fuma-content 1.1.1 → 1.1.2
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.
- package/dist/{build-mdx-BZxE8t2a.js → build-mdx-CUp6FpfT.js} +2 -2
- package/dist/{build-mdx-BZxE8t2a.js.map → build-mdx-CUp6FpfT.js.map} +1 -1
- package/dist/build-mdx-D6zM3Sgl.js +4 -0
- package/dist/bun/index.d.ts +1 -1
- package/dist/bun/index.js +2 -2
- package/dist/{code-generator-CjC4EEXg.js → code-generator-Qhhq7kHh.js} +30 -24
- package/dist/code-generator-Qhhq7kHh.js.map +1 -0
- package/dist/collections/data/runtime.d.ts +6 -5
- package/dist/collections/data/runtime.d.ts.map +1 -1
- package/dist/collections/data.d.ts +5 -5
- package/dist/collections/data.d.ts.map +1 -1
- package/dist/collections/data.js +3 -3
- package/dist/collections/fs.d.ts +2 -2
- package/dist/collections/fs.js +1 -1
- package/dist/collections/index.d.ts +1 -1
- package/dist/collections/index.js +1 -1
- package/dist/collections/json/loader-webpack.d.ts +3 -3
- package/dist/collections/json/loader-webpack.js +5 -5
- package/dist/collections/mdx/loader-webpack.d.ts +3 -3
- package/dist/collections/mdx/loader-webpack.js +5 -5
- package/dist/collections/mdx/react.d.ts +10 -8
- package/dist/collections/mdx/react.d.ts.map +1 -1
- package/dist/collections/mdx/runtime-browser.d.ts +10 -8
- package/dist/collections/mdx/runtime-browser.js +1 -1
- package/dist/collections/mdx/runtime-dynamic.d.ts +9 -8
- package/dist/collections/mdx/runtime-dynamic.d.ts.map +1 -1
- package/dist/collections/mdx/runtime-dynamic.js +6 -6
- package/dist/collections/mdx/runtime.d.ts +9 -7
- package/dist/collections/mdx.d.ts +5 -5
- package/dist/collections/mdx.js +4 -4
- package/dist/collections/runtime/file-store.d.ts +3 -2
- package/dist/collections/runtime/file-store.js +1 -4
- package/dist/collections/runtime/file-store.js.map +1 -1
- package/dist/collections/runtime/store.d.ts +2 -2
- package/dist/collections/runtime/store.js +1 -1
- package/dist/collections/yaml/loader-webpack.d.ts +3 -3
- package/dist/collections/yaml/loader-webpack.js +5 -5
- package/dist/{collections-CA4UxFun.js → collections-CNWuMDAZ.js} +7 -9
- package/dist/collections-CNWuMDAZ.js.map +1 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js.map +1 -1
- package/dist/{core-BBWmcGSK.d.ts → core-CT06v32N.d.ts} +23 -23
- package/dist/core-CT06v32N.d.ts.map +1 -0
- package/dist/{core--4f2Q_1e.js → core-Uv3jZqL-.js} +15 -20
- package/dist/core-Uv3jZqL-.js.map +1 -0
- package/dist/{data-CEF6c9lw.js → data-Cxsx5KPD.js} +34 -33
- package/dist/data-Cxsx5KPD.js.map +1 -0
- package/dist/{dynamic-CtP2lSKk.d.ts → dynamic-Ck1wYoaL.d.ts} +2 -2
- package/dist/{dynamic-CtP2lSKk.d.ts.map → dynamic-Ck1wYoaL.d.ts.map} +1 -1
- package/dist/dynamic.d.ts +2 -2
- package/dist/{file-store-DuAY_Td0.d.ts → file-store-Dm1SjuLg.d.ts} +2 -3
- package/dist/file-store-Dm1SjuLg.d.ts.map +1 -0
- package/dist/{fs-B5nG0vk1.js → fs-CXzVd2Dp.js} +17 -13
- package/dist/fs-CXzVd2Dp.js.map +1 -0
- package/dist/{fs-BhyPXf1u.d.ts → fs-CmwaaFyx.d.ts} +3 -2
- package/dist/fs-CmwaaFyx.d.ts.map +1 -0
- package/dist/{git-BsHTaepF.js → git-DnejL9r_.js} +2 -2
- package/dist/{git-BsHTaepF.js.map → git-DnejL9r_.js.map} +1 -1
- package/dist/{git-CG9Jou-A.d.ts → git-n-9ddn78.d.ts} +2 -2
- package/dist/{git-CG9Jou-A.d.ts.map → git-n-9ddn78.d.ts.map} +1 -1
- package/dist/{index-DAchVPIz.d.ts → index-BheUVWBm.d.ts} +3 -3
- package/dist/{index-DAchVPIz.d.ts.map → index-BheUVWBm.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{loader-Cff0rlh7.js → loader-B4nQrRwA.js} +2 -2
- package/dist/{loader-Cff0rlh7.js.map → loader-B4nQrRwA.js.map} +1 -1
- package/dist/loader-B6ordrWK.js +9 -0
- package/dist/{loader-CtrU5IEv.js → loader-BK8PnqRg.js} +2 -2
- package/dist/{loader-CtrU5IEv.js.map → loader-BK8PnqRg.js.map} +1 -1
- package/dist/{loader-CCb07d3O.js → loader-CnksfM7I.js} +3 -3
- package/dist/{loader-CCb07d3O.js.map → loader-CnksfM7I.js.map} +1 -1
- package/dist/{loader-DZ-8sxfs.js → loader-Cnz-VHne.js} +2 -2
- package/dist/{loader-DZ-8sxfs.js.map → loader-Cnz-VHne.js.map} +1 -1
- package/dist/{loader-Be0nPRo7.js → loader-CuntMmR4.js} +2 -2
- package/dist/{loader-Be0nPRo7.js.map → loader-CuntMmR4.js.map} +1 -1
- package/dist/loader-Cx1Rg_VM.js +8 -0
- package/dist/loader-Dao_nv3e.js +8 -0
- package/dist/mdx-Cw1nBJ0D.js +306 -0
- package/dist/mdx-Cw1nBJ0D.js.map +1 -0
- package/dist/{mdx-B2Umeh_M.d.ts → mdx-PaqRNZMS.d.ts} +7 -16
- package/dist/mdx-PaqRNZMS.d.ts.map +1 -0
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +2 -2
- package/dist/node/index.d.ts +1 -1
- package/dist/node/loader.d.ts +1 -1
- package/dist/node/loader.js +2 -2
- package/dist/plugins/git.d.ts +2 -2
- package/dist/plugins/git.js +1 -1
- package/dist/plugins/json-schema.d.ts +1 -1
- package/dist/plugins/json-schema.js +2 -2
- package/dist/plugins/loader/index.d.ts +3 -3
- package/dist/plugins/loader/index.js +1 -1
- package/dist/plugins/loader/webpack.d.ts +3 -3
- package/dist/plugins/loader/webpack.js +1 -1
- package/dist/{runtime-6EXTvWJC.d.ts → runtime-BUUHSFlR.d.ts} +5 -5
- package/dist/{runtime-6EXTvWJC.d.ts.map → runtime-BUUHSFlR.d.ts.map} +1 -1
- package/dist/{runtime-browser-CWRjOL5k.d.ts → runtime-browser-B70WGxeQ.d.ts} +4 -4
- package/dist/{runtime-browser-CWRjOL5k.d.ts.map → runtime-browser-B70WGxeQ.d.ts.map} +1 -1
- package/dist/{store-IvpEBdxi.js → store-CRyvZFKN.js} +7 -10
- package/dist/{store-IvpEBdxi.js.map → store-CRyvZFKN.js.map} +1 -1
- package/dist/{store-cFBKt8gh.d.ts → store-D_PPrdRE.d.ts} +4 -4
- package/dist/{store-cFBKt8gh.d.ts.map → store-D_PPrdRE.d.ts.map} +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +2 -2
- package/package.json +1 -1
- package/dist/build-mdx-LhpFasX-.js +0 -4
- package/dist/code-generator-CjC4EEXg.js.map +0 -1
- package/dist/collections-CA4UxFun.js.map +0 -1
- package/dist/core--4f2Q_1e.js.map +0 -1
- package/dist/core-BBWmcGSK.d.ts.map +0 -1
- package/dist/data-CEF6c9lw.js.map +0 -1
- package/dist/file-store-DuAY_Td0.d.ts.map +0 -1
- package/dist/fs-B5nG0vk1.js.map +0 -1
- package/dist/fs-BhyPXf1u.d.ts.map +0 -1
- package/dist/loader-B36I1Ac5.js +0 -9
- package/dist/loader-Bf075jNM.js +0 -8
- package/dist/loader-Weah2DhH.js +0 -8
- package/dist/mdx-B2Umeh_M.d.ts.map +0 -1
- package/dist/mdx-DqCW-MvL.js +0 -303
- package/dist/mdx-DqCW-MvL.js.map +0 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { i as pipe, r as asyncPipe } from "./collections-CNWuMDAZ.js";
|
|
2
|
+
import { n as slash } from "./code-generator-Qhhq7kHh.js";
|
|
3
|
+
import { r as validate } from "./validation-BvVvvLII.js";
|
|
4
|
+
import { t as loaderHook } from "./loader-B4nQrRwA.js";
|
|
5
|
+
import { t as FileSystemCollection } from "./fs-CXzVd2Dp.js";
|
|
6
|
+
import { n as gitHook } from "./git-DnejL9r_.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
|
|
9
|
+
//#region src/collections/mdx.ts
|
|
10
|
+
const RuntimePaths = {
|
|
11
|
+
browser: "fuma-content/collections/mdx/runtime-browser",
|
|
12
|
+
dynamic: "fuma-content/collections/mdx/runtime-dynamic",
|
|
13
|
+
server: "fuma-content/collections/mdx/runtime"
|
|
14
|
+
};
|
|
15
|
+
function formatInitializer(code) {
|
|
16
|
+
return `${code.fn}<${code.typeParams.join()}>(${code.params.join()})`;
|
|
17
|
+
}
|
|
18
|
+
var MDXCollection = class extends FileSystemCollection {
|
|
19
|
+
dynamic;
|
|
20
|
+
lazy;
|
|
21
|
+
preprocess;
|
|
22
|
+
postprocess;
|
|
23
|
+
getMDXOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Frontmatter schema
|
|
26
|
+
*/
|
|
27
|
+
frontmatterSchema;
|
|
28
|
+
/**
|
|
29
|
+
* Transform & validate frontmatter
|
|
30
|
+
*/
|
|
31
|
+
frontmatter = asyncPipe();
|
|
32
|
+
/**
|
|
33
|
+
* Transform `vfile` on compilation stage
|
|
34
|
+
*/
|
|
35
|
+
vfile = asyncPipe();
|
|
36
|
+
/**
|
|
37
|
+
* Transform the generated initializer code (TypeScript) for collection store
|
|
38
|
+
*/
|
|
39
|
+
storeInitializer = pipe();
|
|
40
|
+
$inferFrontmatter = void 0;
|
|
41
|
+
constructor(config) {
|
|
42
|
+
super({
|
|
43
|
+
dir: config.dir,
|
|
44
|
+
files: config.files,
|
|
45
|
+
supportedFormats: ["md", "mdx"]
|
|
46
|
+
});
|
|
47
|
+
this.postprocess = config.postprocess;
|
|
48
|
+
this.getMDXOptions = config.options;
|
|
49
|
+
this.dynamic = config.dynamic ?? false;
|
|
50
|
+
this.lazy = config.lazy ?? false;
|
|
51
|
+
this.frontmatterSchema = config.frontmatter;
|
|
52
|
+
this.frontmatter.pipe(this.#onFrontmatter.bind(this));
|
|
53
|
+
this.onServer.hook(this.#onServerHandler.bind(this));
|
|
54
|
+
this.onEmit.pipe(this.#onEmitHandler.bind(this));
|
|
55
|
+
if (this.postprocess?.includeProcessedMarkdown) this.storeInitializer.pipe((code) => {
|
|
56
|
+
code.typeParams[2] += " & { /** Processed Markdown */ _markdown: string; }";
|
|
57
|
+
return code;
|
|
58
|
+
});
|
|
59
|
+
if (this.postprocess?.includeMDAST) this.storeInitializer.pipe((code) => {
|
|
60
|
+
code.typeParams[2] += " & { /** MDAST (as JSON string) */ _mdast: string; }";
|
|
61
|
+
return code;
|
|
62
|
+
});
|
|
63
|
+
if (this.postprocess?.extractLinkReferences) this.storeInitializer.pipe((code, { codegen, environment }) => {
|
|
64
|
+
codegen.addNamedImport(["WithExtractedReferences"], RuntimePaths[environment], true);
|
|
65
|
+
code.typeParams[2] += " & WithExtractedReferences";
|
|
66
|
+
return code;
|
|
67
|
+
});
|
|
68
|
+
this.pluginHook(loaderHook).loaders.push(mdxLoader());
|
|
69
|
+
this.pluginHook(gitHook).onClient.hook(this.#onGitHandler.bind(this));
|
|
70
|
+
}
|
|
71
|
+
#onFrontmatter = (data, { filePath }) => {
|
|
72
|
+
if (!this.frontmatterSchema) return data;
|
|
73
|
+
return validate(this.frontmatterSchema, data, void 0, `invalid frontmatter in ${filePath}`);
|
|
74
|
+
};
|
|
75
|
+
#onServerHandler = ({ server, core }) => {
|
|
76
|
+
if (!server.watcher) return;
|
|
77
|
+
server.watcher.on("all", async (event, file) => {
|
|
78
|
+
if (event === "change" && !this.dynamic) return;
|
|
79
|
+
if (!this.hasFile(file)) return;
|
|
80
|
+
await core.emit({
|
|
81
|
+
filterCollection: (item) => item === this,
|
|
82
|
+
filterWorkspace: () => false,
|
|
83
|
+
write: true
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
#onEmitHandler = async (entries, { core, createCodeGenerator }) => {
|
|
88
|
+
entries.push(await createCodeGenerator(`${this.name}.ts`, async ({ codegen }) => {
|
|
89
|
+
const runtimePath = RuntimePaths.server;
|
|
90
|
+
const base = slash(core._toRuntimePath(this.dir));
|
|
91
|
+
let code;
|
|
92
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(core.getOptions().configPath), true);
|
|
93
|
+
if (this.lazy) {
|
|
94
|
+
codegen.addNamedImport(["mdxStoreLazy"], runtimePath);
|
|
95
|
+
const headGlob = await this.generateDocCollectionFrontmatterGlob(core, codegen, true);
|
|
96
|
+
const bodyGlob = await this.generateDocCollectionGlob(core, codegen);
|
|
97
|
+
code = {
|
|
98
|
+
fn: "mdxStoreLazy",
|
|
99
|
+
typeParams: [
|
|
100
|
+
"typeof Config",
|
|
101
|
+
`"${this.name}"`,
|
|
102
|
+
"unknown"
|
|
103
|
+
],
|
|
104
|
+
params: [
|
|
105
|
+
`"${this.name}"`,
|
|
106
|
+
`"${base}"`,
|
|
107
|
+
`{ head: ${headGlob}, body: ${bodyGlob} }`
|
|
108
|
+
]
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
codegen.addNamedImport(["mdxStore"], runtimePath);
|
|
112
|
+
code = {
|
|
113
|
+
fn: "mdxStore",
|
|
114
|
+
typeParams: [
|
|
115
|
+
"typeof Config",
|
|
116
|
+
`"${this.name}"`,
|
|
117
|
+
"unknown"
|
|
118
|
+
],
|
|
119
|
+
params: [
|
|
120
|
+
`"${this.name}"`,
|
|
121
|
+
`"${base}"`,
|
|
122
|
+
await this.generateDocCollectionGlob(core, codegen, true)
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
code = this.storeInitializer.run(code, {
|
|
127
|
+
codegen,
|
|
128
|
+
environment: "server"
|
|
129
|
+
});
|
|
130
|
+
codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);
|
|
131
|
+
}), await createCodeGenerator(`${this.name}.browser.ts`, async ({ codegen }) => {
|
|
132
|
+
const runtimePath = RuntimePaths.browser;
|
|
133
|
+
codegen.addNamedImport(["mdxStoreBrowser"], runtimePath);
|
|
134
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(core.getOptions().configPath), true);
|
|
135
|
+
let code = {
|
|
136
|
+
fn: `mdxStoreBrowser`,
|
|
137
|
+
typeParams: [
|
|
138
|
+
"typeof Config",
|
|
139
|
+
`"${this.name}"`,
|
|
140
|
+
"unknown"
|
|
141
|
+
],
|
|
142
|
+
params: [`"${this.name}"`, await this.generateDocCollectionGlob(core, codegen)]
|
|
143
|
+
};
|
|
144
|
+
code = this.storeInitializer.run(code, {
|
|
145
|
+
codegen,
|
|
146
|
+
environment: "browser"
|
|
147
|
+
});
|
|
148
|
+
codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);
|
|
149
|
+
}));
|
|
150
|
+
if (this.dynamic) entries.push(await createCodeGenerator(`${this.name}.dynamic.ts`, async ({ codegen }) => {
|
|
151
|
+
const coreOptions = core.getOptions();
|
|
152
|
+
const runtimePath = RuntimePaths.dynamic;
|
|
153
|
+
const base = slash(core._toRuntimePath(this.dir));
|
|
154
|
+
codegen.addNamespaceImport("Config", codegen.formatImportPath(coreOptions.configPath));
|
|
155
|
+
codegen.addNamedImport(["mdxStoreDynamic"], runtimePath);
|
|
156
|
+
const serializableCoreOptions = {
|
|
157
|
+
configPath: core._toRuntimePath(coreOptions.configPath),
|
|
158
|
+
outDir: core._toRuntimePath(coreOptions.outDir),
|
|
159
|
+
cwd: core._toRuntimePath(coreOptions.cwd)
|
|
160
|
+
};
|
|
161
|
+
const jsxImportSource = (await this.getMDXOptions?.("runtime"))?.jsxImportSource ?? "react";
|
|
162
|
+
if (!jsxImportSource) throw new Error(`[Fuma Content] "jsxImportSource" is required for dynamic MDX collection "${this.name}".`);
|
|
163
|
+
codegen.addNamespaceImport("_jsx_runtime", `${jsxImportSource}/jsx-runtime`);
|
|
164
|
+
let code = {
|
|
165
|
+
fn: "mdxStoreDynamic",
|
|
166
|
+
typeParams: [
|
|
167
|
+
"typeof Config",
|
|
168
|
+
`"${this.name}"`,
|
|
169
|
+
"unknown"
|
|
170
|
+
],
|
|
171
|
+
params: [
|
|
172
|
+
"Config",
|
|
173
|
+
JSON.stringify(serializableCoreOptions),
|
|
174
|
+
`"${this.name}"`,
|
|
175
|
+
`"${base}"`,
|
|
176
|
+
await this.generateDocCollectionFrontmatterGlob(core, codegen, true),
|
|
177
|
+
"_jsx_runtime"
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
code = this.storeInitializer.run(code, {
|
|
181
|
+
codegen,
|
|
182
|
+
environment: "dynamic"
|
|
183
|
+
});
|
|
184
|
+
codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);
|
|
185
|
+
}));
|
|
186
|
+
return entries;
|
|
187
|
+
};
|
|
188
|
+
#onGitHandler = async ({ client }) => {
|
|
189
|
+
this.storeInitializer.pipe((code, { codegen, environment }) => {
|
|
190
|
+
codegen.addNamedImport(["WithGit"], RuntimePaths[environment], true);
|
|
191
|
+
code.typeParams[2] += " & WithGit";
|
|
192
|
+
return code;
|
|
193
|
+
});
|
|
194
|
+
this.vfile.pipe(async (file) => {
|
|
195
|
+
const vcData = await client.getFileData({ filePath: file.path });
|
|
196
|
+
file.data["mdx-export"] ??= [];
|
|
197
|
+
file.data["mdx-export"].push({
|
|
198
|
+
name: "lastModified",
|
|
199
|
+
value: vcData.lastModified
|
|
200
|
+
}, {
|
|
201
|
+
name: "creationDate",
|
|
202
|
+
value: vcData.creationDate
|
|
203
|
+
});
|
|
204
|
+
return file;
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
async generateDocCollectionFrontmatterGlob(core, codegen, eager = false) {
|
|
208
|
+
let s = `{`;
|
|
209
|
+
const files = await this.getFiles();
|
|
210
|
+
const query = codegen.formatQuery({
|
|
211
|
+
collection: this.name,
|
|
212
|
+
only: "frontmatter",
|
|
213
|
+
workspace: core.getWorkspace()?.name
|
|
214
|
+
});
|
|
215
|
+
for (const file of files) {
|
|
216
|
+
const fullPath = path.join(this.dir, file);
|
|
217
|
+
const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;
|
|
218
|
+
if (eager) {
|
|
219
|
+
const name = codegen.generateImportName();
|
|
220
|
+
codegen.addNamedImport([`frontmatter as ${name}`], specifier);
|
|
221
|
+
s += `"${slash(file)}": ${name},`;
|
|
222
|
+
} else s += `"${slash(file)}": () => ${codegen.formatDynamicImport(specifier, "frontmatter")},`;
|
|
223
|
+
}
|
|
224
|
+
s += "}";
|
|
225
|
+
return s;
|
|
226
|
+
}
|
|
227
|
+
async generateDocCollectionGlob(core, codegen, eager = false) {
|
|
228
|
+
let s = `{`;
|
|
229
|
+
const files = await this.getFiles();
|
|
230
|
+
const query = codegen.formatQuery({
|
|
231
|
+
collection: this.name,
|
|
232
|
+
workspace: core.getWorkspace()?.name
|
|
233
|
+
});
|
|
234
|
+
for (const file of files) {
|
|
235
|
+
const fullPath = path.join(this.dir, file);
|
|
236
|
+
const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;
|
|
237
|
+
if (eager) {
|
|
238
|
+
const name = codegen.generateImportName();
|
|
239
|
+
codegen.addNamespaceImport(name, specifier);
|
|
240
|
+
s += `"${slash(file)}": ${name},`;
|
|
241
|
+
} else s += `"${slash(file)}": () => ${codegen.formatDynamicImport(specifier)},`;
|
|
242
|
+
}
|
|
243
|
+
s += "}";
|
|
244
|
+
return s;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
function mdxCollection(config) {
|
|
248
|
+
return new MDXCollection(config);
|
|
249
|
+
}
|
|
250
|
+
function mdxLoader() {
|
|
251
|
+
const test = /\.mdx?(\?.+?)?$/;
|
|
252
|
+
return {
|
|
253
|
+
id: "mdx",
|
|
254
|
+
test,
|
|
255
|
+
configureNext(nextConfig) {
|
|
256
|
+
const loaderPath = "fuma-content/collections/mdx/loader-webpack";
|
|
257
|
+
const loaderOptions = this.getLoaderOptions();
|
|
258
|
+
return {
|
|
259
|
+
...nextConfig,
|
|
260
|
+
turbopack: {
|
|
261
|
+
...nextConfig.turbopack,
|
|
262
|
+
rules: {
|
|
263
|
+
...nextConfig.turbopack?.rules,
|
|
264
|
+
"*.{md,mdx}": {
|
|
265
|
+
loaders: [{
|
|
266
|
+
loader: loaderPath,
|
|
267
|
+
options: loaderOptions
|
|
268
|
+
}],
|
|
269
|
+
as: "*.js"
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
pageExtensions: [
|
|
274
|
+
...nextConfig.pageExtensions ?? [
|
|
275
|
+
"js",
|
|
276
|
+
"jsx",
|
|
277
|
+
"tsx",
|
|
278
|
+
"ts"
|
|
279
|
+
],
|
|
280
|
+
"mdx",
|
|
281
|
+
"md"
|
|
282
|
+
],
|
|
283
|
+
webpack(config, options) {
|
|
284
|
+
config.module ||= {};
|
|
285
|
+
config.module.rules ||= [];
|
|
286
|
+
config.module.rules.push({
|
|
287
|
+
test,
|
|
288
|
+
use: [options.defaultLoaders.babel, {
|
|
289
|
+
loader: loaderPath,
|
|
290
|
+
options: loaderOptions
|
|
291
|
+
}]
|
|
292
|
+
});
|
|
293
|
+
return nextConfig.webpack?.(config, options) ?? config;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
},
|
|
297
|
+
async createLoader() {
|
|
298
|
+
const { createMdxLoader } = await import("./loader-B6ordrWK.js");
|
|
299
|
+
return createMdxLoader({ getCore: () => this.core });
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
export { mdxCollection as n, MDXCollection as t };
|
|
306
|
+
//# sourceMappingURL=mdx-Cw1nBJ0D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-Cw1nBJ0D.js","names":["#onFrontmatter","#onServerHandler","#onEmitHandler","#onGitHandler","code: InitializerCode","serializableCoreOptions: CoreOptions"],"sources":["../src/collections/mdx.ts"],"sourcesContent":["import type { Collection } from \"@/collections\";\nimport type { PostprocessOptions } from \"@/collections/mdx/remark-postprocess\";\nimport type { Core, CoreOptions } from \"@/core\";\nimport type { ProcessorOptions } from \"@mdx-js/mdx\";\nimport type { VFile } from \"vfile\";\nimport type { TurbopackLoaderOptions } from \"next/dist/server/config-shared\";\nimport type { Configuration } from \"webpack\";\nimport { LoaderConfig, loaderHook } from \"@/plugins/loader\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport type { PreprocessOptions } from \"@/collections/mdx/remark-preprocess\";\nimport { CodeGenerator, slash } from \"@/utils/code-generator\";\nimport { validate } from \"@/utils/validation\";\nimport type { Awaitable } from \"@/types\";\nimport { asyncPipe, pipe } from \"@/utils/pipe\";\nimport { FileSystemCollection, FileSystemCollectionConfig } from \"./fs\";\nimport { GitHook, gitHook } from \"@/plugins/git\";\nimport path from \"node:path\";\n\ninterface CompilationContext {\n collection: Collection;\n filePath: string;\n source: string;\n}\n\nexport interface MDXCollectionConfig<\n FrontmatterSchema extends StandardSchemaV1 | undefined,\n> extends Omit<FileSystemCollectionConfig, \"supportedFormats\"> {\n postprocess?: Partial<PostprocessOptions>;\n frontmatter?: FrontmatterSchema;\n options?: (environment: \"bundler\" | \"runtime\") => Awaitable<ProcessorOptions>;\n lazy?: boolean;\n dynamic?: boolean;\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\ninterface InitializerCode {\n fn: string;\n typeParams: [config: string, name: string, attached: string];\n params: string[];\n}\n\nfunction formatInitializer(code: InitializerCode) {\n return `${code.fn}<${code.typeParams.join()}>(${code.params.join()})`;\n}\n\nexport class MDXCollection<\n FrontmatterSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined,\n> extends FileSystemCollection {\n readonly dynamic: boolean;\n readonly lazy: boolean;\n readonly preprocess?: PreprocessOptions;\n readonly postprocess?: Partial<PostprocessOptions>;\n readonly getMDXOptions?: (environment: \"bundler\" | \"runtime\") => Awaitable<ProcessorOptions>;\n /**\n * Frontmatter schema\n */\n frontmatterSchema?: FrontmatterSchema;\n /**\n * Transform & validate frontmatter\n */\n frontmatter = asyncPipe<Record<string, unknown> | undefined, CompilationContext>();\n /**\n * Transform `vfile` on compilation stage\n */\n vfile = asyncPipe<VFile, CompilationContext>();\n /**\n * Transform the generated initializer code (TypeScript) for collection store\n */\n storeInitializer = pipe<\n InitializerCode,\n {\n codegen: CodeGenerator;\n environment: \"browser\" | \"server\" | \"dynamic\";\n }\n >();\n\n $inferFrontmatter: FrontmatterSchema extends StandardSchemaV1\n ? StandardSchemaV1.InferOutput<FrontmatterSchema>\n : Record<string, unknown> = undefined as never;\n\n constructor(config: MDXCollectionConfig<FrontmatterSchema>) {\n super({\n dir: config.dir,\n files: config.files,\n supportedFormats: [\"md\", \"mdx\"],\n });\n this.postprocess = config.postprocess;\n this.getMDXOptions = config.options;\n this.dynamic = config.dynamic ?? false;\n this.lazy = config.lazy ?? false;\n this.frontmatterSchema = config.frontmatter;\n this.frontmatter.pipe(this.#onFrontmatter.bind(this));\n this.onServer.hook(this.#onServerHandler.bind(this));\n this.onEmit.pipe(this.#onEmitHandler.bind(this));\n\n if (this.postprocess?.includeProcessedMarkdown) {\n this.storeInitializer.pipe((code) => {\n code.typeParams[2] += \" & { /** Processed Markdown */ _markdown: string; }\";\n return code;\n });\n }\n\n if (this.postprocess?.includeMDAST) {\n this.storeInitializer.pipe((code) => {\n code.typeParams[2] += \" & { /** MDAST (as JSON string) */ _mdast: string; }\";\n return code;\n });\n }\n\n if (this.postprocess?.extractLinkReferences) {\n this.storeInitializer.pipe((code, { codegen, environment }) => {\n codegen.addNamedImport([\"WithExtractedReferences\"], RuntimePaths[environment], true);\n code.typeParams[2] += \" & WithExtractedReferences\";\n return code;\n });\n }\n\n this.pluginHook(loaderHook).loaders.push(mdxLoader());\n this.pluginHook(gitHook).onClient.hook(this.#onGitHandler.bind(this));\n }\n\n #onFrontmatter: (typeof this.frontmatter)[\"$inferHandler\"] = (data, { filePath }) => {\n if (!this.frontmatterSchema) return data;\n\n return validate(\n this.frontmatterSchema,\n data,\n undefined,\n `invalid frontmatter in ${filePath}`,\n ) as Promise<Record<string, unknown>>;\n };\n\n #onServerHandler: (typeof this.onServer)[\"$inferHandler\"] = ({ server, core }) => {\n if (!server.watcher) return;\n\n server.watcher.on(\"all\", async (event, file) => {\n if (event === \"change\" && !this.dynamic) return;\n if (!this.hasFile(file)) return;\n\n await core.emit({\n filterCollection: (item) => item === this,\n filterWorkspace: () => false,\n write: true,\n });\n });\n };\n\n #onEmitHandler: (typeof this.onEmit)[\"$inferHandler\"] = async (\n entries,\n { core, createCodeGenerator },\n ) => {\n entries.push(\n await createCodeGenerator(`${this.name}.ts`, async ({ codegen }) => {\n const runtimePath = RuntimePaths.server;\n const base = slash(core._toRuntimePath(this.dir));\n let code: InitializerCode;\n codegen.addNamespaceImport(\n \"Config\",\n codegen.formatImportPath(core.getOptions().configPath),\n true,\n );\n\n if (this.lazy) {\n codegen.addNamedImport([\"mdxStoreLazy\"], runtimePath);\n const headGlob = await this.generateDocCollectionFrontmatterGlob(core, codegen, true);\n const bodyGlob = await this.generateDocCollectionGlob(core, codegen);\n\n code = {\n fn: \"mdxStoreLazy\",\n typeParams: [\"typeof Config\", `\"${this.name}\"`, \"unknown\"],\n params: [`\"${this.name}\"`, `\"${base}\"`, `{ head: ${headGlob}, body: ${bodyGlob} }`],\n };\n } else {\n codegen.addNamedImport([\"mdxStore\"], runtimePath);\n code = {\n fn: \"mdxStore\",\n typeParams: [\"typeof Config\", `\"${this.name}\"`, \"unknown\"],\n params: [\n `\"${this.name}\"`,\n `\"${base}\"`,\n await this.generateDocCollectionGlob(core, codegen, true),\n ],\n };\n }\n\n code = this.storeInitializer.run(code, {\n codegen,\n environment: \"server\",\n });\n codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);\n }),\n await createCodeGenerator(`${this.name}.browser.ts`, async ({ codegen }) => {\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 code: InitializerCode = {\n fn: `mdxStoreBrowser`,\n typeParams: [\"typeof Config\", `\"${this.name}\"`, \"unknown\"],\n params: [`\"${this.name}\"`, await this.generateDocCollectionGlob(core, codegen)],\n };\n code = this.storeInitializer.run(code, {\n codegen,\n environment: \"browser\",\n });\n codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);\n }),\n );\n if (this.dynamic)\n entries.push(\n await createCodeGenerator(`${this.name}.dynamic.ts`, async ({ codegen }) => {\n const coreOptions = core.getOptions();\n const runtimePath = RuntimePaths.dynamic;\n const base = slash(core._toRuntimePath(this.dir));\n codegen.addNamespaceImport(\"Config\", codegen.formatImportPath(coreOptions.configPath));\n codegen.addNamedImport([\"mdxStoreDynamic\"], runtimePath);\n\n const serializableCoreOptions: CoreOptions = {\n configPath: core._toRuntimePath(coreOptions.configPath),\n outDir: core._toRuntimePath(coreOptions.outDir),\n cwd: core._toRuntimePath(coreOptions.cwd),\n };\n\n const jsxImportSource =\n (await this.getMDXOptions?.(\"runtime\"))?.jsxImportSource ?? \"react\";\n if (!jsxImportSource)\n throw new Error(\n `[Fuma Content] \"jsxImportSource\" is required for dynamic MDX collection \"${this.name}\".`,\n );\n codegen.addNamespaceImport(\"_jsx_runtime\", `${jsxImportSource}/jsx-runtime`);\n\n let code: InitializerCode = {\n fn: \"mdxStoreDynamic\",\n typeParams: [\"typeof Config\", `\"${this.name}\"`, \"unknown\"],\n params: [\n \"Config\",\n JSON.stringify(serializableCoreOptions),\n `\"${this.name}\"`,\n `\"${base}\"`,\n await this.generateDocCollectionFrontmatterGlob(core, codegen, true),\n \"_jsx_runtime\",\n ],\n };\n\n code = this.storeInitializer.run(code, {\n codegen,\n environment: \"dynamic\",\n });\n codegen.push(`export const ${this.name} = ${formatInitializer(code)};`);\n }),\n );\n return entries;\n };\n\n #onGitHandler: GitHook[\"onClient\"][\"$inferHandler\"] = async ({ client }) => {\n this.storeInitializer.pipe((code, { codegen, environment }) => {\n codegen.addNamedImport([\"WithGit\"], RuntimePaths[environment], true);\n code.typeParams[2] += \" & WithGit\";\n return code;\n });\n\n this.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 private async generateDocCollectionFrontmatterGlob(\n core: Core,\n codegen: CodeGenerator,\n eager = false,\n ) {\n let s = `{`;\n const files = await this.getFiles();\n const query = codegen.formatQuery({\n collection: this.name,\n only: \"frontmatter\",\n workspace: core.getWorkspace()?.name,\n });\n for (const file of files) {\n const fullPath = path.join(this.dir, file);\n const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;\n if (eager) {\n const name = codegen.generateImportName();\n codegen.addNamedImport([`frontmatter as ${name}`], specifier);\n s += `\"${slash(file)}\": ${name},`;\n } else {\n s += `\"${slash(file)}\": () => ${codegen.formatDynamicImport(specifier, \"frontmatter\")},`;\n }\n }\n s += \"}\";\n return s;\n }\n\n private async generateDocCollectionGlob(core: Core, codegen: CodeGenerator, eager = false) {\n let s = `{`;\n const files = await this.getFiles();\n const query = codegen.formatQuery({\n collection: this.name,\n workspace: core.getWorkspace()?.name,\n });\n for (const file of files) {\n const fullPath = path.join(this.dir, file);\n const specifier = `${codegen.formatImportPath(fullPath)}?${query}`;\n if (eager) {\n const name = codegen.generateImportName();\n codegen.addNamespaceImport(name, specifier);\n s += `\"${slash(file)}\": ${name},`;\n } else {\n s += `\"${slash(file)}\": () => ${codegen.formatDynamicImport(specifier)},`;\n }\n }\n s += \"}\";\n return s;\n }\n}\n\nexport function mdxCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(\n config: MDXCollectionConfig<FrontmatterSchema>,\n) {\n return new MDXCollection(config);\n}\n\nfunction mdxLoader(): LoaderConfig {\n const test = /\\.mdx?(\\?.+?)?$/;\n\n return {\n id: \"mdx\",\n test,\n configureNext(nextConfig) {\n const loaderPath = \"fuma-content/collections/mdx/loader-webpack\";\n const loaderOptions = this.getLoaderOptions();\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: [...(nextConfig.pageExtensions ?? [\"js\", \"jsx\", \"tsx\", \"ts\"]), \"mdx\", \"md\"],\n webpack(config: Configuration, options) {\n config.module ||= {};\n config.module.rules ||= [];\n config.module.rules.push({\n test,\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 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 { CompiledMDX } from \"@/collections/mdx/build-mdx\";\n"],"mappings":";;;;;;;;;AAkCA,MAAM,eAAe;CACnB,SAAS;CACT,SAAS;CACT,QAAQ;CACT;AAQD,SAAS,kBAAkB,MAAuB;AAChD,QAAO,GAAG,KAAK,GAAG,GAAG,KAAK,WAAW,MAAM,CAAC,IAAI,KAAK,OAAO,MAAM,CAAC;;AAGrE,IAAa,gBAAb,cAEU,qBAAqB;CAC7B,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;;;;CAIT;;;;CAIA,cAAc,WAAoE;;;;CAIlF,QAAQ,WAAsC;;;;CAI9C,mBAAmB,MAMhB;CAEH,oBAE8B;CAE9B,YAAY,QAAgD;AAC1D,QAAM;GACJ,KAAK,OAAO;GACZ,OAAO,OAAO;GACd,kBAAkB,CAAC,MAAM,MAAM;GAChC,CAAC;AACF,OAA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AO,gBAAgB,EACrB,eAAe,KAAK,MACrB,CAAC;;EAEL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as Awaitable, m as Collection,
|
|
2
|
-
import { t as CompilerOptions } from "./index-
|
|
3
|
-
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-
|
|
1
|
+
import { E as Awaitable, m as Collection, p as CodeGenerator, v as AsyncPipe, y as Pipe } from "./core-CT06v32N.js";
|
|
2
|
+
import { t as CompilerOptions } from "./index-BheUVWBm.js";
|
|
3
|
+
import { n as FileSystemCollectionConfig, t as FileSystemCollection } from "./fs-CmwaaFyx.js";
|
|
4
4
|
import { ProcessorOptions, createProcessor } from "@mdx-js/mdx";
|
|
5
5
|
import { VFile } from "vfile";
|
|
6
6
|
import { Processor } from "unified";
|
|
@@ -78,14 +78,6 @@ declare module "vfile" {
|
|
|
78
78
|
interface CompiledMDX<Frontmatter = Record<string, unknown>> extends Record<string, unknown> {
|
|
79
79
|
frontmatter: Frontmatter;
|
|
80
80
|
default: MDXContent;
|
|
81
|
-
/**
|
|
82
|
-
* Enable from `postprocess` option.
|
|
83
|
-
*/
|
|
84
|
-
_markdown?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Enable from `postprocess` option.
|
|
87
|
-
*/
|
|
88
|
-
_mdast?: string;
|
|
89
81
|
}
|
|
90
82
|
//#endregion
|
|
91
83
|
//#region src/collections/mdx.d.ts
|
|
@@ -107,6 +99,7 @@ interface InitializerCode {
|
|
|
107
99
|
params: string[];
|
|
108
100
|
}
|
|
109
101
|
declare class MDXCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> extends FileSystemCollection {
|
|
102
|
+
#private;
|
|
110
103
|
readonly dynamic: boolean;
|
|
111
104
|
readonly lazy: boolean;
|
|
112
105
|
readonly preprocess?: PreprocessOptions;
|
|
@@ -127,18 +120,16 @@ declare class MDXCollection<FrontmatterSchema extends StandardSchemaV1 | undefin
|
|
|
127
120
|
/**
|
|
128
121
|
* Transform the generated initializer code (TypeScript) for collection store
|
|
129
122
|
*/
|
|
130
|
-
storeInitializer: Pipe<InitializerCode,
|
|
123
|
+
storeInitializer: Pipe<InitializerCode, {
|
|
124
|
+
codegen: CodeGenerator;
|
|
131
125
|
environment: "browser" | "server" | "dynamic";
|
|
132
126
|
}>;
|
|
133
127
|
$inferFrontmatter: FrontmatterSchema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<FrontmatterSchema> : Record<string, unknown>;
|
|
134
128
|
constructor(config: MDXCollectionConfig<FrontmatterSchema>);
|
|
135
129
|
private generateDocCollectionFrontmatterGlob;
|
|
136
130
|
private generateDocCollectionGlob;
|
|
137
|
-
private generateCollectionStoreServer;
|
|
138
|
-
private generateCollectionStoreBrowser;
|
|
139
|
-
private generateCollectionStoreDynamic;
|
|
140
131
|
}
|
|
141
132
|
declare function mdxCollection<FrontmatterSchema extends StandardSchemaV1 | undefined = undefined>(config: MDXCollectionConfig<FrontmatterSchema>): MDXCollection<FrontmatterSchema>;
|
|
142
133
|
//#endregion
|
|
143
134
|
export { ExtractedReference as a, CompiledMDX as i, MDXCollectionConfig as n, mdxCollection as r, MDXCollection as t };
|
|
144
|
-
//# sourceMappingURL=mdx-
|
|
135
|
+
//# sourceMappingURL=mdx-PaqRNZMS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-PaqRNZMS.d.ts","names":[],"sources":["../src/collections/mdx/remark-postprocess.ts","../src/collections/mdx/remark-preprocess.ts","../src/collections/mdx/build-mdx.ts","../src/collections/mdx.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;UASiB,kBAAA;;;UAIA,kBAAA;;;;;;EAJA;AAIjB;;;;ACVA;AAEC;IAAA,UAAA,CAAA,EAAA,OAAA;;EAAA;;;;;ACKsC;AAiBvC;EAIgB,YAAA,CAAA,EAAA,OAAA,GAAA;IAUF,cAAA,CAAA,EAAA,OAAA;EAK8B,CAAA;;;;UD3C3B,iBA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A,CAAA,WAAA,EAAA,SAAA,GAAA,SAAA,EAAA,GCWC,SDXD,CCWW,gBDXX,CAAA;EACjE;;;EAI6C,iBAAA,CAAA,ECUxB,iBDVwB;EAAA;AAG9C;;EAIe,WAAA,ECOF,SDPE,CCOF,MDPE,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA,ECOF,kBDPE,CAAA;EACJ;;;SCUJ,UAAA,OAAA;;;AAvDiE;EAUvD,gBAAA,EAoDW,IApDQ,CAiDlB,eAjDkB,EAAA;IACR,OAAA,EAmDb,aAnDa;IACb,WAAA,EAAA,SAAA,GAAA,QAAA,GAAA,SAAA;EACS,CAAA,CAAA;EAAR,iBAAA,EAsDK,iBAtDL,SAsD+B,gBAtD/B,GAuDV,gBAAA,CAAiB,WAvDP,CAuDmB,iBAvDnB,CAAA,GAwDV,MAxDU,CAAA,MAAA,EAAA,OAAA,CAAA;EACA,WAAA,CAAA,MAAA,EAyDM,mBAzDN,CAyD0B,iBAzD1B,CAAA;EAC8C,QAAA,oCAAA;EAAV,QAAA,yBAAA;;AAHtC,iBAuTE,aAvTF,CAAA,0BAuT0C,gBAvT1C,GAAA,SAAA,GAAA,SAAA,CAAA,CAAA,MAAA,EAwTJ,mBAxTI,CAwTgB,iBAxThB,CAAA,CAAA,EAwTkC,aAxTlC,CAwTkC,iBAxTlC,CAAA"}
|
package/dist/next/index.d.ts
CHANGED
package/dist/next/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Core } from "../core
|
|
2
|
-
import { n as loaderPlugin } from "../loader-
|
|
1
|
+
import { t as Core } from "../core-Uv3jZqL-.js";
|
|
2
|
+
import { n as loaderPlugin } from "../loader-B4nQrRwA.js";
|
|
3
3
|
import { t as loadConfig } from "../load-from-file-z7EGuf2n.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
package/dist/node/index.d.ts
CHANGED
package/dist/node/loader.d.ts
CHANGED
package/dist/node/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as createDynamicCore } from "../dynamic-CtOB4Rkp.js";
|
|
2
|
-
import { t as Core } from "../core
|
|
2
|
+
import { t as Core } from "../core-Uv3jZqL-.js";
|
|
3
3
|
import { t as createCache } from "../async-cache-U87GzQTb.js";
|
|
4
|
-
import { n as loaderPlugin } from "../loader-
|
|
4
|
+
import { n as loaderPlugin } from "../loader-B4nQrRwA.js";
|
|
5
5
|
|
|
6
6
|
//#region src/node/loader.ts
|
|
7
7
|
let configLoader;
|
package/dist/plugins/git.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "../core-
|
|
2
|
-
import { a as gitHook, i as git, n as GitFileData, r as GitHook, t as GitClient } from "../git-
|
|
1
|
+
import "../core-CT06v32N.js";
|
|
2
|
+
import { a as gitHook, i as git, n as GitFileData, r as GitHook, t as GitClient } from "../git-n-9ddn78.js";
|
|
3
3
|
export { GitClient, GitFileData, GitHook, git as default, gitHook };
|
package/dist/plugins/git.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as defineCollectionHook } from "../collections-
|
|
2
|
-
import { t as FileSystemCollection } from "../fs-
|
|
1
|
+
import { n as defineCollectionHook } from "../collections-CNWuMDAZ.js";
|
|
2
|
+
import { t as FileSystemCollection } from "../fs-CXzVd2Dp.js";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../core-
|
|
2
|
-
import "../../dynamic-
|
|
3
|
-
import { a as LoaderInput, c as loaderPlugin, i as LoaderHook, n as Loader, o as LoaderOutput, r as LoaderConfig, s as loaderHook, t as CompilerOptions } from "../../index-
|
|
1
|
+
import "../../core-CT06v32N.js";
|
|
2
|
+
import "../../dynamic-Ck1wYoaL.js";
|
|
3
|
+
import { a as LoaderInput, c as loaderPlugin, i as LoaderHook, n as Loader, o as LoaderOutput, r as LoaderConfig, s as loaderHook, t as CompilerOptions } from "../../index-BheUVWBm.js";
|
|
4
4
|
export { CompilerOptions, Loader, LoaderConfig, LoaderHook, LoaderInput, LoaderOutput, loaderHook, loaderPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../core-
|
|
2
|
-
import "../../dynamic-
|
|
3
|
-
import { d as createWebpackLoader, l as WebpackLoader, u as WebpackLoaderOptions } from "../../index-
|
|
1
|
+
import "../../core-CT06v32N.js";
|
|
2
|
+
import "../../dynamic-Ck1wYoaL.js";
|
|
3
|
+
import { d as createWebpackLoader, l as WebpackLoader, u as WebpackLoaderOptions } from "../../index-BheUVWBm.js";
|
|
4
4
|
export { WebpackLoader, WebpackLoaderOptions, createWebpackLoader };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as createDynamicCore } from "../../dynamic-CtOB4Rkp.js";
|
|
2
|
-
import { t as Core } from "../../core
|
|
2
|
+
import { t as Core } from "../../core-Uv3jZqL-.js";
|
|
3
3
|
import { t as ValidationError } from "../../validation-BvVvvLII.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { parse } from "node:querystring";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { D as GetCollectionConfig } from "./core-
|
|
2
|
-
import { t as FileCollectionStore } from "./file-store-
|
|
3
|
-
import { a as ExtractedReference, i as CompiledMDX, t as MDXCollection } from "./mdx-
|
|
4
|
-
import { n as GitFileData } from "./git-
|
|
1
|
+
import { D as GetCollectionConfig } from "./core-CT06v32N.js";
|
|
2
|
+
import { t as FileCollectionStore } from "./file-store-Dm1SjuLg.js";
|
|
3
|
+
import { a as ExtractedReference, i as CompiledMDX, t as MDXCollection } from "./mdx-PaqRNZMS.js";
|
|
4
|
+
import { n as GitFileData } from "./git-n-9ddn78.js";
|
|
5
5
|
|
|
6
6
|
//#region src/collections/mdx/runtime.d.ts
|
|
7
7
|
interface MDXStoreData<Frontmatter, Attached = unknown> {
|
|
@@ -28,4 +28,4 @@ interface WithExtractedReferences {
|
|
|
28
28
|
type WithGit = GitFileData;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { mdxStore as a, WithGit as i, MDXStoreLazyData as n, mdxStoreLazy as o, WithExtractedReferences as r, MDXStoreData as t };
|
|
31
|
-
//# sourceMappingURL=runtime-
|
|
31
|
+
//# sourceMappingURL=runtime-BUUHSFlR.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-
|
|
1
|
+
{"version":3,"file":"runtime-BUUHSFlR.d.ts","names":[],"sources":["../src/collections/mdx/runtime.ts"],"sourcesContent":[],"mappings":";;;;;;AAOiB,UAAA,YAAY,CAAA,WAAA,EAAA,WAAA,OAAA,CAAA,CAAA;EAEL,EAAA,EAAA,MAAA;EAAZ,QAAA,EAAA,WAAA,CAAY,WAAZ,CAAA,GAA2B,QAA3B;;KAGP,cAH0C,CAAA,MAAA,EAAA,aAAA,MAAA,CAAA,GAI7C,mBAJ6C,CAIzB,MAJyB,EAIjB,IAJiB,CAAA,SAIH,aAJG,GAKzC,mBALyC,CAKrB,MALqB,EAKb,IALa,CAAA,CAAA,mBAAA,CAAA,GAAA,KAAA;AAG1C,iBAKW,QALG,CAAA,MAAA,EAAA,aAAA,MAAA,EAAA,QAAA,CAAA,CAAA,KAAA,EAMV,IANU,EAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAQT,MARS,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAShB,mBATgB,CASI,YATJ,CASiB,cATjB,CASgC,MAThC,EASwC,IATxC,CAAA,EAS+C,QAT/C,CAAA,CAAA;AACG,UAsBL,gBAtBK,CAAA,WAAA,EAAA,QAAA,CAAA,CAAA;EAAQ,EAAA,EAAA,MAAA;EAA5B,WAAA,EAwBa,WAxBb;EAA0C,IAAA,EAAA,GAAA,GAyB9B,OAzB8B,CAyBtB,WAzBsB,CAyBV,WAzBU,CAAA,GAyBK,QAzBL,CAAA;;AACV,iBA2BlB,YA3BkB,CAAA,MAAA,EAAA,aAAA,MAAA,EAAA,QAAA,CAAA,CAAA,KAAA,EA4BzB,IA5ByB,EAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA;EAA5B,IAAA,EA+BI,MA/BJ,CAAA,MAAA,EAAA,OAAA,CAAA;EAAmB,IAAA,EAgCf,MAhCe,CAAA,MAAA,EAAA,GAAA,GAgCM,OAhCN,CAAA,OAAA,CAAA,CAAA;AAGzB,CAAA,CAAA,EA+BG,mBA/BqB,CA+BD,gBA/BC,CA+BgB,cA/BhB,CA+B+B,MA/B/B,EA+BuC,IA/BvC,CAAA,EA+B8C,QA/B9C,CAAA,CAAA;AACf,UAgDQ,uBAAA,CAhDR;EAEC;;;EAC0B,mBAAA,EAiDb,kBAjDa,EAAA;;AAAb,KAoDX,OAAA,GAAU,WApDC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as GetCollectionConfig, E as Awaitable } from "./core-
|
|
2
|
-
import { n as MapCollectionStore } from "./store-
|
|
3
|
-
import { i as CompiledMDX, t as MDXCollection } from "./mdx-
|
|
1
|
+
import { D as GetCollectionConfig, E as Awaitable } from "./core-CT06v32N.js";
|
|
2
|
+
import { n as MapCollectionStore } from "./store-D_PPrdRE.js";
|
|
3
|
+
import { i as CompiledMDX, t as MDXCollection } from "./mdx-PaqRNZMS.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/async-cache.d.ts
|
|
6
6
|
interface AsyncCache<V> {
|
|
@@ -26,4 +26,4 @@ declare const _internal_data: Map<string, StoreData>;
|
|
|
26
26
|
declare function mdxStoreBrowser<Config, Name extends string, Attached>(name: Name, _input: Record<string, () => Promise<unknown>>): MapCollectionStore<string, MDXStoreBrowserData<GetFrontmatter<Config, Name>, Attached>>;
|
|
27
27
|
//#endregion
|
|
28
28
|
export { _internal_data as n, mdxStoreBrowser as r, MDXStoreBrowserData as t };
|
|
29
|
-
//# sourceMappingURL=runtime-browser-
|
|
29
|
+
//# sourceMappingURL=runtime-browser-B70WGxeQ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-browser-
|
|
1
|
+
{"version":3,"file":"runtime-browser-B70WGxeQ.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;;;;;AAFb,UCQA,mBDRU,CAAA,WAAA,EAAA,WAAA,OAAA,CAAA,CAAA;EACO,EAAA,EAAA,MAAA;EAAY,OAAA,EAAA,GAAA,GCS7B,SDT6B,CCSnB,WDTmB,CCSP,WDTO,CAAA,GCSQ,QDTR,CAAA;EAAR,MAAA,ECU5B,YDV4B;;UCa5B,YAAA,CDbuD;EAAR,OAAA,EAAA,MAAA;;UCiB/C,SAAA,CDhBS;EAAU,SAAA,ECiBhB,UDjBgB,CCiBL,WDjBK,CAAA;;KCoBxB,8CACH,oBAAoB,QAAQ,cAAc,gBACtC,oBAAoB,QAAQ;cAGrB,gBAAc,YAAA;AAnBV,iBAqBD,eArBoB,CAAA,MAAA,EAAA,aAAA,MAAA,EAAA,QAAA,CAAA,CAAA,IAAA,EAsB5B,IAtB4B,EAAA,MAAA,EAuB1B,MAvB0B,CAAA,MAAA,EAAA,GAAA,GAuBL,OAvBK,CAAA,OAAA,CAAA,CAAA,CAAA,EAwBjC,kBAxBiC,CAAA,MAAA,EAwBN,mBAxBM,CAwBc,cAxBd,CAwB6B,MAxB7B,EAwBqC,IAxBrC,CAAA,EAwB4C,QAxB5C,CAAA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/collections/runtime/store.ts
|
|
2
|
-
var MapCollectionStore = class {
|
|
2
|
+
var MapCollectionStore = class MapCollectionStore {
|
|
3
3
|
dataMap;
|
|
4
4
|
dataList;
|
|
5
5
|
constructor(input) {
|
|
@@ -16,22 +16,19 @@ var MapCollectionStore = class {
|
|
|
16
16
|
return this;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* transform entry and create a new store
|
|
20
20
|
*/
|
|
21
21
|
transform(fn) {
|
|
22
|
-
|
|
23
|
-
const dataMap = this.dataMap;
|
|
24
|
-
const dataList = this.dataList;
|
|
22
|
+
const updated = /* @__PURE__ */ new Map();
|
|
25
23
|
for (const [k, v] of this.dataMap) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
dataList.push(updated);
|
|
24
|
+
const out = fn(k, v);
|
|
25
|
+
updated.set(out[0], out[1]);
|
|
29
26
|
}
|
|
30
|
-
return
|
|
27
|
+
return new MapCollectionStore(updated);
|
|
31
28
|
}
|
|
32
29
|
get $inferData() {}
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
//#endregion
|
|
36
33
|
export { MapCollectionStore as t };
|
|
37
|
-
//# sourceMappingURL=store-
|
|
34
|
+
//# sourceMappingURL=store-CRyvZFKN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-
|
|
1
|
+
{"version":3,"file":"store-CRyvZFKN.js","names":[],"sources":["../src/collections/runtime/store.ts"],"sourcesContent":["import type { Awaitable } from \"@/types\";\n\nexport interface CollectionStore<Id, Data> {\n /**\n * type-only operation to cast data type, doesn't do any runtime transformation.\n */\n castData: <T>(_cast: (input: Data) => T) => CollectionStore<Id, T>;\n\n get: (id: Id) => Awaitable<Data | undefined>;\n list: () => Awaitable<Data[]>;\n\n /**\n * For typescript to infer data types, don't access the value of this property.\n */\n $inferData: Data;\n}\n\nexport class MapCollectionStore<Id, Data> implements CollectionStore<Id, Data> {\n private readonly dataMap: Map<Id, Data>;\n private readonly dataList: Data[];\n\n constructor(input: Map<Id, Data>) {\n this.dataMap = input;\n this.dataList = Array.from(input.values());\n }\n\n get(id: Id): Data | undefined {\n return this.dataMap.get(id);\n }\n\n list(): Data[] {\n return this.dataList;\n }\n\n castData<T>(_cast: (input: Data) => T): MapCollectionStore<Id, T> {\n return this as unknown as MapCollectionStore<Id, T>;\n }\n\n /**\n * transform entry and create a new store\n */\n transform<$Id, T>(fn: (id: Id, data: Data) => [$Id, T]): MapCollectionStore<$Id, T> {\n const updated = new Map<$Id, T>();\n\n for (const [k, v] of this.dataMap) {\n const out = fn(k, v);\n updated.set(out[0], out[1]);\n }\n\n return new MapCollectionStore(updated);\n }\n\n get $inferData(): Data {\n return undefined as Data;\n }\n}\n"],"mappings":";AAiBA,IAAa,qBAAb,MAAa,mBAAkE;CAC7E,AAAiB;CACjB,AAAiB;CAEjB,YAAY,OAAsB;AAChC,OAAK,UAAU;AACf,OAAK,WAAW,MAAM,KAAK,MAAM,QAAQ,CAAC;;CAG5C,IAAI,IAA0B;AAC5B,SAAO,KAAK,QAAQ,IAAI,GAAG;;CAG7B,OAAe;AACb,SAAO,KAAK;;CAGd,SAAY,OAAsD;AAChE,SAAO;;;;;CAMT,UAAkB,IAAkE;EAClF,MAAM,0BAAU,IAAI,KAAa;AAEjC,OAAK,MAAM,CAAC,GAAG,MAAM,KAAK,SAAS;GACjC,MAAM,MAAM,GAAG,GAAG,EAAE;AACpB,WAAQ,IAAI,IAAI,IAAI,IAAI,GAAG;;AAG7B,SAAO,IAAI,mBAAmB,QAAQ;;CAGxC,IAAI,aAAmB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Awaitable } from "./core-
|
|
1
|
+
import { E as Awaitable } from "./core-CT06v32N.js";
|
|
2
2
|
|
|
3
3
|
//#region src/collections/runtime/store.d.ts
|
|
4
4
|
interface CollectionStore<Id, Data> {
|
|
@@ -21,11 +21,11 @@ declare class MapCollectionStore<Id, Data> implements CollectionStore<Id, Data>
|
|
|
21
21
|
list(): Data[];
|
|
22
22
|
castData<T>(_cast: (input: Data) => T): MapCollectionStore<Id, T>;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* transform entry and create a new store
|
|
25
25
|
*/
|
|
26
|
-
transform
|
|
26
|
+
transform<$Id, T>(fn: (id: Id, data: Data) => [$Id, T]): MapCollectionStore<$Id, T>;
|
|
27
27
|
get $inferData(): Data;
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
export { MapCollectionStore as n, CollectionStore as t };
|
|
31
|
-
//# sourceMappingURL=store-
|
|
31
|
+
//# sourceMappingURL=store-D_PPrdRE.d.ts.map
|