@forsakringskassan/docs-generator 2.35.4 → 2.35.5

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
@@ -4,8 +4,8 @@ const require = $createRequire(import.meta.url);
4
4
 
5
5
  import fs from 'node:fs/promises';
6
6
  import path from 'node:path/posix';
7
- import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-Dd3EDAs1.mjs';
8
- import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-C3-r8Xp9.mjs';
7
+ import { g as globSync, m as minimatch, M as MarkdownIt, d as dedent, b as closest, e as distance, f as fm, i as isCI, h as glob, j as moduleImporter, k as cliProgress, t as tinylr, w as watch, l as createInstance, n as fse, o as inter } from './vendor-Q6b0E6UP.mjs';
8
+ import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as exampleWorkerUrl, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-Bx9oXbtZ.mjs';
9
9
  import sp__default from 'node:path';
10
10
  import require$$1 from 'crypto';
11
11
  import 'node:crypto';
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-C3-r8Xp9.mjs';
6
- import './vendor-Dd3EDAs1.mjs';
5
+ export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-Bx9oXbtZ.mjs';
6
+ import './vendor-Q6b0E6UP.mjs';
7
7
  import 'node:url';
8
8
  import 'node:path';
9
9
  import 'fs';
@@ -25091,9 +25091,6 @@ class PluralResolver {
25091
25091
  this.logger = baseLogger.create('pluralResolver');
25092
25092
  this.pluralRulesCache = {};
25093
25093
  }
25094
- addRule(lng, obj) {
25095
- this.rules[lng] = obj;
25096
- }
25097
25094
  clearCache() {
25098
25095
  this.pluralRulesCache = {};
25099
25096
  }
@@ -26249,7 +26246,19 @@ class I18n extends EventEmitter {
26249
26246
  clone.store = new ResourceStore(clonedData, mergedOptions);
26250
26247
  clone.services.resourceStore = clone.store;
26251
26248
  }
26252
- if (options.interpolation) clone.services.interpolator = new Interpolator(mergedOptions);
26249
+ if (options.interpolation) {
26250
+ const defOpts = get$1();
26251
+ const mergedInterpolation = {
26252
+ ...defOpts.interpolation,
26253
+ ...this.options.interpolation,
26254
+ ...options.interpolation
26255
+ };
26256
+ const mergedForInterpolator = {
26257
+ ...mergedOptions,
26258
+ interpolation: mergedInterpolation
26259
+ };
26260
+ clone.services.interpolator = new Interpolator(mergedForInterpolator);
26261
+ }
26253
26262
  clone.translator = new Translator(clone.services, mergedOptions);
