astro 5.16.5 → 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.js → bin/astro.mjs} +7 -8
- package/client.d.ts +19 -45
- package/components/ClientRouter.astro +0 -5
- 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 -29
- package/dist/actions/runtime/server.js +162 -82
- package/dist/actions/runtime/types.d.ts +64 -0
- package/dist/actions/runtime/types.js +0 -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 +11 -9
- package/dist/assets/build/remote.js +4 -14
- package/dist/assets/endpoint/config.js +2 -2
- package/dist/assets/endpoint/dev.js +7 -6
- package/dist/assets/fonts/config.d.ts +86 -174
- package/dist/assets/fonts/config.js +15 -17
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +3 -3
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +4 -4
- package/dist/assets/fonts/types.d.ts +1 -1
- package/dist/assets/fonts/vite-plugin-fonts.js +6 -3
- package/dist/assets/services/sharp.js +5 -6
- package/dist/assets/utils/index.d.ts +0 -6
- package/dist/assets/utils/index.js +0 -9
- package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
- package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -56
- package/dist/assets/vite-plugin-assets.js +9 -14
- package/dist/cli/index.js +0 -2
- package/dist/cli/infra/build-time-astro-version-provider.js +1 -1
- package/dist/cli/preferences/index.js +5 -1
- package/dist/config/index.js +11 -16
- package/dist/container/index.d.ts +0 -1
- package/dist/container/index.js +19 -14
- 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/config.js +17 -13
- package/dist/content/content-layer.js +14 -21
- package/dist/content/data-store.d.ts +0 -2
- package/dist/content/loaders/errors.d.ts +3 -3
- package/dist/content/loaders/errors.js +5 -2
- package/dist/content/loaders/glob.d.ts +0 -5
- package/dist/content/loaders/glob.js +3 -30
- package/dist/content/loaders/types.d.ts +11 -4
- package/dist/content/mutable-data-store.js +1 -14
- package/dist/content/runtime-assets.d.ts +4 -4
- package/dist/content/runtime-assets.js +4 -7
- package/dist/content/runtime.d.ts +35 -73
- package/dist/content/runtime.js +63 -231
- package/dist/content/server-listeners.js +25 -88
- package/dist/content/types-generator.d.ts +1 -6
- package/dist/content/types-generator.js +87 -156
- package/dist/content/utils.d.ts +47 -412
- package/dist/content/utils.js +88 -203
- 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 -8
- package/dist/content/vite-plugin-content-virtual-mod.js +13 -131
- 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 -114
- package/dist/core/app/index.js +20 -557
- 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.d.ts +2 -8
- package/dist/core/app/node.js +8 -9
- 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 +95 -204
- package/dist/core/build/graph.js +2 -2
- package/dist/core/build/index.js +11 -19
- package/dist/core/build/internal.d.ts +3 -29
- package/dist/core/build/internal.js +1 -45
- 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 -131
- 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 +180 -154
- 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 -4
- package/dist/core/config/config.js +2 -2
- 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 +330 -1463
- package/dist/core/config/schemas/base.js +40 -56
- package/dist/core/config/schemas/refined.d.ts +2 -2
- package/dist/core/config/schemas/refined.js +8 -1
- package/dist/core/config/schemas/relative.d.ts +607 -1737
- 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 +12 -0
- package/dist/core/constants.js +22 -1
- package/dist/core/create-vite.d.ts +2 -6
- package/dist/core/create-vite.js +36 -47
- 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/dev/container.js +13 -9
- package/dist/core/dev/dev.js +1 -1
- 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/vite.js +2 -19
- package/dist/core/errors/errors-data.d.ts +85 -57
- package/dist/core/errors/errors-data.js +40 -28
- package/dist/core/errors/errors.d.ts +3 -3
- package/dist/core/errors/errors.js +1 -1
- package/dist/core/errors/overlay.js +1 -1
- package/dist/core/errors/zod-error-map.d.ts +2 -2
- package/dist/core/errors/zod-error-map.js +26 -24
- package/dist/core/messages.d.ts +2 -2
- package/dist/core/messages.js +2 -2
- 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 +4 -4
- package/dist/core/middleware/index.js +6 -12
- 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 -5
- package/dist/core/preview/static-preview-server.js +1 -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 -7
- package/dist/core/render/route-cache.d.ts +3 -3
- package/dist/core/render/route-cache.js +7 -7
- package/dist/core/render-context.d.ts +9 -7
- package/dist/core/render-context.js +46 -47
- 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 +9 -13
- 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 +8 -8
- package/dist/core/routing/validation.d.ts +1 -2
- package/dist/core/routing/validation.js +2 -18
- package/dist/core/server-islands/endpoint.d.ts +1 -2
- package/dist/core/server-islands/endpoint.js +5 -4
- 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 +19 -34
- 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/env-loader.d.ts +0 -1
- package/dist/env/env-loader.js +4 -17
- package/dist/env/schema.d.ts +21 -251
- package/dist/env/schema.js +6 -3
- package/dist/env/vite-plugin-env.js +3 -2
- 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/index.js +0 -3
- 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 +2 -3
- package/dist/integrations/hooks.js +9 -33
- 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/prefetch/index.d.ts +0 -10
- package/dist/prefetch/index.js +1 -1
- package/dist/prerender/routing.d.ts +5 -7
- package/dist/prerender/routing.js +6 -17
- package/dist/runtime/server/astro-global.d.ts +2 -2
- package/dist/runtime/server/astro-global.js +86 -24
- package/dist/runtime/server/render/server-islands.js +2 -2
- package/dist/runtime/server/transition.d.ts +1 -0
- package/dist/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/vite-plugin-transitions.js +1 -4
- package/dist/types/astro.d.ts +10 -8
- package/dist/types/public/common.d.ts +1 -3
- package/dist/types/public/config.d.ts +364 -415
- package/dist/types/public/context.d.ts +21 -52
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +23 -18
- package/dist/types/public/internal.d.ts +3 -18
- 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 -3
- package/dist/virtual-modules/live-config.js +1 -5
- 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 +5 -7
- package/dist/vite-plugin-app/pipeline.js +166 -0
- package/dist/vite-plugin-astro/index.js +11 -13
- 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 +53 -96
- 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-markdown/index.js +0 -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 +14 -15
- package/templates/content/module.mjs +9 -63
- package/templates/content/types.d.ts +32 -78
- 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 -31
- 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/utils/node/emitAsset.d.ts +0 -29
- package/dist/assets/utils/transformToPath.js +0 -32
- package/dist/config/vite-plugin-content-listen.d.ts +0 -17
- package/dist/config/vite-plugin-content-listen.js +0 -26
- package/dist/container/polyfill.d.ts +0 -1
- package/dist/container/polyfill.js +0 -2
- 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/polyfill.d.ts +0 -5
- package/dist/core/polyfill.js +0 -17
- 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-postprocess/index.d.ts +0 -2
- package/dist/vite-plugin-astro-postprocess/index.js +0 -48
- 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 -166
- package/dist/vite-plugin-astro-server/request.d.ts +0 -14
- package/dist/vite-plugin-astro-server/request.js +0 -73
- 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
|
@@ -2,7 +2,7 @@ import type { OutgoingHttpHeaders } from 'node:http';
|
|
|
2
2
|
import type { RemotePattern } from '@astrojs/internal-helpers/remote';
|
|
3
3
|
import type { RehypePlugins, RemarkPlugins, RemarkRehype, ShikiConfig, SyntaxHighlightConfigType } from '@astrojs/markdown-remark';
|
|
4
4
|
import type { Config as SvgoConfig } from 'svgo';
|
|
5
|
-
import type { BuiltinDriverName, BuiltinDriverOptions,
|
|
5
|
+
import type { BuiltinDriverName, BuiltinDriverOptions, Storage } from 'unstorage';
|
|
6
6
|
import type { UserConfig as OriginalViteUserConfig, SSROptions as ViteSSROptions } from 'vite';
|
|
7
7
|
import type { AstroFontProvider, FontFamily } from '../../assets/fonts/types.js';
|
|
8
8
|
import type { ImageFit, ImageLayout } from '../../assets/types.js';
|
|
@@ -137,11 +137,7 @@ interface TestSessionConfig extends CommonSessionConfig {
|
|
|
137
137
|
export type SessionConfig<TDriver extends SessionDriverName> = [
|
|
138
138
|
TDriver
|
|
139
139
|
] extends [never] ? CustomSessionConfig : TDriver extends keyof BuiltinDriverOptions ? BuiltinSessionConfig<TDriver> : TDriver extends 'test' ? TestSessionConfig : CustomSessionConfig;
|
|
140
|
-
export type ResolvedSessionConfig<TDriver extends SessionDriverName> = SessionConfig<TDriver
|
|
141
|
-
driverModule?: () => Promise<{
|
|
142
|
-
default: () => Driver;
|
|
143
|
-
}>;
|
|
144
|
-
};
|
|
140
|
+
export type ResolvedSessionConfig<TDriver extends SessionDriverName> = SessionConfig<TDriver>;
|
|
145
141
|
export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
146
142
|
ssr?: ViteSSROptions;
|
|
147
143
|
}
|
|
@@ -480,6 +476,52 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
480
476
|
* Using `'attribute'` is useful when you are manipulating the `class` attribute of elements and need to avoid conflicts between your own styling logic and Astro's application of styles.
|
|
481
477
|
*/
|
|
482
478
|
scopedStyleStrategy?: 'where' | 'class' | 'attribute';
|
|
479
|
+
/**
|
|
480
|
+
*
|
|
481
|
+
* @name prerenderConflictBehavior
|
|
482
|
+
* @type {'error' | 'warn' | 'ignore'}
|
|
483
|
+
* @default `'warn'`
|
|
484
|
+
* @version 6.0
|
|
485
|
+
* @description
|
|
486
|
+
* Determines the default behavior when two routes generate the same prerendered URL:
|
|
487
|
+
* - `error`: fail the build and display an error, forcing you to resolve the conflict
|
|
488
|
+
* - `warn` (default): log a warning when conflicts occur, but build using the highest-priority route
|
|
489
|
+
* - `ignore`: silently build using the highest-priority route when conflicts occur
|
|
490
|
+
*/
|
|
491
|
+
prerenderConflictBehavior?: 'error' | 'warn' | 'ignore';
|
|
492
|
+
/**
|
|
493
|
+
* @docs
|
|
494
|
+
* @name vite
|
|
495
|
+
* @typeraw {ViteUserConfig}
|
|
496
|
+
* @description
|
|
497
|
+
*
|
|
498
|
+
* Pass additional configuration options to Vite. Useful when Astro doesn't support some advanced configuration that you may need.
|
|
499
|
+
*
|
|
500
|
+
* View the full `vite` configuration object documentation on [vite.dev](https://vite.dev/config/).
|
|
501
|
+
*
|
|
502
|
+
* #### Examples
|
|
503
|
+
*
|
|
504
|
+
* ```js
|
|
505
|
+
* {
|
|
506
|
+
* vite: {
|
|
507
|
+
* ssr: {
|
|
508
|
+
* // Example: Force a broken package to skip SSR processing, if needed
|
|
509
|
+
* external: ['broken-npm-package'],
|
|
510
|
+
* }
|
|
511
|
+
* }
|
|
512
|
+
* }
|
|
513
|
+
* ```
|
|
514
|
+
*
|
|
515
|
+
* ```js
|
|
516
|
+
* {
|
|
517
|
+
* vite: {
|
|
518
|
+
* // Example: Add custom vite plugins directly to your Astro project
|
|
519
|
+
* plugins: [myPlugin()],
|
|
520
|
+
* }
|
|
521
|
+
* }
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
vite?: ViteUserConfig;
|
|
483
525
|
/**
|
|
484
526
|
* @docs
|
|
485
527
|
* @name security
|
|
@@ -563,40 +605,319 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
563
605
|
* When not configured, `X-Forwarded-Host` headers are not trusted and will be ignored.
|
|
564
606
|
*/
|
|
565
607
|
allowedDomains?: Partial<RemotePattern>[];
|
|
608
|
+
/**
|
|
609
|
+
* @docs
|
|
610
|
+
* @name security.csp
|
|
611
|
+
* @kind h4
|
|
612
|
+
* @type {boolean | object}
|
|
613
|
+
* @default `false`
|
|
614
|
+
* @version 6.0.0
|
|
615
|
+
* @description
|
|
616
|
+
*
|
|
617
|
+
* Enables support for [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) to help minimize certain types of security threats by controlling which resources a document is allowed to load. This provides additional protection against [cross-site scripting (XSS)](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting) attacks.
|
|
618
|
+
*
|
|
619
|
+
* Enabling this feature adds additional security to Astro's handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types.
|
|
620
|
+
*
|
|
621
|
+
* This feature comes with some limitations:
|
|
622
|
+
* - External scripts and external styles are not supported out of the box, but you can [provide your own hashes](https://v6.docs.astro.build/en/reference/configuration-reference/#hashes).
|
|
623
|
+
* - [Astro's view transitions](https://v6.docs.astro.build/en/guides/view-transitions/) using the `<ClientRouter />` are not supported, but you can [consider migrating to the browser native View Transition API](https://events-3bg.pages.dev/jotter/astro-view-transitions/) instead if you are not using Astro's enhancements to the native View Transitions and Navigation APIs.
|
|
624
|
+
* - Shiki isn't currently supported. By design, Shiki functions using inline styles.
|
|
625
|
+
*
|
|
626
|
+
* :::note
|
|
627
|
+
* Due to the nature of the Vite dev server, this feature isn't supported while working in `dev` mode. Instead, you can test this in your Astro project using `build` and `preview`.
|
|
628
|
+
* :::
|
|
629
|
+
*
|
|
630
|
+
* When enabled, Astro will add a `<meta>` element inside the `<head>` element of each page.
|
|
631
|
+
* This element will have the `http-equiv="content-security-policy"` attribute, and the `content` attribute will provide values for the `script-src` and `style-src` [directives](https://v6.docs.astro.build/en/reference/configuration-reference/#securitycspdirectives) based on the script and styles used in the page.
|
|
632
|
+
*
|
|
633
|
+
* ```html
|
|
634
|
+
*
|
|
635
|
+
* <head>
|
|
636
|
+
* <meta
|
|
637
|
+
* http-equiv="content-security-policy"
|
|
638
|
+
* content="
|
|
639
|
+
* script-src 'self' 'sha256-somehash';
|
|
640
|
+
* style-src 'self' 'sha256-somehash';
|
|
641
|
+
* "
|
|
642
|
+
* >
|
|
643
|
+
* </head>
|
|
644
|
+
* ```
|
|
645
|
+
*
|
|
646
|
+
* You can further customize the `<meta>` element by enabling this feature with a configuration object that includes additional options.
|
|
647
|
+
*/
|
|
648
|
+
csp?: boolean | {
|
|
649
|
+
/**
|
|
650
|
+
* @name security.csp.algorithm
|
|
651
|
+
* @type {"SHA-256" | "SHA-384" | "SHA-512"}
|
|
652
|
+
* @default `'SHA-256'`
|
|
653
|
+
* @version 6.0.0
|
|
654
|
+
* @description
|
|
655
|
+
*
|
|
656
|
+
* The [hash function](https://developer.mozilla.org/en-US/docs/Glossary/Hash_function) to use when generating the hashes of the styles and scripts emitted by Astro.
|
|
657
|
+
*
|
|
658
|
+
* ```js title="astro.config.mjs"
|
|
659
|
+
* import { defineConfig } from 'astro/config';
|
|
660
|
+
*
|
|
661
|
+
* export default defineConfig({
|
|
662
|
+
* security: {
|
|
663
|
+
* csp: {
|
|
664
|
+
* algorithm: 'SHA-512'
|
|
665
|
+
* }
|
|
666
|
+
* }
|
|
667
|
+
* });
|
|
668
|
+
* ```
|
|
669
|
+
*/
|
|
670
|
+
algorithm?: CspAlgorithm;
|
|
671
|
+
/**
|
|
672
|
+
* @name security.csp.directives
|
|
673
|
+
* @type {string[]}
|
|
674
|
+
* @default `[]`
|
|
675
|
+
* @version 6.0.0
|
|
676
|
+
* @description
|
|
677
|
+
*
|
|
678
|
+
* A list of [CSP directives](https://content-security-policy.com/#directive) (beyond `script-src` and `style-src` which are included by default) that defines valid sources for specific content types. These directives are added to all pages.
|
|
679
|
+
*
|
|
680
|
+
* ```js title="astro.config.mjs"
|
|
681
|
+
* import { defineConfig } from 'astro/config';
|
|
682
|
+
*
|
|
683
|
+
* export default defineConfig({
|
|
684
|
+
* security: {
|
|
685
|
+
* csp: {
|
|
686
|
+
* directives: [
|
|
687
|
+
* "default-src 'self'",
|
|
688
|
+
* "img-src 'self' https://images.cdn.example.com"
|
|
689
|
+
* ]
|
|
690
|
+
* }
|
|
691
|
+
* }
|
|
692
|
+
* });
|
|
693
|
+
* ```
|
|
694
|
+
* After the build, the `<meta>` element will add your directives into the `content` value alongside Astro's default directives:
|
|
695
|
+
*
|
|
696
|
+
* ```html
|
|
697
|
+
* <meta
|
|
698
|
+
* http-equiv="content-security-policy"
|
|
699
|
+
* content="
|
|
700
|
+
* default-src 'self';
|
|
701
|
+
* img-src 'self' 'https://images.cdn.example.com';
|
|
702
|
+
* script-src 'self' 'sha256-somehash';
|
|
703
|
+
* style-src 'self' 'sha256-somehash';
|
|
704
|
+
* "
|
|
705
|
+
* >
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
directives?: CspDirective[];
|
|
709
|
+
/**
|
|
710
|
+
* @name security.csp.styleDirective
|
|
711
|
+
* @type {{ hashes?: CspHash[], resources?: string[] }}
|
|
712
|
+
* @default `undefined`
|
|
713
|
+
* @version 6.0.0
|
|
714
|
+
* @description
|
|
715
|
+
*
|
|
716
|
+
* A configuration object that allows you to override the default sources for the `style-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#resources) property, or to provide additional [hashes]((https://v6.docs.astro.build/en/reference/configuration-reference#hashes) to be rendered. */
|
|
717
|
+
styleDirective?: {
|
|
718
|
+
/**
|
|
719
|
+
* @name security.csp.styleDirective.hashes
|
|
720
|
+
* @type {CspHash[]}
|
|
721
|
+
* @default `[]`
|
|
722
|
+
* @version 6.0.0
|
|
723
|
+
* @description
|
|
724
|
+
*
|
|
725
|
+
* A list of additional hashes to be rendered.
|
|
726
|
+
*
|
|
727
|
+
* You must provide hashes that start with `sha384-`, `sha512-` or `sha256-`. Other values will cause a validation error. These hashes are added to all pages.
|
|
728
|
+
*
|
|
729
|
+
* ```js title="astro.config.mjs"
|
|
730
|
+
* import { defineConfig } from 'astro/config';
|
|
731
|
+
*
|
|
732
|
+
* export default defineConfig({
|
|
733
|
+
* security: {
|
|
734
|
+
* csp: {
|
|
735
|
+
* styleDirective: {
|
|
736
|
+
* hashes: [
|
|
737
|
+
* "sha384-styleHash",
|
|
738
|
+
* "sha512-styleHash",
|
|
739
|
+
* "sha256-styleHash"
|
|
740
|
+
* ]
|
|
741
|
+
* }
|
|
742
|
+
* }
|
|
743
|
+
* }
|
|
744
|
+
* });
|
|
745
|
+
* ```
|
|
746
|
+
*
|
|
747
|
+
* After the build, the `<meta>` element will include your additional hashes in the `style-src` directives:
|
|
748
|
+
*
|
|
749
|
+
* ```html
|
|
750
|
+
* <meta
|
|
751
|
+
* http-equiv="content-security-policy"
|
|
752
|
+
* content="
|
|
753
|
+
* style-src 'self' 'sha384-styleHash' 'sha512-styleHash' 'sha256-styleHash' 'sha256-generatedByAstro';
|
|
754
|
+
* "
|
|
755
|
+
* >
|
|
756
|
+
* ```
|
|
757
|
+
*/
|
|
758
|
+
hashes?: CspHash[];
|
|
759
|
+
/**
|
|
760
|
+
* @name security.csp.styleDirective.resources
|
|
761
|
+
* @type {string[]}
|
|
762
|
+
* @default `[]`
|
|
763
|
+
* @version 6.0.0
|
|
764
|
+
* @description
|
|
765
|
+
*
|
|
766
|
+
* A list of valid sources for `style-src` directives to override Astro's default sources. This will not include `'self'` by default, and must be included in this list if you wish to keep it. These resources are added to all pages.
|
|
767
|
+
*
|
|
768
|
+
* ```js title="astro.config.mjs"
|
|
769
|
+
* import { defineConfig } from 'astro/config';
|
|
770
|
+
*
|
|
771
|
+
* export default defineConfig({
|
|
772
|
+
* security: {
|
|
773
|
+
* csp: {
|
|
774
|
+
* styleDirective: {
|
|
775
|
+
* resources: [
|
|
776
|
+
* "'self'",
|
|
777
|
+
* "https://styles.cdn.example.com"
|
|
778
|
+
* ]
|
|
779
|
+
* }
|
|
780
|
+
* }
|
|
781
|
+
* }
|
|
782
|
+
* });
|
|
783
|
+
* ```
|
|
784
|
+
*
|
|
785
|
+
* After the build, the `<meta>` element will instead apply your sources to the `style-src` directives:
|
|
786
|
+
*
|
|
787
|
+
* ```html
|
|
788
|
+
* <head>
|
|
789
|
+
* <meta
|
|
790
|
+
* http-equiv="content-security-policy"
|
|
791
|
+
* content="
|
|
792
|
+
* style-src 'self' https://styles.cdn.example.com 'sha256-somehash';
|
|
793
|
+
* "
|
|
794
|
+
* >
|
|
795
|
+
* </head>
|
|
796
|
+
* ```
|
|
797
|
+
*
|
|
798
|
+
* When resources are inserted multiple times or from multiple sources (e.g. defined in your `csp` config and added using [the CSP runtime API](/en/reference/api-reference/#csp)), Astro will merge and deduplicate all resources to create your `<meta>` element.
|
|
799
|
+
*/
|
|
800
|
+
resources?: string[];
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* @name security.csp.scriptDirective
|
|
804
|
+
* @type {{ hashes?: CspHash[], resources?: string[], strictDynamic?: boolean }}
|
|
805
|
+
* @default `undefined`
|
|
806
|
+
* @version 6.0.0
|
|
807
|
+
* @description
|
|
808
|
+
*
|
|
809
|
+
* A configuration object that allows you to override the default sources for the `script-src` directive with the [`resources`](https://v6.docs.astro.build/en/reference/configuration-reference/#resources) property, or to provide additional [hashes]((https://v6.docs.astro.build/en/reference/configuration-reference#hashes) to be rendered.
|
|
810
|
+
*/
|
|
811
|
+
scriptDirective?: {
|
|
812
|
+
/**
|
|
813
|
+
* @name security.csp.scriptDirective.hashes
|
|
814
|
+
* @type {CspHash[]}
|
|
815
|
+
* @default `[]`
|
|
816
|
+
* @version 6.0.0
|
|
817
|
+
* @description
|
|
818
|
+
*
|
|
819
|
+
* A list of additional hashes to be rendered.
|
|
820
|
+
*
|
|
821
|
+
* You must provide hashes that start with `sha384-`, `sha512-` or `sha256-`. Other values will cause a validation error. These hashes are added to all pages.
|
|
822
|
+
*
|
|
823
|
+
* ```js title="astro.config.mjs"
|
|
824
|
+
* import { defineConfig } from 'astro/config';
|
|
825
|
+
*
|
|
826
|
+
* export default defineConfig({
|
|
827
|
+
* security: {
|
|
828
|
+
* csp: {
|
|
829
|
+
* scriptDirective: {
|
|
830
|
+
* hashes: [
|
|
831
|
+
* "sha384-scriptHash",
|
|
832
|
+
* "sha512-scriptHash",
|
|
833
|
+
* "sha256-scriptHash"
|
|
834
|
+
* ]
|
|
835
|
+
* }
|
|
836
|
+
* }
|
|
837
|
+
* }
|
|
838
|
+
* });
|
|
839
|
+
* ```
|
|
840
|
+
*
|
|
841
|
+
* After the build, the `<meta>` element will include your additional hashes in the `script-src` directives:
|
|
842
|
+
*
|
|
843
|
+
* ```html
|
|
844
|
+
* <meta
|
|
845
|
+
* http-equiv="content-security-policy"
|
|
846
|
+
* content="
|
|
847
|
+
* script-src 'self' 'sha384-scriptHash' 'sha512-scriptHash' 'sha256-scriptHash' 'sha256-generatedByAstro';
|
|
848
|
+
* "
|
|
849
|
+
* >
|
|
850
|
+
* ```
|
|
851
|
+
*/
|
|
852
|
+
hashes?: CspHash[];
|
|
853
|
+
/**
|
|
854
|
+
* @name security.csp.scriptDirective.resources
|
|
855
|
+
* @type {string[]}
|
|
856
|
+
* @default `[]`
|
|
857
|
+
* @version 6.0.0
|
|
858
|
+
* @description
|
|
859
|
+
*
|
|
860
|
+
* A list of valid sources for the `script-src` directives to override Astro's default sources. This will not include `'self'` by default, and must be included in this list if you wish to keep it. These resources are added to all pages.
|
|
861
|
+
*
|
|
862
|
+
* ```js title="astro.config.mjs"
|
|
863
|
+
* import { defineConfig } from 'astro/config';
|
|
864
|
+
*
|
|
865
|
+
* export default defineConfig({
|
|
866
|
+
* security: {
|
|
867
|
+
* csp: {
|
|
868
|
+
* scriptDirective: {
|
|
869
|
+
* resources: [
|
|
870
|
+
* "'self'", "https://cdn.example.com"
|
|
871
|
+
* ]
|
|
872
|
+
* }
|
|
873
|
+
* }
|
|
874
|
+
* }
|
|
875
|
+
* });
|
|
876
|
+
* ```
|
|
877
|
+
*
|
|
878
|
+
* After the build, the `<meta>` element will instead apply your sources to the `script-src` directives:
|
|
879
|
+
*
|
|
880
|
+
* ```html
|
|
881
|
+
* <head>
|
|
882
|
+
* <meta
|
|
883
|
+
* http-equiv="content-security-policy"
|
|
884
|
+
* content="
|
|
885
|
+
* script-src 'self' https://cdn.example.com 'sha256-somehash';
|
|
886
|
+
* "
|
|
887
|
+
* >
|
|
888
|
+
* </head>
|
|
889
|
+
* ```
|
|
890
|
+
*
|
|
891
|
+
* When resources are inserted multiple times or from multiple sources (e.g. defined in your `csp` config and added using [the CSP runtime API](/en/reference/api-reference/#csp)), Astro will merge and deduplicate all resources to create your `<meta>` element.
|
|
892
|
+
*/
|
|
893
|
+
resources?: string[];
|
|
894
|
+
/**
|
|
895
|
+
* @name security.csp.scriptDirective.strictDynamic
|
|
896
|
+
* @type {boolean}
|
|
897
|
+
* @default `false`
|
|
898
|
+
* @version 6.0.0
|
|
899
|
+
* @description
|
|
900
|
+
*
|
|
901
|
+
* Enables [the `strict-dynamic` keyword](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP#the_strict-dynamic_keyword) to support the dynamic injection of scripts.
|
|
902
|
+
*
|
|
903
|
+
* ```js title="astro.config.mjs"
|
|
904
|
+
* import { defineConfig } from 'astro/config';
|
|
905
|
+
*
|
|
906
|
+
* export default defineConfig({
|
|
907
|
+
* security: {
|
|
908
|
+
* csp: {
|
|
909
|
+
* scriptDirective: {
|
|
910
|
+
* strictDynamic: true
|
|
911
|
+
* }
|
|
912
|
+
* }
|
|
913
|
+
* }
|
|
914
|
+
* });
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
strictDynamic?: boolean;
|
|
918
|
+
};
|
|
919
|
+
};
|
|
566
920
|
};
|
|
567
|
-
/**
|
|
568
|
-
* @docs
|
|
569
|
-
* @name vite
|
|
570
|
-
* @typeraw {ViteUserConfig}
|
|
571
|
-
* @description
|
|
572
|
-
*
|
|
573
|
-
* Pass additional configuration options to Vite. Useful when Astro doesn't support some advanced configuration that you may need.
|
|
574
|
-
*
|
|
575
|
-
* View the full `vite` configuration object documentation on [vite.dev](https://vite.dev/config/).
|
|
576
|
-
*
|
|
577
|
-
* #### Examples
|
|
578
|
-
*
|
|
579
|
-
* ```js
|
|
580
|
-
* {
|
|
581
|
-
* vite: {
|
|
582
|
-
* ssr: {
|
|
583
|
-
* // Example: Force a broken package to skip SSR processing, if needed
|
|
584
|
-
* external: ['broken-npm-package'],
|
|
585
|
-
* }
|
|
586
|
-
* }
|
|
587
|
-
* }
|
|
588
|
-
* ```
|
|
589
|
-
*
|
|
590
|
-
* ```js
|
|
591
|
-
* {
|
|
592
|
-
* vite: {
|
|
593
|
-
* // Example: Add custom vite plugins directly to your Astro project
|
|
594
|
-
* plugins: [myPlugin()],
|
|
595
|
-
* }
|
|
596
|
-
* }
|
|
597
|
-
* ```
|
|
598
|
-
*/
|
|
599
|
-
vite?: ViteUserConfig;
|
|
600
921
|
/**
|
|
601
922
|
* @docs
|
|
602
923
|
* @kind heading
|
|
@@ -1705,14 +2026,14 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
1705
2026
|
* @name i18n.routing.redirectToDefaultLocale
|
|
1706
2027
|
* @kind h4
|
|
1707
2028
|
* @type {boolean}
|
|
1708
|
-
* @default `
|
|
2029
|
+
* @default `false`
|
|
1709
2030
|
* @version 4.2.0
|
|
1710
2031
|
* @description
|
|
1711
2032
|
*
|
|
1712
2033
|
* Configures whether or not the home URL (`/`) generated by `src/pages/index.astro`
|
|
1713
2034
|
* will redirect to `/[defaultLocale]` when `prefixDefaultLocale: true` is set.
|
|
1714
2035
|
*
|
|
1715
|
-
* Set `redirectToDefaultLocale:
|
|
2036
|
+
* Set `redirectToDefaultLocale: true` to enable this automatic redirection at the root of your site:
|
|
1716
2037
|
* ```js
|
|
1717
2038
|
* // astro.config.mjs
|
|
1718
2039
|
* export default defineConfig({
|
|
@@ -1721,7 +2042,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
1721
2042
|
* locales: ["en", "fr"],
|
|
1722
2043
|
* routing: {
|
|
1723
2044
|
* prefixDefaultLocale: true,
|
|
1724
|
-
* redirectToDefaultLocale:
|
|
2045
|
+
* redirectToDefaultLocale: true
|
|
1725
2046
|
* }
|
|
1726
2047
|
* }
|
|
1727
2048
|
* })
|
|
@@ -1922,48 +2243,7 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
1922
2243
|
* These flags allow you to opt in to some deprecated or otherwise outdated behavior of Astro
|
|
1923
2244
|
* in the latest version, so that you can continue to upgrade and take advantage of new Astro releases.
|
|
1924
2245
|
*/
|
|
1925
|
-
legacy?:
|
|
1926
|
-
/**
|
|
1927
|
-
*
|
|
1928
|
-
* @name legacy.collections
|
|
1929
|
-
* @type {boolean}
|
|
1930
|
-
* @default `false`
|
|
1931
|
-
* @version 5.0.0
|
|
1932
|
-
* @description
|
|
1933
|
-
* Enable legacy behavior for content collections.
|
|
1934
|
-
*
|
|
1935
|
-
* ```js
|
|
1936
|
-
* // astro.config.mjs
|
|
1937
|
-
* import { defineConfig } from 'astro/config';
|
|
1938
|
-
* export default defineConfig({
|
|
1939
|
-
* legacy: {
|
|
1940
|
-
* collections: true
|
|
1941
|
-
* }
|
|
1942
|
-
* });
|
|
1943
|
-
* ```
|
|
1944
|
-
*
|
|
1945
|
-
* If enabled, `data` and `content` collections (only) are handled using the legacy content collections implementation. Collections with a `loader` (only) will continue to use the Content Layer API instead. Both kinds of collections may exist in the same project, each using their respective implementations.
|
|
1946
|
-
*
|
|
1947
|
-
* The following limitations continue to exist:
|
|
1948
|
-
*
|
|
1949
|
-
* - Any legacy (`type: 'content'` or `type: 'data'`) collections must continue to be located in the `src/content/` directory.
|
|
1950
|
-
* - These legacy collections will not be transformed to implicitly use the `glob()` loader, and will instead be handled by legacy code.
|
|
1951
|
-
* - Collections using the Content Layer API (with a `loader` defined) are forbidden in `src/content/`, but may exist anywhere else in your project.
|
|
1952
|
-
*
|
|
1953
|
-
* When you are ready to remove this flag and migrate to the new Content Layer API for your legacy collections, you must define a collection for any directories in `src/content/` that you want to continue to use as a collection. It is sufficient to declare an empty collection, and Astro will implicitly generate an appropriate definition for your legacy collections:
|
|
1954
|
-
*
|
|
1955
|
-
* ```js
|
|
1956
|
-
* // src/content.config.ts
|
|
1957
|
-
* import { defineCollection, z } from 'astro:content';
|
|
1958
|
-
*
|
|
1959
|
-
* const blog = defineCollection({ })
|
|
1960
|
-
*
|
|
1961
|
-
* export const collections = { blog };
|
|
1962
|
-
* ```
|
|
1963
|
-
*
|
|
1964
|
-
*/
|
|
1965
|
-
collections?: boolean;
|
|
1966
|
-
};
|
|
2246
|
+
legacy?: Record<string, never>;
|
|
1967
2247
|
/**
|
|
1968
2248
|
*
|
|
1969
2249
|
* @kind heading
|
|
@@ -2008,17 +2288,6 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
2008
2288
|
* See the [Prefetch Guide](https://docs.astro.build/en/guides/prefetch/) for more `prefetch` options and usage.
|
|
2009
2289
|
*/
|
|
2010
2290
|
clientPrerender?: boolean;
|
|
2011
|
-
/**
|
|
2012
|
-
*
|
|
2013
|
-
* @name experimental.failOnPrerenderConflict
|
|
2014
|
-
* @type {boolean}
|
|
2015
|
-
* @default `false`
|
|
2016
|
-
* @version 5.x
|
|
2017
|
-
* @description
|
|
2018
|
-
* When two routes generate the same prerendered URL, fail the build instead of skipping one.
|
|
2019
|
-
* If disabled (default), a warning is logged when conflicts occur and the highest-priority route wins.
|
|
2020
|
-
*/
|
|
2021
|
-
failOnPrerenderConflict?: boolean;
|
|
2022
2291
|
/**
|
|
2023
2292
|
*
|
|
2024
2293
|
* @name experimental.contentIntellisense
|
|
@@ -2060,326 +2329,6 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
2060
2329
|
* see the [Fonts RFC](https://github.com/withastro/roadmap/pull/1039).
|
|
2061
2330
|
*/
|
|
2062
2331
|
fonts?: FontFamily[];
|
|
2063
|
-
/**
|
|
2064
|
-
* @name experimental.headingIdCompat
|
|
2065
|
-
* @type {boolean}
|
|
2066
|
-
* @default `false`
|
|
2067
|
-
* @version 5.5.x
|
|
2068
|
-
* @description
|
|
2069
|
-
*
|
|
2070
|
-
* Enables full compatibility of Markdown headings IDs with common platforms such as GitHub and npm.
|
|
2071
|
-
*
|
|
2072
|
-
* When enabled, IDs for headings ending with non-alphanumeric characters, e.g. `<Picture />`, will
|
|
2073
|
-
* include a trailing `-`, matching standard behavior in other Markdown tooling.
|
|
2074
|
-
*/
|
|
2075
|
-
headingIdCompat?: boolean;
|
|
2076
|
-
/**
|
|
2077
|
-
* @name experimental.csp
|
|
2078
|
-
* @type {boolean | object}
|
|
2079
|
-
* @default `false`
|
|
2080
|
-
* @version 5.9.0
|
|
2081
|
-
* @description
|
|
2082
|
-
*
|
|
2083
|
-
* Enables built-in support for Content Security Policy (CSP). For more information,
|
|
2084
|
-
* refer to the [experimental CSP documentation](https://docs.astro.build/en/reference/experimental-flags/csp/)
|
|
2085
|
-
*
|
|
2086
|
-
*/
|
|
2087
|
-
csp?: boolean | {
|
|
2088
|
-
/**
|
|
2089
|
-
* @name experimental.csp.algorithm
|
|
2090
|
-
* @type {"SHA-256" | "SHA-384" | "SHA-512"}
|
|
2091
|
-
* @default `'SHA-256'`
|
|
2092
|
-
* @version 5.9.0
|
|
2093
|
-
* @description
|
|
2094
|
-
*
|
|
2095
|
-
* The [hash function](https://developer.mozilla.org/en-US/docs/Glossary/Hash_function) to use to generate the hashes of the styles and scripts emitted by Astro.
|
|
2096
|
-
*
|
|
2097
|
-
* ```js
|
|
2098
|
-
* import { defineConfig } from 'astro/config';
|
|
2099
|
-
*
|
|
2100
|
-
* export default defineConfig({
|
|
2101
|
-
* experimental: {
|
|
2102
|
-
* csp: {
|
|
2103
|
-
* algorithm: 'SHA-512'
|
|
2104
|
-
* }
|
|
2105
|
-
* }
|
|
2106
|
-
* });
|
|
2107
|
-
* ```
|
|
2108
|
-
*/
|
|
2109
|
-
algorithm?: CspAlgorithm;
|
|
2110
|
-
/**
|
|
2111
|
-
* @name experimental.csp.styleDirective
|
|
2112
|
-
* @type {{ hashes?: CspHash[], resources?: string[] }}
|
|
2113
|
-
* @default `undefined`
|
|
2114
|
-
* @version 5.9.0
|
|
2115
|
-
* @description
|
|
2116
|
-
*
|
|
2117
|
-
* A configuration object that allows you to override the default sources for the `style-src` directive
|
|
2118
|
-
* with the `resources` property, or to provide additional `hashes` to be rendered.
|
|
2119
|
-
*
|
|
2120
|
-
* These properties are added to all pages and completely override Astro's default resources, not add to them.
|
|
2121
|
-
* Therefore, you must explicitly specify any default values that you want to be included.
|
|
2122
|
-
*/
|
|
2123
|
-
styleDirective?: {
|
|
2124
|
-
/**
|
|
2125
|
-
* @name experimental.csp.styleDirective.hashes
|
|
2126
|
-
* @type {CspHash[]}
|
|
2127
|
-
* @default `[]`
|
|
2128
|
-
* @version 5.9.0
|
|
2129
|
-
* @description
|
|
2130
|
-
*
|
|
2131
|
-
* A list of additional hashes added to the `style-src` directive.
|
|
2132
|
-
*
|
|
2133
|
-
* If you have external styles that aren't generated by Astro, this configuration option allows you to provide additional hashes to be rendered.
|
|
2134
|
-
*
|
|
2135
|
-
* You must provide hashes that start with `sha384-`, `sha512-` or `sha256-`. Other values will cause a validation error. These hashes are added to all pages.
|
|
2136
|
-
*
|
|
2137
|
-
* ```js
|
|
2138
|
-
* import { defineConfig } from 'astro/config';
|
|
2139
|
-
*
|
|
2140
|
-
* export default defineConfig({
|
|
2141
|
-
* experimental: {
|
|
2142
|
-
* csp: {
|
|
2143
|
-
* styleDirective: {
|
|
2144
|
-
* hashes: [
|
|
2145
|
-
* "sha384-styleHash",
|
|
2146
|
-
* "sha512-styleHash",
|
|
2147
|
-
* "sha256-styleHash"
|
|
2148
|
-
* ]
|
|
2149
|
-
* }
|
|
2150
|
-
* }
|
|
2151
|
-
* }
|
|
2152
|
-
* });
|
|
2153
|
-
* ```
|
|
2154
|
-
*/
|
|
2155
|
-
hashes?: CspHash[];
|
|
2156
|
-
/**
|
|
2157
|
-
* @name experimental.csp.styleDirective.resources
|
|
2158
|
-
* @type {string[]}
|
|
2159
|
-
* @default `[]`
|
|
2160
|
-
* @version 5.9.0
|
|
2161
|
-
* @description
|
|
2162
|
-
*
|
|
2163
|
-
* A list of resources applied to the `style-src` directive. These resources are added to all pages and will override Astro's defaults.
|
|
2164
|
-
*
|
|
2165
|
-
* ```js
|
|
2166
|
-
* import { defineConfig } from 'astro/config';
|
|
2167
|
-
*
|
|
2168
|
-
* export default defineConfig({
|
|
2169
|
-
* experimental: {
|
|
2170
|
-
* csp: {
|
|
2171
|
-
* styleDirective: {
|
|
2172
|
-
* resources: [
|
|
2173
|
-
* "'self'",
|
|
2174
|
-
* "https://styles.cdn.example.com"
|
|
2175
|
-
* ]
|
|
2176
|
-
* }
|
|
2177
|
-
* }
|
|
2178
|
-
* }
|
|
2179
|
-
* });
|
|
2180
|
-
* ```
|
|
2181
|
-
*/
|
|
2182
|
-
resources?: string[];
|
|
2183
|
-
};
|
|
2184
|
-
/**
|
|
2185
|
-
* @name experimental.csp.scriptDirective
|
|
2186
|
-
* @type {{ hashes?: CspHash[], resources?: string[], strictDynamic?: boolean }}
|
|
2187
|
-
* @default `undefined`
|
|
2188
|
-
* @version 5.9.0
|
|
2189
|
-
* @description
|
|
2190
|
-
*
|
|
2191
|
-
* A configuration object that allows you to override the default sources for the `script-src` directive
|
|
2192
|
-
* with the `resources` property, or to provide additional `hashes` to be rendered.
|
|
2193
|
-
*
|
|
2194
|
-
* These properties are added to all pages and completely override Astro's default resources, not add to them.
|
|
2195
|
-
* Therefore, you must explicitly specify any default values that you want to be included.
|
|
2196
|
-
*
|
|
2197
|
-
*/
|
|
2198
|
-
scriptDirective?: {
|
|
2199
|
-
/**
|
|
2200
|
-
* @name experimental.csp.scriptDirective.hashes
|
|
2201
|
-
* @type {CspHash[]}
|
|
2202
|
-
* @default `[]`
|
|
2203
|
-
* @version 5.9.0
|
|
2204
|
-
* @description
|
|
2205
|
-
*
|
|
2206
|
-
* A list of additional hashes added to the `script-src` directive.
|
|
2207
|
-
*
|
|
2208
|
-
* If you have external scripts that aren't generated by Astro, or inline scripts, this configuration option allows you to provide additional hashes to be rendered.
|
|
2209
|
-
*
|
|
2210
|
-
* You must provide hashes that start with `sha384-`, `sha512-` or `sha256-`. Other values will cause a validation error. These hashes are added to all pages.
|
|
2211
|
-
*
|
|
2212
|
-
* ```js
|
|
2213
|
-
* import { defineConfig } from 'astro/config';
|
|
2214
|
-
*
|
|
2215
|
-
* export default defineConfig({
|
|
2216
|
-
* experimental: {
|
|
2217
|
-
* csp: {
|
|
2218
|
-
* scriptDirective: {
|
|
2219
|
-
* hashes: [
|
|
2220
|
-
* "sha384-scriptHash",
|
|
2221
|
-
* "sha512-scriptHash",
|
|
2222
|
-
* "sha256-scriptHash"
|
|
2223
|
-
* ]
|
|
2224
|
-
* }
|
|
2225
|
-
* }
|
|
2226
|
-
* }
|
|
2227
|
-
* });
|
|
2228
|
-
* ```
|
|
2229
|
-
*/
|
|
2230
|
-
hashes?: CspHash[];
|
|
2231
|
-
/**
|
|
2232
|
-
* @name experimental.csp.scriptDirective.resources
|
|
2233
|
-
* @type {string[]}
|
|
2234
|
-
* @default `[]`
|
|
2235
|
-
* @version 5.9.0
|
|
2236
|
-
* @description
|
|
2237
|
-
*
|
|
2238
|
-
* A list of resources applied to the `script-src` directive. These resources are added to all pages and will override Astro's defaults.
|
|
2239
|
-
*
|
|
2240
|
-
* ```js
|
|
2241
|
-
* import { defineConfig } from 'astro/config';
|
|
2242
|
-
*
|
|
2243
|
-
* export default defineConfig({
|
|
2244
|
-
* experimental: {
|
|
2245
|
-
* csp: {
|
|
2246
|
-
* scriptDirective: {
|
|
2247
|
-
* resources: [
|
|
2248
|
-
* "'self'",
|
|
2249
|
-
* "https://cdn.example.com"
|
|
2250
|
-
* ]
|
|
2251
|
-
* }
|
|
2252
|
-
* }
|
|
2253
|
-
* }
|
|
2254
|
-
* });
|
|
2255
|
-
* ```
|
|
2256
|
-
*
|
|
2257
|
-
*/
|
|
2258
|
-
resources?: string[];
|
|
2259
|
-
/**
|
|
2260
|
-
* @name experimental.csp.scriptDirective.strictDynamic
|
|
2261
|
-
* @type {boolean}
|
|
2262
|
-
* @default `false`
|
|
2263
|
-
* @version 5.9.0
|
|
2264
|
-
* @description
|
|
2265
|
-
*
|
|
2266
|
-
* Enables the keyword `strict-dynamic` to support the dynamic injection of scripts.
|
|
2267
|
-
*
|
|
2268
|
-
* ```js
|
|
2269
|
-
* import { defineConfig } from 'astro/config';
|
|
2270
|
-
*
|
|
2271
|
-
* export default defineConfig({
|
|
2272
|
-
* experimental: {
|
|
2273
|
-
* csp: {
|
|
2274
|
-
* scriptDirective: {
|
|
2275
|
-
* strictDynamic: true
|
|
2276
|
-
* }
|
|
2277
|
-
* }
|
|
2278
|
-
* }
|
|
2279
|
-
* });
|
|
2280
|
-
* ```
|
|
2281
|
-
*/
|
|
2282
|
-
strictDynamic?: boolean;
|
|
2283
|
-
};
|
|
2284
|
-
/**
|
|
2285
|
-
* @name experimental.csp.directives
|
|
2286
|
-
* @type {string[]}
|
|
2287
|
-
* @default `[]`
|
|
2288
|
-
* @version 5.9.0
|
|
2289
|
-
* @description
|
|
2290
|
-
*
|
|
2291
|
-
* An array of additional directives to add the content of the `Content-Security-Policy` `<meta>` element.
|
|
2292
|
-
*
|
|
2293
|
-
* Use this configuration to add other directive definitions such as `default-src`, `image-src`, etc.
|
|
2294
|
-
*
|
|
2295
|
-
* ##### Example
|
|
2296
|
-
*
|
|
2297
|
-
* You can define a directive to fetch images only from a CDN `cdn.example.com`.
|
|
2298
|
-
*
|
|
2299
|
-
* ```js
|
|
2300
|
-
* export default defineConfig({
|
|
2301
|
-
* experimental: {
|
|
2302
|
-
* csp: {
|
|
2303
|
-
* directives: [
|
|
2304
|
-
* "image-src 'https://cdn.example.com"
|
|
2305
|
-
* ]
|
|
2306
|
-
* }
|
|
2307
|
-
* }
|
|
2308
|
-
* })
|
|
2309
|
-
* ```
|
|
2310
|
-
*
|
|
2311
|
-
*/
|
|
2312
|
-
directives?: CspDirective[];
|
|
2313
|
-
};
|
|
2314
|
-
/**
|
|
2315
|
-
* @name experimental.preserveScriptOrder
|
|
2316
|
-
* @type {boolean}
|
|
2317
|
-
* @default `false`
|
|
2318
|
-
* @version 5.5
|
|
2319
|
-
* @description
|
|
2320
|
-
*
|
|
2321
|
-
* When enabled, `<script>` and `<style>` tags are rendered in the same order as they are defined.
|
|
2322
|
-
*
|
|
2323
|
-
* ## Example
|
|
2324
|
-
*
|
|
2325
|
-
* Consider the following component:
|
|
2326
|
-
*
|
|
2327
|
-
* ```html
|
|
2328
|
-
* <p>I am a component</p>
|
|
2329
|
-
* <style>
|
|
2330
|
-
* body {
|
|
2331
|
-
* background: red;
|
|
2332
|
-
* }
|
|
2333
|
-
* </style>
|
|
2334
|
-
* <style>
|
|
2335
|
-
* body {
|
|
2336
|
-
* background: yellow;
|
|
2337
|
-
* }
|
|
2338
|
-
* </style>
|
|
2339
|
-
* ```
|
|
2340
|
-
*
|
|
2341
|
-
* By default, it will generate a CSS style where `red` will be applied:
|
|
2342
|
-
*
|
|
2343
|
-
* ```css
|
|
2344
|
-
* body {background:#ff0} body {background:red}
|
|
2345
|
-
* ```
|
|
2346
|
-
*
|
|
2347
|
-
* When this new option is set to `true`, the generated CSS style will apply `yellow`:
|
|
2348
|
-
*
|
|
2349
|
-
* ```css
|
|
2350
|
-
* body {background:red} body {background:#ff0}
|
|
2351
|
-
* ```
|
|
2352
|
-
*
|
|
2353
|
-
*/
|
|
2354
|
-
preserveScriptOrder?: boolean;
|
|
2355
|
-
/**
|
|
2356
|
-
* @name experimental.liveContentCollections
|
|
2357
|
-
* @type {boolean}
|
|
2358
|
-
* @default `false`
|
|
2359
|
-
* @version 5.10
|
|
2360
|
-
* @description
|
|
2361
|
-
* Enables the use of live content collections.
|
|
2362
|
-
*
|
|
2363
|
-
*/
|
|
2364
|
-
liveContentCollections?: boolean;
|
|
2365
|
-
/**
|
|
2366
|
-
* @name experimental.staticImportMetaEnv
|
|
2367
|
-
* @type {boolean}
|
|
2368
|
-
* @default `false`
|
|
2369
|
-
* @version 5.13
|
|
2370
|
-
* @description
|
|
2371
|
-
*
|
|
2372
|
-
* Disables replacement of `import.meta.env` values with `process.env` calls and their coercion
|
|
2373
|
-
*
|
|
2374
|
-
* Currently, non-public `import.meta.env` environment variables are replaced by a reference to `process.env`. Additionally, Astro may also convert the value type of your environment variables used through `import.meta.env`, which can prevent access to some values such as the strings `"true"` (which is converted to a boolean value), and `"1"` (which is converted to a number).
|
|
2375
|
-
*
|
|
2376
|
-
* The `experimental.staticImportMetaEnv` flag simplifies Astro's default behavior, making it easier to understand and use. Astro will no longer replace any `import.meta.env` environment variables with a `process.env` call, nor will it coerce values.
|
|
2377
|
-
*
|
|
2378
|
-
* This flag aligns `import.meta.env`'s behavior in Astro with [Vite](https://vite.dev/guide/env-and-mode.html#env-variables).
|
|
2379
|
-
*
|
|
2380
|
-
* See the [experimental static `import.meta.env` docs](https://docs.astro.build/en/reference/experimental-flags/static-import-meta-env/) for more information.
|
|
2381
|
-
*/
|
|
2382
|
-
staticImportMetaEnv?: boolean;
|
|
2383
2332
|
/**
|
|
2384
2333
|
* @name experimental.chromeDevtoolsWorkspace
|
|
2385
2334
|
* @type {boolean}
|