@forsakringskassan/docs-generator 3.1.2 → 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.
@@ -209,6 +209,54 @@ export declare interface FileInfo {
209
209
  outputName: string | false;
210
210
  }
211
211
 
212
+ /**
213
+ * Resolve a link from a `{@link ...}` tag.
214
+ *
215
+ * Link resolvers are processed in order, the first resolver returning a result
216
+ * is used. If your resolver cannot resolve the link it must return `null` or
217
+ * `undefined`.
218
+ *
219
+ * If the key matches a document (by id, name or alias) the document is passed
220
+ * in as a parameter.
221
+ *
222
+ * @example
223
+ * ```ts
224
+ * const linkResolver: LinkResolver = ({ key, title }) => {
225
+ * if (key === "foo") {
226
+ * return {
227
+ * href: "https://example.net/foo",
228
+ * title,
229
+ * rel: "external",
230
+ * };
231
+ * }
232
+ * return null;
233
+ * };
234
+ * ```
235
+ *
236
+ * @public
237
+ * @since %version%
238
+ * @param link - Link data
239
+ * @returns A resolved link or `null` or `undefined` if this resolver cannot
240
+ * handle this link
241
+ */
242
+ export declare type LinkResolver = (this: void, link: {
243
+ /** Key (without hash) referenced by user */
244
+ readonly key: string;
245
+ /** Optional hash from key (includes the `#` prefix) */
246
+ readonly hash: string | null;
247
+ /** Optional explicit title requested by user */
248
+ readonly title: string | null;
249
+ /** Matching document if one was found */
250
+ readonly doc: Document_2 | null;
251
+ }) => {
252
+ /** Link target (href attribute of the `<a>` element) */
253
+ readonly href: string;
254
+ /** Link text */
255
+ readonly title: string;
256
+ /** If given, the `rel` attribute is set with this value on the `<a>` element */
257
+ readonly rel?: "external";
258
+ } | undefined | null;
259
+
212
260
  /**
213
261
  * Options for [[createMarkdownRenderer]].
214
262
  *
@@ -247,6 +295,8 @@ export declare interface MarkdownOptions {
247
295
  /** Default titles for messageboxes */
248
296
  title?: Record<string, string>;
249
297
  };
298
+ /** List of link resolvers to use */
299
+ readonly linkResolvers?: LinkResolver[] | undefined;
250
300
  }
251
301
 