26254
26263
  clone.translator.on('*', (event, ...args) => {
26255
26264
  clone.emit(event, ...args);
@@ -29001,6 +29010,11 @@ function canonicalize(obj, stack, replacementStack, replacer, key) {
29001
29010
  return canonicalizedObj;
29002
29011
  }
29003
29012
 
29013
+ const INCLUDE_HEADERS = {
29014
+ includeIndex: true,
29015
+ includeUnderline: true,
29016
+ includeFileHeaders: true
29017
+ };
29004
29018
  function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
29005
29019
  let optionsObj;
29006
29020
  if (!options) {
@@ -29130,17 +29144,29 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
29130
29144
  * creates a unified diff patch.
29131
29145
  * @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`)
29132
29146
  */
29133
- function formatPatch(patch) {
29147
+ function formatPatch(patch, headerOptions) {
29148
+ if (!headerOptions) {
29149
+ headerOptions = INCLUDE_HEADERS;
29150
+ }
29134
29151
  if (Array.isArray(patch)) {
29135
- return patch.map(formatPatch).join('\n');
29152
+ if (patch.length > 1 && !headerOptions.includeFileHeaders) {
29153
+ throw new Error('Cannot omit file headers on a multi-file patch. '
29154
+ + '(The result would be unparseable; how would a tool trying to apply '
29155
+ + 'the patch know which changes are to which file?)');
29156
+ }
29157
+ return patch.map(p => formatPatch(p, headerOptions)).join('\n');
29136
29158
  }
29137
29159
  const ret = [];
29138
- if (patch.oldFileName == patch.newFileName) {
29160
+ if (headerOptions.includeIndex && patch.oldFileName == patch.newFileName) {
29139
29161
  ret.push('Index: ' + patch.oldFileName);
29140
29162
  }
29141
- ret.push('===================================================================');
29142
- ret.push('--- ' + patch.oldFileName + (typeof patch.oldHeader === 'undefined' ? '' : '\t' + patch.oldHeader));
29143
- ret.push('+++ ' + patch.newFileName + (typeof patch.newHeader === 'undefined' ? '' : '\t' + patch.newHeader));
29163
+ if (headerOptions.includeUnderline) {
29164
+ ret.push('===================================================================');
29165
+ }
29166
+ if (headerOptions.includeFileHeaders) {
29167
+ ret.push('--- ' + patch.oldFileName + (typeof patch.oldHeader === 'undefined' ? '' : '\t' + patch.oldHeader));
29168
+ ret.push('+++ ' + patch.newFileName + (typeof patch.newHeader === 'undefined' ? '' : '\t' + patch.newHeader));
29169
+ }
29144
29170
  for (let i = 0; i < patch.hunks.length; i++) {
29145
29171
  const hunk = patch.hunks[i];
29146
29172
  // Unified Diff Format quirk: If the chunk size is 0,
@@ -29170,7 +29196,7 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
29170
29196
  if (!patchObj) {
29171
29197
  return;
29172
29198
  }
29173
- return formatPatch(patchObj);
29199
+ return formatPatch(patchObj, options === null || options === void 0 ? void 0 : options.headerOptions);
29174
29200
  }
29175
29201
  else {
29176
29202
  const { callback } = options;
@@ -29179,7 +29205,7 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
29179
29205
  callback(undefined);
29180
29206
  }
29181
29207
  else {
29182
- callback(formatPatch(patchObj));
29208
+ callback(formatPatch(patchObj, options.headerOptions));
29183
29209
  }
29184
29210
  } }));
29185
29211
  }
@@ -54893,10 +54919,32 @@ function requireUtils () {
54893
54919
  hasRequiredUtils = 1;
54894
54920
 
54895
54921
  var formats = requireFormats();
54922
+ var getSideChannel = requireSideChannel();
54896
54923
 
54897
54924
  var has = Object.prototype.hasOwnProperty;
54898
54925
  var isArray = Array.isArray;
54899
54926
 
54927
+ // Track objects created from arrayLimit overflow using side-channel
54928
+ // Stores the current max numeric index for O(1) lookup
54929
+ var overflowChannel = getSideChannel();
54930
+
54931
+ var markOverflow = function markOverflow(obj, maxIndex) {
54932
+ overflowChannel.set(obj, maxIndex);
54933
+ return obj;
54934
+ };
54935
+
54936
+ var isOverflow = function isOverflow(obj) {
54937
+ return overflowChannel.has(obj);
54938
+ };
54939
+
54940
+ var getMaxIndex = function getMaxIndex(obj) {
54941
+ return overflowChannel.get(obj);
54942
+ };
54943
+
54944
+ var setMaxIndex = function setMaxIndex(obj, maxIndex) {
54945
+ overflowChannel.set(obj, maxIndex);
54946
+ };
54947
+
54900
54948
  var hexTable = (function () {
54901
54949
  var array = [];
54902
54950
  for (var i = 0; i < 256; ++i) {
@@ -54946,7 +54994,12 @@ function requireUtils () {
54946
54994
  if (isArray(target)) {
54947
54995
  target.push(source);
54948
54996
  } else if (target && typeof target === 'object') {
54949
- if (
54997
+ if (isOverflow(target)) {
54998
+ // Add at next numeric index for overflow objects
54999
+ var newIndex = getMaxIndex(target) + 1;
55000
+ target[newIndex] = source;
55001
+ setMaxIndex(target, newIndex);
55002
+ } else if (
54950
55003
  (options && (options.plainObjects || options.allowPrototypes))
54951
55004
  || !has.call(Object.prototype, source)
54952
55005
  ) {
@@ -54960,6 +55013,18 @@ function requireUtils () {
54960
55013
  }
54961
55014
 
54962
55015
  if (!target || typeof target !== 'object') {
55016
+ if (isOverflow(source)) {
55017
+ // Create new object with target at 0, source values shifted by 1
55018
+ var sourceKeys = Object.keys(source);
55019
+ var result = options && options.plainObjects
55020
+ ? { __proto__: null, 0: target }
55021
+ : { 0: target };
55022
+ for (var m = 0; m < sourceKeys.length; m++) {
55023
+ var oldKey = parseInt(sourceKeys[m], 10);
55024
+ result[oldKey + 1] = source[sourceKeys[m]];
55025
+ }
55026
+ return markOverflow(result, getMaxIndex(source) + 1);
55027
+ }
54963
55028
  return [target].concat(source);
54964
55029
  }
54965
55030
 
@@ -55131,8 +55196,20 @@ function requireUtils () {
55131
55196
  return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
55132
55197
  };
55133
55198
 
55134
- var combine = function combine(a, b) {
55135
- return [].concat(a, b);
55199
+ var combine = function combine(a, b, arrayLimit, plainObjects) {
55200
+ // If 'a' is already an overflow object, add to it
55201
+ if (isOverflow(a)) {
55202
+ var newIndex = getMaxIndex(a) + 1;
55203
+ a[newIndex] = b;
55204
+ setMaxIndex(a, newIndex);
55205
+ return a;
55206
+ }
55207
+
55208
+ var result = [].concat(a, b);
55209
+ if (result.length > arrayLimit) {
55210
+ return markOverflow(arrayToObject(result, { plainObjects: plainObjects }), result.length - 1);
55211
+ }
55212
+ return result;
55136
55213
  };
55137
55214
 
55138
55215
  var maybeMap = function maybeMap(val, fn) {
@@ -55154,6 +55231,7 @@ function requireUtils () {
55154
55231
  decode: decode,
55155
55232
  encode: encode,
55156
55233
  isBuffer: isBuffer,
55234
+ isOverflow: isOverflow,
55157
55235
  isRegExp: isRegExp,
55158
55236
  maybeMap: maybeMap,
55159
55237
  merge: merge
@@ -55640,16 +55718,18 @@ function requireParse () {
55640
55718
  } else {
55641
55719
  key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
55642
55720
 
55643
- val = utils.maybeMap(
55644
- parseArrayValue(
55645
- part.slice(pos + 1),
55646
- options,
55647
- isArray(obj[key]) ? obj[key].length : 0
55648
- ),
55649
- function (encodedVal) {
55650
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
55651
- }
55652
- );
55721
+ if (key !== null) {
55722
+ val = utils.maybeMap(
55723
+ parseArrayValue(
55724
+ part.slice(pos + 1),
55725
+ options,
55726
+ isArray(obj[key]) ? obj[key].length : 0
55727
+ ),
55728
+ function (encodedVal) {
55729
+ return options.decoder(encodedVal, defaults.decoder, charset, 'value');
55730
+ }
55731
+ );
55732
+ }
55653
55733
  }
55654
55734
 
55655
55735
  if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
@@ -55660,11 +55740,18 @@ function requireParse () {
55660
55740
  val = isArray(val) ? [val] : val;
55661
55741
  }
55662
55742
 
55663
- var existing = has.call(obj, key);
55664
- if (existing && options.duplicates === 'combine') {
55665
- obj[key] = utils.combine(obj[key], val);
55666
- } else if (!existing || options.duplicates === 'last') {
55667
- obj[key] = val;
55743
+ if (key !== null) {
55744
+ var existing = has.call(obj, key);
55745
+ if (existing && options.duplicates === 'combine') {
55746
+ obj[key] = utils.combine(
55747
+ obj[key],
55748
+ val,
55749
+ options.arrayLimit,
55750
+ options.plainObjects
55751
+ );
55752
+ } else if (!existing || options.duplicates === 'last') {
55753
+ obj[key] = val;
55754
+ }
55668
55755
  }
55669
55756
  }
55670
55757
 
@@ -55685,9 +55772,19 @@ function requireParse () {
55685
55772
  var root = chain[i];
55686
55773
 
55687
55774
  if (root === '[]' && options.parseArrays) {
55688
- obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
55689
- ? []
55690
- : utils.combine([], leaf);
55775
+ if (utils.isOverflow(leaf)) {
55776
+ // leaf is already an overflow object, preserve it
55777
+ obj = leaf;
55778
+ } else {
55779
+ obj = options.allowEmptyArrays && (leaf === '' || (options.strictNullHandling && leaf === null))
55780
+ ? []
55781
+ : utils.combine(
55782
+ [],
55783
+ leaf,
55784
+ options.arrayLimit,
55785
+ options.plainObjects
55786
+ );
55787
+ }
55691
55788
  } else {
55692
55789
  obj = options.plainObjects ? { __proto__: null } : {};
55693
55790
  var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
@@ -55715,29 +55812,28 @@ function requireParse () {
55715
55812
  return leaf;
55716
55813
  };
55717
55814
 
55718
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
55719
- if (!givenKey) {
55720
- return;
55721
- }
55722
-
55723
- // Transform dot notation to bracket notation
55815
+ var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
55724
55816
  var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
55725
55817
 
55726
- // The regex chunks
55818
+ if (options.depth <= 0) {
55819
+ if (!options.plainObjects && has.call(Object.prototype, key)) {
55820
+ if (!options.allowPrototypes) {
55821
+ return;
55822
+ }
55823
+ }
55824
+
55825
+ return [key];
55826
+ }
55727
55827
 
55728
55828
  var brackets = /(\[[^[\]]*])/;
55729
55829
  var child = /(\[[^[\]]*])/g;
55730
55830
 
55731
- // Get the parent
55732
-
55733
- var segment = options.depth > 0 && brackets.exec(key);
55831
+ var segment = brackets.exec(key);
55734
55832
  var parent = segment ? key.slice(0, segment.index) : key;
55735
55833
 
55736
- // Stash the parent if it exists
55737
-
55738
55834
  var keys = [];
55835
+
55739
55836
  if (parent) {
55740
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
55741
55837
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
55742
55838
  if (!options.allowPrototypes) {
55743
55839
  return;
@@ -55747,28 +55843,42 @@ function requireParse () {
55747
55843
  keys.push(parent);
55748
55844
  }
55749
55845
 
55750
- // Loop through children appending to the array until we hit depth
55751
-
55752
55846
  var i = 0;
55753
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
55847
+ while ((segment = child.exec(key)) !== null && i < options.depth) {
55754
55848
  i += 1;
55755
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
55849
+
55850
+ var segmentContent = segment[1].slice(1, -1);
55851
+ if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
55756
55852
  if (!options.allowPrototypes) {
55757
55853
  return;
55758
55854
  }
55759
55855
  }
55856
+
55760
55857
  keys.push(segment[1]);
55761
55858
  }
55762
55859
 
55763
- // If there's a remainder, check strictDepth option for throw, else just add whatever is left
55764
-
55765
55860
  if (segment) {
55766
55861
  if (options.strictDepth === true) {
55767
55862
  throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
55768
55863
  }
55864
+
55769
55865
  keys.push('[' + key.slice(segment.index) + ']');
55770
55866
  }
55771
55867
 
55868
+ return keys;
55869
+ };
55870
+
55871
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
55872
+ if (!givenKey) {
55873
+ return;
55874
+ }
55875
+
55876
+ var keys = splitKeyIntoSegments(givenKey, options);
55877
+
55878
+ if (!keys) {
55879
+ return;
55880
+ }
55881
+
55772
55882
  return parseObject(keys, val, options, valuesParsed);
55773
55883
  };
55774
55884
 
@@ -56359,4 +56469,4 @@ var srcExports = requireSrc();
56359
56469
  var tinylr = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
56360
56470
 
56361
56471
  export { HighlightJS as H, MarkdownIt as M, deflist_plugin as a, closest as b, createTwoFilesPatch as c, dedent as d, distance as e, fm as f, globSync as g, glob as h, isCI as i, moduleImporter as j, cliProgress as k, createInstance as l, minimatch as m, fse as n, inter as o, tinylr as t, watch$1 as w };
56362
- //# sourceMappingURL=vendor-Dd3EDAs1.mjs.map
56472
+ //# sourceMappingURL=vendor-Q6b0E6UP.mjs.map