wu-framework 1.1.15 → 1.1.17

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 (88) hide show
  1. package/README.md +52 -20
  2. package/dist/wu-framework.cjs.js +1 -1
  3. package/dist/wu-framework.cjs.js.map +1 -1
  4. package/dist/wu-framework.dev.js +15511 -15146
  5. package/dist/wu-framework.dev.js.map +1 -1
  6. package/dist/wu-framework.esm.js +1 -1
  7. package/dist/wu-framework.esm.js.map +1 -1
  8. package/dist/wu-framework.umd.js +1 -1
  9. package/dist/wu-framework.umd.js.map +1 -1
  10. package/package.json +166 -161
  11. package/src/adapters/angular/ai.js +30 -30
  12. package/src/adapters/angular/index.d.ts +154 -154
  13. package/src/adapters/angular/index.js +932 -932
  14. package/src/adapters/angular.d.ts +3 -3
  15. package/src/adapters/angular.js +3 -3
  16. package/src/adapters/index.js +168 -168
  17. package/src/adapters/lit/ai.js +20 -20
  18. package/src/adapters/lit/index.d.ts +120 -120
  19. package/src/adapters/lit/index.js +721 -721
  20. package/src/adapters/lit.d.ts +3 -3
  21. package/src/adapters/lit.js +3 -3
  22. package/src/adapters/preact/ai.js +33 -33
  23. package/src/adapters/preact/index.d.ts +108 -108
  24. package/src/adapters/preact/index.js +661 -661
  25. package/src/adapters/preact.d.ts +3 -3
  26. package/src/adapters/preact.js +3 -3
  27. package/src/adapters/react/index.js +48 -54
  28. package/src/adapters/react.d.ts +3 -3
  29. package/src/adapters/react.js +3 -3
  30. package/src/adapters/shared.js +64 -64
  31. package/src/adapters/solid/ai.js +32 -32
  32. package/src/adapters/solid/index.d.ts +101 -101
  33. package/src/adapters/solid/index.js +586 -586
  34. package/src/adapters/solid.d.ts +3 -3
  35. package/src/adapters/solid.js +3 -3
  36. package/src/adapters/svelte/ai.js +31 -31
  37. package/src/adapters/svelte/index.d.ts +166 -166
  38. package/src/adapters/svelte/index.js +798 -798
  39. package/src/adapters/svelte.d.ts +3 -3
  40. package/src/adapters/svelte.js +3 -3
  41. package/src/adapters/vanilla/ai.js +30 -30
  42. package/src/adapters/vanilla/index.d.ts +179 -179
  43. package/src/adapters/vanilla/index.js +785 -785
  44. package/src/adapters/vanilla.d.ts +3 -3
  45. package/src/adapters/vanilla.js +3 -3
  46. package/src/adapters/vue/ai.js +52 -52
  47. package/src/adapters/vue/index.d.ts +299 -299
  48. package/src/adapters/vue/index.js +610 -610
  49. package/src/adapters/vue.d.ts +3 -3
  50. package/src/adapters/vue.js +3 -3
  51. package/src/ai/wu-ai-actions.js +261 -261
  52. package/src/ai/wu-ai-agent.js +546 -546
  53. package/src/ai/wu-ai-browser-primitives.js +354 -354
  54. package/src/ai/wu-ai-browser.js +380 -380
  55. package/src/ai/wu-ai-context.js +332 -332
  56. package/src/ai/wu-ai-conversation.js +613 -613
  57. package/src/ai/wu-ai-orchestrate.js +1021 -1021
  58. package/src/ai/wu-ai-permissions.js +381 -381
  59. package/src/ai/wu-ai-provider.js +700 -700
  60. package/src/ai/wu-ai-schema.js +225 -225
  61. package/src/ai/wu-ai-triggers.js +396 -396
  62. package/src/ai/wu-ai.js +804 -804
  63. package/src/core/wu-app.js +236 -236
  64. package/src/core/wu-cache.js +498 -477
  65. package/src/core/wu-core.js +1412 -1398
  66. package/src/core/wu-error-boundary.js +396 -382
  67. package/src/core/wu-event-bus.js +390 -348
  68. package/src/core/wu-hooks.js +350 -350
  69. package/src/core/wu-html-parser.js +199 -190
  70. package/src/core/wu-iframe-sandbox.js +328 -328
  71. package/src/core/wu-loader.js +385 -273
  72. package/src/core/wu-logger.js +142 -134
  73. package/src/core/wu-manifest.js +532 -509
  74. package/src/core/wu-mcp-bridge.js +432 -432
  75. package/src/core/wu-overrides.js +510 -510
  76. package/src/core/wu-performance.js +228 -228
  77. package/src/core/wu-plugin.js +401 -348
  78. package/src/core/wu-prefetch.js +414 -414
  79. package/src/core/wu-proxy-sandbox.js +477 -476
  80. package/src/core/wu-sandbox.js +779 -779
  81. package/src/core/wu-script-executor.js +161 -113
  82. package/src/core/wu-snapshot-sandbox.js +227 -227
  83. package/src/core/wu-store.js +13 -3
  84. package/src/core/wu-strategies.js +256 -256
  85. package/src/core/wu-style-bridge.js +477 -477
  86. package/src/index.d.ts +317 -0
  87. package/src/index.js +234 -224
  88. package/src/utils/dependency-resolver.js +327 -327
