@ecopages/core 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -143
- package/package.json +16 -3
- package/src/adapters/node/dev-session.js +2 -1
- package/src/adapters/node/node-client-bridge.d.ts +5 -7
- package/src/adapters/node/node-client-bridge.js +4 -14
- package/src/adapters/node/server-adapter.d.ts +4 -2
- package/src/adapters/node/server-adapter.js +13 -12
- package/src/adapters/shared/hmr/client-bridge.d.ts +25 -0
- package/src/adapters/shared/hmr/client-bridge.js +35 -0
- package/src/adapters/shared/hmr/dev-transform-entrypoint-registry.js +1 -1
- package/src/adapters/shared/hmr/hmr-manager.d.ts +9 -2
- package/src/adapters/shared/hmr/hmr-manager.js +36 -6
- package/src/adapters/shared/http/dist-file-handler.js +3 -7
- package/src/adapters/shared/http/response-headers.d.ts +29 -0
- package/src/adapters/shared/http/response-headers.js +89 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +1 -1
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +3 -2
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +4 -3
- package/src/adapters/shared/runtime/server-request-pipeline.js +4 -4
- package/src/adapters/shared/runtime/server-static-builder.d.ts +19 -8
- package/src/adapters/shared/runtime/server-static-builder.js +23 -4
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +1 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +23 -16
- package/src/assets/app-browser-client-build.d.ts +5 -12
- package/src/assets/app-browser-client-build.js +121 -336
- package/src/assets/asset-processing-service/app-browser-client-bundle.d.ts +4 -0
- package/src/assets/asset-processing-service/app-browser-client-bundle.js +6 -0
- package/src/assets/asset-processing-service/asset-dependency-keys.d.ts +28 -8
- package/src/assets/asset-processing-service/asset-dependency-keys.js +104 -29
- package/src/assets/asset-processing-service/asset-processing.service.d.ts +60 -2
- package/src/assets/asset-processing-service/asset-processing.service.js +189 -58
- package/src/assets/asset-processing-service/bundleable-script.d.ts +3 -0
- package/src/assets/asset-processing-service/bundleable-script.js +4 -0
- package/src/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -2
- package/src/assets/asset-processing-service/grouped-content-bundles.js +5 -10
- package/src/assets/asset-processing-service/index.d.ts +0 -3
- package/src/assets/asset-processing-service/index.js +0 -3
- package/src/assets/asset-processing-service/last-good-output.d.ts +21 -0
- package/src/assets/asset-processing-service/last-good-output.js +32 -0
- package/src/assets/asset-processing-service/page-package.js +1 -4
- package/src/assets/asset-processing-service/processed-asset-ledger.d.ts +63 -0
- package/src/assets/asset-processing-service/processed-asset-ledger.js +101 -0
- package/src/assets/asset-processing-service/processors/base/base-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/base/base-script-processor.js +1 -1
- package/src/assets/asset-processing-service/processors/script/content-script.processor.d.ts +24 -0
- package/src/assets/asset-processing-service/processors/script/content-script.processor.js +59 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -4
- package/src/assets/asset-processing-service/processors/script/file-script.processor.js +18 -6
- package/src/assets/asset-processing-service/processors/script/node-module-script.processor.js +2 -3
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.d.ts +34 -0
- package/src/assets/asset-processing-service/processors/stylesheet/app-stylesheet-imports.js +115 -0
- package/src/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -2
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.d.ts +39 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-module-types.js +150 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.d.ts +84 -0
- package/src/assets/asset-processing-service/processors/stylesheet/css-scanner.js +379 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +16 -0
- package/src/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +50 -24
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.d.ts +33 -0
- package/src/assets/asset-processing-service/processors/stylesheet/import-order.js +67 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.d.ts +44 -0
- package/src/assets/asset-processing-service/processors/stylesheet/package-stylesheet.js +149 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.d.ts +31 -0
- package/src/assets/asset-processing-service/processors/stylesheet/processed-stylesheet-cache.js +59 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.d.ts +20 -0
- package/src/assets/asset-processing-service/processors/stylesheet/source-relative-stylesheet.js +51 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.d.ts +2 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-failure.js +5 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.d.ts +37 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-module.js +48 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +25 -1
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +56 -15
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.d.ts +9 -0
- package/src/assets/asset-processing-service/processors/stylesheet/stylesheet-warnings.js +21 -0
- package/src/assets/browser-asset-output.js +1 -1
- package/src/assets/hashed-browser-asset.js +1 -1
- package/src/assets/{browser-runtime-asset-page-cache.d.ts → page-script-page-cache.d.ts} +3 -3
- package/src/assets/{browser-runtime-asset-page-cache.js → page-script-page-cache.js} +3 -3
- package/src/build/app-build-manifest-runtime.d.ts +23 -11
- package/src/build/app-build-manifest-runtime.js +52 -13
- package/src/build/browser/jsx-ownership-plugins.d.ts +4 -1
- package/src/build/browser/jsx-ownership-plugins.js +6 -0
- package/src/build/build-adapter.d.ts +1 -1
- package/src/build/build-adapter.js +1 -1
- package/src/build/build-graph.d.ts +4 -2
- package/src/build/build-graph.js +12 -46
- package/src/build/cache/build-input-dependency-index.d.ts +0 -19
- package/src/build/cache/build-input-dependency-index.js +1 -34
- package/src/build/cache/pages-unified-graph-build.js +7 -43
- package/src/build/cache/server-module-entries.d.ts +1 -1
- package/src/build/cache/server-module-entries.js +9 -9
- package/src/build/contracts/build-contracts.d.ts +59 -12
- package/src/build/contracts/build-manifest.d.ts +3 -6
- package/src/build/contracts/build-manifest.js +2 -12
- package/src/build/contracts/content-virtual-modules.js +1 -3
- package/src/build/copy-server-files.js +1 -1
- package/src/build/preserve-import-meta-transform.d.ts +3 -1
- package/src/build/preserve-import-meta-transform.js +7 -4
- package/src/build/production-asset-ledger.d.ts +36 -0
- package/src/build/production-asset-ledger.js +104 -0
- package/src/build/production-dist-complete.js +12 -13
- package/src/build/production-route-list.js +1 -1
- package/src/build/rolldown/app-package-declarations.js +1 -1
- package/src/build/rolldown/entry-module-closures.d.ts +5 -1
- package/src/build/rolldown/entry-module-closures.js +21 -8
- package/src/build/rolldown/rolldown-adapter-helpers.d.ts +19 -8
- package/src/build/rolldown/rolldown-adapter-helpers.js +82 -45
- package/src/build/rolldown/rolldown-build-adapter.js +10 -13
- package/src/build/rolldown/rolldown-module-id.d.ts +18 -0
- package/src/build/rolldown/rolldown-module-id.js +29 -0
- package/src/build/rolldown/rolldown-plugin-bridge.d.ts +24 -60
- package/src/build/rolldown/rolldown-plugin-bridge.js +201 -373
- package/src/build/rolldown/stylesheet-module-plugin.d.ts +34 -0
- package/src/build/rolldown/stylesheet-module-plugin.js +160 -0
- package/src/build/rolldown/worker-entries-plugin.d.ts +13 -0
- package/src/build/rolldown/worker-entries-plugin.js +57 -0
- package/src/build/runtime/build-environment-options.js +13 -3
- package/src/build/runtime/build-request-identity.js +1 -1
- package/src/build/runtime/build-request-policy.d.ts +7 -12
- package/src/build/runtime/build-request-policy.js +63 -17
- package/src/build/server/imported-view-plugin.d.ts +1 -0
- package/src/build/server/imported-view-plugin.js +6 -4
- package/src/build/server/page-module-import.service.d.ts +1 -2
- package/src/build/server/page-module-import.service.js +4 -6
- package/src/build/server/resolve-static-view.js +3 -2
- package/src/build/server/route-module-build-cache-registry.js +1 -1
- package/src/build/server/route-module-build-cache.store.js +1 -1
- package/src/build/server/route-module-build-manifest.js +1 -1
- package/src/build/server/route-module-dependency-hasher.d.ts +1 -1
- package/src/build/server/route-module-dependency-hasher.js +2 -2
- package/src/build/server/server-modules-manifest.d.ts +3 -5
- package/src/build/server/server-modules-manifest.js +6 -21
- package/src/build/server/view-module.d.ts +12 -0
- package/src/build/server/view-module.js +23 -0
- package/src/build/server/view-reference.d.ts +16 -5
- package/src/build/server/view-reference.js +25 -14
- package/src/build/server-bundle-deploy-manifest.d.ts +1 -1
- package/src/build/server-bundle-deploy-manifest.js +2 -2
- package/src/build/server-bundle-publication.d.ts +7 -1
- package/src/build/server-bundle-publication.js +11 -4
- package/src/build/server-module.js +1 -1
- package/src/build/worker-urls.d.ts +60 -0
- package/src/build/worker-urls.js +197 -0
- package/src/build.d.ts +7 -5
- package/src/build.js +7 -5
- package/src/cache/module-parse-cache.js +2 -2
- package/src/client/navigation-attributes.d.ts +8 -0
- package/src/client/navigation-attributes.js +8 -0
- package/src/client/navigation-scripts/global-scripts.d.ts +14 -0
- package/src/client/navigation-scripts/global-scripts.js +65 -0
- package/src/client/navigation-scripts/index.d.ts +1 -0
- package/src/client/navigation-scripts/index.js +1 -0
- package/src/client.d.ts +2 -2
- package/src/client.js +2 -2
- package/src/config/assembly/app-runtime.d.ts +45 -5
- package/src/config/assembly/app-runtime.js +11 -2
- package/src/config/assembly/finalize-config.js +13 -5
- package/src/config/config-module-files.js +10 -6
- package/src/config/index.d.ts +2 -1
- package/src/config/internal-types.d.ts +3 -0
- package/src/config/load-eco-config.js +8 -5
- package/src/config/resolve-eco-config-path.js +3 -3
- package/src/config/server-config-bundle.js +1 -1
- package/src/config/user-config-types.d.ts +54 -1
- package/src/config/write-types.js +4 -1
- package/src/css-imports.d.ts +12 -0
- package/src/declarations.d.ts +2 -0
- package/src/dev/development-restart-watch-paths.js +1 -1
- package/src/dev/development-restart.js +1 -1
- package/src/dev/invalidation/development-invalidation.service.d.ts +6 -1
- package/src/dev/invalidation/development-invalidation.service.js +18 -2
- package/src/dev/stylesheets/development-stylesheet.service.d.ts +149 -0
- package/src/dev/stylesheets/development-stylesheet.service.js +350 -0
- package/src/dev/transform-server/dev-transform-bundler.d.ts +12 -3
- package/src/dev/transform-server/dev-transform-bundler.js +32 -21
- package/src/dev/transform-server/dev-transform-externalize-plugin.d.ts +3 -5
- package/src/dev/transform-server/dev-transform-externalize-plugin.js +8 -9
- package/src/dev/transform-server/dev-transform-import-rewriter.d.ts +15 -2
- package/src/dev/transform-server/dev-transform-import-rewriter.js +204 -35
- package/src/dev/transform-server/dev-transform-install-stamp.d.ts +17 -0
- package/src/dev/transform-server/dev-transform-install-stamp.js +79 -0
- package/src/dev/transform-server/dev-transform-server.d.ts +38 -2
- package/src/dev/transform-server/dev-transform-server.js +96 -33
- package/src/dev/transform-server/dev-transform-url.d.ts +4 -2
- package/src/dev/transform-server/dev-transform-url.js +13 -12
- package/src/dev/transform-server/dev-transform-vendor-registry.d.ts +178 -21
- package/src/dev/transform-server/dev-transform-vendor-registry.js +675 -99
- package/src/dev/transform-server/index.d.ts +1 -1
- package/src/dev-toolbar/dev-toolbar-package.js +4 -4
- package/src/eco/component-render-output.d.ts +6 -1
- package/src/eco/component-render-output.js +32 -7
- package/src/eco/discovered-dependencies.d.ts +30 -11
- package/src/eco/discovered-dependencies.js +25 -13
- package/src/eco/discovered-dependency-paths.d.ts +36 -0
- package/src/eco/discovered-dependency-paths.js +58 -0
- package/src/eco/eco.browser.js +8 -12
- package/src/eco/eco.js +0 -30
- package/src/eco/mdx-page-metadata.d.ts +14 -0
- package/src/eco/mdx-page-metadata.js +15 -0
- package/src/eco/page-layout-normalization.d.ts +6 -2
- package/src/eco/page-layout-normalization.js +9 -6
- package/src/env.js +17 -0
- package/src/hmr/client/hmr-runtime.js +14 -13
- package/src/hmr/dev-client-runtime.d.ts +5 -2
- package/src/hmr/dev-client-runtime.js +14 -4
- package/src/hmr/hmr-entrypoint-output.js +1 -1
- package/src/hmr/hmr-strategy.d.ts +2 -2
- package/src/hmr/hmr-strategy.js +2 -2
- package/src/hmr/strategies/js-hmr-strategy.d.ts +4 -1
- package/src/hmr/strategies/js-hmr-strategy.js +7 -6
- package/src/hmr/strategies/template-source-hmr-strategy.d.ts +25 -0
- package/src/hmr/strategies/template-source-hmr-strategy.js +36 -0
- package/src/html-pages/html-page-module-scripts.d.ts +2 -1
- package/src/html-pages/html-page-module-scripts.js +37 -14
- package/src/html-pages/html-page-module.js +1 -1
- package/src/html-pages/html-page-renderer.js +7 -6
- package/src/html-pages/html-page-template.d.ts +0 -5
- package/src/html-pages/html-page-template.js +3 -15
- package/src/html-pages/html-pages.plugin.js +2 -2
- package/src/integration.d.ts +8 -6
- package/src/integration.js +5 -3
- package/src/page-cache/html-page-cache-dependency-index.js +1 -1
- package/src/page-cache/page-cache-service.js +1 -1
- package/src/plugins/alias-resolver-plugin.d.ts +7 -0
- package/src/plugins/alias-resolver-plugin.js +16 -6
- package/src/plugins/component-import-discovery.d.ts +178 -7
- package/src/plugins/component-import-discovery.js +696 -112
- package/src/plugins/eco-component-meta-plugin.d.ts +47 -6
- package/src/plugins/eco-component-meta-plugin.js +227 -59
- package/src/plugins/foreign-jsx-override-plugin.d.ts +14 -1
- package/src/plugins/foreign-jsx-override-plugin.js +18 -8
- package/src/plugins/integration-plugin.d.ts +47 -11
- package/src/plugins/integration-plugin.js +57 -8
- package/src/plugins/processor.d.ts +72 -7
- package/src/plugins/processor.js +44 -9
- package/src/plugins/stylesheet-kinds.d.ts +57 -0
- package/src/plugins/stylesheet-kinds.js +114 -0
- package/src/plugins/tsconfig-import-resolver.d.ts +49 -3
- package/src/plugins/tsconfig-import-resolver.js +120 -6
- package/src/processor-contract.d.ts +66 -0
- package/src/processor-contract.js +389 -0
- package/src/processor.d.ts +6 -1
- package/src/processor.js +6 -1
- package/src/route-renderer/error-pages/default-error-pages.d.ts +1 -0
- package/src/route-renderer/error-pages/default-error-pages.js +27 -7
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.d.ts +8 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preload-invalidation.js +12 -0
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.d.ts +77 -24
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-script-preloader.js +97 -32
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-server-module-importer.js +1 -1
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +9 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +16 -2
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.d.ts +35 -0
- package/src/route-renderer/orchestration/document-shell/layout-children-not-rendered-error.js +53 -0
- package/src/route-renderer/orchestration/foreign-child/render-session.d.ts +4 -8
- package/src/route-renderer/orchestration/foreign-child/render-session.js +2 -5
- package/src/route-renderer/orchestration/integration-renderer.d.ts +171 -64
- package/src/route-renderer/orchestration/integration-renderer.js +293 -332
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +8 -5
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +27 -25
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +0 -6
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +3 -3
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.d.ts +12 -25
- package/src/route-renderer/orchestration/page-browser-graph/grouped-graph-build-plan.js +1 -14
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +0 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +1 -87
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +8 -16
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +25 -271
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.d.ts +0 -24
- package/src/route-renderer/orchestration/page-browser-graph/route-instance-key.js +0 -67
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.d.ts +28 -15
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +63 -41
- package/src/route-renderer/page-loading/component-dependency-collection.d.ts +4 -1
- package/src/route-renderer/page-loading/component-dependency-collection.js +51 -15
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +10 -0
- package/src/route-renderer/page-loading/dependency-resolver.js +27 -6
- package/src/route-renderer/page-loading/file-scoped-dependency-components.d.ts +4 -2
- package/src/route-renderer/page-loading/file-scoped-dependency-components.js +22 -17
- package/src/route-renderer/page-loading/lazy-entry-collection.d.ts +5 -0
- package/src/route-renderer/page-loading/lazy-entry-collection.js +6 -4
- package/src/route-renderer/page-loading/page-dependency-bundling.d.ts +5 -2
- package/src/route-renderer/page-loading/page-dependency-bundling.js +15 -31
- package/src/route-renderer/page-loading/page-module-loader.d.ts +13 -2
- package/src/route-renderer/page-loading/page-module-loader.js +23 -5
- package/src/route-renderer/route-renderer.d.ts +1 -1
- package/src/router/client/navigation-commit.d.ts +2 -0
- package/src/router/client/navigation-commit.js +20 -3
- package/src/router/client/navigation-coordinator.d.ts +18 -0
- package/src/router/client/navigation-coordinator.js +14 -0
- package/src/router/client/navigation-head-order.fixture.css +3 -0
- package/src/router/client/navigation-head.d.ts +2 -1
- package/src/router/client/navigation-head.fixture.css +3 -0
- package/src/router/client/navigation-head.js +222 -39
- package/src/router/client/navigation-lifecycle.d.ts +8 -1
- package/src/router/client/navigation-lifecycle.js +6 -3
- package/src/router/client/navigation-pipeline.d.ts +1 -0
- package/src/router/client/navigation-pipeline.js +1 -0
- package/src/router/server/route-registry.d.ts +3 -2
- package/src/router/server/route-registry.js +6 -5
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +30 -18
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +82 -143
- package/src/static-site-generator/static-site-generator.d.ts +37 -4
- package/src/static-site-generator/static-site-generator.js +99 -51
- package/src/types/asset-types.d.ts +19 -1
- package/src/types/build-types.d.ts +53 -35
- package/src/types/component-identity.d.ts +8 -0
- package/src/types/contracts.d.ts +69 -21
- package/src/types/dev-transform-types.d.ts +33 -6
- package/src/types/eco-api-types.d.ts +13 -18
- package/src/types/integration-types.d.ts +1 -1
- package/src/types/public-types.d.ts +1 -1
- package/src/utils/additional-watch-paths.js +3 -5
- package/src/utils/entry-command-flags.d.ts +23 -0
- package/src/utils/entry-command-flags.js +24 -0
- package/src/utils/package-path.d.ts +42 -0
- package/src/utils/package-path.js +114 -0
- package/src/utils/parse-cli-args.d.ts +18 -1
- package/src/utils/parse-cli-args.js +54 -37
- package/src/utils/path-containment.js +3 -10
- package/src/utils/resolve-work-dir.js +2 -2
- package/src/utils/root-relative-path.js +2 -2
- package/src/utils/server-bundle-context.d.ts +5 -0
- package/src/utils/server-bundle-context.js +7 -1
- package/src/utils/server-utils.module.js +1 -1
- package/src/watchers/project-watcher-ignore.js +3 -3
- package/src/watchers/project-watcher.d.ts +14 -2
- package/src/watchers/project-watcher.js +37 -6
- package/src/watchers/workspace-package-watch-roots.js +2 -2
- package/src/assets/app-browser-client-manifest.d.ts +0 -66
- package/src/assets/app-browser-client-manifest.js +0 -260
- package/src/assets/asset-processing-service/asset-package-role.d.ts +0 -2
- package/src/assets/asset-processing-service/asset-package-role.js +0 -3
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +0 -58
- package/src/assets/asset-processing-service/browser-runtime-asset.factory.js +0 -61
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +0 -79
- package/src/assets/asset-processing-service/browser-runtime-entry-resolution.js +0 -200
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +0 -24
- package/src/assets/asset-processing-service/browser-runtime-entry.factory.js +0 -67
- package/src/build/browser/browser-runtime-manifest.d.ts +0 -35
- package/src/build/browser/browser-runtime-manifest.js +0 -65
- package/src/build/browser/browser-runtime-plugin-helpers.d.ts +0 -14
- package/src/build/browser/browser-runtime-plugin-helpers.js +0 -21
- package/src/build/browser/browser-runtime-plugin.d.ts +0 -54
- package/src/build/browser/browser-runtime-plugin.js +0 -76
- package/src/build/rolldown/server-side-css-shim-plugin.d.ts +0 -28
- package/src/build/rolldown/server-side-css-shim-plugin.js +0 -59
- package/src/dev/transform-server/dev-transform-module-kind.d.ts +0 -13
- package/src/dev/transform-server/dev-transform-module-kind.js +0 -17
- package/src/dev/transform-server/dev-transform-runtime-specifiers.d.ts +0 -5
- package/src/dev/transform-server/dev-transform-runtime-specifiers.js +0 -16
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.d.ts +0 -15
- package/src/route-renderer/orchestration/custom-element-scripts/custom-element-ssr-preload-entrypoint.js +0 -65
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.d.ts +0 -21
- package/src/route-renderer/orchestration/page-browser-graph/missing-production-browser-graph.js +0 -31
package/src/types/contracts.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export type HmrStrategyContract = {
|
|
|
15
15
|
readonly priorityOffset: number;
|
|
16
16
|
readonly priority: number;
|
|
17
17
|
matches(filePath: string): boolean;
|
|
18
|
-
ownsDevTransformEntrypoint(sourcePath: string): boolean;
|
|
18
|
+
ownsDevTransformEntrypoint(sourcePath: string, variant?: string): boolean;
|
|
19
19
|
process(filePath: string): Promise<HmrAction>;
|
|
20
20
|
};
|
|
21
21
|
type RequiresKeys = keyof RequestLocals;
|
|
@@ -250,12 +250,13 @@ export type HmrFileChangeOptions = {
|
|
|
250
250
|
export type RegisteredScriptEntrypointChangeHandler = (filePath: string) => void | boolean | Promise<void | boolean>;
|
|
251
251
|
/**
|
|
252
252
|
* Adapter-agnostic interface for broadcasting development events to connected clients.
|
|
253
|
-
*
|
|
253
|
+
* An adapter's bridge extends the shared `ClientBridge`, which implements every event over its `broadcast`.
|
|
254
254
|
*/
|
|
255
255
|
export interface IClientBridge {
|
|
256
256
|
broadcast(event: ClientBridgeEvent): void;
|
|
257
257
|
reload(): void;
|
|
258
|
-
|
|
258
|
+
/** Refreshes the stylesheet the browser loads from `sourceFile`, the source whose processed output changed. */
|
|
259
|
+
cssUpdate(sourceFile: string): void;
|
|
259
260
|
update(path: string): void;
|
|
260
261
|
error(message: string): void;
|
|
261
262
|
subscriberCount: number;
|
|
@@ -290,6 +291,14 @@ export interface IHmrManager {
|
|
|
290
291
|
registerScriptEntrypoint(entrypointPath: string): Promise<ResolvedHmrEntrypoint>;
|
|
291
292
|
/** Serves a requested module from the active development transform server, when the path is managed by HMR. */
|
|
292
293
|
tryHandleDevClientRequest(request: Request): Promise<Response | null>;
|
|
294
|
+
/**
|
|
295
|
+
* Rewrites the imports of a module the browser loads as written, as the dev transform server rewrites a
|
|
296
|
+
* transpiled module: bare imports become vendor URLs, and named imports of a CommonJS vendor read its default
|
|
297
|
+
* export.
|
|
298
|
+
*
|
|
299
|
+
* @param importerPath - Path relative imports resolve from.
|
|
300
|
+
*/
|
|
301
|
+
rewriteModuleImports(code: string, importerPath: string): Promise<string>;
|
|
293
302
|
/**
|
|
294
303
|
* Registers a custom HMR strategy.
|
|
295
304
|
*/
|
|
@@ -316,6 +325,15 @@ export interface IHmrManager {
|
|
|
316
325
|
* Broadcasts an HMR event to connected clients.
|
|
317
326
|
*/
|
|
318
327
|
broadcast(event: ClientBridgeEvent): void;
|
|
328
|
+
/**
|
|
329
|
+
* Shows `message` in the browser overlay for a build error found while answering a request, and replays it to
|
|
330
|
+
* a browser that connects later.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* `source` is the file that failed. The error stays until the next file change, as a dev-transform failure
|
|
334
|
+
* does; a request that still fails reports it again.
|
|
335
|
+
*/
|
|
336
|
+
reportBuildError(source: string, message: string): void;
|
|
319
337
|
/**
|
|
320
338
|
* Returns an existing emitted HMR script artifact without registering it.
|
|
321
339
|
*/
|
|
@@ -508,6 +526,18 @@ export interface ForeignChildRuntime {
|
|
|
508
526
|
interceptForeignChild?(input: ForeignChildInterceptionInput): ForeignChildInterceptionResult | Promise<ForeignChildInterceptionResult>;
|
|
509
527
|
interceptForeignChildSync?(input: ForeignChildInterceptionInput): Exclude<ForeignChildInterceptionResult, undefined>;
|
|
510
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* The Integration that renders Eco Components in the browser, and what it renders in place of a Foreign Child.
|
|
531
|
+
*
|
|
532
|
+
* @remarks
|
|
533
|
+
* Kept for compatibility: the browser `eco` factories no longer read a host from `window.__ECO_PAGES__`. They
|
|
534
|
+
* render inline for every caller, and the React integration swaps a foreign-owned Component for its boundary
|
|
535
|
+
* when it builds React modules.
|
|
536
|
+
*/
|
|
537
|
+
export interface BrowserForeignChildHost {
|
|
538
|
+
integration: string;
|
|
539
|
+
renderForeignChild(component: EcoComponent, props: Record<string, unknown>): unknown;
|
|
540
|
+
}
|
|
511
541
|
/**
|
|
512
542
|
* Represents a page in EcoPages.
|
|
513
543
|
*/
|
|
@@ -621,19 +651,29 @@ export type LayoutPropsContext = {
|
|
|
621
651
|
locals?: RequestLocals;
|
|
622
652
|
};
|
|
623
653
|
/**
|
|
624
|
-
* One layout tier in a page layout stack (outer→inner).
|
|
654
|
+
* One normalized layout tier in a page layout stack (outer→inner), as stored on page config.
|
|
655
|
+
*/
|
|
656
|
+
export type EcoPageLayoutEntry = {
|
|
657
|
+
component: EcoComponent;
|
|
658
|
+
props?: (context: LayoutPropsContext) => Record<string, unknown>;
|
|
659
|
+
};
|
|
660
|
+
/**
|
|
661
|
+
* A layout tier with a props factory, as written in `eco.page({ layout })`.
|
|
625
662
|
*/
|
|
626
|
-
export type
|
|
627
|
-
component:
|
|
663
|
+
export type EcoPageLayoutEntrySpec<E = EcoPagesElement> = {
|
|
664
|
+
component: EcoLayoutComponent<E>;
|
|
628
665
|
props?: (context: LayoutPropsContext) => Record<string, unknown>;
|
|
629
666
|
};
|
|
630
667
|
/**
|
|
631
|
-
* Layout declaration accepted by `eco.page()
|
|
668
|
+
* Layout declaration accepted by `eco.page()`: an `eco.layout()` result, a plain function typed with
|
|
669
|
+
* {@link LayoutProps}, or an entry that adds a props factory to either.
|
|
632
670
|
*
|
|
633
671
|
* @remarks
|
|
634
|
-
* Array order is outer→inner, matching Next.js App Router segment nesting.
|
|
672
|
+
* Array order is outer→inner, matching Next.js App Router segment nesting. A function with fewer parameters is
|
|
673
|
+
* still assignable, so the type cannot prove that a layout renders `children`; layout composition checks that
|
|
674
|
+
* when it renders the page.
|
|
635
675
|
*/
|
|
636
|
-
export type EcoPageLayoutSpec<E = EcoPagesElement> =
|
|
676
|
+
export type EcoPageLayoutSpec<E = EcoPagesElement> = EcoLayoutComponent<E> | EcoPageLayoutEntrySpec<E>;
|
|
637
677
|
/**
|
|
638
678
|
* One or more layout tiers for `eco.page({ layout })`.
|
|
639
679
|
*
|
|
@@ -643,14 +683,7 @@ export type EcoPageLayoutSpec<E = EcoPagesElement> = EcoComponent<any, E> | EcoP
|
|
|
643
683
|
*/
|
|
644
684
|
export type EcoPageLayouts<E = EcoPagesElement> = EcoPageLayoutSpec<E> | EcoPageLayoutSpec<E>[];
|
|
645
685
|
/**
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
* This preserves compatibility with existing `eco.component()` layouts while
|
|
649
|
-
* also supporting semantic `eco.layout()` declarations.
|
|
650
|
-
*/
|
|
651
|
-
type EcoPageLayoutComponent<T = EcoPagesElement> = EcoLayoutComponent<T> | EcoComponent<any, T>;
|
|
652
|
-
/**
|
|
653
|
-
* Represents a layout component created with eco.layout().
|
|
686
|
+
* A layout component: an `eco.layout()` result or a plain function that takes {@link LayoutProps}.
|
|
654
687
|
*/
|
|
655
688
|
export type EcoLayoutComponent<T = EcoPagesElement> = EcoComponent<LayoutProps<T>, T>;
|
|
656
689
|
/**
|
|
@@ -828,9 +861,6 @@ export type GetStaticProps<T> = (context: {
|
|
|
828
861
|
*/
|
|
829
862
|
export type EcoPageFile<T = unknown> = T & {
|
|
830
863
|
default: EcoComponent<any, any>;
|
|
831
|
-
getStaticPaths?: GetStaticPaths;
|
|
832
|
-
getStaticProps?: GetStaticProps<Record<string, unknown>>;
|
|
833
|
-
getMetadata?: GetMetadata;
|
|
834
864
|
cache?: CacheStrategy;
|
|
835
865
|
};
|
|
836
866
|
/**
|
|
@@ -909,7 +939,7 @@ export type IntegrationRendererRenderOptions<C = EcoPagesElement> = RouteRendere
|
|
|
909
939
|
HtmlTemplate: EcoHtmlComponent<C>;
|
|
910
940
|
Page: EcoComponent<PageProps, C>;
|
|
911
941
|
Layouts?: EcoComponent[];
|
|
912
|
-
Layout?:
|
|
942
|
+
Layout?: EcoComponent;
|
|
913
943
|
layoutEntries?: EcoPageLayoutEntry[];
|
|
914
944
|
dependencies?: EcoComponentDependencies;
|
|
915
945
|
/** Components returned by the page's dependency resolver, available to Integration render hooks. */
|
|
@@ -993,6 +1023,24 @@ export type PageBrowserGraphContributionContext = {
|
|
|
993
1023
|
query?: PageQuery;
|
|
994
1024
|
dependencyInstanceKey?: string;
|
|
995
1025
|
};
|
|
1026
|
+
/**
|
|
1027
|
+
* What an Integration's contribution hook names for one Page Browser Graph.
|
|
1028
|
+
*
|
|
1029
|
+
* @remarks
|
|
1030
|
+
* The production prebuild calls the hook while it plans routes, before the app-wide browser build, so the hook
|
|
1031
|
+
* names what core should process and processes nothing itself: core processes `dependencies`, `components` and
|
|
1032
|
+
* `bundledScripts` when it resolves the graph, and plans their scripts for the app-wide build.
|
|
1033
|
+
*/
|
|
1034
|
+
export interface PageBrowserGraphDeclaration {
|
|
1035
|
+
dependencies?: AssetDefinition[];
|
|
1036
|
+
/** Components whose Dependencies join the graph; their scripts share chunks with every other component script. */
|
|
1037
|
+
components?: ReadonlyArray<EcoComponent | Partial<EcoComponent>>;
|
|
1038
|
+
/** Scripts declared outside any component's Dependencies that the app-wide build bundles with the graph. */
|
|
1039
|
+
bundledScripts?: AssetDefinition[];
|
|
1040
|
+
/** Source files that should invalidate this graph entry when they change. */
|
|
1041
|
+
watchPaths?: string[];
|
|
1042
|
+
}
|
|
1043
|
+
/** What one Page Browser Graph receives once core processed a declaration or a Page's own Dependencies. */
|
|
996
1044
|
export interface PageBrowserGraphContribution {
|
|
997
1045
|
dependencies?: AssetDefinition[];
|
|
998
1046
|
assets?: ProcessedAsset[];
|
|
@@ -1,15 +1,42 @@
|
|
|
1
1
|
import type { EcoBuildPlugin } from './build-types.js';
|
|
2
2
|
export type DevTransformBundleResult = {
|
|
3
3
|
code: string;
|
|
4
|
+
/** Files whose edit invalidates the module: its imports and the files its plugins inlined. */
|
|
4
5
|
dependencies?: string[];
|
|
5
6
|
};
|
|
7
|
+
/** Bare specifiers a contributor's generated browser modules import, and where they resolve from. */
|
|
8
|
+
export type DevTransformVendorEntries = {
|
|
9
|
+
/**
|
|
10
|
+
* A directory inside the contributing package, such as the folder of the contributor's own module.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* The specifiers resolve from it, as an import in the package would, so a dependency only that package declares
|
|
14
|
+
* resolves under a strict install.
|
|
15
|
+
*/
|
|
16
|
+
resolveFrom: string;
|
|
17
|
+
specifiers: readonly string[];
|
|
18
|
+
};
|
|
6
19
|
export type DevTransformBundleContributor = {
|
|
7
|
-
/**
|
|
8
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Returns whether this contributor owns the source module path.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* `variant` is the `eco-variant` query of the requested URL: one file can be served in more than one compiled
|
|
25
|
+
* form, each requested under its own variant, when a contributor needs a form of a shared module that the
|
|
26
|
+
* others do not get.
|
|
27
|
+
*/
|
|
28
|
+
ownsModule(sourcePath: string, variant?: string): boolean;
|
|
9
29
|
/** Integration-owned plugins for one dev-transform module (boundary, MDX, etc.). */
|
|
10
|
-
getModulePlugins(sourcePath: string): Promise<readonly EcoBuildPlugin[]>;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
getModulePlugins(sourcePath: string, variant?: string): Promise<readonly EcoBuildPlugin[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Bare specifiers the contributor's generated browser modules import, such as a hydration bootstrap's
|
|
33
|
+
* framework packages.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* They join the vendor graph before its first build, so the build that serves the first page already holds
|
|
37
|
+
* them and later builds do not move a module the page loaded into a new chunk.
|
|
38
|
+
*/
|
|
39
|
+
getVendorEntries?(): DevTransformVendorEntries;
|
|
40
|
+
/** Plugins applied to lazy vendor prebundles, such as the client-graph boundary. */
|
|
14
41
|
getVendorBundlePlugins?(): Promise<readonly EcoBuildPlugin[]>;
|
|
15
42
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Type definitions for the eco namespace API
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { DependencyLazyTrigger, EcoComponent, EcoComponentDependencies, EcoHtmlComponent,
|
|
5
|
+
import type { DependencyLazyTrigger, EcoComponent, EcoComponentDependencies, EcoHtmlComponent, EcoPageLayouts, EcoPagesElement, EcoPageComponent, FileRouteMiddleware, GetMetadata, GetStaticPaths, GetStaticProps, HtmlTemplateProps, LayoutProps, RequestLocals, RequestPageContext, PagePropsFor, PageRequires, PageDependenciesInput } from './contracts.js';
|
|
6
6
|
import type { CacheStrategy } from './cache-types.js';
|
|
7
7
|
import type { ComponentIdentity } from './component-identity.js';
|
|
8
8
|
export type { EcoPageComponent, FileOwnedDependencyContribution, GetPageDependencies, GetPageDependenciesContext, PageDependenciesInput, PageDependenciesResult, PagePropsFor, PageRequires, } from './contracts.js';
|
|
@@ -14,7 +14,7 @@ export type PropsOf<TComponent extends EcoComponent> = TComponent extends EcoCom
|
|
|
14
14
|
/**
|
|
15
15
|
* Extracts the render result type from one eco component.
|
|
16
16
|
*/
|
|
17
|
-
export type ResultOf<TComponent extends EcoComponent> = TComponent extends
|
|
17
|
+
export type ResultOf<TComponent extends EcoComponent> = CallableComponentOf<TComponent> extends (props: any, ...args: any[]) => infer R ? R : never;
|
|
18
18
|
/**
|
|
19
19
|
* Narrows an eco component to its callable function signature.
|
|
20
20
|
*
|
|
@@ -73,7 +73,14 @@ export interface ComponentOptions<P, E = EcoPagesElement> {
|
|
|
73
73
|
render: (props: P) => E | Promise<E>;
|
|
74
74
|
}
|
|
75
75
|
export type HtmlOptions<E = EcoPagesElement> = ComponentOptions<HtmlTemplateProps<E>, E>;
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Options for `eco.layout()`.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* `P` adds props to `LayoutProps`. Extra props must be optional for the layout to be accepted by
|
|
81
|
+
* `eco.page({ layout })`, which passes only `LayoutProps` and the entry's props factory output.
|
|
82
|
+
*/
|
|
83
|
+
export type LayoutOptions<E = EcoPagesElement, P extends LayoutProps<E> = LayoutProps<E>> = ComponentOptions<P, E>;
|
|
77
84
|
/**
|
|
78
85
|
* Base options shared by all page variants
|
|
79
86
|
*/
|
|
@@ -182,9 +189,9 @@ export interface Eco {
|
|
|
182
189
|
/**
|
|
183
190
|
* Create a route layout component.
|
|
184
191
|
*/
|
|
185
|
-
layout: <E = EcoPagesElement>(options: LayoutOptions<E>) =>
|
|
192
|
+
layout: <E = EcoPagesElement, P extends LayoutProps<E> = LayoutProps<E>>(options: LayoutOptions<E, P>) => EcoComponent<P, E>;
|
|
186
193
|
/**
|
|
187
|
-
* Create a page component with type-safe props from
|
|
194
|
+
* Create a page component with type-safe props from `staticProps`.
|
|
188
195
|
* Returns an EcoPageComponent with attached staticPaths, staticProps, and metadata.
|
|
189
196
|
*
|
|
190
197
|
* If `requires` is provided, the `render` callback receives `locals` as required and non-null for the required keys.
|
|
@@ -193,21 +200,9 @@ export interface Eco {
|
|
|
193
200
|
<T = {}, E = EcoPagesElement>(options: PageOptions<T, E> & {
|
|
194
201
|
requires?: undefined;
|
|
195
202
|
}): EcoPageComponent<T>;
|
|
196
|
-
<T = {}, E = EcoPagesElement, const K extends RequiresKeys =
|
|
203
|
+
<T = {}, E = EcoPagesElement, const K extends RequiresKeys = never>(options: Omit<PageOptions<T, E>, 'render' | 'requires'> & {
|
|
197
204
|
requires: PageRequires<K>;
|
|
198
205
|
render: (props: PagePropsForWithLocals<T, K>) => E | Promise<E>;
|
|
199
206
|
}): EcoPageComponent<T>;
|
|
200
207
|
};
|
|
201
|
-
/**
|
|
202
|
-
* Type-safe wrapper for page metadata (identity function)
|
|
203
|
-
*/
|
|
204
|
-
metadata: <P = {}>(fn: GetMetadata<P>) => GetMetadata<P>;
|
|
205
|
-
/**
|
|
206
|
-
* Type-safe wrapper for static paths (identity function)
|
|
207
|
-
*/
|
|
208
|
-
staticPaths: (fn: GetStaticPaths) => GetStaticPaths;
|
|
209
|
-
/**
|
|
210
|
-
* Type-safe wrapper for static props (identity function)
|
|
211
|
-
*/
|
|
212
|
-
staticProps: <P>(fn: GetStaticProps<P>) => GetStaticProps<P>;
|
|
213
208
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { BaseIntegrationContext, ClientBridgeEvent, ComponentRenderInput, ComponentRenderResult, DefaultHmrContext, ForeignChildRuntime, HmrAction, HmrFileChangeOptions, HmrStrategyContract, IClientBridge, IHmrManager, IntegrationRendererRenderOptions, OwnershipPlanNodeSource, OwnershipValidationError, PageBrowserGraphContribution, PageBrowserGraphContributionContext, PageBrowserGraphResult, PageClientBuildEntry, PageClientBrowserAssets, PageClientPlan, PageClientPlanIslandEntry, PagePackageResult, RegisteredScriptEntrypointChangeHandler, ResolvedHmrEntrypoint, RouteRendererBody, RouteRendererOptions, RouteRenderResult, } from './contracts.js';
|
|
2
2
|
export type { AssetDefinition, ProcessedAsset } from './asset-types.js';
|
|
3
|
-
export type { DevTransformBundleContributor } from './dev-transform-types.js';
|
|
3
|
+
export type { DevTransformBundleContributor, DevTransformVendorEntries } from './dev-transform-types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ApiHandler, ApiHandlerContext, EcoComponent, EcoComponentConfig, EcoComponentDependencies, DependencyAttributes, EcoChildren, EcoFunctionComponent, EcoPageComponent, EcoPageFile, EcoPagesAppConfig, EcoPagesElement, EcoPageLayoutEntry, EcoPageLayoutSpec, EcoPageLayouts, EcoHtmlComponent, EcoLayoutComponent, EcoMiddleware, ErrorHandler, ErrorPageTemplateProps, EcopagesRouteInfo, EcopagesSocket, EcopagesWebSocketHandler, FileRouteMiddleware, FileRouteMiddlewareContext, FileOwnedDependencyContribution, GetPageDependencies, GetPageDependenciesContext, GetMetadata, GetMetadataContext, GetStaticPaths, GetStaticProps, HtmlTemplateProps, LayoutProps, LayoutPropsContext, Middleware, MiddlewareList, MiddlewareNext, OutgoingWebSocketMessage, IncomingWebSocketMessage, PageHeadProps, PageMetadataProps, PageParams, PageQuery, PageDependenciesInput, PageDependenciesResult, PageProps, PagePropsFor, PageRequires, PageRobotsMetadata, RequestLocals, RequestPageContext, RenderContext, RenderOptions, RouteGroupBuilder, RouteHandlerContext, RouteMethod, RouteOptions, RouteSchema, SitemapConfig, StandardSchema, StandardSchemaFailureResult, StandardSchemaIssue, StandardSchemaResult, StandardSchemaSuccessResult, StandardSchemaV1, StaticPageContext, StaticPath, WebSocketCloseInfo, WithLocals, } from './contracts.js';
|
|
1
|
+
export type { ApiHandler, ApiHandlerContext, BrowserForeignChildHost, EcoComponent, EcoComponentConfig, EcoComponentDependencies, DependencyAttributes, EcoChildren, EcoFunctionComponent, EcoPageComponent, EcoPageFile, EcoPagesAppConfig, EcoPagesElement, EcoPageLayoutEntry, EcoPageLayoutEntrySpec, EcoPageLayoutSpec, EcoPageLayouts, EcoHtmlComponent, EcoLayoutComponent, EcoMiddleware, ErrorHandler, ErrorPageTemplateProps, EcopagesRouteInfo, EcopagesSocket, EcopagesWebSocketHandler, FileRouteMiddleware, FileRouteMiddlewareContext, FileOwnedDependencyContribution, GetPageDependencies, GetPageDependenciesContext, GetMetadata, GetMetadataContext, GetStaticPaths, GetStaticProps, HtmlTemplateProps, LayoutProps, LayoutPropsContext, Middleware, MiddlewareList, MiddlewareNext, OutgoingWebSocketMessage, IncomingWebSocketMessage, PageHeadProps, PageMetadataProps, PageParams, PageQuery, PageDependenciesInput, PageDependenciesResult, PageProps, PagePropsFor, PageRequires, PageRobotsMetadata, RequestLocals, RequestPageContext, RenderContext, RenderOptions, RouteGroupBuilder, RouteHandlerContext, RouteMethod, RouteOptions, RouteSchema, SitemapConfig, StandardSchema, StandardSchemaFailureResult, StandardSchemaIssue, StandardSchemaResult, StandardSchemaSuccessResult, StandardSchemaV1, StaticPageContext, StaticPath, WebSocketCloseInfo, WithLocals, } from './contracts.js';
|
|
2
2
|
export type { ViewReference } from './view-reference.js';
|
|
3
3
|
export type { CacheConfig, CacheStrategy } from './cache-types.js';
|
|
4
4
|
export type { CallableComponentOf, ChildrenOf, ComponentOptions, Eco, EcoEmbedProps, EmbedPropsOf, HtmlOptions, LayoutOptions, LazyTrigger, PageOptions, PageOptionsBase, PagePropsForWithLocals, PropsOf, ResultOf, } from './eco-api-types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from '
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
2
|
import { isPathInside } from './path-containment.js';
|
|
3
3
|
const GLOB_SEGMENT = /[*?[\]{}]/;
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ export function resolveAdditionalWatchPath(pattern, rootDir) {
|
|
|
11
11
|
if (!pattern.includes('*')) {
|
|
12
12
|
return { base: path.resolve(rootDir, pattern) };
|
|
13
13
|
}
|
|
14
|
-
const segments =
|
|
14
|
+
const segments = path.fromNative(pattern).split('/');
|
|
15
15
|
const firstGlobIndex = segments.findIndex((segment) => GLOB_SEGMENT.test(segment));
|
|
16
16
|
const staticPrefix = segments.slice(0, firstGlobIndex).join('/') || (firstGlobIndex > 0 ? '/' : '');
|
|
17
17
|
return { base: path.resolve(rootDir, staticPrefix), glob: segments.slice(firstGlobIndex).join('/') };
|
|
@@ -29,9 +29,7 @@ function allowsDotSegments(relativePath, glob) {
|
|
|
29
29
|
.every((segment) => !segment.startsWith('.') || dotPatternSegments.some((pattern) => path.matchesGlob(segment, pattern)));
|
|
30
30
|
}
|
|
31
31
|
function relativeToBase(filePath, base) {
|
|
32
|
-
return isPathInside(filePath, base)
|
|
33
|
-
? path.relative(base, path.resolve(filePath)).split(path.sep).join('/')
|
|
34
|
-
: undefined;
|
|
32
|
+
return isPathInside(filePath, base) ? path.relative(base, path.resolve(filePath)) : undefined;
|
|
35
33
|
}
|
|
36
34
|
export function matchesAdditionalWatchPath(filePath, watchPath) {
|
|
37
35
|
if (!watchPath.glob) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boolean flags that the `ecopages` CLI forwards to the app entry, keyed by flag name.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Single source of truth for two parsers: `parseCliArgs` in the app entry reads every key, and the
|
|
6
|
+
* published `ecopages` wrapper accepts a flag only for the commands listed here. Declaring a flag
|
|
7
|
+
* here is enough for both to accept it, so the wrapper cannot reject a flag the entry understands.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ENTRY_COMMAND_FLAGS: {
|
|
10
|
+
readonly 'keep-going': {
|
|
11
|
+
readonly commands: readonly ["build"];
|
|
12
|
+
readonly help: "Continue the build after a Page fails to render";
|
|
13
|
+
};
|
|
14
|
+
readonly 'serve-only': {
|
|
15
|
+
readonly commands: readonly ["preview"];
|
|
16
|
+
readonly help: "Serve the existing dist/client without rebuilding";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type EntryCommandFlagName = keyof typeof ENTRY_COMMAND_FLAGS;
|
|
20
|
+
/**
|
|
21
|
+
* Names of the entry flags that apply to one CLI command.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getEntryCommandFlagNames(command: string): EntryCommandFlagName[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boolean flags that the `ecopages` CLI forwards to the app entry, keyed by flag name.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Single source of truth for two parsers: `parseCliArgs` in the app entry reads every key, and the
|
|
6
|
+
* published `ecopages` wrapper accepts a flag only for the commands listed here. Declaring a flag
|
|
7
|
+
* here is enough for both to accept it, so the wrapper cannot reject a flag the entry understands.
|
|
8
|
+
*/
|
|
9
|
+
export const ENTRY_COMMAND_FLAGS = {
|
|
10
|
+
'keep-going': {
|
|
11
|
+
commands: ['build'],
|
|
12
|
+
help: 'Continue the build after a Page fails to render',
|
|
13
|
+
},
|
|
14
|
+
'serve-only': {
|
|
15
|
+
commands: ['preview'],
|
|
16
|
+
help: 'Serve the existing dist/client without rebuilding',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Names of the entry flags that apply to one CLI command.
|
|
21
|
+
*/
|
|
22
|
+
export function getEntryCommandFlagNames(command) {
|
|
23
|
+
return Object.keys(ENTRY_COMMAND_FLAGS).filter((name) => ENTRY_COMMAND_FLAGS[name].commands.includes(command));
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names a file inside an installed package as `<name>@<version>/<path inside the package>`, such as
|
|
3
|
+
* `some-lib@1.2.0/css/style.css`, or returns `undefined` when no named `package.json` contains it.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The nearest `package.json` with a `name` is the package root, so a nested one without a name, such as
|
|
7
|
+
* `dist/esm/package.json`, is skipped; a package without a `version` is named `<name>/<path>`. The result does
|
|
8
|
+
* not depend on where the package is installed, so it survives a moved build or another store layout, and two
|
|
9
|
+
* versions of one package name two files. {@link resolvePackagePath} finds the file again.
|
|
10
|
+
*/
|
|
11
|
+
export declare function toPackagePath(filePath: string): string | undefined;
|
|
12
|
+
/** The folder of the nearest `package.json` with a `name` above `filePath`, or `undefined` outside any package. */
|
|
13
|
+
export declare function findPackageRoot(filePath: string): string | undefined;
|
|
14
|
+
/** Splits a {@link toPackagePath} result into the package name and the path inside the package. */
|
|
15
|
+
export declare function splitPackagePath(packagePath: string): {
|
|
16
|
+
name: string;
|
|
17
|
+
subpath: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolves a path {@link toPackagePath} returned to the real path of that file in the package installed for
|
|
21
|
+
* `fromDir`, the folder of the module that imported it.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Looks for `node_modules/<package name>` in `fromDir` and each folder above it, as Node does, so a linked
|
|
25
|
+
* workspace package reaches its own dependencies. When no folder holds the package, it returns the path the
|
|
26
|
+
* package would have in `fromDir/node_modules`: a sealed `ecopages start` keys the file by its package path and
|
|
27
|
+
* never reads it, so a deploy without the package still serves the file the build recorded.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolvePackagePath(fromDir: string, packagePath: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* The file a stylesheet of an installed package stands for when its CSS Module class names are scoped, or
|
|
32
|
+
* `undefined` for a file of the app.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* A scoping Processor derives a class name from the path of the stylesheet relative to the app root, which for a
|
|
36
|
+
* package file includes the store folder, the version folder or the sibling folder of a linked workspace package. This returns
|
|
37
|
+
* `<rootDir>/node_modules/<package name>/<path inside the package>` for a file under `node_modules` or outside
|
|
38
|
+
* `rootDir`, so the names depend on the package name and the path inside it alone, across machines, folders and
|
|
39
|
+
* package-manager layouts, and not on the version. A file outside any named package has no such identity and is
|
|
40
|
+
* scoped by its own path. The file does not have to exist: read the stylesheet from the real path.
|
|
41
|
+
*/
|
|
42
|
+
export declare function toPackageScopeFile(file: string, rootDir: string): string | undefined;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { path } from '@ecopages/file-system/path';
|
|
2
|
+
import { fileSystem } from '@ecopages/file-system';
|
|
3
|
+
import { isPathInside } from './path-containment.js';
|
|
4
|
+
function readPackageIdentity(packageJsonPath) {
|
|
5
|
+
try {
|
|
6
|
+
const { name, version } = JSON.parse(fileSystem.readFileSync(packageJsonPath));
|
|
7
|
+
if (typeof name !== 'string' || name.length === 0)
|
|
8
|
+
return undefined;
|
|
9
|
+
return typeof version === 'string' && version.length > 0 ? { name, version } : { name };
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Names a file inside an installed package as `<name>@<version>/<path inside the package>`, such as
|
|
17
|
+
* `some-lib@1.2.0/css/style.css`, or returns `undefined` when no named `package.json` contains it.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* The nearest `package.json` with a `name` is the package root, so a nested one without a name, such as
|
|
21
|
+
* `dist/esm/package.json`, is skipped; a package without a `version` is named `<name>/<path>`. The result does
|
|
22
|
+
* not depend on where the package is installed, so it survives a moved build or another store layout, and two
|
|
23
|
+
* versions of one package name two files. {@link resolvePackagePath} finds the file again.
|
|
24
|
+
*/
|
|
25
|
+
export function toPackagePath(filePath) {
|
|
26
|
+
if (packagePathCache.has(filePath))
|
|
27
|
+
return packagePathCache.get(filePath);
|
|
28
|
+
const packagePath = findPackagePath(filePath);
|
|
29
|
+
packagePathCache.set(filePath, packagePath);
|
|
30
|
+
return packagePath;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @remarks
|
|
34
|
+
* Dependency keys name node-module scripts by package path on every request, so each file is looked up once per
|
|
35
|
+
* process; a reinstall moves a package to a new real path, which is looked up afresh.
|
|
36
|
+
*/
|
|
37
|
+
const packagePathCache = new Map();
|
|
38
|
+
/** The folder of the nearest `package.json` with a `name` above `filePath`, or `undefined` outside any package. */
|
|
39
|
+
export function findPackageRoot(filePath) {
|
|
40
|
+
let dir = path.dirname(filePath);
|
|
41
|
+
while (true) {
|
|
42
|
+
if (readPackageIdentity(path.join(dir, 'package.json')))
|
|
43
|
+
return dir;
|
|
44
|
+
const parent = path.dirname(dir);
|
|
45
|
+
if (parent === dir)
|
|
46
|
+
return undefined;
|
|
47
|
+
dir = parent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function findPackagePath(filePath) {
|
|
51
|
+
const dir = findPackageRoot(filePath);
|
|
52
|
+
if (!dir)
|
|
53
|
+
return undefined;
|
|
54
|
+
const identity = readPackageIdentity(path.join(dir, 'package.json'));
|
|
55
|
+
return `${identity.name}${identity.version ? `@${identity.version}` : ''}/${path.relative(dir, filePath)}`;
|
|
56
|
+
}
|
|
57
|
+
/** Splits a {@link toPackagePath} result into the package name and the path inside the package. */
|
|
58
|
+
export function splitPackagePath(packagePath) {
|
|
59
|
+
const segments = packagePath.split('/');
|
|
60
|
+
const nameLength = packagePath.startsWith('@') ? 2 : 1;
|
|
61
|
+
const name = segments.slice(0, nameLength).join('/');
|
|
62
|
+
const versionAt = name.indexOf('@', 1);
|
|
63
|
+
return {
|
|
64
|
+
name: versionAt === -1 ? name : name.slice(0, versionAt),
|
|
65
|
+
subpath: segments.slice(nameLength).join('/'),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolves a path {@link toPackagePath} returned to the real path of that file in the package installed for
|
|
70
|
+
* `fromDir`, the folder of the module that imported it.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Looks for `node_modules/<package name>` in `fromDir` and each folder above it, as Node does, so a linked
|
|
74
|
+
* workspace package reaches its own dependencies. When no folder holds the package, it returns the path the
|
|
75
|
+
* package would have in `fromDir/node_modules`: a sealed `ecopages start` keys the file by its package path and
|
|
76
|
+
* never reads it, so a deploy without the package still serves the file the build recorded.
|
|
77
|
+
*/
|
|
78
|
+
export function resolvePackagePath(fromDir, packagePath) {
|
|
79
|
+
const { name, subpath } = splitPackagePath(packagePath);
|
|
80
|
+
let dir = path.resolve(fromDir);
|
|
81
|
+
while (true) {
|
|
82
|
+
const packageDir = path.join(dir, 'node_modules', ...name.split('/'));
|
|
83
|
+
if (fileSystem.exists(path.join(packageDir, 'package.json'))) {
|
|
84
|
+
return path.join(fileSystem.realpath(packageDir), ...subpath.split('/'));
|
|
85
|
+
}
|
|
86
|
+
const parent = path.dirname(dir);
|
|
87
|
+
if (parent === dir)
|
|
88
|
+
break;
|
|
89
|
+
dir = parent;
|
|
90
|
+
}
|
|
91
|
+
return path.join(path.resolve(fromDir), 'node_modules', ...name.split('/'), ...subpath.split('/'));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The file a stylesheet of an installed package stands for when its CSS Module class names are scoped, or
|
|
95
|
+
* `undefined` for a file of the app.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* A scoping Processor derives a class name from the path of the stylesheet relative to the app root, which for a
|
|
99
|
+
* package file includes the store folder, the version folder or the sibling folder of a linked workspace package. This returns
|
|
100
|
+
* `<rootDir>/node_modules/<package name>/<path inside the package>` for a file under `node_modules` or outside
|
|
101
|
+
* `rootDir`, so the names depend on the package name and the path inside it alone, across machines, folders and
|
|
102
|
+
* package-manager layouts, and not on the version. A file outside any named package has no such identity and is
|
|
103
|
+
* scoped by its own path. The file does not have to exist: read the stylesheet from the real path.
|
|
104
|
+
*/
|
|
105
|
+
export function toPackageScopeFile(file, rootDir) {
|
|
106
|
+
const app = fileSystem.exists(rootDir) ? fileSystem.realpath(rootDir) : rootDir;
|
|
107
|
+
if (!file.split('/').includes('node_modules') && isPathInside(file, app))
|
|
108
|
+
return undefined;
|
|
109
|
+
const packagePath = toPackagePath(file);
|
|
110
|
+
if (!packagePath)
|
|
111
|
+
return undefined;
|
|
112
|
+
const { name, subpath } = splitPackagePath(packagePath);
|
|
113
|
+
return path.join(app, 'node_modules', ...name.split('/'), ...subpath.split('/'));
|
|
114
|
+
}
|
|
@@ -18,7 +18,24 @@ export type ReturnParseCliArgs = {
|
|
|
18
18
|
hostname?: string;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* What the process was asked to do: the CLI mode flags and options, before any runtime mode is set.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Pure, so {@link parseCliArgs} and the app runtime's default global-script resolution read the same flags and
|
|
25
|
+
* cannot disagree on build or serve mode. It ignores arguments it does not declare unless `strict` is set, so the
|
|
26
|
+
* runtime default is safe in any process, a test runner included. The ecopages bin is the `ecopages.ts`/`ecopages.js` entry or the
|
|
27
|
+
* `ecopages` package's `bin/cli.js`; another tool's `cli.js` is not treated as it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveEntryCommand(argv: string[], { environment, strict }?: {
|
|
30
|
+
environment?: NodeJS.ProcessEnv;
|
|
31
|
+
strict?: boolean;
|
|
32
|
+
}): ReturnParseCliArgs;
|
|
33
|
+
/**
|
|
34
|
+
* Whether a resolved entry command is a production export: a build, or a preview that is not serve-only.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isProductionExport(command: Pick<ReturnParseCliArgs, 'build' | 'preview' | 'serveOnly'>): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Parses command line arguments for the server and sets the runtime mode.
|
|
22
39
|
* It returns {@link ReturnParseCliArgs}
|
|
23
40
|
*/
|
|
24
41
|
export declare function parseCliArgs(): ReturnParseCliArgs;
|