fuma-content 1.2.3 → 1.4.0

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 (165) hide show
  1. package/dist/async-cache-C47yxLCv.js +0 -2
  2. package/dist/async-cache-svlxyp4V.d.ts +10 -0
  3. package/dist/bin.js +0 -2
  4. package/dist/{build-mdx-C8u32vDa.js → build-mdx-DRJ7dZuq.js} +1 -3
  5. package/dist/bun/index.d.ts +1 -2
  6. package/dist/bun/index.js +1 -3
  7. package/dist/bun-NahDFkhR.js +0 -2
  8. package/dist/code-generator-DFGEY6P5.js +0 -2
  9. package/dist/collections/comark/loader-webpack.d.ts +6 -0
  10. package/dist/collections/comark/loader-webpack.js +6 -0
  11. package/dist/collections/comark/runtime-browser.d.ts +24 -0
  12. package/dist/collections/comark/runtime-browser.js +27 -0
  13. package/dist/collections/comark/runtime.d.ts +27 -0
  14. package/dist/collections/comark/runtime.js +23 -0
  15. package/dist/collections/comark.d.ts +40 -0
  16. package/dist/collections/comark.js +202 -0
  17. package/dist/collections/data/runtime.d.ts +2 -3
  18. package/dist/collections/data/runtime.js +0 -2
  19. package/dist/collections/data.d.ts +3 -4
  20. package/dist/collections/data.js +0 -2
  21. package/dist/collections/fs.d.ts +1 -1
  22. package/dist/collections/fs.js +0 -2
  23. package/dist/collections/json/loader-webpack.d.ts +2 -3
  24. package/dist/collections/json/loader-webpack.js +0 -4
  25. package/dist/collections/mdx/loader-webpack.d.ts +2 -3
  26. package/dist/collections/mdx/loader-webpack.js +1 -5
  27. package/dist/collections/mdx/react.d.ts +3 -4
  28. package/dist/collections/mdx/react.js +0 -2
  29. package/dist/collections/mdx/runtime-browser.d.ts +2 -2
  30. package/dist/collections/mdx/runtime-browser.js +0 -2
  31. package/dist/collections/mdx/runtime-dynamic.d.ts +4 -5
  32. package/dist/collections/mdx/runtime-dynamic.js +4 -7
  33. package/dist/collections/mdx/runtime.d.ts +1 -1
  34. package/dist/collections/mdx/runtime.js +0 -2
  35. package/dist/collections/mdx/vue.d.ts +7 -8
  36. package/dist/collections/mdx/vue.js +0 -2
  37. package/dist/collections/mdx.d.ts +1 -1
  38. package/dist/collections/mdx.js +1 -3
  39. package/dist/collections/obsidian.d.ts +2 -3
  40. package/dist/collections/obsidian.js +3 -6
  41. package/dist/collections/runtime/file-store.d.ts +1 -1
  42. package/dist/collections/runtime/file-store.js +0 -2
  43. package/dist/collections/runtime/store.js +0 -2
  44. package/dist/collections/yaml/loader-webpack.d.ts +2 -3
  45. package/dist/collections/yaml/loader-webpack.js +0 -4
  46. package/dist/collections-Bl9hpWMS.js +0 -2
  47. package/dist/config/index.js +0 -2
  48. package/dist/core-BbTeLenA.d.ts +1 -2
  49. package/dist/{core-CrYszxmc.js → core-Cgc-cdSx.js} +11 -12
  50. package/dist/{dynamic-CNEaikCN.d.ts → dynamic-CO84t8d3.d.ts} +1 -2
  51. package/dist/dynamic.d.ts +1 -1
  52. package/dist/dynamic.js +1 -3
  53. package/dist/{file-store-DutRtol_.d.ts → file-store-D5nKTMSL.d.ts} +1 -2
  54. package/dist/{flatten-m0wfHxLH.js → flatten-Db7WzTB7.js} +0 -2
  55. package/dist/{fs-KJjb32Nq.d.ts → fs-_EGvbkVM.d.ts} +1 -2
  56. package/dist/git-BxnPg5Ao.d.ts +1 -2
  57. package/dist/index.d.ts +1 -2
  58. package/dist/index.js +1 -1
  59. package/dist/is-promise-like-C04ERo2r.js +0 -2
  60. package/dist/{load-from-file-C3CnD8mJ.js → load-from-file-DpW8who8.js} +0 -2
  61. package/dist/{loader-CyhM9SLt.js → loader-9KbB2Twu.js} +8 -7
  62. package/dist/loader-D_sKOzDc.js +0 -2
  63. package/dist/loader-DjDk5eLt.js +51 -0
  64. package/dist/loader-e2SkeDfY.js +0 -2
  65. package/dist/loader-ol04zeoP.js +0 -2
  66. package/dist/{mdx-L0I8mePE.d.ts → mdx-CkXj06oG.d.ts} +2 -3
  67. package/dist/next/index.d.ts +1 -2
  68. package/dist/next/index.js +2 -4
  69. package/dist/node/index.d.ts +1 -2
  70. package/dist/node/index.js +0 -2
  71. package/dist/node/loader.d.ts +1 -2
  72. package/dist/node/loader.js +1 -3
  73. package/dist/{node-Du4i4XDg.js → node-XtGkkaiN.js} +4 -6
  74. package/dist/plugins/git.js +0 -2
  75. package/dist/plugins/json-schema.d.ts +1 -2
  76. package/dist/plugins/json-schema.js +0 -2
  77. package/dist/plugins/loader/index.d.ts +1 -1
  78. package/dist/plugins/loader/index.js +1 -3
  79. package/dist/plugins/loader/webpack.d.ts +1 -1
  80. package/dist/plugins/loader/webpack.js +1 -3
  81. package/dist/plugins/remark/include.d.ts +1 -2
  82. package/dist/plugins/remark/include.js +4 -5
  83. package/dist/{runtime-TETi5Giq.d.ts → runtime-5EdZjL1e.d.ts} +3 -4
  84. package/dist/{runtime-browser-M4sE6SmL.d.ts → runtime-browser-BI2h1vjc.d.ts} +3 -11
  85. package/dist/store-BC3n1VPY.d.ts +1 -2
  86. package/dist/utils/frontmatter.d.ts +15 -0
  87. package/dist/{fuma-matter-E30PU53R.js → utils/frontmatter.js} +3 -5
  88. package/dist/validation-Bf_v2L3p.js +0 -2
  89. package/dist/vite/index.d.ts +1 -2
  90. package/dist/vite/index.js +2 -4
  91. package/dist/vite-DVIOnBqW.js +0 -2
  92. package/dist/{index-DVqrqxzl.d.ts → webpack-C8ABoMB_.d.ts} +15 -16
  93. package/package.json +29 -20
  94. package/dist/async-cache-C47yxLCv.js.map +0 -1
  95. package/dist/bin.js.map +0 -1
  96. package/dist/build-mdx-C8u32vDa.js.map +0 -1
  97. package/dist/bun/index.d.ts.map +0 -1
  98. package/dist/bun/index.js.map +0 -1
  99. package/dist/bun-NahDFkhR.js.map +0 -1
  100. package/dist/code-generator-DFGEY6P5.js.map +0 -1
  101. package/dist/collections/data/runtime.d.ts.map +0 -1
  102. package/dist/collections/data/runtime.js.map +0 -1
  103. package/dist/collections/data.d.ts.map +0 -1
  104. package/dist/collections/data.js.map +0 -1
  105. package/dist/collections/fs.js.map +0 -1
  106. package/dist/collections/json/loader-webpack.d.ts.map +0 -1
  107. package/dist/collections/json/loader-webpack.js.map +0 -1
  108. package/dist/collections/mdx/loader-webpack.d.ts.map +0 -1
  109. package/dist/collections/mdx/loader-webpack.js.map +0 -1
  110. package/dist/collections/mdx/react.d.ts.map +0 -1
  111. package/dist/collections/mdx/react.js.map +0 -1
  112. package/dist/collections/mdx/runtime-browser.js.map +0 -1
  113. package/dist/collections/mdx/runtime-dynamic.d.ts.map +0 -1
  114. package/dist/collections/mdx/runtime-dynamic.js.map +0 -1
  115. package/dist/collections/mdx/runtime.js.map +0 -1
  116. package/dist/collections/mdx/vue.d.ts.map +0 -1
  117. package/dist/collections/mdx/vue.js.map +0 -1
  118. package/dist/collections/mdx.js.map +0 -1
  119. package/dist/collections/obsidian.d.ts.map +0 -1
  120. package/dist/collections/obsidian.js.map +0 -1
  121. package/dist/collections/runtime/file-store.js.map +0 -1
  122. package/dist/collections/runtime/store.js.map +0 -1
  123. package/dist/collections/yaml/loader-webpack.d.ts.map +0 -1
  124. package/dist/collections/yaml/loader-webpack.js.map +0 -1
  125. package/dist/collections-Bl9hpWMS.js.map +0 -1
  126. package/dist/config/index.js.map +0 -1
  127. package/dist/core-BbTeLenA.d.ts.map +0 -1
  128. package/dist/core-CrYszxmc.js.map +0 -1
  129. package/dist/dynamic-CNEaikCN.d.ts.map +0 -1
  130. package/dist/dynamic.js.map +0 -1
  131. package/dist/file-store-DutRtol_.d.ts.map +0 -1
  132. package/dist/flatten-m0wfHxLH.js.map +0 -1
  133. package/dist/fs-KJjb32Nq.d.ts.map +0 -1
  134. package/dist/fuma-matter-E30PU53R.js.map +0 -1
  135. package/dist/git-BxnPg5Ao.d.ts.map +0 -1
  136. package/dist/index-DVqrqxzl.d.ts.map +0 -1
  137. package/dist/index.d.ts.map +0 -1
  138. package/dist/is-promise-like-C04ERo2r.js.map +0 -1
  139. package/dist/load-from-file-C3CnD8mJ.js.map +0 -1
  140. package/dist/loader-CyhM9SLt.js.map +0 -1
  141. package/dist/loader-D_sKOzDc.js.map +0 -1
  142. package/dist/loader-e2SkeDfY.js.map +0 -1
  143. package/dist/loader-ol04zeoP.js.map +0 -1
  144. package/dist/mdx-L0I8mePE.d.ts.map +0 -1
  145. package/dist/next/index.d.ts.map +0 -1
  146. package/dist/next/index.js.map +0 -1
  147. package/dist/node/index.d.ts.map +0 -1
  148. package/dist/node/index.js.map +0 -1
  149. package/dist/node/loader.d.ts.map +0 -1
  150. package/dist/node/loader.js.map +0 -1
  151. package/dist/node-Du4i4XDg.js.map +0 -1
  152. package/dist/plugins/git.js.map +0 -1
  153. package/dist/plugins/json-schema.d.ts.map +0 -1
  154. package/dist/plugins/json-schema.js.map +0 -1
  155. package/dist/plugins/loader/index.js.map +0 -1
  156. package/dist/plugins/loader/webpack.js.map +0 -1
  157. package/dist/plugins/remark/include.d.ts.map +0 -1
  158. package/dist/plugins/remark/include.js.map +0 -1
  159. package/dist/runtime-TETi5Giq.d.ts.map +0 -1
  160. package/dist/runtime-browser-M4sE6SmL.d.ts.map +0 -1
  161. package/dist/store-BC3n1VPY.d.ts.map +0 -1
  162. package/dist/validation-Bf_v2L3p.js.map +0 -1
  163. package/dist/vite/index.d.ts.map +0 -1
  164. package/dist/vite/index.js.map +0 -1
  165. package/dist/vite-DVIOnBqW.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { i as CompiledMDX } from "../../mdx-L0I8mePE.js";
