create-fluxstack 1.18.1 → 1.19.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.
- package/CHANGELOG.md +132 -0
- package/app/client/src/App.tsx +7 -7
- package/app/client/src/components/AppLayout.tsx +60 -23
- package/app/client/src/components/ColorWheel.tsx +195 -0
- package/app/client/src/components/DemoPage.tsx +5 -3
- package/app/client/src/components/LiveUploadWidget.tsx +1 -1
- package/app/client/src/components/ThemePicker.tsx +307 -0
- package/app/client/src/config/theme.config.ts +127 -0
- package/app/client/src/hooks/useThemeClock.ts +66 -0
- package/app/client/src/index.css +193 -0
- package/app/client/src/lib/theme-clock.ts +201 -0
- package/app/client/src/live/AuthDemo.tsx +9 -9
- package/app/client/src/live/CounterDemo.tsx +10 -10
- package/app/client/src/live/FormDemo.tsx +8 -8
- package/app/client/src/live/PingPongDemo.tsx +10 -10
- package/app/client/src/live/RoomChatDemo.tsx +10 -10
- package/app/client/src/live/SharedCounterDemo.tsx +5 -5
- package/app/client/src/pages/ApiTestPage.tsx +5 -5
- package/app/client/src/pages/HomePage.tsx +12 -12
- package/app/server/index.ts +8 -0
- package/app/server/live/auto-generated-components.ts +1 -1
- package/core/build/index.ts +1 -1
- package/core/cli/command-registry.ts +1 -1
- package/core/cli/commands/build.ts +25 -6
- package/core/cli/commands/plugin-deps.ts +1 -2
- package/core/cli/generators/plugin.ts +433 -581
- package/core/framework/server.ts +22 -8
- package/core/index.ts +6 -5
- package/core/plugins/index.ts +71 -199
- package/core/plugins/types.ts +76 -461
- package/core/server/index.ts +1 -1
- package/core/utils/logger/startup-banner.ts +26 -4
- package/core/utils/version.ts +6 -6
- package/create-fluxstack.ts +216 -107
- package/package.json +6 -5
- package/tsconfig.json +2 -1
- package/app/client/.live-stubs/LiveAdminPanel.js +0 -15
- package/app/client/.live-stubs/LiveCounter.js +0 -9
- package/app/client/.live-stubs/LiveForm.js +0 -11
- package/app/client/.live-stubs/LiveLocalCounter.js +0 -8
- package/app/client/.live-stubs/LivePingPong.js +0 -10
- package/app/client/.live-stubs/LiveRoomChat.js +0 -11
- package/app/client/.live-stubs/LiveSharedCounter.js +0 -10
- package/app/client/.live-stubs/LiveUpload.js +0 -15
- package/core/plugins/config.ts +0 -356
- package/core/plugins/dependency-manager.ts +0 -481
- package/core/plugins/discovery.ts +0 -379
- package/core/plugins/executor.ts +0 -353
- package/core/plugins/manager.ts +0 -645
- package/core/plugins/module-resolver.ts +0 -227
- package/core/plugins/registry.ts +0 -913
- package/vitest.config.live.ts +0 -69
package/core/framework/server.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Elysia, type AnyElysia } from "elysia"
|
|
2
2
|
import type { FluxStackConfig, FluxStackContext } from "@core/types"
|
|
3
3
|
import type { FluxStack, PluginContext, PluginUtils, PluginConfigSchema, PluginHook } from "@core/plugins/types"
|
|
4
|
-
import { PluginRegistry } from "@
|
|
5
|
-
import { PluginManager } from "@core/plugins/manager"
|
|
4
|
+
import { PluginRegistry, PluginManager } from "@fluxstack/plugin-kit"
|
|
6
5
|
import { fluxStackConfig } from "@config"
|
|
7
6
|
import { getEnvironmentInfo } from "@core/config"
|
|
8
7
|
import { logger, type Logger } from "@core/utils/logger"
|
|
@@ -11,7 +10,7 @@ import { liveServer } from "@core/server/live"
|
|
|
11
10
|
import { FluxStackError } from "@core/utils/errors"
|
|
12
11
|
import { createTimer, formatBytes, isProduction, isDevelopment } from "@core/utils/helpers"
|
|
13
12
|
import { createHash } from "crypto"
|
|
14
|
-
import { createPluginUtils } from "@
|
|
13
|
+
import { createPluginUtils } from "@fluxstack/plugin-kit"
|
|
15
14
|
import { pluginClientHooks } from "@core/server/plugin-client-hooks"
|
|
16
15
|
import type { Plugin } from "@core/plugins"
|
|
17
16
|
|
|
@@ -149,10 +148,19 @@ export class FluxStackFramework {
|
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
// Initialize plugin manager
|
|
153
|
-
|
|
151
|
+
// Initialize plugin manager.
|
|
152
|
+
// The plugin-kit's PluginManager requires `settings` (plugin-related
|
|
153
|
+
// config slice) and `clientHooks` (registry impl) to be passed
|
|
154
|
+
// explicitly — it no longer reaches into the full config or imports
|
|
155
|
+
// the client hooks singleton.
|
|
156
|
+
this.pluginManager = new PluginManager<FluxStackConfig>({
|
|
154
157
|
config: fullConfig,
|
|
158
|
+
settings: fullConfig.plugins,
|
|
155
159
|
logger: pluginLogger,
|
|
160
|
+
clientHooks: {
|
|
161
|
+
register: (hookName: string, jsCode: string) =>
|
|
162
|
+
pluginClientHooks.register(hookName, jsCode)
|
|
163
|
+
},
|
|
156
164
|
app: this.app
|
|
157
165
|
})
|
|
158
166
|
|
|
@@ -832,17 +840,23 @@ export class FluxStackFramework {
|
|
|
832
840
|
const showBanner = this.cfg.server.showBanner !== false // default: true
|
|
833
841
|
const vitePluginActive = this.pluginRegistry.has('vite')
|
|
834
842
|
|
|
835
|
-
// Prepare startup info for banner or callback
|
|
843
|
+
// Prepare startup info for banner or callback.
|
|
844
|
+
// `plugins` is sourced from the PluginRegistry (the single source
|
|
845
|
+
// of truth after the plugin-kit migration) — this includes every
|
|
846
|
+
// plugin registered via `.use()`, regardless of whether it
|
|
847
|
+
// bothered to push itself to `globalThis.__fluxstackPlugins`.
|
|
848
|
+
const registeredPlugins = this.pluginRegistry.getAll()
|
|
836
849
|
const startupInfo: StartupInfo = {
|
|
837
850
|
port,
|
|
838
851
|
host: this.cfg.server.host || 'localhost',
|
|
839
852
|
apiPrefix,
|
|
840
853
|
environment: this.context.environment,
|
|
841
|
-
pluginCount:
|
|
854
|
+
pluginCount: registeredPlugins.length,
|
|
842
855
|
vitePort: this.cfg.client?.port,
|
|
843
856
|
viteEmbedded: vitePluginActive, // Vite is embedded when plugin is active
|
|
844
857
|
swaggerPath: '/swagger', // TODO: Get from swagger plugin config
|
|
845
|
-
liveComponents: liveServer?.registry.getRegisteredComponentNames() ?? []
|
|
858
|
+
liveComponents: liveServer?.registry.getRegisteredComponentNames() ?? [],
|
|
859
|
+
plugins: registeredPlugins.map(p => ({ name: p.name })),
|
|
846
860
|
}
|
|
847
861
|
|
|
848
862
|
// Display banner if enabled
|
package/core/index.ts
CHANGED
|
@@ -22,11 +22,12 @@ export * from './build'
|
|
|
22
22
|
// CLI and generators
|
|
23
23
|
export * from './cli/generators'
|
|
24
24
|
|
|
25
|
-
// Plugin system (
|
|
26
|
-
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
// Plugin system (via @fluxstack/plugin-kit — single source of truth)
|
|
26
|
+
export {
|
|
27
|
+
PluginRegistry,
|
|
28
|
+
PluginDiscovery,
|
|
29
|
+
PluginManager,
|
|
30
|
+
} from '@fluxstack/plugin-kit'
|
|
30
31
|
|
|
31
32
|
// Utilities (avoid wildcard export to prevent type duplication)
|
|
32
33
|
export {
|
package/core/plugins/index.ts
CHANGED
|
@@ -1,207 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Thin shim barrel over @fluxstack/plugin-kit.
|
|
3
|
+
*
|
|
4
|
+
* All plugin system types and runtime live in @fluxstack/plugin-kit
|
|
5
|
+
* now (see .ai-notes/plans/2026-04-11-plugin-kit-extraction.md).
|
|
6
|
+
* This barrel just re-exports them. The FluxStack-specialized type
|
|
7
|
+
* aliases (Plugin = Plugin<FluxStackConfig>, PluginContext =
|
|
8
|
+
* PluginContext<FluxStackConfig>, etc.) come from the local
|
|
9
|
+
* `./types` shim so legacy `import { Plugin } from '@core/plugins'`
|
|
10
|
+
* call sites stay typed against FluxStack's concrete config shape.
|
|
4
11
|
*/
|
|
5
12
|
|
|
6
|
-
//
|
|
7
|
-
export type {
|
|
8
|
-
FluxStack,
|
|
9
|
-
PluginContext,
|
|
10
|
-
PluginHook,
|
|
11
|
-
PluginPriority,
|
|
12
|
-
PluginManifest,
|
|
13
|
-
PluginLoadResult,
|
|
14
|
-
PluginRegistryState,
|
|
15
|
-
PluginHookResult,
|
|
16
|
-
PluginMetrics,
|
|
17
|
-
PluginDiscoveryOptions,
|
|
18
|
-
PluginInstallOptions,
|
|
19
|
-
PluginExecutionContext,
|
|
20
|
-
PluginValidationResult,
|
|
21
|
-
HookExecutionOptions,
|
|
22
|
-
PluginLifecycleEvent,
|
|
23
|
-
PluginConfigSchema,
|
|
24
|
-
RequestContext,
|
|
25
|
-
ResponseContext,
|
|
26
|
-
ErrorContext,
|
|
27
|
-
BuildContext
|
|
28
|
-
} from './types'
|
|
29
|
-
|
|
30
|
-
export type Plugin = FluxStack.Plugin
|
|
31
|
-
|
|
32
|
-
// Plugin registry
|
|
33
|
-
export { PluginRegistry } from './registry'
|
|
34
|
-
export type { PluginRegistryConfig } from './registry'
|
|
35
|
-
|
|
36
|
-
// Plugin discovery
|
|
37
|
-
export { PluginDiscovery } from './discovery'
|
|
38
|
-
export type { PluginDiscoveryConfig } from './discovery'
|
|
13
|
+
// ─── Runtime + non-specialized types (from the lib) ──────────
|
|
39
14
|
|
|
40
|
-
// Plugin configuration management
|
|
41
15
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
16
|
+
PluginRegistry,
|
|
17
|
+
PluginDiscovery,
|
|
18
|
+
PluginManager,
|
|
19
|
+
PluginModuleResolver,
|
|
20
|
+
PluginExecutor,
|
|
21
|
+
calculateExecutionStats,
|
|
22
|
+
createPluginUtils,
|
|
23
|
+
createRequestContext,
|
|
24
|
+
createResponseContext,
|
|
25
|
+
createErrorContext,
|
|
26
|
+
createBuildContext,
|
|
27
|
+
PluginError,
|
|
28
|
+
} from '@fluxstack/plugin-kit'
|
|
46
29
|
|
|
47
|
-
// Plugin manager
|
|
48
|
-
export {
|
|
49
|
-
PluginManager,
|
|
50
|
-
createRequestContext,
|
|
51
|
-
createResponseContext,
|
|
52
|
-
createErrorContext,
|
|
53
|
-
createBuildContext
|
|
54
|
-
} from './manager'
|
|
55
|
-
export type { PluginManagerConfig } from './manager'
|
|
56
|
-
|
|
57
|
-
// Module resolver for plugins
|
|
58
|
-
export { PluginModuleResolver } from './module-resolver'
|
|
59
|
-
export type { ModuleResolverConfig } from './module-resolver'
|
|
60
|
-
|
|
61
|
-
// Plugin executor
|
|
62
|
-
export {
|
|
63
|
-
PluginExecutor,
|
|
64
|
-
calculateExecutionStats
|
|
65
|
-
} from './executor'
|
|
66
30
|
export type {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
31
|
+
FluxStack,
|
|
32
|
+
PluginHook,
|
|
33
|
+
PluginPriority,
|
|
34
|
+
PluginManifest,
|
|
35
|
+
PluginHookResult,
|
|
36
|
+
PluginMetrics,
|
|
37
|
+
PluginDiscoveryOptions,
|
|
38
|
+
PluginInstallOptions,
|
|
39
|
+
PluginValidationResult,
|
|
40
|
+
HookExecutionOptions,
|
|
41
|
+
PluginLifecycleEvent,
|
|
42
|
+
PluginConfigSchema,
|
|
43
|
+
PluginRegistryConfig,
|
|
44
|
+
PluginRegistrySettings,
|
|
45
|
+
PluginDiscoveryConfig,
|
|
46
|
+
PluginManagerConfig,
|
|
47
|
+
ModuleResolverConfig,
|
|
48
|
+
PluginExecutionPlan,
|
|
49
|
+
PluginExecutionStep,
|
|
50
|
+
PluginExecutionStats,
|
|
51
|
+
} from '@fluxstack/plugin-kit'
|
|
52
|
+
|
|
53
|
+
// ─── FluxStack-specialized type aliases (from the local shim) ───
|
|
71
54
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
...(config.dependencies && { dependencies: config.dependencies }),
|
|
98
|
-
...(config.priority !== undefined && { priority: config.priority }),
|
|
99
|
-
...(config.setup && { setup: config.setup }),
|
|
100
|
-
...(config.onServerStart && { onServerStart: config.onServerStart }),
|
|
101
|
-
...(config.onServerStop && { onServerStop: config.onServerStop }),
|
|
102
|
-
...(config.onRequest && { onRequest: config.onRequest }),
|
|
103
|
-
...(config.onBeforeRoute && { onBeforeRoute: config.onBeforeRoute }),
|
|
104
|
-
...(config.onResponse && { onResponse: config.onResponse }),
|
|
105
|
-
...(config.onError && { onError: config.onError }),
|
|
106
|
-
...(config.configSchema && { configSchema: config.configSchema }),
|
|
107
|
-
...(config.defaultConfig !== undefined ? { defaultConfig: config.defaultConfig } : {})
|
|
108
|
-
} as Plugin
|
|
109
|
-
return plugin
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Create a plugin manifest
|
|
114
|
-
*/
|
|
115
|
-
createManifest: (config: {
|
|
116
|
-
name: string
|
|
117
|
-
version: string
|
|
118
|
-
description: string
|
|
119
|
-
author: string
|
|
120
|
-
license: string
|
|
121
|
-
homepage?: string
|
|
122
|
-
repository?: string
|
|
123
|
-
keywords?: string[]
|
|
124
|
-
dependencies?: Record<string, string>
|
|
125
|
-
peerDependencies?: Record<string, string>
|
|
126
|
-
fluxstack: {
|
|
127
|
-
version: string
|
|
128
|
-
hooks: PluginHook[]
|
|
129
|
-
config?: PluginConfigSchema
|
|
130
|
-
category?: string
|
|
131
|
-
tags?: string[]
|
|
132
|
-
}
|
|
133
|
-
}): PluginManifest => {
|
|
134
|
-
return {
|
|
135
|
-
name: config.name,
|
|
136
|
-
version: config.version || '1.0.0',
|
|
137
|
-
description: config.description,
|
|
138
|
-
author: config.author,
|
|
139
|
-
license: config.license,
|
|
140
|
-
homepage: config.homepage,
|
|
141
|
-
repository: config.repository,
|
|
142
|
-
keywords: config.keywords || [],
|
|
143
|
-
dependencies: config.dependencies || {},
|
|
144
|
-
peerDependencies: config.peerDependencies,
|
|
145
|
-
fluxstack: config.fluxstack
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Validate plugin structure
|
|
151
|
-
*/
|
|
152
|
-
validatePlugin: (plugin: unknown): plugin is Plugin => {
|
|
153
|
-
return (
|
|
154
|
-
!!plugin &&
|
|
155
|
-
typeof plugin === 'object' &&
|
|
156
|
-
'name' in plugin &&
|
|
157
|
-
typeof (plugin as Record<string, unknown>).name === 'string' &&
|
|
158
|
-
((plugin as Record<string, unknown>).name as string).length > 0
|
|
159
|
-
)
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Check if plugin implements hook
|
|
164
|
-
*/
|
|
165
|
-
implementsHook: (plugin: Plugin, hook: PluginHook): boolean => {
|
|
166
|
-
const hookFunction = plugin[hook]
|
|
167
|
-
return !!hookFunction && typeof hookFunction === 'function'
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Get plugin hooks
|
|
172
|
-
*/
|
|
173
|
-
getPluginHooks: (plugin: Plugin): PluginHook[] => {
|
|
174
|
-
const hooks: PluginHook[] = []
|
|
175
|
-
const possibleHooks: PluginHook[] = [
|
|
176
|
-
'setup',
|
|
177
|
-
'onServerStart',
|
|
178
|
-
'onServerStop',
|
|
179
|
-
'onRequest',
|
|
180
|
-
'onResponse',
|
|
181
|
-
'onError',
|
|
182
|
-
'onBuild',
|
|
183
|
-
'onBuildComplete'
|
|
184
|
-
]
|
|
185
|
-
|
|
186
|
-
for (const hook of possibleHooks) {
|
|
187
|
-
if (PluginUtils.implementsHook(plugin, hook)) {
|
|
188
|
-
hooks.push(hook)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return hooks
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Re-export types for convenience
|
|
197
|
-
import type {
|
|
198
|
-
PluginContext,
|
|
199
|
-
PluginConfigSchema,
|
|
200
|
-
PluginHook,
|
|
201
|
-
PluginManifest,
|
|
202
|
-
PluginPriority,
|
|
203
|
-
RequestContext,
|
|
204
|
-
ResponseContext,
|
|
205
|
-
ErrorContext,
|
|
206
|
-
FluxStack
|
|
207
|
-
} from './types'
|
|
55
|
+
export type {
|
|
56
|
+
Plugin,
|
|
57
|
+
PluginContext,
|
|
58
|
+
RequestContext,
|
|
59
|
+
ResponseContext,
|
|
60
|
+
ErrorContext,
|
|
61
|
+
RouteContext,
|
|
62
|
+
ValidationContext,
|
|
63
|
+
TransformContext,
|
|
64
|
+
BuildContext,
|
|
65
|
+
BuildAssetContext,
|
|
66
|
+
BuildErrorContext,
|
|
67
|
+
ConfigLoadContext,
|
|
68
|
+
PluginEventContext,
|
|
69
|
+
CliArgument,
|
|
70
|
+
CliOption,
|
|
71
|
+
CliCommand,
|
|
72
|
+
CliContext,
|
|
73
|
+
PluginLoadResult,
|
|
74
|
+
PluginRegistryState,
|
|
75
|
+
PluginExecutionContext,
|
|
76
|
+
PluginClientHooksAPI,
|
|
77
|
+
PluginUtils,
|
|
78
|
+
Logger,
|
|
79
|
+
} from './types'
|