astro 6.0.0-alpha.0 → 6.0.0-alpha.2
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/astro-jsx.d.ts +11 -0
- package/client.d.ts +17 -41
- package/components/Code.astro +2 -2
- package/components/Image.astro +2 -2
- package/components/Picture.astro +1 -1
- package/dist/actions/consts.d.ts +2 -5
- package/dist/actions/consts.js +4 -8
- package/dist/actions/integration.js +2 -4
- package/dist/actions/runtime/client.d.ts +84 -3
- package/dist/actions/runtime/client.js +238 -7
- package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
- package/dist/actions/runtime/entrypoints/client.js +91 -0
- package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
- package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
- package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
- package/dist/actions/runtime/entrypoints/server.js +33 -0
- package/dist/actions/runtime/server.d.ts +11 -18
- package/dist/actions/runtime/server.js +162 -82
- package/dist/actions/runtime/types.d.ts +64 -0
- package/dist/actions/utils.d.ts +2 -2
- package/dist/actions/utils.js +2 -2
- package/dist/actions/vite-plugin-actions.js +58 -47
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/build/generate.js +12 -10
- package/dist/assets/consts.d.ts +1 -0
- package/dist/assets/consts.js +2 -0
- package/dist/assets/endpoint/config.js +2 -2
- package/dist/assets/endpoint/dev.js +7 -6
- package/dist/assets/fonts/config.d.ts +91 -350
- package/dist/assets/fonts/config.js +35 -136
- package/dist/assets/fonts/constants.js +1 -1
- package/dist/assets/fonts/core/dedupe-font-faces.d.ts +2 -0
- package/dist/assets/fonts/core/dedupe-font-faces.js +30 -0
- package/dist/assets/fonts/definitions.d.ts +9 -22
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +8 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.js +20 -0
- package/dist/assets/fonts/infra/build-url-resolver.d.ts +12 -0
- package/dist/assets/fonts/infra/build-url-resolver.js +40 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.d.ts +11 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.js +42 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.d.ts +18 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +71 -0
- package/dist/assets/fonts/infra/data-collector.d.ts +10 -0
- package/dist/assets/fonts/infra/data-collector.js +35 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +14 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.js +37 -0
- package/dist/assets/fonts/infra/dev-url-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/dev-url-resolver.js +29 -0
- package/dist/assets/fonts/infra/font-type-extractor.d.ts +5 -0
- package/dist/assets/fonts/infra/font-type-extractor.js +21 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.d.ts +11 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.js +25 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.d.ts +5 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.js +145 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.js +14 -0
- package/dist/assets/fonts/{implementations/css-renderer.d.ts → infra/minifiable-css-renderer.d.ts} +8 -3
- package/dist/assets/fonts/{implementations/css-renderer.js → infra/minifiable-css-renderer.js} +12 -10
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/remote-font-provider-resolver.js +49 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.js +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +22 -0
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +6 -0
- package/dist/assets/fonts/{implementations → infra}/system-fallbacks-provider.js +8 -11
- package/dist/assets/fonts/infra/unstorage-fs-storage.d.ts +11 -0
- package/dist/assets/fonts/infra/unstorage-fs-storage.js +26 -0
- package/dist/assets/fonts/infra/url-proxy.d.ts +16 -0
- package/dist/assets/fonts/infra/url-proxy.js +50 -0
- package/dist/assets/fonts/infra/xxhash-hasher.d.ts +7 -0
- package/dist/assets/fonts/infra/xxhash-hasher.js +18 -0
- package/dist/assets/fonts/orchestrate.d.ts +1 -2
- package/dist/assets/fonts/orchestrate.js +50 -17
- package/dist/assets/fonts/providers/index.d.ts +6 -24
- package/dist/assets/fonts/types.d.ts +138 -8
- package/dist/assets/fonts/utils.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +66 -65
- package/dist/assets/services/noop.js +11 -1
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +55 -51
- package/dist/assets/types.d.ts +2 -2
- package/dist/assets/utils/index.d.ts +1 -3
- package/dist/assets/utils/index.js +4 -9
- package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
- package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -6
- package/dist/assets/utils/svg.d.ts +2 -1
- package/dist/assets/utils/svg.js +30 -4
- package/dist/assets/vite-plugin-assets.js +36 -19
- package/dist/cli/add/index.js +21 -13
- package/dist/cli/create-key/infra/crypto-key-generator.d.ts +3 -1
- package/dist/cli/create-key/infra/crypto-key-generator.js +7 -9
- package/dist/cli/definitions.d.ts +19 -2
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/docs/core/open-docs.d.ts +5 -3
- package/dist/cli/docs/core/open-docs.js +2 -9
- package/dist/cli/docs/definitions.d.ts +3 -11
- package/dist/cli/docs/domain/cloud-ide.d.ts +1 -0
- package/dist/cli/docs/domain/cloud-ide.js +0 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.d.ts +5 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.js +6 -0
- package/dist/cli/flags.d.ts +1 -0
- package/dist/cli/index.js +78 -21
- package/dist/cli/info/core/get-package-manager.d.ts +8 -0
- package/dist/cli/info/core/get-package-manager.js +37 -0
- package/dist/cli/info/core/info.d.ts +21 -0
- package/dist/cli/info/core/info.js +21 -0
- package/dist/cli/info/definitions.d.ts +30 -0
- package/dist/cli/info/definitions.js +0 -0
- package/dist/cli/info/domain/debug-info.d.ts +1 -0
- package/dist/cli/info/domain/debug-info.js +0 -0
- package/dist/cli/info/infra/bun-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/bun-package-manager.js +9 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.d.ts +10 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.js +36 -0
- package/dist/cli/info/infra/cli-clipboard.d.ts +13 -0
- package/dist/cli/info/infra/cli-clipboard.js +78 -0
- package/dist/cli/info/infra/cli-debug-info-provider.d.ts +15 -0
- package/dist/cli/info/infra/cli-debug-info-provider.js +57 -0
- package/dist/cli/info/infra/dev-debug-info-provider.d.ts +18 -0
- package/dist/cli/info/infra/dev-debug-info-provider.js +36 -0
- package/dist/cli/info/infra/noop-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/noop-package-manager.js +9 -0
- package/dist/cli/info/infra/npm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/npm-package-manager.js +32 -0
- package/dist/cli/info/infra/pnpm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/pnpm-package-manager.js +33 -0
- package/dist/cli/info/infra/process-node-version-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-node-version-provider.js +6 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.js +7 -0
- package/dist/cli/info/infra/prompts-prompt.d.ts +11 -0
- package/dist/cli/info/infra/prompts-prompt.js +25 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.d.ts +10 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.js +29 -0
- package/dist/cli/info/infra/yarn-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/yarn-package-manager.js +34 -0
- package/dist/cli/infra/build-time-astro-version-provider.d.ts +3 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +4 -8
- package/dist/cli/infra/cli-command-runner.d.ts +7 -4
- package/dist/cli/infra/cli-command-runner.js +14 -10
- package/dist/cli/infra/logger-help-display.d.ts +11 -7
- package/dist/cli/infra/logger-help-display.js +62 -50
- package/dist/cli/infra/passthrough-text-styler.d.ts +9 -0
- package/dist/cli/infra/passthrough-text-styler.js +23 -0
- package/dist/cli/infra/piccolore-text-styler.d.ts +2 -0
- package/dist/cli/infra/piccolore-text-styler.js +5 -0
- package/dist/cli/infra/process-operating-system-provider.d.ts +6 -0
- package/dist/cli/infra/process-operating-system-provider.js +12 -0
- package/dist/cli/infra/tinyexec-command-executor.d.ts +6 -0
- package/dist/cli/infra/tinyexec-command-executor.js +34 -0
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preferences/index.js +6 -2
- package/dist/cli/preview/index.js +1 -1
- package/dist/cli/utils/format-version.js +1 -1
- package/dist/config/index.js +9 -5
- package/dist/container/index.js +19 -13
- package/dist/container/pipeline.d.ts +2 -1
- package/dist/container/pipeline.js +4 -11
- package/dist/container/vite-plugin-container.js +7 -4
- package/dist/content/config.d.ts +34 -40
- package/dist/content/content-layer.js +13 -18
- package/dist/content/loaders/errors.d.ts +3 -3
- package/dist/content/loaders/errors.js +5 -2
- package/dist/content/loaders/glob.js +6 -1
- package/dist/content/loaders/types.d.ts +11 -4
- package/dist/content/runtime-assets.d.ts +4 -4
- package/dist/content/runtime-assets.js +2 -2
- package/dist/content/runtime.d.ts +21 -20
- package/dist/content/runtime.js +14 -16
- package/dist/content/types-generator.js +90 -54
- package/dist/content/utils.d.ts +46 -338
- package/dist/content/utils.js +52 -50
- package/dist/content/vite-plugin-content-assets.d.ts +12 -4
- package/dist/content/vite-plugin-content-assets.js +152 -102
- package/dist/content/vite-plugin-content-imports.js +58 -40
- package/dist/content/vite-plugin-content-virtual-mod.js +95 -77
- package/dist/core/app/app.d.ts +5 -0
- package/dist/core/app/app.js +13 -0
- package/dist/core/app/base.d.ts +132 -0
- package/dist/core/app/base.js +448 -0
- package/dist/core/app/common.d.ts +6 -2
- package/dist/core/app/common.js +60 -33
- package/dist/core/app/dev/app.d.ts +15 -0
- package/dist/core/app/dev/app.js +86 -0
- package/dist/core/app/dev/pipeline.d.ts +13 -0
- package/dist/core/app/dev/pipeline.js +123 -0
- package/dist/core/app/entrypoint.d.ts +2 -0
- package/dist/core/app/entrypoint.js +15 -0
- package/dist/core/app/index.d.ts +7 -99
- package/dist/core/app/index.js +20 -486
- package/dist/core/app/logging.d.ts +3 -0
- package/dist/core/app/logging.js +11 -0
- package/dist/core/app/manifest.d.ts +9 -0
- package/dist/core/app/manifest.js +107 -0
- package/dist/core/app/middlewares.js +1 -1
- package/dist/core/app/node.js +14 -13
- package/dist/core/app/pipeline.d.ts +6 -5
- package/dist/core/app/pipeline.js +65 -49
- package/dist/core/app/types.d.ts +58 -22
- package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
- package/dist/core/app/validate-forwarded-headers.js +60 -0
- package/dist/core/base-pipeline.d.ts +22 -14
- package/dist/core/base-pipeline.js +54 -6
- package/dist/core/build/app.d.ts +13 -0
- package/dist/core/build/app.js +38 -0
- package/dist/core/build/common.d.ts +1 -1
- package/dist/core/build/common.js +2 -2
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +96 -204
- package/dist/core/build/graph.js +2 -2
- package/dist/core/build/index.js +11 -16
- package/dist/core/build/internal.d.ts +2 -27
- package/dist/core/build/internal.js +1 -44
- package/dist/core/build/page-data.js +1 -1
- package/dist/core/build/pipeline.d.ts +15 -26
- package/dist/core/build/pipeline.js +106 -170
- package/dist/core/build/plugins/index.d.ts +4 -2
- package/dist/core/build/plugins/index.js +17 -23
- package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
- package/dist/core/build/plugins/plugin-analyzer.js +5 -13
- package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
- package/dist/core/build/plugins/plugin-component-entry.js +15 -17
- package/dist/core/build/plugins/plugin-css.d.ts +2 -2
- package/dist/core/build/plugins/plugin-css.js +90 -41
- package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
- package/dist/core/build/plugins/plugin-internals.js +24 -18
- package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
- package/dist/core/build/plugins/plugin-manifest.js +89 -129
- package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
- package/dist/core/build/plugins/plugin-middleware.js +5 -7
- package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
- package/dist/core/build/plugins/plugin-noop.js +35 -0
- package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
- package/dist/core/build/plugins/plugin-prerender.js +7 -64
- package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
- package/dist/core/build/plugins/plugin-scripts.js +5 -13
- package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
- package/dist/core/build/plugins/plugin-ssr.js +85 -139
- package/dist/core/build/plugins/util.d.ts +1 -25
- package/dist/core/build/plugins/util.js +0 -47
- package/dist/core/build/runtime.d.ts +26 -0
- package/dist/core/build/runtime.js +45 -0
- package/dist/core/build/static-build.d.ts +2 -2
- package/dist/core/build/static-build.js +181 -155
- package/dist/core/build/types.d.ts +1 -2
- package/dist/core/build/util.d.ts +0 -1
- package/dist/core/build/util.js +0 -7
- package/dist/core/compile/compile.d.ts +2 -3
- package/dist/core/compile/compile.js +2 -2
- package/dist/core/config/config.js +3 -3
- package/dist/core/config/index.d.ts +0 -1
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +336 -1434
- package/dist/core/config/schemas/base.js +42 -41
- package/dist/core/config/schemas/refined.d.ts +2 -2
- package/dist/core/config/schemas/refined.js +1 -1
- package/dist/core/config/schemas/relative.d.ts +672 -1761
- package/dist/core/config/schemas/relative.js +4 -4
- package/dist/core/config/settings.d.ts +3 -3
- package/dist/core/config/settings.js +5 -6
- package/dist/core/config/validate.js +13 -2
- package/dist/core/config/vite-load.js +12 -3
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +20 -1
- package/dist/core/create-vite.d.ts +2 -6
- package/dist/core/create-vite.js +35 -43
- package/dist/core/csp/common.d.ts +1 -1
- package/dist/core/csp/common.js +1 -1
- package/dist/core/csp/config.d.ts +8 -4
- package/dist/core/csp/config.js +1 -1
- package/dist/core/csp/runtime.d.ts +11 -0
- package/dist/core/csp/runtime.js +35 -0
- package/dist/core/dev/container.js +13 -7
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +15 -6
- package/dist/core/errors/dev/runtime.d.ts +6 -0
- package/dist/core/errors/dev/runtime.js +27 -0
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +32 -16
- package/dist/core/errors/errors-data.js +23 -10
- package/dist/core/errors/errors.d.ts +3 -3
- package/dist/core/errors/errors.js +8 -8
- package/dist/core/errors/zod-error-map.d.ts +2 -2
- package/dist/core/errors/zod-error-map.js +26 -24
- package/dist/core/logger/core.js +1 -1
- package/dist/core/messages.d.ts +2 -2
- package/dist/core/messages.js +3 -3
- package/dist/core/middleware/callMiddleware.js +1 -1
- package/dist/core/middleware/defineMiddleware.d.ts +2 -0
- package/dist/core/middleware/defineMiddleware.js +6 -0
- package/dist/core/middleware/index.d.ts +3 -3
- package/dist/core/middleware/index.js +1 -3
- package/dist/core/middleware/sequence.js +4 -4
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +41 -24
- package/dist/core/module-loader/index.d.ts +2 -2
- package/dist/core/module-loader/index.js +1 -1
- package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
- package/dist/core/module-loader/{loader.js → runner.js} +3 -0
- package/dist/core/module-loader/vite.d.ts +3 -2
- package/dist/core/module-loader/vite.js +17 -13
- package/dist/core/preview/index.js +20 -3
- package/dist/core/preview/static-preview-server.js +11 -0
- package/dist/core/redirects/component.js +1 -2
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +1 -3
- package/dist/core/redirects/render.js +5 -2
- package/dist/core/render/paginate.d.ts +1 -1
- package/dist/core/render/paginate.js +8 -6
- package/dist/core/render/params-and-props.d.ts +2 -0
- package/dist/core/render/params-and-props.js +19 -6
- package/dist/core/render/route-cache.d.ts +3 -2
- package/dist/core/render/route-cache.js +6 -5
- package/dist/core/render-context.d.ts +6 -4
- package/dist/core/render-context.js +66 -25
- package/dist/core/routing/astro-designed-error-pages.js +2 -2
- package/dist/core/routing/default.js +1 -1
- package/dist/core/routing/helpers.d.ts +22 -0
- package/dist/core/routing/helpers.js +25 -0
- package/dist/core/routing/index.d.ts +1 -1
- package/dist/core/routing/index.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +6 -1
- package/dist/core/routing/manifest/create.js +11 -14
- package/dist/core/routing/manifest/generator.d.ts +3 -1
- package/dist/core/routing/params.d.ts +2 -1
- package/dist/core/routing/params.js +3 -2
- package/dist/core/server-islands/endpoint.js +40 -19
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +106 -46
- package/dist/core/session/vite-plugin.d.ts +6 -0
- package/dist/core/session/vite-plugin.js +59 -0
- package/dist/core/session.d.ts +4 -2
- package/dist/core/session.js +8 -48
- package/dist/core/sync/index.d.ts +2 -5
- package/dist/core/sync/index.js +34 -22
- package/dist/core/util/pathname.d.ts +10 -0
- package/dist/core/util/pathname.js +17 -0
- package/dist/core/util.d.ts +2 -2
- package/dist/core/util.js +3 -3
- package/dist/core/viteUtils.d.ts +1 -0
- package/dist/core/viteUtils.js +2 -0
- package/dist/entrypoints/legacy.d.ts +2 -0
- package/dist/entrypoints/legacy.js +12 -0
- package/dist/entrypoints/prerender.d.ts +4 -0
- package/dist/entrypoints/prerender.js +7 -0
- package/dist/env/schema.d.ts +21 -251
- package/dist/env/schema.js +6 -3
- package/dist/env/vite-plugin-env.js +61 -42
- package/dist/env/vite-plugin-import-meta-env.js +45 -37
- package/dist/environments.d.ts +3 -0
- package/dist/environments.js +11 -0
- package/dist/events/error.d.ts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -6
- package/dist/i18n/utils.js +1 -63
- package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
- package/dist/i18n/vite-plugin-i18n.js +8 -26
- package/dist/integrations/hooks.d.ts +1 -1
- package/dist/integrations/hooks.js +10 -7
- package/dist/manifest/serialized.d.ts +9 -0
- package/dist/manifest/serialized.js +150 -0
- package/dist/manifest/virtual-module.d.ts +1 -4
- package/dist/manifest/virtual-module.js +100 -91
- package/dist/preferences/index.d.ts +1 -2
- package/dist/prefetch/vite-plugin-prefetch.js +20 -9
- package/dist/prerender/routing.d.ts +5 -7
- package/dist/prerender/routing.js +6 -17
- package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/radio-checkbox.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +2 -2
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/render/server-islands.js +5 -4
- package/dist/runtime/server/transition.d.ts +1 -0
- package/dist/template/4xx.js +3 -1
- package/dist/toolbar/vite-plugin-dev-toolbar.js +13 -7
- package/dist/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/swap-functions.js +4 -0
- package/dist/transitions/vite-plugin-transitions.js +35 -22
- package/dist/types/astro.d.ts +8 -6
- package/dist/types/public/config.d.ts +438 -289
- package/dist/types/public/context.d.ts +3 -4
- package/dist/types/public/extendables.d.ts +2 -0
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +23 -1
- package/dist/types/public/internal.d.ts +1 -16
- package/dist/types/public/preview.d.ts +6 -0
- package/dist/virtual-modules/i18n.d.ts +10 -2
- package/dist/virtual-modules/i18n.js +16 -7
- package/dist/virtual-modules/live-config.d.ts +1 -1
- package/dist/virtual-modules/live-config.js +1 -1
- package/dist/virtual-modules/middleware.d.ts +2 -1
- package/dist/virtual-modules/middleware.js +2 -1
- package/dist/vite-plugin-adapter-config/index.js +12 -5
- package/dist/vite-plugin-app/app.d.ts +47 -0
- package/dist/vite-plugin-app/app.js +410 -0
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
- package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
- package/dist/vite-plugin-app/index.d.ts +3 -0
- package/dist/vite-plugin-app/index.js +19 -0
- package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +6 -7
- package/dist/vite-plugin-app/pipeline.js +166 -0
- package/dist/vite-plugin-astro/index.js +215 -170
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +3 -4
- package/dist/vite-plugin-astro-server/error.js +2 -5
- package/dist/vite-plugin-astro-server/index.d.ts +0 -1
- package/dist/vite-plugin-astro-server/index.js +0 -2
- package/dist/vite-plugin-astro-server/metadata.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +3 -7
- package/dist/vite-plugin-astro-server/plugin.js +40 -108
- package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
- package/dist/vite-plugin-astro-server/util.d.ts +2 -2
- package/dist/vite-plugin-astro-server/util.js +2 -1
- package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
- package/dist/vite-plugin-astro-server/vite.js +7 -7
- package/dist/vite-plugin-chromedevtools/index.d.ts +7 -0
- package/dist/vite-plugin-chromedevtools/index.js +47 -0
- package/dist/vite-plugin-config-alias/index.js +59 -44
- package/dist/vite-plugin-css/index.d.ts +18 -0
- package/dist/vite-plugin-css/index.js +155 -0
- package/dist/vite-plugin-css/util.d.ts +5 -0
- package/dist/vite-plugin-css/util.js +8 -0
- package/dist/vite-plugin-environment/index.d.ts +15 -0
- package/dist/vite-plugin-environment/index.js +77 -0
- package/dist/vite-plugin-fileurl/index.js +6 -3
- package/dist/vite-plugin-head/index.d.ts +1 -2
- package/dist/vite-plugin-head/index.js +42 -58
- package/dist/vite-plugin-hmr-reload/index.js +2 -1
- package/dist/vite-plugin-html/index.d.ts +7 -4
- package/dist/vite-plugin-html/index.js +5 -3
- package/dist/vite-plugin-load-fallback/index.js +12 -5
- package/dist/vite-plugin-markdown/index.js +27 -8
- package/dist/vite-plugin-overlay/index.d.ts +2 -0
- package/dist/vite-plugin-overlay/index.js +21 -0
- package/dist/vite-plugin-pages/const.d.ts +2 -0
- package/dist/vite-plugin-pages/const.js +6 -0
- package/dist/vite-plugin-pages/index.d.ts +2 -0
- package/dist/vite-plugin-pages/index.js +7 -0
- package/dist/vite-plugin-pages/page.d.ts +7 -0
- package/dist/vite-plugin-pages/page.js +54 -0
- package/dist/vite-plugin-pages/pages.d.ts +8 -0
- package/dist/vite-plugin-pages/pages.js +63 -0
- package/dist/vite-plugin-pages/util.d.ts +8 -0
- package/dist/vite-plugin-pages/util.js +15 -0
- package/dist/vite-plugin-renderers/index.d.ts +9 -0
- package/dist/vite-plugin-renderers/index.js +45 -0
- package/dist/vite-plugin-routes/index.d.ts +14 -0
- package/dist/vite-plugin-routes/index.js +181 -0
- package/dist/vite-plugin-scripts/index.js +27 -25
- package/dist/vite-plugin-scripts/page-ssr.js +3 -2
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +2 -1
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +35 -32
- package/templates/content/module.mjs +1 -0
- package/templates/content/types.d.ts +24 -11
- package/types/actions.d.ts +1 -5
- package/types/content.d.ts +9 -11
- package/types/transitions.d.ts +25 -0
- package/dist/actions/loadActions.d.ts +0 -8
- package/dist/actions/loadActions.js +0 -13
- package/dist/actions/runtime/route.d.ts +0 -2
- package/dist/actions/runtime/shared.d.ts +0 -60
- package/dist/actions/runtime/shared.js +0 -296
- package/dist/actions/runtime/utils.d.ts +0 -25
- package/dist/actions/runtime/utils.js +0 -16
- package/dist/actions/runtime/virtual.d.ts +0 -4
- package/dist/actions/runtime/virtual.js +0 -127
- package/dist/assets/fonts/implementations/data-collector.d.ts +0 -3
- package/dist/assets/fonts/implementations/data-collector.js +0 -21
- package/dist/assets/fonts/implementations/error-handler.d.ts +0 -2
- package/dist/assets/fonts/implementations/error-handler.js +0 -41
- package/dist/assets/fonts/implementations/font-fetcher.d.ts +0 -8
- package/dist/assets/fonts/implementations/font-fetcher.js +0 -34
- package/dist/assets/fonts/implementations/font-file-reader.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-file-reader.js +0 -26
- package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/font-metrics-resolver.js +0 -66
- package/dist/assets/fonts/implementations/font-type-extractor.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-type-extractor.js +0 -22
- package/dist/assets/fonts/implementations/hasher.d.ts +0 -2
- package/dist/assets/fonts/implementations/hasher.js +0 -14
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.d.ts +0 -2
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.js +0 -147
- package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/local-provider-url-resolver.js +0 -17
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +0 -20
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +0 -47
- package/dist/assets/fonts/implementations/storage.d.ts +0 -4
- package/dist/assets/fonts/implementations/storage.js +0 -14
- package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +0 -28
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.d.ts +0 -8
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.js +0 -39
- package/dist/assets/fonts/implementations/url-proxy.d.ts +0 -7
- package/dist/assets/fonts/implementations/url-proxy.js +0 -31
- package/dist/assets/fonts/implementations/url-resolver.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-resolver.js +0 -55
- package/dist/assets/utils/node/emitAsset.d.ts +0 -15
- package/dist/assets/utils/remotePattern.d.ts +0 -3
- package/dist/assets/utils/remotePattern.js +0 -16
- package/dist/assets/utils/transformToPath.js +0 -32
- package/dist/cli/docs/domains/platform.d.ts +0 -1
- package/dist/cli/docs/infra/process-platform-provider.d.ts +0 -2
- package/dist/cli/docs/infra/process-platform-provider.js +0 -11
- package/dist/cli/docs/infra/tinyexec-command-executor.d.ts +0 -2
- package/dist/cli/docs/infra/tinyexec-command-executor.js +0 -30
- package/dist/cli/info/index.d.ts +0 -12
- package/dist/cli/info/index.js +0 -267
- package/dist/cli/infra/picocolors-text-styler.d.ts +0 -2
- package/dist/cli/infra/picocolors-text-styler.js +0 -7
- package/dist/core/build/css-asset-name.d.ts +0 -9
- package/dist/core/build/css-asset-name.js +0 -89
- package/dist/core/build/plugin.d.ts +0 -43
- package/dist/core/build/plugin.js +0 -61
- package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
- package/dist/core/build/plugins/plugin-actions.js +0 -16
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +0 -33
- package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
- package/dist/core/build/plugins/plugin-pages.js +0 -66
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
- package/dist/core/build/plugins/plugin-renderers.js +0 -54
- package/dist/core/middleware/loadMiddleware.d.ts +0 -7
- package/dist/core/middleware/loadMiddleware.js +0 -14
- package/dist/core/redirects/helpers.d.ts +0 -7
- package/dist/core/redirects/helpers.js +0 -10
- package/dist/core/routing/manifest/serialization.d.ts +0 -5
- package/dist/core/routing/manifest/serialization.js +0 -37
- package/dist/prerender/metadata.d.ts +0 -8
- package/dist/prerender/metadata.js +0 -18
- package/dist/vite-plugin-astro-server/css.d.ts +0 -13
- package/dist/vite-plugin-astro-server/css.js +0 -48
- package/dist/vite-plugin-astro-server/pipeline.js +0 -161
- package/dist/vite-plugin-astro-server/request.d.ts +0 -14
- package/dist/vite-plugin-astro-server/request.js +0 -66
- package/dist/vite-plugin-astro-server/route.d.ts +0 -25
- package/dist/vite-plugin-astro-server/route.js +0 -283
- package/dist/vite-plugin-scanner/index.d.ts +0 -10
- package/dist/vite-plugin-scanner/index.js +0 -87
- package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
- package/dist/vite-plugin-ssr-manifest/index.js +0 -26
- /package/dist/{cli/docs/domains/platform.js → actions/runtime/types.js} +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.js +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.js +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.js +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.js +0 -0
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import {
|
|
2
|
+
appendForwardSlash,
|
|
3
|
+
collapseDuplicateTrailingSlashes,
|
|
4
|
+
hasFileExtension,
|
|
5
|
+
isInternalPath,
|
|
6
|
+
joinPaths,
|
|
7
|
+
prependForwardSlash,
|
|
8
|
+
removeTrailingForwardSlash
|
|
9
|
+
} from "@astrojs/internal-helpers/path";
|
|
10
|
+
import { matchPattern } from "../../assets/utils/index.js";
|
|
11
|
+
import { normalizeTheLocale } from "../../i18n/index.js";
|
|
12
|
+
import {
|
|
13
|
+
clientAddressSymbol,
|
|
14
|
+
DEFAULT_404_COMPONENT,
|
|
15
|
+
REROUTABLE_STATUS_CODES,
|
|
16
|
+
REROUTE_DIRECTIVE_HEADER,
|
|
17
|
+
responseSentSymbol
|
|
18
|
+
} from "../constants.js";
|
|
19
|
+
import { getSetCookiesFromResponse } from "../cookies/index.js";
|
|
20
|
+
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
21
|
+
import { consoleLogDestination } from "../logger/console.js";
|
|
22
|
+
import { AstroIntegrationLogger, Logger } from "../logger/core.js";
|
|
23
|
+
import { RenderContext } from "../render-context.js";
|
|
24
|
+
import { redirectTemplate } from "../routing/3xx.js";
|
|
25
|
+
import { ensure404Route } from "../routing/astro-designed-error-pages.js";
|
|
26
|
+
import { matchRoute } from "../routing/match.js";
|
|
27
|
+
import { PERSIST_SYMBOL } from "../session.js";
|
|
28
|
+
class BaseApp {
|
|
29
|
+
manifest;
|
|
30
|
+
manifestData;
|
|
31
|
+
pipeline;
|
|
32
|
+
adapterLogger;
|
|
33
|
+
baseWithoutTrailingSlash;
|
|
34
|
+
logger;
|
|
35
|
+
constructor(manifest, streaming = true, ...args) {
|
|
36
|
+
this.manifest = manifest;
|
|
37
|
+
this.manifestData = { routes: manifest.routes.map((route) => route.routeData) };
|
|
38
|
+
this.baseWithoutTrailingSlash = removeTrailingForwardSlash(manifest.base);
|
|
39
|
+
this.pipeline = this.createPipeline(streaming, manifest, ...args);
|
|
40
|
+
this.logger = new Logger({
|
|
41
|
+
dest: consoleLogDestination,
|
|
42
|
+
level: manifest.logLevel
|
|
43
|
+
});
|
|
44
|
+
this.adapterLogger = new AstroIntegrationLogger(this.logger.options, manifest.adapterName);
|
|
45
|
+
ensure404Route(this.manifestData);
|
|
46
|
+
}
|
|
47
|
+
async createRenderContext(payload) {
|
|
48
|
+
return RenderContext.create(payload);
|
|
49
|
+
}
|
|
50
|
+
getAdapterLogger() {
|
|
51
|
+
return this.adapterLogger;
|
|
52
|
+
}
|
|
53
|
+
getAllowedDomains() {
|
|
54
|
+
return this.manifest.allowedDomains;
|
|
55
|
+
}
|
|
56
|
+
matchesAllowedDomains(forwardedHost, protocol) {
|
|
57
|
+
return BaseApp.validateForwardedHost(forwardedHost, this.manifest.allowedDomains, protocol);
|
|
58
|
+
}
|
|
59
|
+
static validateForwardedHost(forwardedHost, allowedDomains, protocol) {
|
|
60
|
+
if (!allowedDomains || allowedDomains.length === 0) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const testUrl = new URL(`${protocol || "https"}://${forwardedHost}`);
|
|
65
|
+
return allowedDomains.some((pattern) => {
|
|
66
|
+
return matchPattern(testUrl, pattern);
|
|
67
|
+
});
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
set setManifestData(newManifestData) {
|
|
73
|
+
this.manifestData = newManifestData;
|
|
74
|
+
}
|
|
75
|
+
removeBase(pathname) {
|
|
76
|
+
if (pathname.startsWith(this.manifest.base)) {
|
|
77
|
+
return pathname.slice(this.baseWithoutTrailingSlash.length + 1);
|
|
78
|
+
}
|
|
79
|
+
return pathname;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* It removes the base from the request URL, prepends it with a forward slash and attempts to decoded it.
|
|
83
|
+
*
|
|
84
|
+
* If the decoding fails, it logs the error and return the pathname as is.
|
|
85
|
+
* @param request
|
|
86
|
+
*/
|
|
87
|
+
getPathnameFromRequest(request) {
|
|
88
|
+
const url = new URL(request.url);
|
|
89
|
+
const pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
90
|
+
try {
|
|
91
|
+
return decodeURI(pathname);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
this.getAdapterLogger().error(e.toString());
|
|
94
|
+
return pathname;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Given a `Request`, it returns the `RouteData` that matches its `pathname`. By default, prerendered
|
|
99
|
+
* routes aren't returned, even if they are matched.
|
|
100
|
+
*
|
|
101
|
+
* When `allowPrerenderedRoutes` is `true`, the function returns matched prerendered routes too.
|
|
102
|
+
* @param request
|
|
103
|
+
* @param allowPrerenderedRoutes
|
|
104
|
+
*/
|
|
105
|
+
match(request, allowPrerenderedRoutes = false) {
|
|
106
|
+
const url = new URL(request.url);
|
|
107
|
+
if (this.manifest.assets.has(url.pathname)) return void 0;
|
|
108
|
+
let pathname = this.computePathnameFromDomain(request);
|
|
109
|
+
if (!pathname) {
|
|
110
|
+
pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
111
|
+
}
|
|
112
|
+
let routeData = matchRoute(decodeURI(pathname), this.manifestData);
|
|
113
|
+
if (!routeData) return void 0;
|
|
114
|
+
if (allowPrerenderedRoutes) {
|
|
115
|
+
return routeData;
|
|
116
|
+
} else if (routeData.prerender) {
|
|
117
|
+
return void 0;
|
|
118
|
+
}
|
|
119
|
+
return routeData;
|
|
120
|
+
}
|
|
121
|
+
computePathnameFromDomain(request) {
|
|
122
|
+
let pathname = void 0;
|
|
123
|
+
const url = new URL(request.url);
|
|
124
|
+
if (this.manifest.i18n && (this.manifest.i18n.strategy === "domains-prefix-always" || this.manifest.i18n.strategy === "domains-prefix-other-locales" || this.manifest.i18n.strategy === "domains-prefix-always-no-redirect")) {
|
|
125
|
+
let host = request.headers.get("X-Forwarded-Host");
|
|
126
|
+
let protocol = request.headers.get("X-Forwarded-Proto");
|
|
127
|
+
if (protocol) {
|
|
128
|
+
protocol = protocol + ":";
|
|
129
|
+
} else {
|
|
130
|
+
protocol = url.protocol;
|
|
131
|
+
}
|
|
132
|
+
if (!host) {
|
|
133
|
+
host = request.headers.get("Host");
|
|
134
|
+
}
|
|
135
|
+
if (host && protocol) {
|
|
136
|
+
host = host.split(":")[0];
|
|
137
|
+
try {
|
|
138
|
+
let locale;
|
|
139
|
+
const hostAsUrl = new URL(`${protocol}//${host}`);
|
|
140
|
+
for (const [domainKey, localeValue] of Object.entries(
|
|
141
|
+
this.manifest.i18n.domainLookupTable
|
|
142
|
+
)) {
|
|
143
|
+
const domainKeyAsUrl = new URL(domainKey);
|
|
144
|
+
if (hostAsUrl.host === domainKeyAsUrl.host && hostAsUrl.protocol === domainKeyAsUrl.protocol) {
|
|
145
|
+
locale = localeValue;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (locale) {
|
|
150
|
+
pathname = prependForwardSlash(
|
|
151
|
+
joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
|
|
152
|
+
);
|
|
153
|
+
if (url.pathname.endsWith("/")) {
|
|
154
|
+
pathname = appendForwardSlash(pathname);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
} catch (e) {
|
|
158
|
+
this.logger.error(
|
|
159
|
+
"router",
|
|
160
|
+
`Astro tried to parse ${protocol}//${host} as an URL, but it threw a parsing error. Check the X-Forwarded-Host and X-Forwarded-Proto headers.`
|
|
161
|
+
);
|
|
162
|
+
this.logger.error("router", `Error: ${e}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return pathname;
|
|
167
|
+
}
|
|
168
|
+
redirectTrailingSlash(pathname) {
|
|
169
|
+
const { trailingSlash } = this.manifest;
|
|
170
|
+
if (pathname === "/" || isInternalPath(pathname)) {
|
|
171
|
+
return pathname;
|
|
172
|
+
}
|
|
173
|
+
const path = collapseDuplicateTrailingSlashes(pathname, trailingSlash !== "never");
|
|
174
|
+
if (path !== pathname) {
|
|
175
|
+
return path;
|
|
176
|
+
}
|
|
177
|
+
if (trailingSlash === "ignore") {
|
|
178
|
+
return pathname;
|
|
179
|
+
}
|
|
180
|
+
if (trailingSlash === "always" && !hasFileExtension(pathname)) {
|
|
181
|
+
return appendForwardSlash(pathname);
|
|
182
|
+
}
|
|
183
|
+
if (trailingSlash === "never") {
|
|
184
|
+
return removeTrailingForwardSlash(pathname);
|
|
185
|
+
}
|
|
186
|
+
return pathname;
|
|
187
|
+
}
|
|
188
|
+
async render(request, renderOptions) {
|
|
189
|
+
let routeData = renderOptions?.routeData;
|
|
190
|
+
let locals;
|
|
191
|
+
let clientAddress;
|
|
192
|
+
let addCookieHeader;
|
|
193
|
+
const url = new URL(request.url);
|
|
194
|
+
const redirect = this.redirectTrailingSlash(url.pathname);
|
|
195
|
+
const prerenderedErrorPageFetch = renderOptions?.prerenderedErrorPageFetch ?? fetch;
|
|
196
|
+
if (redirect !== url.pathname) {
|
|
197
|
+
const status = request.method === "GET" ? 301 : 308;
|
|
198
|
+
return new Response(
|
|
199
|
+
redirectTemplate({
|
|
200
|
+
status,
|
|
201
|
+
relativeLocation: url.pathname,
|
|
202
|
+
absoluteLocation: redirect,
|
|
203
|
+
from: request.url
|
|
204
|
+
}),
|
|
205
|
+
{
|
|
206
|
+
status,
|
|
207
|
+
headers: {
|
|
208
|
+
location: redirect + url.search
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
addCookieHeader = renderOptions?.addCookieHeader;
|
|
214
|
+
clientAddress = renderOptions?.clientAddress ?? Reflect.get(request, clientAddressSymbol);
|
|
215
|
+
routeData = renderOptions?.routeData;
|
|
216
|
+
locals = renderOptions?.locals;
|
|
217
|
+
if (routeData) {
|
|
218
|
+
this.logger.debug(
|
|
219
|
+
"router",
|
|
220
|
+
"The adapter " + this.manifest.adapterName + " provided a custom RouteData for ",
|
|
221
|
+
request.url
|
|
222
|
+
);
|
|
223
|
+
this.logger.debug("router", "RouteData:\n" + routeData);
|
|
224
|
+
}
|
|
225
|
+
if (locals) {
|
|
226
|
+
if (typeof locals !== "object") {
|
|
227
|
+
const error = new AstroError(AstroErrorData.LocalsNotAnObject);
|
|
228
|
+
this.logger.error(null, error.stack);
|
|
229
|
+
return this.renderError(request, {
|
|
230
|
+
status: 500,
|
|
231
|
+
error,
|
|
232
|
+
clientAddress,
|
|
233
|
+
prerenderedErrorPageFetch
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (!routeData) {
|
|
238
|
+
routeData = this.match(request);
|
|
239
|
+
this.logger.debug("router", "Astro matched the following route for " + request.url);
|
|
240
|
+
this.logger.debug("router", "RouteData:\n" + routeData);
|
|
241
|
+
}
|
|
242
|
+
if (!routeData) {
|
|
243
|
+
routeData = this.manifestData.routes.find(
|
|
244
|
+
(route) => route.component === "404.astro" || route.component === DEFAULT_404_COMPONENT
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
if (!routeData) {
|
|
248
|
+
this.logger.debug("router", "Astro hasn't found routes that match " + request.url);
|
|
249
|
+
this.logger.debug("router", "Here's the available routes:\n", this.manifestData);
|
|
250
|
+
return this.renderError(request, {
|
|
251
|
+
locals,
|
|
252
|
+
status: 404,
|
|
253
|
+
clientAddress,
|
|
254
|
+
prerenderedErrorPageFetch
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const pathname = this.getPathnameFromRequest(request);
|
|
258
|
+
const defaultStatus = this.getDefaultStatusCode(routeData, pathname);
|
|
259
|
+
let response;
|
|
260
|
+
let session;
|
|
261
|
+
try {
|
|
262
|
+
const componentInstance = await this.pipeline.getComponentByRoute(routeData);
|
|
263
|
+
const renderContext = await this.createRenderContext({
|
|
264
|
+
pipeline: this.pipeline,
|
|
265
|
+
locals,
|
|
266
|
+
pathname,
|
|
267
|
+
request,
|
|
268
|
+
routeData,
|
|
269
|
+
status: defaultStatus,
|
|
270
|
+
clientAddress
|
|
271
|
+
});
|
|
272
|
+
session = renderContext.session;
|
|
273
|
+
response = await renderContext.render(componentInstance);
|
|
274
|
+
} catch (err) {
|
|
275
|
+
this.logger.error(null, err.stack || err.message || String(err));
|
|
276
|
+
return this.renderError(request, {
|
|
277
|
+
locals,
|
|
278
|
+
status: 500,
|
|
279
|
+
error: err,
|
|
280
|
+
clientAddress,
|
|
281
|
+
prerenderedErrorPageFetch
|
|
282
|
+
});
|
|
283
|
+
} finally {
|
|
284
|
+
await session?.[PERSIST_SYMBOL]();
|
|
285
|
+
}
|
|
286
|
+
if (REROUTABLE_STATUS_CODES.includes(response.status) && // If the body isn't null, that means the user sets the 404 status
|
|
287
|
+
// but uses the current route to handle the 404
|
|
288
|
+
response.body === null && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
|
|
289
|
+
return this.renderError(request, {
|
|
290
|
+
locals,
|
|
291
|
+
response,
|
|
292
|
+
status: response.status,
|
|
293
|
+
// We don't have an error to report here. Passing null means we pass nothing intentionally
|
|
294
|
+
// while undefined means there's no error
|
|
295
|
+
error: response.status === 500 ? null : void 0,
|
|
296
|
+
clientAddress,
|
|
297
|
+
prerenderedErrorPageFetch
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (response.headers.has(REROUTE_DIRECTIVE_HEADER)) {
|
|
301
|
+
response.headers.delete(REROUTE_DIRECTIVE_HEADER);
|
|
302
|
+
}
|
|
303
|
+
if (addCookieHeader) {
|
|
304
|
+
for (const setCookieHeaderValue of BaseApp.getSetCookieFromResponse(response)) {
|
|
305
|
+
response.headers.append("set-cookie", setCookieHeaderValue);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
Reflect.set(response, responseSentSymbol, true);
|
|
309
|
+
return response;
|
|
310
|
+
}
|
|
311
|
+
setCookieHeaders(response) {
|
|
312
|
+
return getSetCookiesFromResponse(response);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Reads all the cookies written by `Astro.cookie.set()` onto the passed response.
|
|
316
|
+
* For example,
|
|
317
|
+
* ```ts
|
|
318
|
+
* for (const cookie_ of App.getSetCookieFromResponse(response)) {
|
|
319
|
+
* const cookie: string = cookie_
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
* @param response The response to read cookies from.
|
|
323
|
+
* @returns An iterator that yields key-value pairs as equal-sign-separated strings.
|
|
324
|
+
*/
|
|
325
|
+
static getSetCookieFromResponse = getSetCookiesFromResponse;
|
|
326
|
+
/**
|
|
327
|
+
* If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
|
|
328
|
+
* This also handles pre-rendered /404 or /500 routes
|
|
329
|
+
*/
|
|
330
|
+
async renderError(request, {
|
|
331
|
+
locals,
|
|
332
|
+
status,
|
|
333
|
+
response: originalResponse,
|
|
334
|
+
skipMiddleware = false,
|
|
335
|
+
error,
|
|
336
|
+
clientAddress,
|
|
337
|
+
prerenderedErrorPageFetch
|
|
338
|
+
}) {
|
|
339
|
+
const errorRoutePath = `/${status}${this.manifest.trailingSlash === "always" ? "/" : ""}`;
|
|
340
|
+
const errorRouteData = matchRoute(errorRoutePath, this.manifestData);
|
|
341
|
+
const url = new URL(request.url);
|
|
342
|
+
if (errorRouteData) {
|
|
343
|
+
if (errorRouteData.prerender) {
|
|
344
|
+
const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
|
|
345
|
+
const statusURL = new URL(`${this.baseWithoutTrailingSlash}/${status}${maybeDotHtml}`, url);
|
|
346
|
+
if (statusURL.toString() !== request.url && prerenderedErrorPageFetch) {
|
|
347
|
+
const response2 = await prerenderedErrorPageFetch(statusURL.toString());
|
|
348
|
+
const override = { status, removeContentEncodingHeaders: true };
|
|
349
|
+
return this.mergeResponses(response2, originalResponse, override);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
const mod = await this.pipeline.getComponentByRoute(errorRouteData);
|
|
353
|
+
let session;
|
|
354
|
+
try {
|
|
355
|
+
const renderContext = await this.createRenderContext({
|
|
356
|
+
locals,
|
|
357
|
+
pipeline: this.pipeline,
|
|
358
|
+
skipMiddleware,
|
|
359
|
+
pathname: this.getPathnameFromRequest(request),
|
|
360
|
+
request,
|
|
361
|
+
routeData: errorRouteData,
|
|
362
|
+
status,
|
|
363
|
+
props: { error },
|
|
364
|
+
clientAddress
|
|
365
|
+
});
|
|
366
|
+
session = renderContext.session;
|
|
367
|
+
const response2 = await renderContext.render(mod);
|
|
368
|
+
return this.mergeResponses(response2, originalResponse);
|
|
369
|
+
} catch {
|
|
370
|
+
if (skipMiddleware === false) {
|
|
371
|
+
return this.renderError(request, {
|
|
372
|
+
locals,
|
|
373
|
+
status,
|
|
374
|
+
response: originalResponse,
|
|
375
|
+
skipMiddleware: true,
|
|
376
|
+
clientAddress,
|
|
377
|
+
prerenderedErrorPageFetch
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
} finally {
|
|
381
|
+
await session?.[PERSIST_SYMBOL]();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const response = this.mergeResponses(new Response(null, { status }), originalResponse);
|
|
385
|
+
Reflect.set(response, responseSentSymbol, true);
|
|
386
|
+
return response;
|
|
387
|
+
}
|
|
388
|
+
mergeResponses(newResponse, originalResponse, override) {
|
|
389
|
+
let newResponseHeaders = newResponse.headers;
|
|
390
|
+
if (override?.removeContentEncodingHeaders) {
|
|
391
|
+
newResponseHeaders = new Headers(newResponseHeaders);
|
|
392
|
+
newResponseHeaders.delete("Content-Encoding");
|
|
393
|
+
newResponseHeaders.delete("Content-Length");
|
|
394
|
+
}
|
|
395
|
+
if (!originalResponse) {
|
|
396
|
+
if (override !== void 0) {
|
|
397
|
+
return new Response(newResponse.body, {
|
|
398
|
+
status: override.status,
|
|
399
|
+
statusText: newResponse.statusText,
|
|
400
|
+
headers: newResponseHeaders
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return newResponse;
|
|
404
|
+
}
|
|
405
|
+
const status = override?.status ? override.status : originalResponse.status === 200 ? newResponse.status : originalResponse.status;
|
|
406
|
+
try {
|
|
407
|
+
originalResponse.headers.delete("Content-type");
|
|
408
|
+
} catch {
|
|
409
|
+
}
|
|
410
|
+
const mergedHeaders = new Map([
|
|
411
|
+
...Array.from(newResponseHeaders),
|
|
412
|
+
...Array.from(originalResponse.headers)
|
|
413
|
+
]);
|
|
414
|
+
const newHeaders = new Headers();
|
|
415
|
+
for (const [name, value] of mergedHeaders) {
|
|
416
|
+
newHeaders.set(name, value);
|
|
417
|
+
}
|
|
418
|
+
return new Response(newResponse.body, {
|
|
419
|
+
status,
|
|
420
|
+
statusText: status === 200 ? newResponse.statusText : originalResponse.statusText,
|
|
421
|
+
// If you're looking at here for possible bugs, it means that it's not a bug.
|
|
422
|
+
// With the middleware, users can meddle with headers, and we should pass to the 404/500.
|
|
423
|
+
// If users see something weird, it's because they are setting some headers they should not.
|
|
424
|
+
//
|
|
425
|
+
// Although, we don't want it to replace the content-type, because the error page must return `text/html`
|
|
426
|
+
headers: newHeaders
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
getDefaultStatusCode(routeData, pathname) {
|
|
430
|
+
if (!routeData.pattern.test(pathname)) {
|
|
431
|
+
for (const fallbackRoute of routeData.fallbackRoutes) {
|
|
432
|
+
if (fallbackRoute.pattern.test(pathname)) {
|
|
433
|
+
return 302;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const route = removeTrailingForwardSlash(routeData.route);
|
|
438
|
+
if (route.endsWith("/404")) return 404;
|
|
439
|
+
if (route.endsWith("/500")) return 500;
|
|
440
|
+
return 200;
|
|
441
|
+
}
|
|
442
|
+
getManifest() {
|
|
443
|
+
return this.pipeline.manifest;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
export {
|
|
447
|
+
BaseApp
|
|
448
|
+
};
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { AstroConfig } from '../../types/public/index.js';
|
|
2
|
+
import type { SSRManifest } from './types.js';
|
|
3
|
+
export type RoutingStrategies = 'manual' | 'pathname-prefix-always' | 'pathname-prefix-other-locales' | 'pathname-prefix-always-no-redirect' | 'domains-prefix-always' | 'domains-prefix-other-locales' | 'domains-prefix-always-no-redirect';
|
|
4
|
+
export declare function toRoutingStrategy(routing: NonNullable<AstroConfig['i18n']>['routing'], domains: NonNullable<AstroConfig['i18n']>['domains']): RoutingStrategies;
|
|
5
|
+
export declare function toFallbackType(routing: NonNullable<AstroConfig['i18n']>['routing']): 'redirect' | 'rewrite';
|
|
6
|
+
export declare function fromRoutingStrategy(strategy: RoutingStrategies, fallbackType: NonNullable<SSRManifest['i18n']>['fallbackType']): NonNullable<AstroConfig['i18n']>['routing'];
|
package/dist/core/app/common.js
CHANGED
|
@@ -1,37 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
function toRoutingStrategy(routing, domains) {
|
|
2
|
+
let strategy;
|
|
3
|
+
const hasDomains = domains ? Object.keys(domains).length > 0 : false;
|
|
4
|
+
if (routing === "manual") {
|
|
5
|
+
strategy = "manual";
|
|
6
|
+
} else {
|
|
7
|
+
if (!hasDomains) {
|
|
8
|
+
if (routing?.prefixDefaultLocale === true) {
|
|
9
|
+
if (routing.redirectToDefaultLocale) {
|
|
10
|
+
strategy = "pathname-prefix-always";
|
|
11
|
+
} else {
|
|
12
|
+
strategy = "pathname-prefix-always-no-redirect";
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
strategy = "pathname-prefix-other-locales";
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
if (routing?.prefixDefaultLocale === true) {
|
|
19
|
+
if (routing.redirectToDefaultLocale) {
|
|
20
|
+
strategy = "domains-prefix-always";
|
|
21
|
+
} else {
|
|
22
|
+
strategy = "domains-prefix-always-no-redirect";
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
strategy = "domains-prefix-other-locales";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
13
28
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
return strategy;
|
|
30
|
+
}
|
|
31
|
+
function toFallbackType(routing) {
|
|
32
|
+
if (routing === "manual") {
|
|
33
|
+
return "rewrite";
|
|
34
|
+
}
|
|
35
|
+
return routing.fallbackType;
|
|
36
|
+
}
|
|
37
|
+
const PREFIX_DEFAULT_LOCALE = /* @__PURE__ */ new Set([
|
|
38
|
+
"pathname-prefix-always",
|
|
39
|
+
"domains-prefix-always",
|
|
40
|
+
"pathname-prefix-always-no-redirect",
|
|
41
|
+
"domains-prefix-always-no-redirect"
|
|
42
|
+
]);
|
|
43
|
+
const REDIRECT_TO_DEFAULT_LOCALE = /* @__PURE__ */ new Set([
|
|
44
|
+
"pathname-prefix-always-no-redirect",
|
|
45
|
+
"domains-prefix-always-no-redirect"
|
|
46
|
+
]);
|
|
47
|
+
function fromRoutingStrategy(strategy, fallbackType) {
|
|
48
|
+
let routing;
|
|
49
|
+
if (strategy === "manual") {
|
|
50
|
+
routing = "manual";
|
|
51
|
+
} else {
|
|
52
|
+
routing = {
|
|
53
|
+
prefixDefaultLocale: PREFIX_DEFAULT_LOCALE.has(strategy),
|
|
54
|
+
redirectToDefaultLocale: !REDIRECT_TO_DEFAULT_LOCALE.has(strategy),
|
|
55
|
+
fallbackType
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return routing;
|
|
34
59
|
}
|
|
35
60
|
export {
|
|
36
|
-
|
|
61
|
+
fromRoutingStrategy,
|
|
62
|
+
toFallbackType,
|
|
63
|
+
toRoutingStrategy
|
|
37
64
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RouteData } from '../../../types/public/index.js';
|
|
2
|
+
import type { Logger } from '../../logger/core.js';
|
|
3
|
+
import type { CreateRenderContext, RenderContext } from '../../render-context.js';
|
|
4
|
+
import { BaseApp, type RenderErrorOptions } from '../base.js';
|
|
5
|
+
import type { SSRManifest } from '../types.js';
|
|
6
|
+
import { DevPipeline } from './pipeline.js';
|
|
7
|
+
export declare class DevApp extends BaseApp<DevPipeline> {
|
|
8
|
+
logger: Logger;
|
|
9
|
+
currentRenderContext: RenderContext | undefined;
|
|
10
|
+
constructor(manifest: SSRManifest, streaming: boolean | undefined, logger: Logger);
|
|
11
|
+
createPipeline(streaming: boolean, manifest: SSRManifest, logger: Logger): DevPipeline;
|
|
12
|
+
match(request: Request): RouteData | undefined;
|
|
13
|
+
createRenderContext(payload: CreateRenderContext): Promise<RenderContext>;
|
|
14
|
+
renderError(request: Request, { locals, skipMiddleware, error, clientAddress, status }: RenderErrorOptions): Promise<Response>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { MiddlewareNoDataOrNextCalled, MiddlewareNotAResponse } from "../../errors/errors-data.js";
|
|
2
|
+
import { isAstroError } from "../../errors/index.js";
|
|
3
|
+
import { isRoute404, isRoute500 } from "../../routing/match.js";
|
|
4
|
+
import { BaseApp } from "../base.js";
|
|
5
|
+
import { DevPipeline } from "./pipeline.js";
|
|
6
|
+
class DevApp extends BaseApp {
|
|
7
|
+
logger;
|
|
8
|
+
currentRenderContext = void 0;
|
|
9
|
+
constructor(manifest, streaming = true, logger) {
|
|
10
|
+
super(manifest, streaming, logger);
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
}
|
|
13
|
+
createPipeline(streaming, manifest, logger) {
|
|
14
|
+
return DevPipeline.create({
|
|
15
|
+
logger,
|
|
16
|
+
manifest,
|
|
17
|
+
streaming
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
match(request) {
|
|
21
|
+
return super.match(request, true);
|
|
22
|
+
}
|
|
23
|
+
async createRenderContext(payload) {
|
|
24
|
+
this.currentRenderContext = await super.createRenderContext(payload);
|
|
25
|
+
return this.currentRenderContext;
|
|
26
|
+
}
|
|
27
|
+
async renderError(request, { locals, skipMiddleware = false, error, clientAddress, status }) {
|
|
28
|
+
if (isAstroError(error) && [MiddlewareNoDataOrNextCalled.name, MiddlewareNotAResponse.name].includes(error.name)) {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
const renderRoute = async (routeData) => {
|
|
32
|
+
try {
|
|
33
|
+
const preloadedComponent = await this.pipeline.getComponentByRoute(routeData);
|
|
34
|
+
const renderContext = await this.createRenderContext({
|
|
35
|
+
locals,
|
|
36
|
+
pipeline: this.pipeline,
|
|
37
|
+
pathname: this.getPathnameFromRequest(request),
|
|
38
|
+
skipMiddleware,
|
|
39
|
+
request,
|
|
40
|
+
routeData,
|
|
41
|
+
clientAddress,
|
|
42
|
+
status,
|
|
43
|
+
shouldInjectCspMetaTags: false
|
|
44
|
+
});
|
|
45
|
+
renderContext.props.error = error;
|
|
46
|
+
const response = await renderContext.render(preloadedComponent);
|
|
47
|
+
if (error) {
|
|
48
|
+
this.logger.error("router", error.stack || error.message);
|
|
49
|
+
}
|
|
50
|
+
return response;
|
|
51
|
+
} catch (_err) {
|
|
52
|
+
if (skipMiddleware === false) {
|
|
53
|
+
return this.renderError(request, {
|
|
54
|
+
clientAddress: void 0,
|
|
55
|
+
prerenderedErrorPageFetch: fetch,
|
|
56
|
+
status: 500,
|
|
57
|
+
skipMiddleware: true,
|
|
58
|
+
error: _err
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
throw _err;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
if (status === 404) {
|
|
65
|
+
const custom400 = getCustom400Route(this.manifestData);
|
|
66
|
+
if (custom400) {
|
|
67
|
+
return renderRoute(custom400);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const custom500 = getCustom500Route(this.manifestData);
|
|
71
|
+
if (!custom500) {
|
|
72
|
+
throw error;
|
|
73
|
+
} else {
|
|
74
|
+
return renderRoute(custom500);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function getCustom500Route(manifestData) {
|
|
79
|
+
return manifestData.routes.find((r) => isRoute500(r.route));
|
|
80
|
+
}
|
|
81
|
+
function getCustom400Route(manifestData) {
|
|
82
|
+
return manifestData.routes.find((r) => isRoute404(r.route));
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
DevApp
|
|
86
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentInstance } from '../../../types/astro.js';
|
|
2
|
+
import type { RewritePayload, RouteData } from '../../../types/public/index.js';
|
|
3
|
+
import { type HeadElements, Pipeline, type TryRewriteResult } from '../../base-pipeline.js';
|
|
4
|
+
type DevPipelineCreate = Pick<DevPipeline, 'logger' | 'manifest' | 'streaming'>;
|
|
5
|
+
export declare class DevPipeline extends Pipeline {
|
|
6
|
+
getName(): string;
|
|
7
|
+
static create({ logger, manifest, streaming }: DevPipelineCreate): DevPipeline;
|
|
8
|
+
headElements(routeData: RouteData): Promise<HeadElements>;
|
|
9
|
+
componentMetadata(): void;
|
|
10
|
+
getComponentByRoute(routeData: RouteData): Promise<ComponentInstance>;
|
|
11
|
+
tryRewrite(payload: RewritePayload, request: Request): Promise<TryRewriteResult>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|