@warlock.js/core 4.0.135 → 4.0.137
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/esm/benchmark/benchmark-snapshots.d.ts +47 -0
- package/esm/benchmark/benchmark-snapshots.d.ts.map +1 -0
- package/esm/benchmark/benchmark-snapshots.js +77 -0
- package/esm/benchmark/benchmark-snapshots.js.map +1 -0
- package/esm/benchmark/benchmark.d.ts +25 -0
- package/esm/benchmark/benchmark.d.ts.map +1 -0
- package/esm/benchmark/benchmark.example.d.ts +2 -0
- package/esm/benchmark/benchmark.example.d.ts.map +1 -0
- package/esm/benchmark/benchmark.js +120 -0
- package/esm/benchmark/benchmark.js.map +1 -0
- package/esm/benchmark/channels/console.channel.d.ts +14 -0
- package/esm/benchmark/channels/console.channel.d.ts.map +1 -0
- package/esm/benchmark/channels/console.channel.js +29 -0
- package/esm/benchmark/channels/console.channel.js.map +1 -0
- package/esm/benchmark/channels/index.d.ts +3 -0
- package/esm/benchmark/channels/index.d.ts.map +1 -0
- package/esm/benchmark/channels/noop.channel.d.ts +5 -0
- package/esm/benchmark/channels/noop.channel.d.ts.map +1 -0
- package/esm/benchmark/channels/noop.channel.js +3 -0
- package/esm/benchmark/channels/noop.channel.js.map +1 -0
- package/esm/benchmark/index.d.ts +7 -0
- package/esm/benchmark/index.d.ts.map +1 -0
- package/esm/benchmark/profiler.d.ts +63 -0
- package/esm/benchmark/profiler.d.ts.map +1 -0
- package/esm/benchmark/profiler.js +155 -0
- package/esm/benchmark/profiler.js.map +1 -0
- package/esm/benchmark/types.d.ts +167 -0
- package/esm/benchmark/types.d.ts.map +1 -0
- package/esm/cli/cli-commands.manager.js +1 -1
- package/esm/cli/cli-commands.manager.js.map +1 -1
- package/esm/cli/commands/dev-server.command.js +1 -1
- package/esm/cli/commands/dev-server.command.js.map +1 -1
- package/esm/cli/commands/drop-tables.command.d.ts +2 -0
- package/esm/cli/commands/drop-tables.command.d.ts.map +1 -0
- package/esm/cli/commands/drop-tables.command.js +17 -0
- package/esm/cli/commands/drop-tables.command.js.map +1 -0
- package/esm/cli/commands/generate/generate.command.d.ts.map +1 -1
- package/esm/cli/commands/generate/generate.command.js +1 -0
- package/esm/cli/commands/generate/generate.command.js.map +1 -1
- package/esm/cli/commands/generate/generators/controller.generator.js +6 -6
- package/esm/cli/commands/generate/generators/controller.generator.js.map +1 -1
- package/esm/cli/commands/generate/generators/module.generator.d.ts.map +1 -1
- package/esm/cli/commands/generate/generators/module.generator.js +6 -5
- package/esm/cli/commands/generate/generators/module.generator.js.map +1 -1
- package/esm/cli/commands/generate/generators/validation.generator.js +11 -11
- package/esm/cli/commands/generate/generators/validation.generator.js.map +1 -1
- package/esm/cli/commands/generate/templates/stubs.d.ts +6 -3
- package/esm/cli/commands/generate/templates/stubs.d.ts.map +1 -1
- package/esm/cli/commands/generate/templates/stubs.js +37 -25
- package/esm/cli/commands/generate/templates/stubs.js.map +1 -1
- package/esm/cli/commands/generate/utils/prompt.js +21 -0
- package/esm/cli/commands/generate/utils/prompt.js.map +1 -0
- package/esm/cli/commands/seed.command.d.ts.map +1 -1
- package/esm/cli/commands/seed.command.js +9 -2
- package/esm/cli/commands/seed.command.js.map +1 -1
- package/esm/cli/commands/storage-put.action.d.ts +22 -0
- package/esm/cli/commands/storage-put.action.d.ts.map +1 -0
- package/esm/cli/commands/storage-put.action.js +75 -0
- package/esm/cli/commands/storage-put.action.js.map +1 -0
- package/esm/cli/commands/storage-put.command.d.ts +20 -0
- package/esm/cli/commands/storage-put.command.d.ts.map +1 -0
- package/esm/cli/commands/storage-put.command.js +41 -0
- package/esm/cli/commands/storage-put.command.js.map +1 -0
- package/esm/cli/commands/typings-generator.command.js +1 -1
- package/esm/cli/commands/typings-generator.command.js.map +1 -1
- package/esm/cli/commands-loader.js +1 -1
- package/esm/cli/commands-loader.js.map +1 -1
- package/esm/cli/framework-cli-commands.d.ts.map +1 -1
- package/esm/cli/framework-cli-commands.js +7 -2
- package/esm/cli/framework-cli-commands.js.map +1 -1
- package/esm/cli/types.d.ts +1 -1
- package/esm/cli/types.d.ts.map +1 -1
- package/esm/config/config-getter.d.ts +1 -1
- package/esm/config/config-getter.d.ts.map +1 -1
- package/esm/config/config-getter.js.map +1 -1
- package/esm/config/config-loader.d.ts +1 -1
- package/esm/config/config-loader.d.ts.map +1 -1
- package/esm/config/config-loader.js +1 -1
- package/esm/config/config-loader.js.map +1 -1
- package/esm/config/config-manager.d.ts +1 -1
- package/esm/config/config-manager.d.ts.map +1 -1
- package/esm/config/load-config-files.d.ts.map +1 -1
- package/esm/config/load-config-files.js +1 -1
- package/esm/config/load-config-files.js.map +1 -1
- package/esm/connectors/base-connector.d.ts.map +1 -0
- package/esm/{dev2-server/connectors → connectors}/base-connector.js +1 -1
- package/esm/connectors/base-connector.js.map +1 -0
- package/esm/connectors/cache-connector.d.ts.map +1 -0
- package/esm/connectors/cache-connector.js.map +1 -0
- package/esm/connectors/communicator-connector.d.ts.map +1 -0
- package/esm/connectors/communicator-connector.js.map +1 -0
- package/esm/connectors/connectors-manager.d.ts.map +1 -0
- package/esm/{dev2-server/connectors → connectors}/connectors-manager.js +1 -1
- package/esm/connectors/connectors-manager.js.map +1 -0
- package/esm/connectors/database-connector.d.ts.map +1 -0
- package/esm/connectors/database-connector.js.map +1 -0
- package/esm/{dev2-server/connectors → connectors}/http-connector.d.ts +2 -0
- package/esm/connectors/http-connector.d.ts.map +1 -0
- package/esm/{dev2-server/connectors → connectors}/http-connector.js +18 -4
- package/esm/connectors/http-connector.js.map +1 -0
- package/esm/connectors/index.d.ts.map +1 -0
- package/esm/connectors/storage.connector.d.ts.map +1 -0
- package/esm/{dev2-server/connectors → connectors}/storage.connector.js +1 -1
- package/esm/connectors/storage.connector.js.map +1 -0
- package/esm/connectors/types.d.ts.map +1 -0
- package/esm/connectors/types.js.map +1 -0
- package/esm/database/drop-tables-action.d.ts +3 -0
- package/esm/database/drop-tables-action.d.ts.map +1 -0
- package/esm/database/drop-tables-action.js +29 -0
- package/esm/database/drop-tables-action.js.map +1 -0
- package/esm/database/migrate-action.js +18 -10
- package/esm/database/migrate-action.js.map +1 -1
- package/esm/database/seed-command-action.js +4 -4
- package/esm/database/seed-command-action.js.map +1 -1
- package/esm/database/seeds/seeder.d.ts +4 -0
- package/esm/database/seeds/seeder.d.ts.map +1 -1
- package/esm/database/seeds/seeder.js.map +1 -1
- package/esm/database/seeds/seeders.manager.d.ts +1 -1
- package/esm/database/seeds/seeders.manager.d.ts.map +1 -1
- package/esm/database/seeds/seeders.manager.js +12 -5
- package/esm/database/seeds/seeders.manager.js.map +1 -1
- package/esm/database/utils.d.ts +1 -2
- package/esm/database/utils.d.ts.map +1 -1
- package/esm/database/utils.js +2 -2
- package/esm/database/utils.js.map +1 -1
- package/esm/dev-server/create-worker.d.ts.map +1 -0
- package/esm/dev-server/create-worker.js.map +1 -0
- package/esm/{dev2-server → dev-server}/dependency-graph.d.ts +10 -1
- package/esm/dev-server/dependency-graph.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/dependency-graph.js +49 -5
- package/esm/dev-server/dependency-graph.js.map +1 -0
- package/esm/dev-server/dev-logger.d.ts.map +1 -0
- package/esm/dev-server/dev-logger.js.map +1 -0
- package/esm/{dev2-server → dev-server}/development-server.d.ts +8 -0
- package/esm/dev-server/development-server.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/development-server.js +57 -7
- package/esm/dev-server/development-server.js.map +1 -0
- package/esm/dev-server/events.d.ts.map +1 -0
- package/esm/dev-server/events.js.map +1 -0
- package/esm/dev-server/export-analyzer.d.ts.map +1 -0
- package/esm/dev-server/export-analyzer.js.map +1 -0
- package/esm/dev-server/file-event-handler.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/file-event-handler.js +13 -4
- package/esm/dev-server/file-event-handler.js.map +1 -0
- package/esm/{dev2-server → dev-server}/file-manager.d.ts +10 -1
- package/esm/dev-server/file-manager.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/file-manager.js +26 -3
- package/esm/dev-server/file-manager.js.map +1 -0
- package/esm/dev-server/file-operations.d.ts.map +1 -0
- package/esm/dev-server/file-operations.js.map +1 -0
- package/esm/{dev2-server → dev-server}/files-orchestrator.d.ts +7 -1
- package/esm/dev-server/files-orchestrator.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/files-orchestrator.js +39 -8
- package/esm/dev-server/files-orchestrator.js.map +1 -0
- package/esm/dev-server/files-watcher.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/files-watcher.js +30 -4
- package/esm/dev-server/files-watcher.js.map +1 -0
- package/esm/dev-server/flags.d.ts.map +1 -0
- package/esm/dev-server/flags.js.map +1 -0
- package/esm/dev-server/health-checker/checkers/base-health-checker.d.ts.map +1 -0
- package/esm/dev-server/health-checker/checkers/base-health-checker.js.map +1 -0
- package/esm/dev-server/health-checker/checkers/eslint-health-checker.d.ts.map +1 -0
- package/esm/dev-server/health-checker/checkers/eslint-health-checker.js.map +1 -0
- package/esm/dev-server/health-checker/checkers/typescript-health-checker.d.ts.map +1 -0
- package/esm/dev-server/health-checker/checkers/typescript-health-checker.js.map +1 -0
- package/esm/dev-server/health-checker/file-health-checker.contract.d.ts.map +1 -0
- package/esm/dev-server/health-checker/file-health-result.d.ts.map +1 -0
- package/esm/dev-server/health-checker/file-health-result.js.map +1 -0
- package/esm/dev-server/health-checker/files-healthcare.manager.d.ts.map +1 -0
- package/esm/dev-server/health-checker/files-healthcare.manager.js.map +1 -0
- package/esm/dev-server/health-checker/index.d.ts.map +1 -0
- package/esm/dev-server/health-checker/workers/eslint-health.worker.d.ts.map +1 -0
- package/esm/dev-server/health-checker/workers/eslint-health.worker.js.map +1 -0
- package/esm/dev-server/health-checker/workers/ts-health.worker.d.ts.map +1 -0
- package/esm/dev-server/health-checker/workers/ts-health.worker.js.map +1 -0
- package/esm/dev-server/import-deduplicator.d.ts +75 -0
- package/esm/dev-server/import-deduplicator.d.ts.map +1 -0
- package/esm/dev-server/import-deduplicator.js +288 -0
- package/esm/dev-server/import-deduplicator.js.map +1 -0
- package/esm/dev-server/import-deduplicator.test.d.ts +7 -0
- package/esm/dev-server/import-deduplicator.test.d.ts.map +1 -0
- package/esm/dev-server/import-transformer.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/import-transformer.js +61 -129
- package/esm/dev-server/import-transformer.js.map +1 -0
- package/esm/{dev2-server → dev-server}/index.d.ts.map +1 -1
- package/esm/{dev2-server → dev-server}/layer-executor.d.ts +5 -2
- package/esm/dev-server/layer-executor.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/layer-executor.js +34 -9
- package/esm/dev-server/layer-executor.js.map +1 -0
- package/esm/dev-server/manifest-manager.d.ts.map +1 -0
- package/esm/dev-server/manifest-manager.js.map +1 -0
- package/esm/{dev2-server → dev-server}/module-loader.d.ts +3 -0
- package/esm/dev-server/module-loader.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/module-loader.js +9 -5
- package/esm/dev-server/module-loader.js.map +1 -0
- package/esm/dev-server/package-json-manager.d.ts.map +1 -0
- package/esm/dev-server/package-json-manager.js.map +1 -0
- package/esm/dev-server/parse-imports.d.ts +34 -0
- package/esm/dev-server/parse-imports.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/parse-imports.js +98 -1
- package/esm/dev-server/parse-imports.js.map +1 -0
- package/esm/dev-server/path.d.ts.map +1 -0
- package/esm/dev-server/path.js.map +1 -0
- package/esm/dev-server/runtime-import-helper.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/runtime-import-helper.js +3 -3
- package/esm/dev-server/runtime-import-helper.js.map +1 -0
- package/esm/dev-server/special-files-collector.d.ts.map +1 -0
- package/esm/dev-server/special-files-collector.js.map +1 -0
- package/esm/dev-server/start-development-server.d.ts.map +1 -0
- package/esm/dev-server/start-development-server.js.map +1 -0
- package/esm/dev-server/transpile-file.d.ts.map +1 -0
- package/esm/dev-server/transpile-file.js.map +1 -0
- package/esm/dev-server/tsconfig-manager.d.ts.map +1 -0
- package/esm/dev-server/tsconfig-manager.js.map +1 -0
- package/esm/dev-server/type-generator.d.ts.map +1 -0
- package/esm/dev-server/type-generator.js.map +1 -0
- package/esm/dev-server/types.d.ts.map +1 -0
- package/esm/dev-server/utils.d.ts.map +1 -0
- package/esm/{dev2-server → dev-server}/utils.js +2 -1
- package/esm/dev-server/utils.js.map +1 -0
- package/esm/encryption/encrypt.d.ts +23 -0
- package/esm/encryption/encrypt.d.ts.map +1 -0
- package/esm/encryption/encrypt.js +85 -0
- package/esm/encryption/encrypt.js.map +1 -0
- package/esm/encryption/hash.d.ts +17 -0
- package/esm/encryption/hash.d.ts.map +1 -0
- package/esm/encryption/hash.js +26 -0
- package/esm/encryption/hash.js.map +1 -0
- package/esm/encryption/index.d.ts +5 -0
- package/esm/encryption/index.d.ts.map +1 -0
- package/esm/encryption/password.d.ts +23 -0
- package/esm/encryption/password.d.ts.map +1 -0
- package/esm/encryption/password.js +72 -0
- package/esm/encryption/password.js.map +1 -0
- package/esm/encryption/types.d.ts +51 -0
- package/esm/encryption/types.d.ts.map +1 -0
- package/esm/generations/add-command.action.d.ts.map +1 -1
- package/esm/generations/add-command.action.js +44 -15
- package/esm/generations/add-command.action.js.map +1 -1
- package/esm/http/middleware/inject-request-context.d.ts.map +1 -1
- package/esm/http/middleware/inject-request-context.js +3 -1
- package/esm/http/middleware/inject-request-context.js.map +1 -1
- package/esm/http/request.d.ts +9 -1
- package/esm/http/request.d.ts.map +1 -1
- package/esm/http/request.js +11 -1
- package/esm/http/request.js.map +1 -1
- package/esm/http/response.d.ts.map +1 -1
- package/esm/http/response.js +54 -16
- package/esm/http/response.js.map +1 -1
- package/esm/http/types.d.ts +14 -6
- package/esm/http/types.d.ts.map +1 -1
- package/esm/http/uploaded-file.js +1 -1
- package/esm/index.d.ts +7 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/mail/mailer-pool.js +11 -11
- package/esm/mail/send-mail.js +1 -1
- package/esm/mail/send-mail.js.map +1 -1
- package/esm/production/production-builder.js +1 -1
- package/esm/repositories/adapters/cascade/cascade-adapter.js +2 -2
- package/esm/repositories/adapters/cascade/cascade-adapter.js.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.ts +17 -0
- package/esm/repositories/adapters/cascade/cascade-query-builder.d.ts.map +1 -1
- package/esm/repositories/adapters/cascade/cascade-query-builder.js +39 -25
- package/esm/repositories/adapters/cascade/cascade-query-builder.js.map +1 -1
- package/esm/repositories/adapters/cascade/filter-applicator.d.ts +49 -0
- package/esm/repositories/adapters/cascade/filter-applicator.d.ts.map +1 -1
- package/esm/repositories/adapters/cascade/filter-applicator.js +99 -0
- package/esm/repositories/adapters/cascade/filter-applicator.js.map +1 -1
- package/esm/repositories/contracts/query-builder.contract.d.ts +41 -0
- package/esm/repositories/contracts/query-builder.contract.d.ts.map +1 -1
- package/esm/repositories/contracts/types.d.ts +56 -6
- package/esm/repositories/contracts/types.d.ts.map +1 -1
- package/esm/repositories/repository.manager.d.ts +93 -48
- package/esm/repositories/repository.manager.d.ts.map +1 -1
- package/esm/repositories/repository.manager.js +139 -50
- package/esm/repositories/repository.manager.js.map +1 -1
- package/esm/resource/resource-field-builder.d.ts.map +1 -1
- package/esm/resource/resource-field-builder.js +18 -4
- package/esm/resource/resource-field-builder.js.map +1 -1
- package/esm/resource/resource.d.ts +23 -1
- package/esm/resource/resource.d.ts.map +1 -1
- package/esm/resource/resource.js +56 -3
- package/esm/resource/resource.js.map +1 -1
- package/esm/resource/types.d.ts +12 -2
- package/esm/resource/types.d.ts.map +1 -1
- package/esm/restful/restful.js +1 -1
- package/esm/restful/restful.js.map +1 -1
- package/esm/retry/index.d.ts +3 -0
- package/esm/retry/index.d.ts.map +1 -0
- package/esm/retry/retry.d.ts +21 -0
- package/esm/retry/retry.d.ts.map +1 -0
- package/esm/retry/retry.js +39 -0
- package/esm/retry/retry.js.map +1 -0
- package/esm/retry/types.d.ts +27 -0
- package/esm/retry/types.d.ts.map +1 -0
- package/esm/router/types.d.ts +10 -10
- package/esm/router/types.d.ts.map +1 -1
- package/esm/storage/scoped-storage.d.ts +34 -1
- package/esm/storage/scoped-storage.d.ts.map +1 -1
- package/esm/storage/scoped-storage.js +84 -1
- package/esm/storage/scoped-storage.js.map +1 -1
- package/esm/storage/types.d.ts +53 -0
- package/esm/storage/types.d.ts.map +1 -1
- package/esm/tests/index.d.ts +1 -0
- package/esm/tests/index.d.ts.map +1 -1
- package/esm/tests/start-http-development-server.d.ts +12 -0
- package/esm/tests/start-http-development-server.d.ts.map +1 -1
- package/esm/tests/start-http-development-server.js +66 -6
- package/esm/tests/start-http-development-server.js.map +1 -1
- package/esm/tests/test-helpers.d.ts +43 -0
- package/esm/tests/test-helpers.d.ts.map +1 -0
- package/esm/tests/test-helpers.js +86 -0
- package/esm/tests/test-helpers.js.map +1 -0
- package/esm/tests/vitest-setup.d.ts +1 -1
- package/esm/tests/vitest-setup.d.ts.map +1 -1
- package/esm/tests/vitest-setup.js +1 -1
- package/esm/tests/vitest-setup.js.map +1 -1
- package/esm/use-cases/index.d.ts +7 -0
- package/esm/use-cases/index.d.ts.map +1 -0
- package/esm/use-cases/types.d.ts +267 -0
- package/esm/use-cases/types.d.ts.map +1 -0
- package/esm/use-cases/use-case-events.d.ts +33 -0
- package/esm/use-cases/use-case-events.d.ts.map +1 -0
- package/esm/use-cases/use-case-events.js +65 -0
- package/esm/use-cases/use-case-events.js.map +1 -0
- package/esm/use-cases/use-case-pipeline.d.ts +29 -0
- package/esm/use-cases/use-case-pipeline.d.ts.map +1 -0
- package/esm/use-cases/use-case-pipeline.js +45 -0
- package/esm/use-cases/use-case-pipeline.js.map +1 -0
- package/esm/use-cases/use-case.d.ts +27 -0
- package/esm/use-cases/use-case.d.ts.map +1 -0
- package/esm/use-cases/use-case.errors.d.ts +6 -0
- package/esm/use-cases/use-case.errors.d.ts.map +1 -0
- package/esm/use-cases/use-case.errors.js +8 -0
- package/esm/use-cases/use-case.errors.js.map +1 -0
- package/esm/use-cases/use-case.js +138 -0
- package/esm/use-cases/use-case.js.map +1 -0
- package/esm/use-cases/use-cases-registry.d.ts +38 -0
- package/esm/use-cases/use-cases-registry.d.ts.map +1 -0
- package/esm/use-cases/use-cases-registry.js +92 -0
- package/esm/use-cases/use-cases-registry.js.map +1 -0
- package/esm/validation/database/exists-except-current-id.js +1 -1
- package/esm/validation/database/exists-except-current-user.js +1 -1
- package/esm/validation/database/unique-except-current-id.js +1 -1
- package/esm/validation/database/unique-except-current-user.js +1 -1
- package/esm/validation/init.js.map +1 -1
- package/esm/validation/plugins/database-plugin.d.ts.map +1 -1
- package/esm/validation/plugins/database-plugin.js +18 -30
- package/esm/validation/plugins/database-plugin.js.map +1 -1
- package/esm/validation/plugins/file-plugin.d.ts.map +1 -1
- package/esm/validation/plugins/file-plugin.js.map +1 -1
- package/esm/validation/plugins/localized-plugin.d.ts.map +1 -1
- package/esm/validation/plugins/localized-plugin.js.map +1 -1
- package/esm/validation/validators/file-validator.d.ts +14 -14
- package/esm/validation/validators/file-validator.d.ts.map +1 -1
- package/esm/validation/validators/file-validator.js +26 -27
- package/esm/validation/validators/file-validator.js.map +1 -1
- package/esm/warlock-config/types.d.ts +7 -2
- package/esm/warlock-config/types.d.ts.map +1 -1
- package/esm/warlock-config/warlock-config.manager.js +1 -1
- package/esm/warlock-config/warlock-config.manager.js.map +1 -1
- package/package.json +7 -7
- package/esm/dev2-server/connectors/base-connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/base-connector.js.map +0 -1
- package/esm/dev2-server/connectors/cache-connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/cache-connector.js.map +0 -1
- package/esm/dev2-server/connectors/communicator-connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/communicator-connector.js.map +0 -1
- package/esm/dev2-server/connectors/connectors-manager.d.ts.map +0 -1
- package/esm/dev2-server/connectors/connectors-manager.js.map +0 -1
- package/esm/dev2-server/connectors/database-connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/database-connector.js.map +0 -1
- package/esm/dev2-server/connectors/http-connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/http-connector.js.map +0 -1
- package/esm/dev2-server/connectors/index.d.ts.map +0 -1
- package/esm/dev2-server/connectors/storage.connector.d.ts.map +0 -1
- package/esm/dev2-server/connectors/storage.connector.js.map +0 -1
- package/esm/dev2-server/connectors/types.d.ts.map +0 -1
- package/esm/dev2-server/connectors/types.js.map +0 -1
- package/esm/dev2-server/create-worker.d.ts.map +0 -1
- package/esm/dev2-server/create-worker.js.map +0 -1
- package/esm/dev2-server/dependency-graph.d.ts.map +0 -1
- package/esm/dev2-server/dependency-graph.js.map +0 -1
- package/esm/dev2-server/dev-logger.d.ts.map +0 -1
- package/esm/dev2-server/dev-logger.js.map +0 -1
- package/esm/dev2-server/development-server.d.ts.map +0 -1
- package/esm/dev2-server/development-server.js.map +0 -1
- package/esm/dev2-server/events.d.ts.map +0 -1
- package/esm/dev2-server/events.js.map +0 -1
- package/esm/dev2-server/export-analyzer.d.ts.map +0 -1
- package/esm/dev2-server/export-analyzer.js.map +0 -1
- package/esm/dev2-server/file-event-handler.d.ts.map +0 -1
- package/esm/dev2-server/file-event-handler.js.map +0 -1
- package/esm/dev2-server/file-manager.d.ts.map +0 -1
- package/esm/dev2-server/file-manager.js.map +0 -1
- package/esm/dev2-server/file-operations.d.ts.map +0 -1
- package/esm/dev2-server/file-operations.js.map +0 -1
- package/esm/dev2-server/files-orchestrator.d.ts.map +0 -1
- package/esm/dev2-server/files-orchestrator.js.map +0 -1
- package/esm/dev2-server/files-watcher.d.ts.map +0 -1
- package/esm/dev2-server/files-watcher.js.map +0 -1
- package/esm/dev2-server/flags.d.ts.map +0 -1
- package/esm/dev2-server/flags.js.map +0 -1
- package/esm/dev2-server/health-checker/checkers/base-health-checker.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/checkers/base-health-checker.js.map +0 -1
- package/esm/dev2-server/health-checker/checkers/eslint-health-checker.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/checkers/eslint-health-checker.js.map +0 -1
- package/esm/dev2-server/health-checker/checkers/typescript-health-checker.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/checkers/typescript-health-checker.js.map +0 -1
- package/esm/dev2-server/health-checker/file-health-checker.contract.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/file-health-result.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/file-health-result.js.map +0 -1
- package/esm/dev2-server/health-checker/files-healthcare.manager.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/files-healthcare.manager.js.map +0 -1
- package/esm/dev2-server/health-checker/index.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/workers/eslint-health.worker.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/workers/eslint-health.worker.js.map +0 -1
- package/esm/dev2-server/health-checker/workers/ts-health.worker.d.ts.map +0 -1
- package/esm/dev2-server/health-checker/workers/ts-health.worker.js.map +0 -1
- package/esm/dev2-server/import-transformer.d.ts.map +0 -1
- package/esm/dev2-server/import-transformer.js.map +0 -1
- package/esm/dev2-server/layer-executor.d.ts.map +0 -1
- package/esm/dev2-server/layer-executor.js.map +0 -1
- package/esm/dev2-server/manifest-manager.d.ts.map +0 -1
- package/esm/dev2-server/manifest-manager.js.map +0 -1
- package/esm/dev2-server/module-loader.d.ts.map +0 -1
- package/esm/dev2-server/module-loader.js.map +0 -1
- package/esm/dev2-server/package-json-manager.d.ts.map +0 -1
- package/esm/dev2-server/package-json-manager.js.map +0 -1
- package/esm/dev2-server/parse-imports.d.ts +0 -13
- package/esm/dev2-server/parse-imports.d.ts.map +0 -1
- package/esm/dev2-server/parse-imports.js.map +0 -1
- package/esm/dev2-server/path.d.ts.map +0 -1
- package/esm/dev2-server/path.js.map +0 -1
- package/esm/dev2-server/runtime-import-helper.d.ts.map +0 -1
- package/esm/dev2-server/runtime-import-helper.js.map +0 -1
- package/esm/dev2-server/special-files-collector.d.ts.map +0 -1
- package/esm/dev2-server/special-files-collector.js.map +0 -1
- package/esm/dev2-server/start-development-server.d.ts.map +0 -1
- package/esm/dev2-server/start-development-server.js.map +0 -1
- package/esm/dev2-server/transpile-file.d.ts.map +0 -1
- package/esm/dev2-server/transpile-file.js.map +0 -1
- package/esm/dev2-server/tsconfig-manager.d.ts.map +0 -1
- package/esm/dev2-server/tsconfig-manager.js.map +0 -1
- package/esm/dev2-server/type-generator.d.ts.map +0 -1
- package/esm/dev2-server/type-generator.js.map +0 -1
- package/esm/dev2-server/types.d.ts.map +0 -1
- package/esm/dev2-server/utils.d.ts.map +0 -1
- package/esm/dev2-server/utils.js.map +0 -1
- package/esm/http/errors/resource-not-found.error.d.ts +0 -21
- package/esm/http/errors/resource-not-found.error.d.ts.map +0 -1
- package/esm/router/utils.d.ts +0 -5
- package/esm/router/utils.d.ts.map +0 -1
- package/esm/store/index.d.ts +0 -25
- package/esm/store/index.d.ts.map +0 -1
- package/esm/store/index.js +0 -52
- package/esm/store/index.js.map +0 -1
- /package/esm/{dev2-server/connectors → connectors}/base-connector.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/cache-connector.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/cache-connector.js +0 -0
- /package/esm/{dev2-server/connectors → connectors}/communicator-connector.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/communicator-connector.js +0 -0
- /package/esm/{dev2-server/connectors → connectors}/connectors-manager.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/database-connector.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/database-connector.js +0 -0
- /package/esm/{dev2-server/connectors → connectors}/index.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/storage.connector.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/types.d.ts +0 -0
- /package/esm/{dev2-server/connectors → connectors}/types.js +0 -0
- /package/esm/{dev2-server → dev-server}/create-worker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/create-worker.js +0 -0
- /package/esm/{dev2-server → dev-server}/dev-logger.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/dev-logger.js +0 -0
- /package/esm/{dev2-server → dev-server}/events.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/events.js +0 -0
- /package/esm/{dev2-server → dev-server}/export-analyzer.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/export-analyzer.js +0 -0
- /package/esm/{dev2-server → dev-server}/file-event-handler.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/file-operations.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/file-operations.js +0 -0
- /package/esm/{dev2-server → dev-server}/files-watcher.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/flags.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/flags.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/base-health-checker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/base-health-checker.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/eslint-health-checker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/eslint-health-checker.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/typescript-health-checker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/checkers/typescript-health-checker.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/file-health-checker.contract.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/file-health-result.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/file-health-result.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/files-healthcare.manager.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/files-healthcare.manager.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/index.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/workers/eslint-health.worker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/workers/eslint-health.worker.js +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/workers/ts-health.worker.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/health-checker/workers/ts-health.worker.js +0 -0
- /package/esm/{dev2-server → dev-server}/import-transformer.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/index.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/manifest-manager.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/manifest-manager.js +0 -0
- /package/esm/{dev2-server → dev-server}/package-json-manager.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/package-json-manager.js +0 -0
- /package/esm/{dev2-server → dev-server}/path.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/path.js +0 -0
- /package/esm/{dev2-server → dev-server}/runtime-import-helper.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/special-files-collector.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/special-files-collector.js +0 -0
- /package/esm/{dev2-server → dev-server}/start-development-server.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/start-development-server.js +0 -0
- /package/esm/{dev2-server → dev-server}/transpile-file.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/transpile-file.js +0 -0
- /package/esm/{dev2-server → dev-server}/tsconfig-manager.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/tsconfig-manager.js +0 -0
- /package/esm/{dev2-server → dev-server}/type-generator.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/type-generator.js +0 -0
- /package/esm/{dev2-server → dev-server}/types.d.ts +0 -0
- /package/esm/{dev2-server → dev-server}/utils.d.ts +0 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Import Deduplicator
|
|
3
|
+
*
|
|
4
|
+
* A pure function module for deduplicating and transforming ES6 imports.
|
|
5
|
+
* This module is framework-agnostic and can be tested in isolation.
|
|
6
|
+
*
|
|
7
|
+
* The transformer:
|
|
8
|
+
* 1. Groups imports by resolved module path
|
|
9
|
+
* 2. Consolidates bindings for duplicate imports
|
|
10
|
+
* 3. Creates alias assignments for duplicate bindings
|
|
11
|
+
* 4. Generates optimized __import() calls
|
|
12
|
+
*/
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Regex Patterns
|
|
15
|
+
// ============================================================================
|
|
16
|
+
/**
|
|
17
|
+
* Pattern to match ES6 import statements
|
|
18
|
+
* Handles:
|
|
19
|
+
* - import { a, b } from "module" (named imports, can span multiple lines)
|
|
20
|
+
* - import * as Foo from "module" (namespace imports)
|
|
21
|
+
* - import Foo from "module" (default imports)
|
|
22
|
+
* - import Foo, { a, b } from "module" (mixed imports)
|
|
23
|
+
*/
|
|
24
|
+
const IMPORT_REGEX = /import\s+(\{[\s\S]*?\}|\*\s+as\s+\w+|\w+(?:\s*,\s*\{[\s\S]*?\})?)\s+from\s+["']([^"']+)["'];?/gm;
|
|
25
|
+
/**
|
|
26
|
+
* Pattern to match side-effect imports: import "module";
|
|
27
|
+
*/
|
|
28
|
+
const SIDE_EFFECT_IMPORT_REGEX = /import\s+["']([^"']+)["'];?/g;
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// Pure Functions
|
|
31
|
+
// ============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* Check if an import path is a relative or absolute path
|
|
34
|
+
*/
|
|
35
|
+
function isLocalImport(importPath) {
|
|
36
|
+
return importPath.startsWith(".") || importPath.startsWith("/");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse import specifier into bindings
|
|
40
|
+
*
|
|
41
|
+
* @param specifier The import specifier string (e.g., "{ a, b as c }", "* as Foo", "Default")
|
|
42
|
+
* @returns Parsed binding information
|
|
43
|
+
*/
|
|
44
|
+
function parseImportSpecifier(specifier) {
|
|
45
|
+
const trimmed = specifier.trim();
|
|
46
|
+
const result = { bindings: [] };
|
|
47
|
+
if (trimmed.startsWith("* as ")) {
|
|
48
|
+
// Namespace import: import * as Foo
|
|
49
|
+
result.namespaceImport = trimmed.replace("* as ", "").trim();
|
|
50
|
+
}
|
|
51
|
+
else if (trimmed.startsWith("{")) {
|
|
52
|
+
// Named imports: import { a, b as c }
|
|
53
|
+
const content = trimmed.match(/\{([\s\S]*?)\}/)?.[1] || "";
|
|
54
|
+
result.bindings = parseNamedImports(content);
|
|
55
|
+
}
|
|
56
|
+
else if (trimmed.match(/^(\w+)\s*,\s*\{/)) {
|
|
57
|
+
// Mixed import: import Foo, { a, b }
|
|
58
|
+
const mixedMatch = trimmed.match(/^(\w+)\s*,\s*\{([\s\S]*?)\}/);
|
|
59
|
+
if (mixedMatch) {
|
|
60
|
+
result.defaultImport = mixedMatch[1];
|
|
61
|
+
result.bindings = parseNamedImports(mixedMatch[2]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Default import: import Foo
|
|
66
|
+
result.defaultImport = trimmed;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parse named imports content (the part inside braces)
|
|
72
|
+
*/
|
|
73
|
+
function parseNamedImports(content) {
|
|
74
|
+
const bindings = [];
|
|
75
|
+
const parts = content
|
|
76
|
+
.split(",")
|
|
77
|
+
.map((s) => s.trim())
|
|
78
|
+
.filter(Boolean);
|
|
79
|
+
for (const part of parts) {
|
|
80
|
+
const asMatch = part.match(/^(\w+)\s+as\s+(\w+)$/);
|
|
81
|
+
if (asMatch) {
|
|
82
|
+
bindings.push({ originalName: asMatch[1], localName: asMatch[2] });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
bindings.push({ originalName: part, localName: part });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return bindings;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Merge bindings from a new import into an existing group
|
|
92
|
+
* Returns aliases that need to be created for duplicate bindings
|
|
93
|
+
*/
|
|
94
|
+
function mergeBindings(group, newBindings) {
|
|
95
|
+
const aliases = [];
|
|
96
|
+
for (const binding of newBindings) {
|
|
97
|
+
const existing = group.bindings.find((b) => b.originalName === binding.originalName);
|
|
98
|
+
if (existing) {
|
|
99
|
+
// Same original name - check if local names differ
|
|
100
|
+
if (existing.localName !== binding.localName) {
|
|
101
|
+
// Need to create an alias: const newLocal = existingLocal;
|
|
102
|
+
aliases.push(`const ${binding.localName} = ${existing.localName};`);
|
|
103
|
+
}
|
|
104
|
+
// If local names are the same, no action needed (deduplicated)
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
// New binding
|
|
108
|
+
group.bindings.push(binding);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return aliases;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Build an __import statement for a group of imports
|
|
115
|
+
*/
|
|
116
|
+
function buildGroupImportStatement(group) {
|
|
117
|
+
const { cachePath, bindings, namespaceImport, defaultImport } = group;
|
|
118
|
+
if (namespaceImport) {
|
|
119
|
+
return `const ${namespaceImport} = await __import("./${cachePath}")`;
|
|
120
|
+
}
|
|
121
|
+
if (defaultImport && bindings.length > 0) {
|
|
122
|
+
const moduleVar = generateModuleVar();
|
|
123
|
+
const namedDestructure = formatBindings(bindings);
|
|
124
|
+
return `const ${moduleVar} = await __import("./${cachePath}");
|
|
125
|
+
const ${defaultImport} = ${moduleVar}?.default ?? ${moduleVar};
|
|
126
|
+
const { ${namedDestructure} } = ${moduleVar};`;
|
|
127
|
+
}
|
|
128
|
+
if (defaultImport) {
|
|
129
|
+
const moduleVar = generateModuleVar();
|
|
130
|
+
return `const ${moduleVar} = await __import("./${cachePath}");
|
|
131
|
+
const ${defaultImport} = ${moduleVar}?.default ?? ${moduleVar};`;
|
|
132
|
+
}
|
|
133
|
+
if (bindings.length > 0) {
|
|
134
|
+
const namedDestructure = formatBindings(bindings);
|
|
135
|
+
return `const { ${namedDestructure} } = await __import("./${cachePath}")`;
|
|
136
|
+
}
|
|
137
|
+
return `await __import("./${cachePath}")`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Format bindings for destructuring
|
|
141
|
+
*/
|
|
142
|
+
function formatBindings(bindings) {
|
|
143
|
+
return bindings
|
|
144
|
+
.map((b) => b.originalName === b.localName ? b.localName : `${b.originalName}: ${b.localName}`)
|
|
145
|
+
.join(", ");
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Generate a unique module variable name
|
|
149
|
+
*/
|
|
150
|
+
function generateModuleVar() {
|
|
151
|
+
return `__module_${Math.random().toString(36).slice(2, 8)}`;
|
|
152
|
+
}
|
|
153
|
+
// ============================================================================
|
|
154
|
+
// Main Transform Function
|
|
155
|
+
// ============================================================================
|
|
156
|
+
/**
|
|
157
|
+
* Transform and deduplicate imports in code
|
|
158
|
+
*
|
|
159
|
+
* This is the main pure function that can be tested independently.
|
|
160
|
+
*
|
|
161
|
+
* @param code The transpiled JavaScript code containing ES6 imports
|
|
162
|
+
* @param resolveCachePath Function to resolve an import path to a cache path
|
|
163
|
+
* @param options Additional transform options
|
|
164
|
+
* @returns Transform result with deduplicated code
|
|
165
|
+
*/
|
|
166
|
+
function deduplicateImports(code, resolveCachePath, options = {}) {
|
|
167
|
+
const { isAlias = () => false } = options;
|
|
168
|
+
let transformedCode = code;
|
|
169
|
+
const unresolvedImports = [];
|
|
170
|
+
const importGroups = new Map();
|
|
171
|
+
const allAliasAssignments = [];
|
|
172
|
+
// -------------------------------------------------------------------------
|
|
173
|
+
// Phase 1: Collect and group all imports by cache path
|
|
174
|
+
// -------------------------------------------------------------------------
|
|
175
|
+
const importMatches = Array.from(code.matchAll(IMPORT_REGEX));
|
|
176
|
+
for (const match of importMatches) {
|
|
177
|
+
const fullImport = match[0];
|
|
178
|
+
const importSpecifier = match[1];
|
|
179
|
+
const importPath = match[2];
|
|
180
|
+
// Only transform local imports and alias imports
|
|
181
|
+
if (!isLocalImport(importPath) && !isAlias(importPath)) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const cachePath = resolveCachePath(importPath);
|
|
185
|
+
if (!cachePath) {
|
|
186
|
+
unresolvedImports.push(importPath);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
// Get or create the import group for this cache path
|
|
190
|
+
if (!importGroups.has(cachePath)) {
|
|
191
|
+
importGroups.set(cachePath, {
|
|
192
|
+
cachePath,
|
|
193
|
+
bindings: [],
|
|
194
|
+
matches: [],
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const group = importGroups.get(cachePath);
|
|
198
|
+
group.matches.push({ fullImport, index: match.index });
|
|
199
|
+
// Parse and merge bindings
|
|
200
|
+
const parsed = parseImportSpecifier(importSpecifier);
|
|
201
|
+
if (parsed.namespaceImport && !group.namespaceImport) {
|
|
202
|
+
group.namespaceImport = parsed.namespaceImport;
|
|
203
|
+
}
|
|
204
|
+
if (parsed.defaultImport && !group.defaultImport) {
|
|
205
|
+
group.defaultImport = parsed.defaultImport;
|
|
206
|
+
}
|
|
207
|
+
// Merge bindings and collect aliases
|
|
208
|
+
const aliases = mergeBindings(group, parsed.bindings);
|
|
209
|
+
allAliasAssignments.push(...aliases);
|
|
210
|
+
}
|
|
211
|
+
// -------------------------------------------------------------------------
|
|
212
|
+
// Phase 2: Generate deduplicated imports
|
|
213
|
+
// -------------------------------------------------------------------------
|
|
214
|
+
const replacements = [];
|
|
215
|
+
for (const [, group] of importGroups) {
|
|
216
|
+
const sortedMatches = [...group.matches].sort((a, b) => a.index - b.index);
|
|
217
|
+
const primaryMatch = sortedMatches[0];
|
|
218
|
+
// Build consolidated import statement
|
|
219
|
+
const importStatement = buildGroupImportStatement(group);
|
|
220
|
+
// Add the primary replacement
|
|
221
|
+
replacements.push({
|
|
222
|
+
index: primaryMatch.index,
|
|
223
|
+
length: primaryMatch.fullImport.length,
|
|
224
|
+
replacement: importStatement,
|
|
225
|
+
});
|
|
226
|
+
// Remove all duplicate imports
|
|
227
|
+
for (let i = 1; i < sortedMatches.length; i++) {
|
|
228
|
+
const duplicateMatch = sortedMatches[i];
|
|
229
|
+
replacements.push({
|
|
230
|
+
index: duplicateMatch.index,
|
|
231
|
+
length: duplicateMatch.fullImport.length,
|
|
232
|
+
replacement: "",
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// Sort replacements by index descending (to avoid index shifts)
|
|
237
|
+
replacements.sort((a, b) => b.index - a.index);
|
|
238
|
+
// Apply replacements
|
|
239
|
+
for (const r of replacements) {
|
|
240
|
+
transformedCode =
|
|
241
|
+
transformedCode.slice(0, r.index) + r.replacement + transformedCode.slice(r.index + r.length);
|
|
242
|
+
}
|
|
243
|
+
// -------------------------------------------------------------------------
|
|
244
|
+
// Phase 3: Insert alias assignments
|
|
245
|
+
// -------------------------------------------------------------------------
|
|
246
|
+
if (allAliasAssignments.length > 0) {
|
|
247
|
+
// Find the last __import call and insert aliases after it
|
|
248
|
+
const lastImportMatch = transformedCode.match(/.*await __import\([^)]+\)[^\n]*/g);
|
|
249
|
+
if (lastImportMatch) {
|
|
250
|
+
const lastImport = lastImportMatch[lastImportMatch.length - 1];
|
|
251
|
+
const lastImportIndex = transformedCode.lastIndexOf(lastImport);
|
|
252
|
+
const insertPosition = lastImportIndex + lastImport.length;
|
|
253
|
+
transformedCode =
|
|
254
|
+
transformedCode.slice(0, insertPosition) +
|
|
255
|
+
"\n" +
|
|
256
|
+
allAliasAssignments.join("\n") +
|
|
257
|
+
transformedCode.slice(insertPosition);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
// -------------------------------------------------------------------------
|
|
261
|
+
// Phase 4: Transform side-effect imports
|
|
262
|
+
// -------------------------------------------------------------------------
|
|
263
|
+
const sideEffectMatches = Array.from(transformedCode.matchAll(SIDE_EFFECT_IMPORT_REGEX));
|
|
264
|
+
for (let i = sideEffectMatches.length - 1; i >= 0; i--) {
|
|
265
|
+
const match = sideEffectMatches[i];
|
|
266
|
+
const fullImport = match[0];
|
|
267
|
+
const importPath = match[1];
|
|
268
|
+
if (!isLocalImport(importPath) && !isAlias(importPath)) {
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
const cachePath = resolveCachePath(importPath);
|
|
272
|
+
if (!cachePath) {
|
|
273
|
+
unresolvedImports.push(importPath);
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const newImport = `await __import("./${cachePath}")`;
|
|
277
|
+
const startIndex = match.index;
|
|
278
|
+
const endIndex = startIndex + fullImport.length;
|
|
279
|
+
transformedCode =
|
|
280
|
+
transformedCode.slice(0, startIndex) + newImport + transformedCode.slice(endIndex);
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
code: transformedCode,
|
|
284
|
+
unresolvedImports,
|
|
285
|
+
groups: importGroups,
|
|
286
|
+
aliasAssignments: allAliasAssignments,
|
|
287
|
+
};
|
|
288
|
+
}export{buildGroupImportStatement,deduplicateImports,isLocalImport,mergeBindings,parseImportSpecifier};//# sourceMappingURL=import-deduplicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-deduplicator.js","sources":["../../src/dev-server/import-deduplicator.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;AAWG;AAmCH;AACA;AACA;AAEA;;;;;;;AAOG;AACH,MAAM,YAAY,GAChB,iGAAiG,CAAC;AAEpG;;AAEG;AACH,MAAM,wBAAwB,GAAG,8BAA8B,CAAC;AAEhE;AACA;AACA;AAEA;;AAEG;AACG,SAAU,aAAa,CAAC,UAAkB,EAAA;AAC9C,IAAA,OAAO,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAClE,CAAC;AAED;;;;;AAKG;AACG,SAAU,oBAAoB,CAAC,SAAiB,EAAA;AAKpD,IAAA,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;AACjC,IAAA,MAAM,MAAM,GAIR,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAErB,IAAA,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;;AAE/B,QAAA,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E,UAAU,CAAC,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACtF,KAAA;IAED,OAAO;AACL,QAAA,IAAI,EAAE,eAAe;QACrB,iBAAiB;AACjB,QAAA,MAAM,EAAE,YAAY;AACpB,QAAA,gBAAgB,EAAE,mBAAmB;KACtC,CAAC;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-deduplicator.test.d.ts","sourceRoot":"","sources":["../../src/dev-server/import-deduplicator.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-transformer.d.ts","sourceRoot":"","sources":["../../src/dev-server/import-transformer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiBlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAqNjE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {devLogError}from'./dev-logger.js';import {exportAnalyzer}from'./export-analyzer.js';import {Path}from'./path.js';import {tsconfigManager}from'./tsconfig-manager.js';let filesOrchestrator;
|
|
1
|
+
import {devLogError}from'./dev-logger.js';import {exportAnalyzer}from'./export-analyzer.js';import {deduplicateImports}from'./import-deduplicator.js';import {Path}from'./path.js';import {tsconfigManager}from'./tsconfig-manager.js';let filesOrchestrator;
|
|
2
2
|
loadFilesOrchestrator();
|
|
3
3
|
async function loadFilesOrchestrator() {
|
|
4
4
|
try {
|
|
@@ -23,86 +23,22 @@ async function loadFilesOrchestrator() {
|
|
|
23
23
|
*/
|
|
24
24
|
function transformImports(fileManager) {
|
|
25
25
|
const code = fileManager.transpiled;
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
// Create a path resolver that uses the fileManager's importMap
|
|
27
|
+
const resolveCachePath = (importPath) => {
|
|
28
|
+
if (!fileManager.importMap.has(importPath)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return findCachePathForImport(importPath, fileManager);
|
|
32
|
+
};
|
|
33
|
+
// Use the pure deduplicator for import transformation
|
|
34
|
+
const result = deduplicateImports(code, resolveCachePath, {
|
|
35
|
+
isAlias: (path) => tsconfigManager.isAlias(path),
|
|
36
|
+
});
|
|
37
|
+
let transformedCode = result.code;
|
|
38
|
+
const unresolvedImports = [...result.unresolvedImports];
|
|
36
39
|
// Pattern to match ES6 export statements
|
|
37
40
|
// Matches: export * from "..." and export { ... } from "..."
|
|
38
41
|
const exportRegex = /export\s+((?:\*|\{[^}]*\}))\s+from\s+["']([^"']+)["'];?/g;
|
|
39
|
-
let transformedCode = code;
|
|
40
|
-
const unresolvedImports = [];
|
|
41
|
-
// Process imports first
|
|
42
|
-
const importMatches = Array.from(code.matchAll(importRegex));
|
|
43
|
-
for (let i = importMatches.length - 1; i >= 0; i--) {
|
|
44
|
-
const match = importMatches[i];
|
|
45
|
-
const fullImport = match[0];
|
|
46
|
-
const importSpecifier = match[1]; // What's being imported (e.g., "{ foo }", "* as bar", "default")
|
|
47
|
-
const importPath = match[2]; // The module path
|
|
48
|
-
// Only transform relative imports and alias imports
|
|
49
|
-
// Skip external packages (node_modules, node built-ins)
|
|
50
|
-
const isRelativeImport = importPath.startsWith(".") || importPath.startsWith("/");
|
|
51
|
-
const isAliasImport = tsconfigManager.isAlias(importPath);
|
|
52
|
-
if (!isRelativeImport && !isAliasImport) {
|
|
53
|
-
// This is an external package - keep as-is
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
// Check if this import was resolved by parseImports (exists in importMap)
|
|
57
|
-
// If not in importMap, it means parseImports skipped it (external package), so we skip it too
|
|
58
|
-
if (!fileManager.importMap.has(importPath)) {
|
|
59
|
-
// Not in importMap = external package, skip transformation
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
// Find the cache path for this import
|
|
63
|
-
const cachePath = findCachePathForImport(importPath, fileManager);
|
|
64
|
-
if (!cachePath) {
|
|
65
|
-
// Could not resolve - track it (this is a local file that should exist but doesn't)
|
|
66
|
-
unresolvedImports.push(importPath);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
// Build the correct replacement depending on the import shape
|
|
70
|
-
const newImport = buildImportReplacement(importSpecifier, cachePath);
|
|
71
|
-
// Replace in code
|
|
72
|
-
const startIndex = match.index;
|
|
73
|
-
const endIndex = startIndex + fullImport.length;
|
|
74
|
-
transformedCode =
|
|
75
|
-
transformedCode.slice(0, startIndex) + newImport + transformedCode.slice(endIndex);
|
|
76
|
-
}
|
|
77
|
-
// Process side-effect imports: import "module";
|
|
78
|
-
const sideEffectMatches = Array.from(transformedCode.matchAll(sideEffectImportRegex));
|
|
79
|
-
for (let i = sideEffectMatches.length - 1; i >= 0; i--) {
|
|
80
|
-
const match = sideEffectMatches[i];
|
|
81
|
-
const fullImport = match[0];
|
|
82
|
-
const importPath = match[1];
|
|
83
|
-
// Only transform relative imports and alias imports
|
|
84
|
-
// Skip external packages (node_modules, node built-ins)
|
|
85
|
-
const isRelativeImport = importPath.startsWith(".") || importPath.startsWith("/");
|
|
86
|
-
const isAliasImport = tsconfigManager.isAlias(importPath);
|
|
87
|
-
if (!isRelativeImport && !isAliasImport) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (!fileManager.importMap.has(importPath)) {
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
const cachePath = findCachePathForImport(importPath, fileManager);
|
|
94
|
-
if (!cachePath) {
|
|
95
|
-
unresolvedImports.push(importPath);
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
// FROM: import "./themes";
|
|
99
|
-
// TO: await __import("./src-app-mail-themes.js");
|
|
100
|
-
const newImport = `await __import("./${cachePath}")`;
|
|
101
|
-
const startIndex = match.index;
|
|
102
|
-
const endIndex = startIndex + fullImport.length;
|
|
103
|
-
transformedCode =
|
|
104
|
-
transformedCode.slice(0, startIndex) + newImport + transformedCode.slice(endIndex);
|
|
105
|
-
}
|
|
106
42
|
// Process exports (need to re-process after imports to get updated string positions)
|
|
107
43
|
const exportMatches = Array.from(transformedCode.matchAll(exportRegex));
|
|
108
44
|
for (let i = exportMatches.length - 1; i >= 0; i--) {
|
|
@@ -118,14 +54,20 @@ function transformImports(fileManager) {
|
|
|
118
54
|
// This is an external package - keep as-is
|
|
119
55
|
continue;
|
|
120
56
|
}
|
|
121
|
-
// Check if this import was resolved by parseImports (exists in importMap)
|
|
122
|
-
// If not in importMap, it means parseImports skipped it (external package), so we skip it too
|
|
123
|
-
if (!fileManager.importMap.has(importPath)) {
|
|
124
|
-
// Not in importMap = external package, skip transformation
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
57
|
// Find the cache path for this import
|
|
128
|
-
|
|
58
|
+
let cachePath = findCachePathForImport(importPath, fileManager);
|
|
59
|
+
// If not in importMap but is a relative import, compute the cache path directly
|
|
60
|
+
if (!cachePath && isRelativeImport) {
|
|
61
|
+
// Resolve the relative import path from the current file's directory
|
|
62
|
+
const currentDir = Path.dirname(fileManager.relativePath);
|
|
63
|
+
let resolvedPath = Path.join(currentDir, importPath);
|
|
64
|
+
// Normalize the path and ensure it has the correct extension
|
|
65
|
+
if (!resolvedPath.endsWith(".ts") && !resolvedPath.endsWith(".tsx")) {
|
|
66
|
+
resolvedPath += ".ts";
|
|
67
|
+
}
|
|
68
|
+
// Compute cache path using the same formula as FileManager.cachePath
|
|
69
|
+
cachePath = resolvedPath.replace(/\//g, "-").replace(/\.(ts|tsx)$/, ".js");
|
|
70
|
+
}
|
|
129
71
|
if (!cachePath) {
|
|
130
72
|
// Could not resolve - track it (this is a local file that should exist but doesn't)
|
|
131
73
|
unresolvedImports.push(importPath);
|
|
@@ -211,6 +153,40 @@ function transformImports(fileManager) {
|
|
|
211
153
|
transformedCode.slice(0, startIndex) + newExport + transformedCode.slice(endIndex);
|
|
212
154
|
}
|
|
213
155
|
}
|
|
156
|
+
// Transform dynamic imports: import("./path") → __import("cache-path")
|
|
157
|
+
// This handles dynamic imports in function bodies that weren't caught by static import transformation
|
|
158
|
+
const dynamicImportRegex = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g;
|
|
159
|
+
const dynamicMatches = Array.from(transformedCode.matchAll(dynamicImportRegex));
|
|
160
|
+
for (let i = dynamicMatches.length - 1; i >= 0; i--) {
|
|
161
|
+
const match = dynamicMatches[i];
|
|
162
|
+
const fullImport = match[0];
|
|
163
|
+
const importPath = match[1];
|
|
164
|
+
// Only transform relative imports and alias imports
|
|
165
|
+
const isRelativeImport = importPath.startsWith(".") || importPath.startsWith("/");
|
|
166
|
+
const isAliasImport = tsconfigManager.isAlias(importPath);
|
|
167
|
+
if (!isRelativeImport && !isAliasImport) {
|
|
168
|
+
// External package - keep as-is
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
// Check if this import was resolved by parseImports
|
|
172
|
+
if (!fileManager.importMap.has(importPath)) {
|
|
173
|
+
// Not in importMap = external package or untracked, skip
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// Find the cache path for this import
|
|
177
|
+
const cachePath = findCachePathForImport(importPath, fileManager);
|
|
178
|
+
if (!cachePath) {
|
|
179
|
+
unresolvedImports.push(importPath);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
// Transform to __import with cache path
|
|
183
|
+
const newImport = `__import("./${cachePath}")`;
|
|
184
|
+
// Replace in code (reverse order so indices stay valid)
|
|
185
|
+
const startIndex = match.index;
|
|
186
|
+
const endIndex = startIndex + fullImport.length;
|
|
187
|
+
transformedCode =
|
|
188
|
+
transformedCode.slice(0, startIndex) + newImport + transformedCode.slice(endIndex);
|
|
189
|
+
}
|
|
214
190
|
// If there are unresolved imports, throw an error
|
|
215
191
|
if (unresolvedImports.length > 0) {
|
|
216
192
|
devLogError(`Failed to transform imports in ${fileManager.relativePath}:\n` +
|
|
@@ -220,50 +196,6 @@ function transformImports(fileManager) {
|
|
|
220
196
|
}
|
|
221
197
|
return transformedCode;
|
|
222
198
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Build a replacement statement for different import syntaxes
|
|
225
|
-
* @param importSpecifier The import specifier (e.g., "Foo", "{ a, b }", "Foo, { a, b }", "* as Bar")
|
|
226
|
-
* @param cachePath The path to the cached file
|
|
227
|
-
*/
|
|
228
|
-
function buildImportReplacement(importSpecifier, cachePath) {
|
|
229
|
-
const trimmed = importSpecifier.trim();
|
|
230
|
-
// Namespace import: import * as Foo from "module";
|
|
231
|
-
if (trimmed.startsWith("* as ")) {
|
|
232
|
-
const identifier = trimmed.replace("* as ", "").trim();
|
|
233
|
-
return `const ${identifier} = await __import("./${cachePath}")`;
|
|
234
|
-
}
|
|
235
|
-
// Mixed import: import Foo, { a, b } from "module";
|
|
236
|
-
// Transform to: const __module = await __import(...); const Foo = __module?.default ?? __module; const { a, b } = __module;
|
|
237
|
-
// Handle multiline: import Foo, {\n a,\n b\n} from "module";
|
|
238
|
-
if (trimmed.match(/^(\w+)\s*,\s*\{/)) {
|
|
239
|
-
const match = trimmed.match(/^(\w+)\s*,\s*(\{[\s\S]*?\})/);
|
|
240
|
-
if (match) {
|
|
241
|
-
const defaultImport = match[1];
|
|
242
|
-
let namedImports = match[2];
|
|
243
|
-
const moduleVar = `__module_${Math.random().toString(36).slice(2, 8)}`;
|
|
244
|
-
// Clean up whitespace and normalize
|
|
245
|
-
namedImports = namedImports.replace(/\s+/g, " ").trim();
|
|
246
|
-
// Normalize `{ default as X }` to `{ default: X }` for valid destructuring
|
|
247
|
-
const normalized = namedImports.replace(/default\s+as\s+/g, "default: ");
|
|
248
|
-
// Generate correct syntax with proper separators
|
|
249
|
-
return `const ${moduleVar} = await __import("./${cachePath}");
|
|
250
|
-
const ${defaultImport} = ${moduleVar}?.default ?? ${moduleVar};
|
|
251
|
-
const ${normalized} = ${moduleVar};`;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// Destructured / named imports (including default alias): import { a, default as X } from "module";
|
|
255
|
-
if (trimmed.startsWith("{")) {
|
|
256
|
-
// Clean up multiline formatting
|
|
257
|
-
let cleanedImports = trimmed.replace(/\s+/g, " ").trim();
|
|
258
|
-
// Normalize `{ default as X }` to `{ default: X }` for valid destructuring
|
|
259
|
-
const normalized = cleanedImports.replace(/default\s+as\s+/g, "default: ");
|
|
260
|
-
return `const ${normalized} = await __import("./${cachePath}")`;
|
|
261
|
-
}
|
|
262
|
-
// Default import: import Foo from "module";
|
|
263
|
-
// Use default with fallback to module object
|
|
264
|
-
const moduleVar = `__module_${Math.random().toString(36).slice(2, 8)}`;
|
|
265
|
-
return `const ${moduleVar} = await __import("./${cachePath}");\nconst ${trimmed} = ${moduleVar}?.default ?? ${moduleVar};`;
|
|
266
|
-
}
|
|
267
199
|
/**
|
|
268
200
|
* Find the cache path for an import
|
|
269
201
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-transformer.js","sources":["../../src/dev-server/import-transformer.ts"],"sourcesContent":[null],"names":[],"mappings":"uOAQA,IAAI,iBAAoC,CAAC;AAEzC,qBAAqB,EAAE,CAAC;AAExB,eAAe,qBAAqB,GAAA;IAClC,IAAI;AACF,QAAA,MAAM,MAAM,GAAG,MAAM,OAAO,yBAAsB,CAAC,CAAC;AACpD,QAAA,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC9C,KAAA;IAAC,OAAO,KAAK,EAAE,GAAE;AACpB,CAAC;AAED;;;;;;;;;;;;;AAaG;AACG,SAAU,gBAAgB,CAAC,WAAwB,EAAA;AACvD,IAAA,MAAM,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC;;AAGpC,IAAA,MAAM,gBAAgB,GAAG,CAAC,UAAkB,KAAmB;QAC7D,IAAI,CAAC,WAAW,CAAC,SAAS,CAA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AAQ,GAAG,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC;QAChD,eAAe;AACb,YAAA,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AACtF,KAAA;;AAGD,IAAA,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;AAChC,QAAA,WAAW,CACT,CAAA,+BAAA,EAAkC,WAAW,CAAC,YAAY,CAAK,GAAA,CAAA;AAC7D,YAAA,CAAA,oBAAA,EAAuB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAI,EAAA,CAAA;AACvD,YAAA,CAAA,mDAAA,CAAqD,CACxD,CAAC;AACF,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;AAED,IAAA,OAAO,eAAe,CAAC;AACzB,CAAC;AAqDD;;;;;;;;;;AAUG;AACH,SAAS,sBAAsB,CAAC,UAAkB,EAAE,WAAwB,EAAA;;IAE1E,MAAM,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE9D,IAAI,CAAC,eAAe,EAAE;AACpB,QAAA,OAAO,IAAI,CAAC;AACb,KAAA;;IAGD,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;;;AAItD,IAAA,OAAO,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dev-server/index.ts"],"names":[],"mappings":""}
|
|
@@ -17,10 +17,12 @@ export declare class LayerExecutor {
|
|
|
17
17
|
constructor(dependencyGraph: DependencyGraph, specialFilesCollector: SpecialFilesCollector, moduleLoader: ModuleLoader);
|
|
18
18
|
/**
|
|
19
19
|
* Execute batch reload for multiple changed files
|
|
20
|
-
* @param changedPaths Array of relative paths that changed
|
|
20
|
+
* @param changedPaths Array of relative paths that changed (code files only)
|
|
21
21
|
* @param filesMap Map of all FileManager instances
|
|
22
|
+
* @param deletedFiles Array of deleted file paths
|
|
23
|
+
* @param allChangedPaths Optional array of all changed paths including env files (for config reload)
|
|
22
24
|
*/
|
|
23
|
-
executeBatchReload(changedPaths: string[], filesMap: Map<string, FileManager>, deletedFiles: string[]): Promise<void>;
|
|
25
|
+
executeBatchReload(changedPaths: string[], filesMap: Map<string, FileManager>, deletedFiles: string[], allChangedPaths?: string[]): Promise<void>;
|
|
24
26
|
/**
|
|
25
27
|
* Determine if we need FSR or HMR
|
|
26
28
|
* FSR is needed if ANY file in the invalidation chain is FSR layer
|
|
@@ -55,6 +57,7 @@ export declare class LayerExecutor {
|
|
|
55
57
|
* Reload affected modules (for HMR)
|
|
56
58
|
* Special files (main, routes, events, locales) need to be actively reloaded
|
|
57
59
|
* Other files will be loaded on next import
|
|
60
|
+
* @returns Array of affected config file paths (for connector restart logic)
|
|
58
61
|
*/
|
|
59
62
|
private reloadAffectedModules;
|
|
60
63
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-executor.d.ts","sourceRoot":"","sources":["../../src/dev-server/layer-executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE;;;;;;;GAOG;AACH,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAFZ,eAAe,EAAE,eAAe,EAChC,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY;IAG7C;;;;;;OAMG;IACU,kBAAkB,CAC7B,YAAY,EAAE,MAAM,EAAE,EACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,YAAY,EAAE,MAAM,EAAE,EACtB,eAAe,CAAC,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC;IAiGhB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;;OAGG;YACW,wBAAwB;IAqCtC;;;OAGG;YACW,2BAA2B;IAiBzC;;OAEG;YACW,yBAAyB;IAevC;;;OAGG;YACW,wBAAwB;IAwBtC;;;;OAIG;YACW,0BAA0B;IAmDxC;;;;;OAKG;YACW,qBAAqB;CAyGpC"}
|