@module-federation/sdk 0.0.13 → 0.0.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 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 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;
@@ -1093,7 +1103,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
1093
1103
  script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
1094
1104
  exportedInterface = scriptContext.module.exports || scriptContext.exports;
1095
1105
  if (attrs && exportedInterface && attrs["globalName"]) {
1096
- container = exportedInterface[attrs["globalName"]];
1106
+ container = exportedInterface[attrs["globalName"]] || exportedInterface;
1097
1107
  cb(undefined, container);
1098
1108
  return [
1099
1109
  2
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 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;
@@ -1089,7 +1099,7 @@ function createScriptNode(url, cb, attrs, createScriptHook) {
1089
1099
  script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
1090
1100
  exportedInterface = scriptContext.module.exports || scriptContext.exports;
1091
1101
  if (attrs && exportedInterface && attrs["globalName"]) {
1092
- container = exportedInterface[attrs["globalName"]];
1102
+ container = exportedInterface[attrs["globalName"]] || exportedInterface;
1093
1103
  cb(undefined, container);
1094
1104
  return [
1095
1105
  2
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [