@fulgurjs/federation 5.9.3 → 6.1.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 (104) hide show
  1. package/CHANGELOG.md +66 -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 +22 -3
  15. package/dist/bridge-router-react.js +107 -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-adapter.d.cts +7 -0
  25. package/dist/react-adapter.d.ts +7 -0
  26. package/dist/react.d.ts +229 -101
  27. package/dist/react.js +4 -0
  28. package/dist/runtime-entry.d.ts +27 -174
  29. package/dist/runtime-entry.js +0 -1
  30. package/dist/runtime.js +19 -17
  31. package/dist/vue-adapter.cjs +13 -1
  32. package/dist/vue-adapter.d.cts +1 -0
  33. package/dist/vue-adapter.d.ts +1 -0
  34. package/dist/vue-adapter.js +14 -2
  35. package/dist/vue.d.ts +594 -0
  36. package/dist/vue.js +8 -0
  37. package/docs/en/migration.md +210 -0
  38. package/docs/en/reference/api.md +555 -0
  39. package/docs/en/reference/errors.md +86 -0
  40. package/docs/{P5-vite7-8 → maintainers/P5-vite7-8}/345/205/274/345/256/271/347/237/251/351/230/265.md +7 -9
  41. 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
  42. package/docs/maintainers//346/262/231/347/256/261/350/276/271/347/225/214/345/256/241/350/256/241.md +43 -0
  43. package/docs/zh/migration.md +210 -0
  44. package/docs/zh/reference/api.md +551 -0
  45. package/docs/zh/reference/errors.md +86 -0
  46. package/examples/templates/README.md +1 -1
  47. package/examples/templates/react-host-vue-remote/pnpm-lock.yaml +7 -7
  48. package/examples/templates/react-host-vue-remote/pnpm-workspace.yaml +1 -1
  49. package/examples/templates/react-host-vue-remote/react-host/README.md +2 -2
  50. package/examples/templates/react-host-vue-remote/react-host/package.json +1 -1
  51. package/examples/templates/react-host-vue-remote/react-host/src/main.tsx +2 -2
  52. package/examples/templates/react-host-vue-remote/scripts/dev.config.json +11 -2
  53. package/examples/templates/react-host-vue-remote/vue-remote/package.json +1 -1
  54. package/examples/templates/react-host-vue-remote/vue-remote/src/bridge.ts +1 -1
  55. package/examples/templates/react-react/host/package.json +1 -1
  56. package/examples/templates/react-react/pnpm-lock.yaml +7 -7
  57. package/examples/templates/react-react/pnpm-workspace.yaml +1 -1
  58. package/examples/templates/react-react/remote/package.json +1 -1
  59. package/examples/templates/react-react/scripts/dev.config.json +11 -2
  60. package/examples/templates/showcase/README.md +6 -6
  61. package/examples/templates/showcase/pnpm-lock.yaml +11 -11
  62. package/examples/templates/showcase/pnpm-workspace.yaml +1 -1
  63. package/examples/templates/showcase/react-host/package.json +1 -1
  64. package/examples/templates/showcase/react-host/src/pages/BridgeVuePage.tsx +1 -1
  65. package/examples/templates/showcase/react-host/src/routing.ts +1 -1
  66. package/examples/templates/showcase/react-remote/package.json +1 -1
  67. package/examples/templates/showcase/react-remote/src/bridge.tsx +1 -1
  68. package/examples/templates/showcase/scripts/dev.config.json +22 -4
  69. package/examples/templates/showcase/vue-host/package.json +1 -1
  70. package/examples/templates/showcase/vue-host/src/pages/BridgeReactPage.vue +1 -1
  71. package/examples/templates/showcase/vue-host/src/routing.ts +3 -13
  72. package/examples/templates/showcase/vue-remote/package.json +1 -1
  73. package/examples/templates/showcase/vue-remote/src/bridge.ts +2 -2
  74. package/examples/templates/vue-host-react-remote/pnpm-lock.yaml +7 -7
  75. package/examples/templates/vue-host-react-remote/pnpm-workspace.yaml +1 -1
  76. package/examples/templates/vue-host-react-remote/react-remote/package.json +1 -1
  77. package/examples/templates/vue-host-react-remote/scripts/dev.config.json +11 -2
  78. package/examples/templates/vue-host-react-remote/vue-host/README.md +2 -2
  79. package/examples/templates/vue-host-react-remote/vue-host/package.json +1 -1
  80. package/examples/templates/vue-host-react-remote/vue-host/src/App.vue +2 -2
  81. package/examples/templates/vue-vue/host/package.json +1 -1
  82. package/examples/templates/vue-vue/host/src/main.ts +28 -21
  83. package/examples/templates/vue-vue/host/src/pages/HomePage.vue +1 -1
  84. package/examples/templates/vue-vue/pnpm-lock.yaml +7 -7
  85. package/examples/templates/vue-vue/pnpm-workspace.yaml +1 -1
  86. package/examples/templates/vue-vue/remote/package.json +1 -1
  87. package/examples/templates/vue-vue/scripts/dev.config.json +11 -2
  88. package/package.json +24 -37
  89. package/dist/bridge-core-D37VanBl.d.ts +0 -99
  90. package/dist/bridge-host-react-CGymCzD2.d.ts +0 -35
  91. package/dist/bridge-host-vue-B3GHaQAC.d.ts +0 -32
  92. package/dist/bridge-react.d.ts +0 -14
  93. package/dist/bridge-react.js +0 -3
  94. package/dist/bridge-vue.d.ts +0 -8
  95. package/dist/bridge-vue.js +0 -3
  96. package/dist/bridge.d.ts +0 -18
  97. package/dist/bridge.js +0 -5
  98. package/dist/chunk-GLASM5EX.js +0 -1730
  99. package/dist/chunk-V6EASSCR.js +0 -249
  100. package/dist/chunk-X34EJB4H.js +0 -207
  101. package/docs/API.en.md +0 -339
  102. package/docs/API.md +0 -914
  103. package/docs//346/262/231/347/256/261/350/276/271/347/225/214/345/256/241/350/256/241.md +0 -45
  104. package/docs//350/277/201/347/247/273/346/214/207/345/215/227.md +0 -179
