fuma-content 1.1.3 → 1.1.4

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 (104) hide show
  1. package/dist/{async-cache-CBEZB25o.d.ts → async-cache-BVuJiIDT.d.ts} +1 -1
  2. package/dist/{async-cache-CBEZB25o.d.ts.map → async-cache-BVuJiIDT.d.ts.map} +1 -1
  3. package/dist/{build-mdx-DkAvzRNg.d.ts → build-mdx-DRqbcE1d.d.ts} +10 -4
  4. package/dist/build-mdx-DRqbcE1d.d.ts.map +1 -0
  5. package/dist/{build-mdx-oug7zk0w.js → build-mdx-DgzggXIL.js} +6 -6
  6. package/dist/build-mdx-DgzggXIL.js.map +1 -0
  7. package/dist/bun/index.d.ts +1 -1
  8. package/dist/bun/index.js +1 -1
  9. package/dist/{bun-cxKGeSx6.js → bun-Be5pgXW_.js} +4 -3
  10. package/dist/bun-Be5pgXW_.js.map +1 -0
  11. package/dist/{code-generator-C_Gu9y3h.js → code-generator-CHcOrCeM.js} +2 -4
  12. package/dist/code-generator-CHcOrCeM.js.map +1 -0
  13. package/dist/collections/data/runtime.d.ts +2 -2
  14. package/dist/collections/data.d.ts +2 -2
  15. package/dist/collections/data.js +3 -3
  16. package/dist/collections/fs.d.ts +1 -1
  17. package/dist/collections/index.d.ts +1 -1
  18. package/dist/collections/json/loader-webpack.d.ts +2 -2
  19. package/dist/collections/json/loader-webpack.js +2 -2
  20. package/dist/collections/mdx/loader-webpack.d.ts +2 -2
  21. package/dist/collections/mdx/loader-webpack.js +2 -2
  22. package/dist/collections/mdx/react.d.ts +2 -3
  23. package/dist/collections/mdx/react.d.ts.map +1 -1
  24. package/dist/collections/mdx/react.js +2 -1
  25. package/dist/collections/mdx/react.js.map +1 -1
  26. package/dist/collections/mdx/runtime-browser.d.ts +3 -4
  27. package/dist/collections/mdx/runtime-browser.d.ts.map +1 -1
  28. package/dist/collections/mdx/runtime-dynamic.d.ts +2 -3
  29. package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
  30. package/dist/collections/mdx/runtime-dynamic.js +9 -4
  31. package/dist/collections/mdx/runtime-dynamic.js.map +1 -1
  32. package/dist/collections/mdx/runtime.d.ts +2 -3
  33. package/dist/collections/mdx/runtime.d.ts.map +1 -1
  34. package/dist/collections/mdx.d.ts +2 -3
  35. package/dist/collections/mdx.d.ts.map +1 -1
  36. package/dist/collections/mdx.js +24 -26
  37. package/dist/collections/mdx.js.map +1 -1
  38. package/dist/collections/obsidian.d.ts +10 -0
  39. package/dist/collections/obsidian.d.ts.map +1 -0
  40. package/dist/collections/obsidian.js +497 -0
  41. package/dist/collections/obsidian.js.map +1 -0
  42. package/dist/collections/runtime/file-store.d.ts +1 -1
  43. package/dist/collections/runtime/store.d.ts +1 -1
  44. package/dist/collections/yaml/loader-webpack.d.ts +2 -2
  45. package/dist/collections/yaml/loader-webpack.js +2 -2
  46. package/dist/config/index.d.ts +1 -2
  47. package/dist/config/index.d.ts.map +1 -1
  48. package/dist/config/index.js.map +1 -1
  49. package/dist/{core-DmbQk8Z2.js → core-BuUsOElL.js} +2 -2
  50. package/dist/{core-DmbQk8Z2.js.map → core-BuUsOElL.js.map} +1 -1
  51. package/dist/{core-CG2zTL4c.d.ts → core-FjA_Xoho.d.ts} +1 -2
  52. package/dist/core-FjA_Xoho.d.ts.map +1 -0
  53. package/dist/dynamic.d.ts +2 -2
  54. package/dist/dynamic.js +1 -1
  55. package/dist/{fuma-matter-Pwr2S9Ab.js → fuma-matter-B4gT09gM.js} +1 -1
  56. package/dist/{fuma-matter-Pwr2S9Ab.js.map → fuma-matter-B4gT09gM.js.map} +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/is-promise-like-DYHv0Yap.js +8 -0
  60. package/dist/is-promise-like-DYHv0Yap.js.map +1 -0
  61. package/dist/{load-from-file-BeLFB77e.js → load-from-file-BhdBOcQT.js} +1 -1
  62. package/dist/{load-from-file-BeLFB77e.js.map → load-from-file-BhdBOcQT.js.map} +1 -1
  63. package/dist/{load-from-file-CpA8UQXX.d.ts → load-from-file-CIYdu-B5.d.ts} +1 -1
  64. package/dist/load-from-file-CIYdu-B5.d.ts.map +1 -0
  65. package/dist/{loader-DTODFdmk.js → loader-BOYLUNfh.js} +2 -2
  66. package/dist/{loader-DTODFdmk.js.map → loader-BOYLUNfh.js.map} +1 -1
  67. package/dist/{loader-DOjRBsog.js → loader-BT4fwLTJ.js} +9 -5
  68. package/dist/loader-BT4fwLTJ.js.map +1 -0
  69. package/dist/{loader-DKTW82eK.js → loader-Cb9kSSxT.js} +2 -2
  70. package/dist/{loader-DKTW82eK.js.map → loader-Cb9kSSxT.js.map} +1 -1
  71. package/dist/{loader-gwXIGo5Q.js → loader-UhlX4xbz.js} +1 -1
  72. package/dist/{loader-gwXIGo5Q.js.map → loader-UhlX4xbz.js.map} +1 -1
  73. package/dist/next/index.d.ts +1 -1
  74. package/dist/next/index.js +2 -2
  75. package/dist/node/index.d.ts +1 -1
  76. package/dist/node/loader.d.ts +1 -1
  77. package/dist/node/loader.js +1 -1
  78. package/dist/{node-l03HaPSS.js → node-Cu5Pqxxo.js} +2 -2
  79. package/dist/node-Cu5Pqxxo.js.map +1 -0
  80. package/dist/plugins/git.d.ts +1 -1
  81. package/dist/plugins/json-schema.d.ts +1 -1
  82. package/dist/plugins/loader/index.d.ts +4 -7
  83. package/dist/plugins/loader/index.d.ts.map +1 -1
  84. package/dist/plugins/loader/index.js +5 -4
  85. package/dist/plugins/loader/index.js.map +1 -1
  86. package/dist/plugins/loader/webpack.d.ts +2 -2
  87. package/dist/plugins/loader/webpack.js +4 -2
  88. package/dist/plugins/loader/webpack.js.map +1 -1
  89. package/dist/vite/index.d.ts +1 -1
  90. package/dist/vite/index.d.ts.map +1 -1
  91. package/dist/vite/index.js +3 -14
  92. package/dist/vite/index.js.map +1 -1
  93. package/dist/{vite-mAc2TZyp.js → vite-CoJIMNWk.js} +3 -3
  94. package/dist/vite-CoJIMNWk.js.map +1 -0
  95. package/package.json +14 -7
  96. package/dist/build-mdx-DkAvzRNg.d.ts.map +0 -1
  97. package/dist/build-mdx-oug7zk0w.js.map +0 -1
  98. package/dist/bun-cxKGeSx6.js.map +0 -1
  99. package/dist/code-generator-C_Gu9y3h.js.map +0 -1
  100. package/dist/core-CG2zTL4c.d.ts.map +0 -1
  101. package/dist/load-from-file-CpA8UQXX.d.ts.map +0 -1
  102. package/dist/loader-DOjRBsog.js.map +0 -1
  103. package/dist/node-l03HaPSS.js.map +0 -1
  104. package/dist/vite-mAc2TZyp.js.map +0 -1
@@ -6,4 +6,4 @@ interface AsyncCache<V> {
6
6
  }
7
7
  //#endregion
8
8
  export { AsyncCache as t };
9
- //# sourceMappingURL=async-cache-CBEZB25o.d.ts.map
9
+ //# sourceMappingURL=async-cache-BVuJiIDT.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"async-cache-CBEZB25o.d.ts","names":[],"sources":["../src/utils/async-cache.ts"],"mappings":";UAAiB,UAAA;EACf,MAAA,GAAS,GAAA,UAAa,EAAA,QAAU,CAAA,GAAI,OAAA,CAAQ,CAAA,MAAO,CAAA,GAAI,OAAA,CAAQ,CAAA;EAC/D,MAAA,WAAiB,UAAA,CAAW,CAAA;EAC5B,UAAA,GAAa,GAAA;AAAA"}
1
+ {"version":3,"file":"async-cache-BVuJiIDT.d.ts","names":[],"sources":["../src/utils/async-cache.ts"],"mappings":";UAAiB,UAAA;EACf,MAAA,GAAS,GAAA,UAAa,EAAA,QAAU,CAAA,GAAI,OAAA,CAAQ,CAAA,MAAO,CAAA,GAAI,OAAA,CAAQ,CAAA;EAC/D,MAAA,WAAiB,UAAA,CAAW,CAAA;EAC5B,UAAA,GAAa,GAAA;AAAA"}
@@ -1,4 +1,5 @@
1
- import { CompilerOptions } from "./plugins/loader/index.js";
1
+ import { t as Core } from "./core-FjA_Xoho.js";
2
+ import { MDXCollection } from "./collections/mdx.js";
2
3
  import { createProcessor } from "@mdx-js/mdx";
3
4
  import { VFile } from "vfile";
4
5
  import { MDXContent } from "mdx/types";
