create-fluxstack 1.0.4 → 1.0.6

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 (406) hide show
  1. package/.claude/settings.local.json +6 -1
  2. package/create-fluxstack.ts +10 -6
  3. package/package.json +1 -1
  4. package/ENV_TESTING_REPORT.md +0 -292
  5. package/FRAMEWORK_ROADMAP.md +0 -183
  6. package/FRONTEND_TESTS_README.md +0 -287
  7. package/TEST_RESULTS.md +0 -130
  8. package/docs/dynamic-environment-variables.md +0 -380
  9. package/examples/dynamic-env-usage.ts +0 -283
  10. package/examples/hybrid-env-strategy.ts +0 -212
  11. package/examples/simplified-env-usage.ts +0 -251
  12. package/meu-app-teste/README.md +0 -44
  13. package/meu-app-teste/app/client/README.md +0 -69
  14. package/meu-app-teste/app/client/frontend-only.ts +0 -12
  15. package/meu-app-teste/app/client/index.html +0 -13
  16. package/meu-app-teste/app/client/public/vite.svg +0 -1
  17. package/meu-app-teste/app/client/src/App.css +0 -883
  18. package/meu-app-teste/app/client/src/App.tsx +0 -669
  19. package/meu-app-teste/app/client/src/assets/react.svg +0 -1
  20. package/meu-app-teste/app/client/src/components/TestPage.tsx +0 -453
  21. package/meu-app-teste/app/client/src/index.css +0 -51
  22. package/meu-app-teste/app/client/src/lib/eden-api.ts +0 -110
  23. package/meu-app-teste/app/client/src/main.tsx +0 -10
  24. package/meu-app-teste/app/client/src/vite-env.d.ts +0 -1
  25. package/meu-app-teste/app/client/tsconfig.app.json +0 -43
  26. package/meu-app-teste/app/client/tsconfig.json +0 -7
  27. package/meu-app-teste/app/client/tsconfig.node.json +0 -25
  28. package/meu-app-teste/app/server/app.ts +0 -10
  29. package/meu-app-teste/app/server/backend-only.ts +0 -15
  30. package/meu-app-teste/app/server/controllers/users.controller.ts +0 -69
  31. package/meu-app-teste/app/server/index.ts +0 -104
  32. package/meu-app-teste/app/server/routes/index.ts +0 -25
  33. package/meu-app-teste/app/server/routes/users.routes.ts +0 -121
  34. package/meu-app-teste/app/server/types/index.ts +0 -1
  35. package/meu-app-teste/app/shared/types/index.ts +0 -18
  36. package/meu-app-teste/bun.lock +0 -1053
  37. package/meu-app-teste/core/__tests__/integration.test.ts +0 -227
  38. package/meu-app-teste/core/build/index.ts +0 -186
  39. package/meu-app-teste/core/cli/command-registry.ts +0 -334
  40. package/meu-app-teste/core/cli/index.ts +0 -394
  41. package/meu-app-teste/core/cli/plugin-discovery.ts +0 -200
  42. package/meu-app-teste/core/client/standalone.ts +0 -57
  43. package/meu-app-teste/core/config/__tests__/config-loader.test.ts +0 -591
  44. package/meu-app-teste/core/config/__tests__/config-merger.test.ts +0 -657
  45. package/meu-app-teste/core/config/__tests__/env-converter.test.ts +0 -372
  46. package/meu-app-teste/core/config/__tests__/env-processor.test.ts +0 -431
  47. package/meu-app-teste/core/config/__tests__/env.test.ts +0 -452
  48. package/meu-app-teste/core/config/__tests__/integration.test.ts +0 -418
  49. package/meu-app-teste/core/config/__tests__/loader.test.ts +0 -331
  50. package/meu-app-teste/core/config/__tests__/schema.test.ts +0 -129
  51. package/meu-app-teste/core/config/__tests__/validator.test.ts +0 -318
  52. package/meu-app-teste/core/config/env-dynamic.ts +0 -326
  53. package/meu-app-teste/core/config/env.ts +0 -597
  54. package/meu-app-teste/core/config/index.ts +0 -317
  55. package/meu-app-teste/core/config/loader.ts +0 -546
  56. package/meu-app-teste/core/config/runtime-config.ts +0 -322
  57. package/meu-app-teste/core/config/schema.ts +0 -694
  58. package/meu-app-teste/core/config/validator.ts +0 -540
  59. package/meu-app-teste/core/framework/__tests__/server.test.ts +0 -233
  60. package/meu-app-teste/core/framework/client.ts +0 -132
  61. package/meu-app-teste/core/framework/index.ts +0 -8
  62. package/meu-app-teste/core/framework/server.ts +0 -501
  63. package/meu-app-teste/core/framework/types.ts +0 -63
  64. package/meu-app-teste/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  65. package/meu-app-teste/core/plugins/__tests__/manager.test.ts +0 -398
  66. package/meu-app-teste/core/plugins/__tests__/monitoring.test.ts +0 -401
  67. package/meu-app-teste/core/plugins/__tests__/registry.test.ts +0 -335
  68. package/meu-app-teste/core/plugins/built-in/index.ts +0 -142
  69. package/meu-app-teste/core/plugins/built-in/logger/index.ts +0 -180
  70. package/meu-app-teste/core/plugins/built-in/monitoring/README.md +0 -193
  71. package/meu-app-teste/core/plugins/built-in/monitoring/index.ts +0 -912
  72. package/meu-app-teste/core/plugins/built-in/static/index.ts +0 -289
  73. package/meu-app-teste/core/plugins/built-in/swagger/index.ts +0 -229
  74. package/meu-app-teste/core/plugins/built-in/vite/index.ts +0 -316
  75. package/meu-app-teste/core/plugins/config.ts +0 -348
  76. package/meu-app-teste/core/plugins/discovery.ts +0 -350
  77. package/meu-app-teste/core/plugins/executor.ts +0 -351
  78. package/meu-app-teste/core/plugins/index.ts +0 -195
  79. package/meu-app-teste/core/plugins/manager.ts +0 -583
  80. package/meu-app-teste/core/plugins/registry.ts +0 -424
  81. package/meu-app-teste/core/plugins/types.ts +0 -254
  82. package/meu-app-teste/core/server/framework.ts +0 -123
  83. package/meu-app-teste/core/server/index.ts +0 -8
  84. package/meu-app-teste/core/server/plugins/database.ts +0 -182
  85. package/meu-app-teste/core/server/plugins/logger.ts +0 -47
  86. package/meu-app-teste/core/server/plugins/swagger.ts +0 -34
  87. package/meu-app-teste/core/server/standalone.ts +0 -91
  88. package/meu-app-teste/core/templates/create-project.ts +0 -455
  89. package/meu-app-teste/core/types/api.ts +0 -169
  90. package/meu-app-teste/core/types/build.ts +0 -174
  91. package/meu-app-teste/core/types/config.ts +0 -68
  92. package/meu-app-teste/core/types/index.ts +0 -127
  93. package/meu-app-teste/core/types/plugin.ts +0 -94
  94. package/meu-app-teste/core/utils/__tests__/errors.test.ts +0 -139
  95. package/meu-app-teste/core/utils/__tests__/helpers.test.ts +0 -297
  96. package/meu-app-teste/core/utils/__tests__/logger.test.ts +0 -141
  97. package/meu-app-teste/core/utils/env-runtime-v2.ts +0 -232
  98. package/meu-app-teste/core/utils/env-runtime.ts +0 -252
  99. package/meu-app-teste/core/utils/errors/codes.ts +0 -115
  100. package/meu-app-teste/core/utils/errors/handlers.ts +0 -63
  101. package/meu-app-teste/core/utils/errors/index.ts +0 -81
  102. package/meu-app-teste/core/utils/helpers.ts +0 -180
  103. package/meu-app-teste/core/utils/index.ts +0 -18
  104. package/meu-app-teste/core/utils/logger/index.ts +0 -161
  105. package/meu-app-teste/core/utils/logger.ts +0 -106
  106. package/meu-app-teste/core/utils/monitoring/index.ts +0 -212
  107. package/meu-app-teste/package.json +0 -92
  108. package/meu-app-teste/tsconfig.json +0 -51
  109. package/meu-app-teste/vite.config.ts +0 -42
  110. package/my-final-test/README.md +0 -44
  111. package/my-final-test/app/client/README.md +0 -69
  112. package/my-final-test/app/client/frontend-only.ts +0 -12
  113. package/my-final-test/app/client/index.html +0 -13
  114. package/my-final-test/app/client/public/vite.svg +0 -1
  115. package/my-final-test/app/client/src/App.css +0 -883
  116. package/my-final-test/app/client/src/App.tsx +0 -669
  117. package/my-final-test/app/client/src/assets/react.svg +0 -1
  118. package/my-final-test/app/client/src/components/TestPage.tsx +0 -453
  119. package/my-final-test/app/client/src/index.css +0 -51
  120. package/my-final-test/app/client/src/lib/eden-api.ts +0 -110
  121. package/my-final-test/app/client/src/main.tsx +0 -10
  122. package/my-final-test/app/client/src/vite-env.d.ts +0 -1
  123. package/my-final-test/app/client/tsconfig.app.json +0 -43
  124. package/my-final-test/app/client/tsconfig.json +0 -7
  125. package/my-final-test/app/client/tsconfig.node.json +0 -25
  126. package/my-final-test/app/server/app.ts +0 -10
  127. package/my-final-test/app/server/backend-only.ts +0 -15
  128. package/my-final-test/app/server/controllers/users.controller.ts +0 -69
  129. package/my-final-test/app/server/index.ts +0 -104
  130. package/my-final-test/app/server/routes/index.ts +0 -25
  131. package/my-final-test/app/server/routes/users.routes.ts +0 -121
  132. package/my-final-test/app/server/types/index.ts +0 -1
  133. package/my-final-test/app/shared/types/index.ts +0 -18
  134. package/my-final-test/bun.lock +0 -993
  135. package/my-final-test/core/__tests__/integration.test.ts +0 -227
  136. package/my-final-test/core/build/index.ts +0 -186
  137. package/my-final-test/core/cli/command-registry.ts +0 -334
  138. package/my-final-test/core/cli/index.ts +0 -394
  139. package/my-final-test/core/cli/plugin-discovery.ts +0 -200
  140. package/my-final-test/core/client/standalone.ts +0 -57
  141. package/my-final-test/core/config/__tests__/config-loader.test.ts +0 -591
  142. package/my-final-test/core/config/__tests__/config-merger.test.ts +0 -657
  143. package/my-final-test/core/config/__tests__/env-converter.test.ts +0 -372
  144. package/my-final-test/core/config/__tests__/env-processor.test.ts +0 -431
  145. package/my-final-test/core/config/__tests__/env.test.ts +0 -452
  146. package/my-final-test/core/config/__tests__/integration.test.ts +0 -418
  147. package/my-final-test/core/config/__tests__/loader.test.ts +0 -331
  148. package/my-final-test/core/config/__tests__/schema.test.ts +0 -129
  149. package/my-final-test/core/config/__tests__/validator.test.ts +0 -318
  150. package/my-final-test/core/config/env-dynamic.ts +0 -326
  151. package/my-final-test/core/config/env.ts +0 -597
  152. package/my-final-test/core/config/index.ts +0 -317
  153. package/my-final-test/core/config/loader.ts +0 -546
  154. package/my-final-test/core/config/runtime-config.ts +0 -322
  155. package/my-final-test/core/config/schema.ts +0 -694
  156. package/my-final-test/core/config/validator.ts +0 -540
  157. package/my-final-test/core/framework/__tests__/server.test.ts +0 -233
  158. package/my-final-test/core/framework/client.ts +0 -132
  159. package/my-final-test/core/framework/index.ts +0 -8
  160. package/my-final-test/core/framework/server.ts +0 -501
  161. package/my-final-test/core/framework/types.ts +0 -63
  162. package/my-final-test/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  163. package/my-final-test/core/plugins/__tests__/manager.test.ts +0 -398
  164. package/my-final-test/core/plugins/__tests__/monitoring.test.ts +0 -401
  165. package/my-final-test/core/plugins/__tests__/registry.test.ts +0 -335
  166. package/my-final-test/core/plugins/built-in/index.ts +0 -142
  167. package/my-final-test/core/plugins/built-in/logger/index.ts +0 -180
  168. package/my-final-test/core/plugins/built-in/monitoring/README.md +0 -193
  169. package/my-final-test/core/plugins/built-in/monitoring/index.ts +0 -912
  170. package/my-final-test/core/plugins/built-in/static/index.ts +0 -289
  171. package/my-final-test/core/plugins/built-in/swagger/index.ts +0 -229
  172. package/my-final-test/core/plugins/built-in/vite/index.ts +0 -316
  173. package/my-final-test/core/plugins/config.ts +0 -348
  174. package/my-final-test/core/plugins/discovery.ts +0 -350
  175. package/my-final-test/core/plugins/executor.ts +0 -351
  176. package/my-final-test/core/plugins/index.ts +0 -195
  177. package/my-final-test/core/plugins/manager.ts +0 -583
  178. package/my-final-test/core/plugins/registry.ts +0 -424
  179. package/my-final-test/core/plugins/types.ts +0 -254
  180. package/my-final-test/core/server/framework.ts +0 -123
  181. package/my-final-test/core/server/index.ts +0 -8
  182. package/my-final-test/core/server/plugins/database.ts +0 -182
  183. package/my-final-test/core/server/plugins/logger.ts +0 -47
  184. package/my-final-test/core/server/plugins/swagger.ts +0 -34
  185. package/my-final-test/core/server/standalone.ts +0 -91
  186. package/my-final-test/core/templates/create-project.ts +0 -455
  187. package/my-final-test/core/types/api.ts +0 -169
  188. package/my-final-test/core/types/build.ts +0 -174
  189. package/my-final-test/core/types/config.ts +0 -68
  190. package/my-final-test/core/types/index.ts +0 -127
  191. package/my-final-test/core/types/plugin.ts +0 -94
  192. package/my-final-test/core/utils/__tests__/errors.test.ts +0 -139
  193. package/my-final-test/core/utils/__tests__/helpers.test.ts +0 -297
  194. package/my-final-test/core/utils/__tests__/logger.test.ts +0 -141
  195. package/my-final-test/core/utils/env-runtime-v2.ts +0 -232
  196. package/my-final-test/core/utils/env-runtime.ts +0 -252
  197. package/my-final-test/core/utils/errors/codes.ts +0 -115
  198. package/my-final-test/core/utils/errors/handlers.ts +0 -63
  199. package/my-final-test/core/utils/errors/index.ts +0 -81
  200. package/my-final-test/core/utils/helpers.ts +0 -180
  201. package/my-final-test/core/utils/index.ts +0 -18
  202. package/my-final-test/core/utils/logger/index.ts +0 -161
  203. package/my-final-test/core/utils/logger.ts +0 -106
  204. package/my-final-test/core/utils/monitoring/index.ts +0 -212
  205. package/my-final-test/package.json +0 -68
  206. package/my-final-test/tsconfig.json +0 -51
  207. package/my-final-test/vite.config.ts +0 -42
  208. package/publish-setup.md +0 -111
  209. package/teste-corrigido/README.md +0 -44
  210. package/teste-corrigido/app/client/README.md +0 -69
  211. package/teste-corrigido/app/client/frontend-only.ts +0 -12
  212. package/teste-corrigido/app/client/index.html +0 -13
  213. package/teste-corrigido/app/client/public/vite.svg +0 -1
  214. package/teste-corrigido/app/client/src/App.css +0 -883
  215. package/teste-corrigido/app/client/src/App.tsx +0 -669
  216. package/teste-corrigido/app/client/src/assets/react.svg +0 -1
  217. package/teste-corrigido/app/client/src/components/TestPage.tsx +0 -453
  218. package/teste-corrigido/app/client/src/index.css +0 -51
  219. package/teste-corrigido/app/client/src/lib/eden-api.ts +0 -110
  220. package/teste-corrigido/app/client/src/main.tsx +0 -10
  221. package/teste-corrigido/app/client/src/vite-env.d.ts +0 -1
  222. package/teste-corrigido/app/client/tsconfig.app.json +0 -43
  223. package/teste-corrigido/app/client/tsconfig.json +0 -7
  224. package/teste-corrigido/app/client/tsconfig.node.json +0 -25
  225. package/teste-corrigido/app/server/app.ts +0 -10
  226. package/teste-corrigido/app/server/backend-only.ts +0 -15
  227. package/teste-corrigido/app/server/controllers/users.controller.ts +0 -69
  228. package/teste-corrigido/app/server/index.ts +0 -104
  229. package/teste-corrigido/app/server/routes/index.ts +0 -25
  230. package/teste-corrigido/app/server/routes/users.routes.ts +0 -121
  231. package/teste-corrigido/app/server/types/index.ts +0 -1
  232. package/teste-corrigido/app/shared/types/index.ts +0 -18
  233. package/teste-corrigido/bun.lock +0 -1053
  234. package/teste-corrigido/core/__tests__/integration.test.ts +0 -227
  235. package/teste-corrigido/core/build/index.ts +0 -186
  236. package/teste-corrigido/core/cli/command-registry.ts +0 -334
  237. package/teste-corrigido/core/cli/index.ts +0 -394
  238. package/teste-corrigido/core/cli/plugin-discovery.ts +0 -200
  239. package/teste-corrigido/core/client/standalone.ts +0 -57
  240. package/teste-corrigido/core/config/__tests__/config-loader.test.ts +0 -591
  241. package/teste-corrigido/core/config/__tests__/config-merger.test.ts +0 -657
  242. package/teste-corrigido/core/config/__tests__/env-converter.test.ts +0 -372
  243. package/teste-corrigido/core/config/__tests__/env-processor.test.ts +0 -431
  244. package/teste-corrigido/core/config/__tests__/env.test.ts +0 -452
  245. package/teste-corrigido/core/config/__tests__/integration.test.ts +0 -418
  246. package/teste-corrigido/core/config/__tests__/loader.test.ts +0 -331
  247. package/teste-corrigido/core/config/__tests__/schema.test.ts +0 -129
  248. package/teste-corrigido/core/config/__tests__/validator.test.ts +0 -318
  249. package/teste-corrigido/core/config/env-dynamic.ts +0 -326
  250. package/teste-corrigido/core/config/env.ts +0 -597
  251. package/teste-corrigido/core/config/index.ts +0 -317
  252. package/teste-corrigido/core/config/loader.ts +0 -546
  253. package/teste-corrigido/core/config/runtime-config.ts +0 -322
  254. package/teste-corrigido/core/config/schema.ts +0 -694
  255. package/teste-corrigido/core/config/validator.ts +0 -540
  256. package/teste-corrigido/core/framework/__tests__/server.test.ts +0 -233
  257. package/teste-corrigido/core/framework/client.ts +0 -132
  258. package/teste-corrigido/core/framework/index.ts +0 -8
  259. package/teste-corrigido/core/framework/server.ts +0 -501
  260. package/teste-corrigido/core/framework/types.ts +0 -63
  261. package/teste-corrigido/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  262. package/teste-corrigido/core/plugins/__tests__/manager.test.ts +0 -398
  263. package/teste-corrigido/core/plugins/__tests__/monitoring.test.ts +0 -401
  264. package/teste-corrigido/core/plugins/__tests__/registry.test.ts +0 -335
  265. package/teste-corrigido/core/plugins/built-in/index.ts +0 -142
  266. package/teste-corrigido/core/plugins/built-in/logger/index.ts +0 -180
  267. package/teste-corrigido/core/plugins/built-in/monitoring/README.md +0 -193
  268. package/teste-corrigido/core/plugins/built-in/monitoring/index.ts +0 -912
  269. package/teste-corrigido/core/plugins/built-in/static/index.ts +0 -289
  270. package/teste-corrigido/core/plugins/built-in/swagger/index.ts +0 -229
  271. package/teste-corrigido/core/plugins/built-in/vite/index.ts +0 -316
  272. package/teste-corrigido/core/plugins/config.ts +0 -348
  273. package/teste-corrigido/core/plugins/discovery.ts +0 -350
  274. package/teste-corrigido/core/plugins/executor.ts +0 -351
  275. package/teste-corrigido/core/plugins/index.ts +0 -195
  276. package/teste-corrigido/core/plugins/manager.ts +0 -583
  277. package/teste-corrigido/core/plugins/registry.ts +0 -424
  278. package/teste-corrigido/core/plugins/types.ts +0 -254
  279. package/teste-corrigido/core/server/framework.ts +0 -123
  280. package/teste-corrigido/core/server/index.ts +0 -8
  281. package/teste-corrigido/core/server/plugins/database.ts +0 -182
  282. package/teste-corrigido/core/server/plugins/logger.ts +0 -47
  283. package/teste-corrigido/core/server/plugins/swagger.ts +0 -34
  284. package/teste-corrigido/core/server/standalone.ts +0 -91
  285. package/teste-corrigido/core/templates/create-project.ts +0 -455
  286. package/teste-corrigido/core/types/api.ts +0 -169
  287. package/teste-corrigido/core/types/build.ts +0 -174
  288. package/teste-corrigido/core/types/config.ts +0 -68
  289. package/teste-corrigido/core/types/index.ts +0 -127
  290. package/teste-corrigido/core/types/plugin.ts +0 -94
  291. package/teste-corrigido/core/utils/__tests__/errors.test.ts +0 -139
  292. package/teste-corrigido/core/utils/__tests__/helpers.test.ts +0 -297
  293. package/teste-corrigido/core/utils/__tests__/logger.test.ts +0 -141
  294. package/teste-corrigido/core/utils/env-runtime-v2.ts +0 -232
  295. package/teste-corrigido/core/utils/env-runtime.ts +0 -252
  296. package/teste-corrigido/core/utils/errors/codes.ts +0 -115
  297. package/teste-corrigido/core/utils/errors/handlers.ts +0 -63
  298. package/teste-corrigido/core/utils/errors/index.ts +0 -81
  299. package/teste-corrigido/core/utils/helpers.ts +0 -180
  300. package/teste-corrigido/core/utils/index.ts +0 -18
  301. package/teste-corrigido/core/utils/logger/index.ts +0 -161
  302. package/teste-corrigido/core/utils/logger.ts +0 -106
  303. package/teste-corrigido/core/utils/monitoring/index.ts +0 -212
  304. package/teste-corrigido/package-template.json +0 -51
  305. package/teste-corrigido/package.json +0 -51
  306. package/teste-corrigido/tsconfig.json +0 -51
  307. package/teste-corrigido/vite.config.ts +0 -42
  308. package/teste-final-npm/README.md +0 -44
  309. package/teste-final-npm/app/client/README.md +0 -69
  310. package/teste-final-npm/app/client/frontend-only.ts +0 -12
  311. package/teste-final-npm/app/client/index.html +0 -13
  312. package/teste-final-npm/app/client/public/vite.svg +0 -1
  313. package/teste-final-npm/app/client/src/App.css +0 -883
  314. package/teste-final-npm/app/client/src/App.tsx +0 -669
  315. package/teste-final-npm/app/client/src/assets/react.svg +0 -1
  316. package/teste-final-npm/app/client/src/components/TestPage.tsx +0 -453
  317. package/teste-final-npm/app/client/src/index.css +0 -51
  318. package/teste-final-npm/app/client/src/lib/eden-api.ts +0 -110
  319. package/teste-final-npm/app/client/src/main.tsx +0 -10
  320. package/teste-final-npm/app/client/src/vite-env.d.ts +0 -1
  321. package/teste-final-npm/app/client/tsconfig.app.json +0 -43
  322. package/teste-final-npm/app/client/tsconfig.json +0 -7
  323. package/teste-final-npm/app/client/tsconfig.node.json +0 -25
  324. package/teste-final-npm/app/server/app.ts +0 -10
  325. package/teste-final-npm/app/server/backend-only.ts +0 -15
  326. package/teste-final-npm/app/server/controllers/users.controller.ts +0 -69
  327. package/teste-final-npm/app/server/index.ts +0 -104
  328. package/teste-final-npm/app/server/routes/index.ts +0 -25
  329. package/teste-final-npm/app/server/routes/users.routes.ts +0 -121
  330. package/teste-final-npm/app/server/types/index.ts +0 -1
  331. package/teste-final-npm/app/shared/types/index.ts +0 -18
  332. package/teste-final-npm/bun.lock +0 -1053
  333. package/teste-final-npm/core/__tests__/integration.test.ts +0 -227
  334. package/teste-final-npm/core/build/index.ts +0 -186
  335. package/teste-final-npm/core/cli/command-registry.ts +0 -334
  336. package/teste-final-npm/core/cli/index.ts +0 -394
  337. package/teste-final-npm/core/cli/plugin-discovery.ts +0 -200
  338. package/teste-final-npm/core/client/standalone.ts +0 -57
  339. package/teste-final-npm/core/config/__tests__/config-loader.test.ts +0 -591
  340. package/teste-final-npm/core/config/__tests__/config-merger.test.ts +0 -657
  341. package/teste-final-npm/core/config/__tests__/env-converter.test.ts +0 -372
  342. package/teste-final-npm/core/config/__tests__/env-processor.test.ts +0 -431
  343. package/teste-final-npm/core/config/__tests__/env.test.ts +0 -452
  344. package/teste-final-npm/core/config/__tests__/integration.test.ts +0 -418
  345. package/teste-final-npm/core/config/__tests__/loader.test.ts +0 -331
  346. package/teste-final-npm/core/config/__tests__/schema.test.ts +0 -129
  347. package/teste-final-npm/core/config/__tests__/validator.test.ts +0 -318
  348. package/teste-final-npm/core/config/env-dynamic.ts +0 -326
  349. package/teste-final-npm/core/config/env.ts +0 -597
  350. package/teste-final-npm/core/config/index.ts +0 -317
  351. package/teste-final-npm/core/config/loader.ts +0 -546
  352. package/teste-final-npm/core/config/runtime-config.ts +0 -322
  353. package/teste-final-npm/core/config/schema.ts +0 -694
  354. package/teste-final-npm/core/config/validator.ts +0 -540
  355. package/teste-final-npm/core/framework/__tests__/server.test.ts +0 -233
  356. package/teste-final-npm/core/framework/client.ts +0 -132
  357. package/teste-final-npm/core/framework/index.ts +0 -8
  358. package/teste-final-npm/core/framework/server.ts +0 -501
  359. package/teste-final-npm/core/framework/types.ts +0 -63
  360. package/teste-final-npm/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  361. package/teste-final-npm/core/plugins/__tests__/manager.test.ts +0 -398
  362. package/teste-final-npm/core/plugins/__tests__/monitoring.test.ts +0 -401
  363. package/teste-final-npm/core/plugins/__tests__/registry.test.ts +0 -335
  364. package/teste-final-npm/core/plugins/built-in/index.ts +0 -142
  365. package/teste-final-npm/core/plugins/built-in/logger/index.ts +0 -180
  366. package/teste-final-npm/core/plugins/built-in/monitoring/README.md +0 -193
  367. package/teste-final-npm/core/plugins/built-in/monitoring/index.ts +0 -912
  368. package/teste-final-npm/core/plugins/built-in/static/index.ts +0 -289
  369. package/teste-final-npm/core/plugins/built-in/swagger/index.ts +0 -229
  370. package/teste-final-npm/core/plugins/built-in/vite/index.ts +0 -316
  371. package/teste-final-npm/core/plugins/config.ts +0 -348
  372. package/teste-final-npm/core/plugins/discovery.ts +0 -350
  373. package/teste-final-npm/core/plugins/executor.ts +0 -351
  374. package/teste-final-npm/core/plugins/index.ts +0 -195
  375. package/teste-final-npm/core/plugins/manager.ts +0 -583
  376. package/teste-final-npm/core/plugins/registry.ts +0 -424
  377. package/teste-final-npm/core/plugins/types.ts +0 -254
  378. package/teste-final-npm/core/server/framework.ts +0 -123
  379. package/teste-final-npm/core/server/index.ts +0 -8
  380. package/teste-final-npm/core/server/plugins/database.ts +0 -182
  381. package/teste-final-npm/core/server/plugins/logger.ts +0 -47
  382. package/teste-final-npm/core/server/plugins/swagger.ts +0 -34
  383. package/teste-final-npm/core/server/standalone.ts +0 -91
  384. package/teste-final-npm/core/templates/create-project.ts +0 -455
  385. package/teste-final-npm/core/types/api.ts +0 -169
  386. package/teste-final-npm/core/types/build.ts +0 -174
  387. package/teste-final-npm/core/types/config.ts +0 -68
  388. package/teste-final-npm/core/types/index.ts +0 -127
  389. package/teste-final-npm/core/types/plugin.ts +0 -94
  390. package/teste-final-npm/core/utils/__tests__/errors.test.ts +0 -139
  391. package/teste-final-npm/core/utils/__tests__/helpers.test.ts +0 -297
  392. package/teste-final-npm/core/utils/__tests__/logger.test.ts +0 -141
  393. package/teste-final-npm/core/utils/env-runtime-v2.ts +0 -232
  394. package/teste-final-npm/core/utils/env-runtime.ts +0 -252
  395. package/teste-final-npm/core/utils/errors/codes.ts +0 -115
  396. package/teste-final-npm/core/utils/errors/handlers.ts +0 -63
  397. package/teste-final-npm/core/utils/errors/index.ts +0 -81
  398. package/teste-final-npm/core/utils/helpers.ts +0 -180
  399. package/teste-final-npm/core/utils/index.ts +0 -18
  400. package/teste-final-npm/core/utils/logger/index.ts +0 -161
  401. package/teste-final-npm/core/utils/logger.ts +0 -106
  402. package/teste-final-npm/core/utils/monitoring/index.ts +0 -212
  403. package/teste-final-npm/package-template.json +0 -51
  404. package/teste-final-npm/package.json +0 -51
  405. package/teste-final-npm/tsconfig.json +0 -51
  406. package/teste-final-npm/vite.config.ts +0 -42
