fuma-content 1.0.2 → 1.1.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 (208) hide show
  1. package/dist/{async-cache-BM9Yf4Nw.js → async-cache-U87GzQTb.js} +1 -1
  2. package/dist/async-cache-U87GzQTb.js.map +1 -0
  3. package/dist/{build-mdx-C1PZsGp2.js → build-mdx-BZxE8t2a.js} +16 -11
  4. package/dist/build-mdx-BZxE8t2a.js.map +1 -0
  5. package/dist/build-mdx-LhpFasX-.js +4 -0
  6. package/dist/bun/index.d.ts +7 -4
  7. package/dist/bun/index.d.ts.map +1 -1
  8. package/dist/bun/index.js +25 -19
  9. package/dist/bun/index.js.map +1 -1
  10. package/dist/{bun-QKQnqgIi.js → bun-CBROq3I0.js} +3 -3
  11. package/dist/bun-CBROq3I0.js.map +1 -0
  12. package/dist/code-generator-CjC4EEXg.js +102 -0
  13. package/dist/code-generator-CjC4EEXg.js.map +1 -0
  14. package/dist/collections/data/runtime.d.ts +15 -0
  15. package/dist/collections/data/runtime.d.ts.map +1 -0
  16. package/dist/collections/{meta → data}/runtime.js +4 -4
  17. package/dist/collections/data/runtime.js.map +1 -0
  18. package/dist/collections/data.d.ts +47 -0
  19. package/dist/collections/data.d.ts.map +1 -0
  20. package/dist/collections/data.js +5 -0
  21. package/dist/collections/fs.d.ts +3 -0
  22. package/dist/collections/fs.js +3 -0
  23. package/dist/collections/index.d.ts +2 -2
  24. package/dist/collections/index.js +2 -15
  25. package/dist/collections/json/loader-webpack.d.ts +9 -0
  26. package/dist/collections/json/loader-webpack.d.ts.map +1 -0
  27. package/dist/collections/json/loader-webpack.js +15 -0
  28. package/dist/collections/json/loader-webpack.js.map +1 -0
  29. package/dist/collections/mdx/loader-webpack.d.ts +5 -5
  30. package/dist/collections/mdx/loader-webpack.d.ts.map +1 -1
  31. package/dist/collections/mdx/loader-webpack.js +11 -21
  32. package/dist/collections/mdx/loader-webpack.js.map +1 -1
  33. package/dist/collections/mdx/react.d.ts +22 -0
  34. package/dist/collections/mdx/react.d.ts.map +1 -0
  35. package/dist/collections/mdx/react.js +35 -0
  36. package/dist/collections/mdx/react.js.map +1 -0
  37. package/dist/collections/mdx/runtime-browser.d.ts +11 -45
  38. package/dist/collections/mdx/runtime-browser.js +6 -44
  39. package/dist/collections/mdx/runtime-browser.js.map +1 -1
  40. package/dist/collections/mdx/runtime-dynamic.d.ts +16 -28
  41. package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
  42. package/dist/collections/mdx/runtime-dynamic.js +19 -23
  43. package/dist/collections/mdx/runtime-dynamic.js.map +1 -1
  44. package/dist/collections/mdx/runtime.d.ts +10 -49
  45. package/dist/collections/mdx/runtime.js +2 -11
  46. package/dist/collections/mdx/runtime.js.map +1 -1
  47. package/dist/collections/mdx.d.ts +6 -2
  48. package/dist/collections/mdx.js +6 -246
  49. package/dist/collections/runtime/file-store.d.ts +4 -22
  50. package/dist/collections/runtime/file-store.js +15 -14
  51. package/dist/collections/runtime/file-store.js.map +1 -1
  52. package/dist/collections/runtime/store.d.ts +3 -3
  53. package/dist/collections/runtime/store.js +2 -2
  54. package/dist/collections/yaml/loader-webpack.d.ts +9 -0
  55. package/dist/collections/yaml/loader-webpack.d.ts.map +1 -0
  56. package/dist/collections/yaml/loader-webpack.js +15 -0
  57. package/dist/collections/yaml/loader-webpack.js.map +1 -0
  58. package/dist/collections-DNFRdCuB.js +98 -0
  59. package/dist/collections-DNFRdCuB.js.map +1 -0
  60. package/dist/config/index.d.ts +1 -1
  61. package/dist/config/index.js.map +1 -1
  62. package/dist/core-BO3b8jMg.d.ts +313 -0
  63. package/dist/core-BO3b8jMg.d.ts.map +1 -0
  64. package/dist/core-D5QHSKk6.js +223 -0
  65. package/dist/core-D5QHSKk6.js.map +1 -0
  66. package/dist/data-9h98oZwj.js +158 -0
  67. package/dist/data-9h98oZwj.js.map +1 -0
  68. package/dist/dynamic-CTYYdl7_.d.ts +33 -0
  69. package/dist/dynamic-CTYYdl7_.d.ts.map +1 -0
  70. package/dist/{dynamic-B40uAtdo.js → dynamic-DhKTOrIl.js} +8 -7
  71. package/dist/dynamic-DhKTOrIl.js.map +1 -0
  72. package/dist/dynamic.d.ts +3 -0
  73. package/dist/dynamic.js +3 -0
  74. package/dist/file-store-laO4IjvB.d.ts +21 -0
  75. package/dist/file-store-laO4IjvB.d.ts.map +1 -0
  76. package/dist/fs-D34Sztbh.d.ts +44 -0
  77. package/dist/fs-D34Sztbh.d.ts.map +1 -0
  78. package/dist/fs-WWbLA7Gx.js +66 -0
  79. package/dist/fs-WWbLA7Gx.js.map +1 -0
  80. package/dist/{fuma-matter-O4fA6nSx.js → fuma-matter-BuBO2w-p.js} +2 -2
  81. package/dist/fuma-matter-BuBO2w-p.js.map +1 -0
  82. package/dist/git-2CjUW3M5.d.ts +37 -0
  83. package/dist/git-2CjUW3M5.d.ts.map +1 -0
  84. package/dist/git-CQWA37-X.js +60 -0
  85. package/dist/git-CQWA37-X.js.map +1 -0
  86. package/dist/index-Da88Sj8w.d.ts +87 -0
  87. package/dist/index-Da88Sj8w.d.ts.map +1 -0
  88. package/dist/index.d.ts +6 -2
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +4 -5
  91. package/dist/load-from-file-BZxc_BhC.js +3 -0
  92. package/dist/{load-from-file-1f4WaHsf.js → load-from-file-irx0JI6j.js} +5 -8
  93. package/dist/load-from-file-irx0JI6j.js.map +1 -0
  94. package/dist/loader-AIEwGc2f.js +9 -0
  95. package/dist/loader-BhXHF8vy.js +16 -0
  96. package/dist/loader-BhXHF8vy.js.map +1 -0
  97. package/dist/loader-BuR4gkKg.js +77 -0
  98. package/dist/loader-BuR4gkKg.js.map +1 -0
  99. package/dist/loader-BzQpSBvP.js +59 -0
  100. package/dist/loader-BzQpSBvP.js.map +1 -0
  101. package/dist/{loader-CXnMFuyE.js → loader-D6StkShK.js} +8 -7
  102. package/dist/loader-D6StkShK.js.map +1 -0
  103. package/dist/loader-DCK4RwOh.js +8 -0
  104. package/dist/loader-DwpOcxgh.js +17 -0
  105. package/dist/loader-DwpOcxgh.js.map +1 -0
  106. package/dist/loader-zsTVgQjO.js +8 -0
  107. package/dist/mdx-Dt9hirUu.d.ts +144 -0
  108. package/dist/mdx-Dt9hirUu.d.ts.map +1 -0
  109. package/dist/mdx-iZ2uP27Z.js +303 -0
  110. package/dist/mdx-iZ2uP27Z.js.map +1 -0
  111. package/dist/next/index.d.ts +6 -10
  112. package/dist/next/index.d.ts.map +1 -1
  113. package/dist/next/index.js +23 -31
  114. package/dist/next/index.js.map +1 -1
  115. package/dist/node/index.d.ts +8 -0
  116. package/dist/node/index.d.ts.map +1 -0
  117. package/dist/node/index.js +10 -0
  118. package/dist/node/index.js.map +1 -0
  119. package/dist/node/loader.d.ts +5 -2
  120. package/dist/node/loader.d.ts.map +1 -1
  121. package/dist/node/loader.js +17 -14
  122. package/dist/node/loader.js.map +1 -1
  123. package/dist/{node-CGIIJIcs.js → node-2VZOh3P9.js} +7 -5
  124. package/dist/node-2VZOh3P9.js.map +1 -0
  125. package/dist/plugins/git.d.ts +3 -2
  126. package/dist/plugins/git.js +2 -61
  127. package/dist/plugins/json-schema.d.ts +26 -2
  128. package/dist/plugins/json-schema.d.ts.map +1 -0
  129. package/dist/plugins/json-schema.js +42 -51
  130. package/dist/plugins/json-schema.js.map +1 -1
  131. package/dist/plugins/loader/index.d.ts +4 -0
  132. package/dist/plugins/loader/index.js +3 -0
  133. package/dist/plugins/loader/webpack.d.ts +4 -0
  134. package/dist/plugins/loader/webpack.js +60 -0
  135. package/dist/plugins/loader/webpack.js.map +1 -0
  136. package/dist/runtime-HN-HSB0Z.d.ts +31 -0
  137. package/dist/runtime-HN-HSB0Z.d.ts.map +1 -0
  138. package/dist/runtime-browser-BQEk7qjc.d.ts +29 -0
  139. package/dist/runtime-browser-BQEk7qjc.d.ts.map +1 -0
  140. package/dist/store-DiuGdV5M.d.ts +31 -0
  141. package/dist/store-DiuGdV5M.d.ts.map +1 -0
  142. package/dist/{store-0LQ2PlH6.js → store-IvpEBdxi.js} +4 -4
  143. package/dist/store-IvpEBdxi.js.map +1 -0
  144. package/dist/{validation-BOJKRAp5.js → validation-BvVvvLII.js} +11 -2
  145. package/dist/validation-BvVvvLII.js.map +1 -0
  146. package/dist/vite/index.d.ts +5 -15
  147. package/dist/vite/index.d.ts.map +1 -1
  148. package/dist/vite/index.js +24 -21
  149. package/dist/vite/index.js.map +1 -1
  150. package/dist/{vite-X-2Al8fq.js → vite-C1qXY47G.js} +4 -3
  151. package/dist/vite-C1qXY47G.js.map +1 -0
  152. package/package.json +51 -46
  153. package/dist/async-cache-BM9Yf4Nw.js.map +0 -1
  154. package/dist/build-D8A5ByFk.js +0 -42
  155. package/dist/build-D8A5ByFk.js.map +0 -1
  156. package/dist/build-mdx-C1PZsGp2.js.map +0 -1
  157. package/dist/build-mdx-DFndaVbS.js +0 -4
  158. package/dist/bun-QKQnqgIi.js.map +0 -1
  159. package/dist/code-generator-gPtrfZ6Q.js +0 -133
  160. package/dist/code-generator-gPtrfZ6Q.js.map +0 -1
  161. package/dist/collections/handlers/fs.d.ts +0 -2
  162. package/dist/collections/handlers/fs.js +0 -28
  163. package/dist/collections/handlers/fs.js.map +0 -1
  164. package/dist/collections/index.js.map +0 -1
  165. package/dist/collections/mdx/runtime-browser.d.ts.map +0 -1
  166. package/dist/collections/mdx/runtime.d.ts.map +0 -1
  167. package/dist/collections/mdx.js.map +0 -1
  168. package/dist/collections/meta/loader-webpack.d.ts +0 -9
  169. package/dist/collections/meta/loader-webpack.d.ts.map +0 -1
  170. package/dist/collections/meta/loader-webpack.js +0 -28
  171. package/dist/collections/meta/loader-webpack.js.map +0 -1
  172. package/dist/collections/meta/runtime.d.ts +0 -11
  173. package/dist/collections/meta/runtime.d.ts.map +0 -1
  174. package/dist/collections/meta/runtime.js.map +0 -1
  175. package/dist/collections/meta.d.ts +0 -2
  176. package/dist/collections/meta.js +0 -134
  177. package/dist/collections/meta.js.map +0 -1
  178. package/dist/collections/runtime/file-store.d.ts.map +0 -1
  179. package/dist/core-Bkh-SI_3.d.ts +0 -561
  180. package/dist/core-Bkh-SI_3.d.ts.map +0 -1
  181. package/dist/core-ZuoVBkeg.js +0 -170
  182. package/dist/core-ZuoVBkeg.js.map +0 -1
  183. package/dist/dynamic-B40uAtdo.js.map +0 -1
  184. package/dist/fuma-matter-O4fA6nSx.js.map +0 -1
  185. package/dist/load-from-file-1f4WaHsf.js.map +0 -1
  186. package/dist/load-from-file-BTNnBu6f.js +0 -3
  187. package/dist/loader-80abXEHx.js +0 -4
  188. package/dist/loader-BFhPyg3z.js +0 -4
  189. package/dist/loader-CXnMFuyE.js.map +0 -1
  190. package/dist/loader-gk94iHf5.js +0 -66
  191. package/dist/loader-gk94iHf5.js.map +0 -1
  192. package/dist/next/index.cjs +0 -502
  193. package/dist/node-CGIIJIcs.js.map +0 -1
  194. package/dist/pipe-5cnvE6KY.js +0 -31
  195. package/dist/pipe-5cnvE6KY.js.map +0 -1
  196. package/dist/plugins/git.js.map +0 -1
  197. package/dist/plugins/with-loader/index.d.ts +0 -2
  198. package/dist/plugins/with-loader/index.js +0 -28
  199. package/dist/plugins/with-loader/index.js.map +0 -1
  200. package/dist/plugins/with-loader/webpack.d.ts +0 -19
  201. package/dist/plugins/with-loader/webpack.d.ts.map +0 -1
  202. package/dist/plugins/with-loader/webpack.js +0 -43
  203. package/dist/plugins/with-loader/webpack.js.map +0 -1
  204. package/dist/store-0LQ2PlH6.js.map +0 -1
  205. package/dist/store-DEjYYF6a.d.ts +0 -31
  206. package/dist/store-DEjYYF6a.d.ts.map +0 -1
  207. package/dist/validation-BOJKRAp5.js.map +0 -1
  208. package/dist/vite-X-2Al8fq.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { parse } from "node:querystring";
