fuma-content 1.1.5 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/{async-cache-Cce8lc9D.js → async-cache-C47yxLCv.js} +3 -4
  2. package/dist/{async-cache-Cce8lc9D.js.map → async-cache-C47yxLCv.js.map} +1 -1
  3. package/dist/bin.js +2 -3
  4. package/dist/bin.js.map +1 -1
  5. package/dist/build-mdx-C8u32vDa.js +158 -0
  6. package/dist/build-mdx-C8u32vDa.js.map +1 -0
  7. package/dist/bun/index.d.ts +1 -1
  8. package/dist/bun/index.js +2 -3
  9. package/dist/bun/index.js.map +1 -1
  10. package/dist/{bun-DsjsbVrx.js → bun-NahDFkhR.js} +3 -4
  11. package/dist/{bun-DsjsbVrx.js.map → bun-NahDFkhR.js.map} +1 -1
  12. package/dist/{code-generator-CHcOrCeM.js → code-generator-pLUE7Rk7.js} +2 -3
  13. package/dist/{code-generator-CHcOrCeM.js.map → code-generator-pLUE7Rk7.js.map} +1 -1
  14. package/dist/collections/data/runtime.d.ts +2 -3
  15. package/dist/collections/data/runtime.d.ts.map +1 -1
  16. package/dist/collections/data/runtime.js +1 -2
  17. package/dist/collections/data/runtime.js.map +1 -1
  18. package/dist/collections/data.d.ts +3 -4
  19. package/dist/collections/data.d.ts.map +1 -1
  20. package/dist/collections/data.js +5 -6
  21. package/dist/collections/data.js.map +1 -1
  22. package/dist/collections/fs.d.ts +2 -45
  23. package/dist/collections/fs.js +3 -4
  24. package/dist/collections/fs.js.map +1 -1
  25. package/dist/collections/index.d.ts +2 -37
  26. package/dist/collections/index.js +1 -37
  27. package/dist/collections/json/loader-webpack.d.ts +1 -3
  28. package/dist/collections/json/loader-webpack.js +4 -5
  29. package/dist/collections/json/loader-webpack.js.map +1 -1
  30. package/dist/collections/mdx/loader-webpack.d.ts +1 -3
  31. package/dist/collections/mdx/loader-webpack.js +4 -5
  32. package/dist/collections/mdx/loader-webpack.js.map +1 -1
  33. package/dist/collections/mdx/react.d.ts +2 -4
  34. package/dist/collections/mdx/react.d.ts.map +1 -1
  35. package/dist/collections/mdx/react.js +2 -3
  36. package/dist/collections/mdx/react.js.map +1 -1
  37. package/dist/collections/mdx/runtime-browser.d.ts +3 -25
  38. package/dist/collections/mdx/runtime-browser.js +2 -4
  39. package/dist/collections/mdx/runtime-browser.js.map +1 -1
  40. package/dist/collections/mdx/runtime-dynamic.d.ts +4 -5
  41. package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
  42. package/dist/collections/mdx/runtime-dynamic.js +6 -7
  43. package/dist/collections/mdx/runtime-dynamic.js.map +1 -1
  44. package/dist/collections/mdx/runtime.d.ts +2 -26
  45. package/dist/collections/mdx/runtime.js +1 -2
  46. package/dist/collections/mdx/runtime.js.map +1 -1
  47. package/dist/collections/mdx/vue.d.ts +27 -0
  48. package/dist/collections/mdx/vue.d.ts.map +1 -0
  49. package/dist/collections/mdx/vue.js +34 -0
  50. package/dist/collections/mdx/vue.js.map +1 -0
  51. package/dist/collections/mdx.d.ts +2 -59
  52. package/dist/collections/mdx.js +6 -7
  53. package/dist/collections/mdx.js.map +1 -1
  54. package/dist/collections/obsidian.d.ts +1 -3
  55. package/dist/collections/obsidian.d.ts.map +1 -1
  56. package/dist/collections/obsidian.js +164 -127
  57. package/dist/collections/obsidian.js.map +1 -1
  58. package/dist/collections/runtime/file-store.d.ts +2 -21
  59. package/dist/collections/runtime/file-store.js +1 -2
  60. package/dist/collections/runtime/file-store.js.map +1 -1
  61. package/dist/collections/runtime/store.d.ts +2 -31
  62. package/dist/collections/runtime/store.js +1 -1
  63. package/dist/collections/runtime/store.js.map +1 -1
  64. package/dist/collections/yaml/loader-webpack.d.ts +1 -3
  65. package/dist/collections/yaml/loader-webpack.js +4 -5
  66. package/dist/collections/yaml/loader-webpack.js.map +1 -1
  67. package/dist/{pipe-CvCqOpXX.js → collections-BuskUhft.js} +36 -4
  68. package/dist/collections-BuskUhft.js.map +1 -0
  69. package/dist/config/index.d.ts +2 -35
  70. package/dist/config/index.js +1 -1
  71. package/dist/{core-FjA_Xoho.d.ts → core-15rgY8JW.d.ts} +69 -4
  72. package/dist/core-15rgY8JW.d.ts.map +1 -0
  73. package/dist/{core-BuUsOElL.js → core-BfIQeHzH.js} +18 -15
  74. package/dist/core-BfIQeHzH.js.map +1 -0
  75. package/dist/dynamic-CwBRfhBm.d.ts +32 -0
  76. package/dist/dynamic-CwBRfhBm.d.ts.map +1 -0
  77. package/dist/dynamic.d.ts +2 -25
  78. package/dist/dynamic.js +2 -3
  79. package/dist/dynamic.js.map +1 -1
  80. package/dist/file-store-270Y4Sx7.d.ts +20 -0
  81. package/dist/file-store-270Y4Sx7.d.ts.map +1 -0
  82. package/dist/flatten-m0wfHxLH.js +10 -0
  83. package/dist/flatten-m0wfHxLH.js.map +1 -0
  84. package/dist/fs-DDVhjRBi.d.ts +44 -0
  85. package/dist/fs-DDVhjRBi.d.ts.map +1 -0
  86. package/dist/{fuma-matter-CCYGfgju.js → fuma-matter-E30PU53R.js} +2 -3
  87. package/dist/{fuma-matter-CCYGfgju.js.map → fuma-matter-E30PU53R.js.map} +1 -1
  88. package/dist/git-Ce7r2zfM.d.ts +37 -0
  89. package/dist/git-Ce7r2zfM.d.ts.map +1 -0
  90. package/dist/index-B9DAFF8c.d.ts +84 -0
  91. package/dist/index-B9DAFF8c.d.ts.map +1 -0
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.js +4 -5
  94. package/dist/{is-promise-like-pBUIbRFy.js → is-promise-like-C04ERo2r.js} +2 -2
  95. package/dist/{is-promise-like-pBUIbRFy.js.map → is-promise-like-C04ERo2r.js.map} +1 -1
  96. package/dist/{load-from-file-B9ho46XM.js → load-from-file-C3CnD8mJ.js} +3 -4
  97. package/dist/{load-from-file-B9ho46XM.js.map → load-from-file-C3CnD8mJ.js.map} +1 -1
  98. package/dist/{loader-B3hZ0R4a.js → loader-CyhM9SLt.js} +5 -6
  99. package/dist/{loader-B3hZ0R4a.js.map → loader-CyhM9SLt.js.map} +1 -1
  100. package/dist/{loader-D2BD3e0R.js → loader-D_sKOzDc.js} +4 -5
  101. package/dist/{loader-D2BD3e0R.js.map → loader-D_sKOzDc.js.map} +1 -1
  102. package/dist/{loader-C5w-u-h2.js → loader-e2SkeDfY.js} +4 -5
  103. package/dist/{loader-C5w-u-h2.js.map → loader-e2SkeDfY.js.map} +1 -1
  104. package/dist/{loader-BFfzKD3u.js → loader-ol04zeoP.js} +3 -4
  105. package/dist/{loader-BFfzKD3u.js.map → loader-ol04zeoP.js.map} +1 -1
  106. package/dist/mdx-BfaapI6d.d.ts +138 -0
  107. package/dist/mdx-BfaapI6d.d.ts.map +1 -0
  108. package/dist/next/index.d.ts +1 -1
  109. package/dist/next/index.js +3 -4
  110. package/dist/next/index.js.map +1 -1
  111. package/dist/node/index.d.ts +0 -1
  112. package/dist/node/index.d.ts.map +1 -1
  113. package/dist/node/index.js +1 -2
  114. package/dist/node/index.js.map +1 -1
  115. package/dist/node/loader.d.ts +1 -1
  116. package/dist/node/loader.js +3 -4
  117. package/dist/node/loader.js.map +1 -1
  118. package/dist/{node-Cu5Pqxxo.js → node-Du4i4XDg.js} +2 -3
  119. package/dist/{node-Cu5Pqxxo.js.map → node-Du4i4XDg.js.map} +1 -1
  120. package/dist/plugins/git.d.ts +2 -38
  121. package/dist/plugins/git.js +3 -5
  122. package/dist/plugins/git.js.map +1 -1
  123. package/dist/plugins/json-schema.d.ts +1 -2
  124. package/dist/plugins/json-schema.d.ts.map +1 -1
  125. package/dist/plugins/json-schema.js +2 -3
  126. package/dist/plugins/json-schema.js.map +1 -1
  127. package/dist/plugins/loader/index.d.ts +2 -72
  128. package/dist/plugins/loader/index.js +6 -7
  129. package/dist/plugins/loader/index.js.map +1 -1
  130. package/dist/plugins/loader/webpack.d.ts +2 -21
  131. package/dist/plugins/loader/webpack.js +3 -4
  132. package/dist/plugins/loader/webpack.js.map +1 -1
  133. package/dist/plugins/remark/include.d.ts +23 -0
  134. package/dist/plugins/remark/include.d.ts.map +1 -0
  135. package/dist/{build-mdx-C210zpJN.js → plugins/remark/include.js} +5 -166
  136. package/dist/plugins/remark/include.js.map +1 -0
  137. package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
  138. package/dist/runtime-bpro4VYw.d.ts +25 -0
  139. package/dist/runtime-bpro4VYw.d.ts.map +1 -0
  140. package/dist/runtime-browser-BT3GpIH7.d.ts +29 -0
  141. package/dist/runtime-browser-BT3GpIH7.d.ts.map +1 -0
  142. package/dist/store-Cc6y2CDE.d.ts +31 -0
  143. package/dist/store-Cc6y2CDE.d.ts.map +1 -0
  144. package/dist/{validation-C3kXuveD.js → validation-Bf_v2L3p.js} +2 -2
  145. package/dist/{validation-C3kXuveD.js.map → validation-Bf_v2L3p.js.map} +1 -1
  146. package/dist/vite/index.d.ts +1 -1
  147. package/dist/vite/index.js +3 -4
  148. package/dist/vite/index.js.map +1 -1
  149. package/dist/{vite-CoJIMNWk.js → vite-DVIOnBqW.js} +2 -3
  150. package/dist/{vite-CoJIMNWk.js.map → vite-DVIOnBqW.js.map} +1 -1
  151. package/package.json +42 -61
  152. package/dist/async-cache-Ca5oMQss.d.ts +0 -11
  153. package/dist/async-cache-Ca5oMQss.d.ts.map +0 -1
  154. package/dist/build-mdx-C210zpJN.js.map +0 -1
  155. package/dist/build-mdx-DhXGp7I9.d.ts +0 -101
  156. package/dist/build-mdx-DhXGp7I9.d.ts.map +0 -1
  157. package/dist/collections/fs.d.ts.map +0 -1
  158. package/dist/collections/index.d.ts.map +0 -1
  159. package/dist/collections/index.js.map +0 -1
  160. package/dist/collections/mdx/runtime-browser.d.ts.map +0 -1
  161. package/dist/collections/mdx/runtime.d.ts.map +0 -1
  162. package/dist/collections/mdx.d.ts.map +0 -1
  163. package/dist/collections/runtime/file-store.d.ts.map +0 -1
  164. package/dist/collections/runtime/store.d.ts.map +0 -1
  165. package/dist/config/index.d.ts.map +0 -1
  166. package/dist/core-BuUsOElL.js.map +0 -1
  167. package/dist/core-FjA_Xoho.d.ts.map +0 -1
  168. package/dist/dynamic.d.ts.map +0 -1
  169. package/dist/load-from-file-CIYdu-B5.d.ts +0 -10
  170. package/dist/load-from-file-CIYdu-B5.d.ts.map +0 -1
  171. package/dist/pipe-CvCqOpXX.js.map +0 -1
  172. package/dist/plugins/git.d.ts.map +0 -1
  173. package/dist/plugins/loader/index.d.ts.map +0 -1
  174. package/dist/plugins/loader/webpack.d.ts.map +0 -1
  175. package/dist/rolldown-runtime-CjeV3_4I.js +0 -18
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.js","names":[],"sources":["../../../src/plugins/loader/webpack.ts"],"sourcesContent":["import { parse } from \"node:querystring\";\nimport { ValidationError } from \"@/utils/validation\";\nimport path from \"node:path\";\nimport { Core } from \"@/core\";\nimport { createDynamicCore, type DynamicCore } from \"@/dynamic\";\nimport type { LoaderContext } from \"webpack\";\nimport type { Loader } from \"@/plugins/loader\";\n\nexport interface WebpackLoaderOptions {\n absoluteCompiledConfigPath: string;\n configPath: string;\n outDir: string;\n isDev: boolean;\n}\n\nexport type WebpackLoader = (this: LoaderContext<WebpackLoaderOptions>, source: string) => void;\n\nconst cachedCores = new Map<string, DynamicCore>();\n\nfunction initDynamicCore({ configPath, isDev, outDir }: WebpackLoaderOptions) {\n const key = `${configPath}:${isDev}:${outDir}`;\n let res = cachedCores.get(key);\n if (res) return res;\n\n res = createDynamicCore({\n core: new Core({ configPath, outDir }),\n compileMode: \"skip\",\n mode: isDev ? \"dev\" : \"production\",\n });\n cachedCores.set(key, res);\n return res;\n}\n\n/**\n * Note: need to handle the `test` regex in Webpack config instead.\n */\nexport function createWebpackLoader(loaderFactory: (core: DynamicCore) => Loader): WebpackLoader {\n let loader: Loader | undefined;\n\n async function asyncLoader(\n this: LoaderContext<WebpackLoaderOptions>,\n source: string,\n callback: LoaderContext<WebpackLoaderOptions>[\"callback\"],\n ) {\n const options = this.getOptions();\n this.cacheable(true);\n this.addDependency(options.absoluteCompiledConfigPath);\n\n if (!loader) {\n const core = initDynamicCore(options);\n loader = loaderFactory(core);\n }\n\n try {\n const result = await loader.load({\n filePath: this.resourcePath,\n query: parse(this.resourceQuery.slice(1)),\n getSource() {\n return source;\n },\n development: this.mode === \"development\",\n addDependency: (file) => {\n this.addDependency(file);\n },\n });\n\n if (result === null) {\n callback(undefined, source);\n } else {\n callback(undefined, result.code, result.map as string);\n }\n } catch (error) {\n if (error instanceof ValidationError) {\n return callback(new Error(await error.toStringFormatted()));\n }\n\n if (!(error instanceof Error)) throw error;\n\n const fpath = path.relative(this.context, this.resourcePath);\n error.message = `${fpath}:${error.name}: ${error.message}`;\n callback(error);\n }\n }\n\n return function loader(source) {\n return asyncLoader.call(this, source, this.async());\n };\n}\n"],"mappings":";;;;;;;AAiBA,MAAM,8BAAc,IAAI,KAA0B;AAElD,SAAS,gBAAgB,EAAE,YAAY,OAAO,UAAgC;CAC5E,MAAM,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG;CACtC,IAAI,MAAM,YAAY,IAAI,IAAI;AAC9B,KAAI,IAAK,QAAO;AAEhB,OAAM,kBAAkB;EACtB,MAAM,IAAI,KAAK;GAAE;GAAY;GAAQ,CAAC;EACtC,aAAa;EACb,MAAM,QAAQ,QAAQ;EACvB,CAAC;AACF,aAAY,IAAI,KAAK,IAAI;AACzB,QAAO;;;;;AAMT,SAAgB,oBAAoB,eAA6D;CAC/F,IAAI;CAEJ,eAAe,YAEb,QACA,UACA;EACA,MAAM,UAAU,KAAK,YAAY;AACjC,OAAK,UAAU,KAAK;AACpB,OAAK,cAAc,QAAQ,2BAA2B;AAEtD,MAAI,CAAC,OAEH,UAAS,cADI,gBAAgB,QAAQ,CACT;AAG9B,MAAI;GACF,MAAM,SAAS,MAAM,OAAO,KAAK;IAC/B,UAAU,KAAK;IACf,OAAO,MAAM,KAAK,cAAc,MAAM,EAAE,CAAC;IACzC,YAAY;AACV,YAAO;;IAET,aAAa,KAAK,SAAS;IAC3B,gBAAgB,SAAS;AACvB,UAAK,cAAc,KAAK;;IAE3B,CAAC;AAEF,OAAI,WAAW,KACb,UAAS,QAAW,OAAO;OAE3B,UAAS,QAAW,OAAO,MAAM,OAAO,IAAc;WAEjD,OAAO;AACd,OAAI,iBAAiB,gBACnB,QAAO,SAAS,IAAI,MAAM,MAAM,MAAM,mBAAmB,CAAC,CAAC;AAG7D,OAAI,EAAE,iBAAiB,OAAQ,OAAM;AAGrC,SAAM,UAAU,GADF,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACnC,GAAG,MAAM,KAAK,IAAI,MAAM;AACjD,YAAS,MAAM;;;AAInB,QAAO,SAAS,OAAO,QAAQ;AAC7B,SAAO,YAAY,KAAK,MAAM,QAAQ,KAAK,OAAO,CAAC"}
1
+ {"version":3,"file":"webpack.js","names":[],"sources":["../../../src/plugins/loader/webpack.ts"],"sourcesContent":["import { parse } from \"node:querystring\";\nimport { ValidationError } from \"@/utils/validation\";\nimport path from \"node:path\";\nimport { Core } from \"@/core\";\nimport { createDynamicCore, type DynamicCore } from \"@/dynamic\";\nimport type { LoaderContext } from \"webpack\";\nimport type { Loader } from \"@/plugins/loader\";\n\nexport interface WebpackLoaderOptions {\n absoluteCompiledConfigPath: string;\n configPath: string;\n outDir: string;\n isDev: boolean;\n}\n\nexport type WebpackLoader = (this: LoaderContext<WebpackLoaderOptions>, source: string) => void;\n\nconst cachedCores = new Map<string, DynamicCore>();\n\nfunction initDynamicCore({ configPath, isDev, outDir }: WebpackLoaderOptions) {\n const key = `${configPath}:${isDev}:${outDir}`;\n let res = cachedCores.get(key);\n if (res) return res;\n\n res = createDynamicCore({\n core: new Core({ configPath, outDir }),\n compileMode: \"skip\",\n mode: isDev ? \"dev\" : \"production\",\n });\n cachedCores.set(key, res);\n return res;\n}\n\n/**\n * Note: need to handle the `test` regex in Webpack config instead.\n */\nexport function createWebpackLoader(loaderFactory: (core: DynamicCore) => Loader): WebpackLoader {\n let loader: Loader | undefined;\n\n async function asyncLoader(\n this: LoaderContext<WebpackLoaderOptions>,\n source: string,\n callback: LoaderContext<WebpackLoaderOptions>[\"callback\"],\n ) {\n const options = this.getOptions();\n this.cacheable(true);\n this.addDependency(options.absoluteCompiledConfigPath);\n\n if (!loader) {\n const core = initDynamicCore(options);\n loader = loaderFactory(core);\n }\n\n try {\n const result = await loader.load({\n filePath: this.resourcePath,\n query: parse(this.resourceQuery.slice(1)),\n getSource() {\n return source;\n },\n development: this.mode === \"development\",\n addDependency: (file) => {\n this.addDependency(file);\n },\n });\n\n if (result === null) {\n callback(undefined, source);\n } else {\n callback(undefined, result.code, result.map as string);\n }\n } catch (error) {\n if (error instanceof ValidationError) {\n return callback(new Error(await error.toStringFormatted()));\n }\n\n if (!(error instanceof Error)) throw error;\n\n const fpath = path.relative(this.context, this.resourcePath);\n error.message = `${fpath}:${error.name}: ${error.message}`;\n callback(error);\n }\n }\n\n return function loader(source) {\n return asyncLoader.call(this, source, this.async());\n };\n}\n"],"mappings":";;;;;;AAiBA,MAAM,8BAAc,IAAI,KAA0B;AAElD,SAAS,gBAAgB,EAAE,YAAY,OAAO,UAAgC;CAC5E,MAAM,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG;CACtC,IAAI,MAAM,YAAY,IAAI,IAAI;AAC9B,KAAI,IAAK,QAAO;AAEhB,OAAM,kBAAkB;EACtB,MAAM,IAAI,KAAK;GAAE;GAAY;GAAQ,CAAC;EACtC,aAAa;EACb,MAAM,QAAQ,QAAQ;EACvB,CAAC;AACF,aAAY,IAAI,KAAK,IAAI;AACzB,QAAO;;;;;AAMT,SAAgB,oBAAoB,eAA6D;CAC/F,IAAI;CAEJ,eAAe,YAEb,QACA,UACA;EACA,MAAM,UAAU,KAAK,YAAY;AACjC,OAAK,UAAU,KAAK;AACpB,OAAK,cAAc,QAAQ,2BAA2B;AAEtD,MAAI,CAAC,OAEH,UAAS,cADI,gBAAgB,QAAQ,CACT;AAG9B,MAAI;GACF,MAAM,SAAS,MAAM,OAAO,KAAK;IAC/B,UAAU,KAAK;IACf,OAAO,MAAM,KAAK,cAAc,MAAM,EAAE,CAAC;IACzC,YAAY;AACV,YAAO;;IAET,aAAa,KAAK,SAAS;IAC3B,gBAAgB,SAAS;AACvB,UAAK,cAAc,KAAK;;IAE3B,CAAC;AAEF,OAAI,WAAW,KACb,UAAS,KAAA,GAAW,OAAO;OAE3B,UAAS,KAAA,GAAW,OAAO,MAAM,OAAO,IAAc;WAEjD,OAAO;AACd,OAAI,iBAAiB,gBACnB,QAAO,SAAS,IAAI,MAAM,MAAM,MAAM,mBAAmB,CAAC,CAAC;AAG7D,OAAI,EAAE,iBAAiB,OAAQ,OAAM;AAGrC,SAAM,UAAU,GADF,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,CACnC,GAAG,MAAM,KAAK,IAAI,MAAM;AACjD,YAAS,MAAM;;;AAInB,QAAO,SAAS,OAAO,QAAQ;AAC7B,SAAO,YAAY,KAAK,MAAM,QAAQ,KAAK,OAAO,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Processor, Transformer } from "unified";
2
+ import { Root } from "mdast";
3
+
4
+ //#region src/plugins/remark/include.d.ts
5
+ interface Params {
6
+ lang?: string;
7
+ meta?: string;
8
+ }
9
+ interface RemarkIncludeOptions {
10
+ tagName?: string;
11
+ }
12
+ declare module "vfile" {
13
+ interface DataMap {
14
+ /** [Fuma Content: remark-include] whether the content is getting parsed from a `<include />` */
15
+ _in_include?: boolean;
16
+ }
17
+ }
18
+ declare function remarkInclude(this: Processor, {
19
+ tagName
20
+ }?: RemarkIncludeOptions): Transformer<Root, Root>;
21
+ //#endregion
22
+ export { Params, RemarkIncludeOptions, remarkInclude };
23
+ //# sourceMappingURL=include.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"include.d.ts","names":[],"sources":["../../../src/plugins/remark/include.ts"],"mappings":";;;;UAWiB,MAAA;EACf,IAAA;EACA,IAAA;AAAA;AAAA,UA4Ke,oBAAA;EACf,OAAA;AAAA;AAAA;EAAA,UAIU,OAAA;IALyB;IAOjC,WAAA;EAAA;AAAA;AAAA,iBAIY,aAAA,CACd,IAAA,EAAM,SAAA;EACJ;AAAA,IAAuB,oBAAA,GACxB,WAAA,CAAY,IAAA,EAAM,IAAA"}
@@ -1,25 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-CjeV3_4I.js";
2
- import { t as createCache } from "./async-cache-Cce8lc9D.js";
3
- import { t as fumaMatter } from "./fuma-matter-CCYGfgju.js";
1
+ import { t as fumaMatter } from "../../fuma-matter-E30PU53R.js";
2
+ import { t as flattenNode } from "../../flatten-m0wfHxLH.js";
4
3
  import * as fs$1 from "node:fs/promises";
5
4
  import * as path$1 from "node:path";
6
5
  import { visit } from "unist-util-visit";
7
- import { createProcessor } from "@mdx-js/mdx";
8
6
  import { VFile } from "vfile";
9
- import { toMarkdown } from "mdast-util-to-markdown";
10
- import { valueToEstree } from "estree-util-value-to-estree";
11
- import { removePosition } from "unist-util-remove-position";
12
- import { mdxToMarkdown } from "mdast-util-mdx";
13
-
14
- //#region src/utils/mdast/flatten.ts
15
- function flattenNode(node) {
16
- if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
17
- if ("value" in node) return node.value;
18
- return "";
19
- }
20
-
21
- //#endregion
22
- //#region src/collections/mdx/remark-include.ts
7
+ //#region src/plugins/remark/include.ts
23
8
  const ElementLikeTypes = [
24
9
  "mdxJsxFlowElement",
25
10
  "mdxJsxTextElement",
@@ -212,153 +197,7 @@ var Terminated = class {
212
197
  this.value = value;
213
198
  }
214
199
  };
215
-
216
- //#endregion
217
- //#region src/collections/mdx/remark-postprocess.ts
218
- /**
219
- * - collect references
220
- * - write frontmatter (auto-title & description)
221
- */
222
- function remarkPostprocess({ _format, processedMarkdown = false, mdast = false, linkReferences = false, valueToExport = [] }) {
223
- return (tree, file) => {
224
- const frontmatter = file.data.frontmatter ??= {};
225
- if (!frontmatter.title) visit(tree, "heading", (node) => {
226
- if (node.depth === 1) {
227
- frontmatter.title = flattenNode(node);
228
- return false;
229
- }
230
- });
231
- file.data["mdx-export"] ??= [];
232
- file.data["mdx-export"].push({
233
- name: "frontmatter",
234
- value: frontmatter
235
- });
236
- if (linkReferences) {
237
- const { as = "_linkReferences" } = linkReferences === true ? {} : linkReferences;
238
- const urls = [];
239
- visit(tree, "link", (node) => {
240
- urls.push({ href: node.url });
241
- return "skip";
242
- });
243
- file.data["mdx-export"].push({
244
- name: as,
245
- value: urls
246
- });
247
- }
248
- if (processedMarkdown) {
249
- const { as = "_markdown", headingIds = true } = processedMarkdown === true ? {} : processedMarkdown;
250
- const extensions = this.data("toMarkdownExtensions") ?? [];
251
- const markdown = toMarkdown(tree, {
252
- ...this.data("settings"),
253
- extensions: _format === "md" ? [...extensions, mdxToMarkdown()] : extensions,
254
- handlers: { heading(node) {
255
- const id = node.data?.hProperties?.id;
256
- const content = flattenNode(node);
257
- return headingIds && id ? `${content} [#${id}]` : content;
258
- } }
259
- });
260
- file.data["mdx-export"].push({
261
- name: as,
262
- value: markdown
263
- });
264
- }
265
- if (mdast) {
266
- const { as = "_mdast", removePosition: shouldRemovePosition = false } = mdast === true ? {} : mdast;
267
- const stringified = JSON.stringify(shouldRemovePosition ? removePosition(structuredClone(tree)) : tree);
268
- file.data["mdx-export"].push({
269
- name: as,
270
- value: stringified
271
- });
272
- }
273
- for (const { name, value } of file.data["mdx-export"]) tree.children.unshift(getMdastExport(name, value));
274
- file.data["mdx-export"] = [];
275
- for (const name of valueToExport) {
276
- if (!(name in file.data)) continue;
277
- tree.children.unshift(getMdastExport(name, file.data[name]));
278
- }
279
- };
280
- }
281
- /**
282
- * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins
283
- *
284
- * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node
285
- */
286
- function getMdastExport(name, value) {
287
- return {
288
- type: "mdxjsEsm",
289
- value: "",
290
- data: { estree: {
291
- type: "Program",
292
- sourceType: "module",
293
- body: [{
294
- type: "ExportNamedDeclaration",
295
- specifiers: [],
296
- attributes: [],
297
- source: null,
298
- declaration: {
299
- type: "VariableDeclaration",
300
- kind: "let",
301
- declarations: [{
302
- type: "VariableDeclarator",
303
- id: {
304
- type: "Identifier",
305
- name
306
- },
307
- init: valueToEstree(value)
308
- }]
309
- }
310
- }]
311
- } }
312
- };
313
- }
314
-
315
200
  //#endregion
316
- //#region src/collections/mdx/build-mdx.ts
317
- var build_mdx_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
318
- async function buildMDX({ core, collection, filePath, frontmatter, source, compiler, environment, isDevelopment }) {
319
- const processorCache = createCache(core.cache).$value();
320
- function getProcessor(format) {
321
- const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
322
- return processorCache.cached(key, async () => {
323
- const mdxOptions = await collection?.getMDXOptions?.(environment);
324
- const postprocessOptions = {
325
- _format: format,
326
- ...collection?.postprocess
327
- };
328
- return createProcessor({
329
- outputFormat: "program",
330
- development: isDevelopment,
331
- ...mdxOptions,
332
- remarkPlugins: typeof mdxOptions?.remarkPlugins === "function" ? mdxOptions.remarkPlugins({
333
- remarkInclude,
334
- remarkPostprocess: [remarkPostprocess, postprocessOptions]
335
- }) : [
336
- remarkInclude,
337
- ...mdxOptions?.remarkPlugins ?? [],
338
- [remarkPostprocess, postprocessOptions]
339
- ],
340
- format
341
- });
342
- });
343
- }
344
- let vfile = new VFile({
345
- value: source,
346
- path: filePath,
347
- cwd: core.getOptions().cwd,
348
- data: {
349
- frontmatter,
350
- _compiler: compiler,
351
- _getProcessor: getProcessor
352
- }
353
- });
354
- if (collection && collection) vfile = await collection.vfile.run(vfile, {
355
- collection,
356
- filePath,
357
- source
358
- });
359
- return (await getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md")).process(vfile);
360
- }
201
+ export { remarkInclude };
361
202
 
362
- //#endregion
363
- export { build_mdx_exports as n, buildMDX as t };
364
- //# sourceMappingURL=build-mdx-C210zpJN.js.map
203
+ //# sourceMappingURL=include.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"include.js","names":["fs","path"],"sources":["../../../src/plugins/remark/include.ts"],"sourcesContent":["import type { Processor, Transformer } 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 { 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 tagName?: string;\n}\n\ndeclare module \"vfile\" {\n interface DataMap {\n /** [Fuma Content: remark-include] whether the content is getting parsed from a `<include />` */\n _in_include?: boolean;\n }\n}\n\nexport function remarkInclude(\n this: Processor,\n { tagName = \"include\" }: RemarkIncludeOptions = {},\n): Transformer<Root, Root> {\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 processor = (await _getProcessor(ext === \".mdx\" ? \"mdx\" : \"md\")) as unknown as Processor<\n Root,\n Root,\n Root\n >;\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 _in_include: true,\n },\n });\n\n let mdast: Root;\n try {\n mdast = await processor.run(processor.parse(targetFile), targetFile);\n } catch (e) {\n if (e instanceof Terminated) mdast = e.value;\n else throw e;\n }\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 return async (tree, file) => {\n if (file.data._in_include) throw new Terminated(tree);\n\n await update(tree, file);\n };\n}\n\nclass Terminated {\n constructor(readonly value: Root) {}\n}\n"],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
@@ -0,0 +1,25 @@
1
+ import { D as GetCollectionConfig } from "./core-15rgY8JW.js";
2
+ import { t as FileCollectionStore } from "./file-store-270Y4Sx7.js";
3
+ import { i as CompiledMDX, t as MDXCollection } from "./mdx-BfaapI6d.js";
4
+ import { n as GitFileData } from "./git-Ce7r2zfM.js";
5
+
6
+ //#region src/collections/mdx/runtime.d.ts
7
+ interface MDXStoreData<Frontmatter, Attached = unknown> {
8
+ id: string;
9
+ compiled: CompiledMDX<Frontmatter> & Attached;
10
+ }
11
+ type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends MDXCollection ? GetCollectionConfig<Config, Name>["$inferFrontmatter"] : never;
12
+ declare function mdxStore<Config, Name extends string, Attached>(_name: Name, base: string, _input: Record<string, unknown>): FileCollectionStore<MDXStoreData<GetFrontmatter<Config, Name>, Attached>>;
13
+ interface MDXStoreLazyData<Frontmatter, Attached> {
14
+ id: string;
15
+ frontmatter: Frontmatter;
16
+ load: () => Promise<CompiledMDX<Frontmatter> & Attached>;
17
+ }
18
+ declare function mdxStoreLazy<Config, Name extends string, Attached>(_name: Name, base: string, _input: {
19
+ head: Record<string, unknown>;
20
+ body: Record<string, () => Promise<unknown>>;
21
+ }): FileCollectionStore<MDXStoreLazyData<GetFrontmatter<Config, Name>, Attached>>;
22
+ type WithGit = GitFileData;
23
+ //#endregion
24
+ export { mdxStoreLazy as a, mdxStore as i, MDXStoreLazyData as n, WithGit as r, MDXStoreData as t };
25
+ //# sourceMappingURL=runtime-bpro4VYw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bpro4VYw.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"}
@@ -0,0 +1,29 @@
1
+ import { D as GetCollectionConfig, E as Awaitable } from "./core-15rgY8JW.js";
2
+ import { n as MapCollectionStore } from "./store-Cc6y2CDE.js";
3
+ import { i as CompiledMDX, t as MDXCollection } from "./mdx-BfaapI6d.js";
4
+
5
+ //#region src/utils/async-cache.d.ts
6
+ interface AsyncCache<V> {
7
+ cached: (key: string, fn: () => Awaitable<V>) => V | PromiseLike<V>;
8
+ $value: <T>() => AsyncCache<T>;
9
+ invalidate: (key: string) => void;
10
+ }
11
+ //#endregion
12
+ //#region src/collections/mdx/runtime-browser.d.ts
13
+ interface MDXStoreBrowserData<Frontmatter, Attached = unknown> {
14
+ id: string;
15
+ preload: () => Awaitable<CompiledMDX<Frontmatter> & Attached>;
16
+ _store: StoreContext;
17
+ }
18
+ interface StoreContext {
19
+ storeId: string;
20
+ }
21
+ interface StoreData {
22
+ preloaded: AsyncCache<CompiledMDX>;
23
+ }
24
+ type GetFrontmatter<Config, Name extends string> = GetCollectionConfig<Config, Name> extends MDXCollection ? GetCollectionConfig<Config, Name>["$inferFrontmatter"] : never;
25
+ declare const _internal_data: Map<string, StoreData>;
26
+ declare function mdxStoreBrowser<Config, Name extends string, Attached>(name: Name, _input: Record<string, () => Promise<unknown>>): MapCollectionStore<string, MDXStoreBrowserData<GetFrontmatter<Config, Name>, Attached>>;
27
+ //#endregion
28
+ export { _internal_data as n, mdxStoreBrowser as r, MDXStoreBrowserData as t };
29
+ //# sourceMappingURL=runtime-browser-BT3GpIH7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-browser-BT3GpIH7.d.ts","names":[],"sources":["../src/utils/async-cache.ts","../src/collections/mdx/runtime-browser.ts"],"mappings":";;;;;UAGiB,UAAA;EACf,MAAA,GAAS,GAAA,UAAa,EAAA,QAAU,SAAA,CAAU,CAAA,MAAO,CAAA,GAAI,WAAA,CAAY,CAAA;EACjE,MAAA,WAAiB,UAAA,CAAW,CAAA;EAC5B,UAAA,GAAa,GAAA;AAAA;;;UCEE,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"}
@@ -0,0 +1,31 @@
1
+ import { E as Awaitable } from "./core-15rgY8JW.js";
2
+
3
+ //#region src/collections/runtime/store.d.ts
4
+ interface CollectionStore<Id, Data> {
5
+ /**
6
+ * type-only operation to cast data type, doesn't do any runtime transformation.
7
+ */
8
+ castData: <T>(_cast: (input: Data) => T) => CollectionStore<Id, T>;
9
+ get: (id: Id) => Awaitable<Data | undefined>;
10
+ list: () => Awaitable<Data[]>;
11
+ /**
12
+ * For typescript to infer data types, don't access the value of this property.
13
+ */
14
+ $inferData: Data;
15
+ }
16
+ declare class MapCollectionStore<Id, Data> implements CollectionStore<Id, Data> {
17
+ private readonly dataMap;
18
+ private readonly dataList;
19
+ constructor(input: Map<Id, Data>);
20
+ get(id: Id): Data | undefined;
21
+ list(): Data[];
22
+ castData<T>(_cast: (input: Data) => T): MapCollectionStore<Id, T>;
23
+ /**
24
+ * transform entry and create a new store
25
+ */
26
+ transform<$Id, T>(fn: (id: Id, data: Data) => [$Id, T]): MapCollectionStore<$Id, T>;
27
+ get $inferData(): Data;
28
+ }
29
+ //#endregion
30
+ export { MapCollectionStore as n, CollectionStore as t };
31
+ //# sourceMappingURL=store-Cc6y2CDE.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-Cc6y2CDE.d.ts","names":[],"sources":["../src/collections/runtime/store.ts"],"mappings":";;;UAEiB,eAAA;;AAAjB;;EAIE,QAAA,MAAc,KAAA,GAAQ,KAAA,EAAO,IAAA,KAAS,CAAA,KAAM,eAAA,CAAgB,EAAA,EAAI,CAAA;EAEhE,GAAA,GAAM,EAAA,EAAI,EAAA,KAAO,SAAA,CAAU,IAAA;EAC3B,IAAA,QAAY,SAAA,CAAU,IAAA;EAHsC;;;EAQ5D,UAAA,EAAY,IAAA;AAAA;AAAA,cAGD,kBAAA,sBAAwC,eAAA,CAAgB,EAAA,EAAI,IAAA;EAAA,iBACtD,OAAA;EAAA,iBACA,QAAA;cAEL,KAAA,EAAO,GAAA,CAAI,EAAA,EAAI,IAAA;EAK3B,GAAA,CAAI,EAAA,EAAI,EAAA,GAAK,IAAA;EAIb,IAAA,CAAA,GAAQ,IAAA;EAIR,QAAA,GAAA,CAAY,KAAA,GAAQ,KAAA,EAAO,IAAA,KAAS,CAAA,GAAI,kBAAA,CAAmB,EAAA,EAAI,CAAA;EAhC5B;;;EAuCnC,SAAA,QAAA,CAAkB,EAAA,GAAK,EAAA,EAAI,EAAA,EAAI,IAAA,EAAM,IAAA,MAAU,GAAA,EAAK,CAAA,IAAK,kBAAA,CAAmB,GAAA,EAAK,CAAA;EAAA,IAW7E,UAAA,CAAA,GAAc,IAAA;AAAA"}
@@ -31,7 +31,7 @@ function getJSONSchema(schema) {
31
31
  libraryOptions: { unrepresentable: "any" }
32
32
  });
33
33
  }
