@next-vibe/checker 1.0.11 → 1.0.13
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/.dist/bin/vibe-runtime.js +26 -22
- package/.dist/bin/vibe-runtime.js.map +5 -5
- package/.dist/oxlint-plugins/i18n.js +4 -0
- package/.dist/oxlint-plugins/i18n.js.map +1 -0
- package/.dist/oxlint-plugins/jsx-capitalization.js +4 -0
- package/.dist/oxlint-plugins/jsx-capitalization.js.map +1 -0
- package/.dist/oxlint-plugins/restricted-syntax.js +4 -0
- package/.dist/oxlint-plugins/restricted-syntax.js.map +1 -0
- package/check.config.ts +4 -12
- package/package.json +2 -9
- package/src/app/api/[locale]/LICENSE +674 -0
- package/src/app/api/[locale]/i18n/de/index.ts +13 -0
- package/src/app/api/[locale]/i18n/en/index.ts +12 -0
- package/src/app/api/[locale]/i18n/pl/index.ts +11 -0
- package/src/app/api/[locale]/shared/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/shared/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/shared/i18n/pl/index.ts +85 -0
- package/src/app/api/[locale]/shared/stats-filtering.ts +202 -0
- package/src/app/api/[locale]/shared/types/common.schema.ts +55 -0
- package/src/app/api/[locale]/shared/types/response.schema.ts +372 -0
- package/src/app/api/[locale]/shared/types/stats-filtering.schema.ts +375 -0
- package/src/app/api/[locale]/shared/types/utils.ts +190 -0
- package/src/app/api/[locale]/shared/utils/base64.ts +49 -0
- package/src/app/api/[locale]/shared/utils/env-util.ts +40 -0
- package/src/app/api/[locale]/shared/utils/i18n/de/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/shared/utils/i18n/pl/index.ts +21 -0
- package/src/app/api/[locale]/shared/utils/index.ts +11 -0
- package/src/app/api/[locale]/shared/utils/object-path.ts +41 -0
- package/src/app/api/[locale]/shared/utils/object.test.ts +82 -0
- package/src/app/api/[locale]/shared/utils/object.ts +75 -0
- package/src/app/api/[locale]/shared/utils/parse-error.ts +134 -0
- package/src/app/api/[locale]/shared/utils/parse-json.ts +70 -0
- package/src/app/api/[locale]/shared/utils/time.ts +53 -0
- package/src/app/api/[locale]/shared/utils/validation.ts +127 -0
- package/src/app/api/[locale]/shared/utils/zod-required-fields.ts +116 -0
- package/src/app/api/[locale]/system/builder/definition.ts +1942 -0
- package/src/app/api/[locale]/system/builder/enum.ts +78 -0
- package/src/app/api/[locale]/system/builder/i18n/de/index.ts +677 -0
- package/src/app/api/[locale]/system/builder/i18n/en/index.ts +665 -0
- package/src/app/api/[locale]/system/builder/i18n/pl/index.ts +668 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.test.ts +182 -0
- package/src/app/api/[locale]/system/builder/repository/build-executor.ts +583 -0
- package/src/app/api/[locale]/system/builder/repository/bun-compiler.ts +261 -0
- package/src/app/api/[locale]/system/builder/repository/bundle-analyzer.ts +197 -0
- package/src/app/api/[locale]/system/builder/repository/config-loader.ts +159 -0
- package/src/app/api/[locale]/system/builder/repository/config-validator.ts +97 -0
- package/src/app/api/[locale]/system/builder/repository/constants.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/error-suggester.ts +75 -0
- package/src/app/api/[locale]/system/builder/repository/file-copier.ts +98 -0
- package/src/app/api/[locale]/system/builder/repository/folder-cleaner.ts +80 -0
- package/src/app/api/[locale]/system/builder/repository/index.ts +2 -0
- package/src/app/api/[locale]/system/builder/repository/npm-package-generator.ts +146 -0
- package/src/app/api/[locale]/system/builder/repository/output-formatter.ts +104 -0
- package/src/app/api/[locale]/system/builder/repository/profile-service.ts +79 -0
- package/src/app/api/[locale]/system/builder/repository/report-generator.ts +125 -0
- package/src/app/api/[locale]/system/builder/repository/vite-compiler.ts +291 -0
- package/src/app/api/[locale]/system/builder/route.ts +21 -0
- package/src/app/api/[locale]/system/builder/test-files/file1.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/file2.tsx +10 -0
- package/src/app/api/[locale]/system/builder/test-files/file3.tsx +16 -0
- package/src/app/api/[locale]/system/builder/test-files/folderToCopy/fileInFolder.ts +2 -0
- package/src/app/api/[locale]/system/builder/test-files/test-config.ts +38 -0
- package/src/app/api/[locale]/system/builder/test-files/test-delete-config.ts +8 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/package.json +24 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/index.ts +7 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.json +19 -0
- package/src/app/api/[locale]/system/builder/test-files/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/builder/test-files/test3.css +1 -0
- package/src/app/api/[locale]/system/check/config/repository.ts +886 -0
- package/src/app/api/[locale]/system/check/config/shared.ts +396 -0
- package/src/app/api/[locale]/system/check/config/types.ts +616 -0
- package/src/app/api/[locale]/system/check/config/utils.ts +171 -0
- package/src/app/api/[locale]/system/check/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/check/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/check/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/check/lint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/lint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/lint/i18n/de/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/i18n/en/index.ts +162 -0
- package/src/app/api/[locale]/system/check/lint/i18n/pl/index.ts +164 -0
- package/src/app/api/[locale]/system/check/lint/repository.ts +753 -0
- package/src/app/api/[locale]/system/check/lint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/README.md +190 -0
- package/src/app/api/[locale]/system/check/oxlint/definition.ts +414 -0
- package/src/app/api/[locale]/system/check/oxlint/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/de/index.ts +171 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/en/index.ts +168 -0
- package/src/app/api/[locale]/system/check/oxlint/i18n/pl/index.ts +172 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/i18n/src/index.ts +372 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/README.md +246 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/jsx-capitalization/src/index.ts +583 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/src/index.ts +500 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/restricted-syntax/test.tsx +74 -0
- package/src/app/api/[locale]/system/check/oxlint/plugins/shared/config-loader.ts +305 -0
- package/src/app/api/[locale]/system/check/oxlint/repository.ts +959 -0
- package/src/app/api/[locale]/system/check/oxlint/route.ts +21 -0
- package/src/app/api/[locale]/system/check/oxlint/types.ts +193 -0
- package/src/app/api/[locale]/system/check/test-project/bun.lock +532 -0
- package/src/app/api/[locale]/system/check/test-project/check.config.ts +981 -0
- package/src/app/api/[locale]/system/check/test-project/package.json +12 -0
- package/src/app/api/[locale]/system/check/test-project/src/constants.ts +6 -0
- package/src/app/api/[locale]/system/check/test-project/src/greet.ts +18 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/a11y-issues.tsx +107 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/eslint-issues.tsx +37 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/general-issues.ts +137 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/i18n-issues.tsx +129 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/jsx-capitalization-issues.tsx +131 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/nextjs-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/promise-issues.ts +76 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/react-issues.tsx +95 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/restricted-syntax-issues.tsx +61 -0
- package/src/app/api/[locale]/system/check/test-project/src/test-issues/typescript-issues.ts +80 -0
- package/src/app/api/[locale]/system/check/test-project/src/utils/calculate.ts +27 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.json +34 -0
- package/src/app/api/[locale]/system/check/test-project/tsconfig.tsbuildinfo +1 -0
- package/src/app/api/[locale]/system/check/typecheck/definition.ts +369 -0
- package/src/app/api/[locale]/system/check/typecheck/enum.ts +37 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/de/index.ts +159 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/en/index.ts +150 -0
- package/src/app/api/[locale]/system/check/typecheck/i18n/pl/index.ts +155 -0
- package/src/app/api/[locale]/system/check/typecheck/repository.ts +919 -0
- package/src/app/api/[locale]/system/check/typecheck/route.ts +22 -0
- package/src/app/api/[locale]/system/check/typecheck/utils.ts +168 -0
- package/src/app/api/[locale]/system/check/vibe-check/definition.ts +568 -0
- package/src/app/api/[locale]/system/check/vibe-check/enum.ts +69 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/de/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/en/index.ts +189 -0
- package/src/app/api/[locale]/system/check/vibe-check/i18n/pl/index.ts +192 -0
- package/src/app/api/[locale]/system/check/vibe-check/repository.ts +545 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.test.ts +1142 -0
- package/src/app/api/[locale]/system/check/vibe-check/route.ts +21 -0
- package/src/app/api/[locale]/system/generated/endpoint.ts +313 -0
- package/src/app/api/[locale]/system/generated/endpoints.ts +156 -0
- package/src/app/api/[locale]/system/generated/route-handlers.ts +224 -0
- package/src/app/api/[locale]/system/generators/endpoint/definition.ts +193 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/endpoint/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/endpoint/repository.ts +291 -0
- package/src/app/api/[locale]/system/generators/endpoint/route.ts +21 -0
- package/src/app/api/[locale]/system/generators/endpoints/definition.ts +246 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/generators/endpoints/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/generators/endpoints/options-repository.ts +463 -0
- package/src/app/api/[locale]/system/generators/endpoints/repository.ts +383 -0
- package/src/app/api/[locale]/system/generators/endpoints/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/definition.ts +194 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/de/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/en/index.ts +69 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/i18n/pl/index.ts +71 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/repository.ts +294 -0
- package/src/app/api/[locale]/system/generators/endpoints-index/route.ts +18 -0
- package/src/app/api/[locale]/system/generators/generate-all/definition.ts +355 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/de/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/en/index.ts +94 -0
- package/src/app/api/[locale]/system/generators/generate-all/i18n/pl/index.ts +96 -0
- package/src/app/api/[locale]/system/generators/generate-all/repository.ts +257 -0
- package/src/app/api/[locale]/system/generators/generate-all/route.ts +20 -0
- package/src/app/api/[locale]/system/generators/i18n/de/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/i18n/en/index.ts +14 -0
- package/src/app/api/[locale]/system/generators/i18n/pl/index.ts +15 -0
- package/src/app/api/[locale]/system/generators/route-handlers/definition.ts +198 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/de/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/en/index.ts +48 -0
- package/src/app/api/[locale]/system/generators/route-handlers/i18n/pl/index.ts +50 -0
- package/src/app/api/[locale]/system/generators/route-handlers/repository.ts +277 -0
- package/src/app/api/[locale]/system/generators/route-handlers/route.ts +17 -0
- package/src/app/api/[locale]/system/generators/shared/utils.ts +233 -0
- package/src/app/api/[locale]/system/help/definition.ts +445 -0
- package/src/app/api/[locale]/system/help/i18n/de/index.ts +267 -0
- package/src/app/api/[locale]/system/help/i18n/en/index.ts +262 -0
- package/src/app/api/[locale]/system/help/i18n/pl/index.ts +265 -0
- package/src/app/api/[locale]/system/help/interactive/definition.ts +125 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/de/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/en/index.ts +19 -0
- package/src/app/api/[locale]/system/help/interactive/i18n/pl/index.ts +22 -0
- package/src/app/api/[locale]/system/help/interactive/repository.ts +1025 -0
- package/src/app/api/[locale]/system/help/interactive/route.ts +53 -0
- package/src/app/api/[locale]/system/help/list/definition.ts +372 -0
- package/src/app/api/[locale]/system/help/list/repository.ts +110 -0
- package/src/app/api/[locale]/system/help/list/route.ts +21 -0
- package/src/app/api/[locale]/system/help/repository.ts +212 -0
- package/src/app/api/[locale]/system/help/route.ts +16 -0
- package/src/app/api/[locale]/system/i18n/de/index.ts +68 -0
- package/src/app/api/[locale]/system/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/i18n/pl/index.ts +66 -0
- package/src/app/api/[locale]/system/release-tool/definition.ts +3104 -0
- package/src/app/api/[locale]/system/release-tool/i18n/de/index.ts +813 -0
- package/src/app/api/[locale]/system/release-tool/i18n/en/index.ts +797 -0
- package/src/app/api/[locale]/system/release-tool/i18n/pl/index.ts +810 -0
- package/src/app/api/[locale]/system/release-tool/repository/asset-zipper.ts +128 -0
- package/src/app/api/[locale]/system/release-tool/repository/changelog-generator.ts +212 -0
- package/src/app/api/[locale]/system/release-tool/repository/ci-detector.ts +566 -0
- package/src/app/api/[locale]/system/release-tool/repository/config.ts +113 -0
- package/src/app/api/[locale]/system/release-tool/repository/constants.ts +407 -0
- package/src/app/api/[locale]/system/release-tool/repository/dependency-manager.ts +527 -0
- package/src/app/api/[locale]/system/release-tool/repository/git-service.ts +403 -0
- package/src/app/api/[locale]/system/release-tool/repository/hook-runner.ts +100 -0
- package/src/app/api/[locale]/system/release-tool/repository/index.ts +1 -0
- package/src/app/api/[locale]/system/release-tool/repository/notification-service.ts +638 -0
- package/src/app/api/[locale]/system/release-tool/repository/package-service.ts +169 -0
- package/src/app/api/[locale]/system/release-tool/repository/publisher.ts +253 -0
- package/src/app/api/[locale]/system/release-tool/repository/quality-runner.ts +428 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-creator.ts +293 -0
- package/src/app/api/[locale]/system/release-tool/repository/release-executor.ts +1198 -0
- package/src/app/api/[locale]/system/release-tool/repository/snyk-service.ts +136 -0
- package/src/app/api/[locale]/system/release-tool/repository/utils.ts +642 -0
- package/src/app/api/[locale]/system/release-tool/repository/validation.ts +288 -0
- package/src/app/api/[locale]/system/release-tool/repository/version-service.ts +297 -0
- package/src/app/api/[locale]/system/release-tool/route.ts +21 -0
- package/src/app/api/[locale]/system/unified-interface/README.md +328 -0
- package/src/app/api/[locale]/system/unified-interface/cli/README.md +349 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-handler.ts +95 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/cli-user.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/cli/auth/session-file.ts +266 -0
- package/src/app/api/[locale]/system/unified-interface/cli/env.ts +26 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/de/index.ts +157 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/en/index.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/i18n/pl/index.ts +158 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/debug.ts +595 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/entry-point.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/environment.ts +155 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/execution-errors.ts +452 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/parsing.ts +297 -0
- package/src/app/api/[locale]/system/unified-interface/cli/runtime/route-executor.ts +859 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/de/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/en/index.ts +11 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/i18n/pl/index.ts +12 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/definition.ts +262 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/repository.ts +421 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/install/route.ts +25 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/definition.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/de/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/en/index.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/i18n/pl/index.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/repository.ts +195 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/status/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/definition.ts +188 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/repository.ts +209 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/uninstall/route.ts +24 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/definition.ts +200 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/de/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/en/index.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/i18n/pl/index.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/repository.ts +113 -0
- package/src/app/api/[locale]/system/unified-interface/cli/setup/update/route.ts +22 -0
- package/src/app/api/[locale]/system/unified-interface/cli/vibe-runtime.ts +304 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/base-renderer.ts +270 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/registry.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/core/types.ts +126 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/de/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/en/index.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/i18n/pl/index.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/accordion.ts +74 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/avatar.ts +39 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/badge.ts +54 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-output.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-files.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-list.ts +298 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/code-quality-summary.ts +96 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/container.ts +186 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-card.ts +65 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-cards.ts +570 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-list.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/data-table.ts +385 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/editable-text.ts +99 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/empty-state.ts +55 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/errors.ts +67 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/grouped-list.ts +729 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-card.ts +87 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link-list.ts +112 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/link.ts +59 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/loading.ts +50 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/markdown.ts +131 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/metric.ts +291 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/section.ts +120 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/stats-grid.ts +149 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/tabs.ts +61 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/text.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/implementations/title.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/response-renderer.ts +418 -0
- package/src/app/api/[locale]/system/unified-interface/cli/widgets/renderers/schema-handler.ts +534 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/de/index.ts +42 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/en/index.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/i18n/pl/index.ts +43 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/README.md +114 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/converter.ts +146 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/de/index.ts +182 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/en/index.ts +179 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/i18n/pl/index.ts +181 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/registry.ts +343 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/definition.ts +147 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/repository.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/serve/route.ts +14 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/protocol-handler.ts +309 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/server.ts +154 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/server/stdio-transport.ts +193 -0
- package/src/app/api/[locale]/system/unified-interface/mcp/types.ts +246 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create-form.ts +1510 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/create.ts +581 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/endpoint-to-metadata.ts +52 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definition/loader.ts +152 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/definitions/registry.ts +265 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/permissions/registry.ts +680 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/executor.ts +220 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/handler.ts +325 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/multi.ts +184 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/request-validator.ts +201 -0
- package/src/app/api/[locale]/system/unified-interface/shared/endpoints/route/single.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env-client.ts +49 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/define-env.ts +47 -0
- package/src/app/api/[locale]/system/unified-interface/shared/env/validation-logger.ts +58 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/enum.ts +110 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/specialized.ts +339 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.test.ts +408 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field/utils.ts +1349 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/endpoint-field-types.ts +107 -0
- package/src/app/api/[locale]/system/unified-interface/shared/field-config/field-config-types.ts +268 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/colors.ts +114 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/endpoint.ts +169 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/file-logger.ts +88 -0
- package/src/app/api/[locale]/system/unified-interface/shared/logger/formatters.ts +177 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/base-auth-handler.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/auth/factory.ts +33 -0
- package/src/app/api/[locale]/system/unified-interface/shared/server-only/server-only.ts +4 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/actions.ts +289 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/endpoint.ts +1167 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/enums.ts +382 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/platform.ts +34 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/types.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/types/ui-config.ts +76 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/error-types.ts +27 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/path.ts +63 -0
- package/src/app/api/[locale]/system/unified-interface/shared/utils/scanner.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/actions.ts +256 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/configs.ts +1158 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/helpers.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/accordion.ts +82 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/avatar.ts +75 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/badge.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-output.ts +302 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/code-quality-list.ts +202 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/container.ts +129 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-card.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-cards.ts +258 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-list.ts +123 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/data-table.ts +387 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/editable-text.ts +89 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/empty-state.ts +78 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/errors.ts +93 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/grouped-list.ts +448 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/index.ts +38 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-card.ts +130 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link-list.ts +127 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/link.ts +68 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/loading.ts +81 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/markdown.ts +176 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/metric-card.ts +241 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/section.ts +90 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/stats-grid.ts +71 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/tabs.ts +80 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/text.ts +105 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/logic/title.ts +72 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/types.ts +240 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/field-helpers.ts +137 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/formatting.ts +437 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/url.ts +40 -0
- package/src/app/api/[locale]/system/unified-interface/shared/widgets/utils/widget-helpers.ts +465 -0
- package/src/app/api/[locale]/user/auth/enum.ts +16 -0
- package/src/app/api/[locale]/user/auth/i18n/de/index.ts +227 -0
- package/src/app/api/[locale]/user/auth/i18n/en/index.ts +205 -0
- package/src/app/api/[locale]/user/auth/i18n/pl/index.ts +219 -0
- package/src/app/api/[locale]/user/auth/types.ts +110 -0
- package/src/app/api/[locale]/user/enum.ts +64 -0
- package/src/app/api/[locale]/user/private/i18n/de/index.ts +3 -0
- package/src/app/api/[locale]/user/private/i18n/en/index.ts +1 -0
- package/src/app/api/[locale]/user/private/i18n/pl/index.ts +3 -0
- package/src/app/api/[locale]/user/types.ts +118 -0
- package/src/app/api/[locale]/user/user-roles/enum.ts +112 -0
- package/src/app/api/[locale]/user/user-roles/i18n/de/index.ts +85 -0
- package/src/app/api/[locale]/user/user-roles/i18n/en/index.ts +83 -0
- package/src/app/api/[locale]/user/user-roles/i18n/pl/index.ts +86 -0
- package/src/app/api/[locale]/user/user-roles/types.ts +34 -0
- package/src/app/api/i18n/de/index.ts +6 -0
- package/src/app/api/i18n/en/index.ts +5 -0
- package/src/app/api/i18n/pl/index.ts +5 -0
- package/src/app/i18n/de/index.ts +6 -0
- package/src/app/i18n/en/index.ts +5 -0
- package/src/app/i18n/pl/index.ts +5 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun Compiler Service
|
|
3
|
+
* Compiles executable files using Bun.build
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/// <reference types="bun-types" />
|
|
7
|
+
|
|
8
|
+
import { existsSync, mkdirSync, statSync } from "node:fs";
|
|
9
|
+
import { basename, dirname, resolve } from "node:path";
|
|
10
|
+
|
|
11
|
+
import type { ResponseType } from "next-vibe/shared/types/response.schema";
|
|
12
|
+
import {
|
|
13
|
+
ErrorResponseTypes,
|
|
14
|
+
fail,
|
|
15
|
+
success,
|
|
16
|
+
} from "next-vibe/shared/types/response.schema";
|
|
17
|
+
|
|
18
|
+
import type { EndpointLogger } from "@/app/api/[locale]/system/unified-interface/shared/logger/endpoint";
|
|
19
|
+
import type { TFunction } from "@/i18n/core/static-types";
|
|
20
|
+
|
|
21
|
+
import type { BuildProfile, FileToCompile } from "../definition";
|
|
22
|
+
import { PROFILE_DEFAULTS, ROOT_DIR, SIZE_THRESHOLDS } from "./constants";
|
|
23
|
+
import { outputFormatter } from "./output-formatter";
|
|
24
|
+
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Default Externals
|
|
27
|
+
// ============================================================================
|
|
28
|
+
|
|
29
|
+
/** Default modules to externalize for executable builds */
|
|
30
|
+
const DEFAULT_EXTERNALS = [
|
|
31
|
+
// React/Next.js - peer dependencies
|
|
32
|
+
"react",
|
|
33
|
+
"react-dom",
|
|
34
|
+
"next",
|
|
35
|
+
// React Native / Expo
|
|
36
|
+
"expo",
|
|
37
|
+
"react-native",
|
|
38
|
+
// Build tools with native binaries or side effects
|
|
39
|
+
"vite",
|
|
40
|
+
"@vitejs/plugin-react",
|
|
41
|
+
"vite-plugin-css-injected-by-js",
|
|
42
|
+
"vite-plugin-dts",
|
|
43
|
+
"@tailwindcss/vite",
|
|
44
|
+
"@tailwindcss/oxide",
|
|
45
|
+
"tailwindcss",
|
|
46
|
+
"rollup",
|
|
47
|
+
"esbuild",
|
|
48
|
+
"lightningcss",
|
|
49
|
+
] as const;
|
|
50
|
+
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Interface
|
|
53
|
+
// ============================================================================
|
|
54
|
+
|
|
55
|
+
export interface IBunCompiler {
|
|
56
|
+
/**
|
|
57
|
+
* Compile a file using Bun.build
|
|
58
|
+
*/
|
|
59
|
+
compileFile(
|
|
60
|
+
fileConfig: FileToCompile,
|
|
61
|
+
output: string[],
|
|
62
|
+
filesBuilt: string[],
|
|
63
|
+
logger: EndpointLogger,
|
|
64
|
+
t: TFunction,
|
|
65
|
+
dryRun?: boolean,
|
|
66
|
+
verbose?: boolean,
|
|
67
|
+
profile?: BuildProfile,
|
|
68
|
+
env?: Record<string, string>,
|
|
69
|
+
): Promise<ResponseType<string[]>>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get default external modules
|
|
73
|
+
*/
|
|
74
|
+
getDefaultExternals(): readonly string[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Implementation
|
|
79
|
+
// ============================================================================
|
|
80
|
+
|
|
81
|
+
export class BunCompiler implements IBunCompiler {
|
|
82
|
+
async compileFile(
|
|
83
|
+
fileConfig: FileToCompile,
|
|
84
|
+
output: string[],
|
|
85
|
+
filesBuilt: string[],
|
|
86
|
+
logger: EndpointLogger,
|
|
87
|
+
t: TFunction,
|
|
88
|
+
dryRun?: boolean,
|
|
89
|
+
verbose?: boolean,
|
|
90
|
+
profile: BuildProfile = "development",
|
|
91
|
+
env?: Record<string, string>,
|
|
92
|
+
): Promise<ResponseType<string[]>> {
|
|
93
|
+
const profileSettings = PROFILE_DEFAULTS[profile];
|
|
94
|
+
const compiledFiles: string[] = [];
|
|
95
|
+
const warnings: string[] = [];
|
|
96
|
+
|
|
97
|
+
const { bunOptions = {} } = fileConfig;
|
|
98
|
+
const entrypointPath = resolve(ROOT_DIR, fileConfig.input);
|
|
99
|
+
const outfilePath = resolve(ROOT_DIR, fileConfig.output);
|
|
100
|
+
const outDir = dirname(outfilePath);
|
|
101
|
+
|
|
102
|
+
if (!existsSync(entrypointPath)) {
|
|
103
|
+
return fail({
|
|
104
|
+
message: "app.api.system.builder.errors.inputFileNotFound",
|
|
105
|
+
messageParams: {
|
|
106
|
+
filePath: fileConfig.input,
|
|
107
|
+
},
|
|
108
|
+
errorType: ErrorResponseTypes.NOT_FOUND,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
output.push(
|
|
113
|
+
outputFormatter.formatItem(
|
|
114
|
+
fileConfig.input,
|
|
115
|
+
`\u2192 ${fileConfig.output} (executable)`,
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
logger.info("Compiling executable with Bun", {
|
|
119
|
+
input: fileConfig.input,
|
|
120
|
+
target: bunOptions?.target || "bun",
|
|
121
|
+
profile,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
if (verbose) {
|
|
125
|
+
output.push(
|
|
126
|
+
outputFormatter.formatVerbose(`Target: ${bunOptions?.target || "bun"}`),
|
|
127
|
+
);
|
|
128
|
+
output.push(outputFormatter.formatVerbose(`Profile: ${profile}`));
|
|
129
|
+
output.push(
|
|
130
|
+
outputFormatter.formatVerbose(
|
|
131
|
+
`Minify: ${bunOptions?.minify ?? profileSettings.minify}`,
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
|
+
output.push(
|
|
135
|
+
outputFormatter.formatVerbose(
|
|
136
|
+
`Sourcemap: ${bunOptions?.sourcemap || profileSettings.sourcemap}`,
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (dryRun) {
|
|
142
|
+
compiledFiles.push(fileConfig.output);
|
|
143
|
+
filesBuilt.push(fileConfig.output);
|
|
144
|
+
return success(compiledFiles);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Ensure output directory exists
|
|
148
|
+
if (!existsSync(outDir)) {
|
|
149
|
+
mkdirSync(outDir, { recursive: true });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Merge default and custom externals
|
|
153
|
+
const externals = [
|
|
154
|
+
...DEFAULT_EXTERNALS,
|
|
155
|
+
...(fileConfig.modulesToExternalize || []),
|
|
156
|
+
...(bunOptions?.external || []),
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
// Build define object for env vars
|
|
160
|
+
const define: Record<string, string> = {
|
|
161
|
+
...bunOptions?.define,
|
|
162
|
+
};
|
|
163
|
+
if (env) {
|
|
164
|
+
for (const [key, value] of Object.entries(env)) {
|
|
165
|
+
define[`process.env.${key}`] = JSON.stringify(value);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Determine sourcemap setting
|
|
170
|
+
const sourcemap =
|
|
171
|
+
bunOptions?.sourcemap ||
|
|
172
|
+
(profileSettings.sourcemap === false
|
|
173
|
+
? "none"
|
|
174
|
+
: profileSettings.sourcemap === true
|
|
175
|
+
? "external"
|
|
176
|
+
: (profileSettings.sourcemap as "external" | "inline" | "none"));
|
|
177
|
+
|
|
178
|
+
// Build with Bun
|
|
179
|
+
const result = await Bun.build({
|
|
180
|
+
entrypoints: [entrypointPath],
|
|
181
|
+
outdir: outDir,
|
|
182
|
+
target: bunOptions?.target || "bun",
|
|
183
|
+
minify: bunOptions?.minify ?? profileSettings.minify,
|
|
184
|
+
sourcemap,
|
|
185
|
+
external: externals,
|
|
186
|
+
naming: bunOptions?.naming || { entry: basename(fileConfig.output) },
|
|
187
|
+
define: Object.keys(define).length > 0 ? define : undefined,
|
|
188
|
+
splitting: bunOptions?.splitting,
|
|
189
|
+
format: bunOptions?.format,
|
|
190
|
+
publicPath: bunOptions?.publicPath,
|
|
191
|
+
root: bunOptions?.root,
|
|
192
|
+
conditions: bunOptions?.conditions,
|
|
193
|
+
loader: bunOptions?.loader,
|
|
194
|
+
drop: bunOptions?.drop,
|
|
195
|
+
banner: bunOptions?.banner,
|
|
196
|
+
footer: bunOptions?.footer,
|
|
197
|
+
bytecode: bunOptions?.bytecode,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
if (!result.success) {
|
|
201
|
+
const errorMessages = result.logs
|
|
202
|
+
.filter((log): log is BuildMessage => log.level === "error")
|
|
203
|
+
.map((log) => log.message)
|
|
204
|
+
.join("\n");
|
|
205
|
+
return fail({
|
|
206
|
+
message: "app.api.system.builder.messages.bundleFailed",
|
|
207
|
+
messageParams: {
|
|
208
|
+
error: errorMessages || "Unknown error",
|
|
209
|
+
},
|
|
210
|
+
errorType: ErrorResponseTypes.INTERNAL_ERROR,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Get file size and check thresholds
|
|
215
|
+
const size = existsSync(outfilePath) ? statSync(outfilePath).size : 0;
|
|
216
|
+
|
|
217
|
+
if (size > SIZE_THRESHOLDS.CRITICAL) {
|
|
218
|
+
warnings.push(
|
|
219
|
+
t("app.api.system.builder.analysis.criticalSize", {
|
|
220
|
+
size: outputFormatter.formatBytes(size),
|
|
221
|
+
}),
|
|
222
|
+
);
|
|
223
|
+
} else if (size > SIZE_THRESHOLDS.WARNING) {
|
|
224
|
+
warnings.push(
|
|
225
|
+
t("app.api.system.builder.analysis.largeBundle", {
|
|
226
|
+
size: outputFormatter.formatBytes(size),
|
|
227
|
+
}),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
compiledFiles.push(fileConfig.output);
|
|
232
|
+
filesBuilt.push(fileConfig.output);
|
|
233
|
+
|
|
234
|
+
// Format success message with size indicator
|
|
235
|
+
const sizeIndicator = outputFormatter.getSizeIndicator(size);
|
|
236
|
+
output.push(
|
|
237
|
+
outputFormatter.formatSuccess(
|
|
238
|
+
`${sizeIndicator} ${t("app.api.system.builder.messages.bundleSuccess")} (${outputFormatter.formatBytes(size)})`,
|
|
239
|
+
),
|
|
240
|
+
);
|
|
241
|
+
logger.info("Executable compiled successfully", {
|
|
242
|
+
outfile: fileConfig.output,
|
|
243
|
+
size,
|
|
244
|
+
profile,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// Log warnings
|
|
248
|
+
for (const warning of warnings) {
|
|
249
|
+
output.push(outputFormatter.formatWarning(warning));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return success(compiledFiles);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
getDefaultExternals(): readonly string[] {
|
|
256
|
+
return DEFAULT_EXTERNALS;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Singleton instance
|
|
261
|
+
export const bunCompiler = new BunCompiler();
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle Analyzer Service
|
|
3
|
+
* Analyzes bundle sizes and provides optimization suggestions
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
7
|
+
import { basename, extname, resolve } from "node:path";
|
|
8
|
+
|
|
9
|
+
import type { TFunction } from "@/i18n/core/static-types";
|
|
10
|
+
|
|
11
|
+
import type { BundleAnalysis } from "../definition";
|
|
12
|
+
import { ROOT_DIR, SIZE_THRESHOLDS } from "./constants";
|
|
13
|
+
import { outputFormatter } from "./output-formatter";
|
|
14
|
+
|
|
15
|
+
// ============================================================================
|
|
16
|
+
// Interface
|
|
17
|
+
// ============================================================================
|
|
18
|
+
|
|
19
|
+
export interface IBundleAnalyzer {
|
|
20
|
+
/**
|
|
21
|
+
* Analyze bundle sizes and generate optimization suggestions
|
|
22
|
+
*/
|
|
23
|
+
analyze(
|
|
24
|
+
outputDir: string,
|
|
25
|
+
output: string[],
|
|
26
|
+
t: TFunction,
|
|
27
|
+
): Promise<BundleAnalysis>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get all files recursively from a directory
|
|
31
|
+
*/
|
|
32
|
+
getAllFiles(dir: string): Array<{ path: string; size: number }>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Check if size exceeds warning threshold
|
|
36
|
+
*/
|
|
37
|
+
isWarningSize(size: number): boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Check if size exceeds critical threshold
|
|
41
|
+
*/
|
|
42
|
+
isCriticalSize(size: number): boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Implementation
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
49
|
+
export class BundleAnalyzer implements IBundleAnalyzer {
|
|
50
|
+
async analyze(
|
|
51
|
+
outputDir: string,
|
|
52
|
+
output: string[],
|
|
53
|
+
t: TFunction,
|
|
54
|
+
): Promise<BundleAnalysis> {
|
|
55
|
+
const dirPath = resolve(ROOT_DIR, outputDir);
|
|
56
|
+
const analysis: BundleAnalysis = {
|
|
57
|
+
totalSize: 0,
|
|
58
|
+
files: [],
|
|
59
|
+
suggestions: [],
|
|
60
|
+
warnings: [],
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
if (!existsSync(dirPath)) {
|
|
64
|
+
return analysis;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const allFiles = this.getAllFiles(dirPath);
|
|
68
|
+
analysis.totalSize = allFiles.reduce((sum, f) => sum + f.size, 0);
|
|
69
|
+
|
|
70
|
+
// Get top 5 largest files
|
|
71
|
+
analysis.files = allFiles
|
|
72
|
+
.toSorted((a, b) => b.size - a.size)
|
|
73
|
+
.slice(0, 5)
|
|
74
|
+
.map((f) => ({
|
|
75
|
+
name: f.path,
|
|
76
|
+
size: f.size,
|
|
77
|
+
percentage:
|
|
78
|
+
analysis.totalSize > 0 ? (f.size / analysis.totalSize) * 100 : 0,
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
// Generate suggestions based on analysis
|
|
82
|
+
if (analysis.totalSize > SIZE_THRESHOLDS.CRITICAL) {
|
|
83
|
+
analysis.warnings.push(
|
|
84
|
+
t("app.api.system.builder.analysis.criticalSize", {
|
|
85
|
+
size: outputFormatter.formatBytes(analysis.totalSize),
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
analysis.suggestions.push(
|
|
89
|
+
t("app.api.system.builder.analysis.considerTreeShaking"),
|
|
90
|
+
);
|
|
91
|
+
analysis.suggestions.push(
|
|
92
|
+
t("app.api.system.builder.analysis.checkLargeDeps"),
|
|
93
|
+
);
|
|
94
|
+
} else if (analysis.totalSize > SIZE_THRESHOLDS.WARNING) {
|
|
95
|
+
analysis.warnings.push(
|
|
96
|
+
t("app.api.system.builder.analysis.largeBundle", {
|
|
97
|
+
size: outputFormatter.formatBytes(analysis.totalSize),
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Check for common issues
|
|
103
|
+
const jsFiles = allFiles.filter(
|
|
104
|
+
(f) => f.path.endsWith(".js") || f.path.endsWith(".mjs"),
|
|
105
|
+
);
|
|
106
|
+
const mapFiles = allFiles.filter((f) => f.path.endsWith(".map"));
|
|
107
|
+
|
|
108
|
+
if (mapFiles.length > 0) {
|
|
109
|
+
const mapSize = mapFiles.reduce((sum, f) => sum + f.size, 0);
|
|
110
|
+
if (mapSize > analysis.totalSize * 0.5) {
|
|
111
|
+
analysis.suggestions.push(
|
|
112
|
+
t("app.api.system.builder.analysis.largeSourcemaps"),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Check for duplicate-looking files
|
|
118
|
+
const baseNames = jsFiles.map((f) => basename(f.path, extname(f.path)));
|
|
119
|
+
const duplicates = baseNames.filter(
|
|
120
|
+
(name, idx) => baseNames.indexOf(name) !== idx,
|
|
121
|
+
);
|
|
122
|
+
if (duplicates.length > 0) {
|
|
123
|
+
analysis.suggestions.push(
|
|
124
|
+
t("app.api.system.builder.analysis.possibleDuplicates"),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Output analysis
|
|
129
|
+
if (analysis.files.length > 0) {
|
|
130
|
+
output.push(
|
|
131
|
+
outputFormatter.formatSection(
|
|
132
|
+
t("app.api.system.builder.messages.bundleAnalysis"),
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
output.push(
|
|
136
|
+
outputFormatter.formatItem(
|
|
137
|
+
t("app.api.system.builder.analysis.totalSize"),
|
|
138
|
+
outputFormatter.formatBytes(analysis.totalSize),
|
|
139
|
+
),
|
|
140
|
+
);
|
|
141
|
+
output.push(
|
|
142
|
+
outputFormatter.formatStep(
|
|
143
|
+
t("app.api.system.builder.analysis.largestFiles"),
|
|
144
|
+
),
|
|
145
|
+
);
|
|
146
|
+
for (const file of analysis.files) {
|
|
147
|
+
output.push(
|
|
148
|
+
outputFormatter.formatItem(
|
|
149
|
+
` ${file.name}`,
|
|
150
|
+
`${outputFormatter.formatBytes(file.size)} (${file.percentage.toFixed(1)}%)`,
|
|
151
|
+
),
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return analysis;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
getAllFiles(dir: string): Array<{ path: string; size: number }> {
|
|
160
|
+
const files: Array<{ path: string; size: number }> = [];
|
|
161
|
+
const basePath = dir;
|
|
162
|
+
|
|
163
|
+
const processDir = (currentDir: string): void => {
|
|
164
|
+
try {
|
|
165
|
+
const entries = readdirSync(currentDir, { withFileTypes: true });
|
|
166
|
+
for (const entry of entries) {
|
|
167
|
+
const fullPath = resolve(currentDir, entry.name);
|
|
168
|
+
if (entry.isDirectory()) {
|
|
169
|
+
processDir(fullPath);
|
|
170
|
+
} else {
|
|
171
|
+
const stats = statSync(fullPath);
|
|
172
|
+
files.push({
|
|
173
|
+
path: fullPath.replace(basePath, ""),
|
|
174
|
+
size: stats.size,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch {
|
|
179
|
+
// Ignore errors reading directory
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
processDir(dir);
|
|
184
|
+
return files;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
isWarningSize(size: number): boolean {
|
|
188
|
+
return size > SIZE_THRESHOLDS.WARNING;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
isCriticalSize(size: number): boolean {
|
|
192
|
+
return size > SIZE_THRESHOLDS.CRITICAL;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Singleton instance
|
|
197
|
+
export const bundleAnalyzer = new BundleAnalyzer();
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Loader Service
|
|
3
|
+
* Loads build configuration from files or inline data
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
|
|
9
|
+
import type { ResponseType } from "next-vibe/shared/types/response.schema";
|
|
10
|
+
import {
|
|
11
|
+
ErrorResponseTypes,
|
|
12
|
+
fail,
|
|
13
|
+
success,
|
|
14
|
+
} from "next-vibe/shared/types/response.schema";
|
|
15
|
+
|
|
16
|
+
import type { EndpointLogger } from "@/app/api/[locale]/system/unified-interface/shared/logger/endpoint";
|
|
17
|
+
import type { TFunction } from "@/i18n/core/static-types";
|
|
18
|
+
|
|
19
|
+
import type {
|
|
20
|
+
BuildConfig,
|
|
21
|
+
CopyConfig,
|
|
22
|
+
FileToCompile,
|
|
23
|
+
NpmPackageConfig,
|
|
24
|
+
} from "../definition";
|
|
25
|
+
import { ROOT_DIR } from "./constants";
|
|
26
|
+
import { outputFormatter } from "./output-formatter";
|
|
27
|
+
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Types
|
|
30
|
+
// ============================================================================
|
|
31
|
+
|
|
32
|
+
/** Inline configuration input matching request type */
|
|
33
|
+
export interface InlineConfigInput {
|
|
34
|
+
foldersToClean?: string[];
|
|
35
|
+
filesToCompile?: FileToCompile[];
|
|
36
|
+
filesOrFoldersToCopy?: CopyConfig[];
|
|
37
|
+
npmPackage?: NpmPackageConfig;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Type for dynamically imported build config module */
|
|
41
|
+
interface BuildConfigModule {
|
|
42
|
+
default: BuildConfig;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Interface
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
49
|
+
export interface IConfigLoader {
|
|
50
|
+
/**
|
|
51
|
+
* Load build configuration from file or inline data
|
|
52
|
+
*/
|
|
53
|
+
load(
|
|
54
|
+
configPath: string | undefined,
|
|
55
|
+
inlineConfig: InlineConfigInput | undefined,
|
|
56
|
+
output: string[],
|
|
57
|
+
logger: EndpointLogger,
|
|
58
|
+
t: TFunction,
|
|
59
|
+
): Promise<ResponseType<BuildConfig>>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Check if a config file exists
|
|
63
|
+
*/
|
|
64
|
+
exists(configPath: string): boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Validate that a module exports a valid build config
|
|
68
|
+
*/
|
|
69
|
+
isValidBuildConfigModule(
|
|
70
|
+
module: BuildConfigModule | Record<string, BuildConfig | undefined>,
|
|
71
|
+
): module is BuildConfigModule;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// Implementation
|
|
76
|
+
// ============================================================================
|
|
77
|
+
|
|
78
|
+
export class ConfigLoader implements IConfigLoader {
|
|
79
|
+
async load(
|
|
80
|
+
configPath: string | undefined,
|
|
81
|
+
inlineConfig: InlineConfigInput | undefined,
|
|
82
|
+
output: string[],
|
|
83
|
+
logger: EndpointLogger,
|
|
84
|
+
t: TFunction,
|
|
85
|
+
): Promise<ResponseType<BuildConfig>> {
|
|
86
|
+
// Use config file if path provided
|
|
87
|
+
if (configPath) {
|
|
88
|
+
const fullPath = resolve(ROOT_DIR, configPath);
|
|
89
|
+
|
|
90
|
+
if (!existsSync(fullPath)) {
|
|
91
|
+
return fail({
|
|
92
|
+
message: "app.api.system.builder.errors.configNotFound",
|
|
93
|
+
messageParams: {
|
|
94
|
+
path: configPath,
|
|
95
|
+
},
|
|
96
|
+
errorType: ErrorResponseTypes.NOT_FOUND,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
output.push(
|
|
101
|
+
outputFormatter.formatStep(
|
|
102
|
+
t("app.api.system.builder.messages.loadingConfig", {
|
|
103
|
+
path: configPath,
|
|
104
|
+
}),
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
logger.info("Loading build config", { path: fullPath });
|
|
108
|
+
|
|
109
|
+
const importedModule = (await import(fullPath)) as
|
|
110
|
+
| BuildConfigModule
|
|
111
|
+
| Record<string, BuildConfig | undefined>;
|
|
112
|
+
|
|
113
|
+
if (!this.isValidBuildConfigModule(importedModule)) {
|
|
114
|
+
return fail({
|
|
115
|
+
message: "app.api.system.builder.errors.invalidBuildConfig",
|
|
116
|
+
errorType: ErrorResponseTypes.VALIDATION_ERROR,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return success(importedModule.default);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Use inline configuration
|
|
124
|
+
output.push(
|
|
125
|
+
outputFormatter.formatStep(
|
|
126
|
+
t("app.api.system.builder.messages.usingInlineConfig"),
|
|
127
|
+
),
|
|
128
|
+
);
|
|
129
|
+
logger.info("Using inline config");
|
|
130
|
+
|
|
131
|
+
return success({
|
|
132
|
+
foldersToClean: inlineConfig?.foldersToClean,
|
|
133
|
+
filesToCompile: inlineConfig?.filesToCompile,
|
|
134
|
+
filesOrFoldersToCopy: inlineConfig?.filesOrFoldersToCopy,
|
|
135
|
+
npmPackage: inlineConfig?.npmPackage,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
exists(configPath: string): boolean {
|
|
140
|
+
const fullPath = resolve(ROOT_DIR, configPath);
|
|
141
|
+
return existsSync(fullPath);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
isValidBuildConfigModule(
|
|
145
|
+
module: BuildConfigModule | Record<string, BuildConfig | undefined>,
|
|
146
|
+
): module is BuildConfigModule {
|
|
147
|
+
if (typeof module !== "object" || module === null) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
if (!("default" in module)) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
const defaultExport = module.default;
|
|
154
|
+
return typeof defaultExport === "object" && defaultExport !== null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Singleton instance
|
|
159
|
+
export const configLoader = new ConfigLoader();
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Validator Service
|
|
3
|
+
* Validates build configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
|
|
9
|
+
import type { TFunction } from "@/i18n/core/static-types";
|
|
10
|
+
|
|
11
|
+
import type { BuildConfig } from "../definition";
|
|
12
|
+
import { ROOT_DIR } from "./constants";
|
|
13
|
+
|
|
14
|
+
/** Validation result */
|
|
15
|
+
interface ValidationResult {
|
|
16
|
+
valid: boolean;
|
|
17
|
+
errors: string[];
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Interface
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
export interface IConfigValidator {
|
|
26
|
+
/**
|
|
27
|
+
* Validate build configuration and return detailed errors/warnings
|
|
28
|
+
*/
|
|
29
|
+
validate(config: BuildConfig, t: TFunction): ValidationResult;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// Implementation
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
export class ConfigValidator implements IConfigValidator {
|
|
37
|
+
validate(config: BuildConfig, t: TFunction): ValidationResult {
|
|
38
|
+
const errors: string[] = [];
|
|
39
|
+
const warnings: string[] = [];
|
|
40
|
+
|
|
41
|
+
// Check if there's anything to build
|
|
42
|
+
if (
|
|
43
|
+
!config.foldersToClean?.length &&
|
|
44
|
+
!config.filesToCompile?.length &&
|
|
45
|
+
!config.filesOrFoldersToCopy?.length &&
|
|
46
|
+
!config.npmPackage
|
|
47
|
+
) {
|
|
48
|
+
errors.push(t("app.api.system.builder.errors.emptyConfig"));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Validate file paths for filesToCompile
|
|
52
|
+
if (config.filesToCompile) {
|
|
53
|
+
for (const file of config.filesToCompile) {
|
|
54
|
+
const inputPath = resolve(ROOT_DIR, file.input);
|
|
55
|
+
if (!existsSync(inputPath)) {
|
|
56
|
+
errors.push(
|
|
57
|
+
t("app.api.system.builder.errors.inputFileNotFound", {
|
|
58
|
+
filePath: file.input,
|
|
59
|
+
}),
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Check for common mistakes
|
|
64
|
+
if (file.output.endsWith("/")) {
|
|
65
|
+
warnings.push(
|
|
66
|
+
t("app.api.system.builder.warnings.outputIsDirectory", {
|
|
67
|
+
path: file.output,
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Validate copy paths
|
|
75
|
+
if (config.filesOrFoldersToCopy) {
|
|
76
|
+
for (const copyConfig of config.filesOrFoldersToCopy) {
|
|
77
|
+
const srcPath = resolve(ROOT_DIR, copyConfig.input);
|
|
78
|
+
if (!existsSync(srcPath)) {
|
|
79
|
+
warnings.push(
|
|
80
|
+
t("app.api.system.builder.warnings.sourceNotFound", {
|
|
81
|
+
path: copyConfig.input,
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
valid: errors.length === 0,
|
|
90
|
+
errors,
|
|
91
|
+
warnings,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Singleton instance
|
|
97
|
+
export const configValidator = new ConfigValidator();
|