2
- import { t as MDXStoreBrowserData } from "../../runtime-browser-M4sE6SmL.js";
3
- import * as vue from "vue";
1
+ import { i as CompiledMDX } from "../../mdx-CkXj06oG.js";
2
+ import { t as MDXStoreBrowserData } from "../../runtime-browser-BI2h1vjc.js";
3
+ import * as _$vue from "vue";
4
4
 
5
5
  //#region src/collections/mdx/vue.vue.d.ts
6
6
  declare const __VLS_export: <Frontmatter, Attached = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
7
- props: vue.PublicProps & __VLS_PrettifyLocal<{
7
+ props: _$vue.PublicProps & __VLS_PrettifyLocal<{
8
8
  entry?: MDXStoreBrowserData<Frontmatter, Attached>;
9
9
  }> & (typeof globalThis extends {
10
10
  __VLS_PROPS_FALLBACK: infer P;
@@ -17,11 +17,10 @@ declare const __VLS_export: <Frontmatter, Attached = unknown>(__VLS_props: NonNu
17
17
  }) => any;
18
18
  };
19
19
  emit: {};
20
- }>) => vue.VNode & {
20
+ }>) => _$vue.VNode & {
21
21
  __ctx?: Awaited<typeof __VLS_setup>;
22
22
  };
