@stevederico/skateboard-ui 1.1.2 → 1.1.4

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/Utilities.js +21 -0
  2. package/package.json +1 -1
package/Utilities.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import { useEffect, useState } from 'react';
2
2
 
3
3
  // Constants will be initialized by the app shell
4
+ // Use window object to avoid module duplication issues with Vite
4
5
  let _constants = null;
6
+ if (typeof window !== 'undefined') {
7
+ window.__SKATEBOARD_CONSTANTS__ = window.__SKATEBOARD_CONSTANTS__ || null;
8
+ }
5
9
 
6
10
  // Check if localStorage is available (respects private mode, etc.)
7
11
  let _localStorageAvailable = null;
@@ -61,11 +65,28 @@ function safeRemoveItem(key) {
61
65
  }
62
66
 
63
67
  export function initializeUtilities(constants) {
68
+ if (!constants) {
69
+ console.error('[Utilities] initializeUtilities called with null/undefined constants!');
70
+ throw new Error('initializeUtilities called with null/undefined constants');
71
+ }
72
+ console.log('[Utilities] Initializing with app:', constants.appName);
73
+ // Store in both module and window to handle module duplication
64
74
  _constants = constants;
75
+ if (typeof window !== 'undefined') {
76
+ window.__SKATEBOARD_CONSTANTS__ = constants;
77
+ }
78
+ console.log('[Utilities] Initialization complete. _constants set:', !!_constants);
65
79
  }
66
80
 
67
81
  function getConstants() {
82
+ // Check window object first (handles module duplication)
83
+ if (typeof window !== 'undefined' && window.__SKATEBOARD_CONSTANTS__) {
84
+ return window.__SKATEBOARD_CONSTANTS__;
85
+ }
86
+
68
87
  if (!_constants) {
88
+ console.error('[Utilities] getConstants called but _constants is null!');
89
+ console.trace('[Utilities] Call stack:');
69
90
  throw new Error('Utilities not initialized. Call initializeUtilities(constants) first.');
70
91
  }
71
92
  return _constants;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./AppSidebar": {