@jk2908/mdsrc 0.5.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -1,13 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1 - 2026-07-01
4
+
5
+ - Generated MDX `Component` types now follow `compileOptions.jsxImportSource`, emitting React, Preact, or Solid component signatures instead of `any`.
6
+
7
+ ## 0.6.0 - 2026-07-01
8
+
9
+ - For Markdown files, non-frontmatter content is now available on the `html` field, replacing `body`.
10
+ - Added support for `.mdx` files. MDX entries now generate a `Component` field instead of `html`.
11
+ - Added cleanup to remove stale generated files and empty directories when source files are removed or renamed.
12
+ - Improved pluralisation for generated collection names and types.
13
+
3
14
  ## 0.5.0 - 2026-06-25
4
15
 
5
16
  - Added multi-type support using pipe syntax: `'string|number'`. The first matching type wins.
6
17
  - Added validation modifiers via pipe syntax: `'string|min=3|max=6'`, `'number|min=18'`, `'date|max=1735689600000'`, `'array|min=2'`.
7
18
  - Added `array` as a supported primitive type with `min`/`max` length modifiers.
8
19
  - Added `BAD_MODIFIER` issue code for unparseable modifier values.
20
+ - Added `INVALID_LENGTH` issue code for string and array length constraint failures.
21
+ - Added `INVALID_SIZE` issue code for number value constraint failures.
22
+ - Single-type fields now return specific issue codes (e.g. `INVALID_DATE` for invalid dates, `INVALID_TYPE` for wrong type) instead of a generic message.
9
23
  - Multi-type fields return a single `INVALID_TYPE` issue listing all attempted types when no type matches.
10
- - Fixed date modifier parsing — modifier values are now correctly converted to numbers before being passed to `new Date()`.
11
24
  - Moved validation logic into `src/validate.ts`.
12
25
 
13
26
  ## 0.4.1 - 2026-06-23
package/README.md CHANGED
@@ -32,7 +32,7 @@ export default defineConfig({
32
32
  })
33
33
  ```
34
34
 
35
- The plugin reads markdown content, validates frontmatter against your schema, and generates typed modules during build and watch. Root config uses `collections`, optional `compileOptions`, and `logger`. Collection config uses `name`, `dir`, and `schema`.
35
+ The plugin reads markdown and MDX content, validates frontmatter against your schema, and generates typed modules during build and watch. Root config uses `collections`, optional `compileOptions`, and `logger`. Collection config uses `name`, `dir`, and `schema`.
36
36
 
37
37
  ### Schema
38
38
 
@@ -107,7 +107,7 @@ See [satteri](https://satteri.bruits.org/) for the full list of compile options
107
107
 
108
108
  ### Output
109
109
 
110
- Each entry exports a `body` field containing the rendered HTML.
110
+ Each entry exports a `html` field containing the rendered HTML for markdown files, or a `Component` field for MDX files.
111
111
 
112
112
  If you configure a collection with `name: 'post'`, `mdsrc` exposes `allPosts` from the package root.
113
113
 
@@ -117,10 +117,29 @@ import { allPosts } from '@jk2908/mdsrc'
117
117
  export const summaries = allPosts.map(post => ({
118
118
  title: post.title,
119
119
  slug: post.__mdsrc.slug,
120
- body: post.body,
120
+ html: post.html,
121
121
  }))
122
122
  ```
123
123
 
124
+ #### Using MDX Components
125
+
126
+ For `.mdx` files, the generated entry includes a `Component` that you can render in your application. You can also pass custom components to it.
127
+
128
+ For example, to render a post and provide a custom `h1` component:
129
+
130
+ ```tsx
131
+ import { allPosts } from '@jk2908/mdsrc'
132
+
133
+ const post = allPosts.find(p => p.__mdsrc.slug === 'my-first-post')
134
+ const H1 = ({ children }) => <h1 style={{ color: 'red' }}>{children}</h1>
135
+
136
+ export function Post() {
137
+ if (!post || !post.Component) return <div>Not found</div>
138
+
139
+ return <post.Component components={{ h1: H1 }} />
140
+ }
141
+ ```
142
+
124
143
  If you want the generated collection module directly, you can also import the collection subpath.
125
144
 
126
145
  ```ts
package/dist/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare const NAME = "mdsrc";
2
2
  export declare const PKG_NAME = "@jk2908/mdsrc";
3
3
  export declare const GENERATED_DIR = ".mdsrc";
4
+ export declare const AUTOGEN_MSG = "// auto-generated by mdsrc";
4
5
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,UAAU,CAAA;AAC3B,eAAO,MAAM,QAAQ,kBAAoB,CAAA;AACzC,eAAO,MAAM,aAAa,WAAa,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,UAAU,CAAA;AAC3B,eAAO,MAAM,QAAQ,kBAAoB,CAAA;AACzC,eAAO,MAAM,aAAa,WAAa,CAAA;AACvC,eAAO,MAAM,WAAW,+BAAiC,CAAA"}
package/dist/config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const NAME = 'mdsrc';
2
2
  export const PKG_NAME = `@jk2908/${NAME}`;
3
3
  export const GENERATED_DIR = `.${NAME}`;
4
+ export const AUTOGEN_MSG = `// auto-generated by ${NAME}`;
4
5
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAA;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,IAAI,EAAE,CAAA;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAA;AAC3B,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,IAAI,EAAE,CAAA;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,IAAI,EAAE,CAAA;AACvC,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,IAAI,EAAE,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import type { Plugin } from 'vite';
2
2
  import { type MarkdownToHtmlResult } from 'satteri';
3
- import type { BuildContext, PluginConfig, Schema } from './types.js';
3
+ import type { BuildContext, Manifest, PluginConfig, Schema } from './types.js';
4
4
  export declare const DEFAULT_COMPILE_OPTIONS: {
5
5
  features: {
6
6
  frontmatter: true;
7
7
  };
8
8
  };
9
- export type { CompileOptions } from './types.js';
9
+ export type { Collection, CompileOptions } from './types.js';
10
10
  /**
11
11
  * Parse YAML or TOML frontmatter
12
12
  */
@@ -47,6 +47,10 @@ export declare function getFileCache(filePath: string): string | undefined;
47
47
  */
48
48
  export declare function maybeWrite(filePath: string, content: string): Promise<boolean>;
49
49
  export declare function schemaToType(schema: Schema): string;