23
23
  declare const _default: typeof __VLS_export;
24
- type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {}; //# sourceMappingURL=vue.vue.d.ts.map
24
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K] } : { [K in keyof T as K]: T[K] }) & {};
25
25
  //#endregion
26
- export { _default as Vue };
27
- //# sourceMappingURL=vue.d.ts.map
26
+ export { _default as Vue };
@@ -30,5 +30,3 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  });
31
31
  //#endregion
32
32
  export { _sfc_main as Vue };
33
-
34
- //# sourceMappingURL=vue.js.map
@@ -1,2 +1,2 @@
1
- import { a as LinkReference, i as CompiledMDX, n as MDXCollectionConfig, r as mdxCollection, t as MDXCollection } from "../mdx-L0I8mePE.js";
1
+ import { a as LinkReference, i as CompiledMDX, n as MDXCollectionConfig, r as mdxCollection, t as MDXCollection } from "../mdx-CkXj06oG.js";
2
2
  export { CompiledMDX, LinkReference, MDXCollection, MDXCollectionConfig, mdxCollection };
@@ -312,12 +312,10 @@ function mdxLoader() {
312
312
  };
313
313
  },
314
314
  async createLoader() {
315
- const { createMdxLoader } = await import("../loader-CyhM9SLt.js").then((n) => n.n);
315
+ const { createMdxLoader } = await import("../loader-9KbB2Twu.js").then((n) => n.n);
316
316
  return createMdxLoader({ getCore: () => this.core });
317
317
  }
318
318
  };
319
319
  }
320
320
  //#endregion
321
321
  export { MDXCollection, mdxCollection };
322
-
323
- //# sourceMappingURL=mdx.js.map
@@ -1,9 +1,8 @@
1
- import { n as MDXCollectionConfig, t as MDXCollection } from "../mdx-L0I8mePE.js";
1
+ import { n as MDXCollectionConfig, t as MDXCollection } from "../mdx-CkXj06oG.js";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/collections/obsidian.d.ts
5
5
  type MDXObsidianCollectionConfig<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined> = MDXCollectionConfig<FrontmatterSchema>;
6
6
  declare function mdxObsidianCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(config: MDXObsidianCollectionConfig<FrontmatterSchema>): MDXCollection<FrontmatterSchema>;
7
7
  //#endregion
8
- export { MDXObsidianCollectionConfig, mdxObsidianCollection };
9
- //# sourceMappingURL=obsidian.d.ts.map
8
+ export { MDXObsidianCollectionConfig, mdxObsidianCollection };
@@ -1,8 +1,7 @@
1
1
  import { n as slash } from "../code-generator-DFGEY6P5.js";
2
- import "../validation-Bf_v2L3p.js";
3
2
  import { MDXCollection, mdxCollection } from "./mdx.js";
4
- import { t as fumaMatter } from "../fuma-matter-E30PU53R.js";
5
- import { t as flattenNode } from "../flatten-m0wfHxLH.js";
3
+ import { parseFrontmatter } from "../utils/frontmatter.js";
4
+ import { t as flattenNode } from "../flatten-Db7WzTB7.js";
6
5
  import { remarkInclude } from "../plugins/remark/include.js";
7
6
  import { readFile } from "node:fs/promises";
8
7
  import path from "node:path";
