@module-federation/sdk
Advanced tools
Comparing version 0.0.0-next-20240228073832 to 0.0.0-next-20240301023125
@@ -134,2 +134,12 @@ 'use strict'; | ||
var DEBUG_LOG = "[ FEDERATION DEBUG ]"; | ||
function safeGetLocalStorageItem() { | ||
try { | ||
if (typeof window !== "undefined" && window.localStorage) { | ||
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE; | ||
} | ||
} catch (error) { | ||
return typeof document !== "undefined"; | ||
} | ||
return false; | ||
} | ||
var Logger = /*#__PURE__*/ function() { | ||
@@ -141,3 +151,3 @@ function Logger(identifier) { | ||
this.identifier = identifier || DEBUG_LOG; | ||
if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) { | ||
if (isBrowserEnv() && safeGetLocalStorageItem()) { | ||
this.enable = true; | ||
@@ -144,0 +154,0 @@ } else if (isDebugMode()) { |
@@ -130,2 +130,12 @@ function _define_property$2(obj, key, value) { | ||
var DEBUG_LOG = "[ FEDERATION DEBUG ]"; | ||
function safeGetLocalStorageItem() { | ||
try { | ||
if (typeof window !== "undefined" && window.localStorage) { | ||
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE; | ||
} | ||
} catch (error) { | ||
return typeof document !== "undefined"; | ||
} | ||
return false; | ||
} | ||
var Logger = /*#__PURE__*/ function() { | ||
@@ -137,3 +147,3 @@ function Logger(identifier) { | ||
this.identifier = identifier || DEBUG_LOG; | ||
if (isBrowserEnv() && localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE) { | ||
if (isBrowserEnv() && safeGetLocalStorageItem()) { | ||
this.enable = true; | ||
@@ -140,0 +150,0 @@ } else if (isDebugMode()) { |
{ | ||
"name": "@module-federation/sdk", | ||
"version": "0.0.0-next-20240228073832", | ||
"version": "0.0.0-next-20240301023125", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "A sdk for support module federation", |
130223
3300