@@ -97,7 +97,7 @@ function invalidBridgeContractError(spec, mod) {
97
97
  `\u73B0\u8C61\uFF1A\u8FDC\u7A0B\u6A21\u5757 "${spec}" \u7684\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F\u5408\u6CD5\u7684\u6865\u63A5\u5951\u7EA6\uFF08BridgeApp\uFF09\u3002
98
98
  \u6839\u56E0: \u5BFC\u51FA\u503C\u4E3A ${actual}` + (missing.length ? `\uFF0C\u7F3A\u5C11\u51FD\u6570\u7C7B\u578B\u7684 ${missing.map((m) => `"${m}"`).join(" / ")} \u5BFC\u51FA\u3002` : "\u3002") + `
99
99
  \u4FEE\u6CD5: \u8FDC\u7A0B\u4FA7\u7528 defineBridgeApp(...) \u521B\u5EFA\u5951\u7EA6\u5E76\u4F5C\u4E3A\u6A21\u5757\u9ED8\u8BA4\u5BFC\u51FA\u2014\u2014
100
- Vue \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/runtime'\uFF1B
100
+ Vue \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/vue'\uFF1B
101
101
  React \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/react'\u3002
102
102
  \u5951\u7EA6\u5FC5\u987B\u5305\u542B mount(el, props?) \u4E0E unmount(el) \u4E24\u4E2A\u51FD\u6570\u3002`,
103
103
  { spec, missing, actual }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RoutingChannel,
3
3
  assertBridgeRoutingProtocol
4
- } from "./chunk-YKIFZIBH.js";
4
+ } from "./chunk-77JZ6U6V.js";
5
5
  import {
6
6
  acquireBridgeSession,
7
7
  assertBridgeContract,
@@ -10,10 +10,10 @@ import {
10
10
  releaseBridgeSession,
11
11
  resolveBridgeContext,
12
12
  withBridgeTimeout
13
- } from "./chunk-Q6V5O5Y6.js";
13
+ } from "./chunk-ENT3BOTX.js";
14
14
  import {
15
15
  bridgeHostError
16
- } from "./chunk-WRJG2YG6.js";
16
+ } from "./chunk-ZAYNS7YQ.js";
17
17
  import {
18
18
  provideAppContext
19
19
  } from "./chunk-TSYLDY6H.js";
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { RouteObject } from 'react-router-dom';
2
+ import { createMemoryRouter, RouterProvider, RouteObject } from 'react-router-dom';
3
3
 
