fuma-content 1.0.1 → 1.0.3

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 (147) hide show
  1. package/dist/async-cache-C0J_pTbk.js +29 -0
  2. package/dist/async-cache-C0J_pTbk.js.map +1 -0
  3. package/dist/bin.d.ts +1 -1
  4. package/dist/bin.js +21 -14
  5. package/dist/bin.js.map +1 -0
  6. package/dist/build-mdx-CSrSOQxF.js +4 -0
  7. package/dist/build-mdx-DugsQ0sk.js +395 -0
  8. package/dist/build-mdx-DugsQ0sk.js.map +1 -0
  9. package/dist/bun/index.d.ts +6 -13
  10. package/dist/bun/index.d.ts.map +1 -0
  11. package/dist/bun/index.js +18 -34
  12. package/dist/bun/index.js.map +1 -0
  13. package/dist/bun-Br1ReMiq.js +35 -0
  14. package/dist/bun-Br1ReMiq.js.map +1 -0
  15. package/dist/code-generator-BvuyL0UO.js +133 -0
  16. package/dist/code-generator-BvuyL0UO.js.map +1 -0
  17. package/dist/collections/handlers/fs.d.ts +2 -10
  18. package/dist/collections/handlers/fs.js +31 -6
  19. package/dist/collections/handlers/fs.js.map +1 -0
  20. package/dist/collections/index.d.ts +2 -10
  21. package/dist/collections/index.js +16 -6
  22. package/dist/collections/index.js.map +1 -0
  23. package/dist/collections/mdx/loader-webpack.d.ts +6 -14
  24. package/dist/collections/mdx/loader-webpack.d.ts.map +1 -0
  25. package/dist/collections/mdx/loader-webpack.js +23 -36
  26. package/dist/collections/mdx/loader-webpack.js.map +1 -0
  27. package/dist/collections/mdx/runtime-browser.d.ts +27 -37
  28. package/dist/collections/mdx/runtime-browser.d.ts.map +1 -0
  29. package/dist/collections/mdx/runtime-browser.js +57 -70
  30. package/dist/collections/mdx/runtime-browser.js.map +1 -0
  31. package/dist/collections/mdx/runtime-dynamic.d.ts +22 -30
  32. package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -0
  33. package/dist/collections/mdx/runtime-dynamic.js +62 -85
  34. package/dist/collections/mdx/runtime-dynamic.js.map +1 -0
  35. package/dist/collections/mdx/runtime.d.ts +31 -52
  36. package/dist/collections/mdx/runtime.d.ts.map +1 -0
  37. package/dist/collections/mdx/runtime.js +24 -34
  38. package/dist/collections/mdx/runtime.js.map +1 -0
  39. package/dist/collections/mdx.d.ts +2 -10
  40. package/dist/collections/mdx.js +241 -284
  41. package/dist/collections/mdx.js.map +1 -0
  42. package/dist/collections/meta/loader-webpack.d.ts +6 -14
  43. package/dist/collections/meta/loader-webpack.d.ts.map +1 -0
  44. package/dist/collections/meta/loader-webpack.js +22 -39
  45. package/dist/collections/meta/loader-webpack.js.map +1 -0
  46. package/dist/collections/meta/runtime.d.ts +7 -15
  47. package/dist/collections/meta/runtime.d.ts.map +1 -0
  48. package/dist/collections/meta/runtime.js +9 -15
  49. package/dist/collections/meta/runtime.js.map +1 -0
  50. package/dist/collections/meta.d.ts +2 -10
  51. package/dist/collections/meta.js +125 -164
  52. package/dist/collections/meta.js.map +1 -0
  53. package/dist/collections/runtime/file-store.d.ts +17 -14
  54. package/dist/collections/runtime/file-store.d.ts.map +1 -0
  55. package/dist/collections/runtime/file-store.js +30 -6
  56. package/dist/collections/runtime/file-store.js.map +1 -0
  57. package/dist/collections/runtime/store.d.ts +3 -28
  58. package/dist/collections/runtime/store.js +3 -6
  59. package/dist/config/index.d.ts +2 -10
  60. package/dist/config/index.js +6 -5
  61. package/dist/config/index.js.map +1 -0
  62. package/dist/core-CRWvbE7W.d.ts +588 -0
  63. package/dist/core-CRWvbE7W.d.ts.map +1 -0
  64. package/dist/core-CnZQDCJ1.js +205 -0
  65. package/dist/core-CnZQDCJ1.js.map +1 -0
  66. package/dist/dynamic.d.ts +24 -0
  67. package/dist/dynamic.d.ts.map +1 -0
  68. package/dist/dynamic.js +28 -0
  69. package/dist/dynamic.js.map +1 -0
  70. package/dist/fuma-matter-D3kkMkdj.js +27 -0
  71. package/dist/fuma-matter-D3kkMkdj.js.map +1 -0
  72. package/dist/index.d.ts +17 -16
  73. package/dist/index.d.ts.map +1 -0
  74. package/dist/index.js +6 -8
  75. package/dist/load-from-file-BctwhOUd.js +3 -0
  76. package/dist/load-from-file-XiM8eZha.js +37 -0
  77. package/dist/load-from-file-XiM8eZha.js.map +1 -0
  78. package/dist/loader-BHMDOncZ.js +4 -0
  79. package/dist/loader-C7W_Rwj8.js +80 -0
  80. package/dist/loader-C7W_Rwj8.js.map +1 -0
  81. package/dist/loader-DLSJPUiO.js +69 -0
  82. package/dist/loader-DLSJPUiO.js.map +1 -0
  83. package/dist/loader-DkmGoUvo.js +4 -0
  84. package/dist/next/index.cjs +457 -554
  85. package/dist/next/index.d.ts +16 -22
  86. package/dist/next/index.d.ts.map +1 -0
  87. package/dist/next/index.js +71 -89
  88. package/dist/next/index.js.map +1 -0
  89. package/dist/node/loader.d.ts +4 -2
  90. package/dist/node/loader.d.ts.map +1 -0
  91. package/dist/node/loader.js +29 -44
  92. package/dist/node/loader.js.map +1 -0
  93. package/dist/node-CVAU22o3.js +31 -0
  94. package/dist/node-CVAU22o3.js.map +1 -0
  95. package/dist/pipe-UEMV1mRg.js +31 -0
  96. package/dist/pipe-UEMV1mRg.js.map +1 -0
  97. package/dist/plugins/git.d.ts +2 -10
  98. package/dist/plugins/git.js +57 -65
  99. package/dist/plugins/git.js.map +1 -0
  100. package/dist/plugins/json-schema.d.ts +2 -10
  101. package/dist/plugins/json-schema.js +60 -58
  102. package/dist/plugins/json-schema.js.map +1 -0
  103. package/dist/plugins/with-loader/index.d.ts +2 -61
  104. package/dist/plugins/with-loader/index.js +28 -6
  105. package/dist/plugins/with-loader/index.js.map +1 -0
  106. package/dist/plugins/with-loader/webpack.d.ts +10 -18
  107. package/dist/plugins/with-loader/webpack.d.ts.map +1 -0
  108. package/dist/plugins/with-loader/webpack.js +43 -12
  109. package/dist/plugins/with-loader/webpack.js.map +1 -0
  110. package/dist/store-BtGmZUAC.d.ts +31 -0
  111. package/dist/store-BtGmZUAC.d.ts.map +1 -0
  112. package/dist/store-D166MOLw.js +37 -0
  113. package/dist/store-D166MOLw.js.map +1 -0
  114. package/dist/validation-BYUzZIfc.js +37 -0
  115. package/dist/validation-BYUzZIfc.js.map +1 -0
  116. package/dist/vite/index.d.ts +22 -28
  117. package/dist/vite/index.d.ts.map +1 -0
  118. package/dist/vite/index.js +44 -53
  119. package/dist/vite/index.js.map +1 -0
  120. package/dist/vite-6awgG092.js +33 -0
  121. package/dist/vite-6awgG092.js.map +1 -0
  122. package/package.json +47 -42
  123. package/dist/build-mdx-I4NROXCF.js +0 -8
  124. package/dist/bun-DMNX4PBC.js +0 -40
  125. package/dist/chunk-3VQS3KSP.js +0 -39
  126. package/dist/chunk-BTRE6MOX.js +0 -16
  127. package/dist/chunk-E4HRKSP4.js +0 -24
  128. package/dist/chunk-ERBMAQYP.js +0 -33
  129. package/dist/chunk-GGL4EF6H.js +0 -38
  130. package/dist/chunk-JBZTQ55D.js +0 -30
  131. package/dist/chunk-KH5GT2Y5.js +0 -104
  132. package/dist/chunk-LUM7SIZN.js +0 -40
  133. package/dist/chunk-MT7RY65Y.js +0 -167
  134. package/dist/chunk-NRZ4GE5O.js +0 -207
  135. package/dist/chunk-OQQNA7L7.js +0 -412
  136. package/dist/chunk-OUJENWQ4.js +0 -45
  137. package/dist/chunk-RMSV4HP6.js +0 -85
  138. package/dist/chunk-RXR7OL76.js +0 -37
  139. package/dist/chunk-VWJKRQZR.js +0 -19
  140. package/dist/chunk-W6HENTK7.js +0 -44
  141. package/dist/chunk-XR5N6ZXJ.js +0 -50
  142. package/dist/core-Bo8KaWQz.d.ts +0 -411
  143. package/dist/load-from-file-HL2VEY3M.js +0 -7
  144. package/dist/loader-NFSL6P5I.js +0 -7
  145. package/dist/loader-T756NSCS.js +0 -7
  146. package/dist/node-DCMYL4DL.js +0 -34
  147. package/dist/vite-QCUPZHHB.js +0 -32
@@ -0,0 +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, type Plugin } from \"@/core\";\n\nexport interface PluginOptions {\n /**\n * @defaultValue content.config.ts\n */\n configPath?: string;\n\n /**\n * Update Vite config to fix module resolution of Fumadocs\n *\n * @defaultValue true\n */\n updateViteConfig?: boolean;\n\n /**\n * Output directory of generated files\n *\n * @defaultValue '.content'\n */\n outDir?: string;\n}\n\nexport default async function content(\n config: Record<string, unknown>,\n pluginOptions: PluginOptions = {},\n): Promise<PluginOption[]> {\n const options = applyDefaults(pluginOptions);\n const core = new Core(options);\n await core.init({\n config,\n plugins: [vitePlugin()],\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 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\nexport async function createStandaloneCore(pluginOptions: PluginOptions = {}) {\n const { loadConfig } = await import(\"@/config/load-from-file\");\n const core = new Core(applyDefaults(pluginOptions));\n await core.init({\n config: loadConfig(core, true),\n plugins: [vitePlugin()],\n });\n return core;\n}\n\nfunction vitePlugin(): Plugin {\n return {\n name: \"vite\",\n config(config) {\n config.emit ??= {\n target: \"vite\",\n jsExtension: false,\n };\n },\n };\n}\n\nfunction applyDefaults(options: PluginOptions): Required<PluginOptions> {\n return {\n updateViteConfig: options.updateViteConfig ?? true,\n configPath: options.configPath ?? Core.defaultOptions.configPath,\n outDir: options.outDir ?? Core.defaultOptions.outDir,\n };\n}\n"],"mappings":";;;;AAyBA,eAA8B,QAC5B,QACA,gBAA+B,EAAE,EACR;CAEzB,MAAM,OAAO,IAAI,KADD,cAAc,cAAc,CACd;AAC9B,OAAM,KAAK,KAAK;EACd;EACA,SAAS,CAAC,YAAY,CAAC;EACxB,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,SAAM,KAAK,KAAK,EAAE,OAAO,MAAM,CAAC;;EAElC,MAAM,gBAAgB,QAAQ;AAC5B,SAAM,KAAK,WAAW,EACpB,SAAS,OAAO,SACjB,CAAC;;EAEL,CACF;;AAGH,eAAsB,qBAAqB,gBAA+B,EAAE,EAAE;CAC5E,MAAM,EAAE,eAAe,MAAM,OAAO;CACpC,MAAM,OAAO,IAAI,KAAK,cAAc,cAAc,CAAC;AACnD,OAAM,KAAK,KAAK;EACd,QAAQ,WAAW,MAAM,KAAK;EAC9B,SAAS,CAAC,YAAY,CAAC;EACxB,CAAC;AACF,QAAO;;AAGT,SAAS,aAAqB;AAC5B,QAAO;EACL,MAAM;EACN,OAAO,QAAQ;AACb,UAAO,SAAS;IACd,QAAQ;IACR,aAAa;IACd;;EAEJ;;AAGH,SAAS,cAAc,SAAiD;AACtE,QAAO;EACL,kBAAkB,QAAQ,oBAAoB;EAC9C,YAAY,QAAQ,cAAc,KAAK,eAAe;EACtD,QAAQ,QAAQ,UAAU,KAAK,eAAe;EAC/C"}
@@ -0,0 +1,33 @@
1
+ import { parse } from "node:querystring";
2
+
3
+ //#region src/plugins/with-loader/vite.ts
4
+ function toVite(name, test, loader) {
5
+ return {
6
+ name: `fuma-content:${name}`,
7
+ async transform(value, id) {
8
+ if (test && !test.test(id)) return;
9
+ const [file, query = ""] = id.split("?", 2);
10
+ const result = await loader.load({
11
+ filePath: file,
12
+ query: parse(query),
13
+ getSource() {
14
+ return value;
15
+ },
16
+ development: this.environment.mode === "dev",
17
+ compiler: { addDependency: (file$1) => {
18
+ this.addWatchFile(file$1);
19
+ } }
20
+ });
21
+ if (result === null) return null;
22
+ return {
23
+ code: result.code,
24
+ map: result.map,
25
+ moduleType: result.moduleType
26
+ };
27
+ }
28
+ };
29
+ }
30
+
31
+ //#endregion
32
+ export { toVite };
33
+ //# sourceMappingURL=vite-6awgG092.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-6awgG092.js","names":["file"],"sources":["../src/plugins/with-loader/vite.ts"],"sourcesContent":["import type { SourceMap } from \"rollup\";\nimport type { PluginOption } from \"vite\";\nimport { parse } from \"node:querystring\";\nimport type { Loader } from \"@/plugins/with-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,68 +1,75 @@
1
1
  {
2
2
  "name": "fuma-content",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "The content processing layer for your app.",
5
5
  "keywords": [
6
- "Docs",
7
- "Contentlayer"
6
+ "Contentlayer",
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
+ "loader-mdx.cjs",
16
+ "loader-meta.cjs",
17
+ "dist/*"
18
+ ],
13
19
  "type": "module",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
14
22
  "exports": {
15
23
  "./config": {
16
- "import": "./dist/config/index.js",
17
- "types": "./dist/config/index.d.ts"
24
+ "types": "./dist/config/index.d.ts",
25
+ "import": "./dist/config/index.js"
26
+ },
27
+ "./dynamic": {
28
+ "types": "./dist/dynamic.d.ts",
29
+ "import": "./dist/dynamic.js"
18
30
  },
19
31
  "./next": {
20
- "import": "./dist/next/index.js",
21
32
  "types": "./dist/next/index.d.ts",
33
+ "import": "./dist/next/index.js",
22
34
  "require": "./dist/next/index.cjs"
23
35
  },
24
36
  "./vite": {
25
- "import": "./dist/vite/index.js",
26
- "types": "./dist/vite/index.d.ts"
37
+ "types": "./dist/vite/index.d.ts",
38
+ "import": "./dist/vite/index.js"
27
39
  },
28
40
  ".": {
29
- "import": "./dist/index.js",
30
- "types": "./dist/index.d.ts"
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.js"
31
43
  },
32
44
  "./collections": {
33
- "import": "./dist/collections/index.js",
34
- "types": "./dist/collections/index.d.ts"
45
+ "types": "./dist/collections/index.d.ts",
46
+ "import": "./dist/collections/index.js"
35
47
  },
36
48
  "./collections/*": {
37
- "import": "./dist/collections/*.js",
38
49
  "types": "./dist/collections/*.d.ts",
50
+ "import": "./dist/collections/*.js",
39
51
  "default": "./dist/collections/*.js"
40
52
  },
41
53
  "./node/loader": {
42
- "import": "./dist/node/loader.js",
43
- "types": "./dist/node/loader.d.ts"
54
+ "types": "./dist/node/loader.d.ts",
55
+ "import": "./dist/node/loader.js"
44
56
  },
45
57
  "./bun": {
46
- "import": "./dist/bun/index.js",
47
- "types": "./dist/bun/index.d.ts"
58
+ "types": "./dist/bun/index.d.ts",
59
+ "import": "./dist/bun/index.js"
48
60
  },
49
61
  "./plugins/with-loader": {
50
- "import": "./dist/plugins/with-loader/index.js",
51
- "types": "./dist/plugins/with-loader/index.d.ts"
62
+ "types": "./dist/plugins/with-loader/index.d.ts",
63
+ "import": "./dist/plugins/with-loader/index.js"
52
64
  },
53
65
  "./plugins/*": {
54
- "import": "./dist/plugins/*.js",
55
- "types": "./dist/plugins/*.d.ts"
66
+ "types": "./dist/plugins/*.d.ts",
67
+ "import": "./dist/plugins/*.js"
56
68
  }
57
69
  },
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
- ],
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
66
73
  "dependencies": {
67
74
  "@mdx-js/mdx": "^3.1.1",
68
75
  "@standard-schema/spec": "^1.1.0",
@@ -80,27 +87,28 @@
80
87
  "unist-util-remove-position": "^5.0.0",
81
88
  "unist-util-visit": "^5.0.0",
82
89
  "vfile": "^6.0.3",
83
- "zod": "^4.2.1"
90
+ "zod": "^4.3.5"
84
91
  },
85
92
  "devDependencies": {
86
93
  "@types/bun": "^1.3.5",
87
94
  "@types/js-yaml": "^4.0.9",
88
95
  "@types/mdast": "^4.0.4",
89
96
  "@types/mdx": "^2.0.13",
90
- "@types/node": "^24.10.2",
97
+ "@types/node": "^25.0.3",
91
98
  "@types/picomatch": "^4.0.2",
92
99
  "@types/react": "^19.2.7",
93
- "fumadocs-core": "^16.3.0",
100
+ "fumadocs-core": "^16.4.4",
94
101
  "mdast-util-directive": "^3.1.0",
95
102
  "mdast-util-mdx-jsx": "^3.2.0",
96
- "next": "16.1.0",
103
+ "next": "16.1.1",
97
104
  "react": "^19.2.3",
98
105
  "remark": "^15.0.1",
99
106
  "remark-directive": "^4.0.0",
100
107
  "remark-stringify": "^11.0.0",
101
- "rollup": "^4.53.5",
108
+ "rollup": "^4.55.1",
109
+ "tsdown": "^0.18.2",
102
110
  "typescript": "^5.9.3",
103
- "vite": "^7.3.0",
111
+ "vite": "^7.3.1",
104
112
  "webpack": "^5.104.1",
105
113
  "typescript-config": "0.0.0"
106
114
  },