@@ -40,6 +41,11 @@ interface PostprocessOptions {
40
41
  //#endregion
41
42
  //#region src/collections/mdx/build-mdx.d.ts
42
43
  type MDXProcessor = ReturnType<typeof createProcessor>;
44
+ interface MDXCompilerContext {
45
+ addDependency: (file: string) => void;
46
+ collection: MDXCollection | undefined;
47
+ core: Core;
48
+ }
43
49
  interface FumaContentDataMap {
44
50
  /**
45
51
  * [Fuma Content] raw frontmatter, you can modify it
@@ -53,9 +59,9 @@ interface FumaContentDataMap {
53
59
  value: unknown;
54
60
  }[];
55
61
  /**
56
- * [Fuma Content] The compiler object from loader
62
+ * [Fuma Content] The internal compiler info
57
63
  */
58
- _compiler?: CompilerOptions;
64
+ _compiler?: MDXCompilerContext;
59
65
  /**
60
66
  * [Fuma Content] get internal processor, do not use this on user land.
61
67
  */
@@ -70,4 +76,4 @@ interface CompiledMDX<Frontmatter = Record<string, unknown>> extends Record<stri
70
76
  }
71
77
  //#endregion
72
78
  export { LinkReference as n, PostprocessOptions as r, CompiledMDX as t };
73
- //# sourceMappingURL=build-mdx-DkAvzRNg.d.ts.map
79
+ //# sourceMappingURL=build-mdx-DRqbcE1d.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-mdx-DRqbcE1d.d.ts","names":[],"sources":["../src/collections/mdx/remark-postprocess.ts","../src/collections/mdx/build-mdx.ts"],"mappings":";;;;;;;UASiB,aAAA;EACf,IAAA;AAAA;AAAA,UAGe,kBAAA;EACf,OAAA;EALe;;;EAUf,aAAA;EATI;AAGN;;EAWE,iBAAA;IAGM,EAAA;IAbN;;;IAiBM,UAAA;EAAA;EAMN;;;EAAA,cAAA;IAGM,EAAA;EAAA;EAUc;;;EAJpB,KAAA;IAGM,EAAA;IACA,cAAA;EAAA;AAAA;;;KCzCH,YAAA,GAAe,UAAA,QAAkB,eAAA;AAAA,UAE5B,kBAAA;EACR,aAAA,GAAgB,IAAA;EAChB,UAAA,EAAY,aAAA;EACZ,IAAA,EAAM,IAAA;AAAA;AAAA,UAgBS,kBAAA;EDgBf;;;ECZA,WAAA,GAAc,MAAA;EDgBM;;;ECXpB,YAAA;IAAiB,IAAA;IAAc,KAAA;EAAA;EA9Bb;;AAAiC;EAmCnD,SAAA,GAAY,kBAAA;;;;EAKZ,aAAA,IAAiB,MAAA,mBAAyB,YAAA,GAAe,OAAA,CAAQ,YAAA;AAAA;AAAA;EAAA,UAKvD,OAAA,SAAgB,kBAAA;AAAA;AAAA,UAGX,WAAA,eAA0B,MAAA,2BAAiC,MAAA;EAI1E,WAAA,EAAa,WAAA;EACb,OAAA,EAAS,UAAA;AAAA"}
@@ -1,12 +1,12 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CjeV3_4I.js";
2
2
  import { t as createCache } from "./async-cache-DRmFaVGm.js";
3
- import { t as fumaMatter } from "./fuma-matter-Pwr2S9Ab.js";
3
+ import { t as fumaMatter } from "./fuma-matter-B4gT09gM.js";
4
4
  import * as fs$1 from "node:fs/promises";
5
5
  import * as path$1 from "node:path";
6
+ import { visit } from "unist-util-visit";
6
7
  import { createProcessor } from "@mdx-js/mdx";
7
8
  import { VFile } from "vfile";
8
9
  import { unified } from "unified";
9
- import { visit } from "unist-util-visit";
10
10
  import { toMarkdown } from "mdast-util-to-markdown";
11
11
  import { valueToEstree } from "estree-util-value-to-estree";
12
12
  import { removePosition } from "unist-util-remove-position";
@@ -47,7 +47,7 @@ function remarkMarkAndUnravel() {
47
47
  }
48
48
 
49
49
  //#endregion
50
- //#region src/collections/mdx/mdast-utils.ts
50
+ //#region src/utils/mdast/flatten.ts
51
51
  function flattenNode(node) {
52
52
  if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
53
53
  if ("value" in node) return node.value;
@@ -340,7 +340,7 @@ function getMdastExport(name, value) {
340
340
  //#endregion
341
341
  //#region src/collections/mdx/build-mdx.ts
342
342
  var build_mdx_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
343
- async function buildMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
343
+ async function buildMDX(core, collection, { filePath, frontmatter, source, compiler, environment, isDevelopment }) {
344
344
  const processorCache = createCache(core.cache).$value();
345
345
  function getProcessor(format) {
346
346
  const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
@@ -370,7 +370,7 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
370
370
  cwd: core.getOptions().cwd,
371
371
  data: {
372
372
  frontmatter,
373
- _compiler,
373
+ _compiler: compiler,
374
374
  _getProcessor: getProcessor
375
375
  }
376
376
  });
@@ -384,4 +384,4 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
384
384
 
385
385
  //#endregion
386
386
  export { build_mdx_exports as n, buildMDX as t };
387
- //# sourceMappingURL=build-mdx-oug7zk0w.js.map
387
+ //# sourceMappingURL=build-mdx-DgzggXIL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-mdx-DgzggXIL.js","names":["fs","path"],"sources":["../src/collections/mdx/remark-unravel.ts","../src/utils/mdast/flatten.ts","../src/collections/mdx/remark-include.ts","../src/collections/mdx/remark-postprocess.ts","../src/collections/mdx/build-mdx.ts"],"sourcesContent":["// from internal remark plugins in https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/remark-mark-and-unravel.js\n// we need to ensure consistency with MDX.js when parsing embed content in `remark-include`\nimport { visit } from \"unist-util-visit\";\nimport type { Transformer } from \"unified\";\nimport type { Root, RootContent } from \"mdast\";\n\nexport function remarkMarkAndUnravel(): Transformer<Root, Root> {\n return (tree) => {\n visit(tree, (node, index, parent) => {\n let offset = -1;\n let all = true;\n let oneOrMore = false;\n\n if (parent && typeof index === \"number\" && node.type === \"paragraph\") {\n const children = node.children;\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (child.type === \"mdxJsxTextElement\" || child.type === \"mdxTextExpression\") {\n oneOrMore = true;\n } else if (child.type === \"text\" && child.value.trim().length === 0) {\n // Empty.\n } else {\n all = false;\n break;\n }\n }\n\n if (all && oneOrMore) {\n offset = -1;\n const newChildren: RootContent[] = [];\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (child.type === \"mdxJsxTextElement\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxJsxFlowElement\";\n }\n\n if (child.type === \"mdxTextExpression\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxFlowExpression\";\n }\n\n if (child.type === \"text\" && /^[\\t\\r\\n ]+$/.test(String(child.value))) {\n // Empty.\n } else {\n newChildren.push(child);\n }\n }\n\n parent.children.splice(index, 1, ...newChildren);\n return index;\n }\n }\n });\n };\n}\n","import type { RootContent } from \"mdast\";\n\nexport function flattenNode(node: RootContent): string {\n if (\"children\" in node) return node.children.map((child) => flattenNode(child)).join(\"\");\n\n if (\"value\" in node) return node.value;\n\n return \"\";\n}\n","import { type PluggableList, type Processor, type Transformer, unified } from \"unified\";\nimport { visit } from \"unist-util-visit\";\nimport type { Code, Node, Root, RootContent } from \"mdast\";\nimport * as path from \"node:path\";\nimport * as fs from \"node:fs/promises\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport type { MdxJsxFlowElement, MdxJsxTextElement } from \"mdast-util-mdx-jsx\";\nimport { VFile } from \"vfile\";\nimport type { Directives } from \"mdast-util-directive\";\nimport { remarkMarkAndUnravel } from \"@/collections/mdx/remark-unravel\";\nimport { flattenNode } from \"@/utils/mdast/flatten\";\n\nexport interface Params {\n lang?: string;\n meta?: string;\n}\n\nconst ElementLikeTypes: ElementLikeContent[\"type\"][] = [\n \"mdxJsxFlowElement\",\n \"mdxJsxTextElement\",\n \"containerDirective\",\n \"textDirective\",\n \"leafDirective\",\n];\ntype ElementLikeContent = MdxJsxFlowElement | MdxJsxTextElement | Directives;\n\nfunction isElementLike(node: Node): node is ElementLikeContent {\n return ElementLikeTypes.includes(node.type as ElementLikeContent[\"type\"]);\n}\n\nfunction parseElementAttributes(\n element: ElementLikeContent,\n): Record<string, string | null | undefined> {\n if (Array.isArray(element.attributes)) {\n const attributes: Record<string, string | null> = {};\n\n for (const attr of element.attributes) {\n if (\n attr.type === \"mdxJsxAttribute\" &&\n (typeof attr.value === \"string\" || attr.value === null)\n ) {\n attributes[attr.name] = attr.value;\n }\n }\n\n return attributes;\n }\n\n return element.attributes ?? {};\n}\n\nfunction parseSpecifier(specifier: string): {\n file: string;\n section?: string;\n} {\n const idx = specifier.lastIndexOf(\"#\");\n if (idx === -1) return { file: specifier };\n\n return {\n file: specifier.slice(0, idx),\n section: specifier.slice(idx + 1),\n };\n}\n\nfunction extractSection(root: Root, section: string): Root | undefined {\n let nodes: RootContent[] | undefined;\n let capturingHeadingContent = false;\n\n visit(root, (node) => {\n if (node.type === \"heading\") {\n if (capturingHeadingContent) {\n return false;\n }\n\n if (node.data?.hProperties?.id === section) {\n capturingHeadingContent = true;\n nodes = [node];\n return \"skip\";\n }\n\n return;\n }\n\n if (capturingHeadingContent) {\n nodes?.push(node as RootContent);\n return \"skip\";\n }\n\n if (isElementLike(node) && node.name === \"section\") {\n const attributes = parseElementAttributes(node);\n\n if (attributes.id === section) {\n nodes = node.children;\n return false;\n }\n }\n });\n\n if (nodes)\n return {\n type: \"root\",\n children: nodes,\n };\n}\n\n// region marker regexes\nconst REGION_MARKERS = [\n {\n start: /^\\s*\\/\\/\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*\\/\\/\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*<!--\\s*#?region\\b\\s*(.*?)\\s*-->/,\n end: /^\\s*<!--\\s*#?endregion\\b\\s*(.*?)\\s*-->/,\n },\n {\n start: /^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\//,\n end: /^\\s*\\/\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\//,\n },\n {\n start: /^\\s*#[rR]egion\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#[eE]nd ?[rR]egion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*(?:--|::|@?REM)\\s*#region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*(?:--|::|@?REM)\\s*#endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#pragma\\s+region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#pragma\\s+endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*\\(\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\)/,\n end: /^\\s*\\(\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\)/,\n },\n];\n\nfunction dedent(lines: string[]): string {\n const minIndent = lines.reduce((min, line) => {\n const match = line.match(/^(\\s*)\\S/);\n return match ? Math.min(min, match[1].length) : min;\n }, Infinity);\n\n return minIndent === Infinity\n ? lines.join(\"\\n\")\n : lines.map((l) => l.slice(minIndent)).join(\"\\n\");\n}\n\nfunction extractCodeRegion(content: string, regionName: string): string {\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n for (const re of REGION_MARKERS) {\n let match = re.start.exec(lines[i]);\n if (match?.[1] !== regionName) continue;\n\n let depth = 1;\n const extractedLines: string[] = [];\n for (let j = i + 1; j < lines.length; j++) {\n match = re.start.exec(lines[j]);\n if (match) {\n depth++;\n continue;\n }\n\n match = re.end.exec(lines[j]);\n if (match) {\n if (match[1] === regionName) depth = 0;\n else if (match[1] === \"\") depth--;\n else continue;\n\n if (depth > 0) continue;\n return dedent(extractedLines);\n } else {\n extractedLines.push(lines[j]);\n }\n }\n }\n }\n throw new Error(`Region \"${regionName}\" not found`);\n}\n\nexport interface RemarkIncludeOptions {\n /**\n * remark plugins to preprocess the MDAST tree before scanning headings/sections.\n *\n * e.g. parse headings before extraction.\n */\n preprocess?: PluggableList;\n}\n\nexport function remarkInclude(\n this: Processor,\n { preprocess = [] }: RemarkIncludeOptions = {},\n): Transformer<Root, Root> {\n const TagName = \"include\";\n const preprocessor = unified().use(remarkMarkAndUnravel).use(preprocess);\n\n const embedContent = async (\n targetPath: string,\n heading: string | undefined,\n params: Params,\n parent: VFile,\n ) => {\n const { _getProcessor = () => this, _compiler } = parent.data;\n let content: string;\n try {\n content = (await fs.readFile(targetPath)).toString();\n } catch (e) {\n throw new Error(\n `failed to read file ${targetPath}\\n${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n );\n }\n\n const ext = path.extname(targetPath);\n _compiler?.addDependency(targetPath);\n if (params.lang || (ext !== \".md\" && ext !== \".mdx\")) {\n const lang = params.lang ?? ext.slice(1);\n\n return {\n type: \"code\",\n lang,\n meta: params.meta,\n value: heading ? extractCodeRegion(content, heading) : content,\n data: {},\n } satisfies Code;\n }\n\n const parser = await _getProcessor(ext === \".mdx\" ? \"mdx\" : \"md\");\n const parsed = fumaMatter(content);\n const targetFile = new VFile({\n path: targetPath,\n value: parsed.content,\n data: {\n ...parent.data,\n frontmatter: parsed.data as Record<string, unknown>,\n },\n });\n\n let mdast = await preprocessor.run(parser.parse(targetFile) as Root, targetFile);\n\n if (heading) {\n const extracted = extractSection(mdast, heading);\n if (!extracted)\n throw new Error(\n `Cannot find section ${heading} in ${targetPath}, make sure you have encapsulated the section in a <section id=\"${heading}\"> tag, or a :::section directive with remark-directive configured.`,\n );\n\n mdast = extracted;\n }\n\n await update(mdast, targetFile);\n return mdast;\n };\n\n async function update(tree: Root, file: VFile) {\n const queue: Promise<void>[] = [];\n\n visit(tree, ElementLikeTypes, (_node, _, parent) => {\n const node = _node as ElementLikeContent;\n if (node.name !== TagName) return;\n\n const specifier = flattenNode(node);\n if (specifier.length === 0) return \"skip\";\n\n const attributes = parseElementAttributes(node);\n const { file: relativePath, section } = parseSpecifier(specifier);\n const targetPath = path.resolve(\n \"cwd\" in attributes ? file.cwd : (file.dirname ?? \"\"),\n relativePath,\n );\n\n queue.push(\n embedContent(targetPath, section, attributes, file).then((replace) => {\n Object.assign(parent && parent.type === \"paragraph\" ? parent : node, replace);\n }),\n );\n\n return \"skip\";\n });\n\n await Promise.all(queue);\n }\n\n return async (tree, file) => {\n await update(tree, file);\n };\n}\n","import type { Processor, Transformer } from \"unified\";\nimport type { Heading, Root, RootContent } from \"mdast\";\nimport { visit } from \"unist-util-visit\";\nimport { toMarkdown } from \"mdast-util-to-markdown\";\nimport { valueToEstree } from \"estree-util-value-to-estree\";\nimport { removePosition } from \"unist-util-remove-position\";\nimport { flattenNode } from \"@/utils/mdast/flatten\";\nimport { mdxToMarkdown } from \"mdast-util-mdx\";\n\nexport interface LinkReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: \"md\" | \"mdx\";\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n processedMarkdown?:\n | boolean\n | {\n as?: string;\n /**\n * include heading IDs into the processed markdown.\n */\n headingIds?: boolean;\n };\n\n /**\n * extract link references, export via `_linkReferences`.\n */\n linkReferences?:\n | boolean\n | {\n as?: string;\n };\n\n /**\n * store MDAST and export via `_mdast`.\n */\n mdast?:\n | boolean\n | {\n as?: string;\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n _format,\n processedMarkdown = false,\n mdast = false,\n linkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, \"heading\", (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data[\"mdx-export\"] ??= [];\n file.data[\"mdx-export\"].push({\n name: \"frontmatter\",\n value: frontmatter,\n });\n\n if (linkReferences) {\n const { as = \"_linkReferences\" } = linkReferences === true ? {} : linkReferences;\n const urls: LinkReference[] = [];\n\n visit(tree, \"link\", (node) => {\n urls.push({\n href: node.url,\n });\n return \"skip\";\n });\n\n file.data[\"mdx-export\"].push({\n name: as,\n value: urls,\n });\n }\n\n if (processedMarkdown) {\n const { as = \"_markdown\", headingIds = true } =\n processedMarkdown === true ? {} : processedMarkdown;\n const extensions = this.data(\"toMarkdownExtensions\") ?? [];\n\n const markdown = toMarkdown(tree, {\n ...this.data(\"settings\"),\n extensions: _format === \"md\" ? [...extensions, mdxToMarkdown()] : extensions,\n handlers: {\n heading(node: Heading) {\n const id = node.data?.hProperties?.id;\n const content = flattenNode(node);\n return headingIds && id ? `${content} [#${id}]` : content;\n },\n },\n });\n\n file.data[\"mdx-export\"].push({\n name: as,\n value: markdown,\n });\n }\n\n if (mdast) {\n const { as = \"_mdast\", removePosition: shouldRemovePosition = false } =\n mdast === true ? {} : mdast;\n const stringified = JSON.stringify(\n shouldRemovePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data[\"mdx-export\"].push({\n name: as,\n value: stringified,\n });\n }\n\n for (const { name, value } of file.data[\"mdx-export\"]) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data[\"mdx-export\"] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: \"mdxjsEsm\",\n value: \"\",\n data: {\n estree: {\n type: \"Program\",\n sourceType: \"module\",\n body: [\n {\n type: \"ExportNamedDeclaration\",\n specifiers: [],\n attributes: [],\n source: null,\n declaration: {\n type: \"VariableDeclaration\",\n kind: \"let\",\n declarations: [\n {\n type: \"VariableDeclarator\",\n id: {\n type: \"Identifier\",\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import { createProcessor } from \"@mdx-js/mdx\";\nimport { VFile } from \"vfile\";\nimport { remarkInclude, type RemarkIncludeOptions } from \"@/collections/mdx/remark-include\";\nimport { type PostprocessOptions, remarkPostprocess } from \"@/collections/mdx/remark-postprocess\";\nimport type { Core } from \"@/core\";\nimport { createCache } from \"@/utils/async-cache\";\nimport type { MDXContent } from \"mdx/types\";\nimport { MDXCollection } from \"../mdx\";\n\ntype MDXProcessor = ReturnType<typeof createProcessor>;\n\ninterface MDXCompilerContext {\n addDependency: (file: string) => void;\n collection: MDXCollection | undefined;\n core: Core;\n}\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: \"bundler\" | \"runtime\";\n isDevelopment: boolean;\n compiler: MDXCompilerContext;\n}\n\nexport interface FumaContentDataMap {\n /**\n * [Fuma Content] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fuma Content] additional ESM exports to write\n */\n \"mdx-export\"?: { name: string; value: unknown }[];\n\n /**\n * [Fuma Content] The internal compiler info\n */\n _compiler?: MDXCompilerContext;\n\n /**\n * [Fuma Content] get internal processor, do not use this on user land.\n */\n _getProcessor?: (format: \"md\" | \"mdx\") => MDXProcessor | Promise<MDXProcessor>;\n}\n\ndeclare module \"vfile\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends FumaContentDataMap {}\n}\n\nexport interface CompiledMDX<Frontmatter = Record<string, unknown>> extends Record<\n string,\n unknown\n> {\n frontmatter: Frontmatter;\n default: MDXContent;\n}\n\nexport async function buildMDX(\n core: Core,\n collection: MDXCollection | undefined,\n { filePath, frontmatter, source, compiler, environment, isDevelopment }: BuildMDXOptions,\n): Promise<VFile> {\n const processorCache = createCache(core.cache).$value<MDXProcessor>();\n\n function getProcessor(format: \"md\" | \"mdx\") {\n const key = `build-mdx:${collection?.name ?? \"global\"}:${format}`;\n\n return processorCache.cached(key, async () => {\n const mdxOptions = await collection?.getMDXOptions?.(environment);\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...collection?.postprocess,\n };\n const remarkIncludeOptions: RemarkIncludeOptions = {\n preprocess: collection?.preprocess?.remarkPlugins,\n };\n\n return createProcessor({\n outputFormat: \"program\",\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n [remarkInclude, remarkIncludeOptions],\n ...(mdxOptions?.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n });\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: core.getOptions().cwd,\n data: {\n frontmatter,\n _compiler: compiler,\n _getProcessor: getProcessor,\n },\n });\n\n if (collection && collection) {\n vfile = await collection.vfile.run(vfile, {\n collection,\n filePath,\n source,\n });\n }\n\n return (await getProcessor(filePath.endsWith(\".mdx\") ? \"mdx\" : \"md\")).process(vfile);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAMA,SAAgB,uBAAgD;AAC9D,SAAQ,SAAS;AACf,QAAM,OAAO,MAAM,OAAO,WAAW;GACnC,IAAI,SAAS;GACb,IAAI,MAAM;GACV,IAAI,YAAY;AAEhB,OAAI,UAAU,OAAO,UAAU,YAAY,KAAK,SAAS,aAAa;IACpE,MAAM,WAAW,KAAK;AAEtB,WAAO,EAAE,SAAS,SAAS,QAAQ;KACjC,MAAM,QAAQ,SAAS;AAEvB,SAAI,MAAM,SAAS,uBAAuB,MAAM,SAAS,oBACvD,aAAY;cACH,MAAM,SAAS,UAAU,MAAM,MAAM,MAAM,CAAC,WAAW,GAAG,QAE9D;AACL,YAAM;AACN;;;AAIJ,QAAI,OAAO,WAAW;AACpB,cAAS;KACT,MAAM,cAA6B,EAAE;AAErC,YAAO,EAAE,SAAS,SAAS,QAAQ;MACjC,MAAM,QAAQ,SAAS;AAEvB,UAAI,MAAM,SAAS,oBAEjB,OAAM,OAAO;AAGf,UAAI,MAAM,SAAS,oBA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AAM"}
@@ -1,4 +1,4 @@
1
- import { n as CoreOptions, t as Core } from "../core-CG2zTL4c.js";
1
+ import { n as CoreOptions, t as Core } from "../core-FjA_Xoho.js";
2
2
  import { BunPlugin } from "bun";
3
3
 
4
4
  //#region src/bun/index.d.ts
package/dist/bun/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Core } from "../core-DmbQk8Z2.js";
1
+ import { t as Core } from "../core-BuUsOElL.js";
2
2
  import { loaderPlugin } from "../plugins/loader/index.js";
3
3
  import { pathToFileURL } from "node:url";
4
4
 
@@ -1,3 +1,4 @@
1
+ import { t as isPromiseLike } from "./is-promise-like-DYHv0Yap.js";
1
2
  import { readFileSync } from "node:fs";
2
3
  import { parse } from "node:querystring";
3
4
 
@@ -20,11 +21,11 @@ function toBun(test = /.+/, loader) {
20
21
  query: parse(query),
21
22
  filePath,
22
23
  development: false,
23
- compiler: { addDependency() {} }
24
+ addDependency() {}
24
25
  };
25
26
  if (loader.bun?.load) return loader.bun.load(readFileSync(filePath).toString(), input);
26
27
  const result = loader.load(input);
27
- if (result instanceof Promise) return result.then(toResult);
28
+ if (isPromiseLike(result)) return result.then(toResult);
28
29
  return toResult(result);
29
30
  });