4
4
  /** 统一逻辑位置:pathname 以 / 开头;search 空串或 ? 开头;hash 空串或 # 开头 */
5
5
  interface BridgeLocation {
@@ -43,7 +43,7 @@ interface BridgeHostRouting {
43
43
  navigation: BridgeHostNavigation;
44
44
  }
45
45
 
46
- /** React Router data router 的宿主端口与子应用 memory router 接线(按需入口)。 */
46
+ /** React Router data router 的宿主导航端口与子应用 memory router 接线(统一入口 /react 提供)。 */
47
47
 
48
48
  type ReactBridgeCancelPolicy = (next: BridgeLocation) => boolean;
49
49
  interface ReactDataRouterLike {
@@ -68,6 +68,12 @@ interface ReactDataRouterLike {
68
68
  replace?: boolean;
69
69
  }): void | Promise<void>;
70
70
  }
71
+ type ReactRouterModule = {
72
+ createMemoryRouter: typeof createMemoryRouter;
73
+ RouterProvider: typeof RouterProvider;
74
+ };
75
+ /** 内部时序缝隙:等待模块级预热落定(仅测试使用;生产代码不需要等待——未就绪时走惰性宿主) */
76
+ declare const __reactRouterDomReady: Promise<void>;
71
77
  /** canNavigate 是可选预判;最终结果同时核对真实 blocker 与已提交位置。 */
