@warlock.js/core 5.31.0 → 5.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/esm/application/app.d.mts +3 -3
- package/esm/application/app.d.mts.map +1 -1
- package/esm/application/application-config-types.d.mts +9 -2
- package/esm/application/application-config-types.d.mts.map +1 -1
- package/esm/application/application.d.mts +5 -7
- package/esm/application/application.d.mts.map +1 -1
- package/esm/application/application.mjs +3 -1
- package/esm/application/application.mjs.map +1 -1
- package/esm/application/boot-signal.d.mts +22 -20
- package/esm/application/boot-signal.d.mts.map +1 -1
- package/esm/application/boot-signal.mjs +15 -9
- package/esm/application/boot-signal.mjs.map +1 -1
- package/esm/application/index.d.mts +2 -1
- package/esm/application/index.mjs +1 -1
- package/esm/application/public-url.d.mts +1 -2
- package/esm/application/public-url.d.mts.map +1 -1
- package/esm/application/roles.d.mts +10 -11
- package/esm/application/roles.d.mts.map +1 -1
- package/esm/benchmark/benchmark-snapshots.d.mts +1 -3
- package/esm/benchmark/benchmark-snapshots.d.mts.map +1 -1
- package/esm/benchmark/benchmark.d.mts +1 -3
- package/esm/benchmark/benchmark.d.mts.map +1 -1
- package/esm/benchmark/channels/console.channel.d.mts +1 -3
- package/esm/benchmark/channels/console.channel.d.mts.map +1 -1
- package/esm/benchmark/channels/noop.channel.d.mts +1 -3
- package/esm/benchmark/channels/noop.channel.d.mts.map +1 -1
- package/esm/benchmark/index.mjs +1 -1
- package/esm/benchmark/profiler.d.mts +1 -3
- package/esm/benchmark/profiler.d.mts.map +1 -1
- package/esm/benchmark/profiler.mjs +2 -1
- package/esm/benchmark/profiler.mjs.map +1 -1
- package/esm/benchmark/types.d.mts +22 -17
- package/esm/benchmark/types.d.mts.map +1 -1
- package/esm/bootstrap/setup.d.mts +1 -2
- package/esm/bootstrap/setup.d.mts.map +1 -1
- package/esm/bootstrap.d.mts +1 -2
- package/esm/bootstrap.d.mts.map +1 -1
- package/esm/cache/database-cache-driver.d.mts +3 -5
- package/esm/cache/database-cache-driver.d.mts.map +1 -1
- package/esm/cache/database-cache-driver.mjs +1 -1
- package/esm/cache/index.d.mts +2 -1
- package/esm/cache/index.mjs +1 -1
- package/esm/cli/cli-commands.manager.mjs +6 -3
- package/esm/cli/cli-commands.manager.mjs.map +1 -1
- package/esm/cli/commands/agents-md/agents-md-command.action.mjs +3 -2
- package/esm/cli/commands/agents-md/agents-md-command.action.mjs.map +1 -1
- package/esm/cli/commands/ai/ai-command.action.mjs +140 -0
- package/esm/cli/commands/ai/ai-command.action.mjs.map +1 -0
- package/esm/cli/commands/ai.command.mjs +50 -0
- package/esm/cli/commands/ai.command.mjs.map +1 -0
- package/esm/cli/commands/board/board-command.action.mjs +1 -1
- package/esm/cli/commands/check/check-command.action.mjs +4 -1
- package/esm/cli/commands/check/check-command.action.mjs.map +1 -1
- package/esm/cli/commands/check/child-typecheck.mjs +1 -1
- package/esm/cli/commands/check/child-typecheck.mjs.map +1 -1
- package/esm/cli/commands/check/format-problems.mjs +1 -1
- package/esm/cli/commands/check.command.mjs +6 -1
- package/esm/cli/commands/check.command.mjs.map +1 -1
- package/esm/cli/commands/dev-server.command.mjs +3 -2
- package/esm/cli/commands/dev-server.command.mjs.map +1 -1
- package/esm/cli/commands/doctor/check.types.d.mts +29 -16
- package/esm/cli/commands/doctor/check.types.d.mts.map +1 -1
- package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs +22 -27
- package/esm/cli/commands/doctor/checks/locales-ts-deprecated.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/doctor-command.action.mjs +2 -1
- package/esm/cli/commands/doctor/doctor-command.action.mjs.map +1 -1
- package/esm/cli/commands/explain/explain-command.action.mjs +1 -1
- package/esm/cli/commands/generate/generators/controller.generator.mjs +5 -2
- package/esm/cli/commands/generate/generators/controller.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/endpoint.generator.mjs +5 -3
- package/esm/cli/commands/generate/generators/endpoint.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/model.generator.mjs +3 -2
- package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/repository.generator.mjs +3 -1
- package/esm/cli/commands/generate/generators/repository.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/resource.generator.mjs +3 -1
- package/esm/cli/commands/generate/generators/resource.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/service.generator.mjs +3 -1
- package/esm/cli/commands/generate/generators/service.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/templates/endpoint-stubs.mjs +2 -2
- package/esm/cli/commands/generate/templates/endpoint-stubs.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/endpoint-schema.mjs +1 -2
- package/esm/cli/commands/generate/utils/endpoint-schema.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/name-parser.mjs +1 -1
- package/esm/cli/commands/generate/utils/path-resolver.mjs +1 -1
- package/esm/cli/commands/inspect/inspect-command.action.mjs +3 -2
- package/esm/cli/commands/inspect/inspect-command.action.mjs.map +1 -1
- package/esm/cli/commands/issue/collect-environment.mjs +187 -0
- package/esm/cli/commands/issue/collect-environment.mjs.map +1 -0
- package/esm/cli/commands/issue/issue-command.action.mjs +70 -0
- package/esm/cli/commands/issue/issue-command.action.mjs.map +1 -0
- package/esm/cli/commands/issue.command.mjs +31 -0
- package/esm/cli/commands/issue.command.mjs.map +1 -0
- package/esm/cli/commands/mcp/mcp-command.action.mjs +15 -14
- package/esm/cli/commands/mcp/mcp-command.action.mjs.map +1 -1
- package/esm/cli/commands/openapi-generator.action.mjs +1 -1
- package/esm/cli/commands/pm2/pm2-command.action.mjs +91 -0
- package/esm/cli/commands/pm2/pm2-command.action.mjs.map +1 -0
- package/esm/cli/commands/pm2/pm2-config.mjs +115 -0
- package/esm/cli/commands/pm2/pm2-config.mjs.map +1 -0
- package/esm/cli/commands/pm2.command.mjs +53 -0
- package/esm/cli/commands/pm2.command.mjs.map +1 -0
- package/esm/cli/commands/postman-generator.action.mjs +1 -1
- package/esm/cli/commands/routes/format-routes-table.mjs +1 -1
- package/esm/cli/commands/routes/route-row.mjs +1 -1
- package/esm/cli/commands/routes/routes-diff.action.mjs +2 -2
- package/esm/cli/commands/routes/routes-diff.action.mjs.map +1 -1
- package/esm/cli/commands/test.command.mjs +1 -1
- package/esm/cli/commands/trace/trace-command.action.mjs +1 -1
- package/esm/cli/commands-loader.mjs +1 -1
- package/esm/cli/framework-cli-commands.mjs +6 -0
- package/esm/cli/framework-cli-commands.mjs.map +1 -1
- package/esm/cli/parse-cli-args.mjs +2 -2
- package/esm/cli/parse-cli-args.mjs.map +1 -1
- package/esm/cli/start.d.mts +1 -1
- package/esm/cli/string-similarity.mjs +1 -1
- package/esm/commands/cli-command.d.mts +2 -4
- package/esm/commands/cli-command.d.mts.map +1 -1
- package/esm/commands/index.d.mts +2 -1
- package/esm/commands/index.mjs +1 -1
- package/esm/commands/types.d.mts +8 -8
- package/esm/commands/types.d.mts.map +1 -1
- package/esm/config/config-getter.d.mts +2 -3
- package/esm/config/config-getter.d.mts.map +1 -1
- package/esm/config/config-getter.mjs +5 -5
- package/esm/config/config-getter.mjs.map +1 -1
- package/esm/config/config-handlers.d.mts +1 -3
- package/esm/config/config-handlers.d.mts.map +1 -1
- package/esm/config/config-loader.d.mts +1 -2
- package/esm/config/config-loader.d.mts.map +1 -1
- package/esm/config/config-loader.mjs +3 -3
- package/esm/config/config-loader.mjs.map +1 -1
- package/esm/config/config-manager.mjs +1 -1
- package/esm/config/config-schema.d.mts +19 -16
- package/esm/config/config-schema.d.mts.map +1 -1
- package/esm/config/config-setter.d.mts +2 -4
- package/esm/config/config-setter.d.mts.map +1 -1
- package/esm/config/config-setter.mjs +2 -2
- package/esm/config/config-setter.mjs.map +1 -1
- package/esm/config/config-special-handlers.d.mts +2 -4
- package/esm/config/config-special-handlers.d.mts.map +1 -1
- package/esm/config/index.d.mts +2 -1
- package/esm/config/index.mjs +1 -1
- package/esm/config/types.d.mts +4 -5
- package/esm/config/types.d.mts.map +1 -1
- package/esm/connectors/access-connector.d.mts +1 -3
- package/esm/connectors/access-connector.d.mts.map +1 -1
- package/esm/connectors/access-connector.mjs +2 -2
- package/esm/connectors/access-connector.mjs.map +1 -1
- package/esm/connectors/ai-connector.d.mts +1 -3
- package/esm/connectors/ai-connector.d.mts.map +1 -1
- package/esm/connectors/ai-connector.mjs +2 -2
- package/esm/connectors/ai-connector.mjs.map +1 -1
- package/esm/connectors/assert-no-reserved-connector-names.d.mts +1 -3
- package/esm/connectors/assert-no-reserved-connector-names.d.mts.map +1 -1
- package/esm/connectors/assert-unique-connector-names.d.mts +1 -3
- package/esm/connectors/assert-unique-connector-names.d.mts.map +1 -1
- package/esm/connectors/assert-unique-connector-names.mjs +2 -1
- package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
- package/esm/connectors/base-connector.d.mts +1 -3
- package/esm/connectors/base-connector.d.mts.map +1 -1
- package/esm/connectors/cache-connector.d.mts +1 -3
- package/esm/connectors/cache-connector.d.mts.map +1 -1
- package/esm/connectors/cache-connector.mjs +3 -3
- package/esm/connectors/cache-connector.mjs.map +1 -1
- package/esm/connectors/connectors-manager.d.mts +2 -4
- package/esm/connectors/connectors-manager.d.mts.map +1 -1
- package/esm/connectors/connectors-manager.mjs +3 -6
- package/esm/connectors/connectors-manager.mjs.map +1 -1
- package/esm/connectors/database-connector.d.mts +1 -3
- package/esm/connectors/database-connector.d.mts.map +1 -1
- package/esm/connectors/database-connector.mjs +2 -2
- package/esm/connectors/database-connector.mjs.map +1 -1
- package/esm/connectors/describe-server-address.mjs +4 -4
- package/esm/connectors/describe-server-address.mjs.map +1 -1
- package/esm/connectors/herald-connector.d.mts +1 -3
- package/esm/connectors/herald-connector.d.mts.map +1 -1
- package/esm/connectors/herald-connector.mjs +2 -2
- package/esm/connectors/herald-connector.mjs.map +1 -1
- package/esm/connectors/http-connector.d.mts +1 -3
- package/esm/connectors/http-connector.d.mts.map +1 -1
- package/esm/connectors/http-connector.mjs +8 -7
- package/esm/connectors/http-connector.mjs.map +1 -1
- package/esm/connectors/index.d.mts +2 -1
- package/esm/connectors/index.mjs +1 -1
- package/esm/connectors/logger-connector.d.mts +1 -3
- package/esm/connectors/logger-connector.d.mts.map +1 -1
- package/esm/connectors/logger-connector.mjs +2 -2
- package/esm/connectors/logger-connector.mjs.map +1 -1
- package/esm/connectors/mail-connector.d.mts +1 -3
- package/esm/connectors/mail-connector.d.mts.map +1 -1
- package/esm/connectors/mail-connector.mjs +2 -2
- package/esm/connectors/mail-connector.mjs.map +1 -1
- package/esm/connectors/notifications-connector.d.mts +1 -3
- package/esm/connectors/notifications-connector.d.mts.map +1 -1
- package/esm/connectors/notifications-connector.mjs +2 -2
- package/esm/connectors/notifications-connector.mjs.map +1 -1
- package/esm/connectors/register-configured-connectors.d.mts +2 -4
- package/esm/connectors/register-configured-connectors.d.mts.map +1 -1
- package/esm/connectors/shutdown-timeout.mjs +7 -0
- package/esm/connectors/shutdown-timeout.mjs.map +1 -0
- package/esm/connectors/socket-connector.d.mts +1 -3
- package/esm/connectors/socket-connector.d.mts.map +1 -1
- package/esm/connectors/socket-connector.mjs +20 -11
- package/esm/connectors/socket-connector.mjs.map +1 -1
- package/esm/connectors/storage.connector.d.mts +1 -3
- package/esm/connectors/storage.connector.d.mts.map +1 -1
- package/esm/connectors/storage.connector.mjs +2 -2
- package/esm/connectors/storage.connector.mjs.map +1 -1
- package/esm/connectors/types.d.mts +17 -14
- package/esm/connectors/types.d.mts.map +1 -1
- package/esm/container/container-instance-registry.mjs.map +1 -1
- package/esm/container/development-app-modules.d.mts +7 -5
- package/esm/container/development-app-modules.d.mts.map +1 -1
- package/esm/container/development-model-modules.d.mts +6 -5
- package/esm/container/development-model-modules.d.mts.map +1 -1
- package/esm/container/index.d.mts +4 -4
- package/esm/container/index.d.mts.map +1 -1
- package/esm/database/index.d.mts +3 -1
- package/esm/database/index.mjs +1 -1
- package/esm/database/migrate-action.mjs +1 -1
- package/esm/database/models/database-log/database-log.d.mts +2 -3
- package/esm/database/models/database-log/database-log.d.mts.map +1 -1
- package/esm/database/models/database-log/index.d.mts +2 -1
- package/esm/database/models/database-log/index.mjs +1 -1
- package/esm/database/seed-command-action.mjs +1 -1
- package/esm/database/seeds/seeder.d.mts +2 -4
- package/esm/database/seeds/seeder.d.mts.map +1 -1
- package/esm/database/seeds/seeder.errors.d.mts +2 -3
- package/esm/database/seeds/seeder.errors.d.mts.map +1 -1
- package/esm/database/seeds/seeders.manager.mjs +2 -1
- package/esm/database/seeds/seeders.manager.mjs.map +1 -1
- package/esm/database/seeds/types.d.mts +7 -8
- package/esm/database/seeds/types.d.mts.map +1 -1
- package/esm/database/utils.d.mts +4 -5
- package/esm/database/utils.d.mts.map +1 -1
- package/esm/dev-server/app-module-registry.mjs +1 -1
- package/esm/dev-server/create-worker.mjs +5 -3
- package/esm/dev-server/create-worker.mjs.map +1 -1
- package/esm/dev-server/dependency-graph.d.mts +1 -3
- package/esm/dev-server/dependency-graph.d.mts.map +1 -1
- package/esm/dev-server/dependency-graph.mjs +1 -1
- package/esm/dev-server/dependency-graph.mjs.map +1 -1
- package/esm/dev-server/extract-translation-keys.mjs +16 -17
- package/esm/dev-server/extract-translation-keys.mjs.map +1 -1
- package/esm/dev-server/file-manager.d.mts +3 -7
- package/esm/dev-server/file-manager.d.mts.map +1 -1
- package/esm/dev-server/file-operations.d.mts +1 -3
- package/esm/dev-server/file-operations.d.mts.map +1 -1
- package/esm/dev-server/files-watcher.mjs +12 -11
- package/esm/dev-server/files-watcher.mjs.map +1 -1
- package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +6 -8
- package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs.map +1 -1
- package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs +36 -115
- package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs.map +1 -1
- package/esm/dev-server/health-checker/default-health-checkers.mjs +6 -15
- package/esm/dev-server/health-checker/default-health-checkers.mjs.map +1 -1
- package/esm/dev-server/health-checker/eslint-support.mjs +27 -0
- package/esm/dev-server/health-checker/eslint-support.mjs.map +1 -0
- package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +7 -6
- package/esm/dev-server/health-checker/file-health-checker.contract.d.mts.map +1 -1
- package/esm/dev-server/health-checker/file-health-result.d.mts +2 -2
- package/esm/dev-server/health-checker/file-health-result.d.mts.map +1 -1
- package/esm/dev-server/health-checker/files-healthcare.manager.mjs +1 -0
- package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
- package/esm/dev-server/health-checker/oxlint-runner.mjs +6 -5
- package/esm/dev-server/health-checker/oxlint-runner.mjs.map +1 -1
- package/esm/dev-server/health-checker/workers/eslint-health.worker.d.mts +1 -1
- package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +2 -11
- package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
- package/esm/dev-server/health-checker/workers/oxlint-health.worker.d.mts +1 -1
- package/esm/dev-server/health-checker/workers/ts-health.worker.d.mts +1 -1
- package/esm/dev-server/health-checker/workers/ts-health.worker.mjs +40 -174
- package/esm/dev-server/health-checker/workers/ts-health.worker.mjs.map +1 -1
- package/esm/dev-server/loader/hook-thread.d.mts +4 -8
- package/esm/dev-server/loader/hook-thread.d.mts.map +1 -1
- package/esm/dev-server/loader/load-hook.d.mts +10 -6
- package/esm/dev-server/loader/load-hook.d.mts.map +1 -1
- package/esm/dev-server/loader/load-hook.mjs +4 -3
- package/esm/dev-server/loader/load-hook.mjs.map +1 -1
- package/esm/dev-server/loader/own-resolver.mjs +1 -1
- package/esm/dev-server/loader/register-loader.mjs +3 -2
- package/esm/dev-server/loader/register-loader.mjs.map +1 -1
- package/esm/dev-server/loader/resolve-hook.d.mts +2 -2
- package/esm/dev-server/loader/resolve-hook.d.mts.map +1 -1
- package/esm/dev-server/loader/resolve-hook.mjs +2 -1
- package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
- package/esm/dev-server/loader/transpile-cache.mjs +2 -1
- package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
- package/esm/dev-server/manifest-manager.d.mts +1 -3
- package/esm/dev-server/manifest-manager.d.mts.map +1 -1
- package/esm/dev-server/model-module-registry.mjs +3 -3
- package/esm/dev-server/model-module-registry.mjs.map +1 -1
- package/esm/dev-server/model-resource-typings.mjs +40 -47
- package/esm/dev-server/model-resource-typings.mjs.map +1 -1
- package/esm/dev-server/module-loader.mjs +2 -2
- package/esm/dev-server/module-loader.mjs.map +1 -1
- package/esm/dev-server/package-json-manager.mjs +1 -1
- package/esm/dev-server/parse-imports.mjs +6 -38
- package/esm/dev-server/parse-imports.mjs.map +1 -1
- package/esm/dev-server/read-config-ast.mjs +3 -33
- package/esm/dev-server/read-config-ast.mjs.map +1 -1
- package/esm/dev-server/ready-block.mjs +1 -1
- package/esm/dev-server/shortcuts.mjs +1 -1
- package/esm/dev-server/special-files-collector.d.mts +2 -4
- package/esm/dev-server/special-files-collector.d.mts.map +1 -1
- package/esm/dev-server/supervisor.mjs +1 -1
- package/esm/dev-server/tsconfig-manager.mjs +3 -3
- package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
- package/esm/dev-server/type-generator.mjs +28 -35
- package/esm/dev-server/type-generator.mjs.map +1 -1
- package/esm/dev-server/types.d.mts +3 -4
- package/esm/dev-server/types.d.mts.map +1 -1
- package/esm/dev-server/update-check-cache.mjs +2 -2
- package/esm/dev-server/update-check-cache.mjs.map +1 -1
- package/esm/encryption/encrypt.d.mts +2 -3
- package/esm/encryption/encrypt.d.mts.map +1 -1
- package/esm/encryption/hash.d.mts +1 -2
- package/esm/encryption/hash.d.mts.map +1 -1
- package/esm/encryption/index.mjs +1 -1
- package/esm/encryption/password.d.mts +2 -3
- package/esm/encryption/password.d.mts.map +1 -1
- package/esm/encryption/types.d.mts +2 -3
- package/esm/encryption/types.d.mts.map +1 -1
- package/esm/errors/error-codes.d.mts +29 -22
- package/esm/errors/error-codes.d.mts.map +1 -1
- package/esm/errors/warlock-error.d.mts +1 -3
- package/esm/errors/warlock-error.d.mts.map +1 -1
- package/esm/generations/add-command.action.mjs +3 -2
- package/esm/generations/add-command.action.mjs.map +1 -1
- package/esm/generations/features/bull-board.feature.mjs +2 -1
- package/esm/generations/features/bull-board.feature.mjs.map +1 -1
- package/esm/generations/features/index.mjs +2 -0
- package/esm/generations/features/index.mjs.map +1 -1
- package/esm/generations/features/notifications.feature.mjs +2 -1
- package/esm/generations/features/notifications.feature.mjs.map +1 -1
- package/esm/generations/features/process.feature.mjs +65 -0
- package/esm/generations/features/process.feature.mjs.map +1 -0
- package/esm/generations/features/shared/merge-web-sitemap-config.mjs +16 -23
- package/esm/generations/features/shared/merge-web-sitemap-config.mjs.map +1 -1
- package/esm/generations/features/shared/patch-tsconfig-include.mjs +1 -1
- package/esm/generations/features/shared/relocate-conflicting-home-route.mjs +1 -1
- package/esm/generations/features/sitemap.feature.mjs +2 -1
- package/esm/generations/features/sitemap.feature.mjs.map +1 -1
- package/esm/generations/generation-fs.mjs +1 -1
- package/esm/generations/generation-run.mjs +1 -1
- package/esm/generations/stubs.mjs +1 -1
- package/esm/generations/stubs.mjs.map +1 -1
- package/esm/http/boot-port-preflight.d.mts +4 -5
- package/esm/http/boot-port-preflight.d.mts.map +1 -1
- package/esm/http/boot-port-preflight.mjs +2 -2
- package/esm/http/boot-port-preflight.mjs.map +1 -1
- package/esm/http/bounded-stream-queue.d.mts +4 -4
- package/esm/http/bounded-stream-queue.d.mts.map +1 -1
- package/esm/http/bounded-stream-queue.mjs +1 -1
- package/esm/http/bounded-stream-queue.mjs.map +1 -1
- package/esm/http/build-cors-options.mjs +2 -2
- package/esm/http/build-cors-options.mjs.map +1 -1
- package/esm/http/build-rate-limit-options.d.mts +2 -3
- package/esm/http/build-rate-limit-options.d.mts.map +1 -1
- package/esm/http/build-rate-limit-options.mjs +1 -1
- package/esm/http/build-rate-limit-options.mjs.map +1 -1
- package/esm/http/conditional-request.d.mts +14 -13
- package/esm/http/conditional-request.d.mts.map +1 -1
- package/esm/http/config.d.mts +2 -4
- package/esm/http/config.d.mts.map +1 -1
- package/esm/http/config.mjs +2 -2
- package/esm/http/config.mjs.map +1 -1
- package/esm/http/context/request-context.d.mts +6 -7
- package/esm/http/context/request-context.d.mts.map +1 -1
- package/esm/http/context/request-memo.d.mts +1 -2
- package/esm/http/context/request-memo.d.mts.map +1 -1
- package/esm/http/createHttpApplication.d.mts +2 -3
- package/esm/http/createHttpApplication.d.mts.map +1 -1
- package/esm/http/createHttpApplication.mjs +2 -2
- package/esm/http/createHttpApplication.mjs.map +1 -1
- package/esm/http/csp.d.mts +10 -12
- package/esm/http/csp.d.mts.map +1 -1
- package/esm/http/csp.mjs +2 -2
- package/esm/http/csp.mjs.map +1 -1
- package/esm/http/csrf-default-guard.d.mts +2 -4
- package/esm/http/csrf-default-guard.d.mts.map +1 -1
- package/esm/http/csrf-default-guard.mjs +1 -1
- package/esm/http/csrf-default-guard.mjs.map +1 -1
- package/esm/http/csrf-origin-policy.d.mts +7 -9
- package/esm/http/csrf-origin-policy.d.mts.map +1 -1
- package/esm/http/csrf-origin-policy.mjs +2 -2
- package/esm/http/csrf-origin-policy.mjs.map +1 -1
- package/esm/http/database/RequestLog.d.mts +2 -3
- package/esm/http/database/RequestLog.d.mts.map +1 -1
- package/esm/http/error-codes.d.mts +1 -2
- package/esm/http/error-codes.d.mts.map +1 -1
- package/esm/http/error-mapper.d.mts +2 -4
- package/esm/http/error-mapper.d.mts.map +1 -1
- package/esm/http/error-mapper.mjs +2 -2
- package/esm/http/error-mapper.mjs.map +1 -1
- package/esm/http/errors/errors.d.mts +28 -29
- package/esm/http/errors/errors.d.mts.map +1 -1
- package/esm/http/escape-header-value.d.mts +1 -2
- package/esm/http/escape-header-value.d.mts.map +1 -1
- package/esm/http/events.d.mts +2 -4
- package/esm/http/events.d.mts.map +1 -1
- package/esm/http/health.d.mts +4 -4
- package/esm/http/health.d.mts.map +1 -1
- package/esm/http/index.d.mts +4 -1
- package/esm/http/index.mjs +1 -1
- package/esm/http/middleware/cache-response-middleware.d.mts +2 -4
- package/esm/http/middleware/cache-response-middleware.d.mts.map +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.d.mts +3 -3
- package/esm/http/middleware/concurrency-limit.middleware.d.mts.map +1 -1
- package/esm/http/middleware/idempotency.middleware.d.mts +3 -3
- package/esm/http/middleware/idempotency.middleware.d.mts.map +1 -1
- package/esm/http/middleware/idempotency.middleware.mjs +6 -6
- package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
- package/esm/http/middleware/index.d.mts +3 -1
- package/esm/http/middleware/index.mjs +1 -1
- package/esm/http/middleware/inject-request-context.d.mts +2 -4
- package/esm/http/middleware/inject-request-context.d.mts.map +1 -1
- package/esm/http/middleware/inject-request-context.mjs +3 -3
- package/esm/http/middleware/inject-request-context.mjs.map +1 -1
- package/esm/http/middleware/ip-filter.middleware.d.mts +3 -3
- package/esm/http/middleware/ip-filter.middleware.d.mts.map +1 -1
- package/esm/http/middleware/maintenance.middleware.d.mts +3 -3
- package/esm/http/middleware/maintenance.middleware.d.mts.map +1 -1
- package/esm/http/middleware/maintenance.middleware.mjs +4 -4
- package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
- package/esm/http/middleware/max-body-size.middleware.d.mts +2 -2
- package/esm/http/middleware/max-body-size.middleware.d.mts.map +1 -1
- package/esm/http/middleware/middleware-list.d.mts +1 -3
- package/esm/http/middleware/middleware-list.d.mts.map +1 -1
- package/esm/http/middleware/rate-limit.middleware.d.mts +3 -3
- package/esm/http/middleware/rate-limit.middleware.d.mts.map +1 -1
- package/esm/http/middleware/rate-limit.middleware.mjs +2 -2
- package/esm/http/middleware/rate-limit.middleware.mjs.map +1 -1
- package/esm/http/middleware/utils/cidr-match.d.mts +2 -3
- package/esm/http/middleware/utils/cidr-match.d.mts.map +1 -1
- package/esm/http/middleware/utils/idempotency-key.d.mts +3 -5
- package/esm/http/middleware/utils/idempotency-key.d.mts.map +1 -1
- package/esm/http/middleware/utils/index.d.mts +2 -1
- package/esm/http/middleware/utils/parse-size.d.mts +1 -2
- package/esm/http/middleware/utils/parse-size.d.mts.map +1 -1
- package/esm/http/middleware/utils/parse-size.mjs +2 -2
- package/esm/http/middleware/utils/parse-size.mjs.map +1 -1
- package/esm/http/plugins.d.mts +2 -4
- package/esm/http/plugins.d.mts.map +1 -1
- package/esm/http/plugins.mjs +10 -10
- package/esm/http/plugins.mjs.map +1 -1
- package/esm/http/port-preflight.d.mts +3 -4
- package/esm/http/port-preflight.d.mts.map +1 -1
- package/esm/http/port-preflight.mjs +2 -0
- package/esm/http/port-preflight.mjs.map +1 -1
- package/esm/http/rate-limit-cache-store.mjs +4 -3
- package/esm/http/rate-limit-cache-store.mjs.map +1 -1
- package/esm/http/ready-report.d.mts +15 -10
- package/esm/http/ready-report.d.mts.map +1 -1
- package/esm/http/request-controller.d.mts +1 -3
- package/esm/http/request-controller.d.mts.map +1 -1
- package/esm/http/request-log-snapshot.d.mts +20 -16
- package/esm/http/request-log-snapshot.d.mts.map +1 -1
- package/esm/http/request-log-snapshot.mjs +3 -3
- package/esm/http/request-log-snapshot.mjs.map +1 -1
- package/esm/http/request.d.mts +8 -7
- package/esm/http/request.d.mts.map +1 -1
- package/esm/http/request.mjs +8 -7
- package/esm/http/request.mjs.map +1 -1
- package/esm/http/response.d.mts +12 -11
- package/esm/http/response.d.mts.map +1 -1
- package/esm/http/response.mjs +7 -7
- package/esm/http/response.mjs.map +1 -1
- package/esm/http/safe-redirect.d.mts +3 -4
- package/esm/http/safe-redirect.d.mts.map +1 -1
- package/esm/http/serialized.d.mts +12 -13
- package/esm/http/serialized.d.mts.map +1 -1
- package/esm/http/server-rebuilt.d.mts +3 -5
- package/esm/http/server-rebuilt.d.mts.map +1 -1
- package/esm/http/server.d.mts +9 -9
- package/esm/http/server.d.mts.map +1 -1
- package/esm/http/server.mjs +4 -4
- package/esm/http/server.mjs.map +1 -1
- package/esm/http/stream-react-response.d.mts +7 -7
- package/esm/http/stream-react-response.d.mts.map +1 -1
- package/esm/http/tracing/index.mjs +1 -1
- package/esm/http/tracing/trace-id.d.mts +2 -3
- package/esm/http/tracing/trace-id.d.mts.map +1 -1
- package/esm/http/tracing/tracing-dispatcher.d.mts +10 -11
- package/esm/http/tracing/tracing-dispatcher.d.mts.map +1 -1
- package/esm/http/tracing/tracing-dispatcher.mjs +2 -2
- package/esm/http/tracing/tracing-dispatcher.mjs.map +1 -1
- package/esm/http/tracing/tracing.type.d.mts +11 -9
- package/esm/http/tracing/tracing.type.d.mts.map +1 -1
- package/esm/http/types.d.mts +49 -43
- package/esm/http/types.d.mts.map +1 -1
- package/esm/http/uploaded-file.d.mts +6 -5
- package/esm/http/uploaded-file.d.mts.map +1 -1
- package/esm/http/uploads/generate-image-variants.d.mts +6 -6
- package/esm/http/uploads/generate-image-variants.d.mts.map +1 -1
- package/esm/http/uploads/generate-image-variants.mjs +1 -1
- package/esm/http/uploads/generate-image-variants.mjs.map +1 -1
- package/esm/http/uploads/image-variant-cache-entries.mjs +1 -1
- package/esm/http/uploads/image-variant-cache.mjs +8 -8
- package/esm/http/uploads/image-variant-cache.mjs.map +1 -1
- package/esm/http/uploads/image-variant-types.d.mts +7 -9
- package/esm/http/uploads/image-variant-types.d.mts.map +1 -1
- package/esm/http/uploads/image-variants-config-error.d.mts +1 -2
- package/esm/http/uploads/image-variants-config-error.d.mts.map +1 -1
- package/esm/http/uploads/index.d.mts +2 -1
- package/esm/http/uploads/index.mjs +1 -1
- package/esm/http/uploads/parse-uploaded-file-query.mjs +1 -1
- package/esm/http/uploads/parse-uploaded-file-query.mjs.map +1 -1
- package/esm/http/uploads/purge-image-variants.d.mts +2 -4
- package/esm/http/uploads/purge-image-variants.d.mts.map +1 -1
- package/esm/http/uploads/resolve-image-variant.d.mts +3 -5
- package/esm/http/uploads/resolve-image-variant.d.mts.map +1 -1
- package/esm/http/uploads/resolve-image-variants-config.mjs +4 -4
- package/esm/http/uploads/resolve-image-variants-config.mjs.map +1 -1
- package/esm/http/uploads/resolve-original-content-type.mjs +1 -1
- package/esm/http/uploads/resolve-original-content-type.mjs.map +1 -1
- package/esm/http/uploads/trim-image-variant-cache.mjs +3 -3
- package/esm/http/uploads/trim-image-variant-cache.mjs.map +1 -1
- package/esm/http/uploads/uploaded-file.controller.d.mts +6 -5
- package/esm/http/uploads/uploaded-file.controller.d.mts.map +1 -1
- package/esm/http/uploads/uploaded-file.controller.mjs +2 -1
- package/esm/http/uploads/uploaded-file.controller.mjs.map +1 -1
- package/esm/http/uploads/variant-cache-key.mjs +1 -1
- package/esm/http/uploads-config.d.mts +2 -4
- package/esm/http/uploads-config.d.mts.map +1 -1
- package/esm/http/uploads-types.d.mts +19 -17
- package/esm/http/uploads-types.d.mts.map +1 -1
- package/esm/http/xmlable.d.mts +1 -2
- package/esm/http/xmlable.d.mts.map +1 -1
- package/esm/image/image.d.mts +6 -7
- package/esm/image/image.d.mts.map +1 -1
- package/esm/image/image.mjs.map +1 -1
- package/esm/image/index.d.mts +2 -1
- package/esm/image/index.mjs +1 -1
- package/esm/index.d.mts +28 -2
- package/esm/index.mjs +7 -2
- package/esm/loader/app-module-importer.d.mts +1 -2
- package/esm/loader/app-module-importer.d.mts.map +1 -1
- package/esm/localization/index.mjs +1 -1
- package/esm/localization/parse-locale-dictionary.d.mts +4 -5
- package/esm/localization/parse-locale-dictionary.d.mts.map +1 -1
- package/esm/localization/parse-locale-dictionary.mjs +1 -1
- package/esm/localization/parse-locale-dictionary.mjs.map +1 -1
- package/esm/localization/register-locale-dictionary.d.mts +3 -4
- package/esm/localization/register-locale-dictionary.d.mts.map +1 -1
- package/esm/localization/register-locale-dictionary.mjs +2 -2
- package/esm/localization/register-locale-dictionary.mjs.map +1 -1
- package/esm/logger/fatal-visibility.d.mts +1 -2
- package/esm/logger/fatal-visibility.d.mts.map +1 -1
- package/esm/logger/index.d.mts +2 -1
- package/esm/logger/index.mjs +1 -1
- package/esm/logger/logger.d.mts +1 -3
- package/esm/logger/logger.d.mts.map +1 -1
- package/esm/logger/types.d.mts +2 -3
- package/esm/logger/types.d.mts.map +1 -1
- package/esm/mail/config.d.mts +12 -14
- package/esm/mail/config.d.mts.map +1 -1
- package/esm/mail/events.d.mts +4 -6
- package/esm/mail/events.d.mts.map +1 -1
- package/esm/mail/index.d.mts +2 -1
- package/esm/mail/index.mjs +1 -1
- package/esm/mail/mail.d.mts +1 -3
- package/esm/mail/mail.d.mts.map +1 -1
- package/esm/mail/mailer-pool.d.mts +5 -7
- package/esm/mail/mailer-pool.d.mts.map +1 -1
- package/esm/mail/react-mail.d.mts +1 -3
- package/esm/mail/react-mail.d.mts.map +1 -1
- package/esm/mail/send-mail.d.mts +1 -3
- package/esm/mail/send-mail.d.mts.map +1 -1
- package/esm/mail/send-mail.mjs +2 -1
- package/esm/mail/send-mail.mjs.map +1 -1
- package/esm/mail/test-mailbox.d.mts +11 -13
- package/esm/mail/test-mailbox.d.mts.map +1 -1
- package/esm/mail/types.d.mts +17 -18
- package/esm/mail/types.d.mts.map +1 -1
- package/esm/manifest/manifest-manager.mjs +1 -1
- package/esm/openapi/build-openapi-document.d.mts +2 -4
- package/esm/openapi/build-openapi-document.d.mts.map +1 -1
- package/esm/openapi/cast-schema.mjs +1 -1
- package/esm/openapi/development-openapi-provider.d.mts +5 -6
- package/esm/openapi/development-openapi-provider.d.mts.map +1 -1
- package/esm/openapi/index.d.mts +3 -1
- package/esm/openapi/index.mjs +1 -1
- package/esm/openapi/openapi-child-output.mjs +2 -2
- package/esm/openapi/openapi-child-output.mjs.map +1 -1
- package/esm/openapi/postman/build-request-url.mjs +1 -1
- package/esm/openapi/postman/example-from-schema.d.mts +1 -3
- package/esm/openapi/postman/example-from-schema.d.mts.map +1 -1
- package/esm/openapi/postman/index.d.mts +2 -1
- package/esm/openapi/postman/openapi-to-postman-collection.d.mts +3 -5
- package/esm/openapi/postman/openapi-to-postman-collection.d.mts.map +1 -1
- package/esm/openapi/postman/postman-types.d.mts +19 -18
- package/esm/openapi/postman/postman-types.d.mts.map +1 -1
- package/esm/openapi/postman/schema-refs.d.mts +1 -3
- package/esm/openapi/postman/schema-refs.d.mts.map +1 -1
- package/esm/openapi/postman/uuid-v5.mjs +1 -1
- package/esm/openapi/schema-registry.d.mts +1 -1
- package/esm/openapi/security.mjs +1 -1
- package/esm/openapi/types.d.mts +23 -21
- package/esm/openapi/types.d.mts.map +1 -1
- package/esm/production/assert-generated-imports.mjs +1 -1
- package/esm/production/build-contributions.mjs +1 -1
- package/esm/production/bundle-framework-dependencies.mjs +1 -1
- package/esm/production/dist-build-manifest.mjs +1 -1
- package/esm/production/esbuild-plugins.mjs.map +1 -1
- package/esm/production/esbuild-preflight.mjs +1 -1
- package/esm/production/production-builder.mjs +2 -1
- package/esm/production/production-builder.mjs.map +1 -1
- package/esm/production/production-supervisor.mjs +1 -1
- package/esm/production/registration-child-runner.mjs +4 -3
- package/esm/production/registration-child-runner.mjs.map +1 -1
- package/esm/production/resolve-build-config.d.mts +4 -4
- package/esm/production/resolve-build-config.d.mts.map +1 -1
- package/esm/production/resolve-build-config.mjs +1 -1
- package/esm/production/route-registration-child.d.mts +1 -1
- package/esm/production/route-registration-child.mjs +8 -7
- package/esm/production/route-registration-child.mjs.map +1 -1
- package/esm/production/tsconfig-path-aliases.mjs +1 -1
- package/esm/react/index.d.mts +1 -3
- package/esm/react/index.d.mts.map +1 -1
- package/esm/react/index.mjs.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.d.mts +3 -4
- package/esm/repositories/adapters/cascade/cascade-adapter.d.mts.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts +2 -3
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts.map +1 -1
- package/esm/repositories/adapters/cascade/filter-applicator.mjs +10 -9
- package/esm/repositories/adapters/cascade/filter-applicator.mjs.map +1 -1
- package/esm/repositories/adapters/cascade/index.d.mts +2 -1
- package/esm/repositories/adapters/cascade/index.mjs +1 -1
- package/esm/repositories/contracts/index.d.mts +2 -1
- package/esm/repositories/contracts/query-builder.contract.d.mts +4 -6
- package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
- package/esm/repositories/contracts/repository-adapter.contract.d.mts +1 -3
- package/esm/repositories/contracts/repository-adapter.contract.d.mts.map +1 -1
- package/esm/repositories/contracts/types.d.mts +23 -25
- package/esm/repositories/contracts/types.d.mts.map +1 -1
- package/esm/repositories/index.d.mts +4 -1
- package/esm/repositories/index.mjs +1 -1
- package/esm/repositories/repository.manager.d.mts +2 -3
- package/esm/repositories/repository.manager.d.mts.map +1 -1
- package/esm/repositories/repository.manager.mjs +2 -2
- package/esm/repositories/repository.manager.mjs.map +1 -1
- package/esm/resource/define-resource.d.mts +3 -5
- package/esm/resource/define-resource.d.mts.map +1 -1
- package/esm/resource/index.d.mts +2 -1
- package/esm/resource/index.mjs +1 -1
- package/esm/resource/nullable-resource.d.mts +5 -7
- package/esm/resource/nullable-resource.d.mts.map +1 -1
- package/esm/resource/register-resource.d.mts +1 -3
- package/esm/resource/register-resource.d.mts.map +1 -1
- package/esm/resource/resource-field-builder.d.mts +1 -3
- package/esm/resource/resource-field-builder.d.mts.map +1 -1
- package/esm/resource/resource.d.mts +3 -5
- package/esm/resource/resource.d.mts.map +1 -1
- package/esm/resource/resource.mjs +4 -2
- package/esm/resource/resource.mjs.map +1 -1
- package/esm/resource/types.d.mts +21 -21
- package/esm/resource/types.d.mts.map +1 -1
- package/esm/restful/index.d.mts +2 -1
- package/esm/restful/index.mjs +1 -1
- package/esm/restful/restful.d.mts +12 -32
- package/esm/restful/restful.d.mts.map +1 -1
- package/esm/router/index.d.mts +2 -1
- package/esm/router/index.mjs +1 -1
- package/esm/router/named-api-routes-with-responses.mjs +2 -1
- package/esm/router/named-api-routes-with-responses.mjs.map +1 -1
- package/esm/router/normalize-request-path.d.mts +1 -2
- package/esm/router/normalize-request-path.d.mts.map +1 -1
- package/esm/router/normalize-route-path.d.mts +1 -2
- package/esm/router/normalize-route-path.d.mts.map +1 -1
- package/esm/router/positional-handler-diagnostics.d.mts +15 -13
- package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
- package/esm/router/resolve-route-rate-limit.mjs +3 -3
- package/esm/router/resolve-route-rate-limit.mjs.map +1 -1
- package/esm/router/route-builder.d.mts +1 -3
- package/esm/router/route-builder.d.mts.map +1 -1
- package/esm/router/route-guard-names.mjs +1 -1
- package/esm/router/route-guard-names.mjs.map +1 -1
- package/esm/router/route-name-method-suffix.d.mts +2 -3
- package/esm/router/route-name-method-suffix.d.mts.map +1 -1
- package/esm/router/route-name-taken-error.d.mts +1 -3
- package/esm/router/route-name-taken-error.d.mts.map +1 -1
- package/esm/router/route-registry.d.mts +1 -3
- package/esm/router/route-registry.d.mts.map +1 -1
- package/esm/router/router.d.mts +2 -4
- package/esm/router/router.d.mts.map +1 -1
- package/esm/router/router.mjs +8 -6
- package/esm/router/router.mjs.map +1 -1
- package/esm/router/types.d.mts +25 -26
- package/esm/router/types.d.mts.map +1 -1
- package/esm/router/unguarded-route-diagnostics.d.mts +6 -8
- package/esm/router/unguarded-route-diagnostics.d.mts.map +1 -1
- package/esm/secrets/errors.d.mts +9 -0
- package/esm/secrets/errors.d.mts.map +1 -0
- package/esm/secrets/errors.mjs +22 -0
- package/esm/secrets/errors.mjs.map +1 -0
- package/esm/secrets/file-backend.mjs +167 -0
- package/esm/secrets/file-backend.mjs.map +1 -0
- package/esm/secrets/index.d.mts +6 -0
- package/esm/secrets/index.mjs +6 -0
- package/esm/secrets/keyring-backend.mjs +50 -0
- package/esm/secrets/keyring-backend.mjs.map +1 -0
- package/esm/secrets/memory-backend.d.mts +12 -0
- package/esm/secrets/memory-backend.d.mts.map +1 -0
- package/esm/secrets/memory-backend.mjs +28 -0
- package/esm/secrets/memory-backend.mjs.map +1 -0
- package/esm/secrets/secret-store.d.mts +25 -0
- package/esm/secrets/secret-store.d.mts.map +1 -0
- package/esm/secrets/secret-store.mjs +117 -0
- package/esm/secrets/secret-store.mjs.map +1 -0
- package/esm/secrets/secrets.d.mts +11 -0
- package/esm/secrets/secrets.d.mts.map +1 -0
- package/esm/secrets/secrets.mjs +63 -0
- package/esm/secrets/secrets.mjs.map +1 -0
- package/esm/secrets/types.d.mts +22 -0
- package/esm/secrets/types.d.mts.map +1 -0
- package/esm/socket/index.d.mts +2 -1
- package/esm/socket/index.mjs +2 -2
- package/esm/socket/types.d.mts +2 -4
- package/esm/socket/types.d.mts.map +1 -1
- package/esm/socket/utils.d.mts +8 -3
- package/esm/socket/utils.d.mts.map +1 -1
- package/esm/socket/utils.mjs +12 -1
- package/esm/socket/utils.mjs.map +1 -1
- package/esm/storage/config.d.mts +4 -6
- package/esm/storage/config.d.mts.map +1 -1
- package/esm/storage/context/storage-driver-context.d.mts +3 -4
- package/esm/storage/context/storage-driver-context.d.mts.map +1 -1
- package/esm/storage/drivers/cloud-driver.d.mts +2 -4
- package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
- package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
- package/esm/storage/drivers/do-spaces-driver.d.mts +1 -3
- package/esm/storage/drivers/do-spaces-driver.d.mts.map +1 -1
- package/esm/storage/drivers/local-driver.d.mts +2 -3
- package/esm/storage/drivers/local-driver.d.mts.map +1 -1
- package/esm/storage/drivers/local-driver.mjs +8 -3
- package/esm/storage/drivers/local-driver.mjs.map +1 -1
- package/esm/storage/drivers/r2-driver.d.mts +1 -3
- package/esm/storage/drivers/r2-driver.d.mts.map +1 -1
- package/esm/storage/drivers/s3-driver.d.mts +1 -3
- package/esm/storage/drivers/s3-driver.d.mts.map +1 -1
- package/esm/storage/index.d.mts +2 -1
- package/esm/storage/index.mjs +1 -1
- package/esm/storage/local-disk-roots.mjs +2 -2
- package/esm/storage/local-disk-roots.mjs.map +1 -1
- package/esm/storage/scoped-storage.d.mts +2 -3
- package/esm/storage/scoped-storage.d.mts.map +1 -1
- package/esm/storage/storage-file.d.mts +1 -3
- package/esm/storage/storage-file.d.mts.map +1 -1
- package/esm/storage/storage.d.mts +3 -4
- package/esm/storage/storage.d.mts.map +1 -1
- package/esm/storage/types.d.mts +36 -36
- package/esm/storage/types.d.mts.map +1 -1
- package/esm/storage/utils/classify-ip-address.d.mts +1 -2
- package/esm/storage/utils/classify-ip-address.d.mts.map +1 -1
- package/esm/storage/utils/contain-path.d.mts +1 -2
- package/esm/storage/utils/contain-path.d.mts.map +1 -1
- package/esm/storage/utils/mime.d.mts +2 -3
- package/esm/storage/utils/mime.d.mts.map +1 -1
- package/esm/storage/utils/safe-fetch.d.mts +6 -6
- package/esm/storage/utils/safe-fetch.d.mts.map +1 -1
- package/esm/storage/utils/safe-fetch.mjs +3 -3
- package/esm/storage/utils/safe-fetch.mjs.map +1 -1
- package/esm/storage/utils/storage-capability-error.d.mts +1 -3
- package/esm/storage/utils/storage-capability-error.d.mts.map +1 -1
- package/esm/storage/utils/storage-error.d.mts +2 -3
- package/esm/storage/utils/storage-error.d.mts.map +1 -1
- package/esm/storage/utils/storage-not-initialized-error.d.mts +1 -2
- package/esm/storage/utils/storage-not-initialized-error.d.mts.map +1 -1
- package/esm/tests/authenticated-test-client.d.mts +5 -6
- package/esm/tests/authenticated-test-client.d.mts.map +1 -1
- package/esm/tests/factories.d.mts +38 -23
- package/esm/tests/factories.d.mts.map +1 -1
- package/esm/tests/fakes/cache-fake.d.mts +14 -9
- package/esm/tests/fakes/cache-fake.d.mts.map +1 -1
- package/esm/tests/fakes/clock-fake.d.mts +13 -8
- package/esm/tests/fakes/clock-fake.d.mts.map +1 -1
- package/esm/tests/fakes/fake-assertion-error.d.mts +2 -3
- package/esm/tests/fakes/fake-assertion-error.d.mts.map +1 -1
- package/esm/tests/fakes/ids-fake.d.mts +5 -4
- package/esm/tests/fakes/ids-fake.d.mts.map +1 -1
- package/esm/tests/fakes/index.d.mts +3 -1
- package/esm/tests/fakes/index.mjs +2 -1
- package/esm/tests/fakes/mail-fake.d.mts +21 -13
- package/esm/tests/fakes/mail-fake.d.mts.map +1 -1
- package/esm/tests/fakes/queue-fake.d.mts +21 -13
- package/esm/tests/fakes/queue-fake.d.mts.map +1 -1
- package/esm/tests/fakes/secrets-fake.d.mts +13 -0
- package/esm/tests/fakes/secrets-fake.d.mts.map +1 -0
- package/esm/tests/fakes/secrets-fake.mjs +50 -0
- package/esm/tests/fakes/secrets-fake.mjs.map +1 -0
- package/esm/tests/fakes/storage-fake.d.mts +12 -8
- package/esm/tests/fakes/storage-fake.d.mts.map +1 -1
- package/esm/tests/fakes/storage-fake.mjs +1 -1
- package/esm/tests/fakes/test-fakes.d.mts +9 -10
- package/esm/tests/fakes/test-fakes.d.mts.map +1 -1
- package/esm/tests/fakes/test-fakes.mjs +6 -3
- package/esm/tests/fakes/test-fakes.mjs.map +1 -1
- package/esm/tests/index.d.mts +3 -1
- package/esm/tests/index.mjs +2 -1
- package/esm/tests/snapshot-response.d.mts +4 -5
- package/esm/tests/snapshot-response.d.mts.map +1 -1
- package/esm/tests/start-http-development-server.d.mts +4 -6
- package/esm/tests/start-http-development-server.d.mts.map +1 -1
- package/esm/tests/start-http-development-server.mjs +5 -5
- package/esm/tests/start-http-development-server.mjs.map +1 -1
- package/esm/tests/test-connectors-selection.d.mts +2 -2
- package/esm/tests/test-connectors-selection.d.mts.map +1 -1
- package/esm/tests/test-connectors-selection.mjs +1 -1
- package/esm/tests/test-helpers.d.mts +11 -12
- package/esm/tests/test-helpers.d.mts.map +1 -1
- package/esm/tests/test-http-server.d.mts +14 -10
- package/esm/tests/test-http-server.d.mts.map +1 -1
- package/esm/tests/test-lifecycle-state.mjs +1 -1
- package/esm/tests/vitest-setup.d.mts +7 -8
- package/esm/tests/vitest-setup.d.mts.map +1 -1
- package/esm/tests/vitest-setup.mjs.map +1 -1
- package/esm/tooling/agents-md/agents-md-markers.d.mts +4 -5
- package/esm/tooling/agents-md/agents-md-markers.d.mts.map +1 -1
- package/esm/tooling/agents-md/agents-md-markers.mjs +2 -1
- package/esm/tooling/agents-md/agents-md-markers.mjs.map +1 -1
- package/esm/tooling/agents-md/agents-md-refresher.d.mts +19 -12
- package/esm/tooling/agents-md/agents-md-refresher.d.mts.map +1 -1
- package/esm/tooling/agents-md/installed-skills.d.mts +13 -9
- package/esm/tooling/agents-md/installed-skills.d.mts.map +1 -1
- package/esm/tooling/agents-md/render-agents-md.d.mts +8 -7
- package/esm/tooling/agents-md/render-agents-md.d.mts.map +1 -1
- package/esm/tooling/agents-md/render-agents-md.mjs +2 -2
- package/esm/tooling/agents-md/render-agents-md.mjs.map +1 -1
- package/esm/tooling/agents-md/write-agents-md.d.mts +17 -12
- package/esm/tooling/agents-md/write-agents-md.d.mts.map +1 -1
- package/esm/tooling/board/board-message.d.mts +4 -6
- package/esm/tooling/board/board-message.d.mts.map +1 -1
- package/esm/tooling/board/board.d.mts +50 -38
- package/esm/tooling/board/board.d.mts.map +1 -1
- package/esm/tooling/board/board.mjs +4 -3
- package/esm/tooling/board/board.mjs.map +1 -1
- package/esm/tooling/board/board.types.d.mts +32 -23
- package/esm/tooling/board/board.types.d.mts.map +1 -1
- package/esm/tooling/check/changed-files.d.mts +4 -6
- package/esm/tooling/check/changed-files.d.mts.map +1 -1
- package/esm/tooling/check/changed-files.mjs +2 -2
- package/esm/tooling/check/changed-files.mjs.map +1 -1
- package/esm/tooling/check/check-report.types.d.mts +22 -17
- package/esm/tooling/check/check-report.types.d.mts.map +1 -1
- package/esm/tooling/check/code-style-conventions.mjs +25 -25
- package/esm/tooling/check/code-style-conventions.mjs.map +1 -1
- package/esm/tooling/check/conventions-step.d.mts +4 -6
- package/esm/tooling/check/conventions-step.d.mts.map +1 -1
- package/esm/tooling/check/conventions-step.mjs +7 -18
- package/esm/tooling/check/conventions-step.mjs.map +1 -1
- package/esm/tooling/check/environment-step.d.mts +2 -4
- package/esm/tooling/check/environment-step.d.mts.map +1 -1
- package/esm/tooling/check/environment-step.mjs +1 -1
- package/esm/tooling/check/index.mjs +1 -1
- package/esm/tooling/check/lint-step.d.mts +5 -12
- package/esm/tooling/check/lint-step.d.mts.map +1 -1
- package/esm/tooling/check/lint-step.mjs +16 -12
- package/esm/tooling/check/lint-step.mjs.map +1 -1
- package/esm/tooling/check/request-input.mjs +15 -15
- package/esm/tooling/check/request-input.mjs.map +1 -1
- package/esm/tooling/check/run-check.d.mts +24 -14
- package/esm/tooling/check/run-check.d.mts.map +1 -1
- package/esm/tooling/check/run-check.mjs +2 -2
- package/esm/tooling/check/run-check.mjs.map +1 -1
- package/esm/tooling/check/run-tests.d.mts +22 -15
- package/esm/tooling/check/run-tests.d.mts.map +1 -1
- package/esm/tooling/check/security-conventions.mjs +133 -131
- package/esm/tooling/check/security-conventions.mjs.map +1 -1
- package/esm/tooling/check/source-ast.mjs +92 -132
- package/esm/tooling/check/source-ast.mjs.map +1 -1
- package/esm/tooling/check/tests-step.d.mts +7 -8
- package/esm/tooling/check/tests-step.d.mts.map +1 -1
- package/esm/tooling/check/tests-step.mjs +3 -3
- package/esm/tooling/check/tests-step.mjs.map +1 -1
- package/esm/tooling/dev-state/dev-server-state.d.mts +17 -13
- package/esm/tooling/dev-state/dev-server-state.d.mts.map +1 -1
- package/esm/tooling/devtools/devtools-client.d.mts +29 -20
- package/esm/tooling/devtools/devtools-client.d.mts.map +1 -1
- package/esm/tooling/generate/generation.d.mts +34 -22
- package/esm/tooling/generate/generation.d.mts.map +1 -1
- package/esm/tooling/generate/generation.mjs +9 -5
- package/esm/tooling/generate/generation.mjs.map +1 -1
- package/esm/tooling/generate/generator-spec.d.mts +9 -9
- package/esm/tooling/generate/generator-spec.d.mts.map +1 -1
- package/esm/tooling/generate/index.mjs +1 -1
- package/esm/tooling/generate/project-files.mjs +3 -3
- package/esm/tooling/generate/project-files.mjs.map +1 -1
- package/esm/tooling/generate/run-cli.d.mts +14 -11
- package/esm/tooling/generate/run-cli.d.mts.map +1 -1
- package/esm/tooling/generate/run-cli.mjs +2 -2
- package/esm/tooling/generate/run-cli.mjs.map +1 -1
- package/esm/tooling/generate/unified-diff.d.mts +10 -7
- package/esm/tooling/generate/unified-diff.d.mts.map +1 -1
- package/esm/tooling/index.d.mts +1 -0
- package/esm/tooling/inspect/boot-for-inspect.d.mts +7 -7
- package/esm/tooling/inspect/boot-for-inspect.d.mts.map +1 -1
- package/esm/tooling/inspect/collect-config.mjs +3 -3
- package/esm/tooling/inspect/collect-config.mjs.map +1 -1
- package/esm/tooling/inspect/collect-models.d.mts +4 -3
- package/esm/tooling/inspect/collect-models.d.mts.map +1 -1
- package/esm/tooling/inspect/collect-models.mjs +1 -1
- package/esm/tooling/inspect/collect-packages.d.mts +1 -2
- package/esm/tooling/inspect/collect-packages.d.mts.map +1 -1
- package/esm/tooling/inspect/collect-pages.mjs +10 -10
- package/esm/tooling/inspect/collect-pages.mjs.map +1 -1
- package/esm/tooling/inspect/collect-routes.mjs +1 -1
- package/esm/tooling/inspect/event-recorder.d.mts +7 -7
- package/esm/tooling/inspect/event-recorder.d.mts.map +1 -1
- package/esm/tooling/inspect/index.d.mts +2 -1
- package/esm/tooling/inspect/index.mjs +1 -1
- package/esm/tooling/inspect/inspect-app.d.mts +25 -16
- package/esm/tooling/inspect/inspect-app.d.mts.map +1 -1
- package/esm/tooling/inspect/inspect-report.schema.d.mts +1 -2
- package/esm/tooling/inspect/inspect-report.schema.d.mts.map +1 -1
- package/esm/tooling/inspect/inspect-report.types.d.mts +86 -54
- package/esm/tooling/inspect/inspect-report.types.d.mts.map +1 -1
- package/esm/tooling/mcp/create-mcp-context.d.mts +11 -8
- package/esm/tooling/mcp/create-mcp-context.d.mts.map +1 -1
- package/esm/tooling/mcp/db-schema.d.mts +10 -9
- package/esm/tooling/mcp/db-schema.d.mts.map +1 -1
- package/esm/tooling/mcp/docs-search.d.mts +20 -15
- package/esm/tooling/mcp/docs-search.d.mts.map +1 -1
- package/esm/tooling/mcp/index.mjs +1 -1
- package/esm/tooling/mcp/load-ai-tools.d.mts +7 -8
- package/esm/tooling/mcp/load-ai-tools.d.mts.map +1 -1
- package/esm/tooling/mcp/load-ai-tools.mjs +2 -1
- package/esm/tooling/mcp/load-ai-tools.mjs.map +1 -1
- package/esm/tooling/mcp/mcp-tools.d.mts +29 -19
- package/esm/tooling/mcp/mcp-tools.d.mts.map +1 -1
- package/esm/tooling/mcp/mcp-tools.mjs +3 -2
- package/esm/tooling/mcp/mcp-tools.mjs.map +1 -1
- package/esm/tooling/mcp/start-mcp-server.d.mts +24 -17
- package/esm/tooling/mcp/start-mcp-server.d.mts.map +1 -1
- package/esm/tooling/mcp/start-mcp-server.mjs +1 -1
- package/esm/tooling/mcp/start-mcp-server.mjs.map +1 -1
- package/esm/tooling/mcp/tool-input.d.mts +7 -7
- package/esm/tooling/mcp/tool-input.d.mts.map +1 -1
- package/esm/tooling/problem.d.mts +27 -17
- package/esm/tooling/problem.d.mts.map +1 -1
- package/esm/tooling/syntax/ast.mjs +230 -0
- package/esm/tooling/syntax/ast.mjs.map +1 -0
- package/esm/tooling/syntax/imports.mjs +34 -0
- package/esm/tooling/syntax/imports.mjs.map +1 -0
- package/esm/tooling/trace/trace-report.types.d.mts +36 -22
- package/esm/tooling/trace/trace-report.types.d.mts.map +1 -1
- package/esm/tooling/trace/trace-request.d.mts +27 -20
- package/esm/tooling/trace/trace-request.d.mts.map +1 -1
- package/esm/tooling/trace/trace-request.mjs +2 -2
- package/esm/tooling/trace/trace-request.mjs.map +1 -1
- package/esm/tooling/typecheck/index.mjs +1 -1
- package/esm/tooling/typecheck/run-typecheck.d.mts +15 -48
- package/esm/tooling/typecheck/run-typecheck.d.mts.map +1 -1
- package/esm/tooling/typecheck/run-typecheck.mjs +42 -105
- package/esm/tooling/typecheck/run-typecheck.mjs.map +1 -1
- package/esm/tooling/typescript/compiler.d.mts +31 -0
- package/esm/tooling/typescript/compiler.d.mts.map +1 -0
- package/esm/tooling/typescript/compiler.mjs +120 -0
- package/esm/tooling/typescript/compiler.mjs.map +1 -0
- package/esm/updater/update-warlock-packages.mjs +3 -2
- package/esm/updater/update-warlock-packages.mjs.map +1 -1
- package/esm/upgrade/codemods/index.mjs +3 -1
- package/esm/upgrade/codemods/index.mjs.map +1 -1
- package/esm/upgrade/codemods/logger-sync-calls.mjs +1 -1
- package/esm/upgrade/codemods/logger-sync-calls.mjs.map +1 -1
- package/esm/upgrade/codemods/oxc-toolchain.mjs +142 -0
- package/esm/upgrade/codemods/oxc-toolchain.mjs.map +1 -0
- package/esm/upgrade/codemods/request-log-snapshot.mjs +1 -1
- package/esm/upgrade/codemods/request-log-snapshot.mjs.map +1 -1
- package/esm/upgrade/codemods/toolchain-templates.mjs +244 -0
- package/esm/upgrade/codemods/toolchain-templates.mjs.map +1 -0
- package/esm/upgrade/diff.mjs +1 -1
- package/esm/upgrade/diff.mjs.map +1 -1
- package/esm/upgrade/load-ts-morph.mjs +3 -2
- package/esm/upgrade/load-ts-morph.mjs.map +1 -1
- package/esm/upgrade/run-upgrade.mjs +26 -7
- package/esm/upgrade/run-upgrade.mjs.map +1 -1
- package/esm/use-cases/index.d.mts +2 -1
- package/esm/use-cases/index.mjs +1 -1
- package/esm/use-cases/types.d.mts +116 -63
- package/esm/use-cases/types.d.mts.map +1 -1
- package/esm/use-cases/use-case-broadcast.d.mts +1 -3
- package/esm/use-cases/use-case-broadcast.d.mts.map +1 -1
- package/esm/use-cases/use-case-events.d.mts +3 -5
- package/esm/use-cases/use-case-events.d.mts.map +1 -1
- package/esm/use-cases/use-case-pipeline.d.mts +6 -6
- package/esm/use-cases/use-case-pipeline.d.mts.map +1 -1
- package/esm/use-cases/use-case.d.mts +2 -4
- package/esm/use-cases/use-case.d.mts.map +1 -1
- package/esm/use-cases/use-case.errors.d.mts +1 -3
- package/esm/use-cases/use-case.errors.d.mts.map +1 -1
- package/esm/use-cases/use-cases-registry.d.mts +8 -10
- package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
- package/esm/utils/app-log.d.mts +1 -2
- package/esm/utils/app-log.d.mts.map +1 -1
- package/esm/utils/clock.d.mts +8 -6
- package/esm/utils/clock.d.mts.map +1 -1
- package/esm/utils/database-log.d.mts +3 -4
- package/esm/utils/database-log.d.mts.map +1 -1
- package/esm/utils/environment.d.mts +4 -5
- package/esm/utils/environment.d.mts.map +1 -1
- package/esm/utils/framework-vesion.mjs.map +1 -1
- package/esm/utils/get-localized.d.mts +2 -3
- package/esm/utils/get-localized.d.mts.map +1 -1
- package/esm/utils/ids.d.mts +9 -6
- package/esm/utils/ids.d.mts.map +1 -1
- package/esm/utils/index.d.mts +2 -1
- package/esm/utils/index.mjs +1 -1
- package/esm/utils/normalized-path.d.mts +1 -2
- package/esm/utils/normalized-path.d.mts.map +1 -1
- package/esm/utils/npm-registry.d.mts +1 -2
- package/esm/utils/npm-registry.d.mts.map +1 -1
- package/esm/utils/paths.d.mts +13 -14
- package/esm/utils/paths.d.mts.map +1 -1
- package/esm/utils/paths.mjs +2 -2
- package/esm/utils/paths.mjs.map +1 -1
- package/esm/utils/promise-all-object.d.mts +1 -2
- package/esm/utils/promise-all-object.d.mts.map +1 -1
- package/esm/utils/queue.d.mts +1 -2
- package/esm/utils/queue.d.mts.map +1 -1
- package/esm/utils/runtime.d.mts +11 -10
- package/esm/utils/runtime.d.mts.map +1 -1
- package/esm/utils/sleep.d.mts +1 -2
- package/esm/utils/sleep.d.mts.map +1 -1
- package/esm/utils/sluggable.d.mts +1 -3
- package/esm/utils/sluggable.d.mts.map +1 -1
- package/esm/utils/to-json.d.mts +1 -2
- package/esm/utils/to-json.d.mts.map +1 -1
- package/esm/utils/types.d.mts +1 -2
- package/esm/utils/types.d.mts.map +1 -1
- package/esm/utils/urls.d.mts +5 -6
- package/esm/utils/urls.d.mts.map +1 -1
- package/esm/utils/version-compare.d.mts +1 -2
- package/esm/utils/version-compare.d.mts.map +1 -1
- package/esm/validation/database/exists-except-current-id.d.mts +2 -3
- package/esm/validation/database/exists-except-current-id.d.mts.map +1 -1
- package/esm/validation/database/exists-except-current-user.d.mts +2 -3
- package/esm/validation/database/exists-except-current-user.d.mts.map +1 -1
- package/esm/validation/database/index.d.mts +2 -1
- package/esm/validation/database/index.mjs +1 -1
- package/esm/validation/database/types.d.mts +14 -10
- package/esm/validation/database/types.d.mts.map +1 -1
- package/esm/validation/database/unique-except-current-id.d.mts +2 -3
- package/esm/validation/database/unique-except-current-id.d.mts.map +1 -1
- package/esm/validation/database/unique-except-current-user.d.mts +2 -3
- package/esm/validation/database/unique-except-current-user.d.mts.map +1 -1
- package/esm/validation/file/file.d.mts +4 -6
- package/esm/validation/file/file.d.mts.map +1 -1
- package/esm/validation/file/index.d.mts +2 -1
- package/esm/validation/file/index.mjs +1 -1
- package/esm/validation/index.d.mts +5 -1
- package/esm/validation/index.mjs +1 -1
- package/esm/validation/plugins/index.mjs +1 -1
- package/esm/validation/types.d.mts +6 -4
- package/esm/validation/types.d.mts.map +1 -1
- package/esm/validation/validateAll.mjs +2 -2
- package/esm/validation/validateAll.mjs.map +1 -1
- package/esm/validation/validation-failure-status.mjs +2 -2
- package/esm/validation/validation-failure-status.mjs.map +1 -1
- package/esm/validation/validators/file-validator.d.mts +2 -4
- package/esm/validation/validators/file-validator.d.mts.map +1 -1
- package/esm/validation/validators/index.d.mts +2 -1
- package/esm/validation/validators/index.mjs +1 -1
- package/esm/vite/lower-stage3-decorators.d.mts +2 -3
- package/esm/vite/lower-stage3-decorators.d.mts.map +1 -1
- package/esm/warlock-config/define-config.d.mts +1 -3
- package/esm/warlock-config/define-config.d.mts.map +1 -1
- package/esm/warlock-config/define-config.mjs +3 -2
- package/esm/warlock-config/define-config.mjs.map +1 -1
- package/esm/warlock-config/index.d.mts +2 -1
- package/esm/warlock-config/index.mjs +1 -1
- package/esm/warlock-config/types.d.mts +8 -6
- package/esm/warlock-config/types.d.mts.map +1 -1
- package/esm/warlock-config/warlock-config.manager.d.mts +5 -7
- package/esm/warlock-config/warlock-config.manager.d.mts.map +1 -1
- package/esm/warlock-config/warlock-config.manager.mjs +2 -1
- package/esm/warlock-config/warlock-config.manager.mjs.map +1 -1
- package/esm/warlock-config/warn-deprecated-config.mjs +1 -1
- package/llms-full.txt +379 -22
- package/llms.txt +3 -2
- package/package.json +27 -15
- package/skills/README.md +2 -1
- package/skills/create-module/SKILL.md +7 -0
- package/skills/index.md +3 -1
- package/skills/report-framework-issue.md +154 -0
- package/skills/run-app/SKILL.md +120 -10
- package/skills/store-secrets/SKILL.md +102 -0
- package/skills/test-fakes/SKILL.md +13 -11
- package/skills/upgrade-from-5-29/SKILL.md +78 -0
- package/skills/warlock-check/SKILL.md +6 -1
- package/skills/warlock-doctor/SKILL.md +9 -0
- package/skills/wire-socket/SKILL.md +19 -0
- package/skills/write-cli-command/SKILL.md +21 -0
- package/esm/tooling/check/index.d.mts +0 -8
- package/esm/tooling/typecheck/index.d.mts +0 -1
|
@@ -34,27 +34,35 @@
|
|
|
34
34
|
* it imports nothing.
|
|
35
35
|
*/
|
|
36
36
|
/** The area a code belongs to, matching its first digit. */
|
|
37
|
-
type ErrorCodeArea = "config" | "boot" | "routing" | "validation" | "http" | "database" | "cli" | "environment" | "convention";
|
|
37
|
+
export type ErrorCodeArea = "config" | "boot" | "routing" | "validation" | "http" | "database" | "cli" | "environment" | "convention";
|
|
38
38
|
/**
|
|
39
39
|
* Who has to act: `code` problems are fixed in the project's source or config,
|
|
40
40
|
* `environment` problems on the machine running it.
|
|
41
41
|
*/
|
|
42
|
-
type ErrorCodeCategory = "code" | "environment";
|
|
42
|
+
export type ErrorCodeCategory = "code" | "environment";
|
|
43
43
|
/** One registry entry. */
|
|
44
|
-
type ErrorCodeDefinition = {
|
|
45
|
-
/** The stable code, e.g. `"WL3001"`. */
|
|
46
|
-
readonly
|
|
47
|
-
|
|
48
|
-
readonly
|
|
49
|
-
|
|
50
|
-
readonly
|
|
51
|
-
|
|
44
|
+
export type ErrorCodeDefinition = {
|
|
45
|
+
/** The stable code, e.g. `"WL3001"`. */
|
|
46
|
+
readonly code: string;
|
|
47
|
+
/** The area, matching the first digit. */
|
|
48
|
+
readonly area: ErrorCodeArea;
|
|
49
|
+
/** Whether the project or the machine has to change. */
|
|
50
|
+
readonly category: ErrorCodeCategory;
|
|
51
|
+
/** One-line name of the problem. */
|
|
52
|
+
readonly title: string;
|
|
53
|
+
/** One-line "what to do". */
|
|
54
|
+
readonly fix: string;
|
|
55
|
+
/** Slug of the skill that explains the fix (`packages/<pkg>/skills/<slug>/SKILL.md`). */
|
|
56
|
+
readonly skill: string;
|
|
57
|
+
/** Names of the error classes that carry this code, when an error class does. */
|
|
58
|
+
readonly errorNames?: readonly string[];
|
|
59
|
+
/** Set when the code is no longer emitted. Retired codes are never reused. */
|
|
52
60
|
readonly retired?: true;
|
|
53
61
|
};
|
|
54
62
|
/** Base URL of the error-code reference; each code is an anchor on that page. */
|
|
55
|
-
declare const ERROR_CODES_DOCS_URL = "https://warlock.js.org/v/latest/core/cli/error-codes/";
|
|
63
|
+
export declare const ERROR_CODES_DOCS_URL = "https://warlock.js.org/v/latest/core/cli/error-codes/";
|
|
56
64
|
/** The registry, keyed by code. */
|
|
57
|
-
declare const ERROR_CODES: {
|
|
65
|
+
export declare const ERROR_CODES: {
|
|
58
66
|
readonly WL1001: {
|
|
59
67
|
readonly code: "WL1001";
|
|
60
68
|
readonly area: "config";
|
|
@@ -76,7 +84,7 @@ declare const ERROR_CODES: {
|
|
|
76
84
|
readonly area: "config";
|
|
77
85
|
readonly category: "code";
|
|
78
86
|
readonly title: "The rate-limit store cannot use the configured cache driver";
|
|
79
|
-
readonly fix:
|
|
87
|
+
readonly fix: 'Use a redis, pg or memory cache driver for http.rateLimit store "cache", or set store: "memory".';
|
|
80
88
|
readonly skill: "configure-app";
|
|
81
89
|
readonly errorNames: readonly ["UnsupportedRateLimitDriverError"];
|
|
82
90
|
};
|
|
@@ -181,7 +189,7 @@ declare const ERROR_CODES: {
|
|
|
181
189
|
readonly area: "boot";
|
|
182
190
|
readonly category: "code";
|
|
183
191
|
readonly title: "Storage was used before the storage connector ran";
|
|
184
|
-
readonly fix:
|
|
192
|
+
readonly fix: 'Add src/config/storage.ts; in a custom command add "storage" to preload.connectors.';
|
|
185
193
|
readonly skill: "store-file";
|
|
186
194
|
readonly errorNames: readonly ["StorageNotInitializedError"];
|
|
187
195
|
};
|
|
@@ -198,7 +206,7 @@ declare const ERROR_CODES: {
|
|
|
198
206
|
readonly area: "routing";
|
|
199
207
|
readonly category: "code";
|
|
200
208
|
readonly title: "A route name is already taken";
|
|
201
|
-
readonly fix:
|
|
209
|
+
readonly fix: 'Rename one of the two routes with the "name" route option; pages and API routes share one namespace.';
|
|
202
210
|
readonly skill: "register-route";
|
|
203
211
|
readonly errorNames: readonly ["RouteNameTakenError"];
|
|
204
212
|
};
|
|
@@ -534,7 +542,7 @@ declare const ERROR_CODES: {
|
|
|
534
542
|
readonly area: "convention";
|
|
535
543
|
readonly category: "code";
|
|
536
544
|
readonly title: "tsconfig.json enables legacy experimentalDecorators";
|
|
537
|
-
readonly fix:
|
|
545
|
+
readonly fix: 'Remove "experimentalDecorators": true from tsconfig.json; Cascade uses standard decorators.';
|
|
538
546
|
readonly skill: "lower-stage3-decorators";
|
|
539
547
|
};
|
|
540
548
|
readonly WL9005: {
|
|
@@ -627,16 +635,16 @@ declare const ERROR_CODES: {
|
|
|
627
635
|
};
|
|
628
636
|
};
|
|
629
637
|
/** Every registered code, as a union. */
|
|
630
|
-
type WarlockErrorCode = keyof typeof ERROR_CODES;
|
|
638
|
+
export type WarlockErrorCode = keyof typeof ERROR_CODES;
|
|
631
639
|
/** Whether `value` is a registered code. */
|
|
632
|
-
declare function isWarlockErrorCode(value: unknown): value is WarlockErrorCode;
|
|
640
|
+
export declare function isWarlockErrorCode(value: unknown): value is WarlockErrorCode;
|
|
633
641
|
/**
|
|
634
642
|
* The registry entry for a code, or `undefined` for an unknown one. Case and
|
|
635
643
|
* surrounding whitespace are ignored, so `explainErrorCode(" wl3001 ")` works.
|
|
636
644
|
*/
|
|
637
|
-
declare function explainErrorCode(code: string): ErrorCodeDefinition | undefined;
|
|
645
|
+
export declare function explainErrorCode(code: string): ErrorCodeDefinition | undefined;
|
|
638
646
|
/** The docs URL of a code: the reference page with the code as its anchor. */
|
|
639
|
-
declare function errorCodeDocsUrl(code: WarlockErrorCode): string;
|
|
647
|
+
export declare function errorCodeDocsUrl(code: WarlockErrorCode): string;
|
|
640
648
|
/**
|
|
641
649
|
* The Warlock code of a thrown value, or `undefined` when it has none.
|
|
642
650
|
*
|
|
@@ -647,7 +655,6 @@ declare function errorCodeDocsUrl(code: WarlockErrorCode): string;
|
|
|
647
655
|
* by name rather than `instanceof` keeps the answer right when two copies of
|
|
648
656
|
* core are loaded.
|
|
649
657
|
*/
|
|
650
|
-
declare function errorCodeOf(error: unknown): WarlockErrorCode | undefined;
|
|
658
|
+
export declare function errorCodeOf(error: unknown): WarlockErrorCode | undefined;
|
|
651
659
|
//#endregion
|
|
652
|
-
export { ERROR_CODES, ERROR_CODES_DOCS_URL, ErrorCodeArea, ErrorCodeCategory, ErrorCodeDefinition, WarlockErrorCode, errorCodeDocsUrl, errorCodeOf, explainErrorCode, isWarlockErrorCode };
|
|
653
660
|
//# sourceMappingURL=error-codes.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/errors/error-codes.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"error-codes.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/errors/error-codes.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAoCY;;;;;YAeA;;YAGA;;WAED;;WAEA,MAAM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE;;qBAGA;;aAGT;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAKA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;aACA;;;;YAKQ,gCAAgC;;wBAG5B,mBAAmB,iBAAiB,SAAS;;;;;wBAQ7C,iBAAiB,eAAe;;wBAOhC,iBAAiB,MAAM;;;;;;;;;;;wBA8BvB,YAAY,iBAAiB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WarlockErrorCode } from "./error-codes.mjs";
|
|
2
|
-
|
|
3
2
|
//#region ../../packages/core/src/errors/warlock-error.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* A framework error with a stable {@link WarlockErrorCode}.
|
|
@@ -11,7 +10,7 @@ import { WarlockErrorCode } from "./error-codes.mjs";
|
|
|
11
10
|
* @example
|
|
12
11
|
* throw new WarlockError("WL3003", `Route name "${name}" not found`);
|
|
13
12
|
*/
|
|
14
|
-
declare class WarlockError extends Error {
|
|
13
|
+
export declare class WarlockError extends Error {
|
|
15
14
|
/** Stable Warlock error code; `warlock explain <code>` prints the fix. */
|
|
16
15
|
readonly code: WarlockErrorCode;
|
|
17
16
|
constructor(code: WarlockErrorCode, message: string, options?: {
|
|
@@ -19,5 +18,4 @@ declare class WarlockError extends Error {
|
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
20
|
//#endregion
|
|
22
|
-
export { WarlockError };
|
|
23
21
|
//# sourceMappingURL=warlock-error.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warlock-error.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/errors/warlock-error.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"warlock-error.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/errors/warlock-error.ts"],"mappings":";;;;;;;;;;;;qBAYa,qBAAqB;;WAEhB,MAAM;EAEtB,YAAmB,MAAM,kBAAkB,iBAAiB;IAAY"}
|
|
@@ -138,7 +138,8 @@ async function approvePnpmSharpBuild() {
|
|
|
138
138
|
const layout = pnpmBuildApprovalLayout(getPnpmVersion(rootPath()));
|
|
139
139
|
if (layout === "packageJson") {
|
|
140
140
|
const packageJsonPath = rootPath("package.json");
|
|
141
|
-
|
|
141
|
+
const packageJson = await getJsonFileAsync(packageJsonPath);
|
|
142
|
+
await putJsonFileAsync(packageJsonPath, mergePackageJsonBuildApprovals(packageJson, ["sharp"]));
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
145
|
const current = hasWorkspaceFile ? await getFileAsync(workspacePath) : "";
|
|
@@ -207,5 +208,5 @@ function validateFeatures(features) {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
//#endregion
|
|
210
|
-
export { addCommandAction };
|
|
211
|
+
export { addCommandAction, allowedFeatures, featuresMap, installDependencies, resolveWarlockDependencyVersions };
|
|
211
212
|
//# sourceMappingURL=add-command.action.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-command.action.mjs","names":[],"sources":["../../../../../../../../packages/core/src/generations/add-command.action.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport {\n fileExistsAsync,\n getFileAsync,\n getJsonFileAsync,\n putFileAsync,\n putJsonFileAsync,\n recordSkippedFile,\n} from \"./generation-fs\";\nimport { isGenerationDryRun, setGenerationDetail } from \"./generation-run\";\nimport { execSync } from \"node:child_process\";\nimport type { CommandActionData } from \"../commands/types\";\nimport {\n detectPackageManager,\n getAddCommand,\n getExactAddCommand,\n type PackageManager,\n} from \"../updater/package-manager\";\nimport { rootPath, srcPath } from \"../utils\";\nimport { getWarlockVersion } from \"../utils/framework-vesion\";\nimport { featuresMap } from \"./features\";\nimport {\n getPnpmVersion,\n isInsideParentPnpmWorkspace,\n mergeOnlyBuiltDependencies,\n mergePackageJsonBuildApprovals,\n mergePnpmSharpApproval,\n pnpmBuildApprovalLayout,\n} from \"./pnpm-build-approvals\";\n\nexport { featuresMap };\nexport type { FeatureDefinition } from \"./features\";\n\n/**\n * The parts of a project `package.json` this action reads or writes. Deliberately\n * partial — it describes what we touch, not the whole manifest.\n */\ntype ProjectPackageJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n};\n\nexport const allowedFeatures = Object.keys(featuresMap);\n\nfunction isWarlockPackage(packageName: string): boolean {\n return packageName.startsWith(\"@warlock.js/\");\n}\n\n/**\n * Resolve the internal feature-map placeholder to the version of Core that is\n * actually executing the command. Every @warlock.js package is lockstep, so\n * Core is the single source of truth; non-Warlock dependencies are untouched.\n */\nexport function resolveWarlockDependencyVersions(\n dependencies: Record<string, string>,\n frameworkVersion: string,\n): void {\n for (const dependency of Object.keys(dependencies)) {\n if (isWarlockPackage(dependency)) {\n dependencies[dependency] = frameworkVersion;\n }\n }\n}\n\nfunction resolveFeatures(features: string[], visited = new Set<string>()): string[] {\n const resolved: string[] = [];\n\n for (const feature of features) {\n if (visited.has(feature)) continue;\n visited.add(feature);\n\n const def = featuresMap[feature];\n\n // `addCommandAction` runs `validateFeatures()` before calling this, and the\n // recursive calls below pass `requires` entries that come out of the map\n // itself — so every lookup resolves. Skipping an unresolvable one keeps a\n // typo from crashing the command with `Cannot read properties of\n // undefined`, which names neither the feature nor the fact that it was the\n // ARGUMENT that was wrong.\n if (def === undefined) continue;\n\n if (def.requires?.length) {\n resolved.push(...resolveFeatures(def.requires, visited));\n }\n\n resolved.push(feature);\n }\n\n return resolved;\n}\n\nexport async function addCommandAction(options: CommandActionData) {\n const features = options.args;\n const { packageManager, list, noInstall } = options.options;\n\n if (list) {\n setGenerationDetail(\n \"features\",\n allowedFeatures.map((feature) => ({\n name: feature,\n description: featuresMap[feature]?.description ?? \"\",\n })),\n );\n\n console.log(\"Available Features:\");\n\n for (const feature of allowedFeatures) {\n const definition = featuresMap[feature];\n\n // `allowedFeatures` is derived from this same map, so this resolves.\n if (definition === undefined) continue;\n\n console.log(`- ${colors.yellowBright(feature)}: ${colors.green(definition.description)}`);\n }\n\n process.exit(0);\n }\n\n validateFeatures(features);\n\n const resolvedFeatures = resolveFeatures(features);\n\n const dependencies: Record<string, string> = {};\n const devDependencies: Record<string, string> = {};\n const ejectConfigs: Record<string, { content: string; name: string }> = {};\n const scripts: Record<string, string> = {};\n\n for (const feature of resolvedFeatures) {\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\n\n // Validated upstream; see the note in resolveFeatures above.\n if (featurePackages === undefined) continue;\n\n Object.assign(dependencies, featurePackages.dependencies);\n if (featurePackages.devDependencies) {\n Object.assign(devDependencies, featurePackages.devDependencies);\n }\n\n if (featurePackages.ejectConfig) {\n ejectConfigs[featurePackages.ejectConfig.name] = featurePackages.ejectConfig;\n }\n\n if (featurePackages.script) {\n Object.assign(scripts, featurePackages.script);\n }\n }\n\n // Pin every @warlock.js/* feature package to the INSTALLED framework version so\n // a scaffolded project's features match its core version instead of drifting to\n // the feature map's static range.\n const frameworkVersion = await getWarlockVersion();\n resolveWarlockDependencyVersions(dependencies, frameworkVersion);\n resolveWarlockDependencyVersions(devDependencies, frameworkVersion);\n\n const currentPackageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\n\n // Fresh templates may omit one of the maps — guard before reading.\n currentPackageJson.dependencies = currentPackageJson.dependencies ?? {};\n currentPackageJson.devDependencies = currentPackageJson.devDependencies ?? {};\n\n // Skip anything already present so we never downgrade an existing pin.\n for (const dependency of Object.keys(dependencies)) {\n if (currentPackageJson.dependencies[dependency]) {\n console.log(`${colors.yellowBright(dependency)} is already installed, skipping...`);\n delete dependencies[dependency];\n }\n }\n\n for (const devDependency of Object.keys(devDependencies)) {\n if (currentPackageJson.devDependencies[devDependency]) {\n console.log(`${colors.yellowBright(devDependency)} is already installed, skipping...`);\n delete devDependencies[devDependency];\n }\n }\n\n setGenerationDetail(\"features\", resolvedFeatures);\n setGenerationDetail(\"dependencies\", { ...dependencies });\n setGenerationDetail(\"devDependencies\", { ...devDependencies });\n\n if (isGenerationDryRun()) {\n // A preview installs nothing; package.json is \"edited\" in the overlay so\n // the report lists it, and later steps read the previewed manifest.\n console.log(\n `Dry run: would install ${colors.magenta(Object.keys({ ...dependencies, ...devDependencies }).join(\", \") || \"nothing\")}`,\n );\n await recordDependencies(dependencies, devDependencies);\n } else if (noInstall) {\n await recordDependencies(dependencies, devDependencies);\n } else {\n const resolvedPackageManager =\n (packageManager as PackageManager | undefined) ?? (await detectPackageManager());\n if (resolvedPackageManager === \"pnpm\" && dependencies.sharp !== undefined) {\n await approvePnpmSharpBuild();\n }\n await installDependencies(\n packageManager as PackageManager | undefined,\n dependencies,\n devDependencies,\n );\n }\n\n for (const [name, config] of Object.entries(ejectConfigs)) {\n if (await fileExistsAsync(srcPath(`config/${name}.ts`))) {\n recordSkippedFile(srcPath(`config/${name}.ts`), \"exists\");\n console.log(`${colors.yellowBright(name)} config already exists, skipping...`);\n continue;\n }\n\n console.log(`Creating ${colors.magenta(name)} config...`);\n\n await putFileAsync(srcPath(`config/${name}.ts`), config.content);\n\n console.log(`${colors.green(name)} config created successfully`);\n }\n\n // now loop again over features to execute onExecuting\n for (const feature of resolvedFeatures) {\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\n\n if (featurePackages?.onExecuting) {\n await featurePackages.onExecuting(options);\n }\n }\n\n setGenerationDetail(\"scripts\", { ...scripts });\n\n if (Object.keys(scripts).length > 0) {\n console.log(`Adding scripts ${colors.magenta(Object.keys(scripts).join(\", \"))}`);\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n packageJson.scripts = { ...(packageJson.scripts ?? {}), ...scripts };\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n console.log(`Scripts added successfully ${colors.green(Object.keys(scripts).join(\", \"))}`);\n }\n}\n\n/**\n * Let pnpm run sharp's install script, written where the INSTALLED pnpm reads\n * approvals (see `pnpmBuildApprovalLayout`). pnpm 9 and 10.0–10.4 reject a\n * settings-only `pnpm-workspace.yaml`, so for them the approval goes into\n * package.json and no workspace file is created.\n *\n * An app inside a parent pnpm workspace gets no per-app policy: the parent's\n * workspace owns it, and a nested workspace file would make a second root.\n */\nasync function approvePnpmSharpBuild(): Promise<void> {\n const workspacePath = rootPath(\"pnpm-workspace.yaml\");\n const hasWorkspaceFile = await fileExistsAsync(workspacePath);\n\n if (!hasWorkspaceFile && isInsideParentPnpmWorkspace(rootPath())) {\n console.log(\n `${colors.yellowBright(\"sharp\")} needs its install script approved in the parent pnpm workspace's settings.`,\n );\n return;\n }\n\n const layout = pnpmBuildApprovalLayout(getPnpmVersion(rootPath()));\n\n if (layout === \"packageJson\") {\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n\n await putJsonFileAsync(packageJsonPath, mergePackageJsonBuildApprovals(packageJson, [\"sharp\"]));\n return;\n }\n\n const current = hasWorkspaceFile ? await getFileAsync(workspacePath) : \"\";\n const updated =\n layout === \"onlyBuiltDependencies\"\n ? mergeOnlyBuiltDependencies(current, [\"sharp\"])\n : mergePnpmSharpApproval(current);\n\n if (updated !== current) await putFileAsync(workspacePath, updated);\n}\n\n/**\n * Install the resolved dependency sets through the project's package manager.\n * Runs two passes (prod then dev) so each lands in the correct section.\n */\nexport async function installDependencies(\n packageManager: PackageManager | undefined,\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n exec: (command: string, options: { cwd: string; stdio: \"inherit\" }) => unknown = execSync,\n) {\n // `--package-manager` is optional; without it, fall back to the lockfile.\n const resolvedPackageManager = packageManager ?? (await detectPackageManager());\n const packageManagerCommand = getAddCommand(resolvedPackageManager);\n const exactPackageManagerCommand = getExactAddCommand(resolvedPackageManager);\n\n const installDependencySet = (dependencySet: Record<string, string>, development: boolean) => {\n const regularSpecs: string[] = [];\n const exactWarlockSpecs: string[] = [];\n\n for (const [name, version] of Object.entries(dependencySet)) {\n const spec = `${name}@${version}`;\n (isWarlockPackage(name) ? exactWarlockSpecs : regularSpecs).push(spec);\n }\n\n const developmentFlag = development ? \" -D\" : \"\";\n const runInstall = (command: string, specs: string[]) => {\n if (specs.length === 0) return;\n\n exec(`${command} ${specs.join(\" \")}${developmentFlag}`, {\n cwd: process.cwd(),\n stdio: \"inherit\",\n });\n };\n\n runInstall(packageManagerCommand, regularSpecs);\n runInstall(exactPackageManagerCommand, exactWarlockSpecs);\n };\n\n if (Object.keys(dependencies).length > 0) {\n console.log(`Installing dependencies ${colors.magenta(Object.keys(dependencies).join(\", \"))}`);\n\n installDependencySet(dependencies, false);\n\n console.log(\n `Dependencies installed successfully ${colors.green(Object.keys(dependencies).join(\", \"))}`,\n );\n }\n\n if (Object.keys(devDependencies).length > 0) {\n console.log(\n `Installing dev dependencies ${colors.magenta(Object.keys(devDependencies).join(\", \"))}`,\n );\n\n installDependencySet(devDependencies, true);\n\n console.log(\n `Dev dependencies installed successfully ${colors.green(Object.keys(devDependencies).join(\", \"))}`,\n );\n }\n}\n\n/**\n * Write the resolved dependency sets into package.json without installing.\n * Used by `--no-install` so a scaffolder can batch every feature into one\n * install pass after the command returns. Versions come from the feature map.\n */\nasync function recordDependencies(\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n) {\n if (Object.keys(dependencies).length === 0 && Object.keys(devDependencies).length === 0) {\n return;\n }\n\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n\n packageJson.dependencies = packageJson.dependencies ?? {};\n packageJson.devDependencies = packageJson.devDependencies ?? {};\n\n Object.assign(packageJson.dependencies, dependencies);\n Object.assign(packageJson.devDependencies, devDependencies);\n\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n const recorded = [...Object.keys(dependencies), ...Object.keys(devDependencies)];\n\n console.log(\n `Recorded ${colors.green(recorded.join(\", \"))} in package.json (${isGenerationDryRun() ? \"dry run: nothing installed\" : \"install skipped via --no-install\"})`,\n );\n}\n\nfunction validateFeatures(features: string[]) {\n for (const feature of features) {\n if (!allowedFeatures.includes(feature)) {\n console.log(\n `Feature ${colors.redBright(feature)} is not allowed, allowed features are: ${colors.green(allowedFeatures.join(\", \"))}`,\n );\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AA2CA,MAAa,kBAAkB,OAAO,KAAK,WAAW;AAEtD,SAAS,iBAAiB,aAA8B;CACtD,OAAO,YAAY,WAAW,cAAc;AAC9C;;;;;;AAOA,SAAgB,iCACd,cACA,kBACM;CACN,KAAK,MAAM,cAAc,OAAO,KAAK,YAAY,GAC/C,IAAI,iBAAiB,UAAU,GAC7B,aAAa,cAAc;AAGjC;AAEA,SAAS,gBAAgB,UAAoB,0BAAU,IAAI,IAAY,GAAa;CAClF,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,WAAW,UAAU;E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AC,SAAS,GAAG;EAC3C,QAAQ,IACN,+BAA+B,OAAO,QAAQ,OAAO,KAAK,eAAe,CAAC,CAAC,KAAK,IAAI,CAAC,GACvF;EAEA,qBAAqB,iBAAiB,IAAI;EAE1C,QAAQ,IACN,2CAA2C,OAAO,MAAM,OAAO,KAAK,eAAe,CAAC,CAAC,KAAK,IAAI,CAAC,GACjG;CACF;AACF;;;;;;AAOA,eAAe,mBACb,cACA,iBACA;CACA,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,WAAW,KAAK,OAAO,KAAK,eAAe,CAAC,CAAC,WAAW,GACpF;CAGF,MAAM,kBAAkB,SAAS,cAAc;CAC/C,MAAM,cAAc,MAAM,iBAAqC,eAAe;CAE9E,YAAY,eAAe,YAAY,gBAAgB,CAAC;CACxD,YAAY,kBAAkB,YAAY,mBAAmB,CAAC;CAE9D,OAAO,OAAO,YAAY,cAAc,YAAY;CACpD,OAAO,OAAO,YAAY,iBAAiB,eAAe;CAE1D,MAAM,iBAAiB,iBAAiB,WAAW;CAEnD,MAAM,WAAW,CAAC,GAAG,OAAO,KAAK,YAAY,GAAG,GAAG,OAAO,KAAK,eAAe,CAAC;CAE/E,QAAQ,IACN,YAAY,OAAO,MAAM,SAAS,KAAK,IAAI,CAAC,EAAE,oBAAoB,mBAAmB,IAAI,+BAA+B,mCAAmC,EAC7J;AACF;AAEA,SAAS,iBAAiB,UAAoB;CAC5C,KAAK,MAAM,WAAW,UACpB,IAAI,CAAC,gBAAgB,SAAS,OAAO,GAAG;EACtC,QAAQ,IACN,WAAW,OAAO,UAAU,OAAO,EAAE,yCAAyC,OAAO,MAAM,gBAAgB,KAAK,IAAI,CAAC,GACvH;EACA,QAAQ,KAAK,CAAC;CAChB;AAEJ"}
|
|
1
|
+
{"version":3,"file":"add-command.action.mjs","names":[],"sources":["../../../../../../../../packages/core/src/generations/add-command.action.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport {\n fileExistsAsync,\n getFileAsync,\n getJsonFileAsync,\n putFileAsync,\n putJsonFileAsync,\n recordSkippedFile,\n} from \"./generation-fs\";\nimport { isGenerationDryRun, setGenerationDetail } from \"./generation-run\";\nimport { execSync } from \"node:child_process\";\nimport type { CommandActionData } from \"../commands/types\";\nimport {\n detectPackageManager,\n getAddCommand,\n getExactAddCommand,\n type PackageManager,\n} from \"../updater/package-manager\";\nimport { rootPath, srcPath } from \"../utils\";\nimport { getWarlockVersion } from \"../utils/framework-vesion\";\nimport { featuresMap } from \"./features\";\nimport {\n getPnpmVersion,\n isInsideParentPnpmWorkspace,\n mergeOnlyBuiltDependencies,\n mergePackageJsonBuildApprovals,\n mergePnpmSharpApproval,\n pnpmBuildApprovalLayout,\n} from \"./pnpm-build-approvals\";\n\nexport { featuresMap };\nexport type { FeatureDefinition } from \"./features\";\n\n/**\n * The parts of a project `package.json` this action reads or writes. Deliberately\n * partial — it describes what we touch, not the whole manifest.\n */\ntype ProjectPackageJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n};\n\nexport const allowedFeatures = Object.keys(featuresMap);\n\nfunction isWarlockPackage(packageName: string): boolean {\n return packageName.startsWith(\"@warlock.js/\");\n}\n\n/**\n * Resolve the internal feature-map placeholder to the version of Core that is\n * actually executing the command. Every @warlock.js package is lockstep, so\n * Core is the single source of truth; non-Warlock dependencies are untouched.\n */\nexport function resolveWarlockDependencyVersions(\n dependencies: Record<string, string>,\n frameworkVersion: string,\n): void {\n for (const dependency of Object.keys(dependencies)) {\n if (isWarlockPackage(dependency)) {\n dependencies[dependency] = frameworkVersion;\n }\n }\n}\n\nfunction resolveFeatures(features: string[], visited = new Set<string>()): string[] {\n const resolved: string[] = [];\n\n for (const feature of features) {\n if (visited.has(feature)) continue;\n visited.add(feature);\n\n const def = featuresMap[feature];\n\n // `addCommandAction` runs `validateFeatures()` before calling this, and the\n // recursive calls below pass `requires` entries that come out of the map\n // itself — so every lookup resolves. Skipping an unresolvable one keeps a\n // typo from crashing the command with `Cannot read properties of\n // undefined`, which names neither the feature nor the fact that it was the\n // ARGUMENT that was wrong.\n if (def === undefined) continue;\n\n if (def.requires?.length) {\n resolved.push(...resolveFeatures(def.requires, visited));\n }\n\n resolved.push(feature);\n }\n\n return resolved;\n}\n\nexport async function addCommandAction(options: CommandActionData) {\n const features = options.args;\n const { packageManager, list, noInstall } = options.options;\n\n if (list) {\n setGenerationDetail(\n \"features\",\n allowedFeatures.map((feature) => ({\n name: feature,\n description: featuresMap[feature]?.description ?? \"\",\n })),\n );\n\n console.log(\"Available Features:\");\n\n for (const feature of allowedFeatures) {\n const definition = featuresMap[feature];\n\n // `allowedFeatures` is derived from this same map, so this resolves.\n if (definition === undefined) continue;\n\n console.log(`- ${colors.yellowBright(feature)}: ${colors.green(definition.description)}`);\n }\n\n process.exit(0);\n }\n\n validateFeatures(features);\n\n const resolvedFeatures = resolveFeatures(features);\n\n const dependencies: Record<string, string> = {};\n const devDependencies: Record<string, string> = {};\n const ejectConfigs: Record<string, { content: string; name: string }> = {};\n const scripts: Record<string, string> = {};\n\n for (const feature of resolvedFeatures) {\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\n\n // Validated upstream; see the note in resolveFeatures above.\n if (featurePackages === undefined) continue;\n\n Object.assign(dependencies, featurePackages.dependencies);\n if (featurePackages.devDependencies) {\n Object.assign(devDependencies, featurePackages.devDependencies);\n }\n\n if (featurePackages.ejectConfig) {\n ejectConfigs[featurePackages.ejectConfig.name] = featurePackages.ejectConfig;\n }\n\n if (featurePackages.script) {\n Object.assign(scripts, featurePackages.script);\n }\n }\n\n // Pin every @warlock.js/* feature package to the INSTALLED framework version so\n // a scaffolded project's features match its core version instead of drifting to\n // the feature map's static range.\n const frameworkVersion = await getWarlockVersion();\n resolveWarlockDependencyVersions(dependencies, frameworkVersion);\n resolveWarlockDependencyVersions(devDependencies, frameworkVersion);\n\n const currentPackageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\n\n // Fresh templates may omit one of the maps — guard before reading.\n currentPackageJson.dependencies = currentPackageJson.dependencies ?? {};\n currentPackageJson.devDependencies = currentPackageJson.devDependencies ?? {};\n\n // Skip anything already present so we never downgrade an existing pin.\n for (const dependency of Object.keys(dependencies)) {\n if (currentPackageJson.dependencies[dependency]) {\n console.log(`${colors.yellowBright(dependency)} is already installed, skipping...`);\n delete dependencies[dependency];\n }\n }\n\n for (const devDependency of Object.keys(devDependencies)) {\n if (currentPackageJson.devDependencies[devDependency]) {\n console.log(`${colors.yellowBright(devDependency)} is already installed, skipping...`);\n delete devDependencies[devDependency];\n }\n }\n\n setGenerationDetail(\"features\", resolvedFeatures);\n setGenerationDetail(\"dependencies\", { ...dependencies });\n setGenerationDetail(\"devDependencies\", { ...devDependencies });\n\n if (isGenerationDryRun()) {\n // A preview installs nothing; package.json is \"edited\" in the overlay so\n // the report lists it, and later steps read the previewed manifest.\n console.log(\n `Dry run: would install ${colors.magenta(Object.keys({ ...dependencies, ...devDependencies }).join(\", \") || \"nothing\")}`,\n );\n await recordDependencies(dependencies, devDependencies);\n } else if (noInstall) {\n await recordDependencies(dependencies, devDependencies);\n } else {\n const resolvedPackageManager =\n (packageManager as PackageManager | undefined) ?? (await detectPackageManager());\n if (resolvedPackageManager === \"pnpm\" && dependencies.sharp !== undefined) {\n await approvePnpmSharpBuild();\n }\n await installDependencies(\n packageManager as PackageManager | undefined,\n dependencies,\n devDependencies,\n );\n }\n\n for (const [name, config] of Object.entries(ejectConfigs)) {\n if (await fileExistsAsync(srcPath(`config/${name}.ts`))) {\n recordSkippedFile(srcPath(`config/${name}.ts`), \"exists\");\n console.log(`${colors.yellowBright(name)} config already exists, skipping...`);\n continue;\n }\n\n console.log(`Creating ${colors.magenta(name)} config...`);\n\n await putFileAsync(srcPath(`config/${name}.ts`), config.content);\n\n console.log(`${colors.green(name)} config created successfully`);\n }\n\n // now loop again over features to execute onExecuting\n for (const feature of resolvedFeatures) {\n const featurePackages = featuresMap[feature as keyof typeof featuresMap];\n\n if (featurePackages?.onExecuting) {\n await featurePackages.onExecuting(options);\n }\n }\n\n setGenerationDetail(\"scripts\", { ...scripts });\n\n if (Object.keys(scripts).length > 0) {\n console.log(`Adding scripts ${colors.magenta(Object.keys(scripts).join(\", \"))}`);\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n packageJson.scripts = { ...(packageJson.scripts ?? {}), ...scripts };\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n console.log(`Scripts added successfully ${colors.green(Object.keys(scripts).join(\", \"))}`);\n }\n}\n\n/**\n * Let pnpm run sharp's install script, written where the INSTALLED pnpm reads\n * approvals (see `pnpmBuildApprovalLayout`). pnpm 9 and 10.0–10.4 reject a\n * settings-only `pnpm-workspace.yaml`, so for them the approval goes into\n * package.json and no workspace file is created.\n *\n * An app inside a parent pnpm workspace gets no per-app policy: the parent's\n * workspace owns it, and a nested workspace file would make a second root.\n */\nasync function approvePnpmSharpBuild(): Promise<void> {\n const workspacePath = rootPath(\"pnpm-workspace.yaml\");\n const hasWorkspaceFile = await fileExistsAsync(workspacePath);\n\n if (!hasWorkspaceFile && isInsideParentPnpmWorkspace(rootPath())) {\n console.log(\n `${colors.yellowBright(\"sharp\")} needs its install script approved in the parent pnpm workspace's settings.`,\n );\n return;\n }\n\n const layout = pnpmBuildApprovalLayout(getPnpmVersion(rootPath()));\n\n if (layout === \"packageJson\") {\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n\n await putJsonFileAsync(packageJsonPath, mergePackageJsonBuildApprovals(packageJson, [\"sharp\"]));\n return;\n }\n\n const current = hasWorkspaceFile ? await getFileAsync(workspacePath) : \"\";\n const updated =\n layout === \"onlyBuiltDependencies\"\n ? mergeOnlyBuiltDependencies(current, [\"sharp\"])\n : mergePnpmSharpApproval(current);\n\n if (updated !== current) await putFileAsync(workspacePath, updated);\n}\n\n/**\n * Install the resolved dependency sets through the project's package manager.\n * Runs two passes (prod then dev) so each lands in the correct section.\n */\nexport async function installDependencies(\n packageManager: PackageManager | undefined,\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n exec: (command: string, options: { cwd: string; stdio: \"inherit\" }) => unknown = execSync,\n) {\n // `--package-manager` is optional; without it, fall back to the lockfile.\n const resolvedPackageManager = packageManager ?? (await detectPackageManager());\n const packageManagerCommand = getAddCommand(resolvedPackageManager);\n const exactPackageManagerCommand = getExactAddCommand(resolvedPackageManager);\n\n const installDependencySet = (dependencySet: Record<string, string>, development: boolean) => {\n const regularSpecs: string[] = [];\n const exactWarlockSpecs: string[] = [];\n\n for (const [name, version] of Object.entries(dependencySet)) {\n const spec = `${name}@${version}`;\n (isWarlockPackage(name) ? exactWarlockSpecs : regularSpecs).push(spec);\n }\n\n const developmentFlag = development ? \" -D\" : \"\";\n const runInstall = (command: string, specs: string[]) => {\n if (specs.length === 0) return;\n\n exec(`${command} ${specs.join(\" \")}${developmentFlag}`, {\n cwd: process.cwd(),\n stdio: \"inherit\",\n });\n };\n\n runInstall(packageManagerCommand, regularSpecs);\n runInstall(exactPackageManagerCommand, exactWarlockSpecs);\n };\n\n if (Object.keys(dependencies).length > 0) {\n console.log(`Installing dependencies ${colors.magenta(Object.keys(dependencies).join(\", \"))}`);\n\n installDependencySet(dependencies, false);\n\n console.log(\n `Dependencies installed successfully ${colors.green(Object.keys(dependencies).join(\", \"))}`,\n );\n }\n\n if (Object.keys(devDependencies).length > 0) {\n console.log(\n `Installing dev dependencies ${colors.magenta(Object.keys(devDependencies).join(\", \"))}`,\n );\n\n installDependencySet(devDependencies, true);\n\n console.log(\n `Dev dependencies installed successfully ${colors.green(Object.keys(devDependencies).join(\", \"))}`,\n );\n }\n}\n\n/**\n * Write the resolved dependency sets into package.json without installing.\n * Used by `--no-install` so a scaffolder can batch every feature into one\n * install pass after the command returns. Versions come from the feature map.\n */\nasync function recordDependencies(\n dependencies: Record<string, string>,\n devDependencies: Record<string, string>,\n) {\n if (Object.keys(dependencies).length === 0 && Object.keys(devDependencies).length === 0) {\n return;\n }\n\n const packageJsonPath = rootPath(\"package.json\");\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(packageJsonPath);\n\n packageJson.dependencies = packageJson.dependencies ?? {};\n packageJson.devDependencies = packageJson.devDependencies ?? {};\n\n Object.assign(packageJson.dependencies, dependencies);\n Object.assign(packageJson.devDependencies, devDependencies);\n\n await putJsonFileAsync(packageJsonPath, packageJson);\n\n const recorded = [...Object.keys(dependencies), ...Object.keys(devDependencies)];\n\n console.log(\n `Recorded ${colors.green(recorded.join(\", \"))} in package.json (${isGenerationDryRun() ? \"dry run: nothing installed\" : \"install skipped via --no-install\"})`,\n );\n}\n\nfunction validateFeatures(features: string[]) {\n for (const feature of features) {\n if (!allowedFeatures.includes(feature)) {\n console.log(\n `Feature ${colors.redBright(feature)} is not allowed, allowed features are: ${colors.green(allowedFeatures.join(\", \"))}`,\n );\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AA2CA,MAAa,kBAAkB,OAAO,KAAK,WAAW;AAEtD,SAAS,iBAAiB,aAA8B;CACtD,OAAO,YAAY,WAAW,cAAc;AAC9C;;;;;;AAOA,SAAgB,iCACd,cACA,kBACM;CACN,KAAK,MAAM,cAAc,OAAO,KAAK,YAAY,GAC/C,IAAI,iBAAiB,UAAU,GAC7B,aAAa,cAAc;AAGjC;AAEA,SAAS,gBAAgB,UAAoB,0BAAU,IAAI,IAAY,GAAa;CAClF,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,IAAI,OAAO,GAAG;EAC1B,QAAQ,IAAI,OAAO;EAEnB,MAAM,MAAM,YAAY;EAQxB,IAAI,QAAQ,QAAW;EAEvB,IAAI,IAAI,UAAU,QAChB,SAAS,KAAK,GAAG,gBAAgB,IAAI,UAAU,OAAO,CAAC;EAGzD,SAAS,KAAK,OAAO;CACvB;CAEA,OAAO;AACT;AAEA,eAA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;AACF;;;;;;AAOA,eAAe,mBACb,cACA,iBACA;CACA,IAAI,OAAO,KAAK,YAAY,CAAC,CAAC,WAAW,KAAK,OAAO,KAAK,eAAe,CAAC,CAAC,WAAW,GACpF;CAGF,MAAM,kBAAkB,SAAS,cAAc;CAC/C,MAAM,cAAc,MAAM,iBAAqC,eAAe;CAE9E,YAAY,eAAe,YAAY,gBAAgB,CAAC;CACxD,YAAY,kBAAkB,YAAY,mBAAmB,CAAC;CAE9D,OAAO,OAAO,YAAY,cAAc,YAAY;CACpD,OAAO,OAAO,YAAY,iBAAiB,eAAe;CAE1D,MAAM,iBAAiB,iBAAiB,WAAW;CAEnD,MAAM,WAAW,CAAC,GAAG,OAAO,KAAK,YAAY,GAAG,GAAG,OAAO,KAAK,eAAe,CAAC;CAE/E,QAAQ,IACN,YAAY,OAAO,MAAM,SAAS,KAAK,IAAI,CAAC,EAAE,oBAAoB,mBAAmB,IAAI,+BAA+B,mCAAmC,EAC7J;AACF;AAEA,SAAS,iBAAiB,UAAoB;CAC5C,KAAK,MAAM,WAAW,UACpB,IAAI,CAAC,gBAAgB,SAAS,OAAO,GAAG;EACtC,QAAQ,IACN,WAAW,OAAO,UAAU,OAAO,EAAE,yCAAyC,OAAO,MAAM,gBAAgB,KAAK,IAAI,CAAC,GACvH;EACA,QAAQ,KAAK,CAAC;CAChB;AAEJ"}
|
|
@@ -22,7 +22,8 @@ async function addDashboardConfigBlock() {
|
|
|
22
22
|
`);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const current = await getFileAsync(configPath);
|
|
26
|
+
const insertion = insertQueueDashboardBlock(current);
|
|
26
27
|
if (insertion.status === "already-present") {
|
|
27
28
|
console.log(`${colors.yellowBright("dashboard")} config already present in src/config/queue.ts, skipping...`);
|
|
28
29
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bull-board.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/bull-board.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getFileAsync, getJsonFileAsync, putFileAsync } from \"../generation-fs\";\nimport type { CommandActionData } from \"../../commands/types\";\nimport { rootPath, srcPath } from \"../../utils\";\nimport { insertQueueDashboardBlock } from \"./shared/insert-queue-dashboard-block\";\nimport type { FeatureDefinition } from \"./types\";\n\n/** The parts of `package.json` this feature reads to check for its prerequisite. */\ntype ProjectPackageJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n};\n\n/**\n * Defensive floor: `requires: [\"queue\"]` normally installs queue first, so\n * this only fires when the dashboard step runs without it (e.g. called\n * directly), and then fails loudly instead of writing a half-wired config.\n */\nasync function isQueueInstalled(): Promise<boolean> {\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\n\n return Boolean(\n packageJson.dependencies?.[\"@warlock.js/queue\"] ||\n packageJson.devDependencies?.[\"@warlock.js/queue\"],\n );\n}\n\n/** Insert the `dashboard` block into `src/config/queue.ts`, without reformatting it. */\nasync function addDashboardConfigBlock(): Promise<void> {\n const configPath = srcPath(\"config/queue.ts\");\n\n if (!(await fileExistsAsync(configPath))) {\n console.log(\n `${colors.yellowBright(\"src/config/queue.ts\")} not found — add this to your queue config yourself:\\n` +\n ' dashboard: { enabled: true, path: \"/admin/queues\", middleware: [] },\\n',\n );\n\n return;\n }\n\n const current = await getFileAsync(configPath);\n const insertion = insertQueueDashboardBlock(current);\n\n if (insertion.status === \"already-present\") {\n console.log(\n `${colors.yellowBright(\"dashboard\")} config already present in src/config/queue.ts, skipping...`,\n );\n\n return;\n }\n\n if (insertion.status === \"unrecognised\") {\n console.log(\n `${colors.yellowBright(\"!\")} src/config/queue.ts has no recognisable ${colors.yellowBright(\"queueConfig\")} object — ` +\n \"add the dashboard block yourself:\\n\" +\n ' dashboard: { enabled: true, path: \"/admin/queues\", middleware: [] },\\n',\n );\n\n return;\n }\n\n await putFileAsync(configPath, insertion.next);\n console.log(`${colors.green(\"✓\")} Added dashboard config to src/config/queue.ts`);\n}\n\n/**\n * Wire the dashboard into the app: verify queue is installed, then add the\n * `dashboard` block to its config.\n */\nasync function completeBullBoardInstallation(_options: CommandActionData): Promise<void> {\n if (!(await isQueueInstalled())) {\n console.log(\n `${colors.redBright(\"✗\")} @warlock.js/queue is not installed — run ` +\n `${colors.yellowBright(\"warlock add queue\")} first, then ${colors.yellowBright(\"warlock add bull-board\")}.`,\n );\n process.exitCode = 1;\n\n return;\n }\n\n await addDashboardConfigBlock();\n\n console.log(\n \"\\nNext: guard the dashboard with a middleware before it ships to production — an empty \" +\n 'middleware list throws QueueDashboardUnguardedError at boot when NODE_ENV is \"production\".',\n );\n}\n\n/** `warlock add bull-board` — a config-driven bull-board dashboard for @warlock.js/queue. */\nexport const bullBoardFeature: FeatureDefinition = {\n description:\n \"Installs @bull-board/api and @bull-board/fastify and adds a dashboard block to src/config/queue.ts. Adds the queue feature first when it is missing.\",\n requires: [\"queue\"],\n dependencies: {\n \"@bull-board/api\": \"^9.10.2\",\n \"@bull-board/fastify\": \"^9.10.2\",\n },\n onExecuting: completeBullBoardInstallation,\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAe,mBAAqC;CAClD,MAAM,cAAc,MAAM,iBAAqC,SAAS,cAAc,CAAC;CAEvF,OAAO,QACL,YAAY,eAAe,wBAC3B,YAAY,kBAAkB,oBAChC;AACF;;AAGA,eAAe,0BAAyC;CACtD,MAAM,aAAa,QAAQ,iBAAiB;CAE5C,IAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;EACxC,QAAQ,IACN,GAAG,OAAO,aAAa,qBAAqB,EAAE;CAEhD;EAEA;CACF;
|
|
1
|
+
{"version":3,"file":"bull-board.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/bull-board.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { fileExistsAsync, getFileAsync, getJsonFileAsync, putFileAsync } from \"../generation-fs\";\nimport type { CommandActionData } from \"../../commands/types\";\nimport { rootPath, srcPath } from \"../../utils\";\nimport { insertQueueDashboardBlock } from \"./shared/insert-queue-dashboard-block\";\nimport type { FeatureDefinition } from \"./types\";\n\n/** The parts of `package.json` this feature reads to check for its prerequisite. */\ntype ProjectPackageJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n};\n\n/**\n * Defensive floor: `requires: [\"queue\"]` normally installs queue first, so\n * this only fires when the dashboard step runs without it (e.g. called\n * directly), and then fails loudly instead of writing a half-wired config.\n */\nasync function isQueueInstalled(): Promise<boolean> {\n const packageJson = await getJsonFileAsync<ProjectPackageJson>(rootPath(\"package.json\"));\n\n return Boolean(\n packageJson.dependencies?.[\"@warlock.js/queue\"] ||\n packageJson.devDependencies?.[\"@warlock.js/queue\"],\n );\n}\n\n/** Insert the `dashboard` block into `src/config/queue.ts`, without reformatting it. */\nasync function addDashboardConfigBlock(): Promise<void> {\n const configPath = srcPath(\"config/queue.ts\");\n\n if (!(await fileExistsAsync(configPath))) {\n console.log(\n `${colors.yellowBright(\"src/config/queue.ts\")} not found — add this to your queue config yourself:\\n` +\n ' dashboard: { enabled: true, path: \"/admin/queues\", middleware: [] },\\n',\n );\n\n return;\n }\n\n const current = await getFileAsync(configPath);\n const insertion = insertQueueDashboardBlock(current);\n\n if (insertion.status === \"already-present\") {\n console.log(\n `${colors.yellowBright(\"dashboard\")} config already present in src/config/queue.ts, skipping...`,\n );\n\n return;\n }\n\n if (insertion.status === \"unrecognised\") {\n console.log(\n `${colors.yellowBright(\"!\")} src/config/queue.ts has no recognisable ${colors.yellowBright(\"queueConfig\")} object — ` +\n \"add the dashboard block yourself:\\n\" +\n ' dashboard: { enabled: true, path: \"/admin/queues\", middleware: [] },\\n',\n );\n\n return;\n }\n\n await putFileAsync(configPath, insertion.next);\n console.log(`${colors.green(\"✓\")} Added dashboard config to src/config/queue.ts`);\n}\n\n/**\n * Wire the dashboard into the app: verify queue is installed, then add the\n * `dashboard` block to its config.\n */\nasync function completeBullBoardInstallation(_options: CommandActionData): Promise<void> {\n if (!(await isQueueInstalled())) {\n console.log(\n `${colors.redBright(\"✗\")} @warlock.js/queue is not installed — run ` +\n `${colors.yellowBright(\"warlock add queue\")} first, then ${colors.yellowBright(\"warlock add bull-board\")}.`,\n );\n process.exitCode = 1;\n\n return;\n }\n\n await addDashboardConfigBlock();\n\n console.log(\n \"\\nNext: guard the dashboard with a middleware before it ships to production — an empty \" +\n 'middleware list throws QueueDashboardUnguardedError at boot when NODE_ENV is \"production\".',\n );\n}\n\n/** `warlock add bull-board` — a config-driven bull-board dashboard for @warlock.js/queue. */\nexport const bullBoardFeature: FeatureDefinition = {\n description:\n \"Installs @bull-board/api and @bull-board/fastify and adds a dashboard block to src/config/queue.ts. Adds the queue feature first when it is missing.\",\n requires: [\"queue\"],\n dependencies: {\n \"@bull-board/api\": \"^9.10.2\",\n \"@bull-board/fastify\": \"^9.10.2\",\n },\n onExecuting: completeBullBoardInstallation,\n};\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAe,mBAAqC;CAClD,MAAM,cAAc,MAAM,iBAAqC,SAAS,cAAc,CAAC;CAEvF,OAAO,QACL,YAAY,eAAe,wBAC3B,YAAY,kBAAkB,oBAChC;AACF;;AAGA,eAAe,0BAAyC;CACtD,MAAM,aAAa,QAAQ,iBAAiB;CAE5C,IAAI,CAAE,MAAM,gBAAgB,UAAU,GAAI;EACxC,QAAQ,IACN,GAAG,OAAO,aAAa,qBAAqB,EAAE;CAEhD;EAEA;CACF;CAEA,MAAM,UAAU,MAAM,aAAa,UAAU;CAC7C,MAAM,YAAY,0BAA0B,OAAO;CAEnD,IAAI,UAAU,WAAW,mBAAmB;EAC1C,QAAQ,IACN,GAAG,OAAO,aAAa,WAAW,EAAE,4DACtC;EAEA;CACF;CAEA,IAAI,UAAU,WAAW,gBAAgB;EACvC,QAAQ,IACN,GAAG,OAAO,aAAa,GAAG,EAAE,2CAA2C,OAAO,aAAa,aAAa,EAAE;;CAG5G;EAEA;CACF;CAEA,MAAM,aAAa,YAAY,UAAU,IAAI;CAC7C,QAAQ,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,+CAA+C;AAClF;;;;;AAMA,eAAe,8BAA8B,UAA4C;CACvF,IAAI,CAAE,MAAM,iBAAiB,GAAI;EAC/B,QAAQ,IACN,GAAG,OAAO,UAAU,GAAG,EAAE,4CACpB,OAAO,aAAa,mBAAmB,EAAE,eAAe,OAAO,aAAa,wBAAwB,EAAE,EAC7G;EACA,QAAQ,WAAW;EAEnB;CACF;CAEA,MAAM,wBAAwB;CAE9B,QAAQ,IACN,qLAEF;AACF;;AAGA,MAAa,mBAAsC;CACjD,aACE;CACF,UAAU,CAAC,OAAO;CAClB,cAAc;EACZ,mBAAmB;EACnB,uBAAuB;CACzB;CACA,aAAa;AACf"}
|
|
@@ -19,6 +19,7 @@ import { mongodbFeature } from "./mongodb.feature.mjs";
|
|
|
19
19
|
import { mysqlFeature } from "./mysql.feature.mjs";
|
|
20
20
|
import { notificationsFeature } from "./notifications.feature.mjs";
|
|
21
21
|
import { postgresFeature } from "./postgres.feature.mjs";
|
|
22
|
+
import { processFeature } from "./process.feature.mjs";
|
|
22
23
|
import { queueFeature } from "./queue.feature.mjs";
|
|
23
24
|
import { reactEmailFeature } from "./react-email.feature.mjs";
|
|
24
25
|
import { reactFeature } from "./react.feature.mjs";
|
|
@@ -60,6 +61,7 @@ const featuresMap = {
|
|
|
60
61
|
shadcn: shadcnFeature,
|
|
61
62
|
sitemap: sitemapFeature,
|
|
62
63
|
devtools: devtoolsFeature,
|
|
64
|
+
process: processFeature,
|
|
63
65
|
herald: heraldFeature,
|
|
64
66
|
queue: queueFeature,
|
|
65
67
|
"bull-board": bullBoardFeature,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/index.ts"],"sourcesContent":["import { accessFeature } from \"./access.feature\";\nimport { aiAnthropicFeature } from \"./ai-anthropic.feature\";\nimport { aiBedrockFeature } from \"./ai-bedrock.feature\";\nimport { aiGoogleFeature } from \"./ai-google.feature\";\nimport { aiOllamaFeature } from \"./ai-ollama.feature\";\nimport { aiOpenaiFeature } from \"./ai-openai.feature\";\nimport { aiPanopticFeature } from \"./ai-panoptic.feature\";\nimport { aiToolsFeature } from \"./ai-tools.feature\";\nimport { aiWorkspaceFeature } from \"./ai-workspace.feature\";\nimport { aiFeature } from \"./ai.feature\";\nimport { authGoogleFeature } from \"./auth-google.feature\";\nimport { authPasskeysFeature } from \"./auth-passkeys.feature\";\nimport { bullBoardFeature } from \"./bull-board.feature\";\nimport { devtoolsFeature } from \"./devtools.feature\";\nimport { heraldFeature } from \"./herald.feature\";\nimport { imageFeature } from \"./image.feature\";\nimport { mailFeature } from \"./mail.feature\";\nimport { mongodbFeature } from \"./mongodb.feature\";\nimport { mysqlFeature } from \"./mysql.feature\";\nimport { notificationsFeature } from \"./notifications.feature\";\nimport { postgresFeature } from \"./postgres.feature\";\nimport { queueFeature } from \"./queue.feature\";\nimport { reactEmailFeature } from \"./react-email.feature\";\nimport { reactFeature } from \"./react.feature\";\nimport { redisFeature } from \"./redis.feature\";\nimport { s3Feature } from \"./s3.feature\";\nimport { schedulerFeature } from \"./scheduler.feature\";\nimport { sesFeature } from \"./ses.feature\";\nimport { shadcnFeature } from \"./shadcn.feature\";\nimport { sitemapFeature } from \"./sitemap.feature\";\nimport { socketFeature } from \"./socket.feature\";\nimport { tailwindFeature } from \"./tailwind.feature\";\nimport { testFeature } from \"./test.feature\";\nimport type { FeatureDefinition } from \"./types\";\nimport { webFeature } from \"./web.feature\";\n\nexport type { FeatureDefinition } from \"./types\";\n\n/**\n * The feature registry `warlock add` dispatches against.\n *\n * This file is an INDEX, nothing more: every entry lives in its own module\n * alongside the `onExecuting` body it runs. Key order is load-bearing — it is\n * the order `--list` prints and the order the \"not allowed\" error lists — so\n * add new features in the place they should appear, not alphabetically.\n */\nexport const featuresMap: Record<string, FeatureDefinition> = {\n \"react-email\": reactEmailFeature,\n react: reactFeature,\n image: imageFeature,\n mail: mailFeature,\n ses: sesFeature,\n mongodb: mongodbFeature,\n scheduler: schedulerFeature,\n // swagger / postman intentionally omitted — those packages do not exist yet;\n // they will ship together in the unified @warlock.js/api-docs package.\n postgres: postgresFeature,\n mysql: mysqlFeature,\n redis: redisFeature,\n s3: s3Feature,\n test: testFeature,\n web: webFeature,\n // Directly after `web`, and only there: it `requires` it, it is useless\n // without it, and a reader scanning `--list` for the page stack should meet\n // the two together rather than find styling filed between queues and sockets.\n tailwind: tailwindFeature,\n // Immediately after `tailwind`, for the same reason `tailwind` follows `web`:\n // it `requires` it, it appends to the stylesheet that feature creates, and the\n // three of them are one stack a reader should meet in build order.\n shadcn: shadcnFeature,\n // Directly after the web/tailwind/shadcn stack, for the same reason: it\n // `requires` web (it reads the page registry `listRoutablePages()`\n // exposes) and a reader scanning `--list` for the page stack should meet it\n // there rather than filed between queues and sockets.\n sitemap: sitemapFeature,\n devtools: devtoolsFeature,\n herald: heraldFeature,\n queue: queueFeature,\n // Directly after `queue`, for the same reason `tailwind` follows `web`: it\n // needs queue already installed and configured, and a reader scanning\n // `--list` for job-queue features should meet the two together.\n \"bull-board\": bullBoardFeature,\n socket: socketFeature,\n notifications: notificationsFeature,\n access: accessFeature,\n // Login methods for @warlock.js/auth — \"<package>-<vendor>\" like the ai-* entries.\n \"auth-google\": authGoogleFeature,\n \"auth-passkeys\": authPasskeysFeature,\n ai: aiFeature,\n \"ai-openai\": aiOpenaiFeature,\n \"ai-google\": aiGoogleFeature,\n \"ai-anthropic\": aiAnthropicFeature,\n \"ai-bedrock\": aiBedrockFeature,\n \"ai-ollama\": aiOllamaFeature,\n \"ai-tools\": aiToolsFeature,\n \"ai-panoptic\": aiPanopticFeature,\n \"ai-workspace\": aiWorkspaceFeature,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/index.ts"],"sourcesContent":["import { accessFeature } from \"./access.feature\";\nimport { aiAnthropicFeature } from \"./ai-anthropic.feature\";\nimport { aiBedrockFeature } from \"./ai-bedrock.feature\";\nimport { aiGoogleFeature } from \"./ai-google.feature\";\nimport { aiOllamaFeature } from \"./ai-ollama.feature\";\nimport { aiOpenaiFeature } from \"./ai-openai.feature\";\nimport { aiPanopticFeature } from \"./ai-panoptic.feature\";\nimport { aiToolsFeature } from \"./ai-tools.feature\";\nimport { aiWorkspaceFeature } from \"./ai-workspace.feature\";\nimport { aiFeature } from \"./ai.feature\";\nimport { authGoogleFeature } from \"./auth-google.feature\";\nimport { authPasskeysFeature } from \"./auth-passkeys.feature\";\nimport { bullBoardFeature } from \"./bull-board.feature\";\nimport { devtoolsFeature } from \"./devtools.feature\";\nimport { heraldFeature } from \"./herald.feature\";\nimport { imageFeature } from \"./image.feature\";\nimport { mailFeature } from \"./mail.feature\";\nimport { mongodbFeature } from \"./mongodb.feature\";\nimport { mysqlFeature } from \"./mysql.feature\";\nimport { notificationsFeature } from \"./notifications.feature\";\nimport { postgresFeature } from \"./postgres.feature\";\nimport { processFeature } from \"./process.feature\";\nimport { queueFeature } from \"./queue.feature\";\nimport { reactEmailFeature } from \"./react-email.feature\";\nimport { reactFeature } from \"./react.feature\";\nimport { redisFeature } from \"./redis.feature\";\nimport { s3Feature } from \"./s3.feature\";\nimport { schedulerFeature } from \"./scheduler.feature\";\nimport { sesFeature } from \"./ses.feature\";\nimport { shadcnFeature } from \"./shadcn.feature\";\nimport { sitemapFeature } from \"./sitemap.feature\";\nimport { socketFeature } from \"./socket.feature\";\nimport { tailwindFeature } from \"./tailwind.feature\";\nimport { testFeature } from \"./test.feature\";\nimport type { FeatureDefinition } from \"./types\";\nimport { webFeature } from \"./web.feature\";\n\nexport type { FeatureDefinition } from \"./types\";\n\n/**\n * The feature registry `warlock add` dispatches against.\n *\n * This file is an INDEX, nothing more: every entry lives in its own module\n * alongside the `onExecuting` body it runs. Key order is load-bearing — it is\n * the order `--list` prints and the order the \"not allowed\" error lists — so\n * add new features in the place they should appear, not alphabetically.\n */\nexport const featuresMap: Record<string, FeatureDefinition> = {\n \"react-email\": reactEmailFeature,\n react: reactFeature,\n image: imageFeature,\n mail: mailFeature,\n ses: sesFeature,\n mongodb: mongodbFeature,\n scheduler: schedulerFeature,\n // swagger / postman intentionally omitted — those packages do not exist yet;\n // they will ship together in the unified @warlock.js/api-docs package.\n postgres: postgresFeature,\n mysql: mysqlFeature,\n redis: redisFeature,\n s3: s3Feature,\n test: testFeature,\n web: webFeature,\n // Directly after `web`, and only there: it `requires` it, it is useless\n // without it, and a reader scanning `--list` for the page stack should meet\n // the two together rather than find styling filed between queues and sockets.\n tailwind: tailwindFeature,\n // Immediately after `tailwind`, for the same reason `tailwind` follows `web`:\n // it `requires` it, it appends to the stylesheet that feature creates, and the\n // three of them are one stack a reader should meet in build order.\n shadcn: shadcnFeature,\n // Directly after the web/tailwind/shadcn stack, for the same reason: it\n // `requires` web (it reads the page registry `listRoutablePages()`\n // exposes) and a reader scanning `--list` for the page stack should meet it\n // there rather than filed between queues and sockets.\n sitemap: sitemapFeature,\n devtools: devtoolsFeature,\n process: processFeature,\n herald: heraldFeature,\n queue: queueFeature,\n // Directly after `queue`, for the same reason `tailwind` follows `web`: it\n // needs queue already installed and configured, and a reader scanning\n // `--list` for job-queue features should meet the two together.\n \"bull-board\": bullBoardFeature,\n socket: socketFeature,\n notifications: notificationsFeature,\n access: accessFeature,\n // Login methods for @warlock.js/auth — \"<package>-<vendor>\" like the ai-* entries.\n \"auth-google\": authGoogleFeature,\n \"auth-passkeys\": authPasskeysFeature,\n ai: aiFeature,\n \"ai-openai\": aiOpenaiFeature,\n \"ai-google\": aiGoogleFeature,\n \"ai-anthropic\": aiAnthropicFeature,\n \"ai-bedrock\": aiBedrockFeature,\n \"ai-ollama\": aiOllamaFeature,\n \"ai-tools\": aiToolsFeature,\n \"ai-panoptic\": aiPanopticFeature,\n \"ai-workspace\": aiWorkspaceFeature,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,cAAiD;CAC5D,eAAe;CACf,OAAO;CACP,OAAO;CACP,MAAM;CACN,KAAK;CACL,SAAS;CACT,WAAW;CAGX,UAAU;CACV,OAAO;CACP,OAAO;CACP,IAAI;CACJ,MAAM;CACN,KAAK;CAIL,UAAU;CAIV,QAAQ;CAKR,SAAS;CACT,UAAU;CACV,SAAS;CACT,QAAQ;CACR,OAAO;CAIP,cAAc;CACd,QAAQ;CACR,eAAe;CACf,QAAQ;CAER,eAAe;CACf,iBAAiB;CACjB,IAAI;CACJ,aAAa;CACb,aAAa;CACb,gBAAgB;CAChB,cAAc;CACd,aAAa;CACb,YAAY;CACZ,eAAe;CACf,gBAAgB;AAClB"}
|
|
@@ -103,7 +103,8 @@ async function pointConfigAtLegacyModel() {
|
|
|
103
103
|
}
|
|
104
104
|
async function completeNotificationsInstallation(_options) {
|
|
105
105
|
const modelPath = srcPath("app/notifications/models/notification/notification.model.ts");
|
|
106
|
-
|
|
106
|
+
const legacyModelPath = srcPath("app/notifications/notification.model.ts");
|
|
107
|
+
if (await fileExistsAsync(legacyModelPath)) {
|
|
107
108
|
if (!await fileExistsAsync(modelPath)) await pointConfigAtLegacyModel();
|
|
108
109
|
console.log(`${colors.yellowBright("src/app/notifications")} already scaffolded (5.29 layout), skipping...`);
|
|
109
110
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/notifications.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { dirname } from \"node:path\";\nimport {\n directoryExistsAsync,\n ensureDirectoryAsync,\n fileExistsAsync,\n getFileAsync,\n putFileAsync,\n recordSkippedFile,\n} from \"../generation-fs\";\nimport type { CommandActionData } from \"../../commands/types\";\nimport { srcPath } from \"../../utils\";\nimport {\n listNotificationsControllerStub,\n listNotificationsSchemaStub,\n markAllNotificationsReadControllerStub,\n markNotificationReadControllerStub,\n markNotificationReadServiceStub,\n notificationControllerSpecStub,\n notificationTestFixtureStub,\n notificationLocalesStub,\n notificationMigrationStub,\n notificationModelStub,\n notificationResourceStub,\n notificationRoutesStub,\n notificationsConfigStub,\n notificationsRequestTypeStub,\n unreadNotificationsCountControllerStub,\n} from \"../stubs\";\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\nimport { type FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\n/**\n * The module's controllers, with the route each one serves. A spec per\n * controller is written next to it when the app has the test feature.\n */\nconst notificationControllers = [\n {\n file: \"list-notifications.controller\",\n stub: listNotificationsControllerStub,\n method: \"GET\",\n path: \"/notifications\",\n },\n {\n file: \"unread-notifications-count.controller\",\n stub: unreadNotificationsCountControllerStub,\n method: \"GET\",\n path: \"/notifications/unread-count\",\n },\n {\n file: \"mark-notification-read.controller\",\n stub: markNotificationReadControllerStub,\n method: \"PATCH\",\n path: \"/notifications/1/read\",\n },\n {\n file: \"mark-all-notifications-read.controller\",\n stub: markAllNotificationsReadControllerStub,\n method: \"PATCH\",\n path: \"/notifications/read-all\",\n },\n] as const;\n\n/** The model's import path in the ejected config, before and since 5.30. */\nconst MODEL_IMPORT = \"app/notifications/models/notification/notification.model\";\nconst LEGACY_MODEL_IMPORT = \"app/notifications/notification.model\";\n\n/**\n * Write one module file unless it already exists. A file the app already has\n * is the app's own code: it is reported and left alone, never overwritten.\n */\nasync function writeModuleFile(relativePath: string, content: string, skipped: string[]) {\n const path = srcPath(\"app/notifications\", relativePath);\n\n if (await fileExistsAsync(path)) {\n skipped.push(relativePath);\n recordSkippedFile(path, \"exists\");\n return;\n }\n\n await ensureDirectoryAsync(dirname(path));\n await putFileAsync(path, content);\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/${relativePath}`);\n}\n\n/**\n * Add the module's `notFound` message to an existing utils/locales.json, or\n * create the file. Existing keys win; a file that is not a JSON object, or\n * that renames its group, is left for the app to update by hand.\n */\nasync function registerNotificationLocales(skipped: string[]) {\n const localesPath = srcPath(\"app/notifications/utils/locales.json\");\n\n if (!(await fileExistsAsync(localesPath))) {\n await writeModuleFile(\"utils/locales.json\", notificationLocalesStub, skipped);\n return;\n }\n\n const defaults = JSON.parse(notificationLocalesStub) as Record<string, unknown>;\n let dictionary: Record<string, unknown>;\n\n try {\n const parsed: unknown = JSON.parse(await getFileAsync(localesPath));\n\n if (parsed === null || Array.isArray(parsed) || typeof parsed !== \"object\") throw new Error();\n\n dictionary = parsed as Record<string, unknown>;\n } catch {\n console.log(\n `${colors.yellowBright(\"notifications\")} locale JSON is invalid; add notFound to src/app/notifications/utils/locales.json manually.`,\n );\n return;\n }\n\n // A root `$group` renames the file's namespace, so the service's\n // t(\"notifications.notFound\") would not find a key merged here.\n if (dictionary.$group !== undefined && dictionary.$group !== \"notifications\") {\n console.log(\n `${colors.yellowBright(\"notifications\")} locale JSON declares a different $group; add notifications.notFound manually.`,\n );\n return;\n }\n\n const missing = Object.keys(defaults).filter((key) => dictionary[key] === undefined);\n\n if (missing.length === 0) return;\n\n for (const key of missing) dictionary[key] = defaults[key];\n\n await putFileAsync(localesPath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n console.log(\n `${colors.green(\"✓\")} Added ${missing.join(\", \")} to src/app/notifications/utils/locales.json`,\n );\n}\n\n/**\n * The config ejected just before this runs imports the 5.30 model path. In an\n * app scaffolded by 5.29 the model is still at the module root, so point the\n * import there instead of at a file that does not exist.\n */\nasync function pointConfigAtLegacyModel() {\n const configPath = srcPath(\"config/notifications.ts\");\n\n if (!(await fileExistsAsync(configPath))) return;\n\n const config = await getFileAsync(configPath);\n\n if (!config.includes(`\"${MODEL_IMPORT}\"`)) return;\n\n await putFileAsync(configPath, config.replace(`\"${MODEL_IMPORT}\"`, `\"${LEGACY_MODEL_IMPORT}\"`));\n console.log(\n `${colors.green(\"✓\")} src/config/notifications.ts imports the existing model at ${LEGACY_MODEL_IMPORT}`,\n );\n}\n\nasync function completeNotificationsInstallation(_options: CommandActionData) {\n const modelPath = srcPath(\"app/notifications/models/notification/notification.model.ts\");\n // Where 5.29 and earlier wrote the model.\n const legacyModelPath = srcPath(\"app/notifications/notification.model.ts\");\n\n // The model file is the sentinel for \"notifications already scaffolded\" —\n // its presence means the migration was created too (timestamped, so we must\n // not re-emit a duplicate on a second run).\n if (await fileExistsAsync(legacyModelPath)) {\n if (!(await fileExistsAsync(modelPath))) await pointConfigAtLegacyModel();\n\n console.log(\n `${colors.yellowBright(\"src/app/notifications\")} already scaffolded (5.29 layout), skipping...`,\n );\n return;\n }\n\n if (await fileExistsAsync(modelPath)) {\n console.log(`${colors.yellowBright(\"src/app/notifications\")} already scaffolded, skipping...`);\n return;\n }\n\n const skipped: string[] = [];\n // An app that already has its own notifications module may keep its model\n // anywhere in it; a second Notification model would collide with it.\n const moduleExists = await directoryExistsAsync(srcPath(\"app/notifications\"));\n\n // 1. Model + migration under models/notification/, like every other module.\n // The migration's MM-DD-YYYY_HH-MM-SS prefix lets cascade infer its\n // createdAt and order it deterministically.\n if (moduleExists) {\n console.log(\n `${colors.yellowBright(\"src/app/notifications\")} already exists: not adding a Notification model or migration. config/notifications.ts must import your model.`,\n );\n } else {\n await writeModuleFile(\n \"models/notification/notification.model.ts\",\n notificationModelStub,\n skipped,\n );\n await writeModuleFile(\n `models/notification/migrations/${migrationTimestamp()}-notification.migration.ts`,\n notificationMigrationStub,\n skipped,\n );\n }\n\n // 2. One responsibility per file: output resource, validated list query,\n // guarded request type, service, translations.\n await writeModuleFile(\"resources/notification.resource.ts\", notificationResourceStub, skipped);\n await writeModuleFile(\n \"schema/list-notifications.schema.ts\",\n listNotificationsSchemaStub,\n skipped,\n );\n await writeModuleFile(\n \"types/notifications-request.type.ts\",\n notificationsRequestTypeStub,\n skipped,\n );\n await writeModuleFile(\n \"services/mark-notification-read.service.ts\",\n markNotificationReadServiceStub,\n skipped,\n );\n await registerNotificationLocales(skipped);\n\n // 3. HTTP surface — list, unread count, mark read, mark all read, one\n // controller per file, gated by authMiddleware in routes.ts.\n const withSpecs = await fileExistsAsync(srcPath(\"test-setup.ts\"));\n if (withSpecs) {\n await writeModuleFile(\"tests/notifications.fixture.ts\", notificationTestFixtureStub, skipped);\n }\n\n for (const controller of notificationControllers) {\n await writeModuleFile(`controllers/${controller.file}.ts`, controller.stub, skipped);\n\n if (withSpecs) {\n await writeModuleFile(\n `controllers/${controller.file}.spec.ts`,\n notificationControllerSpecStub(controller.method, controller.path),\n skipped,\n );\n }\n }\n\n await writeModuleFile(\"routes.ts\", notificationRoutesStub, skipped);\n\n if (skipped.length > 0) {\n console.log(\n `${colors.yellowBright(\"Kept your existing files\")} (not overwritten): ${skipped\n .map((file) => `src/app/notifications/${file}`)\n .join(\", \")}`,\n );\n }\n}\n\nexport const notificationsFeature: FeatureDefinition = {\n description:\n \"Installs @warlock.js/notifications — multi-channel notifications (mail + in-app database). Pulls the mail feature, ejects config/notifications.ts, and scaffolds src/app/notifications: the Notification model + migration, a resource, a validated list query, and the recipient-scoped list / unread-count / mark-read / mark-all-read endpoints (one controller per file, a spec each when tests are set up)\",\n // The ejected config wires a `mail` channel by default (needs nodemailer,\n // via the `mail` feature); the scaffolded routes are gated by\n // `authMiddleware`, so `@warlock.js/auth` is pulled in too.\n requires: [\"mail\"],\n dependencies: {\n \"@warlock.js/notifications\": INSTALLED_WARLOCK_VERSION,\n \"@warlock.js/auth\": INSTALLED_WARLOCK_VERSION,\n },\n ejectConfig: {\n content: notificationsConfigStub,\n name: \"notifications\",\n },\n onExecuting: completeNotificationsInstallation,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,MAAM,0BAA0B;CAC9B;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN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QAAQ,eAAe,CAAC;CAChE,IAAI,WACF,MAAM,gBAAgB,kCAAkC,6BAA6B,OAAO;CAG9F,KAAK,MAAM,cAAc,yBAAyB;EAChD,MAAM,gBAAgB,eAAe,WAAW,KAAK,MAAM,WAAW,MAAM,OAAO;EAEnF,IAAI,WACF,MAAM,gBACJ,eAAe,WAAW,KAAK,WAC/B,+BAA+B,WAAW,QAAQ,WAAW,IAAI,GACjE,OACF;CAEJ;CAEA,MAAM,gBAAgB,aAAa,wBAAwB,OAAO;CAElE,IAAI,QAAQ,SAAS,GACnB,QAAQ,IACN,GAAG,OAAO,aAAa,0BAA0B,EAAE,sBAAsB,QACtE,KAAK,SAAS,yBAAyB,MAAM,CAAC,CAC9C,KAAK,IAAI,GACd;AAEJ;AAEA,MAAa,uBAA0C;CACrD,aACE;CAIF,UAAU,CAAC,MAAM;CACjB,cAAc;EACZ,6BAA6B;EAC7B,oBAAoB;CACtB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;CACA,aAAa;AACf"}
|
|
1
|
+
{"version":3,"file":"notifications.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/notifications.feature.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { dirname } from \"node:path\";\nimport {\n directoryExistsAsync,\n ensureDirectoryAsync,\n fileExistsAsync,\n getFileAsync,\n putFileAsync,\n recordSkippedFile,\n} from \"../generation-fs\";\nimport type { CommandActionData } from \"../../commands/types\";\nimport { srcPath } from \"../../utils\";\nimport {\n listNotificationsControllerStub,\n listNotificationsSchemaStub,\n markAllNotificationsReadControllerStub,\n markNotificationReadControllerStub,\n markNotificationReadServiceStub,\n notificationControllerSpecStub,\n notificationTestFixtureStub,\n notificationLocalesStub,\n notificationMigrationStub,\n notificationModelStub,\n notificationResourceStub,\n notificationRoutesStub,\n notificationsConfigStub,\n notificationsRequestTypeStub,\n unreadNotificationsCountControllerStub,\n} from \"../stubs\";\nimport { migrationTimestamp } from \"./shared/migration-timestamp\";\nimport { type FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\n/**\n * The module's controllers, with the route each one serves. A spec per\n * controller is written next to it when the app has the test feature.\n */\nconst notificationControllers = [\n {\n file: \"list-notifications.controller\",\n stub: listNotificationsControllerStub,\n method: \"GET\",\n path: \"/notifications\",\n },\n {\n file: \"unread-notifications-count.controller\",\n stub: unreadNotificationsCountControllerStub,\n method: \"GET\",\n path: \"/notifications/unread-count\",\n },\n {\n file: \"mark-notification-read.controller\",\n stub: markNotificationReadControllerStub,\n method: \"PATCH\",\n path: \"/notifications/1/read\",\n },\n {\n file: \"mark-all-notifications-read.controller\",\n stub: markAllNotificationsReadControllerStub,\n method: \"PATCH\",\n path: \"/notifications/read-all\",\n },\n] as const;\n\n/** The model's import path in the ejected config, before and since 5.30. */\nconst MODEL_IMPORT = \"app/notifications/models/notification/notification.model\";\nconst LEGACY_MODEL_IMPORT = \"app/notifications/notification.model\";\n\n/**\n * Write one module file unless it already exists. A file the app already has\n * is the app's own code: it is reported and left alone, never overwritten.\n */\nasync function writeModuleFile(relativePath: string, content: string, skipped: string[]) {\n const path = srcPath(\"app/notifications\", relativePath);\n\n if (await fileExistsAsync(path)) {\n skipped.push(relativePath);\n recordSkippedFile(path, \"exists\");\n return;\n }\n\n await ensureDirectoryAsync(dirname(path));\n await putFileAsync(path, content);\n console.log(`${colors.green(\"✓\")} Created src/app/notifications/${relativePath}`);\n}\n\n/**\n * Add the module's `notFound` message to an existing utils/locales.json, or\n * create the file. Existing keys win; a file that is not a JSON object, or\n * that renames its group, is left for the app to update by hand.\n */\nasync function registerNotificationLocales(skipped: string[]) {\n const localesPath = srcPath(\"app/notifications/utils/locales.json\");\n\n if (!(await fileExistsAsync(localesPath))) {\n await writeModuleFile(\"utils/locales.json\", notificationLocalesStub, skipped);\n return;\n }\n\n const defaults = JSON.parse(notificationLocalesStub) as Record<string, unknown>;\n let dictionary: Record<string, unknown>;\n\n try {\n const parsed: unknown = JSON.parse(await getFileAsync(localesPath));\n\n if (parsed === null || Array.isArray(parsed) || typeof parsed !== \"object\") throw new Error();\n\n dictionary = parsed as Record<string, unknown>;\n } catch {\n console.log(\n `${colors.yellowBright(\"notifications\")} locale JSON is invalid; add notFound to src/app/notifications/utils/locales.json manually.`,\n );\n return;\n }\n\n // A root `$group` renames the file's namespace, so the service's\n // t(\"notifications.notFound\") would not find a key merged here.\n if (dictionary.$group !== undefined && dictionary.$group !== \"notifications\") {\n console.log(\n `${colors.yellowBright(\"notifications\")} locale JSON declares a different $group; add notifications.notFound manually.`,\n );\n return;\n }\n\n const missing = Object.keys(defaults).filter((key) => dictionary[key] === undefined);\n\n if (missing.length === 0) return;\n\n for (const key of missing) dictionary[key] = defaults[key];\n\n await putFileAsync(localesPath, `${JSON.stringify(dictionary, null, 2)}\\n`);\n console.log(\n `${colors.green(\"✓\")} Added ${missing.join(\", \")} to src/app/notifications/utils/locales.json`,\n );\n}\n\n/**\n * The config ejected just before this runs imports the 5.30 model path. In an\n * app scaffolded by 5.29 the model is still at the module root, so point the\n * import there instead of at a file that does not exist.\n */\nasync function pointConfigAtLegacyModel() {\n const configPath = srcPath(\"config/notifications.ts\");\n\n if (!(await fileExistsAsync(configPath))) return;\n\n const config = await getFileAsync(configPath);\n\n if (!config.includes(`\"${MODEL_IMPORT}\"`)) return;\n\n await putFileAsync(configPath, config.replace(`\"${MODEL_IMPORT}\"`, `\"${LEGACY_MODEL_IMPORT}\"`));\n console.log(\n `${colors.green(\"✓\")} src/config/notifications.ts imports the existing model at ${LEGACY_MODEL_IMPORT}`,\n );\n}\n\nasync function completeNotificationsInstallation(_options: CommandActionData) {\n const modelPath = srcPath(\"app/notifications/models/notification/notification.model.ts\");\n // Where 5.29 and earlier wrote the model.\n const legacyModelPath = srcPath(\"app/notifications/notification.model.ts\");\n\n // The model file is the sentinel for \"notifications already scaffolded\" —\n // its presence means the migration was created too (timestamped, so we must\n // not re-emit a duplicate on a second run).\n if (await fileExistsAsync(legacyModelPath)) {\n if (!(await fileExistsAsync(modelPath))) await pointConfigAtLegacyModel();\n\n console.log(\n `${colors.yellowBright(\"src/app/notifications\")} already scaffolded (5.29 layout), skipping...`,\n );\n return;\n }\n\n if (await fileExistsAsync(modelPath)) {\n console.log(`${colors.yellowBright(\"src/app/notifications\")} already scaffolded, skipping...`);\n return;\n }\n\n const skipped: string[] = [];\n // An app that already has its own notifications module may keep its model\n // anywhere in it; a second Notification model would collide with it.\n const moduleExists = await directoryExistsAsync(srcPath(\"app/notifications\"));\n\n // 1. Model + migration under models/notification/, like every other module.\n // The migration's MM-DD-YYYY_HH-MM-SS prefix lets cascade infer its\n // createdAt and order it deterministically.\n if (moduleExists) {\n console.log(\n `${colors.yellowBright(\"src/app/notifications\")} already exists: not adding a Notification model or migration. config/notifications.ts must import your model.`,\n );\n } else {\n await writeModuleFile(\n \"models/notification/notification.model.ts\",\n notificationModelStub,\n skipped,\n );\n await writeModuleFile(\n `models/notification/migrations/${migrationTimestamp()}-notification.migration.ts`,\n notificationMigrationStub,\n skipped,\n );\n }\n\n // 2. One responsibility per file: output resource, validated list query,\n // guarded request type, service, translations.\n await writeModuleFile(\"resources/notification.resource.ts\", notificationResourceStub, skipped);\n await writeModuleFile(\n \"schema/list-notifications.schema.ts\",\n listNotificationsSchemaStub,\n skipped,\n );\n await writeModuleFile(\n \"types/notifications-request.type.ts\",\n notificationsRequestTypeStub,\n skipped,\n );\n await writeModuleFile(\n \"services/mark-notification-read.service.ts\",\n markNotificationReadServiceStub,\n skipped,\n );\n await registerNotificationLocales(skipped);\n\n // 3. HTTP surface — list, unread count, mark read, mark all read, one\n // controller per file, gated by authMiddleware in routes.ts.\n const withSpecs = await fileExistsAsync(srcPath(\"test-setup.ts\"));\n if (withSpecs) {\n await writeModuleFile(\"tests/notifications.fixture.ts\", notificationTestFixtureStub, skipped);\n }\n\n for (const controller of notificationControllers) {\n await writeModuleFile(`controllers/${controller.file}.ts`, controller.stub, skipped);\n\n if (withSpecs) {\n await writeModuleFile(\n `controllers/${controller.file}.spec.ts`,\n notificationControllerSpecStub(controller.method, controller.path),\n skipped,\n );\n }\n }\n\n await writeModuleFile(\"routes.ts\", notificationRoutesStub, skipped);\n\n if (skipped.length > 0) {\n console.log(\n `${colors.yellowBright(\"Kept your existing files\")} (not overwritten): ${skipped\n .map((file) => `src/app/notifications/${file}`)\n .join(\", \")}`,\n );\n }\n}\n\nexport const notificationsFeature: FeatureDefinition = {\n description:\n \"Installs @warlock.js/notifications — multi-channel notifications (mail + in-app database). Pulls the mail feature, ejects config/notifications.ts, and scaffolds src/app/notifications: the Notification model + migration, a resource, a validated list query, and the recipient-scoped list / unread-count / mark-read / mark-all-read endpoints (one controller per file, a spec each when tests are set up)\",\n // The ejected config wires a `mail` channel by default (needs nodemailer,\n // via the `mail` feature); the scaffolded routes are gated by\n // `authMiddleware`, so `@warlock.js/auth` is pulled in too.\n requires: [\"mail\"],\n dependencies: {\n \"@warlock.js/notifications\": INSTALLED_WARLOCK_VERSION,\n \"@warlock.js/auth\": INSTALLED_WARLOCK_VERSION,\n },\n ejectConfig: {\n content: notificationsConfigStub,\n name: \"notifications\",\n },\n onExecuting: completeNotificationsInstallation,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,MAAM,0BAA0B;CAC9B;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,MAAM;CACR;AACF;;AAGA,MAAM,eAAe;AACrB,MAAM,sBAAsB;;;;;AAM5B,eAAe,gBAAgB,cAAsB,SAAiB,SAAmB;CACvF,MAAM,OAAO,QAAQ,qBAAqB,YAAY;CAEtD,IAAI,MAAM,gBAAgB,IAAI,GAAG;EAC/B,QAAQ,KAAK,YAAY;EACzB,kBAAkB,MAAM,QAAQ;EAChC;CACF;CAEA,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AQ,WAAW,IAAI,GACjE,OACF;CAEJ;CAEA,MAAM,gBAAgB,aAAa,wBAAwB,OAAO;CAElE,IAAI,QAAQ,SAAS,GACnB,QAAQ,IACN,GAAG,OAAO,aAAa,0BAA0B,EAAE,sBAAsB,QACtE,KAAK,SAAS,yBAAyB,MAAM,CAAC,CAC9C,KAAK,IAAI,GACd;AAEJ;AAEA,MAAa,uBAA0C;CACrD,aACE;CAIF,UAAU,CAAC,MAAM;CACjB,cAAc;EACZ,6BAA6B;EAC7B,oBAAoB;CACtB;CACA,aAAa;EACX,SAAS;EACT,MAAM;CACR;CACA,aAAa;AACf"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { srcPath } from "../../utils/paths.mjs";
|
|
2
|
+
import "../../utils/index.mjs";
|
|
3
|
+
import { recordSkippedFile } from "../generation-run.mjs";
|
|
4
|
+
import { fileExistsAsync, getFileAsync, putFileAsync } from "../generation-fs.mjs";
|
|
5
|
+
import { INSTALLED_WARLOCK_VERSION } from "./types.mjs";
|
|
6
|
+
|
|
7
|
+
//#region ../../packages/core/src/generations/features/process.feature.ts
|
|
8
|
+
const processConfig = `import { rootPath } from "@warlock.js/core";
|
|
9
|
+
import type { SupervisorOptions } from "@warlock.js/process";
|
|
10
|
+
|
|
11
|
+
const processConfig = {
|
|
12
|
+
owner: "app",
|
|
13
|
+
registry: rootPath("storage/processes/registry.json"),
|
|
14
|
+
defaults: { timeoutMs: 300_000, memoryBytes: 512 * 1024 * 1024 },
|
|
15
|
+
} satisfies SupervisorOptions;
|
|
16
|
+
|
|
17
|
+
export default processConfig;
|
|
18
|
+
`;
|
|
19
|
+
const processes = `import { supervisor } from "@warlock.js/process";
|
|
20
|
+
import processConfig from "../../config/process";
|
|
21
|
+
|
|
22
|
+
export const processes = supervisor(processConfig);
|
|
23
|
+
`;
|
|
24
|
+
const lifecycle = `import { Application } from "@warlock.js/core";
|
|
25
|
+
import { processes } from "./index";
|
|
26
|
+
|
|
27
|
+
Application.onValidateBoot(async () => {
|
|
28
|
+
await processes.recover();
|
|
29
|
+
});
|
|
30
|
+
Application.onShutdown(async () => {
|
|
31
|
+
await processes.stopAll();
|
|
32
|
+
});
|
|
33
|
+
`;
|
|
34
|
+
async function createOnce(file, content) {
|
|
35
|
+
if (await fileExistsAsync(file)) {
|
|
36
|
+
recordSkippedFile(file, "exists");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
await putFileAsync(file, content);
|
|
40
|
+
}
|
|
41
|
+
const processFeature = {
|
|
42
|
+
description: "App-owned processes and terminals; creates typed config, recovery and graceful shutdown hooks, and a development process panel.",
|
|
43
|
+
dependencies: { "@warlock.js/process": INSTALLED_WARLOCK_VERSION },
|
|
44
|
+
ejectConfig: {
|
|
45
|
+
name: "process",
|
|
46
|
+
content: processConfig
|
|
47
|
+
},
|
|
48
|
+
async onExecuting() {
|
|
49
|
+
await createOnce(srcPath("app/processes/index.ts"), processes);
|
|
50
|
+
await createOnce(srcPath("app/processes/lifecycle.ts"), lifecycle);
|
|
51
|
+
const main = srcPath("app/main.ts");
|
|
52
|
+
const content = await fileExistsAsync(main) ? await getFileAsync(main) : "";
|
|
53
|
+
if (!/import\s*["']\.\/processes\/lifecycle["']/.test(content)) await putFileAsync(main, `import "./processes/lifecycle";\n${content}`);
|
|
54
|
+
else recordSkippedFile(main, "exists");
|
|
55
|
+
await createOnce(srcPath("app/processes/devtools.ts"), `import { processes } from "./index";
|
|
56
|
+
|
|
57
|
+
export const processPanel = { list: () => processes.list() };
|
|
58
|
+
`);
|
|
59
|
+
console.log("Process supervision configured. Next: set a unique owner and registry per app instance in src/config/process.ts, then import { processes } from your app/processes module and await processes.spawn(...). Install devtools with warlock add devtools to view the Processes panel. Install node-pty separately for spawnPty(). macOS also needs the shipped identity helper compiled and WARLOCK_PROCESS_IDENTITY_HELPER configured; see the process package README.");
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { processFeature };
|
|
65
|
+
//# sourceMappingURL=process.feature.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.feature.mjs","names":[],"sources":["../../../../../../../../../packages/core/src/generations/features/process.feature.ts"],"sourcesContent":["import { srcPath } from \"../../utils\";\nimport { fileExistsAsync, getFileAsync, putFileAsync, recordSkippedFile } from \"../generation-fs\";\nimport { type FeatureDefinition, INSTALLED_WARLOCK_VERSION } from \"./types\";\n\nconst processConfig = `import { rootPath } from \"@warlock.js/core\";\nimport type { SupervisorOptions } from \"@warlock.js/process\";\n\nconst processConfig = {\n owner: \"app\",\n registry: rootPath(\"storage/processes/registry.json\"),\n defaults: { timeoutMs: 300_000, memoryBytes: 512 * 1024 * 1024 },\n} satisfies SupervisorOptions;\n\nexport default processConfig;\n`;\n\nconst processes = `import { supervisor } from \"@warlock.js/process\";\nimport processConfig from \"../../config/process\";\n\nexport const processes = supervisor(processConfig);\n`;\n\nconst lifecycle = `import { Application } from \"@warlock.js/core\";\nimport { processes } from \"./index\";\n\nApplication.onValidateBoot(async () => {\n await processes.recover();\n});\nApplication.onShutdown(async () => {\n await processes.stopAll();\n});\n`;\n\nasync function createOnce(file: string, content: string): Promise<void> {\n if (await fileExistsAsync(file)) {\n recordSkippedFile(file, \"exists\");\n return;\n }\n await putFileAsync(file, content);\n}\n\nexport const processFeature: FeatureDefinition = {\n description:\n \"App-owned processes and terminals; creates typed config, recovery and graceful shutdown hooks, and a development process panel.\",\n dependencies: { \"@warlock.js/process\": INSTALLED_WARLOCK_VERSION },\n ejectConfig: { name: \"process\", content: processConfig },\n async onExecuting() {\n await createOnce(srcPath(\"app/processes/index.ts\"), processes);\n await createOnce(srcPath(\"app/processes/lifecycle.ts\"), lifecycle);\n const main = srcPath(\"app/main.ts\");\n const content = (await fileExistsAsync(main)) ? await getFileAsync(main) : \"\";\n if (!/import\\s*[\"']\\.\\/processes\\/lifecycle[\"']/.test(content)) {\n await putFileAsync(main, `import \"./processes/lifecycle\";\\n${content}`);\n } else recordSkippedFile(main, \"exists\");\n // Devtools discovers this source only in development and only when installed.\n await createOnce(\n srcPath(\"app/processes/devtools.ts\"),\n `import { processes } from \"./index\";\n\nexport const processPanel = { list: () => processes.list() };\n`,\n );\n console.log(\n \"Process supervision configured. Next: set a unique owner and registry per app instance in src/config/process.ts, then import { processes } from your app/processes module and await processes.spawn(...). Install devtools with warlock add devtools to view the Processes panel. Install node-pty separately for spawnPty(). macOS also needs the shipped identity helper compiled and WARLOCK_PROCESS_IDENTITY_HELPER configured; see the process package README.\",\n );\n },\n};\n"],"mappings":";;;;;;;AAIA,MAAM,gBAAgB;;;;;;;;;;;AAYtB,MAAM,YAAY;;;;;AAMlB,MAAM,YAAY;;;;;;;;;;AAWlB,eAAe,WAAW,MAAc,SAAgC;CACtE,IAAI,MAAM,gBAAgB,IAAI,GAAG;EAC/B,kBAAkB,MAAM,QAAQ;EAChC;CACF;CACA,MAAM,aAAa,MAAM,OAAO;AAClC;AAEA,MAAa,iBAAoC;CAC/C,aACE;CACF,cAAc,EAAE,uBAAuB,0BAA0B;CACjE,aAAa;EAAE,MAAM;EAAW,SAAS;CAAc;CACvD,MAAM,cAAc;EAClB,MAAM,WAAW,QAAQ,wBAAwB,GAAG,SAAS;EAC7D,MAAM,WAAW,QAAQ,4BAA4B,GAAG,SAAS;EACjE,MAAM,OAAO,QAAQ,aAAa;EAClC,MAAM,UAAW,MAAM,gBAAgB,IAAI,IAAK,MAAM,aAAa,IAAI,IAAI;EAC3E,IAAI,CAAC,4CAA4C,KAAK,OAAO,GAC3D,MAAM,aAAa,MAAM,oCAAoC,SAAS;OACjE,kBAAkB,MAAM,QAAQ;EAEvC,MAAM,WACJ,QAAQ,2BAA2B,GACnC;;;CAIF;EACA,QAAQ,IACN,qcACF;CACF;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isExportAssignment, isIdentifier, isNumericLiteral, isObjectLiteralExpression, isPropertyAssignment, isShorthandPropertyAssignment, isStringLiteral, isVariableStatement, nameNode, parseSourceFile, topLevelDeclarations, valueText } from "../../../tooling/syntax/ast.mjs";
|
|
2
|
+
import { parseSync } from "oxc-parser";
|
|
2
3
|
|
|
3
4
|
//#region ../../packages/core/src/generations/features/shared/merge-web-sitemap-config.ts
|
|
4
5
|
/**
|
|
@@ -35,12 +36,11 @@ import ts from "typescript";
|
|
|
35
36
|
* @returns What happened, and the new text when there is any.
|
|
36
37
|
*/
|
|
37
38
|
function mergeWebSitemapConfig(source) {
|
|
38
|
-
const
|
|
39
|
-
const objectLiteral = findExportedConfigObjectLiteral(sourceFile);
|
|
39
|
+
const objectLiteral = findExportedConfigObjectLiteral(parseSourceFile("web.ts", source));
|
|
40
40
|
if (!objectLiteral) return { status: "unrecognised" };
|
|
41
41
|
if (hasTopLevelSitemapProperty(objectLiteral)) return { status: "already-present" };
|
|
42
|
-
const bodyStart = objectLiteral.
|
|
43
|
-
const closingBraceIndex = objectLiteral.
|
|
42
|
+
const bodyStart = objectLiteral.start + 1;
|
|
43
|
+
const closingBraceIndex = objectLiteral.end - 1;
|
|
44
44
|
const body = source.slice(bodyStart, closingBraceIndex);
|
|
45
45
|
const indentMatch = /\n([ \t]*)\S/.exec(body);
|
|
46
46
|
const indent = indentMatch ? indentMatch[1] : " ";
|
|
@@ -55,14 +55,7 @@ function mergeWebSitemapConfig(source) {
|
|
|
55
55
|
}
|
|
56
56
|
/** Whether TEXT fails to parse as TypeScript source. */
|
|
57
57
|
function hasSyntaxErrors(text) {
|
|
58
|
-
|
|
59
|
-
compilerOptions: {
|
|
60
|
-
module: ts.ModuleKind.ESNext,
|
|
61
|
-
target: ts.ScriptTarget.ESNext
|
|
62
|
-
},
|
|
63
|
-
reportDiagnostics: true
|
|
64
|
-
});
|
|
65
|
-
return Boolean(diagnostics && diagnostics.length > 0);
|
|
58
|
+
return parseSync("web.ts", text).errors.length > 0;
|
|
66
59
|
}
|
|
67
60
|
/**
|
|
68
61
|
* Whether the exported config object literal already has a `sitemap`
|
|
@@ -71,11 +64,11 @@ function hasSyntaxErrors(text) {
|
|
|
71
64
|
* and must not block adding the top-level one.
|
|
72
65
|
*/
|
|
73
66
|
function hasTopLevelSitemapProperty(objectLiteral) {
|
|
74
|
-
return objectLiteral.properties.some((property) => (
|
|
67
|
+
return objectLiteral.properties.some((property) => (isPropertyAssignment(property) || isShorthandPropertyAssignment(property)) && propertyKeyName(nameNode(property)) === "sitemap");
|
|
75
68
|
}
|
|
76
69
|
/** The literal text of a property name node, when it is one of the plain shapes we care about. */
|
|
77
70
|
function propertyKeyName(name) {
|
|
78
|
-
if (
|
|
71
|
+
if (isIdentifier(name) || isStringLiteral(name) || isNumericLiteral(name)) return valueText(name);
|
|
79
72
|
}
|
|
80
73
|
/**
|
|
81
74
|
* Find the object literal a source file's default export ultimately points
|
|
@@ -83,15 +76,15 @@ function propertyKeyName(name) {
|
|
|
83
76
|
* file.
|
|
84
77
|
*/
|
|
85
78
|
function findExportedConfigObjectLiteral(sourceFile) {
|
|
86
|
-
const exportAssignment = sourceFile.
|
|
79
|
+
const exportAssignment = sourceFile.body.find((statement) => isExportAssignment(statement));
|
|
87
80
|
if (!exportAssignment) return void 0;
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
if (!
|
|
91
|
-
const identifier = expression
|
|
92
|
-
for (const statement of sourceFile
|
|
93
|
-
if (!
|
|
94
|
-
for (const declaration of statement.
|
|
81
|
+
const expression = exportAssignment.declaration;
|
|
82
|
+
if (isObjectLiteralExpression(expression)) return expression;
|
|
83
|
+
if (!isIdentifier(expression)) return void 0;
|
|
84
|
+
const identifier = valueText(expression);
|
|
85
|
+
for (const statement of topLevelDeclarations(sourceFile)) {
|
|
86
|
+
if (!isVariableStatement(statement)) continue;
|
|
87
|
+
for (const declaration of statement.declarations) if (isIdentifier(nameNode(declaration)) && valueText(declaration.id) === identifier && declaration.init && isObjectLiteralExpression(declaration.init)) return declaration.init;
|
|
95
88
|
}
|
|
96
89
|
}
|
|
97
90
|
/**
|