diff options
Diffstat (limited to 'packages/integrations')
97 files changed, 221 insertions, 221 deletions
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(' '), ); }); |