Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
timhub66 committed Sep 29, 2024
2 parents d89e456 + 3c91f0d commit dc2581f
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 49 deletions.
3 changes: 2 additions & 1 deletion Contact.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

欢迎小伙伴们加入micro-app微信群交流^ ^

![IMG_0722](https://github.com/user-attachments/assets/4ca7569d-328d-4f28-aabe-f946b23bff3b)
![IMG_0882](https://github.com/user-attachments/assets/aa133812-2920-4f87-80e3-c44778685725)




Expand Down
10 changes: 10 additions & 0 deletions docs/zh-cn/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

---


### 1.0.0-rc.11

`2024-9-14`

- **Bug Fix**
- 🐞 修复 wangEditor-next 富文本插件报错,[issue 1354](https://github.com/micro-zoe/micro-app/issues/1354)
- 🐞 修复 vue3.5中自定义元素defineCustomElement在子应用中报错,[issue 1367](https://github.com/micro-zoe/micro-app/issues/1367)
- 🐞 修复 new Worker 不传第二个参数报错,[issue 1368](https://github.com/micro-zoe/micro-app/issues/1368)

### 1.0.0-rc.10

`2024-9-14`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@micro-zoe/micro-app",
"version": "1.0.0-rc.10",
"version": "1.0.0-rc.11",
"description": "A lightweight, efficient and powerful micro front-end framework",
"private": false,
"main": "lib/index.min.js",
Expand Down
4 changes: 4 additions & 0 deletions src/libs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ export function isDocumentFragment(target: unknown): target is DocumentFragment
return toTypeString(target) === '[object DocumentFragment]'
}

export function isDocumentShadowRoot(target: unknown): target is DocumentFragment {
return toTypeString(target) === '[object ShadowRoot]'
}

export function isMicroAppBody(target: unknown): target is HTMLElement {
return isElement(target) && target.tagName.toUpperCase() === 'MICRO-APP-BODY'
}
Expand Down
18 changes: 13 additions & 5 deletions src/proxies/worker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

import { appInstanceMap } from '../create_app'
import { CompletionPath, getCurrentAppName } from '../libs/utils'

interface WorkerOptions {
name?: string;
type?: 'classic' | 'module';
Expand Down Expand Up @@ -63,8 +66,16 @@ function urlFromScript(script: string) {
// @ts-ignore
const WorkerProxy = new Proxy<Worker>(originalWorker, {
construct(Target, args): WorkerInstance {
const [scriptURL, options] = args
if (!isSameOrigin(scriptURL)) {
let [scriptURL, options] = args
options = options || {}
const appName = getCurrentAppName()
let url = scriptURL
if (appName) {
const app = appInstanceMap.get(appName)
url = CompletionPath(scriptURL, app!.url)
}

if (url && !isSameOrigin(url)) {
// 如果 scriptURL 是跨域的,使用 Blob URL 加载并执行 worker
const script = `import "${scriptURL}";`
const workerPath = urlFromScript(script)
Expand All @@ -77,7 +88,4 @@ const WorkerProxy = new Proxy<Worker>(originalWorker, {
},
})

// @ts-ignore
window.Worker = WorkerProxy

export default WorkerProxy
1 change: 1 addition & 0 deletions src/sandbox/iframe/special_key.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const escape2RawWindowKeys = [
'Array',
'getComputedStyle',
// FIX ISSUE: https://github.com/micro-zoe/micro-app/issues/1292
'DOMParser',
Expand Down
Loading

0 comments on commit dc2581f

Please sign in to comment.