@forsakringskassan/docs-generator 3.18.0 → 3.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.
package/dist/index.d.mts CHANGED
@@ -1019,7 +1019,7 @@ export declare interface SourceUrlProcessorOptions extends ProcessorOptions {
1019
1019
  readonly sourceFiles?: string[];
1020
1020
  readonly urlFormat: string;
1021
1021
  /** File extension used for finding component by name */
1022
- readonly componentFileExtension?: string;
1022
+ readonly componentFileExtension?: string | string[];
1023
1023
  }
1024
1024
 
1025
1025
  /**
package/dist/index.mjs CHANGED
@@ -1505,6 +1505,19 @@ function selectableVersionProcessor(pkg, container, options) {
1505
1505
  };
1506
1506
  }
1507
1507
 
1508
+ function filenamePattern(base, extensions) {
1509
+ if (typeof extensions === "string") {
1510
+ extensions = [extensions];
1511
+ }
1512
+ switch (extensions.length) {
1513
+ case 0:
1514
+ return base;
1515
+ case 1:
1516
+ return `${base}.${extensions[0]}`;
1517
+ default:
1518
+ return `${base}.{${extensions.join(",")}}`;
1519
+ }
1520
+ }
1508
1521
  function sourceUrlProcessor(...args) {
1509
1522
  const pkg = args.length === 2 ? args[0] : {};
1510
1523
  const options = args.length === 2 ? args[1] : args[0];
@@ -1512,7 +1525,7 @@ function sourceUrlProcessor(...args) {
1512
1525
  enabled = true,
1513
1526
  sourceFiles = ["**/*"],
1514
1527
  urlFormat,
1515
- componentFileExtension = "vue"
1528
+ componentFileExtension = ["vue"]
1516
1529
  } = options;
1517
1530
  const repository = getRepositoryUrl(pkg) ?? "";
1518
1531
  return {
@@ -1529,7 +1542,7 @@ function sourceUrlProcessor(...args) {
1529
1542
  const short = await gitCommitHash("short") ?? "";
1530
1543
  function componentSourceUrl(component) {
1531
1544
  const { source, name } = component;
1532
- const filename = source ?? `${name}.${componentFileExtension}`;
1545
+ const filename = source ?? filenamePattern(name, componentFileExtension);
1533
1546
  const path = matcher(filename, "when generating source url");
1534
1547
  return interpolate(urlFormat, {
1535
1548
  path,
@@ -4474,6 +4487,9 @@ class Generator {
4474
4487
  context.addTemplateBlock("footer:right", "footer:right", {
4475
4488
  filename: "partials/footer-right.html"
4476
4489
  });
4490
+ context.addTemplateBlock("component:aside", "component:aside", {
4491
+ filename: "partials/component-aside.html"
4492
+ });
4477
4493
  const generatedFiles = [
4478
4494
  await stage("generate-docs", context, processors),
4479
4495
  await stage("generate-nav", context, processors),