@ecopages/core 0.6.1 → 0.7.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 +8 -143
- package/package.json +16 -3
- package/src/adapters/node/dev-session.js +2 -1
- package/src/adapters/node/node-client-bridge.d.ts +5 -7
- package/src/adapters/node/node-client-bridge.js +4 -14
- package/src/adapters/node/server-adapter.d.ts +4 -2
- package/src/adapters/node/server-adapter.js +13 -12
- package/src/adapters/shared/hmr/client-bridge.d.ts +25 -0
- package/src/adapters/shared/hmr/client-bridge.js +35 -0
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +1 -1
- package/src/adapters/shared/hmr/hmr-manager.d.ts +9 -2
- package/src/adapters/shared/hmr/hmr-manager.js +36 -6
- package/src/adapters/shared/http/dist-file-handler.js +3 -7
- package/src/adapters/shared/http/response-headers.d.ts +29 -0
- package/src/adapters/shared/http/response-headers.js +89 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +3 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +4 -3
- package/src/adapters/shared/runtime/server-request-pipeline.js +4 -4
- package/src/adapters/shared/runtime/server-static-builder.d.ts +19 -8
- package/src/adapters/shared/runtime/server-static-builder.js +23 -4
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +1 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +23 -16
- package/src/assets/app-browser-client-build.d.ts +5 -12
- package/src/assets/app-browser-client-build.js +121 -336
- package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +4 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.js +6 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +28 -8
- package/src/assets/asset-processing-service/asset-dependency-keys.js +104 -29
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +60 -2
- package/src/assets/asset-processing-service/asset-processing.service.js +189 -58
- package/src/assets/asset-processing-service/bundleable-script.d.ts +3 -0
- package/src/assets/asset-processing-service/bundleable-script.js +4 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -2
- package/src/assets/asset-processing-service/grouped-content-bundles.js +5 -10
- package/src/assets/asset-processing-service/index.d.ts +0 -3
- package/src/assets/asset-processing-service/index.js +0 -3
- package/src/assets/asset-processing-service/last-good-output.d.ts +21 -0
- package/src/assets/asset-processing-service/last-good-output.js +32 -0
- package/src/assets/asset-processing-service/page-package.js +1 -4
- package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +63 -0
- package/src/assets/asset-processing-service/processed-asset-ledger.js +101 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/base/base-script-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +24 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.js +59 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +18 -6
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +2 -3
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.d.ts +34 -0
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.js +115 -0
- package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -2
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.d.ts +39 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.js +150 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.d.ts +84 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.js +379 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +16 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +50 -24
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.d.ts +33 -0
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.js +67 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.d.ts +44 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.js +149 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.d.ts +31 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.js +59 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.d.ts +20 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.js +51 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.d.ts +2 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js +5 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.d.ts +37 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.js +48 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +25 -1
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +56 -15
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.d.ts +9 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.js +21 -0
- package/src/assets/browser-asset-output.js +1 -1
- package/src/assets/hashed-browser-asset.js +1 -1
- package/src/assets/{browser-runtime-asset-page-cache.d.ts → page-script-page-cache.d.ts} +3 -3
- package/src/assets/{browser-runtime-asset-page-cache.js → page-script-page-cache.js} +3 -3
- package/src/build/app-build-manifest-runtime.d.ts +23 -11
- package/src/build/app-build-manifest-runtime.js +52 -13
- package/src/build/browser/jsx-ownership-plugins.d.ts +4 -1
- package/src/build/browser/jsx-ownership-plugins.js +6 -0
- package/src/build/build-adapter.d.ts +1 -1
- package/src/build/build-adapter.js +1 -1
- package/src/build/build-graph.d.ts +4 -2
- package/src/build/build-graph.js +12 -46
- package/src/build/cache/build-input-dependency-index.d.ts +0 -19
- package/src/build/cache/build-input-dependency-index.js +1 -34
- package/src/build/cache/pages-unified-graph-build.js +7 -43
- package/src/build/cache/server-module-entries.d.ts +1 -1
- package/src/build/cache/server-module-entries.js +9 -9
- package/src/build/contracts/build-contracts.d.ts +59 -12
- package/src/build/contracts/build-manifest.d.ts +3 -6
- package/src/build/contracts/build-manifest.js +2 -12
- package/src/build/contracts/content-virtual-modules.js +1 -3
- package/src/build/copy-server-files.js +1 -1
- package/src/build/preserve-import-meta-transform.d.ts +3 -1
- package/src/build/preserve-import-meta-transform.js +7 -4
- package/src/build/production-asset-ledger.d.ts +36 -0
- package/src/build/production-asset-ledger.js +104 -0
- package/src/build/production-dist-complete.js +12 -13
- package/src/build/production-route-list.js +1 -1
- package/src/build/rolldown/app-package-declarations.js +1 -1
- package/src/build/rolldown/entry-module-closures.d.ts +5 -1
- package/src/build/rolldown/entry-module-closures.js +21 -8
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +19 -8
- package/src/build/rolldown/rolldown-adapter-helpers.js +82 -45
- package/src/build/rolldown/rolldown-build-adapter.js +10 -13
- package/src/build/rolldown/rolldown-module-id.d.ts +18 -0
- package/src/build/rolldown/rolldown-module-id.js +29 -0
- package/src/build/rolldown/rolldown-plugin-bridge.d.ts +24 -60
- package/src/build/rolldown/rolldown-plugin-bridge.js +201 -373
- package/src/build/rolldown/stylesheet-module-plugin.d.ts +34 -0
- package/src/build/rolldown/stylesheet-module-plugin.js +160 -0
- package/src/build/rolldown/worker-entries-plugin.d.ts +13 -0
- package/src/build/rolldown/worker-entries-plugin.js +57 -0
- package/src/build/runtime/build-environment-options.js +13 -3
- package/src/build/runtime/build-request-identity.js +1 -1
- package/src/build/runtime/build-request-policy.d.ts +7 -12
- package/src/build/runtime/build-request-policy.js +63 -17
- package/src/build/server/imported-view-plugin.d.ts +1 -0
- package/src/build/server/imported-view-plugin.js +6 -4
- package/src/build/server/page-module-import.service.d.ts +1 -2
- package/src/build/server/page-module-import.service.js +4 -6
- package/src/build/server/resolve-static-view.js +3 -2
- package/src/build/server/route-module-build-cache-registry.js +1 -1
- package/src/build/server/route-module-build-cache.store.js +1 -1
- package/src/build/server/route-module-build-manifest.js +1 -1
- package/src/build/server/route-module-dependency-hasher.d.ts +1 -1
- package/src/build/server/route-module-dependency-hasher.js +2 -2
- package/src/build/server/server-modules-manifest.d.ts +3 -5
- package/src/build/server/server-modules-manifest.js +6 -21
- package/src/build/server/view-module.d.ts +12 -0
- package/src/build/server/view-module.js +23 -0
- package/src/build/server/view-reference.d.ts +16 -5
- package/src/build/server/view-reference.js +25 -14
- package/src/build/server-bundle-deploy-manifest.d.ts +1 -1
- package/src/build/server-bundle-deploy-manifest.js +2 -2
- package/src/build/server-bundle-publication.d.ts +7 -1
- package/src/build/server-bundle-publication.js +11 -4
- package/src/build/server-module.js +1 -1
- package/src/build/worker-urls.d.ts +60 -0
- package/src/build/worker-urls.js +197 -0
- package/src/build.d.ts +7 -5
- package/src/build.js +7 -5
- package/src/cache/module-parse-cache.js +2 -2
- package/src/client/navigation-attributes.d.ts +8 -0
- package/src/client/navigation-attributes.js +8 -0
- package/src/client/navigation-scripts/global-scripts.d.ts +14 -0
- package/src/client/navigation-scripts/global-scripts.js +65 -0
- package/src/client/navigation-scripts/index.d.ts +1 -0
- package/src/client/navigation-scripts/index.js +1 -0
- package/src/client.d.ts +2 -2
- package/src/client.js +2 -2
- package/src/config/assembly/app-runtime.d.ts +45 -5
- package/src/config/assembly/app-runtime.js +11 -2
- package/src/config/assembly/finalize-config.js +13 -5
- package/src/config/config-module-files.js +10 -6
- package/src/config/index.d.ts +2 -1
- package/src/config/internal-types.d.ts +3 -0
- package/src/config/load-eco-config.js +8 -5
- package/src/config/resolve-eco-config-path.js +3 -3
- package/src/config/server-config-bundle.js +1 -1
- package/src/config/user-config-types.d.ts +54 -1
- package/src/config/write-types.js +4 -1
- package/src/css-imports.d.ts +12 -0
- package/src/declarations.d.ts +2 -0
- package/src/dev/development-restart-watch-paths.js +1 -1
- package/src/dev/development-restart.js +1 -1
- package/src/dev/invalidation/development-invalidation.service.d.ts +6 -1
- package/src/dev/invalidation/development-invalidation.service.js +18 -2
- package/src/dev/stylesheets/development-stylesheet.service.d.ts +149 -0
- package/src/dev/stylesheets/development-stylesheet.service.js +350 -0
- package/src/dev/transform-server/dev-transform-bundler.d.ts +12 -3
- package/src/dev/transform-server/dev-transform-bundler.js +32 -21
- package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +3 -5
- package/src/dev/transform-server/dev-transform-externalize-plugin.js +8 -9
- package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +15 -2
- package/src/dev/transform-server/dev-transform-import-rewriter.js +204 -35
- package/src/dev/transform-server/dev-transform-install-stamp.d.ts +17 -0
- package/src/dev/transform-server/dev-transform-install-stamp.js +79 -0
- package/src/dev/transform-server/dev-transform-server.d.ts +38 -2
- package/src/dev/transform-server/dev-transform-server.js +96 -33
- package/src/dev/transform-server/dev-transform-url.d.ts +4 -2
- package/src/dev/transform-server/dev-transform-url.js +13 -12
- package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +178 -21
- package/src/dev/transform-server/dev-transform-vendor-registry.js +675 -99
- package/src/dev/transform-server/index.d.ts +1 -1
- package/src/dev-toolbar/dev-toolbar-package.js +4 -4
- package/src/eco/component-render-output.d.ts +6 -1
- package/src/eco/component-render-output.js +32 -7
- package/src/eco/discovered-dependencies.d.ts +30 -11
- package/src/eco/discovered-dependencies.js +25 -13
- package/src/eco/discovered-dependency-paths.d.ts +36 -0
- package/src/eco/discovered-dependency-paths.js +58 -0
- package/src/eco/eco.browser.js +8 -12
- package/src/eco/eco.js +0 -30
- package/src/eco/mdx-page-metadata.d.ts +14 -0
- package/src/eco/mdx-page-metadata.js +15 -0
- package/src/eco/page-layout-normalization.d.ts +6 -2
- package/src/eco/page-layout-normalization.js +9 -6
- package/src/env.js +17 -0
- package/src/hmr/client/hmr-runtime.js +14 -13
- package/src/hmr/dev-client-runtime.d.ts +5 -2
- package/src/hmr/dev-client-runtime.js +14 -4
- package/src/hmr/hmr-entrypoint-output.js +1 -1
- package/src/hmr/hmr-strategy.d.ts +2 -2
- package/src/hmr/hmr-strategy.js +2 -2
- package/src/hmr/strategies/js-hmr-strategy.d.ts +4 -1
- package/src/hmr/strategies/js-hmr-strategy.js +7 -6
- package/src/hmr/strategies/template-source-hmr-strategy.d.ts +25 -0
- package/src/hmr/strategies/template-source-hmr-strategy.js +36 -0
- package/src/html-pages/html-page-module-scripts.d.ts +2 -1
- package/src/html-pages/html-page-module-scripts.js +37 -14
- package/src/html-pages/html-page-module.js +1 -1
- package/src/html-pages/html-page-renderer.js +7 -6
- package/src/html-pages/html-page-template.d.ts +0 -5
- package/src/html-pages/html-page-template.js +3 -15
- package/src/html-pages/html-pages.plugin.js +2 -2
- package/src/integration.d.ts +8 -6
- package/src/integration.js +5 -3
- package/src/page-cache/html-page-cache-dependency-index.js +1 -1
- package/src/page-cache/page-cache-service.js +1 -1
- package/src/plugins/alias-resolver-plugin.d.ts +7 -0
- package/src/plugins/alias-resolver-plugin.js +16 -6
- package/src/plugins/component-import-discovery.d.ts +178 -7
- package/src/plugins/component-import-discovery.js +696 -112
- package/src/plugins/eco-component-meta-plugin.d.ts +47 -6
- package/src/plugins/eco-component-meta-plugin.js +227 -59
- package/src/plugins/foreign-jsx-override-plugin.d.ts +14 -1
- package/src/plugins/foreign-jsx-override-plugin.js +18 -8
- package/src/plugins/integration-plugin.d.ts +47 -11
- package/src/plugins/integration-plugin.js +57 -8
- package/src/plugins/processor.d.ts +72 -7
- package/src/plugins/processor.js +44 -9
- package/src/plugins/stylesheet-kinds.d.ts +57 -0
- package/src/plugins/stylesheet-kinds.js +114 -0
- package/src/plugins/tsconfig-import-resolver.d.ts +49 -3
- package/src/plugins/tsconfig-import-resolver.js +120 -6
- package/src/processor-contract.d.ts +66 -0
- package/src/processor-contract.js +389 -0
- package/src/processor.d.ts +6 -1
- package/src/processor.js +6 -1
- package/src/route-renderer/error-pages/default-error-pages.d.ts +1 -0
- package/src/route-renderer/error-pages/default-error-pages.js +27 -7
- 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 +12 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +77 -24
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +97 -32
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +1 -1
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +9 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +16 -2
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.d.ts +35 -0
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js +53 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +4 -8
- package/src/route-renderer/orchestration/foreign-child/render-session.js +2 -5
- package/src/route-renderer/orchestration/integration-renderer.d.ts +171 -64
- package/src/route-renderer/orchestration/integration-renderer.js +293 -332
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +8 -5
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +27 -25
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +0 -6
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +3 -3
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +12 -25
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +1 -14
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +0 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -87
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +8 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +25 -271
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +0 -24
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +0 -67
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +28 -15
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +63 -41
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -1
- package/src/route-renderer/page-loading/component-dependency-collection.js +51 -15
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +10 -0
- package/src/route-renderer/page-loading/dependency-resolver.js +27 -6
- package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +4 -2
- package/src/route-renderer/page-loading/file-scoped-dependency-components.js +22 -17
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +5 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.js +6 -4
- package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +5 -2
- package/src/route-renderer/page-loading/page-dependency-bundling.js +15 -31
- package/src/route-renderer/page-loading/page-module-loader.d.ts +13 -2
- package/src/route-renderer/page-loading/page-module-loader.js +23 -5
- package/src/route-renderer/route-renderer.d.ts +1 -1
- package/src/router/client/navigation-commit.d.ts +2 -0
- package/src/router/client/navigation-commit.js +4 -1
- package/src/router/client/navigation-coordinator.d.ts +18 -0
- package/src/router/client/navigation-coordinator.js +14 -0
- package/src/router/client/navigation-lifecycle.d.ts +18 -1
- package/src/router/client/navigation-lifecycle.js +6 -3
- package/src/router/client/navigation-pipeline.d.ts +1 -0
- package/src/router/client/navigation-pipeline.js +1 -0
- package/src/router/server/route-registry.d.ts +3 -2
- package/src/router/server/route-registry.js +6 -5
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +30 -18
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +82 -143
- package/src/static-site-generator/static-site-generator.d.ts +37 -4
- package/src/static-site-generator/static-site-generator.js +99 -51
- package/src/types/asset-types.d.ts +19 -1
- package/src/types/build-types.d.ts +53 -35
- package/src/types/component-identity.d.ts +8 -0
- package/src/types/contracts.d.ts +69 -21
- package/src/types/dev-transform-types.d.ts +33 -6
- package/src/types/eco-api-types.d.ts +13 -18
- package/src/types/integration-types.d.ts +1 -1
- package/src/types/public-types.d.ts +1 -1
- package/src/utils/additional-watch-paths.js +3 -5
- package/src/utils/entry-command-flags.d.ts +23 -0
- package/src/utils/entry-command-flags.js +24 -0
- package/src/utils/package-path.d.ts +42 -0
- package/src/utils/package-path.js +114 -0
- package/src/utils/parse-cli-args.d.ts +18 -1
- package/src/utils/parse-cli-args.js +54 -37
- package/src/utils/path-containment.js +3 -10
- package/src/utils/resolve-work-dir.js +2 -2
- package/src/utils/root-relative-path.js +2 -2
- package/src/utils/server-bundle-context.d.ts +5 -0
- package/src/utils/server-bundle-context.js +7 -1
- package/src/utils/server-utils.module.js +1 -1
- package/src/watchers/project-watcher-ignore.js +3 -3
- package/src/watchers/project-watcher.d.ts +14 -2
- package/src/watchers/project-watcher.js +37 -6
- package/src/watchers/workspace-package-watch-roots.js +2 -2
- package/src/assets/app-browser-client-manifest.d.ts +0 -66
- package/src/assets/app-browser-client-manifest.js +0 -260
- package/src/assets/asset-processing-service/asset-package-role.d.ts +0 -2
- package/src/assets/asset-processing-service/asset-package-role.js +0 -3
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +0 -58
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -61
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +0 -79
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +0 -200
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +0 -24
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -67
- package/src/build/browser/browser-runtime-manifest.d.ts +0 -35
- package/src/build/browser/browser-runtime-manifest.js +0 -65
- package/src/build/browser/browser-runtime-plugin-helpers.d.ts +0 -14
- package/src/build/browser/browser-runtime-plugin-helpers.js +0 -21
- package/src/build/browser/browser-runtime-plugin.d.ts +0 -54
- package/src/build/browser/browser-runtime-plugin.js +0 -76
- package/src/build/rolldown/server-side-css-shim-plugin.d.ts +0 -28
- package/src/build/rolldown/server-side-css-shim-plugin.js +0 -59
- package/src/dev/transform-server/dev-transform-module-kind.d.ts +0 -13
- package/src/dev/transform-server/dev-transform-module-kind.js +0 -17
- package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +0 -5
- package/src/dev/transform-server/dev-transform-runtime-specifiers.js +0 -16
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +0 -15
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +0 -65
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +0 -21
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +0 -31
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type BrowserRuntimeEntryModuleConfig = {
|
|
2
|
-
specifier: string;
|
|
3
|
-
defaultExport?: boolean;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Creates a generated ESM entry module that re-exports runtime modules through
|
|
7
|
-
* one stable file.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Integrations use this helper when they need a browser runtime asset composed
|
|
11
|
-
* from multiple bare specifiers but do not want to own temporary file assembly
|
|
12
|
-
* logic themselves. The generated file lives under the app work directory so
|
|
13
|
-
* repeated runs can reuse the same location without placing sources inside
|
|
14
|
-
* `node_modules`, which can cause bundlers to externalize bare imports.
|
|
15
|
-
* ESM entries use `export *`. CJS entries emit explicit named re-exports from
|
|
16
|
-
* that same file so Rolldown can synthesize ESM bindings such as `jsx`.
|
|
17
|
-
*/
|
|
18
|
-
export declare function createBrowserRuntimeEntryModule(options: {
|
|
19
|
-
modules: BrowserRuntimeEntryModuleConfig[];
|
|
20
|
-
fileName: string;
|
|
21
|
-
rootDir?: string;
|
|
22
|
-
workDir?: string;
|
|
23
|
-
cacheDirName?: string;
|
|
24
|
-
}): string;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
-
import { createRequire } from 'node:module';
|
|
4
|
-
import { DEFAULT_ECOPAGES_WORK_DIR } from '../../constants.js';
|
|
5
|
-
import { browserRuntimeEntryHasEsmExports, inferBrowserRuntimeDefaultExportPolicy, listBrowserRuntimeCjsExportNames, resolveBrowserRuntimeEntryImport, resolveBrowserRuntimeEntryPath, } from './browser-runtime-entry-resolution.js';
|
|
6
|
-
/**
|
|
7
|
-
* Creates a generated ESM entry module that re-exports runtime modules through
|
|
8
|
-
* one stable file.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Integrations use this helper when they need a browser runtime asset composed
|
|
12
|
-
* from multiple bare specifiers but do not want to own temporary file assembly
|
|
13
|
-
* logic themselves. The generated file lives under the app work directory so
|
|
14
|
-
* repeated runs can reuse the same location without placing sources inside
|
|
15
|
-
* `node_modules`, which can cause bundlers to externalize bare imports.
|
|
16
|
-
* ESM entries use `export *`. CJS entries emit explicit named re-exports from
|
|
17
|
-
* that same file so Rolldown can synthesize ESM bindings such as `jsx`.
|
|
18
|
-
*/
|
|
19
|
-
export function createBrowserRuntimeEntryModule(options) {
|
|
20
|
-
if (options.modules.some((module) => !module.specifier.startsWith('node:')) && !options.rootDir) {
|
|
21
|
-
throw new Error('createBrowserRuntimeEntryModule requires rootDir to resolve package specifiers');
|
|
22
|
-
}
|
|
23
|
-
const rootDir = options.rootDir ?? process.cwd();
|
|
24
|
-
const workDir = options.workDir ?? path.join(rootDir, DEFAULT_ECOPAGES_WORK_DIR);
|
|
25
|
-
const artifactsDir = path.join(workDir, '.browser-runtime-entries', options.cacheDirName ?? 'ecopages-browser-runtime');
|
|
26
|
-
fileSystem.ensureDir(artifactsDir);
|
|
27
|
-
const requireFromRoot = createRequire(path.join(rootDir, 'package.json'));
|
|
28
|
-
const seenExports = new Set();
|
|
29
|
-
const statements = [];
|
|
30
|
-
const filePath = path.join(artifactsDir, options.fileName);
|
|
31
|
-
const entryDir = path.dirname(filePath);
|
|
32
|
-
for (const module of options.modules) {
|
|
33
|
-
const importSpecifier = resolveBrowserRuntimeEntryImport({
|
|
34
|
-
specifier: module.specifier,
|
|
35
|
-
requireFromRoot,
|
|
36
|
-
entryDir,
|
|
37
|
-
rootDir,
|
|
38
|
-
});
|
|
39
|
-
const entryPath = resolveBrowserRuntimeEntryPath({
|
|
40
|
-
specifier: module.specifier,
|
|
41
|
-
requireFromRoot,
|
|
42
|
-
rootDir,
|
|
43
|
-
});
|
|
44
|
-
if (module.defaultExport &&
|
|
45
|
-
inferBrowserRuntimeDefaultExportPolicy({ specifier: module.specifier, requireFromRoot, rootDir }) ===
|
|
46
|
-
'emit-default') {
|
|
47
|
-
statements.push(`import __ecopages_default_export__ from '${importSpecifier}';`);
|
|
48
|
-
statements.push('export default __ecopages_default_export__;');
|
|
49
|
-
}
|
|
50
|
-
if (browserRuntimeEntryHasEsmExports(entryPath)) {
|
|
51
|
-
statements.push(`export * from '${importSpecifier}';`);
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
const exportNames = listBrowserRuntimeCjsExportNames(entryPath ?? module.specifier, requireFromRoot).filter((name) => !seenExports.has(name));
|
|
55
|
-
if (exportNames.length > 0) {
|
|
56
|
-
statements.push(`export { ${exportNames.join(', ')} } from '${importSpecifier}';`);
|
|
57
|
-
for (const exportName of exportNames) {
|
|
58
|
-
seenExports.add(exportName);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const content = statements.join('\n');
|
|
63
|
-
if (!fileSystem.exists(filePath) || fileSystem.readFileSync(filePath) !== content) {
|
|
64
|
-
fileSystem.write(filePath, content);
|
|
65
|
-
}
|
|
66
|
-
return filePath;
|
|
67
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type BrowserRuntimeMode = 'development' | 'production';
|
|
2
|
-
export type BrowserRuntimeAssetDeclaration = {
|
|
3
|
-
/** Bare or virtual specifier used by authored/generated browser modules. */
|
|
4
|
-
specifier: string;
|
|
5
|
-
/** Integration, processor, or core subsystem that owns this runtime asset. */
|
|
6
|
-
owner: string;
|
|
7
|
-
/** Source import path used to build or resolve the runtime asset. */
|
|
8
|
-
importPath: string;
|
|
9
|
-
/** Concrete browser URL emitted or served for this runtime asset. */
|
|
10
|
-
publicPath: string;
|
|
11
|
-
/** Runtime mode this declaration applies to. Omit when the URL is mode-independent. */
|
|
12
|
-
mode?: BrowserRuntimeMode;
|
|
13
|
-
/** Specifiers that should be treated as external while building this runtime asset. */
|
|
14
|
-
externals?: readonly string[];
|
|
15
|
-
};
|
|
16
|
-
export type BrowserRuntimeAsset = BrowserRuntimeAssetDeclaration & {
|
|
17
|
-
externals: readonly string[];
|
|
18
|
-
};
|
|
19
|
-
export type BrowserRuntimeManifest = {
|
|
20
|
-
assets: readonly BrowserRuntimeAsset[];
|
|
21
|
-
bySpecifier: ReadonlyMap<string, BrowserRuntimeAsset>;
|
|
22
|
-
};
|
|
23
|
-
export declare class BrowserRuntimeManifestConflictError extends Error {
|
|
24
|
-
readonly specifier: string;
|
|
25
|
-
readonly existing: BrowserRuntimeAsset;
|
|
26
|
-
readonly incoming: BrowserRuntimeAsset;
|
|
27
|
-
constructor(specifier: string, existing: BrowserRuntimeAsset, incoming: BrowserRuntimeAsset);
|
|
28
|
-
}
|
|
29
|
-
export declare function createBrowserRuntimeManifest(declarations?: readonly BrowserRuntimeAssetDeclaration[]): BrowserRuntimeManifest;
|
|
30
|
-
export declare function mergeBrowserRuntimeManifests(...manifests: Array<BrowserRuntimeManifest | undefined>): BrowserRuntimeManifest;
|
|
31
|
-
export declare function getBrowserRuntimeSpecifierMap(manifest: BrowserRuntimeManifest): ReadonlyMap<string, string>;
|
|
32
|
-
/** Resolves a runtime public URL for an exact specifier. */
|
|
33
|
-
export declare function resolveRuntimeSpecifierPublicPath(specifier: string, publicPathsBySpecifier: ReadonlyMap<string, string>): string | undefined;
|
|
34
|
-
/** Resolves a manifest-owned runtime public URL for an exact specifier. */
|
|
35
|
-
export declare function resolveBrowserRuntimePublicPath(specifier: string, manifest: BrowserRuntimeManifest): string | undefined;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export class BrowserRuntimeManifestConflictError extends Error {
|
|
2
|
-
specifier;
|
|
3
|
-
existing;
|
|
4
|
-
incoming;
|
|
5
|
-
constructor(specifier, existing, incoming) {
|
|
6
|
-
super(`Browser runtime asset conflict for ${specifier}: ${existing.owner} maps to ${existing.publicPath}, ` +
|
|
7
|
-
`${incoming.owner} maps to ${incoming.publicPath}`);
|
|
8
|
-
this.name = 'BrowserRuntimeManifestConflictError';
|
|
9
|
-
this.specifier = specifier;
|
|
10
|
-
this.existing = existing;
|
|
11
|
-
this.incoming = incoming;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function normalizeDeclaration(declaration) {
|
|
15
|
-
return {
|
|
16
|
-
...declaration,
|
|
17
|
-
externals: declaration.externals ?? [],
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function hasCompatibleRuntimeAsset(existing, incoming) {
|
|
21
|
-
return (existing.importPath === incoming.importPath &&
|
|
22
|
-
existing.publicPath === incoming.publicPath &&
|
|
23
|
-
existing.mode === incoming.mode &&
|
|
24
|
-
arrayEquals(existing.externals, incoming.externals));
|
|
25
|
-
}
|
|
26
|
-
function arrayEquals(left, right) {
|
|
27
|
-
if (left.length !== right.length) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
return left.every((value, index) => value === right[index]);
|
|
31
|
-
}
|
|
32
|
-
export function createBrowserRuntimeManifest(declarations = []) {
|
|
33
|
-
const assets = [];
|
|
34
|
-
const bySpecifier = new Map();
|
|
35
|
-
for (const declaration of declarations) {
|
|
36
|
-
const asset = normalizeDeclaration(declaration);
|
|
37
|
-
const existing = bySpecifier.get(asset.specifier);
|
|
38
|
-
if (existing) {
|
|
39
|
-
if (!hasCompatibleRuntimeAsset(existing, asset)) {
|
|
40
|
-
throw new BrowserRuntimeManifestConflictError(asset.specifier, existing, asset);
|
|
41
|
-
}
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
assets.push(asset);
|
|
45
|
-
bySpecifier.set(asset.specifier, asset);
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
assets,
|
|
49
|
-
bySpecifier,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export function mergeBrowserRuntimeManifests(...manifests) {
|
|
53
|
-
return createBrowserRuntimeManifest(manifests.flatMap((manifest) => manifest?.assets ?? []));
|
|
54
|
-
}
|
|
55
|
-
export function getBrowserRuntimeSpecifierMap(manifest) {
|
|
56
|
-
return new Map(manifest.assets.map((asset) => [asset.specifier, asset.publicPath]));
|
|
57
|
-
}
|
|
58
|
-
/** Resolves a runtime public URL for an exact specifier. */
|
|
59
|
-
export function resolveRuntimeSpecifierPublicPath(specifier, publicPathsBySpecifier) {
|
|
60
|
-
return publicPathsBySpecifier.get(specifier);
|
|
61
|
-
}
|
|
62
|
-
/** Resolves a manifest-owned runtime public URL for an exact specifier. */
|
|
63
|
-
export function resolveBrowserRuntimePublicPath(specifier, manifest) {
|
|
64
|
-
return manifest.bySpecifier.get(specifier)?.publicPath;
|
|
65
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared helpers for the browser-runtime plugin.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* `createBrowserRuntimePlugin` needs a filter whose alternation matches its
|
|
6
|
-
* registered specifiers. This module builds the filter with the shared
|
|
7
|
-
* regular-expression escaper.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Builds a `RegExp` that matches registered specifiers exactly.
|
|
11
|
-
*
|
|
12
|
-
* Returns `null` for an empty map so callers can short-circuit registration.
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildSpecifierFilter(specifierMap: ReadonlyMap<string, string>): RegExp | null;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared helpers for the browser-runtime plugin.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* `createBrowserRuntimePlugin` needs a filter whose alternation matches its
|
|
6
|
-
* registered specifiers. This module builds the filter with the shared
|
|
7
|
-
* regular-expression escaper.
|
|
8
|
-
*/
|
|
9
|
-
import { escapeRegExp } from '../../utils/regex-escaping.js';
|
|
10
|
-
/**
|
|
11
|
-
* Builds a `RegExp` that matches registered specifiers exactly.
|
|
12
|
-
*
|
|
13
|
-
* Returns `null` for an empty map so callers can short-circuit registration.
|
|
14
|
-
*/
|
|
15
|
-
export function buildSpecifierFilter(specifierMap) {
|
|
16
|
-
if (specifierMap.size === 0) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
const alternation = Array.from(specifierMap.keys()).map(escapeRegExp).join('|');
|
|
20
|
-
return new RegExp(`^(?:${alternation})$`);
|
|
21
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified browser-runtime plugin factory.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Single factory that exposes the browser-runtime manifest behaviors:
|
|
6
|
-
*
|
|
7
|
-
* - `onResolve` for manifest specifiers → mapped public URL, marked external.
|
|
8
|
-
* It sees every form a bundler resolves: static imports, re-exports, side-effect
|
|
9
|
-
* imports and `import()`.
|
|
10
|
-
* - `onResolve` for paths starting with `/` whose target is in the manifest's
|
|
11
|
-
* public path set → marked external
|
|
12
|
-
*
|
|
13
|
-
* The plugin object carries the manifest under `BROWSER_RUNTIME_MANIFEST`.
|
|
14
|
-
*/
|
|
15
|
-
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
16
|
-
import { type BrowserRuntimeManifest } from './browser-runtime-manifest.js';
|
|
17
|
-
/**
|
|
18
|
-
* Symbol used to attach the browser-runtime manifest to a plugin instance.
|
|
19
|
-
*/
|
|
20
|
-
export declare const BROWSER_RUNTIME_MANIFEST: unique symbol;
|
|
21
|
-
/**
|
|
22
|
-
* Default name used by `createBrowserRuntimePlugin` when the caller
|
|
23
|
-
* does not provide one.
|
|
24
|
-
*/
|
|
25
|
-
export declare const DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME = "browser-runtime-plugin";
|
|
26
|
-
export type CreateBrowserRuntimePluginOptions = {
|
|
27
|
-
/** Manifest whose specifier → publicPath entries drive the plugin. */
|
|
28
|
-
manifest: BrowserRuntimeManifest;
|
|
29
|
-
/** Stable build plugin name used for deduplication and selective exclusion. */
|
|
30
|
-
name?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Whether alias `onResolve` results should be marked `external`.
|
|
33
|
-
* Default `true`. Pass `false` to let the bundler try to bundle the
|
|
34
|
-
* mapped URL.
|
|
35
|
-
*/
|
|
36
|
-
external?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Register an `onResolve` for paths starting with `/` whose target
|
|
39
|
-
* is in the manifest's public path set. Marks them external so the
|
|
40
|
-
* bundler does not try to resolve them as source modules. Default
|
|
41
|
-
* `true`.
|
|
42
|
-
*/
|
|
43
|
-
matchPublicPaths?: boolean;
|
|
44
|
-
};
|
|
45
|
-
export declare function getBrowserRuntimeManifestFromPlugin(plugin: EcoBuildPlugin): BrowserRuntimeManifest | undefined;
|
|
46
|
-
/**
|
|
47
|
-
* Creates a build plugin that exposes the browser-runtime manifest
|
|
48
|
-
* behaviors (alias resolution and public-path matching). See
|
|
49
|
-
* {@link CreateBrowserRuntimePluginOptions} for per-behavior toggles.
|
|
50
|
-
*
|
|
51
|
-
* Returns `null` for an empty manifest so callers can short-circuit
|
|
52
|
-
* registration without sprinkling `if (plugin)` everywhere.
|
|
53
|
-
*/
|
|
54
|
-
export declare function createBrowserRuntimePlugin(options: CreateBrowserRuntimePluginOptions): EcoBuildPlugin | null;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified browser-runtime plugin factory.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Single factory that exposes the browser-runtime manifest behaviors:
|
|
6
|
-
*
|
|
7
|
-
* - `onResolve` for manifest specifiers → mapped public URL, marked external.
|
|
8
|
-
* It sees every form a bundler resolves: static imports, re-exports, side-effect
|
|
9
|
-
* imports and `import()`.
|
|
10
|
-
* - `onResolve` for paths starting with `/` whose target is in the manifest's
|
|
11
|
-
* public path set → marked external
|
|
12
|
-
*
|
|
13
|
-
* The plugin object carries the manifest under `BROWSER_RUNTIME_MANIFEST`.
|
|
14
|
-
*/
|
|
15
|
-
import { getBrowserRuntimeSpecifierMap, resolveBrowserRuntimePublicPath, } from './browser-runtime-manifest.js';
|
|
16
|
-
import { buildSpecifierFilter } from './browser-runtime-plugin-helpers.js';
|
|
17
|
-
/**
|
|
18
|
-
* Symbol used to attach the browser-runtime manifest to a plugin instance.
|
|
19
|
-
*/
|
|
20
|
-
export const BROWSER_RUNTIME_MANIFEST = Symbol.for('ecopages.browserRuntimeManifest');
|
|
21
|
-
/**
|
|
22
|
-
* Default name used by `createBrowserRuntimePlugin` when the caller
|
|
23
|
-
* does not provide one.
|
|
24
|
-
*/
|
|
25
|
-
export const DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME = 'browser-runtime-plugin';
|
|
26
|
-
export function getBrowserRuntimeManifestFromPlugin(plugin) {
|
|
27
|
-
return plugin[BROWSER_RUNTIME_MANIFEST];
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Creates a build plugin that exposes the browser-runtime manifest
|
|
31
|
-
* behaviors (alias resolution and public-path matching). See
|
|
32
|
-
* {@link CreateBrowserRuntimePluginOptions} for per-behavior toggles.
|
|
33
|
-
*
|
|
34
|
-
* Returns `null` for an empty manifest so callers can short-circuit
|
|
35
|
-
* registration without sprinkling `if (plugin)` everywhere.
|
|
36
|
-
*/
|
|
37
|
-
export function createBrowserRuntimePlugin(options) {
|
|
38
|
-
const { manifest } = options;
|
|
39
|
-
const specifierMap = getBrowserRuntimeSpecifierMap(manifest);
|
|
40
|
-
const specifierFilter = buildSpecifierFilter(specifierMap);
|
|
41
|
-
if (!specifierFilter) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
const external = options.external ?? true;
|
|
45
|
-
const matchPublicPaths = options.matchPublicPaths ?? true;
|
|
46
|
-
const publicPathSet = new Set(specifierMap.values());
|
|
47
|
-
const plugin = {
|
|
48
|
-
name: options.name ?? DEFAULT_BROWSER_RUNTIME_PLUGIN_NAME,
|
|
49
|
-
cacheKey: JSON.stringify([[...specifierMap].sort(), external, matchPublicPaths]),
|
|
50
|
-
setup(build) {
|
|
51
|
-
build.onResolve({ filter: specifierFilter }, (args) => {
|
|
52
|
-
const mappedPath = resolveBrowserRuntimePublicPath(args.path, manifest);
|
|
53
|
-
if (!mappedPath) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
path: mappedPath,
|
|
58
|
-
external,
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
if (matchPublicPaths) {
|
|
62
|
-
build.onResolve({ filter: /^\// }, (args) => {
|
|
63
|
-
if (!publicPathSet.has(args.path)) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
path: args.path,
|
|
68
|
-
external: true,
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
plugin[BROWSER_RUNTIME_MANIFEST] = manifest;
|
|
75
|
-
return plugin;
|
|
76
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server-side CSS shim plugin for the bundler adapter.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Page modules imported by the server (so the framework can read
|
|
6
|
-
* `getStaticProps` / `staticPaths` / page metadata) commonly have
|
|
7
|
-
* `import './style.css'` at the top. The bundler does not bundle
|
|
8
|
-
* CSS, and the server only needs the JS exports — the CSS itself
|
|
9
|
-
* is delivered to the browser via the page's `dependencies.stylesheets`
|
|
10
|
-
* declarations. This plugin:
|
|
11
|
-
*
|
|
12
|
-
* - Resolves `.css` imports to the absolute on-disk path.
|
|
13
|
-
* - Loads them and returns an empty ESM module with
|
|
14
|
-
* `moduleSideEffects: true` so the bundler keeps the import in
|
|
15
|
-
* the dependency graph without trying to bundle the bytes.
|
|
16
|
-
*
|
|
17
|
-
* The plugin is added by the adapter on every server-side build.
|
|
18
|
-
* Browser-side builds that want real CSS bundling should keep using
|
|
19
|
-
* a dedicated CSS pipeline (e.g. the postcss processor's output)
|
|
20
|
-
* and continue to declare stylesheets in `dependencies.stylesheets`
|
|
21
|
-
* — the shim is intentionally inert for those flows.
|
|
22
|
-
*/
|
|
23
|
-
import type { RolldownPlugin } from 'rolldown';
|
|
24
|
-
/**
|
|
25
|
-
* Builds a Rolldown plugin that turns `.css` imports into no-op ESM
|
|
26
|
-
* modules while preserving the dependency graph.
|
|
27
|
-
*/
|
|
28
|
-
export declare function createServerSideCssShimPlugin(): RolldownPlugin;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server-side CSS shim plugin for the bundler adapter.
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Page modules imported by the server (so the framework can read
|
|
6
|
-
* `getStaticProps` / `staticPaths` / page metadata) commonly have
|
|
7
|
-
* `import './style.css'` at the top. The bundler does not bundle
|
|
8
|
-
* CSS, and the server only needs the JS exports — the CSS itself
|
|
9
|
-
* is delivered to the browser via the page's `dependencies.stylesheets`
|
|
10
|
-
* declarations. This plugin:
|
|
11
|
-
*
|
|
12
|
-
* - Resolves `.css` imports to the absolute on-disk path.
|
|
13
|
-
* - Loads them and returns an empty ESM module with
|
|
14
|
-
* `moduleSideEffects: true` so the bundler keeps the import in
|
|
15
|
-
* the dependency graph without trying to bundle the bytes.
|
|
16
|
-
*
|
|
17
|
-
* The plugin is added by the adapter on every server-side build.
|
|
18
|
-
* Browser-side builds that want real CSS bundling should keep using
|
|
19
|
-
* a dedicated CSS pipeline (e.g. the postcss processor's output)
|
|
20
|
-
* and continue to declare stylesheets in `dependencies.stylesheets`
|
|
21
|
-
* — the shim is intentionally inert for those flows.
|
|
22
|
-
*/
|
|
23
|
-
import path from 'node:path';
|
|
24
|
-
import { fileSystem } from '@ecopages/file-system';
|
|
25
|
-
import { id as idFilter, include } from 'rolldown/filter';
|
|
26
|
-
const CSS_PATH = /\.css$/u;
|
|
27
|
-
const CSS_QUERY = '?ecopages-css-shim';
|
|
28
|
-
const CSS_SHIM_ID = /\?ecopages-css-shim$/u;
|
|
29
|
-
function stripShimQuery(id) {
|
|
30
|
-
const queryIndex = id.indexOf('?');
|
|
31
|
-
return queryIndex === -1 ? id : id.slice(0, queryIndex);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Builds a Rolldown plugin that turns `.css` imports into no-op ESM
|
|
35
|
-
* modules while preserving the dependency graph.
|
|
36
|
-
*/
|
|
37
|
-
export function createServerSideCssShimPlugin() {
|
|
38
|
-
return {
|
|
39
|
-
name: 'ecopages:server-side-css-shim',
|
|
40
|
-
resolveId: {
|
|
41
|
-
filter: [include(idFilter(CSS_PATH))],
|
|
42
|
-
handler(source, importer) {
|
|
43
|
-
const resolved = importer ? path.resolve(path.dirname(importer), source) : path.resolve(source);
|
|
44
|
-
return fileSystem.exists(resolved) ? `${resolved}${CSS_QUERY}` : null;
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
load: {
|
|
48
|
-
filter: [include(idFilter(CSS_SHIM_ID))],
|
|
49
|
-
handler(id) {
|
|
50
|
-
fileSystem.readFileSync(stripShimQuery(id));
|
|
51
|
-
return {
|
|
52
|
-
code: 'export default "";',
|
|
53
|
-
moduleType: 'js',
|
|
54
|
-
moduleSideEffects: true,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type DevTransformModuleKind = 'script' | 'stylesheet';
|
|
2
|
-
/**
|
|
3
|
-
* Classifies a dev-transform source path for materialization.
|
|
4
|
-
*/
|
|
5
|
-
export declare function resolveDevTransformModuleKind(sourcePath: string): DevTransformModuleKind;
|
|
6
|
-
/**
|
|
7
|
-
* Emits browser ESM for a stylesheet import (`import styles from './x.css'`).
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Parallels the server-side CSS shim: CSS stays in the module graph as a string
|
|
11
|
-
* export while real stylesheet delivery uses `dependencies.stylesheets`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function materializeDevTransformStylesheet(cssContent: string): string;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
/**
|
|
3
|
-
* Classifies a dev-transform source path for materialization.
|
|
4
|
-
*/
|
|
5
|
-
export function resolveDevTransformModuleKind(sourcePath) {
|
|
6
|
-
return path.extname(sourcePath) === '.css' ? 'stylesheet' : 'script';
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Emits browser ESM for a stylesheet import (`import styles from './x.css'`).
|
|
10
|
-
*
|
|
11
|
-
* @remarks
|
|
12
|
-
* Parallels the server-side CSS shim: CSS stays in the module graph as a string
|
|
13
|
-
* export while real stylesheet delivery uses `dependencies.stylesheets`.
|
|
14
|
-
*/
|
|
15
|
-
export function materializeDevTransformStylesheet(cssContent) {
|
|
16
|
-
return `export default ${JSON.stringify(cssContent)};\n`;
|
|
17
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DevTransformBundleContributor } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Merges runtime manifest specifiers from all dev-transform contributors.
|
|
4
|
-
*/
|
|
5
|
-
export declare function mergeContributorRuntimeSpecifierMaps(contributors: readonly DevTransformBundleContributor[]): Map<string, string>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merges runtime manifest specifiers from all dev-transform contributors.
|
|
3
|
-
*/
|
|
4
|
-
export function mergeContributorRuntimeSpecifierMaps(contributors) {
|
|
5
|
-
const merged = new Map();
|
|
6
|
-
for (const contributor of contributors) {
|
|
7
|
-
const runtimeSpecifierMap = contributor.getRuntimeSpecifierMap?.();
|
|
8
|
-
if (!runtimeSpecifierMap) {
|
|
9
|
-
continue;
|
|
10
|
-
}
|
|
11
|
-
for (const [specifier, url] of runtimeSpecifierMap) {
|
|
12
|
-
merged.set(specifier, url);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return merged;
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type AssetProcessingIntegration, type AssetDefinition, type ProcessedAsset } from '../../../assets/asset-processing-service/index.js';
|
|
2
|
-
export type CustomElementSsrPipelineImporterOptions = {
|
|
3
|
-
integration?: AssetProcessingIntegration;
|
|
4
|
-
processDependencies: (dependencies: AssetDefinition[], integration?: AssetProcessingIntegration) => Promise<ProcessedAsset[]>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Imports SSR scripts from their asset-pipeline output so preload shares the
|
|
8
|
-
* renderer dependency graph instead of an isolated app-module bundle.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* A script the pipeline cannot build is reported as a preload failure; it is
|
|
12
|
-
* never imported from source, because a native source import skips the server
|
|
13
|
-
* loaders for CSS, MDX and assets.
|
|
14
|
-
*/
|
|
15
|
-
export declare function createCustomElementSsrPipelineImporter({ integration, processDependencies, }: CustomElementSsrPipelineImporterOptions): (scriptPath: string, registryKey: string) => Promise<void>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import { fileSystem } from '@ecopages/file-system';
|
|
4
|
-
import { AssetFactory, } from '../../../assets/asset-processing-service/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Imports SSR scripts from their asset-pipeline output so preload shares the
|
|
7
|
-
* renderer dependency graph instead of an isolated app-module bundle.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* A script the pipeline cannot build is reported as a preload failure; it is
|
|
11
|
-
* never imported from source, because a native source import skips the server
|
|
12
|
-
* loaders for CSS, MDX and assets.
|
|
13
|
-
*/
|
|
14
|
-
export function createCustomElementSsrPipelineImporter({ integration, processDependencies, }) {
|
|
15
|
-
const entrypointCache = new Map();
|
|
16
|
-
const resolveEntrypoint = async (scriptPath) => {
|
|
17
|
-
const processed = await processDependencies([
|
|
18
|
-
AssetFactory.createInlineFileScript({
|
|
19
|
-
filepath: scriptPath,
|
|
20
|
-
excludeFromHtml: true,
|
|
21
|
-
position: 'head',
|
|
22
|
-
bundle: true,
|
|
23
|
-
attributes: {
|
|
24
|
-
type: 'module',
|
|
25
|
-
defer: '',
|
|
26
|
-
},
|
|
27
|
-
}),
|
|
28
|
-
], integration);
|
|
29
|
-
const entrypoint = processed[0]?.filepath;
|
|
30
|
-
if (!entrypoint || path.resolve(entrypoint) === path.resolve(scriptPath)) {
|
|
31
|
-
throw new Error(`The asset pipeline produced no server module for SSR script ${scriptPath}`);
|
|
32
|
-
}
|
|
33
|
-
return entrypoint;
|
|
34
|
-
};
|
|
35
|
-
return async (scriptPath, registryKey) => {
|
|
36
|
-
let entrypoint = entrypointCache.get(scriptPath);
|
|
37
|
-
if (!entrypoint) {
|
|
38
|
-
entrypoint = await resolveEntrypoint(scriptPath);
|
|
39
|
-
entrypointCache.set(scriptPath, entrypoint);
|
|
40
|
-
}
|
|
41
|
-
await importModuleForRegistry(entrypoint, registryKey);
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Evaluates an asset-pipeline module against one custom-element registry.
|
|
46
|
-
*
|
|
47
|
-
* @remarks
|
|
48
|
-
* Bun ignores a query-only URL change for every module, so a query cannot
|
|
49
|
-
* evaluate the module again for a new registry. A copy beside the pipeline
|
|
50
|
-
* file has its own path, so both runtimes evaluate it again, and it keeps the
|
|
51
|
-
* original's package scope and relative `import()`/`import.meta.url`
|
|
52
|
-
* resolution. The copy is removed once evaluated, so it never reaches the
|
|
53
|
-
* build output.
|
|
54
|
-
*/
|
|
55
|
-
async function importModuleForRegistry(modulePath, registryKey) {
|
|
56
|
-
const { dir, name, ext } = path.parse(modulePath);
|
|
57
|
-
const copyPath = path.join(dir, `${name}.eco-ssr-${registryKey}${ext}`);
|
|
58
|
-
await fileSystem.copyFileAsync(modulePath, copyPath);
|
|
59
|
-
try {
|
|
60
|
-
await import(/* @vite-ignore */ pathToFileURL(copyPath).href);
|
|
61
|
-
}
|
|
62
|
-
finally {
|
|
63
|
-
await fileSystem.removeAsync(copyPath);
|
|
64
|
-
}
|
|
65
|
-
}
|
package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { EcoPagesAppConfig } from '../../../config/internal-types.js';
|
|
2
|
-
import type { PageParams } from '../../../types/contracts.js';
|
|
3
|
-
/**
|
|
4
|
-
* Formats the `entry …` label for {@link missingProductionBrowserGraphError}.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Prefers Params when present. Otherwise formats the instance key next to its serializer.
|
|
8
|
-
*/
|
|
9
|
-
export declare function describeProductionBrowserGraphEntry(params?: PageParams, dependencyInstanceKey?: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Returns whether production serving must reject a Page Browser Graph that was not built.
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* True only after `ecopages start` restores the browser client manifest. Static export still
|
|
15
|
-
* builds a graph while writing HTML, including Lit workers that never load that manifest.
|
|
16
|
-
*/
|
|
17
|
-
export declare function shouldRejectUnplannedProductionBrowserGraph(appConfig: EcoPagesAppConfig): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Error for a production request whose Page Browser Graph was not built by `ecopages build`.
|
|
20
|
-
*/
|
|
21
|
-
export declare function missingProductionBrowserGraphError(routeFile: string, entry: string): Error;
|
package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { isProductionRuntime } from '../../../utils/runtime.js';
|
|
2
|
-
import { requireAppRuntime } from '../../../utils/app-runtime.js';
|
|
3
|
-
import { describePageDependencyInstance, describePageDependencyInstanceKey } from './route-instance-key.js';
|
|
4
|
-
/**
|
|
5
|
-
* Formats the `entry …` label for {@link missingProductionBrowserGraphError}.
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* Prefers Params when present. Otherwise formats the instance key next to its serializer.
|
|
9
|
-
*/
|
|
10
|
-
export function describeProductionBrowserGraphEntry(params, dependencyInstanceKey) {
|
|
11
|
-
if (params && Object.keys(params).length > 0) {
|
|
12
|
-
return describePageDependencyInstance({ params });
|
|
13
|
-
}
|
|
14
|
-
return describePageDependencyInstanceKey(dependencyInstanceKey ?? '');
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns whether production serving must reject a Page Browser Graph that was not built.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* True only after `ecopages start` restores the browser client manifest. Static export still
|
|
21
|
-
* builds a graph while writing HTML, including Lit workers that never load that manifest.
|
|
22
|
-
*/
|
|
23
|
-
export function shouldRejectUnplannedProductionBrowserGraph(appConfig) {
|
|
24
|
-
return isProductionRuntime() && requireAppRuntime(appConfig).productionBrowserGraphsSealed;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Error for a production request whose Page Browser Graph was not built by `ecopages build`.
|
|
28
|
-
*/
|
|
29
|
-
export function missingProductionBrowserGraphError(routeFile, entry) {
|
|
30
|
-
return new Error(`The production Page Browser Graph for ${routeFile} is missing from the manifest (entry ${entry}). Run \`ecopages build\` again.`);
|
|
31
|
-
}
|