@forsakringskassan/docs-generator 2.15.6 → 2.16.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/compile-example.js +2 -2
- package/dist/{create-markdown-renderer-BeXKdFXE.js → create-markdown-renderer-D_yU9x5w.js} +90 -23
- package/dist/index.d.ts +1 -0
- package/dist/index.js +193 -24
- package/dist/markdown.js +3 -3
- package/dist/processors/selectable-version.js +21 -8
- package/dist/runtime.js +136 -73
- package/dist/style/core.css +12 -0
- package/dist/style/index.css +12 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vendor-Bxk8vVJ2.js → vendor-BeoVq2Sv.js} +1189 -34
- package/dist/{vue3-Dgc-sSad.js → vue3-B1yNeGmz.js} +460 -8
- package/package.json +2 -1
package/dist/compile-example.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
var path$1 = require('node:path');
|
|
4
4
|
var esbuild = require('esbuild');
|
|
5
5
|
var vue = require('vue');
|
|
6
|
-
var vue3 = require('./vue3-
|
|
6
|
+
var vue3 = require('./vue3-B1yNeGmz.js');
|
|
7
7
|
var path = require('node:path/posix');
|
|
8
8
|
require('@vue/compiler-sfc');
|
|
9
|
-
require('./vendor-
|
|
9
|
+
require('./vendor-BeoVq2Sv.js');
|
|
10
10
|
require('node:url');
|
|
11
11
|
require('fs');
|
|
12
12
|
require('node:fs');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var vendor = require('./vendor-
|
|
3
|
+
var vendor = require('./vendor-BeoVq2Sv.js');
|
|
4
4
|
var path = require('node:path/posix');
|
|
5
5
|
var path$1 = require('node:path');
|
|
6
6
|
require('crypto');
|
|
@@ -8,7 +8,7 @@ var crypto = require('node:crypto');
|
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
var fs = require('node:fs');
|
|
10
10
|
var vue = require('vue');
|
|
11
|
-
var vue3 = require('./vue3-
|
|
11
|
+
var vue3 = require('./vue3-B1yNeGmz.js');
|
|
12
12
|
|
|
13
13
|
function findDocument(haystack, needle) {
|
|
14
14
|
const match = haystack.find((it) => {
|
|
@@ -26,6 +26,18 @@ function findDocument(haystack, needle) {
|
|
|
26
26
|
return match ?? null;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
function findTag(tags, tag) {
|
|
30
|
+
const match = tags.find((it) => it === tag || it.startsWith(`${tag}=`));
|
|
31
|
+
if (!match) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (match === tag) {
|
|
35
|
+
return { tag, value: null };
|
|
36
|
+
} else {
|
|
37
|
+
return { tag, value: match.slice(tag.length + 1) };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
const replacements = {
|
|
30
42
|
\u00E5: "a",
|
|
31
43
|
\u00E4: "a",
|
|
@@ -68,6 +80,11 @@ function getOutputFilePath(outputFolder, fileInfo) {
|
|
|
68
80
|
return normalizePath(outputFolder, path, outputName);
|
|
69
81
|
}
|
|
70
82
|
|
|
83
|
+
function hasTag(tags, tag) {
|
|
84
|
+
const match = tags.find((it) => it === tag || it.startsWith(`${tag}=`));
|
|
85
|
+
return Boolean(match);
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
function parseImport(raw) {
|
|
72
89
|
const comments = [];
|
|
73
90
|
const stripped = raw.replace(/<!--.*?-->/gms, (match) => {
|
|
@@ -260,21 +277,34 @@ function generateVueExample(options) {
|
|
|
260
277
|
code: source,
|
|
261
278
|
setupPath
|
|
262
279
|
});
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
if (output) {
|
|
281
|
+
return {
|
|
282
|
+
source,
|
|
283
|
+
language: options.language,
|
|
284
|
+
comments: [],
|
|
285
|
+
tags,
|
|
286
|
+
markup,
|
|
287
|
+
output,
|
|
288
|
+
runtime: true,
|
|
289
|
+
task: {
|
|
290
|
+
outputFile: output,
|
|
291
|
+
sourcecode,
|
|
292
|
+
sourceFile: filename,
|
|
293
|
+
parent
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
} else {
|
|
297
|
+
return {
|
|
298
|
+
source: sourcecode,
|
|
299
|
+
language: "plaintext",
|
|
300
|
+
comments: [],
|
|
301
|
+
tags,
|
|
302
|
+
markup,
|
|
303
|
+
output: null,
|
|
304
|
+
runtime: true,
|
|
305
|
+
task: null
|
|
306
|
+
};
|
|
307
|
+
}
|
|
278
308
|
}
|
|
279
309
|
function generateStaticExample(options) {
|
|
280
310
|
const { filename, source, language, tags } = options;
|
|
@@ -488,7 +518,7 @@ function htmlencode(text) {
|
|
|
488
518
|
function replaceAtLink(text) {
|
|
489
519
|
return text.replace(
|
|
490
520
|
/{@link [^}]+[$}]/g,
|
|
491
|
-
(match) => match.replace(
|
|
521
|
+
(match) => match.replace(/^{/, "{").replace(/}$/, "}")
|
|
492
522
|
);
|
|
493
523
|
}
|
|
494
524
|
|
|
@@ -505,6 +535,23 @@ function getStandalonePath(output) {
|
|
|
505
535
|
const { dir, name } = path$1.parse(output);
|
|
506
536
|
return path$1.join(dir, `${name}.html`);
|
|
507
537
|
}
|
|
538
|
+
function getSource(content, language, tags, { namedExamples }) {
|
|
539
|
+
const compare = findTag(tags, "compare");
|
|
540
|
+
if (compare && compare.value !== null) {
|
|
541
|
+
const reference = namedExamples.get(compare.value);
|
|
542
|
+
if (!reference) {
|
|
543
|
+
throw new Error(
|
|
544
|
+
`Failed to find referenced example "${compare.value}"`
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
const diff = vendor.createTwoFilesPatch("a", "b", reference.content, content).split("\n").slice(3).filter((it) => !it.startsWith("@@")).join("\n");
|
|
548
|
+
return {
|
|
549
|
+
source: diff,
|
|
550
|
+
language: "diff"
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return { source: content, language };
|
|
554
|
+
}
|
|
508
555
|
function codePreview(options) {
|
|
509
556
|
const { generateExample } = options;
|
|
510
557
|
return (md) => {
|
|
@@ -512,16 +559,33 @@ function codePreview(options) {
|
|
|
512
559
|
};
|
|
513
560
|
function fence(_md, tokens, idx, _options, env) {
|
|
514
561
|
const { fileInfo } = env;
|
|
515
|
-
const { content:
|
|
516
|
-
const { language, tags: rawTags } = parseInfostring(info);
|
|
517
|
-
|
|
562
|
+
const { content: rawContent, info, map } = tokens[idx];
|
|
563
|
+
const { language: rawLanguage, tags: rawTags } = parseInfostring(info);
|
|
564
|
+
const name = findTag(rawTags, "name")?.value;
|
|
565
|
+
if (name) {
|
|
566
|
+
env.namedExamples.set(name, {
|
|
567
|
+
name,
|
|
568
|
+
tags: rawTags,
|
|
569
|
+
content: rawContent
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
if (hasTag(rawTags, "hidden")) {
|
|
573
|
+
return "";
|
|
574
|
+
}
|
|
575
|
+
if (rawLanguage === "mermaid") {
|
|
518
576
|
return (
|
|
519
577
|
/* HTML */
|
|
520
578
|
`
|
|
521
|
-
<pre class="mermaid">${htmlencode(
|
|
579
|
+
<pre class="mermaid">${htmlencode(rawContent)}</pre>
|
|
522
580
|
`
|
|
523
581
|
);
|
|
524
582
|
}
|
|
583
|
+
const { source, language } = getSource(
|
|
584
|
+
rawContent,
|
|
585
|
+
rawLanguage,
|
|
586
|
+
rawTags,
|
|
587
|
+
env
|
|
588
|
+
);
|
|
525
589
|
const example = generateExample({
|
|
526
590
|
source,
|
|
527
591
|
language,
|
|
@@ -970,7 +1034,8 @@ function createMarkdownRenderer(options) {
|
|
|
970
1034
|
path: "",
|
|
971
1035
|
outputName: false
|
|
972
1036
|
},
|
|
973
|
-
ids: /* @__PURE__ */ new Set()
|
|
1037
|
+
ids: /* @__PURE__ */ new Set(),
|
|
1038
|
+
namedExamples: /* @__PURE__ */ new Map()
|
|
974
1039
|
};
|
|
975
1040
|
const included = /* @__PURE__ */ new Set();
|
|
976
1041
|
const md = vendor.MarkdownIt({
|
|
@@ -1015,9 +1080,11 @@ function createMarkdownRenderer(options) {
|
|
|
1015
1080
|
|
|
1016
1081
|
exports.SoftError = SoftError;
|
|
1017
1082
|
exports.createMarkdownRenderer = createMarkdownRenderer;
|
|
1083
|
+
exports.findTag = findTag;
|
|
1018
1084
|
exports.generateExample = generateExample;
|
|
1019
1085
|
exports.generateId = generateId;
|
|
1020
1086
|
exports.getFingerprint = getFingerprint;
|
|
1021
1087
|
exports.getOutputFilePath = getOutputFilePath;
|
|
1088
|
+
exports.hasTag = hasTag;
|
|
1022
1089
|
exports.normalizePath = normalizePath;
|
|
1023
1090
|
exports.parseInfostring = parseInfostring;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var fs = require('node:fs/promises');
|
|
4
4
|
var path = require('node:path/posix');
|
|
5
|
-
var vendor = require('./vendor-
|
|
5
|
+
var vendor = require('./vendor-BeoVq2Sv.js');
|
|
6
6
|
var path$1 = require('node:path');
|
|
7
7
|
var require$$1 = require('crypto');
|
|
8
8
|
require('node:crypto');
|
|
9
|
-
var createMarkdownRenderer = require('./create-markdown-renderer-
|
|
9
|
+
var createMarkdownRenderer = require('./create-markdown-renderer-D_yU9x5w.js');
|
|
10
10
|
var node_child_process = require('node:child_process');
|
|
11
11
|
var util = require('node:util');
|
|
12
|
+
var codeFrame = require('@babel/code-frame');
|
|
12
13
|
var vueDocgenApi = require('vue-docgen-api');
|
|
13
14
|
var fs$1 = require('node:fs');
|
|
14
15
|
var sass = require('sass');
|
|
@@ -43,7 +44,7 @@ require('tls');
|
|
|
43
44
|
require('tty');
|
|
44
45
|
require('querystring');
|
|
45
46
|
require('vue');
|
|
46
|
-
require('./vue3-
|
|
47
|
+
require('./vue3-B1yNeGmz.js');
|
|
47
48
|
|
|
48
49
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
49
50
|
function toArray$2(value) {
|
|
@@ -123,13 +124,16 @@ const matchHeading = /^(#+)(.*)$/gm;
|
|
|
123
124
|
function getHeadings(text) {
|
|
124
125
|
return Array.from(text.matchAll(matchHeading), parseHeading);
|
|
125
126
|
}
|
|
127
|
+
function cleanTitle(text) {
|
|
128
|
+
return text.trim().replaceAll("`", "");
|
|
129
|
+
}
|
|
126
130
|
function parseHeading(match) {
|
|
127
131
|
const [, prefix, text] = match;
|
|
128
132
|
const rank = prefix.length;
|
|
129
133
|
const id = createMarkdownRenderer.generateId(text);
|
|
130
134
|
return {
|
|
131
135
|
rank,
|
|
132
|
-
title: text
|
|
136
|
+
title: cleanTitle(text),
|
|
133
137
|
anchor: id
|
|
134
138
|
};
|
|
135
139
|
}
|
|
@@ -269,7 +273,10 @@ md$2.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
|
269
273
|
if (language === "import") {
|
|
270
274
|
return "";
|
|
271
275
|
}
|
|
276
|
+
const nameTag = tags.find((it) => it.startsWith("name="));
|
|
277
|
+
const name = nameTag ? slugify(nameTag.slice("name=".length)) : undefined;
|
|
272
278
|
collected.push({
|
|
279
|
+
name,
|
|
273
280
|
content,
|
|
274
281
|
language,
|
|
275
282
|
tags
|
|
@@ -336,7 +343,7 @@ function extractExamplesProcessor(options) {
|
|
|
336
343
|
for (const example of examples) {
|
|
337
344
|
const suffix = getSuffix(example.tags);
|
|
338
345
|
const extension = getExtension(example.language);
|
|
339
|
-
const filename = `example-${String(n++)}${suffix}.${extension}`;
|
|
346
|
+
const filename = `example-${example.name ?? String(n++)}${suffix}.${extension}`;
|
|
340
347
|
const filePath = path.join(dir, filename);
|
|
341
348
|
await fs.writeFile(filePath, example.content, "utf-8");
|
|
342
349
|
total++;
|
|
@@ -357,7 +364,12 @@ md$1.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
|
357
364
|
if (language === "import") {
|
|
358
365
|
extension = content.split(".").at(-1)?.trim();
|
|
359
366
|
}
|
|
367
|
+
if (createMarkdownRenderer.hasTag(tags, "hidden")) {
|
|
368
|
+
return "";
|
|
369
|
+
}
|
|
370
|
+
const name = createMarkdownRenderer.findTag(tags, "name")?.value ?? undefined;
|
|
360
371
|
collected.push({
|
|
372
|
+
name,
|
|
361
373
|
selector: `#example-${fingerprint}`,
|
|
362
374
|
language: extension ?? language,
|
|
363
375
|
tags
|
|
@@ -872,6 +884,79 @@ function defineSources(sources) {
|
|
|
872
884
|
return sources;
|
|
873
885
|
}
|
|
874
886
|
|
|
887
|
+
const documentAttributeKeys = [
|
|
888
|
+
"title",
|
|
889
|
+
"short-title",
|
|
890
|
+
"layout",
|
|
891
|
+
"name",
|
|
892
|
+
"alias",
|
|
893
|
+
"status",
|
|
894
|
+
"visible",
|
|
895
|
+
"include",
|
|
896
|
+
"component",
|
|
897
|
+
"href",
|
|
898
|
+
"sortorder",
|
|
899
|
+
"redirect_from"
|
|
900
|
+
];
|
|
901
|
+
|
|
902
|
+
const threshold = 3;
|
|
903
|
+
const suggestions = {
|
|
904
|
+
hidden: "visible"
|
|
905
|
+
};
|
|
906
|
+
function findLocation(content, attr) {
|
|
907
|
+
const match = content.match(/^---\n(.*?)^---/ms);
|
|
908
|
+
if (!match || match.index !== 0) {
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
const yaml = match[1];
|
|
912
|
+
const lines = yaml.split("\n");
|
|
913
|
+
const index = lines.findIndex((it) => it.startsWith(`${attr}:`));
|
|
914
|
+
if (index < 0) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
const blockBegin = 2;
|
|
918
|
+
return {
|
|
919
|
+
start: { line: index + blockBegin, column: 1 },
|
|
920
|
+
end: { line: index + blockBegin, column: 1 + attr.length }
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function getSuggestion(attribute) {
|
|
924
|
+
const manual = suggestions[attribute];
|
|
925
|
+
if (manual) {
|
|
926
|
+
return [manual, 0];
|
|
927
|
+
}
|
|
928
|
+
const closestKey = vendor.closest(attribute, documentAttributeKeys);
|
|
929
|
+
const d = vendor.distance(attribute, closestKey);
|
|
930
|
+
return [closestKey, d];
|
|
931
|
+
}
|
|
932
|
+
class AttributeError extends Error {
|
|
933
|
+
attribute;
|
|
934
|
+
content;
|
|
935
|
+
constructor(options) {
|
|
936
|
+
const { attribute, filePath, content } = options;
|
|
937
|
+
super(`Unknown attribute "${attribute}" in "${filePath}"`);
|
|
938
|
+
this.name = "AttributeError";
|
|
939
|
+
this.attribute = attribute;
|
|
940
|
+
this.content = content;
|
|
941
|
+
}
|
|
942
|
+
prettyError() {
|
|
943
|
+
const { attribute, content, message } = this;
|
|
944
|
+
const [closestMatch, d] = getSuggestion(attribute);
|
|
945
|
+
const suggestion = d <= threshold ? `Did you mean to use "${closestMatch}"?` : `Unknown attribute "${attribute}"`;
|
|
946
|
+
const location = findLocation(content, attribute);
|
|
947
|
+
if (location) {
|
|
948
|
+
const codeframe = codeFrame.codeFrameColumns(content, location, {
|
|
949
|
+
message: suggestion
|
|
950
|
+
});
|
|
951
|
+
return [message, "", codeframe].join("\n");
|
|
952
|
+
} else if (d <= threshold) {
|
|
953
|
+
return [message, "", suggestion].join("\n");
|
|
954
|
+
} else {
|
|
955
|
+
return message;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
875
960
|
function toArray$1(value) {
|
|
876
961
|
return Array.isArray(value) ? value : [value];
|
|
877
962
|
}
|
|
@@ -906,26 +991,44 @@ function getBadge(attrs) {
|
|
|
906
991
|
return "info";
|
|
907
992
|
}
|
|
908
993
|
}
|
|
909
|
-
function
|
|
910
|
-
|
|
911
|
-
|
|
994
|
+
function validateAttributes(attributes, filePath, content) {
|
|
995
|
+
for (const key of Object.keys(attributes)) {
|
|
996
|
+
if (documentAttributeKeys.includes(key)) {
|
|
997
|
+
continue;
|
|
998
|
+
}
|
|
999
|
+
throw new AttributeError({
|
|
1000
|
+
attribute: key,
|
|
1001
|
+
filePath,
|
|
1002
|
+
content
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
function normalizeComponent(value) {
|
|
1007
|
+
if (typeof value === "string") {
|
|
1008
|
+
return {
|
|
1009
|
+
name: value
|
|
1010
|
+
};
|
|
912
1011
|
} else {
|
|
913
|
-
return
|
|
1012
|
+
return value;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
function getComponentAlias(value) {
|
|
1016
|
+
const { name } = normalizeComponent(value);
|
|
1017
|
+
return `component:${name}`;
|
|
1018
|
+
}
|
|
1019
|
+
function* getDocumentAlias(attrs) {
|
|
1020
|
+
if (attrs.alias) {
|
|
1021
|
+
yield* toArray$1(attrs.alias);
|
|
1022
|
+
}
|
|
1023
|
+
if (attrs.component) {
|
|
1024
|
+
yield* toArray$1(attrs.component).map(getComponentAlias);
|
|
914
1025
|
}
|
|
915
1026
|
}
|
|
916
1027
|
function getComponent(attrs) {
|
|
917
1028
|
if (!attrs.component) {
|
|
918
1029
|
return undefined;
|
|
919
1030
|
}
|
|
920
|
-
return toArray$1(attrs.component).map(
|
|
921
|
-
if (typeof it === "string") {
|
|
922
|
-
return {
|
|
923
|
-
name: it
|
|
924
|
-
};
|
|
925
|
-
} else {
|
|
926
|
-
return it;
|
|
927
|
-
}
|
|
928
|
-
});
|
|
1031
|
+
return toArray$1(attrs.component).map(normalizeComponent);
|
|
929
1032
|
}
|
|
930
1033
|
function parseFile$1(filePath, basePath, content) {
|
|
931
1034
|
const relative = basePath ? path$1.relative(basePath, createMarkdownRenderer.normalizePath(filePath)) : createMarkdownRenderer.normalizePath(filePath);
|
|
@@ -938,10 +1041,11 @@ function parseFile$1(filePath, basePath, content) {
|
|
|
938
1041
|
const urlpath = parsed.dir;
|
|
939
1042
|
const outline = getDocumentOutline(blocks.body);
|
|
940
1043
|
const include = attributes.include ?? true;
|
|
1044
|
+
validateAttributes(attributes, filePath, content);
|
|
941
1045
|
return {
|
|
942
1046
|
id: `fs:${filePath.replace(/\\/g, "/")}`,
|
|
943
1047
|
name,
|
|
944
|
-
alias:
|
|
1048
|
+
alias: Array.from(getDocumentAlias(attributes)),
|
|
945
1049
|
visible: attributes.visible ?? true,
|
|
946
1050
|
attributes: {
|
|
947
1051
|
title: attributes.title ?? name,
|
|
@@ -974,6 +1078,36 @@ async function frontMatterFileReader(filePath, basePath) {
|
|
|
974
1078
|
|
|
975
1079
|
const EMPTY_CHAR = "‐";
|
|
976
1080
|
const EM_DASH = "—";
|
|
1081
|
+
function getPropSlotDeprecated(prop) {
|
|
1082
|
+
const tags = prop.tags;
|
|
1083
|
+
if (!tags) {
|
|
1084
|
+
return EMPTY_CHAR;
|
|
1085
|
+
}
|
|
1086
|
+
const tag = tags["deprecated"]?.[0];
|
|
1087
|
+
if (!tag?.description) {
|
|
1088
|
+
return EMPTY_CHAR;
|
|
1089
|
+
}
|
|
1090
|
+
if (tag.description === true) {
|
|
1091
|
+
return "true";
|
|
1092
|
+
} else {
|
|
1093
|
+
return tag.description;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
function getEventDeprecated(event) {
|
|
1097
|
+
const tags = event.tags;
|
|
1098
|
+
if (!tags) {
|
|
1099
|
+
return EMPTY_CHAR;
|
|
1100
|
+
}
|
|
1101
|
+
const tag = tags.find((it) => it.title === "deprecated");
|
|
1102
|
+
if (!tag?.content) {
|
|
1103
|
+
return EMPTY_CHAR;
|
|
1104
|
+
}
|
|
1105
|
+
if (tag.content === true) {
|
|
1106
|
+
return "true";
|
|
1107
|
+
} else {
|
|
1108
|
+
return tag.content;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
977
1111
|
function translateProps(props) {
|
|
978
1112
|
const translatedProps = [];
|
|
979
1113
|
for (const prop of props) {
|
|
@@ -982,7 +1116,8 @@ function translateProps(props) {
|
|
|
982
1116
|
description: prop.description ?? EMPTY_CHAR,
|
|
983
1117
|
type: prop.type?.name ?? EMPTY_CHAR,
|
|
984
1118
|
required: prop.required ? "true" : "false",
|
|
985
|
-
default: prop.defaultValue?.value ?? EMPTY_CHAR
|
|
1119
|
+
default: prop.defaultValue?.value ?? EMPTY_CHAR,
|
|
1120
|
+
deprecated: getPropSlotDeprecated(prop)
|
|
986
1121
|
};
|
|
987
1122
|
translatedProps.push(translatedProp);
|
|
988
1123
|
}
|
|
@@ -994,7 +1129,8 @@ function translateEvents(events) {
|
|
|
994
1129
|
const translatedEvent = {
|
|
995
1130
|
name: event.name,
|
|
996
1131
|
description: event.description ?? EMPTY_CHAR,
|
|
997
|
-
properties: translateEventProperties(event)
|
|
1132
|
+
properties: translateEventProperties(event),
|
|
1133
|
+
deprecated: getEventDeprecated(event)
|
|
998
1134
|
};
|
|
999
1135
|
translatedEvents.push(translatedEvent);
|
|
1000
1136
|
}
|
|
@@ -1028,7 +1164,8 @@ function translateSlots(slots) {
|
|
|
1028
1164
|
const translatedSlot = {
|
|
1029
1165
|
name: slot.name,
|
|
1030
1166
|
description: slot.description ?? EMPTY_CHAR,
|
|
1031
|
-
bindings: translateSlotBindings(slot)
|
|
1167
|
+
bindings: translateSlotBindings(slot),
|
|
1168
|
+
deprecated: getPropSlotDeprecated(slot)
|
|
1032
1169
|
};
|
|
1033
1170
|
translatedSlots.push(translatedSlot);
|
|
1034
1171
|
}
|
|
@@ -1040,7 +1177,10 @@ function translateSlotBindings(slot) {
|
|
|
1040
1177
|
}
|
|
1041
1178
|
const translatedBindings = [];
|
|
1042
1179
|
for (const binding of slot.bindings) {
|
|
1043
|
-
|
|
1180
|
+
const name = binding.name ?? EMPTY_CHAR;
|
|
1181
|
+
const type = binding.type ? `: ${binding.type.name}` : "";
|
|
1182
|
+
const description = binding.description ? ` ${EM_DASH} ${binding.description}` : "";
|
|
1183
|
+
translatedBindings.push(`${name}${type}${description}`);
|
|
1044
1184
|
}
|
|
1045
1185
|
return translatedBindings.join("\n");
|
|
1046
1186
|
}
|
|
@@ -1814,6 +1954,31 @@ function findTemplate(folders, from, src, format) {
|
|
|
1814
1954
|
return template;
|
|
1815
1955
|
}
|
|
1816
1956
|
|
|
1957
|
+
const messageRegex = /^[(][^)]+[)] \[Line \d+, Column \d+\]\n\s+Error: (.*)$/;
|
|
1958
|
+
function getActualMessage(message) {
|
|
1959
|
+
const match = message.match(messageRegex);
|
|
1960
|
+
if (match) {
|
|
1961
|
+
return match[1].trim();
|
|
1962
|
+
} else {
|
|
1963
|
+
return message;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
class TemplateRenderError extends Error {
|
|
1967
|
+
filename;
|
|
1968
|
+
constructor(message, filename) {
|
|
1969
|
+
super(getActualMessage(message));
|
|
1970
|
+
this.name = "RenderError";
|
|
1971
|
+
this.filename = filename;
|
|
1972
|
+
}
|
|
1973
|
+
prettyError() {
|
|
1974
|
+
return [
|
|
1975
|
+
`An error occured when rendering a document.`,
|
|
1976
|
+
` Document: "${this.filename}".`,
|
|
1977
|
+
` Message: ${this.message}`
|
|
1978
|
+
].join("\n");
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1817
1982
|
const scriptPath = path$1.join(__dirname, "compile-example.js");
|
|
1818
1983
|
let loader = null;
|
|
1819
1984
|
function haveOutputFile(fileInfo) {
|
|
@@ -2016,7 +2181,11 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
2016
2181
|
try {
|
|
2017
2182
|
content = await renderTemplate(template, templateData);
|
|
2018
2183
|
} catch (err) {
|
|
2019
|
-
const
|
|
2184
|
+
const filename = fileInfo.fullPath;
|
|
2185
|
+
if (err instanceof Error && err.name === "Template render error") {
|
|
2186
|
+
throw new TemplateRenderError(err.message, filename);
|
|
2187
|
+
}
|
|
2188
|
+
const prefix = `Failed to render "${filename}"`;
|
|
2020
2189
|
const message = err instanceof Error ? err.message : String(err);
|
|
2021
2190
|
throw new Error(`${prefix}: ${message}`, { cause: err });
|
|
2022
2191
|
}
|
package/dist/markdown.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createMarkdownRenderer = require('./create-markdown-renderer-
|
|
4
|
-
require('./vendor-
|
|
3
|
+
var createMarkdownRenderer = require('./create-markdown-renderer-D_yU9x5w.js');
|
|
4
|
+
require('./vendor-BeoVq2Sv.js');
|
|
5
5
|
require('node:url');
|
|
6
6
|
require('node:path');
|
|
7
7
|
require('fs');
|
|
@@ -37,7 +37,7 @@ require('querystring');
|
|
|
37
37
|
require('node:path/posix');
|
|
38
38
|
require('node:crypto');
|
|
39
39
|
require('vue');
|
|
40
|
-
require('./vue3-
|
|
40
|
+
require('./vue3-B1yNeGmz.js');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -334,6 +334,17 @@ var require_semver = __commonJS({
|
|
|
334
334
|
// preminor will bump the version up to the next minor release, and immediately
|
|
335
335
|
// down to pre-release. premajor and prepatch work the same way.
|
|
336
336
|
inc(release, identifier, identifierBase) {
|
|
337
|
+
if (release.startsWith("pre")) {
|
|
338
|
+
if (!identifier && identifierBase === false) {
|
|
339
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
340
|
+
}
|
|
341
|
+
if (identifier) {
|
|
342
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
343
|
+
if (!match || match[1] !== identifier) {
|
|
344
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
337
348
|
switch (release) {
|
|
338
349
|
case "premajor":
|
|
339
350
|
this.prerelease.length = 0;
|
|
@@ -361,6 +372,12 @@ var require_semver = __commonJS({
|
|
|
361
372
|
}
|
|
362
373
|
this.inc("pre", identifier, identifierBase);
|
|
363
374
|
break;
|
|
375
|
+
case "release":
|
|
376
|
+
if (this.prerelease.length === 0) {
|
|
377
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
378
|
+
}
|
|
379
|
+
this.prerelease.length = 0;
|
|
380
|
+
break;
|
|
364
381
|
case "major":
|
|
365
382
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
366
383
|
this.major++;
|
|
@@ -386,9 +403,6 @@ var require_semver = __commonJS({
|
|
|
386
403
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
387
404
|
case "pre": {
|
|
388
405
|
const base = Number(identifierBase) ? 1 : 0;
|
|
389
|
-
if (!identifier && identifierBase === false) {
|
|
390
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
391
|
-
}
|
|
392
406
|
if (this.prerelease.length === 0) {
|
|
393
407
|
this.prerelease = [base];
|
|
394
408
|
} else {
|
|
@@ -523,13 +537,12 @@ var require_diff = __commonJS({
|
|
|
523
537
|
if (!lowVersion.patch && !lowVersion.minor) {
|
|
524
538
|
return "major";
|
|
525
539
|
}
|
|
526
|
-
if (highVersion
|
|
540
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
541
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
542
|
+
return "minor";
|
|
543
|
+
}
|
|
527
544
|
return "patch";
|
|
528
545
|
}
|
|
529
|
-
if (highVersion.minor) {
|
|
530
|
-
return "minor";
|
|
531
|
-
}
|
|
532
|
-
return "major";
|
|
533
546
|
}
|
|
534
547
|
const prefix = highHasPre ? "pre" : "";
|
|
535
548
|
if (v1.major !== v2.major) {
|