@forsakringskassan/docs-generator 2.2.2 → 2.4.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-Cy22ZQUZ.js');
6
+ var vue3 = require('./vue3-CSK73bce.js');
7
7
  var path = require('node:path/posix');
8
8
  require('@vue/compiler-sfc');
9
- require('./vendor-CLTTCh4j.js');
9
+ require('./vendor-BJuS1z3U.js');
10
10
  require('typescript');
11
11
  require('node:url');
12
12
  require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var vendor = require('./vendor-CLTTCh4j.js');
3
+ var vendor = require('./vendor-BJuS1z3U.js');
4
4
  var path = require('node:path/posix');
5
5
  var path$1 = require('node:path');
6
6
  require('crypto');
package/dist/index.d.ts CHANGED
@@ -26,6 +26,17 @@ export declare interface CompileOptions {
26
26
  * Extra attributes to include in the `<link>` or `<script>` tag.
27
27
  */
28
28
  attributes: AttributeTable;
29
+ /**
30
+ * Assets with higher priority is sorted and loaded earlier than assets with
31
+ * lower.
32
+ *
33
+ * The builtin priorities:
34
+ *
35
+ * - Default is `0`.
36
+ * - Processor runtime assets uses `50`.
37
+ * - Bootstrap runtime uses `100`.
38
+ */
39
+ priority: number;
29
40
  }
30
41
 
