@forsakringskassan/docs-generator 3.15.2 → 3.17.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) {
@@ -4382,7 +4380,9 @@ class Generator {
4382
4380
  ...this.processors
4383
4381
  ];
4384
4382
  const examplePatterns = this.exampleFolders.map((it) => `${it}/**/*`);
4385
- const exampleFileMatcher = fileMatcher(examplePatterns, { ignore: [] });
4383
+ const exampleFileMatcher = await fileMatcher(examplePatterns, {
4384
+ ignore: []
4385
+ });
4386
4386
  const templateLoader = createTemplateLoader([]);
4387
4387
  const context = createContext({
4388
4388
  outputFolder: "",
@@ -4452,12 +4452,24 @@ class Generator {
4452
4452
  ...this.processors
4453
4453
  ];
4454
4454
  compileProcessorRuntime(this, import.meta.url, processors);
4455
+ const exampleFileMatcher = await fileMatcher(examplePatterns, {
4456
+ ignore: []
4457
+ });
4455
4458
  const templateLoader = createTemplateLoader(templateFolders);
4456
4459
  const context = createContext({
4457
4460
  outputFolder,
4458
- exampleFileMatcher: fileMatcher(examplePatterns, { ignore: [] }),
4461
+ exampleFileMatcher,
4459
4462
  templateLoader
4460
4463
  });
4464
+ context.addTemplateBlock("footer:left", "footer:left", {
4465
+ filename: "partials/footer-left.html"
4466
+ });
4467
+ context.addTemplateBlock("footer:center", "footer:center", {
4468
+ filename: "partials/footer-center.html"
4469
+ });
4470
+ context.addTemplateBlock("footer:right", "footer:right", {
4471
+ filename: "partials/footer-right.html"
4472
+ });
4461
4473
  const generatedFiles = [
4462
4474
  await stage("generate-docs", context, processors),
4463
4475
  await stage("generate-nav", context, processors),