diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index c82d2d7d7..d7d61253d 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -67,7 +67,7 @@ export interface AstroGlobalPartial { /** @deprecated Use `Astro.glob()` instead. */ fetchContent(globStr: string): Promise; glob(globStr: `${any}.astro`): Promise; - glob>(globStr: `${any}.md`): Promise[]>; + glob>(globStr: `${any}.md`): Promise[]>; glob>(globStr: string): Promise; site: URL; } @@ -517,7 +517,7 @@ export interface MarkdownInstance> { file: string; url: string | undefined; Content: AstroComponentFactory; - getHeaders(): Promise<{ depth: number, slug: string, text: string }[]>; + getHeaders(): Promise<{ depth: number; slug: string; text: string }[]>; } export type GetHydrateCallback = () => Promise<(element: Element, innerHTML: string | null) => void>; diff --git a/packages/astro/src/runtime/server/index.ts b/packages/astro/src/runtime/server/index.ts index 25d41f541..957d3a1cc 100644 --- a/packages/astro/src/runtime/server/index.ts +++ b/packages/astro/src/runtime/server/index.ts @@ -291,7 +291,7 @@ function createAstroGlobFn() { throw new Error(`Astro.glob(${JSON.stringify(globValue())}) - no matches found.`); } // Map over the `import()` promises, calling to load them. - return Promise.all(allEntries.map(fn => fn())); + return Promise.all(allEntries.map((fn) => fn())); }; // Cast the return type because the argument that the user sees (string) is different from the argument // that the runtime sees post-compiler (Record). diff --git a/packages/astro/src/vite-plugin-astro-postprocess/index.ts b/packages/astro/src/vite-plugin-astro-postprocess/index.ts index c0e3ad551..58bd7566d 100644 --- a/packages/astro/src/vite-plugin-astro-postprocess/index.ts +++ b/packages/astro/src/vite-plugin-astro-postprocess/index.ts @@ -1,7 +1,7 @@ import { parse as babelParser } from '@babel/parser'; import type { ArrowFunctionExpressionKind, CallExpressionKind, StringLiteralKind } from 'ast-types/gen/kinds'; import type { NodePath } from 'ast-types/lib/node-path'; -import { parse, print, types, visit } from "recast"; +import { parse, print, types, visit } from 'recast'; import type { Plugin } from 'vite'; import type { AstroConfig } from '../@types/astro'; @@ -53,21 +53,23 @@ export default function astro({ config }: AstroPluginOptions): Plugin { // Wrap the `Astro.glob()` argument with `import.meta.glob`. const argsPath = path.get('arguments', 0) as NodePath; const args = argsPath.value; - argsPath.replace({ - type: 'CallExpression', - callee: { - type: 'MemberExpression', - object: { type: 'MetaProperty', meta: { type: 'Identifier', name: 'import' }, property: { type: 'Identifier', name: 'meta' } }, - property: { type: 'Identifier', name: 'glob' }, - computed: false, - }, - arguments: [args], - } as CallExpressionKind, + argsPath.replace( + { + type: 'CallExpression', + callee: { + type: 'MemberExpression', + object: { type: 'MetaProperty', meta: { type: 'Identifier', name: 'import' }, property: { type: 'Identifier', name: 'meta' } }, + property: { type: 'Identifier', name: 'glob' }, + computed: false, + }, + arguments: [args], + } as CallExpressionKind, { type: 'ArrowFunctionExpression', body: args, - params: [] - } as ArrowFunctionExpressionKind); + params: [], + } as ArrowFunctionExpressionKind + ); return false; }, }); diff --git a/packages/astro/src/vite-plugin-markdown/index.ts b/packages/astro/src/vite-plugin-markdown/index.ts index ebe578783..a250da2af 100644 --- a/packages/astro/src/vite-plugin-markdown/index.ts +++ b/packages/astro/src/vite-plugin-markdown/index.ts @@ -76,7 +76,7 @@ export default function markdown({ config }: AstroPluginOptions): Plugin { }, async load(id) { // A markdown file has been imported via ESM! - // Return the file's JS representation, including all Markdown + // Return the file's JS representation, including all Markdown // frontmatter and a deferred `import() of the compiled markdown content. if (id.startsWith(VIRTUAL_MODULE_ID)) { const sitePathname = config.buildOptions.site ? new URL(config.buildOptions.site).pathname : '/';