@ecopages/core 0.2.0-beta.3 → 0.2.0-beta.31
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
|
@@ -1,65 +1,52 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { AliasResolverCache } from "./alias-resolver-cache.js";
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
if (existsSync(candidate)) {
|
|
8
|
-
return candidate;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
for (const extension of RESOLVABLE_EXTENSIONS) {
|
|
12
|
-
const fileCandidate = `${candidate}${extension}`;
|
|
13
|
-
if (existsSync(fileCandidate)) {
|
|
14
|
-
return fileCandidate;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
for (const extension of RESOLVABLE_EXTENSIONS) {
|
|
18
|
-
const indexCandidate = path.join(candidate, `index${extension}`);
|
|
19
|
-
if (existsSync(indexCandidate)) {
|
|
20
|
-
return indexCandidate;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return void 0;
|
|
24
|
-
}
|
|
25
|
-
function resolveAliasedBarrelTarget(resolvedPath) {
|
|
26
|
-
if (!path.basename(resolvedPath).startsWith("index.")) {
|
|
27
|
-
return resolvedPath;
|
|
28
|
-
}
|
|
29
|
-
const source = readFileSync(resolvedPath, "utf8").trim();
|
|
30
|
-
const match = source.match(/^export\s+\*\s+from\s+['"]([^'"]+)['"]\s*;?$/);
|
|
31
|
-
if (!match?.[1]?.startsWith(".")) {
|
|
32
|
-
return resolvedPath;
|
|
33
|
-
}
|
|
34
|
-
const target = findResolvablePath(path.resolve(path.dirname(resolvedPath), match[1]));
|
|
35
|
-
return target ?? resolvedPath;
|
|
2
|
+
import { loadTsconfigPathPrefixes, resolveProjectImportPath } from "./tsconfig-import-resolver.js";
|
|
3
|
+
function escapeRegExp(value) {
|
|
4
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
36
5
|
}
|
|
37
|
-
function
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
6
|
+
function buildPathPrefixFilter(prefix) {
|
|
7
|
+
if (prefix.endsWith("/")) {
|
|
8
|
+
return new RegExp(`^${escapeRegExp(prefix)}`);
|
|
40
9
|
}
|
|
41
|
-
|
|
42
|
-
const resolved = findResolvablePath(candidate);
|
|
43
|
-
return resolved ? resolveAliasedBarrelTarget(resolved) : void 0;
|
|
10
|
+
return new RegExp(`^${escapeRegExp(prefix)}(?:/|$)`);
|
|
44
11
|
}
|
|
45
|
-
function createAliasResolverPlugin(
|
|
12
|
+
function createAliasResolverPlugin(projectRoot, options) {
|
|
46
13
|
const cache = options?.cache ?? new AliasResolverCache();
|
|
14
|
+
const pathPrefixes = loadTsconfigPathPrefixes(projectRoot);
|
|
47
15
|
return {
|
|
48
16
|
name: "ecopages-alias-resolver",
|
|
49
17
|
setup(build) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
18
|
+
if (pathPrefixes.length === 0) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
for (const prefix of pathPrefixes) {
|
|
22
|
+
build.onResolve({ filter: buildPathPrefixFilter(prefix) }, (args) => {
|
|
23
|
+
if (!args.importer) {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
const cached = cache.get(projectRoot, args.path);
|
|
27
|
+
if (cached.hit) {
|
|
28
|
+
return cached.resolved ? { path: cached.resolved } : void 0;
|
|
29
|
+
}
|
|
30
|
+
const resolved = resolveProjectImportPath(projectRoot, args.importer, args.path);
|
|
31
|
+
cache.set(projectRoot, args.path, resolved);
|
|
32
|
+
return resolved ? { path: resolved } : void 0;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
59
35
|
}
|
|
60
36
|
};
|
|
61
37
|
}
|
|
38
|
+
import {
|
|
39
|
+
isBarePackageImportSpecifier,
|
|
40
|
+
matchesTsconfigPathPrefix,
|
|
41
|
+
loadTsconfigPathPrefixes as loadTsconfigPathPrefixes2,
|
|
42
|
+
resolveProjectImportPath as resolveProjectImportPath2,
|
|
43
|
+
resolveProjectModulePath
|
|
44
|
+
} from "./tsconfig-import-resolver.js";
|
|
62
45
|
export {
|
|
63
46
|
createAliasResolverPlugin,
|
|
64
|
-
|
|
47
|
+
isBarePackageImportSpecifier,
|
|
48
|
+
loadTsconfigPathPrefixes2 as loadTsconfigPathPrefixes,
|
|
49
|
+
matchesTsconfigPathPrefix,
|
|
50
|
+
resolveProjectImportPath2 as resolveProjectImportPath,
|
|
51
|
+
resolveProjectModulePath
|
|
65
52
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
import type { AssetProcessingService } from '../services/assets/asset-processing-service/asset-processing.service.js';
|
|
3
|
+
import type { ProcessedAsset } from '../services/assets/asset-processing-service/assets.types.js';
|
|
4
|
+
import type { EcoPagesElement } from '../types/public-types.js';
|
|
5
|
+
import type { IntegrationRenderer } from '../route-renderer/orchestration/integration-renderer.js';
|
|
6
|
+
import { IntegrationPlugin, type IntegrationPluginConfig } from './integration-plugin.js';
|
|
7
|
+
type RendererClass<C> = new (options: {
|
|
8
|
+
appConfig: EcoPagesAppConfig;
|
|
9
|
+
assetProcessingService: AssetProcessingService;
|
|
10
|
+
resolvedIntegrationDependencies: ProcessedAsset[];
|
|
11
|
+
rendererModules?: unknown;
|
|
12
|
+
runtimeOrigin: string;
|
|
13
|
+
}) => IntegrationRenderer<C>;
|
|
14
|
+
export interface DefineIntegrationDefinition<C = EcoPagesElement> extends IntegrationPluginConfig {
|
|
15
|
+
renderer: RendererClass<C>;
|
|
16
|
+
}
|
|
17
|
+
export interface DefinedIntegration<C = EcoPagesElement> {
|
|
18
|
+
(options?: Omit<IntegrationPluginConfig, 'name'>): IntegrationPlugin<C>;
|
|
19
|
+
Plugin: new (options?: Omit<IntegrationPluginConfig, 'name'>) => IntegrationPlugin<C>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a typed integration plugin factory for integrations that only need
|
|
23
|
+
* declarative config and a renderer class.
|
|
24
|
+
*/
|
|
25
|
+
export declare function defineIntegration<C = EcoPagesElement>(definition: DefineIntegrationDefinition<C>): DefinedIntegration<C>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IntegrationPlugin } from "./integration-plugin.js";
|
|
2
|
+
function defineIntegration(definition) {
|
|
3
|
+
const { renderer, ...defaultConfig } = definition;
|
|
4
|
+
class DefinedIntegrationPlugin extends IntegrationPlugin {
|
|
5
|
+
renderer = renderer;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super({
|
|
8
|
+
...defaultConfig,
|
|
9
|
+
...options
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const factory = ((options) => new DefinedIntegrationPlugin(options));
|
|
14
|
+
factory.Plugin = DefinedIntegrationPlugin;
|
|
15
|
+
return factory;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
defineIntegration
|
|
19
|
+
};
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* @module eco-component-meta-plugin
|
|
27
27
|
*/
|
|
28
|
-
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
28
|
+
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
29
29
|
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
30
30
|
import { type EcoSourceTransform, type EcoViteCompatiblePlugin } from './source-transform.js';
|
|
31
31
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cachedParseSync } from "../cache/module-parse-cache.js";
|
|
2
|
+
import { prependJsxImportSourceIfMissing } from "./jsx-import-source.utils.js";
|
|
2
3
|
import { rapidhash } from "../utils/hash.js";
|
|
3
4
|
import {
|
|
4
5
|
createEcoBuildPluginFromSourceTransform,
|
|
@@ -38,13 +39,6 @@ function detectIntegration(filePath, extensionToIntegration) {
|
|
|
38
39
|
}
|
|
39
40
|
return { name: "ghtml" };
|
|
40
41
|
}
|
|
41
|
-
function prependJsxImportSource(code, jsxImportSource) {
|
|
42
|
-
if (!jsxImportSource || code.includes("@jsxImportSource")) {
|
|
43
|
-
return code;
|
|
44
|
-
}
|
|
45
|
-
return `/** @jsxImportSource ${jsxImportSource} */
|
|
46
|
-
${code}`;
|
|
47
|
-
}
|
|
48
42
|
function createExtensionPattern(extensions) {
|
|
49
43
|
if (extensions.length === 0) {
|
|
50
44
|
throw new Error("[eco-component-meta-plugin] No extensions configured. At least one integration is required.");
|
|
@@ -67,7 +61,10 @@ function createEcoComponentMetaTransform(options) {
|
|
|
67
61
|
transform(code, id) {
|
|
68
62
|
const integration = detectIntegration(id, extensionToIntegration);
|
|
69
63
|
return {
|
|
70
|
-
code:
|
|
64
|
+
code: prependJsxImportSourceIfMissing(
|
|
65
|
+
injectEcoMeta(code, id, integration.name),
|
|
66
|
+
integration.jsxImportSource
|
|
67
|
+
)
|
|
71
68
|
};
|
|
72
69
|
}
|
|
73
70
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { createJsxImportSourcePragma, filterJsxSourceExtensions } from "./jsx-import-source.utils.js";
|
|
3
4
|
function createForeignJsxOverridePlugin(options) {
|
|
4
|
-
const extensions = options.foreignExtensions
|
|
5
|
-
const excludedExtensions = (options.excludeExtensions ?? [])
|
|
6
|
-
(ext) => ext.endsWith(".tsx") || ext.endsWith(".jsx")
|
|
7
|
-
);
|
|
5
|
+
const extensions = filterJsxSourceExtensions(options.foreignExtensions);
|
|
6
|
+
const excludedExtensions = filterJsxSourceExtensions(options.excludeExtensions ?? []);
|
|
8
7
|
if (extensions.length === 0) {
|
|
9
8
|
return {
|
|
10
9
|
name: options.name ?? "foreign-jsx-override",
|
|
@@ -12,8 +11,7 @@ function createForeignJsxOverridePlugin(options) {
|
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
}
|
|
15
|
-
const pragma =
|
|
16
|
-
`;
|
|
14
|
+
const pragma = createJsxImportSourcePragma(options.hostJsxImportSource);
|
|
17
15
|
const filter = new RegExp(`(${extensions.map((e) => e.replace(".", "\\.")).join("|")})$`);
|
|
18
16
|
return {
|
|
19
17
|
name: options.name ?? "foreign-jsx-override",
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
2
|
-
import { type BrowserRuntimeManifest } from '../build/browser-runtime-manifest.js';
|
|
1
|
+
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
2
|
+
import { type BrowserRuntimeManifest } from '../build/browser/browser-runtime-manifest.js';
|
|
3
3
|
import type { EcoPagesAppConfig, IHmrManager } from '../types/internal-types.js';
|
|
4
4
|
import type { HmrStrategy } from '../hmr/hmr-strategy.js';
|
|
5
5
|
import type { EcoPagesElement } from '../types/public-types.js';
|
|
6
6
|
import type { IntegrationRenderer } from '../route-renderer/orchestration/integration-renderer.js';
|
|
7
7
|
import { AssetProcessingService } from '../services/assets/asset-processing-service/asset-processing.service.js';
|
|
8
8
|
import type { AssetDefinition, ProcessedAsset } from '../services/assets/asset-processing-service/assets.types.js';
|
|
9
|
+
import type { StaticExportContext } from '../static-site-generator/static-export-context.js';
|
|
9
10
|
import type { RuntimeCapabilityDeclaration } from './runtime-capability.js';
|
|
10
11
|
export type { RuntimeCapabilityDeclaration, RuntimeCapabilityTag } from './runtime-capability.js';
|
|
11
|
-
export type { EcoBuildLoader, EcoBuildOnLoadArgs, EcoBuildOnLoadResult, EcoBuildOnResolveArgs, EcoBuildOnResolveResult, EcoBuildPlugin, EcoBuildPluginBuilder, } from '../build/build-types.js';
|
|
12
|
+
export type { EcoBuildLoader, EcoBuildOnLoadArgs, EcoBuildOnLoadResult, EcoBuildOnResolveArgs, EcoBuildOnResolveResult, EcoBuildPlugin, EcoBuildPluginBuilder, } from '../build/contracts/build-types.js';
|
|
12
13
|
export type { PageBrowserGraphContribution, PageBrowserGraphContributionContext } from '../types/public-types.js';
|
|
14
|
+
export type { StaticExportContext } from '../static-site-generator/static-export-context.js';
|
|
13
15
|
export type { HtmlDocumentContribution, HtmlDocumentContributionContext, } from '../route-renderer/orchestration/integration-renderer.js';
|
|
14
16
|
/**
|
|
15
17
|
* Type-erased integration plugin stored in app-level registries.
|
|
@@ -47,13 +49,6 @@ export interface IntegrationPluginConfig {
|
|
|
47
49
|
* They are not specific to any particular page or component.
|
|
48
50
|
*/
|
|
49
51
|
integrationDependencies?: AssetDefinition[];
|
|
50
|
-
/**
|
|
51
|
-
* The strategy to use for static building.
|
|
52
|
-
* - 'render': Execute component function directly (faster, efficient).
|
|
53
|
-
* - 'fetch': Start server and fetch URL (slower, needed for some SSR like Lit).
|
|
54
|
-
* @default 'render'
|
|
55
|
-
*/
|
|
56
|
-
staticBuildStep?: 'render' | 'fetch';
|
|
57
52
|
/**
|
|
58
53
|
* Declares runtime-specific requirements that must be satisfied before the
|
|
59
54
|
* app can start with this integration enabled.
|
|
@@ -87,8 +82,11 @@ type RendererClass<C> = new (options: {
|
|
|
87
82
|
*
|
|
88
83
|
* Core owns lifecycle ordering. Integrations declare contributions through the
|
|
89
84
|
* hooks on this class, while `ConfigBuilder.build()` and app startup decide when
|
|
90
|
-
* those hooks run.
|
|
91
|
-
*
|
|
85
|
+
* those hooks run. Build plugins map to {@link AppBuildManifest} buckets:
|
|
86
|
+
* `plugins` → `runtimePlugins`, `browserBuildPlugins` → `browserBundlePlugins`,
|
|
87
|
+
* `browserRuntimeManifest` → client import rewrite map. For page-browser and
|
|
88
|
+
* document shaping, integrations should prefer the contribution contracts
|
|
89
|
+
* re-exported from this module:
|
|
92
90
|
* `PageBrowserGraphContribution` / `PageBrowserGraphContributionContext` and
|
|
93
91
|
* `HtmlDocumentContribution` / `HtmlDocumentContributionContext`.
|
|
94
92
|
*/
|
|
@@ -96,7 +94,6 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
96
94
|
readonly name: string;
|
|
97
95
|
readonly extensions: string[];
|
|
98
96
|
abstract renderer: RendererClass<C>;
|
|
99
|
-
readonly staticBuildStep: 'render' | 'fetch';
|
|
100
97
|
readonly runtimeCapability?: RuntimeCapabilityDeclaration;
|
|
101
98
|
readonly jsxImportSource?: string;
|
|
102
99
|
protected integrationDependencies: AssetDefinition[];
|
|
@@ -106,6 +103,14 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
106
103
|
protected assetProcessingService?: AssetProcessingService;
|
|
107
104
|
protected hmrManager?: IHmrManager;
|
|
108
105
|
runtimeOrigin: string;
|
|
106
|
+
/**
|
|
107
|
+
* Returns build plugins shared by server-oriented and browser-oriented builds.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Collected into {@link AppBuildManifest.runtimePlugins} during config finalization.
|
|
111
|
+
* MDX loaders, virtual-module resolvers, and other transforms that must run during
|
|
112
|
+
* route-module transpile belong here—not in {@link browserBuildPlugins}.
|
|
113
|
+
*/
|
|
109
114
|
get plugins(): EcoBuildPlugin[];
|
|
110
115
|
/**
|
|
111
116
|
* Returns build plugins that should only apply to browser-oriented bundles.
|
|
@@ -199,11 +204,18 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
199
204
|
* Renderers are cheap runtime objects. They receive the finalized app config,
|
|
200
205
|
* a fresh asset-processing service, integration-global processed assets, and
|
|
201
206
|
* any renderer module context supplied by the active runtime.
|
|
202
|
-
renderer.name ||= this.name;
|
|
203
207
|
*/
|
|
204
208
|
initializeRenderer(options?: {
|
|
205
209
|
rendererModules?: unknown;
|
|
206
210
|
}): IntegrationRenderer<C>;
|
|
211
|
+
/**
|
|
212
|
+
* Shapes one dependency batch before core asset processing runs.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* Integrations use this to assign grouped-build metadata or other batch-level
|
|
216
|
+
* policy without teaching core about integration-specific asset graphs.
|
|
217
|
+
*/
|
|
218
|
+
prepareAssetDependencies?(dependencies: AssetDefinition[]): AssetDefinition[];
|
|
207
219
|
/**
|
|
208
220
|
* Prepares build-facing contributions before the app build manifest is sealed.
|
|
209
221
|
*
|
|
@@ -213,6 +225,23 @@ export declare abstract class IntegrationPlugin<C = EcoPagesElement> {
|
|
|
213
225
|
* `setup()`.
|
|
214
226
|
*/
|
|
215
227
|
prepareBuildContributions(): Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* Reports whether this integration's build inputs changed since the last
|
|
230
|
+
* incremental static build.
|
|
231
|
+
*/
|
|
232
|
+
didChange(): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Runs integration-specific setup before static page generation begins.
|
|
235
|
+
*
|
|
236
|
+
* @remarks
|
|
237
|
+
* Integrations that need build-scoped SSR preload or worker sessions should
|
|
238
|
+
* start them here rather than per-page inside the renderer.
|
|
239
|
+
*/
|
|
240
|
+
beforeStaticExport?(_context: StaticExportContext): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Releases resources started in {@link beforeStaticExport}.
|
|
243
|
+
*/
|
|
244
|
+
afterStaticExport?(_context: StaticExportContext): Promise<void>;
|
|
216
245
|
/**
|
|
217
246
|
* Performs runtime-only integration setup after config build has already
|
|
218
247
|
* sealed manifest contributions.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createBrowserRuntimeManifest
|
|
3
|
+
} from "../build/browser/browser-runtime-manifest.js";
|
|
2
4
|
import { AssetProcessingService } from "../services/assets/asset-processing-service/asset-processing.service.js";
|
|
3
5
|
import { deepMerge } from "../utils/deep-merge.js";
|
|
4
6
|
import { invariant } from "../utils/invariant.js";
|
|
@@ -15,7 +17,6 @@ function assertIntegrationInvariant(condition, message) {
|
|
|
15
17
|
class IntegrationPlugin {
|
|
16
18
|
name;
|
|
17
19
|
extensions;
|
|
18
|
-
staticBuildStep;
|
|
19
20
|
runtimeCapability;
|
|
20
21
|
jsxImportSource;
|
|
21
22
|
integrationDependencies;
|
|
@@ -24,6 +25,14 @@ class IntegrationPlugin {
|
|
|
24
25
|
appConfig;
|
|
25
26
|
assetProcessingService;
|
|
26
27
|
hmrManager;
|
|
28
|
+
/**
|
|
29
|
+
* Returns build plugins shared by server-oriented and browser-oriented builds.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Collected into {@link AppBuildManifest.runtimePlugins} during config finalization.
|
|
33
|
+
* MDX loaders, virtual-module resolvers, and other transforms that must run during
|
|
34
|
+
* route-module transpile belong here—not in {@link browserBuildPlugins}.
|
|
35
|
+
*/
|
|
27
36
|
get plugins() {
|
|
28
37
|
return [];
|
|
29
38
|
}
|
|
@@ -60,7 +69,6 @@ class IntegrationPlugin {
|
|
|
60
69
|
this.name = config.name;
|
|
61
70
|
this.extensions = config.extensions;
|
|
62
71
|
this.integrationDependencies = config.integrationDependencies || [];
|
|
63
|
-
this.staticBuildStep = config.staticBuildStep || "render";
|
|
64
72
|
this.runtimeCapability = config.runtimeCapability;
|
|
65
73
|
this.jsxImportSource = config.jsxImportSource;
|
|
66
74
|
}
|
|
@@ -152,7 +160,6 @@ class IntegrationPlugin {
|
|
|
152
160
|
* Renderers are cheap runtime objects. They receive the finalized app config,
|
|
153
161
|
* a fresh asset-processing service, integration-global processed assets, and
|
|
154
162
|
* any renderer module context supplied by the active runtime.
|
|
155
|
-
renderer.name ||= this.name;
|
|
156
163
|
*/
|
|
157
164
|
initializeRenderer(options) {
|
|
158
165
|
const renderer = new this.renderer(this.createRendererOptions(options));
|
|
@@ -169,6 +176,13 @@ class IntegrationPlugin {
|
|
|
169
176
|
*/
|
|
170
177
|
async prepareBuildContributions() {
|
|
171
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Reports whether this integration's build inputs changed since the last
|
|
181
|
+
* incremental static build.
|
|
182
|
+
*/
|
|
183
|
+
didChange() {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
172
186
|
/**
|
|
173
187
|
* Performs runtime-only integration setup after config build has already
|
|
174
188
|
* sealed manifest contributions.
|
|
@@ -180,7 +194,6 @@ class IntegrationPlugin {
|
|
|
180
194
|
this.integrationDependencies,
|
|
181
195
|
this.name
|
|
182
196
|
);
|
|
183
|
-
this.initializeRenderer();
|
|
184
197
|
}
|
|
185
198
|
/**
|
|
186
199
|
* Releases runtime resources owned by the integration.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
export declare function createJsxImportSourcePragma(jsxImportSource: string): string;
|
|
3
|
+
export declare function prependJsxImportSourceIfMissing(code: string, jsxImportSource: string | undefined): string;
|
|
4
|
+
export declare function isJsxSourceExtension(extension: string): boolean;
|
|
5
|
+
export declare function filterJsxSourceExtensions(extensions: string[]): string[];
|
|
6
|
+
export declare function collectJsxExtensions(integrations: NonNullable<EcoPagesAppConfig['integrations']>, options?: {
|
|
7
|
+
excludeIntegrationName?: string;
|
|
8
|
+
}): string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function createJsxImportSourcePragma(jsxImportSource) {
|
|
2
|
+
return `/** @jsxImportSource ${jsxImportSource} */
|
|
3
|
+
`;
|
|
4
|
+
}
|
|
5
|
+
function prependJsxImportSourceIfMissing(code, jsxImportSource) {
|
|
6
|
+
if (!jsxImportSource || code.includes("@jsxImportSource")) {
|
|
7
|
+
return code;
|
|
8
|
+
}
|
|
9
|
+
return createJsxImportSourcePragma(jsxImportSource) + code;
|
|
10
|
+
}
|
|
11
|
+
function isJsxSourceExtension(extension) {
|
|
12
|
+
return extension.endsWith(".tsx") || extension.endsWith(".jsx");
|
|
13
|
+
}
|
|
14
|
+
function filterJsxSourceExtensions(extensions) {
|
|
15
|
+
return extensions.filter(isJsxSourceExtension);
|
|
16
|
+
}
|
|
17
|
+
function collectJsxExtensions(integrations, options) {
|
|
18
|
+
return integrations.filter((integration) => integration.jsxImportSource).filter((integration) => integration.name !== options?.excludeIntegrationName).flatMap((integration) => filterJsxSourceExtensions(integration.extensions));
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
collectJsxExtensions,
|
|
22
|
+
createJsxImportSourcePragma,
|
|
23
|
+
filterJsxSourceExtensions,
|
|
24
|
+
isJsxSourceExtension,
|
|
25
|
+
prependJsxImportSourceIfMissing
|
|
26
|
+
};
|
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
1
|
+
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
2
2
|
import type { EcoPagesAppConfig, IClientBridge } from '../types/internal-types.js';
|
|
3
|
-
import
|
|
3
|
+
import { GENERATED_BASE_PATHS } from '../config/constants.js';
|
|
4
4
|
import type { RuntimeCapabilityDeclaration } from './runtime-capability.js';
|
|
5
5
|
export type { RuntimeCapabilityDeclaration, RuntimeCapabilityTag } from './runtime-capability.js';
|
|
6
|
-
export type { EcoBuildLoader, EcoBuildOnLoadArgs, EcoBuildOnLoadResult, EcoBuildOnResolveArgs, EcoBuildOnResolveResult, EcoBuildPlugin, EcoBuildPluginBuilder, } from '../build/build-types.js';
|
|
6
|
+
export type { EcoBuildLoader, EcoBuildOnLoadArgs, EcoBuildOnLoadResult, EcoBuildOnResolveArgs, EcoBuildOnResolveResult, EcoBuildPlugin, EcoBuildPluginBuilder, } from '../build/contracts/build-types.js';
|
|
7
7
|
export declare const PROCESSOR_ERRORS: {
|
|
8
8
|
readonly CACHE_DIRECTORY_NOT_SET: "Cache directory not set in context";
|
|
9
9
|
};
|
|
10
10
|
export declare function mergeProcessorOptions<TDefaults, TOverrides>(defaults: TDefaults, overrides: TOverrides): TDefaults & TOverrides;
|
|
11
|
+
export declare function resolveGeneratedPath(type: keyof typeof GENERATED_BASE_PATHS, options: {
|
|
12
|
+
root: string;
|
|
13
|
+
module: string;
|
|
14
|
+
subPath?: string;
|
|
15
|
+
}): string;
|
|
11
16
|
export interface ProcessorWatchContext {
|
|
12
17
|
path: string;
|
|
13
18
|
bridge: IClientBridge;
|
|
14
19
|
}
|
|
15
20
|
export interface ProcessorWatchConfig {
|
|
16
21
|
paths: string[];
|
|
22
|
+
/**
|
|
23
|
+
* File extensions that trigger watch callbacks (`onCreate`, `onChange`, `onDelete`).
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Watch extensions drive notifications only. They do not declare asset ownership.
|
|
27
|
+
* Ownership requires {@link ProcessorConfig.capabilities} and controls whether dev
|
|
28
|
+
* invalidation skips server modules and HMR for processor-handled assets.
|
|
29
|
+
*/
|
|
17
30
|
extensions?: string[];
|
|
18
31
|
onCreate?: (ctx: ProcessorWatchContext) => Promise<void>;
|
|
19
32
|
onChange?: (ctx: ProcessorWatchContext) => Promise<void>;
|
|
@@ -52,22 +65,41 @@ export interface ProcessorContext {
|
|
|
52
65
|
cache?: string;
|
|
53
66
|
}
|
|
54
67
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
68
|
+
* Base class for content and asset processors that contribute build plugins.
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Processors declare plugins through two getters that map to
|
|
72
|
+
* {@link AppBuildManifest} buckets (names differ from integrations):
|
|
73
|
+
*
|
|
74
|
+
* - `plugins` → `runtimePlugins` (server **and** browser builds)
|
|
75
|
+
* - `buildPlugins` → `browserBundlePlugins` (browser bundles only)
|
|
76
|
+
*
|
|
77
|
+
* Virtual modules that must resolve during route-module transpile belong in
|
|
78
|
+
* `plugins`. Browser-only bundler hooks belong in `buildPlugins`.
|
|
59
79
|
*/
|
|
60
80
|
export declare abstract class Processor<TOptions = Record<string, unknown>> {
|
|
61
81
|
readonly name: string;
|
|
62
|
-
protected dependencies: AssetDefinition[];
|
|
63
82
|
protected context?: ProcessorContext;
|
|
64
83
|
protected options?: TOptions;
|
|
65
84
|
protected watchConfig?: ProcessorWatchConfig;
|
|
66
85
|
protected capabilities: ProcessorAssetCapability[];
|
|
67
86
|
readonly runtimeCapability?: RuntimeCapabilityDeclaration;
|
|
68
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Browser-bundle-only plugins.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* Maps to {@link AppBuildManifest.browserBundlePlugins}. Integrations name the
|
|
92
|
+
* same bucket `browserBuildPlugins`.
|
|
93
|
+
*/
|
|
69
94
|
abstract buildPlugins?: EcoBuildPlugin[];
|
|
70
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Shared build plugins for server-oriented and browser-oriented work.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* Maps to {@link AppBuildManifest.runtimePlugins}. Despite the name, these are
|
|
100
|
+
* bundler plugins—not dev-server file processors. Runtime-only setup stays in
|
|
101
|
+
* {@link setup}.
|
|
102
|
+
*/
|
|
71
103
|
abstract plugins?: EcoBuildPlugin[];
|
|
72
104
|
constructor(config: ProcessorConfig<TOptions>);
|
|
73
105
|
setContext(appConfig: EcoPagesAppConfig): void;
|
|
@@ -80,14 +112,31 @@ export declare abstract class Processor<TOptions = Record<string, unknown>> {
|
|
|
80
112
|
* warming or watcher registration should stay in `setup()`.
|
|
81
113
|
*/
|
|
82
114
|
prepareBuildContributions(): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Reports whether this processor's build inputs changed since the last
|
|
117
|
+
* incremental static build.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* No shipped processor overrides this today. Integrations and processors can
|
|
121
|
+
* opt in when they own build inputs that should invalidate incremental static
|
|
122
|
+
* exports without a full rebuild.
|
|
123
|
+
*/
|
|
124
|
+
didChange(): boolean;
|
|
83
125
|
abstract setup(): Promise<void>;
|
|
84
|
-
abstract teardown(): Promise<void>;
|
|
85
126
|
abstract process(input: unknown, filePath?: string): Promise<unknown>;
|
|
127
|
+
/**
|
|
128
|
+
* Releases runtime resources owned by the processor.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* Core does not call this hook today. Override only when a processor owns
|
|
132
|
+
* watchers, compiler handles, or other resources that outlive individual
|
|
133
|
+
* requests.
|
|
134
|
+
*/
|
|
135
|
+
teardown(): Promise<void>;
|
|
86
136
|
protected getCachePath(key: string): string;
|
|
87
137
|
protected readCache<T>(key: string): Promise<T | null>;
|
|
88
138
|
protected writeCache<T>(key: string, data: T): Promise<void>;
|
|
89
139
|
getWatchConfig(): ProcessorWatchConfig | undefined;
|
|
90
|
-
getDependencies(): AssetDefinition[];
|
|
91
140
|
getName(): string;
|
|
92
141
|
getAssetCapabilities(): ProcessorAssetCapability[];
|
|
93
142
|
matchesFileFilter(_filepath: string): boolean;
|
package/src/plugins/processor.js
CHANGED
|
@@ -16,7 +16,6 @@ function resolveGeneratedPath(type, options) {
|
|
|
16
16
|
}
|
|
17
17
|
class Processor {
|
|
18
18
|
name;
|
|
19
|
-
dependencies = [];
|
|
20
19
|
context;
|
|
21
20
|
options;
|
|
22
21
|
watchConfig;
|
|
@@ -54,6 +53,28 @@ class Processor {
|
|
|
54
53
|
*/
|
|
55
54
|
async prepareBuildContributions() {
|
|
56
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Reports whether this processor's build inputs changed since the last
|
|
58
|
+
* incremental static build.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* No shipped processor overrides this today. Integrations and processors can
|
|
62
|
+
* opt in when they own build inputs that should invalidate incremental static
|
|
63
|
+
* exports without a full rebuild.
|
|
64
|
+
*/
|
|
65
|
+
didChange() {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Releases runtime resources owned by the processor.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* Core does not call this hook today. Override only when a processor owns
|
|
73
|
+
* watchers, compiler handles, or other resources that outlive individual
|
|
74
|
+
* requests.
|
|
75
|
+
*/
|
|
76
|
+
async teardown() {
|
|
77
|
+
}
|
|
57
78
|
getCachePath(key) {
|
|
58
79
|
return `${this.context?.cache}/${key}`;
|
|
59
80
|
}
|
|
@@ -76,9 +97,6 @@ class Processor {
|
|
|
76
97
|
getWatchConfig() {
|
|
77
98
|
return this.watchConfig;
|
|
78
99
|
}
|
|
79
|
-
getDependencies() {
|
|
80
|
-
return this.dependencies;
|
|
81
|
-
}
|
|
82
100
|
getName() {
|
|
83
101
|
return this.name;
|
|
84
102
|
}
|
|
@@ -137,5 +155,6 @@ class Processor {
|
|
|
137
155
|
export {
|
|
138
156
|
PROCESSOR_ERRORS,
|
|
139
157
|
Processor,
|
|
140
|
-
mergeProcessorOptions
|
|
158
|
+
mergeProcessorOptions,
|
|
159
|
+
resolveGeneratedPath
|
|
141
160
|
};
|