create-fluxstack 1.18.1 → 1.20.0

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 (69) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/LLMD/INDEX.md +1 -1
  3. package/LLMD/MAINTENANCE.md +197 -197
  4. package/LLMD/MIGRATION.md +44 -1
  5. package/LLMD/agent.md +20 -7
  6. package/LLMD/config/declarative-system.md +268 -268
  7. package/LLMD/config/environment-vars.md +3 -6
  8. package/LLMD/config/runtime-reload.md +401 -401
  9. package/LLMD/core/build-system.md +599 -599
  10. package/LLMD/core/framework-lifecycle.md +249 -229
  11. package/LLMD/core/plugin-system.md +154 -100
  12. package/LLMD/patterns/anti-patterns.md +397 -397
  13. package/LLMD/patterns/project-structure.md +264 -264
  14. package/LLMD/patterns/type-safety.md +61 -5
  15. package/LLMD/reference/cli-commands.md +31 -7
  16. package/LLMD/reference/plugin-hooks.md +4 -2
  17. package/LLMD/reference/troubleshooting.md +364 -364
  18. package/LLMD/resources/controllers.md +465 -465
  19. package/LLMD/resources/live-auth.md +178 -1
  20. package/LLMD/resources/live-binary-delta.md +3 -1
  21. package/LLMD/resources/live-components.md +1192 -1041
  22. package/LLMD/resources/live-logging.md +3 -1
  23. package/LLMD/resources/live-rooms.md +1 -1
  24. package/LLMD/resources/live-upload.md +228 -181
  25. package/LLMD/resources/plugins-external.md +8 -7
  26. package/LLMD/resources/rest-auth.md +290 -290
  27. package/LLMD/resources/routes-eden.md +254 -254
  28. package/app/client/src/App.tsx +7 -7
  29. package/app/client/src/components/AppLayout.tsx +60 -23
  30. package/app/client/src/components/ColorWheel.tsx +195 -0
  31. package/app/client/src/components/DemoPage.tsx +5 -3
  32. package/app/client/src/components/LiveUploadWidget.tsx +1 -1
  33. package/app/client/src/components/ThemePicker.tsx +307 -0
  34. package/app/client/src/config/theme.config.ts +127 -0
  35. package/app/client/src/hooks/useThemeClock.ts +66 -0
  36. package/app/client/src/index.css +193 -0
  37. package/app/client/src/lib/theme-clock.ts +201 -0
  38. package/app/client/src/live/AuthDemo.tsx +9 -9
  39. package/app/client/src/live/CounterDemo.tsx +10 -10
  40. package/app/client/src/live/FormDemo.tsx +8 -8
  41. package/app/client/src/live/PingPongDemo.tsx +10 -10
  42. package/app/client/src/live/RoomChatDemo.tsx +10 -10
  43. package/app/client/src/live/SharedCounterDemo.tsx +5 -5
  44. package/app/client/src/pages/ApiTestPage.tsx +5 -5
  45. package/app/client/src/pages/HomePage.tsx +12 -12
  46. package/app/server/index.ts +8 -0
  47. package/app/server/live/auto-generated-components.ts +1 -1
  48. package/core/build/index.ts +1 -1
  49. package/core/cli/command-registry.ts +1 -1
  50. package/core/cli/commands/build.ts +25 -6
  51. package/core/cli/commands/plugin-deps.ts +1 -2
  52. package/core/cli/generators/plugin.ts +433 -581
  53. package/core/framework/server.ts +22 -8
  54. package/core/index.ts +6 -5
  55. package/core/plugins/index.ts +71 -199
  56. package/core/plugins/types.ts +76 -461
  57. package/core/server/index.ts +1 -1
  58. package/core/utils/logger/startup-banner.ts +26 -4
  59. package/create-fluxstack.ts +216 -107
  60. package/package.json +108 -107
  61. package/tsconfig.json +2 -1
  62. package/core/plugins/config.ts +0 -356
  63. package/core/plugins/dependency-manager.ts +0 -481
  64. package/core/plugins/discovery.ts +0 -379
  65. package/core/plugins/executor.ts +0 -353
  66. package/core/plugins/manager.ts +0 -645
  67. package/core/plugins/module-resolver.ts +0 -227
  68. package/core/plugins/registry.ts +0 -913
  69. package/vitest.config.live.ts +0 -69