252
302
  /**
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-fg4eQJx_.mjs';
6
- import './vendor-DWCXj2K2.mjs';
5
+ export { S as SoftError, c as createMarkdownRenderer } from './create-markdown-renderer-DLvvsGCZ.mjs';
6
+ import './vendor-DR1Vkbzf.mjs';
7
7
  import 'node:url';
8
8
  import 'node:path';
9
9
  import 'fs';
@@ -1147,15 +1147,16 @@ var require_range = __commonJS({
1147
1147
  };
1148
1148
  var replaceTilde = (comp, options) => {
1149
1149
  const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1150
+ const z = options.includePrerelease ? "-0" : "";
1150
1151
  return comp.replace(r, (_, M, m, p, pr) => {
1151
1152
  debug("tilde", comp, _, M, m, p, pr);
1152
1153
  let ret;
1153
1154
  if (isX(M)) {
1154
1155
  ret = "";
1155
1156
  } else if (isX(m)) {
1156
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1157
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1157
1158
  } else if (isX(p)) {
1158
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1159
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1159
1160
  } else if (pr) {
1160
1161
  debug("replaceTilde pr", pr);
1161
1162
  ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
package/dist/runtime.mjs CHANGED
@@ -1508,7 +1508,7 @@ function isRegex(value2) {
1508
1508
  function createDOMPurify() {
1509
1509
  let window3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
1510
1510
  const DOMPurify = (root4) => createDOMPurify(root4);
1511
- DOMPurify.version = "3.4.10";
1511
+ DOMPurify.version = "3.4.11";
1512
1512
  DOMPurify.removed = [];
1513
1513
  if (!window3 || !window3.document || window3.document.nodeType !== NODE_TYPE.document || !window3.Element) {
1514
1514
  DOMPurify.isSupported = false;
@@ -1627,6 +1627,8 @@ function createDOMPurify() {
1627
1627
  let SAFE_FOR_XML = true;
1628
1628
  let WHOLE_DOCUMENT = false;
1629
1629
  let SET_CONFIG = false;
1630
+ let SET_CONFIG_ALLOWED_TAGS = null;
1631
+ let SET_CONFIG_ALLOWED_ATTR = null;
1630
1632
  let FORCE_BODY = false;
1631
1633
  let RETURN_DOM = false;
1632
1634
  let RETURN_DOM_FRAGMENT = false;
@@ -1872,12 +1874,6 @@ function createDOMPurify() {
1872
1874
  emptyHTML = _createTrustedHTML("");
1873
1875
  }
1874
1876
  }
1875
- if ((hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) && ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
1876
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
1877
- }
1878
- if (hooks.uponSanitizeAttribute.length > 0 && ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
1879
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
1880
- }
1881
1877
  if (freeze) {
1882
1878
  freeze(cfg);
1883
1879
  }
@@ -2470,9 +2466,18 @@ function createDOMPurify() {
2470
2466
  if (!DOMPurify.isSupported) {
2471
2467
  return dirty;
2472
2468
  }
2473
- if (!SET_CONFIG) {
2469
+ if (SET_CONFIG) {
2470
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
2471
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
2472
+ } else {
2474
2473
  _parseConfig(cfg);
2475
2474
  }
2475
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
2476
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
2477
+ }
2478
+ if (hooks.uponSanitizeAttribute.length > 0) {
2479
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
2480
+ }
2476
2481
  DOMPurify.removed = [];
2477
2482
  const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
2478
2483
  if (inPlace) {
@@ -2572,10 +2577,14 @@ function createDOMPurify() {
2572
2577
  let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2573
2578
  _parseConfig(cfg);
2574
2579
  SET_CONFIG = true;
2580
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2581
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2575
2582
  };
2576
2583
  DOMPurify.clearConfig = function() {
2577
2584
  CONFIG = null;
2578
2585
  SET_CONFIG = false;
2586
+ SET_CONFIG_ALLOWED_TAGS = null;
2587
+ SET_CONFIG_ALLOWED_ATTR = null;
2579
2588
  trustedTypesPolicy = defaultTrustedTypesPolicy;
2580
2589
  emptyHTML = "";
2581
2590
  };
@@ -2591,9 +2600,15 @@ function createDOMPurify() {
2591
2600
  if (typeof hookFunction !== "function") {
2592
2601
  return;
2593
2602
  }
2603
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2604
+ return;
2605
+ }
2594
2606
  arrayPush(hooks[entryPoint], hookFunction);
2595
2607
  };
2596
2608
  DOMPurify.removeHook = function(entryPoint, hookFunction) {
2609
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2610
+ return void 0;
2611
+ }
2597
2612
  if (hookFunction !== void 0) {
2598
2613
  const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2599
2614
  return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
@@ -2601,6 +2616,9 @@ function createDOMPurify() {
2601
2616
  return arrayPop(hooks[entryPoint]);
2602
2617
  };
2603
2618
  DOMPurify.removeHooks = function(entryPoint) {
2619
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2620
+ return;
2621
+ }
2604
2622
  hooks[entryPoint] = [];
2605
2623
  };
2606
2624
  DOMPurify.removeAllHooks = function() {
@@ -33056,7 +33074,7 @@ var init_globalThis = __esm({
33056
33074
  "node_modules/es-toolkit/dist/_internal/globalThis.mjs"() {
33057
33075
  globalThis_ = typeof globalThis === "object" && globalThis || typeof window === "object" && window || typeof self === "object" && self || typeof global === "object" && global || /* @__PURE__ */ (function() {
33058
33076
  return this;
33059
- })() || Function("return this")();
33077
+ })();
33060
33078
  }
