@ecopages/core 0.2.0-beta.3 → 0.2.0-beta.30
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/README.md +38 -9
- package/package.json +241 -30
- package/src/adapters/README.md +6 -2
- package/src/adapters/abstract/application-adapter.d.ts +123 -6
- package/src/adapters/abstract/application-adapter.js +151 -1
- package/src/adapters/abstract/segment-path-matcher.d.ts +6 -0
- package/src/adapters/abstract/segment-path-matcher.js +149 -0
- package/src/adapters/abstract/server-adapter.d.ts +16 -2
- package/src/adapters/abstract/ws-pattern-matcher.d.ts +12 -0
- package/src/adapters/abstract/ws-pattern-matcher.js +30 -0
- package/src/adapters/bun/bun-user-websocket-lifecycle.d.ts +22 -0
- package/src/adapters/bun/bun-user-websocket-lifecycle.js +96 -0
- package/src/adapters/bun/client-bridge.d.ts +1 -0
- package/src/adapters/bun/client-bridge.js +3 -0
- package/src/adapters/bun/create-app.d.ts +9 -6
- package/src/adapters/bun/create-app.js +76 -45
- package/src/adapters/bun/hmr-manager.d.ts +1 -1
- package/src/adapters/bun/hmr-manager.js +1 -1
- package/src/adapters/bun/index.d.ts +1 -1
- package/src/adapters/bun/index.js +25 -2
- package/src/adapters/bun/runtime-host.d.ts +1 -1
- package/src/adapters/bun/runtime-host.js +1 -1
- package/src/adapters/bun/server-adapter.d.ts +92 -41
- package/src/adapters/bun/server-adapter.js +256 -117
- package/src/adapters/bun/static-preview-host.d.ts +1 -1
- package/src/adapters/bun/static-preview-host.js +25 -20
- package/src/adapters/create-app.d.ts +13 -11
- package/src/adapters/create-app.js +2 -51
- package/src/adapters/index.d.ts +2 -2
- package/src/adapters/index.js +26 -4
- package/src/adapters/node/create-app.d.ts +8 -3
- package/src/adapters/node/create-app.js +61 -13
- package/src/adapters/node/node-client-bridge.d.ts +1 -0
- package/src/adapters/node/node-client-bridge.js +3 -0
- package/src/adapters/node/node-hmr-manager.d.ts +1 -1
- package/src/adapters/node/node-hmr-manager.js +1 -1
- package/src/adapters/node/runtime-host.d.ts +1 -1
- package/src/adapters/node/runtime-host.js +1 -1
- package/src/adapters/node/server-adapter-dependencies.js +4 -0
- package/src/adapters/node/server-adapter.d.ts +64 -23
- package/src/adapters/node/server-adapter.js +169 -142
- package/src/adapters/node/static-content-server.d.ts +1 -0
- package/src/adapters/node/static-content-server.js +10 -2
- package/src/adapters/node/static-preview-host.d.ts +1 -1
- package/src/adapters/node/static-preview-host.js +27 -12
- package/src/adapters/shared/{hmr-entrypoint-registrar.d.ts → hmr/hmr-entrypoint-registrar.d.ts} +31 -30
- package/src/adapters/shared/hmr/hmr-entrypoint-registrar.js +106 -0
- package/src/adapters/shared/{hmr-html-response.d.ts → hmr/hmr-html-response.d.ts} +2 -2
- package/src/adapters/shared/{hmr-html-response.js → hmr/hmr-html-response.js} +4 -1
- package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +101 -0
- package/src/adapters/shared/hmr/shared-hmr-manager.js +432 -0
- package/src/adapters/shared/http/api-request-pipeline.d.ts +23 -0
- package/src/adapters/shared/http/api-request-pipeline.js +129 -0
- package/src/adapters/shared/{api-response.d.ts → http/api-response.d.ts} +1 -1
- package/src/adapters/shared/{api-response.js → http/api-response.js} +6 -23
- package/src/adapters/shared/http/create-body-response.d.ts +12 -0
- package/src/adapters/shared/http/create-body-response.js +23 -0
- package/src/adapters/shared/http/define-api-handler.d.ts +90 -0
- package/src/adapters/shared/http/define-api-handler.js +63 -0
- package/src/adapters/shared/{explicit-static-render-preparation.d.ts → http/explicit-static-render-preparation.d.ts} +3 -3
- package/src/adapters/shared/{explicit-static-route-matcher.d.ts → http/explicit-static-route-matcher.d.ts} +3 -9
- package/src/adapters/shared/{explicit-static-route-matcher.js → http/explicit-static-route-matcher.js} +3 -38
- package/src/adapters/shared/{file-route-middleware-pipeline.d.ts → http/file-route-middleware-pipeline.d.ts} +2 -2
- package/src/adapters/shared/{file-route-middleware-pipeline.js → http/file-route-middleware-pipeline.js} +10 -22
- package/src/adapters/shared/{fs-server-response-factory.d.ts → http/fs-server-response-factory.d.ts} +7 -2
- package/src/adapters/shared/{fs-server-response-factory.js → http/fs-server-response-factory.js} +22 -2
- package/src/adapters/shared/{fs-server-response-matcher.d.ts → http/fs-server-response-matcher.d.ts} +25 -5
- package/src/adapters/shared/{fs-server-response-matcher.js → http/fs-server-response-matcher.js} +109 -27
- package/src/adapters/shared/http/run-middleware-chain.d.ts +5 -0
- package/src/adapters/shared/http/run-middleware-chain.js +17 -0
- package/src/adapters/shared/{application-adapter.d.ts → runtime/application-adapter.d.ts} +2 -2
- package/src/adapters/shared/{application-adapter.js → runtime/application-adapter.js} +1 -1
- package/src/adapters/shared/runtime/copy-runtime-public-dir.d.ts +6 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +24 -0
- package/src/adapters/shared/runtime/port-manager.d.ts +116 -0
- package/src/adapters/shared/runtime/port-manager.js +196 -0
- package/src/adapters/shared/{render-context.d.ts → runtime/render-context.d.ts} +2 -2
- package/src/adapters/shared/{render-context.js → runtime/render-context.js} +8 -17
- package/src/adapters/shared/{runtime-app-bootstrap.d.ts → runtime/runtime-app-bootstrap.d.ts} +4 -3
- package/src/adapters/shared/{runtime-app-bootstrap.js → runtime/runtime-app-bootstrap.js} +4 -7
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +46 -0
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +57 -0
- package/src/adapters/shared/{server-adapter.d.ts → runtime/server-adapter.d.ts} +23 -49
- package/src/adapters/shared/runtime/server-adapter.js +226 -0
- package/src/adapters/shared/{server-route-handler.d.ts → runtime/server-route-handler.d.ts} +6 -33
- package/src/adapters/shared/{server-route-handler.js → runtime/server-route-handler.js} +5 -43
- package/src/adapters/shared/{server-static-builder.d.ts → runtime/server-static-builder.d.ts} +27 -35
- package/src/adapters/shared/runtime/server-static-builder.js +191 -0
- package/src/adapters/shared/{static-preview-host.d.ts → runtime/static-preview-host.d.ts} +6 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +21 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +100 -0
- package/src/adapters/shared/ws/websocket-lifecycle.d.ts +24 -0
- package/src/adapters/shared/ws/websocket-lifecycle.js +55 -0
- package/src/build/README.md +140 -31
- package/src/build/app-build-manifest-runtime.d.ts +39 -0
- package/src/build/app-build-manifest-runtime.js +124 -0
- package/src/build/{browser-runtime-plugin.d.ts → browser/browser-runtime-plugin.d.ts} +1 -1
- package/src/build/{browser-runtime-plugin.js → browser/browser-runtime-plugin.js} +1 -1
- package/src/build/browser/jsx-ownership-plugins.d.ts +24 -0
- package/src/build/browser/jsx-ownership-plugins.js +41 -0
- package/src/build/browser/lit-static-render-worker-context.d.ts +2 -0
- package/src/build/browser/lit-static-render-worker-context.js +6 -0
- package/src/build/build-adapter.d.ts +29 -334
- package/src/build/build-adapter.js +32 -133
- package/src/build/cache/build-input-fingerprint.d.ts +28 -0
- package/src/build/cache/build-input-fingerprint.js +31 -0
- package/src/build/cache/cache-constants.d.ts +4 -0
- package/src/build/cache/cache-constants.js +6 -0
- package/src/build/cache/cache-keys.d.ts +22 -0
- package/src/build/cache/cache-keys.js +63 -0
- package/src/build/cache/dev-browser-script-cache.d.ts +34 -0
- package/src/build/cache/dev-browser-script-cache.js +90 -0
- package/src/build/cache/pages-unified-graph-build.d.ts +31 -0
- package/src/build/cache/pages-unified-graph-build.js +198 -0
- package/src/build/cache/production-build-cache.d.ts +20 -0
- package/src/build/cache/production-build-cache.js +63 -0
- package/src/build/cache/server-entry-build-cache.d.ts +43 -0
- package/src/build/cache/server-entry-build-cache.js +165 -0
- package/src/build/contracts/build-contracts.d.ts +96 -0
- package/src/build/contracts/build-manifest.d.ts +90 -0
- package/src/build/{build-manifest.js → contracts/build-manifest.js} +2 -2
- package/src/build/contracts/build-types.js +0 -0
- package/src/build/{rolldown-adapter-helpers.d.ts → rolldown/rolldown-adapter-helpers.d.ts} +23 -9
- package/src/build/{rolldown-adapter-helpers.js → rolldown/rolldown-adapter-helpers.js} +99 -13
- package/src/build/{rolldown-build-adapter.d.ts → rolldown/rolldown-build-adapter.d.ts} +3 -7
- package/src/build/{rolldown-build-adapter.js → rolldown/rolldown-build-adapter.js} +3 -3
- package/src/build/rolldown/rolldown-build-invocation-metrics.d.ts +12 -0
- package/src/build/rolldown/rolldown-build-invocation-metrics.js +43 -0
- package/src/build/{rolldown-plugin-bridge.d.ts → rolldown/rolldown-plugin-bridge.d.ts} +16 -2
- package/src/build/{rolldown-plugin-bridge.js → rolldown/rolldown-plugin-bridge.js} +21 -6
- package/src/build/rolldown/rolldown-source-transform-pass.d.ts +15 -0
- package/src/build/rolldown/rolldown-source-transform-pass.js +61 -0
- package/src/build/rolldown/runtime-build-output-normalizer.d.ts +10 -0
- package/src/build/rolldown/runtime-build-output-normalizer.js +201 -0
- package/src/build/runtime/build-profile-options.d.ts +7 -0
- package/src/build/runtime/build-profile-options.js +37 -0
- package/src/build/runtime/build-request-identity.d.ts +17 -0
- package/src/build/runtime/build-request-identity.js +54 -0
- package/src/build/runtime/build-request-policy.d.ts +59 -0
- package/src/build/runtime/build-request-policy.js +46 -0
- package/src/build/runtime/build-runtime.d.ts +28 -0
- package/src/build/runtime/build-runtime.js +65 -0
- package/src/build/runtime/deduping-build-executor.d.ts +21 -0
- package/src/build/runtime/deduping-build-executor.js +34 -0
- package/src/build/runtime/parallel-build-executor.d.ts +21 -0
- package/src/build/runtime/parallel-build-executor.js +52 -0
- package/src/build/{serialized-build-executor.d.ts → runtime/serialized-build-executor.d.ts} +1 -1
- package/src/client/navigation-scripts/classification.d.ts +16 -0
- package/src/client/navigation-scripts/classification.js +41 -0
- package/src/client/navigation-scripts/index.d.ts +3 -0
- package/src/client/navigation-scripts/index.js +23 -0
- package/src/client/navigation-scripts/navigation-scripts.test.browser.js +65 -0
- package/src/client/navigation-scripts/registry.d.ts +11 -0
- package/src/client/navigation-scripts/registry.js +12 -0
- package/src/client/navigation-scripts/rerun-queue.d.ts +37 -0
- package/src/client/navigation-scripts/rerun-queue.js +73 -0
- package/src/client/scroll.d.ts +17 -0
- package/src/client/scroll.js +25 -0
- package/src/client/scroll.test.browser.js +37 -0
- package/src/client/view-transitions.d.ts +16 -0
- package/src/client/view-transitions.js +63 -0
- package/src/config/config-builder.d.ts +25 -10
- package/src/config/config-builder.js +53 -11
- package/src/config/constants.d.ts +1 -0
- package/src/config/constants.js +2 -1
- package/src/dev/client-bridge-registry.d.ts +5 -0
- package/src/dev/client-bridge-registry.js +15 -0
- package/src/dev/dev-client-ownership.d.ts +7 -0
- package/src/dev/dev-client-ownership.js +6 -0
- package/src/dev/hmr-manager-registry.d.ts +8 -0
- package/src/dev/hmr-manager-registry.js +15 -0
- package/src/dev/host-runtime.d.ts +3 -0
- package/src/dev/host-runtime.js +7 -0
- package/src/dev/runtime-server-started-message.d.ts +2 -0
- package/src/dev/runtime-server-started-message.js +6 -0
- package/src/diagnostics/request-build-dedupe.d.ts +18 -0
- package/src/diagnostics/request-build-dedupe.js +33 -0
- package/src/diagnostics/startup-trace.d.ts +72 -0
- package/src/diagnostics/startup-trace.js +253 -0
- package/src/eco/README.md +11 -0
- package/src/eco/eco-declared-component.d.ts +14 -0
- package/src/eco/eco-declared-component.js +16 -0
- package/src/eco/eco.browser.js +5 -6
- package/src/eco/eco.js +7 -8
- package/src/eco/eco.types.d.ts +14 -3
- package/src/eco/eco.utils.d.ts +1 -1
- package/src/eco/eco.utils.js +1 -1
- package/src/eco/page-layout-normalization.d.ts +21 -0
- package/src/eco/page-layout-normalization.js +59 -0
- package/src/env.d.ts +2 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/index.js +7 -1
- package/src/errors/undeclared-component-dependency-error.d.ts +11 -0
- package/src/errors/undeclared-component-dependency-error.js +17 -0
- package/src/hmr/client/hmr-runtime.js +7 -4
- package/src/hmr/hmr-entrypoint-output.d.ts +49 -0
- package/src/hmr/hmr-entrypoint-output.js +60 -0
- package/src/hmr/hmr-file-change-prep.d.ts +10 -0
- package/src/hmr/hmr-file-change-prep.js +17 -0
- package/src/hmr/hmr-strategy.d.ts +15 -0
- package/src/hmr/hmr-strategy.js +19 -0
- package/src/hmr/strategies/js-hmr-strategy.d.ts +3 -5
- package/src/hmr/strategies/js-hmr-strategy.js +72 -19
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +29 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +28 -2
- package/src/integrations/ghtml/ghtml-renderer.d.ts +2 -6
- package/src/integrations/ghtml/ghtml-renderer.js +2 -51
- package/src/integrations/ghtml/ghtml.plugin.d.ts +3 -16
- package/src/integrations/ghtml/ghtml.plugin.js +7 -14
- package/src/plugins/alias-resolver-cache.d.ts +6 -9
- package/src/plugins/alias-resolver-plugin.d.ts +3 -3
- package/src/plugins/alias-resolver-plugin.js +38 -51
- package/src/plugins/define-integration.d.ts +26 -0
- package/src/plugins/define-integration.js +19 -0
- package/src/plugins/eco-component-meta-plugin.d.ts +1 -1
- package/src/plugins/eco-component-meta-plugin.js +5 -8
- package/src/plugins/foreign-jsx-override-plugin.d.ts +1 -1
- package/src/plugins/foreign-jsx-override-plugin.js +4 -6
- package/src/plugins/integration-plugin.d.ts +43 -14
- package/src/plugins/integration-plugin.js +18 -5
- package/src/plugins/jsx-import-source.utils.d.ts +8 -0
- package/src/plugins/jsx-import-source.utils.js +26 -0
- package/src/plugins/processor.d.ts +61 -12
- package/src/plugins/processor.js +24 -5
- package/src/plugins/source-transform.d.ts +32 -1
- package/src/plugins/source-transform.js +23 -1
- package/src/plugins/tsconfig-import-resolver.d.ts +18 -0
- package/src/plugins/tsconfig-import-resolver.js +159 -0
- package/src/route-renderer/GRAPH.md +26 -32
- package/src/route-renderer/README.md +38 -31
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +107 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +148 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.d.ts +20 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.js +31 -0
- package/src/route-renderer/orchestration/{component-render-context.d.ts → foreign-child/component-render-context.d.ts} +8 -15
- package/src/route-renderer/orchestration/{component-render-context.js → foreign-child/component-render-context.js} +4 -2
- package/src/route-renderer/orchestration/{render-output.utils.d.ts → foreign-child/foreign-child-output.utils.d.ts} +17 -7
- package/src/route-renderer/orchestration/{render-output.utils.js → foreign-child/foreign-child-output.utils.js} +35 -26
- package/src/route-renderer/orchestration/{foreign-subtree-execution.service.d.ts → foreign-child/foreign-subtree-execution.service.d.ts} +64 -34
- package/src/route-renderer/orchestration/{foreign-subtree-execution.service.js → foreign-child/foreign-subtree-execution.service.js} +170 -37
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.d.ts +19 -0
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.js +35 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -143
- package/src/route-renderer/orchestration/integration-renderer.js +163 -402
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.d.ts +75 -0
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +177 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +10 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +143 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +34 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.js +96 -0
- package/src/route-renderer/orchestration/{ownership-validation.service.d.ts → ownership-graph/ownership-validation.service.d.ts} +7 -2
- package/src/route-renderer/orchestration/{ownership-validation.service.js → ownership-graph/ownership-validation.service.js} +30 -3
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.d.ts +7 -0
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +32 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.loader.d.ts +9 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.loader.js +7 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.d.ts +12 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.js +29 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +106 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +436 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +31 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +229 -0
- package/src/route-renderer/orchestration/{processed-asset-dedupe.d.ts → page-browser-graph/processed-asset-dedupe.d.ts} +1 -1
- package/src/route-renderer/orchestration/route-pipeline/integration-route-render-adapter.d.ts +31 -0
- package/src/route-renderer/orchestration/route-pipeline/integration-route-render-adapter.js +25 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.d.ts +6 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.js +27 -0
- package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.d.ts +15 -0
- package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.js +36 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.d.ts +20 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.js +24 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.d.ts +25 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.js +49 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.d.ts +4 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.js +33 -0
- package/src/route-renderer/orchestration/{route-render-orchestrator.d.ts → route-pipeline/route-render-orchestrator.d.ts} +13 -53
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +162 -0
- package/src/route-renderer/orchestration/string-markup-renderer.d.ts +14 -0
- package/src/route-renderer/orchestration/string-markup-renderer.js +55 -0
- package/src/route-renderer/page-loading/component-dependency-collection.js +5 -2
- package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +6 -0
- package/src/route-renderer/page-loading/ecopages-virtual-imports.js +7 -2
- package/src/route-renderer/page-loading/module-declaration-aggregation.js +4 -0
- package/src/router/client/link-intent.d.ts +11 -21
- package/src/router/client/link-intent.js +10 -0
- package/src/router/client/link-intent.test.browser.js +12 -1
- package/src/router/client/link-navigation-policy.d.ts +45 -0
- package/src/router/client/link-navigation-policy.js +101 -0
- package/src/router/client/link-navigation-policy.test.browser.d.ts +1 -0
- package/src/router/client/link-navigation-policy.test.browser.js +92 -0
- package/src/router/client/navigation-coordinator.d.ts +1 -1
- package/src/router/client/navigation-coordinator.js +12 -2
- package/src/services/assets/asset-processing-service/asset-dependency-keys.d.ts +13 -0
- package/src/services/assets/asset-processing-service/asset-dependency-keys.js +3 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +6 -1
- package/src/services/assets/asset-processing-service/asset-processing.service.js +44 -5
- package/src/services/assets/asset-processing-service/assets.types.d.ts +1 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +2 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +1 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +52 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.js +78 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +4 -2
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +28 -13
- package/src/services/assets/asset-processing-service/finalize-processed-asset.d.ts +3 -0
- package/src/services/assets/asset-processing-service/finalize-processed-asset.js +7 -0
- package/src/services/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -1
- package/src/services/assets/asset-processing-service/grouped-content-bundles.js +38 -12
- package/src/services/assets/asset-processing-service/index.d.ts +2 -0
- package/src/services/assets/asset-processing-service/index.js +2 -0
- package/src/services/assets/asset-processing-service/inline-content-script-body.d.ts +11 -0
- package/src/services/assets/asset-processing-service/inline-content-script-body.js +17 -0
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.d.ts +9 -0
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.js +18 -0
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -2
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +2 -15
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +8 -0
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +73 -68
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +0 -1
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +18 -15
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +17 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -31
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +2 -30
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +43 -0
- package/src/services/assets/asset-processing-service/resolve-integration-plugin.d.ts +4 -0
- package/src/services/assets/asset-processing-service/resolve-integration-plugin.js +17 -0
- package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.d.ts +0 -1
- package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.js +5 -10
- package/src/services/assets/browser-bundle.service.d.ts +28 -30
- package/src/services/assets/browser-bundle.service.js +28 -19
- package/src/services/html/html-transformer.service.d.ts +1 -1
- package/src/services/html/html-transformer.service.js +5 -5
- package/src/services/invalidation/development-invalidation.service.d.ts +25 -2
- package/src/services/invalidation/development-invalidation.service.js +64 -11
- package/src/services/module-loading/README.md +49 -0
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +8 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +3 -21
- package/src/services/module-loading/page-module-import.service.d.ts +6 -2
- package/src/services/module-loading/page-module-import.service.js +110 -47
- package/src/services/module-loading/route-module-build-cache-registry.d.ts +24 -0
- package/src/services/module-loading/route-module-build-cache-registry.js +37 -0
- package/src/services/module-loading/route-module-build-cache.d.ts +4 -0
- package/src/services/module-loading/route-module-build-cache.js +38 -0
- package/src/services/module-loading/route-module-build-cache.store.d.ts +57 -0
- package/src/services/module-loading/route-module-build-cache.store.js +207 -0
- package/src/services/module-loading/route-module-build-manifest.d.ts +54 -0
- package/src/services/module-loading/route-module-build-manifest.js +85 -0
- package/src/services/module-loading/route-module-dependency-hasher.d.ts +81 -0
- package/src/services/module-loading/route-module-dependency-hasher.js +122 -0
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -1
- package/src/services/module-loading/server-module-transpiler.service.js +1 -1
- package/src/services/validation/schema-validation-service.d.ts +1 -4
- package/src/services/validation/schema-validation-service.js +12 -13
- package/src/services/validation/standard-schema.types.d.ts +9 -62
- package/src/services/validation/validate-standard-schema.d.ts +7 -0
- package/src/services/validation/validate-standard-schema.js +14 -0
- package/src/static-site-generator/README.md +41 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +28 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +22 -0
- package/src/static-site-generator/sitemap-routes.d.ts +14 -0
- package/src/static-site-generator/sitemap-routes.js +31 -0
- package/src/static-site-generator/sitemap.d.ts +15 -0
- package/src/static-site-generator/sitemap.js +33 -0
- package/src/static-site-generator/static-build-invalidation.d.ts +10 -0
- package/src/static-site-generator/static-build-invalidation.js +59 -0
- package/src/static-site-generator/static-export-context.d.ts +30 -0
- package/src/static-site-generator/static-export-context.js +0 -0
- package/src/static-site-generator/static-site-generator.d.ts +43 -25
- package/src/static-site-generator/static-site-generator.js +381 -106
- package/src/types/internal-types.d.ts +39 -13
- package/src/types/public-types.d.ts +289 -52
- package/src/utils/ecopages-route-info.d.ts +26 -0
- package/src/utils/ecopages-route-info.js +26 -0
- package/src/utils/html-escaping.d.ts +7 -0
- package/src/utils/html-escaping.js +5 -1
- package/src/utils/parse-cli-args.d.ts +2 -0
- package/src/utils/parse-cli-args.js +6 -0
- package/src/utils/path-pattern.d.ts +23 -0
- package/src/utils/path-pattern.js +27 -0
- package/src/utils/server-utils.module.d.ts +3 -2
- package/src/utils/server-utils.module.js +5 -6
- package/src/utils/static-file-extensions.d.ts +12 -0
- package/src/utils/static-file-extensions.js +48 -0
- package/src/watchers/project-watcher-ignore.d.ts +11 -0
- package/src/watchers/project-watcher-ignore.js +16 -0
- package/src/watchers/project-watcher.d.ts +29 -6
- package/src/watchers/project-watcher.js +146 -34
- package/src/watchers/project-watcher.test-helpers.js +5 -5
- package/src/adapters/shared/define-api-handler.d.ts +0 -25
- package/src/adapters/shared/define-api-handler.js +0 -15
- package/src/adapters/shared/hmr-entrypoint-registrar.js +0 -87
- package/src/adapters/shared/server-adapter.js +0 -436
- package/src/adapters/shared/server-static-builder.js +0 -162
- package/src/adapters/shared/shared-hmr-manager.d.ts +0 -59
- package/src/adapters/shared/shared-hmr-manager.js +0 -241
- package/src/build/build-manifest.d.ts +0 -33
- package/src/build/rolldown-dev-build-adapter.d.ts +0 -82
- package/src/build/rolldown-dev-build-adapter.js +0 -166
- package/src/build/runtime-build-executor.d.ts +0 -21
- package/src/build/runtime-build-executor.js +0 -19
- package/src/build/runtime-build-output-normalizer.d.ts +0 -3
- package/src/build/runtime-build-output-normalizer.js +0 -111
- package/src/hmr/hmr.postcss.test.e2e.js +0 -31
- package/src/hmr/hmr.test.e2e.js +0 -43
- package/src/route-renderer/orchestration/declared-ownership-graph.d.ts +0 -18
- package/src/route-renderer/orchestration/declared-ownership-graph.js +0 -34
- package/src/route-renderer/orchestration/ownership-planning.service.d.ts +0 -24
- package/src/route-renderer/orchestration/ownership-planning.service.js +0 -63
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.d.ts +0 -91
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.js +0 -170
- package/src/route-renderer/orchestration/route-render-orchestrator.js +0 -577
- package/src/route-renderer/orchestration/template-serialization.d.ts +0 -38
- package/src/route-renderer/orchestration/template-serialization.js +0 -45
- /package/src/adapters/shared/{explicit-static-render-preparation.js → http/explicit-static-render-preparation.js} +0 -0
- /package/src/adapters/shared/{runtime-host.d.ts → runtime/runtime-host.d.ts} +0 -0
- /package/src/adapters/shared/{runtime-host.js → runtime/runtime-host.js} +0 -0
- /package/src/adapters/shared/{static-preview-host.js → runtime/static-preview-host.js} +0 -0
- /package/src/build/{browser-runtime-manifest.d.ts → browser/browser-runtime-manifest.d.ts} +0 -0
- /package/src/build/{browser-runtime-manifest.js → browser/browser-runtime-manifest.js} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.d.ts → browser/browser-runtime-plugin-helpers.d.ts} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.js → browser/browser-runtime-plugin-helpers.js} +0 -0
- /package/src/build/{build-types.js → contracts/build-contracts.js} +0 -0
- /package/src/build/{build-types.d.ts → contracts/build-types.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.d.ts → rolldown/server-side-css-shim-plugin.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.js → rolldown/server-side-css-shim-plugin.js} +0 -0
- /package/src/build/{serialized-build-executor.js → runtime/serialized-build-executor.js} +0 -0
- /package/src/{hmr/hmr.postcss.test.e2e.d.ts → client/navigation-scripts/navigation-scripts.test.browser.d.ts} +0 -0
- /package/src/{hmr/hmr.test.e2e.d.ts → client/scroll.test.browser.d.ts} +0 -0
- /package/src/route-renderer/orchestration/{processed-asset-dedupe.js → page-browser-graph/processed-asset-dedupe.js} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileSystem } from "@ecopages/file-system";
|
|
4
|
+
import { RESOLVED_ASSETS_DIR } from "../config/constants.js";
|
|
5
|
+
import { appLogger } from "../global/app-logger.js";
|
|
6
|
+
function isRegisteredScriptEntrypoint(registered, filePath) {
|
|
7
|
+
return registered.has(path.resolve(filePath));
|
|
8
|
+
}
|
|
9
|
+
function isBrowserOnlyRegisteredScriptEntrypoint(filePath) {
|
|
10
|
+
return /\.script\.ts$/u.test(path.resolve(filePath));
|
|
11
|
+
}
|
|
12
|
+
function encodeHmrDynamicSegments(filepath) {
|
|
13
|
+
return filepath.replace(/\[([^\]]+)\]/g, "_$1_");
|
|
14
|
+
}
|
|
15
|
+
function resolveHmrEntrypointOutputPaths(srcDir, distDir, entrypointPath) {
|
|
16
|
+
const normalizedEntrypoint = path.resolve(entrypointPath);
|
|
17
|
+
const relativePath = path.relative(srcDir, normalizedEntrypoint);
|
|
18
|
+
const relativePathJs = relativePath.replace(/\.(tsx?|jsx?|mdx?)$/, ".js");
|
|
19
|
+
const encodedPathJs = encodeHmrDynamicSegments(relativePathJs);
|
|
20
|
+
const urlPath = encodedPathJs.split(path.sep).join("/");
|
|
21
|
+
return {
|
|
22
|
+
outputUrl: `/${path.join(RESOLVED_ASSETS_DIR, "_hmr", urlPath).split(path.sep).join("/")}`,
|
|
23
|
+
outputPath: path.join(distDir, urlPath)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function removeStaleHmrEntrypointOutput(outputPath, scope) {
|
|
27
|
+
if (!fileSystem.exists(outputPath)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
fileSystem.remove(outputPath);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
appLogger.warn(
|
|
34
|
+
`[${scope}] Failed to remove stale entrypoint output ${outputPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function isHmrOutputFresh(outputPath, sourcePath) {
|
|
39
|
+
if (!fileSystem.exists(outputPath) || !fileSystem.exists(sourcePath)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const outputMtimeMs = fs.statSync(outputPath).mtimeMs;
|
|
43
|
+
const sourceMtimeMs = fs.statSync(sourcePath).mtimeMs;
|
|
44
|
+
return outputMtimeMs >= sourceMtimeMs;
|
|
45
|
+
}
|
|
46
|
+
function isHmrOutputOlderThanSource(outputPath, sourcePath) {
|
|
47
|
+
if (!fileSystem.exists(outputPath) || !fileSystem.exists(sourcePath)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return fs.statSync(outputPath).mtimeMs < fs.statSync(sourcePath).mtimeMs;
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
encodeHmrDynamicSegments,
|
|
54
|
+
isBrowserOnlyRegisteredScriptEntrypoint,
|
|
55
|
+
isHmrOutputFresh,
|
|
56
|
+
isHmrOutputOlderThanSource,
|
|
57
|
+
isRegisteredScriptEntrypoint,
|
|
58
|
+
removeStaleHmrEntrypointOutput,
|
|
59
|
+
resolveHmrEntrypointOutputPaths
|
|
60
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
import { type AffectedGraphIdentity } from '../route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js';
|
|
3
|
+
export type HmrFileChangePreparation = {
|
|
4
|
+
affectedGraphIdentities: AffectedGraphIdentity[];
|
|
5
|
+
invalidatedGraphCount: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Invalidates affected Page Browser Graph records before HMR strategy dispatch.
|
|
9
|
+
*/
|
|
10
|
+
export declare function prepareHmrFileChange(appConfig: EcoPagesAppConfig, filePath: string): HmrFileChangePreparation;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
getAffectedPageBrowserGraphIdentities,
|
|
4
|
+
invalidatePageBrowserGraphSession
|
|
5
|
+
} from "../route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js";
|
|
6
|
+
function prepareHmrFileChange(appConfig, filePath) {
|
|
7
|
+
const resolvedFilePath = path.resolve(filePath);
|
|
8
|
+
const affectedGraphIdentities = getAffectedPageBrowserGraphIdentities(appConfig, resolvedFilePath);
|
|
9
|
+
const invalidatedGraphCount = invalidatePageBrowserGraphSession(appConfig, resolvedFilePath);
|
|
10
|
+
return {
|
|
11
|
+
affectedGraphIdentities,
|
|
12
|
+
invalidatedGraphCount
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
prepareHmrFileChange
|
|
17
|
+
};
|
|
@@ -133,6 +133,21 @@ export declare abstract class HmrStrategy {
|
|
|
133
133
|
* ```
|
|
134
134
|
*/
|
|
135
135
|
abstract matches(filePath: string): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Returns whether this strategy owns cold registration for the entrypoint.
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* Registration dispatch uses only integration strategies that claim the
|
|
141
|
+
* entrypoint. File-change dispatch continues to use {@link matches}.
|
|
142
|
+
*/
|
|
143
|
+
canEmitEntrypoint(_entrypointPath: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Materializes one integration-owned HMR entrypoint during registration.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* Must write the canonical output path and must not broadcast client events.
|
|
149
|
+
*/
|
|
150
|
+
emitEntrypoint(_entrypointPath: string, _outputPath: string): Promise<void>;
|
|
136
151
|
/**
|
|
137
152
|
* Processes a file change and returns the action to take.
|
|
138
153
|
*
|
package/src/hmr/hmr-strategy.js
CHANGED
|
@@ -37,6 +37,25 @@ class HmrStrategy {
|
|
|
37
37
|
get priority() {
|
|
38
38
|
return this.type + this.priorityOffset;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Returns whether this strategy owns cold registration for the entrypoint.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Registration dispatch uses only integration strategies that claim the
|
|
45
|
+
* entrypoint. File-change dispatch continues to use {@link matches}.
|
|
46
|
+
*/
|
|
47
|
+
canEmitEntrypoint(_entrypointPath) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Materializes one integration-owned HMR entrypoint during registration.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Must write the canonical output path and must not broadcast client events.
|
|
55
|
+
*/
|
|
56
|
+
async emitEntrypoint(_entrypointPath, _outputPath) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
60
|
export {
|
|
42
61
|
HmrStrategy,
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
10
|
import { HmrStrategy, type HmrAction } from '../hmr-strategy.js';
|
|
11
|
-
import type { EcoBuildPlugin } from '../../build/build-types.js';
|
|
12
11
|
import type { BrowserBundleExecutor } from '../../services/assets/browser-bundle.service.js';
|
|
13
12
|
import type { EntrypointDependencyGraph } from '../../services/runtime-state/entrypoint-dependency-graph.service.js';
|
|
14
13
|
/**
|
|
@@ -25,10 +24,6 @@ export interface JsHmrContext {
|
|
|
25
24
|
* Directory where HMR bundles are written.
|
|
26
25
|
*/
|
|
27
26
|
getDistDir(): string;
|
|
28
|
-
/**
|
|
29
|
-
* Build plugins to use during bundling.
|
|
30
|
-
*/
|
|
31
|
-
getPlugins(): EcoBuildPlugin[];
|
|
32
27
|
/**
|
|
33
28
|
* Absolute path to the source directory.
|
|
34
29
|
*/
|
|
@@ -98,6 +93,7 @@ export declare class JsHmrStrategy extends HmrStrategy {
|
|
|
98
93
|
* Matches if:
|
|
99
94
|
* 1. There are registered entrypoints to rebuild
|
|
100
95
|
* 2. The changed file is a JS/TS file in the src directory
|
|
96
|
+
* 3. Registered entrypoints always match, even when they share an integration template extension
|
|
101
97
|
*
|
|
102
98
|
* @param filePath - Absolute path to the changed file
|
|
103
99
|
* @returns True if this file should trigger entrypoint rebuilds
|
|
@@ -116,6 +112,8 @@ export declare class JsHmrStrategy extends HmrStrategy {
|
|
|
116
112
|
* @returns Action to broadcast update events
|
|
117
113
|
*/
|
|
118
114
|
process(filePath: string): Promise<HmrAction>;
|
|
115
|
+
private resolveEntrypointOutputPath;
|
|
116
|
+
private removeStaleEntrypointOutput;
|
|
119
117
|
/**
|
|
120
118
|
* Bundles one or more entrypoints in a single build invocation.
|
|
121
119
|
* Uses the source directory as the output base so that the directory structure
|
|
@@ -2,6 +2,13 @@ import path from "node:path";
|
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
3
|
import { HmrStrategy, HmrStrategyType } from "../hmr-strategy.js";
|
|
4
4
|
import { appLogger } from "../../global/app-logger.js";
|
|
5
|
+
import {
|
|
6
|
+
removeStaleHmrEntrypointOutput,
|
|
7
|
+
resolveHmrEntrypointOutputPaths,
|
|
8
|
+
isRegisteredScriptEntrypoint,
|
|
9
|
+
isHmrOutputFresh,
|
|
10
|
+
isHmrOutputOlderThanSource
|
|
11
|
+
} from "../hmr-entrypoint-output.js";
|
|
5
12
|
class JsHmrStrategy extends HmrStrategy {
|
|
6
13
|
type = HmrStrategyType.SCRIPT;
|
|
7
14
|
context;
|
|
@@ -15,27 +22,30 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
15
22
|
* Matches if:
|
|
16
23
|
* 1. There are registered entrypoints to rebuild
|
|
17
24
|
* 2. The changed file is a JS/TS file in the src directory
|
|
25
|
+
* 3. Registered entrypoints always match, even when they share an integration template extension
|
|
18
26
|
*
|
|
19
27
|
* @param filePath - Absolute path to the changed file
|
|
20
28
|
* @returns True if this file should trigger entrypoint rebuilds
|
|
21
29
|
*/
|
|
22
30
|
matches(filePath) {
|
|
23
31
|
const watchedFiles = this.context.getWatchedFiles();
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
32
|
+
const resolvedPath = path.resolve(filePath);
|
|
33
|
+
const isJsTs = /\.(ts|tsx|js|jsx)$/.test(resolvedPath);
|
|
34
|
+
const srcDir = path.resolve(this.context.getSrcDir());
|
|
35
|
+
const isInSrc = resolvedPath.startsWith(`${srcDir}${path.sep}`) || resolvedPath === srcDir;
|
|
36
|
+
const isIntegrationTemplate = this.context.getTemplateExtensions().some((extension) => resolvedPath.endsWith(extension));
|
|
27
37
|
if (watchedFiles.size === 0) {
|
|
28
38
|
return false;
|
|
29
39
|
}
|
|
30
40
|
if (!isJsTs || !isInSrc) {
|
|
31
41
|
return false;
|
|
32
42
|
}
|
|
43
|
+
if (watchedFiles.has(resolvedPath)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
33
46
|
if (isIntegrationTemplate) {
|
|
34
47
|
return false;
|
|
35
48
|
}
|
|
36
|
-
if (watchedFiles.has(filePath)) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
49
|
return true;
|
|
40
50
|
}
|
|
41
51
|
/**
|
|
@@ -53,22 +63,27 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
53
63
|
async process(filePath) {
|
|
54
64
|
appLogger.debug(`[JsHmrStrategy] Processing ${filePath}`);
|
|
55
65
|
const watchedFiles = this.context.getWatchedFiles();
|
|
66
|
+
const resolvedChanged = path.resolve(filePath);
|
|
67
|
+
const isRegisteredEntrypointEdit = isRegisteredScriptEntrypoint(watchedFiles, resolvedChanged);
|
|
56
68
|
if (watchedFiles.size === 0) {
|
|
57
69
|
appLogger.debug(`[JsHmrStrategy] No watched files to rebuild`);
|
|
58
70
|
return { type: "none" };
|
|
59
71
|
}
|
|
60
72
|
const dependencyHits = this.context.getEntrypointDependencyGraph().getDependencyEntrypoints(filePath);
|
|
61
73
|
const hasDependencyHit = dependencyHits.size > 0;
|
|
62
|
-
const impactedEntrypoints = hasDependencyHit ? Array.from(dependencyHits).filter((entrypoint) => watchedFiles.has(entrypoint)) : Array.from(watchedFiles.keys());
|
|
74
|
+
const impactedEntrypoints = isRegisteredEntrypointEdit ? [resolvedChanged] : hasDependencyHit ? Array.from(dependencyHits).filter((entrypoint) => watchedFiles.has(path.resolve(entrypoint))) : Array.from(watchedFiles.keys());
|
|
63
75
|
const buildableEntrypoints = impactedEntrypoints.filter(
|
|
64
76
|
(entrypoint) => this.context.shouldProcessEntrypoint?.(entrypoint) ?? true
|
|
65
77
|
);
|
|
66
|
-
if (!hasDependencyHit) {
|
|
78
|
+
if (!hasDependencyHit && !isRegisteredEntrypointEdit) {
|
|
67
79
|
appLogger.debug("[JsHmrStrategy] Dependency graph miss, rebuilding all watched entrypoints");
|
|
68
80
|
}
|
|
69
81
|
if (buildableEntrypoints.length === 0) {
|
|
70
82
|
return { type: "none" };
|
|
71
83
|
}
|
|
84
|
+
for (const entrypoint of buildableEntrypoints) {
|
|
85
|
+
this.removeStaleEntrypointOutput(this.resolveEntrypointOutputPath(entrypoint));
|
|
86
|
+
}
|
|
72
87
|
const buildResult = await this.bundleEntrypoints(buildableEntrypoints);
|
|
73
88
|
if (!buildResult.success) {
|
|
74
89
|
return { type: "none" };
|
|
@@ -76,17 +91,19 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
76
91
|
const updates = [];
|
|
77
92
|
let reloadRequired = false;
|
|
78
93
|
for (const entrypoint of buildableEntrypoints) {
|
|
79
|
-
const
|
|
80
|
-
|
|
94
|
+
const resolvedEntrypoint = path.resolve(entrypoint);
|
|
95
|
+
const derivedOutput = resolveHmrEntrypointOutputPaths(
|
|
96
|
+
this.context.getSrcDir(),
|
|
97
|
+
this.context.getDistDir(),
|
|
98
|
+
resolvedEntrypoint
|
|
99
|
+
);
|
|
100
|
+
const outputUrl = watchedFiles.get(resolvedEntrypoint) ?? derivedOutput.outputUrl;
|
|
101
|
+
const outputPath = this.resolveEntrypointOutputPath(resolvedEntrypoint);
|
|
81
102
|
if (buildResult.dependencies) {
|
|
82
|
-
const entrypointDeps = buildResult.dependencies.get(
|
|
83
|
-
this.context.getEntrypointDependencyGraph().setEntrypointDependencies(
|
|
103
|
+
const entrypointDeps = buildResult.dependencies.get(resolvedEntrypoint) ?? [];
|
|
104
|
+
this.context.getEntrypointDependencyGraph().setEntrypointDependencies(resolvedEntrypoint, entrypointDeps);
|
|
84
105
|
}
|
|
85
|
-
const
|
|
86
|
-
const relativePath = path.relative(srcDir, entrypoint);
|
|
87
|
-
const relativePathJs = relativePath.replace(/\.(tsx?|jsx?|mdx?)$/, ".js");
|
|
88
|
-
const outputPath = path.join(this.context.getDistDir(), relativePathJs);
|
|
89
|
-
const result = await this.processOutput(outputPath, outputUrl);
|
|
106
|
+
const result = await this.processOutput(outputPath, outputUrl, resolvedEntrypoint);
|
|
90
107
|
if (result.success) {
|
|
91
108
|
updates.push(outputUrl);
|
|
92
109
|
if (result.requiresReload) {
|
|
@@ -113,6 +130,12 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
113
130
|
}
|
|
114
131
|
return { type: "none" };
|
|
115
132
|
}
|
|
133
|
+
resolveEntrypointOutputPath(entrypointPath) {
|
|
134
|
+
return resolveHmrEntrypointOutputPaths(this.context.getSrcDir(), this.context.getDistDir(), entrypointPath).outputPath;
|
|
135
|
+
}
|
|
136
|
+
removeStaleEntrypointOutput(outputPath) {
|
|
137
|
+
removeStaleHmrEntrypointOutput(outputPath, "JsHmrStrategy");
|
|
138
|
+
}
|
|
116
139
|
/**
|
|
117
140
|
* Bundles one or more entrypoints in a single build invocation.
|
|
118
141
|
* Uses the source directory as the output base so that the directory structure
|
|
@@ -120,13 +143,35 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
120
143
|
*/
|
|
121
144
|
async bundleEntrypoints(entrypoints) {
|
|
122
145
|
try {
|
|
146
|
+
if (entrypoints.length === 1) {
|
|
147
|
+
const entrypoint = entrypoints[0];
|
|
148
|
+
const outputPath = this.resolveEntrypointOutputPath(entrypoint);
|
|
149
|
+
const naming = path.relative(this.context.getDistDir(), outputPath).split(path.sep).join("/");
|
|
150
|
+
const result2 = await this.context.getBrowserBundleService().bundle({
|
|
151
|
+
profile: "hmr-entrypoint",
|
|
152
|
+
entrypoints: [entrypoint],
|
|
153
|
+
outdir: this.context.getDistDir(),
|
|
154
|
+
naming,
|
|
155
|
+
minify: false
|
|
156
|
+
});
|
|
157
|
+
if (!result2.success) {
|
|
158
|
+
appLogger.error("[JsHmrStrategy] Entrypoint build failed:", result2.logs);
|
|
159
|
+
return { success: false };
|
|
160
|
+
}
|
|
161
|
+
const dependencies2 = /* @__PURE__ */ new Map();
|
|
162
|
+
if (result2.dependencyGraph?.entrypoints) {
|
|
163
|
+
for (const [resolvedEntrypoint, deps] of Object.entries(result2.dependencyGraph.entrypoints)) {
|
|
164
|
+
dependencies2.set(path.resolve(resolvedEntrypoint), deps);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return { success: true, dependencies: dependencies2 };
|
|
168
|
+
}
|
|
123
169
|
const result = await this.context.getBrowserBundleService().bundle({
|
|
124
170
|
profile: "hmr-entrypoint",
|
|
125
171
|
entrypoints,
|
|
126
172
|
outdir: this.context.getDistDir(),
|
|
127
173
|
outbase: this.context.getSrcDir(),
|
|
128
174
|
naming: "[dir]/[name]",
|
|
129
|
-
plugins: this.context.getPlugins(),
|
|
130
175
|
minify: false
|
|
131
176
|
});
|
|
132
177
|
if (!result.success) {
|
|
@@ -153,8 +198,16 @@ class JsHmrStrategy extends HmrStrategy {
|
|
|
153
198
|
* @param url - URL path for the bundled file
|
|
154
199
|
* @returns True if processing was successful and update should be broadcast
|
|
155
200
|
*/
|
|
156
|
-
async processOutput(filepath, url) {
|
|
201
|
+
async processOutput(filepath, url, sourcePath) {
|
|
157
202
|
try {
|
|
203
|
+
if (sourcePath && !isHmrOutputFresh(filepath, sourcePath)) {
|
|
204
|
+
if (isHmrOutputOlderThanSource(filepath, sourcePath)) {
|
|
205
|
+
appLogger.warn(
|
|
206
|
+
`[JsHmrStrategy] HMR output is older than source after rebuild; skipping broadcast for ${url}`
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
return { success: false, requiresReload: false };
|
|
210
|
+
}
|
|
158
211
|
const code = await fileSystem.readFile(filepath);
|
|
159
212
|
if (code.includes("/* [ecopages] hmr */")) {
|
|
160
213
|
return { success: true, requiresReload: !code.includes("import.meta.hot.accept") };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HMR strategy for server-rendered include templates and explicit server views.
|
|
3
|
+
*
|
|
4
|
+
* These files affect SSR output (head, layout shell, explicit views) but are not
|
|
5
|
+
* client HMR entrypoints. Broadcast a layout-update so the active navigation
|
|
6
|
+
* runtime can refresh the current page without a full document reload.
|
|
7
|
+
*/
|
|
8
|
+
import { HmrStrategy, type HmrAction } from '../hmr-strategy.js';
|
|
9
|
+
import type { DevelopmentInvalidationService } from '../../services/invalidation/development-invalidation.service.js';
|
|
10
|
+
export declare class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
|
|
11
|
+
private readonly invalidationService;
|
|
12
|
+
readonly type: 100;
|
|
13
|
+
readonly priorityOffset = 50;
|
|
14
|
+
constructor(invalidationService: DevelopmentInvalidationService);
|
|
15
|
+
matches(filePath: string): boolean;
|
|
16
|
+
process(filePath: string): Promise<HmrAction>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HmrStrategy, HmrStrategyType } from "../hmr-strategy.js";
|
|
2
|
+
const SERVER_RENDERED_TEMPLATE_PRIORITY_OFFSET = 50;
|
|
3
|
+
class ServerRenderedTemplateHmrStrategy extends HmrStrategy {
|
|
4
|
+
constructor(invalidationService) {
|
|
5
|
+
super();
|
|
6
|
+
this.invalidationService = invalidationService;
|
|
7
|
+
}
|
|
8
|
+
invalidationService;
|
|
9
|
+
type = HmrStrategyType.INTEGRATION;
|
|
10
|
+
priorityOffset = SERVER_RENDERED_TEMPLATE_PRIORITY_OFFSET;
|
|
11
|
+
matches(filePath) {
|
|
12
|
+
return this.invalidationService.isIncludeSourceFile(filePath) || this.invalidationService.isExplicitServerViewFile(filePath);
|
|
13
|
+
}
|
|
14
|
+
async process(filePath) {
|
|
15
|
+
return {
|
|
16
|
+
type: "broadcast",
|
|
17
|
+
events: [
|
|
18
|
+
{
|
|
19
|
+
type: "layout-update",
|
|
20
|
+
path: filePath,
|
|
21
|
+
timestamp: Date.now()
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
ServerRenderedTemplateHmrStrategy
|
|
29
|
+
};
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type * from './types/public-types.js';
|
|
2
2
|
export type * from './eco/eco.types.js';
|
|
3
3
|
export { eco } from './eco/eco.js';
|
|
4
|
-
export { defineApiHandler, defineGroupHandler, type GroupHandler } from './adapters/shared/define-api-handler.js';
|
|
4
|
+
export { defineApiHandler, defineGroupHandler, defineGet, definePost, definePut, defineDelete, definePatch, defineOptions, defineHead, json, html, redirect, type GroupHandler, } from './adapters/shared/http/define-api-handler.js';
|
|
5
5
|
export { createEcoBuildPluginFromSourceTransform, createVitePluginsFromAppSourceTransforms, getAppSourceTransforms, createVitePluginFromSourceTransform, normalizeTransformId, type EcoSourceTransform, type EcoSourceTransformResult, type EcoViteCompatiblePlugin, } from './plugins/source-transform.js';
|
|
6
6
|
export { createEcoComponentMetaTransform } from './plugins/eco-component-meta-plugin.js';
|
|
7
|
+
export { SchemaError, validateStandardSchema } from './services/validation/validate-standard-schema.js';
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { eco } from "./eco/eco.js";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
defineApiHandler,
|
|
4
|
+
defineGroupHandler,
|
|
5
|
+
defineGet,
|
|
6
|
+
definePost,
|
|
7
|
+
definePut,
|
|
8
|
+
defineDelete,
|
|
9
|
+
definePatch,
|
|
10
|
+
defineOptions,
|
|
11
|
+
defineHead,
|
|
12
|
+
json,
|
|
13
|
+
html,
|
|
14
|
+
redirect
|
|
15
|
+
} from "./adapters/shared/http/define-api-handler.js";
|
|
3
16
|
import {
|
|
4
17
|
createEcoBuildPluginFromSourceTransform,
|
|
5
18
|
createVitePluginsFromAppSourceTransforms,
|
|
@@ -8,14 +21,27 @@ import {
|
|
|
8
21
|
normalizeTransformId
|
|
9
22
|
} from "./plugins/source-transform.js";
|
|
10
23
|
import { createEcoComponentMetaTransform } from "./plugins/eco-component-meta-plugin.js";
|
|
24
|
+
import { SchemaError, validateStandardSchema } from "./services/validation/validate-standard-schema.js";
|
|
11
25
|
export {
|
|
26
|
+
SchemaError,
|
|
12
27
|
createEcoBuildPluginFromSourceTransform,
|
|
13
28
|
createEcoComponentMetaTransform,
|
|
14
29
|
createVitePluginFromSourceTransform,
|
|
15
30
|
createVitePluginsFromAppSourceTransforms,
|
|
16
31
|
defineApiHandler,
|
|
32
|
+
defineDelete,
|
|
33
|
+
defineGet,
|
|
17
34
|
defineGroupHandler,
|
|
35
|
+
defineHead,
|
|
36
|
+
defineOptions,
|
|
37
|
+
definePatch,
|
|
38
|
+
definePost,
|
|
39
|
+
definePut,
|
|
18
40
|
eco,
|
|
19
41
|
getAppSourceTransforms,
|
|
20
|
-
|
|
42
|
+
html,
|
|
43
|
+
json,
|
|
44
|
+
normalizeTransformId,
|
|
45
|
+
redirect,
|
|
46
|
+
validateStandardSchema
|
|
21
47
|
};
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
* This module contains the ghtml renderer
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
6
|
-
import { IntegrationRenderer, type RenderToResponseContext } from '../../route-renderer/orchestration/integration-renderer.js';
|
|
5
|
+
import { StringMarkupRenderer } from '../../route-renderer/orchestration/string-markup-renderer.js';
|
|
7
6
|
/**
|
|
8
7
|
* A renderer for the ghtml integration.
|
|
9
8
|
* It renders a page using the HtmlTemplate and Page components.
|
|
10
9
|
*/
|
|
11
|
-
export declare class GhtmlRenderer extends
|
|
10
|
+
export declare class GhtmlRenderer extends StringMarkupRenderer {
|
|
12
11
|
name: string;
|
|
13
|
-
renderComponent(input: ComponentRenderInput): Promise<ComponentRenderResult>;
|
|
14
|
-
render({ params, query, props, locals, pageLocals, metadata, Page, Layout, HtmlTemplate, }: IntegrationRendererRenderOptions): Promise<RouteRendererBody>;
|
|
15
|
-
renderToResponse<P = Record<string, unknown>>(view: EcoComponent<P>, props: P, ctx: RenderToResponseContext): Promise<Response>;
|
|
16
12
|
}
|
|
@@ -1,56 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IntegrationRenderer
|
|
3
|
-
} from "../../route-renderer/orchestration/integration-renderer.js";
|
|
1
|
+
import { StringMarkupRenderer } from "../../route-renderer/orchestration/string-markup-renderer.js";
|
|
4
2
|
import { GHTML_PLUGIN_NAME } from "./ghtml.constants.js";
|
|
5
|
-
class GhtmlRenderer extends
|
|
3
|
+
class GhtmlRenderer extends StringMarkupRenderer {
|
|
6
4
|
name = GHTML_PLUGIN_NAME;
|
|
7
|
-
async renderComponent(input) {
|
|
8
|
-
return this.renderStringComponentWithQueuedForeignSubtrees(
|
|
9
|
-
input,
|
|
10
|
-
input.component
|
|
11
|
-
);
|
|
12
|
-
}
|
|
13
|
-
async render({
|
|
14
|
-
params,
|
|
15
|
-
query,
|
|
16
|
-
props,
|
|
17
|
-
locals,
|
|
18
|
-
pageLocals,
|
|
19
|
-
metadata,
|
|
20
|
-
Page,
|
|
21
|
-
Layout,
|
|
22
|
-
HtmlTemplate
|
|
23
|
-
}) {
|
|
24
|
-
try {
|
|
25
|
-
return await this.renderPageWithDocumentShell({
|
|
26
|
-
page: {
|
|
27
|
-
component: Page,
|
|
28
|
-
props: { params, query, ...props, locals: pageLocals }
|
|
29
|
-
},
|
|
30
|
-
layout: Layout ? {
|
|
31
|
-
component: Layout,
|
|
32
|
-
props: locals ? { locals } : {}
|
|
33
|
-
} : void 0,
|
|
34
|
-
htmlTemplate: HtmlTemplate,
|
|
35
|
-
metadata,
|
|
36
|
-
pageProps: props ?? {}
|
|
37
|
-
});
|
|
38
|
-
} catch (error) {
|
|
39
|
-
throw this.createRenderError("Error rendering page", error);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async renderToResponse(view, props, ctx) {
|
|
43
|
-
try {
|
|
44
|
-
return await this.renderViewWithDocumentShell({
|
|
45
|
-
view,
|
|
46
|
-
props,
|
|
47
|
-
ctx,
|
|
48
|
-
layout: view.config?.layout
|
|
49
|
-
});
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw this.createRenderError("Error rendering view", error);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
5
|
}
|
|
55
6
|
export {
|
|
56
7
|
GhtmlRenderer
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The Ghtml plugin class
|
|
5
|
-
* This plugin provides support for ghtml components in Ecopages
|
|
6
|
-
*/
|
|
7
|
-
export declare class GhtmlPlugin extends IntegrationPlugin {
|
|
8
|
-
renderer: typeof GhtmlRenderer;
|
|
9
|
-
constructor(options?: Omit<IntegrationPluginConfig, 'name'>);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Factory function to create a Ghtml plugin instance
|
|
13
|
-
* @param options Configuration options for the Ghtml plugin
|
|
14
|
-
* @returns A new GhtmlPlugin instance
|
|
15
|
-
*/
|
|
16
|
-
export declare function ghtmlPlugin(options?: Omit<IntegrationPluginConfig, 'name'>): GhtmlPlugin;
|
|
1
|
+
export declare const ghtmlPlugin: import("../../plugins/define-integration.js").DefinedIntegration<import("../../index.browser.js").EcoPagesElement>;
|
|
2
|
+
/** @deprecated Use {@link ghtmlPlugin.Plugin} or {@link ghtmlPlugin} instead. */
|
|
3
|
+
export declare const GhtmlPlugin: new (options?: Omit<import("../../plugins/integration-plugin.js").IntegrationPluginConfig, "name">) => import("../../plugins/integration-plugin.js").IntegrationPlugin<import("../../index.browser.js").EcoPagesElement>;
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineIntegration } from "../../plugins/define-integration.js";
|
|
2
2
|
import { GhtmlRenderer } from "./ghtml-renderer.js";
|
|
3
3
|
import { GHTML_PLUGIN_NAME } from "./ghtml.constants.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
...options
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function ghtmlPlugin(options) {
|
|
15
|
-
return new GhtmlPlugin(options);
|
|
16
|
-
}
|
|
4
|
+
const ghtmlPlugin = defineIntegration({
|
|
5
|
+
name: GHTML_PLUGIN_NAME,
|
|
6
|
+
extensions: [".ghtml.ts", ".ghtml.tsx", ".ghtml"],
|
|
7
|
+
renderer: GhtmlRenderer
|
|
8
|
+
});
|
|
9
|
+
const GhtmlPlugin = ghtmlPlugin.Plugin;
|
|
17
10
|
export {
|
|
18
11
|
GhtmlPlugin,
|
|
19
12
|
ghtmlPlugin
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-plugin cache for
|
|
2
|
+
* Per-plugin cache for tsconfig path alias resolution.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* The `ecopages-alias-resolver` plugin resolves project aliases
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the resolved path is a barrel) a `readFileSync` to detect
|
|
9
|
-
* `export * from './...'` forwarding.
|
|
5
|
+
* The `ecopages-alias-resolver` plugin resolves project path aliases to
|
|
6
|
+
* concrete file paths using the app's tsconfig `paths`. Each resolution goes
|
|
7
|
+
* through oxc-resolver and may read barrel re-export targets.
|
|
10
8
|
*
|
|
11
|
-
* This cache memoizes the result keyed by `(
|
|
9
|
+
* This cache memoizes the result keyed by `(projectRoot, specifier)`. It is
|
|
12
10
|
* process-local and not currently invalidated by the file watcher —
|
|
13
|
-
*
|
|
14
|
-
* process.
|
|
11
|
+
* project contents are assumed to be stable for the lifetime of the process.
|
|
15
12
|
*/
|
|
16
13
|
export declare class AliasResolverCache {
|
|
17
14
|
private readonly entries;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
1
|
+
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
2
2
|
import { AliasResolverCache } from './alias-resolver-cache.js';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function createAliasResolverPlugin(srcDir: string, options?: {
|
|
3
|
+
export declare function createAliasResolverPlugin(projectRoot: string, options?: {
|
|
5
4
|
cache?: AliasResolverCache;
|
|
6
5
|
}): EcoBuildPlugin;
|
|
6
|
+
export { isBarePackageImportSpecifier, matchesTsconfigPathPrefix, loadTsconfigPathPrefixes, resolveProjectImportPath, resolveProjectModulePath, } from './tsconfig-import-resolver.js';
|