@forsakringskassan/docs-generator 2.18.0 → 2.19.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,10 +3,10 @@
3
3
  var path$1 = require('node:path');
4
4
  var esbuild = require('esbuild');
5
5
  var vue = require('vue');
6
- var vue3 = require('./vue3-CEAR7ggN.js');
6
+ var vue3 = require('./vue3-BhdC7RZQ.js');
7
7
  var path = require('node:path/posix');
8
8
  require('@vue/compiler-sfc');
9
- require('./vendor-Bagon7WF.js');
9
+ require('./vendor-BHA4LIog.js');
10
10
  require('node:url');
11
11
  require('fs');
12
12
  require('node:fs');
@@ -56,7 +56,7 @@ function virtualEntryPlugin(entries) {
56
56
  namespace: pluginName
57
57
  };
58
58
  } else {
59
- return undefined;
59
+ return void 0;
60
60
  }
61
61
  });
62
62
  build.onLoad({ filter: /.*/, namespace: pluginName }, (args) => {
@@ -140,3 +140,4 @@ async function run() {
140
140
  await compileExample(batch);
141
141
  }
142
142
  run();
143
+ //# sourceMappingURL=compile-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile-example.js","sources":["../src/esbuild/virtual-entry-plugin.ts","../src/compile-example.ts"],"sourcesContent":["import path from \"node:path/posix\";\nimport { type Plugin } from \"esbuild\";\n\nconst pluginName = \"virtual-entry\";\n\nexport type VirtualEntries = Record<string, string>;\n\nexport function virtualEntryPlugin(entries: VirtualEntries): Plugin {\n function haveEntry(key: string): boolean {\n return Boolean(entries[key]);\n }\n\n function getEntry(key: string): string {\n return entries[key];\n }\n\n return {\n name: pluginName,\n setup(build) {\n build.onResolve({ filter: /.*/ }, (args) => {\n if (args.kind === \"entry-point\" && haveEntry(args.path)) {\n return {\n path: args.path,\n namespace: pluginName,\n };\n } else {\n return undefined;\n }\n });\n build.onLoad({ filter: /.*/, namespace: pluginName }, (args) => {\n const contents = getEntry(args.path);\n return {\n contents,\n loader: \"ts\",\n resolveDir: path.dirname(args.path),\n };\n });\n },\n };\n}\n","import path from \"node:path\";\nimport { type Plugin, build as esbuild } from \"esbuild\";\nimport { version } from \"vue\";\nimport { vuePlugin as Vue3Plugin } from \"plugin-vue3\";\nimport { virtualEntryPlugin } from \"./esbuild\";\nimport { type ExampleBatch } from \"./examples\";\n\nconst vueMajor = parseInt(version.split(\".\", 2)[0], 10) as 2 | 3;\nconst tsconfig = path.join(__dirname, \"../tsconfig-examples.json\");\n\nfunction stripExtension(filename: string): string {\n return filename.replace(\".js\", \"\");\n}\n\nfunction VuePlugin(): Plugin {\n switch (vueMajor) {\n case 2:\n throw new Error(\n \"Vue 2 is no longer supported, upgrade to Vue 3 or downgrade docs-generator\",\n );\n case 3:\n return Vue3Plugin();\n }\n}\n\nasync function compileExample(batch: ExampleBatch): Promise<void> {\n const { outputFolder: outdir, external, tasks } = batch;\n const entryPoints = tasks.map((it) => {\n return { in: it.sourceFile, out: stripExtension(it.outputFile) };\n });\n const virtualEntries = tasks.map((it): [key: string, value: string] => {\n return [`./${it.sourceFile}`, it.sourcecode];\n });\n const iconLib = process.env.DOCS_ICON_LIB ?? \"@fkui/icon-lib-default\";\n try {\n await esbuild({\n entryPoints,\n outdir,\n bundle: true,\n format: \"iife\",\n platform: \"browser\",\n external,\n tsconfig,\n define: {\n \"process.env.NODE_ENV\": JSON.stringify(\"development\"),\n \"process.env.DOCS_ICON_LIB\": JSON.stringify(iconLib),\n },\n plugins: [\n virtualEntryPlugin(Object.fromEntries(virtualEntries)),\n VuePlugin(),\n ],\n });\n } catch (err) {\n /* eslint-disable-next-line no-console -- expected to log */\n console.error(err);\n process.exitCode = 1;\n }\n}\n\nasync function readBatchData(): Promise<ExampleBatch> {\n const { stdin } = process;\n return new Promise((resolve, reject) => {\n const chunks: Buffer[] = [];\n stdin.on(\"data\", (chunk) => {\n chunks.push(chunk);\n });\n stdin.on(\"end\", () => {\n const content = Buffer.concat(chunks).toString(\"utf-8\");\n const parsed = JSON.parse(content);\n resolve(parsed);\n });\n stdin.on(\"error\", (error) => {\n reject(error);\n });\n });\n}\n\nasync function run(): Promise<void> {\n const batch = await readBatchData();\n await compileExample(batch);\n}\n\nrun();\n"],"names":["version","path","Vue3Plugin","esbuild"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,UAAa,GAAA,eAAA;AAIZ,SAAS,mBAAmB,OAAiC,EAAA;AAChE,EAAA,SAAS,UAAU,GAAsB,EAAA;AACrC,IAAO,OAAA,OAAA,CAAQ,OAAQ,CAAA,GAAG,CAAC,CAAA;AAAA;AAG/B,EAAA,SAAS,SAAS,GAAqB,EAAA;AACnC,IAAA,OAAO,QAAQ,GAAG,CAAA;AAAA;AAGtB,EAAO,OAAA;AAAA,IACH,IAAM,EAAA,UAAA;AAAA,IACN,MAAM,KAAO,EAAA;AACT,MAAA,KAAA,CAAM,UAAU,EAAE,MAAA,EAAQ,IAAK,EAAA,EAAG,CAAC,IAAS,KAAA;AACxC,QAAA,IAAI,KAAK,IAAS,KAAA,aAAA,IAAiB,SAAU,CAAA,IAAA,CAAK,IAAI,CAAG,EAAA;AACrD,UAAO,OAAA;AAAA,YACH,MAAM,IAAK,CAAA,IAAA;AAAA,YACX,SAAW,EAAA;AAAA,WACf;AAAA,SACG,MAAA;AACH,UAAO,OAAA,MAAA;AAAA;AACX,OACH,CAAA;AACD,MAAM,KAAA,CAAA,MAAA,CAAO,EAAE,MAAQ,EAAA,IAAA,EAAM,WAAW,UAAW,EAAA,EAAG,CAAC,IAAS,KAAA;AAC5D,QAAM,MAAA,QAAA,GAAW,QAAS,CAAA,IAAA,CAAK,IAAI,CAAA;AACnC,QAAO,OAAA;AAAA,UACH,QAAA;AAAA,UACA,MAAQ,EAAA,IAAA;AAAA,UACR,UAAY,EAAA,IAAA,CAAK,OAAQ,CAAA,IAAA,CAAK,IAAI;AAAA,SACtC;AAAA,OACH,CAAA;AAAA;AACL,GACJ;AACJ;;AChCA,MAAM,QAAA,GAAW,SAASA,WAAQ,CAAA,KAAA,C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@
1
1
  'use strict';
2
2
 
3
- var vendor = require('./vendor-Bagon7WF.js');
3
+ var vendor = require('./vendor-BHA4LIog.js');
4
4
  var path = require('node:path/posix');
5
5
  var path$1 = require('node:path');
6
6
  require('crypto');
@@ -8,7 +8,11 @@ var crypto = require('node:crypto');
8
8
  require('node:child_process');
9
9
  var fs = require('node:fs');
10
10
  var vue = require('vue');
11
- var vue3 = require('./vue3-CEAR7ggN.js');
11
+ var vue3 = require('./vue3-BhdC7RZQ.js');
12
+
13
+ function isDocumentPage(doc) {
14
+ return doc.kind === "page";
15
+ }
12
16
 
13
17
  function findDocument(haystack, needle) {
14
18
  const match = haystack.find((it) => {
@@ -131,6 +135,105 @@ function getExampleName(filename) {
131
135
  return path$1.parse(filename).name;
132
136
  }
133
137
 
138
+ const vueMajor = parseInt(vue.version.split(".", 2)[0], 10);
139
+ function vueGenerator() {
140
+ switch (vueMajor) {
141
+ case 2:
142
+ throw new Error(
143
+ "Vue 2 is no longer supported, upgrade to Vue 3 or downgrade docs-generator"
144
+ );
145
+ case 3:
146
+ return vue3.generateCode;
147
+ }
148
+ }
149
+ function generateExample(options) {
150
+ const { language } = options;
151
+ if (language === "import") {
152
+ const parsed = parseImport(options.source);
153
+ const filename = getExampleImport(
154
+ options.exampleFolders,
155
+ parsed.filename
156
+ );
157
+ const language2 = parsed.extension;
158
+ const comments = parsed.comments;
159
+ const content = fs.readFileSync(filename, "utf-8");
160
+ const example = generateExample({
161
+ ...options,
162
+ source: content,
163
+ language: language2,
164
+ filename
165
+ });
166
+ return { ...example, comments };
167
+ }
168
+ switch (language) {
169
+ case "vue":
170
+ return generateVueExample(options);
171
+ case "html":
172
+ return generateStaticExample(options);
173
+ default:
174
+ return generateStaticExample(options);
175
+ }
176
+ }
177
+ function generateVueExample(options) {
178
+ const { filename, source, parent, setupPath, tags } = options;
179
+ const fn = vueGenerator();
180
+ const slug = getExampleName(filename);
181
+ const fingerprint = getFingerprint(source);
182
+ const { markup, sourcecode, output } = fn({
183
+ filename,
184
+ slug,
185
+ fingerprint,
186
+ code: source,
187
+ setupPath
188
+ });
189
+ if (output) {
190
+ return {
191
+ source,
192
+ language: options.language,
193
+ comments: [],
194
+ tags,
195
+ markup,
196
+ output,
197
+ runtime: true,
198
+ task: {
199
+ outputFile: output,
200
+ sourcecode,
201
+ sourceFile: filename,
202
+ parent
203
+ }
204
+ };
205
+ } else {
206
+ return {
207
+ source: sourcecode,
208
+ language: "plaintext",
209
+ comments: [],
210
+ tags,
211
+ markup,
212
+ output: null,
213
+ runtime: true,
214
+ task: null
215
+ };
216
+ }
217
+ }
218
+ function generateStaticExample(options) {
219
+ const { filename, source, language, tags } = options;
220
+ const slug = getExampleName(filename);
221
+ const fingerprint = getFingerprint(source);
222
+ const asset = `${slug}-${fingerprint}.${language}`;
223
+ const runtimeLanguages = ["html"];
224
+ const runtime = runtimeLanguages.includes(language);
225
+ return {
226
+ source,
227
+ language: options.language,
228
+ comments: [],
229
+ tags,
230
+ markup: source,
231
+ output: runtime ? asset : null,
232
+ runtime,
233
+ task: null
234
+ };
235
+ }
236
+
134
237
  function normalizeLanguage(lang) {
135
238
  switch (lang) {
136
239
  case "ts":
@@ -142,6 +245,14 @@ function normalizeLanguage(lang) {
142
245
  }
143
246
  }
144
247
 
248
+ function parseInfostring(infostring) {
249
+ const [rawLanguage, ...rawTags] = infostring.trim().split(/\s+/);
250
+ return {
251
+ language: normalizeLanguage(rawLanguage),
252
+ tags: rawTags
253
+ };
254
+ }
255
+
145
256
  function removeLinesInline(lines, { begin, end }) {
146
257
  for (let i = begin; i <= end; i++) {
147
258
  lines[i] = "";
@@ -238,114 +349,6 @@ function transformCode(code, lang) {
238
349
  return code;
239
350
  }
240
351
 
241
- const vueMajor = parseInt(vue.version.split(".", 2)[0], 10);
242
- function vueGenerator() {
243
- switch (vueMajor) {
244
- case 2:
245
- throw new Error(
246
- "Vue 2 is no longer supported, upgrade to Vue 3 or downgrade docs-generator"
247
- );
248
- case 3:
249
- return vue3.generateCode;
250
- }
251
- }
252
- function generateExample(options) {
253
- const { language } = options;
254
- if (language === "import") {
255
- const parsed = parseImport(options.source);
256
- const filename = getExampleImport(
257
- options.exampleFolders,
258
- parsed.filename
259
- );
260
- const language2 = parsed.extension;
261
- const comments = parsed.comments;
262
- const content = fs.readFileSync(filename, "utf-8");
263
- const source = transformCode(content, language2);
264
- const example = generateExample({
265
- ...options,
266
- source,
267
- language: language2,
268
- filename
269
- });
270
- return { ...example, comments };
271
- }
272
- switch (language) {
273
- case "vue":
274
- return generateVueExample(options);
275
- case "html":
276
- return generateStaticExample(options);
277
- default:
278
- return generateStaticExample(options);
279
- }
280
- }
281
- function generateVueExample(options) {
282
- const { filename, source, parent, setupPath, tags } = options;
283
- const fn = vueGenerator();
284
- const slug = getExampleName(filename);
285
- const fingerprint = getFingerprint(source);
286
- const { markup, sourcecode, output } = fn({
287
- filename,
288
- slug,
289
- fingerprint,
290
- code: source,
291
- setupPath
292
- });
293
- if (output) {
294
- return {
295
- source,
296
- language: options.language,
297
- comments: [],
298
- tags,
299
- markup,
300
- output,
301
- runtime: true,
302
- task: {
303
- outputFile: output,
304
- sourcecode,
305
- sourceFile: filename,
306
- parent
307
- }
308
- };
309
- } else {
310
- return {
311
- source: sourcecode,
312
- language: "plaintext",
313
- comments: [],
314
- tags,
315
- markup,
316
- output: null,
317
- runtime: true,
318
- task: null
319
- };
320
- }
321
- }
322
- function generateStaticExample(options) {
323
- const { filename, source, language, tags } = options;
324
- const slug = getExampleName(filename);
325
- const fingerprint = getFingerprint(source);
326
- const asset = `${slug}-${fingerprint}.${language}`;
327
- const runtimeLanguages = ["html"];
328
- const runtime = runtimeLanguages.includes(language);
329
- return {
330
- source,
331
- language: options.language,
332
- comments: [],
333
- tags,
334
- markup: source,
335
- output: runtime ? asset : null,
336
- runtime,
337
- task: null
338
- };
339
- }
340
-
341
- function parseInfostring(infostring) {
342
- const [rawLanguage, ...rawTags] = infostring.trim().split(/\s+/);
343
- return {
344
- language: normalizeLanguage(rawLanguage),
345
- tags: rawTags
346
- };
347
- }
348
-
349
352
  class SoftError extends Error {
350
353
  code;
351
354
  details;
@@ -447,6 +450,17 @@ const linkTag = {
447
450
  }
448
451
  );
449
452
  }
453
+ if (!isDocumentPage(linked)) {
454
+ throw new SoftError(
455
+ "ELINKPARTIAL",
456
+ `Cannot link to partial document "${key}"`,
457
+ {
458
+ key,
459
+ hash,
460
+ title: explicitTitle
461
+ }
462
+ );
463
+ }
450
464
  const url = getRelativeUrl(doc, linked);
451
465
  const title = getLinkTitle(linked, key, explicitTitle);
452
466
  return `<a href="${url}${hash ?? ""}">${title}</a>`;
@@ -560,7 +574,7 @@ function getSource(content, language, tags, { namedExamples }) {
560
574
  function codePreview(options) {
561
575
  const { generateExample } = options;
562
576
  return (md) => {
563
- md.renderer.rules.fence = fence.bind(undefined, md);
577
+ md.renderer.rules.fence = fence.bind(void 0, md);
564
578
  };
565
579
  function fence(_md, tokens, idx, _options, env) {
566
580
  const { fileInfo } = env;
@@ -605,7 +619,7 @@ function codePreview(options) {
605
619
  const highlightedCode = replaceAtLink(
606
620
  highlight({ source: transformedCode, language: example.language })
607
621
  );
608
- const testId = findTestId(tags);
622
+ const testId = findTestId(tags) ?? findTag(tags, "name")?.value;
609
623
  const liveExample = tags.includes("live-example");
610
624
  const staticCode = example.runtime === false || tags.includes("static");
611
625
  const noMarkup = tags.includes("nomarkup");
@@ -794,9 +808,11 @@ function altContainer(context) {
794
808
  return (tokens, index) => {
795
809
  const token = tokens[index];
796
810
  const needle = token.info;
811
+ const tags = token.info.trim().split(/\s+/);
797
812
  const doc = findDocument(docs, needle);
798
813
  if (doc && doc.format === "markdown") {
799
- return md.render(doc.body, env);
814
+ const body = typeof doc.body === "string" ? doc.body : doc.body(tags);
815
+ return md.render(body, env);
800
816
  }
801
817
  return md.render(token.content, env);
802
818
  };
@@ -807,6 +823,7 @@ function apiContainer(context) {
807
823
  return (tokens, index) => {
808
824
  const token = tokens[index];
809
825
  const needle = token.content.trim();
826
+ const tags = token.info.trim().split(/\s+/);
810
827
  const doc = findDocument(docs, needle);
811
828
  if (!doc) {
812
829
  return handleSoftError(
@@ -817,7 +834,9 @@ function apiContainer(context) {
817
834
  )
818
835
  );
819
836
  }
820
- if (included.has(doc.id)) {
837
+ const key = [doc.id, ...tags].join("|");
838
+ const loop = included.get(doc.id);
839
+ if (loop && loop !== context.doc.id) {
821
840
  return handleSoftError(
822
841
  new SoftError(
823
842
  "EINCLUDERECURSION",
@@ -825,15 +844,16 @@ function apiContainer(context) {
825
844
  )
826
845
  );
827
846
  }
828
- included.add(doc.id);
847
+ included.set(key, context.doc.id);
848
+ const body = typeof doc.body === "string" ? doc.body : doc.body(tags);
829
849
  if (doc.format === "html") {
830
- return doc.body.replace(
850
+ return body.replace(
831
851
  /* replace `<next-heading-level>` and `</next-heading-level>` with actual h-tags */
832
852
  /(?<=<\/?)next-heading-level/g,
833
853
  `h${String(env.currentHeading + 1)}`
834
854
  );
835
855
  }
836
- const content = md.render(doc.body, env);
856
+ const content = md.render(body, env);
837
857
  return (
838
858
  /* HTML */
839
859
  ` <div>${content}</div> `
@@ -988,11 +1008,14 @@ function containerParser(md, options) {
988
1008
  md.renderer.rules[`doc_${kind}`] = fn;
989
1009
  }
990
1010
  }
991
- function containerRenderer(docs, env, included, handleSoftError, options) {
1011
+ function containerRenderer(doc, docs, env, included, handleSoftError, options) {
992
1012
  return function(md) {
993
1013
  const context = {
994
1014
  md,
995
1015
  env,
1016
+ get doc() {
1017
+ return doc();
1018
+ },
996
1019
  docs,
997
1020
  included,
998
1021
  handleSoftError
@@ -1049,7 +1072,16 @@ function createMarkdownRenderer(options) {
1049
1072
  currentHeading: 1,
1050
1073
  namedExamples: /* @__PURE__ */ new Map()
1051
1074
  };
1052
- const included = /* @__PURE__ */ new Set();
1075
+ let currentDoc = null;
1076
+ const getCurrentDocument = () => {
1077
+ if (!currentDoc) {
1078
+ throw new Error(
1079
+ "Internal error: getting current document before rendering has started"
1080
+ );
1081
+ }
1082
+ return currentDoc;
1083
+ };
1084
+ const included = /* @__PURE__ */ new Map();
1053
1085
  const md = vendor.MarkdownIt({
1054
1086
  html: true
1055
1087
  });
@@ -1066,16 +1098,24 @@ function createMarkdownRenderer(options) {
1066
1098
  })
1067
1099
  );
1068
1100
  md.use(
1069
- containerRenderer(docs, env, included, options.handleSoftError, {
1070
- messagebox: { title: {}, ...options.messagebox }
1071
- })
1101
+ containerRenderer(
1102
+ getCurrentDocument,
1103
+ docs,
1104
+ env,
1105
+ included,
1106
+ options.handleSoftError,
1107
+ {
1108
+ messagebox: { title: {}, ...options.messagebox }
1109
+ }
1110
+ )
1072
1111
  );
1073
1112
  md.use(table());
1074
1113
  md.use(codeInline());
1075
1114
  return {
1076
1115
  render(doc, content) {
1116
+ currentDoc = doc;
1077
1117
  included.clear();
1078
- included.add(doc.id);
1118
+ included.set(doc.id, doc.id);
1079
1119
  env.fileInfo = doc.fileInfo;
1080
1120
  env.ids = /* @__PURE__ */ new Set();
1081
1121
  const html = md.render(content, env);
@@ -1099,5 +1139,7 @@ exports.getFingerprint = getFingerprint;
1099
1139
  exports.getOutputFilePath = getOutputFilePath;
1100
1140
  exports.hasTag = hasTag;
1101
1141
  exports.htmlencode = htmlencode;
1142
+ exports.isDocumentPage = isDocumentPage;
1102
1143
  exports.normalizePath = normalizePath;
1103
1144
  exports.parseInfostring = parseInfostring;
1145
+ //# sourceMappingURL=create-markdown-renderer-CbE5KJoX.js.map