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,8 +1,8 @@
|
|
|
1
1
|
import { prependForwardSlash, removeFileExtension } from "../path.js";
|
|
2
2
|
import { viteID } from "../util.js";
|
|
3
|
-
import { makePageDataKey } from "./plugins/util.js";
|
|
4
3
|
function createBuildInternals() {
|
|
5
4
|
return {
|
|
5
|
+
clientInput: /* @__PURE__ */ new Set(),
|
|
6
6
|
cssModuleToChunkIdMap: /* @__PURE__ */ new Map(),
|
|
7
7
|
inlinedScripts: /* @__PURE__ */ new Map(),
|
|
8
8
|
entrySpecifierToBundleMap: /* @__PURE__ */ new Map(),
|
|
@@ -16,7 +16,6 @@ function createBuildInternals() {
|
|
|
16
16
|
discoveredScripts: /* @__PURE__ */ new Set(),
|
|
17
17
|
staticFiles: /* @__PURE__ */ new Set(),
|
|
18
18
|
componentMetadata: /* @__PURE__ */ new Map(),
|
|
19
|
-
prerenderOnlyChunks: [],
|
|
20
19
|
astroActionsEntryPoint: void 0,
|
|
21
20
|
middlewareEntryPoint: void 0,
|
|
22
21
|
clientChunksAndAssets: /* @__PURE__ */ new Set()
|
|
@@ -70,13 +69,6 @@ function* getPageDatasByClientOnlyID(internals, viteid) {
|
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
function getPageData(internals, route, component) {
|
|
74
|
-
let pageData = internals.pagesByKeys.get(makePageDataKey(route, component));
|
|
75
|
-
if (pageData) {
|
|
76
|
-
return pageData;
|
|
77
|
-
}
|
|
78
|
-
return void 0;
|
|
79
|
-
}
|
|
80
72
|
function getPageDataByViteID(internals, viteid) {
|
|
81
73
|
if (internals.pagesByViteID.has(viteid)) {
|
|
82
74
|
return internals.pagesByViteID.get(viteid);
|
|
@@ -91,46 +83,11 @@ function hasPrerenderedPages(internals) {
|
|
|
91
83
|
}
|
|
92
84
|
return false;
|
|
93
85
|
}
|
|
94
|
-
function cssOrder(a, b) {
|
|
95
|
-
let depthA = a.depth, depthB = b.depth, orderA = a.order, orderB = b.order;
|
|
96
|
-
if (orderA === -1 && orderB >= 0) {
|
|
97
|
-
return 1;
|
|
98
|
-
} else if (orderB === -1 && orderA >= 0) {
|
|
99
|
-
return -1;
|
|
100
|
-
} else if (orderA > orderB) {
|
|
101
|
-
return 1;
|
|
102
|
-
} else if (orderA < orderB) {
|
|
103
|
-
return -1;
|
|
104
|
-
} else {
|
|
105
|
-
if (depthA === -1) {
|
|
106
|
-
return -1;
|
|
107
|
-
} else if (depthB === -1) {
|
|
108
|
-
return 1;
|
|
109
|
-
} else {
|
|
110
|
-
return depthA > depthB ? -1 : 1;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function mergeInlineCss(acc, current) {
|
|
115
|
-
const lastAdded = acc.at(acc.length - 1);
|
|
116
|
-
const lastWasInline = lastAdded?.type === "inline";
|
|
117
|
-
const currentIsInline = current?.type === "inline";
|
|
118
|
-
if (lastWasInline && currentIsInline) {
|
|
119
|
-
const merged = { type: "inline", content: lastAdded.content + current.content };
|
|
120
|
-
acc[acc.length - 1] = merged;
|
|
121
|
-
return acc;
|
|
122
|
-
}
|
|
123
|
-
acc.push(current);
|
|
124
|
-
return acc;
|
|
125
|
-
}
|
|
126
86
|
export {
|
|
127
87
|
createBuildInternals,
|
|
128
|
-
cssOrder,
|
|
129
|
-
getPageData,
|
|
130
88
|
getPageDataByViteID,
|
|
131
89
|
getPageDatasByClientOnlyID,
|
|
132
90
|
hasPrerenderedPages,
|
|
133
|
-
mergeInlineCss,
|
|
134
91
|
trackClientOnlyPageDatas,
|
|
135
92
|
trackPageData,
|
|
136
93
|
trackScriptPageDatas
|
|
@@ -1,53 +1,42 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentInstance } from '../../types/astro.js';
|
|
2
2
|
import type { RewritePayload } from '../../types/public/common.js';
|
|
3
3
|
import type { RouteData, SSRResult } from '../../types/public/internal.js';
|
|
4
4
|
import type { SSRManifest } from '../app/types.js';
|
|
5
5
|
import type { TryRewriteResult } from '../base-pipeline.js';
|
|
6
|
-
import { Pipeline } from '../
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
6
|
+
import { Pipeline } from '../base-pipeline.js';
|
|
7
|
+
import type { BuildInternals } from './internal.js';
|
|
8
|
+
import type { SinglePageBuiltModule, StaticBuildOptions } from './types.js';
|
|
9
9
|
/**
|
|
10
10
|
* The build pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.
|
|
11
11
|
*/
|
|
12
12
|
export declare class BuildPipeline extends Pipeline {
|
|
13
13
|
#private;
|
|
14
|
-
readonly internals: BuildInternals;
|
|
15
14
|
readonly manifest: SSRManifest;
|
|
16
|
-
readonly options: StaticBuildOptions;
|
|
17
|
-
readonly config: import("../../index.js").AstroConfig;
|
|
18
|
-
readonly settings: AstroSettings;
|
|
19
15
|
readonly defaultRoutes: {
|
|
20
16
|
instance: ComponentInstance;
|
|
21
17
|
matchesComponent(filePath: URL): boolean;
|
|
22
18
|
route: string;
|
|
23
19
|
component: string;
|
|
24
20
|
}[];
|
|
25
|
-
|
|
21
|
+
internals: BuildInternals | undefined;
|
|
22
|
+
options: StaticBuildOptions | undefined;
|
|
23
|
+
getName(): string;
|
|
24
|
+
getSettings(): import("../../types/astro.js").AstroSettings;
|
|
25
|
+
getOptions(): StaticBuildOptions;
|
|
26
|
+
getInternals(): BuildInternals;
|
|
26
27
|
private constructor();
|
|
27
28
|
getRoutes(): RouteData[];
|
|
28
|
-
static create({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* - dist/server/manifest.mjs
|
|
32
|
-
* - dist/renderers.mjs
|
|
33
|
-
*
|
|
34
|
-
* These two files, put together, will be used to generate the pages.
|
|
35
|
-
*
|
|
36
|
-
* ## Errors
|
|
37
|
-
*
|
|
38
|
-
* It will throw errors if the previous files can't be found in the file system.
|
|
39
|
-
*
|
|
40
|
-
* @param staticBuildOptions
|
|
41
|
-
*/
|
|
42
|
-
static retrieveManifest(settings: AstroSettings, internals: BuildInternals): Promise<SSRManifest>;
|
|
29
|
+
static create({ manifest }: Pick<BuildPipeline, 'manifest'>): BuildPipeline;
|
|
30
|
+
setInternals(internals: BuildInternals): void;
|
|
31
|
+
setOptions(options: StaticBuildOptions): void;
|
|
43
32
|
headElements(routeData: RouteData): Pick<SSRResult, 'scripts' | 'styles' | 'links'>;
|
|
44
33
|
componentMetadata(): void;
|
|
45
34
|
/**
|
|
46
35
|
* It collects the routes to generate during the build.
|
|
47
36
|
* It returns a map of page information and their relative entry point as a string.
|
|
48
37
|
*/
|
|
49
|
-
retrieveRoutesToGenerate():
|
|
38
|
+
retrieveRoutesToGenerate(): Set<RouteData>;
|
|
50
39
|
getComponentByRoute(routeData: RouteData): Promise<ComponentInstance>;
|
|
40
|
+
getModuleForRoute(route: RouteData): Promise<SinglePageBuiltModule>;
|
|
51
41
|
tryRewrite(payload: RewritePayload, request: Request): Promise<TryRewriteResult>;
|
|
52
|
-
retrieveSsrEntry(route: RouteData, filePath: string): Promise<SinglePageBuiltModule>;
|
|
53
42
|
}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VIRTUAL_PAGE_RESOLVED_MODULE_ID } from "../../vite-plugin-pages/const.js";
|
|
2
|
+
import { getVirtualModulePageName } from "../../vite-plugin-pages/util.js";
|
|
2
3
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from "../../vite-plugin-scripts/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { RedirectSinglePageBuiltModule } from "../redirects/
|
|
5
|
-
import { Pipeline } from "../
|
|
4
|
+
import { createConsoleLogger } from "../app/index.js";
|
|
5
|
+
import { RedirectSinglePageBuiltModule } from "../redirects/component.js";
|
|
6
|
+
import { Pipeline } from "../base-pipeline.js";
|
|
6
7
|
import { createAssetLink, createStylesheetElementSet } from "../render/ssr-element.js";
|
|
7
8
|
import { createDefaultRoutes } from "../routing/default.js";
|
|
9
|
+
import { getFallbackRoute, routeIsFallback, routeIsRedirect } from "../routing/helpers.js";
|
|
8
10
|
import { findRouteToRewrite } from "../routing/rewrite.js";
|
|
9
|
-
import {
|
|
10
|
-
import { cssOrder, getPageData, mergeInlineCss } from "./internal.js";
|
|
11
|
-
import { ASTRO_PAGE_MODULE_ID, ASTRO_PAGE_RESOLVED_MODULE_ID } from "./plugins/plugin-pages.js";
|
|
12
|
-
import { getPagesFromVirtualModulePageName, getVirtualModulePageName } from "./plugins/util.js";
|
|
13
|
-
import { i18nHasFallback } from "./util.js";
|
|
11
|
+
import { cssOrder, mergeInlineCss, getPageData } from "./runtime.js";
|
|
14
12
|
class BuildPipeline extends Pipeline {
|
|
15
|
-
constructor(
|
|
13
|
+
constructor(manifest, defaultRoutes = createDefaultRoutes(manifest)) {
|
|
16
14
|
const resolveCache = /* @__PURE__ */ new Map();
|
|
17
15
|
async function resolve(specifier) {
|
|
18
16
|
if (resolveCache.has(specifier)) {
|
|
@@ -30,91 +28,57 @@ class BuildPipeline extends Pipeline {
|
|
|
30
28
|
resolveCache.set(specifier, assetLink);
|
|
31
29
|
return assetLink;
|
|
32
30
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
super(
|
|
36
|
-
options.logger,
|
|
37
|
-
manifest,
|
|
38
|
-
options.runtimeMode,
|
|
39
|
-
manifest.renderers,
|
|
40
|
-
resolve,
|
|
41
|
-
serverLike,
|
|
42
|
-
streaming
|
|
43
|
-
);
|
|
44
|
-
this.internals = internals;
|
|
31
|
+
const logger = createConsoleLogger(manifest.logLevel);
|
|
32
|
+
super(logger, manifest, "production", manifest.renderers, resolve, manifest.serverLike);
|
|
45
33
|
this.manifest = manifest;
|
|
46
|
-
this.options = options;
|
|
47
|
-
this.config = config;
|
|
48
|
-
this.settings = settings;
|
|
49
34
|
this.defaultRoutes = defaultRoutes;
|
|
50
35
|
}
|
|
51
|
-
|
|
36
|
+
internals;
|
|
37
|
+
options;
|
|
38
|
+
getName() {
|
|
39
|
+
return "BuildPipeline";
|
|
40
|
+
}
|
|
52
41
|
/**
|
|
53
42
|
* This cache is needed to map a single `RouteData` to its file path.
|
|
54
43
|
* @private
|
|
55
44
|
*/
|
|
56
45
|
#routesByFilePath = /* @__PURE__ */ new WeakMap();
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
getSettings() {
|
|
47
|
+
if (!this.options) {
|
|
48
|
+
throw new Error("No options defined");
|
|
49
|
+
}
|
|
50
|
+
return this.options.settings;
|
|
51
|
+
}
|
|
52
|
+
getOptions() {
|
|
53
|
+
if (!this.options) {
|
|
54
|
+
throw new Error("No options defined");
|
|
55
|
+
}
|
|
56
|
+
return this.options;
|
|
57
|
+
}
|
|
58
|
+
getInternals() {
|
|
59
|
+
if (!this.internals) {
|
|
60
|
+
throw new Error("No internals defined");
|
|
61
|
+
}
|
|
62
|
+
return this.internals;
|
|
59
63
|
}
|
|
60
64
|
getRoutes() {
|
|
61
|
-
return this.
|
|
65
|
+
return this.getOptions().routesList.routes;
|
|
62
66
|
}
|
|
63
|
-
static create({
|
|
64
|
-
|
|
65
|
-
manifest,
|
|
66
|
-
options
|
|
67
|
-
}) {
|
|
68
|
-
return new BuildPipeline(internals, manifest, options);
|
|
67
|
+
static create({ manifest }) {
|
|
68
|
+
return new BuildPipeline(manifest);
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* These two files, put together, will be used to generate the pages.
|
|
76
|
-
*
|
|
77
|
-
* ## Errors
|
|
78
|
-
*
|
|
79
|
-
* It will throw errors if the previous files can't be found in the file system.
|
|
80
|
-
*
|
|
81
|
-
* @param staticBuildOptions
|
|
82
|
-
*/
|
|
83
|
-
static async retrieveManifest(settings, internals) {
|
|
84
|
-
const baseDirectory = getServerOutputDirectory(settings);
|
|
85
|
-
const manifestEntryUrl = new URL(
|
|
86
|
-
`${internals.manifestFileName}?time=${Date.now()}`,
|
|
87
|
-
baseDirectory
|
|
88
|
-
);
|
|
89
|
-
const { manifest } = await import(manifestEntryUrl.toString());
|
|
90
|
-
if (!manifest) {
|
|
91
|
-
throw new Error(
|
|
92
|
-
"Astro couldn't find the emitted manifest. This is an internal error, please file an issue."
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
const renderersEntryUrl = new URL(`renderers.mjs?time=${Date.now()}`, baseDirectory);
|
|
96
|
-
const renderers = await import(renderersEntryUrl.toString());
|
|
97
|
-
const middleware = internals.middlewareEntryPoint ? async function() {
|
|
98
|
-
const mod = await import(internals.middlewareEntryPoint.toString());
|
|
99
|
-
return { onRequest: mod.onRequest };
|
|
100
|
-
} : manifest.middleware;
|
|
101
|
-
if (!renderers) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
"Astro couldn't find the emitted renderers. This is an internal error, please file an issue."
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
...manifest,
|
|
108
|
-
renderers: renderers.renderers,
|
|
109
|
-
middleware
|
|
110
|
-
};
|
|
70
|
+
setInternals(internals) {
|
|
71
|
+
this.internals = internals;
|
|
72
|
+
}
|
|
73
|
+
setOptions(options) {
|
|
74
|
+
this.options = options;
|
|
111
75
|
}
|
|
112
76
|
headElements(routeData) {
|
|
113
77
|
const {
|
|
114
|
-
|
|
115
|
-
manifest: { assetsPrefix, base },
|
|
116
|
-
settings
|
|
78
|
+
manifest: { assetsPrefix, base }
|
|
117
79
|
} = this;
|
|
80
|
+
const settings = this.getSettings();
|
|
81
|
+
const internals = this.getInternals();
|
|
118
82
|
const links = /* @__PURE__ */ new Set();
|
|
119
83
|
const pageBuildData = getPageData(internals, routeData.route, routeData.component);
|
|
120
84
|
const scripts = /* @__PURE__ */ new Set();
|
|
@@ -148,116 +112,88 @@ class BuildPipeline extends Pipeline {
|
|
|
148
112
|
* It returns a map of page information and their relative entry point as a string.
|
|
149
113
|
*/
|
|
150
114
|
retrieveRoutesToGenerate() {
|
|
151
|
-
const pages = /* @__PURE__ */ new
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
this.internals,
|
|
158
|
-
ASTRO_PAGE_RESOLVED_MODULE_ID,
|
|
159
|
-
virtualModulePageName
|
|
160
|
-
)
|
|
161
|
-
);
|
|
162
|
-
for (const pageData of pageDatas) {
|
|
163
|
-
pages.set(pageData, filePath);
|
|
164
|
-
}
|
|
115
|
+
const pages = /* @__PURE__ */ new Set();
|
|
116
|
+
const defaultRouteComponents = new Set(this.defaultRoutes.map((route) => route.component));
|
|
117
|
+
for (const { routeData } of this.manifest.routes) {
|
|
118
|
+
if (routeIsRedirect(routeData)) {
|
|
119
|
+
pages.add(routeData);
|
|
120
|
+
continue;
|
|
165
121
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
122
|
+
if (routeIsFallback(routeData) && i18nHasFallback(this.manifest)) {
|
|
123
|
+
pages.add(routeData);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (defaultRouteComponents.has(routeData.component)) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
pages.add(routeData);
|
|
130
|
+
const moduleSpecifier = getVirtualModulePageName(
|
|
131
|
+
VIRTUAL_PAGE_RESOLVED_MODULE_ID,
|
|
132
|
+
routeData.component
|
|
133
|
+
);
|
|
134
|
+
const filePath = this.internals?.entrySpecifierToBundleMap.get(moduleSpecifier);
|
|
135
|
+
if (filePath) {
|
|
136
|
+
this.#routesByFilePath.set(routeData, filePath);
|
|
176
137
|
}
|
|
177
|
-
}
|
|
178
|
-
for (const [buildData, filePath] of pages.entries()) {
|
|
179
|
-
this.#routesByFilePath.set(buildData.route, filePath);
|
|
180
138
|
}
|
|
181
139
|
return pages;
|
|
182
140
|
}
|
|
183
141
|
async getComponentByRoute(routeData) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
142
|
+
const module = await this.getModuleForRoute(routeData);
|
|
143
|
+
return module.page();
|
|
144
|
+
}
|
|
145
|
+
async getModuleForRoute(route) {
|
|
146
|
+
for (const defaultRoute of this.defaultRoutes) {
|
|
147
|
+
if (route.component === defaultRoute.component) {
|
|
148
|
+
return {
|
|
149
|
+
page: () => Promise.resolve(defaultRoute.instance)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
187
152
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
153
|
+
let routeToProcess = route;
|
|
154
|
+
if (routeIsRedirect(route)) {
|
|
155
|
+
if (route.redirectRoute) {
|
|
156
|
+
routeToProcess = route.redirectRoute;
|
|
157
|
+
} else {
|
|
158
|
+
return RedirectSinglePageBuiltModule;
|
|
191
159
|
}
|
|
160
|
+
} else if (routeIsFallback(route)) {
|
|
161
|
+
routeToProcess = getFallbackRoute(route, this.manifest.routes);
|
|
192
162
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
163
|
+
if (this.manifest.pageMap) {
|
|
164
|
+
const importComponentInstance = this.manifest.pageMap.get(routeToProcess.component);
|
|
165
|
+
if (!importComponentInstance) {
|
|
166
|
+
throw new Error(
|
|
167
|
+
`Unexpectedly unable to find a component instance for route ${route.route}`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
return await importComponentInstance();
|
|
171
|
+
} else if (this.manifest.pageModule) {
|
|
172
|
+
return this.manifest.pageModule;
|
|
173
|
+
}
|
|
174
|
+
throw new Error(
|
|
175
|
+
"Astro couldn't find the correct page to render, probably because it wasn't correctly mapped for SSR usage. This is an internal error, please file an issue."
|
|
176
|
+
);
|
|
196
177
|
}
|
|
197
178
|
async tryRewrite(payload, request) {
|
|
198
179
|
const { routeData, pathname, newUrl } = findRouteToRewrite({
|
|
199
180
|
payload,
|
|
200
181
|
request,
|
|
201
|
-
routes: this.
|
|
202
|
-
trailingSlash: this.
|
|
203
|
-
buildFormat: this.
|
|
204
|
-
base: this.
|
|
205
|
-
outDir: this.serverLike ? this.manifest.buildClientDir : this.manifest.outDir
|
|
182
|
+
routes: this.manifest.routes.map((routeInfo) => routeInfo.routeData),
|
|
183
|
+
trailingSlash: this.manifest.trailingSlash,
|
|
184
|
+
buildFormat: this.manifest.buildFormat,
|
|
185
|
+
base: this.manifest.base,
|
|
186
|
+
outDir: this.manifest.serverLike ? this.manifest.buildClientDir : this.manifest.outDir
|
|
206
187
|
});
|
|
207
188
|
const componentInstance = await this.getComponentByRoute(routeData);
|
|
208
189
|
return { routeData, componentInstance, newUrl, pathname };
|
|
209
190
|
}
|
|
210
|
-
async retrieveSsrEntry(route, filePath) {
|
|
211
|
-
if (this.#componentsInterner.has(route)) {
|
|
212
|
-
return this.#componentsInterner.get(route);
|
|
213
|
-
}
|
|
214
|
-
let entry;
|
|
215
|
-
if (routeIsRedirect(route)) {
|
|
216
|
-
entry = await this.#getEntryForRedirectRoute(route, this.outFolder);
|
|
217
|
-
} else if (routeIsFallback(route)) {
|
|
218
|
-
entry = await this.#getEntryForFallbackRoute(route, this.outFolder);
|
|
219
|
-
} else {
|
|
220
|
-
const ssrEntryURLPage = createEntryURL(filePath, this.outFolder);
|
|
221
|
-
entry = await import(ssrEntryURLPage.toString());
|
|
222
|
-
}
|
|
223
|
-
this.#componentsInterner.set(route, entry);
|
|
224
|
-
return entry;
|
|
225
|
-
}
|
|
226
|
-
async #getEntryForFallbackRoute(route, outFolder) {
|
|
227
|
-
if (route.type !== "fallback") {
|
|
228
|
-
throw new Error(`Expected a redirect route.`);
|
|
229
|
-
}
|
|
230
|
-
if (route.redirectRoute) {
|
|
231
|
-
const filePath = getEntryFilePath(this.internals, route.redirectRoute);
|
|
232
|
-
if (filePath) {
|
|
233
|
-
const url = createEntryURL(filePath, outFolder);
|
|
234
|
-
const ssrEntryPage = await import(url.toString());
|
|
235
|
-
return ssrEntryPage;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return RedirectSinglePageBuiltModule;
|
|
239
|
-
}
|
|
240
|
-
async #getEntryForRedirectRoute(route, outFolder) {
|
|
241
|
-
if (route.type !== "redirect") {
|
|
242
|
-
throw new Error(`Expected a redirect route.`);
|
|
243
|
-
}
|
|
244
|
-
if (route.redirectRoute) {
|
|
245
|
-
const filePath = getEntryFilePath(this.internals, route.redirectRoute);
|
|
246
|
-
if (filePath) {
|
|
247
|
-
const url = createEntryURL(filePath, outFolder);
|
|
248
|
-
const ssrEntryPage = await import(url.toString());
|
|
249
|
-
return ssrEntryPage;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return RedirectSinglePageBuiltModule;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function createEntryURL(filePath, outFolder) {
|
|
256
|
-
return new URL("./" + filePath + `?time=${Date.now()}`, outFolder);
|
|
257
191
|
}
|
|
258
|
-
function
|
|
259
|
-
|
|
260
|
-
|
|
192
|
+
function i18nHasFallback(manifest) {
|
|
193
|
+
if (manifest.i18n && manifest.i18n.fallback) {
|
|
194
|
+
return Object.keys(manifest.i18n.fallback).length > 0;
|
|
195
|
+
}
|
|
196
|
+
return false;
|
|
261
197
|
}
|
|
262
198
|
export {
|
|
263
199
|
BuildPipeline
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
2
|
+
import type { BuildInternals } from '../internal.js';
|
|
3
|
+
import type { StaticBuildOptions } from '../types.js';
|
|
4
|
+
export declare function getAllBuildPlugins(internals: BuildInternals, options: StaticBuildOptions): Array<VitePlugin | VitePlugin[] | undefined>;
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { vitePluginActionsBuild } from "../../../actions/vite-plugin-actions.js";
|
|
2
2
|
import { astroHeadBuildPlugin } from "../../../vite-plugin-head/index.js";
|
|
3
|
-
import { pluginActions } from "./plugin-actions.js";
|
|
4
3
|
import { pluginAnalyzer } from "./plugin-analyzer.js";
|
|
5
|
-
import { pluginChunks } from "./plugin-chunks.js";
|
|
6
4
|
import { pluginComponentEntry } from "./plugin-component-entry.js";
|
|
7
5
|
import { pluginCSS } from "./plugin-css.js";
|
|
8
6
|
import { pluginInternals } from "./plugin-internals.js";
|
|
9
|
-
import { pluginManifest } from "./plugin-manifest.js";
|
|
10
7
|
import { pluginMiddleware } from "./plugin-middleware.js";
|
|
11
|
-
import { pluginPages } from "./plugin-pages.js";
|
|
12
8
|
import { pluginPrerender } from "./plugin-prerender.js";
|
|
13
|
-
import { pluginRenderers } from "./plugin-renderers.js";
|
|
14
9
|
import { pluginScripts } from "./plugin-scripts.js";
|
|
15
10
|
import { pluginSSR } from "./plugin-ssr.js";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
register(pluginChunks());
|
|
11
|
+
import { pluginNoop } from "./plugin-noop.js";
|
|
12
|
+
function getAllBuildPlugins(internals, options) {
|
|
13
|
+
return [
|
|
14
|
+
pluginComponentEntry(internals),
|
|
15
|
+
pluginAnalyzer(internals),
|
|
16
|
+
pluginInternals(options, internals),
|
|
17
|
+
pluginMiddleware(options, internals),
|
|
18
|
+
vitePluginActionsBuild(options, internals),
|
|
19
|
+
...pluginCSS(options, internals),
|
|
20
|
+
astroHeadBuildPlugin(internals),
|
|
21
|
+
pluginPrerender(options, internals),
|
|
22
|
+
pluginScripts(internals),
|
|
23
|
+
...pluginSSR(options, internals),
|
|
24
|
+
pluginNoop()
|
|
25
|
+
].filter(Boolean);
|
|
32
26
|
}
|
|
33
27
|
export {
|
|
34
|
-
|
|
28
|
+
getAllBuildPlugins
|
|
35
29
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
1
2
|
import type { BuildInternals } from '../internal.js';
|
|
2
|
-
|
|
3
|
-
export declare function pluginAnalyzer(internals: BuildInternals): AstroBuildPlugin;
|
|
3
|
+
export declare function pluginAnalyzer(internals: BuildInternals): VitePlugin;
|
|
@@ -4,9 +4,13 @@ import {
|
|
|
4
4
|
trackClientOnlyPageDatas,
|
|
5
5
|
trackScriptPageDatas
|
|
6
6
|
} from "../internal.js";
|
|
7
|
-
|
|
7
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
8
|
+
function pluginAnalyzer(internals) {
|
|
8
9
|
return {
|
|
9
10
|
name: "@astro/rollup-plugin-astro-analyzer",
|
|
11
|
+
applyToEnvironment(environment) {
|
|
12
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender;
|
|
13
|
+
},
|
|
10
14
|
async generateBundle() {
|
|
11
15
|
const ids = this.getModuleIds();
|
|
12
16
|
for (const id of ids) {
|
|
@@ -61,18 +65,6 @@ function vitePluginAnalyzer(internals) {
|
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
|
-
function pluginAnalyzer(internals) {
|
|
65
|
-
return {
|
|
66
|
-
targets: ["server"],
|
|
67
|
-
hooks: {
|
|
68
|
-
"build:before": () => {
|
|
69
|
-
return {
|
|
70
|
-
vitePlugin: vitePluginAnalyzer(internals)
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
68
|
export {
|
|
77
69
|
pluginAnalyzer
|
|
78
70
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
1
2
|
import type { BuildInternals } from '../internal.js';
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* When adding hydrated or client:only components as Rollup inputs, sometimes we're not using all
|
|
5
|
+
* of the export names, e.g. `import { Counter } from './ManyComponents.jsx'`. This plugin proxies
|
|
6
|
+
* entries to re-export only the names the user is using.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pluginComponentEntry(internals: BuildInternals): VitePlugin;
|
|
3
9
|
export declare function normalizeEntryId(id: string): string;
|
|
4
|
-
export declare function pluginComponentEntry(internals: BuildInternals): AstroBuildPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ASTRO_VITE_ENVIRONMENT_NAMES } from "../../constants.js";
|
|
1
2
|
const astroEntryPrefix = "\0astro-entry:";
|
|
2
|
-
function
|
|
3
|
+
function pluginComponentEntry(internals) {
|
|
3
4
|
const componentToExportNames = /* @__PURE__ */ new Map();
|
|
4
5
|
mergeComponentExportNames(internals.discoveredHydratedComponents);
|
|
5
6
|
mergeComponentExportNames(internals.discoveredClientOnlyComponents);
|
|
@@ -22,6 +23,9 @@ function vitePluginComponentEntry(internals) {
|
|
|
22
23
|
return {
|
|
23
24
|
name: "@astro/plugin-component-entry",
|
|
24
25
|
enforce: "pre",
|
|
26
|
+
applyToEnvironment(environment) {
|
|
27
|
+
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.client;
|
|
28
|
+
},
|
|
25
29
|
config(config) {
|
|
26
30
|
const rollupInput = config.build?.rollupOptions?.input;
|
|
27
31
|
if (Array.isArray(rollupInput)) {
|
|
@@ -55,18 +59,6 @@ function vitePluginComponentEntry(internals) {
|
|
|
55
59
|
function normalizeEntryId(id) {
|
|
56
60
|
return id.startsWith(astroEntryPrefix) ? id.slice(astroEntryPrefix.length) : id;
|
|
57
61
|
}
|
|
58
|
-
function pluginComponentEntry(internals) {
|
|
59
|
-
return {
|
|
60
|
-
targets: ["client"],
|
|
61
|
-
hooks: {
|
|
62
|
-
"build:before": () => {
|
|
63
|
-
return {
|
|
64
|
-
vitePlugin: vitePluginComponentEntry(internals)
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
62
|
export {
|
|
71
63
|
normalizeEntryId,
|
|
72
64
|
pluginComponentEntry
|
|
@@ -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
|
/***** ASTRO PLUGIN *****/
|
|
5
|
-
export declare function pluginCSS(options: StaticBuildOptions, internals: BuildInternals):
|
|
5
|
+
export declare function pluginCSS(options: StaticBuildOptions, internals: BuildInternals): VitePlugin[];
|