@module-federation/runtime 0.6.12 → 0.6.14
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 +3 -3
- package/dist/index.esm.js +4 -4
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +6 -3
- package/dist/share.esm.js +7 -5
- package/dist/src/utils/logger.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -305,7 +305,7 @@ let Module = class Module {
|
|
|
305
305
|
origin: this.host
|
|
306
306
|
});
|
|
307
307
|
if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
|
|
308
|
-
|
|
308
|
+
share.logger.error('The remote entry interface does not contain "init"', '\n', 'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]', '\n', 'Ensure that window[nameOfRemote] is returning a {get,init} object.');
|
|
309
309
|
}
|
|
310
310
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
311
311
|
await this.host.hooks.lifecycle.initContainer.emit(polyfills._extends({}, initContainerOptions, {
|
|
@@ -1865,7 +1865,7 @@ class RemoteHandler {
|
|
|
1865
1865
|
host.moduleCache.delete(remote.name);
|
|
1866
1866
|
}
|
|
1867
1867
|
} catch (err) {
|
|
1868
|
-
|
|
1868
|
+
share.logger.log('removeRemote fail: ', err);
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
constructor(host){
|
|
@@ -1992,7 +1992,7 @@ class FederationHost {
|
|
|
1992
1992
|
// maybe will change, temporarily for internal use only
|
|
1993
1993
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
1994
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
1995
|
+
this.version = "0.6.14";
|
|
1996
1996
|
this.moduleCache = new Map();
|
|
1997
1997
|
this.loaderHook = new PluginSystem({
|
|
1998
1998
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.js';
|
|
2
2
|
import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
|
|
3
3
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
4
|
-
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as
|
|
4
|
+
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as logger, x as getFMId, y as isObject, z as error, A as warn, B as isPlainObject, C as isRemoteInfoWithEntry, E as isPureRemoteEntry, F as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, H as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, I as formatShareConfigs, J as getTargetSharedOptions, a as getGlobalShareScope, K as addUniqueItem, L as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.js';
|
|
5
5
|
export { m as registerGlobalPlugins } from './share.esm.js';
|
|
6
6
|
|
|
7
7
|
// Function to match a remote with its name and expose
|
|
@@ -305,7 +305,7 @@ let Module = class Module {
|
|
|
305
305
|
origin: this.host
|
|
306
306
|
});
|
|
307
307
|
if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
|
|
308
|
-
|
|
308
|
+
logger.error('The remote entry interface does not contain "init"', '\n', 'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]', '\n', 'Ensure that window[nameOfRemote] is returning a {get,init} object.');
|
|
309
309
|
}
|
|
310
310
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
311
311
|
await this.host.hooks.lifecycle.initContainer.emit(_extends({}, initContainerOptions, {
|
|
@@ -1865,7 +1865,7 @@ class RemoteHandler {
|
|
|
1865
1865
|
host.moduleCache.delete(remote.name);
|
|
1866
1866
|
}
|
|
1867
1867
|
} catch (err) {
|
|
1868
|
-
|
|
1868
|
+
logger.log('removeRemote fail: ', err);
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
constructor(host){
|
|
@@ -1992,7 +1992,7 @@ class FederationHost {
|
|
|
1992
1992
|
// maybe will change, temporarily for internal use only
|
|
1993
1993
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
1994
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
1995
|
+
this.version = "0.6.14";
|
|
1996
1996
|
this.moduleCache = new Map();
|
|
1997
1997
|
this.loaderHook = new PluginSystem({
|
|
1998
1998
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -9,6 +9,8 @@ function getBuilderId() {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const LOG_CATEGORY = '[ Federation Runtime ]';
|
|
12
|
+
// FIXME: pre-bundle ?
|
|
13
|
+
const logger = sdk.createLogger(LOG_CATEGORY);
|
|
12
14
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
13
15
|
function assert(condition, msg) {
|
|
14
16
|
if (!condition) {
|
|
@@ -25,9 +27,9 @@ function error(msg) {
|
|
|
25
27
|
function warn(msg) {
|
|
26
28
|
if (msg instanceof Error) {
|
|
27
29
|
msg.message = `${LOG_CATEGORY}: ${msg.message}`;
|
|
28
|
-
|
|
30
|
+
logger.warn(msg);
|
|
29
31
|
} else {
|
|
30
|
-
|
|
32
|
+
logger.warn(msg);
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -175,7 +177,7 @@ function getGlobalFederationConstructor() {
|
|
|
175
177
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
176
178
|
if (isDebug) {
|
|
177
179
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
178
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
180
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.14";
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -896,6 +898,7 @@ exports.isObject = isObject;
|
|
|
896
898
|
exports.isPlainObject = isPlainObject;
|
|
897
899
|
exports.isPureRemoteEntry = isPureRemoteEntry;
|
|
898
900
|
exports.isRemoteInfoWithEntry = isRemoteInfoWithEntry;
|
|
901
|
+
exports.logger = logger;
|
|
899
902
|
exports.nativeGlobal = nativeGlobal;
|
|
900
903
|
exports.registerGlobalPlugins = registerGlobalPlugins;
|
|
901
904
|
exports.resetFederationGlobalInfo = resetFederationGlobalInfo;
|
package/dist/share.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as _object_without_properties_loose, a as _extends } from './polyfills.esm.js';
|
|
2
|
-
import { isBrowserEnv, isDebugMode } from '@module-federation/sdk';
|
|
2
|
+
import { createLogger, isBrowserEnv, isDebugMode } from '@module-federation/sdk';
|
|
3
3
|
|
|
4
4
|
function getBuilderId() {
|
|
5
5
|
//@ts-ignore
|
|
@@ -7,6 +7,8 @@ function getBuilderId() {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const LOG_CATEGORY = '[ Federation Runtime ]';
|
|
10
|
+
// FIXME: pre-bundle ?
|
|
11
|
+
const logger = createLogger(LOG_CATEGORY);
|
|
10
12
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
11
13
|
function assert(condition, msg) {
|
|
12
14
|
if (!condition) {
|
|
@@ -23,9 +25,9 @@ function error(msg) {
|
|
|
23
25
|
function warn(msg) {
|
|
24
26
|
if (msg instanceof Error) {
|
|
25
27
|
msg.message = `${LOG_CATEGORY}: ${msg.message}`;
|
|
26
|
-
|
|
28
|
+
logger.warn(msg);
|
|
27
29
|
} else {
|
|
28
|
-
|
|
30
|
+
logger.warn(msg);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -173,7 +175,7 @@ function getGlobalFederationConstructor() {
|
|
|
173
175
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
174
176
|
if (isDebug) {
|
|
175
177
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
176
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
178
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.14";
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -865,4 +867,4 @@ function getTargetSharedOptions(options) {
|
|
|
865
867
|
return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
|
|
866
868
|
}
|
|
867
869
|
|
|
868
|
-
export {
|
|
870
|
+
export { warn as A, isPlainObject as B, isRemoteInfoWithEntry as C, DEFAULT_REMOTE_TYPE as D, isPureRemoteEntry as E, getRemoteEntryInfoFromSnapshot as F, Global as G, arrayOptions as H, formatShareConfigs as I, getTargetSharedOptions as J, addUniqueItem as K, getBuilderId as L, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, logger as w, getFMId as x, isObject as y, error as z };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
declare const logger: import("@module-federation/sdk").Logger;
|
|
1
2
|
export declare function assert(condition: any, msg: string): asserts condition;
|
|
2
3
|
export declare function error(msg: string | Error | unknown): never;
|
|
3
4
|
export declare function warn(msg: Parameters<typeof console.warn>[0]): void;
|
|
5
|
+
export declare function log(...args: unknown[]): void;
|
|
6
|
+
export { logger };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.6.
|
|
53
|
+
"@module-federation/sdk": "0.6.14"
|
|
54
54
|
}
|
|
55
55
|
}
|