@ecopages/core 0.6.0 → 0.7.0
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 +20 -3
- package/src/router/client/navigation-coordinator.d.ts +18 -0
- package/src/router/client/navigation-coordinator.js +14 -0
- package/src/router/client/navigation-head-order.fixture.css +3 -0
- package/src/router/client/navigation-head.d.ts +2 -1
- package/src/router/client/navigation-head.fixture.css +3 -0
- package/src/router/client/navigation-head.js +222 -39
- package/src/router/client/navigation-lifecycle.d.ts +8 -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
|
@@ -3,6 +3,8 @@ import { collectRerunScripts, isNonExecutableHeadScript, isRerunScript, shouldPe
|
|
|
3
3
|
import { getNavigationScriptIdentity } from '../../client/navigation-scripts/identity.js';
|
|
4
4
|
import { ECO_PERSIST_ATTRIBUTE } from '../../client/navigation-attributes.js';
|
|
5
5
|
const stagedStylesheetLoads = new Map();
|
|
6
|
+
const pendingStylesheetLinks = new Map();
|
|
7
|
+
let latestHeadUpdateGeneration = 0;
|
|
6
8
|
function resolveMetaElementKey(element) {
|
|
7
9
|
const identity = element.getAttribute('name') ||
|
|
8
10
|
element.getAttribute('property') ||
|
|
@@ -47,6 +49,8 @@ function indexHeadChildren(head) {
|
|
|
47
49
|
for (const element of Array.from(head.children)) {
|
|
48
50
|
if (element.hasAttribute('data-eco-injected'))
|
|
49
51
|
continue;
|
|
52
|
+
if (element instanceof HTMLLinkElement && pendingStylesheetLinks.has(element))
|
|
53
|
+
continue;
|
|
50
54
|
const key = resolveHeadElementKey(element);
|
|
51
55
|
if (key)
|
|
52
56
|
elements.set(key, element);
|
|
@@ -84,19 +88,100 @@ function syncAttributes(current, incoming) {
|
|
|
84
88
|
}
|
|
85
89
|
for (const attribute of Array.from(incoming.attributes)) {
|
|
86
90
|
if ((incoming.tagName === 'LINK' || incoming.tagName === 'BASE') && attribute.name === 'href') {
|
|
87
|
-
|
|
91
|
+
const href = incoming.href;
|
|
92
|
+
if (current.href !== href)
|
|
93
|
+
current.setAttribute('href', href);
|
|
88
94
|
}
|
|
89
95
|
else {
|
|
90
96
|
current.setAttribute(attribute.name, attribute.value);
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
100
|
+
function isCascadeOrderedElement(key, element) {
|
|
101
|
+
return element.tagName === 'STYLE' || key.startsWith('link:stylesheet:');
|
|
102
|
+
}
|
|
103
|
+
function insertIncomingHeadElement(element, key, incomingElements, currentElements) {
|
|
104
|
+
let anchor = null;
|
|
105
|
+
if (isCascadeOrderedElement(key, element)) {
|
|
106
|
+
let found = false;
|
|
107
|
+
for (const [nextKey, nextIncoming] of incomingElements) {
|
|
108
|
+
if (nextKey === key) {
|
|
109
|
+
found = true;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (!found || !isCascadeOrderedElement(nextKey, nextIncoming))
|
|
113
|
+
continue;
|
|
114
|
+
anchor = currentElements.get(nextKey) ?? null;
|
|
115
|
+
if (anchor)
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (anchor) {
|
|
120
|
+
document.head.insertBefore(element, anchor);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
document.head.appendChild(element);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function isInIncomingCascadePosition(key, element, incomingElements, currentElements) {
|
|
127
|
+
let before = true;
|
|
128
|
+
for (const [otherKey, incoming] of incomingElements) {
|
|
129
|
+
if (otherKey === key) {
|
|
130
|
+
before = false;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (!isCascadeOrderedElement(otherKey, incoming))
|
|
134
|
+
continue;
|
|
135
|
+
const other = currentElements.get(otherKey);
|
|
136
|
+
if (!other || other === element)
|
|
137
|
+
continue;
|
|
138
|
+
const otherFollows = Boolean(element.compareDocumentPosition(other) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
139
|
+
if (otherFollows === before)
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
function cascadeOrderChanged(incoming, current) {
|
|
145
|
+
const retained = new Map([...current].filter(([, element]) => !(element instanceof HTMLLinkElement && pendingStylesheetLinks.has(element))));
|
|
146
|
+
const incomingKeys = [...incoming]
|
|
147
|
+
.filter(([key, element]) => isCascadeOrderedElement(key, element) && retained.has(key))
|
|
148
|
+
.map(([key]) => key);
|
|
149
|
+
const currentKeys = [...retained]
|
|
150
|
+
.filter(([key, element]) => isCascadeOrderedElement(key, element) && incoming.has(key))
|
|
151
|
+
.map(([key]) => key);
|
|
152
|
+
return incomingKeys.some((key, index) => currentKeys[index] !== key);
|
|
153
|
+
}
|
|
94
154
|
function isPersisted(element, persistAttribute) {
|
|
95
155
|
return (element.hasAttribute(persistAttribute) ||
|
|
96
156
|
element.hasAttribute(ECO_PERSIST_ATTRIBUTE) ||
|
|
97
157
|
element.matches('meta[charset]') ||
|
|
98
158
|
shouldPersistExecutableInlineHeadScript(element));
|
|
99
159
|
}
|
|
160
|
+
function hasPersistedCascadeReorder(incoming, current, persistAttribute) {
|
|
161
|
+
return (cascadeOrderChanged(incoming, current) &&
|
|
162
|
+
[...current].some(([key, element]) => incoming.has(key) && isCascadeOrderedElement(key, element) && isPersisted(element, persistAttribute)));
|
|
163
|
+
}
|
|
164
|
+
function stylesheetOrderChanged(incoming, active, staged) {
|
|
165
|
+
let previous;
|
|
166
|
+
for (const key of incoming.keys()) {
|
|
167
|
+
if (!key.startsWith('link:stylesheet:'))
|
|
168
|
+
continue;
|
|
169
|
+
const stage = staged.get(key);
|
|
170
|
+
const current = stage && !stage.committed ? stage.link : active.get(key);
|
|
171
|
+
if (!current)
|
|
172
|
+
return true;
|
|
173
|
+
if (previous && !(previous.compareDocumentPosition(current) & Node.DOCUMENT_POSITION_FOLLOWING))
|
|
174
|
+
return true;
|
|
175
|
+
previous = current;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
function hasPersistedStylesheetForStage(key, stage, persistAttribute) {
|
|
180
|
+
return Array.from(document.head.children).some((element) => element !== stage.link &&
|
|
181
|
+
!(element instanceof HTMLLinkElement && pendingStylesheetLinks.has(element)) &&
|
|
182
|
+
resolveHeadElementKey(element) === key &&
|
|
183
|
+
isPersisted(element, persistAttribute));
|
|
184
|
+
}
|
|
100
185
|
function createHeadScriptActivations(newDocument, currentElements, shouldSkip) {
|
|
101
186
|
const knownScriptKeys = new Set([...currentElements.keys()].filter((key) => key.startsWith('script:')));
|
|
102
187
|
const activations = [];
|
|
@@ -130,100 +215,198 @@ function waitForStylesheet(link) {
|
|
|
130
215
|
let timeout;
|
|
131
216
|
const observer = new MutationObserver(() => {
|
|
132
217
|
if (!link.isConnected)
|
|
133
|
-
done();
|
|
218
|
+
done(false);
|
|
134
219
|
});
|
|
135
|
-
const done = () => {
|
|
220
|
+
const done = (loaded) => {
|
|
136
221
|
clearTimeout(timeout);
|
|
137
222
|
observer.disconnect();
|
|
138
|
-
link.removeEventListener('load',
|
|
139
|
-
link.removeEventListener('error',
|
|
140
|
-
resolve();
|
|
223
|
+
link.removeEventListener('load', onLoad);
|
|
224
|
+
link.removeEventListener('error', onError);
|
|
225
|
+
resolve(loaded);
|
|
141
226
|
};
|
|
142
|
-
|
|
227
|
+
const onLoad = () => done(true);
|
|
228
|
+
const onError = () => done(false);
|
|
229
|
+
timeout = setTimeout(() => done(false), 5000);
|
|
143
230
|
observer.observe(document.head, { childList: true, subtree: true });
|
|
144
|
-
link.addEventListener('load',
|
|
145
|
-
link.addEventListener('error',
|
|
231
|
+
link.addEventListener('load', onLoad, { once: true });
|
|
232
|
+
link.addEventListener('error', onError, { once: true });
|
|
146
233
|
});
|
|
147
234
|
}
|
|
148
|
-
async function
|
|
235
|
+
async function replacementStylesheetsLoaded(currentElements, stagedStylesheets) {
|
|
236
|
+
for (const [key, stage] of stagedStylesheets) {
|
|
237
|
+
if (currentElements.has(key) && !(await stage.loaded))
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
async function preloadIncomingStylesheets(incomingElements, currentElements, stagedStylesheets, generation) {
|
|
149
243
|
const loadPromises = [];
|
|
150
|
-
|
|
244
|
+
const reorder = cascadeOrderChanged(incomingElements, currentElements);
|
|
245
|
+
const placementElements = new Map(currentElements);
|
|
246
|
+
if (reorder) {
|
|
247
|
+
for (const [key] of incomingElements) {
|
|
248
|
+
if (key.startsWith('link:stylesheet:'))
|
|
249
|
+
placementElements.delete(key);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const entries = [...incomingElements];
|
|
253
|
+
const signature = JSON.stringify(entries.filter(([key, element]) => isCascadeOrderedElement(key, element)).map(([key]) => key));
|
|
254
|
+
if (reorder)
|
|
255
|
+
entries.reverse();
|
|
256
|
+
for (const [key, element] of entries) {
|
|
151
257
|
if (!key.startsWith('link:stylesheet:'))
|
|
152
258
|
continue;
|
|
153
|
-
const
|
|
154
|
-
|
|
259
|
+
const registryKey = JSON.stringify([signature, key]);
|
|
260
|
+
const existingStage = stagedStylesheetLoads.get(registryKey);
|
|
261
|
+
if (existingStage &&
|
|
262
|
+
existingStage.link.isConnected &&
|
|
263
|
+
isInIncomingCascadePosition(key, existingStage.link, incomingElements, currentElements)) {
|
|
155
264
|
existingStage.users += 1;
|
|
265
|
+
existingStage.latestGeneration = generation;
|
|
156
266
|
stagedStylesheets.set(key, existingStage);
|
|
157
267
|
loadPromises.push(existingStage.loaded);
|
|
268
|
+
placementElements.set(key, existingStage.link);
|
|
158
269
|
continue;
|
|
159
270
|
}
|
|
160
|
-
if (currentElements.has(key))
|
|
271
|
+
if (currentElements.has(key) && !existingStage && !reorder)
|
|
161
272
|
continue;
|
|
162
273
|
const link = cloneHeadElement(element);
|
|
163
|
-
|
|
164
|
-
|
|
274
|
+
link.media = 'not all';
|
|
275
|
+
const stage = {
|
|
276
|
+
link,
|
|
277
|
+
loaded: waitForStylesheet(link),
|
|
278
|
+
users: 1,
|
|
279
|
+
committed: false,
|
|
280
|
+
registryKey,
|
|
281
|
+
loadedSuccessfully: null,
|
|
282
|
+
latestGeneration: generation,
|
|
283
|
+
};
|
|
284
|
+
void stage.loaded.then((loaded) => {
|
|
285
|
+
stage.loadedSuccessfully = loaded;
|
|
286
|
+
});
|
|
287
|
+
pendingStylesheetLinks.set(link, stage);
|
|
288
|
+
stagedStylesheetLoads.set(registryKey, stage);
|
|
165
289
|
stagedStylesheets.set(key, stage);
|
|
166
290
|
loadPromises.push(stage.loaded);
|
|
167
|
-
|
|
291
|
+
insertIncomingHeadElement(link, key, incomingElements, placementElements);
|
|
292
|
+
placementElements.set(key, link);
|
|
168
293
|
}
|
|
169
294
|
await Promise.all(loadPromises);
|
|
295
|
+
return await replacementStylesheetsLoaded(currentElements, stagedStylesheets);
|
|
296
|
+
}
|
|
297
|
+
function activateStagedStylesheet(key, stage, incoming) {
|
|
298
|
+
for (const candidate of Array.from(document.head.children)) {
|
|
299
|
+
if (candidate === stage.link || resolveHeadElementKey(candidate) !== key)
|
|
300
|
+
continue;
|
|
301
|
+
if (candidate instanceof HTMLLinkElement && pendingStylesheetLinks.has(candidate))
|
|
302
|
+
continue;
|
|
303
|
+
candidate.remove();
|
|
304
|
+
}
|
|
305
|
+
syncHeadElement(stage.link, incoming);
|
|
306
|
+
}
|
|
307
|
+
function reconcileIncomingHead(incomingElements, stagedStylesheets) {
|
|
308
|
+
const current = indexHeadChildren(document.head);
|
|
309
|
+
for (const [key, incoming] of incomingElements) {
|
|
310
|
+
if (incoming.tagName === 'SCRIPT' && !isNonExecutableHeadScript(incoming))
|
|
311
|
+
continue;
|
|
312
|
+
const existing = current.get(key);
|
|
313
|
+
const staged = stagedStylesheets.get(key);
|
|
314
|
+
if (staged && !staged.committed) {
|
|
315
|
+
activateStagedStylesheet(key, staged, incoming);
|
|
316
|
+
current.set(key, staged.link);
|
|
317
|
+
}
|
|
318
|
+
else if (existing) {
|
|
319
|
+
syncHeadElement(existing, incoming);
|
|
320
|
+
}
|
|
321
|
+
else if (!staged) {
|
|
322
|
+
const clone = cloneHeadElement(incoming);
|
|
323
|
+
insertIncomingHeadElement(clone, key, incomingElements, current);
|
|
324
|
+
current.set(key, clone);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
for (const [key, incoming] of [...incomingElements].reverse()) {
|
|
328
|
+
if (incoming.tagName !== 'STYLE')
|
|
329
|
+
continue;
|
|
330
|
+
const style = current.get(key);
|
|
331
|
+
if (style && !isInIncomingCascadePosition(key, style, incomingElements, current)) {
|
|
332
|
+
insertIncomingHeadElement(style, key, incomingElements, current);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return current;
|
|
170
336
|
}
|
|
171
337
|
/**
|
|
172
|
-
* Stages incoming stylesheets and prepares one diff for either router to commit.
|
|
338
|
+
* Stages incoming stylesheets without applying them and prepares one diff for either router to commit.
|
|
173
339
|
*/
|
|
174
340
|
export async function prepareNavigationHead(newDocument, persistAttribute = ECO_PERSIST_ATTRIBUTE, shouldSkipScriptActivation = () => false) {
|
|
341
|
+
const generation = ++latestHeadUpdateGeneration;
|
|
175
342
|
const incomingElements = indexHeadChildren(newDocument.head);
|
|
176
343
|
const currentElements = indexHeadChildren(document.head);
|
|
177
344
|
const pendingRerunScripts = collectRerunScripts(newDocument, (script) => !shouldSkipScriptActivation(script));
|
|
178
345
|
const scriptActivations = createHeadScriptActivations(newDocument, currentElements, shouldSkipScriptActivation);
|
|
179
346
|
const rerunScriptActivations = pendingRerunScripts.map(toRerunScriptActivation);
|
|
180
347
|
const stagedStylesheets = new Map();
|
|
181
|
-
|
|
348
|
+
const hasPersistedReorder = hasPersistedCascadeReorder(incomingElements, currentElements, persistAttribute);
|
|
349
|
+
const requiresReload = hasPersistedReorder ||
|
|
350
|
+
!(await preloadIncomingStylesheets(incomingElements, currentElements, stagedStylesheets, generation));
|
|
182
351
|
let committed = false;
|
|
183
352
|
let cancelled = false;
|
|
353
|
+
const reloadRequired = () => {
|
|
354
|
+
if (requiresReload)
|
|
355
|
+
return true;
|
|
356
|
+
const active = indexHeadChildren(document.head);
|
|
357
|
+
if (hasPersistedCascadeReorder(incomingElements, active, persistAttribute))
|
|
358
|
+
return true;
|
|
359
|
+
if (stylesheetOrderChanged(incomingElements, active, stagedStylesheets))
|
|
360
|
+
return true;
|
|
361
|
+
for (const [key, stage] of stagedStylesheets) {
|
|
362
|
+
if (!stage.link.isConnected || (active.has(key) && stage.loadedSuccessfully === false))
|
|
363
|
+
return true;
|
|
364
|
+
if (hasPersistedStylesheetForStage(key, stage, persistAttribute))
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
};
|
|
184
369
|
return {
|
|
185
370
|
scriptActivations,
|
|
186
371
|
rerunScriptActivations,
|
|
372
|
+
get requiresReload() {
|
|
373
|
+
return reloadRequired();
|
|
374
|
+
},
|
|
187
375
|
commit() {
|
|
188
376
|
if (committed || cancelled)
|
|
189
377
|
return;
|
|
378
|
+
if (reloadRequired())
|
|
379
|
+
throw new Error('Navigation head update requires a full document navigation');
|
|
190
380
|
committed = true;
|
|
191
|
-
const current =
|
|
192
|
-
for (const [
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const staged = stagedStylesheets.get(key);
|
|
197
|
-
if (existing) {
|
|
198
|
-
if (staged && staged.link !== existing)
|
|
199
|
-
staged.link.remove();
|
|
200
|
-
syncHeadElement(existing, incoming);
|
|
201
|
-
}
|
|
202
|
-
else if (!staged) {
|
|
203
|
-
document.head.appendChild(cloneHeadElement(incoming));
|
|
204
|
-
}
|
|
381
|
+
const current = reconcileIncomingHead(incomingElements, stagedStylesheets);
|
|
382
|
+
for (const [link, stage] of pendingStylesheetLinks) {
|
|
383
|
+
const key = resolveHeadElementKey(link);
|
|
384
|
+
if (stage.latestGeneration < generation && key && !incomingElements.has(key))
|
|
385
|
+
link.remove();
|
|
205
386
|
}
|
|
206
387
|
for (const [key, element] of current) {
|
|
207
388
|
if (incomingElements.has(key) || isPersisted(element, persistAttribute))
|
|
208
389
|
continue;
|
|
209
390
|
element.remove();
|
|
210
391
|
}
|
|
211
|
-
for (const
|
|
392
|
+
for (const stage of stagedStylesheets.values()) {
|
|
212
393
|
stage.committed = true;
|
|
213
|
-
|
|
214
|
-
|
|
394
|
+
pendingStylesheetLinks.delete(stage.link);
|
|
395
|
+
if (stagedStylesheetLoads.get(stage.registryKey) === stage)
|
|
396
|
+
stagedStylesheetLoads.delete(stage.registryKey);
|
|
215
397
|
}
|
|
216
398
|
},
|
|
217
399
|
cancel() {
|
|
218
400
|
if (committed || cancelled)
|
|
219
401
|
return;
|
|
220
402
|
cancelled = true;
|
|
221
|
-
for (const
|
|
403
|
+
for (const stage of stagedStylesheets.values()) {
|
|
222
404
|
stage.users -= 1;
|
|
223
405
|
if (stage.users === 0 && !stage.committed) {
|
|
224
406
|
stage.link.remove();
|
|
225
|
-
|
|
226
|
-
|
|
407
|
+
pendingStylesheetLinks.delete(stage.link);
|
|
408
|
+
if (stagedStylesheetLoads.get(stage.registryKey) === stage)
|
|
409
|
+
stagedStylesheetLoads.delete(stage.registryKey);
|
|
227
410
|
}
|
|
228
411
|
}
|
|
229
412
|
},
|
|
@@ -37,7 +37,7 @@ export type DispatchBeforeSwapResult = {
|
|
|
37
37
|
requestedReload: boolean;
|
|
38
38
|
};
|
|
39
39
|
export type SchedulePageLoadOptions = {
|
|
40
|
-
|
|
40
|
+
isSuperseded?: () => boolean;
|
|
41
41
|
schedule?: (callback: FrameRequestCallback) => number;
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
@@ -47,3 +47,10 @@ export declare function dispatchBeforeSwap(doc: Document, input: Omit<EcoBeforeS
|
|
|
47
47
|
export type CompleteNavigationLifecycleOptions = SchedulePageLoadOptions;
|
|
48
48
|
/** Dispatches `eco:after-swap` and schedules `eco:page-load`. */
|
|
49
49
|
export declare function completeNavigationLifecycle(doc: Document, detail: EcoNavigationEvent, options?: CompleteNavigationLifecycleOptions): void;
|
|
50
|
+
/**
|
|
51
|
+
* Schedules `eco:page-load` on the next animation frame unless a newer navigation replaced this one.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Supersession is not staleness: a navigation that completed normally still owes its page-load event.
|
|
55
|
+
*/
|
|
56
|
+
export declare function schedulePageLoad(doc: Document, detail: EcoNavigationEvent, options?: SchedulePageLoadOptions): void;
|
|
@@ -37,12 +37,15 @@ export function completeNavigationLifecycle(doc, detail, options = {}) {
|
|
|
37
37
|
schedulePageLoad(doc, detail, options);
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Schedules `eco:page-load` on the next animation frame unless navigation
|
|
40
|
+
* Schedules `eco:page-load` on the next animation frame unless a newer navigation replaced this one.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Supersession is not staleness: a navigation that completed normally still owes its page-load event.
|
|
41
44
|
*/
|
|
42
|
-
function schedulePageLoad(doc, detail, options = {}) {
|
|
45
|
+
export function schedulePageLoad(doc, detail, options = {}) {
|
|
43
46
|
const schedule = options.schedule ?? ((callback) => requestAnimationFrame(callback));
|
|
44
47
|
schedule(() => {
|
|
45
|
-
if (options.
|
|
48
|
+
if (options.isSuperseded?.()) {
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
51
|
doc.dispatchEvent(new CustomEvent(ECO_NAVIGATION_LIFECYCLE_EVENTS.PAGE_LOAD, { detail }));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ECO_PERSIST_ATTRIBUTE } from '../../client/navigation-attributes.js';
|
|
2
|
+
export { loadNavigationGlobalScripts } from '../../client/navigation-scripts/global-scripts.js';
|
|
2
3
|
export { commitNavigationPage, type NavigationCommitPipelineInput, type NavigationCommitPipelineResult, } from './navigation-commit.js';
|
|
3
4
|
export { runNavigationViewTransition, type NavigationViewTransitionOptions } from './navigation-view-transition.js';
|
|
4
5
|
export { decideQueuedNavigationReplay, type DecideQueuedNavigationReplayInput, type QueueReplayDecision, } from './navigation-replay.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ECO_PERSIST_ATTRIBUTE } from '../../client/navigation-attributes.js';
|
|
2
|
+
export { loadNavigationGlobalScripts } from '../../client/navigation-scripts/global-scripts.js';
|
|
2
3
|
export { commitNavigationPage, } from './navigation-commit.js';
|
|
3
4
|
export { runNavigationViewTransition } from './navigation-view-transition.js';
|
|
4
5
|
export { decideQueuedNavigationReplay, } from './navigation-replay.js';
|
|
@@ -106,7 +106,7 @@ export declare class RouteRegistry {
|
|
|
106
106
|
* @remarks
|
|
107
107
|
* The return shape is {@link PathExpansion}, the same records `staticPaths` produces. They are
|
|
108
108
|
* not Static Path Expansions: HTML still uses Request-Time Rendering. The build uses them so
|
|
109
|
-
* each Params list's graph
|
|
109
|
+
* each Params list's graph scripts are in the production asset ledger.
|
|
110
110
|
*/
|
|
111
111
|
listDynamicPagePathExpansions(input: {
|
|
112
112
|
runtimeOrigin: string;
|
|
@@ -120,7 +120,8 @@ export declare class RouteRegistry {
|
|
|
120
120
|
* Strips the longest template extension the file ends with, so `about.kita.tsx` keeps no
|
|
121
121
|
* `.kita` part when `.tsx` is also registered, and `my.html-tips.html` keeps its name. An
|
|
122
122
|
* endpoint strips its whole marker, so `users.api.tsx` is `/users` even when `.tsx` is a
|
|
123
|
-
* template extension.
|
|
123
|
+
* template extension. `file` is relative to the pages directory and uses `/`, as `fileSystem.glob`
|
|
124
|
+
* returns it.
|
|
124
125
|
*/
|
|
125
126
|
private getRoutePath;
|
|
126
127
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
3
|
import { appLogger } from '../../global/app-logger.js';
|
|
4
4
|
import { loadProductionTemplateRoutes } from '../../build/production-route-list.js';
|
|
@@ -131,8 +131,8 @@ export class RouteRegistry {
|
|
|
131
131
|
}
|
|
132
132
|
const staticPaths = pageModule.staticPaths;
|
|
133
133
|
if (options.requireStaticHooks && this.buildMode) {
|
|
134
|
-
invariant(staticPaths !== undefined, `[ecopages] Missing
|
|
135
|
-
invariant(pageModule.staticProps !== undefined, `[ecopages] Missing
|
|
134
|
+
invariant(staticPaths !== undefined, `[ecopages] Missing staticPaths in ${route.filePath}`);
|
|
135
|
+
invariant(pageModule.staticProps !== undefined, `[ecopages] Missing staticProps in ${route.filePath}`);
|
|
136
136
|
}
|
|
137
137
|
if (!staticPaths) {
|
|
138
138
|
continue;
|
|
@@ -153,7 +153,7 @@ export class RouteRegistry {
|
|
|
153
153
|
* @remarks
|
|
154
154
|
* The return shape is {@link PathExpansion}, the same records `staticPaths` produces. They are
|
|
155
155
|
* not Static Path Expansions: HTML still uses Request-Time Rendering. The build uses them so
|
|
156
|
-
* each Params list's graph
|
|
156
|
+
* each Params list's graph scripts are in the production asset ledger.
|
|
157
157
|
*/
|
|
158
158
|
async listDynamicPagePathExpansions(input) {
|
|
159
159
|
return this.listPathExpansions(input, {
|
|
@@ -245,7 +245,8 @@ export class RouteRegistry {
|
|
|
245
245
|
* Strips the longest template extension the file ends with, so `about.kita.tsx` keeps no
|
|
246
246
|
* `.kita` part when `.tsx` is also registered, and `my.html-tips.html` keeps its name. An
|
|
247
247
|
* endpoint strips its whole marker, so `users.api.tsx` is `/users` even when `.tsx` is a
|
|
248
|
-
* template extension.
|
|
248
|
+
* template extension. `file` is relative to the pages directory and uses `/`, as `fileSystem.glob`
|
|
249
|
+
* returns it.
|
|
249
250
|
*/
|
|
250
251
|
getRoutePath(file, endpointExtension) {
|
|
251
252
|
const extension = endpointExtension ?? findLongestExtension(this.templatesExt, file) ?? '';
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { EcoPagesAppConfig } from '../config/internal-types.js';
|
|
2
|
-
import type { PageParams } from '../types/contracts.js';
|
|
3
2
|
import type { PageRendererResolver } from '../route-renderer/route-renderer.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
params?: PageParams;
|
|
7
|
-
skipStaticProps?: boolean;
|
|
8
|
-
isRouteTemplate?: boolean;
|
|
9
|
-
};
|
|
3
|
+
import type { PlannedRoutePreparation } from '../route-renderer/orchestration/route-pipeline/route-render-orchestrator.js';
|
|
4
|
+
import type { PlannedRouteInstance } from '../route-renderer/orchestration/integration-renderer.js';
|
|
10
5
|
/**
|
|
11
6
|
* Returns whether production should reuse prebuilt Page Browser Graphs.
|
|
12
7
|
*
|
|
@@ -19,24 +14,41 @@ export declare function shouldPrebuildProductionPageBrowserGraphs(): boolean;
|
|
|
19
14
|
* Clears in-memory production Page Browser Graph session records.
|
|
20
15
|
*
|
|
21
16
|
* @remarks
|
|
22
|
-
* Clears only the `'production'` policy so a failed or force export cannot
|
|
23
|
-
*
|
|
24
|
-
*
|
|
17
|
+
* Clears only the `'production'` policy so a failed or force export cannot reuse staged graph output, forgets the
|
|
18
|
+
* app-wide browser build so a retry of `ecopages build` records only its own outputs, and removes the asset ledger
|
|
19
|
+
* file a previous build wrote. Development session records are left intact.
|
|
25
20
|
*/
|
|
26
21
|
export declare function clearProductionPageBrowserGraphSession(appConfig: EcoPagesAppConfig): void;
|
|
22
|
+
/** Identifies one planned route instance: its file, Params and whether it is a template without static props. */
|
|
23
|
+
export declare function getPlannedRouteKey(instance: PlannedRouteInstance): string;
|
|
27
24
|
/**
|
|
28
|
-
*
|
|
25
|
+
* Builds the production browser client for the supplied route instances and prepares each of them.
|
|
29
26
|
*
|
|
30
27
|
* @remarks
|
|
31
|
-
* Deduplicates route file + params pairs
|
|
32
|
-
*
|
|
33
|
-
*
|
|
28
|
+
* Deduplicates route file + params pairs and plans each renderer's routes, which collects the scripts they bundle
|
|
29
|
+
* without processing them. The app-wide browser build then records every planned script in the asset ledger, and
|
|
30
|
+
* each planned route processes its dependencies through it, so the ledger records everything `ecopages start`
|
|
31
|
+
* serves those routes with. The ledger is then written beside the server bundle, where the Lit static-render
|
|
32
|
+
* worker restores it during the export. A route that fails to plan is left out and reported to `onRouteFailure`.
|
|
33
|
+
* Each Integration's global scripts are resolved once, after that build, or on their own when no route is planned.
|
|
34
|
+
*
|
|
35
|
+
* Returns the preparation of every planned instance that runs its static props, by {@link getPlannedRouteKey}, so
|
|
36
|
+
* static export renders it without running its data hooks again. The caller owns the map for the build; no
|
|
37
|
+
* renderer keeps it.
|
|
34
38
|
*/
|
|
35
|
-
export declare function prebuildProductionPageBrowserGraphs(appConfig: EcoPagesAppConfig, routeInstances: readonly
|
|
39
|
+
export declare function prebuildProductionPageBrowserGraphs(appConfig: EcoPagesAppConfig, routeInstances: readonly PlannedRouteInstance[], routeRendererFactory: PageRendererResolver, options?: {
|
|
40
|
+
onRouteFailure?: (routeInstance: PlannedRouteInstance, error: unknown) => void;
|
|
41
|
+
}): Promise<Map<string, PlannedRoutePreparation>>;
|
|
36
42
|
/**
|
|
37
|
-
*
|
|
43
|
+
* Restores the app-wide browser build `ecopages build` recorded in the asset ledger.
|
|
38
44
|
*
|
|
39
45
|
* @remarks
|
|
40
|
-
*
|
|
46
|
+
* Rendering then resolves every script that build bundled through the ledger. With `seal`, as `ecopages start` from
|
|
47
|
+
* a complete `dist/` restores it, a missing ledger is an error. Every dependency then resolves through the ledger,
|
|
48
|
+
* one it does not record is an error, and start compiles and writes nothing. The Lit static-render worker restores without sealing: it renders
|
|
49
|
+
* during the build, which still processes what the ledger does not yet record. It resolves no Integration global
|
|
50
|
+
* scripts: the caller resolves them after it, whether or not a ledger was restored.
|
|
41
51
|
*/
|
|
42
|
-
export declare function
|
|
52
|
+
export declare function restoreProductionBrowserBuild(appConfig: EcoPagesAppConfig, options: {
|
|
53
|
+
seal: boolean;
|
|
54
|
+
}): Promise<boolean>;
|