72
78
  declare function createReactBridgeNavigation(router: ReactDataRouterLike, options?: {
73
79
  canNavigate?: ReactBridgeCancelPolicy;
@@ -76,10 +82,23 @@ declare function createReactBridgeNavigation(router: ReactDataRouterLike, option
76
82
  interface ReactBridgeRouterConnection {
77
83
  element: ReactElement;
78
84
  dispose(): void;
85
+ /**
86
+ * 已接线 memory router 的就绪合同(可加性导出):
87
+ * fast 路径(预热已就绪)= 同步已 resolve 的 Promise(element.props.router 等价);
88
+ * slow 路径(预热未落定/缺依赖)= 惰性宿主接线完成时 resolve(缺依赖时 reject 清晰错误)。
89
+ * 宿主内省请优先用它,不要假设 element.props.router 同步存在。
90
+ */
91
+ routerReady: Promise<WiredRouter['router']>;
92
+ }
93
+ /** 已接线的 memory router(fast 路径同步产出;slow 路径由惰性宿主补挂) */
94
+ interface WiredRouter {
95
+ router: ReturnType<ReactRouterModule['createMemoryRouter']>;
96
+ RouterProvider: ReactRouterModule['RouterProvider'];
97
+ dispose(): void;
79
98
  }
80
99
  /** 返回 RouterProvider 元素,直接作为 defineBridgeApp 工厂的 ReactElement 返回值。 */
81
100
  declare function createReactBridgeRouter(routing: BridgeChildRoute, routes: RouteObject[], options?: {
82
101
  signal?: AbortSignal;
83
102
  }): ReactBridgeRouterConnection;
84
103
 
85
- export { type BridgeHostRouting, type ReactBridgeCancelPolicy, type ReactBridgeRouterConnection, type ReactDataRouterLike, createReactBridgeNavigation, createReactBridgeRouter };
104
+ export { type BridgeHostRouting, type ReactBridgeCancelPolicy, type ReactBridgeRouterConnection, type ReactDataRouterLike, __reactRouterDomReady, createReactBridgeNavigation, createReactBridgeRouter };
@@ -1,6 +1,5 @@
1
1
  // src/bridge-router-react.tsx
2
- import { createElement } from "react";
3
- import { RouterProvider, createMemoryRouter } from "react-router-dom";
2
+ import { createElement, useEffect, useState } from "react";
4
3
 
5
4
  // src/runtime/errors.ts
6
5
  var FgError = class extends Error {
@@ -118,6 +117,24 @@ function connectChildNavigation(routing, apply, onError) {
118
117
  }
119
118
 
120
119
  // src/bridge-router-react.tsx
120
+ var routerDomModule = null;
121
+ var routerDomFailure = null;
122
+ var routerDomReady = import("react-router-dom").then(
123
+ (m) => {
124
+ const candidate = m;
125
+ if (candidate && typeof candidate.createMemoryRouter === "function" && typeof candidate.RouterProvider === "function") {
126
+ routerDomModule = candidate;
127
+ } else {
128
+ routerDomFailure = new Error(
129
+ "[fulgurjs] react-router-dom \u672A\u5B89\u88C5\u6216\u4E0D\u53EF\u7528\uFF08createMemoryRouter/RouterProvider \u7F3A\u5931\uFF09\u3002createReactBridgeRouter\uFF08URL \u540C\u6B65\u53D7\u63A7\u8DEF\u7531\uFF09\u9700\u8981 react-router-dom \u22656.11\uFF1B\u4E0D\u4F7F\u7528\u8DEF\u7531\u540C\u6B65\u7684\u7EAF React \u7EC4\u4EF6\u5DE5\u7A0B\u65E0\u9700\u5B89\u88C5\u3002"
130
+ );
131
+ }
132
+ },
133
+ (e) => {
134
+ routerDomFailure = e;
135
+ }
136
+ );
137
+ var __reactRouterDomReady = routerDomReady;
121
138
  function createReactBridgeNavigation(router, options = {}) {
122
139
  const base = options.basename && options.basename !== "/" ? options.basename.replace(/\/$/, "") : "";
123
140
  const toLogic = () => {
@@ -205,15 +222,16 @@ function createReactBridgeNavigation(router, options = {}) {
205
222
  }
206
223
  };
207
224
  }
208
- function createReactBridgeRouter(routing, routes, options = {}) {
225
+ function wireReactBridgeRouter(m, routing, routes, options) {
209
226
  const init = routing.getLocation();
210
- const router = createMemoryRouter(routes, { initialEntries: [init.pathname + init.search + init.hash] });
227
+ const router = m.createMemoryRouter(routes, { initialEntries: [init.pathname + init.search + init.hash] });
211
228
  const navigate = router.navigate.bind(router);
212
229
  let disposed = false;
230
+ const report = collapseConsecutiveReports((error) => console.error("[fulgurjs] \u5B50\u5E94\u7528 React \u8DEF\u7531\u540C\u6B65\u5931\u8D25\uFF1A", error));
213
231
  const sync = connectChildNavigation(routing, async (loc) => {
214
232
  const cur = router.state.location;
215
233
  if (!sameLocation(cur, loc)) await navigate(loc.pathname + loc.search + loc.hash, { replace: true });
216
- }, collapseConsecutiveReports((error) => console.error("[fulgurjs] \u5B50\u5E94\u7528 React \u8DEF\u7531\u540C\u6B65\u5931\u8D25\uFF1A", error)));
234
+ }, report);
217
235
  router.navigate = ((to, options2) => {
218
236
  if (typeof to === "number") {
219
237
  if (!disposed) routing.go(to);
@@ -225,7 +243,7 @@ function createReactBridgeRouter(routing, routes, options = {}) {
225
243
  return { pathname: l.pathname, search: l.search, hash: l.hash };
226
244
  }, options2?.replace ? "replace" : "push").then(() => {
227
245
  });
228
- void task.catch(collapseConsecutiveReports((error) => console.error("[fulgurjs] \u5B50\u5E94\u7528 React \u8DEF\u7531\u540C\u6B65\u5931\u8D25\uFF1A", error)));
246
+ void task.catch(report);
229
247
  return task;
230
248
  });
231
249
  let unwatch = () => {
@@ -236,22 +254,102 @@ function createReactBridgeRouter(routing, routes, options = {}) {
236
254
  const actual = router.state.location;
237
255
  if (!sameLocation(actual, init)) void sync.enqueue(async () => actual, "replace").catch((error) => console.error("[fulgurjs] \u521D\u59CB React \u8DEF\u7531\u540C\u6B65\u5931\u8D25\uFF1A", error));
238
256
  });
239
- const connection = {
240
- element: createElement(RouterProvider, { router }),
257
+ const wired = {
258
+ router,
259
+ RouterProvider: m.RouterProvider,
241
260
  dispose() {
242
261
  if (disposed) return;
243
- options.signal?.removeEventListener("abort", connection.dispose);
244
262
  disposed = true;
263
+ options.signal?.removeEventListener("abort", disposeWired);
245
264
  unwatch();
246
265
  sync.dispose();
247
266
  router.dispose();
248
267
  }
249
268
  };
269
+ const disposeWired = () => wired.dispose();
270
+ options.signal?.addEventListener("abort", disposeWired, { once: true });
271
+ if (options.signal?.aborted) wired.dispose();
272
+ return wired;
273
+ }
274
+ function LazyRouterProviderHost(props) {
275
+ const [wired, setWired] = useState(null);
276
+ const [failure, setFailure] = useState(routerDomFailure);
277
+ useEffect(() => {
278
+ if (wired || failure !== null) return;
279
+ let alive = true;
280
+ void routerDomReady.then(
281
+ () => {
282
+ if (!alive) return;
283
+ if (routerDomFailure) {
284
+ setFailure(routerDomFailure);
285
+ return;
286
+ }
287
+ if (!routerDomModule || props.isDisposed()) return;
288
+ const w = wireReactBridgeRouter(routerDomModule, props.routing, props.routes, { signal: props.signal });
289
+ props.onWired(w);
290
+ setWired(w);
291
+ },
292
+ (e) => {
293
+ if (alive) setFailure(e);
294
+ }
295
+ );
296
+ return () => {
297
+ alive = false;
298
+ };
299
+ }, [wired, failure, props]);
300
+ if (failure !== null) {
301
+ throw failure instanceof Error ? failure : new Error(String(failure));
302
+ }
303
+ return wired ? createElement(wired.RouterProvider, { router: wired.router }) : null;
304
+ }
305
+ function createReactBridgeRouter(routing, routes, options = {}) {
306
+ let disposed = false;
307
+ let wired = null;
308
+ const dispose = () => {
309
+ if (disposed) return;
310
+ disposed = true;
311
+ wired?.dispose();
312
+ };
313
+ if (routerDomModule) {
314
+ wired = wireReactBridgeRouter(routerDomModule, routing, routes, options);
315
+ const fastRouter = wired.router;
316
+ const connection2 = {
317
+ element: createElement(wired.RouterProvider, { router: wired.router }),
318
+ dispose,
319
+ routerReady: Promise.resolve(fastRouter)
320
+ };
321
+ options.signal?.addEventListener("abort", connection2.dispose, { once: true });
322
+ if (options.signal?.aborted) connection2.dispose();
323
+ return connection2;
324
+ }
325
+ let wireResolve = () => {
326
+ };
327
+ const routerReady = new Promise((resolve, reject) => {
328
+ wireResolve = resolve;
329
+ void routerDomReady.then(() => {
330
+ if (routerDomFailure && !routerDomModule) reject(routerDomFailure);
331
+ }, (e) => reject(e));
332
+ });
333
+ const connection = {
334
+ element: createElement(LazyRouterProviderHost, {
335
+ routing,
336
+ routes,
337
+ signal: options.signal,
338
+ isDisposed: () => disposed,
339
+ onWired: (w) => {
340
+ wired = w;
341
+ wireResolve(w.router);
342
+ }
343
+ }),
344
+ dispose,
345
+ routerReady
346
+ };
250
347
  options.signal?.addEventListener("abort", connection.dispose, { once: true });
251
348
  if (options.signal?.aborted) connection.dispose();
252
349
  return connection;
253
350
  }
254
351
  export {
352
+ __reactRouterDomReady,
255
353
  createReactBridgeNavigation,
256
354
  createReactBridgeRouter
257
355
  };
@@ -1,5 +1,3 @@
1
- import { Router } from 'vue-router';
2
-
3
1
  /** 统一逻辑位置:pathname 以 / 开头;search 空串或 ? 开头;hash 空串或 # 开头 */
4
2
  interface BridgeLocation {
5
3
  pathname: string;
@@ -41,21 +39,42 @@ interface BridgeHostRouting {
41
39
  basePath: string;
42
40
  navigation: BridgeHostNavigation;
43
41
  }
42
+ /**
43
+ * vue-router 实例的最小结构面(/vue 路由同步端口参数;真实 vue-router Router 结构兼容可赋值)。
44
+ * 6.0.0 可选依赖边界:/vue 的 d.ts 不得 import vue-router 类型——未安装 vue-router 的
45
+ * 纯组件工程在 skipLibCheck:false 下也必须能通过类型检查;结构类型的宽化只影响
46
+ * 路由同步端口处的精确提示,业务代码自己的 Router 类型不受影响。
47
+ */
48
+ interface VueRouterLike {
49
+ currentRoute: {
50
+ value: {
51
+ fullPath: string;
52
+ };
53
+ };
54
+ push(to: string): Promise<unknown>;
55
+ replace(to: string): Promise<unknown>;
56
+ go(delta: number): void;
57
+ back(): void;
58
+ forward(): void;
59
+ afterEach(handler: (to: unknown, from: unknown, failure?: unknown) => void): () => void;
60
+ beforeResolve(handler: () => unknown): () => void;
61
+ beforeEach(handler: () => unknown): () => void;
62
+ }
44
63
 
45
- /** Vue Router 4/5 的宿主导航端口与子应用 memory router 接线(按需入口)。 */
64
+ /** Vue Router 4/5 的宿主导航端口与子应用 memory router 接线(统一入口 /vue 提供)。 */
46
65
 
47
66
  interface VueBridgeNavigationOptions {
48
67
  /** 保留配置兼容;Vue Router fullPath 已剥离 history base,不再二次剥离。 */
49
68
  routerBase?: string;
50
69
  }
51
- declare function createVueBridgeNavigation(router: Router, _options?: VueBridgeNavigationOptions): BridgeHostNavigation;
70
+ declare function createVueBridgeNavigation(router: VueRouterLike, _options?: VueBridgeNavigationOptions): BridgeHostNavigation;
52
71
  interface VueBridgeRouterConnection {
53
72
  /** 必须 await ready 后再 app.use(router),初始错误会拒绝此 Promise。 */
54
73
  ready: Promise<void>;
55
74
  dispose(): void;
56
75
  }
57
76
  /** 接线限子应用自己的 memory router;dispose 恢复原始导航方法。 */
58
- declare function connectVueBridgeRouter(routing: BridgeChildRoute, router: Router, options?: {
77
+ declare function connectVueBridgeRouter(routing: BridgeChildRoute, router: VueRouterLike, options?: {
59
78
  signal?: AbortSignal;
60
79
  }): VueBridgeRouterConnection;
61
80
 
@@ -1,6 +1,3 @@
1
- // src/bridge-router-vue.ts
2
- import { isNavigationFailure, NavigationFailureType } from "vue-router";
3
-
4
1
  // src/runtime/errors.ts
5
2
  var FgError = class extends Error {
6
3
  code;
@@ -117,6 +114,8 @@ function connectChildNavigation(routing, apply, onError) {
117
114
  }
118
115
 
119
116
  // src/bridge-router-vue.ts
117
+ var NAVIGATION_FAILURE_CANCELLED = 8;
118
+ var isCancelledNavigationFailure = (failure) => !!failure && typeof failure === "object" && failure.type === NAVIGATION_FAILURE_CANCELLED;
120
119
  var locationFromPath = (path) => {
121
120
  const raw = new URL(path || "/", "http://f.invalid");
122
121
  return { pathname: raw.pathname, search: raw.search, hash: raw.hash };
@@ -160,7 +159,7 @@ function connectVueBridgeRouter(routing, router, options = {}) {
160
159
  if (router.currentRoute.value.fullPath !== path) {
161
160
  const failure = await replace.call(router, path);
162
161
  if (failure && router.currentRoute.value.fullPath !== path) {
163
- if (isNavigationFailure(failure, NavigationFailureType.cancelled)) return;
162
+ if (isCancelledNavigationFailure(failure)) return;
164
163
  throw routingSyncError(spec, `\u5B50\u5E94\u7528\u5B88\u536B\u62D2\u7EDD\u5E94\u7528\u5BBF\u4E3B\u786E\u8BA4\u7684\u4F4D\u7F6E\uFF08\u76EE\u6807 ${path}\uFF09\uFF1B\u8BF7\u5728\u5BBF\u4E3B\u4FA7\u8BBE\u7F6E\u53D6\u6D88\u5B88\u536B\u3002`, []);
165
164
  }
166
165
  }
@@ -189,7 +188,7 @@ function connectVueBridgeRouter(routing, router, options = {}) {
189
188
  await ready;
190
189
  failure = await native.call(router, to);
191
190
  return failure ? void 0 : locationFromPath(router.currentRoute.value.fullPath);
192
- }, typeof to === "object" && to.replace ? "replace" : action);
191
+ }, typeof to === "object" && to?.replace ? "replace" : action);
193
192
  if (failure) return failure;
194
193
  if (result.status === "cancelled") {
195
194
  const remove = router.beforeEach(() => false);
@@ -3,7 +3,7 @@ import {
3
3
  routingNavigationError,
4
4
  routingProtocolError,
5
5
  routingSyncError
6
- } from "./chunk-WRJG2YG6.js";
6
+ } from "./chunk-ZAYNS7YQ.js";
7
7
 
8
8
  // src/bridge-router-core.ts
9
9
  var MAX_REDIRECT_PER_REQUEST = 5;
@@ -3,7 +3,7 @@ import {
3
3
  bridgeSessionMismatchError,
4
4
  invalidBridgeContractError,
5
5
  invalidSessionKeyError
6
- } from "./chunk-WRJG2YG6.js";
6
+ } from "./chunk-ZAYNS7YQ.js";
7
7
  import {
8
8
  clearAppContext
9
9
  } from "./chunk-TSYLDY6H.js";
@@ -29,7 +29,7 @@ function invalidBridgeContractError(spec, mod) {
29
29
  `\u73B0\u8C61\uFF1A\u8FDC\u7A0B\u6A21\u5757 "${spec}" \u7684\u9ED8\u8BA4\u5BFC\u51FA\u4E0D\u662F\u5408\u6CD5\u7684\u6865\u63A5\u5951\u7EA6\uFF08BridgeApp\uFF09\u3002
30
30
  \u6839\u56E0: \u5BFC\u51FA\u503C\u4E3A ${actual}` + (missing.length ? `\uFF0C\u7F3A\u5C11\u51FD\u6570\u7C7B\u578B\u7684 ${missing.map((m) => `"${m}"`).join(" / ")} \u5BFC\u51FA\u3002` : "\u3002") + `
31
31
  \u4FEE\u6CD5: \u8FDC\u7A0B\u4FA7\u7528 defineBridgeApp(...) \u521B\u5EFA\u5951\u7EA6\u5E76\u4F5C\u4E3A\u6A21\u5757\u9ED8\u8BA4\u5BFC\u51FA\u2014\u2014
32
- Vue \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/runtime'\uFF1B
32
+ Vue \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/vue'\uFF1B
33
33
  React \u5B50\u5E94\u7528: import { defineBridgeApp } from '@fulgurjs/federation/react'\u3002
34
34
  \u5951\u7EA6\u5FC5\u987B\u5305\u542B mount(el, props?) \u4E0E unmount(el) \u4E24\u4E2A\u51FD\u6570\u3002`,
35
35
  { spec, missing, actual }