@ecopages/core 0.2.0-alpha.7 → 0.2.0-alpha.9
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 +31 -0
- package/package.json +212 -92
- package/src/adapters/abstract/application-adapter.d.ts +168 -0
- package/src/adapters/abstract/application-adapter.js +109 -0
- package/src/adapters/abstract/router-adapter.d.ts +26 -0
- package/src/adapters/abstract/router-adapter.js +5 -0
- package/src/adapters/abstract/server-adapter.d.ts +69 -0
- package/src/adapters/abstract/server-adapter.js +15 -0
- package/src/adapters/bun/client-bridge.d.ts +34 -0
- package/src/adapters/bun/client-bridge.js +48 -0
- package/src/adapters/bun/create-app.d.ts +60 -0
- package/src/adapters/bun/create-app.js +117 -0
- package/src/adapters/bun/hmr-manager.d.ts +143 -0
- package/src/adapters/bun/hmr-manager.js +334 -0
- package/src/adapters/bun/index.d.ts +2 -0
- package/src/adapters/bun/index.js +8 -0
- package/src/adapters/bun/server-adapter.d.ts +155 -0
- package/src/adapters/bun/server-adapter.js +373 -0
- package/src/adapters/bun/server-lifecycle.d.ts +63 -0
- package/src/adapters/bun/server-lifecycle.js +92 -0
- package/src/adapters/index.d.ts +6 -0
- package/src/adapters/index.js +14 -0
- package/src/adapters/node/bootstrap-dependency-resolver.d.ts +44 -0
- package/src/adapters/node/bootstrap-dependency-resolver.js +172 -0
- package/src/adapters/node/create-app.d.ts +21 -0
- package/src/adapters/node/create-app.js +143 -0
- package/src/adapters/node/index.d.ts +6 -0
- package/src/adapters/node/index.js +11 -0
- package/src/adapters/node/node-client-bridge.d.ts +26 -0
- package/src/adapters/node/node-client-bridge.js +66 -0
- package/src/adapters/node/node-hmr-manager.d.ts +133 -0
- package/src/adapters/node/node-hmr-manager.js +312 -0
- package/src/adapters/node/runtime-adapter.d.ts +46 -0
- package/src/adapters/node/runtime-adapter.js +306 -0
- package/src/adapters/node/server-adapter.d.ts +161 -0
- package/src/adapters/node/server-adapter.js +358 -0
- package/src/adapters/node/static-content-server.d.ts +60 -0
- package/src/adapters/node/static-content-server.js +194 -0
- package/src/adapters/node/write-runtime-manifest.d.ts +26 -0
- package/src/adapters/node/write-runtime-manifest.js +12 -0
- package/src/adapters/shared/api-response.d.ts +52 -0
- package/src/adapters/shared/api-response.js +96 -0
- package/src/adapters/shared/application-adapter.d.ts +18 -0
- package/src/adapters/shared/application-adapter.js +90 -0
- package/src/adapters/shared/define-api-handler.d.ts +25 -0
- package/src/adapters/shared/define-api-handler.js +15 -0
- package/src/adapters/shared/explicit-static-route-matcher.d.ts +38 -0
- package/src/adapters/shared/explicit-static-route-matcher.js +103 -0
- package/src/adapters/shared/file-route-middleware-pipeline.d.ts +65 -0
- package/src/adapters/shared/file-route-middleware-pipeline.js +99 -0
- package/src/adapters/shared/fs-server-response-factory.d.ts +19 -0
- package/src/adapters/shared/fs-server-response-factory.js +97 -0
- package/src/adapters/shared/fs-server-response-matcher.d.ts +75 -0
- package/src/adapters/shared/fs-server-response-matcher.js +160 -0
- 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 +14 -0
- package/src/adapters/shared/render-context.js +70 -0
- 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 +97 -0
- package/src/adapters/shared/server-adapter.js +386 -0
- package/src/adapters/shared/server-route-handler.d.ts +89 -0
- package/src/adapters/shared/server-route-handler.js +111 -0
- package/src/adapters/shared/server-static-builder.d.ts +70 -0
- package/src/adapters/shared/server-static-builder.js +99 -0
- package/src/build/build-adapter.d.ts +186 -0
- package/src/build/build-adapter.js +168 -0
- package/src/build/build-manifest.d.ts +27 -0
- package/src/build/build-manifest.js +30 -0
- package/src/build/build-types.d.ts +57 -0
- package/src/build/build-types.js +0 -0
- package/src/build/dev-build-coordinator.d.ts +74 -0
- package/src/build/dev-build-coordinator.js +161 -0
- package/src/build/esbuild-build-adapter.d.ts +72 -0
- package/src/build/esbuild-build-adapter.js +422 -0
- package/src/build/runtime-build-executor.d.ts +13 -0
- package/src/build/runtime-build-executor.js +20 -0
- package/src/build/runtime-specifier-alias-plugin.d.ts +15 -0
- package/src/build/runtime-specifier-alias-plugin.js +31 -0
- package/src/config/config-builder.d.ts +238 -0
- package/src/config/config-builder.js +565 -0
- package/src/constants.d.ts +45 -0
- package/src/constants.js +25 -0
- package/src/create-app.d.ts +17 -0
- package/src/create-app.js +66 -0
- package/src/dev/sc-server.d.ts +30 -0
- package/src/dev/sc-server.js +111 -0
- package/src/eco/component-render-context.d.ts +105 -0
- package/src/eco/component-render-context.js +87 -0
- package/src/eco/eco.d.ts +9 -0
- package/src/eco/eco.js +114 -0
- package/src/eco/eco.types.d.ts +178 -0
- package/src/eco/eco.types.js +0 -0
- package/src/eco/eco.utils.d.ts +40 -0
- package/src/eco/eco.utils.js +40 -0
- package/src/eco/global-injector-map.d.ts +16 -0
- package/src/eco/global-injector-map.js +80 -0
- package/src/eco/lazy-injector-map.d.ts +8 -0
- package/src/eco/lazy-injector-map.js +70 -0
- package/src/eco/module-dependencies.d.ts +18 -0
- package/src/eco/module-dependencies.js +49 -0
- package/src/errors/http-error.d.ts +31 -0
- package/src/errors/http-error.js +50 -0
- package/src/errors/index.d.ts +2 -0
- package/src/errors/index.js +4 -0
- package/src/errors/locals-access-error.d.ts +4 -0
- package/src/errors/locals-access-error.js +9 -0
- package/src/global/app-logger.d.ts +2 -0
- package/src/global/app-logger.js +6 -0
- package/src/hmr/client/hmr-runtime.d.ts +5 -0
- package/src/hmr/client/hmr-runtime.js +109 -0
- package/src/hmr/hmr-strategy.d.ts +159 -0
- package/src/hmr/hmr-strategy.js +29 -0
- 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.d.ts +1 -0
- package/src/hmr/hmr.test.e2e.js +43 -0
- package/src/hmr/strategies/default-hmr-strategy.d.ts +43 -0
- package/src/hmr/strategies/default-hmr-strategy.js +34 -0
- package/src/hmr/strategies/js-hmr-strategy.d.ts +139 -0
- package/src/hmr/strategies/js-hmr-strategy.js +178 -0
- package/src/index.browser.d.ts +3 -0
- package/src/index.browser.js +4 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +10 -0
- package/src/integrations/ghtml/ghtml-renderer.d.ts +15 -0
- package/src/integrations/ghtml/ghtml-renderer.js +62 -0
- package/src/integrations/ghtml/ghtml.plugin.d.ts +20 -0
- package/src/integrations/ghtml/ghtml.plugin.js +21 -0
- package/src/internal-types.d.ts +221 -0
- package/src/internal-types.js +0 -0
- package/src/plugins/alias-resolver-plugin.d.ts +2 -0
- package/src/plugins/alias-resolver-plugin.js +53 -0
- package/src/plugins/eco-component-meta-plugin.d.ts +97 -0
- package/src/plugins/eco-component-meta-plugin.js +157 -0
- package/src/plugins/integration-plugin.d.ts +136 -0
- package/src/plugins/integration-plugin.js +133 -0
- package/src/plugins/processor.d.ts +95 -0
- package/src/plugins/processor.js +136 -0
- package/src/plugins/runtime-capability.d.ts +9 -0
- package/src/plugins/runtime-capability.js +0 -0
- package/src/public-types.d.ts +1149 -0
- package/src/public-types.js +0 -0
- package/src/route-renderer/component-graph/component-graph-executor.d.ts +32 -0
- package/src/route-renderer/component-graph/component-graph-executor.js +31 -0
- package/src/route-renderer/component-graph/component-graph.d.ts +42 -0
- package/src/route-renderer/component-graph/component-graph.js +72 -0
- package/src/route-renderer/component-graph/component-marker.d.ts +52 -0
- package/src/route-renderer/component-graph/component-marker.js +46 -0
- package/src/route-renderer/component-graph/component-reference.d.ts +10 -0
- package/src/route-renderer/component-graph/component-reference.js +19 -0
- package/src/route-renderer/component-graph/marker-graph-resolver.d.ts +77 -0
- package/src/route-renderer/component-graph/marker-graph-resolver.js +95 -0
- package/src/route-renderer/orchestration/integration-renderer.d.ts +372 -0
- package/src/route-renderer/orchestration/integration-renderer.js +589 -0
- package/src/route-renderer/orchestration/render-execution.service.d.ts +103 -0
- package/src/route-renderer/orchestration/render-execution.service.js +121 -0
- package/src/route-renderer/orchestration/render-preparation.service.d.ts +121 -0
- package/src/route-renderer/orchestration/render-preparation.service.js +332 -0
- package/src/route-renderer/page-loading/dependency-resolver.d.ts +35 -0
- package/src/route-renderer/page-loading/dependency-resolver.js +442 -0
- package/src/route-renderer/page-loading/page-module-loader.d.ts +87 -0
- package/src/route-renderer/page-loading/page-module-loader.js +124 -0
- package/src/route-renderer/route-renderer.d.ts +61 -0
- package/src/route-renderer/route-renderer.js +87 -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/server/fs-router-scanner.d.ts +41 -0
- package/src/router/server/fs-router-scanner.js +156 -0
- package/src/router/server/fs-router.d.ts +26 -0
- package/src/router/server/fs-router.js +100 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.d.ts +120 -0
- package/src/services/assets/asset-processing-service/asset-processing.service.js +331 -0
- package/src/services/assets/asset-processing-service/asset.factory.d.ts +17 -0
- package/src/services/assets/asset-processing-service/asset.factory.js +82 -0
- package/src/services/assets/asset-processing-service/assets.types.d.ts +89 -0
- package/src/services/assets/asset-processing-service/assets.types.js +0 -0
- 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/assets/asset-processing-service/processor.interface.d.ts +22 -0
- package/src/services/assets/asset-processing-service/processor.interface.js +6 -0
- package/src/services/assets/asset-processing-service/processor.registry.d.ts +8 -0
- package/src/services/assets/asset-processing-service/processor.registry.js +15 -0
- package/src/services/assets/asset-processing-service/processors/base/base-processor.d.ts +24 -0
- package/src/services/assets/asset-processing-service/processors/base/base-processor.js +64 -0
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.d.ts +17 -0
- package/src/services/assets/asset-processing-service/processors/base/base-script-processor.js +72 -0
- 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/assets/asset-processing-service/processors/script/content-script.processor.d.ts +5 -0
- package/src/services/assets/asset-processing-service/processors/script/content-script.processor.js +57 -0
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.d.ts +8 -0
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.js +76 -0
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.d.ts +7 -0
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.js +75 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.d.ts +5 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.js +25 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.d.ts +9 -0
- package/src/services/assets/asset-processing-service/processors/stylesheet/file-stylesheet.processor.js +66 -0
- package/src/services/assets/browser-bundle.service.d.ts +32 -0
- package/src/services/assets/browser-bundle.service.js +33 -0
- package/src/services/cache/cache.types.d.ts +107 -0
- package/src/services/cache/cache.types.js +0 -0
- package/src/services/cache/index.d.ts +7 -0
- package/src/services/cache/index.js +7 -0
- package/src/services/cache/memory-cache-store.d.ts +42 -0
- package/src/services/cache/memory-cache-store.js +98 -0
- package/src/services/cache/page-cache-service.d.ts +70 -0
- package/src/services/cache/page-cache-service.js +152 -0
- package/src/services/cache/page-request-cache-coordinator.service.d.ts +75 -0
- package/src/services/cache/page-request-cache-coordinator.service.js +109 -0
- package/src/services/html/html-rewriter-provider.service.d.ts +37 -0
- package/src/services/html/html-rewriter-provider.service.js +65 -0
- package/src/services/html/html-transformer.service.d.ts +77 -0
- package/src/services/html/html-transformer.service.js +221 -0
- package/src/services/invalidation/development-invalidation.service.d.ts +74 -0
- package/src/services/invalidation/development-invalidation.service.js +189 -0
- package/src/services/module-loading/app-server-module-transpiler.service.d.ts +16 -0
- package/src/services/module-loading/app-server-module-transpiler.service.js +34 -0
- package/src/services/module-loading/page-module-import.service.d.ts +71 -0
- package/src/services/module-loading/page-module-import.service.js +132 -0
- package/src/services/module-loading/server-loader.service.d.ts +96 -0
- package/src/services/module-loading/server-loader.service.js +32 -0
- package/src/services/module-loading/server-module-transpiler.service.d.ts +69 -0
- package/src/services/module-loading/server-module-transpiler.service.js +61 -0
- package/src/services/runtime-manifest/node-runtime-manifest.service.d.ts +35 -0
- package/src/services/runtime-manifest/node-runtime-manifest.service.js +60 -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/validation/schema-validation-service.d.ts +122 -0
- package/src/services/validation/schema-validation-service.js +101 -0
- package/src/services/validation/standard-schema.types.d.ts +65 -0
- package/src/services/validation/standard-schema.types.js +0 -0
- package/src/static-site-generator/static-site-generator.d.ts +109 -0
- package/src/static-site-generator/static-site-generator.js +353 -0
- package/src/utils/css.d.ts +1 -0
- package/src/utils/css.js +7 -0
- package/src/utils/deep-merge.d.ts +14 -0
- package/src/utils/deep-merge.js +32 -0
- package/src/utils/hash.d.ts +1 -0
- package/src/utils/hash.js +7 -0
- package/src/utils/html.d.ts +1 -0
- package/src/utils/html.js +4 -0
- package/src/utils/invariant.d.ts +5 -0
- package/src/utils/invariant.js +11 -0
- package/src/utils/locals-utils.d.ts +15 -0
- package/src/utils/locals-utils.js +24 -0
- package/src/utils/parse-cli-args.d.ts +24 -0
- package/src/utils/parse-cli-args.js +47 -0
- package/src/utils/path-utils.module.d.ts +5 -0
- package/src/utils/path-utils.module.js +14 -0
- package/src/utils/resolve-work-dir.d.ts +11 -0
- package/src/utils/resolve-work-dir.js +31 -0
- package/src/utils/runtime.d.ts +11 -0
- package/src/utils/runtime.js +40 -0
- package/src/utils/server-utils.module.d.ts +19 -0
- package/src/utils/server-utils.module.js +56 -0
- package/src/watchers/project-watcher.d.ts +136 -0
- package/src/watchers/project-watcher.js +281 -0
- package/src/watchers/project-watcher.test-helpers.d.ts +4 -0
- package/src/watchers/project-watcher.test-helpers.js +52 -0
- package/src/adapters/bun/hmr-manager.test.ts +0 -267
- package/src/adapters/node/bootstrap-dependency-resolver.test.ts +0 -282
- package/src/adapters/node/node-client-bridge.test.ts +0 -198
- package/src/adapters/node/node-hmr-manager.test.ts +0 -322
- package/src/adapters/node/runtime-adapter.test.ts +0 -868
- package/src/adapters/node/static-content-server.test.ts +0 -60
- package/src/adapters/shared/api-response.test.ts +0 -97
- package/src/adapters/shared/explicit-static-route-matcher.test.ts +0 -381
- package/src/adapters/shared/file-route-middleware-pipeline.test.ts +0 -90
- package/src/adapters/shared/fs-server-response-factory.test.ts +0 -187
- package/src/adapters/shared/fs-server-response-matcher.test.ts +0 -286
- package/src/adapters/shared/hmr-manager.contract.test.ts +0 -196
- package/src/adapters/shared/hmr-manager.dispatch.test.ts +0 -220
- package/src/adapters/shared/render-context.test.ts +0 -146
- package/src/adapters/shared/server-adapter.test.ts +0 -77
- package/src/adapters/shared/server-route-handler.test.ts +0 -110
- package/src/adapters/shared/server-static-builder.test.ts +0 -316
- package/src/build/build-adapter-serialization.test.ts +0 -268
- package/src/build/build-adapter.test.ts +0 -815
- package/src/build/runtime-specifier-alias-plugin.test.ts +0 -43
- package/src/config/config-builder.test.ts +0 -410
- package/src/eco/eco.test.ts +0 -678
- package/src/eco/eco.utils.test.ts +0 -124
- package/src/eco/global-injector-map.test.ts +0 -42
- package/src/eco/lazy-injector-map.test.ts +0 -66
- package/src/eco/module-dependencies.test.ts +0 -30
- package/src/errors/http-error.test.ts +0 -134
- package/src/global/utils.test.ts +0 -12
- 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/hmr-strategy.test.ts +0 -124
- package/src/hmr/strategies/js-hmr-strategy.test.ts +0 -335
- package/src/integrations/ghtml/ghtml-renderer.test.ts +0 -63
- package/src/plugins/alias-resolver-plugin.test.ts +0 -41
- package/src/plugins/eco-component-meta-plugin.test.ts +0 -380
- package/src/plugins/integration-plugin.test.ts +0 -111
- package/src/plugins/processor.test.ts +0 -148
- package/src/route-renderer/component-graph/component-graph-executor.test.ts +0 -41
- package/src/route-renderer/component-graph/component-graph.test.ts +0 -63
- package/src/route-renderer/component-graph/component-marker.test.ts +0 -73
- package/src/route-renderer/component-graph/marker-graph-resolver.test.ts +0 -135
- package/src/route-renderer/orchestration/integration-renderer.test.ts +0 -936
- package/src/route-renderer/orchestration/render-execution.service.test.ts +0 -97
- package/src/route-renderer/orchestration/render-preparation.service.test.ts +0 -235
- package/src/route-renderer/page-loading/dependency-resolver.test.ts +0 -345
- package/src/route-renderer/page-loading/page-module-loader.test.ts +0 -96
- package/src/router/client/navigation-coordinator.test.ts +0 -237
- package/src/router/server/fs-router-scanner.test.ts +0 -83
- package/src/router/server/fs-router.test.ts +0 -214
- package/src/services/assets/asset-processing-service/asset-processing.service.test.ts +0 -385
- package/src/services/assets/asset-processing-service/asset.factory.test.ts +0 -63
- package/src/services/assets/asset-processing-service/browser-runtime-asset.factory.test.ts +0 -72
- package/src/services/assets/asset-processing-service/browser-runtime-entry.factory.test.ts +0 -67
- package/src/services/assets/asset-processing-service/processors/base/base-processor.test.ts +0 -59
- package/src/services/assets/asset-processing-service/processors/script/file-script.processor.test.ts +0 -286
- package/src/services/assets/asset-processing-service/processors/script/node-module-script.processor.test.ts +0 -227
- package/src/services/assets/asset-processing-service/processors/stylesheet/content-stylesheet.processor.test.ts +0 -199
- package/src/services/assets/browser-bundle.service.test.ts +0 -36
- package/src/services/cache/memory-cache-store.test.ts +0 -225
- package/src/services/cache/page-cache-service.test.ts +0 -175
- package/src/services/cache/page-request-cache-coordinator.service.test.ts +0 -79
- package/src/services/html/html-rewriter-provider.service.test.ts +0 -183
- package/src/services/html/html-transformer.service.test.ts +0 -378
- package/src/services/invalidation/development-invalidation.service.test.ts +0 -77
- package/src/services/module-loading/page-module-import.service.test.ts +0 -253
- package/src/services/module-loading/server-loader.service.test.ts +0 -161
- package/src/services/module-loading/server-module-transpiler.service.test.ts +0 -115
- package/src/services/runtime-manifest/node-runtime-manifest.service.test.ts +0 -95
- package/src/services/validation/schema-validation-service.test.ts +0 -223
- package/src/static-site-generator/static-site-generator.test.ts +0 -307
- package/src/utils/deep-merge.test.ts +0 -114
- package/src/utils/invariant.test.ts +0 -22
- package/src/utils/path-utils.test.ts +0 -15
- package/src/utils/server-utils.test.ts +0 -38
- package/src/watchers/project-watcher.integration.test.ts +0 -337
- package/src/watchers/project-watcher.test.ts +0 -678
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../../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,122 @@
|
|
|
1
|
+
import type { StandardSchema } from './standard-schema.types.js';
|
|
2
|
+
export interface ValidationResult<T = unknown> {
|
|
3
|
+
success: boolean;
|
|
4
|
+
data?: T;
|
|
5
|
+
errors?: Array<{
|
|
6
|
+
message: string;
|
|
7
|
+
path?: Array<string | number>;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface ValidationSource {
|
|
11
|
+
body?: unknown;
|
|
12
|
+
query?: Record<string, string>;
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
params?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface ValidationSchemas {
|
|
17
|
+
body?: StandardSchema;
|
|
18
|
+
query?: StandardSchema;
|
|
19
|
+
headers?: StandardSchema;
|
|
20
|
+
params?: StandardSchema;
|
|
21
|
+
}
|
|
22
|
+
export interface ValidatedData {
|
|
23
|
+
body?: unknown;
|
|
24
|
+
query?: unknown;
|
|
25
|
+
headers?: unknown;
|
|
26
|
+
params?: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Service for validating request data using Standard Schema compliant validators.
|
|
30
|
+
*
|
|
31
|
+
* This service provides a unified interface for validating HTTP request data (body, query parameters, headers)
|
|
32
|
+
* using any validation library that implements the Standard Schema specification.
|
|
33
|
+
*
|
|
34
|
+
* @example Using with Zod
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { z } from 'zod';
|
|
37
|
+
* import { SchemaValidationService } from './schema-validation-service.js';
|
|
38
|
+
*
|
|
39
|
+
* const service = new SchemaValidationService();
|
|
40
|
+
* const result = await service.validateRequest(
|
|
41
|
+
* { body: { title: 'Hello', count: 42 } },
|
|
42
|
+
* { body: z.object({ title: z.string(), count: z.number() }) }
|
|
43
|
+
* );
|
|
44
|
+
*
|
|
45
|
+
* if (result.success) {
|
|
46
|
+
* console.log(result.data.body);
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Using with Valibot
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import * as v from 'valibot';
|
|
53
|
+
*
|
|
54
|
+
* const result = await service.validateRequest(
|
|
55
|
+
* { query: { page: '1' } },
|
|
56
|
+
* { query: v.object({ page: v.string() }) }
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Using with ArkType
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { type } from 'arktype';
|
|
63
|
+
*
|
|
64
|
+
* const result = await service.validateRequest(
|
|
65
|
+
* { headers: { 'authorization': 'Bearer token' } },
|
|
66
|
+
* { headers: type({ authorization: 'string' }) }
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example Multiple sources
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const result = await service.validateRequest(
|
|
73
|
+
* {
|
|
74
|
+
* body: { title: 'Post' },
|
|
75
|
+
* query: { format: 'json' },
|
|
76
|
+
* headers: { 'content-type': 'application/json' }
|
|
77
|
+
* },
|
|
78
|
+
* {
|
|
79
|
+
* body: z.object({ title: z.string() }),
|
|
80
|
+
* query: v.object({ format: v.string() }),
|
|
81
|
+
* headers: type({ 'content-type': 'string' })
|
|
82
|
+
* }
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* Supported libraries: Zod, Valibot, ArkType, Effect Schema (with standardSchemaV1 wrapper)
|
|
87
|
+
*/
|
|
88
|
+
export declare class SchemaValidationService {
|
|
89
|
+
/**
|
|
90
|
+
* Validates request data against provided schemas.
|
|
91
|
+
*
|
|
92
|
+
* Validates body, query parameters, and headers against their respective schemas.
|
|
93
|
+
* All validations are performed, and errors are aggregated from all sources.
|
|
94
|
+
*
|
|
95
|
+
* @param source - The data to validate (body, query, headers)
|
|
96
|
+
* @param schemas - The Standard Schema validators for each source
|
|
97
|
+
* @returns Validation result with validated data or aggregated errors
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const result = await service.validateRequest(
|
|
102
|
+
* { body: { name: 'John', age: 30 } },
|
|
103
|
+
* { body: z.object({ name: z.string(), age: z.number() }) }
|
|
104
|
+
* );
|
|
105
|
+
*
|
|
106
|
+
* if (result.success) {
|
|
107
|
+
* const validated = result.data.body;
|
|
108
|
+
* } else {
|
|
109
|
+
* console.error(result.errors);
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
validateRequest(source: ValidationSource, schemas: ValidationSchemas): Promise<ValidationResult<ValidatedData>>;
|
|
114
|
+
/**
|
|
115
|
+
* Validates a single value against a Standard Schema.
|
|
116
|
+
*
|
|
117
|
+
* @param schema - The Standard Schema validator
|
|
118
|
+
* @param data - The data to validate
|
|
119
|
+
* @returns Validation result with validated data or errors
|
|
120
|
+
*/
|
|
121
|
+
private validateWithSchema;
|
|
122
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
class SchemaValidationService {
|
|
2
|
+
/**
|
|
3
|
+
* Validates request data against provided schemas.
|
|
4
|
+
*
|
|
5
|
+
* Validates body, query parameters, and headers against their respective schemas.
|
|
6
|
+
* All validations are performed, and errors are aggregated from all sources.
|
|
7
|
+
*
|
|
8
|
+
* @param source - The data to validate (body, query, headers)
|
|
9
|
+
* @param schemas - The Standard Schema validators for each source
|
|
10
|
+
* @returns Validation result with validated data or aggregated errors
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const result = await service.validateRequest(
|
|
15
|
+
* { body: { name: 'John', age: 30 } },
|
|
16
|
+
* { body: z.object({ name: z.string(), age: z.number() }) }
|
|
17
|
+
* );
|
|
18
|
+
*
|
|
19
|
+
* if (result.success) {
|
|
20
|
+
* const validated = result.data.body;
|
|
21
|
+
* } else {
|
|
22
|
+
* console.error(result.errors);
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
async validateRequest(source, schemas) {
|
|
27
|
+
const validated = {};
|
|
28
|
+
const allErrors = [];
|
|
29
|
+
if (schemas.body && source.body !== void 0) {
|
|
30
|
+
const result = await this.validateWithSchema(schemas.body, source.body);
|
|
31
|
+
if (!result.success) {
|
|
32
|
+
allErrors.push(...result.errors || []);
|
|
33
|
+
} else {
|
|
34
|
+
validated.body = result.data;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (schemas.query && source.query) {
|
|
38
|
+
const result = await this.validateWithSchema(schemas.query, source.query);
|
|
39
|
+
if (!result.success) {
|
|
40
|
+
allErrors.push(...result.errors || []);
|
|
41
|
+
} else {
|
|
42
|
+
validated.query = result.data;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (schemas.headers && source.headers) {
|
|
46
|
+
const result = await this.validateWithSchema(schemas.headers, source.headers);
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
allErrors.push(...result.errors || []);
|
|
49
|
+
} else {
|
|
50
|
+
validated.headers = result.data;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (schemas.params && source.params) {
|
|
54
|
+
const result = await this.validateWithSchema(schemas.params, source.params);
|
|
55
|
+
if (!result.success) {
|
|
56
|
+
allErrors.push(...result.errors || []);
|
|
57
|
+
} else {
|
|
58
|
+
validated.params = result.data;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (allErrors.length > 0) {
|
|
62
|
+
return { success: false, errors: allErrors };
|
|
63
|
+
}
|
|
64
|
+
return { success: true, data: validated };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates a single value against a Standard Schema.
|
|
68
|
+
*
|
|
69
|
+
* @param schema - The Standard Schema validator
|
|
70
|
+
* @param data - The data to validate
|
|
71
|
+
* @returns Validation result with validated data or errors
|
|
72
|
+
*/
|
|
73
|
+
async validateWithSchema(schema, data) {
|
|
74
|
+
try {
|
|
75
|
+
const resultOrPromise = schema["~standard"].validate(data);
|
|
76
|
+
const result = resultOrPromise instanceof Promise ? await resultOrPromise : resultOrPromise;
|
|
77
|
+
if (result.issues) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
errors: result.issues.map((issue) => ({
|
|
81
|
+
message: issue.message,
|
|
82
|
+
path: issue.path?.map((p) => typeof p === "object" && "key" in p ? p.key : p)
|
|
83
|
+
}))
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return { success: true, data: result.value };
|
|
87
|
+
} catch (error) {
|
|
88
|
+
return {
|
|
89
|
+
success: false,
|
|
90
|
+
errors: [
|
|
91
|
+
{
|
|
92
|
+
message: error instanceof Error ? error.message : "Validation failed"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
SchemaValidationService
|
|
101
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Schema interface for universal validation.
|
|
3
|
+
* Compatible with Zod, Valibot, ArkType, Effect Schema, and other validation libraries.
|
|
4
|
+
*
|
|
5
|
+
* @see https://standardschema.dev
|
|
6
|
+
*
|
|
7
|
+
* @example Using with Zod
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { z } from 'zod';
|
|
10
|
+
*
|
|
11
|
+
* const bodySchema = z.object({
|
|
12
|
+
* title: z.string().min(1),
|
|
13
|
+
* content: z.string()
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* app.post('/posts', async (ctx) => {
|
|
17
|
+
* const { title, content } = ctx.body;
|
|
18
|
+
* return ctx.json({ id: 1, title, content });
|
|
19
|
+
* }, {
|
|
20
|
+
* schema: { body: bodySchema }
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface StandardSchema<Input = unknown, Output = Input> {
|
|
25
|
+
readonly '~standard': {
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
readonly vendor: string;
|
|
28
|
+
readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
29
|
+
readonly types?: {
|
|
30
|
+
readonly input: Input;
|
|
31
|
+
readonly output: Output;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Result of Standard Schema validation.
|
|
37
|
+
*/
|
|
38
|
+
export type StandardSchemaResult<Output> = StandardSchemaSuccessResult<Output> | StandardSchemaFailureResult;
|
|
39
|
+
/**
|
|
40
|
+
* Successful validation result.
|
|
41
|
+
*/
|
|
42
|
+
export interface StandardSchemaSuccessResult<Output> {
|
|
43
|
+
readonly value: Output;
|
|
44
|
+
readonly issues?: undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Failed validation result.
|
|
48
|
+
*/
|
|
49
|
+
export interface StandardSchemaFailureResult {
|
|
50
|
+
readonly value?: undefined;
|
|
51
|
+
readonly issues: ReadonlyArray<StandardSchemaIssue>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validation issue details.
|
|
55
|
+
*/
|
|
56
|
+
export interface StandardSchemaIssue {
|
|
57
|
+
readonly message: string;
|
|
58
|
+
readonly path?: ReadonlyArray<PropertyKey | {
|
|
59
|
+
key: PropertyKey;
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Infers the output type from a Standard Schema.
|
|
64
|
+
*/
|
|
65
|
+
export type InferOutput<T extends StandardSchema> = T extends StandardSchema<any, infer O> ? O : never;
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { EcoPagesAppConfig } from '../internal-types.js';
|
|
2
|
+
import type { StaticRoute } from '../public-types.js';
|
|
3
|
+
import type { RouteRendererFactory } from '../route-renderer/route-renderer.js';
|
|
4
|
+
import type { FSRouter } from '../router/server/fs-router.js';
|
|
5
|
+
export declare const STATIC_SITE_GENERATOR_ERRORS: {
|
|
6
|
+
readonly ROUTE_RENDERER_FACTORY_REQUIRED: "RouteRendererFactory is required for render strategy";
|
|
7
|
+
readonly unsupportedBodyType: (bodyType: string) => string;
|
|
8
|
+
readonly missingIntegration: (routePath: string) => string;
|
|
9
|
+
readonly noRendererForIntegration: (integrationName: string) => string;
|
|
10
|
+
readonly dynamicRouteRequiresStaticPaths: (routePath: string) => string;
|
|
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
|
+
*/
|
|
21
|
+
export declare class StaticSiteGenerator {
|
|
22
|
+
appConfig: EcoPagesAppConfig;
|
|
23
|
+
private serverModuleTranspiler;
|
|
24
|
+
/**
|
|
25
|
+
* Creates the static-site generator for one app config.
|
|
26
|
+
*/
|
|
27
|
+
constructor({ appConfig }: {
|
|
28
|
+
appConfig: EcoPagesAppConfig;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Returns the transpiler output directory used for static page-module probes.
|
|
32
|
+
*/
|
|
33
|
+
private getStaticPageModuleOutdir;
|
|
34
|
+
private getExportDir;
|
|
35
|
+
/**
|
|
36
|
+
* Logs the standardized warning emitted when a dynamic-cache page is skipped.
|
|
37
|
+
*/
|
|
38
|
+
private warnDynamicPageSkipped;
|
|
39
|
+
/**
|
|
40
|
+
* Determines whether one filesystem-discovered page should be excluded from
|
|
41
|
+
* static generation.
|
|
42
|
+
*/
|
|
43
|
+
private shouldSkipStaticPageFile;
|
|
44
|
+
/**
|
|
45
|
+
* Determines whether one explicit static route view should be excluded from
|
|
46
|
+
* static generation.
|
|
47
|
+
*/
|
|
48
|
+
private shouldSkipStaticView;
|
|
49
|
+
/**
|
|
50
|
+
* Writes the robots.txt file declared by the app config.
|
|
51
|
+
*/
|
|
52
|
+
generateRobotsTxt(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Returns whether the input path points at the root directory.
|
|
55
|
+
*/
|
|
56
|
+
isRootDir(path: string): boolean | null;
|
|
57
|
+
/**
|
|
58
|
+
* Collects parent directories that must exist for the generated route set.
|
|
59
|
+
*/
|
|
60
|
+
getDirectories(routes: string[]): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Extracts dynamic parameters from the actual path based on the template path.
|
|
63
|
+
*
|
|
64
|
+
* @param templatePath - The template path (e.g., "/blog/[slug]")
|
|
65
|
+
* @param actualPath - The actual path (e.g., "/blog/my-post")
|
|
66
|
+
* @returns A record of extracted parameters (e.g., { slug: "my-post" })
|
|
67
|
+
*/
|
|
68
|
+
private extractParams;
|
|
69
|
+
/**
|
|
70
|
+
* Generates static output for all filesystem-discovered routes.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Routes whose integrations opt into fetch-based static builds are rendered by
|
|
74
|
+
* issuing a request against the running server origin. Render-strategy routes
|
|
75
|
+
* go through the normal route renderer directly.
|
|
76
|
+
*/
|
|
77
|
+
generateStaticPages(router: FSRouter, baseUrl: string, routeRendererFactory?: RouteRendererFactory): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Executes the full static-generation workflow for one app run.
|
|
80
|
+
*/
|
|
81
|
+
run({ router, baseUrl, routeRendererFactory, staticRoutes, }: {
|
|
82
|
+
router: FSRouter;
|
|
83
|
+
baseUrl: string;
|
|
84
|
+
routeRendererFactory?: RouteRendererFactory;
|
|
85
|
+
staticRoutes?: StaticRoute[];
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Generates static pages from explicit static routes registered via app.static().
|
|
89
|
+
* These routes use eco.page views via loader functions for HMR support.
|
|
90
|
+
*/
|
|
91
|
+
private generateExplicitStaticPages;
|
|
92
|
+
/**
|
|
93
|
+
* Generate a single static page for a non-dynamic route.
|
|
94
|
+
*/
|
|
95
|
+
private generateSingleStaticRoute;
|
|
96
|
+
/**
|
|
97
|
+
* Generate static pages for a dynamic route using staticPaths.
|
|
98
|
+
*/
|
|
99
|
+
private generateDynamicStaticRoute;
|
|
100
|
+
/**
|
|
101
|
+
* Resolve a route path template with actual params.
|
|
102
|
+
* Supports both :param and [param] syntax.
|
|
103
|
+
*/
|
|
104
|
+
private resolveRoutePath;
|
|
105
|
+
/**
|
|
106
|
+
* Get the output file path for a given route.
|
|
107
|
+
*/
|
|
108
|
+
private getOutputPath;
|
|
109
|
+
}
|