aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Darius <19603573+itsMapleLeaf@users.noreply.github.com> 2024-08-08 05:12:50 -0500
committerGravatar GitHub <noreply@github.com> 2024-08-08 12:12:50 +0200
commit72c7ae9901de927ae8d9d5be63cbaef4f976422c (patch)
tree6e41a6b07ad8830375ba7b0e4d924fd9449dc7ef
parent85de47cd982fd13c6286bcc0be384a220996ccbd (diff)
downloadastro-72c7ae9901de927ae8d9d5be63cbaef4f976422c.tar.gz
astro-72c7ae9901de927ae8d9d5be63cbaef4f976422c.tar.zst
astro-72c7ae9901de927ae8d9d5be63cbaef4f976422c.zip
update formatter config (#11640)
* update formatter config * format --------- Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
-rw-r--r--biome.json2
-rw-r--r--examples/blog/src/pages/blog/index.astro2
-rw-r--r--examples/portfolio/src/pages/work.astro2
-rw-r--r--packages/astro-prism/README.md2
-rw-r--r--packages/astro-prism/src/plugin.ts8
-rw-r--r--packages/astro-rss/src/index.ts18
-rw-r--r--packages/astro-rss/src/util.ts2
-rw-r--r--packages/astro-rss/test/pagesGlobToRssItems.test.js14
-rw-r--r--packages/astro-rss/test/rss.test.js4
-rw-r--r--packages/astro/CHANGELOG.md12
-rwxr-xr-xpackages/astro/astro.js2
-rw-r--r--packages/astro/client.d.ts2
-rw-r--r--packages/astro/components/Picture.astro4
-rw-r--r--packages/astro/components/ViewTransitions.astro2
-rw-r--r--packages/astro/config.d.ts2
-rw-r--r--packages/astro/e2e/astro-component.test.js22
-rw-r--r--packages/astro/e2e/astro-envs.test.js2
-rw-r--r--packages/astro/e2e/content-collections.test.js2
-rw-r--r--packages/astro/e2e/css.test.js2
-rw-r--r--packages/astro/e2e/custom-client-directives.test.js2
-rw-r--r--packages/astro/e2e/dev-toolbar-audits.test.js10
-rw-r--r--packages/astro/e2e/dev-toolbar.test.js16
-rw-r--r--packages/astro/e2e/errors.test.js4
-rw-r--r--packages/astro/e2e/hmr.test.js4
-rw-r--r--packages/astro/e2e/lit-component.test.js10
-rw-r--r--packages/astro/e2e/multiple-frameworks.test.js12
-rw-r--r--packages/astro/e2e/nested-styles.test.js2
-rw-r--r--packages/astro/e2e/prefetch.test.js8
-rw-r--r--packages/astro/e2e/shared-component-tests.js10
-rw-r--r--packages/astro/e2e/solid-component.test.js2
-rw-r--r--packages/astro/e2e/tailwindcss.test.js10
-rw-r--r--packages/astro/e2e/test-utils.js2
-rw-r--r--packages/astro/e2e/view-transitions.test.js50
-rw-r--r--packages/astro/e2e/vue-component.test.js2
-rw-r--r--packages/astro/performance/content-benchmark.mjs8
-rw-r--r--packages/astro/performance/scripts/generate-posts.mjs4
-rw-r--r--packages/astro/src/@types/astro.ts30
-rw-r--r--packages/astro/src/actions/index.ts6
-rw-r--r--packages/astro/src/actions/runtime/middleware.ts2
-rw-r--r--packages/astro/src/actions/runtime/virtual/client.ts2
-rw-r--r--packages/astro/src/actions/runtime/virtual/get-action.ts2
-rw-r--r--packages/astro/src/actions/runtime/virtual/server.ts14
-rw-r--r--packages/astro/src/actions/runtime/virtual/shared.ts8
-rw-r--r--packages/astro/src/assets/build/generate.ts24
-rw-r--r--packages/astro/src/assets/build/remote.ts2
-rw-r--r--packages/astro/src/assets/endpoint/generic.ts2
-rw-r--r--packages/astro/src/assets/endpoint/node.ts4
-rw-r--r--packages/astro/src/assets/internal.ts8
-rw-r--r--packages/astro/src/assets/services/service.ts18
-rw-r--r--packages/astro/src/assets/services/squoosh.ts2
-rw-r--r--packages/astro/src/assets/utils/metadata.ts2
-rw-r--r--packages/astro/src/assets/utils/node/emitAsset.ts2
-rw-r--r--packages/astro/src/assets/utils/queryParams.ts2
-rw-r--r--packages/astro/src/assets/utils/remotePattern.ts2
-rw-r--r--packages/astro/src/assets/utils/transformToPath.ts4
-rw-r--r--packages/astro/src/assets/vite-plugin-assets.ts16
-rw-r--r--packages/astro/src/cli/add/imports.ts2
-rw-r--r--packages/astro/src/cli/add/index.ts102
-rw-r--r--packages/astro/src/cli/check/index.ts4
-rw-r--r--packages/astro/src/cli/db/index.ts2
-rw-r--r--packages/astro/src/cli/dev/index.ts2
-rw-r--r--packages/astro/src/cli/docs/open.ts2
-rw-r--r--packages/astro/src/cli/info/index.ts2
-rw-r--r--packages/astro/src/cli/install-package.ts14
-rw-r--r--packages/astro/src/cli/preferences/index.ts42
-rw-r--r--packages/astro/src/cli/preview/index.ts2
-rw-r--r--packages/astro/src/config/index.ts4
-rw-r--r--packages/astro/src/container/index.ts18
-rw-r--r--packages/astro/src/container/pipeline.ts4
-rw-r--r--packages/astro/src/content/runtime-assets.ts4
-rw-r--r--packages/astro/src/content/runtime.ts20
-rw-r--r--packages/astro/src/content/server-listeners.ts20
-rw-r--r--packages/astro/src/content/types-generator.ts26
-rw-r--r--packages/astro/src/content/utils.ts18
-rw-r--r--packages/astro/src/content/vite-plugin-content-assets.ts12
-rw-r--r--packages/astro/src/content/vite-plugin-content-imports.ts12
-rw-r--r--packages/astro/src/content/vite-plugin-content-virtual-mod.ts16
-rw-r--r--packages/astro/src/core/app/createOutgoingHttpHeaders.ts2
-rw-r--r--packages/astro/src/core/app/index.ts22
-rw-r--r--packages/astro/src/core/app/node.ts4
-rw-r--r--packages/astro/src/core/app/pipeline.ts10
-rw-r--r--packages/astro/src/core/base-pipeline.ts6
-rw-r--r--packages/astro/src/core/build/add-rollup-input.ts2
-rw-r--r--packages/astro/src/core/build/common.ts4
-rw-r--r--packages/astro/src/core/build/css-asset-name.ts4
-rw-r--r--packages/astro/src/core/build/generate.ts30
-rw-r--r--packages/astro/src/core/build/graph.ts6
-rw-r--r--packages/astro/src/core/build/index.ts16
-rw-r--r--packages/astro/src/core/build/internal.ts18
-rw-r--r--packages/astro/src/core/build/page-data.ts2
-rw-r--r--packages/astro/src/core/build/pipeline.ts28
-rw-r--r--packages/astro/src/core/build/plugins/README.md2
-rw-r--r--packages/astro/src/core/build/plugins/plugin-analyzer.ts8
-rw-r--r--packages/astro/src/core/build/plugins/plugin-content.ts20
-rw-r--r--packages/astro/src/core/build/plugins/plugin-css.ts10
-rw-r--r--packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts4
-rw-r--r--packages/astro/src/core/build/plugins/plugin-internals.ts2
-rw-r--r--packages/astro/src/core/build/plugins/plugin-manifest.ts10
-rw-r--r--packages/astro/src/core/build/plugins/plugin-middleware.ts2
-rw-r--r--packages/astro/src/core/build/plugins/plugin-pages.ts2
-rw-r--r--packages/astro/src/core/build/plugins/plugin-prerender.ts4
-rw-r--r--packages/astro/src/core/build/plugins/plugin-ssr.ts12
-rw-r--r--packages/astro/src/core/build/plugins/util.ts6
-rw-r--r--packages/astro/src/core/build/static-build.ts28
-rw-r--r--packages/astro/src/core/build/util.ts4
-rw-r--r--packages/astro/src/core/config/config.ts6
-rw-r--r--packages/astro/src/core/config/merge.ts4
-rw-r--r--packages/astro/src/core/config/schema.ts32
-rw-r--r--packages/astro/src/core/config/settings.ts12
-rw-r--r--packages/astro/src/core/config/tsconfig.ts8
-rw-r--r--packages/astro/src/core/config/validate.ts2
-rw-r--r--packages/astro/src/core/cookies/cookies.ts6
-rw-r--r--packages/astro/src/core/create-vite.ts4
-rw-r--r--packages/astro/src/core/dev/container.ts2
-rw-r--r--packages/astro/src/core/dev/dev.ts4
-rw-r--r--packages/astro/src/core/dev/restart.ts8
-rw-r--r--packages/astro/src/core/dev/update-check.ts2
-rw-r--r--packages/astro/src/core/errors/dev/vite.ts4
-rw-r--r--packages/astro/src/core/errors/errors-data.ts8
-rw-r--r--packages/astro/src/core/errors/overlay.ts2
-rw-r--r--packages/astro/src/core/errors/utils.ts2
-rw-r--r--packages/astro/src/core/errors/zod-error-map.ts12
-rw-r--r--packages/astro/src/core/logger/core.ts2
-rw-r--r--packages/astro/src/core/logger/node.ts2
-rw-r--r--packages/astro/src/core/logger/vite.ts2
-rw-r--r--packages/astro/src/core/messages.ts14
-rw-r--r--packages/astro/src/core/middleware/callMiddleware.ts4
-rw-r--r--packages/astro/src/core/middleware/sequence.ts2
-rw-r--r--packages/astro/src/core/middleware/vite-plugin.ts6
-rw-r--r--packages/astro/src/core/preview/index.ts6
-rw-r--r--packages/astro/src/core/preview/static-preview-server.ts4
-rw-r--r--packages/astro/src/core/render-context.ts24
-rw-r--r--packages/astro/src/core/render/paginate.ts8
-rw-r--r--packages/astro/src/core/render/params-and-props.ts2
-rw-r--r--packages/astro/src/core/render/renderer.ts2
-rw-r--r--packages/astro/src/core/render/route-cache.ts2
-rw-r--r--packages/astro/src/core/render/slots.ts4
-rw-r--r--packages/astro/src/core/render/ssr-element.ts12
-rw-r--r--packages/astro/src/core/request.ts4
-rw-r--r--packages/astro/src/core/routing/astro-designed-error-pages.ts2
-rw-r--r--packages/astro/src/core/routing/manifest/create.ts24
-rw-r--r--packages/astro/src/core/routing/manifest/generator.ts6
-rw-r--r--packages/astro/src/core/routing/manifest/pattern.ts2
-rw-r--r--packages/astro/src/core/routing/manifest/serialization.ts2
-rw-r--r--packages/astro/src/core/routing/validation.ts12
-rw-r--r--packages/astro/src/core/sync/index.ts12
-rw-r--r--packages/astro/src/core/sync/setup-env-ts.ts6
-rw-r--r--packages/astro/src/core/util.ts2
-rw-r--r--packages/astro/src/core/viteUtils.ts2
-rw-r--r--packages/astro/src/env/runtime.ts4
-rw-r--r--packages/astro/src/env/schema.ts2
-rw-r--r--packages/astro/src/env/validators.ts2
-rw-r--r--packages/astro/src/env/vite-plugin-env.ts4
-rw-r--r--packages/astro/src/events/error.ts2
-rw-r--r--packages/astro/src/events/session.ts16
-rw-r--r--packages/astro/src/i18n/index.ts2
-rw-r--r--packages/astro/src/i18n/middleware.ts2
-rw-r--r--packages/astro/src/i18n/utils.ts2
-rw-r--r--packages/astro/src/integrations/features-validation.ts26
-rw-r--r--packages/astro/src/integrations/hooks.ts22
-rw-r--r--packages/astro/src/jsx/babel.ts34
-rw-r--r--packages/astro/src/jsx/rehype.ts14
-rw-r--r--packages/astro/src/jsx/server.ts4
-rw-r--r--packages/astro/src/preferences/index.ts8
-rw-r--r--packages/astro/src/preferences/store.ts2
-rw-r--r--packages/astro/src/prefetch/index.ts6
-rw-r--r--packages/astro/src/prefetch/vite-plugin-prefetch.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/astro.ts8
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/index.ts6
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts18
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/index.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/perf.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.ts10
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.ts6
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/utils/window.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/apps/xray.ts10
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts8
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/helpers.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/settings.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/toolbar.ts14
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts4
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts6
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/card.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts2
-rw-r--r--packages/astro/src/runtime/client/dev-toolbar/ui-library/window.ts2
-rw-r--r--packages/astro/src/runtime/server/astro-component.ts4
-rw-r--r--packages/astro/src/runtime/server/astro-island.ts8
-rw-r--r--packages/astro/src/runtime/server/endpoint.ts10
-rw-r--r--packages/astro/src/runtime/server/escape.ts2
-rw-r--r--packages/astro/src/runtime/server/hydration.ts8
-rw-r--r--packages/astro/src/runtime/server/index.ts2
-rw-r--r--packages/astro/src/runtime/server/jsx.ts14
-rw-r--r--packages/astro/src/runtime/server/render/astro/factory.ts2
-rw-r--r--packages/astro/src/runtime/server/render/astro/instance.ts6
-rw-r--r--packages/astro/src/runtime/server/render/astro/render.ts16
-rw-r--r--packages/astro/src/runtime/server/render/common.ts4
-rw-r--r--packages/astro/src/runtime/server/render/component.ts60
-rw-r--r--packages/astro/src/runtime/server/render/dom.ts4
-rw-r--r--packages/astro/src/runtime/server/render/head.ts2
-rw-r--r--packages/astro/src/runtime/server/render/instruction.ts6
-rw-r--r--packages/astro/src/runtime/server/render/page.ts6
-rw-r--r--packages/astro/src/runtime/server/render/server-islands.ts2
-rw-r--r--packages/astro/src/runtime/server/render/slot.ts12
-rw-r--r--packages/astro/src/runtime/server/render/util.ts6
-rw-r--r--packages/astro/src/runtime/server/serialize.ts8
-rw-r--r--packages/astro/src/runtime/server/transition.ts14
-rw-r--r--packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts14
-rw-r--r--packages/astro/src/transitions/events.ts14
-rw-r--r--packages/astro/src/transitions/router.ts38
-rw-r--r--packages/astro/src/transitions/swap-functions.ts4
-rw-r--r--packages/astro/src/virtual-modules/container.ts2
-rw-r--r--packages/astro/src/virtual-modules/i18n.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-postprocess/index.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/base.ts8
-rw-r--r--packages/astro/src/vite-plugin-astro-server/css.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/error.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/metadata.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/pipeline.ts6
-rw-r--r--packages/astro/src/vite-plugin-astro-server/plugin.ts4
-rw-r--r--packages/astro/src/vite-plugin-astro-server/response.ts10
-rw-r--r--packages/astro/src/vite-plugin-astro-server/route.ts8
-rw-r--r--packages/astro/src/vite-plugin-astro-server/scripts.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro-server/vite.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro/compile.ts6
-rw-r--r--packages/astro/src/vite-plugin-astro/hmr.ts2
-rw-r--r--packages/astro/src/vite-plugin-astro/index.ts6
-rw-r--r--packages/astro/src/vite-plugin-config-alias/index.ts4
-rw-r--r--packages/astro/src/vite-plugin-env/index.ts12
-rw-r--r--packages/astro/src/vite-plugin-head/index.ts2
-rw-r--r--packages/astro/src/vite-plugin-html/transform/escape.ts2
-rw-r--r--packages/astro/src/vite-plugin-html/transform/slots.ts2
-rw-r--r--packages/astro/src/vite-plugin-integrations-container/index.ts4
-rw-r--r--packages/astro/src/vite-plugin-markdown/images.ts2
-rw-r--r--packages/astro/src/vite-plugin-markdown/index.ts10
-rw-r--r--packages/astro/src/vite-plugin-mdx/index.ts2
-rw-r--r--packages/astro/src/vite-plugin-mdx/tag.ts12
-rw-r--r--packages/astro/src/vite-plugin-mdx/transform-jsx.ts2
-rw-r--r--packages/astro/src/vite-plugin-scanner/index.ts4
-rw-r--r--packages/astro/src/vite-plugin-scanner/scan.ts4
-rw-r--r--packages/astro/src/vite-plugin-utils/index.ts2
-rw-r--r--packages/astro/templates/content/types.d.ts20
-rw-r--r--packages/astro/test/0-css.test.js16
-rw-r--r--packages/astro/test/astro-assets-dir.test.js4
-rw-r--r--packages/astro/test/astro-attrs.test.js4
-rw-r--r--packages/astro/test/astro-basic.test.js2
-rw-r--r--packages/astro/test/astro-children.test.js4
-rw-r--r--packages/astro/test/astro-class-list.test.js6
-rw-r--r--packages/astro/test/astro-client-only.test.js4
-rw-r--r--packages/astro/test/astro-component-bundling.test.js2
-rw-r--r--packages/astro/test/astro-component-code.test.js12
-rw-r--r--packages/astro/test/astro-directives.test.js2
-rw-r--r--packages/astro/test/astro-doctype.test.js2
-rw-r--r--packages/astro/test/astro-envs.test.js4
-rw-r--r--packages/astro/test/astro-expr.test.js2
-rw-r--r--packages/astro/test/astro-get-static-paths.test.js2
-rw-r--r--packages/astro/test/astro-global.test.js2
-rw-r--r--packages/astro/test/astro-markdown-frontmatter-injection.test.js2
-rw-r--r--packages/astro/test/astro-markdown-shiki.test.js6
-rw-r--r--packages/astro/test/astro-markdown.test.js8
-rw-r--r--packages/astro/test/astro-not-response.test.js2
-rw-r--r--packages/astro/test/astro-pages.test.js2
-rw-r--r--packages/astro/test/astro-pagination-root-spread.test.js2
-rw-r--r--packages/astro/test/astro-pagination.test.js2
-rw-r--r--packages/astro/test/astro-scripts.test.js2
-rw-r--r--packages/astro/test/astro-sync.test.js16
-rw-r--r--packages/astro/test/cli.test.js18
-rw-r--r--packages/astro/test/client-address.test.js2
-rw-r--r--packages/astro/test/component-library.test.js12
-rw-r--r--packages/astro/test/container.test.js30
-rw-r--r--packages/astro/test/content-collection-references.test.js4
-rw-r--r--packages/astro/test/content-collections-render.test.js12
-rw-r--r--packages/astro/test/content-collections.test.js12
-rw-r--r--packages/astro/test/core-image-infersize.test.js6
-rw-r--r--packages/astro/test/core-image-unconventional-settings.test.js2
-rw-r--r--packages/astro/test/core-image.test.js48
-rw-r--r--packages/astro/test/css-dangling-references.test.js2
-rw-r--r--packages/astro/test/css-inline-stylesheets.test.js2
-rw-r--r--packages/astro/test/css-order-import.test.js4
-rw-r--r--packages/astro/test/css-order.test.js8
-rw-r--r--packages/astro/test/custom-404-implicit-rerouting.test.js2
-rw-r--r--packages/astro/test/custom-500.test.js4
-rw-r--r--packages/astro/test/data-collections-schema.test.js4
-rw-r--r--packages/astro/test/error-map.test.js18
-rw-r--r--packages/astro/test/events.test.js10
-rw-r--r--packages/astro/test/experimental-content-collection-references.test.js4
-rw-r--r--packages/astro/test/experimental-content-collections-cache-invalidation.test.js6
-rw-r--r--packages/astro/test/experimental-content-collections-css-inline-stylesheets.test.js6
-rw-r--r--packages/astro/test/experimental-content-collections-render.test.js10
-rw-r--r--packages/astro/test/experimental-content-collections.test.js12
-rw-r--r--packages/astro/test/featuresSupport.test.js4
-rw-r--r--packages/astro/test/lit-element.test.js18
-rw-r--r--packages/astro/test/middleware.test.js2
-rw-r--r--packages/astro/test/non-html-pages.test.js2
-rw-r--r--packages/astro/test/parallel.test.js6
-rw-r--r--packages/astro/test/postcss.test.js2
-rw-r--r--packages/astro/test/react-jsx-export.test.js2
-rw-r--r--packages/astro/test/redirects.test.js4
-rw-r--r--packages/astro/test/solid-component.test.js4
-rw-r--r--packages/astro/test/ssr-adapter-build-config.test.js2
-rw-r--r--packages/astro/test/ssr-api-route.test.js6
-rw-r--r--packages/astro/test/ssr-dynamic.test.js2
-rw-r--r--packages/astro/test/ssr-hoisted-script.test.js4
-rw-r--r--packages/astro/test/ssr-prerender-get-static-paths.test.js4
-rw-r--r--packages/astro/test/ssr-split-manifest.test.js4
-rw-r--r--packages/astro/test/static-build-dir.test.js2
-rw-r--r--packages/astro/test/static-build-vite-plugins.test.js6
-rw-r--r--packages/astro/test/test-utils.js4
-rw-r--r--packages/astro/test/units/assets/remote-pattern.test.js8
-rw-r--r--packages/astro/test/units/config/config-resolve.test.js2
-rw-r--r--packages/astro/test/units/config/config-server.test.js2
-rw-r--r--packages/astro/test/units/config/config-validate.test.js76
-rw-r--r--packages/astro/test/units/config/format.test.js4
-rw-r--r--packages/astro/test/units/content-collections/frontmatter.test.js4
-rw-r--r--packages/astro/test/units/dev/base.test.js16
-rw-r--r--packages/astro/test/units/dev/collections-mixed-content-errors.test.js8
-rw-r--r--packages/astro/test/units/dev/collections-renderentry.test.js16
-rw-r--r--packages/astro/test/units/dev/dev.test.js18
-rw-r--r--packages/astro/test/units/dev/head-injection.test.js10
-rw-r--r--packages/astro/test/units/dev/hydration.test.js8
-rw-r--r--packages/astro/test/units/dev/restart.test.js14
-rw-r--r--packages/astro/test/units/env/env-validators.test.js28
-rw-r--r--packages/astro/test/units/i18n/astro_i18n.test.js190
-rw-r--r--packages/astro/test/units/integrations/api.test.js24
-rw-r--r--packages/astro/test/units/render/chunk.test.js4
-rw-r--r--packages/astro/test/units/render/components.test.js8
-rw-r--r--packages/astro/test/units/render/head.test.js20
-rw-r--r--packages/astro/test/units/render/jsx.test.js4
-rw-r--r--packages/astro/test/units/routing/manifest.test.js24
-rw-r--r--packages/astro/test/units/routing/route-matching.test.js2
-rw-r--r--packages/astro/test/units/runtime/astro-global.test.js4
-rw-r--r--packages/astro/test/units/test-utils.js2
-rw-r--r--packages/astro/test/units/vite-plugin-astro-server/request.test.js4
-rw-r--r--packages/astro/test/units/vite-plugin-astro/compile.test.js4
-rw-r--r--packages/astro/test/units/vite-plugin-scanner/scan.test.js26
-rw-r--r--packages/astro/test/view-transitions.test.js2
-rw-r--r--packages/astro/types/content.d.ts2
-rw-r--r--packages/create-astro/src/actions/context.ts2
-rw-r--r--packages/create-astro/src/actions/dependencies.ts8
-rw-r--r--packages/create-astro/src/actions/git.ts6
-rw-r--r--packages/create-astro/src/actions/intro.ts6
-rw-r--r--packages/create-astro/src/actions/next-steps.ts2
-rw-r--r--packages/create-astro/src/actions/project-name.ts2
-rw-r--r--packages/create-astro/src/actions/template.ts6
-rw-r--r--packages/create-astro/src/actions/typescript.ts14
-rw-r--r--packages/create-astro/src/actions/verify.ts4
-rw-r--r--packages/create-astro/src/messages.ts12
-rw-r--r--packages/create-astro/src/shell.ts2
-rw-r--r--packages/create-astro/test/typescript.test.js6
-rw-r--r--packages/create-astro/test/utils.js4
-rw-r--r--packages/db/src/core/cli/commands/link/index.ts18
-rw-r--r--packages/db/src/core/cli/commands/push/index.ts2
-rw-r--r--packages/db/src/core/cli/commands/shell/index.ts2
-rw-r--r--packages/db/src/core/cli/migration-queries.ts28
-rw-r--r--packages/db/src/core/cli/print-help.ts4
-rw-r--r--packages/db/src/core/consts.ts2
-rw-r--r--packages/db/src/core/errors.ts6
-rw-r--r--packages/db/src/core/integration/error-map.ts12
-rw-r--r--packages/db/src/core/integration/index.ts6
-rw-r--r--packages/db/src/core/integration/vite-plugin-db.ts4
-rw-r--r--packages/db/src/core/integration/vite-plugin-inject-env-ts.ts6
-rw-r--r--packages/db/src/core/load-file.ts2
-rw-r--r--packages/db/src/core/queries.ts10
-rw-r--r--packages/db/src/core/schemas.ts10
-rw-r--r--packages/db/src/core/utils.ts4
-rw-r--r--packages/db/src/runtime/db-client.ts8
-rw-r--r--packages/db/src/runtime/errors.ts8
-rw-r--r--packages/db/src/runtime/utils.ts2
-rw-r--r--packages/db/test/test-utils.js6
-rw-r--r--packages/db/test/unit/column-queries.test.js2
-rw-r--r--packages/db/test/unit/reference-queries.test.js6
-rw-r--r--packages/db/test/unit/reset-queries.test.js2
-rw-r--r--packages/integrations/alpinejs/src/index.ts4
-rw-r--r--packages/integrations/alpinejs/test/test-utils.js2
-rw-r--r--packages/integrations/lit/client-shim.js2
-rw-r--r--packages/integrations/lit/client-shim.min.js2
-rw-r--r--packages/integrations/lit/src/client.ts2
-rw-r--r--packages/integrations/lit/src/index.ts2
-rw-r--r--packages/integrations/lit/test/server.test.js10
-rw-r--r--packages/integrations/markdoc/components/TreeNode.ts8
-rw-r--r--packages/integrations/markdoc/src/content-entry-type.ts16
-rw-r--r--packages/integrations/markdoc/src/extensions/prism.ts2
-rw-r--r--packages/integrations/markdoc/src/heading-ids.ts2
-rw-r--r--packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts2
-rw-r--r--packages/integrations/markdoc/src/html/transform/html-token-transform.ts2
-rw-r--r--packages/integrations/markdoc/src/index.ts2
-rw-r--r--packages/integrations/markdoc/src/load-config.ts2
-rw-r--r--packages/integrations/markdoc/src/runtime.ts16
-rw-r--r--packages/integrations/markdoc/test/content-collections.test.js4
-rw-r--r--packages/integrations/markdoc/test/image-assets.test.js4
-rw-r--r--packages/integrations/markdoc/test/render-html.test.js2
-rw-r--r--packages/integrations/markdoc/test/syntax-highlighting.test.js4
-rw-r--r--packages/integrations/mdx/src/index.ts6
-rw-r--r--packages/integrations/mdx/src/plugins.ts2
-rw-r--r--packages/integrations/mdx/src/rehype-apply-frontmatter-export.ts6
-rw-r--r--packages/integrations/mdx/src/rehype-collect-headings.ts2
-rw-r--r--packages/integrations/mdx/src/rehype-images-to-component.ts2
-rw-r--r--packages/integrations/mdx/src/rehype-optimize-static.ts4
-rw-r--r--packages/integrations/mdx/src/utils.ts6
-rw-r--r--packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts8
-rw-r--r--packages/integrations/mdx/src/vite-plugin-mdx.ts4
-rw-r--r--packages/integrations/mdx/test/invalid-mdx-component.test.js2
-rw-r--r--packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js6
-rw-r--r--packages/integrations/mdx/test/mdx-frontmatter-injection.test.js6
-rw-r--r--packages/integrations/mdx/test/mdx-frontmatter.test.js4
-rw-r--r--packages/integrations/mdx/test/mdx-get-headings.test.js10
-rw-r--r--packages/integrations/mdx/test/mdx-get-static-paths.test.js2
-rw-r--r--packages/integrations/mdx/test/mdx-math.test.js4
-rw-r--r--packages/integrations/mdx/test/mdx-optimize.test.js4
-rw-r--r--packages/integrations/mdx/test/mdx-plugins.test.js8
-rw-r--r--packages/integrations/mdx/test/mdx-script-style-raw.test.js8
-rw-r--r--packages/integrations/mdx/test/mdx-vite-env-vars.test.js6
-rw-r--r--packages/integrations/mdx/test/units/rehype-optimize-static.test.js8
-rw-r--r--packages/integrations/node/CHANGELOG.md2
-rw-r--r--packages/integrations/node/src/index.ts2
-rw-r--r--packages/integrations/node/src/log-listening-on.ts12
-rw-r--r--packages/integrations/node/src/preview.ts6
-rw-r--r--packages/integrations/node/src/serve-app.ts2
-rw-r--r--packages/integrations/node/src/standalone.ts2
-rw-r--r--packages/integrations/node/test/bad-urls.test.js2
-rw-r--r--packages/integrations/node/test/errors.test.js4
-rw-r--r--packages/integrations/node/test/image.test.js2
-rw-r--r--packages/integrations/partytown/src/index.ts2
-rw-r--r--packages/integrations/preact/src/client.ts4
-rw-r--r--packages/integrations/preact/src/index.ts2
-rw-r--r--packages/integrations/preact/src/server.ts6
-rw-r--r--packages/integrations/preact/src/signals.ts2
-rw-r--r--packages/integrations/react/CHANGELOG.md2
-rw-r--r--packages/integrations/react/client-v17.js2
-rw-r--r--packages/integrations/react/client.js4
-rw-r--r--packages/integrations/react/server.js2
-rw-r--r--packages/integrations/react/src/actions.ts4
-rw-r--r--packages/integrations/react/src/index.ts4
-rw-r--r--packages/integrations/react/test/react-component.test.js6
-rw-r--r--packages/integrations/sitemap/src/generate-sitemap.ts2
-rw-r--r--packages/integrations/sitemap/src/index.ts6
-rw-r--r--packages/integrations/sitemap/src/schema.ts2
-rw-r--r--packages/integrations/sitemap/src/utils/parse-i18n-url.ts2
-rw-r--r--packages/integrations/sitemap/src/write-sitemap.ts2
-rw-r--r--packages/integrations/sitemap/test/base-path.test.js4
-rw-r--r--packages/integrations/sitemap/test/units/generate-sitemap.test.js8
-rw-r--r--packages/integrations/solid/src/client.ts2
-rw-r--r--packages/integrations/solid/src/index.ts6
-rw-r--r--packages/integrations/solid/src/server.ts4
-rw-r--r--packages/integrations/svelte/client.js4
-rw-r--r--packages/integrations/svelte/src/editor.cts2
-rw-r--r--packages/integrations/tailwind/src/index.ts6
-rw-r--r--packages/integrations/tailwind/test/basic.test.js2
-rw-r--r--packages/integrations/vercel/CHANGELOG.md2
-rw-r--r--packages/integrations/vercel/src/image/shared.ts4
-rw-r--r--packages/integrations/vercel/src/lib/nft.ts8
-rw-r--r--packages/integrations/vercel/src/serverless/adapter.ts38
-rw-r--r--packages/integrations/vercel/src/serverless/entrypoint.ts2
-rw-r--r--packages/integrations/vercel/src/serverless/middleware.ts10
-rw-r--r--packages/integrations/vercel/src/static/adapter.ts4
-rw-r--r--packages/integrations/vercel/test/edge-middleware.test.js10
-rw-r--r--packages/integrations/vercel/test/hosted/hosted.test.js2
-rw-r--r--packages/integrations/vercel/test/isr.test.js2
-rw-r--r--packages/integrations/vercel/test/max-duration.test.js2
-rw-r--r--packages/integrations/vercel/test/redirects.test.js2
-rw-r--r--packages/integrations/vercel/test/serverless-prerender.test.js6
-rw-r--r--packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js4
-rw-r--r--packages/integrations/vercel/test/split.test.js2
-rw-r--r--packages/integrations/vercel/test/streaming.test.js2
-rw-r--r--packages/integrations/vue/src/index.ts6
-rw-r--r--packages/integrations/vue/test/toTsx.test.js4
-rw-r--r--packages/integrations/web-vitals/src/index.ts4
-rw-r--r--packages/integrations/web-vitals/src/middleware.ts2
-rw-r--r--packages/integrations/web-vitals/test/basics.test.js2
-rw-r--r--packages/internal-helpers/src/fs.ts2
-rw-r--r--packages/markdown/remark/src/index.ts2
-rw-r--r--packages/markdown/remark/src/load-plugins.ts7
-rw-r--r--packages/markdown/remark/src/rehype-collect-headings.ts2
-rw-r--r--packages/markdown/remark/src/rehype-prism.ts2
-rw-r--r--packages/markdown/remark/src/shiki.ts6
-rw-r--r--packages/markdown/remark/src/types.ts2
-rw-r--r--packages/markdown/remark/test/autolinking.test.js6
-rw-r--r--packages/markdown/remark/test/remark-collect-images.test.js4
-rw-r--r--packages/markdown/remark/test/shiki.test.js2
-rw-r--r--packages/studio/src/core/tokens.ts12
-rw-r--r--packages/underscore-redirects/src/print.ts2
-rw-r--r--packages/underscore-redirects/test/astro.test.js2
-rw-r--r--packages/upgrade/src/actions/context.ts2
-rw-r--r--packages/upgrade/src/actions/install.ts18
-rw-r--r--packages/upgrade/src/actions/verify.ts10
-rw-r--r--packages/upgrade/src/messages.ts6
-rw-r--r--packages/upgrade/src/shell.ts2
-rw-r--r--packages/upgrade/test/utils.js2
-rw-r--r--prettier.config.js2
492 files changed, 1863 insertions, 1848 deletions
diff --git a/biome.json b/biome.json
index 9da3b4db0..8effd9cfc 100644
--- a/biome.json
+++ b/biome.json
@@ -29,7 +29,7 @@
"linter": { "enabled": false },
"javascript": {
"formatter": {
- "trailingCommas": "es5",
+ "trailingCommas": "all",
"quoteStyle": "single",
"semicolons": "always"
}
diff --git a/examples/blog/src/pages/blog/index.astro b/examples/blog/src/pages/blog/index.astro
index 5dfb9c9c6..a1019da5b 100644
--- a/examples/blog/src/pages/blog/index.astro
+++ b/examples/blog/src/pages/blog/index.astro
@@ -7,7 +7,7 @@ import { getCollection } from 'astro:content';
import FormattedDate from '../../components/FormattedDate.astro';
const posts = (await getCollection('blog')).sort(
- (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
+ (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---
diff --git a/examples/portfolio/src/pages/work.astro b/examples/portfolio/src/pages/work.astro
index 14fe4945a..233c760bf 100644
--- a/examples/portfolio/src/pages/work.astro
+++ b/examples/portfolio/src/pages/work.astro
@@ -9,7 +9,7 @@ import Hero from '../components/Hero.astro';
import Grid from '../components/Grid.astro';
const projects = (await getCollection('work')).sort(
- (a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf()
+ (a, b) => b.data.publishDate.valueOf() - a.data.publishDate.valueOf(),
);
---
diff --git a/packages/astro-prism/README.md b/packages/astro-prism/README.md
index f5627d062..b2dff218c 100644
--- a/packages/astro-prism/README.md
+++ b/packages/astro-prism/README.md
@@ -29,6 +29,6 @@ runHighlighterWithAstro(
<div>{helloAstro}</div>
`,
- 'astro'
+ 'astro',
);
```
diff --git a/packages/astro-prism/src/plugin.ts b/packages/astro-prism/src/plugin.ts
index a50b9d7ef..057433f40 100644
--- a/packages/astro-prism/src/plugin.ts
+++ b/packages/astro-prism/src/plugin.ts
@@ -10,7 +10,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
scriptLang = 'javascript';
// eslint-disable-next-line no-console
console.warn(
- 'Prism TypeScript language not loaded, Astro scripts will be treated as JavaScript.'
+ 'Prism TypeScript language not loaded, Astro scripts will be treated as JavaScript.',
);
}
@@ -41,7 +41,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
(Prism.languages.astro as any).tag.pattern = re(
/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/
- .source
+ .source,
);
(Prism.languages.astro as any).tag.inside['tag'].pattern = /^<\/?[^\s>/]*/;
@@ -60,7 +60,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
inside: Prism.languages.astro,
},
},
- (Prism.languages.astro as any).tag
+ (Prism.languages.astro as any).tag,
);
Prism.languages.insertBefore(
@@ -80,7 +80,7 @@ export function addAstro(Prism: typeof import('prismjs')) {
alias: `language-${scriptLang}`,
},
},
- (Prism.languages.astro as any).tag
+ (Prism.languages.astro as any).tag,
);
// The following will handle plain text inside tags
diff --git a/packages/astro-rss/src/index.ts b/packages/astro-rss/src/index.ts
index 84cdad0d9..b84e81e73 100644
--- a/packages/astro-rss/src/index.ts
+++ b/packages/astro-rss/src/index.ts
@@ -73,8 +73,8 @@ const rssOptionsValidator = z.object({
// eslint-disable-next-line
console.warn(
yellow(
- '[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/'
- )
+ '[RSS] Passing a glob result directly has been deprecated. Please migrate to the `pagesGlobToRssItems()` helper: https://docs.astro.build/en/guides/rss/',
+ ),
);
return pagesGlobToRssItems(items);
}
@@ -123,7 +123,7 @@ async function validateRssOptions(rssOptions: RSSOptions) {
return message;
}),
- ].join('\n')
+ ].join('\n'),
);
throw formattedError;
}
@@ -134,7 +134,7 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
const { url, frontmatter } = await getInfo();
if (url === undefined || url === null) {
throw new Error(
- `[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`
+ `[RSS] You can only glob entries within 'src/pages/' when passing import.meta.glob() directly. Consider mapping the result to an array of RSSFeedItems. See the RSS docs for usage examples: https://docs.astro.build/en/guides/rss/#2-list-of-rss-feed-objects`,
);
}
const parsedResult = rssSchema
@@ -151,11 +151,11 @@ export function pagesGlobToRssItems(items: GlobResult): Promise<ValidatedRSSFeed
[
`[RSS] ${filePath} has invalid or missing frontmatter.\nFix the following properties:`,
...parsedResult.error.errors.map((zodError) => zodError.message),
- ].join('\n')
+ ].join('\n'),
);
(formattedError as any).file = filePath;
throw formattedError;
- })
+ }),
);
}
@@ -207,7 +207,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
if (typeof rssOptions.customData === 'string')
Object.assign(
root.rss.channel,
- parser.parse(`<channel>${rssOptions.customData}</channel>`).channel
+ parser.parse(`<channel>${rssOptions.customData}</channel>`).channel,
);
// items
root.rss.channel.item = items.map((result) => {
@@ -250,7 +250,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
}
if (result.source) {
item.source = parser.parse(
- `<source url="${result.source.url}">${result.source.title}</source>`
+ `<source url="${result.source.url}">${result.source.title}</source>`,
).source;
}
if (result.enclosure) {
@@ -258,7 +258,7 @@ async function generateRSS(rssOptions: ValidatedRSSOptions): Promise<string> {
? result.enclosure.url
: createCanonicalURL(result.enclosure.url, rssOptions.trailingSlash, site);
item.enclosure = parser.parse(
- `<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`
+ `<enclosure url="${enclosureURL}" length="${result.enclosure.length}" type="${result.enclosure.type}"/>`,
).enclosure;
}
return item;
diff --git a/packages/astro-rss/src/util.ts b/packages/astro-rss/src/util.ts
index a709d942d..43de370dd 100644
--- a/packages/astro-rss/src/util.ts
+++ b/packages/astro-rss/src/util.ts
@@ -5,7 +5,7 @@ import type { RSSOptions } from './index.js';
export function createCanonicalURL(
url: string,
trailingSlash?: RSSOptions['trailingSlash'],
- base?: string
+ base?: string,
): string {
let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical
if (!getUrlExtension(url)) {
diff --git a/packages/astro-rss/test/pagesGlobToRssItems.test.js b/packages/astro-rss/test/pagesGlobToRssItems.test.js
index 560ede268..36613c96c 100644
--- a/packages/astro-rss/test/pagesGlobToRssItems.test.js
+++ b/packages/astro-rss/test/pagesGlobToRssItems.test.js
@@ -16,7 +16,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
- })
+ }),
),
'./posts/nested/web1.md': () =>
new Promise((resolve) =>
@@ -27,7 +27,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: web1FeedItem.pubDate,
description: web1FeedItem.description,
},
- })
+ }),
),
};
@@ -49,7 +49,7 @@ describe('pagesGlobToRssItems', () => {
assert.deepEqual(
items.sort((a, b) => a.pubDate - b.pubDate),
- expected
+ expected,
);
});
@@ -63,7 +63,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
- })
+ }),
),
};
return assert.rejects(pagesGlobToRssItems(globResult));
@@ -80,7 +80,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: undefined,
},
- })
+ }),
),
};
return assert.rejects(pagesGlobToRssItems(globResult));
@@ -97,7 +97,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
- })
+ }),
),
};
return assert.doesNotReject(pagesGlobToRssItems(globResult));
@@ -114,7 +114,7 @@ describe('pagesGlobToRssItems', () => {
pubDate: phpFeedItem.pubDate,
description: undefined,
},
- })
+ }),
),
};
return assert.doesNotReject(pagesGlobToRssItems(globResult));
diff --git a/packages/astro-rss/test/rss.test.js b/packages/astro-rss/test/rss.test.js
index 547b75b4e..5a0fd1fd0 100644
--- a/packages/astro-rss/test/rss.test.js
+++ b/packages/astro-rss/test/rss.test.js
@@ -191,7 +191,7 @@ describe('getRssString', () => {
pubDate: phpFeedItem.pubDate,
description: phpFeedItem.description,
},
- })
+ }),
),
'./posts/nested/web1.md': () =>
new Promise((resolve) =>
@@ -202,7 +202,7 @@ describe('getRssString', () => {
pubDate: web1FeedItem.pubDate,
description: web1FeedItem.description,
},
- })
+ }),
),
};
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md
index 9e354d9ca..8149b867a 100644
--- a/packages/astro/CHANGELOG.md
+++ b/packages/astro/CHANGELOG.md
@@ -1127,7 +1127,7 @@
export function Like({ postId }: { postId: string }) {
const [state, action, pending] = useActionState(
experimental_withState(actions.like),
- 0 // initial likes
+ 0, // initial likes
);
return (
@@ -1341,7 +1341,7 @@
{
site: 'https://example.com',
trailingSlash: 'never',
- }
+ },
);
```
@@ -1714,7 +1714,7 @@
middleware({
redirectToDefaultLocale: false,
prefixDefaultLocale: true,
- })
+ }),
);
```
@@ -1985,7 +1985,7 @@
detail: {
level: 'warning',
},
- })
+ }),
);
```
@@ -6675,7 +6675,7 @@
const hydrate = await load();
await hydrate();
},
- { once: true }
+ { once: true },
);
};
@@ -8970,7 +8970,7 @@
{ darkMode: true },
{
expires: '1 month',
- }
+ },
);
const prefs = Astro.cookies.get<Prefs>('prefs').json();
diff --git a/packages/astro/astro.js b/packages/astro/astro.js
index 38bb099ed..2000ca566 100755
--- a/packages/astro/astro.js
+++ b/packages/astro/astro.js
@@ -66,7 +66,7 @@ Please upgrade Node.js to a supported version: "${engines}"\n`);
}
}
console.log(
- `${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`
+ `${ci.name} CI Environment Detected!\nAdditional steps may be needed to set your Node.js version:`,
);
console.log(`Documentation: https://docs.astro.build/en/guides/deploy/`);
if (CI_INSTRUCTIONS[platform]) {
diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts
index 149af6f64..ed5c1b894 100644
--- a/packages/astro/client.d.ts
+++ b/packages/astro/client.d.ts
@@ -50,7 +50,7 @@ declare module 'astro:assets' {
* This is functionally equivalent to using the `<Image />` component, as the component calls this function internally.
*/
getImage: (
- options: import('./dist/assets/types.js').UnresolvedImageTransform
+ options: import('./dist/assets/types.js').UnresolvedImageTransform,
) => Promise<import('./dist/assets/types.js').GetImageResult>;
imageConfig: import('./dist/@types/astro.js').AstroConfig['image'];
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
diff --git a/packages/astro/components/Picture.astro b/packages/astro/components/Picture.astro
index 593dd8097..c85548404 100644
--- a/packages/astro/components/Picture.astro
+++ b/packages/astro/components/Picture.astro
@@ -53,8 +53,8 @@ const optimizedImages: GetImageResult[] = await Promise.all(
format: format,
widths: props.widths,
densities: props.densities,
- })
- )
+ }),
+ ),
);
let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat;
diff --git a/packages/astro/components/ViewTransitions.astro b/packages/astro/components/ViewTransitions.astro
index 84a68d61e..8bda7b780 100644
--- a/packages/astro/components/ViewTransitions.astro
+++ b/packages/astro/components/ViewTransitions.astro
@@ -53,7 +53,7 @@ const { fallback = 'animate' } = Astro.props;
if (supportsViewTransitions || getFallback() !== 'none') {
if (import.meta.env.DEV && window.matchMedia('(prefers-reduced-motion)').matches) {
console.warn(
- `[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`
+ `[transitions]: all view transition animations, including fallback animation, are disabled as this device has the prefer-reduced-motion setting enabled.`,
);
}
document.addEventListener('click', (ev) => {
diff --git a/packages/astro/config.d.ts b/packages/astro/config.d.ts
index a7d827a1f..9f4c6bfd1 100644
--- a/packages/astro/config.d.ts
+++ b/packages/astro/config.d.ts
@@ -17,7 +17,7 @@ export function defineConfig(config: AstroUserConfig): AstroUserConfig;
*/
export function getViteConfig(
config: ViteUserConfig,
- inlineAstroConfig?: AstroInlineConfig
+ inlineAstroConfig?: AstroInlineConfig,
): ViteUserConfigFn;
/**
diff --git a/packages/astro/e2e/astro-component.test.js b/packages/astro/e2e/astro-component.test.js
index c96e9b1c4..0e9c1eaed 100644
--- a/packages/astro/e2e/astro-component.test.js
+++ b/packages/astro/e2e/astro-component.test.js
@@ -20,25 +20,25 @@ test.describe('Astro component HMR', () => {
const hero = page.locator('section');
await expect(hero, 'hero has background: white').toHaveCSS(
'background-color',
- 'rgb(255, 255, 255)'
+ 'rgb(255, 255, 255)',
);
await expect(hero, 'hero has color: black').toHaveCSS('color', 'rgb(0, 0, 0)');
// Edit the Hero component with a new background color
await astro.editFile('./src/components/Hero.astro', (content) =>
- content.replace('background: white', 'background: rgb(230, 230, 230)')
+ content.replace('background: white', 'background: rgb(230, 230, 230)'),
);
await expect(hero, 'background color updated').toHaveCSS(
'background-color',
- 'rgb(230, 230, 230)'
+ 'rgb(230, 230, 230)',
);
});
test('hoisted scripts', async ({ page, astro }) => {
const initialLog = page.waitForEvent(
'console',
- (message) => message.text() === 'Hello, Astro!'
+ (message) => message.text() === 'Hello, Astro!',
);
await page.goto(astro.resolveUrl('/'));
@@ -49,12 +49,12 @@ test.describe('Astro component HMR', () => {
const updatedLog = page.waitForEvent(
'console',
- (message) => message.text() === 'Hello, updated Astro!'
+ (message) => message.text() === 'Hello, updated Astro!',
);
// Edit the hoisted script on the page
await astro.editFile('./src/pages/index.astro', (content) =>
- content.replace('Hello, Astro!', 'Hello, updated Astro!')
+ content.replace('Hello, Astro!', 'Hello, updated Astro!'),
);
await updatedLog;
@@ -63,7 +63,7 @@ test.describe('Astro component HMR', () => {
test('inline scripts', async ({ page, astro }) => {
const initialLog = page.waitForEvent(
'console',
- (message) => message.text() === 'Hello, inline Astro!'
+ (message) => message.text() === 'Hello, inline Astro!',
);
await page.goto(astro.resolveUrl('/'));
@@ -71,12 +71,12 @@ test.describe('Astro component HMR', () => {
const updatedLog = page.waitForEvent(
'console',
- (message) => message.text() === 'Hello, updated inline Astro!'
+ (message) => message.text() === 'Hello, updated inline Astro!',
);
// Edit the inline script on the page
await astro.editFile('./src/pages/index.astro', (content) =>
- content.replace('Hello, inline Astro!', 'Hello, updated inline Astro!')
+ content.replace('Hello, inline Astro!', 'Hello, updated inline Astro!'),
);
await updatedLog;
@@ -89,7 +89,7 @@ test.describe('Astro component HMR', () => {
await Promise.all([
page.waitForLoadState('networkidle'),
await astro.editFile('../_deps/astro-linked-lib/Component.astro', (content) =>
- content.replace('>astro-linked-lib<', '>astro-linked-lib-update<')
+ content.replace('>astro-linked-lib<', '>astro-linked-lib-update<'),
),
]);
h1 = page.locator('#astro-linked-lib');
@@ -103,7 +103,7 @@ test.describe('Astro component HMR', () => {
await Promise.all([
page.waitForLoadState('networkidle'),
await astro.editFile('../_deps/astro-linked-lib/Component.astro', (content) =>
- content.replace('color: red', 'color: green')
+ content.replace('color: red', 'color: green'),
),
]);
h1 = page.locator('#astro-linked-lib');
diff --git a/packages/astro/e2e/astro-envs.test.js b/packages/astro/e2e/astro-envs.test.js
index 668510e3d..f6f3c5031 100644
--- a/packages/astro/e2e/astro-envs.test.js
+++ b/packages/astro/e2e/astro-envs.test.js
@@ -35,7 +35,7 @@ test.describe('Astro Environment BASE_URL', () => {
const clientComponentBaseUrl = page.locator('id=client-component-base-url');
await expect(clientComponentBaseUrl, 'clientComponentBaseUrl equals to /blog').toHaveText(
- '/blog'
+ '/blog',
);
});
});
diff --git a/packages/astro/e2e/content-collections.test.js b/packages/astro/e2e/content-collections.test.js
index eaa40d1b8..63c5077c9 100644
--- a/packages/astro/e2e/content-collections.test.js
+++ b/packages/astro/e2e/content-collections.test.js
@@ -19,7 +19,7 @@ test.describe('Content Collections', () => {
await page.goto(astro.resolveUrl('/'));
await astro.editFile('./src/components/MyComponent.astro', (original) =>
- original.replace('red', 'green')
+ original.replace('red', 'green'),
);
const h1 = page.locator('#my-heading');
diff --git a/packages/astro/e2e/css.test.js b/packages/astro/e2e/css.test.js
index fff197a39..fd4de700e 100644
--- a/packages/astro/e2e/css.test.js
+++ b/packages/astro/e2e/css.test.js
@@ -26,7 +26,7 @@ test.describe('CSS HMR', () => {
await expect(h).toHaveCSS('color', 'rgb(255, 0, 0)');
await astro.editFile('./src/styles/main.css', (original) =>
- original.replace('--h1-color: red;', '--h1-color: green;')
+ original.replace('--h1-color: red;', '--h1-color: green;'),
);
await expect(h).toHaveCSS('color', 'rgb(0, 128, 0)');
diff --git a/packages/astro/e2e/custom-client-directives.test.js b/packages/astro/e2e/custom-client-directives.test.js
index 118a5d53f..ef9de808a 100644
--- a/packages/astro/e2e/custom-client-directives.test.js
+++ b/packages/astro/e2e/custom-client-directives.test.js
@@ -98,7 +98,7 @@ function testClientDirectivesShared() {
const clientOptions = page.locator('#options');
await expect(clientOptions).toHaveText(
- 'Passed options are: {"message":"Hello! I was passed as an option"}'
+ 'Passed options are: {"message":"Hello! I was passed as an option"}',
);
});
}
diff --git a/packages/astro/e2e/dev-toolbar-audits.test.js b/packages/astro/e2e/dev-toolbar-audits.test.js
index 9a628a1c0..6ef63cc1e 100644
--- a/packages/astro/e2e/dev-toolbar-audits.test.js
+++ b/packages/astro/e2e/dev-toolbar-audits.test.js
@@ -79,7 +79,7 @@ test.describe('Dev Toolbar - Audits', () => {
'astro:dev-toolbar:settings',
JSON.stringify({
verbose: true,
- })
+ }),
);
});
@@ -93,7 +93,7 @@ test.describe('Dev Toolbar - Audits', () => {
const badButton = page.locator('#bad-button');
let consolePromise = page.waitForEvent('console', (msg) =>
- msg.text().includes('Rerunning audit lints')
+ msg.text().includes('Rerunning audit lints'),
);
await badButton.click({ clickCount: 5 });
await consolePromise;
@@ -102,7 +102,7 @@ test.describe('Dev Toolbar - Audits', () => {
expect(
logs.filter((log) => log.includes('Rerunning audit lints because the DOM has been updated'))
- .length === 1
+ .length === 1,
).toBe(true);
});
@@ -114,7 +114,7 @@ test.describe('Dev Toolbar - Audits', () => {
'astro:dev-toolbar:settings',
JSON.stringify({
verbose: true,
- })
+ }),
);
});
@@ -153,7 +153,7 @@ test.describe('Dev Toolbar - Audits', () => {
// Make sure we only reran audits once
expect(
logs.filter((log) => log.includes('Rerunning audit lints because the DOM has been updated'))
- .length === 1
+ .length === 1,
).toBe(true);
});
diff --git a/packages/astro/e2e/dev-toolbar.test.js b/packages/astro/e2e/dev-toolbar.test.js
index 305577852..ae8b6ef5c 100644
--- a/packages/astro/e2e/dev-toolbar.test.js
+++ b/packages/astro/e2e/dev-toolbar.test.js
@@ -42,7 +42,7 @@ test.describe('Dev Toolbar', () => {
await appButton.click();
const astroAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:home"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:home"]',
);
const astroWindow = astroAppCanvas.locator('astro-dev-toolbar-window');
await expect(astroWindow).toHaveCount(1);
@@ -152,7 +152,7 @@ test.describe('Dev Toolbar', () => {
const code = xrayHighlightTooltip.locator('pre > code');
await expect(code).toHaveText(
- JSON.stringify({ name: `<img src='' onerror='alert(1)'>` }, undefined, 2)
+ JSON.stringify({ name: `<img src='' onerror='alert(1)'>` }, undefined, 2),
);
expect(isAlertCalled).toBe(false);
});
@@ -264,7 +264,7 @@ test.describe('Dev Toolbar', () => {
await appButton.click();
const settingsAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]',
);
const settingsWindow = settingsAppCanvas.locator('astro-dev-toolbar-window');
await expect(settingsWindow).toHaveCount(1);
@@ -283,7 +283,7 @@ test.describe('Dev Toolbar', () => {
await appButton.click();
const settingsAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]',
);
const settingsWindow = settingsAppCanvas.locator('astro-dev-toolbar-window');
await expect(settingsWindow).toHaveCount(1);
@@ -294,7 +294,7 @@ test.describe('Dev Toolbar', () => {
await appButton.click();
const astroAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:home"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:home"]',
);
const astroWindow = astroAppCanvas.locator('astro-dev-toolbar-window');
await expect(astroWindow).toHaveCount(1);
@@ -311,7 +311,7 @@ test.describe('Dev Toolbar', () => {
await appButton.click();
const settingsAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]',
);
const settingsWindow = settingsAppCanvas.locator('astro-dev-toolbar-window');
await expect(settingsWindow).toHaveCount(1);
@@ -389,7 +389,7 @@ test.describe('Dev Toolbar', () => {
await settingsAppButton.click();
const settingsAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]',
);
const settingsWindow = settingsAppCanvas.locator('astro-dev-toolbar-window');
await expect(settingsWindow).toBeVisible();
@@ -423,7 +423,7 @@ test.describe('Dev Toolbar', () => {
await settingsAppButton.click();
const settingsAppCanvas = toolbar.locator(
- 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]'
+ 'astro-dev-toolbar-app-canvas[data-app-id="astro:settings"]',
);
const settingsWindow = settingsAppCanvas.locator('astro-dev-toolbar-window');
await expect(settingsWindow).toBeVisible();
diff --git a/packages/astro/e2e/errors.test.js b/packages/astro/e2e/errors.test.js
index 9087ac484..c015ea123 100644
--- a/packages/astro/e2e/errors.test.js
+++ b/packages/astro/e2e/errors.test.js
@@ -33,7 +33,7 @@ test.describe('Error display', () => {
// Edit the component file
await astro.editFile(
'./src/pages/astro-syntax-error.astro',
- () => `<h1>No syntax error</h1>`
+ () => `<h1>No syntax error</h1>`,
),
]);
@@ -107,7 +107,7 @@ test.describe('Error display', () => {
// Edit the component file
astro.editFile(
'./src/components/svelte/SvelteSyntaxError.svelte',
- () => `<h1>No mismatch</h1>`
+ () => `<h1>No mismatch</h1>`,
),
]);
diff --git a/packages/astro/e2e/hmr.test.js b/packages/astro/e2e/hmr.test.js
index e6c054300..72eaf8375 100644
--- a/packages/astro/e2e/hmr.test.js
+++ b/packages/astro/e2e/hmr.test.js
@@ -34,7 +34,7 @@ test.describe('Scripts with dependencies', () => {
await expect(h, 'original text set').toHaveText('before');
await astro.editFile('./src/scripts/heading.js', (original) =>
- original.replace('before', 'after')
+ original.replace('before', 'after'),
);
await expect(h, 'text changed').toHaveText('after');
@@ -64,7 +64,7 @@ test.describe('Styles', () => {
await expect(h).toHaveCSS('color', 'rgb(0, 0, 255)');
await astro.editFile('./src/styles/css-external.css', (original) =>
- original.replace('blue', 'red')
+ original.replace('blue', 'red'),
);
await expect(h).toHaveCSS('color', 'rgb(255, 0, 0)');
diff --git a/packages/astro/e2e/lit-component.test.js b/packages/astro/e2e/lit-component.test.js
index 54eb99074..d68f5f7b8 100644
--- a/packages/astro/e2e/lit-component.test.js
+++ b/packages/astro/e2e/lit-component.test.js
@@ -118,13 +118,13 @@ test.describe('Lit components', () => {
// Light DOM reconstructed correctly (slots are rendered alphabetically) and shadow dom content rendered
await expect(label, 'slotted text is in DOM').toHaveText(
- 'Framework client:only component Should not be visible Shadow dom default content should not be visible'
+ 'Framework client:only component Should not be visible Shadow dom default content should not be visible',
);
// Projected content should be visible
await expect(
page.locator('#client-only .default'),
- 'slotted element is visible'
+ 'slotted element is visible',
).toBeVisible();
await expect(page.locator('#client-only .foo1'), 'slotted element is visible').toBeVisible();
await expect(page.locator('#client-only .foo2'), 'slotted element is visible').toBeVisible();
@@ -132,13 +132,13 @@ test.describe('Lit components', () => {
// Non-projected content should not be visible
await expect(
page.locator('#client-only [slot="quux"]'),
- 'element without slot is not visible'
+ 'element without slot is not visible',
).toBeHidden();
// Default slot content should not be visible
await expect(
page.locator('#client-only .defaultContent'),
- 'element without slot is not visible'
+ 'element without slot is not visible',
).toBeHidden();
});
@@ -149,7 +149,7 @@ test.describe('Lit components', () => {
const label = counter.locator('h1');
await astro.editFile('./src/pages/index.astro', (original) =>
- original.replace('Hello, client:idle!', 'Hello, updated client:idle!')
+ original.replace('Hello, client:idle!', 'Hello, updated client:idle!'),
);
await expect(label, 'slot text updated').toHaveText('Hello, updated client:idle!');
diff --git a/packages/astro/e2e/multiple-frameworks.test.js b/packages/astro/e2e/multiple-frameworks.test.js
index e067b0357..08a2fb648 100644
--- a/packages/astro/e2e/multiple-frameworks.test.js
+++ b/packages/astro/e2e/multiple-frameworks.test.js
@@ -109,7 +109,7 @@ test.skip('Multiple frameworks', () => {
await expect(slot, 'initial slot content').toHaveText('Hello Preact!');
await astro.editFile('./src/pages/index.astro', (content) =>
- content.replace('Hello Preact!', 'Hello Preact, updated!')
+ content.replace('Hello Preact!', 'Hello Preact, updated!'),
);
await expect(slot, 'slot content updated').toHaveText('Hello Preact, updated!');
@@ -122,7 +122,7 @@ test.skip('Multiple frameworks', () => {
await expect(count, 'initial count updated to 0').toHaveText('0');
await astro.editFile('./src/components/ReactCounter.jsx', (content) =>
- content.replace('useState(0)', 'useState(5)')
+ content.replace('useState(0)', 'useState(5)'),
);
await expect(count, 'initial count updated to 5').toHaveText('5');
@@ -135,7 +135,7 @@ test.skip('Multiple frameworks', () => {
await expect(count, 'initial count updated to 0').toHaveText('0');
await astro.editFile('./src/components/PreactCounter.tsx', (content) =>
- content.replace('useState(0)', 'useState(5)')
+ content.replace('useState(0)', 'useState(5)'),
);
await expect(count, 'initial count updated to 5').toHaveText('5');
@@ -148,7 +148,7 @@ test.skip('Multiple frameworks', () => {
await expect(count, 'initial count updated to 0').toHaveText('0');
await astro.editFile('./src/components/SolidCounter.tsx', (content) =>
- content.replace('createSignal(0)', 'createSignal(5)')
+ content.replace('createSignal(0)', 'createSignal(5)'),
);
await expect(count, 'initial count updated to 5').toHaveText('5');
@@ -161,7 +161,7 @@ test.skip('Multiple frameworks', () => {
await expect(count, 'initial count updated to 0').toHaveText('0');
await astro.editFile('./src/components/VueCounter.vue', (content) =>
- content.replace('ref(0)', 'ref(5)')
+ content.replace('ref(0)', 'ref(5)'),
);
await expect(count, 'initial count updated to 5').toHaveText('5');
@@ -174,7 +174,7 @@ test.skip('Multiple frameworks', () => {
await expect(count, 'initial count is 0').toHaveText('0');
await astro.editFile('./src/components/SvelteCounter.svelte', (content) =>
- content.replace('let count = 0;', 'let count = 5;')
+ content.replace('let count = 0;', 'let count = 5;'),
);
await expect(count, 'initial count updated to 5').toHaveText('5');
diff --git a/packages/astro/e2e/nested-styles.test.js b/packages/astro/e2e/nested-styles.test.js
index 0dc5b868b..c482570f0 100644
--- a/packages/astro/e2e/nested-styles.test.js
+++ b/packages/astro/e2e/nested-styles.test.js
@@ -34,7 +34,7 @@ test.describe('Loading styles that are nested', () => {
await expect(header, 'should have background color').toHaveCSS(
'background-color',
- 'rgb(0, 0, 139)' // darkblue
+ 'rgb(0, 0, 139)', // darkblue
);
});
});
diff --git a/packages/astro/e2e/prefetch.test.js b/packages/astro/e2e/prefetch.test.js
index 7ac85135b..84ead590c 100644
--- a/packages/astro/e2e/prefetch.test.js
+++ b/packages/astro/e2e/prefetch.test.js
@@ -40,7 +40,7 @@ async function expectUrlPrefetched(url, page, count) {
const fetchCount = reqUrls.filter((u) => u.includes(url)).length;
expect(
fetchCount,
- `${url} should be prefetched ${count} time(s), but is prefetch with link ${linkCount} time(s) and with fetch ${fetchCount} time(s)`
+ `${url} should be prefetched ${count} time(s), but is prefetch with link ${linkCount} time(s) and with fetch ${fetchCount} time(s)`,
).toEqual(count);
}
}
@@ -344,7 +344,7 @@ test.describe('Prefetch (default), Experimental ({ clientPrerender: true })', ()
expect(await scriptIsInHead(page, '?search-param=true')).toBeFalsy();
await page.locator('#prefetch-search-param').hover();
await page.waitForFunction(
- () => document.querySelectorAll('script[type=speculationrules]').length === 2
+ () => document.querySelectorAll('script[type=speculationrules]').length === 2,
);
expect(await scriptIsInHead(page, '?search-param=true')).toBeTruthy();
});
@@ -361,7 +361,7 @@ test.describe('Prefetch (default), Experimental ({ clientPrerender: true })', ()
expect(await scriptIsInHead(page, '/prefetch-hover')).toBeFalsy();
await page.locator('#prefetch-hover').hover();
await page.waitForFunction(
- () => document.querySelectorAll('script[type=speculationrules]').length === 2
+ () => document.querySelectorAll('script[type=speculationrules]').length === 2,
);
expect(await scriptIsInHead(page, '/prefetch-hover')).toBeTruthy();
});
@@ -372,7 +372,7 @@ test.describe('Prefetch (default), Experimental ({ clientPrerender: true })', ()
// Scroll down to show the element
await page.locator('#prefetch-viewport').scrollIntoViewIfNeeded();
await page.waitForFunction(
- () => document.querySelectorAll('script[type=speculationrules]').length === 2
+ () => document.querySelectorAll('script[type=speculationrules]').length === 2,
);
expect(await scriptIsInHead(page, '/prefetch-viewport')).toBeTruthy();
});
diff --git a/packages/astro/e2e/shared-component-tests.js b/packages/astro/e2e/shared-component-tests.js
index ccce25b0b..024f1aade 100644
--- a/packages/astro/e2e/shared-component-tests.js
+++ b/packages/astro/e2e/shared-component-tests.js
@@ -134,7 +134,7 @@ export function prepareTestFactory(opts, { canReplayClicks = false } = {}) {
// Edit the component's initial count prop
await astro.editFile(pageSourceFilePath, (original) =>
- original.replace('id="client-idle" {...someProps}', 'id="client-idle" count={5}')
+ original.replace('id="client-idle" {...someProps}', 'id="client-idle" count={5}'),
);
await expect(count, 'count prop updated').toHaveText('5', { timeout: 10000 });
@@ -144,19 +144,19 @@ export function prepareTestFactory(opts, { canReplayClicks = false } = {}) {
await astro.editFile(componentFilePath, (original) =>
original.replace(
'Framework client:only component',
- 'Updated framework client:only component'
- )
+ 'Updated framework client:only component',
+ ),
);
const label = page.locator('#client-only');
await expect(label, 'client:only component is visible').toBeVisible();
await expect(label, 'client:only slot text is visible').toHaveText(
- 'Updated framework client:only component'
+ 'Updated framework client:only component',
);
// Edit the imported CSS file
await astro.editFile(counterCssFilePath || './src/components/Counter.css', (original) =>
- original.replace('font-size: 2em;', 'font-size: 24px;')
+ original.replace('font-size: 2em;', 'font-size: 24px;'),
);
await expect(count, 'imported CSS updated').toHaveCSS('font-size', '24px');
diff --git a/packages/astro/e2e/solid-component.test.js b/packages/astro/e2e/solid-component.test.js
index 81e6894e8..b998d1873 100644
--- a/packages/astro/e2e/solid-component.test.js
+++ b/packages/astro/e2e/solid-component.test.js
@@ -4,7 +4,7 @@ const { test, createTests } = prepareTestFactory(
{ root: './fixtures/solid-component/' },
{
canReplayClicks: true,
- }
+ },
);
const config = {
diff --git a/packages/astro/e2e/tailwindcss.test.js b/packages/astro/e2e/tailwindcss.test.js
index f8b120081..e58e10dfd 100644
--- a/packages/astro/e2e/tailwindcss.test.js
+++ b/packages/astro/e2e/tailwindcss.test.js
@@ -23,7 +23,7 @@ test.describe('Tailwind CSS', () => {
await expect(body, 'should have classes').toHaveClass('bg-dawn text-midnight');
await expect(body, 'should have background color').toHaveCSS(
'background-color',
- 'rgb(243, 233, 250)'
+ 'rgb(243, 233, 250)',
);
await expect(body, 'should have color').toHaveCSS('color', 'rgb(49, 39, 74)');
});
@@ -37,13 +37,13 @@ test.describe('Tailwind CSS', () => {
await expect(button, 'should have appearance: none').toHaveCSS('appearance', 'none');
await expect(button, 'should have appearance-none with webkit prefix').toHaveCSS(
'-webkit-appearance',
- 'none'
+ 'none',
);
await expect(button, 'should have bg-purple-600').toHaveClass(/bg-purple-600/);
await expect(button, 'should have background color').toHaveCSS(
'background-color',
- 'rgb(147, 51, 234)'
+ 'rgb(147, 51, 234)',
);
await expect(button, 'should have lg:py-3').toHaveClass(/lg:py-3/);
@@ -58,7 +58,7 @@ test.describe('Tailwind CSS', () => {
await page.goto(astro.resolveUrl('/'));
await astro.editFile('./src/components/Button.astro', (original) =>
- original.replace('bg-purple-600', 'bg-purple-400')
+ original.replace('bg-purple-600', 'bg-purple-400'),
);
const button = page.locator('button');
@@ -66,7 +66,7 @@ test.describe('Tailwind CSS', () => {
await expect(button, 'should have bg-purple-400').toHaveClass(/bg-purple-400/);
await expect(button, 'should have background color').toHaveCSS(
'background-color',
- 'rgb(192, 132, 252)'
+ 'rgb(192, 132, 252)',
);
});
});
diff --git a/packages/astro/e2e/test-utils.js b/packages/astro/e2e/test-utils.js
index 7d07ee953..48fcd17bd 100644
--- a/packages/astro/e2e/test-utils.js
+++ b/packages/astro/e2e/test-utils.js
@@ -84,7 +84,7 @@ export async function waitForHydrate(page, el) {
const astroIslandId = await astroIsland.last().getAttribute('uid');
await page.waitForFunction(
(selector) => document.querySelector(selector)?.hasAttribute('ssr') === false,
- `astro-island[uid="${astroIslandId}"]`
+ `astro-island[uid="${astroIslandId}"]`,
);
}
diff --git a/packages/astro/e2e/view-transitions.test.js b/packages/astro/e2e/view-transitions.test.js
index cbcd38497..135ec5571 100644
--- a/packages/astro/e2e/view-transitions.test.js
+++ b/packages/astro/e2e/view-transitions.test.js
@@ -35,7 +35,7 @@ function collectPreloads(page) {
mutations.forEach((mutation) =>
mutation.addedNodes.forEach((node) => {
if (node.nodeName === 'LINK' && node.rel === 'preload') preloads.push(node.href);
- })
+ }),
);
});
observer.observe(document.head, { childList: true });
@@ -132,7 +132,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be 2 page loads. The original, then going from 3 to 2'
+ 'There should be 2 page loads. The original, then going from 3 to 2',
).toEqual(2);
});
@@ -163,7 +163,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 2 page loads (for page one & three), but no additional loads for the hash change'
+ 'There should be only 2 page loads (for page one & three), but no additional loads for the hash change',
).toEqual(2);
});
@@ -185,7 +185,7 @@ test.describe('View Transitions', () => {
await expect(p, 'should have content').toHaveText('Page 1');
expect(
loads.length,
- 'There should be 3 page loads (for page one & three), and an additional loads for the back navigation'
+ 'There should be 3 page loads (for page one & three), and an additional loads for the back navigation',
).toEqual(3);
});
@@ -628,7 +628,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for going back on same page'
+ 'There should be only 1 page load. No additional loads for going back on same page',
).toEqual(1);
});
@@ -770,7 +770,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should only be the initial page load and two normal transitions'
+ 'There should only be the initial page load and two normal transitions',
).toEqual(1);
});
@@ -1030,7 +1030,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
});
@@ -1056,7 +1056,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
});
@@ -1075,7 +1075,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
});
@@ -1104,12 +1104,12 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
expect(
postedEncodings,
- 'There should be 1 POST, with encoding set to `multipart/form-data`'
+ 'There should be 1 POST, with encoding set to `multipart/form-data`',
).toEqual(['multipart/form-data']);
});
@@ -1130,8 +1130,8 @@ test.describe('View Transitions', () => {
await page.goto(
astro.resolveUrl(
- `/form-one?${new URLSearchParams({ enctype: 'application/x-www-form-urlencoded' })}`
- )
+ `/form-one?${new URLSearchParams({ enctype: 'application/x-www-form-urlencoded' })}`,
+ ),
);
// Submit the form
@@ -1139,12 +1139,12 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
expect(
postedEncodings,
- 'There should be 1 POST, with encoding set to `multipart/form-data`'
+ 'There should be 1 POST, with encoding set to `multipart/form-data`',
).toEqual(['application/x-www-form-urlencoded']);
});
@@ -1216,7 +1216,7 @@ test.describe('View Transitions', () => {
expect(
loads.length,
- 'There should be only 1 page load. No additional loads for the form submission'
+ 'There should be only 1 page load. No additional loads for the form submission',
).toEqual(1);
});
@@ -1333,7 +1333,7 @@ test.describe('View Transitions', () => {
expectedAnimations.add(name);
expect(page.locator(selector), 'should be escaped correctly').toHaveCSS(
'view-transition-name',
- name
+ name,
);
};
@@ -1361,36 +1361,36 @@ test.describe('View Transitions', () => {
await checkName('#thirteen', '___01____02______');
await checkName(
'#batch0',
- '__00_01_02_03_04_05_06_07_08_09_0a_0b_0c_0d_0e_0f_10_11_12_13_14_15_16_17_18_19_1a_1b_1c_1d_1e_1f'
+ '__00_01_02_03_04_05_06_07_08_09_0a_0b_0c_0d_0e_0f_10_11_12_13_14_15_16_17_18_19_1a_1b_1c_1d_1e_1f',
);
await checkName(
'#batch1',
- '__20_21_22_23_24_25_26_27_28_29_2a_2b_2c-_2e_2f0123456789_3a_3b_3c_3d_3e_3f'
+ '__20_21_22_23_24_25_26_27_28_29_2a_2b_2c-_2e_2f0123456789_3a_3b_3c_3d_3e_3f',
);
await checkName('#batch2', '__40ABCDEFGHIJKLMNOPQRSTUVWXYZ_5b_5c_5d_5e__');
await checkName('#batch3', '__60abcdefghijklmnopqrstuvwxyz_7b_7c_7d_7e_7f');
await checkName(
'#batch4',
- '\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f'
+ '\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f',
);
await checkName(
'#batch5',
- '\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf'
+ '\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf',
);
await checkName(
'#batch6',
- '\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf'
+ '\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf',
);
await checkName(
'#batch7',
- '\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff'
+ '\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff',
);
await page.click('#navigate');
await page.waitForTimeout(400); // yes, I dislike this, too. Might fix later.
expect(
expectedAnimations.size,
- 'all animations for transition:names should have been found'
+ 'all animations for transition:names should have been found',
).toEqual(0);
});
@@ -1425,7 +1425,7 @@ test.describe('View Transitions', () => {
const attributeValue = await page.$eval(
':root',
(element, attributeName) => element.getAttribute(attributeName),
- 'data-theme'
+ 'data-theme',
);
expect(attributeValue).toBe('purple');
});
diff --git a/packages/astro/e2e/vue-component.test.js b/packages/astro/e2e/vue-component.test.js
index ca491de90..3be31af85 100644
--- a/packages/astro/e2e/vue-component.test.js
+++ b/packages/astro/e2e/vue-component.test.js
@@ -47,7 +47,7 @@ test('hmr works', async ({ page, astro }) => {
await expect(span).toHaveText('Count is 1');
await astro.editFile('./src/components/State.vue', (content) =>
- content.replace('ref(1)', 'ref(2)')
+ content.replace('ref(1)', 'ref(2)'),
);
await expect(span).toHaveText('Count is 2');
diff --git a/packages/astro/performance/content-benchmark.mjs b/packages/astro/performance/content-benchmark.mjs
index bd362c807..a710bd762 100644
--- a/packages/astro/performance/content-benchmark.mjs
+++ b/packages/astro/performance/content-benchmark.mjs
@@ -74,8 +74,8 @@ async function benchmark({ fixtures, templates, numPosts }) {
const fixtures = formats.filter((format) => format !== 'md');
console.log(
`\n${bold('With Astro components')} ${dim(
- `${numPosts} posts (${formatsToString(fixtures)})`
- )}`
+ `${numPosts} posts (${formatsToString(fixtures)})`,
+ )}`,
);
process.env.ASTRO_PERFORMANCE_TEST_NAME = 'with-astro-components';
await benchmark({
@@ -92,8 +92,8 @@ async function benchmark({ fixtures, templates, numPosts }) {
const fixtures = formats.filter((format) => format !== 'md');
console.log(
`\n${bold('With React components')} ${dim(
- `${numPosts} posts (${formatsToString(fixtures)})`
- )}`
+ `${numPosts} posts (${formatsToString(fixtures)})`,
+ )}`,
);
process.env.ASTRO_PERFORMANCE_TEST_NAME = 'with-react-components';
await benchmark({
diff --git a/packages/astro/performance/scripts/generate-posts.mjs b/packages/astro/performance/scripts/generate-posts.mjs
index b97ac8f4b..37466cad3 100644
--- a/packages/astro/performance/scripts/generate-posts.mjs
+++ b/packages/astro/performance/scripts/generate-posts.mjs
@@ -23,8 +23,8 @@ export async function generatePosts({
Array.from(Array(numPosts).keys()).map((idx) => {
return fs.promises.writeFile(
`${postsDir}/post-${idx}${ext.startsWith('.') ? ext : `.${ext}`}`,
- fs.readFileSync(new URL(`./templates/${template}`, import.meta.url), 'utf8')
+ fs.readFileSync(new URL(`./templates/${template}`, import.meta.url), 'utf8'),
);
- })
+ }),
);
}
diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts
index 1a3cf60bb..950095005 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -378,7 +378,7 @@ export interface AstroGlobalPartial {
*/
glob(globStr: `${any}.astro`): Promise<AstroInstance[]>;
glob<T extends Record<string, any>>(
- globStr: `${any}${MarkdowFileExtension}`
+ globStr: `${any}${MarkdowFileExtension}`,
): Promise<MarkdownInstance<T>[]>;
glob<T extends Record<string, any>>(globStr: `${any}.mdx`): Promise<MDXInstance<T>[]>;
glob<T extends Record<string, any>>(globStr: string): Promise<T[]>;
@@ -2300,7 +2300,7 @@ export interface ContentEntryType {
contents: string;
fileUrl: URL;
viteId: string;
- }
+ },
): rollup.LoadResult | Promise<rollup.LoadResult>;
contentModuleTypes?: string;
/**
@@ -2385,7 +2385,7 @@ export type AsyncRendererComponentFn<U> = (
Component: any,
props: any,
slots: Record<string, string>,
- metadata?: AstroComponentMetadata
+ metadata?: AstroComponentMetadata,
) => Promise<U>;
/** Generic interface for a component (Astro, Svelte, React, etc.) */
@@ -2470,7 +2470,7 @@ export type GetStaticPathsResultKeyed = GetStaticPathsResult & {
* [Astro Reference](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
*/
export type GetStaticPaths = (
- options: GetStaticPathsOptions
+ options: GetStaticPathsOptions,
) => Promise<GetStaticPathsResult> | GetStaticPathsResult;
/**
@@ -2493,7 +2493,7 @@ export type GetStaticPaths = (
* ```
*/
export type InferGetStaticParamsType<T> = T extends (
- opts?: GetStaticPathsOptions
+ opts?: GetStaticPathsOptions,
) => infer R | Promise<infer R>
? R extends Array<infer U>
? U extends { params: infer P }
@@ -2526,7 +2526,7 @@ export type InferGetStaticParamsType<T> = T extends (
* ```
*/
export type InferGetStaticPropsType<T> = T extends (
- opts: GetStaticPathsOptions
+ opts: GetStaticPathsOptions,
) => infer R | Promise<infer R>
? R extends Array<infer U>
? U extends { props: infer P }
@@ -2639,7 +2639,7 @@ export type PaginateFunction = <
AdditionalPaginateParams extends Params,
>(
data: PaginateData[],
- args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams>
+ args?: PaginateOptions<AdditionalPaginateProps, AdditionalPaginateParams>,
) => {
params: Simplify<
{
@@ -2755,7 +2755,7 @@ interface AstroSharedContext<
TInputSchema extends ActionInputSchema<TAccept>,
TAction extends ActionClient<unknown, TAccept, TInputSchema>,
>(
- action: TAction
+ action: TAction,
) => ActionReturnType<TAction> | undefined;
/**
* Call action handler from the server.
@@ -2769,7 +2769,7 @@ interface AstroSharedContext<
| ActionClient<TOutput, TAccept, TInputSchema>['orThrow'],
>(
action: TAction,
- input: Parameters<TAction>[0]
+ input: Parameters<TAction>[0],
) => Promise<ActionReturnType<TAction>>;
/**
* Route parameters for this request if this is a dynamic route.
@@ -3142,7 +3142,7 @@ export type RewritePayload = string | URL | Request;
export type MiddlewareNext = (rewritePayload?: RewritePayload) => Promise<Response>;
export type MiddlewareHandler = (
context: APIContext,
- next: MiddlewareNext
+ next: MiddlewareNext,
) => Promise<Response> | Response | Promise<void> | void;
// NOTE: when updating this file with other functions,
@@ -3258,7 +3258,7 @@ export interface SSRResult {
createAstro(
Astro: AstroGlobalPartial,
props: Record<string, any>,
- slots: Record<string, any> | null
+ slots: Record<string, any> | null,
): AstroGlobal;
params: Params;
resolve: (s: string) => Promise<string>;
@@ -3326,7 +3326,7 @@ export interface PreviewServerParams {
}
export type CreatePreviewServer = (
- params: PreviewServerParams
+ params: PreviewServerParams,
) => PreviewServer | Promise<PreviewServer>;
export interface PreviewModule {
@@ -3351,7 +3351,7 @@ type DirectiveOptions = {
export type ClientDirective = (
load: DirectiveLoad,
options: DirectiveOptions,
- el: HTMLElement
+ el: HTMLElement,
) => void;
export interface ClientDirectiveConfig {
@@ -3399,7 +3399,7 @@ export type DevToolbarApp = {
init?(
canvas: ShadowRoot,
app: ToolbarAppEventTarget,
- server: ToolbarServerHelpers
+ server: ToolbarServerHelpers,
): void | Promise<void>;
beforeTogglingOff?(canvas: ShadowRoot): boolean | Promise<boolean>;
};
@@ -3464,7 +3464,7 @@ declare global {
// Container types
export type ContainerImportRendererFn = (
- containerRenderer: ContainerRenderer
+ containerRenderer: ContainerRenderer,
) => Promise<SSRLoadedRenderer>;
export type ContainerRenderer = {
diff --git a/packages/astro/src/actions/index.ts b/packages/astro/src/actions/index.ts
index f176988ff..04a911856 100644
--- a/packages/astro/src/actions/index.ts
+++ b/packages/astro/src/actions/index.ts
@@ -31,7 +31,7 @@ export default function astroActions({
}
const stringifiedActionsImport = JSON.stringify(
- viteID(new URL('./actions', params.config.srcDir))
+ viteID(new URL('./actions', params.config.srcDir)),
);
params.updateConfig({
vite: {
@@ -75,7 +75,7 @@ export function vitePluginUserActions({ settings }: { settings: AstroSettings })
}
if (id === VIRTUAL_INTERNAL_MODULE_ID) {
const resolvedModule = await this.resolve(
- `${decodeURI(new URL('actions', settings.config.srcDir).pathname)}`
+ `${decodeURI(new URL('actions', settings.config.srcDir).pathname)}`,
);
if (!resolvedModule) {
@@ -109,7 +109,7 @@ const vitePluginActions = (fs: typeof fsMod): VitePlugin => ({
let code = await fs.promises.readFile(
new URL('../../templates/actions.mjs', import.meta.url),
- 'utf-8'
+ 'utf-8',
);
if (opts?.ssr) {
code += `\nexport * from 'astro/actions/runtime/virtual/server.js';`;
diff --git a/packages/astro/src/actions/runtime/middleware.ts b/packages/astro/src/actions/runtime/middleware.ts
index 3d430b04a..0b93eb72f 100644
--- a/packages/astro/src/actions/runtime/middleware.ts
+++ b/packages/astro/src/actions/runtime/middleware.ts
@@ -35,7 +35,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
// eslint-disable-next-line no-console
console.warn(
yellow('[astro:actions]'),
- 'POST requests should not be sent to prerendered pages. If you\'re using Actions, disable prerendering with `export const prerender = "false".'
+ 'POST requests should not be sent to prerendered pages. If you\'re using Actions, disable prerendering with `export const prerender = "false".',
);
return next();
}
diff --git a/packages/astro/src/actions/runtime/virtual/client.ts b/packages/astro/src/actions/runtime/virtual/client.ts
index ddeba9a75..424552a9f 100644
--- a/packages/astro/src/actions/runtime/virtual/client.ts
+++ b/packages/astro/src/actions/runtime/virtual/client.ts
@@ -10,5 +10,5 @@ export const z = new Proxy(
get() {
throw new Error('[astro:action] `z` unexpectedly used on the client.');
},
- }
+ },
);
diff --git a/packages/astro/src/actions/runtime/virtual/get-action.ts b/packages/astro/src/actions/runtime/virtual/get-action.ts
index 052849c48..cb9addd9d 100644
--- a/packages/astro/src/actions/runtime/virtual/get-action.ts
+++ b/packages/astro/src/actions/runtime/virtual/get-action.ts
@@ -7,7 +7,7 @@ import type { ActionAccept, ActionClient } from './server.js';
* the user's `src/actions/index.ts` file at build-time.
*/
export async function getAction(
- path: string
+ path: string,
): Promise<ActionClient<unknown, ActionAccept, ZodType> | undefined> {
const pathKeys = path.replace('/_actions/', '').split('.');
// @ts-expect-error virtual module
diff --git a/packages/astro/src/actions/runtime/virtual/server.ts b/packages/astro/src/actions/runtime/virtual/server.ts
index 94a993f04..a711f1032 100644
--- a/packages/astro/src/actions/runtime/virtual/server.ts
+++ b/packages/astro/src/actions/runtime/virtual/server.ts
@@ -25,7 +25,7 @@ export type ActionClient<
TInputSchema extends ActionInputSchema<TAccept> | undefined,
> = TInputSchema extends z.ZodType
? ((
- input: TAccept extends 'form' ? FormData : z.input<TInputSchema>
+ input: TAccept extends 'form' ? FormData : z.input<TInputSchema>,
) => Promise<
SafeResult<
z.input<TInputSchema> extends ErrorInferenceObject
@@ -36,7 +36,7 @@ export type ActionClient<
>) & {
queryString: string;
orThrow: (
- input: TAccept extends 'form' ? FormData : z.input<TInputSchema>
+ input: TAccept extends 'form' ? FormData : z.input<TInputSchema>,
) => Promise<Awaited<TOutput>>;
}
: (input?: any) => Promise<SafeResult<never, Awaited<TOutput>>> & {
@@ -85,7 +85,7 @@ export function defineAction<
function getFormServerHandler<TOutput, TInputSchema extends ActionInputSchema<'form'>>(
handler: ActionHandler<TInputSchema, TOutput>,
- inputSchema?: TInputSchema
+ inputSchema?: TInputSchema,
) {
return async (unparsedInput: unknown, context: ActionAPIContext): Promise<Awaited<TOutput>> => {
if (!(unparsedInput instanceof FormData)) {
@@ -107,7 +107,7 @@ function getFormServerHandler<TOutput, TInputSchema extends ActionInputSchema<'f
function getJsonServerHandler<TOutput, TInputSchema extends ActionInputSchema<'json'>>(
handler: ActionHandler<TInputSchema, TOutput>,
- inputSchema?: TInputSchema
+ inputSchema?: TInputSchema,
) {
return async (unparsedInput: unknown, context: ActionAPIContext): Promise<Awaited<TOutput>> => {
if (unparsedInput instanceof FormData) {
@@ -129,7 +129,7 @@ function getJsonServerHandler<TOutput, TInputSchema extends ActionInputSchema<'j
/** Transform form data to an object based on a Zod schema. */
export function formDataToObject<T extends z.AnyZodObject>(
formData: FormData,
- schema: T
+ schema: T,
): Record<string, unknown> {
const obj: Record<string, unknown> = {};
for (const [key, baseValidator] of Object.entries(schema.shape)) {
@@ -151,7 +151,7 @@ export function formDataToObject<T extends z.AnyZodObject>(
function handleFormDataGetAll(
key: string,
formData: FormData,
- validator: z.ZodArray<z.ZodUnknown>
+ validator: z.ZodArray<z.ZodUnknown>,
) {
const entries = Array.from(formData.getAll(key));
const elementValidator = validator._def.type;
@@ -167,7 +167,7 @@ function handleFormDataGet(
key: string,
formData: FormData,
validator: unknown,
- baseValidator: unknown
+ baseValidator: unknown,
) {
const value = formData.get(key);
if (!value) {
diff --git a/packages/astro/src/actions/runtime/virtual/shared.ts b/packages/astro/src/actions/runtime/virtual/shared.ts
index e00a89c68..962a0bec8 100644
--- a/packages/astro/src/actions/runtime/virtual/shared.ts
+++ b/packages/astro/src/actions/runtime/virtual/shared.ts
@@ -41,7 +41,7 @@ const codeToStatusMap: Record<ActionErrorCode, number> = {
const statusToCodeMap: Record<number, ActionErrorCode> = Object.entries(codeToStatusMap).reduce(
// reverse the key-value pairs
(acc, [key, value]) => ({ ...acc, [value]: key }),
- {}
+ {},
);
// T is used for error inference with SafeInput -> isInputError.
@@ -92,11 +92,11 @@ export function isActionError(error?: unknown): error is ActionError {
}
export function isInputError<T extends ErrorInferenceObject>(
- error?: ActionError<T>
+ error?: ActionError<T>,
): error is ActionInputError<T>;
export function isInputError(error?: unknown): error is ActionInputError<ErrorInferenceObject>;
export function isInputError<T extends ErrorInferenceObject>(
- error?: unknown | ActionError<T>
+ error?: unknown | ActionError<T>,
): error is ActionInputError<T> {
return (
typeof error === 'object' &&
@@ -146,7 +146,7 @@ export class ActionInputError<T extends ErrorInferenceObject> extends ActionErro
}
export async function callSafely<TOutput>(
- handler: () => MaybePromise<TOutput>
+ handler: () => MaybePromise<TOutput>,
): Promise<SafeResult<z.ZodType, TOutput>> {
try {
const data = await handler();
diff --git a/packages/astro/src/assets/build/generate.ts b/packages/astro/src/assets/build/generate.ts
index 52edeafbe..fcc19f4f5 100644
--- a/packages/astro/src/assets/build/generate.ts
+++ b/packages/astro/src/assets/build/generate.ts
@@ -48,7 +48,7 @@ type ImageData = { data: Uint8Array; expires: number };
export async function prepareAssetsGenerationEnv(
pipeline: BuildPipeline,
- totalCount: number
+ totalCount: number,
): Promise<AssetEnv> {
const { config, logger } = pipeline;
let useCache = true;
@@ -61,7 +61,7 @@ export async function prepareAssetsGenerationEnv(
} catch (err) {
logger.warn(
null,
- `An error was encountered while creating the cache directory. Proceeding without caching. Error: ${err}`
+ `An error was encountered while creating the cache directory. Proceeding without caching. Error: ${err}`,
);
useCache = false;
}
@@ -96,7 +96,7 @@ export async function generateImagesForPath(
originalFilePath: string,
transformsAndPath: MapValue<AssetsGlobalStaticImagesList>,
env: AssetEnv,
- queue: PQueue
+ queue: PQueue,
) {
const originalImageData = await loadImage(originalFilePath, env);
@@ -119,7 +119,7 @@ export async function generateImagesForPath(
if (transformsAndPath.originalSrcPath) {
env.logger.debug(
'assets',
- `Deleting ${originalFilePath} as it's not referenced outside of image processing.`
+ `Deleting ${originalFilePath} as it's not referenced outside of image processing.`,
);
await fs.promises.unlink(getFullImagePath(originalFilePath, env));
}
@@ -131,7 +131,7 @@ export async function generateImagesForPath(
async function generateImage(
originalImage: ImageData,
filepath: string,
- options: ImageTransform
+ options: ImageTransform,
) {
const timeStart = performance.now();
const generationData = await generateImageInternal(originalImage, filepath, options);
@@ -145,7 +145,7 @@ export async function generateImagesForPath(
const count = `(${env.count.current}/${env.count.total})`;
env.logger.info(
null,
- ` ${green('▶')} ${filepath} ${dim(statsText)} ${dim(timeIncrease)} ${dim(count)}`
+ ` ${green('▶')} ${filepath} ${dim(statsText)} ${dim(timeIncrease)} ${dim(count)}`,
);
env.count.current++;
}
@@ -153,7 +153,7 @@ export async function generateImagesForPath(
async function generateImageInternal(
originalImage: ImageData,
filepath: string,
- options: ImageTransform
+ options: ImageTransform,
): Promise<GenerationData> {
const isLocalImage = isESMImportedImage(options.src);
const finalFileURL = new URL('.' + filepath, env.clientRoot);
@@ -177,7 +177,7 @@ export async function generateImagesForPath(
await fs.promises.unlink(cachedFileURL);
throw new Error(
- `Malformed cache entry for ${filepath}, cache will be regenerated for this file.`
+ `Malformed cache entry for ${filepath}, cache will be regenerated for this file.`,
);
}
@@ -219,7 +219,7 @@ export async function generateImagesForPath(
await imageService.transform(
originalImage.data,
{ ...options, src: originalImagePath },
- env.imageConfig
+ env.imageConfig,
)
).data;
} catch (e) {
@@ -228,7 +228,7 @@ export async function generateImagesForPath(
...AstroErrorData.CouldNotTransformImage,
message: AstroErrorData.CouldNotTransformImage.message(originalFilePath),
},
- { cause: e }
+ { cause: e },
);
throw error;
@@ -245,14 +245,14 @@ export async function generateImagesForPath(
JSON.stringify({
data: Buffer.from(resultData.data).toString('base64'),
expires: resultData.expires,
- })
+ }),
);
}
}
} catch (e) {
env.logger.warn(
null,
- `An error was encountered while creating the cache directory. Proceeding without caching. Error: ${e}`
+ `An error was encountered while creating the cache directory. Proceeding without caching. Error: ${e}`,
);
} finally {
// Write the final file
diff --git a/packages/astro/src/assets/build/remote.ts b/packages/astro/src/assets/build/remote.ts
index c3d4bb9ba..08f8f4519 100644
--- a/packages/astro/src/assets/build/remote.ts
+++ b/packages/astro/src/assets/build/remote.ts
@@ -8,7 +8,7 @@ export async function loadRemoteImage(src: string) {
if (!res.ok) {
throw new Error(
- `Failed to load remote image ${src}. The request did not return a 200 OK response. (received ${res.status}))`
+ `Failed to load remote image ${src}. The request did not return a 200 OK response. (received ${res.status}))`,
);
}
diff --git a/packages/astro/src/assets/endpoint/generic.ts b/packages/astro/src/assets/endpoint/generic.ts
index 4180bffe2..5238f3721 100644
--- a/packages/astro/src/assets/endpoint/generic.ts
+++ b/packages/astro/src/assets/endpoint/generic.ts
@@ -60,7 +60,7 @@ export const GET: APIRoute = async ({ request }) => {
const { data, format } = await imageService.transform(
new Uint8Array(inputBuffer),
transform,
- imageConfig
+ imageConfig,
);
return new Response(data, {
diff --git a/packages/astro/src/assets/endpoint/node.ts b/packages/astro/src/assets/endpoint/node.ts
index ecbb75179..4c50fe95f 100644
--- a/packages/astro/src/assets/endpoint/node.ts
+++ b/packages/astro/src/assets/endpoint/node.ts
@@ -83,7 +83,7 @@ export const GET: APIRoute = async ({ request }) => {
if (!transform?.src) {
const err = new Error(
- 'Incorrect transform returned by `parseURL`. Expected a transform with a `src` property.'
+ 'Incorrect transform returned by `parseURL`. Expected a transform with a `src` property.',
);
console.error('Could not parse image transform from URL:', err);
return new Response('Internal Server Error', { status: 500 });
@@ -122,7 +122,7 @@ export const GET: APIRoute = async ({ request }) => {
import.meta.env.DEV ? `Could not process image request: ${err}` : `Internal Server Error`,
{
status: 500,
- }
+ },
);
}
};
diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts
index 7265e85df..38afbf19f 100644
--- a/packages/astro/src/assets/internal.ts
+++ b/packages/astro/src/assets/internal.ts
@@ -33,7 +33,7 @@ export async function getConfiguredImageService(): Promise<ImageService> {
export async function getImage(
options: UnresolvedImageTransform,
- imageConfig: AstroConfig['image']
+ imageConfig: AstroConfig['image'],
): Promise<GetImageResult> {
if (!options || typeof options !== 'object') {
throw new AstroError({
@@ -47,7 +47,7 @@ export async function getImage(
message: AstroErrorData.ExpectedImage.message(
options.src,
'undefined',
- JSON.stringify(options)
+ JSON.stringify(options),
),
});
}
@@ -101,7 +101,7 @@ export async function getImage(
url: await service.getURL(srcSet.transform, imageConfig),
descriptor: srcSet.descriptor,
attributes: srcSet.attributes,
- }))
+ })),
);
if (
@@ -113,7 +113,7 @@ export async function getImage(
imageURL = globalThis.astroAsset.addStaticImage(
validatedOptions,
propsToHash,
- originalFilePath
+ originalFilePath,
);
srcSets = srcSetTransforms.map((srcSet) => ({
transform: srcSet.transform,
diff --git a/packages/astro/src/assets/services/service.ts b/packages/astro/src/assets/services/service.ts
index 0a4ff4064..9cd6d0ecb 100644
--- a/packages/astro/src/assets/services/service.ts
+++ b/packages/astro/src/assets/services/service.ts
@@ -47,7 +47,7 @@ interface SharedServiceProps<T extends Record<string, any> = Record<string, any>
*/
getSrcSet?: (
options: ImageTransform,
- imageConfig: ImageConfig<T>
+ imageConfig: ImageConfig<T>,
) => UnresolvedSrcSetValue[] | Promise<UnresolvedSrcSetValue[]>;
/**
* Return any additional HTML attributes separate from `src` that your service requires to show the image properly.
@@ -57,7 +57,7 @@ interface SharedServiceProps<T extends Record<string, any> = Record<string, any>
*/
getHTMLAttributes?: (
options: ImageTransform,
- imageConfig: ImageConfig<T>
+ imageConfig: ImageConfig<T>,
) => Record<string, any> | Promise<Record<string, any>>;
/**
* Validate and return the options passed by the user.
@@ -69,7 +69,7 @@ interface SharedServiceProps<T extends Record<string, any> = Record<string, any>
*/
validateOptions?: (
options: ImageTransform,
- imageConfig: ImageConfig<T>
+ imageConfig: ImageConfig<T>,
) => ImageTransform | Promise<ImageTransform>;
}
@@ -90,7 +90,7 @@ export interface LocalImageService<T extends Record<string, any> = Record<string
*/
parseURL: (
url: URL,
- imageConfig: ImageConfig<T>
+ imageConfig: ImageConfig<T>,
) => LocalImageTransform | undefined | Promise<LocalImageTransform> | Promise<undefined>;
/**
* Performs the image transformations on the input image and returns both the binary data and
@@ -99,7 +99,7 @@ export interface LocalImageService<T extends Record<string, any> = Record<string
transform: (
inputBuffer: Uint8Array,
transform: LocalImageTransform,
- imageConfig: ImageConfig<T>
+ imageConfig: ImageConfig<T>,
) => Promise<{ data: Uint8Array; format: ImageOutputFormat }>;
/**
@@ -148,7 +148,7 @@ export const baseService: Omit<LocalImageService, 'transform'> = {
message: AstroErrorData.ExpectedImage.message(
JSON.stringify(options.src),
typeof options.src,
- JSON.stringify(options, (_, v) => (v === undefined ? null : v))
+ JSON.stringify(options, (_, v) => (v === undefined ? null : v)),
),
});
}
@@ -188,7 +188,7 @@ export const baseService: Omit<LocalImageService, 'transform'> = {
message: AstroErrorData.UnsupportedImageFormat.message(
options.src.format,
options.src.src,
- VALID_SUPPORTED_FORMATS
+ VALID_SUPPORTED_FORMATS,
),
});
}
@@ -281,14 +281,14 @@ export const baseService: Omit<LocalImageService, 'transform'> = {
...densityWidths.map((width, index) => ({
maxTargetWidth: Math.min(width, maxWidth),
descriptor: `${densityValues[index]}x` as const,
- }))
+ })),
);
} else if (widths) {
allWidths.push(
...widths.map((width) => ({
maxTargetWidth: Math.min(width, maxWidth),
descriptor: `${width}w` as const,
- }))
+ })),
);
}
diff --git a/packages/astro/src/assets/services/squoosh.ts b/packages/astro/src/assets/services/squoosh.ts
index ddadaabf3..6eb78db4b 100644
--- a/packages/astro/src/assets/services/squoosh.ts
+++ b/packages/astro/src/assets/services/squoosh.ts
@@ -31,7 +31,7 @@ const qualityTable: Record<
async function getRotationForEXIF(
inputBuffer: Uint8Array,
- src?: string
+ src?: string,
): Promise<Operation | undefined> {
const meta = await imageMetadata(inputBuffer, src);
if (!meta) return undefined;
diff --git a/packages/astro/src/assets/utils/metadata.ts b/packages/astro/src/assets/utils/metadata.ts
index 645a2a5c6..d212bdeb7 100644
--- a/packages/astro/src/assets/utils/metadata.ts
+++ b/packages/astro/src/assets/utils/metadata.ts
@@ -4,7 +4,7 @@ import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
export async function imageMetadata(
data: Uint8Array,
- src?: string
+ src?: string,
): Promise<Omit<ImageMetadata, 'src' | 'fsPath'>> {
try {
const result = probe(data);
diff --git a/packages/astro/src/assets/utils/node/emitAsset.ts b/packages/astro/src/assets/utils/node/emitAsset.ts
index 09a947538..b20ce4933 100644
--- a/packages/astro/src/assets/utils/node/emitAsset.ts
+++ b/packages/astro/src/assets/utils/node/emitAsset.ts
@@ -14,7 +14,7 @@ export async function emitESMImage(
_watchMode: boolean,
// FIX: in Astro 5, this function should not be passed in dev mode at all.
// Or rethink the API so that a function that throws isn't passed through.
- fileEmitter?: FileEmitter
+ fileEmitter?: FileEmitter,
): Promise<ImageMetadata | undefined> {
if (!id) {
return undefined;
diff --git a/packages/astro/src/assets/utils/queryParams.ts b/packages/astro/src/assets/utils/queryParams.ts
index 56bb4b3ff..b073c9786 100644
--- a/packages/astro/src/assets/utils/queryParams.ts
+++ b/packages/astro/src/assets/utils/queryParams.ts
@@ -1,7 +1,7 @@
import type { ImageInputFormat, ImageMetadata } from '../types.js';
export function getOrigQueryParams(
- params: URLSearchParams
+ params: URLSearchParams,
): Pick<ImageMetadata, 'width' | 'height' | 'format'> | undefined {
const width = params.get('origWidth');
const height = params.get('origHeight');
diff --git a/packages/astro/src/assets/utils/remotePattern.ts b/packages/astro/src/assets/utils/remotePattern.ts
index 3384e313e..5feefb89f 100644
--- a/packages/astro/src/assets/utils/remotePattern.ts
+++ b/packages/astro/src/assets/utils/remotePattern.ts
@@ -70,7 +70,7 @@ export function isRemoteAllowed(
{
domains = [],
remotePatterns = [],
- }: Partial<Pick<AstroConfig['image'], 'domains' | 'remotePatterns'>>
+ }: Partial<Pick<AstroConfig['image'], 'domains' | 'remotePatterns'>>,
): boolean {
if (!isRemotePath(src)) return false;
diff --git a/packages/astro/src/assets/utils/transformToPath.ts b/packages/astro/src/assets/utils/transformToPath.ts
index 9a91098cc..554761487 100644
--- a/packages/astro/src/assets/utils/transformToPath.ts
+++ b/packages/astro/src/assets/utils/transformToPath.ts
@@ -18,7 +18,7 @@ export function propsToFilename(filePath: string, transform: ImageTransform, has
export function hashTransform(
transform: ImageTransform,
imageService: string,
- propertiesToHash: string[]
+ propertiesToHash: string[],
) {
// Extract the fields we want to hash
const hashFields = propertiesToHash.reduce(
@@ -28,7 +28,7 @@ export function hashTransform(
acc[prop] = transform[prop];
return acc;
},
- { imageService } as Record<string, unknown>
+ { imageService } as Record<string, unknown>,
);
return shorthash(deterministicString(hashFields));
}
diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts
index 949a6e672..4c9314e85 100644
--- a/packages/astro/src/assets/vite-plugin-assets.ts
+++ b/packages/astro/src/assets/vite-plugin-assets.ts
@@ -25,7 +25,7 @@ const resolvedVirtualModuleId = '\0' + VIRTUAL_MODULE_ID;
const assetRegex = new RegExp(`\\.(${VALID_INPUT_FORMATS.join('|')})`, 'i');
const assetRegexEnds = new RegExp(`\\.(${VALID_INPUT_FORMATS.join('|')})$`, 'i');
const addStaticImageFactory = (
- settings: AstroSettings
+ settings: AstroSettings,
): typeof globalThis.astroAsset.addStaticImage => {
return (options, hashProperties, originalFSPath) => {
if (!globalThis.astroAsset.staticImages) {
@@ -46,7 +46,7 @@ const addStaticImageFactory = (
// This is the path to the original image, from the dist root, without the base or the asset prefix (e.g. /_astro/image.hash.png)
const finalOriginalPath = removeBase(
removeBase(ESMImportedImageSrc, settings.config.base),
- assetPrefix
+ assetPrefix,
);
const hash = hashTransform(options, settings.config.image.service.entrypoint, hashProperties);
@@ -62,8 +62,8 @@ const addStaticImageFactory = (
finalFilePath = prependForwardSlash(
joinPaths(
isESMImportedImage(options.src) ? '' : settings.config.build.assets,
- prependForwardSlash(propsToFilename(finalOriginalPath, options, hash))
- )
+ prependForwardSlash(propsToFilename(finalOriginalPath, options, hash)),
+ ),
);
if (!transformsForPath) {
@@ -146,11 +146,11 @@ export default function assets({
new URL(
isServerLikeOutput(settings.config)
? settings.config.build.client
- : settings.config.outDir
- )
+ : settings.config.outDir,
+ ),
)});
export const assetsDir = /* #__PURE__ */ new URL(${JSON.stringify(
- settings.config.build.assets
+ settings.config.build.assets,
)}, outDir);
export const getImage = async (options) => await getImageInternal(options, imageConfig);
`;
@@ -235,7 +235,7 @@ export default function assets({
if (options?.ssr) {
return `export default ${getProxyCode(
imageMetadata,
- isServerLikeOutput(settings.config)
+ isServerLikeOutput(settings.config),
)}`;
} else {
globalThis.astroAsset.referencedImages.add(imageMetadata.fsPath);
diff --git a/packages/astro/src/cli/add/imports.ts b/packages/astro/src/cli/add/imports.ts
index bae8c7443..375ca1dd8 100644
--- a/packages/astro/src/cli/add/imports.ts
+++ b/packages/astro/src/cli/add/imports.ts
@@ -12,7 +12,7 @@ export function ensureImport(root: t.File, importDeclaration: t.ImportDeclaratio
if (specifier.local.name === specifierToFind.local.name) {
specifiersToFind.splice(i, 1);
}
- })
+ }),
);
}
},
diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts
index 48cdb41a2..7d33fe33a 100644
--- a/packages/astro/src/cli/add/index.ts
+++ b/packages/astro/src/cli/add/index.ts
@@ -191,9 +191,9 @@ export async function add(names: string[], { flags }: AddOptions) {
'SKIP_FORMAT',
`\n ${magenta(
`Astro will scaffold ${green('./db/config.ts')}${magenta(' and ')}${green(
- './db/seed.ts'
- )}${magenta(' files.')}`
- )}\n`
+ './db/seed.ts',
+ )}${magenta(' files.')}`,
+ )}\n`,
);
if (await askToContinue({ flags })) {
@@ -205,7 +205,7 @@ export async function add(names: string[], { flags }: AddOptions) {
} else {
logger.info(
'SKIP_FORMAT',
- `\n Astro DB requires additional configuration. Please refer to https://astro.build/db/config`
+ `\n Astro DB requires additional configuration. Please refer to https://astro.build/db/config`,
);
}
} else {
@@ -235,8 +235,8 @@ export async function add(names: string[], { flags }: AddOptions) {
'SKIP_FORMAT',
msg.cancelled(
`Dependencies ${bold('NOT')} installed.`,
- `Be sure to install them manually before continuing!`
- )
+ `Be sure to install them manually before continuing!`,
+ ),
);
break;
}
@@ -273,8 +273,8 @@ export async function add(names: string[], { flags }: AddOptions) {
ast,
t.importDeclaration(
[t.importSpecifier(defineConfig, defineConfig)],
- t.stringLiteral('astro/config')
- )
+ t.stringLiteral('astro/config'),
+ ),
);
wrapDefaultExport(ast, defineConfig);
@@ -290,9 +290,9 @@ export async function add(names: string[], { flags }: AddOptions) {
'SKIP_FORMAT',
`\n ${magenta(
`Check our deployment docs for ${bold(
- integration.packageName
- )} to update your "adapter" config.`
- )}`
+ integration.packageName,
+ )} to update your "adapter" config.`,
+ )}`,
);
}
} else {
@@ -326,7 +326,7 @@ export async function add(names: string[], { flags }: AddOptions) {
case UpdateResult.cancelled: {
logger.info(
'SKIP_FORMAT',
- msg.cancelled(`Your configuration has ${bold('NOT')} been updated.`)
+ msg.cancelled(`Your configuration has ${bold('NOT')} been updated.`),
);
break;
}
@@ -338,7 +338,7 @@ export async function add(names: string[], { flags }: AddOptions) {
.then((res) => JSON.parse(res.toString()));
const deps = Object.keys(Object.assign(dependencies, devDependencies));
const missingDeps = integrations.filter(
- (integration) => !deps.includes(integration.packageName)
+ (integration) => !deps.includes(integration.packageName),
);
if (missingDeps.length === 0) {
logger.info('SKIP_FORMAT', msg.success(`Configuration up-to-date.`));
@@ -356,8 +356,8 @@ export async function add(names: string[], { flags }: AddOptions) {
msg.success(
`Added the following integration${
integrations.length === 1 ? '' : 's'
- } to your project:\n${list}`
- )
+ } to your project:\n${list}`,
+ ),
);
}
}
@@ -371,13 +371,13 @@ export async function add(names: string[], { flags }: AddOptions) {
case UpdateResult.cancelled: {
logger.info(
'SKIP_FORMAT',
- msg.cancelled(`Your TypeScript configuration has ${bold('NOT')} been updated.`)
+ msg.cancelled(`Your TypeScript configuration has ${bold('NOT')} been updated.`),
);
break;
}
case UpdateResult.failure: {
throw new Error(
- `Unknown error parsing tsconfig.json or jsconfig.json. Could not update TypeScript settings.`
+ `Unknown error parsing tsconfig.json or jsconfig.json. Could not update TypeScript settings.`,
);
}
default:
@@ -386,7 +386,7 @@ export async function add(names: string[], { flags }: AddOptions) {
}
function isAdapter(
- integration: IntegrationInfo
+ integration: IntegrationInfo,
): integration is IntegrationInfo & { type: 'adapter' } {
return integration.type === 'adapter';
}
@@ -445,8 +445,8 @@ async function addIntegration(ast: t.File, integration: IntegrationInfo) {
ast,
t.importDeclaration(
[t.importDefaultSpecifier(integrationId)],
- t.stringLiteral(integration.packageName)
- )
+ t.stringLiteral(integration.packageName),
+ ),
);
visit(ast, {
@@ -472,7 +472,7 @@ async function addIntegration(ast: t.File, integration: IntegrationInfo) {
if (!integrationsProp) {
configObject.properties.push(
- t.objectProperty(t.identifier('integrations'), t.arrayExpression([integrationCall]))
+ t.objectProperty(t.identifier('integrations'), t.arrayExpression([integrationCall])),
);
return;
}
@@ -484,7 +484,7 @@ async function addIntegration(ast: t.File, integration: IntegrationInfo) {
(expr) =>
t.isCallExpression(expr) &&
t.isIdentifier(expr.callee) &&
- expr.callee.name === integrationId.name
+ expr.callee.name === integrationId.name,
);
if (existingIntegrationCall) return;
@@ -499,7 +499,7 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str
ensureImport(
ast,
- t.importDeclaration([t.importDefaultSpecifier(adapterId)], t.stringLiteral(exportName))
+ t.importDeclaration([t.importDefaultSpecifier(adapterId)], t.stringLiteral(exportName)),
);
visit(ast, {
@@ -523,7 +523,7 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str
if (!outputProp) {
configObject.properties.push(
- t.objectProperty(t.identifier('output'), t.stringLiteral('server'))
+ t.objectProperty(t.identifier('output'), t.stringLiteral('server')),
);
}
@@ -610,7 +610,7 @@ async function updateAstroConfig({
logger.info(
'SKIP_FORMAT',
- `\n ${magenta('Astro will make the following changes to your config file:')}\n${message}`
+ `\n ${magenta('Astro will make the following changes to your config file:')}\n${message}`,
);
if (logAdapterInstructions) {
@@ -618,9 +618,9 @@ async function updateAstroConfig({
'SKIP_FORMAT',
magenta(
` For complete deployment options, visit\n ${bold(
- 'https://docs.astro.build/en/guides/deploy/'
- )}\n`
- )
+ 'https://docs.astro.build/en/guides/deploy/',
+ )}\n`,
+ ),
);
}
@@ -669,7 +669,7 @@ async function getInstallIntegrationsCommand({
}
async function convertIntegrationsToInstallSpecifiers(
- integrations: IntegrationInfo[]
+ integrations: IntegrationInfo[],
): Promise<string[]> {
const ranges: Record<string, string> = {};
for (let { packageName, dependencies } of integrations) {
@@ -679,7 +679,7 @@ async function convertIntegrationsToInstallSpecifiers(
}
}
return Promise.all(
- Object.entries(ranges).map(([name, range]) => resolveRangeToInstallSpecifier(name, range))
+ Object.entries(ranges).map(([name, range]) => resolveRangeToInstallSpecifier(name, range)),
);
}
@@ -749,8 +749,8 @@ async function tryToInstallIntegrations({
logger.info(
'SKIP_FORMAT',
`\n ${magenta('Astro will run the following command:')}\n ${dim(
- 'If you skip this step, you can always run it yourself later'
- )}\n${message}`
+ 'If you skip this step, you can always run it yourself later',
+ )}\n${message}`,
);
if (await askToContinue({ flags })) {
@@ -768,7 +768,7 @@ async function tryToInstallIntegrations({
cwd,
// reset NODE_ENV to ensure install command run in dev mode
env: { NODE_ENV: undefined },
- }
+ },
);
spinner.succeed();
return UpdateResult.updated;
@@ -817,8 +817,8 @@ async function validateIntegrations(integrations: string[]): Promise<Integration
if (!response.askToContinue) {
throw new Error(
`No problem! Find our official integrations at ${cyan(
- 'https://astro.build/integrations'
- )}`
+ 'https://astro.build/integrations',
+ )}`,
);
}
spinner.start('Resolving with third party packages...');
@@ -867,15 +867,15 @@ async function validateIntegrations(integrations: string[]): Promise<Integration
} else {
throw new Error(
`${bold(
- packageName
+ packageName,
)} doesn't appear to be an integration or an adapter. Find our official integrations at ${cyan(
- 'https://astro.build/integrations'
- )}`
+ 'https://astro.build/integrations',
+ )}`,
);
}
return { id: integration, packageName, dependencies, type: integrationType };
- })
+ }),
);
spinner.succeed();
return integrationEntries;
@@ -893,13 +893,13 @@ async function updateTSConfig(
cwd = process.cwd(),
logger: Logger,
integrationsInfo: IntegrationInfo[],
- flags: yargs.Arguments
+ flags: yargs.Arguments,
): Promise<UpdateResult> {
const integrations = integrationsInfo.map(
- (integration) => integration.id as frameworkWithTSSettings
+ (integration) => integration.id as frameworkWithTSSettings,
);
const firstIntegrationWithTSSettings = integrations.find((integration) =>
- presets.has(integration)
+ presets.has(integration),
);
if (!firstIntegrationWithTSSettings) {
@@ -926,7 +926,7 @@ async function updateTSConfig(
const outputConfig = updateTSConfigForFramework(
inputConfig.rawConfig,
- firstIntegrationWithTSSettings
+ firstIntegrationWithTSSettings,
);
const output = JSON.stringify(outputConfig, null, 2);
@@ -945,7 +945,7 @@ async function updateTSConfig(
logger.info(
'SKIP_FORMAT',
- `\n ${magenta(`Astro will make the following changes to your ${configFileName}:`)}\n${message}`
+ `\n ${magenta(`Astro will make the following changes to your ${configFileName}:`)}\n${message}`,
);
// Every major framework, apart from Vue and Svelte requires different `jsxImportSource`, as such it's impossible to config
@@ -961,11 +961,11 @@ async function updateTSConfig(
'SKIP_FORMAT',
red(
` ${bold(
- 'Caution:'
+ 'Caution:',
)} Selected UI frameworks require conflicting tsconfig.json settings, as such only settings for ${bold(
- firstIntegrationWithTSSettings
- )} were used.\n More information: https://docs.astro.build/en/guides/typescript/#errors-typing-multiple-jsx-frameworks-at-the-same-time\n`
- )
+ firstIntegrationWithTSSettings,
+ )} were used.\n More information: https://docs.astro.build/en/guides/typescript/#errors-typing-multiple-jsx-frameworks-at-the-same-time\n`,
+ ),
);
}
@@ -1046,7 +1046,7 @@ async function setupIntegrationConfig(opts: {
}) {
const logger = opts.logger;
const possibleConfigFiles = opts.possibleConfigFiles.map((p) =>
- fileURLToPath(new URL(p, opts.root))
+ fileURLToPath(new URL(p, opts.root)),
);
let alreadyConfigured = false;
for (const possibleConfigPath of possibleConfigFiles) {
@@ -1058,7 +1058,7 @@ async function setupIntegrationConfig(opts: {
if (!alreadyConfigured) {
logger.info(
'SKIP_FORMAT',
- `\n ${magenta(`Astro will generate a minimal ${bold(opts.defaultConfigFile)} file.`)}\n`
+ `\n ${magenta(`Astro will generate a minimal ${bold(opts.defaultConfigFile)} file.`)}\n`,
);
if (await askToContinue({ flags: opts.flags })) {
await fs.writeFile(
@@ -1066,7 +1066,7 @@ async function setupIntegrationConfig(opts: {
opts.defaultConfigContent,
{
encoding: 'utf-8',
- }
+ },
);
logger.debug('add', `Generated default ${opts.defaultConfigFile} file`);
}
diff --git a/packages/astro/src/cli/check/index.ts b/packages/astro/src/cli/check/index.ts
index 00bc3d11a..a95e1074a 100644
--- a/packages/astro/src/cli/check/index.ts
+++ b/packages/astro/src/cli/check/index.ts
@@ -12,14 +12,14 @@ export async function check(flags: Arguments) {
'@astrojs/check',
logger,
getPackageOpts,
- ['typescript']
+ ['typescript'],
);
const typescript = await getPackage('typescript', logger, getPackageOpts);
if (!checkPackage || !typescript) {
logger.error(
'check',
- 'The `@astrojs/check` and `typescript` packages are required for this command to work. Please manually install them into your project and try again.'
+ 'The `@astrojs/check` and `typescript` packages are required for this command to work. Please manually install them into your project and try again.',
);
return;
}
diff --git a/packages/astro/src/cli/db/index.ts b/packages/astro/src/cli/db/index.ts
index d7ac76efe..dc6da36e1 100644
--- a/packages/astro/src/cli/db/index.ts
+++ b/packages/astro/src/cli/db/index.ts
@@ -18,7 +18,7 @@ export async function db({ flags }: { flags: Arguments }) {
if (!dbPackage) {
logger.error(
'check',
- 'The `@astrojs/db` package is required for this command to work. Please manually install it in your project and try again.'
+ 'The `@astrojs/db` package is required for this command to work. Please manually install it in your project and try again.',
);
return;
}
diff --git a/packages/astro/src/cli/dev/index.ts b/packages/astro/src/cli/dev/index.ts
index 5db47fb97..531cddde4 100644
--- a/packages/astro/src/cli/dev/index.ts
+++ b/packages/astro/src/cli/dev/index.ts
@@ -23,7 +23,7 @@ export async function dev({ flags }: DevOptions) {
],
},
description: `Check ${cyan(
- 'https://docs.astro.build/en/reference/cli-reference/#astro-dev'
+ 'https://docs.astro.build/en/reference/cli-reference/#astro-dev',
)} for more information.`,
});
return;
diff --git a/packages/astro/src/cli/docs/open.ts b/packages/astro/src/cli/docs/open.ts
index 1227ebff4..3913ccec4 100644
--- a/packages/astro/src/cli/docs/open.ts
+++ b/packages/astro/src/cli/docs/open.ts
@@ -21,7 +21,7 @@ const getPlatformSpecificCommand = (): [string] | [string, string[]] => {
return ['/ide/bin/remote-cli/gitpod-code', ['--openExternal']];
default:
throw new Error(
- `It looks like your platform ("${platform}") isn't supported!\nTo view Astro's docs, please visit https://docs.astro.build`
+ `It looks like your platform ("${platform}") isn't supported!\nTo view Astro's docs, please visit https://docs.astro.build`,
);
}
};
diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts
index 8a253f437..cb61e45bf 100644
--- a/packages/astro/src/cli/info/index.ts
+++ b/packages/astro/src/cli/info/index.ts
@@ -93,7 +93,7 @@ async function copyToClipboard(text: string) {
});
} catch {
console.error(
- colors.red(`\nSorry, something went wrong!`) + ` Please copy the text above manually.`
+ colors.red(`\nSorry, something went wrong!`) + ` Please copy the text above manually.`,
);
}
}
diff --git a/packages/astro/src/cli/install-package.ts b/packages/astro/src/cli/install-package.ts
index 46dfac4a3..637390ef3 100644
--- a/packages/astro/src/cli/install-package.ts
+++ b/packages/astro/src/cli/install-package.ts
@@ -21,7 +21,7 @@ export async function getPackage<T>(
packageName: string,
logger: Logger,
options: GetPackageOptions,
- otherDeps: string[] = []
+ otherDeps: string[] = [],
): Promise<T | undefined> {
try {
// Try to resolve with `createRequire` first to prevent ESM caching of the package
@@ -32,7 +32,7 @@ export async function getPackage<T>(
} catch {
if (options.optional) return undefined;
let message = `To continue, Astro requires the following dependency to be installed: ${bold(
- packageName
+ packageName,
)}.`;
if (ci.isCI) {
@@ -98,7 +98,7 @@ export async function getExecCommand(packageManager?: string): Promise<string> {
async function installPackage(
packageNames: string[],
options: GetPackageOptions,
- logger: Logger
+ logger: Logger,
): Promise<boolean> {
const cwd = options.cwd ?? process.cwd();
const packageManager = (await whichPm(cwd))?.name ?? 'npm';
@@ -120,8 +120,8 @@ async function installPackage(
logger.info(
'SKIP_FORMAT',
`\n ${magenta('Astro will run the following command:')}\n ${dim(
- 'If you skip this step, you can always run it yourself later'
- )}\n${message}`
+ 'If you skip this step, you can always run it yourself later',
+ )}\n${message}`,
);
let response;
@@ -144,7 +144,7 @@ async function installPackage(
await execa(
installCommand.pm,
[installCommand.command, ...installCommand.flags, ...installCommand.dependencies],
- { cwd: cwd }
+ { cwd: cwd },
);
spinner.succeed();
@@ -163,7 +163,7 @@ async function installPackage(
export async function fetchPackageJson(
scope: string | undefined,
name: string,
- tag: string
+ tag: string,
): Promise<Record<string, any> | Error> {
const packageName = `${scope ? `${scope}/` : ''}${name}`;
const registry = await getRegistry();
diff --git a/packages/astro/src/cli/preferences/index.ts b/packages/astro/src/cli/preferences/index.ts
index aa63690da..5735a9b6c 100644
--- a/packages/astro/src/cli/preferences/index.ts
+++ b/packages/astro/src/cli/preferences/index.ts
@@ -43,7 +43,7 @@ export async function preferences(
subcommand: string,
key: string,
value: string | undefined,
- { flags }: PreferencesOptions
+ { flags }: PreferencesOptions,
): Promise<number> {
applyPolyfill();
if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) {
@@ -98,8 +98,8 @@ export async function preferences(
console.error(
msg.formatErrorMessage(
collectErrorMetadata(new Error(`Please provide a ${type} value for "${key}"`)),
- true
- )
+ true,
+ ),
);
return 1;
}
@@ -128,7 +128,7 @@ interface SubcommandOptions {
async function getPreference(
settings: AstroSettings,
key: PreferenceKey,
- { location = 'project' }: SubcommandOptions
+ { location = 'project' }: SubcommandOptions,
) {
try {
let value = await settings.preferences.get(key, { location });
@@ -155,7 +155,7 @@ async function setPreference(
settings: AstroSettings,
key: PreferenceKey,
value: unknown,
- { location }: SubcommandOptions
+ { location }: SubcommandOptions,
) {
try {
const defaultType = typeof dlv(DEFAULT_PREFERENCES, key);
@@ -178,7 +178,7 @@ async function setPreference(
async function enablePreference(
settings: AstroSettings,
key: PreferenceKey,
- { location }: SubcommandOptions
+ { location }: SubcommandOptions,
) {
try {
await settings.preferences.set(key, true, { location });
@@ -191,7 +191,7 @@ async function enablePreference(
async function disablePreference(
settings: AstroSettings,
key: PreferenceKey,
- { location }: SubcommandOptions
+ { location }: SubcommandOptions,
) {
try {
await settings.preferences.set(key, false, { location });
@@ -204,7 +204,7 @@ async function disablePreference(
async function resetPreference(
settings: AstroSettings,
key: PreferenceKey,
- { location }: SubcommandOptions
+ { location }: SubcommandOptions,
) {
try {
await settings.preferences.set(key, undefined as any, { location });
@@ -216,13 +216,13 @@ async function resetPreference(
function annotate(flat: Record<string, any>, annotation: string) {
return Object.fromEntries(
- Object.entries(flat).map(([key, value]) => [key, { annotation, value }])
+ Object.entries(flat).map(([key, value]) => [key, { annotation, value }]),
);
}
function userValues(
flatDefault: Record<string, string | number | boolean>,
flatProject: Record<string, string | number | boolean>,
- flatGlobal: Record<string, string | number | boolean>
+ flatGlobal: Record<string, string | number | boolean>,
) {
const result: AnnotatedValues = {};
for (const key of Object.keys(flatDefault)) {
@@ -289,8 +289,8 @@ async function listPreferences(settings: AstroSettings, { location, json }: Subc
) {
console.log(
yellow(
- 'The dev toolbar is currently disabled. To enable it, set devToolbar: {enabled: true} in your astroConfig file.'
- )
+ 'The dev toolbar is currently disabled. To enable it, set devToolbar: {enabled: true} in your astroConfig file.',
+ ),
);
}
@@ -327,7 +327,7 @@ function annotatedFormat(mv: AnnotatedValue) {
// this is the real formatting for annotated values
function formatAnnotated(
mv: AnnotatedValue,
- style: (value: string | number | boolean) => string = (v) => v.toString()
+ style: (value: string | number | boolean) => string = (v) => v.toString(),
) {
return mv.annotation ? `${style(mv.value)} ${dim(mv.annotation)}` : style(mv.value);
}
@@ -339,28 +339,28 @@ function formatTable(object: Record<string, AnnotatedValue>, columnLabels: [stri
i: number,
a: string,
b: AnnotatedValue,
- style: (value: string | number | boolean) => string = (v) => v.toString()
+ style: (value: string | number | boolean) => string = (v) => v.toString(),
): string {
return `${dim(chars.v)} ${style(a)} ${space(colALength - a.length - 2)} ${dim(
- chars.v
+ chars.v,
)} ${formatAnnotated(b, style)} ${space(colBLength - annotatedFormat(b).length - 3)} ${dim(
- chars.v
+ chars.v,
)}`;
}
const top = dim(
`${chars.topLeft}${chars.h.repeat(colALength + 1)}${chars.hBottom}${chars.h.repeat(
- colBLength
- )}${chars.topRight}`
+ colBLength,
+ )}${chars.topRight}`,
);
const bottom = dim(
`${chars.bottomLeft}${chars.h.repeat(colALength + 1)}${chars.hTop}${chars.h.repeat(
- colBLength
- )}${chars.bottomRight}`
+ colBLength,
+ )}${chars.bottomRight}`,
);
const divider = dim(
`${chars.vRightThick}${chars.hThick.repeat(colALength + 1)}${
chars.hThickCross
- }${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`
+ }${chars.hThick.repeat(colBLength)}${chars.vLeftThick}`,
);
const rows: string[] = [top, formatRow(-1, colA, { value: colB, annotation: '' }, bold), divider];
let i = 0;
diff --git a/packages/astro/src/cli/preview/index.ts b/packages/astro/src/cli/preview/index.ts
index 0d569e2fb..387c1f241 100644
--- a/packages/astro/src/cli/preview/index.ts
+++ b/packages/astro/src/cli/preview/index.ts
@@ -23,7 +23,7 @@ export async function preview({ flags }: PreviewOptions) {
],
},
description: `Starts a local server to serve your static dist/ directory. Check ${cyan(
- 'https://docs.astro.build/en/reference/cli-reference/#astro-preview'
+ 'https://docs.astro.build/en/reference/cli-reference/#astro-preview',
)} for more information.`,
});
return;
diff --git a/packages/astro/src/config/index.ts b/packages/astro/src/config/index.ts
index fb97288a6..3c5faf2fa 100644
--- a/packages/astro/src/config/index.ts
+++ b/packages/astro/src/config/index.ts
@@ -8,7 +8,7 @@ export function defineConfig(config: AstroUserConfig) {
export function getViteConfig(
userViteConfig: ViteUserConfig,
- inlineAstroConfig: AstroInlineConfig = {}
+ inlineAstroConfig: AstroInlineConfig = {},
) {
// Return an async Vite config getter which exposes a resolved `mode` and `command`
return async ({ mode, command }: { mode: string; command: 'serve' | 'build' }) => {
@@ -48,7 +48,7 @@ export function getViteConfig(
astroContentListenPlugin({ settings, logger, fs }),
],
},
- { settings, logger, mode, sync: false }
+ { settings, logger, mode, sync: false },
);
await runHookConfigDone({ settings, logger });
return mergeConfig(viteConfig, userViteConfig);
diff --git a/packages/astro/src/container/index.ts b/packages/astro/src/container/index.ts
index d17ec7846..292b49ece 100644
--- a/packages/astro/src/container/index.ts
+++ b/packages/astro/src/container/index.ts
@@ -105,7 +105,7 @@ export type AddClientRenderer = {
function createManifest(
manifest?: AstroContainerManifest,
renderers?: SSRLoadedRenderer[],
- middleware?: MiddlewareHandler
+ middleware?: MiddlewareHandler,
): SSRManifest {
const defaultMiddleware: MiddlewareHandler = (_, next) => {
return next();
@@ -274,7 +274,7 @@ export class experimental_AstroContainer {
* @param {AstroContainerOptions=} containerOptions
*/
public static async create(
- containerOptions: AstroContainerOptions = {}
+ containerOptions: AstroContainerOptions = {},
): Promise<experimental_AstroContainer> {
const { streaming = false, manifest, renderers = [], resolve } = containerOptions;
const astroConfig = await validateConfig(ASTRO_CONFIG_DEFAULTS, process.cwd(), 'container');
@@ -315,7 +315,7 @@ export class experimental_AstroContainer {
if (!renderer.check || !renderer.renderToStaticMarkup) {
throw new Error(
"The renderer you passed isn't valid. A renderer is usually an object that exposes the `check` and `renderToStaticMarkup` functions.\n" +
- "Usually, the renderer is exported by a /server.js entrypoint e.g. `import renderer from '@astrojs/react/server.js'`"
+ "Usually, the renderer is exported by a /server.js entrypoint e.g. `import renderer from '@astrojs/react/server.js'`",
);
}
if (isNamedRenderer(renderer)) {
@@ -362,7 +362,7 @@ export class experimental_AstroContainer {
throw new Error(
'You tried to add the ' +
name +
- " client renderer, but its server renderer wasn't added. You must add the server renderer first. Use the `addServerRenderer` function."
+ " client renderer, but its server renderer wasn't added. You must add the server renderer first. Use the `addServerRenderer` function.",
);
}
const renderer = this.#pipeline.manifest.renderers[rendererIndex];
@@ -374,7 +374,7 @@ export class experimental_AstroContainer {
// NOTE: we keep this private via TS instead via `#` so it's still available on the surface, so we can play with it.
// @ematipico: I plan to use it for a possible integration that could help people
private static async createFromManifest(
- manifest: SSRManifest
+ manifest: SSRManifest,
): Promise<experimental_AstroContainer> {
const astroConfig = await validateConfig(ASTRO_CONFIG_DEFAULTS, process.cwd(), 'container');
const container = new experimental_AstroContainer({
@@ -431,7 +431,7 @@ export class experimental_AstroContainer {
*/
public async renderToString(
component: AstroComponentFactory,
- options: ContainerRenderOptions = {}
+ options: ContainerRenderOptions = {},
): Promise<string> {
const response = await this.renderToResponse(component, options);
return await response.text();
@@ -458,7 +458,7 @@ export class experimental_AstroContainer {
*/
public async renderToResponse(
component: AstroComponentFactory,
- options: ContainerRenderOptions = {}
+ options: ContainerRenderOptions = {},
): Promise<Response> {
const { routeType = 'page', slots } = options;
const request = options?.request ?? new Request('https://example.com/');
@@ -510,7 +510,7 @@ export class experimental_AstroContainer {
pattern: getPattern(
segments,
ASTRO_CONFIG_DEFAULTS.base,
- ASTRO_CONFIG_DEFAULTS.trailingSlash
+ ASTRO_CONFIG_DEFAULTS.trailingSlash,
),
prerender: false,
segments,
@@ -528,7 +528,7 @@ export class experimental_AstroContainer {
*/
#wrapComponent(
componentFactory: AstroComponentFactory,
- params?: Record<string, string | undefined>
+ params?: Record<string, string | undefined>,
): ComponentInstance {
if (params) {
return {
diff --git a/packages/astro/src/container/pipeline.ts b/packages/astro/src/container/pipeline.ts
index 1ad905bb5..ff2718b8f 100644
--- a/packages/astro/src/container/pipeline.ts
+++ b/packages/astro/src/container/pipeline.ts
@@ -41,7 +41,7 @@ export class ContainerPipeline extends Pipeline {
renderers,
resolve,
serverLike,
- streaming
+ streaming,
);
}
@@ -70,7 +70,7 @@ export class ContainerPipeline extends Pipeline {
async tryRewrite(
payload: RewritePayload,
- request: Request
+ request: Request,
): Promise<[RouteData, ComponentInstance, URL]> {
const [foundRoute, finalUrl] = findRouteToRewrite({
payload,
diff --git a/packages/astro/src/content/runtime-assets.ts b/packages/astro/src/content/runtime-assets.ts
index 42969042c..95b5092fe 100644
--- a/packages/astro/src/content/runtime-assets.ts
+++ b/packages/astro/src/content/runtime-assets.ts
@@ -6,7 +6,7 @@ import { emitESMImage } from '../assets/utils/node/emitAsset.js';
export function createImage(
pluginContext: PluginContext,
shouldEmitFile: boolean,
- entryFilePath: string
+ entryFilePath: string,
) {
return () => {
return z.string().transform(async (imagePath, ctx) => {
@@ -14,7 +14,7 @@ export function createImage(
const metadata = (await emitESMImage(
resolvedFilePath,
pluginContext.meta.watchMode,
- shouldEmitFile ? pluginContext.emitFile : undefined
+ shouldEmitFile ? pluginContext.emitFile : undefined,
)) as OmitBrand<ImageMetadata>;
if (!metadata) {
diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts
index 6fd017c85..34d2f10e9 100644
--- a/packages/astro/src/content/runtime.ts
+++ b/packages/astro/src/content/runtime.ts
@@ -65,15 +65,15 @@ export function createGetCollection({
// eslint-disable-next-line no-console
console.warn(
`The collection ${JSON.stringify(
- collection
- )} does not exist or is empty. Ensure a collection directory with this name exists.`
+ collection,
+ )} does not exist or is empty. Ensure a collection directory with this name exists.`,
);
return [];
}
const lazyImports = Object.values(
type === 'content'
? contentCollectionToEntryMap[collection]
- : dataCollectionToEntryMap[collection]
+ : dataCollectionToEntryMap[collection],
);
let entries: any[] = [];
// Cache `getCollection()` calls in production only
@@ -106,8 +106,8 @@ export function createGetCollection({
collection: entry.collection,
data: entry.data,
};
- })
- )
+ }),
+ ),
);
cacheEntriesByCollection.set(collection, entries);
}
@@ -196,7 +196,7 @@ export function createGetEntry({
// Or pass a single object with the collection and identifier as properties.
// This means the first positional arg can have different shapes.
collectionOrLookupObject: string | EntryLookupObject,
- _lookupId?: string
+ _lookupId?: string,
): Promise<ContentEntryResult | DataEntryResult | undefined> {
let collection: string, lookupId: string;
if (typeof collectionOrLookupObject === 'string') {
@@ -249,7 +249,7 @@ export function createGetEntry({
export function createGetEntries(getEntry: ReturnType<typeof createGetEntry>) {
return async function getEntries(
- entries: { collection: string; id: string }[] | { collection: string; slug: string }[]
+ entries: { collection: string; id: string }[] | { collection: string; slug: string }[],
) {
return Promise.all(entries.map((e) => getEntry(e)));
};
@@ -332,8 +332,8 @@ async function render({
'Content',
propagationMod.Content,
props,
- slots
- )}`
+ slots,
+ )}`,
);
},
propagation: 'self',
@@ -374,7 +374,7 @@ export function createReference({ lookupMap }: { lookupMap: ContentLookupMap })
ctx.addIssue({
code: ZodIssueCode.custom,
message: `**${flattenedErrorPath}**: Reference to ${collection} invalid. Expected ${Object.keys(
- entries
+ entries,
)
.map((c) => JSON.stringify(c))
.join(' | ')}. Received ${JSON.stringify(lookupId)}.`,
diff --git a/packages/astro/src/content/server-listeners.ts b/packages/astro/src/content/server-listeners.ts
index 590d6f8c1..5d7868d58 100644
--- a/packages/astro/src/content/server-listeners.ts
+++ b/packages/astro/src/content/server-listeners.ts
@@ -29,8 +29,8 @@ export async function attachContentServerListeners({
logger.debug(
'content',
`Watching ${cyan(
- contentPaths.contentDir.href.replace(settings.config.root.href, '')
- )} for changes`
+ contentPaths.contentDir.href.replace(settings.config.root.href, ''),
+ )} for changes`,
);
const maybeTsConfigStats = await getTSConfigStatsWhenAllowJsFalse({ contentPaths, settings });
if (maybeTsConfigStats) warnAllowJsIsFalse({ ...maybeTsConfigStats, logger });
@@ -61,16 +61,16 @@ export async function attachContentServerListeners({
contentGenerator.queueEvent({ name: 'add', entry });
});
viteServer.watcher.on('addDir', (entry) =>
- contentGenerator.queueEvent({ name: 'addDir', entry })
+ contentGenerator.queueEvent({ name: 'addDir', entry }),
);
viteServer.watcher.on('change', (entry) =>
- contentGenerator.queueEvent({ name: 'change', entry })
+ contentGenerator.queueEvent({ name: 'change', entry }),
);
viteServer.watcher.on('unlink', (entry) => {
contentGenerator.queueEvent({ name: 'unlink', entry });
});
viteServer.watcher.on('unlinkDir', (entry) =>
- contentGenerator.queueEvent({ name: 'unlinkDir', entry })
+ contentGenerator.queueEvent({ name: 'unlinkDir', entry }),
);
}
}
@@ -87,12 +87,12 @@ function warnAllowJsIsFalse({
logger.warn(
'content',
`Make sure you have the ${bold('allowJs')} compiler option set to ${bold(
- 'true'
+ 'true',
)} in your ${bold(tsConfigFileName)} file to have autocompletion in your ${bold(
- contentConfigFileName
+ contentConfigFileName,
)} file. See ${underline(
- cyan('https://www.typescriptlang.org/tsconfig#allowJs')
- )} for more information.`
+ cyan('https://www.typescriptlang.org/tsconfig#allowJs'),
+ )} for more information.`,
);
}
@@ -104,7 +104,7 @@ async function getTSConfigStatsWhenAllowJsFalse({
settings: AstroSettings;
}) {
const isContentConfigJsFile = ['.js', '.mjs'].some((ext) =>
- contentPaths.config.url.pathname.endsWith(ext)
+ contentPaths.config.url.pathname.endsWith(ext),
);
if (!isContentConfigJsFile) return;
diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts
index 3a646154d..ea0c3cc80 100644
--- a/packages/astro/src/content/types-generator.ts
+++ b/packages/astro/src/content/types-generator.ts
@@ -112,7 +112,7 @@ export async function createContentTypesGenerator({
async function handleEvent(event: ContentEvent): Promise<{ shouldGenerateTypes: boolean }> {
if (event.name === 'addDir' || event.name === 'unlinkDir') {
const collection = normalizePath(
- path.relative(fileURLToPath(contentPaths.contentDir), fileURLToPath(event.entry))
+ path.relative(fileURLToPath(contentPaths.contentDir), fileURLToPath(event.entry)),
);
const collectionKey = JSON.stringify(collection);
// If directory is multiple levels deep, it is not a collection. Ignore event.
@@ -137,7 +137,7 @@ export async function createContentTypesGenerator({
fileURLToPath(event.entry),
contentPaths,
contentEntryExts,
- dataEntryExts
+ dataEntryExts,
);
if (fileType === 'ignored') {
return { shouldGenerateTypes: false };
@@ -156,9 +156,9 @@ export async function createContentTypesGenerator({
'content',
`${bold(
normalizePath(
- path.relative(fileURLToPath(contentPaths.contentDir), fileURLToPath(event.entry))
- )
- )} must live in a ${bold('content/...')} collection subdirectory.`
+ path.relative(fileURLToPath(contentPaths.contentDir), fileURLToPath(event.entry)),
+ ),
+ )} must live in a ${bold('content/...')} collection subdirectory.`,
);
return { shouldGenerateTypes: false };
}
@@ -406,7 +406,7 @@ async function writeContentFiles({
message: AstroErrorData.ContentCollectionTypeMismatchError.message(
collectionKey,
collection.type,
- collectionConfig.type
+ collectionConfig.type,
),
hint:
collection.type === 'data'
@@ -438,7 +438,7 @@ async function writeContentFiles({
for (const entryKey of collectionEntryKeys) {
const entryMetadata = collection.entries[entryKey];
const renderType = `{ render(): Render[${JSON.stringify(
- path.extname(JSON.parse(entryKey))
+ path.extname(JSON.parse(entryKey)),
)}] }`;
const slugType = JSON.stringify(entryMetadata.slug);
@@ -479,14 +479,14 @@ async function writeContentFiles({
dateStrategy: ['format:date-time', 'format:date', 'integer'],
}),
null,
- 2
- )
+ 2,
+ ),
);
} catch (err) {
// This should error gracefully and not crash the dev server
logger.warn(
'content',
- `An error was encountered while creating the JSON schema for the ${collectionKey} collection. Proceeding without it. Error: ${err}`
+ `An error was encountered while creating the JSON schema for the ${collectionKey} collection. Proceeding without it. Error: ${err}`,
);
}
}
@@ -500,7 +500,7 @@ async function writeContentFiles({
const configPathRelativeToCacheDir = normalizeConfigPath(
settings.dotAstroDir.pathname,
- contentPaths.config.url.pathname
+ contentPaths.config.url.pathname,
);
for (const contentEntryType of contentEntryTypes) {
@@ -512,11 +512,11 @@ async function writeContentFiles({
typeTemplateContent = typeTemplateContent.replace('// @@DATA_ENTRY_MAP@@', dataTypesStr);
typeTemplateContent = typeTemplateContent.replace(
"'@@CONTENT_CONFIG_TYPE@@'",
- contentConfig ? `typeof import(${configPathRelativeToCacheDir})` : 'never'
+ contentConfig ? `typeof import(${configPathRelativeToCacheDir})` : 'never',
);
await fs.promises.writeFile(
new URL(CONTENT_TYPES_FILE, settings.dotAstroDir),
- typeTemplateContent
+ typeTemplateContent,
);
}
diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts
index a38aee0d1..ce6dc63ca 100644
--- a/packages/astro/src/content/utils.ts
+++ b/packages/astro/src/content/utils.ts
@@ -76,7 +76,7 @@ export async function getEntryData(
},
collectionConfig: CollectionConfig,
shouldEmitFile: boolean,
- pluginContext: PluginContext
+ pluginContext: PluginContext,
) {
let data;
if (collectionConfig.type === 'data') {
@@ -127,7 +127,7 @@ export async function getEntryData(
message: AstroErrorData.InvalidContentEntryFrontmatterError.message(
entry.collection,
entry.id,
- parsed.error
+ parsed.error,
),
location: {
file: entry._internal.filePath,
@@ -151,7 +151,7 @@ export function getDataEntryExts(settings: Pick<AstroSettings, 'dataEntryTypes'>
}
export function getEntryConfigByExtMap<TEntryType extends ContentEntryType | DataEntryType>(
- entryTypes: TEntryType[]
+ entryTypes: TEntryType[],
): Map<string, TEntryType> {
const map = new Map<string, TEntryType>();
for (const entryType of entryTypes) {
@@ -248,7 +248,7 @@ export function getDataEntryId({
const relativePath = getRelativeEntryPath(entry, collection, contentDir);
const withoutFileExt = normalizePath(relativePath).replace(
new RegExp(path.extname(relativePath) + '$'),
- ''
+ '',
);
return withoutFileExt;
@@ -290,7 +290,7 @@ export function getEntryType(
entryPath: string,
paths: Pick<ContentPaths, 'config' | 'contentDir'>,
contentFileExts: string[],
- dataFileExts: string[]
+ dataFileExts: string[],
): 'content' | 'data' | 'config' | 'ignored' {
const { ext } = path.parse(entryPath);
const fileUrl = pathToFileURL(entryPath);
@@ -310,7 +310,7 @@ export function getEntryType(
function hasUnderscoreBelowContentDirectoryPath(
fileUrl: URL,
- contentDir: ContentPaths['contentDir']
+ contentDir: ContentPaths['contentDir'],
): boolean {
const parts = fileUrl.pathname.replace(contentDir.pathname, '').split('/');
for (const part of parts) {
@@ -324,7 +324,7 @@ function getYAMLErrorLine(rawData: string | undefined, objectKey: string) {
const indexOfObjectKey = rawData.search(
// Match key either at the top of the file or after a newline
// Ensures matching on top-level object keys only
- new RegExp(`(\n|^)${objectKey}`)
+ new RegExp(`(\n|^)${objectKey}`),
);
if (indexOfObjectKey === -1) return 0;
@@ -485,7 +485,7 @@ export type ContentPaths = {
export function getContentPaths(
{ srcDir }: Pick<AstroConfig, 'root' | 'srcDir'>,
- fs: typeof fsMod = fsMod
+ fs: typeof fsMod = fsMod,
): ContentPaths {
const configStats = search(fs, srcDir);
const pkgBase = new URL('../../', import.meta.url);
@@ -499,7 +499,7 @@ export function getContentPaths(
}
function search(fs: typeof fsMod, srcDir: URL) {
const paths = ['config.mjs', 'config.js', 'config.mts', 'config.ts'].map(
- (p) => new URL(`./content/${p}`, srcDir)
+ (p) => new URL(`./content/${p}`, srcDir),
);
for (const file of paths) {
if (fs.existsSync(file)) {
diff --git a/packages/astro/src/content/vite-plugin-content-assets.ts b/packages/astro/src/content/vite-plugin-content-assets.ts
index cba907bbf..dd6dacc7c 100644
--- a/packages/astro/src/content/vite-plugin-content-assets.ts
+++ b/packages/astro/src/content/vite-plugin-content-assets.ts
@@ -77,7 +77,7 @@ export function astroContentAssetPropagationPlugin({
: await getScriptsForURL(
pathToFileURL(basePath),
settings.config.root,
- devModuleLoader
+ devModuleLoader,
);
// Register files we crawled to be able to retrieve the rendered styles and scripts,
@@ -127,7 +127,7 @@ export function astroContentAssetPropagationPlugin({
export function astroConfigBuildPlugin(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['server'],
@@ -176,7 +176,7 @@ export function astroConfigBuildPlugin(
if (entryStyles.size) {
newCode = newCode.replace(
JSON.stringify(STYLES_PLACEHOLDER),
- JSON.stringify(Array.from(entryStyles))
+ JSON.stringify(Array.from(entryStyles)),
);
} else {
newCode = newCode.replace(JSON.stringify(STYLES_PLACEHOLDER), '[]');
@@ -184,7 +184,7 @@ export function astroConfigBuildPlugin(
if (entryLinks.size) {
newCode = newCode.replace(
JSON.stringify(LINKS_PLACEHOLDER),
- JSON.stringify(Array.from(entryLinks).map(prependBase))
+ JSON.stringify(Array.from(entryLinks).map(prependBase)),
);
} else {
newCode = newCode.replace(JSON.stringify(LINKS_PLACEHOLDER), '[]');
@@ -210,8 +210,8 @@ export function astroConfigBuildPlugin(
type: 'module',
},
children: '',
- }))
- )
+ })),
+ ),
);
} else {
newCode = newCode.replace(JSON.stringify(SCRIPTS_PLACEHOLDER), '[]');
diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts
index 91f411f07..de642329a 100644
--- a/packages/astro/src/content/vite-plugin-content-imports.ts
+++ b/packages/astro/src/content/vite-plugin-content-imports.ts
@@ -39,7 +39,7 @@ import {
function getContentRendererByViteId(
viteId: string,
- settings: Pick<AstroSettings, 'contentEntryTypes'>
+ settings: Pick<AstroSettings, 'contentEntryTypes'>,
): ContentEntryType['getRenderModule'] | undefined {
let ext = viteId.split('.').pop();
if (!ext) return undefined;
@@ -215,7 +215,7 @@ type GetEntryModuleParams<TEntryType extends ContentEntryType | DataEntryType> =
};
async function getContentEntryModule(
- params: GetEntryModuleParams<ContentEntryType>
+ params: GetEntryModuleParams<ContentEntryType>,
): Promise<ContentEntryModule> {
const { fileId, contentDir, pluginContext } = params;
const { collectionConfig, entryConfig, entry, rawContents, collection } =
@@ -245,7 +245,7 @@ async function getContentEntryModule(
{ id, collection, _internal, unvalidatedData },
collectionConfig,
params.shouldEmitFile,
- pluginContext
+ pluginContext,
)
: unvalidatedData;
@@ -262,7 +262,7 @@ async function getContentEntryModule(
}
async function getDataEntryModule(
- params: GetEntryModuleParams<DataEntryType>
+ params: GetEntryModuleParams<DataEntryType>,
): Promise<DataEntryModule> {
const { fileId, contentDir, pluginContext } = params;
const { collectionConfig, entryConfig, entry, rawContents, collection } =
@@ -280,7 +280,7 @@ async function getDataEntryModule(
{ id, collection, _internal, unvalidatedData },
collectionConfig,
params.shouldEmitFile,
- pluginContext
+ pluginContext,
)
: unvalidatedData;
@@ -320,7 +320,7 @@ async function getEntryModuleBaseInfo<TEntryType extends ContentEntryType | Data
throw new AstroError({
...AstroErrorData.UnknownContentCollectionError,
message: `No parser found for data entry ${JSON.stringify(
- fileId
+ fileId,
)}. Did you apply an integration for this file type?`,
});
}
diff --git a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
index 03d13a3d7..8c5365368 100644
--- a/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
+++ b/packages/astro/src/content/vite-plugin-content-virtual-mod.ts
@@ -129,21 +129,21 @@ export async function generateContentEntryFile({
`import.meta.glob(${JSON.stringify(value)}, { query: { ${flag}: true } })`;
contentEntryGlobResult = createGlob(
globWithUnderscoresIgnored(relContentDir, contentEntryExts),
- CONTENT_FLAG
+ CONTENT_FLAG,
);
dataEntryGlobResult = createGlob(
globWithUnderscoresIgnored(relContentDir, dataEntryExts),
- DATA_FLAG
+ DATA_FLAG,
);
renderEntryGlobResult = createGlob(
globWithUnderscoresIgnored(relContentDir, contentEntryExts),
- CONTENT_RENDER_FLAG
+ CONTENT_RENDER_FLAG,
);
} else {
contentEntryGlobResult = getStringifiedCollectionFromLookup(
'content',
relContentDir,
- lookupMap
+ lookupMap,
);
dataEntryGlobResult = getStringifiedCollectionFromLookup('data', relContentDir, lookupMap);
renderEntryGlobResult = getStringifiedCollectionFromLookup('render', relContentDir, lookupMap);
@@ -168,7 +168,7 @@ console.warn('astro:content is only supported running server-side. Using it in t
function getStringifiedCollectionFromLookup(
wantedType: 'content' | 'data' | 'render',
relContentDir: string,
- lookupMap: ContentLookupMap
+ lookupMap: ContentLookupMap,
) {
let str = '{';
// In dev, we don't need to normalize the import specifier at all. Vite handles it.
@@ -226,7 +226,7 @@ export async function generateLookupMap({
absolute: true,
cwd: fileURLToPath(root),
fs,
- }
+ },
);
// Run 10 at a time to prevent `await getEntrySlug` from accessing the filesystem all at once.
@@ -276,7 +276,7 @@ export async function generateLookupMap({
collection,
slug,
lookupMap[collection].entries[slug],
- rootRelativePath(root, filePath)
+ rootRelativePath(root, filePath),
),
hint:
slug !== generatedSlug
@@ -301,7 +301,7 @@ export async function generateLookupMap({
},
};
}
- })
+ }),
);
}
diff --git a/packages/astro/src/core/app/createOutgoingHttpHeaders.ts b/packages/astro/src/core/app/createOutgoingHttpHeaders.ts
index e9cb3e1ca..64d2d5135 100644
--- a/packages/astro/src/core/app/createOutgoingHttpHeaders.ts
+++ b/packages/astro/src/core/app/createOutgoingHttpHeaders.ts
@@ -8,7 +8,7 @@ import type { OutgoingHttpHeaders } from 'node:http';
* @returns {OutgoingHttpHeaders} NodeJS OutgoingHttpHeaders object with multiple set-cookie handled as an array of values
*/
export const createOutgoingHttpHeaders = (
- headers: Headers | undefined | null
+ headers: Headers | undefined | null,
): OutgoingHttpHeaders | undefined => {
if (!headers) {
return undefined;
diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts
index 42027098f..d19a4da7d 100644
--- a/packages/astro/src/core/app/index.ts
+++ b/packages/astro/src/core/app/index.ts
@@ -95,7 +95,7 @@ export class App {
this.#pipeline = this.#createPipeline(this.#manifestData, streaming);
this.#adapterLogger = new AstroIntegrationLogger(
this.#logger.options,
- this.#manifest.adapterName
+ this.#manifest.adapterName,
);
}
@@ -114,7 +114,7 @@ export class App {
if (this.#manifest.checkOrigin) {
this.#manifest.middleware = sequence(
createOriginCheckMiddleware(),
- this.#manifest.middleware
+ this.#manifest.middleware,
);
}
@@ -209,7 +209,7 @@ export class App {
let locale;
const hostAsUrl = new URL(`${protocol}//${host}`);
for (const [domainKey, localeValue] of Object.entries(
- this.#manifest.i18n.domainLookupTable
+ this.#manifest.i18n.domainLookupTable,
)) {
// This operation should be safe because we force the protocol via zod inside the configuration
// If not, then it means that the manifest was tampered
@@ -226,7 +226,7 @@ export class App {
if (locale) {
pathname = prependForwardSlash(
- joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname))
+ joinPaths(normalizeTheLocale(locale), this.removeBase(url.pathname)),
);
if (url.pathname.endsWith('/')) {
pathname = appendForwardSlash(pathname);
@@ -235,7 +235,7 @@ export class App {
} catch (e: any) {
this.#logger.error(
'router',
- `Astro tried to parse ${protocol}//${host} as an URL, but it threw a parsing error. Check the X-Forwarded-Host and X-Forwarded-Proto headers.`
+ `Astro tried to parse ${protocol}//${host} as an URL, but it threw a parsing error. Check the X-Forwarded-Host and X-Forwarded-Proto headers.`,
);
this.#logger.error('router', `Error: ${e}`);
}
@@ -253,7 +253,7 @@ export class App {
async render(
request: Request,
routeDataOrOptions?: RouteData | RenderOptions,
- maybeLocals?: object
+ maybeLocals?: object,
): Promise<Response> {
let routeData: RouteData | undefined;
let locals: object | undefined;
@@ -290,7 +290,7 @@ export class App {
this.#logger.debug(
'router',
'The adapter ' + this.#manifest.adapterName + ' provided a custom RouteData for ',
- request.url
+ request.url,
);
this.#logger.debug('router', 'RouteData:\n' + routeData);
}
@@ -370,7 +370,7 @@ export class App {
if (this.#renderOptionsDeprecationWarningShown) return;
this.#logger.warn(
'deprecated',
- `The adapter ${this.#manifest.adapterName} is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See https://github.com/withastro/astro/pull/9199 for more information.`
+ `The adapter ${this.#manifest.adapterName} is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See https://github.com/withastro/astro/pull/9199 for more information.`,
);
this.#renderOptionsDeprecationWarningShown = true;
}
@@ -404,7 +404,7 @@ export class App {
response: originalResponse,
skipMiddleware = false,
error,
- }: RenderErrorOptions
+ }: RenderErrorOptions,
): Promise<Response> {
const errorRoutePath = `/${status}${this.#manifest.trailingSlash === 'always' ? '/' : ''}`;
const errorRouteData = matchRoute(errorRoutePath, this.#manifestData);
@@ -414,7 +414,7 @@ export class App {
const maybeDotHtml = errorRouteData.route.endsWith(`/${status}`) ? '.html' : '';
const statusURL = new URL(
`${this.#baseWithoutTrailingSlash}/${status}${maybeDotHtml}`,
- url
+ url,
);
const response = await fetch(statusURL.toString());
@@ -459,7 +459,7 @@ export class App {
#mergeResponses(
newResponse: Response,
originalResponse?: Response,
- override?: { status: 404 | 500 }
+ override?: { status: 404 | 500 },
) {
if (!originalResponse) {
if (override !== undefined) {
diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts
index 537c7f5e7..f9afa6189 100644
--- a/packages/astro/src/core/app/node.ts
+++ b/packages/astro/src/core/app/node.ts
@@ -37,7 +37,7 @@ export class NodeApp extends App {
render(
req: NodeRequest | Request,
routeDataOrOptions?: RouteData | RenderOptions,
- maybeLocals?: object
+ maybeLocals?: object,
) {
if (!(req instanceof Request)) {
req = NodeApp.createRequest(req);
@@ -120,7 +120,7 @@ export class NodeApp extends App {
// eslint-disable-next-line no-console
console.error(
`There was an uncaught error in the middle of the stream while rendering ${destination.req.url}.`,
- err
+ err,
);
});
});
diff --git a/packages/astro/src/core/app/pipeline.ts b/packages/astro/src/core/app/pipeline.ts
index 64c2fdcb8..b784ba916 100644
--- a/packages/astro/src/core/app/pipeline.ts
+++ b/packages/astro/src/core/app/pipeline.ts
@@ -36,7 +36,7 @@ export class AppPipeline extends Pipeline {
| 'serverLike'
| 'streaming'
| 'defaultRoutes'
- >
+ >,
) {
const pipeline = new AppPipeline(
logger,
@@ -55,7 +55,7 @@ export class AppPipeline extends Pipeline {
undefined,
undefined,
false,
- defaultRoutes
+ defaultRoutes,
);
pipeline.#manifestData = manifestData;
return pipeline;
@@ -93,7 +93,7 @@ export class AppPipeline extends Pipeline {
async tryRewrite(
payload: RewritePayload,
request: Request,
- _sourceRoute: RouteData
+ _sourceRoute: RouteData,
): Promise<[RouteData, ComponentInstance, URL]> {
const [foundRoute, finalUrl] = findRouteToRewrite({
payload,
@@ -125,7 +125,7 @@ export class AppPipeline extends Pipeline {
const importComponentInstance = this.manifest.pageMap.get(route.component);
if (!importComponentInstance) {
throw new Error(
- `Unexpectedly unable to find a component instance for route ${route.route}`
+ `Unexpectedly unable to find a component instance for route ${route.route}`,
);
}
return await importComponentInstance();
@@ -133,7 +133,7 @@ export class AppPipeline extends Pipeline {
return this.manifest.pageModule;
}
throw new Error(
- "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."
+ "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.",
);
}
}
diff --git a/packages/astro/src/core/base-pipeline.ts b/packages/astro/src/core/base-pipeline.ts
index b3884b841..01e18bfa0 100644
--- a/packages/astro/src/core/base-pipeline.ts
+++ b/packages/astro/src/core/base-pipeline.ts
@@ -58,13 +58,13 @@ export abstract class Pipeline {
* Array of built-in, internal, routes.
* Used to find the route module
*/
- readonly defaultRoutes = createDefaultRoutes(manifest)
+ readonly defaultRoutes = createDefaultRoutes(manifest),
) {
this.internalMiddleware = [];
// We do use our middleware only if the user isn't using the manual setup
if (i18n?.strategy !== 'manual') {
this.internalMiddleware.push(
- createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat)
+ createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat),
);
}
// In SSR, getSecret should fail by default. Setting it here will run before the
@@ -94,7 +94,7 @@ export abstract class Pipeline {
abstract tryRewrite(
rewritePayload: RewritePayload,
request: Request,
- sourceRoute: RouteData
+ sourceRoute: RouteData,
): Promise<[RouteData, ComponentInstance, URL]>;
/**
diff --git a/packages/astro/src/core/build/add-rollup-input.ts b/packages/astro/src/core/build/add-rollup-input.ts
index f45aef731..073fb5582 100644
--- a/packages/astro/src/core/build/add-rollup-input.ts
+++ b/packages/astro/src/core/build/add-rollup-input.ts
@@ -10,7 +10,7 @@ function fromEntries<V>(entries: [string, V][]) {
export function addRollupInput(
inputOptions: Rollup.InputOptions,
- newInputs: string[]
+ newInputs: string[],
): Rollup.InputOptions {
// Add input module ids to existing input option, whether it's a string, array or object
// this way you can use multiple html plugins all adding their own inputs
diff --git a/packages/astro/src/core/build/common.ts b/packages/astro/src/core/build/common.ts
index badfa561e..a479aed39 100644
--- a/packages/astro/src/core/build/common.ts
+++ b/packages/astro/src/core/build/common.ts
@@ -17,7 +17,7 @@ function getOutRoot(astroConfig: AstroConfig): URL {
export function getOutFolder(
astroConfig: AstroConfig,
pathname: string,
- routeData: RouteData
+ routeData: RouteData,
): URL {
const outRoot = getOutRoot(astroConfig);
const routeType = routeData.type;
@@ -59,7 +59,7 @@ export function getOutFile(
astroConfig: AstroConfig,
outFolder: URL,
pathname: string,
- routeData: RouteData
+ routeData: RouteData,
): URL {
const routeType = routeData.type;
switch (routeType) {
diff --git a/packages/astro/src/core/build/css-asset-name.ts b/packages/astro/src/core/build/css-asset-name.ts
index 1876c0877..fbee7f2e2 100644
--- a/packages/astro/src/core/build/css-asset-name.ts
+++ b/packages/astro/src/core/build/css-asset-name.ts
@@ -21,7 +21,7 @@ export function shortHashedName(settings: AstroSettings) {
return createNameHash(
getFirstParentId(parents),
parents.map((page) => page.id),
- settings
+ settings,
);
};
}
@@ -29,7 +29,7 @@ export function shortHashedName(settings: AstroSettings) {
export function createNameHash(
baseId: string | undefined,
hashIds: string[],
- settings: AstroSettings
+ settings: AstroSettings,
): string {
const baseName = baseId ? prettifyBaseName(npath.parse(baseId).name) : 'index';
const hash = crypto.createHash('sha256');
diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts
index e3fca6120..5897ba7e4 100644
--- a/packages/astro/src/core/build/generate.ts
+++ b/packages/astro/src/core/build/generate.ts
@@ -69,14 +69,14 @@ export async function generatePages(options: StaticBuildOptions, internals: Buil
// middleware.mjs is not emitted if there is no user middleware
// in which case the import fails with ERR_MODULE_NOT_FOUND, and we fall back to a no-op middleware
middleware = await import(new URL('middleware.mjs', baseDirectory).toString()).then(
- (mod) => mod.onRequest
+ (mod) => mod.onRequest,
);
} catch {}
manifest = createBuildManifest(
options.settings,
internals,
renderers.renderers as SSRLoadedRenderer[],
- middleware
+ middleware,
);
}
const pipeline = BuildPipeline.create({ internals, manifest, options });
@@ -118,7 +118,7 @@ export async function generatePages(options: StaticBuildOptions, internals: Buil
} else {
const ssrEntryURLPage = createEntryURL(filePath, outFolder);
throw new Error(
- `Unable to find the manifest for the module ${ssrEntryURLPage.toString()}. This is unexpected and likely a bug in Astro, please report.`
+ `Unable to find the manifest for the module ${ssrEntryURLPage.toString()}. This is unexpected and likely a bug in Astro, please report.`,
);
}
} else {
@@ -135,7 +135,7 @@ export async function generatePages(options: StaticBuildOptions, internals: Buil
}
logger.info(
null,
- green(`✓ Completed in ${getTimeStat(generatePagesTimer, performance.now())}.\n`)
+ green(`✓ Completed in ${getTimeStat(generatePagesTimer, performance.now())}.\n`),
);
const staticImageList = getStaticImageList();
@@ -170,7 +170,7 @@ async function generatePage(
pageData: PageBuildData,
ssrEntry: SinglePageBuiltModule,
builtPaths: Set<string>,
- pipeline: BuildPipeline
+ pipeline: BuildPipeline,
) {
// prepare information we need
const { config, logger } = pipeline;
@@ -186,7 +186,7 @@ async function generatePage(
const scripts = pageData.hoistedScript ?? null;
if (!pageModulePromise) {
throw new Error(
- `Unable to find the module for ${pageData.component}. This is unexpected and likely a bug in Astro, please report.`
+ `Unable to find the module for ${pageData.component}. This is unexpected and likely a bug in Astro, please report.`,
);
}
const pageModule = await pageModulePromise();
@@ -241,7 +241,7 @@ async function getPathsForRoute(
route: RouteData,
mod: ComponentInstance,
pipeline: BuildPipeline,
- builtPaths: Set<string>
+ builtPaths: Set<string>,
): Promise<Array<string>> {
const { logger, options, routeCache, serverLike } = pipeline;
let paths: Array<string> = [];
@@ -263,7 +263,7 @@ async function getPathsForRoute(
const label = staticPaths.length === 1 ? 'page' : 'pages';
logger.debug(
'build',
- `├── ${bold(green('√'))} ${route.component} → ${magenta(`[${staticPaths.length} ${label}]`)}`
+ `├── ${bold(green('√'))} ${route.component} → ${magenta(`[${staticPaths.length} ${label}]`)}`,
);
paths = staticPaths
@@ -304,7 +304,7 @@ async function getPathsForRoute(
function getInvalidRouteSegmentError(
e: TypeError,
route: RouteData,
- staticPath: GetStaticPathsItem
+ staticPath: GetStaticPathsItem,
): AstroError {
const invalidParam = /^Expected "([^"]+)"/.exec(e.message)?.[1];
const received = invalidParam ? staticPath.params[invalidParam] : undefined;
@@ -312,7 +312,7 @@ function getInvalidRouteSegmentError(
'Learn about dynamic routes at https://docs.astro.build/en/core-concepts/routing/#dynamic-routes';
if (invalidParam && typeof received === 'string') {
const matchingSegment = route.segments.find(
- (segment) => segment[0]?.content === invalidParam
+ (segment) => segment[0]?.content === invalidParam,
)?.[0];
const mightBeMissingSpread = matchingSegment?.dynamic && !matchingSegment?.spread;
if (mightBeMissingSpread) {
@@ -325,7 +325,7 @@ function getInvalidRouteSegmentError(
? AstroErrorData.InvalidDynamicRoute.message(
route.route,
JSON.stringify(invalidParam),
- JSON.stringify(received)
+ JSON.stringify(received),
)
: `Generated path for ${route.route} is invalid.`,
hint,
@@ -355,7 +355,7 @@ function getUrlForPath(
origin: string,
format: AstroConfig['build']['format'],
trailingSlash: AstroConfig['trailingSlash'],
- routeType: RouteType
+ routeType: RouteType,
): URL {
/**
* Examples:
@@ -402,7 +402,7 @@ async function generatePath(
pathname: string,
pipeline: BuildPipeline,
gopts: GeneratePathOptions,
- route: RouteData
+ route: RouteData,
) {
const { mod } = gopts;
const { config, logger, options } = pipeline;
@@ -432,7 +432,7 @@ async function generatePath(
options.origin,
config.build.format,
config.trailingSlash,
- route.type
+ route.type,
);
const request = createRequest({
@@ -520,7 +520,7 @@ function createBuildManifest(
settings: AstroSettings,
internals: BuildInternals,
renderers: SSRLoadedRenderer[],
- middleware: MiddlewareHandler
+ middleware: MiddlewareHandler,
): SSRManifest {
let i18nManifest: SSRManifestI18n | undefined = undefined;
if (settings.config.i18n) {
diff --git a/packages/astro/src/core/build/graph.ts b/packages/astro/src/core/build/graph.ts
index d4c4089f3..e017bcb0f 100644
--- a/packages/astro/src/core/build/graph.ts
+++ b/packages/astro/src/core/build/graph.ts
@@ -17,7 +17,7 @@ export function getParentExtendedModuleInfos(
order = 0,
childId = '',
seen = new Set<string>(),
- accumulated: ExtendedModuleInfo[] = []
+ accumulated: ExtendedModuleInfo[] = [],
): ExtendedModuleInfo[] {
seen.add(id);
@@ -54,7 +54,7 @@ export function getParentModuleInfos(
ctx: { getModuleInfo: GetModuleInfo },
until?: (importer: string) => boolean,
seen = new Set<string>(),
- accumulated: ModuleInfo[] = []
+ accumulated: ModuleInfo[] = [],
): ModuleInfo[] {
seen.add(id);
@@ -88,7 +88,7 @@ export function moduleIsTopLevelPage(info: ModuleInfo): boolean {
// This could be a .astro page, a .markdown or a .md (or really any file extension for markdown files) page.
export function getTopLevelPageModuleInfos(
id: string,
- ctx: { getModuleInfo: GetModuleInfo }
+ ctx: { getModuleInfo: GetModuleInfo },
): ModuleInfo[] {
return getParentModuleInfos(id, ctx).filter(moduleIsTopLevelPage);
}
diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts
index de8e48b9d..8df72d8b2 100644
--- a/packages/astro/src/core/build/index.ts
+++ b/packages/astro/src/core/build/index.ts
@@ -61,7 +61,7 @@ export interface BuildOptions {
*/
export default async function build(
inlineConfig: AstroInlineConfig,
- options: BuildOptions = {}
+ options: BuildOptions = {},
): Promise<void> {
ensureProcessNodeEnv('production');
applyPolyfill();
@@ -140,7 +140,13 @@ class AstroBuilder {
middlewareMode: true,
},
},
- { settings: this.settings, logger: this.logger, mode: 'build', command: 'build', sync: false }
+ {
+ settings: this.settings,
+ logger: this.logger,
+ mode: 'build',
+ command: 'build',
+ sync: false,
+ },
);
await runHookConfigDone({ settings: this.settings, logger: logger });
@@ -182,7 +188,7 @@ class AstroBuilder {
this.timer.buildStart = performance.now();
this.logger.info(
'build',
- green(`✓ Completed in ${getTimeStat(this.timer.init, performance.now())}.`)
+ green(`✓ Completed in ${getTimeStat(this.timer.init, performance.now())}.`),
);
const opts: StaticBuildOptions = {
@@ -221,7 +227,7 @@ class AstroBuilder {
.concat(
this.settings.config.experimental.serverIslands
? [getServerIslandRouteData(this.settings.config)]
- : []
+ : [],
),
logging: this.logger,
cacheManifest: internals.cacheManifestUsed,
@@ -256,7 +262,7 @@ class AstroBuilder {
// outDir gets blown away so it can't be the root.
if (config.outDir.toString() === config.root.toString()) {
throw new Error(
- `the outDir cannot be the root folder. Please build to a folder such as dist.`
+ `the outDir cannot be the root folder. Please build to a folder such as dist.`,
);
}
}
diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts
index efab9baca..5c28a4d40 100644
--- a/packages/astro/src/core/build/internal.ts
+++ b/packages/astro/src/core/build/internal.ts
@@ -150,7 +150,7 @@ export function trackPageData(
component: string,
pageData: PageBuildData,
componentModuleId: string,
- componentURL: URL
+ componentURL: URL,
): void {
pageData.moduleSpecifier = componentModuleId;
internals.pagesByKeys.set(pageData.key, pageData);
@@ -163,7 +163,7 @@ export function trackPageData(
export function trackClientOnlyPageDatas(
internals: BuildInternals,
pageData: PageBuildData,
- clientOnlys: string[]
+ clientOnlys: string[],
) {
for (const clientOnlyComponent of clientOnlys) {
let pageDataSet: Set<PageBuildData>;
@@ -184,7 +184,7 @@ export function trackClientOnlyPageDatas(
export function trackScriptPageDatas(
internals: BuildInternals,
pageData: PageBuildData,
- scriptIds: string[]
+ scriptIds: string[],
) {
for (const scriptId of scriptIds) {
let pageDataSet: Set<PageBuildData>;
@@ -200,7 +200,7 @@ export function trackScriptPageDatas(
export function* getPageDatasByClientOnlyID(
internals: BuildInternals,
- viteid: ViteID
+ viteid: ViteID,
): Generator<PageBuildData, void, unknown> {
const pagesByClientOnly = internals.pagesByClientOnly;
if (pagesByClientOnly.size) {
@@ -238,7 +238,7 @@ export function* getPageDatasByClientOnlyID(
export function getPageData(
internals: BuildInternals,
route: string,
- component: string
+ component: string,
): PageBuildData | undefined {
let pageData = internals.pagesByKeys.get(makePageDataKey(route, component));
if (pageData) {
@@ -271,7 +271,7 @@ function getPagesDatasByComponent(internals: BuildInternals, component: string):
* @param pagesByKeys A map of all page data by their internal key
*/
export function getPageDatasWithPublicKey(
- pagesByKeys: Map<string, PageBuildData>
+ pagesByKeys: Map<string, PageBuildData>,
): Map<string, PageBuildData> {
// Create a map to store the pages with the public key, mimicking internal.pagesByKeys
const pagesWithPublicKey = new Map<string, PageBuildData>();
@@ -303,7 +303,7 @@ export function getPageDatasWithPublicKey(
export function getPageDataByViteID(
internals: BuildInternals,
- viteid: ViteID
+ viteid: ViteID,
): PageBuildData | undefined {
if (internals.pagesByViteID.has(viteid)) {
return internals.pagesByViteID.get(viteid);
@@ -358,7 +358,7 @@ export function cssOrder(a: OrderInfo, b: OrderInfo) {
export function mergeInlineCss(
acc: Array<StylesheetAsset>,
- current: StylesheetAsset
+ current: StylesheetAsset,
): Array<StylesheetAsset> {
const lastAdded = acc.at(acc.length - 1);
const lastWasInline = lastAdded?.type === 'inline';
@@ -379,7 +379,7 @@ export function mergeInlineCss(
*/
export function getPageDatasByHoistedScriptId(
internals: BuildInternals,
- id: string
+ id: string,
): PageBuildData[] {
const set = internals.hoistedScriptIdToPagesMap.get(id);
const pageDatas: PageBuildData[] = [];
diff --git a/packages/astro/src/core/build/page-data.ts b/packages/astro/src/core/build/page-data.ts
index b6cc03002..210b31a0e 100644
--- a/packages/astro/src/core/build/page-data.ts
+++ b/packages/astro/src/core/build/page-data.ts
@@ -46,7 +46,7 @@ export function collectPagesData(opts: CollectPagesDataOptions): CollectPagesDat
const html = `${route.pathname}`.replace(/\/?$/, '/index.html');
debug(
'build',
- `├── ${colors.bold(colors.green('✔'))} ${route.component} → ${colors.yellow(html)}`
+ `├── ${colors.bold(colors.green('✔'))} ${route.component} → ${colors.yellow(html)}`,
);
} else {
debug('build', `├── ${colors.bold(colors.green('✔'))} ${route.component}`);
diff --git a/packages/astro/src/core/build/pipeline.ts b/packages/astro/src/core/build/pipeline.ts
index 7ef94acd9..4e0d94c57 100644
--- a/packages/astro/src/core/build/pipeline.ts
+++ b/packages/astro/src/core/build/pipeline.ts
@@ -54,7 +54,7 @@ export class BuildPipeline extends Pipeline {
readonly options: StaticBuildOptions,
readonly config = options.settings.config,
readonly settings = options.settings,
- readonly defaultRoutes = createDefaultRoutes(manifest)
+ readonly defaultRoutes = createDefaultRoutes(manifest),
) {
const resolveCache = new Map<string, string>();
@@ -87,7 +87,7 @@ export class BuildPipeline extends Pipeline {
manifest.renderers,
resolve,
serverLike,
- streaming
+ streaming,
);
}
@@ -114,18 +114,18 @@ export class BuildPipeline extends Pipeline {
*/
static async retrieveManifest(
staticBuildOptions: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): Promise<SSRManifest> {
const config = staticBuildOptions.settings.config;
const baseDirectory = getOutputDirectory(config);
const manifestEntryUrl = new URL(
`${internals.manifestFileName}?time=${Date.now()}`,
- baseDirectory
+ baseDirectory,
);
const { manifest } = await import(manifestEntryUrl.toString());
if (!manifest) {
throw new Error(
- "Astro couldn't find the emitted manifest. This is an internal error, please file an issue."
+ "Astro couldn't find the emitted manifest. This is an internal error, please file an issue.",
);
}
@@ -140,7 +140,7 @@ export class BuildPipeline extends Pipeline {
if (!renderers) {
throw new Error(
- "Astro couldn't find the emitted renderers. This is an internal error, please file an issue."
+ "Astro couldn't find the emitted renderers. This is an internal error, please file an issue.",
);
}
return {
@@ -161,7 +161,7 @@ export class BuildPipeline extends Pipeline {
const scripts = createModuleScriptsSet(
pageBuildData?.hoistedScript ? [pageBuildData.hoistedScript] : [],
base,
- assetsPrefix
+ assetsPrefix,
);
const sortedCssAssets = pageBuildData?.styles
.sort(cssOrder)
@@ -216,8 +216,8 @@ export class BuildPipeline extends Pipeline {
...getPagesFromVirtualModulePageName(
this.internals,
ASTRO_PAGE_RESOLVED_MODULE_ID,
- virtualModulePageName
- )
+ virtualModulePageName,
+ ),
);
}
if (virtualModulePageName.includes(RESOLVED_SPLIT_MODULE_ID)) {
@@ -225,8 +225,8 @@ export class BuildPipeline extends Pipeline {
...getPagesFromVirtualModulePageName(
this.internals,
RESOLVED_SPLIT_MODULE_ID,
- virtualModulePageName
- )
+ virtualModulePageName,
+ ),
);
}
for (const pageData of pageDatas) {
@@ -288,7 +288,7 @@ export class BuildPipeline extends Pipeline {
async tryRewrite(
payload: RewritePayload,
request: Request,
- _sourceRoute: RouteData
+ _sourceRoute: RouteData,
): Promise<[RouteData, ComponentInstance, URL]> {
const [foundRoute, finalUrl] = findRouteToRewrite({
payload,
@@ -324,7 +324,7 @@ export class BuildPipeline extends Pipeline {
async #getEntryForFallbackRoute(
route: RouteData,
internals: BuildInternals,
- outFolder: URL
+ outFolder: URL,
): Promise<SinglePageBuiltModule> {
if (route.type !== 'fallback') {
throw new Error(`Expected a redirect route.`);
@@ -344,7 +344,7 @@ export class BuildPipeline extends Pipeline {
async #getEntryForRedirectRoute(
route: RouteData,
internals: BuildInternals,
- outFolder: URL
+ outFolder: URL,
): Promise<SinglePageBuiltModule> {
if (route.type !== 'redirect') {
throw new Error(`Expected a redirect route.`);
diff --git a/packages/astro/src/core/build/plugins/README.md b/packages/astro/src/core/build/plugins/README.md
index 410b81da6..2949233e6 100644
--- a/packages/astro/src/core/build/plugins/README.md
+++ b/packages/astro/src/core/build/plugins/README.md
@@ -22,7 +22,7 @@ The emitted file has content similar to:
const renderers = [
Object.assign(
{ name: 'astro:jsx', serverEntrypoint: 'astro/jsx/server.js', jsxImportSource: 'astro' },
- { ssr: server_default }
+ { ssr: server_default },
),
];
diff --git a/packages/astro/src/core/build/plugins/plugin-analyzer.ts b/packages/astro/src/core/build/plugins/plugin-analyzer.ts
index b0ba0e74d..b007e318f 100644
--- a/packages/astro/src/core/build/plugins/plugin-analyzer.ts
+++ b/packages/astro/src/core/build/plugins/plugin-analyzer.ts
@@ -28,7 +28,7 @@ function isPropagatedAsset(id: string) {
export function vitePluginAnalyzer(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): VitePlugin {
function hoistedScriptScanner() {
const uniqueHoistedIds = new Map<string, string>();
@@ -43,7 +43,7 @@ export function vitePluginAnalyzer(
async scan(
this: PluginContext,
scripts: AstroPluginMetadata['astro']['scripts'],
- from: string
+ from: string,
) {
const hoistedScripts = new Set<string>();
for (let i = 0; i < scripts.length; i++) {
@@ -178,7 +178,7 @@ export function vitePluginAnalyzer(
// `discoveredScripts` here, which will eventually be passed as inputs of the client build.
if (options.settings.config.experimental.directRenderScript && astro.scripts.length) {
const scriptIds = astro.scripts.map(
- (_, i) => `${id.replace('/@fs', '')}?astro&type=script&index=${i}&lang.ts`
+ (_, i) => `${id.replace('/@fs', '')}?astro&type=script&index=${i}&lang.ts`,
);
// Assign as entrypoints for the client bundle
@@ -204,7 +204,7 @@ export function vitePluginAnalyzer(
export function pluginAnalyzer(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['server'],
diff --git a/packages/astro/src/core/build/plugins/plugin-content.ts b/packages/astro/src/core/build/plugins/plugin-content.ts
index 68ff981a0..9c6d5add0 100644
--- a/packages/astro/src/core/build/plugins/plugin-content.ts
+++ b/packages/astro/src/core/build/plugins/plugin-content.ts
@@ -80,7 +80,7 @@ function vitePluginContent(
opts: StaticBuildOptions,
lookupMap: ContentLookupMap,
internals: BuildInternals,
- cachedBuildOutput: Array<{ cached: URL; dist: URL }>
+ cachedBuildOutput: Array<{ cached: URL; dist: URL }>,
): VitePlugin {
const { config } = opts.settings;
const distContentRoot = getContentRoot(config);
@@ -184,7 +184,7 @@ function vitePluginContent(
) {
const [srcRelativePath] = id.replace(rootPath, '/').split('?');
const resultId = encodeName(
- `${removeLeadingForwardSlash(removeFileExtension(srcRelativePath))}.render.mjs`
+ `${removeLeadingForwardSlash(removeFileExtension(srcRelativePath))}.render.mjs`,
);
return resultId;
}
@@ -192,7 +192,7 @@ function vitePluginContent(
const collectionEntry = findEntryFromSrcRelativePath(
lookupMap,
srcRelativePath,
- entryCache
+ entryCache,
);
if (collectionEntry) {
let suffix = '.mjs';
@@ -201,7 +201,7 @@ function vitePluginContent(
}
id =
removeLeadingForwardSlash(
- removeFileExtension(encodeName(id.replace(srcPath, '/')))
+ removeFileExtension(encodeName(id.replace(srcPath, '/'))),
) + suffix;
return id;
}
@@ -284,7 +284,7 @@ function vitePluginContent(
function findEntryFromSrcRelativePath(
lookupMap: ContentLookupMap,
srcRelativePath: string,
- entryCache: Map<string, string>
+ entryCache: Map<string, string>,
) {
let value = entryCache.get(srcRelativePath);
if (value) return value;
@@ -308,7 +308,7 @@ interface ContentEntries {
function getEntriesFromManifests(
oldManifest: ContentManifest,
- newManifest: ContentManifest
+ newManifest: ContentManifest,
): ContentEntries {
const { entries: oldEntries } = oldManifest;
const { entries: newEntries } = newManifest;
@@ -320,7 +320,7 @@ function getEntriesFromManifests(
return entries;
}
const oldEntryHashMap = new Map<string, ContentManifestKey>(
- oldEntries.map(([key, hash]) => [hash, key])
+ oldEntries.map(([key, hash]) => [hash, key]),
);
for (const [entry, hash] of newEntryMap) {
@@ -367,7 +367,7 @@ function manifestState(oldManifest: ContentManifest, newManifest: ContentManifes
async function generateContentManifest(
opts: StaticBuildOptions,
- lookupMap: ContentLookupMap
+ lookupMap: ContentLookupMap,
): Promise<ContentManifest> {
let manifest = createContentManifest();
manifest.version = CONTENT_MANIFEST_VERSION;
@@ -382,7 +382,7 @@ async function generateContentManifest(
limit(async () => {
const data = await fsMod.promises.readFile(fileURL, { encoding: 'utf8' });
manifest.entries.push([key, checksum(data, fileURL.toString())]);
- })
+ }),
);
}
}
@@ -480,7 +480,7 @@ export async function copyContentToCache(opts: StaticBuildOptions) {
export function pluginContent(
opts: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
const { cacheDir, outDir } = opts.settings.config;
diff --git a/packages/astro/src/core/build/plugins/plugin-css.ts b/packages/astro/src/core/build/plugins/plugin-css.ts
index 269364842..0ebc7e618 100644
--- a/packages/astro/src/core/build/plugins/plugin-css.ts
+++ b/packages/astro/src/core/build/plugins/plugin-css.ts
@@ -30,7 +30,7 @@ interface PluginOptions {
export function pluginCSS(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['client', 'server'],
@@ -206,7 +206,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
// Ref: https://github.com/vitejs/vite/blob/b2c0ee04d4db4a0ef5a084c50f49782c5f88587c/packages/vite/src/node/plugins/html.ts#L690-L705
if (resolvedConfig.build.cssCodeSplit) return;
const cssChunk = Object.values(bundle).find(
- (chunk) => chunk.type === 'asset' && chunk.name === 'style.css'
+ (chunk) => chunk.type === 'asset' && chunk.name === 'style.css',
);
if (cssChunk === undefined) return;
for (const pageData of internals.pagesByKeys.values()) {
@@ -293,7 +293,7 @@ function rollupPluginAstroBuildCSS(options: PluginOptions): VitePlugin[] {
function* getParentClientOnlys(
id: string,
ctx: { getModuleInfo: GetModuleInfo },
- internals: BuildInternals
+ internals: BuildInternals,
): Generator<PageBuildData, void, unknown> {
for (const info of getParentModuleInfos(id, ctx)) {
yield* getPageDatasByClientOnlyID(internals, info.id);
@@ -310,7 +310,7 @@ function appendCSSToPage(
meta: ViteMetadata,
pagesToCss: Record<string, Record<string, { order: number; depth: number }>>,
depth: number,
- order: number
+ order: number,
) {
for (const importedCssImport of meta.importedCss) {
// CSS is prioritized based on depth. Shared CSS has a higher depth due to being imported by multiple pages.
@@ -341,7 +341,7 @@ function appendCSSToPage(
*/
function isCssScopeToRendered(
cssScopeTo: Record<string, string[]>,
- chunks: Rollup.RenderedChunk[]
+ chunks: Rollup.RenderedChunk[],
) {
for (const moduleId in cssScopeTo) {
const exports = cssScopeTo[moduleId];
diff --git a/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts b/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts
index 7d31aed63..7c3784909 100644
--- a/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts
+++ b/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts
@@ -13,7 +13,7 @@ function virtualHoistedEntry(id: string) {
export function vitePluginHoistedScripts(
settings: AstroSettings,
- internals: BuildInternals
+ internals: BuildInternals,
): VitePlugin {
let assetsInlineLimit: NonNullable<BuildOptions['assetsInlineLimit']>;
@@ -104,7 +104,7 @@ export function vitePluginHoistedScripts(
export function pluginHoistedScripts(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['client'],
diff --git a/packages/astro/src/core/build/plugins/plugin-internals.ts b/packages/astro/src/core/build/plugins/plugin-internals.ts
index 3f5467aae..01d524515 100644
--- a/packages/astro/src/core/build/plugins/plugin-internals.ts
+++ b/packages/astro/src/core/build/plugins/plugin-internals.ts
@@ -36,7 +36,7 @@ export function vitePluginInternals(input: Set<string>, internals: BuildInternal
mapping.set(result.id, new Set<string>([specifier]));
}
}
- })
+ }),
);
}
await Promise.all(promises);
diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts
index 491b9187a..bb1add5b4 100644
--- a/packages/astro/src/core/build/plugins/plugin-manifest.ts
+++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts
@@ -78,7 +78,7 @@ function vitePluginManifest(_options: StaticBuildOptions, internals: BuildIntern
export function pluginManifest(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['server'],
@@ -115,7 +115,7 @@ export function pluginManifest(
async function createManifest(
buildOpts: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): Promise<SerializedSSRManifest> {
if (!internals.manifestEntryChunk) {
throw new Error(`Did not generate an entry chunk for SSR`);
@@ -125,7 +125,7 @@ async function createManifest(
const clientStatics = new Set(
await glob('**/*', {
cwd: fileURLToPath(buildOpts.settings.config.build.client),
- })
+ }),
);
for (const file of clientStatics) {
internals.staticFiles.add(file);
@@ -149,7 +149,7 @@ function injectManifest(manifest: SerializedSSRManifest, chunk: Readonly<OutputC
function buildManifest(
opts: StaticBuildOptions,
internals: BuildInternals,
- staticFiles: string[]
+ staticFiles: string[],
): SerializedSSRManifest {
const { settings } = opts;
@@ -197,7 +197,7 @@ function buildManifest(
scripts.unshift(
Object.assign({}, pageData.hoistedScript, {
value,
- })
+ }),
);
}
if (settings.scripts.some((script) => script.stage === 'page')) {
diff --git a/packages/astro/src/core/build/plugins/plugin-middleware.ts b/packages/astro/src/core/build/plugins/plugin-middleware.ts
index 701422a5b..6b982053f 100644
--- a/packages/astro/src/core/build/plugins/plugin-middleware.ts
+++ b/packages/astro/src/core/build/plugins/plugin-middleware.ts
@@ -6,7 +6,7 @@ export { MIDDLEWARE_MODULE_ID } from '../../middleware/vite-plugin.js';
export function pluginMiddleware(
opts: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
return {
targets: ['server'],
diff --git a/packages/astro/src/core/build/plugins/plugin-pages.ts b/packages/astro/src/core/build/plugins/plugin-pages.ts
index 4df70eac4..2dc400a6c 100644
--- a/packages/astro/src/core/build/plugins/plugin-pages.ts
+++ b/packages/astro/src/core/build/plugins/plugin-pages.ts
@@ -39,7 +39,7 @@ function vitePluginPages(opts: StaticBuildOptions, internals: BuildInternals): V
const pageDatas = getPagesFromVirtualModulePageName(
internals,
ASTRO_PAGE_RESOLVED_MODULE_ID,
- id
+ id,
);
for (const pageData of pageDatas) {
const resolvedPage = await this.resolve(pageData.moduleSpecifier);
diff --git a/packages/astro/src/core/build/plugins/plugin-prerender.ts b/packages/astro/src/core/build/plugins/plugin-prerender.ts
index a8ace9a25..25b951794 100644
--- a/packages/astro/src/core/build/plugins/plugin-prerender.ts
+++ b/packages/astro/src/core/build/plugins/plugin-prerender.ts
@@ -46,7 +46,7 @@ function getNonPrerenderOnlyChunks(bundle: Rollup.OutputBundle, internals: Build
const pageDatas = getPagesFromVirtualModulePageName(
internals,
ASTRO_PAGE_RESOLVED_MODULE_ID,
- chunk.facadeModuleId
+ chunk.facadeModuleId,
);
const prerender = pageDatas.every((pageData) => pageData.route.prerender);
if (prerender) {
@@ -102,7 +102,7 @@ function getNonPrerenderOnlyChunks(bundle: Rollup.OutputBundle, internals: Build
export function pluginPrerender(
opts: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
// Static output can skip prerender completely because we're already rendering all pages
if (opts.settings.config.output === 'static') {
diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts
index f4857402a..f395141a0 100644
--- a/packages/astro/src/core/build/plugins/plugin-ssr.ts
+++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts
@@ -22,7 +22,7 @@ export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR_VIRTUAL_MODULE_ID;
function vitePluginSSR(
internals: BuildInternals,
adapter: AstroAdapter,
- options: StaticBuildOptions
+ options: StaticBuildOptions,
): VitePlugin {
return {
name: '@astrojs/vite-plugin-astro-ssr-server',
@@ -60,7 +60,7 @@ function vitePluginSSR(
}
const virtualModuleName = getVirtualModulePageName(
ASTRO_PAGE_MODULE_ID,
- pageData.component
+ pageData.component,
);
let module = await this.resolve(virtualModuleName);
if (module) {
@@ -106,7 +106,7 @@ function vitePluginSSR(
export function pluginSSR(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
const ssr = isServerLikeOutput(options.settings.config);
const functionPerRouteEnabled = isFunctionPerRouteEnabled(options.settings.adapter);
@@ -149,7 +149,7 @@ export const RESOLVED_SPLIT_MODULE_ID = '\0@astro-page-split:';
function vitePluginSSRSplit(
internals: BuildInternals,
adapter: AstroAdapter,
- options: StaticBuildOptions
+ options: StaticBuildOptions,
): VitePlugin {
return {
name: '@astrojs/vite-plugin-astro-ssr-split',
@@ -217,7 +217,7 @@ function vitePluginSSRSplit(
export function pluginSSRSplit(
options: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): AstroBuildPlugin {
const ssr = isServerLikeOutput(options.settings.config);
const functionPerRouteEnabled = isFunctionPerRouteEnabled(options.settings.adapter);
@@ -301,7 +301,7 @@ function storeEntryPoint(
moduleKey: string,
options: StaticBuildOptions,
internals: BuildInternals,
- fileName: string
+ fileName: string,
) {
const componentPath = getComponentFromVirtualModulePageName(RESOLVED_SPLIT_MODULE_ID, moduleKey);
for (const pageData of Object.values(options.allPages)) {
diff --git a/packages/astro/src/core/build/plugins/util.ts b/packages/astro/src/core/build/plugins/util.ts
index de2c53e81..c636928d0 100644
--- a/packages/astro/src/core/build/plugins/util.ts
+++ b/packages/astro/src/core/build/plugins/util.ts
@@ -82,7 +82,7 @@ export function getVirtualModulePageName(virtualModulePrefix: string, path: stri
export function getPagesFromVirtualModulePageName(
internals: BuildInternals,
virtualModulePrefix: string,
- id: string
+ id: string,
): PageBuildData[] {
const path = getComponentFromVirtualModulePageName(virtualModulePrefix, id);
@@ -105,7 +105,7 @@ export function getPagesFromVirtualModulePageName(
*/
export function getComponentFromVirtualModulePageName(
virtualModulePrefix: string,
- id: string
+ id: string,
): string {
return id.slice(virtualModulePrefix.length).replace(ASTRO_PAGE_EXTENSION_POST_PATTERN, '.');
}
@@ -113,7 +113,7 @@ export function getComponentFromVirtualModulePageName(
export function shouldInlineAsset(
assetContent: string,
assetPath: string,
- assetsInlineLimit: NonNullable<BuildOptions['assetsInlineLimit']>
+ assetsInlineLimit: NonNullable<BuildOptions['assetsInlineLimit']>,
) {
if (typeof assetsInlineLimit === 'function') {
const result = assetsInlineLimit(assetPath, Buffer.from(assetContent));
diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts
index da651effd..862601956 100644
--- a/packages/astro/src/core/build/static-build.ts
+++ b/packages/astro/src/core/build/static-build.ts
@@ -141,7 +141,7 @@ export async function staticBuild(
opts: StaticBuildOptions,
internals: BuildInternals,
ssrOutputChunkNames: string[],
- contentFileNames?: string[]
+ contentFileNames?: string[],
) {
const { settings } = opts;
switch (true) {
@@ -171,7 +171,7 @@ async function ssrBuild(
internals: BuildInternals,
input: Set<string>,
container: AstroBuildPluginContainer,
- logger: Logger
+ logger: Logger,
) {
const buildID = Date.now().toString();
const { allPages, settings, viteConfig } = opts;
@@ -245,7 +245,7 @@ async function ssrBuild(
return makeAstroPageEntryPointFileName(
ASTRO_PAGE_RESOLVED_MODULE_ID,
chunkInfo.facadeModuleId,
- routes
+ routes,
);
} else if (chunkInfo.facadeModuleId?.startsWith(RESOLVED_SPLIT_MODULE_ID)) {
return makeSplitEntryPointFileName(chunkInfo.facadeModuleId, routes);
@@ -303,7 +303,7 @@ async function clientBuild(
opts: StaticBuildOptions,
internals: BuildInternals,
input: Set<string>,
- container: AstroBuildPluginContainer
+ container: AstroBuildPluginContainer,
) {
const { settings, viteConfig } = opts;
const ssr = isServerLikeOutput(settings.config);
@@ -364,7 +364,7 @@ async function clientBuild(
async function runPostBuildHooks(
container: AstroBuildPluginContainer,
ssrOutputs: vite.Rollup.RollupOutput[],
- clientOutputs: vite.Rollup.RollupOutput[]
+ clientOutputs: vite.Rollup.RollupOutput[],
) {
const mutations = await container.runPostHook(ssrOutputs, clientOutputs);
const config = container.options.settings.config;
@@ -401,7 +401,7 @@ async function cleanStaticOutput(opts: StaticBuildOptions, internals: BuildInter
await fs.promises.writeFile(
url,
"// Contents removed by Astro as it's used for prerendering only",
- 'utf-8'
+ 'utf-8',
);
} else {
await fs.promises.unlink(url);
@@ -410,7 +410,7 @@ async function cleanStaticOutput(opts: StaticBuildOptions, internals: BuildInter
// Best-effort only. Sometimes some chunks may be deleted by other plugins, like pure CSS chunks,
// so they may already not exist.
}
- })
+ }),
);
}
@@ -418,7 +418,7 @@ async function cleanServerOutput(
opts: StaticBuildOptions,
ssrOutputChunkNames: string[],
contentFileNames: string[] | undefined,
- internals: BuildInternals
+ internals: BuildInternals,
) {
const out = getOutDirWithinCwd(opts.settings.config.outDir);
// The SSR output chunks for Astro are all .mjs files
@@ -434,7 +434,7 @@ async function cleanServerOutput(
files.map(async (filename) => {
const url = new URL(filename, out);
await fs.promises.rm(url);
- })
+ }),
);
removeEmptyDirs(out);
@@ -447,7 +447,7 @@ async function cleanServerOutput(
await Promise.all(
fileNames
.filter((fileName) => fileName.endsWith('.d.ts'))
- .map((fileName) => fs.promises.rm(new URL(fileName, out)))
+ .map((fileName) => fs.promises.rm(new URL(fileName, out))),
);
// Copy assets before cleaning directory if outside root
await copyFiles(out, opts.settings.config.outDir, true);
@@ -471,7 +471,7 @@ export async function copyFiles(fromFolder: URL, toFolder: URL, includeDotfiles
const p = await fs.promises.copyFile(from, to, fs.constants.COPYFILE_FICLONE);
return p;
});
- })
+ }),
);
}
@@ -499,7 +499,7 @@ async function ssrMoveAssets(opts: StaticBuildOptions) {
// that includes the folder paths in `assetFileNames
if (!fs.existsSync(dir)) await fs.promises.mkdir(dir, { recursive: true });
return fs.promises.rename(currentUrl, clientUrl);
- })
+ }),
);
removeEmptyDirs(serverAssets);
}
@@ -526,7 +526,7 @@ async function ssrMoveAssets(opts: StaticBuildOptions) {
export function makeAstroPageEntryPointFileName(
prefix: string,
facadeModuleId: string,
- routes: RouteData[]
+ routes: RouteData[],
) {
const pageModuleId = facadeModuleId
.replace(prefix, '')
@@ -555,7 +555,7 @@ export function makeSplitEntryPointFileName(facadeModuleId: string, routes: Rout
const filePath = `${makeAstroPageEntryPointFileName(
RESOLVED_SPLIT_MODULE_ID,
facadeModuleId,
- routes
+ routes,
)}`;
const pathComponents = filePath.split(path.sep);
diff --git a/packages/astro/src/core/build/util.ts b/packages/astro/src/core/build/util.ts
index 96a5ec2f2..9dc61f06f 100644
--- a/packages/astro/src/core/build/util.ts
+++ b/packages/astro/src/core/build/util.ts
@@ -12,7 +12,7 @@ export function getTimeStat(timeStart: number, timeEnd: number) {
*/
export function shouldAppendForwardSlash(
trailingSlash: AstroConfig['trailingSlash'],
- buildFormat: AstroConfig['build']['format']
+ buildFormat: AstroConfig['build']['format'],
): boolean {
switch (trailingSlash) {
case 'always':
@@ -57,7 +57,7 @@ export function encodeName(name: string): string {
}
export function viteBuildReturnToRollupOutputs(
- viteBuildReturn: ViteBuildReturn
+ viteBuildReturn: ViteBuildReturn,
): Rollup.RollupOutput[] {
const result: Rollup.RollupOutput[] = [];
if (Array.isArray(viteBuildReturn)) {
diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts
index 4c0f0aa3d..2e43661a4 100644
--- a/packages/astro/src/core/config/config.ts
+++ b/packages/astro/src/core/config/config.ts
@@ -74,7 +74,7 @@ interface ResolveConfigPathOptions {
* Resolve the file URL of the user's `astro.config.js|cjs|mjs|ts` file
*/
export async function resolveConfigPath(
- options: ResolveConfigPathOptions
+ options: ResolveConfigPathOptions,
): Promise<string | undefined> {
let userConfigPath: string | undefined;
if (options.configFile) {
@@ -95,7 +95,7 @@ export async function resolveConfigPath(
async function loadConfig(
root: string,
configFile?: string | false,
- fsMod = fs
+ fsMod = fs,
): Promise<Record<string, any>> {
if (configFile === false) return {};
@@ -155,7 +155,7 @@ interface ResolveConfigResult {
export async function resolveConfig(
inlineConfig: AstroInlineConfig,
command: string,
- fsMod = fs
+ fsMod = fs,
): Promise<ResolveConfigResult> {
const root = resolveRoot(inlineConfig.root);
const { inlineUserConfig, inlineOnlyConfig } = splitInlineConfig(inlineConfig);
diff --git a/packages/astro/src/core/config/merge.ts b/packages/astro/src/core/config/merge.ts
index 81b3b70f3..c897c1441 100644
--- a/packages/astro/src/core/config/merge.ts
+++ b/packages/astro/src/core/config/merge.ts
@@ -4,7 +4,7 @@ import { arraify, isObject, isURL } from '../util.js';
function mergeConfigRecursively(
defaults: Record<string, any>,
overrides: Record<string, any>,
- rootPath: string
+ rootPath: string,
) {
const merged: Record<string, any> = { ...defaults };
for (const key in overrides) {
@@ -67,7 +67,7 @@ function mergeConfigRecursively(
export function mergeConfig(
defaults: Record<string, any>,
overrides: Record<string, any>,
- isRoot = true
+ isRoot = true,
): Record<string, any> {
return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.');
}
diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts
index 60941b17b..9ffb58934 100644
--- a/packages/astro/src/core/config/schema.ts
+++ b/packages/astro/src/core/config/schema.ts
@@ -143,7 +143,7 @@ export const AstroConfigSchema = z.object({
// validate
z
.array(z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }))
- .default(ASTRO_CONFIG_DEFAULTS.integrations)
+ .default(ASTRO_CONFIG_DEFAULTS.integrations),
),
build: z
.object({
@@ -177,7 +177,7 @@ export const AstroConfigSchema = z.object({
},
{
message: 'The `fallback` is mandatory when defining the option as an object.',
- }
+ },
),
serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
@@ -206,7 +206,7 @@ export const AstroConfigSchema = z.object({
port: z.number().optional().default(ASTRO_CONFIG_DEFAULTS.server.port),
headers: z.custom<OutgoingHttpHeaders>().optional(),
})
- .default({})
+ .default({}),
),
redirects: z
.record(
@@ -225,7 +225,7 @@ export const AstroConfigSchema = z.object({
]),
destination: z.string(),
}),
- ])
+ ]),
)
.default(ASTRO_CONFIG_DEFAULTS.redirects),
prefetch: z
@@ -263,7 +263,7 @@ export const AstroConfigSchema = z.object({
(val) => !val.includes('*') || val.startsWith('*.') || val.startsWith('**.'),
{
message: 'wildcards can only be placed at the beginning of the hostname',
- }
+ },
)
.optional(),
port: z.string().optional(),
@@ -273,7 +273,7 @@ export const AstroConfigSchema = z.object({
message: 'wildcards can only be placed at the end of a pathname',
})
.optional(),
- })
+ }),
)
.default([]),
})
@@ -318,7 +318,7 @@ export const AstroConfigSchema = z.object({
.record(
z
.enum(Object.keys(bundledThemes) as [BuiltinTheme, ...BuiltinTheme[]])
- .or(z.custom<ShikiTheme>())
+ .or(z.custom<ShikiTheme>()),
)
.default(ASTRO_CONFIG_DEFAULTS.markdown.shikiConfig.themes!),
defaultColor: z
@@ -381,7 +381,7 @@ export const AstroConfigSchema = z.object({
path: z.string(),
codes: z.string().array().nonempty(),
}),
- ])
+ ]),
),
domains: z
.record(
@@ -389,8 +389,8 @@ export const AstroConfigSchema = z.object({
z
.string()
.url(
- "The domain value must be a valid URL, and it has to start with 'https' or 'http'."
- )
+ "The domain value must be a valid URL, and it has to start with 'https' or 'http'.",
+ ),
)
.optional(),
fallback: z.record(z.string(), z.string()).optional(),
@@ -409,8 +409,8 @@ export const AstroConfigSchema = z.object({
{
message:
'The option `i18n.redirectToDefaultLocale` is only useful when the `i18n.prefixDefaultLocale` is set to `true`. Remove the option `i18n.redirectToDefaultLocale`, or change its value to `true`.',
- }
- )
+ },
+ ),
)
.optional()
.default({}),
@@ -497,7 +497,7 @@ export const AstroConfigSchema = z.object({
}
}
}
- })
+ }),
),
security: z
.object({
@@ -540,7 +540,7 @@ export const AstroConfigSchema = z.object({
.default(ASTRO_CONFIG_DEFAULTS.experimental.serverIslands),
})
.strict(
- `Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/configuration-reference/#experimental-flags for a list of all current experiments.`
+ `Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/configuration-reference/#experimental-flags for a list of all current experiments.`,
)
.default({}),
legacy: z.object({}).default({}),
@@ -605,7 +605,7 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: string) {
},
{
message: 'The `fallback` is mandatory when defining the option as an object.',
- }
+ },
),
serverEntry: z.string().optional().default(ASTRO_CONFIG_DEFAULTS.build.serverEntry),
redirects: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.build.redirects),
@@ -641,7 +641,7 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: string) {
streaming: z.boolean().optional().default(true),
})
.optional()
- .default({})
+ .default({}),
),
})
.transform((config) => {
diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts
index 9c82118b7..c3c62edd4 100644
--- a/packages/astro/src/core/config/settings.ts
+++ b/packages/astro/src/core/config/settings.ts
@@ -35,7 +35,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
const pathRelToContentDir = path.relative(
fileURLToPath(contentDir),
- fileURLToPath(fileUrl)
+ fileURLToPath(fileUrl),
);
let data;
try {
@@ -45,7 +45,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
...AstroErrorData.DataCollectionEntryParseError,
message: AstroErrorData.DataCollectionEntryParseError.message(
pathRelToContentDir,
- e instanceof Error ? e.message : 'contains invalid JSON.'
+ e instanceof Error ? e.message : 'contains invalid JSON.',
),
location: { file: fileUrl.pathname },
stack: e instanceof Error ? e.stack : undefined,
@@ -57,7 +57,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
...AstroErrorData.DataCollectionEntryParseError,
message: AstroErrorData.DataCollectionEntryParseError.message(
pathRelToContentDir,
- 'data is not an object.'
+ 'data is not an object.',
),
location: { file: fileUrl.pathname },
});
@@ -77,7 +77,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
} catch (e) {
const pathRelToContentDir = path.relative(
fileURLToPath(contentDir),
- fileURLToPath(fileUrl)
+ fileURLToPath(fileUrl),
);
const formattedError = isYAMLException(e)
? formatYAMLException(e)
@@ -87,7 +87,7 @@ export function createBaseSettings(config: AstroConfig): AstroSettings {
...AstroErrorData.DataCollectionEntryParseError,
message: AstroErrorData.DataCollectionEntryParseError.message(
pathRelToContentDir,
- formattedError.message
+ formattedError.message,
),
stack: formattedError.stack,
location:
@@ -122,7 +122,7 @@ export async function createSettings(config: AstroConfig, cwd?: string): Promise
if (typeof tsconfig !== 'string') {
watchFiles.push(
- ...[tsconfig.tsconfigFile, ...(tsconfig.extended ?? []).map((e) => e.tsconfigFile)]
+ ...[tsconfig.tsconfigFile, ...(tsconfig.extended ?? []).map((e) => e.tsconfigFile)],
);
settings.tsConfig = tsconfig.tsconfig;
settings.tsConfigPath = tsconfig.tsconfigFile;
diff --git a/packages/astro/src/core/config/tsconfig.ts b/packages/astro/src/core/config/tsconfig.ts
index 9813b200d..03d89e30c 100644
--- a/packages/astro/src/core/config/tsconfig.ts
+++ b/packages/astro/src/core/config/tsconfig.ts
@@ -64,7 +64,7 @@ type TSConfigResult<T = object> = Promise<
*/
export async function loadTSConfig(
root: string | undefined,
- findUp = false
+ findUp = false,
): Promise<TSConfigResult<{ rawConfig: TSConfig }>> {
const safeCwd = root ?? process.cwd();
@@ -74,8 +74,8 @@ export async function loadTSConfig(
find(join(safeCwd, './dummy.txt'), {
root: findUp ? undefined : root,
configName: configName,
- })
- )
+ }),
+ ),
);
// If we have both files, prefer tsconfig.json
@@ -132,7 +132,7 @@ async function safeParse(tsconfigPath: string, options: TSConfckParseOptions = {
export function updateTSConfigForFramework(
target: TSConfig,
- framework: frameworkWithTSSettings
+ framework: frameworkWithTSSettings,
): TSConfig {
if (!presets.has(framework)) {
return target;
diff --git a/packages/astro/src/core/config/validate.ts b/packages/astro/src/core/config/validate.ts
index 8d1207a85..4f4497b78 100644
--- a/packages/astro/src/core/config/validate.ts
+++ b/packages/astro/src/core/config/validate.ts
@@ -5,7 +5,7 @@ import { createRelativeSchema } from './schema.js';
export async function validateConfig(
userConfig: any,
root: string,
- cmd: string
+ cmd: string,
): Promise<AstroConfig> {
const AstroConfigRelativeSchema = createRelativeSchema(cmd, root);
diff --git a/packages/astro/src/core/cookies/cookies.ts b/packages/astro/src/core/cookies/cookies.ts
index c176fc757..852be913d 100644
--- a/packages/astro/src/core/cookies/cookies.ts
+++ b/packages/astro/src/core/cookies/cookies.ts
@@ -26,7 +26,7 @@ interface AstroCookiesInterface {
set(
key: string,
value: string | number | boolean | Record<string, any>,
- options?: AstroCookieSetOptions
+ options?: AstroCookieSetOptions,
): void;
delete(key: string, options?: AstroCookieDeleteOptions): void;
}
@@ -105,7 +105,7 @@ class AstroCookies implements AstroCookiesInterface {
*/
get(
key: string,
- options: AstroCookieGetOptions | undefined = undefined
+ options: AstroCookieGetOptions | undefined = undefined,
): AstroCookie | undefined {
// Check for outgoing Set-Cookie values first
if (this.#outgoing?.has(key)) {
@@ -153,7 +153,7 @@ class AstroCookies implements AstroCookiesInterface {
const warning = new Error(
'Astro.cookies.set() was called after the cookies had already been sent to the browser.\n' +
'This may have happened if this method was called in an imported component.\n' +
- 'Please make sure that Astro.cookies.set() is only called in the frontmatter of the main page.'
+ 'Please make sure that Astro.cookies.set() is only called in the frontmatter of the main page.',
);
warning.name = 'Warning';
// eslint-disable-next-line no-console
diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts
index f0986e82c..0570d9d5d 100644
--- a/packages/astro/src/core/create-vite.ts
+++ b/packages/astro/src/core/create-vite.ts
@@ -75,7 +75,7 @@ const ONLY_DEV_EXTERNAL = [
/** Return a base vite config as a common starting point for all Vite commands. */
export async function createVite(
commandConfig: vite.InlineConfig,
- { settings, logger, mode, command, fs = nodeFs, sync }: CreateViteOptions
+ { settings, logger, mode, command, fs = nodeFs, sync }: CreateViteOptions,
): Promise<vite.InlineConfig> {
const astroPkgsConfig = await crawlFrameworkPkgs({
root: fileURLToPath(settings.config.root),
@@ -312,7 +312,7 @@ function isCommonNotAstro(dep: string): boolean {
(prefix) =>
prefix.startsWith('@')
? dep.startsWith(prefix)
- : dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/
+ : dep.substring(dep.lastIndexOf('/') + 1).startsWith(prefix), // check prefix omitting @scope/
)
);
}
diff --git a/packages/astro/src/core/dev/container.ts b/packages/astro/src/core/dev/container.ts
index aaf6506e9..fc401ca71 100644
--- a/packages/astro/src/core/dev/container.ts
+++ b/packages/astro/src/core/dev/container.ts
@@ -88,7 +88,7 @@ export async function createContainer({
include: rendererClientEntries,
},
},
- { settings, logger, mode: 'dev', command: 'dev', fs, sync: false }
+ { settings, logger, mode: 'dev', command: 'dev', fs, sync: false },
);
await runHookConfigDone({ settings, logger });
await syncInternal({
diff --git a/packages/astro/src/core/dev/dev.ts b/packages/astro/src/core/dev/dev.ts
index 25165f028..3d8424174 100644
--- a/packages/astro/src/core/dev/dev.ts
+++ b/packages/astro/src/core/dev/dev.ts
@@ -70,7 +70,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise<DevS
'SKIP_FORMAT',
await msg.newVersionAvailable({
latestVersion: version,
- })
+ }),
);
}
}
@@ -90,7 +90,7 @@ export default async function dev(inlineConfig: AstroInlineConfig): Promise<DevS
resolvedUrls: restart.container.viteServer.resolvedUrls || { local: [], network: [] },
host: restart.container.settings.config.server.host,
base: restart.container.settings.config.base,
- })
+ }),
);
if (isPrerelease) {
diff --git a/packages/astro/src/core/dev/restart.ts b/packages/astro/src/core/dev/restart.ts
index a30cbe7e3..71dd41f08 100644
--- a/packages/astro/src/core/dev/restart.ts
+++ b/packages/astro/src/core/dev/restart.ts
@@ -13,7 +13,7 @@ import { createContainer, startContainer } from './container.js';
async function createRestartedContainer(
container: Container,
- settings: AstroSettings
+ settings: AstroSettings,
): Promise<Container> {
const { logger, fs, inlineConfig } = container;
const newContainer = await createContainer({
@@ -34,7 +34,7 @@ const preferencesRE = /.*\.astro\/settings.json$/;
function shouldRestartContainer(
{ settings, inlineConfig, restartInFlight }: Container,
- changedFile: string
+ changedFile: string,
): boolean {
if (restartInFlight) return false;
@@ -59,7 +59,7 @@ function shouldRestartContainer(
if (!shouldRestart && settings.watchFiles.length > 0) {
// If the config file didn't change, check if any of the watched files changed.
shouldRestart = settings.watchFiles.some(
- (path) => vite.normalizePath(path) === vite.normalizePath(changedFile)
+ (path) => vite.normalizePath(path) === vite.normalizePath(changedFile),
);
}
@@ -81,7 +81,7 @@ async function restartContainer(container: Container): Promise<Container | Error
if (!isAstroConfigZodError(_err)) {
logger.error(
'config',
- formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n'
+ formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n',
);
}
// Inform connected clients of the config error
diff --git a/packages/astro/src/core/dev/update-check.ts b/packages/astro/src/core/dev/update-check.ts
index 852dc8a13..ff5444686 100644
--- a/packages/astro/src/core/dev/update-check.ts
+++ b/packages/astro/src/core/dev/update-check.ts
@@ -8,7 +8,7 @@ const CHECK_MS_INTERVAL = 1_036_800_000; // 12 days, give or take
let _latestVersion: string | undefined = undefined;
export async function fetchLatestAstroVersion(
- preferences: AstroPreferences | undefined
+ preferences: AstroPreferences | undefined,
): Promise<string> {
if (_latestVersion) {
return _latestVersion;
diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts
index cc723e649..56688877a 100644
--- a/packages/astro/src/core/errors/dev/vite.ts
+++ b/packages/astro/src/core/errors/dev/vite.ts
@@ -157,7 +157,7 @@ export async function getViteErrorPayload(err: ErrorWithMetadata): Promise<Astro
theme: cssVariablesTheme(),
transformers: [
transformerCompactLineOptions(
- err.loc?.line ? [{ line: err.loc.line, classes: ['error-line'] }] : undefined
+ err.loc?.line ? [{ line: err.loc.line, classes: ['error-line'] }] : undefined,
),
],
})
@@ -198,7 +198,7 @@ function transformerCompactLineOptions(
*/
line: number;
classes?: string[];
- }[] = []
+ }[] = [],
): ShikiTransformer {
return {
name: '@shikijs/transformers:compact-line-options',
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts
index a551af2fe..8415a9c0a 100644
--- a/packages/astro/src/core/errors/errors-data.ts
+++ b/packages/astro/src/core/errors/errors-data.ts
@@ -175,7 +175,7 @@ export const NoMatchingRenderer = {
componentName: string,
componentExtension: string | undefined,
plural: boolean,
- validRenderersCount: number
+ validRenderersCount: number,
) =>
`Unable to render \`${componentName}\`.
@@ -576,7 +576,7 @@ export const UnsupportedImageFormat = {
title: 'Unsupported image format',
message: (format: string, imagePath: string, supportedFormats: readonly string[]) =>
`Received unsupported format \`${format}\` from \`${imagePath}\`. Currently only ${supportedFormats.join(
- ', '
+ ', ',
)} are supported by our image services.`,
hint: "Using an `img` tag directly instead of the `Image` component might be what you're looking for.",
} satisfies ErrorData;
@@ -1488,7 +1488,7 @@ export const InvalidContentEntryFrontmatterError = {
message(collection: string, entryId: string, error: ZodError) {
return [
`**${String(collection)} → ${String(
- entryId
+ entryId,
)}** frontmatter does not match collection schema.`,
...error.errors.map((zodError) => zodError.message),
].join('\n');
@@ -1508,7 +1508,7 @@ export const InvalidContentEntrySlugError = {
title: 'Invalid content entry slug.',
message(collection: string, entryId: string) {
return `${String(collection)} → ${String(
- entryId
+ entryId,
)} has an invalid slug. \`slug\` must be a string.`;
},
hint: 'See https://docs.astro.build/en/guides/content-collections/ for more on the `slug` field.',
diff --git a/packages/astro/src/core/errors/overlay.ts b/packages/astro/src/core/errors/overlay.ts
index c4caa3e8d..0579f5b1f 100644
--- a/packages/astro/src/core/errors/overlay.ts
+++ b/packages/astro/src/core/errors/overlay.ts
@@ -677,7 +677,7 @@ class ErrorOverlay extends HTMLElement {
'afterend',
`\n<span class="line error-caret"><span style="padding-left:${
err.loc.column - 1
- }ch;">^</span></span>`
+ }ch;">^</span></span>`,
);
}
}
diff --git a/packages/astro/src/core/errors/utils.ts b/packages/astro/src/core/errors/utils.ts
index ef0a10b4f..05dd49071 100644
--- a/packages/astro/src/core/errors/utils.ts
+++ b/packages/astro/src/core/errors/utils.ts
@@ -9,7 +9,7 @@ import type { SSRError } from '../../@types/astro.js';
*/
export function positionAt(
offset: number,
- text: string
+ text: string,
): {
line: number;
column: number;
diff --git a/packages/astro/src/core/errors/zod-error-map.ts b/packages/astro/src/core/errors/zod-error-map.ts
index c3372b708..647fc0db3 100644
--- a/packages/astro/src/core/errors/zod-error-map.ts
+++ b/packages/astro/src/core/errors/zod-error-map.ts
@@ -32,7 +32,7 @@ export const errorMap: ZodErrorMap = (baseError, ctx) => {
let messages: string[] = [
prefix(
baseErrorPath,
- typeOrLiteralErrByPath.size ? 'Did not match union:' : 'Did not match union.'
+ typeOrLiteralErrByPath.size ? 'Did not match union:' : 'Did not match union.',
),
];
return {
@@ -46,8 +46,8 @@ export const errorMap: ZodErrorMap = (baseError, ctx) => {
key === baseErrorPath
? // Avoid printing the key again if it's a base error
`> ${getTypeOrLiteralMsg(error)}`
- : `> ${prefix(key, getTypeOrLiteralMsg(error))}`
- )
+ : `> ${prefix(key, getTypeOrLiteralMsg(error))}`,
+ ),
)
.join('\n'),
};
@@ -60,7 +60,7 @@ export const errorMap: ZodErrorMap = (baseError, ctx) => {
code: baseError.code,
received: (baseError as any).received,
expected: [baseError.expected],
- })
+ }),
),
};
} else if (baseError.message) {
@@ -76,11 +76,11 @@ const getTypeOrLiteralMsg = (error: TypeOrLiteralErrByPathEntry): string => {
switch (error.code) {
case 'invalid_type':
return `Expected type \`${unionExpectedVals(expectedDeduped)}\`, received ${JSON.stringify(
- error.received
+ error.received,
)}`;
case 'invalid_literal':
return `Expected \`${unionExpectedVals(expectedDeduped)}\`, received ${JSON.stringify(
- error.received
+ error.received,
)}`;
}
};
diff --git a/packages/astro/src/core/logger/core.ts b/packages/astro/src/core/logger/core.ts
index 8cef7c4e3..530399ac4 100644
--- a/packages/astro/src/core/logger/core.ts
+++ b/packages/astro/src/core/logger/core.ts
@@ -77,7 +77,7 @@ export function log(
level: LoggerLevel,
label: string | null,
message: string,
- newLine = true
+ newLine = true,
) {
const logLevel = opts.level;
const dest = opts.dest;
diff --git a/packages/astro/src/core/logger/node.ts b/packages/astro/src/core/logger/node.ts
index aa858cd52..f78d4d247 100644
--- a/packages/astro/src/core/logger/node.ts
+++ b/packages/astro/src/core/logger/node.ts
@@ -44,6 +44,6 @@ export function enableVerboseLogging() {
debug('cli', '--verbose flag enabled! Enabling: DEBUG="astro:*,vite:*"');
debug(
'cli',
- 'Tip: Set the DEBUG env variable directly for more control. Example: "DEBUG=astro:*,vite:* astro build".'
+ 'Tip: Set the DEBUG env variable directly for more control. Example: "DEBUG=astro:*,vite:* astro build".',
);
}
diff --git a/packages/astro/src/core/logger/vite.ts b/packages/astro/src/core/logger/vite.ts
index 317a03782..ed62adc8d 100644
--- a/packages/astro/src/core/logger/vite.ts
+++ b/packages/astro/src/core/logger/vite.ts
@@ -24,7 +24,7 @@ const viteShortcutHelpMsg = /press (.+?) to (.+)$/s;
export function createViteLogger(
astroLogger: AstroLogger,
- viteLogLevel: LogLevel = 'info'
+ viteLogLevel: LogLevel = 'info',
): ViteLogger {
const warnedMessages = new Set<string>();
const loggedErrors = new WeakSet<Error | Rollup.RollupError>();
diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts
index ed59e848f..8104d993b 100644
--- a/packages/astro/src/core/messages.ts
+++ b/packages/astro/src/core/messages.ts
@@ -93,7 +93,7 @@ export function serverStart({
const messages = [
'',
`${bgGreen(bold(` astro `))} ${green(`v${version}`)} ${dim(`ready in`)} ${Math.round(
- startupTime
+ startupTime,
)} ${dim('ms')}`,
'',
...localUrlMessages,
@@ -151,7 +151,7 @@ export function preferenceDefaultIntro(name: string) {
export function preferenceDefault(name: string, value: any) {
return `${yellow('◯')} ${name} has not been set. It defaults to ${bgYellow(
- black(` ${JSON.stringify(value)} `)
+ black(` ${JSON.stringify(value)} `),
)}\n`;
}
@@ -233,10 +233,10 @@ function getNetworkLogging(host: string | boolean): 'none' | 'host-to-expose' |
export function formatConfigErrorMessage(err: ZodError) {
const errorList = err.issues.map(
- (issue) => ` ! ${bold(issue.path.join('.'))} ${red(issue.message + '.')}`
+ (issue) => ` ! ${bold(issue.path.join('.'))} ${red(issue.message + '.')}`,
);
return `${red('[config]')} Astro found issue(s) with your configuration:\n${errorList.join(
- '\n'
+ '\n',
)}`;
}
@@ -246,7 +246,7 @@ const IRRELEVANT_STACK_REGEXP = /node_modules|astro[/\\]dist/g;
function formatErrorStackTrace(
err: Error | ErrorWithMetadata,
- showFullStacktrace: boolean
+ showFullStacktrace: boolean,
): string {
const stackLines = (err.stack || '').split('\n').filter((line) => STACK_LINE_REGEXP.test(line));
// If full details are required, just return the entire stack trace.
@@ -355,8 +355,8 @@ export function printHelp({
message.push(
linebreak(),
` ${bgGreen(black(` ${commandName} `))} ${green(
- `v${process.env.PACKAGE_VERSION ?? ''}`
- )} ${headline}`
+ `v${process.env.PACKAGE_VERSION ?? ''}`,
+ )} ${headline}`,
);
}
diff --git a/packages/astro/src/core/middleware/callMiddleware.ts b/packages/astro/src/core/middleware/callMiddleware.ts
index 5f2102f75..3bdc6052d 100644
--- a/packages/astro/src/core/middleware/callMiddleware.ts
+++ b/packages/astro/src/core/middleware/callMiddleware.ts
@@ -45,8 +45,8 @@ export async function callMiddleware(
apiContext: APIContext,
responseFunction: (
apiContext: APIContext,
- rewritePayload?: RewritePayload
- ) => Promise<Response> | Response
+ rewritePayload?: RewritePayload,
+ ) => Promise<Response> | Response,
): Promise<Response> {
let nextCalled = false;
let responseFunctionPromise: Promise<Response> | Response | undefined = undefined;
diff --git a/packages/astro/src/core/middleware/sequence.ts b/packages/astro/src/core/middleware/sequence.ts
index 8b2c2b49c..ee08381e6 100644
--- a/packages/astro/src/core/middleware/sequence.ts
+++ b/packages/astro/src/core/middleware/sequence.ts
@@ -39,7 +39,7 @@ export function sequence(...handlers: MiddlewareHandler[]): MiddlewareHandler {
} else {
newRequest = new Request(
new URL(payload, handleContext.url.origin),
- handleContext.request
+ handleContext.request,
);
}
carriedPayload = payload;
diff --git a/packages/astro/src/core/middleware/vite-plugin.ts b/packages/astro/src/core/middleware/vite-plugin.ts
index 4472e16c2..bb7b54e72 100644
--- a/packages/astro/src/core/middleware/vite-plugin.ts
+++ b/packages/astro/src/core/middleware/vite-plugin.ts
@@ -28,7 +28,7 @@ export function vitePluginMiddleware({ settings }: { settings: AstroSettings }):
async resolveId(id) {
if (id === MIDDLEWARE_MODULE_ID) {
const middlewareId = await this.resolve(
- `${decodeURI(settings.config.srcDir.pathname)}${MIDDLEWARE_PATH_SEGMENT_NAME}`
+ `${decodeURI(settings.config.srcDir.pathname)}${MIDDLEWARE_PATH_SEGMENT_NAME}`,
);
userMiddlewareIsPresent = !!middlewareId;
if (middlewareId) {
@@ -91,7 +91,7 @@ export const onRequest = sequence(
function createMiddlewareImports(
entrypoints: string[],
- prefix: string
+ prefix: string,
): {
importsCode: string;
sequenceCode: string;
@@ -114,7 +114,7 @@ function createMiddlewareImports(
export function vitePluginMiddlewareBuild(
opts: StaticBuildOptions,
- internals: BuildInternals
+ internals: BuildInternals,
): VitePlugin {
return {
name: '@astro/plugin-middleware-build',
diff --git a/packages/astro/src/core/preview/index.ts b/packages/astro/src/core/preview/index.ts
index e7e3282ff..b46cf1bec 100644
--- a/packages/astro/src/core/preview/index.ts
+++ b/packages/astro/src/core/preview/index.ts
@@ -40,7 +40,7 @@ export default async function preview(inlineConfig: AstroInlineConfig): Promise<
if (!fs.existsSync(settings.config.outDir)) {
const outDirPath = fileURLToPath(settings.config.outDir);
throw new Error(
- `[preview] The output directory ${outDirPath} does not exist. Did you run \`astro build\`?`
+ `[preview] The output directory ${outDirPath} does not exist. Did you run \`astro build\`?`,
);
}
const server = await createStaticPreviewServer(settings, logger);
@@ -51,7 +51,7 @@ export default async function preview(inlineConfig: AstroInlineConfig): Promise<
}
if (!settings.adapter.previewEntrypoint) {
throw new Error(
- `[preview] The ${settings.adapter.name} adapter does not support the preview command.`
+ `[preview] The ${settings.adapter.name} adapter does not support the preview command.`,
);
}
// We need to use require.resolve() here so that advanced package managers like pnpm
@@ -59,7 +59,7 @@ export default async function preview(inlineConfig: AstroInlineConfig): Promise<
// preview entrypoint of the integration package, relative to the user's project root.
const require = createRequire(settings.config.root);
const previewEntrypointUrl = pathToFileURL(
- require.resolve(settings.adapter.previewEntrypoint)
+ require.resolve(settings.adapter.previewEntrypoint),
).href;
const previewModule = (await import(previewEntrypointUrl)) as Partial<PreviewModule>;
diff --git a/packages/astro/src/core/preview/static-preview-server.ts b/packages/astro/src/core/preview/static-preview-server.ts
index 57aa48a1d..68ca3236b 100644
--- a/packages/astro/src/core/preview/static-preview-server.ts
+++ b/packages/astro/src/core/preview/static-preview-server.ts
@@ -18,7 +18,7 @@ export interface PreviewServer {
export default async function createStaticPreviewServer(
settings: AstroSettings,
- logger: Logger
+ logger: Logger,
): Promise<PreviewServer> {
const startServerTime = performance.now();
@@ -54,7 +54,7 @@ export default async function createStaticPreviewServer(
resolvedUrls: previewServer.resolvedUrls ?? { local: [], network: [] },
host: settings.config.server.host,
base: settings.config.base,
- })
+ }),
);
// Resolves once the server is closed
diff --git a/packages/astro/src/core/render-context.ts b/packages/astro/src/core/render-context.ts
index 4a824bfb0..97e1b25d9 100644
--- a/packages/astro/src/core/render-context.ts
+++ b/packages/astro/src/core/render-context.ts
@@ -56,7 +56,7 @@ export class RenderContext {
protected cookies = new AstroCookies(request),
public params = getParams(routeData, pathname),
protected url = new URL(request.url),
- public props: Props = {}
+ public props: Props = {},
) {
this.originalRoute = routeData;
}
@@ -92,7 +92,7 @@ export class RenderContext {
undefined,
undefined,
undefined,
- props
+ props,
);
}
@@ -109,7 +109,7 @@ export class RenderContext {
*/
async render(
componentInstance: ComponentInstance | undefined,
- slots: Record<string, any> = {}
+ slots: Record<string, any> = {},
): Promise<Response> {
const { cookies, middleware, pipeline } = this;
const { logger, serverLike, streaming } = pipeline;
@@ -143,7 +143,7 @@ export class RenderContext {
const [routeData, component] = await pipeline.tryRewrite(
payload,
this.request,
- this.originalRoute
+ this.originalRoute,
);
this.routeData = routeData;
componentInstance = component;
@@ -168,7 +168,7 @@ export class RenderContext {
props,
slots,
streaming,
- this.routeData
+ this.routeData,
);
} catch (e) {
// If there is an error in the page's frontmatter or instantiation of the RenderTemplate fails midway,
@@ -226,7 +226,7 @@ export class RenderContext {
const [routeData, component, newURL] = await this.pipeline.tryRewrite(
reroutePayload,
this.request,
- this.originalRoute
+ this.originalRoute,
);
this.routeData = routeData;
if (reroutePayload instanceof Request) {
@@ -374,20 +374,20 @@ export class RenderContext {
result: SSRResult,
astroStaticPartial: AstroGlobalPartial,
props: Record<string, any>,
- slotValues: Record<string, any> | null
+ slotValues: Record<string, any> | null,
): AstroGlobal {
let astroPagePartial;
// During rewriting, we must recompute the Astro global, because we need to purge the previous params/props/etc.
if (this.isRewriting) {
astroPagePartial = this.#astroPagePartial = this.createAstroPagePartial(
result,
- astroStaticPartial
+ astroStaticPartial,
);
} else {
// Create page partial with static partial so they can be cached together.
astroPagePartial = this.#astroPagePartial ??= this.createAstroPagePartial(
result,
- astroStaticPartial
+ astroStaticPartial,
);
}
// Create component-level partials. `Astro.self` is added by the compiler.
@@ -396,7 +396,7 @@ export class RenderContext {
// Create final object. `Astro.slots` will be lazily created.
const Astro: Omit<AstroGlobal, 'self' | 'slots'> = Object.assign(
Object.create(astroPagePartial),
- astroComponentPartial
+ astroComponentPartial,
);
// Handle `Astro.slots`
@@ -407,7 +407,7 @@ export class RenderContext {
_slots = new Slots(
result,
slotValues,
- this.pipeline.logger
+ this.pipeline.logger,
) as unknown as AstroGlobal['slots'];
}
return _slots;
@@ -419,7 +419,7 @@ export class RenderContext {
createAstroPagePartial(
result: SSRResult,
- astroStaticPartial: AstroGlobalPartial
+ astroStaticPartial: AstroGlobalPartial,
): Omit<AstroGlobal, 'props' | 'self' | 'slots'> {
const renderContext = this;
const { cookies, locals, params, pipeline, url } = this;
diff --git a/packages/astro/src/core/render/paginate.ts b/packages/astro/src/core/render/paginate.ts
index 591d739c5..e962d98d3 100644
--- a/packages/astro/src/core/render/paginate.ts
+++ b/packages/astro/src/core/render/paginate.ts
@@ -9,11 +9,11 @@ import type {
import { AstroError, AstroErrorData } from '../errors/index.js';
export function generatePaginateFunction(
- routeMatch: RouteData
+ routeMatch: RouteData,
): (...args: Parameters<PaginateFunction>) => ReturnType<PaginateFunction> {
return function paginateUtility(
data: any[],
- args: PaginateOptions<Props, Params> = {}
+ args: PaginateOptions<Props, Params> = {},
): ReturnType<PaginateFunction> {
let { pageSize: _pageSize, params: _params, props: _props } = args;
const pageSize = _pageSize || 10;
@@ -54,7 +54,7 @@ export function generatePaginateFunction(
...params,
page:
!includesFirstPageNumber && pageNum - 1 === 1 ? undefined : String(pageNum - 1),
- })
+ }),
);
const first =
pageNum === 1
@@ -63,7 +63,7 @@ export function generatePaginateFunction(
routeMatch.generate({
...params,
page: includesFirstPageNumber ? '1' : undefined,
- })
+ }),
);
const last =
pageNum === lastPage
diff --git a/packages/astro/src/core/render/params-and-props.ts b/packages/astro/src/core/render/params-and-props.ts
index fb02a997d..cf7d02d48 100644
--- a/packages/astro/src/core/render/params-and-props.ts
+++ b/packages/astro/src/core/render/params-and-props.ts
@@ -92,7 +92,7 @@ export function getParams(route: RouteData, pathname: string): Params {
function validatePrerenderEndpointCollision(
route: RouteData,
mod: ComponentInstance,
- params: Params
+ params: Params,
) {
if (route.type === 'endpoint' && mod.getStaticPaths) {
const lastSegment = route.segments[route.segments.length - 1];
diff --git a/packages/astro/src/core/render/renderer.ts b/packages/astro/src/core/render/renderer.ts
index 4b6015bbb..42cc8fd05 100644
--- a/packages/astro/src/core/render/renderer.ts
+++ b/packages/astro/src/core/render/renderer.ts
@@ -3,7 +3,7 @@ import type { ModuleLoader } from '../module-loader/index.js';
export async function loadRenderer(
renderer: AstroRenderer,
- moduleLoader: ModuleLoader
+ moduleLoader: ModuleLoader,
): Promise<SSRLoadedRenderer | undefined> {
const mod = await moduleLoader.import(renderer.serverEntrypoint);
if (typeof mod.default !== 'undefined') {
diff --git a/packages/astro/src/core/render/route-cache.ts b/packages/astro/src/core/render/route-cache.ts
index b6542222b..399795675 100644
--- a/packages/astro/src/core/render/route-cache.ts
+++ b/packages/astro/src/core/render/route-cache.ts
@@ -122,7 +122,7 @@ export function findPathItemByKey(
staticPaths: GetStaticPathsResultKeyed,
params: Params,
route: RouteData,
- logger: Logger
+ logger: Logger,
) {
const paramsKey = stringifyParams(params, route);
const matchedStaticPath = staticPaths.keyed.get(paramsKey);
diff --git a/packages/astro/src/core/render/slots.ts b/packages/astro/src/core/render/slots.ts
index b590237ba..ab87204e4 100644
--- a/packages/astro/src/core/render/slots.ts
+++ b/packages/astro/src/core/render/slots.ts
@@ -53,7 +53,7 @@ export class Slots {
if (!Array.isArray(args)) {
this.#logger.warn(
null,
- `Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])`
+ `Expected second parameter to be an array, received a ${typeof args}. If you're trying to pass an array as a single argument and getting unexpected results, make sure you're passing your array as a item of an array. Ex: Astro.slots.render('default', [["Hello", "World"]])`,
);
} else if (args.length > 0) {
const slotValue = this.#slots[name];
@@ -71,7 +71,7 @@ export class Slots {
// JSX
if (typeof component === 'function') {
return await renderJSX(result, (component as any)(...args)).then((res) =>
- res != null ? String(res) : res
+ res != null ? String(res) : res,
);
}
}
diff --git a/packages/astro/src/core/render/ssr-element.ts b/packages/astro/src/core/render/ssr-element.ts
index a82dd0bc9..7c766ee20 100644
--- a/packages/astro/src/core/render/ssr-element.ts
+++ b/packages/astro/src/core/render/ssr-element.ts
@@ -17,7 +17,7 @@ export function createAssetLink(href: string, base?: string, assetsPrefix?: Asse
export function createStylesheetElement(
stylesheet: StylesheetAsset,
base?: string,
- assetsPrefix?: AssetsPrefix
+ assetsPrefix?: AssetsPrefix,
): SSRElement {
if (stylesheet.type === 'inline') {
return {
@@ -38,7 +38,7 @@ export function createStylesheetElement(
export function createStylesheetElementSet(
stylesheets: StylesheetAsset[],
base?: string,
- assetsPrefix?: AssetsPrefix
+ assetsPrefix?: AssetsPrefix,
): Set<SSRElement> {
return new Set(stylesheets.map((s) => createStylesheetElement(s, base, assetsPrefix)));
}
@@ -46,7 +46,7 @@ export function createStylesheetElementSet(
export function createModuleScriptElement(
script: { type: 'inline' | 'external'; value: string },
base?: string,
- assetsPrefix?: AssetsPrefix
+ assetsPrefix?: AssetsPrefix,
): SSRElement {
if (script.type === 'external') {
return createModuleScriptElementWithSrc(script.value, base, assetsPrefix);
@@ -63,7 +63,7 @@ export function createModuleScriptElement(
export function createModuleScriptElementWithSrc(
src: string,
base?: string,
- assetsPrefix?: AssetsPrefix
+ assetsPrefix?: AssetsPrefix,
): SSRElement {
return {
props: {
@@ -77,9 +77,9 @@ export function createModuleScriptElementWithSrc(
export function createModuleScriptsSet(
scripts: { type: 'inline' | 'external'; value: string }[],
base?: string,
- assetsPrefix?: AssetsPrefix
+ assetsPrefix?: AssetsPrefix,
): Set<SSRElement> {
return new Set<SSRElement>(
- scripts.map((script) => createModuleScriptElement(script, base, assetsPrefix))
+ scripts.map((script) => createModuleScriptElement(script, base, assetsPrefix)),
);
}
diff --git a/packages/astro/src/core/request.ts b/packages/astro/src/core/request.ts
index 27cd67a0d..93b552901 100644
--- a/packages/astro/src/core/request.ts
+++ b/packages/astro/src/core/request.ts
@@ -55,7 +55,7 @@ export function createRequest({
// Examples include `:method`, `:scheme`, `:authority`, and `:path`.
// They are always prefixed with a colon to distinguish them from other headers, and it is an error to add the to a Headers object manually.
// See https://httpwg.org/specs/rfc7540.html#HttpRequest
- Object.entries(headers as Record<string, any>).filter(([name]) => !name.startsWith(':'))
+ Object.entries(headers as Record<string, any>).filter(([name]) => !name.startsWith(':')),
);
if (typeof url === 'string') url = new URL(url);
@@ -83,7 +83,7 @@ export function createRequest({
get() {
logger.warn(
null,
- `\`Astro.request.headers\` is unavailable in "static" output mode, and in prerendered pages within "hybrid" and "server" output modes. If you need access to request headers, make sure that \`output\` is configured as either \`"server"\` or \`output: "hybrid"\` in your config file, and that the page accessing the headers is rendered on-demand.`
+ `\`Astro.request.headers\` is unavailable in "static" output mode, and in prerendered pages within "hybrid" and "server" output modes. If you need access to request headers, make sure that \`output\` is configured as either \`"server"\` or \`output: "hybrid"\` in your config file, and that the page accessing the headers is rendered on-demand.`,
);
return _headers;
},
diff --git a/packages/astro/src/core/routing/astro-designed-error-pages.ts b/packages/astro/src/core/routing/astro-designed-error-pages.ts
index b834fb202..4e4b41b70 100644
--- a/packages/astro/src/core/routing/astro-designed-error-pages.ts
+++ b/packages/astro/src/core/routing/astro-designed-error-pages.ts
@@ -45,7 +45,7 @@ async function default404Page({ pathname }: { pathname: string }) {
tabTitle: '404: Not Found',
pathname,
}),
- { status: 404, headers: { 'Content-Type': 'text/html; charset=utf-8' } }
+ { status: 404, headers: { 'Content-Type': 'text/html; charset=utf-8' } },
);
}
// mark the function as an AstroComponentFactory for the rendering internals
diff --git a/packages/astro/src/core/routing/manifest/create.ts b/packages/astro/src/core/routing/manifest/create.ts
index a92d089ef..f9c19b9ed 100644
--- a/packages/astro/src/core/routing/manifest/create.ts
+++ b/packages/astro/src/core/routing/manifest/create.ts
@@ -133,7 +133,7 @@ export interface CreateRouteManifestParams {
function createFileBasedRoutes(
{ settings, cwd, fsMod }: CreateRouteManifestParams,
- logger: Logger
+ logger: Logger,
): RouteData[] {
const components: string[] = [];
const routes: RouteData[] = [];
@@ -150,7 +150,7 @@ function createFileBasedRoutes(
fs: typeof nodeFs,
dir: string,
parentSegments: RoutePart[][],
- parentParams: string[]
+ parentParams: string[],
) {
let items: Item[] = [];
const files = fs.readdirSync(dir);
@@ -172,8 +172,8 @@ function createFileBasedRoutes(
logger.warn(
null,
`Unsupported file type ${bold(
- resolved
- )} found. Prefix filename with an underscore (\`_\`) to ignore.`
+ resolved,
+ )} found. Prefix filename with an underscore (\`_\`) to ignore.`,
);
continue;
@@ -346,7 +346,7 @@ function createInjectedRoutes({ settings, cwd }: CreateRouteManifestParams): Pri
function createRedirectRoutes(
{ settings }: CreateRouteManifestParams,
routeMap: Map<string, RouteData>,
- logger: Logger
+ logger: Logger,
): PrioritizedRoutesData {
const { config } = settings;
const trailingSlash = config.trailingSlash;
@@ -387,7 +387,7 @@ function createRedirectRoutes(
if (/^https?:\/\//.test(destination)) {
logger.warn(
'redirects',
- `Redirecting to an external URL is not officially supported: ${from} -> ${destination}`
+ `Redirecting to an external URL is not officially supported: ${from} -> ${destination}`,
);
}
@@ -450,11 +450,11 @@ function detectRouteCollision(a: RouteData, b: RouteData, _config: AstroConfig,
// such that one of them will never be matched.
logger.warn(
'router',
- `The route "${a.route}" is defined in both "${a.component}" and "${b.component}". A static route cannot be defined more than once.`
+ `The route "${a.route}" is defined in both "${a.component}" and "${b.component}". A static route cannot be defined more than once.`,
);
logger.warn(
'router',
- 'A collision will result in an hard error in following versions of Astro.'
+ 'A collision will result in an hard error in following versions of Astro.',
);
return;
}
@@ -488,7 +488,7 @@ function detectRouteCollision(a: RouteData, b: RouteData, _config: AstroConfig,
// Both routes are guaranteed to collide such that one will never be matched.
logger.warn(
'router',
- `The route "${a.route}" is defined in both "${a.component}" and "${b.component}" using SSR mode. A dynamic SSR route cannot be defined more than once.`
+ `The route "${a.route}" is defined in both "${a.component}" and "${b.component}" using SSR mode. A dynamic SSR route cannot be defined more than once.`,
);
logger.warn('router', 'A collision will result in an hard error in following versions of Astro.');
}
@@ -496,7 +496,7 @@ function detectRouteCollision(a: RouteData, b: RouteData, _config: AstroConfig,
/** Create manifest of all static routes */
export function createRouteManifest(
params: CreateRouteManifestParams,
- logger: Logger
+ logger: Logger,
): ManifestData {
const { settings } = params;
const { config } = settings;
@@ -520,7 +520,7 @@ export function createRouteManifest(
const routes: RouteData[] = [
...injectedRoutes['legacy'].sort(routeComparator),
...[...fileBasedRoutes, ...injectedRoutes['normal'], ...redirectRoutes['normal']].sort(
- routeComparator
+ routeComparator,
),
...redirectRoutes['legacy'].sort(routeComparator),
];
@@ -543,7 +543,7 @@ export function createRouteManifest(
if (!index) {
let relativePath = path.relative(
fileURLToPath(settings.config.root),
- fileURLToPath(new URL('pages', settings.config.srcDir))
+ fileURLToPath(new URL('pages', settings.config.srcDir)),
);
throw new AstroError({
...MissingIndexForInternationalization,
diff --git a/packages/astro/src/core/routing/manifest/generator.ts b/packages/astro/src/core/routing/manifest/generator.ts
index 734aee726..4ab635ec6 100644
--- a/packages/astro/src/core/routing/manifest/generator.ts
+++ b/packages/astro/src/core/routing/manifest/generator.ts
@@ -8,7 +8,7 @@ import { compile } from 'path-to-regexp';
* @returns {Record<string, string | number | undefined>} The sanitized parameters object.
*/
function sanitizeParams(
- params: Record<string, string | number | undefined>
+ params: Record<string, string | number | undefined>,
): Record<string, string | number | undefined> {
return Object.fromEntries(
Object.entries(params).map(([key, value]) => {
@@ -16,13 +16,13 @@ function sanitizeParams(
return [key, value.normalize().replace(/#/g, '%23').replace(/\?/g, '%3F')];
}
return [key, value];
- })
+ }),
);
}
export function getRouteGenerator(
segments: RoutePart[][],
- addTrailingSlash: AstroConfig['trailingSlash']
+ addTrailingSlash: AstroConfig['trailingSlash'],
) {
const template = segments
.map((segment) => {
diff --git a/packages/astro/src/core/routing/manifest/pattern.ts b/packages/astro/src/core/routing/manifest/pattern.ts
index ee0cfaf65..65f223aa0 100644
--- a/packages/astro/src/core/routing/manifest/pattern.ts
+++ b/packages/astro/src/core/routing/manifest/pattern.ts
@@ -3,7 +3,7 @@ import type { AstroConfig, RoutePart } from '../../../@types/astro.js';
export function getPattern(
segments: RoutePart[][],
base: AstroConfig['base'],
- addTrailingSlash: AstroConfig['trailingSlash']
+ addTrailingSlash: AstroConfig['trailingSlash'],
) {
const pathname = segments
.map((segment) => {
diff --git a/packages/astro/src/core/routing/manifest/serialization.ts b/packages/astro/src/core/routing/manifest/serialization.ts
index 431febcb8..852aa703b 100644
--- a/packages/astro/src/core/routing/manifest/serialization.ts
+++ b/packages/astro/src/core/routing/manifest/serialization.ts
@@ -4,7 +4,7 @@ import { getRouteGenerator } from './generator.js';
export function serializeRouteData(
routeData: RouteData,
- trailingSlash: AstroConfig['trailingSlash']
+ trailingSlash: AstroConfig['trailingSlash'],
): SerializedRouteData {
return {
...routeData,
diff --git a/packages/astro/src/core/routing/validation.ts b/packages/astro/src/core/routing/validation.ts
index b68d5f3e8..1f11f55e6 100644
--- a/packages/astro/src/core/routing/validation.ts
+++ b/packages/astro/src/core/routing/validation.ts
@@ -26,7 +26,7 @@ export function validateDynamicRouteModule(
}: {
ssr: boolean;
route: RouteData;
- }
+ },
) {
if ((!ssr || route.prerender) && !mod.getStaticPaths) {
throw new AstroError({
@@ -40,7 +40,7 @@ export function validateDynamicRouteModule(
export function validateGetStaticPathsResult(
result: GetStaticPathsResult,
logger: Logger,
- route: RouteData
+ route: RouteData,
) {
if (!Array.isArray(result)) {
throw new AstroError({
@@ -57,7 +57,7 @@ export function validateGetStaticPathsResult(
throw new AstroError({
...AstroErrorData.InvalidGetStaticPathsEntry,
message: AstroErrorData.InvalidGetStaticPathsEntry.message(
- Array.isArray(pathObject) ? 'array' : typeof pathObject
+ Array.isArray(pathObject) ? 'array' : typeof pathObject,
),
});
}
@@ -81,14 +81,14 @@ export function validateGetStaticPathsResult(
logger.warn(
'router',
`getStaticPaths() returned an invalid path param: "${key}". A string, number or undefined value was expected, but got \`${JSON.stringify(
- val
- )}\`.`
+ val,
+ )}\`.`,
);
}
if (typeof val === 'string' && val === '') {
logger.warn(
'router',
- `getStaticPaths() returned an invalid path param: "${key}". \`undefined\` expected for an optional param, but got empty string.`
+ `getStaticPaths() returned an invalid path param: "${key}". \`undefined\` expected for an optional param, but got empty string.`,
);
}
}
diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts
index 7441aabc7..7b0d3268a 100644
--- a/packages/astro/src/core/sync/index.ts
+++ b/packages/astro/src/core/sync/index.ts
@@ -88,7 +88,7 @@ export async function syncInternal({
optional: true,
cwd,
},
- []
+ [],
);
try {
@@ -104,7 +104,7 @@ export async function syncInternal({
const error = createSafeError(err);
logger.error(
'types',
- formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n'
+ formatErrorMessage(collectErrorMetadata(error), logger.level() === 'debug') + '\n',
);
// Will return exit code 1 in CLI
throw error;
@@ -127,7 +127,7 @@ export async function syncInternal({
*/
async function syncContentCollections(
settings: AstroSettings,
- { logger, fs }: Required<Pick<SyncOptions, 'logger' | 'fs'>>
+ { logger, fs }: Required<Pick<SyncOptions, 'logger' | 'fs'>>,
): Promise<void> {
// Needed to load content config
const tempViteServer = await createServer(
@@ -138,8 +138,8 @@ async function syncContentCollections(
ssr: { external: [] },
logLevel: 'silent',
},
- { settings, logger, mode: 'build', command: 'build', fs, sync: true }
- )
+ { settings, logger, mode: 'build', command: 'build', fs, sync: true },
+ ),
);
// Patch `hot.send` to bubble up error events
@@ -186,7 +186,7 @@ async function syncContentCollections(
hint,
message: AstroErrorData.GenerateContentTypesError.message(safeError.message),
},
- { cause: e }
+ { cause: e },
);
} finally {
await tempViteServer.close();
diff --git a/packages/astro/src/core/sync/setup-env-ts.ts b/packages/astro/src/core/sync/setup-env-ts.ts
index 5a380271a..39eb062e5 100644
--- a/packages/astro/src/core/sync/setup-env-ts.ts
+++ b/packages/astro/src/core/sync/setup-env-ts.ts
@@ -16,8 +16,8 @@ function getDotAstroTypeReference({
const relativePath = normalizePath(
path.relative(
fileURLToPath(settings.config.srcDir),
- fileURLToPath(new URL(filename, settings.dotAstroDir))
- )
+ fileURLToPath(new URL(filename, settings.dotAstroDir)),
+ ),
);
return `/// <reference path=${JSON.stringify(relativePath)} />`;
@@ -36,7 +36,7 @@ export async function setUpEnvTs({
}) {
const envTsPath = new URL('env.d.ts', settings.config.srcDir);
const envTsPathRelativetoRoot = normalizePath(
- path.relative(fileURLToPath(settings.config.root), fileURLToPath(envTsPath))
+ path.relative(fileURLToPath(settings.config.root), fileURLToPath(envTsPath)),
);
const injectedTypes: Array<InjectedType> = [
diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts
index 7ee4e4261..2dd4ddd3b 100644
--- a/packages/astro/src/core/util.ts
+++ b/packages/astro/src/core/util.ts
@@ -55,7 +55,7 @@ export function getOutputFilename(astroConfig: AstroConfig, name: string, type:
/** is a specifier an npm package? */
export function parseNpmName(
- spec: string
+ spec: string,
): { scope?: string; name: string; subpath?: string } | undefined {
// not an npm package
if (!spec || spec[0] === '.' || spec[0] === '/') return undefined;
diff --git a/packages/astro/src/core/viteUtils.ts b/packages/astro/src/core/viteUtils.ts
index 61ca26a3d..bfe1eaadc 100644
--- a/packages/astro/src/core/viteUtils.ts
+++ b/packages/astro/src/core/viteUtils.ts
@@ -20,7 +20,7 @@ export function resolvePath(specifier: string, importer: string) {
export function rootRelativePath(
root: URL,
idOrUrl: URL | string,
- shouldPrependForwardSlash = true
+ shouldPrependForwardSlash = true,
) {
let id: string;
if (typeof idOrUrl !== 'string') {
diff --git a/packages/astro/src/env/runtime.ts b/packages/astro/src/env/runtime.ts
index af63d3e5c..a2017b617 100644
--- a/packages/astro/src/env/runtime.ts
+++ b/packages/astro/src/env/runtime.ts
@@ -27,12 +27,12 @@ export function getEnv(...args: Parameters<GetEnv>) {
export function createInvalidVariablesError(
key: string,
type: string,
- result: ValidationResultInvalid
+ result: ValidationResultInvalid,
) {
return new AstroError({
...AstroErrorData.EnvInvalidVariables,
message: AstroErrorData.EnvInvalidVariables.message(
- invalidVariablesToError([{ key, type, errors: result.errors }])
+ invalidVariablesToError([{ key, type, errors: result.errors }]),
),
});
}
diff --git a/packages/astro/src/env/schema.ts b/packages/astro/src/env/schema.ts
index bd88fbb46..2fc6b003b 100644
--- a/packages/astro/src/env/schema.ts
+++ b/packages/astro/src/env/schema.ts
@@ -37,7 +37,7 @@ const EnumSchema = z.object({
.string()
.refine((v) => !v.includes("'"), {
message: `The "'" character can't be used as an enum value`,
- })
+ }),
),
optional: z.boolean().optional(),
default: z.string().optional(),
diff --git a/packages/astro/src/env/validators.ts b/packages/astro/src/env/validators.ts
index 8776793cb..f506bb8e7 100644
--- a/packages/astro/src/env/validators.ts
+++ b/packages/astro/src/env/validators.ts
@@ -159,7 +159,7 @@ function selectValidator(options: EnvFieldType): ValueValidator {
export function validateEnvVariable(
value: string | undefined,
- options: EnvFieldType
+ options: EnvFieldType,
): ValidationResult {
const isOptional = options.optional || options.default !== undefined;
if (isOptional && value === undefined) {
diff --git a/packages/astro/src/env/vite-plugin-env.ts b/packages/astro/src/env/vite-plugin-env.ts
index 9aae2cf94..fdcd6ce40 100644
--- a/packages/astro/src/env/vite-plugin-env.ts
+++ b/packages/astro/src/env/vite-plugin-env.ts
@@ -45,7 +45,7 @@ export function astroEnv({
const loadedEnv = loadEnv(
mode === 'dev' ? 'development' : 'production',
fileURLToPath(settings.config.root),
- ''
+ '',
);
for (const [key, value] of Object.entries(loadedEnv)) {
if (value !== undefined) {
@@ -138,7 +138,7 @@ function validatePublicVariables({
function getTemplates(
schema: EnvSchema,
fs: typeof fsMod,
- validatedVariables: ReturnType<typeof validatePublicVariables>
+ validatedVariables: ReturnType<typeof validatePublicVariables>,
) {
let client = '';
let server = fs.readFileSync(MODULE_TEMPLATE_URL, 'utf-8');
diff --git a/packages/astro/src/events/error.ts b/packages/astro/src/events/error.ts
index 97b9f49db..fc8eddfd8 100644
--- a/packages/astro/src/events/error.ts
+++ b/packages/astro/src/events/error.ts
@@ -105,7 +105,7 @@ function getSafeErrorMessage(message: string | Function): string {
`${match1
.split(/\.?(?=[A-Z])/)
.join('_')
- .toUpperCase()}`
+ .toUpperCase()}`,
)
.replace(/\\`/g, '`');
}
diff --git a/packages/astro/src/events/session.ts b/packages/astro/src/events/session.ts
index d9c492cb0..18049ac04 100644
--- a/packages/astro/src/events/session.ts
+++ b/packages/astro/src/events/session.ts
@@ -41,7 +41,7 @@ type StringLiteral<T> = T extends string ? (string extends T ? never : T) : neve
* results in an error, to make sure generic user input is never measured directly.
*/
function measureStringLiteral<T extends string>(
- val: StringLiteral<T> | boolean | undefined
+ val: StringLiteral<T> | boolean | undefined,
): string | boolean | undefined {
return val;
}
@@ -62,7 +62,7 @@ function sanitizeConfigInfo(obj: object | undefined, validKeys: string[]): Confi
result[key] = measureIsDefined((obj as Record<string, unknown>)[key]);
return result;
},
- {} as Record<string, boolean | undefined>
+ {} as Record<string, boolean | undefined>,
);
}
@@ -82,23 +82,23 @@ function createAnonymousConfigInfo(userConfig: AstroUserConfig) {
...sanitizeConfigInfo(userConfig, Object.keys(AstroConfigSchema.shape)),
build: sanitizeConfigInfo(
userConfig.build,
- Object.keys(AstroConfigSchema.shape.build._def.innerType.shape)
+ Object.keys(AstroConfigSchema.shape.build._def.innerType.shape),
),
image: sanitizeConfigInfo(
userConfig.image,
- Object.keys(AstroConfigSchema.shape.image._def.innerType.shape)
+ Object.keys(AstroConfigSchema.shape.image._def.innerType.shape),
),
markdown: sanitizeConfigInfo(
userConfig.markdown,
- Object.keys(AstroConfigSchema.shape.markdown._def.innerType.shape)
+ Object.keys(AstroConfigSchema.shape.markdown._def.innerType.shape),
),
experimental: sanitizeConfigInfo(
userConfig.experimental,
- Object.keys(AstroConfigSchema.shape.experimental._def.innerType.shape)
+ Object.keys(AstroConfigSchema.shape.experimental._def.innerType.shape),
),
legacy: sanitizeConfigInfo(
userConfig.legacy,
- Object.keys(AstroConfigSchema.shape.legacy._def.innerType.shape)
+ Object.keys(AstroConfigSchema.shape.legacy._def.innerType.shape),
),
vite: userConfig.vite
? sanitizeConfigInfo(userConfig.vite, Object.keys(userConfig.vite))
@@ -123,7 +123,7 @@ function createAnonymousConfigInfo(userConfig: AstroUserConfig) {
export function eventCliSession(
cliCommand: string,
userConfig: AstroUserConfig,
- flags?: Record<string, any>
+ flags?: Record<string, any>,
): { eventName: string; payload: EventPayload }[] {
// Filter out yargs default `_` flag which is the cli command
const cliFlags = flags ? Object.keys(flags).filter((name) => name != '_') : undefined;
diff --git a/packages/astro/src/i18n/index.ts b/packages/astro/src/i18n/index.ts
index 28ddfcf51..aa38b63bb 100644
--- a/packages/astro/src/i18n/index.ts
+++ b/packages/astro/src/i18n/index.ts
@@ -387,7 +387,7 @@ export function createMiddleware(
i18nManifest: SSRManifest['i18n'],
base: SSRManifest['base'],
trailingSlash: SSRManifest['trailingSlash'],
- format: SSRManifest['buildFormat']
+ format: SSRManifest['buildFormat'],
) {
return createI18nMiddleware(i18nManifest, base, trailingSlash, format);
}
diff --git a/packages/astro/src/i18n/middleware.ts b/packages/astro/src/i18n/middleware.ts
index 9f9c7348e..097332805 100644
--- a/packages/astro/src/i18n/middleware.ts
+++ b/packages/astro/src/i18n/middleware.ts
@@ -15,7 +15,7 @@ export function createI18nMiddleware(
i18n: SSRManifest['i18n'],
base: SSRManifest['base'],
trailingSlash: SSRManifest['trailingSlash'],
- format: SSRManifest['buildFormat']
+ format: SSRManifest['buildFormat'],
): MiddlewareHandler {
if (!i18n) return (_, next) => next();
const payload: MiddlewarePayload = {
diff --git a/packages/astro/src/i18n/utils.ts b/packages/astro/src/i18n/utils.ts
index e6b91c589..052fe01fc 100644
--- a/packages/astro/src/i18n/utils.ts
+++ b/packages/astro/src/i18n/utils.ts
@@ -183,7 +183,7 @@ export type RoutingStrategies =
| 'domains-prefix-always-no-redirect';
export function toRoutingStrategy(
routing: NonNullable<AstroConfig['i18n']>['routing'],
- domains: NonNullable<AstroConfig['i18n']>['domains']
+ domains: NonNullable<AstroConfig['i18n']>['domains'],
) {
let strategy: RoutingStrategies;
const hasDomains = domains ? Object.keys(domains).length > 0 : false;
diff --git a/packages/astro/src/integrations/features-validation.ts b/packages/astro/src/integrations/features-validation.ts
index 2b45e0461..87de3592b 100644
--- a/packages/astro/src/integrations/features-validation.ts
+++ b/packages/astro/src/integrations/features-validation.ts
@@ -34,7 +34,7 @@ export function validateSupportedFeatures(
featureMap: AstroFeatureMap,
config: AstroConfig,
adapterFeatures: AstroAdapterFeatures | undefined,
- logger: Logger
+ logger: Logger,
): ValidationResult {
const {
assets = UNSUPPORTED_ASSETS_FEATURE,
@@ -51,7 +51,7 @@ export function validateSupportedFeatures(
adapterName,
logger,
'staticOutput',
- () => config?.output === 'static'
+ () => config?.output === 'static',
);
validationResult.hybridOutput = validateSupportKind(
@@ -59,7 +59,7 @@ export function validateSupportedFeatures(
adapterName,
logger,
'hybridOutput',
- () => config?.output === 'hybrid'
+ () => config?.output === 'hybrid',
);
validationResult.serverOutput = validateSupportKind(
@@ -67,7 +67,7 @@ export function validateSupportedFeatures(
adapterName,
logger,
'serverOutput',
- () => config?.output === 'server'
+ () => config?.output === 'server',
);
validationResult.assets = validateAssetsFeature(assets, adapterName, config, logger);
@@ -79,12 +79,12 @@ export function validateSupportedFeatures(
'i18nDomains',
() => {
return config?.output === 'server' && !config?.site;
- }
+ },
);
if (adapterFeatures?.functionPerRoute) {
logger.error(
'config',
- 'The Astro feature `i18nDomains` is incompatible with the Adapter feature `functionPerRoute`'
+ 'The Astro feature `i18nDomains` is incompatible with the Adapter feature `functionPerRoute`',
);
}
}
@@ -94,7 +94,7 @@ export function validateSupportedFeatures(
adapterName,
logger,
'astro:env getSecret',
- () => config?.experimental?.env !== undefined
+ () => config?.experimental?.env !== undefined,
);
return validationResult;
@@ -105,7 +105,7 @@ function validateSupportKind(
adapterName: string,
logger: Logger,
featureName: string,
- hasCorrectConfig: () => boolean
+ hasCorrectConfig: () => boolean,
): boolean {
if (supportKind === STABLE) {
return true;
@@ -130,14 +130,14 @@ function featureIsUnsupported(adapterName: string, logger: Logger, featureName:
function featureIsExperimental(adapterName: string, logger: Logger, featureName: string) {
logger.warn(
'config',
- `The feature "${featureName}" is experimental and subject to change (used by ${adapterName}).`
+ `The feature "${featureName}" is experimental and subject to change (used by ${adapterName}).`,
);
}
function featureIsDeprecated(adapterName: string, logger: Logger, featureName: string) {
logger.warn(
'config',
- `The feature "${featureName}" is deprecated and will be removed in the future (used by ${adapterName}).`
+ `The feature "${featureName}" is deprecated and will be removed in the future (used by ${adapterName}).`,
);
}
@@ -148,7 +148,7 @@ function validateAssetsFeature(
assets: AstroAssetsFeature,
adapterName: string,
config: AstroConfig,
- logger: Logger
+ logger: Logger,
): boolean {
const {
supportKind = UNSUPPORTED,
@@ -158,7 +158,7 @@ function validateAssetsFeature(
if (config?.image?.service?.entrypoint === SHARP_SERVICE && !isSharpCompatible) {
logger.warn(
null,
- `The currently selected adapter \`${adapterName}\` is not compatible with the image service "Sharp".`
+ `The currently selected adapter \`${adapterName}\` is not compatible with the image service "Sharp".`,
);
return false;
}
@@ -166,7 +166,7 @@ function validateAssetsFeature(
if (config?.image?.service?.entrypoint === SQUOOSH_SERVICE && !isSquooshCompatible) {
logger.warn(
null,
- `The currently selected adapter \`${adapterName}\` is not compatible with the image service "Squoosh".`
+ `The currently selected adapter \`${adapterName}\` is not compatible with the image service "Squoosh".`,
);
return false;
}
diff --git a/packages/astro/src/integrations/hooks.ts b/packages/astro/src/integrations/hooks.ts
index 33a7c7c0c..9b2859e48 100644
--- a/packages/astro/src/integrations/hooks.ts
+++ b/packages/astro/src/integrations/hooks.ts
@@ -39,8 +39,8 @@ async function withTakingALongTimeMsg<T>({
logger.info(
'build',
`Waiting for integration ${bold(JSON.stringify(name))}, hook ${bold(
- JSON.stringify(hookName)
- )}...`
+ JSON.stringify(hookName),
+ )}...`,
);
}, timeoutMs);
const result = await hookResult;
@@ -176,7 +176,7 @@ export async function runHookConfigSetup({
if (injectRoute.entrypoint == null && 'entryPoint' in injectRoute) {
logger.warn(
null,
- `The injected route "${injectRoute.pattern}" by ${integration.name} specifies the entry point with the "entryPoint" property. This property is deprecated, please use "entrypoint" instead.`
+ `The injected route "${injectRoute.pattern}" by ${integration.name} specifies the entry point with the "entryPoint" property. This property is deprecated, please use "entrypoint" instead.`,
);
injectRoute.entrypoint = injectRoute.entryPoint as string;
}
@@ -195,26 +195,26 @@ export async function runHookConfigSetup({
addClientDirective: ({ name, entrypoint }) => {
if (updatedSettings.clientDirectives.has(name) || addedClientDirectives.has(name)) {
throw new Error(
- `The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.`
+ `The "${integration.name}" integration is trying to add the "${name}" client directive, but it already exists.`,
);
}
// TODO: this should be performed after astro:config:done
addedClientDirectives.set(
name,
- buildClientDirectiveEntrypoint(name, entrypoint, settings.config.root)
+ buildClientDirectiveEntrypoint(name, entrypoint, settings.config.root),
);
},
addMiddleware: ({ order, entrypoint }) => {
if (typeof updatedSettings.middlewares[order] === 'undefined') {
throw new Error(
- `The "${integration.name}" integration is trying to add middleware but did not specify an order.`
+ `The "${integration.name}" integration is trying to add middleware but did not specify an order.`,
);
}
logger.debug(
'middleware',
`The integration ${integration.name} has added middleware that runs ${
order === 'pre' ? 'before' : 'after'
- } any application middleware you define.`
+ } any application middleware you define.`,
);
updatedSettings.middlewares[order].push(entrypoint);
},
@@ -296,12 +296,12 @@ export async function runHookConfigDone({
setAdapter(adapter) {
if (settings.adapter && settings.adapter.name !== adapter.name) {
throw new Error(
- `Integration "${integration.name}" conflicts with "${settings.adapter.name}". You can only configure one deployment integration.`
+ `Integration "${integration.name}" conflicts with "${settings.adapter.name}". You can only configure one deployment integration.`,
);
}
if (!adapter.supportedAstroFeatures) {
throw new Error(
- `The adapter ${adapter.name} doesn't provide a feature map. It is required in Astro 4.0.`
+ `The adapter ${adapter.name} doesn't provide a feature map. It is required in Astro 4.0.`,
);
} else {
const validationResult = validateSupportedFeatures(
@@ -310,7 +310,7 @@ export async function runHookConfigDone({
settings.config,
// SAFETY: we checked before if it's not present, and we throw an error
adapter.adapterFeatures,
- logger
+ logger,
);
for (const [featureName, supported] of Object.entries(validationResult)) {
// If `supported` / `validationResult[featureName]` only allows boolean,
@@ -320,7 +320,7 @@ export async function runHookConfigDone({
if (!supported && featureName !== 'assets') {
logger.error(
null,
- `The adapter ${adapter.name} doesn't support the feature ${featureName}. Your project won't be built. You should not use it.`
+ `The adapter ${adapter.name} doesn't support the feature ${featureName}. Your project won't be built. You should not use it.`,
);
}
}
diff --git a/packages/astro/src/jsx/babel.ts b/packages/astro/src/jsx/babel.ts
index 02280031b..648831481 100644
--- a/packages/astro/src/jsx/babel.ts
+++ b/packages/astro/src/jsx/babel.ts
@@ -58,15 +58,15 @@ function jsxAttributeToString(attr: t.JSXAttribute): string {
function addClientMetadata(
node: t.JSXElement,
- meta: { resolvedPath: string; path: string; name: string }
+ meta: { resolvedPath: string; path: string; name: string },
) {
const existingAttributes = node.openingElement.attributes.map((attr) =>
- t.isJSXAttribute(attr) ? jsxAttributeToString(attr) : null
+ t.isJSXAttribute(attr) ? jsxAttributeToString(attr) : null,
);
if (!existingAttributes.find((attr) => attr === 'client:component-path')) {
const componentPath = t.jsxAttribute(
t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-path')),
- t.stringLiteral(meta.resolvedPath)
+ t.stringLiteral(meta.resolvedPath),
);
node.openingElement.attributes.push(componentPath);
}
@@ -76,13 +76,13 @@ function addClientMetadata(
}
const componentExport = t.jsxAttribute(
t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-export')),
- t.stringLiteral(meta.name)
+ t.stringLiteral(meta.name),
);
node.openingElement.attributes.push(componentExport);
}
if (!existingAttributes.find((attr) => attr === 'client:component-hydration')) {
const staticMarker = t.jsxAttribute(
- t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-hydration'))
+ t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-hydration')),
);
node.openingElement.attributes.push(staticMarker);
}
@@ -90,30 +90,30 @@ function addClientMetadata(
function addClientOnlyMetadata(
node: t.JSXElement,
- meta: { resolvedPath: string; path: string; name: string }
+ meta: { resolvedPath: string; path: string; name: string },
) {
const tagName = getTagName(node);
node.openingElement = t.jsxOpeningElement(
t.jsxIdentifier(ClientOnlyPlaceholder),
- node.openingElement.attributes
+ node.openingElement.attributes,
);
if (node.closingElement) {
node.closingElement = t.jsxClosingElement(t.jsxIdentifier(ClientOnlyPlaceholder));
}
const existingAttributes = node.openingElement.attributes.map((attr) =>
- t.isJSXAttribute(attr) ? jsxAttributeToString(attr) : null
+ t.isJSXAttribute(attr) ? jsxAttributeToString(attr) : null,
);
if (!existingAttributes.find((attr) => attr === 'client:display-name')) {
const displayName = t.jsxAttribute(
t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('display-name')),
- t.stringLiteral(tagName)
+ t.stringLiteral(tagName),
);
node.openingElement.attributes.push(displayName);
}
if (!existingAttributes.find((attr) => attr === 'client:component-path')) {
const componentPath = t.jsxAttribute(
t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-path')),
- t.stringLiteral(meta.resolvedPath)
+ t.stringLiteral(meta.resolvedPath),
);
node.openingElement.attributes.push(componentPath);
}
@@ -123,13 +123,13 @@ function addClientOnlyMetadata(
}
const componentExport = t.jsxAttribute(
t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-export')),
- t.stringLiteral(meta.name)
+ t.stringLiteral(meta.name),
);
node.openingElement.attributes.push(componentExport);
}
if (!existingAttributes.find((attr) => attr === 'client:component-hydration')) {
const staticMarker = t.jsxAttribute(
- t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-hydration'))
+ t.jsxNamespacedName(t.jsxIdentifier('client'), t.jsxIdentifier('component-hydration')),
);
node.openingElement.attributes.push(staticMarker);
}
@@ -151,8 +151,8 @@ export default function astroJSX(): PluginObj {
0,
t.importDeclaration(
[t.importSpecifier(t.identifier('Fragment'), t.identifier('Fragment'))],
- t.stringLiteral('astro/jsx-runtime')
- )
+ t.stringLiteral('astro/jsx-runtime'),
+ ),
);
},
},
@@ -242,8 +242,8 @@ export default function astroJSX(): PluginObj {
} else {
throw new Error(
`Unable to match <${getTagName(
- parentNode
- )}> with client:* directive to an import statement!`
+ parentNode,
+ )}> with client:* directive to an import statement!`,
);
}
},
@@ -286,7 +286,7 @@ export default function astroJSX(): PluginObj {
if (name.startsWith('client:')) {
// eslint-disable-next-line
console.warn(
- `You are attempting to render <${displayName} ${name} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
+ `You are attempting to render <${displayName} ${name} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`,
);
}
}
diff --git a/packages/astro/src/jsx/rehype.ts b/packages/astro/src/jsx/rehype.ts
index c18124796..6dcb08d0b 100644
--- a/packages/astro/src/jsx/rehype.ts
+++ b/packages/astro/src/jsx/rehype.ts
@@ -47,14 +47,14 @@ export const rehypeAnalyzeAstroMetadata: RehypePlugin = () => {
// work on Astro components as it's server-side only. Warn the user about this.
if (matchedImport.path.endsWith('.astro')) {
const clientAttribute = node.attributes.find(
- (attr) => attr.type === 'mdxJsxAttribute' && attr.name.startsWith('client:')
+ (attr) => attr.type === 'mdxJsxAttribute' && attr.name.startsWith('client:'),
) as MdxJsxAttribute | undefined;
if (clientAttribute) {
// eslint-disable-next-line
console.warn(
`You are attempting to render <${node.name!} ${
clientAttribute.name
- } />, but ${node.name!} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
+ } />, but ${node.name!} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`,
);
}
}
@@ -165,13 +165,13 @@ function isComponent(tagName: string) {
function hasClientDirective(node: MdxJsxFlowElementHast | MdxJsxTextElementHast) {
return node.attributes.some(
- (attr) => attr.type === 'mdxJsxAttribute' && attr.name.startsWith('client:')
+ (attr) => attr.type === 'mdxJsxAttribute' && attr.name.startsWith('client:'),
);
}
function hasClientOnlyDirective(node: MdxJsxFlowElementHast | MdxJsxTextElementHast) {
return node.attributes.some(
- (attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'client:only'
+ (attr) => attr.type === 'mdxJsxAttribute' && attr.name === 'client:only',
);
}
@@ -202,7 +202,7 @@ type MatchedImport = { name: string; path: string };
*/
function findMatchingImport(
tagName: string,
- imports: Map<string, Set<ImportSpecifier>>
+ imports: Map<string, Set<ImportSpecifier>>,
): MatchedImport | undefined {
const tagSpecifier = tagName.split('.')[0];
for (const [source, specs] of imports) {
@@ -239,7 +239,7 @@ function findMatchingImport(
function addClientMetadata(
node: MdxJsxFlowElementHast | MdxJsxTextElementHast,
meta: MatchedImport,
- resolvedPath: string
+ resolvedPath: string,
) {
const attributeNames = node.attributes
.map((attr) => (attr.type === 'mdxJsxAttribute' ? attr.name : null))
@@ -274,7 +274,7 @@ function addClientMetadata(
function addClientOnlyMetadata(
node: MdxJsxFlowElementHast | MdxJsxTextElementHast,
meta: { path: string; name: string },
- resolvedPath: string
+ resolvedPath: string,
) {
const attributeNames = node.attributes
.map((attr) => (attr.type === 'mdxJsxAttribute' ? attr.name : null))
diff --git a/packages/astro/src/jsx/server.ts b/packages/astro/src/jsx/server.ts
index f460094e1..73b584bae 100644
--- a/packages/astro/src/jsx/server.ts
+++ b/packages/astro/src/jsx/server.ts
@@ -10,7 +10,7 @@ const slotName = (str: string) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w
export async function check(
Component: any,
props: any,
- { default: children = null, ...slotted } = {}
+ { default: children = null, ...slotted } = {},
) {
if (typeof Component !== 'function') return false;
const slots: Record<string, any> = {};
@@ -31,7 +31,7 @@ export async function renderToStaticMarkup(
this: any,
Component: any,
props = {},
- { default: children = null, ...slotted } = {}
+ { default: children = null, ...slotted } = {},
) {
const slots: Record<string, any> = {};
for (const [key, value] of Object.entries(slotted)) {
diff --git a/packages/astro/src/preferences/index.ts b/packages/astro/src/preferences/index.ts
index 48493c0f3..9318824bf 100644
--- a/packages/astro/src/preferences/index.ts
+++ b/packages/astro/src/preferences/index.ts
@@ -49,12 +49,12 @@ export interface PreferenceList extends Record<PreferenceLocation, DeepPartial<P
export interface AstroPreferences {
get<Key extends PreferenceKey>(
key: Key,
- opts?: PreferenceOptions
+ opts?: PreferenceOptions,
): Promise<GetDotKey<Preferences, Key>>;
set<Key extends PreferenceKey>(
key: Key,
value: GetDotKey<Preferences, Key>,
- opts?: PreferenceOptions
+ opts?: PreferenceOptions,
): Promise<void>;
getAll(): Promise<PublicPreferences>;
list(opts?: PreferenceOptions): Promise<PreferenceList>;
@@ -104,7 +104,7 @@ export default function createPreferences(config: AstroConfig): AstroPreferences
{},
DEFAULT_PREFERENCES,
stores['global'].getAll(),
- stores['project'].getAll()
+ stores['project'].getAll(),
);
const { _variables, ...prefs } = allPrefs;
@@ -122,7 +122,7 @@ export default function createPreferences(config: AstroConfig): AstroPreferences
function mapFrom(defaults: Preferences, astroConfig: Record<string, any>) {
return Object.fromEntries(
- Object.entries(defaults).map(([key, _]) => [key, astroConfig[key]])
+ Object.entries(defaults).map(([key, _]) => [key, astroConfig[key]]),
);
}
},
diff --git a/packages/astro/src/preferences/store.ts b/packages/astro/src/preferences/store.ts
index d8e8895e7..c999566e8 100644
--- a/packages/astro/src/preferences/store.ts
+++ b/packages/astro/src/preferences/store.ts
@@ -8,7 +8,7 @@ export class PreferenceStore {
constructor(
private dir: string,
- filename = 'settings.json'
+ filename = 'settings.json',
) {
this.file = path.join(this.dir, filename);
}
diff --git a/packages/astro/src/prefetch/index.ts b/packages/astro/src/prefetch/index.ts
index bdf8676e7..177945f37 100644
--- a/packages/astro/src/prefetch/index.ts
+++ b/packages/astro/src/prefetch/index.ts
@@ -62,7 +62,7 @@ function initTapStrategy() {
prefetch(e.target.href, { ignoreSlowConnection: true });
}
},
- { passive: true }
+ { passive: true },
);
}
}
@@ -81,7 +81,7 @@ function initHoverStrategy() {
handleHoverIn(e);
}
},
- { passive: true }
+ { passive: true },
);
document.body.addEventListener('focusout', handleHoverOut, { passive: true });
@@ -159,7 +159,7 @@ function createViewportIntersectionObserver() {
observer.unobserve(anchor);
timeouts.delete(anchor);
prefetch(anchor.href);
- }, 300) as unknown as number
+ }, 300) as unknown as number,
);
} else {
// If exited viewport but haven't prefetched, cancel it
diff --git a/packages/astro/src/prefetch/vite-plugin-prefetch.ts b/packages/astro/src/prefetch/vite-plugin-prefetch.ts
index 9e56536d9..d64c6d500 100644
--- a/packages/astro/src/prefetch/vite-plugin-prefetch.ts
+++ b/packages/astro/src/prefetch/vite-plugin-prefetch.ts
@@ -52,7 +52,7 @@ export default function astroPrefetch({ settings }: { settings: AstroSettings })
.replace('__PREFETCH_DEFAULT_STRATEGY__', JSON.stringify(prefetch?.defaultStrategy))
.replace(
'__EXPERIMENTAL_CLIENT_PRERENDER__',
- JSON.stringify(settings.config.experimental.clientPrerender)
+ JSON.stringify(settings.config.experimental.clientPrerender),
);
}
},
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/astro.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/astro.ts
index c70338ea8..e63667a12 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/astro.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/astro.ts
@@ -368,12 +368,12 @@ export default {
(link) =>
`<a href="${link.link}" target="_blank"><astro-dev-toolbar-icon ${
isDefinedIcon(link.icon) ? `icon="${link.icon}">` : `>${link.icon}`
- }</astro-dev-toolbar-icon>${link.name}</a>`
+ }</astro-dev-toolbar-icon>${link.name}</a>`,
)
.join('')}
</section>
</div>
- `
+ `,
);
const copyDebugButton =
@@ -381,7 +381,7 @@ export default {
copyDebugButton?.addEventListener('click', () => {
navigator.clipboard.writeText(
- '```\n' + (window as DevToolbarMetadata).__astro_dev_toolbar__.debugInfo + '\n```'
+ '```\n' + (window as DevToolbarMetadata).__astro_dev_toolbar__.debugInfo + '\n```',
);
copyDebugButton.textContent = 'Copied to clipboard!';
@@ -431,7 +431,7 @@ export default {
integrationImage.append(icon);
integrationImage.style.setProperty(
'--integration-image-background',
- colorForIntegration()
+ colorForIntegration(),
);
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/index.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/index.ts
index 703b0a523..6a6aba42d 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/index.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/index.ts
@@ -32,7 +32,7 @@ export default {
async init(canvas, eventTarget) {
let audits: Audit[] = [];
let auditWindow = document.createElement(
- 'astro-dev-toolbar-audit-window'
+ 'astro-dev-toolbar-audit-window',
) as DevToolbarAuditListWindow;
let hasCreatedUI = false;
@@ -60,7 +60,7 @@ export default {
if (showState) createAuditsUI();
});
},
- { timeout: 300 }
+ { timeout: 300 },
);
} else {
// Fallback for old versions of Safari, we'll assume that things are less likely to be busy after 150ms.
@@ -174,7 +174,7 @@ export default {
detail: {
state: audits.length > 0,
},
- })
+ }),
);
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts
index c26236c16..a20e14038 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts
@@ -194,14 +194,14 @@ const input_type_to_implicit_role = new Map([
const ariaAttributes = new Set(
'activedescendant atomic autocomplete busy checked colcount colindex colspan controls current describedby description details disabled dropeffect errormessage expanded flowto grabbed haspopup hidden invalid keyshortcuts label labelledby level live modal multiline multiselectable orientation owns placeholder posinset pressed readonly relevant required roledescription rowcount rowindex rowspan selected setsize sort valuemax valuemin valuenow valuetext'.split(
- ' '
- )
+ ' ',
+ ),
);
const ariaRoles = new Set(
'alert alertdialog application article banner button cell checkbox columnheader combobox complementary contentinfo definition dialog directory document feed figure form grid gridcell group heading img link list listbox listitem log main marquee math menu menubar menuitem menuitemcheckbox menuitemradio navigation none note option presentation progressbar radio radiogroup region row rowgroup rowheader scrollbar search searchbox separator slider spinbutton status switch tab tablist tabpanel textbox timer toolbar tooltip tree treegrid treeitem'.split(
- ' '
- )
+ ' ',
+ ),
);
function isInteractive(element: Element): boolean {
@@ -315,7 +315,7 @@ export const a11y: AuditRuleWithSelector[] = [
if (!tracks.length) return true;
const hasCaptionTrack = Array.from(tracks).some(
- (track) => track.getAttribute('kind') === 'captions'
+ (track) => track.getAttribute('kind') === 'captions',
);
return !hasCaptionTrack;
@@ -338,7 +338,7 @@ export const a11y: AuditRuleWithSelector[] = [
a11y_required_attributes[element.localName as keyof typeof a11y_required_attributes];
const missingAttributes = requiredAttributes.filter(
- (attribute) => !element.hasAttribute(attribute)
+ (attribute) => !element.hasAttribute(attribute),
);
return `${
@@ -561,7 +561,7 @@ export const a11y: AuditRuleWithSelector[] = [
return `${
element.localName
} element has ARIA attributes that are not supported by its role (${role}): ${unsupported.join(
- ', '
+ ', ',
)}`;
},
selector: '*',
@@ -575,7 +575,7 @@ export const a11y: AuditRuleWithSelector[] = [
const attributes = getAttributeObject(element);
const unsupportedAttributes = aria.keys().filter((attribute) => !(attribute in props));
const invalidAttributes: string[] = Object.keys(attributes).filter(
- (key) => key.startsWith('aria-') && unsupportedAttributes.includes(key as any)
+ (key) => key.startsWith('aria-') && unsupportedAttributes.includes(key as any),
);
if (invalidAttributes.length > 0) {
(element as any).__astro_role = elementRole;
@@ -681,7 +681,7 @@ function getAttributeObject(element: Element): Record<string, string> {
function is_semantic_role_element(
role: ARIARoleDefinitionKey,
tag_name: string,
- attributes: Record<string, string>
+ attributes: Record<string, string>,
) {
for (const [schema, ax_object] of elementAXObjects.entries()) {
if (
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/index.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/index.ts
index 7d22a50c7..935f5376f 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/index.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/index.ts
@@ -22,7 +22,7 @@ export interface ResolvedAuditRule {
export interface AuditRuleWithSelector extends AuditRule {
selector: string;
match?: (
- element: Element
+ element: Element,
) =>
| boolean
| null
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/perf.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/perf.ts
index 7a3de2307..6a1749d00 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/perf.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/perf.ts
@@ -91,7 +91,7 @@ export const perf: AuditRuleWithSelector[] = [
title: 'Server-rendered component took a long time to render',
message: (element) =>
`This component took an unusually long time to render on the server (${getCleanRenderingTime(
- element.getAttribute('server-render-time')
+ element.getAttribute('server-render-time'),
)}). This might be a sign that it's doing too much work on the server, or something is blocking rendering.`,
selector: 'astro-island[server-render-time]',
match(element) {
@@ -109,7 +109,7 @@ export const perf: AuditRuleWithSelector[] = [
title: 'Client-rendered component took a long time to hydrate',
message: (element) =>
`This component took an unusually long time to render on the server (${getCleanRenderingTime(
- element.getAttribute('client-render-time')
+ element.getAttribute('client-render-time'),
)}). This could be a sign that something is blocking the main thread and preventing the component from hydrating quickly.`,
selector: 'astro-island[client-render-time]',
match(element) {
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.ts
index 86fa7b743..472e8d7c6 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-list-window.ts
@@ -317,7 +317,7 @@ export class DevToolbarAuditListWindow extends HTMLElement {
rulesCategories.forEach((category) => {
const headerEntryContainer = document.createElement('div');
const auditCount = this.audits.filter(
- (audit) => getAuditCategory(audit.rule) === category.code
+ (audit) => getAuditCategory(audit.rule) === category.code,
).length;
const categoryBadge = createRoundedBadge(category.icon);
@@ -334,7 +334,7 @@ export class DevToolbarAuditListWindow extends HTMLElement {
if (backToListButton) {
backToListButton.addEventListener('click', () => {
const activeAudit = this.shadowRoot.querySelector(
- 'astro-dev-toolbar-audit-list-item[active]'
+ 'astro-dev-toolbar-audit-list-item[active]',
);
if (activeAudit) {
activeAudit.toggleAttribute('active', false);
@@ -355,7 +355,7 @@ export class DevToolbarAuditListWindow extends HTMLElement {
if (this.audits.length > 0) {
for (const category of rulesCategories) {
const template = this.shadowRoot.getElementById(
- 'category-template'
+ 'category-template',
) as HTMLTemplateElement;
if (!template) return;
@@ -368,7 +368,7 @@ export class DevToolbarAuditListWindow extends HTMLElement {
const categoryContent = clone.querySelector('.category-content')!;
const categoryAudits = this.audits.filter(
- (audit) => getAuditCategory(audit.rule) === category.code
+ (audit) => getAuditCategory(audit.rule) === category.code,
);
for (const audit of categoryAudits) {
@@ -399,7 +399,7 @@ export class DevToolbarAuditListWindow extends HTMLElement {
updateBadgeCounts() {
for (const category of rulesCategories) {
const auditCount = this.audits.filter(
- (audit) => getAuditCategory(audit.rule) === category.code
+ (audit) => getAuditCategory(audit.rule) === category.code,
).length;
this.badges[category.code].updateCount(auditCount);
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.ts
index e2833e804..38559e0f9 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/ui/audit-ui.ts
@@ -79,7 +79,7 @@ function buildAuditTooltip(rule: ResolvedAuditRule, element: Element) {
tooltip.sections.push({
content: elementFileWithPosition.slice(
- (window as DevToolbarMetadata).__astro_dev_toolbar__.root.length - 1 // We want to keep the final slash, so minus one.
+ (window as DevToolbarMetadata).__astro_dev_toolbar__.root.length - 1, // We want to keep the final slash, so minus one.
),
clickDescription: 'Click to go to file',
async clickAction() {
@@ -97,10 +97,10 @@ function buildAuditCard(
rule: ResolvedAuditRule,
highlightElement: HTMLElement,
auditedElement: Element,
- audits: Audit[]
+ audits: Audit[],
) {
const card = document.createElement(
- 'astro-dev-toolbar-audit-list-item'
+ 'astro-dev-toolbar-audit-list-item',
) as DevToolbarAuditListItem;
card.clickAction = () => {
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts
index eb97bd34e..7ee42da84 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts
@@ -163,7 +163,7 @@ export default {
Run <code>astro preferences disable devToolbar</code> in your terminal to disable the toolbar. <a href="https://docs.astro.build/en/reference/cli-reference/#astro-preferences" target="_blank">Learn more</a>.
</section>
</label>
- `
+ `,
);
const general = windowElement.querySelector('#general')!;
for (const settingsRow of settingsRows) {
@@ -196,7 +196,7 @@ export default {
option.selected = true;
}
option.textContent = `${placement.slice(0, 1).toUpperCase()}${placement.slice(
- 1
+ 1,
)}`.replace('-', ' ');
astroSelect.append(option);
});
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts
index 661b68730..50be27b0e 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/highlight.ts
@@ -4,7 +4,7 @@ import type { Icon } from '../../ui-library/icons.js';
export function createHighlight(
rect: DOMRect,
icon?: Icon,
- additionalAttributes?: Record<string, string>
+ additionalAttributes?: Record<string, string>,
) {
const highlight = document.createElement('astro-dev-toolbar-highlight');
if (icon) highlight.icon = icon;
@@ -57,7 +57,7 @@ export function positionHighlight(highlight: DevToolbarHighlight, rect: DOMRect)
export function attachTooltipToHighlight(
highlight: DevToolbarHighlight,
tooltip: HTMLElement,
- originalElement: Element
+ originalElement: Element,
) {
highlight.shadowRoot.append(tooltip);
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts
index ec5a34ad8..cddee0c26 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/icons.ts
@@ -13,7 +13,7 @@ const categoryIcons = new Map(
analytics: ['checkCircle', 'compress', 'searchFile'],
accessibility: ['approveUser', 'checkCircle'],
other: ['checkCircle', 'grid', 'puzzle', 'sitemap'],
- })
+ }),
);
export function iconForIntegration(integration: Integration) {
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/window.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/window.ts
index fb76c2a9a..87dee93da 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/utils/window.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/utils/window.ts
@@ -10,7 +10,7 @@ export function createWindowElement(content: string, placement = settings.config
export function closeOnOutsideClick(
eventTarget: EventTarget,
- additionalCheck?: (target: Element) => boolean
+ additionalCheck?: (target: Element) => boolean,
) {
function onPageClick(event: MouseEvent) {
const target = event.target as Element | null;
@@ -23,7 +23,7 @@ export function closeOnOutsideClick(
detail: {
state: false,
},
- })
+ }),
);
}
eventTarget.addEventListener('app-toggled', (event: any) => {
diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/xray.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/xray.ts
index 6dae6f6ca..2e56b0f24 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/apps/xray.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/apps/xray.ts
@@ -71,7 +71,7 @@ export default {
<p>
It looks like there are no interactive component islands on this page. Did you forget to add a client directive to your interactive UI component?
</p>
- `
+ `,
);
canvas.append(window);
@@ -140,13 +140,13 @@ export default {
// Display the props if we have any
// Ignore the "data-astro-cid-XXXXXX" prop (internal)
const islandPropsEntries = Object.entries(islandProps).filter(
- (prop: any) => !prop[0].startsWith('data-astro-cid-')
+ (prop: any) => !prop[0].startsWith('data-astro-cid-'),
);
if (islandPropsEntries.length > 0) {
const stringifiedProps = JSON.stringify(
Object.fromEntries(islandPropsEntries.map((prop: any) => [prop[0], prop[1][1]])),
undefined,
- 2
+ 2,
);
tooltip.sections.push({
title: 'Props',
@@ -167,8 +167,8 @@ export default {
'/__open-in-editor?file=' +
encodeURIComponent(
(window as DevToolbarMetadata).__astro_dev_toolbar__.root +
- islandComponentPath.slice(1)
- )
+ islandComponentPath.slice(1),
+ ),
);
},
});
diff --git a/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts b/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts
index 48cdac72f..9731f3597 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/entrypoint.ts
@@ -270,11 +270,11 @@ document.addEventListener('DOMContentLoaded', async () => {
hiddenApps.some(
(p) =>
p.notification.state === true &&
- p.notification.level === notificationLevel
- )
+ p.notification.level === notificationLevel,
+ ),
) ?? 'error',
},
- })
+ }),
);
});
}
@@ -286,7 +286,7 @@ document.addEventListener('DOMContentLoaded', async () => {
const apps: DevToolbarApp[] = [
...[astroDevToolApp, astroXrayApp, astroAuditApp, astroSettingsApp, astroMoreApp].map(
- (appDef) => prepareApp(appDef, true)
+ (appDef) => prepareApp(appDef, true),
),
...customAppsDefinitions.map((appDef) => prepareApp(appDef, false)),
];
diff --git a/packages/astro/src/runtime/client/dev-toolbar/helpers.ts b/packages/astro/src/runtime/client/dev-toolbar/helpers.ts
index c205d0003..a8250ed81 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/helpers.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/helpers.ts
@@ -35,7 +35,7 @@ export class ToolbarAppEventTarget extends EventTarget {
state: options.state,
level: options.state === true ? options.level : undefined,
} satisfies NotificationPayload,
- })
+ }),
);
}
@@ -50,7 +50,7 @@ export class ToolbarAppEventTarget extends EventTarget {
detail: {
state: options.state,
} satisfies AppStatePayload,
- })
+ }),
);
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/settings.ts b/packages/astro/src/runtime/client/dev-toolbar/settings.ts
index 34ab7b5c0..2f5eabe6d 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/settings.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/settings.ts
@@ -39,7 +39,7 @@ function getSettings() {
console[level](
`%cAstro`,
'background: linear-gradient(66.77deg, #D83333 0%, #F041FF 100%); color: white; padding-inline: 4px; border-radius: 2px; font-family: monospace;',
- message
+ message,
);
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts
index 3f9db6b1d..08ea61cac 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/toolbar.ts
@@ -284,13 +284,13 @@ export class AstroDevToolbar extends HTMLElement {
${
this.apps.filter((app) => !app.builtIn).length > this.customAppsToShow
? this.getAppTemplate(
- this.apps.find((app) => app.builtIn && app.id === 'astro:more')!
+ this.apps.find((app) => app.builtIn && app.id === 'astro:more')!,
)
: ''
}
<div class="separator"></div>
${this.getAppTemplate(
- this.apps.find((app) => app.builtIn && app.id === 'astro:settings')!
+ this.apps.find((app) => app.builtIn && app.id === 'astro:settings')!,
)}
</div>
</div>
@@ -315,7 +315,7 @@ export class AstroDevToolbar extends HTMLElement {
async () => {
this.apps.map((app) => this.initApp(app));
},
- { timeout: 300 }
+ { timeout: 300 },
);
} else {
setTimeout(async () => {
@@ -433,7 +433,7 @@ export class AstroDevToolbar extends HTMLElement {
getAppCanvasById(id: string) {
return this.shadowRoot.querySelector<HTMLElement>(
- `astro-dev-toolbar-app-canvas[data-app-id="${id}"]`
+ `astro-dev-toolbar-app-canvas[data-app-id="${id}"]`,
);
}
@@ -482,7 +482,7 @@ export class AstroDevToolbar extends HTMLElement {
app.active = newStatus ?? !app.active;
const mainBarButton = this.getAppButtonById(app.id);
const moreBarButton = this.getAppCanvasById('astro:more')?.shadowRoot?.querySelector(
- `[data-app-id="${app.id}"]`
+ `[data-app-id="${app.id}"]`,
);
if (mainBarButton) {
@@ -513,7 +513,7 @@ export class AstroDevToolbar extends HTMLElement {
state: app.active,
app,
},
- })
+ }),
);
});
@@ -586,7 +586,7 @@ export class AstroDevToolbar extends HTMLElement {
detail: {
placement: newPlacement,
},
- })
+ }),
);
});
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts
index 0a4f30cfc..f018e8f82 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts
@@ -17,7 +17,7 @@ export class DevToolbarBadge extends HTMLElement {
set size(value) {
if (!sizes.includes(value)) {
settings.logger.error(
- `Invalid size: ${value}, expected one of ${sizes.join(', ')}, got ${value}.`
+ `Invalid size: ${value}, expected one of ${sizes.join(', ')}, got ${value}.`,
);
return;
}
@@ -32,7 +32,7 @@ export class DevToolbarBadge extends HTMLElement {
set badgeStyle(value) {
if (!styles.includes(value)) {
settings.logger.error(
- `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`
+ `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
);
return;
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts
index 067a1cf2a..0f13c67ec 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/button.ts
@@ -20,7 +20,7 @@ export class DevToolbarButton extends HTMLElement {
set size(value) {
if (!sizes.includes(value)) {
settings.logger.error(
- `Invalid size: ${value}, expected one of ${sizes.join(', ')}, got ${value}.`
+ `Invalid size: ${value}, expected one of ${sizes.join(', ')}, got ${value}.`,
);
return;
}
@@ -35,7 +35,7 @@ export class DevToolbarButton extends HTMLElement {
set buttonStyle(value) {
if (!styles.includes(value)) {
settings.logger.error(
- `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`
+ `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
);
return;
}
@@ -50,7 +50,7 @@ export class DevToolbarButton extends HTMLElement {
set buttonBorderRadius(value) {
if (!borderRadii.includes(value)) {
settings.logger.error(
- `Invalid border-radius: ${value}, expected one of ${borderRadii.join(', ')}, got ${value}.`
+ `Invalid border-radius: ${value}, expected one of ${borderRadii.join(', ')}, got ${value}.`,
);
return;
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/card.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/card.ts
index bba46a943..abaf90efa 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/card.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/card.ts
@@ -18,7 +18,7 @@ export class DevToolbarCard extends HTMLElement {
set cardStyle(value) {
if (!styles.includes(value)) {
settings.logger.error(
- `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`
+ `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
);
return;
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.ts
index 2dd85edd9..c77d2103b 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.ts
@@ -16,7 +16,7 @@ export class DevToolbarHighlight extends HTMLElement {
set highlightStyle(value) {
if (!styles.includes(value)) {
settings.logger.error(
- `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`
+ `Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
);
return;
}
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts
index cc8fb7829..bc47970c2 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/icons.ts
@@ -8,7 +8,7 @@ export function isDefinedIcon(icon: Icon): icon is DefinedIcon {
export function getIconElement(name: DefinedIcon): SVGElement;
export function getIconElement(name: string & NonNullable<unknown>): undefined;
export function getIconElement(
- name: DefinedIcon | (string & NonNullable<unknown>)
+ name: DefinedIcon | (string & NonNullable<unknown>),
): SVGElement | undefined {
const icon = icons[name as DefinedIcon];
diff --git a/packages/astro/src/runtime/client/dev-toolbar/ui-library/window.ts b/packages/astro/src/runtime/client/dev-toolbar/ui-library/window.ts
index 35cd0aa67..8b040ab44 100644
--- a/packages/astro/src/runtime/client/dev-toolbar/ui-library/window.ts
+++ b/packages/astro/src/runtime/client/dev-toolbar/ui-library/window.ts
@@ -18,7 +18,7 @@ export class DevToolbarWindow extends HTMLElement {
set placement(value) {
if (!isValidPlacement(value)) {
settings.logger.error(
- `Invalid placement: ${value}, expected one of ${placements.join(', ')}, got ${value}.`
+ `Invalid placement: ${value}, expected one of ${placements.join(', ')}, got ${value}.`,
);
return;
}
diff --git a/packages/astro/src/runtime/server/astro-component.ts b/packages/astro/src/runtime/server/astro-component.ts
index 9acc099a9..928d23ad8 100644
--- a/packages/astro/src/runtime/server/astro-component.ts
+++ b/packages/astro/src/runtime/server/astro-component.ts
@@ -10,7 +10,7 @@ function validateArgs(args: unknown[]): args is Parameters<AstroComponentFactory
function baseCreateComponent(
cb: AstroComponentFactory,
moduleId?: string,
- propagation?: PropagationHint
+ propagation?: PropagationHint,
): AstroComponentFactory {
const name = moduleId?.split('/').pop()?.replace('.astro', '') ?? '';
const fn = (...args: Parameters<AstroComponentFactory>) => {
@@ -44,7 +44,7 @@ function createComponentWithOptions(opts: CreateComponentOptions) {
export function createComponent(
arg1: AstroComponentFactory | CreateComponentOptions,
moduleId?: string,
- propagation?: PropagationHint
+ propagation?: PropagationHint,
) {
if (typeof arg1 === 'function') {
return baseCreateComponent(arg1, moduleId, propagation);
diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts
index 22d9dd00a..3c0404435 100644
--- a/packages/astro/src/runtime/server/astro-island.ts
+++ b/packages/astro/src/runtime/server/astro-island.ts
@@ -8,7 +8,7 @@ declare const Astro: {
[k in directiveAstroKeys]?: (
fn: () => Promise<() => void>,
opts: Record<string, any>,
- root: HTMLElement
+ root: HTMLElement,
) => unknown;
};
@@ -123,7 +123,7 @@ declare const Astro: {
return this.hydrate;
},
opts,
- this
+ this,
);
} catch (e) {
// eslint-disable-next-line no-console
@@ -182,7 +182,7 @@ declare const Astro: {
console.error(
`[hydrate] Error parsing props for component ${componentName}`,
this.getAttribute('props'),
- e
+ e,
);
throw e;
}
@@ -195,7 +195,7 @@ declare const Astro: {
if (process.env.NODE_ENV === 'development' && hydrationTimeStart)
this.setAttribute(
'client-render-time',
- (performance.now() - hydrationTimeStart).toString()
+ (performance.now() - hydrationTimeStart).toString(),
);
this.removeAttribute('ssr');
this.dispatchEvent(new CustomEvent('astro:hydrate'));
diff --git a/packages/astro/src/runtime/server/endpoint.ts b/packages/astro/src/runtime/server/endpoint.ts
index 8cd676391..900d604fd 100644
--- a/packages/astro/src/runtime/server/endpoint.ts
+++ b/packages/astro/src/runtime/server/endpoint.ts
@@ -10,7 +10,7 @@ export async function renderEndpoint(
mod: EndpointHandler,
context: APIContext,
ssr: boolean,
- logger: Logger
+ logger: Logger,
) {
const { request, url } = context;
@@ -21,8 +21,8 @@ export async function renderEndpoint(
logger.warn(
'router',
`${url.pathname} ${bold(
- method
- )} requests are not available for a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` to enable.`
+ method,
+ )} requests are not available for a static site. Update your config to \`output: 'server'\` or \`output: 'hybrid'\` to enable.`,
);
}
if (handler === undefined) {
@@ -34,7 +34,7 @@ export async function renderEndpoint(
.join(', ')}\n` +
('all' in mod
? `One of the exported handlers is "all" (lowercase), did you mean to export 'ALL'?\n`
- : '')
+ : ''),
);
// No handler matching the verb found, so this should be a
// 404. Should be handled by 404.astro route if possible.
@@ -45,7 +45,7 @@ export async function renderEndpoint(
'router',
`The route "${
url.pathname
- }" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.`
+ }" exports a value for the method "${method}", but it is of the type ${typeof handler} instead of a function.`,
);
return new Response(null, { status: 500 });
}
diff --git a/packages/astro/src/runtime/server/escape.ts b/packages/astro/src/runtime/server/escape.ts
index 6674b08ff..1dbfd3725 100644
--- a/packages/astro/src/runtime/server/escape.ts
+++ b/packages/astro/src/runtime/server/escape.ts
@@ -82,7 +82,7 @@ function* unescapeChunks(iterable: Iterable<any>): any {
}
export function unescapeHTML(
- str: any
+ str: any,
):
| BlessedType
| Promise<BlessedType | AsyncGenerator<BlessedType, void, unknown>>
diff --git a/packages/astro/src/runtime/server/hydration.ts b/packages/astro/src/runtime/server/hydration.ts
index 28b5ff674..ab6396566 100644
--- a/packages/astro/src/runtime/server/hydration.ts
+++ b/packages/astro/src/runtime/server/hydration.ts
@@ -34,7 +34,7 @@ const transitionDirectivesToCopyOnIsland = Object.freeze([
// Finds these special props and removes them from what gets passed into the component.
export function extractDirectives(
inputProps: Props,
- clientDirectives: SSRResult['clientDirectives']
+ clientDirectives: SSRResult['clientDirectives'],
): ExtractedProps {
let extracted: ExtractedProps = {
isPage: false,
@@ -84,7 +84,7 @@ export function extractDirectives(
.map((d) => `client:${d}`)
.join(', ');
throw new Error(
- `Error: invalid hydration directive "${key}". Supported hydration methods: ${hydrationMethods}`
+ `Error: invalid hydration directive "${key}". Supported hydration methods: ${hydrationMethods}`,
);
}
@@ -125,7 +125,7 @@ interface HydrateScriptOptions {
/** For hydrated components, generate a <script type="module"> to load the component */
export async function generateHydrateScript(
scriptOptions: HydrateScriptOptions,
- metadata: Required<AstroComponentMetadata>
+ metadata: Required<AstroComponentMetadata>,
): Promise<SSRElement> {
const { renderer, result, astroId, props, attrs } = scriptOptions;
const { hydrate, componentUrl, componentExport } = metadata;
@@ -172,7 +172,7 @@ export async function generateHydrateScript(
JSON.stringify({
name: metadata.displayName,
value: metadata.hydrateArgs || '',
- })
+ }),
);
transitionDirectivesToCopyOnIsland.forEach((name) => {
diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts
index 7a1ad16e8..e2b49c231 100644
--- a/packages/astro/src/runtime/server/index.ts
+++ b/packages/astro/src/runtime/server/index.ts
@@ -72,7 +72,7 @@ export function __astro_tag_component__(Component: unknown, rendererName: string
export function spreadAttributes(
values: Record<any, any> = {},
_name?: string,
- { class: scopedClassName }: { class?: string } = {}
+ { class: scopedClassName }: { class?: string } = {},
) {
let output = '';
// If the compiler passes along a scoped class, merge with existing props or inject it
diff --git a/packages/astro/src/runtime/server/jsx.ts b/packages/astro/src/runtime/server/jsx.ts
index b035d2b12..2491ab589 100644
--- a/packages/astro/src/runtime/server/jsx.ts
+++ b/packages/astro/src/runtime/server/jsx.ts
@@ -37,7 +37,7 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise<any> {
return '';
case Array.isArray(vnode):
return markHTMLString(
- (await Promise.all(vnode.map((v: any) => renderJSX(result, v)))).join('')
+ (await Promise.all(vnode.map((v: any) => renderJSX(result, v)))).join(''),
);
}
@@ -130,7 +130,7 @@ Did you forget to import the component or is it possible there is a typo?`);
renderJSX(result, value).then((output) => {
if (output.toString().trim().length === 0) return;
slots[key] = () => output;
- })
+ }),
);
}
await Promise.all(slotPromises);
@@ -142,7 +142,7 @@ Did you forget to import the component or is it possible there is a typo?`);
vnode.props['client:display-name'] ?? '',
null,
props,
- slots
+ slots,
);
} else {
output = await renderComponentToString(
@@ -150,7 +150,7 @@ Did you forget to import the component or is it possible there is a typo?`);
typeof vnode.type === 'function' ? vnode.type.name : vnode.type,
vnode.type,
props,
- slots
+ slots,
);
}
return markHTMLString(output);
@@ -163,7 +163,7 @@ Did you forget to import the component or is it possible there is a typo?`);
async function renderElement(
result: any,
tag: string,
- { children, ...props }: Record<string, any>
+ { children, ...props }: Record<string, any>,
) {
return markHTMLString(
`<${tag}${spreadAttributes(props)}${markHTMLString(
@@ -171,8 +171,8 @@ async function renderElement(
? `/>`
: `>${
children == null ? '' : await renderJSX(result, prerenderElementChildren(tag, children))
- }</${tag}>`
- )}`
+ }</${tag}>`,
+ )}`,
);
}
diff --git a/packages/astro/src/runtime/server/render/astro/factory.ts b/packages/astro/src/runtime/server/render/astro/factory.ts
index f298a4ac1..db319eb1a 100644
--- a/packages/astro/src/runtime/server/render/astro/factory.ts
+++ b/packages/astro/src/runtime/server/render/astro/factory.ts
@@ -18,7 +18,7 @@ export function isAstroComponentFactory(obj: any): obj is AstroComponentFactory
export function isAPropagatingComponent(
result: SSRResult,
- factory: AstroComponentFactory
+ factory: AstroComponentFactory,
): boolean {
let hint: PropagationHint = factory.propagation || 'none';
if (factory.moduleId && result.componentMetadata.has(factory.moduleId) && hint === 'none') {
diff --git a/packages/astro/src/runtime/server/render/astro/instance.ts b/packages/astro/src/runtime/server/render/astro/instance.ts
index 1cfb5b524..3246a7e1b 100644
--- a/packages/astro/src/runtime/server/render/astro/instance.ts
+++ b/packages/astro/src/runtime/server/render/astro/instance.ts
@@ -24,7 +24,7 @@ export class AstroComponentInstance {
result: SSRResult,
props: ComponentProps,
slots: ComponentSlots,
- factory: AstroComponentFactory
+ factory: AstroComponentFactory,
) {
this.result = result;
this.props = props;
@@ -79,7 +79,7 @@ function validateComponentProps(props: any, displayName: string) {
if (prop.startsWith('client:')) {
// eslint-disable-next-line
console.warn(
- `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`
+ `You are attempting to render <${displayName} ${prop} />, but ${displayName} is an Astro component. Astro components do not render in the client and should not have a hydration directive. Please use a framework component for client rendering.`,
);
}
}
@@ -91,7 +91,7 @@ export function createAstroComponentInstance(
displayName: string,
factory: AstroComponentFactory,
props: ComponentProps,
- slots: any = {}
+ slots: any = {},
) {
validateComponentProps(props, displayName);
const instance = new AstroComponentInstance(result, props, slots, factory);
diff --git a/packages/astro/src/runtime/server/render/astro/render.ts b/packages/astro/src/runtime/server/render/astro/render.ts
index 775f7f09c..41845b7b9 100644
--- a/packages/astro/src/runtime/server/render/astro/render.ts
+++ b/packages/astro/src/runtime/server/render/astro/render.ts
@@ -15,14 +15,14 @@ export async function renderToString(
props: any,
children: any,
isPage = false,
- route?: RouteData
+ route?: RouteData,
): Promise<string | Response> {
const templateResult = await callComponentAsTemplateResultOrResponse(
result,
componentFactory,
props,
children,
- route
+ route,
);
// If the Astro component returns a Response on init, return that response
@@ -65,14 +65,14 @@ export async function renderToReadableStream(
props: any,
children: any,
isPage = false,
- route?: RouteData
+ route?: RouteData,
): Promise<ReadableStream | Response> {
const templateResult = await callComponentAsTemplateResultOrResponse(
result,
componentFactory,
props,
children,
- route
+ route,
);
// If the Astro component returns a Response on init, return that response
@@ -142,7 +142,7 @@ async function callComponentAsTemplateResultOrResponse(
componentFactory: AstroComponentFactory,
props: any,
children: any,
- route?: RouteData
+ route?: RouteData,
) {
const factoryResult = await componentFactory(result, props, children);
@@ -157,7 +157,7 @@ async function callComponentAsTemplateResultOrResponse(
...AstroErrorData.OnlyResponseCanBeReturned,
message: AstroErrorData.OnlyResponseCanBeReturned.message(
route?.route,
- typeof factoryResult
+ typeof factoryResult,
),
location: {
file: route?.component,
@@ -203,14 +203,14 @@ export async function renderToAsyncIterable(
props: any,
children: any,
isPage = false,
- route?: RouteData
+ route?: RouteData,
): Promise<AsyncIterable<Uint8Array> | Response> {
const templateResult = await callComponentAsTemplateResultOrResponse(
result,
componentFactory,
props,
children,
- route
+ route,
);
if (templateResult instanceof Response) return templateResult;
let renderedFirstPageChunk = false;
diff --git a/packages/astro/src/runtime/server/render/common.ts b/packages/astro/src/runtime/server/render/common.ts
index 780e41463..0845bdd65 100644
--- a/packages/astro/src/runtime/server/render/common.ts
+++ b/packages/astro/src/runtime/server/render/common.ts
@@ -54,7 +54,7 @@ export const decoder = new TextDecoder();
// can ensure they are added only once, and as soon as possible.
function stringifyChunk(
result: SSRResult,
- chunk: string | HTMLString | SlotString | RenderInstruction
+ chunk: string | HTMLString | SlotString | RenderInstruction,
): string {
if (isRenderInstruction(chunk)) {
const instruction = chunk;
@@ -130,7 +130,7 @@ export function chunkToString(result: SSRResult, chunk: Exclude<RenderDestinatio
export function chunkToByteArray(
result: SSRResult,
- chunk: Exclude<RenderDestinationChunk, Response>
+ chunk: Exclude<RenderDestinationChunk, Response>,
): Uint8Array {
if (ArrayBuffer.isView(chunk)) {
return chunk as Uint8Array;
diff --git a/packages/astro/src/runtime/server/render/component.ts b/packages/astro/src/runtime/server/render/component.ts
index 5b22adecd..449f58fbc 100644
--- a/packages/astro/src/runtime/server/render/component.ts
+++ b/packages/astro/src/runtime/server/render/component.ts
@@ -77,11 +77,11 @@ async function renderFrameworkComponent(
displayName: string,
Component: unknown,
_props: Record<string | number, any>,
- slots: any = {}
+ slots: any = {},
): Promise<RenderInstance> {
if (!Component && 'client:only' in _props === false) {
throw new Error(
- `Unable to render ${displayName} because it is ${Component}!\nDid you forget to import the component or is it possible there is a typo?`
+ `Unable to render ${displayName} because it is ${Component}!\nDid you forget to import the component or is it possible there is a typo?`,
);
}
@@ -93,7 +93,7 @@ async function renderFrameworkComponent(
const { hydration, isPage, props, propsWithoutTransitionAttributes } = extractDirectives(
_props,
- clientDirectives
+ clientDirectives,
);
let html = '';
let attrs: Record<string, string> | undefined = undefined;
@@ -152,7 +152,7 @@ async function renderFrameworkComponent(
result,
Component as typeof HTMLElement,
_props,
- slots
+ slots,
);
return {
render(destination) {
@@ -168,7 +168,7 @@ async function renderFrameworkComponent(
: metadata.hydrateArgs;
if (clientOnlyValues.has(rendererName)) {
renderer = renderers.find(
- ({ name }) => name === `@astrojs/${rendererName}` || name === rendererName
+ ({ name }) => name === `@astrojs/${rendererName}` || name === rendererName,
);
}
}
@@ -199,10 +199,10 @@ async function renderFrameworkComponent(
metadata.displayName,
metadata?.componentUrl?.split('.').pop(),
plural,
- validRenderers.length
+ validRenderers.length,
),
hint: AstroErrorData.NoMatchingRenderer.hint(
- formatList(probableRendererNames.map((r) => '`' + r + '`'))
+ formatList(probableRendererNames.map((r) => '`' + r + '`')),
),
});
} else {
@@ -211,13 +211,13 @@ async function renderFrameworkComponent(
...AstroErrorData.NoClientOnlyHint,
message: AstroErrorData.NoClientOnlyHint.message(metadata.displayName),
hint: AstroErrorData.NoClientOnlyHint.hint(
- probableRendererNames.map((r) => r.replace('@astrojs/', '')).join('|')
+ probableRendererNames.map((r) => r.replace('@astrojs/', '')).join('|'),
),
});
}
} else if (typeof Component !== 'string') {
const matchingRenderers = validRenderers.filter((r) =>
- probableRendererNames.includes(r.name)
+ probableRendererNames.includes(r.name),
);
const plural = validRenderers.length > 1;
if (matchingRenderers.length === 0) {
@@ -227,10 +227,10 @@ async function renderFrameworkComponent(
metadata.displayName,
metadata?.componentUrl?.split('.').pop(),
plural,
- validRenderers.length
+ validRenderers.length,
),
hint: AstroErrorData.NoMatchingRenderer.hint(
- formatList(probableRendererNames.map((r) => '`' + r + '`'))
+ formatList(probableRendererNames.map((r) => '`' + r + '`')),
),
});
} else if (matchingRenderers.length === 1) {
@@ -242,7 +242,7 @@ async function renderFrameworkComponent(
Component,
propsWithoutTransitionAttributes,
children,
- metadata
+ metadata,
));
} else {
throw new Error(`Unable to render ${metadata.displayName}!
@@ -267,7 +267,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
// warning if provide incorrect client:only directive but find the renderer by guess
// eslint-disable-next-line no-console
console.warn(
- `The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.`
+ `The client:only directive for ${metadata.displayName} is not recognized. The renderer ${renderer.name} will be used. If you intended to use a different renderer, please provide a valid client:only directive.`,
);
}
html = await renderSlotToString(result, slots?.fallback);
@@ -278,7 +278,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
Component,
propsWithoutTransitionAttributes,
children,
- metadata
+ metadata,
));
if (process.env.NODE_ENV === 'development')
componentServerRenderEndTime = performance.now() - componentRenderStartTime;
@@ -298,7 +298,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
message: AstroErrorData.NoClientEntrypoint.message(
displayName,
metadata.hydrate,
- renderer.name
+ renderer.name,
),
});
}
@@ -311,9 +311,9 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
const childSlots = Object.values(children).join('');
const renderTemplateResult = renderTemplate`<${Tag}${internalSpreadAttributes(
- props
+ props,
)}${markHTMLString(
- childSlots === '' && voidElementNames.test(Tag) ? `/>` : `>${childSlots}</${Tag}>`
+ childSlots === '' && voidElementNames.test(Tag) ? `/>` : `>${childSlots}</${Tag}>`,
)}`;
html = '';
@@ -339,7 +339,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
destination.write(html);
} else if (html && html.length > 0) {
destination.write(
- markHTMLString(removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot))
+ markHTMLString(removeStaticAstroSlot(html, renderer?.ssr?.supportsAstroStaticSlot)),
);
}
},
@@ -350,13 +350,13 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
const astroId = shorthash(
`<!--${metadata.componentExport!.value}:${metadata.componentUrl}-->\n${html}\n${serializeProps(
props,
- metadata
- )}`
+ metadata,
+ )}`,
);
const island = await generateHydrateScript(
{ renderer: renderer!, result, astroId, props, attrs },
- metadata as Required<AstroComponentMetadata>
+ metadata as Required<AstroComponentMetadata>,
);
if (componentServerRenderEndTime && process.env.NODE_ENV === 'development')
@@ -388,7 +388,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
(key) =>
`<template data-astro-template${key !== 'default' ? `="${key}"` : ''}>${
children[key]
- }</template>`
+ }</template>`,
)
.join('')
: '';
@@ -416,7 +416,7 @@ If you're still stuck, please open an issue on GitHub or join us at https://astr
type: 'renderer-hydration-script',
rendererName: renderer.name,
render: renderer.ssr.renderHydrationScript,
- })
+ }),
);
}
const renderedElement = renderElement('astro-island', island, false);
@@ -433,7 +433,7 @@ function sanitizeElementName(tag: string) {
async function renderFragmentComponent(
result: SSRResult,
- slots: ComponentSlots = {}
+ slots: ComponentSlots = {},
): Promise<RenderInstance> {
const children = await renderSlotToString(result, slots?.default);
return {
@@ -448,7 +448,7 @@ async function renderHTMLComponent(
result: SSRResult,
Component: unknown,
_props: Record<string | number, any>,
- slots: any = {}
+ slots: any = {},
): Promise<RenderInstance> {
const { slotInstructions, children } = await renderSlots(result, slots);
const html = (Component as any)({ slots: children });
@@ -467,7 +467,7 @@ function renderAstroComponent(
displayName: string,
Component: AstroComponentFactory,
props: Record<string | number, any>,
- slots: any = {}
+ slots: any = {},
): RenderInstance {
if (containsServerDirective(props)) {
return renderServerIsland(result, displayName, props, slots);
@@ -489,7 +489,7 @@ export async function renderComponent(
displayName: string,
Component: unknown,
props: Record<string | number, any>,
- slots: ComponentSlots = {}
+ slots: ComponentSlots = {},
): Promise<RenderInstance> {
if (isPromise(Component)) {
Component = await Component.catch(handleCancellation);
@@ -512,7 +512,7 @@ export async function renderComponent(
}
return await renderFrameworkComponent(result, displayName, Component, props, slots).catch(
- handleCancellation
+ handleCancellation,
);
function handleCancellation(e: unknown) {
@@ -543,7 +543,7 @@ export async function renderComponentToString(
props: Record<string | number, any>,
slots: any = {},
isPage = false,
- route?: RouteData
+ route?: RouteData,
): Promise<string> {
let str = '';
let renderedFirstPageChunk = false;
@@ -597,7 +597,7 @@ export type NonAstroPageComponent = {
};
function nonAstroPageNeedsHeadInjection(
- pageComponent: any
+ pageComponent: any,
): pageComponent is NonAstroPageComponent {
return !!pageComponent?.[needsHeadRenderingSymbol];
}
diff --git a/packages/astro/src/runtime/server/render/dom.ts b/packages/astro/src/runtime/server/render/dom.ts
index ca2017018..e2b194df3 100644
--- a/packages/astro/src/runtime/server/render/dom.ts
+++ b/packages/astro/src/runtime/server/render/dom.ts
@@ -12,7 +12,7 @@ export async function renderHTMLElement(
result: SSRResult,
constructor: typeof HTMLElement,
props: any,
- slots: any
+ slots: any,
): Promise<string> {
const name = getHTMLElementName(constructor);
@@ -23,7 +23,7 @@ export async function renderHTMLElement(
}
return markHTMLString(
- `<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}</${name}>`
+ `<${name}${attrHTML}>${await renderSlotToString(result, slots?.default)}</${name}>`,
);
}
diff --git a/packages/astro/src/runtime/server/render/head.ts b/packages/astro/src/runtime/server/render/head.ts
index c39dfe20f..49dd5abed 100644
--- a/packages/astro/src/runtime/server/render/head.ts
+++ b/packages/astro/src/runtime/server/render/head.ts
@@ -21,7 +21,7 @@ export function renderAllHeadContent(result: SSRResult) {
.map((style) =>
style.props.rel === 'stylesheet'
? renderElement('link', style)
- : renderElement('style', style)
+ : renderElement('style', style),
);
// Clear result.styles so that any new styles added will be inlined.
result.styles.clear();
diff --git a/packages/astro/src/runtime/server/render/instruction.ts b/packages/astro/src/runtime/server/render/instruction.ts
index 5be7ffd38..c1761312f 100644
--- a/packages/astro/src/runtime/server/render/instruction.ts
+++ b/packages/astro/src/runtime/server/render/instruction.ts
@@ -32,14 +32,14 @@ export type RenderInstruction =
| RendererHydrationScriptInstruction;
export function createRenderInstruction(
- instruction: RenderDirectiveInstruction
+ instruction: RenderDirectiveInstruction,
): RenderDirectiveInstruction;
export function createRenderInstruction(
- instruction: RendererHydrationScriptInstruction
+ instruction: RendererHydrationScriptInstruction,
): RendererHydrationScriptInstruction;
export function createRenderInstruction(instruction: RenderHeadInstruction): RenderHeadInstruction;
export function createRenderInstruction(
- instruction: MaybeRenderHeadInstruction
+ instruction: MaybeRenderHeadInstruction,
): MaybeRenderHeadInstruction;
export function createRenderInstruction(instruction: { type: string }): RenderInstruction {
return Object.defineProperty(instruction as RenderInstruction, RenderInstructionSymbol, {
diff --git a/packages/astro/src/runtime/server/render/page.ts b/packages/astro/src/runtime/server/render/page.ts
index 32345d926..35a7ec789 100644
--- a/packages/astro/src/runtime/server/render/page.ts
+++ b/packages/astro/src/runtime/server/render/page.ts
@@ -13,7 +13,7 @@ export async function renderPage(
props: any,
children: any,
streaming: boolean,
- route?: RouteData
+ route?: RouteData,
): Promise<Response> {
if (!isAstroComponentFactory(componentFactory)) {
result._metadata.headInTree =
@@ -28,7 +28,7 @@ export async function renderPage(
pageProps,
{},
true,
- route
+ route,
);
const bytes = encoder.encode(str);
@@ -57,7 +57,7 @@ export async function renderPage(
props,
children,
true,
- route
+ route,
);
// Node.js allows passing in an AsyncIterable to the Response constructor.
// This is non-standard so using `any` here to preserve types everywhere else.
diff --git a/packages/astro/src/runtime/server/render/server-islands.ts b/packages/astro/src/runtime/server/render/server-islands.ts
index 9a27fed51..c2263adda 100644
--- a/packages/astro/src/runtime/server/render/server-islands.ts
+++ b/packages/astro/src/runtime/server/render/server-islands.ts
@@ -27,7 +27,7 @@ export function renderServerIsland(
result: SSRResult,
_displayName: string,
props: Record<string | number, any>,
- slots: ComponentSlots
+ slots: ComponentSlots,
): RenderInstance {
return {
async render(destination) {
diff --git a/packages/astro/src/runtime/server/render/slot.ts b/packages/astro/src/runtime/server/render/slot.ts
index bf5a2bb3b..d02a32d82 100644
--- a/packages/astro/src/runtime/server/render/slot.ts
+++ b/packages/astro/src/runtime/server/render/slot.ts
@@ -9,7 +9,7 @@ import { type RenderDestination, type RenderInstance, chunkToString } from './co
type RenderTemplateResult = ReturnType<typeof renderTemplate>;
export type ComponentSlots = Record<string, ComponentSlotValue>;
export type ComponentSlotValue = (
- result: SSRResult
+ result: SSRResult,
) => RenderTemplateResult | Promise<RenderTemplateResult>;
const slotString = Symbol.for('astro:slot-string');
@@ -31,7 +31,7 @@ export function isSlotString(str: string): str is any {
export function renderSlot(
result: SSRResult,
slotted: ComponentSlotValue | RenderTemplateResult,
- fallback?: ComponentSlotValue | RenderTemplateResult
+ fallback?: ComponentSlotValue | RenderTemplateResult,
): RenderInstance {
if (!slotted && fallback) {
return renderSlot(result, fallback);
@@ -46,7 +46,7 @@ export function renderSlot(
export async function renderSlotToString(
result: SSRResult,
slotted: ComponentSlotValue | RenderTemplateResult,
- fallback?: ComponentSlotValue | RenderTemplateResult
+ fallback?: ComponentSlotValue | RenderTemplateResult,
): Promise<string> {
let content = '';
let instructions: null | RenderInstruction[] = null;
@@ -82,7 +82,7 @@ interface RenderSlotsResult {
export async function renderSlots(
result: SSRResult,
- slots: ComponentSlots = {}
+ slots: ComponentSlots = {},
): Promise<RenderSlotsResult> {
let slotInstructions: RenderSlotsResult['slotInstructions'] = null;
let children: RenderSlotsResult['children'] = {};
@@ -97,8 +97,8 @@ export async function renderSlots(
slotInstructions.push(...output.instructions);
}
children[key] = output;
- })
- )
+ }),
+ ),
);
}
return { slotInstructions, children };
diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts
index 469491de4..5dc821aa5 100644
--- a/packages/astro/src/runtime/server/render/util.ts
+++ b/packages/astro/src/runtime/server/render/util.ts
@@ -48,7 +48,7 @@ export function defineScriptVars(vars: Record<any, any>) {
// https://stackoverflow.com/questions/29194024/cant-use-let-keyword-in-safari-javascript
output += `const ${toIdent(key)} = ${JSON.stringify(value)?.replace(
/<\/script>/g,
- '\\x3C/script>'
+ '\\x3C/script>',
)};\n`;
}
return markHTMLString(output);
@@ -96,7 +96,7 @@ Make sure to use the static attribute syntax (\`${key}={value}\`) instead of the
if (key === 'style' && !(value instanceof HTMLString)) {
if (Array.isArray(value) && value.length === 2) {
return markHTMLString(
- ` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`
+ ` ${key}="${toAttributeString(`${toStyleString(value[0])};${value[1]}`, shouldEscape)}"`,
);
}
if (typeof value === 'object') {
@@ -134,7 +134,7 @@ export function internalSpreadAttributes(values: Record<any, any>, shouldEscape
export function renderElement(
name: string,
{ props: _props, children = '' }: SSRElement,
- shouldEscape = true
+ shouldEscape = true,
) {
// Do not print `hoist`, `lang`, `is:global`
const { lang: _, 'data-astro-id': astroId, 'define:vars': defineVars, ...props } = _props;
diff --git a/packages/astro/src/runtime/server/serialize.ts b/packages/astro/src/runtime/server/serialize.ts
index 0d754ebc8..522b05256 100644
--- a/packages/astro/src/runtime/server/serialize.ts
+++ b/packages/astro/src/runtime/server/serialize.ts
@@ -18,7 +18,7 @@ const PROP_TYPE = {
function serializeArray(
value: any[],
metadata: AstroComponentMetadata | Record<string, any> = {},
- parents = new WeakSet<any>()
+ parents = new WeakSet<any>(),
): any[] {
if (parents.has(value)) {
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
@@ -36,7 +36,7 @@ Cyclic references cannot be safely serialized for client-side usage. Please remo
function serializeObject(
value: Record<any, any>,
metadata: AstroComponentMetadata | Record<string, any> = {},
- parents = new WeakSet<any>()
+ parents = new WeakSet<any>(),
): Record<any, any> {
if (parents.has(value)) {
throw new Error(`Cyclic reference detected while serializing props for <${metadata.displayName} client:${metadata.hydrate}>!
@@ -47,7 +47,7 @@ Cyclic references cannot be safely serialized for client-side usage. Please remo
const serialized = Object.fromEntries(
Object.entries(value).map(([k, v]) => {
return [k, convertToSerializedForm(v, metadata, parents)];
- })
+ }),
);
parents.delete(value);
return serialized;
@@ -56,7 +56,7 @@ Cyclic references cannot be safely serialized for client-side usage. Please remo
function convertToSerializedForm(
value: any,
metadata: AstroComponentMetadata | Record<string, any> = {},
- parents = new WeakSet<any>()
+ parents = new WeakSet<any>(),
): [ValueOf<typeof PROP_TYPE>, any] | [ValueOf<typeof PROP_TYPE>] {
const tag = Object.prototype.toString.call(value);
switch (tag) {
diff --git a/packages/astro/src/runtime/server/transition.ts b/packages/astro/src/runtime/server/transition.ts
index 26c5915c1..8887d3dae 100644
--- a/packages/astro/src/runtime/server/transition.ts
+++ b/packages/astro/src/runtime/server/transition.ts
@@ -34,7 +34,7 @@ const getAnimations = (name: TransitionAnimationValue) => {
const addPairs = (
animations: TransitionDirectionalAnimations | Record<string, TransitionAnimationPair>,
- stylesheet: ViewTransitionStyleSheet
+ stylesheet: ViewTransitionStyleSheet,
) => {
for (const [direction, images] of Object.entries(animations) as Entries<typeof animations>) {
for (const [image, rules] of Object.entries(images) as Entries<
@@ -89,7 +89,7 @@ export function renderTransition(
result: SSRResult,
hash: string,
animationName: TransitionAnimationValue | undefined,
- transitionName: string
+ transitionName: string,
) {
if (typeof (transitionName ?? '') !== 'string') {
throw new Error(`Invalid transition name {${transitionName}}`);
@@ -116,7 +116,7 @@ export function renderTransition(
export function createAnimationScope(
transitionName: string,
- animations: Record<string, TransitionAnimationPair>
+ animations: Record<string, TransitionAnimationPair>,
) {
const hash = Math.random().toString(36).slice(2, 8);
const scope = `astro-${hash}`;
@@ -133,7 +133,7 @@ class ViewTransitionStyleSheet {
constructor(
private scope: string,
- private name: string
+ private name: string,
) {}
toString() {
@@ -170,14 +170,14 @@ class ViewTransitionStyleSheet {
'fallback',
// Two selectors here, the second in case there is an animation on the root.
`[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"],
- [data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }`
+ [data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }`,
);
}
addAnimationPair(
direction: 'forwards' | 'backwards' | string,
image: 'old' | 'new',
- rules: TransitionAnimation | TransitionAnimation[]
+ rules: TransitionAnimation | TransitionAnimation[],
) {
const { scope, name } = this;
const animation = stringifyAnimation(rules);
@@ -191,7 +191,7 @@ class ViewTransitionStyleSheet {
this.addRule(
'fallback',
`${prefix}[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"],
- ${prefix}[data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }`
+ ${prefix}[data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }`,
);
}
}
diff --git a/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts b/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts
index bb3c6fcb7..32c91752f 100644
--- a/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts
+++ b/packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts
@@ -28,14 +28,14 @@ export default function astroDevToolbar({ settings, logger }: AstroPluginOptions
server.hot.on('astro:devtoolbar:error:load', (args) => {
logger.error(
'toolbar',
- `Failed to load dev toolbar app from ${args.entrypoint}: ${args.error}`
+ `Failed to load dev toolbar app from ${args.entrypoint}: ${args.error}`,
);
});
server.hot.on('astro:devtoolbar:error:init', (args) => {
logger.error(
'toolbar',
- `Failed to initialize dev toolbar app ${args.app.name} (${args.app.id}):\n${args.error}`
+ `Failed to initialize dev toolbar app ${args.app.name} (${args.app.id}):\n${args.error}`,
);
});
@@ -51,7 +51,7 @@ export default function astroDevToolbar({ settings, logger }: AstroPluginOptions
telemetry.record(
eventAppToggled({
appName: nameToRecord,
- })
+ }),
);
}, 200);
});
@@ -64,12 +64,12 @@ export default function astroDevToolbar({ settings, logger }: AstroPluginOptions
.map(
(plugin) =>
`safeLoadPlugin(${JSON.stringify(
- plugin
+ plugin,
)}, async () => (await import(${JSON.stringify(
- typeof plugin === 'string' ? plugin : plugin.entrypoint
+ typeof plugin === 'string' ? plugin : plugin.entrypoint,
)})).default, ${JSON.stringify(
- typeof plugin === 'string' ? plugin : plugin.entrypoint
- )})`
+ typeof plugin === 'string' ? plugin : plugin.entrypoint,
+ )})`,
)
.join(',')}]));
};
diff --git a/packages/astro/src/transitions/events.ts b/packages/astro/src/transitions/events.ts
index 3c4b4d2e2..39abd46bb 100644
--- a/packages/astro/src/transitions/events.ts
+++ b/packages/astro/src/transitions/events.ts
@@ -38,7 +38,7 @@ class BeforeEvent extends Event {
sourceElement: Element | undefined,
info: any,
newDocument: Document,
- signal: AbortSignal
+ signal: AbortSignal,
) {
super(type, eventInitDict);
this.from = from;
@@ -68,7 +68,7 @@ class BeforeEvent extends Event {
*/
export const isTransitionBeforePreparationEvent = (
- value: any
+ value: any,
): value is TransitionBeforePreparationEvent => value.type === TRANSITION_BEFORE_PREPARATION;
export class TransitionBeforePreparationEvent extends BeforeEvent {
formData: FormData | undefined;
@@ -83,7 +83,7 @@ export class TransitionBeforePreparationEvent extends BeforeEvent {
newDocument: Document,
signal: AbortSignal,
formData: FormData | undefined,
- loader: (event: TransitionBeforePreparationEvent) => Promise<void>
+ loader: (event: TransitionBeforePreparationEvent) => Promise<void>,
) {
super(
TRANSITION_BEFORE_PREPARATION,
@@ -95,7 +95,7 @@ export class TransitionBeforePreparationEvent extends BeforeEvent {
sourceElement,
info,
newDocument,
- signal
+ signal,
);
this.formData = formData;
this.loader = loader.bind(this, this);
@@ -128,7 +128,7 @@ export class TransitionBeforeSwapEvent extends BeforeEvent {
afterPreparation.sourceElement,
afterPreparation.info,
afterPreparation.newDocument,
- afterPreparation.signal
+ afterPreparation.signal,
);
this.direction = afterPreparation.direction;
this.viewTransition = viewTransition;
@@ -151,7 +151,7 @@ export async function doPreparation(
info: any,
signal: AbortSignal,
formData: FormData | undefined,
- defaultLoader: (event: TransitionBeforePreparationEvent) => Promise<void>
+ defaultLoader: (event: TransitionBeforePreparationEvent) => Promise<void>,
) {
const event = new TransitionBeforePreparationEvent(
from,
@@ -163,7 +163,7 @@ export async function doPreparation(
window.document,
signal,
formData,
- defaultLoader
+ defaultLoader,
);
if (document.dispatchEvent(event)) {
await event.loader();
diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts
index e033b202f..3150aa861 100644
--- a/packages/astro/src/transitions/router.ts
+++ b/packages/astro/src/transitions/router.ts
@@ -66,7 +66,7 @@ const announce = () => {
// Much thought went into this magic number; the gist is that screen readers
// need to see that the element changed and might not do so if it happens
// too quickly.
- 60
+ 60,
);
};
@@ -100,7 +100,7 @@ if (inBrowser) {
// returns the contents of the page or null if the router can't deal with it.
async function fetchHTML(
href: string,
- init?: RequestInit
+ init?: RequestInit,
): Promise<null | { html: string; redirected?: string; mediaType: DOMParserSupportedType }> {
try {
const res = await fetch(href, init);
@@ -162,7 +162,7 @@ const moveToLocation = (
from: URL,
options: Options,
pageTitleForBrowserHistory: string,
- historyState?: State
+ historyState?: State,
) => {
const intraPage = samePage(from, to);
@@ -181,13 +181,13 @@ const moveToLocation = (
scrollY: current.scrollY,
},
'',
- to.href
+ to.href,
);
} else {
pushState(
{ ...options.state, index: ++currentHistoryIndex, scrollX: 0, scrollY: 0 },
'',
- to.href
+ to.href,
);
}
}
@@ -234,8 +234,8 @@ function preloadStyleLinks(newDocument: Document) {
if (
!document.querySelector(
`[${PERSIST_ATTR}="${el.getAttribute(
- PERSIST_ATTR
- )}"], link[rel=stylesheet][href="${el.getAttribute('href')}"]`
+ PERSIST_ATTR,
+ )}"], link[rel=stylesheet][href="${el.getAttribute('href')}"]`,
)
) {
const c = document.createElement('link');
@@ -246,7 +246,7 @@ function preloadStyleLinks(newDocument: Document) {
new Promise<any>((resolve) => {
['load', 'error'].forEach((evName) => c.addEventListener(evName, resolve));
document.head.append(c);
- })
+ }),
);
}
}
@@ -262,7 +262,7 @@ async function updateDOM(
options: Options,
currentTransition: Transition,
historyState?: State,
- fallback?: Fallback
+ fallback?: Fallback,
) {
async function animate(phase: string) {
function isInfinite(animation: Animation) {
@@ -276,7 +276,7 @@ async function updateDOM(
document.documentElement.setAttribute(OLD_NEW_ATTR, phase);
const nextAnimations = document.getAnimations();
const newAnimations = nextAnimations.filter(
- (a) => !currentAnimations.includes(a) && !isInfinite(a)
+ (a) => !currentAnimations.includes(a) && !isInfinite(a),
);
// Wait for all new animations to finish (resolved or rejected).
// Do not reject on canceled ones.
@@ -322,7 +322,7 @@ async function transition(
from: URL,
to: URL,
options: Options,
- historyState?: State
+ historyState?: State,
) {
// The most recent navigation always has precedence
// Yes, there can be several navigation instances as the user can click links
@@ -365,7 +365,7 @@ async function transition(
options.info,
currentNavigation!.controller.signal,
options.formData,
- defaultLoader
+ defaultLoader,
);
if (prepEvent.defaultPrevented || prepEvent.signal.aborted) {
if (currentNavigation === mostRecentNavigation) mostRecentNavigation = undefined;
@@ -445,7 +445,7 @@ async function transition(
await prepareForClientOnlyComponents(
preparationEvent.newDocument,
preparationEvent.to,
- preparationEvent.signal
+ preparationEvent.signal,
);
}
async function abortAndRecreateMostRecentTransition(): Promise<Transition> {
@@ -482,7 +482,7 @@ async function transition(
// This automatically cancels any previous transition
// We also already took care that the earlier update callback got through
currentTransition.viewTransition = document.startViewTransition(
- async () => await updateDOM(prepEvent, options, currentTransition, historyState)
+ async () => await updateDOM(prepEvent, options, currentTransition, historyState),
);
} else {
// Simulation mode requires a bit more manual work
@@ -554,7 +554,7 @@ export async function navigate(href: string, options?: Options) {
if (!navigateOnServerWarned) {
// instantiate an error for the stacktrace to show to user.
const warning = new Error(
- 'The view transitions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.'
+ 'The view transitions client API was called during a server side render. This may be unintentional as the navigate() function is expected to be called in response to user interactions. Please make sure that your usage is correct.',
);
warning.name = 'Warning';
// eslint-disable-next-line no-console
@@ -639,7 +639,7 @@ if (inBrowser) {
(lastIndex = history.state.index), (lastY = scrollY), (lastX = scrollX);
intervalId = window.setInterval(scrollInterval, 50);
},
- { passive: true }
+ { passive: true },
);
}
}
@@ -653,7 +653,7 @@ if (inBrowser) {
async function prepareForClientOnlyComponents(
newDocument: Document,
toLocation: URL,
- signal: AbortSignal
+ signal: AbortSignal,
) {
// Any client:only component on the next page?
if (newDocument.body.querySelector(`astro-island[client='only']`)) {
@@ -675,7 +675,7 @@ async function prepareForClientOnlyComponents(
if (nextHead) {
// Collect the vite ids of all styles present in the next head
const viteIds = [...nextHead.querySelectorAll(`style[${VITE_ID}]`)].map((style) =>
- style.getAttribute(VITE_ID)
+ style.getAttribute(VITE_ID),
);
// Copy required styles to the new document if they are from hydration.
viteIds.forEach((id) => {
@@ -690,7 +690,7 @@ async function prepareForClientOnlyComponents(
async function hydrationDone(loadingPage: HTMLIFrameElement) {
if (!signal.aborted) {
await new Promise((r) =>
- loadingPage.contentWindow?.addEventListener('load', r, { once: true })
+ loadingPage.contentWindow?.addEventListener('load', r, { once: true }),
);
}
return new Promise<void>(async (r) => {
diff --git a/packages/astro/src/transitions/swap-functions.ts b/packages/astro/src/transitions/swap-functions.ts
index f9c089e5a..4c8db82ee 100644
--- a/packages/astro/src/transitions/swap-functions.ts
+++ b/packages/astro/src/transitions/swap-functions.ts
@@ -38,10 +38,10 @@ export function deselectScripts(doc: Document) {
export function swapRootAttributes(doc: Document) {
const html = document.documentElement;
const astroAttributes = [...html.attributes].filter(
- ({ name }) => (html.removeAttribute(name), name.startsWith('data-astro-'))
+ ({ name }) => (html.removeAttribute(name), name.startsWith('data-astro-')),
);
[...doc.documentElement.attributes, ...astroAttributes].forEach(({ name, value }) =>
- html.setAttribute(name, value)
+ html.setAttribute(name, value),
);
}
diff --git a/packages/astro/src/virtual-modules/container.ts b/packages/astro/src/virtual-modules/container.ts
index a4da62972..420b3e3e2 100644
--- a/packages/astro/src/virtual-modules/container.ts
+++ b/packages/astro/src/virtual-modules/container.ts
@@ -25,7 +25,7 @@ export async function loadRenderers(renderers: AstroRenderer[]) {
} as SSRLoadedRenderer;
}
return undefined;
- })
+ }),
);
return loadedRenderers.filter((r): r is SSRLoadedRenderer => Boolean(r));
diff --git a/packages/astro/src/virtual-modules/i18n.ts b/packages/astro/src/virtual-modules/i18n.ts
index f7365ea62..aacdd80a9 100644
--- a/packages/astro/src/virtual-modules/i18n.ts
+++ b/packages/astro/src/virtual-modules/i18n.ts
@@ -254,7 +254,7 @@ export const pathHasLocale = (path: string) => I18nInternals.pathHasLocale(path,
*/
export let redirectToDefaultLocale: (
context: APIContext,
- statusCode?: ValidRedirectStatus
+ statusCode?: ValidRedirectStatus,
) => Response | undefined;
if (i18n?.routing === 'manual') {
diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts
index 39acd000c..0e48d8a66 100644
--- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts
+++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts
@@ -48,7 +48,7 @@ export default function astro(): Plugin {
s.overwrite(
firstArgStart,
lastArgEnd,
- `import.meta.glob(${firstArg}), () => ${firstArg}`
+ `import.meta.glob(${firstArg}), () => ${firstArg}`,
);
}
},
diff --git a/packages/astro/src/vite-plugin-astro-server/base.ts b/packages/astro/src/vite-plugin-astro-server/base.ts
index 7f17d2afe..bea642f6f 100644
--- a/packages/astro/src/vite-plugin-astro-server/base.ts
+++ b/packages/astro/src/vite-plugin-astro-server/base.ts
@@ -11,7 +11,7 @@ import { writeHtmlResponse } from './response.js';
export function baseMiddleware(
settings: AstroSettings,
- logger: Logger
+ logger: Logger,
): vite.Connect.NextHandleFunction {
const { config } = settings;
const site = config.site ? new URL(config.base, config.site) : undefined;
@@ -55,15 +55,15 @@ export function baseMiddleware(
fs.stat(publicPath, (_err, stats) => {
if (stats) {
const publicDir = appendForwardSlash(
- path.posix.relative(config.root.pathname, config.publicDir.pathname)
+ path.posix.relative(config.root.pathname, config.publicDir.pathname),
);
const expectedLocation = new URL(devRootURL.pathname + url, devRootURL).pathname;
logger.error(
'router',
`Request URLs for ${bold(
- publicDir
- )} assets must also include your base. "${expectedLocation}" expected, but received "${url}".`
+ publicDir,
+ )} assets must also include your base. "${expectedLocation}" expected, but received "${url}".`,
);
const html = subpathNotUsedTemplate(devRoot, pathname);
return writeHtmlResponse(res, 404, html);
diff --git a/packages/astro/src/vite-plugin-astro-server/css.ts b/packages/astro/src/vite-plugin-astro-server/css.ts
index cda2ef002..c2dd5f6d7 100644
--- a/packages/astro/src/vite-plugin-astro-server/css.ts
+++ b/packages/astro/src/vite-plugin-astro-server/css.ts
@@ -12,7 +12,7 @@ interface ImportedStyle {
/** Given a filePath URL, crawl Vite’s module graph to find all style imports. */
export async function getStylesForURL(
filePath: URL,
- loader: ModuleLoader
+ loader: ModuleLoader,
): Promise<{ urls: Set<string>; styles: ImportedStyle[]; crawledFiles: Set<string> }> {
const importedCssUrls = new Set<string>();
// Map of url to injected style object. Use a `url` key to deduplicate styles
diff --git a/packages/astro/src/vite-plugin-astro-server/error.ts b/packages/astro/src/vite-plugin-astro-server/error.ts
index f29a49ba6..24db9dc49 100644
--- a/packages/astro/src/vite-plugin-astro-server/error.ts
+++ b/packages/astro/src/vite-plugin-astro-server/error.ts
@@ -10,7 +10,7 @@ export function recordServerError(
loader: ModuleLoader,
config: AstroConfig,
{ logger }: DevPipeline,
- _err: unknown
+ _err: unknown,
) {
const err = createSafeError(_err);
diff --git a/packages/astro/src/vite-plugin-astro-server/metadata.ts b/packages/astro/src/vite-plugin-astro-server/metadata.ts
index 09e2373cf..793ee5669 100644
--- a/packages/astro/src/vite-plugin-astro-server/metadata.ts
+++ b/packages/astro/src/vite-plugin-astro-server/metadata.ts
@@ -6,7 +6,7 @@ import { crawlGraph } from './vite.js';
export async function getComponentMetadata(
filePath: URL,
- loader: ModuleLoader
+ loader: ModuleLoader,
): Promise<SSRResult['componentMetadata']> {
const map: SSRResult['componentMetadata'] = new Map();
diff --git a/packages/astro/src/vite-plugin-astro-server/pipeline.ts b/packages/astro/src/vite-plugin-astro-server/pipeline.ts
index 2c718d3ab..4386eb154 100644
--- a/packages/astro/src/vite-plugin-astro-server/pipeline.ts
+++ b/packages/astro/src/vite-plugin-astro-server/pipeline.ts
@@ -46,7 +46,7 @@ export class DevPipeline extends Pipeline {
readonly manifest: SSRManifest,
readonly settings: AstroSettings,
readonly config = settings.config,
- readonly defaultRoutes = createDefaultRoutes(manifest)
+ readonly defaultRoutes = createDefaultRoutes(manifest),
) {
const mode = 'development';
const resolve = createResolve(loader, config.root);
@@ -64,7 +64,7 @@ export class DevPipeline extends Pipeline {
logger,
manifest,
settings,
- }: Pick<DevPipeline, 'loader' | 'logger' | 'manifest' | 'settings'>
+ }: Pick<DevPipeline, 'loader' | 'logger' | 'manifest' | 'settings'>,
) {
const pipeline = new DevPipeline(loader, logger, manifest, settings);
pipeline.manifestData = manifestData;
@@ -202,7 +202,7 @@ export class DevPipeline extends Pipeline {
async tryRewrite(
payload: RewritePayload,
request: Request,
- _sourceRoute: RouteData
+ _sourceRoute: RouteData,
): Promise<[RouteData, ComponentInstance, URL]> {
if (!this.manifestData) {
throw new Error('Missing manifest data. This is an internal error, please file an issue.');
diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts
index a342220ed..7d1e2fb6f 100644
--- a/packages/astro/src/vite-plugin-astro-server/plugin.ts
+++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts
@@ -37,7 +37,7 @@ export default function createVitePluginAstroServer({
const manifest = createDevelopmentManifest(settings);
let manifestData: ManifestData = injectDefaultRoutes(
manifest,
- createRouteManifest({ settings, fsMod }, logger)
+ createRouteManifest({ settings, fsMod }, logger),
);
const pipeline = DevPipeline.create(manifestData, { loader, logger, manifest, settings });
const controller = createController({ loader });
@@ -70,7 +70,7 @@ export default function createVitePluginAstroServer({
const { errorWithMetadata } = recordServerError(loader, settings.config, pipeline, error);
setTimeout(
async () => loader.webSocketSend(await getViteErrorPayload(errorWithMetadata)),
- 200
+ 200,
);
}
diff --git a/packages/astro/src/vite-plugin-astro-server/response.ts b/packages/astro/src/vite-plugin-astro-server/response.ts
index c6e034aef..2ccf1aade 100644
--- a/packages/astro/src/vite-plugin-astro-server/response.ts
+++ b/packages/astro/src/vite-plugin-astro-server/response.ts
@@ -10,7 +10,7 @@ import notFoundTemplate from '../template/4xx.js';
export async function handle404Response(
origin: string,
req: http.IncomingMessage,
- res: http.ServerResponse
+ res: http.ServerResponse,
) {
const pathname = decodeURI(new URL(origin + req.url).pathname);
@@ -26,10 +26,10 @@ export async function handle404Response(
export async function handle500Response(
loader: ModuleLoader,
res: http.ServerResponse,
- err: ErrorWithMetadata
+ err: ErrorWithMetadata,
) {
res.on('close', async () =>
- setTimeout(async () => loader.webSocketSend(await getViteErrorPayload(err)), 200)
+ setTimeout(async () => loader.webSocketSend(await getViteErrorPayload(err)), 200),
);
if (res.headersSent) {
res.write(`<script type="module" src="/@vite/client"></script>`);
@@ -38,7 +38,7 @@ export async function handle500Response(
writeHtmlResponse(
res,
500,
- `<title>${err.name}</title><script type="module" src="/@vite/client"></script>`
+ `<title>${err.name}</title><script type="module" src="/@vite/client"></script>`,
);
}
}
@@ -102,7 +102,7 @@ export async function writeWebResponse(res: http.ServerResponse, webResponse: Re
export async function writeSSRResult(
webRequest: Request,
webResponse: Response,
- res: http.ServerResponse
+ res: http.ServerResponse,
) {
Reflect.set(webRequest, Symbol.for('astro.responseSent'), true);
return writeWebResponse(res, webResponse);
diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts
index 07d6cd2b1..aa70d5324 100644
--- a/packages/astro/src/vite-plugin-astro-server/route.ts
+++ b/packages/astro/src/vite-plugin-astro-server/route.ts
@@ -47,7 +47,7 @@ function getCustom500Route(manifestData: ManifestData): RouteData | undefined {
export async function matchRoute(
pathname: string,
manifestData: ManifestData,
- pipeline: DevPipeline
+ pipeline: DevPipeline,
): Promise<MatchedRoute | undefined> {
const { config, logger, routeCache, serverLike, settings } = pipeline;
const matches = matchAllRoutes(pathname, manifestData);
@@ -97,8 +97,8 @@ export async function matchRoute(
logger.warn(
'router',
`${AstroErrorData.NoMatchingStaticPathFound.message(
- pathname
- )}\n\n${AstroErrorData.NoMatchingStaticPathFound.hint(possibleRoutes)}`
+ pathname,
+ )}\n\n${AstroErrorData.NoMatchingStaticPathFound.hint(possibleRoutes)}`,
);
}
@@ -234,7 +234,7 @@ export async function handleRoute({
statusCode: isRewrite ? response.status : status ?? response.status,
isRewrite,
reqTime: timeEnd - timeStart,
- })
+ }),
);
}
if (response.status === 404 && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== 'no') {
diff --git a/packages/astro/src/vite-plugin-astro-server/scripts.ts b/packages/astro/src/vite-plugin-astro-server/scripts.ts
index 4b94d12f5..e21d44116 100644
--- a/packages/astro/src/vite-plugin-astro-server/scripts.ts
+++ b/packages/astro/src/vite-plugin-astro-server/scripts.ts
@@ -9,7 +9,7 @@ import { crawlGraph } from './vite.js';
export async function getScriptsForURL(
filePath: URL,
root: URL,
- loader: ModuleLoader
+ loader: ModuleLoader,
): Promise<{ scripts: Set<SSRElement>; crawledFiles: Set<string> }> {
const elements = new Set<SSRElement>();
const crawledFiles = new Set<string>();
diff --git a/packages/astro/src/vite-plugin-astro-server/vite.ts b/packages/astro/src/vite-plugin-astro-server/vite.ts
index bd327081b..147853954 100644
--- a/packages/astro/src/vite-plugin-astro-server/vite.ts
+++ b/packages/astro/src/vite-plugin-astro-server/vite.ts
@@ -18,7 +18,7 @@ export async function* crawlGraph(
loader: ModuleLoader,
_id: string,
isRootFile: boolean,
- scanned = new Set<string>()
+ scanned = new Set<string>(),
): AsyncGenerator<ModuleNode, void, unknown> {
const id = unwrapId(_id);
const importedModules = new Set<ModuleNode>();
diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts
index c7845568a..8dfb68a16 100644
--- a/packages/astro/src/vite-plugin-astro/compile.ts
+++ b/packages/astro/src/vite-plugin-astro/compile.ts
@@ -61,12 +61,12 @@ export async function compileAstro({
const { fileId: file, fileUrl: url } = getFileInfo(
compileProps.filename,
- compileProps.astroConfig
+ compileProps.astroConfig,
);
let SUFFIX = '';
SUFFIX += `\nconst $$file = ${JSON.stringify(file)};\nconst $$url = ${JSON.stringify(
- url
+ url,
)};export { $$file as file, $$url as url };\n`;
// Add HMR handling in dev mode.
@@ -126,7 +126,7 @@ async function enhanceCompileError({
if (frontmatterErr?.message) {
frontmatterErr.message = frontmatterErr.message.replace(
'end of file',
- 'end of frontmatter'
+ 'end of frontmatter',
);
}
throw frontmatterErr;
diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts
index 17c10e768..93fecc7aa 100644
--- a/packages/astro/src/vite-plugin-astro/hmr.ts
+++ b/packages/astro/src/vite-plugin-astro/hmr.ts
@@ -10,7 +10,7 @@ export interface HandleHotUpdateOptions {
export async function handleHotUpdate(
ctx: HmrContext,
- { logger, astroFileToCompileMetadata }: HandleHotUpdateOptions
+ { logger, astroFileToCompileMetadata }: HandleHotUpdateOptions,
) {
// HANDLING 1: Invalidate compile metadata if CSS dependency updated
//
diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts
index 456b7677d..d5968a905 100644
--- a/packages/astro/src/vite-plugin-astro/index.ts
+++ b/packages/astro/src/vite-plugin-astro/index.ts
@@ -112,7 +112,7 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl
if (!compileMetadata) {
throw new Error(
`No cached compile metadata found for "${id}". The main Astro module "${filename}" should have ` +
- `compiled and filled the metadata first, before its virtual modules can be requested.`
+ `compiled and filled the metadata first, before its virtual modules can be requested.`,
);
}
@@ -166,7 +166,7 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl
if (src.startsWith('/') && !isBrowserPath(src)) {
const publicDir = config.publicDir.pathname.replace(/\/$/, '').split('/').pop() + '/';
throw new Error(
- `\n\n<script src="${src}"> references an asset in the "${publicDir}" directory. Please add the "is:inline" directive to keep this asset from being bundled.\n\nFile: ${id}`
+ `\n\n<script src="${src}"> references an asset in the "${publicDir}" directory. Please add the "is:inline" directive to keep this asset from being bundled.\n\nFile: ${id}`,
);
}
}
@@ -256,6 +256,6 @@ export default function astro({ settings, logger }: AstroPluginOptions): vite.Pl
function appendSourceMap(content: string, map?: string) {
if (!map) return content;
return `${content}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${Buffer.from(
- map
+ map,
).toString('base64')}`;
}
diff --git a/packages/astro/src/vite-plugin-config-alias/index.ts b/packages/astro/src/vite-plugin-config-alias/index.ts
index a5f4ae53c..cb9bdc48c 100644
--- a/packages/astro/src/vite-plugin-config-alias/index.ts
+++ b/packages/astro/src/vite-plugin-config-alias/index.ts
@@ -28,9 +28,9 @@ const getConfigAlias = (settings: AstroSettings): Alias[] | null => {
const find = new RegExp(
`^${[...alias]
.map((segment) =>
- segment === '*' ? '(.+)' : segment.replace(/[\\^$*+?.()|[\]{}]/, '\\$&')
+ segment === '*' ? '(.+)' : segment.replace(/[\\^$*+?.()|[\]{}]/, '\\$&'),
)
- .join('')}$`
+ .join('')}$`,
);
/** Internal index used to calculate the matching id in a replacement. */
diff --git a/packages/astro/src/vite-plugin-env/index.ts b/packages/astro/src/vite-plugin-env/index.ts
index 00df8f4d3..ea75e752f 100644
--- a/packages/astro/src/vite-plugin-env/index.ts
+++ b/packages/astro/src/vite-plugin-env/index.ts
@@ -20,7 +20,7 @@ const exportConstPrerenderRe = /\bexport\s+const\s+prerender\s*=\s*import\.meta\
function getPrivateEnv(
viteConfig: vite.ResolvedConfig,
- astroConfig: AstroConfig
+ astroConfig: AstroConfig,
): Record<string, string> {
let envPrefixes: string[] = ['PUBLIC_'];
if (viteConfig.envPrefix) {
@@ -33,7 +33,7 @@ function getPrivateEnv(
const fullEnv = loadEnv(
viteConfig.mode,
viteConfig.envDir ?? fileURLToPath(astroConfig.root),
- ''
+ '',
);
const privateEnv: Record<string, string> = {};
@@ -79,7 +79,7 @@ async function replaceDefine(
code: string,
id: string,
define: Record<string, string>,
- config: vite.ResolvedConfig
+ config: vite.ResolvedConfig,
): Promise<{ code: string; map: string | null }> {
// Since esbuild doesn't support replacing complex expressions, we replace `import.meta.env`
// with a marker string first, then postprocess and apply the `Object.assign` code.
@@ -89,7 +89,7 @@ async function replaceDefine(
// Compute the marker from the length of the replaced code. We do this so that esbuild generates
// the sourcemap with the right column offset when we do the postprocessing.
const marker = `__astro_import_meta_env${'_'.repeat(
- env.length - 23 /* length of preceding string */
+ env.length - 23 /* length of preceding string */,
)}`;
replacementMarkers[marker] = env;
define = { ...define, 'import.meta.env': marker };
@@ -133,11 +133,11 @@ export default function envVitePlugin({ settings }: EnvPluginOptions): vite.Plug
// HACK: move ourselves before Vite's define plugin to apply replacements at the right time (before Vite normal plugins)
const viteDefinePluginIndex = resolvedConfig.plugins.findIndex(
- (p) => p.name === 'vite:define'
+ (p) => p.name === 'vite:define',
);
if (viteDefinePluginIndex !== -1) {
const myPluginIndex = resolvedConfig.plugins.findIndex(
- (p) => p.name === 'astro:vite-plugin-env'
+ (p) => p.name === 'astro:vite-plugin-env',
);
if (myPluginIndex !== -1) {
const myPlugin = resolvedConfig.plugins[myPluginIndex];
diff --git a/packages/astro/src/vite-plugin-head/index.ts b/packages/astro/src/vite-plugin-head/index.ts
index 07169bd96..a7e35dedb 100644
--- a/packages/astro/src/vite-plugin-head/index.ts
+++ b/packages/astro/src/vite-plugin-head/index.ts
@@ -22,7 +22,7 @@ export default function configHeadVitePlugin(): vite.Plugin {
id: string,
prop: P,
value: V,
- seen = new Set<string>()
+ seen = new Set<string>(),
) {
if (seen.has(id)) return;
seen.add(id);
diff --git a/packages/astro/src/vite-plugin-html/transform/escape.ts b/packages/astro/src/vite-plugin-html/transform/escape.ts
index d55233adc..c367e834a 100644
--- a/packages/astro/src/vite-plugin-html/transform/escape.ts
+++ b/packages/astro/src/vite-plugin-html/transform/escape.ts
@@ -13,7 +13,7 @@ const rehypeEscape: Plugin<[{ s: MagicString }], Root> = ({ s }) => {
s.overwrite(
node.position!.start.offset!,
node.position!.end.offset!,
- escapeTemplateLiteralCharacters(node.value)
+ escapeTemplateLiteralCharacters(node.value),
);
}
} else if (node.type === 'element') {
diff --git a/packages/astro/src/vite-plugin-html/transform/slots.ts b/packages/astro/src/vite-plugin-html/transform/slots.ts
index 7969db383..82046dd33 100644
--- a/packages/astro/src/vite-plugin-html/transform/slots.ts
+++ b/packages/astro/src/vite-plugin-html/transform/slots.ts
@@ -21,7 +21,7 @@ const rehypeSlots: Plugin<[{ s: MagicString }], Root> = ({ s }) => {
s.overwrite(
start,
end,
- `\${${SLOT_PREFIX}["${name}"] ?? \`${escapeTemplateLiteralCharacters(text).trim()}\`}`
+ `\${${SLOT_PREFIX}["${name}"] ?? \`${escapeTemplateLiteralCharacters(text).trim()}\`}`,
);
}
});
diff --git a/packages/astro/src/vite-plugin-integrations-container/index.ts b/packages/astro/src/vite-plugin-integrations-container/index.ts
index 5c1bb044d..49122b24f 100644
--- a/packages/astro/src/vite-plugin-integrations-container/index.ts
+++ b/packages/astro/src/vite-plugin-integrations-container/index.ts
@@ -24,7 +24,7 @@ export default function astroIntegrationsContainerPlugin({
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
// Ensure the injectedRoutes are all resolved to their final paths through Rollup
settings.resolvedInjectedRoutes = await Promise.all(
- settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route))
+ settings.injectedRoutes.map((route) => resolveEntryPoint.call(this, route)),
);
},
};
@@ -32,7 +32,7 @@ export default function astroIntegrationsContainerPlugin({
async function resolveEntryPoint(
this: PluginContext,
- route: InjectedRoute
+ route: InjectedRoute,
): Promise<ResolvedInjectedRoute> {
const resolvedId = await this.resolve(route.entrypoint)
.then((res) => res?.id)
diff --git a/packages/astro/src/vite-plugin-markdown/images.ts b/packages/astro/src/vite-plugin-markdown/images.ts
index 29afa2001..b9ea98b82 100644
--- a/packages/astro/src/vite-plugin-markdown/images.ts
+++ b/packages/astro/src/vite-plugin-markdown/images.ts
@@ -15,7 +15,7 @@ export function getMarkdownCodeForImages(imagePaths: MarkdownImagePath[], html:
return `{
const regex = new RegExp('__ASTRO_IMAGE_="([^"]*' + ${rawUrl.replace(
/[.*+?^${}()|[\]\\]/g,
- '\\\\$&'
+ '\\\\$&',
)} + '[^"]*)"', 'g');
let match;
let occurrenceCounter = 0;
diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts
index 6859af148..37af2dc50 100644
--- a/packages/astro/src/vite-plugin-markdown/index.ts
+++ b/packages/astro/src/vite-plugin-markdown/index.ts
@@ -23,11 +23,11 @@ interface AstroPluginOptions {
}
const astroServerRuntimeModulePath = normalizePath(
- fileURLToPath(new URL('../runtime/server/index.js', import.meta.url))
+ fileURLToPath(new URL('../runtime/server/index.js', import.meta.url)),
);
const astroErrorModulePath = normalizePath(
- fileURLToPath(new URL('../core/errors/index.js', import.meta.url))
+ fileURLToPath(new URL('../core/errors/index.js', import.meta.url)),
);
export default function markdown({ settings, logger }: AstroPluginOptions): Plugin {
@@ -65,7 +65,7 @@ export default function markdown({ settings, logger }: AstroPluginOptions): Plug
// should be called in between those two lifecycles, so this error should never happen
if (!processor) {
return this.error(
- 'MDX processor is not initialized. This is an internal error. Please file an issue.'
+ 'MDX processor is not initialized. This is an internal error. Please file an issue.',
);
}
@@ -100,13 +100,13 @@ export default function markdown({ settings, logger }: AstroPluginOptions): Plug
if (frontmatter.setup) {
logger.warn(
'markdown',
- `[${id}] Astro now supports MDX! Support for components in ".md" (or alternative extensions like ".markdown") files using the "setup" frontmatter is no longer enabled by default. Migrate this file to MDX.`
+ `[${id}] Astro now supports MDX! Support for components in ".md" (or alternative extensions like ".markdown") files using the "setup" frontmatter is no longer enabled by default. Migrate this file to MDX.`,
);
}
const code = `
import { unescapeHTML, spreadAttributes, createComponent, render, renderComponent, maybeRenderHead } from ${JSON.stringify(
- astroServerRuntimeModulePath
+ astroServerRuntimeModulePath,
)};
import { AstroError, AstroErrorData } from ${JSON.stringify(astroErrorModulePath)};
${layout ? `import Layout from ${JSON.stringify(layout)};` : ''}
diff --git a/packages/astro/src/vite-plugin-mdx/index.ts b/packages/astro/src/vite-plugin-mdx/index.ts
index 1c8e2ced6..1c85d9226 100644
--- a/packages/astro/src/vite-plugin-mdx/index.ts
+++ b/packages/astro/src/vite-plugin-mdx/index.ts
@@ -6,7 +6,7 @@ import { transformJSX } from './transform-jsx.js';
// Format inspired by https://github.com/vitejs/vite/blob/main/packages/vite/src/node/constants.ts#L54
const SPECIAL_QUERY_REGEX = new RegExp(
- `[?&](?:worker|sharedworker|raw|url|${CONTENT_FLAG}|${PROPAGATED_ASSET_FLAG})\\b`
+ `[?&](?:worker|sharedworker|raw|url|${CONTENT_FLAG}|${PROPAGATED_ASSET_FLAG})\\b`,
);
/**
diff --git a/packages/astro/src/vite-plugin-mdx/tag.ts b/packages/astro/src/vite-plugin-mdx/tag.ts
index 0bf9722a5..a65f99806 100644
--- a/packages/astro/src/vite-plugin-mdx/tag.ts
+++ b/packages/astro/src/vite-plugin-mdx/tag.ts
@@ -26,11 +26,11 @@ export const tagExportsPlugin: PluginObj = {
[
t.importSpecifier(
t.identifier('__astro_tag_component__'),
- t.identifier('__astro_tag_component__')
+ t.identifier('__astro_tag_component__'),
),
],
- t.stringLiteral('astro/runtime/server/index.js')
- )
+ t.stringLiteral('astro/runtime/server/index.js'),
+ ),
);
},
// For each export we found, inject `__astro_tag_component__(exportName, rendererName)`
@@ -43,8 +43,8 @@ export const tagExportsPlugin: PluginObj = {
t.callExpression(t.identifier('__astro_tag_component__'), [
t.identifier(id),
t.stringLiteral(rendererName),
- ])
- )
+ ]),
+ ),
);
}
}
@@ -66,7 +66,7 @@ export const tagExportsPlugin: PluginObj = {
: '_hoc_function';
const uidIdentifier = path.scope.generateUidIdentifier(varName);
path.insertBefore(
- t.variableDeclaration('const', [t.variableDeclarator(uidIdentifier, node.declaration)])
+ t.variableDeclaration('const', [t.variableDeclarator(uidIdentifier, node.declaration)]),
);
node.declaration = uidIdentifier;
} else if (t.isFunctionDeclaration(node.declaration) && !node.declaration.id?.name) {
diff --git a/packages/astro/src/vite-plugin-mdx/transform-jsx.ts b/packages/astro/src/vite-plugin-mdx/transform-jsx.ts
index e2e8e97bc..c3bb8ed76 100644
--- a/packages/astro/src/vite-plugin-mdx/transform-jsx.ts
+++ b/packages/astro/src/vite-plugin-mdx/transform-jsx.ts
@@ -11,7 +11,7 @@ import { tagExportsPlugin } from './tag.js';
export async function transformJSX(
code: string,
id: string,
- ssr?: boolean
+ ssr?: boolean,
): Promise<TransformResult> {
const options = await getJsxTransformOptions();
const plugins = ssr ? [...(options.plugins ?? []), tagExportsPlugin] : options.plugins;
diff --git a/packages/astro/src/vite-plugin-scanner/index.ts b/packages/astro/src/vite-plugin-scanner/index.ts
index ecb9c12a5..05be99a07 100644
--- a/packages/astro/src/vite-plugin-scanner/index.ts
+++ b/packages/astro/src/vite-plugin-scanner/index.ts
@@ -56,8 +56,8 @@ export default function astroScannerPlugin({
logger.warn(
'router',
`getStaticPaths() ignored in dynamic page ${bold(
- rootRelativePath(settings.config.root, fileURL, true)
- )}. Add \`export const prerender = true;\` to prerender the page as static HTML during the build process.`
+ rootRelativePath(settings.config.root, fileURL, true),
+ )}. Add \`export const prerender = true;\` to prerender the page as static HTML during the build process.`,
);
}
diff --git a/packages/astro/src/vite-plugin-scanner/scan.ts b/packages/astro/src/vite-plugin-scanner/scan.ts
index 4e0e5fbfe..f447a1f28 100644
--- a/packages/astro/src/vite-plugin-scanner/scan.ts
+++ b/packages/astro/src/vite-plugin-scanner/scan.ts
@@ -39,7 +39,7 @@ let didInit = false;
export async function scan(
code: string,
id: string,
- settings?: AstroSettings
+ settings?: AstroSettings,
): Promise<PageOptions> {
if (!includesExport(code)) return {};
if (!didInit) {
@@ -72,7 +72,7 @@ export async function scan(
message: AstroErrorData.InvalidPrerenderExport.message(
prefix,
suffix,
- settings?.config.output === 'hybrid'
+ settings?.config.output === 'hybrid',
),
location: { file: id },
});
diff --git a/packages/astro/src/vite-plugin-utils/index.ts b/packages/astro/src/vite-plugin-utils/index.ts
index 74167a36a..a0133104c 100644
--- a/packages/astro/src/vite-plugin-utils/index.ts
+++ b/packages/astro/src/vite-plugin-utils/index.ts
@@ -10,7 +10,7 @@ import { viteID } from '../core/util.js';
export function getFileInfo(id: string, config: AstroConfig) {
const sitePathname = appendForwardSlash(
- config.site ? new URL(config.base, config.site).pathname : config.base
+ config.site ? new URL(config.base, config.site).pathname : config.base,
);
const fileId = id.split('?')[0];
diff --git a/packages/astro/templates/content/types.d.ts b/packages/astro/templates/content/types.d.ts
index 23c5eb984..8572771b1 100644
--- a/packages/astro/templates/content/types.d.ts
+++ b/packages/astro/templates/content/types.d.ts
@@ -29,7 +29,7 @@ declare module 'astro:content' {
>(
collection: C,
// Note that this has to accept a regular string too, for SSR
- entrySlug: E
+ entrySlug: E,
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
@@ -37,16 +37,16 @@ declare module 'astro:content' {
/** @deprecated Use `getEntry` instead. */
export function getDataEntryById<C extends keyof DataEntryMap, E extends keyof DataEntryMap[C]>(
collection: C,
- entryId: E
+ entryId: E,
): Promise<CollectionEntry<C>>;
export function getCollection<C extends keyof AnyEntryMap, E extends CollectionEntry<C>>(
collection: C,
- filter?: (entry: CollectionEntry<C>) => entry is E
+ filter?: (entry: CollectionEntry<C>) => entry is E,
): Promise<E[]>;
export function getCollection<C extends keyof AnyEntryMap>(
collection: C,
- filter?: (entry: CollectionEntry<C>) => unknown
+ filter?: (entry: CollectionEntry<C>) => unknown,
): Promise<CollectionEntry<C>[]>;
export function getEntry<
@@ -72,7 +72,7 @@ declare module 'astro:content' {
E extends ValidContentEntrySlug<C> | (string & {}),
>(
collection: C,
- slug: E
+ slug: E,
): E extends ValidContentEntrySlug<C>
? Promise<CollectionEntry<C>>
: Promise<CollectionEntry<C> | undefined>;
@@ -81,7 +81,7 @@ declare module 'astro:content' {
E extends keyof DataEntryMap[C] | (string & {}),
>(
collection: C,
- id: E
+ id: E,
): E extends keyof DataEntryMap[C]
? Promise<DataEntryMap[C][E]>
: Promise<CollectionEntry<C> | undefined>;
@@ -91,17 +91,17 @@ declare module 'astro:content' {
entries: {
collection: C;
slug: ValidContentEntrySlug<C>;
- }[]
+ }[],
): Promise<CollectionEntry<C>[]>;
export function getEntries<C extends keyof DataEntryMap>(
entries: {
collection: C;
id: keyof DataEntryMap[C];
- }[]
+ }[],
): Promise<CollectionEntry<C>[]>;
export function reference<C extends keyof AnyEntryMap>(
- collection: C
+ collection: C,
): import('astro/zod').ZodEffects<
import('astro/zod').ZodString,
C extends keyof ContentEntryMap
@@ -118,7 +118,7 @@ declare module 'astro:content' {
// if `dev` is not running to update as you edit.
// Invalid collection names will be caught at build time.
export function reference<C extends string>(
- collection: C
+ collection: C,
): import('astro/zod').ZodEffects<import('astro/zod').ZodString, never>;
type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js
index 71dc29db1..6c2ee0966 100644
--- a/packages/astro/test/0-css.test.js
+++ b/packages/astro/test/0-css.test.js
@@ -37,7 +37,7 @@ describe('CSS', function () {
},
{
timeout: 45000,
- }
+ },
);
describe('Astro Styles', () => {
@@ -260,7 +260,7 @@ describe('CSS', function () {
const el = $('#svelte-css');
const classes = el.attr('class').split(' ');
const scopedClass = classes.find(
- (name) => name !== 'svelte-css' && /^svelte-[A-Za-z\d-]+/.test(name)
+ (name) => name !== 'svelte-css' && /^svelte-[A-Za-z\d-]+/.test(name),
);
// 1. check HTML
@@ -269,7 +269,7 @@ describe('CSS', function () {
// 2. check CSS
assert.match(
bundledCSS,
- new RegExp(`.svelte-css.${scopedClass}[^{]*{font-family:ComicSansMS`)
+ new RegExp(`.svelte-css.${scopedClass}[^{]*{font-family:ComicSansMS`),
);
});
@@ -277,7 +277,7 @@ describe('CSS', function () {
const el = $('#svelte-sass');
const classes = el.attr('class').split(' ');
const scopedClass = classes.find(
- (name) => name !== 'svelte-sass' && /^svelte-[A-Za-z\d-]+/.test(name)
+ (name) => name !== 'svelte-sass' && /^svelte-[A-Za-z\d-]+/.test(name),
);
// 1. check HTML
@@ -286,7 +286,7 @@ describe('CSS', function () {
// 2. check CSS
assert.match(
bundledCSS,
- new RegExp(`.svelte-sass.${scopedClass}[^{]*{font-family:ComicSansMS`)
+ new RegExp(`.svelte-sass.${scopedClass}[^{]*{font-family:ComicSansMS`),
);
});
@@ -294,7 +294,7 @@ describe('CSS', function () {
const el = $('#svelte-scss');
const classes = el.attr('class').split(' ');
const scopedClass = classes.find(
- (name) => name !== 'svelte-scss' && /^svelte-[A-Za-z\d-]+/.test(name)
+ (name) => name !== 'svelte-scss' && /^svelte-[A-Za-z\d-]+/.test(name),
);
// 1. check HTML
@@ -303,7 +303,7 @@ describe('CSS', function () {
// 2. check CSS
assert.match(
bundledCSS,
- new RegExp(`.svelte-scss.${scopedClass}[^{]*{font-family:ComicSansMS`)
+ new RegExp(`.svelte-scss.${scopedClass}[^{]*{font-family:ComicSansMS`),
);
});
@@ -436,7 +436,7 @@ describe('CSS', function () {
assert.equal(
foundVitePreloadCSS,
false,
- 'Should not have found a preload for the dynamic CSS'
+ 'Should not have found a preload for the dynamic CSS',
);
});
diff --git a/packages/astro/test/astro-assets-dir.test.js b/packages/astro/test/astro-assets-dir.test.js
index 453248987..9cf888846 100644
--- a/packages/astro/test/astro-assets-dir.test.js
+++ b/packages/astro/test/astro-assets-dir.test.js
@@ -29,8 +29,8 @@ describe('assets dir takes the URL path inside the output directory', () => {
assert.equal(
removeTrailingSlash(new URL('./custom_dir_1', checkDir).toString()),
removeTrailingSlash(
- new URL('./fixtures/astro-assets-dir/dist/custom_dir_1', import.meta.url).toString()
- )
+ new URL('./fixtures/astro-assets-dir/dist/custom_dir_1', import.meta.url).toString(),
+ ),
);
});
});
diff --git a/packages/astro/test/astro-attrs.test.js b/packages/astro/test/astro-attrs.test.js
index f4a014042..2e020f8ea 100644
--- a/packages/astro/test/astro-attrs.test.js
+++ b/packages/astro/test/astro-attrs.test.js
@@ -34,13 +34,13 @@ describe('Attributes', async () => {
// cheerio will unescape the values, so checking that the url rendered unescaped to begin with has to be done manually
assert.equal(
html.includes('https://example.com/api/og?title=hello&description=somedescription'),
- true
+ true,
);
// cheerio will unescape the values, so checking that the url rendered unescaped to begin with has to be done manually
assert.equal(
html.includes('cmd: echo &#34;foo&#34; &#38;&#38; echo &#34;bar&#34; > /tmp/hello.txt'),
- true
+ true,
);
for (const id of Object.keys(attrs)) {
diff --git a/packages/astro/test/astro-basic.test.js b/packages/astro/test/astro-basic.test.js
index 2cfa5d27f..0fc87dd60 100644
--- a/packages/astro/test/astro-basic.test.js
+++ b/packages/astro/test/astro-basic.test.js
@@ -139,7 +139,7 @@ describe('Astro basic build', () => {
// <Input type="select"><option>option</option></Input>
assert.equal(
$('body > :nth-child(4)').prop('outerHTML'),
- '<select><option>option</option></select>'
+ '<select><option>option</option></select>',
);
// <Input type="textarea">textarea</Input>
diff --git a/packages/astro/test/astro-children.test.js b/packages/astro/test/astro-children.test.js
index 91afe112e..b5457ea71 100644
--- a/packages/astro/test/astro-children.test.js
+++ b/packages/astro/test/astro-children.test.js
@@ -79,12 +79,12 @@ describe('Component children', () => {
assert.equal(
$('#client').parent().children().length,
2,
- 'rendered the client component and a template'
+ 'rendered the client component and a template',
);
assert.equal(
$('#client').parent().find('template[data-astro-template]').length,
1,
- 'Found 1 template'
+ 'Found 1 template',
);
// test 3: If client, and children are rendered, no template is.
diff --git a/packages/astro/test/astro-class-list.test.js b/packages/astro/test/astro-class-list.test.js
index 904466123..caee0a686 100644
--- a/packages/astro/test/astro-class-list.test.js
+++ b/packages/astro/test/astro-class-list.test.js
@@ -23,7 +23,7 @@ describe('Class List', async () => {
assert.equal(
$('[class="hello goodbye hello world hello friend"]').length,
1,
- '[class="hello goodbye hello world hello friend"]'
+ '[class="hello goodbye hello world hello friend"]',
);
assert.equal($('[class="foo baz"]').length, 1, '[class="foo baz"]');
assert.equal($('span:not([class])').length, 1, 'span:not([class])');
@@ -43,7 +43,7 @@ describe('Class List', async () => {
assert.equal(
$('[class="hello goodbye hello world hello friend"]').length,
1,
- '[class="hello goodbye hello world hello friend"]'
+ '[class="hello goodbye hello world hello friend"]',
);
assert.equal($('[class="foo baz"]').length, 1, '[class="foo baz"]');
assert.equal($('span:not([class])').length, 1, 'span:not([class])');
@@ -55,7 +55,7 @@ describe('Class List', async () => {
assert.equal($('[class="test set"]').text(), 'test set');
assert.equal(
$('[class="hello goodbye hello world hello friend"]').text(),
- 'hello goodbye hello world hello friend'
+ 'hello goodbye hello world hello friend',
);
assert.equal($('[class="foo baz"]').text(), 'foo baz');
assert.equal($('span:not([class])').text(), '');
diff --git a/packages/astro/test/astro-client-only.test.js b/packages/astro/test/astro-client-only.test.js
index 33626e2f3..c0004d184 100644
--- a/packages/astro/test/astro-client-only.test.js
+++ b/packages/astro/test/astro-client-only.test.js
@@ -34,7 +34,7 @@ describe('Client only components', () => {
const stylesheets = await Promise.all(
$('link[rel=stylesheet]').map((_, el) => {
return fixture.readFile(el.attribs.href);
- })
+ }),
);
const css = stylesheets.join('');
@@ -100,7 +100,7 @@ describe('Client only components subpath', () => {
const stylesheets = await Promise.all(
$('link[rel=stylesheet]').map((_, el) => {
return fixture.readFile(el.attribs.href.replace(/\/blog/, ''));
- })
+ }),
);
const css = stylesheets.join('');
diff --git a/packages/astro/test/astro-component-bundling.test.js b/packages/astro/test/astro-component-bundling.test.js
index 619f0af04..39dec7690 100644
--- a/packages/astro/test/astro-component-bundling.test.js
+++ b/packages/astro/test/astro-component-bundling.test.js
@@ -13,7 +13,7 @@ describe('Component bundling', () => {
it('should treeshake FooComponent', async () => {
const astroChunkDir = await fixture.readdir('/_astro');
const manyComponentsChunkName = astroChunkDir.find((chunk) =>
- chunk.startsWith('ManyComponents')
+ chunk.startsWith('ManyComponents'),
);
const manyComponentsChunkContent = await fixture.readFile(`/_astro/${manyComponentsChunkName}`);
assert.equal(manyComponentsChunkContent.includes('FooComponent'), false);
diff --git a/packages/astro/test/astro-component-code.test.js b/packages/astro/test/astro-component-code.test.js
index 3e5bf5d9e..6124e6054 100644
--- a/packages/astro/test/astro-component-code.test.js
+++ b/packages/astro/test/astro-component-code.test.js
@@ -18,7 +18,7 @@ describe('<Code>', () => {
assert.equal(
$('pre').attr('style'),
'background-color:#24292e;color:#e1e4e8; overflow-x: auto;',
- 'applies default and overflow'
+ 'applies default and overflow',
);
assert.equal($('pre > code').length, 1);
@@ -44,7 +44,7 @@ describe('<Code>', () => {
assert.equal(
$('pre').attr('style'),
'background-color:#2e3440ff;color:#d8dee9ff; overflow-x: auto;',
- 'applies custom theme'
+ 'applies custom theme',
);
});
@@ -56,7 +56,7 @@ describe('<Code>', () => {
// test: applies wrap overflow
assert.equal(
$('pre').attr('style'),
- 'background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;'
+ 'background-color:#24292e;color:#e1e4e8; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word;',
);
}
{
@@ -66,7 +66,7 @@ describe('<Code>', () => {
// test: applies wrap overflow
assert.equal(
$('pre').attr('style'),
- 'background-color:#24292e;color:#e1e4e8; overflow-x: auto;'
+ 'background-color:#24292e;color:#e1e4e8; overflow-x: auto;',
);
}
{
@@ -94,7 +94,7 @@ describe('<Code>', () => {
'color:var(--astro-code-color-text)',
'color:var(--astro-code-token-string-expression)',
'color:var(--astro-code-color-text)',
- ]
+ ],
);
});
@@ -105,7 +105,7 @@ describe('<Code>', () => {
assert.equal($('#theme > pre').length, 1);
assert.equal(
$('#theme > pre').attr('style'),
- 'background-color:#FDFDFE;color:#4E5377; overflow-x: auto;'
+ 'background-color:#FDFDFE;color:#4E5377; overflow-x: auto;',
);
assert.equal($('#lang > pre').length, 1);
diff --git a/packages/astro/test/astro-directives.test.js b/packages/astro/test/astro-directives.test.js
index 2a2ae26ef..7e00411ec 100644
--- a/packages/astro/test/astro-directives.test.js
+++ b/packages/astro/test/astro-directives.test.js
@@ -71,7 +71,7 @@ describe('Directives', async () => {
.attr('style')
.toString()
.includes('color:var(--fg);--fg: black;--bg: white;'),
- true
+ true,
);
});
diff --git a/packages/astro/test/astro-doctype.test.js b/packages/astro/test/astro-doctype.test.js
index dbe05092f..63e3eb9f8 100644
--- a/packages/astro/test/astro-doctype.test.js
+++ b/packages/astro/test/astro-doctype.test.js
@@ -31,7 +31,7 @@ describe('Doctype', () => {
// test that Doctype included was preserved
assert.match(
html,
- /^<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/loose.dtd">/i
+ /^<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/loose.dtd">/i,
);
});
diff --git a/packages/astro/test/astro-envs.test.js b/packages/astro/test/astro-envs.test.js
index 6af981930..94844fd54 100644
--- a/packages/astro/test/astro-envs.test.js
+++ b/packages/astro/test/astro-envs.test.js
@@ -67,7 +67,7 @@ describe('Environment Variables', () => {
found = true;
}
}
- })
+ }),
);
assert.equal(found, true, 'found the public env variable in the JS build');
@@ -88,7 +88,7 @@ describe('Environment Variables', () => {
found = true;
}
}
- })
+ }),
);
assert.equal(found, false, 'found the private env variable in the JS build');
diff --git a/packages/astro/test/astro-expr.test.js b/packages/astro/test/astro-expr.test.js
index 3b47cae81..74863629d 100644
--- a/packages/astro/test/astro-expr.test.js
+++ b/packages/astro/test/astro-expr.test.js
@@ -107,7 +107,7 @@ describe('Expressions', () => {
assert.equal($('body').children().length, 2);
assert.equal(
$('body').html().includes('&lt;script&gt;console.log("pwnd")&lt;/script&gt;'),
- true
+ true,
);
assert.equal($('#trusted').length, 1);
});
diff --git a/packages/astro/test/astro-get-static-paths.test.js b/packages/astro/test/astro-get-static-paths.test.js
index 36aa051f4..c451d577f 100644
--- a/packages/astro/test/astro-get-static-paths.test.js
+++ b/packages/astro/test/astro-get-static-paths.test.js
@@ -116,7 +116,7 @@ describe('getStaticPaths - dev calls', () => {
assert.equal(
canonical.attr('href'),
`https://mysite.dev/posts/${page}`,
- `doesn't trim the /${page} route param`
+ `doesn't trim the /${page} route param`,
);
}
});
diff --git a/packages/astro/test/astro-global.test.js b/packages/astro/test/astro-global.test.js
index 284f8e776..e2fbfd50b 100644
--- a/packages/astro/test/astro-global.test.js
+++ b/packages/astro/test/astro-global.test.js
@@ -43,7 +43,7 @@ describe('Astro Global', () => {
const $ = cheerio.load(html);
assert.equal(
$('[data-any-url-contains-extension]').data('any-url-contains-extension'),
- false
+ false,
);
});
});
diff --git a/packages/astro/test/astro-markdown-frontmatter-injection.test.js b/packages/astro/test/astro-markdown-frontmatter-injection.test.js
index 850453306..9818174d7 100644
--- a/packages/astro/test/astro-markdown-frontmatter-injection.test.js
+++ b/packages/astro/test/astro-markdown-frontmatter-injection.test.js
@@ -24,7 +24,7 @@ describe('Astro Markdown - frontmatter injection', () => {
it('rehype supports custom vfile data - reading time', async () => {
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
const readingTimes = frontmatterByPage.map(
- (frontmatter = {}) => frontmatter.injectedReadingTime
+ (frontmatter = {}) => frontmatter.injectedReadingTime,
);
assert.ok(readingTimes.length > 0);
for (let readingTime of readingTimes) {
diff --git a/packages/astro/test/astro-markdown-shiki.test.js b/packages/astro/test/astro-markdown-shiki.test.js
index 3e0fa9734..8140b4d5d 100644
--- a/packages/astro/test/astro-markdown-shiki.test.js
+++ b/packages/astro/test/astro-markdown-shiki.test.js
@@ -23,7 +23,7 @@ describe('Astro Markdown Shiki', () => {
assert.ok($('pre').hasClass('astro-code'));
assert.equal(
$('pre').attr().style,
- 'background-color:#24292e;color:#e1e4e8; overflow-x: auto;'
+ 'background-color:#24292e;color:#e1e4e8; overflow-x: auto;',
);
});
@@ -53,7 +53,7 @@ describe('Astro Markdown Shiki', () => {
assert.ok($('pre').hasClass('astro-code'));
assert.equal(
$('pre').attr().style,
- 'background-color:#fff;color:#24292e; overflow-x: auto;'
+ 'background-color:#fff;color:#24292e; overflow-x: auto;',
);
});
});
@@ -74,7 +74,7 @@ describe('Astro Markdown Shiki', () => {
assert.ok($('pre').hasClass('astro-code'));
assert.equal(
$('pre').attr().style,
- 'background-color:#FDFDFE;color:#4E5377; overflow-x: auto;'
+ 'background-color:#FDFDFE;color:#4E5377; overflow-x: auto;',
);
});
});
diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js
index 9ae09ff92..d0a49c873 100644
--- a/packages/astro/test/astro-markdown.test.js
+++ b/packages/astro/test/astro-markdown.test.js
@@ -20,7 +20,7 @@ describe('Astro Markdown', () => {
assert.equal(
fixLineEndings(raw).trim(),
- `# Basic page\n\nLets make sure raw and compiled content look right!`
+ `# Basic page\n\nLets make sure raw and compiled content look right!`,
);
});
@@ -29,7 +29,7 @@ describe('Astro Markdown', () => {
assert.equal(
fixLineEndings(compiled).trim(),
- `<h1 id="basic-page">Basic page</h1>\n<p>Lets make sure raw and compiled content look right!</p>`
+ `<h1 id="basic-page">Basic page</h1>\n<p>Lets make sure raw and compiled content look right!</p>`,
);
});
@@ -87,7 +87,7 @@ describe('Astro Markdown', () => {
assert.equal(
fixLineEndings(compiledContent.text()).trim(),
- `<h2 id="section-1">Section 1</h2>\n<h2 id="section-2">Section 2</h2>`
+ `<h2 id="section-1">Section 1</h2>\n<h2 id="section-2">Section 2</h2>`,
);
});
@@ -121,7 +121,7 @@ describe('Astro Markdown', () => {
assert.equal(
frontmatterFile?.endsWith('with-layout.md'),
true,
- '"file" prop does not end with correct path or is undefined'
+ '"file" prop does not end with correct path or is undefined',
);
assert.equal(frontmatterUrl, '/with-layout');
assert.equal(file, frontmatterFile);
diff --git a/packages/astro/test/astro-not-response.test.js b/packages/astro/test/astro-not-response.test.js
index 467ca27af..63bcef236 100644
--- a/packages/astro/test/astro-not-response.test.js
+++ b/packages/astro/test/astro-not-response.test.js
@@ -27,7 +27,7 @@ describe('Not returning responses', () => {
assert.equal(
e instanceof Error,
true,
- 'Only instance of Response can be returned from an Astro file'
+ 'Only instance of Response can be returned from an Astro file',
);
return null;
}
diff --git a/packages/astro/test/astro-pages.test.js b/packages/astro/test/astro-pages.test.js
index c3af8d0e4..f359e3e53 100644
--- a/packages/astro/test/astro-pages.test.js
+++ b/packages/astro/test/astro-pages.test.js
@@ -56,7 +56,7 @@ describe('Pages', () => {
assert.equal(
html.includes('/@vite/client'),
true,
- 'Markdown page does not have Vite client for HMR'
+ 'Markdown page does not have Vite client for HMR',
);
});
});
diff --git a/packages/astro/test/astro-pagination-root-spread.test.js b/packages/astro/test/astro-pagination-root-spread.test.js
index c1f5c0ba5..3accbb226 100644
--- a/packages/astro/test/astro-pagination-root-spread.test.js
+++ b/packages/astro/test/astro-pagination-root-spread.test.js
@@ -28,7 +28,7 @@ describe('Pagination root', () => {
const html = await fixture.readFile(curr + 'index.html');
const $ = cheerio.load(html);
assert.equal($('#prev').attr('href'), prev);
- })
+ }),
);
});
});
diff --git a/packages/astro/test/astro-pagination.test.js b/packages/astro/test/astro-pagination.test.js
index a78a2f23e..ed3b2fc47 100644
--- a/packages/astro/test/astro-pagination.test.js
+++ b/packages/astro/test/astro-pagination.test.js
@@ -64,7 +64,7 @@ describe('Pagination', () => {
assert.equal(prevHref, '/posts/blue/1');
assert.equal(nextHref, undefined);
}
- })
+ }),
);
});
});
diff --git a/packages/astro/test/astro-scripts.test.js b/packages/astro/test/astro-scripts.test.js
index ec2d3e805..001242d3b 100644
--- a/packages/astro/test/astro-scripts.test.js
+++ b/packages/astro/test/astro-scripts.test.js
@@ -54,7 +54,7 @@ describe('Scripts (hoisted and not)', () => {
assert.equal(
inlineEntryJS.includes('I AM IMPORTED INLINE'),
true,
- 'The inline imported JS is included in the bundle'
+ 'The inline imported JS is included in the bundle',
);
});
diff --git a/packages/astro/test/astro-sync.test.js b/packages/astro/test/astro-sync.test.js
index f6faa6722..a92993eae 100644
--- a/packages/astro/test/astro-sync.test.js
+++ b/packages/astro/test/astro-sync.test.js
@@ -79,7 +79,7 @@ const createFixture = () => {
assert.equal(
result.outputText,
'',
- `${path} should be valid TypeScript. Output: ${result.outputText}`
+ `${path} should be valid TypeScript. Output: ${result.outputText}`,
);
} catch (error) {
assert.fail(`${path} is not valid TypeScript. Error: ${error.message}`);
@@ -108,7 +108,7 @@ describe('astro sync', () => {
fixture.thenFileContentShouldInclude(
'.astro/types.d.ts',
`declare module 'astro:content' {`,
- 'Types file does not include `astro:content` module declaration'
+ 'Types file does not include `astro:content` module declaration',
);
fixture.thenFileShouldBeValidTypescript('.astro/types.d.ts');
});
@@ -126,7 +126,7 @@ describe('astro sync', () => {
data: InferEntrySchema<"blog">;
render(): Render[".md"];
}>;`,
- 'Types file does not include empty collection type'
+ 'Types file does not include empty collection type',
);
fixture.thenFileContentShouldInclude(
'.astro/types.d.ts',
@@ -135,7 +135,7 @@ describe('astro sync', () => {
collection: "blogMeta";
data: InferEntrySchema<"blogMeta">;
}>;`,
- 'Types file does not include empty collection type'
+ 'Types file does not include empty collection type',
);
});
@@ -144,7 +144,7 @@ describe('astro sync', () => {
fixture.thenFileShouldExist('src/env.d.ts');
fixture.thenFileContentShouldInclude(
'src/env.d.ts',
- `/// <reference path="../.astro/types.d.ts" />`
+ `/// <reference path="../.astro/types.d.ts" />`,
);
});
});
@@ -156,7 +156,7 @@ describe('astro sync', () => {
fixture.thenFileContentShouldInclude(
'.astro/env.d.ts',
`declare module 'astro:env/client' {`,
- 'Types file does not include `astro:env` module declaration'
+ 'Types file does not include `astro:env` module declaration',
);
});
@@ -165,7 +165,7 @@ describe('astro sync', () => {
fixture.thenFileShouldExist('src/env.d.ts');
fixture.thenFileContentShouldInclude(
'src/env.d.ts',
- `/// <reference path="../.astro/env.d.ts" />`
+ `/// <reference path="../.astro/env.d.ts" />`,
);
});
@@ -190,7 +190,7 @@ describe('astro sync', () => {
fixture.thenFileShouldExist('src/env.d.ts');
fixture.thenFileContentShouldInclude(
'src/env.d.ts',
- `/// <reference path="../.astro/actions.d.ts" />`
+ `/// <reference path="../.astro/actions.d.ts" />`,
);
});
});
diff --git a/packages/astro/test/cli.test.js b/packages/astro/test/cli.test.js
index f92ed45aa..5e3ef984f 100644
--- a/packages/astro/test/cli.test.js
+++ b/packages/astro/test/cli.test.js
@@ -62,11 +62,11 @@ describe('astro cli', () => {
await fs.writeFile(pagePath, pageContent);
await checkServer.stop();
const diagnostics = messages.filter(
- (m) => m.type === 'diagnostics' && m.message.includes('Result')
+ (m) => m.type === 'diagnostics' && m.message.includes('Result'),
);
assert.equal(diagnostics[0].message.includes('0 errors'), true);
assert.equal(diagnostics[1].message.includes('1 error'), true);
- }
+ },
);
it('astro --version', async () => {
@@ -91,7 +91,7 @@ describe('astro cli', () => {
} catch {}
assert.equal(proc?.stdout.includes('0 errors'), true);
- }
+ },
);
it(
@@ -112,7 +112,7 @@ describe('astro cli', () => {
}
assert.equal(stdout.includes('1 error'), true);
- }
+ },
);
it('astro dev welcome', async () => {
@@ -136,7 +136,7 @@ describe('astro cli', () => {
it(`astro ${cmd} ${flag} ${flagValue ?? ''} - network log`, async () => {
const { local, network } = await cliServerLogSetupWithFixture(
flagValue ? [flag, flagValue] : [flag],
- cmd
+ cmd,
);
assert.notEqual(local, undefined);
@@ -153,12 +153,12 @@ describe('astro cli', () => {
assert.equal(
networkURL.port,
localURL.port,
- `Expected local and network ports to be equal`
+ `Expected local and network ports to be equal`,
);
assert.equal(
isIPv4(networkURL.hostname),
true,
- `Expected network URL to respect --host flag`
+ `Expected network URL to respect --host flag`,
);
});
});
@@ -175,7 +175,7 @@ describe('astro cli', () => {
assert.equal(
['localhost', '127.0.0.1'].includes(localURL.hostname),
true,
- `Expected local URL to be on localhost`
+ `Expected local URL to be on localhost`,
);
assert.throws(() => new URL(networkURL));
@@ -197,7 +197,7 @@ describe('astro cli', () => {
assert.equal(
['localhost', '127.0.0.1'].includes(localURL.hostname),
true,
- `Expected local URL to be on localhost`
+ `Expected local URL to be on localhost`,
);
});
});
diff --git a/packages/astro/test/client-address.test.js b/packages/astro/test/client-address.test.js
index 667133fe2..fb4f4d338 100644
--- a/packages/astro/test/client-address.test.js
+++ b/packages/astro/test/client-address.test.js
@@ -108,7 +108,7 @@ describe('Astro.clientAddress', () => {
assert.match(
err.message,
/Astro\.clientAddress/,
- 'Error message mentions Astro.clientAddress'
+ 'Error message mentions Astro.clientAddress',
);
}
});
diff --git a/packages/astro/test/component-library.test.js b/packages/astro/test/component-library.test.js
index 503599cd0..142a21b3d 100644
--- a/packages/astro/test/component-library.test.js
+++ b/packages/astro/test/component-library.test.js
@@ -63,7 +63,7 @@ describe('Component Libraries', () => {
assert.equal(
await findEvidence('with-astro/index.html'),
true,
- "Included the .astro component's <style>"
+ "Included the .astro component's <style>",
);
});
@@ -76,7 +76,7 @@ describe('Component Libraries', () => {
assert.equal(
$('#react-idle').text(),
'Hello idle!',
- 'Rendered the client hydrated component'
+ 'Rendered the client hydrated component',
);
assert.equal($('astro-island[uid]').length, 1, 'Included one hydration island');
@@ -90,7 +90,7 @@ describe('Component Libraries', () => {
assert.equal(
$('.counter-message').text().trim(),
'Hello, Svelte!',
- "rendered the counter's slot"
+ "rendered the counter's slot",
);
assert.equal($('astro-island[uid]').length, 1, 'Included one hydration island');
@@ -144,7 +144,7 @@ describe('Component Libraries', () => {
assert.equal(
await findEvidence('/with-astro/'),
true,
- "Included the .astro component's <style>"
+ "Included the .astro component's <style>",
);
});
@@ -157,7 +157,7 @@ describe('Component Libraries', () => {
assert.equal(
$('#react-idle').text(),
'Hello idle!',
- 'Rendered the client hydrated component'
+ 'Rendered the client hydrated component',
);
assert.equal($('astro-island[uid]').length, 1, 'Included one hydration island');
@@ -171,7 +171,7 @@ describe('Component Libraries', () => {
assert.equal(
$('.counter-message').text().trim(),
'Hello, Svelte!',
- "rendered the counter's slot"
+ "rendered the counter's slot",
);
assert.equal($('astro-island[uid]').length, 1, 'Included one hydration island');
diff --git a/packages/astro/test/container.test.js b/packages/astro/test/container.test.js
index 6af5dc1f9..7d8b61d9c 100644
--- a/packages/astro/test/container.test.js
+++ b/packages/astro/test/container.test.js
@@ -46,10 +46,10 @@ describe('Container', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
});
@@ -80,14 +80,14 @@ describe('Container', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
},
'Component2.astro',
- undefined
+ undefined,
);
const container = await experimental_AstroContainer.create();
@@ -122,14 +122,14 @@ describe('Container', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
},
'Component2.astro',
- undefined
+ undefined,
);
const container = await experimental_AstroContainer.create();
@@ -168,15 +168,15 @@ describe('Container', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
- )}`
+ },
+ )}`,
);
},
'Component2.astro',
- undefined
+ undefined,
);
const container = await experimental_AstroContainer.create();
@@ -212,14 +212,14 @@ describe('Container', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
},
'Component2.astro',
- undefined
+ undefined,
);
const container = await experimental_AstroContainer.create();
diff --git a/packages/astro/test/content-collection-references.test.js b/packages/astro/test/content-collection-references.test.js
index 2305ece31..7119e0f04 100644
--- a/packages/astro/test/content-collection-references.test.js
+++ b/packages/astro/test/content-collection-references.test.js
@@ -53,7 +53,7 @@ describe('Content Collections - references', () => {
assert.equal(banner.collection, 'banners');
assert.equal(
banner.data.alt,
- 'Futuristic landscape with chrome buildings and blue skies'
+ 'Futuristic landscape with chrome buildings and blue skies',
);
assert.equal(banner.data.src.width, 400);
@@ -131,7 +131,7 @@ describe('Content Collections - references', () => {
assert.ok(banner.attr('src').includes('the-future'));
assert.equal(
banner.attr('alt'),
- 'Futuristic landscape with chrome buildings and blue skies'
+ 'Futuristic landscape with chrome buildings and blue skies',
);
assert.equal(banner.attr('width'), '400');
assert.equal(banner.attr('height'), '225');
diff --git a/packages/astro/test/content-collections-render.test.js b/packages/astro/test/content-collections-render.test.js
index 277ef8c06..e25e42aa4 100644
--- a/packages/astro/test/content-collections-render.test.js
+++ b/packages/astro/test/content-collections-render.test.js
@@ -65,12 +65,12 @@ describe('Content Collections - render()', () => {
// Includes hoisted script
const scriptWithSrc = [...allScripts].find((script) =>
- $(script).attr('src')?.includes('WithScripts')
+ $(script).attr('src')?.includes('WithScripts'),
);
assert.notEqual(
scriptWithSrc,
undefined,
- '`WithScripts.astro` hoisted script missing from head.'
+ '`WithScripts.astro` hoisted script missing from head.',
);
// Includes inline script
@@ -85,12 +85,12 @@ describe('Content Collections - render()', () => {
// Excludes hoisted script
const scriptWithText = [...allScripts].find((script) =>
- $(script).text().includes('document.querySelector("#update-me")')
+ $(script).text().includes('document.querySelector("#update-me")'),
);
assert.equal(
scriptWithText,
undefined,
- '`WithScripts.astro` hoisted script included unexpectedly.'
+ '`WithScripts.astro` hoisted script included unexpectedly.',
);
});
@@ -237,12 +237,12 @@ describe('Content Collections - render()', () => {
assert.ok(allScripts.length);
// Includes hoisted script
const scriptWithSrc = [...allScripts].find((script) =>
- script.attribs.src.includes('WithScripts.astro')
+ script.attribs.src.includes('WithScripts.astro'),
);
assert.notEqual(
scriptWithSrc,
undefined,
- '`WithScripts.astro` hoisted script missing from head.'
+ '`WithScripts.astro` hoisted script missing from head.',
);
// Includes inline script
diff --git a/packages/astro/test/content-collections.test.js b/packages/astro/test/content-collections.test.js
index fb518b261..43cbcc72d 100644
--- a/packages/astro/test/content-collections.test.js
+++ b/packages/astro/test/content-collections.test.js
@@ -59,7 +59,7 @@ describe('Content Collections', () => {
assert.equal(
publishedDates.every((date) => date instanceof Date),
true,
- 'Not all publishedAt dates are Date objects'
+ 'Not all publishedAt dates are Date objects',
);
assert.deepEqual(
publishedDates.map((date) => date.toISOString()),
@@ -68,7 +68,7 @@ describe('Content Collections', () => {
'2021-01-01T00:00:00.000Z',
'2021-01-03T00:00:00.000Z',
'2021-01-02T00:00:00.000Z',
- ]
+ ],
);
});
@@ -116,7 +116,7 @@ describe('Content Collections', () => {
assert.deepEqual(ids, ['welcome']);
assert.equal(
json.withSymlinkedData[0].data.alt,
- 'Futuristic landscape with chrome buildings and blue skies'
+ 'Futuristic landscape with chrome buildings and blue skies',
);
assert.notEqual(json.withSymlinkedData[0].data.src.src, undefined);
});
@@ -148,7 +148,7 @@ describe('Content Collections', () => {
assert.equal(json.oneWithSchemaConfig.data.publishedAt instanceof Date, true);
assert.equal(
json.oneWithSchemaConfig.data.publishedAt.toISOString(),
- '2021-01-01T00:00:00.000Z'
+ '2021-01-01T00:00:00.000Z',
);
});
@@ -239,7 +239,7 @@ describe('Content Collections', () => {
const $ = cheerio.load(post);
assert.equal(
$(blogSlugToContents[slug].element).text().trim(),
- blogSlugToContents[slug].content
+ blogSlugToContents[slug].content,
);
}
});
@@ -364,7 +364,7 @@ describe('Content Collections', () => {
const $ = cheerio.load(body);
assert.equal(
$(blogSlugToContents[slug].element).text().trim(),
- blogSlugToContents[slug].content
+ blogSlugToContents[slug].content,
);
}
});
diff --git a/packages/astro/test/core-image-infersize.test.js b/packages/astro/test/core-image-infersize.test.js
index 355d6a691..f1ec2d7a0 100644
--- a/packages/astro/test/core-image-infersize.test.js
+++ b/packages/astro/test/core-image-infersize.test.js
@@ -51,7 +51,7 @@ describe('astro:image:infersize', () => {
let $img = $('img');
assert.equal(
$img.attr('src').startsWith('/_image') && $img.attr('src').endsWith('f=webp'),
- true
+ true,
);
});
@@ -59,7 +59,7 @@ describe('astro:image:infersize', () => {
let $img = $('picture img');
assert.equal(
$img.attr('src').startsWith('/_image') && $img.attr('src').endsWith('f=png'),
- true
+ true,
);
});
@@ -67,7 +67,7 @@ describe('astro:image:infersize', () => {
let $img = $('#getImage');
assert.equal(
$img.attr('src').startsWith('/_image') && $img.attr('src').endsWith('f=webp'),
- true
+ true,
);
});
diff --git a/packages/astro/test/core-image-unconventional-settings.test.js b/packages/astro/test/core-image-unconventional-settings.test.js
index 9ecf6aab6..edbfab6f6 100644
--- a/packages/astro/test/core-image-unconventional-settings.test.js
+++ b/packages/astro/test/core-image-unconventional-settings.test.js
@@ -174,7 +174,7 @@ describe('astro:assets - Support unconventional build settings properly', () =>
const unoptimizedData = await fixture.readFile(
unoptimizedSrc.replace('https://cdn.example.com/', ''),
- null
+ null,
);
assert.equal(unoptimizedData instanceof Buffer, true);
diff --git a/packages/astro/test/core-image.test.js b/packages/astro/test/core-image.test.js
index 396b1e5cd..9c62a679e 100644
--- a/packages/astro/test/core-image.test.js
+++ b/packages/astro/test/core-image.test.js
@@ -146,7 +146,7 @@ describe('astro:image', () => {
img.attribs['src'].startsWith('/_image?href=%2F%40fs%2F')
);
}),
- true
+ true,
);
});
@@ -216,11 +216,11 @@ describe('astro:image', () => {
const srcset = parseSrcset($source.attr('srcset'));
assert.equal(
srcset.every((src) => src.url.startsWith('/_image')),
- true
+ true,
);
assert.deepEqual(
srcset.map((src) => src.d),
- [undefined, 2]
+ [undefined, 2],
);
// Widths
@@ -232,17 +232,17 @@ describe('astro:image', () => {
assert.equal($source.length, 1);
assert.equal(
$source.attr('sizes'),
- '(max-width: 448px) 400px, (max-width: 810px) 750px, 1050px'
+ '(max-width: 448px) 400px, (max-width: 810px) 750px, 1050px',
);
const srcset2 = parseSrcset($source.attr('srcset'));
assert.equal(
srcset2.every((src) => src.url.startsWith('/_image')),
- true
+ true,
);
assert.deepEqual(
srcset2.map((src) => src.w),
- [207]
+ [207],
);
// MIME Types
@@ -261,7 +261,7 @@ describe('astro:image', () => {
assert.equal(
validMimeTypes.includes(type),
true,
- `Expected type attribute value to be a valid MIME type: ${type}`
+ `Expected type attribute value to be a valid MIME type: ${type}`,
);
}
});
@@ -290,7 +290,7 @@ describe('astro:image', () => {
...parseSrcset(localImage.attr('srcset')).map((src) => src.url),
localImage.attr('src'),
]).size,
- 3
+ 3,
);
let remoteImage = $('#remote-3-images img');
@@ -299,7 +299,7 @@ describe('astro:image', () => {
...parseSrcset(remoteImage.attr('srcset')).map((src) => src.url),
remoteImage.attr('src'),
]).size,
- 3
+ 3,
);
let local1x = $('#local-1x img');
@@ -308,7 +308,7 @@ describe('astro:image', () => {
...parseSrcset(local1x.attr('srcset')).map((src) => src.url),
local1x.attr('src'),
]).size,
- 1
+ 1,
);
let remote1x = $('#remote-1x img');
@@ -317,7 +317,7 @@ describe('astro:image', () => {
...parseSrcset(remote1x.attr('srcset')).map((src) => src.url),
remote1x.attr('src'),
]).size,
- 1
+ 1,
);
let local2Widths = $('#local-2-widths img');
@@ -326,7 +326,7 @@ describe('astro:image', () => {
...parseSrcset(local2Widths.attr('srcset')).map((src) => src.url),
local2Widths.attr('src'),
]).size,
- 2
+ 2,
);
let remote2Widths = $('#remote-2-widths img');
@@ -335,7 +335,7 @@ describe('astro:image', () => {
...parseSrcset(remote2Widths.attr('srcset')).map((src) => src.url),
remote2Widths.attr('src'),
]).size,
- 2
+ 2,
);
});
});
@@ -406,7 +406,7 @@ describe('astro:image', () => {
let $img = $('#data-uri img');
assert.equal(
$img.attr('src'),
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA2gAwAEAAAAAQAAAA0AAAAAWvB1rQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KGV7hBwAAAWJJREFUKBVtUDEsQ1EUve+1/SItKYMIkYpF06GJdGAwNFFGkxBEYupssRm6EpvJbpVoYhRd6FBikDSxYECsBpG25D/nvP/+p+Ik551z73v33feuyA/izq5CL8ET8ALcBolYIP+vd0ibX/yAT7uj2qkVzwWzUBa0nbacbkKJHi5dlYhXmARYeAS+MwCWA5FPqKIP/9IH/wiygMru5y5mcRYkPHYKP7gAPw4SDbCjRXMgRBJctM4t4ROriM2QSpmkeOtub6YfMYrZvelykbD1sxJVg+6AfKqURRKQLfA4JvoVWgIjDMNlGLVKZxNRFsZsoHGAgREZHKPlJEi2t7if3r2KKS9nVOo0rtNZ3yR7M/VGTqTy5Y4o/scWHBbKfIq0/eZ+x3850OZpaTTxlu/4D3ssuA72uxrYS2rFYjh+aRbmb24LpTVu1IqVKG8P/lmUEaNMxeh6fmquOhkMBE8JJ2yPfwPjdVhiDbiX6AAAAABJRU5ErkJggg=='
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA2gAwAEAAAAAQAAAA0AAAAAWvB1rQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDYuMC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KGV7hBwAAAWJJREFUKBVtUDEsQ1EUve+1/SItKYMIkYpF06GJdGAwNFFGkxBEYupssRm6EpvJbpVoYhRd6FBikDSxYECsBpG25D/nvP/+p+Ik551z73v33feuyA/izq5CL8ET8ALcBolYIP+vd0ibX/yAT7uj2qkVzwWzUBa0nbacbkKJHi5dlYhXmARYeAS+MwCWA5FPqKIP/9IH/wiygMru5y5mcRYkPHYKP7gAPw4SDbCjRXMgRBJctM4t4ROriM2QSpmkeOtub6YfMYrZvelykbD1sxJVg+6AfKqURRKQLfA4JvoVWgIjDMNlGLVKZxNRFsZsoHGAgREZHKPlJEi2t7if3r2KKS9nVOo0rtNZ3yR7M/VGTqTy5Y4o/scWHBbKfIq0/eZ+x3850OZpaTTxlu/4D3ssuA72uxrYS2rFYjh+aRbmb24LpTVu1IqVKG8P/lmUEaNMxeh6fmquOhkMBE8JJ2yPfwPjdVhiDbiX6AAAAABJRU5ErkJggg==',
);
assert.equal(!!$img.attr('width'), true);
assert.equal(!!$img.attr('height'), true);
@@ -464,7 +464,7 @@ describe('astro:image', () => {
// Verbose test for the full URL to make sure the image went through the full pipeline
assert.equal(
$img.attr('src').startsWith('/_image') && $img.attr('src').endsWith('f=webp'),
- true
+ true,
);
});
@@ -566,7 +566,7 @@ describe('astro:image', () => {
assert.equal($img.length, 2);
assert.equal(
imgsSrcs.every((img) => img.startsWith('/')),
- true
+ true,
);
});
@@ -668,7 +668,7 @@ describe('astro:image', () => {
assert.equal(res.status, 200);
assert.equal(
await res.text(),
- "You fool! I'm not a image endpoint at all, I just return this!"
+ "You fool! I'm not a image endpoint at all, I just return this!",
);
});
@@ -735,7 +735,7 @@ describe('astro:image', () => {
assert.equal(logs.length >= 1, true);
assert.equal(
logs[0].message.includes('An ESM-imported image cannot be passed directly'),
- true
+ true,
);
});
@@ -905,12 +905,12 @@ describe('astro:image', () => {
srcset.map(async (src) => {
const data = await fixture.readFile(src.url, null);
return data instanceof Buffer;
- })
+ }),
);
assert.deepEqual(
hasExistingSrc.every((src) => src === true),
- true
+ true,
);
});
@@ -1021,11 +1021,11 @@ describe('astro:image', () => {
await fixture.build({ logging });
const generatingImageIndex = logs.findIndex((logLine) =>
- logLine.message.includes('generating optimized images')
+ logLine.message.includes('generating optimized images'),
);
const relevantLogs = logs.slice(generatingImageIndex + 1, -1);
const isReusingCache = relevantLogs.every((logLine) =>
- logLine.message.includes('(reused cache entry)')
+ logLine.message.includes('(reused cache entry)'),
);
assert.equal(isReusingCache, true);
@@ -1076,7 +1076,7 @@ describe('astro:image', () => {
assert.equal(
allTheSamePath.every((path) => path === allTheSamePath[0]),
- true
+ true,
);
const useCustomHashProperty = $('#use-data img')
@@ -1084,7 +1084,7 @@ describe('astro:image', () => {
.get();
assert.equal(
useCustomHashProperty.every((path) => path === useCustomHashProperty[0]),
- false
+ false,
);
assert.notEqual(useCustomHashProperty[1], useCustomHashProperty[0]);
diff --git a/packages/astro/test/css-dangling-references.test.js b/packages/astro/test/css-dangling-references.test.js
index f4c407092..5788be87f 100644
--- a/packages/astro/test/css-dangling-references.test.js
+++ b/packages/astro/test/css-dangling-references.test.js
@@ -30,7 +30,7 @@ describe("When Vite's preloadModule polyfill is used", async () => {
assert.equal(
missingReferences.length,
0,
- `${filePath} contains a reference to a deleted css asset: ${missingReferences}`
+ `${filePath} contains a reference to a deleted css asset: ${missingReferences}`,
);
});
diff --git a/packages/astro/test/css-inline-stylesheets.test.js b/packages/astro/test/css-inline-stylesheets.test.js
index 66a3da11e..3ccc97a72 100644
--- a/packages/astro/test/css-inline-stylesheets.test.js
+++ b/packages/astro/test/css-inline-stylesheets.test.js
@@ -296,7 +296,7 @@ async function stylesFromServer(app) {
const cssRequest = new Request(`http://example.com${href}`);
const cssResponse = await app.render(cssRequest);
return await cssResponse.text();
- })
+ }),
);
const allLinkedStyles = allLinkedStylesheets.join('');
diff --git a/packages/astro/test/css-order-import.test.js b/packages/astro/test/css-order-import.test.js
index b64125d70..05b061499 100644
--- a/packages/astro/test/css-order-import.test.js
+++ b/packages/astro/test/css-order-import.test.js
@@ -117,7 +117,7 @@ describe('CSS ordering - import order', () => {
const [, { css }] = content;
assert.ok(
!css.includes('.client-1{background:red!important}'),
- 'CSS from Client2.jsx leaked into index.astro when chunking'
+ 'CSS from Client2.jsx leaked into index.astro when chunking',
);
});
@@ -145,7 +145,7 @@ describe('CSS ordering - import order', () => {
it('dynamic imports taken into account', async () => {
let html = await fixture.readFile('/one/index.html');
const content = await Promise.all(
- getLinks(html).map((href) => getLinkContent(href, fixture))
+ getLinks(html).map((href) => getLinkContent(href, fixture)),
);
let [link1, link2] = content;
assert.ok(link1.css.includes('f0f8ff')); // aliceblue minified
diff --git a/packages/astro/test/css-order.test.js b/packages/astro/test/css-order.test.js
index 4c1b41cfc..e839ef744 100644
--- a/packages/astro/test/css-order.test.js
+++ b/packages/astro/test/css-order.test.js
@@ -38,7 +38,7 @@ describe('CSS production ordering', () => {
await fixture.build();
staticHTML = await fixture.readFile('/one/index.html');
staticCSS = await Promise.all(
- getLinks(staticHTML).map((href) => getLinkContent(fixture, href))
+ getLinks(staticHTML).map((href) => getLinkContent(fixture, href)),
);
});
@@ -58,7 +58,7 @@ describe('CSS production ordering', () => {
getLinks(serverHTML).map(async (href) => {
const css = await fixture.readFile(`/client${href}`);
return { href, css };
- })
+ }),
);
});
@@ -86,7 +86,7 @@ describe('CSS production ordering', () => {
let html = await fixture.readFile('/two/index.html');
const content = await Promise.all(
- getLinks(html).map((href) => getLinkContent(fixture, href))
+ getLinks(html).map((href) => getLinkContent(fixture, href)),
);
assert.ok(content.length, 3, 'there are 3 stylesheets');
@@ -103,7 +103,7 @@ describe('CSS production ordering', () => {
for (const html of [oneHtml, twoHtml, threeHtml]) {
const content = await Promise.all(
- getLinks(html).map((href) => getLinkContent(fixture, href))
+ getLinks(html).map((href) => getLinkContent(fixture, href)),
);
const [first] = content;
diff --git a/packages/astro/test/custom-404-implicit-rerouting.test.js b/packages/astro/test/custom-404-implicit-rerouting.test.js
index ca57450be..49f7e5668 100644
--- a/packages/astro/test/custom-404-implicit-rerouting.test.js
+++ b/packages/astro/test/custom-404-implicit-rerouting.test.js
@@ -64,7 +64,7 @@ for (const caseNumber of [1, 2, 3, 4, 5]) {
async () => {
const response = await app.render(new Request('https://example.com/alvsibdlvjks'));
assert.equal(response.status, 404);
- }
+ },
);
});
});
diff --git a/packages/astro/test/custom-500.test.js b/packages/astro/test/custom-500.test.js
index 548b4d878..744140496 100644
--- a/packages/astro/test/custom-500.test.js
+++ b/packages/astro/test/custom-500.test.js
@@ -18,7 +18,7 @@ describe('Custom 500', () => {
try {
renameSync(
new URL('./fixtures/custom-500/src/pages/_500.astro', import.meta.url),
- new URL('./fixtures/custom-500/src/pages/500.astro', import.meta.url)
+ new URL('./fixtures/custom-500/src/pages/500.astro', import.meta.url),
);
} catch (_) {}
});
@@ -26,7 +26,7 @@ describe('Custom 500', () => {
it('renders default error overlay', async () => {
renameSync(
new URL('./fixtures/custom-500/src/pages/500.astro', import.meta.url),
- new URL('./fixtures/custom-500/src/pages/_500.astro', import.meta.url)
+ new URL('./fixtures/custom-500/src/pages/_500.astro', import.meta.url),
);
fixture = await loadFixture({
root: './fixtures/custom-500/',
diff --git a/packages/astro/test/data-collections-schema.test.js b/packages/astro/test/data-collections-schema.test.js
index 1e14aa910..bd7bf598e 100644
--- a/packages/astro/test/data-collections-schema.test.js
+++ b/packages/astro/test/data-collections-schema.test.js
@@ -52,7 +52,7 @@ describe('Content Collections - data collections', () => {
},
$schema: 'http://json-schema.org/draft-07/schema#',
}),
- JSON.stringify(JSON.parse(rawJson))
+ JSON.stringify(JSON.parse(rawJson)),
);
});
@@ -96,7 +96,7 @@ describe('Content Collections - data collections', () => {
},
$schema: 'http://json-schema.org/draft-07/schema#',
}),
- JSON.stringify(JSON.parse(rawJson))
+ JSON.stringify(JSON.parse(rawJson)),
);
});
});
diff --git a/packages/astro/test/error-map.test.js b/packages/astro/test/error-map.test.js
index 5a91bd96e..1906aaa21 100644
--- a/packages/astro/test/error-map.test.js
+++ b/packages/astro/test/error-map.test.js
@@ -14,7 +14,7 @@ describe('Content Collections - error map', () => {
}),
union: z.union([z.string(), z.number()]),
}),
- { base: 1, nested: { key: 2 }, union: true }
+ { base: 1, nested: { key: 2 }, union: true },
);
const msgs = messages(error).sort();
assert.equal(msgs.length, 3);
@@ -28,7 +28,7 @@ describe('Content Collections - error map', () => {
z.object({
foo: z.string(),
}),
- { foo: 1 }
+ { foo: 1 },
);
assert.deepEqual(messages(error), ['**foo**: Expected type `"string"`, received "number"']);
});
@@ -37,7 +37,7 @@ describe('Content Collections - error map', () => {
z.object({
lang: z.literal('en'),
}),
- { lang: 'es' }
+ { lang: 'es' },
);
assert.deepEqual(messages(error), ['**lang**: Expected `"en"`, received "es"']);
});
@@ -47,18 +47,18 @@ describe('Content Collections - error map', () => {
foo: z.string(),
bar: z.string(),
}),
- { foo: 'foo' }
+ { foo: 'foo' },
);
assert.deepEqual(messages(error), ['**bar**: Required']);
});
it('Returns formatted error for basic union mismatch', () => {
const error = getParseError(
z.union([z.boolean(), z.number()]),
- 'not a boolean or a number, oops!'
+ 'not a boolean or a number, oops!',
);
assert.deepEqual(messages(error), [
fixLineEndings(
- 'Did not match union:\n> Expected type `"boolean" | "number"`, received "string"'
+ 'Did not match union:\n> Expected type `"boolean" | "number"`, received "string"',
),
]);
});
@@ -72,11 +72,11 @@ describe('Content Collections - error map', () => {
type: z.literal('article'),
}),
]),
- { type: 'integration-guide' }
+ { type: 'integration-guide' },
);
assert.deepEqual(messages(error), [
fixLineEndings(
- 'Did not match union:\n> **type**: Expected `"tutorial" | "article"`, received "integration-guide"'
+ 'Did not match union:\n> **type**: Expected `"tutorial" | "article"`, received "integration-guide"',
),
]);
});
@@ -85,7 +85,7 @@ describe('Content Collections - error map', () => {
z.object({
lang: z.enum(['en', 'fr']),
}),
- { lang: 'jp' }
+ { lang: 'jp' },
);
assert.deepEqual(messages(error), [
"**lang**: Invalid enum value. Expected 'en' | 'fr', received 'jp'",
diff --git a/packages/astro/test/events.test.js b/packages/astro/test/events.test.js
index e4cf3478e..6c5ef1e57 100644
--- a/packages/astro/test/events.test.js
+++ b/packages/astro/test/events.test.js
@@ -17,7 +17,7 @@ describe('Events', () => {
{
cliCommand: 'dev',
},
- config
+ config,
);
assert.equal(payload.config.build.format, 'file');
});
@@ -32,7 +32,7 @@ describe('Events', () => {
{
cliCommand: 'dev',
},
- config
+ config,
);
assert.equal(payload.config.markdown.syntaxHighlight, 'shiki');
});
@@ -55,7 +55,7 @@ describe('Events', () => {
{
cliCommand: 'dev',
},
- config
+ config,
);
assert.deepEqual(Object.keys(payload.config.vite), [
'css',
@@ -75,7 +75,7 @@ describe('Events', () => {
{
cliCommand: 'dev',
},
- config
+ config,
);
assert.equal(payload.config.integrations.length, 0);
});
@@ -112,7 +112,7 @@ describe('Events', () => {
cliCommand: 'dev',
},
config,
- flags
+ flags,
);
assert.deepEqual(payload.flags, [
'root',
diff --git a/packages/astro/test/experimental-content-collection-references.test.js b/packages/astro/test/experimental-content-collection-references.test.js
index b53f5f7ee..ab458bbd8 100644
--- a/packages/astro/test/experimental-content-collection-references.test.js
+++ b/packages/astro/test/experimental-content-collection-references.test.js
@@ -58,7 +58,7 @@ describe('Experimental Content Collections cache - references', () => {
assert.equal(banner.collection, 'banners');
assert.equal(
banner.data.alt,
- 'Futuristic landscape with chrome buildings and blue skies'
+ 'Futuristic landscape with chrome buildings and blue skies',
);
assert.equal(banner.data.src.width, 400);
@@ -136,7 +136,7 @@ describe('Experimental Content Collections cache - references', () => {
assert.equal(banner.attr('src').includes('the-future'), true);
assert.equal(
banner.attr('alt'),
- 'Futuristic landscape with chrome buildings and blue skies'
+ 'Futuristic landscape with chrome buildings and blue skies',
);
assert.equal(banner.attr('width'), '400');
assert.equal(banner.attr('height'), '225');
diff --git a/packages/astro/test/experimental-content-collections-cache-invalidation.test.js b/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
index 0f4534e51..c359950a0 100644
--- a/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
+++ b/packages/astro/test/experimental-content-collections-cache-invalidation.test.js
@@ -57,7 +57,7 @@ describe('Experimental Content Collections cache - invalidation', () => {
});
backup = new CacheBackup(
'./fixtures/content-collections-cache-invalidation/',
- './cache/version-mismatch/'
+ './cache/version-mismatch/',
);
backup.backup();
await fixture.build();
@@ -88,7 +88,7 @@ describe('Experimental Content Collections cache - invalidation', () => {
});
backup = new CacheBackup(
'./fixtures/content-collections-cache-invalidation/',
- './cache/lockfile-mismatch/'
+ './cache/lockfile-mismatch/',
);
backup.backup();
await fixture.build();
@@ -119,7 +119,7 @@ describe('Experimental Content Collections cache - invalidation', () => {
});
backup = new CacheBackup(
'./fixtures/content-collections-same-contents/',
- './cache/same-contents/'
+ './cache/same-contents/',
);
backup.backup();
await fixture.build();
diff --git a/packages/astro/test/experimental-content-collections-css-inline-stylesheets.test.js b/packages/astro/test/experimental-content-collections-css-inline-stylesheets.test.js
index 5c02c66b5..656a38093 100644
--- a/packages/astro/test/experimental-content-collections-css-inline-stylesheets.test.js
+++ b/packages/astro/test/experimental-content-collections-css-inline-stylesheets.test.js
@@ -137,7 +137,7 @@ describe('Experimental Content Collections cache - inlineStylesheets to auto in
// this test should be updated if it changes
assert.equal($('style').length, 3);
assert.equal($('link[rel=stylesheet]').length, 1);
- }
+ },
);
describe('Inspect linked and inlined stylesheets', () => {
@@ -273,7 +273,7 @@ async function stylesFromServer(app) {
const cssRequest = new Request(`http://example.com${href}`);
const cssResponse = await app.render(cssRequest);
return await cssResponse.text();
- })
+ }),
);
const allLinkedStyles = allLinkedStylesheets.join('');
@@ -299,7 +299,7 @@ function commonExpectations(allStyles) {
// authored in layouts/Layout.astro
assert.equal(allStyles.value.includes('Menlo'), true);
- }
+ },
);
it('Styles used both in content layout and directly in page are included only once', () => {
diff --git a/packages/astro/test/experimental-content-collections-render.test.js b/packages/astro/test/experimental-content-collections-render.test.js
index 0de3cbc34..b0d9616ca 100644
--- a/packages/astro/test/experimental-content-collections-render.test.js
+++ b/packages/astro/test/experimental-content-collections-render.test.js
@@ -74,7 +74,7 @@ if (!isWindows) {
assert.notEqual(
[...allScripts].find((script) => $(script).attr('src')?.includes('/_astro/WithScripts')),
undefined,
- 'hoisted script missing from head.'
+ 'hoisted script missing from head.',
);
// Includes inline script
@@ -90,10 +90,10 @@ if (!isWindows) {
// Excludes hoisted script
assert.notEqual(
[...allScripts].find((script) =>
- $(script).text().includes('document.querySelector("#update-me")')
+ $(script).text().includes('document.querySelector("#update-me")'),
),
'`WithScripts.astro` hoisted script included unexpectedly.',
- undefined
+ undefined,
);
});
@@ -147,10 +147,10 @@ if (!isWindows) {
// Includes hoisted script
assert.notEqual(
[...allScripts].find((script) =>
- $(script).attr('src')?.includes('/_astro/WithScripts')
+ $(script).attr('src')?.includes('/_astro/WithScripts'),
),
undefined,
- 'hoisted script missing from head.'
+ 'hoisted script missing from head.',
);
});
});
diff --git a/packages/astro/test/experimental-content-collections.test.js b/packages/astro/test/experimental-content-collections.test.js
index 0dc3fb6b1..9d139764d 100644
--- a/packages/astro/test/experimental-content-collections.test.js
+++ b/packages/astro/test/experimental-content-collections.test.js
@@ -39,7 +39,7 @@ describe('Experimental Content Collections cache', () => {
'enterprise.md',
// Spaces allowed in IDs
'promo/launch week.mdx',
- ].sort()
+ ].sort(),
);
});
@@ -56,7 +56,7 @@ describe('Experimental Content Collections cache', () => {
'enterprise',
// "launch week.mdx" is converted to "launch-week.mdx"
'promo/launch-week',
- ].sort()
+ ].sort(),
);
});
@@ -71,7 +71,7 @@ describe('Experimental Content Collections cache', () => {
assert.equal(
publishedDates.every((date) => date instanceof Date),
true,
- 'Not all publishedAt dates are Date objects'
+ 'Not all publishedAt dates are Date objects',
);
assert.deepEqual(publishedDates.map((date) => date.toISOString()).sort(), [
'2021-01-01T00:00:00.000Z',
@@ -127,7 +127,7 @@ describe('Experimental Content Collections cache', () => {
assert.equal(json.oneWithSchemaConfig.data.publishedAt instanceof Date, true);
assert.equal(
json.oneWithSchemaConfig.data.publishedAt.toISOString(),
- '2021-01-01T00:00:00.000Z'
+ '2021-01-01T00:00:00.000Z',
);
});
@@ -206,7 +206,7 @@ describe('Experimental Content Collections cache', () => {
const $ = cheerio.load(post);
assert.equal(
$(blogSlugToContents[slug].element).text().trim(),
- blogSlugToContents[slug].content
+ blogSlugToContents[slug].content,
);
}
});
@@ -359,7 +359,7 @@ describe('Experimental Content Collections cache', () => {
const $ = cheerio.load(body);
assert.equal(
$(blogSlugToContents[slug].element).text().trim(),
- blogSlugToContents[slug].content
+ blogSlugToContents[slug].content,
);
}
});
diff --git a/packages/astro/test/featuresSupport.test.js b/packages/astro/test/featuresSupport.test.js
index 4387a702a..42d679d0d 100644
--- a/packages/astro/test/featuresSupport.test.js
+++ b/packages/astro/test/featuresSupport.test.js
@@ -23,7 +23,7 @@ describe('Adapter', () => {
e
.toString()
.includes("The adapter my-ssr-adapter doesn't support the feature build.middleware."),
- true
+ true,
);
}
});
@@ -45,7 +45,7 @@ describe('Adapter', () => {
e
.toString()
.includes("The adapter my-ssr-adapter doesn't support the feature build.split."),
- true
+ true,
);
}
});
diff --git a/packages/astro/test/lit-element.test.js b/packages/astro/test/lit-element.test.js
index efe16b943..0522b8c71 100644
--- a/packages/astro/test/lit-element.test.js
+++ b/packages/astro/test/lit-element.test.js
@@ -40,7 +40,7 @@ describe(
// test 3: string reactive property set
assert.equal(
stripExpressionMarkers($('#default').html()).includes(`<div id="str">initialized</div>`),
- true
+ true,
);
// test 4: boolean reactive property correctly set
@@ -48,14 +48,14 @@ describe(
// this.hasAttribute to determine its value
assert.equal(
stripExpressionMarkers($('#default').html()).includes(`<div id="bool">B</div>`),
- true
+ true,
);
// test 5: object reactive property set
// by default objects will be stringified to [object Object]
assert.equal(
stripExpressionMarkers($('#default').html()).includes(`<div id="data">data: 1</div>`),
- true
+ true,
);
// test 6: reactive properties are not rendered as attributes
@@ -119,30 +119,30 @@ describe(
assert.equal($slottedMyElement.children('.default').length, 1);
assert.equal(
$slottedMyElement.children('.default').eq(0).text(),
- 'slotted my-element default'
+ 'slotted my-element default',
);
assert.equal($slottedMyElement.children('[slot="named"]').length, 3);
assert.equal(
$slottedMyElement.children('[slot="named"]').eq(1).text(),
- 'slotted my-element named 2'
+ 'slotted my-element named 2',
);
assert.equal(
$slottedMyElement.children('[slot="named"]').eq(2).attr('id'),
- 'slotted-slotted'
+ 'slotted-slotted',
);
// Slotted my-element second level
assert.equal($slottedSlottedMyElement.children('.default').length, 2);
assert.equal(
$slottedSlottedMyElement.children('.default').eq(1).text(),
- 'slotted slotted my-element default 2'
+ 'slotted slotted my-element default 2',
);
assert.equal($slottedSlottedMyElement.children('[slot="named"]').length, 2);
assert.equal(
$slottedSlottedMyElement.children('[slot="named"]').eq(1).text(),
- 'slotted slotted my-element named 2'
+ 'slotted slotted my-element named 2',
);
});
@@ -150,5 +150,5 @@ describe(
const dynamicPage = await fixture.readFile('/1/index.html');
assert.equal(dynamicPage.length > 0, true);
});
- }
+ },
);
diff --git a/packages/astro/test/middleware.test.js b/packages/astro/test/middleware.test.js
index b539b467f..612937d80 100644
--- a/packages/astro/test/middleware.test.js
+++ b/packages/astro/test/middleware.test.js
@@ -375,5 +375,5 @@ describe(
const $ = cheerio.load(html);
assert.equal($('p').html(), 'bar');
});
- }
+ },
);
diff --git a/packages/astro/test/non-html-pages.test.js b/packages/astro/test/non-html-pages.test.js
index 2b8ed970f..f84c12f7b 100644
--- a/packages/astro/test/non-html-pages.test.js
+++ b/packages/astro/test/non-html-pages.test.js
@@ -33,7 +33,7 @@ describe('Non-HTML Pages', () => {
// Make sure the whole buffer (in base64) matches this snapshot
assert.equal(
buffer,
- 'iVBORw0KGgoAAAANSUhEUgAAAGQAAACWCAMAAAAfZt10AAAABlBMVEXd3d3+/v7B/CFgAAAA3UlEQVR42u3ZMQ7DIBQFQeb+l06bNgUbG/5eYApLFjzWNE3TNE3TNE035av9AhAQEBBQGAQEFAaFQWFQGBQGhUGCKAwKgwQpDJ6JECgCRYIEikH8YAyCRyEGyRCDvBWRIPNNBpm/8G6kUM45EhXKlQfuFSHFpbFH+jt2j/S7xwqUYvBaCRIozZy6X2km7v1K8uwQIIWBwkBAQEBg3Tyj3z4LnzRBKgwKg8KgMEgQhaEwSBCFQWBEiMIgQQqDBCkMEqQw+APixYgcsa0TERs7D/F6xGmIAxCD/Iw4AvEB92Ec3ZAPdlMAAAAASUVORK5CYII='
+ 'iVBORw0KGgoAAAANSUhEUgAAAGQAAACWCAMAAAAfZt10AAAABlBMVEXd3d3+/v7B/CFgAAAA3UlEQVR42u3ZMQ7DIBQFQeb+l06bNgUbG/5eYApLFjzWNE3TNE3TNE035av9AhAQEBBQGAQEFAaFQWFQGBQGhUGCKAwKgwQpDJ6JECgCRYIEikH8YAyCRyEGyRCDvBWRIPNNBpm/8G6kUM45EhXKlQfuFSHFpbFH+jt2j/S7xwqUYvBaCRIozZy6X2km7v1K8uwQIIWBwkBAQEBg3Tyj3z4LnzRBKgwKg8KgMEgQhaEwSBCFQWBEiMIgQQqDBCkMEqQw+APixYgcsa0TERs7D/F6xGmIAxCD/Iw4AvEB92Ec3ZAPdlMAAAAASUVORK5CYII=',
);
});
});
diff --git a/packages/astro/test/parallel.test.js b/packages/astro/test/parallel.test.js
index b2b70234f..fadb089b5 100644
--- a/packages/astro/test/parallel.test.js
+++ b/packages/astro/test/parallel.test.js
@@ -19,21 +19,21 @@ describe('Component parallelization', () => {
const startTimes = Array.from($('.start')).map((element) => Number(element.children[0].data));
const finishTimes = Array.from($('.finished')).map((element) =>
- Number(element.children[0].data)
+ Number(element.children[0].data),
);
const renderStartWithin = Math.max(...startTimes) - Math.min(...startTimes);
assert.equal(
renderStartWithin < 40,
true, // in theory, this should be 0, but add 40ms tolerance for CI
- "The components didn't start rendering in parallel"
+ "The components didn't start rendering in parallel",
);
const totalRenderTime = Math.max(...finishTimes) - Math.min(...startTimes);
assert.equal(
totalRenderTime < 80,
true, // max component delay is 40ms, add 40ms tolerance for CI
- 'The total render time was significantly longer than the max component delay'
+ 'The total render time was significantly longer than the max component delay',
);
});
});
diff --git a/packages/astro/test/postcss.test.js b/packages/astro/test/postcss.test.js
index 7de73b0d8..562765e30 100644
--- a/packages/astro/test/postcss.test.js
+++ b/packages/astro/test/postcss.test.js
@@ -24,7 +24,7 @@ describe('PostCSS', () => {
.replace(/\s/g, '')
.replace('/n', '');
},
- { timeout: 45000 }
+ { timeout: 45000 },
);
/** All test cases check whether nested styles (i.e. &.nested {}) are correctly transformed */
diff --git a/packages/astro/test/react-jsx-export.test.js b/packages/astro/test/react-jsx-export.test.js
index 6392cef03..66bc073cc 100644
--- a/packages/astro/test/react-jsx-export.test.js
+++ b/packages/astro/test/react-jsx-export.test.js
@@ -51,7 +51,7 @@ describe('react-jsx-export', () => {
it('Cannot output React Invalid Hook warning', async () => {
assert.equal(
logs.every((log) => log.message.indexOf(reactInvalidHookWarning) === -1),
- true
+ true,
);
});
});
diff --git a/packages/astro/test/redirects.test.js b/packages/astro/test/redirects.test.js
index 4e722379c..8014fb73b 100644
--- a/packages/astro/test/redirects.test.js
+++ b/packages/astro/test/redirects.test.js
@@ -55,7 +55,7 @@ describe('Astro.redirect', () => {
} catch (e) {
assert.equal(
e.message,
- 'The response has already been sent to the browser and cannot be altered.'
+ 'The response has already been sent to the browser and cannot be altered.',
);
}
});
@@ -105,7 +105,7 @@ describe('Astro.redirect', () => {
const response = await app.render(request);
assert.equal(
response.headers.get('Location'),
- '/not-verbatim/target1/Las%20Vegas%E2%80%99'
+ '/not-verbatim/target1/Las%20Vegas%E2%80%99',
);
});
});
diff --git a/packages/astro/test/solid-component.test.js b/packages/astro/test/solid-component.test.js
index 3d0eb3161..857993038 100644
--- a/packages/astro/test/solid-component.test.js
+++ b/packages/astro/test/solid-component.test.js
@@ -102,7 +102,7 @@ describe.skip('Solid component build', { todo: 'Check why an error is thrown.' }
assert.equal(
firstHydrationScriptAt < firstHydrationEventAt,
- 'Position of first hydration event'
+ 'Position of first hydration event',
);
});
@@ -119,7 +119,7 @@ describe.skip('Solid component build', { todo: 'Check why an error is thrown.' }
assert.equal(hydrationScriptCount, 1);
assert.equal(
firstHydrationScriptAt < firstHydrationEventAt,
- 'Position of first hydration event'
+ 'Position of first hydration event',
);
});
});
diff --git a/packages/astro/test/ssr-adapter-build-config.test.js b/packages/astro/test/ssr-adapter-build-config.test.js
index 8c19c56ba..a08a126a3 100644
--- a/packages/astro/test/ssr-adapter-build-config.test.js
+++ b/packages/astro/test/ssr-adapter-build-config.test.js
@@ -28,7 +28,7 @@ describe('Integration buildConfig hook', () => {
return id;
} else if (id === 'astro/app') {
const viteId = viteID(
- new URL('../dist/core/app/index.js', import.meta.url)
+ new URL('../dist/core/app/index.js', import.meta.url),
);
return viteId;
}
diff --git a/packages/astro/test/ssr-api-route.test.js b/packages/astro/test/ssr-api-route.test.js
index 6c5d1ad09..2e7405326 100644
--- a/packages/astro/test/ssr-api-route.test.js
+++ b/packages/astro/test/ssr-api-route.test.js
@@ -81,7 +81,7 @@ describe('API routes in SSR', () => {
it('Can be passed binary data from multipart formdata', async () => {
const formData = new FormData();
const raw = await fs.promises.readFile(
- new URL('./fixtures/ssr-api-route/src/images/penguin.jpg', import.meta.url)
+ new URL('./fixtures/ssr-api-route/src/images/penguin.jpg', import.meta.url),
);
const file = new File([raw], 'penguin.jpg', { type: 'text/jpg' });
formData.set('file', file, 'penguin.jpg');
@@ -137,9 +137,9 @@ describe('API routes in SSR', () => {
assert.match(data.generator, /^Astro v/);
assert.equal(
['http://[::1]:4321/blog/context/any', 'http://127.0.0.1:4321/blog/context/any'].includes(
- data.url
+ data.url,
),
- true
+ true,
);
assert.equal(['::1', '127.0.0.1'].includes(data.clientAddress), true);
assert.equal(data.site, 'https://mysite.dev/subsite/');
diff --git a/packages/astro/test/ssr-dynamic.test.js b/packages/astro/test/ssr-dynamic.test.js
index 4cf0bcd5a..b532ac929 100644
--- a/packages/astro/test/ssr-dynamic.test.js
+++ b/packages/astro/test/ssr-dynamic.test.js
@@ -27,7 +27,7 @@ describe('Dynamic pages in SSR', () => {
});
const entrypoint = fileURLToPath(
- new URL(`${root}.astro/test.astro`, import.meta.url)
+ new URL(`${root}.astro/test.astro`, import.meta.url),
);
console.log(entrypoint);
mkdirSync(dirname(entrypoint), { recursive: true });
diff --git a/packages/astro/test/ssr-hoisted-script.test.js b/packages/astro/test/ssr-hoisted-script.test.js
index 70852f1db..c024ce322 100644
--- a/packages/astro/test/ssr-hoisted-script.test.js
+++ b/packages/astro/test/ssr-hoisted-script.test.js
@@ -146,7 +146,7 @@ describe('Hoisted external scripts in SSR', () => {
const $ = cheerioLoad(html);
assert.match(
$('script').attr('src'),
- /^https:\/\/cdn\.example\.com\/_astro\/hoisted\..{8}\.js$/
+ /^https:\/\/cdn\.example\.com\/_astro\/hoisted\..{8}\.js$/,
);
});
});
@@ -247,7 +247,7 @@ describe('Hoisted external scripts in SSR', () => {
const $ = cheerioLoad(html);
assert.match(
$('script').attr('src'),
- /^https:\/\/cdn\.example\.com\/assets\/entry\..{8}\.mjs$/
+ /^https:\/\/cdn\.example\.com\/assets\/entry\..{8}\.mjs$/,
);
});
});
diff --git a/packages/astro/test/ssr-prerender-get-static-paths.test.js b/packages/astro/test/ssr-prerender-get-static-paths.test.js
index 999ab5a74..50b403891 100644
--- a/packages/astro/test/ssr-prerender-get-static-paths.test.js
+++ b/packages/astro/test/ssr-prerender-get-static-paths.test.js
@@ -130,7 +130,7 @@ describe('Prerender', () => {
assert.equal(
canonical.attr('href'),
`https://mysite.dev/blog/posts/${page}`,
- `doesn't trim the /${page} route param`
+ `doesn't trim the /${page} route param`,
);
}
});
@@ -258,7 +258,7 @@ describe('Prerender', () => {
assert.equal(
canonical.attr('href'),
`https://mysite.dev/blog/posts/${page}`,
- `doesn't trim the /${page} route param`
+ `doesn't trim the /${page} route param`,
);
}
});
diff --git a/packages/astro/test/ssr-split-manifest.test.js b/packages/astro/test/ssr-split-manifest.test.js
index 2f66b3676..06a6fe8c6 100644
--- a/packages/astro/test/ssr-split-manifest.test.js
+++ b/packages/astro/test/ssr-split-manifest.test.js
@@ -48,7 +48,7 @@ describe('astro:ssr-manifest, split', () => {
const $ = cheerio.load(html);
assert.match(
$('#assets').text(),
- /\["\/_astro\/index\.([\w-]{8})\.css","\/prerender\/index\.html"\]/
+ /\["\/_astro\/index\.([\w-]{8})\.css","\/prerender\/index\.html"\]/,
);
});
@@ -66,7 +66,7 @@ describe('astro:ssr-manifest, split', () => {
resolve('./test/fixtures/ssr-split-manifest/dist/client/prerender/index.html'),
{
encoding: 'utf8',
- }
+ },
);
assert.equal(text.includes('<title>Pre render me</title>'), true);
});
diff --git a/packages/astro/test/static-build-dir.test.js b/packages/astro/test/static-build-dir.test.js
index 9723e7bb4..1b99315a2 100644
--- a/packages/astro/test/static-build-dir.test.js
+++ b/packages/astro/test/static-build-dir.test.js
@@ -30,7 +30,7 @@ describe('Static build: dir takes the URL path to the output directory', () => {
const removeTrailingSlash = (str) => str.replace(/\/$/, '');
assert.equal(
removeTrailingSlash(checkDir.toString()),
- removeTrailingSlash(new URL('./fixtures/static-build-dir/dist', import.meta.url).toString())
+ removeTrailingSlash(new URL('./fixtures/static-build-dir/dist', import.meta.url).toString()),
);
assert.equal(checkDir.toString(), checkGeneratedDir.toString());
});
diff --git a/packages/astro/test/static-build-vite-plugins.test.js b/packages/astro/test/static-build-vite-plugins.test.js
index fbd9e02a2..23a801ee9 100644
--- a/packages/astro/test/static-build-vite-plugins.test.js
+++ b/packages/astro/test/static-build-vite-plugins.test.js
@@ -77,7 +77,11 @@ describe('Static build: vite plugins included when required', () => {
it('Vite Plugins are included/excluded properly', async () => {
assert.equal(pluginsCalled.size, expectedPluginResult.size, 'Not all plugins were initialized');
Array.from(expectedPluginResult.entries()).forEach(([plugin, called]) =>
- assert.equal(pluginsCalled.get(plugin), called, `${plugin} was ${called ? 'not' : ''} called`)
+ assert.equal(
+ pluginsCalled.get(plugin),
+ called,
+ `${plugin} was ${called ? 'not' : ''} called`,
+ ),
);
});
});
diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js
index 025fe6335..4ed888f97 100644
--- a/packages/astro/test/test-utils.js
+++ b/packages/astro/test/test-utils.js
@@ -128,7 +128,7 @@ export async function loadFixture(inlineConfig) {
const resolveUrl = (url) =>
`${protocol}://${config.server.host || 'localhost'}:${config.server.port}${url.replace(
/^\/?/,
- '/'
+ '/',
)}`;
// A map of files that have been edited.
@@ -213,7 +213,7 @@ export async function loadFixture(inlineConfig) {
readFile: (filePath, encoding) =>
fs.promises.readFile(
new URL(filePath.replace(/^\//, ''), config.outDir),
- encoding === undefined ? 'utf8' : encoding
+ encoding === undefined ? 'utf8' : encoding,
),
readdir: (fp) => fs.promises.readdir(new URL(fp.replace(/^\//, ''), config.outDir)),
glob: (p) =>
diff --git a/packages/astro/test/units/assets/remote-pattern.test.js b/packages/astro/test/units/assets/remote-pattern.test.js
index 8b2072a4c..0961ffd05 100644
--- a/packages/astro/test/units/assets/remote-pattern.test.js
+++ b/packages/astro/test/units/assets/remote-pattern.test.js
@@ -84,7 +84,7 @@ describe('astro/src/assets/utils/remotePattern', () => {
matchPattern(url1, {
protocol: 'https',
}),
- true
+ true,
);
assert.equal(
@@ -92,7 +92,7 @@ describe('astro/src/assets/utils/remotePattern', () => {
protocol: 'https',
hostname: '**.astro.build',
}),
- true
+ true,
);
assert.equal(
@@ -101,7 +101,7 @@ describe('astro/src/assets/utils/remotePattern', () => {
hostname: '**.astro.build',
pathname: '/en/**',
}),
- true
+ true,
);
assert.equal(
@@ -109,7 +109,7 @@ describe('astro/src/assets/utils/remotePattern', () => {
protocol: 'https',
hostname: 'example.com',
}),
- false
+ false,
);
});
});
diff --git a/packages/astro/test/units/config/config-resolve.test.js b/packages/astro/test/units/config/config-resolve.test.js
index b0c11be06..49c879871 100644
--- a/packages/astro/test/units/config/config-resolve.test.js
+++ b/packages/astro/test/units/config/config-resolve.test.js
@@ -11,7 +11,7 @@ describe('resolveConfig', () => {
configFile: false,
root: 'relative/path',
},
- 'dev'
+ 'dev',
);
const expectedRoot = path.join(process.cwd(), 'relative/path/');
assert.equal(fileURLToPath(astroConfig.root), expectedRoot);
diff --git a/packages/astro/test/units/config/config-server.test.js b/packages/astro/test/units/config/config-server.test.js
index 4d7063498..6f621007c 100644
--- a/packages/astro/test/units/config/config-server.test.js
+++ b/packages/astro/test/units/config/config-server.test.js
@@ -13,7 +13,7 @@ describe('config.server', () => {
root: cwd,
...flags,
}),
- 'dev'
+ 'dev',
);
}
diff --git a/packages/astro/test/units/config/config-validate.test.js b/packages/astro/test/units/config/config-validate.test.js
index 4e4ba1e7a..fc69b595f 100644
--- a/packages/astro/test/units/config/config-validate.test.js
+++ b/packages/astro/test/units/config/config-validate.test.js
@@ -23,7 +23,7 @@ describe('Config Validation', () => {
assert.equal(
formattedError,
`[config] Astro found issue(s) with your configuration:
- ! site Expected string, received number.`
+ ! site Expected string, received number.`,
);
});
@@ -39,14 +39,14 @@ describe('Config Validation', () => {
formattedError,
`[config] Astro found issue(s) with your configuration:
! integrations.0 Expected object, received number.
- ! build.format Invalid input.`
+ ! build.format Invalid input.`,
);
});
it('ignores falsey "integration" values', async () => {
const result = await validateConfig(
{ integrations: [0, false, null, undefined] },
- process.cwd()
+ process.cwd(),
);
assert.deepEqual(result.integrations, []);
});
@@ -57,7 +57,7 @@ describe('Config Validation', () => {
it('flattens array "integration" values', async () => {
const result = await validateConfig(
{ integrations: [{ name: '@astrojs/a' }, [{ name: '@astrojs/b' }, { name: '@astrojs/c' }]] },
- process.cwd()
+ process.cwd(),
);
assert.deepEqual(result.integrations, [
{ name: '@astrojs/a', hooks: {} },
@@ -68,18 +68,18 @@ describe('Config Validation', () => {
it('ignores null or falsy "integration" values', async () => {
const configError = await validateConfig(
{ integrations: [null, undefined, false, '', ``] },
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof Error, false);
});
it('Error when outDir is placed within publicDir', async () => {
const configError = await validateConfig({ outDir: './public/dist' }, process.cwd()).catch(
- (err) => err
+ (err) => err,
);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'The value of `outDir` must not point to a path within the folder set as `publicDir`, this will cause an infinite loop'
+ 'The value of `outDir` must not point to a path within the folder set as `publicDir`, this will cause an infinite loop',
);
});
@@ -92,12 +92,12 @@ describe('Config Validation', () => {
locales: ['es'],
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'The default locale `en` is not present in the `i18n.locales` array.'
+ 'The default locale `en` is not present in the `i18n.locales` array.',
);
});
@@ -115,7 +115,7 @@ describe('Config Validation', () => {
],
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(configError.errors[0].message, 'Array must contain at least 1 element(s)');
@@ -135,12 +135,12 @@ describe('Config Validation', () => {
],
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'The default locale `uk` is not present in the `i18n.locales` array.'
+ 'The default locale `uk` is not present in the `i18n.locales` array.',
);
});
@@ -155,12 +155,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The locale `it` value in the `i18n.fallback` record doesn't exist in the `i18n.locales` array."
+ "The locale `it` value in the `i18n.fallback` record doesn't exist in the `i18n.locales` array.",
);
});
@@ -175,12 +175,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The locale `it` key in the `i18n.fallback` record doesn't exist in the `i18n.locales` array."
+ "The locale `it` key in the `i18n.fallback` record doesn't exist in the `i18n.locales` array.",
);
});
@@ -195,12 +195,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "You can't use the default locale as a key. The default locale can only be used as value."
+ "You can't use the default locale as a key. The default locale can only be used as value.",
);
});
@@ -216,12 +216,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'The option `i18n.redirectToDefaultLocale` is only useful when the `i18n.prefixDefaultLocale` is set to `true`. Remove the option `i18n.redirectToDefaultLocale`, or change its value to `true`.'
+ 'The option `i18n.redirectToDefaultLocale` is only useful when the `i18n.prefixDefaultLocale` is set to `true`. Remove the option `i18n.redirectToDefaultLocale`, or change its value to `true`.',
);
});
@@ -237,12 +237,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The locale `lorem` key in the `i18n.domains` record doesn't exist in the `i18n.locales` array."
+ "The locale `lorem` key in the `i18n.domains` record doesn't exist in the `i18n.locales` array.",
);
});
@@ -258,12 +258,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The domain value must be a valid URL, and it has to start with 'https' or 'http'."
+ "The domain value must be a valid URL, and it has to start with 'https' or 'http'.",
);
});
@@ -279,12 +279,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The domain value must be a valid URL, and it has to start with 'https' or 'http'."
+ "The domain value must be a valid URL, and it has to start with 'https' or 'http'.",
);
});
@@ -300,12 +300,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The URL `https://www.example.com/blog/page/` must contain only the origin. A subsequent pathname isn't allowed here. Remove `/blog/page/`."
+ "The URL `https://www.example.com/blog/page/` must contain only the origin. A subsequent pathname isn't allowed here. Remove `/blog/page/`.",
);
});
@@ -321,12 +321,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- "The option `site` isn't set. When using the 'domains' strategy for `i18n`, `site` is required to create absolute URLs for locales that aren't mapped to a domain."
+ "The option `site` isn't set. When using the 'domains' strategy for `i18n`, `site` is required to create absolute URLs for locales that aren't mapped to a domain.",
);
});
@@ -343,12 +343,12 @@ describe('Config Validation', () => {
},
site: 'https://foo.org',
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'Domain support is only available when `output` is `"server"`.'
+ 'Domain support is only available when `output` is `"server"`.',
);
});
});
@@ -364,8 +364,8 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
- ).catch((err) => err)
+ process.cwd(),
+ ).catch((err) => err),
);
});
@@ -381,8 +381,8 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
- ).catch((err) => err)
+ process.cwd(),
+ ).catch((err) => err),
);
});
@@ -397,12 +397,12 @@ describe('Config Validation', () => {
},
},
},
- process.cwd()
+ process.cwd(),
).catch((err) => err);
assert.equal(configError instanceof z.ZodError, true);
assert.equal(
configError.errors[0].message,
- 'A valid variable name cannot start with a number.'
+ 'A valid variable name cannot start with a number.',
);
});
});
diff --git a/packages/astro/test/units/config/format.test.js b/packages/astro/test/units/config/format.test.js
index 4c9e472ff..7b0c88d73 100644
--- a/packages/astro/test/units/config/format.test.js
+++ b/packages/astro/test/units/config/format.test.js
@@ -16,14 +16,14 @@ describe('Astro config formats', () => {
export default {}
`,
},
- root
+ root,
);
await runInContainer({ fs, inlineConfig: { root: fileURLToPath(root) } }, () => {
assert.equal(
true,
true,
- 'We were able to get into the container which means the config loaded.'
+ 'We were able to get into the container which means the config loaded.',
);
});
});
diff --git a/packages/astro/test/units/content-collections/frontmatter.test.js b/packages/astro/test/units/content-collections/frontmatter.test.js
index e03bf734a..2a3cd31ec 100644
--- a/packages/astro/test/units/content-collections/frontmatter.test.js
+++ b/packages/astro/test/units/content-collections/frontmatter.test.js
@@ -49,7 +49,7 @@ describe('frontmatter', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer({ fs, inlineConfig: { root: fileURLToPath(root) } }, async (container) => {
@@ -62,7 +62,7 @@ describe('frontmatter', () => {
title: One
title: two
---
- `
+ `,
);
triggerFSEvent(container, fs, '/src/content/posts/blog.md', 'change');
await new Promise((resolve) => setTimeout(resolve, 100));
diff --git a/packages/astro/test/units/dev/base.test.js b/packages/astro/test/units/dev/base.test.js
index 6a8f33fb7..e625df478 100644
--- a/packages/astro/test/units/dev/base.test.js
+++ b/packages/astro/test/units/dev/base.test.js
@@ -13,7 +13,7 @@ describe('base configuration', () => {
{
'/src/pages/index.astro': `<h1>testing</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -33,7 +33,7 @@ describe('base configuration', () => {
container.handle(req, res);
await done;
assert.equal(res.statusCode, 404);
- }
+ },
);
});
@@ -42,7 +42,7 @@ describe('base configuration', () => {
{
'/src/pages/index.astro': `<h1>testing</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -62,7 +62,7 @@ describe('base configuration', () => {
container.handle(req, res);
await done;
assert.equal(res.statusCode, 200);
- }
+ },
);
});
});
@@ -73,7 +73,7 @@ describe('base configuration', () => {
{
'/src/pages/sub/index.astro': `<h1>testing</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -93,7 +93,7 @@ describe('base configuration', () => {
container.handle(req, res);
await done;
assert.equal(res.statusCode, 404);
- }
+ },
);
});
@@ -102,7 +102,7 @@ describe('base configuration', () => {
{
'/src/pages/sub/index.astro': `<h1>testing</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -122,7 +122,7 @@ describe('base configuration', () => {
container.handle(req, res);
await done;
assert.equal(res.statusCode, 200);
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js
index d63e42d53..73ce15377 100644
--- a/packages/astro/test/units/dev/collections-mixed-content-errors.test.js
+++ b/packages/astro/test/units/dev/collections-mixed-content-errors.test.js
@@ -44,7 +44,7 @@ name: Ben
export const collections = { authors };`,
},
- root
+ root,
);
assert.equal(await sync({ fs }), 1);
@@ -72,7 +72,7 @@ title: Post
export const collections = { blog };`,
},
- root
+ root,
);
assert.equal(await sync({ fs }), 1);
@@ -95,7 +95,7 @@ title: Post
export const collections = { banners };`,
},
- root
+ root,
);
assert.equal(await sync({ fs }), 1);
@@ -118,7 +118,7 @@ title: Post
export const collections = { i18n };`,
},
- root
+ root,
);
try {
diff --git a/packages/astro/test/units/dev/collections-renderentry.test.js b/packages/astro/test/units/dev/collections-renderentry.test.js
index 3fa872289..9441129a7 100644
--- a/packages/astro/test/units/dev/collections-renderentry.test.js
+++ b/packages/astro/test/units/dev/collections-renderentry.test.js
@@ -51,7 +51,7 @@ _describe('Content Collections - render()', () => {
</html>
`,
},
- root
+ root,
);
await runInContainerWithContentListeners(
@@ -77,7 +77,7 @@ _describe('Content Collections - render()', () => {
// Rendered the styles
assert.equal($('style').length, 1);
- }
+ },
);
});
@@ -111,7 +111,7 @@ _describe('Content Collections - render()', () => {
</Layout>
`,
},
- root
+ root,
);
await runInContainerWithContentListeners(
@@ -137,7 +137,7 @@ _describe('Content Collections - render()', () => {
// Rendered the styles
assert.equal($('style').length, 1);
- }
+ },
);
});
@@ -181,7 +181,7 @@ _describe('Content Collections - render()', () => {
</Layout>
`,
},
- root
+ root,
);
await runInContainerWithContentListeners(
@@ -207,7 +207,7 @@ _describe('Content Collections - render()', () => {
// Rendered the styles
assert.equal($('style').length, 1);
- }
+ },
);
});
@@ -250,7 +250,7 @@ _describe('Content Collections - render()', () => {
</html>
`,
},
- root
+ root,
);
await runInContainerWithContentListeners(
@@ -276,7 +276,7 @@ _describe('Content Collections - render()', () => {
// Rendered the styles
assert.equal($('style').length, 1);
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/dev/dev.test.js b/packages/astro/test/units/dev/dev.test.js
index 1ef0ed90b..c82232768 100644
--- a/packages/astro/test/units/dev/dev.test.js
+++ b/packages/astro/test/units/dev/dev.test.js
@@ -27,7 +27,7 @@ describe('dev container', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer({ fs, inlineConfig: { root: fileURLToPath(root) } }, async (container) => {
@@ -62,7 +62,7 @@ describe('dev container', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer({ fs, inlineConfig: { root: fileURLToPath(root) } }, async (container) => {
@@ -79,7 +79,7 @@ describe('dev container', () => {
'/src/components/Header.astro',
`
<h1>{Astro.props.title}</h1>
- `
+ `,
);
triggerFSEvent(container, fs, '/src/components/Header.astro', 'change');
@@ -96,7 +96,7 @@ describe('dev container', () => {
<Header title={name} />
</body>
</html>
- `
+ `,
);
triggerFSEvent(container, fs, '/src/pages/index.astro', 'change');
@@ -118,7 +118,7 @@ describe('dev container', () => {
'/src/components/test.astro': `<h1>{Astro.params.slug}</h1>`,
'/src/pages/test-[slug].astro': `<h1>{Astro.params.slug}</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -159,7 +159,7 @@ describe('dev container', () => {
container.handle(r.req, r.res);
await r.done;
assert.equal(r.res.statusCode, 200);
- }
+ },
);
});
@@ -169,7 +169,7 @@ describe('dev container', () => {
'/src/components/404.astro': `<h1>Custom 404</h1>`,
'/src/pages/page.astro': `<h1>Regular page</h1>`,
},
- root
+ root,
);
await runInContainer(
@@ -221,7 +221,7 @@ describe('dev container', () => {
assert.equal(doc.includes('Custom 404'), true);
assert.equal(r.res.statusCode, 404);
}
- }
+ },
);
});
@@ -255,7 +255,7 @@ describe('dev container', () => {
await r.done;
assert.equal(r.res.statusCode, 404);
- }
+ },
);
});
diff --git a/packages/astro/test/units/dev/head-injection.test.js b/packages/astro/test/units/dev/head-injection.test.js
index 0bb7a30f8..0796ba45f 100644
--- a/packages/astro/test/units/dev/head-injection.test.js
+++ b/packages/astro/test/units/dev/head-injection.test.js
@@ -59,7 +59,7 @@ describe('head injection', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer(
@@ -82,7 +82,7 @@ describe('head injection', () => {
assert.equal($('link[rel=stylesheet][href="/some/fake/styles.css"]').length, 1);
assert.equal($('#other').length, 1);
- }
+ },
);
});
@@ -159,7 +159,7 @@ describe('head injection', () => {
</Layout>
`,
},
- root
+ root,
);
await runInContainer(
@@ -183,10 +183,10 @@ describe('head injection', () => {
assert.equal(
$('link[rel=stylesheet][href="/some/fake/styles.css"]').length,
1,
- 'found inner link'
+ 'found inner link',
);
assert.equal($('#other').length, 1, 'Found the #other div');
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/dev/hydration.test.js b/packages/astro/test/units/dev/hydration.test.js
index df48b757d..369630f9a 100644
--- a/packages/astro/test/units/dev/hydration.test.js
+++ b/packages/astro/test/units/dev/hydration.test.js
@@ -27,7 +27,7 @@ describe('hydration', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer(
@@ -48,10 +48,10 @@ describe('hydration', () => {
assert.equal(
res.statusCode,
200,
- "We get a 200 because the error occurs in the template, but we didn't crash!"
+ "We get a 200 because the error occurs in the template, but we didn't crash!",
);
- }
+ },
);
- }
+ },
);
});
diff --git a/packages/astro/test/units/dev/restart.test.js b/packages/astro/test/units/dev/restart.test.js
index a2a858965..a09bfce98 100644
--- a/packages/astro/test/units/dev/restart.test.js
+++ b/packages/astro/test/units/dev/restart.test.js
@@ -31,7 +31,7 @@ describe('dev container restarts', () => {
`,
},
- root
+ root,
);
const restart = await createContainerWithAutomaticRestart({
@@ -57,7 +57,7 @@ describe('dev container restarts', () => {
// Vite watches the real filesystem, so we have to mock this part. It's not so bad.
restart.container.viteServer.watcher.emit(
'change',
- fs.getFullyResolvedPath('/astro.config.mjs')
+ fs.getFullyResolvedPath('/astro.config.mjs'),
);
// Wait for the restart to finish
@@ -72,7 +72,7 @@ describe('dev container restarts', () => {
// Vite watches the real filesystem, so we have to mock this part. It's not so bad.
restart.container.viteServer.watcher.emit(
'change',
- fs.getFullyResolvedPath('/astro.config.mjs')
+ fs.getFullyResolvedPath('/astro.config.mjs'),
);
hmrError = await restartComplete;
@@ -95,7 +95,7 @@ describe('dev container restarts', () => {
`,
'/astro.config.mjs': ``,
},
- root
+ root,
);
const restart = await createContainerWithAutomaticRestart({
@@ -124,7 +124,7 @@ describe('dev container restarts', () => {
'/src/pages/index.astro': ``,
'/astro.config.ts': ``,
},
- troot
+ troot,
);
const restart = await createContainerWithAutomaticRestart({
@@ -151,7 +151,7 @@ describe('dev container restarts', () => {
{
'/src/pages/index.astro': ``,
},
- root
+ root,
);
const restart = await createContainerWithAutomaticRestart({
@@ -176,7 +176,7 @@ describe('dev container restarts', () => {
{
'/src/pages/index.astro': ``,
},
- root
+ root,
);
const restart = await createContainerWithAutomaticRestart({
diff --git a/packages/astro/test/units/env/env-validators.test.js b/packages/astro/test/units/env/env-validators.test.js
index 890123d24..02c2b5a56 100644
--- a/packages/astro/test/units/env/env-validators.test.js
+++ b/packages/astro/test/units/env/env-validators.test.js
@@ -38,7 +38,7 @@ const createFixture = () => {
const errors = typeof providedErrors === 'string' ? [providedErrors] : providedErrors;
assert.equal(
result.errors.every((element) => errors.includes(element)),
- true
+ true,
);
input = undefined;
},
@@ -58,7 +58,7 @@ describe('astro:env validators', () => {
getEnvFieldType({
type: 'string',
}),
- 'string'
+ 'string',
);
assert.equal(
@@ -66,7 +66,7 @@ describe('astro:env validators', () => {
type: 'string',
optional: true,
}),
- 'string | undefined'
+ 'string | undefined',
);
assert.equal(
@@ -75,14 +75,14 @@ describe('astro:env validators', () => {
optional: true,
default: 'abc',
}),
- 'string'
+ 'string',
);
assert.equal(
getEnvFieldType({
type: 'number',
}),
- 'number'
+ 'number',
);
assert.equal(
@@ -90,7 +90,7 @@ describe('astro:env validators', () => {
type: 'number',
optional: true,
}),
- 'number | undefined'
+ 'number | undefined',
);
assert.equal(
@@ -99,14 +99,14 @@ describe('astro:env validators', () => {
optional: true,
default: 456,
}),
- 'number'
+ 'number',
);
assert.equal(
getEnvFieldType({
type: 'boolean',
}),
- 'boolean'
+ 'boolean',
);
assert.equal(
@@ -114,7 +114,7 @@ describe('astro:env validators', () => {
type: 'boolean',
optional: true,
}),
- 'boolean | undefined'
+ 'boolean | undefined',
);
assert.equal(
@@ -123,7 +123,7 @@ describe('astro:env validators', () => {
optional: true,
default: true,
}),
- 'boolean'
+ 'boolean',
);
assert.equal(
@@ -131,7 +131,7 @@ describe('astro:env validators', () => {
type: 'enum',
values: ['A'],
}),
- "'A'"
+ "'A'",
);
assert.equal(
@@ -139,7 +139,7 @@ describe('astro:env validators', () => {
type: 'enum',
values: ['A', 'B'],
}),
- "'A' | 'B'"
+ "'A' | 'B'",
);
assert.equal(
@@ -148,7 +148,7 @@ describe('astro:env validators', () => {
optional: true,
values: ['A'],
}),
- "'A' | undefined"
+ "'A' | undefined",
);
assert.equal(
getEnvFieldType({
@@ -157,7 +157,7 @@ describe('astro:env validators', () => {
values: ['A', 'B'],
default: 'A',
}),
- "'A' | 'B'"
+ "'A' | 'B'",
);
});
diff --git a/packages/astro/test/units/i18n/astro_i18n.test.js b/packages/astro/test/units/i18n/astro_i18n.test.js
index dab7cf1f7..54424499f 100644
--- a/packages/astro/test/units/i18n/astro_i18n.test.js
+++ b/packages/astro/test/units/i18n/astro_i18n.test.js
@@ -45,7 +45,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'directory',
...config.experimental.i18n,
}),
- '/blog/'
+ '/blog/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -55,7 +55,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/es/'
+ '/blog/es/',
);
// file format
@@ -67,7 +67,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'file',
}),
- '/blog/'
+ '/blog/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -77,7 +77,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'file',
}),
- '/blog/es/'
+ '/blog/es/',
);
assert.equal(
@@ -88,7 +88,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'file',
}),
- '/blog/italiano/'
+ '/blog/italiano/',
);
});
@@ -114,7 +114,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/'
+ '/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -124,7 +124,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/es/'
+ '/es/',
);
});
@@ -155,7 +155,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'never',
format: 'directory',
}),
- '/blog'
+ '/blog',
);
assert.equal(
getLocaleRelativeUrl({
@@ -165,7 +165,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/es/'
+ '/blog/es/',
);
assert.equal(
@@ -176,7 +176,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'file',
}),
- '/blog/italiano/'
+ '/blog/italiano/',
);
assert.equal(
@@ -187,7 +187,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'ignore',
format: 'directory',
}),
- '/blog/'
+ '/blog/',
);
// directory file
@@ -199,7 +199,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'never',
format: 'file',
}),
- '/blog'
+ '/blog',
);
assert.equal(
getLocaleRelativeUrl({
@@ -209,7 +209,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'always',
format: 'file',
}),
- '/blog/es/'
+ '/blog/es/',
);
assert.equal(
@@ -221,7 +221,7 @@ describe('getLocaleRelativeUrl', () => {
trailingSlash: 'ignore',
format: 'file',
}),
- '/blog'
+ '/blog',
);
});
@@ -247,7 +247,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en-us/'
+ '/blog/en-us/',
);
assert.equal(
@@ -260,7 +260,7 @@ describe('getLocaleRelativeUrl', () => {
normalizeLocale: false,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en_US/'
+ '/blog/en_US/',
);
assert.equal(
@@ -272,7 +272,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en-au/'
+ '/blog/en-au/',
);
});
@@ -302,7 +302,7 @@ describe('getLocaleRelativeUrl', () => {
...config.i18n,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en/'
+ '/blog/en/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -313,7 +313,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/es/'
+ '/blog/es/',
);
// file format
@@ -326,7 +326,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en/'
+ '/blog/en/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -337,7 +337,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/es/'
+ '/blog/es/',
);
});
@@ -368,7 +368,7 @@ describe('getLocaleRelativeUrl', () => {
...config.i18n,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en/'
+ '/blog/en/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -379,7 +379,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/es/'
+ '/blog/es/',
);
// file format
@@ -392,7 +392,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/en/'
+ '/blog/en/',
);
assert.equal(
getLocaleRelativeUrl({
@@ -403,7 +403,7 @@ describe('getLocaleRelativeUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- '/blog/es/'
+ '/blog/es/',
);
});
});
@@ -439,7 +439,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'never',
format: 'directory',
}),
- ['/blog', '/blog/en-us', '/blog/es', '/blog/italiano']
+ ['/blog', '/blog/en-us', '/blog/es', '/blog/italiano'],
);
});
@@ -473,7 +473,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'always',
format: 'directory',
}),
- ['/blog/', '/blog/en-us/', '/blog/es/', '/blog/italiano/']
+ ['/blog/', '/blog/en-us/', '/blog/es/', '/blog/italiano/'],
);
});
@@ -499,7 +499,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'always',
format: 'file',
}),
- ['/blog/', '/blog/en-us/', '/blog/es/']
+ ['/blog/', '/blog/en-us/', '/blog/es/'],
);
});
@@ -525,7 +525,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'never',
format: 'file',
}),
- ['/blog', '/blog/en-us', '/blog/es']
+ ['/blog', '/blog/en-us', '/blog/es'],
);
});
@@ -551,7 +551,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'ignore',
format: 'file',
}),
- ['/blog', '/blog/en-us', '/blog/es']
+ ['/blog', '/blog/en-us', '/blog/es'],
);
});
@@ -577,7 +577,7 @@ describe('getLocaleRelativeUrlList', () => {
trailingSlash: 'ignore',
format: 'directory',
}),
- ['/blog/', '/blog/en-us/', '/blog/es/']
+ ['/blog/', '/blog/en-us/', '/blog/es/'],
);
});
@@ -605,7 +605,7 @@ describe('getLocaleRelativeUrlList', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- ['/blog/en', '/blog/en-us', '/blog/es']
+ ['/blog/en', '/blog/en-us', '/blog/es'],
);
});
@@ -634,7 +634,7 @@ describe('getLocaleRelativeUrlList', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- ['/blog/en', '/blog/en-us', '/blog/es']
+ ['/blog/en', '/blog/en-us', '/blog/es'],
);
});
});
@@ -676,7 +676,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
...config.i18n,
}),
- 'https://example.com/blog/'
+ 'https://example.com/blog/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -687,7 +687,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -700,7 +700,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
isBuild: true,
}),
- 'https://es.example.com/blog/'
+ 'https://es.example.com/blog/',
);
assert.throws(
@@ -717,7 +717,7 @@ describe('getLocaleAbsoluteUrl', () => {
new AstroError({
...MissingLocale,
message: MissingLocale.message('ff'),
- })
+ }),
);
// file format
@@ -730,7 +730,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog/'
+ 'https://example.com/blog/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -741,7 +741,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -753,7 +753,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog/italiano/'
+ 'https://example.com/blog/italiano/',
);
assert.equal(
@@ -766,7 +766,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
isBuild: true,
}),
- 'https://es.example.com/blog/'
+ 'https://es.example.com/blog/',
);
assert.equal(
@@ -781,7 +781,7 @@ describe('getLocaleAbsoluteUrl', () => {
path: 'first-post',
isBuild: true,
}),
- 'https://es.example.com/blog/some-name/first-post/'
+ 'https://es.example.com/blog/some-name/first-post/',
);
// en isn't mapped to a domain
@@ -797,7 +797,7 @@ describe('getLocaleAbsoluteUrl', () => {
path: 'first-post',
isBuild: true,
}),
- 'https://example.com/blog/some-name/first-post/'
+ 'https://example.com/blog/some-name/first-post/',
);
});
});
@@ -832,7 +832,7 @@ describe('getLocaleAbsoluteUrl', () => {
...config.i18n,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
@@ -845,7 +845,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
// file format
@@ -859,7 +859,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -871,7 +871,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -885,7 +885,7 @@ describe('getLocaleAbsoluteUrl', () => {
isBuild: true,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://es.example.com/blog/'
+ 'https://es.example.com/blog/',
);
assert.equal(
@@ -901,7 +901,7 @@ describe('getLocaleAbsoluteUrl', () => {
isBuild: true,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://es.example.com/blog/some-name/first-post/'
+ 'https://es.example.com/blog/some-name/first-post/',
);
});
it('should correctly return the URL without base', () => {
@@ -929,7 +929,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/en/'
+ 'https://example.com/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -941,7 +941,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/es/'
+ 'https://example.com/es/',
);
});
@@ -970,7 +970,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en'
+ 'https://example.com/blog/en',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -982,7 +982,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -995,7 +995,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
// directory file
@@ -1009,7 +1009,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en'
+ 'https://example.com/blog/en',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1021,7 +1021,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -1035,7 +1035,7 @@ describe('getLocaleAbsoluteUrl', () => {
site: 'https://example.com',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en'
+ 'https://example.com/blog/en',
);
});
@@ -1063,7 +1063,7 @@ describe('getLocaleAbsoluteUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/en-us/'
+ '/blog/en-us/',
);
assert.equal(
@@ -1074,7 +1074,7 @@ describe('getLocaleAbsoluteUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/en-au/'
+ '/blog/en-au/',
);
assert.equal(
@@ -1086,7 +1086,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
normalizeLocale: true,
}),
- '/blog/en-us/'
+ '/blog/en-us/',
);
});
@@ -1117,7 +1117,7 @@ describe('getLocaleAbsoluteUrl', () => {
...config.i18n,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1129,7 +1129,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
// file format
@@ -1143,7 +1143,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1155,7 +1155,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
});
@@ -1187,7 +1187,7 @@ describe('getLocaleAbsoluteUrl', () => {
...config.i18n,
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1199,7 +1199,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
// file format
@@ -1213,7 +1213,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/en/'
+ 'https://example.com/blog/en/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1225,7 +1225,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
strategy: toRoutingStrategy(config.i18n.routing, {}),
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
});
it('should correctly return the URL without base', () => {
@@ -1259,7 +1259,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/'
+ 'https://example.com/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1270,7 +1270,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/es/'
+ 'https://example.com/es/',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1281,7 +1281,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/italiano/'
+ 'https://example.com/italiano/',
);
});
@@ -1309,7 +1309,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/blog'
+ 'https://example.com/blog',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1320,7 +1320,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -1332,7 +1332,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
site: 'https://example.com',
}),
- 'https://example.com/blog/'
+ 'https://example.com/blog/',
);
// directory file
@@ -1345,7 +1345,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog'
+ 'https://example.com/blog',
);
assert.equal(
getLocaleAbsoluteUrl({
@@ -1356,7 +1356,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog/es/'
+ 'https://example.com/blog/es/',
);
assert.equal(
@@ -1369,7 +1369,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'file',
site: 'https://example.com',
}),
- 'https://example.com/blog'
+ 'https://example.com/blog',
);
});
@@ -1397,7 +1397,7 @@ describe('getLocaleAbsoluteUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/en-us/'
+ '/blog/en-us/',
);
assert.equal(
@@ -1408,7 +1408,7 @@ describe('getLocaleAbsoluteUrl', () => {
trailingSlash: 'always',
format: 'directory',
}),
- '/blog/en-au/'
+ '/blog/en-au/',
);
assert.equal(
@@ -1420,7 +1420,7 @@ describe('getLocaleAbsoluteUrl', () => {
format: 'directory',
normalizeLocale: true,
}),
- '/blog/en-us/'
+ '/blog/en-us/',
);
});
});
@@ -1451,7 +1451,7 @@ describe('getLocaleAbsoluteUrlList', () => {
],
},
},
- process.cwd()
+ process.cwd(),
);
// directory format
assert.deepEqual(
@@ -1466,7 +1466,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/en-us',
'https://example.com/blog/es',
'https://example.com/blog/italiano',
- ]
+ ],
);
});
@@ -1486,7 +1486,7 @@ describe('getLocaleAbsoluteUrlList', () => {
locales: ['en', 'en_US', 'es'],
},
},
- process.cwd()
+ process.cwd(),
);
// directory format
assert.deepEqual(
@@ -1499,7 +1499,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/',
'https://example.com/blog/en-us/',
'https://example.com/blog/es/',
- ]
+ ],
);
});
@@ -1521,7 +1521,7 @@ describe('getLocaleAbsoluteUrlList', () => {
},
},
},
- process.cwd()
+ process.cwd(),
);
// directory format
assert.deepEqual(
@@ -1536,7 +1536,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/en/download/',
'https://example.com/en-us/download/',
'https://example.com/es/download/',
- ]
+ ],
);
});
@@ -1562,7 +1562,7 @@ describe('getLocaleAbsoluteUrlList', () => {
},
},
},
- process.cwd()
+ process.cwd(),
);
// directory format
assert.deepEqual(
@@ -1578,7 +1578,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/en/download/',
'https://example.com/en-us/download/',
'https://es.example.com/download/',
- ]
+ ],
);
});
@@ -1616,7 +1616,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/en-us/',
'https://example.com/blog/es/',
'https://example.com/blog/italiano/',
- ]
+ ],
);
});
@@ -1643,7 +1643,7 @@ describe('getLocaleAbsoluteUrlList', () => {
format: 'file',
site: 'https://example.com',
}),
- ['https://example.com/blog', 'https://example.com/blog/en-us', 'https://example.com/blog/es']
+ ['https://example.com/blog', 'https://example.com/blog/en-us', 'https://example.com/blog/es'],
);
});
@@ -1670,7 +1670,7 @@ describe('getLocaleAbsoluteUrlList', () => {
format: 'file',
site: 'https://example.com',
}),
- ['https://example.com/blog', 'https://example.com/blog/en-us', 'https://example.com/blog/es']
+ ['https://example.com/blog', 'https://example.com/blog/en-us', 'https://example.com/blog/es'],
);
});
@@ -1701,7 +1701,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/',
'https://example.com/blog/en-us/',
'https://example.com/blog/es/',
- ]
+ ],
);
});
@@ -1734,7 +1734,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/en/',
'https://example.com/blog/en-us/',
'https://example.com/blog/es/',
- ]
+ ],
);
});
@@ -1768,7 +1768,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.com/blog/en/',
'https://example.com/blog/en-us/',
'https://example.com/blog/es/',
- ]
+ ],
);
});
@@ -1804,7 +1804,7 @@ describe('getLocaleAbsoluteUrlList', () => {
'https://example.uk/blog/',
'https://example.com/blog/en-us/',
'https://es.example.com/blog/',
- ]
+ ],
);
});
});
diff --git a/packages/astro/test/units/integrations/api.test.js b/packages/astro/test/units/integrations/api.test.js
index 06785e11b..960e003fc 100644
--- a/packages/astro/test/units/integrations/api.test.js
+++ b/packages/astro/test/units/integrations/api.test.js
@@ -127,7 +127,7 @@ describe('Astro feature map', function () {
output: 'hybrid',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['hybridOutput'], true);
});
@@ -140,7 +140,7 @@ describe('Astro feature map', function () {
output: 'hybrid',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['hybridOutput'], false);
});
@@ -153,7 +153,7 @@ describe('Astro feature map', function () {
output: 'hybrid',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['hybridOutput'], false);
});
@@ -167,7 +167,7 @@ describe('Astro feature map', function () {
output: 'static',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['staticOutput'], true);
});
@@ -180,7 +180,7 @@ describe('Astro feature map', function () {
output: 'static',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['staticOutput'], false);
});
@@ -194,7 +194,7 @@ describe('Astro feature map', function () {
output: 'hybrid',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['hybridOutput'], true);
});
@@ -209,7 +209,7 @@ describe('Astro feature map', function () {
output: 'hybrid',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['hybridOutput'], false);
});
@@ -223,7 +223,7 @@ describe('Astro feature map', function () {
output: 'server',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['serverOutput'], true);
});
@@ -238,7 +238,7 @@ describe('Astro feature map', function () {
output: 'server',
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['serverOutput'], false);
});
@@ -262,7 +262,7 @@ describe('Astro feature map', function () {
},
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['assets'], true);
});
@@ -283,7 +283,7 @@ describe('Astro feature map', function () {
},
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['assets'], true);
});
@@ -305,7 +305,7 @@ describe('Astro feature map', function () {
},
},
{},
- defaultLogger
+ defaultLogger,
);
assert.equal(result['assets'], false);
});
diff --git a/packages/astro/test/units/render/chunk.test.js b/packages/astro/test/units/render/chunk.test.js
index 176e5fa1d..b9c1c70f3 100644
--- a/packages/astro/test/units/render/chunk.test.js
+++ b/packages/astro/test/units/render/chunk.test.js
@@ -17,7 +17,7 @@ describe('core/render chunk', () => {
<div id="chunk">{value}</div>
`,
},
- root
+ root,
);
await runInContainer(
@@ -47,7 +47,7 @@ describe('core/render chunk', () => {
} catch {
assert.fail();
}
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/render/components.test.js b/packages/astro/test/units/render/components.test.js
index c490cb19e..b13d1fe88 100644
--- a/packages/astro/test/units/render/components.test.js
+++ b/packages/astro/test/units/render/components.test.js
@@ -24,7 +24,7 @@ describe('core/render components', () => {
</html>
`,
},
- root
+ root,
);
await runInContainer(
@@ -53,7 +53,7 @@ describe('core/render components', () => {
assert.equal(typeof target.attr('style'), 'undefined');
assert.equal($('#pwnd').length, 0);
- }
+ },
);
});
@@ -80,7 +80,7 @@ describe('core/render components', () => {
'/src/components/BothFlipped.astro': `<pre id="both-flipped" set:html={JSON.stringify(Astro.props)} />`,
'/src/components/BothSpread.astro': `<pre id="both-spread" set:html={JSON.stringify(Astro.props)} />`,
},
- root
+ root,
);
await runInContainer(
@@ -116,7 +116,7 @@ describe('core/render components', () => {
assert.deepEqual(BothLiteral, { class: 'red blue' }, '#both-literal');
assert.deepEqual(BothFlipped, { class: 'red blue' }, '#both-flipped');
assert.deepEqual(BothSpread, { class: 'red blue' }, '#both-spread');
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/render/head.test.js b/packages/astro/test/units/render/head.test.js
index 06fe0705a..0eb4c7715 100644
--- a/packages/astro/test/units/render/head.test.js
+++ b/packages/astro/test/units/render/head.test.js
@@ -64,10 +64,10 @@ describe('core/render', () => {
{ slot: 'head' },
{
default: () => render`${renderSlot(result, slots['head'])}`,
- }
+ },
)}
`,
- }
+ },
)}
`;
});
@@ -88,10 +88,10 @@ describe('core/render', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
});
@@ -145,10 +145,10 @@ describe('core/render', () => {
{ slot: 'head' },
{
default: () => render`${renderSlot(result, slots['head'])}`,
- }
+ },
)}
`,
- }
+ },
)}
`;
});
@@ -169,10 +169,10 @@ describe('core/render', () => {
{ slot: 'head' },
{
default: () => render`<meta charset="utf-8">`,
- }
+ },
)}
`,
- }
+ },
)}`;
});
@@ -207,7 +207,7 @@ describe('core/render', () => {
{},
{
default: () => render`${renderSlot(result, slots['default'])} `,
- }
+ },
)}
`;
});
@@ -220,7 +220,7 @@ describe('core/render', () => {
{},
{
default: () => render`${maybeRenderHead(result)}<div>hello world</div>`,
- }
+ },
)}`;
});
diff --git a/packages/astro/test/units/render/jsx.test.js b/packages/astro/test/units/render/jsx.test.js
index 3e1b01b23..ba03a6f55 100644
--- a/packages/astro/test/units/render/jsx.test.js
+++ b/packages/astro/test/units/render/jsx.test.js
@@ -105,9 +105,9 @@ describe('core/render', () => {
const html = await response.text();
assert.equal(
html.includes(
- '<main><div><p class="n">works</p></div><div><p class="p">works</p></div></main>'
+ '<main><div><p class="n">works</p></div><div><p class="p">works</p></div></main>',
),
- true
+ true,
);
});
diff --git a/packages/astro/test/units/routing/manifest.test.js b/packages/astro/test/units/routing/manifest.test.js
index e5fa35729..523d86e6a 100644
--- a/packages/astro/test/units/routing/manifest.test.js
+++ b/packages/astro/test/units/routing/manifest.test.js
@@ -45,7 +45,7 @@ describe('routing - createRouteManifest', () => {
{
'/src/pages/index.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -68,7 +68,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/[contact].astro': `<h1>test</h1>`,
'/src/pages/[contact].ts': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -125,7 +125,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/static-[dynamic].astro': `<h1>test</h1>`,
'/src/pages/index.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -165,7 +165,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/test/index.astro': `<h1>test</h1>`,
'/src/pages/index.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -214,7 +214,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/static.astro': `<h1>test</h1>`,
'/src/pages/index.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -268,7 +268,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/index.astro': `<h1>test</h1>`,
'/src/pages/blog/[...slug].astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -320,7 +320,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/index.astro': `<h1>test</h1>`,
'/src/pages/blog/[...slug].astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -376,7 +376,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/index.astro': `<h1>test</h1>`,
'/src/pages/blog/contributing.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -423,7 +423,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/index.astro': `<h1>test</h1>`,
'/src/pages/blog/contributing.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -475,7 +475,7 @@ describe('routing - createRouteManifest', () => {
{
'/src/pages/contributing.astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -528,7 +528,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/[foo].astro': `<h1>test</h1>`,
'/src/pages/[bar].astro': `<h1>test</h1>`,
},
- root
+ root,
);
const settings = await createBasicSettings({
root: fileURLToPath(root),
@@ -574,7 +574,7 @@ describe('routing - createRouteManifest', () => {
'/src/pages/a-[b].astro': `<h1>test</h1>`,
'/src/pages/blog/a-[b].233.ts': ``,
},
- root
+ root,
);
const settings = await createBasicSettings({
diff --git a/packages/astro/test/units/routing/route-matching.test.js b/packages/astro/test/units/routing/route-matching.test.js
index 5eafa6c80..a9a0e48a3 100644
--- a/packages/astro/test/units/routing/route-matching.test.js
+++ b/packages/astro/test/units/routing/route-matching.test.js
@@ -153,7 +153,7 @@ describe('Route matching', () => {
settings,
fsMod: fs,
},
- defaultLogger
+ defaultLogger,
);
});
diff --git a/packages/astro/test/units/runtime/astro-global.test.js b/packages/astro/test/units/runtime/astro-global.test.js
index 8c745c01d..524a7b1fb 100644
--- a/packages/astro/test/units/runtime/astro-global.test.js
+++ b/packages/astro/test/units/runtime/astro-global.test.js
@@ -11,7 +11,7 @@ describe('astro global', () => {
},
{
message: /can only be used in/,
- }
+ },
);
});
@@ -23,7 +23,7 @@ describe('astro global', () => {
},
{
message: /did not return any matching files/,
- }
+ },
);
});
});
diff --git a/packages/astro/test/units/test-utils.js b/packages/astro/test/units/test-utils.js
index 88092c891..bab850b68 100644
--- a/packages/astro/test/units/test-utils.js
+++ b/packages/astro/test/units/test-utils.js
@@ -203,7 +203,7 @@ export function createBasicPipeline(options = {}) {
options.i18n,
options.middleware,
options.routeCache ?? new RouteCache(options.logging, mode),
- options.site
+ options.site,
);
pipeline.headElements = () => ({ scripts: new Set(), styles: new Set(), links: new Set() });
pipeline.componentMetadata = () => new Map();
diff --git a/packages/astro/test/units/vite-plugin-astro-server/request.test.js b/packages/astro/test/units/vite-plugin-astro-server/request.test.js
index f976a9d30..26f446cb1 100644
--- a/packages/astro/test/units/vite-plugin-astro-server/request.test.js
+++ b/packages/astro/test/units/vite-plugin-astro-server/request.test.js
@@ -48,14 +48,14 @@ describe('vite-plugin-astro-server', () => {
// Note that the content doesn't matter here because we are using a custom loader.
'/src/pages/index.astro': '',
},
- '/'
+ '/',
);
const manifestData = createRouteManifest(
{
fsMod: fs,
settings: pipeline.settings,
},
- defaultLogger
+ defaultLogger,
);
try {
diff --git a/packages/astro/test/units/vite-plugin-astro/compile.test.js b/packages/astro/test/units/vite-plugin-astro/compile.test.js
index dd779024b..25ffdcfe7 100644
--- a/packages/astro/test/units/vite-plugin-astro/compile.test.js
+++ b/packages/astro/test/units/vite-plugin-astro/compile.test.js
@@ -37,7 +37,7 @@ const name: string = 'world'
---
<h1>Hello {name}</h1>`,
- '/src/components/index.astro'
+ '/src/components/index.astro',
);
assert.ok(result.code);
});
@@ -52,7 +52,7 @@ const name = 'world
---
<h1>Hello {name}</h1>`,
- '/src/components/index.astro'
+ '/src/components/index.astro',
);
} catch (e) {
assert.equal(e.message.includes('Unterminated string literal'), true);
diff --git a/packages/astro/test/units/vite-plugin-scanner/scan.test.js b/packages/astro/test/units/vite-plugin-scanner/scan.test.js
index 2ee86610d..5dab2449d 100644
--- a/packages/astro/test/units/vite-plugin-scanner/scan.test.js
+++ b/packages/astro/test/units/vite-plugin-scanner/scan.test.js
@@ -55,9 +55,9 @@ describe('astro scan', () => {
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
@@ -69,9 +69,9 @@ describe('astro scan', () => {
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
@@ -83,9 +83,9 @@ describe('astro scan', () => {
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
@@ -97,9 +97,9 @@ describe('astro scan', () => {
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
@@ -108,15 +108,15 @@ describe('astro scan', () => {
try {
await scan(
`export let prerender = undefined; prerender = true;`,
- '/src/components/index.astro'
+ '/src/components/index.astro',
);
assert.equal(false).to.be.true;
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
@@ -128,9 +128,9 @@ describe('astro scan', () => {
} catch (e) {
assert.equal(
e.message.includes(
- `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`
+ `A \`prerender\` export has been detected, but its value cannot be statically analyzed.`,
),
- true
+ true,
);
}
});
diff --git a/packages/astro/test/view-transitions.test.js b/packages/astro/test/view-transitions.test.js
index 21d45f7fb..168d25f8e 100644
--- a/packages/astro/test/view-transitions.test.js
+++ b/packages/astro/test/view-transitions.test.js
@@ -31,7 +31,7 @@ describe('View Transitions styles', () => {
assert.equal($('astro-island[data-astro-transition-persist]').length, 1);
assert.equal(
$('astro-island[data-astro-transition-persist] > [data-astro-transition-persist]').length,
- 0
+ 0,
);
});
});
diff --git a/packages/astro/types/content.d.ts b/packages/astro/types/content.d.ts
index e09bda618..18ddf2c8c 100644
--- a/packages/astro/types/content.d.ts
+++ b/packages/astro/types/content.d.ts
@@ -47,7 +47,7 @@ declare module 'astro:content' {
| DataCollectionConfig<S>;
export function defineCollection<S extends BaseSchema>(
- input: CollectionConfig<S>
+ input: CollectionConfig<S>,
): CollectionConfig<S>;
/** Run `astro sync` to generate high fidelity types */
diff --git a/packages/create-astro/src/actions/context.ts b/packages/create-astro/src/actions/context.ts
index 4bb76fe71..83a13eda7 100644
--- a/packages/create-astro/src/actions/context.ts
+++ b/packages/create-astro/src/actions/context.ts
@@ -53,7 +53,7 @@ export async function getContext(argv: string[]): Promise<Context> {
'-n': '--no',
'-h': '--help',
},
- { argv, permissive: true }
+ { argv, permissive: true },
);
const packageManager = detectPackageManager() ?? 'npm';
diff --git a/packages/create-astro/src/actions/dependencies.ts b/packages/create-astro/src/actions/dependencies.ts
index dbca1ee0c..6a9b6fccb 100644
--- a/packages/create-astro/src/actions/dependencies.ts
+++ b/packages/create-astro/src/actions/dependencies.ts
@@ -6,7 +6,7 @@ import { shell } from '../shell.js';
import type { Context } from './context.js';
export async function dependencies(
- ctx: Pick<Context, 'install' | 'yes' | 'prompt' | 'packageManager' | 'cwd' | 'dryRun' | 'tasks'>
+ ctx: Pick<Context, 'install' | 'yes' | 'prompt' | 'packageManager' | 'cwd' | 'dryRun' | 'tasks'>,
) {
let deps = ctx.install ?? ctx.yes;
if (deps === undefined) {
@@ -33,8 +33,8 @@ export async function dependencies(
error(
'error',
`Dependencies failed to install, please run ${color.bold(
- ctx.packageManager + ' install'
- )} to install them manually after setup.`
+ ctx.packageManager + ' install',
+ )} to install them manually after setup.`,
);
},
while: () => install({ packageManager: ctx.packageManager, cwd: ctx.cwd }),
@@ -42,7 +42,7 @@ export async function dependencies(
} else {
await info(
ctx.yes === false ? 'deps [skip]' : 'No problem!',
- 'Remember to install dependencies after setup.'
+ 'Remember to install dependencies after setup.',
);
}
}
diff --git a/packages/create-astro/src/actions/git.ts b/packages/create-astro/src/actions/git.ts
index d75ed18cc..1ecf8c542 100644
--- a/packages/create-astro/src/actions/git.ts
+++ b/packages/create-astro/src/actions/git.ts
@@ -7,7 +7,7 @@ import { error, info, title } from '../messages.js';
import { shell } from '../shell.js';
export async function git(
- ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun' | 'tasks'>
+ ctx: Pick<Context, 'cwd' | 'git' | 'yes' | 'prompt' | 'dryRun' | 'tasks'>,
) {
if (fs.existsSync(path.join(ctx.cwd, '.git'))) {
await info('Nice!', `Git has already been initialized`);
@@ -41,7 +41,7 @@ export async function git(
} else {
await info(
ctx.yes === false ? 'git [skip]' : 'Sounds good!',
- `You can always run ${color.reset('git init')}${color.dim(' manually.')}`
+ `You can always run ${color.reset('git init')}${color.dim(' manually.')}`,
);
}
}
@@ -58,7 +58,7 @@ async function init({ cwd }: { cwd: string }) {
'Initial commit from Astro',
'--author="houston[bot] <astrobot-houston@users.noreply.github.com>"',
],
- { cwd, stdio: 'ignore' }
+ { cwd, stdio: 'ignore' },
);
} catch {}
}
diff --git a/packages/create-astro/src/actions/intro.ts b/packages/create-astro/src/actions/intro.ts
index 8a0c10907..0249e63c8 100644
--- a/packages/create-astro/src/actions/intro.ts
+++ b/packages/create-astro/src/actions/intro.ts
@@ -4,7 +4,7 @@ import { color, label } from '@astrojs/cli-kit';
import { banner, say } from '../messages.js';
export async function intro(
- ctx: Pick<Context, 'skipHouston' | 'welcome' | 'hat' | 'tie' | 'version' | 'username' | 'fancy'>
+ ctx: Pick<Context, 'skipHouston' | 'welcome' | 'hat' | 'tie' | 'version' | 'username' | 'fancy'>,
) {
banner();
@@ -17,13 +17,13 @@ export async function intro(
'to',
label('astro', color.bgGreen, color.black),
Promise.resolve(ctx.version).then(
- (version) => (version ? color.green(`v${version}`) : '') + ','
+ (version) => (version ? color.green(`v${version}`) : '') + ',',
),
Promise.resolve(ctx.username).then((username) => `${username}!`),
],
welcome ?? "Let's build something awesome!",
] as string[],
- { clear: true, hat, tie }
+ { clear: true, hat, tie },
);
}
}
diff --git a/packages/create-astro/src/actions/next-steps.ts b/packages/create-astro/src/actions/next-steps.ts
index 384ad61eb..91536cc46 100644
--- a/packages/create-astro/src/actions/next-steps.ts
+++ b/packages/create-astro/src/actions/next-steps.ts
@@ -4,7 +4,7 @@ import type { Context } from './context.js';
import { nextSteps, say } from '../messages.js';
export async function next(
- ctx: Pick<Context, 'hat' | 'tie' | 'cwd' | 'packageManager' | 'skipHouston'>
+ ctx: Pick<Context, 'hat' | 'tie' | 'cwd' | 'packageManager' | 'skipHouston'>,
) {
let projectDir = path.relative(process.cwd(), ctx.cwd);
diff --git a/packages/create-astro/src/actions/project-name.ts b/packages/create-astro/src/actions/project-name.ts
index 2c2d95fb9..26938de80 100644
--- a/packages/create-astro/src/actions/project-name.ts
+++ b/packages/create-astro/src/actions/project-name.ts
@@ -7,7 +7,7 @@ import { info, log, title } from '../messages.js';
import { isEmpty, toValidName } from './shared.js';
export async function projectName(
- ctx: Pick<Context, 'cwd' | 'yes' | 'dryRun' | 'prompt' | 'projectName' | 'exit'>
+ ctx: Pick<Context, 'cwd' | 'yes' | 'dryRun' | 'prompt' | 'projectName' | 'exit'>,
) {
await checkCwd(ctx.cwd);
diff --git a/packages/create-astro/src/actions/template.ts b/packages/create-astro/src/actions/template.ts
index 5169c63e3..d67b54ee0 100644
--- a/packages/create-astro/src/actions/template.ts
+++ b/packages/create-astro/src/actions/template.ts
@@ -7,7 +7,7 @@ import { downloadTemplate } from 'giget';
import { error, info, title } from '../messages.js';
export async function template(
- ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit' | 'tasks'>
+ ctx: Pick<Context, 'template' | 'prompt' | 'yes' | 'dryRun' | 'exit' | 'tasks'>,
) {
if (!ctx.template && ctx.yes) ctx.template = 'basics';
@@ -64,9 +64,9 @@ const FILES_TO_UPDATE = {
JSON.stringify(
Object.assign(JSON.parse(value), Object.assign(overrides, { private: undefined })),
null,
- indent
+ indent,
),
- 'utf-8'
+ 'utf-8',
);
}),
};
diff --git a/packages/create-astro/src/actions/typescript.ts b/packages/create-astro/src/actions/typescript.ts
index 9013d338b..c0034fe4f 100644
--- a/packages/create-astro/src/actions/typescript.ts
+++ b/packages/create-astro/src/actions/typescript.ts
@@ -53,8 +53,8 @@ export async function typescript(ctx: PickedTypeScriptContext) {
error(
'Error',
`Unknown TypeScript option ${color.reset(ts)}${color.dim(
- '! Expected strict | strictest | relaxed'
- )}`
+ '! Expected strict | strictest | relaxed',
+ )}`,
);
ctx.exit(1);
}
@@ -84,7 +84,7 @@ export async function typescript(ctx: PickedTypeScriptContext) {
const FILES_TO_UPDATE = {
'package.json': async (
file: string,
- options: { value: string; ctx: PickedTypeScriptContext }
+ options: { value: string; ctx: PickedTypeScriptContext },
) => {
try {
// inject additional command to build script
@@ -127,7 +127,7 @@ const FILES_TO_UPDATE = {
await writeFile(file, JSON.stringify(result, null, 2));
} else {
throw new Error(
- "There was an error applying the requested TypeScript settings. This could be because the template's tsconfig.json is malformed"
+ "There was an error applying the requested TypeScript settings. This could be because the template's tsconfig.json is malformed",
);
}
} catch (err) {
@@ -135,7 +135,7 @@ const FILES_TO_UPDATE = {
// If the template doesn't have a tsconfig.json, let's add one instead
await writeFile(
file,
- JSON.stringify({ extends: `astro/tsconfigs/${options.value}` }, null, 2)
+ JSON.stringify({ extends: `astro/tsconfigs/${options.value}` }, null, 2),
);
}
}
@@ -145,7 +145,7 @@ const FILES_TO_UPDATE = {
export async function setupTypeScript(value: string, ctx: PickedTypeScriptContext) {
await Promise.all(
Object.entries(FILES_TO_UPDATE).map(async ([file, update]) =>
- update(path.resolve(path.join(ctx.cwd, file)), { value, ctx })
- )
+ update(path.resolve(path.join(ctx.cwd, file)), { value, ctx }),
+ ),
);
}
diff --git a/packages/create-astro/src/actions/verify.ts b/packages/create-astro/src/actions/verify.ts
index 605b6959d..e620a9ca8 100644
--- a/packages/create-astro/src/actions/verify.ts
+++ b/packages/create-astro/src/actions/verify.ts
@@ -6,7 +6,7 @@ import { bannerAbort, error, info, log } from '../messages.js';
import { getTemplateTarget } from './template.js';
export async function verify(
- ctx: Pick<Context, 'version' | 'dryRun' | 'template' | 'ref' | 'exit'>
+ ctx: Pick<Context, 'version' | 'dryRun' | 'template' | 'ref' | 'exit'>,
) {
if (!ctx.dryRun) {
const online = await isOnline();
@@ -33,7 +33,7 @@ export async function verify(
function isOnline(): Promise<boolean> {
return dns.lookup('github.com').then(
() => true,
- () => false
+ () => false,
);
}
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts
index 2ea25f220..ba765f723 100644
--- a/packages/create-astro/src/messages.ts
+++ b/packages/create-astro/src/messages.ts
@@ -111,8 +111,8 @@ export const nextSteps = async ({ projectDir, devCmd }: { projectDir: string; de
await sleep(200);
log(
`\n ${color.bgCyan(` ${color.black('next')} `)} ${color.bold(
- 'Liftoff confirmed. Explore your project!'
- )}`
+ 'Liftoff confirmed. Explore your project!',
+ )}`,
);
await sleep(100);
@@ -126,13 +126,13 @@ export const nextSteps = async ({ projectDir, devCmd }: { projectDir: string; de
log(enter.join(len > max ? '\n' + prefix : ' '));
}
log(
- `${prefix}Run ${color.cyan(devCmd)} to start the dev server. ${color.cyan('CTRL+C')} to stop.`
+ `${prefix}Run ${color.cyan(devCmd)} to start the dev server. ${color.cyan('CTRL+C')} to stop.`,
);
await sleep(100);
log(
`${prefix}Add frameworks like ${color.cyan(`react`)} or ${color.cyan(
- 'tailwind'
- )} using ${color.cyan('astro add')}.`
+ 'tailwind',
+ )} using ${color.cyan('astro add')}.`,
);
await sleep(100);
log(`\n${prefix}Stuck? Join us at ${color.cyan(`https://astro.build/chat`)}`);
@@ -174,7 +174,7 @@ export function printHelp({
if (headline) {
message.push(
linebreak(),
- `${title(commandName)} ${color.green(`v${process.env.PACKAGE_VERSION ?? ''}`)} ${headline}`
+ `${title(commandName)} ${color.green(`v${process.env.PACKAGE_VERSION ?? ''}`)} ${headline}`,
);
}
diff --git a/packages/create-astro/src/shell.ts b/packages/create-astro/src/shell.ts
index 8ce3031be..7c3e22622 100644
--- a/packages/create-astro/src/shell.ts
+++ b/packages/create-astro/src/shell.ts
@@ -22,7 +22,7 @@ const text = (stream: NodeJS.ReadableStream | Readable | null) =>
export async function shell(
command: string,
flags: string[],
- opts: ExecaOptions = {}
+ opts: ExecaOptions = {},
): Promise<Output> {
let child: ChildProcess;
let stdout = '';
diff --git a/packages/create-astro/test/typescript.test.js b/packages/create-astro/test/typescript.test.js
index 0eefcf732..8787bc509 100644
--- a/packages/create-astro/test/typescript.test.js
+++ b/packages/create-astro/test/typescript.test.js
@@ -120,18 +120,18 @@ describe('typescript: setup package', async () => {
const packageJson = new URL('./package.json', root);
assert.equal(
JSON.parse(fs.readFileSync(packageJson, { encoding: 'utf-8' })).scripts.build,
- 'astro build'
+ 'astro build',
);
await setupTypeScript('strictest', { cwd: fileURLToPath(root), install: false });
const { scripts, dependencies } = JSON.parse(
- fs.readFileSync(packageJson, { encoding: 'utf-8' })
+ fs.readFileSync(packageJson, { encoding: 'utf-8' }),
);
assert.deepEqual(
Object.keys(scripts),
['dev', 'build', 'preview'],
- 'does not override existing scripts'
+ 'does not override existing scripts',
);
for (const value of Object.values(dependencies)) {
diff --git a/packages/create-astro/test/utils.js b/packages/create-astro/test/utils.js
index 2c363607d..5412c8cab 100644
--- a/packages/create-astro/test/utils.js
+++ b/packages/create-astro/test/utils.js
@@ -12,7 +12,7 @@ export function setup() {
ctx.messages.push(stripAnsi(String(buf)).trim());
return true;
},
- })
+ }),
);
});
beforeEach(() => {
@@ -40,7 +40,7 @@ const resetNotEmptyFixture = async () => {
const tsconfigPath = new URL('./fixtures/not-empty/tsconfig.json', import.meta.url);
const packageJsonData = JSON.parse(
- await fs.promises.readFile(packagePath, { encoding: 'utf-8' })
+ await fs.promises.readFile(packagePath, { encoding: 'utf-8' }),
);
const overriddenPackageJson = Object.assign(packageJsonData, {
scripts: {
diff --git a/packages/db/src/core/cli/commands/link/index.ts b/packages/db/src/core/cli/commands/link/index.ts
index 78d64b537..d39b8c09a 100644
--- a/packages/db/src/core/cli/commands/link/index.ts
+++ b/packages/db/src/core/cli/commands/link/index.ts
@@ -69,12 +69,12 @@ async function getWorkspaces(sessionToken: string) {
if (res.status === 401) {
throw new Error(
`${bgRed('Unauthorized')}\n\n Are you logged in?\n Run ${cyan(
- 'astro login'
- )} to authenticate and then try linking again.\n\n`
+ 'astro login',
+ )} to authenticate and then try linking again.\n\n`,
);
}
throw new Error(`Failed to fetch user workspace: ${res.status} ${res.statusText}`);
- }
+ },
);
const { data, success } = (await response.json()) as Result<{ id: string; name: string }[]>;
@@ -139,14 +139,14 @@ export async function createNewProject({
if (res.status === 401) {
console.error(
`${bgRed('Unauthorized')}\n\n Are you logged in?\n Run ${cyan(
- 'astro login'
- )} to authenticate and then try linking again.\n\n`
+ 'astro login',
+ )} to authenticate and then try linking again.\n\n`,
);
process.exit(1);
}
console.error(`Failed to create project: ${res.status} ${res.statusText}`);
process.exit(1);
- }
+ },
);
const { data, success } = (await response.json()) as Result<{ id: string; idName: string }>;
@@ -173,14 +173,14 @@ export async function promptExistingProjectName({ workspaceId }: { workspaceId:
if (res.status === 401) {
console.error(
`${bgRed('Unauthorized')}\n\n Are you logged in?\n Run ${cyan(
- 'astro login'
- )} to authenticate and then try linking again.\n\n`
+ 'astro login',
+ )} to authenticate and then try linking again.\n\n`,
);
process.exit(1);
}
console.error(`Failed to fetch projects: ${res.status} ${res.statusText}`);
process.exit(1);
- }
+ },
);
const { data, success } = (await response.json()) as Result<
diff --git a/packages/db/src/core/cli/commands/push/index.ts b/packages/db/src/core/cli/commands/push/index.ts
index bfccdf5f8..ecd101ece 100644
--- a/packages/db/src/core/cli/commands/push/index.ts
+++ b/packages/db/src/core/cli/commands/push/index.ts
@@ -110,7 +110,7 @@ async function pushSchema({
console.error(`${url.toString()} failed: ${res.status} ${res.statusText}`);
console.error(await res.text());
throw new Error(`/db/push fetch failed: ${res.status} ${res.statusText}`);
- }
+ },
);
const result = (await response.json()) as Result<never>;
diff --git a/packages/db/src/core/cli/commands/shell/index.ts b/packages/db/src/core/cli/commands/shell/index.ts
index 7a4115abc..e0a1a6086 100644
--- a/packages/db/src/core/cli/commands/shell/index.ts
+++ b/packages/db/src/core/cli/commands/shell/index.ts
@@ -35,7 +35,7 @@ export async function cmd({
const { ASTRO_DATABASE_FILE } = getAstroEnv();
const dbUrl = normalizeDatabaseUrl(
ASTRO_DATABASE_FILE,
- new URL(DB_PATH, astroConfig.root).href
+ new URL(DB_PATH, astroConfig.root).href,
);
const db = createLocalDatabaseClient({ dbUrl });
const result = await db.run(sql.raw(query));
diff --git a/packages/db/src/core/cli/migration-queries.ts b/packages/db/src/core/cli/migration-queries.ts
index f00d194bf..894c1d66f 100644
--- a/packages/db/src/core/cli/migration-queries.ts
+++ b/packages/db/src/core/cli/migration-queries.ts
@@ -61,7 +61,7 @@ export async function getMigrationQueries({
const addedTables = getAddedTables(oldSnapshot, newSnapshot);
const droppedTables = getDroppedTables(oldSnapshot, newSnapshot);
const notDeprecatedDroppedTables = Object.fromEntries(
- Object.entries(droppedTables).filter(([, table]) => !table.deprecated)
+ Object.entries(droppedTables).filter(([, table]) => !table.deprecated),
);
if (!isEmpty(addedTables) && !isEmpty(notDeprecatedDroppedTables)) {
const oldTable = Object.keys(notDeprecatedDroppedTables)[0];
@@ -85,14 +85,14 @@ export async function getMigrationQueries({
const addedColumns = getAdded(oldTable.columns, newTable.columns);
const droppedColumns = getDropped(oldTable.columns, newTable.columns);
const notDeprecatedDroppedColumns = Object.fromEntries(
- Object.entries(droppedColumns).filter(([, col]) => !col.schema.deprecated)
+ Object.entries(droppedColumns).filter(([, col]) => !col.schema.deprecated),
);
if (!isEmpty(addedColumns) && !isEmpty(notDeprecatedDroppedColumns)) {
throw new Error(
RENAME_COLUMN_ERROR(
`${tableName}.${Object.keys(addedColumns)[0]}`,
- `${tableName}.${Object.keys(notDeprecatedDroppedColumns)[0]}`
- )
+ `${tableName}.${Object.keys(notDeprecatedDroppedColumns)[0]}`,
+ ),
);
}
const result = await getTableChangeQueries({
@@ -146,7 +146,7 @@ export async function getTableChangeQueries({
tableName,
oldIndexes: oldTable.indexes,
newIndexes: newTable.indexes,
- })
+ }),
);
return { queries, confirmations };
}
@@ -156,17 +156,17 @@ export async function getTableChangeQueries({
const { reason, columnName } = dataLossCheck;
const reasonMsgs: Record<DataLossReason, string> = {
'added-required': `You added new required column '${color.bold(
- tableName + '.' + columnName
+ tableName + '.' + columnName,
)}' with no default value.\n This cannot be executed on an existing table.`,
'updated-type': `Updating existing column ${color.bold(
- tableName + '.' + columnName
+ tableName + '.' + columnName,
)} to a new type that cannot be handled automatically.`,
};
confirmations.push(reasonMsgs[reason]);
}
const primaryKeyExists = Object.entries(newTable.columns).find(([, column]) =>
- hasPrimaryKey(column)
+ hasPrimaryKey(column),
);
const droppedPrimaryKey = Object.entries(dropped).find(([, column]) => hasPrimaryKey(column));
@@ -229,7 +229,7 @@ function getDroppedTables(oldTables: DBSnapshot, newTables: DBSnapshot): Resolve
function getAlterTableQueries(
unescTableName: string,
added: DBColumns,
- dropped: DBColumns
+ dropped: DBColumns,
): string[] {
const queries: string[] = [];
const tableName = sqlite.escapeName(unescTableName);
@@ -239,7 +239,7 @@ function getAlterTableQueries(
const type = schemaTypeToSqlType(column.type);
const q = `ALTER TABLE ${tableName} ADD COLUMN ${columnName} ${type}${getModifiers(
columnName,
- column
+ column,
)}`;
queries.push(q);
}
@@ -322,7 +322,7 @@ type DataLossResponse =
function canRecreateTableWithoutDataLoss(
added: DBColumns,
- updated: UpdatedColumns
+ updated: UpdatedColumns,
): DataLossResponse {
for (const [columnName, a] of Object.entries(added)) {
if (hasPrimaryKey(a) && a.type !== 'number' && !hasDefault(a)) {
@@ -404,7 +404,7 @@ const typeChangesWithoutQuery: Array<{ from: ColumnType; to: ColumnType }> = [
function canChangeTypeWithoutQuery(oldColumn: DBColumn, newColumn: DBColumn) {
return typeChangesWithoutQuery.some(
- ({ from, to }) => oldColumn.type === from && newColumn.type === to
+ ({ from, to }) => oldColumn.type === from && newColumn.type === to,
);
}
@@ -441,7 +441,7 @@ export async function getProductionCurrentSnapshot({
console.error(`${url.toString()} failed: ${res.status} ${res.statusText}`);
console.error(await res.text());
throw new Error(`/db/schema fetch failed: ${res.status} ${res.statusText}`);
- }
+ },
);
const result = (await response.json()) as Result<DBSnapshot>;
@@ -479,7 +479,7 @@ export function formatDataLossMessage(confirmations: string[], isColor = true):
messages.push(``);
messages.push(`To resolve, revert these changes or update your schema, and re-run the command.`);
messages.push(
- `You may also run 'astro db push --force-reset' to ignore all warnings and force-push your local database schema to production instead. All data will be lost and the database will be reset.`
+ `You may also run 'astro db push --force-reset' to ignore all warnings and force-push your local database schema to production instead. All data will be lost and the database will be reset.`,
);
let finalMessage = messages.join('\n');
if (!isColor) {
diff --git a/packages/db/src/core/cli/print-help.ts b/packages/db/src/core/cli/print-help.ts
index 8700301dd..4082380b2 100644
--- a/packages/db/src/core/cli/print-help.ts
+++ b/packages/db/src/core/cli/print-help.ts
@@ -41,8 +41,8 @@ export function printHelp({
message.push(
linebreak(),
` ${bgGreen(black(` ${commandName} `))} ${green(
- `v${process.env.PACKAGE_VERSION ?? ''}`
- )} ${headline}`
+ `v${process.env.PACKAGE_VERSION ?? ''}`,
+ )} ${headline}`,
);
}
diff --git a/packages/db/src/core/consts.ts b/packages/db/src/core/consts.ts
index c37f1b99d..703a91dca 100644
--- a/packages/db/src/core/consts.ts
+++ b/packages/db/src/core/consts.ts
@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs';
export const PACKAGE_NAME = JSON.parse(
- readFileSync(new URL('../../package.json', import.meta.url), 'utf8')
+ readFileSync(new URL('../../package.json', import.meta.url), 'utf8'),
).name;
export const RUNTIME_IMPORT = JSON.stringify(`${PACKAGE_NAME}/runtime`);
diff --git a/packages/db/src/core/errors.ts b/packages/db/src/core/errors.ts
index 5c8c196db..5272fd3c2 100644
--- a/packages/db/src/core/errors.ts
+++ b/packages/db/src/core/errors.ts
@@ -1,7 +1,7 @@
import { bold, cyan, red } from 'kleur/colors';
export const MISSING_EXECUTE_PATH_ERROR = `${red(
- '▶ No file path provided.'
+ '▶ No file path provided.',
)} Provide a path by running ${cyan('astro db execute <path>')}\n`;
export const RENAME_TABLE_ERROR = (oldTable: string, newTable: string) => {
@@ -28,7 +28,7 @@ export const RENAME_COLUMN_ERROR = (oldSelector: string, newSelector: string) =>
export const FILE_NOT_FOUND_ERROR = (path: string) => `${red('▶ File not found:')} ${bold(path)}\n`;
export const SHELL_QUERY_MISSING_ERROR = `${red(
- '▶ Please provide a query to execute using the --query flag.'
+ '▶ Please provide a query to execute using the --query flag.',
)}\n`;
export const EXEC_ERROR = (error: string) => {
@@ -42,7 +42,7 @@ export const EXEC_DEFAULT_EXPORT_ERROR = (fileName: string) => {
export const INTEGRATION_TABLE_CONFLICT_ERROR = (
integrationName: string,
tableName: string,
- isUserConflict: boolean
+ isUserConflict: boolean,
) => {
return red('▶ Conflicting table name in integration ' + bold(integrationName)) + isUserConflict
? `\n A user-defined table named ${bold(tableName)} already exists`
diff --git a/packages/db/src/core/integration/error-map.ts b/packages/db/src/core/integration/error-map.ts
index e471fead5..d2697c9ca 100644
--- a/packages/db/src/core/integration/error-map.ts
+++ b/packages/db/src/core/integration/error-map.ts
@@ -37,7 +37,7 @@ export const errorMap: z.ZodErrorMap = (baseError, ctx) => {
const messages: string[] = [
prefix(
baseErrorPath,
- typeOrLiteralErrByPath.size ? 'Did not match union:' : 'Did not match union.'
+ typeOrLiteralErrByPath.size ? 'Did not match union:' : 'Did not match union.',
),
];
return {
@@ -51,8 +51,8 @@ export const errorMap: z.ZodErrorMap = (baseError, ctx) => {
// Avoid printing the key again if it's a base error
key === baseErrorPath
? `> ${getTypeOrLiteralMsg(error)}`
- : `> ${prefix(key, getTypeOrLiteralMsg(error))}`
- )
+ : `> ${prefix(key, getTypeOrLiteralMsg(error))}`,
+ ),
)
.join('\n'),
};
@@ -65,7 +65,7 @@ export const errorMap: z.ZodErrorMap = (baseError, ctx) => {
code: baseError.code,
received: (baseError as any).received,
expected: [baseError.expected],
- })
+ }),
),
};
} else if (baseError.message) {
@@ -81,11 +81,11 @@ const getTypeOrLiteralMsg = (error: TypeOrLiteralErrByPathEntry): string => {
switch (error.code) {
case 'invalid_type':
return `Expected type \`${unionExpectedVals(expectedDeduped)}\`, received ${JSON.stringify(
- error.received
+ error.received,
)}`;
case 'invalid_literal':
return `Expected \`${unionExpectedVals(expectedDeduped)}\`, received ${JSON.stringify(
- error.received
+ error.received,
)}`;
}
};
diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts
index 9be71956f..19c712c80 100644
--- a/packages/db/src/core/integration/index.ts
+++ b/packages/db/src/core/integration/index.ts
@@ -141,12 +141,12 @@ function astroDBIntegration(): AstroIntegration {
// Wait for dev server log before showing "connected".
setTimeout(() => {
logger.info(
- connectToStudio ? 'Connected to remote database.' : 'New local database created.'
+ connectToStudio ? 'Connected to remote database.' : 'New local database created.',
);
if (connectToStudio) return;
const localSeedPaths = SEED_DEV_FILE_NAME.map(
- (name) => new URL(name, getDbDirectoryUrl(root))
+ (name) => new URL(name, getDbDirectoryUrl(root)),
);
// Eager load astro:db module on startup
if (seedFiles.get().length || localSeedPaths.find((path) => existsSync(path))) {
@@ -224,7 +224,7 @@ async function getTempViteServer({ viteConfig }: { viteConfig: UserConfig }) {
optimizeDeps: { noDiscovery: true },
ssr: { external: [] },
logLevel: 'silent',
- })
+ }),
);
const hotSend = tempViteServer.hot.send;
diff --git a/packages/db/src/core/integration/vite-plugin-db.ts b/packages/db/src/core/integration/vite-plugin-db.ts
index cd334b4de..05cfa3ef0 100644
--- a/packages/db/src/core/integration/vite-plugin-db.ts
+++ b/packages/db/src/core/integration/vite-plugin-db.ts
@@ -178,8 +178,8 @@ function getStringifiedTableExports(tables: DBTables) {
.map(
([name, table]) =>
`export const ${name} = asDrizzleTable(${JSON.stringify(name)}, ${JSON.stringify(
- table
- )}, false)`
+ table,
+ )}, false)`,
)
.join('\n');
}
diff --git a/packages/db/src/core/integration/vite-plugin-inject-env-ts.ts b/packages/db/src/core/integration/vite-plugin-inject-env-ts.ts
index 58faa7045..14257d480 100644
--- a/packages/db/src/core/integration/vite-plugin-inject-env-ts.ts
+++ b/packages/db/src/core/integration/vite-plugin-inject-env-ts.ts
@@ -10,7 +10,7 @@ import type { VitePlugin } from '../utils.js';
export function vitePluginInjectEnvTs(
{ srcDir, root }: { srcDir: URL; root: URL },
- logger: AstroIntegrationLogger
+ logger: AstroIntegrationLogger,
): VitePlugin {
return {
name: 'db-inject-env-ts',
@@ -32,7 +32,7 @@ export async function setUpEnvTs({
}) {
const envTsPath = getEnvTsPath({ srcDir });
const envTsPathRelativetoRoot = normalizePath(
- path.relative(fileURLToPath(root), fileURLToPath(envTsPath))
+ path.relative(fileURLToPath(root), fileURLToPath(envTsPath)),
);
if (existsSync(envTsPath)) {
@@ -54,7 +54,7 @@ export async function setUpEnvTs({
function getDBTypeReference({ srcDir, dotAstroDir }: { srcDir: URL; dotAstroDir: URL }) {
const dbTypesFile = new URL(DB_TYPES_FILE, dotAstroDir);
const contentTypesRelativeToSrcDir = normalizePath(
- path.relative(fileURLToPath(srcDir), fileURLToPath(dbTypesFile))
+ path.relative(fileURLToPath(srcDir), fileURLToPath(dbTypesFile)),
);
return `/// <reference path=${JSON.stringify(contentTypesRelativeToSrcDir)} />`;
diff --git a/packages/db/src/core/load-file.ts b/packages/db/src/core/load-file.ts
index cbdb6d243..b9fb0136c 100644
--- a/packages/db/src/core/load-file.ts
+++ b/packages/db/src/core/load-file.ts
@@ -69,7 +69,7 @@ export async function resolveDbConfig({
}
async function loadUserConfigFile(
- root: URL
+ root: URL,
): Promise<{ mod: { default?: unknown } | undefined; dependencies: string[] }> {
let configFileUrl: URL | undefined;
for (const fileName of CONFIG_FILE_NAMES) {
diff --git a/packages/db/src/core/queries.ts b/packages/db/src/core/queries.ts
index 70ea0cf0e..705205ee4 100644
--- a/packages/db/src/core/queries.ts
+++ b/packages/db/src/core/queries.ts
@@ -33,14 +33,14 @@ export function getCreateTableQuery(tableName: string, table: DBTable) {
const colQueries = [];
const colHasPrimaryKey = Object.entries(table.columns).find(([, column]) =>
- hasPrimaryKey(column)
+ hasPrimaryKey(column),
);
if (!colHasPrimaryKey) {
colQueries.push('_id INTEGER PRIMARY KEY');
}
for (const [columnName, column] of Object.entries(table.columns)) {
const colQuery = `${sqlite.escapeName(columnName)} ${schemaTypeToSqlType(
- column.type
+ column.type,
)}${getModifiers(columnName, column)}`;
colQueries.push(colQuery);
}
@@ -59,7 +59,7 @@ export function getCreateIndexQueries(tableName: string, table: Pick<DBTable, 'i
const unique = indexProps.unique ? 'UNIQUE ' : '';
const indexQuery = `CREATE ${unique}INDEX ${sqlite.escapeName(
- indexName
+ indexName,
)} ON ${sqlite.escapeName(tableName)} (${onCols.join(', ')})`;
queries.push(indexQuery);
}
@@ -194,8 +194,8 @@ function getDefaultValueSql(columnName: string, column: DBColumnWithDefault): st
// eslint-disable-next-line no-console
console.log(
`Invalid default value for column ${bold(
- columnName
- )}. Defaults must be valid JSON when using the \`json()\` type.`
+ columnName,
+ )}. Defaults must be valid JSON when using the \`json()\` type.`,
);
process.exit(0);
}
diff --git a/packages/db/src/core/schemas.ts b/packages/db/src/core/schemas.ts
index a2a8368fb..c9575a79a 100644
--- a/packages/db/src/core/schemas.ts
+++ b/packages/db/src/core/schemas.ts
@@ -15,7 +15,7 @@ const sqlSchema = z.instanceof(SQL<any>).transform(
(sqlObj): SerializedSQL => ({
[SERIALIZED_SQL_KEY]: true,
sql: sqlite.sqlToQuery(sqlObj).sql,
- })
+ }),
);
const baseColumnSchema = z.object({
@@ -52,7 +52,7 @@ const numberColumnBaseSchema = baseColumnSchema.omit({ optional: true }).and(
optional: z.literal(false).optional(),
default: z.literal(undefined).optional(),
}),
- ])
+ ]),
);
export const numberColumnOptsSchema: z.ZodType<
@@ -71,7 +71,7 @@ export const numberColumnOptsSchema: z.ZodType<
.returns(z.lazy(() => numberColumnSchema))
.optional()
.transform((fn) => fn?.()),
- })
+ }),
);
export const numberColumnSchema = z.object({
@@ -99,7 +99,7 @@ const textColumnBaseSchema = baseColumnSchema
primaryKey: z.literal(true),
optional: z.literal(false).optional(),
}),
- ])
+ ]),
);
export const textColumnOptsSchema: z.ZodType<
@@ -118,7 +118,7 @@ export const textColumnOptsSchema: z.ZodType<
.returns(z.lazy(() => textColumnSchema))
.optional()
.transform((fn) => fn?.()),
- })
+ }),
);
export const textColumnSchema = z.object({
diff --git a/packages/db/src/core/utils.ts b/packages/db/src/core/utils.ts
index c1cf56579..6229cb070 100644
--- a/packages/db/src/core/utils.ts
+++ b/packages/db/src/core/utils.ts
@@ -31,9 +31,9 @@ export type Result<T> = { success: true; data: T } | { success: false; data: unk
*/
export function mapObject<T, U = T>(
item: Record<string, T>,
- callback: (key: string, value: T) => U
+ callback: (key: string, value: T) => U,
): Record<string, U> {
return Object.fromEntries(
- Object.entries(item).map(([key, value]) => [key, callback(key, value)])
+ Object.entries(item).map(([key, value]) => [key, callback(key, value)]),
);
}
diff --git a/packages/db/src/runtime/db-client.ts b/packages/db/src/runtime/db-client.ts
index a43bb4d78..55c1dd087 100644
--- a/packages/db/src/runtime/db-client.ts
+++ b/packages/db/src/runtime/db-client.ts
@@ -12,7 +12,7 @@ function applyTransactionNotSupported(db: SqliteRemoteDatabase) {
Object.assign(db, {
transaction() {
throw new Error(
- '`db.transaction()` is not currently supported. We recommend `db.batch()` for automatic error rollbacks across multiple queries.'
+ '`db.transaction()` is not currently supported. We recommend `db.batch()` for automatic error rollbacks across multiple queries.',
);
},
});
@@ -57,7 +57,7 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
},
async (response) => {
throw await parseRemoteError(response);
- }
+ },
);
let remoteResult: z.infer<typeof remoteResultSchema>;
@@ -118,7 +118,7 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
},
async (response) => {
throw await parseRemoteError(response);
- }
+ },
);
let remoteResults: z.infer<typeof remoteResultSchema>[];
@@ -154,7 +154,7 @@ export function createRemoteDatabaseClient(appToken: string, remoteDbURL: string
results.push({ rows: rowValues });
}
return results;
- }
+ },
);
applyTransactionNotSupported(db);
return db;
diff --git a/packages/db/src/runtime/errors.ts b/packages/db/src/runtime/errors.ts
index 297cbc232..e15044261 100644
--- a/packages/db/src/runtime/errors.ts
+++ b/packages/db/src/runtime/errors.ts
@@ -2,25 +2,25 @@ import { bold } from 'kleur/colors';
export const FOREIGN_KEY_DNE_ERROR = (tableName: string) => {
return `Table ${bold(
- tableName
+ tableName,
)} references a table that does not exist. Did you apply the referenced table to the \`tables\` object in your db config?`;
};
export const FOREIGN_KEY_REFERENCES_LENGTH_ERROR = (tableName: string) => {
return `Foreign key on ${bold(
- tableName
+ tableName,
)} is misconfigured. \`columns\` and \`references\` must be the same length.`;
};
export const FOREIGN_KEY_REFERENCES_EMPTY_ERROR = (tableName: string) => {
return `Foreign key on ${bold(
- tableName
+ tableName,
)} is misconfigured. \`references\` array cannot be empty.`;
};
export const REFERENCE_DNE_ERROR = (columnName: string) => {
return `Column ${bold(
- columnName
+ columnName,
)} references a table that does not exist. Did you apply the referenced table to the \`tables\` object in your db config?`;
};
diff --git a/packages/db/src/runtime/utils.ts b/packages/db/src/runtime/utils.ts
index 0c2e820e0..64301c39e 100644
--- a/packages/db/src/runtime/utils.ts
+++ b/packages/db/src/runtime/utils.ts
@@ -11,7 +11,7 @@ export async function safeFetch(
options: Parameters<typeof fetch>[1] = {},
onNotOK: (response: Response) => void | Promise<void> = () => {
throw new Error(`Request to ${url} returned a non-OK status code.`);
- }
+ },
): Promise<Response> {
const response = await fetch(url, options);
diff --git a/packages/db/test/test-utils.js b/packages/db/test/test-utils.js
index ea2e893a1..3ad5d3c14 100644
--- a/packages/db/test/test-utils.js
+++ b/packages/db/test/test-utils.js
@@ -78,7 +78,7 @@ function createRemoteDbServer() {
res.end(
JSON.stringify({
success: false,
- })
+ }),
);
return;
}
@@ -116,7 +116,7 @@ function createRemoteDbServer() {
code: e instanceof LibsqlError ? e.code : 'SQLITE_QUERY_FAILED',
details: e.message,
},
- })
+ }),
);
}
});
@@ -137,6 +137,6 @@ function applyParseError(res) {
// Use JSON response with `success: boolean` property
// to match remote error responses.
success: false,
- })
+ }),
);
}
diff --git a/packages/db/test/unit/column-queries.test.js b/packages/db/test/unit/column-queries.test.js
index bd59fd458..e4bb027a4 100644
--- a/packages/db/test/unit/column-queries.test.js
+++ b/packages/db/test/unit/column-queries.test.js
@@ -20,7 +20,7 @@ const userInitial = tableSchema.parse(
email: column.text({ unique: true }),
mi: column.text({ optional: true }),
},
- })
+ }),
);
function userChangeQueries(oldTable, newTable) {
diff --git a/packages/db/test/unit/reference-queries.test.js b/packages/db/test/unit/reference-queries.test.js
index 3a457192f..04f5f84aa 100644
--- a/packages/db/test/unit/reference-queries.test.js
+++ b/packages/db/test/unit/reference-queries.test.js
@@ -32,7 +32,7 @@ function resolveReferences(
{ User = BaseUser, SentBox = BaseSentBox } = {
User: BaseUser,
SentBox: BaseSentBox,
- }
+ },
) {
return tablesSchema.parse({ User, SentBox });
}
@@ -153,12 +153,12 @@ describe('reference queries', () => {
assert.notEqual(typeof updatedForeignKey.queries[0], 'undefined');
assert.deepEqual(
addedForeignKey.queries,
- expected(getTempTableName(addedForeignKey.queries[0]))
+ expected(getTempTableName(addedForeignKey.queries[0])),
);
assert.deepEqual(
updatedForeignKey.queries,
- expected(getTempTableName(updatedForeignKey.queries[0]))
+ expected(getTempTableName(updatedForeignKey.queries[0])),
);
});
});
diff --git a/packages/db/test/unit/reset-queries.test.js b/packages/db/test/unit/reset-queries.test.js
index 13da6ac91..9fb99f91e 100644
--- a/packages/db/test/unit/reset-queries.test.js
+++ b/packages/db/test/unit/reset-queries.test.js
@@ -17,7 +17,7 @@ const userInitial = tableSchema.parse(
email: column.text({ unique: true }),
mi: column.text({ optional: true }),
},
- })
+ }),
);
describe('force reset', () => {
diff --git a/packages/integrations/alpinejs/src/index.ts b/packages/integrations/alpinejs/src/index.ts
index 8bfdd95e5..86e09347e 100644
--- a/packages/integrations/alpinejs/src/index.ts
+++ b/packages/integrations/alpinejs/src/index.ts
@@ -72,7 +72,7 @@ export const setup = (Alpine) => {
${
!isBuild
? `console.warn("[@astrojs/alpinejs] entrypoint \`" + ${JSON.stringify(
- entrypoint
+ entrypoint,
)} + "\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/alpinejs/#entrypoint.");`
: ''
}
@@ -98,7 +98,7 @@ export default function createPlugin(options?: Options): AstroIntegration {
import { setup } from 'virtual:@astrojs/alpinejs/entrypoint';
setup(Alpine);
window.Alpine = Alpine;
-Alpine.start();`
+Alpine.start();`,
);
updateConfig({
vite: {
diff --git a/packages/integrations/alpinejs/test/test-utils.js b/packages/integrations/alpinejs/test/test-utils.js
index d7bf97cc6..38ae4bd5b 100644
--- a/packages/integrations/alpinejs/test/test-utils.js
+++ b/packages/integrations/alpinejs/test/test-utils.js
@@ -79,7 +79,7 @@ export async function waitForHydrate(page, el) {
const astroIslandId = await astroIsland.last().getAttribute('uid');
await page.waitForFunction(
(selector) => document.querySelector(selector)?.hasAttribute('ssr') === false,
- `astro-island[uid="${astroIslandId}"]`
+ `astro-island[uid="${astroIslandId}"]`,
);
}
diff --git a/packages/integrations/lit/client-shim.js b/packages/integrations/lit/client-shim.js
index 20096220d..c28ee5edf 100644
--- a/packages/integrations/lit/client-shim.js
+++ b/packages/integrations/lit/client-shim.js
@@ -8,7 +8,7 @@ async function polyfill() {
}
const polyfillCheckEl = Document.parseHTMLUnsafe(
- `<p><template shadowrootmode="open"></template></p>`
+ `<p><template shadowrootmode="open"></template></p>`,
).querySelector('p');
if (!polyfillCheckEl?.shadowRoot) {
diff --git a/packages/integrations/lit/client-shim.min.js b/packages/integrations/lit/client-shim.min.js
index 6cfe0a332..0ec44c3fa 100644
--- a/packages/integrations/lit/client-shim.min.js
+++ b/packages/integrations/lit/client-shim.min.js
@@ -80,6 +80,6 @@ async function g() {
window.addEventListener('DOMContentLoaded', () => t(document.body), { once: true });
}
var x = Document.parseHTMLUnsafe(
- '<p><template shadowrootmode="open"></template></p>'
+ '<p><template shadowrootmode="open"></template></p>',
).querySelector('p');
(!x || !x.shadowRoot) && g();
diff --git a/packages/integrations/lit/src/client.ts b/packages/integrations/lit/src/client.ts
index 37a1e561f..9a573d8ee 100644
--- a/packages/integrations/lit/src/client.ts
+++ b/packages/integrations/lit/src/client.ts
@@ -23,7 +23,7 @@ export default (element: HTMLElement) =>
async (
Component: any,
props: Record<string, any>,
- { default: defaultChildren, ...slotted }: { default: string; [slotName: string]: string }
+ { default: defaultChildren, ...slotted }: { default: string; [slotName: string]: string },
) => {
// Get the LitElement element instance.
let component = element.children[0];
diff --git a/packages/integrations/lit/src/index.ts b/packages/integrations/lit/src/index.ts
index 33aaf727d..94a6d683a 100644
--- a/packages/integrations/lit/src/index.ts
+++ b/packages/integrations/lit/src/index.ts
@@ -34,7 +34,7 @@ export default function (): AstroIntegration {
// Inject the necessary polyfills on every page (inlined for speed).
injectScript(
'head-inline',
- readFileSync(new URL('../client-shim.min.js', import.meta.url), { encoding: 'utf-8' })
+ readFileSync(new URL('../client-shim.min.js', import.meta.url), { encoding: 'utf-8' }),
);
// Inject the hydration code, before a component is hydrated.
injectScript('before-hydration', `import '@astrojs/lit/hydration-support.js';`);
diff --git a/packages/integrations/lit/test/server.test.js b/packages/integrations/lit/test/server.test.js
index b5f3cac9b..bcecef2f6 100644
--- a/packages/integrations/lit/test/server.test.js
+++ b/packages/integrations/lit/test/server.test.js
@@ -57,7 +57,7 @@ describe('renderToStaticMarkup', () => {
render() {
return html`<p>hola</p>`;
}
- }
+ },
);
const render = await renderToStaticMarkup(tagName);
const $ = cheerio.load(render.html);
@@ -83,7 +83,7 @@ describe('renderToStaticMarkup', () => {
render() {
return html`<p>Hello ${this.prop1}</p>`;
}
- }
+ },
);
const render = await renderToStaticMarkup(tagName, { prop1, attr1 });
const $ = cheerio.load(render.html);
@@ -100,7 +100,7 @@ describe('renderToStaticMarkup', () => {
render() {
return html`<p>child</p>`;
}
- }
+ },
);
customElements.define(
tagName,
@@ -108,7 +108,7 @@ describe('renderToStaticMarkup', () => {
render() {
return html`<child-component></child-component>`;
}
- }
+ },
);
const render = await renderToStaticMarkup(tagName);
const $ = cheerio.load(render.html);
@@ -124,7 +124,7 @@ describe('renderToStaticMarkup', () => {
tagName,
class extends LitElement {
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
- }
+ },
);
const render = await renderToStaticMarkup(tagName);
assert.deepEqual(render, {
diff --git a/packages/integrations/markdoc/components/TreeNode.ts b/packages/integrations/markdoc/components/TreeNode.ts
index abec17d7b..cbcf15329 100644
--- a/packages/integrations/markdoc/components/TreeNode.ts
+++ b/packages/integrations/markdoc/components/TreeNode.ts
@@ -42,7 +42,7 @@ export const ComponentNode = createComponent({
const slots = {
default: () =>
render`${treeNode.children.map((child) =>
- renderComponent(result, 'ComponentNode', ComponentNode, { treeNode: child })
+ renderComponent(result, 'ComponentNode', ComponentNode, { treeNode: child }),
)}`,
};
if (treeNode.type === 'component') {
@@ -55,7 +55,7 @@ export const ComponentNode = createComponent({
renderUniqueStylesheet(result, {
type: 'inline',
content: style,
- })
+ }),
)
.join('');
}
@@ -84,8 +84,8 @@ export const ComponentNode = createComponent({
treeNode.component.name,
treeNode.component,
treeNode.props,
- slots
- )}`
+ slots,
+ )}`,
);
// Let the runtime know that this component is being used.
diff --git a/packages/integrations/markdoc/src/content-entry-type.ts b/packages/integrations/markdoc/src/content-entry-type.ts
index bd19e1ccd..791def315 100644
--- a/packages/integrations/markdoc/src/content-entry-type.ts
+++ b/packages/integrations/markdoc/src/content-entry-type.ts
@@ -117,7 +117,7 @@ const nodeComponentMap = ${getStringifiedMap(componentConfigByNodeMap, 'Node')};
const options = ${JSON.stringify(options)};
const stringifiedAst = ${JSON.stringify(
- /* Double stringify to encode *as* stringified JSON */ JSON.stringify(ast)
+ /* Double stringify to encode *as* stringified JSON */ JSON.stringify(ast),
)};
export const getHeadings = createGetHeadings(stringifiedAst, markdocConfig, options);
@@ -133,7 +133,7 @@ export const Content = createContentComponent(
},
contentModuleTypes: await fs.promises.readFile(
new URL('../template/content-module-types.d.ts', import.meta.url),
- 'utf-8'
+ 'utf-8',
),
};
}
@@ -182,7 +182,7 @@ async function resolvePartials({
if (!partialId) {
const attemptResolveAsRelative = await pluginContext.resolve(
'./' + file,
- fileURLToPath(fileUrl)
+ fileURLToPath(fileUrl),
);
if (!attemptResolveAsRelative?.id) throw new Error();
partialId = attemptResolveAsRelative.id;
@@ -302,7 +302,7 @@ async function emitOptimizedImages(
pluginContext: Rollup.PluginContext;
filePath: string;
astroConfig: AstroConfig;
- }
+ },
) {
for (const node of nodeChildren) {
let isComponent = node.type === 'tag' && node.tag === 'image';
@@ -320,7 +320,7 @@ async function emitOptimizedImages(
const src = await emitESMImage(
resolved.id,
ctx.pluginContext.meta.watchMode,
- ctx.pluginContext.emitFile
+ ctx.pluginContext.emitFile,
);
const fsPath = resolved.id;
@@ -338,7 +338,7 @@ async function emitOptimizedImages(
} else {
throw new MarkdocError({
message: `Could not resolve image ${JSON.stringify(
- node.attributes.src
+ node.attributes.src,
)} from ${JSON.stringify(ctx.filePath)}. Does the file exist?`,
});
}
@@ -366,7 +366,7 @@ function shouldOptimizeImage(src: string) {
function getStringifiedImports(
componentConfigMap: Record<string, ComponentConfig>,
componentNamePrefix: string,
- root: URL
+ root: URL,
) {
let stringifiedComponentImports = '';
for (const [key, config] of Object.entries(componentConfigMap)) {
@@ -394,7 +394,7 @@ function toImportName(unsafeName: string) {
*/
function getStringifiedMap(
componentConfigMap: Record<string, ComponentConfig>,
- componentNamePrefix: string
+ componentNamePrefix: string,
) {
let stringifiedComponentMap = '{';
for (const key in componentConfigMap) {
diff --git a/packages/integrations/markdoc/src/extensions/prism.ts b/packages/integrations/markdoc/src/extensions/prism.ts
index 54f98f928..721564871 100644
--- a/packages/integrations/markdoc/src/extensions/prism.ts
+++ b/packages/integrations/markdoc/src/extensions/prism.ts
@@ -12,7 +12,7 @@ export default function prism(): AstroMarkdocConfig {
// Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML
return unescapeHTML(
- `<pre class="${classLanguage}"><code class="${classLanguage}">${html}</code></pre>`
+ `<pre class="${classLanguage}"><code class="${classLanguage}">${html}</code></pre>`,
) as any;
},
},
diff --git a/packages/integrations/markdoc/src/heading-ids.ts b/packages/integrations/markdoc/src/heading-ids.ts
index d0d14f2b1..9290a3db6 100644
--- a/packages/integrations/markdoc/src/heading-ids.ts
+++ b/packages/integrations/markdoc/src/heading-ids.ts
@@ -10,7 +10,7 @@ import { MarkdocError } from './utils.js';
function getSlug(
attributes: Record<string, any>,
children: RenderableTreeNode[],
- headingSlugger: Slugger
+ headingSlugger: Slugger,
): string {
if (attributes.id && typeof attributes.id === 'string') {
return attributes.id;
diff --git a/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts b/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts
index 2e445d35f..c35376641 100644
--- a/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts
+++ b/packages/integrations/markdoc/src/html/css/parse-inline-css-to-react.ts
@@ -1,7 +1,7 @@
import { styleToObject } from './style-to-object.js';
export function parseInlineCSSToReactLikeObject(
- css: string | undefined | null
+ css: string | undefined | null,
): React.CSSProperties | undefined {
if (typeof css === 'string') {
const cssObject: Record<string, string> = {};
diff --git a/packages/integrations/markdoc/src/html/transform/html-token-transform.ts b/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
index 10796cdc0..2c6a5d1e2 100644
--- a/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
+++ b/packages/integrations/markdoc/src/html/transform/html-token-transform.ts
@@ -125,7 +125,7 @@ export function htmlTokenTransform(tokenizer: Tokenizer, tokens: Token[]): Token
decodeEntities: false,
recognizeCDATA: true,
recognizeSelfClosing: true,
- }
+ },
);
// for every detected token...
diff --git a/packages/integrations/markdoc/src/index.ts b/packages/integrations/markdoc/src/index.ts
index 1696b36e8..dfc4ebe37 100644
--- a/packages/integrations/markdoc/src/index.ts
+++ b/packages/integrations/markdoc/src/index.ts
@@ -26,7 +26,7 @@ export default function markdocIntegration(options?: MarkdocIntegrationOptions):
markdocConfigResult = await loadMarkdocConfig(astroConfig);
addContentEntryType(
- await getContentEntryType({ markdocConfigResult, astroConfig, options })
+ await getContentEntryType({ markdocConfigResult, astroConfig, options }),
);
updateConfig({
diff --git a/packages/integrations/markdoc/src/load-config.ts b/packages/integrations/markdoc/src/load-config.ts
index 6ae6f5a15..ce181e604 100644
--- a/packages/integrations/markdoc/src/load-config.ts
+++ b/packages/integrations/markdoc/src/load-config.ts
@@ -18,7 +18,7 @@ export type MarkdocConfigResult = {
};
export async function loadMarkdocConfig(
- astroConfig: Pick<AstroConfig, 'root'>
+ astroConfig: Pick<AstroConfig, 'root'>,
): Promise<MarkdocConfigResult | undefined> {
let markdocConfigUrl: URL | undefined;
for (const filename of SUPPORTED_MARKDOC_CONFIG_FILES) {
diff --git a/packages/integrations/markdoc/src/runtime.ts b/packages/integrations/markdoc/src/runtime.ts
index 6a645e5d8..31ddf4c64 100644
--- a/packages/integrations/markdoc/src/runtime.ts
+++ b/packages/integrations/markdoc/src/runtime.ts
@@ -18,7 +18,7 @@ import type { MarkdocIntegrationOptions } from './options.js';
*/
export async function setupConfig(
userConfig: AstroMarkdocConfig = {},
- options: MarkdocIntegrationOptions | undefined
+ options: MarkdocIntegrationOptions | undefined,
): Promise<MergedConfig> {
let defaultConfig: AstroMarkdocConfig = setupHeadingConfig();
@@ -44,7 +44,7 @@ export async function setupConfig(
/** Used for synchronous `getHeadings()` function */
export function setupConfigSync(
userConfig: AstroMarkdocConfig = {},
- options: MarkdocIntegrationOptions | undefined
+ options: MarkdocIntegrationOptions | undefined,
): MergedConfig {
const defaultConfig: AstroMarkdocConfig = setupHeadingConfig();
@@ -62,7 +62,7 @@ type MergedConfig = Required<Omit<AstroMarkdocConfig, 'extends'>>;
/** Merge function from `@markdoc/markdoc` internals */
export function mergeConfig(
configA: AstroMarkdocConfig,
- configB: AstroMarkdocConfig
+ configB: AstroMarkdocConfig,
): MergedConfig {
return {
...configA,
@@ -101,7 +101,7 @@ export function mergeConfig(
export function resolveComponentImports(
markdocConfig: Required<Pick<AstroMarkdocConfig, 'tags' | 'nodes'>>,
tagComponentMap: Record<string, AstroInstance['default']>,
- nodeComponentMap: Record<NodeType, AstroInstance['default']>
+ nodeComponentMap: Record<NodeType, AstroInstance['default']>,
) {
for (const [tag, render] of Object.entries(tagComponentMap)) {
const config = markdocConfig.tags[tag];
@@ -137,7 +137,7 @@ const headingLevels = [1, 2, 3, 4, 5, 6] as const;
*/
export function collectHeadings(
children: RenderableTreeNode[],
- collectedHeadings: MarkdownHeading[]
+ collectedHeadings: MarkdownHeading[],
) {
for (const node of children) {
if (typeof node !== 'object' || !Markdoc.Tag.isTag(node)) continue;
@@ -167,7 +167,7 @@ export function collectHeadings(
export function createGetHeadings(
stringifiedAst: string,
userConfig: AstroMarkdocConfig,
- options: MarkdocIntegrationOptions | undefined
+ options: MarkdocIntegrationOptions | undefined,
) {
return function getHeadings() {
/* Yes, we are transforming twice (once from `getHeadings()` and again from <Content /> in case of variables).
@@ -188,7 +188,7 @@ export function createContentComponent(
userConfig: AstroMarkdocConfig,
options: MarkdocIntegrationOptions | undefined,
tagComponentMap: Record<string, AstroInstance['default']>,
- nodeComponentMap: Record<NodeType, AstroInstance['default']>
+ nodeComponentMap: Record<NodeType, AstroInstance['default']>,
) {
return createComponent({
async factory(result: any, props: Record<string, any>) {
@@ -196,7 +196,7 @@ export function createContentComponent(
const config = resolveComponentImports(
await setupConfig(withVariables, options),
tagComponentMap,
- nodeComponentMap
+ nodeComponentMap,
);
return renderComponent(result, Renderer.name, Renderer, { stringifiedAst, config }, {});
diff --git a/packages/integrations/markdoc/test/content-collections.test.js b/packages/integrations/markdoc/test/content-collections.test.js
index ef4ebfcea..5417f297d 100644
--- a/packages/integrations/markdoc/test/content-collections.test.js
+++ b/packages/integrations/markdoc/test/content-collections.test.js
@@ -47,7 +47,7 @@ describe('Markdoc - Content Collections', () => {
assert.deepEqual(
posts.sort().map((post) => formatPost(post)),
- [post1Entry, post2Entry, post3Entry]
+ [post1Entry, post2Entry, post3Entry],
);
});
});
@@ -69,7 +69,7 @@ describe('Markdoc - Content Collections', () => {
assert.notEqual(posts, null);
assert.deepEqual(
posts.sort().map((post) => formatPost(post)),
- [post1Entry, post2Entry, post3Entry]
+ [post1Entry, post2Entry, post3Entry],
);
});
});
diff --git a/packages/integrations/markdoc/test/image-assets.test.js b/packages/integrations/markdoc/test/image-assets.test.js
index 22534c607..0f98af4f1 100644
--- a/packages/integrations/markdoc/test/image-assets.test.js
+++ b/packages/integrations/markdoc/test/image-assets.test.js
@@ -38,7 +38,7 @@ describe('Markdoc - Image assets', () => {
const { document } = parseHTML(html);
assert.match(
document.querySelector('#relative > img')?.src,
- /\/_image\?href=.*%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&f=webp/
+ /\/_image\?href=.*%2Fsrc%2Fassets%2Frelative%2Foar.jpg%3ForigWidth%3D420%26origHeight%3D630%26origFormat%3Djpg&f=webp/,
);
});
@@ -48,7 +48,7 @@ describe('Markdoc - Image assets', () => {
const { document } = parseHTML(html);
assert.match(
document.querySelector('#alias > img')?.src,
- /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp/
+ /\/_image\?href=.*%2Fsrc%2Fassets%2Falias%2Fcityscape.jpg%3ForigWidth%3D420%26origHeight%3D280%26origFormat%3Djpg&f=webp/,
);
});
diff --git a/packages/integrations/markdoc/test/render-html.test.js b/packages/integrations/markdoc/test/render-html.test.js
index 320c5b509..6f877d1e5 100644
--- a/packages/integrations/markdoc/test/render-html.test.js
+++ b/packages/integrations/markdoc/test/render-html.test.js
@@ -250,7 +250,7 @@ function renderComponentsHTMLChecks(html) {
const aside1SectionP1 = aside1Section.querySelector('p:nth-of-type(1)');
assert.equal(
aside1SectionP1.textContent,
- "I'm a Markdown paragraph inside an top-level aside tag"
+ "I'm a Markdown paragraph inside an top-level aside tag",
);
const aside1H2_1 = aside1Section.querySelector('h2:nth-of-type(1)');
assert.equal(aside1H2_1.id, 'im-an-h2-via-markdown-markup'); // automatic slug
diff --git a/packages/integrations/markdoc/test/syntax-highlighting.test.js b/packages/integrations/markdoc/test/syntax-highlighting.test.js
index 7b2016808..f47b891f4 100644
--- a/packages/integrations/markdoc/test/syntax-highlighting.test.js
+++ b/packages/integrations/markdoc/test/syntax-highlighting.test.js
@@ -40,7 +40,7 @@ describe('Markdoc - syntax highlighting', () => {
ast,
await getConfigExtendingShiki({
theme: 'dracula',
- })
+ }),
);
assert.equal(content.children.length, 2);
for (const codeBlock of content.children) {
@@ -57,7 +57,7 @@ describe('Markdoc - syntax highlighting', () => {
ast,
await getConfigExtendingShiki({
wrap: true,
- })
+ }),
);
assert.equal(content.children.length, 2);
for (const codeBlock of content.children) {
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index 30f827dc8..de29003ff 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -68,7 +68,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
},
contentModuleTypes: await fs.readFile(
new URL('../template/content-module-types.d.ts', import.meta.url),
- 'utf-8'
+ 'utf-8',
),
// MDX can import scripts and styles,
// so wrap all MDX files with script / style propagation checks
@@ -91,7 +91,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
options: partialMdxOptions,
defaults: markdownConfigToMdxOptions(
extendMarkdownConfig ? config.markdown : markdownConfigDefaults,
- logger
+ logger,
),
});
@@ -113,7 +113,7 @@ const defaultMdxOptions = {
function markdownConfigToMdxOptions(
markdownConfig: typeof markdownConfigDefaults,
- logger: AstroIntegrationLogger
+ logger: AstroIntegrationLogger,
): MdxOptions {
return {
...defaultMdxOptions,
diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts
index 3978e5325..082e8f6fd 100644
--- a/packages/integrations/mdx/src/plugins.ts
+++ b/packages/integrations/mdx/src/plugins.ts
@@ -86,7 +86,7 @@ function getRehypePlugins(mdxOptions: MdxOptions): PluggableList {
// Render info from `vfile.data.astro.data.frontmatter` as JS
rehypeApplyFrontmatterExport,
// Analyze MDX nodes and attach to `vfile.data.__astroMetadata`
- rehypeAnalyzeAstroMetadata
+ rehypeAnalyzeAstroMetadata,
);
if (mdxOptions.optimize) {
diff --git a/packages/integrations/mdx/src/rehype-apply-frontmatter-export.ts b/packages/integrations/mdx/src/rehype-apply-frontmatter-export.ts
index 3a1098800..7fa7f69ef 100644
--- a/packages/integrations/mdx/src/rehype-apply-frontmatter-export.ts
+++ b/packages/integrations/mdx/src/rehype-apply-frontmatter-export.ts
@@ -10,7 +10,7 @@ export function rehypeApplyFrontmatterExport() {
throw new Error(
// Copied from Astro core `errors-data`
// TODO: find way to import error data from core
- '[MDX] A remark or rehype plugin attempted to inject invalid frontmatter. Ensure "astro.frontmatter" is set to a valid JSON object that is not `null` or `undefined`.'
+ '[MDX] A remark or rehype plugin attempted to inject invalid frontmatter. Ensure "astro.frontmatter" is set to a valid JSON object that is not `null` or `undefined`.',
);
const { frontmatter } = astroData;
const exportNodes = [
@@ -40,8 +40,8 @@ export function rehypeApplyFrontmatterExport() {
'server:root': true,
children,
});
- };`
- )
+ };`,
+ ),
);
}
tree.children = exportNodes.concat(tree.children);
diff --git a/packages/integrations/mdx/src/rehype-collect-headings.ts b/packages/integrations/mdx/src/rehype-collect-headings.ts
index 69e3f9b1b..fafc59721 100644
--- a/packages/integrations/mdx/src/rehype-collect-headings.ts
+++ b/packages/integrations/mdx/src/rehype-collect-headings.ts
@@ -5,7 +5,7 @@ export function rehypeInjectHeadingsExport() {
return function (tree: any, file: MarkdownVFile) {
const headings: MarkdownHeading[] = file.data.__astroHeadings || [];
tree.children.unshift(
- jsToTreeNode(`export function getHeadings() { return ${JSON.stringify(headings)} }`)
+ jsToTreeNode(`export function getHeadings() { return ${JSON.stringify(headings)} }`),
);
};
}
diff --git a/packages/integrations/mdx/src/rehype-images-to-component.ts b/packages/integrations/mdx/src/rehype-images-to-component.ts
index 6c797fda2..95b500784 100644
--- a/packages/integrations/mdx/src/rehype-images-to-component.ts
+++ b/packages/integrations/mdx/src/rehype-images-to-component.ts
@@ -157,7 +157,7 @@ export function rehypeImageToComponent() {
tree.children.unshift(...importsStatements);
tree.children.unshift(
- jsToTreeNode(`import { Image as ${ASTRO_IMAGE_IMPORT} } from "astro:assets";`)
+ jsToTreeNode(`import { Image as ${ASTRO_IMAGE_IMPORT} } from "astro:assets";`),
);
// Export `__usesAstroImage` to pick up `astro:assets` usage in the module graph.
// @see the '@astrojs/mdx-postprocess' plugin
diff --git a/packages/integrations/mdx/src/rehype-optimize-static.ts b/packages/integrations/mdx/src/rehype-optimize-static.ts
index ebedb753e..80c28ab9c 100644
--- a/packages/integrations/mdx/src/rehype-optimize-static.ts
+++ b/packages/integrations/mdx/src/rehype-optimize-static.ts
@@ -183,7 +183,7 @@ interface ElementGroup {
function findElementGroups(
allPossibleElements: Set<OptimizableNode>,
elementMetadatas: WeakMap<OptimizableNode, ElementMetadata>,
- isNodeNonStatic: (node: Node) => boolean
+ isNodeNonStatic: (node: Node) => boolean,
): ElementGroup[] {
const elementGroups: ElementGroup[] = [];
@@ -195,7 +195,7 @@ function findElementGroups(
const metadata = elementMetadatas.get(el);
if (!metadata) {
throw new Error(
- 'Internal MDX error: rehype-optimize-static should have metadata for element node'
+ 'Internal MDX error: rehype-optimize-static should have metadata for element node',
);
}
diff --git a/packages/integrations/mdx/src/utils.ts b/packages/integrations/mdx/src/utils.ts
index 4705316cc..ad98abb9e 100644
--- a/packages/integrations/mdx/src/utils.ts
+++ b/packages/integrations/mdx/src/utils.ts
@@ -18,7 +18,7 @@ export interface FileInfo {
/** @see 'vite-plugin-utils' for source */
export function getFileInfo(id: string, config: AstroConfig): FileInfo {
const sitePathname = appendForwardSlash(
- config.site ? new URL(config.base, config.site).pathname : config.base
+ config.site ? new URL(config.base, config.site).pathname : config.base,
);
// Try to grab the file's actual URL
@@ -69,7 +69,7 @@ export function jsToTreeNode(
acornOpts: AcornOpts = {
ecmaVersion: 'latest',
sourceType: 'module',
- }
+ },
): MdxjsEsm {
return {
type: 'mdxjsEsm',
@@ -101,7 +101,7 @@ export function ignoreStringPlugins(plugins: any[], logger: AstroIntegrationLogg
}
if (hasInvalidPlugin) {
logger.warn(
- `To inherit Markdown plugins in MDX, please use explicit imports in your config instead of "strings." See Markdown docs: https://docs.astro.build/en/guides/markdown-content/#markdown-plugins`
+ `To inherit Markdown plugins in MDX, please use explicit imports in your config instead of "strings." See Markdown docs: https://docs.astro.build/en/guides/markdown-content/#markdown-plugins`,
);
}
return validPlugins;
diff --git a/packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts b/packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts
index 7661c0ecf..e00173fbe 100644
--- a/packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts
+++ b/packages/integrations/mdx/src/vite-plugin-mdx-postprocess.ts
@@ -50,7 +50,7 @@ function injectUnderscoreFragmentImport(code: string, imports: readonly ImportSp
function injectMetadataExports(
code: string,
exports: readonly ExportSpecifier[],
- fileInfo: FileInfo
+ fileInfo: FileInfo,
) {
if (!exports.some(({ n }) => n === 'url')) {
code += `\nexport const url = ${JSON.stringify(fileInfo.fileUrl)};`;
@@ -101,7 +101,7 @@ function annotateContentExport(
code: string,
id: string,
ssr: boolean,
- imports: readonly ImportSpecifier[]
+ imports: readonly ImportSpecifier[],
) {
// Mark `Content` as MDX component
code += `\nContent[Symbol.for('mdx-component')] = true`;
@@ -117,7 +117,7 @@ function annotateContentExport(
code,
imports,
astroTagComponentImportRegex,
- 'astro/runtime/server/index.js'
+ 'astro/runtime/server/index.js',
)
) {
code += `\nimport { __astro_tag_component__ } from 'astro/runtime/server/index.js';`;
@@ -135,7 +135,7 @@ function isSpecifierImported(
code: string,
imports: readonly ImportSpecifier[],
specifierRegex: RegExp,
- source: string
+ source: string,
) {
for (const imp of imports) {
if (imp.n !== source) continue;
diff --git a/packages/integrations/mdx/src/vite-plugin-mdx.ts b/packages/integrations/mdx/src/vite-plugin-mdx.ts
index 1b966ecd2..b232d1c83 100644
--- a/packages/integrations/mdx/src/vite-plugin-mdx.ts
+++ b/packages/integrations/mdx/src/vite-plugin-mdx.ts
@@ -54,7 +54,7 @@ export function vitePluginMdx(mdxOptions: MdxOptions): Plugin {
// should be called in between those two lifecycle, so this error should never happen
if (!processor) {
return this.error(
- 'MDX processor is not initialized. This is an internal error. Please file an issue.'
+ 'MDX processor is not initialized. This is an internal error. Please file an issue.',
);
}
@@ -86,7 +86,7 @@ function getMdxMeta(vfile: VFile): Record<string, any> {
const astroMetadata = getAstroMetadata(vfile);
if (!astroMetadata) {
throw new Error(
- 'Internal MDX error: Astro metadata is not set by rehype-analyze-astro-metadata'
+ 'Internal MDX error: Astro metadata is not set by rehype-analyze-astro-metadata',
);
}
return {
diff --git a/packages/integrations/mdx/test/invalid-mdx-component.test.js b/packages/integrations/mdx/test/invalid-mdx-component.test.js
index 4e68fea64..b8152e89c 100644
--- a/packages/integrations/mdx/test/invalid-mdx-component.test.js
+++ b/packages/integrations/mdx/test/invalid-mdx-component.test.js
@@ -32,7 +32,7 @@ describe('MDX component with runtime error', () => {
assert.ok(error);
assert.match(
error?.hint,
- /This issue often occurs when your MDX component encounters runtime errors/
+ /This issue often occurs when your MDX component encounters runtime errors/,
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js b/packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js
index e29efa45b..07197e0e5 100644
--- a/packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js
+++ b/packages/integrations/mdx/test/mdx-astro-markdown-remarkRehype.test.js
@@ -25,7 +25,7 @@ describe('MDX with Astro Markdown remark-rehype config', () => {
assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
assert.equal(
document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
- 'Kembali ke konten'
+ 'Kembali ke konten',
);
});
@@ -54,7 +54,7 @@ describe('MDX with Astro Markdown remark-rehype config', () => {
assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
assert.equal(
document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
- 'Kembali ke konten'
+ 'Kembali ke konten',
);
});
@@ -83,7 +83,7 @@ describe('MDX with Astro Markdown remark-rehype config', () => {
assert.equal(document.querySelector('#footnote-label').textContent, 'Catatan kaki');
assert.equal(
document.querySelector('.data-footnote-backref').getAttribute('aria-label'),
- 'Back to reference 1'
+ 'Back to reference 1',
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-frontmatter-injection.test.js b/packages/integrations/mdx/test/mdx-frontmatter-injection.test.js
index 90ec45e4e..5c8b69d07 100644
--- a/packages/integrations/mdx/test/mdx-frontmatter-injection.test.js
+++ b/packages/integrations/mdx/test/mdx-frontmatter-injection.test.js
@@ -25,7 +25,7 @@ describe('MDX frontmatter injection', () => {
it('rehype supports custom vfile data - reading time', async () => {
const frontmatterByPage = JSON.parse(await fixture.readFile('/glob.json'));
const readingTimes = frontmatterByPage.map(
- (frontmatter = {}) => frontmatter.injectedReadingTime
+ (frontmatter = {}) => frontmatter.injectedReadingTime,
);
assert.equal(readingTimes.length > 0, true);
for (let readingTime of readingTimes) {
@@ -39,11 +39,11 @@ describe('MDX frontmatter injection', () => {
const descriptions = frontmatterByPage.map((frontmatter = {}) => frontmatter.description);
assert.equal(
descriptions.includes('Processed by remarkDescription plugin: Page 1 description'),
- true
+ true,
);
assert.equal(
descriptions.includes('Processed by remarkDescription plugin: Page 2 description'),
- true
+ true,
);
});
diff --git a/packages/integrations/mdx/test/mdx-frontmatter.test.js b/packages/integrations/mdx/test/mdx-frontmatter.test.js
index 3fcbf28e8..df36a2439 100644
--- a/packages/integrations/mdx/test/mdx-frontmatter.test.js
+++ b/packages/integrations/mdx/test/mdx-frontmatter.test.js
@@ -50,7 +50,7 @@ describe('MDX frontmatter', () => {
const { document } = parseHTML(html);
const headingSlugs = [...document.querySelectorAll('[data-headings] > li')].map(
- (el) => el.textContent
+ (el) => el.textContent,
);
assert.equal(headingSlugs.length > 0, true);
@@ -70,7 +70,7 @@ describe('MDX frontmatter', () => {
assert.equal(
frontmatterFile?.endsWith('with-headings.mdx'),
true,
- '"file" prop does not end with correct path or is undefined'
+ '"file" prop does not end with correct path or is undefined',
);
assert.equal(frontmatterUrl, '/with-headings');
assert.equal(file, frontmatterFile);
diff --git a/packages/integrations/mdx/test/mdx-get-headings.test.js b/packages/integrations/mdx/test/mdx-get-headings.test.js
index 29bb427cc..4de8b0a6e 100644
--- a/packages/integrations/mdx/test/mdx-get-headings.test.js
+++ b/packages/integrations/mdx/test/mdx-get-headings.test.js
@@ -43,7 +43,7 @@ describe('MDX getHeadings', () => {
{ depth: 3, slug: 'subsection-1', text: 'Subsection 1' },
{ depth: 3, slug: 'subsection-2', text: 'Subsection 2' },
{ depth: 2, slug: 'section-2', text: 'Section 2' },
- ])
+ ]),
);
});
@@ -59,7 +59,7 @@ describe('MDX getHeadings', () => {
},
{ depth: 2, slug: 'h2title', text: 'h2Title' },
{ depth: 3, slug: 'h3title', text: 'h3Title' },
- ])
+ ]),
);
});
});
@@ -100,7 +100,7 @@ describe('MDX heading IDs can be customized by user plugins', () => {
const headingIDs = document.querySelectorAll('h1,h2,h3').map((el) => el.id);
assert.equal(
JSON.stringify(headingIDs),
- JSON.stringify(Array.from({ length: headingIDs.length }, (_, idx) => String(idx)))
+ JSON.stringify(Array.from({ length: headingIDs.length }, (_, idx) => String(idx))),
);
});
@@ -114,7 +114,7 @@ describe('MDX heading IDs can be customized by user plugins', () => {
{ depth: 3, slug: '2', text: 'Subsection 1' },
{ depth: 3, slug: '3', text: 'Subsection 2' },
{ depth: 2, slug: '4', text: 'Section 2' },
- ])
+ ]),
);
});
});
@@ -194,7 +194,7 @@ describe('MDX headings with frontmatter', () => {
{ depth: 4, slug: 'item-2', text: 'Item 2' },
{ depth: 5, slug: 'nested-item-3', text: 'Nested Item 3' },
{ depth: 6, slug: 'frontmatterunknown', text: 'frontmatter.unknown' },
- ])
+ ]),
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-get-static-paths.test.js b/packages/integrations/mdx/test/mdx-get-static-paths.test.js
index 845676f8f..96f0dc9a4 100644
--- a/packages/integrations/mdx/test/mdx-get-static-paths.test.js
+++ b/packages/integrations/mdx/test/mdx-get-static-paths.test.js
@@ -28,7 +28,7 @@ describe('getStaticPaths', () => {
assert.equal(
$('#file').text().includes('fixtures/mdx-get-static-paths/src/content/1.mdx'),
true,
- 'file is included'
+ 'file is included',
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-math.test.js b/packages/integrations/mdx/test/mdx-math.test.js
index 908a88e11..5352eca68 100644
--- a/packages/integrations/mdx/test/mdx-math.test.js
+++ b/packages/integrations/mdx/test/mdx-math.test.js
@@ -32,7 +32,7 @@ describe('MDX math', () => {
assert.equal(
mjxStyle.includes('mjx-container[jax="SVG"]'),
true,
- 'style should not be html-escaped'
+ 'style should not be html-escaped',
);
});
@@ -66,7 +66,7 @@ describe('MDX math', () => {
assert.equal(
mjxStyle.includes('mjx-container[jax="CHTML"]'),
true,
- 'style should not be html-escaped'
+ 'style should not be html-escaped',
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-optimize.test.js b/packages/integrations/mdx/test/mdx-optimize.test.js
index f504a49c9..47acfdff8 100644
--- a/packages/integrations/mdx/test/mdx-optimize.test.js
+++ b/packages/integrations/mdx/test/mdx-optimize.test.js
@@ -21,7 +21,7 @@ describe('MDX optimize', () => {
assert.equal(document.querySelector('h1').textContent.includes('MDX page'), true);
assert.equal(
document.querySelector('p').textContent.includes('I once heard a very inspirational quote:'),
- true
+ true,
);
const blockquote = document.querySelector('blockquote.custom-blockquote');
@@ -40,7 +40,7 @@ describe('MDX optimize', () => {
assert.equal(document.querySelector('h1').textContent.includes('Astro page'), true);
assert.equal(
document.querySelector('p').textContent.includes('I once heard a very inspirational quote:'),
- true
+ true,
);
const blockquote = document.querySelector('blockquote.custom-blockquote');
diff --git a/packages/integrations/mdx/test/mdx-plugins.test.js b/packages/integrations/mdx/test/mdx-plugins.test.js
index 124ec52c1..68ce1e22e 100644
--- a/packages/integrations/mdx/test/mdx-plugins.test.js
+++ b/packages/integrations/mdx/test/mdx-plugins.test.js
@@ -167,9 +167,9 @@ describe('MDX plugins', () => {
assert.equal(
selectTocLink(
document,
- '`remarkToc` plugin applied unexpectedly. Should override Markdown config.'
+ '`remarkToc` plugin applied unexpectedly. Should override Markdown config.',
),
- null
+ null,
);
});
@@ -194,13 +194,13 @@ describe('MDX plugins', () => {
assert.equal(
quote.textContent.includes('"Smartypants" is -- awesome'),
true,
- 'Does not respect `markdown.smartypants` option.'
+ 'Does not respect `markdown.smartypants` option.',
);
} else {
assert.equal(
quote.textContent.includes('“Smartypants” is — awesome'),
true,
- 'Respects `markdown.smartypants` unexpectedly.'
+ 'Respects `markdown.smartypants` unexpectedly.',
);
}
});
diff --git a/packages/integrations/mdx/test/mdx-script-style-raw.test.js b/packages/integrations/mdx/test/mdx-script-style-raw.test.js
index 5b276f043..dc4f337bf 100644
--- a/packages/integrations/mdx/test/mdx-script-style-raw.test.js
+++ b/packages/integrations/mdx/test/mdx-script-style-raw.test.js
@@ -34,14 +34,14 @@ describe('MDX script style raw', () => {
assert.equal(
scriptContent.includes("console.log('raw script')"),
true,
- 'script should not be html-escaped'
+ 'script should not be html-escaped',
);
const styleContent = document.getElementById('test-style').innerHTML;
assert.equal(
styleContent.includes('h1[id="script-style-raw"]'),
true,
- 'style should not be html-escaped'
+ 'style should not be html-escaped',
);
});
});
@@ -61,14 +61,14 @@ describe('MDX script style raw', () => {
assert.equal(
scriptContent.includes("console.log('raw script')"),
true,
- 'script should not be html-escaped'
+ 'script should not be html-escaped',
);
const styleContent = document.getElementById('test-style').innerHTML;
assert.equal(
styleContent.includes('h1[id="script-style-raw"]'),
true,
- 'style should not be html-escaped'
+ 'style should not be html-escaped',
);
});
});
diff --git a/packages/integrations/mdx/test/mdx-vite-env-vars.test.js b/packages/integrations/mdx/test/mdx-vite-env-vars.test.js
index 4e32d12cb..80a9b1cec 100644
--- a/packages/integrations/mdx/test/mdx-vite-env-vars.test.js
+++ b/packages/integrations/mdx/test/mdx-vite-env-vars.test.js
@@ -32,7 +32,7 @@ describe('MDX - Vite env vars', () => {
document
.querySelector('[data-env-site]')
?.innerHTML.includes('https://mdx-is-neat.com/blog/cool-post'),
- true
+ true,
);
});
it('Transforms `import.meta.env` in variable exports', async () => {
@@ -41,13 +41,13 @@ describe('MDX - Vite env vars', () => {
assert.equal(
document.querySelector('[data-env-variable-exports]')?.innerHTML.includes('MODE works'),
- true
+ true,
);
assert.equal(
document
.querySelector('[data-env-variable-exports-unknown]')
?.innerHTML.includes('exports: ""'),
- true
+ true,
);
});
it('Transforms `import.meta.env` in HTML attributes', async () => {
diff --git a/packages/integrations/mdx/test/units/rehype-optimize-static.test.js b/packages/integrations/mdx/test/units/rehype-optimize-static.test.js
index 675bc3478..6121975a4 100644
--- a/packages/integrations/mdx/test/units/rehype-optimize-static.test.js
+++ b/packages/integrations/mdx/test/units/rehype-optimize-static.test.js
@@ -36,7 +36,7 @@ describe('rehype-optimize-static', () => {
`\
<_components.h1 {...{
"set:html": "hello"
-}} />`
+}} />`,
);
});
@@ -50,7 +50,7 @@ foo bar
jsx,
`\
<Fragment set:html="<h1>hello</h1>
-<p>foo bar</p>" />`
+<p>foo bar</p>" />`,
);
});
@@ -66,7 +66,7 @@ This is a <Comp />
jsx,
`\
<><Fragment set:html="<h1>hello</h1>
-" /><_components.p>{"This is a "}<Comp /></_components.p></>`
+" /><_components.p>{"This is a "}<Comp /></_components.p></>`,
);
});
@@ -83,7 +83,7 @@ foo <strong>bar</strong> baz
`\
<Fragment set:html="<h1>hello</h1>
<p>foo <strong>bar</strong> baz</p>
-<strong>qux</strong>" />`
+<strong>qux</strong>" />`,
);
});
});
diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md
index a53586087..174554168 100644
--- a/packages/integrations/node/CHANGELOG.md
+++ b/packages/integrations/node/CHANGELOG.md
@@ -724,7 +724,7 @@
{ darkMode: true },
{
expires: '1 month',
- }
+ },
);
const prefs = Astro.cookies.get<Prefs>('prefs').json();
diff --git a/packages/integrations/node/src/index.ts b/packages/integrations/node/src/index.ts
index eb3c98a9b..36d9ee30f 100644
--- a/packages/integrations/node/src/index.ts
+++ b/packages/integrations/node/src/index.ts
@@ -73,7 +73,7 @@ export default function createIntegration(userOptions: UserOptions): AstroIntegr
if (config.output === 'static') {
logger.warn(
- `\`output: "server"\` or \`output: "hybrid"\` is required to use this adapter.`
+ `\`output: "server"\` or \`output: "hybrid"\` is required to use this adapter.`,
);
}
},
diff --git a/packages/integrations/node/src/log-listening-on.ts b/packages/integrations/node/src/log-listening-on.ts
index 5986fc64e..7e299740c 100644
--- a/packages/integrations/node/src/log-listening-on.ts
+++ b/packages/integrations/node/src/log-listening-on.ts
@@ -8,20 +8,20 @@ import type { Options } from './types.js';
export async function logListeningOn(
logger: AstroIntegrationLogger,
server: http.Server | https.Server,
- options: Pick<Options, 'host'>
+ options: Pick<Options, 'host'>,
) {
await new Promise<void>((resolve) => server.once('listening', resolve));
const protocol = server instanceof https.Server ? 'https' : 'http';
// Allow to provide host value at runtime
const host = getResolvedHostForHttpServer(
- process.env.HOST !== undefined && process.env.HOST !== '' ? process.env.HOST : options.host
+ process.env.HOST !== undefined && process.env.HOST !== '' ? process.env.HOST : options.host,
);
const { port } = server.address() as AddressInfo;
const address = getNetworkAddress(protocol, host, port);
if (host === undefined) {
logger.info(
- `Server listening on \n local: ${address.local[0]} \t\n network: ${address.network[0]}\n`
+ `Server listening on \n local: ${address.local[0]} \t\n network: ${address.network[0]}\n`,
);
} else {
logger.info(`Server listening on ${address.local[0]}`);
@@ -52,7 +52,7 @@ export function getNetworkAddress(
protocol: 'http' | 'https' = 'http',
hostname: string | undefined,
port: number,
- base?: string
+ base?: string,
) {
const NetworkAddress: NetworkAddressOpt = {
local: [],
@@ -66,12 +66,12 @@ export function getNetworkAddress(
detail.address &&
(detail.family === 'IPv4' ||
// @ts-expect-error Node 18.0 - 18.3 returns number
- detail.family === 4)
+ detail.family === 4),
)
.forEach((detail) => {
let host = detail.address.replace(
'127.0.0.1',
- hostname === undefined || wildcardHosts.has(hostname) ? 'localhost' : hostname
+ hostname === undefined || wildcardHosts.has(hostname) ? 'localhost' : hostname,
);
// ipv6 host
if (host.includes(':')) {
diff --git a/packages/integrations/node/src/preview.ts b/packages/integrations/node/src/preview.ts
index 0e3f55ae6..518155c4a 100644
--- a/packages/integrations/node/src/preview.ts
+++ b/packages/integrations/node/src/preview.ts
@@ -19,15 +19,15 @@ const createPreviewServer: CreatePreviewServer = async function (preview) {
options = ssrModule.options!;
} else {
throw new AstroError(
- `The server entrypoint doesn't have a handler. Are you sure this is the right file?`
+ `The server entrypoint doesn't have a handler. Are you sure this is the right file?`,
);
}
} catch (err) {
if ((err as any).code === 'ERR_MODULE_NOT_FOUND') {
throw new AstroError(
`The server entrypoint ${fileURLToPath(
- preview.serverEntrypoint
- )} does not exist. Have you ran a build yet?`
+ preview.serverEntrypoint,
+ )} does not exist. Have you ran a build yet?`,
);
} else {
throw err;
diff --git a/packages/integrations/node/src/serve-app.ts b/packages/integrations/node/src/serve-app.ts
index 2934a01ab..72b4e0fd6 100644
--- a/packages/integrations/node/src/serve-app.ts
+++ b/packages/integrations/node/src/serve-app.ts
@@ -39,7 +39,7 @@ export function createAppHandler(app: NodeApp): RequestHandler {
addCookieHeader: true,
locals,
routeData,
- })
+ }),
);
await NodeApp.writeResponse(response, res);
} else if (next) {
diff --git a/packages/integrations/node/src/standalone.ts b/packages/integrations/node/src/standalone.ts
index 843055df3..817ca7020 100644
--- a/packages/integrations/node/src/standalone.ts
+++ b/packages/integrations/node/src/standalone.ts
@@ -59,7 +59,7 @@ export function createServer(listener: http.RequestListener, host: string, port:
key: fs.readFileSync(process.env.SERVER_KEY_PATH),
cert: fs.readFileSync(process.env.SERVER_CERT_PATH),
},
- listener
+ listener,
);
} else {
httpServer = http.createServer(listener);
diff --git a/packages/integrations/node/test/bad-urls.test.js b/packages/integrations/node/test/bad-urls.test.js
index cdc0158ff..9323516e8 100644
--- a/packages/integrations/node/test/bad-urls.test.js
+++ b/packages/integrations/node/test/bad-urls.test.js
@@ -39,7 +39,7 @@ describe('Bad URLs', () => {
assert.equal(
statusCodes.includes(fetchResult.status),
true,
- `${weirdUrl} returned something else than 400, 404, or 500`
+ `${weirdUrl} returned something else than 400, 404, or 500`,
);
}
const stillWork = await fixture.fetch('/');
diff --git a/packages/integrations/node/test/errors.test.js b/packages/integrations/node/test/errors.test.js
index 365eaff6b..d75155aa5 100644
--- a/packages/integrations/node/test/errors.test.js
+++ b/packages/integrations/node/test/errors.test.js
@@ -56,7 +56,7 @@ describe('Errors', () => {
const $ = cheerio.load(html);
assert.equal($('p').text().trim(), 'Internal server error');
- }
+ },
);
it(
@@ -84,6 +84,6 @@ describe('Errors', () => {
} else {
throw new Error('The response should take at most 2 chunks.');
}
- }
+ },
);
});
diff --git a/packages/integrations/node/test/image.test.js b/packages/integrations/node/test/image.test.js
index c4758f96b..5303fe37e 100644
--- a/packages/integrations/node/test/image.test.js
+++ b/packages/integrations/node/test/image.test.js
@@ -28,7 +28,7 @@ describe.skip('Image endpoint', () => {
assert.equal(res.status, 200);
const resImage = await fixture.fetch(
- '/_image?href=/_astro/some_penguin.97ef5f92.png&w=50&f=webp'
+ '/_image?href=/_astro/some_penguin.97ef5f92.png&w=50&f=webp',
);
assert.equal(resImage.status, 200);
diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts
index 34c936d96..bf8a6db1c 100644
--- a/packages/integrations/partytown/src/index.ts
+++ b/packages/integrations/partytown/src/index.ts
@@ -44,7 +44,7 @@ export default function createPlugin(options?: PartytownOptions): AstroIntegrati
dev: true,
etag: true,
extensions: [],
- })
+ }),
);
},
'astro:build:done': async ({ dir }) => {
diff --git a/packages/integrations/preact/src/client.ts b/packages/integrations/preact/src/client.ts
index 050a86f8a..3fb36d22a 100644
--- a/packages/integrations/preact/src/client.ts
+++ b/packages/integrations/preact/src/client.ts
@@ -9,7 +9,7 @@ export default (element: HTMLElement) =>
Component: any,
props: Record<string, any>,
{ default: children, ...slotted }: Record<string, any>,
- { client }: Record<string, string>
+ { client }: Record<string, string>,
) => {
if (!element.hasAttribute('ssr')) return;
for (const [key, value] of Object.entries(slotted)) {
@@ -32,7 +32,7 @@ export default (element: HTMLElement) =>
bootstrap(
h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
- element
+ element,
);
// Preact has no "unmount" option, but you can use `render(null, element)`
diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts
index aab4f9925..4f999103c 100644
--- a/packages/integrations/preact/src/index.ts
+++ b/packages/integrations/preact/src/index.ts
@@ -49,7 +49,7 @@ export default function ({ include, exclude, compat, devtools }: Options = {}):
viteConfig.optimizeDeps!.include!.push(
'preact/compat',
'preact/test-utils',
- 'preact/compat/jsx-runtime'
+ 'preact/compat/jsx-runtime',
);
viteConfig.resolve = {
dedupe: ['preact/compat', 'preact'],
diff --git a/packages/integrations/preact/src/server.ts b/packages/integrations/preact/src/server.ts
index 15e88412d..932cacb99 100644
--- a/packages/integrations/preact/src/server.ts
+++ b/packages/integrations/preact/src/server.ts
@@ -15,7 +15,7 @@ async function check(
this: RendererContext,
Component: any,
props: Record<string, any>,
- children: any
+ children: any,
) {
if (typeof Component !== 'function') return false;
if (Component.name === 'QwikComponent') return false;
@@ -55,7 +55,7 @@ async function renderToStaticMarkup(
Component: any,
props: Record<string, any>,
{ default: children, ...slotted }: Record<string, any>,
- metadata: AstroComponentMetadata | undefined
+ metadata: AstroComponentMetadata | undefined,
) {
const ctx = getContext(this.result);
@@ -85,7 +85,7 @@ async function renderToStaticMarkup(
hydrate: shouldHydrate(metadata),
value: children,
})
- : children
+ : children,
);
const html = await renderToStringAsync(vNode);
diff --git a/packages/integrations/preact/src/signals.ts b/packages/integrations/preact/src/signals.ts
index ef3a4b70a..ea022b422 100644
--- a/packages/integrations/preact/src/signals.ts
+++ b/packages/integrations/preact/src/signals.ts
@@ -25,7 +25,7 @@ export function serializeSignals(
ctx: Context,
props: Record<string, any>,
attrs: AstroPreactAttrs,
- map: PropNameToSignalMap
+ map: PropNameToSignalMap,
) {
// Check for signals
const signals: Record<string, string> = {};
diff --git a/packages/integrations/react/CHANGELOG.md b/packages/integrations/react/CHANGELOG.md
index b8aa870f5..5a3fdbcbc 100644
--- a/packages/integrations/react/CHANGELOG.md
+++ b/packages/integrations/react/CHANGELOG.md
@@ -154,7 +154,7 @@
export function Like({ postId }: { postId: string }) {
const [state, action, pending] = useActionState(
experimental_withState(actions.like),
- 0 // initial likes
+ 0, // initial likes
);
return (
diff --git a/packages/integrations/react/client-v17.js b/packages/integrations/react/client-v17.js
index 565c688d4..bd17050ea 100644
--- a/packages/integrations/react/client-v17.js
+++ b/packages/integrations/react/client-v17.js
@@ -10,7 +10,7 @@ export default (element) =>
const componentEl = createElement(
Component,
props,
- children != null ? createElement(StaticHtml, { value: children }) : children
+ children != null ? createElement(StaticHtml, { value: children }) : children,
);
const isHydrate = client !== 'only';
diff --git a/packages/integrations/react/client.js b/packages/integrations/react/client.js
index 13515df40..044eaf26f 100644
--- a/packages/integrations/react/client.js
+++ b/packages/integrations/react/client.js
@@ -33,7 +33,7 @@ function createReactElementFromDOMElement(element) {
return undefined;
}
})
- .filter((a) => !!a)
+ .filter((a) => !!a),
);
}
@@ -88,7 +88,7 @@ export default (element) =>
const componentEl = createElement(
Component,
props,
- getChildren(children, element.hasAttribute('data-react-children'))
+ getChildren(children, element.hasAttribute('data-react-children')),
);
const rootKey = isAlreadyHydrated(element);
// HACK: delete internal react marker for nested components to suppress aggressive warnings
diff --git a/packages/integrations/react/server.js b/packages/integrations/react/server.js
index 16bf6785e..3907ba6f1 100644
--- a/packages/integrations/react/server.js
+++ b/packages/integrations/react/server.js
@@ -174,7 +174,7 @@ async function renderToPipeableStreamAsync(vnode, options) {
destroy() {
resolve(html);
},
- })
+ }),
);
},
});
diff --git a/packages/integrations/react/src/actions.ts b/packages/integrations/react/src/actions.ts
index bc45e28ee..a5ccb2f9a 100644
--- a/packages/integrations/react/src/actions.ts
+++ b/packages/integrations/react/src/actions.ts
@@ -51,7 +51,7 @@ export async function experimental_getActionState<T>({
if (!contentType || !isFormRequest(contentType)) {
throw new AstroError(
'`getActionState()` must be called with a form request.',
- "Ensure your action uses the `accept: 'form'` option."
+ "Ensure your action uses the `accept: 'form'` option.",
);
}
const formData = await request.clone().formData();
@@ -59,7 +59,7 @@ export async function experimental_getActionState<T>({
if (!state) {
throw new AstroError(
'`getActionState()` could not find a state object.',
- 'Ensure your action was passed to `useActionState()` with the `experimental_withState()` wrapper.'
+ 'Ensure your action was passed to `useActionState()` with the `experimental_withState()` wrapper.',
);
}
return JSON.parse(state) as T;
diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts
index f8a9c4ab2..49cb0e6f7 100644
--- a/packages/integrations/react/src/index.ts
+++ b/packages/integrations/react/src/index.ts
@@ -50,7 +50,7 @@ function optionsPlugin(experimentalReactChildren: boolean): vite.Plugin {
function getViteConfiguration(
{ include, exclude, babel, experimentalReactChildren }: ReactIntegrationOptions = {},
- reactConfig: ReactVersionConfig
+ reactConfig: ReactVersionConfig,
) {
return {
optimizeDeps: {
@@ -101,7 +101,7 @@ export default function ({
updateConfig({
vite: getViteConfiguration(
{ include, exclude, babel, experimentalReactChildren },
- versionConfig
+ versionConfig,
),
});
if (command === 'dev') {
diff --git a/packages/integrations/react/test/react-component.test.js b/packages/integrations/react/test/react-component.test.js
index 44dbb138f..25a35f49d 100644
--- a/packages/integrations/react/test/react-component.test.js
+++ b/packages/integrations/react/test/react-component.test.js
@@ -54,7 +54,7 @@ describe('React Components', () => {
assert.equal(islandsWithChildren.length, 2);
assert.equal(
$(islandsWithChildren[0]).html(),
- $(islandsWithChildren[1]).find('astro-slot').html()
+ $(islandsWithChildren[1]).find('astro-slot').html(),
);
// test 11: Should generate unique React.useId per island
@@ -150,8 +150,8 @@ describe('React Components', () => {
`[/window]
The window object is not available during server-side rendering (SSR).
Try using \`import.meta.env.SSR\` to write SSR-friendly code.
- https://docs.astro.build/reference/api-reference/#importmeta`
- )
+ https://docs.astro.build/reference/api-reference/#importmeta`,
+ ),
);
});
diff --git a/packages/integrations/sitemap/src/generate-sitemap.ts b/packages/integrations/sitemap/src/generate-sitemap.ts
index abd5d2c6f..0fb096cc9 100644
--- a/packages/integrations/sitemap/src/generate-sitemap.ts
+++ b/packages/integrations/sitemap/src/generate-sitemap.ts
@@ -35,7 +35,7 @@ function createGetI18nLinks(
urls: string[],
defaultLocale: string,
locales: Record<string, string>,
- finalSiteUrl: string
+ finalSiteUrl: string,
): GetI18nLinks {
// `parsedI18nUrls` will have the same length as `urls`, matching correspondingly
const parsedI18nUrls = urls.map((url) => parseI18nUrl(url, defaultLocale, locales, finalSiteUrl));
diff --git a/packages/integrations/sitemap/src/index.ts b/packages/integrations/sitemap/src/index.ts
index 98aa4f31c..057fc2371 100644
--- a/packages/integrations/sitemap/src/index.ts
+++ b/packages/integrations/sitemap/src/index.ts
@@ -51,7 +51,7 @@ const isStatusCodePage = (locales: string[]) => {
const statusPathNames = new Set(
locales
.flatMap((locale) => [...STATUS_CODE_PAGES].map((page) => `${locale}/${page}`))
- .concat([...STATUS_CODE_PAGES])
+ .concat([...STATUS_CODE_PAGES]),
);
return (pathname: string): boolean => {
@@ -79,7 +79,7 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => {
try {
if (!config.site) {
logger.warn(
- 'The Sitemap integration requires the `site` astro.config option. Skipping.'
+ 'The Sitemap integration requires the `site` astro.config option. Skipping.',
);
return;
}
@@ -176,7 +176,7 @@ const createPlugin = (options?: SitemapOptions): AstroIntegration => {
sourceData: urlData,
limit: entryLimit,
},
- config
+ config,
);
logger.info(`\`${OUTFILE}\` created at \`${path.relative(process.cwd(), destDir)}\``);
} catch (err) {
diff --git a/packages/integrations/sitemap/src/schema.ts b/packages/integrations/sitemap/src/schema.ts
index a7682e881..17ca41b41 100644
--- a/packages/integrations/sitemap/src/schema.ts
+++ b/packages/integrations/sitemap/src/schema.ts
@@ -20,7 +20,7 @@ export const SitemapOptionsSchema = z
.min(2)
.regex(/^[a-zA-Z\-]+$/gm, {
message: 'Only English alphabet symbols and hyphen allowed',
- })
+ }),
),
})
.refine((val) => !val || val.locales[val.defaultLocale], {
diff --git a/packages/integrations/sitemap/src/utils/parse-i18n-url.ts b/packages/integrations/sitemap/src/utils/parse-i18n-url.ts
index 5b7ebf785..86221ca9d 100644
--- a/packages/integrations/sitemap/src/utils/parse-i18n-url.ts
+++ b/packages/integrations/sitemap/src/utils/parse-i18n-url.ts
@@ -8,7 +8,7 @@ export function parseI18nUrl(
url: string,
defaultLocale: string,
locales: Record<string, string>,
- base: string
+ base: string,
): ParsedI18nUrl | undefined {
if (!url.startsWith(base)) {
return undefined;
diff --git a/packages/integrations/sitemap/src/write-sitemap.ts b/packages/integrations/sitemap/src/write-sitemap.ts
index 9993d7790..8c86ae166 100644
--- a/packages/integrations/sitemap/src/write-sitemap.ts
+++ b/packages/integrations/sitemap/src/write-sitemap.ts
@@ -29,7 +29,7 @@ export async function writeSitemap(
limit = 50000,
publicBasePath = './',
}: WriteSitemapConfig,
- astroConfig: AstroConfig
+ astroConfig: AstroConfig,
) {
await mkdir(destinationDir, { recursive: true });
diff --git a/packages/integrations/sitemap/test/base-path.test.js b/packages/integrations/sitemap/test/base-path.test.js
index df3cadcc4..fee031ff4 100644
--- a/packages/integrations/sitemap/test/base-path.test.js
+++ b/packages/integrations/sitemap/test/base-path.test.js
@@ -23,7 +23,7 @@ describe('URLs with base path', () => {
assert.equal(sitemapZero.urlset.url[0].loc[0], 'http://example.com/base/one/');
assert.equal(
sitemapIndex.sitemapindex.sitemap[0].loc[0],
- 'http://example.com/base/sitemap-0.xml'
+ 'http://example.com/base/sitemap-0.xml',
);
});
});
@@ -45,7 +45,7 @@ describe('URLs with base path', () => {
assert.equal(sitemapZero.urlset.url[0].loc[0], 'http://example.com/base/123/');
assert.equal(
sitemapIndex.sitemapindex.sitemap[0].loc[0],
- 'http://example.com/base/sitemap-0.xml'
+ 'http://example.com/base/sitemap-0.xml',
);
});
});
diff --git a/packages/integrations/sitemap/test/units/generate-sitemap.test.js b/packages/integrations/sitemap/test/units/generate-sitemap.test.js
index 2af0e42ab..fbf4e7858 100644
--- a/packages/integrations/sitemap/test/units/generate-sitemap.test.js
+++ b/packages/integrations/sitemap/test/units/generate-sitemap.test.js
@@ -14,7 +14,7 @@ describe('generateSitemap', () => {
`${site}/b`,
`${site}/c`,
],
- site
+ site,
);
assert.equal(items.length, 3);
assert.equal(items[0].url, `${site}/a`);
@@ -30,7 +30,7 @@ describe('generateSitemap', () => {
`${site}/a`,
`${site}/b`,
],
- site
+ site,
);
assert.equal(items.length, 3);
assert.equal(items[0].url, `${site}/a`);
@@ -52,7 +52,7 @@ describe('generateSitemap', () => {
changefreq: 'monthly',
lastmod: now,
priority: 0.5,
- }
+ },
);
assert.equal(items.length, 3);
@@ -99,7 +99,7 @@ describe('generateSitemap', () => {
fr: 'fr-CA',
},
},
- }
+ },
);
assert.equal(items.length, 8);
diff --git a/packages/integrations/solid/src/client.ts b/packages/integrations/solid/src/client.ts
index 0455bff2a..a47c5310d 100644
--- a/packages/integrations/solid/src/client.ts
+++ b/packages/integrations/solid/src/client.ts
@@ -55,7 +55,7 @@ export default (element: HTMLElement) =>
element,
{
renderId,
- }
+ },
);
element.addEventListener('astro:unmount', () => dispose(), { once: true });
diff --git a/packages/integrations/solid/src/index.ts b/packages/integrations/solid/src/index.ts
index 1bbfa741f..001f3d6ab 100644
--- a/packages/integrations/solid/src/index.ts
+++ b/packages/integrations/solid/src/index.ts
@@ -39,7 +39,7 @@ async function getDevtoolsPlugin(logger: AstroIntegrationLogger, retrieve: boole
return (await import('solid-devtools/vite')).default as DevtoolsPlugin;
} catch (_) {
logger.warn(
- 'Solid Devtools requires `solid-devtools` as a peer dependency, add it to your project.'
+ 'Solid Devtools requires `solid-devtools` as a peer dependency, add it to your project.',
);
return null;
}
@@ -48,7 +48,7 @@ async function getDevtoolsPlugin(logger: AstroIntegrationLogger, retrieve: boole
async function getViteConfiguration(
isDev: boolean,
{ include, exclude }: Options,
- devtoolsPlugin: DevtoolsPlugin | null
+ devtoolsPlugin: DevtoolsPlugin | null,
) {
// https://github.com/solidjs/vite-plugin-solid
// We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode
@@ -123,7 +123,7 @@ export default function (options: Options = {}): AstroIntegration {
}) => {
const devtoolsPlugin = await getDevtoolsPlugin(
logger,
- !!options.devtools && command === 'dev'
+ !!options.devtools && command === 'dev',
);
addRenderer(getRenderer());
diff --git a/packages/integrations/solid/src/server.ts b/packages/integrations/solid/src/server.ts
index a58d7e17d..a352dfa5a 100644
--- a/packages/integrations/solid/src/server.ts
+++ b/packages/integrations/solid/src/server.ts
@@ -19,7 +19,7 @@ async function check(
this: RendererContext,
Component: any,
props: Record<string, any>,
- children: any
+ children: any,
) {
if (typeof Component !== 'function') return false;
if (Component.name === 'QwikComponent') return false;
@@ -44,7 +44,7 @@ async function renderToStaticMarkup(
Component: any,
props: Record<string, any>,
{ default: children, ...slotted }: any,
- metadata?: undefined | Record<string, any>
+ metadata?: undefined | Record<string, any>,
) {
const ctx = getContext(this.result);
const renderId = metadata?.hydrate ? incrementId(ctx) : '';
diff --git a/packages/integrations/svelte/client.js b/packages/integrations/svelte/client.js
index 056fd19c7..005bbe9da 100644
--- a/packages/integrations/svelte/client.js
+++ b/packages/integrations/svelte/client.js
@@ -41,7 +41,7 @@ function createSlotDefinition(key, children) {
parent = target;
target.insertAdjacentHTML(
'beforeend',
- `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${children}</astro-slot>`
+ `<astro-slot${key === 'default' ? '' : ` name="${key}"`}>${children}</astro-slot>`,
);
},
// create
@@ -52,7 +52,7 @@ function createSlotDefinition(key, children) {
d() {
if (!parent) return;
const slot = parent.querySelector(
- `astro-slot${key === 'default' ? ':not([name])' : `[name="${key}"]`}`
+ `astro-slot${key === 'default' ? ':not([name])' : `[name="${key}"]`}`,
);
if (slot) slot.remove();
},
diff --git a/packages/integrations/svelte/src/editor.cts b/packages/integrations/svelte/src/editor.cts
index b61c0e74d..42a72913d 100644
--- a/packages/integrations/svelte/src/editor.cts
+++ b/packages/integrations/svelte/src/editor.cts
@@ -11,7 +11,7 @@ export function toTSX(code: string, className: string): string {
tsx = '/// <reference types="svelte2tsx/svelte-shims" />\n' + tsx;
result = tsx.replace(
'export default class extends __sveltets_2_createSvelte2TsxComponent(',
- `export default function ${className}__AstroComponent_(_props: typeof Component.props): any {}\nlet Component = `
+ `export default function ${className}__AstroComponent_(_props: typeof Component.props): any {}\nlet Component = `,
);
} catch {
return result;
diff --git a/packages/integrations/tailwind/src/index.ts b/packages/integrations/tailwind/src/index.ts
index c52e1f6e5..45f72ca32 100644
--- a/packages/integrations/tailwind/src/index.ts
+++ b/packages/integrations/tailwind/src/index.ts
@@ -6,7 +6,7 @@ import type { CSSOptions, UserConfig } from 'vite';
async function getPostCssConfig(
root: UserConfig['root'],
- postcssInlineOptions: CSSOptions['postcss']
+ postcssInlineOptions: CSSOptions['postcss'],
) {
let postcssConfigResult;
// Check if postcss config is not inlined
@@ -26,7 +26,7 @@ async function getViteConfiguration(
tailwindConfigPath: string | undefined,
nesting: boolean,
root: string,
- postcssInlineOptions: CSSOptions['postcss']
+ postcssInlineOptions: CSSOptions['postcss'],
): Promise<Partial<UserConfig>> {
// We need to manually load postcss config files because when inlining the tailwind and autoprefixer plugins,
// that causes vite to ignore postcss config files
@@ -89,7 +89,7 @@ export default function tailwindIntegration(options?: TailwindOptions): AstroInt
customConfigPath,
nesting,
fileURLToPath(config.root),
- config.vite.css?.postcss
+ config.vite.css?.postcss,
),
});
diff --git a/packages/integrations/tailwind/test/basic.test.js b/packages/integrations/tailwind/test/basic.test.js
index 9921202aa..5cac5c949 100644
--- a/packages/integrations/tailwind/test/basic.test.js
+++ b/packages/integrations/tailwind/test/basic.test.js
@@ -30,7 +30,7 @@ describe('Basic', () => {
assert.equal(css.includes('text-red-500'), true); // class css
assert.equal(
new RegExp(/\.a\[data-astro-cid-.*?\] \.b\[data-astro-cid-.*?\]/).test(css),
- true
+ true,
); // nesting
});
});
diff --git a/packages/integrations/vercel/CHANGELOG.md b/packages/integrations/vercel/CHANGELOG.md
index 5306ab652..2fda03d95 100644
--- a/packages/integrations/vercel/CHANGELOG.md
+++ b/packages/integrations/vercel/CHANGELOG.md
@@ -1207,7 +1207,7 @@
{ darkMode: true },
{
expires: '1 month',
- }
+ },
);
const prefs = Astro.cookies.get<Prefs>('prefs').json();
diff --git a/packages/integrations/vercel/src/image/shared.ts b/packages/integrations/vercel/src/image/shared.ts
index f15d81516..da9342f29 100644
--- a/packages/integrations/vercel/src/image/shared.ts
+++ b/packages/integrations/vercel/src/image/shared.ts
@@ -68,7 +68,7 @@ export function getAstroImageConfig(
imagesConfig: VercelImageConfig | undefined,
command: string,
devImageService: DevImageService,
- astroImageConfig: AstroConfig['image']
+ astroImageConfig: AstroConfig['image'],
) {
let devService = '@astrojs/vercel/dev-image-service';
@@ -105,7 +105,7 @@ export function getAstroImageConfig(
export function sharedValidateOptions(
options: ImageTransform,
serviceConfig: Record<string, any>,
- mode: 'development' | 'production'
+ mode: 'development' | 'production',
) {
const vercelImageOptions = serviceConfig as VercelImageConfig;
diff --git a/packages/integrations/vercel/src/lib/nft.ts b/packages/integrations/vercel/src/lib/nft.ts
index 51abe1211..7f21f3f27 100644
--- a/packages/integrations/vercel/src/lib/nft.ts
+++ b/packages/integrations/vercel/src/lib/nft.ts
@@ -18,7 +18,7 @@ export async function copyDependenciesToFunction(
logger: AstroIntegrationLogger;
},
// we want to pass the caching by reference, and not by value
- cache: object
+ cache: object,
): Promise<{ handler: string }> {
const entryPath = fileURLToPath(entry);
logger.info(`Bundling function ${relativePath(fileURLToPath(outDir), entryPath)}`);
@@ -54,11 +54,11 @@ export async function copyDependenciesToFunction(
if (entryPath === file) {
logger.debug(
- `[@astrojs/vercel] The module "${module}" couldn't be resolved. This may not be a problem, but it's worth checking.`
+ `[@astrojs/vercel] The module "${module}" couldn't be resolved. This may not be a problem, but it's worth checking.`,
);
} else {
logger.debug(
- `[@astrojs/vercel] The module "${module}" inside the file "${file}" couldn't be resolved. This may not be a problem, but it's worth checking.`
+ `[@astrojs/vercel] The module "${module}" inside the file "${file}" couldn't be resolved. This may not be a problem, but it's worth checking.`,
);
}
}
@@ -75,7 +75,7 @@ export async function copyDependenciesToFunction(
const commonAncestor = await copyFilesToFolder(
[...result.fileList].map((file) => new URL(file, base)).concat(includeFiles),
outDir,
- excludeFiles
+ excludeFiles,
);
return {
diff --git a/packages/integrations/vercel/src/serverless/adapter.ts b/packages/integrations/vercel/src/serverless/adapter.ts
index e4ab5ac88..8cddc0be1 100644
--- a/packages/integrations/vercel/src/serverless/adapter.ts
+++ b/packages/integrations/vercel/src/serverless/adapter.ts
@@ -214,10 +214,10 @@ export default function vercelServerless({
'astro:config:setup': async ({ command, config, updateConfig, injectScript, logger }) => {
if (maxDuration && maxDuration > 900) {
logger.warn(
- `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`
+ `maxDuration is set to ${maxDuration} seconds, which is longer than the maximum allowed duration of 900 seconds.`,
);
logger.warn(
- `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`
+ `Please make sure that your plan allows for this duration. See https://vercel.com/docs/functions/serverless-functions/runtimes#maxduration for more information.`,
);
}
@@ -226,7 +226,7 @@ export default function vercelServerless({
'head-inline',
await getInjectableWebAnalyticsContent({
mode: command === 'dev' ? 'development' : 'production',
- })
+ }),
);
}
if (command === 'build' && speedInsights?.enabled) {
@@ -242,7 +242,7 @@ export default function vercelServerless({
'\n' +
`\tYour "vercel.json" \`trailingSlash\` configuration (set to \`true\`) will conflict with your Astro \`trailinglSlash\` configuration (set to \`"always"\`).\n` +
`\tThis would cause infinite redirects under certain conditions and throw an \`ERR_TOO_MANY_REDIRECTS\` error.\n` +
- `\tTo prevent this, your Astro configuration is updated to \`"ignore"\` during builds.\n`
+ `\tTo prevent this, your Astro configuration is updated to \`"ignore"\` during builds.\n`,
);
updateConfig({
trailingSlash: 'ignore',
@@ -274,7 +274,7 @@ export default function vercelServerless({
imagesConfig,
command,
devImageService,
- config.image
+ config.image,
),
});
},
@@ -284,12 +284,12 @@ export default function vercelServerless({
`\n` +
`\tVercel's hosting plans might have limits to the number of functions you can create.\n` +
`\tMake sure to check your plan carefully to avoid incurring additional costs.\n` +
- `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n`
+ `\tYou can set functionPerRoute: false to prevent surpassing the limit.\n`,
);
}
setAdapter(
- getAdapter({ functionPerRoute, edgeMiddleware, middlewareSecret, skewProtection })
+ getAdapter({ functionPerRoute, edgeMiddleware, middlewareSecret, skewProtection }),
);
_config = config;
@@ -298,13 +298,13 @@ export default function vercelServerless({
if (config.output === 'static') {
throw new AstroError(
- '`output: "server"` or `output: "hybrid"` is required to use the serverless adapter.'
+ '`output: "server"` or `output: "hybrid"` is required to use the serverless adapter.',
);
}
},
'astro:build:ssr': async ({ entryPoints, middlewareEntryPoint }) => {
_entryPoints = new Map(
- Array.from(entryPoints).filter(([routeData]) => !routeData.prerender)
+ Array.from(entryPoints).filter(([routeData]) => !routeData.prerender),
);
_middlewareEntryPoint = middlewareEntryPoint;
},
@@ -389,7 +389,7 @@ export default function vercelServerless({
await builder.buildMiddlewareFolder(
_middlewareEntryPoint,
MIDDLEWARE_PATH,
- middlewareSecret
+ middlewareSecret,
);
}
const fourOhFourRoute = routes.find((route) => route.pathname === '/404');
@@ -464,7 +464,7 @@ class VercelBuilder {
readonly includeFiles: URL[],
readonly logger: AstroIntegrationLogger,
readonly maxDuration?: number,
- readonly runtime = getRuntime(process, logger)
+ readonly runtime = getRuntime(process, logger),
) {}
async buildServerlessFolder(entry: URL, functionName: string) {
@@ -483,7 +483,7 @@ class VercelBuilder {
excludeFiles,
logger,
},
- NTF_CACHE
+ NTF_CACHE,
);
// Enable ESM
@@ -505,7 +505,7 @@ class VercelBuilder {
await this.buildServerlessFolder(entry, functionName);
const prerenderConfig = new URL(
`./functions/${functionName}.prerender-config.json`,
- this.config.outDir
+ this.config.outDir,
);
// https://vercel.com/docs/build-output-api/v3/primitives#prerender-configuration-file
await writeJson(prerenderConfig, {
@@ -525,7 +525,7 @@ class VercelBuilder {
new URL(VERCEL_EDGE_MIDDLEWARE_FILE, this.config.srcDir),
new URL('./middleware.mjs', functionFolder),
middlewareSecret,
- this.logger
+ this.logger,
);
await writeJson(new URL(`./.vc-config.json`, functionFolder), {
@@ -544,7 +544,7 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
`\n` +
`\tThe local Node.js version (${major}) is not supported by Vercel Serverless Functions.\n` +
`\tYour project will use Node.js 18 as the runtime instead.\n` +
- `\tConsider switching your local version to 18.\n`
+ `\tConsider switching your local version to 18.\n`,
);
return 'nodejs18.x';
}
@@ -554,26 +554,26 @@ function getRuntime(process: NodeJS.Process, logger: AstroIntegrationLogger): Ru
if (support.status === 'retiring') {
if (support.warnDate && new Date() >= support.warnDate) {
logger.warn(
- `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`
+ `Your project is being built for Node.js ${major} as the runtime, which is retiring by ${support.removal}.`,
);
}
return `nodejs${major}.x`;
}
if (support.status === 'beta') {
logger.warn(
- `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`
+ `Your project is being built for Node.js ${major} as the runtime, which is currently in beta for Vercel Serverless Functions.`,
);
return `nodejs${major}.x`;
}
if (support.status === 'deprecated') {
const removeDate = new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }).format(
- support.removal
+ support.removal,
);
logger.warn(
`\n` +
`\tYour project is being built for Node.js ${major} as the runtime.\n` +
`\tThis version is deprecated by Vercel Serverless Functions, and scheduled to be disabled on ${removeDate}.\n` +
- `\tConsider upgrading your local version to 18.\n`
+ `\tConsider upgrading your local version to 18.\n`,
);
return `nodejs${major}.x`;
}
diff --git a/packages/integrations/vercel/src/serverless/entrypoint.ts b/packages/integrations/vercel/src/serverless/entrypoint.ts
index 11d3c3a91..876ab6b07 100644
--- a/packages/integrations/vercel/src/serverless/entrypoint.ts
+++ b/packages/integrations/vercel/src/serverless/entrypoint.ts
@@ -18,7 +18,7 @@ applyPolyfills();
export const createExports = (
manifest: SSRManifest,
- { middlewareSecret, skewProtection }: { middlewareSecret: string; skewProtection: boolean }
+ { middlewareSecret, skewProtection }: { middlewareSecret: string; skewProtection: boolean },
) => {
const app = new NodeApp(manifest);
const handler = async (req: IncomingMessage, res: ServerResponse) => {
diff --git a/packages/integrations/vercel/src/serverless/middleware.ts b/packages/integrations/vercel/src/serverless/middleware.ts
index e8e6adf9f..07d0843bf 100644
--- a/packages/integrations/vercel/src/serverless/middleware.ts
+++ b/packages/integrations/vercel/src/serverless/middleware.ts
@@ -26,13 +26,13 @@ export async function generateEdgeMiddleware(
vercelEdgeMiddlewareHandlerPath: URL,
outPath: URL,
middlewareSecret: string,
- logger: AstroIntegrationLogger
+ logger: AstroIntegrationLogger,
): Promise<URL> {
const code = edgeMiddlewareTemplate(
astroMiddlewareEntryPointPath,
vercelEdgeMiddlewareHandlerPath,
middlewareSecret,
- logger
+ logger,
);
// https://vercel.com/docs/concepts/functions/edge-middleware#create-edge-middleware
const bundledFilePath = fileURLToPath(outPath);
@@ -69,17 +69,17 @@ function edgeMiddlewareTemplate(
astroMiddlewareEntryPointPath: URL,
vercelEdgeMiddlewareHandlerPath: URL,
middlewareSecret: string,
- logger: AstroIntegrationLogger
+ logger: AstroIntegrationLogger,
) {
const middlewarePath = JSON.stringify(
- fileURLToPath(astroMiddlewareEntryPointPath).replace(/\\/g, '/')
+ fileURLToPath(astroMiddlewareEntryPointPath).replace(/\\/g, '/'),
);
const filePathEdgeMiddleware = fileURLToPath(vercelEdgeMiddlewareHandlerPath);
let handlerTemplateImport = '';
let handlerTemplateCall = '{}';
if (existsSync(filePathEdgeMiddleware + '.js') || existsSync(filePathEdgeMiddleware + '.ts')) {
logger.warn(
- 'Usage of `vercel-edge-middleware.js` is deprecated. You can now use the `waitUntil(promise)` function directly as `ctx.locals.waitUntil(promise)`.'
+ 'Usage of `vercel-edge-middleware.js` is deprecated. You can now use the `waitUntil(promise)` function directly as `ctx.locals.waitUntil(promise)`.',
);
const stringified = JSON.stringify(filePathEdgeMiddleware.replace(/\\/g, '/'));
handlerTemplateImport = `import handler from ${stringified}`;
diff --git a/packages/integrations/vercel/src/static/adapter.ts b/packages/integrations/vercel/src/static/adapter.ts
index e2e73ea44..efe3d2da5 100644
--- a/packages/integrations/vercel/src/static/adapter.ts
+++ b/packages/integrations/vercel/src/static/adapter.ts
@@ -74,7 +74,7 @@ export default function vercelStatic({
'head-inline',
await getInjectableWebAnalyticsContent({
mode: command === 'dev' ? 'development' : 'production',
- })
+ }),
);
}
if (command === 'build' && speedInsights?.enabled) {
@@ -95,7 +95,7 @@ export default function vercelStatic({
imagesConfig,
command,
devImageService,
- config.image
+ config.image,
),
});
},
diff --git a/packages/integrations/vercel/test/edge-middleware.test.js b/packages/integrations/vercel/test/edge-middleware.test.js
index 6cc5f00a7..9ae583a11 100644
--- a/packages/integrations/vercel/test/edge-middleware.test.js
+++ b/packages/integrations/vercel/test/edge-middleware.test.js
@@ -14,7 +14,7 @@ describe('Vercel edge middleware', () => {
it('an edge function is created', async () => {
const contents = await build.readFile(
- '../.vercel/output/functions/_middleware.func/.vc-config.json'
+ '../.vercel/output/functions/_middleware.func/.vc-config.json',
);
const contentsJSON = JSON.parse(contents);
assert.equal(contentsJSON.runtime, 'edge');
@@ -26,14 +26,14 @@ describe('Vercel edge middleware', () => {
const { routes } = JSON.parse(contents);
assert.equal(
routes.some((route) => route.dest === '_middleware'),
- true
+ true,
);
});
it('edge sets Set-Cookie headers', async () => {
let entry = new URL(
'../.vercel/output/functions/_middleware.func/middleware.mjs',
- build.config.outDir
+ build.config.outDir,
);
const module = await import(entry);
const request = new Request('http://example.com/foo');
@@ -50,7 +50,7 @@ describe('Vercel edge middleware', () => {
await fixture.build();
const contents = await fixture.readFile(
// this is abysmal...
- '../.vercel/output/functions/render.func/www/withastro/astro/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/dist/middleware.mjs'
+ '../.vercel/output/functions/render.func/www/withastro/astro/packages/integrations/vercel/test/fixtures/middleware-with-edge-file/dist/middleware.mjs',
);
console.log(contents);
// assert.equal(contents.includes('title:')).to.be.true;
@@ -66,7 +66,7 @@ describe('Vercel edge middleware', () => {
await fixture.build();
const contents = await fixture.readFile(
// this is abysmal...
- '../.vercel/output/functions/render.func/www/withastro/astro/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/dist/middleware.mjs'
+ '../.vercel/output/functions/render.func/www/withastro/astro/packages/integrations/vercel/test/fixtures/middleware-without-edge-file/dist/middleware.mjs',
);
console.log(contents);
// assert.equal(contents.includes('title:')).to.be.false;
diff --git a/packages/integrations/vercel/test/hosted/hosted.test.js b/packages/integrations/vercel/test/hosted/hosted.test.js
index 547138b8c..e090188a7 100644
--- a/packages/integrations/vercel/test/hosted/hosted.test.js
+++ b/packages/integrations/vercel/test/hosted/hosted.test.js
@@ -6,7 +6,7 @@ const VERCEL_TEST_URL = 'https://astro-vercel-image-test.vercel.app';
describe('Hosted Vercel Tests', () => {
it('Image endpoint works', async () => {
const image = await fetch(
- VERCEL_TEST_URL + '/_image?href=%2F_astro%2Fpenguin.e9c64733.png&w=300&f=webp'
+ VERCEL_TEST_URL + '/_image?href=%2F_astro%2Fpenguin.e9c64733.png&w=300&f=webp',
);
assert.equal(image.status, 200);
diff --git a/packages/integrations/vercel/test/isr.test.js b/packages/integrations/vercel/test/isr.test.js
index a8df2c0ef..fb957aa78 100644
--- a/packages/integrations/vercel/test/isr.test.js
+++ b/packages/integrations/vercel/test/isr.test.js
@@ -15,7 +15,7 @@ describe('ISR', () => {
it('generates expected prerender config', async () => {
const vcConfig = JSON.parse(
- await fixture.readFile('../.vercel/output/functions/_isr.prerender-config.json')
+ await fixture.readFile('../.vercel/output/functions/_isr.prerender-config.json'),
);
assert.deepEqual(vcConfig, {
expiration: 120,
diff --git a/packages/integrations/vercel/test/max-duration.test.js b/packages/integrations/vercel/test/max-duration.test.js
index 2a7698663..d5e26fc1a 100644
--- a/packages/integrations/vercel/test/max-duration.test.js
+++ b/packages/integrations/vercel/test/max-duration.test.js
@@ -15,7 +15,7 @@ describe('maxDuration', () => {
it('makes it to vercel function configuration', async () => {
const vcConfig = JSON.parse(
- await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json')
+ await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json'),
);
assert.equal(vcConfig.maxDuration, 60);
});
diff --git a/packages/integrations/vercel/test/redirects.test.js b/packages/integrations/vercel/test/redirects.test.js
index 57de308e2..9d4f9499e 100644
--- a/packages/integrations/vercel/test/redirects.test.js
+++ b/packages/integrations/vercel/test/redirects.test.js
@@ -77,7 +77,7 @@ describe('Redirects', () => {
const config = await getConfig();
assert.equal(
config.routes.find((r) => r.src === '/'),
- undefined
+ undefined,
);
});
});
diff --git a/packages/integrations/vercel/test/serverless-prerender.test.js b/packages/integrations/vercel/test/serverless-prerender.test.js
index 5b75418c9..61e239300 100644
--- a/packages/integrations/vercel/test/serverless-prerender.test.js
+++ b/packages/integrations/vercel/test/serverless-prerender.test.js
@@ -20,7 +20,7 @@ describe('Serverless prerender', () => {
it('outDir is tree-shaken if not needed', async () => {
const [file] = await fixture.glob(
- '../.vercel/output/functions/_render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/.vercel/output/_functions/pages/_image.astro.mjs'
+ '../.vercel/output/functions/_render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/.vercel/output/_functions/pages/_image.astro.mjs',
);
const contents = await fixture.readFile(file);
assert.ok(!contents.includes('const outDir ='), "outDir is tree-shaken if it's not imported");
@@ -30,8 +30,8 @@ describe('Serverless prerender', () => {
it.skip('includeFiles work', async () => {
assert.ok(
await fixture.readFile(
- '../.vercel/output/functions/render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/dist/middleware.mjs'
- )
+ '../.vercel/output/functions/render.func/packages/integrations/vercel/test/fixtures/serverless-prerender/dist/middleware.mjs',
+ ),
);
});
});
diff --git a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
index 0967f864b..3f9613834 100644
--- a/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
+++ b/packages/integrations/vercel/test/serverless-with-dynamic-routes.test.js
@@ -18,10 +18,10 @@ describe('Serverless with dynamic routes', () => {
it('build successful', async () => {
assert.ok(await fixture.readFile('../.vercel/output/static/index.html'));
assert.ok(
- await fixture.readFile('../.vercel/output/functions/[id]/index.astro.func/.vc-config.json')
+ await fixture.readFile('../.vercel/output/functions/[id]/index.astro.func/.vc-config.json'),
);
assert.ok(
- await fixture.readFile('../.vercel/output/functions/api/[id].js.func/.vc-config.json')
+ await fixture.readFile('../.vercel/output/functions/api/[id].js.func/.vc-config.json'),
);
});
});
diff --git a/packages/integrations/vercel/test/split.test.js b/packages/integrations/vercel/test/split.test.js
index e64a4dc60..4105db7fc 100644
--- a/packages/integrations/vercel/test/split.test.js
+++ b/packages/integrations/vercel/test/split.test.js
@@ -26,7 +26,7 @@ describe('build: split', () => {
assert.equal(config.routes.length, 5);
assert.equal(
config.routes.some((route) => route.dest === 'prerender.astro'),
- false
+ false,
);
});
});
diff --git a/packages/integrations/vercel/test/streaming.test.js b/packages/integrations/vercel/test/streaming.test.js
index a0172a7e6..1e4b0f111 100644
--- a/packages/integrations/vercel/test/streaming.test.js
+++ b/packages/integrations/vercel/test/streaming.test.js
@@ -15,7 +15,7 @@ describe('streaming', () => {
it('makes it to vercel function configuration', async () => {
const vcConfig = JSON.parse(
- await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json')
+ await fixture.readFile('../.vercel/output/functions/_render.func/.vc-config.json'),
);
assert.equal(vcConfig.supportsResponseStreaming, true);
});
diff --git a/packages/integrations/vue/src/index.ts b/packages/integrations/vue/src/index.ts
index 81afe3a2e..fc54a5f99 100644
--- a/packages/integrations/vue/src/index.ts
+++ b/packages/integrations/vue/src/index.ts
@@ -75,7 +75,7 @@ export const setup = async (app) => {
${
!isBuild
? `console.warn("[@astrojs/vue] appEntrypoint \`" + ${JSON.stringify(
- appEntrypoint
+ appEntrypoint,
)} + "\` does not export a default function. Check out https://docs.astro.build/en/guides/integrations-guide/vue/#appentrypoint.");`
: ''
}
@@ -104,7 +104,7 @@ export const setup = async (app) => {
async function getViteConfiguration(
command: HookParameters<'astro:config:setup'>['command'],
- options?: Options
+ options?: Options,
): Promise<UserConfig> {
let vueOptions = {
...options,
@@ -138,7 +138,7 @@ async function getViteConfiguration(
vueDevTools({
...devToolsOptions,
appendTo: VIRTUAL_MODULE_ID,
- })
+ }),
);
}
diff --git a/packages/integrations/vue/test/toTsx.test.js b/packages/integrations/vue/test/toTsx.test.js
index bf2af56a9..b91b5cad1 100644
--- a/packages/integrations/vue/test/toTsx.test.js
+++ b/packages/integrations/vue/test/toTsx.test.js
@@ -22,7 +22,7 @@ describe('toTSX function', () => {
// Replace the expectations below with the expected result based on your logic
assert.strictEqual(
result,
- `export default function ${className}__AstroComponent_(_props: Record<string, any>): any {}`
+ `export default function ${className}__AstroComponent_(_props: Record<string, any>): any {}`,
);
});
it('should correctly transform Vue code to TSX', () => {
@@ -45,7 +45,7 @@ describe('toTSX function', () => {
const result = toTSX(vueCode, className);
assert.strictEqual(
result.replace(/\s/g, ''),
- `import{defineProps}from'vue';constProps=defineProps({msg:String})exportdefaultfunction${className}__AstroComponent_(_props:typeofProps):any{<div></div>}`
+ `import{defineProps}from'vue';constProps=defineProps({msg:String})exportdefaultfunction${className}__AstroComponent_(_props:typeofProps):any{<div></div>}`,
);
});
});
diff --git a/packages/integrations/web-vitals/src/index.ts b/packages/integrations/web-vitals/src/index.ts
index f5c1c72a2..02293ac6f 100644
--- a/packages/integrations/web-vitals/src/index.ts
+++ b/packages/integrations/web-vitals/src/index.ts
@@ -15,7 +15,7 @@ export default function webVitals({ deprecated }: { deprecated?: boolean } = {})
if (!config.integrations.find(({ name }) => name === 'astro:db')) {
throw new AstroError(
'Astro DB integration not found.',
- 'Run `npx astro add db` to install `@astrojs/db` and add it to your Astro config.'
+ 'Run `npx astro add db` to install `@astrojs/db` and add it to your Astro config.',
);
}
@@ -23,7 +23,7 @@ export default function webVitals({ deprecated }: { deprecated?: boolean } = {})
throw new AstroError(
'No SSR adapter found.',
'`@astrojs/web-vitals` requires your site to be built with `hybrid` or `server` output.\n' +
- 'Please add an SSR adapter: https://docs.astro.build/en/guides/server-side-rendering/'
+ 'Please add an SSR adapter: https://docs.astro.build/en/guides/server-side-rendering/',
);
}
diff --git a/packages/integrations/web-vitals/src/middleware.ts b/packages/integrations/web-vitals/src/middleware.ts
index b4994c902..1935b78d7 100644
--- a/packages/integrations/web-vitals/src/middleware.ts
+++ b/packages/integrations/web-vitals/src/middleware.ts
@@ -16,7 +16,7 @@ export const onRequest: MiddlewareHandler = async ({ params, url }, next) => {
?.pipeThrough(new TextDecoderStream())
.pipeThrough(HeadInjectionTransformStream(webVitalsMetaTag))
.pipeThrough(new TextEncoderStream()),
- response
+ response,
);
};
diff --git a/packages/integrations/web-vitals/test/basics.test.js b/packages/integrations/web-vitals/test/basics.test.js
index f3d84f2fd..7d5afa9df 100644
--- a/packages/integrations/web-vitals/test/basics.test.js
+++ b/packages/integrations/web-vitals/test/basics.test.js
@@ -124,7 +124,7 @@ describe('Web Vitals integration basics', () => {
assert.equal(
consoleErrorMock.calls.length,
0,
- 'Endpoint logged errors:\n' + consoleErrorMock.calls[0]?.join(' ')
+ 'Endpoint logged errors:\n' + consoleErrorMock.calls[0]?.join(' '),
);
});
diff --git a/packages/internal-helpers/src/fs.ts b/packages/internal-helpers/src/fs.ts
index fb6d307ca..c9f27810a 100644
--- a/packages/internal-helpers/src/fs.ts
+++ b/packages/internal-helpers/src/fs.ts
@@ -43,7 +43,7 @@ export async function getFilesFromFolder(dir: URL) {
export async function copyFilesToFolder(
files: URL[],
outDir: URL,
- exclude: URL[] = []
+ exclude: URL[] = [],
): Promise<string> {
const excludeList = exclude.map(fileURLToPath);
const fileList = files.map(fileURLToPath).filter((f) => !excludeList.includes(f));
diff --git a/packages/markdown/remark/src/index.ts b/packages/markdown/remark/src/index.ts
index 14d24f76d..66cf00043 100644
--- a/packages/markdown/remark/src/index.ts
+++ b/packages/markdown/remark/src/index.ts
@@ -52,7 +52,7 @@ const isPerformanceBenchmark = Boolean(process.env.ASTRO_PERFORMANCE_BENCHMARK);
* Create a markdown preprocessor to render multiple markdown files
*/
export async function createMarkdownProcessor(
- opts?: AstroMarkdownOptions
+ opts?: AstroMarkdownOptions,
): Promise<MarkdownProcessor> {
const {
syntaxHighlight = markdownConfigDefaults.syntaxHighlight,
diff --git a/packages/markdown/remark/src/load-plugins.ts b/packages/markdown/remark/src/load-plugins.ts
index a120b5ab1..37a83827d 100644
--- a/packages/markdown/remark/src/load-plugins.ts
+++ b/packages/markdown/remark/src/load-plugins.ts
@@ -10,7 +10,12 @@ async function importPlugin(p: string | unified.Plugin<any[], any>) {
}
export function loadPlugins(
- items: (string | [string, any] | unified.Plugin<any[], any> | [unified.Plugin<any[], any>, any])[]
+ items: (
+ | string
+ | [string, any]
+ | unified.Plugin<any[], any>
+ | [unified.Plugin<any[], any>, any]
+ )[],
): Promise<[unified.Plugin, any?]>[] {
return items.map((p) => {
return new Promise((resolve, reject) => {
diff --git a/packages/markdown/remark/src/rehype-collect-headings.ts b/packages/markdown/remark/src/rehype-collect-headings.ts
index 3bff443e2..05afae1ba 100644
--- a/packages/markdown/remark/src/rehype-collect-headings.ts
+++ b/packages/markdown/remark/src/rehype-collect-headings.ts
@@ -97,7 +97,7 @@ function getMdxFrontmatterVariablePath(node: MdxTextExpression): string[] | Erro
expressionPath.push(
expression.property.type === 'Literal'
? String(expression.property.value)
- : expression.property.name
+ : expression.property.name,
);
expression = expression.object;
diff --git a/packages/markdown/remark/src/rehype-prism.ts b/packages/markdown/remark/src/rehype-prism.ts
index 7f713ddf2..0dcc5695f 100644
--- a/packages/markdown/remark/src/rehype-prism.ts
+++ b/packages/markdown/remark/src/rehype-prism.ts
@@ -9,7 +9,7 @@ export const rehypePrism: Plugin<[], Root> = () => {
let { html, classLanguage } = runHighlighterWithAstro(language, code);
return Promise.resolve(
- `<pre class="${classLanguage}" data-language="${language}"><code is:raw class="${classLanguage}">${html}</code></pre>`
+ `<pre class="${classLanguage}" data-language="${language}"><code is:raw class="${classLanguage}">${html}</code></pre>`,
);
});
};
diff --git a/packages/markdown/remark/src/shiki.ts b/packages/markdown/remark/src/shiki.ts
index fa29c9c06..0028ec927 100644
--- a/packages/markdown/remark/src/shiki.ts
+++ b/packages/markdown/remark/src/shiki.ts
@@ -19,7 +19,7 @@ export interface ShikiHighlighter {
* Raw `meta` information to be used by Shiki transformers
*/
meta?: string;
- }
+ },
): Promise<string>;
}
@@ -30,7 +30,7 @@ const ASTRO_COLOR_REPLACEMENTS: Record<string, string> = {
};
const COLOR_REPLACEMENT_REGEX = new RegExp(
`${Object.keys(ASTRO_COLOR_REPLACEMENTS).join('|')}`,
- 'g'
+ 'g',
);
let _cssVariablesTheme: ReturnType<typeof createCssVariablesTheme>;
@@ -63,7 +63,7 @@ export async function createShikiHighlighter({
} catch (_err) {
// eslint-disable-next-line no-console
console.warn(
- `[Shiki] The language "${lang}" doesn't exist, falling back to "plaintext".`
+ `[Shiki] The language "${lang}" doesn't exist, falling back to "plaintext".`,
);
lang = 'plaintext';
}
diff --git a/packages/markdown/remark/src/types.ts b/packages/markdown/remark/src/types.ts
index e3496ec5d..aa7b62c9a 100644
--- a/packages/markdown/remark/src/types.ts
+++ b/packages/markdown/remark/src/types.ts
@@ -57,7 +57,7 @@ export interface AstroMarkdownOptions {
export interface MarkdownProcessor {
render: (
content: string,
- opts?: MarkdownProcessorRenderOptions
+ opts?: MarkdownProcessorRenderOptions,
) => Promise<MarkdownProcessorRenderResult>;
}
diff --git a/packages/markdown/remark/test/autolinking.test.js b/packages/markdown/remark/test/autolinking.test.js
index 966d5e303..3fd5ad0fc 100644
--- a/packages/markdown/remark/test/autolinking.test.js
+++ b/packages/markdown/remark/test/autolinking.test.js
@@ -16,7 +16,7 @@ describe('autolinking', () => {
assert.equal(
code.replace(/\n/g, ''),
- `<p>See <a href="https://example.com">https://example.com</a> for more.</p>`
+ `<p>See <a href="https://example.com">https://example.com</a> for more.</p>`,
);
});
@@ -26,7 +26,7 @@ describe('autolinking', () => {
assert.equal(
code.trim(),
- `<p>See <a href="http://www.example.com">www.example.com</a> for more.</p>`
+ `<p>See <a href="http://www.example.com">www.example.com</a> for more.</p>`,
);
});
@@ -36,7 +36,7 @@ describe('autolinking', () => {
assert.equal(
code.trim(),
- `<p>See <code>https://example.com</code> or <code>www.example.com</code> for more.</p>`
+ `<p>See <code>https://example.com</code> or <code>www.example.com</code> for more.</p>`,
);
});
});
diff --git a/packages/markdown/remark/test/remark-collect-images.test.js b/packages/markdown/remark/test/remark-collect-images.test.js
index cdfccf9c8..025d909aa 100644
--- a/packages/markdown/remark/test/remark-collect-images.test.js
+++ b/packages/markdown/remark/test/remark-collect-images.test.js
@@ -20,7 +20,7 @@ describe('collect images', async () => {
assert.equal(
code,
- '<p>Hello <img __ASTRO_IMAGE_="{&#x22;src&#x22;:&#x22;./img.png&#x22;,&#x22;alt&#x22;:&#x22;inline image url&#x22;,&#x22;index&#x22;:0}"></p>'
+ '<p>Hello <img __ASTRO_IMAGE_="{&#x22;src&#x22;:&#x22;./img.png&#x22;,&#x22;alt&#x22;:&#x22;inline image url&#x22;,&#x22;index&#x22;:0}"></p>',
);
assert.deepEqual(Array.from(imagePaths), ['./img.png']);
@@ -34,7 +34,7 @@ describe('collect images', async () => {
assert.equal(
code,
- '<p>Hello <img __ASTRO_IMAGE_="{&#x22;src&#x22;:&#x22;./img.webp&#x22;,&#x22;alt&#x22;:&#x22;image ref&#x22;,&#x22;index&#x22;:0}"></p>'
+ '<p>Hello <img __ASTRO_IMAGE_="{&#x22;src&#x22;:&#x22;./img.webp&#x22;,&#x22;alt&#x22;:&#x22;image ref&#x22;,&#x22;index&#x22;:0}"></p>',
);
assert.deepEqual(Array.from(metadata.imagePaths), ['./img.webp']);
diff --git a/packages/markdown/remark/test/shiki.test.js b/packages/markdown/remark/test/shiki.test.js
index 149fa38bb..c3cb81370 100644
--- a/packages/markdown/remark/test/shiki.test.js
+++ b/packages/markdown/remark/test/shiki.test.js
@@ -46,7 +46,7 @@ describe('shiki syntax highlighting', () => {
`\
- const foo = "bar";
+ const foo = "world";`,
- 'diff'
+ 'diff',
);
assert.match(html, /user-select: none/);
diff --git a/packages/studio/src/core/tokens.ts b/packages/studio/src/core/tokens.ts
index 4a4ec53c1..43919ce7f 100644
--- a/packages/studio/src/core/tokens.ts
+++ b/packages/studio/src/core/tokens.ts
@@ -50,7 +50,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
static async createToken(
sessionToken: string,
- projectId: string
+ projectId: string,
): Promise<{ token: string; ttl: number }> {
const spinner = ora('Connecting to remote database...').start();
const response = await safeFetch(
@@ -64,7 +64,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
},
(res) => {
throw new Error(`Failed to create token: ${res.status} ${res.statusText}`);
- }
+ },
);
spinner.succeed(green('Connected to remote database.'));
@@ -94,7 +94,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
},
() => {
throw new Error(`Failed to fetch ${url}.`);
- }
+ },
);
}
@@ -125,7 +125,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
try {
const { token, ttl } = await ManagedRemoteAppToken.createToken(
this.session,
- this.projectId
+ this.projectId,
);
this.token = token;
this.ttl = ttl;
@@ -135,7 +135,7 @@ class ManagedRemoteAppToken implements ManagedAppToken {
// If we get here we couldn't create a new token. Since the existing token
// is expired we really can't do anything and should exit.
throw new Error(
- `Token has expired and attempts to renew it have failed, please try again.`
+ `Token has expired and attempts to renew it have failed, please try again.`,
);
}
}
@@ -217,7 +217,7 @@ async function safeFetch(
options: Parameters<typeof fetch>[1] = {},
onNotOK: (response: Response) => void | Promise<void> = () => {
throw new Error(`Request to ${url} returned a non-OK status code.`);
- }
+ },
): Promise<Response> {
const response = await fetch(url, options);
diff --git a/packages/underscore-redirects/src/print.ts b/packages/underscore-redirects/src/print.ts
index 7e2f1c402..339406a86 100644
--- a/packages/underscore-redirects/src/print.ts
+++ b/packages/underscore-redirects/src/print.ts
@@ -12,7 +12,7 @@ import type { RedirectDefinition } from './redirects.js';
export function print(
definitions: RedirectDefinition[],
minInputLength: number,
- minTargetLength: number
+ minTargetLength: number,
) {
let _redirects = '';
diff --git a/packages/underscore-redirects/test/astro.test.js b/packages/underscore-redirects/test/astro.test.js
index 1d753449b..71ee13f33 100644
--- a/packages/underscore-redirects/test/astro.test.js
+++ b/packages/underscore-redirects/test/astro.test.js
@@ -19,7 +19,7 @@ describe('Astro', () => {
{ pathname: '/one', distURL: new URL('./one/index.html', import.meta.url), segments: [] },
'./.adapter/dist/entry.mjs',
],
- ])
+ ]),
);
const _redirects = createRedirectsFromAstroRoutes({
config: serverConfig,
diff --git a/packages/upgrade/src/actions/context.ts b/packages/upgrade/src/actions/context.ts
index 9c229a363..2103a5327 100644
--- a/packages/upgrade/src/actions/context.ts
+++ b/packages/upgrade/src/actions/context.ts
@@ -35,7 +35,7 @@ export async function getContext(argv: string[]): Promise<Context> {
'-h': '--help',
},
- { argv, permissive: true }
+ { argv, permissive: true },
);
const packageManager = (await detectPackageManager(process.cwd()))?.name ?? 'npm';
diff --git a/packages/upgrade/src/actions/install.ts b/packages/upgrade/src/actions/install.ts
index 6014b404c..f031729e4 100644
--- a/packages/upgrade/src/actions/install.ts
+++ b/packages/upgrade/src/actions/install.ts
@@ -27,7 +27,7 @@ export async function install(
ctx: Pick<
Context,
'version' | 'packages' | 'packageManager' | 'prompt' | 'dryRun' | 'exit' | 'cwd'
- >
+ >,
) {
await banner();
newline();
@@ -60,7 +60,7 @@ export async function install(
label: title('wait'),
message: `${pluralize(
['One package has', 'Some packages have'],
- majors.length
+ majors.length,
)} breaking changes. Continue?`,
initial: true,
});
@@ -118,7 +118,7 @@ function sortPackages(a: PackageInfo, b: PackageInfo): number {
async function runInstallCommand(
ctx: Pick<Context, 'cwd' | 'packageManager' | 'exit'>,
dependencies: PackageInfo[],
- devDependencies: PackageInfo[]
+ devDependencies: PackageInfo[],
) {
const cwd = fileURLToPath(ctx.cwd);
if (ctx.packageManager === 'yarn') await ensureYarnLock({ cwd });
@@ -137,10 +137,10 @@ async function runInstallCommand(
[
installCmd,
...dependencies.map(
- ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`
+ ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`,
),
],
- { cwd, timeout: 90_000, stdio: 'ignore' }
+ { cwd, timeout: 90_000, stdio: 'ignore' },
);
}
if (devDependencies.length > 0) {
@@ -150,10 +150,10 @@ async function runInstallCommand(
installCmd,
'--save-dev',
...devDependencies.map(
- ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`
+ ({ name, targetVersion }) => `${name}@${targetVersion.replace(/^\^/, '')}`,
),
],
- { cwd, timeout: 90_000, stdio: 'ignore' }
+ { cwd, timeout: 90_000, stdio: 'ignore' },
);
}
} catch {
@@ -164,8 +164,8 @@ async function runInstallCommand(
error(
'error',
`Dependencies failed to install, please run the following command manually:\n${color.bold(
- `${ctx.packageManager} ${installCmd} ${packages}`
- )}`
+ `${ctx.packageManager} ${installCmd} ${packages}`,
+ )}`,
);
return ctx.exit(1);
}
diff --git a/packages/upgrade/src/actions/verify.ts b/packages/upgrade/src/actions/verify.ts
index c3f4b7af2..193b0477a 100644
--- a/packages/upgrade/src/actions/verify.ts
+++ b/packages/upgrade/src/actions/verify.ts
@@ -10,7 +10,7 @@ import semverParse from 'semver/functions/parse.js';
import { bannerAbort, error, getRegistry, info, newline } from '../messages.js';
export async function verify(
- ctx: Pick<Context, 'version' | 'packages' | 'cwd' | 'dryRun' | 'exit'>
+ ctx: Pick<Context, 'version' | 'packages' | 'cwd' | 'dryRun' | 'exit'>,
) {
const registry = await getRegistry();
@@ -40,7 +40,7 @@ function isOnline(registry: string): Promise<boolean> {
const { host } = new URL(registry);
return dns.lookup(host).then(
() => true,
- () => false
+ () => false,
);
}
@@ -88,7 +88,7 @@ function isSupportedPackage(name: string, version: string): boolean {
export function collectPackageInfo(
ctx: Pick<Context, 'version' | 'packages'>,
dependencies: Record<string, string> = {},
- devDependencies: Record<string, string> = {}
+ devDependencies: Record<string, string> = {},
) {
for (const [name, currentVersion] of Object.entries(dependencies)) {
if (!isSupportedPackage(name, currentVersion)) continue;
@@ -111,7 +111,7 @@ export function collectPackageInfo(
async function verifyVersions(
ctx: Pick<Context, 'version' | 'packages' | 'exit'>,
- registry: string
+ registry: string,
) {
const tasks: Promise<void>[] = [];
for (const packageInfo of ctx.packages) {
@@ -185,7 +185,7 @@ async function resolveTargetVersion(packageInfo: PackageInfo, registry: string):
function extractChangelogURLFromRepository(
repository: Record<string, string>,
version: string,
- branch = 'main'
+ branch = 'main',
) {
return (
repository.url.replace('git+', '').replace('.git', '') +
diff --git a/packages/upgrade/src/messages.ts b/packages/upgrade/src/messages.ts
index 7bc06724b..17548371c 100644
--- a/packages/upgrade/src/messages.ts
+++ b/packages/upgrade/src/messages.ts
@@ -86,8 +86,8 @@ export const newline = () => stdout.write('\n');
export const banner = async () =>
log(
`\n${label('astro', color.bgGreen, color.black)} ${color.bold(
- 'Integration upgrade in progress.'
- )}`
+ 'Integration upgrade in progress.',
+ )}`,
);
export const bannerAbort = () =>
@@ -105,7 +105,7 @@ export const info = async (prefix: string, text: string, version = '') => {
log(`${' '.repeat(9)}${color.dim(text)} ${color.reset(version)}`);
} else {
log(
- `${' '.repeat(5)} ${color.cyan(symbol)} ${prefix} ${color.dim(text)} ${color.reset(version)}`
+ `${' '.repeat(5)} ${color.cyan(symbol)} ${prefix} ${color.dim(text)} ${color.reset(version)}`,
);
}
};
diff --git a/packages/upgrade/src/shell.ts b/packages/upgrade/src/shell.ts
index 863e26f64..cd16e0d02 100644
--- a/packages/upgrade/src/shell.ts
+++ b/packages/upgrade/src/shell.ts
@@ -23,7 +23,7 @@ let signal: AbortSignal;
export async function shell(
command: string,
flags: string[],
- opts: ExecaOptions = {}
+ opts: ExecaOptions = {},
): Promise<Output> {
let child: ChildProcess;
let stdout = '';
diff --git a/packages/upgrade/test/utils.js b/packages/upgrade/test/utils.js
index 64850a790..8b80bc2e5 100644
--- a/packages/upgrade/test/utils.js
+++ b/packages/upgrade/test/utils.js
@@ -11,7 +11,7 @@ export function setup() {
ctx.messages.push(stripAnsi(String(buf)).trim());
return true;
},
- })
+ }),
);
});
beforeEach(() => {
diff --git a/prettier.config.js b/prettier.config.js
index 4c9969429..e93fdfce7 100644
--- a/prettier.config.js
+++ b/prettier.config.js
@@ -4,7 +4,7 @@ export default {
semi: true,
singleQuote: true,
tabWidth: 2,
- trailingComma: 'es5',
+ trailingComma: 'all',
useTabs: true,
plugins: ['prettier-plugin-astro'],
overrides: [