@forsakringskassan/docs-generator 2.28.11 → 2.29.1
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-DcyK76t5.mjs → create-markdown-renderer-xNUEILpa.mjs} +4 -4
- package/dist/{create-markdown-renderer-DcyK76t5.mjs.map → create-markdown-renderer-xNUEILpa.mjs.map} +1 -1
- package/dist/index.mjs +86 -23
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.mjs +4 -5
- package/dist/markdown.mjs.map +1 -1
- package/dist/runtime.mjs +3241 -3032
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vendor-CMzqoPR8.mjs → vendor-CUZpvssc.mjs} +94 -84
- package/dist/vendor-CUZpvssc.mjs.map +1 -0
- package/dist/{vue3-CprzF_70.mjs → vue3-CRwEnRGE.mjs} +24 -41
- package/dist/vue3-CRwEnRGE.mjs.map +1 -0
- package/dist/{worker-DxdZEcOj.mjs → worker-DE8HC-uI.mjs} +3 -31
- package/dist/{worker-DxdZEcOj.mjs.map → worker-DE8HC-uI.mjs.map} +1 -1
- package/package.json +1 -2
- package/dist/vendor-CMzqoPR8.mjs.map +0 -1
- package/dist/vue3-CprzF_70.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,8 @@ const require = $createRequire(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path/posix';
|
|
7
|
-
import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent,
|
|
8
|
-
import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-
|
|
7
|
+
import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse } from './vendor-CUZpvssc.mjs';
|
|
8
|
+
import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-xNUEILpa.mjs';
|
|
9
9
|
import path$1 from 'node:path';
|
|
10
10
|
import require$$1 from 'crypto';
|
|
11
11
|
import 'node:crypto';
|
|
@@ -15,7 +15,7 @@ import { codeFrameColumns } from '@babel/code-frame';
|
|
|
15
15
|
import { parse } from 'vue-docgen-api';
|
|
16
16
|
import { parse as parse$2 } from '@babel/parser';
|
|
17
17
|
import traverseModule from '@babel/traverse';
|
|
18
|
-
import { parse as parse$1, compileScript as compileScript$1, compileTemplate } from '
|
|
18
|
+
import { parse as parse$1, compileScript as compileScript$1, compileTemplate } from 'vue/compiler-sfc';
|
|
19
19
|
import fs__default, { existsSync, readFileSync, copyFileSync } from 'node:fs';
|
|
20
20
|
import { fileURLToPath } from 'node:url';
|
|
21
21
|
import { compileStringAsync, NodePackageImporter } from 'sass';
|
|
@@ -27,7 +27,6 @@ import 'fs';
|
|
|
27
27
|
import 'node:events';
|
|
28
28
|
import 'node:stream';
|
|
29
29
|
import 'node:string_decoder';
|
|
30
|
-
import 'typescript';
|
|
31
30
|
import 'constants';
|
|
32
31
|
import 'stream';
|
|
33
32
|
import 'util';
|
|
@@ -47,7 +46,7 @@ import 'tls';
|
|
|
47
46
|
import 'tty';
|
|
48
47
|
import 'querystring';
|
|
49
48
|
import 'vue';
|
|
50
|
-
import './vue3-
|
|
49
|
+
import './vue3-CRwEnRGE.mjs';
|
|
51
50
|
|
|
52
51
|
function toArray$2(value) {
|
|
53
52
|
return Array.isArray(value) ? value : [value];
|
|
@@ -284,8 +283,8 @@ function slugify(value) {
|
|
|
284
283
|
return value.toLowerCase().replace(/\//g, "--").replace(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
|
|
285
284
|
}
|
|
286
285
|
|
|
287
|
-
const md$
|
|
288
|
-
md$
|
|
286
|
+
const md$6 = MarkdownIt();
|
|
287
|
+
md$6.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
289
288
|
const { content, info } = tokens[idx];
|
|
290
289
|
const { language, tags } = parseInfostring(info);
|
|
291
290
|
if (language === "import") {
|
|
@@ -306,7 +305,7 @@ function findExamples$1(doc) {
|
|
|
306
305
|
return [];
|
|
307
306
|
}
|
|
308
307
|
const collected = [];
|
|
309
|
-
md$
|
|
308
|
+
md$6.render(doc.body, collected);
|
|
310
309
|
return collected;
|
|
311
310
|
}
|
|
312
311
|
function getSuffix(tags) {
|
|
@@ -373,8 +372,8 @@ function extractExamplesProcessor(options) {
|
|
|
373
372
|
};
|
|
374
373
|
}
|
|
375
374
|
|
|
376
|
-
const md$
|
|
377
|
-
md$
|
|
375
|
+
const md$5 = MarkdownIt();
|
|
376
|
+
md$5.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
378
377
|
const { content, info, map } = tokens[idx];
|
|
379
378
|
const { language: rawLanguage, tags } = parseInfostring(info);
|
|
380
379
|
const hashContent = `${map?.[0]}:${map?.[1]}:${info}:${content}`;
|
|
@@ -412,7 +411,7 @@ function findExamples(doc) {
|
|
|
412
411
|
return [];
|
|
413
412
|
}
|
|
414
413
|
const collected = [];
|
|
415
|
-
md$
|
|
414
|
+
md$5.render(doc.body, collected);
|
|
416
415
|
return collected;
|
|
417
416
|
}
|
|
418
417
|
function manifestPageFromDocument(doc) {
|
|
@@ -1239,30 +1238,91 @@ function translateSlotBindings(slot) {
|
|
|
1239
1238
|
}
|
|
1240
1239
|
return translatedBindings;
|
|
1241
1240
|
}
|
|
1241
|
+
function filterModels(rawProps, rawEvents) {
|
|
1242
|
+
const modelEvents = rawEvents.filter((it) => it.name.startsWith("update:"));
|
|
1243
|
+
const rawModels = modelEvents.map((it) => {
|
|
1244
|
+
const propName = it.name.slice("update:".length);
|
|
1245
|
+
const prop = rawProps.find((it2) => it2.name === propName);
|
|
1246
|
+
if (!prop) {
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
return {
|
|
1250
|
+
...prop,
|
|
1251
|
+
name: propName === "modelValue" ? "v-model" : `v-model:${propName}`
|
|
1252
|
+
};
|
|
1253
|
+
});
|
|
1254
|
+
const models = rawModels.filter((model) => model !== null);
|
|
1255
|
+
const events = rawEvents.filter((it) => !it.name.startsWith("update:"));
|
|
1256
|
+
const props = rawProps.filter((prop) => {
|
|
1257
|
+
const hasModelName = models.some(
|
|
1258
|
+
(model) => model.name.slice("v-model:".length) === prop.name
|
|
1259
|
+
);
|
|
1260
|
+
return !(hasModelName || prop.name.startsWith("modelValue"));
|
|
1261
|
+
});
|
|
1262
|
+
return { models, props, events };
|
|
1263
|
+
}
|
|
1242
1264
|
async function translateAPI(filePath) {
|
|
1243
1265
|
const api = await parse(filePath);
|
|
1244
|
-
const
|
|
1245
|
-
const
|
|
1266
|
+
const rawProps = api.props ? translateProps(api.props) : [];
|
|
1267
|
+
const rawEvents = api.events ? translateEvents(api.events) : [];
|
|
1268
|
+
const { models, props, events } = filterModels(rawProps, rawEvents);
|
|
1246
1269
|
const slots = api.slots ? translateSlots(api.slots) : [];
|
|
1247
|
-
for (const event of events) {
|
|
1248
|
-
if (!event.name.startsWith("update:")) {
|
|
1249
|
-
continue;
|
|
1250
|
-
}
|
|
1251
|
-
const prop = event.name.slice("update:".length);
|
|
1252
|
-
const entry = props.find((it) => it.name === prop);
|
|
1253
|
-
if (entry) {
|
|
1254
|
-
entry.name = prop === "modelValue" ? "v-model" : `v-model:${prop}`;
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
1270
|
return {
|
|
1258
1271
|
name: api.displayName,
|
|
1259
1272
|
slug: slugify(api.displayName),
|
|
1273
|
+
models,
|
|
1260
1274
|
props,
|
|
1261
1275
|
events,
|
|
1262
1276
|
slots
|
|
1263
1277
|
};
|
|
1264
1278
|
}
|
|
1265
1279
|
|
|
1280
|
+
const md$4 = MarkdownIt();
|
|
1281
|
+
const EMPTY_CHAR$4 = "‐";
|
|
1282
|
+
function render$5(text) {
|
|
1283
|
+
return text ? md$4.render(text) : EMPTY_CHAR$4;
|
|
1284
|
+
}
|
|
1285
|
+
function renderInline$4(text) {
|
|
1286
|
+
return text ? md$4.renderInline(text) : EMPTY_CHAR$4;
|
|
1287
|
+
}
|
|
1288
|
+
function generateModelTable(slug, models) {
|
|
1289
|
+
return (
|
|
1290
|
+
/* HTML */
|
|
1291
|
+
`
|
|
1292
|
+
<next-heading-level id="${slug}-models">
|
|
1293
|
+
<a class="header-anchor" href="#${slug}-models">Models</a>
|
|
1294
|
+
</next-heading-level>
|
|
1295
|
+
<dl class="docs-api docs-api--models">
|
|
1296
|
+
${models.map((model) => {
|
|
1297
|
+
const { name } = model;
|
|
1298
|
+
const id = `${slug}-model-${slugify(name)}`;
|
|
1299
|
+
return (
|
|
1300
|
+
/* HTML */
|
|
1301
|
+
`
|
|
1302
|
+
<dt>
|
|
1303
|
+
<code id="${id}"
|
|
1304
|
+
><a class="docs-api__anchor" href="#${id}"
|
|
1305
|
+
><span class="docs-api__name"
|
|
1306
|
+
>${htmlencode(name)}</span
|
|
1307
|
+
>: ${htmlencode(model.type ?? "unknown")}</a
|
|
1308
|
+
></code
|
|
1309
|
+
>
|
|
1310
|
+
${model.required ? "" : `<span class="docs-tag docs-tag--default">Optional</span>`}
|
|
1311
|
+
${model.deprecated === null ? "" : `<span class="docs-tag docs-tag--deprecated">Deprecated</span>`}
|
|
1312
|
+
</dt>
|
|
1313
|
+
<dd>
|
|
1314
|
+
${render$5(model.description)}
|
|
1315
|
+
${model.default ? `<p class="doc-api__item">Default: <code>${htmlencode(model.default.value)}</code></p>` : ""}
|
|
1316
|
+
${model.deprecated ? `<p class="doc-api__item docs-deprecated">Deprecated: ${renderInline$4(model.deprecated)}</p>` : ""}
|
|
1317
|
+
</dd>
|
|
1318
|
+
`
|
|
1319
|
+
);
|
|
1320
|
+
}).join("")}
|
|
1321
|
+
</dl>
|
|
1322
|
+
`
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1266
1326
|
const md$3 = MarkdownIt();
|
|
1267
1327
|
const EMPTY_CHAR$3 = "‐";
|
|
1268
1328
|
function render$4(text) {
|
|
@@ -1661,6 +1721,9 @@ function parseAPI(filePath, api) {
|
|
|
1661
1721
|
const parsedPath = path$1.parse(relative);
|
|
1662
1722
|
const componentName = parsedPath.name;
|
|
1663
1723
|
let html = "";
|
|
1724
|
+
if (api.models.length) {
|
|
1725
|
+
html += generateModelTable(api.slug, api.models);
|
|
1726
|
+
}
|
|
1664
1727
|
if (api.props.length) {
|
|
1665
1728
|
html += generatePropTable(api.slug, api.props);
|
|
1666
1729
|
}
|