@forsakringskassan/docs-generator 2.34.0 → 2.35.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/{create-markdown-renderer-C8_hQlL-.mjs → create-markdown-renderer-CEuJ5uE8.mjs} +7 -7
- package/dist/create-markdown-renderer-CEuJ5uE8.mjs.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +49 -38
- package/dist/index.mjs.map +1 -1
- package/dist/markdown.mjs +4 -4
- package/dist/style/core.css +7 -7
- package/dist/style/index.css +9 -7
- package/dist/style/site.css +2 -0
- package/dist/style/theme/fkui.css +6 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vendor-BPf0gRBB.mjs → vendor-CMa7Qsb1.mjs} +192 -136
- package/dist/vendor-CMa7Qsb1.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/create-markdown-renderer-C8_hQlL-.mjs.map +0 -1
- package/dist/vendor-BPf0gRBB.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -4,12 +4,12 @@ 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, 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, o as inter } from './vendor-
|
|
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-
|
|
9
|
-
import
|
|
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, o as inter } from './vendor-CMa7Qsb1.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-CEuJ5uE8.mjs';
|
|
9
|
+
import sp__default from 'node:path';
|
|
10
10
|
import require$$1 from 'crypto';
|
|
11
11
|
import 'node:crypto';
|
|
12
|
-
import { exec } from 'node:child_process';
|
|
12
|
+
import { exec, execSync } from 'node:child_process';
|
|
13
13
|
import util, { promisify } from 'node:util';
|
|
14
14
|
import { codeFrameColumns } from '@babel/code-frame';
|
|
15
15
|
import { parse as parse$1 } from '@babel/parser';
|
|
@@ -35,8 +35,7 @@ import 'path';
|
|
|
35
35
|
import 'node:module';
|
|
36
36
|
import 'readline';
|
|
37
37
|
import 'events';
|
|
38
|
-
import '
|
|
39
|
-
import 'os';
|
|
38
|
+
import 'node:os';
|
|
40
39
|
import 'http';
|
|
41
40
|
import 'https';
|
|
42
41
|
import 'url';
|
|
@@ -44,6 +43,7 @@ import 'buffer';
|
|
|
44
43
|
import 'net';
|
|
45
44
|
import 'tls';
|
|
46
45
|
import 'tty';
|
|
46
|
+
import 'os';
|
|
47
47
|
import 'querystring';
|
|
48
48
|
import 'vue';
|
|
49
49
|
import './vue3-DtTC1eal.mjs';
|
|
@@ -284,6 +284,17 @@ function slugify(value) {
|
|
|
284
284
|
return value.toLowerCase().replace(/\//g, "--").replace(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
function isRelease() {
|
|
288
|
+
try {
|
|
289
|
+
const cmd = `git log -n1 --format=format:%s`;
|
|
290
|
+
const message = execSync(cmd, { encoding: "utf-8" }).trim();
|
|
291
|
+
return message.startsWith("chore(release):");
|
|
292
|
+
} catch (err) {
|
|
293
|
+
console.error(err);
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
287
298
|
const md$6 = MarkdownIt();
|
|
288
299
|
md$6.renderer.rules.fence = (tokens, idx, _options, collected) => {
|
|
289
300
|
const { content, info } = tokens[idx];
|
|
@@ -998,7 +1009,7 @@ function toArray$1(value) {
|
|
|
998
1009
|
return Array.isArray(value) ? value : [value];
|
|
999
1010
|
}
|
|
1000
1011
|
function isIndexPage(parsed) {
|
|
1001
|
-
const folder =
|
|
1012
|
+
const folder = sp__default.basename(parsed.dir);
|
|
1002
1013
|
if (parsed.name === folder) {
|
|
1003
1014
|
return true;
|
|
1004
1015
|
}
|
|
@@ -1068,8 +1079,8 @@ function getComponent(attrs) {
|
|
|
1068
1079
|
return toArray$1(attrs.component).map(normalizeComponent);
|
|
1069
1080
|
}
|
|
1070
1081
|
function parseFile$1(filePath, basePath, content) {
|
|
1071
|
-
const relative = basePath ?
|
|
1072
|
-
const parsed =
|
|
1082
|
+
const relative = basePath ? sp__default.relative(basePath, normalizePath(filePath)) : normalizePath(filePath);
|
|
1083
|
+
const parsed = sp__default.parse(relative);
|
|
1073
1084
|
const blocks = fm(content);
|
|
1074
1085
|
const attributes = blocks.attributes;
|
|
1075
1086
|
const isIndex = isIndexPage(parsed);
|
|
@@ -1726,7 +1737,7 @@ async function translateAPI(filePath) {
|
|
|
1726
1737
|
|
|
1727
1738
|
function parseAPI(filePath, api) {
|
|
1728
1739
|
const relative = normalizePath(filePath);
|
|
1729
|
-
const parsedPath =
|
|
1740
|
+
const parsedPath = sp__default.parse(relative);
|
|
1730
1741
|
const componentName = parsedPath.name;
|
|
1731
1742
|
let html = "";
|
|
1732
1743
|
if (api.models.length) {
|
|
@@ -1755,7 +1766,7 @@ function parseAPI(filePath, api) {
|
|
|
1755
1766
|
}
|
|
1756
1767
|
async function parseTranslation(slug, filePath) {
|
|
1757
1768
|
const relative = normalizePath(filePath);
|
|
1758
|
-
const parsedPath =
|
|
1769
|
+
const parsedPath = sp__default.parse(relative);
|
|
1759
1770
|
const componentName = parsedPath.name;
|
|
1760
1771
|
const content = await fs.readFile(filePath, "utf-8");
|
|
1761
1772
|
return {
|
|
@@ -1830,8 +1841,8 @@ function parseFile(filePath, basePath, content) {
|
|
|
1830
1841
|
if (!title) {
|
|
1831
1842
|
throw new Error(`No title property set in "${filePath}"`);
|
|
1832
1843
|
}
|
|
1833
|
-
const relative = basePath ?
|
|
1834
|
-
const parsed =
|
|
1844
|
+
const relative = basePath ? sp__default.relative(basePath, normalizePath(filePath)) : normalizePath(filePath);
|
|
1845
|
+
const parsed = sp__default.parse(relative);
|
|
1835
1846
|
const filename = parsed.name.toLowerCase();
|
|
1836
1847
|
const name = parsed.name;
|
|
1837
1848
|
const urlpath = parsed.dir;
|
|
@@ -1872,7 +1883,7 @@ async function compileSassString(dst, style) {
|
|
|
1872
1883
|
style: "expanded",
|
|
1873
1884
|
importers: [new NodePackageImporter(), moduleImporter]
|
|
1874
1885
|
});
|
|
1875
|
-
await fs.mkdir(
|
|
1886
|
+
await fs.mkdir(sp__default.dirname(dst), { recursive: true });
|
|
1876
1887
|
await fs.writeFile(dst, result.css, "utf-8");
|
|
1877
1888
|
}
|
|
1878
1889
|
|
|
@@ -1965,7 +1976,7 @@ async function compileScript(options) {
|
|
|
1965
1976
|
const iconLib = process.env.DOCS_ICON_LIB ?? "@fkui/icon-lib-default";
|
|
1966
1977
|
try {
|
|
1967
1978
|
const entryPoints = [src instanceof URL ? fileURLToPath(src) : src];
|
|
1968
|
-
const outfile =
|
|
1979
|
+
const outfile = sp__default.join("temp", `asset-${name}.js`);
|
|
1969
1980
|
const external = [...assets, ...vendor.map(toExternalVendor)];
|
|
1970
1981
|
const format = buildOptions.format ?? "esm";
|
|
1971
1982
|
await esbuild({
|
|
@@ -1986,8 +1997,8 @@ async function compileScript(options) {
|
|
|
1986
1997
|
const fingerprint = getFingerprint(content);
|
|
1987
1998
|
const integrity = getIntegrity(content);
|
|
1988
1999
|
const filename = `${name}-${fingerprint}.js`;
|
|
1989
|
-
const dst =
|
|
1990
|
-
await fs$1.mkdir(
|
|
2000
|
+
const dst = sp__default.join(assetFolder, filename);
|
|
2001
|
+
await fs$1.mkdir(sp__default.dirname(dst), { recursive: true });
|
|
1991
2002
|
await fs$1.rename(outfile, dst);
|
|
1992
2003
|
const stat = await fs$1.stat(dst);
|
|
1993
2004
|
return {
|
|
@@ -2087,7 +2098,7 @@ function compileProcessorRuntime(generator, distDir, processors) {
|
|
|
2087
2098
|
const assetName = [
|
|
2088
2099
|
"processors",
|
|
2089
2100
|
processor.name.replace(/-processor/, ""),
|
|
2090
|
-
entry.name ??
|
|
2101
|
+
entry.name ?? sp__default.parse(entry.src).name
|
|
2091
2102
|
].join("/");
|
|
2092
2103
|
const name = processorRuntimeName(processor, entry);
|
|
2093
2104
|
const bundled = new URL(`${name}.mjs`, distDir);
|
|
@@ -2153,7 +2164,7 @@ function pathFromDoc({ fileInfo }) {
|
|
|
2153
2164
|
return [fileInfo.path.replace(/\\/g, "/"), true];
|
|
2154
2165
|
} else {
|
|
2155
2166
|
return [
|
|
2156
|
-
`./${
|
|
2167
|
+
`./${sp__default.join(fileInfo.path, fileInfo.name).replace(/\\/g, "/")}`,
|
|
2157
2168
|
false
|
|
2158
2169
|
];
|
|
2159
2170
|
}
|
|
@@ -2388,7 +2399,7 @@ function findTemplate(folders, from, src, format) {
|
|
|
2388
2399
|
folders = [...folders, templateDirectory];
|
|
2389
2400
|
const template = `${layout}.template.${format}`;
|
|
2390
2401
|
const searchPaths = folders.map((it) => {
|
|
2391
|
-
return
|
|
2402
|
+
return sp__default.join(it, template);
|
|
2392
2403
|
});
|
|
2393
2404
|
const found = searchPaths.find((it) => fs__default.existsSync(it));
|
|
2394
2405
|
if (!found) {
|
|
@@ -2455,7 +2466,7 @@ Make sure the name is correct and the template file exists in one of the listed
|
|
|
2455
2466
|
}
|
|
2456
2467
|
findTemplateFile(name) {
|
|
2457
2468
|
const { folders } = this;
|
|
2458
|
-
const searchPaths = folders.map((it) =>
|
|
2469
|
+
const searchPaths = folders.map((it) => sp__default.join(it, name));
|
|
2459
2470
|
return searchPaths.find((it) => existsSync(it));
|
|
2460
2471
|
}
|
|
2461
2472
|
}
|
|
@@ -2526,8 +2537,8 @@ function findSidenav(doc, tree) {
|
|
|
2526
2537
|
}
|
|
2527
2538
|
function cache(cacheFolder, outputFolder) {
|
|
2528
2539
|
return (it) => {
|
|
2529
|
-
const cacheFile =
|
|
2530
|
-
const outputFile =
|
|
2540
|
+
const cacheFile = sp__default.join(cacheFolder, it.outputFile);
|
|
2541
|
+
const outputFile = sp__default.join(outputFolder, it.outputFile);
|
|
2531
2542
|
if (existsSync(cacheFile)) {
|
|
2532
2543
|
copyFileSync(cacheFile, outputFile);
|
|
2533
2544
|
return false;
|
|
@@ -2545,8 +2556,8 @@ async function compileExamples(options) {
|
|
|
2545
2556
|
...assets.map((it) => it.name),
|
|
2546
2557
|
...vendors.map((it) => it.package)
|
|
2547
2558
|
];
|
|
2548
|
-
const cacheFolder =
|
|
2549
|
-
const outputFolder =
|
|
2559
|
+
const cacheFolder = sp__default.posix.join(options.cacheFolder, fileInfo.path);
|
|
2560
|
+
const outputFolder = sp__default.posix.join(options.outputFolder, fileInfo.path);
|
|
2550
2561
|
const cacheMiss = cache(cacheFolder, outputFolder);
|
|
2551
2562
|
const dirtyTasks = tasks.filter(cacheMiss);
|
|
2552
2563
|
if (dirtyTasks.length === 0) {
|
|
@@ -2581,8 +2592,8 @@ async function compileStandalones(options) {
|
|
|
2581
2592
|
if (tasks.length === 0) {
|
|
2582
2593
|
return;
|
|
2583
2594
|
}
|
|
2584
|
-
const cacheFolder =
|
|
2585
|
-
const outputFolder =
|
|
2595
|
+
const cacheFolder = sp__default.posix.join(options.cacheFolder, fileInfo.path);
|
|
2596
|
+
const outputFolder = sp__default.posix.join(options.outputFolder, fileInfo.path);
|
|
2586
2597
|
const cacheMiss = cache(cacheFolder, outputFolder);
|
|
2587
2598
|
const dirtyTasks = tasks.filter(cacheMiss);
|
|
2588
2599
|
const standaloneTemplate = findTemplate(
|
|
@@ -2591,7 +2602,7 @@ async function compileStandalones(options) {
|
|
|
2591
2602
|
"example"
|
|
2592
2603
|
);
|
|
2593
2604
|
for (const task of dirtyTasks) {
|
|
2594
|
-
const outputFile =
|
|
2605
|
+
const outputFile = sp__default.join(outputFolder, task.outputFile);
|
|
2595
2606
|
const content = await renderTemplate(standaloneTemplate, {
|
|
2596
2607
|
...templateData,
|
|
2597
2608
|
content: task.content
|
|
@@ -2613,7 +2624,7 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
2613
2624
|
return null;
|
|
2614
2625
|
}
|
|
2615
2626
|
const dst = getOutputFilePath(outputFolder, fileInfo);
|
|
2616
|
-
const mkdir = fs.mkdir(
|
|
2627
|
+
const mkdir = fs.mkdir(sp__default.dirname(dst), { recursive: true });
|
|
2617
2628
|
const topnav = nav.topnav;
|
|
2618
2629
|
const sidenav = findSidenav(doc, nav.sidenav);
|
|
2619
2630
|
if (sidenav && isNavigationSection(sidenav)) {
|
|
@@ -2679,12 +2690,12 @@ async function render(doc, docs, nav, vendors, options) {
|
|
|
2679
2690
|
fileMatcher
|
|
2680
2691
|
});
|
|
2681
2692
|
if (example.output) {
|
|
2682
|
-
const { dir, name } =
|
|
2693
|
+
const { dir, name } = sp__default.parse(example.output);
|
|
2683
2694
|
if (example.task) {
|
|
2684
2695
|
generatedExamples.push(example.task);
|
|
2685
2696
|
}
|
|
2686
2697
|
generatedStandalone.push({
|
|
2687
|
-
outputFile:
|
|
2698
|
+
outputFile: sp__default.join(dir, `${name}.html`),
|
|
2688
2699
|
content: example.markup
|
|
2689
2700
|
});
|
|
2690
2701
|
}
|
|
@@ -2978,7 +2989,7 @@ function getAssetSource(asset) {
|
|
|
2978
2989
|
return lines.join("\n");
|
|
2979
2990
|
}
|
|
2980
2991
|
async function compileVendor(assetFolder, vendor, options) {
|
|
2981
|
-
const name =
|
|
2992
|
+
const name = sp__default.isAbsolute(vendor.package) ? sp__default.basename(vendor.package) : vendor.package;
|
|
2982
2993
|
const slug = slugify(name);
|
|
2983
2994
|
const outfile = `temp/vendor-${slug}.out.js`;
|
|
2984
2995
|
const tmpfile = `temp/vendor-${slug}.in.js`;
|
|
@@ -3004,7 +3015,7 @@ async function compileVendor(assetFolder, vendor, options) {
|
|
|
3004
3015
|
const fingerprint = getFingerprint(content);
|
|
3005
3016
|
const integrity = getIntegrity(content);
|
|
3006
3017
|
const filename = `vendor-${slug}-${fingerprint}.js`;
|
|
3007
|
-
const dst =
|
|
3018
|
+
const dst = sp__default.join(assetFolder, filename).replace(/\\/g, "/");
|
|
3008
3019
|
await fs.rename(outfile, dst);
|
|
3009
3020
|
const stat = await fs.stat(dst);
|
|
3010
3021
|
return {
|
|
@@ -3207,7 +3218,7 @@ function getWorkingDir(value) {
|
|
|
3207
3218
|
if (value) {
|
|
3208
3219
|
const url = typeof value === "string" ? new URL(value) : value;
|
|
3209
3220
|
const normalized = normalizePath(fileURLToPath(url));
|
|
3210
|
-
return
|
|
3221
|
+
return sp__default.posix.dirname(normalized);
|
|
3211
3222
|
} else {
|
|
3212
3223
|
return normalizePath(process.cwd());
|
|
3213
3224
|
}
|
|
@@ -3245,7 +3256,7 @@ class Generator {
|
|
|
3245
3256
|
this.bundleDefaultFont = options.bundleDefaultFont ?? true;
|
|
3246
3257
|
this.outputFolder = options.outputFolder ?? "./public";
|
|
3247
3258
|
this.cacheFolder = options.cacheFolder ?? "./temp/docs";
|
|
3248
|
-
this.assetFolder =
|
|
3259
|
+
this.assetFolder = sp__default.posix.join(this.outputFolder, "assets");
|
|
3249
3260
|
this.exampleFolders = options.exampleFolders ?? [];
|
|
3250
3261
|
this.templateFolders = options.templateFolders ?? [];
|
|
3251
3262
|
this.processors = options.processors ?? [];
|
|
@@ -3405,7 +3416,7 @@ class Generator {
|
|
|
3405
3416
|
const { outputFolder, cacheFolder, assetFolder } = this;
|
|
3406
3417
|
await fs.rm(cacheFolder, { force: true, recursive: true });
|
|
3407
3418
|
if (existsSync(outputFolder)) {
|
|
3408
|
-
await fs.mkdir(
|
|
3419
|
+
await fs.mkdir(sp__default.dirname(cacheFolder), { recursive: true });
|
|
3409
3420
|
await fse.copy(outputFolder, cacheFolder);
|
|
3410
3421
|
await fs.rm(outputFolder, { recursive: true });
|
|
3411
3422
|
}
|
|
@@ -3422,7 +3433,7 @@ class Generator {
|
|
|
3422
3433
|
const filename = `inter-${subset}-wght-normal.woff2`;
|
|
3423
3434
|
const module = `@fontsource-variable/inter/files/${filename}`;
|
|
3424
3435
|
const src = fileURLToPath(import.meta.resolve(module));
|
|
3425
|
-
const dst =
|
|
3436
|
+
const dst = sp__default.join(assetFolder, filename);
|
|
3426
3437
|
return fs.copyFile(src, dst);
|
|
3427
3438
|
});
|
|
3428
3439
|
await Promise.all(files);
|
|
@@ -3532,5 +3543,5 @@ function searchProcessor() {
|
|
|
3532
3543
|
};
|
|
3533
3544
|
}
|
|
3534
3545
|
|
|
3535
|
-
export { Generator, availableProcessors, cookieProcessor, defineSources, extractExamplesProcessor, frontMatterFileReader, htmlRedirectProcessor, livereloadProcessor, manifestProcessor, matomoProcessor, motdProcessor, navigationFileReader, processorRuntimeName, redirectFileProcessor, searchProcessor, selectableVersionProcessor, sourceUrlProcessor, themeSelectProcessor, topnavProcessor, versionBannerProcessor, versionProcessor, vueFileReader };
|
|
3546
|
+
export { Generator, availableProcessors, cookieProcessor, defineSources, extractExamplesProcessor, frontMatterFileReader, htmlRedirectProcessor, isRelease, livereloadProcessor, manifestProcessor, matomoProcessor, motdProcessor, navigationFileReader, processorRuntimeName, redirectFileProcessor, searchProcessor, selectableVersionProcessor, sourceUrlProcessor, themeSelectProcessor, topnavProcessor, versionBannerProcessor, versionProcessor, vueFileReader };
|
|
3536
3547
|
//# sourceMappingURL=index.mjs.map
|