50
+ export declare function getManifest(outDir: string): Promise<{
51
+ [k: string]: string[];
52
+ } | null>;
53
+ export declare function cleanup(outDir: string, manifest: Manifest, prevManifest: Manifest | null): Promise<boolean>;
50
54
  /**
51
55
  * Build the Vite plugin that validates collections and writes the generated modules
52
56
  * keep the runtime data and declaration files in the same pass
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AAEjD,OAAO,EAAuC,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAExF,OAAO,KAAK,EAAE,YAAY,EAAc,YAAY,EAAO,MAAM,EAAE,MAAM,YAAY,CAAA;AAMrF,eAAO,MAAM,uBAAuB;;;;CAIV,CAAA;AAE1B,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD;;GAEG;AACH,wBAAsB,KAAK,CAAC,WAAW,EAAE,oBAAoB,CAAC,aAAa,CAAC,gBAa3E;AAED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,kBAgDnE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,WAEpC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,qBAA4B,CAAA;AAElD,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;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E,MAAM,QAY7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,sBAQ5C;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,oBAyBjE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,UAoB1C;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM;;UAiB/C;AAED,wBAAsB,OAAO,CAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,QAAQ,GAAG,IAAI,oBAsC7B;AAyND;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAgJ1D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC"}
package/dist/index.js CHANGED
@@ -21,12 +21,16 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
21
21
  import { realpathSync } from "node:fs";
22
22
  import fs from "node:fs/promises";
23
23
  import path from "node:path";
24
- import { markdownToHtml } from "satteri";
24
+ import {
25
+ markdownToHtml,
26
+ mdxToJs
27
+ } from "satteri";
25
28
 
26
29
  // src/config.ts
27
30
  var NAME = "mdsrc";
28
31
  var PKG_NAME = `@jk2908/${NAME}`;
29
32
  var GENERATED_DIR = `.${NAME}`;
33
+ var AUTOGEN_MSG = `// auto-generated by ${NAME}`;
30
34
 
31
35
  // src/logger.ts
32
36
  var LEVELS = {
@@ -121,6 +125,9 @@ function capitalise(str) {
121
125
  function pluralise(str, count) {
122
126
  return count === 1 ? str : str.endsWith("s") ? str : `${str}s`;
123
127
  }
128
+ function singularise(str, suffix = "s") {
129
+ return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;
130
+ }
124
131
  function debounce(fn, wait) {
125
132
  let timeoutId = null;
126
133
  return (...args) => {
@@ -145,6 +152,9 @@ function deep(obj, path, value) {
145
152
  }
146
153
  cur[parts.at(-1)] = value;
147
154
  }
155
+ function slugify(str) {
156
+ return str.toLowerCase().replace(/\s/g, "-");
157
+ }
148
158
 
149
159
  // src/types.ts
150
160
  var PRIMITIVE_NAMES = ["string", "number", "boolean", "date", "array"];
@@ -498,6 +508,7 @@ var DEFAULT_COMPILE_OPTIONS = {
498
508
  frontmatter: true
499
509
  }
500
510
  };
511
+ var ACCEPTED_EXTENSIONS = ["md", "mdx"];
501
512
  async function parse(frontmatter) {
502
513
  if (!frontmatter)
503
514
  return {};
@@ -515,29 +526,38 @@ async function create(dir, buildContext) {
515
526
  const { logger: logger2, compileOptions = {} } = buildContext;
516
527
  const { features, ...restCompileOptions } = compileOptions;
517
528
  try {
518
- const files = (await fs.readdir(dir)).filter((file) => path.extname(file) === ".md");
529
+ const files = (await fs.readdir(dir)).filter((file) => ACCEPTED_EXTENSIONS.some((e) => `.${e}` === path.extname(file)));
519
530
  const filePaths = files.map((file) => path.join(dir, file));
520
531
  if (!files.length) {
521
532
  logger2.warn(`mdsrc: ${dir} is empty`);
522
533
  return [];
523
534
  }
535
+ const parserArgs = {
536
+ features: {
537
+ ...DEFAULT_COMPILE_OPTIONS.features,
538
+ ...features
539
+ },
540
+ ...restCompileOptions
541
+ };
524
542
  return Promise.all(filePaths.map(async (filePath) => {
525
543
  const file = path.basename(filePath);
526
- const { html, frontmatter: rawFrontmatter } = markdownToHtml(await fs.readFile(filePath, "utf-8"), {
527
- features: {
528
- ...DEFAULT_COMPILE_OPTIONS.features,
529
- ...features
530
- },
531
- ...restCompileOptions
532
- });
533
- const frontmatter = await parse(rawFrontmatter);
534
- return {
544
+ const ext = path.extname(filePath);
545
+ const md = ext === ".md";
546
+ const content = await fs.readFile(filePath, "utf-8");
547
+ let res = ext === ".md" ? markdownToHtml(content, parserArgs) : mdxToJs(content, parserArgs);
548
+ if (res instanceof Promise)
549
+ res = await res;
550
+ const frontmatter = await parse(res.frontmatter);
551
+ const body = "html" in res ? res.html : res.code;
552
+ const slug = slugify(path.basename(file, md ? ".md" : ".mdx"));
553
+ return md ? {
535
554
  ...frontmatter,
536
- __mdsrc: {
537
- slug: path.basename(file, ".md").toLowerCase().replace(/\s+/g, "-"),
538
- filename: file
539
- },
540
- body: html.trim()
555
+ __mdsrc: { slug, filename: file, type: "md" },
556
+ html: body.trim()
557
+ } : {
558
+ ...frontmatter,
559
+ __mdsrc: { slug, filename: file, type: "mdx" },
560
+ code: body.trim()
541
561
  };
542
562
  }));
543
563
  } catch (err) {
@@ -601,73 +621,154 @@ function schemaToType(schema) {
601
621
  `);
602
622
  return `{ ${fields} }`;
603
623
  }
624
+ async function getManifest(outDir) {
625
+ return fs.readFile(path.join(outDir, "manifest.json"), "utf-8").then(JSON.parse).then((manifest) => {
626
+ if (!isRecord(manifest))
627
+ return null;
628
+ const entries = Object.entries(manifest).filter((entry) => typeof entry[0] === "string" && Array.isArray(entry[1]) && entry[1].every((value) => typeof value === "string"));
629
+ return Object.fromEntries(entries);
630
+ }).catch(() => null);
631
+ }
632
+ async function cleanup(outDir, manifest, prevManifest) {
633
+ if (!prevManifest)
634
+ return false;
635
+ const files = new Set(Object.values(manifest).flat());
636
+ const prevFiles = Object.values(prevManifest).flat();
637
+ const staleDirs = new Set;
638
+ let cleaned = false;
639
+ for (const filePath of prevFiles) {
640
+ if (files.has(filePath))
641
+ continue;
642
+ await fs.rm(filePath, { force: true });
643
+ fileCache.delete(filePath);
644
+ staleDirs.add(path.dirname(filePath));
645
+ cleaned = true;
646
+ }
647
+ for (const dir of [...staleDirs].toSorted((a, b) => b.length - a.length)) {
648
+ if (dir === outDir)
649
+ continue;
650
+ try {
651
+ if ((await fs.readdir(dir)).length)
652
+ continue;
653
+ } catch (err) {
654
+ if (!isENOENT(err))
655
+ throw err;
656
+ continue;
657
+ }
658
+ await fs.rm(dir, { recursive: true, force: true });
659
+ cleaned = true;
660
+ }
661
+ return cleaned;
662
+ }
604
663
  async function build(src, buildContext) {
605
664
  const { logger: logger2, outDir } = buildContext;
606
665
  let names = [];
607
666
  const collections = {};
667
+ const manifest = {};
608
668
  try {
609
669
  if (!outDir)
610
670
  throw new Error("Output directory is not defined");
611
671
  await fs.mkdir(outDir, { recursive: true });
672
+ const prevManifest = await getManifest(outDir);
612
673
  for (const collection of src) {
613
674
  const raw = await create(path.join(process.cwd(), collection.dir), buildContext);
614
675
  const validated = raw.map((item) => {
615
- const { body, __mdsrc, ...metadata } = item;
676
+ const { html, code, __mdsrc, ...metadata } = item;
616
677
  const res = validate(metadata, collection.schema);
617
678
  if (res.issues)
618
679
  throw new Error(JSON.stringify(res.issues, null, 2));
619
- return {
620
- ...res.value,
621
- body,
622
- __mdsrc
623
- };
680
+ return __mdsrc.type === "md" ? { ...res.value, __mdsrc, html } : { ...res.value, __mdsrc, code };
624
681
  });
625
682
  collections[collection.name] = {
626
683
  items: validated,
627
684
  schema: collection.schema
628
685
  };
686
+ manifest[collection.name] = [];
629
687
  }
630
688
  names = Object.keys(collections);
689
+ const componentTypeDef = names.some((name) => collections[name]?.items.some(isMdx)) ? getComponentTypeDef(buildContext.compileOptions) : null;
631
690
  const promises = [];
632
- promises.push(maybeWrite(path.join(outDir, "types.ts"), `
691
+ promises.push(maybeWrite(path.join(outDir, "types.ts"), ` ${AUTOGEN_MSG}
692
+
693
+ import type { Collection } from '${PKG_NAME}'
694
+ ${componentTypeDef ? `
695
+ ${componentTypeDef.import}` : ""}
696
+
697
+ ${componentTypeDef ? `
698
+ type Component = ${componentTypeDef.type}
699
+ ` : ""}
700
+
633
701
  ${names.map((name) => `
634
- export type ${capitalise(name)} = ${schemaToType(collections[name].schema)} & {
635
- body: string,
636
- __mdsrc: {
637
- slug: string
638
- filename: string
639
- },
640
- }
702
+ export type ${capitalise(singularise(name))} = ${schemaToType(collections[name].schema)} & {
703
+ html?: string,
704
+ Component?: ${componentTypeDef ? "Component" : "unknown"},
705
+ } & Collection.Metadata
641
706
  `).join(`
642
707
 
643
708
  `)}`.trim()));
644
- promises.push(maybeWrite(path.join(outDir, "index.d.ts"), `
645
- import type { ${names.map((name) => capitalise(name)).join(", ")} } from './types.js'
709
+ promises.push(maybeWrite(path.join(outDir, "index.d.ts"), ` ${AUTOGEN_MSG}
710
+
711
+ import type { ${names.map((name) => capitalise(singularise(name))).join(", ")} } from './types.js'
646
712
 
647
713
  ${names.map((name) => `
648
- export const all${capitalise(pluralise(name, 2))}: ${capitalise(name)}[]
714
+ export const all${capitalise(pluralise(name, 2))}: ${capitalise(singularise(name))}[]
649
715
  `).join(`
650
716
 
651
717
  `)}
652
718
 
653
719
  declare module '${PKG_NAME}' {
654
720
  ${names.map((name) => `
655
- export const all${capitalise(pluralise(name, 2))}: ${capitalise(name)}[]
721
+ export const all${capitalise(pluralise(name, 2))}: ${capitalise(singularise(name))}[]
656
722
  `).join(`
657
723
 
658
724
  `)}
659
725
  }
660
726
  `.trim()));
661
727
  for (const name of names) {
662
- const collection = collections[name]?.items;
728
+ const collection = collections[name]?.items ?? [];
663
729
  const fileName = toModuleName(name);
664
- promises.push(maybeWrite(path.join(outDir, `${fileName}.js`), `export const all${capitalise(pluralise(name, 2))} = ${collection?.length ? JSON.stringify(collection) : "[]"}`.trim()));
730
+ const filePath = `${fileName}.js`;
731
+ const imports = [];
732
+ const entries = [];
733
+ if (collection.some(isMdx)) {
734
+ await fs.mkdir(path.join(outDir, fileName), { recursive: true });
735
+ }
736
+ for (let i = 0;i < collection.length; i++) {
737
+ const item = collection[i];
738
+ if (isMdx(item)) {
739
+ const slug = item.__mdsrc.slug;
740
+ const fullPath2 = path.join(outDir, fileName, `${slug}.js`);
741
+ manifest[name].push(fullPath2);
742
+ promises.push(maybeWrite(fullPath2, item.code));
743
+ const importName = `C${i}`;
744
+ imports.push(`import ${importName} from './${fileName}/${slug}.js'`);
745
+ const { code, ...rest } = item;
746
+ entries.push(`{ ...${JSON.stringify(rest)}, Component: ${importName} }`);
747
+ } else {
748
+ entries.push(JSON.stringify(item));
749
+ }
750
+ }
751
+ const fullPath = path.join(outDir, filePath);
752
+ manifest[name].push(fullPath);
753
+ promises.push(maybeWrite(fullPath, ` ${AUTOGEN_MSG}
754
+
755
+ ${imports.join(`
756
+ `)}
757
+
758
+ export const all${capitalise(pluralise(name, 2))} = [${entries.join(`,
759
+ `)}]`.trim()));
665
760
  }
666
- promises.push(maybeWrite(path.join(outDir, "index.js"), names.map((name) => `export * from './${toModuleName(name)}.js'`).join(`
667
- `)));
761
+ promises.push(maybeWrite(path.join(outDir, "index.js"), `${AUTOGEN_MSG}
762
+
763
+ ${names.map((name) => `
764
+ export * from './${toModuleName(name)}.js'
765
+ `).join(`
766
+ `)}`));
767
+ promises.push(maybeWrite(path.join(outDir, "manifest.json"), JSON.stringify(manifest, null, 2)));
668
768
  const writes = await Promise.all(promises);
769
+ const cleaned = await cleanup(outDir, manifest, prevManifest);
669
770
  buildContext.names = names;
670
- return writes.some((changed) => changed);
771
+ return writes.some((c) => c) || cleaned;
671
772
  } catch (err) {
672
773
  logger2.error("[build]: failed to generate data", err);
673
774
  throw err;
@@ -778,6 +879,41 @@ function mdsrc(config) {
778
879
  function toModuleName(name) {
779
880
  return name.toLowerCase();
780
881
  }
882
+ function getComponentTypeDef(compileOptions) {
883
+ const importSource = getJsxImportSource(compileOptions);
884
+ switch (importSource) {
885
+ case "preact": {
886
+ return {
887
+ import: `import type { ComponentType } from 'preact'`,
888
+ type: `ComponentType<{ components?: Record<string, ComponentType<any>> }>`
889
+ };
890
+ }
891
+ case "solid-js": {
892
+ return {
893
+ import: `import type { Component } from 'solid-js'`,
894
+ type: `Component<{ components?: Record<string, Component<any>> }>`
895
+ };
896
+ }
897
+ case "react":
898
+ default: {
899
+ return {
900
+ import: `import type { ComponentType } from 'react'`,
901
+ type: `ComponentType<{ components?: Record<string, ComponentType<any>> }>`
902
+ };
903
+ }
904
+ }
905
+ }
906
+ function getJsxImportSource(compileOptions) {
907
+ if (!compileOptions)
908
+ return "react";
909
+ if ("jsxImportSource" in compileOptions && typeof compileOptions.jsxImportSource === "string") {
910
+ return compileOptions.jsxImportSource;
911
+ }
912
+ return "react";
913
+ }
914
+ function isMdx(item) {
915
+ return item.__mdsrc.type === "mdx";
916
+ }
781
917
  export {
782
918
  toModuleName,
783
919
  setFileCache,
@@ -785,12 +921,14 @@ export {
785
921
  parse,
786
922
  maybeWrite,
787
923
  isENOENT,
924
+ getManifest,
788
925
  getFileCache,
789
926
  fileCache,
790
927
  mdsrc as default,
791
928
  create,
929
+ cleanup,
792
930
  FILE_CACHE_MAX_SIZE,
793
931
  DEFAULT_COMPILE_OPTIONS
794
932
  };
795
933
 
796
- //# debugId=49D42D1A4493323164756E2164756E21
934
+ //# debugId=7E42618D1E5115AF64756E2164756E21
package/dist/index.js.map CHANGED
@@ -2,14 +2,14 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/config.ts", "../src/logger.ts", "../src/utils.ts", "../src/types.ts", "../src/validate.ts"],
4
4
  "sourcesContent": [
5
- "import { realpathSync } from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport type { Plugin, ViteDevServer } from 'vite'\n\nimport { markdownToHtml, type CompileOptions, type MarkdownToHtmlResult } from 'satteri'\n\nimport type { BuildContext, Collection, PluginConfig, Raw, Schema } from './types.js'\nimport { GENERATED_DIR, PKG_NAME } from './config.js'\nimport { Logger } from './logger.js'\nimport { capitalise, debounce, pluralise } from './utils.js'\nimport { parseKey, validate } from './validate.js'\n\nexport const DEFAULT_COMPILE_OPTIONS = {\n\tfeatures: {\n\t\tfrontmatter: true,\n\t},\n} satisfies CompileOptions\n\nexport type { CompileOptions } from './types.js'\n\n/**\n * Parse YAML or TOML frontmatter\n */\nexport async function parse(frontmatter: MarkdownToHtmlResult['frontmatter']) {\n\tif (!frontmatter) return {}\n\n\tconst { kind, value } = frontmatter\n\n\tswitch (kind) {\n\t\tcase 'yaml': {\n\t\t\treturn (await import('yaml')).parse(value)\n\t\t}\n\t\tcase 'toml': {\n\t\t\treturn (await import('smol-toml')).parse(value)\n\t\t}\n\t}\n}\n\n/**\n * Read every markdown file in a collection and turn it into the raw entry shape\n * add mdsrc metadata like slug and filename alongside the trimmed body\n * return an empty list if the directory read fails\n */\nexport async function create(dir: string, buildContext: BuildContext) {\n\tconst { logger, compileOptions = {} } = buildContext\n\tconst { features, ...restCompileOptions } = compileOptions\n\n\ttry {\n\t\t// only pick up markdown files from this directory\n\t\t// leave everything else alone\n\t\tconst files = (await fs.readdir(dir)).filter(\n\t\t\t(file: string) => path.extname(file) === '.md',\n\t\t)\n\t\tconst filePaths = files.map(file => path.join(dir, file))\n\n\t\tif (!files.length) {\n\t\t\tlogger.warn(`mdsrc: ${dir} is empty`)\n\t\t\treturn []\n\t\t}\n\n\t\treturn Promise.all(\n\t\t\tfilePaths.map(async filePath => {\n\t\t\t\tconst file = path.basename(filePath)\n\n\t\t\t\tconst { html, frontmatter: rawFrontmatter } = markdownToHtml(\n\t\t\t\t\tawait fs.readFile(filePath, 'utf-8'),\n\t\t\t\t\t{\n\t\t\t\t\t\tfeatures: {\n\t\t\t\t\t\t\t...DEFAULT_COMPILE_OPTIONS.features,\n\t\t\t\t\t\t\t...features,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t...restCompileOptions,\n\t\t\t\t\t},\n\t\t\t\t)\n\n\t\t\t\tconst frontmatter = await parse(rawFrontmatter)\n\n\t\t\t\treturn {\n\t\t\t\t\t...frontmatter,\n\t\t\t\t\t__mdsrc: {\n\t\t\t\t\t\tslug: path.basename(file, '.md').toLowerCase().replace(/\\s+/g, '-'),\n\t\t\t\t\t\tfilename: file,\n\t\t\t\t\t},\n\t\t\t\t\tbody: html.trim(),\n\t\t\t\t} satisfies Raw\n\t\t\t}),\n\t\t)\n\t} catch (err) {\n\t\tlogger.error('[create]: failed to create entries', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * LRU cache for file content. Stores the last written content per file path\n * so `maybeWrite` can skip disk I/O when nothing has changed.\n *\n * Uses Map insertion order to track recency: the front of the map holds the\n * least recently used entries, which are evicted first when the cache is full.\n */\nexport const fileCache = new Map<string, string>()\n\nexport const FILE_CACHE_MAX_SIZE = 100\n\n/**\n * Promote an existing cache entry to most-recently-used by deleting and\n * re-inserting it, which moves it to the end of the Map's iteration\n * order. If the cache is at capacity, evict the least recently used\n * entry (front) before inserting\n */\nexport function setFileCache(filePath: string, content: string) {\n\tfileCache.delete(filePath)\n\n\tif (fileCache.size >= FILE_CACHE_MAX_SIZE) {\n\t\tconst lru = fileCache.keys().next().value\n\n\t\tif (lru !== undefined) {\n\t\t\tfileCache.delete(lru)\n\t\t}\n\t}\n\n\tfileCache.set(filePath, content)\n}\n\n/**\n * Retrieve a cached value and promote it to most-recently-used so it won't\n * be evicted while still actively referenced\n */\nexport function getFileCache(filePath: string) {\n\tconst content = fileCache.get(filePath)\n\n\tif (content !== undefined) {\n\t\tsetFileCache(filePath, content)\n\t}\n\n\treturn content\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = getFileCache(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tsetFileCache(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tsetFileCache(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tsetFileCache(filePath, content)\n\n\treturn true\n}\n\nexport function schemaToType(schema: Schema) {\n\tconst fields = Object.entries(schema)\n\t\t.map(([k, v]) => {\n\t\t\tconst { key, optional } = parseKey(k)\n\n\t\t\tlet type: string\n\n\t\t\tif (typeof v === 'string') {\n\t\t\t\t// date will be an ISO string post validation\n\t\t\t\ttype = v === 'date' ? 'string' : v === 'array' ? 'any[]' : v\n\t\t\t} else {\n\t\t\t\t// recursively call for record shapes\n\t\t\t\ttype = schemaToType(v)\n\t\t\t}\n\n\t\t\treturn `${key}${optional ? '?' : ''}: ${type}`\n\t\t})\n\t\t.join('\\n ')\n\n\treturn `{ ${fields} }`\n}\n\nasync function build(src: Collection[], buildContext: BuildContext) {\n\tconst { logger, outDir } = buildContext\n\tlet names: string[] = []\n\n\t// keep each validated collection beside its schema so emit stays in sync\n\tconst collections: Record<\n\t\tstring,\n\t\t{\n\t\t\titems: Raw[]\n\t\t\tschema: Schema\n\t\t}\n\t> = {}\n\n\ttry {\n\t\tif (!outDir) throw new Error('Output directory is not defined')\n\n\t\t// make sure the output directory exists before the writes begin\n\t\t// that way the emit step can stay simple\n\t\tawait fs.mkdir(outDir, { recursive: true })\n\n\t\t// read and validate every collection before writing anything out\n\t\t// this keeps the js and dts outputs in step\n\t\tfor (const collection of src) {\n\t\t\tconst raw = await create(path.join(process.cwd(), collection.dir), buildContext)\n\n\t\t\t// check each raw item before it makes it into the generated collection\n\t\t\t// bad entries get logged and dropped\n\t\t\tconst validated = raw.map(item => {\n\t\t\t\tconst { body, __mdsrc, ...metadata } = item\n\t\t\t\tconst res = validate(metadata, collection.schema)\n\n\t\t\t\tif (res.issues) throw new Error(JSON.stringify(res.issues, null, 2))\n\n\t\t\t\treturn {\n\t\t\t\t\t...res.value,\n\t\t\t\t\tbody,\n\t\t\t\t\t__mdsrc,\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tcollections[collection.name] = {\n\t\t\t\t// keep the cleaned items with the schema they came from\n\t\t\t\t// both js and dts generation read from this shape\n\t\t\t\titems: validated,\n\t\t\t\tschema: collection.schema,\n\t\t\t}\n\t\t}\n\n\t\t// take the collection names after validation has settled\n\t\t// every generated file then works from the same list\n\t\tnames = Object.keys(collections)\n\t\t// queue the file writes first so the emit phase can run together\n\t\t// wait for them once every output is ready\n\t\tconst promises = []\n\n\t\t// build the type file from the schema rather than the observed data\n\t\t// that keeps optional fields and date output honest\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'types.ts'),\n\t\t\t\t`\n\t\t\t\t\t${names\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\texport type ${capitalise(name)} = ${schemaToType(collections[name].schema)} & {\n\t\t\t\t\t\t\t\t\tbody: string,\n\t\t\t\t\t\t\t\t\t__mdsrc: {\n\t\t\t\t\t\t\t\t\t\tslug: string\n\t\t\t\t\t\t\t\t\t\tfilename: string\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n\\n')}`.trim(),\n\t\t\t),\n\t\t)\n\n\t\t// write the package surface separately so consumers get typed named exports\n\t\t// this mirrors the generated js entry file\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'index.d.ts'),\n\t\t\t\t`\t\n\t\t\t\t\timport type { ${names.map(name => capitalise(name)).join(', ')} } from './types.js'\n\n\t\t\t\t\t${names\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\texport const all${capitalise(pluralise(name, 2))}: ${capitalise(name)}[]\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n\\n')}\n\n\t\t\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t\t\t${names\n\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\t\texport const all${capitalise(pluralise(name, 2))}: ${capitalise(name)}[]\n\t\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.join('\\n\\n')}\n\t\t\t\t\t}\n\t\t\t\t`.trim(),\n\t\t\t),\n\t\t)\n\n\t\t// serialise each validated collection as a plain module for Vite to load\n\t\tfor (const name of names) {\n\t\t\tconst collection = collections[name]?.items\n\t\t\tconst fileName = toModuleName(name)\n\n\t\t\tpromises.push(\n\t\t\t\tmaybeWrite(\n\t\t\t\t\tpath.join(outDir, `${fileName}.js`),\n\t\t\t\t\t`export const all${capitalise(pluralise(name, 2))} = ${collection?.length ? JSON.stringify(collection) : '[]'}`.trim(),\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\t// stitch the per-collection modules into the public js entrypoint\n\t\t// this is the file the root package import resolves to\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'index.js'),\n\t\t\t\tnames.map(name => `export * from './${toModuleName(name)}.js'`).join('\\n'),\n\t\t\t),\n\t\t)\n\n\t\t// flush every generated artifact once all the content is ready\n\t\t// let any failed write fail the build\n\t\tconst writes = await Promise.all(promises)\n\t\tbuildContext.names = names\n\n\t\treturn writes.some(changed => changed)\n\t} catch (err) {\n\t\tlogger.error('[build]: failed to generate data', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Convert watcher paths to a consistent slash format before comparing them\n */\nfunction normaliseWatchPath(p: string) {\n\treturn p.replace(/\\\\/g, '/')\n}\n\n/**\n * Build the Vite plugin that validates collections and writes the generated modules\n * keep the runtime data and declaration files in the same pass\n * resolve package imports from the generated directory\n */\nexport default function mdsrc(config: PluginConfig): Plugin {\n\tconst src = config.collections\n\n\t// use one logger for the whole build so every step reports the same way\n\t// stay chatty outside production\n\tconst logger = new Logger(\n\t\tconfig.logger?.level ?? (process.env.NODE_ENV === 'production' ? 'error' : 'debug'),\n\t)\n\n\t// write generated files into a hidden folder at the project root\n\t// keep the generated surface out of src\n\tconst outDir = path.join(process.cwd(), GENERATED_DIR)\n\tconst watchRoot = normaliseWatchPath(realpathSync.native(process.cwd()))\n\tconst watchedRoots = src.map(c => `${normaliseWatchPath(path.join(watchRoot, c.dir))}/`)\n\n\t// watcher events can arrive through symlinked paths like /var while cwd has\n\t// already resolved to /private/var, so canonicalise the parent dir once and\n\t// reattach the file name for stable prefix checks\n\tconst resolveWatchFile = (filePath: string) => {\n\t\tconst absolutePath = path.resolve(watchRoot, filePath)\n\t\tconst parentPath = path.dirname(absolutePath)\n\n\t\ttry {\n\t\t\tconst resolvedParentPath = normaliseWatchPath(realpathSync.native(parentPath))\n\t\t\treturn normaliseWatchPath(\n\t\t\t\tpath.join(resolvedParentPath, path.basename(absolutePath)),\n\t\t\t)\n\t\t} catch {\n\t\t\treturn normaliseWatchPath(absolutePath)\n\t\t}\n\t}\n\n\tfunction watchedFile(filePath: string) {\n\t\treturn watchedRoots.some(root => resolveWatchFile(filePath).startsWith(root))\n\t}\n\n\t// pass shared build tools into helpers without dragging lots of state around\n\t// keep the helper signatures small\n\tconst buildContext = {\n\t\tlogger,\n\t\tcompileOptions: config.compileOptions,\n\t\toutDir,\n\t\tnames: [],\n\t} satisfies BuildContext\n\n\tlet rebuildRunning = false\n\tlet rebuildQueued = false\n\tlet rebuildReason = 'change'\n\n\tconst rebuild = debounce((event: string, filePath: string) => {\n\t\tfunction queue() {\n\t\t\tvoid (async () => {\n\t\t\t\t// collapse bursts of file events into one active rebuild plus a single\n\t\t\t\t// queued rerun when changes land mid-build\n\t\t\t\tif (rebuildRunning) {\n\t\t\t\t\trebuildQueued = true\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\trebuildRunning = true\n\n\t\t\t\tdo {\n\t\t\t\t\trebuildQueued = false\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst changed = await build(src, buildContext)\n\n\t\t\t\t\t\tif (changed) logger.info(`[watch]: content rebuilt (${rebuildReason})`)\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tlogger.error('[watch] content rebuild failed', err)\n\t\t\t\t\t}\n\t\t\t\t} while (rebuildQueued)\n\n\t\t\t\trebuildRunning = false\n\t\t\t})()\n\t\t}\n\n\t\t// ignore anything outside the watched content dirs\n\t\tif (!watchedFile(filePath)) return\n\n\t\tconst file = resolveWatchFile(filePath)\n\n\t\trebuildReason = `${event}: ${path.relative(watchRoot, file)}`\n\t\tqueue()\n\t}, 75)\n\n\treturn {\n\t\tname: 'mdsrc',\n\t\tenforce: 'pre',\n\t\tconfig(viteConfig) {\n\t\t\tviteConfig.optimizeDeps ??= {}\n\t\t\tviteConfig.optimizeDeps.exclude = [\n\t\t\t\t...new Set([...(viteConfig.optimizeDeps.exclude ?? []), PKG_NAME]),\n\t\t\t]\n\n\t\t\tviteConfig.resolve ??= {}\n\n\t\t\tif (Array.isArray(viteConfig.resolve.alias)) {\n\t\t\t\tviteConfig.resolve.alias = [\n\t\t\t\t\t...viteConfig.resolve.alias,\n\t\t\t\t\t{\n\t\t\t\t\t\tfind: PKG_NAME,\n\t\t\t\t\t\treplacement: path.join(outDir, 'index.js'),\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t} else {\n\t\t\t\tviteConfig.resolve.alias = {\n\t\t\t\t\t...viteConfig.resolve.alias,\n\t\t\t\t\t[PKG_NAME]: path.join(outDir, 'index.js'),\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tasync buildStart() {\n\t\t\tawait build(src, buildContext)\n\t\t},\n\t\tconfigureServer(server: ViteDevServer) {\n\t\t\tlogger.info(\n\t\t\t\t`[configureServer]: Watching for changes in ./${src.map(c => c.dir).join(', ')}...`,\n\t\t\t)\n\n\t\t\tserver.watcher\n\t\t\t\t.on('add', (p: string) => rebuild('add', p))\n\t\t\t\t.on('change', (p: string) => rebuild('change', p))\n\t\t\t\t.on('unlink', (p: string) => rebuild('unlink', p))\n\t\t},\n\t\tresolveId(id) {\n\t\t\t// point imports at generated files rather than source files\n\t\t\t// that makes the package behave like a normal module\n\t\t\tif (id === PKG_NAME) return path.join(outDir, 'index.js')\n\n\t\t\tif (id.startsWith(`${PKG_NAME}/`)) {\n\t\t\t\t// allow collection subpath imports once the build knows their names\n\t\t\t\t// leave unknown subpaths unresolved\n\t\t\t\tconst subpath = id.slice(PKG_NAME.length + 1)\n\t\t\t\tconst match = buildContext.names.find(\n\t\t\t\t\tname => name === subpath || toModuleName(name) === subpath,\n\t\t\t\t)\n\n\t\t\t\tif (match) return path.join(outDir, `${toModuleName(match)}.js`)\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t}\n}\n\nexport function toModuleName(name: string) {\n\treturn name.toLowerCase()\n}\n",
6
- "export const NAME = 'mdsrc'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`",
5
+ "import { realpathSync } from 'node:fs'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\n\nimport type { Plugin, ViteDevServer } from 'vite'\n\nimport {\n\tmarkdownToHtml,\n\tmdxToJs,\n\ttype CompileOptions,\n\ttype MarkdownToHtmlResult,\n} from 'satteri'\n\nimport type {\n\tAcceptedExtension,\n\tBuildContext,\n\tCollection,\n\tManifest,\n\tMdxRaw,\n\tPluginConfig,\n\tRaw,\n\tSchema,\n} from './types.js'\nimport { AUTOGEN_MSG, GENERATED_DIR, PKG_NAME } from './config.js'\nimport { Logger } from './logger.js'\nimport {\n\tcapitalise,\n\tdebounce,\n\tisRecord,\n\tpluralise,\n\tsingularise,\n\tslugify,\n} from './utils.js'\nimport { parseKey, validate } from './validate.js'\n\nexport const DEFAULT_COMPILE_OPTIONS = {\n\tfeatures: {\n\t\tfrontmatter: true,\n\t},\n} satisfies CompileOptions\n\nconst ACCEPTED_EXTENSIONS = ['md', 'mdx'] as const satisfies AcceptedExtension[]\n\nexport type { Collection, CompileOptions } from './types.js'\n\n/**\n * Parse YAML or TOML frontmatter\n */\nexport async function parse(frontmatter: MarkdownToHtmlResult['frontmatter']) {\n\tif (!frontmatter) return {}\n\n\tconst { kind, value } = frontmatter\n\n\tswitch (kind) {\n\t\tcase 'yaml': {\n\t\t\treturn (await import('yaml')).parse(value)\n\t\t}\n\t\tcase 'toml': {\n\t\t\treturn (await import('smol-toml')).parse(value)\n\t\t}\n\t}\n}\n\n/**\n * Read every markdown file in a collection and turn it into the raw entry shape\n * add mdsrc metadata like slug and filename alongside the trimmed body\n * return an empty list if the directory read fails\n */\nexport async function create(dir: string, buildContext: BuildContext) {\n\tconst { logger, compileOptions = {} } = buildContext\n\tconst { features, ...restCompileOptions } = compileOptions\n\n\ttry {\n\t\t// only pick up markdown files from this directory\n\t\t// leave everything else alone\n\t\tconst files = (await fs.readdir(dir)).filter((file: string) =>\n\t\t\tACCEPTED_EXTENSIONS.some(e => `.${e}` === path.extname(file)),\n\t\t)\n\t\tconst filePaths = files.map(file => path.join(dir, file))\n\n\t\tif (!files.length) {\n\t\t\tlogger.warn(`mdsrc: ${dir} is empty`)\n\t\t\treturn []\n\t\t}\n\n\t\tconst parserArgs = {\n\t\t\tfeatures: {\n\t\t\t\t...DEFAULT_COMPILE_OPTIONS.features,\n\t\t\t\t...features,\n\t\t\t},\n\t\t\t...restCompileOptions,\n\t\t}\n\n\t\treturn Promise.all(\n\t\t\tfilePaths.map(async filePath => {\n\t\t\t\tconst file = path.basename(filePath)\n\n\t\t\t\tconst ext = path.extname(filePath)\n\t\t\t\t// if not markdown, must be mdx\n\t\t\t\tconst md = ext === '.md'\n\t\t\t\tconst content = await fs.readFile(filePath, 'utf-8')\n\n\t\t\t\tlet res =\n\t\t\t\t\text === '.md'\n\t\t\t\t\t\t? markdownToHtml(content, parserArgs)\n\t\t\t\t\t\t: mdxToJs(content, parserArgs)\n\n\t\t\t\t// if any async plugins are used, `res` will be a Promise\n\t\t\t\tif (res instanceof Promise) res = await res\n\n\t\t\t\tconst frontmatter = await parse(res.frontmatter)\n\t\t\t\tconst body = 'html' in res ? res.html : res.code\n\t\t\t\tconst slug = slugify(path.basename(file, md ? '.md' : '.mdx'))\n\n\t\t\t\treturn md\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...frontmatter,\n\t\t\t\t\t\t\t__mdsrc: { slug, filename: file, type: 'md' as const },\n\t\t\t\t\t\t\thtml: body.trim(),\n\t\t\t\t\t\t}\n\t\t\t\t\t: {\n\t\t\t\t\t\t\t...frontmatter,\n\t\t\t\t\t\t\t__mdsrc: { slug, filename: file, type: 'mdx' as const },\n\t\t\t\t\t\t\tcode: body.trim(),\n\t\t\t\t\t\t}\n\t\t\t}),\n\t\t)\n\t} catch (err) {\n\t\tlogger.error('[create]: failed to create entries', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Returns whether the error was caused by a missing file or directory\n */\nexport function isENOENT(err: unknown) {\n\treturn err instanceof Error && 'code' in err && err.code === 'ENOENT'\n}\n\n/**\n * LRU cache for file content. Stores the last written content per file path\n * so `maybeWrite` can skip disk I/O when nothing has changed.\n *\n * Uses Map insertion order to track recency: the front of the map holds the\n * least recently used entries, which are evicted first when the cache is full.\n */\nexport const fileCache = new Map<string, string>()\n\nexport const FILE_CACHE_MAX_SIZE = 100\n\n/**\n * Promote an existing cache entry to most-recently-used by deleting and\n * re-inserting it, which moves it to the end of the Map's iteration\n * order. If the cache is at capacity, evict the least recently used\n * entry (front) before inserting\n */\nexport function setFileCache(filePath: string, content: string) {\n\tfileCache.delete(filePath)\n\n\tif (fileCache.size >= FILE_CACHE_MAX_SIZE) {\n\t\tconst lru = fileCache.keys().next().value\n\n\t\tif (lru !== undefined) {\n\t\t\tfileCache.delete(lru)\n\t\t}\n\t}\n\n\tfileCache.set(filePath, content)\n}\n\n/**\n * Retrieve a cached value and promote it to most-recently-used so it won't\n * be evicted while still actively referenced\n */\nexport function getFileCache(filePath: string) {\n\tconst content = fileCache.get(filePath)\n\n\tif (content !== undefined) {\n\t\tsetFileCache(filePath, content)\n\t}\n\n\treturn content\n}\n\n/**\n * Write a file only if the content has changed since the last build\n */\nexport async function maybeWrite(filePath: string, content: string) {\n\tconst cached = getFileCache(filePath)\n\n\tif (cached !== content) {\n\t\t// cache says content changed, write without reading\n\t\tawait fs.writeFile(filePath, content)\n\t\tsetFileCache(filePath, content)\n\n\t\treturn true\n\t}\n\n\t// cache miss or cache hit with same content — verify on disk\n\ttry {\n\t\tif ((await fs.readFile(filePath, 'utf-8')) === content) {\n\t\t\tsetFileCache(filePath, content)\n\t\t\treturn false\n\t\t}\n\t} catch (err) {\n\t\tif (!isENOENT(err)) throw err\n\t}\n\n\tawait fs.writeFile(filePath, content)\n\tsetFileCache(filePath, content)\n\n\treturn true\n}\n\nexport function schemaToType(schema: Schema) {\n\tconst fields = Object.entries(schema)\n\t\t.map(([k, v]) => {\n\t\t\tconst { key, optional } = parseKey(k)\n\n\t\t\tlet type: string\n\n\t\t\tif (typeof v === 'string') {\n\t\t\t\t// date will be an ISO string post validation\n\t\t\t\ttype = v === 'date' ? 'string' : v === 'array' ? 'any[]' : v\n\t\t\t} else {\n\t\t\t\t// recursively call for record shapes\n\t\t\t\ttype = schemaToType(v)\n\t\t\t}\n\n\t\t\treturn `${key}${optional ? '?' : ''}: ${type}`\n\t\t})\n\t\t.join('\\n ')\n\n\treturn `{ ${fields} }`\n}\n\nexport async function getManifest(outDir: string) {\n\treturn fs\n\t\t.readFile(path.join(outDir, 'manifest.json'), 'utf-8')\n\t\t.then(JSON.parse)\n\t\t.then(manifest => {\n\t\t\tif (!isRecord(manifest)) return null\n\n\t\t\tconst entries = Object.entries(manifest).filter(\n\t\t\t\t(entry): entry is [string, string[]] =>\n\t\t\t\t\ttypeof entry[0] === 'string' &&\n\t\t\t\t\tArray.isArray(entry[1]) &&\n\t\t\t\t\tentry[1].every(value => typeof value === 'string'),\n\t\t\t)\n\n\t\t\treturn Object.fromEntries(entries)\n\t\t})\n\t\t.catch(() => null)\n}\n\nexport async function cleanup(\n\toutDir: string,\n\tmanifest: Manifest,\n\tprevManifest: Manifest | null,\n) {\n\tif (!prevManifest) return false\n\n\tconst files = new Set(Object.values(manifest).flat())\n\tconst prevFiles = Object.values(prevManifest).flat()\n\tconst staleDirs = new Set<string>()\n\n\tlet cleaned = false\n\n\tfor (const filePath of prevFiles) {\n\t\t// this asset still exists\n\t\tif (files.has(filePath)) continue\n\n\t\tawait fs.rm(filePath, { force: true })\n\n\t\tfileCache.delete(filePath)\n\t\tstaleDirs.add(path.dirname(filePath))\n\n\t\tcleaned = true\n\t}\n\n\t// sort so nested dirs are removed first\n\tfor (const dir of [...staleDirs].toSorted((a, b) => b.length - a.length)) {\n\t\tif (dir === outDir) continue\n\n\t\ttry {\n\t\t\tif ((await fs.readdir(dir)).length) continue\n\t\t} catch (err) {\n\t\t\tif (!isENOENT(err)) throw err\n\t\t\tcontinue\n\t\t}\n\n\t\tawait fs.rm(dir, { recursive: true, force: true })\n\t\tcleaned = true\n\t}\n\n\treturn cleaned\n}\n\nasync function build(src: Collection.Entry[], buildContext: BuildContext) {\n\tconst { logger, outDir } = buildContext\n\tlet names: string[] = []\n\n\t// keep each validated collection beside its schema so emit stays in sync\n\tconst collections: Record<\n\t\tstring,\n\t\t{\n\t\t\titems: Raw[]\n\t\t\tschema: Schema\n\t\t}\n\t> = {}\n\n\t// file manifest for cleanup\n\tconst manifest: Record<string, string[]> = {}\n\n\ttry {\n\t\tif (!outDir) throw new Error('Output directory is not defined')\n\n\t\t// make sure the output directory exists before the writes begin\n\t\tawait fs.mkdir(outDir, { recursive: true })\n\t\tconst prevManifest = await getManifest(outDir)\n\n\t\t// read and validate every collection before writing anything out\n\t\t// this keeps the js and dts outputs in step\n\t\tfor (const collection of src) {\n\t\t\tconst raw = await create(path.join(process.cwd(), collection.dir), buildContext)\n\n\t\t\t// check each raw item before it makes it into the generated collection\n\t\t\t// bad entries get logged and dropped\n\t\t\tconst validated: Raw[] = raw.map(item => {\n\t\t\t\tconst { html, code, __mdsrc, ...metadata } = item\n\t\t\t\tconst res = validate(metadata, collection.schema)\n\n\t\t\t\tif (res.issues) throw new Error(JSON.stringify(res.issues, null, 2))\n\n\t\t\t\treturn __mdsrc.type === 'md'\n\t\t\t\t\t? { ...res.value, __mdsrc, html }\n\t\t\t\t\t: { ...res.value, __mdsrc, code }\n\t\t\t})\n\n\t\t\tcollections[collection.name] = {\n\t\t\t\t// keep the cleaned items with the schema they came from\n\t\t\t\t// both js and dts generation read from this shape\n\t\t\t\titems: validated,\n\t\t\t\tschema: collection.schema,\n\t\t\t}\n\n\t\t\tmanifest[collection.name] = []\n\t\t}\n\n\t\t// take the collection names after validation has settled\n\t\t// every generated file then works from the same list\n\t\tnames = Object.keys(collections)\n\n\t\tconst componentTypeDef = names.some(name => collections[name]?.items.some(isMdx))\n\t\t\t? getComponentTypeDef(buildContext.compileOptions)\n\t\t\t: null\n\n\t\t// queue the file writes first so the emit phase can run together\n\t\t// wait for them once every output is ready\n\t\tconst promises = []\n\n\t\t// build the type file from the schema rather than the observed data\n\t\t// that keeps optional fields and date output honest\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'types.ts'),\n\t\t\t\t` ${AUTOGEN_MSG}\n\n\t\t\t\t\timport type { Collection } from '${PKG_NAME}'\n\t\t\t\t\t${componentTypeDef ? `\\n\\t\\t\\t\\t\\t${componentTypeDef.import}` : ''}\n\n\t\t\t\t\t${componentTypeDef ? `\\n\\t\\t\\t\\t\\ttype Component = ${componentTypeDef.type}\\n` : ''}\n\t\t\t\t\n\t\t\t\t\t${names\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\texport type ${capitalise(singularise(name))} = ${schemaToType(collections[name].schema)} & {\n\t\t\t\t\t\t\t\t\thtml?: string,\n\t\t\t\t\t\t\t\t\tComponent?: ${componentTypeDef ? 'Component' : 'unknown'},\n\t\t\t\t\t\t\t\t} & Collection.Metadata\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n\\n')}`.trim(),\n\t\t\t),\n\t\t)\n\n\t\t// write the package surface separately so consumers get typed named exports\n\t\t// this mirrors the generated js entry file\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'index.d.ts'),\n\t\t\t\t`\t${AUTOGEN_MSG}\n\n\t\t\t\t\timport type { ${names.map(name => capitalise(singularise(name))).join(', ')} } from './types.js'\n\n\t\t\t\t\t${names\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\texport const all${capitalise(pluralise(name, 2))}: ${capitalise(singularise(name))}[]\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n\\n')}\n\n\t\t\t\t\tdeclare module '${PKG_NAME}' {\n\t\t\t\t\t\t${names\n\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\tname => `\n\t\t\t\t\t\t\t\t\texport const all${capitalise(pluralise(name, 2))}: ${capitalise(singularise(name))}[]\n\t\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.join('\\n\\n')}\n\t\t\t\t\t}\n\t\t\t\t`.trim(),\n\t\t\t),\n\t\t)\n\n\t\t// serialise each validated collection as a plain module for Vite to load\n\t\tfor (const name of names) {\n\t\t\tconst collection = collections[name]?.items ?? []\n\n\t\t\tconst fileName = toModuleName(name)\n\t\t\tconst filePath = `${fileName}.js`\n\n\t\t\tconst imports: string[] = []\n\t\t\tconst entries: string[] = []\n\n\t\t\tif (collection.some(isMdx)) {\n\t\t\t\tawait fs.mkdir(path.join(outDir, fileName), { recursive: true })\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < collection.length; i++) {\n\t\t\t\tconst item = collection[i]\n\n\t\t\t\tif (isMdx(item)) {\n\t\t\t\t\tconst slug = item.__mdsrc.slug\n\n\t\t\t\t\t// fileName (collection name) is used as dir name\n\t\t\t\t\tconst fullPath = path.join(outDir, fileName, `${slug}.js`)\n\n\t\t\t\t\tmanifest[name].push(fullPath)\n\t\t\t\t\tpromises.push(maybeWrite(fullPath, item.code))\n\n\t\t\t\t\tconst importName = `C${i}`\n\t\t\t\t\timports.push(`import ${importName} from './${fileName}/${slug}.js'`)\n\n\t\t\t\t\t// oxlint-disable-next-line no-unused-vars\n\t\t\t\t\tconst { code, ...rest } = item\n\t\t\t\t\tentries.push(`{ ...${JSON.stringify(rest)}, Component: ${importName} }`)\n\t\t\t\t} else {\n\t\t\t\t\tentries.push(JSON.stringify(item))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst fullPath = path.join(outDir, filePath)\n\n\t\t\t// add to manifest\n\t\t\tmanifest[name].push(fullPath)\n\n\t\t\tpromises.push(\n\t\t\t\tmaybeWrite(\n\t\t\t\t\tfullPath,\n\t\t\t\t\t`\t${AUTOGEN_MSG}\n\t\t\n\t\t\t\t\t\t${imports.join('\\n')}\n\n\t\t\t\t\t\texport const all${capitalise(pluralise(name, 2))} = [${entries.join(',\\n')}]`.trim(),\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\t// stitch the per-collection modules into the public js entrypoint\n\t\t// this is the file the root package import resolves to\n\t\tpromises.push(\n\t\t\tmaybeWrite(\n\t\t\t\tpath.join(outDir, 'index.js'),\n\t\t\t\t`${AUTOGEN_MSG}\n\t\t\t\t\n\t\t\t\t\t${names\n\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\tname =>\n\t\t\t\t\t\t\t\t`\n\t\t\t\t\t\t\t\texport * from './${toModuleName(name)}.js'\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.join('\\n')}`,\n\t\t\t),\n\t\t)\n\n\t\tpromises.push(\n\t\t\tmaybeWrite(path.join(outDir, 'manifest.json'), JSON.stringify(manifest, null, 2)),\n\t\t)\n\n\t\t// flush every generated artifact once all the content is ready\n\t\t// let any failed write fail the build\n\t\tconst writes = await Promise.all(promises)\n\t\tconst cleaned = await cleanup(outDir, manifest, prevManifest)\n\n\t\tbuildContext.names = names\n\n\t\treturn writes.some(c => c) || cleaned\n\t} catch (err) {\n\t\tlogger.error('[build]: failed to generate data', err)\n\t\tthrow err\n\t}\n}\n\n/**\n * Convert watcher paths to a consistent slash format before comparing them\n */\nfunction normaliseWatchPath(p: string) {\n\treturn p.replace(/\\\\/g, '/')\n}\n\n/**\n * Build the Vite plugin that validates collections and writes the generated modules\n * keep the runtime data and declaration files in the same pass\n * resolve package imports from the generated directory\n */\nexport default function mdsrc(config: PluginConfig): Plugin {\n\tconst src = config.collections\n\n\t// use one logger for the whole build so every step reports the same way\n\t// stay chatty outside production\n\tconst logger = new Logger(\n\t\tconfig.logger?.level ?? (process.env.NODE_ENV === 'production' ? 'error' : 'debug'),\n\t)\n\n\t// write generated files into a hidden folder at the project root\n\t// keep the generated surface out of src\n\tconst outDir = path.join(process.cwd(), GENERATED_DIR)\n\tconst watchRoot = normaliseWatchPath(realpathSync.native(process.cwd()))\n\tconst watchedRoots = src.map(c => `${normaliseWatchPath(path.join(watchRoot, c.dir))}/`)\n\n\t// watcher events can arrive through symlinked paths like /var while cwd has\n\t// already resolved to /private/var, so canonicalise the parent dir once and\n\t// reattach the file name for stable prefix checks\n\tconst resolveWatchFile = (filePath: string) => {\n\t\tconst absolutePath = path.resolve(watchRoot, filePath)\n\t\tconst parentPath = path.dirname(absolutePath)\n\n\t\ttry {\n\t\t\tconst resolvedParentPath = normaliseWatchPath(realpathSync.native(parentPath))\n\t\t\treturn normaliseWatchPath(\n\t\t\t\tpath.join(resolvedParentPath, path.basename(absolutePath)),\n\t\t\t)\n\t\t} catch {\n\t\t\treturn normaliseWatchPath(absolutePath)\n\t\t}\n\t}\n\n\tfunction watchedFile(filePath: string) {\n\t\treturn watchedRoots.some(root => resolveWatchFile(filePath).startsWith(root))\n\t}\n\n\t// pass shared build tools into helpers without dragging lots of state around\n\t// keep the helper signatures small\n\tconst buildContext = {\n\t\tlogger,\n\t\tcompileOptions: config.compileOptions,\n\t\toutDir,\n\t\tnames: [],\n\t} satisfies BuildContext\n\n\tlet rebuildRunning = false\n\tlet rebuildQueued = false\n\tlet rebuildReason = 'change'\n\n\tconst rebuild = debounce((event: string, filePath: string) => {\n\t\tfunction queue() {\n\t\t\tvoid (async () => {\n\t\t\t\t// collapse bursts of file events into one active rebuild plus a single\n\t\t\t\t// queued rerun when changes land mid-build\n\t\t\t\tif (rebuildRunning) {\n\t\t\t\t\trebuildQueued = true\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\trebuildRunning = true\n\n\t\t\t\tdo {\n\t\t\t\t\trebuildQueued = false\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst changed = await build(src, buildContext)\n\n\t\t\t\t\t\tif (changed) logger.info(`[watch]: content rebuilt (${rebuildReason})`)\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tlogger.error('[watch] content rebuild failed', err)\n\t\t\t\t\t}\n\t\t\t\t} while (rebuildQueued)\n\n\t\t\t\trebuildRunning = false\n\t\t\t})()\n\t\t}\n\n\t\t// ignore anything outside the watched content dirs\n\t\tif (!watchedFile(filePath)) return\n\n\t\tconst file = resolveWatchFile(filePath)\n\n\t\trebuildReason = `${event}: ${path.relative(watchRoot, file)}`\n\t\tqueue()\n\t}, 75)\n\n\treturn {\n\t\tname: 'mdsrc',\n\t\tenforce: 'pre',\n\t\tconfig(viteConfig) {\n\t\t\tviteConfig.optimizeDeps ??= {}\n\t\t\tviteConfig.optimizeDeps.exclude = [\n\t\t\t\t...new Set([...(viteConfig.optimizeDeps.exclude ?? []), PKG_NAME]),\n\t\t\t]\n\n\t\t\tviteConfig.resolve ??= {}\n\n\t\t\tif (Array.isArray(viteConfig.resolve.alias)) {\n\t\t\t\tviteConfig.resolve.alias = [\n\t\t\t\t\t...viteConfig.resolve.alias,\n\t\t\t\t\t{\n\t\t\t\t\t\tfind: PKG_NAME,\n\t\t\t\t\t\treplacement: path.join(outDir, 'index.js'),\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t} else {\n\t\t\t\tviteConfig.resolve.alias = {\n\t\t\t\t\t...viteConfig.resolve.alias,\n\t\t\t\t\t[PKG_NAME]: path.join(outDir, 'index.js'),\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tasync buildStart() {\n\t\t\tawait build(src, buildContext)\n\t\t},\n\t\tconfigureServer(server: ViteDevServer) {\n\t\t\tlogger.info(\n\t\t\t\t`[configureServer]: Watching for changes in ./${src.map(c => c.dir).join(', ')}...`,\n\t\t\t)\n\n\t\t\tserver.watcher\n\t\t\t\t.on('add', (p: string) => rebuild('add', p))\n\t\t\t\t.on('change', (p: string) => rebuild('change', p))\n\t\t\t\t.on('unlink', (p: string) => rebuild('unlink', p))\n\t\t},\n\t\tresolveId(id) {\n\t\t\t// point imports at generated files rather than source files\n\t\t\t// that makes the package behave like a normal module\n\t\t\tif (id === PKG_NAME) return path.join(outDir, 'index.js')\n\n\t\t\tif (id.startsWith(`${PKG_NAME}/`)) {\n\t\t\t\t// allow collection subpath imports once the build knows their names\n\t\t\t\t// leave unknown subpaths unresolved\n\t\t\t\tconst subpath = id.slice(PKG_NAME.length + 1)\n\t\t\t\tconst match = buildContext.names.find(\n\t\t\t\t\tname => name === subpath || toModuleName(name) === subpath,\n\t\t\t\t)\n\n\t\t\t\tif (match) return path.join(outDir, `${toModuleName(match)}.js`)\n\t\t\t}\n\n\t\t\treturn null\n\t\t},\n\t}\n}\n\nexport function toModuleName(name: string) {\n\treturn name.toLowerCase()\n}\n\nfunction getComponentTypeDef(compileOptions?: CompileOptions) {\n\tconst importSource = getJsxImportSource(compileOptions)\n\n\tswitch (importSource) {\n\t\tcase 'preact': {\n\t\t\treturn {\n\t\t\t\timport: `import type { ComponentType } from 'preact'`,\n\t\t\t\ttype: `ComponentType<{ components?: Record<string, ComponentType<any>> }>`,\n\t\t\t}\n\t\t}\n\t\tcase 'solid-js': {\n\t\t\treturn {\n\t\t\t\timport: `import type { Component } from 'solid-js'`,\n\t\t\t\ttype: `Component<{ components?: Record<string, Component<any>> }>`,\n\t\t\t}\n\t\t}\n\t\tcase 'react':\n\t\tdefault: {\n\t\t\treturn {\n\t\t\t\timport: `import type { ComponentType } from 'react'`,\n\t\t\t\ttype: `ComponentType<{ components?: Record<string, ComponentType<any>> }>`,\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @see https://satteri.bruits.org/docs/options/\n */\nfunction getJsxImportSource(compileOptions?: CompileOptions) {\n\tif (!compileOptions) return 'react'\n\n\tif (\n\t\t'jsxImportSource' in compileOptions &&\n\t\ttypeof compileOptions.jsxImportSource === 'string'\n\t) {\n\t\treturn compileOptions.jsxImportSource\n\t}\n\n\treturn 'react'\n}\n\nfunction isMdx(item: Raw): item is MdxRaw {\n\treturn item.__mdsrc.type === 'mdx'\n}\n",
6
+ "export const NAME = 'mdsrc'\nexport const PKG_NAME = `@jk2908/${NAME}`\nexport const GENERATED_DIR = `.${NAME}`\nexport const AUTOGEN_MSG = `// auto-generated by ${NAME}`\n",
7
7
  "import { NAME } from './config.js'\n\nconst LEVELS = {\n\tdebug: 0,\n\tinfo: 1,\n\twarn: 2,\n\terror: 3,\n\tfatal: 4,\n} as const\n\nexport type LogLevel = keyof typeof LEVELS\n\ntype LogEntry = {\n\tts: number\n\tlevel: LogLevel\n\tmessage: string\n\terror?:\n\t\t| Error\n\t\t| {\n\t\t\t\tmessage: string\n\t\t\t\tstack?: string\n\t\t\t\tcause?: unknown\n\t\t }\n}\n\n/**\n * Log messages with different severity levels\n */\nexport class Logger {\n\tstatic #defaultLevel: LogLevel = 'info'\n\n\t#level?: LogLevel\n\n\tconstructor(level?: LogLevel) {\n\t\tthis.#level = level\n\t}\n\n\tstatic set defaultLevel(level: LogLevel) {\n\t\tLogger.#defaultLevel = level\n\t}\n\n\tstatic get defaultLevel() {\n\t\treturn Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Convert a value to an Error instance\n\t */\n\tstatic toError(err: unknown) {\n\t\treturn err instanceof Error ? err : new Error(String(err), { cause: err })\n\t}\n\n\t/**\n\t * Stringify the error for logging\n\t */\n\tstatic print(err: unknown) {\n\t\tif (err instanceof Error) {\n\t\t\treturn err.message + (err.stack ? `\\n${err.stack}` : '')\n\t\t}\n\n\t\t// for plain objects, attempt to stringify with indentation\n\t\t// for readability\n\t\tif (typeof err === 'object' && err !== null) {\n\t\t\ttry {\n\t\t\t\treturn JSON.stringify(err, null, 2)\n\t\t\t} catch {\n\t\t\t\t// if stringify fails (e.g. circular reference), fall back\n\t\t\t\t// to basic string conversion\n\t\t\t\treturn String(err)\n\t\t\t}\n\t\t}\n\n\t\treturn String(err)\n\t}\n\n\tset level(level: LogLevel) {\n\t\tthis.#level = level\n\t}\n\n\tget level() {\n\t\treturn this.#level ?? Logger.#defaultLevel\n\t}\n\n\t/**\n\t * Log a message with a specific level\n\t */\n\tlog(level: LogLevel, message: string, error?: Error) {\n\t\tif (LEVELS[level] < LEVELS[this.level]) return\n\n\t\tconst entry: LogEntry = {\n\t\t\tts: Date.now(),\n\t\t\tlevel,\n\t\t\tmessage,\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tentry.error = error ? Logger.toError(error) : new Error(message)\n\t\t}\n\n\t\tconst line = `[${NAME}] [${entry.ts}] [${level.toUpperCase()}] ${message}`\n\t\tconst extra = entry.error ? `\\n${Logger.print(entry.error)}` : ''\n\n\t\tif (level === 'warn') {\n\t\t\tconsole.warn(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tif (level === 'error' || level === 'fatal') {\n\t\t\tconsole.error(line, extra)\n\t\t\treturn\n\t\t}\n\n\t\tconsole.log(line, extra)\n\t}\n\n\t/**\n\t * Log a debug message\n\t */\n\tdebug(...messages: string[]) {\n\t\tthis.log('debug', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an info message\n\t */\n\tinfo(...messages: string[]) {\n\t\tthis.log('info', messages.join(' '))\n\t}\n\n\t/**\n\t * Log a warning message\n\t */\n\twarn(...messages: string[]) {\n\t\tthis.log('warn', messages.join(' '))\n\t}\n\n\t/**\n\t * Log an error message\n\t */\n\terror(message: string, error?: unknown) {\n\t\tthis.log('error', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n\n\t/**\n\t * Log a fatal error message\n\t */\n\tfatal(message: string, error?: unknown) {\n\t\tthis.log('fatal', message, error === undefined ? undefined : Logger.toError(error))\n\t}\n}\n\nexport const logger = new Logger(\n\tprocess.env.NODE_ENV === 'production' ? 'error' : 'debug',\n)\n",
8
- "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pluralise(str: string, count: number) {\n\treturn count === 1 ? str : str.endsWith('s') ? str : `${str}s`\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n\nexport function dedent(str: string) {\n\treturn str\n\t\t.replace(/^\\n/, '')\n\t\t.replace(/\\s+$/, '')\n\t\t.split('\\n')\n\t\t.filter(Boolean)\n\t\t.map(line => line.replace(/^\\s+/, ''))\n\t\t.join('\\n')\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function deep(obj: any, path: string, value: unknown) {\n\tconst parts = path.split('.')\n\tlet cur = obj\n\n\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\tconst k = parts[i]\n\t\tcur[k] ??= {}\n\t\tcur = cur[k]\n\t}\n\n\tcur[parts.at(-1)!] = value\n}\n",
9
- "import type { CompileOptions as SatteriCompileOptions } from 'satteri'\n\nimport type { LogLevel, Logger } from './logger.js'\n\nexport type CompileOptions = SatteriCompileOptions\n\nexport type PluginConfig = {\n\tcollections: Collection[]\n\tlogger?: {\n\t\tlevel?: LogLevel\n\t}\n\tcompileOptions?: CompileOptions\n}\n\nexport type BuildContext = {\n\tlogger: InstanceType<typeof Logger>\n\tcompileOptions?: CompileOptions\n\toutDir?: string\n\tnames?: string[]\n}\n\nexport const PRIMITIVE_NAMES = ['string', 'number', 'boolean', 'date', 'array'] as const\n\nexport const MODIFIER_NAMES = ['max', 'min'] as const\n\nexport namespace Schema {\n\texport type Primitive = 'string' | 'number' | 'boolean' | 'date' | 'array'\n\n\texport type ModifierName = (typeof MODIFIER_NAMES)[number]\n\n\texport type Modifier = `${ModifierName}=${string}`\n\n\texport type Key = string\n\n\texport type Value = Primitive | `${Primitive}|${string}` | { [key: Key]: Value }\n}\n\nexport interface Schema {\n\t[key: Schema.Key]: Schema.Value\n}\n\nexport type Collection = {\n\tname: string\n\tdir: string\n\tschema: Schema\n}\n\nexport type Entries = Record<string, unknown>\n\nexport type Raw = {\n\t__mdsrc: {\n\t\tslug: string\n\t\tfilename: string\n\t}\n\tbody: string\n} & Entries\n\nexport type Types = Record<string, string>\n\nexport type IssueCode =\n\t| 'MISSING_REQUIRED'\n\t| 'UNKNOWN_KEY'\n\t| 'INVALID_TYPE'\n\t| 'INVALID_DATE'\n\t| 'INVALID_INPUT'\n\t| 'INVALID_LENGTH'\n\t| 'INVALID_SIZE'\n\t| 'BAD_MODIFIER'\n\nexport type Issue = {\n\treadonly code: IssueCode\n\treadonly message: string\n}\n\nexport type Fail = {\n\treadonly issues: Issue[]\n}\n\nexport type Success<Output> = {\n\treadonly value: Output\n\treadonly issues?: Issue[]\n\treadonly types?: Record<string, string>\n}\n\nexport type Result<Output> = Success<Output> | Fail\n",
8
+ "export function capitalise(str: string) {\n\treturn str.charAt(0).toUpperCase() + str.slice(1)\n}\n\nexport function pluralise(str: string, count: number) {\n\treturn count === 1 ? str : str.endsWith('s') ? str : `${str}s`\n}\n\nexport function singularise(str: string, suffix = 's') {\n\treturn str.endsWith(suffix) ? str.slice(0, -suffix.length) : str\n}\n\nexport function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number) {\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null\n\n\treturn (...args: T) => {\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId)\n\t\t}\n\n\t\ttimeoutId = setTimeout(() => {\n\t\t\tfn.apply(null, args)\n\t\t}, wait)\n\t}\n}\n\nexport function dedent(str: string) {\n\treturn str\n\t\t.replace(/^\\n/, '')\n\t\t.replace(/\\s+$/, '')\n\t\t.split('\\n')\n\t\t.filter(Boolean)\n\t\t.map(line => line.replace(/^\\s+/, ''))\n\t\t.join('\\n')\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function deep(obj: any, path: string, value: unknown) {\n\tconst parts = path.split('.')\n\tlet cur = obj\n\n\tfor (let i = 0; i < parts.length - 1; i++) {\n\t\tconst k = parts[i]\n\t\tcur[k] ??= {}\n\t\tcur = cur[k]\n\t}\n\n\tcur[parts.at(-1)!] = value\n}\n\nexport function slugify(str: string) {\n\treturn str.toLowerCase().replace(/\\s/g, '-')\n}\n",
9
+ "import type {\n\tCompileOptions as SatteriCompileOptions,\n\tMdxCompileOptions as SatteriMdxCompileOptions,\n} from 'satteri'\n\nimport type { LogLevel, Logger } from './logger.js'\n\nexport type CompileOptions = SatteriCompileOptions | SatteriMdxCompileOptions\n\nexport type PluginConfig = {\n\tcollections: Collection.Entry[]\n\tlogger?: {\n\t\tlevel?: LogLevel\n\t}\n\tcompileOptions?: CompileOptions\n}\n\nexport type BuildContext = {\n\tlogger: InstanceType<typeof Logger>\n\tcompileOptions?: CompileOptions\n\toutDir?: string\n\tnames?: string[]\n}\n\nexport type Manifest = Record<string, string[]>\n\nexport const PRIMITIVE_NAMES = ['string', 'number', 'boolean', 'date', 'array'] as const\n\nexport const MODIFIER_NAMES = ['max', 'min'] as const\n\nexport namespace Schema {\n\texport type Primitive = 'string' | 'number' | 'boolean' | 'date' | 'array'\n\n\texport type ModifierName = (typeof MODIFIER_NAMES)[number]\n\n\texport type Modifier = `${ModifierName}=${string}`\n\n\texport type Key = string\n\n\texport type Value = Primitive | `${Primitive}|${string}` | { [key: Key]: Value }\n}\n\nexport interface Schema {\n\t[key: Schema.Key]: Schema.Value\n}\n\nexport namespace Collection {\n\texport type Entry = {\n\t\tname: string\n\t\tdir: string\n\t\tschema: Schema\n\t}\n\n\texport type Metadata = {\n\t\t__mdsrc: {\n\t\t\tslug: string\n\t\t\tfilename: string\n\t\t\ttype: AcceptedExtension\n\t\t}\n\t}\n}\n\nexport type Entries = Record<string, unknown>\n\nexport type AcceptedExtension = 'md' | 'mdx'\n\nexport type MdRaw = {\n\t__mdsrc: {\n\t\tslug: string\n\t\tfilename: string\n\t\ttype: Extract<AcceptedExtension, 'md'>\n\t}\n\thtml: string\n}\n\nexport type MdxRaw = {\n\t__mdsrc: {\n\t\tslug: string\n\t\tfilename: string\n\t\ttype: Extract<AcceptedExtension, 'mdx'>\n\t}\n\tcode: string\n}\n\nexport type Raw = MdRaw | MdxRaw\n\nexport type Types = Record<string, string>\n\nexport type IssueCode =\n\t| 'MISSING_REQUIRED'\n\t| 'UNKNOWN_KEY'\n\t| 'INVALID_TYPE'\n\t| 'INVALID_DATE'\n\t| 'INVALID_INPUT'\n\t| 'INVALID_LENGTH'\n\t| 'INVALID_SIZE'\n\t| 'BAD_MODIFIER'\n\nexport type Issue = {\n\treadonly code: IssueCode\n\treadonly message: string\n}\n\nexport type Fail = {\n\treadonly issues: Issue[]\n}\n\nexport type Success<Output> = {\n\treadonly value: Output\n\treadonly issues?: Issue[]\n\treadonly types?: Record<string, string>\n}\n\nexport type Result<Output> = Success<Output> | Fail\n",
10
10
  "import {\n\tMODIFIER_NAMES,\n\tPRIMITIVE_NAMES,\n\ttype Entries,\n\ttype Issue,\n\ttype Result,\n\ttype Schema,\n} from './types.js'\nimport { deep, isRecord } from './utils.js'\n\n/**\n * Check one entry against the declared schema and coerce what can be coerced\n * leave missing optional keys alone instead of treating them as errors\n * normalise dates to ISO strings for output\n */\nexport function validate(input: Entries, schema: Schema) {\n\t// keep valid values separate so bad fields never sneak into output\n\tconst validated: Entries = {}\n\t// collect every problem so one pass can report the lot\n\tconst issues: Issue[] = []\n\n\t// bail out early if the frontmatter is not even an object\n\tif (typeof input !== 'object' || input === null) {\n\t\tissues.push({ message: 'Input must be an object', code: 'INVALID_INPUT' })\n\t\treturn { issues } satisfies Result<Entries>\n\t}\n\n\tconst schemaKeys = new Set(Object.keys(schema).map(k => parseKey(k).key))\n\n\t// bail out early on unknown keys\n\tfor (const key in input) {\n\t\tif (!schemaKeys.has(key)) {\n\t\t\tissues.push({ message: `Unknown key: ${key}`, code: 'UNKNOWN_KEY' })\n\t\t}\n\t}\n\n\t// bail\n\tif (issues.length) return { issues } satisfies Result<Entries>\n\n\tfunction walk(key: string, schemaValue: Schema.Value, data: unknown) {\n\t\tconst { optional, key: parsedKey } = parseKey(key)\n\n\t\tif (data === undefined) {\n\t\t\tif (!optional) {\n\t\t\t\tissues.push({\n\t\t\t\t\tmessage: `Missing required key: ${parsedKey}`,\n\t\t\t\t\tcode: 'MISSING_REQUIRED',\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn\n\t\t}\n\n\t\t// check primitives\n\t\tif (typeof schemaValue === 'string') {\n\t\t\tconst { types, modifiers } = parseSchemaValue(schemaValue)\n\n\t\t\tfor (const type of types) {\n\t\t\t\tif (type === 'string') {\n\t\t\t\t\tif (typeof data !== 'string') {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be a string`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.min) {\n\t\t\t\t\t\tconst min = Number(modifiers.min)\n\n\t\t\t\t\t\tif (Number.isNaN(min)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.min}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (data.length < min) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be greater than or equal to minimum length (${min})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_LENGTH',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.max) {\n\t\t\t\t\t\tconst max = Number(modifiers.max)\n\n\t\t\t\t\t\tif (Number.isNaN(max)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.max}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (data.length > max) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be less than or equal to maximum length (${max})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_LENGTH',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tdeep(validated, parsedKey, data)\n\t\t\t\t\treturn\n\t\t\t\t} else if (type === 'number') {\n\t\t\t\t\tlet num = data\n\n\t\t\t\t\tif (typeof data === 'string' && !Number.isNaN(Number(data))) {\n\t\t\t\t\t\tnum = Number(data)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof num !== 'number' || Number.isNaN(num)) {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be a number`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.min) {\n\t\t\t\t\t\tconst min = Number(modifiers.min)\n\n\t\t\t\t\t\tif (Number.isNaN(min)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.min}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (num < min) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be greater than or equal to minimum size (${min})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_SIZE',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.max) {\n\t\t\t\t\t\tconst max = Number(modifiers.max)\n\n\t\t\t\t\t\tif (Number.isNaN(max)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.max}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (num > max) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be less than or equal to maximum size (${max})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_SIZE',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tdeep(validated, parsedKey, num)\n\t\t\t\t\treturn\n\t\t\t\t} else if (type === 'boolean') {\n\t\t\t\t\tlet bool = data\n\n\t\t\t\t\tif (typeof data === 'string') {\n\t\t\t\t\t\tif (data.toLowerCase() === 'true') {\n\t\t\t\t\t\t\tbool = true\n\t\t\t\t\t\t} else if (data.toLowerCase() === 'false') {\n\t\t\t\t\t\t\tbool = false\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof bool !== 'boolean') {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be a boolean`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tdeep(validated, parsedKey, bool)\n\t\t\t\t\treturn\n\t\t\t\t} else if (type === 'date') {\n\t\t\t\t\tlet date: Date\n\n\t\t\t\t\tif (data instanceof Date) {\n\t\t\t\t\t\tdate = data\n\t\t\t\t\t} else if (typeof data === 'string' || typeof data === 'number') {\n\t\t\t\t\t\tdate = new Date(data)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be a Date, string or number`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst dt = date.getTime()\n\n\t\t\t\t\tif (Number.isNaN(dt)) {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be a valid date`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_DATE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.min) {\n\t\t\t\t\t\tconst min = new Date(Number(modifiers.min))\n\n\t\t\t\t\t\tif (Number.isNaN(min.getTime())) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.min}) that could not be converted to instance (Date)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (dt < min.getTime()) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be greater than or equal to minimum date (${min.toISOString()})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_DATE',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.max) {\n\t\t\t\t\t\tconst max = new Date(Number(modifiers.max))\n\n\t\t\t\t\t\tif (Number.isNaN(max.getTime())) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.max}) that could not be converted to instance (Date)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (dt > max.getTime()) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be less than or equal to maximum date (${max.toISOString()})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_DATE',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tdeep(validated, parsedKey, date.toISOString())\n\t\t\t\t\treturn\n\t\t\t\t} else if (type === 'array') {\n\t\t\t\t\tif (!Array.isArray(data)) {\n\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be an array`,\n\t\t\t\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.min) {\n\t\t\t\t\t\tconst min = Number(modifiers.min)\n\n\t\t\t\t\t\tif (Number.isNaN(min)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.min}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (data.length < min) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be greater than or equal to minimum array length (${min})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_LENGTH',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (modifiers.max) {\n\t\t\t\t\t\tconst max = Number(modifiers.max)\n\n\t\t\t\t\t\tif (Number.isNaN(max)) {\n\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} contains a bad modifier (${modifiers.max}) that could not be converted to type (number)`,\n\t\t\t\t\t\t\t\tcode: 'BAD_MODIFIER',\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (data.length > max) {\n\t\t\t\t\t\t\tif (types.length === 1) {\n\t\t\t\t\t\t\t\tissues.push({\n\t\t\t\t\t\t\t\t\tmessage: `Key ${parsedKey} must be less than or equal to maximum array length (${max})`,\n\t\t\t\t\t\t\t\t\tcode: 'INVALID_LENGTH',\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tdeep(validated, parsedKey, data)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// no type matched\n\t\t\tissues.push({\n\t\t\t\tmessage: `Key ${parsedKey} must be one of: ${types.join(', ')}`,\n\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t})\n\t\t} else {\n\t\t\tif (!isRecord(data)) {\n\t\t\t\tissues.push({\n\t\t\t\t\tmessage: `Key ${parsedKey} must be an object`,\n\t\t\t\t\tcode: 'INVALID_TYPE',\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst obj = data\n\n\t\t\tfor (const subKey in schemaValue) {\n\t\t\t\twalk(`${parsedKey}.${subKey}`, schemaValue[subKey], obj[parseKey(subKey).key])\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (const key in schema) {\n\t\twalk(key, schema[key], input[parseKey(key).key])\n\t}\n\n\t// return the clean entry when validation passes, otherwise return the full\n\t// issue list\n\treturn (issues.length ? { issues } : { value: validated }) satisfies Result<Entries>\n}\n\nexport function parseKey(k: string) {\n\tconst optional = k.endsWith('?')\n\n\treturn {\n\t\toptional,\n\t\tkey: optional ? k.slice(0, -1) : k,\n\t}\n}\n\nfunction parseSchemaValue(value: Schema.Value) {\n\tif (isRecord(value)) throw new Error('Cannot parse object schema values')\n\n\tconst parts = value.split('|')\n\tconst types: string[] = []\n\tconst modifiers: Partial<Record<Schema.ModifierName, string>> = {}\n\n\tfor (const p of parts) {\n\t\tif (p.indexOf('=') > -1) {\n\t\t\tconst [m, v] = p.split('=')\n\n\t\t\tif (!isModifierName(m)) throw new Error(`Unrecognised modifier: ${m}`)\n\n\t\t\tmodifiers[m] = v\n\t\t} else {\n\t\t\tif (!isPrimitive(p)) throw new Error(`Unrecognised type: ${p}`)\n\t\t\ttypes.push(p)\n\t\t}\n\t}\n\n\treturn { types, modifiers }\n}\n\nfunction isModifierName(name: string): name is Schema.ModifierName {\n\treturn MODIFIER_NAMES.some(n => n === name)\n}\n\nfunction isPrimitive(name: string): name is Schema.Primitive {\n\treturn PRIMITIVE_NAMES.some(n => n === name)\n}\n"
11
11
  ],
12
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAIA;;;ACNO,IAAM,OAAO;AACb,IAAM,WAAW,WAAW;AAC5B,IAAM,gBAAgB,IAAI;;;ACAjC,IAAM,SAAS;AAAA,EACd,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AACR;AAAA;AAoBO,MAAM,OAAO;AAAA,SACZ,gBAA0B;AAAA,EAEjC;AAAA,EAEA,WAAW,CAAC,OAAkB;AAAA,IAC7B,KAAK,SAAS;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mB,CAAC,gBAAiC;AAAA,EAC7D,MAAM,eAAe,mBAAmB,cAAc;AAAA,EAEtD,QAAQ;AAAA,SACF,UAAU;AAAA,MACd,OAAO;AAAA,QACN,QAAQ;AAAA,QACR,MAAM;AAAA,MACP;AAAA,IACD;AAAA,SACK,YAAY;AAAA,MAChB,OAAO;AAAA,QACN,QAAQ;AAAA,QACR,MAAM;AAAA,MACP;AAAA,IACD;AAAA,SACK;AAAA,aACI;AAAA,MACR,OAAO;AAAA,QACN,QAAQ;AAAA,QACR,MAAM;AAAA,MACP;AAAA,IACD;AAAA;AAAA;AAOF,SAAS,kBAAkB,CAAC,gBAAiC;AAAA,EAC5D,IAAI,CAAC;AAAA,IAAgB,OAAO;AAAA,EAE5B,IACC,qBAAqB,kBACrB,OAAO,eAAe,oBAAoB,UACzC;AAAA,IACD,OAAO,eAAe;AAAA,EACvB;AAAA,EAEA,OAAO;AAAA;AAGR,SAAS,KAAK,CAAC,MAA2B;AAAA,EACzC,OAAO,KAAK,QAAQ,SAAS;AAAA;",
13
+ "debugId": "7E42618D1E5115AF64756E2164756E21",
14
14
  "names": []
15
15
  }
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { CompileOptions as SatteriCompileOptions } from 'satteri';
1
+ import type { CompileOptions as SatteriCompileOptions, MdxCompileOptions as SatteriMdxCompileOptions } from 'satteri';
2
2
  import type { LogLevel, Logger } from './logger.js';
