@module-federation/sdk 0.0.0-next-20240126081640 → 0.0.0-next-20240131231251

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
@@ -108,13 +108,23 @@ function safeToString(info) {
108
108
  }
109
109
  }
110
110
  var DEBUG_LOG = "[ FEDERATION DEBUG ]";
111
+ function safeGetLocalStorageItem() {
112
+ try {
113
+ if (typeof window !== "undefined" && window.localStorage) {
114
+ return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
115
+ }
116
+ } catch (error) {
117
+ return typeof typeof document !== "undefined";
118
+ }
119
+ return false;
120
+ }
111
121
  var Logger = /*#__PURE__*/ function() {
112
122
  function Logger(identifier) {
113
123
  _class_call_check(this, Logger);
114
124
  _define_property$1(this, "enable", false);
115
125
  _define_property$1(this, "identifier", void 0);
116
126
  this.identifier = identifier || DEBUG_LOG;
117
- if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) {
127
+ if (isBrowserEnv() && safeGetLocalStorageItem()) {
118
128
  this.enable = true;
119
129
  } else if (isDebugMode()) {
120
130
  this.enable = true;
@@ -490,10 +500,11 @@ function generateSnapshotFromManifest(manifest) {
490
500
  };
491
501
  })
492
502
  };
493
- if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) {
494
- var prefetchInterface = manifest.metaData.prefetchInterface;
503
+ if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) {
504
+ var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type;
495
505
  basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), {
496
- prefetchInterface: prefetchInterface
506
+ prefetchEntry: simpleJoinRemoteEntry(path, name),
507
+ prefetchEntryType: type
497
508
  });
498
509
  }
499
510
  if ("publicPath" in manifest.metaData) {
package/dist/index.esm.js CHANGED
@@ -104,13 +104,23 @@ function safeToString(info) {
104
104
  }
105
105
  }
106
106
  var DEBUG_LOG = "[ FEDERATION DEBUG ]";
107
+ function safeGetLocalStorageItem() {
108
+ try {
109
+ if (typeof window !== "undefined" && window.localStorage) {
110
+ return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
111
+ }
112
+ } catch (error) {
113
+ return typeof typeof document !== "undefined";
114
+ }
115
+ return false;
116
+ }
107
117
  var Logger = /*#__PURE__*/ function() {
108
118
  function Logger(identifier) {
109
119
  _class_call_check(this, Logger);
110
120
  _define_property$1(this, "enable", false);
111
121
  _define_property$1(this, "identifier", void 0);
112
122
  this.identifier = identifier || DEBUG_LOG;
113
- if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) {
123
+ if (isBrowserEnv() && safeGetLocalStorageItem()) {
114
124
  this.enable = true;
115
125
  } else if (isDebugMode()) {
116
126
  this.enable = true;
@@ -486,10 +496,11 @@ function generateSnapshotFromManifest(manifest) {
486
496
  };
487
497
  })
488
498
  };
489
- if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchInterface) {
490
- var prefetchInterface = manifest.metaData.prefetchInterface;
499
+ if ((_manifest_metaData = manifest.metaData) === null || _manifest_metaData === void 0 ? void 0 : _manifest_metaData.prefetchEntry) {
500
+ var _manifest_metaData_prefetchEntry = manifest.metaData.prefetchEntry, path = _manifest_metaData_prefetchEntry.path, name = _manifest_metaData_prefetchEntry.name, type = _manifest_metaData_prefetchEntry.type;
491
501
  basicRemoteSnapshot = _object_spread_props(_object_spread({}, basicRemoteSnapshot), {
492
- prefetchInterface: prefetchInterface
502
+ prefetchEntry: simpleJoinRemoteEntry(path, name),
503
+ prefetchEntryType: type
493
504
  });
494
505
  }
495
506
  if ("publicPath" in manifest.metaData) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
@@ -27,7 +27,8 @@ export interface BasicProviderModuleInfo extends BasicModuleInfo {
27
27
  modulePath?: string;
28
28
  assets: StatsAssets;
29
29
  }>;
30
- prefetchInterface?: boolean;
30
+ prefetchEntry?: string;
31
+ prefetchEntryType?: RemoteEntryType;
31
32
  }
32
33
  interface BasicProviderModuleInfoWithPublicPath extends BasicProviderModuleInfo {
33
34
  publicPath: string;
@@ -14,7 +14,7 @@ export interface BasicStatsMetaData {
14
14
  globalName: string;
15
15
  buildInfo: StatsBuildInfo;
16
16
  remoteEntry: ResourceInfo;
17
- prefetchInterface: boolean;
17
+ prefetchEntry: ResourceInfo;
18
18
  types: Omit<ResourceInfo, 'type'>;
19
19
  }
20
20
  type StatsMetaDataWithGetPublicPath<T = BasicStatsMetaData> = T & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.0-next-20240126081640",
3
+ "version": "0.0.0-next-20240131231251",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [