@module-federation/sdk 0.0.0-next-20240228065321 → 0.0.0-next-20240301023125

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
@@ -131,13 +131,23 @@ function safeToString(info) {
131
131
  }
132
132
  }
133
133
  var DEBUG_LOG = "[ FEDERATION DEBUG ]";
134
+ function safeGetLocalStorageItem() {
135
+ try {
136
+ if (typeof window !== "undefined" && window.localStorage) {
137
+ return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
138
+ }
139
+ } catch (error) {
140
+ return typeof document !== "undefined";
141
+ }
142
+ return false;
143
+ }
134
144
  var Logger = /*#__PURE__*/ function() {
135
145
  function Logger(identifier) {
136
146
  _class_call_check(this, Logger);
137
147
  _define_property$1(this, "enable", false);
138
148
  _define_property$1(this, "identifier", void 0);
139
149
  this.identifier = identifier || DEBUG_LOG;
140
- if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) {
150
+ if (isBrowserEnv() && safeGetLocalStorageItem()) {
141
151
  this.enable = true;
142
152
  } else if (isDebugMode()) {
143
153
  this.enable = true;
package/dist/index.esm.js CHANGED
@@ -127,13 +127,23 @@ function safeToString(info) {
127
127
  }
128
128
  }
129
129
  var DEBUG_LOG = "[ FEDERATION DEBUG ]";
130
+ function safeGetLocalStorageItem() {
131
+ try {
132
+ if (typeof window !== "undefined" && window.localStorage) {
133
+ return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
134
+ }
135
+ } catch (error) {
136
+ return typeof document !== "undefined";
137
+ }
138
+ return false;
139
+ }
130
140
  var Logger = /*#__PURE__*/ function() {
131
141
  function Logger(identifier) {
132
142
  _class_call_check(this, Logger);
133
143
  _define_property$1(this, "enable", false);
134
144
  _define_property$1(this, "identifier", void 0);
135
145
  this.identifier = identifier || DEBUG_LOG;
136
- if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) {
146
+ if (isBrowserEnv() && safeGetLocalStorageItem()) {
137
147
  this.enable = true;
138
148
  } else if (isDebugMode()) {
139
149
  this.enable = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/sdk",
3
- "version": "0.0.0-next-20240228065321",
3
+ "version": "0.0.0-next-20240301023125",
4
4
  "license": "MIT",
5
5
  "description": "A sdk for support module federation",
6
6
  "keywords": [