2
2
 
3
- //#region src/plugins/with-loader/vite.ts
3
+ //#region src/plugins/loader/vite.ts
4
4
  function toVite(name, test, loader) {
5
5
  return {
6
6
  name: `fuma-content:${name}`,
@@ -21,7 +21,8 @@ function toVite(name, test, loader) {
21
21
  if (result === null) return null;
22
22
  return {
23
23
  code: result.code,
24
- map: result.map
24
+ map: result.map,
25
+ moduleType: result.moduleType
25
26
  };
26
27
  }
27
28
  };
@@ -29,4 +30,4 @@ function toVite(name, test, loader) {
29
30
 
30
31
  //#endregion
31
32
  export { toVite };
32
- //# sourceMappingURL=vite-X-2Al8fq.js.map
33
+ //# sourceMappingURL=vite-C1qXY47G.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-C1qXY47G.js","names":["file"],"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 compiler: {\n addDependency: (file) => {\n this.addWatchFile(file);\n },\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,UAAU,EACR,gBAAgB,WAAS;AACvB,UAAK,aAAaA,OAAK;OAE1B;IACF,CAAC;AAEF,OAAI,WAAW,KAAM,QAAO;AAC5B,UAAO;IACL,MAAM,OAAO;IACb,KAAK,OAAO;IACZ,YAAY,OAAO;IACpB;;EAEJ"}
package/package.json CHANGED
@@ -1,71 +1,80 @@
1
1
  {
2
2
  "name": "fuma-content",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "The content processing layer for your app.",
5
5
  "keywords": [
6
- "Docs",
7
- "Contentlayer"
6
+ "Content",
7
+ "Docs"
8
8
  ],
9
- "repository": "github:fuma-nama/fuma-content",
9
+ "homepage": "https://fuma-content.vercel.app",
10
10
  "license": "MIT",
11
11
  "author": "Fuma Nama",
12
- "homepage": "https://fuma-content.vercel.app",
12
+ "repository": "github:fuma-nama/fuma-content",
13
+ "bin": "./dist/bin.js",
14
+ "files": [
15
+ "dist/*"
16
+ ],
13
17
  "type": "module",
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
14
20
  "exports": {
15
21
  "./config": {
16
- "import": "./dist/config/index.js",
17
- "types": "./dist/config/index.d.ts"
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"
18
28
  },
19
29
  "./next": {
20
- "import": "./dist/next/index.js",
21
30
  "types": "./dist/next/index.d.ts",
22
- "require": "./dist/next/index.cjs"
31
+ "import": "./dist/next/index.js"
23
32
  },
24
33
  "./vite": {
25
- "import": "./dist/vite/index.js",
26
- "types": "./dist/vite/index.d.ts"
34
+ "types": "./dist/vite/index.d.ts",
35
+ "import": "./dist/vite/index.js"
27
36
  },
28
37
  ".": {
29
- "import": "./dist/index.js",
30
- "types": "./dist/index.d.ts"
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js"
31
40
  },
32
41
  "./collections": {
33
- "import": "./dist/collections/index.js",
34
- "types": "./dist/collections/index.d.ts"
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"
35
48
  },
36
49
  "./collections/*": {
37
- "import": "./dist/collections/*.js",
38
50
  "types": "./dist/collections/*.d.ts",
51
+ "import": "./dist/collections/*.js",
39
52
  "default": "./dist/collections/*.js"
40
53
  },
41
- "./node/loader": {
42
- "import": "./dist/node/loader.js",
43
- "types": "./dist/node/loader.d.ts"
54
+ "./node": {
55
+ "types": "./dist/node/index.d.ts",
56
+ "import": "./dist/node/index.js"
44
57
  },
45
58
  "./bun": {
46
- "import": "./dist/bun/index.js",
47
- "types": "./dist/bun/index.d.ts"
59
+ "types": "./dist/bun/index.d.ts",
60
+ "import": "./dist/bun/index.js"
48
61
  },
49
- "./plugins/with-loader": {
50
- "import": "./dist/plugins/with-loader/index.js",
51
- "types": "./dist/plugins/with-loader/index.d.ts"
62
+ "./plugins/loader": {
63
+ "types": "./dist/plugins/loader/index.d.ts",
64
+ "import": "./dist/plugins/loader/index.js"
52
65
  },
53
66
  "./plugins/*": {
54
- "import": "./dist/plugins/*.js",
55
- "types": "./dist/plugins/*.d.ts"
67
+ "types": "./dist/plugins/*.d.ts",
68
+ "import": "./dist/plugins/*.js"
56
69
  }
57
70
  },
58
- "main": "./dist/index.js",
59
- "types": "./dist/index.d.ts",
60
- "bin": "./dist/bin.js",
61
- "files": [
62
- "dist/*",
63
- "loader-mdx.cjs",
64
- "loader-meta.cjs"
65
- ],
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
66
74
  "dependencies": {
67
75
  "@mdx-js/mdx": "^3.1.1",
68
76
  "@standard-schema/spec": "^1.1.0",
77
+ "@types/mdx": "^2.0.13",
69
78
  "chokidar": "^5.0.0",
70
79
  "esbuild": "^0.27.2",
71
80
  "estree-util-value-to-estree": "^3.5.0",
@@ -80,28 +89,27 @@
80
89
  "unist-util-remove-position": "^5.0.0",
81
90
  "unist-util-visit": "^5.0.0",
82
91
  "vfile": "^6.0.3",
83
- "zod": "^4.2.1"
92
+ "zod": "^4.3.5"
84
93
  },
85
94
  "devDependencies": {
86
- "@types/bun": "^1.3.5",
95
+ "@types/bun": "^1.3.6",
87
96
  "@types/js-yaml": "^4.0.9",
88
97
  "@types/mdast": "^4.0.4",
89
- "@types/mdx": "^2.0.13",
90
- "@types/node": "^24.10.4",
98
+ "@types/node": "^25.0.9",
91
99
  "@types/picomatch": "^4.0.2",
92
- "@types/react": "^19.2.7",
93
- "fumadocs-core": "^16.3.2",
100
+ "@types/react": "^19.2.8",
101
+ "fumadocs-core": "^16.4.7",
94
102
  "mdast-util-directive": "^3.1.0",
95
103
  "mdast-util-mdx-jsx": "^3.2.0",
96
- "next": "16.1.0",
104
+ "next": "16.1.3",
97
105
  "react": "^19.2.3",
98
106
  "remark": "^15.0.1",
99
107
  "remark-directive": "^4.0.0",
100
108
  "remark-stringify": "^11.0.0",
101
- "rollup": "^4.54.0",
109
+ "rollup": "^4.55.1",
102
110
  "tsdown": "^0.18.2",
103
111
  "typescript": "^5.9.3",
104
- "vite": "^7.3.0",
112
+ "vite": "^7.3.1",
105
113
  "webpack": "^5.104.1",
106
114
  "typescript-config": "0.0.0"
107
115
  },
@@ -121,9 +129,6 @@
121
129
  "optional": true
122
130
  }
123
131
  },
124
- "publishConfig": {
125
- "access": "public"
126
- },
127
132
  "scripts": {
128
133
  "build": "tsdown",
129
134
  "clean": "rimraf dist",
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-cache-BM9Yf4Nw.js","names":[],"sources":["../src/utils/async-cache.ts"],"sourcesContent":["export interface AsyncCache<V> {\n cached: (key: string, fn: () => V | Promise<V>) => V | Promise<V>;\n $value: <T>() => AsyncCache<T>;\n invalidate: (key: string) => void;\n}\n\n/**\n * cache for async resources, finished promises will be resolved into original value, otherwise wrapped with a promise.\n */\nexport function createCache<V>(\n store = new Map<string, V | Promise<V>>(),\n): AsyncCache<V> {\n return {\n cached(key, fn) {\n let cached = store.get(key);\n if (cached) return cached;\n\n cached = fn();\n if (cached instanceof Promise) {\n cached = cached.then((out) => {\n // replace with resolved if still exists\n if (store.has(key)) {\n store.set(key, out);\n }\n\n return out;\n });\n }\n store.set(key, cached);\n return cached;\n },\n invalidate(key) {\n store.delete(key);\n },\n $value<T>() {\n return this as unknown as AsyncCache<T>;\n },\n };\n}\n"],"mappings":";;;;AASA,SAAgB,YACd,wBAAQ,IAAI,KAA6B,EAC1B;AACf,QAAO;EACL,OAAO,KAAK,IAAI;GACd,IAAI,SAAS,MAAM,IAAI,IAAI;AAC3B,OAAI,OAAQ,QAAO;AAEnB,YAAS,IAAI;AACb,OAAI,kBAAkB,QACpB,UAAS,OAAO,MAAM,QAAQ;AAE5B,QAAI,MAAM,IAAI,IAAI,CAChB,OAAM,IAAI,KAAK,IAAI;AAGrB,WAAO;KACP;AAEJ,SAAM,IAAI,KAAK,OAAO;AACtB,UAAO;;EAET,WAAW,KAAK;AACd,SAAM,OAAO,IAAI;;EAEnB,SAAY;AACV,UAAO;;EAEV"}
@@ -1,42 +0,0 @@
1
- //#region src/config/build.ts
2
- /**
3
- * @param config - either the default export or all exports of config file.
4
- * @param workspace
5
- */
6
- function buildConfig(config, workspace) {
7
- const collections = /* @__PURE__ */ new Map();
8
- const loaded = {};
9
- let globalConfig;
10
- if ("default" in config) {
11
- globalConfig = config.default;
12
- for (const [k, v] of Object.entries(config)) {
13
- if (k === "default") continue;
14
- globalConfig.collections ??= {};
15
- globalConfig.collections[k] = v;
16
- }
17
- } else globalConfig = config;
18
- if (globalConfig.collections) for (const [name, collection] of Object.entries(globalConfig.collections)) {
19
- collection.init?.({
20
- name,
21
- workspace
22
- });
23
- collections.set(name, collection);
24
- }
25
- return {
26
- ...globalConfig,
27
- collections,
28
- workspaces: Object.fromEntries(Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {
29
- return [key, {
30
- dir: value.dir,
31
- config: buildConfig(value.config, {
32
- ...value,
33
- name: key
34
- })
35
- }];
36
- }))
37
- };
38
- }
39
-
40
- //#endregion
41
- export { buildConfig as t };
42
- //# sourceMappingURL=build-D8A5ByFk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-D8A5ByFk.js","names":["loaded: GlobalConfig","globalConfig: GlobalConfig"],"sources":["../src/config/build.ts"],"sourcesContent":["import type { GlobalConfig, WorkspaceConfig } from \"@/config/index\";\nimport type { Collection } from \"@/collections\";\n\nexport interface LoadedConfig extends Omit<\n GlobalConfig,\n \"workspaces\" | \"collections\"\n> {\n collections: Map<string, Collection>;\n workspaces: Record<\n string,\n {\n dir: string;\n config: LoadedConfig;\n }\n >;\n}\n\n/**\n * @param config - either the default export or all exports of config file.\n * @param workspace\n */\nexport function buildConfig(\n config: Record<string, unknown>,\n workspace?: WorkspaceConfig,\n): LoadedConfig {\n const collections = new Map<string, Collection>();\n const loaded: GlobalConfig = {};\n let globalConfig: GlobalConfig;\n\n if (\"default\" in config) {\n globalConfig = config.default as GlobalConfig;\n for (const [k, v] of Object.entries(config)) {\n if (k === \"default\") continue;\n\n globalConfig.collections ??= {};\n globalConfig.collections[k] = v as Collection;\n }\n } else {\n globalConfig = config as GlobalConfig;\n }\n\n if (globalConfig.collections) {\n for (const [name, collection] of Object.entries(globalConfig.collections)) {\n collection.init?.({ name, workspace });\n collections.set(name, collection);\n }\n }\n\n return {\n ...globalConfig,\n collections,\n workspaces: Object.fromEntries(\n Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {\n return [\n key,\n {\n dir: value.dir,\n config: buildConfig(value.config as Record<string, unknown>, {\n ...value,\n name: key,\n }),\n },\n ];\n }),\n ),\n };\n}\n"],"mappings":";;;;;AAqBA,SAAgB,YACd,QACA,WACc;CACd,MAAM,8BAAc,IAAI,KAAyB;CACjD,MAAMA,SAAuB,EAAE;CAC/B,IAAIC;AAEJ,KAAI,aAAa,QAAQ;AACvB,iBAAe,OAAO;AACtB,OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,OAAO,EAAE;AAC3C,OAAI,MAAM,UAAW;AAErB,gBAAa,gBAAgB,EAAE;AAC/B,gBAAa,YAAY,KAAK;;OAGhC,gBAAe;AAGjB,KAAI,aAAa,YACf,MAAK,MAAM,CAAC,MAAM,eAAe,OAAO,QAAQ,aAAa,YAAY,EAAE;AACzE,aAAW,OAAO;GAAE;GAAM;GAAW,CAAC;AACtC,cAAY,IAAI,MAAM,WAAW;;AAIrC,QAAO;EACL,GAAG;EACH;EACA,YAAY,OAAO,YACjB,OAAO,QAAQ,OAAO,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,WAAW;AAC5D,UAAO,CACL,KACA;IACE,KAAK,MAAM;IACX,QAAQ,YAAY,MAAM,QAAmC;KAC3D,GAAG;KACH,MAAM;KACP,CAAC;IACH,CACF;IACD,CACH;EACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-mdx-C1PZsGp2.js","names":["newChildren: RootContent[]","ElementLikeTypes: ElementLikeContent[\"type\"][]","attributes: Record<string, string | null>","nodes: RootContent[] | undefined","extractedLines: string[]","content: string","fs","path","queue: Promise<void>[]","_stringifyProcessor: Processor | undefined","urls: ExtractedReference[]","postprocessOptions: PostprocessOptions","remarkIncludeOptions: RemarkIncludeOptions"],"sources":["../src/collections/mdx/remark-unravel.ts","../src/collections/mdx/mdast-utils.ts","../src/collections/mdx/remark-include.ts","../src/collections/mdx/remark-postprocess.ts","../src/collections/mdx/remark-preprocess.ts","../src/collections/mdx/build-mdx.ts"],"sourcesContent":["// from internal remark plugins in https://github.com/mdx-js/mdx/blob/main/packages/mdx/lib/plugin/remark-mark-and-unravel.js\n// we need to ensure consistency with MDX.js when parsing embed content in `remark-include`\nimport { visit } from \"unist-util-visit\";\nimport type { Transformer } from \"unified\";\nimport type { Root, RootContent } from \"mdast\";\n\nexport function remarkMarkAndUnravel(): Transformer<Root, Root> {\n return (tree) => {\n visit(tree, (node, index, parent) => {\n let offset = -1;\n let all = true;\n let oneOrMore = false;\n\n if (parent && typeof index === \"number\" && node.type === \"paragraph\") {\n const children = node.children;\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (\n child.type === \"mdxJsxTextElement\" ||\n child.type === \"mdxTextExpression\"\n ) {\n oneOrMore = true;\n } else if (child.type === \"text\" && child.value.trim().length === 0) {\n // Empty.\n } else {\n all = false;\n break;\n }\n }\n\n if (all && oneOrMore) {\n offset = -1;\n const newChildren: RootContent[] = [];\n\n while (++offset < children.length) {\n const child = children[offset];\n\n if (child.type === \"mdxJsxTextElement\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxJsxFlowElement\";\n }\n\n if (child.type === \"mdxTextExpression\") {\n // @ts-expect-error: mutate because it is faster; content model is fine.\n child.type = \"mdxFlowExpression\";\n }\n\n if (\n child.type === \"text\" &&\n /^[\\t\\r\\n ]+$/.test(String(child.value))\n ) {\n // Empty.\n } else {\n newChildren.push(child);\n }\n }\n\n parent.children.splice(index, 1, ...newChildren);\n return index;\n }\n }\n });\n };\n}\n","import type { RootContent } from \"mdast\";\n\nexport function flattenNode(node: RootContent): string {\n if (\"children\" in node)\n return node.children.map((child) => flattenNode(child)).join(\"\");\n\n if (\"value\" in node) return node.value;\n\n return \"\";\n}\n","import {\n type PluggableList,\n type Processor,\n type Transformer,\n unified,\n} 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 \"@/utils/fuma-matter\";\nimport type { MdxJsxFlowElement, MdxJsxTextElement } from \"mdast-util-mdx-jsx\";\nimport { VFile } from \"vfile\";\nimport type { Directives } from \"mdast-util-directive\";\nimport { remarkMarkAndUnravel } from \"@/collections/mdx/remark-unravel\";\nimport { flattenNode } from \"./mdast-utils\";\n\nexport interface Params {\n lang?: string;\n meta?: string;\n}\n\nconst ElementLikeTypes: ElementLikeContent[\"type\"][] = [\n \"mdxJsxFlowElement\",\n \"mdxJsxTextElement\",\n \"containerDirective\",\n \"textDirective\",\n \"leafDirective\",\n];\ntype ElementLikeContent = MdxJsxFlowElement | MdxJsxTextElement | Directives;\n\nfunction isElementLike(node: Node): node is ElementLikeContent {\n return ElementLikeTypes.includes(node.type as ElementLikeContent[\"type\"]);\n}\n\nfunction parseElementAttributes(\n element: ElementLikeContent,\n): Record<string, string | null | undefined> {\n if (Array.isArray(element.attributes)) {\n const attributes: Record<string, string | null> = {};\n\n for (const attr of element.attributes) {\n if (\n attr.type === \"mdxJsxAttribute\" &&\n (typeof attr.value === \"string\" || attr.value === null)\n ) {\n attributes[attr.name] = attr.value;\n }\n }\n\n return attributes;\n }\n\n return element.attributes ?? {};\n}\n\nfunction parseSpecifier(specifier: string): {\n file: string;\n section?: string;\n} {\n const idx = specifier.lastIndexOf(\"#\");\n if (idx === -1) return { file: specifier };\n\n return {\n file: specifier.slice(0, idx),\n section: specifier.slice(idx + 1),\n };\n}\n\nfunction extractSection(root: Root, section: string): Root | undefined {\n let nodes: RootContent[] | undefined;\n let capturingHeadingContent = false;\n\n visit(root, (node) => {\n if (node.type === \"heading\") {\n if (capturingHeadingContent) {\n return false;\n }\n\n if (node.data?.hProperties?.id === section) {\n capturingHeadingContent = true;\n nodes = [node];\n return \"skip\";\n }\n\n return;\n }\n\n if (capturingHeadingContent) {\n nodes?.push(node as RootContent);\n return \"skip\";\n }\n\n if (isElementLike(node) && node.name === \"section\") {\n const attributes = parseElementAttributes(node);\n\n if (attributes.id === section) {\n nodes = node.children;\n return false;\n }\n }\n });\n\n if (nodes)\n return {\n type: \"root\",\n children: nodes,\n };\n}\n\n// region marker regexes\nconst REGION_MARKERS = [\n {\n start: /^\\s*\\/\\/\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*\\/\\/\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*<!--\\s*#?region\\b\\s*(.*?)\\s*-->/,\n end: /^\\s*<!--\\s*#?endregion\\b\\s*(.*?)\\s*-->/,\n },\n {\n start: /^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\//,\n end: /^\\s*\\/\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\//,\n },\n {\n start: /^\\s*#[rR]egion\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#[eE]nd ?[rR]egion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#\\s*#?region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#\\s*#?endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*(?:--|::|@?REM)\\s*#region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*(?:--|::|@?REM)\\s*#endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*#pragma\\s+region\\b\\s*(.*?)\\s*$/,\n end: /^\\s*#pragma\\s+endregion\\b\\s*(.*?)\\s*$/,\n },\n {\n start: /^\\s*\\(\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\)/,\n end: /^\\s*\\(\\*\\s*#endregion\\b\\s*(.*?)\\s*\\*\\)/,\n },\n];\n\nfunction dedent(lines: string[]): string {\n const minIndent = lines.reduce((min, line) => {\n const match = line.match(/^(\\s*)\\S/);\n return match ? Math.min(min, match[1].length) : min;\n }, Infinity);\n\n return minIndent === Infinity\n ? lines.join(\"\\n\")\n : lines.map((l) => l.slice(minIndent)).join(\"\\n\");\n}\n\nfunction extractCodeRegion(content: string, regionName: string): string {\n const lines = content.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n for (const re of REGION_MARKERS) {\n let match = re.start.exec(lines[i]);\n if (match?.[1] !== regionName) continue;\n\n let depth = 1;\n const extractedLines: string[] = [];\n for (let j = i + 1; j < lines.length; j++) {\n match = re.start.exec(lines[j]);\n if (match) {\n depth++;\n continue;\n }\n\n match = re.end.exec(lines[j]);\n if (match) {\n if (match[1] === regionName) depth = 0;\n else if (match[1] === \"\") depth--;\n else continue;\n\n if (depth > 0) continue;\n return dedent(extractedLines);\n } else {\n extractedLines.push(lines[j]);\n }\n }\n }\n }\n throw new Error(`Region \"${regionName}\" not found`);\n}\n\nexport interface RemarkIncludeOptions {\n /**\n * remark plugins to preprocess the MDAST tree before scanning headings/sections.\n *\n * e.g. parse headings before extraction.\n */\n preprocess?: PluggableList;\n}\n\nexport function remarkInclude(\n this: Processor,\n { preprocess = [] }: RemarkIncludeOptions = {},\n): Transformer<Root, Root> {\n const TagName = \"include\";\n const preprocessor = unified().use(remarkMarkAndUnravel).use(preprocess);\n\n const embedContent = async (\n targetPath: string,\n heading: string | undefined,\n params: Params,\n parent: VFile,\n ) => {\n const { _getProcessor = () => this, _compiler } = parent.data;\n let content: string;\n try {\n content = (await fs.readFile(targetPath)).toString();\n } catch (e) {\n throw new Error(\n `failed to read file ${targetPath}\\n${e instanceof Error ? e.message : String(e)}`,\n { cause: e },\n );\n }\n\n const ext = path.extname(targetPath);\n _compiler?.addDependency(targetPath);\n if (params.lang || (ext !== \".md\" && ext !== \".mdx\")) {\n const lang = params.lang ?? ext.slice(1);\n\n return {\n type: \"code\",\n lang,\n meta: params.meta,\n value: heading ? extractCodeRegion(content, heading) : content,\n data: {},\n } satisfies Code;\n }\n\n const parser = await _getProcessor(ext === \".mdx\" ? \"mdx\" : \"md\");\n const parsed = fumaMatter(content);\n const targetFile = new VFile({\n path: targetPath,\n value: parsed.content,\n data: {\n ...parent.data,\n frontmatter: parsed.data as Record<string, unknown>,\n },\n });\n\n let mdast = await preprocessor.run(\n parser.parse(targetFile) as Root,\n targetFile,\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(\n parent && parent.type === \"paragraph\" ? parent : node,\n replace,\n );\n }),\n );\n\n return \"skip\";\n });\n\n await Promise.all(queue);\n }\n\n return async (tree, file) => {\n await update(tree, file);\n };\n}\n","import type { Processor, Transformer } from \"unified\";\nimport type { Root, RootContent } from \"mdast\";\nimport { visit } from \"unist-util-visit\";\nimport { toMarkdown } from \"mdast-util-to-markdown\";\nimport { valueToEstree } from \"estree-util-value-to-estree\";\nimport { removePosition } from \"unist-util-remove-position\";\nimport remarkMdx from \"remark-mdx\";\nimport { flattenNode } from \"./mdast-utils\";\n\nexport interface ExtractedReference {\n href: string;\n}\n\nexport interface PostprocessOptions {\n _format: \"md\" | \"mdx\";\n\n /**\n * Properties to export from `vfile.data`\n */\n valueToExport?: string[];\n\n /**\n * stringify MDAST and export via `_markdown`.\n */\n includeProcessedMarkdown?: boolean;\n\n /**\n * extract link references, export via `extractedReferences`.\n */\n extractLinkReferences?: boolean;\n\n /**\n * store MDAST and export via `_mdast`.\n */\n includeMDAST?:\n | boolean\n | {\n removePosition?: boolean;\n };\n}\n\n/**\n * - collect references\n * - write frontmatter (auto-title & description)\n */\nexport function remarkPostprocess(\n this: Processor,\n {\n _format,\n includeProcessedMarkdown = false,\n includeMDAST = false,\n extractLinkReferences = false,\n valueToExport = [],\n }: PostprocessOptions,\n): Transformer<Root, Root> {\n let _stringifyProcessor: Processor | undefined;\n const getStringifyProcessor = () => {\n return (_stringifyProcessor ??=\n _format === \"mdx\"\n ? this\n : // force Markdown processor to stringify MDX nodes\n this().use(remarkMdx).freeze());\n };\n\n return (tree, file) => {\n const frontmatter = (file.data.frontmatter ??= {});\n if (!frontmatter.title) {\n visit(tree, \"heading\", (node) => {\n if (node.depth === 1) {\n frontmatter.title = flattenNode(node);\n return false;\n }\n });\n }\n\n file.data[\"mdx-export\"] ??= [];\n file.data[\"mdx-export\"].push({\n name: \"frontmatter\",\n value: frontmatter,\n });\n\n if (extractLinkReferences) {\n const urls: ExtractedReference[] = [];\n\n visit(tree, \"link\", (node) => {\n urls.push({\n href: node.url,\n });\n return \"skip\";\n });\n\n file.data[\"mdx-export\"].push({\n name: \"extractedReferences\",\n value: urls,\n });\n }\n\n if (includeProcessedMarkdown) {\n const processor = getStringifyProcessor();\n const markdown = toMarkdown(tree, {\n ...processor.data(\"settings\"),\n // from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js\n extensions: processor.data(\"toMarkdownExtensions\") || [],\n });\n\n file.data[\"mdx-export\"].push({\n name: \"_markdown\",\n value: markdown,\n });\n }\n\n if (includeMDAST) {\n const options = includeMDAST === true ? {} : includeMDAST;\n const mdast = JSON.stringify(\n options.removePosition ? removePosition(structuredClone(tree)) : tree,\n );\n\n file.data[\"mdx-export\"].push({\n name: \"_mdast\",\n value: mdast,\n });\n }\n\n for (const { name, value } of file.data[\"mdx-export\"]) {\n tree.children.unshift(getMdastExport(name, value));\n }\n\n // reset the data to reduce memory usage\n file.data[\"mdx-export\"] = [];\n\n for (const name of valueToExport) {\n if (!(name in file.data)) continue;\n\n tree.children.unshift(getMdastExport(name, file.data[name]));\n }\n };\n}\n\n/**\n * MDX.js first converts javascript (with esm support) into mdast nodes with remark-mdx, then handle the other remark plugins\n *\n * Therefore, if we want to inject an export, we must convert the object into AST, then add the mdast node\n */\nfunction getMdastExport(name: string, value: unknown): RootContent {\n return {\n type: \"mdxjsEsm\",\n value: \"\",\n data: {\n estree: {\n type: \"Program\",\n sourceType: \"module\",\n body: [\n {\n type: \"ExportNamedDeclaration\",\n specifiers: [],\n attributes: [],\n source: null,\n declaration: {\n type: \"VariableDeclaration\",\n kind: \"let\",\n declarations: [\n {\n type: \"VariableDeclarator\",\n id: {\n type: \"Identifier\",\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n","import type { Processor, Transformer } from \"unified\";\nimport type { Root } from \"mdast\";\n\nexport interface PreprocessOptions {\n preprocessor?: Processor<Root>;\n}\n\ndeclare module \"vfile\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap {\n _preprocessed?: boolean;\n }\n}\n\nexport function remarkPreprocess(\n options?: PreprocessOptions,\n): Transformer<Root, Root> {\n return async (tree, file) => {\n if (file.data._preprocessed) return;\n file.data._preprocessed = true;\n\n if (options?.preprocessor) {\n return (await options.preprocessor.run(tree)) as Root;\n }\n };\n}\n","import { createProcessor } from \"@mdx-js/mdx\";\nimport { VFile } from \"vfile\";\nimport {\n remarkInclude,\n type RemarkIncludeOptions,\n} from \"@/collections/mdx/remark-include\";\nimport {\n type PostprocessOptions,\n remarkPostprocess,\n} from \"@/collections/mdx/remark-postprocess\";\nimport type { Core } from \"@/core\";\nimport { remarkPreprocess } from \"@/collections/mdx/remark-preprocess\";\nimport type { Pluggable } from \"unified\";\nimport type { Collection } from \"@/collections\";\nimport { createCache } from \"@/utils/async-cache\";\nimport type { CompilerOptions } from \"@/plugins/with-loader\";\nimport type { FC } from \"react\";\nimport type { MDXProps } from \"mdx/types\";\n\ntype MDXProcessor = ReturnType<typeof createProcessor>;\n\ninterface BuildMDXOptions {\n /**\n * Specify a file path for source\n */\n filePath: string;\n source: string;\n frontmatter?: Record<string, unknown>;\n\n environment: \"bundler\" | \"runtime\";\n isDevelopment: boolean;\n _compiler?: CompilerOptions;\n}\n\nexport interface FumaContentDataMap {\n /**\n * [Fuma Content] raw frontmatter, you can modify it\n */\n frontmatter?: Record<string, unknown>;\n\n /**\n * [Fuma Content] additional ESM exports to write\n */\n \"mdx-export\"?: { name: string; value: unknown }[];\n\n /**\n * [Fuma Content] The compiler object from loader\n */\n _compiler?: CompilerOptions;\n\n /**\n * [Fuma Content] get internal processor, do not use this on user land.\n */\n _getProcessor?: (\n format: \"md\" | \"mdx\",\n ) => MDXProcessor | Promise<MDXProcessor>;\n}\n\ndeclare module \"vfile\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- extend data map\n interface DataMap extends FumaContentDataMap {}\n}\n\nexport type CompiledMDX<Frontmatter = Record<string, unknown>> = {\n frontmatter: Frontmatter;\n} & CompiledMDXData &\n Record<string, unknown>;\n\nexport interface CompiledMDXData {\n default: FC<MDXProps>;\n\n /**\n * Enable from `postprocess` option.\n */\n _markdown?: string;\n /**\n * Enable from `postprocess` option.\n */\n _mdast?: string;\n}\n\nexport async function buildMDX(\n core: Core,\n collection: Collection | undefined,\n {\n filePath,\n frontmatter,\n source,\n _compiler,\n environment,\n isDevelopment,\n }: BuildMDXOptions,\n): Promise<VFile> {\n const handler = collection?.handlers.mdx;\n const processorCache = createCache(core.cache).$value<MDXProcessor>();\n\n function getProcessor(format: \"md\" | \"mdx\") {\n const key = `build-mdx:${collection?.name ?? \"global\"}:${format}`;\n\n return processorCache.cached(key, async () => {\n const mdxOptions = await handler?.getMDXOptions?.(environment);\n const preprocessPlugin = [\n remarkPreprocess,\n handler?.preprocess,\n ] satisfies Pluggable;\n const postprocessOptions: PostprocessOptions = {\n _format: format,\n ...handler?.postprocess,\n };\n const remarkIncludeOptions: RemarkIncludeOptions = {\n preprocess: [preprocessPlugin],\n };\n\n return createProcessor({\n outputFormat: \"program\",\n development: isDevelopment,\n ...mdxOptions,\n remarkPlugins: [\n preprocessPlugin,\n [remarkInclude, remarkIncludeOptions],\n ...(mdxOptions?.remarkPlugins ?? []),\n [remarkPostprocess, postprocessOptions],\n ],\n format,\n });\n });\n }\n\n let vfile = new VFile({\n value: source,\n path: filePath,\n cwd: handler?.cwd,\n data: {\n frontmatter,\n _compiler,\n _getProcessor: getProcessor,\n },\n });\n\n if (collection && handler) {\n vfile = await handler.vfile.run(vfile, {\n collection,\n filePath,\n source,\n });\n }\n\n return (await getProcessor(filePath.endsWith(\".mdx\") ? \"mdx\" : \"md\")).process(\n vfile,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAMA,SAAgB,uBAAgD;AAC9D,SAAQ,SAAS;AACf,QAAM,OAAO,MAAM,OAAO,WAAW;GACnC,IAAI,SAAS;GACb,IAAI,MAAM;GACV,IAAI,YAAY;AAEhB,OAAI,UAAU,OAAO,UAAU,YAAY,KAAK,SAAS,aAAa;IACpE,MAAM,WAAW,KAAK;AAEtB,WAAO,EAAE,SAAS,SAAS,QAAQ;KACjC,MAAM,QAAQ,SAAS;AAEvB,SACE,MAAM,SAAS,uBACf,MAAM,SAAS,oBAEf,aAAY;cACH,MAAM,SAAS,UAAU,MAAM,MAAM,MAAM,CAAC,WAAW,GAAG,QAE9D;AACL,YAAM;AACN;;;AAIJ,QAAI,OAAO,WAAW;AACpB,cAAS;KACT,MAAMA,cAA6B,EAAE;AAErC,YAAO,EAAE,SAAS,SAAS,QAAQ;MACjC,MAAM,QAAQ,SAAS;AAEvB,UAAI,MAAM,SAAS,oBAEjB,OAAM,OAAO;AAGf,UAAI,MAAM,SAAS,oBAEjB,OAAM,OAAO;AAGf,UACE,MAAM,SAAS,UACf,eAAe,KAAK,OAAO,MAAM,MAAM,CAAC,EACxC,OAGA,aAAY,KAAK,MAAM;;AAI3B,YAAO,SAAS,OAAO,OAAO,GAAG,GAAG,YAAY;AAChD,YAAO;;;IAGX;;;;;;AC7DN,SAAgB,YAAY,MAA2B;AACrD,KAAI,cAAc,KAChB,QAAO,KAAK,SAAS,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC,KAAK,GAAG;AAElE,KAAI,WAAW,KAAM,QAAO,KAAK;AAEjC,QAAO;;;;;ACcT,MAAMC,mBAAiD;CACrD;CACA;CACA;CACA;CACA;CACD;AAGD,SAAS,cAAc,MAAwC;AAC7D,QAAO,iBAAiB,SAAS,KAAK,KAAmC;;AAG3E,SAAS,uBAC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a,YAAY,QAAQ,SAAS,GAAG;AAEzD,SAAO,eAAe,OAAO,KAAK,YAAY;GAC5C,MAAM,aAAa,MAAM,SAAS,gBAAgB,YAAY;GAC9D,MAAM,mBAAmB,CACvB,kBACA,SAAS,WACV;GACD,MAAMC,qBAAyC;IAC7C,SAAS;IACT,GAAG,SAAS;IACb;GACD,MAAMC,uBAA6C,EACjD,YAAY,CAAC,iBAAiB,EAC/B;AAED,UAAO,gBAAgB;IACrB,cAAc;IACd,aAAa;IACb,GAAG;IACH,eAAe;KACb;KACA,CAAC,eAAe,qBAAqB;KACrC,GAAI,YAAY,iBAAiB,EAAE;KACnC,CAAC,mBAAmB,mBAAmB;KACxC;IACD;IACD,CAAC;IACF;;CAGJ,IAAI,QAAQ,IAAI,MAAM;EACpB,OAAO;EACP,MAAM;EACN,KAAK,SAAS;EACd,MAAM;GACJ;GACA;GACA,eAAe;GAChB;EACF,CAAC;AAEF,KAAI,cAAc,QAChB,SAAQ,MAAM,QAAQ,MAAM,IAAI,OAAO;EACrC;EACA;EACA;EACD,CAAC;AAGJ,SAAQ,MAAM,aAAa,SAAS,SAAS,OAAO,GAAG,QAAQ,KAAK,EAAE,QACpE,MACD"}
@@ -1,4 +0,0 @@
1
- import "./fuma-matter-O4fA6nSx.js";
2
- import { t as buildMDX } from "./build-mdx-C1PZsGp2.js";
3
-
4
- export { buildMDX };
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun-QKQnqgIi.js","names":["input: LoaderInput"],"sources":["../src/plugins/with-loader/bun.ts"],"sourcesContent":["import { parse } from \"node:querystring\";\nimport { readFileSync } from \"node:fs\";\nimport type { LoaderInput, Loader, LoaderOutput } from \"@/plugins/with-loader\";\n\nexport function toBun(test: RegExp = /.+/, loader: Loader) {\n function toResult(output: LoaderOutput | null): Bun.OnLoadResult {\n // it errors, treat this as an exception\n if (!output) return;\n\n return {\n contents: output.code,\n loader: \"js\",\n };\n }\n\n return (build: Bun.PluginBuilder): void => {\n // avoid using async here, because it will cause dynamic require() to fail\n build.onLoad({ filter: test }, (args) => {\n const [filePath, query = \"\"] = args.path.split(\"?\", 2);\n const input: LoaderInput = {\n async getSource() {\n return Bun.file(filePath).text();\n },\n query: parse(query),\n filePath,\n development: false,\n compiler: {\n addDependency() {},\n },\n };\n\n if (loader.bun?.load) {\n return loader.bun.load(readFileSync(filePath).toString(), input);\n }\n\n const result = loader.load(input);\n if (result instanceof Promise) {\n return result.then(toResult);\n }\n return toResult(result);\n });\n };\n}\n"],"mappings":";;;;AAIA,SAAgB,MAAM,OAAe,MAAM,QAAgB;CACzD,SAAS,SAAS,QAA+C;AAE/D,MAAI,CAAC,OAAQ;AAEb,SAAO;GACL,UAAU,OAAO;GACjB,QAAQ;GACT;;AAGH,SAAQ,UAAmC;AAEzC,QAAM,OAAO,EAAE,QAAQ,MAAM,GAAG,SAAS;GACvC,MAAM,CAAC,UAAU,QAAQ,MAAM,KAAK,KAAK,MAAM,KAAK,EAAE;GACtD,MAAMA,QAAqB;IACzB,MAAM,YAAY;AAChB,YAAO,IAAI,KAAK,SAAS,CAAC,MAAM;;IAElC,OAAO,MAAM,MAAM;IACnB;IACA,aAAa;IACb,UAAU,EACR,gBAAgB,IACjB;IACF;AAED,OAAI,OAAO,KAAK,KACd,QAAO,OAAO,IAAI,KAAK,aAAa,SAAS,CAAC,UAAU,EAAE,MAAM;GAGlE,MAAM,SAAS,OAAO,KAAK,MAAM;AACjC,OAAI,kBAAkB,QACpB,QAAO,OAAO,KAAK,SAAS;AAE9B,UAAO,SAAS,OAAO;IACvB"}
@@ -1,133 +0,0 @@
1
- import { t as createCache } from "./async-cache-BM9Yf4Nw.js";
2
- import path from "node:path";
3
- import { glob } from "tinyglobby";
4
-
5
- //#region src/utils/code-generator.ts
6
- function importInfo() {
7
- return {
8
- named: /* @__PURE__ */ new Map(),
9
- namespaces: /* @__PURE__ */ new Set(),
10
- isUsed: /* @__PURE__ */ new Set()
11
- };
12
- }
13
- /**
14
- * Code generator (one instance per file)
15
- */
16
- var CodeGenerator = class {
17
- lines = [];
18
- globCache;
19
- importInfos = /* @__PURE__ */ new Map();
20
- eagerImportId = 0;
21
- options;
22
- constructor({ target = "default", jsExtension = false, globCache = /* @__PURE__ */ new Map(), outDir = "" }) {
23
- this.options = {
24
- target,
25
- jsExtension,
26
- globCache,
27
- outDir
28
- };
29
- this.globCache = createCache(globCache);
30
- }
31
- addNamespaceImport(namespace, specifier, types = false) {
32
- const info = this.importInfos.get(specifier) ?? importInfo();
33
- this.importInfos.set(specifier, info);
34
- if (!types) info.isUsed.add(namespace);
35
- info.namespaces.add(namespace);
36
- }
37
- addNamedImport(names, specifier, types = false) {
38
- const info = this.importInfos.get(specifier) ?? importInfo();
39
- this.importInfos.set(specifier, info);
40
- for (const name of names) {
41
- const [memberName, importName = memberName] = name.split(/\s+as\s+/, 2);
42
- info.named.set(importName, memberName);
43
- if (!types) info.isUsed.add(importName);
44
- }
45
- }
46
- push(...insert) {
47
- this.lines.push(...insert);
48
- }
49
- async pushAsync(insert) {
50
- for (const line of await Promise.all(insert)) {
51
- if (line === void 0) continue;
52
- this.lines.push(line);
53
- }
54
- }
55
- async generateGlobImport(patterns, options) {
56
- if (this.options.target === "vite") return this.generateViteGlobImport(patterns, options);
57
- return this.generateNodeGlobImport(patterns, options);
58
- }
59
- generateViteGlobImport(patterns, { base, ...rest }) {
60
- patterns = (typeof patterns === "string" ? [patterns] : patterns).map(normalizeViteGlobPath);
61
- return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify({
62
- base: normalizeViteGlobPath(path.relative(this.options.outDir, base)),
63
- ...rest
64
- }, null, 2)})`;
65
- }
66
- async generateNodeGlobImport(patterns, { base, eager = false, query = {}, import: importName }) {
67
- const files = await this.globCache.cached(JSON.stringify({
68
- patterns,
69
- base
70
- }), () => glob(patterns, { cwd: base }));
71
- let code = "{";
72
- for (const item of files) {
73
- const fullPath = path.join(base, item);
74
- const searchParams = new URLSearchParams();
75
- for (const [k, v] of Object.entries(query)) if (v !== void 0) searchParams.set(k, v);
76
- const importPath = `${this.formatImportPath(fullPath)}?${searchParams.toString()}`;
77
- if (eager) {
78
- const name = `__fd_glob_${this.eagerImportId++}`;
79
- this.lines.unshift(importName ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}` : `import * as ${name} from ${JSON.stringify(importPath)}`);
80
- code += `${JSON.stringify(item)}: ${name}, `;
81
- } else {
82
- let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;
83
- if (importName) line += `.then(mod => mod.${importName})`;
84
- code += `${line}, `;
85
- }
86
- }
87
- code += "}";
88
- return code;
89
- }
90
- formatImportPath(file) {
91
- const ext = path.extname(file);
92
- let filename;
93
- if (ext === ".ts") {
94
- filename = file.substring(0, file.length - ext.length);
95
- if (this.options.jsExtension) filename += ".js";
96
- } else filename = file;
97
- const importPath = slash(path.relative(this.options.outDir, filename));
98
- return importPath.startsWith(".") ? importPath : `./${importPath}`;
99
- }
100
- toString() {
101
- const final = ["// @ts-nocheck"];
102
- if (this.options.target === "vite") final.push("/// <reference types=\"vite/client\" />");
103
- for (const [specifier, info] of this.importInfos) {
104
- const { namespaces, named, isUsed } = info;
105
- for (const namespace of namespaces) final.push(isUsed.has(namespace) ? `import * as ${namespace} from "${specifier}";` : `import type * as ${namespace} from "${specifier}";`);
106
- const namedImports = [];
107
- for (const [importName, memberName] of named) {
108
- const item = importName === memberName ? importName : `${memberName} as ${importName}`;
109
- namedImports.push(isUsed.has(importName) ? item : `type ${item}`);
110
- }
111
- if (namedImports.length > 0) final.push(`import { ${namedImports.join(", ")} } from "${specifier}";`);
112
- }
113
- final.push(...this.lines);
114
- return final.join("\n");
115
- }
116
- };
117
- /**
118
- * convert into POSIX & relative file paths, such that Vite can accept it.
119
- */
120
- function normalizeViteGlobPath(file) {
121
- file = slash(file);
122
- if (file.startsWith("./")) return file;
123
- if (file.startsWith("/")) return `.${file}`;
124
- return `./${file}`;
125
- }
126
- function slash(path$1) {
127
- if (path$1.startsWith("\\\\?\\")) return path$1;
128
- return path$1.replaceAll("\\", "/");
129
- }
130
-
131
- //#endregion
132
- export { slash as n, CodeGenerator as t };
133
- //# sourceMappingURL=code-generator-gPtrfZ6Q.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"code-generator-gPtrfZ6Q.js","names":["code: string","filename: string","final: string[]","namedImports: string[]","path"],"sources":["../src/utils/code-generator.ts"],"sourcesContent":["import path from \"node:path\";\nimport { glob } from \"tinyglobby\";\nimport { type AsyncCache, createCache } from \"@/utils/async-cache\";\n\nexport interface GlobImportOptions {\n base: string;\n query?: Record<string, string | undefined>;\n import?: string;\n eager?: boolean;\n}\n\nexport interface CodeGeneratorOptions {\n target: \"default\" | \"vite\";\n outDir: string;\n /**\n * add .js extenstion to imports\n */\n jsExtension: boolean;\n globCache: Map<string, Promise<string[]>>;\n}\n\ninterface ImportInfo {\n // import name -> member name\n named: Map<string, string>;\n namespaces: Set<string>;\n /**\n * a set of import names, the import is type-only if its name is missing in this set.\n */\n isUsed: Set<string>;\n}\n\nfunction importInfo(): ImportInfo {\n return {\n named: new Map(),\n namespaces: new Set(),\n isUsed: new Set(),\n };\n}\n\n/**\n * Code generator (one instance per file)\n */\nexport class CodeGenerator {\n private readonly lines: string[] = [];\n private readonly globCache: AsyncCache<string[]>;\n // specifier -> imported members/info\n private readonly importInfos = new Map<string, ImportInfo>();\n private eagerImportId = 0;\n\n readonly options: CodeGeneratorOptions;\n constructor({\n target = \"default\",\n jsExtension = false,\n globCache = new Map(),\n outDir = \"\",\n }: Partial<CodeGeneratorOptions>) {\n this.options = {\n target,\n jsExtension,\n globCache,\n outDir,\n };\n this.globCache = createCache(globCache);\n }\n\n addNamespaceImport(namespace: string, specifier: string, types = false) {\n const info = this.importInfos.get(specifier) ?? importInfo();\n this.importInfos.set(specifier, info);\n if (!types) info.isUsed.add(namespace);\n info.namespaces.add(namespace);\n }\n\n addNamedImport(names: string[], specifier: string, types = false) {\n const info = this.importInfos.get(specifier) ?? importInfo();\n this.importInfos.set(specifier, info);\n for (const name of names) {\n const [memberName, importName = memberName] = name.split(/\\s+as\\s+/, 2);\n info.named.set(importName, memberName);\n if (!types) info.isUsed.add(importName);\n }\n }\n\n push(...insert: string[]) {\n this.lines.push(...insert);\n }\n\n async pushAsync(insert: Promise<string | undefined>[]) {\n for (const line of await Promise.all(insert)) {\n if (line === undefined) continue;\n\n this.lines.push(line);\n }\n }\n\n async generateGlobImport(\n patterns: string | string[],\n options: GlobImportOptions,\n ): Promise<string> {\n if (this.options.target === \"vite\") {\n return this.generateViteGlobImport(patterns, options);\n }\n\n return this.generateNodeGlobImport(patterns, options);\n }\n\n private generateViteGlobImport(\n patterns: string | string[],\n { base, ...rest }: GlobImportOptions,\n ): string {\n patterns = (typeof patterns === \"string\" ? [patterns] : patterns).map(\n normalizeViteGlobPath,\n );\n\n return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(\n {\n base: normalizeViteGlobPath(path.relative(this.options.outDir, base)),\n ...rest,\n },\n null,\n 2,\n )})`;\n }\n\n private async generateNodeGlobImport(\n patterns: string | string[],\n { base, eager = false, query = {}, import: importName }: GlobImportOptions,\n ): Promise<string> {\n const files = await this.globCache.cached(\n JSON.stringify({ patterns, base }),\n () =>\n glob(patterns, {\n cwd: base,\n }),\n );\n\n let code: string = \"{\";\n for (const item of files) {\n const fullPath = path.join(base, item);\n const searchParams = new URLSearchParams();\n\n for (const [k, v] of Object.entries(query)) {\n if (v !== undefined) searchParams.set(k, v);\n }\n\n const importPath = `${this.formatImportPath(fullPath)}?${searchParams.toString()}`;\n if (eager) {\n const name = `__fd_glob_${this.eagerImportId++}`;\n this.lines.unshift(\n importName\n ? `import { ${importName} as ${name} } from ${JSON.stringify(importPath)}`\n : `import * as ${name} from ${JSON.stringify(importPath)}`,\n );\n\n code += `${JSON.stringify(item)}: ${name}, `;\n } else {\n let line = `${JSON.stringify(item)}: () => import(${JSON.stringify(importPath)})`;\n if (importName) {\n line += `.then(mod => mod.${importName})`;\n }\n\n code += `${line}, `;\n }\n }\n\n code += \"}\";\n return code;\n }\n\n formatImportPath(file: string) {\n const ext = path.extname(file);\n let filename: string;\n\n if (ext === \".ts\") {\n filename = file.substring(0, file.length - ext.length);\n if (this.options.jsExtension) filename += \".js\";\n } else {\n filename = file;\n }\n\n const importPath = slash(path.relative(this.options.outDir, filename));\n return importPath.startsWith(\".\") ? importPath : `./${importPath}`;\n }\n\n toString() {\n const final: string[] = [\"// @ts-nocheck\"];\n if (this.options.target === \"vite\") {\n final.push('/// <reference types=\"vite/client\" />');\n }\n\n for (const [specifier, info] of this.importInfos) {\n const { namespaces, named, isUsed } = info;\n for (const namespace of namespaces) {\n final.push(\n isUsed.has(namespace)\n ? `import * as ${namespace} from \"${specifier}\";`\n : `import type * as ${namespace} from \"${specifier}\";`,\n );\n }\n\n const namedImports: string[] = [];\n for (const [importName, memberName] of named) {\n const item =\n importName === memberName\n ? importName\n : `${memberName} as ${importName}`;\n\n namedImports.push(isUsed.has(importName) ? item : `type ${item}`);\n }\n\n if (namedImports.length > 0) {\n final.push(\n `import { ${namedImports.join(\", \")} } from \"${specifier}\";`,\n );\n }\n }\n\n final.push(...this.lines);\n return final.join(\"\\n\");\n }\n}\n\n/**\n * convert into POSIX & relative file paths, such that Vite can accept it.\n */\nfunction normalizeViteGlobPath(file: string) {\n file = slash(file);\n if (file.startsWith(\"./\")) return file;\n if (file.startsWith(\"/\")) return `.${file}`;\n\n return `./${file}`;\n}\n\nexport function slash(path: string): string {\n const isExtendedLengthPath = path.startsWith(\"\\\\\\\\?\\\\\");\n\n if (isExtendedLengthPath) {\n return path;\n }\n\n return path.replaceAll(\"\\\\\", \"/\");\n}\n\nexport function ident(code: string, tab: number = 1) {\n return code\n .split(\"\\n\")\n .map((v) => \" \".repeat(tab) + v)\n .join(\"\\n\");\n}\n"],"mappings":";;;;;AA+BA,SAAS,aAAyB;AAChC,QAAO;EACL,uBAAO,IAAI,KAAK;EAChB,4BAAY,IAAI,KAAK;EACrB,wBAAQ,IAAI,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Handler, Z as initFileCollection } from "../../core-Bkh-SI_3.js";
2
- export { FIleCollectionHandler, FileHandlerConfig, initFileCollection };
@@ -1,28 +0,0 @@
1
- import path from "node:path";
2
- import picomatch from "picomatch";
3
-
4
- //#region src/collections/handlers/fs.ts
5
- function initFileCollection(collection, init, config) {
6
- const { workspace } = init;
7
- const { supportedFormats, dir, files } = config;
8
- const patterns = files ?? (supportedFormats ? [`**/*.{${supportedFormats.join(",")}}`] : [`**/*`]);
9
- let matcher;
10
- collection.handlers.fs = {
11
- patterns,
12
- dir: workspace ? path.resolve(workspace.dir, dir) : dir,
13
- isFileSupported(filePath) {
14
- if (!supportedFormats) return true;
15
- return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
16
- },
17
- hasFile(filePath) {
18
- if (!this.isFileSupported(filePath)) return false;
19
- const relativePath = path.relative(this.dir, filePath);
20
- if (relativePath.startsWith(`..${path.sep}`)) return false;
21
- return (matcher ??= picomatch(patterns))(relativePath);
22
- }
23
- };
24
- }
25
-
26
- //#endregion
27
- export { initFileCollection };
28
- //# sourceMappingURL=fs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fs.js","names":["matcher: picomatch.Matcher"],"sources":["../../../src/collections/handlers/fs.ts"],"sourcesContent":["import picomatch from \"picomatch\";\nimport path from \"node:path\";\nimport type { Collection, InitOptions } from \"@/collections\";\n\nexport interface FileHandlerConfig {\n /**\n * Directory to scan\n */\n dir: string;\n\n /**\n * what files to include/exclude (glob patterns)\n *\n * Include all files if not specified\n */\n files?: string[];\n\n /**\n * Restrict to a list of file extensions to include, e.g. `['js', 'ts']`.\n */\n supportedFormats?: string[];\n}\n\nexport interface FIleCollectionHandler {\n /**\n * content directory (absolute)\n */\n dir: string;\n hasFile: (filePath: string) => boolean;\n isFileSupported: (filePath: string) => boolean;\n patterns: string[];\n}\n\nexport function initFileCollection(\n collection: Collection,\n init: InitOptions,\n config: FileHandlerConfig,\n) {\n const { workspace } = init;\n const { supportedFormats, dir, files } = config;\n const patterns =\n files ??\n (supportedFormats ? [`**/*.{${supportedFormats.join(\",\")}}`] : [`**/*`]);\n let matcher: picomatch.Matcher;\n\n collection.handlers.fs = {\n patterns,\n dir: workspace ? path.resolve(workspace.dir, dir) : dir,\n isFileSupported(filePath) {\n if (!supportedFormats) return true;\n\n return supportedFormats.some((format) => filePath.endsWith(`.${format}`));\n },\n hasFile(filePath) {\n if (!this.isFileSupported(filePath)) return false;\n\n const relativePath = path.relative(this.dir, filePath);\n if (relativePath.startsWith(`..${path.sep}`)) return false;\n\n return (matcher ??= picomatch(patterns))(relativePath);\n },\n };\n}\n"],"mappings":";;;;AAiCA,SAAgB,mBACd,YACA,MACA,QACA;CACA,MAAM,EAAE,cAAc;CACtB,MAAM,EAAE,kBAAkB,KAAK,UAAU;CACzC,MAAM,WACJ,UACC,mBAAmB,CAAC,SAAS,iBAAiB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO;CACzE,IAAIA;AAEJ,YAAW,SAAS,KAAK;EACvB;EACA,KAAK,YAAY,KAAK,QAAQ,UAAU,KAAK,IAAI,GAAG;EACpD,gBAAgB,UAAU;AACxB,OAAI,CAAC,iBAAkB,QAAO;AAE9B,UAAO,iBAAiB,MAAM,WAAW,SAAS,SAAS,IAAI,SAAS,CAAC;;EAE3E,QAAQ,UAAU;AAChB,OAAI,CAAC,KAAK,gBAAgB,SAAS,CAAE,QAAO;GAE5C,MAAM,eAAe,KAAK,SAAS,KAAK,KAAK,SAAS;AACtD,OAAI,aAAa,WAAW,KAAK,KAAK,MAAM,CAAE,QAAO;AAErD,WAAQ,YAAY,UAAU,SAAS,EAAE,aAAa;;EAEzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/collections/index.ts"],"sourcesContent":["import type { WorkspaceConfig } from \"@/config\";\nimport type { JSONSchemaHandler } from \"@/plugins/json-schema\";\nimport type { FIleCollectionHandler } from \"@/collections/handlers/fs\";\nimport type { MDXCollectionHandler } from \"@/collections/mdx\";\nimport type { MetaCollectionHandler } from \"@/collections/meta\";\nimport type { VersionControlHandler } from \"@/plugins/git\";\nimport type { PluginOption } from \"@/core\";\n\nexport interface InitOptions {\n name: string;\n workspace?: WorkspaceConfig;\n}\n\nexport interface Collection {\n name: string;\n init?: (options: InitOptions) => void;\n\n readonly handlers: CollectionHandlers;\n\n /**\n * information for the collection type, can be shared for all collections of same type.\n */\n readonly typeInfo: CollectionTypeInfo;\n}\n\nexport interface CollectionTypeInfo {\n /**\n * ID for collection type.\n *\n * @example `my-package:my-collection-type`\n */\n readonly id: string;\n\n /**\n * plugins to register, registered once for each collection type.\n */\n readonly plugins?: PluginOption;\n}\n\nexport interface CollectionHandlers {\n fs?: FIleCollectionHandler;\n mdx?: MDXCollectionHandler;\n meta?: MetaCollectionHandler;\n \"json-schema\"?: JSONSchemaHandler;\n \"version-control\"?: VersionControlHandler;\n}\n\nexport function createCollection(\n info: CollectionTypeInfo,\n init: (collection: Collection, options: InitOptions) => void,\n): Collection {\n return {\n name: \"\",\n handlers: {},\n init(options) {\n this.name = options.name;\n init(this, options);\n },\n typeInfo: info,\n };\n}\n"],"mappings":";AA+CA,SAAgB,iBACd,MACA,MACY;AACZ,QAAO;EACL,MAAM;EACN,UAAU,EAAE;EACZ,KAAK,SAAS;AACZ,QAAK,OAAO,QAAQ;AACpB,QAAK,MAAM,QAAQ;;EAErB,UAAU;EACX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-browser.d.ts","names":[],"sources":["../../../src/utils/async-cache.ts","../../../src/collections/mdx/runtime-browser.ts"],"sourcesContent":[],"mappings":";;;;;UAAiB;kCACiB,IAAI,QAAQ,OAAO,IAAI,QAAQ;mBAC9C,WAAW;;;;;AADQ,UCUrB,mBDVqB,CAAA,aAAA,EAAA,YAAA,CAAA,CAAA;EAAe,EAAA,EAAA,MAAA;EAAY,OAAA,EAAA,GAAA,GAAA,CCa1D,WDb0D,CCa9C,aDb8C,CAAA,GCa/B,YDb+B,CAAA,GCc3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AAA;IACP;;;IAIC,mBAAA,EA4Ce,kBA5Cf,EAAA;EAE6C,CAAA;CAAQ,IAAA,yBAAA,CAAA,OAAA,CAAA,IAAA,GAAA;EAAvB,IAAA,EAAA,GAAA,UAAA,QAAA,WAAA,EAAA,CAAA,MAAA,CAAA,CAAA,CAAA,GAAA;IAAjB;;;IAwBP,mBAAe,EAkBN,kBAlBM,EAAA;EACZ,CAAA,CAAA;CACP,IAAA;AAAU,iBAoBN,eAAA,CAAA,CApBM,EAAA,CAAA,CAAA,CAAA,CAAA,IAAA,EADX,CACW,EAAA,GADX,CACW,SADX,YACW,CAAA,OAAA,CAAA,GADX,CACW,GAAA;EACd,QAAA,wBAAA;CACY,IAAA,yBAAA,CAAA,OAAA,CAAA,IAAA,GAAA;EAEZ,IAAA,EAAA,GAAA,UAAA,QAAA,WAAA,EAAA,CAAA,MAAA,CAAA,CAAA,CAAA,yBAAA,CAAA;CAAU,IAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mdx.js","names":["mdxTypeInfo: CollectionTypeInfo","mdxHandler","base","initializer: string","coreOptions: CoreOptions","base: Plugin","plugin","loaderOptions: WebpackLoaderOptions"],"sources":["../../src/collections/mdx.ts"],"sourcesContent":["import {\n type Collection,\n type CollectionTypeInfo,\n createCollection,\n} from \"@/collections\";\nimport {\n type FileHandlerConfig,\n initFileCollection,\n} from \"@/collections/handlers/fs\";\nimport type { PostprocessOptions } from \"@/collections/mdx/remark-postprocess\";\nimport type { CoreOptions, EmitCodeGeneratorContext, Plugin } from \"@/core\";\nimport type { ProcessorOptions } from \"@mdx-js/mdx\";\nimport path from \"node:path\";\nimport type { VFile } from \"vfile\";\nimport type { TurbopackLoaderOptions } from \"next/dist/server/config-shared\";\nimport type { Configuration } from \"webpack\";\nimport type { WebpackLoaderOptions } from \"@/plugins/with-loader/webpack\";\nimport { withLoader } from \"@/plugins/with-loader\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { PreprocessOptions } from \"@/collections/mdx/remark-preprocess\";\nimport { slash } from \"@/utils/code-generator\";\nimport { validate } from \"@/utils/validation\";\nimport type { Awaitable } from \"@/types\";\nimport { type AsyncPipe, asyncPipe, type Pipe, pipe } from \"@/utils/pipe\";\n\ninterface CompilationContext {\n collection: Collection;\n filePath: string;\n source: string;\n}\n\nexport interface MDXCollectionHandler {\n readonly cwd: string;\n readonly dynamic: boolean;\n readonly lazy: boolean;\n\n preprocess?: PreprocessOptions;\n postprocess?: Partial<PostprocessOptions>;\n getMDXOptions?: (\n environment: \"bundler\" | \"runtime\",\n ) => Awaitable<ProcessorOptions>;\n\n /**\n * Transform & validate frontmatter\n */\n frontmatter: AsyncPipe<\n Record<string, unknown> | undefined,\n CompilationContext\n >;\n\n /**\n * Transform `vfile` on compilation stage\n */\n vfile: AsyncPipe<VFile, CompilationContext>;\n\n /**\n * Transform the initializer code (TypeScript) for collection store\n */\n storeInitializer: Pipe<\n string,\n EmitCodeGeneratorContext & {\n environment: \"browser\" | \"server\" | \"dynamic\";\n }\n >;\n}\n\nexport interface MDXCollectionConfig<\n FrontmatterSchema extends StandardSchemaV1 | undefined = undefined,\n> extends FileHandlerConfig {\n postprocess?: Partial<PostprocessOptions>;\n frontmatter?: FrontmatterSchema;\n options?: (environment: \"bundler\" | \"runtime\") => Awaitable<ProcessorOptions>;\n lazy?: boolean;\n dynamic?: boolean;\n}\n\nexport interface MDXCollection<Frontmatter> extends Collection {\n _frontmatter?: Frontmatter;\n}\n\nconst mdxTypeInfo: CollectionTypeInfo = {\n id: \"mdx\",\n plugins: [plugin()],\n};\n\nconst RuntimePaths = {\n browser: \"fuma-content/collections/mdx/runtime-browser\",\n dynamic: \"fuma-content/collections/mdx/runtime-dynamic\",\n server: \"fuma-content/collections/mdx/runtime\",\n};\n\nexport function defineMDX<\n FrontmatterSchema extends StandardSchemaV1 | undefined = undefined,\n>(\n config: MDXCollectionConfig<FrontmatterSchema>,\n): MDXCollection<\n FrontmatterSchema extends StandardSchemaV1\n ? StandardSchemaV1.InferOutput<FrontmatterSchema>\n : Record<string, unknown>\n> {\n const { lazy = false, dynamic = false } = config;\n return createCollection(mdxTypeInfo, (collection, options) => {\n initFileCollection(collection, options, {\n supportedFormats: [\"mdx\", \"md\"],\n ...config,\n });\n const mdxHandler = (collection.handlers.mdx = {\n cwd: options.workspace\n ? path.resolve(options.workspace.dir)\n : process.cwd(),\n postprocess: config.postprocess,\n getMDXOptions: config.options,\n dynamic,\n lazy: lazy,\n vfile: asyncPipe(),\n frontmatter: asyncPipe(),\n storeInitializer: pipe(),\n });\n\n if (config.frontmatter) {\n const frontmatter = config.frontmatter;\n mdxHandler.frontmatter.pipe((data, { filePath }) => {\n return validate(\n frontmatter,\n data,\n undefined,\n `invalid frontmatter in ${filePath}`,\n ) as Promise<Record<string, unknown>>;\n });\n }\n\n if (mdxHandler.postprocess?.extractLinkReferences) {\n mdxHandler.storeInitializer.pipe(\n (initializer, { codegen, environment }) => {\n codegen.addNamedImport(\n [\"$extractedReferences\"],\n RuntimePaths[environment],\n );\n return `${initializer}.$data($extractedReferences())`;\n },\n );\n }\n\n collection.handlers[\"version-control\"] = {\n client({ client }) {\n const mdxHandler = collection.handlers.mdx;\n if (!mdxHandler) return;\n\n mdxHandler.storeInitializer.pipe(\n (initializer, { codegen, environment }) => {\n codegen.addNamedImport(\n [\"$versionControl\"],\n RuntimePaths[environment],\n );\n return `${initializer}.$data($versionControl())`;\n },\n );\n\n mdxHandler.vfile.pipe(async (file) => {\n const vcData = await client.getFileData({ filePath: file.path });\n file.data[\"mdx-export\"] ??= [];\n file.data[\"mdx-export\"].push(\n {\n name: \"lastModified\",\n value: vcData.lastModified,\n },\n {\n name: \"creationDate\",\n value: vcData.creationDate,\n },\n );\n return file;\n });\n },\n };\n });\n}\n\nfunction plugin(): Plugin {\n const mdxLoaderGlob = /\\.mdx?(\\?.+?)?$/;\n\n function generateDocCollectionFrontmatterGlob(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n eager = false,\n ) {\n const handler = collection.handlers.fs;\n if (!handler) return \"\";\n return context.codegen.generateGlobImport(handler.patterns, {\n query: {\n collection: collection.name,\n only: \"frontmatter\",\n workspace: context.workspace,\n },\n import: \"frontmatter\",\n base: handler.dir,\n eager,\n });\n }\n\n function generateDocCollectionGlob(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n eager = false,\n ) {\n const handler = collection.handlers.fs;\n if (!handler) return \"\";\n return context.codegen.generateGlobImport(handler.patterns, {\n query: {\n collection: collection.name,\n workspace: context.workspace,\n },\n base: handler.dir,\n eager,\n });\n }\n\n async function generateCollectionStoreServer(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n ) {\n const mdxHandler = collection.handlers.mdx;\n const fsHandler = collection.handlers.fs;\n if (!fsHandler || !mdxHandler) return;\n const { core, codegen } = context;\n const runtimePath = RuntimePaths.server;\n const base = slash(path.relative(process.cwd(), fsHandler.dir));\n let initializer: string;\n codegen.addNamespaceImport(\n \"Config\",\n codegen.formatImportPath(core.getOptions().configPath),\n true,\n );\n\n if (mdxHandler.lazy) {\n codegen.addNamedImport([\"mdxStoreLazy\"], runtimePath);\n const [headGlob, bodyGlob] = await Promise.all([\n generateDocCollectionFrontmatterGlob(context, collection, true),\n generateDocCollectionGlob(context, collection),\n ]);\n\n initializer = `mdxStoreLazy<typeof Config, \"${collection.name}\">(\"${collection.name}\", \"${base}\", { head: ${headGlob}, body: ${bodyGlob} })`;\n } else {\n codegen.addNamedImport([\"mdxStore\"], runtimePath);\n initializer = `mdxStore<typeof Config, \"${collection.name}\">(\"${collection.name}\", \"${base}\", ${await generateDocCollectionGlob(context, collection, true)})`;\n }\n\n initializer = mdxHandler.storeInitializer.run(initializer, {\n ...context,\n environment: \"server\",\n });\n codegen.push(`export const ${collection.name} = ${initializer};`);\n }\n\n async function generateCollectionStoreBrowser(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n ) {\n const mdxHandler = collection.handlers.mdx;\n const fsHandler = collection.handlers.fs;\n if (!fsHandler || !mdxHandler) return;\n const { core, codegen } = context;\n const runtimePath = RuntimePaths.browser;\n codegen.addNamedImport([\"mdxStoreBrowser\"], runtimePath);\n codegen.addNamespaceImport(\n \"Config\",\n codegen.formatImportPath(core.getOptions().configPath),\n true,\n );\n\n let initializer = `mdxStoreBrowser<typeof Config, \"${collection.name}\">(\"${collection.name}\", ${await generateDocCollectionGlob(context, collection)})`;\n\n initializer = mdxHandler.storeInitializer.run(initializer, {\n ...context,\n environment: \"browser\",\n });\n codegen.push(`export const ${collection.name} = ${initializer};`);\n }\n\n async function generateCollectionStoreDynamic(\n context: EmitCodeGeneratorContext,\n collection: Collection,\n ) {\n const mdxHandler = collection.handlers.mdx;\n const fsHandler = collection.handlers.fs;\n if (!fsHandler || !mdxHandler || !mdxHandler.dynamic) return;\n const { core, codegen } = context;\n const { configPath, workspace, outDir } = core.getOptions();\n const runtimePath = RuntimePaths.dynamic;\n const base = slash(path.relative(process.cwd(), fsHandler.dir));\n codegen.addNamespaceImport(\n \"Config\",\n codegen.formatImportPath(core.getOptions().configPath),\n );\n codegen.addNamedImport([\"mdxStoreDynamic\"], runtimePath);\n\n const coreOptions: CoreOptions = {\n configPath,\n workspace,\n outDir,\n };\n let initializer = `mdxStoreDynamic<typeof Config, \"${collection.name}\">(Config, ${JSON.stringify(\n coreOptions,\n )}, \"${collection.name}\", \"${base}\", ${await generateDocCollectionFrontmatterGlob(context, collection, true)})`;\n\n initializer = mdxHandler.storeInitializer.run(initializer, {\n ...context,\n environment: \"dynamic\",\n });\n codegen.push(`export const ${collection.name} = ${initializer};`);\n }\n\n const base: Plugin = {\n name: \"mdx\",\n configureServer(server) {\n if (!server.watcher) return;\n\n server.watcher.on(\"all\", async (event, file) => {\n const updatedCollection = this.core\n .getCollections()\n .find((collection) => {\n const handlers = collection.handlers;\n if (!handlers.mdx || !handlers.fs) return false;\n if (event === \"change\" && !handlers.mdx.dynamic) return false;\n return handlers.fs.hasFile(file);\n });\n\n if (!updatedCollection) return;\n await this.core.emit({\n filterPlugin: (plugin) => plugin.name === base.name,\n filterWorkspace: () => false,\n write: true,\n });\n });\n },\n emit() {\n return Promise.all([\n this.createCodeGenerator(\"mdx.ts\", async (ctx) => {\n for (const collection of this.core.getCollections()) {\n await generateCollectionStoreServer(ctx, collection);\n }\n }),\n\n this.createCodeGenerator(\"mdx-browser.ts\", async (ctx) => {\n for (const collection of this.core.getCollections()) {\n await generateCollectionStoreBrowser(ctx, collection);\n }\n\n ctx.codegen.push(\n `export { useRenderer } from \"${RuntimePaths.browser}\";`,\n );\n }),\n\n this.createCodeGenerator(\"mdx-dynamic.ts\", async (ctx) => {\n for (const collection of this.core.getCollections()) {\n await generateCollectionStoreDynamic(ctx, collection);\n }\n }),\n ]);\n },\n next: {\n config(nextConfig) {\n const { configPath, outDir } = this.core.getOptions();\n const loaderPath = \"fuma-content/collections/mdx/loader-webpack\";\n const loaderOptions: WebpackLoaderOptions = {\n configPath,\n outDir,\n absoluteCompiledConfigPath: path.resolve(\n this.core.getCompiledConfigPath(),\n ),\n isDev: process.env.NODE_ENV === \"development\",\n };\n\n return {\n ...nextConfig,\n turbopack: {\n ...nextConfig.turbopack,\n rules: {\n ...nextConfig.turbopack?.rules,\n \"*.{md,mdx}\": {\n loaders: [\n {\n loader: loaderPath,\n options: loaderOptions as unknown as TurbopackLoaderOptions,\n },\n ],\n as: \"*.js\",\n },\n },\n },\n pageExtensions: [\n ...(nextConfig.pageExtensions ?? [\"js\", \"jsx\", \"tsx\", \"ts\"]),\n \"mdx\",\n \"md\",\n ],\n webpack(config: Configuration, options) {\n config.module ||= {};\n config.module.rules ||= [];\n config.module.rules.push({\n test: mdxLoaderGlob,\n use: [\n options.defaultLoaders.babel,\n {\n loader: loaderPath,\n options: loaderOptions,\n },\n ],\n });\n\n return nextConfig.webpack?.(config, options) ?? config;\n },\n };\n },\n },\n };\n\n return withLoader(base, {\n test: mdxLoaderGlob,\n async createLoader() {\n const { createMdxLoader } = await import(\"./mdx/loader\");\n return createMdxLoader({\n getCore: () => this.core,\n });\n },\n });\n}\n\nexport type { ExtractedReference } from \"@/collections/mdx/remark-postprocess\";\nexport type { CompiledMDXData, CompiledMDX } from \"@/collections/mdx/build-mdx\";\n"],"mappings":";;;;;;;;;AAgFA,MAAMA,cAAkC;CACtC,IAAI;CACJ,SAAS,CAAC,QAAQ,CAAC;CACpB;AAED,MAAM,eAAe;CACnB,SAAS;CACT,SAAS;CACT,QAAQ;CACT;AAED,SAAgB,UAGd,QAKA;CACA,MAAM,EAAE,OAAO,OAAO,UAAU,UAAU;AAC1C,QAAO,iBAAiB,cAAc,YAAY,YAAY;AAC5D,qBAAmB,YAAY,SAAS;GACtC,kBAAkB,CAAC,OAAO,KAAK;GAC/B,GAAG;GACJ,CAAC;EACF,MAAM,aAAc,WAAW,SAAS,MAAM;GAC5C,KAAK,QAAQ,YACT,KAAK,QAAQ,QAAQ,UAAU,IAAI,GACnC,QAAQ,KAAK;GACjB,aAAa,OAAO;GACpB,eAAe,OAAO;GACtB;GACM;GACN,OAAO,WAAW;GAClB,aAAa,WAAW;GACxB,kBAAkB,MAAM;GACzB;AAED,MAAI,OAAO,aAAa;GACtB,MAAM,cAAc,OAAO;AAC3B,cAAW,YAAY,MAAM,MAAM,EAAE,eAAe;AAClD,WAAO,SACL,aACA,MACA,QACA,0BAA0B,WAC3B;KACD;;AAGJ,MAAI,WAAW,aAAa,sBAC1B,YAAW,iBAAiB,MACzB,aAAa,EAAE,SAAS,kBAAkB;AACzC,WAAQ,eACN,CAAC,uBAAuB,EACxB,aAAa,aACd;AACD,UAAO,GAAG,YAAY;IAEzB;AAGH,aAAW,SAAS,qBAAqB,EACvC,OAAO,EAAE,UAAU;GACjB,MAAMC,eAAa,WAAW,SAAS;AACvC,OAAI,CAACA,aAAY;AAEjB,gBAAW,iBAAiB,MACzB,aAAa,EAAE,SAAS,kBAAkB;AACzC,YAAQ,eACN,CAAC,kBAAkB,EACnB,aAAa,aACd;AACD,WAAO,GAAG,YAAY;KAEzB;AAED,gBAAW,MA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,gBAAgB,CACjD,OAAM,+BAA+B,KAAK,WAAW;AAGvD,SAAI,QAAQ,KACV,gCAAgC,aAAa,QAAQ,IACtD;MACD;IAEF,KAAK,oBAAoB,kBAAkB,OAAO,QAAQ;AACxD,UAAK,MAAM,cAAc,KAAK,KAAK,gBAAgB,CACjD,OAAM,+BAA+B,KAAK,WAAW;MAEvD;IACH,CAAC;;EAEJ,MAAM,EACJ,OAAO,YAAY;GACjB,MAAM,EAAE,YAAY,WAAW,KAAK,KAAK,YAAY;GACrD,MAAM,aAAa;GACnB,MAAMC,gBAAsC;IAC1C;IACA;IACA,4BAA4B,KAAK,QAC/B,KAAK,KAAK,uBAAuB,CAClC;IACD,OAAO,QAAQ,IAAI,aAAa;IACjC;AAED,UAAO;IACL,GAAG;IACH,WAAW;KACT,GAAG,WAAW;KACd,OAAO;MACL,GAAG,WAAW,WAAW;MACzB,cAAc;OACZ,SAAS,CACP;QACE,QAAQ;QACR,SAAS;QACV,CACF;OACD,IAAI;OACL;MACF;KACF;IACD,gBAAgB;KACd,GAAI,WAAW,kBAAkB;MAAC;MAAM;MAAO;MAAO;MAAK;KAC3D;KACA;KACD;IACD,QAAQ,QAAuB,SAAS;AACtC,YAAO,WAAW,EAAE;AACpB,YAAO,OAAO,UAAU,EAAE;AAC1B,YAAO,OAAO,MAAM,KAAK;MACvB,MAAM;MACN,KAAK,CACH,QAAQ,eAAe,OACvB;OACE,QAAQ;OACR,SAAS;OACV,CACF;MACF,CAAC;AAEF,YAAO,WAAW,UAAU,QAAQ,QAAQ,IAAI;;IAEnD;KAEJ;EACF;AAED,QAAO,WAAW,MAAM;EACtB,MAAM;EACN,MAAM,eAAe;GACnB,MAAM,EAAE,oBAAoB,MAAM,OAAO;AACzC,UAAO,gBAAgB,EACrB,eAAe,KAAK,MACrB,CAAC;;EAEL,CAAC"}
@@ -1,9 +0,0 @@
1
- import "../../core-Bkh-SI_3.js";
2
- import { WebpackLoaderOptions } from "../../plugins/with-loader/webpack.js";
3
- import { LoaderContext } from "webpack";
4
-
5
- //#region src/collections/meta/loader-webpack.d.ts
6
- declare function loader(this: LoaderContext<WebpackLoaderOptions>, source: string): Promise<void>;
7
- //#endregion
8
- export { loader as default };
9
- //# sourceMappingURL=loader-webpack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader-webpack.d.ts","names":[],"sources":["../../../src/collections/meta/loader-webpack.ts"],"sourcesContent":[],"mappings":";;;;;iBAY8B,MAAA,OACtB,cAAc,wCAEnB"}