@module-federation/runtime-core 0.0.0-next-20250328101836 → 0.0.0-next-20250401023940

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 CHANGED
@@ -688,9 +688,6 @@ function formatShare(shareArgs, from, name, shareStrategy) {
688
688
  throw new Error(`Can not get shared '${name}'!`);
689
689
  });
690
690
  }
691
- if (shareArgs.strategy) {
692
- warn(`"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"`);
693
- }
694
691
  var _shareArgs_version, _shareArgs_scope, _shareArgs_strategy;
695
692
  return polyfills._extends({
696
693
  deps: [],
@@ -1227,23 +1224,14 @@ let Module = class Module {
1227
1224
  const remoteEntryExports = await this.getEntry();
1228
1225
  if (!this.inited) {
1229
1226
  const localShareScopeMap = this.host.shareScopeMap;
1230
- const shareScopeKeys = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
1231
- this.remoteInfo.shareScope
1232
- ];
1233
- if (!shareScopeKeys.length) {
1234
- shareScopeKeys.push('default');
1227
+ const remoteShareScope = this.remoteInfo.shareScope || 'default';
1228
+ if (!localShareScopeMap[remoteShareScope]) {
1229
+ localShareScopeMap[remoteShareScope] = {};
1235
1230
  }
1236
- shareScopeKeys.forEach((shareScopeKey)=>{
1237
- if (!localShareScopeMap[shareScopeKey]) {
1238
- localShareScopeMap[shareScopeKey] = {};
1239
- }
1240
- });
1241
- // TODO: compate legacy init params, should use shareScopeMap if exist
1242
- const shareScope = localShareScopeMap[shareScopeKeys[0]];
1231
+ const shareScope = localShareScopeMap[remoteShareScope];
1243
1232
  const initScope = [];
1244
1233
  const remoteEntryInitOptions = {
1245
- version: this.remoteInfo.version || '',
1246
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? shareScopeKeys : this.remoteInfo.shareScope || 'default'
1234
+ version: this.remoteInfo.version || ''
1247
1235
  };
1248
1236
  // Help to find host instance
1249
1237
  Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {
@@ -687,9 +687,6 @@ function formatShare(shareArgs, from, name, shareStrategy) {
687
687
  throw new Error(`Can not get shared '${name}'!`);
688
688
  });
689
689
  }
690
- if (shareArgs.strategy) {
691
- warn(`"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"`);
692
- }
693
690
  var _shareArgs_version, _shareArgs_scope, _shareArgs_strategy;
694
691
  return _extends({
695
692
  deps: [],
@@ -1226,23 +1223,14 @@ let Module = class Module {
1226
1223
  const remoteEntryExports = await this.getEntry();
1227
1224
  if (!this.inited) {
1228
1225
  const localShareScopeMap = this.host.shareScopeMap;
1229
- const shareScopeKeys = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
1230
- this.remoteInfo.shareScope
1231
- ];
1232
- if (!shareScopeKeys.length) {
1233
- shareScopeKeys.push('default');
1226
+ const remoteShareScope = this.remoteInfo.shareScope || 'default';
1227
+ if (!localShareScopeMap[remoteShareScope]) {
1228
+ localShareScopeMap[remoteShareScope] = {};
1234
1229
  }
1235
- shareScopeKeys.forEach((shareScopeKey)=>{
1236
- if (!localShareScopeMap[shareScopeKey]) {
1237
- localShareScopeMap[shareScopeKey] = {};
1238
- }
1239
- });
1240
- // TODO: compate legacy init params, should use shareScopeMap if exist
1241
- const shareScope = localShareScopeMap[shareScopeKeys[0]];
1230
+ const shareScope = localShareScopeMap[remoteShareScope];
1242
1231
  const initScope = [];
1243
1232
  const remoteEntryInitOptions = {
1244
- version: this.remoteInfo.version || '',
1245
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? shareScopeKeys : this.remoteInfo.shareScope || 'default'
1233
+ version: this.remoteInfo.version || ''
1246
1234
  };
1247
1235
  // Help to find host instance
1248
1236
  Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {
@@ -6,7 +6,7 @@ export type PartialOptional<T, K extends keyof T> = Omit<T, K> & {
6
6
  };
7
7
  export interface RemoteInfoCommon {
8
8
  alias?: string;
9
- shareScope?: string | string[];
9
+ shareScope?: string;
10
10
  type?: RemoteEntryType;
11
11
  entryGlobalName?: string;
12
12
  }
@@ -26,7 +26,7 @@ export interface RemoteInfo {
26
26
  entry: string;
27
27
  type: RemoteEntryType;
28
28
  entryGlobalName: string;
29
- shareScope: string | string[];
29
+ shareScope: string;
30
30
  }
31
31
  export type HostInfo = Pick<Options, 'name' | 'version' | 'remotes' | 'version'>;
32
32
  export interface SharedConfig {
@@ -34,7 +34,6 @@ export interface SharedConfig {
34
34
  requiredVersion: false | string;
35
35
  eager?: boolean;
36
36
  strictVersion?: boolean;
37
- layer?: string | null;
38
37
  }
39
38
  type SharedBaseArgs = {
40
39
  version?: string;
@@ -101,8 +100,7 @@ export type LoadModuleOptions = {
101
100
  };
102
101
  export type RemoteEntryInitOptions = {
103
102
  version: string;
104
- shareScopeMap?: ShareScopeMap;
105
- shareScopeKeys: string | string[];
103
+ shareScopeMap: ShareScopeMap;
106
104
  };
107
105
  export type InitTokens = Record<string, Record<string, any>>;
108
106
  export type InitScope = InitTokens[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime-core",
3
- "version": "0.0.0-next-20250328101836",
3
+ "version": "0.0.0-next-20250401023940",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.mjs",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@module-federation/sdk": "0.0.0-next-20250328101836",
40
- "@module-federation/error-codes": "0.0.0-next-20250328101836"
39
+ "@module-federation/sdk": "0.0.0-next-20250401023940",
40
+ "@module-federation/error-codes": "0.0.0-next-20250401023940"
41
41
  }
42
42
  }