fumadocs-mdx 12.0.0 → 12.0.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/bin.cjs +103 -85
- package/dist/bin.js +1 -1
- package/dist/{browser-D5lvL8vv.d.ts → browser-BupUnhpC.d.ts} +1 -1
- package/dist/{browser-DjWADqp8.d.cts → browser-R0x9IPaQ.d.cts} +1 -1
- package/dist/bun/index.cjs +156 -130
- package/dist/bun/index.js +10 -10
- package/dist/chunk-ADR6R7HM.js +29 -0
- package/dist/{chunk-3M4SHY6K.js → chunk-FSZMKRVH.js} +1 -1
- package/dist/{chunk-POXTQZ4D.js → chunk-LGYVNESJ.js} +2 -6
- package/dist/chunk-LMG6UWCL.js +167 -0
- package/dist/{chunk-SWNOXPYJ.js → chunk-QAUWMR5D.js} +6 -6
- package/dist/{chunk-KGUBBRL6.js → chunk-RMDXSZYE.js} +11 -39
- package/dist/{chunk-YC25YEBF.js → chunk-U4MQ44TS.js} +1 -1
- package/dist/chunk-XMFLD5J6.js +30 -0
- package/dist/{chunk-TLD6JMT6.js → chunk-ZX7TM4AR.js} +4 -2
- package/dist/config/index.cjs +84 -56
- package/dist/config/index.d.cts +2 -6
- package/dist/config/index.d.ts +2 -6
- package/dist/config/index.js +2 -2
- package/dist/{define--6HQ1ehX.d.cts → define-DJbJduHy.d.cts} +15 -15
- package/dist/{define--6HQ1ehX.d.ts → define-DJbJduHy.d.ts} +15 -15
- package/dist/index.cjs +127 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +11 -0
- package/dist/load-UUXLUBHL.js +9 -0
- package/dist/loader-mdx.cjs +217 -174
- package/dist/loader-mdx.js +7 -7
- package/dist/next/index.cjs +129 -109
- package/dist/next/index.js +40 -54
- package/dist/node/loader.cjs +152 -109
- package/dist/node/loader.js +6 -7
- package/dist/postinstall-SCSXM4IM.js +10 -0
- package/dist/{preset-WFEORCAB.js → preset-ZMP6U62C.js} +1 -1
- package/dist/runtime/next/async.cjs +117 -65
- package/dist/runtime/next/async.d.cts +3 -3
- package/dist/runtime/next/async.d.ts +3 -3
- package/dist/runtime/next/async.js +15 -8
- package/dist/runtime/next/index.d.cts +8 -8
- package/dist/runtime/next/index.d.ts +8 -8
- package/dist/runtime/vite/browser.d.cts +2 -2
- package/dist/runtime/vite/browser.d.ts +2 -2
- package/dist/runtime/vite/server.d.cts +5 -5
- package/dist/runtime/vite/server.d.ts +5 -5
- package/dist/{shared-CqgMnt9h.d.cts → shared-Cnm1afPW.d.cts} +3 -2
- package/dist/{shared-0QIuV0XZ.d.ts → shared-DpXxElc1.d.ts} +3 -2
- package/dist/{types-DLIAvrgC.d.ts → types-CbLt05Gc.d.cts} +7 -8
- package/dist/{types-Dl8HLbm5.d.cts → types-Ci6BA1tA.d.ts} +7 -8
- package/dist/vite/index.cjs +177 -145
- package/dist/vite/index.d.cts +1 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +15 -20
- package/dist/{watcher-4NDMOH4R.js → watcher-HGOH3APP.js} +1 -1
- package/package.json +23 -15
- package/dist/chunk-KTDVTBMH.js +0 -139
- package/dist/postinstall-U7VROOY7.js +0 -9
package/dist/node/loader.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/mdx/preset.ts
|
|
33
|
+
// src/loaders/mdx/preset.ts
|
|
34
34
|
var preset_exports = {};
|
|
35
35
|
__export(preset_exports, {
|
|
36
36
|
getDefaultMDXOptions: () => getDefaultMDXOptions
|
|
@@ -111,24 +111,12 @@ function getDefaultMDXOptions({
|
|
|
111
111
|
}
|
|
112
112
|
var plugins;
|
|
113
113
|
var init_preset = __esm({
|
|
114
|
-
"src/mdx/preset.ts"() {
|
|
114
|
+
"src/loaders/mdx/preset.ts"() {
|
|
115
115
|
"use strict";
|
|
116
116
|
plugins = __toESM(require("fumadocs-core/mdx-plugins"), 1);
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
// src/node/loader.ts
|
|
121
|
-
var loader_exports = {};
|
|
122
|
-
__export(loader_exports, {
|
|
123
|
-
load: () => load2
|
|
124
|
-
});
|
|
125
|
-
module.exports = __toCommonJS(loader_exports);
|
|
126
|
-
|
|
127
|
-
// src/utils/config.ts
|
|
128
|
-
var fs = __toESM(require("fs/promises"), 1);
|
|
129
|
-
var path = __toESM(require("path"), 1);
|
|
130
|
-
var import_node_url = require("url");
|
|
131
|
-
|
|
132
120
|
// src/config/build.ts
|
|
133
121
|
function buildConfig(config) {
|
|
134
122
|
const collections = /* @__PURE__ */ new Map();
|
|
@@ -178,12 +166,18 @@ function buildConfig(config) {
|
|
|
178
166
|
}
|
|
179
167
|
};
|
|
180
168
|
}
|
|
169
|
+
var init_build = __esm({
|
|
170
|
+
"src/config/build.ts"() {
|
|
171
|
+
"use strict";
|
|
172
|
+
}
|
|
173
|
+
});
|
|
181
174
|
|
|
182
|
-
// src/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
// src/loaders/config/load.ts
|
|
176
|
+
var load_exports = {};
|
|
177
|
+
__export(load_exports, {
|
|
178
|
+
getConfigHash: () => getConfigHash,
|
|
179
|
+
loadConfig: () => loadConfig
|
|
180
|
+
});
|
|
187
181
|
async function compileConfig(configPath, outDir) {
|
|
188
182
|
const { build } = await import("esbuild");
|
|
189
183
|
const transformed = await build({
|
|
@@ -226,6 +220,42 @@ async function getConfigHash(configPath) {
|
|
|
226
220
|
}
|
|
227
221
|
throw new Error("Cannot find config file");
|
|
228
222
|
}
|
|
223
|
+
var fs, path, import_node_url, cache;
|
|
224
|
+
var init_load = __esm({
|
|
225
|
+
"src/loaders/config/load.ts"() {
|
|
226
|
+
"use strict";
|
|
227
|
+
fs = __toESM(require("fs/promises"), 1);
|
|
228
|
+
path = __toESM(require("path"), 1);
|
|
229
|
+
import_node_url = require("url");
|
|
230
|
+
init_build();
|
|
231
|
+
cache = null;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// src/node/loader.ts
|
|
236
|
+
var loader_exports = {};
|
|
237
|
+
__export(loader_exports, {
|
|
238
|
+
load: () => load2
|
|
239
|
+
});
|
|
240
|
+
module.exports = __toCommonJS(loader_exports);
|
|
241
|
+
|
|
242
|
+
// src/loaders/config/index.ts
|
|
243
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
244
|
+
function findConfigFile() {
|
|
245
|
+
return import_node_path.default.resolve("source.config.ts");
|
|
246
|
+
}
|
|
247
|
+
function dynamicConfig(configPath, outDir) {
|
|
248
|
+
return {
|
|
249
|
+
async getConfig(hash) {
|
|
250
|
+
const { loadConfig: loadConfig2, getConfigHash: getConfigHash2 } = await Promise.resolve().then(() => (init_load(), load_exports));
|
|
251
|
+
return loadConfig2(
|
|
252
|
+
configPath,
|
|
253
|
+
outDir,
|
|
254
|
+
hash ?? await getConfigHash2(configPath)
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
}
|
|
229
259
|
|
|
230
260
|
// src/utils/fuma-matter.ts
|
|
231
261
|
var import_js_yaml = require("js-yaml");
|
|
@@ -282,7 +312,7 @@ async function validate(schema, data, context, errorMessage) {
|
|
|
282
312
|
}
|
|
283
313
|
|
|
284
314
|
// src/utils/git-timestamp.ts
|
|
285
|
-
var
|
|
315
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
286
316
|
var import_tinyexec = require("tinyexec");
|
|
287
317
|
var cache2 = /* @__PURE__ */ new Map();
|
|
288
318
|
async function getGitTimestamp(file) {
|
|
@@ -291,7 +321,7 @@ async function getGitTimestamp(file) {
|
|
|
291
321
|
try {
|
|
292
322
|
const out = await (0, import_tinyexec.x)(
|
|
293
323
|
"git",
|
|
294
|
-
["log", "-1", '--pretty="%ai"',
|
|
324
|
+
["log", "-1", '--pretty="%ai"', import_node_path2.default.relative(process.cwd(), file)],
|
|
295
325
|
{
|
|
296
326
|
throwOnError: true
|
|
297
327
|
}
|
|
@@ -304,27 +334,39 @@ async function getGitTimestamp(file) {
|
|
|
304
334
|
}
|
|
305
335
|
}
|
|
306
336
|
|
|
307
|
-
// src/
|
|
308
|
-
function countLines(s) {
|
|
309
|
-
let num = 0;
|
|
310
|
-
for (const c of s) {
|
|
311
|
-
if (c === "\n") num++;
|
|
312
|
-
}
|
|
313
|
-
return num;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// src/mdx/build-mdx.ts
|
|
337
|
+
// src/loaders/mdx/build-mdx.ts
|
|
317
338
|
var import_mdx = require("@mdx-js/mdx");
|
|
318
339
|
|
|
319
|
-
// src/mdx/remark-include.ts
|
|
340
|
+
// src/loaders/mdx/remark-include.ts
|
|
320
341
|
var import_unified = require("unified");
|
|
321
342
|
var import_unist_util_visit = require("unist-util-visit");
|
|
322
|
-
var
|
|
343
|
+
var path4 = __toESM(require("path"), 1);
|
|
323
344
|
var fs2 = __toESM(require("fs/promises"), 1);
|
|
324
345
|
var import_remark_parse = __toESM(require("remark-parse"), 1);
|
|
325
346
|
var import_remark_mdx = __toESM(require("remark-mdx"), 1);
|
|
326
347
|
var import_mdx_plugins = require("fumadocs-core/mdx-plugins");
|
|
327
|
-
var
|
|
348
|
+
var ElementLikeTypes = [
|
|
349
|
+
"mdxJsxFlowElement",
|
|
350
|
+
"mdxJsxTextElement",
|
|
351
|
+
"containerDirective",
|
|
352
|
+
"textDirective",
|
|
353
|
+
"leafDirective"
|
|
354
|
+
];
|
|
355
|
+
function isElementLike(node) {
|
|
356
|
+
return ElementLikeTypes.includes(node.type);
|
|
357
|
+
}
|
|
358
|
+
function parseElementAttributes(element) {
|
|
359
|
+
if (Array.isArray(element.attributes)) {
|
|
360
|
+
const attributes = {};
|
|
361
|
+
for (const attr of element.attributes) {
|
|
362
|
+
if (attr.type === "mdxJsxAttribute" && (typeof attr.value === "string" || attr.value === null)) {
|
|
363
|
+
attributes[attr.name] = attr.value;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return attributes;
|
|
367
|
+
}
|
|
368
|
+
return element.attributes ?? {};
|
|
369
|
+
}
|
|
328
370
|
function flattenNode(node) {
|
|
329
371
|
if ("children" in node)
|
|
330
372
|
return node.children.map((child) => flattenNode(child)).join("");
|
|
@@ -341,21 +383,31 @@ function parseSpecifier(specifier) {
|
|
|
341
383
|
}
|
|
342
384
|
function extractSection(root, section) {
|
|
343
385
|
let nodes;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
386
|
+
let capturingHeadingContent = false;
|
|
387
|
+
(0, import_unist_util_visit.visit)(root, (node) => {
|
|
388
|
+
if (node.type === "heading") {
|
|
389
|
+
if (capturingHeadingContent) {
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
if (node.data?.hProperties?.id === section) {
|
|
393
|
+
capturingHeadingContent = true;
|
|
394
|
+
nodes = [node];
|
|
395
|
+
return "skip";
|
|
396
|
+
}
|
|
397
|
+
return;
|
|
350
398
|
}
|
|
351
|
-
if (
|
|
352
|
-
nodes
|
|
353
|
-
|
|
399
|
+
if (capturingHeadingContent) {
|
|
400
|
+
nodes?.push(node);
|
|
401
|
+
return "skip";
|
|
354
402
|
}
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
403
|
+
if (isElementLike(node) && node.name === "section") {
|
|
404
|
+
const attributes = parseElementAttributes(node);
|
|
405
|
+
if (attributes.id === section) {
|
|
406
|
+
nodes = node.children;
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
});
|
|
359
411
|
if (nodes)
|
|
360
412
|
return {
|
|
361
413
|
type: "root",
|
|
@@ -375,7 +427,7 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
375
427
|
{ cause: e }
|
|
376
428
|
);
|
|
377
429
|
}
|
|
378
|
-
const ext =
|
|
430
|
+
const ext = path4.extname(file);
|
|
379
431
|
data._compiler?.addDependency(file);
|
|
380
432
|
if (params.lang || ext !== ".md" && ext !== ".mdx") {
|
|
381
433
|
const lang = params.lang ?? ext.slice(1);
|
|
@@ -387,59 +439,56 @@ ${e instanceof Error ? e.message : String(e)}`,
|
|
|
387
439
|
data: {}
|
|
388
440
|
};
|
|
389
441
|
}
|
|
390
|
-
const
|
|
442
|
+
const parser = (data._getProcessor ?? getDefaultProcessor)(
|
|
391
443
|
ext === ".mdx" ? "mdx" : "md"
|
|
392
444
|
);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
445
|
+
const parsed = fumaMatter(content);
|
|
446
|
+
let mdast = parser.parse({
|
|
447
|
+
path: file,
|
|
448
|
+
value: parsed.content,
|
|
449
|
+
data: { frontmatter: parsed.data }
|
|
450
|
+
});
|
|
396
451
|
if (heading) {
|
|
397
|
-
const extracted = extractSection(
|
|
452
|
+
const extracted = extractSection(
|
|
453
|
+
await (0, import_unified.unified)().use(import_mdx_plugins.remarkHeading).run(mdast),
|
|
454
|
+
heading
|
|
455
|
+
);
|
|
398
456
|
if (!extracted)
|
|
399
457
|
throw new Error(
|
|
400
|
-
`Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag.`
|
|
458
|
+
`Cannot find section ${heading} in ${file}, make sure you have encapsulated the section in a <section id="${heading}"> tag, or a :::section directive with remark-directive configured.`
|
|
401
459
|
);
|
|
402
|
-
|
|
460
|
+
mdast = extracted;
|
|
403
461
|
}
|
|
404
|
-
await update(
|
|
405
|
-
return
|
|
462
|
+
await update(mdast, path4.dirname(file), data);
|
|
463
|
+
return mdast;
|
|
406
464
|
}
|
|
407
465
|
async function update(tree, directory, data) {
|
|
408
466
|
const queue = [];
|
|
409
|
-
(0, import_unist_util_visit.visit)(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
Object.assign(
|
|
431
|
-
parent && parent.type === "paragraph" ? parent : node,
|
|
432
|
-
replace
|
|
433
|
-
);
|
|
434
|
-
})
|
|
435
|
-
);
|
|
436
|
-
return "skip";
|
|
437
|
-
}
|
|
438
|
-
);
|
|
467
|
+
(0, import_unist_util_visit.visit)(tree, ElementLikeTypes, (_node, _, parent) => {
|
|
468
|
+
const node = _node;
|
|
469
|
+
if (node.name !== TagName) return;
|
|
470
|
+
const specifier = flattenNode(node);
|
|
471
|
+
if (specifier.length === 0) return "skip";
|
|
472
|
+
const attributes = parseElementAttributes(node);
|
|
473
|
+
const { file: relativePath, section } = parseSpecifier(specifier);
|
|
474
|
+
const file = path4.resolve(
|
|
475
|
+
"cwd" in attributes ? process.cwd() : directory,
|
|
476
|
+
relativePath
|
|
477
|
+
);
|
|
478
|
+
queue.push(
|
|
479
|
+
embedContent(file, section, attributes, data).then((replace) => {
|
|
480
|
+
Object.assign(
|
|
481
|
+
parent && parent.type === "paragraph" ? parent : node,
|
|
482
|
+
replace
|
|
483
|
+
);
|
|
484
|
+
})
|
|
485
|
+
);
|
|
486
|
+
return "skip";
|
|
487
|
+
});
|
|
439
488
|
await Promise.all(queue);
|
|
440
489
|
}
|
|
441
490
|
return async (tree, file) => {
|
|
442
|
-
await update(tree,
|
|
491
|
+
await update(tree, path4.dirname(file.path), file.data);
|
|
443
492
|
};
|
|
444
493
|
}
|
|
445
494
|
function getDefaultProcessor(format) {
|
|
@@ -448,7 +497,7 @@ function getDefaultProcessor(format) {
|
|
|
448
497
|
return mdProcessor.use(import_remark_mdx.default);
|
|
449
498
|
}
|
|
450
499
|
|
|
451
|
-
// src/mdx/remark-postprocess.ts
|
|
500
|
+
// src/loaders/mdx/remark-postprocess.ts
|
|
452
501
|
var import_unist_util_visit2 = require("unist-util-visit");
|
|
453
502
|
var import_mdast_util_to_markdown = require("mdast-util-to-markdown");
|
|
454
503
|
var import_estree_util_value_to_estree = require("estree-util-value-to-estree");
|
|
@@ -477,7 +526,7 @@ function remarkPostprocess({
|
|
|
477
526
|
if (includeProcessedMarkdown) {
|
|
478
527
|
file.data._markdown = (0, import_mdast_util_to_markdown.toMarkdown)(tree, {
|
|
479
528
|
...this.data("settings"),
|
|
480
|
-
//
|
|
529
|
+
// from https://github.com/remarkjs/remark/blob/main/packages/remark-stringify/lib/index.js
|
|
481
530
|
extensions: this.data("toMarkdownExtensions") || []
|
|
482
531
|
});
|
|
483
532
|
}
|
|
@@ -531,7 +580,7 @@ function flattenNode2(node) {
|
|
|
531
580
|
return "";
|
|
532
581
|
}
|
|
533
582
|
|
|
534
|
-
// src/mdx/build-mdx.ts
|
|
583
|
+
// src/loaders/mdx/build-mdx.ts
|
|
535
584
|
var cache3 = /* @__PURE__ */ new Map();
|
|
536
585
|
async function buildMDX(cacheKey, source, options) {
|
|
537
586
|
const { filePath, frontmatter, data, _compiler, ...rest } = options;
|
|
@@ -567,7 +616,7 @@ async function buildMDX(cacheKey, source, options) {
|
|
|
567
616
|
return processor;
|
|
568
617
|
}
|
|
569
618
|
return getProcessor(
|
|
570
|
-
options.format ?? filePath.endsWith(".mdx") ? "mdx" : "md"
|
|
619
|
+
options.format ?? (filePath.endsWith(".mdx") ? "mdx" : "md")
|
|
571
620
|
).process({
|
|
572
621
|
value: source,
|
|
573
622
|
path: filePath,
|
|
@@ -580,10 +629,10 @@ async function buildMDX(cacheKey, source, options) {
|
|
|
580
629
|
});
|
|
581
630
|
}
|
|
582
631
|
|
|
583
|
-
// src/loaders/mdx.ts
|
|
632
|
+
// src/loaders/mdx/index.ts
|
|
584
633
|
var import_zod = require("zod");
|
|
585
634
|
var import_promises = __toESM(require("fs/promises"), 1);
|
|
586
|
-
var
|
|
635
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
587
636
|
var import_node_crypto = require("crypto");
|
|
588
637
|
var querySchema = import_zod.z.object({
|
|
589
638
|
only: import_zod.z.literal(["frontmatter", "all"]).default("all"),
|
|
@@ -611,7 +660,7 @@ function createMdxLoader(configLoader) {
|
|
|
611
660
|
const cacheDir = isDevelopment ? void 0 : loaded.global.experimentalBuildCache;
|
|
612
661
|
const cacheKey = `${parsed.hash}_${parsed.collection ?? "global"}_${generateCacheHash(filePath)}`;
|
|
613
662
|
if (cacheDir) {
|
|
614
|
-
const cached = await import_promises.default.readFile(
|
|
663
|
+
const cached = await import_promises.default.readFile(import_node_path3.default.join(cacheDir, cacheKey)).then((content) => cacheEntry.parse(JSON.parse(content.toString()))).catch(() => null);
|
|
615
664
|
if (cached && cached.hash === generateCacheHash(value)) return cached;
|
|
616
665
|
}
|
|
617
666
|
const collection = parsed.collection ? loaded.collections.get(parsed.collection) : void 0;
|
|
@@ -666,7 +715,7 @@ function createMdxLoader(configLoader) {
|
|
|
666
715
|
if (cacheDir) {
|
|
667
716
|
await import_promises.default.mkdir(cacheDir, { recursive: true });
|
|
668
717
|
await import_promises.default.writeFile(
|
|
669
|
-
|
|
718
|
+
import_node_path3.default.join(cacheDir, cacheKey),
|
|
670
719
|
JSON.stringify({
|
|
671
720
|
...out,
|
|
672
721
|
hash: generateCacheHash(value)
|
|
@@ -679,25 +728,19 @@ function createMdxLoader(configLoader) {
|
|
|
679
728
|
function generateCacheHash(input) {
|
|
680
729
|
return (0, import_node_crypto.createHash)("md5").update(input).digest("hex");
|
|
681
730
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
configPath,
|
|
689
|
-
outDir,
|
|
690
|
-
hash ?? await getConfigHash(configPath)
|
|
691
|
-
);
|
|
692
|
-
}
|
|
693
|
-
};
|
|
731
|
+
function countLines(s) {
|
|
732
|
+
let num = 0;
|
|
733
|
+
for (const c of s) {
|
|
734
|
+
if (c === "\n") num++;
|
|
735
|
+
}
|
|
736
|
+
return num;
|
|
694
737
|
}
|
|
695
738
|
|
|
696
739
|
// src/loaders/adapter.ts
|
|
697
740
|
var import_node_url2 = require("url");
|
|
698
741
|
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
699
742
|
var import_node_querystring = require("querystring");
|
|
700
|
-
var
|
|
743
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
701
744
|
function toNode(loader, filterByPath) {
|
|
702
745
|
return async (url, _context, nextLoad) => {
|
|
703
746
|
if (!url.startsWith("file:///")) return nextLoad(url);
|
package/dist/node/loader.js
CHANGED
|
@@ -2,16 +2,15 @@ import {
|
|
|
2
2
|
toNode
|
|
3
3
|
} from "../chunk-VXEBLM4X.js";
|
|
4
4
|
import {
|
|
5
|
-
createMdxLoader
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
createMdxLoader
|
|
6
|
+
} from "../chunk-RMDXSZYE.js";
|
|
7
|
+
import "../chunk-QAUWMR5D.js";
|
|
8
|
+
import "../chunk-LMG6UWCL.js";
|
|
8
9
|
import "../chunk-IQAEAI4P.js";
|
|
9
10
|
import {
|
|
11
|
+
dynamicConfig,
|
|
10
12
|
findConfigFile
|
|
11
|
-
} from "../chunk-
|
|
12
|
-
import "../chunk-SWNOXPYJ.js";
|
|
13
|
-
import "../chunk-KTDVTBMH.js";
|
|
14
|
-
import "../chunk-YC25YEBF.js";
|
|
13
|
+
} from "../chunk-XMFLD5J6.js";
|
|
15
14
|
import "../chunk-VWJKRQZR.js";
|
|
16
15
|
|
|
17
16
|
// src/node/loader.ts
|