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
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { extname } from "node:path";
|
|
2
|
-
import { fileURLToPath
|
|
3
|
-
import {
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { isRunnableDevEnvironment } from "vite";
|
|
4
4
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
5
5
|
import { createViteLoader } from "../core/module-loader/vite.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { wrapId } from "../core/util.js";
|
|
7
|
+
import { isBuildableCSSRequest } from "../vite-plugin-astro-server/util.js";
|
|
8
|
+
import { crawlGraph } from "../vite-plugin-astro-server/vite.js";
|
|
8
9
|
import {
|
|
9
10
|
CONTENT_IMAGE_FLAG,
|
|
10
11
|
CONTENT_RENDER_FLAG,
|
|
@@ -13,6 +14,9 @@ import {
|
|
|
13
14
|
STYLES_PLACEHOLDER
|
|
14
15
|
} from "./consts.js";
|
|
15
16
|
import { hasContentFlag } from "./utils.js";
|
|
17
|
+
import { joinPaths, prependForwardSlash, slash } from "@astrojs/internal-helpers/path";
|
|
18
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
19
|
+
import { isAstroServerEnvironment } from "../environments.js";
|
|
16
20
|
function astroContentAssetPropagationPlugin({
|
|
17
21
|
settings
|
|
18
22
|
}) {
|
|
@@ -49,13 +53,19 @@ function astroContentAssetPropagationPlugin({
|
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
configureServer(server) {
|
|
52
|
-
|
|
56
|
+
if (!isRunnableDevEnvironment(server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr])) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
devModuleLoader = createViteLoader(
|
|
60
|
+
server,
|
|
61
|
+
server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr]
|
|
62
|
+
);
|
|
53
63
|
},
|
|
54
|
-
async transform(_, id
|
|
64
|
+
async transform(_, id) {
|
|
55
65
|
if (hasContentFlag(id, PROPAGATED_ASSET_FLAG)) {
|
|
56
66
|
const basePath = id.split("?")[0];
|
|
57
67
|
let stringifiedLinks, stringifiedStyles;
|
|
58
|
-
if (
|
|
68
|
+
if (isAstroServerEnvironment(this.environment) && devModuleLoader) {
|
|
59
69
|
if (!devModuleLoader.getModuleById(basePath)?.ssrModule) {
|
|
60
70
|
await devModuleLoader.import(basePath);
|
|
61
71
|
}
|
|
@@ -63,7 +73,7 @@ function astroContentAssetPropagationPlugin({
|
|
|
63
73
|
styles,
|
|
64
74
|
urls,
|
|
65
75
|
crawledFiles: styleCrawledFiles
|
|
66
|
-
} = await getStylesForURL(
|
|
76
|
+
} = await getStylesForURL(basePath, devModuleLoader.getSSREnvironment());
|
|
67
77
|
for (const file of styleCrawledFiles) {
|
|
68
78
|
if (!file.includes("node_modules")) {
|
|
69
79
|
this.addWatchFile(file);
|
|
@@ -89,60 +99,94 @@ function astroContentAssetPropagationPlugin({
|
|
|
89
99
|
}
|
|
90
100
|
};
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
const INLINE_QUERY_REGEX = /(?:\?|&)inline(?:$|&)/;
|
|
103
|
+
async function getStylesForURL(filePath, environment) {
|
|
104
|
+
const importedCssUrls = /* @__PURE__ */ new Set();
|
|
105
|
+
const importedStylesMap = /* @__PURE__ */ new Map();
|
|
106
|
+
const crawledFiles = /* @__PURE__ */ new Set();
|
|
107
|
+
for await (const importedModule of crawlGraph(environment, filePath, false)) {
|
|
108
|
+
if (importedModule.file) {
|
|
109
|
+
crawledFiles.add(importedModule.file);
|
|
110
|
+
}
|
|
111
|
+
if (isBuildableCSSRequest(importedModule.url)) {
|
|
112
|
+
let css = "";
|
|
113
|
+
if (typeof importedModule.ssrModule?.default === "string") {
|
|
114
|
+
css = importedModule.ssrModule.default;
|
|
115
|
+
} else {
|
|
116
|
+
let modId = importedModule.url;
|
|
117
|
+
if (!INLINE_QUERY_REGEX.test(importedModule.url)) {
|
|
118
|
+
if (importedModule.url.includes("?")) {
|
|
119
|
+
modId = importedModule.url.replace("?", "?inline&");
|
|
104
120
|
} else {
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
for (const chunk of outputs) {
|
|
109
|
-
if (chunk.type === "chunk" && chunk.code.includes(LINKS_PLACEHOLDER)) {
|
|
110
|
-
const entryStyles = /* @__PURE__ */ new Set();
|
|
111
|
-
const entryLinks = /* @__PURE__ */ new Set();
|
|
112
|
-
for (const id of chunk.moduleIds) {
|
|
113
|
-
const _entryCss = internals.propagatedStylesMap.get(id);
|
|
114
|
-
if (_entryCss) {
|
|
115
|
-
for (const value of _entryCss) {
|
|
116
|
-
if (value.type === "inline") entryStyles.add(value.content);
|
|
117
|
-
if (value.type === "external") entryLinks.add(value.src);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
let newCode = chunk.code;
|
|
122
|
-
if (entryStyles.size) {
|
|
123
|
-
newCode = newCode.replace(
|
|
124
|
-
JSON.stringify(STYLES_PLACEHOLDER),
|
|
125
|
-
JSON.stringify(Array.from(entryStyles))
|
|
126
|
-
);
|
|
127
|
-
} else {
|
|
128
|
-
newCode = newCode.replace(JSON.stringify(STYLES_PLACEHOLDER), "[]");
|
|
129
|
-
}
|
|
130
|
-
if (entryLinks.size) {
|
|
131
|
-
newCode = newCode.replace(
|
|
132
|
-
JSON.stringify(LINKS_PLACEHOLDER),
|
|
133
|
-
JSON.stringify(Array.from(entryLinks).map(prependBase))
|
|
134
|
-
);
|
|
135
|
-
} else {
|
|
136
|
-
newCode = newCode.replace(JSON.stringify(LINKS_PLACEHOLDER), "[]");
|
|
137
|
-
}
|
|
138
|
-
mutate(chunk, ["server"], newCode);
|
|
121
|
+
modId += "?inline";
|
|
139
122
|
}
|
|
140
123
|
}
|
|
124
|
+
try {
|
|
125
|
+
const ssrModule = await environment.runner.import(modId);
|
|
126
|
+
css = ssrModule.default;
|
|
127
|
+
} catch {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
141
130
|
}
|
|
131
|
+
importedStylesMap.set(importedModule.url, {
|
|
132
|
+
id: wrapId(importedModule.id ?? importedModule.url),
|
|
133
|
+
url: wrapId(importedModule.url),
|
|
134
|
+
content: css
|
|
135
|
+
});
|
|
142
136
|
}
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
urls: importedCssUrls,
|
|
140
|
+
styles: [...importedStylesMap.values()],
|
|
141
|
+
crawledFiles
|
|
143
142
|
};
|
|
144
143
|
}
|
|
144
|
+
async function contentAssetsBuildPostHook(base, internals, {
|
|
145
|
+
ssrOutputs,
|
|
146
|
+
prerenderOutputs,
|
|
147
|
+
mutate
|
|
148
|
+
}) {
|
|
149
|
+
const outputs = ssrOutputs.flatMap((o) => o.output).concat(
|
|
150
|
+
...(Array.isArray(prerenderOutputs) ? prerenderOutputs : [prerenderOutputs]).flatMap(
|
|
151
|
+
(o) => o.output
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
for (const chunk of outputs) {
|
|
155
|
+
if (chunk.type !== "chunk") continue;
|
|
156
|
+
if (!chunk.code.includes(LINKS_PLACEHOLDER)) continue;
|
|
157
|
+
const entryStyles = /* @__PURE__ */ new Set();
|
|
158
|
+
const entryLinks = /* @__PURE__ */ new Set();
|
|
159
|
+
for (const id of chunk.moduleIds) {
|
|
160
|
+
const entryCss = internals.propagatedStylesMap.get(id);
|
|
161
|
+
if (entryCss) {
|
|
162
|
+
for (const value of entryCss) {
|
|
163
|
+
if (value.type === "inline") entryStyles.add(value.content);
|
|
164
|
+
if (value.type === "external")
|
|
165
|
+
entryLinks.add(prependForwardSlash(joinPaths(base, slash(value.src))));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let newCode = chunk.code;
|
|
170
|
+
if (entryStyles.size) {
|
|
171
|
+
newCode = newCode.replace(
|
|
172
|
+
JSON.stringify(STYLES_PLACEHOLDER),
|
|
173
|
+
JSON.stringify(Array.from(entryStyles))
|
|
174
|
+
);
|
|
175
|
+
} else {
|
|
176
|
+
newCode = newCode.replace(JSON.stringify(STYLES_PLACEHOLDER), "[]");
|
|
177
|
+
}
|
|
178
|
+
if (entryLinks.size) {
|
|
179
|
+
newCode = newCode.replace(
|
|
180
|
+
JSON.stringify(LINKS_PLACEHOLDER),
|
|
181
|
+
JSON.stringify(Array.from(entryLinks))
|
|
182
|
+
);
|
|
183
|
+
} else {
|
|
184
|
+
newCode = newCode.replace(JSON.stringify(LINKS_PLACEHOLDER), "[]");
|
|
185
|
+
}
|
|
186
|
+
mutate(chunk, ["server"], newCode);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
145
189
|
export {
|
|
146
|
-
|
|
147
|
-
|
|
190
|
+
astroContentAssetPropagationPlugin,
|
|
191
|
+
contentAssetsBuildPostHook
|
|
148
192
|
};
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
reloadContentConfigObserver,
|
|
23
23
|
reverseSymlink
|
|
24
24
|
} from "./utils.js";
|
|
25
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
25
26
|
function getContentRendererByViteId(viteId, settings) {
|
|
26
27
|
let ext = viteId.split(".").pop();
|
|
27
28
|
if (!ext) return void 0;
|
|
@@ -111,17 +112,22 @@ export const _internal = {
|
|
|
111
112
|
configureServer(viteServer) {
|
|
112
113
|
viteServer.watcher.on("all", async (event, entry) => {
|
|
113
114
|
if (CHOKIDAR_MODIFIED_EVENTS.includes(event)) {
|
|
115
|
+
const environment = viteServer.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
114
116
|
const entryType = getEntryType(entry, contentPaths, contentEntryExts, dataEntryExts);
|
|
115
117
|
if (!COLLECTION_TYPES_TO_INVALIDATE_ON.includes(entryType)) return;
|
|
116
118
|
if (entryType === "content" || entryType === "data") {
|
|
117
|
-
await reloadContentConfigObserver({
|
|
119
|
+
await reloadContentConfigObserver({
|
|
120
|
+
fs,
|
|
121
|
+
settings,
|
|
122
|
+
environment: viteServer.environments[ASTRO_VITE_ENVIRONMENT_NAMES.astro]
|
|
123
|
+
});
|
|
118
124
|
}
|
|
119
|
-
for (const modUrl of
|
|
125
|
+
for (const modUrl of environment.moduleGraph.urlToModuleMap.keys()) {
|
|
120
126
|
if (hasContentFlag(modUrl, CONTENT_FLAG) || hasContentFlag(modUrl, DATA_FLAG) || Boolean(getContentRendererByViteId(modUrl, settings))) {
|
|
121
127
|
try {
|
|
122
|
-
const mod = await
|
|
128
|
+
const mod = await environment.moduleGraph.getModuleByUrl(modUrl);
|
|
123
129
|
if (mod) {
|
|
124
|
-
|
|
130
|
+
environment.moduleGraph.invalidateModule(mod);
|
|
125
131
|
}
|
|
126
132
|
} catch (e) {
|
|
127
133
|
if (e.code === "ERR_CLOSED_SERVER") break;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { dataToEsm } from "@rollup/pluginutils";
|
|
1
2
|
import nodeFs from "node:fs";
|
|
2
3
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { dataToEsm } from "@rollup/pluginutils";
|
|
4
4
|
import { normalizePath } from "vite";
|
|
5
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
5
6
|
import { AstroError, AstroErrorData } from "../core/errors/index.js";
|
|
6
7
|
import { rootRelativePath } from "../core/viteUtils.js";
|
|
7
8
|
import { createDefaultAstroMetadata } from "../vite-plugin-astro/metadata.js";
|
|
@@ -20,12 +21,14 @@ import {
|
|
|
20
21
|
} from "./consts.js";
|
|
21
22
|
import { getDataStoreFile } from "./content-layer.js";
|
|
22
23
|
import { getContentPaths, isDeferredModule } from "./utils.js";
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
import { isAstroClientEnvironment } from "../environments.js";
|
|
25
|
+
function invalidateDataStore(viteServer) {
|
|
26
|
+
const environment = viteServer.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
27
|
+
const module = environment.moduleGraph.getModuleById(RESOLVED_DATA_STORE_VIRTUAL_ID);
|
|
25
28
|
if (module) {
|
|
26
|
-
|
|
29
|
+
environment.moduleGraph.invalidateModule(module);
|
|
27
30
|
}
|
|
28
|
-
|
|
31
|
+
viteServer.environments.client.hot.send({
|
|
29
32
|
type: "full-reload",
|
|
30
33
|
path: "*"
|
|
31
34
|
});
|
|
@@ -92,9 +95,9 @@ function astroContentVirtualModPlugin({
|
|
|
92
95
|
return ASSET_IMPORTS_RESOLVED_STUB_ID;
|
|
93
96
|
}
|
|
94
97
|
},
|
|
95
|
-
async load(id
|
|
98
|
+
async load(id) {
|
|
96
99
|
if (id === RESOLVED_VIRTUAL_MODULE_ID) {
|
|
97
|
-
const isClient =
|
|
100
|
+
const isClient = isAstroClientEnvironment(this.environment);
|
|
98
101
|
const code = await generateContentEntryFile({
|
|
99
102
|
settings,
|
|
100
103
|
fs,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { RoutesList } from '../../types/astro.js';
|
|
2
|
+
import type { RemotePattern, RouteData } from '../../types/public/index.js';
|
|
3
|
+
import type { Pipeline } from '../base-pipeline.js';
|
|
4
|
+
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
|
5
|
+
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
|
6
|
+
import { type CreateRenderContext, RenderContext } from '../render-context.js';
|
|
7
|
+
import type { AppPipeline } from './pipeline.js';
|
|
8
|
+
import type { SSRManifest } from './types.js';
|
|
9
|
+
export interface RenderOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to automatically add all cookies written by `Astro.cookie.set()` to the response headers.
|
|
12
|
+
*
|
|
13
|
+
* When set to `true`, they will be added to the `Set-Cookie` header as comma-separated key=value pairs. You can use the standard `response.headers.getSetCookie()` API to read them individually.
|
|
14
|
+
*
|
|
15
|
+
* When set to `false`, the cookies will only be available from `App.getSetCookieFromResponse(response)`.
|
|
16
|
+
*
|
|
17
|
+
* @default {false}
|
|
18
|
+
*/
|
|
19
|
+
addCookieHeader?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The client IP address that will be made available as `Astro.clientAddress` in pages, and as `ctx.clientAddress` in API routes and middleware.
|
|
22
|
+
*
|
|
23
|
+
* Default: `request[Symbol.for("astro.clientAddress")]`
|
|
24
|
+
*/
|
|
25
|
+
clientAddress?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The mutable object that will be made available as `Astro.locals` in pages, and as `ctx.locals` in API routes and middleware.
|
|
28
|
+
*/
|
|
29
|
+
locals?: object;
|
|
30
|
+
/**
|
|
31
|
+
* A custom fetch function for retrieving prerendered pages - 404 or 500.
|
|
32
|
+
*
|
|
33
|
+
* If not provided, Astro will fallback to its default behavior for fetching error pages.
|
|
34
|
+
*
|
|
35
|
+
* When a dynamic route is matched but ultimately results in a 404, this function will be used
|
|
36
|
+
* to fetch the prerendered 404 page if available. Similarly, it may be used to fetch a
|
|
37
|
+
* prerendered 500 error page when necessary.
|
|
38
|
+
*
|
|
39
|
+
* @param {ErrorPagePath} url - The URL of the prerendered 404 or 500 error page to fetch.
|
|
40
|
+
* @returns {Promise<Response>} A promise resolving to the prerendered response.
|
|
41
|
+
*/
|
|
42
|
+
prerenderedErrorPageFetch?: (url: ErrorPagePath) => Promise<Response>;
|
|
43
|
+
/**
|
|
44
|
+
* **Advanced API**: you probably do not need to use this.
|
|
45
|
+
*
|
|
46
|
+
* Default: `app.match(request)`
|
|
47
|
+
*/
|
|
48
|
+
routeData?: RouteData;
|
|
49
|
+
}
|
|
50
|
+
export interface RenderErrorOptions {
|
|
51
|
+
locals?: App.Locals;
|
|
52
|
+
routeData?: RouteData;
|
|
53
|
+
response?: Response;
|
|
54
|
+
status: 404 | 500;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to skip middleware while rendering the error page. Defaults to false.
|
|
57
|
+
*/
|
|
58
|
+
skipMiddleware?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Allows passing an error to 500.astro. It will be available through `Astro.props.error`.
|
|
61
|
+
*/
|
|
62
|
+
error?: unknown;
|
|
63
|
+
clientAddress: string | undefined;
|
|
64
|
+
prerenderedErrorPageFetch: ((url: ErrorPagePath) => Promise<Response>) | undefined;
|
|
65
|
+
}
|
|
66
|
+
type ErrorPagePath = `${string}/404` | `${string}/500` | `${string}/404/` | `${string}/500/` | `${string}404.html` | `${string}500.html`;
|
|
67
|
+
export declare abstract class BaseApp<P extends Pipeline = AppPipeline> {
|
|
68
|
+
manifest: SSRManifest;
|
|
69
|
+
manifestData: RoutesList;
|
|
70
|
+
pipeline: P;
|
|
71
|
+
adapterLogger: AstroIntegrationLogger;
|
|
72
|
+
baseWithoutTrailingSlash: string;
|
|
73
|
+
logger: Logger;
|
|
74
|
+
constructor(manifest: SSRManifest, streaming?: boolean, ...args: any[]);
|
|
75
|
+
createRenderContext(payload: CreateRenderContext): Promise<RenderContext>;
|
|
76
|
+
getAdapterLogger(): AstroIntegrationLogger;
|
|
77
|
+
getAllowedDomains(): Partial<RemotePattern>[] | undefined;
|
|
78
|
+
protected matchesAllowedDomains(forwardedHost: string, protocol?: string): boolean;
|
|
79
|
+
static validateForwardedHost(forwardedHost: string, allowedDomains?: Partial<RemotePattern>[], protocol?: string): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a pipeline by reading the stored manifest
|
|
82
|
+
*
|
|
83
|
+
* @param streaming
|
|
84
|
+
* @param manifest
|
|
85
|
+
* @param args
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
abstract createPipeline(streaming: boolean, manifest: SSRManifest, ...args: any[]): P;
|
|
89
|
+
set setManifestData(newManifestData: RoutesList);
|
|
90
|
+
removeBase(pathname: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* It removes the base from the request URL, prepends it with a forward slash and attempts to decoded it.
|
|
93
|
+
*
|
|
94
|
+
* If the decoding fails, it logs the error and return the pathname as is.
|
|
95
|
+
* @param request
|
|
96
|
+
*/
|
|
97
|
+
getPathnameFromRequest(request: Request): string;
|
|
98
|
+
/**
|
|
99
|
+
* Given a `Request`, it returns the `RouteData` that matches its `pathname`. By default, prerendered
|
|
100
|
+
* routes aren't returned, even if they are matched.
|
|
101
|
+
*
|
|
102
|
+
* When `allowPrerenderedRoutes` is `true`, the function returns matched prerendered routes too.
|
|
103
|
+
* @param request
|
|
104
|
+
* @param allowPrerenderedRoutes
|
|
105
|
+
*/
|
|
106
|
+
match(request: Request, allowPrerenderedRoutes?: boolean): RouteData | undefined;
|
|
107
|
+
private computePathnameFromDomain;
|
|
108
|
+
private redirectTrailingSlash;
|
|
109
|
+
render(request: Request, renderOptions?: RenderOptions): Promise<Response>;
|
|
110
|
+
setCookieHeaders(response: Response): Generator<string, string[], any>;
|
|
111
|
+
/**
|
|
112
|
+
* Reads all the cookies written by `Astro.cookie.set()` onto the passed response.
|
|
113
|
+
* For example,
|
|
114
|
+
* ```ts
|
|
115
|
+
* for (const cookie_ of App.getSetCookieFromResponse(response)) {
|
|
116
|
+
* const cookie: string = cookie_
|
|
117
|
+
* }
|
|
118
|
+
* ```
|
|
119
|
+
* @param response The response to read cookies from.
|
|
120
|
+
* @returns An iterator that yields key-value pairs as equal-sign-separated strings.
|
|
121
|
+
*/
|
|
122
|
+
static getSetCookieFromResponse: typeof getSetCookiesFromResponse;
|
|
123
|
+
/**
|
|
124
|
+
* If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
|
|
125
|
+
* This also handles pre-rendered /404 or /500 routes
|
|
126
|
+
*/
|
|
127
|
+
renderError(request: Request, { locals, status, response: originalResponse, skipMiddleware, error, clientAddress, prerenderedErrorPageFetch, }: RenderErrorOptions): Promise<Response>;
|
|
128
|
+
private mergeResponses;
|
|
129
|
+
getDefaultStatusCode(routeData: RouteData, pathname: string): number;
|
|
130
|
+
getManifest(): SSRManifest;
|
|
131
|
+
}
|
|
132
|
+
export {};
|