@@ -1,135 +1,143 @@
1
- /**
2
- * 📝 WU-LOGGER: Sistema de logging inteligente para entornos
3
- * Controla los logs automáticamente según el entorno
4
- */
5
-
6
- export class WuLogger {
7
- constructor() {
8
- // Detectar entorno automáticamente
9
- this.isDevelopment = this.detectEnvironment();
10
- // En desarrollo: warn (menos ruido), en producción: error
11
- this.logLevel = this.isDevelopment ? 'warn' : 'error';
12
-
13
- this.levels = {
14
- debug: 0,
15
- info: 1,
16
- warn: 2,
17
- error: 3,
18
- silent: 4
19
- };
20
- }
21
-
22
- /**
23
- * Detectar si estamos en desarrollo
24
- */
25
- detectEnvironment() {
26
- // Múltiples formas de detectar desarrollo
27
- return (
28
- // Vite development
29
- window.location.hostname === 'localhost' ||
30
- window.location.hostname === '127.0.0.1' ||
31
- window.location.port !== '' ||
32
- // NODE_ENV si está disponible
33
- (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development') ||
34
- // URL params para forzar debug
35
- new URLSearchParams(window.location.search).has('wu-debug') ||
36
- // Manual override
37
- window.WU_DEBUG === true
38
- );
39
- }
40
-
41
- /**
42
- * Configurar nivel de logging
43
- */
44
- setLevel(level) {
45
- this.logLevel = level;
46
- return this;
47
- }
48
-
49
- /**
50
- * Habilitar/deshabilitar development mode
51
- */
52
- setDevelopment(isDev) {
53
- this.isDevelopment = isDev;
54
- this.logLevel = isDev ? 'debug' : 'error';
55
- return this;
56
- }
57
-
58
- /**
59
- * Verificar si debemos mostrar el log
60
- */
61
- shouldLog(level) {
62
- return this.levels[level] >= this.levels[this.logLevel];
63
- }
64
-
65
- /**
66
- * Logging methods
67
- */
68
- debug(...args) {
69
- if (this.shouldLog('debug')) {
70
- console.log(...args);
71
- }
72
- }
73
-
74
- info(...args) {
75
- if (this.shouldLog('info')) {
76
- console.info(...args);
77
- }
78
- }
79
-
80
- warn(...args) {
81
- if (this.shouldLog('warn')) {
82
- console.warn(...args);
83
- }
84
- }
85
-
86
- error(...args) {
87
- if (this.shouldLog('error')) {
88
- console.error(...args);
89
- }
90
- }
91
-
92
- /**
93
- * Logging con contexto Wu
94
- */
95
- wu(level, ...args) {
96
- if (this.shouldLog(level)) {
97
- const method = level === 'debug' ? 'log' : level;
98
- console[method]('[Wu]', ...args);
99
- }
100
- }
101
-
102
- /**
103
- * Helper methods específicos para Wu
104
- */
105
- wuDebug(...args) { this.wu('debug', ...args); }
106
- wuInfo(...args) { this.wu('info', ...args); }
107
- wuWarn(...args) { this.wu('warn', ...args); }
108
- wuError(...args) { this.wu('error', ...args); }
109
- }
110
-
111
- // Singleton instance
112
- export const logger = new WuLogger();
113
-
114
- // Helper para compatibilidad con logs existentes
115
- export const wuLog = {
116
- debug: (...args) => logger.wuDebug(...args),
117
- info: (...args) => logger.wuInfo(...args),
118
- warn: (...args) => logger.wuWarn(...args),
119
- error: (...args) => logger.wuError(...args)
120
- };
121
-
122
- /**
123
- * 🔇 Silenciar todos los logs de Wu Framework
124
- * Útil en producción para eliminar todo el ruido
125
- */
126
- export function silenceAllLogs() {
127
- logger.setLevel('silent');
128
- }
129
-
130
- /**
131
- * 🔊 Restaurar logs (nivel debug)
132
- */
133
- export function enableAllLogs() {
134
- logger.setLevel('debug');
1
+ /**
2
+ * 📝 WU-LOGGER: Sistema de logging inteligente para entornos
3
+ * Controla los logs automáticamente según el entorno
4
+ */
5
+
6
+ export class WuLogger {
7
+ constructor() {
8
+ // Detectar entorno automáticamente
9
+ this.isDevelopment = this.detectEnvironment();
10
+ // En desarrollo: warn (menos ruido), en producción: error
11
+ this.logLevel = this.isDevelopment ? 'warn' : 'error';
12
+
13
+ this.levels = {
14
+ debug: 0,
15
+ info: 1,
16
+ warn: 2,
17
+ error: 3,
18
+ silent: 4
19
+ };
20
+ }
21
+
22
+ /**
23
+ * Detectar si estamos en desarrollo
24
+ */
25
+ detectEnvironment() {
26
+ // 1. Explicit flag takes priority
27
+ if (typeof window !== 'undefined' && window.WU_DEBUG === true) return true;
28
+ if (typeof window !== 'undefined' && window.WU_DEBUG === false) return false;
29
+
30
+ // 2. NODE_ENV check (works in bundlers and Node)
31
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') return false;
32
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'development') return true;
33
+
34
+ // 3. Browser heuristics (only if window exists)
35
+ if (typeof window !== 'undefined' && window.location) {
36
+ const hostname = window.location.hostname;
37
+ if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]') return true;
38
+
39
+ // URL param override
40
+ try {
41
+ if (new URLSearchParams(window.location.search).has('wu-debug')) return true;
42
+ } catch {}
43
+ }
44
+
45
+ // 4. Default: assume production
46
+ return false;
47
+ }
48
+
49
+ /**
50
+ * Configurar nivel de logging
51
+ */
52
+ setLevel(level) {
53
+ this.logLevel = level;
54
+ return this;
55
+ }
56
+
57
+ /**
58
+ * Habilitar/deshabilitar development mode
59
+ */
60
+ setDevelopment(isDev) {
61
+ this.isDevelopment = isDev;
62
+ this.logLevel = isDev ? 'debug' : 'error';
63
+ return this;
64
+ }
65
+
66
+ /**
67
+ * Verificar si debemos mostrar el log
68
+ */
69
+ shouldLog(level) {
70
+ return this.levels[level] >= this.levels[this.logLevel];
71
+ }
72
+
73
+ /**
74
+ * Logging methods
75
+ */
76
+ debug(...args) {
77
+ if (this.shouldLog('debug')) {
78
+ console.log(...args);
79
+ }
80
+ }
81
+
82
+ info(...args) {
83
+ if (this.shouldLog('info')) {
84
+ console.info(...args);
85
+ }
86
+ }
87
+
88
+ warn(...args) {
89
+ if (this.shouldLog('warn')) {
90
+ console.warn(...args);
91
+ }
92
+ }
93
+
94
+ error(...args) {
95
+ if (this.shouldLog('error')) {
96
+ console.error(...args);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Logging con contexto Wu
102
+ */
103
+ wu(level, ...args) {
104
+ if (this.shouldLog(level)) {
105
+ const method = level === 'debug' ? 'log' : level;
106
+ console[method]('[Wu]', ...args);
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Helper methods específicos para Wu
112
+ */
113
+ wuDebug(...args) { this.wu('debug', ...args); }
114
+ wuInfo(...args) { this.wu('info', ...args); }
115
+ wuWarn(...args) { this.wu('warn', ...args); }
116
+ wuError(...args) { this.wu('error', ...args); }
117
+ }
118
+
119
+ // Singleton instance
120
+ export const logger = new WuLogger();
121
+
122
+ // Helper para compatibilidad con logs existentes
123
+ export const wuLog = {
124
+ debug: (...args) => logger.wuDebug(...args),
125
+ info: (...args) => logger.wuInfo(...args),
126
+ warn: (...args) => logger.wuWarn(...args),
127
+ error: (...args) => logger.wuError(...args)
128
+ };
129
+
130
+ /**
131
+ * 🔇 Silenciar todos los logs de Wu Framework
132
+ * Útil en producción para eliminar todo el ruido
133
+ */
134
+ export function silenceAllLogs() {
135
+ logger.setLevel('silent');
136
+ }
137
+
138
+ /**
139
+ * 🔊 Restaurar logs (nivel debug)
140
+ */
141
+ export function enableAllLogs() {
142
+ logger.setLevel('debug');
135
143
  }