@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,6 +1,9 @@
|
|
|
1
1
|
import { fileSystem } from '@ecopages/file-system';
|
|
2
|
+
import { PLAIN_CSS_KINDS } from '../../plugins/stylesheet-kinds.js';
|
|
2
3
|
import { AssetFactory } from '../../assets/asset-processing-service/index.js';
|
|
4
|
+
import { isExternalReference, listCssReferences, } from '../../assets/asset-processing-service/processors/stylesheet/css-scanner.js';
|
|
3
5
|
import { contentHash } from '../../utils/content-hash.js';
|
|
6
|
+
import { toRootRelativePath } from '../../utils/root-relative-path.js';
|
|
4
7
|
import { isProductionRuntime } from '../../utils/runtime.js';
|
|
5
8
|
/**
|
|
6
9
|
* Returns `true` when the asset attributes match the exact shape required for
|
|
@@ -14,37 +17,13 @@ function hasOnlyExpectedAttributes(attributes, expected) {
|
|
|
14
17
|
}
|
|
15
18
|
return expectedKeys.every((key) => attributes?.[key] === expected[key]);
|
|
16
19
|
}
|
|
17
|
-
function isSafeBundledStylesheetReference(reference) {
|
|
18
|
-
return (reference.startsWith('/') ||
|
|
19
|
-
reference.startsWith('data:') ||
|
|
20
|
-
reference.startsWith('http://') ||
|
|
21
|
-
reference.startsWith('https://') ||
|
|
22
|
-
reference.startsWith('#'));
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Normalizes CSS URL tokens before safety checks so quoted and unquoted forms are treated equally.
|
|
26
|
-
*/
|
|
27
|
-
function normalizeCssReferenceToken(token) {
|
|
28
|
-
return token.trim().replace(/^['"]|['"]$/g, '');
|
|
29
|
-
}
|
|
30
20
|
/**
|
|
31
21
|
* Rejects stylesheet content that contains relative references which would stop
|
|
32
22
|
* working once multiple files are collapsed into one page-owned bundle.
|
|
33
23
|
*/
|
|
34
24
|
function isSafeBundledStylesheetContent(content) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (reference && !isSafeBundledStylesheetReference(reference)) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
for (const match of content.matchAll(/url\(([^)]+)\)/g)) {
|
|
42
|
-
const reference = normalizeCssReferenceToken(match[1] ?? '');
|
|
43
|
-
if (reference && !isSafeBundledStylesheetReference(reference)) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
25
|
+
const { references, imports } = listCssReferences(content);
|
|
26
|
+
return references.length === 0 && imports.every((statement) => isExternalReference(statement.specifier));
|
|
48
27
|
}
|
|
49
28
|
function isBundleableFileStylesheetAsset(dependency) {
|
|
50
29
|
return dependency.kind === 'stylesheet' && dependency.source === 'file';
|
|
@@ -58,7 +37,7 @@ function isBundleableFileScriptAsset(dependency) {
|
|
|
58
37
|
export function shouldBundlePageDependencies(bundlesPageDependencies) {
|
|
59
38
|
return bundlesPageDependencies;
|
|
60
39
|
}
|
|
61
|
-
function createPageDependencyPackagingPlan(dependencies, integrationName) {
|
|
40
|
+
function createPageDependencyPackagingPlan(dependencies, integrationName, rootDir, stylesheets) {
|
|
62
41
|
const shouldBundleDependencies = isProductionRuntime();
|
|
63
42
|
const bundleableStyles = dependencies
|
|
64
43
|
.filter((dependency) => {
|
|
@@ -74,6 +53,9 @@ function createPageDependencyPackagingPlan(dependencies, integrationName) {
|
|
|
74
53
|
if (dependency.source === 'content') {
|
|
75
54
|
return isSafeBundledStylesheetContent(dependency.content);
|
|
76
55
|
}
|
|
56
|
+
if (dependency.fromPackage || stylesheets.isCssModule(dependency.filepath)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
77
59
|
if (!fileSystem.exists(dependency.filepath)) {
|
|
78
60
|
return false;
|
|
79
61
|
}
|
|
@@ -120,7 +102,7 @@ function createPageDependencyPackagingPlan(dependencies, integrationName) {
|
|
|
120
102
|
for (const run of collectContiguousEligibleRuns(dependencies, isEligibleScript)) {
|
|
121
103
|
const pageScriptImports = [...new Set(run.assets.map((dependency) => dependency.filepath))];
|
|
122
104
|
const bundledScript = AssetFactory.createContentScript({
|
|
123
|
-
name: `${integrationName}-page-${contentHash(pageScriptImports.join('|'), 16)}`,
|
|
105
|
+
name: `${integrationName}-page-${contentHash(pageScriptImports.map((filepath) => toRootRelativePath(rootDir, filepath)).join('|'), 16)}`,
|
|
124
106
|
content: pageScriptImports.map((filepath) => `import ${JSON.stringify(filepath)};`).join('\n'),
|
|
125
107
|
position: 'head',
|
|
126
108
|
attributes: { type: 'module', defer: '' },
|
|
@@ -186,13 +168,15 @@ function applyPageDependencyPackagingPlan(dependencies, plan) {
|
|
|
186
168
|
* Rewrites eligible flat dependency declarations into page-owned stylesheet and script bundles.
|
|
187
169
|
*
|
|
188
170
|
* Only consecutive assets with the default attribute shape and without explicit packaging roles are
|
|
189
|
-
* collapsed so integration-specific, lazy, or custom-attribute assets keep their declared order.
|
|
171
|
+
* collapsed so integration-specific, lazy, or custom-attribute assets keep their declared order. A CSS Module is
|
|
172
|
+
* never collapsed: the bundle concatenates the stylesheet sources and processes the result as one plain stylesheet,
|
|
173
|
+
* which would leave its classes unscoped, so it stays a link of its own, scoped by the Processor.
|
|
190
174
|
*/
|
|
191
|
-
export function packagePageDependencies(dependencies, integrationName, bundlesPageDependencies) {
|
|
175
|
+
export function packagePageDependencies(dependencies, integrationName, bundlesPageDependencies, rootDir, stylesheets = PLAIN_CSS_KINDS) {
|
|
192
176
|
if (!shouldBundlePageDependencies(bundlesPageDependencies)) {
|
|
193
177
|
return dependencies;
|
|
194
178
|
}
|
|
195
|
-
const plan = createPageDependencyPackagingPlan(dependencies, integrationName);
|
|
179
|
+
const plan = createPageDependencyPackagingPlan(dependencies, integrationName, rootDir, stylesheets);
|
|
196
180
|
if (!plan) {
|
|
197
181
|
return dependencies;
|
|
198
182
|
}
|
|
@@ -52,8 +52,19 @@ export declare class PageModuleLoaderService {
|
|
|
52
52
|
context: GetMetadataContext;
|
|
53
53
|
}): Promise<PageMetadataProps>;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
55
|
+
* Fails when a page module still declares data through the removed module-level exports.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Integrations that cannot call `eco.page(...)`, such as MDX, move their metadata export onto the
|
|
59
|
+
* Page in `normalizePageModule`, so only modules that declare the old exports reach this check.
|
|
60
|
+
*/
|
|
61
|
+
assertNoLegacyPageExports(file: string, module: EcoPageFile): void;
|
|
62
|
+
/**
|
|
63
|
+
* Loads a page module and resolves the data hooks of its Page component.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Throws through {@link PageModuleLoaderService.assertNoLegacyPageExports} when the module still
|
|
67
|
+
* has a legacy data export.
|
|
57
68
|
*/
|
|
58
69
|
resolvePageModule(options: {
|
|
59
70
|
file: string;
|
|
@@ -2,6 +2,7 @@ import { invariant } from '../../utils/invariant.js';
|
|
|
2
2
|
import { requireAppRuntime } from '../../utils/app-runtime.js';
|
|
3
3
|
import { resolveInternalExecutionDir } from '../../utils/resolve-work-dir.js';
|
|
4
4
|
import { HttpError } from '../../errors/http-error.js';
|
|
5
|
+
const LEGACY_PAGE_EXPORT_NAMES = ['getStaticPaths', 'getStaticProps', 'getMetadata'];
|
|
5
6
|
/**
|
|
6
7
|
* Loads route page modules and normalizes their data hooks for rendering.
|
|
7
8
|
*
|
|
@@ -91,19 +92,36 @@ export class PageModuleLoaderService {
|
|
|
91
92
|
return metadata;
|
|
92
93
|
}
|
|
93
94
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
95
|
+
* Fails when a page module still declares data through the removed module-level exports.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Integrations that cannot call `eco.page(...)`, such as MDX, move their metadata export onto the
|
|
99
|
+
* Page in `normalizePageModule`, so only modules that declare the old exports reach this check.
|
|
100
|
+
*/
|
|
101
|
+
assertNoLegacyPageExports(file, module) {
|
|
102
|
+
const found = LEGACY_PAGE_EXPORT_NAMES.filter((name) => module[name] !== undefined);
|
|
103
|
+
if (found.length === 0)
|
|
104
|
+
return;
|
|
105
|
+
throw new Error(`[ecopages] ${file} exports ${found.join(', ')}. Pages declare data through the staticPaths, staticProps and metadata options of eco.page({ ... }); module-level exports are no longer read. Run the migrate-to-eco-page codemod from @ecopages/codemod to migrate this file.`);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Loads a page module and resolves the data hooks of its Page component.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* Throws through {@link PageModuleLoaderService.assertNoLegacyPageExports} when the module still
|
|
112
|
+
* has a legacy data export.
|
|
96
113
|
*/
|
|
97
114
|
async resolvePageModule(options) {
|
|
98
115
|
const module = options.pageModule ??
|
|
99
116
|
(await (options.importPageFileFn ?? ((file) => this.importPageFile(file)))(options.file));
|
|
100
|
-
|
|
117
|
+
this.assertNoLegacyPageExports(options.file, module);
|
|
118
|
+
const { default: Page, ...integrationSpecificProps } = module;
|
|
101
119
|
const pageComponent = Page;
|
|
102
120
|
return {
|
|
103
121
|
module,
|
|
104
122
|
Page,
|
|
105
|
-
getStaticProps: pageComponent.staticProps
|
|
106
|
-
getMetadata: pageComponent.metadata
|
|
123
|
+
getStaticProps: pageComponent.staticProps,
|
|
124
|
+
getMetadata: pageComponent.metadata,
|
|
107
125
|
integrationSpecificProps,
|
|
108
126
|
};
|
|
109
127
|
}
|
|
@@ -9,7 +9,7 @@ import type { IntegrationRenderer } from './orchestration/integration-renderer.j
|
|
|
9
9
|
* loading. Returning this narrowed shape avoids a dedicated wrapper class while
|
|
10
10
|
* still keeping callers off the full integration renderer surface.
|
|
11
11
|
*/
|
|
12
|
-
export type PageRouteRenderer = Pick<IntegrationRenderer<unknown>, 'execute' | 'loadPageModule'
|
|
12
|
+
export type PageRouteRenderer = Pick<IntegrationRenderer<unknown>, 'execute' | 'loadPageModule'>;
|
|
13
13
|
/**
|
|
14
14
|
* Narrow explicit-view render contract exposed to static route handling.
|
|
15
15
|
*
|
|
@@ -6,6 +6,8 @@ export type NavigationCommitPipelineInput = {
|
|
|
6
6
|
direction: EcoNavigationDirection;
|
|
7
7
|
newDocument: Document;
|
|
8
8
|
isStale: () => boolean;
|
|
9
|
+
/** Defaults to `isStale`; pass a predicate that stays false after completion to keep `eco:page-load` after `complete()`. */
|
|
10
|
+
isSuperseded?: () => boolean;
|
|
9
11
|
viewTransitionsEnabled: boolean;
|
|
10
12
|
persistAttribute?: string;
|
|
11
13
|
includeBodyScripts?: boolean;
|
|
@@ -6,6 +6,9 @@ async function requestReload(input) {
|
|
|
6
6
|
await input.onReloadRequested?.();
|
|
7
7
|
return input.isStale() ? 'stale' : 'reload-requested';
|
|
8
8
|
}
|
|
9
|
+
function resolveIsSuperseded(input) {
|
|
10
|
+
return input.isSuperseded ?? input.isStale;
|
|
11
|
+
}
|
|
9
12
|
/** Runs shared document work around the router-specific page swap. */
|
|
10
13
|
export async function commitNavigationPage(input) {
|
|
11
14
|
let headUpdate = null;
|
|
@@ -61,7 +64,7 @@ export async function commitNavigationPage(input) {
|
|
|
61
64
|
return input.isStale() ? 'stale' : 'reload-requested';
|
|
62
65
|
if (input.isStale() || !committed)
|
|
63
66
|
return 'stale';
|
|
64
|
-
completeNavigationLifecycle(document, { url: input.url, direction: input.direction }, {
|
|
67
|
+
completeNavigationLifecycle(document, { url: input.url, direction: input.direction }, { isSuperseded: resolveIsSuperseded(input) });
|
|
65
68
|
await input.afterLifecycle?.();
|
|
66
69
|
return input.isStale() ? 'stale' : 'committed';
|
|
67
70
|
}
|
|
@@ -72,6 +72,14 @@ export type EcoNavigationTransaction = {
|
|
|
72
72
|
id: number;
|
|
73
73
|
signal: AbortSignal;
|
|
74
74
|
isCurrent: () => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether a newer navigation began or this one was cancelled.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* Unlike `!isCurrent()`, this stays false after `complete()`, so work scheduled for a committed
|
|
80
|
+
* navigation (such as `eco:page-load`) is skipped only when another navigation replaced it.
|
|
81
|
+
*/
|
|
82
|
+
isSuperseded: () => boolean;
|
|
75
83
|
cancel: () => void;
|
|
76
84
|
complete: () => void;
|
|
77
85
|
};
|
|
@@ -95,6 +103,14 @@ export type EcoNavigationRuntimeRegistration = {
|
|
|
95
103
|
* not blank the current page before the incoming document is ready.
|
|
96
104
|
*/
|
|
97
105
|
cleanupBeforeHandoff?: () => void | Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Starts keeping what the runtime needs to preserve page state on `reloadCurrentPage`.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Development HMR turns this on through `enableReloadStatePreservation()`. A runtime that registers later
|
|
111
|
+
* is told on registration, so production navigation never pays for it.
|
|
112
|
+
*/
|
|
113
|
+
enableReloadStatePreservation?: () => void;
|
|
98
114
|
};
|
|
99
115
|
/** Public browser-side navigation coordinator interface. */
|
|
100
116
|
export interface EcoNavigationRuntime {
|
|
@@ -130,6 +146,8 @@ export interface EcoNavigationRuntime {
|
|
|
130
146
|
reloadCurrentPage(request?: EcoReloadRequest): Promise<boolean>;
|
|
131
147
|
/** Runs a target runtime's cleanup hook before handoff. */
|
|
132
148
|
cleanupOwner(owner: EcoNavigationOwner): Promise<void>;
|
|
149
|
+
/** Asks every registered runtime, and each one that registers later, to preserve state on reloads. */
|
|
150
|
+
enableReloadStatePreservation(): void;
|
|
133
151
|
}
|
|
134
152
|
/**
|
|
135
153
|
* Reads the explicit browser document owner marker from a rendered HTML document.
|
|
@@ -39,6 +39,7 @@ function getCandidateOwners(currentOwner, registrations, excludedOwner) {
|
|
|
39
39
|
function createEcoNavigationRuntime() {
|
|
40
40
|
const registrations = new Map();
|
|
41
41
|
let owner = 'none';
|
|
42
|
+
let reloadStatePreservationEnabled = false;
|
|
42
43
|
let navigationSequence = 0;
|
|
43
44
|
let navigationAbortController = null;
|
|
44
45
|
const cancelNavigationTransaction = (navigationId, abortController) => {
|
|
@@ -75,6 +76,7 @@ function createEcoNavigationRuntime() {
|
|
|
75
76
|
id: navigationId,
|
|
76
77
|
signal: abortController.signal,
|
|
77
78
|
isCurrent: () => navigationSequence === navigationId && navigationAbortController === abortController,
|
|
79
|
+
isSuperseded: () => navigationSequence !== navigationId,
|
|
78
80
|
cancel: () => {
|
|
79
81
|
cancelNavigationTransaction(navigationId, abortController);
|
|
80
82
|
},
|
|
@@ -108,6 +110,9 @@ function createEcoNavigationRuntime() {
|
|
|
108
110
|
},
|
|
109
111
|
register(registration) {
|
|
110
112
|
registrations.set(registration.owner, registration);
|
|
113
|
+
if (reloadStatePreservationEnabled) {
|
|
114
|
+
registration.enableReloadStatePreservation?.();
|
|
115
|
+
}
|
|
111
116
|
return () => {
|
|
112
117
|
const currentRegistration = registrations.get(registration.owner);
|
|
113
118
|
if (currentRegistration !== registration) {
|
|
@@ -160,6 +165,15 @@ function createEcoNavigationRuntime() {
|
|
|
160
165
|
}
|
|
161
166
|
return false;
|
|
162
167
|
},
|
|
168
|
+
enableReloadStatePreservation() {
|
|
169
|
+
if (reloadStatePreservationEnabled) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
reloadStatePreservationEnabled = true;
|
|
173
|
+
for (const registration of registrations.values()) {
|
|
174
|
+
registration.enableReloadStatePreservation?.();
|
|
175
|
+
}
|
|
176
|
+
},
|
|
163
177
|
async cleanupOwner(targetOwner) {
|
|
164
178
|
if (targetOwner === 'none') {
|
|
165
179
|
return;
|
|
@@ -21,6 +21,16 @@ export interface EcoNavigationEvent {
|
|
|
21
21
|
}
|
|
22
22
|
/** Detail for the pre-commit lifecycle event. */
|
|
23
23
|
export interface EcoBeforeSwapEvent extends EcoNavigationEvent {
|
|
24
|
+
/**
|
|
25
|
+
* The parsed incoming document, which a listener may change before the swap.
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Browser-router inserts or replaces custom elements with the nodes of this document, so properties set on
|
|
29
|
+
* them and their descendants survive and the browser upgrades them when they connect. Elements the swap
|
|
30
|
+
* keeps in place, such as persisted elements, ignore properties set on their incoming counterpart. A
|
|
31
|
+
* property set before an element upgrades shadows a class accessor of the same name and is reset by a
|
|
32
|
+
* class field of that name.
|
|
33
|
+
*/
|
|
24
34
|
newDocument: Document;
|
|
25
35
|
reload: () => void;
|
|
26
36
|
}
|
|
@@ -37,7 +47,7 @@ export type DispatchBeforeSwapResult = {
|
|
|
37
47
|
requestedReload: boolean;
|
|
38
48
|
};
|
|
39
49
|
export type SchedulePageLoadOptions = {
|
|
40
|
-
|
|
50
|
+
isSuperseded?: () => boolean;
|
|
41
51
|
schedule?: (callback: FrameRequestCallback) => number;
|
|
42
52
|
};
|
|
43
53
|
/**
|
|
@@ -47,3 +57,10 @@ export declare function dispatchBeforeSwap(doc: Document, input: Omit<EcoBeforeS
|
|
|
47
57
|
export type CompleteNavigationLifecycleOptions = SchedulePageLoadOptions;
|
|
48
58
|
/** Dispatches `eco:after-swap` and schedules `eco:page-load`. */
|
|
49
59
|
export declare function completeNavigationLifecycle(doc: Document, detail: EcoNavigationEvent, options?: CompleteNavigationLifecycleOptions): void;
|
|
60
|
+
/**
|
|
61
|
+
* Schedules `eco:page-load` on the next animation frame unless a newer navigation replaced this one.
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* Supersession is not staleness: a navigation that completed normally still owes its page-load event.
|
|
65
|
+
*/
|
|
66
|
+
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>;
|