From 2168153a16e861673abd3b9cb8acf3191d0adab7 Mon Sep 17 00:00:00 2001 From: raoenhui Date: Fri, 29 Nov 2024 16:01:26 +0800 Subject: [PATCH 1/4] Update Contact.md --- Contact.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contact.md b/Contact.md index 0fb92e33..ed898e50 100644 --- a/Contact.md +++ b/Contact.md @@ -1,6 +1,7 @@ 欢迎小伙伴们加入micro-app微信群交流^ ^ -![image](https://github.com/user-attachments/assets/ec331898-9222-48b9-9fd6-8a58bc9a9bf2) +![image](https://github.com/user-attachments/assets/bc2ed2a1-a5a5-4ad7-8a2f-0f3a58507490) + From ce2689e0b150aca101424e42b715b45572976229 Mon Sep 17 00:00:00 2001 From: timhub66 Date: Mon, 2 Dec 2024 20:25:33 +0800 Subject: [PATCH 2/4] fix: 1459 && 1460 --- src/sandbox/scoped_css.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/sandbox/scoped_css.ts b/src/sandbox/scoped_css.ts index 07612754..6856ded0 100644 --- a/src/sandbox/scoped_css.ts +++ b/src/sandbox/scoped_css.ts @@ -107,8 +107,21 @@ class CSSParser { * 6. :where(.a, .b, .c) a {} * should be ==> micro-app[name=xxx] :where(.a, .b, .c) a {} */ - return m[0].replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => { + const attributeValues: {[key: string]: any} = {} + const matchRes = m[0].replace(/\[([^=]+)=?(.+?)\]/g, (match, p1, p2) => { + const mock = `__mock_${p1}Value__` + attributeValues[mock] = p2 + return match.replace(p2, mock) + }) + + return matchRes.replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => { selector = trim(selector) + selector = selector.replace(/\[[^=]+=?(.+?)\]/g, (match:string, p1: string) => { + if (attributeValues[p1]) { + return match.replace(p1, attributeValues[p1]) + } + return match + }) if (selector && !( this.scopecssDisableNextLine || ( @@ -149,7 +162,7 @@ class CSSParser { !this.scopecssDisableNextLine && (!this.scopecssDisable || this.scopecssDisableSelectors.length) ) { - cssValue = cssValue.replace(/url\(["']?([^)"']+)["']?\)/gm, (all, $1) => { + cssValue = cssValue.replace(/url\((["']?)(.*?)\1\)/gm, (all, _, $1) => { if (/^((data|blob):|#|%23)/.test($1) || /^(https?:)?\/\//.test($1)) { return all } From 358199c40352b41d8df848fd0659d76187594e11 Mon Sep 17 00:00:00 2001 From: timhub66 Date: Tue, 3 Dec 2024 10:37:36 +0800 Subject: [PATCH 3/4] fix: 1444 --- src/proxies/worker.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/proxies/worker.ts b/src/proxies/worker.ts index 6152fffa..da30a736 100644 --- a/src/proxies/worker.ts +++ b/src/proxies/worker.ts @@ -8,6 +8,10 @@ interface WorkerOptions { credentials?: 'omit' | 'same-origin' | 'include'; } +const EXCLUDE_URL_PROTOCOLS = [ + 'blob:' +] + interface WorkerInstance extends EventTarget { postMessage(message: any, transfer?: Transferable[]): void; terminate(): void; @@ -20,14 +24,12 @@ interface Worker { const originalWorker = window.Worker function isSameOrigin(url: string | URL): boolean { - if (url instanceof URL && url.protocol === 'blob:') { - // 如果 url 是 Blob URL,直接返回 true - return true - } - - // 检查 URL 是否与当前页面在同一个源 try { - const parsedUrl = new URL(url as string) + // 检查 URL 是否与当前页面在同一个源 + const parsedUrl = url instanceof URL ? url : new URL(url as string) + if (EXCLUDE_URL_PROTOCOLS.includes(parsedUrl.protocol)) { + return true + } return ( parsedUrl.protocol === window.location.protocol && parsedUrl.hostname === window.location.hostname && From da00cf7f6dbb2b3abd694453171e0edbb0e5c55d Mon Sep 17 00:00:00 2001 From: timhub66 Date: Mon, 9 Dec 2024 10:09:05 +0800 Subject: [PATCH 4/4] chore: release rc16 --- docs/zh-cn/changelog.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index a2914677..b33c0979 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -7,6 +7,14 @@ - 修订版本号:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix,则任何时候都可发布) --- +### 1.0.0-rc.16 + +`2024-12-09` +- **Bug Fix** + - 🐞 修复 子应用 使用 blob string url 创建 WebWorker 时报错,[issue 1444](https://github.com/micro-zoe/micro-app/issues/1444)。 +- **Feature** + - 支持 unocss。 + ### 1.0.0-rc.15 `2024-11-22` diff --git a/package.json b/package.json index 1eb93a05..fc096769 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@micro-zoe/micro-app", - "version": "1.0.0-rc.15", + "version": "1.0.0-rc.16", "description": "A lightweight, efficient and powerful micro front-end framework", "private": false, "main": "lib/index.min.js",