34
-
35
34
  //#endregion
36
35
  export { getJSONSchema as n, validate as r, ValidationError as t };
37
- //# sourceMappingURL=validation-C3kXuveD.js.map
36
+
37
+ //# sourceMappingURL=validation-Bf_v2L3p.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation-C3kXuveD.js","names":[],"sources":["../src/utils/validation.ts"],"sourcesContent":["import type { StandardJSONSchemaV1, StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport class ValidationError extends Error {\n title: string;\n issues: readonly StandardSchemaV1.Issue[];\n\n constructor(message: string, issues: readonly StandardSchemaV1.Issue[]) {\n super(`${message}:\\n${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join(\"\\n\")}`);\n\n this.title = message;\n this.issues = issues;\n }\n\n async toStringFormatted() {\n // Handle ESM/CJS interop: picocolors is a CJS module that exports via\n // module.exports = createColors(). When dynamically imported in ESM context\n // (e.g., Next.js 16 Turbopack), the exports are wrapped under .default\n const picocolorsModule = await import(\"picocolors\");\n const picocolors = picocolorsModule.default ?? picocolorsModule;\n\n return [\n picocolors.bold(`[Fuma Content] ${this.title}:`),\n ...this.issues.map((issue) =>\n picocolors.redBright(\n `- ${picocolors.bold(issue.path?.join(\".\") ?? \"*\")}: ${issue.message}`,\n ),\n ),\n ].join(\"\\n\");\n }\n}\n\nexport async function validate<Schema extends StandardSchemaV1, Context>(\n schema: StandardSchemaV1 | ((context: Context) => StandardSchemaV1),\n data: unknown,\n context: Context,\n errorMessage: string,\n): Promise<StandardSchemaV1.InferOutput<Schema>> {\n if (typeof schema === \"function\" && !(\"~standard\" in schema)) {\n schema = schema(context);\n }\n\n if (\"~standard\" in schema) {\n const result = await (schema as StandardSchemaV1)[\"~standard\"].validate(data);\n\n if (result.issues) {\n throw new ValidationError(errorMessage, result.issues);\n }\n\n return result.value;\n }\n\n return data;\n}\n\n/**\n * get JSON Schema from a Standard Schema\n */\nexport function getJSONSchema(schema: StandardSchemaV1) {\n return (schema as unknown as Partial<StandardJSONSchemaV1>)[\"~standard\"]?.jsonSchema.input({\n target: \"draft-2020-12\",\n libraryOptions: {\n // for Zod\n unrepresentable: \"any\",\n },\n });\n}\n"],"mappings":";AAEA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CACA;CAEA,YAAY,SAAiB,QAA2C;AACtE,QAAM,GAAG,QAAQ,KAAK,OAAO,KAAK,UAAU,KAAK,MAAM,KAAK,IAAI,MAAM,UAAU,CAAC,KAAK,KAAK,GAAG;AAE9F,OAAK,QAAQ;AACb,OAAK,SAAS;;CAGhB,MAAM,oBAAoB;EAIxB,MAAM,mBAAmB,MAAM,OAAO;EACtC,MAAM,aAAa,iBAAiB,WAAW;AAE/C,SAAO,CACL,WAAW,KAAK,kBAAkB,KAAK,MAAM,GAAG,EAChD,GAAG,KAAK,OAAO,KAAK,UAClB,WAAW,UACT,KAAK,WAAW,KAAK,MAAM,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM,UAC9D,CACF,CACF,CAAC,KAAK,KAAK;;;AAIhB,eAAsB,SACpB,QACA,MACA,SACA,cAC+C;AAC/C,KAAI,OAAO,WAAW,cAAc,EAAE,eAAe,QACnD,UAAS,OAAO,QAAQ;AAG1B,KAAI,eAAe,QAAQ;EACzB,MAAM,SAAS,MAAO,OAA4B,aAAa,SAAS,KAAK;AAE7E,MAAI,OAAO,OACT,OAAM,IAAI,gBAAgB,cAAc,OAAO,OAAO;AAGxD,SAAO,OAAO;;AAGhB,QAAO;;;;;AAMT,SAAgB,cAAc,QAA0B;AACtD,QAAQ,OAAoD,cAAc,WAAW,MAAM;EACzF,QAAQ;EACR,gBAAgB,EAEd,iBAAiB,OAClB;EACF,CAAC"}
1
+ {"version":3,"file":"validation-Bf_v2L3p.js","names":[],"sources":["../src/utils/validation.ts"],"sourcesContent":["import type { StandardJSONSchemaV1, StandardSchemaV1 } from \"@standard-schema/spec\";\n\nexport class ValidationError extends Error {\n title: string;\n issues: readonly StandardSchemaV1.Issue[];\n\n constructor(message: string, issues: readonly StandardSchemaV1.Issue[]) {\n super(`${message}:\\n${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join(\"\\n\")}`);\n\n this.title = message;\n this.issues = issues;\n }\n\n async toStringFormatted() {\n // Handle ESM/CJS interop: picocolors is a CJS module that exports via\n // module.exports = createColors(). When dynamically imported in ESM context\n // (e.g., Next.js 16 Turbopack), the exports are wrapped under .default\n const picocolorsModule = await import(\"picocolors\");\n const picocolors = picocolorsModule.default ?? picocolorsModule;\n\n return [\n picocolors.bold(`[Fuma Content] ${this.title}:`),\n ...this.issues.map((issue) =>\n picocolors.redBright(\n `- ${picocolors.bold(issue.path?.join(\".\") ?? \"*\")}: ${issue.message}`,\n ),\n ),\n ].join(\"\\n\");\n }\n}\n\nexport async function validate<Schema extends StandardSchemaV1, Context>(\n schema: StandardSchemaV1 | ((context: Context) => StandardSchemaV1),\n data: unknown,\n context: Context,\n errorMessage: string,\n): Promise<StandardSchemaV1.InferOutput<Schema>> {\n if (typeof schema === \"function\" && !(\"~standard\" in schema)) {\n schema = schema(context);\n }\n\n if (\"~standard\" in schema) {\n const result = await (schema as StandardSchemaV1)[\"~standard\"].validate(data);\n\n if (result.issues) {\n throw new ValidationError(errorMessage, result.issues);\n }\n\n return result.value;\n }\n\n return data;\n}\n\n/**\n * get JSON Schema from a Standard Schema\n */\nexport function getJSONSchema(schema: StandardSchemaV1) {\n return (schema as unknown as Partial<StandardJSONSchemaV1>)[\"~standard\"]?.jsonSchema.input({\n target: \"draft-2020-12\",\n libraryOptions: {\n // for Zod\n unrepresentable: \"any\",\n },\n });\n}\n"],"mappings":";AAEA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CACA;CAEA,YAAY,SAAiB,QAA2C;AACtE,QAAM,GAAG,QAAQ,KAAK,OAAO,KAAK,UAAU,KAAK,MAAM,KAAK,IAAI,MAAM,UAAU,CAAC,KAAK,KAAK,GAAG;AAE9F,OAAK,QAAQ;AACb,OAAK,SAAS;;CAGhB,MAAM,oBAAoB;EAIxB,MAAM,mBAAmB,MAAM,OAAO;EACtC,MAAM,aAAa,iBAAiB,WAAW;AAE/C,SAAO,CACL,WAAW,KAAK,kBAAkB,KAAK,MAAM,GAAG,EAChD,GAAG,KAAK,OAAO,KAAK,UAClB,WAAW,UACT,KAAK,WAAW,KAAK,MAAM,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM,UAC9D,CACF,CACF,CAAC,KAAK,KAAK;;;AAIhB,eAAsB,SACpB,QACA,MACA,SACA,cAC+C;AAC/C,KAAI,OAAO,WAAW,cAAc,EAAE,eAAe,QACnD,UAAS,OAAO,QAAQ;AAG1B,KAAI,eAAe,QAAQ;EACzB,MAAM,SAAS,MAAO,OAA4B,aAAa,SAAS,KAAK;AAE7E,MAAI,OAAO,OACT,OAAM,IAAI,gBAAgB,cAAc,OAAO,OAAO;AAGxD,SAAO,OAAO;;AAGhB,QAAO;;;;;AAMT,SAAgB,cAAc,QAA0B;AACtD,QAAQ,OAAoD,cAAc,WAAW,MAAM;EACzF,QAAQ;EACR,gBAAgB,EAEd,iBAAiB,OAClB;EACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as CoreOptions, t as Core } from "../core-FjA_Xoho.js";
1
+ import { n as CoreOptions, t as Core } from "../core-15rgY8JW.js";
2
2
  import { PluginOption } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
@@ -1,6 +1,5 @@
1
- import { t as Core } from "../core-BuUsOElL.js";
1
+ import { t as Core } from "../core-BfIQeHzH.js";
2
2
  import { loaderPlugin } from "../plugins/loader/index.js";
3
-
4
3
  //#region src/vite/index.ts
5
4
  async function content(config, pluginOpitons = {}) {
6
5
  const { clean = true } = pluginOpitons;
@@ -27,12 +26,12 @@ function createViteCore({ configPath, outDir, cwd }) {
27
26
  });
28
27
  }
