@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.
- package/dist/vite.config.cjs +70 -56
- package/dist/vite.config.mjs +70 -56
- package/dist/write-config.mjs +23 -5
- package/package.json +1 -1
package/dist/vite.config.cjs
CHANGED
|
@@ -1182,8 +1182,8 @@ var require_utils = __commonJS({
|
|
|
1182
1182
|
}
|
|
1183
1183
|
return output;
|
|
1184
1184
|
};
|
|
1185
|
-
exports2.basename = (
|
|
1186
|
-
const segs =
|
|
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(
|
|
4833
|
-
if (
|
|
4834
|
-
return
|
|
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
|
|
5213
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
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,
|
|
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:
|
|
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(
|
|
5250
|
-
if (
|
|
5251
|
-
const index =
|
|
5252
|
-
return
|
|
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
|
|
5285
|
-
for (let i = 1; i < pointer; i++)
|
|
5286
|
-
if (!
|
|
5287
|
-
url.path =
|
|
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
|
|
5321
|
-
if (!
|
|
5322
|
-
if (isRelative(base || input) && !isRelative(
|
|
5323
|
-
return
|
|
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(
|
|
5332
|
-
if (!
|
|
5333
|
-
const index =
|
|
5334
|
-
return
|
|
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(
|
|
10646
|
-
if (
|
|
10646
|
+
var normalize = function(path4) {
|
|
10647
|
+
if (path4.length === 0) {
|
|
10647
10648
|
return ".";
|
|
10648
10649
|
}
|
|
10649
|
-
|
|
10650
|
-
const isUNCPath =
|
|
10651
|
-
const isPathAbsolute = isAbsolute(
|
|
10652
|
-
const trailingSeparator =
|
|
10653
|
-
|
|
10654
|
-
if (
|
|
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
|
-
|
|
10662
|
+
path4 += "/";
|
|
10662
10663
|
}
|
|
10663
|
-
if (_DRIVE_LETTER_RE.test(
|
|
10664
|
-
|
|
10664
|
+
if (_DRIVE_LETTER_RE.test(path4)) {
|
|
10665
|
+
path4 += "/";
|
|
10665
10666
|
}
|
|
10666
10667
|
if (isUNCPath) {
|
|
10667
10668
|
if (!isPathAbsolute) {
|
|
10668
|
-
return `//./${
|
|
10669
|
+
return `//./${path4}`;
|
|
10669
10670
|
}
|
|
10670
|
-
return `//${
|
|
10671
|
+
return `//${path4}`;
|
|
10671
10672
|
}
|
|
10672
|
-
return isPathAbsolute && !isAbsolute(
|
|
10673
|
+
return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
|
|
10673
10674
|
};
|
|
10674
10675
|
var join = function(...segments) {
|
|
10675
|
-
let
|
|
10676
|
+
let path4 = "";
|
|
10676
10677
|
for (const seg of segments) {
|
|
10677
10678
|
if (!seg) {
|
|
10678
10679
|
continue;
|
|
10679
10680
|
}
|
|
10680
|
-
if (
|
|
10681
|
-
const pathTrailing =
|
|
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
|
-
|
|
10686
|
+
path4 += seg.slice(1);
|
|
10686
10687
|
} else {
|
|
10687
|
-
|
|
10688
|
+
path4 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
10688
10689
|
}
|
|
10689
10690
|
} else {
|
|
10690
|
-
|
|
10691
|
+
path4 += seg;
|
|
10691
10692
|
}
|
|
10692
10693
|
}
|
|
10693
|
-
return normalize(
|
|
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
|
|
10707
|
-
if (!
|
|
10707
|
+
const path4 = index >= 0 ? arguments_[index] : cwd();
|
|
10708
|
+
if (!path4 || path4.length === 0) {
|
|
10708
10709
|
continue;
|
|
10709
10710
|
}
|
|
10710
|
-
resolvedPath = `${
|
|
10711
|
-
resolvedAbsolute = isAbsolute(
|
|
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(
|
|
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 <=
|
|
10726
|
-
if (index <
|
|
10727
|
-
char =
|
|
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 += `/${
|
|
10764
|
+
res += `/${path4.slice(lastSlash + 1, index)}`;
|
|
10764
10765
|
} else {
|
|
10765
|
-
res =
|
|
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
|
},
|
package/dist/vite.config.mjs
CHANGED
|
@@ -1180,8 +1180,8 @@ var require_utils = __commonJS({
|
|
|
1180
1180
|
}
|
|
1181
1181
|
return output;
|
|
1182
1182
|
};
|
|
1183
|
-
exports.basename = (
|
|
1184
|
-
const segs =
|
|
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(
|
|
4825
|
-
if (
|
|
4826
|
-
return
|
|
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
|
|
5205
|
-
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(
|
|
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,
|
|
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:
|
|
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(
|
|
5242
|
-
if (
|
|
5243
|
-
const index =
|
|
5244
|
-
return
|
|
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
|
|
5277
|
-
for (let i = 1; i < pointer; i++)
|
|
5278
|
-
if (!
|
|
5279
|
-
url.path =
|
|
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
|
|
5313
|
-
if (!
|
|
5314
|
-
if (isRelative(base || input) && !isRelative(
|
|
5315
|
-
return
|
|
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(
|
|
5324
|
-
if (!
|
|
5325
|
-
const index =
|
|
5326
|
-
return
|
|
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(
|
|
10638
|
-
if (
|
|
10638
|
+
var normalize = function(path4) {
|
|
10639
|
+
if (path4.length === 0) {
|
|
10639
10640
|
return ".";
|
|
10640
10641
|
}
|
|
10641
|
-
|
|
10642
|
-
const isUNCPath =
|
|
10643
|
-
const isPathAbsolute = isAbsolute(
|
|
10644
|
-
const trailingSeparator =
|
|
10645
|
-
|
|
10646
|
-
if (
|
|
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
|
-
|
|
10654
|
+
path4 += "/";
|
|
10654
10655
|
}
|
|
10655
|
-
if (_DRIVE_LETTER_RE.test(
|
|
10656
|
-
|
|
10656
|
+
if (_DRIVE_LETTER_RE.test(path4)) {
|
|
10657
|
+
path4 += "/";
|
|
10657
10658
|
}
|
|
10658
10659
|
if (isUNCPath) {
|
|
10659
10660
|
if (!isPathAbsolute) {
|
|
10660
|
-
return `//./${
|
|
10661
|
+
return `//./${path4}`;
|
|
10661
10662
|
}
|
|
10662
|
-
return `//${
|
|
10663
|
+
return `//${path4}`;
|
|
10663
10664
|
}
|
|
10664
|
-
return isPathAbsolute && !isAbsolute(
|
|
10665
|
+
return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
|
|
10665
10666
|
};
|
|
10666
10667
|
var join = function(...segments) {
|
|
10667
|
-
let
|
|
10668
|
+
let path4 = "";
|
|
10668
10669
|
for (const seg of segments) {
|
|
10669
10670
|
if (!seg) {
|
|
10670
10671
|
continue;
|
|
10671
10672
|
}
|
|
10672
|
-
if (
|
|
10673
|
-
const pathTrailing =
|
|
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
|
-
|
|
10678
|
+
path4 += seg.slice(1);
|
|
10678
10679
|
} else {
|
|
10679
|
-
|
|
10680
|
+
path4 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
10680
10681
|
}
|
|
10681
10682
|
} else {
|
|
10682
|
-
|
|
10683
|
+
path4 += seg;
|
|
10683
10684
|
}
|
|
10684
10685
|
}
|
|
10685
|
-
return normalize(
|
|
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
|
|
10699
|
-
if (!
|
|
10699
|
+
const path4 = index >= 0 ? arguments_[index] : cwd();
|
|
10700
|
+
if (!path4 || path4.length === 0) {
|
|
10700
10701
|
continue;
|
|
10701
10702
|
}
|
|
10702
|
-
resolvedPath = `${
|
|
10703
|
-
resolvedAbsolute = isAbsolute(
|
|
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(
|
|
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 <=
|
|
10718
|
-
if (index <
|
|
10719
|
-
char =
|
|
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 += `/${
|
|
10756
|
+
res += `/${path4.slice(lastSlash + 1, index)}`;
|
|
10756
10757
|
} else {
|
|
10757
|
-
res =
|
|
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
|
},
|
package/dist/write-config.mjs
CHANGED
|
@@ -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
|
};
|