@module-federation/runtime-core 0.17.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.
@@ -15,14 +15,20 @@ function assert(condition, msg) {
15
15
  }
16
16
  function error(msg) {
17
17
  if (msg instanceof Error) {
18
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
18
+ // Check if the message already starts with the log category to avoid duplication
19
+ if (!msg.message.startsWith(LOG_CATEGORY)) {
20
+ msg.message = `${LOG_CATEGORY}: ${msg.message}`;
21
+ }
19
22
  throw msg;
20
23
  }
21
24
  throw new Error(`${LOG_CATEGORY}: ${msg}`);
22
25
  }
23
26
  function warn(msg) {
24
27
  if (msg instanceof Error) {
25
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
28
+ // Check if the message already starts with the log category to avoid duplication
29
+ if (!msg.message.startsWith(LOG_CATEGORY)) {
30
+ msg.message = `${LOG_CATEGORY}: ${msg.message}`;
31
+ }
26
32
  logger.warn(msg);
27
33
  } else {
28
34
  logger.warn(msg);
@@ -196,7 +202,7 @@ function getGlobalFederationConstructor() {
196
202
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
197
203
  if (isDebug) {
198
204
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
199
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.17.0";
205
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.17.1";
200
206
  }
201
207
  }
202
208
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1652,7 +1658,8 @@ class SyncWaterfallHook extends SyncHook {
1652
1658
  return data;
1653
1659
  }
1654
1660
  constructor(type){
1655
- super(), this.onerror = error;
1661
+ super();
1662
+ this.onerror = error;
1656
1663
  this.type = type;
1657
1664
  }
1658
1665
  }
@@ -1690,7 +1697,8 @@ class AsyncWaterfallHook extends SyncHook {
1690
1697
  return Promise.resolve(data);
1691
1698
  }
1692
1699
  constructor(type){
1693
- super(), this.onerror = error;
1700
+ super();
1701
+ this.onerror = error;
1694
1702
  this.type = type;
1695
1703
  }
1696
1704
  }
@@ -2290,6 +2298,7 @@ class SharedHandler {
2290
2298
  if (gShared) {
2291
2299
  gShared.lib = factory;
2292
2300
  gShared.loaded = true;
2301
+ addUseIn(gShared);
2293
2302
  }
2294
2303
  return factory;
2295
2304
  };
@@ -2332,10 +2341,10 @@ class SharedHandler {
2332
2341
  }
2333
2342
  }
2334
2343
  /**
2335
- * This function initializes the sharing sequence (executed only once per share scope).
2336
- * It accepts one argument, the name of the share scope.
2337
- * If the share scope does not exist, it creates one.
2338
- */ // eslint-disable-next-line @typescript-eslint/member-ordering
2344
+ * This function initializes the sharing sequence (executed only once per share scope).
2345
+ * It accepts one argument, the name of the share scope.
2346
+ * If the share scope does not exist, it creates one.
2347
+ */ // eslint-disable-next-line @typescript-eslint/member-ordering
2339
2348
  initializeSharing(shareScopeName = DEFAULT_SCOPE, extraOptions) {
2340
2349
  const { host } = this;
2341
2350
  const from = extraOptions == null ? void 0 : extraOptions.from;
@@ -3025,7 +3034,7 @@ class ModuleFederation {
3025
3034
  // maybe will change, temporarily for internal use only
3026
3035
  initContainer: new AsyncWaterfallHook('initContainer')
3027
3036
  });
3028
- this.version = "0.17.0";
3037
+ this.version = "0.17.1";
3029
3038
  this.moduleCache = new Map();