29
28
  async function createStandaloneCore(pluginOptions = {}) {
30
- const { loadConfig } = await import("../load-from-file-B9ho46XM.js").then((n) => n.n);
29
+ const { loadConfig } = await import("../load-from-file-C3CnD8mJ.js").then((n) => n.n);
31
30
  const core = createViteCore(pluginOptions);
32
31
  await core.init({ config: loadConfig(core, true) });
33
32
  return core;
34
33
  }
35
-
36
34
  //#endregion
37
35
  export { createStandaloneCore, content as default };
36
+
38
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/vite/index.ts"],"sourcesContent":["import type { PluginOption } from \"vite\";\nimport type { FSWatcher } from \"chokidar\";\nimport { Core, CoreOptions, type Plugin } from \"@/core\";\nimport { loaderPlugin } from \"@/plugins/loader\";\n\nexport interface PluginOptions extends Pick<CoreOptions, \"configPath\" | \"cwd\" | \"outDir\"> {\n /**\n * clean output directory on start\n *\n * @defaultValue true\n */\n clean?: boolean;\n}\n\nexport default async function content(\n config: Record<string, unknown>,\n pluginOpitons: PluginOptions = {},\n): Promise<PluginOption[]> {\n const { clean = true } = pluginOpitons;\n const core = createViteCore(pluginOpitons);\n await core.init({\n config,\n });\n\n const ctx = core.getPluginContext();\n return [\n ...core.getPlugins(true).map((plugin) => plugin.vite?.createPlugin?.call(ctx)),\n {\n name: \"fuma-content\",\n async buildStart() {\n if (clean) await core.clearOutputDirectory();\n await core.emit({ write: true });\n },\n async configureServer(server) {\n await core.initServer({\n watcher: server.watcher as unknown as FSWatcher,\n });\n },\n },\n ];\n}\n\nfunction createViteCore({ configPath, outDir, cwd }: PluginOptions) {\n return new Core({\n cwd,\n configPath,\n outDir,\n plugins: [loaderPlugin()],\n });\n}\n\nexport async function createStandaloneCore(pluginOptions: PluginOptions = {}) {\n const { loadConfig } = await import(\"@/config/load-from-file\");\n const core = createViteCore(pluginOptions);\n await core.init({\n config: loadConfig(core, true),\n });\n return core;\n}\n"],"mappings":";;;;AAcA,eAA8B,QAC5B,QACA,gBAA+B,EAAE,EACR;CACzB,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,OAAO,eAAe,cAAc;AAC1C,OAAM,KAAK,KAAK,EACd,QACD,CAAC;CAEF,MAAM,MAAM,KAAK,kBAAkB;AACnC,QAAO,CACL,GAAG,KAAK,WAAW,KAAK,CAAC,KAAK,WAAW,OAAO,MAAM,cAAc,KAAK,IAAI,CAAC,EAC9E;EACE,MAAM;EACN,MAAM,aAAa;AACjB,OAAI,MAAO,OAAM,KAAK,sBAAsB;AAC5C,SAAM,KAAK,KAAK,EAAE,OAAO,MAAM,CAAC;;EAElC,MAAM,gBAAgB,QAAQ;AAC5B,SAAM,KAAK,WAAW,EACpB,SAAS,OAAO,SACjB,CAAC;;EAEL,CACF;;AAGH,SAAS,eAAe,EAAE,YAAY,QAAQ,OAAsB;AAClE,QAAO,IAAI,KAAK;EACd;EACA;EACA;EACA,SAAS,CAAC,cAAc,CAAC;EAC1B,CAAC;;AAGJ,eAAsB,qBAAqB,gBAA+B,EAAE,EAAE;CAC5E,MAAM,EAAE,eAAe,MAAM,OAAO;CACpC,MAAM,OAAO,eAAe,cAAc;AAC1C,OAAM,KAAK,KAAK,EACd,QAAQ,WAAW,MAAM,KAAK,EAC/B,CAAC;AACF,QAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/vite/index.ts"],"sourcesContent":["import type { PluginOption } from \"vite\";\nimport type { FSWatcher } from \"chokidar\";\nimport { Core, CoreOptions, type Plugin } from \"@/core\";\nimport { loaderPlugin } from \"@/plugins/loader\";\n\nexport interface PluginOptions extends Pick<CoreOptions, \"configPath\" | \"cwd\" | \"outDir\"> {\n /**\n * clean output directory on start\n *\n * @defaultValue true\n */\n clean?: boolean;\n}\n\nexport default async function content(\n config: Record<string, unknown>,\n pluginOpitons: PluginOptions = {},\n): Promise<PluginOption[]> {\n const { clean = true } = pluginOpitons;\n const core = createViteCore(pluginOpitons);\n await core.init({\n config,\n });\n\n const ctx = core.getPluginContext();\n return [\n ...core.getPlugins(true).map((plugin) => plugin.vite?.createPlugin?.call(ctx)),\n {\n name: \"fuma-content\",\n async buildStart() {\n if (clean) await core.clearOutputDirectory();\n await core.emit({ write: true });\n },\n async configureServer(server) {\n await core.initServer({\n watcher: server.watcher as unknown as FSWatcher,\n });\n },\n },\n ];\n}\n\nfunction createViteCore({ configPath, outDir, cwd }: PluginOptions) {\n return new Core({\n cwd,\n configPath,\n outDir,\n plugins: [loaderPlugin()],\n });\n}\n\nexport async function createStandaloneCore(pluginOptions: PluginOptions = {}) {\n const { loadConfig } = await import(\"@/config/load-from-file\");\n const core = createViteCore(pluginOptions);\n await core.init({\n config: loadConfig(core, true),\n });\n return core;\n}\n"],"mappings":";;;AAcA,eAA8B,QAC5B,QACA,gBAA+B,EAAE,EACR;CACzB,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,OAAO,eAAe,cAAc;AAC1C,OAAM,KAAK,KAAK,EACd,QACD,CAAC;CAEF,MAAM,MAAM,KAAK,kBAAkB;AACnC,QAAO,CACL,GAAG,KAAK,WAAW,KAAK,CAAC,KAAK,WAAW,OAAO,MAAM,cAAc,KAAK,IAAI,CAAC,EAC9E;EACE,MAAM;EACN,MAAM,aAAa;AACjB,OAAI,MAAO,OAAM,KAAK,sBAAsB;AAC5C,SAAM,KAAK,KAAK,EAAE,OAAO,MAAM,CAAC;;EAElC,MAAM,gBAAgB,QAAQ;AAC5B,SAAM,KAAK,WAAW,EACpB,SAAS,OAAO,SACjB,CAAC;;EAEL,CACF;;AAGH,SAAS,eAAe,EAAE,YAAY,QAAQ,OAAsB;AAClE,QAAO,IAAI,KAAK;EACd;EACA;EACA;EACA,SAAS,CAAC,cAAc,CAAC;EAC1B,CAAC;;AAGJ,eAAsB,qBAAqB,gBAA+B,EAAE,EAAE;CAC5E,MAAM,EAAE,eAAe,MAAM,OAAO,iCAAA,MAAA,MAAA,EAAA,EAAA;CACpC,MAAM,OAAO,eAAe,cAAc;AAC1C,OAAM,KAAK,KAAK,EACd,QAAQ,WAAW,MAAM,KAAK,EAC/B,CAAC;AACF,QAAO"}
@@ -1,5 +1,4 @@
1
1
  import { parse } from "node:querystring";
