@forsakringskassan/docs-generator 3.3.2 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{create-markdown-renderer-AbpNHoqd.mjs → create-markdown-renderer-O3H4lWpJ.mjs} +47 -61
- package/dist/create-markdown-renderer-O3H4lWpJ.mjs.map +1 -0
- package/dist/{format-code.worker-C__DrPyb.mjs → format-code.worker-BrwaE6UF.mjs} +2 -2
- package/dist/format-code.worker-BrwaE6UF.mjs.map +1 -0
- package/dist/index.mjs +87 -97
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.mjs +3 -3
- package/dist/processors/selectable-version.mjs +3 -3
- package/dist/runtime-bootstrap.mjs +1 -1
- package/dist/runtime.mjs +97 -32
- package/dist/{vendor-B2TWdfAe.mjs → vendor-CjH-H-vc.mjs} +221 -219
- package/dist/{vendor-B2TWdfAe.mjs.map → vendor-CjH-H-vc.mjs.map} +1 -1
- package/dist/{vue3-B3-18vX3.mjs → vue3-DbJPWpmQ.mjs} +2 -2
- package/dist/{vue3-B3-18vX3.mjs.map → vue3-DbJPWpmQ.mjs.map} +1 -1
- package/dist/{worker-DX8mHsqQ.mjs → worker-48dDDchZ.mjs} +5 -6
- package/dist/worker-48dDDchZ.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/create-markdown-renderer-AbpNHoqd.mjs.map +0 -1
- package/dist/format-code.worker-C__DrPyb.mjs.map +0 -1
- package/dist/worker-DX8mHsqQ.mjs.map +0 -1
package/dist/{create-markdown-renderer-AbpNHoqd.mjs → create-markdown-renderer-O3H4lWpJ.mjs}
RENAMED
|
@@ -2,7 +2,7 @@ import { createRequire as $createRequire } from "node:module";
|
|
|
2
2
|
|
|
3
3
|
const require = $createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
import { c as createSyncFn, d as dedent, H as HighlightJS, b as createTwoFilesPatch, M as MarkdownIt, e as deflist_plugin } from './vendor-
|
|
5
|
+
import { c as createSyncFn, d as dedent, H as HighlightJS, b as createTwoFilesPatch, M as MarkdownIt, e as deflist_plugin } from './vendor-CjH-H-vc.mjs';
|
|
6
6
|
import path from 'node:path/posix';
|
|
7
7
|
import path__default from 'node:path';
|
|
8
8
|
import crypto from 'node:crypto';
|
|
@@ -10,7 +10,7 @@ import 'node:child_process';
|
|
|
10
10
|
import { fileURLToPath } from 'node:url';
|
|
11
11
|
import fs__default from 'node:fs';
|
|
12
12
|
import { version } from 'vue';
|
|
13
|
-
import { g as generateCode } from './vue3-
|
|
13
|
+
import { g as generateCode } from './vue3-DbJPWpmQ.mjs';
|
|
14
14
|
|
|
15
15
|
function findDocument(haystack, needle) {
|
|
16
16
|
for (const document of haystack) {
|
|
@@ -34,9 +34,8 @@ function findTag(tags, tag) {
|
|
|
34
34
|
}
|
|
35
35
|
if (match === tag) {
|
|
36
36
|
return { tag, value: null };
|
|
37
|
-
} else {
|
|
38
|
-
return { tag, value: match.slice(tag.length + 1) };
|
|
39
37
|
}
|
|
38
|
+
return { tag, value: match.slice(tag.length + 1) };
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
const replacements = {
|
|
@@ -47,14 +46,9 @@ const replacements = {
|
|
|
47
46
|
function findVersion(text) {
|
|
48
47
|
const match = /(\d+)\.(\d+)\.(\d+) \(\d+-\d+-\d+\)/.exec(text);
|
|
49
48
|
if (match) {
|
|
50
|
-
return [
|
|
51
|
-
Number.parseInt(match[1], 10),
|
|
52
|
-
Number.parseInt(match[2], 10),
|
|
53
|
-
Number.parseInt(match[3], 10)
|
|
54
|
-
];
|
|
55
|
-
} else {
|
|
56
|
-
return null;
|
|
49
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
57
50
|
}
|
|
51
|
+
return null;
|
|
58
52
|
}
|
|
59
53
|
function generateId(text) {
|
|
60
54
|
const version = findVersion(text);
|
|
@@ -84,14 +78,14 @@ function getOutputFilePath(outputFolder, fileInfo) {
|
|
|
84
78
|
return normalizePath(outputFolder, path, outputName);
|
|
85
79
|
}
|
|
86
80
|
|
|
87
|
-
const url$1 = new URL("./format-code.worker-
|
|
81
|
+
const url$1 = new URL("./format-code.worker-BrwaE6UF.mjs", import.meta.url);
|
|
88
82
|
const filePath$1 = fileURLToPath(url$1);
|
|
89
83
|
|
|
90
84
|
const formatCode = createSyncFn(filePath$1);
|
|
91
85
|
|
|
92
86
|
function hasTag(tags, tag) {
|
|
93
|
-
const match = tags.
|
|
94
|
-
return
|
|
87
|
+
const match = tags.some((it) => it === tag || it.startsWith(`${tag}=`));
|
|
88
|
+
return match;
|
|
95
89
|
}
|
|
96
90
|
|
|
97
91
|
const replacement = {
|
|
@@ -139,7 +133,7 @@ function getExampleName(filename) {
|
|
|
139
133
|
return path__default.parse(filename).name;
|
|
140
134
|
}
|
|
141
135
|
|
|
142
|
-
const vueMajor = Number
|
|
136
|
+
const vueMajor = Number(version.split(".", 2)[0]);
|
|
143
137
|
function vueGenerator() {
|
|
144
138
|
switch (vueMajor) {
|
|
145
139
|
case 2:
|
|
@@ -203,18 +197,17 @@ function generateVueExample(options) {
|
|
|
203
197
|
parent
|
|
204
198
|
}
|
|
205
199
|
};
|
|
206
|
-
} else {
|
|
207
|
-
return {
|
|
208
|
-
source: sourcecode,
|
|
209
|
-
language: "plaintext",
|
|
210
|
-
comments: [],
|
|
211
|
-
tags,
|
|
212
|
-
markup,
|
|
213
|
-
output: null,
|
|
214
|
-
runtime: true,
|
|
215
|
-
task: null
|
|
216
|
-
};
|
|
217
200
|
}
|
|
201
|
+
return {
|
|
202
|
+
source: sourcecode,
|
|
203
|
+
language: "plaintext",
|
|
204
|
+
comments: [],
|
|
205
|
+
tags,
|
|
206
|
+
markup,
|
|
207
|
+
output: null,
|
|
208
|
+
runtime: true,
|
|
209
|
+
task: null
|
|
210
|
+
};
|
|
218
211
|
}
|
|
219
212
|
function generateStaticExample(options) {
|
|
220
213
|
const { filename, source, language, tags } = options;
|
|
@@ -343,9 +336,8 @@ function maybeDedent(value) {
|
|
|
343
336
|
}
|
|
344
337
|
if (/^\s/.test(value)) {
|
|
345
338
|
return dedent(value);
|
|
346
|
-
} else {
|
|
347
|
-
return value;
|
|
348
339
|
}
|
|
340
|
+
return value;
|
|
349
341
|
}
|
|
350
342
|
const transformations = {
|
|
351
343
|
html: [cutSnippets, stripHtmlValidateComments, maybeDedent],
|
|
@@ -367,7 +359,7 @@ function transformCode(code, lang) {
|
|
|
367
359
|
return code;
|
|
368
360
|
}
|
|
369
361
|
|
|
370
|
-
const url = new URL("./worker-
|
|
362
|
+
const url = new URL("./worker-48dDDchZ.mjs", import.meta.url);
|
|
371
363
|
const filePath = fileURLToPath(url);
|
|
372
364
|
|
|
373
365
|
class SoftError extends Error {
|
|
@@ -396,11 +388,11 @@ function getRelativeUrl(from, to) {
|
|
|
396
388
|
const relative = path.relative(fromDir, toResolved);
|
|
397
389
|
if (fromDir === toDir) {
|
|
398
390
|
return relative === "index.html" ? "./" : `./${relative}`;
|
|
399
|
-
}
|
|
391
|
+
}
|
|
392
|
+
if (relative.endsWith("/index.html")) {
|
|
400
393
|
return path.dirname(relative);
|
|
401
|
-
} else {
|
|
402
|
-
return relative;
|
|
403
394
|
}
|
|
395
|
+
return relative;
|
|
404
396
|
}
|
|
405
397
|
function getLinkTitle(doc, key, explicitTitle) {
|
|
406
398
|
if (explicitTitle) {
|
|
@@ -409,9 +401,8 @@ function getLinkTitle(doc, key, explicitTitle) {
|
|
|
409
401
|
const { title, component } = doc.attributes;
|
|
410
402
|
if (component?.some((it) => it.name === key)) {
|
|
411
403
|
return `<code>${key}</code>`;
|
|
412
|
-
} else {
|
|
413
|
-
return title ?? doc.name;
|
|
414
404
|
}
|
|
405
|
+
return title ?? doc.name;
|
|
415
406
|
}
|
|
416
407
|
function renderLink(link) {
|
|
417
408
|
const { href, title, rel } = link;
|
|
@@ -577,10 +568,9 @@ function getStandalonePath(output) {
|
|
|
577
568
|
function ensureTrailingNewline(text) {
|
|
578
569
|
if (text.endsWith("\n")) {
|
|
579
570
|
return text;
|
|
580
|
-
} else {
|
|
581
|
-
return `${text}
|
|
582
|
-
`;
|
|
583
571
|
}
|
|
572
|
+
return `${text}
|
|
573
|
+
`;
|
|
584
574
|
}
|
|
585
575
|
function codePreview(options) {
|
|
586
576
|
const { generateExample, getImportedSource } = options;
|
|
@@ -608,7 +598,7 @@ function codePreview(options) {
|
|
|
608
598
|
);
|
|
609
599
|
const b = ensureTrailingNewline(transformCode(content, language));
|
|
610
600
|
const diff = createTwoFilesPatch("a", "b", a, b, "", "", {
|
|
611
|
-
context: context ? Number
|
|
601
|
+
context: context ? Number(context) : 3,
|
|
612
602
|
ignoreWhitespace: true
|
|
613
603
|
}).split("\n").slice(4).join("\n");
|
|
614
604
|
return {
|
|
@@ -665,7 +655,7 @@ function codePreview(options) {
|
|
|
665
655
|
);
|
|
666
656
|
const testId = findTestId(tags) ?? findTag(tags, "name")?.value;
|
|
667
657
|
const liveExample = tags.includes("live-example");
|
|
668
|
-
const staticCode = example.runtime
|
|
658
|
+
const staticCode = !example.runtime || tags.includes("static");
|
|
669
659
|
const noMarkup = tags.includes("nomarkup");
|
|
670
660
|
const fullscreen = tags.includes("fullscreen");
|
|
671
661
|
const modifier = getClassModifier(tags);
|
|
@@ -811,7 +801,7 @@ function headingLevel(options) {
|
|
|
811
801
|
}
|
|
812
802
|
ids.add(id);
|
|
813
803
|
return tag.replace(/h(\d)/, (_, n) => {
|
|
814
|
-
const level = Number
|
|
804
|
+
const level = Number(n) + offset;
|
|
815
805
|
env.currentHeading = level;
|
|
816
806
|
return `<h${String(level)} id="${id}" class="docs-heading docs-heading--h${n}"><a class="header-anchor" href="#${id}">`;
|
|
817
807
|
});
|
|
@@ -819,7 +809,7 @@ function headingLevel(options) {
|
|
|
819
809
|
md.renderer.rules.heading_close = function(tokens, idx) {
|
|
820
810
|
const { tag } = tokens[idx];
|
|
821
811
|
return tag.replace(/h(\d)/, (_, n) => {
|
|
822
|
-
const level = Number
|
|
812
|
+
const level = Number(n) + offset;
|
|
823
813
|
return `</a></h${String(level)}>`;
|
|
824
814
|
});
|
|
825
815
|
};
|
|
@@ -936,9 +926,8 @@ function detailsContainer(context, options) {
|
|
|
936
926
|
const customTitle = info ? info.split(" ") : [];
|
|
937
927
|
if (customTitle.length > 0) {
|
|
938
928
|
return customTitle.join(" ");
|
|
939
|
-
} else {
|
|
940
|
-
return options.title.details ?? "Details";
|
|
941
929
|
}
|
|
930
|
+
return options.title.details ?? "Details";
|
|
942
931
|
}
|
|
943
932
|
return (tokens, index) => {
|
|
944
933
|
const token = tokens[index];
|
|
@@ -968,21 +957,19 @@ function messageboxContainer(context, options, alias) {
|
|
|
968
957
|
function getTitle(variant, customTitle) {
|
|
969
958
|
if (customTitle && customTitle.length > 0) {
|
|
970
959
|
return customTitle.join(" ");
|
|
971
|
-
} else {
|
|
972
|
-
return options.title[variant] ?? defaultTitle[variant] ?? "";
|
|
973
960
|
}
|
|
961
|
+
return options.title[variant] ?? defaultTitle[variant] ?? "";
|
|
974
962
|
}
|
|
975
963
|
function parseInfo(info) {
|
|
976
964
|
if (alias) {
|
|
977
|
-
const
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
return { variant, title };
|
|
981
|
-
} else {
|
|
982
|
-
const [variant = "info", ...customTitle] = info ? info.split(" ") : [];
|
|
983
|
-
const title = getTitle(variant, customTitle);
|
|
984
|
-
return { variant, title };
|
|
965
|
+
const variant2 = alias;
|
|
966
|
+
const customTitle2 = info ? info.split(" ") : [];
|
|
967
|
+
const title2 = getTitle(variant2, customTitle2);
|
|
968
|
+
return { variant: variant2, title: title2 };
|
|
985
969
|
}
|
|
970
|
+
const [variant = "info", ...customTitle] = info ? info.split(" ") : [];
|
|
971
|
+
const title = getTitle(variant, customTitle);
|
|
972
|
+
return { variant, title };
|
|
986
973
|
}
|
|
987
974
|
return (tokens, index) => {
|
|
988
975
|
const token = tokens[index];
|
|
@@ -1006,11 +993,11 @@ function messageboxContainer(context, options, alias) {
|
|
|
1006
993
|
const markerStr = ":";
|
|
1007
994
|
const markerChar = markerStr.codePointAt(0);
|
|
1008
995
|
function container(state, startLine, endLine, silent) {
|
|
1009
|
-
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1010
|
-
let max = state.eMarks[startLine];
|
|
1011
996
|
if (state.sCount[startLine] - state.blkIndent >= 4) {
|
|
1012
997
|
return false;
|
|
1013
998
|
}
|
|
999
|
+
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
1000
|
+
let max = state.eMarks[startLine];
|
|
1014
1001
|
if (pos + 3 > max) {
|
|
1015
1002
|
return false;
|
|
1016
1003
|
}
|
|
@@ -1024,13 +1011,13 @@ function container(state, startLine, endLine, silent) {
|
|
|
1024
1011
|
if (len < 3) {
|
|
1025
1012
|
return false;
|
|
1026
1013
|
}
|
|
1014
|
+
if (silent) {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1027
1017
|
const markup = state.src.slice(mem, pos);
|
|
1028
1018
|
const params = state.src.slice(pos, max).trim().split(/\s+/);
|
|
1029
1019
|
const kind = params[0];
|
|
1030
1020
|
const info = params.slice(1).join(" ");
|
|
1031
|
-
if (silent) {
|
|
1032
|
-
return true;
|
|
1033
|
-
}
|
|
1034
1021
|
let nextLine = startLine;
|
|
1035
1022
|
let haveEndMarker = false;
|
|
1036
1023
|
for (; ; ) {
|
|
@@ -1169,9 +1156,8 @@ function processInlineTags(tags, doc, docs, text, handleSoftError) {
|
|
|
1169
1156
|
} catch (err) {
|
|
1170
1157
|
if (err instanceof SoftError) {
|
|
1171
1158
|
return handleSoftError(err);
|
|
1172
|
-
} else {
|
|
1173
|
-
throw err;
|
|
1174
1159
|
}
|
|
1160
|
+
throw err;
|
|
1175
1161
|
}
|
|
1176
1162
|
}
|
|
1177
1163
|
);
|
|
@@ -1251,4 +1237,4 @@ function createMarkdownRenderer(options) {
|
|
|
1251
1237
|
}
|
|
1252
1238
|
|
|
1253
1239
|
export { SoftError as S, getFingerprint as a, parseImport as b, createMarkdownRenderer as c, findTag as d, getOutputFilePath as e, formatCode as f, generateId as g, hasTag as h, isDocumentPage as i, htmlencode as j, filePath as k, generateExample as l, normalizePath as n, parseInfostring as p };
|
|
1254
|
-
//# sourceMappingURL=create-markdown-renderer-
|
|
1240
|
+
//# sourceMappingURL=create-markdown-renderer-O3H4lWpJ.mjs.map
|