@forsakringskassan/docs-generator 3.0.0 → 3.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/{create-markdown-renderer-CoqQjBrC.mjs → create-markdown-renderer-C-rQVf_R.mjs} +4 -4
- package/dist/{create-markdown-renderer-CoqQjBrC.mjs.map → create-markdown-renderer-C-rQVf_R.mjs.map} +1 -1
- package/dist/{format-code.worker-CE6SMet0.mjs → format-code.worker-BwtL4Ldq.mjs} +2 -2
- package/dist/{format-code.worker-CE6SMet0.mjs.map → format-code.worker-BwtL4Ldq.mjs.map} +1 -1
- package/dist/index.mjs +190 -178
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.mjs +2 -2
- package/dist/runtime.mjs +734 -516
- package/dist/{vendor-B7bJ2okl.mjs → vendor-CyiP4ufo.mjs} +10 -5
- package/dist/{vendor-B7bJ2okl.mjs.map → vendor-CyiP4ufo.mjs.map} +1 -1
- package/package.json +1 -1
|
@@ -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 {
|
|
5
|
+
import { o as runAsWorker, j as format2, r as resolveConfig } from './vendor-CyiP4ufo.mjs';
|
|
6
6
|
import 'node:url';
|
|
7
7
|
import 'node:path';
|
|
8
8
|
import 'fs';
|
|
@@ -54,4 +54,4 @@ async function formatCode(source, filepath) {
|
|
|
54
54
|
runAsWorker(formatCode);
|
|
55
55
|
|
|
56
56
|
export { formatCode };
|
|
57
|
-
//# sourceMappingURL=format-code.worker-
|
|
57
|
+
//# sourceMappingURL=format-code.worker-BwtL4Ldq.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-code.worker-
|
|
1
|
+
{"version":3,"file":"format-code.worker-BwtL4Ldq.mjs","sources":["../src/utils/format-code.worker.ts"],"sourcesContent":["import { type Options, format as prettier, resolveConfig } from \"prettier\";\nimport { runAsWorker } from \"synckit\";\n\nconst configCache = new Map<string, Options | null>();\n\nasync function getConfig(filepath: string): Promise<Options | null> {\n const cached = configCache.get(filepath);\n if (cached !== undefined) {\n return cached;\n }\n const options = await resolveConfig(filepath);\n configCache.set(filepath, options);\n return options;\n}\n\n/**\n * @internal\n */\nexport async function formatCode(\n source: string,\n filepath: string,\n): Promise<string> {\n const options = await getConfig(filepath);\n const formatted = await prettier(source, { ...options, filepath });\n return formatted.trim();\n}\n\nrunAsWorker(formatCode);\n"],"names":["prettier"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAA,uBAAkB,GAAA,EAA4B;AAEpD,eAAe,UAAU,QAAA,EAA2C;AAChE,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,GAAA,CAAI,QAAQ,CAAA;AACvC,EAAA,IAAI,WAAW,MAAA,EAAW;AACtB,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,QAAQ,CAAA;AAC5C,EAAA,WAAA,CAAY,GAAA,CAAI,UAAU,OAAO,CAAA;AACjC,EAAA,OAAO,OAAA;AACX;AAKA,eAAsB,UAAA,CAClB,QACA,QAAA,EACe;AACf,EAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,QAAQ,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,MAAMA,OAAA,CAAS,MAAA,EAAQ,EAAE,GAAG,OAAA,EAAS,UAAU,CAAA;AACjE,EAAA,OAAO,UAAU,IAAA,EAAK;AAC1B;AAEA,WAAA,CAAY,UAAU,CAAA;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import { createRequire as $createRequire } from "node:module";
|
|
|
3
3
|
const require = $createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
import { ApiItemKind, ApiModel } from '@microsoft/api-extractor-model';
|
|
6
|
-
import {
|
|
6
|
+
import { p as ts, Z as Ze, M as MarkdownIt, f as dedent, a as closest, h as distance, i as fm, m as isCI, n as moduleImporter, c as cliProgress, t as tinylr, w as watch, b as createInstance, k as fse, l as inter } from './vendor-CyiP4ufo.mjs';
|
|
7
7
|
import path__default from 'node:path';
|
|
8
8
|
import crypto from 'node:crypto';
|
|
9
9
|
import path from 'node:path/posix';
|
|
10
10
|
import { exec, execSync } from 'node:child_process';
|
|
11
|
-
import {
|
|
11
|
+
import { d as generateId, b as formatCode, p as parseInfostring, k as isDocumentPage, n as normalizePath, e as getFingerprint, i as hasTag, a as findTag, h as getOutputFilePath, j as htmlencode, f as filePath, c as createMarkdownRenderer, g as generateExample } from './create-markdown-renderer-C-rQVf_R.mjs';
|
|
12
12
|
import { DocExcerpt } from '@microsoft/tsdoc';
|
|
13
13
|
import fs from 'node:fs/promises';
|
|
14
14
|
import util, { promisify } from 'node:util';
|
|
@@ -1036,23 +1036,198 @@ function selectableVersionProcessor(pkg, container, options) {
|
|
|
1036
1036
|
};
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
|
-
function
|
|
1040
|
-
|
|
1041
|
-
|
|
1039
|
+
function isNavigationSection(node) {
|
|
1040
|
+
return "key" in node;
|
|
1041
|
+
}
|
|
1042
|
+
function pathFromDoc({ fileInfo }) {
|
|
1043
|
+
if (fileInfo.name === "index") {
|
|
1044
|
+
return [fileInfo.path.replaceAll("\\", "/"), true];
|
|
1045
|
+
} else {
|
|
1046
|
+
return [
|
|
1047
|
+
`./${path__default.join(fileInfo.path, fileInfo.name).replaceAll("\\", "/")}`,
|
|
1048
|
+
false
|
|
1049
|
+
];
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
function getParentKey(name) {
|
|
1053
|
+
return name.split("/").slice(0, -1).join("/");
|
|
1054
|
+
}
|
|
1055
|
+
function generateNavtree(docs) {
|
|
1056
|
+
const section = {};
|
|
1057
|
+
function createSection(key, title, sortorder, { visible } = {}) {
|
|
1058
|
+
const existing = section[key];
|
|
1059
|
+
if (existing) {
|
|
1060
|
+
existing.title = title;
|
|
1061
|
+
existing.sortorder = sortorder;
|
|
1062
|
+
existing.visible = visible ?? true;
|
|
1063
|
+
} else {
|
|
1064
|
+
const node = {
|
|
1065
|
+
key,
|
|
1066
|
+
title,
|
|
1067
|
+
path: "",
|
|
1068
|
+
sortorder,
|
|
1069
|
+
children: [],
|
|
1070
|
+
visible: visible ?? true
|
|
1071
|
+
};
|
|
1072
|
+
section[key] = node;
|
|
1073
|
+
if (key !== ".") {
|
|
1074
|
+
const parent = attach(key);
|
|
1075
|
+
parent.children.push(node);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
function attach(key) {
|
|
1080
|
+
const parentKey = getParentKey(key);
|
|
1081
|
+
let parent = section[parentKey];
|
|
1082
|
+
if (parent) {
|
|
1083
|
+
return parent;
|
|
1084
|
+
}
|
|
1085
|
+
parent = {
|
|
1086
|
+
key: parentKey,
|
|
1087
|
+
title: parentKey.split("/").at(-1) ?? "(missing title)",
|
|
1088
|
+
path: "",
|
|
1089
|
+
sortorder: Infinity,
|
|
1090
|
+
children: [],
|
|
1091
|
+
visible: true
|
|
1092
|
+
};
|
|
1093
|
+
section[parentKey] = parent;
|
|
1094
|
+
let anchestor = parentKey;
|
|
1095
|
+
let current = parent;
|
|
1096
|
+
while (anchestor !== ".") {
|
|
1097
|
+
anchestor = getParentKey(anchestor);
|
|
1098
|
+
if (section[anchestor]) {
|
|
1099
|
+
section[anchestor].children.push(current);
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
const node = {
|
|
1103
|
+
key: anchestor,
|
|
1104
|
+
title: "",
|
|
1105
|
+
path: "",
|
|
1106
|
+
sortorder: Infinity,
|
|
1107
|
+
children: [current],
|
|
1108
|
+
visible: true
|
|
1109
|
+
};
|
|
1110
|
+
section[anchestor] = node;
|
|
1111
|
+
current = node;
|
|
1112
|
+
}
|
|
1113
|
+
return parent;
|
|
1114
|
+
}
|
|
1115
|
+
for (const doc of docs) {
|
|
1116
|
+
if (doc.format === "redirect") {
|
|
1117
|
+
continue;
|
|
1118
|
+
}
|
|
1119
|
+
const [name, isSection] = pathFromDoc(doc);
|
|
1120
|
+
const title = doc.attributes.shortTitle ?? doc.attributes.title ?? doc.fileInfo.name;
|
|
1121
|
+
const sortorder = doc.attributes.sortorder;
|
|
1122
|
+
if (doc.attributes.href) {
|
|
1123
|
+
const parent2 = attach(name);
|
|
1124
|
+
const leafNode = {
|
|
1125
|
+
id: doc.id,
|
|
1126
|
+
title,
|
|
1127
|
+
path: doc.attributes.href,
|
|
1128
|
+
sortorder,
|
|
1129
|
+
external: true
|
|
1130
|
+
};
|
|
1131
|
+
parent2.children.push(leafNode);
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
if (!doc.fileInfo.outputName) {
|
|
1135
|
+
if (isSection) {
|
|
1136
|
+
createSection(name, title, sortorder);
|
|
1137
|
+
}
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
if (!doc.visible) {
|
|
1141
|
+
if (isSection) {
|
|
1142
|
+
createSection(name, title, sortorder, { visible: false });
|
|
1143
|
+
}
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
if (name === ".") {
|
|
1147
|
+
createSection(name, title, sortorder);
|
|
1148
|
+
continue;
|
|
1149
|
+
}
|
|
1150
|
+
const parent = attach(name);
|
|
1151
|
+
if (isSection) {
|
|
1152
|
+
const leafNode = {
|
|
1153
|
+
id: doc.id,
|
|
1154
|
+
title,
|
|
1155
|
+
path: `${name}/`,
|
|
1156
|
+
sortorder,
|
|
1157
|
+
external: false
|
|
1158
|
+
};
|
|
1159
|
+
const existing = section[name];
|
|
1160
|
+
if (existing) {
|
|
1161
|
+
existing.title = title;
|
|
1162
|
+
existing.path = leafNode.path;
|
|
1163
|
+
existing.sortorder = sortorder;
|
|
1164
|
+
existing.children.unshift(leafNode);
|
|
1165
|
+
existing.visible = true;
|
|
1166
|
+
} else {
|
|
1167
|
+
const sectionNode = {
|
|
1168
|
+
key: name,
|
|
1169
|
+
title,
|
|
1170
|
+
path: leafNode.path,
|
|
1171
|
+
sortorder,
|
|
1172
|
+
children: [leafNode],
|
|
1173
|
+
visible: true
|
|
1174
|
+
};
|
|
1175
|
+
section[name] = sectionNode;
|
|
1176
|
+
parent.children.push(sectionNode);
|
|
1177
|
+
}
|
|
1178
|
+
} else {
|
|
1179
|
+
const leafNode = {
|
|
1180
|
+
id: doc.id,
|
|
1181
|
+
title,
|
|
1182
|
+
path: `${doc.fileInfo.path}/${doc.fileInfo.outputName}`,
|
|
1183
|
+
sortorder,
|
|
1184
|
+
external: false
|
|
1185
|
+
};
|
|
1186
|
+
parent.children.push(leafNode);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
const root = section["."];
|
|
1190
|
+
if (root) {
|
|
1191
|
+
return root;
|
|
1192
|
+
} else {
|
|
1042
1193
|
return {
|
|
1043
|
-
key,
|
|
1044
|
-
|
|
1194
|
+
key: ".",
|
|
1195
|
+
title: "",
|
|
1196
|
+
path: "",
|
|
1197
|
+
sortorder: Infinity,
|
|
1045
1198
|
children: [],
|
|
1046
|
-
visible: true
|
|
1047
|
-
...it
|
|
1199
|
+
visible: true
|
|
1048
1200
|
};
|
|
1049
|
-
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
function generateNavigation(entries, navtree) {
|
|
1050
1205
|
return {
|
|
1051
1206
|
key: ".",
|
|
1052
1207
|
path: "./index.html",
|
|
1053
1208
|
sortorder: Infinity,
|
|
1054
|
-
|
|
1055
|
-
|
|
1209
|
+
visible: true,
|
|
1210
|
+
children: entries.map((entry, index) => {
|
|
1211
|
+
const navtreeItem = navtree.children.find(
|
|
1212
|
+
(item) => item.title === entry.title
|
|
1213
|
+
);
|
|
1214
|
+
if (navtreeItem) {
|
|
1215
|
+
return {
|
|
1216
|
+
...navtreeItem,
|
|
1217
|
+
path: entry.path,
|
|
1218
|
+
sortorder: entry.sortorder ?? index,
|
|
1219
|
+
visible: true
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
const key = path.parse(entry.path).name;
|
|
1223
|
+
return {
|
|
1224
|
+
key,
|
|
1225
|
+
sortorder: index,
|
|
1226
|
+
children: [],
|
|
1227
|
+
visible: true,
|
|
1228
|
+
...entry
|
|
1229
|
+
};
|
|
1230
|
+
}).toSorted((a, b) => a.sortorder - b.sortorder)
|
|
1056
1231
|
};
|
|
1057
1232
|
}
|
|
1058
1233
|
function topnavProcessor(filename, title) {
|
|
@@ -1062,7 +1237,9 @@ function topnavProcessor(filename, title) {
|
|
|
1062
1237
|
async handler(context) {
|
|
1063
1238
|
const content = await fs.readFile(filename, "utf8");
|
|
1064
1239
|
const parsed = JSON.parse(content);
|
|
1065
|
-
const
|
|
1240
|
+
const pages = context.docs.filter(isDocumentPage);
|
|
1241
|
+
const navtree = generateNavtree(pages);
|
|
1242
|
+
const rootNode = generateNavigation(parsed, navtree);
|
|
1066
1243
|
context.setTopNavigation({
|
|
1067
1244
|
title,
|
|
1068
1245
|
...rootNode
|
|
@@ -2489,171 +2666,6 @@ var langSv = {
|
|
|
2489
2666
|
translation: translation
|
|
2490
2667
|
};
|
|
2491
2668
|
|
|
2492
|
-
function isNavigationSection(node) {
|
|
2493
|
-
return "key" in node;
|
|
2494
|
-
}
|
|
2495
|
-
function pathFromDoc({ fileInfo }) {
|
|
2496
|
-
if (fileInfo.name === "index") {
|
|
2497
|
-
return [fileInfo.path.replaceAll("\\", "/"), true];
|
|
2498
|
-
} else {
|
|
2499
|
-
return [
|
|
2500
|
-
`./${path__default.join(fileInfo.path, fileInfo.name).replaceAll("\\", "/")}`,
|
|
2501
|
-
false
|
|
2502
|
-
];
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
function getParentKey(name) {
|
|
2506
|
-
return name.split("/").slice(0, -1).join("/");
|
|
2507
|
-
}
|
|
2508
|
-
function generateNavtree(docs) {
|
|
2509
|
-
const section = {};
|
|
2510
|
-
function createSection(key, title, sortorder, { visible } = {}) {
|
|
2511
|
-
const existing = section[key];
|
|
2512
|
-
if (existing) {
|
|
2513
|
-
existing.title = title;
|
|
2514
|
-
existing.sortorder = sortorder;
|
|
2515
|
-
existing.visible = visible ?? true;
|
|
2516
|
-
} else {
|
|
2517
|
-
const node = {
|
|
2518
|
-
key,
|
|
2519
|
-
title,
|
|
2520
|
-
path: "",
|
|
2521
|
-
sortorder,
|
|
2522
|
-
children: [],
|
|
2523
|
-
visible: visible ?? true
|
|
2524
|
-
};
|
|
2525
|
-
section[key] = node;
|
|
2526
|
-
if (key !== ".") {
|
|
2527
|
-
const parent = attach(key);
|
|
2528
|
-
parent.children.push(node);
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
function attach(key) {
|
|
2533
|
-
const parentKey = getParentKey(key);
|
|
2534
|
-
let parent = section[parentKey];
|
|
2535
|
-
if (parent) {
|
|
2536
|
-
return parent;
|
|
2537
|
-
}
|
|
2538
|
-
parent = {
|
|
2539
|
-
key: parentKey,
|
|
2540
|
-
title: parentKey.split("/").at(-1) ?? "(missing title)",
|
|
2541
|
-
path: "",
|
|
2542
|
-
sortorder: Infinity,
|
|
2543
|
-
children: [],
|
|
2544
|
-
visible: true
|
|
2545
|
-
};
|
|
2546
|
-
section[parentKey] = parent;
|
|
2547
|
-
let anchestor = parentKey;
|
|
2548
|
-
let current = parent;
|
|
2549
|
-
while (anchestor !== ".") {
|
|
2550
|
-
anchestor = getParentKey(anchestor);
|
|
2551
|
-
if (section[anchestor]) {
|
|
2552
|
-
section[anchestor].children.push(current);
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
const node = {
|
|
2556
|
-
key: anchestor,
|
|
2557
|
-
title: "",
|
|
2558
|
-
path: "",
|
|
2559
|
-
sortorder: Infinity,
|
|
2560
|
-
children: [current],
|
|
2561
|
-
visible: true
|
|
2562
|
-
};
|
|
2563
|
-
section[anchestor] = node;
|
|
2564
|
-
current = node;
|
|
2565
|
-
}
|
|
2566
|
-
return parent;
|
|
2567
|
-
}
|
|
2568
|
-
for (const doc of docs) {
|
|
2569
|
-
if (doc.format === "redirect") {
|
|
2570
|
-
continue;
|
|
2571
|
-
}
|
|
2572
|
-
const [name, isSection] = pathFromDoc(doc);
|
|
2573
|
-
const title = doc.attributes.shortTitle ?? doc.attributes.title ?? doc.fileInfo.name;
|
|
2574
|
-
const sortorder = doc.attributes.sortorder;
|
|
2575
|
-
if (doc.attributes.href) {
|
|
2576
|
-
const parent2 = attach(name);
|
|
2577
|
-
const leafNode = {
|
|
2578
|
-
id: doc.id,
|
|
2579
|
-
title,
|
|
2580
|
-
path: doc.attributes.href,
|
|
2581
|
-
sortorder,
|
|
2582
|
-
external: true
|
|
2583
|
-
};
|
|
2584
|
-
parent2.children.push(leafNode);
|
|
2585
|
-
continue;
|
|
2586
|
-
}
|
|
2587
|
-
if (!doc.fileInfo.outputName) {
|
|
2588
|
-
if (isSection) {
|
|
2589
|
-
createSection(name, title, sortorder);
|
|
2590
|
-
}
|
|
2591
|
-
continue;
|
|
2592
|
-
}
|
|
2593
|
-
if (!doc.visible) {
|
|
2594
|
-
if (isSection) {
|
|
2595
|
-
createSection(name, title, sortorder, { visible: false });
|
|
2596
|
-
}
|
|
2597
|
-
continue;
|
|
2598
|
-
}
|
|
2599
|
-
if (name === ".") {
|
|
2600
|
-
createSection(name, title, sortorder);
|
|
2601
|
-
continue;
|
|
2602
|
-
}
|
|
2603
|
-
const parent = attach(name);
|
|
2604
|
-
if (isSection) {
|
|
2605
|
-
const leafNode = {
|
|
2606
|
-
id: doc.id,
|
|
2607
|
-
title,
|
|
2608
|
-
path: `${name}/`,
|
|
2609
|
-
sortorder,
|
|
2610
|
-
external: false
|
|
2611
|
-
};
|
|
2612
|
-
const existing = section[name];
|
|
2613
|
-
if (existing) {
|
|
2614
|
-
existing.title = title;
|
|
2615
|
-
existing.path = leafNode.path;
|
|
2616
|
-
existing.sortorder = sortorder;
|
|
2617
|
-
existing.children.unshift(leafNode);
|
|
2618
|
-
existing.visible = true;
|
|
2619
|
-
} else {
|
|
2620
|
-
const sectionNode = {
|
|
2621
|
-
key: name,
|
|
2622
|
-
title,
|
|
2623
|
-
path: leafNode.path,
|
|
2624
|
-
sortorder,
|
|
2625
|
-
children: [leafNode],
|
|
2626
|
-
visible: true
|
|
2627
|
-
};
|
|
2628
|
-
section[name] = sectionNode;
|
|
2629
|
-
parent.children.push(sectionNode);
|
|
2630
|
-
}
|
|
2631
|
-
} else {
|
|
2632
|
-
const leafNode = {
|
|
2633
|
-
id: doc.id,
|
|
2634
|
-
title,
|
|
2635
|
-
path: `${doc.fileInfo.path}/${doc.fileInfo.outputName}`,
|
|
2636
|
-
sortorder,
|
|
2637
|
-
external: false
|
|
2638
|
-
};
|
|
2639
|
-
parent.children.push(leafNode);
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
const root = section["."];
|
|
2643
|
-
if (root) {
|
|
2644
|
-
return root;
|
|
2645
|
-
} else {
|
|
2646
|
-
return {
|
|
2647
|
-
key: ".",
|
|
2648
|
-
title: "",
|
|
2649
|
-
path: "",
|
|
2650
|
-
sortorder: Infinity,
|
|
2651
|
-
children: [],
|
|
2652
|
-
visible: true
|
|
2653
|
-
};
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
2669
|
function navigationProcessor() {
|
|
2658
2670
|
return {
|
|
2659
2671
|
stage: "generate-nav",
|