@@ -47,7 +46,7 @@ async function buildStorage(options) {
47
46
  case ".md":
48
47
  case ".mdx": {
49
48
  const rawContent = await raw.read();
50
- const { data, content } = fumaMatter(rawContent);
49
+ const { data, content } = parseFrontmatter(rawContent);
51
50
  if (enforceMdx) outPath = outPath.slice(0, -path.extname(outPath).length) + ".mdx";
52
51
  parsed = {
53
52
  format: "content",
@@ -534,5 +533,3 @@ function mdxObsidianCollection(config) {
534
533
  }
535
534
  //#endregion
536
535
  export { mdxObsidianCollection };
537
-
538
- //# sourceMappingURL=obsidian.js.map
@@ -1,2 +1,2 @@
1
- import { n as FileInfo, t as FileCollectionStore } from "../../file-store-DutRtol_.js";
1
+ import { n as FileInfo, t as FileCollectionStore } from "../../file-store-D5nKTMSL.js";
2
2
  export { FileCollectionStore, FileInfo };
@@ -24,5 +24,3 @@ var FileCollectionStore = class extends MapCollectionStore {
24
24
  };
25
25
  //#endregion
26
26
  export { FileCollectionStore };
27
-
28
- //# sourceMappingURL=file-store.js.map
@@ -30,5 +30,3 @@ var MapCollectionStore = class MapCollectionStore {
30
30
  };
31
31
  //#endregion
32
32
  export { MapCollectionStore };
33
-
34
- //# sourceMappingURL=store.js.map
@@ -1,7 +1,6 @@
1
- import { c as WebpackLoader } from "../../index-DVqrqxzl.js";
1
+ import { t as WebpackLoader } from "../../webpack-C8ABoMB_.js";
2
2
 
3
3
  //#region src/collections/yaml/loader-webpack.d.ts
4
4
  declare const _default: WebpackLoader;
5
5
  //#endregion
6
- export { _default as default };
7
- //# sourceMappingURL=loader-webpack.d.ts.map
6
+ export { _default as default };
@@ -1,10 +1,6 @@
1
- import "../../validation-Bf_v2L3p.js";
2
1
  import { createWebpackLoader } from "../../plugins/loader/webpack.js";
3
- import "../../loader-ol04zeoP.js";
4
2
  import { t as createYamlLoader } from "../../loader-D_sKOzDc.js";
5
3
  //#region src/collections/yaml/loader-webpack.ts
6
4
  var loader_webpack_default = createWebpackLoader((core) => createYamlLoader(core));
7
5
  //#endregion
8
6
  export { loader_webpack_default as default };
9
-
10
- //# sourceMappingURL=loader-webpack.js.map
@@ -90,5 +90,3 @@ function defineCollectionHook(...args) {
90
90
  }
91
91
  //#endregion
92
92
  export { asyncHook as a, pipe as i, defineCollectionHook as n, hook as o, asyncPipe as r, Collection as t };
93
-
94
- //# sourceMappingURL=collections-Bl9hpWMS.js.map
@@ -4,5 +4,3 @@ function defineConfig(config = {}) {
4
4
  }
5
5
  //#endregion
6
6
  export { defineConfig };
7
-
8
- //# sourceMappingURL=index.js.map
@@ -311,5 +311,4 @@ declare class Core {
311
311
  private initConfig;
312
312
  }
313
313
  //#endregion
314
- export { GlobalConfig as A, Hook as C, GetCollectionConfig as D, Awaitable as E, defineConfig as M, CollectionsPack as O, AsyncHook as S, hook as T, defineCollectionHook as _, EmitOptions as a, asyncPipe as b, PluginContext as c, ResolvedCoreOptions as d, ServerContext as f, CollectionHookContext as g, CollectionHook as h, EmitEntry as i, WorkspaceConfig as j, EmitConfig as k, PluginOption$1 as l, Collection as m, CoreOptions as n, EmitOutput as o, CodeGenerator as p, EmitContext as r, Plugin as s, Core as t, ResolvedConfig as u, AsyncPipe as v, asyncHook as w, pipe as x, Pipe as y };
315
- //# sourceMappingURL=core-BbTeLenA.d.ts.map
314
+ export { GlobalConfig as A, Hook as C, GetCollectionConfig as D, Awaitable as E, defineConfig as M, CollectionsPack as O, AsyncHook as S, hook as T, defineCollectionHook as _, EmitOptions as a, asyncPipe as b, PluginContext as c, ResolvedCoreOptions as d, ServerContext as f, CollectionHookContext as g, CollectionHook as h, EmitEntry as i, WorkspaceConfig as j, EmitConfig as k, PluginOption$1 as l, Collection as m, CoreOptions as n, EmitOutput as o, CodeGenerator as p, EmitContext as r, Plugin as s, Core as t, ResolvedConfig as u, AsyncPipe as v, asyncHook as w, pipe as x, Pipe as y };
@@ -186,16 +186,17 @@ var Core = class Core {
186
186
  }
187
187
  async initConfig(config) {
188
188
  const collections = /* @__PURE__ */ new Map();
189
- let globalConfig;
190
- if ("default" in config) {
191
- globalConfig = config.default;
192
- for (const [k, v] of Object.entries(config)) if (v instanceof Collection) {
193
- globalConfig.collections ??= {};
194
- globalConfig.collections[k] = v;
195
- }
196
- } else globalConfig = config;
197
- globalConfig.collections ??= {};
198
- const pendingCollections = new Map(Object.entries(globalConfig.collections));
189
+ const globalConfig = {};
190
+ for (const [k, v] of Object.entries(config)) if (v instanceof Collection) {
191
+ globalConfig.collections ??= {};
192
+ globalConfig.collections[k] = v;
193
+ } else if (k === "default") {
194
+ const { collections, ...rest } = v;
195
+ globalConfig.collections ??= {};
196
+ Object.assign(globalConfig, rest);
197
+ Object.assign(globalConfig.collections, collections);
198
+ } else globalConfig[k] = v;
199
+ const pendingCollections = new Map(globalConfig.collections ? Object.entries(globalConfig.collections) : void 0);
199
200
  while (pendingCollections.size > 0) {
200
201
  const entries = Array.from(pendingCollections.entries());
201
202
  pendingCollections.clear();
@@ -216,5 +217,3 @@ var Core = class Core {
216
217
  };
217
218
  //#endregion
218
219
  export { Core as t };
219
-
220
- //# sourceMappingURL=core-CrYszxmc.js.map
@@ -28,5 +28,4 @@ declare function createDynamicCore({
28
28
  mode: "dev" | "production";
29
29
  }): DynamicCore;
30
30
  //#endregion
31
- export { createDynamicCore as n, DynamicCore as t };
32
- //# sourceMappingURL=dynamic-CNEaikCN.d.ts.map
31
+ export { createDynamicCore as n, DynamicCore as t };
package/dist/dynamic.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createDynamicCore, t as DynamicCore } from "./dynamic-CNEaikCN.js";
1
+ import { n as createDynamicCore, t as DynamicCore } from "./dynamic-CO84t8d3.js";
2
2
  export { DynamicCore, createDynamicCore };
package/dist/dynamic.js CHANGED
@@ -9,7 +9,7 @@ function createDynamicCore({ core, compileMode = true, mode }) {
9
9
  })).mtime.getTime().toString();
10
10
  }
11
11
  async function init() {
12
- const { loadConfig } = await import("./load-from-file-C3CnD8mJ.js").then((n) => n.n);
12
+ const { loadConfig } = await import("./load-from-file-DpW8who8.js").then((n) => n.n);
13
13
  await core.init({ config: loadConfig(core, compileMode) });
14
14
  }
15
15
  return { async getCore() {
@@ -24,5 +24,3 @@ function createDynamicCore({ core, compileMode = true, mode }) {
24
24
  }
25
25
  //#endregion
26
26
  export { createDynamicCore };
27
-
28
- //# sourceMappingURL=dynamic.js.map
@@ -16,5 +16,4 @@ declare class FileCollectionStore<V> extends MapCollectionStore<string, FileInfo
16
16
  castData<T>(_cast: (input: FileInfo & V) => FileInfo & T): FileCollectionStore<T>;
17
17
  }
18
18
  //#endregion
19
- export { FileInfo as n, FileCollectionStore as t };
20
- //# sourceMappingURL=file-store-DutRtol_.d.ts.map
19
+ export { FileInfo as n, FileCollectionStore as t };
@@ -6,5 +6,3 @@ function flattenNode(node) {
6
6
  }
7
7
  //#endregion
8
8
  export { flattenNode as t };
9
-
10
- //# sourceMappingURL=flatten-m0wfHxLH.js.map
@@ -37,5 +37,4 @@ interface FileSystemCollectionConfig {
37
37
  }
38
38
  declare function fileSystemCollection(config: FileSystemCollectionConfig): FileSystemCollection;
39
39
  //#endregion
40
- export { FileSystemCollectionConfig as n, fileSystemCollection as r, FileSystemCollection as t };
41
- //# sourceMappingURL=fs-KJjb32Nq.d.ts.map
40
+ export { FileSystemCollectionConfig as n, fileSystemCollection as r, FileSystemCollection as t };
@@ -33,5 +33,4 @@ interface GitClient {
33
33
  }) => Promise<GitFileData>;
34
34
  }
