create-fluxstack 1.0.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 (101) hide show
  1. package/.env +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +214 -0
  4. package/app/client/README.md +69 -0
  5. package/app/client/frontend-only.ts +12 -0
  6. package/app/client/index.html +13 -0
  7. package/app/client/public/vite.svg +1 -0
  8. package/app/client/src/App.css +883 -0
  9. package/app/client/src/App.tsx +669 -0
  10. package/app/client/src/assets/react.svg +1 -0
  11. package/app/client/src/components/TestPage.tsx +453 -0
  12. package/app/client/src/index.css +51 -0
  13. package/app/client/src/lib/eden-api.ts +110 -0
  14. package/app/client/src/main.tsx +10 -0
  15. package/app/client/src/vite-env.d.ts +1 -0
  16. package/app/client/tsconfig.app.json +43 -0
  17. package/app/client/tsconfig.json +7 -0
  18. package/app/client/tsconfig.node.json +25 -0
  19. package/app/server/app.ts +10 -0
  20. package/app/server/backend-only.ts +15 -0
  21. package/app/server/controllers/users.controller.ts +69 -0
  22. package/app/server/index.ts +104 -0
  23. package/app/server/routes/index.ts +25 -0
  24. package/app/server/routes/users.routes.ts +121 -0
  25. package/app/server/types/index.ts +1 -0
  26. package/app/shared/types/index.ts +18 -0
  27. package/bun.lock +1053 -0
  28. package/core/__tests__/integration.test.ts +227 -0
  29. package/core/build/index.ts +186 -0
  30. package/core/cli/command-registry.ts +334 -0
  31. package/core/cli/index.ts +394 -0
  32. package/core/cli/plugin-discovery.ts +200 -0
  33. package/core/client/standalone.ts +57 -0
  34. package/core/config/__tests__/config-loader.test.ts +591 -0
  35. package/core/config/__tests__/config-merger.test.ts +657 -0
  36. package/core/config/__tests__/env-converter.test.ts +372 -0
  37. package/core/config/__tests__/env-processor.test.ts +431 -0
  38. package/core/config/__tests__/env.test.ts +452 -0
  39. package/core/config/__tests__/integration.test.ts +418 -0
  40. package/core/config/__tests__/loader.test.ts +331 -0
  41. package/core/config/__tests__/schema.test.ts +129 -0
  42. package/core/config/__tests__/validator.test.ts +318 -0
  43. package/core/config/env-dynamic.ts +326 -0
  44. package/core/config/env.ts +597 -0
  45. package/core/config/index.ts +317 -0
  46. package/core/config/loader.ts +546 -0
  47. package/core/config/runtime-config.ts +322 -0
  48. package/core/config/schema.ts +694 -0
  49. package/core/config/validator.ts +540 -0
  50. package/core/framework/__tests__/server.test.ts +233 -0
  51. package/core/framework/client.ts +132 -0
  52. package/core/framework/index.ts +8 -0
  53. package/core/framework/server.ts +501 -0
  54. package/core/framework/types.ts +63 -0
  55. package/core/plugins/__tests__/built-in.test.ts.disabled +366 -0
  56. package/core/plugins/__tests__/manager.test.ts +398 -0
  57. package/core/plugins/__tests__/monitoring.test.ts +401 -0
  58. package/core/plugins/__tests__/registry.test.ts +335 -0
  59. package/core/plugins/built-in/index.ts +142 -0
  60. package/core/plugins/built-in/logger/index.ts +180 -0
  61. package/core/plugins/built-in/monitoring/README.md +193 -0
  62. package/core/plugins/built-in/monitoring/index.ts +912 -0
  63. package/core/plugins/built-in/static/index.ts +289 -0
  64. package/core/plugins/built-in/swagger/index.ts +229 -0
  65. package/core/plugins/built-in/vite/index.ts +316 -0
  66. package/core/plugins/config.ts +348 -0
  67. package/core/plugins/discovery.ts +350 -0
  68. package/core/plugins/executor.ts +351 -0
  69. package/core/plugins/index.ts +195 -0
  70. package/core/plugins/manager.ts +583 -0
  71. package/core/plugins/registry.ts +424 -0
  72. package/core/plugins/types.ts +254 -0
  73. package/core/server/framework.ts +123 -0
  74. package/core/server/index.ts +8 -0
  75. package/core/server/plugins/database.ts +182 -0
  76. package/core/server/plugins/logger.ts +47 -0
  77. package/core/server/plugins/swagger.ts +34 -0
  78. package/core/server/standalone.ts +91 -0
  79. package/core/templates/create-project.ts +455 -0
  80. package/core/types/api.ts +169 -0
  81. package/core/types/build.ts +174 -0
  82. package/core/types/config.ts +68 -0
  83. package/core/types/index.ts +127 -0
  84. package/core/types/plugin.ts +94 -0
  85. package/core/utils/__tests__/errors.test.ts +139 -0
  86. package/core/utils/__tests__/helpers.test.ts +297 -0
  87. package/core/utils/__tests__/logger.test.ts +141 -0
  88. package/core/utils/env-runtime-v2.ts +232 -0
  89. package/core/utils/env-runtime.ts +252 -0
  90. package/core/utils/errors/codes.ts +115 -0
  91. package/core/utils/errors/handlers.ts +63 -0
  92. package/core/utils/errors/index.ts +81 -0
  93. package/core/utils/helpers.ts +180 -0
  94. package/core/utils/index.ts +18 -0
  95. package/core/utils/logger/index.ts +161 -0
  96. package/core/utils/logger.ts +106 -0
  97. package/core/utils/monitoring/index.ts +212 -0
  98. package/create-fluxstack.ts +231 -0
  99. package/package.json +43 -0
  100. package/tsconfig.json +51 -0
  101. package/vite.config.ts +42 -0
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Enhanced Plugin System
3
+ * Comprehensive plugin system with lifecycle hooks, dependency management, and configuration
4
+ */
5
+
6
+ // Core plugin types and interfaces
7
+ export type {
8
+ Plugin,
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
+ // Plugin registry
31
+ export { PluginRegistry } from './registry'
32
+ export type { PluginRegistryConfig } from './registry'
33
+
34
+ // Plugin discovery
35
+ export { PluginDiscovery, pluginDiscovery } from './discovery'
36
+ export type { PluginDiscoveryConfig } from './discovery'
37
+
38
+ // Plugin configuration management
39
+ export {
40
+ DefaultPluginConfigManager,
41
+ createPluginUtils
42
+ } from './config'
43
+ export type { PluginConfigManager } from './config'
44
+
45
+ // Plugin manager
46
+ export {
47
+ PluginManager,
48
+ createRequestContext,
49
+ createResponseContext,
50
+ createErrorContext,
51
+ createBuildContext
52
+ } from './manager'
53
+ export type { PluginManagerConfig } from './manager'
54
+
55
+ // Plugin executor
56
+ export {
57
+ PluginExecutor,
58
+ calculateExecutionStats
59
+ } from './executor'
60
+ export type {
61
+ PluginExecutionPlan,
62
+ PluginExecutionStep,
63
+ PluginExecutionStats
64
+ } from './executor'
65
+
66
+ // Utility functions for plugin development
67
+ export const PluginUtils = {
68
+ /**
69
+ * Create a simple plugin
70
+ */
71
+ createPlugin: (config: {
72
+ name: string
73
+ version?: string
74
+ description?: string
75
+ dependencies?: string[]
76
+ priority?: number | PluginPriority
77
+ setup?: (context: PluginContext) => void | Promise<void>
78
+ onServerStart?: (context: PluginContext) => void | Promise<void>
79
+ onServerStop?: (context: PluginContext) => void | Promise<void>
80
+ onRequest?: (context: RequestContext) => void | Promise<void>
81
+ onResponse?: (context: ResponseContext) => void | Promise<void>
82
+ onError?: (context: ErrorContext) => void | Promise<void>
83
+ configSchema?: any
84
+ defaultConfig?: any
85
+ }): Plugin => {
86
+ const plugin = {
87
+ name: config.name,
88
+ ...(config.version && { version: config.version }),
89
+ ...(config.description && { description: config.description }),
90
+ ...(config.dependencies && { dependencies: config.dependencies }),
91
+ ...(config.priority !== undefined && { priority: config.priority }),
92
+ ...(config.setup && { setup: config.setup }),
93
+ ...(config.onServerStart && { onServerStart: config.onServerStart }),
94
+ ...(config.onServerStop && { onServerStop: config.onServerStop }),
95
+ ...(config.onRequest && { onRequest: config.onRequest }),
96
+ ...(config.onResponse && { onResponse: config.onResponse }),
97
+ ...(config.onError && { onError: config.onError }),
98
+ ...(config.configSchema && { configSchema: config.configSchema }),
99
+ ...(config.defaultConfig && { defaultConfig: config.defaultConfig })
100
+ } as Plugin
101
+ return plugin
102
+ },
103
+
104
+ /**
105
+ * Create a plugin manifest
106
+ */
107
+ createManifest: (config: {
108
+ name: string
109
+ version: string
110
+ description: string
111
+ author: string
112
+ license: string
113
+ homepage?: string
114
+ repository?: string
115
+ keywords?: string[]
116
+ dependencies?: Record<string, string>
117
+ peerDependencies?: Record<string, string>
118
+ fluxstack: {
119
+ version: string
120
+ hooks: PluginHook[]
121
+ config?: any
122
+ category?: string
123
+ tags?: string[]
124
+ }
125
+ }): any => {
126
+ return {
127
+ name: config.name,
128
+ version: config.version || '1.0.0',
129
+ description: config.description,
130
+ author: config.author,
131
+ license: config.license,
132
+ homepage: config.homepage,
133
+ repository: config.repository,
134
+ keywords: config.keywords || [],
135
+ dependencies: config.dependencies || {},
136
+ peerDependencies: config.peerDependencies,
137
+ fluxstack: config.fluxstack
138
+ }
139
+ },
140
+
141
+ /**
142
+ * Validate plugin structure
143
+ */
144
+ validatePlugin: (plugin: any): plugin is Plugin => {
145
+ return (
146
+ plugin &&
147
+ typeof plugin === 'object' &&
148
+ typeof plugin.name === 'string' &&
149
+ plugin.name.length > 0
150
+ )
151
+ },
152
+
153
+ /**
154
+ * Check if plugin implements hook
155
+ */
156
+ implementsHook: (plugin: Plugin, hook: PluginHook): boolean => {
157
+ const hookFunction = (plugin as any)[hook]
158
+ return hookFunction && typeof hookFunction === 'function'
159
+ },
160
+
161
+ /**
162
+ * Get plugin hooks
163
+ */
164
+ getPluginHooks: (plugin: Plugin): PluginHook[] => {
165
+ const hooks: PluginHook[] = []
166
+ const possibleHooks: PluginHook[] = [
167
+ 'setup',
168
+ 'onServerStart',
169
+ 'onServerStop',
170
+ 'onRequest',
171
+ 'onResponse',
172
+ 'onError',
173
+ 'onBuild',
174
+ 'onBuildComplete'
175
+ ]
176
+
177
+ for (const hook of possibleHooks) {
178
+ if (PluginUtils.implementsHook(plugin, hook)) {
179
+ hooks.push(hook)
180
+ }
181
+ }
182
+
183
+ return hooks
184
+ }
185
+ }
186
+
187
+ // Re-export types for convenience
188
+ import type {
189
+ PluginContext,
190
+ PluginHook,
191
+ PluginPriority,
192
+ RequestContext,
193
+ ResponseContext,
194
+ ErrorContext
195
+ } from './types'