@crimsonsunset/jsg-logger 1.8.0 → 1.8.1

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.
Files changed (2) hide show
  1. package/index.js +17 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -119,6 +119,11 @@ class JSGLogger {
119
119
  window.__JSG_Logger_Enhanced__ = JSGLogger._enhancedLoggers;
120
120
  }
121
121
 
122
+ // Server equivalent: persist to globalThis so cross-bundle module instances can find it
123
+ if (!isBrowser()) {
124
+ globalThis.__JSG_Logger_Enhanced__ = JSGLogger._enhancedLoggers;
125
+ }
126
+
122
127
  return JSGLogger._enhancedLoggers;
123
128
  }
124
129
 
@@ -143,6 +148,13 @@ class JSGLogger {
143
148
  };
144
149
  }
145
150
 
151
+ // Server equivalent: check globalThis for cross-module-instance singleton
152
+ // Same problem as browser cross-bundle, but for Node.js bundled server chunks
153
+ if (!isBrowser() && globalThis.__JSG_Logger_Enhanced__) {
154
+ JSGLogger._enhancedLoggers = globalThis.__JSG_Logger_Enhanced__;
155
+ return JSGLogger._enhancedLoggers;
156
+ }
157
+
146
158
  // No options and no global instance - first time initialization
147
159
  if (!JSGLogger._instance) {
148
160
  JSGLogger._instance = new JSGLogger();
@@ -153,6 +165,11 @@ class JSGLogger {
153
165
  window.JSG_Logger = JSGLogger._enhancedLoggers.controls;
154
166
  window.__JSG_Logger_Enhanced__ = JSGLogger._enhancedLoggers;
155
167
  }
168
+
169
+ // Server equivalent: persist to globalThis for cross-bundle access
170
+ if (!isBrowser()) {
171
+ globalThis.__JSG_Logger_Enhanced__ = JSGLogger._enhancedLoggers;
172
+ }
156
173
  }
157
174
 
158
175
  return JSGLogger._enhancedLoggers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crimsonsunset/jsg-logger",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "type": "module",
5
5
  "description": "Multi-environment logger with smart detection, file-level overrides, and beautiful console formatting. Test it live: https://logger.joesangiorgio.com/",
6
6
  "main": "index.js",