fumadocs-mdx 14.3.0 → 14.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-CrnPUO1X.js → adapter-DVxULZiU.js} +3 -3
- package/dist/{adapter-CrnPUO1X.js.map → adapter-DVxULZiU.js.map} +1 -1
- package/dist/{build-DxkMdv29.js → build-DPafU2lu.js} +2 -2
- package/dist/{build-DxkMdv29.js.map → build-DPafU2lu.js.map} +1 -1
- package/dist/{build-mdx-iu_4pINO.js → build-mdx-82nyqL4J.js} +2 -2
- package/dist/{build-mdx-iu_4pINO.js.map → build-mdx-82nyqL4J.js.map} +1 -1
- package/dist/{build-mdx-CAXqH1_C.d.ts → build-mdx-YyRh-ZGV.d.ts} +1 -1
- package/dist/{build-mdx-CAXqH1_C.d.ts.map → build-mdx-YyRh-ZGV.d.ts.map} +1 -1
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +5 -5
- package/dist/{codegen-Bd9bQlN7.js → codegen-B8EhLmbU.js} +1 -1
- package/dist/{codegen-Bd9bQlN7.js.map → codegen-B8EhLmbU.js.map} +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +12 -6
- package/dist/config/index.js.map +1 -1
- package/dist/{core-C9TGjTWd.d.ts → core-C5aAAT92.d.ts} +28 -6
- package/dist/core-C5aAAT92.d.ts.map +1 -0
- package/dist/{core-BluWnx7f.js → core-Wd5WdPN4.js} +8 -2
- package/dist/{core-BluWnx7f.js.map → core-Wd5WdPN4.js.map} +1 -1
- package/dist/{index-Cfo6kcGs.d.ts → index-BIbaPT3v.d.ts} +1 -1
- package/dist/index-BIbaPT3v.d.ts.map +1 -0
- package/dist/{index-file-4qOxhCQn.js → index-file-eVlUbKSO.js} +4 -4
- package/dist/index-file-eVlUbKSO.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/{load-from-file-CEpo5Sqi.js → load-from-file-C1DDNVwF.js} +2 -2
- package/dist/{load-from-file-CEpo5Sqi.js.map → load-from-file-C1DDNVwF.js.map} +1 -1
- package/dist/{loaders-BauN_my2.js → loaders-ezSYYkT7.js} +1 -1
- package/dist/{loaders-BauN_my2.js.map → loaders-ezSYYkT7.js.map} +1 -1
- package/dist/{mdx-Cd17PhOW.js → mdx-D2vcWdqv.js} +5 -5
- package/dist/mdx-D2vcWdqv.js.map +1 -0
- package/dist/{meta-DV1ZTafU.js → meta-B6guI74I.js} +3 -3
- package/dist/{meta-DV1ZTafU.js.map → meta-B6guI74I.js.map} +1 -1
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +4 -4
- package/dist/node/loader.js +4 -4
- package/dist/node/loader.js.map +1 -1
- package/dist/plugins/index-file.d.ts +1 -1
- package/dist/plugins/index-file.js +1 -1
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/last-modified.d.ts +1 -1
- package/dist/plugins/last-modified.js +1 -1
- package/dist/{preset-BjHACE1Z.js → preset-B0H8HalE.js} +1 -1
- package/dist/{preset-BjHACE1Z.js.map → preset-B0H8HalE.js.map} +1 -1
- package/dist/{remark-include-naMKDvrK.js → remark-include-VDoXZSBN.js} +3 -3
- package/dist/remark-include-VDoXZSBN.js.map +1 -0
- package/dist/runtime/browser.d.ts +3 -3
- package/dist/runtime/browser.js.map +1 -1
- package/dist/runtime/dynamic.d.ts +2 -2
- package/dist/runtime/dynamic.js +5 -5
- package/dist/runtime/dynamic.js.map +1 -1
- package/dist/runtime/server.d.ts +1 -1
- package/dist/runtime/server.js.map +1 -1
- package/dist/runtime/types.d.ts +1 -1
- package/dist/{types-DRpz2Vq2.d.ts → types-hAduruLB.d.ts} +1 -1
- package/dist/{types-DRpz2Vq2.d.ts.map → types-hAduruLB.d.ts.map} +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +7 -7
- package/dist/webpack/mdx.d.ts +1 -1
- package/dist/webpack/mdx.js +3 -3
- package/dist/webpack/meta.d.ts +1 -1
- package/dist/webpack/meta.js +3 -3
- package/dist/{webpack-sTIanFoi.js → webpack-CBlMzMlJ.js} +2 -2
- package/dist/{webpack-sTIanFoi.js.map → webpack-CBlMzMlJ.js.map} +1 -1
- package/package.json +8 -8
- package/dist/core-C9TGjTWd.d.ts.map +0 -1
- package/dist/fuma-matter-Fge-qpw1.js +0 -26
- package/dist/fuma-matter-Fge-qpw1.js.map +0 -1
- package/dist/index-Cfo6kcGs.d.ts.map +0 -1
- package/dist/index-file-4qOxhCQn.js.map +0 -1
- package/dist/mdx-Cd17PhOW.js.map +0 -1
- package/dist/remark-include-naMKDvrK.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as ValidationError } from "./core-
|
|
2
|
-
import { t as loadConfig } from "./load-from-file-
|
|
1
|
+
import { r as ValidationError } from "./core-Wd5WdPN4.js";
|
|
2
|
+
import { t as loadConfig } from "./load-from-file-C1DDNVwF.js";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -138,4 +138,4 @@ function toBun(loader) {
|
|
|
138
138
|
//#endregion
|
|
139
139
|
export { createIntegratedConfigLoader as a, toWebpack as i, toNode as n, createStandaloneConfigLoader as o, toVite as r, toBun as t };
|
|
140
140
|
|
|
141
|
-
//# sourceMappingURL=adapter-
|
|
141
|
+
//# sourceMappingURL=adapter-DVxULZiU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-
|
|
1
|
+
{"version":3,"file":"adapter-DVxULZiU.js","names":[],"sources":["../src/loaders/config.ts","../src/loaders/adapter.ts"],"sourcesContent":["import { loadConfig } from '@/config/load-from-file';\nimport type { Core } from '@/core';\nimport fs from 'node:fs/promises';\n\nexport interface ConfigLoader {\n getCore(): Promise<Core>;\n}\n\nexport function createStandaloneConfigLoader({\n core,\n buildConfig,\n mode,\n}: {\n /**\n * core (not initialized)\n */\n core: Core;\n buildConfig: boolean;\n /**\n * In dev mode, the config file is dynamically re-loaded when it's updated.\n */\n mode: 'dev' | 'production';\n}): ConfigLoader {\n let prev:\n | {\n hash: string;\n init: Promise<void>;\n }\n | undefined;\n\n async function getConfigHash(): Promise<string> {\n if (mode === 'production') return 'static';\n\n const stats = await fs.stat(core.getOptions().configPath).catch(() => {\n throw new Error('Cannot find config file');\n });\n\n return stats.mtime.getTime().toString();\n }\n\n return {\n async getCore() {\n const hash = await getConfigHash();\n if (!prev || hash !== prev.hash) {\n prev = {\n hash,\n init: core.init({\n config: loadConfig(core, buildConfig),\n }),\n };\n }\n\n await prev.init;\n return core;\n },\n };\n}\n\n/**\n * create config loader from initialized core\n */\nexport function createIntegratedConfigLoader(core: Core): ConfigLoader {\n return {\n async getCore() {\n return core;\n },\n };\n}\n","import type { CompilerOptions } from '@/loaders/mdx/build-mdx';\nimport type { LoadFnOutput, LoadHook } from 'node:module';\nimport { fileURLToPath } from 'node:url';\nimport fs from 'node:fs/promises';\nimport type { TransformPluginContext } from 'rolldown';\nimport type { Environment, TransformResult } from 'vite';\nimport { parse } from 'node:querystring';\nimport { ValidationError } from '@/utils/validation';\nimport type { LoaderContext } from 'webpack';\nimport { readFileSync } from 'node:fs';\n\nexport interface LoaderInput {\n development: boolean;\n compiler: CompilerOptions;\n\n filePath: string;\n query: Record<string, string | string[] | undefined>;\n getSource: () => string | Promise<string>;\n}\n\nexport interface LoaderOutput {\n code: string;\n map?: unknown;\n\n /**\n * Only supported in Vite 8.\n *\n * Explicitly define the transformed module type, for unsupported environments, you need to consider the differences between each bundler.\n */\n moduleType?: 'js' | 'json';\n}\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface Loader {\n /**\n * Filter file paths, the input can be either a file URL or file path.\n *\n * Must take resource query into consideration.\n */\n test?: RegExp;\n\n /**\n * Transform input into JavaScript.\n *\n * Returns:\n * - `LoaderOutput`: JavaScript code & source map.\n * - `null`: skip the loader. Fallback to default behaviour if possible, otherwise the adapter will try workarounds.\n */\n load: (input: LoaderInput) => Awaitable<LoaderOutput | null>;\n\n bun?: {\n /**\n * 1. Bun doesn't allow `null` in loaders.\n * 2. Bun requires sync result to support dynamic require().\n */\n load?: (source: string, input: LoaderInput) => Awaitable<Bun.OnLoadResult>;\n };\n}\n\nexport function toNode(loader: Loader): LoadHook {\n return async (url, _context, nextLoad): Promise<LoadFnOutput> => {\n if (url.startsWith('file:///') && (!loader.test || loader.test.test(url))) {\n const parsedUrl = new URL(url);\n const filePath = fileURLToPath(parsedUrl);\n\n const result = await loader.load({\n filePath,\n query: Object.fromEntries(parsedUrl.searchParams.entries()),\n async getSource() {\n return await fs.readFile(filePath, 'utf-8');\n },\n development: false,\n compiler: {\n addDependency() {},\n },\n });\n\n if (result) {\n return {\n source: result.code,\n format: 'module',\n shortCircuit: true,\n };\n }\n }\n\n return nextLoad(url);\n };\n}\n\nexport interface ViteLoader {\n filter: (id: string) => boolean;\n\n transform: (\n this: TransformPluginContext & { environment: Environment },\n value: string,\n id: string,\n ) => Promise<TransformResult | null>;\n}\n\nexport function toVite(loader: Loader): ViteLoader {\n return {\n filter(id) {\n return !loader.test || loader.test.test(id);\n },\n async transform(value, id) {\n const environment = this.environment;\n const [file, query = ''] = id.split('?', 2);\n\n const result = await loader.load({\n filePath: file,\n query: parse(query),\n getSource() {\n return value;\n },\n development: environment.mode === 'dev',\n compiler: {\n addDependency: (file) => {\n this.addWatchFile(file);\n },\n },\n });\n\n if (result === null) return null;\n return {\n code: result.code,\n map: result.map as TransformResult['map'],\n moduleType: result.moduleType,\n };\n },\n };\n}\n\nexport type WebpackLoader = (\n this: LoaderContext<unknown>,\n source: string,\n callback: LoaderContext<unknown>['callback'],\n) => Promise<void>;\n\n/**\n * need to handle the `test` regex in Webpack config instead.\n */\nexport function toWebpack(loader: Loader): WebpackLoader {\n return async function (source, callback) {\n try {\n const result = await loader.load({\n filePath: this.resourcePath,\n query: parse(this.resourceQuery.slice(1)),\n getSource() {\n return source;\n },\n development: this.mode === 'development',\n compiler: this,\n });\n\n if (result === null) {\n callback(undefined, source);\n } else {\n callback(undefined, result.code, result.map as string);\n }\n } catch (error) {\n if (error instanceof ValidationError) {\n return callback(new Error(await error.toStringFormatted()));\n }\n\n if (!(error instanceof Error)) throw error;\n callback(error);\n }\n };\n}\n\nexport function toBun(loader: Loader) {\n function toResult(output: LoaderOutput | null): Bun.OnLoadResult {\n // it errors, treat this as an exception\n if (!output) return;\n\n return {\n contents: output.code,\n loader: output.moduleType ?? 'js',\n };\n }\n\n return (build: Bun.PluginBuilder) => {\n // avoid using async here, because it will cause dynamic require() to fail\n build.onLoad({ filter: loader.test ?? /.+/ }, (args) => {\n const [filePath, query = ''] = args.path.split('?', 2);\n const input: LoaderInput = {\n async getSource() {\n return Bun.file(filePath).text();\n },\n query: parse(query),\n filePath,\n development: false,\n compiler: {\n addDependency() {},\n },\n };\n\n if (loader.bun?.load) {\n return loader.bun.load(readFileSync(filePath, 'utf-8'), input);\n }\n\n const result = loader.load(input);\n if (result instanceof Promise) {\n return result.then(toResult);\n }\n return toResult(result);\n });\n };\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,6BAA6B,EAC3C,MACA,aACA,QAWe;CACf,IAAI;CAOJ,eAAe,gBAAiC;AAC9C,MAAI,SAAS,aAAc,QAAO;AAMlC,UAAO,MAJa,GAAG,KAAK,KAAK,YAAY,CAAC,WAAW,CAAC,YAAY;AACpE,SAAM,IAAI,MAAM,0BAA0B;IAC1C,EAEW,MAAM,SAAS,CAAC,UAAU;;AAGzC,QAAO,EACL,MAAM,UAAU;EACd,MAAM,OAAO,MAAM,eAAe;AAClC,MAAI,CAAC,QAAQ,SAAS,KAAK,KACzB,QAAO;GACL;GACA,MAAM,KAAK,KAAK,EACd,QAAQ,WAAW,MAAM,YAAY,EACtC,CAAC;GACH;AAGH,QAAM,KAAK;AACX,SAAO;IAEV;;;;;AAMH,SAAgB,6BAA6B,MAA0B;AACrE,QAAO,EACL,MAAM,UAAU;AACd,SAAO;IAEV;;;;ACNH,S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YAAY;AACV,YAAO;;IAET,aAAa,KAAK,SAAS;IAC3B,UAAU;IACX,CAAC;AAEF,OAAI,WAAW,KACb,UAAS,KAAA,GAAW,OAAO;OAE3B,UAAS,KAAA,GAAW,OAAO,MAAM,OAAO,IAAc;WAEjD,OAAO;AACd,OAAI,iBAAiB,gBACnB,QAAO,SAAS,IAAI,MAAM,MAAM,MAAM,mBAAmB,CAAC,CAAC;AAG7D,OAAI,EAAE,iBAAiB,OAAQ,OAAM;AACrC,YAAS,MAAM;;;;AAKrB,SAAgB,MAAM,QAAgB;CACpC,SAAS,SAAS,QAA+C;AAE/D,MAAI,CAAC,OAAQ;AAEb,SAAO;GACL,UAAU,OAAO;GACjB,QAAQ,OAAO,cAAc;GAC9B;;AAGH,SAAQ,UAA6B;AAEnC,QAAM,OAAO,EAAE,QAAQ,OAAO,QAAQ,MAAM,GAAG,SAAS;GACtD,MAAM,CAAC,UAAU,QAAQ,MAAM,KAAK,KAAK,MAAM,KAAK,EAAE;GACtD,MAAM,QAAqB;IACzB,MAAM,YAAY;AAChB,YAAO,IAAI,KAAK,SAAS,CAAC,MAAM;;IAElC,OAAO,MAAM,MAAM;IACnB;IACA,aAAa;IACb,UAAU,EACR,gBAAgB,IACjB;IACF;AAED,OAAI,OAAO,KAAK,KACd,QAAO,OAAO,IAAI,KAAK,aAAa,UAAU,QAAQ,EAAE,MAAM;GAGhE,MAAM,SAAS,OAAO,KAAK,MAAM;AACjC,OAAI,kBAAkB,QACpB,QAAO,OAAO,KAAK,SAAS;AAE9B,UAAO,SAAS,OAAO;IACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as applyMdxPreset } from "./preset-
|
|
1
|
+
import { t as applyMdxPreset } from "./preset-B0H8HalE.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import picomatch from "picomatch";
|
|
4
4
|
//#region src/config/build.ts
|
|
@@ -96,4 +96,4 @@ function buildConfig(config, cwd = process.cwd()) {
|
|
|
96
96
|
//#endregion
|
|
97
97
|
export { buildConfig as t };
|
|
98
98
|
|
|
99
|
-
//# sourceMappingURL=build-
|
|
99
|
+
//# sourceMappingURL=build-DPafU2lu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-
|
|
1
|
+
{"version":3,"file":"build-DPafU2lu.js","names":[],"sources":["../src/config/build.ts"],"sourcesContent":["import type { ProcessorOptions } from '@mdx-js/mdx';\nimport type {\n AnyCollection,\n DocCollection,\n DocsCollection,\n GlobalConfig,\n MetaCollection,\n} from '@/config/define';\nimport picomatch from 'picomatch';\nimport { applyMdxPreset } from '@/config/preset';\nimport path from 'node:path';\n\nexport type BuildEnvironment = 'bundler' | 'runtime';\n\nexport interface LoadedConfig {\n collections: Map<string, CollectionItem>;\n global: GlobalConfig;\n getMDXOptions(\n collection?: DocCollectionItem,\n environment?: BuildEnvironment,\n ): ProcessorOptions | Promise<ProcessorOptions>;\n workspaces: Record<\n string,\n {\n dir: string;\n config: LoadedConfig;\n }\n >;\n}\n\nexport type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;\n\ninterface PrimitiveCollectionItem {\n name: string;\n cwd: string;\n /**\n * content directory (absolute)\n */\n dir: string;\n hasFile: (filePath: string) => boolean;\n isFileSupported: (filePath: string) => boolean;\n patterns: string[];\n}\n\nexport type MetaCollectionItem = PrimitiveCollectionItem & Omit<MetaCollection, 'files' | 'dir'>;\nexport type DocCollectionItem = PrimitiveCollectionItem & Omit<DocCollection, 'files' | 'dir'>;\n\nexport interface DocsCollectionItem\n extends Omit<DocsCollection, 'dir' | 'meta' | 'docs'>, Omit<PrimitiveCollectionItem, 'patterns'> {\n meta: MetaCollectionItem;\n docs: DocCollectionItem;\n}\n\nconst SupportedFormats = {\n doc: ['mdx', 'md'],\n meta: ['json', 'yaml'],\n};\n\nexport function buildCollection(\n name: string,\n collection: AnyCollection,\n cwd: string,\n): CollectionItem {\n if (collection.type === 'docs') {\n return {\n ...collection,\n type: 'docs',\n get dir() {\n return this.docs.dir;\n },\n name,\n meta: buildCollection(name, collection.meta, cwd) as MetaCollectionItem,\n docs: buildCollection(name, collection.docs, cwd) as DocCollectionItem,\n hasFile(filePath) {\n return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);\n },\n isFileSupported(filePath) {\n return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);\n },\n cwd,\n };\n }\n\n return {\n ...collection,\n ...buildPrimitiveCollection(name, collection, cwd),\n };\n}\n\nfunction buildPrimitiveCollection(\n name: string,\n config: DocCollection | MetaCollection,\n cwd: string,\n): PrimitiveCollectionItem {\n const supportedFormats = SupportedFormats[config.type];\n const patterns = config.files ?? [`**/*.{${supportedFormats.join(',')}}`];\n let matcher: picomatch.Matcher;\n\n return {\n dir: path.resolve(cwd, config.dir),\n cwd,\n name,\n patterns,\n isFileSupported(filePath) {\n return supportedFormats.some((format) => filePath.endsWith(`.${format}`));\n },\n hasFile(filePath) {\n if (!this.isFileSupported(filePath)) return false;\n\n const relativePath = path.relative(this.dir, filePath);\n if (relativePath.startsWith(`..${path.sep}`)) return false;\n\n return (matcher ??= picomatch(patterns))(relativePath);\n },\n };\n}\n\nexport function buildConfig(config: Record<string, unknown>, cwd = process.cwd()): LoadedConfig {\n const collections = new Map<string, CollectionItem>();\n const loaded: GlobalConfig = {};\n\n for (const [k, v] of Object.entries(config)) {\n if (!v) {\n continue;\n }\n\n if (typeof v === 'object' && 'type' in v) {\n if (v.type === 'docs' || v.type === 'doc' || v.type === 'meta') {\n collections.set(k, buildCollection(k, v as AnyCollection, cwd));\n continue;\n }\n }\n\n if (k === 'default' && v) {\n Object.assign(loaded, v);\n continue;\n }\n\n throw new Error(\n `Unknown export \"${k}\", you can only export collections from source configuration file.`,\n );\n }\n\n const mdxOptionsCache = new Map<string, ProcessorOptions | Promise<ProcessorOptions>>();\n return {\n global: loaded,\n collections,\n workspaces: Object.fromEntries(\n Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {\n return [\n key,\n {\n dir: value.dir,\n config: buildConfig(value.config, path.resolve(cwd, value.dir)),\n },\n ];\n }),\n ),\n getMDXOptions(collection, environment = 'bundler') {\n const key = collection ? `${environment}:${collection.name}` : environment;\n const cached = mdxOptionsCache.get(key);\n if (cached) return cached;\n let result: ProcessorOptions | Promise<ProcessorOptions>;\n\n if (collection?.mdxOptions) {\n const optionsFn = collection.mdxOptions;\n result = typeof optionsFn === 'function' ? optionsFn(environment) : optionsFn;\n } else {\n result = (async () => {\n const optionsFn = this.global.mdxOptions;\n const options = typeof optionsFn === 'function' ? await optionsFn() : optionsFn;\n\n return applyMdxPreset(options)(environment);\n })();\n }\n\n mdxOptionsCache.set(key, result);\n return result;\n },\n };\n}\n"],"mappings":";;;;AAqDA,MAAM,mBAAmB;CACvB,KAAK,CAAC,OAAO,KAAK;CAClB,MAAM,CAAC,QAAQ,OAAO;CACvB;AAED,SAAgB,gBACd,MACA,YACA,KACgB;AAChB,KAAI,WAAW,SAAS,OACtB,QAAO;EACL,GAAG;EACH,MAAM;EACN,IAAI,MAAM;AACR,UAAO,KAAK,KAAK;;EAEnB;EACA,MAAM,gBAAgB,MAAM,WAAW,MAAM,IAAI;EACjD,MAAM,gBAAgB,MAAM,WAAW,MAAM,IAAI;EACjD,QAAQ,UAAU;AAChB,UAAO,KAAK,KAAK,QAAQ,SAAS,IAAI,KAAK,KAAK,QAAQ,SAAS;;EAEnE,gBAAgB,UAAU;AACxB,UAAO,KAAK,KAAK,gBAAgB,SAAS,IAAI,KAAK,KAAK,gBAAgB,SAAS;;EAEnF;EACD;AAGH,QAAO;EACL,GAAG;EACH,GAAG,yBAAyB,MAAM,YAAY,IAAI;EACnD;;AAGH,SAAS,yBACP,MACA,QACA,KACyB;CACzB,MAAM,mBAAmB,iBAAiB,OAAO;CACjD,MAAM,WAAW,OAAO,SAAS,CAAC,SAAS,iBAAiB,KAAK,IAAI,CAAC,GAAG;CACzE,IAAI;AAEJ,QAAO;EACL,KAAK,KAAK,QAAQ,KAAK,OAAO,I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Q,QAAO;GACnB,IAAI;AAEJ,OAAI,YAAY,YAAY;IAC1B,MAAM,YAAY,WAAW;AAC7B,aAAS,OAAO,cAAc,aAAa,UAAU,YAAY,GAAG;SAEpE,WAAU,YAAY;IACpB,MAAM,YAAY,KAAK,OAAO;AAG9B,WAAO,eAFS,OAAO,cAAc,aAAa,MAAM,WAAW,GAAG,UAExC,CAAC,YAAY;OACzC;AAGN,mBAAgB,IAAI,KAAK,OAAO;AAChC,UAAO;;EAEV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
|
|
2
|
-
import { n as flattenNode, t as remarkInclude } from "./remark-include-
|
|
2
|
+
import { n as flattenNode, t as remarkInclude } from "./remark-include-VDoXZSBN.js";
|
|
3
3
|
import { visit } from "unist-util-visit";
|
|
4
4
|
import { VFile } from "vfile";
|
|
5
5
|
import { createProcessor } from "@mdx-js/mdx";
|
|
@@ -304,4 +304,4 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
|
|
|
304
304
|
//#endregion
|
|
305
305
|
export { build_mdx_exports as n, buildMDX as t };
|
|
306
306
|
|
|
307
|
-
//# sourceMappingURL=build-mdx-
|
|
307
|
+
//# sourceMappingURL=build-mdx-82nyqL4J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-mdx-iu_4pINO.js","names":[],"sources":["../../core/dist/utils-pSG8hSr9.js","../../core/dist/mdx-plugins/stringifier.js","../../core/dist/mdx-plugins/remark-llms.js","../src/loaders/mdx/remark-postprocess.ts","../src/loaders/mdx/build-mdx.ts"],"sourcesContent":["import { valueToEstree } from \"estree-util-value-to-estree\";\n//#region src/mdx-plugins/utils.ts\nfunction flattenNode(node) {\n\tif (\"children\" in node) return node.children.map(flattenNode).join(\"\");\n\tif (\"value\" in node && typeof node.value === \"string\") return node.value;\n\treturn \"\";\n}\nfunction flattenNodeHast(node) {\n\tif (\"children\" in node) return node.children.map(flattenNodeHast).join(\"\");\n\treturn \"value\" in node && typeof node.value === \"string\" ? node.value : \"\";\n}\nfunction toMdxExport(name, value) {\n\treturn toMdxExportRaw(name, valueToEstree(value));\n}\nfunction toMdxExportRaw(name, expression) {\n\treturn {\n\t\ttype: \"mdxjsEsm\",\n\t\tvalue: \"\",\n\t\tdata: { estree: {\n\t\t\ttype: \"Program\",\n\t\t\tsourceType: \"module\",\n\t\t\tbody: [{\n\t\t\t\ttype: \"ExportNamedDeclaration\",\n\t\t\t\tattributes: [],\n\t\t\t\tspecifiers: [],\n\t\t\t\tdeclaration: {\n\t\t\t\t\ttype: \"VariableDeclaration\",\n\t\t\t\t\tkind: \"let\",\n\t\t\t\t\tdeclarations: [{\n\t\t\t\t\t\ttype: \"VariableDeclarator\",\n\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\ttype: \"Identifier\",\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinit: expression\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\t\t}]\n\t\t} }\n\t};\n}\nfunction handleTag(value, tag) {\n\tconst idx = value.indexOf(tag);\n\tif (idx !== -1) return value.slice(0, idx).trimEnd() + value.slice(idx + tag.length);\n\treturn false;\n}\n//#endregion\nexport { toMdxExportRaw as a, toMdxExport as i, flattenNodeHast as n, handleTag as r, flattenNode as t };\n","import { mdxToMarkdown } from \"mdast-util-mdx\";\nimport { toMarkdown } from \"mdast-util-to-markdown\";\n//#region src/mdx-plugins/stringifier.ts\nfunction defaultStringifier(config = {}) {\n\tconst { filterMdxAttributes, filterElement = (node) => {\n\t\tswitch (node.type) {\n\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\tcase \"mdxJsxTextElement\":\n\t\t\t\tswitch (node.name) {\n\t\t\t\t\tcase \"File\":\n\t\t\t\t\tcase \"TypeTable\":\n\t\t\t\t\tcase \"Callout\":\n\t\t\t\t\tcase \"Card\": return true;\n\t\t\t\t}\n\t\t\t\treturn \"children-only\";\n\t\t}\n\t\treturn true;\n\t}, stringify, ...customExtension } = config;\n\tfunction modHandler(handler, ctx) {\n\t\treturn function(node, parent, state, info) {\n\t\t\tlet visibility = filterElement(node);\n\t\t\tif (visibility === false) return \"\";\n\t\t\tif (stringify) {\n\t\t\t\tconst v = stringify(node, parent, state, info, ctx);\n\t\t\t\tif (v) return v;\n\t\t\t}\n\t\t\tconst extraInfo = node.data?._stringify;\n\t\t\tif (extraInfo) if (extraInfo === \"children-only\") visibility = \"children-only\";\n\t\t\telse if (\"text\" in extraInfo) return extraInfo.text;\n\t\t\telse node = extraInfo.node;\n\t\t\tif (visibility === \"children-only\") {\n\t\t\t\tif (!(\"children\" in node)) return \"\";\n\t\t\t\tswitch (node.type) {\n\t\t\t\t\tcase \"mdxJsxTextElement\":\n\t\t\t\t\tcase \"paragraph\": return state.containerPhrasing(node, info);\n\t\t\t\t\tcase \"mdxJsxFlowElement\": return state.containerFlow(node, info);\n\t\t\t\t\tdefault: return state.containerFlow({\n\t\t\t\t\t\ttype: \"root\",\n\t\t\t\t\t\tchildren: node.children\n\t\t\t\t\t}, info);\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch (node.type) {\n\t\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\t\tcase \"mdxJsxTextElement\": {\n\t\t\t\t\tconst stringifiedAttributes = [];\n\t\t\t\t\tfor (const attr of node.attributes) {\n\t\t\t\t\t\tif (attr.type === \"mdxJsxExpressionAttribute\") continue;\n\t\t\t\t\t\tif (filterMdxAttributes && !filterMdxAttributes(node, attr)) continue;\n\t\t\t\t\t\tconst str = typeof attr.value === \"string\" ? attr.value : attr.value?.value;\n\t\t\t\t\t\tif (!str) continue;\n\t\t\t\t\t\tstringifiedAttributes.push({\n\t\t\t\t\t\t\ttype: \"mdxJsxAttribute\",\n\t\t\t\t\t\t\tname: attr.name,\n\t\t\t\t\t\t\tvalue: str\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn handler({\n\t\t\t\t\t\t...node,\n\t\t\t\t\t\tattributes: stringifiedAttributes\n\t\t\t\t\t}, parent, state, info);\n\t\t\t\t}\n\t\t\t\tdefault: return handler(node, parent, state, info);\n\t\t\t}\n\t\t};\n\t}\n\tconst customToMarkdown = { handlers: { _custom(node, _, state, info) {\n\t\tconst handlers = state.handlers;\n\t\tfor (const k in handlers) handlers[k] = modHandler(handlers[k], node.ctx);\n\t\treturn state.handle(node.root, void 0, state, info);\n\t} } };\n\treturn function(root, ctx) {\n\t\treturn toMarkdown({\n\t\t\ttype: \"_custom\",\n\t\t\troot,\n\t\t\tctx\n\t\t}, {\n\t\t\t...this?.data(\"settings\"),\n\t\t\textensions: [\n\t\t\t\tmdxToMarkdown(),\n\t\t\t\t...this?.data(\"toMarkdownExtensions\") ?? [],\n\t\t\t\tcustomToMarkdown,\n\t\t\t\tcustomExtension\n\t\t\t]\n\t\t});\n\t};\n}\n//#endregion\nexport { defaultStringifier };\n","import { i as toMdxExport } from \"../utils-pSG8hSr9.js\";\nimport { defaultStringifier } from \"./stringifier.js\";\nimport { defaultHandlers } from \"mdast-util-to-markdown\";\n//#region src/mdx-plugins/remark-llms.ts\n/**\n* generate `llms.txt` for markdown.\n*/\nfunction remarkLLMs({ as = \"_markdown\", headingIds = true, _data = false, mdxAsPlaceholder, ...rest } = {}) {\n\tconst stringifier = defaultStringifier({\n\t\t...rest,\n\t\tfilterElement(node) {\n\t\t\tswitch (node.type) {\n\t\t\t\tcase \"mdxjsEsm\": return false;\n\t\t\t\tdefault: return true;\n\t\t\t}\n\t\t},\n\t\tstringify(node, parent, state, info, ctx) {\n\t\t\tif (mdxAsPlaceholder) switch (node.type) {\n\t\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\t\tcase \"mdxJsxTextElement\": if (node.name && mdxAsPlaceholder.includes(node.name)) return placeholder(node, parent, state, info);\n\t\t\t}\n\t\t\treturn rest.stringify?.(node, parent, state, info, ctx);\n\t\t},\n\t\thandlers: {\n\t\t\theading(node, _p, state, info) {\n\t\t\t\tconst id = node.data?.hProperties?.id;\n\t\t\t\tconst defaultValue = defaultHandlers.heading(node, _p, state, info);\n\t\t\t\treturn headingIds && id ? `${defaultValue} [#${id}]` : defaultValue;\n\t\t\t},\n\t\t\t...rest.handlers\n\t\t}\n\t});\n\treturn (node, file) => {\n\t\tconst value = stringifier.call(this, node, void 0);\n\t\tnode.children.unshift(toMdxExport(as, value));\n\t\tif (_data) file.data.markdown = value;\n\t};\n}\n/**\n* Preserve AST data to render the MDX component at runtime, use `renderPlaceholder()` to render the placeholders.\n*/\nfunction placeholder(node, _parent, state, info) {\n\tconst attributes = {};\n\tfor (const attr of node.attributes) {\n\t\tif (attr.type === \"mdxJsxExpressionAttribute\") continue;\n\t\tattributes[attr.name] = attr.value;\n\t}\n\treturn `\\0${JSON.stringify({\n\t\tname: node.name,\n\t\tchildren: state.containerPhrasing(node, info),\n\t\tattributes\n\t})}\\0`;\n}\n//#endregion\nexport { placeholder, remarkLLMs };\n","import type { Processor, Transformer } from 'unified';\nimport type { Root, RootContent } from 'mdast';\nimport { visit } from 'unist-util-visit';\nimport { valueToEstree } from 'estree-util-value-to-estree';\nimport { removePosition } from 'unist-util-remove-position';\nimport { flattenNode } from './mdast-utils';\nimport type { LLMsOptions } from 'fumadocs-core/mdx-plugins';\nimport { remarkLLMs } from 'fumadocs-core/mdx-plugins/remark-llms';\n\nexport interface ExtractedReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: 'md' | 'mdx';\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n includeProcessedMarkdown?: boolean | LLMsOptions;\n\n /**\n * extract link references, export via `extractedReferences`.\n */\n extractLinkReferences?: boolean;\n\n /**\n * store MDAST and export via `_mdast`.\n */\n includeMDAST?:\n | boolean\n | {\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n includeProcessedMarkdown = false,\n includeMDAST = false,\n extractLinkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, 'heading', (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data['mdx-export'] ??= [];\n file.data['mdx-export'].push({\n name: 'frontmatter',\n value: frontmatter,\n });\n\n if (extractLinkReferences) {\n const urls: ExtractedReference[] = [];\n\n visit(tree, 'link', (node) => {\n urls.push({\n href: node.url,\n });\n return 'skip';\n });\n\n file.data['mdx-export'].push({\n name: 'extractedReferences',\n value: urls,\n });\n }\n\n if (includeProcessedMarkdown) {\n const llms = remarkLLMs.call(\n this,\n typeof includeProcessedMarkdown === 'object' ? includeProcessedMarkdown : undefined,\n );\n llms(tree, file, () => undefined);\n }\n\n if (includeMDAST) {\n const options = includeMDAST === true ? {} : includeMDAST;\n const mdast = JSON.stringify(\n options.removePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data['mdx-export'].push({\n name: '_mdast',\n value: mdast,\n });\n }\n\n for (const { name, value } of file.data['mdx-export']) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data['mdx-export'] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: [\n {\n type: 'ExportNamedDeclaration',\n attributes: [],\n specifiers: [],\n source: null,\n declaration: {\n type: 'VariableDeclaration',\n kind: 'let',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: {\n type: 'Identifier',\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import { createProcessor } from '@mdx-js/mdx';\nimport { VFile } from 'vfile';\nimport { remarkInclude } from '@/loaders/mdx/remark-include';\nimport type { StructuredData } from 'fumadocs-core/mdx-plugins';\nimport type { TOCItemType } from 'fumadocs-core/toc';\nimport type { FC } from 'react';\nimport type { MDXProps } from 'mdx/types';\nimport { type PostprocessOptions, remarkPostprocess } from '@/loaders/mdx/remark-postprocess';\nimport type { Core } from '@/core';\nimport type { DocCollectionItem } from '@/config/build';\n\ntype Processor = ReturnType<typeof createProcessor>;\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: 'bundler' | 'runtime';\n isDevelopment: boolean;\n _compiler?: CompilerOptions;\n}\n\nexport interface CompilerOptions {\n addDependency: (file: string) => void;\n}\n\nexport interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {\n frontmatter: Frontmatter;\n structuredData: StructuredData;\n toc: TOCItemType[];\n default: FC<MDXProps>;\n\n /**\n * Enable from `postprocess` option.\n */\n _markdown?: string;\n /**\n * Enable from `postprocess` option.\n */\n _mdast?: string;\n}\n\nexport interface FumadocsDataMap {\n /**\n * [Fumadocs MDX] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fumadocs MDX] additional ESM exports to write\n */\n 'mdx-export'?: { name: string; value: unknown }[];\n\n /**\n * [Fumadocs MDX] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Fumadocs MDX] get internal processor, do not use this on user land.\n */\n _getProcessor?: (format: 'md' | 'mdx') => Processor;\n}\n\ndeclare module 'vfile' {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends FumadocsDataMap {}\n}\n\nexport async function buildMDX(\n core: Core,\n collection: DocCollectionItem | undefined,\n { filePath, frontmatter, source, _compiler, environment, isDevelopment }: BuildMDXOptions,\n): Promise<VFile> {\n const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);\n\n function getProcessor(format: 'md' | 'mdx') {\n const cache = core.cache as Map<string, Processor>;\n const key = `build-mdx:${collection?.name ?? 'global'}:${format}`;\n let processor = cache.get(key);\n\n if (!processor) {\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...collection?.postprocess,\n };\n\n processor = createProcessor({\n outputFormat: 'program',\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n remarkInclude,\n ...(mdxOptions.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n\n cache.set(key, processor);\n }\n\n return processor;\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: collection?.cwd,\n data: { frontmatter, _compiler, _getProcessor: getProcessor },\n });\n\n if (collection) {\n vfile = await core.transformVFile({ collection, filePath, source }, vfile);\n }\n\n return getProcessor(filePath.endsWith('.mdx') ? 'mdx' : 'md').process(vfile);\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAS,YAAY,MAAM,OAAO;AACjC,QAAO,eAAe,MAAM,cAAc,MAAM,CAAC;;AAElD,SAAS,eAAe,MAAM,YAAY;AACzC,QAAO;EACN,MAAM;EACN,OAAO;EACP,MAAM,EAAE,QAAQ;GACf,MAAM;GACN,YAAY;GACZ,MAAM,CAAC;IACN,MAAM;IACN,YAAY,EAAE;IACd,YAAY,EAAE;IACd,aAAa;KACZ,MAAM;KACN,MAAM;KACN,cAAc,CAAC;MACd,MAAM;MACN,IAAI;OACH,MAAM;OACN;OACA;MACD,MAAM;MACN,CAAC;KACF;IACD,CAAC;GACF,EAAE;EACH;;;;ACpCF,SAAS,mBAAmB,SAAS,EAAE,EAAE;CACxC,MAAM,EAAE,qBAAqB,iBAAiB,SAAS;AACtD,UAAQ,KAAK,MAAb;GACC,KAAK;GACL,KAAK;AACJ,YAAQ,KAAK,MAAb;KACC,KAAK;KACL,KAAK;KAC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AAI,QAAQ,IAAI,MAAM;EACpB,OAAO;EACP,MAAM;EACN,KAAK,YAAY;EACjB,MAAM;GAAE;GAAa;GAAW,eAAe;GAAc;EAC9D,CAAC;AAEF,KAAI,WACF,SAAQ,MAAM,KAAK,eAAe;EAAE;EAAY;EAAU;EAAQ,EAAE,MAAM;AAG5E,QAAO,aAAa,SAAS,SAAS,OAAO,GAAG,QAAQ,KAAK,CAAC,QAAQ,MAAM"}
|
|
1
|
+
{"version":3,"file":"build-mdx-82nyqL4J.js","names":[],"sources":["../../core/dist/utils-pSG8hSr9.js","../../core/dist/mdx-plugins/stringifier.js","../../core/dist/mdx-plugins/remark-llms.js","../src/loaders/mdx/remark-postprocess.ts","../src/loaders/mdx/build-mdx.ts"],"sourcesContent":["import { valueToEstree } from \"estree-util-value-to-estree\";\n//#region src/mdx-plugins/utils.ts\nfunction flattenNode(node) {\n\tif (\"children\" in node) return node.children.map(flattenNode).join(\"\");\n\tif (\"value\" in node && typeof node.value === \"string\") return node.value;\n\treturn \"\";\n}\nfunction flattenNodeHast(node) {\n\tif (\"children\" in node) return node.children.map(flattenNodeHast).join(\"\");\n\treturn \"value\" in node && typeof node.value === \"string\" ? node.value : \"\";\n}\nfunction toMdxExport(name, value) {\n\treturn toMdxExportRaw(name, valueToEstree(value));\n}\nfunction toMdxExportRaw(name, expression) {\n\treturn {\n\t\ttype: \"mdxjsEsm\",\n\t\tvalue: \"\",\n\t\tdata: { estree: {\n\t\t\ttype: \"Program\",\n\t\t\tsourceType: \"module\",\n\t\t\tbody: [{\n\t\t\t\ttype: \"ExportNamedDeclaration\",\n\t\t\t\tattributes: [],\n\t\t\t\tspecifiers: [],\n\t\t\t\tdeclaration: {\n\t\t\t\t\ttype: \"VariableDeclaration\",\n\t\t\t\t\tkind: \"let\",\n\t\t\t\t\tdeclarations: [{\n\t\t\t\t\t\ttype: \"VariableDeclarator\",\n\t\t\t\t\t\tid: {\n\t\t\t\t\t\t\ttype: \"Identifier\",\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinit: expression\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\t\t}]\n\t\t} }\n\t};\n}\nfunction handleTag(value, tag) {\n\tconst idx = value.indexOf(tag);\n\tif (idx !== -1) return value.slice(0, idx).trimEnd() + value.slice(idx + tag.length);\n\treturn false;\n}\n//#endregion\nexport { toMdxExportRaw as a, toMdxExport as i, flattenNodeHast as n, handleTag as r, flattenNode as t };\n","import { mdxToMarkdown } from \"mdast-util-mdx\";\nimport { toMarkdown } from \"mdast-util-to-markdown\";\n//#region src/mdx-plugins/stringifier.ts\nfunction defaultStringifier(config = {}) {\n\tconst { filterMdxAttributes, filterElement = (node) => {\n\t\tswitch (node.type) {\n\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\tcase \"mdxJsxTextElement\":\n\t\t\t\tswitch (node.name) {\n\t\t\t\t\tcase \"File\":\n\t\t\t\t\tcase \"TypeTable\":\n\t\t\t\t\tcase \"Callout\":\n\t\t\t\t\tcase \"Card\": return true;\n\t\t\t\t}\n\t\t\t\treturn \"children-only\";\n\t\t}\n\t\treturn true;\n\t}, stringify, ...customExtension } = config;\n\tfunction modHandler(handler, ctx) {\n\t\treturn function(node, parent, state, info) {\n\t\t\tlet visibility = filterElement(node);\n\t\t\tif (visibility === false) return \"\";\n\t\t\tif (stringify) {\n\t\t\t\tconst v = stringify(node, parent, state, info, ctx);\n\t\t\t\tif (v) return v;\n\t\t\t}\n\t\t\tconst extraInfo = node.data?._stringify;\n\t\t\tif (extraInfo) if (extraInfo === \"children-only\") visibility = \"children-only\";\n\t\t\telse if (\"text\" in extraInfo) return extraInfo.text;\n\t\t\telse node = extraInfo.node;\n\t\t\tif (visibility === \"children-only\") {\n\t\t\t\tif (!(\"children\" in node)) return \"\";\n\t\t\t\tswitch (node.type) {\n\t\t\t\t\tcase \"mdxJsxTextElement\":\n\t\t\t\t\tcase \"paragraph\": return state.containerPhrasing(node, info);\n\t\t\t\t\tcase \"mdxJsxFlowElement\": return state.containerFlow(node, info);\n\t\t\t\t\tdefault: return state.containerFlow({\n\t\t\t\t\t\ttype: \"root\",\n\t\t\t\t\t\tchildren: node.children\n\t\t\t\t\t}, info);\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch (node.type) {\n\t\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\t\tcase \"mdxJsxTextElement\": {\n\t\t\t\t\tconst stringifiedAttributes = [];\n\t\t\t\t\tfor (const attr of node.attributes) {\n\t\t\t\t\t\tif (attr.type === \"mdxJsxExpressionAttribute\") continue;\n\t\t\t\t\t\tif (filterMdxAttributes && !filterMdxAttributes(node, attr)) continue;\n\t\t\t\t\t\tconst str = typeof attr.value === \"string\" ? attr.value : attr.value?.value;\n\t\t\t\t\t\tif (!str) continue;\n\t\t\t\t\t\tstringifiedAttributes.push({\n\t\t\t\t\t\t\ttype: \"mdxJsxAttribute\",\n\t\t\t\t\t\t\tname: attr.name,\n\t\t\t\t\t\t\tvalue: str\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn handler({\n\t\t\t\t\t\t...node,\n\t\t\t\t\t\tattributes: stringifiedAttributes\n\t\t\t\t\t}, parent, state, info);\n\t\t\t\t}\n\t\t\t\tdefault: return handler(node, parent, state, info);\n\t\t\t}\n\t\t};\n\t}\n\tconst customToMarkdown = { handlers: { _custom(node, _, state, info) {\n\t\tconst handlers = state.handlers;\n\t\tfor (const k in handlers) handlers[k] = modHandler(handlers[k], node.ctx);\n\t\treturn state.handle(node.root, void 0, state, info);\n\t} } };\n\treturn function(root, ctx) {\n\t\treturn toMarkdown({\n\t\t\ttype: \"_custom\",\n\t\t\troot,\n\t\t\tctx\n\t\t}, {\n\t\t\t...this?.data(\"settings\"),\n\t\t\textensions: [\n\t\t\t\tmdxToMarkdown(),\n\t\t\t\t...this?.data(\"toMarkdownExtensions\") ?? [],\n\t\t\t\tcustomToMarkdown,\n\t\t\t\tcustomExtension\n\t\t\t]\n\t\t});\n\t};\n}\n//#endregion\nexport { defaultStringifier };\n","import { i as toMdxExport } from \"../utils-pSG8hSr9.js\";\nimport { defaultStringifier } from \"./stringifier.js\";\nimport { defaultHandlers } from \"mdast-util-to-markdown\";\n//#region src/mdx-plugins/remark-llms.ts\n/**\n* generate `llms.txt` for markdown.\n*/\nfunction remarkLLMs({ as = \"_markdown\", headingIds = true, _data = false, mdxAsPlaceholder, ...rest } = {}) {\n\tconst stringifier = defaultStringifier({\n\t\t...rest,\n\t\tfilterElement(node) {\n\t\t\tswitch (node.type) {\n\t\t\t\tcase \"mdxjsEsm\": return false;\n\t\t\t\tdefault: return true;\n\t\t\t}\n\t\t},\n\t\tstringify(node, parent, state, info, ctx) {\n\t\t\tif (mdxAsPlaceholder) switch (node.type) {\n\t\t\t\tcase \"mdxJsxFlowElement\":\n\t\t\t\tcase \"mdxJsxTextElement\": if (node.name && mdxAsPlaceholder.includes(node.name)) return placeholder(node, parent, state, info);\n\t\t\t}\n\t\t\treturn rest.stringify?.(node, parent, state, info, ctx);\n\t\t},\n\t\thandlers: {\n\t\t\theading(node, _p, state, info) {\n\t\t\t\tconst id = node.data?.hProperties?.id;\n\t\t\t\tconst defaultValue = defaultHandlers.heading(node, _p, state, info);\n\t\t\t\treturn headingIds && id ? `${defaultValue} [#${id}]` : defaultValue;\n\t\t\t},\n\t\t\t...rest.handlers\n\t\t}\n\t});\n\treturn (node, file) => {\n\t\tconst value = stringifier.call(this, node, void 0);\n\t\tnode.children.unshift(toMdxExport(as, value));\n\t\tif (_data) file.data.markdown = value;\n\t};\n}\n/**\n* Preserve AST data to render the MDX component at runtime, use `renderPlaceholder()` to render the placeholders.\n*/\nfunction placeholder(node, _parent, state, info) {\n\tconst attributes = {};\n\tfor (const attr of node.attributes) {\n\t\tif (attr.type === \"mdxJsxExpressionAttribute\") continue;\n\t\tattributes[attr.name] = attr.value;\n\t}\n\treturn `\\0${JSON.stringify({\n\t\tname: node.name,\n\t\tchildren: state.containerPhrasing(node, info),\n\t\tattributes\n\t})}\\0`;\n}\n//#endregion\nexport { placeholder, remarkLLMs };\n","import type { Processor, Transformer } from 'unified';\nimport type { Root, RootContent } from 'mdast';\nimport { visit } from 'unist-util-visit';\nimport { valueToEstree } from 'estree-util-value-to-estree';\nimport { removePosition } from 'unist-util-remove-position';\nimport { flattenNode } from './mdast-utils';\nimport type { LLMsOptions } from 'fumadocs-core/mdx-plugins';\nimport { remarkLLMs } from 'fumadocs-core/mdx-plugins/remark-llms';\n\nexport interface ExtractedReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: 'md' | 'mdx';\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n includeProcessedMarkdown?: boolean | LLMsOptions;\n\n /**\n * extract link references, export via `extractedReferences`.\n */\n extractLinkReferences?: boolean;\n\n /**\n * store MDAST and export via `_mdast`.\n */\n includeMDAST?:\n | boolean\n | {\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n includeProcessedMarkdown = false,\n includeMDAST = false,\n extractLinkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, 'heading', (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data['mdx-export'] ??= [];\n file.data['mdx-export'].push({\n name: 'frontmatter',\n value: frontmatter,\n });\n\n if (extractLinkReferences) {\n const urls: ExtractedReference[] = [];\n\n visit(tree, 'link', (node) => {\n urls.push({\n href: node.url,\n });\n return 'skip';\n });\n\n file.data['mdx-export'].push({\n name: 'extractedReferences',\n value: urls,\n });\n }\n\n if (includeProcessedMarkdown) {\n const llms = remarkLLMs.call(\n this,\n typeof includeProcessedMarkdown === 'object' ? includeProcessedMarkdown : undefined,\n );\n llms(tree, file, () => undefined);\n }\n\n if (includeMDAST) {\n const options = includeMDAST === true ? {} : includeMDAST;\n const mdast = JSON.stringify(\n options.removePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data['mdx-export'].push({\n name: '_mdast',\n value: mdast,\n });\n }\n\n for (const { name, value } of file.data['mdx-export']) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data['mdx-export'] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: [\n {\n type: 'ExportNamedDeclaration',\n attributes: [],\n specifiers: [],\n source: null,\n declaration: {\n type: 'VariableDeclaration',\n kind: 'let',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: {\n type: 'Identifier',\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import { createProcessor } from '@mdx-js/mdx';\nimport { VFile } from 'vfile';\nimport { remarkInclude } from '@/loaders/mdx/remark-include';\nimport type { StructuredData } from 'fumadocs-core/mdx-plugins';\nimport type { TOCItemType } from 'fumadocs-core/toc';\nimport type { FC } from 'react';\nimport type { MDXProps } from 'mdx/types';\nimport { type PostprocessOptions, remarkPostprocess } from '@/loaders/mdx/remark-postprocess';\nimport type { Core } from '@/core';\nimport type { DocCollectionItem } from '@/config/build';\n\ntype Processor = ReturnType<typeof createProcessor>;\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: 'bundler' | 'runtime';\n isDevelopment: boolean;\n _compiler?: CompilerOptions;\n}\n\nexport interface CompilerOptions {\n addDependency: (file: string) => void;\n}\n\nexport interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {\n frontmatter: Frontmatter;\n structuredData: StructuredData;\n toc: TOCItemType[];\n default: FC<MDXProps>;\n\n /**\n * Enable from `postprocess` option.\n */\n _markdown?: string;\n /**\n * Enable from `postprocess` option.\n */\n _mdast?: string;\n}\n\nexport interface FumadocsDataMap {\n /**\n * [Fumadocs MDX] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fumadocs MDX] additional ESM exports to write\n */\n 'mdx-export'?: { name: string; value: unknown }[];\n\n /**\n * [Fumadocs MDX] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Fumadocs MDX] get internal processor, do not use this on user land.\n */\n _getProcessor?: (format: 'md' | 'mdx') => Processor;\n}\n\ndeclare module 'vfile' {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends FumadocsDataMap {}\n}\n\nexport async function buildMDX(\n core: Core,\n collection: DocCollectionItem | undefined,\n { filePath, frontmatter, source, _compiler, environment, isDevelopment }: BuildMDXOptions,\n): Promise<VFile> {\n const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);\n\n function getProcessor(format: 'md' | 'mdx') {\n const cache = core.cache as Map<string, Processor>;\n const key = `build-mdx:${collection?.name ?? 'global'}:${format}`;\n let processor = cache.get(key);\n\n if (!processor) {\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...collection?.postprocess,\n };\n\n processor = createProcessor({\n outputFormat: 'program',\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n remarkInclude,\n ...(mdxOptions.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n\n cache.set(key, processor);\n }\n\n return processor;\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: collection?.cwd,\n data: { frontmatter, _compiler, _getProcessor: getProcessor },\n });\n\n if (collection) {\n vfile = await core.transformVFile({ collection, filePath, source }, vfile);\n }\n\n return getProcessor(filePath.endsWith('.mdx') ? 'mdx' : 'md').process(vfile);\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAS,YAAY,MAAM,OAAO;AACjC,QAAO,eAAe,MAAM,cAAc,MAAM,CAAC;;AAElD,SAAS,eAAe,MAAM,YAAY;AACzC,QAAO;EACN,MAAM;EACN,OAAO;EACP,MAAM,EAAE,QAAQ;GACf,MAAM;GACN,YAAY;GACZ,MAAM,CAAC;IACN,MAAM;IACN,YAAY,EAAE;IACd,YAAY,EAAE;IACd,aAAa;KACZ,MAAM;KACN,MAAM;KACN,cAAc,CAAC;MACd,MAAM;MACN,IAAI;OACH,MAAM;OACN;OACA;MACD,MAAM;MACN,CAAC;KACF;IACD,CAAC;GACF,EAAE;EACH;;;;ACpCF,SAAS,mBAAmB,SAAS,EAAE,EAAE;CACxC,MAAM,EAAE,qBAAqB,iBAAiB,SAAS;AACtD,UAAQ,KAAK,MAAb;GACC,KAAK;GACL,KAAK;AACJ,YAAQ,KAAK,MAAb;KACC,KAAK;KACL,KAAK;KACL,KAAK;KACL,KAAK,OAAQ,QAAO;;AAErB,WAAO;;AAET,SAAO;IACL,WAAW,GAAG,oBAAoB;CACrC,SAAS,WAAW,SAAS,KAAK;AACjC,SAAO,SAAS,MAAM,QAAQ,OAAO,MAAM;GAC1C,IAAI,aAAa,cAAc,KAAK;AACpC,OAAI,eAAe,MAAO,QAAO;AACjC,OAAI,WAAW;IACd,MAAM,IAAI,UAAU,MAAM,QAAQ,OAAO,MAAM,IAAI;AACnD,QAAI,EAAG,QAAO;;GAEf,MAAM,YAAY,KAAK,MAAM;AAC7B,OAAI,UAAW,KAAI,cAAc,gBAAiB,cAAa;YACtD,UAAU,UAAW,QAAO,UAAU;OAC1C,QAAO,UAAU;AACtB,OAAI,eAAe,iBAAiB;AACnC,QAAI,EAAE,cAAc,MAAO,QAAO;AAClC,YAAQ,KAAK,MAAb;KACC,KAAK;KACL,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MAAA;EACnD,WAAA,EAAa,WAAA;EACb,cAAA,EAAgB,cAAA;EAChB,GAAA,EAAK,WAAA;EACL,OAAA,EAAS,EAAA,CAAG,QAAA;EAAD;;;EAKX,SAAA;EARA;;;EAYA,MAAA;AAAA;AAAA,UAGe,eAAA;EAZf;;;EAgBA,WAAA,GAAc,MAAA;EAPd;;;EAYA,YAAA;IAAiB,IAAA;IAAc,KAAA;EAAA;EAKnB;;;EAAZ,SAAA,GAAY,eAAA;EAVZ;;;EAeA,aAAA,IAAiB,MAAA,mBAAyB,SAAA;AAAA;AAAA;EAAA,UAKhC,OAAA,SAAgB,eAAA;AAAA"}
|
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { t as buildConfig } from "../build-
|
|
3
|
-
import { n as createCore, t as _Defaults } from "../core-
|
|
4
|
-
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-
|
|
5
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-D2vcWdqv.js";
|
|
2
|
+
import { t as buildConfig } from "../build-DPafU2lu.js";
|
|
3
|
+
import { n as createCore, t as _Defaults } from "../core-Wd5WdPN4.js";
|
|
4
|
+
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DVxULZiU.js";
|
|
5
|
+
import { t as createMetaLoader } from "../meta-B6guI74I.js";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
//#region src/bun/index.ts
|
|
8
8
|
function createMdxPlugin(options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen-
|
|
1
|
+
{"version":3,"file":"codegen-B8EhLmbU.js","names":[],"sources":["../src/utils/codegen.ts"],"sourcesContent":["import path from 'node:path';\nimport { glob } from 'tinyglobby';\n\nexport interface GlobImportOptions {\n base: string;\n query?: Record<string, string | undefined>;\n import?: string;\n eager?: boolean;\n}\n\nexport interface CodeGenOptions {\n target: 'default' | 'vite';\n outDir: string;\n /**\n * add .js extension to imports\n */\n jsExtension: boolean;\n globCache: Map<string, Promise<string[]>>;\n}\n\nexport type CodeGen = ReturnType<typeof createCodegen>;\n\n/**\n * Code generator (one instance per file)\n */\nexport function createCodegen({\n target = 'default',\n outDir = '',\n jsExtension = false,\n globCache = new Map(),\n}: Partial<CodeGenOptions>) {\n let eagerImportId = 0;\n const banner: string[] = ['// @ts-nocheck'];\n\n if (target === 'vite') {\n banner.push('/// <reference types=\"vite/client\" />');\n }\n\n return {\n options: {\n target,\n outDir,\n } as CodeGenOptions,\n lines: [] as string[],\n addImport(statement: string) {\n this.lines.unshift(statement);\n },\n async pushAsync(insert: Promise<string | undefined>[]) {\n for (const line of await Promise.all(insert)) {\n if (line === undefined) continue;\n\n this.lines.push(line);\n }\n },\n\n async generateGlobImport(\n patterns: string | string[],\n options: GlobImportOptions,\n ): Promise<string> {\n if (target === 'vite') {\n return this.generateViteGlobImport(patterns, options);\n }\n\n return this.generateNodeGlobImport(patterns, options);\n },\n\n generateViteGlobImport(\n patterns: string | string[],\n { base, ...rest }: GlobImportOptions,\n ): string {\n patterns = (typeof patterns === 'string' ? [patterns] : patterns).map(normalizeViteGlobPath);\n\n return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(\n {\n base: normalizeViteGlobPath(path.relative(outDir, base)),\n ...rest,\n },\n null,\n 2,\n )})`;\n },\n async generateNodeGlobImport(\n patterns: string | string[],\n { base, eager = false, query = {}, import: importName }: GlobImportOptions,\n ): Promise<string> {\n const cacheKey = JSON.stringify({ patterns, base });\n let files = globCache.get(cacheKey);\n if (!files) {\n files = glob(patterns, {\n cwd: base,\n });\n globCache.set(cacheKey, files);\n }\n\n let code: string = '{';\n for (const item of await files) {\n const fullPath = path.join(base, item);\n const searchParams = new URLSearchParams();\n\n for (const [k, v] of Object.entries(query)) {\n if (v !== undefined) searchParams.set(k, v);\n }\n\n const importPath = this.formatImportPath(fullPath) + '?' + searchParams.toString();\n if (eager) {\n const name = `__fd_glob_${eagerImportId++}`;\n this.lines.unshift(\n importName\n ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}`\n : `import * as ${name} from ${JSON.stringify(importPath)}`,\n );\n\n code += `${JSON.stringify(item)}: ${name}, `;\n } else {\n let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;\n if (importName) {\n line += `.then(mod => mod.${importName})`;\n }\n\n code += `${line}, `;\n }\n }\n\n code += '}';\n return code;\n },\n formatImportPath(file: string) {\n const ext = path.extname(file);\n let filename: string;\n\n if (ext === '.ts') {\n filename = file.substring(0, file.length - ext.length);\n if (jsExtension) filename += '.js';\n } else {\n filename = file;\n }\n\n const importPath = slash(path.relative(outDir, filename));\n return importPath.startsWith('.') ? importPath : `./${importPath}`;\n },\n toString() {\n return [...banner, ...this.lines].join('\\n');\n },\n };\n}\n\n/**\n * convert into POSIX & relative file paths, such that Vite can accept it.\n */\nfunction normalizeViteGlobPath(file: string) {\n file = slash(file);\n if (file.startsWith('./')) return file;\n if (file.startsWith('/')) return `.${file}`;\n\n return `./${file}`;\n}\n\nexport function slash(path: string): string {\n const isExtendedLengthPath = path.startsWith('\\\\\\\\?\\\\');\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll('\\\\', '/');\n}\n\nexport function ident(code: string, tab: number = 1) {\n return code\n .split('\\n')\n .map((v) => ' '.repeat(tab) + v)\n .join('\\n');\n}\n"],"mappings":";;;;;;AAyBA,SAAgB,cAAc,EAC5B,SAAS,WACT,SAAS,IACT,cAAc,OACd,4BAAY,IAAI,KAAK,IACK;CAC1B,IAAI,gBAAgB;CACpB,MAAM,SAAmB,CAAC,iBAAiB;AAE3C,KAAI,WAAW,OACb,QAAO,KAAK,0CAAwC;AAGtD,QAAO;EACL,SAAS;GACP;GACA;GACD;EACD,OAAO,EAAE;EACT,UAAU,WAAmB;AAC3B,QAAK,MAAM,QAAQ,UAAU;;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AU,WAAW,KACtE,eAAe,KAAK,QAAQ,KAAK,UAAU,WAAW,GAC3D;AAED,aAAQ,GAAG,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK;WACpC;KACL,IAAI,OAAO,GAAG,KAAK,UAAU,KAAK,CAAC,iBAAiB,KAAK,UAAU,WAAW,CAAC;AAC/E,SAAI,WACF,SAAQ,oBAAoB,WAAW;AAGzC,aAAQ,GAAG,KAAK;;;AAIpB,WAAQ;AACR,UAAO;;EAET,iBAAiB,MAAc;GAC7B,MAAM,MAAM,KAAK,QAAQ,KAAK;GAC9B,IAAI;AAEJ,OAAI,QAAQ,OAAO;AACjB,eAAW,KAAK,UAAU,GAAG,KAAK,SAAS,IAAI,OAAO;AACtD,QAAI,YAAa,aAAY;SAE7B,YAAW;GAGb,MAAM,aAAa,MAAM,KAAK,SAAS,QAAQ,SAAS,CAAC;AACzD,UAAO,WAAW,WAAW,IAAI,GAAG,aAAa,KAAK;;EAExD,WAAW;AACT,UAAO,CAAC,GAAG,QAAQ,GAAG,KAAK,MAAM,CAAC,KAAK,KAAK;;EAE/C;;;;;AAMH,SAAS,sBAAsB,MAAc;AAC3C,QAAO,MAAM,KAAK;AAClB,KAAI,KAAK,WAAW,KAAK,CAAE,QAAO;AAClC,KAAI,KAAK,WAAW,IAAI,CAAE,QAAO,IAAI;AAErC,QAAO,KAAK;;AAGd,SAAgB,MAAM,MAAsB;AAG1C,KAF6B,KAAK,WAAW,UAErB,CACtB,QAAO;AAGT,QAAO,KAAK,WAAW,MAAM,IAAI;;AAGnC,SAAgB,MAAM,MAAc,MAAc,GAAG;AACnD,QAAO,KACJ,MAAM,KAAK,CACX,KAAK,MAAM,KAAK,OAAO,IAAI,GAAG,EAAE,CAChC,KAAK,KAAK"}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs,
|
|
1
|
+
import { A as DocCollection, B as MDXPresetOptions, D as AnyCollection, E as remarkInclude, F as defineConfig, I as defineDocs, M as GlobalConfig, N as MetaCollection, O as BaseCollection, P as defineCollections, R as PostprocessOptions, T as metaSchema, V as applyMdxPreset, j as DocsCollection, k as CollectionSchema, w as frontmatterSchema, z as DefaultMDXOptions } from "../core-C5aAAT92.js";
|
|
2
|
+
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
package/dist/config/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as applyMdxPreset } from "../preset-
|
|
2
|
-
import { t as remarkInclude } from "../remark-include-
|
|
1
|
+
import { t as applyMdxPreset } from "../preset-B0H8HalE.js";
|
|
2
|
+
import { t as remarkInclude } from "../remark-include-VDoXZSBN.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region ../core/dist/source/schema.js
|
|
5
5
|
/**
|
|
6
6
|
* Zod 4 schema
|
|
7
7
|
*/
|
|
8
|
-
const metaSchema = z.object({
|
|
8
|
+
const metaSchema$1 = z.object({
|
|
9
9
|
title: z.string().optional(),
|
|
10
10
|
pages: z.array(z.string()).optional(),
|
|
11
11
|
description: z.string().optional(),
|
|
@@ -22,7 +22,7 @@ const pageSchema = z.object({
|
|
|
22
22
|
description: z.string().optional(),
|
|
23
23
|
icon: z.string().optional(),
|
|
24
24
|
full: z.boolean().optional(),
|
|
25
|
-
_openapi: z.
|
|
25
|
+
_openapi: z.record(z.string(), z.custom()).optional()
|
|
26
26
|
});
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/config/define.ts
|
|
@@ -43,7 +43,7 @@ function defineDocs(options) {
|
|
|
43
43
|
meta: defineCollections({
|
|
44
44
|
type: "meta",
|
|
45
45
|
dir,
|
|
46
|
-
schema: metaSchema,
|
|
46
|
+
schema: metaSchema$1,
|
|
47
47
|
...options?.meta
|
|
48
48
|
})
|
|
49
49
|
};
|
|
@@ -52,6 +52,12 @@ function defineConfig(config = {}) {
|
|
|
52
52
|
return config;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
|
-
|
|
55
|
+
//#region src/config/index.ts
|
|
56
|
+
/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
57
|
+
const frontmatterSchema = pageSchema;
|
|
58
|
+
/** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
59
|
+
const metaSchema = metaSchema$1;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
|
56
62
|
|
|
57
63
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../core/dist/source/schema.js","../../src/config/define.ts"],"sourcesContent":["import { z } from \"zod\";\n//#region src/source/schema.ts\n/**\n* Zod 4 schema\n*/\nconst metaSchema = z.object({\n\ttitle: z.string().optional(),\n\tpages: z.array(z.string()).optional(),\n\tdescription: z.string().optional(),\n\troot: z.boolean().optional(),\n\tdefaultOpen: z.boolean().optional(),\n\tcollapsible: z.boolean().optional(),\n\ticon: z.string().optional()\n});\n/**\n* Zod 4 schema\n*/\nconst pageSchema = z.object({\n\ttitle: z.string(),\n\tdescription: z.string().optional(),\n\ticon: z.string().optional(),\n\tfull: z.boolean().optional(),\n\t_openapi: z.
|
|
1
|
+
{"version":3,"file":"index.js","names":["metaSchema","metaSchema","p","m"],"sources":["../../../core/dist/source/schema.js","../../src/config/define.ts","../../src/config/index.ts"],"sourcesContent":["import { z } from \"zod\";\n//#region src/source/schema.ts\n/**\n* Zod 4 schema\n*/\nconst metaSchema = z.object({\n\ttitle: z.string().optional(),\n\tpages: z.array(z.string()).optional(),\n\tdescription: z.string().optional(),\n\troot: z.boolean().optional(),\n\tdefaultOpen: z.boolean().optional(),\n\tcollapsible: z.boolean().optional(),\n\ticon: z.string().optional()\n});\n/**\n* Zod 4 schema\n*/\nconst pageSchema = z.object({\n\ttitle: z.string(),\n\tdescription: z.string().optional(),\n\ticon: z.string().optional(),\n\tfull: z.boolean().optional(),\n\t_openapi: z.record(z.string(), z.custom()).optional()\n});\n//#endregion\nexport { metaSchema, pageSchema };\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { MDXPresetOptions } from '@/config/preset';\nimport type { ProcessorOptions } from '@mdx-js/mdx';\nimport { metaSchema, pageSchema } from 'fumadocs-core/source/schema';\nimport type { PostprocessOptions } from '@/loaders/mdx/remark-postprocess';\nimport type { PluginOption } from '@/core';\nimport type { BuildEnvironment } from './build';\n\nexport type CollectionSchema<Schema extends StandardSchemaV1, Context> =\n | Schema\n | ((ctx: Context) => Schema);\n\nexport type AnyCollection = DocsCollection | DocCollection | MetaCollection;\n\nexport interface BaseCollection {\n /**\n * Directory to scan\n */\n dir: string;\n\n /**\n * what files to include/exclude (glob patterns)\n *\n * Include all files if not specified\n */\n files?: string[];\n}\n\nexport interface MetaCollection<\n Schema extends StandardSchemaV1 = StandardSchemaV1,\n> extends BaseCollection {\n type: 'meta';\n\n schema?: CollectionSchema<Schema, { path: string; source: string }>;\n}\n\nexport interface DocCollection<\n Schema extends StandardSchemaV1 = StandardSchemaV1,\n> extends BaseCollection {\n type: 'doc';\n\n postprocess?: Partial<PostprocessOptions>;\n mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);\n\n /**\n * Load files with async\n */\n async?: boolean;\n\n /**\n * Compile files on-demand\n */\n dynamic?: boolean;\n\n schema?: CollectionSchema<Schema, { path: string; source: string }>;\n}\n\nexport interface DocsCollection<\n DocSchema extends StandardSchemaV1 = StandardSchemaV1,\n MetaSchema extends StandardSchemaV1 = StandardSchemaV1,\n> {\n type: 'docs';\n dir: string;\n\n docs: DocCollection<DocSchema>;\n meta: MetaCollection<MetaSchema>;\n}\n\nexport interface GlobalConfig {\n plugins?: PluginOption[];\n\n /**\n * Configure global MDX options\n */\n mdxOptions?: MDXPresetOptions | (() => Promise<MDXPresetOptions>);\n\n workspaces?: Record<\n string,\n {\n dir: string;\n config: Record<string, unknown>;\n }\n >;\n\n /**\n * specify a directory to access & store cache (disabled during development mode).\n *\n * The cache will never be updated, delete the cache folder to clean.\n */\n experimentalBuildCache?: string;\n}\n\nexport function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(\n options: DocCollection<Schema>,\n): DocCollection<Schema>;\nexport function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(\n options: MetaCollection<Schema>,\n): MetaCollection<Schema>;\n\nexport function defineCollections(\n options: DocCollection | MetaCollection,\n): DocCollection | MetaCollection {\n return options as any;\n}\n\nexport function defineDocs<\n DocSchema extends StandardSchemaV1 = typeof pageSchema,\n MetaSchema extends StandardSchemaV1 = typeof metaSchema,\n>(options: {\n /**\n * The content directory to scan files\n *\n * @defaultValue 'content/docs'\n */\n dir?: string;\n\n docs?: Omit<DocCollection<DocSchema>, 'dir' | 'type'>;\n meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;\n}): DocsCollection<DocSchema, MetaSchema> {\n const dir = options.dir ?? 'content/docs';\n\n return {\n type: 'docs',\n dir,\n docs: defineCollections({\n type: 'doc',\n dir,\n schema: pageSchema as any,\n ...options?.docs,\n }),\n meta: defineCollections({\n type: 'meta',\n dir,\n schema: metaSchema as any,\n ...options?.meta,\n }),\n };\n}\n\nexport function defineConfig(config: GlobalConfig = {}): GlobalConfig {\n return config;\n}\n","export * from './define';\nexport * from '@/config/preset';\nexport { remarkInclude } from '@/loaders/mdx/remark-include';\nimport { metaSchema as m, pageSchema as p } from 'fumadocs-core/source/schema';\n\n/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */\nexport const frontmatterSchema = p;\n/** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */\nexport const metaSchema = m;\n\nexport type { PostprocessOptions } from '@/loaders/mdx/remark-postprocess';\n"],"mappings":";;;;;;;AAKA,MAAMA,eAAa,EAAE,OAAO;CAC3B,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACrC,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,MAAM,EAAE,SAAS,CAAC,UAAU;CAC5B,aAAa,EAAE,SAAS,CAAC,UAAU;CACnC,aAAa,EAAE,SAAS,CAAC,UAAU;CACnC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,CAAC;;;;AAIF,MAAM,aAAa,EAAE,OAAO;CAC3B,OAAO,EAAE,QAAQ;CACjB,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,MAAM,EAAE,SAAS,CAAC,UAAU;CAC5B,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,UAAU;CACrD,CAAC;;;AC4EF,SAAgB,kBACd,SACgC;AAChC,QAAO;;AAGT,SAAgB,WAGd,SAUwC;CACxC,MAAM,MAAM,QAAQ,OAAO;AAE3B,QAAO;EACL,MAAM;EACN;EACA,MAAM,kBAAkB;GACtB,MAAM;GACN;GACA,QAAQ;GACR,GAAG,SAAS;GACb,CAAC;EACF,MAAM,kBAAkB;GACtB,MAAM;GACN;GACA,QAAQC;GACR,GAAG,SAAS;GACb,CAAC;EACH;;AAGH,SAAgB,aAAa,SAAuB,EAAE,EAAgB;AACpE,QAAO;;;;;ACtIT,MAAa,oBAAoBC;;AAEjC,MAAa,aAAaC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-
|
|
1
|
+
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-hAduruLB.js";
|
|
2
|
+
import * as _$zod from "zod";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { Pluggable, Processor, Transformer } from "unified";
|
|
4
5
|
import * as Plugins from "fumadocs-core/mdx-plugins";
|
|
@@ -9,6 +10,7 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
|
9
10
|
import { Root } from "mdast";
|
|
10
11
|
import { FSWatcher } from "chokidar";
|
|
11
12
|
import { MetaData, PageData, Source } from "fumadocs-core/source";
|
|
13
|
+
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
12
14
|
|
|
13
15
|
//#region src/config/preset.d.ts
|
|
14
16
|
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
@@ -40,7 +42,7 @@ declare function applyMdxPreset(options?: MDXPresetOptions): (environment: Build
|
|
|
40
42
|
/**
|
|
41
43
|
* Zod 4 schema
|
|
42
44
|
*/
|
|
43
|
-
declare const metaSchema: z.ZodObject<{
|
|
45
|
+
declare const metaSchema$1: z.ZodObject<{
|
|
44
46
|
title: z.ZodOptional<z.ZodString>;
|
|
45
47
|
pages: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
48
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -57,7 +59,7 @@ declare const pageSchema: z.ZodObject<{
|
|
|
57
59
|
description: z.ZodOptional<z.ZodString>;
|
|
58
60
|
icon: z.ZodOptional<z.ZodString>;
|
|
59
61
|
full: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
-
_openapi: z.ZodOptional<z.
|
|
62
|
+
_openapi: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<any, any>>>;
|
|
61
63
|
}, z.core.$strip>;
|
|
62
64
|
//#endregion
|
|
63
65
|
//#region src/loaders/mdx/remark-postprocess.d.ts
|
|
@@ -150,7 +152,7 @@ interface GlobalConfig {
|
|
|
150
152
|
}
|
|
151
153
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollection<Schema>): DocCollection<Schema>;
|
|
152
154
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
153
|
-
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof pageSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema>(options: {
|
|
155
|
+
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof pageSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema$1>(options: {
|
|
154
156
|
/**
|
|
155
157
|
* The content directory to scan files
|
|
156
158
|
*
|
|
@@ -195,6 +197,26 @@ interface DocsCollectionItem extends Omit<DocsCollection, 'dir' | 'meta' | 'docs
|
|
|
195
197
|
//#region src/loaders/mdx/remark-include.d.ts
|
|
196
198
|
declare function remarkInclude(this: Processor): Transformer<Root, Root>;
|
|
197
199
|
//#endregion
|
|
200
|
+
//#region src/config/index.d.ts
|
|
201
|
+
/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
202
|
+
declare const frontmatterSchema: _$zod.ZodObject<{
|
|
203
|
+
title: _$zod.ZodString;
|
|
204
|
+
description: _$zod.ZodOptional<_$zod.ZodString>;
|
|
205
|
+
icon: _$zod.ZodOptional<_$zod.ZodString>;
|
|
206
|
+
full: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
207
|
+
_openapi: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodCustom<undefined, undefined>>>;
|
|
208
|
+
}, _$zod_v4_core0.$strip>;
|
|
209
|
+
/** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
210
|
+
declare const metaSchema: _$zod.ZodObject<{
|
|
211
|
+
title: _$zod.ZodOptional<_$zod.ZodString>;
|
|
212
|
+
pages: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
|
|
213
|
+
description: _$zod.ZodOptional<_$zod.ZodString>;
|
|
214
|
+
root: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
215
|
+
defaultOpen: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
216
|
+
collapsible: _$zod.ZodOptional<_$zod.ZodBoolean>;
|
|
217
|
+
icon: _$zod.ZodOptional<_$zod.ZodString>;
|
|
218
|
+
}, _$zod_v4_core0.$strip>;
|
|
219
|
+
//#endregion
|
|
198
220
|
//#region src/runtime/server.d.ts
|
|
199
221
|
type MetaCollectionEntry<Data> = Data & MetaMethods;
|
|
200
222
|
type DocCollectionEntry<Name extends string = string, Frontmatter = unknown, TC extends InternalTypeConfig = InternalTypeConfig> = DocData & DocMethods & Frontmatter & TC['DocData'][Name];
|
|
@@ -381,5 +403,5 @@ declare function createCore(options: CoreOptions): {
|
|
|
381
403
|
};
|
|
382
404
|
type Core = ReturnType<typeof createCore>;
|
|
383
405
|
//#endregion
|
|
384
|
-
export {
|
|
385
|
-
//# sourceMappingURL=core-
|
|
406
|
+
export { DocCollection as A, MDXPresetOptions as B, toFumadocsSource as C, AnyCollection as D, remarkInclude as E, defineConfig as F, defineDocs as I, ExtractedReference as L, GlobalConfig as M, MetaCollection as N, BaseCollection as O, defineCollections as P, PostprocessOptions as R, server as S, metaSchema as T, applyMdxPreset as V, DocCollectionEntry as _, EmitOptions as a, ServerCreate as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AsyncDocsCollectionEntry as g, AsyncDocCollectionEntry as h, EmitEntry as i, DocsCollection as j, CollectionSchema as k, PluginOption as l, indexFile as m, Core as n, EmitOutput as o, IndexFilePluginOptions as p, CoreOptions as r, Plugin as s, CompilationContext as t, ServerContext as u, DocsCollectionEntry as v, frontmatterSchema as w, ServerOptions as x, MetaCollectionEntry as y, DefaultMDXOptions as z };
|
|
407
|
+
//# sourceMappingURL=core-C5aAAT92.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-C5aAAT92.d.ts","names":[],"sources":["../src/config/preset.ts","../../core/dist/source/schema.js","../src/loaders/mdx/remark-postprocess.ts","../src/config/define.ts","../src/config/build.ts","../src/loaders/mdx/remark-include.ts","../src/config/index.ts","../src/runtime/server.ts","../src/plugins/index-file.ts","../src/core.ts"],"mappings":";;;;;;;;;;;;;;;KAKK,cAAA,GAAiB,SAAA,OAAgB,CAAA,EAAG,SAAA,OAAgB,SAAA;AAAA,KAE7C,iBAAA,GAAoB,IAAA,CAC9B,WAAA,CAAY,gBAAA;EAGZ,aAAA,GAAgB,cAAA;EAChB,aAAA,GAAgB,cAAA;;;;EAKhB,aAAA;EAEA,sBAAA,GAAyB,OAAA,CAAQ,gBAAA;EACjC,oBAAA,GAAuB,OAAA,CAAQ,oBAAA;EAC/B,kBAAA,GAAqB,OAAA,CAAQ,kBAAA;EAC7B,oBAAA,GAAuB,OAAA,CAAQ,oBAAA;EAC/B,gBAAA,GAAmB,OAAA,CAAQ,gBAAA;EAC3B,iBAAA,GAAoB,OAAA,CAAQ,iBAAA;AAAA;AAAA,KAgBlB,gBAAA;EACL,MAAA;AAAA,IAAwB,iBAAA;EAEzB,MAAA;AAAA,IACE,gBAAA;;;;iBAKQ,cAAA,CACd,OAAA,GAAS,gBAAA,IACP,WAAA,EAAa,gBAAA,KAAqB,OAAA,CAAQ,gBAAA;;;;;;cC9C9C,YAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;cAYA,UAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;UCRiB,kBAAA;EACf,IAAA;AAAA;AAAA,UAGe,kBAAA;EACf,OAAA;;;;EAKA,aAAA;;;;EAKA,wBAAA,aAAqC,WAAA;EFnBpB;;;EEwBjB,qBAAA;EFxBuD;;;EE6BvD,YAAA;IAGM,cAAA;EAAA;AAAA;;;KC7BI,gBAAA,gBAAgC,gBAAA,aACxC,MAAA,KACE,GAAA,EAAK,OAAA,KAAY,MAAA;AAAA,KAEX,aAA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gB,OAAA;qBASjB,WAAA,GAAmB,OAAA,CAAQ,UAAA;yBAiDxC,gBAAA,CAAiB,kBAAA,GAAmB,IAAA,YAE5C,OAAA;gCAcQ,gBAAA,CAAiB,iBAAA,GAAkB,IAAA,EACtC,MAAA,oBACL,OAAA,CAAQ,MAAA;0BAcA,gBAAA,CAAiB,iBAAA,GAAkB,IAAA,EACtC,KAAA,GACL,OAAA,CAAQ,KAAA;AAAA;AAAA,KAyDH,IAAA,GAAO,UAAA,QAAkB,UAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ident } from "./codegen-
|
|
1
|
+
import { n as ident } from "./codegen-B8EhLmbU.js";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/utils/validation.ts
|
|
@@ -50,6 +50,9 @@ function createCore(options) {
|
|
|
50
50
|
return data;
|
|
51
51
|
}
|
|
52
52
|
return {
|
|
53
|
+
/**
|
|
54
|
+
* Convenient cache store, reset when config changes
|
|
55
|
+
*/
|
|
53
56
|
cache: /* @__PURE__ */ new Map(),
|
|
54
57
|
async init({ config: newConfig }) {
|
|
55
58
|
config = await newConfig;
|
|
@@ -87,6 +90,9 @@ function createCore(options) {
|
|
|
87
90
|
getConfig() {
|
|
88
91
|
return config;
|
|
89
92
|
},
|
|
93
|
+
/**
|
|
94
|
+
* The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling)
|
|
95
|
+
*/
|
|
90
96
|
getCompiledConfigPath() {
|
|
91
97
|
return path.join(options.outDir, "source.config.mjs");
|
|
92
98
|
},
|
|
@@ -207,4 +213,4 @@ function postprocessPlugin() {
|
|
|
207
213
|
//#endregion
|
|
208
214
|
export { createCore as n, ValidationError as r, _Defaults as t };
|
|
209
215
|
|
|
210
|
-
//# sourceMappingURL=core-
|
|
216
|
+
//# sourceMappingURL=core-Wd5WdPN4.js.map
|