@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
package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { appLogger } from "../../../../../global/app-logger.js";
|
|
2
|
-
import { getAppBrowserBuildPlugins } from "../../../../../build/build-adapter.js";
|
|
3
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { BaseProcessor } from "./base-processor.js";
|
|
@@ -22,14 +21,6 @@ class BaseScriptProcessor extends BaseProcessor {
|
|
|
22
21
|
}
|
|
23
22
|
return dep.bundleOptions || {};
|
|
24
23
|
}
|
|
25
|
-
collectBuildPlugins(excludePluginNames) {
|
|
26
|
-
const buildPlugins = getAppBrowserBuildPlugins(this.appConfig);
|
|
27
|
-
if (!excludePluginNames || excludePluginNames.length === 0) {
|
|
28
|
-
return buildPlugins;
|
|
29
|
-
}
|
|
30
|
-
const excluded = new Set(excludePluginNames);
|
|
31
|
-
return buildPlugins.filter((plugin) => !excluded.has(plugin.name));
|
|
32
|
-
}
|
|
33
24
|
async bundleScript({
|
|
34
25
|
entrypoint,
|
|
35
26
|
outdir,
|
|
@@ -37,8 +28,6 @@ class BaseScriptProcessor extends BaseProcessor {
|
|
|
37
28
|
plugins: additionalPlugins,
|
|
38
29
|
...rest
|
|
39
30
|
}) {
|
|
40
|
-
const buildPlugins = this.collectBuildPlugins(excludeAppBuildPlugins);
|
|
41
|
-
const allPlugins = additionalPlugins ? [...additionalPlugins, ...buildPlugins] : buildPlugins;
|
|
42
31
|
const buildResult = await this.browserBundleService.bundle({
|
|
43
32
|
profile: "browser-script",
|
|
44
33
|
entrypoints: [entrypoint],
|
|
@@ -47,7 +36,7 @@ class BaseScriptProcessor extends BaseProcessor {
|
|
|
47
36
|
excludeAppBuildPlugins,
|
|
48
37
|
splitting: true,
|
|
49
38
|
naming: "[name]-[hash].[ext]",
|
|
50
|
-
plugins:
|
|
39
|
+
plugins: additionalPlugins,
|
|
51
40
|
...rest
|
|
52
41
|
});
|
|
53
42
|
if (!buildResult.success) {
|
|
@@ -86,8 +75,6 @@ class BaseScriptProcessor extends BaseProcessor {
|
|
|
86
75
|
plugins: additionalPlugins,
|
|
87
76
|
...rest
|
|
88
77
|
}) {
|
|
89
|
-
const buildPlugins = this.collectBuildPlugins(excludeAppBuildPlugins);
|
|
90
|
-
const allPlugins = additionalPlugins ? [...additionalPlugins, ...buildPlugins] : buildPlugins;
|
|
91
78
|
const buildResult = await this.browserBundleService.bundleGroupedEntries(entries, {
|
|
92
79
|
profile: "browser-script",
|
|
93
80
|
outdir,
|
|
@@ -96,7 +83,7 @@ class BaseScriptProcessor extends BaseProcessor {
|
|
|
96
83
|
...rest,
|
|
97
84
|
splitting: true,
|
|
98
85
|
naming: "[name]-[hash].[ext]",
|
|
99
|
-
plugins:
|
|
86
|
+
plugins: additionalPlugins
|
|
100
87
|
});
|
|
101
88
|
if (!buildResult.success) {
|
|
102
89
|
for (const log of buildResult.logs) {
|
package/src/services/assets/asset-processing-service/processors/script/content-script.processor.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { ContentScriptAsset, ProcessedAsset } from '../../assets.types.js';
|
|
2
2
|
import { BaseScriptProcessor } from '../base/base-script-processor.js';
|
|
3
3
|
export declare class ContentScriptProcessor extends BaseScriptProcessor<ContentScriptAsset> {
|
|
4
|
+
private getContentScriptEntryDir;
|
|
5
|
+
private getContentScriptEntryPath;
|
|
6
|
+
private toProcessedAsset;
|
|
7
|
+
private removeContentScriptEntry;
|
|
4
8
|
processGrouped(deps: ContentScriptAsset[]): Promise<ProcessedAsset[]>;
|
|
9
|
+
private getGroupedBundlerOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Emits one content script asset. Cache reuse is owned by {@link AssetProcessingService}.
|
|
12
|
+
*/
|
|
5
13
|
process(dep: ContentScriptAsset): Promise<ProcessedAsset>;
|
|
6
14
|
}
|
package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js
CHANGED
|
@@ -1,7 +1,37 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
|
+
import { resolveInlineContentScriptBody } from "../../inline-content-script-body.js";
|
|
4
|
+
import { shouldUseDevBrowserScriptCache } from "../../../../../build/cache/dev-browser-script-cache.js";
|
|
3
5
|
import { BaseScriptProcessor } from "../base/base-script-processor.js";
|
|
4
6
|
class ContentScriptProcessor extends BaseScriptProcessor {
|
|
7
|
+
getContentScriptEntryDir() {
|
|
8
|
+
const dir = path.join(this.appConfig.absolutePaths.workDir, "content-script-entries");
|
|
9
|
+
fileSystem.ensureDir(dir);
|
|
10
|
+
return dir;
|
|
11
|
+
}
|
|
12
|
+
getContentScriptEntryPath(contentHash) {
|
|
13
|
+
return path.join(this.getContentScriptEntryDir(), `${contentHash}.js`);
|
|
14
|
+
}
|
|
15
|
+
toProcessedAsset(dep, filepath) {
|
|
16
|
+
return {
|
|
17
|
+
filepath,
|
|
18
|
+
content: resolveInlineContentScriptBody(dep, filepath),
|
|
19
|
+
kind: "script",
|
|
20
|
+
position: dep.position,
|
|
21
|
+
attributes: dep.attributes,
|
|
22
|
+
inline: dep.inline,
|
|
23
|
+
excludeFromHtml: dep.excludeFromHtml,
|
|
24
|
+
packageRole: dep.packageRole,
|
|
25
|
+
groupedBundle: dep.groupedBundle,
|
|
26
|
+
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
removeContentScriptEntry(contentHash) {
|
|
30
|
+
if (shouldUseDevBrowserScriptCache()) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
fileSystem.remove(this.getContentScriptEntryPath(contentHash));
|
|
34
|
+
}
|
|
5
35
|
async processGrouped(deps) {
|
|
6
36
|
if (deps.length === 0) {
|
|
7
37
|
return [];
|
|
@@ -10,109 +40,84 @@ class ContentScriptProcessor extends BaseScriptProcessor {
|
|
|
10
40
|
if (!shouldBundle || deps.some((dep) => dep.inline)) {
|
|
11
41
|
return Promise.all(deps.map((dep) => this.process(dep)));
|
|
12
42
|
}
|
|
13
|
-
|
|
14
|
-
this.appConfig.absolutePaths.distDir,
|
|
15
|
-
`grouped-script-entries-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
|
16
|
-
);
|
|
17
|
-
fileSystem.ensureDir(tempDir);
|
|
43
|
+
let tempEntries = [];
|
|
18
44
|
try {
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const tempFilepath =
|
|
45
|
+
tempEntries = deps.map((dep) => {
|
|
46
|
+
const contentHash = this.generateHash(dep.content);
|
|
47
|
+
const tempFilepath = this.getContentScriptEntryPath(contentHash);
|
|
22
48
|
fileSystem.write(tempFilepath, dep.content);
|
|
23
49
|
return {
|
|
24
50
|
dep,
|
|
25
|
-
|
|
51
|
+
contentHash,
|
|
26
52
|
tempFilepath
|
|
27
53
|
};
|
|
28
54
|
});
|
|
29
|
-
const primaryDep = deps[0];
|
|
30
55
|
const outputPaths = await this.bundleScripts({
|
|
31
|
-
...this.
|
|
32
|
-
entries: tempEntries.map(({
|
|
33
|
-
entryName,
|
|
56
|
+
...this.getGroupedBundlerOptions(deps),
|
|
57
|
+
entries: tempEntries.map(({ dep, contentHash, tempFilepath }) => ({
|
|
58
|
+
entryName: dep.groupedBundle?.entryName ?? dep.name ?? contentHash,
|
|
34
59
|
entrypoint: tempFilepath
|
|
35
60
|
})),
|
|
36
61
|
outdir: this.getAssetsDir(),
|
|
37
62
|
minify: this.isProduction,
|
|
38
63
|
naming: "[name]-[hash].[ext]"
|
|
39
64
|
});
|
|
40
|
-
return tempEntries.map(({ dep,
|
|
65
|
+
return tempEntries.map(({ dep, contentHash }) => {
|
|
66
|
+
const entryName = dep.groupedBundle?.entryName ?? dep.name ?? contentHash;
|
|
41
67
|
const bundledFilePath = outputPaths.get(entryName);
|
|
42
68
|
if (!bundledFilePath) {
|
|
43
69
|
throw new Error(`Missing grouped bundle output for ${entryName}`);
|
|
44
70
|
}
|
|
45
|
-
return
|
|
46
|
-
filepath: bundledFilePath,
|
|
47
|
-
content: dep.inline ? fileSystem.readFileSync(bundledFilePath).toString() : void 0,
|
|
48
|
-
kind: "script",
|
|
49
|
-
position: dep.position,
|
|
50
|
-
attributes: dep.attributes,
|
|
51
|
-
inline: dep.inline,
|
|
52
|
-
excludeFromHtml: dep.excludeFromHtml,
|
|
53
|
-
packageRole: dep.packageRole,
|
|
54
|
-
groupedBundle: dep.groupedBundle,
|
|
55
|
-
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
56
|
-
};
|
|
71
|
+
return this.toProcessedAsset(dep, bundledFilePath);
|
|
57
72
|
});
|
|
58
73
|
} finally {
|
|
59
|
-
|
|
74
|
+
for (const { contentHash } of tempEntries) {
|
|
75
|
+
this.removeContentScriptEntry(contentHash);
|
|
76
|
+
}
|
|
60
77
|
}
|
|
61
78
|
}
|
|
79
|
+
getGroupedBundlerOptions(deps) {
|
|
80
|
+
const primaryDep = deps[0];
|
|
81
|
+
const options = this.getBundlerOptions(primaryDep);
|
|
82
|
+
if (deps.some((dep) => dep.bundleOptions?.splitting === false)) {
|
|
83
|
+
return {
|
|
84
|
+
...options,
|
|
85
|
+
splitting: false
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return options;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Emits one content script asset. Cache reuse is owned by {@link AssetProcessingService}.
|
|
92
|
+
*/
|
|
62
93
|
async process(dep) {
|
|
94
|
+
const shouldBundle = this.shouldBundle(dep);
|
|
63
95
|
const hash = this.generateHash(dep.content);
|
|
64
96
|
const filename = dep.name ? `${dep.name}.js` : `script-${hash}.js`;
|
|
65
|
-
const shouldBundle = this.shouldBundle(dep);
|
|
66
97
|
const filepath = path.join(this.getAssetsDir(), "scripts", filename);
|
|
67
98
|
if (!shouldBundle) {
|
|
68
|
-
if (!dep.inline)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
kind: "script",
|
|
73
|
-
position: dep.position,
|
|
74
|
-
attributes: dep.attributes,
|
|
75
|
-
inline: dep.inline,
|
|
76
|
-
excludeFromHtml: dep.excludeFromHtml,
|
|
77
|
-
packageRole: dep.packageRole,
|
|
78
|
-
groupedBundle: dep.groupedBundle,
|
|
79
|
-
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
80
|
-
};
|
|
81
|
-
this.writeCacheFile(filename, unbundledProcessedAsset);
|
|
82
|
-
return unbundledProcessedAsset;
|
|
99
|
+
if (!dep.inline) {
|
|
100
|
+
fileSystem.write(filepath, dep.content);
|
|
101
|
+
}
|
|
102
|
+
return this.toProcessedAsset(dep, filepath);
|
|
83
103
|
}
|
|
84
|
-
if (dep.content) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
);
|
|
91
|
-
fileSystem.write(tempFileName, dep.content);
|
|
104
|
+
if (!dep.content) {
|
|
105
|
+
throw new Error("No content found for script asset");
|
|
106
|
+
}
|
|
107
|
+
const entryPath = this.getContentScriptEntryPath(hash);
|
|
108
|
+
fileSystem.write(entryPath, dep.content);
|
|
109
|
+
try {
|
|
92
110
|
const bundledFilePath = await this.bundleScript({
|
|
93
|
-
entrypoint:
|
|
111
|
+
entrypoint: entryPath,
|
|
94
112
|
outdir: this.getAssetsDir(),
|
|
95
113
|
minify: this.isProduction,
|
|
96
114
|
naming: `${path.parse(filename).name}-[hash].[ext]`,
|
|
97
115
|
...this.getBundlerOptions(dep)
|
|
98
116
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
kind: "script",
|
|
103
|
-
position: dep.position,
|
|
104
|
-
attributes: dep.attributes,
|
|
105
|
-
inline: dep.inline,
|
|
106
|
-
excludeFromHtml: dep.excludeFromHtml,
|
|
107
|
-
packageRole: dep.packageRole,
|
|
108
|
-
groupedBundle: dep.groupedBundle,
|
|
109
|
-
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
110
|
-
};
|
|
111
|
-
fileSystem.remove(tempFileName);
|
|
112
|
-
this.writeCacheFile(filename, processedAsset);
|
|
113
|
-
return processedAsset;
|
|
117
|
+
return this.toProcessedAsset(dep, bundledFilePath);
|
|
118
|
+
} finally {
|
|
119
|
+
this.removeContentScriptEntry(hash);
|
|
114
120
|
}
|
|
115
|
-
throw new Error("No content found for script asset");
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
export {
|
package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { FileScriptAsset, ProcessedAsset } from '../../assets.types.js';
|
|
|
3
3
|
import { BaseScriptProcessor } from '../base/base-script-processor.js';
|
|
4
4
|
export declare class FileScriptProcessor extends BaseScriptProcessor<FileScriptAsset> {
|
|
5
5
|
private hmrManager?;
|
|
6
|
-
private resolveHmrOutputFilepath;
|
|
7
6
|
setHmrManager(hmrManager: IHmrManager): void;
|
|
8
7
|
process(dep: FileScriptAsset): Promise<ProcessedAsset>;
|
|
9
8
|
}
|
package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js
CHANGED
|
@@ -4,28 +4,31 @@ import { fileSystem } from "@ecopages/file-system";
|
|
|
4
4
|
import { BaseScriptProcessor } from "../base/base-script-processor.js";
|
|
5
5
|
class FileScriptProcessor extends BaseScriptProcessor {
|
|
6
6
|
hmrManager;
|
|
7
|
-
resolveHmrOutputFilepath(entrypointPath) {
|
|
8
|
-
if (!this.hmrManager || !("getDistDir" in this.hmrManager)) {
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
const getDistDir = this.hmrManager.getDistDir;
|
|
12
|
-
if (typeof getDistDir !== "function") {
|
|
13
|
-
return void 0;
|
|
14
|
-
}
|
|
15
|
-
const relativePathJs = path.relative(this.appConfig.absolutePaths.srcDir, entrypointPath).replace(/\.(tsx?|jsx?|mdx?)$/, ".js").replace(/\[([^\]]+)\]/g, "_$1_");
|
|
16
|
-
return path.join(getDistDir.call(this.hmrManager), relativePathJs);
|
|
17
|
-
}
|
|
18
7
|
setHmrManager(hmrManager) {
|
|
19
8
|
this.hmrManager = hmrManager;
|
|
20
9
|
}
|
|
21
10
|
async process(dep) {
|
|
22
11
|
if (this.hmrManager?.isEnabled() && !dep.inline) {
|
|
23
|
-
const
|
|
24
|
-
|
|
12
|
+
const resolvedOutput = this.hmrManager.getResolvedScriptOutput?.(dep.filepath);
|
|
13
|
+
if (resolvedOutput) {
|
|
14
|
+
return {
|
|
15
|
+
filepath: resolvedOutput.outputPath,
|
|
16
|
+
sourceFilepath: dep.filepath,
|
|
17
|
+
srcUrl: resolvedOutput.outputUrl,
|
|
18
|
+
kind: "script",
|
|
19
|
+
position: dep.position,
|
|
20
|
+
attributes: dep.attributes,
|
|
21
|
+
inline: false,
|
|
22
|
+
excludeFromHtml: dep.excludeFromHtml,
|
|
23
|
+
packageRole: dep.packageRole,
|
|
24
|
+
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const registered = await this.hmrManager.registerScriptEntrypoint(dep.filepath);
|
|
25
28
|
return {
|
|
26
|
-
filepath:
|
|
29
|
+
filepath: registered.outputPath,
|
|
27
30
|
sourceFilepath: dep.filepath,
|
|
28
|
-
srcUrl: outputUrl,
|
|
31
|
+
srcUrl: registered.outputUrl,
|
|
29
32
|
kind: "script",
|
|
30
33
|
position: dep.position,
|
|
31
34
|
attributes: dep.attributes,
|
|
@@ -8,19 +8,33 @@ class NodeModuleScriptProcessor extends BaseScriptProcessor {
|
|
|
8
8
|
const modulePath = this.resolveModulePath(dep.importPath, this.appConfig.rootDir);
|
|
9
9
|
const moduleName = path.basename(modulePath);
|
|
10
10
|
const filename = dep.name ?? `nm-${moduleName}`;
|
|
11
|
+
const shouldBundle = this.shouldBundle(dep);
|
|
11
12
|
const configHash = this.generateHash(
|
|
12
|
-
JSON.stringify({
|
|
13
|
+
JSON.stringify({
|
|
14
|
+
bundle: shouldBundle,
|
|
15
|
+
inline: dep.inline,
|
|
16
|
+
minify: shouldBundle && !dep.inline && this.isProduction,
|
|
17
|
+
opts: dep.bundleOptions
|
|
18
|
+
})
|
|
13
19
|
);
|
|
14
20
|
const cachekey = `${this.buildCacheKey(filename, this.generateHash(modulePath), dep)}:${configHash}`;
|
|
15
21
|
return this.getOrProcess(cachekey, async () => {
|
|
16
|
-
if (dep.inline) {
|
|
22
|
+
if (dep.inline || !shouldBundle) {
|
|
17
23
|
const content = fileSystem.readFileAsBuffer(modulePath).toString();
|
|
24
|
+
const filepath = dep.inline ? void 0 : path.join(this.getAssetsDir(), "vendors", filename);
|
|
25
|
+
if (filepath) {
|
|
26
|
+
fileSystem.ensureDir(path.dirname(filepath));
|
|
27
|
+
if (!fileSystem.exists(filepath) || fileSystem.readFileAsBuffer(filepath).toString() !== content) {
|
|
28
|
+
fileSystem.copyFile(modulePath, filepath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
18
31
|
return {
|
|
32
|
+
filepath,
|
|
19
33
|
content,
|
|
20
34
|
kind: dep.kind,
|
|
21
35
|
position: dep.position,
|
|
22
36
|
attributes: dep.attributes,
|
|
23
|
-
inline:
|
|
37
|
+
inline: dep.inline,
|
|
24
38
|
excludeFromHtml: dep.excludeFromHtml,
|
|
25
39
|
packageRole: dep.packageRole,
|
|
26
40
|
bundledSourceFilepaths: dep.bundledSourceFilepaths
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ContentStylesheetAsset, ProcessedAsset } from '../../assets.types.js';
|
|
2
2
|
import { BaseProcessor } from '../base/base-processor.js';
|
|
3
3
|
export declare class ContentStylesheetProcessor extends BaseProcessor<ContentStylesheetAsset> {
|
|
4
|
-
private static readonly PROCESSABLE_STYLESHEET_EXTENSIONS;
|
|
5
|
-
private isProcessableStylesheet;
|
|
6
|
-
private applyStylesheetProcessors;
|
|
7
4
|
process(dep: ContentStylesheetAsset): Promise<ProcessedAsset>;
|
|
8
5
|
}
|
|
@@ -1,40 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
3
|
import { BaseProcessor } from "../base/base-processor.js";
|
|
4
|
+
import { applyStylesheetProcessors } from "./stylesheet-processor-pipeline.js";
|
|
4
5
|
class ContentStylesheetProcessor extends BaseProcessor {
|
|
5
|
-
static PROCESSABLE_STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".scss", ".sass", ".less"]);
|
|
6
|
-
isProcessableStylesheet(filepath) {
|
|
7
|
-
return ContentStylesheetProcessor.PROCESSABLE_STYLESHEET_EXTENSIONS.has(path.extname(filepath));
|
|
8
|
-
}
|
|
9
|
-
async applyStylesheetProcessors(content, filepath) {
|
|
10
|
-
if (!this.isProcessableStylesheet(filepath)) {
|
|
11
|
-
return content;
|
|
12
|
-
}
|
|
13
|
-
let transformedContent = content;
|
|
14
|
-
const processors = this.appConfig.processors ? Array.from(this.appConfig.processors.values()) : [];
|
|
15
|
-
for (const processor of processors) {
|
|
16
|
-
const hasCapabilities = processor.getAssetCapabilities().length > 0;
|
|
17
|
-
const canProcessStylesheet = processor.canProcessAsset("stylesheet", filepath);
|
|
18
|
-
if (!canProcessStylesheet && (hasCapabilities || !processor.getName().includes("postcss"))) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
if (!processor.matchesFileFilter(filepath)) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const result = await processor.process(transformedContent, filepath);
|
|
25
|
-
if (typeof result === "string") {
|
|
26
|
-
transformedContent = result;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (result instanceof Buffer) {
|
|
30
|
-
transformedContent = result.toString();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return transformedContent;
|
|
34
|
-
}
|
|
35
6
|
async process(dep) {
|
|
36
7
|
const virtualFilepath = path.join(this.appConfig.absolutePaths.distDir, "styles", "page-bundle.css");
|
|
37
|
-
const processedContent = await this.
|
|
8
|
+
const processedContent = await applyStylesheetProcessors(this.appConfig, dep.content, virtualFilepath);
|
|
38
9
|
const hash = this.generateHash(processedContent);
|
|
39
10
|
const filename = `style-${hash}.css`;
|
|
40
11
|
const cachekey = this.buildCacheKey(filename, hash, dep);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { FileStylesheetAsset, ProcessedAsset } from '../../assets.types.js';
|
|
2
2
|
import { BaseProcessor } from '../base/base-processor.js';
|
|
3
3
|
export declare class FileStylesheetProcessor extends BaseProcessor<FileStylesheetAsset> {
|
|
4
|
-
private static readonly PROCESSABLE_STYLESHEET_EXTENSIONS;
|
|
5
4
|
getStyleContent: (srcUrl: string) => Buffer;
|
|
6
|
-
private isProcessableStylesheet;
|
|
7
|
-
private applyStylesheetProcessors;
|
|
8
5
|
process(dep: FileStylesheetAsset): Promise<ProcessedAsset>;
|
|
9
6
|
}
|
|
@@ -1,43 +1,15 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileSystem } from "@ecopages/file-system";
|
|
3
3
|
import { BaseProcessor } from "../base/base-processor.js";
|
|
4
|
+
import { applyStylesheetProcessors } from "./stylesheet-processor-pipeline.js";
|
|
4
5
|
class FileStylesheetProcessor extends BaseProcessor {
|
|
5
|
-
static PROCESSABLE_STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".scss", ".sass", ".less"]);
|
|
6
6
|
getStyleContent = (srcUrl) => {
|
|
7
7
|
return fileSystem.readFileAsBuffer(srcUrl);
|
|
8
8
|
};
|
|
9
|
-
isProcessableStylesheet(filepath) {
|
|
10
|
-
return FileStylesheetProcessor.PROCESSABLE_STYLESHEET_EXTENSIONS.has(path.extname(filepath));
|
|
11
|
-
}
|
|
12
|
-
async applyStylesheetProcessors(content, filepath) {
|
|
13
|
-
if (!this.isProcessableStylesheet(filepath)) {
|
|
14
|
-
return content;
|
|
15
|
-
}
|
|
16
|
-
let transformedContent = content;
|
|
17
|
-
for (const processor of this.appConfig.processors.values()) {
|
|
18
|
-
const hasCapabilities = processor.getAssetCapabilities().length > 0;
|
|
19
|
-
const canProcessStylesheet = processor.canProcessAsset("stylesheet", filepath);
|
|
20
|
-
if (!canProcessStylesheet && (hasCapabilities || !processor.getName().includes("postcss"))) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (!processor.matchesFileFilter(filepath)) {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const result = await processor.process(transformedContent, filepath);
|
|
27
|
-
if (typeof result === "string") {
|
|
28
|
-
transformedContent = result;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (result instanceof Buffer) {
|
|
32
|
-
transformedContent = result.toString();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return transformedContent;
|
|
36
|
-
}
|
|
37
9
|
async process(dep) {
|
|
38
10
|
const buffer = this.getStyleContent(dep.filepath);
|
|
39
11
|
const rawContent = buffer.toString();
|
|
40
|
-
const processedContent = await this.
|
|
12
|
+
const processedContent = await applyStylesheetProcessors(this.appConfig, rawContent, dep.filepath);
|
|
41
13
|
const hash = this.generateHash(processedContent);
|
|
42
14
|
const cachekey = this.buildCacheKey(dep.filepath, hash, dep);
|
|
43
15
|
return this.getOrProcess(cachekey, () => {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
const PROCESSABLE_STYLESHEET_EXTENSIONS = /* @__PURE__ */ new Set([".css", ".scss", ".sass", ".less"]);
|
|
3
|
+
function isProcessableStylesheet(filepath) {
|
|
4
|
+
return PROCESSABLE_STYLESHEET_EXTENSIONS.has(path.extname(filepath));
|
|
5
|
+
}
|
|
6
|
+
function shouldRunStylesheetProcessor(processor, filepath) {
|
|
7
|
+
const hasCapabilities = processor.getAssetCapabilities().length > 0;
|
|
8
|
+
const canProcessStylesheet = processor.canProcessAsset("stylesheet", filepath);
|
|
9
|
+
if (canProcessStylesheet) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
if (hasCapabilities) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return processor.getName().includes("postcss");
|
|
16
|
+
}
|
|
17
|
+
async function applyStylesheetProcessors(appConfig, content, filepath) {
|
|
18
|
+
if (!isProcessableStylesheet(filepath)) {
|
|
19
|
+
return content;
|
|
20
|
+
}
|
|
21
|
+
let transformedContent = content;
|
|
22
|
+
const processors = appConfig.processors ? Array.from(appConfig.processors.values()) : [];
|
|
23
|
+
for (const processor of processors) {
|
|
24
|
+
if (!shouldRunStylesheetProcessor(processor, filepath)) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!processor.matchesFileFilter(filepath)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const result = await processor.process(transformedContent, filepath);
|
|
31
|
+
if (typeof result === "string") {
|
|
32
|
+
transformedContent = result;
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (result instanceof Buffer) {
|
|
36
|
+
transformedContent = result.toString();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return transformedContent;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
applyStylesheetProcessors
|
|
43
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnyIntegrationPlugin } from '../../../plugins/integration-plugin.js';
|
|
2
|
+
import type { EcoPagesAppConfig } from '../../../types/internal-types.js';
|
|
3
|
+
/** Resolves the integration plugin that owns one asset-processing batch key. */
|
|
4
|
+
export declare function resolveIntegrationPluginForProcessingKey(appConfig: EcoPagesAppConfig, processingKey: string): AnyIntegrationPlugin | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function resolveIntegrationPluginForProcessingKey(appConfig, processingKey) {
|
|
2
|
+
if (!appConfig.integrations?.length) {
|
|
3
|
+
return void 0;
|
|
4
|
+
}
|
|
5
|
+
const exactMatch = appConfig.integrations.find((integration) => integration.name === processingKey);
|
|
6
|
+
if (exactMatch) {
|
|
7
|
+
return exactMatch;
|
|
8
|
+
}
|
|
9
|
+
const baseName = processingKey.split(":")[0];
|
|
10
|
+
if (!baseName || baseName === processingKey) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
return appConfig.integrations.find((integration) => integration.name === baseName);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
resolveIntegrationPluginForProcessingKey
|
|
17
|
+
};
|
|
@@ -2,7 +2,6 @@ import type { AssetProcessor } from './processor.interface.js';
|
|
|
2
2
|
import type { AssetDefinition, ProcessedAsset } from './assets.types.js';
|
|
3
3
|
type ProcessUngroupedDependencyOptions = {
|
|
4
4
|
dep: AssetDefinition;
|
|
5
|
-
key: string;
|
|
6
5
|
depKey: string;
|
|
7
6
|
getCachedAsset: (dep: AssetDefinition, depKey: string) => ProcessedAsset | null;
|
|
8
7
|
getProcessor: (dep: AssetDefinition) => AssetProcessor | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fileSystem } from "@ecopages/file-system";
|
|
2
|
+
import { finalizeProcessedAsset } from "./finalize-processed-asset.js";
|
|
2
3
|
async function processUngroupedDependency(options) {
|
|
3
4
|
const {
|
|
4
5
|
dep,
|
|
5
|
-
key,
|
|
6
6
|
depKey,
|
|
7
7
|
getCachedAsset,
|
|
8
8
|
getProcessor,
|
|
@@ -14,7 +14,7 @@ async function processUngroupedDependency(options) {
|
|
|
14
14
|
} = options;
|
|
15
15
|
const cached = getCachedAsset(dep, depKey);
|
|
16
16
|
if (cached) {
|
|
17
|
-
return
|
|
17
|
+
return finalizeProcessedAsset(cached, resolveProcessedAssetSrcUrl);
|
|
18
18
|
}
|
|
19
19
|
const processor = getProcessor(dep);
|
|
20
20
|
if (!processor) {
|
|
@@ -27,14 +27,9 @@ async function processUngroupedDependency(options) {
|
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
29
29
|
const processed = await processor.process(dep);
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
...processed,
|
|
34
|
-
srcUrl
|
|
35
|
-
};
|
|
36
|
-
setCachedAsset(dep, depKey, processedWithKey);
|
|
37
|
-
return processedWithKey;
|
|
30
|
+
const finalized = finalizeProcessedAsset(processed, resolveProcessedAssetSrcUrl);
|
|
31
|
+
setCachedAsset(dep, depKey, finalized);
|
|
32
|
+
return finalized;
|
|
38
33
|
} catch (error) {
|
|
39
34
|
logProcessingError(dep, error);
|
|
40
35
|
return null;
|