wu-framework 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wu-framework",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "🚀 Universal Microfrontends Framework - Framework agnostic, zero config, Shadow DOM isolation",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -34,21 +34,34 @@ export class WuRegistry {
34
34
  }
35
35
  });
36
36
 
37
- // Exponer API global para microfrontends
38
- if (!window.wu) {
39
- window.wu = {};
40
- }
37
+ // API para que apps notifiquen que están listas (se agrega a window.wu cuando exista)
38
+ // No crear window.wu aquí - eso lo hace index.js con la instancia completa
39
+ this._setupNotifyReady();
40
+ }
41
41
 
42
- // API para que apps notifiquen que están listas
43
- window.wu.notifyReady = (appName) => {
44
- console.log(`[WuRegistry] 📢 App ${appName} called notifyReady()`);
42
+ /**
43
+ * 🔔 Setup notifyReady API cuando window.wu esté disponible
44
+ */
45
+ _setupNotifyReady() {
46
+ const setupFn = () => {
47
+ if (window.wu && !window.wu.notifyReady) {
48
+ window.wu.notifyReady = (appName) => {
49
+ console.log(`[WuRegistry] 📢 App ${appName} called notifyReady()`);
50
+ const event = new CustomEvent('wu:app:ready', {
51
+ detail: { appName, timestamp: Date.now() }
52
+ });
53
+ window.dispatchEvent(event);
54
+ };
55
+ }
56
+ };
45
57
 
46
- const event = new CustomEvent('wu:app:ready', {
47
- detail: { appName, timestamp: Date.now() }
48
- });
58
+ // Intentar setup inmediato
59
+ setupFn();
49
60
 
50
- window.dispatchEvent(event);
51
- };
61
+ // Si window.wu no existe aún, esperar un tick
62
+ if (!window.wu) {
63
+ queueMicrotask(setupFn);
64
+ }
52
65
  }
53
66
 
54
67
  /**
package/src/index.js CHANGED
@@ -98,14 +98,13 @@ if (typeof window !== 'undefined' && window.wu && window.wu._isWuFramework) {
98
98
 
99
99
  // Hacer wu disponible globalmente
100
100
  if (typeof window !== 'undefined') {
101
- if (!window.wu) {
102
- window.wu = wu;
103
- console.log('🚀 Wu Framework loaded - Universal Microfrontends ready');
104
- }
101
+ // SIEMPRE configurar window.wu con la instancia real (puede haber un objeto vacío)
102
+ window.wu = wu;
105
103
 
106
- // Siempre configurar estas propiedades (pueden faltar si es instancia reutilizada)
104
+ // Configurar propiedades si no existen
107
105
  if (!wu.version) {
108
- wu.version = '1.0.2';
106
+ wu.version = '1.0.3';
107
+ console.log('🚀 Wu Framework loaded - Universal Microfrontends ready');
109
108
  wu.info = {
110
109
  name: 'Wu Framework',
111
110
  description: 'Universal Microfrontends',