31
42
  declare interface Component {
@@ -154,7 +165,9 @@ declare class Generator_2 {
154
165
  private resources;
155
166
  private sourceFiles;
156
167
  constructor(options: GeneratorOptions);
157
- compileScript(name: string, src: string | URL, options?: Partial<CompileOptions>): void;
168
+ compileScript(name: string, src: string | URL, options?: Partial<CompileOptions>, buildOptions?: {
169
+ define?: Record<string, string>;
170
+ }): void;
158
171
  compileStyle(name: string, src: string | URL, options?: Partial<CompileOptions>): void;
159
172
  /**
160
173
  * @param dst - Destination directory relative to asset folder.
@@ -345,6 +358,19 @@ export declare interface NormalizedDocumentAttributes {
345
358
  sortorder: number;
346
359
  }
347
360
 
361
+ /**
362
+ * Interface representing `package.json`.
363
+ *
364
+ * @public
365
+ */
366
+ export declare interface PackageJson {
367
+ readonly name: string;
368
+ readonly version: string;
369
+ readonly repository?: {
370
+ readonly url?: string;
371
+ };
372
+ }
373
+
348
374
  /**
349
375
  * @public
350
376
  */
@@ -378,6 +404,7 @@ export declare interface ProcessorContext {
378
404
  */
379
405
  addTemplateBlock<T>(container: string, id: string, renderer: TemplateBlockRenderer<T>): void;
380
406
  /* Excluded from this release type: getAllTemplateBlocks */
407
+ /* Excluded from this release type: hasTemplate */
381
408
  setTopNavigation(root: NavigationSection): void;
382
409
  setSideNavigation(root: NavigationSection): void;
383
410
  getAllTemplateData(): Record<string, unknown>;
@@ -432,6 +459,10 @@ export declare interface ProcessorRuntime {
432
459
  src: string;
433
460
  /** Bundle name (in dist/processors) folder (default: derived from processor name) */
434
461
  name?: string;
462
+ /** Build options (passed to compileScript) */
463
+ buildOptions?: {
464
+ define?: Record<string, string>;
465
+ };
435
466
  }
436
467
 
437
468
  /* Excluded from this release type: processorRuntimeName */
@@ -461,10 +492,7 @@ export declare function searchProcessor(): Processor;
461
492
  *
462
493
  * @public
463
494
  */
464
- export declare function selectableVersionProcessor(pkg: {
465
- name: string;
466
- version: string;
467
- }, container: string, options?: ProcessorOptions): Processor;
495
+ export declare function selectableVersionProcessor(pkg: PackageJson, container: string, options?: ProcessorOptions): Processor;
468
496
 
469
497
  /**
470
498
  * Options passed from the example compiler to the `setup` function.
@@ -494,6 +522,14 @@ export declare interface SourceFiles {
494
522
  transform?(doc: Document_2): Document_2;
495
523
  }
496
524
 
525
+ /**
526
+ * Processor that provide `componentSourceUrl` template function used for resolving
527
+ * component source urls.
528
+ *
529
+ * @public
530
+ */
531
+ export declare function sourceUrlProcessor(pkg: PackageJson, options: SourceUrlProcessorOptions): Processor;
532
+
497
533
  /**
498
534
  * Processor that provide `componentSourceUrl` template function used for resolving
499
535
  * component source urls.
@@ -503,7 +539,7 @@ export declare interface SourceFiles {
503
539
  export declare function sourceUrlProcessor(options: SourceUrlProcessorOptions): Processor;
504
540
 
505
541
  /**
506
- * Options for {@link sourceUrlProcessor}.
542
+ * Options for {@link sourceUrlProcessor#}.
507
543
  *
508
544
  * @public
509
545
  */
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('node:fs/promises');
4
- var vendor = require('./vendor-CLTTCh4j.js');
4
+ var vendor = require('./vendor-BJuS1z3U.js');
5
5
  var path = require('node:path');
6
6
  var require$$1 = require('crypto');
7
- var createMarkdownRenderer = require('./create-markdown-renderer-Db4n4L1y.js');
7
+ var createMarkdownRenderer = require('./create-markdown-renderer-CipdiqUn.js');
8
8
  var node_child_process = require('node:child_process');
9
9
  var path$1 = require('node:path/posix');
10
10
  require('node:crypto');
11
11
  var util = require('node:util');
12
12
  var fs$1 = require('node:fs');
13
13
  var vue = require('vue');
14
- var vue3 = require('./vue3-Cy22ZQUZ.js');
14
+ var vue3 = require('./vue3-CSK73bce.js');
15
15
  var vueDocgenApi = require('vue-docgen-api');
16
16
  var sass = require('sass');
17
17
  var node_url = require('node:url');
18
- var esbuild = require('esbuild');
18
+ var esbuild$1 = require('esbuild');
19
19
  var nunjucks = require('nunjucks');
20
20
  var express = require('express');
21
21
  require('@vue/compiler-sfc');
@@ -128,6 +128,39 @@ function getIntegrity(source) {
128
128
  return `sha384-${hash}`;
129
129
  }
130
130
 
131
+ function getPullRequestID(env) {
132
+ if (env.JOB_BASE_NAME) {
133
+ const name = env.JOB_BASE_NAME;
134
+ const match = name.match(/^PR-(\d+)$/);
135
+ return match ? match[1] : void 0;
136
+ }
137
+ if (env.GITHUB_REF) {
138
+ const name = env.GITHUB_REF;
139
+ const match = name.match(/^refs\/pull\/([^/]+)\/merge$/);
140
+ return match ? match[1] : void 0;
141
+ }
142
+ return void 0;
143
+ }
144
+
145
+ const RE_MATCH_SSH = /^(ssh:\/\/)?(?<user>[^@]+)@(?<host>[^:]+):(?<path>.*)$/;
146
+ function getRepositoryUrl(value) {
147
+ if (typeof value !== "string") {
148
+ const url = value.repository?.url;
149
+ if (!url) {
150
+ return null;
151
+ }
152
+ value = url;
153
+ }
154
+ value = value.replace(/^git[+]/, "");
155
+ const ssh = value.match(RE_MATCH_SSH);
156
+ if (ssh) {
157
+ const { host, path } = ssh.groups;
158
+ value = `https://${host}/${path}`;
159
+ }
160
+ value = value.replace(/[.]git$/, "");
161
+ return value;
162
+ }
163
+
131
164
  function cacheKey$1(...args) {
132
165
  return JSON.stringify(args);
133
166
  }
@@ -169,7 +202,7 @@ function haveOutput(doc) {
169
202
  }
170
203
 
171
204
  function interpolate(value, data) {
172
- return value.replace(/{{([^}]+)}}/g, (match, raw) => {
205
+ return value.replace(/{{([^{}]+)}}/g, (match, raw) => {
173
206
  const key = raw.trim();
174
207
  return data[key] ?? match;
175
208
  });
@@ -435,14 +468,6 @@ async function getGitBranch() {
435
468
  return branch;
436
469
  }
437
470
  }
438
- function getPullRequestID() {
439
- if (process.env.JOB_BASE_NAME) {
440
- const name = process.env.JOB_BASE_NAME;
441
- const match = name.match(/PR-(\d+)/);
442
- return match ? match[1] : void 0;
443
- }
444
- return void 0;
445
- }
446
471
  async function getSCMData(pkg, options) {
447
472
  const commitHash = await gitCommitHash("full");
448
473
  const commitShort = await gitCommitHash("short");
@@ -450,8 +475,9 @@ async function getSCMData(pkg, options) {
450
475
  return null;
451
476
  }
452
477
  const { homepage } = pkg;
453
- const pr = getPullRequestID();
454
- const prUrl = pr ? interpolate(options.prUrlFormat, { homepage, pr }) : void 0;
478
+ const repository = getRepositoryUrl(pkg) ?? "";
479
+ const pr = getPullRequestID(process.env);
480
+ const prUrl = pr ? interpolate(options.prUrlFormat, { homepage, pr, repository }) : void 0;
455
481
  return {
456
482
  branch: await getGitBranch(),
457
483
  commitShort,
@@ -459,7 +485,8 @@ async function getSCMData(pkg, options) {
459
485
  commitUrl: interpolate(options.commitUrlFormat, {
460
486
  hash: commitHash,
461
487
  short: commitShort,
462
- homepage
488
+ homepage,
489
+ repository
463
490
  }),
464
491
  pr,
465
492
  prUrl
@@ -585,25 +612,33 @@ function generateVueExample(options) {
585
612
  };
586
613
  }
587
614
  function generateStaticExample(options) {
588
- const { source, language, tags } = options;
615
+ const { filename, source, language, tags } = options;
616
+ const slug = getExampleName(filename);
617
+ const fingerprint = createMarkdownRenderer.getFingerprint(source);
618
+ const asset = `${slug}-${fingerprint}.${language}`;
589
619
  const runtimeLanguages = ["html"];
620
+ const runtime = runtimeLanguages.includes(language);
590
621
  return {
591
622
  source,
592
623
  language: options.language,
593
624
  comments: [],
594
625
  tags,
595
626
  markup: source,
596
- output: null,
597
- runtime: runtimeLanguages.includes(language)
627
+ output: runtime ? asset : null,
628
+ runtime,
629
+ task: null
598
630
  };
599
631
  }
600
632
 
601
- function sourceUrlProcessor(options) {
633
+ function sourceUrlProcessor(...args) {
634
+ const pkg = args.length === 2 ? args[0] : {};
635
+ const options = args.length === 2 ? args[1] : args[0];
602
636
  const {
603
637
  enabled = true,
604
638
  urlFormat,
605
639
  componentFileExtension = "vue"
606
640
  } = options;
641
+ const repository = getRepositoryUrl(pkg) ?? "";
607
642
  return {
608
643
  after: "generate-docs",
609
644
  name: "source-url-processor",
@@ -617,7 +652,12 @@ function sourceUrlProcessor(options) {
617
652
  const { source, name } = component;
618
653
  const filename = source ?? `${name}.${componentFileExtension}`;
619
654
  const path = getExampleImport(["./"], filename);
620
- return interpolate(urlFormat, { path, hash, short });
655
+ return interpolate(urlFormat, {
656
+ path,
657
+ hash,
658
+ short,
659
+ repository
660
+ });
621
661
  }
622
662
  context.setTemplateData("componentSourceUrl", componentSourceUrl);
623
663
  }
@@ -1003,7 +1043,7 @@ async function navigationFileReader(filePath, basePath) {
1003
1043
  return [doc];
1004
1044
  }
1005
1045
 
1006
- function resolveScssImport(filePath) {
1046
+ function resolveScssImport(filePath, throwError = true) {
1007
1047
  const { dir, base } = path$1.parse(filePath);
1008
1048
  const search = [`${base}.css`, `${base}.scss`, `_${base}.scss`, `${base}`];
1009
1049
  for (const variant of search) {
@@ -1017,20 +1057,24 @@ function resolveScssImport(filePath) {
1017
1057
  }
1018
1058
  }
1019
1059
  }
1020
- throw new Error(`Failed to resolve "${filePath}"`);
1060
+ if (throwError) {
1061
+ throw new Error(`Failed to resolve "${filePath}"`);
1062
+ }
1063
+ return null;
1021
1064
  }
1022
- const tildeImporter = {
1065
+ const WEBPACK_NODE_MODULE_PREFIX = "~";
1066
+ const moduleImporter = {
1023
1067
  canonicalize(url) {
1024
- const indexOfTilde = url.indexOf("~");
1025
- if (indexOfTilde >= 0) {
1026
- return resolveScssImport(url.slice(indexOfTilde + 1));
1068
+ const indexOfPrefix = url.indexOf(WEBPACK_NODE_MODULE_PREFIX);
1069
+ if (indexOfPrefix >= 0) {
1070
+ return resolveScssImport(url.slice(indexOfPrefix + 1));
1027
1071
  }
1028
1072
  if (url.startsWith("file://")) {
1029
1073
  const path$1 = node_url.fileURLToPath(url);
1030
1074
  const relative = path.isAbsolute(path$1) ? path.relative(__dirname, path$1) : path$1;
1031
1075
  return resolveScssImport(relative.replace(/\\/g, "/"));
1032
1076
  }
1033
- return null;
1077
+ return resolveScssImport(url, false);
1034
1078
  },
1035
1079
  async load(url) {
1036
1080
  const filepath = node_url.fileURLToPath(url);
@@ -1046,7 +1090,7 @@ const tildeImporter = {
1046
1090
  async function compileSassString(dst, style) {
1047
1091
  const result = await sass.compileStringAsync(style, {
1048
1092
  style: "expanded",
1049
- importers: [tildeImporter]
1093
+ importers: [new sass.NodePackageImporter(), moduleImporter]
1050
1094
  });
1051
1095
  await fs.mkdir(path.dirname(dst), { recursive: true });
1052
1096
  await fs.writeFile(dst, result.css, "utf-8");
@@ -1078,6 +1122,12 @@ async function compileStyle(assetFolder, name, src) {
1078
1122
  }
1079
1123
  }
1080
1124
 
1125
+ function byPriority$1({ options: a }, { options: b }) {
1126
+ return b.priority - a.priority;
1127
+ }
1128
+ function toSorted$1(values, comparator) {
1129
+ return [...values].sort(comparator);
1130
+ }
1081
1131
  function cssAssetProcessor(assetFolder, assets) {
1082
1132
  return {
1083
1133
  name: "css-asset-processor",
@@ -1086,7 +1136,7 @@ function cssAssetProcessor(assetFolder, assets) {
1086
1136
  const assetInfo = context.getTemplateData("assets") ?? {};
1087
1137
  const head = context.getTemplateData("injectHead") ?? [];
1088
1138
  const body = context.getTemplateData("injectBody") ?? [];
1089
- for (const asset of assets) {
1139
+ for (const asset of toSorted$1(assets, byPriority$1)) {
1090
1140
  const info = await compileStyle(
1091
1141
  assetFolder,
1092
1142
  asset.name,
@@ -1114,12 +1164,23 @@ function cssAssetProcessor(assetFolder, assets) {
1114
1164
  };
1115
1165
  }
1116
1166
 
1117
- async function compileScript(assetFolder, name, src, options) {
1167
+ function esbuild(options) {
1168
+ return esbuild$1.build(options);
1169
+ }
1170
+
1171
+ async function compileScript(options) {
1172
+ const {
1173
+ assetFolder,
1174
+ name,
1175
+ src,
1176
+ buildOptions,
1177
+ fs: fs$1 = fs
1178
+ } = options;
1118
1179
  const iconLib = process.env.DOCS_ICON_LIB ?? "@fkui/icon-lib-default";
1119
1180
  try {
1120
1181
  const entryPoints = [src instanceof URL ? node_url.fileURLToPath(src) : src];
1121
1182
  const outfile = path.join("temp", `asset-${name}.js`);
1122
- await esbuild.build({
1183
+ await esbuild({
1123
1184
  entryPoints,
1124
1185
  outfile,
1125
1186
  bundle: true,
@@ -1127,19 +1188,20 @@ async function compileScript(assetFolder, name, src, options) {
1127
1188
  platform: "browser",
1128
1189
  external: ["vue", "@fkui/vue"],
1129
1190
  tsconfig: path.join(__dirname, "../tsconfig-examples.json"),
1191
+ ...buildOptions,
1130
1192
  define: {
1131
- "process.env.DOCS_ICON_LIB": JSON.stringify(iconLib)
1132
- },
1133
- ...options
1193
+ "process.env.DOCS_ICON_LIB": JSON.stringify(iconLib),
1194
+ ...buildOptions?.define
1195
+ }
1134
1196
  });
1135
- const content = await fs.readFile(outfile, "utf-8");
1197
+ const content = await fs$1.readFile(outfile, "utf-8");
1136
1198
  const fingerprint = createMarkdownRenderer.getFingerprint(content);
1137
1199
  const integrity = getIntegrity(content);
1138
1200
  const filename = `${name}-${fingerprint}.js`;
1139
1201
  const dst = path.join(assetFolder, filename);
1140
- await fs.mkdir(path.dirname(dst), { recursive: true });
1141
- await fs.rename(outfile, dst);
1142
- const stat = await fs.stat(dst);
1202
+ await fs$1.mkdir(path.dirname(dst), { recursive: true });
1203
+ await fs$1.rename(outfile, dst);
1204
+ const stat = await fs$1.stat(dst);
1143
1205
  return {
1144
1206
  name,
1145
1207
  filename,
@@ -1154,6 +1216,12 @@ async function compileScript(assetFolder, name, src, options) {
1154
1216
  }
1155
1217
  }
1156
1218
 
1219
+ function byPriority({ options: a }, { options: b }) {
1220
+ return b.priority - a.priority;
1221
+ }
1222
+ function toSorted(values, comparator) {
1223
+ return [...values].sort(comparator);
1224
+ }
1157
1225
  function jsAssetProcessor(assetFolder, assets) {
1158
1226
  return {
1159
1227
  name: "js-asset-processor",
@@ -1162,12 +1230,13 @@ function jsAssetProcessor(assetFolder, assets) {
1162
1230
  const assetInfo = context.getTemplateData("assets") ?? {};
1163
1231
  const head = context.getTemplateData("injectHead") ?? [];
1164
1232
  const body = context.getTemplateData("injectBody") ?? [];
1165
- for (const asset of assets) {
1166
- const info = await compileScript(
1233
+ for (const asset of toSorted(assets, byPriority)) {
1234
+ const info = await compileScript({
1167
1235
  assetFolder,
1168
- asset.name,
1169
- asset.src
1170
- );
1236
+ name: asset.name,
1237
+ src: asset.src,
1238
+ buildOptions: asset.buildOptions
1239
+ });
1171
1240
  const attrs = serializeAttrs(asset.options.attributes);
1172
1241
  const inject = { ...info, attrs: Array.from(attrs).join(" ") };
1173
1242
  assetInfo[asset.name] = info;
@@ -1227,9 +1296,17 @@ function compileProcessorRuntime(generator, distDir, processors) {
1227
1296
  const name = processorRuntimeName(processor, entry);
1228
1297
  const bundled = new URL(`${name}.js`, distDir);
1229
1298
  const scriptPath = fs$1.existsSync(bundled) ? bundled : entry.src;
1230
- generator.compileScript(assetName, scriptPath, {
1231
- appendTo: "body"
1232
- });
1299
+ generator.compileScript(
1300
+ assetName,
1301
+ scriptPath,
1302
+ {
1303
+ appendTo: "body",
1304
+ priority: 50
1305
+ },
1306
+ {
1307
+ ...entry.buildOptions
1308
+ }
1309
+ );
1233
1310
  }
1234
1311
  }
1235
1312
  }
@@ -1449,14 +1526,22 @@ class TemplateLoader {
1449
1526
  }
1450
1527
  }
1451
1528
  }
1529
+ hasTemplate(name) {
1530
+ const { templateCache } = this;
1531
+ const cached = templateCache.get(name);
1532
+ if (cached) {
1533
+ return true;
1534
+ }
1535
+ const filePath = this.findTemplateFile(name);
1536
+ return Boolean(filePath);
1537
+ }
1452
1538
  async resolveTemplate(name) {
1453
1539
  const { templateCache, folders } = this;
1454
1540
  const cached = templateCache.get(name);
1455
1541
  if (cached) {
1456
1542
  return cached;
1457
1543
  }
1458
- const searchPaths = folders.map((it) => path.join(it, name));
1459
- const filePath = searchPaths.find((it) => fs$1.existsSync(it));
1544
+ const filePath = this.findTemplateFile(name);
1460
1545
  if (!filePath) {
1461
1546
  const searched = folders.map((it) => ` - "${it}"`).join("\n");
1462
1547
  const message = `Failed to resolve template "${name}", searched in:
@@ -1471,6 +1556,11 @@ Make sure the name is correct and the template file exists in one of the listed
1471
1556
  templateCache.set(name, resolved);
1472
1557
  return resolved;
1473
1558
  }
1559
+ findTemplateFile(name) {
1560
+ const { folders } = this;
1561
+ const searchPaths = folders.map((it) => path.join(it, name));
1562
+ return searchPaths.find((it) => fs$1.existsSync(it));
1563
+ }
1474
1564
  }
1475
1565
 
1476
1566
  function dump(value) {
@@ -1647,6 +1737,7 @@ async function compileStandalones(options) {
1647
1737
  }
1648
1738
  function createTemplateLoader(folders) {
1649
1739
  loader = new TemplateLoader(folders);
1740
+ return loader;
1650
1741
  }
1651
1742
  async function render(doc, docs, nav, vendors, options) {
1652
1743
  const { fileInfo } = doc;
@@ -1694,7 +1785,9 @@ async function render(doc, docs, nav, vendors, options) {
1694
1785
  });
1695
1786
  if (example.output) {
1696
1787
  const { dir, name } = path.parse(example.output);
1697
- generatedExamples.push(example.task);
1788
+ if (example.task) {
1789
+ generatedExamples.push(example.task);
1790
+ }
1698
1791
  generatedStandalone.push({
1699
1792
  outputFile: path.join(dir, `${name}.html`),
1700
1793
  content: example.markup
@@ -1824,7 +1917,6 @@ function nunjucksProcessor(options) {
1824
1917
  const docs = context.docs.filter((it) => {
1825
1918
  return it.fileInfo.outputName;
1826
1919
  });
1827
- createTemplateLoader(options.templateFolders);
1828
1920
  progressbar.start(docs.length, 0, {
1829
1921
  filename: docs.length > 0 ? docs[0].fileInfo.fullPath : ""
1830
1922
  });
@@ -1898,7 +1990,7 @@ async function compileVendor(assetFolder, vendor, options) {
1898
1990
  const source = getAssetSource(vendor, customRequire.toString());
1899
1991
  const tsconfig = path.resolve(__dirname, "../tsconfig-examples.json");
1900
1992
  await fs.writeFile(tmpfile, source, "utf-8");
1901
- await esbuild.build({
1993
+ await esbuild$1.build({
1902
1994
  entryPoints: [tmpfile],
1903
1995
  outfile,
1904
1996
  bundle: true,
@@ -2128,7 +2220,7 @@ async function stage(stage2, context, processors, { verbose } = { verbose: true
2128
2220
  }
2129
2221
  return generatedFiles;
2130
2222
  }
2131
- function createContext() {
2223
+ function createContext(templateLoader) {
2132
2224
  let docs = [];
2133
2225
  let vendors = [];
2134
2226
  const resources = [];
@@ -2188,6 +2280,9 @@ function createContext() {
2188
2280
  getAllTemplateBlocks() {
2189
2281
  return templateBlocks;
2190
2282
  },
2283
+ hasTemplate(name) {
2284
+ return Boolean(templateLoader?.hasTemplate(name));
2285
+ },
2191
2286
  setTopNavigation(root) {
2192
2287
  topnav = root;
2193
2288
  },
@@ -2238,17 +2333,22 @@ class Generator {
2238
2333
  this.sourceFiles = [];
2239
2334
  const bootstrapUrl = new URL("runtime-bootstrap.js", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)));
2240
2335
  this.compileScript("bootstrap", bootstrapUrl, {
2241
- appendTo: "head"
2336
+ appendTo: "head",
2337
+ priority: 100
2242
2338
  });
2243
2339
  }
2244
- compileScript(name, src, options) {
2340
+ compileScript(name, src, options, buildOptions) {
2245
2341
  this.scripts.push({
2246
2342
  name,
2247
2343
  src,
2248
2344
  options: {
2249
2345
  appendTo: "none",
2250
2346
  attributes: {},
2347
+ priority: 0,
2251
2348
  ...options
2349
+ },
2350
+ buildOptions: {
2351
+ ...buildOptions
2252
2352
  }
2253
2353
  });
2254
2354
  }
@@ -2259,6 +2359,7 @@ class Generator {
2259
2359
  options: {
2260
2360
  appendTo: "none",
2261
2361
  attributes: {},
2362
+ priority: 0,
2262
2363
  ...options
2263
2364
  }
2264
2365
  });
@@ -2287,7 +2388,8 @@ class Generator {
2287
2388
  fileReaderProcessor(sourceFiles),
2288
2389
  ...this.processors
2289
2390
  ];
2290
- const context = createContext();
2391
+ const templateLoader = createTemplateLoader([]);
2392
+ const context = createContext(templateLoader);
2291
2393
  await stage("generate-docs", context, processors, { verbose: false });
2292
2394
  const docs = context.docs.filter(haveOutput);
2293
2395
  const pages = docs.map(manifestPageFromDocument);
@@ -2326,7 +2428,8 @@ class Generator {
2326
2428
  ...this.processors
2327
2429
  ];
2328
2430
  compileProcessorRuntime(this, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href)), processors);
2329
- const context = createContext();
2431
+ const templateLoader = createTemplateLoader(templateFolders);
2432
+ const context = createContext(templateLoader);
2330
2433
  const generatedFiles = [
2331
2434
  await stage("generate-docs", context, processors),
2332
2435
  await stage("generate-nav", context, processors),
@@ -127,9 +127,11 @@ export declare interface ExampleStaticResult {
127
127
  /** HTML markup to inject into document */
128
128
  markup: string;
129
129
  /** asset filename */
130
- output: null;
130
+ output: string | null;
131
131
  /** enables/disables running example live in the browser */
132
132
  runtime: boolean;
133
+ /** task data for compiler */
134
+ task: null;
133
135
  }
134
136
 
135
137
  /**
package/dist/markdown.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var createMarkdownRenderer = require('./create-markdown-renderer-Db4n4L1y.js');
4
- require('./vendor-CLTTCh4j.js');
3
+ var createMarkdownRenderer = require('./create-markdown-renderer-CipdiqUn.js');
4
+ require('./vendor-BJuS1z3U.js');
5
5
  require('@vue/compiler-sfc');
6
6
  require('typescript');
7
7
  require('node:url');