3030
3039
  this.loaderHook = new PluginSystem({
3031
3040
  // FIXME: may not be suitable , not open to the public yet
@@ -3071,7 +3080,7 @@ class ModuleFederation {
3071
3080
  }
3072
3081
 
3073
3082
  var index = /*#__PURE__*/Object.freeze({
3074
- __proto__: null
3083
+ __proto__: null
3075
3084
  });
3076
3085
 
3077
3086
  exports.loadScript = sdk.loadScript;
package/dist/index.esm.js CHANGED
@@ -14,14 +14,20 @@ function assert(condition, msg) {
14
14
  }
15
15
  function error(msg) {
16
16
  if (msg instanceof Error) {
17
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
17
+ // Check if the message already starts with the log category to avoid duplication
18
+ if (!msg.message.startsWith(LOG_CATEGORY)) {
19
+ msg.message = `${LOG_CATEGORY}: ${msg.message}`;
20
+ }
18
21
  throw msg;
19
22
  }
20
23
  throw new Error(`${LOG_CATEGORY}: ${msg}`);
21
24
  }
22
25
  function warn(msg) {
23
26
  if (msg instanceof Error) {
24
- msg.message = `${LOG_CATEGORY}: ${msg.message}`;
27
+ // Check if the message already starts with the log category to avoid duplication
28
+ if (!msg.message.startsWith(LOG_CATEGORY)) {
29
+ msg.message = `${LOG_CATEGORY}: ${msg.message}`;
30
+ }
25
31
  logger.warn(msg);
26
32
  } else {
27
33
  logger.warn(msg);
@@ -195,7 +201,7 @@ function getGlobalFederationConstructor() {
195
201
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
196
202
  if (isDebug) {
197
203
  CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
198
- CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.17.0";
204
+ CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.17.1";
199
205
  }
200
206
  }
201
207
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1651,7 +1657,8 @@ class SyncWaterfallHook extends SyncHook {
1651
1657
  return data;
1652
1658
  }
1653
1659
  constructor(type){
1654
- super(), this.onerror = error;
1660
+ super();
1661
+ this.onerror = error;
1655
1662
  this.type = type;
1656
1663
  }
1657
1664
  }
@@ -1689,7 +1696,8 @@ class AsyncWaterfallHook extends SyncHook {
1689
1696
  return Promise.resolve(data);
1690
1697
  }
1691
1698
  constructor(type){
1692
- super(), this.onerror = error;
1699
+ super();
1700
+ this.onerror = error;
1693
1701
  this.type = type;
1694
1702
  }
1695
1703
  }
@@ -2289,6 +2297,7 @@ class SharedHandler {
2289
2297
  if (gShared) {
2290
2298
  gShared.lib = factory;
2291
2299
  gShared.loaded = true;
2300
+ addUseIn(gShared);
2292
2301
  }
2293
2302
  return factory;
2294
2303
  };
@@ -2331,10 +2340,10 @@ class SharedHandler {
2331
2340
  }
2332
2341
  }
2333
2342
  /**
2334
- * This function initializes the sharing sequence (executed only once per share scope).
2335
- * It accepts one argument, the name of the share scope.
2336
- * If the share scope does not exist, it creates one.
2337
- */ // eslint-disable-next-line @typescript-eslint/member-ordering
2343
+ * This function initializes the sharing sequence (executed only once per share scope).
2344
+ * It accepts one argument, the name of the share scope.
2345
+ * If the share scope does not exist, it creates one.
2346
+ */ // eslint-disable-next-line @typescript-eslint/member-ordering
2338
2347
  initializeSharing(shareScopeName = DEFAULT_SCOPE, extraOptions) {
2339
2348
  const { host } = this;
2340
2349
  const from = extraOptions == null ? void 0 : extraOptions.from;
@@ -3024,7 +3033,7 @@ class ModuleFederation {
3024
3033
  // maybe will change, temporarily for internal use only
3025
3034
  initContainer: new AsyncWaterfallHook('initContainer')
3026
3035
  });
3027
- this.version = "0.17.0";
3036
+ this.version = "0.17.1";
3028
3037
  this.moduleCache = new Map();
3029
3038
  this.loaderHook = new PluginSystem({
3030
3039
  // FIXME: may not be suitable , not open to the public yet
@@ -3070,7 +3079,7 @@ class ModuleFederation {
3070
3079
  }
3071
3080
 
3072
3081
  var index = /*#__PURE__*/Object.freeze({
3073
- __proto__: null
3082
+ __proto__: null
3074
3083
  });
3075
3084
 
3076
3085
  export { CurrentGlobal, Global, Module, ModuleFederation, addGlobalSnapshot, assert, getGlobalFederationConstructor, getGlobalSnapshot, getInfoWithoutType, getRegisteredShare, getRemoteEntry, getRemoteInfo, helpers, isStaticResourcesEqual, matchRemoteWithNameAndExpose, registerGlobalPlugins, resetFederationGlobalInfo, safeWrapper, satisfy, setGlobalFederationConstructor, setGlobalFederationInstance, index as types };
@@ -36,7 +36,7 @@ export declare class SharedHandler {
36
36
  registerShared(globalOptions: Options, userOptions: UserOptions): {
37
37
  shareInfos: ShareInfos;
38
38
  shared: {
39
- [x: string]: Shared[];
39
+ [pkgName: string]: Shared[];
40
40
  };
41
41
  };
42
42
  loadShare<T>(pkgName: string, extraOptions?: {
@@ -4,7 +4,7 @@ import { SyncWaterfallHook } from './hooks';
4
4
  export declare function formatShare(shareArgs: ShareArgs, from: string, name: string, shareStrategy?: ShareStrategy): Shared;
5
5
  export declare function formatShareConfigs(globalOptions: Options, userOptions: UserOptions): {
6
6
  shared: {
7
- [x: string]: Shared[];
7
+ [pkgName: string]: Shared[];
8
8
  };
9
9
  shareInfos: ShareInfos;
10
10
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@module-federation/runtime-core",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "author": "zhouxiao <codingzx@gmail.com>",
6
6
  "main": "./dist/index.cjs.cjs",
7
7
  "module": "./dist/index.esm.js",
8
- "types": "./dist/index.cjs.d.ts",
8
+ "types": "./dist/index.d.ts",
9
9
  "license": "MIT",
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -22,21 +22,21 @@
22
22
  "exports": {
23
23
  ".": {
24
24
  "import": {
25
- "types": "./dist/index.esm.d.ts",
25
+ "types": "./dist/index.d.ts",
26
26
  "default": "./dist/index.esm.js"
27
27
  },
28
28
  "require": {
29
- "types": "./dist/index.cjs.d.ts",
29
+ "types": "./dist/index.d.ts",
30
30
  "default": "./dist/index.cjs.cjs"
31
31
  }
32
32
  },
33
33
  "./types": {
34
34
  "import": {
35
- "types": "./dist/types.esm.d.ts",
35
+ "types": "./dist/types.d.ts",
36
36
  "default": "./dist/types.esm.js"
37
37
  },
38
38
  "require": {
39
- "types": "./dist/types.cjs.d.ts",
39
+ "types": "./dist/types.d.ts",
40
40
  "default": "./dist/types.cjs.cjs"
41
41
  }
42
42
  }
@@ -44,15 +44,15 @@
44
44
  "typesVersions": {
45
45
  "*": {
46
46
  ".": [
47
- "./dist/index.cjs.d.ts"
47
+ "./dist/index.d.ts"
48
48
  ],
49
49
  "types": [
50
- "./dist/types.cjs.d.ts"
50
+ "./dist/types.d.ts"
51
51
  ]
52
52
  }
53
53
  },
54
54
  "dependencies": {
55
- "@module-federation/sdk": "0.17.0",
56
- "@module-federation/error-codes": "0.17.0"
55
+ "@module-federation/sdk": "0.17.1",
56
+ "@module-federation/error-codes": "0.17.1"
57
57
  }
58
58
  }
File without changes
File without changes