@fulgurjs/federation 0.6.2 → 0.7.1
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 +20 -0
- package/README.md +36 -1
- package/dist/chunk-6EGDSX3S.js +6 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +5 -6
- package/dist/runtime.js +1 -1
- package/dist/vue.cjs +783 -0
- package/dist/vue.d.cts +35 -0
- package/dist/vue.d.ts +35 -0
- package/dist/vue.js +760 -0
- package/docs//350/277/201/347/247/273/346/214/207/345/215/227.md +17 -15
- package/package.json +30 -4
package/dist/vue.d.cts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vue 生态层:remoteComponent() 远程组件直渲染。
|
|
5
|
+
*
|
|
6
|
+
* 定位:runtime.js 保持框架无关(不 import vue,gzip 红线守卫),
|
|
7
|
+
* Vue 封装按需引入——独立文件、零 runtime 体积增量。
|
|
8
|
+
*
|
|
9
|
+
* 语义(docs/远程组件直渲染API设计方案-2026-09-20.md §二):
|
|
10
|
+
* - 内部 = defineAsyncComponent({ loader: () => loadRemote(spec, opts).then(m => m.default ?? m) });
|
|
11
|
+
* - H3 零兜底:加载失败显式进错误态(fulgurjs:error 事件由 runtime 层照常发出),
|
|
12
|
+
* 不传 errorComponent 时渲染内置默认错误占位(文案含错误码+根因+修法,显式非静默);
|
|
13
|
+
* - 模块去重沿用 loadRemote 内部 Promise 缓存(同 spec 不重复加载);
|
|
14
|
+
* - 返回标准 Vue 异步组件,props(如 form-params)在使用处透传,不改分发机制。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface RemoteComponentOptions {
|
|
18
|
+
/** 加载期间展示的组件 */
|
|
19
|
+
loadingComponent?: Component;
|
|
20
|
+
/** 加载失败展示的组件(收到 error prop);不传时用内置默认错误占位 */
|
|
21
|
+
errorComponent?: Component;
|
|
22
|
+
/** 单次调用级重试覆盖,透传 loadRemote(缺省用远程注册值,默认 2) */
|
|
23
|
+
retries?: number;
|
|
24
|
+
/** defineAsyncComponent delay(ms):切换到 loadingComponent 前的等待,默认 200 */
|
|
25
|
+
delay?: number;
|
|
26
|
+
/** defineAsyncComponent timeout(ms):超时进错误态;不设则由 runtime 容器超时兜底 */
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 创建远程组件:`remoteComponent('cku-mes-admin/FormRouterPage')`。
|
|
31
|
+
* 返回标准 Vue 异步组件,使用处直接透传 props(如 form-params)。
|
|
32
|
+
*/
|
|
33
|
+
declare function remoteComponent(spec: string, opts?: RemoteComponentOptions): Component;
|
|
34
|
+
|
|
35
|
+
export { type RemoteComponentOptions, remoteComponent };
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vue 生态层:remoteComponent() 远程组件直渲染。
|
|
5
|
+
*
|
|
6
|
+
* 定位:runtime.js 保持框架无关(不 import vue,gzip 红线守卫),
|
|
7
|
+
* Vue 封装按需引入——独立文件、零 runtime 体积增量。
|
|
8
|
+
*
|
|
9
|
+
* 语义(docs/远程组件直渲染API设计方案-2026-09-20.md §二):
|
|
10
|
+
* - 内部 = defineAsyncComponent({ loader: () => loadRemote(spec, opts).then(m => m.default ?? m) });
|
|
11
|
+
* - H3 零兜底:加载失败显式进错误态(fulgurjs:error 事件由 runtime 层照常发出),
|
|
12
|
+
* 不传 errorComponent 时渲染内置默认错误占位(文案含错误码+根因+修法,显式非静默);
|
|
13
|
+
* - 模块去重沿用 loadRemote 内部 Promise 缓存(同 spec 不重复加载);
|
|
14
|
+
* - 返回标准 Vue 异步组件,props(如 form-params)在使用处透传,不改分发机制。
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface RemoteComponentOptions {
|
|
18
|
+
/** 加载期间展示的组件 */
|
|
19
|
+
loadingComponent?: Component;
|
|
20
|
+
/** 加载失败展示的组件(收到 error prop);不传时用内置默认错误占位 */
|
|
21
|
+
errorComponent?: Component;
|
|
22
|
+
/** 单次调用级重试覆盖,透传 loadRemote(缺省用远程注册值,默认 2) */
|
|
23
|
+
retries?: number;
|
|
24
|
+
/** defineAsyncComponent delay(ms):切换到 loadingComponent 前的等待,默认 200 */
|
|
25
|
+
delay?: number;
|
|
26
|
+
/** defineAsyncComponent timeout(ms):超时进错误态;不设则由 runtime 容器超时兜底 */
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 创建远程组件:`remoteComponent('cku-mes-admin/FormRouterPage')`。
|
|
31
|
+
* 返回标准 Vue 异步组件,使用处直接透传 props(如 form-params)。
|
|
32
|
+
*/
|
|
33
|
+
declare function remoteComponent(spec: string, opts?: RemoteComponentOptions): Component;
|
|
34
|
+
|
|
35
|
+
export { type RemoteComponentOptions, remoteComponent };
|