astro 6.0.0-alpha.0 → 6.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro-jsx.d.ts +11 -0
- package/client.d.ts +17 -41
- package/components/Code.astro +2 -2
- package/components/Image.astro +2 -2
- package/components/Picture.astro +1 -1
- package/dist/actions/consts.d.ts +2 -5
- package/dist/actions/consts.js +4 -8
- package/dist/actions/integration.js +2 -4
- package/dist/actions/runtime/client.d.ts +84 -3
- package/dist/actions/runtime/client.js +238 -7
- package/dist/actions/runtime/entrypoints/client.d.ts +7 -0
- package/dist/actions/runtime/entrypoints/client.js +91 -0
- package/dist/actions/runtime/entrypoints/route.d.ts +2 -0
- package/dist/actions/runtime/{route.js → entrypoints/route.js} +1 -1
- package/dist/actions/runtime/entrypoints/server.d.ts +6 -0
- package/dist/actions/runtime/entrypoints/server.js +33 -0
- package/dist/actions/runtime/server.d.ts +11 -18
- package/dist/actions/runtime/server.js +162 -82
- package/dist/actions/runtime/types.d.ts +64 -0
- package/dist/actions/utils.d.ts +2 -2
- package/dist/actions/utils.js +2 -2
- package/dist/actions/vite-plugin-actions.js +18 -21
- package/dist/assets/build/generate.d.ts +2 -2
- package/dist/assets/build/generate.js +12 -10
- package/dist/assets/endpoint/config.js +2 -2
- package/dist/assets/endpoint/dev.js +7 -6
- package/dist/assets/fonts/config.d.ts +91 -350
- package/dist/assets/fonts/config.js +35 -136
- package/dist/assets/fonts/constants.js +1 -1
- package/dist/assets/fonts/core/dedupe-font-faces.d.ts +2 -0
- package/dist/assets/fonts/core/dedupe-font-faces.js +30 -0
- package/dist/assets/fonts/definitions.d.ts +9 -22
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/build-remote-font-provider-mod-resolver.js +8 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/build-url-proxy-hash-resolver.js +20 -0
- package/dist/assets/fonts/infra/build-url-resolver.d.ts +12 -0
- package/dist/assets/fonts/infra/build-url-resolver.js +40 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.d.ts +11 -0
- package/dist/assets/fonts/infra/cached-font-fetcher.js +42 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.d.ts +18 -0
- package/dist/assets/fonts/infra/capsize-font-metrics-resolver.js +71 -0
- package/dist/assets/fonts/infra/data-collector.d.ts +10 -0
- package/dist/assets/fonts/infra/data-collector.js +35 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/dev-remote-font-provider-mod-resolver.js +14 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.d.ts +15 -0
- package/dist/assets/fonts/infra/dev-url-proxy-hash-resolver.js +37 -0
- package/dist/assets/fonts/infra/dev-url-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/dev-url-resolver.js +29 -0
- package/dist/assets/fonts/infra/font-type-extractor.d.ts +5 -0
- package/dist/assets/fonts/infra/font-type-extractor.js +21 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.d.ts +11 -0
- package/dist/assets/fonts/infra/fontace-font-file-reader.js +25 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.d.ts +5 -0
- package/dist/assets/fonts/infra/levenshtein-string-matcher.js +145 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/local-url-proxy-content-resolver.js +14 -0
- package/dist/assets/fonts/{implementations/css-renderer.d.ts → infra/minifiable-css-renderer.d.ts} +8 -3
- package/dist/assets/fonts/{implementations/css-renderer.js → infra/minifiable-css-renderer.js} +12 -10
- package/dist/assets/fonts/infra/remote-font-provider-resolver.d.ts +10 -0
- package/dist/assets/fonts/infra/remote-font-provider-resolver.js +49 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.d.ts +4 -0
- package/dist/assets/fonts/infra/remote-url-proxy-content-resolver.js +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.d.ts +9 -0
- package/dist/assets/fonts/infra/require-local-provider-url-resolver.js +22 -0
- package/dist/assets/fonts/infra/system-fallbacks-provider.d.ts +6 -0
- package/dist/assets/fonts/{implementations → infra}/system-fallbacks-provider.js +8 -11
- package/dist/assets/fonts/infra/unstorage-fs-storage.d.ts +11 -0
- package/dist/assets/fonts/infra/unstorage-fs-storage.js +26 -0
- package/dist/assets/fonts/infra/url-proxy.d.ts +16 -0
- package/dist/assets/fonts/infra/url-proxy.js +50 -0
- package/dist/assets/fonts/infra/xxhash-hasher.d.ts +7 -0
- package/dist/assets/fonts/infra/xxhash-hasher.js +18 -0
- package/dist/assets/fonts/orchestrate.d.ts +1 -2
- package/dist/assets/fonts/orchestrate.js +50 -17
- package/dist/assets/fonts/providers/index.d.ts +6 -24
- package/dist/assets/fonts/types.d.ts +138 -8
- package/dist/assets/fonts/utils.d.ts +1 -2
- package/dist/assets/fonts/vite-plugin-fonts.js +56 -61
- package/dist/assets/services/noop.js +5 -0
- package/dist/assets/utils/index.d.ts +0 -2
- package/dist/assets/utils/index.js +0 -5
- package/dist/assets/utils/{transformToPath.d.ts → node.d.ts} +15 -1
- package/dist/assets/utils/{node/emitAsset.js → node.js} +34 -6
- package/dist/assets/utils/remotePattern.d.ts +1 -3
- package/dist/assets/utils/svg.d.ts +2 -1
- package/dist/assets/utils/svg.js +30 -4
- package/dist/assets/vite-plugin-assets.js +10 -8
- package/dist/cli/add/index.js +21 -13
- package/dist/cli/create-key/infra/crypto-key-generator.d.ts +3 -1
- package/dist/cli/create-key/infra/crypto-key-generator.js +7 -9
- package/dist/cli/definitions.d.ts +19 -2
- package/dist/cli/dev/index.js +1 -1
- package/dist/cli/docs/core/open-docs.d.ts +5 -3
- package/dist/cli/docs/core/open-docs.js +2 -9
- package/dist/cli/docs/definitions.d.ts +3 -11
- package/dist/cli/docs/domain/cloud-ide.d.ts +1 -0
- package/dist/cli/docs/domain/cloud-ide.js +0 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.d.ts +5 -0
- package/dist/cli/docs/infra/process-cloud-ide-provider.js +6 -0
- package/dist/cli/flags.d.ts +1 -0
- package/dist/cli/index.js +78 -21
- package/dist/cli/info/core/get-package-manager.d.ts +8 -0
- package/dist/cli/info/core/get-package-manager.js +37 -0
- package/dist/cli/info/core/info.d.ts +21 -0
- package/dist/cli/info/core/info.js +21 -0
- package/dist/cli/info/definitions.d.ts +30 -0
- package/dist/cli/info/definitions.js +0 -0
- package/dist/cli/info/domain/debug-info.d.ts +1 -0
- package/dist/cli/info/domain/debug-info.js +0 -0
- package/dist/cli/info/infra/bun-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/bun-package-manager.js +9 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.d.ts +10 -0
- package/dist/cli/info/infra/cli-astro-config-resolver.js +36 -0
- package/dist/cli/info/infra/cli-clipboard.d.ts +13 -0
- package/dist/cli/info/infra/cli-clipboard.js +78 -0
- package/dist/cli/info/infra/cli-debug-info-provider.d.ts +15 -0
- package/dist/cli/info/infra/cli-debug-info-provider.js +57 -0
- package/dist/cli/info/infra/dev-debug-info-provider.d.ts +18 -0
- package/dist/cli/info/infra/dev-debug-info-provider.js +36 -0
- package/dist/cli/info/infra/noop-package-manager.d.ts +5 -0
- package/dist/cli/info/infra/noop-package-manager.js +9 -0
- package/dist/cli/info/infra/npm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/npm-package-manager.js +32 -0
- package/dist/cli/info/infra/pnpm-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/pnpm-package-manager.js +33 -0
- package/dist/cli/info/infra/process-node-version-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-node-version-provider.js +6 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.d.ts +4 -0
- package/dist/cli/info/infra/process-package-manager-user-agent-provider.js +7 -0
- package/dist/cli/info/infra/prompts-prompt.d.ts +11 -0
- package/dist/cli/info/infra/prompts-prompt.js +25 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.d.ts +10 -0
- package/dist/cli/info/infra/styled-debug-info-formatter.js +29 -0
- package/dist/cli/info/infra/yarn-package-manager.d.ts +10 -0
- package/dist/cli/info/infra/yarn-package-manager.js +34 -0
- package/dist/cli/infra/build-time-astro-version-provider.d.ts +3 -1
- package/dist/cli/infra/build-time-astro-version-provider.js +4 -8
- package/dist/cli/infra/cli-command-runner.d.ts +7 -4
- package/dist/cli/infra/cli-command-runner.js +14 -10
- package/dist/cli/infra/logger-help-display.d.ts +11 -7
- package/dist/cli/infra/logger-help-display.js +62 -50
- package/dist/cli/infra/passthrough-text-styler.d.ts +9 -0
- package/dist/cli/infra/passthrough-text-styler.js +23 -0
- package/dist/cli/infra/piccolore-text-styler.d.ts +2 -0
- package/dist/cli/infra/piccolore-text-styler.js +5 -0
- package/dist/cli/infra/process-operating-system-provider.d.ts +6 -0
- package/dist/cli/infra/process-operating-system-provider.js +12 -0
- package/dist/cli/infra/tinyexec-command-executor.d.ts +6 -0
- package/dist/cli/infra/tinyexec-command-executor.js +34 -0
- package/dist/cli/install-package.js +1 -1
- package/dist/cli/preferences/index.js +6 -2
- package/dist/cli/preview/index.js +1 -1
- package/dist/cli/utils/format-version.js +1 -1
- package/dist/config/index.js +9 -5
- package/dist/container/index.js +19 -13
- package/dist/container/pipeline.d.ts +2 -1
- package/dist/container/pipeline.js +4 -11
- package/dist/content/config.d.ts +34 -40
- package/dist/content/content-layer.js +13 -18
- package/dist/content/loaders/errors.d.ts +3 -3
- package/dist/content/loaders/errors.js +5 -2
- package/dist/content/loaders/glob.js +6 -1
- package/dist/content/loaders/types.d.ts +11 -4
- package/dist/content/runtime-assets.d.ts +4 -4
- package/dist/content/runtime-assets.js +2 -2
- package/dist/content/runtime.d.ts +21 -20
- package/dist/content/runtime.js +14 -16
- package/dist/content/types-generator.js +81 -54
- package/dist/content/utils.d.ts +46 -338
- package/dist/content/utils.js +43 -48
- package/dist/content/vite-plugin-content-assets.d.ts +12 -4
- package/dist/content/vite-plugin-content-assets.js +100 -56
- package/dist/content/vite-plugin-content-imports.js +10 -4
- package/dist/content/vite-plugin-content-virtual-mod.js +10 -7
- package/dist/core/app/app.d.ts +5 -0
- package/dist/core/app/app.js +13 -0
- package/dist/core/app/base.d.ts +132 -0
- package/dist/core/app/base.js +448 -0
- package/dist/core/app/common.d.ts +6 -2
- package/dist/core/app/common.js +60 -33
- package/dist/core/app/dev/app.d.ts +15 -0
- package/dist/core/app/dev/app.js +86 -0
- package/dist/core/app/dev/pipeline.d.ts +13 -0
- package/dist/core/app/dev/pipeline.js +123 -0
- package/dist/core/app/entrypoint.d.ts +2 -0
- package/dist/core/app/entrypoint.js +15 -0
- package/dist/core/app/index.d.ts +7 -99
- package/dist/core/app/index.js +20 -486
- package/dist/core/app/logging.d.ts +3 -0
- package/dist/core/app/logging.js +11 -0
- package/dist/core/app/manifest.d.ts +9 -0
- package/dist/core/app/manifest.js +107 -0
- package/dist/core/app/middlewares.js +1 -1
- package/dist/core/app/node.js +14 -13
- package/dist/core/app/pipeline.d.ts +6 -5
- package/dist/core/app/pipeline.js +65 -49
- package/dist/core/app/types.d.ts +58 -22
- package/dist/core/app/validate-forwarded-headers.d.ts +16 -0
- package/dist/core/app/validate-forwarded-headers.js +60 -0
- package/dist/core/base-pipeline.d.ts +22 -14
- package/dist/core/base-pipeline.js +54 -6
- package/dist/core/build/app.d.ts +13 -0
- package/dist/core/build/app.js +38 -0
- package/dist/core/build/common.d.ts +1 -1
- package/dist/core/build/common.js +2 -2
- package/dist/core/build/generate.d.ts +1 -1
- package/dist/core/build/generate.js +96 -204
- package/dist/core/build/graph.js +2 -2
- package/dist/core/build/index.js +11 -16
- package/dist/core/build/internal.d.ts +2 -27
- package/dist/core/build/internal.js +1 -44
- package/dist/core/build/page-data.js +1 -1
- package/dist/core/build/pipeline.d.ts +15 -26
- package/dist/core/build/pipeline.js +106 -170
- package/dist/core/build/plugins/index.d.ts +4 -2
- package/dist/core/build/plugins/index.js +17 -23
- package/dist/core/build/plugins/plugin-analyzer.d.ts +2 -2
- package/dist/core/build/plugins/plugin-analyzer.js +5 -13
- package/dist/core/build/plugins/plugin-component-entry.d.ts +7 -2
- package/dist/core/build/plugins/plugin-component-entry.js +5 -13
- package/dist/core/build/plugins/plugin-css.d.ts +2 -2
- package/dist/core/build/plugins/plugin-css.js +86 -41
- package/dist/core/build/plugins/plugin-internals.d.ts +2 -2
- package/dist/core/build/plugins/plugin-internals.js +24 -18
- package/dist/core/build/plugins/plugin-manifest.d.ts +33 -5
- package/dist/core/build/plugins/plugin-manifest.js +89 -129
- package/dist/core/build/plugins/plugin-middleware.d.ts +2 -2
- package/dist/core/build/plugins/plugin-middleware.js +5 -7
- package/dist/core/build/plugins/plugin-noop.d.ts +3 -0
- package/dist/core/build/plugins/plugin-noop.js +29 -0
- package/dist/core/build/plugins/plugin-prerender.d.ts +2 -2
- package/dist/core/build/plugins/plugin-prerender.js +7 -64
- package/dist/core/build/plugins/plugin-scripts.d.ts +5 -2
- package/dist/core/build/plugins/plugin-scripts.js +5 -13
- package/dist/core/build/plugins/plugin-ssr.d.ts +2 -2
- package/dist/core/build/plugins/plugin-ssr.js +60 -132
- package/dist/core/build/plugins/util.d.ts +1 -25
- package/dist/core/build/plugins/util.js +0 -47
- package/dist/core/build/runtime.d.ts +26 -0
- package/dist/core/build/runtime.js +45 -0
- package/dist/core/build/static-build.d.ts +2 -2
- package/dist/core/build/static-build.js +181 -155
- package/dist/core/build/types.d.ts +1 -2
- package/dist/core/build/util.d.ts +0 -1
- package/dist/core/build/util.js +0 -7
- package/dist/core/compile/compile.d.ts +2 -3
- package/dist/core/compile/compile.js +2 -2
- package/dist/core/config/config.js +3 -3
- package/dist/core/config/index.d.ts +0 -1
- package/dist/core/config/index.js +0 -2
- package/dist/core/config/schemas/base.d.ts +336 -1434
- package/dist/core/config/schemas/base.js +42 -41
- package/dist/core/config/schemas/refined.d.ts +2 -2
- package/dist/core/config/schemas/refined.js +1 -1
- package/dist/core/config/schemas/relative.d.ts +672 -1761
- package/dist/core/config/schemas/relative.js +4 -4
- package/dist/core/config/settings.d.ts +3 -3
- package/dist/core/config/settings.js +5 -6
- package/dist/core/config/validate.js +13 -2
- package/dist/core/config/vite-load.js +12 -3
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +20 -1
- package/dist/core/create-vite.d.ts +2 -6
- package/dist/core/create-vite.js +35 -43
- package/dist/core/csp/common.d.ts +1 -1
- package/dist/core/csp/common.js +1 -1
- package/dist/core/csp/config.d.ts +8 -4
- package/dist/core/csp/config.js +1 -1
- package/dist/core/csp/runtime.d.ts +11 -0
- package/dist/core/csp/runtime.js +35 -0
- package/dist/core/dev/container.js +13 -7
- package/dist/core/dev/dev.js +2 -2
- package/dist/core/dev/restart.js +15 -6
- package/dist/core/errors/dev/runtime.d.ts +6 -0
- package/dist/core/errors/dev/runtime.js +27 -0
- package/dist/core/errors/dev/utils.js +1 -1
- package/dist/core/errors/dev/vite.js +1 -1
- package/dist/core/errors/errors-data.d.ts +27 -7
- package/dist/core/errors/errors-data.js +17 -4
- package/dist/core/errors/errors.d.ts +3 -3
- package/dist/core/errors/errors.js +8 -8
- package/dist/core/errors/zod-error-map.d.ts +2 -2
- package/dist/core/errors/zod-error-map.js +26 -24
- package/dist/core/logger/core.js +1 -1
- package/dist/core/messages.d.ts +2 -2
- package/dist/core/messages.js +3 -3
- package/dist/core/middleware/callMiddleware.js +1 -1
- package/dist/core/middleware/defineMiddleware.d.ts +2 -0
- package/dist/core/middleware/defineMiddleware.js +6 -0
- package/dist/core/middleware/index.d.ts +3 -3
- package/dist/core/middleware/index.js +1 -3
- package/dist/core/middleware/sequence.js +4 -4
- package/dist/core/middleware/vite-plugin.d.ts +1 -1
- package/dist/core/middleware/vite-plugin.js +18 -7
- package/dist/core/module-loader/index.d.ts +2 -2
- package/dist/core/module-loader/index.js +1 -1
- package/dist/core/module-loader/{loader.d.ts → runner.d.ts} +6 -17
- package/dist/core/module-loader/{loader.js → runner.js} +3 -0
- package/dist/core/module-loader/vite.d.ts +3 -2
- package/dist/core/module-loader/vite.js +17 -13
- package/dist/core/preview/index.js +20 -3
- package/dist/core/preview/static-preview-server.js +11 -0
- package/dist/core/redirects/component.js +1 -2
- package/dist/core/redirects/index.d.ts +0 -1
- package/dist/core/redirects/index.js +1 -3
- package/dist/core/redirects/render.js +5 -2
- package/dist/core/render/paginate.d.ts +1 -1
- package/dist/core/render/paginate.js +8 -6
- package/dist/core/render/params-and-props.d.ts +2 -0
- package/dist/core/render/params-and-props.js +19 -6
- package/dist/core/render/route-cache.d.ts +3 -2
- package/dist/core/render/route-cache.js +6 -5
- package/dist/core/render-context.d.ts +6 -4
- package/dist/core/render-context.js +66 -25
- package/dist/core/routing/astro-designed-error-pages.js +2 -2
- package/dist/core/routing/default.js +1 -1
- package/dist/core/routing/helpers.d.ts +22 -0
- package/dist/core/routing/helpers.js +25 -0
- package/dist/core/routing/index.d.ts +1 -1
- package/dist/core/routing/index.js +2 -2
- package/dist/core/routing/manifest/create.d.ts +6 -1
- package/dist/core/routing/manifest/create.js +11 -14
- package/dist/core/routing/manifest/generator.d.ts +3 -1
- package/dist/core/routing/params.d.ts +2 -1
- package/dist/core/routing/params.js +3 -2
- package/dist/core/server-islands/endpoint.js +40 -19
- package/dist/core/server-islands/vite-plugin-server-islands.d.ts +1 -1
- package/dist/core/server-islands/vite-plugin-server-islands.js +89 -44
- package/dist/core/session/vite-plugin.d.ts +6 -0
- package/dist/core/session/vite-plugin.js +53 -0
- package/dist/core/session.d.ts +4 -2
- package/dist/core/session.js +8 -48
- package/dist/core/sync/index.d.ts +2 -5
- package/dist/core/sync/index.js +34 -22
- package/dist/core/util/pathname.d.ts +10 -0
- package/dist/core/util/pathname.js +17 -0
- package/dist/core/util.d.ts +2 -2
- package/dist/core/util.js +3 -3
- package/dist/entrypoints/legacy.d.ts +2 -0
- package/dist/entrypoints/legacy.js +12 -0
- package/dist/entrypoints/prerender.d.ts +4 -0
- package/dist/entrypoints/prerender.js +7 -0
- package/dist/env/schema.d.ts +21 -251
- package/dist/env/schema.js +6 -3
- package/dist/env/vite-plugin-env.js +15 -10
- package/dist/env/vite-plugin-import-meta-env.js +3 -2
- package/dist/environments.d.ts +3 -0
- package/dist/environments.js +11 -0
- package/dist/events/error.d.ts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/utils.d.ts +1 -6
- package/dist/i18n/utils.js +1 -63
- package/dist/i18n/vite-plugin-i18n.d.ts +0 -5
- package/dist/i18n/vite-plugin-i18n.js +1 -22
- package/dist/integrations/hooks.d.ts +1 -1
- package/dist/integrations/hooks.js +10 -7
- package/dist/manifest/serialized.d.ts +9 -0
- package/dist/manifest/serialized.js +144 -0
- package/dist/manifest/virtual-module.d.ts +1 -4
- package/dist/manifest/virtual-module.js +77 -80
- package/dist/preferences/index.d.ts +1 -2
- package/dist/prerender/routing.d.ts +5 -7
- package/dist/prerender/routing.js +6 -17
- package/dist/runtime/client/dev-toolbar/ui-library/badge.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/button.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/card.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/highlight.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/radio-checkbox.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/select.d.ts +2 -2
- package/dist/runtime/client/dev-toolbar/ui-library/toggle.d.ts +2 -2
- package/dist/runtime/server/endpoint.js +1 -1
- package/dist/runtime/server/render/server-islands.js +5 -4
- package/dist/runtime/server/transition.d.ts +1 -0
- package/dist/template/4xx.js +3 -1
- package/dist/transitions/events.d.ts +7 -0
- package/dist/transitions/router.js +7 -3
- package/dist/transitions/swap-functions.js +4 -0
- package/dist/types/astro.d.ts +8 -6
- package/dist/types/public/config.d.ts +404 -288
- package/dist/types/public/context.d.ts +3 -4
- package/dist/types/public/index.d.ts +2 -1
- package/dist/types/public/integrations.d.ts +23 -1
- package/dist/types/public/internal.d.ts +1 -16
- package/dist/types/public/preview.d.ts +6 -0
- package/dist/virtual-modules/i18n.d.ts +10 -2
- package/dist/virtual-modules/i18n.js +16 -7
- package/dist/virtual-modules/live-config.d.ts +1 -1
- package/dist/virtual-modules/live-config.js +1 -1
- package/dist/virtual-modules/middleware.d.ts +2 -1
- package/dist/virtual-modules/middleware.js +2 -1
- package/dist/vite-plugin-adapter-config/index.js +3 -2
- package/dist/vite-plugin-app/app.d.ts +47 -0
- package/dist/vite-plugin-app/app.js +410 -0
- package/dist/vite-plugin-app/createAstroServerApp.d.ts +8 -0
- package/dist/vite-plugin-app/createAstroServerApp.js +56 -0
- package/dist/vite-plugin-app/index.d.ts +3 -0
- package/dist/vite-plugin-app/index.js +16 -0
- package/dist/{vite-plugin-astro-server → vite-plugin-app}/pipeline.d.ts +6 -7
- package/dist/vite-plugin-app/pipeline.js +166 -0
- package/dist/vite-plugin-astro/index.js +21 -7
- package/dist/vite-plugin-astro-server/base.js +1 -1
- package/dist/vite-plugin-astro-server/controller.d.ts +1 -1
- package/dist/vite-plugin-astro-server/error.d.ts +3 -4
- package/dist/vite-plugin-astro-server/error.js +2 -5
- package/dist/vite-plugin-astro-server/index.d.ts +1 -2
- package/dist/vite-plugin-astro-server/index.js +6 -4
- package/dist/vite-plugin-astro-server/metadata.js +1 -1
- package/dist/vite-plugin-astro-server/plugin.d.ts +4 -7
- package/dist/vite-plugin-astro-server/plugin.js +54 -65
- package/dist/vite-plugin-astro-server/server-state.d.ts +1 -1
- package/dist/vite-plugin-astro-server/util.d.ts +0 -2
- package/dist/vite-plugin-astro-server/util.js +1 -2
- package/dist/vite-plugin-astro-server/vite.d.ts +2 -2
- package/dist/vite-plugin-astro-server/vite.js +7 -7
- package/dist/vite-plugin-config-alias/index.js +40 -32
- package/dist/vite-plugin-css/index.d.ts +18 -0
- package/dist/vite-plugin-css/index.js +134 -0
- package/dist/vite-plugin-css/util.d.ts +5 -0
- package/dist/vite-plugin-css/util.js +8 -0
- package/dist/vite-plugin-environment/index.d.ts +15 -0
- package/dist/vite-plugin-environment/index.js +77 -0
- package/dist/vite-plugin-head/index.d.ts +1 -2
- package/dist/vite-plugin-head/index.js +42 -58
- package/dist/vite-plugin-hmr-reload/index.js +2 -1
- package/dist/vite-plugin-pages/const.d.ts +2 -0
- package/dist/vite-plugin-pages/const.js +6 -0
- package/dist/vite-plugin-pages/index.d.ts +2 -0
- package/dist/vite-plugin-pages/index.js +7 -0
- package/dist/vite-plugin-pages/page.d.ts +7 -0
- package/dist/vite-plugin-pages/page.js +48 -0
- package/dist/vite-plugin-pages/pages.d.ts +8 -0
- package/dist/vite-plugin-pages/pages.js +57 -0
- package/dist/vite-plugin-pages/util.d.ts +8 -0
- package/dist/vite-plugin-pages/util.js +15 -0
- package/dist/vite-plugin-renderers/index.d.ts +9 -0
- package/dist/vite-plugin-renderers/index.js +40 -0
- package/dist/vite-plugin-routes/index.d.ts +14 -0
- package/dist/vite-plugin-routes/index.js +177 -0
- package/dist/vite-plugin-scripts/index.js +2 -6
- package/dist/vite-plugin-scripts/page-ssr.js +3 -2
- package/dist/zod.d.ts +2 -2
- package/dist/zod.js +2 -2
- package/package.json +34 -31
- package/templates/content/module.mjs +1 -0
- package/templates/content/types.d.ts +24 -11
- package/types/actions.d.ts +1 -5
- package/types/content.d.ts +9 -11
- package/types/transitions.d.ts +25 -0
- package/dist/actions/loadActions.d.ts +0 -8
- package/dist/actions/loadActions.js +0 -13
- package/dist/actions/runtime/route.d.ts +0 -2
- package/dist/actions/runtime/shared.d.ts +0 -60
- package/dist/actions/runtime/shared.js +0 -296
- package/dist/actions/runtime/utils.d.ts +0 -25
- package/dist/actions/runtime/utils.js +0 -16
- package/dist/actions/runtime/virtual.d.ts +0 -4
- package/dist/actions/runtime/virtual.js +0 -127
- package/dist/assets/fonts/implementations/data-collector.d.ts +0 -3
- package/dist/assets/fonts/implementations/data-collector.js +0 -21
- package/dist/assets/fonts/implementations/error-handler.d.ts +0 -2
- package/dist/assets/fonts/implementations/error-handler.js +0 -41
- package/dist/assets/fonts/implementations/font-fetcher.d.ts +0 -8
- package/dist/assets/fonts/implementations/font-fetcher.js +0 -34
- package/dist/assets/fonts/implementations/font-file-reader.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-file-reader.js +0 -26
- package/dist/assets/fonts/implementations/font-metrics-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/font-metrics-resolver.js +0 -66
- package/dist/assets/fonts/implementations/font-type-extractor.d.ts +0 -4
- package/dist/assets/fonts/implementations/font-type-extractor.js +0 -22
- package/dist/assets/fonts/implementations/hasher.d.ts +0 -2
- package/dist/assets/fonts/implementations/hasher.js +0 -14
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.d.ts +0 -2
- package/dist/assets/fonts/implementations/levenshtein-string-matcher.js +0 -147
- package/dist/assets/fonts/implementations/local-provider-url-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/local-provider-url-resolver.js +0 -17
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-mod-resolver.js +0 -20
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.d.ts +0 -6
- package/dist/assets/fonts/implementations/remote-font-provider-resolver.js +0 -47
- package/dist/assets/fonts/implementations/storage.d.ts +0 -4
- package/dist/assets/fonts/implementations/storage.js +0 -14
- package/dist/assets/fonts/implementations/system-fallbacks-provider.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.d.ts +0 -5
- package/dist/assets/fonts/implementations/url-proxy-content-resolver.js +0 -28
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.d.ts +0 -8
- package/dist/assets/fonts/implementations/url-proxy-hash-resolver.js +0 -39
- package/dist/assets/fonts/implementations/url-proxy.d.ts +0 -7
- package/dist/assets/fonts/implementations/url-proxy.js +0 -31
- package/dist/assets/fonts/implementations/url-resolver.d.ts +0 -11
- package/dist/assets/fonts/implementations/url-resolver.js +0 -55
- package/dist/assets/utils/node/emitAsset.d.ts +0 -15
- package/dist/assets/utils/transformToPath.js +0 -32
- package/dist/cli/docs/domains/platform.d.ts +0 -1
- package/dist/cli/docs/infra/process-platform-provider.d.ts +0 -2
- package/dist/cli/docs/infra/process-platform-provider.js +0 -11
- package/dist/cli/docs/infra/tinyexec-command-executor.d.ts +0 -2
- package/dist/cli/docs/infra/tinyexec-command-executor.js +0 -30
- package/dist/cli/info/index.d.ts +0 -12
- package/dist/cli/info/index.js +0 -267
- package/dist/cli/infra/picocolors-text-styler.d.ts +0 -2
- package/dist/cli/infra/picocolors-text-styler.js +0 -7
- package/dist/core/build/css-asset-name.d.ts +0 -9
- package/dist/core/build/css-asset-name.js +0 -89
- package/dist/core/build/plugin.d.ts +0 -43
- package/dist/core/build/plugin.js +0 -61
- package/dist/core/build/plugins/plugin-actions.d.ts +0 -4
- package/dist/core/build/plugins/plugin-actions.js +0 -16
- package/dist/core/build/plugins/plugin-chunks.d.ts +0 -2
- package/dist/core/build/plugins/plugin-chunks.js +0 -33
- package/dist/core/build/plugins/plugin-pages.d.ts +0 -6
- package/dist/core/build/plugins/plugin-pages.js +0 -66
- package/dist/core/build/plugins/plugin-renderers.d.ts +0 -5
- package/dist/core/build/plugins/plugin-renderers.js +0 -54
- package/dist/core/middleware/loadMiddleware.d.ts +0 -7
- package/dist/core/middleware/loadMiddleware.js +0 -14
- package/dist/core/redirects/helpers.d.ts +0 -7
- package/dist/core/redirects/helpers.js +0 -10
- package/dist/core/routing/manifest/serialization.d.ts +0 -5
- package/dist/core/routing/manifest/serialization.js +0 -37
- package/dist/prerender/metadata.d.ts +0 -8
- package/dist/prerender/metadata.js +0 -18
- package/dist/vite-plugin-astro-server/css.d.ts +0 -13
- package/dist/vite-plugin-astro-server/css.js +0 -48
- package/dist/vite-plugin-astro-server/pipeline.js +0 -161
- package/dist/vite-plugin-astro-server/request.d.ts +0 -14
- package/dist/vite-plugin-astro-server/request.js +0 -66
- package/dist/vite-plugin-astro-server/route.d.ts +0 -25
- package/dist/vite-plugin-astro-server/route.js +0 -283
- package/dist/vite-plugin-scanner/index.d.ts +0 -10
- package/dist/vite-plugin-scanner/index.js +0 -87
- package/dist/vite-plugin-ssr-manifest/index.d.ts +0 -2
- package/dist/vite-plugin-ssr-manifest/index.js +0 -26
- /package/dist/{cli/docs/domains/platform.js → actions/runtime/types.js} +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/extract-unifont-providers.js +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/normalize-remote-font-faces.js +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/optimize-fallbacks.js +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.d.ts +0 -0
- /package/dist/assets/fonts/{logic → core}/resolve-families.js +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { vitePluginMiddlewareBuild } from "../../middleware/vite-plugin.js";
|
|
2
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
2
3
|
function pluginMiddleware(opts, internals) {
|
|
4
|
+
const plugin = vitePluginMiddlewareBuild(opts, internals);
|
|
3
5
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
vitePlugin: vitePluginMiddlewareBuild(opts, internals)
|
|
9
|
-
};
|
|
10
|
-
}
|
|
6
|
+
...plugin,
|
|
7
|
+
applyToEnvironment(environment) {
|
|
8
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
|
11
9
|
}
|
|
12
10
|
};
|
|
13
11
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const NOOP_MODULE_ID = "virtual:astro:noop";
|
|
2
|
+
const RESOLVED_NOOP_MODULE_ID = "\0" + NOOP_MODULE_ID;
|
|
3
|
+
function pluginNoop() {
|
|
4
|
+
return {
|
|
5
|
+
name: "plugin-noop",
|
|
6
|
+
resolveId(id) {
|
|
7
|
+
if (id === NOOP_MODULE_ID) {
|
|
8
|
+
return RESOLVED_NOOP_MODULE_ID;
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
load(id) {
|
|
12
|
+
if (id === RESOLVED_NOOP_MODULE_ID) {
|
|
13
|
+
return "export const noop = {};";
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
generateBundle(_options, bundle) {
|
|
17
|
+
for (const [name, chunk] of Object.entries(bundle)) {
|
|
18
|
+
if (chunk.type === "asset") continue;
|
|
19
|
+
if (chunk.facadeModuleId === RESOLVED_NOOP_MODULE_ID) {
|
|
20
|
+
delete bundle[name];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
NOOP_MODULE_ID,
|
|
28
|
+
pluginNoop
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
1
2
|
import type { BuildInternals } from '../internal.js';
|
|
2
|
-
import type { AstroBuildPlugin } from '../plugin.js';
|
|
3
3
|
import type { StaticBuildOptions } from '../types.js';
|
|
4
|
-
export declare function pluginPrerender(
|
|
4
|
+
export declare function pluginPrerender(_opts: StaticBuildOptions, internals: BuildInternals): VitePlugin;
|
|
@@ -1,75 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { getPagesFromVirtualModulePageName } from "./util.js";
|
|
4
|
-
function vitePluginPrerender(internals) {
|
|
1
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
2
|
+
function pluginPrerender(_opts, internals) {
|
|
5
3
|
return {
|
|
6
4
|
name: "astro:rollup-plugin-prerender",
|
|
7
|
-
|
|
5
|
+
applyToEnvironment(environment) {
|
|
6
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
|
7
|
+
},
|
|
8
|
+
generateBundle() {
|
|
8
9
|
const moduleIds = this.getModuleIds();
|
|
9
10
|
for (const id of moduleIds) {
|
|
10
11
|
const pageInfo = internals.pagesByViteID.get(id);
|
|
11
12
|
if (!pageInfo) continue;
|
|
12
13
|
const moduleInfo = this.getModuleInfo(id);
|
|
13
14
|
if (!moduleInfo) continue;
|
|
14
|
-
|
|
15
|
-
pageInfo.route.prerender = prerender;
|
|
16
|
-
}
|
|
17
|
-
const nonPrerenderOnlyChunks = getNonPrerenderOnlyChunks(bundle, internals);
|
|
18
|
-
internals.prerenderOnlyChunks = Object.values(bundle).filter((chunk) => {
|
|
19
|
-
return chunk.type === "chunk" && !nonPrerenderOnlyChunks.has(chunk);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function getNonPrerenderOnlyChunks(bundle, internals) {
|
|
25
|
-
const chunks = Object.values(bundle);
|
|
26
|
-
const prerenderOnlyEntryChunks = /* @__PURE__ */ new Set();
|
|
27
|
-
const nonPrerenderOnlyEntryChunks = /* @__PURE__ */ new Set();
|
|
28
|
-
for (const chunk of chunks) {
|
|
29
|
-
if (chunk.type === "chunk" && chunk.isEntry) {
|
|
30
|
-
if (chunk.facadeModuleId?.startsWith(ASTRO_PAGE_RESOLVED_MODULE_ID)) {
|
|
31
|
-
const pageDatas = getPagesFromVirtualModulePageName(
|
|
32
|
-
internals,
|
|
33
|
-
ASTRO_PAGE_RESOLVED_MODULE_ID,
|
|
34
|
-
chunk.facadeModuleId
|
|
35
|
-
);
|
|
36
|
-
const prerender = pageDatas.every((pageData) => pageData.route.prerender);
|
|
37
|
-
if (prerender) {
|
|
38
|
-
prerenderOnlyEntryChunks.add(chunk);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
nonPrerenderOnlyEntryChunks.add(chunk);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const nonPrerenderOnlyChunks = new Set(nonPrerenderOnlyEntryChunks);
|
|
46
|
-
for (const chunk of nonPrerenderOnlyChunks) {
|
|
47
|
-
for (const importFileName of chunk.imports) {
|
|
48
|
-
const importChunk = bundle[importFileName];
|
|
49
|
-
if (importChunk?.type === "chunk") {
|
|
50
|
-
nonPrerenderOnlyChunks.add(importChunk);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
for (const dynamicImportFileName of chunk.dynamicImports) {
|
|
54
|
-
const dynamicImportChunk = bundle[dynamicImportFileName];
|
|
55
|
-
if (dynamicImportChunk?.type === "chunk" && !prerenderOnlyEntryChunks.has(dynamicImportChunk)) {
|
|
56
|
-
nonPrerenderOnlyChunks.add(dynamicImportChunk);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return nonPrerenderOnlyChunks;
|
|
61
|
-
}
|
|
62
|
-
function pluginPrerender(opts, internals) {
|
|
63
|
-
if (opts.settings.buildOutput === "static") {
|
|
64
|
-
return { targets: ["server"] };
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
targets: ["server"],
|
|
68
|
-
hooks: {
|
|
69
|
-
"build:before": () => {
|
|
70
|
-
return {
|
|
71
|
-
vitePlugin: vitePluginPrerender(internals)
|
|
72
|
-
};
|
|
15
|
+
pageInfo.route.prerender = Boolean(moduleInfo?.meta?.astro?.pageOptions?.prerender);
|
|
73
16
|
}
|
|
74
17
|
}
|
|
75
18
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
1
2
|
import type { BuildInternals } from '../internal.js';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Inline scripts from Astro files directly into the HTML.
|
|
5
|
+
*/
|
|
6
|
+
export declare function pluginScripts(internals: BuildInternals): VitePlugin;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { shouldInlineAsset } from "./util.js";
|
|
2
|
-
|
|
2
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
3
|
+
function pluginScripts(internals) {
|
|
3
4
|
let assetInlineLimit;
|
|
4
5
|
return {
|
|
5
6
|
name: "@astro/plugin-scripts",
|
|
7
|
+
applyToEnvironment(environment) {
|
|
8
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.client;
|
|
9
|
+
},
|
|
6
10
|
configResolved(config) {
|
|
7
11
|
assetInlineLimit = config.build.assetsInlineLimit;
|
|
8
12
|
},
|
|
@@ -25,18 +29,6 @@ function vitePluginScripts(internals) {
|
|
|
25
29
|
}
|
|
26
30
|
};
|
|
27
31
|
}
|
|
28
|
-
function pluginScripts(internals) {
|
|
29
|
-
return {
|
|
30
|
-
targets: ["client"],
|
|
31
|
-
hooks: {
|
|
32
|
-
"build:before": () => {
|
|
33
|
-
return {
|
|
34
|
-
vitePlugin: vitePluginScripts(internals)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
32
|
export {
|
|
41
33
|
pluginScripts
|
|
42
34
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
1
2
|
import type { BuildInternals } from '../internal.js';
|
|
2
|
-
import type { AstroBuildPlugin } from '../plugin.js';
|
|
3
3
|
import type { StaticBuildOptions } from '../types.js';
|
|
4
4
|
export declare const RESOLVED_SSR_VIRTUAL_MODULE_ID: string;
|
|
5
|
-
export declare function pluginSSR(options: StaticBuildOptions, internals: BuildInternals):
|
|
5
|
+
export declare function pluginSSR(options: StaticBuildOptions, internals: BuildInternals): VitePlugin[];
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { routeIsRedirect } from "../../redirects/index.js";
|
|
4
|
-
import { VIRTUAL_ISLAND_MAP_ID } from "../../server-islands/vite-plugin-server-islands.js";
|
|
5
|
-
import { addRollupInput } from "../add-rollup-input.js";
|
|
6
|
-
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from "./plugin-manifest.js";
|
|
7
|
-
import { ASTRO_PAGE_MODULE_ID } from "./plugin-pages.js";
|
|
8
|
-
import { RENDERERS_MODULE_ID } from "./plugin-renderers.js";
|
|
9
|
-
import { getVirtualModulePageName } from "./util.js";
|
|
10
|
-
const SSR_VIRTUAL_MODULE_ID = "@astrojs-ssr-virtual-entry";
|
|
1
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
2
|
+
const SSR_VIRTUAL_MODULE_ID = "virtual:astro:legacy-ssr-entry";
|
|
11
3
|
const RESOLVED_SSR_VIRTUAL_MODULE_ID = "\0" + SSR_VIRTUAL_MODULE_ID;
|
|
12
|
-
const ADAPTER_VIRTUAL_MODULE_ID = "
|
|
4
|
+
const ADAPTER_VIRTUAL_MODULE_ID = "virtual:astro:adapter-entrypoint";
|
|
13
5
|
const RESOLVED_ADAPTER_VIRTUAL_MODULE_ID = "\0" + ADAPTER_VIRTUAL_MODULE_ID;
|
|
6
|
+
const ADAPTER_CONFIG_VIRTUAL_MODULE_ID = "virtual:astro:adapter-config";
|
|
7
|
+
const RESOLVED_ADAPTER_CONFIG_VIRTUAL_MODULE_ID = "\0" + ADAPTER_CONFIG_VIRTUAL_MODULE_ID;
|
|
14
8
|
function vitePluginAdapter(adapter) {
|
|
15
9
|
return {
|
|
16
10
|
name: "@astrojs/vite-plugin-astro-adapter",
|
|
17
11
|
enforce: "post",
|
|
12
|
+
applyToEnvironment(environment) {
|
|
13
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
|
14
|
+
},
|
|
18
15
|
resolveId(id) {
|
|
19
16
|
if (id === ADAPTER_VIRTUAL_MODULE_ID) {
|
|
20
17
|
return RESOLVED_ADAPTER_VIRTUAL_MODULE_ID;
|
|
@@ -22,71 +19,70 @@ function vitePluginAdapter(adapter) {
|
|
|
22
19
|
},
|
|
23
20
|
async load(id) {
|
|
24
21
|
if (id === RESOLVED_ADAPTER_VIRTUAL_MODULE_ID) {
|
|
25
|
-
|
|
22
|
+
const adapterEntrypointStr = JSON.stringify(adapter.serverEntrypoint);
|
|
23
|
+
return {
|
|
24
|
+
code: `export * from ${adapterEntrypointStr};
|
|
25
|
+
import * as _serverEntrypoint from ${adapterEntrypointStr};
|
|
26
|
+
export default _serverEntrypoint.default;`
|
|
27
|
+
};
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function vitePluginAdapterConfig(adapter) {
|
|
31
33
|
return {
|
|
32
|
-
name: "@astrojs/vite-plugin-astro-
|
|
34
|
+
name: "@astrojs/vite-plugin-astro-adapter-config",
|
|
33
35
|
enforce: "post",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
inputs.add(getVirtualModulePageName(ASTRO_PAGE_MODULE_ID, pageData.component));
|
|
36
|
+
applyToEnvironment(environment) {
|
|
37
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
|
38
|
+
},
|
|
39
|
+
resolveId(id) {
|
|
40
|
+
if (id === ADAPTER_CONFIG_VIRTUAL_MODULE_ID) {
|
|
41
|
+
return RESOLVED_ADAPTER_CONFIG_VIRTUAL_MODULE_ID;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
},
|
|
44
|
+
load(id) {
|
|
45
|
+
if (id === RESOLVED_ADAPTER_CONFIG_VIRTUAL_MODULE_ID) {
|
|
46
|
+
return {
|
|
47
|
+
code: `export const args = ${adapter.args ? JSON.stringify(adapter.args, null, 2) : "undefined"};
|
|
48
|
+
export const exports = ${adapter.exports ? JSON.stringify(adapter.exports) : "undefined"};
|
|
49
|
+
export const adapterFeatures = ${adapter.adapterFeatures ? JSON.stringify(adapter.adapterFeatures, null, 2) : "undefined"};
|
|
50
|
+
export const serverEntrypoint = ${JSON.stringify(adapter.serverEntrypoint)};`
|
|
51
|
+
};
|
|
45
52
|
}
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function vitePluginSSR(internals, adapter) {
|
|
57
|
+
return {
|
|
58
|
+
name: "@astrojs/vite-plugin-astro-ssr-server",
|
|
59
|
+
enforce: "post",
|
|
60
|
+
applyToEnvironment(environment) {
|
|
61
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
|
|
48
62
|
},
|
|
49
63
|
resolveId(id) {
|
|
50
64
|
if (id === SSR_VIRTUAL_MODULE_ID) {
|
|
51
65
|
return RESOLVED_SSR_VIRTUAL_MODULE_ID;
|
|
52
66
|
}
|
|
53
67
|
},
|
|
54
|
-
|
|
68
|
+
load(id) {
|
|
55
69
|
if (id === RESOLVED_SSR_VIRTUAL_MODULE_ID) {
|
|
56
|
-
const { allPages } = options;
|
|
57
|
-
const imports = [];
|
|
58
|
-
const contents = [];
|
|
59
70
|
const exports = [];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
if (adapter.exports) {
|
|
72
|
+
exports.push(
|
|
73
|
+
...adapter.exports?.map((name) => {
|
|
74
|
+
if (name === "default") {
|
|
75
|
+
return `export default _exports.default;`;
|
|
76
|
+
} else {
|
|
77
|
+
return `export const ${name} = _exports['${name}'];`;
|
|
78
|
+
}
|
|
79
|
+
}) ?? []
|
|
69
80
|
);
|
|
70
|
-
let module = await this.resolve(virtualModuleName);
|
|
71
|
-
if (module) {
|
|
72
|
-
const variable = `_page${i}`;
|
|
73
|
-
imports.push(`const ${variable} = () => import("${virtualModuleName}");`);
|
|
74
|
-
const pageData2 = internals.pagesByKeys.get(pageData.key);
|
|
75
|
-
pageMap.push(
|
|
76
|
-
`[${JSON.stringify(pageData2?.component || pageData.component)}, ${variable}]`
|
|
77
|
-
);
|
|
78
|
-
i++;
|
|
79
|
-
}
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const middleware = await this.resolve(MIDDLEWARE_MODULE_ID);
|
|
86
|
-
const ssrCode = generateSSRCode(adapter, middleware.id);
|
|
87
|
-
imports.push(...ssrCode.imports);
|
|
88
|
-
contents.push(...ssrCode.contents);
|
|
89
|
-
return { code: [...imports, ...contents, ...exports].join("\n") };
|
|
82
|
+
return {
|
|
83
|
+
code: `import _exports from 'astro/entrypoints/legacy';
|
|
84
|
+
${exports.join("\n")}`
|
|
85
|
+
};
|
|
90
86
|
}
|
|
91
87
|
},
|
|
92
88
|
async generateBundle(_opts, bundle) {
|
|
@@ -95,85 +91,17 @@ function vitePluginSSR(internals, adapter, options) {
|
|
|
95
91
|
internals.staticFiles.add(chunk.fileName);
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
|
-
for (const [, chunk] of Object.entries(bundle)) {
|
|
99
|
-
if (chunk.type === "asset") {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (chunk.modules[RESOLVED_SSR_VIRTUAL_MODULE_ID]) {
|
|
103
|
-
internals.ssrEntryChunk = chunk;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
94
|
}
|
|
107
95
|
};
|
|
108
96
|
}
|
|
109
97
|
function pluginSSR(options, internals) {
|
|
98
|
+
const adapter = options.settings.adapter;
|
|
110
99
|
const ssr = options.settings.buildOutput === "server";
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const ssrPlugin = ssr && vitePluginSSR(internals, adapter, options);
|
|
117
|
-
const vitePlugin = [vitePluginAdapter(adapter)];
|
|
118
|
-
if (ssrPlugin) {
|
|
119
|
-
vitePlugin.unshift(ssrPlugin);
|
|
120
|
-
}
|
|
121
|
-
return {
|
|
122
|
-
enforce: "after-user-plugins",
|
|
123
|
-
vitePlugin
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
"build:post": async () => {
|
|
127
|
-
if (!ssr) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (!internals.ssrEntryChunk) {
|
|
131
|
-
throw new Error(`Did not generate an entry chunk for SSR`);
|
|
132
|
-
}
|
|
133
|
-
internals.ssrEntryChunk.fileName = options.settings.config.build.serverEntry;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function generateSSRCode(adapter, middlewareId) {
|
|
139
|
-
const edgeMiddleware = adapter?.adapterFeatures?.edgeMiddleware ?? false;
|
|
140
|
-
const imports = [
|
|
141
|
-
`import { renderers } from '${RENDERERS_MODULE_ID}';`,
|
|
142
|
-
`import * as serverEntrypointModule from '${ADAPTER_VIRTUAL_MODULE_ID}';`,
|
|
143
|
-
`import { manifest as defaultManifest } from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';`,
|
|
144
|
-
`import { serverIslandMap } from '${VIRTUAL_ISLAND_MAP_ID}';`
|
|
145
|
-
];
|
|
146
|
-
const contents = [
|
|
147
|
-
edgeMiddleware ? `const middleware = (_, next) => next()` : "",
|
|
148
|
-
`const _manifest = Object.assign(defaultManifest, {`,
|
|
149
|
-
` pageMap,`,
|
|
150
|
-
` serverIslandMap,`,
|
|
151
|
-
` renderers,`,
|
|
152
|
-
` actions: () => import("${ENTRYPOINT_VIRTUAL_MODULE_ID}"),`,
|
|
153
|
-
` middleware: ${edgeMiddleware ? "undefined" : `() => import("${middlewareId}")`}`,
|
|
154
|
-
`});`,
|
|
155
|
-
`const _args = ${adapter.args ? JSON.stringify(adapter.args, null, 4) : "undefined"};`,
|
|
156
|
-
adapter.exports ? `const _exports = serverEntrypointModule.createExports(_manifest, _args);` : "",
|
|
157
|
-
...adapter.exports?.map((name) => {
|
|
158
|
-
if (name === "default") {
|
|
159
|
-
return `export default _exports.default;`;
|
|
160
|
-
} else {
|
|
161
|
-
return `export const ${name} = _exports['${name}'];`;
|
|
162
|
-
}
|
|
163
|
-
}) ?? [],
|
|
164
|
-
// NOTE: This is intentionally obfuscated!
|
|
165
|
-
// Do NOT simplify this to something like `serverEntrypointModule.start?.(_manifest, _args)`
|
|
166
|
-
// They are NOT equivalent! Some bundlers will throw if `start` is not exported, but we
|
|
167
|
-
// only want to silently ignore it... hence the dynamic, obfuscated weirdness.
|
|
168
|
-
`const _start = 'start';
|
|
169
|
-
if (Object.prototype.hasOwnProperty.call(serverEntrypointModule, _start)) {
|
|
170
|
-
serverEntrypointModule[_start](_manifest, _args);
|
|
171
|
-
}`
|
|
172
|
-
];
|
|
173
|
-
return {
|
|
174
|
-
imports,
|
|
175
|
-
contents
|
|
176
|
-
};
|
|
100
|
+
const plugins = [vitePluginAdapter(adapter), vitePluginAdapterConfig(adapter)];
|
|
101
|
+
if (ssr) {
|
|
102
|
+
plugins.unshift(vitePluginSSR(internals, adapter));
|
|
103
|
+
}
|
|
104
|
+
return plugins;
|
|
177
105
|
}
|
|
178
106
|
export {
|
|
179
107
|
RESOLVED_SSR_VIRTUAL_MODULE_ID,
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import type { BuildOptions
|
|
2
|
-
import type { BuildInternals } from '../internal.js';
|
|
3
|
-
import type { PageBuildData } from '../types.js';
|
|
4
|
-
type OutputOptionsHook = Extract<VitePlugin['outputOptions'], Function>;
|
|
5
|
-
type OutputOptions = Parameters<OutputOptionsHook>[0];
|
|
6
|
-
type ExtendManualChunksHooks = {
|
|
7
|
-
before?: Rollup.GetManualChunk;
|
|
8
|
-
after?: Rollup.GetManualChunk;
|
|
9
|
-
};
|
|
10
|
-
export declare function extendManualChunks(outputOptions: OutputOptions, hooks: ExtendManualChunksHooks): void;
|
|
1
|
+
import type { BuildOptions } from 'vite';
|
|
11
2
|
export declare const ASTRO_PAGE_EXTENSION_POST_PATTERN = "@_@";
|
|
12
3
|
/**
|
|
13
4
|
* Generate a unique key to identify each page in the build process.
|
|
@@ -15,19 +6,4 @@ export declare const ASTRO_PAGE_EXTENSION_POST_PATTERN = "@_@";
|
|
|
15
6
|
* @param componentPath Usually pageData.component
|
|
16
7
|
*/
|
|
17
8
|
export declare function makePageDataKey(route: string, componentPath: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Prevents Rollup from triggering other plugins in the process by masking the extension (hence the virtual file).
|
|
20
|
-
* Inverse function of getComponentFromVirtualModulePageName() below.
|
|
21
|
-
* @param virtualModulePrefix The prefix used to create the virtual module
|
|
22
|
-
* @param path Page component path
|
|
23
|
-
*/
|
|
24
|
-
export declare function getVirtualModulePageName(virtualModulePrefix: string, path: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* From the VirtualModulePageName, and the internals, get all pageDatas that use this
|
|
27
|
-
* component as their entry point.
|
|
28
|
-
* @param virtualModulePrefix The prefix used to create the virtual module
|
|
29
|
-
* @param id Virtual module name
|
|
30
|
-
*/
|
|
31
|
-
export declare function getPagesFromVirtualModulePageName(internals: BuildInternals, virtualModulePrefix: string, id: string): PageBuildData[];
|
|
32
9
|
export declare function shouldInlineAsset(assetContent: string, assetPath: string, assetsInlineLimit: NonNullable<BuildOptions['assetsInlineLimit']>): boolean;
|
|
33
|
-
export {};
|
|
@@ -1,52 +1,8 @@
|
|
|
1
|
-
import { extname } from "node:path";
|
|
2
|
-
function extendManualChunks(outputOptions, hooks) {
|
|
3
|
-
const manualChunks = outputOptions.manualChunks;
|
|
4
|
-
outputOptions.manualChunks = function(id, meta) {
|
|
5
|
-
if (hooks.before) {
|
|
6
|
-
let value = hooks.before(id, meta);
|
|
7
|
-
if (value) {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
if (typeof manualChunks == "object") {
|
|
12
|
-
if (id in manualChunks) {
|
|
13
|
-
let value = manualChunks[id];
|
|
14
|
-
return value[0];
|
|
15
|
-
}
|
|
16
|
-
} else if (typeof manualChunks === "function") {
|
|
17
|
-
const outid = manualChunks.call(this, id, meta);
|
|
18
|
-
if (outid) {
|
|
19
|
-
return outid;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
if (hooks.after) {
|
|
23
|
-
return hooks.after(id, meta) || null;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
1
|
const ASTRO_PAGE_EXTENSION_POST_PATTERN = "@_@";
|
|
29
2
|
const ASTRO_PAGE_KEY_SEPARATOR = "&";
|
|
30
3
|
function makePageDataKey(route, componentPath) {
|
|
31
4
|
return route + ASTRO_PAGE_KEY_SEPARATOR + componentPath;
|
|
32
5
|
}
|
|
33
|
-
function getVirtualModulePageName(virtualModulePrefix, path) {
|
|
34
|
-
const extension = extname(path);
|
|
35
|
-
return virtualModulePrefix + (extension.startsWith(".") ? path.slice(0, -extension.length) + extension.replace(".", ASTRO_PAGE_EXTENSION_POST_PATTERN) : path);
|
|
36
|
-
}
|
|
37
|
-
function getPagesFromVirtualModulePageName(internals, virtualModulePrefix, id) {
|
|
38
|
-
const path = getComponentFromVirtualModulePageName(virtualModulePrefix, id);
|
|
39
|
-
const pages = [];
|
|
40
|
-
internals.pagesByKeys.forEach((pageData) => {
|
|
41
|
-
if (pageData.component === path) {
|
|
42
|
-
pages.push(pageData);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return pages;
|
|
46
|
-
}
|
|
47
|
-
function getComponentFromVirtualModulePageName(virtualModulePrefix, id) {
|
|
48
|
-
return id.slice(virtualModulePrefix.length).replace(ASTRO_PAGE_EXTENSION_POST_PATTERN, ".");
|
|
49
|
-
}
|
|
50
6
|
function shouldInlineAsset(assetContent, assetPath, assetsInlineLimit) {
|
|
51
7
|
if (typeof assetsInlineLimit === "function") {
|
|
52
8
|
const result = assetsInlineLimit(assetPath, Buffer.from(assetContent));
|
|
@@ -60,9 +16,6 @@ function shouldInlineAsset(assetContent, assetPath, assetsInlineLimit) {
|
|
|
60
16
|
}
|
|
61
17
|
export {
|
|
62
18
|
ASTRO_PAGE_EXTENSION_POST_PATTERN,
|
|
63
|
-
extendManualChunks,
|
|
64
|
-
getPagesFromVirtualModulePageName,
|
|
65
|
-
getVirtualModulePageName,
|
|
66
19
|
makePageDataKey,
|
|
67
20
|
shouldInlineAsset
|
|
68
21
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BuildInternals } from './internal.js';
|
|
2
|
+
import type { PageBuildData, StylesheetAsset } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* From its route and component, get the page data from the build internals.
|
|
5
|
+
* @param internals Build Internals with all the pages
|
|
6
|
+
* @param route The route of the page, used to identify the page
|
|
7
|
+
* @param component The component of the page, used to identify the page
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPageData(internals: BuildInternals, route: string, component: string): PageBuildData | undefined;
|
|
10
|
+
interface OrderInfo {
|
|
11
|
+
depth: number;
|
|
12
|
+
order: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sort a page's CSS by depth. A higher depth means that the CSS comes from shared subcomponents.
|
|
16
|
+
* A lower depth means it comes directly from the top-level page.
|
|
17
|
+
* Can be used to sort stylesheets so that shared rules come first
|
|
18
|
+
* and page-specific rules come after.
|
|
19
|
+
*/
|
|
20
|
+
export declare function cssOrder(a: OrderInfo, b: OrderInfo): 1 | -1;
|
|
21
|
+
/**
|
|
22
|
+
* Merges inline CSS into as few stylesheets as possible,
|
|
23
|
+
* preserving ordering when there are non-inlined in between.
|
|
24
|
+
*/
|
|
25
|
+
export declare function mergeInlineCss(acc: Array<StylesheetAsset>, current: StylesheetAsset): Array<StylesheetAsset>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { makePageDataKey } from "./plugins/util.js";
|
|
2
|
+
function getPageData(internals, route, component) {
|
|
3
|
+
let pageData = internals.pagesByKeys.get(makePageDataKey(route, component));
|
|
4
|
+
if (pageData) {
|
|
5
|
+
return pageData;
|
|
6
|
+
}
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
function cssOrder(a, b) {
|
|
10
|
+
let depthA = a.depth, depthB = b.depth, orderA = a.order, orderB = b.order;
|
|
11
|
+
if (orderA === -1 && orderB >= 0) {
|
|
12
|
+
return 1;
|
|
13
|
+
} else if (orderB === -1 && orderA >= 0) {
|
|
14
|
+
return -1;
|
|
15
|
+
} else if (orderA > orderB) {
|
|
16
|
+
return 1;
|
|
17
|
+
} else if (orderA < orderB) {
|
|
18
|
+
return -1;
|
|
19
|
+
} else {
|
|
20
|
+
if (depthA === -1) {
|
|
21
|
+
return -1;
|
|
22
|
+
} else if (depthB === -1) {
|
|
23
|
+
return 1;
|
|
24
|
+
} else {
|
|
25
|
+
return depthA > depthB ? -1 : 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function mergeInlineCss(acc, current) {
|
|
30
|
+
const lastAdded = acc.at(acc.length - 1);
|
|
31
|
+
const lastWasInline = lastAdded?.type === "inline";
|
|
32
|
+
const currentIsInline = current?.type === "inline";
|
|
33
|
+
if (lastWasInline && currentIsInline) {
|
|
34
|
+
const merged = { type: "inline", content: lastAdded.content + current.content };
|
|
35
|
+
acc[acc.length - 1] = merged;
|
|
36
|
+
return acc;
|
|
37
|
+
}
|
|
38
|
+
acc.push(current);
|
|
39
|
+
return acc;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
cssOrder,
|
|
43
|
+
getPageData,
|
|
44
|
+
mergeInlineCss
|
|
45
|
+
};
|
|
@@ -3,9 +3,9 @@ import type { RouteData } from '../../types/public/internal.js';
|
|
|
3
3
|
import type { StaticBuildOptions } from './types.js';
|
|
4
4
|
export declare function viteBuild(opts: StaticBuildOptions): Promise<{
|
|
5
5
|
internals: BuildInternals;
|
|
6
|
-
|
|
6
|
+
prerenderOutputDir: URL;
|
|
7
7
|
}>;
|
|
8
|
-
export declare function staticBuild(opts: StaticBuildOptions, internals: BuildInternals,
|
|
8
|
+
export declare function staticBuild(opts: StaticBuildOptions, internals: BuildInternals, prerenderOutputDir: URL): Promise<void>;
|
|
9
9
|
/**
|
|
10
10
|
* This function takes the virtual module name of any page entrypoint and
|
|
11
11
|
* transforms it to generate a final `.mjs` output file.
|