From c464bf258f0f60ea7730fdf0e5f85011b6e7f56b Mon Sep 17 00:00:00 2001 From: Princesseuh Date: Thu, 13 Apr 2023 09:56:50 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/content/types-generator.ts | 2 +- packages/astro/src/content/utils.ts | 2 +- .../src/content/vite-plugin-content-imports.ts | 2 +- packages/integrations/mdx/src/plugins.ts | 4 +++- .../mdx/src/remark-images-to-component.ts | 2 +- .../markdown/remark/src/remark-collect-images.ts | 14 +++++++------- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/astro/src/content/types-generator.ts b/packages/astro/src/content/types-generator.ts index b6185c26a798..825f7b5d8e82 100644 --- a/packages/astro/src/content/types-generator.ts +++ b/packages/astro/src/content/types-generator.ts @@ -10,13 +10,13 @@ import { info, warn, type LogOptions } from '../core/logger/core.js'; import { isRelativePath } from '../core/path.js'; import { CONTENT_TYPES_FILE } from './consts.js'; import { - NoCollectionError, getContentEntryExts, getContentPaths, getEntryInfo, getEntrySlug, getEntryType, loadContentConfig, + NoCollectionError, parseFrontmatter, type ContentConfig, type ContentObservable, diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 97e96dc98593..f392efc5587d 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -4,7 +4,7 @@ import fsMod from 'node:fs'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; import type { PluginContext } from 'rollup'; -import { normalizePath, type ViteDevServer, type ErrorPayload as ViteErrorPayload } from 'vite'; +import { normalizePath, type ErrorPayload as ViteErrorPayload, type ViteDevServer } from 'vite'; import { z } from 'zod'; import type { AstroConfig, AstroSettings, ImageInputFormat } from '../@types/astro.js'; import { VALID_INPUT_FORMATS } from '../assets/consts.js'; diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts index 99298657384d..1c7a80b917b7 100644 --- a/packages/astro/src/content/vite-plugin-content-imports.ts +++ b/packages/astro/src/content/vite-plugin-content-imports.ts @@ -10,7 +10,6 @@ import { AstroError } from '../core/errors/errors.js'; import { escapeViteEnvReferences, getFileInfo } from '../vite-plugin-utils/index.js'; import { CONTENT_FLAG } from './consts.js'; import { - NoCollectionError, getContentEntryExts, getContentPaths, getEntryData, @@ -18,6 +17,7 @@ import { getEntrySlug, getEntryType, globalContentConfigObserver, + NoCollectionError, type ContentConfig, } from './utils.js'; diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts index 56fbbf837f15..859cf3bbeacf 100644 --- a/packages/integrations/mdx/src/plugins.ts +++ b/packages/integrations/mdx/src/plugins.ts @@ -100,7 +100,9 @@ export async function getRemarkPlugins( mdxOptions: MdxOptions, config: AstroConfig ): Promise { - let remarkPlugins: PluggableList = [...(config.experimental.assets ? [remarkCollectImages, remarkImageToComponent] : [])]; + let remarkPlugins: PluggableList = [ + ...(config.experimental.assets ? [remarkCollectImages, remarkImageToComponent] : []), + ]; if (!isPerformanceBenchmark) { if (mdxOptions.gfm) { diff --git a/packages/integrations/mdx/src/remark-images-to-component.ts b/packages/integrations/mdx/src/remark-images-to-component.ts index 8a3166f49e64..8fd4ef36696c 100644 --- a/packages/integrations/mdx/src/remark-images-to-component.ts +++ b/packages/integrations/mdx/src/remark-images-to-component.ts @@ -1,6 +1,6 @@ import type { MarkdownVFile } from '@astrojs/markdown-remark'; import { type Image, type Parent } from 'mdast'; -import type { MdxJsxFlowElement, MdxjsEsm } from 'mdast-util-mdx'; +import type { MdxjsEsm, MdxJsxFlowElement } from 'mdast-util-mdx'; import { visit } from 'unist-util-visit'; import { jsToTreeNode } from './utils.js'; diff --git a/packages/markdown/remark/src/remark-collect-images.ts b/packages/markdown/remark/src/remark-collect-images.ts index 0f1eb59f7b24..a9f524f7ac69 100644 --- a/packages/markdown/remark/src/remark-collect-images.ts +++ b/packages/markdown/remark/src/remark-collect-images.ts @@ -4,15 +4,15 @@ import type { MarkdownVFile } from './types'; export function remarkCollectImages() { return function (tree: any, vfile: MarkdownVFile) { - if (typeof vfile?.path !== 'string') return; + if (typeof vfile?.path !== 'string') return; - const imagePaths = new Set(); - visit(tree, 'image', (node: Image) => { - if (shouldOptimizeImage(node.url)) imagePaths.add(node.url); - }); + const imagePaths = new Set(); + visit(tree, 'image', (node: Image) => { + if (shouldOptimizeImage(node.url)) imagePaths.add(node.url); + }); - vfile.data.imagePaths = imagePaths; - }; + vfile.data.imagePaths = imagePaths; + }; } function shouldOptimizeImage(src: string) {