astro 6.0.0-alpha.0 → 6.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro-jsx.d.ts +11 -0
- package/client.d.ts +17 -41
- package/components/Code.astro +2 -2
- package/components/Image.astro +2 -2
- package/components/Picture.astro +1 -1
- package/dist/actions/consts.d.ts +2 -5
- package/dist/actions/consts.js +4 -8
- package/dist/actions/integration.js +2 -4
- package/dist/actions/runtime/client.d.ts +84 -3
- package/dist/actions/runtime/client.js +238 -7
- package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
- package/dist/actions/runtime/entrypoints/client.js +91 -0
- package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
- package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
- package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
- package/dist/actions/runtime/entrypoints/server.js +33 -0
- package/dist/actions/runtime/server.d.ts +11 -18
- package/dist/actions/runtime/server.js +162 -82
- package/dist/actions/runtime/types.d.ts +64 -0
- package/dist/actions/utils.d.ts +2 -2
- package/dist/actions/utils.js +2 -2
- package/dist/actions/vite-plugin-actions.js +58 -47
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/build/generate.js +12 -10
- package/dist/assets/consts.d.ts +1 -0
- package/dist/assets/consts.js +2 -0
- package/dist/assets/endpoint/config.js +2 -2
- package/dist/assets/endpoint/dev.js +7 -6
- package/dist/assets/fonts/config.d.ts +91 -350
- package/dist/assets/fonts/config.js +35 -136
- package/dist/assets/fonts/constants.js +1 -1
- package/dist/assets/fonts/core/dedupe-font-faces.d.ts +2 -0
- package/dist/assets/fonts/core/dedupe-font-faces.js +30 -0
- package/dist/assets/fonts/definitions.d.ts +9 -22
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +8 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.js +20 -0
- package/dist/assets/fonts/infra/build-url-resolver.d.ts +12 -0
- package/dist/assets/fonts/infra/build-url-resolver.js +40 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.d.ts +11 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.js +42 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.d.ts +18 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +71 -0
- package/dist/assets/fonts/infra/data-collector.d.ts +10 -0
- package/dist/assets/fonts/infra/data-collector.js +35 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +14 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.js +37 -0
- package/dist/assets/fonts/infra/dev-url-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/dev-url-resolver.js +29 -0
- package/dist/assets/fonts/infra/font-type-extractor.d.ts +5 -0
- package/dist/assets/fonts/infra/font-type-extractor.js +21 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.d.ts +11 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.js +25 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.d.ts +5 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.js +145 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.js +14 -0
- package/dist/assets/fonts/{implementations/css-renderer.d.ts → infra/minifiable-css-renderer.d.ts} +8 -3
- package/dist/assets/fonts/{implementations/css-renderer.js → infra/minifiable-css-renderer.js} +12 -10
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/remote-font-provider-resolver.js +49 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.js +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +22 -0
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +6 -0
- package/dist/assets/fonts/{implementations → infra}/system-fallbacks-provider.js +8 -11
- package/dist/assets/fonts/infra/unstorage-fs-storage.d.ts +11 -0
- package/dist/assets/fonts/infra/unstorage-fs-storage.js +26 -0
- package/dist/assets/fonts/infra/url-proxy.d.ts +16 -0
- package/dist/assets/fonts/infra/url-proxy.js +50 -0
- package/dist/assets/fonts/infra/xxhash-hasher.d.ts +7 -0
- package/dist/assets/fonts/infra/xxhash-hasher.js +18 -0
- package/dist/assets/fonts/orchestrate.d.ts +1 -2
- package/dist/assets/fonts/orchestrate.js +50 -17
- package/dist/assets/fonts/providers/index.d.ts +6 -24
- package/dist/assets/fonts/types.d.ts +138 -8
- package/dist/assets/fonts/utils.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +66 -65
- package/dist/assets/services/noop.js +11 -1
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +55 -51
- package/dist/assets/types.d.ts +2 -2
- package/dist/assets/utils/index.d.ts +1 -3
- package/dist/assets/utils/index.js +4 -9
- package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
- package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -6
- package/dist/assets/utils/svg.d.ts +2 -1
- package/dist/assets/utils/svg.js +30 -4
- package/dist/assets/vite-plugin-assets.js +36 -19
- package/dist/cli/add/index.js +21 -13
- package/dist/cli/create-key/infra/crypto-key-generator.d.ts +3 -1
- package/dist/cli/create-key/infra/crypto-key-generator.js +7 -9
- package/dist/cli/definitions.d.ts +19 -2
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/docs/core/open-docs.d.ts +5 -3
- package/dist/cli/docs/core/open-docs.js +2 -9
- package/dist/cli/docs/definitions.d.ts +3 -11
- package/dist/cli/docs/domain/cloud-ide.d.ts +1 -0
- package/dist/cli/docs/domain/cloud-ide.js +0 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.d.ts +5 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.js +6 -0
- package/dist/cli/flags.d.ts +1 -0
- package/dist/cli/index.js +78 -21
- package/dist/cli/info/core/get-package-manager.d.ts +8 -0
- package/dist/cli/info/core/get-package-manager.js +37 -0
- package/dist/cli/info/core/info.d.ts +21 -0
- package/dist/cli/info/core/info.js +21 -0
- package/dist/cli/info/definitions.d.ts +30 -0
- package/dist/cli/info/definitions.js +0 -0
- package/dist/cli/info/domain/debug-info.d.ts +1 -0
- package/dist/cli/info/domain/debug-info.js +0 -0
- package/dist/cli/info/infra/bun-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/bun-package-manager.js +9 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.d.ts +10 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.js +36 -0
- package/dist/cli/info/infra/cli-clipboard.d.ts +13 -0
- package/dist/cli/info/infra/cli-clipboard.js +78 -0
- package/dist/cli/info/infra/cli-debug-info-provider.d.ts +15 -0
- package/dist/cli/info/infra/cli-debug-info-provider.js +57 -0
- package/dist/cli/info/infra/dev-debug-info-provider.d.ts +18 -0
- package/dist/cli/info/infra/dev-debug-info-provider.js +36 -0
- package/dist/cli/info/infra/noop-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/noop-package-manager.js +9 -0
- package/dist/cli/info/infra/npm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/npm-package-manager.js +32 -0
- package/dist/cli/info/infra/pnpm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/pnpm-package-manager.js +33 -0
- package/dist/cli/info/infra/process-node-version-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-node-version-provider.js +6 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.js +7 -0
- package/dist/cli/info/infra/prompts-prompt.d.ts +11 -0
- package/dist/cli/info/infra/prompts-prompt.js +25 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.d.ts +10 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.js +29 -0
- package/dist/cli/info/infra/yarn-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/yarn-package-manager.js +34 -0
- package/dist/cli/infra/build-time-astro-version-provider.d.ts +3 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +4 -8
- package/dist/cli/infra/cli-command-runner.d.ts +7 -4
- package/dist/cli/infra/cli-command-runner.js +14 -10
- package/dist/cli/infra/logger-help-display.d.ts +11 -7
- package/dist/cli/infra/logger-help-display.js +62 -50
- package/dist/cli/infra/passthrough-text-styler.d.ts +9 -0
- package/dist/cli/infra/passthrough-text-styler.js +23 -0
- package/dist/cli/infra/piccolore-text-styler.d.ts +2 -0
- package/dist/cli/infra/piccolore-text-styler.js +5 -0
- package/dist/cli/infra/process-operating-system-provider.d.ts +6 -0
- package/dist/cli/infra/process-operating-system-provider.js +12 -0
- package/dist/cli/infra/tinyexec-command-executor.d.ts +6 -0
- package/dist/cli/infra/tinyexec-command-executor.js +34 -0
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preferences/index.js +6 -2
- package/dist/cli/preview/index.js +1 -1
- package/dist/cli/utils/format-version.js +1 -1
- package/dist/config/index.js +9 -5
- package/dist/container/index.js +19 -13
- package/dist/container/pipeline.d.ts +2 -1
- package/dist/container/pipeline.js +4 -11
- package/dist/container/vite-plugin-container.js +7 -4
- package/dist/content/config.d.ts +34 -40
- package/dist/content/content-layer.js +13 -18
- package/dist/content/loaders/errors.d.ts +3 -3
- package/dist/content/loaders/errors.js +5 -2
- package/dist/content/loaders/glob.js +6 -1
- package/dist/content/loaders/types.d.ts +11 -4
- package/dist/content/runtime-assets.d.ts +4 -4
- package/dist/content/runtime-assets.js +2 -2
- package/dist/content/runtime.d.ts +21 -20
- package/dist/content/runtime.js +14 -16
- package/dist/content/types-generator.js +90 -54
- package/dist/content/utils.d.ts +46 -338
- package/dist/content/utils.js +52 -50
- package/dist/content/vite-plugin-content-assets.d.ts +12 -4
- package/dist/content/vite-plugin-content-assets.js +152 -102
- package/dist/content/vite-plugin-content-imports.js +58 -40
- package/dist/content/vite-plugin-content-virtual-mod.js +95 -77
- package/dist/core/app/app.d.ts +5 -0
- package/dist/core/app/app.js +13 -0
- package/dist/core/app/base.d.ts +132 -0
- package/dist/core/app/base.js +448 -0
- package/dist/core/app/common.d.ts +6 -2
- package/dist/core/app/common.js +60 -33
- package/dist/core/app/dev/app.d.ts +15 -0
- package/dist/core/app/dev/app.js +86 -0
- package/dist/core/app/dev/pipeline.d.ts +13 -0
- package/dist/core/app/dev/pipeline.js +123 -0
- package/dist/core/app/entrypoint.d.ts +2 -0
- package/dist/core/app/entrypoint.js +15 -0
- package/dist/core/app/index.d.ts +7 -99
- package/dist/core/app/index.js +20 -486
- package/dist/core/app/logging.d.ts +3 -0
- package/dist/core/app/logging.js +11 -0
- package/dist/core/app/manifest.d.ts +9 -0
- package/dist/core/app/manifest.js +107 -0
- package/dist/core/app/middlewares.js +1 -1
- package/dist/core/app/node.js +14 -13
- package/dist/core/app/pipeline.d.ts +6 -5
- package/dist/core/app/pipeline.js +65 -49
- package/dist/core/app/types.d.ts +58 -22
- package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
- package/dist/core/app/validate-forwarded-headers.js +60 -0
- package/dist/core/base-pipeline.d.ts +22 -14
- package/dist/core/base-pipeline.js +54 -6
- package/dist/core/build/app.d.ts +13 -0
- package/dist/core/build/app.js +38 -0
- package/dist/core/build/common.d.ts +1 -1
- package/dist/core/build/common.js +2 -2
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +96 -204
- package/dist/core/build/graph.js +2 -2
- package/dist/core/build/index.js +11 -16
- package/dist/core/build/internal.d.ts +2 -27
- package/dist/core/build/internal.js +1 -44
- package/dist/core/build/page-data.js +1 -1
- package/dist/core/build/pipeline.d.ts +15 -26
- package/dist/core/build/pipeline.js +106 -170
- package/dist/core/build/plugins/index.d.ts +4 -2
- package/dist/core/build/plugins/index.js +17 -23
- package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
- package/dist/core/build/plugins/plugin-analyzer.js +5 -13
- package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
- package/dist/core/build/plugins/plugin-component-entry.js +15 -17
- package/dist/core/build/plugins/plugin-css.d.ts +2 -2
- package/dist/core/build/plugins/plugin-css.js +90 -41
- package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
- package/dist/core/build/plugins/plugin-internals.js +24 -18
- package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
- package/dist/core/build/plugins/plugin-manifest.js +89 -129
- package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
- package/dist/core/build/plugins/plugin-middleware.js +5 -7
- package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
- package/dist/core/build/plugins/plugin-noop.js +35 -0
- package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
- package/dist/core/build/plugins/plugin-prerender.js +7 -64
- package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
- package/dist/core/build/plugins/plugin-scripts.js +5 -13
- package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
- package/dist/core/build/plugins/plugin-ssr.js +85 -139
- package/dist/core/build/plugins/util.d.ts +1 -25
- package/dist/core/build/plugins/util.js +0 -47
- package/dist/core/build/runtime.d.ts +26 -0
- package/dist/core/build/runtime.js +45 -0
- package/dist/core/build/static-build.d.ts +2 -2
- package/dist/core/build/static-build.js +181 -155
- package/dist/core/build/types.d.ts +1 -2
- package/dist/core/build/util.d.ts +0 -1
- package/dist/core/build/util.js +0 -7
- package/dist/core/compile/compile.d.ts +2 -3
- package/dist/core/compile/compile.js +2 -2
- package/dist/core/config/config.js +3 -3
- package/dist/core/config/index.d.ts +0 -1
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +336 -1434
- package/dist/core/config/schemas/base.js +42 -41
- package/dist/core/config/schemas/refined.d.ts +2 -2
- package/dist/core/config/schemas/refined.js +1 -1
- package/dist/core/config/schemas/relative.d.ts +672 -1761
- package/dist/core/config/schemas/relative.js +4 -4
- package/dist/core/config/settings.d.ts +3 -3
- package/dist/core/config/settings.js +5 -6
- package/dist/core/config/validate.js +13 -2
- package/dist/core/config/vite-load.js +12 -3
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +20 -1
- package/dist/core/create-vite.d.ts +2 -6
- package/dist/core/create-vite.js +35 -43
- package/dist/core/csp/common.d.ts +1 -1
- package/dist/core/csp/common.js +1 -1
- package/dist/core/csp/config.d.ts +8 -4
- package/dist/core/csp/config.js +1 -1
- package/dist/core/csp/runtime.d.ts +11 -0
- package/dist/core/csp/runtime.js +35 -0
- package/dist/core/dev/container.js +13 -7
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +15 -6
- package/dist/core/errors/dev/runtime.d.ts +6 -0
- package/dist/core/errors/dev/runtime.js +27 -0
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +32 -16
- package/dist/core/errors/errors-data.js +23 -10
- package/dist/core/errors/errors.d.ts +3 -3
- package/dist/core/errors/errors.js +8 -8
- package/dist/core/errors/zod-error-map.d.ts +2 -2
- package/dist/core/errors/zod-error-map.js +26 -24
- package/dist/core/logger/core.js +1 -1
- package/dist/core/messages.d.ts +2 -2
- package/dist/core/messages.js +3 -3
- package/dist/core/middleware/callMiddleware.js +1 -1
- package/dist/core/middleware/defineMiddleware.d.ts +2 -0
- package/dist/core/middleware/defineMiddleware.js +6 -0
- package/dist/core/middleware/index.d.ts +3 -3
- package/dist/core/middleware/index.js +1 -3
- package/dist/core/middleware/sequence.js +4 -4
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +41 -24
- package/dist/core/module-loader/index.d.ts +2 -2
- package/dist/core/module-loader/index.js +1 -1
- package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
- package/dist/core/module-loader/{loader.js → runner.js} +3 -0
- package/dist/core/module-loader/vite.d.ts +3 -2
- package/dist/core/module-loader/vite.js +17 -13
- package/dist/core/preview/index.js +20 -3
- package/dist/core/preview/static-preview-server.js +11 -0
- package/dist/core/redirects/component.js +1 -2
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +1 -3
- package/dist/core/redirects/render.js +5 -2
- package/dist/core/render/paginate.d.ts +1 -1
- package/dist/core/render/paginate.js +8 -6
- package/dist/core/render/params-and-props.d.ts +2 -0
- package/dist/core/render/params-and-props.js +19 -6
- package/dist/core/render/route-cache.d.ts +3 -2
- package/dist/core/render/route-cache.js +6 -5
- package/dist/core/render-context.d.ts +6 -4
- package/dist/core/render-context.js +66 -25
- package/dist/core/routing/astro-designed-error-pages.js +2 -2
- package/dist/core/routing/default.js +1 -1
- package/dist/core/routing/helpers.d.ts +22 -0
- package/dist/core/routing/helpers.js +25 -0
- package/dist/core/routing/index.d.ts +1 -1
- package/dist/core/routing/index.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +6 -1
- package/dist/core/routing/manifest/create.js +11 -14
- package/dist/core/routing/manifest/generator.d.ts +3 -1
- package/dist/core/routing/params.d.ts +2 -1
- package/dist/core/routing/params.js +3 -2
- package/dist/core/server-islands/endpoint.js +40 -19
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +106 -46
- package/dist/core/session/vite-plugin.d.ts +6 -0
- package/dist/core/session/vite-plugin.js +59 -0
- package/dist/core/session.d.ts +4 -2
- package/dist/core/session.js +8 -48
- package/dist/core/sync/index.d.ts +2 -5
- package/dist/core/sync/index.js +34 -22
- package/dist/core/util/pathname.d.ts +10 -0
- package/dist/core/util/pathname.js +17 -0
- package/dist/core/util.d.ts +2 -2
- package/dist/core/util.js +3 -3
- package/dist/core/viteUtils.d.ts +1 -0
- package/dist/core/viteUtils.js +2 -0
- package/dist/entrypoints/legacy.d.ts +2 -0
- package/dist/entrypoints/legacy.js +12 -0
- package/dist/entrypoints/prerender.d.ts +4 -0
- package/dist/entrypoints/prerender.js +7 -0
- package/dist/env/schema.d.ts +21 -251
- package/dist/env/schema.js +6 -3
- package/dist/env/vite-plugin-env.js +61 -42
- package/dist/env/vite-plugin-import-meta-env.js +45 -37
- package/dist/environments.d.ts +3 -0
- package/dist/environments.js +11 -0
- package/dist/events/error.d.ts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -6
- package/dist/i18n/utils.js +1 -63
- package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
- package/dist/i18n/vite-plugin-i18n.js +8 -26
- package/dist/integrations/hooks.d.ts +1 -1
- package/dist/integrations/hooks.js +10 -7
- package/dist/manifest/serialized.d.ts +9 -0
- package/dist/manifest/serialized.js +150 -0
- package/dist/manifest/virtual-module.d.ts +1 -4
- package/dist/manifest/virtual-module.js +100 -91
- package/dist/preferences/index.d.ts +1 -2
- package/dist/prefetch/vite-plugin-prefetch.js +20 -9
- package/dist/prerender/routing.d.ts +5 -7
- package/dist/prerender/routing.js +6 -17
- package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/radio-checkbox.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +2 -2
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/render/server-islands.js +5 -4
- package/dist/runtime/server/transition.d.ts +1 -0
- package/dist/template/4xx.js +3 -1
- package/dist/toolbar/vite-plugin-dev-toolbar.js +13 -7
- package/dist/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/swap-functions.js +4 -0
- package/dist/transitions/vite-plugin-transitions.js +35 -22
- package/dist/types/astro.d.ts +8 -6
- package/dist/types/public/config.d.ts +438 -289
- package/dist/types/public/context.d.ts +3 -4
- package/dist/types/public/extendables.d.ts +2 -0
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +23 -1
- package/dist/types/public/internal.d.ts +1 -16
- package/dist/types/public/preview.d.ts +6 -0
- package/dist/virtual-modules/i18n.d.ts +10 -2
- package/dist/virtual-modules/i18n.js +16 -7
- package/dist/virtual-modules/live-config.d.ts +1 -1
- package/dist/virtual-modules/live-config.js +1 -1
- package/dist/virtual-modules/middleware.d.ts +2 -1
- package/dist/virtual-modules/middleware.js +2 -1
- package/dist/vite-plugin-adapter-config/index.js +12 -5
- package/dist/vite-plugin-app/app.d.ts +47 -0
- package/dist/vite-plugin-app/app.js +410 -0
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
- package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
- package/dist/vite-plugin-app/index.d.ts +3 -0
- package/dist/vite-plugin-app/index.js +19 -0
- package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +6 -7
- package/dist/vite-plugin-app/pipeline.js +166 -0
- package/dist/vite-plugin-astro/index.js +215 -170
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +3 -4
- package/dist/vite-plugin-astro-server/error.js +2 -5
- package/dist/vite-plugin-astro-server/index.d.ts +0 -1
- package/dist/vite-plugin-astro-server/index.js +0 -2
- package/dist/vite-plugin-astro-server/metadata.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +3 -7
- package/dist/vite-plugin-astro-server/plugin.js +40 -108
- package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
- package/dist/vite-plugin-astro-server/util.d.ts +2 -2
- package/dist/vite-plugin-astro-server/util.js +2 -1
- package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
- package/dist/vite-plugin-astro-server/vite.js +7 -7
- package/dist/vite-plugin-chromedevtools/index.d.ts +7 -0
- package/dist/vite-plugin-chromedevtools/index.js +47 -0
- package/dist/vite-plugin-config-alias/index.js +59 -44
- package/dist/vite-plugin-css/index.d.ts +18 -0
- package/dist/vite-plugin-css/index.js +155 -0
- package/dist/vite-plugin-css/util.d.ts +5 -0
- package/dist/vite-plugin-css/util.js +8 -0
- package/dist/vite-plugin-environment/index.d.ts +15 -0
- package/dist/vite-plugin-environment/index.js +77 -0
- package/dist/vite-plugin-fileurl/index.js +6 -3
- package/dist/vite-plugin-head/index.d.ts +1 -2
- package/dist/vite-plugin-head/index.js +42 -58
- package/dist/vite-plugin-hmr-reload/index.js +2 -1
- package/dist/vite-plugin-html/index.d.ts +7 -4
- package/dist/vite-plugin-html/index.js +5 -3
- package/dist/vite-plugin-load-fallback/index.js +12 -5
- package/dist/vite-plugin-markdown/index.js +27 -8
- package/dist/vite-plugin-overlay/index.d.ts +2 -0
- package/dist/vite-plugin-overlay/index.js +21 -0
- package/dist/vite-plugin-pages/const.d.ts +2 -0
- package/dist/vite-plugin-pages/const.js +6 -0
- package/dist/vite-plugin-pages/index.d.ts +2 -0
- package/dist/vite-plugin-pages/index.js +7 -0
- package/dist/vite-plugin-pages/page.d.ts +7 -0
- package/dist/vite-plugin-pages/page.js +54 -0
- package/dist/vite-plugin-pages/pages.d.ts +8 -0
- package/dist/vite-plugin-pages/pages.js +63 -0
- package/dist/vite-plugin-pages/util.d.ts +8 -0
- package/dist/vite-plugin-pages/util.js +15 -0
- package/dist/vite-plugin-renderers/index.d.ts +9 -0
- package/dist/vite-plugin-renderers/index.js +45 -0
- package/dist/vite-plugin-routes/index.d.ts +14 -0
- package/dist/vite-plugin-routes/index.js +181 -0
- package/dist/vite-plugin-scripts/index.js +27 -25
- package/dist/vite-plugin-scripts/page-ssr.js +3 -2
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +2 -1
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +35 -32
- package/templates/content/module.mjs +1 -0
- package/templates/content/types.d.ts +24 -11
- package/types/actions.d.ts +1 -5
- package/types/content.d.ts +9 -11
- package/types/transitions.d.ts +25 -0
- package/dist/actions/loadActions.d.ts +0 -8
- package/dist/actions/loadActions.js +0 -13
- package/dist/actions/runtime/route.d.ts +0 -2
- package/dist/actions/runtime/shared.d.ts +0 -60
- package/dist/actions/runtime/shared.js +0 -296
- package/dist/actions/runtime/utils.d.ts +0 -25
- package/dist/actions/runtime/utils.js +0 -16
- package/dist/actions/runtime/virtual.d.ts +0 -4
- package/dist/actions/runtime/virtual.js +0 -127
- package/dist/assets/fonts/implementations/data-collector.d.ts +0 -3
- package/dist/assets/fonts/implementations/data-collector.js +0 -21
- package/dist/assets/fonts/implementations/error-handler.d.ts +0 -2
- package/dist/assets/fonts/implementations/error-handler.js +0 -41
- package/dist/assets/fonts/implementations/font-fetcher.d.ts +0 -8
- package/dist/assets/fonts/implementations/font-fetcher.js +0 -34
- package/dist/assets/fonts/implementations/font-file-reader.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-file-reader.js +0 -26
- package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/font-metrics-resolver.js +0 -66
- package/dist/assets/fonts/implementations/font-type-extractor.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-type-extractor.js +0 -22
- package/dist/assets/fonts/implementations/hasher.d.ts +0 -2
- package/dist/assets/fonts/implementations/hasher.js +0 -14
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.d.ts +0 -2
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.js +0 -147
- package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/local-provider-url-resolver.js +0 -17
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +0 -20
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +0 -47
- package/dist/assets/fonts/implementations/storage.d.ts +0 -4
- package/dist/assets/fonts/implementations/storage.js +0 -14
- package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +0 -28
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.d.ts +0 -8
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.js +0 -39
- package/dist/assets/fonts/implementations/url-proxy.d.ts +0 -7
- package/dist/assets/fonts/implementations/url-proxy.js +0 -31
- package/dist/assets/fonts/implementations/url-resolver.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-resolver.js +0 -55
- package/dist/assets/utils/node/emitAsset.d.ts +0 -15
- package/dist/assets/utils/remotePattern.d.ts +0 -3
- package/dist/assets/utils/remotePattern.js +0 -16
- package/dist/assets/utils/transformToPath.js +0 -32
- package/dist/cli/docs/domains/platform.d.ts +0 -1
- package/dist/cli/docs/infra/process-platform-provider.d.ts +0 -2
- package/dist/cli/docs/infra/process-platform-provider.js +0 -11
- package/dist/cli/docs/infra/tinyexec-command-executor.d.ts +0 -2
- package/dist/cli/docs/infra/tinyexec-command-executor.js +0 -30
- package/dist/cli/info/index.d.ts +0 -12
- package/dist/cli/info/index.js +0 -267
- package/dist/cli/infra/picocolors-text-styler.d.ts +0 -2
- package/dist/cli/infra/picocolors-text-styler.js +0 -7
- package/dist/core/build/css-asset-name.d.ts +0 -9
- package/dist/core/build/css-asset-name.js +0 -89
- package/dist/core/build/plugin.d.ts +0 -43
- package/dist/core/build/plugin.js +0 -61
- package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
- package/dist/core/build/plugins/plugin-actions.js +0 -16
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +0 -33
- package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
- package/dist/core/build/plugins/plugin-pages.js +0 -66
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
- package/dist/core/build/plugins/plugin-renderers.js +0 -54
- package/dist/core/middleware/loadMiddleware.d.ts +0 -7
- package/dist/core/middleware/loadMiddleware.js +0 -14
- package/dist/core/redirects/helpers.d.ts +0 -7
- package/dist/core/redirects/helpers.js +0 -10
- package/dist/core/routing/manifest/serialization.d.ts +0 -5
- package/dist/core/routing/manifest/serialization.js +0 -37
- package/dist/prerender/metadata.d.ts +0 -8
- package/dist/prerender/metadata.js +0 -18
- package/dist/vite-plugin-astro-server/css.d.ts +0 -13
- package/dist/vite-plugin-astro-server/css.js +0 -48
- package/dist/vite-plugin-astro-server/pipeline.js +0 -161
- package/dist/vite-plugin-astro-server/request.d.ts +0 -14
- package/dist/vite-plugin-astro-server/request.js +0 -66
- package/dist/vite-plugin-astro-server/route.d.ts +0 -25
- package/dist/vite-plugin-astro-server/route.js +0 -283
- package/dist/vite-plugin-scanner/index.d.ts +0 -10
- package/dist/vite-plugin-scanner/index.js +0 -87
- package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
- package/dist/vite-plugin-ssr-manifest/index.js +0 -26
- /package/dist/{cli/docs/domains/platform.js → actions/runtime/types.js} +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.js +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.js +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.js +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.js +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
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
|
-
import type {
|
|
4
|
+
import type { Config as SvgoConfig } from 'svgo';
|
|
5
|
+
import type { BuiltinDriverName, BuiltinDriverOptions, Storage } from 'unstorage';
|
|
5
6
|
import type { UserConfig as OriginalViteUserConfig, SSROptions as ViteSSROptions } from 'vite';
|
|
6
7
|
import type { AstroFontProvider, FontFamily } from '../../assets/fonts/types.js';
|
|
7
8
|
import type { ImageFit, ImageLayout } from '../../assets/types.js';
|
|
@@ -18,8 +19,17 @@ export type Locales = (string | {
|
|
|
18
19
|
path: string;
|
|
19
20
|
})[];
|
|
20
21
|
export type { AstroFontProvider as FontProvider };
|
|
21
|
-
export type { CspAlgorithm };
|
|
22
|
+
export type { CspAlgorithm, CspHash };
|
|
22
23
|
export type { RemotePattern };
|
|
24
|
+
export type CspStyleDirective = {
|
|
25
|
+
hashes?: CspHash[];
|
|
26
|
+
resources?: string[];
|
|
27
|
+
};
|
|
28
|
+
export type CspScriptDirective = {
|
|
29
|
+
hashes?: CspHash[];
|
|
30
|
+
resources?: string[];
|
|
31
|
+
strictDynamic?: boolean;
|
|
32
|
+
};
|
|
23
33
|
type NormalizeLocales<T extends Locales> = {
|
|
24
34
|
[K in keyof T]: T[K] extends string ? T[K] : T[K] extends {
|
|
25
35
|
codes: Array<string>;
|
|
@@ -136,11 +146,7 @@ interface TestSessionConfig extends CommonSessionConfig {
|
|
|
136
146
|
export type SessionConfig<TDriver extends SessionDriverName> = [
|
|
137
147
|
TDriver
|
|
138
148
|
] extends [never] ? CustomSessionConfig : TDriver extends keyof BuiltinDriverOptions ? BuiltinSessionConfig<TDriver> : TDriver extends 'test' ? TestSessionConfig : CustomSessionConfig;
|
|
139
|
-
export type ResolvedSessionConfig<TDriver extends SessionDriverName> = SessionConfig<TDriver
|
|
140
|
-
driverModule?: () => Promise<{
|
|
141
|
-
default: () => Driver;
|
|
142
|
-
}>;
|
|
143
|
-
};
|
|
149
|
+
export type ResolvedSessionConfig<TDriver extends SessionDriverName> = SessionConfig<TDriver>;
|
|
144
150
|
export interface ViteUserConfig extends OriginalViteUserConfig {
|
|
145
151
|
ssr?: ViteSSROptions;
|
|
146
152
|
}
|
|
@@ -479,6 +485,58 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
479
485
|
* 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.
|
|
480
486
|
*/
|
|
481
487
|
scopedStyleStrategy?: 'where' | 'class' | 'attribute';
|
|
488
|
+
/**
|
|
489
|
+
* @docs
|
|
490
|
+
* @name prerenderConflictBehavior
|
|
491
|
+
* @type {'error' | 'warn' | 'ignore'}
|
|
492
|
+
* @default `'warn'`
|
|
493
|
+
* @version 6.0
|
|
494
|
+
* @description
|
|
495
|
+
* Determines the default behavior when two routes generate the same prerendered URL:
|
|
496
|
+
* - `error`: fail the build and display an error, forcing you to resolve the conflict
|
|
497
|
+
* - `warn` (default): log a warning when conflicts occur, but build using the highest-priority route
|
|
498
|
+
* - `ignore`: silently build using the highest-priority route when conflicts occur
|
|
499
|
+
*
|
|
500
|
+
* ```js
|
|
501
|
+
* {
|
|
502
|
+
* prerenderConflictBehavior: 'error'
|
|
503
|
+
* }
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
prerenderConflictBehavior?: 'error' | 'warn' | 'ignore';
|
|
507
|
+
/**
|
|
508
|
+
* @docs
|
|
509
|
+
* @name vite
|
|
510
|
+
* @typeraw {ViteUserConfig}
|
|
511
|
+
* @description
|
|
512
|
+
*
|
|
513
|
+
* Pass additional configuration options to Vite. Useful when Astro doesn't support some advanced configuration that you may need.
|
|
514
|
+
*
|
|
515
|
+
* View the full `vite` configuration object documentation on [vite.dev](https://vite.dev/config/).
|
|
516
|
+
*
|
|
517
|
+
* #### Examples
|
|
518
|
+
*
|
|
519
|
+
* ```js
|
|
520
|
+
* {
|
|
521
|
+
* vite: {
|
|
522
|
+
* ssr: {
|
|
523
|
+
* // Example: Force a broken package to skip SSR processing, if needed
|
|
524
|
+
* external: ['broken-npm-package'],
|
|
525
|
+
* }
|
|
526
|
+
* }
|
|
527
|
+
* }
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* ```js
|
|
531
|
+
* {
|
|
532
|
+
* vite: {
|
|
533
|
+
* // Example: Add custom vite plugins directly to your Astro project
|
|
534
|
+
* plugins: [myPlugin()],
|
|
535
|
+
* }
|
|
536
|
+
* }
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
vite?: ViteUserConfig;
|
|
482
540
|
/**
|
|
483
541
|
* @docs
|
|
484
542
|
* @name security
|
|
@@ -562,40 +620,337 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
562
620
|
* When not configured, `X-Forwarded-Host` headers are not trusted and will be ignored.
|
|
563
621
|
*/
|
|
564
622
|
allowedDomains?: Partial<RemotePattern>[];
|
|
623
|
+
/**
|
|
624
|
+
* @docs
|
|
625
|
+
* @name security.csp
|
|
626
|
+
* @kind h4
|
|
627
|
+
* @type {boolean | object}
|
|
628
|
+
* @default `false`
|
|
629
|
+
* @version 6.0.0
|
|
630
|
+
* @description
|
|
631
|
+
*
|
|
632
|
+
* 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.
|
|
633
|
+
*
|
|
634
|
+
* 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.
|
|
635
|
+
*
|
|
636
|
+
* This feature comes with some limitations:
|
|
637
|
+
* - 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).
|
|
638
|
+
* - [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.
|
|
639
|
+
* - Shiki isn't currently supported. By design, Shiki functions using inline styles.
|
|
640
|
+
*
|
|
641
|
+
* :::note
|
|
642
|
+
* 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`.
|
|
643
|
+
* :::
|
|
644
|
+
*
|
|
645
|
+
* When enabled, Astro will add a `<meta>` element inside the `<head>` element of each page.
|
|
646
|
+
* 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.
|
|
647
|
+
*
|
|
648
|
+
* ```html
|
|
649
|
+
*
|
|
650
|
+
* <head>
|
|
651
|
+
* <meta
|
|
652
|
+
* http-equiv="content-security-policy"
|
|
653
|
+
* content="
|
|
654
|
+
* script-src 'self' 'sha256-somehash';
|
|
655
|
+
* style-src 'self' 'sha256-somehash';
|
|
656
|
+
* "
|
|
657
|
+
* >
|
|
658
|
+
* </head>
|
|
659
|
+
* ```
|
|
660
|
+
*
|
|
661
|
+
* You can further customize the `<meta>` element by enabling this feature with a configuration object that includes additional options.
|
|
662
|
+
*/
|
|
663
|
+
csp?: boolean | {
|
|
664
|
+
/**
|
|
665
|
+
* @docs
|
|
666
|
+
* @name security.csp.algorithm
|
|
667
|
+
* @kind h5
|
|
668
|
+
* @type {"SHA-256" | "SHA-384" | "SHA-512"}
|
|
669
|
+
* @default `'SHA-256'`
|
|
670
|
+
* @version 6.0.0
|
|
671
|
+
* @description
|
|
672
|
+
*
|
|
673
|
+
* 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.
|
|
674
|
+
*
|
|
675
|
+
* ```js title="astro.config.mjs"
|
|
676
|
+
* import { defineConfig } from 'astro/config';
|
|
677
|
+
*
|
|
678
|
+
* export default defineConfig({
|
|
679
|
+
* security: {
|
|
680
|
+
* csp: {
|
|
681
|
+
* algorithm: 'SHA-512'
|
|
682
|
+
* }
|
|
683
|
+
* }
|
|
684
|
+
* });
|
|
685
|
+
* ```
|
|
686
|
+
*/
|
|
687
|
+
algorithm?: CspAlgorithm;
|
|
688
|
+
/**
|
|
689
|
+
* @docs
|
|
690
|
+
* @name security.csp.directives
|
|
691
|
+
* @kind h5
|
|
692
|
+
* @type {string[]}
|
|
693
|
+
* @default `[]`
|
|
694
|
+
* @version 6.0.0
|
|
695
|
+
* @description
|
|
696
|
+
*
|
|
697
|
+
* 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.
|
|
698
|
+
*
|
|
699
|
+
* ```js title="astro.config.mjs"
|
|
700
|
+
* import { defineConfig } from 'astro/config';
|
|
701
|
+
*
|
|
702
|
+
* export default defineConfig({
|
|
703
|
+
* security: {
|
|
704
|
+
* csp: {
|
|
705
|
+
* directives: [
|
|
706
|
+
* "default-src 'self'",
|
|
707
|
+
* "img-src 'self' https://images.cdn.example.com"
|
|
708
|
+
* ]
|
|
709
|
+
* }
|
|
710
|
+
* }
|
|
711
|
+
* });
|
|
712
|
+
* ```
|
|
713
|
+
* After the build, the `<meta>` element will add your directives into the `content` value alongside Astro's default directives:
|
|
714
|
+
*
|
|
715
|
+
* ```html
|
|
716
|
+
* <meta
|
|
717
|
+
* http-equiv="content-security-policy"
|
|
718
|
+
* content="
|
|
719
|
+
* default-src 'self';
|
|
720
|
+
* img-src 'self' 'https://images.cdn.example.com';
|
|
721
|
+
* script-src 'self' 'sha256-somehash';
|
|
722
|
+
* style-src 'self' 'sha256-somehash';
|
|
723
|
+
* "
|
|
724
|
+
* >
|
|
725
|
+
* ```
|
|
726
|
+
*/
|
|
727
|
+
directives?: CspDirective[];
|
|
728
|
+
/**
|
|
729
|
+
* @docs
|
|
730
|
+
* @name security.csp.styleDirective
|
|
731
|
+
* @kind h5
|
|
732
|
+
* @type {CspStyleDirective}
|
|
733
|
+
* @default `undefined`
|
|
734
|
+
* @version 6.0.0
|
|
735
|
+
* @description
|
|
736
|
+
*
|
|
737
|
+
* 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. */
|
|
738
|
+
styleDirective?: {
|
|
739
|
+
/**
|
|
740
|
+
* @docs
|
|
741
|
+
* @name security.csp.styleDirective.hashes
|
|
742
|
+
* @kind h6
|
|
743
|
+
* @type {CspHash[]}
|
|
744
|
+
* @default `[]`
|
|
745
|
+
* @version 6.0.0
|
|
746
|
+
* @description
|
|
747
|
+
*
|
|
748
|
+
* A list of additional hashes to be rendered.
|
|
749
|
+
*
|
|
750
|
+
* 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.
|
|
751
|
+
*
|
|
752
|
+
* ```js title="astro.config.mjs"
|
|
753
|
+
* import { defineConfig } from 'astro/config';
|
|
754
|
+
*
|
|
755
|
+
* export default defineConfig({
|
|
756
|
+
* security: {
|
|
757
|
+
* csp: {
|
|
758
|
+
* styleDirective: {
|
|
759
|
+
* hashes: [
|
|
760
|
+
* "sha384-styleHash",
|
|
761
|
+
* "sha512-styleHash",
|
|
762
|
+
* "sha256-styleHash"
|
|
763
|
+
* ]
|
|
764
|
+
* }
|
|
765
|
+
* }
|
|
766
|
+
* }
|
|
767
|
+
* });
|
|
768
|
+
* ```
|
|
769
|
+
*
|
|
770
|
+
* After the build, the `<meta>` element will include your additional hashes in the `style-src` directives:
|
|
771
|
+
*
|
|
772
|
+
* ```html
|
|
773
|
+
* <meta
|
|
774
|
+
* http-equiv="content-security-policy"
|
|
775
|
+
* content="
|
|
776
|
+
* style-src 'self' 'sha384-styleHash' 'sha512-styleHash' 'sha256-styleHash' 'sha256-generatedByAstro';
|
|
777
|
+
* "
|
|
778
|
+
* >
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
|
+
hashes?: CspHash[];
|
|
782
|
+
/**
|
|
783
|
+
* @docs
|
|
784
|
+
* @name security.csp.styleDirective.resources
|
|
785
|
+
* @kind h6
|
|
786
|
+
* @type {string[]}
|
|
787
|
+
* @default `[]`
|
|
788
|
+
* @version 6.0.0
|
|
789
|
+
* @description
|
|
790
|
+
*
|
|
791
|
+
* 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.
|
|
792
|
+
*
|
|
793
|
+
* ```js title="astro.config.mjs"
|
|
794
|
+
* import { defineConfig } from 'astro/config';
|
|
795
|
+
*
|
|
796
|
+
* export default defineConfig({
|
|
797
|
+
* security: {
|
|
798
|
+
* csp: {
|
|
799
|
+
* styleDirective: {
|
|
800
|
+
* resources: [
|
|
801
|
+
* "'self'",
|
|
802
|
+
* "https://styles.cdn.example.com"
|
|
803
|
+
* ]
|
|
804
|
+
* }
|
|
805
|
+
* }
|
|
806
|
+
* }
|
|
807
|
+
* });
|
|
808
|
+
* ```
|
|
809
|
+
*
|
|
810
|
+
* After the build, the `<meta>` element will instead apply your sources to the `style-src` directives:
|
|
811
|
+
*
|
|
812
|
+
* ```html
|
|
813
|
+
* <head>
|
|
814
|
+
* <meta
|
|
815
|
+
* http-equiv="content-security-policy"
|
|
816
|
+
* content="
|
|
817
|
+
* style-src 'self' https://styles.cdn.example.com 'sha256-somehash';
|
|
818
|
+
* "
|
|
819
|
+
* >
|
|
820
|
+
* </head>
|
|
821
|
+
* ```
|
|
822
|
+
*
|
|
823
|
+
* 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.
|
|
824
|
+
*/
|
|
825
|
+
resources?: string[];
|
|
826
|
+
};
|
|
827
|
+
/**
|
|
828
|
+
* @docs
|
|
829
|
+
* @name security.csp.scriptDirective
|
|
830
|
+
* @kind h5
|
|
831
|
+
* @type {CspScriptDirective}
|
|
832
|
+
* @default `undefined`
|
|
833
|
+
* @version 6.0.0
|
|
834
|
+
* @description
|
|
835
|
+
*
|
|
836
|
+
* 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.
|
|
837
|
+
*/
|
|
838
|
+
scriptDirective?: {
|
|
839
|
+
/**
|
|
840
|
+
* @docs
|
|
841
|
+
* @name security.csp.scriptDirective.hashes
|
|
842
|
+
* @kind h6
|
|
843
|
+
* @type {CspHash[]}
|
|
844
|
+
* @default `[]`
|
|
845
|
+
* @version 6.0.0
|
|
846
|
+
* @description
|
|
847
|
+
*
|
|
848
|
+
* A list of additional hashes to be rendered.
|
|
849
|
+
*
|
|
850
|
+
* 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.
|
|
851
|
+
*
|
|
852
|
+
* ```js title="astro.config.mjs"
|
|
853
|
+
* import { defineConfig } from 'astro/config';
|
|
854
|
+
*
|
|
855
|
+
* export default defineConfig({
|
|
856
|
+
* security: {
|
|
857
|
+
* csp: {
|
|
858
|
+
* scriptDirective: {
|
|
859
|
+
* hashes: [
|
|
860
|
+
* "sha384-scriptHash",
|
|
861
|
+
* "sha512-scriptHash",
|
|
862
|
+
* "sha256-scriptHash"
|
|
863
|
+
* ]
|
|
864
|
+
* }
|
|
865
|
+
* }
|
|
866
|
+
* }
|
|
867
|
+
* });
|
|
868
|
+
* ```
|
|
869
|
+
*
|
|
870
|
+
* After the build, the `<meta>` element will include your additional hashes in the `script-src` directives:
|
|
871
|
+
*
|
|
872
|
+
* ```html
|
|
873
|
+
* <meta
|
|
874
|
+
* http-equiv="content-security-policy"
|
|
875
|
+
* content="
|
|
876
|
+
* script-src 'self' 'sha384-scriptHash' 'sha512-scriptHash' 'sha256-scriptHash' 'sha256-generatedByAstro';
|
|
877
|
+
* "
|
|
878
|
+
* >
|
|
879
|
+
* ```
|
|
880
|
+
*/
|
|
881
|
+
hashes?: CspHash[];
|
|
882
|
+
/**
|
|
883
|
+
* @docs
|
|
884
|
+
* @name security.csp.scriptDirective.resources
|
|
885
|
+
* @kind h6
|
|
886
|
+
* @type {string[]}
|
|
887
|
+
* @default `[]`
|
|
888
|
+
* @version 6.0.0
|
|
889
|
+
* @description
|
|
890
|
+
*
|
|
891
|
+
* 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.
|
|
892
|
+
*
|
|
893
|
+
* ```js title="astro.config.mjs"
|
|
894
|
+
* import { defineConfig } from 'astro/config';
|
|
895
|
+
*
|
|
896
|
+
* export default defineConfig({
|
|
897
|
+
* security: {
|
|
898
|
+
* csp: {
|
|
899
|
+
* scriptDirective: {
|
|
900
|
+
* resources: [
|
|
901
|
+
* "'self'", "https://cdn.example.com"
|
|
902
|
+
* ]
|
|
903
|
+
* }
|
|
904
|
+
* }
|
|
905
|
+
* }
|
|
906
|
+
* });
|
|
907
|
+
* ```
|
|
908
|
+
*
|
|
909
|
+
* After the build, the `<meta>` element will instead apply your sources to the `script-src` directives:
|
|
910
|
+
*
|
|
911
|
+
* ```html
|
|
912
|
+
* <head>
|
|
913
|
+
* <meta
|
|
914
|
+
* http-equiv="content-security-policy"
|
|
915
|
+
* content="
|
|
916
|
+
* script-src 'self' https://cdn.example.com 'sha256-somehash';
|
|
917
|
+
* "
|
|
918
|
+
* >
|
|
919
|
+
* </head>
|
|
920
|
+
* ```
|
|
921
|
+
*
|
|
922
|
+
* 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.
|
|
923
|
+
*/
|
|
924
|
+
resources?: string[];
|
|
925
|
+
/**
|
|
926
|
+
* @docs
|
|
927
|
+
* @name security.csp.scriptDirective.strictDynamic
|
|
928
|
+
* @kind h6
|
|
929
|
+
* @type {boolean}
|
|
930
|
+
* @default `false`
|
|
931
|
+
* @version 6.0.0
|
|
932
|
+
* @description
|
|
933
|
+
*
|
|
934
|
+
* 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.
|
|
935
|
+
*
|
|
936
|
+
* ```js title="astro.config.mjs"
|
|
937
|
+
* import { defineConfig } from 'astro/config';
|
|
938
|
+
*
|
|
939
|
+
* export default defineConfig({
|
|
940
|
+
* security: {
|
|
941
|
+
* csp: {
|
|
942
|
+
* scriptDirective: {
|
|
943
|
+
* strictDynamic: true
|
|
944
|
+
* }
|
|
945
|
+
* }
|
|
946
|
+
* }
|
|
947
|
+
* });
|
|
948
|
+
* ```
|
|
949
|
+
*/
|
|
950
|
+
strictDynamic?: boolean;
|
|
951
|
+
};
|
|
952
|
+
};
|
|
565
953
|
};
|
|
566
|
-
/**
|
|
567
|
-
* @docs
|
|
568
|
-
* @name vite
|
|
569
|
-
* @typeraw {ViteUserConfig}
|
|
570
|
-
* @description
|
|
571
|
-
*
|
|
572
|
-
* Pass additional configuration options to Vite. Useful when Astro doesn't support some advanced configuration that you may need.
|
|
573
|
-
*
|
|
574
|
-
* View the full `vite` configuration object documentation on [vite.dev](https://vite.dev/config/).
|
|
575
|
-
*
|
|
576
|
-
* #### Examples
|
|
577
|
-
*
|
|
578
|
-
* ```js
|
|
579
|
-
* {
|
|
580
|
-
* vite: {
|
|
581
|
-
* ssr: {
|
|
582
|
-
* // Example: Force a broken package to skip SSR processing, if needed
|
|
583
|
-
* external: ['broken-npm-package'],
|
|
584
|
-
* }
|
|
585
|
-
* }
|
|
586
|
-
* }
|
|
587
|
-
* ```
|
|
588
|
-
*
|
|
589
|
-
* ```js
|
|
590
|
-
* {
|
|
591
|
-
* vite: {
|
|
592
|
-
* // Example: Add custom vite plugins directly to your Astro project
|
|
593
|
-
* plugins: [myPlugin()],
|
|
594
|
-
* }
|
|
595
|
-
* }
|
|
596
|
-
* ```
|
|
597
|
-
*/
|
|
598
|
-
vite?: ViteUserConfig;
|
|
599
954
|
/**
|
|
600
955
|
* @docs
|
|
601
956
|
* @kind heading
|
|
@@ -1966,17 +2321,6 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
1966
2321
|
* See the [Prefetch Guide](https://docs.astro.build/en/guides/prefetch/) for more `prefetch` options and usage.
|
|
1967
2322
|
*/
|
|
1968
2323
|
clientPrerender?: boolean;
|
|
1969
|
-
/**
|
|
1970
|
-
*
|
|
1971
|
-
* @name experimental.failOnPrerenderConflict
|
|
1972
|
-
* @type {boolean}
|
|
1973
|
-
* @default `false`
|
|
1974
|
-
* @version 5.x
|
|
1975
|
-
* @description
|
|
1976
|
-
* When two routes generate the same prerendered URL, fail the build instead of skipping one.
|
|
1977
|
-
* If disabled (default), a warning is logged when conflicts occur and the highest-priority route wins.
|
|
1978
|
-
*/
|
|
1979
|
-
failOnPrerenderConflict?: boolean;
|
|
1980
2324
|
/**
|
|
1981
2325
|
*
|
|
1982
2326
|
* @name experimental.contentIntellisense
|
|
@@ -2018,244 +2362,6 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
2018
2362
|
* see the [Fonts RFC](https://github.com/withastro/roadmap/pull/1039).
|
|
2019
2363
|
*/
|
|
2020
2364
|
fonts?: FontFamily[];
|
|
2021
|
-
/**
|
|
2022
|
-
* @name experimental.csp
|
|
2023
|
-
* @type {boolean | object}
|
|
2024
|
-
* @default `false`
|
|
2025
|
-
* @version 5.9.0
|
|
2026
|
-
* @description
|
|
2027
|
-
*
|
|
2028
|
-
* Enables built-in support for Content Security Policy (CSP). For more information,
|
|
2029
|
-
* refer to the [experimental CSP documentation](https://docs.astro.build/en/reference/experimental-flags/csp/)
|
|
2030
|
-
*
|
|
2031
|
-
*/
|
|
2032
|
-
csp?: boolean | {
|
|
2033
|
-
/**
|
|
2034
|
-
* @name experimental.csp.algorithm
|
|
2035
|
-
* @type {"SHA-256" | "SHA-384" | "SHA-512"}
|
|
2036
|
-
* @default `'SHA-256'`
|
|
2037
|
-
* @version 5.9.0
|
|
2038
|
-
* @description
|
|
2039
|
-
*
|
|
2040
|
-
* 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.
|
|
2041
|
-
*
|
|
2042
|
-
* ```js
|
|
2043
|
-
* import { defineConfig } from 'astro/config';
|
|
2044
|
-
*
|
|
2045
|
-
* export default defineConfig({
|
|
2046
|
-
* experimental: {
|
|
2047
|
-
* csp: {
|
|
2048
|
-
* algorithm: 'SHA-512'
|
|
2049
|
-
* }
|
|
2050
|
-
* }
|
|
2051
|
-
* });
|
|
2052
|
-
* ```
|
|
2053
|
-
*/
|
|
2054
|
-
algorithm?: CspAlgorithm;
|
|
2055
|
-
/**
|
|
2056
|
-
* @name experimental.csp.styleDirective
|
|
2057
|
-
* @type {{ hashes?: CspHash[], resources?: string[] }}
|
|
2058
|
-
* @default `undefined`
|
|
2059
|
-
* @version 5.9.0
|
|
2060
|
-
* @description
|
|
2061
|
-
*
|
|
2062
|
-
* A configuration object that allows you to override the default sources for the `style-src` directive
|
|
2063
|
-
* with the `resources` property, or to provide additional `hashes` to be rendered.
|
|
2064
|
-
*
|
|
2065
|
-
* These properties are added to all pages and completely override Astro's default resources, not add to them.
|
|
2066
|
-
* Therefore, you must explicitly specify any default values that you want to be included.
|
|
2067
|
-
*/
|
|
2068
|
-
styleDirective?: {
|
|
2069
|
-
/**
|
|
2070
|
-
* @name experimental.csp.styleDirective.hashes
|
|
2071
|
-
* @type {CspHash[]}
|
|
2072
|
-
* @default `[]`
|
|
2073
|
-
* @version 5.9.0
|
|
2074
|
-
* @description
|
|
2075
|
-
*
|
|
2076
|
-
* A list of additional hashes added to the `style-src` directive.
|
|
2077
|
-
*
|
|
2078
|
-
* If you have external styles that aren't generated by Astro, this configuration option allows you to provide additional hashes to be rendered.
|
|
2079
|
-
*
|
|
2080
|
-
* 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.
|
|
2081
|
-
*
|
|
2082
|
-
* ```js
|
|
2083
|
-
* import { defineConfig } from 'astro/config';
|
|
2084
|
-
*
|
|
2085
|
-
* export default defineConfig({
|
|
2086
|
-
* experimental: {
|
|
2087
|
-
* csp: {
|
|
2088
|
-
* styleDirective: {
|
|
2089
|
-
* hashes: [
|
|
2090
|
-
* "sha384-styleHash",
|
|
2091
|
-
* "sha512-styleHash",
|
|
2092
|
-
* "sha256-styleHash"
|
|
2093
|
-
* ]
|
|
2094
|
-
* }
|
|
2095
|
-
* }
|
|
2096
|
-
* }
|
|
2097
|
-
* });
|
|
2098
|
-
* ```
|
|
2099
|
-
*/
|
|
2100
|
-
hashes?: CspHash[];
|
|
2101
|
-
/**
|
|
2102
|
-
* @name experimental.csp.styleDirective.resources
|
|
2103
|
-
* @type {string[]}
|
|
2104
|
-
* @default `[]`
|
|
2105
|
-
* @version 5.9.0
|
|
2106
|
-
* @description
|
|
2107
|
-
*
|
|
2108
|
-
* A list of resources applied to the `style-src` directive. These resources are added to all pages and will override Astro's defaults.
|
|
2109
|
-
*
|
|
2110
|
-
* ```js
|
|
2111
|
-
* import { defineConfig } from 'astro/config';
|
|
2112
|
-
*
|
|
2113
|
-
* export default defineConfig({
|
|
2114
|
-
* experimental: {
|
|
2115
|
-
* csp: {
|
|
2116
|
-
* styleDirective: {
|
|
2117
|
-
* resources: [
|
|
2118
|
-
* "'self'",
|
|
2119
|
-
* "https://styles.cdn.example.com"
|
|
2120
|
-
* ]
|
|
2121
|
-
* }
|
|
2122
|
-
* }
|
|
2123
|
-
* }
|
|
2124
|
-
* });
|
|
2125
|
-
* ```
|
|
2126
|
-
*/
|
|
2127
|
-
resources?: string[];
|
|
2128
|
-
};
|
|
2129
|
-
/**
|
|
2130
|
-
* @name experimental.csp.scriptDirective
|
|
2131
|
-
* @type {{ hashes?: CspHash[], resources?: string[], strictDynamic?: boolean }}
|
|
2132
|
-
* @default `undefined`
|
|
2133
|
-
* @version 5.9.0
|
|
2134
|
-
* @description
|
|
2135
|
-
*
|
|
2136
|
-
* A configuration object that allows you to override the default sources for the `script-src` directive
|
|
2137
|
-
* with the `resources` property, or to provide additional `hashes` to be rendered.
|
|
2138
|
-
*
|
|
2139
|
-
* These properties are added to all pages and completely override Astro's default resources, not add to them.
|
|
2140
|
-
* Therefore, you must explicitly specify any default values that you want to be included.
|
|
2141
|
-
*
|
|
2142
|
-
*/
|
|
2143
|
-
scriptDirective?: {
|
|
2144
|
-
/**
|
|
2145
|
-
* @name experimental.csp.scriptDirective.hashes
|
|
2146
|
-
* @type {CspHash[]}
|
|
2147
|
-
* @default `[]`
|
|
2148
|
-
* @version 5.9.0
|
|
2149
|
-
* @description
|
|
2150
|
-
*
|
|
2151
|
-
* A list of additional hashes added to the `script-src` directive.
|
|
2152
|
-
*
|
|
2153
|
-
* 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.
|
|
2154
|
-
*
|
|
2155
|
-
* 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.
|
|
2156
|
-
*
|
|
2157
|
-
* ```js
|
|
2158
|
-
* import { defineConfig } from 'astro/config';
|
|
2159
|
-
*
|
|
2160
|
-
* export default defineConfig({
|
|
2161
|
-
* experimental: {
|
|
2162
|
-
* csp: {
|
|
2163
|
-
* scriptDirective: {
|
|
2164
|
-
* hashes: [
|
|
2165
|
-
* "sha384-scriptHash",
|
|
2166
|
-
* "sha512-scriptHash",
|
|
2167
|
-
* "sha256-scriptHash"
|
|
2168
|
-
* ]
|
|
2169
|
-
* }
|
|
2170
|
-
* }
|
|
2171
|
-
* }
|
|
2172
|
-
* });
|
|
2173
|
-
* ```
|
|
2174
|
-
*/
|
|
2175
|
-
hashes?: CspHash[];
|
|
2176
|
-
/**
|
|
2177
|
-
* @name experimental.csp.scriptDirective.resources
|
|
2178
|
-
* @type {string[]}
|
|
2179
|
-
* @default `[]`
|
|
2180
|
-
* @version 5.9.0
|
|
2181
|
-
* @description
|
|
2182
|
-
*
|
|
2183
|
-
* A list of resources applied to the `script-src` directive. These resources are added to all pages and will override Astro's defaults.
|
|
2184
|
-
*
|
|
2185
|
-
* ```js
|
|
2186
|
-
* import { defineConfig } from 'astro/config';
|
|
2187
|
-
*
|
|
2188
|
-
* export default defineConfig({
|
|
2189
|
-
* experimental: {
|
|
2190
|
-
* csp: {
|
|
2191
|
-
* scriptDirective: {
|
|
2192
|
-
* resources: [
|
|
2193
|
-
* "'self'",
|
|
2194
|
-
* "https://cdn.example.com"
|
|
2195
|
-
* ]
|
|
2196
|
-
* }
|
|
2197
|
-
* }
|
|
2198
|
-
* }
|
|
2199
|
-
* });
|
|
2200
|
-
* ```
|
|
2201
|
-
*
|
|
2202
|
-
*/
|
|
2203
|
-
resources?: string[];
|
|
2204
|
-
/**
|
|
2205
|
-
* @name experimental.csp.scriptDirective.strictDynamic
|
|
2206
|
-
* @type {boolean}
|
|
2207
|
-
* @default `false`
|
|
2208
|
-
* @version 5.9.0
|
|
2209
|
-
* @description
|
|
2210
|
-
*
|
|
2211
|
-
* Enables the keyword `strict-dynamic` to support the dynamic injection of scripts.
|
|
2212
|
-
*
|
|
2213
|
-
* ```js
|
|
2214
|
-
* import { defineConfig } from 'astro/config';
|
|
2215
|
-
*
|
|
2216
|
-
* export default defineConfig({
|
|
2217
|
-
* experimental: {
|
|
2218
|
-
* csp: {
|
|
2219
|
-
* scriptDirective: {
|
|
2220
|
-
* strictDynamic: true
|
|
2221
|
-
* }
|
|
2222
|
-
* }
|
|
2223
|
-
* }
|
|
2224
|
-
* });
|
|
2225
|
-
* ```
|
|
2226
|
-
*/
|
|
2227
|
-
strictDynamic?: boolean;
|
|
2228
|
-
};
|
|
2229
|
-
/**
|
|
2230
|
-
* @name experimental.csp.directives
|
|
2231
|
-
* @type {string[]}
|
|
2232
|
-
* @default `[]`
|
|
2233
|
-
* @version 5.9.0
|
|
2234
|
-
* @description
|
|
2235
|
-
*
|
|
2236
|
-
* An array of additional directives to add the content of the `Content-Security-Policy` `<meta>` element.
|
|
2237
|
-
*
|
|
2238
|
-
* Use this configuration to add other directive definitions such as `default-src`, `image-src`, etc.
|
|
2239
|
-
*
|
|
2240
|
-
* ##### Example
|
|
2241
|
-
*
|
|
2242
|
-
* You can define a directive to fetch images only from a CDN `cdn.example.com`.
|
|
2243
|
-
*
|
|
2244
|
-
* ```js
|
|
2245
|
-
* export default defineConfig({
|
|
2246
|
-
* experimental: {
|
|
2247
|
-
* csp: {
|
|
2248
|
-
* directives: [
|
|
2249
|
-
* "image-src 'https://cdn.example.com"
|
|
2250
|
-
* ]
|
|
2251
|
-
* }
|
|
2252
|
-
* }
|
|
2253
|
-
* })
|
|
2254
|
-
* ```
|
|
2255
|
-
*
|
|
2256
|
-
*/
|
|
2257
|
-
directives?: CspDirective[];
|
|
2258
|
-
};
|
|
2259
2365
|
/**
|
|
2260
2366
|
* @name experimental.chromeDevtoolsWorkspace
|
|
2261
2367
|
* @type {boolean}
|
|
@@ -2281,6 +2387,49 @@ export interface AstroUserConfig<TLocales extends Locales = never, TSession exte
|
|
|
2281
2387
|
* See the [experimental Chrome DevTools workspace feature documentation](https://docs.astro.build/en/reference/experimental-flags/chrome-devtools-workspace/) for more information.
|
|
2282
2388
|
*/
|
|
2283
2389
|
chromeDevtoolsWorkspace?: boolean;
|
|
2390
|
+
/**
|
|
2391
|
+
* @name experimental.svgo
|
|
2392
|
+
* @type {boolean | SvgoConfig}
|
|
2393
|
+
* @default `false`
|
|
2394
|
+
* @description
|
|
2395
|
+
* Enable SVG optimization using SVGO during build time.
|
|
2396
|
+
*
|
|
2397
|
+
* Set to `true` to enable optimization with default settings, or pass a configuration
|
|
2398
|
+
* object to customize SVGO behavior.
|
|
2399
|
+
*
|
|
2400
|
+
* When enabled, all imported SVG files will be optimized for smaller file sizes
|
|
2401
|
+
* and better performance while maintaining visual quality.
|
|
2402
|
+
*
|
|
2403
|
+
* ```js
|
|
2404
|
+
* {
|
|
2405
|
+
* experimental: {
|
|
2406
|
+
* // Enable with defaults
|
|
2407
|
+
* svgo: true
|
|
2408
|
+
* }
|
|
2409
|
+
* }
|
|
2410
|
+
* ```
|
|
2411
|
+
*
|
|
2412
|
+
* To customize optimization, pass a [SVGO configuration object](https://svgo.dev/):
|
|
2413
|
+
*
|
|
2414
|
+
* ```js
|
|
2415
|
+
* {
|
|
2416
|
+
* experimental: {
|
|
2417
|
+
* svgo: {
|
|
2418
|
+
* plugins: [
|
|
2419
|
+
* 'preset-default',
|
|
2420
|
+
* {
|
|
2421
|
+
* name: 'removeViewBox',
|
|
2422
|
+
* active: false
|
|
2423
|
+
* }
|
|
2424
|
+
* ]
|
|
2425
|
+
* }
|
|
2426
|
+
* }
|
|
2427
|
+
* }
|
|
2428
|
+
* ```
|
|
2429
|
+
*
|
|
2430
|
+
* See the [experimental SVGO optimization docs](https://docs.astro.build/en/reference/experimental-flags/svg-optimization/) for more information.
|
|
2431
|
+
*/
|
|
2432
|
+
svgo?: boolean | SvgoConfig;
|
|
2284
2433
|
};
|
|
2285
2434
|
}
|
|
2286
2435
|
/**
|