@fulgurjs/federation 5.9.3 → 6.0.0

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 (93) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.en.md +57 -416
  3. package/README.md +56 -446
  4. package/dist/bridge-app-vue.d.cts +1 -1
  5. package/dist/bridge-app-vue.d.ts +1 -1
  6. package/dist/bridge-core.cjs +1 -1
  7. package/dist/bridge-core.js +2 -2
  8. package/dist/bridge-errors.cjs +1 -1
  9. package/dist/bridge-errors.js +1 -1
  10. package/dist/bridge-host-react.cjs +1 -1
  11. package/dist/bridge-host-react.js +3 -3
  12. package/dist/bridge-host-vue.cjs +1 -1
  13. package/dist/bridge-host-vue.js +3 -3
  14. package/dist/bridge-router-react.d.ts +4 -2
  15. package/dist/bridge-router-react.js +95 -9
  16. package/dist/bridge-router-vue.d.ts +24 -5
  17. package/dist/bridge-router-vue.js +4 -5
  18. package/dist/{chunk-YKIFZIBH.js → chunk-77JZ6U6V.js} +1 -1
  19. package/dist/{chunk-Q6V5O5Y6.js → chunk-ENT3BOTX.js} +1 -1
  20. package/dist/{chunk-WRJG2YG6.js → chunk-ZAYNS7YQ.js} +1 -1
  21. package/dist/cli.js +460 -109
  22. package/dist/index.cjs +25 -38
  23. package/dist/index.js +25 -38
  24. package/dist/react.d.ts +194 -101
  25. package/dist/react.js +4 -0
  26. package/dist/runtime-entry.d.ts +9 -174
  27. package/dist/runtime-entry.js +0 -1
  28. package/dist/runtime.js +1 -1
  29. package/dist/vue.d.ts +576 -0
  30. package/dist/vue.js +8 -0
  31. package/docs/en/migration.md +210 -0
  32. package/docs/en/reference/api.md +534 -0
  33. package/docs/en/reference/errors.md +86 -0
  34. package/docs/{P5-vite7-8 → maintainers/P5-vite7-8}/345/205/274/345/256/271/347/237/251/351/230/265.md +7 -9
  35. package/docs/{webpack-mf- → maintainers/webpack-mf-}/345/257/271/347/205/247/344/270/216/347/274/272/345/217/243.md +10 -10
  36. package/docs/maintainers//346/262/231/347/256/261/350/276/271/347/225/214/345/256/241/350/256/241.md +43 -0
  37. package/docs/zh/migration.md +210 -0
  38. package/docs/zh/reference/api.md +533 -0
  39. package/docs/zh/reference/errors.md +86 -0
  40. package/examples/templates/README.md +1 -1
  41. package/examples/templates/react-host-vue-remote/pnpm-workspace.yaml +1 -1
  42. package/examples/templates/react-host-vue-remote/react-host/README.md +2 -2
  43. package/examples/templates/react-host-vue-remote/react-host/package.json +1 -1
  44. package/examples/templates/react-host-vue-remote/react-host/src/main.tsx +2 -2
  45. package/examples/templates/react-host-vue-remote/scripts/dev.config.json +11 -2
  46. package/examples/templates/react-host-vue-remote/vue-remote/package.json +1 -1
  47. package/examples/templates/react-host-vue-remote/vue-remote/src/bridge.ts +1 -1
  48. package/examples/templates/react-react/host/package.json +1 -1
  49. package/examples/templates/react-react/pnpm-workspace.yaml +1 -1
  50. package/examples/templates/react-react/remote/package.json +1 -1
  51. package/examples/templates/react-react/scripts/dev.config.json +11 -2
  52. package/examples/templates/showcase/README.md +6 -6
  53. package/examples/templates/showcase/pnpm-workspace.yaml +1 -1
  54. package/examples/templates/showcase/react-host/package.json +1 -1
  55. package/examples/templates/showcase/react-host/src/pages/BridgeVuePage.tsx +1 -1
  56. package/examples/templates/showcase/react-host/src/routing.ts +1 -1
  57. package/examples/templates/showcase/react-remote/package.json +1 -1
  58. package/examples/templates/showcase/react-remote/src/bridge.tsx +1 -1
  59. package/examples/templates/showcase/scripts/dev.config.json +22 -4
  60. package/examples/templates/showcase/vue-host/package.json +1 -1
  61. package/examples/templates/showcase/vue-host/src/pages/BridgeReactPage.vue +1 -1
  62. package/examples/templates/showcase/vue-host/src/routing.ts +3 -13
  63. package/examples/templates/showcase/vue-remote/package.json +1 -1
  64. package/examples/templates/showcase/vue-remote/src/bridge.ts +2 -2
  65. package/examples/templates/vue-host-react-remote/pnpm-workspace.yaml +1 -1
  66. package/examples/templates/vue-host-react-remote/react-remote/package.json +1 -1
  67. package/examples/templates/vue-host-react-remote/scripts/dev.config.json +11 -2
  68. package/examples/templates/vue-host-react-remote/vue-host/README.md +2 -2
  69. package/examples/templates/vue-host-react-remote/vue-host/package.json +1 -1
  70. package/examples/templates/vue-host-react-remote/vue-host/src/App.vue +2 -2
  71. package/examples/templates/vue-vue/host/package.json +1 -1
  72. package/examples/templates/vue-vue/host/src/main.ts +28 -21
  73. package/examples/templates/vue-vue/host/src/pages/HomePage.vue +1 -1
  74. package/examples/templates/vue-vue/pnpm-workspace.yaml +1 -1
  75. package/examples/templates/vue-vue/remote/package.json +1 -1
  76. package/examples/templates/vue-vue/scripts/dev.config.json +11 -2
  77. package/package.json +24 -37
  78. package/dist/bridge-core-D37VanBl.d.ts +0 -99
  79. package/dist/bridge-host-react-CGymCzD2.d.ts +0 -35
  80. package/dist/bridge-host-vue-B3GHaQAC.d.ts +0 -32
  81. package/dist/bridge-react.d.ts +0 -14
  82. package/dist/bridge-react.js +0 -3
  83. package/dist/bridge-vue.d.ts +0 -8
  84. package/dist/bridge-vue.js +0 -3
  85. package/dist/bridge.d.ts +0 -18
  86. package/dist/bridge.js +0 -5
  87. package/dist/chunk-GLASM5EX.js +0 -1730
  88. package/dist/chunk-V6EASSCR.js +0 -249
  89. package/dist/chunk-X34EJB4H.js +0 -207
  90. package/docs/API.en.md +0 -339
  91. package/docs/API.md +0 -914
  92. package/docs//346/262/231/347/256/261/350/276/271/347/225/214/345/256/241/350/256/241.md +0 -45
  93. package/docs//350/277/201/347/247/273/346/214/207/345/215/227.md +0 -179
