fuma-content 0.0.2 → 1.0.1

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.
Files changed (75) hide show
  1. package/dist/bin.d.ts +1 -0
  2. package/dist/bin.js +18 -0
  3. package/dist/build-mdx-I4NROXCF.js +8 -0
  4. package/dist/bun/index.d.ts +16 -0
  5. package/dist/bun/index.js +37 -0
  6. package/dist/bun-DMNX4PBC.js +40 -0
  7. package/dist/chunk-3VQS3KSP.js +39 -0
  8. package/dist/chunk-BTRE6MOX.js +16 -0
  9. package/dist/chunk-E4HRKSP4.js +24 -0
  10. package/dist/chunk-ERBMAQYP.js +33 -0
  11. package/dist/chunk-GGL4EF6H.js +38 -0
  12. package/dist/chunk-JBZTQ55D.js +30 -0
  13. package/dist/chunk-KH5GT2Y5.js +104 -0
  14. package/dist/chunk-LUM7SIZN.js +40 -0
  15. package/dist/chunk-MT7RY65Y.js +167 -0
  16. package/dist/chunk-NRZ4GE5O.js +207 -0
  17. package/dist/chunk-OQQNA7L7.js +412 -0
  18. package/dist/chunk-OUJENWQ4.js +45 -0
  19. package/dist/chunk-RMSV4HP6.js +85 -0
  20. package/dist/chunk-RXR7OL76.js +37 -0
  21. package/dist/chunk-VWJKRQZR.js +19 -0
  22. package/dist/chunk-W6HENTK7.js +44 -0
  23. package/dist/chunk-XR5N6ZXJ.js +50 -0
  24. package/dist/collections/handlers/fs.d.ts +10 -0
  25. package/dist/collections/handlers/fs.js +6 -0
  26. package/dist/collections/index.d.ts +10 -0
  27. package/dist/collections/index.js +6 -0
  28. package/dist/collections/mdx/loader-webpack.d.ts +17 -0
  29. package/dist/collections/mdx/loader-webpack.js +39 -0
  30. package/dist/collections/mdx/runtime-browser.d.ts +55 -0
  31. package/dist/collections/mdx/runtime-browser.js +82 -0
  32. package/dist/collections/mdx/runtime-dynamic.d.ts +43 -0
  33. package/dist/collections/mdx/runtime-dynamic.js +96 -0
  34. package/dist/collections/mdx/runtime.d.ts +70 -0
  35. package/dist/collections/mdx/runtime.js +45 -0
  36. package/dist/collections/mdx.d.ts +10 -0
  37. package/dist/collections/mdx.js +291 -0
  38. package/dist/collections/meta/loader-webpack.d.ts +17 -0
  39. package/dist/collections/meta/loader-webpack.js +42 -0
  40. package/dist/collections/meta/runtime.d.ts +19 -0
  41. package/dist/collections/meta/runtime.js +18 -0
  42. package/dist/collections/meta.d.ts +10 -0
  43. package/dist/collections/meta.js +170 -0
  44. package/dist/collections/runtime/file-store.d.ts +19 -0
  45. package/dist/collections/runtime/file-store.js +7 -0
  46. package/dist/collections/runtime/store.d.ts +28 -0
  47. package/dist/collections/runtime/store.js +6 -0
  48. package/dist/config/index.d.ts +10 -0
  49. package/dist/config/index.js +7 -0
  50. package/dist/core-Bo8KaWQz.d.ts +411 -0
  51. package/dist/index.d.ts +15 -31
  52. package/dist/index.js +6 -49
  53. package/dist/load-from-file-HL2VEY3M.js +7 -0
  54. package/dist/loader-NFSL6P5I.js +7 -0
  55. package/dist/loader-T756NSCS.js +7 -0
  56. package/dist/next/index.cjs +594 -0
  57. package/dist/next/index.d.ts +27 -0
  58. package/dist/next/index.js +100 -0
  59. package/dist/node/loader.d.ts +5 -0
  60. package/dist/node/loader.js +47 -0
  61. package/dist/node-DCMYL4DL.js +34 -0
  62. package/dist/plugins/git.d.ts +10 -0
  63. package/dist/plugins/git.js +70 -0
  64. package/dist/plugins/json-schema.d.ts +10 -0
  65. package/dist/plugins/json-schema.js +59 -0
  66. package/dist/plugins/with-loader/index.d.ts +61 -0
  67. package/dist/plugins/with-loader/index.js +6 -0
  68. package/dist/plugins/with-loader/webpack.d.ts +27 -0
  69. package/dist/plugins/with-loader/webpack.js +12 -0
  70. package/dist/vite/index.d.ts +33 -0
  71. package/dist/vite/index.js +61 -0
  72. package/dist/vite-QCUPZHHB.js +32 -0
  73. package/package.json +104 -36
  74. package/dist/internal.d.ts +0 -114
  75. package/dist/internal.js +0 -420
