@forsakringskassan/docs-generator 2.17.1 → 2.18.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-2ejm6Tub.js → create-markdown-renderer-CaJTFjAd.js} +10 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +33 -6
- package/dist/markdown.js +3 -3
- package/dist/{vendor-BeoVq2Sv.js → vendor-Bagon7WF.js} +5 -0
- package/dist/{vue3-B1yNeGmz.js → vue3-CEAR7ggN.js} +1 -1
- package/package.json +1 -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-CEAR7ggN.js');
|
|
7
7
|
var path = require('node:path/posix');
|
|
8
8
|
require('@vue/compiler-sfc');
|
|
9
|
-
require('./vendor-
|
|
9
|
+
require('./vendor-Bagon7WF.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-Bagon7WF.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-CEAR7ggN.js');
|
|
12
12
|
|
|
13
13
|
function findDocument(haystack, needle) {
|
|
14
14
|
const match = haystack.find((it) => {
|
|
@@ -538,13 +538,18 @@ function getStandalonePath(output) {
|
|
|
538
538
|
function getSource(content, language, tags, { namedExamples }) {
|
|
539
539
|
const compare = findTag(tags, "compare");
|
|
540
540
|
if (compare && compare.value !== null) {
|
|
541
|
+
const { value: context } = findTag(tags, "context") ?? {};
|
|
541
542
|
const reference = namedExamples.get(compare.value);
|
|
542
543
|
if (!reference) {
|
|
543
544
|
throw new Error(
|
|
544
545
|
`Failed to find referenced example "${compare.value}"`
|
|
545
546
|
);
|
|
546
547
|
}
|
|
547
|
-
const
|
|
548
|
+
const a = transformCode(reference.content, reference.language);
|
|
549
|
+
const b = transformCode(content, language);
|
|
550
|
+
const diff = vendor.createTwoFilesPatch("a", "b", a, b, "", "", {
|
|
551
|
+
context: context ? parseInt(context, 10) : 3
|
|
552
|
+
}).split("\n").slice(4).join("\n");
|
|
548
553
|
return {
|
|
549
554
|
source: diff,
|
|
550
555
|
language: "diff"
|
|
@@ -566,7 +571,8 @@ function codePreview(options) {
|
|
|
566
571
|
env.namedExamples.set(name, {
|
|
567
572
|
name,
|
|
568
573
|
tags: rawTags,
|
|
569
|
-
content: rawContent
|
|
574
|
+
content: rawContent,
|
|
575
|
+
language: rawLanguage
|
|
570
576
|
});
|
|
571
577
|
}
|
|
572
578
|
if (hasTag(rawTags, "hidden")) {
|
package/dist/index.d.ts
CHANGED
|
@@ -325,6 +325,9 @@ export declare interface ManifestProcessorOptions {
|
|
|
325
325
|
markdown?: string;
|
|
326
326
|
/** If set, the manifest will be written as JSON to this destination */
|
|
327
327
|
json?: string;
|
|
328
|
+
/** If set to `true` the markdown manifest will be verified instead of
|
|
329
|
+
* written (typically enabled during CI) */
|
|
330
|
+
verify?: boolean;
|
|
328
331
|
}
|
|
329
332
|
|
|
330
333
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
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-Bagon7WF.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-CaJTFjAd.js');
|
|
10
10
|
var node_child_process = require('node:child_process');
|
|
11
11
|
var util = require('node:util');
|
|
12
12
|
var codeFrame = require('@babel/code-frame');
|
|
@@ -44,7 +44,7 @@ require('tls');
|
|
|
44
44
|
require('tty');
|
|
45
45
|
require('querystring');
|
|
46
46
|
require('vue');
|
|
47
|
-
require('./vue3-
|
|
47
|
+
require('./vue3-CEAR7ggN.js');
|
|
48
48
|
|
|
49
49
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
50
50
|
function toArray$2(value) {
|
|
@@ -424,8 +424,26 @@ function renderMarkdown(manifest) {
|
|
|
424
424
|
function renderJSON(manifest) {
|
|
425
425
|
return JSON.stringify(manifest, null, 2);
|
|
426
426
|
}
|
|
427
|
+
function normalize(text) {
|
|
428
|
+
return text.replace(/\r\n/g, "\n");
|
|
429
|
+
}
|
|
430
|
+
class ManifestError extends Error {
|
|
431
|
+
filename;
|
|
432
|
+
constructor(filename) {
|
|
433
|
+
super(`Documentation manifest "${filename}" is not up-to-date!`);
|
|
434
|
+
this.filename = filename;
|
|
435
|
+
}
|
|
436
|
+
prettyError() {
|
|
437
|
+
const { filename, message } = this;
|
|
438
|
+
return [
|
|
439
|
+
message,
|
|
440
|
+
"",
|
|
441
|
+
`Run the build locally and commit the content of "${filename}".`
|
|
442
|
+
].join("\n");
|
|
443
|
+
}
|
|
444
|
+
}
|
|
427
445
|
function manifestProcessor(options = {}) {
|
|
428
|
-
const { markdown, json } = options;
|
|
446
|
+
const { markdown, json, verify } = options;
|
|
429
447
|
return {
|
|
430
448
|
name: "manifestProcessor",
|
|
431
449
|
before: "render",
|
|
@@ -437,8 +455,17 @@ function manifestProcessor(options = {}) {
|
|
|
437
455
|
});
|
|
438
456
|
const manifest = { pages };
|
|
439
457
|
if (markdown) {
|
|
440
|
-
const content = renderMarkdown(manifest);
|
|
441
|
-
|
|
458
|
+
const content = normalize(renderMarkdown(manifest));
|
|
459
|
+
if (verify) {
|
|
460
|
+
const actual = normalize(
|
|
461
|
+
await fs.readFile(markdown, "utf-8")
|
|
462
|
+
);
|
|
463
|
+
if (actual !== content) {
|
|
464
|
+
throw new ManifestError(markdown);
|
|
465
|
+
}
|
|
466
|
+
} else {
|
|
467
|
+
await fs.writeFile(markdown, content, "utf-8");
|
|
468
|
+
}
|
|
442
469
|
}
|
|
443
470
|
if (json) {
|
|
444
471
|
const content = renderJSON(manifest);
|
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-CaJTFjAd.js');
|
|
4
|
+
require('./vendor-Bagon7WF.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-CEAR7ggN.js');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -26515,6 +26515,11 @@ function formatPatch(diff) {
|
|
|
26515
26515
|
}
|
|
26516
26516
|
function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
26517
26517
|
var _options2;
|
|
26518
|
+
if (typeof options === 'function') {
|
|
26519
|
+
options = {
|
|
26520
|
+
callback: options
|
|
26521
|
+
};
|
|
26522
|
+
}
|
|
26518
26523
|
if (!((_options2 = options) !== null && _options2 !== undefined && _options2.callback)) {
|
|
26519
26524
|
var patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
26520
26525
|
if (!patchObj) {
|