@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,13 +1,14 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { appLogger } from '../global/app-logger.js';
|
|
3
3
|
import { requireAppRuntime } from '../utils/app-runtime.js';
|
|
4
4
|
import { resolveBuildParallelism } from '../build/build-parallelism.js';
|
|
5
5
|
import { fileSystem } from '@ecopages/file-system';
|
|
6
6
|
import { CLIENT_OUTPUT_DIR } from '../utils/resolve-entry-file.js';
|
|
7
7
|
import { prepareExplicitStaticRender, resolveExplicitViewRenderer, } from '../route-renderer/explicit-view-render-preparation.js';
|
|
8
|
-
import { ensureIntegrationRuntimeReady, setupAppRuntimeIntegrations, teardownAppRuntimeIntegrations, } from '../build/app-build-manifest-runtime.js';
|
|
8
|
+
import { ensureIntegrationRuntimeReady, requireBrowserBuildGlobalScriptResolution, resolveIntegrationDependencies, setupAppRuntimeIntegrations, teardownAppRuntimeIntegrations, } from '../build/app-build-manifest-runtime.js';
|
|
9
9
|
import { emitProductionServerModules, shouldBuildPagesUnifiedGraph } from '../build/cache/pages-unified-graph-build.js';
|
|
10
|
-
import {
|
|
10
|
+
import { getImportedViewPaths } from '../build/server/imported-view-plugin.js';
|
|
11
|
+
import { clearProductionPageBrowserGraphSession, getPlannedRouteKey, prebuildProductionPageBrowserGraphs, shouldPrebuildProductionPageBrowserGraphs, } from './production-page-browser-graph-prebuild.js';
|
|
11
12
|
import { renderSitemap } from './sitemap.js';
|
|
12
13
|
import { resolveSitemapLocations } from './sitemap-routes.js';
|
|
13
14
|
import { toEcopagesRouteInfo } from '../utils/ecopages-route-info.js';
|
|
@@ -20,12 +21,18 @@ function createStaticGenerationPageError(route, error, label = 'static page') {
|
|
|
20
21
|
appLogger.error(`Error generating ${label} for ${route}:`, cause);
|
|
21
22
|
return new Error(`Failed to generate ${label} for ${route}`, { cause });
|
|
22
23
|
}
|
|
24
|
+
function describePlannedRoute(appConfig, routeInstance) {
|
|
25
|
+
const relativeFile = path.relative(appConfig.rootDir, routeInstance.routeFile);
|
|
26
|
+
const routeFile = relativeFile && !relativeFile.startsWith('..') ? relativeFile : routeInstance.routeFile;
|
|
27
|
+
const params = routeInstance.params && Object.keys(routeInstance.params).length > 0 ? routeInstance.params : undefined;
|
|
28
|
+
return params ? `${routeFile} ${JSON.stringify(params)}` : routeFile;
|
|
29
|
+
}
|
|
23
30
|
function throwStaticGenerationPageFailures(pageFailures, keepGoing) {
|
|
24
31
|
if (!keepGoing && pageFailures.length > 0) {
|
|
25
32
|
throw new AggregateError(pageFailures, `Failed to generate ${pageFailures.length} static page(s)`);
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
function
|
|
35
|
+
function clearProductionAssetLedgerOnFailure(appConfig, generationFailed) {
|
|
29
36
|
if (generationFailed && shouldPrebuildProductionPageBrowserGraphs()) {
|
|
30
37
|
clearProductionPageBrowserGraphSession(appConfig);
|
|
31
38
|
}
|
|
@@ -72,15 +79,9 @@ export class StaticSiteGenerator {
|
|
|
72
79
|
return (this.appConfig.absolutePaths?.distDir ??
|
|
73
80
|
path.join(this.appConfig.rootDir, this.appConfig.distDir, CLIENT_OUTPUT_DIR));
|
|
74
81
|
}
|
|
75
|
-
async shouldSkipStaticPageFile(filePath,
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const Page = pageModule.default;
|
|
79
|
-
if (Page.cache !== 'dynamic') {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
renderer.clearPrebuiltRoutePreparation?.({ file: filePath, params });
|
|
83
|
-
return true;
|
|
82
|
+
async shouldSkipStaticPageFile(filePath, routeRendererFactory) {
|
|
83
|
+
const pageModule = await routeRendererFactory.getPageRenderer(filePath).loadPageModule(filePath);
|
|
84
|
+
return pageModule.default.cache === 'dynamic';
|
|
84
85
|
}
|
|
85
86
|
shouldSkipStaticView(_routePath, view) {
|
|
86
87
|
return view.cache === 'dynamic';
|
|
@@ -109,33 +110,18 @@ export class StaticSiteGenerator {
|
|
|
109
110
|
fileSystem.ensureDir(this.getExportDir());
|
|
110
111
|
fileSystem.write(path.join(this.getExportDir(), fileName), renderSitemap(locations));
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*/
|
|
115
|
-
getDirectories(routes) {
|
|
116
|
-
const directories = new Set();
|
|
117
|
-
for (const route of routes) {
|
|
118
|
-
const path = route.startsWith('http') ? new URL(route).pathname : route;
|
|
119
|
-
const segments = path.split('/');
|
|
120
|
-
if (segments.length > 2) {
|
|
121
|
-
directories.add(segments.slice(0, segments.length - 1).join('/'));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return Array.from(directories);
|
|
125
|
-
}
|
|
126
|
-
writeStaticOutput(routePath, contents, directories = []) {
|
|
127
|
-
const outputPath = this.getOutputPath(routePath, directories);
|
|
113
|
+
writeStaticOutput(routePath, contents, sourceFile) {
|
|
114
|
+
const outputPath = this.getOutputPath(routePath, sourceFile);
|
|
128
115
|
fileSystem.ensureDir(path.dirname(outputPath));
|
|
129
116
|
fileSystem.write(outputPath, contents);
|
|
130
117
|
return outputPath;
|
|
131
118
|
}
|
|
132
119
|
async writeStaticPageArtifact(options) {
|
|
133
|
-
const directories = options.directories ?? this.getDirectories([options.pathname]);
|
|
134
120
|
const contents = await options.createContents();
|
|
135
121
|
if (contents === null) {
|
|
136
122
|
return;
|
|
137
123
|
}
|
|
138
|
-
this.writeStaticOutput(options.pathname, contents,
|
|
124
|
+
this.writeStaticOutput(options.pathname, contents, options.sourceFile);
|
|
139
125
|
options.activeStaticPathnames?.add(options.pathname);
|
|
140
126
|
await options.onSuccessfulExport?.();
|
|
141
127
|
}
|
|
@@ -167,7 +153,13 @@ export class StaticSiteGenerator {
|
|
|
167
153
|
if (!routeRendererFactory) {
|
|
168
154
|
throw new Error(STATIC_SITE_GENERATOR_ERRORS.ROUTE_RENDERER_FACTORY_REQUIRED);
|
|
169
155
|
}
|
|
170
|
-
|
|
156
|
+
const planKey = getPlannedRouteKey({ routeFile: filePath, params });
|
|
157
|
+
if (input.routePlans?.failed.has(planKey)) {
|
|
158
|
+
throw input.routePlans.failed.get(planKey);
|
|
159
|
+
}
|
|
160
|
+
const planned = input.routePlans?.preparations.get(planKey);
|
|
161
|
+
input.routePlans?.preparations.delete(planKey);
|
|
162
|
+
if (await this.shouldSkipStaticPageFile(filePath, routeRendererFactory)) {
|
|
171
163
|
skipped?.push(filePath);
|
|
172
164
|
return null;
|
|
173
165
|
}
|
|
@@ -175,7 +167,7 @@ export class StaticSiteGenerator {
|
|
|
175
167
|
const result = await renderer.execute({
|
|
176
168
|
file: filePath,
|
|
177
169
|
params: params,
|
|
178
|
-
});
|
|
170
|
+
}, planned);
|
|
179
171
|
const body = result.body;
|
|
180
172
|
if (typeof body === 'string' || Buffer.isBuffer(body)) {
|
|
181
173
|
return { body, metadata: result.metadata };
|
|
@@ -195,14 +187,13 @@ export class StaticSiteGenerator {
|
|
|
195
187
|
const { router, baseUrl, routeRendererFactory, skipped, activeStaticPathnames, sitemapEligiblePathnames } = input;
|
|
196
188
|
const routes = input.preloadedRoutes ?? (await router.listStaticGenerationRoutes({ runtimeOrigin: baseUrl }));
|
|
197
189
|
appLogger.debug('Static Pages', routes.map((route) => route.requestUrl));
|
|
198
|
-
const directories = this.getDirectories(routes.map((route) => route.requestUrl));
|
|
199
190
|
const failures = input.failures ?? [];
|
|
200
191
|
await runWithConcurrency(routes, resolveBuildParallelism(), async (route) => {
|
|
201
192
|
try {
|
|
202
193
|
let renderedMetadata;
|
|
203
194
|
await this.writeStaticPageArtifact({
|
|
204
195
|
pathname: route.pathname,
|
|
205
|
-
|
|
196
|
+
sourceFile: route.templateRoute.filePath,
|
|
206
197
|
activeStaticPathnames,
|
|
207
198
|
onSuccessfulExport: () => this.considerSitemapEligibility({
|
|
208
199
|
pathname: route.pathname,
|
|
@@ -219,6 +210,7 @@ export class StaticSiteGenerator {
|
|
|
219
210
|
route,
|
|
220
211
|
routeRendererFactory,
|
|
221
212
|
skipped,
|
|
213
|
+
routePlans: input.routePlans,
|
|
222
214
|
});
|
|
223
215
|
renderedMetadata = rendered?.metadata;
|
|
224
216
|
return rendered?.body ?? null;
|
|
@@ -250,10 +242,7 @@ export class StaticSiteGenerator {
|
|
|
250
242
|
for (const integration of this.appConfig.integrations) {
|
|
251
243
|
if (!integration.staticExport)
|
|
252
244
|
continue;
|
|
253
|
-
await ensureIntegrationRuntimeReady({
|
|
254
|
-
appConfig: this.appConfig,
|
|
255
|
-
integrationName: integration.name,
|
|
256
|
-
});
|
|
245
|
+
await ensureIntegrationRuntimeReady({ appConfig: this.appConfig, integrationName: integration.name });
|
|
257
246
|
const release = await integration.staticExport(context);
|
|
258
247
|
if (release) {
|
|
259
248
|
releases.push(release);
|
|
@@ -298,6 +287,29 @@ export class StaticSiteGenerator {
|
|
|
298
287
|
errorPageLoaders: input.errorPageLoaders,
|
|
299
288
|
});
|
|
300
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Records a route instance the production build could not plan.
|
|
292
|
+
*
|
|
293
|
+
* @remarks
|
|
294
|
+
* A Page static export renders keeps the error, so export reports it under the Page's URL without running its
|
|
295
|
+
* data hooks again. Any other concrete instance, such as a Dynamic Page entry or an `app.static` route, is a page
|
|
296
|
+
* failure that fails the build unless it keeps going. A route template or an imported view is planned without
|
|
297
|
+
* the props a request supplies, so its failure is a warning: `ecopages start` then fails the requests that need
|
|
298
|
+
* a dependency only that plan would have recorded.
|
|
299
|
+
*/
|
|
300
|
+
reportRoutePlanFailure(routeInstance, error, context) {
|
|
301
|
+
const planKey = getPlannedRouteKey(routeInstance);
|
|
302
|
+
if (context.exportedRouteKeys.has(planKey)) {
|
|
303
|
+
context.routePlans.failed.set(planKey, error);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const route = describePlannedRoute(this.appConfig, routeInstance);
|
|
307
|
+
if (routeInstance.isRouteTemplate) {
|
|
308
|
+
appLogger.warn(`Could not plan ${route} without request props; \`ecopages start\` fails requests that need a dependency only it declares.`, error instanceof Error ? error.message : String(error));
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
context.pageFailures.push(createStaticGenerationPageError(route, error, 'route plan'));
|
|
312
|
+
}
|
|
301
313
|
async executeStaticGenerationBody(input) {
|
|
302
314
|
const explicitStaticRoutes = input.staticRoutes && input.routeRendererFactory
|
|
303
315
|
? await this.prepareExplicitStaticRoutes({
|
|
@@ -307,14 +319,25 @@ export class StaticSiteGenerator {
|
|
|
307
319
|
failures: input.pageFailures,
|
|
308
320
|
})
|
|
309
321
|
: [];
|
|
322
|
+
const routePlans = { preparations: new Map(), failed: new Map() };
|
|
310
323
|
if (shouldPrebuildProductionPageBrowserGraphs() && input.routeRendererFactory) {
|
|
311
|
-
const dynamicRouteTemplates = (input.router.templateRoutes ?? [])
|
|
312
|
-
.filter((route) => route.kind !== 'exact' && route.role === 'page')
|
|
313
|
-
.map((route) => ({ routeFile: route.filePath, skipStaticProps: true, isRouteTemplate: true }));
|
|
314
324
|
const dynamicPageEntries = (await input.router.listDynamicPagePathExpansions?.({
|
|
315
325
|
runtimeOrigin: input.baseUrl,
|
|
316
326
|
})) ?? [];
|
|
317
|
-
|
|
327
|
+
const expandedRouteFiles = new Set([
|
|
328
|
+
...input.routes.map((route) => route.templateRoute.filePath),
|
|
329
|
+
...dynamicPageEntries.map((route) => route.templateRoute.filePath),
|
|
330
|
+
]);
|
|
331
|
+
const dynamicRouteTemplates = (input.router.templateRoutes ?? [])
|
|
332
|
+
.filter((route) => route.kind !== 'exact' && route.role === 'page' && !expandedRouteFiles.has(route.filePath))
|
|
333
|
+
.map((route) => ({ routeFile: route.filePath, skipStaticProps: true, isRouteTemplate: true }));
|
|
334
|
+
const importedViews = getImportedViewPaths(this.appConfig).map((routeFile) => ({
|
|
335
|
+
routeFile,
|
|
336
|
+
skipStaticProps: true,
|
|
337
|
+
isRouteTemplate: true,
|
|
338
|
+
}));
|
|
339
|
+
const exportedRouteKeys = new Set(input.routes.map((route) => getPlannedRouteKey({ routeFile: route.templateRoute.filePath, params: route.params })));
|
|
340
|
+
routePlans.preparations = await prebuildProductionPageBrowserGraphs(this.appConfig, [
|
|
318
341
|
...input.routes.map((route) => ({
|
|
319
342
|
routeFile: route.templateRoute.filePath,
|
|
320
343
|
params: route.params,
|
|
@@ -324,8 +347,18 @@ export class StaticSiteGenerator {
|
|
|
324
347
|
params: route.params,
|
|
325
348
|
})),
|
|
326
349
|
...dynamicRouteTemplates,
|
|
350
|
+
...importedViews,
|
|
327
351
|
...explicitStaticRoutes.flatMap(({ routeFile, routeEntries }) => routeFile ? routeEntries.map(({ params }) => ({ routeFile, params })) : []),
|
|
328
|
-
], input.routeRendererFactory
|
|
352
|
+
], input.routeRendererFactory, {
|
|
353
|
+
onRouteFailure: (routeInstance, error) => this.reportRoutePlanFailure(routeInstance, error, {
|
|
354
|
+
exportedRouteKeys,
|
|
355
|
+
routePlans,
|
|
356
|
+
pageFailures: input.pageFailures,
|
|
357
|
+
}),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
await resolveIntegrationDependencies({ appConfig: this.appConfig });
|
|
329
362
|
}
|
|
330
363
|
this.generateRobotsTxt();
|
|
331
364
|
const semanticErrorPathnames = new Set(SEMANTIC_ERROR_PAGE_PATHNAMES);
|
|
@@ -339,6 +372,7 @@ export class StaticSiteGenerator {
|
|
|
339
372
|
activeStaticPathnames: input.activeStaticPathnames,
|
|
340
373
|
preloadedRoutes: pageRoutes,
|
|
341
374
|
sitemapEligiblePathnames: input.sitemapEligiblePathnames,
|
|
375
|
+
routePlans,
|
|
342
376
|
});
|
|
343
377
|
if (explicitStaticRoutes.length > 0 && input.routeRendererFactory) {
|
|
344
378
|
await this.generateExplicitStaticPages({
|
|
@@ -359,12 +393,17 @@ export class StaticSiteGenerator {
|
|
|
359
393
|
writeArtifact: async (artifact) => await this.writeStaticPageArtifact(artifact),
|
|
360
394
|
}).export(input.activeStaticPathnames);
|
|
361
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* @remarks
|
|
398
|
+
* Sitemap locations use `appConfig.baseUrl` (config, `ECOPAGES_BASE_URL`, `--base-url`), the same canonical
|
|
399
|
+
* origin Pages resolve. The `baseUrl` passed to `run` is the serve origin used to enumerate routes and is not public.
|
|
400
|
+
*/
|
|
362
401
|
finalizeStaticGenerationRun(input) {
|
|
363
402
|
if (this.appConfig.sitemap?.enabled && input.sitemapEligiblePathnames) {
|
|
364
403
|
const locations = resolveSitemapLocations({
|
|
365
404
|
eligiblePathnames: [...input.sitemapEligiblePathnames],
|
|
366
405
|
sitemap: this.appConfig.sitemap,
|
|
367
|
-
baseUrl:
|
|
406
|
+
baseUrl: this.appConfig.baseUrl,
|
|
368
407
|
});
|
|
369
408
|
this.generateSitemap(locations, this.appConfig.sitemap);
|
|
370
409
|
}
|
|
@@ -380,7 +419,9 @@ export class StaticSiteGenerator {
|
|
|
380
419
|
const pageFailures = [];
|
|
381
420
|
const activeStaticPathnames = new Set();
|
|
382
421
|
const sitemapEligiblePathnames = this.appConfig.sitemap?.enabled ? new Set() : undefined;
|
|
422
|
+
requireBrowserBuildGlobalScriptResolution(this.appConfig);
|
|
383
423
|
this.resetStaticGenerationState(force);
|
|
424
|
+
requireAppRuntime(this.appConfig).staticGenerationActive = true;
|
|
384
425
|
let releases = [];
|
|
385
426
|
let generationFailed = false;
|
|
386
427
|
let generationError;
|
|
@@ -424,7 +465,6 @@ export class StaticSiteGenerator {
|
|
|
424
465
|
throw error;
|
|
425
466
|
}
|
|
426
467
|
this.finalizeStaticGenerationRun({
|
|
427
|
-
baseUrl,
|
|
428
468
|
skippedDynamicPages,
|
|
429
469
|
sitemapEligiblePathnames,
|
|
430
470
|
});
|
|
@@ -434,7 +474,8 @@ export class StaticSiteGenerator {
|
|
|
434
474
|
generationFailed = true;
|
|
435
475
|
generationError = error;
|
|
436
476
|
}
|
|
437
|
-
|
|
477
|
+
requireAppRuntime(this.appConfig).staticGenerationActive = false;
|
|
478
|
+
clearProductionAssetLedgerOnFailure(this.appConfig, generationFailed);
|
|
438
479
|
const cleanupErrors = [];
|
|
439
480
|
try {
|
|
440
481
|
await this.releaseStaticExports(releases);
|
|
@@ -582,18 +623,25 @@ export class StaticSiteGenerator {
|
|
|
582
623
|
}
|
|
583
624
|
/**
|
|
584
625
|
* Get the output file path for a given route.
|
|
626
|
+
*
|
|
627
|
+
* @remarks
|
|
628
|
+
* The path depends only on the route and its own source file, never on sibling Pages. `/` is `index.html`
|
|
629
|
+
* and a trailing-slash route is `<route>index.html`. Otherwise a Page whose source file is named `index`
|
|
630
|
+
* (`pages/blog/index.tsx`, also for a dynamic `[slug]/index.tsx`) writes `<route>/index.html`, and any other
|
|
631
|
+
* Page (`pages/blog.tsx`, `[slug].tsx`) writes `<route>.html`. Explicit static routes and semantic error
|
|
632
|
+
* pages have no filesystem source, so they write `<route>.html`. Static serving resolves both layouts.
|
|
585
633
|
*/
|
|
586
|
-
getOutputPath(routePath,
|
|
634
|
+
getOutputPath(routePath, sourceFile) {
|
|
587
635
|
let outputName;
|
|
588
636
|
if (routePath === '/') {
|
|
589
637
|
outputName = 'index.html';
|
|
590
638
|
}
|
|
591
|
-
else if (directories.includes(routePath)) {
|
|
592
|
-
outputName = `${routePath}/index.html`;
|
|
593
|
-
}
|
|
594
639
|
else if (routePath.endsWith('/')) {
|
|
595
640
|
outputName = `${routePath}index.html`;
|
|
596
641
|
}
|
|
642
|
+
else if (sourceFile && path.basename(sourceFile).split('.')[0] === 'index') {
|
|
643
|
+
outputName = `${routePath}/index.html`;
|
|
644
|
+
}
|
|
597
645
|
else {
|
|
598
646
|
outputName = `${routePath}.html`;
|
|
599
647
|
}
|
|
@@ -2,7 +2,7 @@ import type { EcoBuildPlugin } from './build-types.js';
|
|
|
2
2
|
export type AssetSource = 'content' | 'file' | 'node-module';
|
|
3
3
|
export type AssetKind = 'script' | 'stylesheet';
|
|
4
4
|
export type AssetPosition = 'head' | 'body';
|
|
5
|
-
export type AssetPackageRole = 'page-script' | 'page-style' | '
|
|
5
|
+
export type AssetPackageRole = 'page-script' | 'page-style' | 'keep-separate' | 'dynamic-chunk';
|
|
6
6
|
export type GroupedScriptBundle = {
|
|
7
7
|
id: string;
|
|
8
8
|
entryName: string;
|
|
@@ -13,6 +13,14 @@ export interface BaseAsset {
|
|
|
13
13
|
attributes?: Record<string, string>;
|
|
14
14
|
position?: AssetPosition;
|
|
15
15
|
packageRole?: AssetPackageRole;
|
|
16
|
+
/**
|
|
17
|
+
* The source files this asset was built or generated from.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* On a content script it marks a generated script, which imports these files by absolute path: its dependency
|
|
21
|
+
* key hashes its text with these files written relative to the app root, and its `name`, so a moved build
|
|
22
|
+
* still finds it.
|
|
23
|
+
*/
|
|
16
24
|
bundledSourceFilepaths?: string[];
|
|
17
25
|
}
|
|
18
26
|
export interface ScriptAsset extends BaseAsset {
|
|
@@ -87,6 +95,16 @@ export interface FileStylesheetAsset extends StylesheetAsset {
|
|
|
87
95
|
source: 'file';
|
|
88
96
|
filepath: string;
|
|
89
97
|
name?: string;
|
|
98
|
+
/**
|
|
99
|
+
* The package path, such as `some-lib/css/style.css`, of a stylesheet a package import named.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Processors do not transform it, a Page stylesheet bundle never merges it, and each file its relative
|
|
103
|
+
* `url()` references is emitted under a content hash with the reference rewritten to it. Its dependency key
|
|
104
|
+
* is this path, not `filepath`, so a reinstalled package, such as a pnpm store path after a version bump,
|
|
105
|
+
* keeps the key.
|
|
106
|
+
*/
|
|
107
|
+
fromPackage?: string;
|
|
90
108
|
}
|
|
91
109
|
export interface InlineFileStylesheetAsset extends FileStylesheetAsset {
|
|
92
110
|
inline: true;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How a module refers to the specifier being resolved.
|
|
3
|
-
*/
|
|
4
|
-
export type EcoBuildImportKind = 'import-statement' | 'dynamic-import' | 'require-call' | 'import-rule' | 'url-token' | 'new-url' | 'hot-accept';
|
|
5
1
|
/**
|
|
6
2
|
* Arguments passed to a build plugin `onResolve` callback.
|
|
7
3
|
*/
|
|
8
4
|
export type EcoBuildOnResolveArgs = {
|
|
9
5
|
path: string;
|
|
10
6
|
importer?: string;
|
|
11
|
-
namespace?: string;
|
|
12
|
-
/** Absent for an entry point. */
|
|
13
|
-
kind?: EcoBuildImportKind;
|
|
14
7
|
};
|
|
15
8
|
/**
|
|
16
9
|
* Result returned by a build plugin `onResolve` callback.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* A virtual module's `path` starts with `\0`, so no other plugin reads it as a file.
|
|
17
13
|
*/
|
|
18
14
|
export type EcoBuildOnResolveResult = {
|
|
19
15
|
path?: string;
|
|
20
|
-
namespace?: string;
|
|
21
16
|
external?: boolean;
|
|
22
17
|
};
|
|
23
18
|
/**
|
|
@@ -25,25 +20,39 @@ export type EcoBuildOnResolveResult = {
|
|
|
25
20
|
*/
|
|
26
21
|
export type EcoBuildOnLoadArgs = {
|
|
27
22
|
path: string;
|
|
28
|
-
namespace?: string;
|
|
29
23
|
};
|
|
30
24
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* `object` turns the result's `exports` into a module; the others compile `contents` as that language.
|
|
25
|
+
* Language the bundler compiles a loaded module's `contents` as.
|
|
35
26
|
*/
|
|
36
|
-
export type EcoBuildLoader = 'js' | 'jsx' | 'ts' | 'tsx'
|
|
27
|
+
export type EcoBuildLoader = 'js' | 'jsx' | 'ts' | 'tsx';
|
|
37
28
|
/**
|
|
38
29
|
* Result returned by a build plugin `onLoad` callback.
|
|
39
30
|
*/
|
|
40
31
|
export type EcoBuildOnLoadResult = {
|
|
41
32
|
contents?: string | Uint8Array;
|
|
42
33
|
loader?: EcoBuildLoader;
|
|
43
|
-
exports?: Record<string, unknown>;
|
|
44
34
|
/** Source map for the loaded contents, when the loader rewrites source. */
|
|
45
35
|
map?: unknown;
|
|
46
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* A module id the bundler resolved a specifier to.
|
|
39
|
+
*/
|
|
40
|
+
export type EcoBuildResolvedId = {
|
|
41
|
+
id: string;
|
|
42
|
+
/** Whether the build leaves the module out of its output. */
|
|
43
|
+
external: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Module ids a build plugin handler runs for.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* The bundler tests both patterns itself, so an id they rule out never reaches the callback. Ids use `/`
|
|
50
|
+
* separators on every platform, so `exclude: /\/node_modules\//` skips installed packages everywhere.
|
|
51
|
+
*/
|
|
52
|
+
export type EcoBuildFilter = {
|
|
53
|
+
filter: RegExp;
|
|
54
|
+
exclude?: RegExp;
|
|
55
|
+
};
|
|
47
56
|
/**
|
|
48
57
|
* Result returned by a build plugin `transform` callback.
|
|
49
58
|
*/
|
|
@@ -61,14 +70,9 @@ export type EcoBuildOnTransformResult = {
|
|
|
61
70
|
export interface EcoBuildPluginBuilder {
|
|
62
71
|
/** Entry names and source paths passed to this build request. */
|
|
63
72
|
entrypoints?: Readonly<Record<string, string>>;
|
|
64
|
-
onResolve(options:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}, callback: (args: EcoBuildOnResolveArgs) => EcoBuildOnResolveResult | undefined | Promise<EcoBuildOnResolveResult | undefined>): void;
|
|
68
|
-
onLoad(options: {
|
|
69
|
-
filter: RegExp;
|
|
70
|
-
namespace?: string;
|
|
71
|
-
}, callback: (args: EcoBuildOnLoadArgs) => EcoBuildOnLoadResult | undefined | Promise<EcoBuildOnLoadResult | undefined>): void;
|
|
73
|
+
onResolve(options: EcoBuildFilter, callback: (args: EcoBuildOnResolveArgs) => EcoBuildOnResolveResult | undefined | Promise<EcoBuildOnResolveResult | undefined>): void;
|
|
74
|
+
onLoad(options: EcoBuildFilter, callback: (args: EcoBuildOnLoadArgs) => EcoBuildOnLoadResult | undefined | Promise<EcoBuildOnLoadResult | undefined>): void;
|
|
75
|
+
/** Serves `specifier` as a virtual module whose source `callback` returns. */
|
|
72
76
|
module(specifier: string, callback: () => EcoBuildOnLoadResult | Promise<EcoBuildOnLoadResult>): void;
|
|
73
77
|
/**
|
|
74
78
|
* Registers a source rewrite that runs after `load`.
|
|
@@ -77,9 +81,29 @@ export interface EcoBuildPluginBuilder {
|
|
|
77
81
|
* Prefer this over `onLoad` when the plugin only rewrites module source, so
|
|
78
82
|
* it still runs on first-wins load results and can return a source map.
|
|
79
83
|
*/
|
|
80
|
-
transform(options:
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
transform(options: EcoBuildFilter, callback: (code: string, id: string) => EcoBuildOnTransformResult | string | undefined | Promise<EcoBuildOnTransformResult | string | undefined>): void;
|
|
85
|
+
/**
|
|
86
|
+
* Registers a check that runs once every module of the build is transformed.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* It does not run when the build already failed. A thrown error fails the build.
|
|
90
|
+
*/
|
|
91
|
+
onEnd(callback: () => void | Promise<void>): void;
|
|
92
|
+
/**
|
|
93
|
+
* Declares a file the running `onLoad` or `transform` callback read, so an edit to it rebuilds that module.
|
|
94
|
+
*
|
|
95
|
+
* @remarks
|
|
96
|
+
* The file joins the dependencies of every entry whose graph holds the module, which is what caches
|
|
97
|
+
* and the development watcher invalidate on. A call outside those callbacks throws.
|
|
98
|
+
*/
|
|
99
|
+
addWatchFile(filePath: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resolves `specifier` from `importer` the way the build does, through the other plugins and the bundler.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* Returns `undefined` when nothing resolves it. A call outside an `onLoad` or `transform` callback throws.
|
|
105
|
+
*/
|
|
106
|
+
resolve(specifier: string, importer: string): Promise<EcoBuildResolvedId | undefined>;
|
|
83
107
|
}
|
|
84
108
|
/**
|
|
85
109
|
* Runtime-agnostic build plugin contract consumed by Ecopages processors/loaders.
|
|
@@ -96,15 +120,9 @@ export type EcoBuildPlugin = {
|
|
|
96
120
|
* A build request is identified by its plugins' names in order, so builds that differ only in the options
|
|
97
121
|
* a factory captured would otherwise share an identity, and with it a deduplicated build or a reused
|
|
98
122
|
* artifact. A factory that captures an option which changes its output sets this to a string of that option.
|
|
123
|
+
* The dependency key of a script that declares the plugin in `bundleOptions` includes it too, so the
|
|
124
|
+
* processed-asset cache keeps such scripts apart. It must hold no absolute path: name a file relative to the
|
|
125
|
+
* app root instead, or the production ledger misses every such script once the build moves.
|
|
99
126
|
*/
|
|
100
127
|
cacheKey?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Allows entry-specific plugin instances to share a browser build with matching group keys.
|
|
103
|
-
*
|
|
104
|
-
* @remarks
|
|
105
|
-
* Instances remain in the build so each can contribute its own entry configuration. Plugins with the same name
|
|
106
|
-
* must use the same key and position relative to other plugins to share a build; entries that omit the plugin may
|
|
107
|
-
* still join that build.
|
|
108
|
-
*/
|
|
109
|
-
bundleGroupKey?: string;
|
|
110
128
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/** Stable attribution for a Component created by an Integration-owned module. */
|
|
2
2
|
export type ComponentIdentity = {
|
|
3
3
|
id: string;
|
|
4
|
+
/**
|
|
5
|
+
* Source file of the declaring module, relative to the app root with forward slashes (`src/components/x.tsx`,
|
|
6
|
+
* `../` for a linked workspace package), as the component meta transform writes it.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Consumers resolve it against `appConfig.rootDir`, so an emitted module names no path of the machine that
|
|
10
|
+
* built it. A runtime-created identity may hold an absolute path, which resolves to itself.
|
|
11
|
+
*/
|
|
4
12
|
file: string;
|
|
5
13
|
integration: string;
|
|
6
14
|
};
|