@forsakringskassan/docs-generator 1.33.0 → 2.0.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.
@@ -3,8 +3,7 @@
3
3
  var path$1 = require('node:path');
4
4
  var esbuild = require('esbuild');
5
5
  var vue = require('vue');
6
- var vue2 = require('./vue2-BJo6OAwR.js');
7
- var vue3 = require('./vue3-C37GopjU.js');
6
+ var vue3 = require('./vue3-DIgl9PAu.js');
8
7
  var path = require('node:path/posix');
9
8
  require('@vue/compiler-sfc');
10
9
  require('./vendor-DD1glhBC.js');
@@ -82,7 +81,9 @@ function stripExtension(filename) {
82
81
  function VuePlugin() {
83
82
  switch (vueMajor) {
84
83
  case 2:
85
- return vue2.export_vuePlugin({ workers: false });
84
+ throw new Error(
85
+ "Vue 2 is no longer supported, upgrade to Vue 3 or downgrade docs-generator"
86
+ );
86
87
  case 3:
87
88
  return vue3.export_vuePlugin();
88
89
  }
@@ -170,7 +170,7 @@ function findTestId(tags) {
170
170
  const tag = tags.find((it) => {
171
171
  return it.startsWith(prefix);
172
172
  });
173
- const match = tag == null ? void 0 : tag.match(/^test-id=(?:"([^"]+)"|'([^']+)'|([^'"]+))$/);
173
+ const match = tag?.match(/^test-id=(?:"([^"]+)"|'([^']+)'|([^'"]+))$/);
174
174
  if (!match) {
175
175
  return null;
176
176
  }
@@ -274,7 +274,7 @@ function codePreview(options) {
274
274
  tags: rawTags
275
275
  });
276
276
  const { tags } = example;
277
- const hashContent = `${map == null ? void 0 : map[0]}:${map == null ? void 0 : map[1]}:${info}:${source}`;
277
+ const hashContent = `${map?.[0]}:${map?.[1]}:${info}:${source}`;
278
278
  const fingerprint = getFingerprint(hashContent);
279
279
  const highlightedCode = replaceAtLink(highlight(example));
280
280
  const testId = findTestId(tags);
@@ -401,10 +401,9 @@ function headingLevel(options) {
401
401
  let counter = 1;
402
402
  return function(md) {
403
403
  md.renderer.rules.heading_open = function(tokens, idx, _options, env) {
404
- var _a;
405
404
  const { ids } = env;
406
405
  const { tag } = tokens[idx];
407
- const title = getTokensText(((_a = tokens[idx + 1]) == null ? void 0 : _a.children) ?? []);
406
+ const title = getTokensText(tokens[idx + 1]?.children ?? []);
408
407
  let id = generateId(title);
409
408
  if (ids.has(id)) {
410
409
  id += `--${counter++}`;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  var fs = require('node:fs/promises');
4
4
  var path = require('node:path');
5
5
  var vendor = require('./vendor-DD1glhBC.js');
6
- var createMarkdownRenderer = require('./create-markdown-renderer-CjwHt5p0.js');
6
+ var createMarkdownRenderer = require('./create-markdown-renderer-Blvx866w.js');
7
7
  var require$$1 = require('crypto');
8
8
  require('node:crypto');
9
9
  var vueDocgenApi = require('vue-docgen-api');
@@ -15,8 +15,7 @@ var esbuild = require('esbuild');
15
15
  var util = require('node:util');
16
16
  var nunjucks = require('nunjucks');
17
17
  var vue = require('vue');
18
- var vue2 = require('./vue2-BJo6OAwR.js');
19
- var vue3 = require('./vue3-C37GopjU.js');
18
+ var vue3 = require('./vue3-DIgl9PAu.js');
20
19
  var express = require('express');
21
20
  var childProcess = require('node:child_process');
22
21
  require('fs');
@@ -272,15 +271,14 @@ async function frontMatterFileReader(filePath, basePath) {
272
271
  const EMPTY_CHAR = "‐";
273
272
  const EM_DASH = "—";
274
273
  function translateProps(props) {
275
- var _a, _b;
276
274
  const translatedProps = [];
277
275
  for (const prop of props) {
278
276
  const translatedProp = {
279
277
  name: prop.name,
280
278
  description: prop.description ?? EMPTY_CHAR,
281
- type: ((_a = prop.type) == null ? void 0 : _a.name) ?? EMPTY_CHAR,
279
+ type: prop.type?.name ?? EMPTY_CHAR,
282
280
  required: prop.required ? "true" : "false",
283
- default: ((_b = prop.defaultValue) == null ? void 0 : _b.value) ?? EMPTY_CHAR
281
+ default: prop.defaultValue?.value ?? EMPTY_CHAR
284
282
  };
285
283
  translatedProps.push(translatedProp);
286
284
  }
@@ -745,10 +743,16 @@ function getExampleName(filename) {
745
743
  }
746
744
 
747
745
  const vueMajor = parseInt(vue.version.split(".", 2)[0], 10);
748
- const vueGenerator = {
749
- [2]: vue2.generateCode,
750
- [3]: vue3.generateCode
751
- };
746
+ function vueGenerator() {
747
+ switch (vueMajor) {
748
+ case 2:
749
+ throw new Error(
750
+ "Vue 2 is no longer supported, upgrade to Vue 3 or downgrade docs-generator"
751
+ );
752
+ case 3:
753
+ return vue3.generateCode;
754
+ }
755
+ }
752
756
  function generateExample(options) {
753
757
  const { language } = options;
754
758
  if (language === "import") {
@@ -779,7 +783,7 @@ function generateExample(options) {
779
783
  }
780
784
  function generateVueExample(options) {
781
785
  const { filename, source, parent, setupPath, tags } = options;
782
- const fn = vueGenerator[vueMajor];
786
+ const fn = vueGenerator();
783
787
  const slug = getExampleName(filename);
784
788
  const fingerprint = createMarkdownRenderer.getFingerprint(source);
785
789
  const { markup, sourcecode, output } = fn({
@@ -1450,7 +1454,7 @@ function findExamples(doc) {
1450
1454
  md.renderer.rules.fence = (tokens, idx) => {
1451
1455
  const { content, info, map } = tokens[idx];
1452
1456
  const [language, ...tags] = info.split(/\s+/);
1453
- const hashContent = `${map == null ? void 0 : map[0]}:${map == null ? void 0 : map[1]}:${info}:${content}`;
1457
+ const hashContent = `${map?.[0]}:${map?.[1]}:${info}:${content}`;
1454
1458
  const fingerprint = createMarkdownRenderer.getFingerprint(hashContent);
1455
1459
  collected.push({
1456
1460
  selector: `#example-${fingerprint}`,
package/dist/markdown.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var createMarkdownRenderer = require('./create-markdown-renderer-CjwHt5p0.js');
3
+ var createMarkdownRenderer = require('./create-markdown-renderer-Blvx866w.js');
4
4
  require('./vendor-DD1glhBC.js');
5
5
  require('node:url');
6
6
  require('node:path');