2
-
3
2
  //#region src/plugins/loader/vite.ts
4
3
  function toVite(name, test, loader) {
5
4
  return {
@@ -27,7 +26,7 @@ function toVite(name, test, loader) {
27
26
  }
28
27
  };
29
28
  }
30
-
31
29
  //#endregion
32
30
  export { toVite };
33
- //# sourceMappingURL=vite-CoJIMNWk.js.map
31
+
32
+ //# sourceMappingURL=vite-DVIOnBqW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-CoJIMNWk.js","names":[],"sources":["../src/plugins/loader/vite.ts"],"sourcesContent":["import type { SourceMap } from \"rollup\";\nimport type { PluginOption } from \"vite\";\nimport { parse } from \"node:querystring\";\nimport type { Loader } from \"@/plugins/loader\";\n\nexport function toVite(name: string, test: RegExp | undefined, loader: Loader): PluginOption {\n return {\n name: `fuma-content:${name}`,\n async transform(value, id) {\n if (test && !test.test(id)) return;\n\n const [file, query = \"\"] = id.split(\"?\", 2);\n const result = await loader.load({\n filePath: file,\n query: parse(query),\n getSource() {\n return value;\n },\n development: this.environment.mode === \"dev\",\n addDependency: (file) => {\n this.addWatchFile(file);\n },\n });\n\n if (result === null) return null;\n return {\n code: result.code,\n map: result.map as SourceMap,\n moduleType: result.moduleType,\n };\n },\n };\n}\n"],"mappings":";;;AAKA,SAAgB,OAAO,MAAc,MAA0B,QAA8B;AAC3F,QAAO;EACL,MAAM,gBAAgB;EACtB,MAAM,UAAU,OAAO,IAAI;AACzB,OAAI,QAAQ,CAAC,KAAK,KAAK,GAAG,CAAE;GAE5B,MAAM,CAAC,MAAM,QAAQ,MAAM,GAAG,MAAM,KAAK,EAAE;GAC3C,MAAM,SAAS,MAAM,OAAO,KAAK;IAC/B,UAAU;IACV,OAAO,MAAM,MAAM;IACnB,YAAY;AACV,YAAO;;IAET,aAAa,KAAK,YAAY,SAAS;IACvC,gBAAgB,SAAS;AACvB,UAAK,aAAa,KAAK;;IAE1B,CAAC;AAEF,OAAI,WAAW,KAAM,QAAO;AAC5B,UAAO;IACL,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,YAAY,OAAO;IACpB;;EAEJ"}
1
+ {"version":3,"file":"vite-DVIOnBqW.js","names":[],"sources":["../src/plugins/loader/vite.ts"],"sourcesContent":["import type { SourceMap } from \"rollup\";\nimport type { PluginOption } from \"vite\";\nimport { parse } from \"node:querystring\";\nimport type { Loader } from \"@/plugins/loader\";\n\nexport function toVite(name: string, test: RegExp | undefined, loader: Loader): PluginOption {\n return {\n name: `fuma-content:${name}`,\n async transform(value, id) {\n if (test && !test.test(id)) return;\n\n const [file, query = \"\"] = id.split(\"?\", 2);\n const result = await loader.load({\n filePath: file,\n query: parse(query),\n getSource() {\n return value;\n },\n development: this.environment.mode === \"dev\",\n addDependency: (file) => {\n this.addWatchFile(file);\n },\n });\n\n if (result === null) return null;\n return {\n code: result.code,\n map: result.map as SourceMap,\n moduleType: result.moduleType,\n };\n },\n };\n}\n"],"mappings":";;AAKA,SAAgB,OAAO,MAAc,MAA0B,QAA8B;AAC3F,QAAO;EACL,MAAM,gBAAgB;EACtB,MAAM,UAAU,OAAO,IAAI;AACzB,OAAI,QAAQ,CAAC,KAAK,KAAK,GAAG,CAAE;GAE5B,MAAM,CAAC,MAAM,QAAQ,MAAM,GAAG,MAAM,KAAK,EAAE;GAC3C,MAAM,SAAS,MAAM,OAAO,KAAK;IAC/B,UAAU;IACV,OAAO,MAAM,MAAM;IACnB,YAAY;AACV,YAAO;;IAET,aAAa,KAAK,YAAY,SAAS;IACvC,gBAAgB,SAAS;AACvB,UAAK,aAAa,KAAK;;IAE1B,CAAC;AAEF,OAAI,WAAW,KAAM,QAAO;AAC5B,UAAO;IACL,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,YAAY,OAAO;IACpB;;EAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma-content",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "The content processing layer for your app.",
5
5
  "keywords": [
6
6
  "Content",
@@ -15,58 +15,38 @@
15
15
  "dist/*"
16
16
  ],
17
17
  "type": "module",
18
- "main": "./dist/index.js",
19
18
  "types": "./dist/index.d.ts",
20
19
  "exports": {
21
- "./config": {
22
- "types": "./dist/config/index.d.ts",
23
- "import": "./dist/config/index.js"
24
- },
25
- "./dynamic": {
26
- "types": "./dist/dynamic.d.ts",
27
- "import": "./dist/dynamic.js"
28
- },
29
- "./next": {
30
- "types": "./dist/next/index.d.ts",
31
- "import": "./dist/next/index.js"
32
- },
33
- "./vite": {
34
- "types": "./dist/vite/index.d.ts",
35
- "import": "./dist/vite/index.js"
36
- },
37
- ".": {
38
- "types": "./dist/index.d.ts",
39
- "import": "./dist/index.js"
40
- },
41
- "./collections": {
42
- "types": "./dist/collections/index.d.ts",
43
- "import": "./dist/collections/index.js"
44
- },
45
- "./collections/mdx/react": {
46
- "types": "./dist/collections/mdx/react.d.ts",
47
- "import": "./dist/collections/mdx/react.js"
48
- },
49
- "./collections/*": {
50
- "types": "./dist/collections/*.d.ts",
51
- "import": "./dist/collections/*.js",
52
- "default": "./dist/collections/*.js"
53
- },
54
- "./node": {
55
- "types": "./dist/node/index.d.ts",
56
- "import": "./dist/node/index.js"
57
- },
58
- "./bun": {
59
- "types": "./dist/bun/index.d.ts",
60
- "import": "./dist/bun/index.js"
61
- },
62
- "./plugins/loader": {
63
- "types": "./dist/plugins/loader/index.d.ts",
64
- "import": "./dist/plugins/loader/index.js"
65
- },
66
- "./plugins/*": {
67
- "types": "./dist/plugins/*.d.ts",
68
- "import": "./dist/plugins/*.js"
69
- }
20
+ ".": "./dist/index.js",
21
+ "./bun": "./dist/bun/index.js",
22
+ "./collections": "./dist/collections/index.js",
23
+ "./collections/data": "./dist/collections/data.js",
24
+ "./collections/data/runtime": "./dist/collections/data/runtime.js",
25
+ "./collections/fs": "./dist/collections/fs.js",
26
+ "./collections/json/loader-webpack": "./dist/collections/json/loader-webpack.js",
27
+ "./collections/mdx": "./dist/collections/mdx.js",
28
+ "./collections/mdx/loader-webpack": "./dist/collections/mdx/loader-webpack.js",
29
+ "./collections/mdx/react": "./dist/collections/mdx/react.js",
30
+ "./collections/mdx/runtime": "./dist/collections/mdx/runtime.js",
31
+ "./collections/mdx/runtime-browser": "./dist/collections/mdx/runtime-browser.js",
32
+ "./collections/mdx/runtime-dynamic": "./dist/collections/mdx/runtime-dynamic.js",
33
+ "./collections/mdx/vue": "./dist/collections/mdx/vue.js",
34
+ "./collections/obsidian": "./dist/collections/obsidian.js",
35
+ "./collections/runtime/file-store": "./dist/collections/runtime/file-store.js",
36
+ "./collections/runtime/store": "./dist/collections/runtime/store.js",
37
+ "./collections/yaml/loader-webpack": "./dist/collections/yaml/loader-webpack.js",
38
+ "./config": "./dist/config/index.js",
39
+ "./dynamic": "./dist/dynamic.js",
40
+ "./next": "./dist/next/index.js",
41
+ "./node": "./dist/node/index.js",
42
+ "./node/loader": "./dist/node/loader.js",
43
+ "./plugins/git": "./dist/plugins/git.js",
44
+ "./plugins/json-schema": "./dist/plugins/json-schema.js",
45
+ "./plugins/loader": "./dist/plugins/loader/index.js",
46
+ "./plugins/loader/webpack": "./dist/plugins/loader/webpack.js",
47
+ "./plugins/remark/include": "./dist/plugins/remark/include.js",
48
+ "./vite": "./dist/vite/index.js",
49
+ "./package.json": "./package.json"
70
50
  },
71
51
  "publishConfig": {
72
52
  "access": "public"
@@ -75,7 +55,7 @@
75
55
  "@mdx-js/mdx": "^3.1.1",
76
56
  "@standard-schema/spec": "^1.1.0",
77
57
  "chokidar": "^5.0.0",
78
- "esbuild": "^0.27.3",
58
+ "esbuild": "^0.27.4",
79
59
  "estree-util-value-to-estree": "^3.5.0",
80
60
  "github-slugger": "^2.0.0",
81
61
  "js-yaml": "^4.1.1",
@@ -92,29 +72,30 @@
92
72
  "zod": "^4.3.6"
93
73
  },
94
74
  "devDependencies": {
95
- "@types/bun": "^1.3.9",
75
+ "@types/bun": "^1.3.10",
96
76
  "@types/js-yaml": "^4.0.9",
97
77
  "@types/mdast": "^4.0.4",
98
78
  "@types/mdx": "^2.0.13",
99
- "@types/node": "^25.2.3",
79
+ "@types/node": "^25.5.0",
100
80
  "@types/picomatch": "^4.0.2",
101
81
  "@types/react": "^19.2.14",
102
82
  "mdast-util-directive": "^3.1.0",
103
83
  "mdast-util-mdx-jsx": "^3.2.0",
84
+ "micromark-util-types": "^2.0.2",
104
85
  "next": "16.1.6",
105
86
  "react": "^19.2.4",
106
87
  "remark": "^15.0.1",
107
88
  "remark-directive": "^4.0.0",
108
89
  "remark-mdx": "^3.1.1",
109
90
  "remark-stringify": "^11.0.0",
110
- "rollup": "^4.57.1",
111
- "tsdown": "^0.20.3",
91
+ "rollup": "^4.59.0",
92
+ "tsdown": "^0.21.2",
112
93
  "typescript": "^5.9.3",
113
94
  "unplugin-vue": "^7.1.1",
114
- "vite": "^7.3.1",
115
- "vue": "^3.5.28",
116
- "vue-tsc": "^3.2.4",
117
- "webpack": "^5.105.1",
95
+ "vite": "^8.0.0",
96
+ "vue": "^3.5.30",
97
+ "vue-tsc": "^3.2.5",
98
+ "webpack": "^5.105.4",
118
99
  "typescript-config": "0.0.0"
119
100
  },
120
101
  "peerDependencies": {
@@ -122,7 +103,7 @@
122
103
  "@types/mdx": "*",
123
104
  "next": "^15.3.0 || ^16.0.0",
124
105
  "react": "*",
125
- "vite": "6.x.x || 7.x.x",
106
+ "vite": "7.x.x || 8.x.x",
126
107
  "vue": "3.x.x"
127
108
  },
128
109
  "peerDependenciesMeta": {