@vendure-io/docs-provider 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/testing.js CHANGED
@@ -1,12 +1,13 @@
1
- import { compile as v } from "@mdx-js/mdx";
2
- import w from "rehype-slug";
3
- import k from "remark-directive";
4
- import y from "remark-gfm";
5
- import { visit as g } from "unist-util-visit";
6
- import { readFile as F } from "fs/promises";
7
- import { h as P } from "./manifest-DlSWyjsA.js";
8
- import { readFileSync as I } from "node:fs";
9
- import { relative as x } from "node:path";
1
+ import { compile as F } from "@mdx-js/mdx";
2
+ import L from "rehype-slug";
3
+ import E from "remark-directive";
4
+ import j from "remark-gfm";
5
+ import { visit as v } from "unist-util-visit";
6
+ import { readFile as P } from "fs/promises";
7
+ import { h as k } from "./manifest-DlSWyjsA.js";
8
+ import { readFileSync as x } from "node:fs";
9
+ import { relative as y } from "node:path";
10
+ import { p as A, F as I } from "./frontmatter-B5d9WZzh.js";
10
11
  const T = {
11
12
  info: "info",
12
13
  note: "note",
@@ -14,89 +15,89 @@ const T = {
14
15
  warning: "warning",
15
16
  caution: "caution",
16
17
  danger: "danger"
17
- }, E = {
18
+ }, S = {
18
19
  info: "Info",
19
20
  note: "Note",
20
21
  tip: "Tip",
21
22
  warning: "Warning",
22
23
  caution: "Caution",
23
24
  danger: "Danger"
24
- }, A = () => (r) => {
25
- g(r, "containerDirective", (e) => {
26
- var o;
25
+ }, C = () => (s) => {
26
+ v(s, "containerDirective", (e) => {
27
+ var u;
27
28
  const t = e.name.toLowerCase();
28
29
  if (!(t in T))
29
30
  return;
30
- const i = T[t];
31
- let s;
31
+ const n = T[t];
32
+ let r;
32
33
  if (e.children.length > 0) {
33
34
  const l = e.children[0];
34
- if (l.type === "paragraph" && "data" in l && ((o = l.data) == null ? void 0 : o.directiveLabel) === !0) {
35
- const u = [];
36
- for (const c of l.children)
37
- c.type === "text" && u.push(c.value);
38
- u.length > 0 && (s = u.join("")), e.children = e.children.slice(1);
35
+ if (l.type === "paragraph" && "data" in l && ((u = l.data) == null ? void 0 : u.directiveLabel) === !0) {
36
+ const c = [];
37
+ for (const m of l.children)
38
+ m.type === "text" && c.push(m.value);
39
+ c.length > 0 && (r = c.join("")), e.children = e.children.slice(1);
39
40
  }
40
41
  }
41
- const n = s || E[t], a = e.data || (e.data = {});
42
- a.hName = "Callout", a.hProperties = {
43
- type: i,
44
- title: n
42
+ const a = r || S[t], i = e.data || (e.data = {});
43
+ i.hName = "Callout", i.hProperties = {
44
+ type: n,
45
+ title: a
45
46
  };
46
47
  });
47
48
  };
48
49
  function D() {
49
- return (r) => {
50
- g(r, "code", (e) => {
50
+ return (s) => {
51
+ v(s, "code", (e) => {
51
52
  if (!e.meta) return;
52
53
  const t = e.meta.match(/(?:title|filename)=["']([^"']+)["']/);
53
54
  if (!t) return;
54
- const i = t[1];
55
- e.value.trim().startsWith("// filename:") || (e.value = `// filename: ${i}
55
+ const n = t[1];
56
+ e.value.trim().startsWith("// filename:") || (e.value = `// filename: ${n}
56
57
  ${e.value}`);
57
58
  });
58
59
  };
59
60
  }
60
- const S = () => (r) => {
61
+ const R = () => (s) => {
61
62
  const e = [];
62
- g(r, "html", (t, i, s) => {
63
- i !== void 0 && s && typeof t.value == "string" && t.value.trim().startsWith("<!--") && t.value.trim().endsWith("-->") && e.push(i);
63
+ v(s, "html", (t, n, r) => {
64
+ n !== void 0 && r && typeof t.value == "string" && t.value.trim().startsWith("<!--") && t.value.trim().endsWith("-->") && e.push(n);
64
65
  });
65
66
  for (const t of e.reverse())
66
- r.children.splice(t, 1);
67
- }, R = ["@theme/Tabs", "@theme/TabItem"], b = () => (r) => {
67
+ s.children.splice(t, 1);
68
+ }, q = ["@theme/Tabs", "@theme/TabItem"], M = () => (s) => {
68
69
  const e = [];
69
- g(r, "mdxjsEsm", (t) => {
70
- const i = t.value;
71
- R.some(
72
- (n) => i.includes(`from '${n}'`) || i.includes(`from "${n}"`)
70
+ v(s, "mdxjsEsm", (t) => {
71
+ const n = t.value;
72
+ q.some(
73
+ (a) => n.includes(`from '${a}'`) || n.includes(`from "${a}"`)
73
74
  ) && e.push(t);
74
75
  });
75
76
  for (const t of e) {
76
- const i = r.children.indexOf(t);
77
- i !== -1 && r.children.splice(i, 1);
77
+ const n = s.children.indexOf(t);
78
+ n !== -1 && s.children.splice(n, 1);
78
79
  }
79
80
  };
80
- function M() {
81
+ function N() {
81
82
  return [
82
- y,
83
- k,
84
- A,
83
+ j,
84
+ E,
85
+ C,
85
86
  D,
86
- b,
87
- S
87
+ M,
88
+ R
88
89
  ];
89
90
  }
90
- function N() {
91
- return [w];
91
+ function O() {
92
+ return [L];
92
93
  }
93
- async function L(r, e, t) {
94
- var a, o, l, u;
95
- const i = performance.now(), s = (t == null ? void 0 : t.remarkPlugins) ?? M(), n = (t == null ? void 0 : t.rehypePlugins) ?? N();
94
+ async function _(s, e, t) {
95
+ var i, u, l, c;
96
+ const n = performance.now(), r = (t == null ? void 0 : t.remarkPlugins) ?? N(), a = (t == null ? void 0 : t.rehypePlugins) ?? O();
96
97
  try {
97
- return await v(r, {
98
- remarkPlugins: s,
99
- rehypePlugins: n,
98
+ return await F(s, {
99
+ remarkPlugins: r,
100
+ rehypePlugins: a,
100
101
  // Don't output to JS, just compile to check for errors
101
102
  outputFormat: "function-body",
102
103
  // Suppress development warnings about missing 'development' option
@@ -104,156 +105,787 @@ async function L(r, e, t) {
104
105
  }), {
105
106
  filePath: e,
106
107
  success: !0,
107
- compilationTime: performance.now() - i
108
+ compilationTime: performance.now() - n
108
109
  };
109
- } catch (c) {
110
- const f = performance.now() - i;
111
- let m = "Unknown compilation error", h, p;
112
- if (c instanceof Error) {
113
- m = c.message;
114
- const d = c;
115
- if (d.line !== void 0 ? h = d.line : ((o = (a = d.position) == null ? void 0 : a.start) == null ? void 0 : o.line) !== void 0 && (h = d.position.start.line), d.column !== void 0 ? p = d.column : ((u = (l = d.position) == null ? void 0 : l.start) == null ? void 0 : u.column) !== void 0 && (p = d.position.start.column), h === void 0) {
116
- const $ = m.match(/\((\d+):(\d+)\)/);
117
- $ && (h = parseInt($[1], 10), p = parseInt($[2], 10));
110
+ } catch (m) {
111
+ const o = performance.now() - n;
112
+ let h = "Unknown compilation error", f, g;
113
+ if (m instanceof Error) {
114
+ h = m.message;
115
+ const d = m;
116
+ if (d.line !== void 0 ? f = d.line : ((u = (i = d.position) == null ? void 0 : i.start) == null ? void 0 : u.line) !== void 0 && (f = d.position.start.line), d.column !== void 0 ? g = d.column : ((c = (l = d.position) == null ? void 0 : l.start) == null ? void 0 : c.column) !== void 0 && (g = d.position.start.column), f === void 0) {
117
+ const p = h.match(/\((\d+):(\d+)\)/);
118
+ p && (f = parseInt(p[1], 10), g = parseInt(p[2], 10));
118
119
  }
119
120
  }
120
121
  return {
121
122
  filePath: e,
122
123
  success: !1,
123
- error: m,
124
- line: h,
125
- column: p,
126
- compilationTime: f
124
+ error: h,
125
+ line: f,
126
+ column: g,
127
+ compilationTime: o
127
128
  };
128
129
  }
129
130
  }
130
- async function H(r, e) {
131
- const t = performance.now(), i = P(r), s = [];
132
- let n = 0, a = 0;
133
- for (let o = 0; o < i.length; o++) {
134
- const l = i[o];
131
+ async function U(s, e) {
132
+ const t = performance.now(), n = k(s), r = [];
133
+ let a = 0, i = 0;
134
+ for (let u = 0; u < n.length; u++) {
135
+ const l = n[u];
135
136
  if (!l.file)
136
137
  continue;
137
- const u = l.file;
138
+ const c = l.file;
138
139
  try {
139
- const c = await F(u, "utf-8"), f = await L(c, l.file, {
140
+ const m = await P(c, "utf-8"), o = await _(m, l.file, {
140
141
  remarkPlugins: e == null ? void 0 : e.remarkPlugins,
141
142
  rehypePlugins: e == null ? void 0 : e.rehypePlugins
142
143
  });
143
- if (s.push(f), f.success ? n++ : a++, e != null && e.onProgress && e.onProgress(o + 1, i.length, f), e != null && e.failFast && !f.success)
144
+ if (r.push(o), o.success ? a++ : i++, e != null && e.onProgress && e.onProgress(u + 1, n.length, o), e != null && e.failFast && !o.success)
144
145
  break;
145
- } catch (c) {
146
- const f = c instanceof Error ? c.message : "Unknown error reading file", m = {
146
+ } catch (m) {
147
+ const o = m instanceof Error ? m.message : "Unknown error reading file", h = {
147
148
  filePath: l.file,
148
149
  success: !1,
149
- error: `Failed to read file: ${f}`,
150
+ error: `Failed to read file: ${o}`,
150
151
  compilationTime: 0
151
152
  };
152
- if (s.push(m), a++, e != null && e.onProgress && e.onProgress(o + 1, i.length, m), e != null && e.failFast)
153
+ if (r.push(h), i++, e != null && e.onProgress && e.onProgress(u + 1, n.length, h), e != null && e.failFast)
153
154
  break;
154
155
  }
155
156
  }
156
157
  return {
157
- packageId: r.id,
158
- totalFiles: s.length,
159
- passed: n,
160
- failed: a,
161
- results: s,
158
+ packageId: s.id,
159
+ totalFiles: r.length,
160
+ passed: a,
161
+ failed: i,
162
+ results: r,
162
163
  totalTime: performance.now() - t
163
164
  };
164
165
  }
165
- const C = ["warning", "info", "tip", "note", "caution", "danger"], j = new RegExp(
166
- `^:::(${C.join("|")}) ([A-Z].*)$`
166
+ const V = ["warning", "info", "tip", "note", "caution", "danger"], z = new RegExp(
167
+ `^:::(${V.join("|")}) ([A-Z].*)$`
167
168
  );
168
- function K(r, e) {
169
- const t = performance.now(), i = [], s = P(r);
170
- let n = 0;
171
- for (const a of s) {
172
- if (!a.file) continue;
173
- n++;
174
- const l = I(a.file, "utf-8").split(`
169
+ function B(s, e) {
170
+ const t = performance.now(), n = [], r = k(s);
171
+ let a = 0;
172
+ for (const i of r) {
173
+ if (!i.file) continue;
174
+ a++;
175
+ const l = x(i.file, "utf-8").split(`
175
176
  `);
176
- for (let u = 0; u < l.length; u++) {
177
- const c = l[u], f = c.match(j);
178
- if (f) {
179
- const [, m, h] = f, p = {
180
- file: r.basePath ? x(r.basePath, a.file) : a.file,
181
- absolutePath: a.file,
182
- line: u + 1,
177
+ for (let c = 0; c < l.length; c++) {
178
+ const m = l[c], o = m.match(z);
179
+ if (o) {
180
+ const [, h, f] = o, g = {
181
+ file: s.basePath ? y(s.basePath, i.file) : i.file,
182
+ absolutePath: i.file,
183
+ line: c + 1,
183
184
  column: 1,
184
- content: c.trim(),
185
- admonitionType: m,
186
- label: h,
187
- suggestion: `:::${m}[${h}]`
185
+ content: m.trim(),
186
+ admonitionType: h,
187
+ label: f,
188
+ suggestion: `:::${h}[${f}]`
188
189
  };
189
- if (i.push(p), e != null && e.onError && e.onError(p), e != null && e.failFast && i.length > 0)
190
+ if (n.push(g), e != null && e.onError && e.onError(g), e != null && e.failFast && n.length > 0)
190
191
  return {
191
- packageId: r.id,
192
- filesScanned: n,
193
- errors: i,
192
+ packageId: s.id,
193
+ filesScanned: a,
194
+ errors: n,
194
195
  totalTime: performance.now() - t
195
196
  };
196
197
  }
197
198
  }
198
199
  }
199
200
  return {
200
- packageId: r.id,
201
- filesScanned: n,
202
- errors: i,
201
+ packageId: s.id,
202
+ filesScanned: a,
203
+ errors: n,
203
204
  totalTime: performance.now() - t
204
205
  };
205
206
  }
206
- function Z(r) {
207
+ function le(s) {
207
208
  const e = [];
208
- if (e.push(""), e.push(`Admonition Syntax Report: ${r.packageId}`), e.push("=".repeat(50)), e.push(""), e.push(`Files scanned: ${r.filesScanned}`), e.push(`Errors found: ${r.errors.length}`), e.push(`Total time: ${r.totalTime.toFixed(2)}ms`), e.push(""), r.errors.length === 0)
209
+ if (e.push(""), e.push(`Admonition Syntax Report: ${s.packageId}`), e.push("=".repeat(50)), e.push(""), e.push(`Files scanned: ${s.filesScanned}`), e.push(`Errors found: ${s.errors.length}`), e.push(`Total time: ${s.totalTime.toFixed(2)}ms`), e.push(""), s.errors.length === 0)
209
210
  return e.push("All admonitions use correct bracket syntax!"), e.push(""), e.join(`
210
211
  `);
211
212
  e.push("Errors:"), e.push("-".repeat(50)), e.push("");
212
- for (const t of r.errors)
213
+ for (const t of s.errors)
213
214
  e.push(` ${t.file}:${t.line}`), e.push(` ${t.content}`), e.push(` Fix: ${t.suggestion}`), e.push("");
214
215
  return e.push("Admonitions with custom titles must use bracket syntax:"), e.push(" Before: :::warning Deprecated"), e.push(" After: :::warning[Deprecated]"), e.push(""), e.push("See: https://github.com/remarkjs/remark-directive"), e.push(""), e.join(`
215
216
  `);
216
217
  }
217
- function q(r, e = !1) {
218
+ const b = /* @__PURE__ */ new Set([
219
+ "abap",
220
+ "actionscript-3",
221
+ "ada",
222
+ "angular-html",
223
+ "angular-ts",
224
+ "apache",
225
+ "apex",
226
+ "apl",
227
+ "applescript",
228
+ "ara",
229
+ "asciidoc",
230
+ "asm",
231
+ "astro",
232
+ "awk",
233
+ "ballerina",
234
+ "bat",
235
+ "beancount",
236
+ "berry",
237
+ "bibtex",
238
+ "bicep",
239
+ "blade",
240
+ "bsl",
241
+ "c",
242
+ "c3",
243
+ "cadence",
244
+ "cairo",
245
+ "clarity",
246
+ "clojure",
247
+ "cmake",
248
+ "cobol",
249
+ "codeowners",
250
+ "codeql",
251
+ "coffee",
252
+ "common-lisp",
253
+ "coq",
254
+ "cpp",
255
+ "crystal",
256
+ "csharp",
257
+ "css",
258
+ "csv",
259
+ "cue",
260
+ "cypher",
261
+ "d",
262
+ "dart",
263
+ "dax",
264
+ "desktop",
265
+ "diff",
266
+ "docker",
267
+ "dotenv",
268
+ "dream-maker",
269
+ "edge",
270
+ "elixir",
271
+ "elm",
272
+ "emacs-lisp",
273
+ "erb",
274
+ "erlang",
275
+ "fennel",
276
+ "fish",
277
+ "fluent",
278
+ "fortran-fixed-form",
279
+ "fortran-free-form",
280
+ "fsharp",
281
+ "gdresource",
282
+ "gdscript",
283
+ "gdshader",
284
+ "genie",
285
+ "gherkin",
286
+ "git-commit",
287
+ "git-rebase",
288
+ "gleam",
289
+ "glimmer-js",
290
+ "glimmer-ts",
291
+ "glsl",
292
+ "gn",
293
+ "gnuplot",
294
+ "go",
295
+ "graphql",
296
+ "groovy",
297
+ "hack",
298
+ "haml",
299
+ "handlebars",
300
+ "haskell",
301
+ "haxe",
302
+ "hcl",
303
+ "hjson",
304
+ "hlsl",
305
+ "html",
306
+ "html-derivative",
307
+ "http",
308
+ "hurl",
309
+ "hxml",
310
+ "hy",
311
+ "imba",
312
+ "ini",
313
+ "java",
314
+ "javascript",
315
+ "jinja",
316
+ "jison",
317
+ "json",
318
+ "json5",
319
+ "jsonc",
320
+ "jsonl",
321
+ "jsonnet",
322
+ "jssm",
323
+ "jsx",
324
+ "julia",
325
+ "kdl",
326
+ "kotlin",
327
+ "kusto",
328
+ "latex",
329
+ "lean",
330
+ "less",
331
+ "liquid",
332
+ "llvm",
333
+ "log",
334
+ "logo",
335
+ "lua",
336
+ "luau",
337
+ "make",
338
+ "markdown",
339
+ "marko",
340
+ "matlab",
341
+ "mdc",
342
+ "mdx",
343
+ "mermaid",
344
+ "mipsasm",
345
+ "mojo",
346
+ "moonbit",
347
+ "move",
348
+ "narrat",
349
+ "nextflow",
350
+ "nginx",
351
+ "nim",
352
+ "nix",
353
+ "nushell",
354
+ "objective-c",
355
+ "objective-cpp",
356
+ "ocaml",
357
+ "odin",
358
+ "openscad",
359
+ "pascal",
360
+ "perl",
361
+ "php",
362
+ "pkl",
363
+ "plsql",
364
+ "po",
365
+ "polar",
366
+ "postcss",
367
+ "powerquery",
368
+ "powershell",
369
+ "prisma",
370
+ "prolog",
371
+ "proto",
372
+ "pug",
373
+ "puppet",
374
+ "purescript",
375
+ "python",
376
+ "qml",
377
+ "qmldir",
378
+ "qss",
379
+ "r",
380
+ "racket",
381
+ "raku",
382
+ "razor",
383
+ "reg",
384
+ "regexp",
385
+ "rel",
386
+ "riscv",
387
+ "ron",
388
+ "rosmsg",
389
+ "rst",
390
+ "ruby",
391
+ "rust",
392
+ "sas",
393
+ "sass",
394
+ "scala",
395
+ "scheme",
396
+ "scss",
397
+ "sdbl",
398
+ "shaderlab",
399
+ "shellscript",
400
+ "shellsession",
401
+ "smalltalk",
402
+ "solidity",
403
+ "soy",
404
+ "sparql",
405
+ "splunk",
406
+ "sql",
407
+ "ssh-config",
408
+ "stata",
409
+ "stylus",
410
+ "surrealql",
411
+ "svelte",
412
+ "swift",
413
+ "system-verilog",
414
+ "systemd",
415
+ "talonscript",
416
+ "tasl",
417
+ "tcl",
418
+ "templ",
419
+ "terraform",
420
+ "tex",
421
+ "toml",
422
+ "ts-tags",
423
+ "tsv",
424
+ "tsx",
425
+ "turtle",
426
+ "twig",
427
+ "typescript",
428
+ "typespec",
429
+ "typst",
430
+ "v",
431
+ "vala",
432
+ "vb",
433
+ "verilog",
434
+ "vhdl",
435
+ "viml",
436
+ "vue",
437
+ "vue-html",
438
+ "vue-vine",
439
+ "vyper",
440
+ "wasm",
441
+ "wenyan",
442
+ "wgsl",
443
+ "wikitext",
444
+ "wit",
445
+ "wolfram",
446
+ "xml",
447
+ "xsl",
448
+ "yaml",
449
+ "zenscript",
450
+ "zig",
451
+ // Aliases registered in Shiki
452
+ "adoc",
453
+ "batch",
454
+ "be",
455
+ "1c",
456
+ "cdc",
457
+ "clj",
458
+ "ql",
459
+ "coffeescript",
460
+ "lisp",
461
+ "c++",
462
+ "c#",
463
+ "cs",
464
+ "cql",
465
+ "dockerfile",
466
+ "elisp",
467
+ "erl",
468
+ "ftl",
469
+ "f",
470
+ "for",
471
+ "f77",
472
+ "f90",
473
+ "f95",
474
+ "f03",
475
+ "f08",
476
+ "f18",
477
+ "f#",
478
+ "fs",
479
+ "tscn",
480
+ "tres",
481
+ "gd",
482
+ "gjs",
483
+ "gts",
484
+ "gql",
485
+ "hbs",
486
+ "hs",
487
+ "properties",
488
+ "js",
489
+ "cjs",
490
+ "mjs",
491
+ "fsl",
492
+ "jl",
493
+ "kt",
494
+ "kts",
495
+ "kql",
496
+ "lean4",
497
+ "makefile",
498
+ "md",
499
+ "mmd",
500
+ "mips",
501
+ "mbt",
502
+ "mbti",
503
+ "nar",
504
+ "nf",
505
+ "nu",
506
+ "objc",
507
+ "scad",
508
+ "pot",
509
+ "potx",
510
+ "ps",
511
+ "ps1",
512
+ "protobuf",
513
+ "jade",
514
+ "py",
515
+ "perl6",
516
+ "regex",
517
+ "rb",
518
+ "rs",
519
+ "1c-query",
520
+ "shader",
521
+ "bash",
522
+ "sh",
523
+ "shell",
524
+ "zsh",
525
+ "console",
526
+ "closure-templates",
527
+ "spl",
528
+ "styl",
529
+ "surql",
530
+ "talon",
531
+ "tf",
532
+ "tfvars",
533
+ "lit",
534
+ "ts",
535
+ "cts",
536
+ "mts",
537
+ "tsp",
538
+ "typ",
539
+ "cmd",
540
+ "vim",
541
+ "vimscript",
542
+ "vy",
543
+ "文言",
544
+ "mediawiki",
545
+ "wiki",
546
+ "wl",
547
+ "yml"
548
+ ]), $ = {
549
+ env: "dotenv",
550
+ text: "ini",
551
+ // fallback for plain text
552
+ plaintext: "ini",
553
+ // fallback for plain text
554
+ txt: "ini",
555
+ // fallback for plain text
556
+ plain: "ini",
557
+ // fallback for plain text
558
+ terminal: "shellscript",
559
+ term: "shellscript",
560
+ cURL: "bash",
561
+ curl: "bash"
562
+ }, W = /^```(\w[\w+#-]*)?/;
563
+ function G(s, e) {
564
+ const t = performance.now(), n = [], r = k(s), a = new Set(b);
565
+ if (e != null && e.additionalLanguages)
566
+ for (const c of e.additionalLanguages)
567
+ a.add(c.toLowerCase());
568
+ const i = { ...$, ...e == null ? void 0 : e.additionalAliases };
569
+ let u = 0, l = 0;
570
+ for (const c of r) {
571
+ if (!c.file) continue;
572
+ u++;
573
+ const o = x(c.file, "utf-8").split(`
574
+ `);
575
+ for (let h = 0; h < o.length; h++) {
576
+ const f = o[h], g = f.match(W);
577
+ if (g) {
578
+ l++;
579
+ const d = g[1];
580
+ if (!d) continue;
581
+ const p = d.toLowerCase();
582
+ if (!(a.has(p) || p in i)) {
583
+ const w = {
584
+ file: s.basePath ? y(s.basePath, c.file) : c.file,
585
+ absolutePath: c.file,
586
+ line: h + 1,
587
+ language: d,
588
+ content: f.trim(),
589
+ suggestion: X(p, a, i)
590
+ };
591
+ if (n.push(w), e != null && e.onError && e.onError(w), e != null && e.failFast && n.length > 0)
592
+ return {
593
+ packageId: s.id,
594
+ filesScanned: u,
595
+ codeBlocksFound: l,
596
+ errors: n,
597
+ totalTime: performance.now() - t
598
+ };
599
+ }
600
+ }
601
+ }
602
+ }
603
+ return {
604
+ packageId: s.id,
605
+ filesScanned: u,
606
+ codeBlocksFound: l,
607
+ errors: n,
608
+ totalTime: performance.now() - t
609
+ };
610
+ }
611
+ function X(s, e, t) {
612
+ if (s in t)
613
+ return `Use '${t[s]}' instead of '${s}'`;
614
+ const n = {
615
+ typescript: "ts",
616
+ javascript: "js",
617
+ "node.js": "javascript",
618
+ nodejs: "javascript",
619
+ "c-sharp": "csharp",
620
+ "c-plus-plus": "cpp",
621
+ py3: "python",
622
+ python3: "python",
623
+ bash4: "bash",
624
+ zshell: "zsh",
625
+ cfg: "ini",
626
+ conf: "ini",
627
+ config: "ini",
628
+ env: "dotenv",
629
+ ".env": "dotenv"
630
+ };
631
+ if (s in n)
632
+ return `Use '${n[s]}' instead of '${s}'`;
633
+ for (const r of e)
634
+ if (r.includes(s) || s.includes(r))
635
+ return `Did you mean '${r}'?`;
636
+ }
637
+ function ce(s, e) {
638
+ var n;
639
+ const t = s.toLowerCase();
640
+ return !!(b.has(t) || t in $ || (n = e == null ? void 0 : e.additionalLanguages) != null && n.includes(t) || e != null && e.additionalAliases && t in e.additionalAliases);
641
+ }
642
+ function ue(s) {
643
+ const e = s.toLowerCase();
644
+ if (e in $)
645
+ return $[e];
646
+ if (b.has(e))
647
+ return e;
648
+ }
649
+ function fe(s) {
650
+ const e = [];
651
+ if (e.push(""), e.push(`Code Language Validation Report: ${s.packageId}`), e.push("=".repeat(50)), e.push(""), e.push(`Files scanned: ${s.filesScanned}`), e.push(`Code blocks found: ${s.codeBlocksFound}`), e.push(`Invalid languages: ${s.errors.length}`), e.push(`Total time: ${s.totalTime.toFixed(2)}ms`), e.push(""), s.errors.length === 0)
652
+ return e.push("All code blocks use valid language identifiers!"), e.push(""), e.join(`
653
+ `);
654
+ e.push("Errors:"), e.push("-".repeat(50)), e.push("");
655
+ const t = /* @__PURE__ */ new Map();
656
+ for (const n of s.errors) {
657
+ const r = t.get(n.language) ?? [];
658
+ r.push(n), t.set(n.language, r);
659
+ }
660
+ for (const [n, r] of t) {
661
+ const a = r[0].suggestion;
662
+ e.push(` Language: '${n}'${a ? ` - ${a}` : " (unsupported)"}`), e.push(` Found in ${r.length} location(s):`);
663
+ for (const i of r)
664
+ e.push(` - ${i.file}:${i.line}`);
665
+ e.push("");
666
+ }
667
+ return e.push("Common fixes:"), e.push(" - 'env' → 'dotenv' (for .env files)"), e.push(" - 'text' → remove language or use 'ini' for config-like content"), e.push(" - 'terminal' → 'bash' or 'shell'"), e.push(""), e.push("See supported languages: https://shiki.style/languages"), e.push(""), e.join(`
668
+ `);
669
+ }
670
+ function K(s, e) {
671
+ const t = performance.now(), n = [], r = k(s);
672
+ let a = 0;
673
+ for (const i of r) {
674
+ if (!i.file) continue;
675
+ a++;
676
+ const u = x(i.file, "utf-8");
677
+ try {
678
+ A(u, i.file);
679
+ } catch (l) {
680
+ const c = {
681
+ file: s.basePath ? y(s.basePath, i.file) : i.file,
682
+ absolutePath: i.file,
683
+ issues: H(l)
684
+ };
685
+ if (n.push(c), e != null && e.onError && e.onError(c), e != null && e.failFast && n.length > 0)
686
+ return {
687
+ packageId: s.id,
688
+ filesScanned: a,
689
+ errors: n,
690
+ totalTime: performance.now() - t
691
+ };
692
+ }
693
+ }
694
+ return {
695
+ packageId: s.id,
696
+ filesScanned: a,
697
+ errors: n,
698
+ totalTime: performance.now() - t
699
+ };
700
+ }
701
+ function H(s) {
702
+ if (s instanceof I) {
703
+ const e = s.message, t = e.split(`
704
+ `), n = [];
705
+ for (const r of t) {
706
+ const a = r.trim();
707
+ a.startsWith("- ") && n.push(a.slice(2));
708
+ }
709
+ return n.length === 0 ? [e] : n;
710
+ }
711
+ return s instanceof Error ? [s.message] : ["Unknown error"];
712
+ }
713
+ function me(s) {
714
+ const e = [];
715
+ if (e.push(""), e.push(`Frontmatter Validation Report: ${s.packageId}`), e.push("=".repeat(50)), e.push(""), e.push(`Files scanned: ${s.filesScanned}`), e.push(`Errors found: ${s.errors.length}`), e.push(`Total time: ${s.totalTime.toFixed(2)}ms`), e.push(""), s.errors.length === 0)
716
+ return e.push("All files have valid frontmatter!"), e.push(""), e.join(`
717
+ `);
718
+ e.push("Errors:"), e.push("-".repeat(50)), e.push("");
719
+ for (const t of s.errors) {
720
+ e.push(` ${t.file}`);
721
+ for (const n of t.issues)
722
+ e.push(` - ${n}`);
723
+ e.push("");
724
+ }
725
+ return e.push("Frontmatter requirements:"), e.push(" - title: Required, non-empty string"), e.push(" - description: Optional string"), e.push(" - keywords: Optional array of strings"), e.push(" - sidebarLabel: Optional string"), e.push(" - hidden: Optional boolean"), e.push(" - order: Optional integer"), e.push(" - lastModified: Optional ISO 8601 datetime"), e.push(""), e.join(`
726
+ `);
727
+ }
728
+ async function he(s, e) {
729
+ const t = performance.now(), {
730
+ verbose: n = !1,
731
+ failFast: r = !1,
732
+ exit: a = !0,
733
+ silent: i = !1,
734
+ mdx: u = !0,
735
+ admonitions: l = !0,
736
+ codeLanguages: c = !0,
737
+ frontmatter: m = !0
738
+ } = e ?? {}, o = {
739
+ packageId: s.id,
740
+ totalErrors: 0,
741
+ totalTime: 0,
742
+ success: !0
743
+ }, h = () => r && o.totalErrors > 0;
744
+ if (m !== !1 && !h()) {
745
+ const f = typeof m == "object" ? m : {};
746
+ r && (f.failFast = !0), o.frontmatter = K(s, f), o.totalErrors += o.frontmatter.errors.length;
747
+ }
748
+ if (l !== !1 && !h()) {
749
+ const f = typeof l == "object" ? l : {};
750
+ r && (f.failFast = !0), o.admonitions = B(s, f), o.totalErrors += o.admonitions.errors.length;
751
+ }
752
+ if (c !== !1 && !h()) {
753
+ const f = typeof c == "object" ? c : {};
754
+ r && (f.failFast = !0), o.codeLanguages = G(s, f), o.totalErrors += o.codeLanguages.errors.length;
755
+ }
756
+ if (u !== !1 && !h()) {
757
+ const f = typeof u == "object" ? u : {};
758
+ r && (f.failFast = !0), o.mdx = await U(s, f), o.totalErrors += o.mdx.failed;
759
+ }
760
+ return o.totalTime = performance.now() - t, o.success = o.totalErrors === 0, i || console.log(Y(o, n)), a && process.exit(o.success ? 0 : 1), o;
761
+ }
762
+ function Y(s, e = !1) {
763
+ const t = [];
764
+ t.push(""), t.push(`Documentation Test Report: ${s.packageId}`), t.push("=".repeat(60)), t.push(""), t.push("Summary"), t.push("-".repeat(60));
765
+ const n = [];
766
+ s.frontmatter && n.push({
767
+ name: "Frontmatter",
768
+ errors: s.frontmatter.errors.length,
769
+ time: s.frontmatter.totalTime,
770
+ details: `${s.frontmatter.filesScanned} files`
771
+ }), s.admonitions && n.push({
772
+ name: "Admonitions",
773
+ errors: s.admonitions.errors.length,
774
+ time: s.admonitions.totalTime,
775
+ details: `${s.admonitions.filesScanned} files`
776
+ }), s.codeLanguages && n.push({
777
+ name: "Code Languages",
778
+ errors: s.codeLanguages.errors.length,
779
+ time: s.codeLanguages.totalTime,
780
+ details: `${s.codeLanguages.codeBlocksFound} blocks`
781
+ }), s.mdx && n.push({
782
+ name: "MDX Compilation",
783
+ errors: s.mdx.failed,
784
+ time: s.mdx.totalTime,
785
+ details: `${s.mdx.passed}/${s.mdx.totalFiles} passed`
786
+ });
787
+ for (const r of n) {
788
+ const a = r.errors === 0 ? "✓" : "✗", i = r.errors === 0 ? "OK" : `${r.errors} error${r.errors > 1 ? "s" : ""}`;
789
+ t.push(` ${a} ${r.name.padEnd(16)} ${i.padEnd(12)} (${r.details})`);
790
+ }
791
+ if (t.push(""), t.push(`Total errors: ${s.totalErrors}`), t.push(`Total time: ${s.totalTime.toFixed(2)}ms`), t.push(""), s.totalErrors > 0 || e) {
792
+ if (t.push("Details"), t.push("-".repeat(60)), s.frontmatter && (s.frontmatter.errors.length > 0 || e))
793
+ if (t.push(""), t.push("Frontmatter Validation:"), s.frontmatter.errors.length === 0)
794
+ t.push(" All files have valid frontmatter.");
795
+ else
796
+ for (const r of s.frontmatter.errors) {
797
+ t.push(` [FAIL] ${r.file}`);
798
+ for (const a of r.issues)
799
+ t.push(` ${a}`);
800
+ }
801
+ if (s.admonitions && (s.admonitions.errors.length > 0 || e))
802
+ if (t.push(""), t.push("Admonition Validation:"), s.admonitions.errors.length === 0)
803
+ t.push(" All admonitions use correct syntax.");
804
+ else
805
+ for (const r of s.admonitions.errors)
806
+ t.push(` [FAIL] ${r.file}:${r.line}`), t.push(` ${r.content}`), t.push(` Fix: ${r.suggestion}`);
807
+ if (s.codeLanguages && (s.codeLanguages.errors.length > 0 || e))
808
+ if (t.push(""), t.push("Code Language Validation:"), s.codeLanguages.errors.length === 0)
809
+ t.push(" All code blocks use valid languages.");
810
+ else {
811
+ const r = /* @__PURE__ */ new Map();
812
+ for (const a of s.codeLanguages.errors) {
813
+ const i = r.get(a.language) ?? [];
814
+ i.push(a), r.set(a.language, i);
815
+ }
816
+ for (const [a, i] of r) {
817
+ const u = i[0].suggestion;
818
+ t.push(` Language '${a}'${u ? ` - ${u}` : " (unsupported)"}`);
819
+ for (const l of i)
820
+ t.push(` - ${l.file}:${l.line}`);
821
+ }
822
+ }
823
+ if (s.mdx && (s.mdx.failed > 0 || e)) {
824
+ if (t.push(""), t.push("MDX Compilation:"), s.mdx.failed === 0)
825
+ t.push(" All MDX files compiled successfully.");
826
+ else
827
+ for (const r of s.mdx.results)
828
+ if (r.success)
829
+ e && t.push(` [PASS] ${r.filePath}`);
830
+ else if (t.push(` [FAIL] ${r.filePath}`), r.error) {
831
+ const a = r.line ? ` (line ${r.line}${r.column ? `:${r.column}` : ""})` : "";
832
+ t.push(` Error${a}: ${r.error}`);
833
+ }
834
+ }
835
+ }
836
+ return t.push(""), s.success ? t.push("✔ All documentation tests passed!") : t.push(`✖ ${s.totalErrors} error${s.totalErrors > 1 ? "s" : ""} found.`), t.push(""), t.join(`
837
+ `);
838
+ }
839
+ function de(s, e = !1) {
218
840
  const t = [];
219
- t.push(""), t.push(`MDX Compilation Report: ${r.packageId}`), t.push("=".repeat(50)), t.push("");
220
- const i = r.totalFiles > 0 ? (r.passed / r.totalFiles * 100).toFixed(1) : "0";
221
- if (t.push(`Total files: ${r.totalFiles}`), t.push(`Passed: ${r.passed} (${i}%)`), t.push(`Failed: ${r.failed}`), t.push(`Total time: ${r.totalTime.toFixed(2)}ms`), t.push(""), e) {
841
+ t.push(""), t.push(`MDX Compilation Report: ${s.packageId}`), t.push("=".repeat(50)), t.push("");
842
+ const n = s.totalFiles > 0 ? (s.passed / s.totalFiles * 100).toFixed(1) : "0";
843
+ if (t.push(`Total files: ${s.totalFiles}`), t.push(`Passed: ${s.passed} (${n}%)`), t.push(`Failed: ${s.failed}`), t.push(`Total time: ${s.totalTime.toFixed(2)}ms`), t.push(""), e) {
222
844
  t.push("Results:"), t.push("-".repeat(50));
223
- for (const s of r.results) {
224
- const n = s.success ? "[PASS]" : "[FAIL]", a = `(${s.compilationTime.toFixed(2)}ms)`;
225
- if (t.push(`${n} ${s.filePath} ${a}`), !s.success && s.error) {
226
- const o = s.line ? ` (line ${s.line}${s.column ? `:${s.column}` : ""})` : "";
227
- t.push(` Error${o}: ${s.error}`);
845
+ for (const r of s.results) {
846
+ const a = r.success ? "[PASS]" : "[FAIL]", i = `(${r.compilationTime.toFixed(2)}ms)`;
847
+ if (t.push(`${a} ${r.filePath} ${i}`), !r.success && r.error) {
848
+ const u = r.line ? ` (line ${r.line}${r.column ? `:${r.column}` : ""})` : "";
849
+ t.push(` Error${u}: ${r.error}`);
228
850
  }
229
851
  }
230
- } else if (r.failed > 0) {
852
+ } else if (s.failed > 0) {
231
853
  t.push("Failures:"), t.push("-".repeat(50));
232
- for (const s of r.results.filter((n) => !n.success))
233
- if (t.push(`[FAIL] ${s.filePath}`), s.error) {
234
- const n = s.line ? ` (line ${s.line}${s.column ? `:${s.column}` : ""})` : "";
235
- t.push(` Error${n}: ${s.error}`);
854
+ for (const r of s.results.filter((a) => !a.success))
855
+ if (t.push(`[FAIL] ${r.filePath}`), r.error) {
856
+ const a = r.line ? ` (line ${r.line}${r.column ? `:${r.column}` : ""})` : "";
857
+ t.push(` Error${a}: ${r.error}`);
236
858
  }
237
859
  }
238
- return t.push(""), r.failed === 0 ? t.push("All MDX files compiled successfully!") : t.push(`${r.failed} file(s) failed to compile.`), t.push(""), t.join(`
860
+ return t.push(""), s.failed === 0 ? t.push("All MDX files compiled successfully!") : t.push(`${s.failed} file(s) failed to compile.`), t.push(""), t.join(`
239
861
  `);
240
862
  }
241
- function z() {
242
- return (r, e, t) => {
243
- const i = t.success ? "✓" : "✗", s = (r / e * 100).toFixed(0);
244
- process.stdout.write(`\r[${r}/${e}] (${s}%) ${i} ${t.filePath}`), process.stdout.write("\x1B[K"), r === e && process.stdout.write(`
863
+ function ge() {
864
+ return (s, e, t) => {
865
+ const n = t.success ? "✓" : "✗", r = (s / e * 100).toFixed(0);
866
+ process.stdout.write(`\r[${s}/${e}] (${r}%) ${n} ${t.filePath}`), process.stdout.write("\x1B[K"), s === e && process.stdout.write(`
245
867
  `);
246
868
  };
247
869
  }
248
870
  export {
249
- C as ADMONITION_TYPES,
250
- j as INVALID_ADMONITION_PATTERN,
251
- L as compileMdx,
252
- z as createProgressReporter,
253
- Z as formatAdmonitionReport,
254
- q as formatTestReport,
255
- N as getDefaultRehypePlugins,
256
- M as getDefaultRemarkPlugins,
257
- H as testManifestMdx,
258
- K as validateAdmonitions
871
+ V as ADMONITION_TYPES,
872
+ z as INVALID_ADMONITION_PATTERN,
873
+ $ as LANGUAGE_ALIASES,
874
+ b as SHIKI_BUNDLED_LANGUAGES,
875
+ _ as compileMdx,
876
+ ge as createProgressReporter,
877
+ le as formatAdmonitionReport,
878
+ fe as formatCodeLanguageReport,
879
+ me as formatFrontmatterReport,
880
+ de as formatTestReport,
881
+ Y as formatTestRunnerReport,
882
+ ue as getCanonicalLanguage,
883
+ O as getDefaultRehypePlugins,
884
+ N as getDefaultRemarkPlugins,
885
+ ce as isValidCodeLanguage,
886
+ he as runAllTests,
887
+ U as testManifestMdx,
888
+ B as validateAdmonitions,
889
+ G as validateCodeLanguages,
890
+ K as validateFrontmatter
259
891
  };