@ecopages/core 0.2.0-alpha.2 → 0.2.0-alpha.20
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/CHANGELOG.md +26 -64
- package/README.md +212 -14
- package/package.json +116 -66
- package/src/adapters/README.md +39 -0
- package/src/adapters/abstract/application-adapter.d.ts +28 -2
- package/src/adapters/abstract/application-adapter.js +14 -2
- package/src/adapters/abstract/router-adapter.d.ts +1 -1
- package/src/adapters/abstract/server-adapter.d.ts +2 -2
- package/src/adapters/bun/client-bridge.d.ts +1 -1
- package/src/adapters/bun/create-app.d.ts +4 -12
- package/src/adapters/bun/create-app.js +4 -5
- package/src/adapters/bun/hmr-manager.d.ts +80 -21
- package/src/adapters/bun/hmr-manager.js +168 -62
- package/src/adapters/bun/index.d.ts +2 -3
- package/src/adapters/bun/index.js +3 -3
- package/src/adapters/bun/server-adapter.d.ts +5 -5
- package/src/adapters/bun/server-adapter.js +40 -34
- package/src/adapters/bun/server-lifecycle.d.ts +28 -17
- package/src/adapters/bun/server-lifecycle.js +34 -62
- package/src/{create-app.d.ts → adapters/create-app.d.ts} +9 -6
- package/src/{create-app.js → adapters/create-app.js} +4 -4
- package/src/adapters/index.d.ts +2 -6
- package/src/adapters/index.js +2 -8
- package/src/adapters/node/create-app.d.ts +6 -9
- package/src/adapters/node/create-app.js +12 -6
- package/src/adapters/node/node-client-bridge.d.ts +1 -1
- package/src/adapters/node/node-hmr-manager.d.ts +89 -18
- package/src/adapters/node/node-hmr-manager.js +185 -95
- package/src/adapters/node/server-adapter.d.ts +6 -35
- package/src/adapters/node/server-adapter.js +44 -105
- package/src/adapters/node/static-content-server.d.ts +37 -1
- package/src/adapters/node/static-content-server.js +29 -1
- package/src/adapters/shared/application-adapter.d.ts +1 -1
- package/src/{define-api-handler.d.ts → adapters/shared/define-api-handler.d.ts} +1 -1
- package/src/adapters/shared/explicit-static-route-matcher.d.ts +2 -2
- package/src/adapters/shared/explicit-static-route-matcher.js +4 -1
- package/src/adapters/shared/file-route-middleware-pipeline.d.ts +1 -1
- package/src/adapters/shared/file-route-middleware-pipeline.js +1 -0
- package/src/adapters/shared/fs-server-response-factory.d.ts +2 -2
- package/src/adapters/shared/fs-server-response-factory.js +1 -1
- package/src/adapters/shared/fs-server-response-matcher.d.ts +8 -12
- package/src/adapters/shared/fs-server-response-matcher.js +10 -18
- package/src/adapters/shared/hmr-entrypoint-registrar.d.ts +55 -0
- package/src/adapters/shared/hmr-entrypoint-registrar.js +87 -0
- package/src/adapters/shared/hmr-html-response.d.ts +22 -0
- package/src/adapters/shared/hmr-html-response.js +32 -0
- package/src/adapters/shared/render-context.d.ts +2 -1
- package/src/adapters/shared/render-context.js +6 -3
- package/src/adapters/shared/runtime-bootstrap.d.ts +38 -0
- package/src/adapters/shared/runtime-bootstrap.js +43 -0
- package/src/adapters/shared/server-adapter.d.ts +13 -3
- package/src/adapters/shared/server-adapter.js +42 -5
- package/src/adapters/shared/server-route-handler.d.ts +4 -4
- package/src/adapters/shared/server-route-handler.js +6 -15
- package/src/adapters/shared/server-static-builder.d.ts +38 -6
- package/src/adapters/shared/server-static-builder.js +64 -10
- package/src/build/README.md +107 -0
- package/src/build/build-adapter.d.ts +168 -3
- package/src/build/build-adapter.js +604 -16
- package/src/build/build-manifest.d.ts +27 -0
- package/src/build/build-manifest.js +30 -0
- package/src/build/dev-build-coordinator.d.ts +72 -0
- package/src/build/dev-build-coordinator.js +154 -0
- package/src/build/esbuild-build-adapter.d.ts +15 -6
- package/src/build/esbuild-build-adapter.js +189 -74
- package/src/build/runtime-build-executor.d.ts +14 -0
- package/src/build/runtime-build-executor.js +22 -0
- package/src/build/runtime-specifier-alias-plugin.d.ts +15 -0
- package/src/build/runtime-specifier-alias-plugin.js +35 -0
- package/src/build/runtime-specifier-aliases.d.ts +5 -0
- package/src/build/runtime-specifier-aliases.js +95 -0
- package/src/config/README.md +36 -0
- package/src/config/config-builder.d.ts +52 -27
- package/src/config/config-builder.js +260 -49
- package/src/{constants.d.ts → config/constants.d.ts} +13 -0
- package/src/{constants.js → config/constants.js} +4 -0
- package/src/declarations.d.ts +19 -14
- package/src/dev/sc-server.d.ts +1 -1
- package/src/dev/sc-server.js +1 -1
- package/src/eco/README.md +70 -16
- package/src/eco/eco.browser.d.ts +2 -0
- package/src/eco/eco.browser.js +83 -0
- package/src/eco/eco.js +32 -57
- package/src/eco/eco.types.d.ts +12 -4
- package/src/eco/eco.utils.d.ts +1 -40
- package/src/eco/eco.utils.js +5 -35
- package/src/eco/global-injector-map.d.ts +1 -1
- package/src/eco/lazy-injector-map.d.ts +1 -1
- package/src/hmr/README.md +26 -0
- package/src/hmr/client/hmr-runtime.d.ts +1 -6
- package/src/hmr/client/hmr-runtime.js +30 -7
- package/src/hmr/hmr-strategy.d.ts +16 -13
- package/src/hmr/hmr-strategy.js +22 -7
- package/src/hmr/hmr.postcss.test.e2e.d.ts +1 -0
- package/src/hmr/hmr.postcss.test.e2e.js +31 -0
- package/src/hmr/hmr.test.e2e.js +26 -33
- package/src/hmr/strategies/default-hmr-strategy.d.ts +2 -2
- package/src/hmr/strategies/default-hmr-strategy.js +1 -1
- package/src/hmr/strategies/js-hmr-strategy.d.ts +46 -43
- package/src/hmr/strategies/js-hmr-strategy.js +72 -73
- package/src/index.browser.d.ts +2 -2
- package/src/index.browser.js +1 -1
- package/src/index.d.ts +4 -3
- package/src/index.js +16 -5
- package/src/integrations/ghtml/ghtml-renderer.d.ts +7 -2
- package/src/integrations/ghtml/ghtml-renderer.js +33 -30
- package/src/integrations/ghtml/ghtml.constants.d.ts +1 -0
- package/src/integrations/ghtml/ghtml.constants.js +4 -0
- package/src/integrations/ghtml/ghtml.plugin.d.ts +2 -6
- package/src/integrations/ghtml/ghtml.plugin.js +3 -4
- package/src/plugins/README.md +35 -0
- package/src/plugins/alias-resolver-plugin.js +17 -3
- package/src/plugins/eco-component-meta-plugin.d.ts +14 -1
- package/src/plugins/eco-component-meta-plugin.js +27 -21
- package/src/plugins/foreign-jsx-override-plugin.d.ts +31 -0
- package/src/plugins/foreign-jsx-override-plugin.js +35 -0
- package/src/plugins/integration-plugin.d.ts +145 -28
- package/src/plugins/integration-plugin.js +109 -13
- package/src/plugins/processor.d.ts +15 -2
- package/src/plugins/processor.js +16 -2
- package/src/plugins/runtime-capability.d.ts +9 -0
- package/src/plugins/source-transform.d.ts +46 -0
- package/src/plugins/source-transform.js +71 -0
- package/src/route-renderer/GRAPH.md +64 -98
- package/src/route-renderer/README.md +67 -46
- package/src/route-renderer/orchestration/boundary-planning.service.d.ts +25 -0
- package/src/route-renderer/orchestration/boundary-planning.service.js +97 -0
- package/src/route-renderer/orchestration/component-render-context.d.ts +83 -0
- package/src/route-renderer/orchestration/component-render-context.js +147 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +554 -0
- package/src/route-renderer/orchestration/integration-renderer.js +957 -0
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.d.ts +89 -0
- package/src/route-renderer/orchestration/queued-boundary-runtime.service.js +155 -0
- package/src/route-renderer/orchestration/render-execution.service.d.ts +43 -0
- package/src/route-renderer/orchestration/render-execution.service.js +106 -0
- package/src/{eco/eco.utils.ts → route-renderer/orchestration/render-output.utils.d.ts} +10 -53
- package/src/route-renderer/orchestration/render-output.utils.js +65 -0
- package/src/route-renderer/{render-preparation.service.d.ts → orchestration/render-preparation.service.d.ts} +18 -10
- package/src/route-renderer/{render-preparation.service.js → orchestration/render-preparation.service.js} +115 -17
- package/src/route-renderer/orchestration/route-shell-composer.service.d.ts +50 -0
- package/src/route-renderer/orchestration/route-shell-composer.service.js +81 -0
- package/src/route-renderer/orchestration/template-serialization.d.ts +38 -0
- package/src/route-renderer/orchestration/template-serialization.js +45 -0
- package/src/route-renderer/{dependency-resolver.d.ts → page-loading/dependency-resolver.d.ts} +15 -4
- package/src/route-renderer/{dependency-resolver.js → page-loading/dependency-resolver.js} +28 -12
- package/src/route-renderer/page-loading/page-module-loader.d.ts +90 -0
- package/src/route-renderer/{page-module-loader.js → page-loading/page-module-loader.js} +39 -14
- package/src/route-renderer/route-renderer.d.ts +45 -4
- package/src/route-renderer/route-renderer.js +38 -3
- package/src/router/README.md +97 -0
- package/src/router/client/link-intent.d.ts +53 -0
- package/src/router/client/link-intent.js +34 -0
- package/src/router/client/link-intent.test.browser.d.ts +1 -0
- package/src/router/client/link-intent.test.browser.js +43 -0
- package/src/router/client/navigation-coordinator.d.ts +149 -0
- package/src/router/client/navigation-coordinator.js +215 -0
- package/src/router/{fs-router-scanner.d.ts → server/fs-router-scanner.d.ts} +3 -3
- package/src/router/{fs-router-scanner.js → server/fs-router-scanner.js} +14 -8
- package/src/router/{fs-router.d.ts → server/fs-router.d.ts} +1 -1
- package/src/router/{fs-router.js → server/fs-router.js} +1 -1
- package/src/services/README.md +29 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +120 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset-processing.service.js +91 -10
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset.factory.d.ts +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/asset.factory.js +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/assets.types.d.ts +2 -1
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.d.ts +55 -0
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.js +48 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.d.ts +20 -0
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.js +41 -0
- package/src/services/assets/asset-processing-service/index.d.ts +5 -0
- package/src/services/assets/asset-processing-service/index.js +5 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.interface.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.registry.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-processor.d.ts +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-processor.js +9 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-script-processor.d.ts +5 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/base/base-script-processor.js +15 -23
- package/src/services/assets/asset-processing-service/processors/index.d.ts +5 -0
- package/src/services/assets/asset-processing-service/processors/index.js +5 -0
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/content-script.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/content-script.processor.js +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/file-script.processor.d.ts +4 -3
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/file-script.processor.js +16 -4
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/node-module-script.processor.d.ts +3 -3
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/script/node-module-script.processor.js +6 -5
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/content-stylesheet.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/content-stylesheet.processor.js +1 -1
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/file-stylesheet.processor.d.ts +2 -2
- package/src/services/{asset-processing-service → assets/asset-processing-service}/processors/stylesheet/file-stylesheet.processor.js +5 -2
- package/src/services/assets/browser-bundle.service.d.ts +32 -0
- package/src/services/assets/browser-bundle.service.js +33 -0
- package/src/services/{page-request-cache-coordinator.service.d.ts → cache/page-request-cache-coordinator.service.d.ts} +2 -2
- package/src/services/{page-request-cache-coordinator.service.js → cache/page-request-cache-coordinator.service.js} +3 -1
- package/src/services/html/html-rewriter-provider.service.d.ts +37 -0
- package/src/services/html/html-rewriter-provider.service.js +68 -0
- package/src/services/html/html-transformer.service.d.ts +77 -0
- package/src/services/html/html-transformer.service.js +215 -0
- package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
- package/src/services/invalidation/development-invalidation.service.js +190 -0
- package/src/services/module-loading/app-module-loader.service.d.ts +28 -0
- package/src/services/module-loading/app-module-loader.service.js +35 -0
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +24 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +109 -0
- package/src/services/module-loading/host-module-loader-registry.d.ts +4 -0
- package/src/services/module-loading/host-module-loader-registry.js +15 -0
- package/src/services/module-loading/module-loading-types.d.ts +2 -0
- package/src/services/module-loading/node-bootstrap-plugin.d.ts +42 -0
- package/src/services/module-loading/node-bootstrap-plugin.js +204 -0
- package/src/services/module-loading/page-module-import.service.d.ts +76 -0
- package/src/services/module-loading/page-module-import.service.js +173 -0
- package/src/services/module-loading/server-module-transpiler.service.d.ts +72 -0
- package/src/services/module-loading/server-module-transpiler.service.js +64 -0
- package/src/services/runtime-state/dev-graph.service.d.ts +118 -0
- package/src/services/runtime-state/dev-graph.service.js +162 -0
- package/src/services/runtime-state/entrypoint-dependency-graph.service.d.ts +41 -0
- package/src/services/runtime-state/entrypoint-dependency-graph.service.js +85 -0
- package/src/services/runtime-state/runtime-specifier-registry.service.d.ts +69 -0
- package/src/services/runtime-state/runtime-specifier-registry.service.js +37 -0
- package/src/services/runtime-state/server-invalidation-state.service.d.ts +26 -0
- package/src/services/runtime-state/server-invalidation-state.service.js +35 -0
- package/src/services/{schema-validation-service.d.ts → validation/schema-validation-service.d.ts} +1 -1
- package/src/static-site-generator/README.md +26 -0
- package/src/static-site-generator/static-site-generator.d.ts +50 -3
- package/src/static-site-generator/static-site-generator.js +71 -5
- package/src/{internal-types.d.ts → types/internal-types.d.ts} +53 -22
- package/src/types/internal-types.js +0 -0
- package/src/{public-types.d.ts → types/public-types.d.ts} +146 -21
- package/src/types/public-types.js +0 -0
- package/src/utils/html-escaping.d.ts +7 -0
- package/src/utils/html-escaping.js +6 -0
- package/src/utils/locals-utils.d.ts +1 -1
- package/src/utils/parse-cli-args.d.ts +4 -1
- package/src/utils/parse-cli-args.js +16 -1
- package/src/utils/resolve-work-dir.d.ts +11 -0
- package/src/utils/resolve-work-dir.js +31 -0
- package/src/watchers/project-watcher.d.ts +40 -24
- package/src/watchers/project-watcher.js +129 -92
- package/src/watchers/project-watcher.test-helpers.d.ts +2 -2
- package/src/watchers/project-watcher.test-helpers.js +1 -0
- package/src/adapters/abstract/application-adapter.ts +0 -337
- package/src/adapters/abstract/router-adapter.ts +0 -30
- package/src/adapters/abstract/server-adapter.ts +0 -79
- package/src/adapters/bun/client-bridge.ts +0 -62
- package/src/adapters/bun/create-app.ts +0 -189
- package/src/adapters/bun/define-api-handler.d.ts +0 -61
- package/src/adapters/bun/define-api-handler.ts +0 -114
- package/src/adapters/bun/hmr-manager.ts +0 -281
- package/src/adapters/bun/index.ts +0 -3
- package/src/adapters/bun/server-adapter.ts +0 -492
- package/src/adapters/bun/server-lifecycle.ts +0 -154
- package/src/adapters/index.ts +0 -6
- package/src/adapters/node/create-app.ts +0 -179
- package/src/adapters/node/index.d.ts +0 -4
- package/src/adapters/node/index.js +0 -8
- package/src/adapters/node/index.ts +0 -9
- package/src/adapters/node/node-client-bridge.ts +0 -79
- package/src/adapters/node/node-hmr-manager.ts +0 -271
- package/src/adapters/node/server-adapter.ts +0 -561
- package/src/adapters/node/static-content-server.ts +0 -203
- package/src/adapters/shared/api-response.ts +0 -104
- package/src/adapters/shared/application-adapter.ts +0 -199
- package/src/adapters/shared/explicit-static-route-matcher.ts +0 -134
- package/src/adapters/shared/file-route-middleware-pipeline.ts +0 -123
- package/src/adapters/shared/fs-server-response-factory.ts +0 -118
- package/src/adapters/shared/fs-server-response-matcher.ts +0 -198
- package/src/adapters/shared/render-context.ts +0 -105
- package/src/adapters/shared/server-adapter.ts +0 -442
- package/src/adapters/shared/server-route-handler.ts +0 -166
- package/src/adapters/shared/server-static-builder.ts +0 -82
- package/src/build/build-adapter.ts +0 -132
- package/src/build/build-types.ts +0 -83
- package/src/build/esbuild-build-adapter.ts +0 -510
- package/src/config/config-builder.ts +0 -474
- package/src/constants.ts +0 -39
- package/src/create-app.ts +0 -87
- package/src/define-api-handler.js +0 -15
- package/src/define-api-handler.ts +0 -66
- package/src/dev/sc-server.ts +0 -143
- package/src/eco/component-render-context.d.ts +0 -105
- package/src/eco/component-render-context.js +0 -77
- package/src/eco/component-render-context.ts +0 -202
- package/src/eco/eco.ts +0 -221
- package/src/eco/eco.types.ts +0 -202
- package/src/eco/global-injector-map.ts +0 -112
- package/src/eco/lazy-injector-map.ts +0 -120
- package/src/eco/module-dependencies.ts +0 -75
- package/src/errors/http-error.ts +0 -72
- package/src/errors/index.ts +0 -2
- package/src/errors/locals-access-error.ts +0 -7
- package/src/global/app-logger.ts +0 -4
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-have-HMR-script-injected-in-page-1.png +0 -0
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-HMR-Server-Integration-should-load-fixture-app-page-1.png +0 -0
- package/src/hmr/client/__screenshots__/hmr-runtime.test.browser.ts/HMR-Runtime-WebSocket-Connection-should-connect-to-correct-HMR-endpoint-1.png +0 -0
- package/src/hmr/client/hmr-runtime.ts +0 -121
- package/src/hmr/hmr-strategy.ts +0 -172
- package/src/hmr/hmr.test.e2e.ts +0 -75
- package/src/hmr/strategies/default-hmr-strategy.ts +0 -60
- package/src/hmr/strategies/js-hmr-strategy.ts +0 -308
- package/src/index.browser.ts +0 -3
- package/src/index.ts +0 -5
- package/src/integrations/ghtml/ghtml-renderer.ts +0 -93
- package/src/integrations/ghtml/ghtml.plugin.ts +0 -32
- package/src/internal-types.ts +0 -212
- package/src/plugins/alias-resolver-plugin.ts +0 -45
- package/src/plugins/eco-component-meta-plugin.ts +0 -474
- package/src/plugins/integration-plugin.ts +0 -184
- package/src/plugins/processor.ts +0 -220
- package/src/public-types.ts +0 -1255
- package/src/route-renderer/component-graph-executor.d.ts +0 -32
- package/src/route-renderer/component-graph-executor.js +0 -31
- package/src/route-renderer/component-graph-executor.ts +0 -84
- package/src/route-renderer/component-graph.d.ts +0 -42
- package/src/route-renderer/component-graph.js +0 -72
- package/src/route-renderer/component-graph.ts +0 -159
- package/src/route-renderer/component-marker.d.ts +0 -52
- package/src/route-renderer/component-marker.js +0 -46
- package/src/route-renderer/component-marker.ts +0 -117
- package/src/route-renderer/dependency-resolver.ts +0 -596
- package/src/route-renderer/html-post-processing.service.d.ts +0 -40
- package/src/route-renderer/html-post-processing.service.js +0 -86
- package/src/route-renderer/html-post-processing.service.ts +0 -103
- package/src/route-renderer/integration-renderer.d.ts +0 -339
- package/src/route-renderer/integration-renderer.js +0 -526
- package/src/route-renderer/integration-renderer.ts +0 -696
- package/src/route-renderer/marker-graph-resolver.d.ts +0 -76
- package/src/route-renderer/marker-graph-resolver.js +0 -93
- package/src/route-renderer/marker-graph-resolver.ts +0 -153
- package/src/route-renderer/page-module-loader.d.ts +0 -61
- package/src/route-renderer/page-module-loader.ts +0 -153
- package/src/route-renderer/render-execution.service.d.ts +0 -69
- package/src/route-renderer/render-execution.service.js +0 -91
- package/src/route-renderer/render-execution.service.ts +0 -158
- package/src/route-renderer/render-preparation.service.ts +0 -358
- package/src/route-renderer/route-renderer.ts +0 -80
- package/src/router/fs-router-scanner.ts +0 -217
- package/src/router/fs-router.ts +0 -122
- package/src/services/asset-processing-service/asset-processing.service.d.ts +0 -41
- package/src/services/asset-processing-service/asset-processing.service.ts +0 -306
- package/src/services/asset-processing-service/asset.factory.ts +0 -105
- package/src/services/asset-processing-service/assets.types.ts +0 -112
- package/src/services/asset-processing-service/index.d.ts +0 -3
- package/src/services/asset-processing-service/index.js +0 -3
- package/src/services/asset-processing-service/index.ts +0 -3
- package/src/services/asset-processing-service/processor.interface.ts +0 -27
- package/src/services/asset-processing-service/processor.registry.ts +0 -18
- package/src/services/asset-processing-service/processors/base/base-processor.ts +0 -76
- package/src/services/asset-processing-service/processors/base/base-script-processor.ts +0 -105
- package/src/services/asset-processing-service/processors/index.d.ts +0 -5
- package/src/services/asset-processing-service/processors/index.js +0 -5
- package/src/services/asset-processing-service/processors/index.ts +0 -5
- package/src/services/asset-processing-service/processors/script/content-script.processor.ts +0 -66
- package/src/services/asset-processing-service/processors/script/file-script.processor.ts +0 -88
- package/src/services/asset-processing-service/processors/script/node-module-script.processor.ts +0 -84
- package/src/services/asset-processing-service/processors/stylesheet/content-stylesheet.processor.ts +0 -27
- package/src/services/asset-processing-service/processors/stylesheet/file-stylesheet.processor.ts +0 -77
- package/src/services/cache/cache.types.ts +0 -126
- package/src/services/cache/index.ts +0 -18
- package/src/services/cache/memory-cache-store.ts +0 -130
- package/src/services/cache/page-cache-service.ts +0 -202
- package/src/services/html-transformer.service.d.ts +0 -50
- package/src/services/html-transformer.service.js +0 -163
- package/src/services/html-transformer.service.ts +0 -217
- package/src/services/page-module-import.service.d.ts +0 -37
- package/src/services/page-module-import.service.js +0 -88
- package/src/services/page-module-import.service.ts +0 -129
- package/src/services/page-request-cache-coordinator.service.ts +0 -128
- package/src/services/schema-validation-service.ts +0 -204
- package/src/services/validation/standard-schema.types.ts +0 -68
- package/src/static-site-generator/static-site-generator.ts +0 -359
- package/src/utils/css.d.ts +0 -1
- package/src/utils/css.js +0 -7
- package/src/utils/css.ts +0 -5
- package/src/utils/deep-merge.ts +0 -47
- package/src/utils/hash.ts +0 -5
- package/src/utils/html.ts +0 -1
- package/src/utils/invariant.ts +0 -15
- package/src/utils/locals-utils.ts +0 -37
- package/src/utils/parse-cli-args.ts +0 -83
- package/src/utils/path-utils.module.ts +0 -14
- package/src/utils/runtime.ts +0 -44
- package/src/utils/server-utils.module.ts +0 -67
- package/src/watchers/project-watcher.test-helpers.ts +0 -40
- package/src/watchers/project-watcher.ts +0 -306
- /package/src/adapters/{bun → shared}/define-api-handler.js +0 -0
- /package/src/{internal-types.js → plugins/runtime-capability.js} +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/assets.types.js +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.interface.js +0 -0
- /package/src/services/{asset-processing-service → assets/asset-processing-service}/processor.registry.js +0 -0
- /package/src/{public-types.js → services/module-loading/module-loading-types.js} +0 -0
- /package/src/services/{schema-validation-service.js → validation/schema-validation-service.js} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
class NoopEntrypointDependencyGraph {
|
|
3
|
+
supportsSelectiveInvalidation() {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
getDependencyEntrypoints(_filePath) {
|
|
7
|
+
return /* @__PURE__ */ new Set();
|
|
8
|
+
}
|
|
9
|
+
setEntrypointDependencies(_entrypointPath, _dependencies) {
|
|
10
|
+
}
|
|
11
|
+
clearEntrypointDependencies(_entrypointPath) {
|
|
12
|
+
}
|
|
13
|
+
reset() {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class InMemoryEntrypointDependencyGraph {
|
|
17
|
+
dependencyEntrypoints = /* @__PURE__ */ new Map();
|
|
18
|
+
entrypointDependencies = /* @__PURE__ */ new Map();
|
|
19
|
+
supportsSelectiveInvalidation() {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
getDependencyEntrypoints(filePath) {
|
|
23
|
+
return new Set(this.dependencyEntrypoints.get(path.resolve(filePath)) ?? []);
|
|
24
|
+
}
|
|
25
|
+
setEntrypointDependencies(entrypointPath, dependencies) {
|
|
26
|
+
const normalizedEntrypoint = path.resolve(entrypointPath);
|
|
27
|
+
this.clearEntrypointDependencies(normalizedEntrypoint);
|
|
28
|
+
const normalizedDependencies = /* @__PURE__ */ new Set([
|
|
29
|
+
normalizedEntrypoint,
|
|
30
|
+
...dependencies.map((dependencyPath) => path.resolve(dependencyPath))
|
|
31
|
+
]);
|
|
32
|
+
this.entrypointDependencies.set(normalizedEntrypoint, normalizedDependencies);
|
|
33
|
+
for (const dependencyPath of normalizedDependencies) {
|
|
34
|
+
const entrypoints = this.dependencyEntrypoints.get(dependencyPath) ?? /* @__PURE__ */ new Set();
|
|
35
|
+
entrypoints.add(normalizedEntrypoint);
|
|
36
|
+
this.dependencyEntrypoints.set(dependencyPath, entrypoints);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
clearEntrypointDependencies(entrypointPath) {
|
|
40
|
+
const normalizedEntrypoint = path.resolve(entrypointPath);
|
|
41
|
+
const previousDependencies = this.entrypointDependencies.get(normalizedEntrypoint);
|
|
42
|
+
if (!previousDependencies) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const dependencyPath of previousDependencies) {
|
|
46
|
+
const entrypoints = this.dependencyEntrypoints.get(dependencyPath);
|
|
47
|
+
if (!entrypoints) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
entrypoints.delete(normalizedEntrypoint);
|
|
51
|
+
if (entrypoints.size === 0) {
|
|
52
|
+
this.dependencyEntrypoints.delete(dependencyPath);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
this.entrypointDependencies.delete(normalizedEntrypoint);
|
|
56
|
+
}
|
|
57
|
+
reset() {
|
|
58
|
+
this.dependencyEntrypoints.clear();
|
|
59
|
+
this.entrypointDependencies.clear();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function isLegacyEntrypointDependencyGraph(value) {
|
|
63
|
+
return Boolean(value) && typeof value === "object" && typeof value.supportsSelectiveInvalidation === "function" && typeof value.getDependencyEntrypoints === "function" && typeof value.setEntrypointDependencies === "function" && typeof value.clearEntrypointDependencies === "function" && typeof value.reset === "function";
|
|
64
|
+
}
|
|
65
|
+
function getAppEntrypointDependencyGraph(appConfig) {
|
|
66
|
+
if (appConfig.runtime?.entrypointDependencyGraph) {
|
|
67
|
+
return appConfig.runtime.entrypointDependencyGraph;
|
|
68
|
+
}
|
|
69
|
+
if (isLegacyEntrypointDependencyGraph(appConfig.runtime?.devGraphService)) {
|
|
70
|
+
return appConfig.runtime.devGraphService;
|
|
71
|
+
}
|
|
72
|
+
return new NoopEntrypointDependencyGraph();
|
|
73
|
+
}
|
|
74
|
+
function setAppEntrypointDependencyGraph(appConfig, entrypointDependencyGraph) {
|
|
75
|
+
appConfig.runtime = {
|
|
76
|
+
...appConfig.runtime ?? {},
|
|
77
|
+
entrypointDependencyGraph
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
InMemoryEntrypointDependencyGraph,
|
|
82
|
+
NoopEntrypointDependencyGraph,
|
|
83
|
+
getAppEntrypointDependencyGraph,
|
|
84
|
+
setAppEntrypointDependencyGraph
|
|
85
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Stores runtime-visible bare-specifier mappings for one app instance.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Integrations populate this registry during runtime setup when they expose
|
|
7
|
+
* browser runtime modules through stable bare imports. Build and HMR code later
|
|
8
|
+
* consume the collected map to create aliasing and bootstrap behavior without
|
|
9
|
+
* forcing integrations to own global registry state.
|
|
10
|
+
*/
|
|
11
|
+
export interface RuntimeSpecifierRegistry {
|
|
12
|
+
/**
|
|
13
|
+
* Merges a new batch of specifier mappings into the registry.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Later registrations replace earlier URLs for the same specifier. This keeps
|
|
17
|
+
* runtime setup deterministic while still allowing an integration to refresh
|
|
18
|
+
* its own declarations during one app session.
|
|
19
|
+
*/
|
|
20
|
+
register(map: Record<string, string>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the current registry contents.
|
|
23
|
+
*
|
|
24
|
+
* @remarks
|
|
25
|
+
* The returned map is the live backing map for the registry implementation, so
|
|
26
|
+
* callers should treat it as read-only unless they intentionally own registry
|
|
27
|
+
* mutation semantics.
|
|
28
|
+
*/
|
|
29
|
+
getAll(): Map<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Removes all registered specifiers for the current app/runtime instance.
|
|
32
|
+
*/
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Default in-memory runtime specifier registry used by core.
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* Runtime specifier maps are app-local bootstrap metadata, not durable build
|
|
40
|
+
* artifacts, so the default implementation stays intentionally small.
|
|
41
|
+
*/
|
|
42
|
+
export declare class InMemoryRuntimeSpecifierRegistry implements RuntimeSpecifierRegistry {
|
|
43
|
+
private readonly specifierMap;
|
|
44
|
+
/**
|
|
45
|
+
* Merges one integration-provided mapping set into the app registry.
|
|
46
|
+
*/
|
|
47
|
+
register(map: Record<string, string>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the live app-owned mapping table.
|
|
50
|
+
*/
|
|
51
|
+
getAll(): Map<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Clears all mappings for the current runtime session.
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the runtime specifier registry owned by one app instance.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* Older tests and helpers may not seed runtime state explicitly yet, so this
|
|
62
|
+
* helper still provides an in-memory fallback when the app runtime has not been
|
|
63
|
+
* initialized.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getAppRuntimeSpecifierRegistry(appConfig: EcoPagesAppConfig): RuntimeSpecifierRegistry;
|
|
66
|
+
/**
|
|
67
|
+
* Installs the runtime specifier registry that should back one app instance.
|
|
68
|
+
*/
|
|
69
|
+
export declare function setAppRuntimeSpecifierRegistry(appConfig: EcoPagesAppConfig, runtimeSpecifierRegistry: RuntimeSpecifierRegistry): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
class InMemoryRuntimeSpecifierRegistry {
|
|
2
|
+
specifierMap = /* @__PURE__ */ new Map();
|
|
3
|
+
/**
|
|
4
|
+
* Merges one integration-provided mapping set into the app registry.
|
|
5
|
+
*/
|
|
6
|
+
register(map) {
|
|
7
|
+
for (const [specifier, url] of Object.entries(map)) {
|
|
8
|
+
this.specifierMap.set(specifier, url);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns the live app-owned mapping table.
|
|
13
|
+
*/
|
|
14
|
+
getAll() {
|
|
15
|
+
return this.specifierMap;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Clears all mappings for the current runtime session.
|
|
19
|
+
*/
|
|
20
|
+
clear() {
|
|
21
|
+
this.specifierMap.clear();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function getAppRuntimeSpecifierRegistry(appConfig) {
|
|
25
|
+
return appConfig.runtime?.runtimeSpecifierRegistry ?? new InMemoryRuntimeSpecifierRegistry();
|
|
26
|
+
}
|
|
27
|
+
function setAppRuntimeSpecifierRegistry(appConfig, runtimeSpecifierRegistry) {
|
|
28
|
+
appConfig.runtime = {
|
|
29
|
+
...appConfig.runtime ?? {},
|
|
30
|
+
runtimeSpecifierRegistry
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
InMemoryRuntimeSpecifierRegistry,
|
|
35
|
+
getAppRuntimeSpecifierRegistry,
|
|
36
|
+
setAppRuntimeSpecifierRegistry
|
|
37
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../../types/internal-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* App-owned coarse invalidation state for server-executed modules.
|
|
4
|
+
*/
|
|
5
|
+
export interface ServerInvalidationState {
|
|
6
|
+
getServerInvalidationVersion(): number;
|
|
7
|
+
invalidateServerModules(changedFiles?: string[]): void;
|
|
8
|
+
reset(): void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal app-local invalidation state backed by a single generation counter.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CounterServerInvalidationState implements ServerInvalidationState {
|
|
14
|
+
private serverInvalidationVersion;
|
|
15
|
+
getServerInvalidationVersion(): number;
|
|
16
|
+
invalidateServerModules(_changedFiles?: string[]): void;
|
|
17
|
+
reset(): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Returns the app-owned server invalidation state.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAppServerInvalidationState(appConfig: EcoPagesAppConfig): ServerInvalidationState;
|
|
23
|
+
/**
|
|
24
|
+
* Installs the invalidation state used by one app instance.
|
|
25
|
+
*/
|
|
26
|
+
export declare function setAppServerInvalidationState(appConfig: EcoPagesAppConfig, serverInvalidationState: ServerInvalidationState): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class CounterServerInvalidationState {
|
|
2
|
+
serverInvalidationVersion = 0;
|
|
3
|
+
getServerInvalidationVersion() {
|
|
4
|
+
return this.serverInvalidationVersion;
|
|
5
|
+
}
|
|
6
|
+
invalidateServerModules(_changedFiles) {
|
|
7
|
+
this.serverInvalidationVersion += 1;
|
|
8
|
+
}
|
|
9
|
+
reset() {
|
|
10
|
+
this.serverInvalidationVersion += 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function isLegacyServerInvalidationState(value) {
|
|
14
|
+
return Boolean(value) && typeof value === "object" && typeof value.getServerInvalidationVersion === "function" && typeof value.invalidateServerModules === "function" && typeof value.reset === "function";
|
|
15
|
+
}
|
|
16
|
+
function getAppServerInvalidationState(appConfig) {
|
|
17
|
+
if (appConfig.runtime?.serverInvalidationState) {
|
|
18
|
+
return appConfig.runtime.serverInvalidationState;
|
|
19
|
+
}
|
|
20
|
+
if (isLegacyServerInvalidationState(appConfig.runtime?.devGraphService)) {
|
|
21
|
+
return appConfig.runtime.devGraphService;
|
|
22
|
+
}
|
|
23
|
+
return new CounterServerInvalidationState();
|
|
24
|
+
}
|
|
25
|
+
function setAppServerInvalidationState(appConfig, serverInvalidationState) {
|
|
26
|
+
appConfig.runtime = {
|
|
27
|
+
...appConfig.runtime ?? {},
|
|
28
|
+
serverInvalidationState
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
CounterServerInvalidationState,
|
|
33
|
+
getAppServerInvalidationState,
|
|
34
|
+
setAppServerInvalidationState
|
|
35
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Static Site Generation
|
|
2
|
+
|
|
3
|
+
This directory contains the static-build execution path used when Ecopages renders pages ahead of time.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
The static-site generator reuses the same app-owned config, route matching, and rendering services that development and preview flows use, but drives them in a build-oriented loop.
|
|
8
|
+
|
|
9
|
+
It is responsible for:
|
|
10
|
+
|
|
11
|
+
- enumerating renderable routes
|
|
12
|
+
- rendering static outputs through the normal rendering pipeline
|
|
13
|
+
- respecting route-level constraints such as cache policy and unsupported dynamic server-only paths
|
|
14
|
+
|
|
15
|
+
## Design Rule
|
|
16
|
+
|
|
17
|
+
Static generation should follow the same ownership model as runtime rendering.
|
|
18
|
+
|
|
19
|
+
That means it should reuse:
|
|
20
|
+
|
|
21
|
+
- built app config
|
|
22
|
+
- route matching
|
|
23
|
+
- render orchestration
|
|
24
|
+
- asset processing
|
|
25
|
+
|
|
26
|
+
It should not invent a parallel rendering stack just for build mode.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { EcoPagesAppConfig } from '../internal-types.js';
|
|
2
|
-
import type { StaticRoute } from '../public-types.js';
|
|
1
|
+
import type { EcoPagesAppConfig } from '../types/internal-types.js';
|
|
2
|
+
import type { StaticRoute } from '../types/public-types.js';
|
|
3
3
|
import type { RouteRendererFactory } from '../route-renderer/route-renderer.js';
|
|
4
|
-
import type { FSRouter } from '../router/fs-router.js';
|
|
4
|
+
import type { FSRouter } from '../router/server/fs-router.js';
|
|
5
5
|
export declare const STATIC_SITE_GENERATOR_ERRORS: {
|
|
6
6
|
readonly ROUTE_RENDERER_FACTORY_REQUIRED: "RouteRendererFactory is required for render strategy";
|
|
7
7
|
readonly unsupportedBodyType: (bodyType: string) => string;
|
|
@@ -9,13 +9,49 @@ export declare const STATIC_SITE_GENERATOR_ERRORS: {
|
|
|
9
9
|
readonly noRendererForIntegration: (integrationName: string) => string;
|
|
10
10
|
readonly dynamicRouteRequiresStaticPaths: (routePath: string) => string;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Generates static output files from the finalized app config and route graph.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This class intentionally reuses the same routing, renderer, and server-module
|
|
17
|
+
* loading seams used by runtime rendering. Static generation should be a build
|
|
18
|
+
* loop over the normal app model, not a parallel rendering stack with different
|
|
19
|
+
* semantics.
|
|
20
|
+
*/
|
|
12
21
|
export declare class StaticSiteGenerator {
|
|
13
22
|
appConfig: EcoPagesAppConfig;
|
|
23
|
+
/**
|
|
24
|
+
* Creates the static-site generator for one app config.
|
|
25
|
+
*/
|
|
14
26
|
constructor({ appConfig }: {
|
|
15
27
|
appConfig: EcoPagesAppConfig;
|
|
16
28
|
});
|
|
29
|
+
private getExportDir;
|
|
30
|
+
/**
|
|
31
|
+
* Logs the standardized warning emitted when a dynamic-cache page is skipped.
|
|
32
|
+
*/
|
|
33
|
+
private warnDynamicPageSkipped;
|
|
34
|
+
/**
|
|
35
|
+
* Determines whether one filesystem-discovered page should be excluded from
|
|
36
|
+
* static generation.
|
|
37
|
+
*/
|
|
38
|
+
private shouldSkipStaticPageFile;
|
|
39
|
+
/**
|
|
40
|
+
* Determines whether one explicit static route view should be excluded from
|
|
41
|
+
* static generation.
|
|
42
|
+
*/
|
|
43
|
+
private shouldSkipStaticView;
|
|
44
|
+
/**
|
|
45
|
+
* Writes the robots.txt file declared by the app config.
|
|
46
|
+
*/
|
|
17
47
|
generateRobotsTxt(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Returns whether the input path points at the root directory.
|
|
50
|
+
*/
|
|
18
51
|
isRootDir(path: string): boolean | null;
|
|
52
|
+
/**
|
|
53
|
+
* Collects parent directories that must exist for the generated route set.
|
|
54
|
+
*/
|
|
19
55
|
getDirectories(routes: string[]): string[];
|
|
20
56
|
/**
|
|
21
57
|
* Extracts dynamic parameters from the actual path based on the template path.
|
|
@@ -25,7 +61,18 @@ export declare class StaticSiteGenerator {
|
|
|
25
61
|
* @returns A record of extracted parameters (e.g., { slug: "my-post" })
|
|
26
62
|
*/
|
|
27
63
|
private extractParams;
|
|
64
|
+
/**
|
|
65
|
+
* Generates static output for all filesystem-discovered routes.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* Routes whose integrations opt into fetch-based static builds are rendered by
|
|
69
|
+
* issuing a request against the running server origin. Render-strategy routes
|
|
70
|
+
* go through the normal route renderer directly.
|
|
71
|
+
*/
|
|
28
72
|
generateStaticPages(router: FSRouter, baseUrl: string, routeRendererFactory?: RouteRendererFactory): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Executes the full static-generation workflow for one app run.
|
|
75
|
+
*/
|
|
29
76
|
run({ router, baseUrl, routeRendererFactory, staticRoutes, }: {
|
|
30
77
|
router: FSRouter;
|
|
31
78
|
baseUrl: string;
|
|
@@ -11,9 +11,52 @@ const STATIC_SITE_GENERATOR_ERRORS = {
|
|
|
11
11
|
};
|
|
12
12
|
class StaticSiteGenerator {
|
|
13
13
|
appConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Creates the static-site generator for one app config.
|
|
16
|
+
*/
|
|
14
17
|
constructor({ appConfig }) {
|
|
15
18
|
this.appConfig = appConfig;
|
|
16
19
|
}
|
|
20
|
+
getExportDir() {
|
|
21
|
+
return this.appConfig.absolutePaths?.distDir ?? path.join(this.appConfig.rootDir, this.appConfig.distDir);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Logs the standardized warning emitted when a dynamic-cache page is skipped.
|
|
25
|
+
*/
|
|
26
|
+
warnDynamicPageSkipped(filePath) {
|
|
27
|
+
appLogger.warn(
|
|
28
|
+
"Pages with cache: 'dynamic' are not supported in static generation or preview, so they will be skipped\n",
|
|
29
|
+
`\u27A4 ${filePath}`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Determines whether one filesystem-discovered page should be excluded from
|
|
34
|
+
* static generation.
|
|
35
|
+
*/
|
|
36
|
+
async shouldSkipStaticPageFile(filePath, routeRendererFactory) {
|
|
37
|
+
const module = await routeRendererFactory.createRenderer(filePath).loadPageModule(filePath, {
|
|
38
|
+
cacheScope: "static-page-probe"
|
|
39
|
+
});
|
|
40
|
+
if (module.default?.cache !== "dynamic") {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
this.warnDynamicPageSkipped(filePath);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether one explicit static route view should be excluded from
|
|
48
|
+
* static generation.
|
|
49
|
+
*/
|
|
50
|
+
shouldSkipStaticView(routePath, view) {
|
|
51
|
+
if (view.cache !== "dynamic") {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
this.warnDynamicPageSkipped(routePath);
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Writes the robots.txt file declared by the app config.
|
|
59
|
+
*/
|
|
17
60
|
generateRobotsTxt() {
|
|
18
61
|
let data = "";
|
|
19
62
|
const preferences = this.appConfig.robotsTxt.preferences;
|
|
@@ -26,13 +69,19 @@ class StaticSiteGenerator {
|
|
|
26
69
|
}
|
|
27
70
|
data += "\n";
|
|
28
71
|
}
|
|
29
|
-
fileSystem.ensureDir(this.
|
|
30
|
-
fileSystem.write(
|
|
72
|
+
fileSystem.ensureDir(this.getExportDir());
|
|
73
|
+
fileSystem.write(path.join(this.getExportDir(), "robots.txt"), data);
|
|
31
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns whether the input path points at the root directory.
|
|
77
|
+
*/
|
|
32
78
|
isRootDir(path2) {
|
|
33
79
|
const slashes = path2.match(/\//g);
|
|
34
80
|
return slashes && slashes.length === 1;
|
|
35
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Collects parent directories that must exist for the generated route set.
|
|
84
|
+
*/
|
|
36
85
|
getDirectories(routes) {
|
|
37
86
|
const directories = /* @__PURE__ */ new Set();
|
|
38
87
|
for (const route of routes) {
|
|
@@ -64,12 +113,20 @@ class StaticSiteGenerator {
|
|
|
64
113
|
}
|
|
65
114
|
return params;
|
|
66
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Generates static output for all filesystem-discovered routes.
|
|
118
|
+
*
|
|
119
|
+
* @remarks
|
|
120
|
+
* Routes whose integrations opt into fetch-based static builds are rendered by
|
|
121
|
+
* issuing a request against the running server origin. Render-strategy routes
|
|
122
|
+
* go through the normal route renderer directly.
|
|
123
|
+
*/
|
|
67
124
|
async generateStaticPages(router, baseUrl, routeRendererFactory) {
|
|
68
125
|
const routes = Object.keys(router.routes).filter((route) => !route.includes("["));
|
|
69
126
|
appLogger.debug("Static Pages", routes);
|
|
70
127
|
const directories = this.getDirectories(routes);
|
|
71
128
|
for (const directory of directories) {
|
|
72
|
-
fileSystem.ensureDir(path.join(this.
|
|
129
|
+
fileSystem.ensureDir(path.join(this.getExportDir(), directory));
|
|
73
130
|
}
|
|
74
131
|
for (const route of routes) {
|
|
75
132
|
try {
|
|
@@ -90,6 +147,9 @@ class StaticSiteGenerator {
|
|
|
90
147
|
if (!routeRendererFactory) {
|
|
91
148
|
throw new Error(STATIC_SITE_GENERATOR_ERRORS.ROUTE_RENDERER_FACTORY_REQUIRED);
|
|
92
149
|
}
|
|
150
|
+
if (await this.shouldSkipStaticPageFile(filePath, routeRendererFactory)) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
93
153
|
let pathname2 = routePathname;
|
|
94
154
|
const pathnameSegments2 = pathname2.split("/").filter(Boolean);
|
|
95
155
|
if (pathname2 === "/") {
|
|
@@ -127,7 +187,7 @@ class StaticSiteGenerator {
|
|
|
127
187
|
} else {
|
|
128
188
|
pathname += ".html";
|
|
129
189
|
}
|
|
130
|
-
const outputPath = path.join(this.
|
|
190
|
+
const outputPath = path.join(this.getExportDir(), pathname);
|
|
131
191
|
fileSystem.write(outputPath, contents);
|
|
132
192
|
} catch (error) {
|
|
133
193
|
appLogger.error(
|
|
@@ -137,6 +197,9 @@ class StaticSiteGenerator {
|
|
|
137
197
|
}
|
|
138
198
|
}
|
|
139
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Executes the full static-generation workflow for one app run.
|
|
202
|
+
*/
|
|
140
203
|
async run({
|
|
141
204
|
router,
|
|
142
205
|
baseUrl,
|
|
@@ -162,6 +225,9 @@ class StaticSiteGenerator {
|
|
|
162
225
|
try {
|
|
163
226
|
const mod = await route.loader();
|
|
164
227
|
const view = mod.default;
|
|
228
|
+
if (this.shouldSkipStaticView(route.path, view)) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
165
231
|
const isDynamic = route.path.includes(":") || route.path.includes("[");
|
|
166
232
|
if (isDynamic) {
|
|
167
233
|
await this.generateDynamicStaticRoute(route.path, view, routeRendererFactory);
|
|
@@ -260,7 +326,7 @@ class StaticSiteGenerator {
|
|
|
260
326
|
} else {
|
|
261
327
|
outputName = `${routePath}.html`;
|
|
262
328
|
}
|
|
263
|
-
return path.join(this.
|
|
329
|
+
return path.join(this.getExportDir(), outputName);
|
|
264
330
|
}
|
|
265
331
|
}
|
|
266
332
|
function templateSegmentsFromPath(path2) {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import type { EcoBuildPlugin } from '
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { EcoBuildPlugin } from '../build/build-types.js';
|
|
2
|
+
import type { AppBuildManifest } from '../build/build-manifest.js';
|
|
3
|
+
import type { BuildAdapter, BuildExecutor, BuildOwnership } from '../build/build-adapter.js';
|
|
4
|
+
import type { IntegrationPlugin } from '../plugins/integration-plugin.js';
|
|
5
|
+
import type { Processor } from '../plugins/processor.js';
|
|
6
|
+
import type { EcoSourceTransform } from '../plugins/source-transform.js';
|
|
4
7
|
import type { PageMetadataProps } from './public-types.js';
|
|
5
|
-
import type { FSRouter } from '
|
|
6
|
-
import type { CacheConfig } from '
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
8
|
+
import type { FSRouter } from '../router/server/fs-router.js';
|
|
9
|
+
import type { CacheConfig } from '../services/cache/cache.types.js';
|
|
10
|
+
import type { DevGraphService } from '../services/runtime-state/dev-graph.service.js';
|
|
11
|
+
import type { AppModuleLoader } from '../services/module-loading/app-module-loader.service.js';
|
|
12
|
+
import type { SourceModuleLoader } from '../services/module-loading/module-loading-types.js';
|
|
13
|
+
import type { EntrypointDependencyGraph } from '../services/runtime-state/entrypoint-dependency-graph.service.js';
|
|
14
|
+
import type { RuntimeSpecifierRegistry } from '../services/runtime-state/runtime-specifier-registry.service.js';
|
|
15
|
+
import type { ServerInvalidationState } from '../services/runtime-state/server-invalidation-state.service.js';
|
|
16
|
+
import type { ServerModuleTranspiler } from '../services/module-loading/server-module-transpiler.service.js';
|
|
15
17
|
export interface RobotsPreference {
|
|
16
18
|
/**
|
|
17
19
|
* The user agent
|
|
@@ -58,20 +60,22 @@ export type EcoPagesAppConfig = {
|
|
|
58
60
|
* @default "layouts"
|
|
59
61
|
*/
|
|
60
62
|
layoutsDir: string;
|
|
61
|
-
/**
|
|
62
|
-
* The templates used for the pages
|
|
63
|
-
* @default "{head: 'head.kita.tsx', html: 'html.kita.tsx', seo: 'seo.kita.tsx'}"
|
|
64
|
-
*/
|
|
65
|
-
includesTemplates: IncludesTemplates;
|
|
66
|
-
/** Error 404 page
|
|
67
|
-
* @default "404.kita.tsx"
|
|
68
|
-
*/
|
|
69
|
-
error404Template: string;
|
|
70
63
|
/**
|
|
71
64
|
* The directory where the output will be located
|
|
72
65
|
* @default "dist"
|
|
73
66
|
*/
|
|
74
67
|
distDir: string;
|
|
68
|
+
/**
|
|
69
|
+
* The directory where internal runtime and build artifacts are stored.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
* This directory is not intended for deployment. It owns transpiled server
|
|
73
|
+
* modules, runtime manifests, and processor caches so `distDir` can remain a
|
|
74
|
+
* clean export tree.
|
|
75
|
+
*
|
|
76
|
+
* @default ".eco"
|
|
77
|
+
*/
|
|
78
|
+
workDir: string;
|
|
75
79
|
/**
|
|
76
80
|
* The templates extensions based on the integrations
|
|
77
81
|
*/
|
|
@@ -106,6 +110,7 @@ export type EcoPagesAppConfig = {
|
|
|
106
110
|
config: string;
|
|
107
111
|
componentsDir: string;
|
|
108
112
|
distDir: string;
|
|
113
|
+
workDir: string;
|
|
109
114
|
includesDir: string;
|
|
110
115
|
layoutsDir: string;
|
|
111
116
|
pagesDir: string;
|
|
@@ -123,11 +128,37 @@ export type EcoPagesAppConfig = {
|
|
|
123
128
|
* Loaders to be used in the app, these are used to process the files when importing them
|
|
124
129
|
*/
|
|
125
130
|
loaders: Map<string, EcoBuildPlugin>;
|
|
131
|
+
/**
|
|
132
|
+
* App-owned source transforms that can be adapted into Vite or other
|
|
133
|
+
* transform-first bundlers without going through the legacy loader bridge.
|
|
134
|
+
*/
|
|
135
|
+
sourceTransforms: Map<string, EcoSourceTransform>;
|
|
126
136
|
/**
|
|
127
137
|
* Cache configuration for ISR and page caching.
|
|
128
138
|
* @default { store: 'memory', defaultStrategy: 'static', enabled: true }
|
|
129
139
|
*/
|
|
130
140
|
cache?: CacheConfig;
|
|
141
|
+
/**
|
|
142
|
+
* Runtime-owned services attached after config construction.
|
|
143
|
+
*
|
|
144
|
+
* These values are internal implementation details used to thread per-app
|
|
145
|
+
* executors and similar runtime state through the system without relying on
|
|
146
|
+
* process-global registries.
|
|
147
|
+
*/
|
|
148
|
+
runtime?: {
|
|
149
|
+
appModuleLoader?: AppModuleLoader;
|
|
150
|
+
buildOwnership?: BuildOwnership;
|
|
151
|
+
buildAdapter?: BuildAdapter;
|
|
152
|
+
buildManifest?: AppBuildManifest;
|
|
153
|
+
buildExecutor?: BuildExecutor;
|
|
154
|
+
devGraphService?: DevGraphService;
|
|
155
|
+
entrypointDependencyGraph?: EntrypointDependencyGraph;
|
|
156
|
+
hostModuleLoader?: SourceModuleLoader;
|
|
157
|
+
rendererModuleContext?: unknown;
|
|
158
|
+
runtimeSpecifierRegistry?: RuntimeSpecifierRegistry;
|
|
159
|
+
serverInvalidationState?: ServerInvalidationState;
|
|
160
|
+
serverModuleTranspiler?: ServerModuleTranspiler;
|
|
161
|
+
};
|
|
131
162
|
/**
|
|
132
163
|
* Experimental features.
|
|
133
164
|
*/
|
|
File without changes
|