33061
33079
  });
33062
33080
 
@@ -33637,7 +33655,7 @@ function isEmpty(value2) {
33637
33655
  if (typeof value2.splice !== "function" && typeof value2 !== "string" && !isBuffer(value2) && !isTypedArray2(value2) && !isArguments(value2)) return false;
33638
33656
  return value2.length === 0;
33639
33657
  }
33640
- if (typeof value2 === "object") {
33658
+ if (typeof value2 === "object" || typeof value2 === "function") {
33641
33659
  if (value2 instanceof Map || value2 instanceof Set) return value2.size === 0;
33642
33660
  const keys3 = Object.keys(value2);
33643
33661
  if (isPrototype(value2)) return keys3.filter((x6) => x6 !== "constructor").length === 0;
@@ -35931,7 +35949,7 @@ function dedent(templ) {
35931
35949
  return arr;
35932
35950
  }, []);
35933
35951
  if (indentLengths.length) {
35934
- var pattern_1 = new RegExp("\n[ ]{" + Math.min.apply(Math, indentLengths) + "}", "g");
35952
+ var pattern_1 = new RegExp("\n[ ]{".concat(Math.min.apply(Math, indentLengths), "}"), "g");
35935
35953
  strings = strings.map(function(str2) {
35936
35954
  return str2.replace(pattern_1, "\n");
35937
35955
  });
@@ -35944,7 +35962,7 @@ function dedent(templ) {
35944
35962
  var indentedValue = value2;
35945
35963
  if (typeof value2 === "string" && value2.includes("\n")) {
35946
35964
  indentedValue = String(value2).split("\n").map(function(str2, i6) {
35947
- return i6 === 0 ? str2 : "" + endentation + str2;
35965
+ return i6 === 0 ? str2 : "".concat(endentation).concat(str2);
35948
35966
  }).join("\n");
35949
35967
  }
35950
35968
  string3 += indentedValue + strings[i5 + 1];
@@ -172968,7 +172986,7 @@ export {
172968
172986
  /*! Bundled license information:
172969
172987
 
172970
172988
  dompurify/dist/purify.es.mjs:
172971
- (*! @license DOMPurify 3.4.10 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.10/LICENSE *)
172989
+ (*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
172972
172990
 
172973
172991
  mermaid/dist/chunks/mermaid.core/chunk-XPW4576I.mjs:
172974
172992
  (*! Bundled license information:
@@ -47851,7 +47851,10 @@ function requireSideChannel () {
47851
47851
  var channel = {
47852
47852
  assert: function (key) {
47853
47853
  if (!channel.has(key)) {
47854
- throw new $TypeError('Side channel does not contain ' + inspect(key));
47854
+ var keyDesc = key && Object(key) === key
47855
+ ? 'the given object key'
47856
+ : inspect(key);
47857
+ throw new $TypeError('Side channel does not contain ' + keyDesc);
47855
47858
  }
47856
47859
  },
47857
47860
  'delete': function (key) {
@@ -47871,7 +47874,7 @@ function requireSideChannel () {
47871
47874
  $channelData.set(key, value);
47872
47875
  }
47873
47876
  };
47874
- // @ts-expect-error TODO: figure out why this is erroring
47877
+
47875
47878
  return channel;
47876
47879
  };
47877
47880
  return sideChannel;
@@ -70103,4 +70106,4 @@ var typescript = /*#__PURE__*/Object.freeze({
70103
70106
  });
70104
70107
 
70105
70108
  export { HighlightJS as H, MarkdownIt as M, Ze$a 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$2 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$6 as t, watch$1 as w };
70106
- //# sourceMappingURL=vendor-DWCXj2K2.mjs.map
70109
+ //# sourceMappingURL=vendor-DR1Vkbzf.mjs.map