@ecopages/core 0.2.1 → 0.3.1
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 +201 -72
- package/package.json +83 -254
- package/src/adapters/create-app.d.ts +56 -19
- package/src/adapters/create-app.js +48 -63
- package/src/adapters/node/create-app.d.ts +218 -15
- package/src/adapters/node/create-app.js +593 -146
- package/src/adapters/node/dev-session.d.ts +35 -0
- package/src/adapters/node/dev-session.js +116 -0
- package/src/adapters/node/http-request-bridge.d.ts +61 -0
- package/src/adapters/node/http-request-bridge.js +207 -0
- package/src/adapters/node/node-client-bridge.d.ts +2 -1
- package/src/adapters/node/node-client-bridge.js +62 -61
- package/src/adapters/node/runtime-host.d.ts +74 -0
- package/src/adapters/node/runtime-host.js +123 -0
- package/src/adapters/node/server-adapter.d.ts +95 -90
- package/src/adapters/node/server-adapter.js +373 -342
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.d.ts +16 -0
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +32 -0
- package/src/adapters/shared/hmr/hmr-html-response.d.ts +14 -0
- package/src/adapters/shared/hmr/hmr-html-response.js +25 -0
- package/src/adapters/shared/hmr/hmr-manager.d.ts +120 -0
- package/src/adapters/shared/hmr/hmr-manager.js +448 -0
- package/src/adapters/shared/http/api-request-pipeline.d.ts +41 -0
- package/src/adapters/shared/http/api-request-pipeline.js +204 -0
- package/src/adapters/shared/{api-response.d.ts → http/api-response.d.ts} +3 -2
- package/src/adapters/shared/http/api-response.js +79 -0
- package/src/adapters/shared/http/create-body-response.d.ts +12 -0
- package/src/adapters/shared/http/create-body-response.js +26 -0
- package/src/adapters/shared/http/define-api-handler.d.ts +48 -0
- package/src/adapters/shared/http/define-api-handler.js +49 -0
- package/src/adapters/shared/http/dist-file-handler.d.ts +16 -0
- package/src/adapters/shared/http/dist-file-handler.js +172 -0
- package/src/adapters/shared/{explicit-static-route-matcher.d.ts → http/explicit-static-route-matcher.d.ts} +9 -11
- package/src/adapters/shared/http/explicit-static-route-matcher.js +64 -0
- package/src/adapters/shared/{file-route-middleware-pipeline.d.ts → http/file-route-middleware-pipeline.d.ts} +8 -11
- package/src/adapters/shared/http/file-route-middleware-pipeline.js +84 -0
- package/src/adapters/shared/http/fs-server-response-factory.d.ts +9 -0
- package/src/adapters/shared/http/fs-server-response-factory.js +23 -0
- package/src/adapters/shared/http/fs-server-response-matcher.d.ts +98 -0
- package/src/adapters/shared/http/fs-server-response-matcher.js +245 -0
- 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/runtime/bind-runtime-server.d.ts +15 -0
- package/src/adapters/shared/runtime/bind-runtime-server.js +44 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.d.ts +8 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +71 -0
- package/src/adapters/shared/runtime/dev-static-route-prewarm.d.ts +13 -0
- package/src/adapters/shared/runtime/dev-static-route-prewarm.js +56 -0
- package/src/adapters/shared/runtime/port-manager-default-prompt.d.ts +6 -0
- package/src/adapters/shared/runtime/port-manager-default-prompt.js +41 -0
- package/src/adapters/shared/runtime/port-manager.d.ts +107 -0
- package/src/adapters/shared/runtime/port-manager.js +170 -0
- package/src/adapters/shared/{render-context.d.ts → runtime/render-context.d.ts} +5 -4
- package/src/adapters/shared/runtime/render-context.js +94 -0
- package/src/adapters/shared/runtime/runtime-app-bootstrap.d.ts +17 -0
- package/src/adapters/shared/runtime/runtime-app-bootstrap.js +34 -0
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +42 -0
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +90 -0
- package/src/adapters/shared/runtime/server-request-pipeline.d.ts +98 -0
- package/src/adapters/shared/runtime/server-request-pipeline.js +272 -0
- package/src/adapters/shared/{server-route-handler.d.ts → runtime/server-route-handler.d.ts} +10 -39
- package/src/adapters/shared/runtime/server-route-handler.js +95 -0
- package/src/adapters/shared/runtime/server-static-builder.d.ts +107 -0
- package/src/adapters/shared/runtime/server-static-builder.js +172 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +20 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +123 -0
- package/src/adapters/shared/ws/websocket-lifecycle.d.ts +23 -0
- package/src/adapters/shared/ws/websocket-lifecycle.js +61 -0
- package/src/adapters/shared/ws/ws-pattern-matcher.d.ts +7 -0
- package/src/adapters/shared/ws/ws-pattern-matcher.js +20 -0
- package/src/assets/app-browser-client-build.d.ts +18 -0
- package/src/assets/app-browser-client-build.js +476 -0
- package/src/assets/app-browser-client-manifest.d.ts +69 -0
- package/src/assets/app-browser-client-manifest.js +332 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +35 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.js +41 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +16 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.js +80 -0
- package/src/assets/asset-processing-service/asset-package-role.d.ts +2 -0
- package/src/assets/asset-processing-service/asset-package-role.js +3 -0
- package/src/assets/asset-processing-service/asset-processing-integration.d.ts +7 -0
- package/src/assets/asset-processing-service/asset-processing-integration.js +6 -0
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +156 -0
- package/src/assets/asset-processing-service/asset-processing.service.js +555 -0
- package/src/assets/asset-processing-service/asset.factory.js +79 -0
- package/src/assets/asset-processing-service/assets.types.d.ts +1 -0
- package/src/{services/assets → assets}/asset-processing-service/browser-runtime-asset.factory.d.ts +4 -1
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +61 -0
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +79 -0
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +200 -0
- package/src/{services/assets → assets}/asset-processing-service/browser-runtime-entry.factory.d.ts +6 -2
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +67 -0
- package/src/assets/asset-processing-service/finalize-processed-asset.d.ts +3 -0
- package/src/assets/asset-processing-service/finalize-processed-asset.js +5 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +11 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.js +39 -0
- package/src/assets/asset-processing-service/index.d.ts +10 -0
- package/src/{services/assets/asset-processing-service/index.d.ts → assets/asset-processing-service/index.js} +4 -0
- package/src/assets/asset-processing-service/inline-content-script-body.d.ts +11 -0
- package/src/assets/asset-processing-service/inline-content-script-body.js +23 -0
- package/src/assets/asset-processing-service/materialize-content-script-asset.d.ts +9 -0
- package/src/assets/asset-processing-service/materialize-content-script-asset.js +22 -0
- package/src/assets/asset-processing-service/page-package.d.ts +6 -0
- package/src/assets/asset-processing-service/page-package.js +81 -0
- package/src/assets/asset-processing-service/processor.interface.d.ts +8 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.d.ts +13 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.js +22 -0
- package/src/assets/asset-processing-service/processors/base/base-script-processor.d.ts +40 -0
- package/src/assets/asset-processing-service/processors/base/base-script-processor.js +136 -0
- package/src/assets/asset-processing-service/processors/index.js +5 -0
- package/src/assets/asset-processing-service/processors/script/classic-script-compiler.d.ts +26 -0
- package/src/assets/asset-processing-service/processors/script/classic-script-compiler.js +92 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +21 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.js +88 -0
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +43 -0
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +165 -0
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +64 -0
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +135 -0
- package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +36 -0
- package/src/{services/assets → assets}/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +40 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +19 -0
- package/src/assets/browser-bundle.service.d.ts +45 -0
- package/src/assets/browser-bundle.service.js +50 -0
- package/src/assets/browser-runtime-asset-page-cache.d.ts +11 -0
- package/src/assets/browser-runtime-asset-page-cache.js +17 -0
- package/src/assets/hashed-browser-asset.d.ts +25 -0
- package/src/assets/hashed-browser-asset.js +99 -0
- package/src/assets/processed-asset-dedupe.d.ts +3 -0
- package/src/assets/processed-asset-dedupe.js +24 -0
- package/src/browser-env.d.ts +4 -0
- package/src/browser-env.js +11 -0
- package/src/build/app-build-manifest-runtime.d.ts +38 -0
- package/src/build/app-build-manifest-runtime.js +126 -0
- package/src/build/browser/browser-runtime-manifest.d.ts +35 -0
- package/src/build/browser/browser-runtime-manifest.js +65 -0
- package/src/build/browser/browser-runtime-plugin-helpers.d.ts +14 -0
- package/src/build/browser/browser-runtime-plugin-helpers.js +21 -0
- package/src/build/browser/browser-runtime-plugin.d.ts +54 -0
- package/src/build/browser/browser-runtime-plugin.js +76 -0
- package/src/build/browser/jsx-ownership-plugins.d.ts +24 -0
- package/src/build/browser/jsx-ownership-plugins.js +55 -0
- package/src/build/browser/lit-static-render-worker-context.d.ts +1 -0
- package/src/build/browser/lit-static-render-worker-context.js +5 -0
- package/src/build/build-adapter.d.ts +11 -228
- package/src/build/build-adapter.js +18 -569
- package/src/build/build-graph.d.ts +34 -0
- package/src/build/build-graph.js +162 -0
- package/src/build/build-log.d.ts +19 -0
- package/src/build/build-log.js +35 -0
- package/src/build/build-parallelism.d.ts +4 -0
- package/src/build/build-parallelism.js +7 -0
- package/src/build/cache/app-config-hash.d.ts +10 -0
- package/src/build/cache/app-config-hash.js +22 -0
- package/src/build/cache/build-input-dependency-index.d.ts +118 -0
- package/src/build/cache/build-input-dependency-index.js +249 -0
- package/src/build/cache/cache-keys.d.ts +6 -0
- package/src/build/cache/cache-keys.js +17 -0
- package/src/build/cache/pages-unified-graph-build.d.ts +54 -0
- package/src/build/cache/pages-unified-graph-build.js +182 -0
- package/src/build/contracts/build-contracts.d.ts +154 -0
- package/src/build/contracts/build-manifest.d.ts +29 -0
- package/src/build/contracts/build-manifest.js +52 -0
- package/src/build/contracts/build-types.d.ts +1 -0
- package/src/build/contracts/build-types.js +1 -0
- package/src/build/contracts/content-virtual-modules.d.ts +14 -0
- package/src/build/contracts/content-virtual-modules.js +37 -0
- package/src/build/contracts/server-only-specifier.d.ts +8 -0
- package/src/build/contracts/server-only-specifier.js +11 -0
- package/src/build/contracts.d.ts +4 -0
- package/src/build/contracts.js +2 -0
- package/src/build/mapped-source-transform.d.ts +22 -0
- package/src/build/mapped-source-transform.js +31 -0
- package/src/build/preserve-import-meta-transform.d.ts +32 -0
- package/src/build/preserve-import-meta-transform.js +138 -0
- package/src/build/rolldown/app-package-declarations.d.ts +8 -0
- package/src/build/rolldown/app-package-declarations.js +81 -0
- package/src/build/rolldown/entry-module-closures.d.ts +8 -0
- package/src/build/rolldown/entry-module-closures.js +39 -0
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +97 -0
- package/src/build/rolldown/rolldown-adapter-helpers.js +570 -0
- package/src/build/rolldown/rolldown-build-adapter.d.ts +26 -0
- package/src/build/rolldown/rolldown-build-adapter.js +85 -0
- package/src/build/rolldown/rolldown-build-invocation-metrics.d.ts +11 -0
- package/src/build/rolldown/rolldown-build-invocation-metrics.js +33 -0
- package/src/build/rolldown/rolldown-plugin-bridge.d.ts +76 -0
- package/src/build/rolldown/rolldown-plugin-bridge.js +450 -0
- package/src/build/rolldown/server-side-css-shim-plugin.d.ts +28 -0
- package/src/build/rolldown/server-side-css-shim-plugin.js +59 -0
- package/src/build/runtime/build-environment-options.d.ts +4 -0
- package/src/build/runtime/build-environment-options.js +20 -0
- package/src/build/runtime/build-queue.d.ts +58 -0
- package/src/build/runtime/build-queue.js +106 -0
- package/src/build/runtime/build-request-identity.d.ts +15 -0
- package/src/build/runtime/build-request-identity.js +52 -0
- package/src/build/runtime/build-request-policy.d.ts +80 -0
- package/src/build/runtime/build-request-policy.js +132 -0
- package/src/build/server/app-module-loader.service.d.ts +35 -0
- package/src/build/server/app-module-loader.service.js +34 -0
- package/src/build/server/page-module-import.service.d.ts +111 -0
- package/src/build/server/page-module-import.service.js +263 -0
- package/src/build/server/route-module-build-cache-registry.d.ts +20 -0
- package/src/build/server/route-module-build-cache-registry.js +41 -0
- package/src/build/server/route-module-build-cache.store.d.ts +49 -0
- package/src/build/server/route-module-build-cache.store.js +75 -0
- package/src/build/server/route-module-build-manifest.d.ts +56 -0
- package/src/build/server/route-module-build-manifest.js +49 -0
- package/src/build/server/route-module-dependency-hasher.d.ts +66 -0
- package/src/build/server/route-module-dependency-hasher.js +131 -0
- package/src/build/server/view-module-loader.d.ts +10 -0
- package/src/build/server/view-module-loader.js +46 -0
- package/src/build/server-bundle-deploy-manifest.d.ts +76 -0
- package/src/build/server-bundle-deploy-manifest.js +178 -0
- package/src/build/server-bundle-publication.d.ts +12 -0
- package/src/build/server-bundle-publication.js +39 -0
- package/src/build/server-module.d.ts +8 -0
- package/src/build/server-module.js +22 -0
- package/src/build/source-maps.d.ts +17 -0
- package/src/build/source-maps.js +29 -0
- package/src/build.d.ts +19 -0
- package/src/build.js +19 -0
- package/src/cache/index.d.ts +7 -0
- package/src/cache/index.js +7 -0
- package/src/cache/module-parse-cache.d.ts +43 -0
- package/src/cache/module-parse-cache.js +97 -0
- package/src/cache/module-transform-profiler.d.ts +7 -0
- package/src/cache/module-transform-profiler.js +8 -0
- package/src/client/navigation-attributes.d.ts +2 -0
- package/src/client/navigation-attributes.js +2 -0
- package/src/client/navigation-scripts/activation.d.ts +36 -0
- package/src/client/navigation-scripts/activation.js +97 -0
- package/src/client/navigation-scripts/classification.d.ts +12 -0
- package/src/client/navigation-scripts/classification.js +49 -0
- package/src/client/navigation-scripts/identity.d.ts +19 -0
- package/src/client/navigation-scripts/identity.js +26 -0
- package/src/client/navigation-scripts/index.d.ts +4 -0
- package/src/client/navigation-scripts/index.js +4 -0
- package/src/client/navigation-scripts/registry.d.ts +12 -0
- package/src/client/navigation-scripts/registry.js +17 -0
- package/src/client/navigation-scripts/rerun-queue.d.ts +30 -0
- package/src/client/navigation-scripts/rerun-queue.js +84 -0
- package/src/client/scroll.d.ts +17 -0
- package/src/client/scroll.js +33 -0
- package/src/client/view-transitions.d.ts +28 -0
- package/src/client/view-transitions.js +121 -0
- package/src/client.d.ts +15 -0
- package/src/client.js +15 -0
- package/src/config/assembly/app-runtime.d.ts +73 -0
- package/src/config/assembly/app-runtime.js +82 -0
- package/src/config/assembly/finalize-config.d.ts +26 -0
- package/src/config/assembly/finalize-config.js +242 -0
- package/src/config/config-module-files.d.ts +11 -0
- package/src/config/config-module-files.js +70 -0
- package/src/config/define-config.d.ts +11 -0
- package/src/config/define-config.js +3 -0
- package/src/config/index.d.ts +6 -0
- package/src/config/index.js +5 -0
- package/src/config/internal-types.d.ts +180 -0
- package/src/config/internal-types.js +1 -0
- package/src/config/load-eco-config.d.ts +15 -0
- package/src/config/load-eco-config.js +72 -0
- package/src/config/resolve-eco-config-path.d.ts +38 -0
- package/src/config/resolve-eco-config-path.js +70 -0
- package/src/config/server-config-bundle.d.ts +14 -0
- package/src/config/server-config-bundle.js +36 -0
- package/src/config/user-config-types.d.ts +152 -0
- package/src/config/user-config-types.js +1 -0
- package/src/config/write-types.d.ts +1 -0
- package/src/config/write-types.js +18 -0
- package/src/{config/constants.d.ts → constants.d.ts} +5 -4
- package/src/constants.js +46 -0
- package/src/css-imports.d.ts +4 -0
- package/src/declarations.d.ts +13 -6
- package/src/dev/development-restart-watch-paths.d.ts +13 -0
- package/src/dev/development-restart-watch-paths.js +44 -0
- package/src/dev/development-restart.d.ts +25 -0
- package/src/dev/development-restart.js +45 -0
- package/src/dev/invalidation/development-invalidation.service.d.ts +153 -0
- package/src/dev/invalidation/development-invalidation.service.js +338 -0
- package/src/dev/runtime-server-started-message.d.ts +10 -0
- package/src/dev/runtime-server-started-message.js +14 -0
- package/src/dev/transform-server/dev-transform-bundler.d.ts +26 -0
- package/src/dev/transform-server/dev-transform-bundler.js +77 -0
- package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +12 -0
- package/src/dev/transform-server/dev-transform-externalize-plugin.js +29 -0
- package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +17 -0
- package/src/dev/transform-server/dev-transform-import-rewriter.js +128 -0
- package/src/dev/transform-server/dev-transform-module-kind.d.ts +13 -0
- package/src/dev/transform-server/dev-transform-module-kind.js +17 -0
- package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +5 -0
- package/src/dev/transform-server/dev-transform-runtime-specifiers.js +16 -0
- package/src/dev/transform-server/dev-transform-server.d.ts +61 -0
- package/src/dev/transform-server/dev-transform-server.js +234 -0
- package/src/dev/transform-server/dev-transform-url.d.ts +18 -0
- package/src/dev/transform-server/dev-transform-url.js +88 -0
- package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +28 -0
- package/src/dev/transform-server/dev-transform-vendor-registry.js +148 -0
- package/src/dev/transform-server/index.d.ts +6 -0
- package/src/dev/transform-server/index.js +4 -0
- package/src/dev/transform-server/types.d.ts +1 -0
- package/src/dev/transform-server/types.js +1 -0
- package/src/dev-toolbar/build-error-contract.d.ts +12 -0
- package/src/dev-toolbar/build-error-contract.js +3 -0
- package/src/dev-toolbar/define-dev-tool.d.ts +21 -0
- package/src/dev-toolbar/define-dev-tool.js +9 -0
- package/src/dev-toolbar/dev-toolbar-config.d.ts +24 -0
- package/src/dev-toolbar/dev-toolbar-config.js +17 -0
- package/src/dev-toolbar/dev-toolbar-manifest-contract.d.ts +22 -0
- package/src/dev-toolbar/dev-toolbar-manifest-contract.js +2 -0
- package/src/dev-toolbar/dev-toolbar-manifest.d.ts +27 -0
- package/src/dev-toolbar/dev-toolbar-manifest.js +65 -0
- package/src/dev-toolbar/dev-toolbar-package.d.ts +34 -0
- package/src/dev-toolbar/dev-toolbar-package.js +78 -0
- package/src/dev-toolbar/dev-toolbar-runtime-paths.d.ts +8 -0
- package/src/dev-toolbar/dev-toolbar-runtime-paths.js +11 -0
- package/src/dev-toolbar/dev-toolbar-runtime.d.ts +10 -0
- package/src/dev-toolbar/dev-toolbar-runtime.js +26 -0
- package/src/diagnostics/request-pipeline-metrics.d.ts +48 -0
- package/src/diagnostics/request-pipeline-metrics.js +113 -0
- package/src/diagnostics/startup-trace.d.ts +71 -0
- package/src/diagnostics/startup-trace.js +247 -0
- package/src/eco/component-identity.d.ts +17 -0
- package/src/eco/component-identity.js +25 -0
- package/src/eco/component-internal-state.d.ts +5 -0
- package/src/eco/component-internal-state.js +17 -0
- package/src/eco/component-render-context.d.ts +60 -0
- package/src/eco/component-render-context.js +140 -0
- package/src/{route-renderer/orchestration/render-output.utils.d.ts → eco/component-render-output.d.ts} +24 -16
- package/src/eco/component-render-output.js +123 -0
- package/src/eco/discovered-dependencies.d.ts +45 -0
- package/src/eco/discovered-dependencies.js +87 -0
- package/src/eco/eco-declared-component.d.ts +15 -0
- package/src/eco/eco-declared-component.js +23 -0
- package/src/eco/eco.browser.d.ts +1 -1
- package/src/eco/eco.browser.js +64 -66
- package/src/eco/eco.d.ts +1 -1
- package/src/eco/eco.js +173 -67
- package/src/eco/global-injector-map.d.ts +3 -3
- package/src/eco/global-injector-map.js +55 -41
- package/src/eco/module-dependencies.js +52 -44
- package/src/eco/page-dependency-contributions.d.ts +19 -0
- package/src/eco/page-dependency-contributions.js +52 -0
- package/src/eco/page-layout-normalization.d.ts +21 -0
- package/src/eco/page-layout-normalization.js +69 -0
- package/src/env.d.ts +31 -7
- package/src/env.js +38 -0
- package/src/errors/http-error-page-contract.d.ts +77 -0
- package/src/errors/http-error-page-contract.js +106 -0
- package/src/errors/http-error.d.ts +10 -2
- package/src/errors/http-error.js +66 -49
- package/src/errors/index.d.ts +2 -0
- package/src/errors/index.js +3 -4
- package/src/errors/locals-access-error.js +5 -8
- package/src/errors/undeclared-component-dependency-error.d.ts +11 -0
- package/src/errors/undeclared-component-dependency-error.js +17 -0
- package/src/global/app-logger.js +4 -6
- package/src/hmr/client/build-error-overlay.d.ts +17 -0
- package/src/hmr/client/build-error-overlay.js +79 -0
- package/src/hmr/client/build-error-presentation.d.ts +2 -0
- package/src/hmr/client/build-error-presentation.js +30 -0
- package/src/hmr/client/hmr-runtime.js +131 -101
- package/src/hmr/client/module-update.d.ts +20 -0
- package/src/hmr/client/module-update.js +56 -0
- package/src/hmr/dev-client-runtime.d.ts +39 -0
- package/src/hmr/dev-client-runtime.js +78 -0
- package/src/hmr/hmr-asset-paths.d.ts +14 -0
- package/src/hmr/hmr-asset-paths.js +22 -0
- package/src/hmr/hmr-entrypoint-output.d.ts +11 -0
- package/src/hmr/hmr-entrypoint-output.js +34 -0
- package/src/hmr/hmr-registered-entrypoints-context.d.ts +7 -0
- package/src/hmr/hmr-registered-entrypoints-context.js +1 -0
- package/src/hmr/hmr-runtime-paths.d.ts +10 -0
- package/src/hmr/hmr-runtime-paths.js +13 -0
- package/src/hmr/hmr-strategy.d.ts +18 -25
- package/src/hmr/hmr-strategy.js +108 -42
- package/src/hmr/strategies/default-hmr-strategy.js +55 -33
- package/src/hmr/strategies/js-hmr-strategy.d.ts +15 -102
- package/src/hmr/strategies/js-hmr-strategy.js +110 -170
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +35 -0
- package/src/html/html-rewriter.d.ts +77 -0
- package/src/html/html-rewriter.js +590 -0
- package/src/html/html-source-parser.d.ts +59 -0
- package/src/html/html-source-parser.js +203 -0
- package/src/html/html-tokenizer.d.ts +69 -0
- package/src/html/html-tokenizer.js +193 -0
- package/src/html/html-transformer.service.d.ts +74 -0
- package/src/html/html-transformer.service.js +173 -0
- package/src/html-pages/html-page-classic-script.d.ts +15 -0
- package/src/html-pages/html-page-classic-script.js +25 -0
- package/src/html-pages/html-page-document.d.ts +33 -0
- package/src/html-pages/html-page-document.js +100 -0
- package/src/html-pages/html-page-module-scripts.d.ts +86 -0
- package/src/html-pages/html-page-module-scripts.js +293 -0
- package/src/html-pages/html-page-module.d.ts +32 -0
- package/src/html-pages/html-page-module.js +113 -0
- package/src/html-pages/html-page-renderer.d.ts +69 -0
- package/src/html-pages/html-page-renderer.js +287 -0
- package/src/html-pages/html-page-template.d.ts +128 -0
- package/src/html-pages/html-page-template.js +495 -0
- package/src/html-pages/html-page-warning-state.d.ts +8 -0
- package/src/html-pages/html-page-warning-state.js +6 -0
- package/src/html-pages/html-pages.plugin.d.ts +23 -0
- package/src/html-pages/html-pages.plugin.js +32 -0
- package/src/index.browser.d.ts +4 -1
- package/src/index.browser.js +5 -4
- package/src/index.d.ts +8 -4
- package/src/index.js +9 -21
- package/src/integration.d.ts +25 -0
- package/src/integration.js +23 -0
- package/src/islands/island-host.d.ts +43 -0
- package/src/islands/island-host.js +65 -0
- package/src/page-cache/cache.types.d.ts +1 -0
- package/src/page-cache/cache.types.js +1 -0
- package/src/page-cache/html-page-cache-dependency-index.d.ts +15 -0
- package/src/page-cache/html-page-cache-dependency-index.js +27 -0
- package/src/{services/cache → page-cache}/memory-cache-store.d.ts +3 -3
- package/src/page-cache/memory-cache-store.js +118 -0
- package/src/{services/cache → page-cache}/page-cache-service.d.ts +29 -10
- package/src/page-cache/page-cache-service.js +374 -0
- package/src/{services/cache → page-cache}/page-request-cache-coordinator.service.d.ts +7 -2
- package/src/page-cache/page-request-cache-coordinator.service.js +139 -0
- package/src/plugins/alias-resolver-cache.d.ts +40 -0
- package/src/plugins/alias-resolver-cache.js +63 -0
- package/src/plugins/alias-resolver-plugin.d.ts +3 -2
- package/src/plugins/alias-resolver-plugin.js +34 -50
- package/src/plugins/component-import-discovery.d.ts +28 -0
- package/src/plugins/component-import-discovery.js +244 -0
- package/src/plugins/define-integration.d.ts +24 -0
- package/src/plugins/define-integration.js +20 -0
- package/src/plugins/eco-component-meta-plugin.d.ts +29 -92
- package/src/plugins/eco-component-meta-plugin.js +367 -161
- package/src/plugins/find-integration-for-file.d.ts +16 -0
- package/src/plugins/find-integration-for-file.js +34 -0
- package/src/plugins/foreign-jsx-override-plugin.d.ts +4 -2
- package/src/plugins/foreign-jsx-override-plugin.js +49 -31
- package/src/plugins/integration-plugin.d.ts +109 -104
- package/src/plugins/integration-plugin.js +150 -172
- package/src/plugins/jsx-import-source.utils.d.ts +7 -0
- package/src/plugins/jsx-import-source.utils.js +15 -0
- package/src/plugins/package-specifier.d.ts +8 -0
- package/src/plugins/package-specifier.js +24 -0
- package/src/plugins/processor.d.ts +85 -34
- package/src/plugins/processor.js +160 -126
- package/src/plugins/tsconfig-import-resolver.d.ts +46 -0
- package/src/plugins/tsconfig-import-resolver.js +268 -0
- package/src/processor.d.ts +4 -0
- package/src/processor.js +3 -0
- package/src/route-renderer/error-pages/default-error-pages.d.ts +39 -0
- package/src/route-renderer/error-pages/default-error-pages.js +193 -0
- package/src/route-renderer/error-pages/error-page-renderer.d.ts +51 -0
- package/src/route-renderer/error-pages/error-page-renderer.js +130 -0
- package/src/route-renderer/error-pages/semantic-error-page-exporter.d.ts +22 -0
- package/src/route-renderer/error-pages/semantic-error-page-exporter.js +33 -0
- package/src/route-renderer/explicit-view-render-preparation.d.ts +44 -0
- package/src/route-renderer/explicit-view-render-preparation.js +49 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +24 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +78 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +164 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.d.ts +17 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +34 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +15 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +65 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +114 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +161 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.d.ts +32 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.js +52 -0
- package/src/route-renderer/orchestration/foreign-child/foreign-child-output.utils.d.ts +4 -0
- package/src/route-renderer/orchestration/foreign-child/foreign-child-output.utils.js +27 -0
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.d.ts +127 -0
- package/src/route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js +319 -0
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.d.ts +18 -0
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.js +33 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +26 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.js +9 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +346 -346
- package/src/route-renderer/orchestration/integration-renderer.js +1209 -942
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +15 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +49 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +70 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.js +177 -0
- package/src/route-renderer/orchestration/ownership-graph/ownership-validation.service.d.ts +26 -0
- package/src/route-renderer/orchestration/ownership-graph/ownership-validation.service.js +74 -0
- package/src/route-renderer/orchestration/ownership-graph/page-client-browser-assets.d.ts +28 -0
- package/src/route-renderer/orchestration/ownership-graph/page-client-browser-assets.js +44 -0
- package/src/route-renderer/orchestration/ownership-graph/page-client-plan.d.ts +40 -0
- package/src/route-renderer/orchestration/ownership-graph/page-client-plan.js +175 -0
- 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 +31 -0
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +33 -0
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +14 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.merge.d.ts +5 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.merge.js +30 -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 +32 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +108 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +486 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +58 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +338 -0
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +26 -0
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +32 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.d.ts +5 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.js +11 -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 +43 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.d.ts +26 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.js +43 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.d.ts +26 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.js +44 -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 +30 -0
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +131 -0
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +350 -0
- package/src/route-renderer/orchestration/string-markup-renderer.d.ts +11 -0
- package/src/route-renderer/orchestration/string-markup-renderer.js +10 -0
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +50 -0
- package/src/route-renderer/page-loading/component-dependency-collection.js +197 -0
- package/src/route-renderer/page-loading/declared-asset-collection.d.ts +24 -0
- package/src/route-renderer/page-loading/declared-asset-collection.js +78 -0
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +41 -6
- package/src/route-renderer/page-loading/dependency-resolver.js +232 -417
- package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +12 -0
- package/src/route-renderer/page-loading/ecopages-virtual-imports.js +100 -0
- package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +41 -0
- package/src/route-renderer/page-loading/file-scoped-dependency-components.js +120 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +44 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.js +74 -0
- package/src/route-renderer/page-loading/lazy-trigger-planning.d.ts +19 -0
- package/src/route-renderer/page-loading/lazy-trigger-planning.js +51 -0
- package/src/route-renderer/page-loading/module-declaration-aggregation.d.ts +5 -0
- package/src/route-renderer/page-loading/module-declaration-aggregation.js +44 -0
- package/src/route-renderer/page-loading/module-declaration-scripts.d.ts +3 -0
- package/src/route-renderer/page-loading/module-declaration-scripts.js +13 -0
- package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +12 -0
- package/src/route-renderer/page-loading/page-dependency-bundling.js +200 -0
- package/src/route-renderer/page-loading/page-module-loader.d.ts +9 -9
- package/src/route-renderer/page-loading/page-module-loader.js +136 -123
- package/src/route-renderer/page-loading/resolved-page-dependencies.d.ts +11 -0
- package/src/route-renderer/page-loading/resolved-page-dependencies.js +39 -0
- package/src/route-renderer/route-renderer.d.ts +36 -35
- package/src/route-renderer/route-renderer.js +48 -93
- package/src/router/client/link-intent.d.ts +11 -21
- package/src/router/client/link-intent.js +56 -30
- package/src/router/client/link-navigation-policy.d.ts +48 -0
- package/src/router/client/link-navigation-policy.js +116 -0
- package/src/router/client/navigation-commit.d.ts +22 -0
- package/src/router/client/navigation-commit.js +57 -0
- package/src/router/client/navigation-coordinator.d.ts +21 -20
- package/src/router/client/navigation-coordinator.js +194 -204
- package/src/router/client/navigation-document.d.ts +37 -0
- package/src/router/client/navigation-document.js +106 -0
- package/src/router/client/navigation-head.d.ts +13 -0
- package/src/router/client/navigation-head.js +238 -0
- package/src/router/client/navigation-lifecycle.d.ts +49 -0
- package/src/router/client/navigation-lifecycle.js +50 -0
- package/src/router/client/navigation-pipeline.d.ts +8 -0
- package/src/router/client/navigation-pipeline.js +8 -0
- package/src/router/client/navigation-replay.d.ts +16 -0
- package/src/router/client/navigation-replay.js +17 -0
- package/src/router/client/navigation-view-transition.d.ts +9 -0
- package/src/router/client/navigation-view-transition.js +61 -0
- package/src/router/server/parse-search-params.d.ts +9 -0
- package/src/router/server/parse-search-params.js +16 -0
- package/src/router/server/route-registry.d.ts +102 -0
- package/src/router/server/route-registry.js +230 -0
- package/src/router/server/segment-path-matcher.d.ts +39 -0
- package/src/router/server/segment-path-matcher.js +179 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +36 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +196 -0
- package/src/static-site-generator/sitemap-routes.d.ts +14 -0
- package/src/static-site-generator/sitemap-routes.js +36 -0
- package/src/static-site-generator/sitemap.d.ts +15 -0
- package/src/static-site-generator/sitemap.js +42 -0
- package/src/static-site-generator/static-export-context.d.ts +33 -0
- package/src/static-site-generator/static-export-context.js +1 -0
- package/src/static-site-generator/static-site-generator.d.ts +52 -52
- package/src/static-site-generator/static-site-generator.js +542 -331
- package/src/types/api-response.d.ts +9 -0
- package/src/types/api-response.js +1 -0
- package/src/{services/assets/asset-processing-service/assets.types.d.ts → types/asset-types.d.ts} +36 -4
- package/src/types/asset-types.js +1 -0
- package/src/types/build-types.d.ts +104 -0
- package/src/types/build-types.js +1 -0
- package/src/{services/cache/cache.types.d.ts → types/cache-types.d.ts} +20 -9
- package/src/types/cache-types.js +5 -0
- package/src/types/component-identity.d.ts +6 -0
- package/src/types/component-identity.js +1 -0
- package/src/types/contracts.d.ts +1513 -0
- package/src/types/contracts.js +1 -0
- package/src/types/dev-transform-types.d.ts +15 -0
- package/src/types/dev-transform-types.js +1 -0
- package/src/{eco/eco.types.d.ts → types/eco-api-types.d.ts} +79 -44
- package/src/types/eco-api-types.js +5 -0
- package/src/types/integration-types.d.ts +3 -0
- package/src/types/integration-types.js +1 -0
- package/src/types/public-types.d.ts +3 -1165
- package/src/types/public-types.js +1 -0
- package/src/types/standard-schema-types.d.ts +12 -0
- package/src/types/standard-schema-types.js +1 -0
- package/src/utils/additional-watch-paths.d.ts +25 -0
- package/src/utils/additional-watch-paths.js +49 -0
- package/src/utils/app-runtime.d.ts +9 -0
- package/src/utils/app-runtime.js +13 -0
- package/src/utils/content-hash.d.ts +8 -0
- package/src/utils/content-hash.js +16 -0
- package/src/utils/deep-merge.js +39 -26
- package/src/utils/ecopages-route-info.d.ts +22 -0
- package/src/utils/ecopages-route-info.js +20 -0
- package/src/utils/format-error-chain.d.ts +9 -0
- package/src/utils/format-error-chain.js +20 -0
- package/src/utils/html-entities.d.ts +10 -0
- package/src/utils/html-entities.js +34 -0
- package/src/utils/html-escaping.d.ts +14 -0
- package/src/utils/html-escaping.js +42 -5
- package/src/utils/invariant.d.ts +6 -1
- package/src/utils/invariant.js +16 -10
- package/src/utils/locals-utils.d.ts +1 -1
- package/src/utils/locals-utils.js +32 -22
- package/src/utils/parse-cli-args.d.ts +3 -6
- package/src/utils/parse-cli-args.js +55 -60
- package/src/utils/path-containment.d.ts +15 -0
- package/src/utils/path-containment.js +27 -0
- package/src/utils/path-pattern.d.ts +23 -0
- package/src/utils/path-pattern.js +42 -0
- package/src/utils/regex-escaping.d.ts +2 -0
- package/src/utils/regex-escaping.js +4 -0
- package/src/utils/resolve-entry-file.d.ts +72 -0
- package/src/utils/resolve-entry-file.js +74 -0
- package/src/utils/resolve-work-dir.js +23 -27
- package/src/utils/runtime.d.ts +12 -9
- package/src/utils/runtime.js +14 -39
- package/src/utils/server-utils.module.d.ts +13 -2
- package/src/utils/server-utils.module.js +74 -53
- package/src/utils/static-file-extensions.d.ts +12 -0
- package/src/utils/static-file-extensions.js +54 -0
- package/src/validation/standard-schema.types.d.ts +1 -0
- package/src/validation/standard-schema.types.js +1 -0
- package/src/validation/validate-request.d.ts +36 -0
- package/src/validation/validate-request.js +56 -0
- package/src/validation/validate-standard-schema.d.ts +7 -0
- package/src/validation/validate-standard-schema.js +14 -0
- package/src/watchers/project-watcher-ignore.d.ts +13 -0
- package/src/watchers/project-watcher-ignore.js +27 -0
- package/src/watchers/project-watcher.d.ts +95 -80
- package/src/watchers/project-watcher.js +526 -264
- package/src/watchers/workspace-package-watch-roots.d.ts +9 -0
- package/src/watchers/workspace-package-watch-roots.js +44 -0
- package/CHANGELOG.md +0 -38
- package/src/adapters/README.md +0 -39
- package/src/adapters/abstract/application-adapter.d.ts +0 -194
- package/src/adapters/abstract/application-adapter.js +0 -121
- package/src/adapters/abstract/router-adapter.d.ts +0 -26
- package/src/adapters/abstract/router-adapter.js +0 -5
- package/src/adapters/abstract/server-adapter.d.ts +0 -69
- package/src/adapters/abstract/server-adapter.js +0 -15
- package/src/adapters/bun/client-bridge.d.ts +0 -34
- package/src/adapters/bun/client-bridge.js +0 -48
- package/src/adapters/bun/create-app.d.ts +0 -52
- package/src/adapters/bun/create-app.js +0 -116
- package/src/adapters/bun/hmr-manager.d.ts +0 -143
- package/src/adapters/bun/hmr-manager.js +0 -334
- package/src/adapters/bun/index.d.ts +0 -2
- package/src/adapters/bun/index.js +0 -8
- package/src/adapters/bun/server-adapter.d.ts +0 -155
- package/src/adapters/bun/server-adapter.js +0 -374
- package/src/adapters/bun/server-lifecycle.d.ts +0 -63
- package/src/adapters/bun/server-lifecycle.js +0 -92
- package/src/adapters/index.d.ts +0 -2
- package/src/adapters/index.js +0 -8
- package/src/adapters/node/node-hmr-manager.d.ts +0 -133
- package/src/adapters/node/node-hmr-manager.js +0 -312
- package/src/adapters/node/static-content-server.d.ts +0 -60
- package/src/adapters/node/static-content-server.js +0 -194
- package/src/adapters/shared/api-response.js +0 -96
- package/src/adapters/shared/application-adapter.d.ts +0 -18
- package/src/adapters/shared/application-adapter.js +0 -90
- 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/explicit-static-route-matcher.js +0 -103
- package/src/adapters/shared/file-route-middleware-pipeline.js +0 -99
- package/src/adapters/shared/fs-server-response-factory.d.ts +0 -19
- package/src/adapters/shared/fs-server-response-factory.js +0 -97
- package/src/adapters/shared/fs-server-response-matcher.d.ts +0 -75
- package/src/adapters/shared/fs-server-response-matcher.js +0 -160
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +0 -55
- package/src/adapters/shared/hmr-entrypoint-registrar.js +0 -87
- package/src/adapters/shared/hmr-html-response.d.ts +0 -22
- package/src/adapters/shared/hmr-html-response.js +0 -32
- package/src/adapters/shared/render-context.js +0 -72
- package/src/adapters/shared/runtime-bootstrap.d.ts +0 -38
- package/src/adapters/shared/runtime-bootstrap.js +0 -43
- package/src/adapters/shared/server-adapter.d.ts +0 -97
- package/src/adapters/shared/server-adapter.js +0 -390
- package/src/adapters/shared/server-route-handler.js +0 -111
- package/src/adapters/shared/server-static-builder.d.ts +0 -70
- package/src/adapters/shared/server-static-builder.js +0 -100
- package/src/build/README.md +0 -107
- package/src/build/build-manifest.d.ts +0 -27
- package/src/build/build-manifest.js +0 -30
- package/src/build/build-types.d.ts +0 -57
- package/src/build/build-types.js +0 -0
- package/src/build/dev-build-coordinator.d.ts +0 -72
- package/src/build/dev-build-coordinator.js +0 -154
- package/src/build/esbuild-build-adapter.d.ts +0 -78
- package/src/build/esbuild-build-adapter.js +0 -505
- package/src/build/runtime-build-executor.d.ts +0 -14
- package/src/build/runtime-build-executor.js +0 -22
- package/src/build/runtime-specifier-alias-plugin.d.ts +0 -15
- package/src/build/runtime-specifier-alias-plugin.js +0 -35
- package/src/build/runtime-specifier-aliases.d.ts +0 -5
- package/src/build/runtime-specifier-aliases.js +0 -95
- package/src/config/README.md +0 -36
- package/src/config/config-builder.d.ts +0 -261
- package/src/config/config-builder.js +0 -602
- package/src/config/constants.js +0 -25
- package/src/dev/sc-server.d.ts +0 -30
- package/src/dev/sc-server.js +0 -111
- package/src/eco/README.md +0 -690
- package/src/eco/eco.types.js +0 -0
- package/src/eco/eco.utils.d.ts +0 -1
- package/src/eco/eco.utils.js +0 -10
- package/src/eco/lazy-injector-map.d.ts +0 -8
- package/src/eco/lazy-injector-map.js +0 -70
- package/src/hmr/README.md +0 -26
- package/src/hmr/hmr.postcss.test.e2e.js +0 -31
- package/src/hmr/hmr.test.e2e.js +0 -43
- package/src/integrations/ghtml/ghtml-renderer.d.ts +0 -20
- package/src/integrations/ghtml/ghtml-renderer.js +0 -63
- package/src/integrations/ghtml/ghtml.plugin.d.ts +0 -20
- package/src/integrations/ghtml/ghtml.plugin.js +0 -21
- package/src/plugins/README.md +0 -35
- package/src/plugins/runtime-capability.d.ts +0 -9
- package/src/plugins/runtime-capability.js +0 -0
- package/src/plugins/source-transform.d.ts +0 -46
- package/src/plugins/source-transform.js +0 -71
- package/src/route-renderer/GRAPH.md +0 -353
- package/src/route-renderer/README.md +0 -116
- package/src/route-renderer/orchestration/component-render-context.d.ts +0 -83
- package/src/route-renderer/orchestration/component-render-context.js +0 -147
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +0 -93
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +0 -155
- package/src/route-renderer/orchestration/render-execution.service.d.ts +0 -43
- package/src/route-renderer/orchestration/render-execution.service.js +0 -106
- package/src/route-renderer/orchestration/render-output.utils.js +0 -65
- package/src/route-renderer/orchestration/render-preparation.service.d.ts +0 -115
- package/src/route-renderer/orchestration/render-preparation.service.js +0 -325
- package/src/route-renderer/orchestration/template-serialization.d.ts +0 -38
- package/src/route-renderer/orchestration/template-serialization.js +0 -45
- package/src/router/README.md +0 -97
- package/src/router/client/link-intent.test.browser.js +0 -43
- package/src/router/server/fs-router-scanner.d.ts +0 -41
- package/src/router/server/fs-router-scanner.js +0 -161
- package/src/router/server/fs-router.d.ts +0 -26
- package/src/router/server/fs-router.js +0 -100
- package/src/services/README.md +0 -29
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +0 -120
- package/src/services/assets/asset-processing-service/asset-processing.service.js +0 -331
- package/src/services/assets/asset-processing-service/asset.factory.js +0 -82
- package/src/services/assets/asset-processing-service/assets.types.js +0 -0
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -48
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -41
- package/src/services/assets/asset-processing-service/index.js +0 -5
- package/src/services/assets/asset-processing-service/processor.interface.d.ts +0 -22
- package/src/services/assets/asset-processing-service/processor.interface.js +0 -6
- package/src/services/assets/asset-processing-service/processor.registry.d.ts +0 -8
- package/src/services/assets/asset-processing-service/processor.registry.js +0 -15
- package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +0 -24
- package/src/services/assets/asset-processing-service/processors/base/base-processor.js +0 -64
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -17
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +0 -72
- package/src/services/assets/asset-processing-service/processors/index.js +0 -5
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +0 -5
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +0 -57
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +0 -9
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +0 -88
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +0 -7
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +0 -75
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +0 -25
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +0 -66
- package/src/services/assets/browser-bundle.service.d.ts +0 -32
- package/src/services/assets/browser-bundle.service.js +0 -33
- package/src/services/cache/cache.types.js +0 -0
- package/src/services/cache/index.d.ts +0 -7
- package/src/services/cache/index.js +0 -7
- package/src/services/cache/memory-cache-store.js +0 -98
- package/src/services/cache/page-cache-service.js +0 -152
- package/src/services/cache/page-request-cache-coordinator.service.js +0 -109
- package/src/services/html/html-rewriter-provider.service.d.ts +0 -37
- package/src/services/html/html-rewriter-provider.service.js +0 -68
- package/src/services/html/html-transformer.service.d.ts +0 -77
- package/src/services/html/html-transformer.service.js +0 -215
- package/src/services/invalidation/development-invalidation.service.d.ts +0 -74
- package/src/services/invalidation/development-invalidation.service.js +0 -190
- package/src/services/module-loading/app-module-loader.service.d.ts +0 -25
- package/src/services/module-loading/app-module-loader.service.js +0 -31
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +0 -24
- package/src/services/module-loading/app-server-module-transpiler.service.js +0 -109
- package/src/services/module-loading/host-module-loader-registry.d.ts +0 -4
- package/src/services/module-loading/host-module-loader-registry.js +0 -15
- package/src/services/module-loading/module-loading-types.d.ts +0 -2
- package/src/services/module-loading/module-loading-types.js +0 -0
- package/src/services/module-loading/node-bootstrap-plugin.d.ts +0 -22
- package/src/services/module-loading/node-bootstrap-plugin.js +0 -192
- package/src/services/module-loading/page-module-import.service.d.ts +0 -75
- package/src/services/module-loading/page-module-import.service.js +0 -161
- package/src/services/module-loading/server-module-transpiler.service.d.ts +0 -72
- package/src/services/module-loading/server-module-transpiler.service.js +0 -64
- package/src/services/runtime-state/dev-graph.service.d.ts +0 -118
- package/src/services/runtime-state/dev-graph.service.js +0 -162
- package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +0 -41
- package/src/services/runtime-state/entrypoint-dependency-graph.service.js +0 -85
- package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +0 -69
- package/src/services/runtime-state/runtime-specifier-registry.service.js +0 -37
- package/src/services/runtime-state/server-invalidation-state.service.d.ts +0 -26
- package/src/services/runtime-state/server-invalidation-state.service.js +0 -35
- package/src/services/validation/schema-validation-service.d.ts +0 -122
- package/src/services/validation/schema-validation-service.js +0 -101
- package/src/services/validation/standard-schema.types.d.ts +0 -65
- package/src/services/validation/standard-schema.types.js +0 -0
- package/src/static-site-generator/README.md +0 -26
- package/src/types/internal-types.d.ts +0 -231
- package/src/types/internal-types.js +0 -0
- package/src/utils/hash.d.ts +0 -1
- package/src/utils/hash.js +0 -7
- package/src/utils/html.d.ts +0 -1
- package/src/utils/html.js +0 -4
- package/src/utils/path-utils.module.d.ts +0 -5
- package/src/utils/path-utils.module.js +0 -14
- package/src/watchers/project-watcher.test-helpers.d.ts +0 -4
- package/src/watchers/project-watcher.test-helpers.js +0 -52
- /package/src/{services/assets → assets}/asset-processing-service/asset.factory.d.ts +0 -0
- /package/src/{hmr/hmr.postcss.test.e2e.d.ts → assets/asset-processing-service/assets.types.js} +0 -0
- /package/src/{hmr/hmr.test.e2e.d.ts → assets/asset-processing-service/processor.interface.js} +0 -0
- /package/src/{services/assets → assets}/asset-processing-service/processors/index.d.ts +0 -0
- /package/src/{services/assets → assets}/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -0
- /package/src/{router/client/link-intent.test.browser.d.ts → build/contracts/build-contracts.js} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified pages Rolldown graph (Phase A build + Phase C import).
|
|
3
|
+
*
|
|
4
|
+
* Enabled by default in production builds. Opt out with
|
|
5
|
+
* `ECOPAGES_UNIFIED_PAGES_GRAPH=false` or `0`. Covers all static page template extensions
|
|
6
|
+
* registered on the app config.
|
|
7
|
+
*/
|
|
8
|
+
import type { EcoPagesAppConfig } from '../../config/internal-types.js';
|
|
9
|
+
import { type RouteModuleDependencyHashes } from '../server/route-module-dependency-hasher.js';
|
|
10
|
+
export interface PagesUnifiedGraphCacheManifest {
|
|
11
|
+
buildKey: string;
|
|
12
|
+
outputs: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Local files reachable from the outputs through local imports, including
|
|
15
|
+
* shared chunks. The graph is reused only while all of them exist.
|
|
16
|
+
*/
|
|
17
|
+
outputImports: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Content hashes for every trackable source file in the graph.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Compiled chunks can outlive a deleted layout or component. Reuse also
|
|
23
|
+
* requires these hashes so a source edit or deletion rebuilds the graph.
|
|
24
|
+
*/
|
|
25
|
+
dependencyHashes: RouteModuleDependencyHashes;
|
|
26
|
+
/**
|
|
27
|
+
* Memoized result of {@link isGraphManifestCurrent} for page imports.
|
|
28
|
+
*/
|
|
29
|
+
importable?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* True when the unified graph should build or serve prebuilt page modules.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Enabled by default in production builds. `ECOPAGES_UNIFIED_PAGES_GRAPH=false` or `0` opts out, which the
|
|
36
|
+
* bench parity suite uses as its per-page build oracle.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shouldBuildPagesUnifiedGraph(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @remarks
|
|
41
|
+
* Pages of an Integration that compiles its own modules (`compilePageModule`), such as
|
|
42
|
+
* HTML Pages, are not bundled, so they stay out of the graph.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isPagesUnifiedGraphPage(filePath: string, appConfig: EcoPagesAppConfig): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Builds eligible static pages in one Rolldown invocation and records outputs for this process.
|
|
47
|
+
*/
|
|
48
|
+
export declare function ensurePagesUnifiedGraphBuilt(options: {
|
|
49
|
+
appConfig: EcoPagesAppConfig;
|
|
50
|
+
entryPaths: readonly string[];
|
|
51
|
+
outdir: string;
|
|
52
|
+
force?: boolean;
|
|
53
|
+
}): Promise<PagesUnifiedGraphCacheManifest | undefined>;
|
|
54
|
+
export declare function importPagesUnifiedGraphModule<T>(appConfig: EcoPagesAppConfig, filePath: string): Promise<T | undefined>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified pages Rolldown graph (Phase A build + Phase C import).
|
|
3
|
+
*
|
|
4
|
+
* Enabled by default in production builds. Opt out with
|
|
5
|
+
* `ECOPAGES_UNIFIED_PAGES_GRAPH=false` or `0`. Covers all static page template extensions
|
|
6
|
+
* registered on the app config.
|
|
7
|
+
*/
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { isEcopagesEnvDisabled } from '../../env.js';
|
|
10
|
+
import { isProductionRuntime } from '../../utils/runtime.js';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
import { fileSystem } from '@ecopages/file-system';
|
|
13
|
+
import { requireAppRuntime } from '../../utils/app-runtime.js';
|
|
14
|
+
import { appLogger } from '../../global/app-logger.js';
|
|
15
|
+
import { findIntegrationForFile } from '../../plugins/find-integration-for-file.js';
|
|
16
|
+
import { buildOrThrow } from '../runtime/build-queue.js';
|
|
17
|
+
import { createServerBuildRequest, resolveAppBuildPlugins } from '../runtime/build-request-policy.js';
|
|
18
|
+
import { hashAppConfigFile } from './app-config-hash.js';
|
|
19
|
+
import { collectBuildOutputImports, getBuildEntryOutput } from '../build-graph.js';
|
|
20
|
+
import { getServerModuleBuildCacheOutdir } from '../server/route-module-build-cache-registry.js';
|
|
21
|
+
import { RouteModuleDependencyHasher, resolveRouteModuleDependencyPaths, } from '../server/route-module-dependency-hasher.js';
|
|
22
|
+
/**
|
|
23
|
+
* True when the unified graph should build or serve prebuilt page modules.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Enabled by default in production builds. `ECOPAGES_UNIFIED_PAGES_GRAPH=false` or `0` opts out, which the
|
|
27
|
+
* bench parity suite uses as its per-page build oracle.
|
|
28
|
+
*/
|
|
29
|
+
export function shouldBuildPagesUnifiedGraph() {
|
|
30
|
+
return !isEcopagesEnvDisabled('ECOPAGES_UNIFIED_PAGES_GRAPH') && isProductionRuntime();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @remarks
|
|
34
|
+
* Pages of an Integration that compiles its own modules (`compilePageModule`), such as
|
|
35
|
+
* HTML Pages, are not bundled, so they stay out of the graph.
|
|
36
|
+
*/
|
|
37
|
+
export function isPagesUnifiedGraphPage(filePath, appConfig) {
|
|
38
|
+
const owner = findIntegrationForFile(appConfig.integrations, path.normalize(filePath));
|
|
39
|
+
return owner !== undefined && !owner.compilePageModule;
|
|
40
|
+
}
|
|
41
|
+
function createPagesUnifiedGraphBuildKey(appConfig, outdir) {
|
|
42
|
+
const pluginNames = resolveAppBuildPlugins(appConfig, 'server')
|
|
43
|
+
.map((plugin) => plugin.name)
|
|
44
|
+
.sort()
|
|
45
|
+
.join('|');
|
|
46
|
+
const templateExtensions = [...appConfig.templatesExt].sort().join('|');
|
|
47
|
+
return [
|
|
48
|
+
path.resolve(outdir),
|
|
49
|
+
hashAppConfigFile(appConfig),
|
|
50
|
+
templateExtensions,
|
|
51
|
+
pluginNames,
|
|
52
|
+
'node',
|
|
53
|
+
'esm',
|
|
54
|
+
'external-packages',
|
|
55
|
+
].join('::');
|
|
56
|
+
}
|
|
57
|
+
function readPagesUnifiedGraphManifest(appConfig) {
|
|
58
|
+
return requireAppRuntime(appConfig).pagesUnifiedGraphManifest ?? undefined;
|
|
59
|
+
}
|
|
60
|
+
function sourceDependenciesAreCurrent(manifest) {
|
|
61
|
+
return new RouteModuleDependencyHasher().matchesStoredHashes(manifest.dependencyHashes);
|
|
62
|
+
}
|
|
63
|
+
function writePagesUnifiedGraphManifest(appConfig, manifest) {
|
|
64
|
+
requireAppRuntime(appConfig).pagesUnifiedGraphManifest = manifest;
|
|
65
|
+
}
|
|
66
|
+
function createSafeGraphEntryKey(entryPath, rootDir) {
|
|
67
|
+
const relativePath = path.relative(rootDir, entryPath).replace(/\.[^.]+$/u, '');
|
|
68
|
+
const safeKey = relativePath.replace(/[^a-zA-Z0-9]+/gu, '-').replace(/^-+|-+$/gu, '');
|
|
69
|
+
return safeKey.length > 0 ? safeKey : 'page';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether `manifest` was built for this graph setup, every file its outputs import
|
|
73
|
+
* still exists, and source hashes still match.
|
|
74
|
+
*/
|
|
75
|
+
function isGraphManifestCurrent(manifest, appConfig, outdir) {
|
|
76
|
+
return (manifest.buildKey === createPagesUnifiedGraphBuildKey(appConfig, outdir) &&
|
|
77
|
+
manifest.outputImports.every((filePath) => fileSystem.exists(filePath)) &&
|
|
78
|
+
sourceDependenciesAreCurrent(manifest));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @remarks
|
|
82
|
+
* In addition to graph freshness and chunk existence on disk, the manifest must
|
|
83
|
+
* match the exact count of active template entries so removing or adding a page
|
|
84
|
+
* invalidates the graph.
|
|
85
|
+
*/
|
|
86
|
+
function isManifestValidForEntries(manifest, appConfig, outdir, entryPaths) {
|
|
87
|
+
return (isGraphManifestCurrent(manifest, appConfig, outdir) &&
|
|
88
|
+
entryPaths.length === Object.keys(manifest.outputs).length &&
|
|
89
|
+
entryPaths.every((entryPath) => {
|
|
90
|
+
const outputPath = manifest.outputs[path.resolve(entryPath)];
|
|
91
|
+
return outputPath ? fileSystem.exists(outputPath) : false;
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* {@link isGraphManifestCurrent} for page imports, memoized per manifest.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Page modules can be imported before the static site generator calls
|
|
99
|
+
* {@link ensurePagesUnifiedGraphBuilt} (for example while collecting static
|
|
100
|
+
* paths), so the import path must not trust a graph this process has already
|
|
101
|
+
* invalidated.
|
|
102
|
+
*/
|
|
103
|
+
function isGraphImportable(manifest, appConfig) {
|
|
104
|
+
if (manifest.importable !== undefined)
|
|
105
|
+
return manifest.importable;
|
|
106
|
+
const current = isGraphManifestCurrent(manifest, appConfig, getServerModuleBuildCacheOutdir(appConfig));
|
|
107
|
+
manifest.importable = current;
|
|
108
|
+
return current;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Builds eligible static pages in one Rolldown invocation and records outputs for this process.
|
|
112
|
+
*/
|
|
113
|
+
export async function ensurePagesUnifiedGraphBuilt(options) {
|
|
114
|
+
requireAppRuntime(options.appConfig);
|
|
115
|
+
if (!shouldBuildPagesUnifiedGraph()) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
const eligibleEntryPaths = Array.from(new Set(options.entryPaths
|
|
119
|
+
.map((entryPath) => path.resolve(entryPath))
|
|
120
|
+
.filter((entryPath) => isPagesUnifiedGraphPage(entryPath, options.appConfig))));
|
|
121
|
+
if (eligibleEntryPaths.length === 0) {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
const outdir = path.resolve(options.outdir);
|
|
125
|
+
const existingManifest = options.force ? undefined : readPagesUnifiedGraphManifest(options.appConfig);
|
|
126
|
+
if (existingManifest &&
|
|
127
|
+
isManifestValidForEntries(existingManifest, options.appConfig, outdir, eligibleEntryPaths)) {
|
|
128
|
+
appLogger.debug('Reusing pages unified graph built in this process');
|
|
129
|
+
return existingManifest;
|
|
130
|
+
}
|
|
131
|
+
const entryRecord = {};
|
|
132
|
+
for (const entryPath of eligibleEntryPaths) {
|
|
133
|
+
const entryKey = createSafeGraphEntryKey(entryPath, options.appConfig.rootDir);
|
|
134
|
+
entryRecord[entryKey] = entryPath;
|
|
135
|
+
}
|
|
136
|
+
appLogger.debugTime('pagesUnifiedGraphBuild');
|
|
137
|
+
const buildOptions = createServerBuildRequest(options.appConfig, {
|
|
138
|
+
entrypoints: entryRecord,
|
|
139
|
+
outdir,
|
|
140
|
+
splitting: true,
|
|
141
|
+
naming: '[name]-[hash].[ext]',
|
|
142
|
+
});
|
|
143
|
+
const buildResult = await buildOrThrow(options.appConfig, buildOptions, 'Pages unified graph build failed').finally(() => appLogger.debugTimeEnd('pagesUnifiedGraphBuild'));
|
|
144
|
+
const outputs = {};
|
|
145
|
+
const outputImports = new Set();
|
|
146
|
+
const dependencyHasher = new RouteModuleDependencyHasher();
|
|
147
|
+
const dependencyHashes = {};
|
|
148
|
+
for (const entryPath of eligibleEntryPaths) {
|
|
149
|
+
const fileHash = fileSystem.hash(entryPath);
|
|
150
|
+
const compiledOutput = getBuildEntryOutput(buildResult, entryPath, options.appConfig.rootDir);
|
|
151
|
+
if (!compiledOutput) {
|
|
152
|
+
throw new Error(`Pages unified graph build produced no output for ${entryPath}`);
|
|
153
|
+
}
|
|
154
|
+
outputs[entryPath] = compiledOutput;
|
|
155
|
+
for (const importPath of collectBuildOutputImports(buildResult, compiledOutput))
|
|
156
|
+
outputImports.add(importPath);
|
|
157
|
+
const dependencyModulePaths = resolveRouteModuleDependencyPaths(buildResult, entryPath, options.appConfig.rootDir);
|
|
158
|
+
Object.assign(dependencyHashes, dependencyHasher.createDependencyHashes(dependencyModulePaths));
|
|
159
|
+
dependencyHashes[path.normalize(entryPath)] = fileHash;
|
|
160
|
+
}
|
|
161
|
+
const manifest = {
|
|
162
|
+
buildKey: createPagesUnifiedGraphBuildKey(options.appConfig, outdir),
|
|
163
|
+
outputs,
|
|
164
|
+
outputImports: [...outputImports],
|
|
165
|
+
dependencyHashes,
|
|
166
|
+
};
|
|
167
|
+
writePagesUnifiedGraphManifest(options.appConfig, manifest);
|
|
168
|
+
appLogger.debug(`Built pages unified graph for ${eligibleEntryPaths.length} entries`);
|
|
169
|
+
return manifest;
|
|
170
|
+
}
|
|
171
|
+
export async function importPagesUnifiedGraphModule(appConfig, filePath) {
|
|
172
|
+
const manifest = readPagesUnifiedGraphManifest(appConfig);
|
|
173
|
+
if (!manifest || !isGraphImportable(manifest, appConfig)) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
const resolvedFilePath = path.resolve(filePath);
|
|
177
|
+
const outputPath = manifest.outputs[resolvedFilePath];
|
|
178
|
+
if (!outputPath || !fileSystem.exists(outputPath)) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
return (await import(/* @vite-ignore */ pathToFileURL(outputPath).href));
|
|
182
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
|
+
/** A single artifact emitted by the build backend. */
|
|
3
|
+
export interface BuildOutput {
|
|
4
|
+
path: string;
|
|
5
|
+
/** Output bytes returned by a memory-only build request. */
|
|
6
|
+
content?: string | Uint8Array;
|
|
7
|
+
/** Whether the emitted filename is content-addressed according to the output naming policy. */
|
|
8
|
+
contentHashed?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Per-entrypoint dependency metadata surfaced alongside a build. */
|
|
11
|
+
export interface BuildDependencyGraph {
|
|
12
|
+
/**
|
|
13
|
+
* Each entry's resolved absolute path, mapped to its static and dynamic source
|
|
14
|
+
* module closure, including inlined and tree-shaken imports and the entry itself.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Production caches hash these files to decide reuse, so an omitted module leaves stale output after it
|
|
18
|
+
* changes.
|
|
19
|
+
*/
|
|
20
|
+
entrypoints: Record<string, string[]>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One error or warning of a build.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* `plugin` names the `EcoBuildPlugin` that threw, not the bridge plugin that hosts it. Terminal colour codes
|
|
27
|
+
* are stripped from `message` and `frame`.
|
|
28
|
+
*/
|
|
29
|
+
export interface BuildLog {
|
|
30
|
+
message: string;
|
|
31
|
+
code?: string;
|
|
32
|
+
plugin?: string;
|
|
33
|
+
hook?: string;
|
|
34
|
+
id?: string;
|
|
35
|
+
loc?: {
|
|
36
|
+
file?: string;
|
|
37
|
+
line: number;
|
|
38
|
+
column: number;
|
|
39
|
+
};
|
|
40
|
+
frame?: string;
|
|
41
|
+
stack?: string;
|
|
42
|
+
}
|
|
43
|
+
/** The result of a build that produced its outputs. */
|
|
44
|
+
export interface BuildSuccess {
|
|
45
|
+
success: true;
|
|
46
|
+
outputs: BuildOutput[];
|
|
47
|
+
/** Warnings reported by the bundler. */
|
|
48
|
+
warnings: BuildLog[];
|
|
49
|
+
/** Absolute filesystem paths recorded by plugin load hooks during this build. */
|
|
50
|
+
loadedInputs: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Filesystem inputs recorded by each plugin-loaded module in this build.
|
|
53
|
+
*
|
|
54
|
+
* @remarks
|
|
55
|
+
* Cache owners use module ownership to keep plugin inputs scoped to their
|
|
56
|
+
* own entry closure, including when one entry's plugin explicitly reads a
|
|
57
|
+
* file that another entry loads as a source module.
|
|
58
|
+
*/
|
|
59
|
+
loadedInputsByModule: Record<string, string[]>;
|
|
60
|
+
dependencyGraph: BuildDependencyGraph;
|
|
61
|
+
/**
|
|
62
|
+
* Emitted absolute output paths keyed by the entry path or name the caller
|
|
63
|
+
* passed, plus the bundler's facade path when that spelling differs.
|
|
64
|
+
*/
|
|
65
|
+
entryOutputs: Record<string, string>;
|
|
66
|
+
/** All emitted chunks keyed by absolute output path; local external edges remain leaves. */
|
|
67
|
+
outputGraph: Record<string, BuildChunk>;
|
|
68
|
+
}
|
|
69
|
+
/** The result of a build that failed: it emitted nothing and says why. */
|
|
70
|
+
export interface BuildFailure {
|
|
71
|
+
success: false;
|
|
72
|
+
/** The errors of the build. */
|
|
73
|
+
logs: BuildLog[];
|
|
74
|
+
}
|
|
75
|
+
/** The full result of one `BuildAdapter.build` call. */
|
|
76
|
+
export type BuildResult = BuildSuccess | BuildFailure;
|
|
77
|
+
export interface BuildChunk {
|
|
78
|
+
fileName: string;
|
|
79
|
+
imports: string[];
|
|
80
|
+
dynamicImports: string[];
|
|
81
|
+
isEntry: boolean;
|
|
82
|
+
facadeModuleId: string | null;
|
|
83
|
+
}
|
|
84
|
+
/** Targets supported by the Ecopages build adapter. */
|
|
85
|
+
export type BuildTarget = 'browser' | 'node' | 'es3' | 'es5' | 'esnext' | `es${number}` | `chrome${string}` | `edge${string}` | `firefox${string}` | `safari${string}` | `hermes${string}` | `deno${string}` | `ios${string}`;
|
|
86
|
+
/** Output formats normalized by the Ecopages build adapter. */
|
|
87
|
+
export type BuildFormat = 'esm' | 'cjs' | 'iife';
|
|
88
|
+
/** Source map modes accepted by the Ecopages build adapter. */
|
|
89
|
+
export type BuildSourcemap = 'none' | 'inline' | 'external' | 'linked' | 'hidden';
|
|
90
|
+
/**
|
|
91
|
+
* Options accepted by every `BuildAdapter.build` call.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* Fields that the adapter can forward are honored. `splitting: false` disables
|
|
95
|
+
* Rolldown code splitting for single-entrypoint builds.
|
|
96
|
+
*/
|
|
97
|
+
export interface BuildOptions {
|
|
98
|
+
environment: BuildEnvironment;
|
|
99
|
+
entrypoints: string[] | Record<string, string>;
|
|
100
|
+
outdir?: string;
|
|
101
|
+
naming?: string;
|
|
102
|
+
conditions?: string[];
|
|
103
|
+
define?: Record<string, string>;
|
|
104
|
+
minify?: boolean;
|
|
105
|
+
treeshaking?: boolean;
|
|
106
|
+
target?: BuildTarget;
|
|
107
|
+
format?: BuildFormat;
|
|
108
|
+
sourcemap?: BuildSourcemap;
|
|
109
|
+
/** When `false` with a single entrypoint, inlines dynamic imports into one output file. */
|
|
110
|
+
splitting?: boolean;
|
|
111
|
+
root?: string;
|
|
112
|
+
externalPackages?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Logs the externalized packages that resolve outside `root`, one line per
|
|
115
|
+
* build, named by its entry files in `runtimeOutdir` (or `outdir`).
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* Set by the `server-entry` profile only: the server entry and the emitted
|
|
119
|
+
* config are what gets deployed, while module builds that the running
|
|
120
|
+
* server makes on the deploy target stay silent.
|
|
121
|
+
*/
|
|
122
|
+
reportPackagesOutsideRoot?: boolean;
|
|
123
|
+
/** Directory the output runs from when it is written to a staging `outdir` first. Defaults to `outdir`. */
|
|
124
|
+
runtimeOutdir?: string;
|
|
125
|
+
/** Keep generated outputs in the returned result instead of writing files to disk. */
|
|
126
|
+
writeToDisk?: boolean;
|
|
127
|
+
external?: string[];
|
|
128
|
+
jsx?: {
|
|
129
|
+
development?: boolean;
|
|
130
|
+
factory?: string;
|
|
131
|
+
fragment?: string;
|
|
132
|
+
importSource?: string;
|
|
133
|
+
runtime?: 'classic' | 'automatic';
|
|
134
|
+
sideEffects?: boolean;
|
|
135
|
+
};
|
|
136
|
+
plugins?: EcoBuildPlugin[];
|
|
137
|
+
}
|
|
138
|
+
/** Compilation environment, independent of the build queue's scheduling lane. */
|
|
139
|
+
export type BuildEnvironment = 'server' | 'browser';
|
|
140
|
+
/** Resolved transpile settings for a compilation environment. */
|
|
141
|
+
export interface BuildTranspileOptions {
|
|
142
|
+
target: BuildTarget;
|
|
143
|
+
format: BuildFormat;
|
|
144
|
+
sourcemap: BuildSourcemap;
|
|
145
|
+
}
|
|
146
|
+
/** Low-level build backend contract. */
|
|
147
|
+
export interface BuildAdapter {
|
|
148
|
+
build(options: BuildOptions): Promise<BuildResult>;
|
|
149
|
+
resolve(importPath: string, rootDir: string): string;
|
|
150
|
+
}
|
|
151
|
+
/** Runtime-facing facade for issuing builds. */
|
|
152
|
+
export interface BuildExecutor {
|
|
153
|
+
build(options: BuildOptions): Promise<BuildResult>;
|
|
154
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
|
+
import type { BuildEnvironment } from './build-contracts.js';
|
|
3
|
+
import { type BrowserRuntimeManifest } from '../browser/browser-runtime-manifest.js';
|
|
4
|
+
/**
|
|
5
|
+
* App-owned build plugins, already selected per environment, and the separate browser runtime declarations.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Sealed once by {@link createAppBuildManifest}. Readers take `server` or `browser` as it is and do not filter.
|
|
9
|
+
*/
|
|
10
|
+
export interface AppBuildManifest {
|
|
11
|
+
server: EcoBuildPlugin[];
|
|
12
|
+
browser: EcoBuildPlugin[];
|
|
13
|
+
browserRuntimeManifest: BrowserRuntimeManifest;
|
|
14
|
+
}
|
|
15
|
+
/** One plugin an app contributes to its build manifest, and who contributed it. */
|
|
16
|
+
export interface BuildPluginRegistration {
|
|
17
|
+
plugin: EcoBuildPlugin;
|
|
18
|
+
source: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function appliesToBuildEnvironment(plugin: EcoBuildPlugin, environment: BuildEnvironment): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Seals the app's build manifest: validates every registration once and stores the plugins per environment.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* Registration order is kept. The browser list puts the plugins that also apply to the server first, then the
|
|
26
|
+
* browser runtime plugin that maps manifest specifiers to public URLs, then the browser-only plugins, because
|
|
27
|
+
* the first plugin to return a result for a resolve or load wins.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createAppBuildManifest(registrations: readonly BuildPluginRegistration[], browserRuntimeManifest?: BrowserRuntimeManifest): AppBuildManifest;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createBrowserRuntimePlugin, DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME } from '../browser/browser-runtime-plugin.js';
|
|
2
|
+
import { mergeBrowserRuntimeManifests } from '../browser/browser-runtime-manifest.js';
|
|
3
|
+
export function appliesToBuildEnvironment(plugin, environment) {
|
|
4
|
+
return plugin.environments?.includes(environment) ?? true;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @remarks
|
|
8
|
+
* Names identify plugins within an environment. Reject overlapping registrations
|
|
9
|
+
* instead of silently dropping a contributor's hooks.
|
|
10
|
+
*/
|
|
11
|
+
function validateBuildPluginRegistrations(registrations) {
|
|
12
|
+
const sources = new Map();
|
|
13
|
+
for (const { plugin, source } of registrations) {
|
|
14
|
+
for (const environment of ['server', 'browser']) {
|
|
15
|
+
if (!appliesToBuildEnvironment(plugin, environment))
|
|
16
|
+
continue;
|
|
17
|
+
const key = `${plugin.name}:${environment}`;
|
|
18
|
+
const previous = sources.get(key);
|
|
19
|
+
if (previous) {
|
|
20
|
+
throw new Error(`Build plugin "${plugin.name}" for ${environment} is registered by both ${previous} and ${source}.`);
|
|
21
|
+
}
|
|
22
|
+
sources.set(key, source);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Seals the app's build manifest: validates every registration once and stores the plugins per environment.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Registration order is kept. The browser list puts the plugins that also apply to the server first, then the
|
|
31
|
+
* browser runtime plugin that maps manifest specifiers to public URLs, then the browser-only plugins, because
|
|
32
|
+
* the first plugin to return a result for a resolve or load wins.
|
|
33
|
+
*/
|
|
34
|
+
export function createAppBuildManifest(registrations, browserRuntimeManifest) {
|
|
35
|
+
validateBuildPluginRegistrations(registrations);
|
|
36
|
+
const plugins = registrations.map(({ plugin }) => plugin);
|
|
37
|
+
const runtimeManifest = mergeBrowserRuntimeManifests(browserRuntimeManifest);
|
|
38
|
+
const runtimePlugin = createBrowserRuntimePlugin({
|
|
39
|
+
name: DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME,
|
|
40
|
+
manifest: runtimeManifest,
|
|
41
|
+
});
|
|
42
|
+
const browserPlugins = plugins.filter((plugin) => appliesToBuildEnvironment(plugin, 'browser'));
|
|
43
|
+
return {
|
|
44
|
+
server: plugins.filter((plugin) => appliesToBuildEnvironment(plugin, 'server')),
|
|
45
|
+
browser: [
|
|
46
|
+
...browserPlugins.filter((plugin) => appliesToBuildEnvironment(plugin, 'server')),
|
|
47
|
+
...(runtimePlugin ? [runtimePlugin] : []),
|
|
48
|
+
...browserPlugins.filter((plugin) => !appliesToBuildEnvironment(plugin, 'server')),
|
|
49
|
+
],
|
|
50
|
+
browserRuntimeManifest: runtimeManifest,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from '../../types/build-types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Virtual module prefix for collection imports, e.g. `ecopages:content/docs`. */
|
|
2
|
+
export declare const CONTENT_VIRTUAL_MODULE_PREFIX = "ecopages:content";
|
|
3
|
+
/** Matches `ecopages:content/<collection>` metadata specifiers (no MDX imports). */
|
|
4
|
+
export declare const CONTENT_VIRTUAL_MODULE_PATTERN: RegExp;
|
|
5
|
+
/** Matches `ecopages:content/<collection>/server` component resolver specifiers. */
|
|
6
|
+
export declare const CONTENT_SERVER_VIRTUAL_MODULE_PATTERN: RegExp;
|
|
7
|
+
/** Matches browser-only `ecopages:content/<collection>/browser` component loader specifiers. */
|
|
8
|
+
export declare const CONTENT_BROWSER_VIRTUAL_MODULE_PATTERN: RegExp;
|
|
9
|
+
export type ParsedCollectionSpecifier = {
|
|
10
|
+
collectionName: string;
|
|
11
|
+
variant: 'entries' | 'server' | 'browser';
|
|
12
|
+
};
|
|
13
|
+
export declare function parseCollectionSpecifier(specifier: string): ParsedCollectionSpecifier | null;
|
|
14
|
+
export declare function isContentServerVirtualModule(specifier: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Virtual module prefix for collection imports, e.g. `ecopages:content/docs`. */
|
|
2
|
+
export const CONTENT_VIRTUAL_MODULE_PREFIX = 'ecopages:content';
|
|
3
|
+
/** Matches `ecopages:content/<collection>` metadata specifiers (no MDX imports). */
|
|
4
|
+
export const CONTENT_VIRTUAL_MODULE_PATTERN = /^ecopages:content\/[a-z][a-z0-9-]*$/;
|
|
5
|
+
/** Matches `ecopages:content/<collection>/server` component resolver specifiers. */
|
|
6
|
+
export const CONTENT_SERVER_VIRTUAL_MODULE_PATTERN = /^ecopages:content\/[a-z][a-z0-9-]+\/server$/;
|
|
7
|
+
/** Matches browser-only `ecopages:content/<collection>/browser` component loader specifiers. */
|
|
8
|
+
export const CONTENT_BROWSER_VIRTUAL_MODULE_PATTERN = /^ecopages:content\/[a-z][a-z0-9-]+\/browser$/;
|
|
9
|
+
export function parseCollectionSpecifier(specifier) {
|
|
10
|
+
const normalized = specifier.startsWith(`${CONTENT_VIRTUAL_MODULE_PREFIX}/`)
|
|
11
|
+
? specifier.slice(`${CONTENT_VIRTUAL_MODULE_PREFIX}/`.length)
|
|
12
|
+
: specifier.startsWith('content/')
|
|
13
|
+
? specifier.slice('content/'.length)
|
|
14
|
+
: null;
|
|
15
|
+
if (!normalized) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (normalized.endsWith('/server')) {
|
|
19
|
+
return {
|
|
20
|
+
collectionName: normalized.slice(0, -'/server'.length),
|
|
21
|
+
variant: 'server',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (normalized.endsWith('/browser')) {
|
|
25
|
+
return {
|
|
26
|
+
collectionName: normalized.slice(0, -'/browser'.length),
|
|
27
|
+
variant: 'browser',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
collectionName: normalized,
|
|
32
|
+
variant: 'entries',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function isContentServerVirtualModule(specifier) {
|
|
36
|
+
return CONTENT_SERVER_VIRTUAL_MODULE_PATTERN.test(specifier);
|
|
37
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @remarks
|
|
3
|
+
* Matches the `.server` naming convention with or without a file extension,
|
|
4
|
+
* ignoring query and fragment suffixes used by module resolver plugins,
|
|
5
|
+
* so import pruning and browser resolution enforce the same boundary.
|
|
6
|
+
* This module has no runtime dependencies and is safe to import in the browser.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isServerOnlyModuleSpecifier(specifier: string): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @remarks
|
|
3
|
+
* Matches the `.server` naming convention with or without a file extension,
|
|
4
|
+
* ignoring query and fragment suffixes used by module resolver plugins,
|
|
5
|
+
* so import pruning and browser resolution enforce the same boundary.
|
|
6
|
+
* This module has no runtime dependencies and is safe to import in the browser.
|
|
7
|
+
*/
|
|
8
|
+
export function isServerOnlyModuleSpecifier(specifier) {
|
|
9
|
+
const pathname = specifier.replace(/[?#].*$/, '');
|
|
10
|
+
return /(?:^|[/])[^/]+\.server(?:$|\.)/.test(pathname);
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type * from './contracts/build-contracts.js';
|
|
2
|
+
export type * from './contracts/build-types.js';
|
|
3
|
+
export { CONTENT_BROWSER_VIRTUAL_MODULE_PATTERN, CONTENT_SERVER_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PREFIX, isContentServerVirtualModule, parseCollectionSpecifier, type ParsedCollectionSpecifier, } from './contracts/content-virtual-modules.js';
|
|
4
|
+
export { isServerOnlyModuleSpecifier } from './contracts/server-only-specifier.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CONTENT_BROWSER_VIRTUAL_MODULE_PATTERN, CONTENT_SERVER_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PATTERN, CONTENT_VIRTUAL_MODULE_PREFIX, isContentServerVirtualModule, parseCollectionSpecifier, } from './contracts/content-virtual-modules.js';
|
|
2
|
+
export { isServerOnlyModuleSpecifier } from './contracts/server-only-specifier.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
import type { EcoBuildOnTransformResult, EcoBuildPlugin } from './contracts/build-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Applies source edits while preserving mappings to the original file.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Core transforms use this when they change source positions. Inserted text is
|
|
8
|
+
* unmapped; retained text keeps its original line and column positions.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createMappedSourceTransformResult(code: string, id: string, edit: (source: MagicString) => void): EcoBuildOnTransformResult;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps one of core's own source rewrites as a build plugin with a `transform` hook.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* The rewrite receives the module id without its query and hash, because it reads the file the id names.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createCoreTransformPlugin(options: {
|
|
18
|
+
name: string;
|
|
19
|
+
filter: RegExp;
|
|
20
|
+
cacheKey?: string;
|
|
21
|
+
transform(code: string, id: string): EcoBuildOnTransformResult | string | undefined;
|
|
22
|
+
}): EcoBuildPlugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
/**
|
|
3
|
+
* Applies source edits while preserving mappings to the original file.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Core transforms use this when they change source positions. Inserted text is
|
|
7
|
+
* unmapped; retained text keeps its original line and column positions.
|
|
8
|
+
*/
|
|
9
|
+
export function createMappedSourceTransformResult(code, id, edit) {
|
|
10
|
+
const source = new MagicString(code, { filename: id });
|
|
11
|
+
edit(source);
|
|
12
|
+
return {
|
|
13
|
+
code: source.toString(),
|
|
14
|
+
map: source.generateMap({ source: id, includeContent: true, hires: 'boundary' }),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wraps one of core's own source rewrites as a build plugin with a `transform` hook.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* The rewrite receives the module id without its query and hash, because it reads the file the id names.
|
|
22
|
+
*/
|
|
23
|
+
export function createCoreTransformPlugin(options) {
|
|
24
|
+
return {
|
|
25
|
+
name: options.name,
|
|
26
|
+
cacheKey: options.cacheKey,
|
|
27
|
+
setup(build) {
|
|
28
|
+
build.transform({ filter: options.filter }, (code, id) => options.transform(code, id.replace(/[?#].*$/, '')));
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EcoBuildPlugin } from './contracts/build-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves `dir` through symlinks, including for a directory that does not
|
|
4
|
+
* exist yet.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Node resolves a relative import and `import.meta.url` against the real path
|
|
8
|
+
* of the module, so a path computed from a symlinked output directory (macOS
|
|
9
|
+
* `/tmp`, a linked project root) would point at the wrong place.
|
|
10
|
+
*/
|
|
11
|
+
export declare function realpathOfDirectory(dir: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a build plugin that keeps `import.meta.url`, `import.meta.dirname`
|
|
14
|
+
* and `import.meta.filename` (and Bun's `dir`, `path` and `file`) of every bundled
|
|
15
|
+
* module pointing at its source file, for server output that runs from
|
|
16
|
+
* `runtimeDir`.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* A bundled module would otherwise see the location of its output chunk, so a
|
|
20
|
+
* lookup such as Core reading `../../../package.json` or a page globbing
|
|
21
|
+
* `import.meta.dirname` would search `dist/.server/` or `.eco/.server-modules/`.
|
|
22
|
+
* The rewrite is a path relative to the output chunk's own `import.meta`, so
|
|
23
|
+
* the output keeps working after it moves together with the sources. It
|
|
24
|
+
* assumes flat output file names in `runtimeDir`, which the external package
|
|
25
|
+
* plugin already requires. `import.meta.resolve()` is not rewritten and
|
|
26
|
+
* resolves from the output chunk.
|
|
27
|
+
*
|
|
28
|
+
* The filter matches the extensions this transform accepts
|
|
29
|
+
* (`.ts`, `.tsx`, `.js`, `.jsx`), so bundled `.mjs`, `.cjs`, `.mts` and
|
|
30
|
+
* `.cts` modules keep the `import.meta` of their output chunk.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createPreserveImportMetaPlugin(runtimeDir: string): EcoBuildPlugin;
|