@@ -8,7 +8,7 @@
8
8
  </template>
9
9
 
10
10
  <script setup lang="ts">
11
- import { remoteComponent } from '@fulgurjs/federation/runtime'
11
+ import { remoteComponent } from '@fulgurjs/federation/vue'
12
12
 
13
13
  // remoteComponent:首次渲染才真正加载远程模块;失败时插件呈现默认错误占位
14
14
  // (含「重试加载 / 刷新页面重试」),无需自己实现错误组件。
@@ -2,7 +2,7 @@ packages:
2
2
  - host
3
3
  - remote
4
4
  minimumReleaseAgeExclude:
5
- - '@fulgurjs/federation@5.7.1 || 5.8.0 || 5.9.0 || 5.9.1 || 5.9.2'
5
+ - '@fulgurjs/federation@6.0.0'
6
6
  # pnpm >=12 构建脚本批准(12 起弃用 onlyBuiltDependencies;pnpm 9-11 忽略本键:
7
7
  # esbuild >=0.16 二进制经 optionalDependencies 平台包分发,postinstall 仅校验,不阻塞安装)
8
8
  allowBuilds:
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview --port 5213 --strictPort"
10
10
  },
11
11
  "dependencies": {
12
- "@fulgurjs/federation": "5.9.2",
12
+ "@fulgurjs/federation": "6.0.0",
13
13
  "vue": "^3.5.13"
14
14
  },
