@ecopages/core 0.2.0-alpha.2 → 0.2.0-alpha.21
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 +26 -64
- package/README.md +212 -14
- package/package.json +116 -66
- package/src/adapters/README.md +39 -0
- package/src/adapters/abstract/application-adapter.d.ts +28 -2
- package/src/adapters/abstract/application-adapter.js +14 -2
- package/src/adapters/abstract/router-adapter.d.ts +1 -1
- package/src/adapters/abstract/server-adapter.d.ts +2 -2
- package/src/adapters/bun/client-bridge.d.ts +1 -1
- package/src/adapters/bun/create-app.d.ts +4 -12
- package/src/adapters/bun/create-app.js +4 -5
- package/src/adapters/bun/hmr-manager.d.ts +80 -21
- package/src/adapters/bun/hmr-manager.js +168 -62
- package/src/adapters/bun/index.d.ts +2 -3
- package/src/adapters/bun/index.js +3 -3
- package/src/adapters/bun/server-adapter.d.ts +5 -5
- package/src/adapters/bun/server-adapter.js +40 -34
- package/src/adapters/bun/server-lifecycle.d.ts +28 -17
- package/src/adapters/bun/server-lifecycle.js +34 -62
- package/src/{create-app.d.ts → adapters/create-app.d.ts} +9 -6
- package/src/{create-app.js → adapters/create-app.js} +4 -4
- package/src/adapters/index.d.ts +2 -6
- package/src/adapters/index.js +2 -8
- package/src/adapters/node/create-app.d.ts +6 -9
- package/src/adapters/node/create-app.js +12 -6
- package/src/adapters/node/node-client-bridge.d.ts +1 -1
- package/src/adapters/node/node-hmr-manager.d.ts +89 -18
- package/src/adapters/node/node-hmr-manager.js +185 -95
- package/src/adapters/node/server-adapter.d.ts +6 -35
- package/src/adapters/node/server-adapter.js +44 -105
- package/src/adapters/node/static-content-server.d.ts +37 -1
- package/src/adapters/node/static-content-server.js +29 -1
- package/src/adapters/shared/application-adapter.d.ts +1 -1
- package/src/{define-api-handler.d.ts → adapters/shared/define-api-handler.d.ts} +1 -1
- package/src/adapters/shared/explicit-static-route-matcher.d.ts +2 -2
- package/src/adapters/shared/explicit-static-route-matcher.js +4 -1
- package/src/adapters/shared/file-route-middleware-pipeline.d.ts +1 -1
- package/src/adapters/shared/file-route-middleware-pipeline.js +1 -0
- package/src/adapters/shared/fs-server-response-factory.d.ts +2 -2
- package/src/adapters/shared/fs-server-response-factory.js +1 -1
- package/src/adapters/shared/fs-server-response-matcher.d.ts +8 -12
- package/src/adapters/shared/fs-server-response-matcher.js +10 -18
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +55 -0
- package/src/adapters/shared/hmr-entrypoint-registrar.js +87 -0
- package/src/adapters/shared/hmr-html-response.d.ts +22 -0
- package/src/adapters/shared/hmr-html-response.js +32 -0
- package/src/adapters/shared/render-context.d.ts +2 -1
- package/src/adapters/shared/render-context.js +6 -3
- package/src/adapters/shared/runtime-bootstrap.d.ts +38 -0
- package/src/adapters/shared/runtime-bootstrap.js +43 -0
- package/src/adapters/shared/server-adapter.d.ts +13 -3
- package/src/adapters/shared/server-adapter.js +42 -5
- package/src/adapters/shared/server-route-handler.d.ts +4 -4
- package/src/adapters/shared/server-route-handler.js +6 -15
- package/src/adapters/shared/server-static-builder.d.ts +38 -6
- package/src/adapters/shared/server-static-builder.js +64 -10
- package/src/build/README.md +107 -0
- package/src/build/build-adapter.d.ts +168 -3
- package/src/build/build-adapter.js +604 -16
- package/src/build/build-manifest.d.ts +27 -0
- package/src/build/build-manifest.js +30 -0
- package/src/build/dev-build-coordinator.d.ts +72 -0
- package/src/build/dev-build-coordinator.js +154 -0
- package/src/build/esbuild-build-adapter.d.ts +15 -6
- package/src/build/esbuild-build-adapter.js +189 -74
- package/src/build/runtime-build-executor.d.ts +14 -0
- package/src/build/runtime-build-executor.js +22 -0
- package/src/build/runtime-specifier-alias-plugin.d.ts +15 -0
- package/src/build/runtime-specifier-alias-plugin.js +35 -0
- package/src/build/runtime-specifier-aliases.d.ts +5 -0
- package/src/build/runtime-specifier-aliases.js +95 -0
- package/src/config/README.md +36 -0
- package/src/config/config-builder.d.ts +52 -27
- package/src/config/config-builder.js +260 -49
- package/src/{constants.d.ts → config/constants.d.ts} +13 -0
- package/src/{constants.js → config/constants.js} +4 -0
- package/src/declarations.d.ts +19 -14
- package/src/dev/sc-server.d.ts +1 -1
- package/src/dev/sc-server.js +1 -1
- package/src/eco/README.md +70 -16
- package/src/eco/eco.browser.d.ts +2 -0
- package/src/eco/eco.browser.js +83 -0
- package/src/eco/eco.js +32 -57
- package/src/eco/eco.types.d.ts +12 -4
- package/src/eco/eco.utils.d.ts +1 -40
- package/src/eco/eco.utils.js +5 -35
- package/src/eco/global-injector-map.d.ts +1 -1
- package/src/eco/lazy-injector-map.d.ts +1 -1
- package/src/hmr/README.md +26 -0
- package/src/hmr/client/hmr-runtime.d.ts +1 -6
- package/src/hmr/client/hmr-runtime.js +30 -7
- package/src/hmr/hmr-strategy.d.ts +16 -13
- package/src/hmr/hmr-strategy.js +22 -7
- package/src/hmr/hmr.postcss.test.e2e.d.ts +1 -0
- package/src/hmr/hmr.postcss.test.e2e.js +31 -0
- package/src/hmr/hmr.test.e2e.js +26 -33
- package/src/hmr/strategies/default-hmr-strategy.d.ts +2 -2
- package/src/hmr/strategies/default-hmr-strategy.js +1 -1
- package/src/hmr/strategies/js-hmr-strategy.d.ts +46 -43
- package/src/hmr/strategies/js-hmr-strategy.js +72 -73
- package/src/index.browser.d.ts +2 -2
- package/src/index.browser.js +1 -1
- package/src/index.d.ts +4 -3
- package/src/index.js +16 -5
- package/src/integrations/ghtml/ghtml-renderer.d.ts +7 -2
- package/src/integrations/ghtml/ghtml-renderer.js +33 -30
- package/src/integrations/ghtml/ghtml.constants.d.ts +1 -0
- package/src/integrations/ghtml/ghtml.constants.js +4 -0
- package/src/integrations/ghtml/ghtml.plugin.d.ts +2 -6
- package/src/integrations/ghtml/ghtml.plugin.js +3 -4
- package/src/plugins/README.md +35 -0
- package/src/plugins/alias-resolver-plugin.js +17 -3
- package/src/plugins/eco-component-meta-plugin.d.ts +14 -1
- package/src/plugins/eco-component-meta-plugin.js +27 -21
- package/src/plugins/foreign-jsx-override-plugin.d.ts +31 -0
- package/src/plugins/foreign-jsx-override-plugin.js +35 -0
- package/src/plugins/integration-plugin.d.ts +145 -28
- package/src/plugins/integration-plugin.js +109 -13
- package/src/plugins/processor.d.ts +15 -2
- package/src/plugins/processor.js +16 -2
- package/src/plugins/runtime-capability.d.ts +9 -0
- package/src/plugins/source-transform.d.ts +46 -0
- package/src/plugins/source-transform.js +71 -0
- package/src/route-renderer/GRAPH.md +64 -98
- package/src/route-renderer/README.md +67 -46
- package/src/route-renderer/orchestration/boundary-planning.service.d.ts +25 -0
- package/src/route-renderer/orchestration/boundary-planning.service.js +97 -0
- package/src/route-renderer/orchestration/component-render-context.d.ts +83 -0
- package/src/route-renderer/orchestration/component-render-context.js +147 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +554 -0
- package/src/route-renderer/orchestration/integration-renderer.js +957 -0
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +89 -0
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +155 -0
- package/src/route-renderer/orchestration/render-execution.service.d.ts +43 -0
- package/src/route-renderer/orchestration/render-execution.service.js +106 -0
- package/src/{eco/eco.utils.ts → route-renderer/orchestration/render-output.utils.d.ts} +10 -53
- package/src/route-renderer/orchestration/render-output.utils.js +65 -0
- package/src/route-renderer/{render-preparation.service.d.ts → orchestration/render-preparation.service.d.ts} +18 -10
- package/src/route-renderer/{render-preparation.service.js → orchestration/render-preparation.service.js} +115 -17
- package/src/route-renderer/orchestration/route-shell-composer.service.d.ts +50 -0
- package/src/route-renderer/orchestration/route-shell-composer.service.js +81 -0
- package/src/route-renderer/orchestration/template-serialization.d.ts +38 -0
- package/src/route-renderer/orchestration/template-serialization.js +45 -0
- package/src/route-renderer/{dependency-resolver.d.ts → page-loading/dependency-resolver.d.ts} +15 -4
- package/src/route-renderer/{dependency-resolver.js → page-loading/dependency-resolver.js} +28 -12
- package/src/route-renderer/page-loading/page-module-loader.d.ts +90 -0
- package/src/route-renderer/{page-module-loader.js → page-loading/page-module-loader.js} +39 -14
- package/src/route-renderer/route-renderer.d.ts +45 -4
- package/src/route-renderer/route-renderer.js +38 -3
- package/src/router/README.md +97 -0
- package/src/router/client/link-intent.d.ts +53 -0
- package/src/router/client/link-intent.js +34 -0
- package/src/router/client/link-intent.test.browser.d.ts +1 -0
- package/src/router/client/link-intent.test.browser.js +43 -0
- package/src/router/client/navigation-coordinator.d.ts +149 -0
- package/src/router/client/navigation-coordinator.js +215 -0
- package/src/router/{fs-router-scanner.d.ts → server/fs-router-scanner.d.ts} +3 -3
- package/src/router/{fs-router-scanner.js → server/fs-router-scanner.js} +14 -8
- package/src/router/{fs-router.d.ts → server/fs-router.d.ts} +1 -1
- package/src/router/{fs-router.js → server/fs-router.js} +1 -1
- package/src/services/README.md +29 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +120 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset-processing.service.js +91 -10
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset.factory.d.ts +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset.factory.js +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/assets.types.d.ts +2 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +55 -0
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +48 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +20 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +41 -0
- package/src/services/assets/asset-processing-service/index.d.ts +5 -0
- package/src/services/assets/asset-processing-service/index.js +5 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.interface.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.registry.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-processor.d.ts +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-processor.js +9 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-script-processor.d.ts +5 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-script-processor.js +15 -23
- package/src/services/assets/asset-processing-service/processors/index.d.ts +5 -0
- package/src/services/assets/asset-processing-service/processors/index.js +5 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/content-script.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/content-script.processor.js +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/file-script.processor.d.ts +4 -3
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/file-script.processor.js +16 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/node-module-script.processor.d.ts +3 -3
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/node-module-script.processor.js +6 -5
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/content-stylesheet.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/content-stylesheet.processor.js +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/file-stylesheet.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/file-stylesheet.processor.js +5 -2
- package/src/services/assets/browser-bundle.service.d.ts +32 -0
- package/src/services/assets/browser-bundle.service.js +33 -0
- package/src/services/{page-request-cache-coordinator.service.d.ts → cache/page-request-cache-coordinator.service.d.ts} +2 -2
- package/src/services/{page-request-cache-coordinator.service.js → cache/page-request-cache-coordinator.service.js} +3 -1
- package/src/services/html/html-rewriter-provider.service.d.ts +37 -0
- package/src/services/html/html-rewriter-provider.service.js +68 -0
- package/src/services/html/html-transformer.service.d.ts +77 -0
- package/src/services/html/html-transformer.service.js +215 -0
- package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
- package/src/services/invalidation/development-invalidation.service.js +190 -0
- package/src/services/module-loading/app-module-loader.service.d.ts +28 -0
- package/src/services/module-loading/app-module-loader.service.js +35 -0
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +24 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +109 -0
- package/src/services/module-loading/host-module-loader-registry.d.ts +4 -0
- package/src/services/module-loading/host-module-loader-registry.js +15 -0
- package/src/services/module-loading/module-loading-types.d.ts +2 -0
- package/src/services/module-loading/node-bootstrap-plugin.d.ts +42 -0
- package/src/services/module-loading/node-bootstrap-plugin.js +204 -0
- package/src/services/module-loading/page-module-import.service.d.ts +76 -0
- package/src/services/module-loading/page-module-import.service.js +173 -0
- package/src/services/module-loading/server-module-transpiler.service.d.ts +72 -0
- package/src/services/module-loading/server-module-transpiler.service.js +64 -0
- package/src/services/runtime-state/dev-graph.service.d.ts +118 -0
- package/src/services/runtime-state/dev-graph.service.js +162 -0
- package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +41 -0
- package/src/services/runtime-state/entrypoint-dependency-graph.service.js +85 -0
- package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +69 -0
- package/src/services/runtime-state/runtime-specifier-registry.service.js +37 -0
- package/src/services/runtime-state/server-invalidation-state.service.d.ts +26 -0
- package/src/services/runtime-state/server-invalidation-state.service.js +35 -0
- package/src/services/{schema-validation-service.d.ts → validation/schema-validation-service.d.ts} +1 -1
- package/src/static-site-generator/README.md +26 -0
- package/src/static-site-generator/static-site-generator.d.ts +50 -3
- package/src/static-site-generator/static-site-generator.js +71 -5
- package/src/{internal-types.d.ts → types/internal-types.d.ts} +53 -22
- package/src/types/internal-types.js +0 -0
- package/src/{public-types.d.ts → types/public-types.d.ts} +146 -21
- package/src/types/public-types.js +0 -0
- package/src/utils/html-escaping.d.ts +7 -0
- package/src/utils/html-escaping.js +6 -0
- package/src/utils/locals-utils.d.ts +1 -1
- package/src/utils/parse-cli-args.d.ts +4 -1
- package/src/utils/parse-cli-args.js +16 -1
- package/src/utils/resolve-work-dir.d.ts +11 -0
- package/src/utils/resolve-work-dir.js +31 -0
- package/src/watchers/project-watcher.d.ts +40 -24
- package/src/watchers/project-watcher.js +129 -92
- package/src/watchers/project-watcher.test-helpers.d.ts +2 -2
- package/src/watchers/project-watcher.test-helpers.js +1 -0
- package/src/adapters/abstract/application-adapter.ts +0 -337
- package/src/adapters/abstract/router-adapter.ts +0 -30
- package/src/adapters/abstract/server-adapter.ts +0 -79
- package/src/adapters/bun/client-bridge.ts +0 -62
- package/src/adapters/bun/create-app.ts +0 -189
- package/src/adapters/bun/define-api-handler.d.ts +0 -61
- package/src/adapters/bun/define-api-handler.ts +0 -114
- package/src/adapters/bun/hmr-manager.ts +0 -281
- package/src/adapters/bun/index.ts +0 -3
- package/src/adapters/bun/server-adapter.ts +0 -492
- package/src/adapters/bun/server-lifecycle.ts +0 -154
- package/src/adapters/index.ts +0 -6
- package/src/adapters/node/create-app.ts +0 -179
- package/src/adapters/node/index.d.ts +0 -4
- package/src/adapters/node/index.js +0 -8
- package/src/adapters/node/index.ts +0 -9
- package/src/adapters/node/node-client-bridge.ts +0 -79
- package/src/adapters/node/node-hmr-manager.ts +0 -271
- package/src/adapters/node/server-adapter.ts +0 -561
- package/src/adapters/node/static-content-server.ts +0 -203
- package/src/adapters/shared/api-response.ts +0 -104
- package/src/adapters/shared/application-adapter.ts +0 -199
- package/src/adapters/shared/explicit-static-route-matcher.ts +0 -134
- package/src/adapters/shared/file-route-middleware-pipeline.ts +0 -123
- package/src/adapters/shared/fs-server-response-factory.ts +0 -118
- package/src/adapters/shared/fs-server-response-matcher.ts +0 -198
- package/src/adapters/shared/render-context.ts +0 -105
- package/src/adapters/shared/server-adapter.ts +0 -442
- package/src/adapters/shared/server-route-handler.ts +0 -166
- package/src/adapters/shared/server-static-builder.ts +0 -82
- package/src/build/build-adapter.ts +0 -132
- package/src/build/build-types.ts +0 -83
- package/src/build/esbuild-build-adapter.ts +0 -510
- package/src/config/config-builder.ts +0 -474
- package/src/constants.ts +0 -39
- package/src/create-app.ts +0 -87
- package/src/define-api-handler.js +0 -15
- package/src/define-api-handler.ts +0 -66
- package/src/dev/sc-server.ts +0 -143
- package/src/eco/component-render-context.d.ts +0 -105
- package/src/eco/component-render-context.js +0 -77
- package/src/eco/component-render-context.ts +0 -202
- package/src/eco/eco.ts +0 -221
- package/src/eco/eco.types.ts +0 -202
- package/src/eco/global-injector-map.ts +0 -112
- package/src/eco/lazy-injector-map.ts +0 -120
- package/src/eco/module-dependencies.ts +0 -75
- package/src/errors/http-error.ts +0 -72
- package/src/errors/index.ts +0 -2
- package/src/errors/locals-access-error.ts +0 -7
- package/src/global/app-logger.ts +0 -4
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-have-HMR-script-injected-in-page-1.png +0 -0
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-load-fixture-app-page-1.png +0 -0
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-WebSocket-Connection-should-connect-to-correct-HMR-endpoint-1.png +0 -0
- package/src/hmr/client/hmr-runtime.ts +0 -121
- package/src/hmr/hmr-strategy.ts +0 -172
- package/src/hmr/hmr.test.e2e.ts +0 -75
- package/src/hmr/strategies/default-hmr-strategy.ts +0 -60
- package/src/hmr/strategies/js-hmr-strategy.ts +0 -308
- package/src/index.browser.ts +0 -3
- package/src/index.ts +0 -5
- package/src/integrations/ghtml/ghtml-renderer.ts +0 -93
- package/src/integrations/ghtml/ghtml.plugin.ts +0 -32
- package/src/internal-types.ts +0 -212
- package/src/plugins/alias-resolver-plugin.ts +0 -45
- package/src/plugins/eco-component-meta-plugin.ts +0 -474
- package/src/plugins/integration-plugin.ts +0 -184
- package/src/plugins/processor.ts +0 -220
- package/src/public-types.ts +0 -1255
- package/src/route-renderer/component-graph-executor.d.ts +0 -32
- package/src/route-renderer/component-graph-executor.js +0 -31
- package/src/route-renderer/component-graph-executor.ts +0 -84
- package/src/route-renderer/component-graph.d.ts +0 -42
- package/src/route-renderer/component-graph.js +0 -72
- package/src/route-renderer/component-graph.ts +0 -159
- package/src/route-renderer/component-marker.d.ts +0 -52
- package/src/route-renderer/component-marker.js +0 -46
- package/src/route-renderer/component-marker.ts +0 -117
- package/src/route-renderer/dependency-resolver.ts +0 -596
- package/src/route-renderer/html-post-processing.service.d.ts +0 -40
- package/src/route-renderer/html-post-processing.service.js +0 -86
- package/src/route-renderer/html-post-processing.service.ts +0 -103
- package/src/route-renderer/integration-renderer.d.ts +0 -339
- package/src/route-renderer/integration-renderer.js +0 -526
- package/src/route-renderer/integration-renderer.ts +0 -696
- package/src/route-renderer/marker-graph-resolver.d.ts +0 -76
- package/src/route-renderer/marker-graph-resolver.js +0 -93
- package/src/route-renderer/marker-graph-resolver.ts +0 -153
- package/src/route-renderer/page-module-loader.d.ts +0 -61
- package/src/route-renderer/page-module-loader.ts +0 -153
- package/src/route-renderer/render-execution.service.d.ts +0 -69
- package/src/route-renderer/render-execution.service.js +0 -91
- package/src/route-renderer/render-execution.service.ts +0 -158
- package/src/route-renderer/render-preparation.service.ts +0 -358
- package/src/route-renderer/route-renderer.ts +0 -80
- package/src/router/fs-router-scanner.ts +0 -217
- package/src/router/fs-router.ts +0 -122
- package/src/services/asset-processing-service/asset-processing.service.d.ts +0 -41
- package/src/services/asset-processing-service/asset-processing.service.ts +0 -306
- package/src/services/asset-processing-service/asset.factory.ts +0 -105
- package/src/services/asset-processing-service/assets.types.ts +0 -112
- package/src/services/asset-processing-service/index.d.ts +0 -3
- package/src/services/asset-processing-service/index.js +0 -3
- package/src/services/asset-processing-service/index.ts +0 -3
- package/src/services/asset-processing-service/processor.interface.ts +0 -27
- package/src/services/asset-processing-service/processor.registry.ts +0 -18
- package/src/services/asset-processing-service/processors/base/base-processor.ts +0 -76
- package/src/services/asset-processing-service/processors/base/base-script-processor.ts +0 -105
- package/src/services/asset-processing-service/processors/index.d.ts +0 -5
- package/src/services/asset-processing-service/processors/index.js +0 -5
- package/src/services/asset-processing-service/processors/index.ts +0 -5
- package/src/services/asset-processing-service/processors/script/content-script.processor.ts +0 -66
- package/src/services/asset-processing-service/processors/script/file-script.processor.ts +0 -88
- package/src/services/asset-processing-service/processors/script/node-module-script.processor.ts +0 -84
- package/src/services/asset-processing-service/processors/stylesheet/content-stylesheet.processor.ts +0 -27
- package/src/services/asset-processing-service/processors/stylesheet/file-stylesheet.processor.ts +0 -77
- package/src/services/cache/cache.types.ts +0 -126
- package/src/services/cache/index.ts +0 -18
- package/src/services/cache/memory-cache-store.ts +0 -130
- package/src/services/cache/page-cache-service.ts +0 -202
- package/src/services/html-transformer.service.d.ts +0 -50
- package/src/services/html-transformer.service.js +0 -163
- package/src/services/html-transformer.service.ts +0 -217
- package/src/services/page-module-import.service.d.ts +0 -37
- package/src/services/page-module-import.service.js +0 -88
- package/src/services/page-module-import.service.ts +0 -129
- package/src/services/page-request-cache-coordinator.service.ts +0 -128
- package/src/services/schema-validation-service.ts +0 -204
- package/src/services/validation/standard-schema.types.ts +0 -68
- package/src/static-site-generator/static-site-generator.ts +0 -359
- package/src/utils/css.d.ts +0 -1
- package/src/utils/css.js +0 -7
- package/src/utils/css.ts +0 -5
- package/src/utils/deep-merge.ts +0 -47
- package/src/utils/hash.ts +0 -5
- package/src/utils/html.ts +0 -1
- package/src/utils/invariant.ts +0 -15
- package/src/utils/locals-utils.ts +0 -37
- package/src/utils/parse-cli-args.ts +0 -83
- package/src/utils/path-utils.module.ts +0 -14
- package/src/utils/runtime.ts +0 -44
- package/src/utils/server-utils.module.ts +0 -67
- package/src/watchers/project-watcher.test-helpers.ts +0 -40
- package/src/watchers/project-watcher.ts +0 -306
- /package/src/adapters/{bun → shared}/define-api-handler.js +0 -0
- /package/src/{internal-types.js → plugins/runtime-capability.js} +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/assets.types.js +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.interface.js +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.registry.js +0 -0
- /package/src/{public-types.js → services/module-loading/module-loading-types.js} +0 -0
- /package/src/services/{schema-validation-service.js → validation/schema-validation-service.js} +0 -0
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream';
|
|
2
|
-
import type { ApiResponseBuilder } from '
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
2
|
+
import type { ApiResponseBuilder } from '../adapters/shared/api-response.js';
|
|
3
|
+
import type { BuildExecutor } from '../build/build-adapter.js';
|
|
4
|
+
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
5
|
+
import type { ComponentBoundaryRuntime } from '../route-renderer/orchestration/component-render-context.js';
|
|
6
|
+
import type { EcoPageComponent } from '../eco/eco.types.js';
|
|
5
7
|
import type { EcoPagesAppConfig } from './internal-types.js';
|
|
6
|
-
import type { HmrStrategy } from '
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
8
|
+
import type { HmrStrategy } from '../hmr/hmr-strategy.js';
|
|
9
|
+
import type { BrowserBundleExecutor } from '../services/assets/browser-bundle.service.js';
|
|
10
|
+
import type { ProcessedAsset } from '../services/assets/asset-processing-service/assets.types.js';
|
|
11
|
+
import type { CacheStats, CacheStrategy } from '../services/cache/cache.types.js';
|
|
9
12
|
import type { InteractionEventsString as ScriptsInjectorInteractionEventsString } from '@ecopages/scripts-injector/types';
|
|
10
|
-
export type {
|
|
11
|
-
|
|
12
|
-
export type {
|
|
13
|
+
export type { EcoPagesAppConfig } from './internal-types.js';
|
|
14
|
+
export type { EcoPageComponent } from '../eco/eco.types.js';
|
|
15
|
+
export type { ProcessedAsset } from '../services/assets/asset-processing-service/assets.types.js';
|
|
16
|
+
import type { StandardSchema, StandardSchemaResult, StandardSchemaSuccessResult, StandardSchemaFailureResult, StandardSchemaIssue, InferOutput } from '../services/validation/standard-schema.types.js';
|
|
17
|
+
export type { StandardSchema, StandardSchemaResult, StandardSchemaSuccessResult, StandardSchemaFailureResult, StandardSchemaIssue, InferOutput, ComponentBoundaryRuntime, };
|
|
13
18
|
export type InteractionEventsString = ScriptsInjectorInteractionEventsString;
|
|
14
19
|
export type DependencyLazyTrigger = {
|
|
15
20
|
'on:idle': true;
|
|
@@ -82,7 +87,7 @@ export interface CacheInvalidator {
|
|
|
82
87
|
}
|
|
83
88
|
/**
|
|
84
89
|
* Context interface for HMR strategies.
|
|
85
|
-
* Provides access to watched files, specifier mappings, and build configuration.
|
|
90
|
+
* Provides access to watched files, registered bare-specifier mappings, and build configuration.
|
|
86
91
|
*/
|
|
87
92
|
export interface DefaultHmrContext {
|
|
88
93
|
/**
|
|
@@ -90,7 +95,7 @@ export interface DefaultHmrContext {
|
|
|
90
95
|
*/
|
|
91
96
|
getWatchedFiles(): Map<string, string>;
|
|
92
97
|
/**
|
|
93
|
-
* Map of bare specifiers to
|
|
98
|
+
* Map of bare specifiers to runtime URLs for browser import resolution.
|
|
94
99
|
*/
|
|
95
100
|
getSpecifierMap(): Map<string, string>;
|
|
96
101
|
/**
|
|
@@ -115,6 +120,18 @@ export interface DefaultHmrContext {
|
|
|
115
120
|
* Used by plugins to identify page files for transformation.
|
|
116
121
|
*/
|
|
117
122
|
getPagesDir(): string;
|
|
123
|
+
/**
|
|
124
|
+
* Build executor owned by the active app/runtime.
|
|
125
|
+
*/
|
|
126
|
+
getBuildExecutor(): BuildExecutor;
|
|
127
|
+
/**
|
|
128
|
+
* Browser bundler owned by the active app/runtime.
|
|
129
|
+
*/
|
|
130
|
+
getBrowserBundleService(): BrowserBundleExecutor;
|
|
131
|
+
/**
|
|
132
|
+
* Server-side module loader owned by the active app/runtime.
|
|
133
|
+
*/
|
|
134
|
+
importServerModule<T = unknown>(filePath: string): Promise<T>;
|
|
118
135
|
}
|
|
119
136
|
/**
|
|
120
137
|
* Represents an event broadcast to connected clients via the ClientBridge.
|
|
@@ -155,11 +172,29 @@ export interface IClientBridge {
|
|
|
155
172
|
*/
|
|
156
173
|
export interface IHmrManager {
|
|
157
174
|
/**
|
|
158
|
-
* Registers
|
|
175
|
+
* Registers an integration-owned client entrypoint to be built and watched.
|
|
176
|
+
*
|
|
177
|
+
* @remarks
|
|
178
|
+
* This path is strict: the owning integration must emit the expected `_hmr`
|
|
179
|
+
* bundle. Missing output is treated as a development pipeline failure.
|
|
159
180
|
*/
|
|
160
181
|
registerEntrypoint(entrypointPath: string): Promise<string>;
|
|
161
182
|
/**
|
|
162
|
-
* Registers
|
|
183
|
+
* Registers a generic script asset entrypoint to be built and watched.
|
|
184
|
+
*
|
|
185
|
+
* @remarks
|
|
186
|
+
* This path exists for non-page script assets that are not owned by a
|
|
187
|
+
* framework integration. Unlike `registerEntrypoint()`, it may use the generic
|
|
188
|
+
* script bundling path.
|
|
189
|
+
*/
|
|
190
|
+
registerScriptEntrypoint(entrypointPath: string): Promise<string>;
|
|
191
|
+
/**
|
|
192
|
+
* Registers mappings from bare specifiers to runtime URLs.
|
|
193
|
+
*
|
|
194
|
+
* @remarks
|
|
195
|
+
* This is the shared registration seam for integration-owned runtime alias
|
|
196
|
+
* maps. The registry may later back a broader import-map-style facility, but
|
|
197
|
+
* the mappings themselves remain integration-owned.
|
|
163
198
|
*/
|
|
164
199
|
registerSpecifierMap(map: Record<string, string>): void;
|
|
165
200
|
/**
|
|
@@ -191,7 +226,7 @@ export interface IHmrManager {
|
|
|
191
226
|
*/
|
|
192
227
|
getWatchedFiles(): Map<string, string>;
|
|
193
228
|
/**
|
|
194
|
-
* Gets the specifier map.
|
|
229
|
+
* Gets the registered bare-specifier map.
|
|
195
230
|
*/
|
|
196
231
|
getSpecifierMap(): Map<string, string>;
|
|
197
232
|
/**
|
|
@@ -227,6 +262,21 @@ export type EcoComponentDependencies = {
|
|
|
227
262
|
components?: EcoComponent[];
|
|
228
263
|
};
|
|
229
264
|
export type EcoPagesElement = string | Promise<string>;
|
|
265
|
+
/**
|
|
266
|
+
* Serializable child payloads accepted by cross-integration deferred rendering.
|
|
267
|
+
*
|
|
268
|
+
* This models the broad value shapes that EcoPages already flattens when a
|
|
269
|
+
* foreign component boundary serializes its children for another integration.
|
|
270
|
+
* It is intentionally transport-oriented rather than framework-native, so it
|
|
271
|
+
* can be shared across Kita, Lit, React, and Ecopages JSX authoring surfaces
|
|
272
|
+
* without coupling core types to any one renderer.
|
|
273
|
+
*/
|
|
274
|
+
export type EcoChildren = string | Promise<string> | number | bigint | boolean | null | undefined | readonly EcoChildren[] | {
|
|
275
|
+
strings: readonly string[];
|
|
276
|
+
values?: readonly EcoChildren[];
|
|
277
|
+
} | {
|
|
278
|
+
[key: string]: EcoChildren;
|
|
279
|
+
};
|
|
230
280
|
/**
|
|
231
281
|
* Represents the input configuration for EcoPages.
|
|
232
282
|
*/
|
|
@@ -280,7 +330,7 @@ export type EcoComponentConfig = {
|
|
|
280
330
|
* MyPage.config = { layout: Layout };
|
|
281
331
|
* ```
|
|
282
332
|
*/
|
|
283
|
-
layout?:
|
|
333
|
+
layout?: EcoPageLayoutComponent<any>;
|
|
284
334
|
dependencies?: EcoComponentDependencies;
|
|
285
335
|
/**
|
|
286
336
|
* Internal: Resolved lazy scripts grouped by trigger.
|
|
@@ -389,6 +439,12 @@ export interface PageHeadProps<T = EcoPagesElement> {
|
|
|
389
439
|
dependencies?: EcoComponentDependencies;
|
|
390
440
|
children?: T;
|
|
391
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Represents the props for a route layout.
|
|
444
|
+
*/
|
|
445
|
+
export interface LayoutProps<T = EcoPagesElement> extends Partial<RequestPageContext> {
|
|
446
|
+
children: T;
|
|
447
|
+
}
|
|
392
448
|
/**
|
|
393
449
|
* Represents the props for the HTML template of a page.
|
|
394
450
|
*/
|
|
@@ -398,6 +454,21 @@ export interface HtmlTemplateProps extends PageHeadProps {
|
|
|
398
454
|
headContent?: EcoPagesElement;
|
|
399
455
|
pageProps: Record<string, unknown>;
|
|
400
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Layout components accepted by pages.
|
|
459
|
+
*
|
|
460
|
+
* This preserves compatibility with existing `eco.component()` layouts while
|
|
461
|
+
* also supporting semantic `eco.layout()` declarations.
|
|
462
|
+
*/
|
|
463
|
+
export type EcoPageLayoutComponent<T = EcoPagesElement> = EcoLayoutComponent<T> | EcoComponent<any, T>;
|
|
464
|
+
/**
|
|
465
|
+
* Represents a layout component created with eco.layout().
|
|
466
|
+
*/
|
|
467
|
+
export type EcoLayoutComponent<T = EcoPagesElement> = EcoComponent<LayoutProps<T>, T>;
|
|
468
|
+
/**
|
|
469
|
+
* Represents an HTML shell component created with eco.html().
|
|
470
|
+
*/
|
|
471
|
+
export type EcoHtmlComponent<T = EcoPagesElement> = EcoComponent<HtmlTemplateProps, T>;
|
|
401
472
|
/**
|
|
402
473
|
* Represents the props for the error 404 template.
|
|
403
474
|
*/
|
|
@@ -598,21 +669,75 @@ type StylesheetContentIntegrationPluginDependencies = {
|
|
|
598
669
|
export type IntegrationRendererRenderOptions<C = EcoPagesElement> = RouteRendererOptions & {
|
|
599
670
|
props?: Record<string, unknown>;
|
|
600
671
|
metadata: PageMetadataProps;
|
|
601
|
-
HtmlTemplate:
|
|
672
|
+
HtmlTemplate: EcoHtmlComponent<C>;
|
|
602
673
|
Page: EcoComponent<PageProps, C>;
|
|
603
|
-
Layout?:
|
|
674
|
+
Layout?: EcoPageLayoutComponent<any>;
|
|
604
675
|
dependencies?: EcoComponentDependencies;
|
|
605
676
|
resolvedDependencies: ProcessedAsset[];
|
|
606
677
|
componentRender?: ComponentRenderResult;
|
|
607
678
|
pageProps?: Record<string, unknown>;
|
|
608
679
|
cacheStrategy?: CacheStrategy;
|
|
609
680
|
pageLocals?: RequestLocals;
|
|
681
|
+
boundaryPlan?: BoundaryPlan;
|
|
682
|
+
};
|
|
683
|
+
export type BoundaryValidationErrorCode = 'UNKNOWN_INTEGRATION_OWNER' | 'MISSING_COMPONENT_METADATA';
|
|
684
|
+
export interface BoundaryValidationError {
|
|
685
|
+
code: BoundaryValidationErrorCode;
|
|
686
|
+
message: string;
|
|
687
|
+
componentId?: string;
|
|
688
|
+
componentFile?: string;
|
|
689
|
+
integrationName?: string;
|
|
690
|
+
}
|
|
691
|
+
export type BoundaryPlanNodeSource = 'route' | 'page' | 'layout' | 'html-template' | 'dependency';
|
|
692
|
+
export interface BoundaryOwnership {
|
|
693
|
+
integrationName: string;
|
|
694
|
+
componentId: string;
|
|
695
|
+
componentFile?: string;
|
|
696
|
+
isPageEntry: boolean;
|
|
697
|
+
isForeignToParent: boolean;
|
|
698
|
+
}
|
|
699
|
+
export interface BoundaryPlanNode {
|
|
700
|
+
id: string;
|
|
701
|
+
source: BoundaryPlanNodeSource;
|
|
702
|
+
ownership: BoundaryOwnership;
|
|
703
|
+
children: BoundaryPlanNode[];
|
|
704
|
+
declaredDependenciesValid: boolean;
|
|
705
|
+
}
|
|
706
|
+
export interface BoundaryPlan {
|
|
707
|
+
root: BoundaryPlanNode;
|
|
708
|
+
rendererNames: string[];
|
|
709
|
+
foreignEdgeCount: number;
|
|
710
|
+
hasValidationErrors: boolean;
|
|
711
|
+
validationErrors: BoundaryValidationError[];
|
|
712
|
+
}
|
|
713
|
+
export type BoundaryAttachmentPolicy = {
|
|
714
|
+
kind: 'none';
|
|
715
|
+
} | {
|
|
716
|
+
kind: 'first-element';
|
|
610
717
|
};
|
|
611
|
-
export interface
|
|
718
|
+
export interface BoundaryRenderPayload {
|
|
719
|
+
html: string;
|
|
720
|
+
assets: ProcessedAsset[];
|
|
721
|
+
rootTag?: string;
|
|
722
|
+
rootAttributes?: Record<string, string>;
|
|
723
|
+
attachmentPolicy: BoundaryAttachmentPolicy;
|
|
724
|
+
integrationName: string;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Shared execution-scoped context threaded through component boundary renders.
|
|
728
|
+
*
|
|
729
|
+
* Integrations can extend this with renderer-local runtime keys, but the cache
|
|
730
|
+
* and optional component instance identity are shared across all renderers.
|
|
731
|
+
*/
|
|
732
|
+
export interface BaseIntegrationContext {
|
|
733
|
+
rendererCache?: Map<string, unknown>;
|
|
734
|
+
componentInstanceId?: string;
|
|
735
|
+
}
|
|
736
|
+
export interface ComponentRenderInput<TIntegrationContext extends BaseIntegrationContext = BaseIntegrationContext> {
|
|
612
737
|
component: EcoComponent;
|
|
613
738
|
props: Record<string, unknown>;
|
|
614
|
-
children?:
|
|
615
|
-
integrationContext?:
|
|
739
|
+
children?: unknown;
|
|
740
|
+
integrationContext?: TIntegrationContext;
|
|
616
741
|
}
|
|
617
742
|
export interface ComponentRenderResult {
|
|
618
743
|
html: string;
|
|
@@ -669,7 +794,7 @@ export interface RenderContext {
|
|
|
669
794
|
* @param props - Props to pass to the view
|
|
670
795
|
* @param options - Optional status code and headers
|
|
671
796
|
*/
|
|
672
|
-
render<P = Record<string, unknown>>(view: EcoComponent<P>, props
|
|
797
|
+
render<P = Record<string, unknown>>(view: EcoComponent<P>, props?: P, options?: RenderOptions): Promise<Response>;
|
|
673
798
|
/**
|
|
674
799
|
* Render an eco.page view without layout (for partials/fragments).
|
|
675
800
|
* @param view - The eco.page component to render
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiHandlerContext } from '../public-types.js';
|
|
1
|
+
import type { ApiHandlerContext } from '../types/public-types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a require function for validating and retrieving request locals.
|
|
4
4
|
* Supports both single key access and multiple keys with type safety.
|
|
@@ -17,8 +17,11 @@ export type ReturnParseCliArgs = {
|
|
|
17
17
|
hostname?: string;
|
|
18
18
|
reactFastRefresh?: boolean;
|
|
19
19
|
};
|
|
20
|
+
export type ParseCliArgsOptions = {
|
|
21
|
+
embeddedRuntime?: boolean;
|
|
22
|
+
};
|
|
20
23
|
/**
|
|
21
24
|
* Parses command line arguments for the server.
|
|
22
25
|
* It returns {@link ReturnParseCliArgs}
|
|
23
26
|
*/
|
|
24
|
-
export declare function parseCliArgs(): ReturnParseCliArgs;
|
|
27
|
+
export declare function parseCliArgs(options?: ParseCliArgsOptions): ReturnParseCliArgs;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { getRuntimeArgv } from "./runtime.js";
|
|
3
|
+
function getEmbeddedRuntimeCommandOptions() {
|
|
4
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
5
|
+
return {
|
|
6
|
+
preview: false,
|
|
7
|
+
build: false,
|
|
8
|
+
start: !isDevelopment,
|
|
9
|
+
dev: isDevelopment,
|
|
10
|
+
port: void 0,
|
|
11
|
+
hostname: void 0,
|
|
12
|
+
reactFastRefresh: void 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
3
15
|
const ECOPAGES_BIN_FILES = ["ecopages.ts", "ecopages.js", "cli.js"];
|
|
4
16
|
const ECOPAGES_AVAILABLE_COMMANDS = ["dev", "build", "start", "preview"];
|
|
5
|
-
function parseCliArgs() {
|
|
17
|
+
function parseCliArgs(options = {}) {
|
|
18
|
+
if (options.embeddedRuntime || process.env.ECOPAGES_INTERNAL_EMBEDDED_RUNTIME === "true") {
|
|
19
|
+
return getEmbeddedRuntimeCommandOptions();
|
|
20
|
+
}
|
|
6
21
|
const runtimeArgv = getRuntimeArgv();
|
|
7
22
|
const { values } = parseArgs({
|
|
8
23
|
args: runtimeArgv,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type InternalPathConfig = {
|
|
2
|
+
rootDir?: string;
|
|
3
|
+
workDir?: string;
|
|
4
|
+
absolutePaths?: {
|
|
5
|
+
workDir?: string;
|
|
6
|
+
distDir?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function resolveInternalWorkDir(appConfig: InternalPathConfig): string;
|
|
10
|
+
export declare function resolveInternalExecutionDir(appConfig: InternalPathConfig): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { DEFAULT_ECOPAGES_WORK_DIR } from "../config/constants.js";
|
|
3
|
+
function isInsideNodeModules(directory) {
|
|
4
|
+
return path.normalize(directory).split(path.sep).includes("node_modules");
|
|
5
|
+
}
|
|
6
|
+
function resolveInternalWorkDir(appConfig) {
|
|
7
|
+
if (appConfig.absolutePaths?.workDir) {
|
|
8
|
+
return appConfig.absolutePaths.workDir;
|
|
9
|
+
}
|
|
10
|
+
if (appConfig.rootDir) {
|
|
11
|
+
return path.join(appConfig.rootDir, appConfig.workDir ?? DEFAULT_ECOPAGES_WORK_DIR);
|
|
12
|
+
}
|
|
13
|
+
if (appConfig.workDir) {
|
|
14
|
+
return appConfig.workDir;
|
|
15
|
+
}
|
|
16
|
+
return DEFAULT_ECOPAGES_WORK_DIR;
|
|
17
|
+
}
|
|
18
|
+
function resolveInternalExecutionDir(appConfig) {
|
|
19
|
+
const workDir = resolveInternalWorkDir(appConfig);
|
|
20
|
+
if (!isInsideNodeModules(workDir)) {
|
|
21
|
+
return workDir;
|
|
22
|
+
}
|
|
23
|
+
if (appConfig.rootDir) {
|
|
24
|
+
return path.join(appConfig.rootDir, DEFAULT_ECOPAGES_WORK_DIR);
|
|
25
|
+
}
|
|
26
|
+
return DEFAULT_ECOPAGES_WORK_DIR;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
resolveInternalExecutionDir,
|
|
30
|
+
resolveInternalWorkDir
|
|
31
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { type FSWatcher } from 'chokidar';
|
|
2
|
-
import type { EcoPagesAppConfig, IHmrManager, IClientBridge } from '../internal-types.js';
|
|
2
|
+
import type { EcoPagesAppConfig, IHmrManager, IClientBridge } from '../types/internal-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Configuration options for the ProjectWatcher
|
|
5
5
|
* @interface ProjectWatcherConfig
|
|
6
6
|
* @property {EcoPagesAppConfig} config - The application configuration
|
|
7
|
-
* @property {() => void} refreshRouterRoutesCallback - Callback to refresh router routes
|
|
7
|
+
* @property {() => Promise<void>} refreshRouterRoutesCallback - Callback to refresh router routes
|
|
8
8
|
* @property {IHmrManager} hmrManager - The HMR manager instance
|
|
9
9
|
* @property {ClientBridge} bridge - The client bridge instance
|
|
10
10
|
*/
|
|
11
11
|
export interface ProjectWatcherConfig {
|
|
12
12
|
config: EcoPagesAppConfig;
|
|
13
|
-
refreshRouterRoutesCallback: () => void
|
|
13
|
+
refreshRouterRoutesCallback: () => Promise<void>;
|
|
14
14
|
hmrManager: IHmrManager;
|
|
15
15
|
bridge: IClientBridge;
|
|
16
16
|
}
|
|
@@ -42,8 +42,10 @@ export declare class ProjectWatcher {
|
|
|
42
42
|
private refreshRouterRoutesCallback;
|
|
43
43
|
private hmrManager;
|
|
44
44
|
private bridge;
|
|
45
|
+
private readonly invalidationService;
|
|
45
46
|
private watcher;
|
|
46
47
|
private lastHandledChange;
|
|
48
|
+
private changeQueue;
|
|
47
49
|
constructor({ config, refreshRouterRoutesCallback, hmrManager, bridge }: ProjectWatcherConfig);
|
|
48
50
|
/**
|
|
49
51
|
* Uncaches modules in the source directory to ensure fresh imports.
|
|
@@ -51,24 +53,45 @@ export declare class ProjectWatcher {
|
|
|
51
53
|
* @private
|
|
52
54
|
*/
|
|
53
55
|
private uncacheModules;
|
|
56
|
+
private isRouteSourceFile;
|
|
57
|
+
private isIncludeSourceFile;
|
|
54
58
|
/**
|
|
55
59
|
* Handles public directory file changes by copying only the changed file.
|
|
56
60
|
* @param filePath - Absolute path of the changed file
|
|
57
61
|
*/
|
|
58
62
|
private handlePublicDirFileChange;
|
|
63
|
+
/**
|
|
64
|
+
* Serializes file change handling so that concurrent chokidar events are
|
|
65
|
+
* processed one at a time, preventing overlapping builds and race conditions.
|
|
66
|
+
*/
|
|
67
|
+
private enqueueChange;
|
|
59
68
|
/**
|
|
60
69
|
* Handles file changes by uncaching modules, refreshing routes, and delegating appropriately.
|
|
61
|
-
* Follows
|
|
62
|
-
* 0. Public directory match?
|
|
63
|
-
* 1. additionalWatchPaths match?
|
|
64
|
-
* 2.
|
|
65
|
-
* 3.
|
|
70
|
+
* Follows 5-rule priority:
|
|
71
|
+
* 0. Public directory match? -> copy file and reload
|
|
72
|
+
* 1. additionalWatchPaths match? -> reload
|
|
73
|
+
* 2. Include template source? -> reload after processor notifications
|
|
74
|
+
* 3. Processor-owned asset? -> processor already handled it via notification, skip HMR
|
|
75
|
+
* 4. Otherwise -> HMR strategies
|
|
76
|
+
*
|
|
77
|
+
* Processors that watch a file extension as a dependency (e.g. PostCSS watching
|
|
78
|
+
* .tsx for Tailwind class scanning) are always notified first, but do not
|
|
79
|
+
* prevent the file from flowing through the normal HMR strategy pipeline.
|
|
66
80
|
*
|
|
67
81
|
* Duplicate identical watcher events for the same file are coalesced within a
|
|
68
82
|
* short window before any of the priority rules run.
|
|
69
83
|
* @param rawPath - Path of the changed file
|
|
84
|
+
* @param event - The type of file system event
|
|
70
85
|
*/
|
|
71
86
|
private handleFileChange;
|
|
87
|
+
/**
|
|
88
|
+
* Notifies all processors whose watch config matches the given file extension.
|
|
89
|
+
* This is called before checking processor ownership so that dependency-only
|
|
90
|
+
* processors (e.g. PostCSS watching .tsx for class scanning) receive their
|
|
91
|
+
* notifications regardless of whether they own the file.
|
|
92
|
+
*/
|
|
93
|
+
private notifyProcessors;
|
|
94
|
+
private getProcessorHandler;
|
|
72
95
|
/**
|
|
73
96
|
* Checks if a file is in the public directory.
|
|
74
97
|
*/
|
|
@@ -79,7 +102,8 @@ export declare class ProjectWatcher {
|
|
|
79
102
|
private matchesAdditionalWatchPaths;
|
|
80
103
|
/**
|
|
81
104
|
* Checks if a file is handled by a processor.
|
|
82
|
-
* Processors that declare
|
|
105
|
+
* Processors that declare asset capabilities own those file types.
|
|
106
|
+
* Processors without capabilities fall back to checking watch extensions.
|
|
83
107
|
*/
|
|
84
108
|
private isHandledByProcessor;
|
|
85
109
|
/**
|
|
@@ -88,30 +112,22 @@ export declare class ProjectWatcher {
|
|
|
88
112
|
*
|
|
89
113
|
* @param {string} path - Path of the changed directory
|
|
90
114
|
*/
|
|
91
|
-
triggerRouterRefresh(
|
|
115
|
+
triggerRouterRefresh(changedPath: string): Promise<void>;
|
|
92
116
|
/**
|
|
93
117
|
* Handles and logs errors that occur during file watching.
|
|
94
118
|
*
|
|
95
119
|
* @param {unknown} error - The error to handle
|
|
96
120
|
*/
|
|
97
121
|
handleError(error: unknown): void;
|
|
98
|
-
/**
|
|
99
|
-
* Processes file changes for specific file extensions.
|
|
100
|
-
* Used by processors to handle their specific file types.
|
|
101
|
-
*
|
|
102
|
-
* @private
|
|
103
|
-
* @param {string} path - Path of the changed file
|
|
104
|
-
* @param {string[]} extensions - File extensions to process
|
|
105
|
-
* @param {(ctx: ProcessorWatchContext) => void} handler - Handler function for the file change
|
|
106
|
-
*/
|
|
107
|
-
private shouldProcess;
|
|
108
122
|
/**
|
|
109
123
|
* Creates and configures the file system watcher.
|
|
110
124
|
* This sets up:
|
|
111
|
-
* 1.
|
|
112
|
-
* 2.
|
|
113
|
-
* 3.
|
|
114
|
-
*
|
|
125
|
+
* 1. Page file watching
|
|
126
|
+
* 2. Directory watching
|
|
127
|
+
* 3. Error handling
|
|
128
|
+
*
|
|
129
|
+
* Processor notifications are dispatched inside handleFileChange, ensuring
|
|
130
|
+
* a single unified event pipeline with no parallel chokidar bindings.
|
|
115
131
|
*
|
|
116
132
|
* Uses chokidar's built-in debouncing through `awaitWriteFinish` to handle
|
|
117
133
|
* rapid file changes efficiently.
|