Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh authored and astrobot-houston committed Apr 13, 2023
1 parent 2511d58 commit c464bf2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/content/vite-plugin-content-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ 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,
getEntryInfo,
getEntrySlug,
getEntryType,
globalContentConfigObserver,
NoCollectionError,
type ContentConfig,
} from './utils.js';

Expand Down
4 changes: 3 additions & 1 deletion packages/integrations/mdx/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
14 changes: 7 additions & 7 deletions packages/markdown/remark/src/remark-collect-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c464bf2

Please sign in to comment.