@forsakringskassan/docs-generator 3.4.1 → 3.5.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.
@@ -2,7 +2,7 @@ import { createRequire as $createRequire } from "node:module";
2
2
 
3
3
  const require = $createRequire(import.meta.url);
4
4
 
5
- import { r as runAsWorker, f as format2, a as resolveConfig } from './vendor-BCT11nQq.mjs';
5
+ import { r as runAsWorker, f as format2, a as resolveConfig } from './vendor-BeEO8YMF.mjs';
6
6
  import 'node:url';
7
7
  import 'node:path';
8
8
  import 'fs';
@@ -54,4 +54,4 @@ async function formatCode(source, filepath) {
54
54
  runAsWorker(formatCode);
55
55
 
56
56
  export { formatCode };
57
- //# sourceMappingURL=format-code.worker-C0TyapmE.mjs.map
57
+ //# sourceMappingURL=format-code.worker-Y0WP8Vzk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-code.worker-C0TyapmE.mjs","sources":["../src/utils/format-code.worker.ts"],"sourcesContent":["import { type Options, format as prettier, resolveConfig } from \"prettier\";\nimport { runAsWorker } from \"synckit\";\n\nconst configCache = new Map<string, Options | null>();\n\nasync function getConfig(filepath: string): Promise<Options | null> {\n const cached = configCache.get(filepath);\n if (cached !== undefined) {\n return cached;\n }\n const options = await resolveConfig(filepath);\n configCache.set(filepath, options);\n return options;\n}\n\n/**\n * @internal\n */\nexport async function formatCode(\n source: string,\n filepath: string,\n): Promise<string> {\n const options = await getConfig(filepath);\n const formatted = await prettier(source, { ...options, filepath });\n return formatted.trim();\n}\n\n/* eslint-disable-next-line unicorn/no-top-level-side-effects -- required for worker to function */\nrunAsWorker(formatCode);\n"],"names":["prettier"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAA,uBAAkB,GAAA,EAA4B;AAEpD,eAAe,UAAU,QAAA,EAA2C;AAChE,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,GAAA,CAAI,QAAQ,CAAA;AACvC,EAAA,IAAI,WAAW,MAAA,EAAW;AACtB,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,QAAQ,CAAA;AAC5C,EAAA,WAAA,CAAY,GAAA,CAAI,UAAU,OAAO,CAAA;AACjC,EAAA,OAAO,OAAA;AACX;AAKA,eAAsB,UAAA,CAClB,QACA,QAAA,EACe;AACf,EAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,QAAQ,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,MAAMA,OAAA,CAAS,MAAA,EAAQ,EAAE,GAAG,OAAA,EAAS,UAAU,CAAA;AACjE,EAAA,OAAO,UAAU,IAAA,EAAK;AAC1B;AAGA,WAAA,CAAY,UAAU,CAAA;;;;"}
1
+ {"version":3,"file":"format-code.worker-Y0WP8Vzk.mjs","sources":["../src/utils/format-code.worker.ts"],"sourcesContent":["import { type Options, format as prettier, resolveConfig } from \"prettier\";\nimport { runAsWorker } from \"synckit\";\n\nconst configCache = new Map<string, Options | null>();\n\nasync function getConfig(filepath: string): Promise<Options | null> {\n const cached = configCache.get(filepath);\n if (cached !== undefined) {\n return cached;\n }\n const options = await resolveConfig(filepath);\n configCache.set(filepath, options);\n return options;\n}\n\n/**\n * @internal\n */\nexport async function formatCode(\n source: string,\n filepath: string,\n): Promise<string> {\n const options = await getConfig(filepath);\n const formatted = await prettier(source, { ...options, filepath });\n return formatted.trim();\n}\n\n/* eslint-disable-next-line unicorn/no-top-level-side-effects -- required for worker to function */\nrunAsWorker(formatCode);\n"],"names":["prettier"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,WAAA,uBAAkB,GAAA,EAA4B;AAEpD,eAAe,UAAU,QAAA,EAA2C;AAChE,EAAA,MAAM,MAAA,GAAS,WAAA,CAAY,GAAA,CAAI,QAAQ,CAAA;AACvC,EAAA,IAAI,WAAW,MAAA,EAAW;AACtB,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,QAAQ,CAAA;AAC5C,EAAA,WAAA,CAAY,GAAA,CAAI,UAAU,OAAO,CAAA;AACjC,EAAA,OAAO,OAAA;AACX;AAKA,eAAsB,UAAA,CAClB,QACA,QAAA,EACe;AACf,EAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,QAAQ,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,MAAMA,OAAA,CAAS,MAAA,EAAQ,EAAE,GAAG,OAAA,EAAS,UAAU,CAAA;AACjE,EAAA,OAAO,UAAU,IAAA,EAAK;AAC1B;AAGA,WAAA,CAAY,UAAU,CAAA;;;;"}
package/dist/index.mjs CHANGED
@@ -3,12 +3,12 @@ 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 MarkdownIt, d as dedent, g as closest, h as distance, i as fm, j as isCI, m as moduleImporter, k as cliProgress, l as tinylr, w as watch, n as createInstance, o as fse, p as inter } from './vendor-BCT11nQq.mjs';
6
+ import { t as ts, Z as Ze, M as MarkdownIt, d as dedent, g as closest, h as distance, i as fm, j as isCI, m as moduleImporter, k as cliProgress, l as tinylr, w as watch, n as createInstance, o as fse, p as inter } from './vendor-BeEO8YMF.mjs';
7
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-DotrdY3t.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-BuSu2H7E.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';
package/dist/markdown.mjs CHANGED
@@ -2,8 +2,8 @@ import { createRequire as $createRequire } from "node:module";
2
2
 
3
3
  const require = $createRequire(import.meta.url);
4
4
 
5
- export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-DotrdY3t.mjs';
6
- import './vendor-BCT11nQq.mjs';
5
+ export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-BuSu2H7E.mjs';
6
+ import './vendor-BeEO8YMF.mjs';
7
7
  import 'node:url';
8
8
  import 'node:path';
9
9
  import 'fs';
@@ -21454,6 +21454,8 @@ var cliProgress = /*@__PURE__*/getDefaultExportFromCjs(cliProgressExports);
21454
21454
 
21455
21455
  // Process definition lists
21456
21456
  //
21457
+ const ddDepthKey = Symbol('markdown-it-deflist.ddDepth');
21458
+
21457
21459
  function deflist_plugin (md) {
21458
21460
  const isSpace = md.utils.isSpace;
21459
21461
 
@@ -21464,6 +21466,7 @@ function deflist_plugin (md) {
21464
21466
  const max = state.eMarks[line];
21465
21467
 
21466
21468
  if (start >= max) { return -1 }
21469
+ if (state.sCount[line] - state.blkIndent >= 4) { return -1 }
21467
21470
 
21468
21471
  // Check bullet
21469
21472
  const marker = state.src.charCodeAt(start++);
@@ -21471,31 +21474,31 @@ function deflist_plugin (md) {
21471
21474
 
21472
21475
  const pos = state.skipSpaces(start);
21473
21476
 
21474
- // require space after ":"
21475
- if (start === pos) { return -1 }
21476
-
21477
- // no empty definitions, e.g. " : "
21478
- if (pos >= max) { return -1 }
21477
+ // require space after marker if there is inline content
21478
+ if (start < max && start === pos) { return -1 }
21479
21479
 
21480
21480
  return start
21481
21481
  }
21482
21482
 
21483
- function markTightParagraphs (state, idx) {
21484
- const level = state.level + 2;
21483
+ function markTightParagraph (state, start, end, level) {
21484
+ let block = -1;
21485
21485
 
21486
- for (let i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
21487
- if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
21488
- state.tokens[i + 2].hidden = true;
21489
- state.tokens[i].hidden = true;
21490
- i += 2;
21491
- }
21486
+ for (let i = start; i < end; i++) {
21487
+ const token = state.tokens[i];
21488
+ if (token.level !== level || !token.block || token.nesting < 0) { continue }
21489
+ if (block >= 0) { return }
21490
+ block = i;
21492
21491
  }
21492
+
21493
+ if (block < 0 || state.tokens[block].type !== 'paragraph_open') { return }
21494
+ state.tokens[block + 2].hidden = true;
21495
+ state.tokens[block].hidden = true;
21493
21496
  }
21494
21497
 
21495
21498
  function deflist (state, startLine, endLine, silent) {
21496
21499
  if (silent) {
21497
21500
  // quirk: validation mode validates a dd block only, not a whole deflist
21498
- if (state.ddIndent < 0) { return false }
21501
+ if (!state.env[ddDepthKey]) { return false }
21499
21502
  const markerPos = skipMarker(state, startLine);
21500
21503
  return markerPos >= 0 && state.sCount[startLine] < state.blkIndent
21501
21504
  }
@@ -21503,8 +21506,11 @@ function deflist_plugin (md) {
21503
21506
  let nextLine = startLine + 1;
21504
21507
  if (nextLine >= endLine) { return false }
21505
21508
 
21509
+ let termIsTight = true;
21510
+
21506
21511
  if (state.isEmpty(nextLine)) {
21507
21512
  nextLine++;
21513
+ termIsTight = false;
21508
21514
  if (nextLine >= endLine) { return false }
21509
21515
  }
21510
21516
 
@@ -21512,10 +21518,6 @@ function deflist_plugin (md) {
21512
21518
  let contentStart = skipMarker(state, nextLine);
21513
21519
  if (contentStart < 0) { return false }
21514
21520
 
21515
- // Start list
21516
- const listTokIdx = state.tokens.length;
21517
- let tight = true;
21518
-
21519
21521
  const token_dl_o = state.push('dl_open', 'dl', 1);
21520
21522
  const listLines = [startLine, 0];
21521
21523
  token_dl_o.map = listLines;
@@ -21536,19 +21538,18 @@ function deflist_plugin (md) {
21536
21538
  /* eslint no-labels:0,block-scoped-var:0 */
21537
21539
  OUTER:
21538
21540
  for (;;) {
21539
- let prevEmptyEnd = false;
21540
-
21541
21541
  const token_dt_o = state.push('dt_open', 'dt', 1);
21542
21542
  token_dt_o.map = [dtLine, dtLine];
21543
21543
 
21544
21544
  const token_i = state.push('inline', '', 0);
21545
- token_i.map = [dtLine, dtLine];
21546
- token_i.content = state.getLines(dtLine, dtLine + 1, state.blkIndent, false).trim();
21545
+ token_i.map = [dtLine, dtLine];
21546
+ token_i.content = state.getLines(dtLine, dtLine + 1, state.blkIndent, false).trim();
21547
21547
  token_i.children = [];
21548
21548
 
21549
21549
  state.push('dt_close', 'dt', -1);
21550
21550
 
21551
21551
  for (;;) {
21552
+ const itemTokIdx = state.tokens.length;
21552
21553
  const token_dd_o = state.push('dd_open', 'dd', 1);
21553
21554
  const itemLines = [nextLine, 0];
21554
21555
  token_dd_o.map = itemLines;
@@ -21576,33 +21577,29 @@ function deflist_plugin (md) {
21576
21577
  contentStart = pos;
21577
21578
 
21578
21579
  const oldTight = state.tight;
21579
- const oldDDIndent = state.ddIndent;
21580
21580
  const oldIndent = state.blkIndent;
21581
21581
  const oldTShift = state.tShift[ddLine];
21582
21582
  const oldSCount = state.sCount[ddLine];
21583
21583
  const oldParentType = state.parentType;
21584
- state.blkIndent = state.ddIndent = state.sCount[ddLine] + 2;
21584
+ state.blkIndent = state.sCount[ddLine] + 2;
21585
21585
  state.tShift[ddLine] = contentStart - state.bMarks[ddLine];
21586
21586
  state.sCount[ddLine] = offset;
21587
21587
  state.tight = true;
21588
21588
  state.parentType = 'deflist';
21589
21589
 
21590
+ state.env[ddDepthKey] = (state.env[ddDepthKey] || 0) + 1;
21590
21591
  state.md.block.tokenize(state, ddLine, endLine, true);
21592
+ state.env[ddDepthKey]--;
21591
21593
 
21592
- // If any of list item is tight, mark list as tight
21593
- if (!state.tight || prevEmptyEnd) {
21594
- tight = false;
21594
+ if (termIsTight) {
21595
+ markTightParagraph(state, itemTokIdx, state.tokens.length, token_dd_o.level + 1);
21595
21596
  }
21596
- // Item become loose if finish with empty line,
21597
- // but we should filter last element, because it means list finish
21598
- prevEmptyEnd = (state.line - ddLine) > 1 && state.isEmpty(state.line - 1);
21599
21597
 
21600
21598
  state.tShift[ddLine] = oldTShift;
21601
21599
  state.sCount[ddLine] = oldSCount;
21602
21600
  state.tight = oldTight;
21603
21601
  state.parentType = oldParentType;
21604
21602
  state.blkIndent = oldIndent;
21605
- state.ddIndent = oldDDIndent;
21606
21603
 
21607
21604
  state.push('dd_close', 'dd', -1);
21608
21605
 
@@ -21620,6 +21617,8 @@ function deflist_plugin (md) {
21620
21617
  // insert DD tag and repeat checking
21621
21618
  }
21622
21619
 
21620
+ // EOF, empty and outdented lines have already exited through OUTER above.
21621
+ // Keep these checks as guards for non-standard block parser states.
21623
21622
  if (nextLine >= endLine) { break }
21624
21623
  dtLine = nextLine;
21625
21624
 
@@ -21628,12 +21627,16 @@ function deflist_plugin (md) {
21628
21627
 
21629
21628
  ddLine = dtLine + 1;
21630
21629
  if (ddLine >= endLine) { break }
21631
- if (state.isEmpty(ddLine)) { ddLine++; }
21630
+ const skippedEmptyLine = state.isEmpty(ddLine);
21631
+ if (skippedEmptyLine) { ddLine++; }
21632
+ // A trailing blank reaches EOF here, with the same result as above.
21632
21633
  if (ddLine >= endLine) { break }
21633
21634
 
21635
+ // Nested block tokenizers normally stop before an outdented line.
21634
21636
  if (state.sCount[ddLine] < state.blkIndent) { break }
21635
21637
  contentStart = skipMarker(state, ddLine);
21636
21638
  if (contentStart < 0) { break }
21639
+ termIsTight = !skippedEmptyLine;
21637
21640
 
21638
21641
  // go to the next loop iteration:
21639
21642
  // insert DT and DD tags and repeat checking
@@ -21646,11 +21649,6 @@ function deflist_plugin (md) {
21646
21649
 
21647
21650
  state.line = nextLine;
21648
21651
 
21649
- // mark paragraphs tight if needed
21650
- if (tight) {
21651
- markTightParagraphs(state, listTokIdx);
21652
- }
21653
-
21654
21652
  return true
21655
21653
  }
21656
21654
 
@@ -70531,4 +70529,4 @@ var yaml = /*#__PURE__*/Object.freeze({
70531
70529
  });
70532
70530
 
70533
70531
  export { HighlightJS as H, MarkdownIt as M, Ze$b as Z, resolveConfig as a, createTwoFilesPatch$1 as b, createSyncFn as c, dedent$1 as d, deflist_plugin as e, format2 as f, closest as g, distance as h, fm$3 as i, isCI as j, cliProgress as k, tinylr as l, moduleImporter as m, createInstance as n, fse as o, inter as p, runAsWorker as r, ts$9 as t, watch$1 as w };
70534
- //# sourceMappingURL=vendor-BCT11nQq.mjs.map
70532
+ //# sourceMappingURL=vendor-BeEO8YMF.mjs.map