@warlock.js/core 5.0.2 → 5.2.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 +190 -0
- package/esm/application/app.d.mts +1 -1
- package/esm/application/app.d.mts.map +1 -1
- package/esm/application/app.mjs +1 -1
- package/esm/application/app.mjs.map +1 -1
- package/esm/application/application-config-types.d.mts +1 -1
- package/esm/application/application-config-types.d.mts.map +1 -1
- package/esm/application/application.d.mts +1 -1
- package/esm/application/application.d.mts.map +1 -1
- package/esm/application/application.mjs +1 -1
- package/esm/application/application.mjs.map +1 -1
- package/esm/application/boot-signal.d.mts +1 -1
- package/esm/application/boot-signal.d.mts.map +1 -1
- package/esm/application/boot-signal.mjs +1 -1
- package/esm/application/boot-signal.mjs.map +1 -1
- package/esm/benchmark/benchmark-snapshots.d.mts +1 -1
- package/esm/benchmark/benchmark-snapshots.d.mts.map +1 -1
- package/esm/benchmark/benchmark-snapshots.mjs +1 -1
- package/esm/benchmark/benchmark-snapshots.mjs.map +1 -1
- package/esm/benchmark/benchmark.d.mts +1 -1
- package/esm/benchmark/benchmark.d.mts.map +1 -1
- package/esm/benchmark/benchmark.mjs +1 -1
- package/esm/benchmark/benchmark.mjs.map +1 -1
- package/esm/benchmark/channels/console.channel.d.mts +1 -1
- package/esm/benchmark/channels/console.channel.d.mts.map +1 -1
- package/esm/benchmark/channels/console.channel.mjs +1 -1
- package/esm/benchmark/channels/console.channel.mjs.map +1 -1
- package/esm/benchmark/channels/noop.channel.d.mts +1 -1
- package/esm/benchmark/channels/noop.channel.d.mts.map +1 -1
- package/esm/benchmark/channels/noop.channel.mjs +1 -1
- package/esm/benchmark/channels/noop.channel.mjs.map +1 -1
- package/esm/benchmark/profiler.d.mts +1 -1
- package/esm/benchmark/profiler.d.mts.map +1 -1
- package/esm/benchmark/profiler.mjs +1 -1
- package/esm/benchmark/profiler.mjs.map +1 -1
- package/esm/benchmark/types.d.mts +1 -1
- package/esm/benchmark/types.d.mts.map +1 -1
- package/esm/bootstrap/setup.d.mts +1 -1
- package/esm/bootstrap/setup.d.mts.map +1 -1
- package/esm/bootstrap/setup.mjs +1 -1
- package/esm/bootstrap/setup.mjs.map +1 -1
- package/esm/bootstrap.d.mts +1 -1
- package/esm/bootstrap.d.mts.map +1 -1
- package/esm/bootstrap.mjs +1 -1
- package/esm/bootstrap.mjs.map +1 -1
- package/esm/cache/database-cache-driver.d.mts +1 -1
- package/esm/cache/database-cache-driver.d.mts.map +1 -1
- package/esm/cache/database-cache-driver.mjs +1 -1
- package/esm/cache/database-cache-driver.mjs.map +1 -1
- package/esm/cache/index.mjs +1 -1
- package/esm/cache/index.mjs.map +1 -1
- package/esm/cli/cli-commands.manager.mjs +37 -2
- package/esm/cli/cli-commands.manager.mjs.map +1 -1
- package/esm/cli/cli-commands.utils.mjs +17 -11
- package/esm/cli/cli-commands.utils.mjs.map +1 -1
- package/esm/cli/commands/add.command.mjs +1 -1
- package/esm/cli/commands/add.command.mjs.map +1 -1
- package/esm/cli/commands/build.command.mjs +1 -1
- package/esm/cli/commands/build.command.mjs.map +1 -1
- package/esm/cli/commands/create-database.command.mjs +1 -1
- package/esm/cli/commands/create-database.command.mjs.map +1 -1
- package/esm/cli/commands/dev-server.command.mjs +2 -2
- package/esm/cli/commands/dev-server.command.mjs.map +1 -1
- package/esm/cli/commands/doctor/boot-for-diagnostics.mjs +207 -0
- package/esm/cli/commands/doctor/boot-for-diagnostics.mjs.map +1 -0
- package/esm/cli/commands/doctor/checks/config.check.mjs +6 -3
- package/esm/cli/commands/doctor/checks/config.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/connectors.check.mjs +39 -13
- package/esm/cli/commands/doctor/checks/connectors.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/handler-signature.check.mjs +9 -5
- package/esm/cli/commands/doctor/checks/handler-signature.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/health.check.mjs +78 -12
- package/esm/cli/commands/doctor/checks/health.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/index.mjs +6 -1
- package/esm/cli/commands/doctor/checks/index.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/optional-peers.check.mjs +117 -54
- package/esm/cli/commands/doctor/checks/optional-peers.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs +28 -10
- package/esm/cli/commands/doctor/checks/release-hygiene.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/checks/routes.check.mjs +52 -13
- package/esm/cli/commands/doctor/checks/routes.check.mjs.map +1 -1
- package/esm/cli/commands/doctor/doctor-command.action.mjs +17 -7
- package/esm/cli/commands/doctor/doctor-command.action.mjs.map +1 -1
- package/esm/cli/commands/doctor/format-report.mjs +1 -1
- package/esm/cli/commands/doctor/format-report.mjs.map +1 -1
- package/esm/cli/commands/doctor/run-checks.mjs +16 -7
- package/esm/cli/commands/doctor/run-checks.mjs.map +1 -1
- package/esm/cli/commands/doctor.command.mjs +18 -10
- package/esm/cli/commands/doctor.command.mjs.map +1 -1
- package/esm/cli/commands/drop-tables.command.mjs +1 -1
- package/esm/cli/commands/drop-tables.command.mjs.map +1 -1
- package/esm/cli/commands/generate/generate.command.mjs +1 -1
- package/esm/cli/commands/generate/generate.command.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/column-dsl-parser.mjs +1 -1
- package/esm/cli/commands/generate/generators/column-dsl-parser.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/controller.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/controller.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/migration.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/migration.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/model.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/model.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/module.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/module.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/repository.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/repository.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/resource.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/resource.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/service.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/service.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/templates/stubs.mjs +1 -1
- package/esm/cli/commands/generate/templates/stubs.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/name-parser.mjs +1 -1
- package/esm/cli/commands/generate/utils/name-parser.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/path-resolver.mjs +1 -1
- package/esm/cli/commands/generate/utils/path-resolver.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/prompt.mjs +1 -1
- package/esm/cli/commands/generate/utils/prompt.mjs.map +1 -1
- package/esm/cli/commands/generate/utils/writer.mjs +1 -1
- package/esm/cli/commands/generate/utils/writer.mjs.map +1 -1
- package/esm/cli/commands/migrate.command.mjs +1 -1
- package/esm/cli/commands/migrate.command.mjs.map +1 -1
- package/esm/cli/commands/routes/diff-page-routes.mjs +84 -0
- package/esm/cli/commands/routes/diff-page-routes.mjs.map +1 -0
- package/esm/cli/commands/routes/format-routes-table.mjs +1 -1
- package/esm/cli/commands/routes/format-routes-table.mjs.map +1 -1
- package/esm/cli/commands/routes/route-row.mjs +1 -1
- package/esm/cli/commands/routes/route-row.mjs.map +1 -1
- package/esm/cli/commands/routes/routes-command.action.mjs +1 -1
- package/esm/cli/commands/routes/routes-command.action.mjs.map +1 -1
- package/esm/cli/commands/routes/routes-diff.action.mjs +84 -0
- package/esm/cli/commands/routes/routes-diff.action.mjs.map +1 -0
- package/esm/cli/commands/routes.command.mjs +16 -2
- package/esm/cli/commands/routes.command.mjs.map +1 -1
- package/esm/cli/commands/seed.command.mjs +1 -1
- package/esm/cli/commands/seed.command.mjs.map +1 -1
- package/esm/cli/commands/start-production.command.mjs +9 -2
- package/esm/cli/commands/start-production.command.mjs.map +1 -1
- package/esm/cli/commands/storage-put.action.mjs +1 -1
- package/esm/cli/commands/storage-put.action.mjs.map +1 -1
- package/esm/cli/commands/storage-put.command.mjs +1 -1
- package/esm/cli/commands/storage-put.command.mjs.map +1 -1
- package/esm/cli/commands/typings-generator.command.mjs +1 -1
- package/esm/cli/commands/typings-generator.command.mjs.map +1 -1
- package/esm/cli/commands/update.command.mjs +1 -1
- package/esm/cli/commands/update.command.mjs.map +1 -1
- package/esm/cli/commands-loader.mjs +1 -1
- package/esm/cli/commands-loader.mjs.map +1 -1
- package/esm/cli/framework-cli-commands.mjs +3 -2
- package/esm/cli/framework-cli-commands.mjs.map +1 -1
- package/esm/cli/parse-cli-args.mjs +1 -1
- package/esm/cli/parse-cli-args.mjs.map +1 -1
- package/esm/cli/start.mjs +1 -1
- package/esm/cli/start.mjs.map +1 -1
- package/esm/cli/string-similarity.mjs +1 -1
- package/esm/cli/string-similarity.mjs.map +1 -1
- package/esm/commands/cli-command.d.mts +1 -1
- package/esm/commands/cli-command.d.mts.map +1 -1
- package/esm/commands/cli-command.mjs +1 -1
- package/esm/commands/cli-command.mjs.map +1 -1
- package/esm/commands/types.d.mts +1 -1
- package/esm/commands/types.d.mts.map +1 -1
- package/esm/config/config-getter.d.mts +1 -1
- package/esm/config/config-getter.d.mts.map +1 -1
- package/esm/config/config-getter.mjs +1 -1
- package/esm/config/config-getter.mjs.map +1 -1
- package/esm/config/config-handlers.d.mts +1 -1
- package/esm/config/config-handlers.d.mts.map +1 -1
- package/esm/config/config-handlers.mjs +1 -1
- package/esm/config/config-handlers.mjs.map +1 -1
- package/esm/config/config-loader.d.mts +2 -2
- package/esm/config/config-loader.d.mts.map +1 -1
- package/esm/config/config-loader.mjs +1 -1
- package/esm/config/config-loader.mjs.map +1 -1
- package/esm/config/config-manager.mjs +1 -1
- package/esm/config/config-manager.mjs.map +1 -1
- package/esm/config/config-setter.d.mts +1 -1
- package/esm/config/config-setter.d.mts.map +1 -1
- package/esm/config/config-setter.mjs +1 -1
- package/esm/config/config-setter.mjs.map +1 -1
- package/esm/config/config-special-handlers.d.mts +2 -2
- package/esm/config/config-special-handlers.d.mts.map +1 -1
- package/esm/config/config-special-handlers.mjs +1 -1
- package/esm/config/config-special-handlers.mjs.map +1 -1
- package/esm/config/load-config-files.mjs +1 -1
- package/esm/config/load-config-files.mjs.map +1 -1
- package/esm/config/locale-configuration.mjs +1 -1
- package/esm/config/locale-configuration.mjs.map +1 -1
- package/esm/config/types.d.mts +1 -1
- package/esm/config/types.d.mts.map +1 -1
- package/esm/connectors/access-connector.d.mts +1 -1
- package/esm/connectors/access-connector.d.mts.map +1 -1
- package/esm/connectors/access-connector.mjs +1 -1
- package/esm/connectors/access-connector.mjs.map +1 -1
- package/esm/connectors/ai-connector.d.mts +1 -1
- package/esm/connectors/ai-connector.d.mts.map +1 -1
- package/esm/connectors/ai-connector.mjs +1 -1
- package/esm/connectors/ai-connector.mjs.map +1 -1
- package/esm/connectors/assert-no-reserved-connector-names.d.mts +1 -1
- package/esm/connectors/assert-no-reserved-connector-names.d.mts.map +1 -1
- package/esm/connectors/assert-no-reserved-connector-names.mjs +1 -1
- package/esm/connectors/assert-no-reserved-connector-names.mjs.map +1 -1
- package/esm/connectors/assert-unique-connector-names.d.mts +1 -1
- package/esm/connectors/assert-unique-connector-names.d.mts.map +1 -1
- package/esm/connectors/assert-unique-connector-names.mjs +1 -1
- package/esm/connectors/assert-unique-connector-names.mjs.map +1 -1
- package/esm/connectors/base-connector.d.mts +1 -1
- package/esm/connectors/base-connector.d.mts.map +1 -1
- package/esm/connectors/base-connector.mjs +1 -1
- package/esm/connectors/base-connector.mjs.map +1 -1
- package/esm/connectors/cache-connector.d.mts +1 -1
- package/esm/connectors/cache-connector.d.mts.map +1 -1
- package/esm/connectors/cache-connector.mjs +1 -1
- package/esm/connectors/cache-connector.mjs.map +1 -1
- package/esm/connectors/connectors-manager.d.mts +1 -1
- package/esm/connectors/connectors-manager.d.mts.map +1 -1
- package/esm/connectors/connectors-manager.mjs +1 -1
- package/esm/connectors/connectors-manager.mjs.map +1 -1
- package/esm/connectors/database-connector.d.mts +1 -1
- package/esm/connectors/database-connector.d.mts.map +1 -1
- package/esm/connectors/database-connector.mjs +1 -1
- package/esm/connectors/database-connector.mjs.map +1 -1
- package/esm/connectors/describe-server-address.mjs +108 -8
- package/esm/connectors/describe-server-address.mjs.map +1 -1
- package/esm/connectors/herald-connector.d.mts +1 -1
- package/esm/connectors/herald-connector.d.mts.map +1 -1
- package/esm/connectors/herald-connector.mjs +1 -1
- package/esm/connectors/herald-connector.mjs.map +1 -1
- package/esm/connectors/http-connector.d.mts +19 -1
- package/esm/connectors/http-connector.d.mts.map +1 -1
- package/esm/connectors/http-connector.mjs +42 -5
- package/esm/connectors/http-connector.mjs.map +1 -1
- package/esm/connectors/logger-connector.d.mts +1 -1
- package/esm/connectors/logger-connector.d.mts.map +1 -1
- package/esm/connectors/logger-connector.mjs +1 -1
- package/esm/connectors/logger-connector.mjs.map +1 -1
- package/esm/connectors/mail-connector.d.mts +1 -1
- package/esm/connectors/mail-connector.d.mts.map +1 -1
- package/esm/connectors/mail-connector.mjs +1 -1
- package/esm/connectors/mail-connector.mjs.map +1 -1
- package/esm/connectors/notifications-connector.d.mts +1 -1
- package/esm/connectors/notifications-connector.d.mts.map +1 -1
- package/esm/connectors/notifications-connector.mjs +1 -1
- package/esm/connectors/notifications-connector.mjs.map +1 -1
- package/esm/connectors/register-configured-connectors.d.mts +1 -1
- package/esm/connectors/register-configured-connectors.d.mts.map +1 -1
- package/esm/connectors/register-configured-connectors.mjs +1 -1
- package/esm/connectors/register-configured-connectors.mjs.map +1 -1
- package/esm/connectors/socket-connector.d.mts +1 -1
- package/esm/connectors/socket-connector.d.mts.map +1 -1
- package/esm/connectors/socket-connector.mjs +1 -1
- package/esm/connectors/socket-connector.mjs.map +1 -1
- package/esm/connectors/storage.connector.d.mts +1 -1
- package/esm/connectors/storage.connector.d.mts.map +1 -1
- package/esm/connectors/storage.connector.mjs +1 -1
- package/esm/connectors/storage.connector.mjs.map +1 -1
- package/esm/connectors/types.d.mts +1 -1
- package/esm/connectors/types.d.mts.map +1 -1
- package/esm/connectors/types.mjs +1 -1
- package/esm/connectors/types.mjs.map +1 -1
- package/esm/container/index.d.mts +1 -1
- package/esm/container/index.d.mts.map +1 -1
- package/esm/container/index.mjs +1 -1
- package/esm/container/index.mjs.map +1 -1
- package/esm/database/create-database-action.mjs +1 -1
- package/esm/database/create-database-action.mjs.map +1 -1
- package/esm/database/drop-tables-action.mjs +1 -1
- package/esm/database/drop-tables-action.mjs.map +1 -1
- package/esm/database/migrate-action.mjs +1 -1
- package/esm/database/migrate-action.mjs.map +1 -1
- package/esm/database/models/database-log/database-log.d.mts +1 -1
- package/esm/database/models/database-log/database-log.d.mts.map +1 -1
- package/esm/database/models/database-log/database-log.mjs +1 -1
- package/esm/database/models/database-log/database-log.mjs.map +1 -1
- package/esm/database/pending-exit-code.mjs +1 -1
- package/esm/database/pending-exit-code.mjs.map +1 -1
- package/esm/database/resolve-pending-migrations.mjs +1 -1
- package/esm/database/resolve-pending-migrations.mjs.map +1 -1
- package/esm/database/seed-command-action.mjs +1 -1
- package/esm/database/seed-command-action.mjs.map +1 -1
- package/esm/database/seeds/seed-records-table-migration.mjs +2 -2
- package/esm/database/seeds/seed-records-table-migration.mjs.map +1 -1
- package/esm/database/seeds/seeder.d.mts +1 -1
- package/esm/database/seeds/seeder.d.mts.map +1 -1
- package/esm/database/seeds/seeder.errors.d.mts +1 -1
- package/esm/database/seeds/seeder.errors.d.mts.map +1 -1
- package/esm/database/seeds/seeder.errors.mjs +1 -1
- package/esm/database/seeds/seeder.errors.mjs.map +1 -1
- package/esm/database/seeds/seeder.mjs +1 -1
- package/esm/database/seeds/seeder.mjs.map +1 -1
- package/esm/database/seeds/seeders.manager.mjs +1 -1
- package/esm/database/seeds/seeders.manager.mjs.map +1 -1
- package/esm/database/seeds/seeds-table-migration.mjs +2 -2
- package/esm/database/seeds/seeds-table-migration.mjs.map +1 -1
- package/esm/database/seeds/types.d.mts +1 -1
- package/esm/database/seeds/types.d.mts.map +1 -1
- package/esm/database/seeds/utils.mjs +1 -1
- package/esm/database/seeds/utils.mjs.map +1 -1
- package/esm/database/utils.d.mts +1 -1
- package/esm/database/utils.d.mts.map +1 -1
- package/esm/database/utils.mjs +1 -1
- package/esm/database/utils.mjs.map +1 -1
- package/esm/dev-server/check-for-updates.mjs +1 -1
- package/esm/dev-server/check-for-updates.mjs.map +1 -1
- package/esm/dev-server/create-worker.mjs +1 -1
- package/esm/dev-server/create-worker.mjs.map +1 -1
- package/esm/dev-server/dependency-graph.d.mts +1 -1
- 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/dev-logger.mjs +2 -5
- package/esm/dev-server/dev-logger.mjs.map +1 -1
- package/esm/dev-server/development-server.mjs +4 -8
- package/esm/dev-server/development-server.mjs.map +1 -1
- package/esm/dev-server/events.mjs +1 -1
- package/esm/dev-server/events.mjs.map +1 -1
- package/esm/dev-server/file-event-handler.mjs +1 -1
- package/esm/dev-server/file-event-handler.mjs.map +1 -1
- package/esm/dev-server/file-manager.d.mts +1 -1
- package/esm/dev-server/file-manager.d.mts.map +1 -1
- package/esm/dev-server/file-manager.mjs +1 -1
- package/esm/dev-server/file-manager.mjs.map +1 -1
- package/esm/dev-server/file-operations.d.mts +1 -1
- package/esm/dev-server/file-operations.d.mts.map +1 -1
- package/esm/dev-server/file-operations.mjs +1 -1
- package/esm/dev-server/file-operations.mjs.map +1 -1
- package/esm/dev-server/files-orchestrator.mjs +1 -1
- package/esm/dev-server/files-orchestrator.mjs.map +1 -1
- package/esm/dev-server/files-watcher.mjs +1 -1
- package/esm/dev-server/files-watcher.mjs.map +1 -1
- package/esm/dev-server/flags.mjs +1 -1
- package/esm/dev-server/flags.mjs.map +1 -1
- package/esm/dev-server/health-checker/checkers/base-health-checker.mjs +1 -1
- package/esm/dev-server/health-checker/checkers/base-health-checker.mjs.map +1 -1
- package/esm/dev-server/health-checker/checkers/eslint-health-checker.mjs +1 -1
- 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 +1 -1
- package/esm/dev-server/health-checker/checkers/typescript-health-checker.mjs.map +1 -1
- package/esm/dev-server/health-checker/file-health-checker.contract.d.mts +1 -1
- 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 +1 -1
- package/esm/dev-server/health-checker/file-health-result.d.mts.map +1 -1
- package/esm/dev-server/health-checker/file-health-result.mjs +1 -1
- package/esm/dev-server/health-checker/file-health-result.mjs.map +1 -1
- package/esm/dev-server/health-checker/files-healthcare.manager.mjs +1 -1
- package/esm/dev-server/health-checker/files-healthcare.manager.mjs.map +1 -1
- package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs +1 -1
- package/esm/dev-server/health-checker/workers/eslint-health.worker.mjs.map +1 -1
- package/esm/dev-server/health-checker/workers/ts-health.worker.mjs +1 -1
- package/esm/dev-server/health-checker/workers/ts-health.worker.mjs.map +1 -1
- package/esm/dev-server/layer-executor.mjs +11 -4
- package/esm/dev-server/layer-executor.mjs.map +1 -1
- package/esm/dev-server/loader/build-transpile-init.mjs +1 -1
- package/esm/dev-server/loader/build-transpile-init.mjs.map +1 -1
- package/esm/dev-server/loader/hook-thread.d.mts +1 -1
- package/esm/dev-server/loader/hook-thread.d.mts.map +1 -1
- package/esm/dev-server/loader/hook-thread.mjs +1 -1
- package/esm/dev-server/loader/hook-thread.mjs.map +1 -1
- package/esm/dev-server/loader/load-hook.d.mts +1 -1
- package/esm/dev-server/loader/load-hook.d.mts.map +1 -1
- package/esm/dev-server/loader/load-hook.mjs +1 -1
- 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/own-resolver.mjs.map +1 -1
- package/esm/dev-server/loader/register-loader.mjs +1 -1
- package/esm/dev-server/loader/register-loader.mjs.map +1 -1
- package/esm/dev-server/loader/resolve-capture.mjs +1 -1
- package/esm/dev-server/loader/resolve-capture.mjs.map +1 -1
- package/esm/dev-server/loader/resolve-hook.d.mts +1 -1
- package/esm/dev-server/loader/resolve-hook.d.mts.map +1 -1
- package/esm/dev-server/loader/resolve-hook.mjs +1 -1
- package/esm/dev-server/loader/resolve-hook.mjs.map +1 -1
- package/esm/dev-server/loader/source-slug.mjs +1 -1
- package/esm/dev-server/loader/source-slug.mjs.map +1 -1
- package/esm/dev-server/loader/transpile-cache.mjs +13 -4
- package/esm/dev-server/loader/transpile-cache.mjs.map +1 -1
- package/esm/dev-server/loader/version-registry.mjs +1 -1
- package/esm/dev-server/loader/version-registry.mjs.map +1 -1
- package/esm/dev-server/manifest-manager.d.mts +1 -1
- package/esm/dev-server/manifest-manager.d.mts.map +1 -1
- package/esm/dev-server/manifest-manager.mjs +1 -1
- package/esm/dev-server/manifest-manager.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/package-json-manager.mjs.map +1 -1
- package/esm/dev-server/parse-imports.mjs +1 -1
- package/esm/dev-server/parse-imports.mjs.map +1 -1
- package/esm/dev-server/read-config-ast.mjs +1 -1
- package/esm/dev-server/read-config-ast.mjs.map +1 -1
- package/esm/dev-server/ready-block.mjs +62 -0
- package/esm/dev-server/ready-block.mjs.map +1 -0
- package/esm/dev-server/register-dev-shortcuts.mjs +1 -1
- package/esm/dev-server/register-dev-shortcuts.mjs.map +1 -1
- package/esm/dev-server/restart-dev-server.mjs +1 -1
- package/esm/dev-server/restart-dev-server.mjs.map +1 -1
- package/esm/dev-server/run-typings-generation.mjs +1 -1
- package/esm/dev-server/run-typings-generation.mjs.map +1 -1
- package/esm/dev-server/shortcuts.mjs +1 -1
- package/esm/dev-server/shortcuts.mjs.map +1 -1
- package/esm/dev-server/special-files-collector.d.mts +1 -1
- package/esm/dev-server/special-files-collector.d.mts.map +1 -1
- package/esm/dev-server/special-files-collector.mjs +1 -1
- package/esm/dev-server/special-files-collector.mjs.map +1 -1
- package/esm/dev-server/start-development-server.mjs +1 -1
- package/esm/dev-server/start-development-server.mjs.map +1 -1
- package/esm/dev-server/supervisor.mjs +10 -7
- package/esm/dev-server/supervisor.mjs.map +1 -1
- package/esm/dev-server/tsconfig-manager.mjs +1 -1
- package/esm/dev-server/tsconfig-manager.mjs.map +1 -1
- package/esm/dev-server/type-generator.mjs +1 -1
- package/esm/dev-server/type-generator.mjs.map +1 -1
- package/esm/dev-server/types.d.mts +1 -1
- package/esm/dev-server/types.d.mts.map +1 -1
- package/esm/dev-server/update-check-cache.mjs +1 -1
- package/esm/dev-server/update-check-cache.mjs.map +1 -1
- package/esm/dev-server/utils.mjs +1 -1
- package/esm/dev-server/utils.mjs.map +1 -1
- package/esm/encryption/encrypt.d.mts +1 -1
- package/esm/encryption/encrypt.d.mts.map +1 -1
- package/esm/encryption/encrypt.mjs +1 -1
- package/esm/encryption/encrypt.mjs.map +1 -1
- package/esm/encryption/hash.d.mts +1 -1
- package/esm/encryption/hash.d.mts.map +1 -1
- package/esm/encryption/hash.mjs +1 -1
- package/esm/encryption/hash.mjs.map +1 -1
- package/esm/encryption/password.d.mts +1 -1
- package/esm/encryption/password.d.mts.map +1 -1
- package/esm/encryption/password.mjs +1 -1
- package/esm/encryption/password.mjs.map +1 -1
- package/esm/encryption/types.d.mts +1 -1
- package/esm/encryption/types.d.mts.map +1 -1
- package/esm/generations/add-command.action.mjs +12 -578
- package/esm/generations/add-command.action.mjs.map +1 -1
- package/esm/generations/features/access.feature.mjs +77 -0
- package/esm/generations/features/access.feature.mjs.map +1 -0
- package/esm/generations/features/ai-anthropic.feature.mjs +12 -0
- package/esm/generations/features/ai-anthropic.feature.mjs.map +1 -0
- package/esm/generations/features/ai-bedrock.feature.mjs +12 -0
- package/esm/generations/features/ai-bedrock.feature.mjs.map +1 -0
- package/esm/generations/features/ai-google.feature.mjs +12 -0
- package/esm/generations/features/ai-google.feature.mjs.map +1 -0
- package/esm/generations/features/ai-ollama.feature.mjs +12 -0
- package/esm/generations/features/ai-ollama.feature.mjs.map +1 -0
- package/esm/generations/features/ai-openai.feature.mjs +12 -0
- package/esm/generations/features/ai-openai.feature.mjs.map +1 -0
- package/esm/generations/features/ai-panoptic.feature.mjs +14 -0
- package/esm/generations/features/ai-panoptic.feature.mjs.map +1 -0
- package/esm/generations/features/ai-tools.feature.mjs +14 -0
- package/esm/generations/features/ai-tools.feature.mjs.map +1 -0
- package/esm/generations/features/ai-workspace.feature.mjs +14 -0
- package/esm/generations/features/ai-workspace.feature.mjs.map +1 -0
- package/esm/generations/features/ai.feature.mjs +16 -0
- package/esm/generations/features/ai.feature.mjs.map +1 -0
- package/esm/generations/features/herald.feature.mjs +20 -0
- package/esm/generations/features/herald.feature.mjs.map +1 -0
- package/esm/generations/features/image.feature.mjs +9 -0
- package/esm/generations/features/image.feature.mjs.map +1 -0
- package/esm/generations/features/index.mjs +72 -0
- package/esm/generations/features/index.mjs.map +1 -0
- package/esm/generations/features/mail.feature.mjs +10 -0
- package/esm/generations/features/mail.feature.mjs.map +1 -0
- package/esm/generations/features/mongodb.feature.mjs +9 -0
- package/esm/generations/features/mongodb.feature.mjs.map +1 -0
- package/esm/generations/features/mysql.feature.mjs +9 -0
- package/esm/generations/features/mysql.feature.mjs.map +1 -0
- package/esm/generations/features/notifications.feature.mjs +44 -0
- package/esm/generations/features/notifications.feature.mjs.map +1 -0
- package/esm/generations/features/postgres.feature.mjs +9 -0
- package/esm/generations/features/postgres.feature.mjs.map +1 -0
- package/esm/generations/features/react-email.feature.mjs +70 -0
- package/esm/generations/features/react-email.feature.mjs.map +1 -0
- package/esm/generations/features/react.feature.mjs +16 -0
- package/esm/generations/features/react.feature.mjs.map +1 -0
- package/esm/generations/features/redis.feature.mjs +9 -0
- package/esm/generations/features/redis.feature.mjs.map +1 -0
- package/esm/generations/features/s3.feature.mjs +13 -0
- package/esm/generations/features/s3.feature.mjs.map +1 -0
- package/esm/generations/features/scheduler.feature.mjs +11 -0
- package/esm/generations/features/scheduler.feature.mjs.map +1 -0
- package/esm/generations/features/ses.feature.mjs +9 -0
- package/esm/generations/features/ses.feature.mjs.map +1 -0
- package/esm/generations/features/shadcn.feature.mjs +397 -0
- package/esm/generations/features/shadcn.feature.mjs.map +1 -0
- package/esm/generations/features/shared/link-ai-package-import.mjs +37 -0
- package/esm/generations/features/shared/link-ai-package-import.mjs.map +1 -0
- package/esm/generations/features/shared/migration-timestamp.mjs +17 -0
- package/esm/generations/features/shared/migration-timestamp.mjs.map +1 -0
- package/esm/generations/features/socket.feature.mjs +15 -0
- package/esm/generations/features/socket.feature.mjs.map +1 -0
- package/esm/generations/features/tailwind.feature.mjs +174 -0
- package/esm/generations/features/tailwind.feature.mjs.map +1 -0
- package/esm/generations/features/test.feature.mjs +96 -0
- package/esm/generations/features/test.feature.mjs.map +1 -0
- package/esm/generations/features/types.mjs +14 -0
- package/esm/generations/features/types.mjs.map +1 -0
- package/esm/generations/features/web.feature.mjs +187 -0
- package/esm/generations/features/web.feature.mjs.map +1 -0
- package/esm/generations/stubs.mjs +238 -10
- package/esm/generations/stubs.mjs.map +1 -1
- package/esm/http/boot-port-preflight.d.mts +46 -0
- package/esm/http/boot-port-preflight.d.mts.map +1 -0
- package/esm/http/boot-port-preflight.mjs +87 -0
- package/esm/http/boot-port-preflight.mjs.map +1 -0
- package/esm/http/build-cors-options.mjs +1 -1
- package/esm/http/build-cors-options.mjs.map +1 -1
- package/esm/http/config.d.mts +1 -1
- package/esm/http/config.d.mts.map +1 -1
- package/esm/http/config.mjs +1 -1
- package/esm/http/config.mjs.map +1 -1
- package/esm/http/context/request-context.d.mts +1 -1
- package/esm/http/context/request-context.d.mts.map +1 -1
- package/esm/http/context/request-context.mjs +1 -1
- package/esm/http/context/request-context.mjs.map +1 -1
- package/esm/http/context/request-memo.d.mts +1 -1
- package/esm/http/context/request-memo.d.mts.map +1 -1
- package/esm/http/context/request-memo.mjs +1 -1
- package/esm/http/context/request-memo.mjs.map +1 -1
- package/esm/http/createHttpApplication.d.mts +1 -1
- package/esm/http/createHttpApplication.d.mts.map +1 -1
- package/esm/http/createHttpApplication.mjs +1 -1
- package/esm/http/createHttpApplication.mjs.map +1 -1
- package/esm/http/database/RequestLog.d.mts +1 -1
- package/esm/http/database/RequestLog.d.mts.map +1 -1
- package/esm/http/database/RequestLog.mjs +1 -1
- package/esm/http/database/RequestLog.mjs.map +1 -1
- package/esm/http/error-codes.d.mts +1 -1
- package/esm/http/error-codes.d.mts.map +1 -1
- package/esm/http/error-codes.mjs +1 -1
- package/esm/http/error-codes.mjs.map +1 -1
- package/esm/http/errors/errors.d.mts +1 -1
- package/esm/http/errors/errors.d.mts.map +1 -1
- package/esm/http/errors/errors.mjs +1 -1
- package/esm/http/errors/errors.mjs.map +1 -1
- package/esm/http/events.d.mts +1 -1
- package/esm/http/events.d.mts.map +1 -1
- package/esm/http/events.mjs +1 -1
- package/esm/http/events.mjs.map +1 -1
- package/esm/http/health.d.mts +1 -1
- package/esm/http/health.d.mts.map +1 -1
- package/esm/http/health.mjs +1 -1
- package/esm/http/health.mjs.map +1 -1
- package/esm/http/index.d.mts +2 -0
- package/esm/http/index.mjs +2 -0
- package/esm/http/middleware/cache-response-middleware.d.mts +1 -1
- package/esm/http/middleware/cache-response-middleware.d.mts.map +1 -1
- package/esm/http/middleware/cache-response-middleware.mjs +1 -1
- package/esm/http/middleware/cache-response-middleware.mjs.map +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.d.mts +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.d.mts.map +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.mjs +1 -1
- package/esm/http/middleware/concurrency-limit.middleware.mjs.map +1 -1
- package/esm/http/middleware/idempotency.middleware.d.mts +1 -1
- package/esm/http/middleware/idempotency.middleware.d.mts.map +1 -1
- package/esm/http/middleware/idempotency.middleware.mjs +1 -1
- package/esm/http/middleware/idempotency.middleware.mjs.map +1 -1
- package/esm/http/middleware/inject-request-context.d.mts +1 -1
- package/esm/http/middleware/inject-request-context.d.mts.map +1 -1
- package/esm/http/middleware/inject-request-context.mjs +1 -1
- package/esm/http/middleware/inject-request-context.mjs.map +1 -1
- package/esm/http/middleware/ip-filter.middleware.d.mts +2 -2
- package/esm/http/middleware/ip-filter.middleware.d.mts.map +1 -1
- package/esm/http/middleware/ip-filter.middleware.mjs +2 -2
- package/esm/http/middleware/ip-filter.middleware.mjs.map +1 -1
- package/esm/http/middleware/maintenance.middleware.d.mts +1 -1
- package/esm/http/middleware/maintenance.middleware.d.mts.map +1 -1
- package/esm/http/middleware/maintenance.middleware.mjs +1 -1
- package/esm/http/middleware/maintenance.middleware.mjs.map +1 -1
- package/esm/http/middleware/max-body-size.middleware.d.mts +1 -1
- package/esm/http/middleware/max-body-size.middleware.d.mts.map +1 -1
- package/esm/http/middleware/max-body-size.middleware.mjs +1 -1
- package/esm/http/middleware/max-body-size.middleware.mjs.map +1 -1
- package/esm/http/middleware/middleware-list.d.mts +1 -1
- package/esm/http/middleware/middleware-list.d.mts.map +1 -1
- package/esm/http/middleware/middleware-list.mjs +1 -1
- package/esm/http/middleware/middleware-list.mjs.map +1 -1
- package/esm/http/middleware/rate-limit.middleware.d.mts +1 -1
- package/esm/http/middleware/rate-limit.middleware.d.mts.map +1 -1
- package/esm/http/middleware/rate-limit.middleware.mjs +1 -1
- package/esm/http/middleware/rate-limit.middleware.mjs.map +1 -1
- package/esm/http/middleware/utils/cidr-match.d.mts +1 -1
- package/esm/http/middleware/utils/cidr-match.d.mts.map +1 -1
- package/esm/http/middleware/utils/cidr-match.mjs +1 -1
- package/esm/http/middleware/utils/cidr-match.mjs.map +1 -1
- package/esm/http/middleware/utils/idempotency-key.d.mts +1 -1
- package/esm/http/middleware/utils/idempotency-key.d.mts.map +1 -1
- package/esm/http/middleware/utils/idempotency-key.mjs +1 -1
- package/esm/http/middleware/utils/idempotency-key.mjs.map +1 -1
- package/esm/http/middleware/utils/parse-size.d.mts +1 -1
- package/esm/http/middleware/utils/parse-size.d.mts.map +1 -1
- package/esm/http/middleware/utils/parse-size.mjs +1 -1
- package/esm/http/middleware/utils/parse-size.mjs.map +1 -1
- package/esm/http/plugins.d.mts +1 -1
- package/esm/http/plugins.d.mts.map +1 -1
- package/esm/http/plugins.mjs +1 -1
- package/esm/http/plugins.mjs.map +1 -1
- package/esm/http/port-preflight.d.mts +9 -1
- package/esm/http/port-preflight.d.mts.map +1 -1
- package/esm/http/port-preflight.mjs +9 -2
- package/esm/http/port-preflight.mjs.map +1 -1
- package/esm/http/ready-report.d.mts +56 -0
- package/esm/http/ready-report.d.mts.map +1 -0
- package/esm/http/ready-report.mjs +24 -0
- package/esm/http/ready-report.mjs.map +1 -0
- package/esm/http/request-controller.d.mts +1 -1
- package/esm/http/request-controller.d.mts.map +1 -1
- package/esm/http/request-controller.mjs +1 -1
- package/esm/http/request-controller.mjs.map +1 -1
- package/esm/http/request.d.mts +15 -3
- package/esm/http/request.d.mts.map +1 -1
- package/esm/http/request.mjs +17 -3
- package/esm/http/request.mjs.map +1 -1
- package/esm/http/response.d.mts +4 -4
- package/esm/http/response.d.mts.map +1 -1
- package/esm/http/response.mjs +1 -1
- package/esm/http/response.mjs.map +1 -1
- package/esm/http/server.d.mts +1 -1
- package/esm/http/server.d.mts.map +1 -1
- package/esm/http/server.mjs +27 -3
- package/esm/http/server.mjs.map +1 -1
- package/esm/http/types.d.mts +2 -4
- package/esm/http/types.d.mts.map +1 -1
- package/esm/http/uploaded-file.d.mts +1 -1
- package/esm/http/uploaded-file.d.mts.map +1 -1
- package/esm/http/uploaded-file.mjs +1 -1
- package/esm/http/uploaded-file.mjs.map +1 -1
- package/esm/http/uploads-config.d.mts +1 -1
- package/esm/http/uploads-config.d.mts.map +1 -1
- package/esm/http/uploads-config.mjs +1 -1
- package/esm/http/uploads-config.mjs.map +1 -1
- package/esm/http/uploads-types.d.mts +1 -1
- package/esm/http/uploads-types.d.mts.map +1 -1
- package/esm/image/image.d.mts +1 -1
- package/esm/image/image.d.mts.map +1 -1
- package/esm/image/image.mjs +1 -1
- package/esm/image/image.mjs.map +1 -1
- package/esm/index.d.mts +7 -1
- package/esm/index.mjs +7 -1
- package/esm/logger/fatal-visibility.d.mts +25 -0
- package/esm/logger/fatal-visibility.d.mts.map +1 -0
- package/esm/logger/fatal-visibility.mjs +31 -0
- package/esm/logger/fatal-visibility.mjs.map +1 -0
- package/esm/logger/index.d.mts +1 -0
- package/esm/logger/index.mjs +1 -0
- package/esm/logger/logger.d.mts +1 -1
- package/esm/logger/logger.d.mts.map +1 -1
- package/esm/logger/logger.mjs +1 -1
- package/esm/logger/logger.mjs.map +1 -1
- package/esm/logger/types.d.mts +1 -1
- package/esm/logger/types.d.mts.map +1 -1
- package/esm/mail/config.d.mts +1 -1
- package/esm/mail/config.d.mts.map +1 -1
- package/esm/mail/config.mjs +1 -1
- package/esm/mail/config.mjs.map +1 -1
- package/esm/mail/events.d.mts +1 -1
- package/esm/mail/events.d.mts.map +1 -1
- package/esm/mail/events.mjs +1 -1
- package/esm/mail/events.mjs.map +1 -1
- package/esm/mail/mail.d.mts +1 -1
- package/esm/mail/mail.d.mts.map +1 -1
- package/esm/mail/mail.mjs +1 -1
- package/esm/mail/mail.mjs.map +1 -1
- package/esm/mail/mailer-pool.d.mts +1 -1
- package/esm/mail/mailer-pool.d.mts.map +1 -1
- package/esm/mail/mailer-pool.mjs +3 -1
- package/esm/mail/mailer-pool.mjs.map +1 -1
- package/esm/mail/react-mail.d.mts +1 -1
- package/esm/mail/react-mail.d.mts.map +1 -1
- package/esm/mail/react-mail.mjs +1 -1
- package/esm/mail/react-mail.mjs.map +1 -1
- package/esm/mail/send-mail.d.mts +1 -1
- package/esm/mail/send-mail.d.mts.map +1 -1
- package/esm/mail/send-mail.mjs +1 -1
- package/esm/mail/send-mail.mjs.map +1 -1
- package/esm/mail/test-mailbox.d.mts +1 -1
- package/esm/mail/test-mailbox.d.mts.map +1 -1
- package/esm/mail/test-mailbox.mjs +1 -1
- package/esm/mail/test-mailbox.mjs.map +1 -1
- package/esm/mail/types.d.mts +1 -1
- package/esm/mail/types.d.mts.map +1 -1
- package/esm/mail/types.mjs +1 -1
- package/esm/mail/types.mjs.map +1 -1
- package/esm/manifest/manifest-manager.mjs +1 -1
- package/esm/manifest/manifest-manager.mjs.map +1 -1
- package/esm/production/assert-dist-ready-to-start.mjs +24 -0
- package/esm/production/assert-dist-ready-to-start.mjs.map +1 -0
- package/esm/production/assert-generated-imports.mjs +1 -1
- package/esm/production/assert-generated-imports.mjs.map +1 -1
- package/esm/production/build-app-production.mjs +1 -1
- package/esm/production/build-app-production.mjs.map +1 -1
- package/esm/production/build-contributions.mjs +1 -1
- package/esm/production/build-contributions.mjs.map +1 -1
- package/esm/production/dist-build-manifest.mjs +47 -0
- package/esm/production/dist-build-manifest.mjs.map +1 -0
- package/esm/production/esbuild-plugins.mjs +1 -1
- package/esm/production/esbuild-plugins.mjs.map +1 -1
- package/esm/production/production-builder.mjs +69 -14
- package/esm/production/production-builder.mjs.map +1 -1
- package/esm/production/production-supervisor.mjs +22 -10
- package/esm/production/production-supervisor.mjs.map +1 -1
- package/esm/production/promote-dist.mjs +115 -0
- package/esm/production/promote-dist.mjs.map +1 -0
- package/esm/production/resolve-build-config.d.mts +1 -1
- package/esm/production/resolve-build-config.d.mts.map +1 -1
- package/esm/production/resolve-build-config.mjs +1 -1
- package/esm/production/resolve-build-config.mjs.map +1 -1
- package/esm/react/index.d.mts +1 -1
- package/esm/react/index.d.mts.map +1 -1
- package/esm/react/index.mjs +1 -1
- package/esm/react/index.mjs.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.d.mts +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.d.mts.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.mjs +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.mjs.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.mts.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.mjs +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.mjs.map +1 -1
- package/esm/repositories/adapters/cascade/filter-applicator.mjs +1 -1
- package/esm/repositories/adapters/cascade/filter-applicator.mjs.map +1 -1
- package/esm/repositories/contracts/query-builder.contract.d.mts +1 -1
- package/esm/repositories/contracts/query-builder.contract.d.mts.map +1 -1
- package/esm/repositories/contracts/repository-adapter.contract.d.mts +1 -1
- package/esm/repositories/contracts/repository-adapter.contract.d.mts.map +1 -1
- package/esm/repositories/contracts/types.d.mts +1 -1
- package/esm/repositories/contracts/types.d.mts.map +1 -1
- package/esm/repositories/repository.manager.d.mts +1 -1
- package/esm/repositories/repository.manager.d.mts.map +1 -1
- package/esm/repositories/repository.manager.mjs +1 -1
- package/esm/repositories/repository.manager.mjs.map +1 -1
- package/esm/resource/define-resource.d.mts +1 -1
- package/esm/resource/define-resource.d.mts.map +1 -1
- package/esm/resource/define-resource.mjs +1 -1
- package/esm/resource/define-resource.mjs.map +1 -1
- package/esm/resource/register-resource.d.mts +1 -1
- package/esm/resource/register-resource.d.mts.map +1 -1
- package/esm/resource/register-resource.mjs +1 -1
- package/esm/resource/register-resource.mjs.map +1 -1
- package/esm/resource/resource-field-builder.d.mts +1 -1
- package/esm/resource/resource-field-builder.d.mts.map +1 -1
- package/esm/resource/resource-field-builder.mjs +1 -1
- package/esm/resource/resource-field-builder.mjs.map +1 -1
- package/esm/resource/resource.d.mts +1 -1
- package/esm/resource/resource.d.mts.map +1 -1
- package/esm/resource/resource.mjs +1 -1
- package/esm/resource/resource.mjs.map +1 -1
- package/esm/resource/types.d.mts +1 -1
- package/esm/resource/types.d.mts.map +1 -1
- package/esm/restful/restful.d.mts +1 -1
- package/esm/restful/restful.d.mts.map +1 -1
- package/esm/restful/restful.mjs +1 -1
- package/esm/restful/restful.mjs.map +1 -1
- package/esm/router/describe-route-for-log.mjs +1 -1
- package/esm/router/describe-route-for-log.mjs.map +1 -1
- package/esm/router/index.d.mts +3 -0
- package/esm/router/index.mjs +3 -0
- package/esm/router/log-request-lifecycle.mjs +1 -1
- package/esm/router/log-request-lifecycle.mjs.map +1 -1
- package/esm/router/normalize-request-path.d.mts +14 -0
- package/esm/router/normalize-request-path.d.mts.map +1 -0
- package/esm/router/normalize-request-path.mjs +18 -0
- package/esm/router/normalize-request-path.mjs.map +1 -0
- package/esm/router/normalize-route-path.d.mts +28 -0
- package/esm/router/normalize-route-path.d.mts.map +1 -0
- package/esm/router/normalize-route-path.mjs +33 -0
- package/esm/router/normalize-route-path.mjs.map +1 -0
- package/esm/router/positional-handler-diagnostics.d.mts +1 -1
- package/esm/router/positional-handler-diagnostics.d.mts.map +1 -1
- package/esm/router/positional-handler-diagnostics.mjs +1 -1
- package/esm/router/positional-handler-diagnostics.mjs.map +1 -1
- package/esm/router/route-builder.d.mts +1 -1
- package/esm/router/route-builder.d.mts.map +1 -1
- package/esm/router/route-builder.mjs +1 -1
- package/esm/router/route-builder.mjs.map +1 -1
- package/esm/router/route-name-method-suffix.d.mts +33 -0
- package/esm/router/route-name-method-suffix.d.mts.map +1 -0
- package/esm/router/route-name-method-suffix.mjs +39 -0
- package/esm/router/route-name-method-suffix.mjs.map +1 -0
- package/esm/router/route-registry.d.mts +1 -1
- package/esm/router/route-registry.d.mts.map +1 -1
- package/esm/router/route-registry.mjs +4 -3
- package/esm/router/route-registry.mjs.map +1 -1
- package/esm/router/router.d.mts +15 -1
- package/esm/router/router.d.mts.map +1 -1
- package/esm/router/router.mjs +51 -12
- package/esm/router/router.mjs.map +1 -1
- package/esm/router/types.d.mts +1 -1
- package/esm/router/types.d.mts.map +1 -1
- package/esm/socket/types.d.mts +1 -1
- package/esm/socket/types.d.mts.map +1 -1
- package/esm/socket/utils.d.mts +1 -1
- package/esm/socket/utils.d.mts.map +1 -1
- package/esm/socket/utils.mjs +1 -1
- package/esm/socket/utils.mjs.map +1 -1
- package/esm/storage/config.d.mts +1 -1
- package/esm/storage/config.d.mts.map +1 -1
- package/esm/storage/config.mjs +1 -1
- package/esm/storage/config.mjs.map +1 -1
- package/esm/storage/context/storage-driver-context.d.mts +1 -1
- package/esm/storage/context/storage-driver-context.d.mts.map +1 -1
- package/esm/storage/context/storage-driver-context.mjs +1 -1
- package/esm/storage/context/storage-driver-context.mjs.map +1 -1
- package/esm/storage/drivers/cloud-driver.d.mts +1 -1
- package/esm/storage/drivers/cloud-driver.d.mts.map +1 -1
- package/esm/storage/drivers/cloud-driver.mjs +1 -1
- package/esm/storage/drivers/cloud-driver.mjs.map +1 -1
- package/esm/storage/drivers/do-spaces-driver.d.mts +1 -1
- package/esm/storage/drivers/do-spaces-driver.d.mts.map +1 -1
- package/esm/storage/drivers/do-spaces-driver.mjs +1 -1
- package/esm/storage/drivers/do-spaces-driver.mjs.map +1 -1
- package/esm/storage/drivers/local-driver.d.mts +1 -1
- package/esm/storage/drivers/local-driver.d.mts.map +1 -1
- package/esm/storage/drivers/local-driver.mjs +1 -1
- package/esm/storage/drivers/local-driver.mjs.map +1 -1
- package/esm/storage/drivers/r2-driver.d.mts +1 -1
- package/esm/storage/drivers/r2-driver.d.mts.map +1 -1
- package/esm/storage/drivers/r2-driver.mjs +1 -1
- package/esm/storage/drivers/r2-driver.mjs.map +1 -1
- package/esm/storage/drivers/s3-driver.d.mts +1 -1
- package/esm/storage/drivers/s3-driver.d.mts.map +1 -1
- package/esm/storage/drivers/s3-driver.mjs +1 -1
- package/esm/storage/drivers/s3-driver.mjs.map +1 -1
- package/esm/storage/scoped-storage.d.mts +1 -1
- package/esm/storage/scoped-storage.d.mts.map +1 -1
- package/esm/storage/scoped-storage.mjs +1 -1
- package/esm/storage/scoped-storage.mjs.map +1 -1
- package/esm/storage/storage-file.d.mts +1 -1
- package/esm/storage/storage-file.d.mts.map +1 -1
- package/esm/storage/storage-file.mjs +1 -1
- package/esm/storage/storage-file.mjs.map +1 -1
- package/esm/storage/storage.d.mts +1 -1
- package/esm/storage/storage.d.mts.map +1 -1
- package/esm/storage/storage.mjs +1 -1
- package/esm/storage/storage.mjs.map +1 -1
- package/esm/storage/types.d.mts +15 -1
- package/esm/storage/types.d.mts.map +1 -1
- package/esm/storage/utils/contain-path.d.mts +1 -1
- package/esm/storage/utils/contain-path.d.mts.map +1 -1
- package/esm/storage/utils/contain-path.mjs +1 -1
- package/esm/storage/utils/contain-path.mjs.map +1 -1
- package/esm/storage/utils/mime.d.mts +1 -1
- package/esm/storage/utils/mime.d.mts.map +1 -1
- package/esm/storage/utils/mime.mjs +1 -1
- package/esm/storage/utils/mime.mjs.map +1 -1
- package/esm/storage/utils/safe-fetch.d.mts +1 -1
- package/esm/storage/utils/safe-fetch.d.mts.map +1 -1
- package/esm/storage/utils/safe-fetch.mjs +1 -1
- package/esm/storage/utils/safe-fetch.mjs.map +1 -1
- package/esm/storage/utils/storage-error.d.mts +1 -1
- package/esm/storage/utils/storage-error.d.mts.map +1 -1
- package/esm/storage/utils/storage-error.mjs +1 -1
- package/esm/storage/utils/storage-error.mjs.map +1 -1
- package/esm/tests/start-http-development-server.d.mts +1 -1
- package/esm/tests/start-http-development-server.d.mts.map +1 -1
- package/esm/tests/start-http-development-server.mjs +3 -2
- package/esm/tests/start-http-development-server.mjs.map +1 -1
- package/esm/tests/test-connectors-selection.d.mts +1 -1
- package/esm/tests/test-connectors-selection.d.mts.map +1 -1
- package/esm/tests/test-connectors-selection.mjs +1 -1
- package/esm/tests/test-connectors-selection.mjs.map +1 -1
- package/esm/tests/test-helpers.d.mts +1 -1
- package/esm/tests/test-helpers.d.mts.map +1 -1
- package/esm/tests/test-helpers.mjs +1 -1
- package/esm/tests/test-helpers.mjs.map +1 -1
- package/esm/tests/test-lifecycle-state.mjs +1 -1
- package/esm/tests/test-lifecycle-state.mjs.map +1 -1
- package/esm/tests/test-server-port-channel.mjs +1 -1
- package/esm/tests/test-server-port-channel.mjs.map +1 -1
- package/esm/tests/test-setup-timeout.mjs +1 -1
- package/esm/tests/test-setup-timeout.mjs.map +1 -1
- package/esm/tests/vitest-setup.d.mts +1 -1
- package/esm/tests/vitest-setup.d.mts.map +1 -1
- package/esm/tests/vitest-setup.mjs +1 -1
- package/esm/tests/vitest-setup.mjs.map +1 -1
- package/esm/updater/package-manager.mjs +1 -1
- package/esm/updater/package-manager.mjs.map +1 -1
- package/esm/updater/update-warlock-packages.mjs +1 -1
- package/esm/updater/update-warlock-packages.mjs.map +1 -1
- package/esm/use-cases/types.d.mts +1 -1
- package/esm/use-cases/types.d.mts.map +1 -1
- package/esm/use-cases/use-case-broadcast.d.mts +1 -1
- package/esm/use-cases/use-case-broadcast.d.mts.map +1 -1
- package/esm/use-cases/use-case-broadcast.mjs +1 -1
- package/esm/use-cases/use-case-broadcast.mjs.map +1 -1
- package/esm/use-cases/use-case-events.d.mts +1 -1
- package/esm/use-cases/use-case-events.d.mts.map +1 -1
- package/esm/use-cases/use-case-events.mjs +1 -1
- package/esm/use-cases/use-case-events.mjs.map +1 -1
- package/esm/use-cases/use-case-pipeline.d.mts +1 -1
- package/esm/use-cases/use-case-pipeline.d.mts.map +1 -1
- package/esm/use-cases/use-case-pipeline.mjs +1 -1
- package/esm/use-cases/use-case-pipeline.mjs.map +1 -1
- package/esm/use-cases/use-case.d.mts +1 -1
- package/esm/use-cases/use-case.d.mts.map +1 -1
- package/esm/use-cases/use-case.errors.d.mts +1 -1
- package/esm/use-cases/use-case.errors.d.mts.map +1 -1
- package/esm/use-cases/use-case.errors.mjs +1 -1
- package/esm/use-cases/use-case.errors.mjs.map +1 -1
- package/esm/use-cases/use-case.mjs +1 -1
- package/esm/use-cases/use-case.mjs.map +1 -1
- package/esm/use-cases/use-cases-registry.d.mts +1 -1
- package/esm/use-cases/use-cases-registry.d.mts.map +1 -1
- package/esm/use-cases/use-cases-registry.mjs +1 -1
- package/esm/use-cases/use-cases-registry.mjs.map +1 -1
- package/esm/utils/app-log.d.mts +1 -1
- package/esm/utils/app-log.d.mts.map +1 -1
- package/esm/utils/app-log.mjs +1 -1
- package/esm/utils/app-log.mjs.map +1 -1
- package/esm/utils/database-log.d.mts +1 -1
- package/esm/utils/database-log.d.mts.map +1 -1
- package/esm/utils/database-log.mjs +1 -1
- package/esm/utils/database-log.mjs.map +1 -1
- package/esm/utils/environment.d.mts +1 -1
- package/esm/utils/environment.d.mts.map +1 -1
- package/esm/utils/environment.mjs +1 -1
- package/esm/utils/environment.mjs.map +1 -1
- package/esm/utils/framework-vesion.mjs +1 -1
- package/esm/utils/framework-vesion.mjs.map +1 -1
- package/esm/utils/get-localized.d.mts +1 -1
- package/esm/utils/get-localized.d.mts.map +1 -1
- package/esm/utils/get-localized.mjs +1 -1
- package/esm/utils/get-localized.mjs.map +1 -1
- package/esm/utils/load-environment.mjs +1 -1
- package/esm/utils/load-environment.mjs.map +1 -1
- package/esm/utils/normalized-path.d.mts +1 -1
- package/esm/utils/normalized-path.d.mts.map +1 -1
- package/esm/utils/normalized-path.mjs +1 -1
- package/esm/utils/normalized-path.mjs.map +1 -1
- package/esm/utils/npm-registry.d.mts +1 -1
- package/esm/utils/npm-registry.d.mts.map +1 -1
- package/esm/utils/npm-registry.mjs +1 -1
- package/esm/utils/npm-registry.mjs.map +1 -1
- package/esm/utils/paths.d.mts +1 -1
- package/esm/utils/paths.d.mts.map +1 -1
- package/esm/utils/paths.mjs +1 -1
- package/esm/utils/paths.mjs.map +1 -1
- package/esm/utils/promise-all-object.d.mts +1 -1
- package/esm/utils/promise-all-object.d.mts.map +1 -1
- package/esm/utils/promise-all-object.mjs +1 -1
- package/esm/utils/promise-all-object.mjs.map +1 -1
- package/esm/utils/queue.d.mts +1 -1
- package/esm/utils/queue.d.mts.map +1 -1
- package/esm/utils/queue.mjs +1 -1
- package/esm/utils/queue.mjs.map +1 -1
- package/esm/utils/sleep.d.mts +1 -1
- package/esm/utils/sleep.d.mts.map +1 -1
- package/esm/utils/sleep.mjs +1 -1
- package/esm/utils/sleep.mjs.map +1 -1
- package/esm/utils/sluggable.d.mts +1 -1
- package/esm/utils/sluggable.d.mts.map +1 -1
- package/esm/utils/sluggable.mjs +1 -1
- package/esm/utils/sluggable.mjs.map +1 -1
- package/esm/utils/to-json.d.mts +1 -1
- package/esm/utils/to-json.d.mts.map +1 -1
- package/esm/utils/to-json.mjs +1 -1
- package/esm/utils/to-json.mjs.map +1 -1
- package/esm/utils/types.d.mts +1 -1
- package/esm/utils/types.d.mts.map +1 -1
- package/esm/utils/urls.d.mts +1 -1
- package/esm/utils/urls.d.mts.map +1 -1
- package/esm/utils/urls.mjs +1 -1
- package/esm/utils/urls.mjs.map +1 -1
- package/esm/utils/version-compare.d.mts +1 -1
- package/esm/utils/version-compare.d.mts.map +1 -1
- package/esm/utils/version-compare.mjs +1 -1
- package/esm/utils/version-compare.mjs.map +1 -1
- package/esm/validation/database/exists-except-current-id.d.mts +1 -1
- package/esm/validation/database/exists-except-current-id.d.mts.map +1 -1
- package/esm/validation/database/exists-except-current-id.mjs +1 -1
- package/esm/validation/database/exists-except-current-id.mjs.map +1 -1
- package/esm/validation/database/exists-except-current-user.d.mts +1 -1
- package/esm/validation/database/exists-except-current-user.d.mts.map +1 -1
- package/esm/validation/database/exists-except-current-user.mjs +1 -1
- package/esm/validation/database/exists-except-current-user.mjs.map +1 -1
- package/esm/validation/database/types.d.mts +1 -1
- package/esm/validation/database/types.d.mts.map +1 -1
- package/esm/validation/database/unique-except-current-id.d.mts +1 -1
- package/esm/validation/database/unique-except-current-id.d.mts.map +1 -1
- package/esm/validation/database/unique-except-current-id.mjs +1 -1
- package/esm/validation/database/unique-except-current-id.mjs.map +1 -1
- package/esm/validation/database/unique-except-current-user.d.mts +1 -1
- package/esm/validation/database/unique-except-current-user.d.mts.map +1 -1
- package/esm/validation/database/unique-except-current-user.mjs +1 -1
- package/esm/validation/database/unique-except-current-user.mjs.map +1 -1
- package/esm/validation/file/file.d.mts +1 -1
- package/esm/validation/file/file.d.mts.map +1 -1
- package/esm/validation/file/file.mjs +1 -1
- package/esm/validation/file/file.mjs.map +1 -1
- package/esm/validation/init.mjs +1 -1
- package/esm/validation/init.mjs.map +1 -1
- package/esm/validation/plugins/database-plugin.mjs +1 -1
- package/esm/validation/plugins/database-plugin.mjs.map +1 -1
- package/esm/validation/plugins/file-plugin.mjs +1 -1
- package/esm/validation/plugins/file-plugin.mjs.map +1 -1
- package/esm/validation/plugins/localized-plugin.mjs +1 -1
- package/esm/validation/plugins/localized-plugin.mjs.map +1 -1
- package/esm/validation/types.d.mts +1 -1
- package/esm/validation/types.d.mts.map +1 -1
- package/esm/validation/validateAll.mjs +1 -1
- package/esm/validation/validateAll.mjs.map +1 -1
- package/esm/validation/validators/file-validator.d.mts +1 -1
- package/esm/validation/validators/file-validator.d.mts.map +1 -1
- package/esm/validation/validators/file-validator.mjs +1 -1
- package/esm/validation/validators/file-validator.mjs.map +1 -1
- package/esm/vite/lower-stage3-decorators.d.mts +1 -1
- package/esm/vite/lower-stage3-decorators.d.mts.map +1 -1
- package/esm/vite/lower-stage3-decorators.mjs +1 -1
- package/esm/vite/lower-stage3-decorators.mjs.map +1 -1
- package/esm/warlock-config/default-configurations.mjs +1 -1
- package/esm/warlock-config/default-configurations.mjs.map +1 -1
- package/esm/warlock-config/define-config.d.mts +1 -1
- package/esm/warlock-config/define-config.d.mts.map +1 -1
- package/esm/warlock-config/define-config.mjs +1 -1
- package/esm/warlock-config/define-config.mjs.map +1 -1
- package/esm/warlock-config/normalize-build-config.mjs +1 -1
- package/esm/warlock-config/normalize-build-config.mjs.map +1 -1
- package/esm/warlock-config/types.d.mts +1 -1
- package/esm/warlock-config/types.d.mts.map +1 -1
- package/esm/warlock-config/warlock-config.manager.d.mts +1 -1
- package/esm/warlock-config/warlock-config.manager.d.mts.map +1 -1
- package/esm/warlock-config/warlock-config.manager.mjs +1 -1
- package/esm/warlock-config/warlock-config.manager.mjs.map +1 -1
- package/llms-full.txt +527 -91
- package/llms.txt +7 -5
- package/package.json +12 -12
- package/skills/add-connector/SKILL.md +35 -28
- package/skills/create-controller/SKILL.md +1 -1
- package/skills/create-module/SKILL.md +12 -12
- package/skills/hash-password/SKILL.md +4 -4
- package/skills/run-app/SKILL.md +77 -16
- package/skills/send-mail/SKILL.md +2 -2
- package/skills/use-middleware/SKILL.md +13 -4
- package/skills/use-model-transformers/SKILL.md +2 -2
- package/skills/use-repository/SKILL.md +1 -1
- package/skills/use-request-locals/SKILL.md +24 -1
- package/skills/validate-input/SKILL.md +1 -1
- package/skills/warlock-conventions/SKILL.md +6 -2
- package/skills/warlock-doctor/SKILL.md +3 -3
- package/skills/warlock-routes/SKILL.md +47 -9
- package/skills/write-cli-command/SKILL.md +1 -1
- package/skills/write-seeder/SKILL.md +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-imports.mjs","names":[],"sources":["../../../../../../../core/src/dev-server/parse-imports.ts"],"sourcesContent":["import { fileExistsAsync, directoryExistsAsync } from \"@warlock.js/fs\";\nimport { ImportSpecifier, parse } from \"es-module-lexer\";\nimport path from \"node:path\";\nimport { Path } from \"../utils/normalized-path\";\nimport { tsconfigManager } from \"./tsconfig-manager\";\n\n/**\n * Detect if a file contains only type definitions (no runtime code)\n *\n * A file is considered type-only if ALL its exports are:\n * - interface declarations\n * - type alias declarations\n * - export type { ... } statements\n * - export type { ... } from \"...\" statements\n *\n * Files with any of these are NOT type-only:\n * - export const/let/var\n * - export function\n * - export class\n * - export default (non-type)\n * - export { ... } (without type keyword)\n * - export * from (without type keyword)\n *\n * @param source - The source code to analyze\n * @returns true if the file exports only types\n */\nexport function isTypeOnlyFile(source: string): boolean {\n // Remove comments to avoid false positives\n const withoutComments = source\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\") // block comments\n .replace(/\\/\\/.*$/gm, \"\"); // line comments\n\n // Remove string literals to avoid false positives\n const withoutStrings = withoutComments\n .replace(/'(?:[^'\\\\]|\\\\.)*'/g, \"''\")\n .replace(/\"(?:[^\"\\\\]|\\\\.)*\"/g, '\"\"')\n .replace(/`(?:[^`\\\\]|\\\\.)*`/g, \"``\");\n\n // Patterns for type-only exports (these are safe)\n const typeOnlyPatterns = [\n /export\\s+type\\s+\\{[^}]*\\}/g, // export type { Foo, Bar }\n /export\\s+type\\s+\\{[^}]*\\}\\s+from\\s+['\"]/g, // export type { Foo } from \"...\"\n /export\\s+interface\\s+\\w+/g, // export interface Foo\n /export\\s+type\\s+\\w+\\s*=/g, // export type Foo =\n ];\n\n // Remove all type-only exports from consideration\n let remaining = withoutStrings;\n for (const pattern of typeOnlyPatterns) {\n remaining = remaining.replace(pattern, \"\");\n }\n\n // Patterns for runtime exports (these make the file NOT type-only)\n const runtimeExportPatterns = [\n /export\\s+(?:const|let|var)\\s+\\w+/g, // export const/let/var foo\n /export\\s+function\\s+\\w+/g, // export function foo\n /export\\s+async\\s+function\\s+\\w+/g, // export async function foo\n /export\\s+class\\s+\\w+/g, // export class Foo\n /export\\s+enum\\s+\\w+/g, // export enum Foo (enums have runtime value)\n /export\\s+default\\s+(?!type\\s)/g, // export default (not type)\n /export\\s+\\{[^}]*\\}(?!\\s+from)/g, // export { foo } (local re-export without type)\n /export\\s+\\{[^}]*\\}\\s+from\\s+['\"][^'\"]+['\"]/g, // export { foo } from (without type)\n /export\\s+\\*\\s+from\\s+['\"][^'\"]+['\"]/g, // export * from (re-exports everything)\n /export\\s+\\*\\s+as\\s+\\w+/g, // export * as namespace\n ];\n\n for (const pattern of runtimeExportPatterns) {\n if (pattern.test(remaining)) {\n // Reset regex lastIndex for subsequent tests\n pattern.lastIndex = 0;\n\n // Special case: check if export { } contains only type exports\n if (pattern.source.includes(\"export\\\\s+\\\\{\")) {\n const matches = remaining.match(/export\\s+\\{([^}]*)\\}(?:\\s+from\\s+['\"][^'\"]+['\"])?/g);\n if (matches) {\n for (const match of matches) {\n // Skip if it's already a type export\n if (/^export\\s+type\\s+/.test(match)) continue;\n\n // Extract the specifiers\n const specifiersMatch = match.match(/export\\s+\\{([^}]*)\\}/);\n if (specifiersMatch) {\n const specifiers = specifiersMatch[1];\n const items = specifiers\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n\n // If any specifier is NOT prefixed with \"type \", this is a runtime export\n const hasRuntimeSpecifier = items.some((item) => !item.startsWith(\"type \"));\n if (hasRuntimeSpecifier) {\n return false;\n }\n }\n }\n }\n continue;\n }\n\n return false;\n }\n }\n\n // If we get here, no runtime exports were found\n // But we should also verify the file has at least some type exports\n // (an empty file or file with only imports is not really \"type-only\")\n const hasTypeExports = typeOnlyPatterns.some((pattern) => {\n pattern.lastIndex = 0;\n return pattern.test(withoutStrings);\n });\n\n return hasTypeExports;\n}\n\n/**\n * Check if an import statement is a pure `import type` (the keyword sits\n * immediately after `import`, covering `import type { X }`, `import type Foo`,\n * and `import type * as Ns`).\n */\nfunction isTypeOnlyImport(line: string): boolean {\n const trimmed = line.trim();\n\n return trimmed.startsWith(\"import type \") || !!trimmed.match(/^import\\s+type\\s+[\\{\\*]/);\n}\n\n/**\n * Decide whether an `import ... from \"m\"` statement contributes any runtime\n * binding. Returns false for pure `import type` and for destructured imports\n * where every specifier is prefixed with the `type` keyword.\n */\nfunction hasRuntimeImports(line: string): boolean {\n const trimmed = line.trim();\n\n if (isTypeOnlyImport(trimmed)) {\n return false;\n }\n\n const specifiersMatch = trimmed.match(/import\\s+(?:type\\s+)?\\{([^}]+)\\}/);\n\n if (!specifiersMatch) {\n return true;\n }\n\n const items = specifiersMatch[1].split(\",\").map((s) => s.trim()).filter(Boolean);\n\n return !items.every((item) => /^type\\s+\\w+/.test(item));\n}\n\n/**\n * Decide whether an `export ... from \"m\"` statement re-exports only types.\n * Covers `export type { X } from`, `export type * from`, and\n * `export { type X, type Y } from`.\n */\nfunction isExportTypeOnlyStatement(line: string): boolean {\n const trimmed = line.trim();\n\n if (/^export\\s+type\\s+/.test(trimmed)) {\n return true;\n }\n\n const specifiersMatch = trimmed.match(/export\\s+\\{([^}]+)\\}/);\n\n if (!specifiersMatch) {\n return false;\n }\n\n const items = specifiersMatch[1].split(\",\").map((s) => s.trim()).filter(Boolean);\n\n return items.every((item) => /^type\\s+\\w+/.test(item));\n}\n\n/**\n * Extract import paths using regex (more reliable for TypeScript).\n * Each entry carries an `isTypeOnly` flag: true when every occurrence of the\n * path in the source is a type-only statement (no runtime binding).\n * A single runtime occurrence makes the path runtime.\n */\nfunction extractImportPathsWithRegex(\n source: string,\n): Array<{ path: string; originalLine: string; isTypeOnly: boolean }> {\n const imports: Array<{ path: string; originalLine: string; isTypeOnly: boolean }> = [];\n const seenPaths = new Map<string, number>();\n\n /**\n * Record an import path with its type-only flag.\n * If the same path appears in multiple statements, the edge is type-only\n * iff every occurrence is type-only — a single runtime statement makes it runtime.\n */\n const record = (importPath: string, originalLine: string, isTypeOnly: boolean): void => {\n if (!importPath) {\n return;\n }\n\n const existingIndex = seenPaths.get(importPath);\n\n if (existingIndex === undefined) {\n seenPaths.set(importPath, imports.length);\n imports.push({ path: importPath, originalLine, isTypeOnly });\n\n return;\n }\n\n if (!isTypeOnly) {\n imports[existingIndex].isTypeOnly = false;\n }\n };\n\n // Pattern 1: Standard ES module imports (handles multiline)\n // Matches: import { ... } from \"path\", import Foo from \"path\", import Foo, { ... } from \"path\"\n const importRegex =\n /import\\s+(?:type\\s+)?(\\{[\\s\\S]*?\\}|\\*\\s+as\\s+\\w+|\\w+(?:\\s*,\\s*\\{[\\s\\S]*?\\})?)\\s+from\\s+['\"]([^'\"]+)['\"]/g;\n\n let match;\n\n while ((match = importRegex.exec(source)) !== null) {\n const fullMatch = match[0];\n const importPath = match[2];\n const isTypeOnly = !hasRuntimeImports(fullMatch);\n\n record(importPath, fullMatch, isTypeOnly);\n }\n\n // Pattern 1b: Side-effect imports - import \"path\" — always runtime\n const sideEffectRegex = /import\\s+['\"]([^'\"]+)['\"]/g;\n\n while ((match = sideEffectRegex.exec(source)) !== null) {\n record(match[1], match[0], false);\n }\n\n // Pattern 2: Dynamic imports - import(\"path\") — always runtime\n const dynamicImportPattern = /import\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g;\n\n while ((match = dynamicImportPattern.exec(source)) !== null) {\n record(match[1], match[0], false);\n }\n\n // Pattern 3: Export from - export ... from \"path\"\n const exportFromPattern = /export\\s+(?:\\{[^}]*\\}|\\*|\\w+)\\s+from\\s+['\"]([^'\"]+)['\"]/g;\n\n while ((match = exportFromPattern.exec(source)) !== null) {\n const fullMatch = match[0];\n\n record(match[1], fullMatch, isExportTypeOnlyStatement(fullMatch));\n }\n\n return imports;\n}\n\n/**\n * Metadata for a single resolved import edge.\n * `isTypeOnly` is true iff every import/export statement that references this\n * path is type-only (pure `import type`, `export type`, or destructured lists\n * where every specifier carries the `type` keyword). A single runtime\n * occurrence flips the flag to false — that's what matters for cycle detection.\n */\nexport type ResolvedImport = {\n absolutePath: string;\n isTypeOnly: boolean;\n};\n\n/**\n * Parse import/export statements in a TS/JS source file and return the\n * resolved dependency edges keyed by the original import path. Includes\n * type-only edges (flagged) so downstream consumers can distinguish runtime\n * cycles from type-only ones.\n *\n * @example\n * const importMap = await parseImports(source, \"/abs/path/to/file.ts\");\n * for (const [importPath, { absolutePath, isTypeOnly }] of importMap) {\n * // ...\n * }\n */\nexport async function parseImports(\n source: string,\n filePath: string,\n): Promise<Map<string, ResolvedImport>> {\n try {\n // Skip .d.ts files - they're type declarations, not runtime code\n if (filePath.endsWith(\".d.ts\")) {\n return new Map();\n }\n\n // Try es-module-lexer first (faster and more accurate for simple cases)\n try {\n const [imports] = await parse(source);\n\n if (imports && imports.length > 0) {\n return await resolveImports(imports as ImportSpecifier[], source, filePath);\n }\n } catch (lexerError) {\n // es-module-lexer failed, fall back to regex-based extraction\n // This is common with TypeScript files that have complex syntax\n }\n\n // Fallback: Use regex-based extraction (more forgiving with TypeScript)\n const regexImports = extractImportPathsWithRegex(source);\n const resolvedImports = new Map<string, ResolvedImport>();\n\n for (const { path: importPath, isTypeOnly } of regexImports) {\n if (isNodeBuiltin(importPath)) {\n continue;\n }\n\n if (!importPath.startsWith(\".\") && !tsconfigManager.isAlias(importPath)) {\n continue;\n }\n\n let resolvedPath: string | null = null;\n\n if (tsconfigManager.isAlias(importPath)) {\n resolvedPath = await resolveAliasImport(importPath);\n } else if (importPath.startsWith(\".\")) {\n resolvedPath = await resolveRelativeImport(importPath, filePath);\n }\n\n if (resolvedPath) {\n mergeResolvedImport(resolvedImports, importPath, resolvedPath, isTypeOnly);\n }\n }\n\n return resolvedImports;\n } catch (error) {\n console.error(`Error parsing imports for ${filePath}:`, error);\n\n return new Map();\n }\n}\n\n/**\n * Merge a resolved import into the output map, preserving the type-only rule:\n * a path is type-only iff every statement that references it is type-only.\n */\nfunction mergeResolvedImport(\n target: Map<string, ResolvedImport>,\n importPath: string,\n absolutePath: string,\n isTypeOnly: boolean,\n): void {\n const existing = target.get(importPath);\n\n if (!existing) {\n target.set(importPath, { absolutePath, isTypeOnly });\n\n return;\n }\n\n if (!isTypeOnly) {\n existing.isTypeOnly = false;\n }\n}\n\n/**\n * Resolve imports from `es-module-lexer` output. For each specifier, slice the\n * raw statement (`ss..se`) and re-run the type-only heuristic so we can flag\n * the edge correctly — the lexer itself does not distinguish `import type`.\n */\nasync function resolveImports(\n imports: ImportSpecifier[],\n source: string,\n filePath: string,\n): Promise<Map<string, ResolvedImport>> {\n const resolvedImports = new Map<string, ResolvedImport>();\n\n for (const imp of imports) {\n const importPath = imp.n;\n\n if (!importPath) {\n continue;\n }\n\n if (isNodeBuiltin(importPath)) {\n continue;\n }\n\n if (!importPath.startsWith(\".\") && !tsconfigManager.isAlias(importPath)) {\n continue;\n }\n\n let resolvedPath: string | null = null;\n\n if (tsconfigManager.isAlias(importPath)) {\n resolvedPath = await resolveAliasImport(importPath);\n } else if (importPath.startsWith(\".\")) {\n resolvedPath = await resolveRelativeImport(importPath, filePath);\n }\n\n if (!resolvedPath) {\n continue;\n }\n\n const isTypeOnly = isLexerStatementTypeOnly(imp, source);\n\n mergeResolvedImport(resolvedImports, importPath, resolvedPath, isTypeOnly);\n }\n\n return resolvedImports;\n}\n\n/**\n * Classify a single lexer-reported statement as type-only or runtime.\n * Dynamic imports (`import(...)`) are always runtime. For static\n * imports/export-from we slice the raw source and apply the same heuristic\n * the regex fallback uses.\n */\nfunction isLexerStatementTypeOnly(imp: ImportSpecifier, source: string): boolean {\n // Dynamic imports always execute — they cannot be type-only.\n // es-module-lexer reports dynamic with a.n === undefined typically, but\n // we guard by checking the statement prefix too.\n const statementStart = imp.ss;\n const statementEnd = imp.se;\n\n if (\n typeof statementStart !== \"number\" ||\n typeof statementEnd !== \"number\" ||\n statementEnd <= statementStart\n ) {\n return false;\n }\n\n const statement = source.slice(statementStart, statementEnd);\n const trimmed = statement.trim();\n\n if (trimmed.startsWith(\"import(\") || /^\\bimport\\s*\\(/.test(trimmed)) {\n return false;\n }\n\n if (trimmed.startsWith(\"export\")) {\n return isExportTypeOnlyStatement(statement);\n }\n\n return !hasRuntimeImports(statement);\n}\n\n/**\n * Resolve alias imports to actual file paths with extensions\n * Example: app/users/services/get-users.service -> /absolute/path/to/src/app/users/services/get-users.service.ts\n */\nasync function resolveAliasImport(importPath: string): Promise<string | null> {\n // Use tsconfig manager to resolve the alias to an absolute path\n const resolvedBase = tsconfigManager.resolveAliasToAbsolute(importPath);\n\n if (!resolvedBase) return null;\n\n // Try to resolve with extensions\n const resolvedPath = await tryResolveWithExtensions(resolvedBase);\n\n return resolvedPath;\n}\n\n/**\n * Resolve relative imports to actual file paths\n * Example: ./../services/get-user.service -> /absolute/path/to/services/get-user.service.ts\n */\nasync function resolveRelativeImport(\n importPath: string,\n currentFilePath: string,\n): Promise<string | null> {\n const dir = path.dirname(currentFilePath);\n // Use path.resolve to handle .. and . properly, then normalize to forward slashes\n const resolvedBase = Path.normalize(path.resolve(dir, importPath));\n\n // Try to resolve with extensions\n const resolvedPath = await tryResolveWithExtensions(resolvedBase);\n\n return resolvedPath;\n}\n\n/**\n * Try to resolve a file path by checking different extensions\n * TypeScript/JavaScript files can be imported without extensions\n *\n * @TODO: For better performance, we need to check the files in files orchestrator\n * instead of using the file system as we will be fetching all project files anyway.\n */\n// Cache for file existence checks to avoid redundant filesystem calls\nconst fileExistsCache = new Map<string, boolean>();\n\n/**\n * Clear the file exists cache\n * Should be called when new files are created to ensure fresh lookups\n */\nexport function clearFileExistsCache(): void {\n fileExistsCache.clear();\n}\n\nasync function cachedFileExists(filePath: string): Promise<boolean> {\n if (fileExistsCache.has(filePath)) {\n return fileExistsCache.get(filePath)!;\n }\n const exists = (await fileExistsAsync(filePath)) as boolean;\n fileExistsCache.set(filePath, exists);\n return exists;\n}\n\nasync function tryResolveWithExtensions(basePath: string): Promise<string | null> {\n // Normalize the base path first (handle Windows paths)\n const normalizedBase = Path.normalize(basePath);\n\n // List of extensions to try, in order of preference\n const extensions = [\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"];\n const validExtensions = new Set(extensions);\n\n // If the path already has a VALID code file extension, check if it exists\n const ext = path.extname(normalizedBase);\n if (ext && validExtensions.has(ext)) {\n if (await cachedFileExists(normalizedBase)) {\n return normalizedBase;\n }\n // If explicit extension doesn't exist, return null\n return null;\n }\n\n // Try all extensions in parallel for better performance\n const pathsToCheck = extensions.map((extension) => normalizedBase + extension);\n const results = await Promise.all(\n pathsToCheck.map(async (p) => ({ path: p, exists: await cachedFileExists(p) })),\n );\n\n // Return the first one that exists (in order of preference)\n for (const result of results) {\n if (result.exists) {\n return result.path;\n }\n }\n\n // Try index files in directory\n if (await directoryExistsAsync(normalizedBase)) {\n const indexPaths = extensions.map((extension) =>\n Path.join(normalizedBase, `index${extension}`),\n );\n const indexResults = await Promise.all(\n indexPaths.map(async (p) => ({ path: p, exists: await cachedFileExists(p) })),\n );\n\n for (const result of indexResults) {\n if (result.exists) {\n return result.path;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Check if import is a Node.js built-in module\n */\nfunction isNodeBuiltin(importPath: string): boolean {\n const builtins = [\n \"fs\",\n \"path\",\n \"http\",\n \"https\",\n \"crypto\",\n \"stream\",\n \"util\",\n \"events\",\n \"buffer\",\n \"child_process\",\n \"os\",\n \"url\",\n \"querystring\",\n \"zlib\",\n \"net\",\n \"tls\",\n \"dns\",\n \"dgram\",\n \"cluster\",\n \"worker_threads\",\n \"perf_hooks\",\n \"async_hooks\",\n \"timers\",\n \"readline\",\n \"repl\",\n \"vm\",\n \"assert\",\n \"console\",\n \"process\",\n \"v8\",\n ];\n\n // Check for node: prefix or direct builtin name\n if (importPath.startsWith(\"node:\")) return true;\n\n const moduleName = importPath.split(\"/\")[0];\n return builtins.includes(moduleName);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,QAAyB;CAOtD,MAAM,iBALkB,OACrB,QAAQ,qBAAqB,EAAE,CAAC,CAChC,QAAQ,aAAa,EAGa,CAAC,CACnC,QAAQ,sBAAsB,IAAI,CAAC,CACnC,QAAQ,sBAAsB,MAAI,CAAC,CACnC,QAAQ,sBAAsB,IAAI;CAGrC,MAAM,mBAAmB;EACvB;EACA;EACA;EACA;CACF;CAGA,IAAI,YAAY;CAChB,KAAK,MAAM,WAAW,kBACpB,YAAY,UAAU,QAAQ,SAAS,EAAE;CAiB3C,KAAK,MAAM,WAAW;EAZpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGwC,GACxC,IAAI,QAAQ,KAAK,SAAS,GAAG;EAE3B,QAAQ,YAAY;EAGpB,IAAI,QAAQ,OAAO,SAAS,eAAe,GAAG;GAC5C,MAAM,UAAU,UAAU,MAAM,oDAAoD;GACpF,IAAI,SACF,KAAK,MAAM,SAAS,SAAS;IAE3B,IAAI,oBAAoB,KAAK,KAAK,GAAG;IAGrC,MAAM,kBAAkB,MAAM,MAAM,sBAAsB;IAC1D,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,IAAI,OAAO,gBAAgB,IAAI,GAAG,GAAG;EACnC,IAAI,MAAM,iBAAiB,cAAc,GACvC,OAAO;EAGT,OAAO;CACT;CAGA,MAAM,eAAe,WAAW,KAAK,cAAc,iBAAiB,SAAS;CAC7E,MAAM,UAAU,MAAM,QAAQ,IAC5B,aAAa,IAAI,OAAO,OAAO;EAAE,MAAM;EAAG,QAAQ,MAAM,iBAAiB,CAAC;CAAE,EAAE,CAChF;CAGA,KAAK,MAAM,UAAU,SACnB,IAAI,OAAO,QACT,OAAO,OAAO;CAKlB,IAAI,MAAM,qBAAqB,cAAc,GAAG;EAC9C,MAAM,aAAa,WAAW,KAAK,cACjC,KAAK,KAAK,gBAAgB,QAAQ,WAAW,CAC/C;EACA,MAAM,eAAe,MAAM,QAAQ,IACjC,WAAW,IAAI,OAAO,OAAO;GAAE,MAAM;GAAG,QAAQ,MAAM,iBAAiB,CAAC;EAAE,EAAE,CAC9E;EAEA,KAAK,MAAM,UAAU,cACnB,IAAI,OAAO,QACT,OAAO,OAAO;CAGpB;CAEA,OAAO;AACT;;;;AAKA,SAAS,cAAc,YAA6B;CAClD,MAAM,WAAW;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAGA,IAAI,WAAW,WAAW,OAAO,GAAG,OAAO;CAE3C,MAAM,aAAa,WAAW,MAAM,GAAG,CAAC,CAAC;CACzC,OAAO,SAAS,SAAS,UAAU;AACrC"}
|
|
1
|
+
{"version":3,"file":"parse-imports.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/parse-imports.ts"],"sourcesContent":["import { fileExistsAsync, directoryExistsAsync } from \"@warlock.js/fs\";\nimport { type ImportSpecifier, parse } from \"es-module-lexer\";\nimport path from \"node:path\";\nimport { Path } from \"../utils/normalized-path\";\nimport { tsconfigManager } from \"./tsconfig-manager\";\n\n/**\n * Detect if a file contains only type definitions (no runtime code)\n *\n * A file is considered type-only if ALL its exports are:\n * - interface declarations\n * - type alias declarations\n * - export type { ... } statements\n * - export type { ... } from \"...\" statements\n *\n * Files with any of these are NOT type-only:\n * - export const/let/var\n * - export function\n * - export class\n * - export default (non-type)\n * - export { ... } (without type keyword)\n * - export * from (without type keyword)\n *\n * @param source - The source code to analyze\n * @returns true if the file exports only types\n */\nexport function isTypeOnlyFile(source: string): boolean {\n // Remove comments to avoid false positives\n const withoutComments = source\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\") // block comments\n .replace(/\\/\\/.*$/gm, \"\"); // line comments\n\n // Remove string literals to avoid false positives\n const withoutStrings = withoutComments\n .replace(/'(?:[^'\\\\]|\\\\.)*'/g, \"''\")\n .replace(/\"(?:[^\"\\\\]|\\\\.)*\"/g, '\"\"')\n .replace(/`(?:[^`\\\\]|\\\\.)*`/g, \"``\");\n\n // Patterns for type-only exports (these are safe)\n const typeOnlyPatterns = [\n /export\\s+type\\s+\\{[^}]*\\}/g, // export type { Foo, Bar }\n /export\\s+type\\s+\\{[^}]*\\}\\s+from\\s+['\"]/g, // export type { Foo } from \"...\"\n /export\\s+interface\\s+\\w+/g, // export interface Foo\n /export\\s+type\\s+\\w+\\s*=/g, // export type Foo =\n ];\n\n // Remove all type-only exports from consideration\n let remaining = withoutStrings;\n for (const pattern of typeOnlyPatterns) {\n remaining = remaining.replace(pattern, \"\");\n }\n\n // Patterns for runtime exports (these make the file NOT type-only)\n const runtimeExportPatterns = [\n /export\\s+(?:const|let|var)\\s+\\w+/g, // export const/let/var foo\n /export\\s+function\\s+\\w+/g, // export function foo\n /export\\s+async\\s+function\\s+\\w+/g, // export async function foo\n /export\\s+class\\s+\\w+/g, // export class Foo\n /export\\s+enum\\s+\\w+/g, // export enum Foo (enums have runtime value)\n /export\\s+default\\s+(?!type\\s)/g, // export default (not type)\n /export\\s+\\{[^}]*\\}(?!\\s+from)/g, // export { foo } (local re-export without type)\n /export\\s+\\{[^}]*\\}\\s+from\\s+['\"][^'\"]+['\"]/g, // export { foo } from (without type)\n /export\\s+\\*\\s+from\\s+['\"][^'\"]+['\"]/g, // export * from (re-exports everything)\n /export\\s+\\*\\s+as\\s+\\w+/g, // export * as namespace\n ];\n\n for (const pattern of runtimeExportPatterns) {\n if (pattern.test(remaining)) {\n // Reset regex lastIndex for subsequent tests\n pattern.lastIndex = 0;\n\n // Special case: check if export { } contains only type exports\n if (pattern.source.includes(\"export\\\\s+\\\\{\")) {\n const matches = remaining.match(/export\\s+\\{([^}]*)\\}(?:\\s+from\\s+['\"][^'\"]+['\"])?/g);\n if (matches) {\n for (const match of matches) {\n // Skip if it's already a type export\n if (/^export\\s+type\\s+/.test(match)) continue;\n\n // Extract the specifiers\n const specifiersMatch = match.match(/export\\s+\\{([^}]*)\\}/);\n if (specifiersMatch) {\n const specifiers = specifiersMatch[1];\n const items = specifiers\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n\n // If any specifier is NOT prefixed with \"type \", this is a runtime export\n const hasRuntimeSpecifier = items.some((item) => !item.startsWith(\"type \"));\n if (hasRuntimeSpecifier) {\n return false;\n }\n }\n }\n }\n continue;\n }\n\n return false;\n }\n }\n\n // If we get here, no runtime exports were found\n // But we should also verify the file has at least some type exports\n // (an empty file or file with only imports is not really \"type-only\")\n const hasTypeExports = typeOnlyPatterns.some((pattern) => {\n pattern.lastIndex = 0;\n return pattern.test(withoutStrings);\n });\n\n return hasTypeExports;\n}\n\n/**\n * Check if an import statement is a pure `import type` (the keyword sits\n * immediately after `import`, covering `import type { X }`, `import type Foo`,\n * and `import type * as Ns`).\n */\nfunction isTypeOnlyImport(line: string): boolean {\n const trimmed = line.trim();\n\n return trimmed.startsWith(\"import type \") || !!trimmed.match(/^import\\s+type\\s+[\\{\\*]/);\n}\n\n/**\n * Decide whether an `import ... from \"m\"` statement contributes any runtime\n * binding. Returns false for pure `import type` and for destructured imports\n * where every specifier is prefixed with the `type` keyword.\n */\nfunction hasRuntimeImports(line: string): boolean {\n const trimmed = line.trim();\n\n if (isTypeOnlyImport(trimmed)) {\n return false;\n }\n\n const specifiersMatch = trimmed.match(/import\\s+(?:type\\s+)?\\{([^}]+)\\}/);\n\n if (!specifiersMatch) {\n return true;\n }\n\n const items = specifiersMatch[1].split(\",\").map((s) => s.trim()).filter(Boolean);\n\n return !items.every((item) => /^type\\s+\\w+/.test(item));\n}\n\n/**\n * Decide whether an `export ... from \"m\"` statement re-exports only types.\n * Covers `export type { X } from`, `export type * from`, and\n * `export { type X, type Y } from`.\n */\nfunction isExportTypeOnlyStatement(line: string): boolean {\n const trimmed = line.trim();\n\n if (/^export\\s+type\\s+/.test(trimmed)) {\n return true;\n }\n\n const specifiersMatch = trimmed.match(/export\\s+\\{([^}]+)\\}/);\n\n if (!specifiersMatch) {\n return false;\n }\n\n const items = specifiersMatch[1].split(\",\").map((s) => s.trim()).filter(Boolean);\n\n return items.every((item) => /^type\\s+\\w+/.test(item));\n}\n\n/**\n * Extract import paths using regex (more reliable for TypeScript).\n * Each entry carries an `isTypeOnly` flag: true when every occurrence of the\n * path in the source is a type-only statement (no runtime binding).\n * A single runtime occurrence makes the path runtime.\n */\nfunction extractImportPathsWithRegex(\n source: string,\n): Array<{ path: string; originalLine: string; isTypeOnly: boolean }> {\n const imports: Array<{ path: string; originalLine: string; isTypeOnly: boolean }> = [];\n const seenPaths = new Map<string, number>();\n\n /**\n * Record an import path with its type-only flag.\n * If the same path appears in multiple statements, the edge is type-only\n * iff every occurrence is type-only — a single runtime statement makes it runtime.\n */\n const record = (importPath: string, originalLine: string, isTypeOnly: boolean): void => {\n if (!importPath) {\n return;\n }\n\n const existingIndex = seenPaths.get(importPath);\n\n if (existingIndex === undefined) {\n seenPaths.set(importPath, imports.length);\n imports.push({ path: importPath, originalLine, isTypeOnly });\n\n return;\n }\n\n if (!isTypeOnly) {\n imports[existingIndex].isTypeOnly = false;\n }\n };\n\n // Pattern 1: Standard ES module imports (handles multiline)\n // Matches: import { ... } from \"path\", import Foo from \"path\", import Foo, { ... } from \"path\"\n const importRegex =\n /import\\s+(?:type\\s+)?(\\{[\\s\\S]*?\\}|\\*\\s+as\\s+\\w+|\\w+(?:\\s*,\\s*\\{[\\s\\S]*?\\})?)\\s+from\\s+['\"]([^'\"]+)['\"]/g;\n\n let match;\n\n while ((match = importRegex.exec(source)) !== null) {\n const fullMatch = match[0];\n const importPath = match[2];\n const isTypeOnly = !hasRuntimeImports(fullMatch);\n\n record(importPath, fullMatch, isTypeOnly);\n }\n\n // Pattern 1b: Side-effect imports - import \"path\" — always runtime\n const sideEffectRegex = /import\\s+['\"]([^'\"]+)['\"]/g;\n\n while ((match = sideEffectRegex.exec(source)) !== null) {\n record(match[1], match[0], false);\n }\n\n // Pattern 2: Dynamic imports - import(\"path\") — always runtime\n const dynamicImportPattern = /import\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g;\n\n while ((match = dynamicImportPattern.exec(source)) !== null) {\n record(match[1], match[0], false);\n }\n\n // Pattern 3: Export from - export ... from \"path\"\n const exportFromPattern = /export\\s+(?:\\{[^}]*\\}|\\*|\\w+)\\s+from\\s+['\"]([^'\"]+)['\"]/g;\n\n while ((match = exportFromPattern.exec(source)) !== null) {\n const fullMatch = match[0];\n\n record(match[1], fullMatch, isExportTypeOnlyStatement(fullMatch));\n }\n\n return imports;\n}\n\n/**\n * Metadata for a single resolved import edge.\n * `isTypeOnly` is true iff every import/export statement that references this\n * path is type-only (pure `import type`, `export type`, or destructured lists\n * where every specifier carries the `type` keyword). A single runtime\n * occurrence flips the flag to false — that's what matters for cycle detection.\n */\nexport type ResolvedImport = {\n absolutePath: string;\n isTypeOnly: boolean;\n};\n\n/**\n * Parse import/export statements in a TS/JS source file and return the\n * resolved dependency edges keyed by the original import path. Includes\n * type-only edges (flagged) so downstream consumers can distinguish runtime\n * cycles from type-only ones.\n *\n * @example\n * const importMap = await parseImports(source, \"/abs/path/to/file.ts\");\n * for (const [importPath, { absolutePath, isTypeOnly }] of importMap) {\n * // ...\n * }\n */\nexport async function parseImports(\n source: string,\n filePath: string,\n): Promise<Map<string, ResolvedImport>> {\n try {\n // Skip .d.ts files - they're type declarations, not runtime code\n if (filePath.endsWith(\".d.ts\")) {\n return new Map();\n }\n\n // Try es-module-lexer first (faster and more accurate for simple cases)\n try {\n const [imports] = await parse(source);\n\n if (imports && imports.length > 0) {\n return await resolveImports(imports as ImportSpecifier[], source, filePath);\n }\n } catch (lexerError) {\n // es-module-lexer failed, fall back to regex-based extraction\n // This is common with TypeScript files that have complex syntax\n }\n\n // Fallback: Use regex-based extraction (more forgiving with TypeScript)\n const regexImports = extractImportPathsWithRegex(source);\n const resolvedImports = new Map<string, ResolvedImport>();\n\n for (const { path: importPath, isTypeOnly } of regexImports) {\n if (isNodeBuiltin(importPath)) {\n continue;\n }\n\n if (!importPath.startsWith(\".\") && !tsconfigManager.isAlias(importPath)) {\n continue;\n }\n\n let resolvedPath: string | null = null;\n\n if (tsconfigManager.isAlias(importPath)) {\n resolvedPath = await resolveAliasImport(importPath);\n } else if (importPath.startsWith(\".\")) {\n resolvedPath = await resolveRelativeImport(importPath, filePath);\n }\n\n if (resolvedPath) {\n mergeResolvedImport(resolvedImports, importPath, resolvedPath, isTypeOnly);\n }\n }\n\n return resolvedImports;\n } catch (error) {\n console.error(`Error parsing imports for ${filePath}:`, error);\n\n return new Map();\n }\n}\n\n/**\n * Merge a resolved import into the output map, preserving the type-only rule:\n * a path is type-only iff every statement that references it is type-only.\n */\nfunction mergeResolvedImport(\n target: Map<string, ResolvedImport>,\n importPath: string,\n absolutePath: string,\n isTypeOnly: boolean,\n): void {\n const existing = target.get(importPath);\n\n if (!existing) {\n target.set(importPath, { absolutePath, isTypeOnly });\n\n return;\n }\n\n if (!isTypeOnly) {\n existing.isTypeOnly = false;\n }\n}\n\n/**\n * Resolve imports from `es-module-lexer` output. For each specifier, slice the\n * raw statement (`ss..se`) and re-run the type-only heuristic so we can flag\n * the edge correctly — the lexer itself does not distinguish `import type`.\n */\nasync function resolveImports(\n imports: ImportSpecifier[],\n source: string,\n filePath: string,\n): Promise<Map<string, ResolvedImport>> {\n const resolvedImports = new Map<string, ResolvedImport>();\n\n for (const imp of imports) {\n const importPath = imp.n;\n\n if (!importPath) {\n continue;\n }\n\n if (isNodeBuiltin(importPath)) {\n continue;\n }\n\n if (!importPath.startsWith(\".\") && !tsconfigManager.isAlias(importPath)) {\n continue;\n }\n\n let resolvedPath: string | null = null;\n\n if (tsconfigManager.isAlias(importPath)) {\n resolvedPath = await resolveAliasImport(importPath);\n } else if (importPath.startsWith(\".\")) {\n resolvedPath = await resolveRelativeImport(importPath, filePath);\n }\n\n if (!resolvedPath) {\n continue;\n }\n\n const isTypeOnly = isLexerStatementTypeOnly(imp, source);\n\n mergeResolvedImport(resolvedImports, importPath, resolvedPath, isTypeOnly);\n }\n\n return resolvedImports;\n}\n\n/**\n * Classify a single lexer-reported statement as type-only or runtime.\n * Dynamic imports (`import(...)`) are always runtime. For static\n * imports/export-from we slice the raw source and apply the same heuristic\n * the regex fallback uses.\n */\nfunction isLexerStatementTypeOnly(imp: ImportSpecifier, source: string): boolean {\n // Dynamic imports always execute — they cannot be type-only.\n // es-module-lexer reports dynamic with a.n === undefined typically, but\n // we guard by checking the statement prefix too.\n const statementStart = imp.ss;\n const statementEnd = imp.se;\n\n if (\n typeof statementStart !== \"number\" ||\n typeof statementEnd !== \"number\" ||\n statementEnd <= statementStart\n ) {\n return false;\n }\n\n const statement = source.slice(statementStart, statementEnd);\n const trimmed = statement.trim();\n\n if (trimmed.startsWith(\"import(\") || /^\\bimport\\s*\\(/.test(trimmed)) {\n return false;\n }\n\n if (trimmed.startsWith(\"export\")) {\n return isExportTypeOnlyStatement(statement);\n }\n\n return !hasRuntimeImports(statement);\n}\n\n/**\n * Resolve alias imports to actual file paths with extensions\n * Example: app/users/services/get-users.service -> /absolute/path/to/src/app/users/services/get-users.service.ts\n */\nasync function resolveAliasImport(importPath: string): Promise<string | null> {\n // Use tsconfig manager to resolve the alias to an absolute path\n const resolvedBase = tsconfigManager.resolveAliasToAbsolute(importPath);\n\n if (!resolvedBase) return null;\n\n // Try to resolve with extensions\n const resolvedPath = await tryResolveWithExtensions(resolvedBase);\n\n return resolvedPath;\n}\n\n/**\n * Resolve relative imports to actual file paths\n * Example: ./../services/get-user.service -> /absolute/path/to/services/get-user.service.ts\n */\nasync function resolveRelativeImport(\n importPath: string,\n currentFilePath: string,\n): Promise<string | null> {\n const dir = path.dirname(currentFilePath);\n // Use path.resolve to handle .. and . properly, then normalize to forward slashes\n const resolvedBase = Path.normalize(path.resolve(dir, importPath));\n\n // Try to resolve with extensions\n const resolvedPath = await tryResolveWithExtensions(resolvedBase);\n\n return resolvedPath;\n}\n\n/**\n * Try to resolve a file path by checking different extensions\n * TypeScript/JavaScript files can be imported without extensions\n *\n * @TODO: For better performance, we need to check the files in files orchestrator\n * instead of using the file system as we will be fetching all project files anyway.\n */\n// Cache for file existence checks to avoid redundant filesystem calls\nconst fileExistsCache = new Map<string, boolean>();\n\n/**\n * Clear the file exists cache\n * Should be called when new files are created to ensure fresh lookups\n */\nexport function clearFileExistsCache(): void {\n fileExistsCache.clear();\n}\n\nasync function cachedFileExists(filePath: string): Promise<boolean> {\n if (fileExistsCache.has(filePath)) {\n return fileExistsCache.get(filePath)!;\n }\n const exists = (await fileExistsAsync(filePath)) as boolean;\n fileExistsCache.set(filePath, exists);\n return exists;\n}\n\nasync function tryResolveWithExtensions(basePath: string): Promise<string | null> {\n // Normalize the base path first (handle Windows paths)\n const normalizedBase = Path.normalize(basePath);\n\n // List of extensions to try, in order of preference\n const extensions = [\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\"];\n const validExtensions = new Set(extensions);\n\n // If the path already has a VALID code file extension, check if it exists\n const ext = path.extname(normalizedBase);\n if (ext && validExtensions.has(ext)) {\n if (await cachedFileExists(normalizedBase)) {\n return normalizedBase;\n }\n // If explicit extension doesn't exist, return null\n return null;\n }\n\n // Try all extensions in parallel for better performance\n const pathsToCheck = extensions.map((extension) => normalizedBase + extension);\n const results = await Promise.all(\n pathsToCheck.map(async (p) => ({ path: p, exists: await cachedFileExists(p) })),\n );\n\n // Return the first one that exists (in order of preference)\n for (const result of results) {\n if (result.exists) {\n return result.path;\n }\n }\n\n // Try index files in directory\n if (await directoryExistsAsync(normalizedBase)) {\n const indexPaths = extensions.map((extension) =>\n Path.join(normalizedBase, `index${extension}`),\n );\n const indexResults = await Promise.all(\n indexPaths.map(async (p) => ({ path: p, exists: await cachedFileExists(p) })),\n );\n\n for (const result of indexResults) {\n if (result.exists) {\n return result.path;\n }\n }\n }\n\n return null;\n}\n\n/**\n * Check if import is a Node.js built-in module\n */\nfunction isNodeBuiltin(importPath: string): boolean {\n const builtins = [\n \"fs\",\n \"path\",\n \"http\",\n \"https\",\n \"crypto\",\n \"stream\",\n \"util\",\n \"events\",\n \"buffer\",\n \"child_process\",\n \"os\",\n \"url\",\n \"querystring\",\n \"zlib\",\n \"net\",\n \"tls\",\n \"dns\",\n \"dgram\",\n \"cluster\",\n \"worker_threads\",\n \"perf_hooks\",\n \"async_hooks\",\n \"timers\",\n \"readline\",\n \"repl\",\n \"vm\",\n \"assert\",\n \"console\",\n \"process\",\n \"v8\",\n ];\n\n // Check for node: prefix or direct builtin name\n if (importPath.startsWith(\"node:\")) return true;\n\n const moduleName = importPath.split(\"/\")[0];\n return builtins.includes(moduleName);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,eAAe,QAAyB;CAOtD,MAAM,iBALkB,OACrB,QAAQ,qBAAqB,EAAE,EAC/B,QAAQ,aAAa,EAGa,EAClC,QAAQ,sBAAsB,IAAI,EAClC,QAAQ,sBAAsB,MAAI,EAClC,QAAQ,sBAAsB,IAAI;CAGrC,MAAM,mBAAmB;EACvB;EACA;EACA;EACA;CACF;CAGA,IAAI,YAAY;CAChB,KAAK,MAAM,WAAW,kBACpB,YAAY,UAA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AM,GAAG,EAAE;CACzC,OAAO,SAAS,SAAS,UAAU;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-config-ast.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"read-config-ast.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/read-config-ast.ts"],"sourcesContent":["/**\n * Parse one config file into an AST.\n *\n * ## Why this is not `ts.createProgram`\n *\n * It was. The typings generator built a whole TypeScript **Program** for each\n * config file just to call `program.getSourceFile(path)` on it. A Warlock\n * config imports `@warlock.js/core`, which in this monorepo resolves to\n * TypeScript **source**, so every one of those Programs resolved and parsed the\n * entire dependency graph behind it.\n *\n * Measured on the reference app's six configs, 2026-08-24:\n *\n * ```\n * ts.createProgram 82,996.00 ms 2,908 source files per program\n * ts.createSourceFile 5.12 ms\n * ratio 16,212x\n * ```\n *\n * And all of it was discarded. `getTypeChecker()` is never called anywhere in\n * the generator — every question it asks of the AST is syntactic\n * (`isImportDeclaration`, `isTypeAliasDeclaration`, `isVariableDeclaration`,\n * `isObjectLiteralExpression`). Resolving 2,908 files to answer a syntactic\n * question is 2,908 files of work thrown away.\n *\n * A previous pass had already noticed the cost and halved it, from two Programs\n * per file to one — an optimisation inside a premise that did not need to hold.\n *\n * **If a future change here needs a type checker, it needs a Program too, and\n * the cost comes back.** That is the one reason to reconsider this file.\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport ts from \"typescript\";\n\nexport async function readConfigAst(filePath: string): Promise<ts.SourceFile | undefined> {\n let contents: string;\n\n try {\n contents = await readFile(filePath, \"utf-8\");\n } catch {\n // Callers already treat a missing config as \"nothing to generate\"; a throw\n // here would turn an absent optional file into a failed generation.\n return undefined;\n }\n\n return ts.createSourceFile(\n filePath,\n contents,\n ts.ScriptTarget.ESNext,\n // The generator's visitors read `node.parent`, which the Program-backed\n // source files provided for free.\n /* setParentNodes */ true,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,cAAc,UAAsD;CACxF,IAAI;CAEJ,IAAI;EACF,WAAW,MAAM,SAAS,UAAU,OAAO;CAC7C,QAAQ;EAGN;CACF;CAEA,OAAO,GAAG,iBACR,UACA,UACA,GAAG,aAAa,QAGK,IACvB;AACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Application } from "../application/application.mjs";
|
|
2
|
+
import "../application/index.mjs";
|
|
3
|
+
import { getHttpReadyReport } from "../http/ready-report.mjs";
|
|
4
|
+
import { connectorsManager } from "../connectors/connectors-manager.mjs";
|
|
5
|
+
import { colors } from "@mongez/copper";
|
|
6
|
+
|
|
7
|
+
//#region core/src/dev-server/ready-block.ts
|
|
8
|
+
/** Collect the facts from the places that own them. Pure read, no printing. */
|
|
9
|
+
function collectReadyBlockFacts(bootDurationMs) {
|
|
10
|
+
return {
|
|
11
|
+
http: getHttpReadyReport(),
|
|
12
|
+
hasWebSurface: connectorsManager.list().some((connector) => connector.name === "web"),
|
|
13
|
+
mode: Application.environment,
|
|
14
|
+
bootDurationMs
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function formatDuration(ms) {
|
|
18
|
+
if (ms < 1e3) return `${ms.toFixed(0)}ms`;
|
|
19
|
+
if (ms > 6e4) return `${(ms / 6e4).toFixed(2)}m`;
|
|
20
|
+
return `${(ms / 1e3).toFixed(2)}s`;
|
|
21
|
+
}
|
|
22
|
+
/** ` ➜ App http://localhost:2042` */
|
|
23
|
+
function urlRow(label, url, note) {
|
|
24
|
+
const suffix = note ? ` ${colors.dim(note)}` : "";
|
|
25
|
+
return ` ${colors.green("➜")} ${colors.bold(label.padEnd(8))}${colors.cyan(url)}${suffix}`;
|
|
26
|
+
}
|
|
27
|
+
/** `Port` `2042`, joined into one dim summary line. */
|
|
28
|
+
function factRow(pairs) {
|
|
29
|
+
return ` ${pairs.map(([key, value]) => `${colors.dim(key)} ${colors.white(value)}`).join(colors.dim(" · "))}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render the block as lines. Separated from printing so a test can assert the
|
|
33
|
+
* exact content without capturing stdout, and so the renderer stays pure.
|
|
34
|
+
*/
|
|
35
|
+
function renderReadyBlock(facts) {
|
|
36
|
+
const lines = [""];
|
|
37
|
+
if (facts.http) {
|
|
38
|
+
const note = facts.http.wildcardBind ? "(all interfaces)" : void 0;
|
|
39
|
+
lines.push(urlRow("App", facts.http.url, note));
|
|
40
|
+
if (facts.hasWebSurface) lines.push(urlRow("Web", facts.http.url));
|
|
41
|
+
if (facts.http.publicUrl) {
|
|
42
|
+
const address = facts.http.publicUrl.replace(/^[^:]*:\s*/, "");
|
|
43
|
+
lines.push(urlRow("Public", address));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const pairs = [];
|
|
47
|
+
if (facts.http) pairs.push(["port", String(facts.http.port)]);
|
|
48
|
+
pairs.push(["mode", facts.mode]);
|
|
49
|
+
if (facts.http) pairs.push(["routes", String(facts.http.routeCount)]);
|
|
50
|
+
if (facts.bootDurationMs !== void 0) pairs.push(["ready in", formatDuration(facts.bootDurationMs)]);
|
|
51
|
+
lines.push(factRow(pairs));
|
|
52
|
+
lines.push("");
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
/** Collect, render, print. The only function the dev server needs. */
|
|
56
|
+
function printReadyBlock(bootDurationMs) {
|
|
57
|
+
for (const line of renderReadyBlock(collectReadyBlockFacts(bootDurationMs))) console.log(line);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { printReadyBlock };
|
|
62
|
+
//# sourceMappingURL=ready-block.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready-block.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/ready-block.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { Application } from \"../application\";\nimport { connectorsManager } from \"../connectors/connectors-manager\";\nimport { getHttpReadyReport, type HttpReadyReport } from \"../http/ready-report\";\n\n/**\n * The one screen `warlock dev` exists to print.\n *\n * ## What was wrong with the lines this replaces\n *\n * Every fact was announced by whichever component discovered it, the moment it\n * discovered it, in that component's own format:\n *\n * ℹ info (21:28:36.095) [http] [routes] 14 route(s) registered\n * ✓ success (21:28:36.118) [http] [connection] Server ready at http://[::1]:2030\n * 21:28:36 ➜ Development Server is ready in 660.72ms\n *\n * The ORDER of that output is the order the work finished in, which is not a\n * fact about the application and changes between runs. There was no single\n * place stating where to point a browser, and the one URL on screen was an IPv6\n * literal most terminals will not linkify. This is a screen a developer reads a\n * hundred times a day.\n *\n * So the facts are collected (`http/ready-report.ts`) and rendered once, here,\n * after boot has actually completed.\n *\n * ## The rule this file must not break\n *\n * **Warnings never move into the block.** They are logged by whoever found them\n * at the moment they were found, which puts them ABOVE this block — visible,\n * out of the summary, and impossible to mistake for decoration. A block that\n * absorbs warnings is a block that hides them, and this file is deliberately\n * incapable of receiving one: nothing in {@link ReadyBlockFacts} can carry a\n * warning.\n *\n * ## Why the URL is not the address that was bound\n *\n * `listen()` returns what it bound (`http://[::1]:2030` for a dual-stack\n * `localhost`). The block shows `http://localhost:2030`, which resolves back to\n * that exact socket. The transform is display-only and lives in\n * `connectors/describe-server-address.ts`; nothing here touches `host`, and the\n * set of interfaces the server accepts on is unchanged.\n */\n\nexport type ReadyBlockFacts = {\n /** The bound HTTP surface, or `undefined` for a process with no HTTP server. */\n http?: HttpReadyReport;\n /** Whether a web/SSR surface (the `web` connector) serves on the same origin. */\n hasWebSurface: boolean;\n /** `development` / `production` / `test`. */\n mode: string;\n /** How long the boot took, when the caller measured it. */\n bootDurationMs?: number;\n};\n\n/** Collect the facts from the places that own them. Pure read, no printing. */\nexport function collectReadyBlockFacts(bootDurationMs?: number): ReadyBlockFacts {\n return {\n http: getHttpReadyReport(),\n // The web connector serves pages on the SAME origin as the API — one port\n // serves everything in v5 — so its presence is what makes the \"Web\" row\n // true, not a second address. Showing the row unconditionally would tell an\n // API-only app it has a page surface it does not have.\n hasWebSurface: connectorsManager.list().some((connector) => connector.name === \"web\"),\n mode: Application.environment,\n bootDurationMs,\n };\n}\n\nfunction formatDuration(ms: number): string {\n if (ms < 1000) return `${ms.toFixed(0)}ms`;\n if (ms > 60_000) return `${(ms / 60_000).toFixed(2)}m`;\n\n return `${(ms / 1000).toFixed(2)}s`;\n}\n\n/** ` ➜ App http://localhost:2042` */\nfunction urlRow(label: string, url: string, note?: string): string {\n const suffix = note ? ` ${colors.dim(note)}` : \"\";\n\n return ` ${colors.green(\"➜\")} ${colors.bold(label.padEnd(8))}${colors.cyan(url)}${suffix}`;\n}\n\n/** `Port` `2042`, joined into one dim summary line. */\nfunction factRow(pairs: [string, string][]): string {\n const rendered = pairs.map(([key, value]) => `${colors.dim(key)} ${colors.white(value)}`);\n\n return ` ${rendered.join(colors.dim(\" · \"))}`;\n}\n\n/**\n * Render the block as lines. Separated from printing so a test can assert the\n * exact content without capturing stdout, and so the renderer stays pure.\n */\nexport function renderReadyBlock(facts: ReadyBlockFacts): string[] {\n const lines: string[] = [\"\"];\n\n if (facts.http) {\n // A wildcard bind reaches more than loopback. `localhost` is still correct\n // and still reaches it, but the reader is told the bind is wider rather\n // than left to infer it from a URL that no longer says so.\n const note = facts.http.wildcardBind ? \"(all interfaces)\" : undefined;\n\n lines.push(urlRow(\"App\", facts.http.url, note));\n\n if (facts.hasWebSurface) {\n // Same origin, deliberately: pages and API share one port. Repeating the\n // URL is not redundancy here — it answers \"where do I open the site?\"\n // without the reader having to know that.\n lines.push(urlRow(\"Web\", facts.http.url));\n }\n\n if (facts.http.publicUrl) {\n // `publicUrl` arrives pre-labelled from `describeServerAddress`; the block\n // supplies its own label, so strip the prose and keep the address.\n const address = facts.http.publicUrl.replace(/^[^:]*:\\s*/, \"\");\n lines.push(urlRow(\"Public\", address));\n }\n }\n\n const pairs: [string, string][] = [];\n\n if (facts.http) {\n pairs.push([\"port\", String(facts.http.port)]);\n }\n\n pairs.push([\"mode\", facts.mode]);\n\n if (facts.http) {\n pairs.push([\"routes\", String(facts.http.routeCount)]);\n }\n\n if (facts.bootDurationMs !== undefined) {\n pairs.push([\"ready in\", formatDuration(facts.bootDurationMs)]);\n }\n\n lines.push(factRow(pairs));\n lines.push(\"\");\n\n return lines;\n}\n\n/** Collect, render, print. The only function the dev server needs. */\nexport function printReadyBlock(bootDurationMs?: number): void {\n for (const line of renderReadyBlock(collectReadyBlockFacts(bootDurationMs))) {\n console.log(line);\n }\n}\n"],"mappings":";;;;;;;;AAwDA,SAAgB,uBAAuB,gBAA0C;CAC/E,OAAO;EACL,MAAM,mBAAmB;EAKzB,eAAe,kBAAkB,KAAK,EAAE,MAAM,cAAc,UAAU,SAAS,KAAK;EACpF,MAAM,YAAY;EAClB;CACF;AACF;AAEA,SAAS,eAAe,IAAoB;CAC1C,IAAI,KAAK,KAAM,OAAO,GAAG,GAAG,QAAQ,CAAC,EAAE;CACvC,IAAI,KAAK,KAAQ,OAAO,IAAI,KAAK,KAAQ,QAAQ,CAAC,EAAE;CAEpD,OAAO,IAAI,KAAK,KAAM,QAAQ,CAAC,EAAE;AACnC;;AAGA,SAAS,OAAO,OAAe,KAAa,MAAuB;CACjE,MAAM,SAAS,OAAO,IAAI,OAAO,IAAI,IAAI,MAAM;CAE/C,OAAO,KAAK,OAAO,MAAM,GAAG,EAAE,IAAI,OAAO,KAAK,MAAM,OAAO,CAAC,CAAC,IAAI,OAAO,KAAK,GAAG,IAAI;AACtF;;AAGA,SAAS,QAAQ,OAAmC;CAGlD,OAAO,QAFU,MAAM,KAAK,CAAC,KAAK,WAAW,GAAG,OAAO,IAAI,GAAG,EAAE,GAAG,OAAO,MAAM,KAAK,GAE/D,EAAE,KAAK,OAAO,IAAI,OAAO,CAAC;AAClD;;;;;AAMA,SAAgB,iBAAiB,OAAkC;CACjE,MAAM,QAAkB,CAAC,EAAE;CAE3B,IAAI,MAAM,MAAM;EAId,MAAM,OAAO,MAAM,KAAK,eAAe,qBAAqB;EAE5D,MAAM,KAAK,OAAO,OAAO,MAAM,KAAK,KAAK,IAAI,CAAC;EAE9C,IAAI,MAAM,eAIR,MAAM,KAAK,OAAO,OAAO,MAAM,KAAK,GAAG,CAAC;EAG1C,IAAI,MAAM,KAAK,WAAW;GAGxB,MAAM,UAAU,MAAM,KAAK,UAAU,QAAQ,cAAc,EAAE;GAC7D,MAAM,KAAK,OAAO,UAAU,OAAO,CAAC;EACtC;CACF;CAEA,MAAM,QAA4B,CAAC;CAEnC,IAAI,MAAM,MACR,MAAM,KAAK,CAAC,QAAQ,OAAO,MAAM,KAAK,IAAI,CAAC,CAAC;CAG9C,MAAM,KAAK,CAAC,QAAQ,MAAM,IAAI,CAAC;CAE/B,IAAI,MAAM,MACR,MAAM,KAAK,CAAC,UAAU,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC;CAGtD,IAAI,MAAM,mBAAmB,QAC3B,MAAM,KAAK,CAAC,YAAY,eAAe,MAAM,cAAc,CAAC,CAAC;CAG/D,MAAM,KAAK,QAAQ,KAAK,CAAC;CACzB,MAAM,KAAK,EAAE;CAEb,OAAO;AACT;;AAGA,SAAgB,gBAAgB,gBAA+B;CAC7D,KAAK,MAAM,QAAQ,iBAAiB,uBAAuB,cAAc,CAAC,GACxE,QAAQ,IAAI,IAAI;AAEpB"}
|
|
@@ -3,7 +3,7 @@ import { restartDevServer } from "./restart-dev-server.mjs";
|
|
|
3
3
|
import { devServerShortcuts } from "./shortcuts.mjs";
|
|
4
4
|
import { colors } from "@mongez/copper";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region core/src/dev-server/register-dev-shortcuts.ts
|
|
7
7
|
/**
|
|
8
8
|
* Arm the dev server's standing keyboard shortcuts and print the one-line
|
|
9
9
|
* hint that tells the developer they exist.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-dev-shortcuts.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"register-dev-shortcuts.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/register-dev-shortcuts.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { devLogError } from \"./dev-logger\";\nimport type { DevelopmentServer } from \"./development-server\";\nimport { restartDevServer } from \"./restart-dev-server\";\nimport { devServerShortcuts } from \"./shortcuts\";\n\n/**\n * Arm the dev server's standing keyboard shortcuts and print the one-line\n * hint that tells the developer they exist.\n *\n * These stay available for the whole session. The update shortcut (`u`) is\n * deliberately not here — it is armed by the update notice only when there is\n * something to update, and dropped again once it has been used.\n *\n * Entirely TTY-gated: with piped stdin (CI, a supervisor, `warlock dev | tee`)\n * nothing is registered, no hint is printed, and stdin is never touched.\n */\nexport function registerDevShortcuts(devServer: DevelopmentServer): void {\n if (!devServerShortcuts.isSupported()) {\n return;\n }\n\n devServerShortcuts.register({\n key: \"r\",\n description: \"restart the server\",\n handler: () => restart(devServer),\n });\n\n devServerShortcuts.register({\n key: \"c\",\n description: \"clear the console\",\n handler: () => console.clear(),\n });\n\n devServerShortcuts.register({\n key: \"q\",\n description: \"quit\",\n handler: () => quit(devServer),\n });\n\n devServerShortcuts.register({\n key: \"h\",\n description: \"show this help\",\n handler: printShortcuts,\n });\n\n console.log(\n ` ${colors.dim(\"press\")} ${colors.bold(colors.cyan(\"h\"))} ` +\n `${colors.dim(\"for shortcuts\")}`,\n );\n}\n\n/** `r` — bring the server back up on a clean process. */\nasync function restart(devServer: DevelopmentServer): Promise<void> {\n const restarted = await restartDevServer(devServer);\n\n if (!restarted) {\n devServerShortcuts.resume();\n devLogError(\"Restart failed — start the dev server again manually.\");\n }\n}\n\n/** `q` — the same graceful shutdown Ctrl+C performs. */\nasync function quit(devServer: DevelopmentServer): Promise<void> {\n try {\n await devServer.shutdown();\n process.exit(0);\n } catch (error) {\n devLogError(`Shutdown failed: ${(error as Error).message}`);\n process.exit(1);\n }\n}\n\n/** `h` — list whatever is armed right now, `u` included when it is. */\nfunction printShortcuts(): void {\n console.log();\n console.log(` ${colors.bold(\"Shortcuts\")}`);\n\n for (const shortcut of devServerShortcuts.list()) {\n console.log(\n ` ${colors.bold(colors.cyan(shortcut.key))} ${colors.dim(shortcut.description)}`,\n );\n }\n\n console.log(` ${colors.bold(colors.cyan(\"Ctrl+C\"))} ${colors.dim(\"quit\")}`);\n console.log();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,SAAgB,qBAAqB,WAAoC;CACvE,IAAI,CAAC,mBAAmB,YAAY,GAClC;CAGF,mBAAmB,SAAS;EAC1B,KAAK;EACL,aAAa;EACb,eAAe,QAAQ,SAAS;CAClC,CAAC;CAED,mBAAmB,SAAS;EAC1B,KAAK;EACL,aAAa;EACb,eAAe,QAAQ,MAAM;CAC/B,CAAC;CAED,mBAAmB,SAAS;EAC1B,KAAK;EACL,aAAa;EACb,eAAe,KAAK,SAAS;CAC/B,CAAC;CAED,mBAAmB,SAAS;EAC1B,KAAK;EACL,aAAa;EACb,SAAS;CACX,CAAC;CAED,QAAQ,IACN,MAAM,OAAO,IAAI,OAAO,EAAE,GAAG,OAAO,KAAK,OAAO,KAAK,GAAG,CAAC,EAAE,GACtD,OAAO,IAAI,eAAe,GACjC;AACF;;AAGA,eAAe,QAAQ,WAA6C;CAGlE,IAAI,CAAC,MAFmB,iBAAiB,SAAS,GAElC;EACd,mBAAmB,OAAO;EAC1B,YAAY,uDAAuD;CACrE;AACF;;AAGA,eAAe,KAAK,WAA6C;CAC/D,IAAI;EACF,MAAM,UAAU,SAAS;EACzB,QAAQ,KAAK,CAAC;CAChB,SAAS,OAAO;EACd,YAAY,oBAAqB,MAAgB,SAAS;EAC1D,QAAQ,KAAK,CAAC;CAChB;AACF;;AAGA,SAAS,iBAAuB;CAC9B,QAAQ,IAAI;CACZ,QAAQ,IAAI,KAAK,OAAO,KAAK,WAAW,GAAG;CAE3C,KAAK,MAAM,YAAY,mBAAmB,KAAK,GAC7C,QAAQ,IACN,QAAQ,OAAO,KAAK,OAAO,KAAK,SAAS,GAAG,CAAC,EAAE,IAAI,OAAO,IAAI,SAAS,WAAW,GACpF;CAGF,QAAQ,IAAI,QAAQ,OAAO,KAAK,OAAO,KAAK,QAAQ,CAAC,EAAE,IAAI,OAAO,IAAI,MAAM,GAAG;CAC/E,QAAQ,IAAI;AACd"}
|
|
@@ -2,7 +2,7 @@ import { devLogError, devServeLog } from "./dev-logger.mjs";
|
|
|
2
2
|
import { isDevWorker } from "./supervisor.mjs";
|
|
3
3
|
import { colors } from "@mongez/copper";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region core/src/dev-server/restart-dev-server.ts
|
|
6
6
|
/**
|
|
7
7
|
* Restart `warlock dev`.
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart-dev-server.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"restart-dev-server.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/restart-dev-server.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { devLogError, devServeLog } from \"./dev-logger\";\nimport type { DevelopmentServer } from \"./development-server\";\nimport { isDevWorker, RESTART_EXIT_CODE } from \"./supervisor\";\n\n/**\n * Restart `warlock dev`.\n *\n * There is no way to un-load an ES module graph, so a restart is a fresh\n * process. This one doesn't create it: the supervisor that launched us does.\n * We shut down cleanly — which frees the http port before the replacement\n * binds it — and exit with {@link RESTART_EXIT_CODE}, which the supervisor\n * reads as \"spawn me again\".\n *\n * Never returns on the happy path. Returns `false` when a restart isn't\n * possible — no supervisor (a programmatic `startDevelopmentServer` call), or\n * a shutdown that failed — so the caller can carry on with the server it has.\n */\nexport async function restartDevServer(devServer: DevelopmentServer): Promise<boolean> {\n if (!isDevWorker()) {\n devLogError(\"Restart is unavailable — this server was not started by `warlock dev`.\");\n return false;\n }\n\n devServeLog(colors.cyanBright(\"Restarting the development server…\"));\n\n try {\n await devServer.shutdown();\n } catch (error) {\n devLogError(`Shutdown before restart failed: ${(error as Error).message}`);\n return false;\n }\n\n process.exit(RESTART_EXIT_CODE);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,eAAsB,iBAAiB,WAAgD;CACrF,IAAI,CAAC,YAAY,GAAG;EAClB,YAAY,wEAAwE;EACpF,OAAO;CACT;CAEA,YAAY,OAAO,WAAW,oCAAoC,CAAC;CAEnE,IAAI;EACF,MAAM,UAAU,SAAS;CAC3B,SAAS,OAAO;EACd,YAAY,mCAAoC,MAAgB,SAAS;EACzE,OAAO;CACT;CAEA,QAAQ,OAAsB;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-typings-generation.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"run-typings-generation.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/run-typings-generation.ts"],"sourcesContent":["/**\n * Run type generation, in this process.\n *\n * ## Why this is not a spawn\n *\n * It used to be. `type-generator.ts` ran `npx warlock generate.typings`, which\n * resolves to `core/bin/warlock.js` → `import \"../esm/cli/start.mjs\"`. This\n * monorepo consumes packages as TypeScript **source**, so there is no `esm/`\n * directory: every dev boot printed `✗ Failed to generate types`, and an\n * `ERR_MODULE_NOT_FOUND` stack rode along inside an otherwise green core suite.\n *\n * Spawning was the mistake underneath the broken path. The CLI command it\n * launched does two things — add the config files to the orchestrator, then\n * call `typeGenerator.generateAll()` — and the dev server has **already**\n * initialised that orchestrator with those files at boot. So it paid for a\n * second Node process to rediscover state it was holding, in order to call a\n * method that lives in the same module it was calling from.\n *\n * Launching a binary through `npx` is separately prohibited in this workspace:\n * resolve and invoke directly.\n *\n * ## Why a failure here is not fatal\n *\n * Generated typings are editor autocomplete. A dev server that refused to boot\n * because it could not write them would be a worse defect than the one this\n * replaces, so this never throws — but it does say **why**, which the old\n * `Failed to generate types` did not. A failure message that names no cause\n * sends the reader hunting, which is most of what the old line achieved.\n */\n\nexport type TypingsGenerationPorts = {\n /** `typeGenerator.generateAll()` in production; a fake in tests. */\n generate(): Promise<void>;\n info(message: string): void;\n success(message: string): void;\n error(message: string): void;\n};\n\nfunction describeCause(thrown: unknown): string {\n if (thrown instanceof Error) return thrown.message;\n\n return String(thrown);\n}\n\nexport async function runTypingsGeneration(ports: TypingsGenerationPorts): Promise<void> {\n ports.info(\"Checking for types generation\");\n\n try {\n await ports.generate();\n\n ports.success(\"Types generated successfully\");\n } catch (thrown) {\n ports.error(`Failed to generate types: ${describeCause(thrown)}`);\n }\n}\n"],"mappings":";AAsCA,SAAS,cAAc,QAAyB;CAC9C,IAAI,kBAAkB,OAAO,OAAO,OAAO;CAE3C,OAAO,OAAO,MAAM;AACtB;AAEA,eAAsB,qBAAqB,OAA8C;CACvF,MAAM,KAAK,+BAA+B;CAE1C,IAAI;EACF,MAAM,MAAM,SAAS;EAErB,MAAM,QAAQ,8BAA8B;CAC9C,SAAS,QAAQ;EACf,MAAM,MAAM,6BAA6B,cAAc,MAAM,GAAG;CAClE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcuts.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"shortcuts.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/shortcuts.ts"],"sourcesContent":["import readline from \"node:readline\";\n\n/**\n * A single-keypress shortcut offered by the dev server while it runs.\n */\nexport type DevServerShortcut = {\n /** The key that triggers it, e.g. `\"u\"`. Matched case-insensitively. */\n key: string;\n /** Short human label, used when we print the available shortcuts. */\n description: string;\n /** What to run when the key is pressed. Rejections are swallowed. */\n handler: () => void | Promise<void>;\n};\n\n/**\n * Single-keypress shortcuts for the dev server (`press u to update`, …).\n *\n * Reading one key at a time requires putting stdin into raw mode, which\n * means this process — not the terminal driver — becomes responsible for\n * `Ctrl+C`. The manager therefore re-raises `SIGINT` itself so the existing\n * graceful-shutdown handlers keep working exactly as before.\n *\n * Everything is opt-in and self-guarding: with no TTY (piped output, CI,\n * a supervisor) `register()` reports `false` and stdin is never touched, so\n * callers can fall back to printing a plain \"run `npx warlock update`\" hint.\n */\nexport class DevServerShortcuts {\n private readonly shortcuts = new Map<string, DevServerShortcut>();\n\n /** Whether we currently hold stdin in raw mode. */\n private listening = false;\n\n /** Set while a handler runs, so a second keypress can't re-enter it. */\n private busy = false;\n\n private keypressListener?: (character: string, key: KeypressEvent) => void;\n\n /**\n * @param input The stream to read keys from. Defaults to the process's\n * own stdin; tests pass a fake TTY instead.\n * @param onInterrupt What `Ctrl+C` does once raw mode has taken it away from\n * the terminal driver. Defaults to re-raising `SIGINT`.\n */\n public constructor(\n private readonly input: NodeJS.ReadStream = process.stdin,\n private readonly onInterrupt: () => void = raiseInterrupt,\n ) {}\n\n /**\n * Whether the current terminal can deliver individual keypresses. False in\n * CI, when stdin is a pipe, and in any non-interactive shell.\n */\n public isSupported(): boolean {\n return Boolean(this.input.isTTY && typeof this.input.setRawMode === \"function\");\n }\n\n /**\n * Offer a shortcut. Returns whether it was actually registered — `false`\n * means the terminal can't support keypresses and the caller should print\n * a copy-and-paste command instead.\n */\n public register(shortcut: DevServerShortcut): boolean {\n if (!this.isSupported()) {\n return false;\n }\n\n this.shortcuts.set(shortcut.key.toLowerCase(), shortcut);\n this.listen();\n\n return true;\n }\n\n /** Every armed shortcut, in the order it was registered. */\n public list(): DevServerShortcut[] {\n return [...this.shortcuts.values()];\n }\n\n /** Drop a shortcut, releasing the terminal once none are left. */\n public unregister(key: string): void {\n this.shortcuts.delete(key.toLowerCase());\n\n if (this.shortcuts.size === 0) {\n this.release();\n }\n }\n\n /**\n * Hand the terminal back: leave raw mode and stop listening. Call this\n * before spawning a child process that needs stdin (the package manager\n * install), and on shutdown. Registered shortcuts are kept, so `register()`\n * (or `resume()`) can take the terminal again afterwards.\n */\n public release(): void {\n if (!this.listening) {\n return;\n }\n\n this.listening = false;\n\n if (this.keypressListener) {\n this.input.off(\"keypress\", this.keypressListener);\n this.keypressListener = undefined;\n }\n\n if (this.input.isTTY) {\n this.input.setRawMode(false);\n }\n\n this.input.pause();\n }\n\n /** Re-take the terminal after a {@link release}, if shortcuts remain. */\n public resume(): void {\n if (this.shortcuts.size > 0) {\n this.listen();\n }\n }\n\n /** Start (or keep) listening for keypresses. */\n private listen(): void {\n if (this.listening || !this.isSupported()) {\n return;\n }\n\n this.listening = true;\n\n readline.emitKeypressEvents(this.input);\n this.input.setRawMode(true);\n this.input.resume();\n\n this.keypressListener = (_character, key) => {\n void this.handleKeypress(key);\n };\n\n this.input.on(\"keypress\", this.keypressListener);\n }\n\n /**\n * Route a keypress to its shortcut. In raw mode the terminal no longer\n * turns `Ctrl+C` into a signal for us, so we translate it back into a\n * `SIGINT` and let the dev server's shutdown handlers take it from there.\n */\n private async handleKeypress(key: KeypressEvent | undefined): Promise<void> {\n if (!key) {\n return;\n }\n\n if (key.ctrl && (key.name === \"c\" || key.name === \"d\")) {\n this.release();\n this.onInterrupt();\n return;\n }\n\n if (this.busy) {\n return;\n }\n\n const shortcut = key.name ? this.shortcuts.get(key.name.toLowerCase()) : undefined;\n\n if (!shortcut) {\n return;\n }\n\n this.busy = true;\n\n try {\n await shortcut.handler();\n } catch {\n // A shortcut is a convenience — never let it take the dev server down.\n } finally {\n this.busy = false;\n }\n }\n}\n\n/** Re-raise the interrupt the terminal would have sent outside raw mode. */\nfunction raiseInterrupt(): void {\n process.kill(process.pid, \"SIGINT\");\n}\n\n/** The keypress shape emitted by `readline.emitKeypressEvents`. */\ntype KeypressEvent = {\n name?: string;\n ctrl?: boolean;\n meta?: boolean;\n shift?: boolean;\n};\n\n/** Process-wide shortcuts for the running dev server. */\nexport const devServerShortcuts = new DevServerShortcuts();\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,IAAa,qBAAb,MAAgC;;;;;;;CAiB9B,AAAO,YACL,AAAiB,QAA2B,QAAQ,OACpD,AAAiB,cAA0B,gBAC3C;EAFiB;EACA;mCAlBU,IAAI,IAA+B;mBAG5C;cAGL;CAaZ;;;;;CAMH,AAAO,cAAuB;EAC5B,OAAO,QAAQ,KAAK,MAAM,SAAS,OAAO,KAAK,MAAM,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AAK,UAAU,IAAI,IAAI,KAAK,YAAY,CAAC,IAAI;EAEzE,IAAI,CAAC,UACH;EAGF,KAAK,OAAO;EAEZ,IAAI;GACF,MAAM,SAAS,QAAQ;EACzB,QAAQ,CAER,UAAU;GACR,KAAK,OAAO;EACd;CACF;AACF;;AAGA,SAAS,iBAAuB;CAC9B,QAAQ,KAAK,QAAQ,KAAK,QAAQ;AACpC;;AAWA,MAAa,qBAAqB,IAAI,mBAAmB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileManager } from "./file-manager.mjs";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region core/src/dev-server/special-files-collector.d.ts
|
|
4
4
|
type SpecialFileType = "config" | "main" | "route" | "event" | "locale";
|
|
5
5
|
/**
|
|
6
6
|
* Categorises files into the kinds the dev server treats specially
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"special-files-collector.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"special-files-collector.d.mts","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/special-files-collector.ts"],"mappings":";;;KAEY,eAAA;;AAAZ;;;cAMa,qBAAA;EAAA,iBACM,OAAA;EAQV,OAAA,CAAQ,KAAA,EAAO,GAAA,SAAY,WAAA;EAO3B,OAAA,CAAQ,WAAA,EAAa,WAAA;EAIrB,UAAA,CAAW,YAAA;EAIX,UAAA,CAAW,WAAA,EAAa,WAAA;EAKxB,WAAA,CAAY,YAAA,WAAuB,eAAA;EAUnC,cAAA,CAAe,IAAA,EAAM,eAAA,GAAkB,WAAA;EAUvC,QAAA,CAAA,GAAY,MAAA,CAAO,eAAA;EAUnB,KAAA,CAAA;EAAA,QAIC,UAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"special-files-collector.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"special-files-collector.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/special-files-collector.ts"],"sourcesContent":["import { FileManager } from \"./file-manager\";\r\n\r\nexport type SpecialFileType = \"config\" | \"main\" | \"route\" | \"event\" | \"locale\";\r\n\r\n/**\r\n * Categorises files into the kinds the dev server treats specially\r\n * (config / main / route / event / locale) and exposes typed accessors.\r\n */\r\nexport class SpecialFilesCollector {\r\n private readonly buckets: Record<SpecialFileType, Map<string, FileManager>> = {\r\n config: new Map(),\r\n main: new Map(),\r\n route: new Map(),\r\n event: new Map(),\r\n locale: new Map(),\r\n };\r\n\r\n public collect(files: Map<string, FileManager>): void {\r\n for (const bucket of Object.values(this.buckets)) bucket.clear();\r\n for (const [relativePath, fileManager] of files) {\r\n this.categorise(relativePath, fileManager);\r\n }\r\n }\r\n\r\n public addFile(fileManager: FileManager): void {\r\n this.categorise(fileManager.relativePath, fileManager);\r\n }\r\n\r\n public removeFile(relativePath: string): void {\r\n for (const bucket of Object.values(this.buckets)) bucket.delete(relativePath);\r\n }\r\n\r\n public updateFile(fileManager: FileManager): void {\r\n this.removeFile(fileManager.relativePath);\r\n this.categorise(fileManager.relativePath, fileManager);\r\n }\r\n\r\n public getFileType(relativePath: string): SpecialFileType | null {\r\n for (const [type, bucket] of Object.entries(this.buckets) as [\r\n SpecialFileType,\r\n Map<string, FileManager>,\r\n ][]) {\r\n if (bucket.has(relativePath)) return type;\r\n }\r\n return null;\r\n }\r\n\r\n public getFilesByType(type: SpecialFileType): FileManager[] {\r\n const files = Array.from(this.buckets[type].values());\r\n // Routes are loaded sequentially in alphabetical order so registration\r\n // is deterministic across runs.\r\n if (type === \"route\") {\r\n files.sort((a, b) => a.relativePath.localeCompare(b.relativePath));\r\n }\r\n return files;\r\n }\r\n\r\n public getStats(): Record<SpecialFileType, number> {\r\n return {\r\n config: this.buckets.config.size,\r\n main: this.buckets.main.size,\r\n route: this.buckets.route.size,\r\n event: this.buckets.event.size,\r\n locale: this.buckets.locale.size,\r\n };\r\n }\r\n\r\n public clear(): void {\r\n for (const bucket of Object.values(this.buckets)) bucket.clear();\r\n }\r\n\r\n private categorise(relativePath: string, fileManager: FileManager): void {\r\n if (isConfigFile(relativePath)) {\r\n this.buckets.config.set(relativePath, fileManager);\r\n } else if (isMainFile(relativePath)) {\r\n this.buckets.main.set(relativePath, fileManager);\r\n } else if (isRouteFile(relativePath)) {\r\n this.buckets.route.set(relativePath, fileManager);\r\n } else if (isEventFile(relativePath)) {\r\n this.buckets.event.set(relativePath, fileManager);\r\n } else if (isLocaleFile(relativePath)) {\r\n this.buckets.locale.set(relativePath, fileManager);\r\n }\r\n }\r\n}\r\n\r\nconst isConfigFile = (path: string) => /^src\\/config\\/.*\\.(ts|tsx)$/.test(path);\r\nconst isMainFile = (path: string) =>\r\n /^src\\/app\\/[^/]+\\/main\\.(ts|tsx)$/.test(path) ||\r\n path === \"src/app/main.ts\" ||\r\n path === \"src/app/main.tsx\";\r\nconst isRouteFile = (path: string) => /^src\\/app\\/[^/]+\\/routes\\.(ts|tsx)$/.test(path);\r\nconst isEventFile = (path: string) => /^src\\/app\\/[^/]+\\/events\\/[^/]+\\.(ts|tsx)$/.test(path);\r\nconst isLocaleFile = (path: string) => /^src\\/app\\/[^/]+\\/utils\\/locales\\.(ts|tsx)$/.test(path);\r\n"],"mappings":";;;;;AAQA,IAAa,wBAAb,MAAmC;;iBAC6C;GAC5E,wBAAQ,IAAI,IAAI;GAChB,sBAAM,IAAI,IAAI;GACd,uBAAO,IAAI,IAAI;GACf,uBAAO,IAAI,IAAI;GACf,wBAAQ,IAAI,IAAI;EAClB;;CAEA,AAAO,QAAQ,OAAuC;EACpD,KAAK,MAAM,UAAU,OAAO,OAAO,KAAK,OAAO,GAAG,OAAO,MAAM;EAC/D,KAAK,MAAM,CAAC,cAAc,gBAAgB,OACxC,KAAK,WAAW,cAAc,WAAW;CAE7C;CAEA,AAAO,QAAQ,aAAgC;EAC7C,KAAK,WAAW,YAAY,cAAc,WAAW;CACvD;CAEA,AAAO,WAAW,cAA4B;EAC5C,KAAK,MAAM,UAAU,OAAO,OAAO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AClB,oCAAoC,KAAK,IAAI,KAC7C,SAAS,qBACT,SAAS;AACX,MAAM,eAAe,SAAiB,sCAAsC,KAAK,IAAI;AACrF,MAAM,eAAe,SAAiB,6CAA6C,KAAK,IAAI;AAC5F,MAAM,gBAAgB,SAAiB,8CAA8C,KAAK,IAAI"}
|
|
@@ -3,7 +3,7 @@ import { DevelopmentServer } from "./development-server.mjs";
|
|
|
3
3
|
import { registerDevShortcuts } from "./register-dev-shortcuts.mjs";
|
|
4
4
|
import { colors } from "@mongez/copper";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region core/src/dev-server/start-development-server.ts
|
|
7
7
|
let handlersRegistered = false;
|
|
8
8
|
/**
|
|
9
9
|
* Start the development server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-development-server.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"start-development-server.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/start-development-server.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { devLogError, devServeLog } from \"./dev-logger\";\nimport { DevelopmentServer } from \"./development-server\";\nimport { registerDevShortcuts } from \"./register-dev-shortcuts\";\n\nlet handlersRegistered = false;\n\n/**\n * Options accepted by `startDevelopmentServer`. CLI flags translate to\n * these; programmatic callers (tests, scripts) can pass them directly.\n *\n * `undefined` for any field means \"fall through to `warlock.config.ts >\n * devServer.*` defaults.\" Pass an explicit value only to override.\n */\nexport type StartDevServerOptions = {\n /**\n * Delete `.warlock/manifest.json` before starting — forces every file\n * to be re-parsed from disk instead of restored from the cached graph.\n */\n fresh?: boolean;\n /** Run background type generation. Default from devServer config (true). */\n generateTypings?: boolean;\n /** Run file health checkers. Default from devServer config (true). */\n healthCheckers?: boolean;\n};\n\n/**\n * Start the development server.\n *\n * Boots the file orchestrator, loads app modules, starts late-phase\n * connectors, then wires graceful shutdown for SIGINT/SIGTERM (plus\n * SIGHUP on Windows where Ctrl+C in spawned children lands as SIGHUP).\n *\n * If startup throws, shuts down cleanly and exits 1 — dev should die\n * loudly rather than hang with a half-initialized state.\n */\nexport async function startDevelopmentServer(\n options: StartDevServerOptions = {},\n): Promise<DevelopmentServer> {\n // V8 honours inline source maps embedded by the transpile cache (and\n // tsx's own maps in passthrough mode), so thrown-error stack frames point\n // at the original `src/**.ts` line/column instead of transpiled output.\n process.setSourceMapsEnabled(true);\n\n const devServer = new DevelopmentServer(options);\n\n registerShutdownHandlers(devServer);\n\n try {\n await devServer.start();\n } catch (error) {\n devLogError(`Failed to start Development Server: ${(error as Error).message}`);\n await safeShutdown(devServer);\n process.exit(1);\n }\n\n // Only once the server is actually up — a half-started process has nothing\n // worth restarting, and taking raw mode before then would swallow the\n // Ctrl+C of a developer trying to escape a slow boot.\n registerDevShortcuts(devServer);\n\n return devServer;\n}\n\n/**\n * Register signal handlers once per process. Guards against handler\n * accumulation if `startDevelopmentServer` is invoked more than once\n * (tests, programmatic restart).\n */\nfunction registerShutdownHandlers(devServer: DevelopmentServer): void {\n if (handlersRegistered) return;\n handlersRegistered = true;\n\n const onSignal = (signal: NodeJS.Signals) => async () => {\n devServeLog(colors.yellow(`📡 Received ${signal}`));\n const ok = await safeShutdown(devServer);\n process.exit(ok ? 0 : 1);\n };\n\n process.on(\"SIGINT\", onSignal(\"SIGINT\"));\n process.on(\"SIGTERM\", onSignal(\"SIGTERM\"));\n // Ctrl+C in spawned Windows children lands as SIGHUP, not SIGINT.\n if (process.platform === \"win32\") {\n process.on(\"SIGHUP\", onSignal(\"SIGHUP\"));\n }\n}\n\n/**\n * Shut down the dev server without swallowing async errors. Returns\n * whether shutdown completed cleanly so the caller picks the exit code.\n */\nasync function safeShutdown(devServer: DevelopmentServer): Promise<boolean> {\n try {\n await devServer.shutdown();\n return true;\n } catch (error) {\n devLogError(`Shutdown failed: ${(error as Error).message}`);\n return false;\n }\n}\n"],"mappings":";;;;;;AAKA,IAAI,qBAAqB;;;;;;;;;;;AA+BzB,eAAsB,uBACpB,UAAiC,CAAC,GACN;CAI5B,QAAQ,qBAAqB,IAAI;CAEjC,MAAM,YAAY,IAAI,kBAAkB,OAAO;CAE/C,yBAAyB,SAAS;CAElC,IAAI;EACF,MAAM,UAAU,MAAM;CACxB,SAAS,OAAO;EACd,YAAY,uCAAwC,MAAgB,SAAS;EAC7E,MAAM,aAAa,SAAS;EAC5B,QAAQ,KAAK,CAAC;CAChB;CAKA,qBAAqB,SAAS;CAE9B,OAAO;AACT;;;;;;AAOA,SAAS,yBAAyB,WAAoC;CACpE,IAAI,oBAAoB;CACxB,qBAAqB;CAErB,MAAM,YAAY,WAA2B,YAAY;EACvD,YAAY,OAAO,OAAO,eAAe,QAAQ,CAAC;EAClD,MAAM,KAAK,MAAM,aAAa,SAAS;EACvC,QAAQ,KAAK,KAAK,IAAI,CAAC;CACzB;CAEA,QAAQ,GAAG,UAAU,SAAS,QAAQ,CAAC;CACvC,QAAQ,GAAG,WAAW,SAAS,SAAS,CAAC;CAEzC,IAAI,QAAQ,aAAa,SACvB,QAAQ,GAAG,UAAU,SAAS,QAAQ,CAAC;AAE3C;;;;;AAMA,eAAe,aAAa,WAAgD;CAC1E,IAAI;EACF,MAAM,UAAU,SAAS;EACzB,OAAO;CACT,SAAS,OAAO;EACd,YAAY,oBAAqB,MAAgB,SAAS;EAC1D,OAAO;CACT;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { devLogError, devLogWarn } from "./dev-logger.mjs";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region core/src/dev-server/supervisor.ts
|
|
5
5
|
/**
|
|
6
6
|
* Set on the worker process so it knows it was launched by a supervisor —
|
|
7
7
|
* and so `warlock dev` inside the worker runs the server instead of
|
|
@@ -51,12 +51,11 @@ function isDevWorker() {
|
|
|
51
51
|
function superviseDevServer(now = Date.now) {
|
|
52
52
|
let worker;
|
|
53
53
|
let shuttingDown = false;
|
|
54
|
-
let startedAt = 0;
|
|
55
54
|
/** Timestamps of recent crash-restarts, used to detect flapping. */
|
|
56
55
|
let crashes = [];
|
|
57
56
|
const spawnWorker = () => {
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
const spawnedAt = now();
|
|
58
|
+
const spawnedWorker = spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
60
59
|
cwd: process.cwd(),
|
|
61
60
|
env: {
|
|
62
61
|
...process.env,
|
|
@@ -65,12 +64,16 @@ function superviseDevServer(now = Date.now) {
|
|
|
65
64
|
stdio: "inherit",
|
|
66
65
|
windowsHide: false
|
|
67
66
|
});
|
|
68
|
-
worker
|
|
67
|
+
worker = spawnedWorker;
|
|
68
|
+
spawnedWorker.on("error", (error) => {
|
|
69
|
+
if (worker !== spawnedWorker) return;
|
|
69
70
|
shuttingDown = true;
|
|
70
71
|
devLogError(`Could not start the development server: ${error.message}`);
|
|
71
72
|
process.exit(1);
|
|
72
73
|
});
|
|
73
|
-
|
|
74
|
+
spawnedWorker.on("exit", (code, signal) => {
|
|
75
|
+
if (worker !== spawnedWorker) return;
|
|
76
|
+
worker = void 0;
|
|
74
77
|
releaseTerminal();
|
|
75
78
|
if (shuttingDown) {
|
|
76
79
|
process.exit(signal ? 1 : code ?? 0);
|
|
@@ -80,7 +83,7 @@ function superviseDevServer(now = Date.now) {
|
|
|
80
83
|
spawnWorker();
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
83
|
-
if ((signal !== null || (code ?? 0) !== 0) && shouldRecoverFromCrash(now() -
|
|
86
|
+
if ((signal !== null || (code ?? 0) !== 0) && shouldRecoverFromCrash(now() - spawnedAt)) {
|
|
84
87
|
devLogWarn(`Development server ${signal ? `was killed by ${signal}` : `exited with code ${code}`} — restarting.`);
|
|
85
88
|
spawnWorker();
|
|
86
89
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"supervisor.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/supervisor.ts"],"sourcesContent":["import { spawn, type ChildProcess } from \"node:child_process\";\nimport { devLogError, devLogWarn } from \"./dev-logger\";\n\n/**\n * Set on the worker process so it knows it was launched by a supervisor —\n * and so `warlock dev` inside the worker runs the server instead of\n * supervising a third process.\n */\nexport const WORKER_ENV_FLAG = \"WARLOCK_DEV_WORKER\";\n\n/**\n * Exit code a worker uses to ask for a fresh process. Chosen as EX_TEMPFAIL,\n * whose conventional meaning (\"temporary failure, retry\") is close enough that\n * a stray supervisor-less exit reads sensibly in a shell.\n */\nexport const RESTART_EXIT_CODE = 75;\n\n/** Signals the supervisor must hand to the worker rather than act on itself. */\nconst FORWARDED_SIGNALS: NodeJS.Signals[] = [\"SIGTERM\", \"SIGHUP\"];\n\n/**\n * How long a worker must survive before an abnormal exit counts as a crash\n * worth recovering from rather than a failed boot worth reporting once.\n */\nconst HEALTHY_UPTIME_MS = 5_000;\n\n/** Crashes allowed inside {@link CRASH_WINDOW_MS} before we stop restarting. */\nconst CRASH_RESTART_LIMIT = 3;\n\n/** The rolling window flapping is measured over. */\nconst CRASH_WINDOW_MS = 60_000;\n\n/** Whether this process is the worker (i.e. a supervisor already exists). */\nexport function isDevWorker(): boolean {\n return process.env[WORKER_ENV_FLAG] === \"1\";\n}\n\n/**\n * Run `warlock dev` as a supervised pair: a thin parent that owns the terminal\n * and a disposable child that is the actual dev server.\n *\n * The child asks to be replaced by exiting {@link RESTART_EXIT_CODE}; the\n * supervisor spawns a fresh one in its place. Because the parent is never\n * itself replaced, the process tree stays exactly two deep no matter how many\n * restarts happen — the previous design re-exec'd itself and left one idle\n * waiter behind per restart.\n *\n * The supervisor deliberately loads no config, no connectors, and no\n * application code, so a worker that wedges or dies can always be replaced by\n * a process that is known-good.\n *\n * Never resolves: the returned promise is a deliberate dead end so callers can\n * `return` it to stop everything downstream (notably the command's preloaders,\n * which must only ever run in the worker). The process ends with the last\n * worker, not with this promise.\n */\nexport function superviseDevServer(now: () => number = Date.now): Promise<never> {\n let worker: ChildProcess | undefined;\n let shuttingDown = false;\n\n /** Timestamps of recent crash-restarts, used to detect flapping. */\n let crashes: number[] = [];\n\n const spawnWorker = (): void => {\n const spawnedAt = now();\n\n const spawnedWorker = spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {\n cwd: process.cwd(),\n env: { ...process.env, [WORKER_ENV_FLAG]: \"1\" },\n stdio: \"inherit\",\n windowsHide: false,\n });\n worker = spawnedWorker;\n\n spawnedWorker.on(\"error\", (error) => {\n if (worker !== spawnedWorker) return;\n\n shuttingDown = true;\n devLogError(`Could not start the development server: ${error.message}`);\n process.exit(1);\n });\n\n spawnedWorker.on(\"exit\", (code, signal) => {\n // A replaced worker can finish emitting lifecycle events after its\n // successor is already healthy. It must not spend that successor's crash\n // budget, spawn another worker, or print a terminal flapping diagnosis.\n if (worker !== spawnedWorker) return;\n\n worker = undefined;\n releaseTerminal();\n\n // `return` after every exit deliberately: `process.exit` is typed\n // `never`, but treating it as control flow means anything that stubs it\n // out turns \"we are shutting down\" into \"spawn another worker\".\n if (shuttingDown) {\n process.exit(signal ? 1 : (code ?? 0));\n return;\n }\n\n if (code === RESTART_EXIT_CODE) {\n spawnWorker();\n return;\n }\n\n const crashed = signal !== null || (code ?? 0) !== 0;\n\n if (crashed && shouldRecoverFromCrash(now() - spawnedAt)) {\n devLogWarn(\n `Development server ${signal ? `was killed by ${signal}` : `exited with code ${code}`} — restarting.`,\n );\n spawnWorker();\n return;\n }\n\n // The worker owns its own error reporting; the supervisor only mirrors\n // the outcome so `npm run dev` and CI see the code they expect.\n process.exit(signal ? 1 : (code ?? 0));\n });\n };\n\n /**\n * Whether a worker that died on its own should be replaced.\n *\n * The rule is minimum healthy uptime, not a bare retry count. A worker that\n * dies almost immediately failed to *boot* — a broken config, a port already\n * taken — and it has already printed why; respawning would just reprint the\n * same error and bury it. A worker that ran fine for a while and then died\n * (OOM, a native crash, a dead loader thread) is the case worth recovering,\n * because the state that killed it is usually not reproduced on a fresh boot.\n *\n * Flapping is still capped: enough crashes inside one window and we stop and\n * say so, rather than restarting forever behind the developer's back.\n */\n function shouldRecoverFromCrash(uptimeMs: number): boolean {\n if (uptimeMs < HEALTHY_UPTIME_MS) {\n return false;\n }\n\n const at = now();\n\n crashes = [...crashes.filter((time) => at - time < CRASH_WINDOW_MS), at];\n\n if (crashes.length > CRASH_RESTART_LIMIT) {\n devLogError(\n `Development server crashed ${crashes.length} times in ` +\n `${Math.round(CRASH_WINDOW_MS / 1000)}s — not restarting again. ` +\n `Fix the cause and run \\`warlock dev\\` when you're ready.`,\n );\n return false;\n }\n\n return true;\n }\n\n // SIGINT reaches the worker directly from the terminal (same process group),\n // so the supervisor must NOT act on it — exiting here would orphan a server\n // that is still draining. It only notes that the next exit is final.\n process.on(\"SIGINT\", () => {\n shuttingDown = true;\n });\n\n for (const signal of FORWARDED_SIGNALS) {\n process.on(signal, () => {\n shuttingDown = true;\n worker?.kill(signal);\n });\n }\n\n spawnWorker();\n\n return new Promise<never>(() => {\n // Intentionally never settles — see the doc comment.\n });\n}\n\n/**\n * Put the shared TTY back into a sane state after a worker exits.\n *\n * The worker takes stdin into raw mode for its keyboard shortcuts and releases\n * it on shutdown — but a worker that was killed outright never got the chance,\n * and the mode belongs to the terminal, not the process that set it. Without\n * this, the next worker (or the user's shell) inherits a stdin with no line\n * editing and no Ctrl+C.\n */\nfunction releaseTerminal(): void {\n try {\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(false);\n }\n } catch {\n // Nothing to recover if the terminal is already gone.\n }\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,kBAAkB;;;;;;AAO/B,MAAa,oBAAoB;;AAGjC,MAAM,oBAAsC,CAAC,WAAW,QAAQ;;;;;AAMhE,MAAM,oBAAoB;;AAG1B,MAAM,sBAAsB;;AAG5B,MAAM,kBAAkB;;AAGxB,SAAgB,cAAuB;CACrC,OAAO,QAAQ,IAAI,qBAAqB;AAC1C;;;;;;;;;;;;;;;;;;;;AAq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AAO;EACT;EAEA,OAAO;CACT;CAKA,QAAQ,GAAG,gBAAgB;EACzB,eAAe;CACjB,CAAC;CAED,KAAK,MAAM,UAAU,mBACnB,QAAQ,GAAG,cAAc;EACvB,eAAe;EACf,QAAQ,KAAK,MAAM;CACrB,CAAC;CAGH,YAAY;CAEZ,OAAO,IAAI,cAAqB,CAEhC,CAAC;AACH;;;;;;;;;;AAWA,SAAS,kBAAwB;CAC/B,IAAI;EACF,IAAI,QAAQ,MAAM,OAChB,QAAQ,MAAM,WAAW,KAAK;CAElC,QAAQ,CAER;AACF"}
|
|
@@ -2,7 +2,7 @@ import { Path } from "../utils/normalized-path.mjs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region core/src/dev-server/tsconfig-manager.ts
|
|
6
6
|
var TSConfigManager = class {
|
|
7
7
|
constructor() {
|
|
8
8
|
this.aliases = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-manager.mjs","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"tsconfig-manager.mjs","names":[],"sources":["C:/Work/Warlock.js/core/src/dev-server/tsconfig-manager.ts"],"sourcesContent":["import path from \"node:path\";\nimport ts from \"typescript\";\nimport { Path } from \"../utils/normalized-path\";\n\nexport class TSConfigManager {\n /**\n * Aliases list (from tsconfig paths)\n */\n public aliases: Record<string, string[]> = {};\n\n /**\n * Base URL for resolving paths\n */\n public baseUrl: string = \".\";\n\n /**\n * TSConfig\n */\n public tsconfig: any;\n\n public init() {\n if (this.tsconfig) return;\n\n // use typescript to load the tsconfig.json file\n const output = ts.readConfigFile(Path.toAbsolute(\"tsconfig.json\"), ts.sys.readFile);\n\n this.tsconfig = output.config!;\n\n this.aliases = output.config?.compilerOptions?.paths || {};\n\n this.baseUrl = output.config?.compilerOptions?.baseUrl || \".\";\n }\n\n /**\n * Check if the given path is an alias\n * This checks if it's a REAL path alias (not an external package alias)\n *\n * Real aliases map to local paths (e.g., app/* -> src/app/*, src/* -> src/*)\n * External package aliases map to themselves with @ prefix (e.g., @warlock.js/core -> @warlock.js/core)\n */\n public isAlias(path: string) {\n if (!this.tsconfig) {\n this.init();\n }\n\n return Object.keys(this.aliases).some((alias) => {\n // Remove /* from alias pattern for matching\n const aliasPattern = alias.replace(\"/*\", \"\");\n\n if (!path.startsWith(aliasPattern)) {\n return false;\n }\n\n // Check if this is a real alias or just an external package mapping\n const aliasTargets = this.aliases[alias];\n if (!Array.isArray(aliasTargets) || aliasTargets.length === 0) {\n return false;\n }\n\n // If the alias starts with @, it's likely an external package alias\n // Example: \"@warlock.js/core\" -> \"@warlock.js/core\" (external package)\n if (aliasPattern.startsWith(\"@\")) {\n return false;\n }\n\n // Otherwise, it's a real path alias (including self-referencing ones like src/* -> src/*)\n // Example: \"app/*\" -> \"src/app/*\" (real alias)\n // Example: \"src/*\" -> \"src/*\" (self-referencing alias, still valid)\n return true;\n });\n }\n\n /**\n * Get the alias key that matches the given import path\n */\n public getMatchingAlias(path: string): string | null {\n const aliasKey = Object.keys(this.aliases).find((alias) => {\n const aliasPattern = alias.replace(\"/*\", \"\");\n return path.startsWith(aliasPattern);\n });\n\n return aliasKey || null;\n }\n\n /**\n * Resolve an alias import path to a relative path based on tsconfig paths\n * Example: \"app/users/services/get-users.service\" -> \"src/app/users/services/get-users.service\"\n *\n * @param path - The import path with alias (e.g., \"app/users/services/get-users.service\")\n * @returns The resolved relative path or null if alias not found\n */\n public resolveAliasPath(checkingPath: string): string | null {\n // Find matching alias from tsconfig paths\n const aliasKey = this.getMatchingAlias(checkingPath);\n\n if (!aliasKey) return null;\n\n const aliasTargets = this.aliases[aliasKey];\n if (!Array.isArray(aliasTargets) || aliasTargets.length === 0) {\n return null;\n }\n\n // Get the first target path (usually there's only one)\n const targetPattern = aliasTargets[0];\n\n // Replace alias pattern with target pattern\n const aliasPattern = aliasKey.replace(\"/*\", \"\");\n const targetBase = targetPattern.replace(\"/*\", \"\");\n // Remove any leading slash so path.join does not drop the base\n const relativePart = checkingPath.substring(aliasPattern.length).replace(/^[/\\\\]/, \"\");\n\n // Join the target base with the relative part\n const resolvedPath = path.join(targetBase, relativePart);\n\n return Path.normalize(resolvedPath);\n }\n\n /**\n * Resolve an alias import path to an absolute path\n * Example: \"app/users/services/get-users.service\" -> \"/absolute/path/to/src/app/users/services/get-users.service\"\n *\n * @param path - The import path with alias\n * @returns The resolved absolute path or null if alias not found\n */\n public resolveAliasToAbsolute(path: string): string | null {\n const relativePath = this.resolveAliasPath(path);\n\n if (!relativePath) return null;\n\n return Path.normalize(Path.toAbsolute(relativePath));\n }\n}\n\nexport const tsconfigManager = new TSConfigManager();\n"],"mappings":";;;;;AAIA,IAAa,kBAAb,MAA6B;;iBAIgB,CAAC;iBAKnB;;CAOzB,AAAO,OAAO;EACZ,IAAI,KAAK,UAAU;EAGnB,MAAM,SAAS,GAAG,eAAe,KAAK,WAAW,eAAe,GAAG,GAAG,IAAI,QAAQ;EAElF,KAAK,WAAW,OAAO;EAEvB,KAAK,UAAU,OAAO,QAAQ,iBAAiB,SAAS,CAAC;EAEzD,KAAK,UAAU,OAAO,QAAQ,iBAAiB,WAAW;CAC5D;;;;;;;;CASA,AAAO,QAAQ,MAAc;EAC3B,IAAI,CAAC,KAAK,UACR,KAAK,KAAK;EAGZ,OAAO,OAAO,KAAK,KAAK,OAAO,EAAE,MAAM,UAAU;GAE/C,MAAM,eAAe,MAAM,QAAQ,MAAM,EAAE;GAE3C,IAAI,CAAC,KAAK,WAAW,YAAY,GAC/B,OAAO;GAIT,MAAM,eAAe,KAAK,QAAQ;GAClC,IAAI,CAAC,MAAM,QAAQ,YAAY,KAAK,aAAa,WAAW,GAC1D,OAAO;GAKT,IAAI,aAAa,WAAW,GAAG,GAC7B,OAAO;GAMT,OAAO;EACT,CAAC;CACH;;;;CAKA,AAAO,iBAAiB,MAA6B;EAMnD,OALiB,OAAO,KAAK,KAAK,OAAO,EAAE,MAAM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