create-fluxstack 1.16.0 → 1.17.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 +80 -0
- package/app/client/src/App.tsx +8 -0
- package/app/client/src/live/AuthDemo.tsx +4 -4
- package/core/build/bundler.ts +40 -26
- package/core/build/flux-plugins-generator.ts +325 -325
- package/core/build/index.ts +92 -21
- package/core/cli/command-registry.ts +44 -46
- package/core/cli/commands/build.ts +11 -6
- package/core/cli/commands/create.ts +7 -5
- package/core/cli/commands/dev.ts +6 -5
- package/core/cli/commands/help.ts +3 -2
- package/core/cli/commands/make-plugin.ts +8 -7
- package/core/cli/commands/plugin-add.ts +60 -43
- package/core/cli/commands/plugin-deps.ts +73 -57
- package/core/cli/commands/plugin-list.ts +44 -41
- package/core/cli/commands/plugin-remove.ts +33 -22
- package/core/cli/generators/component.ts +770 -769
- package/core/cli/generators/controller.ts +9 -8
- package/core/cli/generators/index.ts +148 -146
- package/core/cli/generators/interactive.ts +228 -227
- package/core/cli/generators/plugin.ts +11 -10
- package/core/cli/generators/prompts.ts +83 -82
- package/core/cli/generators/route.ts +7 -6
- package/core/cli/generators/service.ts +10 -9
- package/core/cli/generators/template-engine.ts +2 -1
- package/core/cli/generators/types.ts +7 -7
- package/core/cli/generators/utils.ts +191 -191
- package/core/cli/index.ts +9 -8
- package/core/cli/plugin-discovery.ts +2 -2
- package/core/client/hooks/useAuth.ts +48 -48
- package/core/client/standalone.ts +18 -17
- package/core/client/state/createStore.ts +192 -192
- package/core/client/state/index.ts +14 -14
- package/core/config/index.ts +1 -0
- package/core/framework/client.ts +131 -131
- package/core/framework/index.ts +7 -7
- package/core/framework/server.ts +72 -112
- package/core/framework/types.ts +2 -2
- package/core/plugins/built-in/live-components/commands/create-live-component.ts +6 -3
- package/core/plugins/built-in/monitoring/index.ts +110 -68
- package/core/plugins/built-in/static/index.ts +2 -2
- package/core/plugins/built-in/swagger/index.ts +9 -9
- package/core/plugins/built-in/vite/index.ts +3 -3
- package/core/plugins/built-in/vite/vite-dev.ts +3 -3
- package/core/plugins/config.ts +50 -47
- package/core/plugins/discovery.ts +10 -4
- package/core/plugins/executor.ts +2 -2
- package/core/plugins/index.ts +206 -203
- package/core/plugins/manager.ts +21 -20
- package/core/plugins/registry.ts +76 -12
- package/core/plugins/types.ts +14 -14
- package/core/server/framework.ts +3 -189
- package/core/server/live/auto-generated-components.ts +11 -29
- package/core/server/live/index.ts +41 -31
- package/core/server/live/websocket-plugin.ts +11 -1
- package/core/server/middleware/elysia-helpers.ts +16 -15
- package/core/server/middleware/errorHandling.ts +14 -14
- package/core/server/middleware/index.ts +31 -31
- package/core/server/plugins/database.ts +181 -180
- package/core/server/plugins/static-files-plugin.ts +4 -3
- package/core/server/plugins/swagger.ts +11 -8
- package/core/server/rooms/RoomBroadcaster.ts +11 -10
- package/core/server/rooms/RoomSystem.ts +14 -11
- package/core/server/services/BaseService.ts +7 -7
- package/core/server/services/ServiceContainer.ts +5 -5
- package/core/server/services/index.ts +8 -8
- package/core/templates/create-project.ts +28 -27
- package/core/testing/index.ts +9 -9
- package/core/testing/setup.ts +73 -73
- package/core/types/api.ts +168 -168
- package/core/types/config.ts +5 -5
- package/core/types/index.ts +1 -1
- package/core/types/plugin.ts +2 -2
- package/core/types/types.ts +3 -3
- package/core/utils/build-logger.ts +324 -324
- package/core/utils/config-schema.ts +480 -480
- package/core/utils/env.ts +10 -8
- package/core/utils/errors/codes.ts +114 -114
- package/core/utils/errors/handlers.ts +30 -20
- package/core/utils/errors/index.ts +54 -46
- package/core/utils/errors/middleware.ts +113 -113
- package/core/utils/helpers.ts +19 -16
- package/core/utils/logger/colors.ts +114 -114
- package/core/utils/logger/config.ts +2 -2
- package/core/utils/logger/formatter.ts +82 -82
- package/core/utils/logger/group-logger.ts +101 -101
- package/core/utils/logger/index.ts +13 -3
- package/core/utils/logger/startup-banner.ts +2 -2
- package/core/utils/logger/winston-logger.ts +152 -152
- package/core/utils/monitoring/index.ts +211 -211
- package/core/utils/sync-version.ts +67 -66
- package/core/utils/version.ts +1 -1
- package/package.json +104 -100
- package/playwright-report/index.html +85 -0
- package/playwright.config.ts +31 -0
- package/plugins/crypto-auth/client/CryptoAuthClient.ts +302 -302
- package/plugins/crypto-auth/client/components/index.ts +11 -11
- package/plugins/crypto-auth/client/index.ts +11 -11
- package/plugins/crypto-auth/package.json +65 -65
- package/plugins/crypto-auth/server/CryptoAuthService.ts +185 -185
- package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +6 -5
- package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +6 -5
- package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +3 -3
- package/plugins/crypto-auth/server/middlewares/index.ts +22 -22
- package/plugins/crypto-auth/server/middlewares.ts +19 -19
- package/vite.config.ts +13 -0
- package/app/client/.live-stubs/LiveAdminPanel.js +0 -5
- 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/app/server/live/register-components.ts +0 -19
- package/core/build/live-components-generator.ts +0 -321
- package/core/live/ComponentRegistry.ts +0 -403
- package/core/live/types.ts +0 -241
- package/workspace.json +0 -6
package/core/plugins/config.ts
CHANGED
|
@@ -10,10 +10,10 @@ import type { Logger } from "@core/utils/logger/index"
|
|
|
10
10
|
type Plugin = FluxStack.Plugin
|
|
11
11
|
|
|
12
12
|
export interface PluginConfigManager {
|
|
13
|
-
validatePluginConfig(plugin: Plugin, config:
|
|
14
|
-
mergePluginConfig(plugin: Plugin, userConfig:
|
|
15
|
-
getPluginConfig(pluginName: string, config: FluxStackConfig):
|
|
16
|
-
setPluginConfig(pluginName: string, pluginConfig:
|
|
13
|
+
validatePluginConfig(plugin: Plugin, config: unknown): PluginValidationResult
|
|
14
|
+
mergePluginConfig(plugin: Plugin, userConfig: unknown): unknown
|
|
15
|
+
getPluginConfig(pluginName: string, config: FluxStackConfig): unknown
|
|
16
|
+
setPluginConfig(pluginName: string, pluginConfig: unknown, config: FluxStackConfig): void
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
@@ -24,7 +24,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
24
24
|
/**
|
|
25
25
|
* Validate plugin configuration against its schema
|
|
26
26
|
*/
|
|
27
|
-
validatePluginConfig(plugin: Plugin, config:
|
|
27
|
+
validatePluginConfig(plugin: Plugin, config: unknown): PluginValidationResult {
|
|
28
28
|
const result: PluginValidationResult = {
|
|
29
29
|
valid: true,
|
|
30
30
|
errors: [],
|
|
@@ -49,21 +49,21 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
49
49
|
/**
|
|
50
50
|
* Merge user configuration with plugin defaults
|
|
51
51
|
*/
|
|
52
|
-
mergePluginConfig(plugin: Plugin, userConfig:
|
|
53
|
-
const defaultConfig = plugin.defaultConfig || {}
|
|
54
|
-
|
|
52
|
+
mergePluginConfig(plugin: Plugin, userConfig: unknown): unknown {
|
|
53
|
+
const defaultConfig = (plugin.defaultConfig || {}) as Record<string, unknown>
|
|
54
|
+
|
|
55
55
|
if (!userConfig) {
|
|
56
56
|
return defaultConfig
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
return this.deepMerge(defaultConfig, userConfig)
|
|
59
|
+
return this.deepMerge(defaultConfig, userConfig as Record<string, unknown>)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Get plugin configuration from main config
|
|
64
64
|
* @deprecated Plugin configs are now directly accessed from config.plugins
|
|
65
65
|
*/
|
|
66
|
-
getPluginConfig(pluginName: string, config: FluxStackConfig):
|
|
66
|
+
getPluginConfig(pluginName: string, config: FluxStackConfig): unknown {
|
|
67
67
|
// Plugin configs are now accessed directly from config.plugins
|
|
68
68
|
// Example: config.plugins.swaggerEnabled
|
|
69
69
|
return {}
|
|
@@ -73,7 +73,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
73
73
|
* Set plugin configuration in main config
|
|
74
74
|
* @deprecated Plugin configs are now set via environment variables and config files
|
|
75
75
|
*/
|
|
76
|
-
setPluginConfig(pluginName: string, pluginConfig:
|
|
76
|
+
setPluginConfig(pluginName: string, pluginConfig: unknown, config: FluxStackConfig): void {
|
|
77
77
|
// Plugin configs are now set via environment variables and config files
|
|
78
78
|
// This function is deprecated and does nothing
|
|
79
79
|
}
|
|
@@ -82,7 +82,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
82
82
|
* Validate configuration against JSON schema
|
|
83
83
|
*/
|
|
84
84
|
private validateAgainstSchema(
|
|
85
|
-
data:
|
|
85
|
+
data: unknown,
|
|
86
86
|
schema: PluginConfigSchema,
|
|
87
87
|
pluginName: string,
|
|
88
88
|
result: PluginValidationResult
|
|
@@ -93,10 +93,12 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
93
93
|
return
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
const dataObj = data as Record<string, unknown>
|
|
97
|
+
|
|
96
98
|
// Check required properties
|
|
97
99
|
if (schema.required && Array.isArray(schema.required)) {
|
|
98
100
|
for (const requiredProp of schema.required) {
|
|
99
|
-
if (!(requiredProp in
|
|
101
|
+
if (!(requiredProp in dataObj)) {
|
|
100
102
|
result.valid = false
|
|
101
103
|
result.errors.push(`Plugin '${pluginName}' configuration missing required property: ${requiredProp}`)
|
|
102
104
|
}
|
|
@@ -106,8 +108,8 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
106
108
|
// Validate properties
|
|
107
109
|
if (schema.properties) {
|
|
108
110
|
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
109
|
-
if (propName in
|
|
110
|
-
this.validateProperty(
|
|
111
|
+
if (propName in dataObj) {
|
|
112
|
+
this.validateProperty(dataObj[propName], propSchema as Record<string, unknown>, `${pluginName}.${propName}`, result)
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
}
|
|
@@ -115,8 +117,8 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
115
117
|
// Check for additional properties
|
|
116
118
|
if (schema.additionalProperties === false) {
|
|
117
119
|
const allowedProps = Object.keys(schema.properties || {})
|
|
118
|
-
const actualProps = Object.keys(
|
|
119
|
-
|
|
120
|
+
const actualProps = Object.keys(dataObj)
|
|
121
|
+
|
|
120
122
|
for (const prop of actualProps) {
|
|
121
123
|
if (!allowedProps.includes(prop)) {
|
|
122
124
|
result.warnings.push(`Plugin '${pluginName}' configuration has unexpected property: ${prop}`)
|
|
@@ -128,7 +130,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
128
130
|
/**
|
|
129
131
|
* Validate individual property
|
|
130
132
|
*/
|
|
131
|
-
private validateProperty(value:
|
|
133
|
+
private validateProperty(value: unknown, schema: Record<string, unknown>, path: string, result: PluginValidationResult): void {
|
|
132
134
|
if (schema.type) {
|
|
133
135
|
const actualType = Array.isArray(value) ? 'array' : typeof value
|
|
134
136
|
if (actualType !== schema.type) {
|
|
@@ -141,13 +143,13 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
141
143
|
// Type-specific validations
|
|
142
144
|
switch (schema.type) {
|
|
143
145
|
case 'string':
|
|
144
|
-
this.validateStringProperty(value, schema, path, result)
|
|
146
|
+
this.validateStringProperty(value as string, schema, path, result)
|
|
145
147
|
break
|
|
146
148
|
case 'number':
|
|
147
|
-
this.validateNumberProperty(value, schema, path, result)
|
|
149
|
+
this.validateNumberProperty(value as number, schema, path, result)
|
|
148
150
|
break
|
|
149
151
|
case 'array':
|
|
150
|
-
this.validateArrayProperty(value, schema, path, result)
|
|
152
|
+
this.validateArrayProperty(value as unknown[], schema, path, result)
|
|
151
153
|
break
|
|
152
154
|
case 'object':
|
|
153
155
|
if (schema.properties) {
|
|
@@ -157,28 +159,28 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
// Enum validation
|
|
160
|
-
if (schema.enum && !schema.enum.includes(value)) {
|
|
162
|
+
if (schema.enum && !(schema.enum as unknown[]).includes(value)) {
|
|
161
163
|
result.valid = false
|
|
162
|
-
result.errors.push(`Property '${path}' must be one of: ${schema.enum.join(', ')}`)
|
|
164
|
+
result.errors.push(`Property '${path}' must be one of: ${(schema.enum as unknown[]).join(', ')}`)
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
/**
|
|
167
169
|
* Validate string property
|
|
168
170
|
*/
|
|
169
|
-
private validateStringProperty(value: string, schema:
|
|
170
|
-
if (schema.minLength && value.length < schema.minLength) {
|
|
171
|
+
private validateStringProperty(value: string, schema: Record<string, unknown>, path: string, result: PluginValidationResult): void {
|
|
172
|
+
if (schema.minLength && value.length < (schema.minLength as number)) {
|
|
171
173
|
result.valid = false
|
|
172
174
|
result.errors.push(`Property '${path}' must be at least ${schema.minLength} characters long`)
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
if (schema.maxLength && value.length > schema.maxLength) {
|
|
177
|
+
if (schema.maxLength && value.length > (schema.maxLength as number)) {
|
|
176
178
|
result.valid = false
|
|
177
179
|
result.errors.push(`Property '${path}' must be at most ${schema.maxLength} characters long`)
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
if (schema.pattern) {
|
|
181
|
-
const regex = new RegExp(schema.pattern)
|
|
183
|
+
const regex = new RegExp(schema.pattern as string)
|
|
182
184
|
if (!regex.test(value)) {
|
|
183
185
|
result.valid = false
|
|
184
186
|
result.errors.push(`Property '${path}' does not match required pattern: ${schema.pattern}`)
|
|
@@ -189,18 +191,18 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
189
191
|
/**
|
|
190
192
|
* Validate number property
|
|
191
193
|
*/
|
|
192
|
-
private validateNumberProperty(value: number, schema:
|
|
193
|
-
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
194
|
+
private validateNumberProperty(value: number, schema: Record<string, unknown>, path: string, result: PluginValidationResult): void {
|
|
195
|
+
if (schema.minimum !== undefined && value < (schema.minimum as number)) {
|
|
194
196
|
result.valid = false
|
|
195
197
|
result.errors.push(`Property '${path}' must be at least ${schema.minimum}`)
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
200
|
+
if (schema.maximum !== undefined && value > (schema.maximum as number)) {
|
|
199
201
|
result.valid = false
|
|
200
202
|
result.errors.push(`Property '${path}' must be at most ${schema.maximum}`)
|
|
201
203
|
}
|
|
202
204
|
|
|
203
|
-
if (schema.multipleOf && value % schema.multipleOf !== 0) {
|
|
205
|
+
if (schema.multipleOf && value % (schema.multipleOf as number) !== 0) {
|
|
204
206
|
result.valid = false
|
|
205
207
|
result.errors.push(`Property '${path}' must be a multiple of ${schema.multipleOf}`)
|
|
206
208
|
}
|
|
@@ -209,20 +211,20 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
209
211
|
/**
|
|
210
212
|
* Validate array property
|
|
211
213
|
*/
|
|
212
|
-
private validateArrayProperty(value:
|
|
213
|
-
if (schema.minItems && value.length < schema.minItems) {
|
|
214
|
+
private validateArrayProperty(value: unknown[], schema: Record<string, unknown>, path: string, result: PluginValidationResult): void {
|
|
215
|
+
if (schema.minItems && value.length < (schema.minItems as number)) {
|
|
214
216
|
result.valid = false
|
|
215
217
|
result.errors.push(`Property '${path}' must have at least ${schema.minItems} items`)
|
|
216
218
|
}
|
|
217
219
|
|
|
218
|
-
if (schema.maxItems && value.length > schema.maxItems) {
|
|
220
|
+
if (schema.maxItems && value.length > (schema.maxItems as number)) {
|
|
219
221
|
result.valid = false
|
|
220
222
|
result.errors.push(`Property '${path}' must have at most ${schema.maxItems} items`)
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
if (schema.items) {
|
|
224
226
|
value.forEach((item, index) => {
|
|
225
|
-
this.validateProperty(item, schema.items, `${path}[${index}]`, result)
|
|
227
|
+
this.validateProperty(item, schema.items as Record<string, unknown>, `${path}[${index}]`, result)
|
|
226
228
|
})
|
|
227
229
|
}
|
|
228
230
|
}
|
|
@@ -230,10 +232,11 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
230
232
|
/**
|
|
231
233
|
* Validate object property
|
|
232
234
|
*/
|
|
233
|
-
private validateObjectProperty(value:
|
|
235
|
+
private validateObjectProperty(value: unknown, schema: Record<string, unknown>, path: string, result: PluginValidationResult): void {
|
|
236
|
+
const valueObj = value as Record<string, unknown>
|
|
234
237
|
if (schema.required) {
|
|
235
|
-
for (const requiredProp of schema.required) {
|
|
236
|
-
if (!(requiredProp in
|
|
238
|
+
for (const requiredProp of (schema.required as string[])) {
|
|
239
|
+
if (!(requiredProp in valueObj)) {
|
|
237
240
|
result.valid = false
|
|
238
241
|
result.errors.push(`Property '${path}' missing required property: ${requiredProp}`)
|
|
239
242
|
}
|
|
@@ -241,9 +244,9 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
if (schema.properties) {
|
|
244
|
-
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
245
|
-
if (propName in
|
|
246
|
-
this.validateProperty(
|
|
247
|
+
for (const [propName, propSchema] of Object.entries(schema.properties as Record<string, unknown>)) {
|
|
248
|
+
if (propName in valueObj) {
|
|
249
|
+
this.validateProperty(valueObj[propName], propSchema as Record<string, unknown>, `${path}.${propName}`, result)
|
|
247
250
|
}
|
|
248
251
|
}
|
|
249
252
|
}
|
|
@@ -252,7 +255,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
252
255
|
/**
|
|
253
256
|
* Deep merge two objects
|
|
254
257
|
*/
|
|
255
|
-
|
|
258
|
+
deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown> {
|
|
256
259
|
if (source === null || source === undefined) {
|
|
257
260
|
return target
|
|
258
261
|
}
|
|
@@ -266,7 +269,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
if (Array.isArray(source)) {
|
|
269
|
-
return [...source]
|
|
272
|
+
return [...source] as unknown as Record<string, unknown>
|
|
270
273
|
}
|
|
271
274
|
|
|
272
275
|
const result = { ...target }
|
|
@@ -274,7 +277,7 @@ export class DefaultPluginConfigManager implements PluginConfigManager {
|
|
|
274
277
|
for (const key in source) {
|
|
275
278
|
if (source.hasOwnProperty(key)) {
|
|
276
279
|
if (typeof source[key] === 'object' && !Array.isArray(source[key]) && source[key] !== null) {
|
|
277
|
-
result[key] = this.deepMerge(target[key], source[key])
|
|
280
|
+
result[key] = this.deepMerge(target[key] as Record<string, unknown>, source[key] as Record<string, unknown>)
|
|
278
281
|
} else {
|
|
279
282
|
result[key] = source[key]
|
|
280
283
|
}
|
|
@@ -335,11 +338,11 @@ export function createPluginUtils(logger?: Logger): PluginUtils {
|
|
|
335
338
|
return hash.toString(36)
|
|
336
339
|
},
|
|
337
340
|
|
|
338
|
-
deepMerge: (target:
|
|
339
|
-
return
|
|
341
|
+
deepMerge: (target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown> => {
|
|
342
|
+
return sharedConfigManager.deepMerge(target, source)
|
|
340
343
|
},
|
|
341
344
|
|
|
342
|
-
validateSchema: (data:
|
|
345
|
+
validateSchema: (data: Record<string, unknown>, schema: PluginConfigSchema): { valid: boolean; errors: string[] } => {
|
|
343
346
|
const result = sharedConfigManager.validatePluginConfig({ name: 'temp', configSchema: schema }, data)
|
|
344
347
|
return {
|
|
345
348
|
valid: result.valid,
|
|
@@ -305,8 +305,14 @@ export class PluginDiscovery {
|
|
|
305
305
|
/**
|
|
306
306
|
* Validate if an object is a valid plugin
|
|
307
307
|
*/
|
|
308
|
-
private isValidPlugin(plugin:
|
|
309
|
-
if (!plugin || typeof plugin !== 'object'
|
|
308
|
+
private isValidPlugin(plugin: unknown): plugin is Plugin {
|
|
309
|
+
if (!plugin || typeof plugin !== 'object') {
|
|
310
|
+
return false
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const pluginObj = plugin as Record<string, unknown>
|
|
314
|
+
|
|
315
|
+
if (typeof pluginObj.name !== 'string' || pluginObj.name.length === 0) {
|
|
310
316
|
return false
|
|
311
317
|
}
|
|
312
318
|
|
|
@@ -317,8 +323,8 @@ export class PluginDiscovery {
|
|
|
317
323
|
]
|
|
318
324
|
|
|
319
325
|
for (const hook of hookNames) {
|
|
320
|
-
if (hook in
|
|
321
|
-
this.logger?.warn(`Plugin "${
|
|
326
|
+
if (hook in pluginObj && typeof pluginObj[hook] !== 'function') {
|
|
327
|
+
this.logger?.warn(`Plugin "${pluginObj.name}" has invalid hook "${hook}" (expected function, got ${typeof pluginObj[hook]})`)
|
|
322
328
|
return false
|
|
323
329
|
}
|
|
324
330
|
}
|
package/core/plugins/executor.ts
CHANGED
|
@@ -72,8 +72,8 @@ export class PluginExecutor {
|
|
|
72
72
|
*/
|
|
73
73
|
async executePlan(
|
|
74
74
|
plan: PluginExecutionPlan,
|
|
75
|
-
context:
|
|
76
|
-
executor: (plugin: Plugin, hook: PluginHook, context:
|
|
75
|
+
context: unknown,
|
|
76
|
+
executor: (plugin: Plugin, hook: PluginHook, context: unknown) => Promise<PluginHookResult>
|
|
77
77
|
): Promise<PluginHookResult[]> {
|
|
78
78
|
const results: PluginHookResult[] = []
|
|
79
79
|
|