@module-federation/runtime-core 0.0.0-next-20250328075155 → 0.0.0-next-20250328121722

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
@@ -1227,23 +1227,14 @@ let Module = class Module {
1227
1227
  const remoteEntryExports = await this.getEntry();
1228
1228
  if (!this.inited) {
1229
1229
  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');
1230
+ const remoteShareScope = this.remoteInfo.shareScope || 'default';
1231
+ if (!localShareScopeMap[remoteShareScope]) {
1232
+ localShareScopeMap[remoteShareScope] = {};
1235
1233
  }
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]];
1234
+ const shareScope = localShareScopeMap[remoteShareScope];
1243
1235
  const initScope = [];
1244
1236
  const remoteEntryInitOptions = {
1245
- version: this.remoteInfo.version || '',
1246
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? shareScopeKeys : this.remoteInfo.shareScope || 'default'
1237
+ version: this.remoteInfo.version || ''
1247
1238
  };
1248
1239
  // Help to find host instance
1249
1240
  Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {
@@ -1226,23 +1226,14 @@ let Module = class Module {
1226
1226
  const remoteEntryExports = await this.getEntry();
1227
1227
  if (!this.inited) {
1228
1228
  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');
1229
+ const remoteShareScope = this.remoteInfo.shareScope || 'default';
1230
+ if (!localShareScopeMap[remoteShareScope]) {
1231
+ localShareScopeMap[remoteShareScope] = {};
1234
1232
  }
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]];
1233
+ const shareScope = localShareScopeMap[remoteShareScope];
1242
1234
  const initScope = [];
1243
1235
  const remoteEntryInitOptions = {
1244
- version: this.remoteInfo.version || '',
1245
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? shareScopeKeys : this.remoteInfo.shareScope || 'default'
1236
+ version: this.remoteInfo.version || ''
1246
1237
  };
1247
1238
  // Help to find host instance
1248
1239
  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-20250328075155",
3
+ "version": "0.0.0-next-20250328121722",
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-20250328075155",
40
- "@module-federation/error-codes": "0.0.0-next-20250328075155"
39
+ "@module-federation/sdk": "0.0.0-next-20250328121722",
40
+ "@module-federation/error-codes": "0.0.0-next-20250328121722"
41
41
  }
42
42
  }