@forsakringskassan/docs-generator 2.38.0 → 2.38.1

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.mjs CHANGED
@@ -4,11 +4,10 @@ const require = $createRequire(import.meta.url);
4
4
 
5
5
  import fs from 'node:fs/promises';
6
6
  import path from 'node:path/posix';
7
- import { t as ts, m as minimatch, M as MarkdownIt, d as dedent, g as closest, h as distance, i as fm, j as isCI, Z as Ze, k as moduleImporter, l as cliProgress, n as tinylr, w as watch, o as createInstance, p as fse, q as inter } from './vendor-DV7BHNMM.mjs';
8
- import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as filePath, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-DFoBsWJN.mjs';
7
+ import { t as ts, m as minimatch, M as MarkdownIt, d as dedent, g as closest, h as distance, i as fm, j as isCI, Z as Ze, k as moduleImporter, l as cliProgress, n as tinylr, w as watch, o as createInstance, p as fse, q as inter } from './vendor-BK-uA6Uv.mjs';
8
+ import { g as generateId, p as parseInfostring, i as isDocumentPage, n as normalizePath, a as getFingerprint, h as hasTag, f as findTag, b as getOutputFilePath, d as htmlencode, e as filePath, c as createMarkdownRenderer, j as generateExample } from './create-markdown-renderer-1_yCrnbT.mjs';
9
9
  import path__default from 'node:path';
10
- import require$$1 from 'crypto';
11
- import 'node:crypto';
10
+ import crypto from 'node:crypto';
12
11
  import { exec, execSync } from 'node:child_process';
13
12
  import util, { promisify } from 'node:util';
14
13
  import { codeFrameColumns } from '@babel/code-frame';
@@ -40,6 +39,7 @@ import 'http';
40
39
  import 'https';
41
40
  import 'url';
42
41
  import 'buffer';
42
+ import 'crypto';
43
43
  import 'net';
44
44
  import 'tls';
45
45
  import 'tty';
@@ -50,7 +50,7 @@ import 'fs/promises';
50
50
  import 'process';
51
51
  import 'v8';
52
52
  import 'vue';
53
- import './vue3-DtTC1eal.mjs';
53
+ import './vue3-fRI2JWNs.mjs';
54
54
 