35
35
  //#endregion
36
- export { gitHook as a, git as i, GitFileData as n, GitHook as r, GitClient as t };
37
- //# sourceMappingURL=git-BxnPg5Ao.d.ts.map
36
+ export { gitHook as a, git as i, GitFileData as n, GitHook as r, GitClient as t };
package/dist/index.d.ts CHANGED
@@ -14,5 +14,4 @@ declare function validate<Schema extends StandardSchemaV1, Context>(schema: Stan
14
14
  */
15
15
  declare function getJSONSchema(schema: StandardSchemaV1): Record<string, unknown> | undefined;
16
16
  //#endregion
17
- export { AsyncHook, AsyncPipe, Core, CoreOptions, EmitContext, EmitEntry, EmitOptions, EmitOutput, type GetCollectionConfig, Hook, Pipe, Plugin, PluginContext, PluginOption, ResolvedConfig, ResolvedCoreOptions, ServerContext, ValidationError, asyncHook, asyncPipe, getJSONSchema, hook, pipe, validate };
18
- //# sourceMappingURL=index.d.ts.map
17
+ export { AsyncHook, AsyncPipe, Core, CoreOptions, EmitContext, EmitEntry, EmitOptions, EmitOutput, type GetCollectionConfig, Hook, Pipe, Plugin, PluginContext, PluginOption, ResolvedConfig, ResolvedCoreOptions, ServerContext, ValidationError, asyncHook, asyncPipe, getJSONSchema, hook, pipe, validate };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as asyncHook, i as pipe, o as hook, r as asyncPipe } from "./collections-Bl9hpWMS.js";
2
- import { t as Core } from "./core-CrYszxmc.js";
2
+ import { t as Core } from "./core-Cgc-cdSx.js";
3
3
  import { n as getJSONSchema, r as validate, t as ValidationError } from "./validation-Bf_v2L3p.js";
4
4
  export { Core, ValidationError, asyncHook, asyncPipe, getJSONSchema, hook, pipe, validate };
@@ -4,5 +4,3 @@ function isPromiseLike(v) {
4
4
  }
5
5
  //#endregion
6
6
  export { isPromiseLike as t };
7
-
8
- //# sourceMappingURL=is-promise-like-C04ERo2r.js.map
@@ -32,5 +32,3 @@ async function loadConfig(core, compileMode) {
32
32
  }
33
33
  //#endregion
34
34
  export { load_from_file_exports as n, loadConfig as t };
35
-
36
- //# sourceMappingURL=load-from-file-C3CnD8mJ.js.map
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
2
2
  import { MDXCollection } from "./collections/mdx.js";
