[ci] format
This commit is contained in:
parent
2511d58d58
commit
c464bf258f
6 changed files with 14 additions and 12 deletions
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -100,7 +100,9 @@ export async function getRemarkPlugins(
|
|||
mdxOptions: MdxOptions,
|
||||
config: AstroConfig
|
||||
): Promise<MdxRollupPluginOptions['remarkPlugins']> {
|
||||
let remarkPlugins: PluggableList = [...(config.experimental.assets ? [remarkCollectImages, remarkImageToComponent] : [])];
|
||||
let remarkPlugins: PluggableList = [
|
||||
...(config.experimental.assets ? [remarkCollectImages, remarkImageToComponent] : []),
|
||||
];
|
||||
|
||||
if (!isPerformanceBenchmark) {
|
||||
if (mdxOptions.gfm) {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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<string>();
|
||||
visit(tree, 'image', (node: Image) => {
|
||||
if (shouldOptimizeImage(node.url)) imagePaths.add(node.url);
|
||||
});
|
||||
const imagePaths = new Set<string>();
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue