[ci] format
This commit is contained in:
parent
fec583909a
commit
05c5ef155f
10 changed files with 37 additions and 36 deletions
|
@ -57,9 +57,7 @@ async function benchmark({ fixtures, templates, numPosts }) {
|
|||
|
||||
if (test.includes('simple')) {
|
||||
const fixtures = formats;
|
||||
console.log(
|
||||
`\n${bold('Simple')} ${dim(`${numPosts} posts (${formatsToString(fixtures)})`)}`
|
||||
);
|
||||
console.log(`\n${bold('Simple')} ${dim(`${numPosts} posts (${formatsToString(fixtures)})`)}`);
|
||||
process.env.ASTRO_PERFORMANCE_TEST_NAME = 'simple';
|
||||
await benchmark({
|
||||
fixtures,
|
||||
|
|
|
@ -1015,8 +1015,8 @@ export interface AstroConfig extends z.output<typeof AstroConfigSchema> {
|
|||
export interface ContentEntryType {
|
||||
extensions: string[];
|
||||
getEntryInfo(params: {
|
||||
fileUrl: URL;
|
||||
contents: string;
|
||||
fileUrl: URL;
|
||||
contents: string;
|
||||
}): GetEntryInfoReturnType | Promise<GetEntryInfoReturnType>;
|
||||
contentModuleTypes?: string;
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ type GetEntryInfoReturnType = {
|
|||
rawData: string;
|
||||
body: string;
|
||||
slug: string;
|
||||
}
|
||||
};
|
||||
|
||||
export interface AstroSettings {
|
||||
config: AstroConfig;
|
||||
|
|
|
@ -11,15 +11,14 @@ import { escapeViteEnvReferences, getFileInfo } from '../vite-plugin-utils/index
|
|||
import { CONTENT_FLAG } from './consts.js';
|
||||
import {
|
||||
ContentConfig,
|
||||
getContentEntryExts,
|
||||
extractFrontmatterAssets,
|
||||
getContentEntryExts,
|
||||
getContentPaths,
|
||||
getEntryData,
|
||||
getEntryInfo,
|
||||
getEntrySlug,
|
||||
getEntryType,
|
||||
globalContentConfigObserver,
|
||||
parseFrontmatter,
|
||||
} from './utils.js';
|
||||
|
||||
function isContentFlagImport(viteId: string, contentEntryExts: string[]) {
|
||||
|
|
|
@ -3,10 +3,10 @@ import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
|
|||
|
||||
import { fileURLToPath, pathToFileURL } from 'url';
|
||||
import jsxRenderer from '../../jsx/renderer.js';
|
||||
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
||||
import { createDefaultDevConfig } from './config.js';
|
||||
import { AstroTimer } from './timer.js';
|
||||
import { loadTSConfig } from './tsconfig.js';
|
||||
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
||||
|
||||
export function createBaseSettings(config: AstroConfig): AstroSettings {
|
||||
return {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import type { AstroIntegration, AstroConfig, ContentEntryType, HookParameters } from 'astro';
|
||||
import { InlineConfig } from 'vite';
|
||||
import type { Config } from '@markdoc/markdoc';
|
||||
import Markdoc from '@markdoc/markdoc';
|
||||
import type { AstroConfig, AstroIntegration, ContentEntryType, HookParameters } from 'astro';
|
||||
import fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { InlineConfig } from 'vite';
|
||||
import {
|
||||
prependForwardSlash,
|
||||
getAstroConfigPath,
|
||||
MarkdocError,
|
||||
parseFrontmatter,
|
||||
prependForwardSlash,
|
||||
} from './utils.js';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import fs from 'node:fs';
|
||||
|
||||
type IntegrationWithPrivateHooks = {
|
||||
name: string;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import matter from 'gray-matter';
|
||||
import path from 'node:path';
|
||||
import type fsMod from 'node:fs';
|
||||
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
||||
import type { AstroInstance } from 'astro';
|
||||
import z from 'astro/zod';
|
||||
import matter from 'gray-matter';
|
||||
import type fsMod from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
||||
|
||||
/**
|
||||
* Match YAML exception handling from Astro core errors
|
||||
|
|
|
@ -11,7 +11,7 @@ import type { Options as RemarkRehypeOptions } from 'remark-rehype';
|
|||
import { VFile } from 'vfile';
|
||||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
|
||||
import { getFileInfo, parseFrontmatter, ignoreStringPlugins } from './utils.js';
|
||||
import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js';
|
||||
|
||||
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
|
||||
extendMarkdownConfig: boolean;
|
||||
|
@ -23,20 +23,23 @@ export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | '
|
|||
remarkRehype: RemarkRehypeOptions;
|
||||
};
|
||||
|
||||
|
||||
type IntegrationWithPrivateHooks = {
|
||||
type IntegrationWithPrivateHooks = {
|
||||
name: string;
|
||||
hooks: Omit<AstroIntegration['hooks'], 'astro:config:setup'> & {
|
||||
'astro:config:setup': (params: HookParameters<'astro:config:setup'> & {
|
||||
// `addPageExtension` and `contentEntryType` are not a public APIs
|
||||
// Add type defs here
|
||||
addPageExtension: (extension: string) => void
|
||||
addContentEntryType: (contentEntryType: ContentEntryType) => void
|
||||
}) => void | Promise<void>;
|
||||
'astro:config:setup': (
|
||||
params: HookParameters<'astro:config:setup'> & {
|
||||
// `addPageExtension` and `contentEntryType` are not a public APIs
|
||||
// Add type defs here
|
||||
addPageExtension: (extension: string) => void;
|
||||
addContentEntryType: (contentEntryType: ContentEntryType) => void;
|
||||
}
|
||||
) => void | Promise<void>;
|
||||
};
|
||||
};
|
||||
|
||||
export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): IntegrationWithPrivateHooks {
|
||||
export default function mdx(
|
||||
partialMdxOptions: Partial<MdxOptions> = {}
|
||||
): IntegrationWithPrivateHooks {
|
||||
return {
|
||||
name: '@astrojs/mdx',
|
||||
hooks: {
|
||||
|
@ -70,7 +73,9 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
|||
|
||||
const mdxOptions = applyDefaultOptions({
|
||||
options: partialMdxOptions,
|
||||
defaults: markdownConfigToMdxOptions(extendMarkdownConfig ? config.markdown : markdownConfigDefaults),
|
||||
defaults: markdownConfigToMdxOptions(
|
||||
extendMarkdownConfig ? config.markdown : markdownConfigDefaults
|
||||
),
|
||||
});
|
||||
|
||||
const mdxPluginOpts: MdxRollupPluginOptions = {
|
||||
|
@ -188,7 +193,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
|||
const defaultMdxOptions = {
|
||||
extendMarkdownConfig: true,
|
||||
recmaPlugins: [],
|
||||
}
|
||||
};
|
||||
|
||||
function markdownConfigToMdxOptions(markdownConfig: typeof markdownConfigDefaults): MdxOptions {
|
||||
return {
|
||||
|
@ -196,7 +201,7 @@ function markdownConfigToMdxOptions(markdownConfig: typeof markdownConfigDefault
|
|||
...markdownConfig,
|
||||
remarkPlugins: ignoreStringPlugins(markdownConfig.remarkPlugins),
|
||||
rehypePlugins: ignoreStringPlugins(markdownConfig.rehypePlugins),
|
||||
remarkRehype: markdownConfig.remarkRehype as any ?? {},
|
||||
remarkRehype: (markdownConfig.remarkRehype as any) ?? {},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ import {
|
|||
safelyGetAstroData,
|
||||
} from '@astrojs/markdown-remark/dist/internal.js';
|
||||
import { nodeTypes } from '@mdx-js/mdx';
|
||||
import type { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
||||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||
import type { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
||||
import type { AstroConfig } from 'astro';
|
||||
import type { Literal, MemberExpression } from 'estree';
|
||||
import { visit as estreeVisit } from 'estree-util-visit';
|
||||
import type { Image } from 'mdast';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkSmartypants from 'remark-smartypants';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||
import type { Options as AcornOpts } from 'acorn';
|
||||
import { parse } from 'acorn';
|
||||
import type { AstroConfig, SSRError } from 'astro';
|
||||
import { bold, yellow } from 'kleur/colors';
|
||||
import matter from 'gray-matter';
|
||||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||
import { bold, yellow } from 'kleur/colors';
|
||||
import type { MdxjsEsm } from 'mdast-util-mdx';
|
||||
|
||||
function appendForwardSlash(path: string) {
|
||||
|
|
|
@ -93,7 +93,7 @@ export async function renderMarkdown(
|
|||
} else if (syntaxHighlight === 'prism') {
|
||||
parser.use([remarkPrism(scopedClassName)]);
|
||||
}
|
||||
|
||||
|
||||
if (opts.experimentalAssets) {
|
||||
// Apply later in case user plugins resolve relative image paths
|
||||
parser.use([toRemarkCollectImages(opts.resolveImage)]);
|
||||
|
|
Loading…
Reference in a new issue