30
31
  };
@@ -32,4 +33,4 @@ function toBun(test = /.+/, loader) {
32
33
 
33
34
  //#endregion
34
35
  export { toBun };
35
- //# sourceMappingURL=bun-cxKGeSx6.js.map
36
+ //# sourceMappingURL=bun-Be5pgXW_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-Be5pgXW_.js","names":[],"sources":["../src/plugins/loader/bun.ts"],"sourcesContent":["import { parse } from \"node:querystring\";\nimport { readFileSync } from \"node:fs\";\nimport type { LoaderInput, Loader, LoaderOutput } from \"@/plugins/loader\";\nimport { isPromiseLike } from \"@/utils/is-promise-like\";\n\nexport function toBun(test: RegExp = /.+/, loader: Loader) {\n function toResult(output: LoaderOutput | null): Bun.OnLoadResult {\n // it errors, treat this as an exception\n if (!output) return;\n\n return {\n contents: output.code,\n loader: output.moduleType ?? \"js\",\n };\n }\n\n return (build: Bun.PluginBuilder): void => {\n // avoid using async here, because it will cause dynamic require() to fail\n build.onLoad({ filter: test }, (args) => {\n const [filePath, query = \"\"] = args.path.split(\"?\", 2);\n const input: LoaderInput = {\n async getSource() {\n return Bun.file(filePath).text();\n },\n query: parse(query),\n filePath,\n development: false,\n addDependency() {},\n };\n\n if (loader.bun?.load) {\n return loader.bun.load(readFileSync(filePath).toString(), input);\n }\n\n const result = loader.load(input);\n if (isPromiseLike(result)) {\n return result.then(toResult);\n }\n return toResult(result);\n });\n };\n}\n"],"mappings":";;;;;AAKA,SAAgB,MAAM,OAAe,MAAM,QAAgB;CACzD,SAAS,SAAS,QAA+C;AAE/D,MAAI,CAAC,OAAQ;AAEb,SAAO;GACL,UAAU,OAAO;GACjB,QAAQ,OAAO,cAAc;GAC9B;;AAGH,SAAQ,UAAmC;AAEzC,QAAM,OAAO,EAAE,QAAQ,MAAM,GAAG,SAAS;GACvC,MAAM,CAAC,UAAU,QAAQ,MAAM,KAAK,KAAK,MAAM,KAAK,EAAE;GACtD,MAAM,QAAqB;IACzB,MAAM,YAAY;AAChB,YAAO,IAAI,KAAK,SAAS,CAAC,MAAM;;IAElC,OAAO,MAAM,MAAM;IACnB;IACA,aAAa;IACb,gBAAgB;IACjB;AAED,OAAI,OAAO,KAAK,KACd,QAAO,OAAO,IAAI,KAAK,aAAa,SAAS,CAAC,UAAU,EAAE,MAAM;GAGlE,MAAM,SAAS,OAAO,KAAK,MAAM;AACjC,OAAI,cAAc,OAAO,CACvB,QAAO,OAAO,KAAK,SAAS;AAE9B,UAAO,SAAS,OAAO;IACvB"}
@@ -10,9 +10,8 @@ var CodeGenerator = class {
10
10
  importInfos = /* @__PURE__ */ new Map();
11
11
  eagerImportId = 0;
12
12
  options;
13
- constructor({ target = "default", jsExtension = false, outDir = "" }) {
13
+ constructor({ jsExtension = false, outDir = "" }) {
14
14
  this.options = {
15
- target,
16
15
  jsExtension,
17
16
  outDir
18
17
  };
@@ -82,7 +81,6 @@ var CodeGenerator = class {
82
81
  }
83
82
  toString() {
84
83
  const final = ["// @ts-nocheck"];
85
- if (this.options.target === "vite") final.push("/// <reference types=\"vite/client\" />");
86
84
  for (const [specifier, { namespaces, isUsed, named }] of this.importInfos) {
87
85
  if (namespaces) for (const namespace of namespaces) final.push(isUsed?.has(namespace) ? `import * as ${namespace} from "${specifier}";` : `import type * as ${namespace} from "${specifier}";`);
88
86
  if (named && named.size > 0) {
@@ -105,4 +103,4 @@ function slash(path) {
105
103
 
106
104
  //#endregion
107
105
  export { slash as n, CodeGenerator as t };
108
- //# sourceMappingURL=code-generator-C_Gu9y3h.js.map
106
+ //# sourceMappingURL=code-generator-CHcOrCeM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-generator-CHcOrCeM.js","names":[],"sources":["../src/utils/code-generator.ts"],"sourcesContent":["import type { EmitConfig } from \"@/config\";\nimport path from \"node:path\";\nimport { URLSearchParams } from \"node:url\";\n\nexport interface CodeGeneratorOptions extends EmitConfig {\n outDir: string;\n}\n\ninterface ImportInfo {\n /**\n * import name -> member name\n */\n named?: Map<string, string>;\n namespaces?: Set<string>;\n /**\n * a set of import names, the import is type-only if its name is missing in this set.\n */\n isUsed?: Set<string>;\n}\n\n/**\n * Code generator (one instance per file)\n */\nexport class CodeGenerator {\n private readonly lines: string[] = [];\n // specifier -> imported members/info\n private readonly importInfos = new Map<string, ImportInfo>();\n private eagerImportId = 0;\n\n readonly options: CodeGeneratorOptions;\n constructor({ jsExtension = false, outDir = \"\" }: Partial<CodeGeneratorOptions>) {\n this.options = {\n jsExtension,\n outDir,\n };\n }\n\n addNamespaceImport(namespace: string, specifier: string, typeOnly = false) {\n const info = this.importInfos.get(specifier) ?? {};\n this.importInfos.set(specifier, info);\n if (!typeOnly) {\n info.isUsed ??= new Set();\n info.isUsed.add(namespace);\n }\n\n info.namespaces ??= new Set();\n info.namespaces.add(namespace);\n }\n\n addNamedImport(names: string[], specifier: string, typeOnly = false) {\n const info = this.importInfos.get(specifier) ?? {};\n this.importInfos.set(specifier, info);\n info.named ??= new Map();\n\n for (const name of names) {\n const [memberName, importName = memberName] = name.split(/\\s+as\\s+/, 2);\n info.named.set(importName, memberName);\n if (!typeOnly) {\n info.isUsed ??= new Set();\n info.isUsed.add(importName);\n }\n }\n }\n\n push(...insert: string[]) {\n this.lines.push(...insert);\n }\n\n async pushAsync(insert: Promise<string | undefined>[]) {\n for (const line of await Promise.all(insert)) {\n if (line === undefined) continue;\n\n this.lines.push(line);\n }\n }\n\n /** generate a random import name that is unique in file. */\n generateImportName(): string {\n return `__${this.eagerImportId++}`;\n }\n\n formatDynamicImport(specifier: string, mod?: string): string {\n let s = `import(\"${specifier}\")`;\n if (mod) s += `.then(mod => mod.${mod})`;\n return s;\n }\n\n formatQuery(query: Record<string, string | undefined>) {\n const params = new URLSearchParams();\n for (const k in query) {\n const value = query[k];\n if (typeof value === \"string\") params.set(k, value);\n }\n return params.toString();\n }\n\n formatImportPath(file: string) {\n const ext = path.extname(file);\n let filename: string;\n\n switch (ext) {\n case \".ts\":\n case \".tsx\":\n filename = file.substring(0, file.length - ext.length);\n if (this.options.jsExtension) filename += \".js\";\n break;\n default:\n filename = file;\n }\n\n const importPath = slash(path.relative(this.options.outDir, filename));\n return importPath.startsWith(\"../\") ? importPath : `./${importPath}`;\n }\n\n toString() {\n const final: string[] = [\"// @ts-nocheck\"];\n\n for (const [specifier, { namespaces, isUsed, named }] of this.importInfos) {\n if (namespaces)\n for (const namespace of namespaces) {\n final.push(\n isUsed?.has(namespace)\n ? `import * as ${namespace} from \"${specifier}\";`\n : `import type * as ${namespace} from \"${specifier}\";`,\n );\n }\n\n if (named && named.size > 0) {\n const namedImports: string[] = [];\n\n for (const [importName, memberName] of named) {\n const item = importName === memberName ? importName : `${memberName} as ${importName}`;\n\n namedImports.push(isUsed?.has(importName) ? item : `type ${item}`);\n }\n\n final.push(`import { ${namedImports.join(\", \")} } from \"${specifier}\";`);\n }\n }\n\n final.push(...this.lines);\n return final.join(\"\\n\");\n }\n}\n\nexport function slash(path: string): string {\n const isExtendedLengthPath = path.startsWith(\"\\\\\\\\?\\\\\");\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll(\"\\\\\", \"/\");\n}\n\nexport function ident(code: string, tab: number = 1) {\n return code\n .split(\"\\n\")\n .map((v) => \" \".repeat(tab) + v)\n .join(\"\\n\");\n}\n"],"mappings":";;;;;;;AAuBA,IAAa,gBAAb,MAA2B;CACzB,AAAiB,QAAkB,EAAE;CAErC,AAAiB,8BAAc,IAAI,KAAyB;CAC5D,AAAQ,gBAAgB;CAExB,AAAS;CACT,YAAY,EAAE,cAAc,OAAO,SAAS,MAAqC;AAC/E,OAAK,UAAU;GACb;GACA;GACD;;CAGH,mBAAmB,WAAmB,WAAmB,WAAW,OAAO;EACzE,MAAM,OAAO,KAAK,YAAY,IAAI,UAAU,IAAI,EAAE;AAClD,OAAK,YAAY,IAAI,WAAW,KAAK;AACrC,MAAI,CAAC,UAAU;AACb,QAAK,2BAAW,IAAI,KAAK;AACzB,QAAK,OAAO,IAAI,UAAU;;AAG5B,OAAK,+BAAe,IAAI,KAAK;AAC7B,OAAK,WAAW,IAAI,UAAU;;CAGhC,eAAe,OAAiB,WAAmB,WAAW,OAAO;EACnE,MAAM,OAAO,KAAK,YAAY,IAAI,UAAU,IAAI,EAAE;AAClD,OAAK,YAAY,IAAI,WAAW,KAAK;AACrC,OAAK,0BAAU,IAAI,KAAK;AAExB,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,CAAC,YAAY,aAAa,cAAc,KAAK,MAAM,YAAY,EAAE;AACvE,QAAK,MAAM,IAAI,YAAY,WAAW;AACtC,OAAI,CAAC,UAAU;AACb,SAAK,2BAAW,IAAI,KAAK;AACzB,SAAK,OAAO,IAAI,WAAW;;;;CAKjC,KAAK,GAAG,QAAkB;AACxB,OAAK,MAAM,KAAK,GAAG,OAAO;;CAG5B,MAAM,UAAU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;AAE1E,kBAAa,KAAK,QAAQ,IAAI,WAAW,GAAG,OAAO,QAAQ,OAAO;;AAGpE,UAAM,KAAK,YAAY,aAAa,KAAK,KAAK,CAAC,WAAW,UAAU,IAAI;;;AAI5E,QAAM,KAAK,GAAG,KAAK,MAAM;AACzB,SAAO,MAAM,KAAK,KAAK;;;AAI3B,SAAgB,MAAM,MAAsB;AAG1C,KAF6B,KAAK,WAAW,UAAU,CAGrD,QAAO;AAGT,QAAO,KAAK,WAAW,MAAM,IAAI"}
@@ -1,5 +1,5 @@
1
- import { C as GetCollectionConfig } from "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import { C as GetCollectionConfig } from "../../core-FjA_Xoho.js";
2
+ import "../../load-from-file-CIYdu-B5.js";
3
3
  import { DataCollection } from "../data.js";
4
4
  import { FileCollectionStore } from "../runtime/file-store.js";
5
5
 
@@ -1,5 +1,5 @@
1
- import { m as AsyncPipe } from "../core-CG2zTL4c.js";
2
- import "../load-from-file-CpA8UQXX.js";
1
+ import { m as AsyncPipe } from "../core-FjA_Xoho.js";
2
+ import "../load-from-file-CIYdu-B5.js";
3
3
  import { LoaderConfig } from "../plugins/loader/index.js";
4
4
  import { FileSystemCollection, FileSystemCollectionConfig } from "./fs.js";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -1,5 +1,5 @@
1
1
  import { t as asyncPipe } from "../pipe-CvCqOpXX.js";
2
- import { n as slash } from "../code-generator-C_Gu9y3h.js";
2
+ import { n as slash } from "../code-generator-CHcOrCeM.js";
3
3
  import { loaderHook } from "../plugins/loader/index.js";
4
4
  import { FileSystemCollection } from "./fs.js";
5
5
  import path from "node:path";
@@ -102,7 +102,7 @@ function yamlLoader() {
102
102
  };
103
103
  },
104
104
  async createLoader() {
105
- const { createYamlLoader } = await import("../loader-DKTW82eK.js").then((n) => n.n);
105
+ const { createYamlLoader } = await import("../loader-Cb9kSSxT.js").then((n) => n.n);
106
106
  const core = this.core;
107
107
  return createYamlLoader({ getCore: () => core });
108
108
  }
@@ -147,7 +147,7 @@ function jsonLoader() {
147
147
  };
148
148
  },
149
149
  async createLoader(environment) {
150
- const { createJsonLoader } = await import("../loader-DTODFdmk.js").then((n) => n.n);
150
+ const { createJsonLoader } = await import("../loader-BOYLUNfh.js").then((n) => n.n);
151
151
  const core = this.core;
152
152
  return createJsonLoader({ getCore: () => core }, environment === "vite" ? "json" : "js");
153
153
  }
@@ -1,4 +1,4 @@
1
- import "../core-CG2zTL4c.js";
1
+ import "../core-FjA_Xoho.js";
2
2
  import { Collection } from "./index.js";
3
3
 
4
4
  //#region src/collections/fs.d.ts
@@ -1,4 +1,4 @@
1
- import { f as ServerContext, i as EmitEntry, l as PluginOption, m as AsyncPipe, r as EmitContext, t as Core, u as ResolvedConfig, v as AsyncHook, y as Hook } from "../core-CG2zTL4c.js";
1
+ import { f as ServerContext, i as EmitEntry, l as PluginOption, m as AsyncPipe, r as EmitContext, t as Core, u as ResolvedConfig, v as AsyncHook, y as Hook } from "../core-FjA_Xoho.js";
2
2
 
3
3
  //#region src/collections/index.d.ts
4
4
  interface CollectionHookContext {
@@ -1,5 +1,5 @@
1
- import "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import "../../core-FjA_Xoho.js";
2
+ import "../../load-from-file-CIYdu-B5.js";
3
3
  import { WebpackLoader } from "../../plugins/loader/webpack.js";
4
4
 
5
5
  //#region src/collections/json/loader-webpack.d.ts
@@ -1,7 +1,7 @@
1
1
  import "../../validation-C3kXuveD.js";
2
2
  import { createWebpackLoader } from "../../plugins/loader/webpack.js";
3
- import "../../loader-gwXIGo5Q.js";
4
- import { t as createJsonLoader } from "../../loader-DTODFdmk.js";
3
+ import "../../loader-UhlX4xbz.js";
4
+ import { t as createJsonLoader } from "../../loader-BOYLUNfh.js";
5
5
 
6
6
  //#region src/collections/json/loader-webpack.ts
7
7
  var loader_webpack_default = createWebpackLoader((core) => createJsonLoader(core, "json"));
@@ -1,5 +1,5 @@
1
- import "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import "../../core-FjA_Xoho.js";
2
+ import "../../load-from-file-CIYdu-B5.js";
3
3
  import { WebpackLoader } from "../../plugins/loader/webpack.js";
4
4
 
5
5
  //#region src/collections/mdx/loader-webpack.d.ts
@@ -1,7 +1,7 @@
1
1
  import "../../validation-C3kXuveD.js";
2
+ import "../../fuma-matter-B4gT09gM.js";
2
3
  import { createWebpackLoader } from "../../plugins/loader/webpack.js";
3
- import "../../fuma-matter-Pwr2S9Ab.js";
4
- import { t as createMdxLoader } from "../../loader-DOjRBsog.js";
4
+ import { t as createMdxLoader } from "../../loader-BT4fwLTJ.js";
5
5
 
6
6
  //#region src/collections/mdx/loader-webpack.ts
7
7
  var loader_webpack_default = createWebpackLoader(createMdxLoader);
@@ -1,6 +1,5 @@
1
- import "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
3
- import { t as CompiledMDX } from "../../build-mdx-DkAvzRNg.js";
1
+ import "../../core-FjA_Xoho.js";
2
+ import { t as CompiledMDX } from "../../build-mdx-DRqbcE1d.js";
4
3
  import { MDXStoreBrowserData } from "./runtime-browser.js";
5
4
  import { ReactNode } from "react";
6
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"react.d.ts","names":[],"sources":["../../../src/collections/mdx/react.ts"],"mappings":";;;;;;;;;;;AAiBA;iBAAgB,WAAA,uBAAA,CACd,KAAA,EAAO,mBAAA,CAAoB,WAAA,EAAa,QAAA,eACxC,QAAA,GAAW,IAAA,EAAM,WAAA,CAAY,WAAA,IAAe,QAAA,KAAa,SAAA,GACxD,SAAA"}
1
+ {"version":3,"file":"react.d.ts","names":[],"sources":["../../../src/collections/mdx/react.ts"],"mappings":";;;;;;;;;AAkBA;;iBAAgB,WAAA,uBAAA,CACd,KAAA,EAAO,mBAAA,CAAoB,WAAA,EAAa,QAAA,eACxC,QAAA,GAAW,IAAA,EAAM,WAAA,CAAY,WAAA,IAAe,QAAA,KAAa,SAAA,GACxD,SAAA"}
@@ -1,3 +1,4 @@
1
+ import { t as isPromiseLike } from "../../is-promise-like-DYHv0Yap.js";
1
2
  import { createElement, lazy } from "react";
2
3
 
3
4
  //#region src/collections/mdx/react.ts
@@ -20,7 +21,7 @@ function useRenderer(entry, renderFn) {
20
21
  forceOnDemand: false,
21
22
  renderJSX() {
22
23
  const v = entry.preload();
23
- if (!("then" in v) && !this.forceOnDemand) return renderFn(v);
24
+ if (!isPromiseLike(v) && !this.forceOnDemand) return renderFn(v);
24
25
  this.forceOnDemand = true;
25
26
  return createElement(OnDemand);
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","names":[],"sources":["../../../src/collections/mdx/react.ts"],"sourcesContent":["import { ReactNode, lazy, createElement } from \"react\";\nimport { CompiledMDX } from \"./build-mdx\";\nimport { MDXStoreBrowserData } from \"./runtime-browser\";\n\nconst renderMap = new Map<\n string,\n {\n renderJSX: () => ReactNode;\n forceOnDemand: boolean;\n }\n>();\n\n/**\n * Renders content (loaded lazily).\n *\n * It is recommended to use with `<Suspense />`.\n */\nexport function useRenderer<Frontmatter, Attached>(\n entry: MDXStoreBrowserData<Frontmatter, Attached> | undefined,\n renderFn: (data: CompiledMDX<Frontmatter> & Attached) => ReactNode,\n): ReactNode {\n if (!entry) return null;\n const renderKey = `${entry._store.storeId}:${entry.id}`;\n let renderInfo = renderMap.get(renderKey);\n\n if (!renderInfo) {\n const OnDemand = lazy(async () => {\n const loaded = await entry.preload();\n return { default: () => renderFn(loaded) };\n });\n\n renderInfo = {\n forceOnDemand: false,\n renderJSX() {\n const v = entry.preload();\n if (!(\"then\" in v) && !this.forceOnDemand) {\n return renderFn(v);\n }\n\n // ensure it won't unmount React lazy during re-renders\n this.forceOnDemand = true;\n return createElement(OnDemand);\n },\n };\n renderMap.set(renderKey, renderInfo);\n }\n\n return renderInfo.renderJSX();\n}\n"],"mappings":";;;AAIA,MAAM,4BAAY,IAAI,KAMnB;;;;;;AAOH,SAAgB,YACd,OACA,UACW;AACX,KAAI,CAAC,MAAO,QAAO;CACnB,MAAM,YAAY,GAAG,MAAM,OAAO,QAAQ,GAAG,MAAM;CACnD,IAAI,aAAa,UAAU,IAAI,UAAU;AAEzC,KAAI,CAAC,YAAY;EACf,MAAM,WAAW,KAAK,YAAY;GAChC,MAAM,SAAS,MAAM,MAAM,SAAS;AACpC,UAAO,EAAE,eAAe,SAAS,OAAO,EAAE;IAC1C;AAEF,eAAa;GACX,eAAe;GACf,YAAY;IACV,MAAM,IAAI,MAAM,SAAS;AACzB,QAAI,EAAE,UAAU,MAAM,CAAC,KAAK,cAC1B,QAAO,SAAS,EAAE;AAIpB,SAAK,gBAAgB;AACrB,WAAO,cAAc,SAAS;;GAEjC;AACD,YAAU,IAAI,WAAW,WAAW;;AAGtC,QAAO,WAAW,WAAW"}
1
+ {"version":3,"file":"react.js","names":[],"sources":["../../../src/collections/mdx/react.ts"],"sourcesContent":["import { ReactNode, lazy, createElement } from \"react\";\nimport { CompiledMDX } from \"./build-mdx\";\nimport { MDXStoreBrowserData } from \"./runtime-browser\";\nimport { isPromiseLike } from \"@/utils/is-promise-like\";\n\nconst renderMap = new Map<\n string,\n {\n renderJSX: () => ReactNode;\n forceOnDemand: boolean;\n }\n>();\n\n/**\n * Renders content (loaded lazily).\n *\n * It is recommended to use with `<Suspense />`.\n */\nexport function useRenderer<Frontmatter, Attached>(\n entry: MDXStoreBrowserData<Frontmatter, Attached> | undefined,\n renderFn: (data: CompiledMDX<Frontmatter> & Attached) => ReactNode,\n): ReactNode {\n if (!entry) return null;\n const renderKey = `${entry._store.storeId}:${entry.id}`;\n let renderInfo = renderMap.get(renderKey);\n\n if (!renderInfo) {\n const OnDemand = lazy(async () => {\n const loaded = await entry.preload();\n return { default: () => renderFn(loaded) };\n });\n\n renderInfo = {\n forceOnDemand: false,\n renderJSX() {\n const v = entry.preload();\n if (!isPromiseLike(v) && !this.forceOnDemand) {\n return renderFn(v);\n }\n\n // ensure it won't unmount React lazy during re-renders\n this.forceOnDemand = true;\n return createElement(OnDemand);\n },\n };\n renderMap.set(renderKey, renderInfo);\n }\n\n return renderInfo.renderJSX();\n}\n"],"mappings":";;;;AAKA,MAAM,4BAAY,IAAI,KAMnB;;;;;;AAOH,SAAgB,YACd,OACA,UACW;AACX,KAAI,CAAC,MAAO,QAAO;CACnB,MAAM,YAAY,GAAG,MAAM,OAAO,QAAQ,GAAG,MAAM;CACnD,IAAI,aAAa,UAAU,IAAI,UAAU;AAEzC,KAAI,CAAC,YAAY;EACf,MAAM,WAAW,KAAK,YAAY;GAChC,MAAM,SAAS,MAAM,MAAM,SAAS;AACpC,UAAO,EAAE,eAAe,SAAS,OAAO,EAAE;IAC1C;AAEF,eAAa;GACX,eAAe;GACf,YAAY;IACV,MAAM,IAAI,MAAM,SAAS;AACzB,QAAI,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,cAC7B,QAAO,SAAS,EAAE;AAIpB,SAAK,gBAAgB;AACrB,WAAO,cAAc,SAAS;;GAEjC;AACD,YAAU,IAAI,WAAW,WAAW;;AAGtC,QAAO,WAAW,WAAW"}
@@ -1,9 +1,8 @@
1
- import { C as GetCollectionConfig, S as Awaitable } from "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import { C as GetCollectionConfig, S as Awaitable } from "../../core-FjA_Xoho.js";
3
2
  import { MapCollectionStore } from "../runtime/store.js";
4
- import { t as CompiledMDX } from "../../build-mdx-DkAvzRNg.js";
3
+ import { t as CompiledMDX } from "../../build-mdx-DRqbcE1d.js";
5
4
  import { MDXCollection } from "../mdx.js";
6
- import { t as AsyncCache } from "../../async-cache-CBEZB25o.js";
5
+ import { t as AsyncCache } from "../../async-cache-BVuJiIDT.js";
7
6
  import { WithGit } from "./runtime.js";
8
7
 
9
8
  //#region src/collections/mdx/runtime-browser.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-browser.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-browser.ts"],"mappings":";;;;;;;;;UAQiB,mBAAA;EACf,EAAA;EACA,OAAA,QAAe,SAAA,CAAU,WAAA,CAAY,WAAA,IAAe,QAAA;EACpD,MAAA,EAAQ,YAAA;AAAA;AAAA,UAGA,YAAA;EACR,OAAA;AAAA;AAAA,UAGQ,SAAA;EACR,SAAA,EAAW,UAAA,CAAW,WAAA;AAAA;AAAA,KAGnB,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,cAGrB,cAAA,EAAc,GAAA,SAAA,SAAA;AAAA,iBAEX,eAAA,uCAAA,CACd,IAAA,EAAM,IAAA,EACN,MAAA,EAAQ,MAAA,eAAqB,OAAA,aAC5B,kBAAA,SAA2B,mBAAA,CAAoB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA"}
1
+ {"version":3,"file":"runtime-browser.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-browser.ts"],"mappings":";;;;;;;;UAQiB,mBAAA;EACf,EAAA;EACA,OAAA,QAAe,SAAA,CAAU,WAAA,CAAY,WAAA,IAAe,QAAA;EACpD,MAAA,EAAQ,YAAA;AAAA;AAAA,UAGA,YAAA;EACR,OAAA;AAAA;AAAA,UAGQ,SAAA;EACR,SAAA,EAAW,UAAA,CAAW,WAAA;AAAA;AAAA,KAGnB,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,cAGrB,cAAA,EAAc,GAAA,SAAA,SAAA;AAAA,iBAEX,eAAA,uCAAA,CACd,IAAA,EAAM,IAAA,EACN,MAAA,EAAQ,MAAA,eAAqB,OAAA,aAC5B,kBAAA,SAA2B,mBAAA,CAAoB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA"}
@@ -1,7 +1,6 @@
1
- import { C as GetCollectionConfig, n as CoreOptions } from "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import { C as GetCollectionConfig, n as CoreOptions } from "../../core-FjA_Xoho.js";
3
2
  import { FileCollectionStore } from "../runtime/file-store.js";
4
- import { t as CompiledMDX } from "../../build-mdx-DkAvzRNg.js";
3
+ import { t as CompiledMDX } from "../../build-mdx-DRqbcE1d.js";
5
4
  import { MDXCollection } from "../mdx.js";
6
5
  import { WithGit } from "./runtime.js";
7
6
  import { MDXContent } from "mdx/types";
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-dynamic.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"mappings":";;;;;;;;;UAYiB,mBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,OAAA,QAAe,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAK/C,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,iBAGZ,eAAA,uCAAA,CACpB,MAAA,EAAQ,MAAA,EACR,WAAA,EAAa,WAAA,EACb,IAAA,EAAM,IAAA,EACN,IAAA,UACA,YAAA,EAAc,MAAA,mBACd,UAAA,YACC,OAAA,CAAQ,mBAAA,CAAoB,mBAAA,CAAoB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,KA+CrE,UAAA,GAAa,UAAA"}
1
+ {"version":3,"file":"runtime-dynamic.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"mappings":";;;;;;;;UAYiB,mBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,OAAA,QAAe,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAK/C,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,iBAGZ,eAAA,uCAAA,CACpB,MAAA,EAAQ,MAAA,EACR,WAAA,EAAa,WAAA,EACb,IAAA,EAAM,IAAA,EACN,IAAA,UACA,YAAA,EAAc,MAAA,mBACd,UAAA,YACC,OAAA,CAAQ,mBAAA,CAAoB,mBAAA,CAAoB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,KAoDrE,UAAA,GAAa,UAAA"}
@@ -1,10 +1,10 @@
1
- import { t as Core } from "../../core-DmbQk8Z2.js";
1
+ import { t as Core } from "../../core-BuUsOElL.js";
2
2
  import "../../validation-C3kXuveD.js";
3
3
  import { t as createCache } from "../../async-cache-DRmFaVGm.js";
4
4
  import { MDXCollection } from "../mdx.js";
5
+ import { t as fumaMatter } from "../../fuma-matter-B4gT09gM.js";
5
6
  import { FileCollectionStore } from "../runtime/file-store.js";
6
- import { t as fumaMatter } from "../../fuma-matter-Pwr2S9Ab.js";
7
- import { t as buildMDX } from "../../build-mdx-oug7zk0w.js";
7
+ import { t as buildMDX } from "../../build-mdx-DgzggXIL.js";
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { pathToFileURL } from "node:url";
@@ -36,7 +36,12 @@ async function mdxStoreDynamic(config, coreOptions, name, base, _frontmatter, js
36
36
  source: content,
37
37
  frontmatter: v,
38
38
  isDevelopment: false,
39
- environment: "runtime"
39
+ environment: "runtime",
40
+ compiler: {
41
+ collection,
42
+ core,
43
+ addDependency() {}
44
+ }
40
45
  });
41
46
  return await executeMdx(String(compiled.value), {
42
47
  baseUrl: pathToFileURL(filePath),
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-dynamic.js","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"sourcesContent":["import { buildMDX, type CompiledMDX } from \"@/collections/mdx/build-mdx\";\nimport { pathToFileURL } from \"node:url\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport fs from \"node:fs/promises\";\nimport { type CoreOptions, Core } from \"@/core\";\nimport type { MDXContent } from \"mdx/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { GetCollectionConfig } from \"@/types\";\nimport { MDXCollection } from \"@/collections/mdx\";\nimport path from \"node:path\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport interface MDXStoreDynamicData<Frontmatter, Attached = unknown> {\n id: string;\n frontmatter: Frontmatter;\n compile: () => Promise<CompiledMDX<Frontmatter> & Attached>;\n}\n\nlet corePromise: Promise<Core>;\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends MDXCollection\n ? GetCollectionConfig<Config, Name>[\"$inferFrontmatter\"]\n : never;\n\nexport async function mdxStoreDynamic<Config, Name extends string, Attached>(\n config: Config,\n coreOptions: CoreOptions,\n name: Name,\n base: string,\n _frontmatter: Record<string, unknown>,\n jsxRuntime: unknown,\n): Promise<FileCollectionStore<MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>>> {\n corePromise ??= (async () => {\n const core = new Core(coreOptions);\n await core.init({\n config: config as Record<string, unknown>,\n });\n return core;\n })();\n const core = await corePromise;\n const frontmatter = _frontmatter as Record<string, GetFrontmatter<Config, Name>>;\n const collection = core.getCollection(name);\n if (!collection || !(collection instanceof MDXCollection))\n throw new Error(\"invalid collection name\");\n\n const merged: Record<string, MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>> = {};\n const cache = createCache<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>();\n\n for (const [k, v] of Object.entries(frontmatter)) {\n merged[k] = {\n id: k,\n frontmatter: v,\n async compile() {\n return cache.cached(k, async () => {\n const filePath = path.join(base, k);\n let content = (await fs.readFile(filePath)).toString();\n content = fumaMatter(content).content;\n\n const compiled = await buildMDX(core, collection, {\n filePath,\n source: content,\n frontmatter: v as unknown as Record<string, unknown>,\n isDevelopment: false,\n environment: \"runtime\",\n });\n\n return (await executeMdx(String(compiled.value), {\n baseUrl: pathToFileURL(filePath),\n jsxRuntime,\n })) as CompiledMDX<GetFrontmatter<Config, Name>> & Attached;\n });\n },\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n\nexport type MdxContent = MDXContent;\n\ninterface Options {\n scope?: Record<string, unknown>;\n baseUrl?: string | URL;\n jsxRuntime?: unknown;\n}\n\nconst AsyncFunction: new (...args: string[]) => (...args: unknown[]) => Promise<unknown> =\n Object.getPrototypeOf(executeMdx).constructor;\n\nasync function executeMdx(compiled: string, options: Options = {}) {\n const { opts: scopeOpts, ...scope } = options.scope ?? {};\n const fullScope = {\n opts: {\n ...(scopeOpts as object),\n ...(options.jsxRuntime as object),\n baseUrl: options.baseUrl,\n },\n ...scope,\n };\n\n const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);\n return (await hydrateFn.apply(hydrateFn, Object.values(fullScope))) as {\n default: MdxContent;\n };\n}\n\nexport type { WithGit } from \"./runtime\";\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAI;AAOJ,eAAsB,gBACpB,QACA,aACA,MACA,MACA,cACA,YAC2F;AAC3F,kBAAiB,YAAY;EAC3B,MAAM,OAAO,IAAI,KAAK,YAAY;AAClC,QAAM,KAAK,KAAK,EACN,QACT,CAAC;AACF,SAAO;KACL;CACJ,MAAM,OAAO,MAAM;CACnB,MAAM,cAAc;CACpB,MAAM,aAAa,KAAK,cAAc,KAAK;AAC3C,KAAI,CAAC,cAAc,EAAE,sBAAsB,eACzC,OAAM,IAAI,MAAM,0BAA0B;CAE5C,MAAM,SAAsF,EAAE;CAC9F,MAAM,QAAQ,aAAmE;AAEjF,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,QAAO,KAAK;EACV,IAAI;EACJ,aAAa;EACb,MAAM,UAAU;AACd,UAAO,MAAM,OAAO,GAAG,YAAY;IACjC,MAAM,WAAW,KAAK,KAAK,MAAM,EAAE;IACnC,IAAI,WAAW,MAAM,GAAG,SAAS,SAAS,EAAE,UAAU;AACtD,cAAU,WAAW,QAAQ,CAAC;IAE9B,MAAM,WAAW,MAAM,SAAS,MAAM,YAAY;KAChD;KACA,QAAQ;KACR,aAAa;KACb,eAAe;KACf,aAAa;KACd,CAAC;AAEF,WAAQ,MAAM,WAAW,OAAO,SAAS,MAAM,EAAE;KAC/C,SAAS,cAAc,SAAS;KAChC;KACD,CAAC;KACF;;EAEL;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO;;AAW9C,MAAM,gBACJ,OAAO,eAAe,WAAW,CAAC;AAEpC,eAAe,WAAW,UAAkB,UAAmB,EAAE,EAAE;CACjE,MAAM,EAAE,MAAM,WAAW,GAAG,UAAU,QAAQ,SAAS,EAAE;CACzD,MAAM,YAAY;EAChB,MAAM;GACJ,GAAI;GACJ,GAAI,QAAQ;GACZ,SAAS,QAAQ;GAClB;EACD,GAAG;EACJ;CAED,MAAM,YAAY,IAAI,cAAc,GAAG,OAAO,KAAK,UAAU,EAAE,SAAS;AACxE,QAAQ,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"runtime-dynamic.js","names":[],"sources":["../../../src/collections/mdx/runtime-dynamic.ts"],"sourcesContent":["import { buildMDX, type CompiledMDX } from \"@/collections/mdx/build-mdx\";\nimport { pathToFileURL } from \"node:url\";\nimport { fumaMatter } from \"@/collections/mdx/fuma-matter\";\nimport fs from \"node:fs/promises\";\nimport { type CoreOptions, Core } from \"@/core\";\nimport type { MDXContent } from \"mdx/types\";\nimport { FileCollectionStore } from \"@/collections/runtime/file-store\";\nimport type { GetCollectionConfig } from \"@/types\";\nimport { MDXCollection } from \"@/collections/mdx\";\nimport path from \"node:path\";\nimport { createCache } from \"@/utils/async-cache\";\n\nexport interface MDXStoreDynamicData<Frontmatter, Attached = unknown> {\n id: string;\n frontmatter: Frontmatter;\n compile: () => Promise<CompiledMDX<Frontmatter> & Attached>;\n}\n\nlet corePromise: Promise<Core>;\n\ntype GetFrontmatter<Config, Name extends string> =\n GetCollectionConfig<Config, Name> extends MDXCollection\n ? GetCollectionConfig<Config, Name>[\"$inferFrontmatter\"]\n : never;\n\nexport async function mdxStoreDynamic<Config, Name extends string, Attached>(\n config: Config,\n coreOptions: CoreOptions,\n name: Name,\n base: string,\n _frontmatter: Record<string, unknown>,\n jsxRuntime: unknown,\n): Promise<FileCollectionStore<MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>>> {\n corePromise ??= (async () => {\n const core = new Core(coreOptions);\n await core.init({\n config: config as Record<string, unknown>,\n });\n return core;\n })();\n const core = await corePromise;\n const frontmatter = _frontmatter as Record<string, GetFrontmatter<Config, Name>>;\n const collection = core.getCollection(name);\n if (!collection || !(collection instanceof MDXCollection))\n throw new Error(\"invalid collection name\");\n\n const merged: Record<string, MDXStoreDynamicData<GetFrontmatter<Config, Name>, Attached>> = {};\n const cache = createCache<CompiledMDX<GetFrontmatter<Config, Name>> & Attached>();\n\n for (const [k, v] of Object.entries(frontmatter)) {\n merged[k] = {\n id: k,\n frontmatter: v,\n async compile() {\n return cache.cached(k, async () => {\n const filePath = path.join(base, k);\n let content = (await fs.readFile(filePath)).toString();\n content = fumaMatter(content).content;\n\n const compiled = await buildMDX(core, collection, {\n filePath,\n source: content,\n frontmatter: v as unknown as Record<string, unknown>,\n isDevelopment: false,\n environment: \"runtime\",\n compiler: {\n collection,\n core,\n addDependency() {},\n },\n });\n\n return (await executeMdx(String(compiled.value), {\n baseUrl: pathToFileURL(filePath),\n jsxRuntime,\n })) as CompiledMDX<GetFrontmatter<Config, Name>> & Attached;\n });\n },\n };\n }\n\n return new FileCollectionStore(base, merged);\n}\n\nexport type MdxContent = MDXContent;\n\ninterface Options {\n scope?: Record<string, unknown>;\n baseUrl?: string | URL;\n jsxRuntime?: unknown;\n}\n\nconst AsyncFunction: new (...args: string[]) => (...args: unknown[]) => Promise<unknown> =\n Object.getPrototypeOf(executeMdx).constructor;\n\nasync function executeMdx(compiled: string, options: Options = {}) {\n const { opts: scopeOpts, ...scope } = options.scope ?? {};\n const fullScope = {\n opts: {\n ...(scopeOpts as object),\n ...(options.jsxRuntime as object),\n baseUrl: options.baseUrl,\n },\n ...scope,\n };\n\n const hydrateFn = new AsyncFunction(...Object.keys(fullScope), compiled);\n return (await hydrateFn.apply(hydrateFn, Object.values(fullScope))) as {\n default: MdxContent;\n };\n}\n\nexport type { WithGit } from \"./runtime\";\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAI;AAOJ,eAAsB,gBACpB,QACA,aACA,MACA,MACA,cACA,YAC2F;AAC3F,kBAAiB,YAAY;EAC3B,MAAM,OAAO,IAAI,KAAK,YAAY;AAClC,QAAM,KAAK,KAAK,EACN,QACT,CAAC;AACF,SAAO;KACL;CACJ,MAAM,OAAO,MAAM;CACnB,MAAM,cAAc;CACpB,MAAM,aAAa,KAAK,cAAc,KAAK;AAC3C,KAAI,CAAC,cAAc,EAAE,sBAAsB,eACzC,OAAM,IAAI,MAAM,0BAA0B;CAE5C,MAAM,SAAsF,EAAE;CAC9F,MAAM,QAAQ,aAAmE;AAEjF,MAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,YAAY,CAC9C,QAAO,KAAK;EACV,IAAI;EACJ,aAAa;EACb,MAAM,UAAU;AACd,UAAO,MAAM,OAAO,GAAG,YAAY;IACjC,MAAM,WAAW,KAAK,KAAK,MAAM,EAAE;IACnC,IAAI,WAAW,MAAM,GAAG,SAAS,SAAS,EAAE,UAAU;AACtD,cAAU,WAAW,QAAQ,CAAC;IAE9B,MAAM,WAAW,MAAM,SAAS,MAAM,YAAY;KAChD;KACA,QAAQ;KACR,aAAa;KACb,eAAe;KACf,aAAa;KACb,UAAU;MACR;MACA;MACA,gBAAgB;MACjB;KACF,CAAC;AAEF,WAAQ,MAAM,WAAW,OAAO,SAAS,MAAM,EAAE;KAC/C,SAAS,cAAc,SAAS;KAChC;KACD,CAAC;KACF;;EAEL;AAGH,QAAO,IAAI,oBAAoB,MAAM,OAAO;;AAW9C,MAAM,gBACJ,OAAO,eAAe,WAAW,CAAC;AAEpC,eAAe,WAAW,UAAkB,UAAmB,EAAE,EAAE;CACjE,MAAM,EAAE,MAAM,WAAW,GAAG,UAAU,QAAQ,SAAS,EAAE;CACzD,MAAM,YAAY;EAChB,MAAM;GACJ,GAAI;GACJ,GAAI,QAAQ;GACZ,SAAS,QAAQ;GAClB;EACD,GAAG;EACJ;CAED,MAAM,YAAY,IAAI,cAAc,GAAG,OAAO,KAAK,UAAU,EAAE,SAAS;AACxE,QAAQ,MAAM,UAAU,MAAM,WAAW,OAAO,OAAO,UAAU,CAAC"}
@@ -1,7 +1,6 @@
1
- import { C as GetCollectionConfig } from "../../core-CG2zTL4c.js";
2
- import "../../load-from-file-CpA8UQXX.js";
1
+ import { C as GetCollectionConfig } from "../../core-FjA_Xoho.js";
3
2
  import { FileCollectionStore } from "../runtime/file-store.js";
4
- import { t as CompiledMDX } from "../../build-mdx-DkAvzRNg.js";
3
+ import { t as CompiledMDX } from "../../build-mdx-DRqbcE1d.js";
5
4
  import { MDXCollection } from "../mdx.js";
6
5
  import { GitFileData } from "../../plugins/git.js";
7
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime.ts"],"mappings":";;;;;;;;UAOiB,YAAA;EACf,EAAA;EACA,QAAA,EAAU,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAGlC,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,iBAGlB,QAAA,uCAAA,CACd,KAAA,EAAO,IAAA,EACP,IAAA,UACA,MAAA,EAAQ,MAAA,oBACP,mBAAA,CAAoB,YAAA,CAAa,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,UAcjD,gBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,IAAA,QAAY,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,iBAGjC,YAAA,uCAAA,CACd,KAAA,EAAO,IAAA,EACP,IAAA,UACA,MAAA;EACE,IAAA,EAAM,MAAA;EACN,IAAA,EAAM,MAAA,eAAqB,OAAA;AAAA,IAE5B,mBAAA,CAAoB,gBAAA,CAAiB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,KAkB1D,OAAA,GAAU,WAAA"}
1
+ {"version":3,"file":"runtime.d.ts","names":[],"sources":["../../../src/collections/mdx/runtime.ts"],"mappings":";;;;;;;UAOiB,YAAA;EACf,EAAA;EACA,QAAA,EAAU,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,KAGlC,cAAA,gCACH,mBAAA,CAAoB,MAAA,EAAQ,IAAA,UAAc,aAAA,GACtC,mBAAA,CAAoB,MAAA,EAAQ,IAAA;AAAA,iBAGlB,QAAA,uCAAA,CACd,KAAA,EAAO,IAAA,EACP,IAAA,UACA,MAAA,EAAQ,MAAA,oBACP,mBAAA,CAAoB,YAAA,CAAa,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,UAcjD,gBAAA;EACf,EAAA;EACA,WAAA,EAAa,WAAA;EACb,IAAA,QAAY,OAAA,CAAQ,WAAA,CAAY,WAAA,IAAe,QAAA;AAAA;AAAA,iBAGjC,YAAA,uCAAA,CACd,KAAA,EAAO,IAAA,EACP,IAAA,UACA,MAAA;EACE,IAAA,EAAM,MAAA;EACN,IAAA,EAAM,MAAA,eAAqB,OAAA;AAAA,IAE5B,mBAAA,CAAoB,gBAAA,CAAiB,cAAA,CAAe,MAAA,EAAQ,IAAA,GAAO,QAAA;AAAA,KAkB1D,OAAA,GAAU,WAAA"}
@@ -1,8 +1,7 @@
1
- import { S as Awaitable, h as Pipe, m as AsyncPipe, p as CodeGenerator } from "../core-CG2zTL4c.js";
1
+ import { S as Awaitable, h as Pipe, m as AsyncPipe, p as CodeGenerator } from "../core-FjA_Xoho.js";
2
2
  import { Collection } from "./index.js";
3
- import "../load-from-file-CpA8UQXX.js";
4
3
  import { FileSystemCollection, FileSystemCollectionConfig } from "./fs.js";
5
- import { n as LinkReference, r as PostprocessOptions, t as CompiledMDX } from "../build-mdx-DkAvzRNg.js";
4
+ import { n as LinkReference, r as PostprocessOptions, t as CompiledMDX } from "../build-mdx-DRqbcE1d.js";
6
5
  import { ProcessorOptions } from "@mdx-js/mdx";
7
6
  import { VFile } from "vfile";
8
7
  import { PluggableList } from "unified";
@@ -1 +1 @@
1
- {"version":3,"file":"mdx.d.ts","names":[],"sources":["../../src/collections/mdx.ts"],"mappings":";;;;;;;;;;;UAkBU,kBAAA;EACR,UAAA,EAAY,UAAA;EACZ,QAAA;EACA,MAAA;AAAA;AAAA,UAGe,mBAAA,2BACW,gBAAA,sBAClB,IAAA,CAAK,0BAAA;EACb,WAAA,GAAc,OAAA,CAAQ,kBAAA;EACtB,UAAA,GAAa,iBAAA;EACb,WAAA,GAAc,iBAAA;EACd,OAAA,IAAW,WAAA,4BAAuC,SAAA,CAAU,gBAAA;EAC5D,IAAA;EACA,OAAA;AAAA;AAAA,UAGQ,iBAAA;EACR,aAAA,GAAgB,aAAA;AAAA;AAAA,UASR,eAAA;EACR,EAAA;EACA,UAAA,GAAa,MAAA,UAAgB,IAAA,UAAc,QAAA;EAC3C,MAAA;AAAA;AAAA,cAOW,aAAA,2BACe,gBAAA,eAA+B,gBAAA,sBACjD,oBAAA;EAAA;WACC,OAAA;EAAA,SACA,IAAA;EAAA,SACA,UAAA,GAAa,iBAAA;EAAA,SACb,WAAA,GAAc,OAAA,CAAQ,kBAAA;EAAA,SACtB,aAAA,IAAiB,WAAA,4BAAuC,SAAA,CAAU,gBAAA;EApCnE;;;EAwCR,iBAAA,GAAoB,iBAAA;EAvCE;;;EA2CtB,WAAA,EAAW,SAAA,CAAA,MAAA,+BAAA,kBAAA;EAzCG;;;EA6Cd,KAAA,EAAK,SAAA,CAAA,KAAA,EAAA,kBAAA;EA5CuD;;;EAgD5D,gBAAA,EAG0B,IAAA,C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