@@ -1,316 +0,0 @@
1
- import type { Plugin, PluginContext, RequestContext } from "../../types"
2
- import { createServer, type ViteDevServer } from 'vite'
3
-
4
- let viteServer: ViteDevServer | null = null
5
-
6
- export const vitePlugin: Plugin = {
7
- name: "vite",
8
- version: "1.0.0",
9
- description: "Enhanced Vite integration plugin for FluxStack with improved error handling and monitoring",
10
- author: "FluxStack Team",
11
- priority: "high", // Should run early to setup proxying
12
- category: "development",
13
- tags: ["vite", "development", "hot-reload"],
14
- dependencies: [], // No dependencies
15
-
16
- configSchema: {
17
- type: "object",
18
- properties: {
19
- enabled: {
20
- type: "boolean",
21
- description: "Enable Vite integration"
22
- },
23
- port: {
24
- type: "number",
25
- minimum: 1,
26
- maximum: 65535,
27
- description: "Vite development server port"
28
- },
29
- host: {
30
- type: "string",
31
- description: "Vite development server host"
32
- },
33
- checkInterval: {
34
- type: "number",
35
- minimum: 100,
36
- description: "Interval to check if Vite is running (ms)"
37
- },
38
- maxRetries: {
39
- type: "number",
40
- minimum: 1,
41
- description: "Maximum retries to connect to Vite"
42
- },
43
- timeout: {
44
- type: "number",
45
- minimum: 100,
46
- description: "Timeout for Vite requests (ms)"
47
- },
48
- proxyPaths: {
49
- type: "array",
50
- items: { type: "string" },
51
- description: "Paths to proxy to Vite (defaults to all non-API paths)"
52
- },
53
- excludePaths: {
54
- type: "array",
55
- items: { type: "string" },
56
- description: "Paths to exclude from Vite proxying"
57
- }
58
- },
59
- additionalProperties: false
60
- },
61
-
62
- defaultConfig: {
63
- enabled: true,
64
- port: 5173,
65
- host: "localhost",
66
- checkInterval: 2000,
67
- maxRetries: 10,
68
- timeout: 5000,
69
- proxyPaths: [],
70
- excludePaths: []
71
- },
72
-
73
- setup: async (context: PluginContext) => {
74
- const config = getPluginConfig(context)
75
-
76
- if (!config.enabled || !context.config.client) {
77
- context.logger.info('Vite plugin disabled or no client configuration found')
78
- return
79
- }
80
-
81
- const vitePort = config.port || context.config.client.port || 5173
82
- const viteHost = config.host || "localhost"
83
-
84
- context.logger.info(`🎨 Starting Vite dev server programmatically on ${viteHost}:${vitePort}`)
85
-
86
- try {
87
- // Start Vite dev server programmatically
88
- viteServer = await createServer({
89
- configFile: './vite.config.ts',
90
- // Don't override root - let vite.config.ts handle it
91
- server: {
92
- port: vitePort,
93
- host: viteHost
94
- }
95
- })
96
-
97
- await viteServer.listen()
98
- viteServer.printUrls()
99
-
100
- context.logger.info(`✅ Vite server started successfully on ${viteHost}:${vitePort}`)
101
- context.logger.info('🔄 Hot reload coordination active - Zero órfãos!')
102
-
103
- // Store Vite config in context for later use
104
- ;(context as any).viteConfig = {
105
- port: vitePort,
106
- host: viteHost,
107
- ...config,
108
- server: viteServer
109
- }
110
-
111
- // Setup cleanup on process exit
112
- const cleanup = async () => {
113
- if (viteServer) {
114
- context.logger.info('🛑 Stopping Vite server...')
115
- await viteServer.close()
116
- viteServer = null
117
- }
118
- }
119
-
120
- process.on('SIGINT', cleanup)
121
- process.on('SIGTERM', cleanup)
122
- process.on('exit', cleanup)
123
-
124
- } catch (error) {
125
- context.logger.error('❌ Failed to start Vite server programmatically:', error)
126
- context.logger.info('⚠️ Falling back to monitoring mode...')
127
-
128
- // Fallback to monitoring if programmatic start fails
129
- ;(context as any).viteConfig = {
130
- port: vitePort,
131
- host: viteHost,
132
- ...config
133
- }
134
- monitorVite(context, viteHost, vitePort, config)
135
- }
136
- },
137
-
138
- onServerStart: async (context: PluginContext) => {
139
- const config = getPluginConfig(context)
140
- const viteConfig = (context as any).viteConfig
141
-
142
- if (config.enabled && viteConfig) {
143
- context.logger.info(`Vite integration active - monitoring ${viteConfig.host}:${viteConfig.port}`)
144
- }
145
- },
146
-
147
- onBeforeRoute: async (requestContext: RequestContext) => {
148
- // Skip API routes and swagger - let them be handled by backend
149
- if (requestContext.path.startsWith("/api") || requestContext.path.startsWith("/swagger")) {
150
- return
151
- }
152
-
153
- // Use fixed configuration for simplicity - Vite should be running on port 5173
154
- const viteHost = "localhost"
155
- const vitePort = 5173
156
-
157
- try {
158
- const url = new URL(requestContext.request.url)
159
- const viteUrl = `http://${viteHost}:${vitePort}${requestContext.path}${url.search}`
160
-
161
- // Forward request to Vite
162
- const response = await fetch(viteUrl, {
163
- method: requestContext.method,
164
- headers: requestContext.headers,
165
- body: requestContext.method !== 'GET' && requestContext.method !== 'HEAD' ? requestContext.request.body : undefined
166
- })
167
-
168
- // If Vite responds successfully, handle the request
169
- if (response.ok || response.status < 500) {
170
- // Return a proper Response object with all headers and status
171
- const body = await response.arrayBuffer()
172
-
173
- requestContext.handled = true
174
- requestContext.response = new Response(body, {
175
- status: response.status,
176
- statusText: response.statusText,
177
- headers: response.headers
178
- })
179
- }
180
-
181
- } catch (viteError) {
182
- // If Vite fails, let the request continue to normal routing (will become 404)
183
- // Only log if explicitly enabled for debugging
184
- if (process.env.ENABLE_VITE_PROXY_LOGS === 'true') {
185
- console.warn(`Vite proxy error: ${viteError}`)
186
- }
187
- }
188
- }
189
- }
190
-
191
- // Helper function to get plugin config
192
- function getPluginConfig(context: PluginContext) {
193
- const pluginConfig = context.config.plugins.config?.vite || {}
194
- return { ...vitePlugin.defaultConfig, ...pluginConfig }
195
- }
196
-
197
- // Monitor Vite server status with automatic port detection
198
- async function monitorVite(
199
- context: PluginContext,
200
- host: string,
201
- initialPort: number,
202
- config: any
203
- ) {
204
- let retries = 0
205
- let isConnected = false
206
- let actualPort = initialPort
207
- let portDetected = false
208
-
209
- const checkVite = async () => {
210
- try {
211
- // If we haven't found the correct port yet, try to detect it
212
- if (!portDetected) {
213
- const detectedPort = await detectVitePort(host, initialPort)
214
- if (detectedPort !== null) {
215
- actualPort = detectedPort
216
- portDetected = true
217
- // Update the context with the detected port
218
- if ((context as any).viteConfig) {
219
- ;(context as any).viteConfig.port = actualPort
220
- }
221
- }
222
- }
223
-
224
- const isRunning = await checkViteRunning(host, actualPort, config.timeout)
225
-
226
- if (isRunning && !isConnected) {
227
- isConnected = true
228
- retries = 0
229
- if (actualPort !== initialPort) {
230
- context.logger.info(`✓ Vite server detected on ${host}:${actualPort} (auto-detected from port ${initialPort})`)
231
- } else {
232
- context.logger.info(`✓ Vite server detected on ${host}:${actualPort}`)
233
- }
234
- context.logger.info("Hot reload coordination active")
235
- } else if (!isRunning && isConnected) {
236
- isConnected = false
237
- context.logger.warn(`✗ Vite server disconnected from ${host}:${actualPort}`)
238
- // Reset port detection when disconnected
239
- portDetected = false
240
- actualPort = initialPort
241
- } else if (!isRunning) {
242
- retries++
243
- if (retries <= config.maxRetries) {
244
- if (portDetected) {
245
- context.logger.debug(`Waiting for Vite server on ${host}:${actualPort}... (${retries}/${config.maxRetries})`)
246
- } else {
247
- context.logger.debug(`Detecting Vite server port... (${retries}/${config.maxRetries})`)
248
- }
249
- } else if (retries === config.maxRetries + 1) {
250
- context.logger.warn(`Vite server not found after ${config.maxRetries} attempts. Development features may be limited.`)
251
- }
252
- }
253
- } catch (error) {
254
- if (isConnected) {
255
- context.logger.error('Error checking Vite server status', { error })
256
- }
257
- }
258
-
259
- // Continue monitoring
260
- setTimeout(checkVite, config.checkInterval)
261
- }
262
-
263
- // Start monitoring after a brief delay
264
- setTimeout(checkVite, 1000)
265
- }
266
-
267
- // Auto-detect Vite port by trying common ports
268
- async function detectVitePort(host: string, startPort: number): Promise<number | null> {
269
- // Try the initial port first, then common alternatives
270
- const portsToTry = [
271
- startPort,
272
- startPort + 1,
273
- startPort + 2,
274
- startPort + 3,
275
- 5174, // Common Vite alternative
276
- 5175,
277
- 5176,
278
- 3000, // Sometimes Vite might use this
279
- 4173 // Another common alternative
280
- ]
281
-
282
- for (const port of portsToTry) {
283
- try {
284
- const isRunning = await checkViteRunning(host, port, 1000)
285
- if (isRunning) {
286
- return port
287
- }
288
- } catch (error) {
289
- // Continue trying other ports
290
- }
291
- }
292
-
293
- return null
294
- }
295
-
296
- // Check if Vite is running
297
- async function checkViteRunning(host: string, port: number, timeout: number = 1000): Promise<boolean> {
298
- try {
299
- const controller = new AbortController()
300
- const timeoutId = setTimeout(() => controller.abort(), timeout)
301
-
302
- const response = await fetch(`http://${host}:${port}`, {
303
- signal: controller.signal,
304
- method: 'HEAD' // Use HEAD to minimize data transfer
305
- })
306
-
307
- clearTimeout(timeoutId)
308
- return response.status >= 200 && response.status < 500
309
- } catch (error) {
310
- return false
311
- }
312
- }
313
-
314
- // Note: Proxy logic is now handled directly in the onBeforeRoute hook above
315
-
316
- export default vitePlugin
@@ -1,348 +0,0 @@
1
- /**
2
- * Plugin Configuration Management
3
- * Handles plugin-specific configuration validation and management
4
- */
5
-
6
- import type { Plugin, PluginConfigSchema, PluginValidationResult } from "./types"
7
- import type { FluxStackConfig } from "../config/schema"
8
- import type { Logger } from "../utils/logger/index"
9
-
10
- export interface PluginConfigManager {
11
- validatePluginConfig(plugin: Plugin, config: any): PluginValidationResult
12
- mergePluginConfig(plugin: Plugin, userConfig: any): any
13
- getPluginConfig(pluginName: string, config: FluxStackConfig): any
14
- setPluginConfig(pluginName: string, pluginConfig: any, config: FluxStackConfig): void
15
- }
16
-
17
- export class DefaultPluginConfigManager implements PluginConfigManager {
18
- constructor(_logger?: Logger) {
19
- // Logger stored but not used in current implementation
20
- }
21
-
22
- /**
23
- * Validate plugin configuration against its schema
24
- */
25
- validatePluginConfig(plugin: Plugin, config: any): PluginValidationResult {
26
- const result: PluginValidationResult = {
27
- valid: true,
28
- errors: [],
29
- warnings: []
30
- }
31
-
32
- if (!plugin.configSchema) {
33
- // No schema means any config is valid
34
- return result
35
- }
36
-
37
- try {
38
- this.validateAgainstSchema(config, plugin.configSchema, plugin.name, result)
39
- } catch (error) {
40
- result.valid = false
41
- result.errors.push(`Configuration validation failed: ${error instanceof Error ? error.message : String(error)}`)
42
- }
43
-
44
- return result
45
- }
46
-
47
- /**
48
- * Merge user configuration with plugin defaults
49
- */
50
- mergePluginConfig(plugin: Plugin, userConfig: any): any {
51
- const defaultConfig = plugin.defaultConfig || {}
52
-
53
- if (!userConfig) {
54
- return defaultConfig
55
- }
56
-
57
- return this.deepMerge(defaultConfig, userConfig)
58
- }
59
-
60
- /**
61
- * Get plugin configuration from main config
62
- */
63
- getPluginConfig(pluginName: string, config: FluxStackConfig): any {
64
- return config.plugins.config[pluginName] || {}
65
- }
66
-
67
- /**
68
- * Set plugin configuration in main config
69
- */
70
- setPluginConfig(pluginName: string, pluginConfig: any, config: FluxStackConfig): void {
71
- if (!config.plugins.config) {
72
- config.plugins.config = {}
73
- }
74
- config.plugins.config[pluginName] = pluginConfig
75
- }
76
-
77
- /**
78
- * Validate configuration against JSON schema
79
- */
80
- private validateAgainstSchema(
81
- data: any,
82
- schema: PluginConfigSchema,
83
- pluginName: string,
84
- result: PluginValidationResult
85
- ): void {
86
- if (schema.type === 'object' && typeof data !== 'object') {
87
- result.valid = false
88
- result.errors.push(`Plugin '${pluginName}' configuration must be an object`)
89
- return
90
- }
91
-
92
- // Check required properties
93
- if (schema.required && Array.isArray(schema.required)) {
94
- for (const requiredProp of schema.required) {
95
- if (!(requiredProp in data)) {
96
- result.valid = false
97
- result.errors.push(`Plugin '${pluginName}' configuration missing required property: ${requiredProp}`)
98
- }
99
- }
100
- }
101
-
102
- // Validate properties
103
- if (schema.properties) {
104
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
105
- if (propName in data) {
106
- this.validateProperty(data[propName], propSchema, `${pluginName}.${propName}`, result)
107
- }
108
- }
109
- }
110
-
111
- // Check for additional properties
112
- if (schema.additionalProperties === false) {
113
- const allowedProps = Object.keys(schema.properties || {})
114
- const actualProps = Object.keys(data)
115
-
116
- for (const prop of actualProps) {
117
- if (!allowedProps.includes(prop)) {
118
- result.warnings.push(`Plugin '${pluginName}' configuration has unexpected property: ${prop}`)
119
- }
120
- }
121
- }
122
- }
123
-
124
- /**
125
- * Validate individual property
126
- */
127
- private validateProperty(value: any, schema: any, path: string, result: PluginValidationResult): void {
128
- if (schema.type) {
129
- const actualType = Array.isArray(value) ? 'array' : typeof value
130
- if (actualType !== schema.type) {
131
- result.valid = false
132
- result.errors.push(`Property '${path}' must be of type ${schema.type}, got ${actualType}`)
133
- return
134
- }
135
- }
136
-
137
- // Type-specific validations
138
- switch (schema.type) {
139
- case 'string':
140
- this.validateStringProperty(value, schema, path, result)
141
- break
142
- case 'number':
143
- this.validateNumberProperty(value, schema, path, result)
144
- break
145
- case 'array':
146
- this.validateArrayProperty(value, schema, path, result)
147
- break
148
- case 'object':
149
- if (schema.properties) {
150
- this.validateObjectProperty(value, schema, path, result)
151
- }
152
- break
153
- }
154
-
155
- // Enum validation
156
- if (schema.enum && !schema.enum.includes(value)) {
157
- result.valid = false
158
- result.errors.push(`Property '${path}' must be one of: ${schema.enum.join(', ')}`)
159
- }
160
- }
161
-
162
- /**
163
- * Validate string property
164
- */
165
- private validateStringProperty(value: string, schema: any, path: string, result: PluginValidationResult): void {
166
- if (schema.minLength && value.length < schema.minLength) {
167
- result.valid = false
168
- result.errors.push(`Property '${path}' must be at least ${schema.minLength} characters long`)
169
- }
170
-
171
- if (schema.maxLength && value.length > schema.maxLength) {
172
- result.valid = false
173
- result.errors.push(`Property '${path}' must be at most ${schema.maxLength} characters long`)
174
- }
175
-
176
- if (schema.pattern) {
177
- const regex = new RegExp(schema.pattern)
178
- if (!regex.test(value)) {
179
- result.valid = false
180
- result.errors.push(`Property '${path}' does not match required pattern: ${schema.pattern}`)
181
- }
182
- }
183
- }
184
-
185
- /**
186
- * Validate number property
187
- */
188
- private validateNumberProperty(value: number, schema: any, path: string, result: PluginValidationResult): void {
189
- if (schema.minimum !== undefined && value < schema.minimum) {
190
- result.valid = false
191
- result.errors.push(`Property '${path}' must be at least ${schema.minimum}`)
192
- }
193
-
194
- if (schema.maximum !== undefined && value > schema.maximum) {
195
- result.valid = false
196
- result.errors.push(`Property '${path}' must be at most ${schema.maximum}`)
197
- }
198
-
199
- if (schema.multipleOf && value % schema.multipleOf !== 0) {
200
- result.valid = false
201
- result.errors.push(`Property '${path}' must be a multiple of ${schema.multipleOf}`)
202
- }
203
- }
204
-
205
- /**
206
- * Validate array property
207
- */
208
- private validateArrayProperty(value: any[], schema: any, path: string, result: PluginValidationResult): void {
209
- if (schema.minItems && value.length < schema.minItems) {
210
- result.valid = false
211
- result.errors.push(`Property '${path}' must have at least ${schema.minItems} items`)
212
- }
213
-
214
- if (schema.maxItems && value.length > schema.maxItems) {
215
- result.valid = false
216
- result.errors.push(`Property '${path}' must have at most ${schema.maxItems} items`)
217
- }
218
-
219
- if (schema.items) {
220
- value.forEach((item, index) => {
221
- this.validateProperty(item, schema.items, `${path}[${index}]`, result)
222
- })
223
- }
224
- }
225
-
226
- /**
227
- * Validate object property
228
- */
229
- private validateObjectProperty(value: any, schema: any, path: string, result: PluginValidationResult): void {
230
- if (schema.required) {
231
- for (const requiredProp of schema.required) {
232
- if (!(requiredProp in value)) {
233
- result.valid = false
234
- result.errors.push(`Property '${path}' missing required property: ${requiredProp}`)
235
- }
236
- }
237
- }
238
-
239
- if (schema.properties) {
240
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
241
- if (propName in value) {
242
- this.validateProperty(value[propName], propSchema, `${path}.${propName}`, result)
243
- }
244
- }
245
- }
246
- }
247
-
248
- /**
249
- * Deep merge two objects
250
- */
251
- private deepMerge(target: any, source: any): any {
252
- if (source === null || source === undefined) {
253
- return target
254
- }
255
-
256
- if (target === null || target === undefined) {
257
- return source
258
- }
259
-
260
- if (typeof target !== 'object' || typeof source !== 'object') {
261
- return source
262
- }
263
-
264
- if (Array.isArray(source)) {
265
- return [...source]
266
- }
267
-
268
- const result = { ...target }
269
-
270
- for (const key in source) {
271
- if (source.hasOwnProperty(key)) {
272
- if (typeof source[key] === 'object' && !Array.isArray(source[key]) && source[key] !== null) {
273
- result[key] = this.deepMerge(target[key], source[key])
274
- } else {
275
- result[key] = source[key]
276
- }
277
- }
278
- }
279
-
280
- return result
281
- }
282
- }
283
-
284
- /**
285
- * Create plugin configuration utilities
286
- */
287
- export function createPluginUtils(logger?: Logger): PluginUtils {
288
- return {
289
- createTimer: (label: string) => {
290
- const start = Date.now()
291
- return {
292
- end: () => {
293
- const duration = Date.now() - start
294
- logger?.debug(`Timer '${label}' completed`, { duration })
295
- return duration
296
- }
297
- }
298
- },
299
-
300
- formatBytes: (bytes: number): string => {
301
- if (bytes === 0) return '0 Bytes'
302
- const k = 1024
303
- const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
304
- const i = Math.floor(Math.log(bytes) / Math.log(k))
305
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
306
- },
307
-
308
- isProduction: (): boolean => {
309
- return process.env.NODE_ENV === 'production'
310
- },
311
-
312
- isDevelopment: (): boolean => {
313
- return process.env.NODE_ENV === 'development'
314
- },
315
-
316
- getEnvironment: (): string => {
317
- return process.env.NODE_ENV || 'development'
318
- },
319
-
320
- createHash: (data: string): string => {
321
- // Simple hash function - in production, use crypto
322
- let hash = 0
323
- for (let i = 0; i < data.length; i++) {
324
- const char = data.charCodeAt(i)
325
- hash = ((hash << 5) - hash) + char
326
- hash = hash & hash // Convert to 32-bit integer
327
- }
328
- return hash.toString(36)
329
- },
330
-
331
- deepMerge: (target: any, source: any): any => {
332
- const manager = new DefaultPluginConfigManager()
333
- return (manager as any).deepMerge(target, source)
334
- },
335
-
336
- validateSchema: (data: any, schema: any): { valid: boolean; errors: string[] } => {
337
- const manager = new DefaultPluginConfigManager()
338
- const result = manager.validatePluginConfig({ name: 'temp', configSchema: schema }, data)
339
- return {
340
- valid: result.valid,
341
- errors: result.errors
342
- }
343
- }
344
- }
345
- }
346
-
347
- // Export types for plugin utilities
348
- import type { PluginUtils } from "./types"