Skip to content

Commit 10a217a

Browse files
committed
Merge branch 'dev'
2 parents 2a20f4e + da00cf7 commit 10a217a

File tree

5 files changed

+35
-11
lines changed

5 files changed

+35
-11
lines changed

Contact.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
欢迎小伙伴们加入micro-app微信群交流^ ^
3-
![image](https://github.com/user-attachments/assets/ec331898-9222-48b9-9fd6-8a58bc9a9bf2)
3+
![image](https://github.com/user-attachments/assets/bc2ed2a1-a5a5-4ad7-8a2f-0f3a58507490)
4+
45

56

67

docs/zh-cn/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
- 修订版本号:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix,则任何时候都可发布)
88

99
---
10+
### 1.0.0-rc.16
11+
12+
`2024-12-09`
13+
- **Bug Fix**
14+
- 🐞 修复 子应用 使用 blob string url 创建 WebWorker 时报错,[issue 1444](https://github.com/micro-zoe/micro-app/issues/1444)
15+
- **Feature**
16+
- 支持 unocss。
17+
1018
### 1.0.0-rc.15
1119

1220
`2024-11-22`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-zoe/micro-app",
3-
"version": "1.0.0-rc.15",
3+
"version": "1.0.0-rc.16",
44
"description": "A lightweight, efficient and powerful micro front-end framework",
55
"private": false,
66
"main": "lib/index.min.js",

src/proxies/worker.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ interface WorkerOptions {
88
credentials?: 'omit' | 'same-origin' | 'include';
99
}
1010

11+
const EXCLUDE_URL_PROTOCOLS = [
12+
'blob:'
13+
]
14+
1115
interface WorkerInstance extends EventTarget {
1216
postMessage(message: any, transfer?: Transferable[]): void;
1317
terminate(): void;
@@ -20,14 +24,12 @@ interface Worker {
2024
const originalWorker = window.Worker
2125

2226
function isSameOrigin(url: string | URL): boolean {
23-
if (url instanceof URL && url.protocol === 'blob:') {
24-
// 如果 url 是 Blob URL,直接返回 true
25-
return true
26-
}
27-
28-
// 检查 URL 是否与当前页面在同一个源
2927
try {
30-
const parsedUrl = new URL(url as string)
28+
// 检查 URL 是否与当前页面在同一个源
29+
const parsedUrl = url instanceof URL ? url : new URL(url as string)
30+
if (EXCLUDE_URL_PROTOCOLS.includes(parsedUrl.protocol)) {
31+
return true
32+
}
3133
return (
3234
parsedUrl.protocol === window.location.protocol &&
3335
parsedUrl.hostname === window.location.hostname &&

src/sandbox/scoped_css.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,21 @@ class CSSParser {
107107
* 6. :where(.a, .b, .c) a {}
108108
* should be ==> micro-app[name=xxx] :where(.a, .b, .c) a {}
109109
*/
110-
return m[0].replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => {
110+
const attributeValues: {[key: string]: any} = {}
111+
const matchRes = m[0].replace(/\[([^=]+)=?(.+?)\]/g, (match, p1, p2) => {
112+
const mock = `__mock_${p1}Value__`
113+
attributeValues[mock] = p2
114+
return match.replace(p2, mock)
115+
})
116+
117+
return matchRes.replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => {
111118
selector = trim(selector)
119+
selector = selector.replace(/\[[^=]+=?(.+?)\]/g, (match:string, p1: string) => {
120+
if (attributeValues[p1]) {
121+
return match.replace(p1, attributeValues[p1])
122+
}
123+
return match
124+
})
112125
if (selector && !(
113126
this.scopecssDisableNextLine ||
114127
(
@@ -149,7 +162,7 @@ class CSSParser {
149162
!this.scopecssDisableNextLine &&
150163
(!this.scopecssDisable || this.scopecssDisableSelectors.length)
151164
) {
152-
cssValue = cssValue.replace(/url\(["']?([^)"']+)["']?\)/gm, (all, $1) => {
165+
cssValue = cssValue.replace(/url\((["']?)(.*?)\1\)/gm, (all, _, $1) => {
153166
if (/^((data|blob):|#|%23)/.test($1) || /^(https?:)?\/\//.test($1)) {
154167
return all
155168
}

0 commit comments

Comments
 (0)