@forsakringskassan/docs-generator 3.16.0 → 3.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/index.mjs CHANGED
@@ -3,14 +3,14 @@ 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 { t as ts, Z as Ze, M as MarkdownItCallable, g as fm, s as strToU8, z as zlibSync, h as strFromU8, d as dedent, i as closest, j as distance, k as isCI, m as moduleImporter, l as cliProgress, n as tinylr, w as watch, o as createInstance, p as fse, q as inter } from './vendor-BLfCdre8.mjs';
6
+ import { Z as Ze, M as MarkdownItCallable, g as fm, s as strToU8, z as zlibSync, h as strFromU8, d as dedent, i as closest, j as distance, k as isCI, m as moduleImporter, l as cliProgress, t as tinylr, w as watch, n as createInstance, o as fse, p as inter } from './vendor-i-8GIz5x.mjs';
7
7
  import path__default from 'node:path';
8
+ import fs from 'node:fs/promises';
8
9
  import crypto from 'node:crypto';
9
10
  import path from 'node:path/posix';
10
11
  import { exec, execSync } from 'node:child_process';
11
- import { g as generateId, f as formatCode, p as parseImport, a as getFingerprint, b as parseInfostring, h as hasTag, d as findTag, e as getOutputFilePath, i as isDocumentPage, j as findDocument, k as getDocumentBody, n as normalizePath, l as htmlencode, c as createMarkdownRenderer } from './create-markdown-renderer-BlUpDhJP.mjs';
12
+ import { g as generateId, f as formatCode, p as parseImport, a as getFingerprint, b as parseInfostring, h as hasTag, d as findTag, e as getOutputFilePath, i as isDocumentPage, j as findDocument, k as getDocumentBody, n as normalizePath, l as htmlencode, c as createMarkdownRenderer } from './create-markdown-renderer-DrDHT9bZ.mjs';
12
13
  import { DocExcerpt } from '@microsoft/tsdoc';
13
- import fs from 'node:fs/promises';
14
14
  import pkg from '../package.json' with { type: "json" };
15
15
  import fs__default, { existsSync, readFileSync, copyFileSync } from 'node:fs';
16
16
  import { version } from 'vue';
@@ -91,15 +91,13 @@ function memoize(callback) {
91
91
  };
92
92
  }
93
93
 
94
- function fileMatcher(patterns, options) {
95
- const { ignore } = options;
96
- const fileList = ts(patterns, {
97
- posix: true,
98
- ignore
99
- });
94
+ async function fileMatcher(patterns, options) {
95
+ const { ignore: exclude } = options;
96
+ const fileList = await Array.fromAsync(fs.glob(patterns, { exclude }));
100
97
  return memoize((filename, context) => {
101
98
  const matches = fileList.filter((file) => {
102
- const stem = file.replace(/^(?:\.\.\/)+/, "");
99
+ const regex = path__default.sep === "/" ? /^(?:\.\.\/)+/ : /^(?:\.\.\\)+/;
100
+ const stem = file.replace(regex, "");
103
101
  return path__default.matchesGlob(stem, `**/${filename}`);
104
102
  });
105
103
  if (matches.length === 0) {
@@ -1517,9 +1515,6 @@ function sourceUrlProcessor(...args) {
1517
1515
  componentFileExtension = "vue"
1518
1516
  } = options;
1519
1517
  const repository = getRepositoryUrl(pkg) ?? "";
1520
- const matcher = fileMatcher(sourceFiles, {
1521
- ignore: ["**/node_modules/**"]
1522
- });
1523
1518
  return {
1524
1519
  after: "generate-docs",
1525
1520
  name: "source-url-processor",
@@ -1527,6 +1522,9 @@ function sourceUrlProcessor(...args) {
1527
1522
  if (!enabled) {
1528
1523
  return;
1529
1524
  }
1525
+ const matcher = await fileMatcher(sourceFiles, {
1526
+ ignore: ["**/node_modules/**"]
1527
+ });
1530
1528
  const hash = await gitCommitHash("full") ?? "";
1531
1529
  const short = await gitCommitHash("short") ?? "";
1532
1530
  function componentSourceUrl(component) {
@@ -2966,6 +2964,7 @@ function parseFile$1(filePath, basePath, content) {
2966
2964
  visible: attributes.href ? true : false,
2967
2965
  attributes: {
2968
2966
  title,
2967
+ shortTitle: attributes["short-title"],
2969
2968
  href,
2970
2969
  sortorder: attributes.sortorder ?? Infinity,
2971
2970
  redirectFrom: [],
@@ -4382,7 +4381,9 @@ class Generator {
4382
4381
  ...this.processors
4383
4382
  ];
4384
4383
  const examplePatterns = this.exampleFolders.map((it) => `${it}/**/*`);
4385
- const exampleFileMatcher = fileMatcher(examplePatterns, { ignore: [] });
4384
+ const exampleFileMatcher = await fileMatcher(examplePatterns, {
4385
+ ignore: []
4386
+ });
4386
4387
  const templateLoader = createTemplateLoader([]);
4387
4388
  const context = createContext({
4388
4389
  outputFolder: "",
@@ -4452,12 +4453,18 @@ class Generator {
4452
4453
  ...this.processors
4453
4454
  ];
4454
4455
  compileProcessorRuntime(this, import.meta.url, processors);
4456
+ const exampleFileMatcher = await fileMatcher(examplePatterns, {
4457
+ ignore: []
4458
+ });
4455
4459
  const templateLoader = createTemplateLoader(templateFolders);
4456
4460
  const context = createContext({
4457
4461
  outputFolder,
4458
- exampleFileMatcher: fileMatcher(examplePatterns, { ignore: [] }),
4462
+ exampleFileMatcher,
4459
4463
  templateLoader
4460
4464
  });
4465
+ context.addTemplateBlock("header:left", "header:left", {
4466
+ filename: "partials/brand.html"
4467
+ });
4461
4468
  context.addTemplateBlock("footer:left", "footer:left", {
4462
4469
  filename: "partials/footer-left.html"
4463
4470
  });