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
package/dist/cli/add/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { diffWords } from "diff";
|
|
|
6
6
|
import { builders, generateCode, loadFile } from "magicast";
|
|
7
7
|
import { getDefaultExportOptions } from "magicast/helpers";
|
|
8
8
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
9
|
-
import colors from "
|
|
9
|
+
import colors from "piccolore";
|
|
10
10
|
import prompts from "prompts";
|
|
11
11
|
import maxSatisfying from "semver/ranges/max-satisfying.js";
|
|
12
12
|
import yoctoSpinner from "yocto-spinner";
|
|
@@ -134,7 +134,7 @@ async function add(names, { flags }) {
|
|
|
134
134
|
const cwd = inlineConfig.root;
|
|
135
135
|
const logger = createLoggerFromFlags(flags);
|
|
136
136
|
const integrationNames = names.map((name) => ALIASES.has(name) ? ALIASES.get(name) : name);
|
|
137
|
-
const integrations = await validateIntegrations(integrationNames, flags);
|
|
137
|
+
const integrations = await validateIntegrations(integrationNames, flags, logger);
|
|
138
138
|
let installResult = await tryToInstallIntegrations({ integrations, cwd, flags, logger });
|
|
139
139
|
const rootPath = resolveRoot(cwd);
|
|
140
140
|
const root = pathToFileURL(rootPath);
|
|
@@ -182,7 +182,7 @@ async function add(names, { flags }) {
|
|
|
182
182
|
${magenta(`Astro will scaffold ${green("./wrangler.jsonc")}.`)}
|
|
183
183
|
`
|
|
184
184
|
);
|
|
185
|
-
if (await askToContinue({ flags })) {
|
|
185
|
+
if (await askToContinue({ flags, logger })) {
|
|
186
186
|
const data = await getPackageJson();
|
|
187
187
|
await fs.writeFile(
|
|
188
188
|
wranglerConfigURL,
|
|
@@ -202,7 +202,7 @@ async function add(names, { flags }) {
|
|
|
202
202
|
${magenta(`Astro will scaffold ${green("./public/.assetsignore")}.`)}
|
|
203
203
|
`
|
|
204
204
|
);
|
|
205
|
-
if (await askToContinue({ flags })) {
|
|
205
|
+
if (await askToContinue({ flags, logger })) {
|
|
206
206
|
if (!existsSync(dir)) {
|
|
207
207
|
await fs.mkdir(dir);
|
|
208
208
|
}
|
|
@@ -222,7 +222,7 @@ async function add(names, { flags }) {
|
|
|
222
222
|
${magenta(`Astro will scaffold ${green("./src/styles/global.css")}.`)}
|
|
223
223
|
`
|
|
224
224
|
);
|
|
225
|
-
if (await askToContinue({ flags })) {
|
|
225
|
+
if (await askToContinue({ flags, logger })) {
|
|
226
226
|
if (!existsSync(dir)) {
|
|
227
227
|
await fs.mkdir(dir);
|
|
228
228
|
}
|
|
@@ -261,7 +261,7 @@ async function add(names, { flags }) {
|
|
|
261
261
|
)}
|
|
262
262
|
`
|
|
263
263
|
);
|
|
264
|
-
if (await askToContinue({ flags })) {
|
|
264
|
+
if (await askToContinue({ flags, logger })) {
|
|
265
265
|
await fs.mkdir(new URL("./db", root));
|
|
266
266
|
await Promise.all([
|
|
267
267
|
fs.writeFile(new URL("./db/config.ts", root), STUBS.DB_CONFIG, { encoding: "utf-8" }),
|
|
@@ -558,7 +558,7 @@ ${message}`
|
|
|
558
558
|
)
|
|
559
559
|
);
|
|
560
560
|
}
|
|
561
|
-
if (await askToContinue({ flags })) {
|
|
561
|
+
if (await askToContinue({ flags, logger })) {
|
|
562
562
|
await fs.writeFile(fileURLToPath(configURL), output, { encoding: "utf-8" });
|
|
563
563
|
logger.debug("add", `Updated astro config`);
|
|
564
564
|
return 1 /* updated */;
|
|
@@ -637,7 +637,7 @@ ${boxen(coloredOutput, {
|
|
|
637
637
|
)}
|
|
638
638
|
${message}`
|
|
639
639
|
);
|
|
640
|
-
if (await askToContinue({ flags })) {
|
|
640
|
+
if (await askToContinue({ flags, logger })) {
|
|
641
641
|
const spinner = yoctoSpinner({ text: "Installing dependencies..." }).start();
|
|
642
642
|
try {
|
|
643
643
|
await exec(installCommand.command, [...installCommand.args, ...installSpecifiers], {
|
|
@@ -659,7 +659,7 @@ ${message}`
|
|
|
659
659
|
return 2 /* cancelled */;
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
async function validateIntegrations(integrations, flags) {
|
|
662
|
+
async function validateIntegrations(integrations, flags, logger) {
|
|
663
663
|
const spinner = yoctoSpinner({ text: "Resolving packages..." }).start();
|
|
664
664
|
try {
|
|
665
665
|
const integrationEntries = await Promise.all(
|
|
@@ -680,7 +680,7 @@ async function validateIntegrations(integrations, flags) {
|
|
|
680
680
|
spinner.warning(yellow(firstPartyPkgCheck.message));
|
|
681
681
|
}
|
|
682
682
|
spinner.warning(yellow(`${bold(integration)} is not an official Astro package.`));
|
|
683
|
-
if (!await askToContinue({ flags })) {
|
|
683
|
+
if (!await askToContinue({ flags, logger })) {
|
|
684
684
|
throw new Error(
|
|
685
685
|
`No problem! Find our official integrations at ${cyan(
|
|
686
686
|
"https://astro.build/integrations"
|
|
@@ -827,7 +827,7 @@ ${message}`
|
|
|
827
827
|
)
|
|
828
828
|
);
|
|
829
829
|
}
|
|
830
|
-
if (await askToContinue({ flags })) {
|
|
830
|
+
if (await askToContinue({ flags, logger })) {
|
|
831
831
|
await fs.writeFile(inputConfig.tsconfigFile, output, {
|
|
832
832
|
encoding: "utf-8"
|
|
833
833
|
});
|
|
@@ -852,8 +852,16 @@ function parseIntegrationName(spec) {
|
|
|
852
852
|
}
|
|
853
853
|
return { scope, name, tag };
|
|
854
854
|
}
|
|
855
|
-
|
|
855
|
+
let hasHintedAboutYesFlag = false;
|
|
856
|
+
async function askToContinue({
|
|
857
|
+
flags,
|
|
858
|
+
logger
|
|
859
|
+
}) {
|
|
856
860
|
if (flags.yes || flags.y) return true;
|
|
861
|
+
if (!hasHintedAboutYesFlag) {
|
|
862
|
+
hasHintedAboutYesFlag = true;
|
|
863
|
+
logger.info("SKIP_FORMAT", dim(" To run this command without prompts, pass the --yes flag\n"));
|
|
864
|
+
}
|
|
857
865
|
const response = await prompts({
|
|
858
866
|
type: "confirm",
|
|
859
867
|
name: "askToContinue",
|
|
@@ -901,7 +909,7 @@ async function setupIntegrationConfig(opts) {
|
|
|
901
909
|
${magenta(`Astro will generate a minimal ${bold(opts.defaultConfigFile)} file.`)}
|
|
902
910
|
`
|
|
903
911
|
);
|
|
904
|
-
if (await askToContinue({ flags: opts.flags })) {
|
|
912
|
+
if (await askToContinue({ flags: opts.flags, logger })) {
|
|
905
913
|
await fs.writeFile(
|
|
906
914
|
fileURLToPath(new URL(opts.defaultConfigFile, opts.root)),
|
|
907
915
|
opts.defaultConfigContent,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createKey, encodeKey } from "../../../core/encryption.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
};
|
|
2
|
+
class CryptoKeyGenerator {
|
|
3
|
+
async generate() {
|
|
4
|
+
const key = await createKey();
|
|
5
|
+
const encoded = await encodeKey(key);
|
|
6
|
+
return encoded;
|
|
7
|
+
}
|
|
10
8
|
}
|
|
11
9
|
export {
|
|
12
|
-
|
|
10
|
+
CryptoKeyGenerator
|
|
13
11
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StdioOptions } from 'node:child_process';
|
|
1
2
|
import type { AnyCommand } from './domain/command.js';
|
|
2
3
|
import type { HelpPayload } from './domain/help-payload.js';
|
|
3
4
|
export interface HelpDisplay {
|
|
@@ -13,8 +14,24 @@ export interface TextStyler {
|
|
|
13
14
|
bgGreen: (msg: string) => string;
|
|
14
15
|
}
|
|
15
16
|
export interface AstroVersionProvider {
|
|
16
|
-
|
|
17
|
+
readonly version: string;
|
|
17
18
|
}
|
|
18
19
|
export interface CommandRunner {
|
|
19
|
-
run: <T extends AnyCommand>(command: T, ...args: Parameters<T['run']>) => ReturnType<T['run']
|
|
20
|
+
run: <T extends AnyCommand>(command: T, ...args: Parameters<T['run']>) => ReturnType<T['run']> | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface CommandExecutorOptions {
|
|
23
|
+
cwd?: string;
|
|
24
|
+
env?: Record<string, string | undefined>;
|
|
25
|
+
shell?: boolean;
|
|
26
|
+
input?: string;
|
|
27
|
+
stdio?: StdioOptions;
|
|
28
|
+
}
|
|
29
|
+
export interface CommandExecutor {
|
|
30
|
+
execute: (command: string, args?: Array<string>, options?: CommandExecutorOptions) => Promise<{
|
|
31
|
+
stdout: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export interface OperatingSystemProvider {
|
|
35
|
+
readonly name: NodeJS.Platform;
|
|
36
|
+
readonly displayName: string;
|
|
20
37
|
}
|
package/dist/cli/dev/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Logger } from '../../../core/logger/core.js';
|
|
2
|
-
import type { CommandExecutor,
|
|
2
|
+
import type { CommandExecutor, OperatingSystemProvider } from '../../definitions.js';
|
|
3
|
+
import type { CloudIdeProvider } from '../definitions.js';
|
|
3
4
|
interface Options {
|
|
4
5
|
url: string;
|
|
5
|
-
|
|
6
|
+
operatingSystemProvider: OperatingSystemProvider;
|
|
6
7
|
logger: Logger;
|
|
7
8
|
commandExecutor: CommandExecutor;
|
|
9
|
+
cloudIdeProvider: CloudIdeProvider;
|
|
8
10
|
}
|
|
9
11
|
export declare const openDocsCommand: {
|
|
10
12
|
help: {
|
|
@@ -14,6 +16,6 @@ export declare const openDocsCommand: {
|
|
|
14
16
|
};
|
|
15
17
|
description: string;
|
|
16
18
|
};
|
|
17
|
-
run({ url,
|
|
19
|
+
run({ url, operatingSystemProvider, logger, commandExecutor, cloudIdeProvider }: Options): Promise<void>;
|
|
18
20
|
};
|
|
19
21
|
export {};
|
|
@@ -10,13 +10,6 @@ function getExecInputForPlatform(platform) {
|
|
|
10
10
|
return ["cmd", ["/c", "start"]];
|
|
11
11
|
case "gitpod":
|
|
12
12
|
return ["/ide/bin/remote-cli/gitpod-code", ["--openExternal"]];
|
|
13
|
-
case "aix":
|
|
14
|
-
case "freebsd":
|
|
15
|
-
case "haiku":
|
|
16
|
-
case "openbsd":
|
|
17
|
-
case "sunos":
|
|
18
|
-
case "cygwin":
|
|
19
|
-
case "netbsd":
|
|
20
13
|
default:
|
|
21
14
|
return null;
|
|
22
15
|
}
|
|
@@ -29,8 +22,8 @@ const openDocsCommand = defineCommand({
|
|
|
29
22
|
},
|
|
30
23
|
description: `Launches the Astro Docs website directly from the terminal.`
|
|
31
24
|
},
|
|
32
|
-
async run({ url,
|
|
33
|
-
const platform =
|
|
25
|
+
async run({ url, operatingSystemProvider, logger, commandExecutor, cloudIdeProvider }) {
|
|
26
|
+
const platform = cloudIdeProvider.name ?? operatingSystemProvider.name;
|
|
34
27
|
const input = getExecInputForPlatform(platform);
|
|
35
28
|
if (!input) {
|
|
36
29
|
logger.error(
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export interface CommandExecutor {
|
|
6
|
-
execute: (command: string, args?: Array<string>, options?: {
|
|
7
|
-
cwd?: string;
|
|
8
|
-
env: Record<string, string | undefined>;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
stdout: string;
|
|
11
|
-
}>;
|
|
1
|
+
import type { CloudIde } from './domain/cloud-ide.js';
|
|
2
|
+
export interface CloudIdeProvider {
|
|
3
|
+
readonly name: CloudIde | null;
|
|
12
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CloudIde = 'gitpod';
|
|
File without changes
|
package/dist/cli/flags.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Arguments } from 'yargs-parser';
|
|
|
2
2
|
import { Logger } from '../core/logger/core.js';
|
|
3
3
|
import type { AstroInlineConfig } from '../types/public/config.js';
|
|
4
4
|
export type Flags = Arguments;
|
|
5
|
+
/** @deprecated Use AstroConfigResolver instead */
|
|
5
6
|
export declare function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig;
|
|
6
7
|
/**
|
|
7
8
|
* The `logging` is usually created from an `AstroInlineConfig`, but some flows like `add`
|
package/dist/cli/index.js
CHANGED
|
@@ -28,27 +28,26 @@ function resolveCommand(flags) {
|
|
|
28
28
|
async function runCommand(cmd, flags) {
|
|
29
29
|
const [
|
|
30
30
|
{ createLoggerFromFlags },
|
|
31
|
-
{
|
|
32
|
-
{
|
|
33
|
-
{
|
|
34
|
-
{
|
|
31
|
+
{ piccoloreTextStyler: textStyler },
|
|
32
|
+
{ BuildTimeAstroVersionProvider },
|
|
33
|
+
{ LoggerHelpDisplay },
|
|
34
|
+
{ CliCommandRunner }
|
|
35
35
|
] = await Promise.all([
|
|
36
36
|
import("./flags.js"),
|
|
37
|
-
import("./infra/
|
|
37
|
+
import("./infra/piccolore-text-styler.js"),
|
|
38
38
|
import("./infra/build-time-astro-version-provider.js"),
|
|
39
39
|
import("./infra/logger-help-display.js"),
|
|
40
40
|
import("./infra/cli-command-runner.js")
|
|
41
41
|
]);
|
|
42
42
|
const logger = createLoggerFromFlags(flags);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const helpDisplay = createLoggerHelpDisplay({
|
|
43
|
+
const astroVersionProvider = new BuildTimeAstroVersionProvider();
|
|
44
|
+
const helpDisplay = new LoggerHelpDisplay({
|
|
46
45
|
logger,
|
|
47
46
|
flags,
|
|
48
47
|
textStyler,
|
|
49
48
|
astroVersionProvider
|
|
50
49
|
});
|
|
51
|
-
const runner =
|
|
50
|
+
const runner = new CliCommandRunner({ helpDisplay });
|
|
52
51
|
switch (cmd) {
|
|
53
52
|
/** Display --help flag */
|
|
54
53
|
case "help": {
|
|
@@ -66,35 +65,93 @@ async function runCommand(cmd, flags) {
|
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
67
|
case "info": {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const [
|
|
69
|
+
{ ProcessOperatingSystemProvider },
|
|
70
|
+
{ CliAstroConfigResolver },
|
|
71
|
+
{ ProcessPackageManagerUserAgentProvider },
|
|
72
|
+
{ ProcessNodeVersionProvider },
|
|
73
|
+
{ CliDebugInfoProvider },
|
|
74
|
+
{ TinyexecCommandExecutor },
|
|
75
|
+
{ getPackageManager },
|
|
76
|
+
{ StyledDebugInfoFormatter },
|
|
77
|
+
{ PromptsPrompt },
|
|
78
|
+
{ CliClipboard },
|
|
79
|
+
{ PassthroughTextStyler },
|
|
80
|
+
{ infoCommand }
|
|
81
|
+
] = await Promise.all([
|
|
82
|
+
import("./infra/process-operating-system-provider.js"),
|
|
83
|
+
import("./info/infra/cli-astro-config-resolver.js"),
|
|
84
|
+
import("./info/infra/process-package-manager-user-agent-provider.js"),
|
|
85
|
+
import("./info/infra/process-node-version-provider.js"),
|
|
86
|
+
import("./info/infra/cli-debug-info-provider.js"),
|
|
87
|
+
import("./infra/tinyexec-command-executor.js"),
|
|
88
|
+
import("./info/core/get-package-manager.js"),
|
|
89
|
+
import("./info/infra/styled-debug-info-formatter.js"),
|
|
90
|
+
import("./info/infra/prompts-prompt.js"),
|
|
91
|
+
import("./info/infra/cli-clipboard.js"),
|
|
92
|
+
import("./infra/passthrough-text-styler.js"),
|
|
93
|
+
import("./info/core/info.js")
|
|
94
|
+
]);
|
|
95
|
+
const operatingSystemProvider = new ProcessOperatingSystemProvider();
|
|
96
|
+
const astroConfigResolver = new CliAstroConfigResolver({ flags });
|
|
97
|
+
const commandExecutor = new TinyexecCommandExecutor();
|
|
98
|
+
const packageManagerUserAgentProvider = new ProcessPackageManagerUserAgentProvider();
|
|
99
|
+
const nodeVersionProvider = new ProcessNodeVersionProvider();
|
|
100
|
+
const debugInfoProvider = new CliDebugInfoProvider({
|
|
101
|
+
config: await astroConfigResolver.resolve(),
|
|
102
|
+
astroVersionProvider,
|
|
103
|
+
operatingSystemProvider,
|
|
104
|
+
packageManager: await getPackageManager({
|
|
105
|
+
packageManagerUserAgentProvider,
|
|
106
|
+
commandExecutor
|
|
107
|
+
}),
|
|
108
|
+
nodeVersionProvider
|
|
109
|
+
});
|
|
110
|
+
const prompt = new PromptsPrompt({ force: flags.copy });
|
|
111
|
+
const clipboard = new CliClipboard({
|
|
112
|
+
commandExecutor,
|
|
113
|
+
logger,
|
|
114
|
+
operatingSystemProvider,
|
|
115
|
+
prompt
|
|
116
|
+
});
|
|
117
|
+
return await runner.run(infoCommand, {
|
|
118
|
+
logger,
|
|
119
|
+
debugInfoProvider,
|
|
120
|
+
getDebugInfoFormatter: ({ pretty }) => new StyledDebugInfoFormatter({
|
|
121
|
+
textStyler: pretty ? textStyler : new PassthroughTextStyler()
|
|
122
|
+
}),
|
|
123
|
+
clipboard
|
|
124
|
+
});
|
|
72
125
|
}
|
|
73
126
|
case "create-key": {
|
|
74
|
-
const [{
|
|
127
|
+
const [{ CryptoKeyGenerator }, { createKeyCommand }] = await Promise.all([
|
|
75
128
|
import("./create-key/infra/crypto-key-generator.js"),
|
|
76
129
|
import("./create-key/core/create-key.js")
|
|
77
130
|
]);
|
|
78
|
-
const keyGenerator =
|
|
131
|
+
const keyGenerator = new CryptoKeyGenerator();
|
|
79
132
|
return await runner.run(createKeyCommand, { logger, keyGenerator });
|
|
80
133
|
}
|
|
81
134
|
case "docs": {
|
|
82
135
|
const [
|
|
83
|
-
{
|
|
84
|
-
{
|
|
136
|
+
{ TinyexecCommandExecutor },
|
|
137
|
+
{ ProcessOperatingSystemProvider },
|
|
138
|
+
{ ProcessCloudIdeProvider },
|
|
85
139
|
{ openDocsCommand }
|
|
86
140
|
] = await Promise.all([
|
|
87
|
-
import("./
|
|
88
|
-
import("./
|
|
141
|
+
import("./infra/tinyexec-command-executor.js"),
|
|
142
|
+
import("./infra/process-operating-system-provider.js"),
|
|
143
|
+
import("./docs/infra/process-cloud-ide-provider.js"),
|
|
89
144
|
import("./docs/core/open-docs.js")
|
|
90
145
|
]);
|
|
91
|
-
const commandExecutor =
|
|
92
|
-
const
|
|
146
|
+
const commandExecutor = new TinyexecCommandExecutor();
|
|
147
|
+
const operatingSystemProvider = new ProcessOperatingSystemProvider();
|
|
148
|
+
const cloudIdeProvider = new ProcessCloudIdeProvider();
|
|
93
149
|
return await runner.run(openDocsCommand, {
|
|
94
150
|
url: "https://docs.astro.build/",
|
|
95
151
|
logger,
|
|
96
152
|
commandExecutor,
|
|
97
|
-
|
|
153
|
+
operatingSystemProvider,
|
|
154
|
+
cloudIdeProvider
|
|
98
155
|
});
|
|
99
156
|
}
|
|
100
157
|
case "telemetry": {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandExecutor } from '../../definitions.js';
|
|
2
|
+
import type { PackageManager, PackageManagerUserAgentProvider } from '../definitions.js';
|
|
3
|
+
interface Options {
|
|
4
|
+
packageManagerUserAgentProvider: PackageManagerUserAgentProvider;
|
|
5
|
+
commandExecutor: CommandExecutor;
|
|
6
|
+
}
|
|
7
|
+
export declare function getPackageManager({ packageManagerUserAgentProvider, commandExecutor, }: Options): Promise<PackageManager>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
async function getPackageManager({
|
|
2
|
+
packageManagerUserAgentProvider,
|
|
3
|
+
commandExecutor
|
|
4
|
+
}) {
|
|
5
|
+
if (!packageManagerUserAgentProvider.userAgent) {
|
|
6
|
+
const { NoopPackageManager } = await import("../infra/noop-package-manager.js");
|
|
7
|
+
return new NoopPackageManager();
|
|
8
|
+
}
|
|
9
|
+
const specifier = packageManagerUserAgentProvider.userAgent.split(" ")[0];
|
|
10
|
+
const _name = specifier.substring(0, specifier.lastIndexOf("/"));
|
|
11
|
+
const name = _name === "npminstall" ? "cnpm" : _name;
|
|
12
|
+
switch (name) {
|
|
13
|
+
case "pnpm": {
|
|
14
|
+
const { PnpmPackageManager } = await import("../infra/pnpm-package-manager.js");
|
|
15
|
+
return new PnpmPackageManager({ commandExecutor });
|
|
16
|
+
}
|
|
17
|
+
case "npm": {
|
|
18
|
+
const { NpmPackageManager } = await import("../infra/npm-package-manager.js");
|
|
19
|
+
return new NpmPackageManager({ commandExecutor });
|
|
20
|
+
}
|
|
21
|
+
case "yarn": {
|
|
22
|
+
const { YarnPackageManager } = await import("../infra/yarn-package-manager.js");
|
|
23
|
+
return new YarnPackageManager({ commandExecutor });
|
|
24
|
+
}
|
|
25
|
+
case "bun": {
|
|
26
|
+
const { BunPackageManager } = await import("../infra/bun-package-manager.js");
|
|
27
|
+
return new BunPackageManager();
|
|
28
|
+
}
|
|
29
|
+
default: {
|
|
30
|
+
const { NoopPackageManager } = await import("../infra/noop-package-manager.js");
|
|
31
|
+
return new NoopPackageManager();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
getPackageManager
|
|
37
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Logger } from '../../../core/logger/core.js';
|
|
2
|
+
import type { Clipboard, DebugInfoFormatter, DebugInfoProvider } from '../definitions.js';
|
|
3
|
+
interface Options {
|
|
4
|
+
debugInfoProvider: DebugInfoProvider;
|
|
5
|
+
getDebugInfoFormatter: (options: {
|
|
6
|
+
pretty: boolean;
|
|
7
|
+
}) => DebugInfoFormatter;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
clipboard: Clipboard;
|
|
10
|
+
}
|
|
11
|
+
export declare const infoCommand: {
|
|
12
|
+
help: {
|
|
13
|
+
commandName: string;
|
|
14
|
+
tables: {
|
|
15
|
+
Flags: [string, string][];
|
|
16
|
+
};
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
run({ debugInfoProvider, getDebugInfoFormatter, logger, clipboard }: Options): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineCommand } from "../../domain/command.js";
|
|
2
|
+
const infoCommand = defineCommand({
|
|
3
|
+
help: {
|
|
4
|
+
commandName: "astro info",
|
|
5
|
+
tables: {
|
|
6
|
+
Flags: [
|
|
7
|
+
["--help (-h)", "See all available flags."],
|
|
8
|
+
["--copy", "Force copy of the output."]
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
description: "Reports useful information about your current Astro environment. Useful for providing information when opening an issue."
|
|
12
|
+
},
|
|
13
|
+
async run({ debugInfoProvider, getDebugInfoFormatter, logger, clipboard }) {
|
|
14
|
+
const debugInfo = await debugInfoProvider.get();
|
|
15
|
+
logger.info("SKIP_FORMAT", getDebugInfoFormatter({ pretty: true }).format(debugInfo));
|
|
16
|
+
await clipboard.copy(getDebugInfoFormatter({ pretty: false }).format(debugInfo));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
infoCommand
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AstroConfig } from '../../types/public/index.js';
|
|
2
|
+
import type { DebugInfo } from './domain/debug-info.js';
|
|
3
|
+
export interface DebugInfoProvider {
|
|
4
|
+
get: () => Promise<DebugInfo>;
|
|
5
|
+
}
|
|
6
|
+
export interface DebugInfoFormatter {
|
|
7
|
+
format: (info: DebugInfo) => string;
|
|
8
|
+
}
|
|
9
|
+
export interface Clipboard {
|
|
10
|
+
copy: (text: string) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface PackageManager {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
getPackageVersion: (name: string) => Promise<string | undefined>;
|
|
15
|
+
}
|
|
16
|
+
export interface AstroConfigResolver {
|
|
17
|
+
resolve: () => Promise<AstroConfig>;
|
|
18
|
+
}
|
|
19
|
+
export interface Prompt {
|
|
20
|
+
confirm: (input: {
|
|
21
|
+
message: string;
|
|
22
|
+
defaultValue?: boolean;
|
|
23
|
+
}) => Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
export interface PackageManagerUserAgentProvider {
|
|
26
|
+
readonly userAgent: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface NodeVersionProvider {
|
|
29
|
+
readonly version: string;
|
|
30
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DebugInfo = Array<[string, string | Array<string>]>;
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AstroConfig } from '../../../types/public/index.js';
|
|
2
|
+
import type { Flags } from '../../flags.js';
|
|
3
|
+
import type { AstroConfigResolver } from '../definitions.js';
|
|
4
|
+
export declare class CliAstroConfigResolver implements AstroConfigResolver {
|
|
5
|
+
#private;
|
|
6
|
+
constructor({ flags }: {
|
|
7
|
+
flags: Flags;
|
|
8
|
+
});
|
|
9
|
+
resolve(): Promise<AstroConfig>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { resolveConfig } from "../../../core/config/config.js";
|
|
2
|
+
class CliAstroConfigResolver {
|
|
3
|
+
// TODO: find something better
|
|
4
|
+
#flags;
|
|
5
|
+
constructor({ flags }) {
|
|
6
|
+
this.#flags = flags;
|
|
7
|
+
}
|
|
8
|
+
async resolve() {
|
|
9
|
+
const { astroConfig } = await resolveConfig(
|
|
10
|
+
// TODO: consider testing flags => astro inline config
|
|
11
|
+
{
|
|
12
|
+
// Inline-only configs
|
|
13
|
+
configFile: typeof this.#flags.config === "string" ? this.#flags.config : void 0,
|
|
14
|
+
mode: typeof this.#flags.mode === "string" ? this.#flags.mode : void 0,
|
|
15
|
+
logLevel: this.#flags.verbose ? "debug" : this.#flags.silent ? "silent" : void 0,
|
|
16
|
+
force: this.#flags.force ? true : void 0,
|
|
17
|
+
// Astro user configs
|
|
18
|
+
root: typeof this.#flags.root === "string" ? this.#flags.root : void 0,
|
|
19
|
+
site: typeof this.#flags.site === "string" ? this.#flags.site : void 0,
|
|
20
|
+
base: typeof this.#flags.base === "string" ? this.#flags.base : void 0,
|
|
21
|
+
outDir: typeof this.#flags.outDir === "string" ? this.#flags.outDir : void 0,
|
|
22
|
+
server: {
|
|
23
|
+
port: typeof this.#flags.port === "number" ? this.#flags.port : void 0,
|
|
24
|
+
host: typeof this.#flags.host === "string" || typeof this.#flags.host === "boolean" ? this.#flags.host : void 0,
|
|
25
|
+
open: typeof this.#flags.open === "string" || typeof this.#flags.open === "boolean" ? this.#flags.open : void 0,
|
|
26
|
+
allowedHosts: typeof this.#flags.allowedHosts === "string" ? this.#flags.allowedHosts.split(",") : typeof this.#flags.allowedHosts === "boolean" && this.#flags.allowedHosts === true ? this.#flags.allowedHosts : []
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"info"
|
|
30
|
+
);
|
|
31
|
+
return astroConfig;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
CliAstroConfigResolver
|
|
36
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Logger } from '../../../core/logger/core.js';
|
|
2
|
+
import type { CommandExecutor, OperatingSystemProvider } from '../../definitions.js';
|
|
3
|
+
import type { Clipboard, Prompt } from '../definitions.js';
|
|
4
|
+
export declare class CliClipboard implements Clipboard {
|
|
5
|
+
#private;
|
|
6
|
+
constructor({ operatingSystemProvider, commandExecutor, logger, prompt, }: {
|
|
7
|
+
operatingSystemProvider: OperatingSystemProvider;
|
|
8
|
+
commandExecutor: CommandExecutor;
|
|
9
|
+
logger: Logger;
|
|
10
|
+
prompt: Prompt;
|
|
11
|
+
});
|
|
12
|
+
copy(text: string): Promise<void>;
|
|
13
|
+
}
|