@@ -1,227 +0,0 @@
1
- /**
2
- * Module Resolver para Plugins
3
- * Implementa resolução em cascata: plugin local → projeto principal
4
- */
5
-
6
- import { existsSync, readFileSync } from 'fs'
7
- import { join, resolve } from 'path'
8
- import type { Logger } from '@core/utils/logger'
9
-
10
- export interface ModuleResolverConfig {
11
- projectRoot: string
12
- logger?: Logger
13
- }
14
-
15
- export class PluginModuleResolver {
16
- private config: ModuleResolverConfig
17
- private logger?: Logger
18
- private static readonly MAX_CACHE_SIZE = 1000
19
- private resolveCache: Map<string, string> = new Map()
20
-
21
- constructor(config: ModuleResolverConfig) {
22
- this.config = config
23
- this.logger = config.logger
24
- }
25
-
26
- private cacheSet(key: string, value: string): void {
27
- if (this.resolveCache.size >= PluginModuleResolver.MAX_CACHE_SIZE) {
28
- const firstKey = this.resolveCache.keys().next().value
29
- if (firstKey !== undefined) {
30
- this.resolveCache.delete(firstKey)
31
- }
32
- }
33
- this.resolveCache.set(key, value)
34
- }
35
-
36
- /**
37
- * Resolve um módulo com estratégia em cascata:
38
- * 1. node_modules local do plugin
39
- * 2. node_modules do projeto principal
40
- */
41
- resolveModule(moduleName: string, pluginPath: string): string | null {
42
- const cacheKey = `${pluginPath}::${moduleName}`
43
-
44
- // Verificar cache
45
- if (this.resolveCache.has(cacheKey)) {
46
- return this.resolveCache.get(cacheKey)!
47
- }
48
-
49
- this.logger?.debug(`Resolvendo módulo '${moduleName}' para plugin em '${pluginPath}'`)
50
-
51
- // 1. Tentar no node_modules local do plugin
52
- const localPath = this.tryResolveLocal(moduleName, pluginPath)
53
- if (localPath) {
54
- this.logger?.debug(`✅ Módulo '${moduleName}' encontrado localmente: ${localPath}`)
55
- this.cacheSet(cacheKey, localPath)
56
- return localPath
57
- }
58
-
59
- // 2. Tentar no node_modules do projeto principal
60
- const projectPath = this.tryResolveProject(moduleName)
61
- if (projectPath) {
62
- this.logger?.debug(`✅ Módulo '${moduleName}' encontrado no projeto: ${projectPath}`)
63
- this.cacheSet(cacheKey, projectPath)
64
- return projectPath
65
- }
66
-
67
- this.logger?.warn(`❌ Módulo '${moduleName}' não encontrado em nenhum contexto`)
68
- return null
69
- }
70
-
71
- /**
72
- * Tenta resolver no node_modules local do plugin
73
- */
74
- private tryResolveLocal(moduleName: string, pluginPath: string): string | null {
75
- const pluginDir = resolve(pluginPath)
76
- const localNodeModules = join(pluginDir, 'node_modules', moduleName)
77
-
78
- if (existsSync(localNodeModules)) {
79
- // Verificar se tem package.json para pegar o entry point
80
- const packageJsonPath = join(localNodeModules, 'package.json')
81
- if (existsSync(packageJsonPath)) {
82
- try {
83
- const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))
84
- const entry = pkg.module || pkg.main || 'index.js'
85
- const entryPath = join(localNodeModules, entry)
86
-
87
- if (existsSync(entryPath)) {
88
- return entryPath
89
- }
90
- } catch (error) {
91
- this.logger?.debug(`Erro ao ler package.json de '${moduleName}'`, { error })
92
- }
93
- }
94
-
95
- // Fallback: tentar index.js/index.ts
96
- const indexJs = join(localNodeModules, 'index.js')
97
- const indexTs = join(localNodeModules, 'index.ts')
98
-
99
- if (existsSync(indexJs)) return indexJs
100
- if (existsSync(indexTs)) return indexTs
101
-
102
- return localNodeModules
103
- }
104
-
105
- return null
106
- }
107
-
108
- /**
109
- * Tenta resolver no node_modules do projeto principal
110
- */
111
- private tryResolveProject(moduleName: string): string | null {
112
- const projectNodeModules = join(this.config.projectRoot, 'node_modules', moduleName)
113
-
114
- if (existsSync(projectNodeModules)) {
115
- // Verificar se tem package.json para pegar o entry point
116
- const packageJsonPath = join(projectNodeModules, 'package.json')
117
- if (existsSync(packageJsonPath)) {
118
- try {
119
- const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))
120
- const entry = pkg.module || pkg.main || 'index.js'
121
- const entryPath = join(projectNodeModules, entry)
122
-
123
- if (existsSync(entryPath)) {
124
- return entryPath
125
- }
126
- } catch (error) {
127
- this.logger?.debug(`Erro ao ler package.json de '${moduleName}'`, { error })
128
- }
129
- }
130
-
131
- // Fallback: tentar index.js/index.ts
132
- const indexJs = join(projectNodeModules, 'index.js')
133
- const indexTs = join(projectNodeModules, 'index.ts')
134
-
135
- if (existsSync(indexJs)) return indexJs
136
- if (existsSync(indexTs)) return indexTs
137
-
138
- return projectNodeModules
139
- }
140
-
141
- return null
142
- }
143
-
144
- /**
145
- * Resolve sub-paths (ex: @noble/curves/ed25519)
146
- */
147
- resolveSubpath(moduleName: string, subpath: string, pluginPath: string): string | null {
148
- const fullModule = `${moduleName}/${subpath}`
149
- const cacheKey = `${pluginPath}::${fullModule}`
150
-
151
- // Verificar cache
152
- if (this.resolveCache.has(cacheKey)) {
153
- return this.resolveCache.get(cacheKey)!
154
- }
155
-
156
- this.logger?.debug(`Resolvendo subpath '${fullModule}' para plugin em '${pluginPath}'`)
157
-
158
- // 1. Tentar no node_modules local do plugin
159
- const pluginDir = resolve(pluginPath)
160
- const localPath = join(pluginDir, 'node_modules', fullModule)
161
-
162
- if (this.existsWithExtension(localPath)) {
163
- const resolvedLocal = this.findFileWithExtension(localPath)
164
- if (resolvedLocal) {
165
- this.logger?.debug(`✅ Subpath '${fullModule}' encontrado localmente: ${resolvedLocal}`)
166
- this.cacheSet(cacheKey, resolvedLocal)
167
- return resolvedLocal
168
- }
169
- }
170
-
171
- // 2. Tentar no node_modules do projeto principal
172
- const projectPath = join(this.config.projectRoot, 'node_modules', fullModule)
173
-
174
- if (this.existsWithExtension(projectPath)) {
175
- const resolvedProject = this.findFileWithExtension(projectPath)
176
- if (resolvedProject) {
177
- this.logger?.debug(`✅ Subpath '${fullModule}' encontrado no projeto: ${resolvedProject}`)
178
- this.cacheSet(cacheKey, resolvedProject)
179
- return resolvedProject
180
- }
181
- }
182
-
183
- this.logger?.warn(`❌ Subpath '${fullModule}' não encontrado em nenhum contexto`)
184
- return null
185
- }
186
-
187
- /**
188
- * Verifica se arquivo existe com alguma extensão comum
189
- */
190
- private existsWithExtension(basePath: string): boolean {
191
- const extensions = ['', '.js', '.ts', '.mjs', '.cjs', '.jsx', '.tsx', '/index.js', '/index.ts']
192
- return extensions.some(ext => existsSync(basePath + ext))
193
- }
194
-
195
- /**
196
- * Encontra arquivo com extensão
197
- */
198
- private findFileWithExtension(basePath: string): string | null {
199
- const extensions = ['', '.js', '.ts', '.mjs', '.cjs', '.jsx', '.tsx', '/index.js', '/index.ts']
200
-
201
- for (const ext of extensions) {
202
- const fullPath = basePath + ext
203
- if (existsSync(fullPath)) {
204
- return fullPath
205
- }
206
- }
207
-
208
- return null
209
- }
210
-
211
- /**
212
- * Limpar cache
213
- */
214
- clearCache(): void {
215
- this.resolveCache.clear()
216
- }
217
-
218
- /**
219
- * Obter estatísticas
220
- */
221
- getStats() {
222
- return {
223
- cachedModules: this.resolveCache.size,
224
- projectRoot: this.config.projectRoot
225
- }
226
- }
227
- }