@forsakringskassan/vite-lib-config 5.1.8 → 5.2.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.
@@ -4,8 +4,9 @@ import { cli } from "../dist/cli.mjs";
4
4
 
5
5
  const argv = process.argv.slice(2);
6
6
 
7
- /* eslint-disable-next-line unicorn/prefer-top-level-await -- technical debt, this still runs as commonjs */
8
- cli(argv).catch((err) => {
7
+ try {
8
+ await cli(argv);
9
+ } catch (err) {
9
10
  console.error(err);
10
11
  process.exitCode = 1;
11
- });
12
+ }
@@ -2495,7 +2495,7 @@ import path from "node:path";
2495
2495
  import fs, { promises as fsPromises } from "node:fs";
2496
2496
  import { fileURLToPath } from "node:url";
2497
2497
 
2498
- // node_modules/p-locate/node_modules/yocto-queue/index.js
2498
+ // node_modules/yocto-queue/index.js
2499
2499
  var Node = class {
2500
2500
  value;
2501
2501
  next;
@@ -2561,7 +2561,7 @@ var Queue = class {
2561
2561
  }
2562
2562
  };
2563
2563
 
2564
- // node_modules/p-locate/node_modules/p-limit/index.js
2564
+ // node_modules/p-limit/index.js
2565
2565
  function pLimit(concurrency) {
2566
2566
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
2567
2567
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
@@ -5842,7 +5842,7 @@ function extractAugmentations(content) {
5842
5842
  const matches = content.matchAll(
5843
5843
  /^declare (?:module\s*"([^"]+)"|global)\s*\{([\s\S]+?)^\}/gm
5844
5844
  );
5845
- return Array.from(matches).map((it2) => {
5845
+ return Array.from(matches, (it2) => {
5846
5846
  const [withDeclaration, name = "", withoutDeclaration] = it2;
5847
5847
  if (name.startsWith(".")) {
5848
5848
  const exported = withoutDeclaration.replaceAll(
@@ -5850,9 +5850,8 @@ function extractAugmentations(content) {
5850
5850
  "$1export interface"
5851
5851
  );
5852
5852
  return dedent_default(exported);
5853
- } else {
5854
- return withDeclaration;
5855
5853
  }
5854
+ return withDeclaration;
5856
5855
  });
5857
5856
  }
5858
5857
 
@@ -5860,10 +5859,9 @@ function extractAugmentations(content) {
5860
5859
  async function getConfigFiles(configFiles) {
5861
5860
  if (configFiles.length > 0) {
5862
5861
  return configFiles.flatMap((it2) => ts(it2));
5863
- } else {
5864
- const result = await findUp("api-extractor.json");
5865
- return result ? [result] : [];
5866
5862
  }
5863
+ const result = await findUp("api-extractor.json");
5864
+ return result ? [result] : [];
5867
5865
  }
5868
5866
  async function findReferencedFiles(filename, visited) {
5869
5867
  if (visited.has(filename)) {
@@ -5917,9 +5915,9 @@ async function patchAugmentations(config) {
5917
5915
  "declaration files referenced by",
5918
5916
  mainEntryPointFilePath
5919
5917
  );
5920
- const augmentations = await Promise.all(
5921
- Array.from(files).map(extract)
5922
- ).then((it2) => it2.flat());
5918
+ const promises = Array.from(files, (it2) => extract(it2));
5919
+ const result = await Promise.all(promises);
5920
+ const augmentations = result.flat();
5923
5921
  console.log("Found", augmentations.length, "module augmentation(s)");
5924
5922
  if (augmentations.length > 0) {
5925
5923
  console.log("Writing", publicTrimmedFilePath);
@@ -5957,7 +5955,6 @@ async function patchDeclareVarVls(declarationDir) {
5957
5955
  }
5958
5956
  async function run(argv) {
5959
5957
  const flags = new Set(argv.filter((it2) => it2.startsWith("--")));
5960
- const positional = argv.filter((it2) => !it2.startsWith("--"));
5961
5958
  if (flags.has("--help")) {
5962
5959
  console.log("usage: fk-api-extractor [OPTIONS..] [FILENAME..]");
5963
5960
  console.log(`
@@ -5975,6 +5972,7 @@ only.
5975
5972
  `);
5976
5973
  return;
5977
5974
  }
5975
+ const positional = argv.filter((it2) => !it2.startsWith("--"));
5978
5976
  const configFiles = await getConfigFiles(positional);
5979
5977
  const numFiles = configFiles.length;
5980
5978
  const strFiles = `${String(numFiles)} file${numFiles === 1 ? "" : "s"}`;
@@ -1701,7 +1701,11 @@ var require_parse = __commonJS({
1701
1701
  }
1702
1702
  }
1703
1703
  };
1704
- var getStarExtglobSequenceOutput = (pattern) => {
1704
+ var buildCharClassStar = (chars3) => {
1705
+ const source = chars3.length === 1 ? utils.escapeRegex(chars3[0]) : `[${chars3.map((ch) => utils.escapeRegex(ch)).join("")}]`;
1706
+ return `${source}*`;
1707
+ };
1708
+ var getStarExtglobSequenceChars = (pattern) => {
1705
1709
  let index = 0;
1706
1710
  const chars3 = [];
1707
1711
  while (index < pattern.length) {
@@ -1723,8 +1727,7 @@ var require_parse = __commonJS({
1723
1727
  if (chars3.length < 1) {
1724
1728
  return;
1725
1729
  }
1726
- const source = chars3.length === 1 ? utils.escapeRegex(chars3[0]) : `[${chars3.map((ch) => utils.escapeRegex(ch)).join("")}]`;
1727
- return `${source}*`;
1730
+ return chars3;
1728
1731
  };
1729
1732
  var repeatedExtglobRecursion = (pattern) => {
1730
1733
  let depth = 0;
@@ -1748,15 +1751,29 @@ var require_parse = __commonJS({
1748
1751
  return { risky: true };
1749
1752
  }
1750
1753
  }
1754
+ const safeChars = [];
1755
+ let sawStarSequence = false;
1756
+ let combinable = true;
1751
1757
  for (const branch of branches) {
1752
- const safeOutput = getStarExtglobSequenceOutput(branch);
1753
- if (safeOutput) {
1754
- return { risky: true, safeOutput };
1758
+ const chars3 = getStarExtglobSequenceChars(branch);
1759
+ if (chars3) {
1760
+ sawStarSequence = true;
1761
+ safeChars.push(...chars3);
1762
+ continue;
1763
+ }
1764
+ const literal = normalizeSimpleBranch(branch);
1765
+ if (literal && literal.length === 1) {
1766
+ safeChars.push(literal);
1767
+ continue;
1755
1768
  }
1769
+ combinable = false;
1756
1770
  if (repeatedExtglobRecursion(branch) > max) {
1757
1771
  return { risky: true };
1758
1772
  }
1759
1773
  }
1774
+ if (sawStarSequence) {
1775
+ return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
1776
+ }
1760
1777
  return { risky: false };
1761
1778
  };
1762
1779
  var parse3 = (input, options) => {
@@ -2606,9 +2623,9 @@ var require_picomatch = __commonJS({
2606
2623
  }
2607
2624
  return { isMatch: Boolean(match), match, output };
2608
2625
  };
2609
- picomatch.matchBase = (input, glob, options) => {
2626
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
2610
2627
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
2611
- return regex.test(utils.basename(input));
2628
+ return regex.test(utils.basename(input, { windows: posix }));
2612
2629
  };
2613
2630
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
2614
2631
  picomatch.parse = (pattern, options) => {
@@ -4715,7 +4732,7 @@ var import_node_path = __toESM(require("node:path"), 1);
4715
4732
  var import_node_crypto = __toESM(require("node:crypto"), 1);
4716
4733
  var import_node_tty = require("node:tty");
4717
4734
  var import_node_util = require("node:util");
4718
- var version = "6.0.7";
4735
+ var version = "6.0.8";
4719
4736
  function resolveCompiler(root) {
4720
4737
  const compiler = tryResolveCompiler(root) || tryResolveCompiler();
4721
4738
  if (!compiler) throw new Error("Failed to resolve vue/compiler-sfc.\n@vitejs/plugin-vue requires vue (>=3.2.25) to be present in the dependency tree.");
@@ -4832,6 +4849,18 @@ function createRollupError(id2, error) {
4832
4849
  };
4833
4850
  return rollupError;
4834
4851
  }
4852
+ function isVaporMode(descriptor, options) {
4853
+ if (descriptor.vapor) return true;
4854
+ if (options.features?.vapor) return canForceVaporMode(descriptor);
4855
+ return false;
4856
+ }
4857
+ function canForceVaporMode(descriptor) {
4858
+ if (descriptor.filename.endsWith(".vue")) {
4859
+ if (descriptor.scriptSetup) return true;
4860
+ if (descriptor.script) return false;
4861
+ }
4862
+ return true;
4863
+ }
4835
4864
  async function transformTemplateAsModule(code2, filename, descriptor, options, pluginContext, ssr, customElement) {
4836
4865
  const result = compile(code2, filename, descriptor, options, pluginContext, ssr, customElement);
4837
4866
  let returnCode = result.code;
@@ -4906,7 +4935,7 @@ function resolveTemplateCompilerOptions(descriptor, options, filename, ssr) {
4906
4935
  if (lang && /tsx?$/.test(lang) && !expressionPlugins.includes("typescript")) expressionPlugins.push("typescript");
4907
4936
  return {
4908
4937
  ...options.template,
4909
- vapor: descriptor.vapor,
4938
+ vapor: isVaporMode(descriptor, options),
4910
4939
  id: id2,
4911
4940
  ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
4912
4941
  filename,
@@ -4972,6 +5001,7 @@ function resolveScript(descriptor, options, ssr, customElement) {
4972
5001
  sourceMap: options.sourceMap,
4973
5002
  genDefaultAs: canInlineMain(descriptor, options) ? scriptIdentifier : void 0,
4974
5003
  customElement,
5004
+ vapor: isVaporMode(descriptor, options),
4975
5005
  propsDestructure: options.features?.propsDestructure ?? options.script?.propsDestructure
4976
5006
  });
4977
5007
  if (!options.isProduction && resolved?.deps) {
@@ -4995,8 +5025,8 @@ function canInlineMain(descriptor, options) {
4995
5025
  var comma = ",".charCodeAt(0);
4996
5026
  var semicolon = ";".charCodeAt(0);
4997
5027
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
4998
- var intToChar = new Uint8Array(64);
4999
- var charToInt = new Uint8Array(128);
5028
+ var intToChar = /* @__PURE__ */ new Uint8Array(64);
5029
+ var charToInt = /* @__PURE__ */ new Uint8Array(128);
5000
5030
  for (let i = 0; i < chars.length; i++) {
5001
5031
  const c = chars.charCodeAt(i);
5002
5032
  intToChar[i] = c;
@@ -5607,8 +5637,8 @@ function createDebug$1(namespace, options) {
5607
5637
  options.formatArgs.call(debug2, diff, args);
5608
5638
  debug2.log(...args);
5609
5639
  };
5610
- debug2.extend = function(namespace$1, delimiter = ":") {
5611
- return createDebug$1(this.namespace + delimiter + namespace$1, {
5640
+ debug2.extend = function(namespace2, delimiter = ":") {
5641
+ return createDebug$1(this.namespace + delimiter + namespace2, {
5612
5642
  useColors: this.useColors,
5613
5643
  color: this.color,
5614
5644
  formatArgs: this.formatArgs,
@@ -5639,8 +5669,8 @@ function createDebug$1(namespace, options) {
5639
5669
  }
5640
5670
  var names = [];
5641
5671
  var skips = [];
5642
- function enable(namespaces$1) {
5643
- globalNamespaces = namespaces$1;
5672
+ function enable(namespaces) {
5673
+ globalNamespaces = namespaces;
5644
5674
  names = [];
5645
5675
  skips = [];
5646
5676
  const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
@@ -5747,7 +5777,7 @@ var inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key))
5747
5777
  else value = Number(value);
5748
5778
  obj[prop] = value;
5749
5779
  return obj;
5750
- }, {});
5780
+ }, /* @__PURE__ */ Object.create(null));
5751
5781
  function useColors() {
5752
5782
  return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : (0, import_node_tty.isatty)(process.stderr.fd);
5753
5783
  }
@@ -5756,8 +5786,8 @@ function getDate() {
5756
5786
  return `${(/* @__PURE__ */ new Date()).toISOString()} `;
5757
5787
  }
5758
5788
  function formatArgs(diff, args) {
5759
- const { namespace: name, useColors: useColors$1 } = this;
5760
- if (useColors$1) {
5789
+ const { namespace: name, useColors: useColors2 } = this;
5790
+ if (useColors2) {
5761
5791
  const c = this.color;
5762
5792
  const colorCode = `\x1B[3${c < 8 ? c : `8;5;${c}`}`;
5763
5793
  const prefix = ` ${colorCode};1m${name} \x1B[0m`;
@@ -5774,10 +5804,16 @@ var defaultOptions = {
5774
5804
  useColors: useColors(),
5775
5805
  formatArgs,
5776
5806
  formatters: {
5807
+ /**
5808
+ * Map %o to `util.inspect()`, all on a single line.
5809
+ */
5777
5810
  o(v2) {
5778
5811
  this.inspectOpts.colors = this.useColors;
5779
5812
  return (0, import_node_util.inspect)(v2, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
5780
5813
  },
5814
+ /**
5815
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
5816
+ */
5781
5817
  O(v2) {
5782
5818
  this.inspectOpts.colors = this.useColors;
5783
5819
  return (0, import_node_util.inspect)(v2, this.inspectOpts);
@@ -5956,7 +5992,7 @@ async function transformMain(code2, filename, options, pluginContext, ssr, custo
5956
5992
  }
5957
5993
  const attachedProps = [];
5958
5994
  const hasScoped = descriptor.styles.some((s) => s.scoped);
5959
- const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
5995
+ const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && isVaporMode(descriptor, options);
5960
5996
  const { code: scriptCode, map: scriptMap } = await genScriptCode(descriptor, options, pluginContext, ssr, customElement);
5961
5997
  const hasTemplateImport = descriptor.template && !isUseInlineTemplate(descriptor, options);
5962
5998
  const isTemplateInlined = !!descriptor.template && (!descriptor.template.lang || descriptor.template.lang === "html") && !descriptor.template.src;
@@ -6053,7 +6089,7 @@ async function transformMain(code2, filename, options, pluginContext, ssr, custo
6053
6089
  async function genTemplateCode(descriptor, options, pluginContext, ssr, customElement) {
6054
6090
  const template = descriptor.template;
6055
6091
  const hasScoped = descriptor.styles.some((style) => style.scoped);
6056
- const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
6092
+ const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && isVaporMode(descriptor, options);
6057
6093
  if ((!template.lang || template.lang === "html") && !template.src) {
6058
6094
  const result = transformTemplateInMain(template.content, descriptor, options, pluginContext, ssr, customElement);
6059
6095
  return {
@@ -6073,7 +6109,7 @@ async function genTemplateCode(descriptor, options, pluginContext, ssr, customEl
6073
6109
  }
6074
6110
  }
6075
6111
  async function genScriptCode(descriptor, options, pluginContext, ssr, customElement) {
6076
- let scriptCode = `const ${scriptIdentifier} = { ${descriptor.vapor ? "__vapor: true" : ""} }`;
6112
+ let scriptCode = `const ${scriptIdentifier} = { ${isVaporMode(descriptor, options) ? "__vapor: true" : ""} }`;
6077
6113
  let map;
6078
6114
  const script = resolveScript(descriptor, options, ssr, customElement);
6079
6115
  if (script) if (canInlineMain(descriptor, options)) {
@@ -10904,8 +10940,11 @@ function customMappingPlugin() {
10904
10940
  const replacement = folder[format2];
10905
10941
  return {
10906
10942
  ...options,
10907
- dir: dir?.replace("[custom-format]", replacement),
10908
- entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace("[custom-format]", replacement) : entryFileNames
10943
+ dir: dir?.replace("[custom-format]", () => replacement),
10944
+ entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
10945
+ "[custom-format]",
10946
+ () => replacement
10947
+ ) : entryFileNames
10909
10948
  };
10910
10949
  }
10911
10950
  };
@@ -11166,12 +11205,11 @@ ${indent}`);
11166
11205
  // src/utils/pretty-list.ts
11167
11206
  function prettyList(deps, predicate) {
11168
11207
  const filtered = predicate ? deps.filter(predicate) : deps;
11169
- filtered.sort();
11208
+ filtered.sort((a, b) => a.localeCompare(b));
11170
11209
  if (filtered.length > 0) {
11171
11210
  return ["", ...filtered.map((it2) => ` - ${it2}`)].join("\n");
11172
- } else {
11173
- return "(none)";
11174
11211
  }
11212
+ return "(none)";
11175
11213
  }
11176
11214
 
11177
11215
  // src/vite.config.ts
@@ -1699,7 +1699,11 @@ var require_parse = __commonJS({
1699
1699
  }
1700
1700
  }
1701
1701
  };
1702
- var getStarExtglobSequenceOutput = (pattern) => {
1702
+ var buildCharClassStar = (chars3) => {
1703
+ const source = chars3.length === 1 ? utils.escapeRegex(chars3[0]) : `[${chars3.map((ch) => utils.escapeRegex(ch)).join("")}]`;
1704
+ return `${source}*`;
1705
+ };
1706
+ var getStarExtglobSequenceChars = (pattern) => {
1703
1707
  let index = 0;
1704
1708
  const chars3 = [];
1705
1709
  while (index < pattern.length) {
@@ -1721,8 +1725,7 @@ var require_parse = __commonJS({
1721
1725
  if (chars3.length < 1) {
1722
1726
  return;
1723
1727
  }
1724
- const source = chars3.length === 1 ? utils.escapeRegex(chars3[0]) : `[${chars3.map((ch) => utils.escapeRegex(ch)).join("")}]`;
1725
- return `${source}*`;
1728
+ return chars3;
1726
1729
  };
1727
1730
  var repeatedExtglobRecursion = (pattern) => {
1728
1731
  let depth = 0;
@@ -1746,15 +1749,29 @@ var require_parse = __commonJS({
1746
1749
  return { risky: true };
1747
1750
  }
1748
1751
  }
1752
+ const safeChars = [];
1753
+ let sawStarSequence = false;
1754
+ let combinable = true;
1749
1755
  for (const branch of branches) {
1750
- const safeOutput = getStarExtglobSequenceOutput(branch);
1751
- if (safeOutput) {
1752
- return { risky: true, safeOutput };
1756
+ const chars3 = getStarExtglobSequenceChars(branch);
1757
+ if (chars3) {
1758
+ sawStarSequence = true;
1759
+ safeChars.push(...chars3);
1760
+ continue;
1761
+ }
1762
+ const literal = normalizeSimpleBranch(branch);
1763
+ if (literal && literal.length === 1) {
1764
+ safeChars.push(literal);
1765
+ continue;
1753
1766
  }
1767
+ combinable = false;
1754
1768
  if (repeatedExtglobRecursion(branch) > max) {
1755
1769
  return { risky: true };
1756
1770
  }
1757
1771
  }
1772
+ if (sawStarSequence) {
1773
+ return combinable ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } : { risky: true };
1774
+ }
1758
1775
  return { risky: false };
1759
1776
  };
1760
1777
  var parse3 = (input, options) => {
@@ -2604,9 +2621,9 @@ var require_picomatch = __commonJS({
2604
2621
  }
2605
2622
  return { isMatch: Boolean(match), match, output };
2606
2623
  };
2607
- picomatch.matchBase = (input, glob, options) => {
2624
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
2608
2625
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
2609
- return regex.test(utils.basename(input));
2626
+ return regex.test(utils.basename(input, { windows: posix }));
2610
2627
  };
2611
2628
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
2612
2629
  picomatch.parse = (pattern, options) => {
@@ -4707,7 +4724,7 @@ import path from "node:path";
4707
4724
  import crypto from "node:crypto";
4708
4725
  import { isatty } from "node:tty";
4709
4726
  import { formatWithOptions, inspect } from "node:util";
4710
- var version = "6.0.7";
4727
+ var version = "6.0.8";
4711
4728
  function resolveCompiler(root) {
4712
4729
  const compiler = tryResolveCompiler(root) || tryResolveCompiler();
4713
4730
  if (!compiler) throw new Error("Failed to resolve vue/compiler-sfc.\n@vitejs/plugin-vue requires vue (>=3.2.25) to be present in the dependency tree.");
@@ -4824,6 +4841,18 @@ function createRollupError(id2, error) {
4824
4841
  };
4825
4842
  return rollupError;
4826
4843
  }
4844
+ function isVaporMode(descriptor, options) {
4845
+ if (descriptor.vapor) return true;
4846
+ if (options.features?.vapor) return canForceVaporMode(descriptor);
4847
+ return false;
4848
+ }
4849
+ function canForceVaporMode(descriptor) {
4850
+ if (descriptor.filename.endsWith(".vue")) {
4851
+ if (descriptor.scriptSetup) return true;
4852
+ if (descriptor.script) return false;
4853
+ }
4854
+ return true;
4855
+ }
4827
4856
  async function transformTemplateAsModule(code2, filename, descriptor, options, pluginContext, ssr, customElement) {
4828
4857
  const result = compile(code2, filename, descriptor, options, pluginContext, ssr, customElement);
4829
4858
  let returnCode = result.code;
@@ -4898,7 +4927,7 @@ function resolveTemplateCompilerOptions(descriptor, options, filename, ssr) {
4898
4927
  if (lang && /tsx?$/.test(lang) && !expressionPlugins.includes("typescript")) expressionPlugins.push("typescript");
4899
4928
  return {
4900
4929
  ...options.template,
4901
- vapor: descriptor.vapor,
4930
+ vapor: isVaporMode(descriptor, options),
4902
4931
  id: id2,
4903
4932
  ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
4904
4933
  filename,
@@ -4964,6 +4993,7 @@ function resolveScript(descriptor, options, ssr, customElement) {
4964
4993
  sourceMap: options.sourceMap,
4965
4994
  genDefaultAs: canInlineMain(descriptor, options) ? scriptIdentifier : void 0,
4966
4995
  customElement,
4996
+ vapor: isVaporMode(descriptor, options),
4967
4997
  propsDestructure: options.features?.propsDestructure ?? options.script?.propsDestructure
4968
4998
  });
4969
4999
  if (!options.isProduction && resolved?.deps) {
@@ -4987,8 +5017,8 @@ function canInlineMain(descriptor, options) {
4987
5017
  var comma = ",".charCodeAt(0);
4988
5018
  var semicolon = ";".charCodeAt(0);
4989
5019
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
4990
- var intToChar = new Uint8Array(64);
4991
- var charToInt = new Uint8Array(128);
5020
+ var intToChar = /* @__PURE__ */ new Uint8Array(64);
5021
+ var charToInt = /* @__PURE__ */ new Uint8Array(128);
4992
5022
  for (let i = 0; i < chars.length; i++) {
4993
5023
  const c = chars.charCodeAt(i);
4994
5024
  intToChar[i] = c;
@@ -5599,8 +5629,8 @@ function createDebug$1(namespace, options) {
5599
5629
  options.formatArgs.call(debug2, diff, args);
5600
5630
  debug2.log(...args);
5601
5631
  };
5602
- debug2.extend = function(namespace$1, delimiter = ":") {
5603
- return createDebug$1(this.namespace + delimiter + namespace$1, {
5632
+ debug2.extend = function(namespace2, delimiter = ":") {
5633
+ return createDebug$1(this.namespace + delimiter + namespace2, {
5604
5634
  useColors: this.useColors,
5605
5635
  color: this.color,
5606
5636
  formatArgs: this.formatArgs,
@@ -5631,8 +5661,8 @@ function createDebug$1(namespace, options) {
5631
5661
  }
5632
5662
  var names = [];
5633
5663
  var skips = [];
5634
- function enable(namespaces$1) {
5635
- globalNamespaces = namespaces$1;
5664
+ function enable(namespaces) {
5665
+ globalNamespaces = namespaces;
5636
5666
  names = [];
5637
5667
  skips = [];
5638
5668
  const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
@@ -5739,7 +5769,7 @@ var inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key))
5739
5769
  else value = Number(value);
5740
5770
  obj[prop] = value;
5741
5771
  return obj;
5742
- }, {});
5772
+ }, /* @__PURE__ */ Object.create(null));
5743
5773
  function useColors() {
5744
5774
  return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd);
5745
5775
  }
@@ -5748,8 +5778,8 @@ function getDate() {
5748
5778
  return `${(/* @__PURE__ */ new Date()).toISOString()} `;
5749
5779
  }
5750
5780
  function formatArgs(diff, args) {
5751
- const { namespace: name, useColors: useColors$1 } = this;
5752
- if (useColors$1) {
5781
+ const { namespace: name, useColors: useColors2 } = this;
5782
+ if (useColors2) {
5753
5783
  const c = this.color;
5754
5784
  const colorCode = `\x1B[3${c < 8 ? c : `8;5;${c}`}`;
5755
5785
  const prefix = ` ${colorCode};1m${name} \x1B[0m`;
@@ -5766,10 +5796,16 @@ var defaultOptions = {
5766
5796
  useColors: useColors(),
5767
5797
  formatArgs,
5768
5798
  formatters: {
5799
+ /**
5800
+ * Map %o to `util.inspect()`, all on a single line.
5801
+ */
5769
5802
  o(v2) {
5770
5803
  this.inspectOpts.colors = this.useColors;
5771
5804
  return inspect(v2, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
5772
5805
  },
5806
+ /**
5807
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
5808
+ */
5773
5809
  O(v2) {
5774
5810
  this.inspectOpts.colors = this.useColors;
5775
5811
  return inspect(v2, this.inspectOpts);
@@ -5948,7 +5984,7 @@ async function transformMain(code2, filename, options, pluginContext, ssr, custo
5948
5984
  }
5949
5985
  const attachedProps = [];
5950
5986
  const hasScoped = descriptor.styles.some((s) => s.scoped);
5951
- const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
5987
+ const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && isVaporMode(descriptor, options);
5952
5988
  const { code: scriptCode, map: scriptMap } = await genScriptCode(descriptor, options, pluginContext, ssr, customElement);
5953
5989
  const hasTemplateImport = descriptor.template && !isUseInlineTemplate(descriptor, options);
5954
5990
  const isTemplateInlined = !!descriptor.template && (!descriptor.template.lang || descriptor.template.lang === "html") && !descriptor.template.src;
@@ -6045,7 +6081,7 @@ async function transformMain(code2, filename, options, pluginContext, ssr, custo
6045
6081
  async function genTemplateCode(descriptor, options, pluginContext, ssr, customElement) {
6046
6082
  const template = descriptor.template;
6047
6083
  const hasScoped = descriptor.styles.some((style) => style.scoped);
6048
- const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
6084
+ const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && isVaporMode(descriptor, options);
6049
6085
  if ((!template.lang || template.lang === "html") && !template.src) {
6050
6086
  const result = transformTemplateInMain(template.content, descriptor, options, pluginContext, ssr, customElement);
6051
6087
  return {
@@ -6065,7 +6101,7 @@ async function genTemplateCode(descriptor, options, pluginContext, ssr, customEl
6065
6101
  }
6066
6102
  }
6067
6103
  async function genScriptCode(descriptor, options, pluginContext, ssr, customElement) {
6068
- let scriptCode = `const ${scriptIdentifier} = { ${descriptor.vapor ? "__vapor: true" : ""} }`;
6104
+ let scriptCode = `const ${scriptIdentifier} = { ${isVaporMode(descriptor, options) ? "__vapor: true" : ""} }`;
6069
6105
  let map;
6070
6106
  const script = resolveScript(descriptor, options, ssr, customElement);
6071
6107
  if (script) if (canInlineMain(descriptor, options)) {
@@ -10896,8 +10932,11 @@ function customMappingPlugin() {
10896
10932
  const replacement = folder[format2];
10897
10933
  return {
10898
10934
  ...options,
10899
- dir: dir?.replace("[custom-format]", replacement),
10900
- entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace("[custom-format]", replacement) : entryFileNames
10935
+ dir: dir?.replace("[custom-format]", () => replacement),
10936
+ entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
10937
+ "[custom-format]",
10938
+ () => replacement
10939
+ ) : entryFileNames
10901
10940
  };
10902
10941
  }
10903
10942
  };
@@ -11158,12 +11197,11 @@ ${indent}`);
11158
11197
  // src/utils/pretty-list.ts
11159
11198
  function prettyList(deps, predicate) {
11160
11199
  const filtered = predicate ? deps.filter(predicate) : deps;
11161
- filtered.sort();
11200
+ filtered.sort((a, b) => a.localeCompare(b));
11162
11201
  if (filtered.length > 0) {
11163
11202
  return ["", ...filtered.map((it2) => ` - ${it2}`)].join("\n");
11164
- } else {
11165
- return "(none)";
11166
11203
  }
11204
+ return "(none)";
11167
11205
  }
11168
11206
 
11169
11207
  // src/vite.config.ts
@@ -13,10 +13,10 @@ var __export = (target, all) => {
13
13
  __defProp(target, name, { get: all[name], enumerable: true });
14
14
  };
15
15
 
16
- // node_modules/p-locate/node_modules/yocto-queue/index.js
16
+ // node_modules/yocto-queue/index.js
17
17
  var Node, Queue;
18
18
  var init_yocto_queue = __esm({
19
- "node_modules/p-locate/node_modules/yocto-queue/index.js"() {
19
+ "node_modules/yocto-queue/index.js"() {
20
20
  Node = class {
21
21
  value;
22
22
  next;
@@ -84,7 +84,7 @@ var init_yocto_queue = __esm({
84
84
  }
85
85
  });
86
86
 
87
- // node_modules/p-locate/node_modules/p-limit/index.js
87
+ // node_modules/p-limit/index.js
88
88
  function pLimit(concurrency) {
89
89
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
90
90
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
@@ -135,7 +135,7 @@ function pLimit(concurrency) {
135
135
  return generator;
136
136
  }
137
137
  var init_p_limit = __esm({
138
- "node_modules/p-locate/node_modules/p-limit/index.js"() {
138
+ "node_modules/p-limit/index.js"() {
139
139
  init_yocto_queue();
140
140
  }
141
141
  });
@@ -491,11 +491,11 @@ var boilerplate = `/* This file was generated by @forsakringskassan/vite-lib-con
491
491
  function detectTestRunner(flags) {
492
492
  if (flags.has("--with-jest")) {
493
493
  return "jest";
494
- } else if (flags.has("--with-vitest")) {
495
- return "vitest";
496
- } else {
494
+ }
495
+ if (flags.has("--with-vitest")) {
497
496
  return "vitest";
498
497
  }
498
+ return "vitest";
499
499
  }
500
500
  async function serializeJson(data) {
501
501
  const { format, resolveConfig } = await import("prettier");
@@ -649,7 +649,7 @@ async function run(cwd, argv) {
649
649
  console.log("Test runner:", testRunner);
650
650
  console.log();
651
651
  const written = /* @__PURE__ */ new Set();
652
- for (const [filename, promise] of generated.entries()) {
652
+ for (const [filename, promise] of generated) {
653
653
  const content = await promise;
654
654
  if (content) {
655
655
  await writeJsonFile(cwd, filename, content);
@@ -658,10 +658,11 @@ async function run(cwd, argv) {
658
658
  }
659
659
  const entries = await fs3.readdir(cwd);
660
660
  for (const entry of entries) {
661
- if (isTSConfigFile(entry) && !written.has(entry)) {
662
- await fs3.unlink(path3.join(cwd, entry));
663
- console.log(entry, "removed");
661
+ if (!isTSConfigFile(entry) || written.has(entry)) {
662
+ continue;
664
663
  }
664
+ await fs3.unlink(path3.join(cwd, entry));
665
+ console.log(entry, "removed");
665
666
  }
666
667
  console.groupEnd();
667
668
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vite-lib-config",
3
- "version": "5.1.8",
3
+ "version": "5.2.1",
4
4
  "description": "Försäkringskassan toolchain to build libraries with Vite",
5
5
  "keywords": [
6
6
  "vite"
@@ -60,18 +60,12 @@
60
60
  "@fkui/tsconfig": ">= 6.3.0",
61
61
  "@forsakringskassan/apimock-express": "^1.1.0 || ^2.0.0 || ^3.0.0",
62
62
  "prettier": "^3.0.0",
63
- "typescript": "^5.0.2 || ^6.0.2",
63
+ "typescript": "^5.0.2 || ^6.0.2 || ^7.0.0",
64
64
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0",
65
65
  "vue": "^3.0.0"
66
66
  },
67
67
  "engines": {
68
68
  "node": "^22.12.0 || >= 24",
69
69
  "npm": ">= 11.0.0"
70
- },
71
- "allowScripts": {
72
- "core-js": false,
73
- "esbuild": true,
74
- "fsevents": false,
75
- "unrs-resolver": true
76
70
  }
77
71
  }