3
- import { t as fumaMatter } from "./fuma-matter-E30PU53R.js";
3
+ import { parseFrontmatter } from "./utils/frontmatter.js";
4
4
  import fs from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
@@ -21,9 +21,14 @@ function createMdxLoader({ getCore }) {
21
21
  return { async load({ getSource, development: isDevelopment, query, addDependency, filePath }) {
22
22
  let core = await getCore();
23
23
  const value = await getSource();
24
- const matter = fumaMatter(value);
24
+ const matter = parseFrontmatter(value);
25
25
  const { collection: collectionName, workspace, only } = querySchema.parse(query);
26
26
  if (workspace) core = core.getWorkspaces().get(workspace) ?? core;
27
+ let collection = collectionName ? core.getCollection(collectionName) : void 0;
28
+ if (!(collection instanceof MDXCollection)) {
29
+ if (collectionName) return null;
30
+ collection = void 0;
31
+ }
27
32
  let after;
28
33
  const { experimentalBuildCache = false } = core.getConfig();
29
34
  if (!isDevelopment && experimentalBuildCache) {
@@ -39,8 +44,6 @@ function createMdxLoader({ getCore }) {
39
44
  }));
40
45
  };
41
46
  }
42
- let collection = collectionName ? core.getCollection(collectionName) : void 0;
43
- if (!(collection instanceof MDXCollection)) collection = void 0;
44
47
  if (collection?.frontmatter) matter.data = await collection.frontmatter.run(matter.data, {
45
48
  collection,
46
49
  filePath,
@@ -51,7 +54,7 @@ function createMdxLoader({ getCore }) {
51
54
  map: null
52
55
  };
53
56
  const lineOffset = isDevelopment ? countLines(matter.matter) : 0;
54
- const { buildMDX } = await import("./build-mdx-C8u32vDa.js").then((n) => n.n);
57
+ const { buildMDX } = await import("./build-mdx-DRJ7dZuq.js").then((n) => n.n);
55
58
  const compiled = await buildMDX({
56
59
  core,
57
60
  collection,
@@ -84,5 +87,3 @@ function countLines(s) {
84
87
  }
85
88
  //#endregion
86
89
  export { loader_exports as n, createMdxLoader as t };
87
-
88
- //# sourceMappingURL=loader-CyhM9SLt.js.map
@@ -14,5 +14,3 @@ function createYamlLoader(core) {
14
14
  }
15
15
  //#endregion
16
16
  export { loader_exports as n, createYamlLoader as t };
17
-
18
- //# sourceMappingURL=loader-D_sKOzDc.js.map
@@ -0,0 +1,51 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-CiIaOW0V.js";
2
+ import { ComarkCollection } from "./collections/comark.js";
3
+ import { parseFrontmatter } from "./utils/frontmatter.js";
4
+ import { z } from "zod";
5
+ //#region src/collections/comark/loader.ts
6
+ var loader_exports = /* @__PURE__ */ __exportAll({ createComarkLoader: () => createComarkLoader });
7
+ const querySchema = z.object({
8
+ only: z.literal(["frontmatter", "all"]).default("all"),
9
+ collection: z.string().optional(),
10
+ workspace: z.string().optional()
11
+ }).loose();
12
+ function createComarkLoader({ getCore }) {
13
+ return { async load({ getSource, query, filePath }) {
14
+ let core = await getCore();
15
+ const value = await getSource();
16
+ const matter = parseFrontmatter(value);
17
+ const { collection: collectionName, workspace, only } = querySchema.parse(query);
18
+ if (workspace) core = core.getWorkspaces().get(workspace) ?? core;
19
+ let collection = collectionName ? core.getCollection(collectionName) : void 0;
20
+ if (!(collection instanceof ComarkCollection)) {
21
+ if (collectionName) return null;
22
+ collection = void 0;
23
+ }
24
+ if (collection?.frontmatter) matter.data = await collection.frontmatter.run(matter.data, {
25
+ collection,
26
+ filePath,
27
+ source: value
28
+ });
29
+ if (only === "frontmatter") return {
30
+ code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
31
+ map: null
32
+ };
33
+ const { parse } = await import("comark");
34
+ let tree = await parse(value, await collection?.getComarkOptions("bundler"));
35
+ tree.frontmatter = matter.data;
36
+ if (collection?.tree) tree = await collection.tree.run(tree, {
37
+ collection,
38
+ filePath,
39
+ source: value
40
+ });
41
+ const serialized = JSON.stringify(tree);
42
+ return {
43
+ code: `export const frontmatter = ${JSON.stringify(tree.frontmatter)};
44
+ export const tree = ${serialized};
45
+ export default tree;`,
46
+ map: null
47
+ };
48
+ } };
49
+ }
50
+ //#endregion
51
+ export { loader_exports as n, createComarkLoader as t };
@@ -13,5 +13,3 @@ function createJsonLoader(core, resolveJson = "js") {
13
13
  }
14
14
  //#endregion
15
15
  export { loader_exports as n, createJsonLoader as t };
16
-
17
- //# sourceMappingURL=loader-e2SkeDfY.js.map
@@ -54,5 +54,3 @@ function createDataLoader({ getCore }, parse, moduleType = "js") {
54
54
  }
55
55
  //#endregion
56
56
  export { createDataLoader as t };
57
-
58
- //# sourceMappingURL=loader-ol04zeoP.js.map
@@ -1,5 +1,5 @@
1
1
  import { E as Awaitable, m as Collection, p as CodeGenerator, t as Core, v as AsyncPipe, y as Pipe } from "./core-BbTeLenA.js";
2
- import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-KJjb32Nq.js";
2
+ import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-_EGvbkVM.js";
3
3
  import { VFile } from "vfile";
4
4
  import { ProcessorOptions, createProcessor } from "@mdx-js/mdx";
5
5
  import { StandardSchemaV1 } from "@standard-schema/spec";
@@ -134,5 +134,4 @@ declare class MDXCollection<FrontmatterSchema extends StandardSchemaV1 | undefin
134
134
  }
135
135
  declare function mdxCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(config: MDXCollectionConfig<FrontmatterSchema>): MDXCollection<FrontmatterSchema>;
136
136
  //#endregion
137
- export { LinkReference as a, CompiledMDX as i, MDXCollectionConfig as n, mdxCollection as r, MDXCollection as t };
138
- //# sourceMappingURL=mdx-L0I8mePE.d.ts.map
137
+ export { LinkReference as a, CompiledMDX as i, MDXCollectionConfig as n, mdxCollection as r, MDXCollection as t };
@@ -13,5 +13,4 @@ interface NextOptions extends Pick<CoreOptions, "cwd" | "configPath" | "outDir">
13
13
  declare function createContent(options?: NextOptions): Promise<(nextConfig?: NextConfig) => NextConfig>;
14
14
  declare function createStandaloneCore(options: NextOptions): Promise<Core>;
15
15
  //#endregion
16
- export { NextOptions, createContent, createStandaloneCore };
17
- //# sourceMappingURL=index.d.ts.map
16
+ export { NextOptions, createContent, createStandaloneCore };
@@ -1,6 +1,6 @@
1
- import { t as Core } from "../core-CrYszxmc.js";
1
+ import { t as Core } from "../core-Cgc-cdSx.js";
2
2
  import { loaderPlugin } from "../plugins/loader/index.js";
3
- import { t as loadConfig } from "../load-from-file-C3CnD8mJ.js";
3
+ import { t as loadConfig } from "../load-from-file-DpW8who8.js";
4
4
  import path from "node:path";
5
5
  //#region src/next/index.ts
6
6
  async function createContent(options = {}) {
@@ -69,5 +69,3 @@ function createNextCore({ configPath, cwd, outDir }) {
69
69
  }
70
70
  //#endregion
71
71
  export { createContent, createStandaloneCore };
72
-
73
- //# sourceMappingURL=index.js.map
@@ -3,5 +3,4 @@ import { LoaderOptions } from "./loader.js";
3
3
  //#region src/node/index.d.ts
4
4
  declare function register(options?: LoaderOptions): void;
5
5
  //#endregion
6
- export { register };
7
- //# sourceMappingURL=index.d.ts.map
6
+ export { register };
@@ -5,5 +5,3 @@ function register(options = {}) {
5
5
  }
6
6
  //#endregion
7
7
  export { register };
8
-
9
- //# sourceMappingURL=index.js.map
@@ -6,5 +6,4 @@ type LoaderOptions = Omit<CoreOptions, "plugins" | "workspace">;
6
6
  declare const initialize: InitializeHook<LoaderOptions>;
7
7
  declare const load: LoadHook;
8
8
  //#endregion
9
- export { LoaderOptions, initialize, load };
10
- //# sourceMappingURL=loader.d.ts.map
9
+ export { LoaderOptions, initialize, load };
@@ -1,5 +1,5 @@
1
1
  import { createDynamicCore } from "../dynamic.js";
2
- import { t as Core } from "../core-CrYszxmc.js";
2
+ import { t as Core } from "../core-Cgc-cdSx.js";
3
3
  import { t as createCache } from "../async-cache-C47yxLCv.js";
4
4
  import { loaderPlugin } from "../plugins/loader/index.js";
5
5
  //#region src/node/loader.ts
@@ -33,5 +33,3 @@ const load = async (url, context, nextLoad) => {
33
33
  };
34
34
  //#endregion
35
35
  export { initialize, load };
36
-
37
- //# sourceMappingURL=loader.js.map
@@ -4,10 +4,10 @@ import { fileURLToPath } from "node:url";
4
4
  function toNode(loaders) {
5
5
  return async (url, _context, nextLoad) => {
6
6
  if (!url.startsWith("file:///")) return nextLoad(url);
7
- const config = loaders.find((loader) => !loader.test || loader.test.test(url));
8
- if (config) {
9
- const parsedUrl = new URL(url);
10
- const filePath = fileURLToPath(parsedUrl);
7
+ const parsedUrl = new URL(url);
8
+ const filePath = fileURLToPath(parsedUrl);
9
+ for (const config of loaders) {
10
+ if (config.test && !config.test.test(url)) continue;
11
11
  const result = await config.loader.load({
12
12
  filePath,
13
13
  query: Object.fromEntries(parsedUrl.searchParams.entries()),
@@ -28,5 +28,3 @@ function toNode(loaders) {
28
28
  }
29
29
  //#endregion
30
30
  export { toNode };
31
-
32
- //# sourceMappingURL=node-Du4i4XDg.js.map
@@ -55,5 +55,3 @@ function createGitClient(cwd) {
55
55
  }
56
56
  //#endregion
57
57
  export { git as default, gitHook };
58
-
59
- //# sourceMappingURL=git.js.map
@@ -22,5 +22,4 @@ interface JSONSchemaHook {
22
22
  */
23
23
  declare const jsonSchemaHook: CollectionHook<JSONSchemaHook, JSONSchemaOptions>;
24
24
  //#endregion
25
- export { JSONSchemaHook, JSONSchemaOptions, jsonSchemaHook };
26
- //# sourceMappingURL=json-schema.d.ts.map
25
+ export { JSONSchemaHook, JSONSchemaOptions, jsonSchemaHook };
@@ -47,5 +47,3 @@ const jsonSchemaHook = defineCollectionHook("json-schema", (collection, { insert
47
47
  });
48
48
  //#endregion
49
49
  export { jsonSchemaHook };
50
-
51
- //# sourceMappingURL=json-schema.js.map
@@ -1,2 +1,2 @@
1
- import { a as LoaderOutput, i as LoaderInput, n as LoaderConfig, o as loaderHook, r as LoaderHook, s as loaderPlugin, t as Loader } from "../../index-DVqrqxzl.js";
1
+ import { a as LoaderConfig, c as LoaderOutput, i as Loader, l as loaderHook, o as LoaderHook, s as LoaderInput, u as loaderPlugin } from "../../webpack-C8ABoMB_.js";
2
2
  export { Loader, LoaderConfig, LoaderHook, LoaderInput, LoaderOutput, loaderHook, loaderPlugin };
@@ -56,7 +56,7 @@ function loaderPlugin() {
56
56
  for (const loader of await initLoaders(this, "bun")) toBun(loader.test, loader.loader)(build);
57
57
  } },
58
58
  node: { async createLoad() {
59
- const { toNode } = await import("../../node-Du4i4XDg.js");
59
+ const { toNode } = await import("../../node-XtGkkaiN.js");
60
60
  return toNode(await initLoaders(this, "node"));
61
61
  } },
62
62
  vite: { async createPlugin() {
@@ -70,5 +70,3 @@ function loaderPlugin() {
70
70
  const loaderHook = defineCollectionHook("loader", () => ({ loaders: [] }));
71
71
  //#endregion
72
72
  export { loaderHook, loaderPlugin };
73
-
74
- //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import { c as WebpackLoader, l as WebpackLoaderOptions, u as createWebpackLoader } from "../../index-DVqrqxzl.js";
1
+ import { n as WebpackLoaderOptions, r as createWebpackLoader, t as WebpackLoader } from "../../webpack-C8ABoMB_.js";
2
2
  export { WebpackLoader, WebpackLoaderOptions, createWebpackLoader };
@@ -1,5 +1,5 @@
1
1
  import { createDynamicCore } from "../../dynamic.js";
2
- import { t as Core } from "../../core-CrYszxmc.js";
2
+ import { t as Core } from "../../core-Cgc-cdSx.js";
3
3
  import { t as ValidationError } from "../../validation-Bf_v2L3p.js";
4
4
  import path from "node:path";
5
5
  import { parse } from "node:querystring";
@@ -57,5 +57,3 @@ function createWebpackLoader(loaderFactory) {
57
57
  }
58
58
  //#endregion
59
59
  export { createWebpackLoader };
60
-
61
- //# sourceMappingURL=webpack.js.map
@@ -19,5 +19,4 @@ declare function remarkInclude(this: Processor, {
19
19
  tagName
20
20
  }?: RemarkIncludeOptions): Transformer<Root, Root>;
21
21
  //#endregion
22
- export { Params, RemarkIncludeOptions, remarkInclude };
23
- //# sourceMappingURL=include.d.ts.map
22
+ export { Params, RemarkIncludeOptions, remarkInclude };
@@ -1,5 +1,5 @@
1
- import { t as fumaMatter } from "../../fuma-matter-E30PU53R.js";
2
- import { t as flattenNode } from "../../flatten-m0wfHxLH.js";
1
+ import { parseFrontmatter } from "../../utils/frontmatter.js";
2
+ import { t as flattenNode } from "../../flatten-Db7WzTB7.js";
3
3
  import * as fs$1 from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
5
5
  import { visit } from "unist-util-visit";
@@ -145,7 +145,7 @@ function remarkInclude({ tagName = "include" } = {}) {
145
145
  data: {}
146
146
  };
147
147
  const processor = await _getProcessor(ext === ".mdx" ? "mdx" : "md");
148
- const parsed = fumaMatter(content);
148
+ const parsed = parseFrontmatter(content);
149
149
  const targetFile = new VFile({
150
150
  path: targetPath,
151
151
  value: parsed.content,
@@ -193,11 +193,10 @@ function remarkInclude({ tagName = "include" } = {}) {
193
193
  };
194
194
  }
195
195
  var Terminated = class {
196
+ value;
196
197
  constructor(value) {
197
198
  this.value = value;
198
199
  }
199
200
  };
200
201
  //#endregion
201
202
  export { remarkInclude };
202
-
203
- //# sourceMappingURL=include.js.map
@@ -1,6 +1,6 @@
1
1
  import { D as GetCollectionConfig } from "./core-BbTeLenA.js";
2
- import { t as FileCollectionStore } from "./file-store-DutRtol_.js";
3
- import { i as CompiledMDX } from "./mdx-L0I8mePE.js";
2
+ import { t as FileCollectionStore } from "./file-store-D5nKTMSL.js";
3
+ import { i as CompiledMDX } from "./mdx-CkXj06oG.js";
4
4
  import { n as GitFileData } from "./git-BxnPg5Ao.js";
5
5
 
6
6
  //#region src/collections/mdx/runtime.d.ts
@@ -23,5 +23,4 @@ declare function mdxStoreLazy<Config, Name extends string, Attached>(_name: Name
23
23
  }): FileCollectionStore<MDXStoreLazyData<GetFrontmatter<Config, Name>, Attached>>;
24
24
  type WithGit = GitFileData;
25
25
  //#endregion
26
- export { mdxStoreLazy as a, mdxStore as i, MDXStoreLazyData as n, WithGit as r, MDXStoreData as t };
27
- //# sourceMappingURL=runtime-TETi5Giq.d.ts.map
26
+ export { mdxStoreLazy as a, mdxStore as i, MDXStoreLazyData as n, WithGit as r, MDXStoreData as t };