55
55
  function toArray$2(value) {
56
56
  return Array.isArray(value) ? value : [value];
@@ -162,7 +162,7 @@ function getDocumentOutline(text, _format) {
162
162
  const entries = getHeadings(text);
163
163
  const root = { title: "", rank: 0, anchor: "", subheadings: [] };
164
164
  const stack = [root];
165
- const top = () => stack[stack.length - 1];
165
+ const top = () => stack.at(-1);
166
166
  for (const entry of entries) {
167
167
  const heading = {
168
168
  title: entry.title,
@@ -180,7 +180,7 @@ function getDocumentOutline(text, _format) {
180
180
  }
181
181
 
182
182
  function getIntegrity(source) {
183
- const hash = require$$1.createHash("sha384").update(source).digest("base64");
183
+ const hash = crypto.createHash("sha384").update(source).digest("base64");
184
184
  return `sha384-${hash}`;
185
185
  }
186
186
 
@@ -207,19 +207,19 @@ function getRepositoryUrl(value) {
207
207
  }
208
208
  value = url;
209
209
  }
210
- value = value.replace(/^git[+]/, "");
210
+ value = value.replace(/^git\+/, "");
211
211
  const ssh = RE_MATCH_SSH.exec(value);
212
212
  if (ssh) {
213
213
  const { host, path } = ssh.groups;
214
214
  value = `https://${host}/${path}`;
215
215
  }
216
- value = value.replace(/[.]git$/, "");
216
+ value = value.replace(/\.git$/, "");
217
217
  return value;
218
218
  }
219
219
 
220
220
  function runCommand(cmd, defaultValue) {
221
221
  return new Promise((resolve) => {
222
- exec(cmd, { encoding: "utf-8" }, (error, stdout) => {
222
+ exec(cmd, { encoding: "utf8" }, (error, stdout) => {
223
223
  if (error) {
224
224
  console.error(error);
225
225
  resolve(defaultValue);
@@ -244,7 +244,7 @@ function haveOutput(doc) {
244
244
  }
245
245
 
246
246
  function interpolate(value, data) {
247
- return value.replace(/{{([^{}]+)}}/g, (match, raw) => {
247
+ return value.replaceAll(/{{([^{}]+)}}/g, (match, raw) => {
248
248
  const key = raw.trim();
249
249
  const value2 = data[key];
250
250
  return value2 ?? match;
@@ -252,7 +252,7 @@ function interpolate(value, data) {
252
252
  }
253
253
 
254
254
  function quote(text) {
255
- return String(text).replace(/"/g, """);
255
+ return String(text).replaceAll('"', """);
256
256
  }
257
257
  function* serializeAttr(key, value) {
258
258
  if (value === null || value === false) {
@@ -285,13 +285,13 @@ function difference(a, b) {
285
285
  }
286
286
 
287
287
  function slugify(value) {
288
- return value.toLowerCase().replace(/\//g, "--").replace(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
288
+ return value.toLowerCase().replaceAll("/", "--").replaceAll(/[^a-z]+/g, "-").replace(/(^-+|-+$)/, "");
289
289
  }
290
290
 
291
291
  function isRelease() {
292
292
  try {
293
293
  const cmd = `git log -n1 --format=format:%s`;
294
- const message = execSync(cmd, { encoding: "utf-8" }).trim();
294
+ const message = execSync(cmd, { encoding: "utf8" }).trim();
295
295
  return message.startsWith("chore(release):");
296
296
  } catch (err) {
297
297
  console.error(err);
@@ -379,7 +379,7 @@ function extractExamplesProcessor(options) {
379
379
  const extension = getExtension(example.language);
380
380
  const filename = `example-${example.name ?? String(n++)}${suffix}.${extension}`;
381
381
  const filePath = path.join(dir, filename);
382
- await fs.writeFile(filePath, example.content, "utf-8");
382
+ await fs.writeFile(filePath, example.content, "utf8");
383
383
  total++;
384
384
  }
385
385
  }
@@ -463,12 +463,13 @@ function renderJSON(manifest) {
463
463
  return JSON.stringify(manifest, null, 2);
464
464
  }
465
465
  function normalize(text) {
466
- return text.replace(/\r\n/g, "\n");
466
+ return text.replaceAll("\r\n", "\n");
467
467
  }
468
468
  class ManifestError extends Error {
469
469
  filename;
470
470
  constructor(filename) {
471
471
  super(`Documentation manifest "${filename}" is not up-to-date!`);
472
+ this.name = "ManifestError";
472
473
  this.filename = filename;
473
474
  }
474
475
  prettyError() {
@@ -496,18 +497,18 @@ function manifestProcessor(options = {}) {
496
497
  const content = normalize(renderMarkdown(manifest));
497
498
  if (verify) {
498
499
  const actual = normalize(
499
- await fs.readFile(markdown, "utf-8")
500
+ await fs.readFile(markdown, "utf8")
500
501
  );
501
502
  if (actual !== content) {
502
503
  throw new ManifestError(markdown);
503
504
  }
504
505
  } else {
505
- await fs.writeFile(markdown, content, "utf-8");
506
+ await fs.writeFile(markdown, content, "utf8");
506
507
  }
507
508
  }
508
509
  if (json) {
509
510
  const content = renderJSON(manifest);
510
- await fs.writeFile(json, content, "utf-8");
511
+ await fs.writeFile(json, content, "utf8");
511
512
  }
512
513
  }
513
514
  };
@@ -655,7 +656,7 @@ function htmlRedirectProcessor() {
655
656
  const dst = relative(doc.body, doc);
656
657
  const content = template(dst);
657
658
  await fs.mkdir(path.dirname(filePath), { recursive: true });
658
- await fs.writeFile(filePath, dedent(content), "utf-8");
659
+ await fs.writeFile(filePath, dedent(content), "utf8");
659
660
  }
660
661
  }
661
662
  };
@@ -681,14 +682,14 @@ function redirectFileProcessor(prefix = "/", filename = "_redirects") {
681
682
  });
682
683
  const filePath = path.join(context.outputFolder, filename);
683
684
  await fs.mkdir(path.dirname(filePath), { recursive: true });
684
- await fs.writeFile(filePath, lines.join(""), "utf-8");
685
+ await fs.writeFile(filePath, lines.join(""), "utf8");
685
686
  context.log(filename, "generated");
686
687
  }
687
688
  };
688
689
  }
689
690
 
690
691
  function getRedirects(docs) {
691
- return docs.filter(isDocumentPage).map((it) => {
692
+ return docs.filter(isDocumentPage).flatMap((it) => {
692
693
  const { fileInfo } = it;
693
694
  const { path, outputName } = fileInfo;
694
695
  if (outputName === false) {
@@ -700,7 +701,7 @@ function getRedirects(docs) {
700
701
  to: normalizePath(path, outputName)
701
702
  };
702
703
  });
703
- }).flat();
704
+ });
704
705
  }
705
706
 
706
707
  function redirectProcessor() {
@@ -793,7 +794,7 @@ function topnavProcessor(filename, title) {
793
794
  after: "generate-nav",
794
795
  name: "topnav-processor",
795
796
  async handler(context) {
796
- const content = await fs.readFile(filename, "utf-8");
797
+ const content = await fs.readFile(filename, "utf8");
797
798
  const parsed = JSON.parse(content);
798
799
  const rootNode = generateNavigation(parsed);
799
800
  context.setTopNavigation({
@@ -963,7 +964,7 @@ function findLocation(content, attr) {
963
964
  const yaml = match[1];
964
965
  const lines = yaml.split("\n");
965
966
  const index = lines.findIndex((it) => it.startsWith(`${attr}:`));
966
- if (index < 0) {
967
+ if (index === -1) {
967
968
  return null;
968
969
  }
969
970
  const blockBegin = 2;
@@ -1096,7 +1097,7 @@ function parseFile$1(filePath, basePath, content) {
1096
1097
  validateAttributes(attributes, filePath, content);
1097
1098
  return {
1098
1099
  kind: "page",
1099
- id: `fs:${filePath.replace(/\\/g, "/")}`,
1100
+ id: `fs:${filePath.replaceAll("\\", "/")}`,
1100
1101
  name,
1101
1102
  alias: Array.from(getDocumentAlias(attributes)),
1102
1103
  visible: attributes.visible ?? true,
@@ -1127,7 +1128,7 @@ function parseFile$1(filePath, basePath, content) {
1127
1128
  };
1128
1129
  }
1129
1130
  async function frontMatterFileReader(filePath, basePath) {
1130
- const content = await fs.readFile(filePath, "utf-8");
1131
+ const content = await fs.readFile(filePath, "utf8");
1131
1132
  const doc = parseFile$1(filePath, basePath, content);
1132
1133
  return [doc];
1133
1134
  }
@@ -1149,7 +1150,7 @@ function getDescription(node) {
1149
1150
  if (!text.startsWith("*")) {
1150
1151
  return null;
1151
1152
  }
1152
- return node.value.replace(/^\s*[*]\s/gm, "").replace(/\s+$/gm, "");
1153
+ return node.value.replaceAll(/^\s*\*\s/gm, "").replaceAll(/\s+$/gm, "");
1153
1154
  }
1154
1155
  function flattenMemberExpression(node) {
1155
1156
  const { object, property } = node;
@@ -1602,7 +1603,7 @@ function getEventDeprecated(event) {
1602
1603
  }
1603
1604
  }
1604
1605
  function isSimpleName(name) {
1605
- return /^[a-z0-9]+$/i.test(name);
1606
+ return /^[\da-z]+$/i.test(name);
1606
1607
  }
1607
1608
  function getPropType(prop) {
1608
1609
  const { type } = prop;
@@ -1676,7 +1677,7 @@ function translateEvents(events) {
1676
1677
  function translateEventProperties(event) {
1677
1678
  const properties = event.properties;
1678
1679
  const types = event.type ? Object.values(event.type.names) : [];
1679
- if (!properties && !types.length) {
1680
+ if (!properties && types.length === 0) {
1680
1681
  return [];
1681
1682
  }
1682
1683
  if (!properties) {
@@ -1685,8 +1686,7 @@ function translateEventProperties(event) {
1685
1686
  ];
1686
1687
  }
1687
1688
  const translatedProperties = [];
1688
- for (let i = 0; i < properties.length; i++) {
1689
- const property = properties[i];
1689
+ for (const [i, property] of properties.entries()) {
1690
1690
  const name = property.name ?? "<anonymous>";
1691
1691
  const eventType = types[i];
1692
1692
  const hasEventType = Boolean(eventType) && eventType !== "undefined";
@@ -1784,21 +1784,21 @@ function parseAPI(filePath, api) {
1784
1784
  const parsedPath = path__default.parse(relative);
1785
1785
  const componentName = parsedPath.name;
1786
1786
  let html = "";
1787
- if (api.models.length) {
1787
+ if (api.models.length > 0) {
1788
1788
  html += generateModelTable(api.slug, api.models);
1789
1789
  }
1790
- if (api.props.length) {
1790
+ if (api.props.length > 0) {
1791
1791
  html += generatePropTable(api.slug, api.props);
1792
1792
  }
1793
- if (api.events.length) {
1793
+ if (api.events.length > 0) {
1794
1794
  html += generateEventTable(api.slug, api.events);
1795
1795
  }
1796
- if (api.slots.length) {
1796
+ if (api.slots.length > 0) {
1797
1797
  html += generateSlotTable(api.slug, api.slots);
1798
1798
  }
1799
1799
  return {
1800
1800
  kind: "partial",
1801
- id: `fs:${filePath.replace(/\\/g, "/")}:api`,
1801
+ id: `fs:${filePath.replaceAll("\\", "/")}:api`,
1802
1802
  name: `vue:${componentName}`,
1803
1803
  alias: [],
1804
1804
  body: html,
@@ -1812,10 +1812,10 @@ async function parseTranslation(slug, filePath) {
1812
1812
  const relative = normalizePath(filePath);
1813
1813
  const parsedPath = path__default.parse(relative);
1814
1814
  const componentName = parsedPath.name;
1815
- const content = await fs.readFile(filePath, "utf-8");
1815
+ const content = await fs.readFile(filePath, "utf8");
1816
1816
  return {
1817
1817
  kind: "partial",
1818
- id: `fs:${filePath.replace(/\\/g, "/")}:translation`,
1818
+ id: `fs:${filePath.replaceAll("\\", "/")}:translation`,
1819
1819
  name: `translation:${componentName}`,
1820
1820
  alias: [],
1821
1821
  get body() {
@@ -1892,7 +1892,7 @@ function parseFile(filePath, basePath, content) {
1892
1892
  const urlpath = parsed.dir;
1893
1893
  return {
1894
1894
  kind: "page",
1895
- id: `nav:${filePath.replace(/\\/g, "/")}`,
1895
+ id: `nav:${filePath.replaceAll("\\", "/")}`,
1896
1896
  name,
1897
1897
  alias: [],
1898
1898
  visible: attributes.href ? true : false,
@@ -1917,7 +1917,7 @@ function parseFile(filePath, basePath, content) {
1917
1917
  };
1918
1918
  }
1919
1919
  async function navigationFileReader(filePath, basePath) {
1920
- const content = await fs.readFile(filePath, "utf-8");
1920
+ const content = await fs.readFile(filePath, "utf8");
1921
1921
  const doc = parseFile(filePath, basePath, content);
1922
1922
  return [doc];
1923
1923
  }
@@ -1928,15 +1928,15 @@ async function compileSassString(dst, style) {
1928
1928
  importers: [new NodePackageImporter(), moduleImporter]
1929
1929
  });
1930
1930
  await fs.mkdir(path__default.dirname(dst), { recursive: true });
1931
- await fs.writeFile(dst, result.css, "utf-8");
1931
+ await fs.writeFile(dst, result.css, "utf8");
1932
1932
  }
1933
1933
 
1934
1934
  async function compileStyle(assetFolder, name, src) {
1935
1935
  try {
1936
1936
  const outfile = path.join("temp", `asset-${name}.css`);
1937
- const source = await fs.readFile(src, "utf-8");
1937
+ const source = await fs.readFile(src, "utf8");
1938
1938
  await compileSassString(outfile, source);
1939
- const content = await fs.readFile(outfile, "utf-8");
1939
+ const content = await fs.readFile(outfile, "utf8");
1940
1940
  const fingerprint = getFingerprint(content);
1941
1941
  const integrity = getIntegrity(content);
1942
1942
  const filename = `${name}-${fingerprint}.css`;
@@ -1961,9 +1961,6 @@ async function compileStyle(assetFolder, name, src) {
1961
1961
  function byPriority$1({ options: a }, { options: b }) {
1962
1962
  return b.priority - a.priority;
1963
1963
  }
1964
- function toSorted$1(values, comparator) {
1965
- return [...values].sort(comparator);
1966
- }
1967
1964
  function cssAssetProcessor(assetFolder, assets) {
1968
1965
  return {
1969
1966
  name: "css-asset-processor",
@@ -1972,7 +1969,7 @@ function cssAssetProcessor(assetFolder, assets) {
1972
1969
  const assetInfo = context.getTemplateData("assets", {});
1973
1970
  const head = context.getTemplateData("injectHead", []);
1974
1971
  const body = context.getTemplateData("injectBody", []);
1975
- for (const asset of toSorted$1(assets, byPriority$1)) {
1972
+ for (const asset of assets.toSorted(byPriority$1)) {
1976
1973
  const info = await compileStyle(
1977
1974
  assetFolder,
1978
1975
  asset.name,
@@ -2037,7 +2034,7 @@ async function compileScript(options) {
2037
2034
  ...buildOptions.define
2038
2035
  }
2039
2036
  });
2040
- const content = await fs$1.readFile(outfile, "utf-8");
2037
+ const content = await fs$1.readFile(outfile, "utf8");
2041
2038
  const fingerprint = getFingerprint(content);
2042
2039
  const integrity = getIntegrity(content);
2043
2040
  const filename = `${name}-${fingerprint}.js`;
@@ -2063,9 +2060,6 @@ async function compileScript(options) {
2063
2060
  function byPriority({ options: a }, { options: b }) {
2064
2061
  return b.priority - a.priority;
2065
2062
  }
2066
- function toSorted(values, comparator) {
2067
- return [...values].sort(comparator);
2068
- }
2069
2063
  function isExternal(asset) {
2070
2064
  return asset.options.appendTo === "none";
2071
2065
  }
@@ -2078,7 +2072,7 @@ function jsAssetProcessor(assetFolder, assets, vendor) {
2078
2072
  const assetInfo = context.getTemplateData("assets", {});
2079
2073
  const head = context.getTemplateData("injectHead", []);
2080
2074
  const body = context.getTemplateData("injectBody", []);
2081
- for (const asset of toSorted(assets, byPriority)) {
2075
+ for (const asset of assets.toSorted(byPriority)) {
2082
2076
  const info = await compileScript({
2083
2077
  assetFolder,
2084
2078
  name: asset.name,
@@ -2205,10 +2199,10 @@ function isNavigationSection(node) {
2205
2199
  }
2206
2200
  function pathFromDoc({ fileInfo }) {
2207
2201
  if (fileInfo.name === "index") {
2208
- return [fileInfo.path.replace(/\\/g, "/"), true];
2202
+ return [fileInfo.path.replaceAll("\\", "/"), true];
2209
2203
  } else {
2210
2204
  return [
2211
- `./${path__default.join(fileInfo.path, fileInfo.name).replace(/\\/g, "/")}`,
2205
+ `./${path__default.join(fileInfo.path, fileInfo.name).replaceAll("\\", "/")}`,
2212
2206
  false
2213
2207
  ];
2214
2208
  }
@@ -2503,7 +2497,7 @@ ${searched}
2503
2497
  Make sure the name is correct and the template file exists in one of the listed directories.`;
2504
2498
  throw new Error(message);
2505
2499
  }
2506
- const content = await fs.readFile(filePath, "utf-8");
2500
+ const content = await fs.readFile(filePath, "utf8");
2507
2501
  const resolved = { content, filePath };
2508
2502
  templateCache.set(name, resolved);
2509
2503
  return resolved;
@@ -2515,7 +2509,7 @@ Make sure the name is correct and the template file exists in one of the listed
2515
2509
  }
2516
2510
  }
2517
2511
 
2518
- const messageRegex = /^[(][^)]+[)] \[Line \d+, Column \d+\]\n\s+Error: (.*)$/;
2512
+ const messageRegex = /^\([^)]+\) \[Line \d+, Column \d+]\n\s+Error: (.*)$/;
2519
2513
  function getActualMessage(message) {
2520
2514
  const match = messageRegex.exec(message);
2521
2515
  if (match) {
@@ -2528,7 +2522,7 @@ class TemplateRenderError extends Error {
2528
2522
  filename;
2529
2523
  constructor(message, filename) {
2530
2524
  super(getActualMessage(message));
2531
- this.name = "RenderError";
2525
+ this.name = "TemplateRenderError";
2532
2526
  this.filename = filename;
2533
2527
  }
2534
2528
  prettyError() {
@@ -2651,7 +2645,7 @@ async function compileStandalones(options) {
2651
2645
  ...templateData,
2652
2646
  content: task.content
2653
2647
  });
2654
- await fs.writeFile(outputFile, content, "utf-8");
2648
+ await fs.writeFile(outputFile, content, "utf8");
2655
2649
  }
2656
2650
  }
2657
2651
  function createTemplateLoader(folders) {
@@ -2659,7 +2653,7 @@ function createTemplateLoader(folders) {
2659
2653
  return loader;
2660
2654
  }
2661
2655
  function stripPrettierComments(content) {
2662
- return content.replace(/\s*<!-- prettier-ignore -->\s*/gm, "");
2656
+ return content.replaceAll(/\s*<!-- prettier-ignore -->\s*/gm, "");
2663
2657
  }
2664
2658
  async function render(doc, docs, nav, vendors, options) {
2665
2659
  const { fileInfo } = doc;
@@ -2684,7 +2678,7 @@ async function render(doc, docs, nav, vendors, options) {
2684
2678
  site: options.site,
2685
2679
  doc,
2686
2680
  get layoutClass() {
2687
- return `layout--${doc.template.replace(/[.]/g, "--")}`;
2681
+ return `layout--${doc.template.replaceAll(".", "--")}`;
2688
2682
  },
2689
2683
  topnav,
2690
2684
  rootUrl(doc2) {
@@ -2748,7 +2742,7 @@ async function render(doc, docs, nav, vendors, options) {
2748
2742
  getImportedSource(filename) {
2749
2743
  const context = `when importing example from "${fileInfo.fullPath}"`;
2750
2744
  const match = fileMatcher(filename, context);
2751
- return readFileSync(match, "utf-8");
2745
+ return readFileSync(match, "utf8");
2752
2746
  },
2753
2747
  addResource(dst2, src) {
2754
2748
  if (!existsSync(src)) {
@@ -2811,14 +2805,14 @@ async function render(doc, docs, nav, vendors, options) {
2811
2805
  const message = err instanceof Error ? err.message : String(err);
2812
2806
  throw new Error(`${prefix}: ${message}`, { cause: err });
2813
2807
  }
2814
- const expandedDst = dst.replace(/\[([^]+)\]/g, (match, key) => {
2808
+ const expandedDst = dst.replaceAll(/\[([^]+)]/g, (match, key) => {
2815
2809
  if (key === "hash") {
2816
2810
  return getFingerprint(doc.body);
2817
2811
  } else {
2818
2812
  return match;
2819
2813
  }
2820
2814
  });
2821
- const writeFile = fs.writeFile(expandedDst, content, "utf-8");
2815
+ const writeFile = fs.writeFile(expandedDst, content, "utf8");
2822
2816
  try {
2823
2817
  const assets = Object.values(templateData.assets).filter(
2824
2818
  (it) => it.importmap
@@ -2881,9 +2875,9 @@ function nunjucksProcessor(options) {
2881
2875
  }
2882
2876
  });
2883
2877
  }
2884
- const formats = ["markdown", "json"];
2878
+ const formats = /* @__PURE__ */ new Set(["markdown", "json"]);
2885
2879
  const docs = context.docs.filter(isDocumentPage).filter((it) => {
2886
- if (!formats.includes(it.format)) {
2880
+ if (!formats.has(it.format)) {
2887
2881
  return false;
2888
2882
  }
2889
2883
  return it.fileInfo.outputName;
@@ -2932,7 +2926,7 @@ async function keypress() {
2932
2926
  process.stdin.once("data", (data) => {
2933
2927
  process.stdin.setRawMode(false);
2934
2928
  process.stdin.resume();
2935
- resolve(data.toString("utf-8"));
2929
+ resolve(data.toString("utf8"));
2936
2930
  });
2937
2931
  });
2938
2932
  }
@@ -3028,7 +3022,7 @@ async function serve(options) {
3028
3022
 
3029
3023
  function getAssetSource(asset) {
3030
3024
  const lines = [];
3031
- const pkg = asset.package.replace(/\\/g, "/");
3025
+ const pkg = asset.package.replaceAll("\\", "/");
3032
3026
  lines.push(`export * from "${pkg}";`);
3033
3027
  return lines.join("\n");
3034
3028
  }
@@ -3038,7 +3032,7 @@ async function compileVendor(assetFolder, vendor, options) {
3038
3032
  const outfile = `temp/vendor-${slug}.out.js`;
3039
3033
  const tmpfile = `temp/vendor-${slug}.in.js`;
3040
3034
  const source = getAssetSource(vendor);
3041
- await fs.writeFile(tmpfile, source, "utf-8");
3035
+ await fs.writeFile(tmpfile, source, "utf8");
3042
3036
  await esbuild$1.build({
3043
3037
  entryPoints: [tmpfile],
3044
3038
  outfile,
@@ -3055,11 +3049,11 @@ async function compileVendor(assetFolder, vendor, options) {
3055
3049
  alias: vendor.alias ? { [vendor.package]: vendor.alias } : void 0,
3056
3050
  ...options
3057
3051
  });
3058
- const content = await fs.readFile(outfile, "utf-8");
3052
+ const content = await fs.readFile(outfile, "utf8");
3059
3053
  const fingerprint = getFingerprint(content);
3060
3054
  const integrity = getIntegrity(content);
3061
3055
  const filename = `vendor-${slug}-${fingerprint}.js`;
3062
- const dst = path__default.join(assetFolder, filename).replace(/\\/g, "/");
3056
+ const dst = path__default.join(assetFolder, filename).replaceAll("\\", "/");
3063
3057
  await fs.rename(outfile, dst);
3064
3058
  const stat = await fs.stat(dst);
3065
3059
  return {
@@ -3137,7 +3131,8 @@ function filterProcessors(stage2, processors) {
3137
3131
  }
3138
3132
  return [...before, ...during, ...after];
3139
3133
  }
3140
- async function stage(stage2, context, processors, { verbose } = { verbose: true }) {
3134
+ async function stage(stage2, context, processors, options) {
3135
+ const { verbose = true } = options ?? {};
3141
3136
  if (verbose) {
3142
3137
  console.log(`stage:${stage2}`);
3143
3138
  }
@@ -3215,7 +3210,7 @@ function createContext(outputFolder, templateLoader) {
3215
3210
  },
3216
3211
  addResource(dst, src) {
3217
3212
  resources.push({
3218
- from: src.replace(/\\/g, "/"),
3213
+ from: src.replaceAll("\\", "/"),
3219
3214
  to: dst
3220
3215
  });
3221
3216
  },
@@ -3292,7 +3287,7 @@ class Generator {
3292
3287
  "[docs-generator] deprecated: not passing import.meta.url as the first argument is deprecated, assuming `process.cwd()`."
3293
3288
  );
3294
3289
  }
3295
- if (typeof options.site === "undefined") {
3290
+ if (options.site === void 0) {
3296
3291
  throw new Error("site metadata not set in configuration");
3297
3292
  }
3298
3293
  this.cwd = cwd;
@@ -3305,7 +3300,7 @@ class Generator {
3305
3300
  this.templateFolders = options.templateFolders ?? [];
3306
3301
  this.processors = options.processors ?? [];
3307
3302
  this.vendor = options.vendor ?? [];
3308
- this.setupPath = options.setupPath.replace(/\\/g, "/");
3303
+ this.setupPath = options.setupPath.replaceAll("\\", "/");
3309
3304
  this.scripts = [];
3310
3305
  this.styles = [];
3311
3306
  this.resources = [];
@@ -3357,7 +3352,7 @@ class Generator {
3357
3352
  */
3358
3353
  copyResource(dst, src) {
3359
3354
  this.resources.push({
3360
- from: src.replace(/\\/g, "/"),
3355
+ from: src.replaceAll("\\", "/"),
3361
3356
  to: dst
3362
3357
  });
3363
3358
  }
@@ -3447,7 +3442,7 @@ class Generator {
3447
3442
  */
3448
3443
  serve() {
3449
3444
  const { outputFolder, sourceFiles } = this;
3450
- const watch = sourceFiles.map((it) => it.include).flat();
3445
+ const watch = sourceFiles.flatMap((it) => it.include);
3451
3446
  return serve({
3452
3447
  outputFolder,
3453
3448
  watch,