@module-federation/bridge-vue3 0.16.0 → 0.17.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 +36 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +10 -0
- package/dist/index.js +911 -904
- package/package.json +5 -4
- package/src/create.ts +24 -6
- package/src/index.ts +1 -1
- package/src/remoteApp.tsx +8 -5
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/module-federation/core",
|
|
8
8
|
"directory": "packages/vue3-bridge"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.17.1",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"vue-router": "=4"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@module-federation/bridge-shared": "0.
|
|
36
|
-
"@module-federation/sdk": "0.
|
|
37
|
-
"@module-federation/runtime": "0.
|
|
35
|
+
"@module-federation/bridge-shared": "0.17.1",
|
|
36
|
+
"@module-federation/sdk": "0.17.1",
|
|
37
|
+
"@module-federation/runtime": "0.17.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@types/react": "^18.3.11",
|
|
40
41
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
41
42
|
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
|
42
43
|
"typescript": "^5.2.2",
|
package/src/create.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { LoggerInstance } from './utils.js';
|
|
|
5
5
|
|
|
6
6
|
declare const __APP_VERSION__: string;
|
|
7
7
|
|
|
8
|
-
export function
|
|
8
|
+
export function createRemoteAppComponent(info: {
|
|
9
9
|
loader: () => Promise<any>;
|
|
10
10
|
export?: string;
|
|
11
11
|
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
@@ -29,17 +29,20 @@ export function createRemoteComponent(info: {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const exportName = info?.export || 'default';
|
|
32
|
-
LoggerInstance.debug(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
LoggerInstance.debug(
|
|
33
|
+
`createRemoteAppComponent LazyComponent create >>>`,
|
|
34
|
+
{
|
|
35
|
+
basename,
|
|
36
|
+
info,
|
|
37
|
+
},
|
|
38
|
+
);
|
|
36
39
|
|
|
37
40
|
const module: any = await info.loader();
|
|
38
41
|
const moduleName = module && module[Symbol.for('mf_module_id')];
|
|
39
42
|
const exportFn = module[exportName];
|
|
40
43
|
|
|
41
44
|
LoggerInstance.debug(
|
|
42
|
-
`
|
|
45
|
+
`createRemoteAppComponent LazyComponent loadRemote info >>>`,
|
|
43
46
|
{ moduleName, module, exportName, basename, route },
|
|
44
47
|
);
|
|
45
48
|
|
|
@@ -59,3 +62,18 @@ export function createRemoteComponent(info: {
|
|
|
59
62
|
},
|
|
60
63
|
});
|
|
61
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!
|
|
68
|
+
*/
|
|
69
|
+
export function createRemoteComponent(info: {
|
|
70
|
+
loader: () => Promise<any>;
|
|
71
|
+
export?: string;
|
|
72
|
+
asyncComponentOptions?: Omit<AsyncComponentOptions, 'loader'>;
|
|
73
|
+
rootAttrs?: Record<string, unknown>;
|
|
74
|
+
}) {
|
|
75
|
+
LoggerInstance.warn(
|
|
76
|
+
'createRemoteAppComponent is deprecated, please use createRemoteAppComponent instead!',
|
|
77
|
+
);
|
|
78
|
+
return createRemoteAppComponent(info);
|
|
79
|
+
}
|
package/src/index.ts
CHANGED
package/src/remoteApp.tsx
CHANGED
|
@@ -43,7 +43,7 @@ export default defineComponent({
|
|
|
43
43
|
hashRoute: props.hashRoute,
|
|
44
44
|
};
|
|
45
45
|
LoggerInstance.debug(
|
|
46
|
-
`
|
|
46
|
+
`createRemoteAppComponent LazyComponent render >>>`,
|
|
47
47
|
renderProps,
|
|
48
48
|
);
|
|
49
49
|
|
|
@@ -67,7 +67,7 @@ export default defineComponent({
|
|
|
67
67
|
// dispatchPopstateEnv
|
|
68
68
|
if (pathname.value !== '' && pathname.value !== newPath) {
|
|
69
69
|
LoggerInstance.debug(
|
|
70
|
-
`
|
|
70
|
+
`createRemoteAppComponent dispatchPopstateEnv >>>`,
|
|
71
71
|
{
|
|
72
72
|
...props,
|
|
73
73
|
pathname: route.path,
|
|
@@ -84,9 +84,12 @@ export default defineComponent({
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
onBeforeUnmount(() => {
|
|
87
|
-
LoggerInstance.debug(
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
LoggerInstance.debug(
|
|
88
|
+
`createRemoteAppComponent LazyComponent destroy >>>`,
|
|
89
|
+
{
|
|
90
|
+
...props,
|
|
91
|
+
},
|
|
92
|
+
);
|
|
90
93
|
watchStopHandle();
|
|
91
94
|
|
|
92
95
|
hostInstance?.bridgeHook?.lifecycle?.beforeBridgeDestroy?.emit({
|