@ecopages/core 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -143
- package/package.json +16 -3
- package/src/adapters/node/dev-session.js +2 -1
- package/src/adapters/node/node-client-bridge.d.ts +5 -7
- package/src/adapters/node/node-client-bridge.js +4 -14
- package/src/adapters/node/server-adapter.d.ts +4 -2
- package/src/adapters/node/server-adapter.js +13 -12
- package/src/adapters/shared/hmr/client-bridge.d.ts +25 -0
- package/src/adapters/shared/hmr/client-bridge.js +35 -0
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +1 -1
- package/src/adapters/shared/hmr/hmr-manager.d.ts +9 -2
- package/src/adapters/shared/hmr/hmr-manager.js +36 -6
- package/src/adapters/shared/http/dist-file-handler.js +3 -7
- package/src/adapters/shared/http/response-headers.d.ts +29 -0
- package/src/adapters/shared/http/response-headers.js +89 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +3 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +4 -3
- package/src/adapters/shared/runtime/server-request-pipeline.js +4 -4
- package/src/adapters/shared/runtime/server-static-builder.d.ts +19 -8
- package/src/adapters/shared/runtime/server-static-builder.js +23 -4
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +1 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +23 -16
- package/src/assets/app-browser-client-build.d.ts +5 -12
- package/src/assets/app-browser-client-build.js +121 -336
- package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +4 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.js +6 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +28 -8
- package/src/assets/asset-processing-service/asset-dependency-keys.js +104 -29
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +60 -2
- package/src/assets/asset-processing-service/asset-processing.service.js +189 -58
- package/src/assets/asset-processing-service/bundleable-script.d.ts +3 -0
- package/src/assets/asset-processing-service/bundleable-script.js +4 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -2
- package/src/assets/asset-processing-service/grouped-content-bundles.js +5 -10
- package/src/assets/asset-processing-service/index.d.ts +0 -3
- package/src/assets/asset-processing-service/index.js +0 -3
- package/src/assets/asset-processing-service/last-good-output.d.ts +21 -0
- package/src/assets/asset-processing-service/last-good-output.js +32 -0
- package/src/assets/asset-processing-service/page-package.js +1 -4
- package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +63 -0
- package/src/assets/asset-processing-service/processed-asset-ledger.js +101 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/base/base-script-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +24 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.js +59 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +18 -6
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +2 -3
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.d.ts +34 -0
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.js +115 -0
- package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -2
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.d.ts +39 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.js +150 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.d.ts +84 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.js +379 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +16 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +50 -24
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.d.ts +33 -0
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.js +67 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.d.ts +44 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.js +149 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.d.ts +31 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.js +59 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.d.ts +20 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.js +51 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.d.ts +2 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js +5 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.d.ts +37 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.js +48 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +25 -1
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +56 -15
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.d.ts +9 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.js +21 -0
- package/src/assets/browser-asset-output.js +1 -1
- package/src/assets/hashed-browser-asset.js +1 -1
- package/src/assets/{browser-runtime-asset-page-cache.d.ts → page-script-page-cache.d.ts} +3 -3
- package/src/assets/{browser-runtime-asset-page-cache.js → page-script-page-cache.js} +3 -3
- package/src/build/app-build-manifest-runtime.d.ts +23 -11
- package/src/build/app-build-manifest-runtime.js +52 -13
- package/src/build/browser/jsx-ownership-plugins.d.ts +4 -1
- package/src/build/browser/jsx-ownership-plugins.js +6 -0
- package/src/build/build-adapter.d.ts +1 -1
- package/src/build/build-adapter.js +1 -1
- package/src/build/build-graph.d.ts +4 -2
- package/src/build/build-graph.js +12 -46
- package/src/build/cache/build-input-dependency-index.d.ts +0 -19
- package/src/build/cache/build-input-dependency-index.js +1 -34
- package/src/build/cache/pages-unified-graph-build.js +7 -43
- package/src/build/cache/server-module-entries.d.ts +1 -1
- package/src/build/cache/server-module-entries.js +9 -9
- package/src/build/contracts/build-contracts.d.ts +59 -12
- package/src/build/contracts/build-manifest.d.ts +3 -6
- package/src/build/contracts/build-manifest.js +2 -12
- package/src/build/contracts/content-virtual-modules.js +1 -3
- package/src/build/copy-server-files.js +1 -1
- package/src/build/preserve-import-meta-transform.d.ts +3 -1
- package/src/build/preserve-import-meta-transform.js +7 -4
- package/src/build/production-asset-ledger.d.ts +36 -0
- package/src/build/production-asset-ledger.js +104 -0
- package/src/build/production-dist-complete.js +12 -13
- package/src/build/production-route-list.js +1 -1
- package/src/build/rolldown/app-package-declarations.js +1 -1
- package/src/build/rolldown/entry-module-closures.d.ts +5 -1
- package/src/build/rolldown/entry-module-closures.js +21 -8
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +19 -8
- package/src/build/rolldown/rolldown-adapter-helpers.js +82 -45
- package/src/build/rolldown/rolldown-build-adapter.js +10 -13
- package/src/build/rolldown/rolldown-module-id.d.ts +18 -0
- package/src/build/rolldown/rolldown-module-id.js +29 -0
- package/src/build/rolldown/rolldown-plugin-bridge.d.ts +24 -60
- package/src/build/rolldown/rolldown-plugin-bridge.js +201 -373
- package/src/build/rolldown/stylesheet-module-plugin.d.ts +34 -0
- package/src/build/rolldown/stylesheet-module-plugin.js +160 -0
- package/src/build/rolldown/worker-entries-plugin.d.ts +13 -0
- package/src/build/rolldown/worker-entries-plugin.js +57 -0
- package/src/build/runtime/build-environment-options.js +13 -3
- package/src/build/runtime/build-request-identity.js +1 -1
- package/src/build/runtime/build-request-policy.d.ts +7 -12
- package/src/build/runtime/build-request-policy.js +63 -17
- package/src/build/server/imported-view-plugin.d.ts +1 -0
- package/src/build/server/imported-view-plugin.js +6 -4
- package/src/build/server/page-module-import.service.d.ts +1 -2
- package/src/build/server/page-module-import.service.js +4 -6
- package/src/build/server/resolve-static-view.js +3 -2
- package/src/build/server/route-module-build-cache-registry.js +1 -1
- package/src/build/server/route-module-build-cache.store.js +1 -1
- package/src/build/server/route-module-build-manifest.js +1 -1
- package/src/build/server/route-module-dependency-hasher.d.ts +1 -1
- package/src/build/server/route-module-dependency-hasher.js +2 -2
- package/src/build/server/server-modules-manifest.d.ts +3 -5
- package/src/build/server/server-modules-manifest.js +6 -21
- package/src/build/server/view-module.d.ts +12 -0
- package/src/build/server/view-module.js +23 -0
- package/src/build/server/view-reference.d.ts +16 -5
- package/src/build/server/view-reference.js +25 -14
- package/src/build/server-bundle-deploy-manifest.d.ts +1 -1
- package/src/build/server-bundle-deploy-manifest.js +2 -2
- package/src/build/server-bundle-publication.d.ts +7 -1
- package/src/build/server-bundle-publication.js +11 -4
- package/src/build/server-module.js +1 -1
- package/src/build/worker-urls.d.ts +60 -0
- package/src/build/worker-urls.js +197 -0
- package/src/build.d.ts +7 -5
- package/src/build.js +7 -5
- package/src/cache/module-parse-cache.js +2 -2
- package/src/client/navigation-attributes.d.ts +8 -0
- package/src/client/navigation-attributes.js +8 -0
- package/src/client/navigation-scripts/global-scripts.d.ts +14 -0
- package/src/client/navigation-scripts/global-scripts.js +65 -0
- package/src/client/navigation-scripts/index.d.ts +1 -0
- package/src/client/navigation-scripts/index.js +1 -0
- package/src/client.d.ts +2 -2
- package/src/client.js +2 -2
- package/src/config/assembly/app-runtime.d.ts +45 -5
- package/src/config/assembly/app-runtime.js +11 -2
- package/src/config/assembly/finalize-config.js +13 -5
- package/src/config/config-module-files.js +10 -6
- package/src/config/index.d.ts +2 -1
- package/src/config/internal-types.d.ts +3 -0
- package/src/config/load-eco-config.js +8 -5
- package/src/config/resolve-eco-config-path.js +3 -3
- package/src/config/server-config-bundle.js +1 -1
- package/src/config/user-config-types.d.ts +54 -1
- package/src/config/write-types.js +4 -1
- package/src/css-imports.d.ts +12 -0
- package/src/declarations.d.ts +2 -0
- package/src/dev/development-restart-watch-paths.js +1 -1
- package/src/dev/development-restart.js +1 -1
- package/src/dev/invalidation/development-invalidation.service.d.ts +6 -1
- package/src/dev/invalidation/development-invalidation.service.js +18 -2
- package/src/dev/stylesheets/development-stylesheet.service.d.ts +149 -0
- package/src/dev/stylesheets/development-stylesheet.service.js +350 -0
- package/src/dev/transform-server/dev-transform-bundler.d.ts +12 -3
- package/src/dev/transform-server/dev-transform-bundler.js +32 -21
- package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +3 -5
- package/src/dev/transform-server/dev-transform-externalize-plugin.js +8 -9
- package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +15 -2
- package/src/dev/transform-server/dev-transform-import-rewriter.js +204 -35
- package/src/dev/transform-server/dev-transform-install-stamp.d.ts +17 -0
- package/src/dev/transform-server/dev-transform-install-stamp.js +79 -0
- package/src/dev/transform-server/dev-transform-server.d.ts +38 -2
- package/src/dev/transform-server/dev-transform-server.js +96 -33
- package/src/dev/transform-server/dev-transform-url.d.ts +4 -2
- package/src/dev/transform-server/dev-transform-url.js +13 -12
- package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +178 -21
- package/src/dev/transform-server/dev-transform-vendor-registry.js +675 -99
- package/src/dev/transform-server/index.d.ts +1 -1
- package/src/dev-toolbar/dev-toolbar-package.js +4 -4
- package/src/eco/component-render-output.d.ts +6 -1
- package/src/eco/component-render-output.js +32 -7
- package/src/eco/discovered-dependencies.d.ts +30 -11
- package/src/eco/discovered-dependencies.js +25 -13
- package/src/eco/discovered-dependency-paths.d.ts +36 -0
- package/src/eco/discovered-dependency-paths.js +58 -0
- package/src/eco/eco.browser.js +8 -12
- package/src/eco/eco.js +0 -30
- package/src/eco/mdx-page-metadata.d.ts +14 -0
- package/src/eco/mdx-page-metadata.js +15 -0
- package/src/eco/page-layout-normalization.d.ts +6 -2
- package/src/eco/page-layout-normalization.js +9 -6
- package/src/env.js +17 -0
- package/src/hmr/client/hmr-runtime.js +14 -13
- package/src/hmr/dev-client-runtime.d.ts +5 -2
- package/src/hmr/dev-client-runtime.js +14 -4
- package/src/hmr/hmr-entrypoint-output.js +1 -1
- package/src/hmr/hmr-strategy.d.ts +2 -2
- package/src/hmr/hmr-strategy.js +2 -2
- package/src/hmr/strategies/js-hmr-strategy.d.ts +4 -1
- package/src/hmr/strategies/js-hmr-strategy.js +7 -6
- package/src/hmr/strategies/template-source-hmr-strategy.d.ts +25 -0
- package/src/hmr/strategies/template-source-hmr-strategy.js +36 -0
- package/src/html-pages/html-page-module-scripts.d.ts +2 -1
- package/src/html-pages/html-page-module-scripts.js +37 -14
- package/src/html-pages/html-page-module.js +1 -1
- package/src/html-pages/html-page-renderer.js +7 -6
- package/src/html-pages/html-page-template.d.ts +0 -5
- package/src/html-pages/html-page-template.js +3 -15
- package/src/html-pages/html-pages.plugin.js +2 -2
- package/src/integration.d.ts +8 -6
- package/src/integration.js +5 -3
- package/src/page-cache/html-page-cache-dependency-index.js +1 -1
- package/src/page-cache/page-cache-service.js +1 -1
- package/src/plugins/alias-resolver-plugin.d.ts +7 -0
- package/src/plugins/alias-resolver-plugin.js +16 -6
- package/src/plugins/component-import-discovery.d.ts +178 -7
- package/src/plugins/component-import-discovery.js +696 -112
- package/src/plugins/eco-component-meta-plugin.d.ts +47 -6
- package/src/plugins/eco-component-meta-plugin.js +227 -59
- package/src/plugins/foreign-jsx-override-plugin.d.ts +14 -1
- package/src/plugins/foreign-jsx-override-plugin.js +18 -8
- package/src/plugins/integration-plugin.d.ts +47 -11
- package/src/plugins/integration-plugin.js +57 -8
- package/src/plugins/processor.d.ts +72 -7
- package/src/plugins/processor.js +44 -9
- package/src/plugins/stylesheet-kinds.d.ts +57 -0
- package/src/plugins/stylesheet-kinds.js +114 -0
- package/src/plugins/tsconfig-import-resolver.d.ts +49 -3
- package/src/plugins/tsconfig-import-resolver.js +120 -6
- package/src/processor-contract.d.ts +66 -0
- package/src/processor-contract.js +389 -0
- package/src/processor.d.ts +6 -1
- package/src/processor.js +6 -1
- package/src/route-renderer/error-pages/default-error-pages.d.ts +1 -0
- package/src/route-renderer/error-pages/default-error-pages.js +27 -7
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +12 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +77 -24
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +97 -32
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +1 -1
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +9 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +16 -2
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.d.ts +35 -0
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js +53 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +4 -8
- package/src/route-renderer/orchestration/foreign-child/render-session.js +2 -5
- package/src/route-renderer/orchestration/integration-renderer.d.ts +171 -64
- package/src/route-renderer/orchestration/integration-renderer.js +293 -332
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +8 -5
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +27 -25
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +0 -6
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +3 -3
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +12 -25
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +1 -14
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +0 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -87
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +8 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +25 -271
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +0 -24
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +0 -67
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +28 -15
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +63 -41
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -1
- package/src/route-renderer/page-loading/component-dependency-collection.js +51 -15
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +10 -0
- package/src/route-renderer/page-loading/dependency-resolver.js +27 -6
- package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +4 -2
- package/src/route-renderer/page-loading/file-scoped-dependency-components.js +22 -17
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +5 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.js +6 -4
- package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +5 -2
- package/src/route-renderer/page-loading/page-dependency-bundling.js +15 -31
- package/src/route-renderer/page-loading/page-module-loader.d.ts +13 -2
- package/src/route-renderer/page-loading/page-module-loader.js +23 -5
- package/src/route-renderer/route-renderer.d.ts +1 -1
- package/src/router/client/navigation-commit.d.ts +2 -0
- package/src/router/client/navigation-commit.js +4 -1
- package/src/router/client/navigation-coordinator.d.ts +18 -0
- package/src/router/client/navigation-coordinator.js +14 -0
- package/src/router/client/navigation-lifecycle.d.ts +18 -1
- package/src/router/client/navigation-lifecycle.js +6 -3
- package/src/router/client/navigation-pipeline.d.ts +1 -0
- package/src/router/client/navigation-pipeline.js +1 -0
- package/src/router/server/route-registry.d.ts +3 -2
- package/src/router/server/route-registry.js +6 -5
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +30 -18
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +82 -143
- package/src/static-site-generator/static-site-generator.d.ts +37 -4
- package/src/static-site-generator/static-site-generator.js +99 -51
- package/src/types/asset-types.d.ts +19 -1
- package/src/types/build-types.d.ts +53 -35
- package/src/types/component-identity.d.ts +8 -0
- package/src/types/contracts.d.ts +69 -21
- package/src/types/dev-transform-types.d.ts +33 -6
- package/src/types/eco-api-types.d.ts +13 -18
- package/src/types/integration-types.d.ts +1 -1
- package/src/types/public-types.d.ts +1 -1
- package/src/utils/additional-watch-paths.js +3 -5
- package/src/utils/entry-command-flags.d.ts +23 -0
- package/src/utils/entry-command-flags.js +24 -0
- package/src/utils/package-path.d.ts +42 -0
- package/src/utils/package-path.js +114 -0
- package/src/utils/parse-cli-args.d.ts +18 -1
- package/src/utils/parse-cli-args.js +54 -37
- package/src/utils/path-containment.js +3 -10
- package/src/utils/resolve-work-dir.js +2 -2
- package/src/utils/root-relative-path.js +2 -2
- package/src/utils/server-bundle-context.d.ts +5 -0
- package/src/utils/server-bundle-context.js +7 -1
- package/src/utils/server-utils.module.js +1 -1
- package/src/watchers/project-watcher-ignore.js +3 -3
- package/src/watchers/project-watcher.d.ts +14 -2
- package/src/watchers/project-watcher.js +37 -6
- package/src/watchers/workspace-package-watch-roots.js +2 -2
- package/src/assets/app-browser-client-manifest.d.ts +0 -66
- package/src/assets/app-browser-client-manifest.js +0 -260
- package/src/assets/asset-processing-service/asset-package-role.d.ts +0 -2
- package/src/assets/asset-processing-service/asset-package-role.js +0 -3
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +0 -58
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -61
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +0 -79
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +0 -200
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +0 -24
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -67
- package/src/build/browser/browser-runtime-manifest.d.ts +0 -35
- package/src/build/browser/browser-runtime-manifest.js +0 -65
- package/src/build/browser/browser-runtime-plugin-helpers.d.ts +0 -14
- package/src/build/browser/browser-runtime-plugin-helpers.js +0 -21
- package/src/build/browser/browser-runtime-plugin.d.ts +0 -54
- package/src/build/browser/browser-runtime-plugin.js +0 -76
- package/src/build/rolldown/server-side-css-shim-plugin.d.ts +0 -28
- package/src/build/rolldown/server-side-css-shim-plugin.js +0 -59
- package/src/dev/transform-server/dev-transform-module-kind.d.ts +0 -13
- package/src/dev/transform-server/dev-transform-module-kind.js +0 -17
- package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +0 -5
- package/src/dev/transform-server/dev-transform-runtime-specifiers.js +0 -16
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +0 -15
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +0 -65
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +0 -21
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +0 -31
|
@@ -46,7 +46,7 @@ export declare const HmrStrategyType: {
|
|
|
46
46
|
readonly SCRIPT: 25;
|
|
47
47
|
/**
|
|
48
48
|
* Fallback strategy for unhandled file types.
|
|
49
|
-
* Lowest priority,
|
|
49
|
+
* Lowest priority, evaluated after integration and script strategies.
|
|
50
50
|
*/
|
|
51
51
|
readonly FALLBACK: 0;
|
|
52
52
|
};
|
|
@@ -123,7 +123,7 @@ export declare abstract class HmrStrategy implements HmrStrategyContract {
|
|
|
123
123
|
* module in the per-file ESM graph (pages and imported children). File-change
|
|
124
124
|
* dispatch continues to use {@link matches}.
|
|
125
125
|
*/
|
|
126
|
-
ownsDevTransformEntrypoint(_sourcePath: string): boolean;
|
|
126
|
+
ownsDevTransformEntrypoint(_sourcePath: string, _variant?: string): boolean;
|
|
127
127
|
/**
|
|
128
128
|
* Processes a file change and returns the action to take.
|
|
129
129
|
*
|
package/src/hmr/hmr-strategy.js
CHANGED
|
@@ -44,7 +44,7 @@ export const HmrStrategyType = {
|
|
|
44
44
|
SCRIPT: 25,
|
|
45
45
|
/**
|
|
46
46
|
* Fallback strategy for unhandled file types.
|
|
47
|
-
* Lowest priority,
|
|
47
|
+
* Lowest priority, evaluated after integration and script strategies.
|
|
48
48
|
*/
|
|
49
49
|
FALLBACK: 0,
|
|
50
50
|
};
|
|
@@ -104,7 +104,7 @@ export class HmrStrategy {
|
|
|
104
104
|
* module in the per-file ESM graph (pages and imported children). File-change
|
|
105
105
|
* dispatch continues to use {@link matches}.
|
|
106
106
|
*/
|
|
107
|
-
ownsDevTransformEntrypoint(_sourcePath) {
|
|
107
|
+
ownsDevTransformEntrypoint(_sourcePath, _variant) {
|
|
108
108
|
return false;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -22,6 +22,8 @@ export interface JsHmrContext extends HmrRegisteredEntrypointsContext {
|
|
|
22
22
|
getPagesDir(): string;
|
|
23
23
|
getLayoutsDir(): string;
|
|
24
24
|
getTemplateExtensions(): string[];
|
|
25
|
+
/** Whether `filePath` is a stylesheet, which a served module can import as text. */
|
|
26
|
+
isStylesheet(filePath: string): boolean;
|
|
25
27
|
/**
|
|
26
28
|
* @remarks
|
|
27
29
|
* Integrations with higher-priority HMR strategies can use this to keep the
|
|
@@ -43,7 +45,8 @@ export declare class JsHmrStrategy extends HmrStrategy {
|
|
|
43
45
|
* With a selective dependency graph, a file the dev transform has not served and no served module
|
|
44
46
|
* imports is left to the fallback reload: hot-updating the watched entrypoints would not apply it.
|
|
45
47
|
* That covers server-only modules and HTML Page classic scripts, which are compiled outside the dev
|
|
46
|
-
* transform.
|
|
48
|
+
* transform. A stylesheet a served module imports as text matches the same way, so its importer re-imports
|
|
49
|
+
* the new CSS.
|
|
47
50
|
*/
|
|
48
51
|
matches(filePath: string): boolean;
|
|
49
52
|
private resolveImpactedEntrypoints;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module
|
|
9
9
|
*/
|
|
10
|
-
import path from '
|
|
10
|
+
import { path } from '@ecopages/file-system/path';
|
|
11
11
|
import { HmrStrategy, HmrStrategyType } from '../hmr-strategy.js';
|
|
12
12
|
import { appLogger } from '../../global/app-logger.js';
|
|
13
13
|
import { isRegisteredDevTransformEntrypoint, isRegisteredScriptEntrypoint } from '../hmr-entrypoint-output.js';
|
|
@@ -26,21 +26,22 @@ export class JsHmrStrategy extends HmrStrategy {
|
|
|
26
26
|
* With a selective dependency graph, a file the dev transform has not served and no served module
|
|
27
27
|
* imports is left to the fallback reload: hot-updating the watched entrypoints would not apply it.
|
|
28
28
|
* That covers server-only modules and HTML Page classic scripts, which are compiled outside the dev
|
|
29
|
-
* transform.
|
|
29
|
+
* transform. A stylesheet a served module imports as text matches the same way, so its importer re-imports
|
|
30
|
+
* the new CSS.
|
|
30
31
|
*/
|
|
31
32
|
matches(filePath) {
|
|
32
33
|
const watchedFiles = this.context.getWatchedFiles();
|
|
33
34
|
const resolvedPath = path.resolve(filePath);
|
|
34
|
-
const
|
|
35
|
+
const isModule = /\.(ts|tsx|js|jsx)$/.test(resolvedPath) || this.context.isStylesheet(resolvedPath);
|
|
35
36
|
const srcDir = path.resolve(this.context.getSrcDir());
|
|
36
|
-
const isInSrc = resolvedPath.startsWith(`${srcDir}
|
|
37
|
+
const isInSrc = resolvedPath.startsWith(`${srcDir}/`) || resolvedPath === srcDir;
|
|
37
38
|
const isIntegrationTemplate = this.context
|
|
38
39
|
.getTemplateExtensions()
|
|
39
40
|
.some((extension) => resolvedPath.endsWith(extension));
|
|
40
41
|
if (watchedFiles.size === 0) {
|
|
41
42
|
return false;
|
|
42
43
|
}
|
|
43
|
-
if (!
|
|
44
|
+
if (!isModule || !isInSrc) {
|
|
44
45
|
return false;
|
|
45
46
|
}
|
|
46
47
|
if (watchedFiles.has(resolvedPath)) {
|
|
@@ -97,7 +98,7 @@ export class JsHmrStrategy extends HmrStrategy {
|
|
|
97
98
|
}
|
|
98
99
|
const { devTransformUpdates, devTransformReloadRequired } = this.collectDevTransformHmrOutcome(buildableEntrypoints, watchedFiles, registeredEntrypoints);
|
|
99
100
|
if (devTransformReloadRequired) {
|
|
100
|
-
appLogger.debug(`[JsHmrStrategy] Full reload required
|
|
101
|
+
appLogger.debug(`[JsHmrStrategy] Full reload required: a script entrypoint change handler requested it`);
|
|
101
102
|
return {
|
|
102
103
|
type: 'broadcast',
|
|
103
104
|
events: [{ type: 'reload' }],
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HMR strategy for files with an integration template extension, such as Kita, Lit or MDX pages, layouts and
|
|
3
|
+
* components, that no integration or script strategy claims.
|
|
4
|
+
*
|
|
5
|
+
* Such a file only shapes server-rendered markup, so a `layout-update` lets the active navigation runtime
|
|
6
|
+
* refresh the current page in place. Without a navigation runtime the client reloads the document.
|
|
7
|
+
*/
|
|
8
|
+
import { HmrStrategy, type HmrAction } from '../hmr-strategy.js';
|
|
9
|
+
import type { HmrRegisteredEntrypointsContext } from '../hmr-registered-entrypoints-context.js';
|
|
10
|
+
import type { DevelopmentInvalidationService } from '../../dev/invalidation/development-invalidation.service.js';
|
|
11
|
+
/**
|
|
12
|
+
* @remarks
|
|
13
|
+
* Ranks below every integration and script strategy, so a template an integration owns (a React page) or the
|
|
14
|
+
* browser loads as a module (a served Lit component) keeps that strategy's update. A registered script
|
|
15
|
+
* entrypoint is never claimed: an in-place refresh keeps a head module script with the same URL, so the changed
|
|
16
|
+
* script would not run again.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TemplateSourceHmrStrategy extends HmrStrategy {
|
|
19
|
+
private readonly invalidationService;
|
|
20
|
+
private readonly context;
|
|
21
|
+
readonly type: 0;
|
|
22
|
+
constructor(invalidationService: DevelopmentInvalidationService, context: HmrRegisteredEntrypointsContext);
|
|
23
|
+
matches(filePath: string): boolean;
|
|
24
|
+
process(filePath: string): Promise<HmrAction>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HMR strategy for files with an integration template extension, such as Kita, Lit or MDX pages, layouts and
|
|
3
|
+
* components, that no integration or script strategy claims.
|
|
4
|
+
*
|
|
5
|
+
* Such a file only shapes server-rendered markup, so a `layout-update` lets the active navigation runtime
|
|
6
|
+
* refresh the current page in place. Without a navigation runtime the client reloads the document.
|
|
7
|
+
*/
|
|
8
|
+
import { HmrStrategy, HmrStrategyType } from '../hmr-strategy.js';
|
|
9
|
+
import { isRegisteredScriptEntrypoint } from '../hmr-entrypoint-output.js';
|
|
10
|
+
/**
|
|
11
|
+
* @remarks
|
|
12
|
+
* Ranks below every integration and script strategy, so a template an integration owns (a React page) or the
|
|
13
|
+
* browser loads as a module (a served Lit component) keeps that strategy's update. A registered script
|
|
14
|
+
* entrypoint is never claimed: an in-place refresh keeps a head module script with the same URL, so the changed
|
|
15
|
+
* script would not run again.
|
|
16
|
+
*/
|
|
17
|
+
export class TemplateSourceHmrStrategy extends HmrStrategy {
|
|
18
|
+
invalidationService;
|
|
19
|
+
context;
|
|
20
|
+
type = HmrStrategyType.FALLBACK;
|
|
21
|
+
constructor(invalidationService, context) {
|
|
22
|
+
super();
|
|
23
|
+
this.invalidationService = invalidationService;
|
|
24
|
+
this.context = context;
|
|
25
|
+
}
|
|
26
|
+
matches(filePath) {
|
|
27
|
+
return (this.invalidationService.isTemplateSourceFile(filePath) &&
|
|
28
|
+
!isRegisteredScriptEntrypoint(this.context.getRegisteredEntrypoints(), filePath));
|
|
29
|
+
}
|
|
30
|
+
async process(filePath) {
|
|
31
|
+
return {
|
|
32
|
+
type: 'broadcast',
|
|
33
|
+
events: [{ type: 'layout-update', path: filePath, timestamp: Date.now() }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -67,7 +67,8 @@ type ModuleScriptScan = {
|
|
|
67
67
|
* component meta transform moves into Component Dependencies are not reported.
|
|
68
68
|
*
|
|
69
69
|
* Relative and tsconfig-alias imports are followed; packages are not scanned, but a side-effect
|
|
70
|
-
* import of a package stylesheet is reported
|
|
70
|
+
* import of a package stylesheet is reported, except in a module with an `eco.*()` declaration,
|
|
71
|
+
* which moves it into its Dependencies. The result is kept while the visited files keep
|
|
71
72
|
* their contents. The scan stops at the first stylesheet import, so the visited
|
|
72
73
|
* files then include every file whose edit can remove it.
|
|
73
74
|
*/
|
|
@@ -2,14 +2,15 @@ import { contentHash } from '../utils/content-hash.js';
|
|
|
2
2
|
import { getBuildEntryOutput } from '../build/build-graph.js';
|
|
3
3
|
import { assertBuildSucceeded } from '../build/build-log.js';
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
|
-
import path from '
|
|
5
|
+
import { path } from '@ecopages/file-system/path';
|
|
6
6
|
import { fileSystem } from '@ecopages/file-system';
|
|
7
7
|
import { parseModuleSource } from '../cache/module-parse-cache.js';
|
|
8
8
|
import { requireAppRuntime } from '../utils/app-runtime.js';
|
|
9
9
|
import { RESOLVED_ASSETS_DIR } from '../constants.js';
|
|
10
|
-
import {
|
|
10
|
+
import { getStylesheetKinds } from '../plugins/stylesheet-kinds.js';
|
|
11
|
+
import { isCssImport, isDeliveredStylesheetImport } from '../plugins/component-import-discovery.js';
|
|
11
12
|
import { stripsSideEffectStylesheetImports } from '../plugins/eco-component-meta-plugin.js';
|
|
12
|
-
import { isBarePackageImportSpecifier, resolveProjectModulePath } from '../plugins/tsconfig-import-resolver.js';
|
|
13
|
+
import { isBarePackageImportSpecifier, loadTsconfigPathPrefixes, resolveProjectModulePath, } from '../plugins/tsconfig-import-resolver.js';
|
|
13
14
|
import { BrowserBundleService } from '../assets/browser-bundle.service.js';
|
|
14
15
|
import { isProductionRuntime } from '../utils/runtime.js';
|
|
15
16
|
import { compileHtmlPage, compileHtmlShell } from './html-page-template.js';
|
|
@@ -104,20 +105,36 @@ function bindsNothing(statement) {
|
|
|
104
105
|
}
|
|
105
106
|
function resolvePackageFile(importer, specifier) {
|
|
106
107
|
try {
|
|
107
|
-
return createRequire(importer).resolve(specifier);
|
|
108
|
+
return path.fromNative(createRequire(importer).resolve(specifier));
|
|
108
109
|
}
|
|
109
110
|
catch {
|
|
110
111
|
return undefined;
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
/** The stylesheet an import names, by its resolved path or, when it does not resolve, its specifier. */
|
|
114
|
-
function stylesheetPath(appConfig, importer, specifier, resolved) {
|
|
115
|
+
function stylesheetPath(appConfig, kinds, importer, specifier, resolved) {
|
|
115
116
|
const target = resolved ??
|
|
116
117
|
(isBarePackageImportSpecifier(specifier, appConfig.rootDir)
|
|
117
118
|
? resolvePackageFile(importer, specifier)
|
|
118
119
|
: undefined) ??
|
|
119
120
|
specifier;
|
|
120
|
-
return
|
|
121
|
+
return kinds.isStylesheet(target) ? target : undefined;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Whether the component meta transform moves the side-effect import of a package specifier into Component
|
|
125
|
+
* Dependencies, by the rule it applies.
|
|
126
|
+
*
|
|
127
|
+
* @remarks
|
|
128
|
+
* An import the transform would refuse is reported here instead.
|
|
129
|
+
*/
|
|
130
|
+
function deliversPackageStylesheet(appConfig, kinds, importer, specifier) {
|
|
131
|
+
const entry = { source: specifier, start: 0, end: 0, bindings: [], sideEffectOnly: true, attributed: false };
|
|
132
|
+
try {
|
|
133
|
+
return isDeliveredStylesheetImport(entry, importer, appConfig.rootDir, loadTsconfigPathPrefixes(appConfig.rootDir), kinds);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
121
138
|
}
|
|
122
139
|
/**
|
|
123
140
|
* Returns the first side-effect stylesheet import of `file`, or the local modules it imports.
|
|
@@ -126,6 +143,7 @@ function readModuleImports(appConfig, file) {
|
|
|
126
143
|
const source = fileSystem.readFileSync(file);
|
|
127
144
|
const { program, module } = parseModuleSource(file, source);
|
|
128
145
|
const stripped = stripsSideEffectStylesheetImports(appConfig, file, source);
|
|
146
|
+
const kinds = getStylesheetKinds(appConfig);
|
|
129
147
|
const resolve = (specifier) => resolveProjectModulePath(appConfig.rootDir, file, specifier, { preserveBarrel: true });
|
|
130
148
|
const dependencies = [];
|
|
131
149
|
for (const statement of program.body) {
|
|
@@ -133,10 +151,14 @@ function readModuleImports(appConfig, file) {
|
|
|
133
151
|
if (!specifier || isTypeOnly(statement))
|
|
134
152
|
continue;
|
|
135
153
|
const resolved = resolve(specifier);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
154
|
+
if (bindsNothing(statement)) {
|
|
155
|
+
const stylesheet = stylesheetPath(appConfig, kinds, file, specifier, resolved);
|
|
156
|
+
const strippedByTransform = stripped &&
|
|
157
|
+
statement.type === 'ImportDeclaration' &&
|
|
158
|
+
(resolved === undefined
|
|
159
|
+
? deliversPackageStylesheet(appConfig, kinds, file, specifier)
|
|
160
|
+
: isCssImport(specifier, kinds));
|
|
161
|
+
if (stylesheet && !strippedByTransform)
|
|
140
162
|
return { stylesheet, dependencies };
|
|
141
163
|
}
|
|
142
164
|
if (resolved)
|
|
@@ -163,7 +185,8 @@ function readModuleImports(appConfig, file) {
|
|
|
163
185
|
* component meta transform moves into Component Dependencies are not reported.
|
|
164
186
|
*
|
|
165
187
|
* Relative and tsconfig-alias imports are followed; packages are not scanned, but a side-effect
|
|
166
|
-
* import of a package stylesheet is reported
|
|
188
|
+
* import of a package stylesheet is reported, except in a module with an `eco.*()` declaration,
|
|
189
|
+
* which moves it into its Dependencies. The result is kept while the visited files keep
|
|
167
190
|
* their contents. The scan stops at the first stylesheet import, so the visited
|
|
168
191
|
* files then include every file whose edit can remove it.
|
|
169
192
|
*/
|
|
@@ -213,7 +236,7 @@ function listHtmlFiles(appConfig) {
|
|
|
213
236
|
function fingerprint(files, rootDir) {
|
|
214
237
|
return files
|
|
215
238
|
.map((file) => {
|
|
216
|
-
const relativePath = path.relative(rootDir, file)
|
|
239
|
+
const relativePath = path.relative(rootDir, file);
|
|
217
240
|
if (!fileSystem.exists(file))
|
|
218
241
|
return `${relativePath}:missing`;
|
|
219
242
|
return `${relativePath}:${contentHash(fileSystem.readFileSync(file))}`;
|
|
@@ -260,7 +283,7 @@ async function buildModuleScripts(appConfig, referencedScripts) {
|
|
|
260
283
|
for (const script of scripts) {
|
|
261
284
|
const baseName = path
|
|
262
285
|
.relative(srcDir, script)
|
|
263
|
-
.split(
|
|
286
|
+
.split('/')
|
|
264
287
|
.join('/')
|
|
265
288
|
.replace(/\.[^./]+$/, '');
|
|
266
289
|
let name = baseName;
|
|
@@ -288,7 +311,7 @@ async function buildModuleScripts(appConfig, referencedScripts) {
|
|
|
288
311
|
for (const script of scripts) {
|
|
289
312
|
const output = getBuildEntryOutput(result, script, appConfig.rootDir);
|
|
290
313
|
if (output)
|
|
291
|
-
urls.set(fileSystem.realpath(script), `/${path.relative(distDir, output)
|
|
314
|
+
urls.set(fileSystem.realpath(script), `/${path.relative(distDir, output)}`);
|
|
292
315
|
}
|
|
293
316
|
return urls;
|
|
294
317
|
}
|
|
@@ -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 { registerDiscoveredDependencies } from '../eco/discovered-dependencies.js';
|
|
4
4
|
import { appLogger } from '../global/app-logger.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 { AssetFactory } from '../assets/asset-processing-service/asset.factory.js';
|
|
4
4
|
import { hasProductionServerModule } from '../build/server/server-modules-manifest.js';
|
|
@@ -6,11 +6,12 @@ import { StringMarkupRenderer } from '../route-renderer/orchestration/string-mar
|
|
|
6
6
|
import { findElements, parseHtml } from '../html/html-source-parser.js';
|
|
7
7
|
import { escapeHtmlAttribute } from '../utils/html-escaping.js';
|
|
8
8
|
import { invariant } from '../utils/invariant.js';
|
|
9
|
+
import { listCssReferences } from '../assets/asset-processing-service/processors/stylesheet/css-scanner.js';
|
|
9
10
|
import { resolveClassicScriptOptions } from './html-page-classic-script.js';
|
|
10
11
|
import { findHtmlFilesLoading, getHtmlPageModuleScriptUrls, scanModuleScript } from './html-page-module-scripts.js';
|
|
11
12
|
import { reconcileHtmlPageDocument } from './html-page-document.js';
|
|
12
13
|
import { getBuiltInHtmlShell, getCompiledHtmlTemplate, HTML_PAGES_INTEGRATION_NAME, warnHtmlTemplateRender, } from './html-page-module.js';
|
|
13
|
-
import {
|
|
14
|
+
import { getHtmlAssetKey, } from './html-page-template.js';
|
|
14
15
|
/**
|
|
15
16
|
* Brackets the Page markup so it can be wrapped in a `<body>` when the shell
|
|
16
17
|
* renders none, as JSX shells that leave `<body>` to Layouts do.
|
|
@@ -184,7 +185,7 @@ export class HtmlPageRenderer extends StringMarkupRenderer {
|
|
|
184
185
|
if (asset.kind === 'inline-style') {
|
|
185
186
|
const processed = await this.processAsset(AssetFactory.createInlineContentStylesheet({ content: asset.content, processingOrigin: `${file}.css` }));
|
|
186
187
|
invariant(processed?.content !== undefined, `${file}: could not process an inline <style>; the asset pipeline logged the cause.`);
|
|
187
|
-
for (const url of
|
|
188
|
+
for (const url of listCssReferences(processed.content).references) {
|
|
188
189
|
warnHtmlTemplateRender(this.appConfig, file, `style-url:${url}`, () => `${file}: url(${url}) in a processed <style> is left as written, so the browser resolves it against the route URL. Move the file to the public directory and use a root-relative URL.`);
|
|
189
190
|
}
|
|
190
191
|
return `${asset.tag.slice(0, asset.contentStart)}${escapeStyleContent(processed.content)}${asset.tag.slice(asset.contentEnd)}`;
|
|
@@ -274,15 +275,15 @@ export class HtmlPageRenderer extends StringMarkupRenderer {
|
|
|
274
275
|
return;
|
|
275
276
|
const real = (target) => (fileSystem.exists(target) ? fileSystem.realpath(target) : target);
|
|
276
277
|
const rootDir = real(this.appConfig.rootDir);
|
|
277
|
-
const show = (target) => path.isAbsolute(target) ? path.relative(rootDir, real(target))
|
|
278
|
+
const show = (target) => (path.isAbsolute(target) ? path.relative(rootDir, real(target)) : target);
|
|
278
279
|
const stylesheet = real(found.stylesheet);
|
|
279
280
|
const through = found.importer === path.resolve(script) ? '' : ` through ${show(found.importer)}`;
|
|
280
281
|
const srcDir = real(this.appConfig.absolutePaths.srcDir);
|
|
281
282
|
const href = path
|
|
282
283
|
.relative(path.dirname(real(file)), stylesheet)
|
|
283
|
-
.split(
|
|
284
|
+
.split('/')
|
|
284
285
|
.join('/');
|
|
285
|
-
const fix = stylesheet.startsWith(`${srcDir}
|
|
286
|
+
const fix = stylesheet.startsWith(`${srcDir}/`)
|
|
286
287
|
? `Load it with <link rel="stylesheet" href="${href.startsWith('../') ? href : `./${href}`}"> in ${show(file)} instead.`
|
|
287
288
|
: `A <link> cannot point outside ${show(srcDir)}, so copy the stylesheet under ${show(srcDir)} and link it from ${show(file)} instead.`;
|
|
288
289
|
throw new Error(`[ecopages] ${show(file)}: "${reference}" imports ${show(stylesheet)}${through}, which a module script cannot add to the Page. ${fix}`);
|
|
@@ -81,11 +81,6 @@ export type CompileHtmlTemplateOptions = {
|
|
|
81
81
|
warn?: (message: string) => void;
|
|
82
82
|
};
|
|
83
83
|
export declare const CHILDREN_MARKER = "eco:children";
|
|
84
|
-
/**
|
|
85
|
-
* @remarks
|
|
86
|
-
* Reads `url()` and the string URLs of `image-set()`, and skips comments.
|
|
87
|
-
*/
|
|
88
|
-
export declare function findRelativeCssUrls(css: string): string[];
|
|
89
84
|
/**
|
|
90
85
|
* Returns the singleton identity of a head tag, if it has one.
|
|
91
86
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { parseModuleSource } from '../cache/module-parse-cache.js';
|
|
3
|
+
import { listCssReferences } from '../assets/asset-processing-service/processors/stylesheet/css-scanner.js';
|
|
3
4
|
import { escapeHtmlAttribute } from '../utils/html-escaping.js';
|
|
4
5
|
import { isPathInside } from '../utils/path-containment.js';
|
|
5
6
|
import { findElements, getAttribute, getElementText, decodeHtmlEntities, HEAD_CONTENT_ELEMENTS, parseHtml, walkElements, } from '../html/html-source-parser.js';
|
|
@@ -15,19 +16,6 @@ function isRelativeUrl(value) {
|
|
|
15
16
|
const url = value.trim();
|
|
16
17
|
return url.length > 0 && !URL_SCHEME.test(url) && !/^[/#?]/.test(url);
|
|
17
18
|
}
|
|
18
|
-
/**
|
|
19
|
-
* @remarks
|
|
20
|
-
* Reads `url()` and the string URLs of `image-set()`, and skips comments.
|
|
21
|
-
*/
|
|
22
|
-
export function findRelativeCssUrls(css) {
|
|
23
|
-
const code = css.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
24
|
-
const urls = [...code.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/gi)].map((match) => match[2]);
|
|
25
|
-
for (const [, args] of code.matchAll(/image-set\(((?:[^()]|\([^()]*\))*)\)/gi)) {
|
|
26
|
-
const strings = args.replace(/url\([^)]*\)/gi, '').matchAll(/(['"])(.*?)\1/g);
|
|
27
|
-
urls.push(...[...strings].map((match) => match[2]));
|
|
28
|
-
}
|
|
29
|
-
return [...new Set(urls)].filter(isRelativeUrl);
|
|
30
|
-
}
|
|
31
19
|
function attributeValue(element, name) {
|
|
32
20
|
return getAttribute(element, name)?.value;
|
|
33
21
|
}
|
|
@@ -154,7 +142,7 @@ const FETCHED_URLS = new Map([
|
|
|
154
142
|
['href', hrefUrls],
|
|
155
143
|
['xlink:href', hrefUrls],
|
|
156
144
|
['data', (element, value) => (element.tagName === 'object' ? [value] : [])],
|
|
157
|
-
['style', (_element, value) =>
|
|
145
|
+
['style', (_element, value) => listCssReferences(value).references],
|
|
158
146
|
]);
|
|
159
147
|
const SOCIAL_IMAGE_KEY = /^meta:(og:image(?::url|:secure_url)?|twitter:image(?::src)?)$/;
|
|
160
148
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { IntegrationPlugin } from '../plugins/integration-plugin.js';
|
|
3
3
|
import { HTML_PAGES_INTEGRATION_NAME, loadHtmlPageModule, reviveHtmlPageModule, serializeHtmlPageModule, } from './html-page-module.js';
|
|
4
4
|
import { HtmlPageRenderer } from './html-page-renderer.js';
|
|
@@ -24,7 +24,7 @@ export class HtmlPagesPlugin extends IntegrationPlugin {
|
|
|
24
24
|
compilePageModule(filePath, appConfig) {
|
|
25
25
|
const file = path.resolve(filePath);
|
|
26
26
|
const { pagesDir, htmlTemplatePath } = appConfig.absolutePaths;
|
|
27
|
-
if (!file.startsWith(`${pagesDir}
|
|
27
|
+
if (!file.startsWith(`${pagesDir}/`) && file !== htmlTemplatePath) {
|
|
28
28
|
throw new Error(`[ecopages] ${file} is neither a Page under ${pagesDir} nor the HTML template, so HTML Pages cannot load it.`);
|
|
29
29
|
}
|
|
30
30
|
return loadHtmlPageModule(appConfig, file);
|
package/src/integration.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
export { APP_BROWSER_CLIENT_BUNDLE_ID, type AssetDefinition, AssetFactory, type AssetProcessingIntegration, AssetProcessingService,
|
|
1
|
+
export { APP_BROWSER_CLIENT_BUNDLE_ID, type AssetDefinition, AssetFactory, type AssetProcessingIntegration, AssetProcessingService, type ContentScriptAsset, createAppBrowserClientEntry, type ProcessedAsset, } from './assets/asset-processing-service/index.js';
|
|
2
2
|
export type { AppRuntime } from './config/assembly/app-runtime.js';
|
|
3
3
|
export { requireAppRuntime } from './utils/app-runtime.js';
|
|
4
|
-
export { DEV_TRANSFORM_URL_PREFIX, type DevTransformBundleContributor } from './dev/transform-server/index.js';
|
|
4
|
+
export { DEV_TRANSFORM_URL_PREFIX, type DevTransformBundleContributor, type DevTransformVendorEntries, } from './dev/transform-server/index.js';
|
|
5
5
|
export { type ForeignChildInterceptionInput, type ForeignChildInterceptionResult, getComponentRenderContext, runWithComponentRenderContext, } from './eco/component-render-context.js';
|
|
6
6
|
export { ensurePageConfigLayouts } from './eco/page-layout-normalization.js';
|
|
7
|
+
export { moveMdxMetadataOntoPage } from './eco/mdx-page-metadata.js';
|
|
7
8
|
export { collectJsxExtensions, createJsxImportSourcePragma, filterJsxSourceExtensions, isJsxSourceExtension, } from './plugins/jsx-import-source.utils.js';
|
|
8
9
|
export { resolveDocumentShellLayouts, resolveInnermostPageLayout, resolveLayoutEntryProps, resolveLayoutShellProps, resolvePageLayoutComponents, type DocumentShellLayoutResolutionInput, type LayoutShellPropsContext, } from './route-renderer/orchestration/document-shell/layout-shell-props.service.js';
|
|
10
|
+
export { LayoutChildrenNotRenderedError } from './route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js';
|
|
9
11
|
export { isRegisteredDevTransformEntrypoint, isRegisteredScriptEntrypoint } from './hmr/hmr-entrypoint-output.js';
|
|
10
12
|
export { type HmrRegisteredEntrypointsContext } from './hmr/hmr-registered-entrypoints-context.js';
|
|
11
13
|
export { HmrStrategy, HmrStrategyType } from './hmr/hmr-strategy.js';
|
|
14
|
+
export { getStylesheetKinds, type StylesheetKinds } from './plugins/stylesheet-kinds.js';
|
|
12
15
|
export { type DefinedIntegration, defineIntegration } from './plugins/define-integration.js';
|
|
13
|
-
export { type AnyIntegrationPlugin, type
|
|
16
|
+
export { type AnyIntegrationPlugin, type EcoBuildFilter, type EcoBuildOnLoadArgs, type EcoBuildOnLoadResult, type EcoBuildOnResolveArgs, type EcoBuildOnResolveResult, type EcoBuildPlugin, type EcoBuildPluginBuilder, type EcoBuildResolvedId, IntegrationPlugin, type IntegrationPluginConfig, type IntegrationRendererBase, type IntegrationRuntimeContext, mergeIntegrationOptions, type ServerDomInstaller, type ServerDomSurfaceKind, type StaticExportContext, type StaticExportRelease, } from './plugins/integration-plugin.js';
|
|
14
17
|
export { installConfiguredServerDom } from './plugins/server-dom.js';
|
|
15
|
-
export { CUSTOM_ELEMENT_SSR_PRELOAD_CACHE_SCOPES, CustomElementScriptPreloader, type CustomElementScriptPreloadScopeState, type CustomElementSsrPreloadComponent, invalidateCustomElementScriptPreload, } from './route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js';
|
|
18
|
+
export { CUSTOM_ELEMENT_SSR_PRELOAD_CACHE_SCOPES, CustomElementScriptPreloader, type CustomElementScriptPreloadScopeState, type CustomElementSsrPreloadComponent, invalidateCustomElementScriptPreload, type SsrScriptAssignment, type SsrScriptPreload, type SsrScriptPreloadDeclaration, type SsrScriptPreloaderInit, } from './route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js';
|
|
16
19
|
export { createCustomElementServerModuleImporter, createSharedServerModuleImporter, } from './route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js';
|
|
17
|
-
export { createCustomElementSsrPipelineImporter } from './route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js';
|
|
18
20
|
export { type DocumentShellComposeChildrenContext, type DocumentShellComposeChildrenResult, type DocumentShellLayoutInput, } from './route-renderer/orchestration/document-shell/document-shell-render.service.js';
|
|
19
21
|
export { type QueuedForeignSubtreeResolutionContext, resolveQueuedTokens, } from './route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js';
|
|
20
|
-
export { createIntegrationRenderer, type HtmlDocumentContribution, type HtmlDocumentContributionContext, IntegrationRenderer, type IntegrationRendererHookFactory, type IntegrationRendererHookFactoryOptions, type IntegrationRendererHooks, type IntegrationRendererOptions, type PageBrowserGraphContributionContext, type PageClientBrowserAssets, type PageClientBuildEntry, type PageClientPlan, type RouteModuleLoadOptions, selectHydrationIslandEntries, } from './route-renderer/orchestration/integration-renderer.js';
|
|
22
|
+
export { createIntegrationRenderer, type HtmlDocumentContribution, type HtmlDocumentContributionContext, IntegrationRenderer, type IntegrationRendererHookFactory, type IntegrationRendererHookFactoryOptions, type IntegrationRendererHooks, type IntegrationRendererOptions, type PageBrowserGraphContribution, type PageBrowserGraphContributionContext, type PageBrowserGraphDeclaration, type PageClientBrowserAssets, type PageClientBuildEntry, type PageClientPlan, type RouteModuleLoadOptions, selectHydrationIslandEntries, } from './route-renderer/orchestration/integration-renderer.js';
|
|
21
23
|
export { StringMarkupRenderer } from './route-renderer/orchestration/string-markup-renderer.js';
|
|
22
24
|
export { attachEcoFileMetadataToConfig, collectComponentConfigFilePaths, } from './route-renderer/page-loading/file-scoped-dependency-components.js';
|
|
23
25
|
export { RouteRendererFactory } from './route-renderer/route-renderer.js';
|
package/src/integration.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export { APP_BROWSER_CLIENT_BUNDLE_ID, AssetFactory, AssetProcessingService,
|
|
1
|
+
export { APP_BROWSER_CLIENT_BUNDLE_ID, AssetFactory, AssetProcessingService, createAppBrowserClientEntry, } from './assets/asset-processing-service/index.js';
|
|
2
2
|
export { requireAppRuntime } from './utils/app-runtime.js';
|
|
3
|
-
export { DEV_TRANSFORM_URL_PREFIX } from './dev/transform-server/index.js';
|
|
3
|
+
export { DEV_TRANSFORM_URL_PREFIX, } from './dev/transform-server/index.js';
|
|
4
4
|
export { getComponentRenderContext, runWithComponentRenderContext, } from './eco/component-render-context.js';
|
|
5
5
|
export { ensurePageConfigLayouts } from './eco/page-layout-normalization.js';
|
|
6
|
+
export { moveMdxMetadataOntoPage } from './eco/mdx-page-metadata.js';
|
|
6
7
|
export { collectJsxExtensions, createJsxImportSourcePragma, filterJsxSourceExtensions, isJsxSourceExtension, } from './plugins/jsx-import-source.utils.js';
|
|
7
8
|
export { resolveDocumentShellLayouts, resolveInnermostPageLayout, resolveLayoutEntryProps, resolveLayoutShellProps, resolvePageLayoutComponents, } from './route-renderer/orchestration/document-shell/layout-shell-props.service.js';
|
|
9
|
+
export { LayoutChildrenNotRenderedError } from './route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js';
|
|
8
10
|
export { isRegisteredDevTransformEntrypoint, isRegisteredScriptEntrypoint } from './hmr/hmr-entrypoint-output.js';
|
|
9
11
|
export {} from './hmr/hmr-registered-entrypoints-context.js';
|
|
10
12
|
export { HmrStrategy, HmrStrategyType } from './hmr/hmr-strategy.js';
|
|
13
|
+
export { getStylesheetKinds } from './plugins/stylesheet-kinds.js';
|
|
11
14
|
export { defineIntegration } from './plugins/define-integration.js';
|
|
12
15
|
export { IntegrationPlugin, mergeIntegrationOptions, } from './plugins/integration-plugin.js';
|
|
13
16
|
export { installConfiguredServerDom } from './plugins/server-dom.js';
|
|
14
17
|
export { CUSTOM_ELEMENT_SSR_PRELOAD_CACHE_SCOPES, CustomElementScriptPreloader, invalidateCustomElementScriptPreload, } from './route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js';
|
|
15
18
|
export { createCustomElementServerModuleImporter, createSharedServerModuleImporter, } from './route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js';
|
|
16
|
-
export { createCustomElementSsrPipelineImporter } from './route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js';
|
|
17
19
|
export {} from './route-renderer/orchestration/document-shell/document-shell-render.service.js';
|
|
18
20
|
export { resolveQueuedTokens, } from './route-renderer/orchestration/foreign-child/foreign-subtree-execution.service.js';
|
|
19
21
|
export { createIntegrationRenderer, IntegrationRenderer, selectHydrationIslandEntries, } from './route-renderer/orchestration/integration-renderer.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Handles stale-while-revalidate semantics and background regeneration.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import path from '
|
|
6
|
+
import { path } from '@ecopages/file-system/path';
|
|
7
7
|
import { requireAppRuntime } from '../utils/app-runtime.js';
|
|
8
8
|
import { appLogger } from '../global/app-logger.js';
|
|
9
9
|
import { MemoryCacheStore } from './memory-cache-store.js';
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import type { EcoBuildPlugin } from '../build/contracts/build-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @remarks
|
|
4
|
+
* A query on the specifier, such as a module variant, follows the resolved path.
|
|
5
|
+
*
|
|
6
|
+
* The `cacheKey` holds the tsconfig path prefixes only: a key that named `projectRoot` would change the
|
|
7
|
+
* dependency key of every script that declares the plugin when the project moves.
|
|
8
|
+
*/
|
|
2
9
|
export declare function createAliasResolverPlugin(projectRoot: string): EcoBuildPlugin;
|
|
3
10
|
export { isBarePackageImportSpecifier, matchesTsconfigPathPrefix, loadTsconfigPathPrefixes, resolveProjectImportPath, resolveProjectModulePath, } from './tsconfig-import-resolver.js';
|
|
@@ -7,12 +7,19 @@ function buildPathPrefixFilter(prefix) {
|
|
|
7
7
|
}
|
|
8
8
|
return new RegExp(`^${escapeRegExp(prefix)}(?:/|$)`);
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @remarks
|
|
12
|
+
* A query on the specifier, such as a module variant, follows the resolved path.
|
|
13
|
+
*
|
|
14
|
+
* The `cacheKey` holds the tsconfig path prefixes only: a key that named `projectRoot` would change the
|
|
15
|
+
* dependency key of every script that declares the plugin when the project moves.
|
|
16
|
+
*/
|
|
10
17
|
export function createAliasResolverPlugin(projectRoot) {
|
|
11
18
|
const cache = new AliasResolverCache();
|
|
12
19
|
const pathPrefixes = loadTsconfigPathPrefixes(projectRoot);
|
|
13
20
|
return {
|
|
14
21
|
name: 'ecopages-alias-resolver',
|
|
15
|
-
cacheKey: JSON.stringify(
|
|
22
|
+
cacheKey: JSON.stringify(pathPrefixes),
|
|
16
23
|
setup(build) {
|
|
17
24
|
if (pathPrefixes.length === 0) {
|
|
18
25
|
return;
|
|
@@ -22,13 +29,16 @@ export function createAliasResolverPlugin(projectRoot) {
|
|
|
22
29
|
if (!args.importer) {
|
|
23
30
|
return undefined;
|
|
24
31
|
}
|
|
25
|
-
const
|
|
32
|
+
const queryStart = args.path.indexOf('?');
|
|
33
|
+
const specifier = queryStart === -1 ? args.path : args.path.slice(0, queryStart);
|
|
34
|
+
const query = queryStart === -1 ? '' : args.path.slice(queryStart);
|
|
35
|
+
const cached = cache.get(projectRoot, specifier);
|
|
26
36
|
if (cached.hit) {
|
|
27
|
-
return cached.resolved ? { path: cached.resolved } : undefined;
|
|
37
|
+
return cached.resolved ? { path: `${cached.resolved}${query}` } : undefined;
|
|
28
38
|
}
|
|
29
|
-
const resolved = resolveProjectImportPath(projectRoot, args.importer,
|
|
30
|
-
cache.set(projectRoot,
|
|
31
|
-
return resolved ? { path: resolved } : undefined;
|
|
39
|
+
const resolved = resolveProjectImportPath(projectRoot, args.importer, specifier);
|
|
40
|
+
cache.set(projectRoot, specifier, resolved);
|
|
41
|
+
return resolved ? { path: `${resolved}${query}` } : undefined;
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
44
|
},
|