@forsakringskassan/docs-generator 3.2.0 → 3.3.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
@@ -8,7 +8,7 @@ import path__default from 'node:path';
8
8
  import crypto from 'node:crypto';
9
9
  import path from 'node:path/posix';
10
10
  import { exec, execSync } from 'node:child_process';
11
- import { g as generateId, f as formatCode, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, b as parseImport, d as findTag, e as getOutputFilePath, j as htmlencode, k as filePath, c as createMarkdownRenderer, l as generateExample } from './create-markdown-renderer-p3FAbLe1.mjs';
11
+ import { g as generateId, f as formatCode, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, b as parseImport, d as findTag, e as getOutputFilePath, j as htmlencode, k as filePath, c as createMarkdownRenderer, l as generateExample } from './create-markdown-renderer-DLvvsGCZ.mjs';
12
12
  import { DocExcerpt } from '@microsoft/tsdoc';
13
13
  import fs from 'node:fs/promises';
14
14
  import util, { promisify, styleText } from 'node:util';
@@ -97,7 +97,7 @@ function fileMatcher(patterns) {
97
97
  });
98
98
  return memoize((filename, context) => {
99
99
  const matches = fileList.filter((file) => {
100
- const stem = file.replace(/^(\.\.\/)+/, "");
100
+ const stem = file.replace(/^(?:\.\.\/)+/, "");
101
101
  return path__default.matchesGlob(stem, `**/${filename}`);
102
102
  });
103
103
  if (matches.length === 0) {
@@ -129,7 +129,7 @@ function formatSize(value) {
129
129
  return `${String(value)} GB`;
130
130
  }
131
131
 
132
- const matchHeading = /^(#+)(.*)$/gm;
132
+ const matchHeading = /^(#+)([^#].*)$/gm;
133
133
  function getHeadings(text) {
134
134
  return Array.from(text.matchAll(matchHeading), parseHeading);
135
135
  }
@@ -186,7 +186,7 @@ function getPullRequestID(env) {
186
186
  return void 0;
187
187
  }
188
188
 
189
- const RE_MATCH_SSH = /^(ssh:\/\/)?(?<user>[^@]+)@(?<host>[^:]+):(?<path>.*)$/;
189
+ const RE_MATCH_SSH = /^[^@]+@(?<host>[^:]+):(?<path>.*)$/;
190
190
  function getRepositoryUrl(value) {
191
191
  if (typeof value !== "string") {
192
192
  const url = value.repository?.url;
@@ -232,7 +232,7 @@ function haveOutput(doc) {
232
232
  }
233
233
 
234
234
  function interpolate(value, data) {
235
- return value.replaceAll(/{{([^{}]+)}}/g, (match, raw) => {
235
+ return value.replaceAll(/\{\{([^{}]+)\}\}/g, (match, raw) => {
236
236
  const key = raw.trim();
237
237
  const value2 = data[key];
238
238
  return value2 ?? match;
@@ -286,7 +286,7 @@ function difference(a, b) {
286
286
  }
287
287
 
288
288
  function slugify(value) {
289
- return value.toLowerCase().replaceAll("/", "--").replaceAll(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
289
+ return value.toLowerCase().replaceAll("/", "--").replaceAll(/[^a-z]+/g, "-").replace(/^-+|-+$/, "");
290
290
  }
291
291
 
292
292
  function isRelease() {
@@ -1426,8 +1426,8 @@ function findLocation(content, attr) {
1426
1426
  }
1427
1427
  const blockBegin = 2;
1428
1428
  return {
1429
- start: { line: index + blockBegin, column: 1 },
1430
- end: { line: index + blockBegin, column: 1 + attr.length }
1429
+ start: { line: index + blockBegin, column: 0 },
1430
+ end: { line: index + blockBegin, column: attr.length }
1431
1431
  };
1432
1432
  }
1433
1433
  function getSuggestion(attribute) {
@@ -1682,8 +1682,8 @@ function findDocComment(path, node) {
1682
1682
  return doc;
1683
1683
  }
1684
1684
  }
1685
- const grandparent = path.parentPath?.parent;
1686
- if (parent.type === "VariableDeclarator" && grandparent?.leadingComments) {
1685
+ const grandparent = path.parentPath.parent;
1686
+ if (parent.type === "VariableDeclarator" && grandparent.leadingComments) {
1687
1687
  const doc = grandparent.leadingComments.find(isDocComment);
1688
1688
  if (doc) {
1689
1689
  return doc;
@@ -2858,7 +2858,7 @@ Make sure the name is correct and the template file exists in one of the listed
2858
2858
  }
2859
2859
  }
2860
2860
 
2861
- const messageRegex = /^\([^)]+\) \[Line \d+, Column \d+]\n\s+Error: (.*)$/;
2861
+ const messageRegex = /^\([^)]+\) \[Line \d+, Column \d+\]\n\s+Error: (.*)$/;
2862
2862
  function getActualMessage(message) {
2863
2863
  const match = messageRegex.exec(message);
2864
2864
  if (match) {
@@ -3002,7 +3002,7 @@ function createTemplateLoader(folders) {
3002
3002
  return loader;
3003
3003
  }
3004
3004
  function stripPrettierComments(content) {
3005
- return content.replaceAll(/\s*<!-- prettier-ignore -->\s*/gm, "");
3005
+ return content.replaceAll(/\s*<!-- prettier-ignore -->\s*/g, "");
3006
3006
  }
3007
3007
  async function render(doc, docs, options) {
3008
3008
  const { fileInfo } = doc;
@@ -3164,7 +3164,7 @@ async function render(doc, docs, options) {
3164
3164
  const message = err instanceof Error ? err.message : String(err);
3165
3165
  throw new Error(`${prefix}: ${message}`, { cause: err });
3166
3166
  }
3167
- const expandedDst = dst.replaceAll(/\[([^]+)]/g, (match, key) => {
3167
+ const expandedDst = dst.replaceAll(/\[([\s\S]+)\]/g, (match, key) => {
3168
3168
  if (key === "hash") {
3169
3169
  return getFingerprint(doc.body);
3170
3170
  } else {