@ice/mf-runtime 0.0.8-beta.4 → 0.0.8-beta.6
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/es2017/index.d.ts +1 -0
- package/es2017/index.js +26 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +26 -0
- package/package.json +3 -2
package/es2017/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { loadRemote, registerPlugins } from '@module-federation/runtime';
|
|
|
3
3
|
export * from './FallBack';
|
|
4
4
|
export * from './RemoteModule';
|
|
5
5
|
export declare function init(options: ExtendedUserOptions, microMods?: MicroMod[]): void;
|
|
6
|
+
export declare function initByMicroMods(microMods: MicroMod[]): void;
|
package/es2017/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBasename } from '@ice/stark-app';
|
|
1
2
|
import { registerPlugins, init as mfInit } from '@module-federation/runtime';
|
|
2
3
|
import { runtimePlugin } from './runtime-plugin';
|
|
3
4
|
import { initGlobalStore } from './mf-global-store';
|
|
@@ -11,3 +12,28 @@ export function init(options, microMods) {
|
|
|
11
12
|
runtimePlugin()
|
|
12
13
|
]);
|
|
13
14
|
}
|
|
15
|
+
// 需要一个稳定的,微应用唯一的 ID
|
|
16
|
+
function generateUniqueId() {
|
|
17
|
+
const prefix = 'ice_standard';
|
|
18
|
+
const baseName = getBasename().split('/').join('_');
|
|
19
|
+
return `${prefix}_${baseName}`;
|
|
20
|
+
}
|
|
21
|
+
export function initByMicroMods(microMods) {
|
|
22
|
+
const remotes = microMods.map((microMod)=>{
|
|
23
|
+
var _microMod_remoteEntry;
|
|
24
|
+
const isLegacy = !((_microMod_remoteEntry = microMod.remoteEntry) === null || _microMod_remoteEntry === void 0 ? void 0 : _microMod_remoteEntry.match(/\/mf\/remoteEntry\.js$/));
|
|
25
|
+
const remote = {
|
|
26
|
+
name: microMod.moduleFederatedName,
|
|
27
|
+
entry: microMod.remoteEntry,
|
|
28
|
+
alias: microMod.appName,
|
|
29
|
+
extraInfo: Object.assign(microMod.extraInfo || {}, {
|
|
30
|
+
legacy: isLegacy
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
return remote;
|
|
34
|
+
});
|
|
35
|
+
init({
|
|
36
|
+
remotes,
|
|
37
|
+
name: generateUniqueId()
|
|
38
|
+
}, microMods);
|
|
39
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { loadRemote, registerPlugins } from '@module-federation/runtime';
|
|
|
3
3
|
export * from './FallBack';
|
|
4
4
|
export * from './RemoteModule';
|
|
5
5
|
export declare function init(options: ExtendedUserOptions, microMods?: MicroMod[]): void;
|
|
6
|
+
export declare function initByMicroMods(microMods: MicroMod[]): void;
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBasename } from "@ice/stark-app";
|
|
1
2
|
import { registerPlugins, init as mfInit } from "@module-federation/runtime";
|
|
2
3
|
import { runtimePlugin } from "./runtime-plugin";
|
|
3
4
|
import { initGlobalStore } from "./mf-global-store";
|
|
@@ -11,3 +12,28 @@ export function init(options, microMods) {
|
|
|
11
12
|
runtimePlugin()
|
|
12
13
|
]);
|
|
13
14
|
}
|
|
15
|
+
// 需要一个稳定的,微应用唯一的 ID
|
|
16
|
+
function generateUniqueId() {
|
|
17
|
+
var prefix = "ice_standard";
|
|
18
|
+
var baseName = getBasename().split("/").join("_");
|
|
19
|
+
return "".concat(prefix, "_").concat(baseName);
|
|
20
|
+
}
|
|
21
|
+
export function initByMicroMods(microMods) {
|
|
22
|
+
var remotes = microMods.map(function(microMod) {
|
|
23
|
+
var _microMod_remoteEntry;
|
|
24
|
+
var isLegacy = !((_microMod_remoteEntry = microMod.remoteEntry) === null || _microMod_remoteEntry === void 0 ? void 0 : _microMod_remoteEntry.match(/\/mf\/remoteEntry\.js$/));
|
|
25
|
+
var remote = {
|
|
26
|
+
name: microMod.moduleFederatedName,
|
|
27
|
+
entry: microMod.remoteEntry,
|
|
28
|
+
alias: microMod.appName,
|
|
29
|
+
extraInfo: Object.assign(microMod.extraInfo || {}, {
|
|
30
|
+
legacy: isLegacy
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
return remote;
|
|
34
|
+
});
|
|
35
|
+
init({
|
|
36
|
+
remotes: remotes,
|
|
37
|
+
name: generateUniqueId()
|
|
38
|
+
}, microMods);
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ice/mf-runtime",
|
|
3
|
-
"version": "0.0.8-beta.
|
|
3
|
+
"version": "0.0.8-beta.6",
|
|
4
4
|
"description": "ice mf runtime",
|
|
5
5
|
"files": [
|
|
6
6
|
"esm",
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
"registry": "https://registry.npmjs.org"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"react": "^16 || ^17 || ^18"
|
|
72
|
+
"react": "^16 || ^17 || ^18",
|
|
73
|
+
"@ice/stark-app": "^1.5.0"
|
|
73
74
|
},
|
|
74
75
|
"license": "MIT"
|
|
75
76
|
}
|