@@ -0,0 +1,10 @@
1
+ export { G as GlobalConfig, W as WorkspaceConfig, D as defineConfig } from '../core-Bo8KaWQz.js';
2
+ import 'chokidar';
3
+ import '@mdx-js/mdx';
4
+ import 'vfile';
5
+ import '@standard-schema/spec';
6
+ import 'unified';
7
+ import 'mdast';
8
+ import 'vite';
9
+ import 'next';
10
+ import 'node:module';
@@ -0,0 +1,7 @@
1
+ // src/config/index.ts
2
+ function defineConfig(config = {}) {
3
+ return config;
4
+ }
5
+ export {
6
+ defineConfig
7
+ };
@@ -0,0 +1,411 @@
1
+ import { FSWatcher } from 'chokidar';
2
+ import { ProcessorOptions } from '@mdx-js/mdx';
3
+ import { VFile } from 'vfile';
4
+ import { StandardSchemaV1 } from '@standard-schema/spec';
5
+ import { Processor } from 'unified';
6
+ import { Root } from 'mdast';
7
+ import * as Vite from 'vite';
8
+ import { NextConfig } from 'next';
9
+ import { LoadHook } from 'node:module';
10
+
11
+ interface JSONSchemaOptions {
12
+ /**
13
+ * insert `$schema` field to JSON files on creation.
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ insert?: boolean;
18
+ }
19
+ interface JSONSchemaHandler {
20
+ create: () => object | undefined | Promise<object | undefined>;
21
+ }
22
+ /**
23
+ * Generate JSON schemas locally for collection schemas
24
+ *
25
+ * note: **it only works with Zod**
26
+ */
27
+ declare function jsonSchema({ insert, }?: JSONSchemaOptions): Plugin;
28
+
29
+ interface FileHandlerConfig {
30
+ /**
31
+ * Directory to scan
32
+ */
33
+ dir: string;
34
+ /**
35
+ * what files to include/exclude (glob patterns)
36
+ *
37
+ * Include all files if not specified
38
+ */
39
+ files?: string[];
40
+ }
41
+ interface FIleCollectionHandler {
42
+ /**
43
+ * content directory (absolute)
44
+ */
45
+ dir: string;
46
+ hasFile: (filePath: string) => boolean;
47
+ isFileSupported: (filePath: string) => boolean;
48
+ patterns: string[];
49
+ }
50
+ declare function buildFileHandler({ workspace }: InitOptions, config: FileHandlerConfig, supportedFormats: string[]): FIleCollectionHandler;
51
+
52
+ interface ExtractedReference {
53
+ href: string;
54
+ }
55
+ interface PostprocessOptions {
56
+ _format: "md" | "mdx";
57
+ /**
58
+ * Properties to export from `vfile.data`
59
+ */
60
+ valueToExport?: string[];
61
+ /**
62
+ * stringify MDAST and export via `_markdown`.
63
+ */
64
+ includeProcessedMarkdown?: boolean;
65
+ /**
66
+ * extract link references, export via `extractedReferences`.
67
+ */
68
+ extractLinkReferences?: boolean;
69
+ /**
70
+ * store MDAST and export via `_mdast`.
71
+ */
72
+ includeMDAST?: boolean | {
73
+ removePosition?: boolean;
74
+ };
75
+ }
76
+
77
+ interface PreprocessOptions {
78
+ preprocessor?: Processor<Root>;
79
+ }
80
+ declare module "vfile" {
81
+ interface DataMap {
82
+ _preprocessed?: boolean;
83
+ }
84
+ }
85
+
86
+ type Awaitable$2<T> = T | PromiseLike<T>;
87
+ interface CompilationContext {
88
+ collection: Collection;
89
+ filePath: string;
90
+ source: string;
91
+ }
92
+ interface MDXCollectionHandler {
93
+ readonly cwd: string;
94
+ readonly dynamic: boolean;
95
+ readonly lazy: boolean;
96
+ preprocess?: PreprocessOptions;
97
+ postprocess?: Partial<PostprocessOptions>;
98
+ getMDXOptions?: (environment: "bundler" | "runtime") => Awaitable$2<ProcessorOptions>;
99
+ /**
100
+ * Transform frontmatter
101
+ */
102
+ frontmatter?: (this: CompilationContext, data: Record<string, unknown>) => Awaitable$2<Record<string, unknown> | undefined>;
103
+ /**
104
+ * Transform `vfile` on compilation stage
105
+ */
106
+ vfile?: (this: CompilationContext, file: VFile) => Awaitable$2<VFile>;
107
+ onGenerateStore?: (this: EmitCodeGeneratorContext & {
108
+ environment: "browser" | "server" | "dynamic";
109
+ }, initializer: string) => string;
110
+ }
111
+ interface MDXCollectionConfig<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined> extends FileHandlerConfig {
112
+ postprocess?: Partial<PostprocessOptions>;
113
+ frontmatter?: FrontmatterSchema;
114
+ options?: (environment: "bundler" | "runtime") => Awaitable$2<ProcessorOptions>;
115
+ lazy?: boolean;
116
+ dynamic?: boolean;
117
+ }
118
+ type MDXCollection<Frontmatter> = Collection & {
119
+ _frontmatter?: Frontmatter;
120
+ };
121
+ declare function defineMDX<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(config: MDXCollectionConfig<FrontmatterSchema>): MDXCollection<FrontmatterSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<FrontmatterSchema> : Record<string, unknown>>;
122
+
123
+ type Awaitable$1<T> = T | PromiseLike<T>;
124
+ interface MetaContext {
125
+ path: string;
126
+ source: string;
127
+ }
128
+ interface MetaCollectionHandler {
129
+ /**
130
+ * Transform metadata
131
+ */
132
+ transform?: (this: MetaContext, data: unknown) => Awaitable$1<unknown | undefined>;
133
+ schema?: StandardSchemaV1;
134
+ }
135
+ interface MetaCollectionConfig<Schema extends StandardSchemaV1> extends FileHandlerConfig {
136
+ schema?: Schema;
137
+ }
138
+ type MetaCollection<_Data> = Collection & {
139
+ _type?: _Data;
140
+ };
141
+ declare function defineMeta<Schema extends StandardSchemaV1>(config: MetaCollectionConfig<Schema>): MetaCollection<Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : Record<string, unknown>>;
142
+
143
+ interface VersionControlFileData {
144
+ /**
145
+ * Last modified date of file, obtained from version control.
146
+ */
147
+ lastModified: Date | null;
148
+ /**
149
+ * Creation date of file, obtained from version control.
150
+ */
151
+ creationDate: Date | null;
152
+ }
153
+ interface VersionControlHandler {
154
+ /**
155
+ * receive the version control client.
156
+ */
157
+ client: (context: {
158
+ client: VersionControlClient;
159
+ }) => void | Promise<void>;
160
+ }
161
+ interface GitPluginOptions {
162
+ /**
163
+ * Filter the collections to include by names
164
+ */
165
+ filter?: (collection: string) => boolean;
166
+ }
167
+ /**
168
+ * Add version control integration for Git.
169
+ * 1. Injects `creationDate` & `lastModified` properties to page exports.
170
+ *
171
+ * @remarks If you are using Vercel, please set `VERCEL_DEEP_CLONE` environment variable to `true`. This ensures the client can access the full commit history of Git.
172
+ */
173
+ declare function git(options?: GitPluginOptions): Plugin;
174
+ interface VersionControlClient {
175
+ getFileData: (options: {
176
+ filePath: string;
177
+ }) => Promise<VersionControlFileData>;
178
+ }
179
+
180
+ interface InitOptions {
181
+ name: string;
182
+ workspace?: WorkspaceConfig;
183
+ }
184
+ interface Collection {
185
+ name: string;
186
+ init?: (options: InitOptions) => void;
187
+ readonly handlers: CollectionHandlers;
188
+ /**
189
+ * information for the collection type, can be shared for all collections of same type.
190
+ */
191
+ readonly typeInfo: CollectionTypeInfo;
192
+ }
193
+ interface CollectionTypeInfo {
194
+ /**
195
+ * ID for collection type.
196
+ *
197
+ * @example `my-package:my-collection-type`
198
+ */
199
+ readonly id: string;
200
+ /**
201
+ * plugins to register, registered once for each collection type.
202
+ */
203
+ readonly plugins?: PluginOption;
204
+ }
205
+ interface CollectionHandlers {
206
+ fs?: FIleCollectionHandler;
207
+ mdx?: MDXCollectionHandler;
208
+ meta?: MetaCollectionHandler;
209
+ "json-schema"?: JSONSchemaHandler;
210
+ "version-control"?: VersionControlHandler;
211
+ }
212
+ declare function createCollection(info: CollectionTypeInfo, init: (collection: Collection, options: InitOptions) => void): Collection;
213
+
214
+ interface GlobalConfig<Collections extends Record<string, Collection> = Record<string, Collection>> {
215
+ plugins?: PluginOption[];
216
+ collections?: Collections;
217
+ workspaces?: Record<string, Omit<WorkspaceConfig, "name">>;
218
+ /**
219
+ * specify a directory to access & store cache (disabled during development mode).
220
+ *
221
+ * The cache will never be updated, delete the cache folder to clean.
222
+ */
223
+ experimentalBuildCache?: string;
224
+ }
225
+ interface WorkspaceConfig {
226
+ name: string;
227
+ dir: string;
228
+ config: GlobalConfig | {
229
+ default: GlobalConfig;
230
+ };
231
+ }
232
+ declare function defineConfig<Collections extends Record<string, Collection> = Record<string, Collection>>(config?: GlobalConfig<Collections>): GlobalConfig<Collections>;
233
+
234
+ interface LoadedConfig extends Omit<GlobalConfig, "workspaces" | "collections"> {
235
+ collections: Map<string, Collection>;
236
+ workspaces: Record<string, {
237
+ dir: string;
238
+ config: LoadedConfig;
239
+ }>;
240
+ }
241
+
242
+ interface GlobImportOptions {
243
+ base: string;
244
+ query?: Record<string, string | undefined>;
245
+ import?: string;
246
+ eager?: boolean;
247
+ }
248
+ interface CodeGeneratorOptions {
249
+ target: "default" | "vite";
250
+ outDir: string;
251
+ /**
252
+ * add .js extenstion to imports
253
+ */
254
+ jsExtension: boolean;
255
+ globCache: Map<string, Promise<string[]>>;
256
+ }
257
+ /**
258
+ * Code generator (one instance per file)
259
+ */
260
+ declare class CodeGenerator {
261
+ private readonly lines;
262
+ private readonly globCache;
263
+ private readonly importInfos;
264
+ private eagerImportId;
265
+ readonly options: CodeGeneratorOptions;
266
+ constructor({ target, jsExtension, globCache, outDir, }: Partial<CodeGeneratorOptions>);
267
+ addNamespaceImport(namespace: string, specifier: string, types?: boolean): void;
268
+ addNamedImport(names: string[], specifier: string, types?: boolean): void;
269
+ push(...insert: string[]): void;
270
+ pushAsync(insert: Promise<string | undefined>[]): Promise<void>;
271
+ generateGlobImport(patterns: string | string[], options: GlobImportOptions): Promise<string>;
272
+ private generateViteGlobImport;
273
+ private generateNodeGlobImport;
274
+ formatImportPath(file: string): string;
275
+ toString(): string;
276
+ }
277
+
278
+ type Awaitable<T> = T | PromiseLike<T>;
279
+ interface EmitEntry {
280
+ /**
281
+ * path relative to output directory
282
+ */
283
+ path: string;
284
+ content: string;
285
+ }
286
+ interface PluginContext {
287
+ core: Core;
288
+ }
289
+ interface EmitContext extends PluginContext {
290
+ createCodeGenerator: (path: string, content: (ctx: EmitCodeGeneratorContext) => Promise<void>) => Promise<EmitEntry>;
291
+ }
292
+ interface EmitCodeGeneratorContext {
293
+ core: Core;
294
+ workspace?: string;
295
+ codegen: CodeGenerator;
296
+ }
297
+ interface Plugin {
298
+ /**
299
+ * unique name for plugin
300
+ *
301
+ * @example `my-package:my-plugin`
302
+ */
303
+ name: string;
304
+ /**
305
+ * on config loaded/updated
306
+ */
307
+ config?: (this: PluginContext, config: LoadedConfig) => Awaitable<void | LoadedConfig>;
308
+ collection?: (this: PluginContext, collection: Collection) => Awaitable<void>;
309
+ /**
310
+ * Generate files (e.g. types, index file, or JSON schemas)
311
+ */
312
+ emit?: (this: EmitContext) => Awaitable<EmitEntry[]>;
313
+ /**
314
+ * Configure Fumadocs dev server
315
+ */
316
+ configureServer?: (this: PluginContext, server: ServerContext) => Awaitable<void>;
317
+ vite?: {
318
+ createPlugin?: (this: PluginContext) => Vite.PluginOption;
319
+ };
320
+ bun?: {
321
+ build?: (this: PluginContext, build: Bun.PluginBuilder) => Awaitable<void>;
322
+ };
323
+ next?: {
324
+ config?: (this: PluginContext, config: NextConfig) => NextConfig;
325
+ };
326
+ node?: {
327
+ createLoad?: (this: PluginContext) => Awaitable<LoadHook>;
328
+ };
329
+ }
330
+ type PluginOption = Awaitable<Plugin | PluginOption[] | false | undefined>;
331
+ interface ServerContext {
332
+ /**
333
+ * the file watcher, by default all content files are watched, along with other files.
334
+ *
335
+ * make sure to filter when listening to events
336
+ */
337
+ watcher?: FSWatcher;
338
+ }
339
+ interface CoreOptions {
340
+ configPath: string;
341
+ outDir: string;
342
+ plugins?: PluginOption[];
343
+ emit?: {
344
+ target?: "default" | "vite";
345
+ /**
346
+ * add .js extenstion to imports
347
+ */
348
+ jsExtension?: boolean;
349
+ };
350
+ /**
351
+ * the workspace info if this instance is created as a workspace
352
+ */
353
+ workspace?: {
354
+ parent: Core;
355
+ name: string;
356
+ dir: string;
357
+ };
358
+ }
359
+ interface EmitOptions {
360
+ /**
361
+ * filter the plugins to run emit
362
+ */
363
+ filterPlugin?: (plugin: Plugin) => boolean;
364
+ /**
365
+ * filter the workspaces to run emit
366
+ */
367
+ filterWorkspace?: (workspace: string) => boolean;
368
+ /**
369
+ * write files
370
+ */
371
+ write?: boolean;
372
+ }
373
+ interface EmitOutput {
374
+ entries: EmitEntry[];
375
+ workspaces: Record<string, EmitEntry[]>;
376
+ }
377
+ declare class Core {
378
+ private readonly workspaces;
379
+ private readonly options;
380
+ private plugins;
381
+ private config;
382
+ static defaultOptions: {
383
+ configPath: string;
384
+ outDir: string;
385
+ };
386
+ /**
387
+ * Convenient cache store, reset when config changes.
388
+ *
389
+ * You can group namespaces in cache key with ":", like `my-plugin:data`
390
+ */
391
+ readonly cache: Map<string, unknown>;
392
+ constructor(options: CoreOptions);
393
+ init({ config: newConfig }: {
394
+ config: Awaitable<LoadedConfig>;
395
+ }): Promise<void>;
396
+ getWorkspaces(): Map<string, Core>;
397
+ getOptions(): CoreOptions;
398
+ getConfig(): LoadedConfig;
399
+ /**
400
+ * The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling)
401
+ */
402
+ getCompiledConfigPath(): string;
403
+ getPlugins(workspace?: boolean): Plugin[];
404
+ getCollections(workspace?: boolean): Collection[];
405
+ getCollection(name: string): Collection | undefined;
406
+ getPluginContext(): PluginContext;
407
+ initServer(server: ServerContext): Promise<void>;
408
+ emit(emitOptions?: EmitOptions): Promise<EmitOutput>;
409
+ }
410
+
411
+ export { type CollectionHandlers as A, createCollection as B, type CoreOptions as C, defineConfig as D, type ExtractedReference as E, type FileHandlerConfig as F, type GlobalConfig as G, type InitOptions as I, type JSONSchemaOptions as J, type MDXCollection as M, type PluginContext as P, type ServerContext as S, type VersionControlFileData as V, type WorkspaceConfig as W, Core as a, type MetaCollection as b, type Plugin as c, type Collection as d, type EmitEntry as e, type EmitContext as f, type EmitCodeGeneratorContext as g, type PluginOption as h, type EmitOptions as i, type EmitOutput as j, jsonSchema as k, type JSONSchemaHandler as l, type FIleCollectionHandler as m, buildFileHandler as n, type MDXCollectionHandler as o, type MDXCollectionConfig as p, defineMDX as q, type MetaContext as r, type MetaCollectionHandler as s, type MetaCollectionConfig as t, defineMeta as u, git as v, type VersionControlHandler as w, type GitPluginOptions as x, type VersionControlClient as y, type CollectionTypeInfo as z };
package/dist/index.d.ts CHANGED
@@ -1,33 +1,17 @@
1
- import { AnyZodObject, z } from 'zod';
2
- import { MDXContent } from 'mdx/types';
1
+ import { d as Collection, G as GlobalConfig } from './core-Bo8KaWQz.js';
2
+ export { a as Core, C as CoreOptions, g as EmitCodeGeneratorContext, f as EmitContext, e as EmitEntry, i as EmitOptions, j as EmitOutput, c as Plugin, P as PluginContext, h as PluginOption, S as ServerContext } from './core-Bo8KaWQz.js';
3
+ import 'chokidar';
4
+ import '@mdx-js/mdx';
5
+ import 'vfile';
6
+ import '@standard-schema/spec';
7
+ import 'unified';
8
+ import 'mdast';
9
+ import 'vite';
10
+ import 'next';
11
+ import 'node:module';
3
12
 
4
- interface CreateOptions {
5
- schema?: AnyZodObject;
6
- /**
7
- * Filter file paths
8
- */
9
- include?: string | string[];
10
- }
11
- interface Document<Info = unknown> {
12
- info: Info;
13
- /**
14
- * Render data, should be accepted by renderer
15
- */
16
- renderer: MDXContent;
17
- /**
18
- * File Path
19
- */
20
- file: string;
21
- }
22
- interface Json<Info = unknown> {
23
- info: Info;
24
- /**
25
- * File Path
26
- */
27
- file: string;
28
- }
29
- type GetInfoType<T extends CreateOptions> = T["schema"] extends AnyZodObject ? z.infer<T["schema"]> : Record<string, unknown>;
30
- declare function document<T extends CreateOptions>(entryPoint: unknown, options?: T): Document<GetInfoType<T>>[];
31
- declare function json<T extends CreateOptions>(entryPoint: unknown, options?: T): Json<GetInfoType<T>>[];
13
+ type GetCollectionConfig<Config, Name extends string> = Config extends Record<Name, Collection> ? Config[Name] : Config extends {
14
+ default: GlobalConfig<infer Collections>;
15
+ } ? Collections[Name] : never;
32
16
 
33
- export { type CreateOptions, type Document, type Json, document, json };
17
+ export type { GetCollectionConfig };
package/dist/index.js CHANGED
@@ -1,51 +1,8 @@
1
- // src/source/index.ts
2
- import { z } from "zod";
3
- import micromatch from "micromatch";
4
- var defaultSchema = z.record(z.string(), z.unknown());
5
- function document(entryPoint, options) {
6
- const { schema = defaultSchema, include } = options ?? {};
7
- return read(entryPoint, ["md", "mdx"], include).map((item) => {
8
- const {
9
- default: render,
10
- format: _format,
11
- file,
12
- frontmatter,
13
- ...rest
14
- } = item;
15
- const result = schema.safeParse(frontmatter);
16
- if (!result.success) throw createError(file, result.error);
17
- return {
18
- file,
19
- info: result.data,
20
- renderer: render,
21
- ...rest
22
- };
23
- });
24
- }
25
- function json(entryPoint, options) {
26
- const { schema = defaultSchema, include } = options ?? {};
27
- return read(entryPoint, ["json"], include).map(
28
- ({ file, default: data }) => {
29
- const result = schema.safeParse(data);
30
- if (!result.success) throw createError(file, result.error);
31
- return {
32
- file,
33
- info: result.data
34
- };
35
- }
36
- );
37
- }
38
- function createError(file, err) {
39
- const message = `${file}:
40
- ${Object.entries(err.flatten().fieldErrors).map(([k, v]) => `${k}: ${v?.join(", ") ?? ""}`).join("\n")}`;
41
- return new Error(message);
42
- }
43
- function read(entryPoint, format, include) {
44
- const cast = entryPoint;
45
- const entries = format.flatMap((f) => cast[f] ?? []);
46
- return entries.filter((e) => !include || micromatch.isMatch(e.file, include));
47
- }
1
+ import {
2
+ Core
3
+ } from "./chunk-NRZ4GE5O.js";
4
+ import "./chunk-MT7RY65Y.js";
5
+ import "./chunk-JBZTQ55D.js";
48
6
  export {
49
- document,
50
- json
7
+ Core
51
8
  };
@@ -0,0 +1,7 @@
1
+ import {
2
+ loadConfig
3
+ } from "./chunk-LUM7SIZN.js";
4
+ import "./chunk-W6HENTK7.js";
5
+ export {
6
+ loadConfig
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ createMdxLoader
3
+ } from "./chunk-KH5GT2Y5.js";
4
+ import "./chunk-VWJKRQZR.js";
5
+ export {
6
+ createMdxLoader
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ createMetaLoader
3
+ } from "./chunk-RMSV4HP6.js";
4
+ import "./chunk-OUJENWQ4.js";
5
+ export {
6
+ createMetaLoader
7
+ };