@forsakringskassan/vite-lib-config 5.7.1 → 5.9.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.
@@ -1182,8 +1182,8 @@ var require_utils = __commonJS({
1182
1182
  }
1183
1183
  return output;
1184
1184
  };
1185
- exports2.basename = (path3, { windows } = {}) => {
1186
- const segs = path3.split(windows ? /[\\/]/ : "/");
1185
+ exports2.basename = (path4, { windows } = {}) => {
1186
+ const segs = path4.split(windows ? /[\\/]/ : "/");
1187
1187
  const last = segs[segs.length - 1];
1188
1188
  if (last === "") {
1189
1189
  return segs[segs.length - 2];
@@ -4697,6 +4697,7 @@ __export(vite_config_exports, {
4697
4697
  vuePlugin: () => vuePlugin2
4698
4698
  });
4699
4699
  module.exports = __toCommonJS(vite_config_exports);
4700
+ var import_node_path4 = __toESM(require("node:path"));
4700
4701
  var import_vite2 = require("vite");
4701
4702
  var import_apimock_express = require("@forsakringskassan/apimock-express");
4702
4703
  var import_ufuzzy = __toESM(require_uFuzzy());
@@ -4829,9 +4830,9 @@ function setSrcDescriptor(filename, entry, scoped) {
4829
4830
  function getHash(text) {
4830
4831
  return import_node_crypto.default.hash("sha256", text, "hex").substring(0, 8);
4831
4832
  }
4832
- function slash(path3) {
4833
- if (path3.startsWith("\\\\?\\")) return path3;
4834
- return path3.replace(/\\/g, "/");
4833
+ function slash(path4) {
4834
+ if (path4.startsWith("\\\\?\\")) return path4;
4835
+ return path4.replace(/\\/g, "/");
4835
4836
  }
4836
4837
  function createRollupError(id2, error) {
4837
4838
  const { message, name, stack } = error;
@@ -5209,16 +5210,16 @@ function parseAbsoluteUrl(input) {
5209
5210
  }
5210
5211
  function parseFileUrl(input) {
5211
5212
  const match = fileRegex.exec(input);
5212
- const path3 = match[2];
5213
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path3) ? path3 : "/" + path3, match[3] || "", match[4] || "");
5213
+ const path4 = match[2];
5214
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
5214
5215
  }
5215
- function makeUrl(scheme, user, host, port, path3, query2, hash) {
5216
+ function makeUrl(scheme, user, host, port, path4, query2, hash) {
5216
5217
  return {
5217
5218
  scheme,
5218
5219
  user,
5219
5220
  host,
5220
5221
  port,
5221
- path: path3,
5222
+ path: path4,
5222
5223
  query: query2,
5223
5224
  hash,
5224
5225
  type: 7
@@ -5246,10 +5247,10 @@ function parseUrl(input) {
5246
5247
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
5247
5248
  return url;
5248
5249
  }
5249
- function stripPathFilename(path3) {
5250
- if (path3.endsWith("/..")) return path3;
5251
- const index = path3.lastIndexOf("/");
5252
- return path3.slice(0, index + 1);
5250
+ function stripPathFilename(path4) {
5251
+ if (path4.endsWith("/..")) return path4;
5252
+ const index = path4.lastIndexOf("/");
5253
+ return path4.slice(0, index + 1);
5253
5254
  }
5254
5255
  function mergePaths(url, base) {
5255
5256
  normalizePath$1(base, base.type);
@@ -5281,10 +5282,10 @@ function normalizePath$1(url, type) {
5281
5282
  pieces[pointer++] = piece;
5282
5283
  positive++;
5283
5284
  }
5284
- let path3 = "";
5285
- for (let i = 1; i < pointer; i++) path3 += "/" + pieces[i];
5286
- if (!path3 || addTrailingSlash && !path3.endsWith("/..")) path3 += "/";
5287
- url.path = path3;
5285
+ let path4 = "";
5286
+ for (let i = 1; i < pointer; i++) path4 += "/" + pieces[i];
5287
+ if (!path4 || addTrailingSlash && !path4.endsWith("/..")) path4 += "/";
5288
+ url.path = path4;
5288
5289
  }
5289
5290
  function resolve(input, base) {
5290
5291
  if (!input && !base) return "";
@@ -5317,10 +5318,10 @@ function resolve(input, base) {
5317
5318
  case 3:
5318
5319
  return queryHash;
5319
5320
  case 4: {
5320
- const path3 = url.path.slice(1);
5321
- if (!path3) return queryHash || ".";
5322
- if (isRelative(base || input) && !isRelative(path3)) return "./" + path3 + queryHash;
5323
- return path3 + queryHash;
5321
+ const path4 = url.path.slice(1);
5322
+ if (!path4) return queryHash || ".";
5323
+ if (isRelative(base || input) && !isRelative(path4)) return "./" + path4 + queryHash;
5324
+ return path4 + queryHash;
5324
5325
  }
5325
5326
  case 5:
5326
5327
  return url.path + queryHash;
@@ -5328,10 +5329,10 @@ function resolve(input, base) {
5328
5329
  return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
5329
5330
  }
5330
5331
  }
5331
- function stripFilename(path3) {
5332
- if (!path3) return "";
5333
- const index = path3.lastIndexOf("/");
5334
- return path3.slice(0, index + 1);
5332
+ function stripFilename(path4) {
5333
+ if (!path4) return "";
5334
+ const index = path4.lastIndexOf("/");
5335
+ return path4.slice(0, index + 1);
5335
5336
  }
5336
5337
  function resolver(mapUrl, sourceRoot) {
5337
5338
  const from = stripFilename(mapUrl);
@@ -10642,55 +10643,55 @@ function normalizeWindowsPath(input = "") {
10642
10643
  var _UNC_REGEX = /^[/\\]{2}/;
10643
10644
  var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
10644
10645
  var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
10645
- var normalize = function(path3) {
10646
- if (path3.length === 0) {
10646
+ var normalize = function(path4) {
10647
+ if (path4.length === 0) {
10647
10648
  return ".";
10648
10649
  }
10649
- path3 = normalizeWindowsPath(path3);
10650
- const isUNCPath = path3.match(_UNC_REGEX);
10651
- const isPathAbsolute = isAbsolute(path3);
10652
- const trailingSeparator = path3[path3.length - 1] === "/";
10653
- path3 = normalizeString(path3, !isPathAbsolute);
10654
- if (path3.length === 0) {
10650
+ path4 = normalizeWindowsPath(path4);
10651
+ const isUNCPath = path4.match(_UNC_REGEX);
10652
+ const isPathAbsolute = isAbsolute(path4);
10653
+ const trailingSeparator = path4[path4.length - 1] === "/";
10654
+ path4 = normalizeString(path4, !isPathAbsolute);
10655
+ if (path4.length === 0) {
10655
10656
  if (isPathAbsolute) {
10656
10657
  return "/";
10657
10658
  }
10658
10659
  return trailingSeparator ? "./" : ".";
10659
10660
  }
10660
10661
  if (trailingSeparator) {
10661
- path3 += "/";
10662
+ path4 += "/";
10662
10663
  }
10663
- if (_DRIVE_LETTER_RE.test(path3)) {
10664
- path3 += "/";
10664
+ if (_DRIVE_LETTER_RE.test(path4)) {
10665
+ path4 += "/";
10665
10666
  }
10666
10667
  if (isUNCPath) {
10667
10668
  if (!isPathAbsolute) {
10668
- return `//./${path3}`;
10669
+ return `//./${path4}`;
10669
10670
  }
10670
- return `//${path3}`;
10671
+ return `//${path4}`;
10671
10672
  }
10672
- return isPathAbsolute && !isAbsolute(path3) ? `/${path3}` : path3;
10673
+ return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
10673
10674
  };
10674
10675
  var join = function(...segments) {
10675
- let path3 = "";
10676
+ let path4 = "";
10676
10677
  for (const seg of segments) {
10677
10678
  if (!seg) {
10678
10679
  continue;
10679
10680
  }
10680
- if (path3.length > 0) {
10681
- const pathTrailing = path3[path3.length - 1] === "/";
10681
+ if (path4.length > 0) {
10682
+ const pathTrailing = path4[path4.length - 1] === "/";
10682
10683
  const segLeading = seg[0] === "/";
10683
10684
  const both = pathTrailing && segLeading;
10684
10685
  if (both) {
10685
- path3 += seg.slice(1);
10686
+ path4 += seg.slice(1);
10686
10687
  } else {
10687
- path3 += pathTrailing || segLeading ? seg : `/${seg}`;
10688
+ path4 += pathTrailing || segLeading ? seg : `/${seg}`;
10688
10689
  }
10689
10690
  } else {
10690
- path3 += seg;
10691
+ path4 += seg;
10691
10692
  }
10692
10693
  }
10693
- return normalize(path3);
10694
+ return normalize(path4);
10694
10695
  };
10695
10696
  function cwd() {
10696
10697
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
@@ -10703,12 +10704,12 @@ var resolve2 = function(...arguments_) {
10703
10704
  let resolvedPath = "";
10704
10705
  let resolvedAbsolute = false;
10705
10706
  for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
10706
- const path3 = index >= 0 ? arguments_[index] : cwd();
10707
- if (!path3 || path3.length === 0) {
10707
+ const path4 = index >= 0 ? arguments_[index] : cwd();
10708
+ if (!path4 || path4.length === 0) {
10708
10709
  continue;
10709
10710
  }
10710
- resolvedPath = `${path3}/${resolvedPath}`;
10711
- resolvedAbsolute = isAbsolute(path3);
10711
+ resolvedPath = `${path4}/${resolvedPath}`;
10712
+ resolvedAbsolute = isAbsolute(path4);
10712
10713
  }
10713
10714
  resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
10714
10715
  if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
@@ -10716,15 +10717,15 @@ var resolve2 = function(...arguments_) {
10716
10717
  }
10717
10718
  return resolvedPath.length > 0 ? resolvedPath : ".";
10718
10719
  };
10719
- function normalizeString(path3, allowAboveRoot) {
10720
+ function normalizeString(path4, allowAboveRoot) {
10720
10721
  let res = "";
10721
10722
  let lastSegmentLength = 0;
10722
10723
  let lastSlash = -1;
10723
10724
  let dots = 0;
10724
10725
  let char = null;
10725
- for (let index = 0; index <= path3.length; ++index) {
10726
- if (index < path3.length) {
10727
- char = path3[index];
10726
+ for (let index = 0; index <= path4.length; ++index) {
10727
+ if (index < path4.length) {
10728
+ char = path4[index];
10728
10729
  } else if (char === "/") {
10729
10730
  break;
10730
10731
  } else {
@@ -10760,9 +10761,9 @@ function normalizeString(path3, allowAboveRoot) {
10760
10761
  }
10761
10762
  } else {
10762
10763
  if (res.length > 0) {
10763
- res += `/${path3.slice(lastSlash + 1, index)}`;
10764
+ res += `/${path4.slice(lastSlash + 1, index)}`;
10764
10765
  } else {
10765
- res = path3.slice(lastSlash + 1, index);
10766
+ res = path4.slice(lastSlash + 1, index);
10766
10767
  }
10767
10768
  lastSegmentLength = index - lastSlash - 1;
10768
10769
  }
@@ -11336,6 +11337,19 @@ var defaultConfig = {
11336
11337
  external: Array.from(external)
11337
11338
  }
11338
11339
  },
11340
+ resolve: {
11341
+ alias: {
11342
+ /* enable vue runtime template compiler needed by both jest/vitest
11343
+ * and by cypress component.
11344
+ *
11345
+ * tests. https://github.com/vuejs/core/tree/main/packages/vue#which-dist-file-to-use */
11346
+ vue: "vue/dist/vue.esm-bundler.js",
11347
+ /* resolve the package itself to the source-code instead of the
11348
+ * output `dist` folder, so examples can use the actual package name
11349
+ * instead of relative paths */
11350
+ [packageJson.name]: import_node_path4.default.resolve("src/index.ts")
11351
+ }
11352
+ },
11339
11353
  server: {
11340
11354
  port: 8080
11341
11355
  },
@@ -1180,8 +1180,8 @@ var require_utils = __commonJS({
1180
1180
  }
1181
1181
  return output;
1182
1182
  };
1183
- exports.basename = (path3, { windows } = {}) => {
1184
- const segs = path3.split(windows ? /[\\/]/ : "/");
1183
+ exports.basename = (path4, { windows } = {}) => {
1184
+ const segs = path4.split(windows ? /[\\/]/ : "/");
1185
1185
  const last = segs[segs.length - 1];
1186
1186
  if (last === "") {
1187
1187
  return segs[segs.length - 2];
@@ -4688,6 +4688,7 @@ var require_semver2 = __commonJS({
4688
4688
 
4689
4689
  // src/vite.config.ts
4690
4690
  var import_ufuzzy = __toESM(require_uFuzzy());
4691
+ import path3 from "node:path";
4691
4692
  import {
4692
4693
  defineConfig as viteDefineConfig
4693
4694
  } from "vite";
@@ -4821,9 +4822,9 @@ function setSrcDescriptor(filename, entry, scoped) {
4821
4822
  function getHash(text) {
4822
4823
  return crypto.hash("sha256", text, "hex").substring(0, 8);
4823
4824
  }
4824
- function slash(path3) {
4825
- if (path3.startsWith("\\\\?\\")) return path3;
4826
- return path3.replace(/\\/g, "/");
4825
+ function slash(path4) {
4826
+ if (path4.startsWith("\\\\?\\")) return path4;
4827
+ return path4.replace(/\\/g, "/");
4827
4828
  }
4828
4829
  function createRollupError(id2, error) {
4829
4830
  const { message, name, stack } = error;
@@ -5201,16 +5202,16 @@ function parseAbsoluteUrl(input) {
5201
5202
  }
5202
5203
  function parseFileUrl(input) {
5203
5204
  const match = fileRegex.exec(input);
5204
- const path3 = match[2];
5205
- return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path3) ? path3 : "/" + path3, match[3] || "", match[4] || "");
5205
+ const path4 = match[2];
5206
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
5206
5207
  }
5207
- function makeUrl(scheme, user, host, port, path3, query2, hash) {
5208
+ function makeUrl(scheme, user, host, port, path4, query2, hash) {
5208
5209
  return {
5209
5210
  scheme,
5210
5211
  user,
5211
5212
  host,
5212
5213
  port,
5213
- path: path3,
5214
+ path: path4,
5214
5215
  query: query2,
5215
5216
  hash,
5216
5217
  type: 7
@@ -5238,10 +5239,10 @@ function parseUrl(input) {
5238
5239
  url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
5239
5240
  return url;
5240
5241
  }
5241
- function stripPathFilename(path3) {
5242
- if (path3.endsWith("/..")) return path3;
5243
- const index = path3.lastIndexOf("/");
5244
- return path3.slice(0, index + 1);
5242
+ function stripPathFilename(path4) {
5243
+ if (path4.endsWith("/..")) return path4;
5244
+ const index = path4.lastIndexOf("/");
5245
+ return path4.slice(0, index + 1);
5245
5246
  }
5246
5247
  function mergePaths(url, base) {
5247
5248
  normalizePath$1(base, base.type);
@@ -5273,10 +5274,10 @@ function normalizePath$1(url, type) {
5273
5274
  pieces[pointer++] = piece;
5274
5275
  positive++;
5275
5276
  }
5276
- let path3 = "";
5277
- for (let i = 1; i < pointer; i++) path3 += "/" + pieces[i];
5278
- if (!path3 || addTrailingSlash && !path3.endsWith("/..")) path3 += "/";
5279
- url.path = path3;
5277
+ let path4 = "";
5278
+ for (let i = 1; i < pointer; i++) path4 += "/" + pieces[i];
5279
+ if (!path4 || addTrailingSlash && !path4.endsWith("/..")) path4 += "/";
5280
+ url.path = path4;
5280
5281
  }
5281
5282
  function resolve(input, base) {
5282
5283
  if (!input && !base) return "";
@@ -5309,10 +5310,10 @@ function resolve(input, base) {
5309
5310
  case 3:
5310
5311
  return queryHash;
5311
5312
  case 4: {
5312
- const path3 = url.path.slice(1);
5313
- if (!path3) return queryHash || ".";
5314
- if (isRelative(base || input) && !isRelative(path3)) return "./" + path3 + queryHash;
5315
- return path3 + queryHash;
5313
+ const path4 = url.path.slice(1);
5314
+ if (!path4) return queryHash || ".";
5315
+ if (isRelative(base || input) && !isRelative(path4)) return "./" + path4 + queryHash;
5316
+ return path4 + queryHash;
5316
5317
  }
5317
5318
  case 5:
5318
5319
  return url.path + queryHash;
@@ -5320,10 +5321,10 @@ function resolve(input, base) {
5320
5321
  return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
5321
5322
  }
5322
5323
  }
5323
- function stripFilename(path3) {
5324
- if (!path3) return "";
5325
- const index = path3.lastIndexOf("/");
5326
- return path3.slice(0, index + 1);
5324
+ function stripFilename(path4) {
5325
+ if (!path4) return "";
5326
+ const index = path4.lastIndexOf("/");
5327
+ return path4.slice(0, index + 1);
5327
5328
  }
5328
5329
  function resolver(mapUrl, sourceRoot) {
5329
5330
  const from = stripFilename(mapUrl);
@@ -10634,55 +10635,55 @@ function normalizeWindowsPath(input = "") {
10634
10635
  var _UNC_REGEX = /^[/\\]{2}/;
10635
10636
  var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
10636
10637
  var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
10637
- var normalize = function(path3) {
10638
- if (path3.length === 0) {
10638
+ var normalize = function(path4) {
10639
+ if (path4.length === 0) {
10639
10640
  return ".";
10640
10641
  }
10641
- path3 = normalizeWindowsPath(path3);
10642
- const isUNCPath = path3.match(_UNC_REGEX);
10643
- const isPathAbsolute = isAbsolute(path3);
10644
- const trailingSeparator = path3[path3.length - 1] === "/";
10645
- path3 = normalizeString(path3, !isPathAbsolute);
10646
- if (path3.length === 0) {
10642
+ path4 = normalizeWindowsPath(path4);
10643
+ const isUNCPath = path4.match(_UNC_REGEX);
10644
+ const isPathAbsolute = isAbsolute(path4);
10645
+ const trailingSeparator = path4[path4.length - 1] === "/";
10646
+ path4 = normalizeString(path4, !isPathAbsolute);
10647
+ if (path4.length === 0) {
10647
10648
  if (isPathAbsolute) {
10648
10649
  return "/";
10649
10650
  }
10650
10651
  return trailingSeparator ? "./" : ".";
10651
10652
  }
10652
10653
  if (trailingSeparator) {
10653
- path3 += "/";
10654
+ path4 += "/";
10654
10655
  }
10655
- if (_DRIVE_LETTER_RE.test(path3)) {
10656
- path3 += "/";
10656
+ if (_DRIVE_LETTER_RE.test(path4)) {
10657
+ path4 += "/";
10657
10658
  }
10658
10659
  if (isUNCPath) {
10659
10660
  if (!isPathAbsolute) {
10660
- return `//./${path3}`;
10661
+ return `//./${path4}`;
10661
10662
  }
10662
- return `//${path3}`;
10663
+ return `//${path4}`;
10663
10664
  }
10664
- return isPathAbsolute && !isAbsolute(path3) ? `/${path3}` : path3;
10665
+ return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
10665
10666
  };
10666
10667
  var join = function(...segments) {
10667
- let path3 = "";
10668
+ let path4 = "";
10668
10669
  for (const seg of segments) {
10669
10670
  if (!seg) {
10670
10671
  continue;
10671
10672
  }
10672
- if (path3.length > 0) {
10673
- const pathTrailing = path3[path3.length - 1] === "/";
10673
+ if (path4.length > 0) {
10674
+ const pathTrailing = path4[path4.length - 1] === "/";
10674
10675
  const segLeading = seg[0] === "/";
10675
10676
  const both = pathTrailing && segLeading;
10676
10677
  if (both) {
10677
- path3 += seg.slice(1);
10678
+ path4 += seg.slice(1);
10678
10679
  } else {
10679
- path3 += pathTrailing || segLeading ? seg : `/${seg}`;
10680
+ path4 += pathTrailing || segLeading ? seg : `/${seg}`;
10680
10681
  }
10681
10682
  } else {
10682
- path3 += seg;
10683
+ path4 += seg;
10683
10684
  }
10684
10685
  }
10685
- return normalize(path3);
10686
+ return normalize(path4);
10686
10687
  };
10687
10688
  function cwd() {
10688
10689
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
@@ -10695,12 +10696,12 @@ var resolve2 = function(...arguments_) {
10695
10696
  let resolvedPath = "";
10696
10697
  let resolvedAbsolute = false;
10697
10698
  for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
10698
- const path3 = index >= 0 ? arguments_[index] : cwd();
10699
- if (!path3 || path3.length === 0) {
10699
+ const path4 = index >= 0 ? arguments_[index] : cwd();
10700
+ if (!path4 || path4.length === 0) {
10700
10701
  continue;
10701
10702
  }
10702
- resolvedPath = `${path3}/${resolvedPath}`;
10703
- resolvedAbsolute = isAbsolute(path3);
10703
+ resolvedPath = `${path4}/${resolvedPath}`;
10704
+ resolvedAbsolute = isAbsolute(path4);
10704
10705
  }
10705
10706
  resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
10706
10707
  if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
@@ -10708,15 +10709,15 @@ var resolve2 = function(...arguments_) {
10708
10709
  }
10709
10710
  return resolvedPath.length > 0 ? resolvedPath : ".";
10710
10711
  };
10711
- function normalizeString(path3, allowAboveRoot) {
10712
+ function normalizeString(path4, allowAboveRoot) {
10712
10713
  let res = "";
10713
10714
  let lastSegmentLength = 0;
10714
10715
  let lastSlash = -1;
10715
10716
  let dots = 0;
10716
10717
  let char = null;
10717
- for (let index = 0; index <= path3.length; ++index) {
10718
- if (index < path3.length) {
10719
- char = path3[index];
10718
+ for (let index = 0; index <= path4.length; ++index) {
10719
+ if (index < path4.length) {
10720
+ char = path4[index];
10720
10721
  } else if (char === "/") {
10721
10722
  break;
10722
10723
  } else {
@@ -10752,9 +10753,9 @@ function normalizeString(path3, allowAboveRoot) {
10752
10753
  }
10753
10754
  } else {
10754
10755
  if (res.length > 0) {
10755
- res += `/${path3.slice(lastSlash + 1, index)}`;
10756
+ res += `/${path4.slice(lastSlash + 1, index)}`;
10756
10757
  } else {
10757
- res = path3.slice(lastSlash + 1, index);
10758
+ res = path4.slice(lastSlash + 1, index);
10758
10759
  }
10759
10760
  lastSegmentLength = index - lastSlash - 1;
10760
10761
  }
@@ -11330,6 +11331,19 @@ var defaultConfig = {
11330
11331
  external: Array.from(external)
11331
11332
  }
11332
11333
  },
11334
+ resolve: {
11335
+ alias: {
11336
+ /* enable vue runtime template compiler needed by both jest/vitest
11337
+ * and by cypress component.
11338
+ *
11339
+ * tests. https://github.com/vuejs/core/tree/main/packages/vue#which-dist-file-to-use */
11340
+ vue: "vue/dist/vue.esm-bundler.js",
11341
+ /* resolve the package itself to the source-code instead of the
11342
+ * output `dist` folder, so examples can use the actual package name
11343
+ * instead of relative paths */
11344
+ [packageJson.name]: path3.resolve("src/index.ts")
11345
+ }
11346
+ },
11333
11347
  server: {
11334
11348
  port: 8080
11335
11349
  },
@@ -721,8 +721,8 @@ async function generateTsconfigLib(options) {
721
721
  compilerOptions: {
722
722
  types: testRunner === "jest" ? ["node", "jest", "vite/client"] : void 0,
723
723
  paths: {
724
- [`${name}/cypress`]: ["./src/cypress/index.ts"],
725
- [`${name}/selectors`]: ["./src/selectors/index.ts"],
724
+ [`${name}/cypress`]: options.enablePageobjects ? ["./src/cypress/index.ts"] : void 0,
725
+ [`${name}/selectors`]: options.enableSelectors ? ["./src/selectors/index.ts"] : void 0,
726
726
  [name]: ["./src/index.ts"]
727
727
  }
728
728
  }
@@ -738,8 +738,8 @@ async function generateTsconfigCypress(options) {
738
738
  ],
739
739
  compilerOptions: {
740
740
  paths: {
741
- [`${name}/cypress`]: ["./src/cypress/index.ts"],
742
- [`${name}/selectors`]: ["./src/selectors/index.ts"],
741
+ [`${name}/cypress`]: options.enablePageobjects ? ["./src/cypress/index.ts"] : void 0,
742
+ [`${name}/selectors`]: options.enableSelectors ? ["./src/selectors/index.ts"] : void 0,
743
743
  [name]: ["./src/index.ts"]
744
744
  }
745
745
  }
@@ -764,6 +764,20 @@ async function generateTsconfigPageobjects(options) {
764
764
  };
765
765
  return [boilerplate, await serializeJson(config)].join("\n\n");
766
766
  }
767
+ function generateViteConfig() {
768
+ const config = [
769
+ `import { defineConfig } from "@forsakringskassan/vite-lib-config/vite";`,
770
+ `import { defineTestConfig } from "@forsakringskassan/vitest-config-jsdom";`,
771
+ ``,
772
+ `export default defineConfig({`,
773
+ ` test: defineTestConfig({`,
774
+ ` setupFiles: ["./vitest.setup.ts"],`,
775
+ ` }),`,
776
+ `});`
777
+ ].map((it) => `${it}
778
+ `).join("");
779
+ return [boilerplate, config].join("\n\n");
780
+ }
767
781
  async function readJsonFile(cwd, filename) {
768
782
  const filePath = path3.join(cwd, filename);
769
783
  const content = await fs3.readFile(filePath, "utf8");
@@ -872,6 +886,7 @@ async function run(cwd, argv) {
872
886
  enableSelectors: Boolean(pkg.exports?.["./selectors"])
873
887
  };
874
888
  const generated = /* @__PURE__ */ new Map([
889
+ ["api-extractor.json", null],
875
890
  ["api-extractor.lib.json", generateApiExtractorLib(options)],
876
891
  ["api-extractor.cypress.json", generateApiExtractorCypress(options)],
877
892
  [
@@ -882,7 +897,9 @@ async function run(cwd, argv) {
882
897
  ["tsconfig.lib.json", generateTsconfigLib(options)],
883
898
  ["tsconfig.cypress.json", generateTsconfigCypress(options)],
884
899
  ["tsconfig.selectors.json", generateTsconfigSelectors(options)],
885
- ["tsconfig.pageobjects.json", generateTsconfigPageobjects(options)]
900
+ ["tsconfig.pageobjects.json", generateTsconfigPageobjects(options)],
901
+ ["vite.config.ts", null],
902
+ ["vite.config.mts", generateViteConfig()]
886
903
  ]);
887
904
  console.group("Writing configuration files");
888
905
  console.log("API Extractor:", flagEnabled(options.enableApiExtractor));
@@ -924,6 +941,7 @@ export {
924
941
  generateTsconfigLib,
925
942
  generateTsconfigPageobjects,
926
943
  generateTsconfigSelectors,
944
+ generateViteConfig,
927
945
  run,
928
946
  updateBuildScripts
929
947
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vite-lib-config",
3
- "version": "5.7.1",
3
+ "version": "5.9.0",
4
4
  "description": "Försäkringskassan toolchain to build libraries with Vite",
5
5
  "keywords": [
6
6
  "vite"