@module-federation/runtime 0.0.0-next-20231225094207 → 0.0.0-next-20231228055514
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/dist/index.cjs.js +16 -3
- package/dist/index.esm.js +16 -3
- package/dist/share.cjs.js +0 -1
- package/dist/share.esm.js +0 -1
- package/dist/src/core.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -136,7 +136,10 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
136
136
|
1. '${entry}' is not the correct URL, or the remoteEntry resource or name is incorrect.\n
|
|
137
137
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
138
138
|
`);
|
|
139
|
+
console.log(entryExports);
|
|
139
140
|
return entryExports;
|
|
141
|
+
}).catch((e)=>{
|
|
142
|
+
return e;
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
return sdk.loadScript(entry, {
|
|
@@ -151,6 +154,8 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
151
154
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
152
155
|
`);
|
|
153
156
|
return entryExports;
|
|
157
|
+
}).catch((e)=>{
|
|
158
|
+
return e;
|
|
154
159
|
});
|
|
155
160
|
}
|
|
156
161
|
async function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook }) {
|
|
@@ -1375,11 +1380,19 @@ class FederationHost {
|
|
|
1375
1380
|
});
|
|
1376
1381
|
return moduleOrFactory;
|
|
1377
1382
|
} catch (error) {
|
|
1378
|
-
|
|
1383
|
+
const { from = 'runtime' } = options || {
|
|
1384
|
+
from: 'runtime'
|
|
1385
|
+
};
|
|
1386
|
+
const failOver = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
1379
1387
|
id,
|
|
1380
|
-
error
|
|
1388
|
+
error,
|
|
1389
|
+
from,
|
|
1390
|
+
origin: this
|
|
1381
1391
|
});
|
|
1382
|
-
|
|
1392
|
+
if (!failOver) {
|
|
1393
|
+
throw error;
|
|
1394
|
+
}
|
|
1395
|
+
return failOver;
|
|
1383
1396
|
}
|
|
1384
1397
|
}
|
|
1385
1398
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
package/dist/index.esm.js
CHANGED
|
@@ -134,7 +134,10 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
134
134
|
1. '${entry}' is not the correct URL, or the remoteEntry resource or name is incorrect.\n
|
|
135
135
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
136
136
|
`);
|
|
137
|
+
console.log(entryExports);
|
|
137
138
|
return entryExports;
|
|
139
|
+
}).catch((e)=>{
|
|
140
|
+
return e;
|
|
138
141
|
});
|
|
139
142
|
}
|
|
140
143
|
return loadScript(entry, {
|
|
@@ -149,6 +152,8 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
149
152
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
150
153
|
`);
|
|
151
154
|
return entryExports;
|
|
155
|
+
}).catch((e)=>{
|
|
156
|
+
return e;
|
|
152
157
|
});
|
|
153
158
|
}
|
|
154
159
|
async function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook }) {
|
|
@@ -1373,11 +1378,19 @@ class FederationHost {
|
|
|
1373
1378
|
});
|
|
1374
1379
|
return moduleOrFactory;
|
|
1375
1380
|
} catch (error) {
|
|
1376
|
-
|
|
1381
|
+
const { from = 'runtime' } = options || {
|
|
1382
|
+
from: 'runtime'
|
|
1383
|
+
};
|
|
1384
|
+
const failOver = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
1377
1385
|
id,
|
|
1378
|
-
error
|
|
1386
|
+
error,
|
|
1387
|
+
from,
|
|
1388
|
+
origin: this
|
|
1379
1389
|
});
|
|
1380
|
-
|
|
1390
|
+
if (!failOver) {
|
|
1391
|
+
throw error;
|
|
1392
|
+
}
|
|
1393
|
+
return failOver;
|
|
1381
1394
|
}
|
|
1382
1395
|
}
|
|
1383
1396
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
package/dist/share.cjs.js
CHANGED
|
@@ -724,7 +724,6 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
|
|
|
724
724
|
const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
|
|
725
725
|
//@ts-ignore
|
|
726
726
|
const defaultResolver = ()=>{
|
|
727
|
-
debugger;
|
|
728
727
|
if (shareConfig.singleton) {
|
|
729
728
|
if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
|
|
730
729
|
const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
|
package/dist/share.esm.js
CHANGED
|
@@ -722,7 +722,6 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
|
|
|
722
722
|
const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
|
|
723
723
|
//@ts-ignore
|
|
724
724
|
const defaultResolver = ()=>{
|
|
725
|
-
debugger;
|
|
726
725
|
if (shareConfig.singleton) {
|
|
727
726
|
if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
|
|
728
727
|
const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
|
package/dist/src/core.d.ts
CHANGED
|
@@ -53,6 +53,8 @@ export declare class FederationHost {
|
|
|
53
53
|
errorLoadRemote: AsyncHook<[{
|
|
54
54
|
id: string;
|
|
55
55
|
error: unknown;
|
|
56
|
+
from: 'build' | 'runtime';
|
|
57
|
+
origin: FederationHost;
|
|
56
58
|
}], void>;
|
|
57
59
|
beforeLoadShare: AsyncWaterfallHook<{
|
|
58
60
|
pkgName: string;
|
|
@@ -115,6 +117,7 @@ export declare class FederationHost {
|
|
|
115
117
|
private _getRemoteModuleAndOptions;
|
|
116
118
|
loadRemote<T>(id: string, options?: {
|
|
117
119
|
loadFactory?: boolean;
|
|
120
|
+
from: 'build' | 'runtime';
|
|
118
121
|
}): Promise<T | null>;
|
|
119
122
|
preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
|
|
120
123
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20231228055514",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
48
|
+
"@module-federation/sdk": "0.0.0-next-20231228055514"
|
|
49
49
|
}
|
|
50
50
|
}
|