@@ -120,13 +128,10 @@
120
128
  "optional": true
121
129
  }
122
130
  },
123
- "publishConfig": {
124
- "access": "public"
125
- },
126
131
  "scripts": {
127
- "build": "tsup",
132
+ "build": "tsdown",
128
133
  "clean": "rimraf dist",
129
- "dev": "tsup --watch",
134
+ "dev": "tsdown --watch",
130
135
  "types:check": "tsc --noEmit"
131
136
  }
132
137
  }
@@ -1,8 +0,0 @@
1
- import {
2
- buildMDX
3
- } from "./chunk-OQQNA7L7.js";
4
- import "./chunk-VWJKRQZR.js";
5
- import "./chunk-JBZTQ55D.js";
6
- export {
7
- buildMDX
8
- };
@@ -1,40 +0,0 @@
1
- // src/plugins/with-loader/bun.ts
2
- import { parse } from "querystring";
3
- import { readFileSync } from "fs";
4
- function toBun(test = /.+/, loader) {
5
- function toResult(output) {
6
- if (!output) return;
7
- return {
8
- contents: output.code,
9
- loader: "js"
10
- };
11
- }
12
- return (build) => {
13
- build.onLoad({ filter: test }, (args) => {
14
- const [filePath, query = ""] = args.path.split("?", 2);
15
- const input = {
16
- async getSource() {
17
- return Bun.file(filePath).text();
18
- },
19
- query: parse(query),
20
- filePath,
21
- development: false,
22
- compiler: {
23
- addDependency() {
24
- }
25
- }
26
- };
27
- if (loader.bun?.load) {
28
- return loader.bun.load(readFileSync(filePath).toString(), input);
29
- }
30
- const result = loader.load(input);
31
- if (result instanceof Promise) {
32
- return result.then(toResult);
33
- }
34
- return toResult(result);
35
- });
36
- };
37
- }
38
- export {
39
- toBun
40
- };
@@ -1,39 +0,0 @@
1
- // src/collections/runtime/store.ts
2
- var SimpleCollectionStore = class {
3
- dataMap;
4
- dataList;
5
- constructor(input) {
6
- this.dataMap = input;
7
- this.dataList = Array.from(input.values());
8
- }
9
- get(id) {
10
- return this.dataMap.get(id);
11
- }
12
- list() {
13
- return this.dataList;
14
- }
15
- $data(_cast) {
16
- return this;
17
- }
18
- /**
19
- * in-place transformation on all data
20
- */
21
- transform(fn) {
22
- this.dataList.length = 0;
23
- const dataMap = this.dataMap;
24
- const dataList = this.dataList;
25
- for (const [k, v] of this.dataMap) {
26
- const updated = fn(v);
27
- dataMap.set(k, updated);
28
- dataList.push(updated);
29
- }
30
- return this;
31
- }
32
- get $inferData() {
33
- return void 0;
34
- }
35
- };
36
-
37
- export {
38
- SimpleCollectionStore
39
- };
@@ -1,16 +0,0 @@
1
- // src/collections/index.ts
2
- function createCollection(info, init) {
3
- return {
4
- name: "",
5
- handlers: {},
6
- init(options) {
7
- this.name = options.name;
8
- init(this, options);
9
- },
10
- typeInfo: info
11
- };
12
- }
13
-
14
- export {
15
- createCollection
16
- };
@@ -1,24 +0,0 @@
1
- // src/collections/handlers/fs.ts
2
- import picomatch from "picomatch";
3
- import path from "path";
4
- function buildFileHandler({ workspace }, config, supportedFormats) {
5
- const patterns = config.files ?? [`**/*.{${supportedFormats.join(",")}}`];
6
- let matcher;
7
- return {
8
- patterns,
9
- dir: workspace ? path.resolve(workspace.dir, config.dir) : config.dir,
10
- isFileSupported(filePath) {
11
- return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
12
- },
13
- hasFile(filePath) {
14
- if (!this.isFileSupported(filePath)) return false;
15
- const relativePath = path.relative(this.dir, filePath);
16
- if (relativePath.startsWith(`..${path.sep}`)) return false;
17
- return (matcher ??= picomatch(patterns))(relativePath);
18
- }
19
- };
20
- }
21
-
22
- export {
23
- buildFileHandler
24
- };
@@ -1,33 +0,0 @@
1
- // src/plugins/with-loader/index.ts
2
- function withLoader(plugin, { test, createLoader }) {
3
- let loader;
4
- return {
5
- bun: {
6
- async build(build) {
7
- const { toBun } = await import("./bun-DMNX4PBC.js");
8
- toBun(test, await (loader ??= createLoader.call(this, "bun")))(build);
9
- }
10
- },
11
- node: {
12
- async createLoad() {
13
- const { toNode } = await import("./node-DCMYL4DL.js");
14
- return toNode(test, await (loader ??= createLoader.call(this, "node")));
15
- }
16
- },
17
- vite: {
18
- async createPlugin() {
19
- const { toVite } = await import("./vite-QCUPZHHB.js");
20
- return toVite(
21
- plugin.name,
22
- test,
23
- await (loader ??= createLoader.call(this, "vite"))
24
- );
25
- }
26
- },
27
- ...plugin
28
- };
29
- }
30
-
31
- export {
32
- withLoader
33
- };
@@ -1,38 +0,0 @@
1
- // src/config/dynamic.ts
2
- import fs from "fs/promises";
3
- function createDynamicCore({
4
- core,
5
- buildConfig,
6
- mode
7
- }) {
8
- let prev;
9
- async function getConfigHash() {
10
- if (mode === "production") return "static";
11
- const stats = await fs.stat(core.getOptions().configPath).catch(() => {
12
- throw new Error("Cannot find config file");
13
- });
14
- return stats.mtime.getTime().toString();
15
- }
16
- return {
17
- async getCore() {
18
- const hash = await getConfigHash();
19
- if (!prev || hash !== prev.hash) {
20
- prev = {
21
- hash,
22
- init: (async () => {
23
- const { loadConfig } = await import("./load-from-file-HL2VEY3M.js");
24
- await core.init({
25
- config: loadConfig(core, buildConfig)
26
- });
27
- })()
28
- };
29
- }
30
- await prev.init;
31
- return core;
32
- }
33
- };
34
- }
35
-
36
- export {
37
- createDynamicCore
38
- };
@@ -1,30 +0,0 @@
1
- // src/utils/async-cache.ts
2
- function createCache(store = /* @__PURE__ */ new Map()) {
3
- return {
4
- cached(key, fn) {
5
- let cached = store.get(key);
6
- if (cached) return cached;
7
- cached = fn();
8
- if (cached instanceof Promise) {
9
- cached = cached.then((out) => {
10
- if (store.has(key)) {
11
- store.set(key, out);
12
- }
13
- return out;
14
- });
15
- }
16
- store.set(key, cached);
17
- return cached;
18
- },
19
- invalidate(key) {
20
- store.delete(key);
21
- },
22
- $value() {
23
- return this;
24
- }
25
- };
26
- }
27
-
28
- export {
29
- createCache
30
- };
@@ -1,104 +0,0 @@
1
- import {
2
- fumaMatter
3
- } from "./chunk-VWJKRQZR.js";
4
-
5
- // src/collections/mdx/loader.ts
6
- import { z } from "zod";
7
- import fs from "fs/promises";
8
- import path from "path";
9
- import { createHash } from "crypto";
10
- var querySchema = z.object({
11
- only: z.literal(["frontmatter", "all"]).default("all"),
12
- collection: z.string().optional(),
13
- workspace: z.string().optional()
14
- }).loose();
15
- var cacheEntry = z.object({
16
- code: z.string(),
17
- map: z.any().optional(),
18
- hash: z.string().optional()
19
- });
20
- function createMdxLoader({ getCore }) {
21
- return {
22
- async load({
23
- getSource,
24
- development: isDevelopment,
25
- query,
26
- compiler,
27
- filePath
28
- }) {
29
- let core = await getCore();
30
- const value = await getSource();
31
- const matter = fumaMatter(value);
32
- const {
33
- collection: collectionName,
34
- workspace,
35
- only
36
- } = querySchema.parse(query);
37
- if (workspace) {
38
- core = core.getWorkspaces().get(workspace) ?? core;
39
- }
40
- let after;
41
- const { experimentalBuildCache = false } = core.getConfig();
42
- if (!isDevelopment && experimentalBuildCache) {
43
- const cacheDir = experimentalBuildCache;
44
- const cacheKey = `${collectionName ?? "global"}_${generateCacheHash(filePath)}`;
45
- const cached = await fs.readFile(path.join(cacheDir, cacheKey)).then((content) => cacheEntry.parse(JSON.parse(content.toString()))).catch(() => null);
46
- if (cached && cached.hash === generateCacheHash(value)) return cached;
47
- after = async () => {
48
- await fs.mkdir(cacheDir, { recursive: true });
49
- await fs.writeFile(
50
- path.join(cacheDir, cacheKey),
51
- JSON.stringify({
52
- ...out,
53
- hash: generateCacheHash(value)
54
- })
55
- );
56
- };
57
- }
58
- const collection = collectionName ? core.getCollection(collectionName) : void 0;
59
- const handler = collection?.handlers.mdx;
60
- if (collection && handler?.frontmatter) {
61
- matter.data = await handler.frontmatter.call(
62
- { collection, filePath, source: value },
63
- matter.data
64
- );
65
- }
66
- if (only === "frontmatter") {
67
- return {
68
- code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
69
- map: null
70
- };
71
- }
72
- const lineOffset = isDevelopment ? countLines(matter.matter) : 0;
73
- const { buildMDX } = await import("./build-mdx-I4NROXCF.js");
74
- const compiled = await buildMDX(core, collection, {
75
- isDevelopment,
76
- source: "\n".repeat(lineOffset) + matter.content,
77
- filePath,
78
- frontmatter: matter.data,
79
- _compiler: compiler,
80
- environment: "bundler"
81
- });
82
- const out = {
83
- code: String(compiled.value),
84
- map: compiled.map
85
- };
86
- await after?.();
87
- return out;
88
- }
89
- };
90
- }
91
- function generateCacheHash(input) {
92
- return createHash("md5").update(input).digest("hex");
93
- }
94
- function countLines(s) {
95
- let num = 0;
96
- for (const c of s) {
97
- if (c === "\n") num++;
98
- }
99
- return num;
100
- }
101
-
102
- export {
103
- createMdxLoader
104
- };
@@ -1,40 +0,0 @@
1
- import {
2
- buildConfig
3
- } from "./chunk-W6HENTK7.js";
4
-
5
- // src/config/load-from-file.ts
6
- import { pathToFileURL } from "url";
7
- async function compileConfig(core) {
8
- const { build } = await import("esbuild");
9
- const { configPath, outDir } = core.getOptions();
10
- const transformed = await build({
11
- entryPoints: [{ in: configPath, out: "content.config" }],
12
- bundle: true,
13
- outdir: outDir,
14
- target: "node20",
15
- write: true,
16
- platform: "node",
17
- format: "esm",
18
- packages: "external",
19
- outExtension: {
20
- ".js": ".mjs"
21
- },
22
- allowOverwrite: true
23
- });
24
- if (transformed.errors.length > 0) {
25
- throw new Error("failed to compile configuration file");
26
- }
27
- }
28
- async function loadConfig(core, build = false) {
29
- if (build) await compileConfig(core);
30
- const url = pathToFileURL(core.getCompiledConfigPath());
31
- url.searchParams.set("hash", Date.now().toString());
32
- const config = import(url.href).then(
33
- (loaded) => buildConfig(loaded)
34
- );
35
- return await config;
36
- }
37
-
38
- export {
39
- loadConfig
40
- };