15
15
  "devDependencies": {
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "apps": [
3
- { "name": "remote", "dir": "remote", "port": 5213 },
4
- { "name": "host", "dir": "host", "port": 5214 }
3
+ {
4
+ "name": "remote",
5
+ "dir": "remote",
6
+ "port": 5213
7
+ },
8
+ {
9
+ "name": "host",
10
+ "dir": "host",
11
+ "port": 5214,
12
+ "host": true
13
+ }
5
14
  ]
6
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fulgurjs/federation",
3
- "version": "5.9.3",
3
+ "version": "6.0.0",
4
4
  "type": "module",
5
5
  "description": "Vite Module Federation for Vue and React: remote modules, shared dependencies and app bridges.",
6
6
  "license": "MIT",
@@ -13,6 +13,10 @@
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
15
  },
16
+ "./vue": {
17
+ "types": "./dist/vue.d.ts",
18
+ "import": "./dist/vue.js"
19
+ },
16
20
  "./runtime": {
17
21
  "types": "./dist/runtime-entry.d.ts",
18
22
  "import": "./dist/runtime-entry.js"
@@ -21,18 +25,6 @@
21
25
  "types": "./dist/react.d.ts",
22
26
  "import": "./dist/react.js"
23
27
  },
24
- "./bridge": {
25
- "types": "./dist/bridge.d.ts",
26
- "import": "./dist/bridge.js"
27
- },
28
- "./bridge/vue": {
29
- "types": "./dist/bridge-vue.d.ts",
30
- "import": "./dist/bridge-vue.js"
31
- },
32
- "./bridge/react": {
33
- "types": "./dist/bridge-react.d.ts",
34
- "import": "./dist/bridge-react.js"
35
- },
36
28
  "./package.json": "./package.json",
37
29
  "./internal/context.js": {
38
30
  "types": "./dist/context.d.ts",
@@ -74,37 +66,29 @@
74
66
  "types": "./dist/bridge-host-react.d.ts",
75
67
  "import": "./dist/bridge-host-react.js"
76
68
  },
77
- "./bridge/router/vue": {
69
+ "./internal/bridge-router-core.js": {
70
+ "types": "./dist/bridge-router-core.d.ts",
71
+ "import": "./dist/bridge-router-core.js"
72
+ },
73
+ "./internal/bridge-router-vue.js": {
78
74
  "types": "./dist/bridge-router-vue.d.ts",
79
75
  "import": "./dist/bridge-router-vue.js"
80
76
  },
81
- "./bridge/router/react": {
77
+ "./internal/bridge-router-react.js": {
82
78
  "types": "./dist/bridge-router-react.d.ts",
83
79
  "import": "./dist/bridge-router-react.js"
84
80
  }
85
81
  },
86
82
  "typesVersions": {
87
83
  "*": {
84
+ "vue": [
85
+ "dist/vue.d.ts"
86
+ ],
88
87
  "runtime": [
89
88
  "dist/runtime-entry.d.ts"
90
89
  ],
91
90
  "react": [
92
91
  "dist/react.d.ts"
93
- ],
94
- "bridge/vue": [
95
- "dist/bridge-vue.d.ts"
96
- ],
97
- "bridge/react": [
98
- "dist/bridge-react.d.ts"
99
- ],
100
- "bridge": [
101
- "dist/bridge.d.ts"
102
- ],
103
- "bridge/router/vue": [
104
- "dist/bridge-router-vue.d.ts"
105
- ],
106
- "bridge/router/react": [
107
- "dist/bridge-router-react.d.ts"
108
92
  ]
109
93
  }
110
94
  },
@@ -116,15 +100,18 @@
116
100
  "CHANGELOG.md",
117
101
  "DESIGN.md",
118
102
  "examples",
119
- "docs/迁移指南.md",
120
- "docs/webpack-mf-对照与缺口.md",
121
- "docs/沙箱边界审计.md",
122
- "docs/P5-vite7-8兼容矩阵.md",
123
- "docs/API.md",
124
- "docs/API.en.md"
103
+ "docs/zh/reference/api.md",
104
+ "docs/zh/reference/errors.md",
105
+ "docs/zh/migration.md",
106
+ "docs/en/reference/api.md",
107
+ "docs/en/reference/errors.md",
108
+ "docs/en/migration.md",
109
+ "docs/maintainers/webpack-mf-对照与缺口.md",
110
+ "docs/maintainers/沙箱边界审计.md",
111
+ "docs/maintainers/P5-vite7-8兼容矩阵.md"
125
112
  ],
