astro 6.0.0-alpha.0 → 6.0.0-alpha.1
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 +18 -21
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/build/generate.js +12 -10
- 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 +56 -61
- package/dist/assets/services/noop.js +5 -0
- package/dist/assets/utils/index.d.ts +0 -2
- package/dist/assets/utils/index.js +0 -5
- 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/remotePattern.d.ts +1 -3
- package/dist/assets/utils/svg.d.ts +2 -1
- package/dist/assets/utils/svg.js +30 -4
- package/dist/assets/vite-plugin-assets.js +10 -8
- 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/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 +81 -54
- package/dist/content/utils.d.ts +46 -338
- package/dist/content/utils.js +43 -48
- package/dist/content/vite-plugin-content-assets.d.ts +12 -4
- package/dist/content/vite-plugin-content-assets.js +100 -56
- package/dist/content/vite-plugin-content-imports.js +10 -4
- package/dist/content/vite-plugin-content-virtual-mod.js +10 -7
- 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 +5 -13
- package/dist/core/build/plugins/plugin-css.d.ts +2 -2
- package/dist/core/build/plugins/plugin-css.js +86 -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 +29 -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 +60 -132
- 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 +27 -7
- package/dist/core/errors/errors-data.js +17 -4
- 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 +18 -7
- 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 +89 -44
- package/dist/core/session/vite-plugin.d.ts +6 -0
- package/dist/core/session/vite-plugin.js +53 -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/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 +15 -10
- package/dist/env/vite-plugin-import-meta-env.js +3 -2
- 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 +1 -22
- 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 +144 -0
- package/dist/manifest/virtual-module.d.ts +1 -4
- package/dist/manifest/virtual-module.js +77 -80
- package/dist/preferences/index.d.ts +1 -2
- 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/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/swap-functions.js +4 -0
- package/dist/types/astro.d.ts +8 -6
- package/dist/types/public/config.d.ts +404 -288
- package/dist/types/public/context.d.ts +3 -4
- 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 +3 -2
- 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 +16 -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 +21 -7
- 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 +1 -2
- package/dist/vite-plugin-astro-server/index.js +6 -4
- package/dist/vite-plugin-astro-server/metadata.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +4 -7
- package/dist/vite-plugin-astro-server/plugin.js +54 -65
- package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
- package/dist/vite-plugin-astro-server/util.d.ts +0 -2
- package/dist/vite-plugin-astro-server/util.js +1 -2
- 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-config-alias/index.js +40 -32
- package/dist/vite-plugin-css/index.d.ts +18 -0
- package/dist/vite-plugin-css/index.js +134 -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-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-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 +48 -0
- package/dist/vite-plugin-pages/pages.d.ts +8 -0
- package/dist/vite-plugin-pages/pages.js +57 -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 +40 -0
- package/dist/vite-plugin-routes/index.d.ts +14 -0
- package/dist/vite-plugin-routes/index.js +177 -0
- package/dist/vite-plugin-scripts/index.js +2 -6
- package/dist/vite-plugin-scripts/page-ssr.js +3 -2
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +34 -31
- 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/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
package/dist/core/app/index.js
CHANGED
|
@@ -1,491 +1,25 @@
|
|
|
1
|
+
import { App } from "./app.js";
|
|
2
|
+
import { BaseApp } from "./base.js";
|
|
3
|
+
import { fromRoutingStrategy, toRoutingStrategy } from "./common.js";
|
|
4
|
+
import { createConsoleLogger } from "./logging.js";
|
|
1
5
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
clientAddressSymbol,
|
|
10
|
-
DEFAULT_404_COMPONENT,
|
|
11
|
-
REROUTABLE_STATUS_CODES,
|
|
12
|
-
REROUTE_DIRECTIVE_HEADER,
|
|
13
|
-
responseSentSymbol
|
|
14
|
-
} from "../constants.js";
|
|
15
|
-
import { getSetCookiesFromResponse } from "../cookies/index.js";
|
|
16
|
-
import { AstroError, AstroErrorData } from "../errors/index.js";
|
|
17
|
-
import { consoleLogDestination } from "../logger/console.js";
|
|
18
|
-
import { AstroIntegrationLogger, Logger } from "../logger/core.js";
|
|
19
|
-
import { NOOP_MIDDLEWARE_FN } from "../middleware/noop-middleware.js";
|
|
20
|
-
import {
|
|
21
|
-
appendForwardSlash,
|
|
22
|
-
joinPaths,
|
|
23
|
-
prependForwardSlash,
|
|
24
|
-
removeTrailingForwardSlash
|
|
25
|
-
} from "../path.js";
|
|
26
|
-
import { createAssetLink } from "../render/ssr-element.js";
|
|
27
|
-
import { RenderContext } from "../render-context.js";
|
|
28
|
-
import { redirectTemplate } from "../routing/3xx.js";
|
|
29
|
-
import { ensure404Route } from "../routing/astro-designed-error-pages.js";
|
|
30
|
-
import { createDefaultRoutes } from "../routing/default.js";
|
|
31
|
-
import { matchRoute } from "../routing/match.js";
|
|
32
|
-
import { PERSIST_SYMBOL } from "../session.js";
|
|
6
|
+
deserializeManifest,
|
|
7
|
+
deserializeRouteData,
|
|
8
|
+
deserializeRouteInfo,
|
|
9
|
+
serializeRouteData,
|
|
10
|
+
serializeRouteInfo
|
|
11
|
+
} from "./manifest.js";
|
|
33
12
|
import { AppPipeline } from "./pipeline.js";
|
|
34
|
-
import { deserializeManifest } from "./common.js";
|
|
35
|
-
class App {
|
|
36
|
-
#manifest;
|
|
37
|
-
#manifestData;
|
|
38
|
-
#logger = new Logger({
|
|
39
|
-
dest: consoleLogDestination,
|
|
40
|
-
level: "info"
|
|
41
|
-
});
|
|
42
|
-
#baseWithoutTrailingSlash;
|
|
43
|
-
#pipeline;
|
|
44
|
-
#adapterLogger;
|
|
45
|
-
constructor(manifest, streaming = true) {
|
|
46
|
-
this.#manifest = manifest;
|
|
47
|
-
this.#manifestData = {
|
|
48
|
-
routes: manifest.routes.map((route) => route.routeData)
|
|
49
|
-
};
|
|
50
|
-
ensure404Route(this.#manifestData);
|
|
51
|
-
this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
|
|
52
|
-
this.#pipeline = this.#createPipeline(streaming);
|
|
53
|
-
this.#adapterLogger = new AstroIntegrationLogger(
|
|
54
|
-
this.#logger.options,
|
|
55
|
-
this.#manifest.adapterName
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
getAdapterLogger() {
|
|
59
|
-
return this.#adapterLogger;
|
|
60
|
-
}
|
|
61
|
-
getAllowedDomains() {
|
|
62
|
-
return this.#manifest.allowedDomains;
|
|
63
|
-
}
|
|
64
|
-
get manifest() {
|
|
65
|
-
return this.#manifest;
|
|
66
|
-
}
|
|
67
|
-
set manifest(value) {
|
|
68
|
-
this.#manifest = value;
|
|
69
|
-
}
|
|
70
|
-
matchesAllowedDomains(forwardedHost, protocol) {
|
|
71
|
-
return App.validateForwardedHost(forwardedHost, this.#manifest.allowedDomains, protocol);
|
|
72
|
-
}
|
|
73
|
-
static validateForwardedHost(forwardedHost, allowedDomains, protocol) {
|
|
74
|
-
if (!allowedDomains || allowedDomains.length === 0) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
const testUrl = new URL(`${protocol || "https"}://${forwardedHost}`);
|
|
79
|
-
return allowedDomains.some((pattern) => {
|
|
80
|
-
return matchPattern(testUrl, pattern);
|
|
81
|
-
});
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Creates a pipeline by reading the stored manifest
|
|
88
|
-
*
|
|
89
|
-
* @param streaming
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
#createPipeline(streaming = false) {
|
|
93
|
-
return AppPipeline.create({
|
|
94
|
-
logger: this.#logger,
|
|
95
|
-
manifest: this.#manifest,
|
|
96
|
-
runtimeMode: "production",
|
|
97
|
-
renderers: this.#manifest.renderers,
|
|
98
|
-
defaultRoutes: createDefaultRoutes(this.#manifest),
|
|
99
|
-
resolve: async (specifier) => {
|
|
100
|
-
if (!(specifier in this.#manifest.entryModules)) {
|
|
101
|
-
throw new Error(`Unable to resolve [${specifier}]`);
|
|
102
|
-
}
|
|
103
|
-
const bundlePath = this.#manifest.entryModules[specifier];
|
|
104
|
-
if (bundlePath.startsWith("data:") || bundlePath.length === 0) {
|
|
105
|
-
return bundlePath;
|
|
106
|
-
} else {
|
|
107
|
-
return createAssetLink(bundlePath, this.#manifest.base, this.#manifest.assetsPrefix);
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
serverLike: true,
|
|
111
|
-
streaming
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
set setManifestData(newManifestData) {
|
|
115
|
-
this.#manifestData = newManifestData;
|
|
116
|
-
}
|
|
117
|
-
removeBase(pathname) {
|
|
118
|
-
if (pathname.startsWith(this.#manifest.base)) {
|
|
119
|
-
return pathname.slice(this.#baseWithoutTrailingSlash.length + 1);
|
|
120
|
-
}
|
|
121
|
-
return pathname;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* It removes the base from the request URL, prepends it with a forward slash and attempts to decoded it.
|
|
125
|
-
*
|
|
126
|
-
* If the decoding fails, it logs the error and return the pathname as is.
|
|
127
|
-
* @param request
|
|
128
|
-
* @private
|
|
129
|
-
*/
|
|
130
|
-
#getPathnameFromRequest(request) {
|
|
131
|
-
const url = new URL(request.url);
|
|
132
|
-
const pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
133
|
-
try {
|
|
134
|
-
return decodeURI(pathname);
|
|
135
|
-
} catch (e) {
|
|
136
|
-
this.getAdapterLogger().error(e.toString());
|
|
137
|
-
return pathname;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Given a `Request`, it returns the `RouteData` that matches its `pathname`. By default, prerendered
|
|
142
|
-
* routes aren't returned, even if they are matched.
|
|
143
|
-
*
|
|
144
|
-
* When `allowPrerenderedRoutes` is `true`, the function returns matched prerendered routes too.
|
|
145
|
-
* @param request
|
|
146
|
-
* @param allowPrerenderedRoutes
|
|
147
|
-
*/
|
|
148
|
-
match(request, allowPrerenderedRoutes = false) {
|
|
149
|
-
const url = new URL(request.url);
|
|
150
|
-
if (this.#manifest.assets.has(url.pathname)) return void 0;
|
|
151
|
-
let pathname = this.#computePathnameFromDomain(request);
|
|
152
|
-
if (!pathname) {
|
|
153
|
-
pathname = prependForwardSlash(this.removeBase(url.pathname));
|
|
154
|
-
}
|
|
155
|
-
let routeData = matchRoute(decodeURI(pathname), this.#manifestData);
|
|
156
|
-
if (!routeData) return void 0;
|
|
157
|
-
if (allowPrerenderedRoutes) {
|
|
158
|
-
return routeData;
|
|
159
|
-
} else if (routeData.prerender) {
|
|
160
|
-
return void 0;
|
|
161
|
-
}
|
|
162
|
-
return routeData;
|
|
163
|
-
}
|
|
164
|
-
#computePathnameFromDomain(request) {
|
|
165
|
-
let pathname = void 0;
|
|
166
|
-
const url = new URL(request.url);
|
|
167
|
-
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")) {
|
|
168
|
-
let forwardedHost = request.headers.get("X-Forwarded-Host");
|
|
169
|
-
let protocol = request.headers.get("X-Forwarded-Proto");
|
|
170
|
-
if (protocol) {
|
|
171
|
-
protocol = protocol + ":";
|
|
172
|
-
} else {
|
|
173
|
-
protocol = url.protocol;
|
|
174
|
-
}
|
|
175
|
-
if (forwardedHost && !this.matchesAllowedDomains(forwardedHost, protocol?.replace(":", ""))) {
|
|
176
|
-
forwardedHost = null;
|
|
177
|
-
}
|
|
178
|
-
let host = forwardedHost;
|
|
179
|
-
if (!host) {
|
|
180
|
-
host = request.headers.get("Host");
|
|
181
|
-
}
|
|
182
|
-
if (host && protocol) {
|
|
183
|
-
host = host.split(":")[0];
|
|
184
|
-
try {
|
|
185
|
-
let locale;
|
|
186
|
-
const hostAsUrl = new URL(`${protocol}//${host}`);
|
|
187
|
-
for (const [domainKey, localeValue] of Object.entries(
|
|
188
|
-
this.#manifest.i18n.domainLookupTable
|
|
189
|
-
)) {
|
|
190
|
-
const domainKeyAsUrl = new URL(domainKey);
|
|
191
|
-
if (hostAsUrl.host === domainKeyAsUrl.host && hostAsUrl.protocol === domainKeyAsUrl.protocol) {
|
|
192
|
-
locale = localeValue;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
if (locale) {
|
|
197
|
-
pathname = prependForwardSlash(
|
|
198
|
-
joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
|
|
199
|
-
);
|
|
200
|
-
if (url.pathname.endsWith("/")) {
|
|
201
|
-
pathname = appendForwardSlash(pathname);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
} catch (e) {
|
|
205
|
-
this.#logger.error(
|
|
206
|
-
"router",
|
|
207
|
-
`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.`
|
|
208
|
-
);
|
|
209
|
-
this.#logger.error("router", `Error: ${e}`);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return pathname;
|
|
214
|
-
}
|
|
215
|
-
#redirectTrailingSlash(pathname) {
|
|
216
|
-
const { trailingSlash } = this.#manifest;
|
|
217
|
-
if (pathname === "/" || isInternalPath(pathname)) {
|
|
218
|
-
return pathname;
|
|
219
|
-
}
|
|
220
|
-
const path = collapseDuplicateTrailingSlashes(pathname, trailingSlash !== "never");
|
|
221
|
-
if (path !== pathname) {
|
|
222
|
-
return path;
|
|
223
|
-
}
|
|
224
|
-
if (trailingSlash === "ignore") {
|
|
225
|
-
return pathname;
|
|
226
|
-
}
|
|
227
|
-
if (trailingSlash === "always" && !hasFileExtension(pathname)) {
|
|
228
|
-
return appendForwardSlash(pathname);
|
|
229
|
-
}
|
|
230
|
-
if (trailingSlash === "never") {
|
|
231
|
-
return removeTrailingForwardSlash(pathname);
|
|
232
|
-
}
|
|
233
|
-
return pathname;
|
|
234
|
-
}
|
|
235
|
-
async render(request, {
|
|
236
|
-
addCookieHeader,
|
|
237
|
-
clientAddress = Reflect.get(request, clientAddressSymbol),
|
|
238
|
-
locals,
|
|
239
|
-
prerenderedErrorPageFetch = fetch,
|
|
240
|
-
routeData
|
|
241
|
-
} = {}) {
|
|
242
|
-
const url = new URL(request.url);
|
|
243
|
-
const redirect = this.#redirectTrailingSlash(url.pathname);
|
|
244
|
-
if (redirect !== url.pathname) {
|
|
245
|
-
const status = request.method === "GET" ? 301 : 308;
|
|
246
|
-
return new Response(
|
|
247
|
-
redirectTemplate({
|
|
248
|
-
status,
|
|
249
|
-
relativeLocation: url.pathname,
|
|
250
|
-
absoluteLocation: redirect,
|
|
251
|
-
from: request.url
|
|
252
|
-
}),
|
|
253
|
-
{
|
|
254
|
-
status,
|
|
255
|
-
headers: {
|
|
256
|
-
location: redirect + url.search
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
if (routeData) {
|
|
262
|
-
this.#logger.debug(
|
|
263
|
-
"router",
|
|
264
|
-
"The adapter " + this.#manifest.adapterName + " provided a custom RouteData for ",
|
|
265
|
-
request.url
|
|
266
|
-
);
|
|
267
|
-
this.#logger.debug("router", "RouteData:\n" + routeData);
|
|
268
|
-
}
|
|
269
|
-
if (locals) {
|
|
270
|
-
if (typeof locals !== "object") {
|
|
271
|
-
const error = new AstroError(AstroErrorData.LocalsNotAnObject);
|
|
272
|
-
this.#logger.error(null, error.stack);
|
|
273
|
-
return this.#renderError(request, {
|
|
274
|
-
status: 500,
|
|
275
|
-
error,
|
|
276
|
-
clientAddress,
|
|
277
|
-
prerenderedErrorPageFetch
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
if (!routeData) {
|
|
282
|
-
routeData = this.match(request);
|
|
283
|
-
this.#logger.debug("router", "Astro matched the following route for " + request.url);
|
|
284
|
-
this.#logger.debug("router", "RouteData:\n" + routeData);
|
|
285
|
-
}
|
|
286
|
-
if (!routeData) {
|
|
287
|
-
routeData = this.#manifestData.routes.find(
|
|
288
|
-
(route) => route.component === "404.astro" || route.component === DEFAULT_404_COMPONENT
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
if (!routeData) {
|
|
292
|
-
this.#logger.debug("router", "Astro hasn't found routes that match " + request.url);
|
|
293
|
-
this.#logger.debug("router", "Here's the available routes:\n", this.#manifestData);
|
|
294
|
-
return this.#renderError(request, {
|
|
295
|
-
locals,
|
|
296
|
-
status: 404,
|
|
297
|
-
clientAddress,
|
|
298
|
-
prerenderedErrorPageFetch
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
const pathname = this.#getPathnameFromRequest(request);
|
|
302
|
-
const defaultStatus = this.#getDefaultStatusCode(routeData, pathname);
|
|
303
|
-
let response;
|
|
304
|
-
let session;
|
|
305
|
-
try {
|
|
306
|
-
const mod = await this.#pipeline.getModuleForRoute(routeData);
|
|
307
|
-
const renderContext = await RenderContext.create({
|
|
308
|
-
pipeline: this.#pipeline,
|
|
309
|
-
locals,
|
|
310
|
-
pathname,
|
|
311
|
-
request,
|
|
312
|
-
routeData,
|
|
313
|
-
status: defaultStatus,
|
|
314
|
-
clientAddress
|
|
315
|
-
});
|
|
316
|
-
session = renderContext.session;
|
|
317
|
-
response = await renderContext.render(await mod.page());
|
|
318
|
-
} catch (err) {
|
|
319
|
-
this.#logger.error(null, err.stack || err.message || String(err));
|
|
320
|
-
return this.#renderError(request, {
|
|
321
|
-
locals,
|
|
322
|
-
status: 500,
|
|
323
|
-
error: err,
|
|
324
|
-
clientAddress,
|
|
325
|
-
prerenderedErrorPageFetch
|
|
326
|
-
});
|
|
327
|
-
} finally {
|
|
328
|
-
await session?.[PERSIST_SYMBOL]();
|
|
329
|
-
}
|
|
330
|
-
if (REROUTABLE_STATUS_CODES.includes(response.status) && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
|
|
331
|
-
return this.#renderError(request, {
|
|
332
|
-
locals,
|
|
333
|
-
response,
|
|
334
|
-
status: response.status,
|
|
335
|
-
// We don't have an error to report here. Passing null means we pass nothing intentionally
|
|
336
|
-
// while undefined means there's no error
|
|
337
|
-
error: response.status === 500 ? null : void 0,
|
|
338
|
-
clientAddress,
|
|
339
|
-
prerenderedErrorPageFetch
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
if (response.headers.has(REROUTE_DIRECTIVE_HEADER)) {
|
|
343
|
-
response.headers.delete(REROUTE_DIRECTIVE_HEADER);
|
|
344
|
-
}
|
|
345
|
-
if (addCookieHeader) {
|
|
346
|
-
for (const setCookieHeaderValue of App.getSetCookieFromResponse(response)) {
|
|
347
|
-
response.headers.append("set-cookie", setCookieHeaderValue);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
Reflect.set(response, responseSentSymbol, true);
|
|
351
|
-
return response;
|
|
352
|
-
}
|
|
353
|
-
setCookieHeaders(response) {
|
|
354
|
-
return getSetCookiesFromResponse(response);
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Reads all the cookies written by `Astro.cookie.set()` onto the passed response.
|
|
358
|
-
* For example,
|
|
359
|
-
* ```ts
|
|
360
|
-
* for (const cookie_ of App.getSetCookieFromResponse(response)) {
|
|
361
|
-
* const cookie: string = cookie_
|
|
362
|
-
* }
|
|
363
|
-
* ```
|
|
364
|
-
* @param response The response to read cookies from.
|
|
365
|
-
* @returns An iterator that yields key-value pairs as equal-sign-separated strings.
|
|
366
|
-
*/
|
|
367
|
-
static getSetCookieFromResponse = getSetCookiesFromResponse;
|
|
368
|
-
/**
|
|
369
|
-
* If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
|
|
370
|
-
* This also handles pre-rendered /404 or /500 routes
|
|
371
|
-
*/
|
|
372
|
-
async #renderError(request, {
|
|
373
|
-
locals,
|
|
374
|
-
status,
|
|
375
|
-
response: originalResponse,
|
|
376
|
-
skipMiddleware = false,
|
|
377
|
-
error,
|
|
378
|
-
clientAddress,
|
|
379
|
-
prerenderedErrorPageFetch
|
|
380
|
-
}) {
|
|
381
|
-
const errorRoutePath = `/${status}${this.#manifest.trailingSlash === "always" ? "/" : ""}`;
|
|
382
|
-
const errorRouteData = matchRoute(errorRoutePath, this.#manifestData);
|
|
383
|
-
const url = new URL(request.url);
|
|
384
|
-
if (errorRouteData) {
|
|
385
|
-
if (errorRouteData.prerender) {
|
|
386
|
-
const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? ".html" : "";
|
|
387
|
-
const statusURL = new URL(
|
|
388
|
-
`${this.#baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
|
|
389
|
-
url
|
|
390
|
-
);
|
|
391
|
-
if (statusURL.toString() !== request.url) {
|
|
392
|
-
const response2 = await prerenderedErrorPageFetch(statusURL.toString());
|
|
393
|
-
const override = { status, removeContentEncodingHeaders: true };
|
|
394
|
-
return this.#mergeResponses(response2, originalResponse, override);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
const mod = await this.#pipeline.getModuleForRoute(errorRouteData);
|
|
398
|
-
let session;
|
|
399
|
-
try {
|
|
400
|
-
const renderContext = await RenderContext.create({
|
|
401
|
-
locals,
|
|
402
|
-
pipeline: this.#pipeline,
|
|
403
|
-
middleware: skipMiddleware ? NOOP_MIDDLEWARE_FN : void 0,
|
|
404
|
-
pathname: this.#getPathnameFromRequest(request),
|
|
405
|
-
request,
|
|
406
|
-
routeData: errorRouteData,
|
|
407
|
-
status,
|
|
408
|
-
props: { error },
|
|
409
|
-
clientAddress
|
|
410
|
-
});
|
|
411
|
-
session = renderContext.session;
|
|
412
|
-
const response2 = await renderContext.render(await mod.page());
|
|
413
|
-
return this.#mergeResponses(response2, originalResponse);
|
|
414
|
-
} catch {
|
|
415
|
-
if (skipMiddleware === false) {
|
|
416
|
-
return this.#renderError(request, {
|
|
417
|
-
locals,
|
|
418
|
-
status,
|
|
419
|
-
response: originalResponse,
|
|
420
|
-
skipMiddleware: true,
|
|
421
|
-
clientAddress,
|
|
422
|
-
prerenderedErrorPageFetch
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
} finally {
|
|
426
|
-
await session?.[PERSIST_SYMBOL]();
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
const response = this.#mergeResponses(new Response(null, { status }), originalResponse);
|
|
430
|
-
Reflect.set(response, responseSentSymbol, true);
|
|
431
|
-
return response;
|
|
432
|
-
}
|
|
433
|
-
#mergeResponses(newResponse, originalResponse, override) {
|
|
434
|
-
let newResponseHeaders = newResponse.headers;
|
|
435
|
-
if (override?.removeContentEncodingHeaders) {
|
|
436
|
-
newResponseHeaders = new Headers(newResponseHeaders);
|
|
437
|
-
newResponseHeaders.delete("Content-Encoding");
|
|
438
|
-
newResponseHeaders.delete("Content-Length");
|
|
439
|
-
}
|
|
440
|
-
if (!originalResponse) {
|
|
441
|
-
if (override !== void 0) {
|
|
442
|
-
return new Response(newResponse.body, {
|
|
443
|
-
status: override.status,
|
|
444
|
-
statusText: newResponse.statusText,
|
|
445
|
-
headers: newResponseHeaders
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
return newResponse;
|
|
449
|
-
}
|
|
450
|
-
const status = override?.status ? override.status : originalResponse.status === 200 ? newResponse.status : originalResponse.status;
|
|
451
|
-
try {
|
|
452
|
-
originalResponse.headers.delete("Content-type");
|
|
453
|
-
} catch {
|
|
454
|
-
}
|
|
455
|
-
const mergedHeaders = new Map([
|
|
456
|
-
...Array.from(newResponseHeaders),
|
|
457
|
-
...Array.from(originalResponse.headers)
|
|
458
|
-
]);
|
|
459
|
-
const newHeaders = new Headers();
|
|
460
|
-
for (const [name, value] of mergedHeaders) {
|
|
461
|
-
newHeaders.set(name, value);
|
|
462
|
-
}
|
|
463
|
-
return new Response(newResponse.body, {
|
|
464
|
-
status,
|
|
465
|
-
statusText: status === 200 ? newResponse.statusText : originalResponse.statusText,
|
|
466
|
-
// If you're looking at here for possible bugs, it means that it's not a bug.
|
|
467
|
-
// With the middleware, users can meddle with headers, and we should pass to the 404/500.
|
|
468
|
-
// If users see something weird, it's because they are setting some headers they should not.
|
|
469
|
-
//
|
|
470
|
-
// Although, we don't want it to replace the content-type, because the error page must return `text/html`
|
|
471
|
-
headers: newHeaders
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
#getDefaultStatusCode(routeData, pathname) {
|
|
475
|
-
if (!routeData.pattern.test(pathname)) {
|
|
476
|
-
for (const fallbackRoute of routeData.fallbackRoutes) {
|
|
477
|
-
if (fallbackRoute.pattern.test(pathname)) {
|
|
478
|
-
return 302;
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
const route = removeTrailingForwardSlash(routeData.route);
|
|
483
|
-
if (route.endsWith("/404")) return 404;
|
|
484
|
-
if (route.endsWith("/500")) return 500;
|
|
485
|
-
return 200;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
13
|
export {
|
|
489
14
|
App,
|
|
490
|
-
|
|
15
|
+
AppPipeline,
|
|
16
|
+
BaseApp,
|
|
17
|
+
createConsoleLogger,
|
|
18
|
+
deserializeManifest,
|
|
19
|
+
deserializeRouteData,
|
|
20
|
+
deserializeRouteInfo,
|
|
21
|
+
fromRoutingStrategy,
|
|
22
|
+
serializeRouteData,
|
|
23
|
+
serializeRouteInfo,
|
|
24
|
+
toRoutingStrategy
|
|
491
25
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { consoleLogDestination } from "../logger/console.js";
|
|
2
|
+
import { Logger } from "../logger/core.js";
|
|
3
|
+
function createConsoleLogger(level) {
|
|
4
|
+
return new Logger({
|
|
5
|
+
dest: consoleLogDestination,
|
|
6
|
+
level: level ?? "info"
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
createConsoleLogger
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SerializedRouteData } from '../../types/astro.js';
|
|
2
|
+
import type { AstroConfig, RouteData } from '../../types/public/index.js';
|
|
3
|
+
import type { RoutesList } from '../../types/astro.js';
|
|
4
|
+
import type { RouteInfo, SerializedSSRManifest, SSRManifest, SerializedRouteInfo } from './types.js';
|
|
5
|
+
export declare function deserializeManifest(serializedManifest: SerializedSSRManifest, routesList?: RoutesList): SSRManifest;
|
|
6
|
+
export declare function serializeRouteData(routeData: RouteData, trailingSlash: AstroConfig['trailingSlash']): SerializedRouteData;
|
|
7
|
+
export declare function deserializeRouteData(rawRouteData: SerializedRouteData): RouteData;
|
|
8
|
+
export declare function serializeRouteInfo(routeInfo: RouteInfo, trailingSlash: AstroConfig['trailingSlash']): SerializedRouteInfo;
|
|
9
|
+
export declare function deserializeRouteInfo(rawRouteInfo: SerializedRouteInfo): RouteInfo;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { decodeKey } from "../encryption.js";
|
|
2
|
+
import { NOOP_MIDDLEWARE_FN } from "../middleware/noop-middleware.js";
|
|
3
|
+
function deserializeManifest(serializedManifest, routesList) {
|
|
4
|
+
const routes = [];
|
|
5
|
+
if (serializedManifest.routes) {
|
|
6
|
+
for (const serializedRoute of serializedManifest.routes) {
|
|
7
|
+
routes.push({
|
|
8
|
+
...serializedRoute,
|
|
9
|
+
routeData: deserializeRouteData(serializedRoute.routeData)
|
|
10
|
+
});
|
|
11
|
+
const route = serializedRoute;
|
|
12
|
+
route.routeData = deserializeRouteData(serializedRoute.routeData);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (routesList) {
|
|
16
|
+
for (const route of routesList?.routes) {
|
|
17
|
+
routes.push({
|
|
18
|
+
file: "",
|
|
19
|
+
links: [],
|
|
20
|
+
scripts: [],
|
|
21
|
+
styles: [],
|
|
22
|
+
routeData: route
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const assets = new Set(serializedManifest.assets);
|
|
27
|
+
const componentMetadata = new Map(serializedManifest.componentMetadata);
|
|
28
|
+
const inlinedScripts = new Map(serializedManifest.inlinedScripts);
|
|
29
|
+
const clientDirectives = new Map(serializedManifest.clientDirectives);
|
|
30
|
+
const key = decodeKey(serializedManifest.key);
|
|
31
|
+
return {
|
|
32
|
+
// in case user middleware exists, this no-op middleware will be reassigned (see plugin-ssr.ts)
|
|
33
|
+
middleware() {
|
|
34
|
+
return { onRequest: NOOP_MIDDLEWARE_FN };
|
|
35
|
+
},
|
|
36
|
+
...serializedManifest,
|
|
37
|
+
rootDir: new URL(serializedManifest.rootDir),
|
|
38
|
+
srcDir: new URL(serializedManifest.srcDir),
|
|
39
|
+
publicDir: new URL(serializedManifest.publicDir),
|
|
40
|
+
outDir: new URL(serializedManifest.outDir),
|
|
41
|
+
cacheDir: new URL(serializedManifest.cacheDir),
|
|
42
|
+
buildClientDir: new URL(serializedManifest.buildClientDir),
|
|
43
|
+
buildServerDir: new URL(serializedManifest.buildServerDir),
|
|
44
|
+
assets,
|
|
45
|
+
componentMetadata,
|
|
46
|
+
inlinedScripts,
|
|
47
|
+
clientDirectives,
|
|
48
|
+
routes,
|
|
49
|
+
key
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function serializeRouteData(routeData, trailingSlash) {
|
|
53
|
+
return {
|
|
54
|
+
...routeData,
|
|
55
|
+
pattern: routeData.pattern.source,
|
|
56
|
+
redirectRoute: routeData.redirectRoute ? serializeRouteData(routeData.redirectRoute, trailingSlash) : void 0,
|
|
57
|
+
fallbackRoutes: routeData.fallbackRoutes.map((fallbackRoute) => {
|
|
58
|
+
return serializeRouteData(fallbackRoute, trailingSlash);
|
|
59
|
+
}),
|
|
60
|
+
_meta: { trailingSlash }
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function deserializeRouteData(rawRouteData) {
|
|
64
|
+
return {
|
|
65
|
+
route: rawRouteData.route,
|
|
66
|
+
type: rawRouteData.type,
|
|
67
|
+
pattern: new RegExp(rawRouteData.pattern),
|
|
68
|
+
params: rawRouteData.params,
|
|
69
|
+
component: rawRouteData.component,
|
|
70
|
+
pathname: rawRouteData.pathname || void 0,
|
|
71
|
+
segments: rawRouteData.segments,
|
|
72
|
+
prerender: rawRouteData.prerender,
|
|
73
|
+
redirect: rawRouteData.redirect,
|
|
74
|
+
redirectRoute: rawRouteData.redirectRoute ? deserializeRouteData(rawRouteData.redirectRoute) : void 0,
|
|
75
|
+
fallbackRoutes: rawRouteData.fallbackRoutes.map((fallback) => {
|
|
76
|
+
return deserializeRouteData(fallback);
|
|
77
|
+
}),
|
|
78
|
+
isIndex: rawRouteData.isIndex,
|
|
79
|
+
origin: rawRouteData.origin,
|
|
80
|
+
distURL: rawRouteData.distURL
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function serializeRouteInfo(routeInfo, trailingSlash) {
|
|
84
|
+
return {
|
|
85
|
+
styles: routeInfo.styles,
|
|
86
|
+
file: routeInfo.file,
|
|
87
|
+
links: routeInfo.links,
|
|
88
|
+
scripts: routeInfo.scripts,
|
|
89
|
+
routeData: serializeRouteData(routeInfo.routeData, trailingSlash)
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function deserializeRouteInfo(rawRouteInfo) {
|
|
93
|
+
return {
|
|
94
|
+
styles: rawRouteInfo.styles,
|
|
95
|
+
file: rawRouteInfo.file,
|
|
96
|
+
links: rawRouteInfo.links,
|
|
97
|
+
scripts: rawRouteInfo.scripts,
|
|
98
|
+
routeData: deserializeRouteData(rawRouteInfo.routeData)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
deserializeManifest,
|
|
103
|
+
deserializeRouteData,
|
|
104
|
+
deserializeRouteInfo,
|
|
105
|
+
serializeRouteData,
|
|
106
|
+
serializeRouteInfo
|
|
107
|
+
};
|
package/dist/core/app/node.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { Http2ServerResponse } from "node:http2";
|
|
3
3
|
import { clientAddressSymbol, nodeRequestAbortControllerCleanupSymbol } from "../constants.js";
|
|
4
|
-
import { deserializeManifest } from "./
|
|
4
|
+
import { deserializeManifest } from "./manifest.js";
|
|
5
5
|
import { createOutgoingHttpHeaders } from "./createOutgoingHttpHeaders.js";
|
|
6
6
|
import { App } from "./index.js";
|
|
7
|
+
import { sanitizeHost, validateForwardedHeaders } from "./validate-forwarded-headers.js";
|
|
7
8
|
class NodeApp extends App {
|
|
8
9
|
headersMap = void 0;
|
|
9
10
|
setHeadersMap(headers) {
|
|
@@ -48,20 +49,20 @@ class NodeApp extends App {
|
|
|
48
49
|
const getFirstForwardedValue = (multiValueHeader) => {
|
|
49
50
|
return multiValueHeader?.toString()?.split(",").map((e) => e.trim())?.[0];
|
|
50
51
|
};
|
|
51
|
-
const forwardedProtocol = getFirstForwardedValue(req.headers["x-forwarded-proto"]);
|
|
52
52
|
const providedProtocol = isEncrypted ? "https" : "http";
|
|
53
|
-
const protocol = forwardedProtocol ?? providedProtocol;
|
|
54
|
-
let forwardedHostname = getFirstForwardedValue(req.headers["x-forwarded-host"]);
|
|
55
53
|
const providedHostname = req.headers.host ?? req.headers[":authority"];
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
54
|
+
const validated = validateForwardedHeaders(
|
|
55
|
+
getFirstForwardedValue(req.headers["x-forwarded-proto"]),
|
|
56
|
+
getFirstForwardedValue(req.headers["x-forwarded-host"]),
|
|
57
|
+
getFirstForwardedValue(req.headers["x-forwarded-port"]),
|
|
58
|
+
allowedDomains
|
|
59
|
+
);
|
|
60
|
+
const protocol = validated.protocol ?? providedProtocol;
|
|
61
|
+
const sanitizedProvidedHostname = sanitizeHost(
|
|
62
|
+
typeof providedHostname === "string" ? providedHostname : void 0
|
|
63
|
+
);
|
|
64
|
+
const hostname = validated.host ?? sanitizedProvidedHostname;
|
|
65
|
+
const port = validated.port;
|
|
65
66
|
let url;
|
|
66
67
|
try {
|
|
67
68
|
const hostnamePort = getHostnamePort(hostname, port);
|