@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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
+
import { resolveServerAppBuildPlugins } from "../runtime/build-request-policy.js";
|
|
4
|
+
import { createBuildInputsFingerprint } from "./build-input-fingerprint.js";
|
|
5
|
+
import {
|
|
6
|
+
isProductionCacheManifestCurrent,
|
|
7
|
+
matchesProductionCacheBuildKey,
|
|
8
|
+
matchesProductionCacheFingerprint,
|
|
9
|
+
readProductionCacheManifest,
|
|
10
|
+
writeProductionCacheManifest
|
|
11
|
+
} from "./production-build-cache.js";
|
|
12
|
+
import { createPluginCacheKey, getCorePackageVersion } from "./cache-keys.js";
|
|
13
|
+
import {
|
|
14
|
+
RouteModuleDependencyHasher,
|
|
15
|
+
createRouteModuleDependencyHashes
|
|
16
|
+
} from "../../services/module-loading/route-module-dependency-hasher.js";
|
|
17
|
+
import { resolveInternalExecutionDir } from "../../utils/resolve-work-dir.js";
|
|
18
|
+
import { SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME } from "../../utils/resolve-entry-file.js";
|
|
19
|
+
import { SERVER_ENTRY_BUILD_CACHE_FILENAME } from "./cache-constants.js";
|
|
20
|
+
import { SERVER_ENTRY_BUILD_CACHE_FILENAME as SERVER_ENTRY_BUILD_CACHE_FILENAME2 } from "./cache-constants.js";
|
|
21
|
+
const SERVER_BUNDLE_MANIFEST_FILENAME = "manifest.json";
|
|
22
|
+
function getServerEntryCacheDir(appConfig) {
|
|
23
|
+
return path.join(resolveInternalExecutionDir(appConfig), ".server-entry");
|
|
24
|
+
}
|
|
25
|
+
function getServerEntryCacheManifestPath(appConfig) {
|
|
26
|
+
return path.join(getServerEntryCacheDir(appConfig), SERVER_ENTRY_BUILD_CACHE_FILENAME);
|
|
27
|
+
}
|
|
28
|
+
function hashDependencyGraph(entryPath, dependencyGraph, hasher, rootDir) {
|
|
29
|
+
if (!dependencyGraph) {
|
|
30
|
+
return { [path.resolve(entryPath)]: fileSystem.hash(entryPath) };
|
|
31
|
+
}
|
|
32
|
+
return createRouteModuleDependencyHashes(hasher, { dependencyGraph }, entryPath, rootDir);
|
|
33
|
+
}
|
|
34
|
+
function createServerEntryBuildKey(appConfig) {
|
|
35
|
+
try {
|
|
36
|
+
return [
|
|
37
|
+
"server-entry-request-v2",
|
|
38
|
+
"node",
|
|
39
|
+
"esm",
|
|
40
|
+
"external-packages",
|
|
41
|
+
createPluginCacheKey(resolveServerAppBuildPlugins(appConfig))
|
|
42
|
+
].join("::");
|
|
43
|
+
} catch {
|
|
44
|
+
return "server-entry-request-v2::node::esm::external-packages";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function getServerBundleOutputPaths(appConfig) {
|
|
48
|
+
const distDir = appConfig.absolutePaths?.distDir ?? path.join(appConfig.rootDir, appConfig.distDir);
|
|
49
|
+
const serverOutdir = path.join(distDir, SERVER_BUNDLE_DIR);
|
|
50
|
+
const serverEntryPath = path.join(serverOutdir, SERVER_BUNDLE_FILENAME);
|
|
51
|
+
const manifestPath = path.join(serverOutdir, SERVER_BUNDLE_MANIFEST_FILENAME);
|
|
52
|
+
return { distDir, serverOutdir, serverEntryPath, manifestPath };
|
|
53
|
+
}
|
|
54
|
+
function readServerEntryBuildCacheManifest(appConfig) {
|
|
55
|
+
return readProductionCacheManifest(getServerEntryCacheManifestPath(appConfig));
|
|
56
|
+
}
|
|
57
|
+
function writeServerEntryBuildCacheManifest(appConfig, manifest) {
|
|
58
|
+
writeProductionCacheManifest(
|
|
59
|
+
path.join(getServerEntryCacheDir(appConfig), SERVER_ENTRY_BUILD_CACHE_FILENAME),
|
|
60
|
+
manifest
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function writeServerBundleDeployManifest(appConfig, serverEntryPath) {
|
|
64
|
+
const { distDir, manifestPath } = getServerBundleOutputPaths(appConfig);
|
|
65
|
+
fileSystem.ensureDir(path.dirname(manifestPath));
|
|
66
|
+
const payload = {
|
|
67
|
+
serverEntry: path.relative(path.dirname(manifestPath), serverEntryPath) || SERVER_BUNDLE_FILENAME,
|
|
68
|
+
distDir,
|
|
69
|
+
builtAt: Date.now()
|
|
70
|
+
};
|
|
71
|
+
fileSystem.write(manifestPath, `${JSON.stringify(payload, null, " ")}
|
|
72
|
+
`);
|
|
73
|
+
}
|
|
74
|
+
function lookupServerEntryBuildCache(options) {
|
|
75
|
+
if (options.force) {
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
if (process.env.NODE_ENV !== "production") {
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
const entryPath = path.resolve(options.entryPath);
|
|
82
|
+
const entryHash = fileSystem.hash(entryPath);
|
|
83
|
+
const buildInputsFingerprint = createBuildInputsFingerprint(options.appConfig);
|
|
84
|
+
const buildKey = createServerEntryBuildKey(options.appConfig);
|
|
85
|
+
const manifest = readServerEntryBuildCacheManifest(options.appConfig);
|
|
86
|
+
if (!manifest) {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
if (!isProductionCacheManifestCurrent(manifest, getCorePackageVersion())) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
if (manifest.entryPath !== entryPath || manifest.entryHash !== entryHash || !matchesProductionCacheFingerprint(manifest, buildInputsFingerprint) || !matchesProductionCacheBuildKey(manifest, buildKey)) {
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
const hasher = new RouteModuleDependencyHasher();
|
|
96
|
+
if (!hasher.matchesStoredHashes(manifest.dependencyHashes, entryPath, entryHash)) {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
const existingOutputs = manifest.outputPaths.filter((outputPath) => fileSystem.exists(outputPath));
|
|
100
|
+
if (existingOutputs.length === 0) {
|
|
101
|
+
return void 0;
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
manifest,
|
|
105
|
+
outputPaths: existingOutputs
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function recordServerEntryBuildCache(options) {
|
|
109
|
+
if (process.env.NODE_ENV !== "production") {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const entryPath = path.resolve(options.entryPath);
|
|
113
|
+
const entryHash = fileSystem.hash(entryPath);
|
|
114
|
+
const hasher = new RouteModuleDependencyHasher();
|
|
115
|
+
const dependencyHashes = hashDependencyGraph(
|
|
116
|
+
entryPath,
|
|
117
|
+
options.buildResult.dependencyGraph,
|
|
118
|
+
hasher,
|
|
119
|
+
options.appConfig.rootDir
|
|
120
|
+
);
|
|
121
|
+
const manifest = {
|
|
122
|
+
invalidationVersion: getCorePackageVersion(),
|
|
123
|
+
entryPath,
|
|
124
|
+
entryHash,
|
|
125
|
+
buildInputsFingerprint: createBuildInputsFingerprint(options.appConfig),
|
|
126
|
+
buildKey: createServerEntryBuildKey(options.appConfig),
|
|
127
|
+
outputPaths: options.outputPaths,
|
|
128
|
+
dependencyHashes,
|
|
129
|
+
builtAt: Date.now()
|
|
130
|
+
};
|
|
131
|
+
writeServerEntryBuildCacheManifest(options.appConfig, manifest);
|
|
132
|
+
}
|
|
133
|
+
function resolveProductionServerEntry(cwd = process.cwd()) {
|
|
134
|
+
const manifestPath = path.join(cwd, "dist", SERVER_BUNDLE_DIR, SERVER_BUNDLE_MANIFEST_FILENAME);
|
|
135
|
+
if (fileSystem.exists(manifestPath)) {
|
|
136
|
+
try {
|
|
137
|
+
const parsed = JSON.parse(fileSystem.readFileSync(manifestPath));
|
|
138
|
+
if (parsed?.serverEntry) {
|
|
139
|
+
const fromManifest = path.isAbsolute(parsed.serverEntry) ? parsed.serverEntry : path.join(path.dirname(manifestPath), parsed.serverEntry);
|
|
140
|
+
if (fileSystem.exists(fromManifest)) {
|
|
141
|
+
return fromManifest;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (parsed?.distDir) {
|
|
145
|
+
const fromDistDir = path.join(parsed.distDir, SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME);
|
|
146
|
+
if (fileSystem.exists(fromDistDir)) {
|
|
147
|
+
return fromDistDir;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
} catch {
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const legacyPath = path.join(cwd, "dist", SERVER_BUNDLE_DIR, SERVER_BUNDLE_FILENAME);
|
|
154
|
+
return fileSystem.exists(legacyPath) ? legacyPath : void 0;
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
SERVER_BUNDLE_MANIFEST_FILENAME,
|
|
158
|
+
SERVER_ENTRY_BUILD_CACHE_FILENAME2 as SERVER_ENTRY_BUILD_CACHE_FILENAME,
|
|
159
|
+
getServerBundleOutputPaths,
|
|
160
|
+
lookupServerEntryBuildCache,
|
|
161
|
+
readServerEntryBuildCacheManifest,
|
|
162
|
+
recordServerEntryBuildCache,
|
|
163
|
+
resolveProductionServerEntry,
|
|
164
|
+
writeServerBundleDeployManifest
|
|
165
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { EcoSourceTransform } from '../../plugins/source-transform.js';
|
|
2
|
+
import type { EcoBuildPlugin } from './build-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Which backend owns the app's build pipeline.
|
|
5
|
+
*
|
|
6
|
+
* - `'rolldown'`: the default. Ecopages runs the build directly through
|
|
7
|
+
* its bundler-backed adapter.
|
|
8
|
+
* - `'vite-host'`: a host runtime owns the build. {@link ViteHostBuildAdapter}
|
|
9
|
+
* is exposed as a boundary marker; any direct call into it throws.
|
|
10
|
+
*/
|
|
11
|
+
export type BuildOwnership = 'vite-host' | 'rolldown';
|
|
12
|
+
/** A single message emitted by the build backend. */
|
|
13
|
+
export interface BuildLog {
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/** A single artifact emitted by the build backend. */
|
|
17
|
+
export interface BuildOutput {
|
|
18
|
+
path: string;
|
|
19
|
+
}
|
|
20
|
+
/** Per-entrypoint dependency metadata surfaced alongside a build. */
|
|
21
|
+
export interface BuildDependencyGraph {
|
|
22
|
+
entrypoints: Record<string, string[]>;
|
|
23
|
+
}
|
|
24
|
+
/** The full result of one `BuildAdapter.build` call. */
|
|
25
|
+
export interface BuildResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
logs: BuildLog[];
|
|
28
|
+
outputs: BuildOutput[];
|
|
29
|
+
dependencyGraph?: BuildDependencyGraph;
|
|
30
|
+
entryOutputs?: Record<string, string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Options accepted by every `BuildAdapter.build` call.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Fields that the adapter can forward are honored; fields that cannot
|
|
37
|
+
* (currently `splitting`, `bundle`, and `outbase`) are accepted so
|
|
38
|
+
* call-sites compile, but the adapter ignores them.
|
|
39
|
+
*/
|
|
40
|
+
export interface BuildOptions {
|
|
41
|
+
entrypoints: string[] | Record<string, string>;
|
|
42
|
+
outdir?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Base directory for `[dir]` placeholders in `naming`. Currently
|
|
45
|
+
* the bundled adapter derives the base from `root` directly and
|
|
46
|
+
* ignores this field.
|
|
47
|
+
*
|
|
48
|
+
* @deprecated Accepted for call-site compatibility only. Use record-form
|
|
49
|
+
* `entrypoints` keys to preserve directory structure.
|
|
50
|
+
*/
|
|
51
|
+
outbase?: string;
|
|
52
|
+
naming?: string;
|
|
53
|
+
conditions?: string[];
|
|
54
|
+
define?: Record<string, string>;
|
|
55
|
+
minify?: boolean;
|
|
56
|
+
treeshaking?: boolean;
|
|
57
|
+
target?: string;
|
|
58
|
+
format?: string;
|
|
59
|
+
sourcemap?: string;
|
|
60
|
+
/** @deprecated Accepted for call-site compatibility only. */
|
|
61
|
+
splitting?: boolean;
|
|
62
|
+
root?: string;
|
|
63
|
+
/** @deprecated Accepted for call-site compatibility only. */
|
|
64
|
+
bundle?: boolean;
|
|
65
|
+
externalPackages?: boolean;
|
|
66
|
+
external?: string[];
|
|
67
|
+
jsx?: {
|
|
68
|
+
development?: boolean;
|
|
69
|
+
factory?: string;
|
|
70
|
+
fragment?: string;
|
|
71
|
+
importSource?: string;
|
|
72
|
+
runtime?: 'classic' | 'automatic';
|
|
73
|
+
sideEffects?: boolean;
|
|
74
|
+
};
|
|
75
|
+
plugins?: EcoBuildPlugin[];
|
|
76
|
+
sourceTransforms?: EcoSourceTransform[];
|
|
77
|
+
}
|
|
78
|
+
/** Stable profile identifiers for `BuildAdapter.getTranspileOptions`. */
|
|
79
|
+
export type BuildTranspileProfile = 'browser-script' | 'hmr-runtime' | 'hmr-entrypoint';
|
|
80
|
+
/** Resolved transpile settings for a given profile. */
|
|
81
|
+
export interface BuildTranspileOptions {
|
|
82
|
+
target: string;
|
|
83
|
+
format: string;
|
|
84
|
+
sourcemap: string;
|
|
85
|
+
}
|
|
86
|
+
/** Low-level build backend contract. */
|
|
87
|
+
export interface BuildAdapter {
|
|
88
|
+
readonly ownership?: BuildOwnership;
|
|
89
|
+
build(options: BuildOptions): Promise<BuildResult>;
|
|
90
|
+
resolve(importPath: string, rootDir: string): string;
|
|
91
|
+
getTranspileOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
|
|
92
|
+
}
|
|
93
|
+
/** Runtime-facing facade for issuing builds. */
|
|
94
|
+
export interface BuildExecutor {
|
|
95
|
+
build(options: BuildOptions): Promise<BuildResult>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
|
+
import { type BrowserRuntimeManifest } from '../browser/browser-runtime-manifest.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sealed, app-owned registry of build plugins and browser runtime assets.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Core assembles one manifest during {@link ConfigBuilder.build} and stores it on
|
|
8
|
+
* `appConfig.runtime.buildManifest`. Request policy reads from this manifest when
|
|
9
|
+
* constructing server and browser {@link BuildOptions}; profiles do not inject
|
|
10
|
+
* plugins themselves.
|
|
11
|
+
*
|
|
12
|
+
* Contributor naming differs by layer but maps to the same buckets:
|
|
13
|
+
*
|
|
14
|
+
* | Integration getter | Processor getter | Manifest bucket |
|
|
15
|
+
* | --- | --- | --- |
|
|
16
|
+
* | `plugins` | `plugins` | `runtimePlugins` |
|
|
17
|
+
* | `browserBuildPlugins` | `buildPlugins` | `browserBundlePlugins` |
|
|
18
|
+
* | `browserRuntimeManifest` | — | `browserRuntimeManifest` |
|
|
19
|
+
* | — (file loaders on config) | — | `loaderPlugins` |
|
|
20
|
+
*
|
|
21
|
+
* Use {@link getServerBuildPlugins} and {@link getBrowserBuildPlugins} to turn
|
|
22
|
+
* buckets into the plugin lists passed to Rolldown. App-aware call sites should
|
|
23
|
+
* prefer {@link getAppServerBuildPlugins} and {@link getAppBrowserBuildPlugins},
|
|
24
|
+
* which add alias resolution, JSX ownership, and browser source-transform
|
|
25
|
+
* deduplication on top of the manifest lists.
|
|
26
|
+
*/
|
|
27
|
+
export interface AppBuildManifest {
|
|
28
|
+
/** File-extension loaders registered on the app config (for example `.mdx`). */
|
|
29
|
+
loaderPlugins: EcoBuildPlugin[];
|
|
30
|
+
/**
|
|
31
|
+
* Shared plugins for server-oriented and browser-oriented builds.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Sourced from integration `plugins` and processor `plugins`. Virtual-module
|
|
35
|
+
* loaders and transforms that must run during route-module transpile belong
|
|
36
|
+
* here.
|
|
37
|
+
*/
|
|
38
|
+
runtimePlugins: EcoBuildPlugin[];
|
|
39
|
+
/**
|
|
40
|
+
* Browser-bundle-only plugins.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Sourced from integration `browserBuildPlugins` and processor `buildPlugins`.
|
|
44
|
+
* Do not register server route or static-page transforms here.
|
|
45
|
+
*/
|
|
46
|
+
browserBundlePlugins: EcoBuildPlugin[];
|
|
47
|
+
/**
|
|
48
|
+
* Specifier → public URL map for client bundles.
|
|
49
|
+
*
|
|
50
|
+
* @remarks
|
|
51
|
+
* Not a plugin list. {@link getBrowserBuildPlugins} synthesizes
|
|
52
|
+
* `browser-runtime-plugin` from this map to rewrite manifest-owned imports.
|
|
53
|
+
*/
|
|
54
|
+
browserRuntimeManifest: BrowserRuntimeManifest;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Merges plugin lists while preserving first-registration precedence by name.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Build manifests treat plugin names as stable identities. The first plugin
|
|
61
|
+
* with a given name wins so config-time assembly stays deterministic across
|
|
62
|
+
* loader, runtime, and browser buckets.
|
|
63
|
+
*/
|
|
64
|
+
export declare function mergeEcoBuildPlugins(...pluginLists: Array<EcoBuildPlugin[] | undefined>): EcoBuildPlugin[];
|
|
65
|
+
/**
|
|
66
|
+
* Creates one app-owned build manifest from the supplied plugin buckets.
|
|
67
|
+
*/
|
|
68
|
+
export declare function createAppBuildManifest(input?: Partial<AppBuildManifest>): AppBuildManifest;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the shared browser runtime asset manifest sealed into the app build manifest.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getBrowserRuntimeManifest(manifest: AppBuildManifest): BrowserRuntimeManifest;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the plugin list used for server-oriented builds.
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Merges `loaderPlugins` then `runtimePlugins`. Browser-only buckets and the
|
|
78
|
+
* synthesized browser-runtime rewrite plugin are excluded.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getServerBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
81
|
+
/**
|
|
82
|
+
* Returns the plugin list used for browser-oriented builds.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* Merges, in order: `loaderPlugins`, `runtimePlugins`, a synthesized
|
|
86
|
+
* `browser-runtime-plugin` when `browserRuntimeManifest` has entries, then
|
|
87
|
+
* `browserBundlePlugins`. Plugin names dedupe with first-registration wins via
|
|
88
|
+
* {@link mergeEcoBuildPlugins}.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getBrowserBuildPlugins(manifest: AppBuildManifest): EcoBuildPlugin[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME } from "
|
|
1
|
+
import { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME } from "../browser/browser-runtime-plugin.js";
|
|
2
2
|
import {
|
|
3
3
|
createBrowserRuntimeManifest,
|
|
4
4
|
mergeBrowserRuntimeManifests
|
|
5
|
-
} from "
|
|
5
|
+
} from "../browser/browser-runtime-manifest.js";
|
|
6
6
|
function mergeEcoBuildPlugins(...pluginLists) {
|
|
7
7
|
const byName = /* @__PURE__ */ new Map();
|
|
8
8
|
for (const plugins of pluginLists) {
|
|
File without changes
|
|
@@ -2,19 +2,33 @@
|
|
|
2
2
|
* Shared helpers for the Rolldown-backed build adapters.
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* The standard {@link RolldownBuildAdapter}
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* mapping, the same dependency-graph extraction, and the same
|
|
9
|
-
* post-build rewriting pipeline. This module hosts the shared code so
|
|
10
|
-
* the two adapters stay semantically identical.
|
|
5
|
+
* The standard {@link RolldownBuildAdapter} uses these helpers for
|
|
6
|
+
* BuildOptions → Rolldown mapping, dependency-graph extraction, and the
|
|
7
|
+
* post-build rewriting pipeline.
|
|
11
8
|
*
|
|
12
9
|
* @module
|
|
13
10
|
*/
|
|
14
|
-
import type { InputOptions, OutputOptions } from 'rolldown';
|
|
15
|
-
import type { EcoBuildPlugin } from '
|
|
16
|
-
import type { BuildDependencyGraph, BuildLog, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '
|
|
11
|
+
import type { InputOptions, OutputOptions, RolldownPlugin } from 'rolldown';
|
|
12
|
+
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
13
|
+
import type { BuildDependencyGraph, BuildLog, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '../build-adapter.js';
|
|
17
14
|
export declare function transpileProfileToOptions(profile: BuildTranspileProfile): BuildTranspileOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves Node builtins as external before Rolldown falls back to file resolution.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Rolldown documents two first-class externalization points: its `external`
|
|
20
|
+
* option is checked before resolution, and a plugin `resolveId` hook can return
|
|
21
|
+
* `{ id, external: true }`. Core uses the latter to keep Node-builtin ownership
|
|
22
|
+
* explicit in the Node-target plugin pipeline.
|
|
23
|
+
*
|
|
24
|
+
* The hook runs before Rolldown's internal filesystem resolver, leaving imports
|
|
25
|
+
* such as `node:fs` intact for the Node runtime. It is installed only for
|
|
26
|
+
* Node-target builds, so browser bundles still surface accidental Node builtin
|
|
27
|
+
* imports as resolver failures.
|
|
28
|
+
*
|
|
29
|
+
* See {@link https://rolldown.rs/in-depth/external-modules | Rolldown external modules}.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createNodeBuiltinExternalPlugin(): RolldownPlugin;
|
|
18
32
|
export declare function extractDependencyGraph(chunks: Array<{
|
|
19
33
|
facadeModuleId: string | null;
|
|
20
34
|
moduleIds: string[];
|
|
@@ -1,10 +1,46 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
1
|
+
import { builtinModules, createRequire } from "node:module";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
2
3
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
+
import { isBarePackageImportSpecifier } from "../../plugins/tsconfig-import-resolver.js";
|
|
5
|
+
import {
|
|
6
|
+
collectBrowserRuntimeImportRewriteMap,
|
|
7
|
+
rewriteBrowserRuntimeImports
|
|
8
|
+
} from "../browser/browser-runtime-plugin.js";
|
|
4
9
|
import { createServerSideCssShimPlugin } from "./server-side-css-shim-plugin.js";
|
|
5
10
|
import { createRolldownPluginBridge } from "./rolldown-plugin-bridge.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
11
|
+
import {
|
|
12
|
+
isDeclaredAppPackageImport,
|
|
13
|
+
isWorkspacePackageImport,
|
|
14
|
+
normalizeNodeRuntimeBuildOutputs
|
|
15
|
+
} from "./runtime-build-output-normalizer.js";
|
|
16
|
+
const corePackageRequire = createRequire(new URL("../../../package.json", import.meta.url));
|
|
17
|
+
const nodeBuiltinSpecifiers = new Set(builtinModules);
|
|
18
|
+
let corePackageNames;
|
|
19
|
+
function getCorePackageNames() {
|
|
20
|
+
if (corePackageNames) {
|
|
21
|
+
return corePackageNames;
|
|
22
|
+
}
|
|
23
|
+
const packageJsonPath = new URL("../../../package.json", import.meta.url);
|
|
24
|
+
corePackageNames = /* @__PURE__ */ new Set();
|
|
25
|
+
try {
|
|
26
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
27
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
|
|
28
|
+
const entries = packageJson[field];
|
|
29
|
+
if (!entries || typeof entries !== "object") {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
for (const name of Object.keys(entries)) {
|
|
33
|
+
corePackageNames.add(name);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
return corePackageNames;
|
|
39
|
+
}
|
|
40
|
+
function isCoreDeclaredPackageImport(specifier) {
|
|
41
|
+
const name = specifier.startsWith("@") ? specifier.split("/").slice(0, 2).join("/") : specifier.split("/")[0] ?? specifier;
|
|
42
|
+
return getCorePackageNames().has(name);
|
|
43
|
+
}
|
|
8
44
|
function transpileProfileToOptions(profile) {
|
|
9
45
|
switch (profile) {
|
|
10
46
|
case "browser-script":
|
|
@@ -17,8 +53,8 @@ function transpileProfileToOptions(profile) {
|
|
|
17
53
|
};
|
|
18
54
|
}
|
|
19
55
|
}
|
|
20
|
-
function isPackageImport(id) {
|
|
21
|
-
return
|
|
56
|
+
function isPackageImport(id, contextRoot) {
|
|
57
|
+
return isBarePackageImportSpecifier(id, contextRoot);
|
|
22
58
|
}
|
|
23
59
|
function tryResolveModule(id, resolver) {
|
|
24
60
|
try {
|
|
@@ -37,13 +73,21 @@ function getAppRootRequire(cache, contextRoot) {
|
|
|
37
73
|
return req;
|
|
38
74
|
}
|
|
39
75
|
function shouldBundlePackageImport(id, contextRoot, appRootRequireCache) {
|
|
76
|
+
if (isWorkspacePackageImport(id, contextRoot)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
40
79
|
if (isDeclaredAppPackageImport(id, contextRoot)) {
|
|
41
80
|
const appRootRequire = getAppRootRequire(appRootRequireCache, contextRoot);
|
|
42
81
|
const appResolvedPath = tryResolveModule(id, appRootRequire);
|
|
43
82
|
return Boolean(appResolvedPath && /\.(?:[cm]?ts|tsx|jsx)$/u.test(appResolvedPath));
|
|
44
83
|
}
|
|
45
|
-
|
|
46
|
-
|
|
84
|
+
if (isCoreDeclaredPackageImport(id)) {
|
|
85
|
+
const coreResolvedPath = tryResolveModule(id, corePackageRequire);
|
|
86
|
+
if (coreResolvedPath && !/\.(?:[cm]?ts|tsx|jsx)$/u.test(coreResolvedPath)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
47
91
|
}
|
|
48
92
|
function createExternalMatcher(options, appRootRequireCache) {
|
|
49
93
|
const explicitExternals = new Set(options.external ?? []);
|
|
@@ -53,12 +97,23 @@ function createExternalMatcher(options, appRootRequireCache) {
|
|
|
53
97
|
if (explicitExternals.has(id)) {
|
|
54
98
|
return true;
|
|
55
99
|
}
|
|
56
|
-
if (!externalPackages || !isPackageImport(id)) {
|
|
100
|
+
if (!externalPackages || !isPackageImport(id, contextRoot)) {
|
|
57
101
|
return false;
|
|
58
102
|
}
|
|
59
103
|
return !shouldBundlePackageImport(id, contextRoot, appRootRequireCache);
|
|
60
104
|
};
|
|
61
105
|
}
|
|
106
|
+
function isNodeBuiltinSpecifier(id) {
|
|
107
|
+
return id.startsWith("node:") || nodeBuiltinSpecifiers.has(id);
|
|
108
|
+
}
|
|
109
|
+
function createNodeBuiltinExternalPlugin() {
|
|
110
|
+
return {
|
|
111
|
+
name: "ecopages-node-builtin-external",
|
|
112
|
+
resolveId(id) {
|
|
113
|
+
return isNodeBuiltinSpecifier(id) ? { id, external: true } : null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
62
117
|
function mapRolldownFormat(value) {
|
|
63
118
|
switch (value) {
|
|
64
119
|
case "cjs":
|
|
@@ -162,8 +217,13 @@ function resolveRolldownOptions(options, contextRoot, outdir, appRootRequireCach
|
|
|
162
217
|
transformOptions.target = options.target;
|
|
163
218
|
}
|
|
164
219
|
const bundlePlugins = options.plugins ?? [];
|
|
165
|
-
const
|
|
166
|
-
const
|
|
220
|
+
const sourceTransforms = options.target === "browser" ? options.sourceTransforms ?? [] : [];
|
|
221
|
+
const appPlugins = createRolldownPluginBridge(bundlePlugins, contextRoot, sourceTransforms);
|
|
222
|
+
const allPlugins = [
|
|
223
|
+
...mapRolldownPlatform(options.target) === "node" ? [createNodeBuiltinExternalPlugin()] : [],
|
|
224
|
+
...options.target !== "browser" ? [createServerSideCssShimPlugin()] : [],
|
|
225
|
+
...appPlugins
|
|
226
|
+
];
|
|
167
227
|
const inputOptions = {
|
|
168
228
|
input: options.entrypoints,
|
|
169
229
|
cwd: contextRoot,
|
|
@@ -172,6 +232,11 @@ function resolveRolldownOptions(options, contextRoot, outdir, appRootRequireCach
|
|
|
172
232
|
transform: Object.keys(transformOptions).length > 0 ? transformOptions : void 0,
|
|
173
233
|
resolve: options.conditions ? { conditionNames: options.conditions } : void 0,
|
|
174
234
|
treeshake: typeof options.treeshaking === "boolean" ? options.treeshaking : true,
|
|
235
|
+
...process.env.ECOPAGES_PROFILE_BUILD === "1" ? {} : {
|
|
236
|
+
checks: {
|
|
237
|
+
pluginTimings: false
|
|
238
|
+
}
|
|
239
|
+
},
|
|
175
240
|
experimental: {
|
|
176
241
|
nativeMagicString: true
|
|
177
242
|
},
|
|
@@ -215,11 +280,21 @@ function rewriteBrowserRuntimeImportsInOutputs(result, contextRoot, plugins) {
|
|
|
215
280
|
if (rewritten !== code) {
|
|
216
281
|
fs.writeFileSync(output.path, rewritten);
|
|
217
282
|
}
|
|
218
|
-
|
|
283
|
+
rememberRewrite(contentKey);
|
|
219
284
|
}
|
|
220
285
|
return result;
|
|
221
286
|
}
|
|
287
|
+
const REWRITE_CACHE_MAX_ENTRIES = 2048;
|
|
222
288
|
const rewriteCache = /* @__PURE__ */ new Set();
|
|
289
|
+
function rememberRewrite(contentKey) {
|
|
290
|
+
rewriteCache.add(contentKey);
|
|
291
|
+
if (rewriteCache.size > REWRITE_CACHE_MAX_ENTRIES) {
|
|
292
|
+
const oldest = rewriteCache.values().next().value;
|
|
293
|
+
if (oldest !== void 0) {
|
|
294
|
+
rewriteCache.delete(oldest);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
223
298
|
function djb2(input) {
|
|
224
299
|
let hash = 5381;
|
|
225
300
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -246,16 +321,27 @@ function buildResultFromRolldownOutput(output, outdir, contextRoot) {
|
|
|
246
321
|
}));
|
|
247
322
|
const entryChunks = output.output.filter((entry) => entry.type === "chunk" && entry.isEntry);
|
|
248
323
|
const dependencyGraph = entryChunks.length > 0 ? extractDependencyGraph(entryChunks, contextRoot) : void 0;
|
|
324
|
+
const entryOutputs = {};
|
|
325
|
+
for (const chunk of entryChunks) {
|
|
326
|
+
if (chunk.facadeModuleId) {
|
|
327
|
+
entryOutputs[normalizeModulePath(chunk.facadeModuleId, contextRoot)] = normalizeOutputPath(
|
|
328
|
+
chunk.fileName,
|
|
329
|
+
outdir
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
249
333
|
return {
|
|
250
334
|
success: true,
|
|
251
335
|
logs: [],
|
|
252
336
|
outputs,
|
|
253
|
-
dependencyGraph
|
|
337
|
+
dependencyGraph,
|
|
338
|
+
entryOutputs: entryChunks.length > 0 ? entryOutputs : void 0
|
|
254
339
|
};
|
|
255
340
|
}
|
|
256
341
|
export {
|
|
257
342
|
buildResultFromRolldownOutput,
|
|
258
343
|
clearRewriteCacheForTests,
|
|
344
|
+
createNodeBuiltinExternalPlugin,
|
|
259
345
|
extractDependencyGraph,
|
|
260
346
|
resolveRolldownOptions,
|
|
261
347
|
rewriteBrowserRuntimeImportsInOutputs,
|
|
@@ -6,19 +6,15 @@
|
|
|
6
6
|
* default adapter installed by `ConfigBuilder` and the adapter that
|
|
7
7
|
* issues real builds in production.
|
|
8
8
|
*
|
|
9
|
-
* Each `build()` creates a fresh `rolldown()` bundler
|
|
10
|
-
* module-graph reuse across calls. For HMR/watch mode where the same
|
|
11
|
-
* entrypoints are rebuilt repeatedly, see {@link RolldownDevBuildAdapter}.
|
|
9
|
+
* Each `build()` creates a fresh `rolldown()` bundler.
|
|
12
10
|
*/
|
|
13
|
-
import type { BuildAdapter, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '
|
|
11
|
+
import type { BuildAdapter, BuildOptions, BuildResult, BuildTranspileOptions, BuildTranspileProfile } from '../build-adapter.js';
|
|
14
12
|
export declare class RolldownBuildAdapter implements BuildAdapter {
|
|
15
13
|
readonly ownership: "rolldown";
|
|
16
14
|
/** Per-adapter require cache, keyed on resolved context root. */
|
|
17
15
|
private readonly appRootRequireCache;
|
|
18
16
|
/**
|
|
19
|
-
* Issues one build. Creates a fresh `rolldown()` bundler per call
|
|
20
|
-
* so no module-graph reuse. For repeated rebuilds on the same
|
|
21
|
-
* entrypoints, use {@link RolldownDevBuildAdapter}.
|
|
17
|
+
* Issues one build. Creates a fresh `rolldown()` bundler per call.
|
|
22
18
|
*/
|
|
23
19
|
buildOrThrow(options: BuildOptions): Promise<BuildResult>;
|
|
24
20
|
build(options: BuildOptions): Promise<BuildResult>;
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
toBuildLogs,
|
|
10
10
|
transpileProfileToOptions
|
|
11
11
|
} from "./rolldown-adapter-helpers.js";
|
|
12
|
+
import { recordRolldownBuildInvocation } from "./rolldown-build-invocation-metrics.js";
|
|
12
13
|
const moduleRequire = createRequire(import.meta.url);
|
|
13
14
|
class RolldownBuildAdapter {
|
|
14
15
|
ownership = "rolldown";
|
|
15
16
|
/** Per-adapter require cache, keyed on resolved context root. */
|
|
16
17
|
appRootRequireCache = /* @__PURE__ */ new Map();
|
|
17
18
|
/**
|
|
18
|
-
* Issues one build. Creates a fresh `rolldown()` bundler per call
|
|
19
|
-
* so no module-graph reuse. For repeated rebuilds on the same
|
|
20
|
-
* entrypoints, use {@link RolldownDevBuildAdapter}.
|
|
19
|
+
* Issues one build. Creates a fresh `rolldown()` bundler per call.
|
|
21
20
|
*/
|
|
22
21
|
async buildOrThrow(options) {
|
|
22
|
+
recordRolldownBuildInvocation("rolldown");
|
|
23
23
|
const contextRoot = options.root ? path.resolve(options.root) : process.cwd();
|
|
24
24
|
const outdir = path.resolve(options.outdir ?? "dist/assets");
|
|
25
25
|
const plugins = options.plugins ?? [];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide Rolldown build invocation counters for benchmarks and spikes.
|
|
3
|
+
*
|
|
4
|
+
* Gated behind {@link isRolldownBuildMetricsEnabled} so production paths stay quiet.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isRolldownBuildMetricsEnabled(): boolean;
|
|
7
|
+
export declare function recordRolldownBuildInvocation(adapter?: 'rolldown'): void;
|
|
8
|
+
export declare function getRolldownBuildInvocationCounts(): Readonly<Record<string, number>>;
|
|
9
|
+
export declare function resetRolldownBuildInvocationCounts(): void;
|
|
10
|
+
export declare function recordPageModuleBuildInvocation(): void;
|
|
11
|
+
export declare function getPageModuleRolldownBuildInvocations(): number;
|
|
12
|
+
export declare function getTotalRolldownBuildInvocations(): number;
|