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.
- package/.claude/settings.local.json +6 -1
- package/create-fluxstack.ts +10 -6
- package/package.json +1 -1
- package/ENV_TESTING_REPORT.md +0 -292
- package/FRAMEWORK_ROADMAP.md +0 -183
- package/FRONTEND_TESTS_README.md +0 -287
- package/TEST_RESULTS.md +0 -130
- package/docs/dynamic-environment-variables.md +0 -380
- package/examples/dynamic-env-usage.ts +0 -283
- package/examples/hybrid-env-strategy.ts +0 -212
- package/examples/simplified-env-usage.ts +0 -251
- package/meu-app-teste/README.md +0 -44
- package/meu-app-teste/app/client/README.md +0 -69
- package/meu-app-teste/app/client/frontend-only.ts +0 -12
- package/meu-app-teste/app/client/index.html +0 -13
- package/meu-app-teste/app/client/public/vite.svg +0 -1
- package/meu-app-teste/app/client/src/App.css +0 -883
- package/meu-app-teste/app/client/src/App.tsx +0 -669
- package/meu-app-teste/app/client/src/assets/react.svg +0 -1
- package/meu-app-teste/app/client/src/components/TestPage.tsx +0 -453
- package/meu-app-teste/app/client/src/index.css +0 -51
- package/meu-app-teste/app/client/src/lib/eden-api.ts +0 -110
- package/meu-app-teste/app/client/src/main.tsx +0 -10
- package/meu-app-teste/app/client/src/vite-env.d.ts +0 -1
- package/meu-app-teste/app/client/tsconfig.app.json +0 -43
- package/meu-app-teste/app/client/tsconfig.json +0 -7
- package/meu-app-teste/app/client/tsconfig.node.json +0 -25
- package/meu-app-teste/app/server/app.ts +0 -10
- package/meu-app-teste/app/server/backend-only.ts +0 -15
- package/meu-app-teste/app/server/controllers/users.controller.ts +0 -69
- package/meu-app-teste/app/server/index.ts +0 -104
- package/meu-app-teste/app/server/routes/index.ts +0 -25
- package/meu-app-teste/app/server/routes/users.routes.ts +0 -121
- package/meu-app-teste/app/server/types/index.ts +0 -1
- package/meu-app-teste/app/shared/types/index.ts +0 -18
- package/meu-app-teste/bun.lock +0 -1053
- package/meu-app-teste/core/__tests__/integration.test.ts +0 -227
- package/meu-app-teste/core/build/index.ts +0 -186
- package/meu-app-teste/core/cli/command-registry.ts +0 -334
- package/meu-app-teste/core/cli/index.ts +0 -394
- package/meu-app-teste/core/cli/plugin-discovery.ts +0 -200
- package/meu-app-teste/core/client/standalone.ts +0 -57
- package/meu-app-teste/core/config/__tests__/config-loader.test.ts +0 -591
- package/meu-app-teste/core/config/__tests__/config-merger.test.ts +0 -657
- package/meu-app-teste/core/config/__tests__/env-converter.test.ts +0 -372
- package/meu-app-teste/core/config/__tests__/env-processor.test.ts +0 -431
- package/meu-app-teste/core/config/__tests__/env.test.ts +0 -452
- package/meu-app-teste/core/config/__tests__/integration.test.ts +0 -418
- package/meu-app-teste/core/config/__tests__/loader.test.ts +0 -331
- package/meu-app-teste/core/config/__tests__/schema.test.ts +0 -129
- package/meu-app-teste/core/config/__tests__/validator.test.ts +0 -318
- package/meu-app-teste/core/config/env-dynamic.ts +0 -326
- package/meu-app-teste/core/config/env.ts +0 -597
- package/meu-app-teste/core/config/index.ts +0 -317
- package/meu-app-teste/core/config/loader.ts +0 -546
- package/meu-app-teste/core/config/runtime-config.ts +0 -322
- package/meu-app-teste/core/config/schema.ts +0 -694
- package/meu-app-teste/core/config/validator.ts +0 -540
- package/meu-app-teste/core/framework/__tests__/server.test.ts +0 -233
- package/meu-app-teste/core/framework/client.ts +0 -132
- package/meu-app-teste/core/framework/index.ts +0 -8
- package/meu-app-teste/core/framework/server.ts +0 -501
- package/meu-app-teste/core/framework/types.ts +0 -63
- package/meu-app-teste/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/meu-app-teste/core/plugins/__tests__/manager.test.ts +0 -398
- package/meu-app-teste/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/meu-app-teste/core/plugins/__tests__/registry.test.ts +0 -335
- package/meu-app-teste/core/plugins/built-in/index.ts +0 -142
- package/meu-app-teste/core/plugins/built-in/logger/index.ts +0 -180
- package/meu-app-teste/core/plugins/built-in/monitoring/README.md +0 -193
- package/meu-app-teste/core/plugins/built-in/monitoring/index.ts +0 -912
- package/meu-app-teste/core/plugins/built-in/static/index.ts +0 -289
- package/meu-app-teste/core/plugins/built-in/swagger/index.ts +0 -229
- package/meu-app-teste/core/plugins/built-in/vite/index.ts +0 -316
- package/meu-app-teste/core/plugins/config.ts +0 -348
- package/meu-app-teste/core/plugins/discovery.ts +0 -350
- package/meu-app-teste/core/plugins/executor.ts +0 -351
- package/meu-app-teste/core/plugins/index.ts +0 -195
- package/meu-app-teste/core/plugins/manager.ts +0 -583
- package/meu-app-teste/core/plugins/registry.ts +0 -424
- package/meu-app-teste/core/plugins/types.ts +0 -254
- package/meu-app-teste/core/server/framework.ts +0 -123
- package/meu-app-teste/core/server/index.ts +0 -8
- package/meu-app-teste/core/server/plugins/database.ts +0 -182
- package/meu-app-teste/core/server/plugins/logger.ts +0 -47
- package/meu-app-teste/core/server/plugins/swagger.ts +0 -34
- package/meu-app-teste/core/server/standalone.ts +0 -91
- package/meu-app-teste/core/templates/create-project.ts +0 -455
- package/meu-app-teste/core/types/api.ts +0 -169
- package/meu-app-teste/core/types/build.ts +0 -174
- package/meu-app-teste/core/types/config.ts +0 -68
- package/meu-app-teste/core/types/index.ts +0 -127
- package/meu-app-teste/core/types/plugin.ts +0 -94
- package/meu-app-teste/core/utils/__tests__/errors.test.ts +0 -139
- package/meu-app-teste/core/utils/__tests__/helpers.test.ts +0 -297
- package/meu-app-teste/core/utils/__tests__/logger.test.ts +0 -141
- package/meu-app-teste/core/utils/env-runtime-v2.ts +0 -232
- package/meu-app-teste/core/utils/env-runtime.ts +0 -252
- package/meu-app-teste/core/utils/errors/codes.ts +0 -115
- package/meu-app-teste/core/utils/errors/handlers.ts +0 -63
- package/meu-app-teste/core/utils/errors/index.ts +0 -81
- package/meu-app-teste/core/utils/helpers.ts +0 -180
- package/meu-app-teste/core/utils/index.ts +0 -18
- package/meu-app-teste/core/utils/logger/index.ts +0 -161
- package/meu-app-teste/core/utils/logger.ts +0 -106
- package/meu-app-teste/core/utils/monitoring/index.ts +0 -212
- package/meu-app-teste/package.json +0 -92
- package/meu-app-teste/tsconfig.json +0 -51
- package/meu-app-teste/vite.config.ts +0 -42
- package/my-final-test/README.md +0 -44
- package/my-final-test/app/client/README.md +0 -69
- package/my-final-test/app/client/frontend-only.ts +0 -12
- package/my-final-test/app/client/index.html +0 -13
- package/my-final-test/app/client/public/vite.svg +0 -1
- package/my-final-test/app/client/src/App.css +0 -883
- package/my-final-test/app/client/src/App.tsx +0 -669
- package/my-final-test/app/client/src/assets/react.svg +0 -1
- package/my-final-test/app/client/src/components/TestPage.tsx +0 -453
- package/my-final-test/app/client/src/index.css +0 -51
- package/my-final-test/app/client/src/lib/eden-api.ts +0 -110
- package/my-final-test/app/client/src/main.tsx +0 -10
- package/my-final-test/app/client/src/vite-env.d.ts +0 -1
- package/my-final-test/app/client/tsconfig.app.json +0 -43
- package/my-final-test/app/client/tsconfig.json +0 -7
- package/my-final-test/app/client/tsconfig.node.json +0 -25
- package/my-final-test/app/server/app.ts +0 -10
- package/my-final-test/app/server/backend-only.ts +0 -15
- package/my-final-test/app/server/controllers/users.controller.ts +0 -69
- package/my-final-test/app/server/index.ts +0 -104
- package/my-final-test/app/server/routes/index.ts +0 -25
- package/my-final-test/app/server/routes/users.routes.ts +0 -121
- package/my-final-test/app/server/types/index.ts +0 -1
- package/my-final-test/app/shared/types/index.ts +0 -18
- package/my-final-test/bun.lock +0 -993
- package/my-final-test/core/__tests__/integration.test.ts +0 -227
- package/my-final-test/core/build/index.ts +0 -186
- package/my-final-test/core/cli/command-registry.ts +0 -334
- package/my-final-test/core/cli/index.ts +0 -394
- package/my-final-test/core/cli/plugin-discovery.ts +0 -200
- package/my-final-test/core/client/standalone.ts +0 -57
- package/my-final-test/core/config/__tests__/config-loader.test.ts +0 -591
- package/my-final-test/core/config/__tests__/config-merger.test.ts +0 -657
- package/my-final-test/core/config/__tests__/env-converter.test.ts +0 -372
- package/my-final-test/core/config/__tests__/env-processor.test.ts +0 -431
- package/my-final-test/core/config/__tests__/env.test.ts +0 -452
- package/my-final-test/core/config/__tests__/integration.test.ts +0 -418
- package/my-final-test/core/config/__tests__/loader.test.ts +0 -331
- package/my-final-test/core/config/__tests__/schema.test.ts +0 -129
- package/my-final-test/core/config/__tests__/validator.test.ts +0 -318
- package/my-final-test/core/config/env-dynamic.ts +0 -326
- package/my-final-test/core/config/env.ts +0 -597
- package/my-final-test/core/config/index.ts +0 -317
- package/my-final-test/core/config/loader.ts +0 -546
- package/my-final-test/core/config/runtime-config.ts +0 -322
- package/my-final-test/core/config/schema.ts +0 -694
- package/my-final-test/core/config/validator.ts +0 -540
- package/my-final-test/core/framework/__tests__/server.test.ts +0 -233
- package/my-final-test/core/framework/client.ts +0 -132
- package/my-final-test/core/framework/index.ts +0 -8
- package/my-final-test/core/framework/server.ts +0 -501
- package/my-final-test/core/framework/types.ts +0 -63
- package/my-final-test/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/my-final-test/core/plugins/__tests__/manager.test.ts +0 -398
- package/my-final-test/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/my-final-test/core/plugins/__tests__/registry.test.ts +0 -335
- package/my-final-test/core/plugins/built-in/index.ts +0 -142
- package/my-final-test/core/plugins/built-in/logger/index.ts +0 -180
- package/my-final-test/core/plugins/built-in/monitoring/README.md +0 -193
- package/my-final-test/core/plugins/built-in/monitoring/index.ts +0 -912
- package/my-final-test/core/plugins/built-in/static/index.ts +0 -289
- package/my-final-test/core/plugins/built-in/swagger/index.ts +0 -229
- package/my-final-test/core/plugins/built-in/vite/index.ts +0 -316
- package/my-final-test/core/plugins/config.ts +0 -348
- package/my-final-test/core/plugins/discovery.ts +0 -350
- package/my-final-test/core/plugins/executor.ts +0 -351
- package/my-final-test/core/plugins/index.ts +0 -195
- package/my-final-test/core/plugins/manager.ts +0 -583
- package/my-final-test/core/plugins/registry.ts +0 -424
- package/my-final-test/core/plugins/types.ts +0 -254
- package/my-final-test/core/server/framework.ts +0 -123
- package/my-final-test/core/server/index.ts +0 -8
- package/my-final-test/core/server/plugins/database.ts +0 -182
- package/my-final-test/core/server/plugins/logger.ts +0 -47
- package/my-final-test/core/server/plugins/swagger.ts +0 -34
- package/my-final-test/core/server/standalone.ts +0 -91
- package/my-final-test/core/templates/create-project.ts +0 -455
- package/my-final-test/core/types/api.ts +0 -169
- package/my-final-test/core/types/build.ts +0 -174
- package/my-final-test/core/types/config.ts +0 -68
- package/my-final-test/core/types/index.ts +0 -127
- package/my-final-test/core/types/plugin.ts +0 -94
- package/my-final-test/core/utils/__tests__/errors.test.ts +0 -139
- package/my-final-test/core/utils/__tests__/helpers.test.ts +0 -297
- package/my-final-test/core/utils/__tests__/logger.test.ts +0 -141
- package/my-final-test/core/utils/env-runtime-v2.ts +0 -232
- package/my-final-test/core/utils/env-runtime.ts +0 -252
- package/my-final-test/core/utils/errors/codes.ts +0 -115
- package/my-final-test/core/utils/errors/handlers.ts +0 -63
- package/my-final-test/core/utils/errors/index.ts +0 -81
- package/my-final-test/core/utils/helpers.ts +0 -180
- package/my-final-test/core/utils/index.ts +0 -18
- package/my-final-test/core/utils/logger/index.ts +0 -161
- package/my-final-test/core/utils/logger.ts +0 -106
- package/my-final-test/core/utils/monitoring/index.ts +0 -212
- package/my-final-test/package.json +0 -68
- package/my-final-test/tsconfig.json +0 -51
- package/my-final-test/vite.config.ts +0 -42
- package/publish-setup.md +0 -111
- package/teste-corrigido/README.md +0 -44
- package/teste-corrigido/app/client/README.md +0 -69
- package/teste-corrigido/app/client/frontend-only.ts +0 -12
- package/teste-corrigido/app/client/index.html +0 -13
- package/teste-corrigido/app/client/public/vite.svg +0 -1
- package/teste-corrigido/app/client/src/App.css +0 -883
- package/teste-corrigido/app/client/src/App.tsx +0 -669
- package/teste-corrigido/app/client/src/assets/react.svg +0 -1
- package/teste-corrigido/app/client/src/components/TestPage.tsx +0 -453
- package/teste-corrigido/app/client/src/index.css +0 -51
- package/teste-corrigido/app/client/src/lib/eden-api.ts +0 -110
- package/teste-corrigido/app/client/src/main.tsx +0 -10
- package/teste-corrigido/app/client/src/vite-env.d.ts +0 -1
- package/teste-corrigido/app/client/tsconfig.app.json +0 -43
- package/teste-corrigido/app/client/tsconfig.json +0 -7
- package/teste-corrigido/app/client/tsconfig.node.json +0 -25
- package/teste-corrigido/app/server/app.ts +0 -10
- package/teste-corrigido/app/server/backend-only.ts +0 -15
- package/teste-corrigido/app/server/controllers/users.controller.ts +0 -69
- package/teste-corrigido/app/server/index.ts +0 -104
- package/teste-corrigido/app/server/routes/index.ts +0 -25
- package/teste-corrigido/app/server/routes/users.routes.ts +0 -121
- package/teste-corrigido/app/server/types/index.ts +0 -1
- package/teste-corrigido/app/shared/types/index.ts +0 -18
- package/teste-corrigido/bun.lock +0 -1053
- package/teste-corrigido/core/__tests__/integration.test.ts +0 -227
- package/teste-corrigido/core/build/index.ts +0 -186
- package/teste-corrigido/core/cli/command-registry.ts +0 -334
- package/teste-corrigido/core/cli/index.ts +0 -394
- package/teste-corrigido/core/cli/plugin-discovery.ts +0 -200
- package/teste-corrigido/core/client/standalone.ts +0 -57
- package/teste-corrigido/core/config/__tests__/config-loader.test.ts +0 -591
- package/teste-corrigido/core/config/__tests__/config-merger.test.ts +0 -657
- package/teste-corrigido/core/config/__tests__/env-converter.test.ts +0 -372
- package/teste-corrigido/core/config/__tests__/env-processor.test.ts +0 -431
- package/teste-corrigido/core/config/__tests__/env.test.ts +0 -452
- package/teste-corrigido/core/config/__tests__/integration.test.ts +0 -418
- package/teste-corrigido/core/config/__tests__/loader.test.ts +0 -331
- package/teste-corrigido/core/config/__tests__/schema.test.ts +0 -129
- package/teste-corrigido/core/config/__tests__/validator.test.ts +0 -318
- package/teste-corrigido/core/config/env-dynamic.ts +0 -326
- package/teste-corrigido/core/config/env.ts +0 -597
- package/teste-corrigido/core/config/index.ts +0 -317
- package/teste-corrigido/core/config/loader.ts +0 -546
- package/teste-corrigido/core/config/runtime-config.ts +0 -322
- package/teste-corrigido/core/config/schema.ts +0 -694
- package/teste-corrigido/core/config/validator.ts +0 -540
- package/teste-corrigido/core/framework/__tests__/server.test.ts +0 -233
- package/teste-corrigido/core/framework/client.ts +0 -132
- package/teste-corrigido/core/framework/index.ts +0 -8
- package/teste-corrigido/core/framework/server.ts +0 -501
- package/teste-corrigido/core/framework/types.ts +0 -63
- package/teste-corrigido/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/teste-corrigido/core/plugins/__tests__/manager.test.ts +0 -398
- package/teste-corrigido/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/teste-corrigido/core/plugins/__tests__/registry.test.ts +0 -335
- package/teste-corrigido/core/plugins/built-in/index.ts +0 -142
- package/teste-corrigido/core/plugins/built-in/logger/index.ts +0 -180
- package/teste-corrigido/core/plugins/built-in/monitoring/README.md +0 -193
- package/teste-corrigido/core/plugins/built-in/monitoring/index.ts +0 -912
- package/teste-corrigido/core/plugins/built-in/static/index.ts +0 -289
- package/teste-corrigido/core/plugins/built-in/swagger/index.ts +0 -229
- package/teste-corrigido/core/plugins/built-in/vite/index.ts +0 -316
- package/teste-corrigido/core/plugins/config.ts +0 -348
- package/teste-corrigido/core/plugins/discovery.ts +0 -350
- package/teste-corrigido/core/plugins/executor.ts +0 -351
- package/teste-corrigido/core/plugins/index.ts +0 -195
- package/teste-corrigido/core/plugins/manager.ts +0 -583
- package/teste-corrigido/core/plugins/registry.ts +0 -424
- package/teste-corrigido/core/plugins/types.ts +0 -254
- package/teste-corrigido/core/server/framework.ts +0 -123
- package/teste-corrigido/core/server/index.ts +0 -8
- package/teste-corrigido/core/server/plugins/database.ts +0 -182
- package/teste-corrigido/core/server/plugins/logger.ts +0 -47
- package/teste-corrigido/core/server/plugins/swagger.ts +0 -34
- package/teste-corrigido/core/server/standalone.ts +0 -91
- package/teste-corrigido/core/templates/create-project.ts +0 -455
- package/teste-corrigido/core/types/api.ts +0 -169
- package/teste-corrigido/core/types/build.ts +0 -174
- package/teste-corrigido/core/types/config.ts +0 -68
- package/teste-corrigido/core/types/index.ts +0 -127
- package/teste-corrigido/core/types/plugin.ts +0 -94
- package/teste-corrigido/core/utils/__tests__/errors.test.ts +0 -139
- package/teste-corrigido/core/utils/__tests__/helpers.test.ts +0 -297
- package/teste-corrigido/core/utils/__tests__/logger.test.ts +0 -141
- package/teste-corrigido/core/utils/env-runtime-v2.ts +0 -232
- package/teste-corrigido/core/utils/env-runtime.ts +0 -252
- package/teste-corrigido/core/utils/errors/codes.ts +0 -115
- package/teste-corrigido/core/utils/errors/handlers.ts +0 -63
- package/teste-corrigido/core/utils/errors/index.ts +0 -81
- package/teste-corrigido/core/utils/helpers.ts +0 -180
- package/teste-corrigido/core/utils/index.ts +0 -18
- package/teste-corrigido/core/utils/logger/index.ts +0 -161
- package/teste-corrigido/core/utils/logger.ts +0 -106
- package/teste-corrigido/core/utils/monitoring/index.ts +0 -212
- package/teste-corrigido/package-template.json +0 -51
- package/teste-corrigido/package.json +0 -51
- package/teste-corrigido/tsconfig.json +0 -51
- package/teste-corrigido/vite.config.ts +0 -42
- package/teste-final-npm/README.md +0 -44
- package/teste-final-npm/app/client/README.md +0 -69
- package/teste-final-npm/app/client/frontend-only.ts +0 -12
- package/teste-final-npm/app/client/index.html +0 -13
- package/teste-final-npm/app/client/public/vite.svg +0 -1
- package/teste-final-npm/app/client/src/App.css +0 -883
- package/teste-final-npm/app/client/src/App.tsx +0 -669
- package/teste-final-npm/app/client/src/assets/react.svg +0 -1
- package/teste-final-npm/app/client/src/components/TestPage.tsx +0 -453
- package/teste-final-npm/app/client/src/index.css +0 -51
- package/teste-final-npm/app/client/src/lib/eden-api.ts +0 -110
- package/teste-final-npm/app/client/src/main.tsx +0 -10
- package/teste-final-npm/app/client/src/vite-env.d.ts +0 -1
- package/teste-final-npm/app/client/tsconfig.app.json +0 -43
- package/teste-final-npm/app/client/tsconfig.json +0 -7
- package/teste-final-npm/app/client/tsconfig.node.json +0 -25
- package/teste-final-npm/app/server/app.ts +0 -10
- package/teste-final-npm/app/server/backend-only.ts +0 -15
- package/teste-final-npm/app/server/controllers/users.controller.ts +0 -69
- package/teste-final-npm/app/server/index.ts +0 -104
- package/teste-final-npm/app/server/routes/index.ts +0 -25
- package/teste-final-npm/app/server/routes/users.routes.ts +0 -121
- package/teste-final-npm/app/server/types/index.ts +0 -1
- package/teste-final-npm/app/shared/types/index.ts +0 -18
- package/teste-final-npm/bun.lock +0 -1053
- package/teste-final-npm/core/__tests__/integration.test.ts +0 -227
- package/teste-final-npm/core/build/index.ts +0 -186
- package/teste-final-npm/core/cli/command-registry.ts +0 -334
- package/teste-final-npm/core/cli/index.ts +0 -394
- package/teste-final-npm/core/cli/plugin-discovery.ts +0 -200
- package/teste-final-npm/core/client/standalone.ts +0 -57
- package/teste-final-npm/core/config/__tests__/config-loader.test.ts +0 -591
- package/teste-final-npm/core/config/__tests__/config-merger.test.ts +0 -657
- package/teste-final-npm/core/config/__tests__/env-converter.test.ts +0 -372
- package/teste-final-npm/core/config/__tests__/env-processor.test.ts +0 -431
- package/teste-final-npm/core/config/__tests__/env.test.ts +0 -452
- package/teste-final-npm/core/config/__tests__/integration.test.ts +0 -418
- package/teste-final-npm/core/config/__tests__/loader.test.ts +0 -331
- package/teste-final-npm/core/config/__tests__/schema.test.ts +0 -129
- package/teste-final-npm/core/config/__tests__/validator.test.ts +0 -318
- package/teste-final-npm/core/config/env-dynamic.ts +0 -326
- package/teste-final-npm/core/config/env.ts +0 -597
- package/teste-final-npm/core/config/index.ts +0 -317
- package/teste-final-npm/core/config/loader.ts +0 -546
- package/teste-final-npm/core/config/runtime-config.ts +0 -322
- package/teste-final-npm/core/config/schema.ts +0 -694
- package/teste-final-npm/core/config/validator.ts +0 -540
- package/teste-final-npm/core/framework/__tests__/server.test.ts +0 -233
- package/teste-final-npm/core/framework/client.ts +0 -132
- package/teste-final-npm/core/framework/index.ts +0 -8
- package/teste-final-npm/core/framework/server.ts +0 -501
- package/teste-final-npm/core/framework/types.ts +0 -63
- package/teste-final-npm/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/teste-final-npm/core/plugins/__tests__/manager.test.ts +0 -398
- package/teste-final-npm/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/teste-final-npm/core/plugins/__tests__/registry.test.ts +0 -335
- package/teste-final-npm/core/plugins/built-in/index.ts +0 -142
- package/teste-final-npm/core/plugins/built-in/logger/index.ts +0 -180
- package/teste-final-npm/core/plugins/built-in/monitoring/README.md +0 -193
- package/teste-final-npm/core/plugins/built-in/monitoring/index.ts +0 -912
- package/teste-final-npm/core/plugins/built-in/static/index.ts +0 -289
- package/teste-final-npm/core/plugins/built-in/swagger/index.ts +0 -229
- package/teste-final-npm/core/plugins/built-in/vite/index.ts +0 -316
- package/teste-final-npm/core/plugins/config.ts +0 -348
- package/teste-final-npm/core/plugins/discovery.ts +0 -350
- package/teste-final-npm/core/plugins/executor.ts +0 -351
- package/teste-final-npm/core/plugins/index.ts +0 -195
- package/teste-final-npm/core/plugins/manager.ts +0 -583
- package/teste-final-npm/core/plugins/registry.ts +0 -424
- package/teste-final-npm/core/plugins/types.ts +0 -254
- package/teste-final-npm/core/server/framework.ts +0 -123
- package/teste-final-npm/core/server/index.ts +0 -8
- package/teste-final-npm/core/server/plugins/database.ts +0 -182
- package/teste-final-npm/core/server/plugins/logger.ts +0 -47
- package/teste-final-npm/core/server/plugins/swagger.ts +0 -34
- package/teste-final-npm/core/server/standalone.ts +0 -91
- package/teste-final-npm/core/templates/create-project.ts +0 -455
- package/teste-final-npm/core/types/api.ts +0 -169
- package/teste-final-npm/core/types/build.ts +0 -174
- package/teste-final-npm/core/types/config.ts +0 -68
- package/teste-final-npm/core/types/index.ts +0 -127
- package/teste-final-npm/core/types/plugin.ts +0 -94
- package/teste-final-npm/core/utils/__tests__/errors.test.ts +0 -139
- package/teste-final-npm/core/utils/__tests__/helpers.test.ts +0 -297
- package/teste-final-npm/core/utils/__tests__/logger.test.ts +0 -141
- package/teste-final-npm/core/utils/env-runtime-v2.ts +0 -232
- package/teste-final-npm/core/utils/env-runtime.ts +0 -252
- package/teste-final-npm/core/utils/errors/codes.ts +0 -115
- package/teste-final-npm/core/utils/errors/handlers.ts +0 -63
- package/teste-final-npm/core/utils/errors/index.ts +0 -81
- package/teste-final-npm/core/utils/helpers.ts +0 -180
- package/teste-final-npm/core/utils/index.ts +0 -18
- package/teste-final-npm/core/utils/logger/index.ts +0 -161
- package/teste-final-npm/core/utils/logger.ts +0 -106
- package/teste-final-npm/core/utils/monitoring/index.ts +0 -212
- package/teste-final-npm/package-template.json +0 -51
- package/teste-final-npm/package.json +0 -51
- package/teste-final-npm/tsconfig.json +0 -51
- package/teste-final-npm/vite.config.ts +0 -42
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin Discovery System
|
|
3
|
-
* Handles automatic discovery and loading of plugins from various sources
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { Plugin, PluginManifest, PluginLoadResult, PluginDiscoveryOptions } from "./types"
|
|
7
|
-
import type { Logger } from "../utils/logger/index"
|
|
8
|
-
import { readdir, readFile } from "fs/promises"
|
|
9
|
-
import { join, resolve } from "path"
|
|
10
|
-
import { existsSync } from "fs"
|
|
11
|
-
|
|
12
|
-
export interface PluginDiscoveryConfig {
|
|
13
|
-
logger?: Logger
|
|
14
|
-
baseDir?: string
|
|
15
|
-
builtInDir?: string
|
|
16
|
-
externalDir?: string
|
|
17
|
-
nodeModulesDir?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export class PluginDiscovery {
|
|
21
|
-
private logger?: Logger
|
|
22
|
-
private baseDir: string
|
|
23
|
-
private builtInDir: string
|
|
24
|
-
private externalDir: string
|
|
25
|
-
private nodeModulesDir: string
|
|
26
|
-
|
|
27
|
-
constructor(config: PluginDiscoveryConfig = {}) {
|
|
28
|
-
this.logger = config.logger
|
|
29
|
-
this.baseDir = config.baseDir || process.cwd()
|
|
30
|
-
this.builtInDir = config.builtInDir || join(this.baseDir, 'core/plugins/built-in')
|
|
31
|
-
this.externalDir = config.externalDir || join(this.baseDir, 'plugins')
|
|
32
|
-
this.nodeModulesDir = config.nodeModulesDir || join(this.baseDir, 'node_modules')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Discover all available plugins
|
|
37
|
-
*/
|
|
38
|
-
async discoverAll(options: PluginDiscoveryOptions = {}): Promise<PluginLoadResult[]> {
|
|
39
|
-
const results: PluginLoadResult[] = []
|
|
40
|
-
const {
|
|
41
|
-
includeBuiltIn = true,
|
|
42
|
-
includeExternal = true
|
|
43
|
-
} = options
|
|
44
|
-
|
|
45
|
-
// Discover built-in plugins
|
|
46
|
-
if (includeBuiltIn) {
|
|
47
|
-
const builtInResults = await this.discoverBuiltInPlugins()
|
|
48
|
-
results.push(...builtInResults)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Discover external plugins
|
|
52
|
-
if (includeExternal) {
|
|
53
|
-
const externalResults = await this.discoverExternalPlugins()
|
|
54
|
-
results.push(...externalResults)
|
|
55
|
-
|
|
56
|
-
const npmResults = await this.discoverNpmPlugins()
|
|
57
|
-
results.push(...npmResults)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return results
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Discover built-in plugins
|
|
65
|
-
*/
|
|
66
|
-
async discoverBuiltInPlugins(): Promise<PluginLoadResult[]> {
|
|
67
|
-
if (!existsSync(this.builtInDir)) {
|
|
68
|
-
this.logger?.debug('Built-in plugins directory not found', { dir: this.builtInDir })
|
|
69
|
-
return []
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return this.discoverPluginsInDirectory(this.builtInDir, 'built-in')
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Discover external plugins in the plugins directory
|
|
77
|
-
*/
|
|
78
|
-
async discoverExternalPlugins(): Promise<PluginLoadResult[]> {
|
|
79
|
-
if (!existsSync(this.externalDir)) {
|
|
80
|
-
this.logger?.debug('External plugins directory not found', { dir: this.externalDir })
|
|
81
|
-
return []
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return this.discoverPluginsInDirectory(this.externalDir, 'external')
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Discover npm-installed plugins
|
|
89
|
-
*/
|
|
90
|
-
async discoverNpmPlugins(): Promise<PluginLoadResult[]> {
|
|
91
|
-
if (!existsSync(this.nodeModulesDir)) {
|
|
92
|
-
this.logger?.debug('Node modules directory not found', { dir: this.nodeModulesDir })
|
|
93
|
-
return []
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const results: PluginLoadResult[] = []
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
const entries = await readdir(this.nodeModulesDir, { withFileTypes: true })
|
|
100
|
-
|
|
101
|
-
for (const entry of entries) {
|
|
102
|
-
if (entry.isDirectory() && entry.name.startsWith('fluxstack-plugin-')) {
|
|
103
|
-
const pluginDir = join(this.nodeModulesDir, entry.name)
|
|
104
|
-
const result = await this.loadPluginFromDirectory(pluginDir, 'npm')
|
|
105
|
-
results.push(result)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
} catch (error) {
|
|
109
|
-
this.logger?.error('Failed to discover npm plugins', { error })
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return results
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Load a specific plugin by name
|
|
117
|
-
*/
|
|
118
|
-
async loadPlugin(name: string): Promise<PluginLoadResult> {
|
|
119
|
-
// Try built-in first
|
|
120
|
-
const builtInPath = join(this.builtInDir, name)
|
|
121
|
-
if (existsSync(builtInPath)) {
|
|
122
|
-
return this.loadPluginFromDirectory(builtInPath, 'built-in')
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Try external plugins
|
|
126
|
-
const externalPath = join(this.externalDir, name)
|
|
127
|
-
if (existsSync(externalPath)) {
|
|
128
|
-
return this.loadPluginFromDirectory(externalPath, 'external')
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Try npm plugins
|
|
132
|
-
const npmPath = join(this.nodeModulesDir, `fluxstack-plugin-${name}`)
|
|
133
|
-
if (existsSync(npmPath)) {
|
|
134
|
-
return this.loadPluginFromDirectory(npmPath, 'npm')
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
success: false,
|
|
139
|
-
error: `Plugin '${name}' not found in any plugin directory`
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Discover plugins in a specific directory
|
|
145
|
-
*/
|
|
146
|
-
private async discoverPluginsInDirectory(
|
|
147
|
-
directory: string,
|
|
148
|
-
source: 'built-in' | 'external' | 'npm'
|
|
149
|
-
): Promise<PluginLoadResult[]> {
|
|
150
|
-
const results: PluginLoadResult[] = []
|
|
151
|
-
|
|
152
|
-
try {
|
|
153
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
154
|
-
|
|
155
|
-
for (const entry of entries) {
|
|
156
|
-
if (entry.isDirectory()) {
|
|
157
|
-
const pluginDir = join(directory, entry.name)
|
|
158
|
-
const result = await this.loadPluginFromDirectory(pluginDir, source)
|
|
159
|
-
results.push(result)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
} catch (error) {
|
|
163
|
-
this.logger?.error(`Failed to discover plugins in directory '${directory}'`, { error })
|
|
164
|
-
results.push({
|
|
165
|
-
success: false,
|
|
166
|
-
error: `Failed to scan directory: ${error instanceof Error ? error.message : String(error)}`
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return results
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Load a plugin from a specific directory
|
|
175
|
-
*/
|
|
176
|
-
private async loadPluginFromDirectory(
|
|
177
|
-
pluginDir: string,
|
|
178
|
-
source: 'built-in' | 'external' | 'npm'
|
|
179
|
-
): Promise<PluginLoadResult> {
|
|
180
|
-
try {
|
|
181
|
-
// Load manifest if it exists
|
|
182
|
-
const manifest = await this.loadPluginManifest(pluginDir)
|
|
183
|
-
|
|
184
|
-
// Find the main plugin file
|
|
185
|
-
const pluginFile = await this.findPluginFile(pluginDir)
|
|
186
|
-
if (!pluginFile) {
|
|
187
|
-
return {
|
|
188
|
-
success: false,
|
|
189
|
-
error: 'No plugin entry point found (index.ts, index.js, plugin.ts, or plugin.js)'
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Import the plugin
|
|
194
|
-
const pluginModule = await import(resolve(pluginFile))
|
|
195
|
-
const plugin: Plugin = pluginModule.default || pluginModule
|
|
196
|
-
|
|
197
|
-
if (!this.isValidPlugin(plugin)) {
|
|
198
|
-
return {
|
|
199
|
-
success: false,
|
|
200
|
-
error: 'Invalid plugin: must export a plugin object with a name property'
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Validate manifest compatibility
|
|
205
|
-
const warnings: string[] = []
|
|
206
|
-
if (manifest) {
|
|
207
|
-
const manifestWarnings = this.validateManifestCompatibility(plugin, manifest)
|
|
208
|
-
warnings.push(...manifestWarnings)
|
|
209
|
-
} else {
|
|
210
|
-
warnings.push('No plugin manifest found')
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
this.logger?.debug(`Loaded plugin '${plugin.name}' from ${source}`, {
|
|
214
|
-
plugin: plugin.name,
|
|
215
|
-
version: plugin.version,
|
|
216
|
-
source,
|
|
217
|
-
path: pluginDir
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
return {
|
|
221
|
-
success: true,
|
|
222
|
-
plugin,
|
|
223
|
-
warnings
|
|
224
|
-
}
|
|
225
|
-
} catch (error) {
|
|
226
|
-
this.logger?.error(`Failed to load plugin from '${pluginDir}'`, { error })
|
|
227
|
-
return {
|
|
228
|
-
success: false,
|
|
229
|
-
error: error instanceof Error ? error.message : String(error)
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Load plugin manifest from directory
|
|
236
|
-
*/
|
|
237
|
-
private async loadPluginManifest(pluginDir: string): Promise<PluginManifest | undefined> {
|
|
238
|
-
const manifestPath = join(pluginDir, 'plugin.json')
|
|
239
|
-
|
|
240
|
-
if (!existsSync(manifestPath)) {
|
|
241
|
-
// Try package.json for npm plugins
|
|
242
|
-
const packagePath = join(pluginDir, 'package.json')
|
|
243
|
-
if (existsSync(packagePath)) {
|
|
244
|
-
try {
|
|
245
|
-
const packageContent = await readFile(packagePath, 'utf-8')
|
|
246
|
-
const packageJson = JSON.parse(packageContent)
|
|
247
|
-
|
|
248
|
-
if (packageJson.fluxstack) {
|
|
249
|
-
return {
|
|
250
|
-
name: packageJson.name,
|
|
251
|
-
version: packageJson.version,
|
|
252
|
-
description: packageJson.description || '',
|
|
253
|
-
author: packageJson.author || '',
|
|
254
|
-
license: packageJson.license || '',
|
|
255
|
-
homepage: packageJson.homepage,
|
|
256
|
-
repository: packageJson.repository,
|
|
257
|
-
keywords: packageJson.keywords || [],
|
|
258
|
-
dependencies: packageJson.dependencies || {},
|
|
259
|
-
peerDependencies: packageJson.peerDependencies,
|
|
260
|
-
fluxstack: packageJson.fluxstack
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
} catch (error) {
|
|
264
|
-
this.logger?.warn(`Failed to parse package.json in '${pluginDir}'`, { error })
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return undefined
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
try {
|
|
271
|
-
const manifestContent = await readFile(manifestPath, 'utf-8')
|
|
272
|
-
return JSON.parse(manifestContent)
|
|
273
|
-
} catch (error) {
|
|
274
|
-
this.logger?.warn(`Failed to parse plugin manifest in '${pluginDir}'`, { error })
|
|
275
|
-
return undefined
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Find the main plugin file in a directory
|
|
281
|
-
*/
|
|
282
|
-
private async findPluginFile(pluginDir: string): Promise<string | null> {
|
|
283
|
-
const possibleFiles = [
|
|
284
|
-
'index.ts',
|
|
285
|
-
'index.js',
|
|
286
|
-
'plugin.ts',
|
|
287
|
-
'plugin.js',
|
|
288
|
-
'src/index.ts',
|
|
289
|
-
'src/index.js',
|
|
290
|
-
'dist/index.js'
|
|
291
|
-
]
|
|
292
|
-
|
|
293
|
-
for (const file of possibleFiles) {
|
|
294
|
-
const filePath = join(pluginDir, file)
|
|
295
|
-
if (existsSync(filePath)) {
|
|
296
|
-
return filePath
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return null
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Validate if an object is a valid plugin
|
|
305
|
-
*/
|
|
306
|
-
private isValidPlugin(plugin: any): plugin is Plugin {
|
|
307
|
-
return (
|
|
308
|
-
plugin &&
|
|
309
|
-
typeof plugin === 'object' &&
|
|
310
|
-
typeof plugin.name === 'string' &&
|
|
311
|
-
plugin.name.length > 0
|
|
312
|
-
)
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Validate manifest compatibility with plugin
|
|
317
|
-
*/
|
|
318
|
-
private validateManifestCompatibility(plugin: Plugin, manifest: PluginManifest): string[] {
|
|
319
|
-
const warnings: string[] = []
|
|
320
|
-
|
|
321
|
-
if (plugin.name !== manifest.name) {
|
|
322
|
-
warnings.push(`Plugin name mismatch: plugin exports '${plugin.name}' but manifest declares '${manifest.name}'`)
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (plugin.version && plugin.version !== manifest.version) {
|
|
326
|
-
warnings.push(`Plugin version mismatch: plugin exports '${plugin.version}' but manifest declares '${manifest.version}'`)
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if (plugin.dependencies && manifest.fluxstack.hooks) {
|
|
330
|
-
// Check if plugin implements the hooks declared in manifest
|
|
331
|
-
const declaredHooks = manifest.fluxstack.hooks
|
|
332
|
-
const implementedHooks = Object.keys(plugin).filter(key =>
|
|
333
|
-
key.startsWith('on') || key === 'setup'
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
for (const hook of declaredHooks) {
|
|
337
|
-
if (!implementedHooks.includes(hook)) {
|
|
338
|
-
warnings.push(`Plugin declares hook '${hook}' in manifest but doesn't implement it`)
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return warnings
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Default plugin discovery instance
|
|
349
|
-
*/
|
|
350
|
-
export const pluginDiscovery = new PluginDiscovery()
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plugin Executor
|
|
3
|
-
* Handles plugin execution with priority and dependency resolution
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
Plugin,
|
|
8
|
-
PluginHook,
|
|
9
|
-
PluginHookResult,
|
|
10
|
-
PluginPriority,
|
|
11
|
-
HookExecutionOptions
|
|
12
|
-
} from "./types"
|
|
13
|
-
import type { Logger } from "../utils/logger/index"
|
|
14
|
-
import { FluxStackError } from "../utils/errors"
|
|
15
|
-
|
|
16
|
-
export interface PluginExecutionPlan {
|
|
17
|
-
hook: PluginHook
|
|
18
|
-
plugins: PluginExecutionStep[]
|
|
19
|
-
parallel: boolean
|
|
20
|
-
totalPlugins: number
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface PluginExecutionStep {
|
|
24
|
-
plugin: Plugin
|
|
25
|
-
priority: number
|
|
26
|
-
dependencies: string[]
|
|
27
|
-
dependents: string[]
|
|
28
|
-
canExecuteInParallel: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export class PluginExecutor {
|
|
32
|
-
private logger: Logger
|
|
33
|
-
|
|
34
|
-
constructor(logger: Logger) {
|
|
35
|
-
this.logger = logger
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Create execution plan for a hook
|
|
40
|
-
*/
|
|
41
|
-
createExecutionPlan(
|
|
42
|
-
plugins: Plugin[],
|
|
43
|
-
hook: PluginHook,
|
|
44
|
-
options: HookExecutionOptions = {}
|
|
45
|
-
): PluginExecutionPlan {
|
|
46
|
-
const { parallel = false } = options
|
|
47
|
-
|
|
48
|
-
// Filter plugins that implement this hook
|
|
49
|
-
const applicablePlugins = plugins.filter(plugin => {
|
|
50
|
-
const hookFunction = plugin[hook]
|
|
51
|
-
return hookFunction && typeof hookFunction === 'function'
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
// Create execution steps
|
|
55
|
-
const steps = applicablePlugins.map(plugin => this.createExecutionStep(plugin, plugins))
|
|
56
|
-
|
|
57
|
-
// Sort by priority and dependencies
|
|
58
|
-
const sortedSteps = this.sortExecutionSteps(steps, hook)
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
hook,
|
|
62
|
-
plugins: sortedSteps,
|
|
63
|
-
parallel,
|
|
64
|
-
totalPlugins: applicablePlugins.length
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Execute plugins according to plan
|
|
70
|
-
*/
|
|
71
|
-
async executePlan(
|
|
72
|
-
plan: PluginExecutionPlan,
|
|
73
|
-
context: any,
|
|
74
|
-
executor: (plugin: Plugin, hook: PluginHook, context: any) => Promise<PluginHookResult>
|
|
75
|
-
): Promise<PluginHookResult[]> {
|
|
76
|
-
const results: PluginHookResult[] = []
|
|
77
|
-
|
|
78
|
-
this.logger.debug(`Executing plan for hook '${plan.hook}'`, {
|
|
79
|
-
hook: plan.hook,
|
|
80
|
-
totalPlugins: plan.totalPlugins,
|
|
81
|
-
parallel: plan.parallel
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
if (plan.parallel) {
|
|
85
|
-
// Execute in parallel groups based on dependencies
|
|
86
|
-
const groups = this.createParallelGroups(plan.plugins)
|
|
87
|
-
|
|
88
|
-
for (const group of groups) {
|
|
89
|
-
const groupPromises = group.map(step =>
|
|
90
|
-
executor(step.plugin, plan.hook, context)
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
const groupResults = await Promise.allSettled(groupPromises)
|
|
94
|
-
|
|
95
|
-
for (let i = 0; i < groupResults.length; i++) {
|
|
96
|
-
const result = groupResults[i]
|
|
97
|
-
if (result.status === 'fulfilled') {
|
|
98
|
-
results.push(result.value)
|
|
99
|
-
} else {
|
|
100
|
-
results.push({
|
|
101
|
-
success: false,
|
|
102
|
-
error: result.reason,
|
|
103
|
-
duration: 0,
|
|
104
|
-
plugin: group[i].plugin.name,
|
|
105
|
-
hook: plan.hook
|
|
106
|
-
})
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
} else {
|
|
111
|
-
// Execute sequentially
|
|
112
|
-
for (const step of plan.plugins) {
|
|
113
|
-
const result = await executor(step.plugin, plan.hook, context)
|
|
114
|
-
results.push(result)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return results
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Validate execution plan
|
|
123
|
-
*/
|
|
124
|
-
validateExecutionPlan(plan: PluginExecutionPlan): { valid: boolean; errors: string[] } {
|
|
125
|
-
const errors: string[] = []
|
|
126
|
-
|
|
127
|
-
// Check for circular dependencies
|
|
128
|
-
const visited = new Set<string>()
|
|
129
|
-
const visiting = new Set<string>()
|
|
130
|
-
|
|
131
|
-
const checkCircular = (step: PluginExecutionStep) => {
|
|
132
|
-
if (visiting.has(step.plugin.name)) {
|
|
133
|
-
errors.push(`Circular dependency detected involving plugin '${step.plugin.name}'`)
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (visited.has(step.plugin.name)) {
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
visiting.add(step.plugin.name)
|
|
142
|
-
|
|
143
|
-
for (const depName of step.dependencies) {
|
|
144
|
-
const depStep = plan.plugins.find(s => s.plugin.name === depName)
|
|
145
|
-
if (depStep) {
|
|
146
|
-
checkCircular(depStep)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
visiting.delete(step.plugin.name)
|
|
151
|
-
visited.add(step.plugin.name)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
for (const step of plan.plugins) {
|
|
155
|
-
checkCircular(step)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// Check for missing dependencies
|
|
159
|
-
for (const step of plan.plugins) {
|
|
160
|
-
for (const depName of step.dependencies) {
|
|
161
|
-
const depExists = plan.plugins.some(s => s.plugin.name === depName)
|
|
162
|
-
if (!depExists) {
|
|
163
|
-
errors.push(`Plugin '${step.plugin.name}' depends on '${depName}' which is not available`)
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
valid: errors.length === 0,
|
|
170
|
-
errors
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Create execution step for a plugin
|
|
176
|
-
*/
|
|
177
|
-
private createExecutionStep(plugin: Plugin, allPlugins: Plugin[]): PluginExecutionStep {
|
|
178
|
-
const priority = this.normalizePriority(plugin.priority)
|
|
179
|
-
const dependencies = plugin.dependencies || []
|
|
180
|
-
|
|
181
|
-
// Find dependents
|
|
182
|
-
const dependents = allPlugins
|
|
183
|
-
.filter(p => p.dependencies?.includes(plugin.name))
|
|
184
|
-
.map(p => p.name)
|
|
185
|
-
|
|
186
|
-
// Determine if can execute in parallel
|
|
187
|
-
const canExecuteInParallel = dependencies.length === 0
|
|
188
|
-
|
|
189
|
-
return {
|
|
190
|
-
plugin,
|
|
191
|
-
priority,
|
|
192
|
-
dependencies,
|
|
193
|
-
dependents,
|
|
194
|
-
canExecuteInParallel
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Sort execution steps by priority and dependencies
|
|
200
|
-
*/
|
|
201
|
-
private sortExecutionSteps(steps: PluginExecutionStep[], hook: PluginHook): PluginExecutionStep[] {
|
|
202
|
-
// Topological sort with priority consideration
|
|
203
|
-
const sorted: PluginExecutionStep[] = []
|
|
204
|
-
const visited = new Set<string>()
|
|
205
|
-
const visiting = new Set<string>()
|
|
206
|
-
|
|
207
|
-
const visit = (step: PluginExecutionStep) => {
|
|
208
|
-
if (visiting.has(step.plugin.name)) {
|
|
209
|
-
throw new FluxStackError(
|
|
210
|
-
`Circular dependency detected involving plugin '${step.plugin.name}' for hook '${hook}'`,
|
|
211
|
-
'CIRCULAR_DEPENDENCY',
|
|
212
|
-
400
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (visited.has(step.plugin.name)) {
|
|
217
|
-
return
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
visiting.add(step.plugin.name)
|
|
221
|
-
|
|
222
|
-
// Visit dependencies first
|
|
223
|
-
for (const depName of step.dependencies) {
|
|
224
|
-
const depStep = steps.find(s => s.plugin.name === depName)
|
|
225
|
-
if (depStep) {
|
|
226
|
-
visit(depStep)
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
visiting.delete(step.plugin.name)
|
|
231
|
-
visited.add(step.plugin.name)
|
|
232
|
-
sorted.push(step)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Sort by priority first, then visit
|
|
236
|
-
const prioritySorted = [...steps].sort((a, b) => b.priority - a.priority)
|
|
237
|
-
|
|
238
|
-
for (const step of prioritySorted) {
|
|
239
|
-
visit(step)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return sorted
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Create parallel execution groups
|
|
247
|
-
*/
|
|
248
|
-
private createParallelGroups(steps: PluginExecutionStep[]): PluginExecutionStep[][] {
|
|
249
|
-
const groups: PluginExecutionStep[][] = []
|
|
250
|
-
const processed = new Set<string>()
|
|
251
|
-
|
|
252
|
-
while (processed.size < steps.length) {
|
|
253
|
-
const currentGroup: PluginExecutionStep[] = []
|
|
254
|
-
|
|
255
|
-
for (const step of steps) {
|
|
256
|
-
if (processed.has(step.plugin.name)) {
|
|
257
|
-
continue
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Check if all dependencies are already processed
|
|
261
|
-
const canExecute = step.dependencies.every(dep => processed.has(dep))
|
|
262
|
-
|
|
263
|
-
if (canExecute) {
|
|
264
|
-
currentGroup.push(step)
|
|
265
|
-
processed.add(step.plugin.name)
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (currentGroup.length === 0) {
|
|
270
|
-
// This shouldn't happen if dependencies are valid
|
|
271
|
-
const remaining = steps.filter(s => !processed.has(s.plugin.name))
|
|
272
|
-
throw new FluxStackError(
|
|
273
|
-
`Unable to resolve dependencies for plugins: ${remaining.map(s => s.plugin.name).join(', ')}`,
|
|
274
|
-
'DEPENDENCY_RESOLUTION_ERROR',
|
|
275
|
-
400
|
|
276
|
-
)
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Sort group by priority
|
|
280
|
-
currentGroup.sort((a, b) => b.priority - a.priority)
|
|
281
|
-
groups.push(currentGroup)
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return groups
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Normalize plugin priority to numeric value
|
|
289
|
-
*/
|
|
290
|
-
private normalizePriority(priority?: number | PluginPriority): number {
|
|
291
|
-
if (typeof priority === 'number') {
|
|
292
|
-
return priority
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
switch (priority) {
|
|
296
|
-
case 'highest': return 1000
|
|
297
|
-
case 'high': return 750
|
|
298
|
-
case 'normal': return 500
|
|
299
|
-
case 'low': return 250
|
|
300
|
-
case 'lowest': return 0
|
|
301
|
-
default: return 500 // default to normal
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Plugin execution statistics
|
|
308
|
-
*/
|
|
309
|
-
export interface PluginExecutionStats {
|
|
310
|
-
totalPlugins: number
|
|
311
|
-
successfulPlugins: number
|
|
312
|
-
failedPlugins: number
|
|
313
|
-
totalDuration: number
|
|
314
|
-
averageDuration: number
|
|
315
|
-
slowestPlugin: { name: string; duration: number } | null
|
|
316
|
-
fastestPlugin: { name: string; duration: number } | null
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Calculate execution statistics
|
|
321
|
-
*/
|
|
322
|
-
export function calculateExecutionStats(results: PluginHookResult[]): PluginExecutionStats {
|
|
323
|
-
const totalPlugins = results.length
|
|
324
|
-
const successfulPlugins = results.filter(r => r.success).length
|
|
325
|
-
const failedPlugins = totalPlugins - successfulPlugins
|
|
326
|
-
const totalDuration = results.reduce((sum, r) => sum + r.duration, 0)
|
|
327
|
-
const averageDuration = totalPlugins > 0 ? totalDuration / totalPlugins : 0
|
|
328
|
-
|
|
329
|
-
let slowestPlugin: { name: string; duration: number } | null = null
|
|
330
|
-
let fastestPlugin: { name: string; duration: number } | null = null
|
|
331
|
-
|
|
332
|
-
for (const result of results) {
|
|
333
|
-
if (!slowestPlugin || result.duration > slowestPlugin.duration) {
|
|
334
|
-
slowestPlugin = { name: result.plugin, duration: result.duration }
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (!fastestPlugin || result.duration < fastestPlugin.duration) {
|
|
338
|
-
fastestPlugin = { name: result.plugin, duration: result.duration }
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return {
|
|
343
|
-
totalPlugins,
|
|
344
|
-
successfulPlugins,
|
|
345
|
-
failedPlugins,
|
|
346
|
-
totalDuration,
|
|
347
|
-
averageDuration,
|
|
348
|
-
slowestPlugin,
|
|
349
|
-
fastestPlugin
|
|
350
|
-
}
|
|
351
|
-
}
|