@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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { RolldownPlugin } from 'rolldown';
|
|
2
|
+
import type { BuildStylesheets } from '../contracts/build-contracts.js';
|
|
3
|
+
import type { WatchFilesByModule } from './rolldown-plugin-bridge.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds the Rolldown plugin that gives every stylesheet import of a build one module shape, in server builds and
|
|
6
|
+
* browser bundles alike.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* - A binding import (`import styles from './card.css'`) loads the module `stylesheets.compileModule` returns: the
|
|
10
|
+
* processed CSS as its default export.
|
|
11
|
+
* - A side-effect import (`import './card.css'`) loads an empty module. The component meta transform removes the side
|
|
12
|
+
* effect imports of app modules, whose CSS reaches the Page as a Dependency, so the ones left come from packages.
|
|
13
|
+
*
|
|
14
|
+
* Its `transform` runs after every other plugin's, so it reads each module as Rolldown parses it, and lists the side
|
|
15
|
+
* effect stylesheet imports there. A side-effect import resolves through the other plugins first and keeps their
|
|
16
|
+
* result when it is external, so a build that externalizes its imports, such as the dev transform server's, keeps
|
|
17
|
+
* doing so; its id gets a query, so the same file imported with a binding stays a separate, compiled module.
|
|
18
|
+
*
|
|
19
|
+
* A package module's own CSS Module import fails a build when no declaration reaches the module, since its CSS would
|
|
20
|
+
* never reach a Page, unless `stylesheets.reportUndeliverable` takes the error. A package module's own side-effect import in a browser build fails it, since its CSS would never reach a Page, unless
|
|
21
|
+
* `stylesheets.reportUndeliverable` takes the error. The import of a package discovery reached never gets here: the
|
|
22
|
+
* component meta transform removed it.
|
|
23
|
+
*
|
|
24
|
+
* The files a compiled stylesheet inlined are declared with `addWatchFile` and recorded in `watchFiles` under its
|
|
25
|
+
* module, so they join the module closure of every entry that imports it.
|
|
26
|
+
*
|
|
27
|
+
* @param build - The build's environment and root; a module under `node_modules` or outside the root is a package.
|
|
28
|
+
* @param stylesheets - The stylesheet extensions and the compiler; defaults to plain `.css` exported as written.
|
|
29
|
+
* @param watchFiles - Receives the files each compiled stylesheet inlined, by module id.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createStylesheetModulePlugin(build: {
|
|
32
|
+
environment: 'server' | 'browser';
|
|
33
|
+
root: string;
|
|
34
|
+
}, stylesheets: BuildStylesheets | undefined, watchFiles: WatchFilesByModule): RolldownPlugin;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
|
+
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
+
import { code as codeFilter, id as idFilter, include } from 'rolldown/filter';
|
|
4
|
+
import { collectStaticImports, createUndeliverableCssModuleError, createUndeliverablePackageCssModuleError, createUndeliverablePackageStylesheetError, hasDiscoveryRecord, } from '../../plugins/component-import-discovery.js';
|
|
5
|
+
import { isPathInside } from '../../utils/path-containment.js';
|
|
6
|
+
import { PLAIN_CSS_KINDS } from '../../plugins/stylesheet-kinds.js';
|
|
7
|
+
import { parseModuleSource } from '../../cache/module-parse-cache.js';
|
|
8
|
+
import { escapeRegExp } from '../../utils/regex-escaping.js';
|
|
9
|
+
import { toStylesheetModule } from '../../assets/asset-processing-service/processors/stylesheet/stylesheet-module.js';
|
|
10
|
+
import { fromRolldownModuleId, toRolldownModuleId } from './rolldown-module-id.js';
|
|
11
|
+
const SIDE_EFFECT_QUERY = '?ecopages-stylesheet-side-effect';
|
|
12
|
+
/** Plain CSS, default-exported as written: the stylesheets of a build request that names none. */
|
|
13
|
+
const PLAIN_CSS_STYLESHEETS = {
|
|
14
|
+
extensions: PLAIN_CSS_KINDS.extensions,
|
|
15
|
+
isCssModule: PLAIN_CSS_KINDS.isCssModule,
|
|
16
|
+
compileModule: async (file) => ({ code: toStylesheetModule(await fileSystem.readFile(file)) }),
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The specifiers of stylesheets `code` imports only for their side effects, as in `import './card.css'`.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* A module that does not parse, such as one another plugin has not finished compiling, lists none, so its
|
|
23
|
+
* stylesheet imports compile: the safe choice, since an unused default export is dropped from the output.
|
|
24
|
+
*/
|
|
25
|
+
function collectSideEffectStylesheetImports(code, id, isStylesheet) {
|
|
26
|
+
const file = fromRolldownModuleId(id).replace(/[?#].*$/u, '');
|
|
27
|
+
let imports;
|
|
28
|
+
try {
|
|
29
|
+
imports = collectStaticImports(parseModuleSource(file, code, { sourceType: 'module' }).program);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return new Set();
|
|
33
|
+
}
|
|
34
|
+
const stylesheetImports = imports.filter((entry) => isStylesheet(entry.source));
|
|
35
|
+
const bound = new Set(stylesheetImports.filter((entry) => !entry.sideEffectOnly).map((entry) => entry.source));
|
|
36
|
+
return new Set(stylesheetImports
|
|
37
|
+
.filter((entry) => entry.sideEffectOnly && !bound.has(entry.source))
|
|
38
|
+
.map((entry) => entry.source));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds the Rolldown plugin that gives every stylesheet import of a build one module shape, in server builds and
|
|
42
|
+
* browser bundles alike.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* - A binding import (`import styles from './card.css'`) loads the module `stylesheets.compileModule` returns: the
|
|
46
|
+
* processed CSS as its default export.
|
|
47
|
+
* - A side-effect import (`import './card.css'`) loads an empty module. The component meta transform removes the side
|
|
48
|
+
* effect imports of app modules, whose CSS reaches the Page as a Dependency, so the ones left come from packages.
|
|
49
|
+
*
|
|
50
|
+
* Its `transform` runs after every other plugin's, so it reads each module as Rolldown parses it, and lists the side
|
|
51
|
+
* effect stylesheet imports there. A side-effect import resolves through the other plugins first and keeps their
|
|
52
|
+
* result when it is external, so a build that externalizes its imports, such as the dev transform server's, keeps
|
|
53
|
+
* doing so; its id gets a query, so the same file imported with a binding stays a separate, compiled module.
|
|
54
|
+
*
|
|
55
|
+
* A package module's own CSS Module import fails a build when no declaration reaches the module, since its CSS would
|
|
56
|
+
* never reach a Page, unless `stylesheets.reportUndeliverable` takes the error. A package module's own side-effect import in a browser build fails it, since its CSS would never reach a Page, unless
|
|
57
|
+
* `stylesheets.reportUndeliverable` takes the error. The import of a package discovery reached never gets here: the
|
|
58
|
+
* component meta transform removed it.
|
|
59
|
+
*
|
|
60
|
+
* The files a compiled stylesheet inlined are declared with `addWatchFile` and recorded in `watchFiles` under its
|
|
61
|
+
* module, so they join the module closure of every entry that imports it.
|
|
62
|
+
*
|
|
63
|
+
* @param build - The build's environment and root; a module under `node_modules` or outside the root is a package.
|
|
64
|
+
* @param stylesheets - The stylesheet extensions and the compiler; defaults to plain `.css` exported as written.
|
|
65
|
+
* @param watchFiles - Receives the files each compiled stylesheet inlined, by module id.
|
|
66
|
+
*/
|
|
67
|
+
export function createStylesheetModulePlugin(build, stylesheets, watchFiles) {
|
|
68
|
+
const compiler = stylesheets ?? PLAIN_CSS_STYLESHEETS;
|
|
69
|
+
const extensionPattern = compiler.extensions.map(escapeRegExp).join('|');
|
|
70
|
+
const STYLESHEET_ID = new RegExp(`(?:${extensionPattern})$`, 'iu');
|
|
71
|
+
const SIDE_EFFECT_ID = new RegExp(`(?:${extensionPattern})${escapeRegExp(SIDE_EFFECT_QUERY)}$`, 'iu');
|
|
72
|
+
const isCssModule = compiler.isCssModule ?? PLAIN_CSS_KINDS.isCssModule;
|
|
73
|
+
const STYLESHEET_REFERENCE = new RegExp(`(?:${extensionPattern})['"]`, 'iu');
|
|
74
|
+
const isStylesheet = (specifier) => STYLESHEET_ID.test(specifier);
|
|
75
|
+
const sideEffectImportsByImporter = new Map();
|
|
76
|
+
const appRoot = fileSystem.exists(build.root) ? path.fromNative(fileSystem.realpath(build.root)) : build.root;
|
|
77
|
+
const report = (error) => {
|
|
78
|
+
if (!compiler.reportUndeliverable)
|
|
79
|
+
throw error;
|
|
80
|
+
compiler.reportUndeliverable(error);
|
|
81
|
+
};
|
|
82
|
+
const unreachedAppCssModules = [];
|
|
83
|
+
const checkCssModule = async (context, importer, source, extraOptions) => {
|
|
84
|
+
const importerFile = fromRolldownModuleId(importer).replace(/[?#].*$/u, '');
|
|
85
|
+
const fromPackage = importerFile.includes('/node_modules/') || !isPathInside(importerFile, appRoot);
|
|
86
|
+
if (fromPackage) {
|
|
87
|
+
if (!hasDiscoveryRecord(build.root, importerFile)) {
|
|
88
|
+
report(createUndeliverablePackageCssModuleError(appRoot, importerFile, source));
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const resolved = await context.resolve(source, importer, { ...extraOptions, skipSelf: true });
|
|
93
|
+
if (!resolved || resolved.external)
|
|
94
|
+
return;
|
|
95
|
+
unreachedAppCssModules.push({
|
|
96
|
+
importerFile,
|
|
97
|
+
cssFile: fromRolldownModuleId(resolved.id).replace(/[?#].*$/u, ''),
|
|
98
|
+
source,
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
name: 'ecopages:stylesheet-modules',
|
|
103
|
+
transform: {
|
|
104
|
+
order: 'post',
|
|
105
|
+
filter: [include(codeFilter(STYLESHEET_REFERENCE))],
|
|
106
|
+
handler(code, id) {
|
|
107
|
+
sideEffectImportsByImporter.set(id, collectSideEffectStylesheetImports(code, id, isStylesheet));
|
|
108
|
+
return null;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
buildEnd() {
|
|
112
|
+
for (const { importerFile, cssFile, source } of unreachedAppCssModules) {
|
|
113
|
+
if (hasDiscoveryRecord(build.root, importerFile) || hasDiscoveryRecord(build.root, cssFile))
|
|
114
|
+
continue;
|
|
115
|
+
report(createUndeliverableCssModuleError(appRoot, importerFile, source));
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
resolveId: {
|
|
119
|
+
filter: [include(idFilter(STYLESHEET_ID))],
|
|
120
|
+
async handler(source, importer, extraOptions) {
|
|
121
|
+
if (!importer)
|
|
122
|
+
return null;
|
|
123
|
+
if (!sideEffectImportsByImporter.get(importer)?.has(source)) {
|
|
124
|
+
if (isCssModule(source))
|
|
125
|
+
await checkCssModule(this, importer, source, extraOptions);
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const resolved = await this.resolve(source, importer, { ...extraOptions, skipSelf: true });
|
|
129
|
+
if (!resolved || resolved.external)
|
|
130
|
+
return resolved;
|
|
131
|
+
const importerFile = fromRolldownModuleId(importer).replace(/[?#].*$/u, '');
|
|
132
|
+
const fromPackage = importerFile.includes('/node_modules/') || !isPathInside(importerFile, appRoot);
|
|
133
|
+
if (build.environment === 'browser' && fromPackage) {
|
|
134
|
+
const error = createUndeliverablePackageStylesheetError(appRoot, importerFile, source);
|
|
135
|
+
if (!compiler.reportUndeliverable)
|
|
136
|
+
throw error;
|
|
137
|
+
compiler.reportUndeliverable(error);
|
|
138
|
+
}
|
|
139
|
+
return toRolldownModuleId(`${fromRolldownModuleId(resolved.id)}${SIDE_EFFECT_QUERY}`);
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
load: {
|
|
143
|
+
filter: [include(idFilter(STYLESHEET_ID)), include(idFilter(SIDE_EFFECT_ID))],
|
|
144
|
+
async handler(id) {
|
|
145
|
+
if (id.endsWith(SIDE_EFFECT_QUERY)) {
|
|
146
|
+
return { code: 'export default "";', moduleType: 'js', moduleSideEffects: true };
|
|
147
|
+
}
|
|
148
|
+
const file = fromRolldownModuleId(id);
|
|
149
|
+
const { code, dependencies = [] } = await compiler.compileModule(file);
|
|
150
|
+
for (const dependency of dependencies) {
|
|
151
|
+
this.addWatchFile(dependency);
|
|
152
|
+
}
|
|
153
|
+
if (dependencies.length > 0) {
|
|
154
|
+
watchFiles.set(file, new Set([...(watchFiles.get(file) ?? []), ...dependencies]));
|
|
155
|
+
}
|
|
156
|
+
return { code, moduleType: 'js' };
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RolldownPlugin } from 'rolldown';
|
|
2
|
+
/**
|
|
3
|
+
* Builds each relative module Worker URL of a browser build as its own entry.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The worker is emitted as a chunk of the same build, so it shares chunks with the page code that imports the
|
|
7
|
+
* same modules, and the `new URL(...)` expression becomes `import.meta.ROLLUP_FILE_URL_<ref>`, which Rolldown
|
|
8
|
+
* replaces with the emitted file's URL, resolved against `import.meta.url`. The page chunk's hash then follows the worker's file name.
|
|
9
|
+
* A Worker URL left as written is reported as a build warning, so a source path never ships silently.
|
|
10
|
+
* A classic worker fails the build: worker output is ESM and may import shared chunks. Installed packages are left
|
|
11
|
+
* as they are, so a package that starts a classic worker or handles a failed one itself still builds.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createWorkerEntriesPlugin(): RolldownPlugin;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
import { parseModuleSource } from '../../cache/module-parse-cache.js';
|
|
3
|
+
import { WORKER_CONSTRUCTOR_PATTERN, findWorkerUrls, formatClassicWorkerError, formatUnbundledWorkerWarning, formatWorkerUrlQueryError, isUnbundledWorkerUrl, } from '../worker-urls.js';
|
|
4
|
+
import { fromRolldownModuleId } from './rolldown-module-id.js';
|
|
5
|
+
const NODE_MODULES_PATTERN = /\/node_modules\//;
|
|
6
|
+
const PARSER_LANGUAGES = ['js', 'jsx', 'ts', 'tsx'];
|
|
7
|
+
function parserLanguage(moduleType) {
|
|
8
|
+
return PARSER_LANGUAGES.find((language) => language === moduleType) ?? 'js';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Builds each relative module Worker URL of a browser build as its own entry.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* The worker is emitted as a chunk of the same build, so it shares chunks with the page code that imports the
|
|
15
|
+
* same modules, and the `new URL(...)` expression becomes `import.meta.ROLLUP_FILE_URL_<ref>`, which Rolldown
|
|
16
|
+
* replaces with the emitted file's URL, resolved against `import.meta.url`. The page chunk's hash then follows the worker's file name.
|
|
17
|
+
* A Worker URL left as written is reported as a build warning, so a source path never ships silently.
|
|
18
|
+
* A classic worker fails the build: worker output is ESM and may import shared chunks. Installed packages are left
|
|
19
|
+
* as they are, so a package that starts a classic worker or handles a failed one itself still builds.
|
|
20
|
+
*/
|
|
21
|
+
export function createWorkerEntriesPlugin() {
|
|
22
|
+
return {
|
|
23
|
+
name: 'ecopages:worker-entries',
|
|
24
|
+
transform: {
|
|
25
|
+
filter: { id: { exclude: NODE_MODULES_PATTERN }, code: WORKER_CONSTRUCTOR_PATTERN },
|
|
26
|
+
async handler(code, id, meta) {
|
|
27
|
+
const program = parseModuleSource(id, code, {
|
|
28
|
+
sourceType: 'module',
|
|
29
|
+
lang: parserLanguage(meta.moduleType),
|
|
30
|
+
}).program;
|
|
31
|
+
const urls = findWorkerUrls(program, code);
|
|
32
|
+
const file = fromRolldownModuleId(id);
|
|
33
|
+
let source;
|
|
34
|
+
for (const url of urls) {
|
|
35
|
+
if (url.kind === 'classic')
|
|
36
|
+
throw new Error(formatClassicWorkerError(url, file));
|
|
37
|
+
if (url.kind === 'query')
|
|
38
|
+
throw new Error(formatWorkerUrlQueryError(url, file));
|
|
39
|
+
if (isUnbundledWorkerUrl(url)) {
|
|
40
|
+
this.warn(formatUnbundledWorkerWarning(url, file));
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const resolved = await this.resolve(url.specifier, id);
|
|
44
|
+
if (!resolved || resolved.external) {
|
|
45
|
+
throw new Error(`Could not resolve the ${url.constructorName} URL ${JSON.stringify(url.specifier)} in ${file}.`);
|
|
46
|
+
}
|
|
47
|
+
const referenceId = this.emitFile({ type: 'chunk', id: resolved.id });
|
|
48
|
+
source ??= new MagicString(code);
|
|
49
|
+
source.overwrite(url.expression.start, url.expression.end, `import.meta.ROLLUP_FILE_URL_${referenceId}`);
|
|
50
|
+
}
|
|
51
|
+
if (!source)
|
|
52
|
+
return null;
|
|
53
|
+
return { code: source.toString(), map: source.generateMap({ hires: true }) };
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -6,15 +6,25 @@ export function resolveTranspileOptions(environment) {
|
|
|
6
6
|
sourcemap: 'none',
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Replaces `import.meta.env.NODE_ENV` and `process.env.NODE_ENV` with the current Node environment in browser code.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* CommonJS packages such as React pick their development or production build from `process.env.NODE_ENV`. Defining it
|
|
14
|
+
* for every browser build gives the app-wide build, route builds and the development vendor graph the same choice;
|
|
15
|
+
* Rolldown would otherwise choose by `minify`.
|
|
16
|
+
*/
|
|
17
|
+
function createBrowserNodeEnvironmentDefines() {
|
|
18
|
+
const nodeEnvironment = JSON.stringify(getNodeEnvironment() ?? 'development');
|
|
19
|
+
return { 'import.meta.env.NODE_ENV': nodeEnvironment, 'process.env.NODE_ENV': nodeEnvironment };
|
|
20
|
+
}
|
|
9
21
|
export function resolveBuildEnvironmentOptions(environment, appConfig) {
|
|
10
22
|
return {
|
|
11
23
|
environment,
|
|
12
24
|
root: appConfig.rootDir,
|
|
13
25
|
...resolveTranspileOptions(environment),
|
|
14
26
|
minify: false,
|
|
15
|
-
...(environment === 'browser'
|
|
16
|
-
? { define: { 'import.meta.env.NODE_ENV': JSON.stringify(getNodeEnvironment() ?? 'development') } }
|
|
17
|
-
: {}),
|
|
27
|
+
...(environment === 'browser' ? { define: createBrowserNodeEnvironmentDefines() } : {}),
|
|
18
28
|
...(environment === 'server' ? { externalPackages: true } : {}),
|
|
19
29
|
};
|
|
20
30
|
}
|
|
@@ -7,9 +7,9 @@ import type { BuildEnvironment, BuildOptions } from '../contracts/build-contract
|
|
|
7
7
|
* @remarks
|
|
8
8
|
* Rolldown asks plugins in this order and the first one that returns a result for a resolve or load wins, so
|
|
9
9
|
* position is priority: the alias resolver, then the sealed manifest's plugins for the environment (for the browser,
|
|
10
|
-
* the plugins that also apply to the server,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* the plugins that also apply to the server, then the browser-only ones), then the JSX ownership plugins.
|
|
11
|
+
* {@link resolveBuildPluginOrder} puts caller plugins before them and core's own transforms after. The unified pages
|
|
12
|
+
* graph keys its cache by their names.
|
|
13
13
|
*/
|
|
14
14
|
export declare function resolveAppBuildPlugins(appConfig: EcoPagesAppConfig, environment: BuildEnvironment): EcoBuildPlugin[];
|
|
15
15
|
/**
|
|
@@ -17,9 +17,9 @@ export declare function resolveAppBuildPlugins(appConfig: EcoPagesAppConfig, env
|
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
19
|
* App-manifest plugins cannot be silently replaced by same-name caller plugins.
|
|
20
|
-
* Unique caller plugins are prepended so first-wins Rolldown hooks
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Unique caller plugins are prepended so first-wins Rolldown hooks still run
|
|
21
|
+
* before general app loaders. Use `excludeAppBuildPlugins` on browser requests
|
|
22
|
+
* to omit app-owned plugins.
|
|
23
23
|
*/
|
|
24
24
|
export declare function mergeCallerBuildPlugins(appPlugins: EcoBuildPlugin[], callerPlugins?: EcoBuildPlugin[], environment?: BuildEnvironment): EcoBuildPlugin[];
|
|
25
25
|
/**
|
|
@@ -30,7 +30,7 @@ export declare function mergeCallerBuildPlugins(appPlugins: EcoBuildPlugin[], ca
|
|
|
30
30
|
* that decides priority:
|
|
31
31
|
*
|
|
32
32
|
* 1. Caller plugins that apply to the environment and do not share a name with an app plugin, so a caller's
|
|
33
|
-
*
|
|
33
|
+
* alias rewrite runs before the general app loaders. A caller plugin cannot replace an app plugin of
|
|
34
34
|
* the same name.
|
|
35
35
|
* 2. {@link resolveAppBuildPlugins}, less the names in `excludeAppBuildPlugins`. Use it to omit app plugins that a
|
|
36
36
|
* request replaces; an environment cannot express that.
|
|
@@ -72,10 +72,5 @@ export declare function createServerBuildRequest(appConfig: EcoPagesAppConfig, i
|
|
|
72
72
|
* chosen by {@link BrowserBundleService}.
|
|
73
73
|
*
|
|
74
74
|
* Plugins follow {@link resolveBuildPluginOrder}; `excludeAppBuildPlugins` omits app-owned names.
|
|
75
|
-
*
|
|
76
|
-
* @remarks
|
|
77
|
-
* Specifiers of the browser runtime manifest are dropped from `external`. Rolldown checks `external` before any
|
|
78
|
-
* plugin, so one listed there would stay a bare import instead of becoming the manifest's public URL, which the
|
|
79
|
-
* browser runtime plugin maps while resolving.
|
|
80
75
|
*/
|
|
81
76
|
export declare function createBrowserBuildRequest(appConfig: EcoPagesAppConfig, input: BrowserBuildRequestInput): BuildOptions;
|
|
@@ -4,17 +4,22 @@ import { createAliasResolverPlugin } from '../../plugins/alias-resolver-plugin.j
|
|
|
4
4
|
import { resolveBuildEnvironmentOptions } from './build-environment-options.js';
|
|
5
5
|
import { getJsxOwnershipPlugins } from '../browser/jsx-ownership-plugins.js';
|
|
6
6
|
import { createEcoComponentMetaPlugin } from '../../plugins/eco-component-meta-plugin.js';
|
|
7
|
+
import { getStylesheetKinds } from '../../plugins/stylesheet-kinds.js';
|
|
7
8
|
import { isProductionRuntime } from '../../env.js';
|
|
9
|
+
import { appLogger } from '../../global/app-logger.js';
|
|
8
10
|
import { createPreserveImportMetaPlugin } from '../preserve-import-meta-transform.js';
|
|
11
|
+
import { keepsLastGoodOutput, reportAssetFailure } from '../../assets/asset-processing-service/last-good-output.js';
|
|
12
|
+
import { emptyStylesheetModule } from '../../assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js';
|
|
13
|
+
import { compileStylesheetModule } from '../../assets/asset-processing-service/processors/stylesheet/stylesheet-module.js';
|
|
9
14
|
/**
|
|
10
15
|
* App-owned plugins of one environment, in the order their hooks run.
|
|
11
16
|
*
|
|
12
17
|
* @remarks
|
|
13
18
|
* Rolldown asks plugins in this order and the first one that returns a result for a resolve or load wins, so
|
|
14
19
|
* position is priority: the alias resolver, then the sealed manifest's plugins for the environment (for the browser,
|
|
15
|
-
* the plugins that also apply to the server,
|
|
16
|
-
*
|
|
17
|
-
*
|
|
20
|
+
* the plugins that also apply to the server, then the browser-only ones), then the JSX ownership plugins.
|
|
21
|
+
* {@link resolveBuildPluginOrder} puts caller plugins before them and core's own transforms after. The unified pages
|
|
22
|
+
* graph keys its cache by their names.
|
|
18
23
|
*/
|
|
19
24
|
export function resolveAppBuildPlugins(appConfig, environment) {
|
|
20
25
|
const projectDir = appConfig.absolutePaths?.projectDir;
|
|
@@ -29,9 +34,9 @@ export function resolveAppBuildPlugins(appConfig, environment) {
|
|
|
29
34
|
*
|
|
30
35
|
* @remarks
|
|
31
36
|
* App-manifest plugins cannot be silently replaced by same-name caller plugins.
|
|
32
|
-
* Unique caller plugins are prepended so first-wins Rolldown hooks
|
|
33
|
-
*
|
|
34
|
-
*
|
|
37
|
+
* Unique caller plugins are prepended so first-wins Rolldown hooks still run
|
|
38
|
+
* before general app loaders. Use `excludeAppBuildPlugins` on browser requests
|
|
39
|
+
* to omit app-owned plugins.
|
|
35
40
|
*/
|
|
36
41
|
export function mergeCallerBuildPlugins(appPlugins, callerPlugins, environment) {
|
|
37
42
|
if (!callerPlugins || callerPlugins.length === 0) {
|
|
@@ -49,7 +54,7 @@ export function mergeCallerBuildPlugins(appPlugins, callerPlugins, environment)
|
|
|
49
54
|
* that decides priority:
|
|
50
55
|
*
|
|
51
56
|
* 1. Caller plugins that apply to the environment and do not share a name with an app plugin, so a caller's
|
|
52
|
-
*
|
|
57
|
+
* alias rewrite runs before the general app loaders. A caller plugin cannot replace an app plugin of
|
|
53
58
|
* the same name.
|
|
54
59
|
* 2. {@link resolveAppBuildPlugins}, less the names in `excludeAppBuildPlugins`. Use it to omit app plugins that a
|
|
55
60
|
* request replaces; an environment cannot express that.
|
|
@@ -70,6 +75,52 @@ export function resolveBuildPluginOrder(appConfig, environment, options) {
|
|
|
70
75
|
}
|
|
71
76
|
return [...plugins, ...coreTransforms];
|
|
72
77
|
}
|
|
78
|
+
/** Messages of undeliverable stylesheet imports already warned about, by app. */
|
|
79
|
+
const warnedUndeliverableStylesheets = new WeakMap();
|
|
80
|
+
/**
|
|
81
|
+
* The app's stylesheets, which every build request compiles with {@link compileStylesheetModule}.
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* In `ecopages dev` (see {@link keepsLastGoodOutput}), a stylesheet that fails compiles to its last good module,
|
|
85
|
+
* so a Page that imports it still renders while the error shows.
|
|
86
|
+
*
|
|
87
|
+
* Outside production, a package module's own side-effect stylesheet import warns once per import instead of failing
|
|
88
|
+
* the build, so `ecopages dev` keeps running; `ecopages build` fails on it.
|
|
89
|
+
*/
|
|
90
|
+
function resolveBuildStylesheets(appConfig) {
|
|
91
|
+
const kinds = getStylesheetKinds(appConfig);
|
|
92
|
+
return {
|
|
93
|
+
extensions: kinds.extensions,
|
|
94
|
+
isCssModule: kinds.isCssModule,
|
|
95
|
+
compileModule: async (file) => {
|
|
96
|
+
try {
|
|
97
|
+
return await compileStylesheetModule(appConfig, file);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (!keepsLastGoodOutput(appConfig))
|
|
101
|
+
throw error;
|
|
102
|
+
reportAssetFailure(appConfig, 'stylesheet', file, error);
|
|
103
|
+
return (requireAppRuntime(appConfig).developmentStylesheets?.lastGoodModule(file) ?? {
|
|
104
|
+
code: emptyStylesheetModule(kinds.isCssModule(file)),
|
|
105
|
+
dependencies: [],
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
...(isProductionRuntime()
|
|
110
|
+
? {}
|
|
111
|
+
: {
|
|
112
|
+
reportUndeliverable: (error) => {
|
|
113
|
+
let warned = warnedUndeliverableStylesheets.get(appConfig);
|
|
114
|
+
if (!warned)
|
|
115
|
+
warnedUndeliverableStylesheets.set(appConfig, (warned = new Set()));
|
|
116
|
+
if (warned.has(error.message))
|
|
117
|
+
return;
|
|
118
|
+
warned.add(error.message);
|
|
119
|
+
appLogger.warn(error.message);
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
73
124
|
/**
|
|
74
125
|
* Assembles a complete server-oriented {@link BuildOptions} before scheduling.
|
|
75
126
|
*
|
|
@@ -87,7 +138,9 @@ export function createServerBuildRequest(appConfig, input) {
|
|
|
87
138
|
const importMetaDir = input.runtimeOutdir ?? input.outdir;
|
|
88
139
|
const plugins = resolveBuildPluginOrder(appConfig, 'server', {
|
|
89
140
|
callerPlugins: input.plugins,
|
|
90
|
-
coreTransforms: importMetaDir && !isProductionRuntime()
|
|
141
|
+
coreTransforms: importMetaDir && !isProductionRuntime()
|
|
142
|
+
? [createPreserveImportMetaPlugin(importMetaDir, appConfig.rootDir)]
|
|
143
|
+
: [],
|
|
91
144
|
});
|
|
92
145
|
const { plugins: _callerPlugins, ...overrides } = input;
|
|
93
146
|
return {
|
|
@@ -95,6 +148,7 @@ export function createServerBuildRequest(appConfig, input) {
|
|
|
95
148
|
...overrides,
|
|
96
149
|
environment: 'server',
|
|
97
150
|
entrypoints: input.entrypoints,
|
|
151
|
+
stylesheets: resolveBuildStylesheets(appConfig),
|
|
98
152
|
...(plugins.length > 0 ? { plugins } : {}),
|
|
99
153
|
};
|
|
100
154
|
}
|
|
@@ -106,11 +160,6 @@ export function createServerBuildRequest(appConfig, input) {
|
|
|
106
160
|
* chosen by {@link BrowserBundleService}.
|
|
107
161
|
*
|
|
108
162
|
* Plugins follow {@link resolveBuildPluginOrder}; `excludeAppBuildPlugins` omits app-owned names.
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* Specifiers of the browser runtime manifest are dropped from `external`. Rolldown checks `external` before any
|
|
112
|
-
* plugin, so one listed there would stay a bare import instead of becoming the manifest's public URL, which the
|
|
113
|
-
* browser runtime plugin maps while resolving.
|
|
114
163
|
*/
|
|
115
164
|
export function createBrowserBuildRequest(appConfig, input) {
|
|
116
165
|
const { excludeAppBuildPlugins, plugins: callerPlugins, define: callerDefines, ...overrides } = input;
|
|
@@ -118,17 +167,14 @@ export function createBrowserBuildRequest(appConfig, input) {
|
|
|
118
167
|
callerPlugins,
|
|
119
168
|
excludeAppBuildPlugins,
|
|
120
169
|
});
|
|
121
|
-
const { bySpecifier } = requireAppRuntime(appConfig).buildManifest.browserRuntimeManifest;
|
|
122
170
|
const environmentOptions = resolveBuildEnvironmentOptions('browser', appConfig);
|
|
123
171
|
return {
|
|
124
172
|
...environmentOptions,
|
|
125
173
|
...overrides,
|
|
126
174
|
define: { ...environmentOptions.define, ...callerDefines },
|
|
127
|
-
...(overrides.external
|
|
128
|
-
? { external: overrides.external.filter((specifier) => !bySpecifier.has(specifier)) }
|
|
129
|
-
: {}),
|
|
130
175
|
environment: 'browser',
|
|
131
176
|
entrypoints: input.entrypoints,
|
|
177
|
+
stylesheets: resolveBuildStylesheets(appConfig),
|
|
132
178
|
plugins,
|
|
133
179
|
};
|
|
134
180
|
}
|
|
@@ -5,6 +5,7 @@ export declare const IMPORTED_VIEW_PLUGIN_NAME = "ecopages-imported-views";
|
|
|
5
5
|
export declare function getImportedViewPaths(appConfig: EcoPagesAppConfig): readonly string[];
|
|
6
6
|
/**
|
|
7
7
|
* Turns Integration-owned imports in the server-entry graph into view references.
|
|
8
|
+
* A file without a default export is not a view and stays a real module.
|
|
8
9
|
*
|
|
9
10
|
* @remarks
|
|
10
11
|
* Register only on the server-entry bundle. Page and route-module builds must
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import path from '
|
|
2
|
-
import {
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
|
+
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
+
import { collectViewIntegrations, findViewOwner, isExemptFromViewReference, isViewModule, viewExtensionFilter, viewReferenceModuleSource, } from './view-reference.js';
|
|
3
4
|
export const IMPORTED_VIEW_PLUGIN_NAME = 'ecopages-imported-views';
|
|
4
5
|
const importedViewPaths = new WeakMap();
|
|
5
6
|
/** Paths the server-entry plugin turned into view references for this app. */
|
|
@@ -17,6 +18,7 @@ function recordImportedViewPath(appConfig, filePath) {
|
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Turns Integration-owned imports in the server-entry graph into view references.
|
|
21
|
+
* A file without a default export is not a view and stays a real module.
|
|
20
22
|
*
|
|
21
23
|
* @remarks
|
|
22
24
|
* Register only on the server-entry bundle. Page and route-module builds must
|
|
@@ -45,12 +47,12 @@ export function createImportedViewPlugin(appConfig, options = {}) {
|
|
|
45
47
|
return undefined;
|
|
46
48
|
}
|
|
47
49
|
const owner = findViewOwner(integrations, args.path);
|
|
48
|
-
if (!owner) {
|
|
50
|
+
if (!owner || !isViewModule(args.path, fileSystem.readFileSync(args.path))) {
|
|
49
51
|
return undefined;
|
|
50
52
|
}
|
|
51
53
|
recordImportedViewPath(appConfig, args.path);
|
|
52
54
|
return {
|
|
53
|
-
contents: viewReferenceModuleSource(args.path, owner.name),
|
|
55
|
+
contents: viewReferenceModuleSource(args.path, owner.name, appConfig.rootDir),
|
|
54
56
|
loader: 'js',
|
|
55
57
|
};
|
|
56
58
|
});
|
|
@@ -90,8 +90,7 @@ export declare class PageModuleImportService {
|
|
|
90
90
|
* error that names the source and says to run `ecopages build`. During
|
|
91
91
|
* `ecopages build`, before the map exists on disk, listing routes still compiles
|
|
92
92
|
* from source. `bypassCache` only skips the in-memory import promise, not the
|
|
93
|
-
* manifest.
|
|
94
|
-
* recorded source key, so `identity.file` from the build machine can load.
|
|
93
|
+
* manifest.
|
|
95
94
|
*/
|
|
96
95
|
private importFromProductionManifest;
|
|
97
96
|
private loadProductionManifestModule;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { collectBuildOutputImports, getBuildEntryOutput } from '../../build/build-graph.js';
|
|
2
|
-
import path from '
|
|
3
|
-
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { path } from '@ecopages/file-system/path';
|
|
4
3
|
import { fileSystem } from '@ecopages/file-system';
|
|
5
4
|
import { requireAppRuntime } from '../../utils/app-runtime.js';
|
|
6
5
|
import {} from '../../build/build-adapter.js';
|
|
@@ -87,8 +86,7 @@ export class PageModuleImportService {
|
|
|
87
86
|
* error that names the source and says to run `ecopages build`. During
|
|
88
87
|
* `ecopages build`, before the map exists on disk, listing routes still compiles
|
|
89
88
|
* from source. `bypassCache` only skips the in-memory import promise, not the
|
|
90
|
-
* manifest.
|
|
91
|
-
* recorded source key, so `identity.file` from the build machine can load.
|
|
89
|
+
* manifest.
|
|
92
90
|
*/
|
|
93
91
|
async importFromProductionManifest(options) {
|
|
94
92
|
const manifest = loadProductionServerModules(this.appConfig);
|
|
@@ -203,7 +201,7 @@ export class PageModuleImportService {
|
|
|
203
201
|
return undefined;
|
|
204
202
|
}
|
|
205
203
|
this.registerRouteModuleDependencies(cacheBuildOptions.filePath, Object.keys(cachedBuild.entry.dependencyHashes ?? {}));
|
|
206
|
-
const loadedModule = (await import(/* @vite-ignore */
|
|
204
|
+
const loadedModule = (await import(/* @vite-ignore */ path.toFileUrl(cachedBuild.outputPath).href));
|
|
207
205
|
this.recordPipelineLoad('route-module-cache-hit');
|
|
208
206
|
return loadedModule;
|
|
209
207
|
}
|
|
@@ -234,7 +232,7 @@ export class PageModuleImportService {
|
|
|
234
232
|
dependencyModulePaths,
|
|
235
233
|
outputImports: collectBuildOutputImports(buildResult, compiledOutput),
|
|
236
234
|
});
|
|
237
|
-
const compiledOutputUrl =
|
|
235
|
+
const compiledOutputUrl = path.toFileUrl(compiledOutput);
|
|
238
236
|
if (shouldAddRuntimeUpdateQuery()) {
|
|
239
237
|
compiledOutputUrl.searchParams.set('update', `${fileHash}-${this.getDevelopmentGeneration()}`);
|
|
240
238
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
1
2
|
import { getComponentIdentity } from '../../eco/component-identity.js';
|
|
2
3
|
import { isViewReference } from '../../types/view-reference.js';
|
|
3
4
|
import { createViewLoaderFromFilePath } from './import-view-module.js';
|
|
@@ -11,13 +12,13 @@ export function resolveStaticView(appConfig, view) {
|
|
|
11
12
|
throw new Error(PATH_VIEW_REMOVED);
|
|
12
13
|
}
|
|
13
14
|
if (isViewReference(view)) {
|
|
14
|
-
return createViewLoaderFromFilePath(appConfig, view.filePath);
|
|
15
|
+
return createViewLoaderFromFilePath(appConfig, path.resolve(appConfig.rootDir, view.filePath));
|
|
15
16
|
}
|
|
16
17
|
if (typeof view === 'function' && 'config' in view && view.config) {
|
|
17
18
|
const loader = async () => ({ default: view });
|
|
18
19
|
const filePath = getComponentIdentity(view)?.file;
|
|
19
20
|
if (filePath) {
|
|
20
|
-
loader.filePath = filePath;
|
|
21
|
+
loader.filePath = path.resolve(appConfig.rootDir, filePath);
|
|
21
22
|
}
|
|
22
23
|
return loader;
|
|
23
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { hashAppConfigFile } from '../../build/cache/app-config-hash.js';
|
|
3
3
|
import { requireAppRuntime } from '../../utils/app-runtime.js';
|
|
4
4
|
import { resolveInternalExecutionDir } from '../../utils/resolve-work-dir.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { fileSystem } from '@ecopages/file-system';
|
|
3
3
|
import { RouteModuleDependencyHasher } from './route-module-dependency-hasher.js';
|
|
4
4
|
import { createEmptyRouteModuleBuildCacheManifest, createRouteModuleBuildKey, normalizeRouteModuleCachePath, shouldCacheRouteModuleBuild, } from './route-module-build-manifest.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { isDevelopmentRuntime, isProductionRuntime } from '../../utils/runtime.js';
|
|
3
3
|
import { createBuildRequestIdentity } from '../../build/runtime/build-request-identity.js';
|
|
4
4
|
const ROUTE_MODULE_OUTPUT_NAMING_IDENTITY = '[route-module-output]';
|
|
@@ -62,5 +62,5 @@ export declare class RouteModuleDependencyHasher {
|
|
|
62
62
|
* @param rootDir - Project root used to normalize relative module ids.
|
|
63
63
|
* @returns Normalized module paths, falling back to the entrypoint when no graph is available.
|
|
64
64
|
*/
|
|
65
|
-
export declare function resolveRouteModuleDependencyPaths(buildResult: Pick<BuildSuccess, 'dependencyGraph'
|
|
65
|
+
export declare function resolveRouteModuleDependencyPaths(buildResult: Pick<BuildSuccess, 'dependencyGraph'>, entrypointPath: string, rootDir: string): string[];
|
|
66
66
|
export {};
|