@fulgurjs/federation 6.11.6 → 6.11.7
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.
- package/CHANGELOG.md +6 -0
- package/dist/cli.js +16 -8
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/runtime.js +1 -1
- package/examples/templates/README.md +5 -1
- package/examples/templates/react-host-vue-remote/README.md +2 -2
- package/examples/templates/react-host-vue-remote/react-host/src/{application.tsx → fulgurjs/host/application.tsx} +2 -1
- package/examples/templates/react-host-vue-remote/react-host/src/{host-session.ts → fulgurjs/host/session.ts} +1 -1
- package/examples/templates/react-host-vue-remote/react-host/src/main.tsx +1 -1
- package/examples/templates/react-host-vue-remote/vue-remote/README.md +2 -2
- package/examples/templates/react-host-vue-remote/vue-remote/fulgurjs.config.ts +1 -1
- package/examples/templates/react-host-vue-remote/vue-remote/src/App.vue +1 -1
- package/examples/templates/react-host-vue-remote/vue-remote/src/{application.ts → fulgurjs/exposes/application.ts} +4 -3
- package/examples/templates/react-host-vue-remote/vue-remote/src/main.ts +1 -1
- package/examples/templates/react-react/README.md +5 -5
- package/examples/templates/react-react/host/README.md +1 -1
- package/examples/templates/react-react/host/src/{application.tsx → fulgurjs/host/application.tsx} +3 -2
- package/examples/templates/react-react/host/src/{remotePages.tsx → fulgurjs/host/remotePages.tsx} +1 -1
- package/examples/templates/react-react/host/src/main.tsx +1 -1
- package/examples/templates/react-react/remote/README.md +4 -4
- package/examples/templates/react-react/remote/fulgurjs.config.ts +4 -4
- package/examples/templates/react-react/remote/src/App.tsx +1 -1
- package/examples/templates/react-react/remote/src/{application.tsx → fulgurjs/exposes/application.tsx} +2 -1
- package/examples/templates/react-react/remote/src/main.tsx +1 -1
- package/examples/templates/showcase/README.md +13 -13
- package/examples/templates/showcase/react-host/src/GuardBanner.tsx +2 -2
- package/examples/templates/showcase/react-host/src/Layout.tsx +1 -1
- package/examples/templates/showcase/react-host/src/ObsPanel.tsx +2 -2
- package/examples/templates/showcase/react-host/src/{pages → fulgurjs/host}/BridgeVuePage.tsx +4 -4
- package/examples/templates/showcase/react-host/src/{application.tsx → fulgurjs/host/application.tsx} +5 -4
- package/examples/templates/showcase/react-host/src/{demo-log.ts → fulgurjs/host/demo-log.ts} +1 -1
- package/examples/templates/showcase/react-host/src/{routing.ts → fulgurjs/host/routing.ts} +1 -1
- package/examples/templates/showcase/react-host/src/main.tsx +1 -1
- package/examples/templates/showcase/react-remote/fulgurjs.config.ts +1 -1
- package/examples/templates/showcase/react-remote/src/{application.tsx → fulgurjs/exposes/application.tsx} +7 -6
- package/examples/templates/showcase/react-remote/src/main.tsx +1 -1
- package/examples/templates/showcase/vue-host/src/App.vue +1 -1
- package/examples/templates/showcase/vue-host/src/GuardBanner.vue +1 -1
- package/examples/templates/showcase/vue-host/src/ObsPanel.vue +2 -2
- package/examples/templates/showcase/vue-host/src/{pages → fulgurjs/host}/BridgeReactPage.vue +4 -4
- package/examples/templates/showcase/vue-host/src/{application.ts → fulgurjs/host/application.ts} +5 -4
- package/examples/templates/showcase/vue-host/src/{demo-log.ts → fulgurjs/host/demo-log.ts} +1 -1
- package/examples/templates/showcase/vue-host/src/{guard.ts → fulgurjs/host/guard.ts} +1 -1
- package/examples/templates/showcase/vue-host/src/{routing.ts → fulgurjs/host/routing.ts} +1 -1
- package/examples/templates/showcase/vue-host/src/main.ts +1 -1
- package/examples/templates/showcase/vue-remote/fulgurjs.config.ts +1 -1
- package/examples/templates/showcase/vue-remote/src/{application.ts → fulgurjs/exposes/application.ts} +7 -6
- package/examples/templates/showcase/vue-remote/src/main.ts +1 -1
- package/examples/templates/vue-host-react-remote/README.md +2 -2
- package/examples/templates/vue-host-react-remote/react-remote/README.md +2 -2
- package/examples/templates/vue-host-react-remote/react-remote/fulgurjs.config.ts +1 -1
- package/examples/templates/vue-host-react-remote/react-remote/src/{application.tsx → fulgurjs/exposes/application.tsx} +1 -0
- package/examples/templates/vue-host-react-remote/react-remote/src/main.tsx +1 -1
- package/examples/templates/vue-host-react-remote/vue-host/README.md +1 -1
- package/examples/templates/vue-host-react-remote/vue-host/src/App.vue +1 -1
- package/examples/templates/vue-host-react-remote/vue-host/src/fulgurjs/host/application.ts +6 -0
- package/examples/templates/vue-host-react-remote/vue-host/src/main.ts +1 -1
- package/examples/templates/vue-vue/README.md +6 -6
- package/examples/templates/vue-vue/host/src/{application.ts → fulgurjs/host/application.ts} +5 -4
- package/examples/templates/vue-vue/host/src/main.ts +1 -1
- package/examples/templates/vue-vue/host/src/pages/UtilsDemo.vue +1 -1
- package/examples/templates/vue-vue/remote/README.md +4 -4
- package/examples/templates/vue-vue/remote/fulgurjs.config.ts +4 -4
- package/examples/templates/vue-vue/remote/src/App.vue +1 -1
- package/examples/templates/vue-vue/remote/src/{application.ts → fulgurjs/exposes/application.ts} +2 -1
- package/examples/templates/vue-vue/remote/src/main.ts +1 -1
- package/package.json +1 -1
- package/examples/templates/vue-host-react-remote/vue-host/src/application.ts +0 -5
- /package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/ClickButton.tsx +0 -0
- /package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/pages/DetailPage.tsx +0 -0
- /package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/pages/HomePage.tsx +0 -0
- /package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/utils.ts +0 -0
- /package/examples/templates/vue-host-react-remote/vue-host/src/{host-session.ts → fulgurjs/host/session.ts} +0 -0
- /package/examples/templates/vue-vue/host/src/{type-demo.ts → fulgurjs/host/type-demo.ts} +0 -0
- /package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/ClickButton.vue +0 -0
- /package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/pages/DetailPage.vue +0 -0
- /package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/pages/HomePage.vue +0 -0
- /package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/utils.ts +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
/** 宿主装配入口:main 只调用 start;在这里连接本工程的路由与远程挂载,原业务页面仍在 pages/。 */
|
|
1
2
|
import { createApp, h } from 'vue'
|
|
2
3
|
import { createRouter, createWebHistory, useRoute } from 'vue-router'
|
|
3
4
|
import { defineApplication, createHostPages } from '@fulgurjs/federation/vue'
|
|
4
|
-
import App from '
|
|
5
|
-
import HomePage from '
|
|
6
|
-
import UtilsDemo from '
|
|
7
|
-
import { pages, remotePrefixes } from '
|
|
5
|
+
import App from '../../App.vue'
|
|
6
|
+
import HomePage from '../../pages/HomePage.vue'
|
|
7
|
+
import UtilsDemo from '../../pages/UtilsDemo.vue'
|
|
8
|
+
import { pages, remotePrefixes } from '../../../fulgurjs.config.ts'
|
|
8
9
|
|
|
9
10
|
// 页面适配器:URL 解析、最长前缀远程归属、异步组件缓存、
|
|
10
11
|
// 加载/错误占位(含「重试加载 / 刷新页面重试」)全部由插件完成。
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<button data-testid="demo-utils-reload" @click="load">重新调用</button>
|
|
13
13
|
<section data-testid="demo-types-guide">
|
|
14
14
|
<h3>远程类型提示:像使用本地代码一样</h3>
|
|
15
|
-
<p>打开 <code>host/src/type-demo.ts</code>,在 <code>utils.</code> 后触发补全,或悬停查看函数参数和返回值。</p>
|
|
15
|
+
<p>打开 <code>host/src/fulgurjs/host/type-demo.ts</code>,在 <code>utils.</code> 后触发补全,或悬停查看函数参数和返回值。</p>
|
|
16
16
|
<p>下面的详情组件来自远程,<code>id</code> 和 <code>tab</code> 都是字符串。把本文件中的 <code>id="7"</code> 改成 <code>:id="7"</code>,编辑器和类型检查会提示错误;体验后请还原。</p>
|
|
17
17
|
<RemoteDetail id="7" tab="type-demo" />
|
|
18
18
|
<p>执行 <code>pnpm --dir host typecheck</code> 可检查正确调用和五条错误示例。错误示例不在浏览器中执行;移除其中一行的 <code>@ts-expect-error</code> 后再检查,就能看到具体诊断。</p>
|
|
@@ -17,10 +17,10 @@ pnpm --dir remote dev
|
|
|
17
17
|
|
|
18
18
|
| expose 键 | 源文件 | 说明 |
|
|
19
19
|
| --- | --- | --- |
|
|
20
|
-
| `./ClickButton` | `src/exposes/ClickButton.vue` | 可点击计数按钮(本地状态在组件内) |
|
|
21
|
-
| `./utils` | `src/exposes/utils.ts` | 普通 TS 模块:`sumNumbers` / `DEMO_ANSWER` / `formatPrice` |
|
|
22
|
-
| `./pages/HomePage` | `src/exposes/pages/HomePage.vue` | 联邦页面:远程首页 |
|
|
23
|
-
| `./pages/DetailPage` | `src/exposes/pages/DetailPage.vue` | 联邦页面:详情页(接收宿主路由的 `id` / `tab` props) |
|
|
20
|
+
| `./ClickButton` | `src/fulgurjs/exposes/ClickButton.vue` | 可点击计数按钮(本地状态在组件内) |
|
|
21
|
+
| `./utils` | `src/fulgurjs/exposes/utils.ts` | 普通 TS 模块:`sumNumbers` / `DEMO_ANSWER` / `formatPrice` |
|
|
22
|
+
| `./pages/HomePage` | `src/fulgurjs/exposes/pages/HomePage.vue` | 联邦页面:远程首页 |
|
|
23
|
+
| `./pages/DetailPage` | `src/fulgurjs/exposes/pages/DetailPage.vue` | 联邦页面:详情页(接收宿主路由的 `id` / `tab` props) |
|
|
24
24
|
|
|
25
25
|
宿主如何调用 `./utils`(宿主侧代码):
|
|
26
26
|
|
|
@@ -9,10 +9,10 @@ export default {
|
|
|
9
9
|
// 生产构建的容器入口文件名(部署后宿主 prod 地址指向它所在目录)
|
|
10
10
|
filename: 'fulgurjs-remoteEntry.js',
|
|
11
11
|
exposes: {
|
|
12
|
-
'./ClickButton': './src/exposes/ClickButton.vue',
|
|
13
|
-
'./utils': './src/exposes/utils.ts',
|
|
14
|
-
'./pages/HomePage': './src/exposes/pages/HomePage.vue',
|
|
15
|
-
'./pages/DetailPage': './src/exposes/pages/DetailPage.vue',
|
|
12
|
+
'./ClickButton': './src/fulgurjs/exposes/ClickButton.vue',
|
|
13
|
+
'./utils': './src/fulgurjs/exposes/utils.ts',
|
|
14
|
+
'./pages/HomePage': './src/fulgurjs/exposes/pages/HomePage.vue',
|
|
15
|
+
'./pages/DetailPage': './src/fulgurjs/exposes/pages/DetailPage.vue',
|
|
16
16
|
},
|
|
17
17
|
shared: {
|
|
18
18
|
vue: { singleton: true, requiredVersion: '^3.4.0' },
|
package/examples/templates/vue-vue/remote/src/{application.ts → fulgurjs/exposes/application.ts}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/** 应用装配入口:main 只调用 start;独立与嵌入复用本工厂,每次挂载的实例和清理由插件管理。 */
|
|
1
2
|
import { createApp } from 'vue'
|
|
2
3
|
import { defineApplication } from '@fulgurjs/federation/vue'
|
|
3
|
-
import App from '
|
|
4
|
+
import App from '../../App.vue'
|
|
4
5
|
|
|
5
6
|
// 普通组件远程不需要额外桥接/路由;独立调试仍由同一应用入口启动。
|
|
6
7
|
export default defineApplication(() => createApp(App))
|
package/package.json
CHANGED
/package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/ClickButton.tsx
RENAMED
|
File without changes
|
/package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/pages/DetailPage.tsx
RENAMED
|
File without changes
|
/package/examples/templates/react-react/remote/src/{exposes → fulgurjs/exposes}/pages/HomePage.tsx
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/pages/DetailPage.vue
RENAMED
|
File without changes
|
/package/examples/templates/vue-vue/remote/src/{exposes → fulgurjs/exposes}/pages/HomePage.vue
RENAMED
|
File without changes
|
|
File without changes
|