@ecopages/core 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -143
- package/package.json +16 -3
- package/src/adapters/node/dev-session.js +2 -1
- package/src/adapters/node/node-client-bridge.d.ts +5 -7
- package/src/adapters/node/node-client-bridge.js +4 -14
- package/src/adapters/node/server-adapter.d.ts +4 -2
- package/src/adapters/node/server-adapter.js +13 -12
- package/src/adapters/shared/hmr/client-bridge.d.ts +25 -0
- package/src/adapters/shared/hmr/client-bridge.js +35 -0
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +1 -1
- package/src/adapters/shared/hmr/hmr-manager.d.ts +9 -2
- package/src/adapters/shared/hmr/hmr-manager.js +36 -6
- package/src/adapters/shared/http/dist-file-handler.js +3 -7
- package/src/adapters/shared/http/response-headers.d.ts +29 -0
- package/src/adapters/shared/http/response-headers.js +89 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +3 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +4 -3
- package/src/adapters/shared/runtime/server-request-pipeline.js +4 -4
- package/src/adapters/shared/runtime/server-static-builder.d.ts +19 -8
- package/src/adapters/shared/runtime/server-static-builder.js +23 -4
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +1 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +23 -16
- package/src/assets/app-browser-client-build.d.ts +5 -12
- package/src/assets/app-browser-client-build.js +121 -336
- package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +4 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.js +6 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +28 -8
- package/src/assets/asset-processing-service/asset-dependency-keys.js +104 -29
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +60 -2
- package/src/assets/asset-processing-service/asset-processing.service.js +189 -58
- package/src/assets/asset-processing-service/bundleable-script.d.ts +3 -0
- package/src/assets/asset-processing-service/bundleable-script.js +4 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -2
- package/src/assets/asset-processing-service/grouped-content-bundles.js +5 -10
- package/src/assets/asset-processing-service/index.d.ts +0 -3
- package/src/assets/asset-processing-service/index.js +0 -3
- package/src/assets/asset-processing-service/last-good-output.d.ts +21 -0
- package/src/assets/asset-processing-service/last-good-output.js +32 -0
- package/src/assets/asset-processing-service/page-package.js +1 -4
- package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +63 -0
- package/src/assets/asset-processing-service/processed-asset-ledger.js +101 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/base/base-script-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +24 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.js +59 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +18 -6
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +2 -3
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.d.ts +34 -0
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.js +115 -0
- package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -2
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.d.ts +39 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.js +150 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.d.ts +84 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.js +379 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +16 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +50 -24
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.d.ts +33 -0
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.js +67 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.d.ts +44 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.js +149 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.d.ts +31 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.js +59 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.d.ts +20 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.js +51 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.d.ts +2 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js +5 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.d.ts +37 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.js +48 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +25 -1
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +56 -15
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.d.ts +9 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.js +21 -0
- package/src/assets/browser-asset-output.js +1 -1
- package/src/assets/hashed-browser-asset.js +1 -1
- package/src/assets/{browser-runtime-asset-page-cache.d.ts → page-script-page-cache.d.ts} +3 -3
- package/src/assets/{browser-runtime-asset-page-cache.js → page-script-page-cache.js} +3 -3
- package/src/build/app-build-manifest-runtime.d.ts +23 -11
- package/src/build/app-build-manifest-runtime.js +52 -13
- package/src/build/browser/jsx-ownership-plugins.d.ts +4 -1
- package/src/build/browser/jsx-ownership-plugins.js +6 -0
- package/src/build/build-adapter.d.ts +1 -1
- package/src/build/build-adapter.js +1 -1
- package/src/build/build-graph.d.ts +4 -2
- package/src/build/build-graph.js +12 -46
- package/src/build/cache/build-input-dependency-index.d.ts +0 -19
- package/src/build/cache/build-input-dependency-index.js +1 -34
- package/src/build/cache/pages-unified-graph-build.js +7 -43
- package/src/build/cache/server-module-entries.d.ts +1 -1
- package/src/build/cache/server-module-entries.js +9 -9
- package/src/build/contracts/build-contracts.d.ts +59 -12
- package/src/build/contracts/build-manifest.d.ts +3 -6
- package/src/build/contracts/build-manifest.js +2 -12
- package/src/build/contracts/content-virtual-modules.js +1 -3
- package/src/build/copy-server-files.js +1 -1
- package/src/build/preserve-import-meta-transform.d.ts +3 -1
- package/src/build/preserve-import-meta-transform.js +7 -4
- package/src/build/production-asset-ledger.d.ts +36 -0
- package/src/build/production-asset-ledger.js +104 -0
- package/src/build/production-dist-complete.js +12 -13
- package/src/build/production-route-list.js +1 -1
- package/src/build/rolldown/app-package-declarations.js +1 -1
- package/src/build/rolldown/entry-module-closures.d.ts +5 -1
- package/src/build/rolldown/entry-module-closures.js +21 -8
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +19 -8
- package/src/build/rolldown/rolldown-adapter-helpers.js +82 -45
- package/src/build/rolldown/rolldown-build-adapter.js +10 -13
- package/src/build/rolldown/rolldown-module-id.d.ts +18 -0
- package/src/build/rolldown/rolldown-module-id.js +29 -0
- package/src/build/rolldown/rolldown-plugin-bridge.d.ts +24 -60
- package/src/build/rolldown/rolldown-plugin-bridge.js +201 -373
- package/src/build/rolldown/stylesheet-module-plugin.d.ts +34 -0
- package/src/build/rolldown/stylesheet-module-plugin.js +160 -0
- package/src/build/rolldown/worker-entries-plugin.d.ts +13 -0
- package/src/build/rolldown/worker-entries-plugin.js +57 -0
- package/src/build/runtime/build-environment-options.js +13 -3
- package/src/build/runtime/build-request-identity.js +1 -1
- package/src/build/runtime/build-request-policy.d.ts +7 -12
- package/src/build/runtime/build-request-policy.js +63 -17
- package/src/build/server/imported-view-plugin.d.ts +1 -0
- package/src/build/server/imported-view-plugin.js +6 -4
- package/src/build/server/page-module-import.service.d.ts +1 -2
- package/src/build/server/page-module-import.service.js +4 -6
- package/src/build/server/resolve-static-view.js +3 -2
- package/src/build/server/route-module-build-cache-registry.js +1 -1
- package/src/build/server/route-module-build-cache.store.js +1 -1
- package/src/build/server/route-module-build-manifest.js +1 -1
- package/src/build/server/route-module-dependency-hasher.d.ts +1 -1
- package/src/build/server/route-module-dependency-hasher.js +2 -2
- package/src/build/server/server-modules-manifest.d.ts +3 -5
- package/src/build/server/server-modules-manifest.js +6 -21
- package/src/build/server/view-module.d.ts +12 -0
- package/src/build/server/view-module.js +23 -0
- package/src/build/server/view-reference.d.ts +16 -5
- package/src/build/server/view-reference.js +25 -14
- package/src/build/server-bundle-deploy-manifest.d.ts +1 -1
- package/src/build/server-bundle-deploy-manifest.js +2 -2
- package/src/build/server-bundle-publication.d.ts +7 -1
- package/src/build/server-bundle-publication.js +11 -4
- package/src/build/server-module.js +1 -1
- package/src/build/worker-urls.d.ts +60 -0
- package/src/build/worker-urls.js +197 -0
- package/src/build.d.ts +7 -5
- package/src/build.js +7 -5
- package/src/cache/module-parse-cache.js +2 -2
- package/src/client/navigation-attributes.d.ts +8 -0
- package/src/client/navigation-attributes.js +8 -0
- package/src/client/navigation-scripts/global-scripts.d.ts +14 -0
- package/src/client/navigation-scripts/global-scripts.js +65 -0
- package/src/client/navigation-scripts/index.d.ts +1 -0
- package/src/client/navigation-scripts/index.js +1 -0
- package/src/client.d.ts +2 -2
- package/src/client.js +2 -2
- package/src/config/assembly/app-runtime.d.ts +45 -5
- package/src/config/assembly/app-runtime.js +11 -2
- package/src/config/assembly/finalize-config.js +13 -5
- package/src/config/config-module-files.js +10 -6
- package/src/config/index.d.ts +2 -1
- package/src/config/internal-types.d.ts +3 -0
- package/src/config/load-eco-config.js +8 -5
- package/src/config/resolve-eco-config-path.js +3 -3
- package/src/config/server-config-bundle.js +1 -1
- package/src/config/user-config-types.d.ts +54 -1
- package/src/config/write-types.js +4 -1
- package/src/css-imports.d.ts +12 -0
- package/src/declarations.d.ts +2 -0
- package/src/dev/development-restart-watch-paths.js +1 -1
- package/src/dev/development-restart.js +1 -1
- package/src/dev/invalidation/development-invalidation.service.d.ts +6 -1
- package/src/dev/invalidation/development-invalidation.service.js +18 -2
- package/src/dev/stylesheets/development-stylesheet.service.d.ts +149 -0
- package/src/dev/stylesheets/development-stylesheet.service.js +350 -0
- package/src/dev/transform-server/dev-transform-bundler.d.ts +12 -3
- package/src/dev/transform-server/dev-transform-bundler.js +32 -21
- package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +3 -5
- package/src/dev/transform-server/dev-transform-externalize-plugin.js +8 -9
- package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +15 -2
- package/src/dev/transform-server/dev-transform-import-rewriter.js +204 -35
- package/src/dev/transform-server/dev-transform-install-stamp.d.ts +17 -0
- package/src/dev/transform-server/dev-transform-install-stamp.js +79 -0
- package/src/dev/transform-server/dev-transform-server.d.ts +38 -2
- package/src/dev/transform-server/dev-transform-server.js +96 -33
- package/src/dev/transform-server/dev-transform-url.d.ts +4 -2
- package/src/dev/transform-server/dev-transform-url.js +13 -12
- package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +178 -21
- package/src/dev/transform-server/dev-transform-vendor-registry.js +675 -99
- package/src/dev/transform-server/index.d.ts +1 -1
- package/src/dev-toolbar/dev-toolbar-package.js +4 -4
- package/src/eco/component-render-output.d.ts +6 -1
- package/src/eco/component-render-output.js +32 -7
- package/src/eco/discovered-dependencies.d.ts +30 -11
- package/src/eco/discovered-dependencies.js +25 -13
- package/src/eco/discovered-dependency-paths.d.ts +36 -0
- package/src/eco/discovered-dependency-paths.js +58 -0
- package/src/eco/eco.browser.js +8 -12
- package/src/eco/eco.js +0 -30
- package/src/eco/mdx-page-metadata.d.ts +14 -0
- package/src/eco/mdx-page-metadata.js +15 -0
- package/src/eco/page-layout-normalization.d.ts +6 -2
- package/src/eco/page-layout-normalization.js +9 -6
- package/src/env.js +17 -0
- package/src/hmr/client/hmr-runtime.js +14 -13
- package/src/hmr/dev-client-runtime.d.ts +5 -2
- package/src/hmr/dev-client-runtime.js +14 -4
- package/src/hmr/hmr-entrypoint-output.js +1 -1
- package/src/hmr/hmr-strategy.d.ts +2 -2
- package/src/hmr/hmr-strategy.js +2 -2
- package/src/hmr/strategies/js-hmr-strategy.d.ts +4 -1
- package/src/hmr/strategies/js-hmr-strategy.js +7 -6
- package/src/hmr/strategies/template-source-hmr-strategy.d.ts +25 -0
- package/src/hmr/strategies/template-source-hmr-strategy.js +36 -0
- package/src/html-pages/html-page-module-scripts.d.ts +2 -1
- package/src/html-pages/html-page-module-scripts.js +37 -14
- package/src/html-pages/html-page-module.js +1 -1
- package/src/html-pages/html-page-renderer.js +7 -6
- package/src/html-pages/html-page-template.d.ts +0 -5
- package/src/html-pages/html-page-template.js +3 -15
- package/src/html-pages/html-pages.plugin.js +2 -2
- package/src/integration.d.ts +8 -6
- package/src/integration.js +5 -3
- package/src/page-cache/html-page-cache-dependency-index.js +1 -1
- package/src/page-cache/page-cache-service.js +1 -1
- package/src/plugins/alias-resolver-plugin.d.ts +7 -0
- package/src/plugins/alias-resolver-plugin.js +16 -6
- package/src/plugins/component-import-discovery.d.ts +178 -7
- package/src/plugins/component-import-discovery.js +696 -112
- package/src/plugins/eco-component-meta-plugin.d.ts +47 -6
- package/src/plugins/eco-component-meta-plugin.js +227 -59
- package/src/plugins/foreign-jsx-override-plugin.d.ts +14 -1
- package/src/plugins/foreign-jsx-override-plugin.js +18 -8
- package/src/plugins/integration-plugin.d.ts +47 -11
- package/src/plugins/integration-plugin.js +57 -8
- package/src/plugins/processor.d.ts +72 -7
- package/src/plugins/processor.js +44 -9
- package/src/plugins/stylesheet-kinds.d.ts +57 -0
- package/src/plugins/stylesheet-kinds.js +114 -0
- package/src/plugins/tsconfig-import-resolver.d.ts +49 -3
- package/src/plugins/tsconfig-import-resolver.js +120 -6
- package/src/processor-contract.d.ts +66 -0
- package/src/processor-contract.js +389 -0
- package/src/processor.d.ts +6 -1
- package/src/processor.js +6 -1
- package/src/route-renderer/error-pages/default-error-pages.d.ts +1 -0
- package/src/route-renderer/error-pages/default-error-pages.js +27 -7
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +12 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +77 -24
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +97 -32
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +1 -1
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +9 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +16 -2
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.d.ts +35 -0
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js +53 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +4 -8
- package/src/route-renderer/orchestration/foreign-child/render-session.js +2 -5
- package/src/route-renderer/orchestration/integration-renderer.d.ts +171 -64
- package/src/route-renderer/orchestration/integration-renderer.js +293 -332
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +8 -5
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +27 -25
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +0 -6
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +3 -3
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +12 -25
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +1 -14
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +0 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -87
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +8 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +25 -271
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +0 -24
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +0 -67
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +28 -15
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +63 -41
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -1
- package/src/route-renderer/page-loading/component-dependency-collection.js +51 -15
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +10 -0
- package/src/route-renderer/page-loading/dependency-resolver.js +27 -6
- package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +4 -2
- package/src/route-renderer/page-loading/file-scoped-dependency-components.js +22 -17
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +5 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.js +6 -4
- package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +5 -2
- package/src/route-renderer/page-loading/page-dependency-bundling.js +15 -31
- package/src/route-renderer/page-loading/page-module-loader.d.ts +13 -2
- package/src/route-renderer/page-loading/page-module-loader.js +23 -5
- package/src/route-renderer/route-renderer.d.ts +1 -1
- package/src/router/client/navigation-commit.d.ts +2 -0
- package/src/router/client/navigation-commit.js +20 -3
- package/src/router/client/navigation-coordinator.d.ts +18 -0
- package/src/router/client/navigation-coordinator.js +14 -0
- package/src/router/client/navigation-head-order.fixture.css +3 -0
- package/src/router/client/navigation-head.d.ts +2 -1
- package/src/router/client/navigation-head.fixture.css +3 -0
- package/src/router/client/navigation-head.js +222 -39
- package/src/router/client/navigation-lifecycle.d.ts +8 -1
- package/src/router/client/navigation-lifecycle.js +6 -3
- package/src/router/client/navigation-pipeline.d.ts +1 -0
- package/src/router/client/navigation-pipeline.js +1 -0
- package/src/router/server/route-registry.d.ts +3 -2
- package/src/router/server/route-registry.js +6 -5
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +30 -18
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +82 -143
- package/src/static-site-generator/static-site-generator.d.ts +37 -4
- package/src/static-site-generator/static-site-generator.js +99 -51
- package/src/types/asset-types.d.ts +19 -1
- package/src/types/build-types.d.ts +53 -35
- package/src/types/component-identity.d.ts +8 -0
- package/src/types/contracts.d.ts +69 -21
- package/src/types/dev-transform-types.d.ts +33 -6
- package/src/types/eco-api-types.d.ts +13 -18
- package/src/types/integration-types.d.ts +1 -1
- package/src/types/public-types.d.ts +1 -1
- package/src/utils/additional-watch-paths.js +3 -5
- package/src/utils/entry-command-flags.d.ts +23 -0
- package/src/utils/entry-command-flags.js +24 -0
- package/src/utils/package-path.d.ts +42 -0
- package/src/utils/package-path.js +114 -0
- package/src/utils/parse-cli-args.d.ts +18 -1
- package/src/utils/parse-cli-args.js +54 -37
- package/src/utils/path-containment.js +3 -10
- package/src/utils/resolve-work-dir.js +2 -2
- package/src/utils/root-relative-path.js +2 -2
- package/src/utils/server-bundle-context.d.ts +5 -0
- package/src/utils/server-bundle-context.js +7 -1
- package/src/utils/server-utils.module.js +1 -1
- package/src/watchers/project-watcher-ignore.js +3 -3
- package/src/watchers/project-watcher.d.ts +14 -2
- package/src/watchers/project-watcher.js +37 -6
- package/src/watchers/workspace-package-watch-roots.js +2 -2
- package/src/assets/app-browser-client-manifest.d.ts +0 -66
- package/src/assets/app-browser-client-manifest.js +0 -260
- package/src/assets/asset-processing-service/asset-package-role.d.ts +0 -2
- package/src/assets/asset-processing-service/asset-package-role.js +0 -3
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +0 -58
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -61
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +0 -79
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +0 -200
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +0 -24
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -67
- package/src/build/browser/browser-runtime-manifest.d.ts +0 -35
- package/src/build/browser/browser-runtime-manifest.js +0 -65
- package/src/build/browser/browser-runtime-plugin-helpers.d.ts +0 -14
- package/src/build/browser/browser-runtime-plugin-helpers.js +0 -21
- package/src/build/browser/browser-runtime-plugin.d.ts +0 -54
- package/src/build/browser/browser-runtime-plugin.js +0 -76
- package/src/build/rolldown/server-side-css-shim-plugin.d.ts +0 -28
- package/src/build/rolldown/server-side-css-shim-plugin.js +0 -59
- package/src/dev/transform-server/dev-transform-module-kind.d.ts +0 -13
- package/src/dev/transform-server/dev-transform-module-kind.js +0 -17
- package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +0 -5
- package/src/dev/transform-server/dev-transform-runtime-specifiers.js +0 -16
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +0 -15
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +0 -65
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +0 -21
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +0 -31
package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
1
|
import type { EcoPagesAppConfig } from '../../../../config/internal-types.js';
|
|
2
|
-
|
|
2
|
+
import type { ProcessedStylesheet } from './processed-stylesheet-cache.js';
|
|
3
|
+
export type { ProcessedStylesheet } from './processed-stylesheet-cache.js';
|
|
4
|
+
/**
|
|
5
|
+
* Runs the registered stylesheet Processor over `content`, or returns it as written when none applies.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* An app has at most one stylesheet Processor (config finalization rejects a second), so there is no chain: a
|
|
9
|
+
* stylesheet reaches that Processor only when it is a `.css` file or has an extension the Processor declares,
|
|
10
|
+
* the Processor's capability filter matches it, and it implements `transformStylesheet`.
|
|
11
|
+
*
|
|
12
|
+
* Only the dependencies that are stylesheets are kept. A Processor that scans content, such as Tailwind, also reports
|
|
13
|
+
* every file it scanned; a change to one reaches the stylesheet through the Processor's `invalidateStylesheets` hook
|
|
14
|
+
* instead, so a content edit does not invalidate every Page and module that uses the stylesheet.
|
|
15
|
+
*
|
|
16
|
+
* A CSS Module (see `StylesheetKinds.isCssModule`) needs a Processor that declares `cssModules`, and the result then
|
|
17
|
+
* carries the `exports` the Processor returned: the class map, from the same transform as the scoped CSS. Without
|
|
18
|
+
* one the call rejects, so no environment can serve a CSS Module unscoped.
|
|
19
|
+
*
|
|
20
|
+
* After the Processor, the relative `@import`s it left are inlined (see {@link inlineStylesheetImports}), so plain CSS
|
|
21
|
+
* with no Processor works in a build. The partials count as dependencies, like those the Processor reports.
|
|
22
|
+
*
|
|
23
|
+
* The result goes through the app's processed stylesheet cache, so one edit runs the Processor once whichever path
|
|
24
|
+
* asks first (see `ProcessedStylesheetCache`). A config with no app runtime, as in a unit test, transforms each time.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyStylesheetProcessors(appConfig: EcoPagesAppConfig, content: string, filepath: string): Promise<ProcessedStylesheet>;
|
package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js
CHANGED
|
@@ -1,19 +1,60 @@
|
|
|
1
|
-
import path from '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
|
+
import { CSS_MODULE_PROCESSOR_FIX, findStylesheetProcessor, getStylesheetKinds, } from '../../../../plugins/stylesheet-kinds.js';
|
|
3
|
+
import { inlineStylesheetImports } from './app-stylesheet-imports.js';
|
|
4
|
+
/**
|
|
5
|
+
* Runs the registered stylesheet Processor over `content`, or returns it as written when none applies.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* An app has at most one stylesheet Processor (config finalization rejects a second), so there is no chain: a
|
|
9
|
+
* stylesheet reaches that Processor only when it is a `.css` file or has an extension the Processor declares,
|
|
10
|
+
* the Processor's capability filter matches it, and it implements `transformStylesheet`.
|
|
11
|
+
*
|
|
12
|
+
* Only the dependencies that are stylesheets are kept. A Processor that scans content, such as Tailwind, also reports
|
|
13
|
+
* every file it scanned; a change to one reaches the stylesheet through the Processor's `invalidateStylesheets` hook
|
|
14
|
+
* instead, so a content edit does not invalidate every Page and module that uses the stylesheet.
|
|
15
|
+
*
|
|
16
|
+
* A CSS Module (see `StylesheetKinds.isCssModule`) needs a Processor that declares `cssModules`, and the result then
|
|
17
|
+
* carries the `exports` the Processor returned: the class map, from the same transform as the scoped CSS. Without
|
|
18
|
+
* one the call rejects, so no environment can serve a CSS Module unscoped.
|
|
19
|
+
*
|
|
20
|
+
* After the Processor, the relative `@import`s it left are inlined (see {@link inlineStylesheetImports}), so plain CSS
|
|
21
|
+
* with no Processor works in a build. The partials count as dependencies, like those the Processor reports.
|
|
22
|
+
*
|
|
23
|
+
* The result goes through the app's processed stylesheet cache, so one edit runs the Processor once whichever path
|
|
24
|
+
* asks first (see `ProcessedStylesheetCache`). A config with no app runtime, as in a unit test, transforms each time.
|
|
25
|
+
*/
|
|
6
26
|
export async function applyStylesheetProcessors(appConfig, content, filepath) {
|
|
7
|
-
|
|
8
|
-
|
|
27
|
+
const kinds = getStylesheetKinds(appConfig);
|
|
28
|
+
if (!kinds.isStylesheet(filepath)) {
|
|
29
|
+
return { css: content, dependencies: [] };
|
|
9
30
|
}
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
31
|
+
const processor = findStylesheetProcessor(appConfig.processors?.values() ?? []);
|
|
32
|
+
const transformStylesheet = processor?.transformStylesheet && processor.canProcessAsset('stylesheet', filepath)
|
|
33
|
+
? processor.transformStylesheet.bind(processor)
|
|
34
|
+
: undefined;
|
|
35
|
+
const isCssModule = kinds.isCssModule(filepath);
|
|
36
|
+
if (isCssModule && (!kinds.scopesCssModules || !transformStylesheet)) {
|
|
37
|
+
throw new Error(`[ecopages] ${filepath} is a CSS Module. ${CSS_MODULE_PROCESSOR_FIX}`);
|
|
17
38
|
}
|
|
18
|
-
|
|
39
|
+
if (!transformStylesheet && !/@import/i.test(content)) {
|
|
40
|
+
return { css: content, dependencies: [] };
|
|
41
|
+
}
|
|
42
|
+
const self = path.resolve(filepath);
|
|
43
|
+
const process = async () => {
|
|
44
|
+
const transformed = transformStylesheet ? await transformStylesheet(content, filepath) : { css: content };
|
|
45
|
+
if (isCssModule && !transformed.exports) {
|
|
46
|
+
throw new Error(`[ecopages] ${filepath} is a CSS Module, but Processor "${processor?.name}" returned no exports for it.`);
|
|
47
|
+
}
|
|
48
|
+
const inlined = inlineStylesheetImports(transformed.css, filepath);
|
|
49
|
+
const dependencies = new Set([...(transformed.dependencies ?? []), ...inlined.dependencies]
|
|
50
|
+
.map((dependency) => path.resolve(dependency))
|
|
51
|
+
.filter((dependency) => dependency !== self && kinds.isStylesheet(dependency)));
|
|
52
|
+
return {
|
|
53
|
+
css: inlined.css,
|
|
54
|
+
dependencies: [...dependencies],
|
|
55
|
+
...(isCssModule ? { exports: transformed.exports } : {}),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const cache = appConfig.appRuntime?.processedStylesheets;
|
|
59
|
+
return cache ? cache.get(filepath, content, process) : process();
|
|
19
60
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs a stylesheet warning once per stylesheet and message while its `source` is unchanged.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* A stylesheet goes through several processing passes: once per Page that links it, linked and inlined, and by
|
|
6
|
+
* the build loader, so a single missing reference would otherwise log once per pass. An edit changes `source`,
|
|
7
|
+
* which clears what was logged for the stylesheet, so a warning that is still true after a save is shown again.
|
|
8
|
+
*/
|
|
9
|
+
export declare function warnStylesheetOnce(stylesheet: string, source: string, message: string, warn: (message: string) => void): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const seen = new Map();
|
|
2
|
+
/**
|
|
3
|
+
* Logs a stylesheet warning once per stylesheet and message while its `source` is unchanged.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* A stylesheet goes through several processing passes: once per Page that links it, linked and inlined, and by
|
|
7
|
+
* the build loader, so a single missing reference would otherwise log once per pass. An edit changes `source`,
|
|
8
|
+
* which clears what was logged for the stylesheet, so a warning that is still true after a save is shown again.
|
|
9
|
+
*/
|
|
10
|
+
export function warnStylesheetOnce(stylesheet, source, message, warn) {
|
|
11
|
+
let entry = seen.get(stylesheet);
|
|
12
|
+
if (!entry || entry.source !== source) {
|
|
13
|
+
entry = { source, messages: new Set() };
|
|
14
|
+
seen.set(stylesheet, entry);
|
|
15
|
+
}
|
|
16
|
+
if (entry.messages.has(message)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
entry.messages.add(message);
|
|
20
|
+
warn(message);
|
|
21
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { contentHash } from '../utils/content-hash.js';
|
|
2
|
-
import path from '
|
|
2
|
+
import { path } from '@ecopages/file-system/path';
|
|
3
3
|
import { fileSystem } from '@ecopages/file-system';
|
|
4
4
|
const HASH_LENGTH = 16;
|
|
5
5
|
export const HASHED_BROWSER_ASSET_INDEX_FILENAME = '.ecopages-hashed-assets';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { EcoPagesAppConfig } from '../config/internal-types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Clears the rendered HTML cache after a
|
|
3
|
+
* Clears the rendered HTML cache after a page script asset changed its file path.
|
|
4
4
|
*
|
|
5
5
|
* @remarks
|
|
6
6
|
* Cached development documents hold the old script URLs, so every entry is dropped instead of keyed by a
|
|
7
7
|
* generation. This currently reaches from the Build layer into rendered-page cache state; #556 tracks
|
|
8
8
|
* moving invalidation behind a lower-level cache contract. Only call this when a previously cached
|
|
9
|
-
*
|
|
9
|
+
* page-script asset filepath changes. First inserts must not clear the cache or cold start thrashes it.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function clearPageCacheForPageScriptChange(appConfig: EcoPagesAppConfig): Promise<void>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { clearAppPageCache } from '../page-cache/page-cache-service.js';
|
|
2
2
|
import { isDevelopmentRuntime } from '../utils/runtime.js';
|
|
3
3
|
/**
|
|
4
|
-
* Clears the rendered HTML cache after a
|
|
4
|
+
* Clears the rendered HTML cache after a page script asset changed its file path.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* Cached development documents hold the old script URLs, so every entry is dropped instead of keyed by a
|
|
8
8
|
* generation. This currently reaches from the Build layer into rendered-page cache state; #556 tracks
|
|
9
9
|
* moving invalidation behind a lower-level cache contract. Only call this when a previously cached
|
|
10
|
-
*
|
|
10
|
+
* page-script asset filepath changes. First inserts must not clear the cache or cold start thrashes it.
|
|
11
11
|
*/
|
|
12
|
-
export async function
|
|
12
|
+
export async function clearPageCacheForPageScriptChange(appConfig) {
|
|
13
13
|
if (!isDevelopmentRuntime()) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -5,8 +5,8 @@ import type { EcoPagesAppConfig } from '../config/internal-types.js';
|
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* Called during runtime assembly. Loaders come first, then processors, then integrations. Each one's
|
|
8
|
-
* `plugins(app)` is read once; every registration is validated once, by {@link createAppBuildManifest}.
|
|
9
|
-
*
|
|
8
|
+
* `plugins(app)` is read once; every registration is validated once, by {@link createAppBuildManifest}. Runtime
|
|
9
|
+
* setup happens after finalization.
|
|
10
10
|
*/
|
|
11
11
|
export declare function sealAppBuildManifest(appConfig: EcoPagesAppConfig): AppBuildManifest;
|
|
12
12
|
/**
|
|
@@ -20,15 +20,6 @@ export declare function setupAppRuntimePlugins(options: {
|
|
|
20
20
|
appConfig: EcoPagesAppConfig;
|
|
21
21
|
skipProcessorSetup?: boolean;
|
|
22
22
|
}): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Activates one integration's runtime setup on first use.
|
|
25
|
-
*
|
|
26
|
-
* @remarks
|
|
27
|
-
* Concurrent callers share a single in-flight promise per integration name.
|
|
28
|
-
* Server DOM install runs inside that promise, before `setup()`, so a second
|
|
29
|
-
* caller cannot skip the in-flight activation. Failed activations are evicted
|
|
30
|
-
* so a later caller can retry.
|
|
31
|
-
*/
|
|
32
23
|
export declare function ensureIntegrationRuntimeReady(options: {
|
|
33
24
|
appConfig: EcoPagesAppConfig;
|
|
34
25
|
integrationName: string;
|
|
@@ -36,6 +27,27 @@ export declare function ensureIntegrationRuntimeReady(options: {
|
|
|
36
27
|
export declare function setupAppRuntimeIntegrations(options: {
|
|
37
28
|
appConfig: EcoPagesAppConfig;
|
|
38
29
|
}): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Fails a production export whose runtime resolves Integration global scripts at activation.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Such a runtime bundles each global script on its own into `dist/client` at its first activation, beside the copy
|
|
35
|
+
* the app-wide browser build emits. Static generation calls this before it activates anything.
|
|
36
|
+
*/
|
|
37
|
+
export declare function requireBrowserBuildGlobalScriptResolution(appConfig: EcoPagesAppConfig): void;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves each Integration's global scripts once a `'browser-build'` runtime's browser build is known.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Integration `setup()` does not resolve them. Static generation calls this after the app-wide browser build, so
|
|
43
|
+
* each global script resolves to that build's output, and the Lit static-render worker calls it after restoring
|
|
44
|
+
* the asset ledger. An Integration that was never set up is skipped.
|
|
45
|
+
*
|
|
46
|
+
* @throws When the runtime resolves at activation (see {@link requireBrowserBuildGlobalScriptResolution}).
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveIntegrationDependencies(options: {
|
|
49
|
+
appConfig: EcoPagesAppConfig;
|
|
50
|
+
}): Promise<void>;
|
|
39
51
|
/**
|
|
40
52
|
* Releases runtime resources owned by the app's Integrations.
|
|
41
53
|
*
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { mergeBrowserRuntimeManifests } from './browser/browser-runtime-manifest.js';
|
|
2
1
|
import { seedProcessorWatchPaths } from './cache/build-input-dependency-index.js';
|
|
3
2
|
import { createAppBuildManifest, } from './contracts/build-manifest.js';
|
|
4
3
|
import { requireAppRuntime } from '../utils/app-runtime.js';
|
|
@@ -11,15 +10,14 @@ import { installConfiguredServerDom } from '../plugins/server-dom.js';
|
|
|
11
10
|
*
|
|
12
11
|
* @remarks
|
|
13
12
|
* Called during runtime assembly. Loaders come first, then processors, then integrations. Each one's
|
|
14
|
-
* `plugins(app)` is read once; every registration is validated once, by {@link createAppBuildManifest}.
|
|
15
|
-
*
|
|
13
|
+
* `plugins(app)` is read once; every registration is validated once, by {@link createAppBuildManifest}. Runtime
|
|
14
|
+
* setup happens after finalization.
|
|
16
15
|
*/
|
|
17
16
|
export function sealAppBuildManifest(appConfig) {
|
|
18
17
|
const registrations = [...appConfig.loaders.values()].map((plugin) => ({
|
|
19
18
|
plugin,
|
|
20
19
|
source: `Loader "${plugin.name}"`,
|
|
21
20
|
}));
|
|
22
|
-
const browserRuntimeManifests = [];
|
|
23
21
|
for (const processor of appConfig.processors.values()) {
|
|
24
22
|
for (const plugin of processor.plugins(appConfig)) {
|
|
25
23
|
registrations.push({ plugin, source: `Processor "${processor.name}"` });
|
|
@@ -29,9 +27,8 @@ export function sealAppBuildManifest(appConfig) {
|
|
|
29
27
|
for (const plugin of integration.plugins(appConfig)) {
|
|
30
28
|
registrations.push({ plugin, source: `Integration "${integration.name}"` });
|
|
31
29
|
}
|
|
32
|
-
browserRuntimeManifests.push(integration.browserRuntimeManifest);
|
|
33
30
|
}
|
|
34
|
-
return createAppBuildManifest(registrations
|
|
31
|
+
return createAppBuildManifest(registrations);
|
|
35
32
|
}
|
|
36
33
|
/**
|
|
37
34
|
* Gives each Processor its app config and calls `setup()`.
|
|
@@ -72,14 +69,26 @@ export async function setupAppRuntimePlugins(options) {
|
|
|
72
69
|
}
|
|
73
70
|
}
|
|
74
71
|
/**
|
|
75
|
-
* Activates one integration's runtime setup on first use
|
|
72
|
+
* Activates one integration's runtime setup on first use, then resolves its global scripts when the runtime's
|
|
73
|
+
* `globalScriptResolution` is `'activation'`.
|
|
76
74
|
*
|
|
77
75
|
* @remarks
|
|
78
76
|
* Concurrent callers share a single in-flight promise per integration name.
|
|
79
77
|
* Server DOM install runs inside that promise, before `setup()`, so a second
|
|
80
|
-
* caller cannot skip the in-flight activation.
|
|
81
|
-
* so a
|
|
78
|
+
* caller cannot skip the in-flight activation. Resolution runs inside it too,
|
|
79
|
+
* after a successful `setup()`, so an Integration a request activates in dev or
|
|
80
|
+
* start, or after a failed warmup, has its global scripts once it is ready.
|
|
81
|
+
* A `'browser-build'` runtime leaves them to {@link resolveIntegrationDependencies} until that has run once; an activation
|
|
82
|
+
* after it, such as `app.fetch()` after a build in the same process, resolves at activation like any other.
|
|
83
|
+
* Failed activations are evicted so a later caller can retry.
|
|
82
84
|
*/
|
|
85
|
+
/**
|
|
86
|
+
* Runtimes whose {@link resolveIntegrationDependencies} has run, so their browser build is known.
|
|
87
|
+
*
|
|
88
|
+
* @remarks
|
|
89
|
+
* Kept here rather than on the runtime so only this module can mark one.
|
|
90
|
+
*/
|
|
91
|
+
const browserBuildResolved = new WeakSet();
|
|
83
92
|
export async function ensureIntegrationRuntimeReady(options) {
|
|
84
93
|
const runtime = requireAppRuntime(options.appConfig);
|
|
85
94
|
const existing = runtime.integrationActivations.get(options.integrationName);
|
|
@@ -94,6 +103,9 @@ export async function ensureIntegrationRuntimeReady(options) {
|
|
|
94
103
|
const activation = (async () => {
|
|
95
104
|
await installConfiguredServerDom(options.appConfig.integrations);
|
|
96
105
|
await integration.setup({ appConfig: options.appConfig, runtime });
|
|
106
|
+
if (runtime.globalScriptResolution === 'activation' || browserBuildResolved.has(runtime)) {
|
|
107
|
+
await integration.refreshResolvedIntegrationDependencies();
|
|
108
|
+
}
|
|
97
109
|
})();
|
|
98
110
|
runtime.integrationActivations.set(options.integrationName, activation);
|
|
99
111
|
try {
|
|
@@ -105,10 +117,37 @@ export async function ensureIntegrationRuntimeReady(options) {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
export async function setupAppRuntimeIntegrations(options) {
|
|
108
|
-
await Promise.all(options.appConfig.integrations.map((integration) => ensureIntegrationRuntimeReady({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
await Promise.all(options.appConfig.integrations.map((integration) => ensureIntegrationRuntimeReady({ appConfig: options.appConfig, integrationName: integration.name })));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Fails a production export whose runtime resolves Integration global scripts at activation.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* Such a runtime bundles each global script on its own into `dist/client` at its first activation, beside the copy
|
|
127
|
+
* the app-wide browser build emits. Static generation calls this before it activates anything.
|
|
128
|
+
*/
|
|
129
|
+
export function requireBrowserBuildGlobalScriptResolution(appConfig) {
|
|
130
|
+
const { globalScriptResolution } = requireAppRuntime(appConfig);
|
|
131
|
+
if (globalScriptResolution !== 'browser-build') {
|
|
132
|
+
throw new Error(`A production export needs an app runtime created with globalScriptResolution 'browser-build', but it was created with '${globalScriptResolution}'. Run it through \`ecopages build\` or \`ecopages preview\`, finalize the config with { globalScriptResolution: 'browser-build' }, or load it with loadEcoPagesConfig({ globalScriptResolution: 'browser-build' }).`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Resolves each Integration's global scripts once a `'browser-build'` runtime's browser build is known.
|
|
137
|
+
*
|
|
138
|
+
* @remarks
|
|
139
|
+
* Integration `setup()` does not resolve them. Static generation calls this after the app-wide browser build, so
|
|
140
|
+
* each global script resolves to that build's output, and the Lit static-render worker calls it after restoring
|
|
141
|
+
* the asset ledger. An Integration that was never set up is skipped.
|
|
142
|
+
*
|
|
143
|
+
* @throws When the runtime resolves at activation (see {@link requireBrowserBuildGlobalScriptResolution}).
|
|
144
|
+
*/
|
|
145
|
+
export async function resolveIntegrationDependencies(options) {
|
|
146
|
+
requireBrowserBuildGlobalScriptResolution(options.appConfig);
|
|
147
|
+
browserBuildResolved.add(requireAppRuntime(options.appConfig));
|
|
148
|
+
for (const integration of options.appConfig.integrations) {
|
|
149
|
+
await integration.refreshResolvedIntegrationDependencies();
|
|
150
|
+
}
|
|
112
151
|
}
|
|
113
152
|
/**
|
|
114
153
|
* Releases runtime resources owned by the app's Integrations.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '../contracts/build-types.js';
|
|
1
|
+
import type { EcoBuildPlugin, EcoBuildPluginBuilder } from '../contracts/build-types.js';
|
|
2
2
|
import type { EcoPagesAppConfig } from '../../config/internal-types.js';
|
|
3
|
+
/** Name of the JSX Integration whose longest extension `filePath` ends with, if any. */
|
|
4
|
+
export declare function findJsxExtensionOwner(appConfig: EcoPagesAppConfig, filePath: string): string | undefined;
|
|
3
5
|
/**
|
|
4
6
|
* Foreign JSX override plugins for mixed-integration app builds.
|
|
5
7
|
*
|
|
@@ -21,4 +23,5 @@ export declare function getJsxOwnershipPlugins(appConfig: EcoPagesAppConfig): Ec
|
|
|
21
23
|
*/
|
|
22
24
|
export declare function getHostScopedJsxOwnershipPlugins(appConfig: EcoPagesAppConfig, hostIntegrationName: string, options?: {
|
|
23
25
|
name?: string;
|
|
26
|
+
scope?: (build: EcoBuildPluginBuilder) => (sourcePath: string) => boolean;
|
|
24
27
|
}): EcoBuildPlugin[];
|
|
@@ -6,6 +6,11 @@ function collectJsxExtensionEntries(appConfig) {
|
|
|
6
6
|
.flatMap((integration) => filterJsxSourceExtensions(integration.extensions).map((extension) => ({ integration, extension })))
|
|
7
7
|
.sort((left, right) => right.extension.length - left.extension.length);
|
|
8
8
|
}
|
|
9
|
+
/** Name of the JSX Integration whose longest extension `filePath` ends with, if any. */
|
|
10
|
+
export function findJsxExtensionOwner(appConfig, filePath) {
|
|
11
|
+
return collectJsxExtensionEntries(appConfig).find(({ extension }) => filePath.endsWith(extension))?.integration
|
|
12
|
+
.name;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* Foreign JSX override plugins for mixed-integration app builds.
|
|
11
16
|
*
|
|
@@ -50,6 +55,7 @@ export function getHostScopedJsxOwnershipPlugins(appConfig, hostIntegrationName,
|
|
|
50
55
|
name: options?.name ?? `ecopages-jsx-ownership-host-${hostIntegrationName}`,
|
|
51
56
|
hostJsxImportSource,
|
|
52
57
|
foreignExtensions,
|
|
58
|
+
...(options?.scope ? { scope: options.scope } : {}),
|
|
53
59
|
}),
|
|
54
60
|
];
|
|
55
61
|
}
|
|
@@ -13,4 +13,4 @@ import { type BuildAdapter } from './contracts/build-contracts.js';
|
|
|
13
13
|
export type { BuildAdapter, BuildFormat, BuildChunk, BuildDependencyGraph, BuildExecutor, BuildFailure, BuildLog, BuildOptions, BuildOutput, BuildResult, BuildSourcemap, BuildSuccess, BuildTarget, BuildTranspileOptions, BuildEnvironment, } from './contracts/build-contracts.js';
|
|
14
14
|
/** Constructs the Rolldown build adapter. */
|
|
15
15
|
export declare function createBuildAdapter(): BuildAdapter;
|
|
16
|
-
export { ensureIntegrationRuntimeReady, sealAppBuildManifest, setupAppRuntimeIntegrations, setupAppRuntimePlugins, teardownAppRuntimeIntegrations, } from './app-build-manifest-runtime.js';
|
|
16
|
+
export { ensureIntegrationRuntimeReady, resolveIntegrationDependencies, sealAppBuildManifest, setupAppRuntimeIntegrations, setupAppRuntimePlugins, teardownAppRuntimeIntegrations, } from './app-build-manifest-runtime.js';
|
|
@@ -15,4 +15,4 @@ import { createRolldownBuildAdapter } from './rolldown/rolldown-build-adapter.js
|
|
|
15
15
|
export function createBuildAdapter() {
|
|
16
16
|
return createRolldownBuildAdapter();
|
|
17
17
|
}
|
|
18
|
-
export { ensureIntegrationRuntimeReady, sealAppBuildManifest, setupAppRuntimeIntegrations, setupAppRuntimePlugins, teardownAppRuntimeIntegrations, } from './app-build-manifest-runtime.js';
|
|
18
|
+
export { ensureIntegrationRuntimeReady, resolveIntegrationDependencies, sealAppBuildManifest, setupAppRuntimeIntegrations, setupAppRuntimePlugins, teardownAppRuntimeIntegrations, } from './app-build-manifest-runtime.js';
|
|
@@ -21,8 +21,10 @@ export declare function recordBuildEntryOutput(entryOutputs: Record<string, stri
|
|
|
21
21
|
* Finds the emitted file for an entry using the path or name the caller passed.
|
|
22
22
|
*/
|
|
23
23
|
export declare function getBuildEntryOutput(result: Pick<BuildSuccess, 'entryOutputs'>, entry: string, root: string): string | undefined;
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Collects the files one entry's output depends on: its source-module closure and the files its plugins declared.
|
|
26
|
+
*/
|
|
27
|
+
export declare function collectBuildEntryInputPaths(result: Pick<BuildSuccess, 'dependencyGraph'>, entry: string, root: string, options?: {
|
|
26
28
|
includeNodeModules?: boolean;
|
|
27
29
|
}): string[];
|
|
28
30
|
/**
|
package/src/build/build-graph.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
3
|
function tryRealpath(filePath) {
|
|
5
4
|
try {
|
|
6
5
|
return fileSystem.exists(filePath) ? fileSystem.realpath(filePath) : undefined;
|
|
@@ -42,14 +41,14 @@ function isSameBuildEntry(left, right) {
|
|
|
42
41
|
* Named grouped entries also look up by the record key they chose.
|
|
43
42
|
*/
|
|
44
43
|
export function recordBuildEntryOutput(entryOutputs, outputPath, options) {
|
|
45
|
-
const
|
|
46
|
-
const
|
|
44
|
+
const facadeModuleId = path.fromNative(options.facadeModuleId);
|
|
45
|
+
const keys = new Set([facadeModuleId]);
|
|
46
|
+
const facadeReal = tryRealpath(facadeModuleId);
|
|
47
47
|
if (facadeReal) {
|
|
48
48
|
keys.add(facadeReal);
|
|
49
49
|
}
|
|
50
50
|
for (const requested of requestedBuildEntries(options.entrypoints, options.root)) {
|
|
51
|
-
const matchesFacade = isSameBuildEntry(
|
|
52
|
-
isSameBuildEntry(options.facadeModuleId, requested.entry);
|
|
51
|
+
const matchesFacade = isSameBuildEntry(facadeModuleId, requested.resolved) || isSameBuildEntry(facadeModuleId, requested.entry);
|
|
53
52
|
const matchesName = options.chunkName !== undefined && options.chunkName === requested.name;
|
|
54
53
|
if (!matchesFacade && !matchesName) {
|
|
55
54
|
continue;
|
|
@@ -88,51 +87,18 @@ export function getBuildEntryOutput(result, entry, root) {
|
|
|
88
87
|
}
|
|
89
88
|
return undefined;
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Collects the files one entry's output depends on: its source-module closure and the files its plugins declared.
|
|
92
|
+
*/
|
|
92
93
|
export function collectBuildEntryInputPaths(result, entry, root, options = {}) {
|
|
93
94
|
const resolvedEntry = resolveBuildEntryPath(entry, root);
|
|
94
95
|
const entrypoints = result.dependencyGraph.entrypoints;
|
|
95
96
|
const closureEntry = [resolvedEntry, tryRealpath(resolvedEntry)].find((candidate) => candidate && entrypoints[candidate]);
|
|
96
97
|
const moduleClosure = closureEntry ? entrypoints[closureEntry] : undefined;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return [...new Set([...entryModules, ...pluginInputs])].filter((filePath) => path.isAbsolute(filePath) &&
|
|
100
|
-
(options.includeNodeModules === true || !filePath.includes(`${path.sep}node_modules${path.sep}`)) &&
|
|
98
|
+
return [...new Set(moduleClosure?.length ? moduleClosure : [resolvedEntry])].filter((filePath) => path.isAbsolute(filePath) &&
|
|
99
|
+
(options.includeNodeModules === true || !filePath.includes(`/node_modules/`)) &&
|
|
101
100
|
!filePath.includes('\0'));
|
|
102
101
|
}
|
|
103
|
-
function modulePathAliases(moduleId) {
|
|
104
|
-
const aliases = new Set([moduleId]);
|
|
105
|
-
let filesystemPath;
|
|
106
|
-
if (moduleId.startsWith('file:')) {
|
|
107
|
-
try {
|
|
108
|
-
filesystemPath = fileURLToPath(moduleId);
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return aliases;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (path.isAbsolute(moduleId)) {
|
|
115
|
-
filesystemPath = path.resolve(moduleId);
|
|
116
|
-
}
|
|
117
|
-
if (filesystemPath) {
|
|
118
|
-
aliases.add(filesystemPath);
|
|
119
|
-
const realPath = tryRealpath(filesystemPath);
|
|
120
|
-
if (realPath)
|
|
121
|
-
aliases.add(realPath);
|
|
122
|
-
}
|
|
123
|
-
return aliases;
|
|
124
|
-
}
|
|
125
|
-
function collectInputsForModuleClosure(loadedInputsByModule, moduleClosure) {
|
|
126
|
-
const closureAliases = new Set(moduleClosure.flatMap((moduleId) => [...modulePathAliases(moduleId)]));
|
|
127
|
-
const inputs = new Set();
|
|
128
|
-
for (const [moduleId, filePaths] of Object.entries(loadedInputsByModule)) {
|
|
129
|
-
if (![...modulePathAliases(moduleId)].some((alias) => closureAliases.has(alias)))
|
|
130
|
-
continue;
|
|
131
|
-
for (const filePath of filePaths)
|
|
132
|
-
inputs.add(filePath);
|
|
133
|
-
}
|
|
134
|
-
return [...inputs];
|
|
135
|
-
}
|
|
136
102
|
/**
|
|
137
103
|
* @remarks
|
|
138
104
|
* Traverses emitted chunk edges without reading output code. Local external
|
|
@@ -147,9 +113,9 @@ export function collectBuildOutputImports(result, outputPath) {
|
|
|
147
113
|
continue;
|
|
148
114
|
for (const imported of [...chunk.imports, ...chunk.dynamicImports]) {
|
|
149
115
|
const local = imported.startsWith('file:')
|
|
150
|
-
?
|
|
116
|
+
? path.fromFileUrl(imported)
|
|
151
117
|
: path.isAbsolute(imported)
|
|
152
|
-
? imported
|
|
118
|
+
? path.fromNative(imported)
|
|
153
119
|
: imported.startsWith('.')
|
|
154
120
|
? path.resolve(path.dirname(current), imported)
|
|
155
121
|
: undefined;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import type { EcoPagesAppConfig } from '../../config/internal-types.js';
|
|
2
|
-
export type BuildInputRecordingContext = {
|
|
3
|
-
index: BuildInputDependencyIndex | undefined;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
3
|
* Cached result kinds that share one reverse index from recorded build inputs.
|
|
7
4
|
*/
|
|
@@ -92,22 +89,6 @@ export declare class BuildInputDependencyIndex {
|
|
|
92
89
|
clear(): void;
|
|
93
90
|
private removeBindingFromSource;
|
|
94
91
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Captures the current build-input targets before handing plugin hooks to a bundler.
|
|
97
|
-
*/
|
|
98
|
-
export declare function getBuildInputRecordingContext(): BuildInputRecordingContext;
|
|
99
|
-
/**
|
|
100
|
-
* Creates a recorder whose writes stay attached to a captured build context.
|
|
101
|
-
*
|
|
102
|
-
* @remarks
|
|
103
|
-
* Rolldown plugin hooks may run outside the caller's AsyncLocalStorage context,
|
|
104
|
-
* so the recorder closes over the targets captured before the build starts.
|
|
105
|
-
*/
|
|
106
|
-
export declare function createBuildInputRecorder(context: BuildInputRecordingContext, loadedInputs: Set<string>, loadedInputsByModule: Map<string, Set<string>>): (moduleId: string, filePath: string) => void;
|
|
107
|
-
/**
|
|
108
|
-
* Runs `fn` with `index` receiving every loaded path.
|
|
109
|
-
*/
|
|
110
|
-
export declare function runWithBuildInputIndex<T>(index: BuildInputDependencyIndex, fn: () => T): T;
|
|
111
92
|
/**
|
|
112
93
|
* Seeds Processor watch directories into the recorded watch set.
|
|
113
94
|
*
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
const activeIndex = new AsyncLocalStorage();
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
4
2
|
function bindingId(binding) {
|
|
5
3
|
return `${binding.consumer}:${binding.key}`;
|
|
6
4
|
}
|
|
@@ -201,37 +199,6 @@ export class BuildInputDependencyIndex {
|
|
|
201
199
|
}
|
|
202
200
|
}
|
|
203
201
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Captures the current build-input targets before handing plugin hooks to a bundler.
|
|
206
|
-
*/
|
|
207
|
-
export function getBuildInputRecordingContext() {
|
|
208
|
-
return {
|
|
209
|
-
index: activeIndex.getStore(),
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Creates a recorder whose writes stay attached to a captured build context.
|
|
214
|
-
*
|
|
215
|
-
* @remarks
|
|
216
|
-
* Rolldown plugin hooks may run outside the caller's AsyncLocalStorage context,
|
|
217
|
-
* so the recorder closes over the targets captured before the build starts.
|
|
218
|
-
*/
|
|
219
|
-
export function createBuildInputRecorder(context, loadedInputs, loadedInputsByModule) {
|
|
220
|
-
return (moduleId, filePath) => {
|
|
221
|
-
const normalized = path.resolve(filePath);
|
|
222
|
-
loadedInputs.add(normalized);
|
|
223
|
-
const moduleInputs = loadedInputsByModule.get(moduleId) ?? new Set();
|
|
224
|
-
moduleInputs.add(normalized);
|
|
225
|
-
loadedInputsByModule.set(moduleId, moduleInputs);
|
|
226
|
-
context.index?.recordWatchPath(normalized);
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Runs `fn` with `index` receiving every loaded path.
|
|
231
|
-
*/
|
|
232
|
-
export function runWithBuildInputIndex(index, fn) {
|
|
233
|
-
return activeIndex.run(index, fn);
|
|
234
|
-
}
|
|
235
202
|
/**
|
|
236
203
|
* Seeds Processor watch directories into the recorded watch set.
|
|
237
204
|
*
|