@ecopages/core 0.2.0-beta.3 → 0.2.0-beta.30
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 +38 -9
- package/package.json +241 -30
- package/src/adapters/README.md +6 -2
- package/src/adapters/abstract/application-adapter.d.ts +123 -6
- package/src/adapters/abstract/application-adapter.js +151 -1
- package/src/adapters/abstract/segment-path-matcher.d.ts +6 -0
- package/src/adapters/abstract/segment-path-matcher.js +149 -0
- package/src/adapters/abstract/server-adapter.d.ts +16 -2
- package/src/adapters/abstract/ws-pattern-matcher.d.ts +12 -0
- package/src/adapters/abstract/ws-pattern-matcher.js +30 -0
- package/src/adapters/bun/bun-user-websocket-lifecycle.d.ts +22 -0
- package/src/adapters/bun/bun-user-websocket-lifecycle.js +96 -0
- package/src/adapters/bun/client-bridge.d.ts +1 -0
- package/src/adapters/bun/client-bridge.js +3 -0
- package/src/adapters/bun/create-app.d.ts +9 -6
- package/src/adapters/bun/create-app.js +76 -45
- package/src/adapters/bun/hmr-manager.d.ts +1 -1
- package/src/adapters/bun/hmr-manager.js +1 -1
- package/src/adapters/bun/index.d.ts +1 -1
- package/src/adapters/bun/index.js +25 -2
- package/src/adapters/bun/runtime-host.d.ts +1 -1
- package/src/adapters/bun/runtime-host.js +1 -1
- package/src/adapters/bun/server-adapter.d.ts +92 -41
- package/src/adapters/bun/server-adapter.js +256 -117
- package/src/adapters/bun/static-preview-host.d.ts +1 -1
- package/src/adapters/bun/static-preview-host.js +25 -20
- package/src/adapters/create-app.d.ts +13 -11
- package/src/adapters/create-app.js +2 -51
- package/src/adapters/index.d.ts +2 -2
- package/src/adapters/index.js +26 -4
- package/src/adapters/node/create-app.d.ts +8 -3
- package/src/adapters/node/create-app.js +61 -13
- package/src/adapters/node/node-client-bridge.d.ts +1 -0
- package/src/adapters/node/node-client-bridge.js +3 -0
- package/src/adapters/node/node-hmr-manager.d.ts +1 -1
- package/src/adapters/node/node-hmr-manager.js +1 -1
- package/src/adapters/node/runtime-host.d.ts +1 -1
- package/src/adapters/node/runtime-host.js +1 -1
- package/src/adapters/node/server-adapter-dependencies.js +4 -0
- package/src/adapters/node/server-adapter.d.ts +64 -23
- package/src/adapters/node/server-adapter.js +169 -142
- package/src/adapters/node/static-content-server.d.ts +1 -0
- package/src/adapters/node/static-content-server.js +10 -2
- package/src/adapters/node/static-preview-host.d.ts +1 -1
- package/src/adapters/node/static-preview-host.js +27 -12
- package/src/adapters/shared/{hmr-entrypoint-registrar.d.ts → hmr/hmr-entrypoint-registrar.d.ts} +31 -30
- package/src/adapters/shared/hmr/hmr-entrypoint-registrar.js +106 -0
- package/src/adapters/shared/{hmr-html-response.d.ts → hmr/hmr-html-response.d.ts} +2 -2
- package/src/adapters/shared/{hmr-html-response.js → hmr/hmr-html-response.js} +4 -1
- package/src/adapters/shared/hmr/shared-hmr-manager.d.ts +101 -0
- package/src/adapters/shared/hmr/shared-hmr-manager.js +432 -0
- package/src/adapters/shared/http/api-request-pipeline.d.ts +23 -0
- package/src/adapters/shared/http/api-request-pipeline.js +129 -0
- package/src/adapters/shared/{api-response.d.ts → http/api-response.d.ts} +1 -1
- package/src/adapters/shared/{api-response.js → http/api-response.js} +6 -23
- package/src/adapters/shared/http/create-body-response.d.ts +12 -0
- package/src/adapters/shared/http/create-body-response.js +23 -0
- package/src/adapters/shared/http/define-api-handler.d.ts +90 -0
- package/src/adapters/shared/http/define-api-handler.js +63 -0
- package/src/adapters/shared/{explicit-static-render-preparation.d.ts → http/explicit-static-render-preparation.d.ts} +3 -3
- package/src/adapters/shared/{explicit-static-route-matcher.d.ts → http/explicit-static-route-matcher.d.ts} +3 -9
- package/src/adapters/shared/{explicit-static-route-matcher.js → http/explicit-static-route-matcher.js} +3 -38
- package/src/adapters/shared/{file-route-middleware-pipeline.d.ts → http/file-route-middleware-pipeline.d.ts} +2 -2
- package/src/adapters/shared/{file-route-middleware-pipeline.js → http/file-route-middleware-pipeline.js} +10 -22
- package/src/adapters/shared/{fs-server-response-factory.d.ts → http/fs-server-response-factory.d.ts} +7 -2
- package/src/adapters/shared/{fs-server-response-factory.js → http/fs-server-response-factory.js} +22 -2
- package/src/adapters/shared/{fs-server-response-matcher.d.ts → http/fs-server-response-matcher.d.ts} +25 -5
- package/src/adapters/shared/{fs-server-response-matcher.js → http/fs-server-response-matcher.js} +109 -27
- package/src/adapters/shared/http/run-middleware-chain.d.ts +5 -0
- package/src/adapters/shared/http/run-middleware-chain.js +17 -0
- package/src/adapters/shared/{application-adapter.d.ts → runtime/application-adapter.d.ts} +2 -2
- package/src/adapters/shared/{application-adapter.js → runtime/application-adapter.js} +1 -1
- package/src/adapters/shared/runtime/copy-runtime-public-dir.d.ts +6 -0
- package/src/adapters/shared/runtime/copy-runtime-public-dir.js +24 -0
- package/src/adapters/shared/runtime/port-manager.d.ts +116 -0
- package/src/adapters/shared/runtime/port-manager.js +196 -0
- package/src/adapters/shared/{render-context.d.ts → runtime/render-context.d.ts} +2 -2
- package/src/adapters/shared/{render-context.js → runtime/render-context.js} +8 -17
- package/src/adapters/shared/{runtime-app-bootstrap.d.ts → runtime/runtime-app-bootstrap.d.ts} +4 -3
- package/src/adapters/shared/{runtime-app-bootstrap.js → runtime/runtime-app-bootstrap.js} +4 -7
- package/src/adapters/shared/runtime/runtime-server-lifecycle.d.ts +46 -0
- package/src/adapters/shared/runtime/runtime-server-lifecycle.js +57 -0
- package/src/adapters/shared/{server-adapter.d.ts → runtime/server-adapter.d.ts} +23 -49
- package/src/adapters/shared/runtime/server-adapter.js +226 -0
- package/src/adapters/shared/{server-route-handler.d.ts → runtime/server-route-handler.d.ts} +6 -33
- package/src/adapters/shared/{server-route-handler.js → runtime/server-route-handler.js} +5 -43
- package/src/adapters/shared/{server-static-builder.d.ts → runtime/server-static-builder.d.ts} +27 -35
- package/src/adapters/shared/runtime/server-static-builder.js +191 -0
- package/src/adapters/shared/{static-preview-host.d.ts → runtime/static-preview-host.d.ts} +6 -1
- package/src/adapters/shared/ws/node-http-websocket-upgrades.d.ts +21 -0
- package/src/adapters/shared/ws/node-http-websocket-upgrades.js +100 -0
- package/src/adapters/shared/ws/websocket-lifecycle.d.ts +24 -0
- package/src/adapters/shared/ws/websocket-lifecycle.js +55 -0
- package/src/build/README.md +140 -31
- package/src/build/app-build-manifest-runtime.d.ts +39 -0
- package/src/build/app-build-manifest-runtime.js +124 -0
- package/src/build/{browser-runtime-plugin.d.ts → browser/browser-runtime-plugin.d.ts} +1 -1
- package/src/build/{browser-runtime-plugin.js → browser/browser-runtime-plugin.js} +1 -1
- package/src/build/browser/jsx-ownership-plugins.d.ts +24 -0
- package/src/build/browser/jsx-ownership-plugins.js +41 -0
- package/src/build/browser/lit-static-render-worker-context.d.ts +2 -0
- package/src/build/browser/lit-static-render-worker-context.js +6 -0
- package/src/build/build-adapter.d.ts +29 -334
- package/src/build/build-adapter.js +32 -133
- package/src/build/cache/build-input-fingerprint.d.ts +28 -0
- package/src/build/cache/build-input-fingerprint.js +31 -0
- package/src/build/cache/cache-constants.d.ts +4 -0
- package/src/build/cache/cache-constants.js +6 -0
- package/src/build/cache/cache-keys.d.ts +22 -0
- package/src/build/cache/cache-keys.js +63 -0
- package/src/build/cache/dev-browser-script-cache.d.ts +34 -0
- package/src/build/cache/dev-browser-script-cache.js +90 -0
- package/src/build/cache/pages-unified-graph-build.d.ts +31 -0
- package/src/build/cache/pages-unified-graph-build.js +198 -0
- package/src/build/cache/production-build-cache.d.ts +20 -0
- package/src/build/cache/production-build-cache.js +63 -0
- package/src/build/cache/server-entry-build-cache.d.ts +43 -0
- package/src/build/cache/server-entry-build-cache.js +165 -0
- package/src/build/contracts/build-contracts.d.ts +96 -0
- package/src/build/contracts/build-manifest.d.ts +90 -0
- package/src/build/{build-manifest.js → contracts/build-manifest.js} +2 -2
- package/src/build/contracts/build-types.js +0 -0
- package/src/build/{rolldown-adapter-helpers.d.ts → rolldown/rolldown-adapter-helpers.d.ts} +23 -9
- package/src/build/{rolldown-adapter-helpers.js → rolldown/rolldown-adapter-helpers.js} +99 -13
- package/src/build/{rolldown-build-adapter.d.ts → rolldown/rolldown-build-adapter.d.ts} +3 -7
- package/src/build/{rolldown-build-adapter.js → rolldown/rolldown-build-adapter.js} +3 -3
- package/src/build/rolldown/rolldown-build-invocation-metrics.d.ts +12 -0
- package/src/build/rolldown/rolldown-build-invocation-metrics.js +43 -0
- package/src/build/{rolldown-plugin-bridge.d.ts → rolldown/rolldown-plugin-bridge.d.ts} +16 -2
- package/src/build/{rolldown-plugin-bridge.js → rolldown/rolldown-plugin-bridge.js} +21 -6
- package/src/build/rolldown/rolldown-source-transform-pass.d.ts +15 -0
- package/src/build/rolldown/rolldown-source-transform-pass.js +61 -0
- package/src/build/rolldown/runtime-build-output-normalizer.d.ts +10 -0
- package/src/build/rolldown/runtime-build-output-normalizer.js +201 -0
- package/src/build/runtime/build-profile-options.d.ts +7 -0
- package/src/build/runtime/build-profile-options.js +37 -0
- package/src/build/runtime/build-request-identity.d.ts +17 -0
- package/src/build/runtime/build-request-identity.js +54 -0
- package/src/build/runtime/build-request-policy.d.ts +59 -0
- package/src/build/runtime/build-request-policy.js +46 -0
- package/src/build/runtime/build-runtime.d.ts +28 -0
- package/src/build/runtime/build-runtime.js +65 -0
- package/src/build/runtime/deduping-build-executor.d.ts +21 -0
- package/src/build/runtime/deduping-build-executor.js +34 -0
- package/src/build/runtime/parallel-build-executor.d.ts +21 -0
- package/src/build/runtime/parallel-build-executor.js +52 -0
- package/src/build/{serialized-build-executor.d.ts → runtime/serialized-build-executor.d.ts} +1 -1
- package/src/client/navigation-scripts/classification.d.ts +16 -0
- package/src/client/navigation-scripts/classification.js +41 -0
- package/src/client/navigation-scripts/index.d.ts +3 -0
- package/src/client/navigation-scripts/index.js +23 -0
- package/src/client/navigation-scripts/navigation-scripts.test.browser.js +65 -0
- package/src/client/navigation-scripts/registry.d.ts +11 -0
- package/src/client/navigation-scripts/registry.js +12 -0
- package/src/client/navigation-scripts/rerun-queue.d.ts +37 -0
- package/src/client/navigation-scripts/rerun-queue.js +73 -0
- package/src/client/scroll.d.ts +17 -0
- package/src/client/scroll.js +25 -0
- package/src/client/scroll.test.browser.js +37 -0
- package/src/client/view-transitions.d.ts +16 -0
- package/src/client/view-transitions.js +63 -0
- package/src/config/config-builder.d.ts +25 -10
- package/src/config/config-builder.js +53 -11
- package/src/config/constants.d.ts +1 -0
- package/src/config/constants.js +2 -1
- package/src/dev/client-bridge-registry.d.ts +5 -0
- package/src/dev/client-bridge-registry.js +15 -0
- package/src/dev/dev-client-ownership.d.ts +7 -0
- package/src/dev/dev-client-ownership.js +6 -0
- package/src/dev/hmr-manager-registry.d.ts +8 -0
- package/src/dev/hmr-manager-registry.js +15 -0
- package/src/dev/host-runtime.d.ts +3 -0
- package/src/dev/host-runtime.js +7 -0
- package/src/dev/runtime-server-started-message.d.ts +2 -0
- package/src/dev/runtime-server-started-message.js +6 -0
- package/src/diagnostics/request-build-dedupe.d.ts +18 -0
- package/src/diagnostics/request-build-dedupe.js +33 -0
- package/src/diagnostics/startup-trace.d.ts +72 -0
- package/src/diagnostics/startup-trace.js +253 -0
- package/src/eco/README.md +11 -0
- package/src/eco/eco-declared-component.d.ts +14 -0
- package/src/eco/eco-declared-component.js +16 -0
- package/src/eco/eco.browser.js +5 -6
- package/src/eco/eco.js +7 -8
- package/src/eco/eco.types.d.ts +14 -3
- package/src/eco/eco.utils.d.ts +1 -1
- package/src/eco/eco.utils.js +1 -1
- package/src/eco/page-layout-normalization.d.ts +21 -0
- package/src/eco/page-layout-normalization.js +59 -0
- package/src/env.d.ts +2 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/index.js +7 -1
- package/src/errors/undeclared-component-dependency-error.d.ts +11 -0
- package/src/errors/undeclared-component-dependency-error.js +17 -0
- package/src/hmr/client/hmr-runtime.js +7 -4
- package/src/hmr/hmr-entrypoint-output.d.ts +49 -0
- package/src/hmr/hmr-entrypoint-output.js +60 -0
- package/src/hmr/hmr-file-change-prep.d.ts +10 -0
- package/src/hmr/hmr-file-change-prep.js +17 -0
- package/src/hmr/hmr-strategy.d.ts +15 -0
- package/src/hmr/hmr-strategy.js +19 -0
- package/src/hmr/strategies/js-hmr-strategy.d.ts +3 -5
- package/src/hmr/strategies/js-hmr-strategy.js +72 -19
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.d.ts +17 -0
- package/src/hmr/strategies/server-rendered-template-hmr-strategy.js +29 -0
- package/src/index.d.ts +2 -1
- package/src/index.js +28 -2
- package/src/integrations/ghtml/ghtml-renderer.d.ts +2 -6
- package/src/integrations/ghtml/ghtml-renderer.js +2 -51
- package/src/integrations/ghtml/ghtml.plugin.d.ts +3 -16
- package/src/integrations/ghtml/ghtml.plugin.js +7 -14
- package/src/plugins/alias-resolver-cache.d.ts +6 -9
- package/src/plugins/alias-resolver-plugin.d.ts +3 -3
- package/src/plugins/alias-resolver-plugin.js +38 -51
- package/src/plugins/define-integration.d.ts +26 -0
- package/src/plugins/define-integration.js +19 -0
- package/src/plugins/eco-component-meta-plugin.d.ts +1 -1
- package/src/plugins/eco-component-meta-plugin.js +5 -8
- package/src/plugins/foreign-jsx-override-plugin.d.ts +1 -1
- package/src/plugins/foreign-jsx-override-plugin.js +4 -6
- package/src/plugins/integration-plugin.d.ts +43 -14
- package/src/plugins/integration-plugin.js +18 -5
- package/src/plugins/jsx-import-source.utils.d.ts +8 -0
- package/src/plugins/jsx-import-source.utils.js +26 -0
- package/src/plugins/processor.d.ts +61 -12
- package/src/plugins/processor.js +24 -5
- package/src/plugins/source-transform.d.ts +32 -1
- package/src/plugins/source-transform.js +23 -1
- package/src/plugins/tsconfig-import-resolver.d.ts +18 -0
- package/src/plugins/tsconfig-import-resolver.js +159 -0
- package/src/route-renderer/GRAPH.md +26 -32
- package/src/route-renderer/README.md +38 -31
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.d.ts +107 -0
- package/src/route-renderer/orchestration/document-shell/document-shell-render.service.js +148 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.d.ts +20 -0
- package/src/route-renderer/orchestration/document-shell/layout-shell-props.service.js +31 -0
- package/src/route-renderer/orchestration/{component-render-context.d.ts → foreign-child/component-render-context.d.ts} +8 -15
- package/src/route-renderer/orchestration/{component-render-context.js → foreign-child/component-render-context.js} +4 -2
- package/src/route-renderer/orchestration/{render-output.utils.d.ts → foreign-child/foreign-child-output.utils.d.ts} +17 -7
- package/src/route-renderer/orchestration/{render-output.utils.js → foreign-child/foreign-child-output.utils.js} +35 -26
- package/src/route-renderer/orchestration/{foreign-subtree-execution.service.d.ts → foreign-child/foreign-subtree-execution.service.d.ts} +64 -34
- package/src/route-renderer/orchestration/{foreign-subtree-execution.service.js → foreign-child/foreign-subtree-execution.service.js} +170 -37
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.d.ts +19 -0
- package/src/route-renderer/orchestration/foreign-child/owning-renderer-resolution.js +35 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +24 -143
- package/src/route-renderer/orchestration/integration-renderer.js +163 -402
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.d.ts +75 -0
- package/src/route-renderer/orchestration/integration-renderer.test-fixtures.js +177 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.d.ts +10 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph-collectors.js +143 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.d.ts +34 -0
- package/src/route-renderer/orchestration/ownership-graph/component-graph.js +96 -0
- package/src/route-renderer/orchestration/{ownership-validation.service.d.ts → ownership-graph/ownership-validation.service.d.ts} +7 -2
- package/src/route-renderer/orchestration/{ownership-validation.service.js → ownership-graph/ownership-validation.service.js} +30 -3
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.d.ts +7 -0
- package/src/route-renderer/orchestration/page-browser-graph/global-injector-assets.service.js +32 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.loader.d.ts +9 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-contribution.loader.js +7 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.d.ts +12 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-merge.utils.js +29 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.d.ts +106 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js +436 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.d.ts +31 -0
- package/src/route-renderer/orchestration/page-browser-graph/page-browser-graph.service.js +229 -0
- package/src/route-renderer/orchestration/{processed-asset-dedupe.d.ts → page-browser-graph/processed-asset-dedupe.d.ts} +1 -1
- package/src/route-renderer/orchestration/route-pipeline/integration-route-render-adapter.d.ts +31 -0
- package/src/route-renderer/orchestration/route-pipeline/integration-route-render-adapter.js +25 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.d.ts +6 -0
- package/src/route-renderer/orchestration/route-pipeline/marker-artifact.utils.js +27 -0
- package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.d.ts +15 -0
- package/src/route-renderer/orchestration/route-pipeline/robots-meta.contribution.js +36 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.d.ts +20 -0
- package/src/route-renderer/orchestration/route-pipeline/route-html-finalization.service.js +24 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.d.ts +25 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.builder.js +49 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.d.ts +4 -0
- package/src/route-renderer/orchestration/route-pipeline/route-prepared-options.utils.js +33 -0
- package/src/route-renderer/orchestration/{route-render-orchestrator.d.ts → route-pipeline/route-render-orchestrator.d.ts} +13 -53
- package/src/route-renderer/orchestration/route-pipeline/route-render-orchestrator.js +162 -0
- package/src/route-renderer/orchestration/string-markup-renderer.d.ts +14 -0
- package/src/route-renderer/orchestration/string-markup-renderer.js +55 -0
- package/src/route-renderer/page-loading/component-dependency-collection.js +5 -2
- package/src/route-renderer/page-loading/ecopages-virtual-imports.d.ts +6 -0
- package/src/route-renderer/page-loading/ecopages-virtual-imports.js +7 -2
- package/src/route-renderer/page-loading/module-declaration-aggregation.js +4 -0
- package/src/router/client/link-intent.d.ts +11 -21
- package/src/router/client/link-intent.js +10 -0
- package/src/router/client/link-intent.test.browser.js +12 -1
- package/src/router/client/link-navigation-policy.d.ts +45 -0
- package/src/router/client/link-navigation-policy.js +101 -0
- package/src/router/client/link-navigation-policy.test.browser.d.ts +1 -0
- package/src/router/client/link-navigation-policy.test.browser.js +92 -0
- package/src/router/client/navigation-coordinator.d.ts +1 -1
- package/src/router/client/navigation-coordinator.js +12 -2
- package/src/services/assets/asset-processing-service/asset-dependency-keys.d.ts +13 -0
- package/src/services/assets/asset-processing-service/asset-dependency-keys.js +3 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +6 -1
- package/src/services/assets/asset-processing-service/asset-processing.service.js +44 -5
- package/src/services/assets/asset-processing-service/assets.types.d.ts +1 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +2 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +1 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.d.ts +52 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry-resolution.js +78 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +4 -2
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +28 -13
- package/src/services/assets/asset-processing-service/finalize-processed-asset.d.ts +3 -0
- package/src/services/assets/asset-processing-service/finalize-processed-asset.js +7 -0
- package/src/services/assets/asset-processing-service/grouped-content-bundles.d.ts +2 -1
- package/src/services/assets/asset-processing-service/grouped-content-bundles.js +38 -12
- package/src/services/assets/asset-processing-service/index.d.ts +2 -0
- package/src/services/assets/asset-processing-service/index.js +2 -0
- package/src/services/assets/asset-processing-service/inline-content-script-body.d.ts +11 -0
- package/src/services/assets/asset-processing-service/inline-content-script-body.js +17 -0
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.d.ts +9 -0
- package/src/services/assets/asset-processing-service/materialize-content-script-asset.js +18 -0
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +0 -2
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +2 -15
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts +8 -0
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +73 -68
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +0 -1
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +18 -15
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +17 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +2 -31
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +0 -3
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +2 -30
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.d.ts +2 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/stylesheet-processor-pipeline.js +43 -0
- package/src/services/assets/asset-processing-service/resolve-integration-plugin.d.ts +4 -0
- package/src/services/assets/asset-processing-service/resolve-integration-plugin.js +17 -0
- package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.d.ts +0 -1
- package/src/services/assets/asset-processing-service/ungrouped-dependency-processing.js +5 -10
- package/src/services/assets/browser-bundle.service.d.ts +28 -30
- package/src/services/assets/browser-bundle.service.js +28 -19
- package/src/services/html/html-transformer.service.d.ts +1 -1
- package/src/services/html/html-transformer.service.js +5 -5
- package/src/services/invalidation/development-invalidation.service.d.ts +25 -2
- package/src/services/invalidation/development-invalidation.service.js +64 -11
- package/src/services/module-loading/README.md +49 -0
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +8 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +3 -21
- package/src/services/module-loading/page-module-import.service.d.ts +6 -2
- package/src/services/module-loading/page-module-import.service.js +110 -47
- package/src/services/module-loading/route-module-build-cache-registry.d.ts +24 -0
- package/src/services/module-loading/route-module-build-cache-registry.js +37 -0
- package/src/services/module-loading/route-module-build-cache.d.ts +4 -0
- package/src/services/module-loading/route-module-build-cache.js +38 -0
- package/src/services/module-loading/route-module-build-cache.store.d.ts +57 -0
- package/src/services/module-loading/route-module-build-cache.store.js +207 -0
- package/src/services/module-loading/route-module-build-manifest.d.ts +54 -0
- package/src/services/module-loading/route-module-build-manifest.js +85 -0
- package/src/services/module-loading/route-module-dependency-hasher.d.ts +81 -0
- package/src/services/module-loading/route-module-dependency-hasher.js +122 -0
- package/src/services/module-loading/server-module-transpiler.service.d.ts +1 -1
- package/src/services/module-loading/server-module-transpiler.service.js +1 -1
- package/src/services/validation/schema-validation-service.d.ts +1 -4
- package/src/services/validation/schema-validation-service.js +12 -13
- package/src/services/validation/standard-schema.types.d.ts +9 -62
- package/src/services/validation/validate-standard-schema.d.ts +7 -0
- package/src/services/validation/validate-standard-schema.js +14 -0
- package/src/static-site-generator/README.md +41 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.d.ts +28 -0
- package/src/static-site-generator/production-page-browser-graph-prebuild.js +22 -0
- package/src/static-site-generator/sitemap-routes.d.ts +14 -0
- package/src/static-site-generator/sitemap-routes.js +31 -0
- package/src/static-site-generator/sitemap.d.ts +15 -0
- package/src/static-site-generator/sitemap.js +33 -0
- package/src/static-site-generator/static-build-invalidation.d.ts +10 -0
- package/src/static-site-generator/static-build-invalidation.js +59 -0
- package/src/static-site-generator/static-export-context.d.ts +30 -0
- package/src/static-site-generator/static-export-context.js +0 -0
- package/src/static-site-generator/static-site-generator.d.ts +43 -25
- package/src/static-site-generator/static-site-generator.js +381 -106
- package/src/types/internal-types.d.ts +39 -13
- package/src/types/public-types.d.ts +289 -52
- package/src/utils/ecopages-route-info.d.ts +26 -0
- package/src/utils/ecopages-route-info.js +26 -0
- package/src/utils/html-escaping.d.ts +7 -0
- package/src/utils/html-escaping.js +5 -1
- package/src/utils/parse-cli-args.d.ts +2 -0
- package/src/utils/parse-cli-args.js +6 -0
- package/src/utils/path-pattern.d.ts +23 -0
- package/src/utils/path-pattern.js +27 -0
- package/src/utils/server-utils.module.d.ts +3 -2
- package/src/utils/server-utils.module.js +5 -6
- package/src/utils/static-file-extensions.d.ts +12 -0
- package/src/utils/static-file-extensions.js +48 -0
- package/src/watchers/project-watcher-ignore.d.ts +11 -0
- package/src/watchers/project-watcher-ignore.js +16 -0
- package/src/watchers/project-watcher.d.ts +29 -6
- package/src/watchers/project-watcher.js +146 -34
- package/src/watchers/project-watcher.test-helpers.js +5 -5
- package/src/adapters/shared/define-api-handler.d.ts +0 -25
- package/src/adapters/shared/define-api-handler.js +0 -15
- package/src/adapters/shared/hmr-entrypoint-registrar.js +0 -87
- package/src/adapters/shared/server-adapter.js +0 -436
- package/src/adapters/shared/server-static-builder.js +0 -162
- package/src/adapters/shared/shared-hmr-manager.d.ts +0 -59
- package/src/adapters/shared/shared-hmr-manager.js +0 -241
- package/src/build/build-manifest.d.ts +0 -33
- package/src/build/rolldown-dev-build-adapter.d.ts +0 -82
- package/src/build/rolldown-dev-build-adapter.js +0 -166
- package/src/build/runtime-build-executor.d.ts +0 -21
- package/src/build/runtime-build-executor.js +0 -19
- package/src/build/runtime-build-output-normalizer.d.ts +0 -3
- package/src/build/runtime-build-output-normalizer.js +0 -111
- package/src/hmr/hmr.postcss.test.e2e.js +0 -31
- package/src/hmr/hmr.test.e2e.js +0 -43
- package/src/route-renderer/orchestration/declared-ownership-graph.d.ts +0 -18
- package/src/route-renderer/orchestration/declared-ownership-graph.js +0 -34
- package/src/route-renderer/orchestration/ownership-planning.service.d.ts +0 -24
- package/src/route-renderer/orchestration/ownership-planning.service.js +0 -63
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.d.ts +0 -91
- package/src/route-renderer/orchestration/queued-foreign-subtree-resolution.service.js +0 -170
- package/src/route-renderer/orchestration/route-render-orchestrator.js +0 -577
- package/src/route-renderer/orchestration/template-serialization.d.ts +0 -38
- package/src/route-renderer/orchestration/template-serialization.js +0 -45
- /package/src/adapters/shared/{explicit-static-render-preparation.js → http/explicit-static-render-preparation.js} +0 -0
- /package/src/adapters/shared/{runtime-host.d.ts → runtime/runtime-host.d.ts} +0 -0
- /package/src/adapters/shared/{runtime-host.js → runtime/runtime-host.js} +0 -0
- /package/src/adapters/shared/{static-preview-host.js → runtime/static-preview-host.js} +0 -0
- /package/src/build/{browser-runtime-manifest.d.ts → browser/browser-runtime-manifest.d.ts} +0 -0
- /package/src/build/{browser-runtime-manifest.js → browser/browser-runtime-manifest.js} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.d.ts → browser/browser-runtime-plugin-helpers.d.ts} +0 -0
- /package/src/build/{browser-runtime-plugin-helpers.js → browser/browser-runtime-plugin-helpers.js} +0 -0
- /package/src/build/{build-types.js → contracts/build-contracts.js} +0 -0
- /package/src/build/{build-types.d.ts → contracts/build-types.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.d.ts → rolldown/server-side-css-shim-plugin.d.ts} +0 -0
- /package/src/build/{server-side-css-shim-plugin.js → rolldown/server-side-css-shim-plugin.js} +0 -0
- /package/src/build/{serialized-build-executor.js → runtime/serialized-build-executor.js} +0 -0
- /package/src/{hmr/hmr.postcss.test.e2e.d.ts → client/navigation-scripts/navigation-scripts.test.browser.d.ts} +0 -0
- /package/src/{hmr/hmr.test.e2e.d.ts → client/scroll.test.browser.d.ts} +0 -0
- /package/src/route-renderer/orchestration/{processed-asset-dedupe.js → page-browser-graph/processed-asset-dedupe.js} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readProductionCacheManifest, writeProductionCacheManifest } from "../../build/cache/production-build-cache.js";
|
|
3
|
+
import { createJsxCacheKey, createPluginCacheKey, getCorePackageVersion } from "../../build/cache/cache-keys.js";
|
|
4
|
+
import {
|
|
5
|
+
createJsxCacheKey as createJsxCacheKey2,
|
|
6
|
+
createPluginCacheKey as createPluginCacheKey2,
|
|
7
|
+
getCorePackageVersion as getCorePackageVersion2,
|
|
8
|
+
hashPluginSetup
|
|
9
|
+
} from "../../build/cache/cache-keys.js";
|
|
10
|
+
import { ROUTE_MODULE_BUILD_CACHE_FILENAME } from "../../build/cache/cache-constants.js";
|
|
11
|
+
function normalizeRouteModuleCachePath(filePath) {
|
|
12
|
+
return path.resolve(filePath);
|
|
13
|
+
}
|
|
14
|
+
function shouldPersistRouteModuleBuildCache(options) {
|
|
15
|
+
if (process.env.NODE_ENV !== "production") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (options.bypassCache) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if ((options.invalidationVersion ?? 0) > 0) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (options.cacheScope) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
function resolvePageModuleOutputFileName(options) {
|
|
30
|
+
const fileBaseName = path.basename(options.filePath, path.extname(options.filePath));
|
|
31
|
+
const cacheScopeSuffix = options.cacheScope ? `-${sanitizeCacheScope(options.cacheScope)}` : "";
|
|
32
|
+
const invalidationSuffix = shouldVersionBuildOutputPath(options.invalidationVersion ?? 0) ? `-v${options.invalidationVersion}` : "";
|
|
33
|
+
return `${fileBaseName}-${options.fileHash}${cacheScopeSuffix}${invalidationSuffix}.mjs`;
|
|
34
|
+
}
|
|
35
|
+
function createPersistedRouteModuleBuildKey(options) {
|
|
36
|
+
return [
|
|
37
|
+
path.resolve(options.rootDir),
|
|
38
|
+
path.resolve(options.outdir),
|
|
39
|
+
options.splitting ?? "default",
|
|
40
|
+
options.externalPackages ?? "default",
|
|
41
|
+
createJsxCacheKey(options.jsx),
|
|
42
|
+
createPluginCacheKey(options.plugins)
|
|
43
|
+
].join("::");
|
|
44
|
+
}
|
|
45
|
+
function createEmptyRouteModuleBuildCacheManifest() {
|
|
46
|
+
return {
|
|
47
|
+
invalidationVersion: getCorePackageVersion(),
|
|
48
|
+
entries: {}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function readRouteModuleBuildCacheManifest(manifestPath) {
|
|
52
|
+
const parsed = readProductionCacheManifest(manifestPath);
|
|
53
|
+
if (!parsed || typeof parsed.entries !== "object") {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
invalidationVersion: parsed.invalidationVersion ?? "",
|
|
58
|
+
configHash: parsed.configHash,
|
|
59
|
+
buildInputsFingerprint: parsed.buildInputsFingerprint,
|
|
60
|
+
entries: parsed.entries
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function writeRouteModuleBuildCacheManifest(manifestPath, manifest) {
|
|
64
|
+
writeProductionCacheManifest(manifestPath, manifest);
|
|
65
|
+
}
|
|
66
|
+
function shouldVersionBuildOutputPath(invalidationVersion) {
|
|
67
|
+
return typeof Bun !== "undefined" && invalidationVersion > 0;
|
|
68
|
+
}
|
|
69
|
+
function sanitizeCacheScope(cacheScope) {
|
|
70
|
+
return cacheScope.replace(/[^a-zA-Z0-9_-]+/g, "-");
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
ROUTE_MODULE_BUILD_CACHE_FILENAME,
|
|
74
|
+
createEmptyRouteModuleBuildCacheManifest,
|
|
75
|
+
createJsxCacheKey2 as createJsxCacheKey,
|
|
76
|
+
createPersistedRouteModuleBuildKey,
|
|
77
|
+
createPluginCacheKey2 as createPluginCacheKey,
|
|
78
|
+
getCorePackageVersion2 as getCorePackageVersion,
|
|
79
|
+
hashPluginSetup,
|
|
80
|
+
normalizeRouteModuleCachePath,
|
|
81
|
+
readRouteModuleBuildCacheManifest,
|
|
82
|
+
resolvePageModuleOutputFileName,
|
|
83
|
+
shouldPersistRouteModuleBuildCache,
|
|
84
|
+
writeRouteModuleBuildCacheManifest
|
|
85
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { BuildResult } from '../../build/build-adapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Content hashes for every trackable source file in one route module's import graph.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Keys are normalized absolute filesystem paths. Values are opaque content hashes
|
|
7
|
+
* produced by the active {@link FileSystem} implementation. Only app-owned source
|
|
8
|
+
* files are tracked; `node:` builtins and `node_modules` paths are excluded
|
|
9
|
+
* because they are covered by the core package {@link getCorePackageVersion | invalidation version}.
|
|
10
|
+
*/
|
|
11
|
+
export type RouteModuleDependencyHashes = Record<string, string>;
|
|
12
|
+
type HashFileFn = (filePath: string) => string;
|
|
13
|
+
type ExistsFn = (filePath: string) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Lazily hashes route-module dependency files while memoizing results for one build run.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Multiple route modules often share layouts or utilities. Memoizing per path avoids
|
|
19
|
+
* re-reading the same dependency file while validating or recording many cache entries
|
|
20
|
+
* during one production build.
|
|
21
|
+
*/
|
|
22
|
+
export declare class RouteModuleDependencyHasher {
|
|
23
|
+
private readonly memo;
|
|
24
|
+
private readonly hashFile;
|
|
25
|
+
private readonly exists;
|
|
26
|
+
constructor(dependencies?: {
|
|
27
|
+
hashFile?: HashFileFn;
|
|
28
|
+
exists?: ExistsFn;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Returns a memoized content hash for one trackable dependency path.
|
|
32
|
+
*
|
|
33
|
+
* @param filePath - Absolute or project-relative source path.
|
|
34
|
+
* @returns The content hash, or `undefined` when the path is not trackable or missing.
|
|
35
|
+
*/
|
|
36
|
+
hashDependency(filePath: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Builds the dependency-hash map for one route entrypoint graph.
|
|
39
|
+
*
|
|
40
|
+
* @param modulePaths - Raw module ids from the bundler dependency graph.
|
|
41
|
+
* @returns Hashes for every trackable, existing source file in the graph.
|
|
42
|
+
*/
|
|
43
|
+
createDependencyHashes(modulePaths: readonly string[]): RouteModuleDependencyHashes;
|
|
44
|
+
/**
|
|
45
|
+
* Returns whether every stored dependency hash still matches the current file contents.
|
|
46
|
+
*
|
|
47
|
+
* @param storedHashes - Dependency hashes previously persisted for one route module.
|
|
48
|
+
* @param entrypointPath - Route entry file whose hash is validated separately.
|
|
49
|
+
* @param entrypointSourceHash - Already-validated content hash for {@link entrypointPath}.
|
|
50
|
+
* @returns `true` when all stored hashes are present and still valid.
|
|
51
|
+
*/
|
|
52
|
+
matchesStoredHashes(storedHashes: RouteModuleDependencyHashes | undefined, entrypointPath?: string, entrypointSourceHash?: string): boolean;
|
|
53
|
+
/** Clears the per-build memo so subsequent reads reflect current file contents. */
|
|
54
|
+
clearMemo(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns whether a bundler module id should participate in route-module cache invalidation.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* Builtins and installed packages are excluded. Their changes are expected to be
|
|
61
|
+
* reflected through framework-level invalidation instead of per-route file hashing.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isTrackableRouteModuleDependency(modulePath: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Filters a bundler module list down to trackable app-owned source files.
|
|
66
|
+
*/
|
|
67
|
+
export declare function filterTrackableRouteModuleDependencies(modulePaths: readonly string[]): string[];
|
|
68
|
+
/**
|
|
69
|
+
* Resolves the dependency module list for one route entrypoint from a build result.
|
|
70
|
+
*
|
|
71
|
+
* @param buildResult - Completed route-module build output.
|
|
72
|
+
* @param entrypointPath - Absolute or root-relative route source path used as the build entry.
|
|
73
|
+
* @param rootDir - Project root used to normalize relative module ids.
|
|
74
|
+
* @returns Normalized module paths, falling back to the entrypoint when no graph is available.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveRouteModuleDependencyPaths(buildResult: Pick<BuildResult, 'dependencyGraph'>, entrypointPath: string, rootDir: string): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Convenience helper that combines graph extraction and dependency hashing.
|
|
79
|
+
*/
|
|
80
|
+
export declare function createRouteModuleDependencyHashes(hasher: RouteModuleDependencyHasher, buildResult: Pick<BuildResult, 'dependencyGraph'>, entrypointPath: string, rootDir: string): RouteModuleDependencyHashes;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
+
class RouteModuleDependencyHasher {
|
|
4
|
+
memo = /* @__PURE__ */ new Map();
|
|
5
|
+
hashFile;
|
|
6
|
+
exists;
|
|
7
|
+
constructor(dependencies) {
|
|
8
|
+
this.hashFile = dependencies?.hashFile ?? ((filePath) => fileSystem.hash(filePath));
|
|
9
|
+
this.exists = dependencies?.exists ?? ((filePath) => fileSystem.exists(filePath));
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns a memoized content hash for one trackable dependency path.
|
|
13
|
+
*
|
|
14
|
+
* @param filePath - Absolute or project-relative source path.
|
|
15
|
+
* @returns The content hash, or `undefined` when the path is not trackable or missing.
|
|
16
|
+
*/
|
|
17
|
+
hashDependency(filePath) {
|
|
18
|
+
const normalizedPath = path.normalize(filePath);
|
|
19
|
+
if (!isTrackableRouteModuleDependency(normalizedPath)) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
if (!this.exists(normalizedPath)) {
|
|
23
|
+
return void 0;
|
|
24
|
+
}
|
|
25
|
+
const cachedHash = this.memo.get(normalizedPath);
|
|
26
|
+
if (cachedHash) {
|
|
27
|
+
return cachedHash;
|
|
28
|
+
}
|
|
29
|
+
const nextHash = this.hashFile(normalizedPath);
|
|
30
|
+
this.memo.set(normalizedPath, nextHash);
|
|
31
|
+
return nextHash;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds the dependency-hash map for one route entrypoint graph.
|
|
35
|
+
*
|
|
36
|
+
* @param modulePaths - Raw module ids from the bundler dependency graph.
|
|
37
|
+
* @returns Hashes for every trackable, existing source file in the graph.
|
|
38
|
+
*/
|
|
39
|
+
createDependencyHashes(modulePaths) {
|
|
40
|
+
const dependencyHashes = {};
|
|
41
|
+
for (const modulePath of filterTrackableRouteModuleDependencies(modulePaths)) {
|
|
42
|
+
const dependencyHash = this.hashDependency(modulePath);
|
|
43
|
+
if (dependencyHash) {
|
|
44
|
+
dependencyHashes[modulePath] = dependencyHash;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return dependencyHashes;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns whether every stored dependency hash still matches the current file contents.
|
|
51
|
+
*
|
|
52
|
+
* @param storedHashes - Dependency hashes previously persisted for one route module.
|
|
53
|
+
* @param entrypointPath - Route entry file whose hash is validated separately.
|
|
54
|
+
* @param entrypointSourceHash - Already-validated content hash for {@link entrypointPath}.
|
|
55
|
+
* @returns `true` when all stored hashes are present and still valid.
|
|
56
|
+
*/
|
|
57
|
+
matchesStoredHashes(storedHashes, entrypointPath, entrypointSourceHash) {
|
|
58
|
+
this.clearMemo();
|
|
59
|
+
if (!storedHashes || Object.keys(storedHashes).length === 0) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const normalizedEntrypoint = entrypointPath ? path.normalize(entrypointPath) : void 0;
|
|
63
|
+
for (const [dependencyPath, storedHash] of Object.entries(storedHashes)) {
|
|
64
|
+
if (normalizedEntrypoint && path.normalize(dependencyPath) === normalizedEntrypoint) {
|
|
65
|
+
if (entrypointSourceHash && storedHash !== entrypointSourceHash) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const currentHash = this.hashDependency(dependencyPath);
|
|
71
|
+
if (!currentHash || currentHash !== storedHash) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
/** Clears the per-build memo so subsequent reads reflect current file contents. */
|
|
78
|
+
clearMemo() {
|
|
79
|
+
this.memo.clear();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function isTrackableRouteModuleDependency(modulePath) {
|
|
83
|
+
const normalizedPath = path.normalize(modulePath);
|
|
84
|
+
if (normalizedPath.startsWith("node:")) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (normalizedPath.includes(`${path.sep}node_modules${path.sep}`)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return /\.(?:[cm]?[jt]sx?|mdx)$/iu.test(normalizedPath) || normalizedPath.endsWith(".json");
|
|
91
|
+
}
|
|
92
|
+
function filterTrackableRouteModuleDependencies(modulePaths) {
|
|
93
|
+
const uniquePaths = /* @__PURE__ */ new Set();
|
|
94
|
+
for (const modulePath of modulePaths) {
|
|
95
|
+
const normalizedPath = path.normalize(modulePath);
|
|
96
|
+
if (isTrackableRouteModuleDependency(normalizedPath)) {
|
|
97
|
+
uniquePaths.add(normalizedPath);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return Array.from(uniquePaths).sort();
|
|
101
|
+
}
|
|
102
|
+
function resolveRouteModuleDependencyPaths(buildResult, entrypointPath, rootDir) {
|
|
103
|
+
const normalizedEntrypoint = path.isAbsolute(entrypointPath) ? path.normalize(entrypointPath) : path.normalize(path.resolve(rootDir, entrypointPath));
|
|
104
|
+
const graphEntrypoints = buildResult.dependencyGraph?.entrypoints ?? {};
|
|
105
|
+
const dependencyPaths = graphEntrypoints[normalizedEntrypoint] ?? graphEntrypoints[entrypointPath] ?? Object.entries(graphEntrypoints).find(([candidate]) => path.normalize(candidate) === normalizedEntrypoint)?.[1];
|
|
106
|
+
if (!dependencyPaths || dependencyPaths.length === 0) {
|
|
107
|
+
return [normalizedEntrypoint];
|
|
108
|
+
}
|
|
109
|
+
return dependencyPaths.map(
|
|
110
|
+
(dependencyPath) => path.isAbsolute(dependencyPath) ? path.normalize(dependencyPath) : path.normalize(path.resolve(rootDir, dependencyPath))
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function createRouteModuleDependencyHashes(hasher, buildResult, entrypointPath, rootDir) {
|
|
114
|
+
return hasher.createDependencyHashes(resolveRouteModuleDependencyPaths(buildResult, entrypointPath, rootDir));
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
RouteModuleDependencyHasher,
|
|
118
|
+
createRouteModuleDependencyHashes,
|
|
119
|
+
filterTrackableRouteModuleDependencies,
|
|
120
|
+
isTrackableRouteModuleDependency,
|
|
121
|
+
resolveRouteModuleDependencyPaths
|
|
122
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BuildExecutor } from '../../build/build-adapter.js';
|
|
2
|
-
import type { EcoBuildPlugin } from '../../build/build-types.js';
|
|
2
|
+
import type { EcoBuildPlugin } from '../../build/contracts/build-types.js';
|
|
3
3
|
import type { AppModuleLoader } from './app-module-loader.service.js';
|
|
4
4
|
import { type PageModuleBuildImportOptions } from './page-module-import.service.js';
|
|
5
5
|
import type { SourceModuleLoaderFactory } from './module-loading-types.js';
|
|
@@ -11,7 +11,7 @@ class ServerModuleTranspiler {
|
|
|
11
11
|
* context.
|
|
12
12
|
*/
|
|
13
13
|
constructor(args) {
|
|
14
|
-
this.pageModuleImportService = args.pageModuleImportService ?? new PageModuleImportService({
|
|
14
|
+
this.pageModuleImportService = args.pageModuleImportService ?? new PageModuleImportService(void 0, {
|
|
15
15
|
canLoadSourceModuleFromHost: args.canLoadSourceModuleFromHost,
|
|
16
16
|
getHostModuleLoader: args.getHostModuleLoader
|
|
17
17
|
});
|
|
@@ -113,10 +113,7 @@ export declare class SchemaValidationService {
|
|
|
113
113
|
validateRequest(source: ValidationSource, schemas: ValidationSchemas): Promise<ValidationResult<ValidatedData>>;
|
|
114
114
|
/**
|
|
115
115
|
* Validates a single value against a Standard Schema.
|
|
116
|
-
*
|
|
117
|
-
* @param schema - The Standard Schema validator
|
|
118
|
-
* @param data - The data to validate
|
|
119
|
-
* @returns Validation result with validated data or errors
|
|
120
116
|
*/
|
|
117
|
+
private mapSchemaIssue;
|
|
121
118
|
private validateWithSchema;
|
|
122
119
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SchemaError, validateStandardSchema } from "./validate-standard-schema.js";
|
|
1
2
|
class SchemaValidationService {
|
|
2
3
|
/**
|
|
3
4
|
* Validates request data against provided schemas.
|
|
@@ -65,26 +66,24 @@ class SchemaValidationService {
|
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Validates a single value against a Standard Schema.
|
|
68
|
-
*
|
|
69
|
-
* @param schema - The Standard Schema validator
|
|
70
|
-
* @param data - The data to validate
|
|
71
|
-
* @returns Validation result with validated data or errors
|
|
72
69
|
*/
|
|
70
|
+
mapSchemaIssue(issue) {
|
|
71
|
+
return {
|
|
72
|
+
message: issue.message,
|
|
73
|
+
path: issue.path?.map((p) => typeof p === "object" && "key" in p ? p.key : p)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
73
76
|
async validateWithSchema(schema, data) {
|
|
74
77
|
try {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
const value = await validateStandardSchema(schema, data);
|
|
79
|
+
return { success: true, data: value };
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (error instanceof SchemaError) {
|
|
78
82
|
return {
|
|
79
83
|
success: false,
|
|
80
|
-
errors:
|
|
81
|
-
message: issue.message,
|
|
82
|
-
path: issue.path?.map((p) => typeof p === "object" && "key" in p ? p.key : p)
|
|
83
|
-
}))
|
|
84
|
+
errors: error.issues.map((issue) => this.mapSchemaIssue(issue))
|
|
84
85
|
};
|
|
85
86
|
}
|
|
86
|
-
return { success: true, data: result.value };
|
|
87
|
-
} catch (error) {
|
|
88
87
|
return {
|
|
89
88
|
success: false,
|
|
90
89
|
errors: [
|
|
@@ -1,65 +1,12 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
/**
|
|
2
|
-
* Standard Schema
|
|
3
|
-
* Compatible with Zod, Valibot, ArkType, Effect Schema, and other validation libraries.
|
|
4
|
-
*
|
|
3
|
+
* Ecopages aliases for the official Standard Schema V1 types.
|
|
5
4
|
* @see https://standardschema.dev
|
|
6
|
-
*
|
|
7
|
-
* @example Using with Zod
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { z } from 'zod';
|
|
10
|
-
*
|
|
11
|
-
* const bodySchema = z.object({
|
|
12
|
-
* title: z.string().min(1),
|
|
13
|
-
* content: z.string()
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* app.post('/posts', async (ctx) => {
|
|
17
|
-
* const { title, content } = ctx.body;
|
|
18
|
-
* return ctx.json({ id: 1, title, content });
|
|
19
|
-
* }, {
|
|
20
|
-
* schema: { body: bodySchema }
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
5
|
*/
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
readonly output: Output;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Result of Standard Schema validation.
|
|
37
|
-
*/
|
|
38
|
-
export type StandardSchemaResult<Output> = StandardSchemaSuccessResult<Output> | StandardSchemaFailureResult;
|
|
39
|
-
/**
|
|
40
|
-
* Successful validation result.
|
|
41
|
-
*/
|
|
42
|
-
export interface StandardSchemaSuccessResult<Output> {
|
|
43
|
-
readonly value: Output;
|
|
44
|
-
readonly issues?: undefined;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Failed validation result.
|
|
48
|
-
*/
|
|
49
|
-
export interface StandardSchemaFailureResult {
|
|
50
|
-
readonly value?: undefined;
|
|
51
|
-
readonly issues: ReadonlyArray<StandardSchemaIssue>;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Validation issue details.
|
|
55
|
-
*/
|
|
56
|
-
export interface StandardSchemaIssue {
|
|
57
|
-
readonly message: string;
|
|
58
|
-
readonly path?: ReadonlyArray<PropertyKey | {
|
|
59
|
-
key: PropertyKey;
|
|
60
|
-
}>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Infers the output type from a Standard Schema.
|
|
64
|
-
*/
|
|
65
|
-
export type InferOutput<T extends StandardSchema> = T extends StandardSchema<any, infer O> ? O : never;
|
|
6
|
+
export type StandardSchema<Input = unknown, Output = Input> = StandardSchemaV1<Input, Output>;
|
|
7
|
+
export type StandardSchemaResult<Output> = StandardSchemaV1.Result<Output>;
|
|
8
|
+
export type StandardSchemaSuccessResult<Output> = StandardSchemaV1.SuccessResult<Output>;
|
|
9
|
+
export type StandardSchemaFailureResult = StandardSchemaV1.FailureResult;
|
|
10
|
+
export type StandardSchemaIssue = StandardSchemaV1.Issue;
|
|
11
|
+
export type InferOutput<T extends StandardSchemaV1> = StandardSchemaV1.InferOutput<T>;
|
|
12
|
+
export type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export { SchemaError } from '@standard-schema/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Validates a value with any Standard Schema-compliant validator.
|
|
5
|
+
* Throws {@link SchemaError} when validation fails.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateStandardSchema<T>(schema: StandardSchemaV1<unknown, T>, value: unknown): Promise<T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SchemaError } from "@standard-schema/utils";
|
|
2
|
+
import { SchemaError as SchemaError2 } from "@standard-schema/utils";
|
|
3
|
+
async function validateStandardSchema(schema, value) {
|
|
4
|
+
const resultOrPromise = schema["~standard"].validate(value);
|
|
5
|
+
const result = resultOrPromise instanceof Promise ? await resultOrPromise : resultOrPromise;
|
|
6
|
+
if (result.issues) {
|
|
7
|
+
throw new SchemaError(result.issues);
|
|
8
|
+
}
|
|
9
|
+
return result.value;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
SchemaError2 as SchemaError,
|
|
13
|
+
validateStandardSchema
|
|
14
|
+
};
|
|
@@ -24,3 +24,44 @@ That means it should reuse:
|
|
|
24
24
|
- asset processing
|
|
25
25
|
|
|
26
26
|
It should not invent a parallel rendering stack just for build mode.
|
|
27
|
+
|
|
28
|
+
## Files
|
|
29
|
+
|
|
30
|
+
| File | Role |
|
|
31
|
+
| ------------------------------ | ---------------------------------------------------------------------------- |
|
|
32
|
+
| `static-site-generator.ts` | Route enumeration, HTML artifact writes, integration export hooks, sitemap |
|
|
33
|
+
| `static-export-context.ts` | Hook context type for `beforeStaticExport` / `afterStaticExport` |
|
|
34
|
+
| `sitemap.ts` | Pure sitemap.xml renderer |
|
|
35
|
+
| `sitemap-routes.ts` | Sitemap location assembly (`exclude`, `extraUrls`, dedupe) |
|
|
36
|
+
| `static-build-invalidation.ts` | `dist/` reset policy, production cache clearing, static-render cache context |
|
|
37
|
+
|
|
38
|
+
Build-input fingerprinting (`hashAppConfigFile`, `createBuildInputsFingerprint`) lives in `packages/core/src/build/cache/build-input-fingerprint.ts` and is shared with server-entry and unified-graph caches.
|
|
39
|
+
|
|
40
|
+
## Incremental static export
|
|
41
|
+
|
|
42
|
+
`ServerStaticBuilder.prepareExportDirectory()` decides whether to wipe `dist/`:
|
|
43
|
+
|
|
44
|
+
1. `force: true` → always reset
|
|
45
|
+
2. Any processor/integration reports `didChange()` → reset
|
|
46
|
+
3. Route-module manifest lacks matching `configHash` + `buildInputsFingerprint` → reset
|
|
47
|
+
|
|
48
|
+
When `dist/` is preserved (`preserveExportDirectory: true`), `StaticSiteGenerator.run()` prunes HTML files no longer in the active route set.
|
|
49
|
+
|
|
50
|
+
Rendered HTML reuse is tracked in `.eco/.server-modules/.build-cache.json` under each route module's `renderedOutputs`. `canReuseStaticRender()` skips re-rendering when the source file, dependency hashes, and output path are unchanged.
|
|
51
|
+
|
|
52
|
+
`clearProductionBuildCaches()` runs on `force` builds and removes all persisted `.eco` build manifests (route modules, server entry, unified pages graph).
|
|
53
|
+
|
|
54
|
+
## Integration hooks
|
|
55
|
+
|
|
56
|
+
Integrations may implement:
|
|
57
|
+
|
|
58
|
+
- `beforeStaticExport(context)` — runs after unified-graph prebuild, before page rendering
|
|
59
|
+
- `afterStaticExport(context)` — runs in a `finally` block after generation completes
|
|
60
|
+
|
|
61
|
+
When `appConfig.sitemap.enabled` is true, `sitemap.xml` is written **after** `afterStaticExport` so integration-generated URLs can be listed via `extraUrls`.
|
|
62
|
+
|
|
63
|
+
Sitemap eligibility is decided during successful page export (`activeStaticPathnames` plus `robots.index !== false`, fail-closed on metadata errors). `resolveSitemapLocations` then applies `exclude` and appends `extraUrls`.
|
|
64
|
+
|
|
65
|
+
`StaticExportContext.routes` is the unfiltered static-generation route list. Sitemap filtering is applied separately.
|
|
66
|
+
|
|
67
|
+
See `StaticExportContext` in `static-export-context.ts`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
import type { PageRendererResolver } from '../route-renderer/route-renderer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether production static export should warm Page Browser Graphs before rendering.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* True only when `NODE_ENV === 'production'`. Independent of `force` and of
|
|
8
|
+
* unified pages-graph env flags. Does not persist a disk manifest.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shouldPrebuildProductionPageBrowserGraphs(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Clears in-memory production Page Browser Graph session records.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Clears only the `'production'` policy so a failed or force export cannot
|
|
16
|
+
* reuse staged graph output. Development session records are left intact.
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearProductionPageBrowserGraphSession(appConfig: EcoPagesAppConfig): void;
|
|
19
|
+
/**
|
|
20
|
+
* Warms production Page Browser Graphs for the supplied static route files.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Deduplicates and lexicographically sorts absolute route paths, then calls
|
|
24
|
+
* each integration renderer's `prebuildProductionPageBrowserGraph` sequentially
|
|
25
|
+
* (activates integration runtime, then resolves into
|
|
26
|
+
* `page-browser-graph-session`). Does not persist a disk manifest.
|
|
27
|
+
*/
|
|
28
|
+
export declare function prebuildProductionPageBrowserGraphs(routeFiles: readonly string[], routeRendererFactory: PageRendererResolver): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { getAppPageBrowserGraphSession } from "../route-renderer/orchestration/page-browser-graph/page-browser-graph-session.js";
|
|
3
|
+
function shouldPrebuildProductionPageBrowserGraphs() {
|
|
4
|
+
return process.env.NODE_ENV === "production";
|
|
5
|
+
}
|
|
6
|
+
function clearProductionPageBrowserGraphSession(appConfig) {
|
|
7
|
+
getAppPageBrowserGraphSession(appConfig).clearPolicyRecords("production");
|
|
8
|
+
}
|
|
9
|
+
async function prebuildProductionPageBrowserGraphs(routeFiles, routeRendererFactory) {
|
|
10
|
+
const uniqueRouteFiles = [...new Set(routeFiles.map((routeFile) => path.resolve(routeFile)))].sort(
|
|
11
|
+
(left, right) => left.localeCompare(right)
|
|
12
|
+
);
|
|
13
|
+
for (const routeFile of uniqueRouteFiles) {
|
|
14
|
+
const renderer = routeRendererFactory.getPageRenderer(routeFile);
|
|
15
|
+
await renderer.prebuildProductionPageBrowserGraph(routeFile);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
clearProductionPageBrowserGraphSession,
|
|
20
|
+
prebuildProductionPageBrowserGraphs,
|
|
21
|
+
shouldPrebuildProductionPageBrowserGraphs
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SitemapConfig } from '../types/public-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the ordered absolute locations for sitemap.xml.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* `eligiblePathnames` must already be successfully exported and robots-indexable.
|
|
7
|
+
* Filtering here is only `sitemap.exclude`, then `extraUrls` are appended.
|
|
8
|
+
* `extraUrls` always include (deduped) and are not subject to `exclude` or page robots.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveSitemapLocations(input: {
|
|
11
|
+
eligiblePathnames: readonly string[];
|
|
12
|
+
sitemap: SitemapConfig;
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
}): string[];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { matchesAnyPathPattern, normalizePathname } from "../utils/path-pattern.js";
|
|
2
|
+
import { buildSitemapLocation } from "./sitemap.js";
|
|
3
|
+
function resolveSitemapLocations(input) {
|
|
4
|
+
const exclude = input.sitemap.exclude ?? [];
|
|
5
|
+
const locations = [];
|
|
6
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7
|
+
for (const pathname of input.eligiblePathnames) {
|
|
8
|
+
const normalized = normalizePathname(pathname);
|
|
9
|
+
if (matchesAnyPathPattern(normalized, exclude)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
const location = buildSitemapLocation(input.baseUrl, normalized);
|
|
13
|
+
if (seen.has(location)) {
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
seen.add(location);
|
|
17
|
+
locations.push(location);
|
|
18
|
+
}
|
|
19
|
+
for (const extraUrl of input.sitemap.extraUrls ?? []) {
|
|
20
|
+
const location = buildSitemapLocation(input.baseUrl, extraUrl);
|
|
21
|
+
if (seen.has(location)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
seen.add(location);
|
|
25
|
+
locations.push(location);
|
|
26
|
+
}
|
|
27
|
+
return locations;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
resolveSitemapLocations
|
|
31
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joins a base origin with a pathname or absolute URL into a sitemap `<loc>` value.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Trailing slashes are stripped except for the site root (`/`). Absolute `http(s)`
|
|
6
|
+
* URLs in `extraUrls` are returned as-is (still slash-normalized).
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildSitemapLocation(baseUrl: string, pathnameOrUrl: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Renders a sitemap.org 0.9 urlset document from absolute location URLs.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Callers are responsible for deduplication; this serializer preserves input order.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderSitemap(locations: readonly string[]): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { escapeXmlText } from "../utils/html-escaping.js";
|
|
2
|
+
import { normalizePathname } from "../utils/path-pattern.js";
|
|
3
|
+
function buildSitemapLocation(baseUrl, pathnameOrUrl) {
|
|
4
|
+
const trimmed = pathnameOrUrl.trim();
|
|
5
|
+
if (/^https?:\/\//i.test(trimmed)) {
|
|
6
|
+
return normalizeLocation(trimmed);
|
|
7
|
+
}
|
|
8
|
+
const origin = baseUrl.replace(/\/+$/, "");
|
|
9
|
+
const pathname = normalizePathname(trimmed);
|
|
10
|
+
return pathname === "/" ? `${origin}/` : `${origin}${pathname}`;
|
|
11
|
+
}
|
|
12
|
+
function renderSitemap(locations) {
|
|
13
|
+
const urls = locations.map((loc) => ` <url>
|
|
14
|
+
<loc>${escapeXmlText(normalizeLocation(loc))}</loc>
|
|
15
|
+
</url>`).join("\n");
|
|
16
|
+
return [
|
|
17
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
18
|
+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',
|
|
19
|
+
urls,
|
|
20
|
+
"</urlset>",
|
|
21
|
+
""
|
|
22
|
+
].join("\n");
|
|
23
|
+
}
|
|
24
|
+
function normalizeLocation(location) {
|
|
25
|
+
if (/^https?:\/\/[^/]+\/?$/i.test(location)) {
|
|
26
|
+
return `${location.replace(/\/+$/, "")}/`;
|
|
27
|
+
}
|
|
28
|
+
return location.replace(/\/+$/, "");
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
buildSitemapLocation,
|
|
32
|
+
renderSitemap
|
|
33
|
+
};
|