3
- export type CompileOptions = SatteriCompileOptions;
3
+ export type CompileOptions = SatteriCompileOptions | SatteriMdxCompileOptions;
4
4
  export type PluginConfig = {
5
- collections: Collection[];
5
+ collections: Collection.Entry[];
6
6
  logger?: {
7
7
  level?: LogLevel;
8
8
  };
@@ -14,6 +14,7 @@ export type BuildContext = {
14
14
  outDir?: string;
15
15
  names?: string[];
16
16
  };
17
+ export type Manifest = Record<string, string[]>;
17
18
  export declare const PRIMITIVE_NAMES: readonly ['string', 'number', 'boolean', 'date', 'array'];
18
19
  export declare const MODIFIER_NAMES: readonly ['max', 'min'];
19
20
  export declare namespace Schema {
@@ -28,19 +29,39 @@ export declare namespace Schema {
28
29
  export interface Schema {
29
30
  [key: Schema.Key]: Schema.Value;
30
31
  }
31
- export type Collection = {
32
- name: string;
33
- dir: string;
34
- schema: Schema;
35
- };
32
+ export declare namespace Collection {
33
+ type Entry = {
34
+ name: string;
35
+ dir: string;
36
+ schema: Schema;
37
+ };
38
+ type Metadata = {
39
+ __mdsrc: {
40
+ slug: string;
41
+ filename: string;
42
+ type: AcceptedExtension;
43
+ };
44
+ };
45
+ }
36
46
  export type Entries = Record<string, unknown>;
37
- export type Raw = {
47
+ export type AcceptedExtension = 'md' | 'mdx';
48
+ export type MdRaw = {
49
+ __mdsrc: {
50
+ slug: string;
51
+ filename: string;
52
+ type: Extract<AcceptedExtension, 'md'>;
53
+ };
54
+ html: string;
55
+ };
56
+ export type MdxRaw = {
38
57
  __mdsrc: {
39
58
  slug: string;
40
59
  filename: string;
60
+ type: Extract<AcceptedExtension, 'mdx'>;
41
61
  };
42
- body: string;
43
- } & Entries;
62
+ code: string;
63
+ };
64
+ export type Raw = MdRaw | MdxRaw;
44
65
  export type Types = Record<string, string>;
45
66
  export type IssueCode = 'MISSING_REQUIRED' | 'UNKNOWN_KEY' | 'INVALID_TYPE' | 'INVALID_DATE' | 'INVALID_INPUT' | 'INVALID_LENGTH' | 'INVALID_SIZE' | 'BAD_MODIFIER';
46
67
  export type Issue = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAA;AAElD,MAAM,MAAM,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,MAAM,CAAC,E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,EAAE,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,OAAO,CAAC,MAAM,IAAI;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvC,CAAA;AAED,MAAM,MAAM,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AAExF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AAExF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAA"}
package/dist/utils.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export declare function capitalise(str: string): string;
2
2
  export declare function pluralise(str: string, count: number): string;
3
+ export declare function singularise(str: string, suffix?: string): string;
3
4
  export declare function debounce<T extends unknown[]>(fn: (...args: T) => void, wait: number): (...args: T) => void;
4
5
  export declare function dedent(str: string): string;
5
6
  export declare function isRecord(value: unknown): value is Record<string, unknown>;
6
7
  export declare function deep(obj: any, path: string, value: unknown): void;
8
+ export declare function slugify(str: string): string;
7
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,UAErC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAEnD;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,aAGlE,CAAC,UASlB;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,UAQjC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,QAW1D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,UAErC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAEnD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAM,UAEpD;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,aAGlE,CAAC,UASlB;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,UAQjC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,QAW1D;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,UAElC"}
package/dist/utils.js CHANGED
@@ -4,6 +4,9 @@ export function capitalise(str) {
4
4
  export function pluralise(str, count) {
5
5
  return count === 1 ? str : str.endsWith('s') ? str : `${str}s`;
6
6
  }
7
+ export function singularise(str, suffix = 's') {
8
+ return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;
9
+ }
7
10
  export function debounce(fn, wait) {
8
11
  let timeoutId = null;
9
12
  return (...args) => {
@@ -37,4 +40,7 @@ export function deep(obj, path, value) {
37
40
  }
38
41
  cur[parts.at(-1)] = value;
39
42
  }
43
+ export function slugify(str) {
44
+ return str.toLowerCase().replace(/\s/g, '-');
45
+ }
40
46
  //# sourceMappingURL=utils.js.map
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAa;IACnD,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAA;AAC/D,CAAC;AAED,MAAM,UAAU,QAAQ,CAAsB,EAAwB,EAAE,IAAY;IACnF,IAAI,SAAS,GAAyC,IAAI,CAAA;IAE1D,OAAO,CAAC,GAAG,IAAO,EAAE,EAAE;QACrB,IAAI,SAAS,EAAE,CAAC;YACf,YAAY,CAAC,SAAS,CAAC,CAAA;QACxB,CAAC;QAED,SAAS,GAAG,UAAU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AC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACrC,IAAI,CAAC,IAAI,CAAC,CAAA;AACb,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC5E,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAQ,EAAE,IAAY,EAAE,KAAc;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,GAAG,GAAG,GAAG,CAAA;IAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA;QACb,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACb,CAAC;IAED,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,GAAG,KAAK,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,GAAW;IAClC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAC7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jk2908/mdsrc",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "author": "Jerome Kenway",
6
6
  "description": "A Vite plugin for turning structured Markdown content into importable, type-safe modules",