astro 6.0.0-alpha.0 → 6.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro-jsx.d.ts +11 -0
- package/client.d.ts +17 -41
- package/components/Code.astro +2 -2
- package/components/Image.astro +2 -2
- package/components/Picture.astro +1 -1
- package/dist/actions/consts.d.ts +2 -5
- package/dist/actions/consts.js +4 -8
- package/dist/actions/integration.js +2 -4
- package/dist/actions/runtime/client.d.ts +84 -3
- package/dist/actions/runtime/client.js +238 -7
- package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
- package/dist/actions/runtime/entrypoints/client.js +91 -0
- package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
- package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
- package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
- package/dist/actions/runtime/entrypoints/server.js +33 -0
- package/dist/actions/runtime/server.d.ts +11 -18
- package/dist/actions/runtime/server.js +162 -82
- package/dist/actions/runtime/types.d.ts +64 -0
- package/dist/actions/utils.d.ts +2 -2
- package/dist/actions/utils.js +2 -2
- package/dist/actions/vite-plugin-actions.js +58 -47
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/build/generate.js +12 -10
- package/dist/assets/consts.d.ts +1 -0
- package/dist/assets/consts.js +2 -0
- package/dist/assets/endpoint/config.js +2 -2
- package/dist/assets/endpoint/dev.js +7 -6
- package/dist/assets/fonts/config.d.ts +91 -350
- package/dist/assets/fonts/config.js +35 -136
- package/dist/assets/fonts/constants.js +1 -1
- package/dist/assets/fonts/core/dedupe-font-faces.d.ts +2 -0
- package/dist/assets/fonts/core/dedupe-font-faces.js +30 -0
- package/dist/assets/fonts/definitions.d.ts +9 -22
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +8 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.js +20 -0
- package/dist/assets/fonts/infra/build-url-resolver.d.ts +12 -0
- package/dist/assets/fonts/infra/build-url-resolver.js +40 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.d.ts +11 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.js +42 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.d.ts +18 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +71 -0
- package/dist/assets/fonts/infra/data-collector.d.ts +10 -0
- package/dist/assets/fonts/infra/data-collector.js +35 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +14 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.js +37 -0
- package/dist/assets/fonts/infra/dev-url-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/dev-url-resolver.js +29 -0
- package/dist/assets/fonts/infra/font-type-extractor.d.ts +5 -0
- package/dist/assets/fonts/infra/font-type-extractor.js +21 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.d.ts +11 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.js +25 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.d.ts +5 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.js +145 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.js +14 -0
- package/dist/assets/fonts/{implementations/css-renderer.d.ts → infra/minifiable-css-renderer.d.ts} +8 -3
- package/dist/assets/fonts/{implementations/css-renderer.js → infra/minifiable-css-renderer.js} +12 -10
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/remote-font-provider-resolver.js +49 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.js +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +22 -0
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +6 -0
- package/dist/assets/fonts/{implementations → infra}/system-fallbacks-provider.js +8 -11
- package/dist/assets/fonts/infra/unstorage-fs-storage.d.ts +11 -0
- package/dist/assets/fonts/infra/unstorage-fs-storage.js +26 -0
- package/dist/assets/fonts/infra/url-proxy.d.ts +16 -0
- package/dist/assets/fonts/infra/url-proxy.js +50 -0
- package/dist/assets/fonts/infra/xxhash-hasher.d.ts +7 -0
- package/dist/assets/fonts/infra/xxhash-hasher.js +18 -0
- package/dist/assets/fonts/orchestrate.d.ts +1 -2
- package/dist/assets/fonts/orchestrate.js +50 -17
- package/dist/assets/fonts/providers/index.d.ts +6 -24
- package/dist/assets/fonts/types.d.ts +138 -8
- package/dist/assets/fonts/utils.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +66 -65
- package/dist/assets/services/noop.js +11 -1
- package/dist/assets/services/service.d.ts +1 -1
- package/dist/assets/services/service.js +55 -51
- package/dist/assets/types.d.ts +2 -2
- package/dist/assets/utils/index.d.ts +1 -3
- package/dist/assets/utils/index.js +4 -9
- package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
- package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -6
- package/dist/assets/utils/svg.d.ts +2 -1
- package/dist/assets/utils/svg.js +30 -4
- package/dist/assets/vite-plugin-assets.js +36 -19
- package/dist/cli/add/index.js +21 -13
- package/dist/cli/create-key/infra/crypto-key-generator.d.ts +3 -1
- package/dist/cli/create-key/infra/crypto-key-generator.js +7 -9
- package/dist/cli/definitions.d.ts +19 -2
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/docs/core/open-docs.d.ts +5 -3
- package/dist/cli/docs/core/open-docs.js +2 -9
- package/dist/cli/docs/definitions.d.ts +3 -11
- package/dist/cli/docs/domain/cloud-ide.d.ts +1 -0
- package/dist/cli/docs/domain/cloud-ide.js +0 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.d.ts +5 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.js +6 -0
- package/dist/cli/flags.d.ts +1 -0
- package/dist/cli/index.js +78 -21
- package/dist/cli/info/core/get-package-manager.d.ts +8 -0
- package/dist/cli/info/core/get-package-manager.js +37 -0
- package/dist/cli/info/core/info.d.ts +21 -0
- package/dist/cli/info/core/info.js +21 -0
- package/dist/cli/info/definitions.d.ts +30 -0
- package/dist/cli/info/definitions.js +0 -0
- package/dist/cli/info/domain/debug-info.d.ts +1 -0
- package/dist/cli/info/domain/debug-info.js +0 -0
- package/dist/cli/info/infra/bun-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/bun-package-manager.js +9 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.d.ts +10 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.js +36 -0
- package/dist/cli/info/infra/cli-clipboard.d.ts +13 -0
- package/dist/cli/info/infra/cli-clipboard.js +78 -0
- package/dist/cli/info/infra/cli-debug-info-provider.d.ts +15 -0
- package/dist/cli/info/infra/cli-debug-info-provider.js +57 -0
- package/dist/cli/info/infra/dev-debug-info-provider.d.ts +18 -0
- package/dist/cli/info/infra/dev-debug-info-provider.js +36 -0
- package/dist/cli/info/infra/noop-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/noop-package-manager.js +9 -0
- package/dist/cli/info/infra/npm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/npm-package-manager.js +32 -0
- package/dist/cli/info/infra/pnpm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/pnpm-package-manager.js +33 -0
- package/dist/cli/info/infra/process-node-version-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-node-version-provider.js +6 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.js +7 -0
- package/dist/cli/info/infra/prompts-prompt.d.ts +11 -0
- package/dist/cli/info/infra/prompts-prompt.js +25 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.d.ts +10 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.js +29 -0
- package/dist/cli/info/infra/yarn-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/yarn-package-manager.js +34 -0
- package/dist/cli/infra/build-time-astro-version-provider.d.ts +3 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +4 -8
- package/dist/cli/infra/cli-command-runner.d.ts +7 -4
- package/dist/cli/infra/cli-command-runner.js +14 -10
- package/dist/cli/infra/logger-help-display.d.ts +11 -7
- package/dist/cli/infra/logger-help-display.js +62 -50
- package/dist/cli/infra/passthrough-text-styler.d.ts +9 -0
- package/dist/cli/infra/passthrough-text-styler.js +23 -0
- package/dist/cli/infra/piccolore-text-styler.d.ts +2 -0
- package/dist/cli/infra/piccolore-text-styler.js +5 -0
- package/dist/cli/infra/process-operating-system-provider.d.ts +6 -0
- package/dist/cli/infra/process-operating-system-provider.js +12 -0
- package/dist/cli/infra/tinyexec-command-executor.d.ts +6 -0
- package/dist/cli/infra/tinyexec-command-executor.js +34 -0
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preferences/index.js +6 -2
- package/dist/cli/preview/index.js +1 -1
- package/dist/cli/utils/format-version.js +1 -1
- package/dist/config/index.js +9 -5
- package/dist/container/index.js +19 -13
- package/dist/container/pipeline.d.ts +2 -1
- package/dist/container/pipeline.js +4 -11
- package/dist/container/vite-plugin-container.js +7 -4
- package/dist/content/config.d.ts +34 -40
- package/dist/content/content-layer.js +13 -18
- package/dist/content/loaders/errors.d.ts +3 -3
- package/dist/content/loaders/errors.js +5 -2
- package/dist/content/loaders/glob.js +6 -1
- package/dist/content/loaders/types.d.ts +11 -4
- package/dist/content/runtime-assets.d.ts +4 -4
- package/dist/content/runtime-assets.js +2 -2
- package/dist/content/runtime.d.ts +21 -20
- package/dist/content/runtime.js +14 -16
- package/dist/content/types-generator.js +90 -54
- package/dist/content/utils.d.ts +46 -338
- package/dist/content/utils.js +52 -50
- package/dist/content/vite-plugin-content-assets.d.ts +12 -4
- package/dist/content/vite-plugin-content-assets.js +152 -102
- package/dist/content/vite-plugin-content-imports.js +58 -40
- package/dist/content/vite-plugin-content-virtual-mod.js +95 -77
- package/dist/core/app/app.d.ts +5 -0
- package/dist/core/app/app.js +13 -0
- package/dist/core/app/base.d.ts +132 -0
- package/dist/core/app/base.js +448 -0
- package/dist/core/app/common.d.ts +6 -2
- package/dist/core/app/common.js +60 -33
- package/dist/core/app/dev/app.d.ts +15 -0
- package/dist/core/app/dev/app.js +86 -0
- package/dist/core/app/dev/pipeline.d.ts +13 -0
- package/dist/core/app/dev/pipeline.js +123 -0
- package/dist/core/app/entrypoint.d.ts +2 -0
- package/dist/core/app/entrypoint.js +15 -0
- package/dist/core/app/index.d.ts +7 -99
- package/dist/core/app/index.js +20 -486
- package/dist/core/app/logging.d.ts +3 -0
- package/dist/core/app/logging.js +11 -0
- package/dist/core/app/manifest.d.ts +9 -0
- package/dist/core/app/manifest.js +107 -0
- package/dist/core/app/middlewares.js +1 -1
- package/dist/core/app/node.js +14 -13
- package/dist/core/app/pipeline.d.ts +6 -5
- package/dist/core/app/pipeline.js +65 -49
- package/dist/core/app/types.d.ts +58 -22
- package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
- package/dist/core/app/validate-forwarded-headers.js +60 -0
- package/dist/core/base-pipeline.d.ts +22 -14
- package/dist/core/base-pipeline.js +54 -6
- package/dist/core/build/app.d.ts +13 -0
- package/dist/core/build/app.js +38 -0
- package/dist/core/build/common.d.ts +1 -1
- package/dist/core/build/common.js +2 -2
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +96 -204
- package/dist/core/build/graph.js +2 -2
- package/dist/core/build/index.js +11 -16
- package/dist/core/build/internal.d.ts +2 -27
- package/dist/core/build/internal.js +1 -44
- package/dist/core/build/page-data.js +1 -1
- package/dist/core/build/pipeline.d.ts +15 -26
- package/dist/core/build/pipeline.js +106 -170
- package/dist/core/build/plugins/index.d.ts +4 -2
- package/dist/core/build/plugins/index.js +17 -23
- package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
- package/dist/core/build/plugins/plugin-analyzer.js +5 -13
- package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
- package/dist/core/build/plugins/plugin-component-entry.js +15 -17
- package/dist/core/build/plugins/plugin-css.d.ts +2 -2
- package/dist/core/build/plugins/plugin-css.js +90 -41
- package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
- package/dist/core/build/plugins/plugin-internals.js +24 -18
- package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
- package/dist/core/build/plugins/plugin-manifest.js +89 -129
- package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
- package/dist/core/build/plugins/plugin-middleware.js +5 -7
- package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
- package/dist/core/build/plugins/plugin-noop.js +35 -0
- package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
- package/dist/core/build/plugins/plugin-prerender.js +7 -64
- package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
- package/dist/core/build/plugins/plugin-scripts.js +5 -13
- package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
- package/dist/core/build/plugins/plugin-ssr.js +85 -139
- package/dist/core/build/plugins/util.d.ts +1 -25
- package/dist/core/build/plugins/util.js +0 -47
- package/dist/core/build/runtime.d.ts +26 -0
- package/dist/core/build/runtime.js +45 -0
- package/dist/core/build/static-build.d.ts +2 -2
- package/dist/core/build/static-build.js +181 -155
- package/dist/core/build/types.d.ts +1 -2
- package/dist/core/build/util.d.ts +0 -1
- package/dist/core/build/util.js +0 -7
- package/dist/core/compile/compile.d.ts +2 -3
- package/dist/core/compile/compile.js +2 -2
- package/dist/core/config/config.js +3 -3
- package/dist/core/config/index.d.ts +0 -1
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +336 -1434
- package/dist/core/config/schemas/base.js +42 -41
- package/dist/core/config/schemas/refined.d.ts +2 -2
- package/dist/core/config/schemas/refined.js +1 -1
- package/dist/core/config/schemas/relative.d.ts +672 -1761
- package/dist/core/config/schemas/relative.js +4 -4
- package/dist/core/config/settings.d.ts +3 -3
- package/dist/core/config/settings.js +5 -6
- package/dist/core/config/validate.js +13 -2
- package/dist/core/config/vite-load.js +12 -3
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +20 -1
- package/dist/core/create-vite.d.ts +2 -6
- package/dist/core/create-vite.js +35 -43
- package/dist/core/csp/common.d.ts +1 -1
- package/dist/core/csp/common.js +1 -1
- package/dist/core/csp/config.d.ts +8 -4
- package/dist/core/csp/config.js +1 -1
- package/dist/core/csp/runtime.d.ts +11 -0
- package/dist/core/csp/runtime.js +35 -0
- package/dist/core/dev/container.js +13 -7
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +15 -6
- package/dist/core/errors/dev/runtime.d.ts +6 -0
- package/dist/core/errors/dev/runtime.js +27 -0
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +32 -16
- package/dist/core/errors/errors-data.js +23 -10
- package/dist/core/errors/errors.d.ts +3 -3
- package/dist/core/errors/errors.js +8 -8
- package/dist/core/errors/zod-error-map.d.ts +2 -2
- package/dist/core/errors/zod-error-map.js +26 -24
- package/dist/core/logger/core.js +1 -1
- package/dist/core/messages.d.ts +2 -2
- package/dist/core/messages.js +3 -3
- package/dist/core/middleware/callMiddleware.js +1 -1
- package/dist/core/middleware/defineMiddleware.d.ts +2 -0
- package/dist/core/middleware/defineMiddleware.js +6 -0
- package/dist/core/middleware/index.d.ts +3 -3
- package/dist/core/middleware/index.js +1 -3
- package/dist/core/middleware/sequence.js +4 -4
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +41 -24
- package/dist/core/module-loader/index.d.ts +2 -2
- package/dist/core/module-loader/index.js +1 -1
- package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
- package/dist/core/module-loader/{loader.js → runner.js} +3 -0
- package/dist/core/module-loader/vite.d.ts +3 -2
- package/dist/core/module-loader/vite.js +17 -13
- package/dist/core/preview/index.js +20 -3
- package/dist/core/preview/static-preview-server.js +11 -0
- package/dist/core/redirects/component.js +1 -2
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +1 -3
- package/dist/core/redirects/render.js +5 -2
- package/dist/core/render/paginate.d.ts +1 -1
- package/dist/core/render/paginate.js +8 -6
- package/dist/core/render/params-and-props.d.ts +2 -0
- package/dist/core/render/params-and-props.js +19 -6
- package/dist/core/render/route-cache.d.ts +3 -2
- package/dist/core/render/route-cache.js +6 -5
- package/dist/core/render-context.d.ts +6 -4
- package/dist/core/render-context.js +66 -25
- package/dist/core/routing/astro-designed-error-pages.js +2 -2
- package/dist/core/routing/default.js +1 -1
- package/dist/core/routing/helpers.d.ts +22 -0
- package/dist/core/routing/helpers.js +25 -0
- package/dist/core/routing/index.d.ts +1 -1
- package/dist/core/routing/index.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +6 -1
- package/dist/core/routing/manifest/create.js +11 -14
- package/dist/core/routing/manifest/generator.d.ts +3 -1
- package/dist/core/routing/params.d.ts +2 -1
- package/dist/core/routing/params.js +3 -2
- package/dist/core/server-islands/endpoint.js +40 -19
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +106 -46
- package/dist/core/session/vite-plugin.d.ts +6 -0
- package/dist/core/session/vite-plugin.js +59 -0
- package/dist/core/session.d.ts +4 -2
- package/dist/core/session.js +8 -48
- package/dist/core/sync/index.d.ts +2 -5
- package/dist/core/sync/index.js +34 -22
- package/dist/core/util/pathname.d.ts +10 -0
- package/dist/core/util/pathname.js +17 -0
- package/dist/core/util.d.ts +2 -2
- package/dist/core/util.js +3 -3
- package/dist/core/viteUtils.d.ts +1 -0
- package/dist/core/viteUtils.js +2 -0
- package/dist/entrypoints/legacy.d.ts +2 -0
- package/dist/entrypoints/legacy.js +12 -0
- package/dist/entrypoints/prerender.d.ts +4 -0
- package/dist/entrypoints/prerender.js +7 -0
- package/dist/env/schema.d.ts +21 -251
- package/dist/env/schema.js +6 -3
- package/dist/env/vite-plugin-env.js +61 -42
- package/dist/env/vite-plugin-import-meta-env.js +45 -37
- package/dist/environments.d.ts +3 -0
- package/dist/environments.js +11 -0
- package/dist/events/error.d.ts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -6
- package/dist/i18n/utils.js +1 -63
- package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
- package/dist/i18n/vite-plugin-i18n.js +8 -26
- package/dist/integrations/hooks.d.ts +1 -1
- package/dist/integrations/hooks.js +10 -7
- package/dist/manifest/serialized.d.ts +9 -0
- package/dist/manifest/serialized.js +150 -0
- package/dist/manifest/virtual-module.d.ts +1 -4
- package/dist/manifest/virtual-module.js +100 -91
- package/dist/preferences/index.d.ts +1 -2
- package/dist/prefetch/vite-plugin-prefetch.js +20 -9
- package/dist/prerender/routing.d.ts +5 -7
- package/dist/prerender/routing.js +6 -17
- package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/radio-checkbox.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +2 -2
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/render/server-islands.js +5 -4
- package/dist/runtime/server/transition.d.ts +1 -0
- package/dist/template/4xx.js +3 -1
- package/dist/toolbar/vite-plugin-dev-toolbar.js +13 -7
- package/dist/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/swap-functions.js +4 -0
- package/dist/transitions/vite-plugin-transitions.js +35 -22
- package/dist/types/astro.d.ts +8 -6
- package/dist/types/public/config.d.ts +438 -289
- package/dist/types/public/context.d.ts +3 -4
- package/dist/types/public/extendables.d.ts +2 -0
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +23 -1
- package/dist/types/public/internal.d.ts +1 -16
- package/dist/types/public/preview.d.ts +6 -0
- package/dist/virtual-modules/i18n.d.ts +10 -2
- package/dist/virtual-modules/i18n.js +16 -7
- package/dist/virtual-modules/live-config.d.ts +1 -1
- package/dist/virtual-modules/live-config.js +1 -1
- package/dist/virtual-modules/middleware.d.ts +2 -1
- package/dist/virtual-modules/middleware.js +2 -1
- package/dist/vite-plugin-adapter-config/index.js +12 -5
- package/dist/vite-plugin-app/app.d.ts +47 -0
- package/dist/vite-plugin-app/app.js +410 -0
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
- package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
- package/dist/vite-plugin-app/index.d.ts +3 -0
- package/dist/vite-plugin-app/index.js +19 -0
- package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +6 -7
- package/dist/vite-plugin-app/pipeline.js +166 -0
- package/dist/vite-plugin-astro/index.js +215 -170
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +3 -4
- package/dist/vite-plugin-astro-server/error.js +2 -5
- package/dist/vite-plugin-astro-server/index.d.ts +0 -1
- package/dist/vite-plugin-astro-server/index.js +0 -2
- package/dist/vite-plugin-astro-server/metadata.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +3 -7
- package/dist/vite-plugin-astro-server/plugin.js +40 -108
- package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
- package/dist/vite-plugin-astro-server/util.d.ts +2 -2
- package/dist/vite-plugin-astro-server/util.js +2 -1
- package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
- package/dist/vite-plugin-astro-server/vite.js +7 -7
- package/dist/vite-plugin-chromedevtools/index.d.ts +7 -0
- package/dist/vite-plugin-chromedevtools/index.js +47 -0
- package/dist/vite-plugin-config-alias/index.js +59 -44
- package/dist/vite-plugin-css/index.d.ts +18 -0
- package/dist/vite-plugin-css/index.js +155 -0
- package/dist/vite-plugin-css/util.d.ts +5 -0
- package/dist/vite-plugin-css/util.js +8 -0
- package/dist/vite-plugin-environment/index.d.ts +15 -0
- package/dist/vite-plugin-environment/index.js +77 -0
- package/dist/vite-plugin-fileurl/index.js +6 -3
- package/dist/vite-plugin-head/index.d.ts +1 -2
- package/dist/vite-plugin-head/index.js +42 -58
- package/dist/vite-plugin-hmr-reload/index.js +2 -1
- package/dist/vite-plugin-html/index.d.ts +7 -4
- package/dist/vite-plugin-html/index.js +5 -3
- package/dist/vite-plugin-load-fallback/index.js +12 -5
- package/dist/vite-plugin-markdown/index.js +27 -8
- package/dist/vite-plugin-overlay/index.d.ts +2 -0
- package/dist/vite-plugin-overlay/index.js +21 -0
- package/dist/vite-plugin-pages/const.d.ts +2 -0
- package/dist/vite-plugin-pages/const.js +6 -0
- package/dist/vite-plugin-pages/index.d.ts +2 -0
- package/dist/vite-plugin-pages/index.js +7 -0
- package/dist/vite-plugin-pages/page.d.ts +7 -0
- package/dist/vite-plugin-pages/page.js +54 -0
- package/dist/vite-plugin-pages/pages.d.ts +8 -0
- package/dist/vite-plugin-pages/pages.js +63 -0
- package/dist/vite-plugin-pages/util.d.ts +8 -0
- package/dist/vite-plugin-pages/util.js +15 -0
- package/dist/vite-plugin-renderers/index.d.ts +9 -0
- package/dist/vite-plugin-renderers/index.js +45 -0
- package/dist/vite-plugin-routes/index.d.ts +14 -0
- package/dist/vite-plugin-routes/index.js +181 -0
- package/dist/vite-plugin-scripts/index.js +27 -25
- package/dist/vite-plugin-scripts/page-ssr.js +3 -2
- package/dist/vite-plugin-utils/index.d.ts +1 -0
- package/dist/vite-plugin-utils/index.js +2 -1
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +35 -32
- package/templates/content/module.mjs +1 -0
- package/templates/content/types.d.ts +24 -11
- package/types/actions.d.ts +1 -5
- package/types/content.d.ts +9 -11
- package/types/transitions.d.ts +25 -0
- package/dist/actions/loadActions.d.ts +0 -8
- package/dist/actions/loadActions.js +0 -13
- package/dist/actions/runtime/route.d.ts +0 -2
- package/dist/actions/runtime/shared.d.ts +0 -60
- package/dist/actions/runtime/shared.js +0 -296
- package/dist/actions/runtime/utils.d.ts +0 -25
- package/dist/actions/runtime/utils.js +0 -16
- package/dist/actions/runtime/virtual.d.ts +0 -4
- package/dist/actions/runtime/virtual.js +0 -127
- package/dist/assets/fonts/implementations/data-collector.d.ts +0 -3
- package/dist/assets/fonts/implementations/data-collector.js +0 -21
- package/dist/assets/fonts/implementations/error-handler.d.ts +0 -2
- package/dist/assets/fonts/implementations/error-handler.js +0 -41
- package/dist/assets/fonts/implementations/font-fetcher.d.ts +0 -8
- package/dist/assets/fonts/implementations/font-fetcher.js +0 -34
- package/dist/assets/fonts/implementations/font-file-reader.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-file-reader.js +0 -26
- package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/font-metrics-resolver.js +0 -66
- package/dist/assets/fonts/implementations/font-type-extractor.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-type-extractor.js +0 -22
- package/dist/assets/fonts/implementations/hasher.d.ts +0 -2
- package/dist/assets/fonts/implementations/hasher.js +0 -14
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.d.ts +0 -2
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.js +0 -147
- package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/local-provider-url-resolver.js +0 -17
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +0 -20
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +0 -47
- package/dist/assets/fonts/implementations/storage.d.ts +0 -4
- package/dist/assets/fonts/implementations/storage.js +0 -14
- package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +0 -28
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.d.ts +0 -8
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.js +0 -39
- package/dist/assets/fonts/implementations/url-proxy.d.ts +0 -7
- package/dist/assets/fonts/implementations/url-proxy.js +0 -31
- package/dist/assets/fonts/implementations/url-resolver.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-resolver.js +0 -55
- package/dist/assets/utils/node/emitAsset.d.ts +0 -15
- package/dist/assets/utils/remotePattern.d.ts +0 -3
- package/dist/assets/utils/remotePattern.js +0 -16
- package/dist/assets/utils/transformToPath.js +0 -32
- package/dist/cli/docs/domains/platform.d.ts +0 -1
- package/dist/cli/docs/infra/process-platform-provider.d.ts +0 -2
- package/dist/cli/docs/infra/process-platform-provider.js +0 -11
- package/dist/cli/docs/infra/tinyexec-command-executor.d.ts +0 -2
- package/dist/cli/docs/infra/tinyexec-command-executor.js +0 -30
- package/dist/cli/info/index.d.ts +0 -12
- package/dist/cli/info/index.js +0 -267
- package/dist/cli/infra/picocolors-text-styler.d.ts +0 -2
- package/dist/cli/infra/picocolors-text-styler.js +0 -7
- package/dist/core/build/css-asset-name.d.ts +0 -9
- package/dist/core/build/css-asset-name.js +0 -89
- package/dist/core/build/plugin.d.ts +0 -43
- package/dist/core/build/plugin.js +0 -61
- package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
- package/dist/core/build/plugins/plugin-actions.js +0 -16
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +0 -33
- package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
- package/dist/core/build/plugins/plugin-pages.js +0 -66
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
- package/dist/core/build/plugins/plugin-renderers.js +0 -54
- package/dist/core/middleware/loadMiddleware.d.ts +0 -7
- package/dist/core/middleware/loadMiddleware.js +0 -14
- package/dist/core/redirects/helpers.d.ts +0 -7
- package/dist/core/redirects/helpers.js +0 -10
- package/dist/core/routing/manifest/serialization.d.ts +0 -5
- package/dist/core/routing/manifest/serialization.js +0 -37
- package/dist/prerender/metadata.d.ts +0 -8
- package/dist/prerender/metadata.js +0 -18
- package/dist/vite-plugin-astro-server/css.d.ts +0 -13
- package/dist/vite-plugin-astro-server/css.js +0 -48
- package/dist/vite-plugin-astro-server/pipeline.js +0 -161
- package/dist/vite-plugin-astro-server/request.d.ts +0 -14
- package/dist/vite-plugin-astro-server/request.js +0 -66
- package/dist/vite-plugin-astro-server/route.d.ts +0 -25
- package/dist/vite-plugin-astro-server/route.js +0 -283
- package/dist/vite-plugin-scanner/index.d.ts +0 -10
- package/dist/vite-plugin-scanner/index.js +0 -87
- package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
- package/dist/vite-plugin-ssr-manifest/index.js +0 -26
- /package/dist/{cli/docs/domains/platform.js → actions/runtime/types.js} +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.js +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.js +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.js +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.js +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { prependForwardSlash } from "../core/path.js";
|
|
2
|
+
import { DEFAULT_COMPONENTS } from "../core/routing/default.js";
|
|
3
|
+
import { routeIsRedirect } from "../core/routing/index.js";
|
|
4
|
+
import { VIRTUAL_PAGE_MODULE_ID, VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "./const.js";
|
|
5
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
6
|
+
function pluginPage({ routesList }) {
|
|
7
|
+
return {
|
|
8
|
+
name: "@astro/plugin-page",
|
|
9
|
+
applyToEnvironment(environment) {
|
|
10
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
11
|
+
},
|
|
12
|
+
resolveId: {
|
|
13
|
+
filter: {
|
|
14
|
+
id: new RegExp(`^${VIRTUAL_PAGE_MODULE_ID}`)
|
|
15
|
+
},
|
|
16
|
+
handler(id) {
|
|
17
|
+
return VIRTUAL_PAGE_RESOLVED_MODULE_ID + id.slice(VIRTUAL_PAGE_MODULE_ID.length);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
load: {
|
|
21
|
+
filter: {
|
|
22
|
+
id: new RegExp(`^${VIRTUAL_PAGE_RESOLVED_MODULE_ID}`)
|
|
23
|
+
},
|
|
24
|
+
handler(id) {
|
|
25
|
+
const componentPath = getComponentFromVirtualModulePageName(
|
|
26
|
+
VIRTUAL_PAGE_RESOLVED_MODULE_ID,
|
|
27
|
+
id
|
|
28
|
+
);
|
|
29
|
+
if (DEFAULT_COMPONENTS.some((component) => componentPath === component)) {
|
|
30
|
+
return { code: "" };
|
|
31
|
+
}
|
|
32
|
+
const routes = routesList.routes.filter((route) => route.component === componentPath);
|
|
33
|
+
for (const route of routes) {
|
|
34
|
+
if (routeIsRedirect(route)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const astroModuleId = prependForwardSlash(componentPath);
|
|
38
|
+
const imports = [];
|
|
39
|
+
const exports = [];
|
|
40
|
+
imports.push(`import * as _page from ${JSON.stringify(astroModuleId)};`);
|
|
41
|
+
exports.push(`export const page = () => _page`);
|
|
42
|
+
return { code: `${imports.join("\n")}
|
|
43
|
+
${exports.join("\n")}` };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function getComponentFromVirtualModulePageName(virtualModulePrefix, id) {
|
|
50
|
+
return id.slice(virtualModulePrefix.length).replace(/@_@/g, ".");
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
pluginPage
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
+
import type { RoutesList } from '../types/astro.js';
|
|
3
|
+
export declare const VIRTUAL_PAGES_MODULE_ID = "virtual:astro:pages";
|
|
4
|
+
interface PagesPluginOptions {
|
|
5
|
+
routesList: RoutesList;
|
|
6
|
+
}
|
|
7
|
+
export declare function pluginPages({ routesList }: PagesPluginOptions): VitePlugin;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DEFAULT_COMPONENTS } from "../core/routing/default.js";
|
|
2
|
+
import { routeIsRedirect } from "../core/routing/index.js";
|
|
3
|
+
import { VIRTUAL_PAGE_MODULE_ID } from "./const.js";
|
|
4
|
+
import { getVirtualModulePageName } from "./util.js";
|
|
5
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
6
|
+
const VIRTUAL_PAGES_MODULE_ID = "virtual:astro:pages";
|
|
7
|
+
const VIRTUAL_PAGES_RESOLVED_MODULE_ID = "\0" + VIRTUAL_PAGES_MODULE_ID;
|
|
8
|
+
function pluginPages({ routesList }) {
|
|
9
|
+
return {
|
|
10
|
+
name: "@astro/plugin-pages",
|
|
11
|
+
enforce: "post",
|
|
12
|
+
applyToEnvironment(environment) {
|
|
13
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
14
|
+
},
|
|
15
|
+
resolveId: {
|
|
16
|
+
filter: {
|
|
17
|
+
id: new RegExp(`^${VIRTUAL_PAGES_MODULE_ID}$`)
|
|
18
|
+
},
|
|
19
|
+
handler() {
|
|
20
|
+
return VIRTUAL_PAGES_RESOLVED_MODULE_ID;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
load: {
|
|
24
|
+
filter: {
|
|
25
|
+
id: new RegExp(`^${VIRTUAL_PAGES_RESOLVED_MODULE_ID}$`)
|
|
26
|
+
},
|
|
27
|
+
async handler() {
|
|
28
|
+
const imports = [];
|
|
29
|
+
const pageMap = [];
|
|
30
|
+
let i = 0;
|
|
31
|
+
for (const route of routesList.routes) {
|
|
32
|
+
if (routeIsRedirect(route)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (DEFAULT_COMPONENTS.some((component) => route.component === component)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const virtualModuleName = getVirtualModulePageName(
|
|
39
|
+
VIRTUAL_PAGE_MODULE_ID,
|
|
40
|
+
route.component
|
|
41
|
+
);
|
|
42
|
+
const module = await this.resolve(virtualModuleName);
|
|
43
|
+
if (module) {
|
|
44
|
+
const variable = `_page${i}`;
|
|
45
|
+
imports.push(`const ${variable} = () => import("${virtualModuleName}");`);
|
|
46
|
+
pageMap.push(`[${JSON.stringify(route.component)}, ${variable}]`);
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const pageMapCode = `const pageMap = new Map([
|
|
51
|
+
${pageMap.join(",\n ")}
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
export { pageMap };`;
|
|
55
|
+
return { code: [...imports, pageMapCode].join("\n") };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
VIRTUAL_PAGES_MODULE_ID,
|
|
62
|
+
pluginPages
|
|
63
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prevents Rollup from triggering other plugins in the process by masking the extension (hence the virtual file).
|
|
3
|
+
* Inverse function of getComponentFromVirtualModulePageName() below.
|
|
4
|
+
* @param virtualModulePrefix The prefix used to create the virtual module
|
|
5
|
+
* @param path Page component path
|
|
6
|
+
*/
|
|
7
|
+
export declare function getVirtualModulePageName(virtualModulePrefix: string, path: string): string;
|
|
8
|
+
export declare function getVirtualModulePageNameForComponent(component: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fileExtension } from "@astrojs/internal-helpers/path";
|
|
2
|
+
import { VIRTUAL_PAGE_MODULE_ID } from "./const.js";
|
|
3
|
+
const ASTRO_PAGE_EXTENSION_POST_PATTERN = "@_@";
|
|
4
|
+
function getVirtualModulePageName(virtualModulePrefix, path) {
|
|
5
|
+
const extension = fileExtension(path);
|
|
6
|
+
return virtualModulePrefix + (extension.startsWith(".") ? path.slice(0, -extension.length) + extension.replace(".", ASTRO_PAGE_EXTENSION_POST_PATTERN) : path);
|
|
7
|
+
}
|
|
8
|
+
function getVirtualModulePageNameForComponent(component) {
|
|
9
|
+
const virtualModuleName = getVirtualModulePageName(VIRTUAL_PAGE_MODULE_ID, component);
|
|
10
|
+
return virtualModuleName;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
getVirtualModulePageName,
|
|
14
|
+
getVirtualModulePageNameForComponent
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
+
import type { AstroSettings } from '../types/astro.js';
|
|
3
|
+
export declare const ASTRO_RENDERERS_MODULE_ID = "virtual:astro:renderers";
|
|
4
|
+
export declare const RESOLVED_ASTRO_RENDERERS_MODULE_ID = "\0virtual:astro:renderers";
|
|
5
|
+
interface PluginOptions {
|
|
6
|
+
settings: AstroSettings;
|
|
7
|
+
}
|
|
8
|
+
export default function vitePluginRenderers(options: PluginOptions): VitePlugin;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const ASTRO_RENDERERS_MODULE_ID = "virtual:astro:renderers";
|
|
2
|
+
const RESOLVED_ASTRO_RENDERERS_MODULE_ID = `\0${ASTRO_RENDERERS_MODULE_ID}`;
|
|
3
|
+
function vitePluginRenderers(options) {
|
|
4
|
+
const renderers = options.settings.renderers;
|
|
5
|
+
return {
|
|
6
|
+
name: "astro:plugin-renderers",
|
|
7
|
+
enforce: "pre",
|
|
8
|
+
resolveId: {
|
|
9
|
+
filter: {
|
|
10
|
+
id: new RegExp(`^${ASTRO_RENDERERS_MODULE_ID}$`)
|
|
11
|
+
},
|
|
12
|
+
handler() {
|
|
13
|
+
return RESOLVED_ASTRO_RENDERERS_MODULE_ID;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
load: {
|
|
17
|
+
filter: {
|
|
18
|
+
id: new RegExp(`^${RESOLVED_ASTRO_RENDERERS_MODULE_ID}$`)
|
|
19
|
+
},
|
|
20
|
+
handler() {
|
|
21
|
+
if (renderers.length > 0) {
|
|
22
|
+
const imports = [];
|
|
23
|
+
const exports = [];
|
|
24
|
+
let i = 0;
|
|
25
|
+
let rendererItems = "";
|
|
26
|
+
for (const renderer of renderers) {
|
|
27
|
+
const variable = `_renderer${i}`;
|
|
28
|
+
imports.push(`import ${variable} from ${JSON.stringify(renderer.serverEntrypoint)};`);
|
|
29
|
+
rendererItems += `Object.assign(${JSON.stringify(renderer)}, { ssr: ${variable} }),`;
|
|
30
|
+
i++;
|
|
31
|
+
}
|
|
32
|
+
exports.push(`export const renderers = [${rendererItems}];`);
|
|
33
|
+
return { code: `${imports.join("\n")}
|
|
34
|
+
${exports.join("\n")}` };
|
|
35
|
+
}
|
|
36
|
+
return { code: `export const renderers = [];` };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
ASTRO_RENDERERS_MODULE_ID,
|
|
43
|
+
RESOLVED_ASTRO_RENDERERS_MODULE_ID,
|
|
44
|
+
vitePluginRenderers as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type fsMod from 'node:fs';
|
|
2
|
+
import { type Plugin } from 'vite';
|
|
3
|
+
import type { Logger } from '../core/logger/core.js';
|
|
4
|
+
import type { AstroSettings, RoutesList } from '../types/astro.js';
|
|
5
|
+
type Payload = {
|
|
6
|
+
settings: AstroSettings;
|
|
7
|
+
logger: Logger;
|
|
8
|
+
fsMod?: typeof fsMod;
|
|
9
|
+
routesList: RoutesList;
|
|
10
|
+
command: 'dev' | 'build';
|
|
11
|
+
};
|
|
12
|
+
export declare const ASTRO_ROUTES_MODULE_ID = "virtual:astro:routes";
|
|
13
|
+
export default function astroPluginRoutes({ settings, logger, fsMod, routesList: initialRoutesList, command, }: Payload): Promise<Plugin>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { extname } from "node:path";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import colors from "piccolore";
|
|
4
|
+
import { normalizePath } from "vite";
|
|
5
|
+
import { serializeRouteData } from "../core/app/index.js";
|
|
6
|
+
import { warnMissingAdapter } from "../core/dev/adapter-validation.js";
|
|
7
|
+
import { createRoutesList } from "../core/routing/index.js";
|
|
8
|
+
import { getRoutePrerenderOption } from "../core/routing/manifest/prerender.js";
|
|
9
|
+
import { isEndpoint, isPage } from "../core/util.js";
|
|
10
|
+
import { rootRelativePath } from "../core/viteUtils.js";
|
|
11
|
+
import { createDefaultAstroMetadata } from "../vite-plugin-astro/metadata.js";
|
|
12
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
13
|
+
import { isAstroServerEnvironment } from "../environments.js";
|
|
14
|
+
const ASTRO_ROUTES_MODULE_ID = "virtual:astro:routes";
|
|
15
|
+
const ASTRO_ROUTES_MODULE_ID_RESOLVED = "\0" + ASTRO_ROUTES_MODULE_ID;
|
|
16
|
+
const KNOWN_FILE_EXTENSIONS = [".astro", ".js", ".ts"];
|
|
17
|
+
async function astroPluginRoutes({
|
|
18
|
+
settings,
|
|
19
|
+
logger,
|
|
20
|
+
fsMod,
|
|
21
|
+
routesList: initialRoutesList,
|
|
22
|
+
command
|
|
23
|
+
}) {
|
|
24
|
+
logger.debug("update", "Re-calculate routes");
|
|
25
|
+
let routeList = initialRoutesList;
|
|
26
|
+
let serializedRouteInfo = routeList.routes.map(
|
|
27
|
+
(r) => {
|
|
28
|
+
return {
|
|
29
|
+
file: "",
|
|
30
|
+
links: [],
|
|
31
|
+
scripts: [],
|
|
32
|
+
styles: [],
|
|
33
|
+
routeData: serializeRouteData(r, settings.config.trailingSlash)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
async function rebuildRoutes(path = null, server) {
|
|
38
|
+
if (path != null && path.startsWith(settings.config.srcDir.pathname)) {
|
|
39
|
+
logger.debug(
|
|
40
|
+
"update",
|
|
41
|
+
`Re-calculating routes for ${path.slice(settings.config.srcDir.pathname.length)}`
|
|
42
|
+
);
|
|
43
|
+
const file = pathToFileURL(normalizePath(path));
|
|
44
|
+
routeList = await createRoutesList(
|
|
45
|
+
{
|
|
46
|
+
settings,
|
|
47
|
+
fsMod
|
|
48
|
+
},
|
|
49
|
+
logger,
|
|
50
|
+
{ dev: command === "dev" }
|
|
51
|
+
);
|
|
52
|
+
serializedRouteInfo = routeList.routes.map((r) => {
|
|
53
|
+
return {
|
|
54
|
+
file: fileURLToPath(file),
|
|
55
|
+
links: [],
|
|
56
|
+
scripts: [],
|
|
57
|
+
styles: [],
|
|
58
|
+
routeData: serializeRouteData(r, settings.config.trailingSlash)
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
let environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
|
|
62
|
+
const virtualMod = environment.moduleGraph.getModuleById(ASTRO_ROUTES_MODULE_ID_RESOLVED);
|
|
63
|
+
if (!virtualMod) return;
|
|
64
|
+
environment.moduleGraph.invalidateModule(virtualMod);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
name: "astro:routes",
|
|
69
|
+
configureServer(server) {
|
|
70
|
+
server.watcher.on("add", (path) => rebuildRoutes(path, server));
|
|
71
|
+
server.watcher.on("unlink", (path) => rebuildRoutes(path, server));
|
|
72
|
+
server.watcher.on("change", (path) => rebuildRoutes(path, server));
|
|
73
|
+
},
|
|
74
|
+
applyToEnvironment(environment) {
|
|
75
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
76
|
+
},
|
|
77
|
+
resolveId: {
|
|
78
|
+
filter: {
|
|
79
|
+
id: new RegExp(`^${ASTRO_ROUTES_MODULE_ID}$`)
|
|
80
|
+
},
|
|
81
|
+
handler() {
|
|
82
|
+
return ASTRO_ROUTES_MODULE_ID_RESOLVED;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
load: {
|
|
86
|
+
filter: {
|
|
87
|
+
id: new RegExp(`^${ASTRO_ROUTES_MODULE_ID_RESOLVED}$`)
|
|
88
|
+
},
|
|
89
|
+
handler() {
|
|
90
|
+
const environmentName = this.environment.name;
|
|
91
|
+
const filteredRoutes = serializedRouteInfo.filter((routeInfo) => {
|
|
92
|
+
if (command === "build") {
|
|
93
|
+
if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.prerender) {
|
|
94
|
+
return routeInfo.routeData.prerender;
|
|
95
|
+
}
|
|
96
|
+
if (environmentName === ASTRO_VITE_ENVIRONMENT_NAMES.ssr) {
|
|
97
|
+
return !routeInfo.routeData.prerender;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return true;
|
|
101
|
+
});
|
|
102
|
+
const code = `
|
|
103
|
+
import { deserializeRouteInfo } from 'astro/app';
|
|
104
|
+
const serializedData = ${JSON.stringify(filteredRoutes)};
|
|
105
|
+
const routes = serializedData.map(deserializeRouteInfo);
|
|
106
|
+
export { routes };
|
|
107
|
+
`;
|
|
108
|
+
return { code };
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
async transform(code, id) {
|
|
112
|
+
if (!isAstroServerEnvironment(this.environment)) return;
|
|
113
|
+
const filename = normalizePath(id);
|
|
114
|
+
let fileURL;
|
|
115
|
+
try {
|
|
116
|
+
fileURL = new URL(`file://${filename}`);
|
|
117
|
+
} catch {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const fileIsPage = isPage(fileURL, settings);
|
|
121
|
+
const fileIsEndpoint = isEndpoint(fileURL, settings);
|
|
122
|
+
if (!(fileIsPage || fileIsEndpoint)) return;
|
|
123
|
+
const route = routeList.routes.find((r) => {
|
|
124
|
+
const filePath = new URL(`./${r.component}`, settings.config.root);
|
|
125
|
+
return normalizePath(fileURLToPath(filePath)) === filename;
|
|
126
|
+
});
|
|
127
|
+
if (!route) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!route.prerender && code.includes("getStaticPaths") && // this should only be valid for `.astro`, `.js` and `.ts` files
|
|
131
|
+
KNOWN_FILE_EXTENSIONS.includes(extname(filename))) {
|
|
132
|
+
logger.warn(
|
|
133
|
+
"router",
|
|
134
|
+
`getStaticPaths() ignored in dynamic page ${colors.bold(
|
|
135
|
+
rootRelativePath(settings.config.root, fileURL, true)
|
|
136
|
+
)}. Add \`export const prerender = true;\` to prerender the page as static HTML during the build process.`
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
const { meta = {} } = this.getModuleInfo(id) ?? {};
|
|
140
|
+
return {
|
|
141
|
+
code,
|
|
142
|
+
map: null,
|
|
143
|
+
meta: {
|
|
144
|
+
...meta,
|
|
145
|
+
astro: {
|
|
146
|
+
...meta.astro ?? createDefaultAstroMetadata(),
|
|
147
|
+
pageOptions: {
|
|
148
|
+
prerender: route.prerender
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
},
|
|
154
|
+
// Handle hot updates to update the prerender option
|
|
155
|
+
async handleHotUpdate(ctx) {
|
|
156
|
+
const filename = normalizePath(ctx.file);
|
|
157
|
+
let fileURL;
|
|
158
|
+
try {
|
|
159
|
+
fileURL = new URL(`file://${filename}`);
|
|
160
|
+
} catch {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const fileIsPage = isPage(fileURL, settings);
|
|
164
|
+
const fileIsEndpoint = isEndpoint(fileURL, settings);
|
|
165
|
+
if (!(fileIsPage || fileIsEndpoint)) return;
|
|
166
|
+
const route = routeList.routes.find((r) => {
|
|
167
|
+
const filePath = new URL(`./${r.component}`, settings.config.root);
|
|
168
|
+
return normalizePath(fileURLToPath(filePath)) === filename;
|
|
169
|
+
});
|
|
170
|
+
if (!route) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
await getRoutePrerenderOption(await ctx.read(), route, settings, logger);
|
|
174
|
+
warnMissingAdapter(logger, settings);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
export {
|
|
179
|
+
ASTRO_ROUTES_MODULE_ID,
|
|
180
|
+
astroPluginRoutes as default
|
|
181
|
+
};
|
|
@@ -1,42 +1,44 @@
|
|
|
1
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../core/constants.js";
|
|
1
2
|
const SCRIPT_ID_PREFIX = `astro:scripts/`;
|
|
2
3
|
const BEFORE_HYDRATION_SCRIPT_ID = `${SCRIPT_ID_PREFIX}${"before-hydration"}.js`;
|
|
3
4
|
const PAGE_SCRIPT_ID = `${SCRIPT_ID_PREFIX}${"page"}.js`;
|
|
4
5
|
const PAGE_SSR_SCRIPT_ID = `${SCRIPT_ID_PREFIX}${"page-ssr"}.js`;
|
|
5
6
|
function astroScriptsPlugin({ settings }) {
|
|
6
|
-
let env = void 0;
|
|
7
7
|
return {
|
|
8
8
|
name: "astro:scripts",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
resolveId: {
|
|
10
|
+
filter: {
|
|
11
|
+
id: new RegExp(`^${SCRIPT_ID_PREFIX}`)
|
|
12
|
+
},
|
|
13
|
+
handler(id) {
|
|
14
14
|
return id;
|
|
15
15
|
}
|
|
16
|
-
return void 0;
|
|
17
16
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
17
|
+
load: {
|
|
18
|
+
filter: {
|
|
19
|
+
id: new RegExp(`^(${BEFORE_HYDRATION_SCRIPT_ID}|${PAGE_SCRIPT_ID}|${PAGE_SSR_SCRIPT_ID})$`)
|
|
20
|
+
},
|
|
21
|
+
handler(id) {
|
|
22
|
+
if (id === BEFORE_HYDRATION_SCRIPT_ID) {
|
|
23
|
+
return {
|
|
24
|
+
code: settings.scripts.filter((s) => s.stage === "before-hydration").map((s) => s.content).join("\n")
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (id === PAGE_SCRIPT_ID) {
|
|
28
|
+
return {
|
|
29
|
+
code: settings.scripts.filter((s) => s.stage === "page").map((s) => s.content).join("\n")
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (id === PAGE_SSR_SCRIPT_ID) {
|
|
33
|
+
return {
|
|
34
|
+
code: settings.scripts.filter((s) => s.stage === "page-ssr").map((s) => s.content).join("\n")
|
|
35
|
+
};
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
|
-
return null;
|
|
35
38
|
},
|
|
36
39
|
buildStart() {
|
|
37
40
|
const hasHydrationScripts = settings.scripts.some((s) => s.stage === "before-hydration");
|
|
38
|
-
|
|
39
|
-
if (hasHydrationScripts && env?.command === "build" && !isSsrBuild) {
|
|
41
|
+
if (hasHydrationScripts && (this.environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender || this.environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr)) {
|
|
40
42
|
this.emitFile({
|
|
41
43
|
type: "chunk",
|
|
42
44
|
id: BEFORE_HYDRATION_SCRIPT_ID,
|
|
@@ -2,14 +2,15 @@ import MagicString from "magic-string";
|
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { isPage } from "../core/util.js";
|
|
4
4
|
import { PAGE_SSR_SCRIPT_ID } from "./index.js";
|
|
5
|
+
import { isAstroServerEnvironment } from "../environments.js";
|
|
5
6
|
function astroScriptsPostPlugin({
|
|
6
7
|
settings
|
|
7
8
|
}) {
|
|
8
9
|
return {
|
|
9
10
|
name: "astro:scripts:page-ssr",
|
|
10
11
|
enforce: "post",
|
|
11
|
-
transform(code, id
|
|
12
|
-
if (!
|
|
12
|
+
transform(code, id) {
|
|
13
|
+
if (!isAstroServerEnvironment(this.environment)) return;
|
|
13
14
|
const hasInjectedScript = settings.scripts.some((s2) => s2.stage === "page-ssr");
|
|
14
15
|
if (!hasInjectedScript) return;
|
|
15
16
|
const filename = normalizePath(id);
|
|
@@ -13,6 +13,7 @@ export declare function getFileInfo(id: string, config: AstroConfig): {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function normalizeFilename(filename: string, root: URL): string;
|
|
15
15
|
export declare function cleanUrl(url: string): string;
|
|
16
|
+
export declare const specialQueriesRE: RegExp;
|
|
16
17
|
/**
|
|
17
18
|
* Detect `?url`, `?raw`, and `?direct`, in which case we usually want to skip
|
|
18
19
|
* transforming any code with this queries as Vite will handle it directly.
|
package/dist/zod.d.ts
CHANGED
package/dist/zod.js
CHANGED