xpe 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/kernel/iframe.js +16 -2
  2. package/package.json +17 -19
@@ -727,7 +727,11 @@ function wrapInlineScriptWithSandbox(code) {
727
727
  }
728
728
  function createExecNextScriptContent() {
729
729
  return [
730
- "const sandbox = window.__XPE_INTERNAL_SANDBOX__;",
730
+ // This helper is injected as a classic script repeatedly. `const` would
731
+ // create a global lexical binding and fail on the second queued script
732
+ // (notably when Vite's dev client precedes the app entry). `var` is
733
+ // intentionally used so each queue step remains re-entrant.
734
+ "var sandbox = window.__XPE_INTERNAL_SANDBOX__;",
731
735
  "if(sandbox.execQueue && sandbox.execQueue.length){ sandbox.execQueue.shift()()}",
732
736
  ].join("");
733
737
  }
@@ -1001,9 +1005,19 @@ export function insertScriptToIframe(scriptResult, iframeWindow, rawElement) {
1001
1005
  scriptElement.onerror = afterExecScript;
1002
1006
  }
1003
1007
  container.appendChild(scriptElement);
1004
- if (isOutlineScript && module && isEntry) {
1008
+ // Vite injects an HMR client module before the actual application entry in
1009
+ // development HTML. That client keeps a long-lived websocket and may not
1010
+ // dispatch the module load event in the sandbox, so waiting for it would
1011
+ // prevent the real entry module from ever being inserted. It is not an
1012
+ // application lifecycle module and must not participate in the serial
1013
+ // entry gate.
1014
+ const isViteClientModule = module && /(?:^|\/)@vite\/client(?:$|\?)/.test(src);
1015
+ if (isOutlineScript && module && isEntry && !isViteClientModule) {
1005
1016
  waitForModuleLifecycleReady(iframeWindow, afterExecScript);
1006
1017
  }
1018
+ if (isOutlineScript && isViteClientModule) {
1019
+ afterExecScript();
1020
+ }
1007
1021
  // 调用回调
1008
1022
  callback?.(iframeWindow);
1009
1023
  // 执行 hooks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xpe",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "下一代微前端应用运行底座",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,6 +37,21 @@
37
37
  },
38
38
  "./package.json": "./package.json"
39
39
  },
40
+ "keywords": [
41
+ "micro-frontend",
42
+ "xpe"
43
+ ],
44
+ "devDependencies": {
45
+ "@playwright/test": "^1.60.0",
46
+ "@types/node": "^25.9.3",
47
+ "@vitejs/plugin-vue": "^6.0.7",
48
+ "jsdom": "^29.1.1",
49
+ "typescript": "^5.8.3",
50
+ "vite": "^8.0.16",
51
+ "vitest": "^4.1.8",
52
+ "vue": "^3.5.38",
53
+ "vue-router": "^5.1.0"
54
+ },
40
55
  "scripts": {
41
56
  "clean": "node scripts/clean-dist.mjs",
42
57
  "build": "node scripts/clean-dist.mjs && tsc -p tsconfig.build.json && node scripts/fix-dist-imports.mjs && node scripts/check-dist-surface.mjs",
@@ -51,8 +66,6 @@
51
66
  "check:public-surface": "node scripts/check-public-surface.mjs",
52
67
  "check:release-metadata": "node scripts/check-release-metadata.mjs",
53
68
  "verify": "pnpm run check:release-metadata && pnpm run typecheck && pnpm test && pnpm run build && pnpm run check:pack",
54
- "prepack": "pnpm run build",
55
- "prepublishOnly": "pnpm run verify",
56
69
  "test": "vitest run",
57
70
  "test:watch": "vitest",
58
71
  "typecheck": "pnpm run typecheck:public && pnpm run typecheck:kernel && pnpm run check:host-child-smoke",
@@ -61,20 +74,5 @@
61
74
  "typecheck:kernel": "node scripts/check-kernel-typecheck.mjs",
62
75
  "typecheck:public": "tsc -p tsconfig.json --noEmit",
63
76
  "upstream:status": "node scripts/upstream-status.mjs"
64
- },
65
- "keywords": [
66
- "micro-frontend",
67
- "xpe"
68
- ],
69
- "devDependencies": {
70
- "@playwright/test": "^1.60.0",
71
- "@types/node": "^25.9.3",
72
- "@vitejs/plugin-vue": "^6.0.7",
73
- "jsdom": "^29.1.1",
74
- "typescript": "^5.8.3",
75
- "vite": "^8.0.16",
76
- "vitest": "^4.1.8",
77
- "vue": "^3.5.38",
78
- "vue-router": "^5.1.0"
79
77
  }
80
- }
78
+ }