126
113
  "scripts": {
127
- "build": "cp ../../README.md README.md && cp ../../README.en.md README.en.md && mkdir -p docs && cp ../../docs/API.md ../../docs/API.en.md ../../docs/迁移指南.md ../../docs/webpack-mf-对照与缺口.md ../../docs/沙箱边界审计.md ../../docs/P5-vite7-8兼容矩阵.md docs/ && cp ../../CHANGELOG.md CHANGELOG.md && cp ../../DESIGN.md DESIGN.md && node scripts/sync-package-examples.mjs && esbuild src/runtime/index.ts --bundle --format=esm --target=es2022 --minify --outfile=dist/runtime.js && node scripts/gen-runtime.mjs && tsup src/index.ts src/pages.ts src/vue-adapter.ts src/react-adapter.ts src/context.ts src/bridge-core.ts src/bridge-errors.ts src/bridge-app-vue.ts src/bridge-app-react.ts src/bridge-host-vue.ts src/bridge-host-react.ts --format esm,cjs --dts --external vite --target node18 --clean && tsup src/runtime-entry.ts --format esm --dts --external vite,vue --target node18 && tsup src/react.ts --format esm --dts --external vite,react --target node18 && tsup src/bridge.ts src/bridge-vue.ts src/bridge-react.ts --format esm --dts --external vite,vue,react,react-dom --target node18 && tsup src/bridge-router-vue.ts --format esm --dts --external vite,vue,vue-router --target node18 && tsup src/bridge-router-react.tsx --format esm --dts --external vite,react,react-dom,react-router-dom --target node18 && esbuild src/cli.ts --bundle --format=esm --target=node18 --platform=node --outfile=dist/cli.js && esbuild src/runtime/index.ts --bundle --format=esm --target=es2022 --minify --outfile=dist/runtime.js && node scripts/gen-runtime-entry.mjs && node scripts/check-gzip.mjs && node scripts/check-manual-codes.mjs",
114
+ "build": "cp ../../README.md README.md && cp ../../README.en.md README.en.md && mkdir -p docs && mkdir -p docs/zh/reference docs/en/reference docs/maintainers && cp ../../docs/zh/reference/api.md ../../docs/zh/reference/errors.md docs/zh/reference/ && cp ../../docs/zh/migration.md docs/zh/ && cp ../../docs/en/reference/api.md ../../docs/en/reference/errors.md docs/en/reference/ && cp ../../docs/en/migration.md docs/en/ && cp ../../docs/maintainers/webpack-mf-对照与缺口.md ../../docs/maintainers/沙箱边界审计.md ../../docs/maintainers/P5-vite7-8兼容矩阵.md docs/maintainers/ && cp ../../CHANGELOG.md CHANGELOG.md && cp ../../DESIGN.md DESIGN.md && node scripts/sync-package-examples.mjs && esbuild src/runtime/index.ts --bundle --format=esm --target=es2022 --minify --outfile=dist/runtime.js && node scripts/gen-runtime.mjs && tsup src/index.ts src/pages.ts src/vue-adapter.ts src/react-adapter.ts src/context.ts src/bridge-core.ts src/bridge-errors.ts src/bridge-app-vue.ts src/bridge-app-react.ts src/bridge-host-vue.ts src/bridge-host-react.ts --format esm,cjs --dts --external vite --target node18 --clean && tsup src/runtime-entry.ts --format esm --dts --external vite --target node18 && tsup src/vue.ts --format esm --dts --external vite,vue,vue-router --target node18 && tsup src/react.ts --format esm --dts --external vite,react,react-dom,react-router-dom --target node18 && tsup src/bridge-router-vue.ts --format esm --dts --external vite,vue,vue-router --target node18 && tsup src/bridge-router-react.tsx --format esm --dts --external vite,react,react-dom,react-router-dom --target node18 && esbuild src/cli.ts --bundle --format=esm --target=node18 --platform=node --outfile=dist/cli.js && esbuild src/runtime/index.ts --bundle --format=esm --target=es2022 --minify --outfile=dist/runtime.js && node scripts/gen-runtime-entry.mjs && node scripts/check-gzip.mjs && node scripts/check-manual-codes.mjs",
128
115
  "dev": "tsup --watch",
129
116
  "test": "vitest run --dir tests",
130
117
  "typecheck": "tsc --noEmit",
@@ -1,99 +0,0 @@
1
- /** 统一逻辑位置:pathname 以 / 开头;search 空串或 ? 开头;hash 空串或 # 开头 */
2
- interface BridgeLocation {
3
- pathname: string;
4
- search: string;
5
- hash: string;
6
- }
7
- type BridgeNavigationResult = {
8
- status: 'committed';
9
- location: BridgeLocation;
10
- } | {
11
- status: 'cancelled';
12
- location: BridgeLocation;
13
- };
14
- /** 宿主导航端口(宿主适配器把 Router 包装成本接口;逻辑路径不含部署 base) */
15
- interface BridgeHostNavigation {
16
- getLocation(): BridgeLocation;
17
- subscribe(listener: (location: BridgeLocation) => void): () => void;
18
- navigate(target: BridgeLocation, action: 'push' | 'replace', options?: {
19
- signal?: AbortSignal;
20
- }): Promise<BridgeNavigationResult>;
21
- go(delta: number): void;
22
- }
23
- /** 子应用路由通道(桥接宿主按挂载代次创建,随 mount 第三参数交给子应用) */
24
- interface BridgeChildRoute {
25
- /**
26
- * 远程 spec(宿主创建通道时标注,如 "remote-b/bridge");子应用路由接线
27
- * (connectVueBridgeRouter/createReactBridgeRouter)的诊断错误用它定位真实远程,
28
- * 缺省(纯 memory 小部件自建通道)回退 'child-router'。
29
- */
30
- readonly spec?: string;
31
- getLocation(): BridgeLocation;
32
- subscribe(listener: (location: BridgeLocation) => void): () => void;
33
- navigate(target: BridgeLocation, action: 'push' | 'replace'): Promise<BridgeNavigationResult>;
34
- go(delta: number): void;
35
- }
36
- /** 挂载控制参数(mount 第三参数;不混入业务 props) */
37
- interface BridgeMountOptions {
38
- signal?: AbortSignal;
39
- routing?: BridgeChildRoute;
40
- }
41
- /** 子应用路由协议声明(defineBridgeApp(工厂, { routing: true }) 时写入) */
42
- interface BridgeRoutingProtocol {
43
- protocol: 1;
44
- }
45
- /** 宿主组件 routing prop(独立控制通道,不进 appProps/Context) */
46
- interface BridgeHostRouting {
47
- /** 宿主路由视角的静态绝对路径,如 "/approval";同页各同步实例不得相同或重叠 */
48
- basePath: string;
49
- navigation: BridgeHostNavigation;
50
- }
51
-
52
- /**
53
- * 跨应用上下文标准字段表(§4.3,0.8.2 精简后)。
54
- *
55
- * 读写约定:宿主桥先写标准字段;远程 boot 只增不改宿主键;
56
- * 嵌套对象(如 events)是引用共享,子应用挂属性即时可见(同 realm 直引用)。
57
- *
58
- * 精简记录(0.8.2):`token` 快照与 `formUrl`/`baseUrl` 从默认 provide 集合移除——
59
- * token 快照与 getToken 函数引用重复(快照会过期),formUrl/baseUrl 自 0.7.0
60
- * remoteComponent 直渲染后无消费点;项目如需可经扩展位自行提供。
61
- */
62
- interface AppContext {
63
- /** 宿主登录用户原始形态(只读约定) */
64
- user: Record<string, any>;
65
- /** 取最新 token(拉取式防过期;0.8.2 起 bridge 不再传一次性 token 快照,用本函数取值) */
66
- getToken?: () => string | undefined;
67
- /** 宿主 pinia 实例:子应用 useUserStore(ctx.store) 拿共享响应式状态 */
68
- store?: unknown;
69
- /** 宿主 Vue App 实例(同 realm 直引用):全局组件/指令注册目标 */
70
- hostApp?: unknown;
71
- /** EP locale 等 UI 配置(原 W4 字段) */
72
- locale?: unknown;
73
- /** 事件/方法池:events.main.* 宿主提供、events.bpm.* / events.lowcode.* 子应用反向注册 */
74
- events?: Record<string, any>;
75
- /**
76
- * 非敏感登录代次 ID:宿主每次成功登录/重新登录生成新值,token 刷新但会话未变时沿用。
77
- * 远程 onSession 按它去重(同一代次只执行一次)。不是用户 ID、不是 token、不作为授权凭证。
78
- * 远程声明了 onSession 时必填(缺省即 MFU-013)。
79
- */
80
- sessionKey?: string;
81
- /** 项目扩展位(formUrl/baseUrl 等自定义键,按需自行提供) */
82
- [key: string]: unknown;
83
- }
84
-
85
- /** 子应用桥接契约(远程 ./bridge 模块的默认导出;任务书 §3.2) */
86
- interface BridgeApp {
87
- /** 首次根提交完成时才算挂载成功;同一容器未卸载前重复 mount 是契约违例 */
88
- mount(el: HTMLElement, props?: Record<string, unknown>, options?: BridgeMountOptions): void | Promise<void>;
89
- /** 同步使当前挂载代次失效并清理已创建的 root;未知容器为 no-op */
90
- unmount(el: HTMLElement): void;
91
- /**
92
- * 路由协议声明(URL 同步):defineBridgeApp(工厂, { routing: true }) 时写入
93
- * { protocol: 1 }。宿主启用 routing 时必须存在且 protocol === 1(MFU-031),
94
- * 不允许静默退回 memory 假装深链成功。
95
- */
96
- routing?: BridgeRoutingProtocol;
97
- }
98
-
99
- export type { AppContext as A, BridgeHostRouting as B, BridgeApp as a };
@@ -1,35 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { A as AppContext } from './bridge-core-D37VanBl.js';
3
-
4
- /**
5
- * React 宿主桥接工厂(/bridge、/bridge/react 导出 createReactBridgeApp;任务书 §3.4)。
6
- *
7
- * 定位:接收注入的 loadRemote(不静态引用运行时内核,dist 壳绑定),返回
8
- * `ComponentType<{ appProps: P; sessionKey?: string | null }>`,负责:
9
- * - DOM 所有权(§4.5):只创建并保持稳定的空挂载 el(fragment 的固定子节点);
10
- * pending/error 占位是它的兄弟节点,宿主重渲染不 patch 子应用 root 内部;
11
- * - 会话代次(§4.3):受控 sessionKey 驱动 挂载/换会话/登出;同会话重渲染不重挂;
12
- * - StrictMode 安全(§4.5):双 effect 走 cleanup(作废+卸载)→setup(新代次) 顺序,
13
- * 顺序 unmount/mount 不产生双实例或残留;
14
- * - unmount 抛错(BN09):报告 MFU-016(phase: unmount)并封锁该容器的新挂载。
15
- *
16
- * appProps 是挂载时浅拷贝快照(顶层替换不追踪,重挂由 key 重建);sessionKey
17
- * 是桥接控制参数,不混入业务 props。
18
- */
19
-
20
- /** 渲染函数形态的错误占位:(error, retry) => ReactNode */
21
- type BridgeErrorFallback = (error: unknown, retry: () => void) => ReactNode;
22
- interface ReactBridgeAppOptions {
23
- /** 加载 pending 占位(默认 null) */
24
- fallback?: ReactNode;
25
- /** 加载/挂载失败占位;默认内置中文诊断 + 「重试加载 / 刷新页面重试」 */
26
- error?: ReactNode | BridgeErrorFallback;
27
- /** 透传现行 loadRemote 的重试选项(0-10 整数),不另叠自动重试 */
28
- retries?: number;
29
- /** 本次桥接加载等待上限 ms;不取消已发出的共享请求,迟到结果一律丢弃 */
30
- timeout?: number;
31
- /** 无副作用的同步 getter:首次、重试及换会话的实际加载前返回本次所需上下文快照 */
32
- getContext?: () => Partial<AppContext> & Record<string, unknown>;
33
- }
34
-
35
- export type { BridgeErrorFallback as B, ReactBridgeAppOptions as R };
@@ -1,32 +0,0 @@
1
- import { Component } from 'vue';
2
- import { A as AppContext } from './bridge-core-D37VanBl.js';
3
-
4
- /**
5
- * Vue 宿主桥接工厂(/bridge、/bridge/vue 导出 createVueBridgeApp;任务书 §3.4)。
6
- *
7
- * 定位:接收注入的 loadRemote(不静态引用运行时内核,dist 壳绑定),返回一个
8
- * 包装组件 `{ appProps: P; sessionKey?: string | null }`,负责:
9
- * - DOM 所有权(§4.5):只创建并保持稳定的空挂载 el(多根 fragment 的固定子节点);
10
- * pending/error 占位是它的兄弟节点,宿主重渲染不 patch 子应用 root 内部;
11
- * - 会话代次(§4.3):受控 sessionKey 驱动 挂载/换会话/登出;同会话重渲染不重挂;
12
- * - 错误诊断:契约非法 MFU-015、生命周期失败 MFU-016(phase 区分)、会话矛盾 MFU-017;
13
- * 默认占位含「重试加载 / 刷新页面重试」两条恢复操作(§4.4)。
14
- *
15
- * appProps 是挂载时浅拷贝快照(顶层替换不追踪、不重渲染子应用,重挂由 :key 重建);
16
- * sessionKey 是桥接控制参数,不混入业务 props。
17
- */
18
-
19
- interface VueBridgeAppOptions {
20
- /** 加载 pending 占位组件(默认无占位节点) */
21
- loadingComponent?: Component;
22
- /** 加载/挂载失败占位(完全接管,契约不变:只接收 error prop;默认内置中文诊断 + 两条恢复操作) */
23
- errorComponent?: Component;
24
- /** 透传现行 loadRemote 的重试选项(0-10 整数),不另叠自动重试 */
25
- retries?: number;
26
- /** 本次桥接加载等待上限 ms;不取消已发出的共享请求,迟到结果一律丢弃 */
27
- timeout?: number;
28
- /** 无副作用的同步 getter:首次、重试及换会话的实际加载前返回本次所需上下文快照 */
29
- getContext?: () => Partial<AppContext> & Record<string, unknown>;
30
- }
31
-
32
- export type { VueBridgeAppOptions as V };
@@ -1,14 +0,0 @@
1
- import * as react from 'react';
2
- import { B as BridgeHostRouting } from './bridge-core-D37VanBl.js';
3
- export { A as AppContext, a as BridgeApp } from './bridge-core-D37VanBl.js';
4
- import { R as ReactBridgeAppOptions } from './bridge-host-react-CGymCzD2.js';
5
- export { B as BridgeErrorFallback } from './bridge-host-react-CGymCzD2.js';
6
-
7
- /** React 宿主桥接工厂:返回 `ComponentType<{ appProps: P; sessionKey?: string | null }>` */
8
- declare const createReactBridgeApp: <P = Record<string, unknown>>(spec: string, options?: ReactBridgeAppOptions) => react.ComponentType<{
9
- appProps?: P;
10
- sessionKey?: string | null;
11
- routing?: BridgeHostRouting;
12
- }>;
13
-
14
- export { ReactBridgeAppOptions, createReactBridgeApp };
@@ -1,3 +0,0 @@
1
- import { loadRemote } from "./runtime.js";
2
- import { createReactBridgeAppWithLoader } from "./bridge-host-react.js";
3
- export const createReactBridgeApp = createReactBridgeAppWithLoader(loadRemote);
@@ -1,8 +0,0 @@
1
- import * as vue from 'vue';
2
- import { V as VueBridgeAppOptions } from './bridge-host-vue-B3GHaQAC.js';
3
- export { A as AppContext, a as BridgeApp } from './bridge-core-D37VanBl.js';
4
-
5
- /** Vue 宿主桥接工厂:返回 `{ appProps: P; sessionKey?: string | null }` 形态的包装组件 */
6
- declare const createVueBridgeApp: <P = Record<string, unknown>>(spec: string, options?: VueBridgeAppOptions) => vue.Component;
7
-
8
- export { VueBridgeAppOptions, createVueBridgeApp };
@@ -1,3 +0,0 @@
1
- import { loadRemote } from "./runtime.js";
2
- import { createVueBridgeAppWithLoader } from "./bridge-host-vue.js";
3
- export const createVueBridgeApp = createVueBridgeAppWithLoader(loadRemote);
package/dist/bridge.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import * as react from 'react';
2
- import { B as BridgeHostRouting } from './bridge-core-D37VanBl.js';
3
- export { A as AppContext, a as BridgeApp } from './bridge-core-D37VanBl.js';
4
- import { R as ReactBridgeAppOptions } from './bridge-host-react-CGymCzD2.js';
5
- export { B as BridgeErrorFallback } from './bridge-host-react-CGymCzD2.js';
6
- import * as vue from 'vue';
7
- import { V as VueBridgeAppOptions } from './bridge-host-vue-B3GHaQAC.js';
8
-
9
- /** Vue 宿主桥接工厂:返回 `{ appProps: P; sessionKey?: string | null }` 形态的包装组件 */
10
- declare const createVueBridgeApp: <P = Record<string, unknown>>(spec: string, options?: VueBridgeAppOptions) => vue.Component;
11
- /** React 宿主桥接工厂:返回 `ComponentType<{ appProps: P; sessionKey?: string | null }>` */
12
- declare const createReactBridgeApp: <P = Record<string, unknown>>(spec: string, options?: ReactBridgeAppOptions) => react.ComponentType<{
13
- appProps?: P;
14
- sessionKey?: string | null;
15
- routing?: BridgeHostRouting;
16
- }>;
17
-
18
- export { ReactBridgeAppOptions, VueBridgeAppOptions, createReactBridgeApp, createVueBridgeApp };
package/dist/bridge.js DELETED
@@ -1,5 +0,0 @@
1
- import { loadRemote } from "./runtime.js";
2
- import { createVueBridgeAppWithLoader } from "./bridge-host-vue.js";
3
- import { createReactBridgeAppWithLoader } from "./bridge-host-react.js";
4
- export const createVueBridgeApp = createVueBridgeAppWithLoader(loadRemote);
5
- export const createReactBridgeApp = createReactBridgeAppWithLoader(loadRemote);