@forsakringskassan/vite-lib-config 5.1.8 → 5.2.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/bin/build-vue-lib.mjs +4 -3
- package/dist/api-extractor.mjs +10 -12
- package/dist/vite.config.cjs +32 -13
- package/dist/vite.config.mjs +32 -13
- package/dist/write-config.mjs +12 -11
- package/package.json +2 -8
package/bin/build-vue-lib.mjs
CHANGED
|
@@ -4,8 +4,9 @@ import { cli } from "../dist/cli.mjs";
|
|
|
4
4
|
|
|
5
5
|
const argv = process.argv.slice(2);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
cli(argv)
|
|
7
|
+
try {
|
|
8
|
+
await cli(argv);
|
|
9
|
+
} catch (err) {
|
|
9
10
|
console.error(err);
|
|
10
11
|
process.exitCode = 1;
|
|
11
|
-
}
|
|
12
|
+
}
|
package/dist/api-extractor.mjs
CHANGED
|
@@ -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/
|
|
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-
|
|
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
|
|
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
|
|
5921
|
-
|
|
5922
|
-
|
|
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"}`;
|
package/dist/vite.config.cjs
CHANGED
|
@@ -1701,7 +1701,11 @@ var require_parse = __commonJS({
|
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
1703
|
};
|
|
1704
|
-
var
|
|
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
|
-
|
|
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
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
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) => {
|
|
@@ -10904,8 +10921,11 @@ function customMappingPlugin() {
|
|
|
10904
10921
|
const replacement = folder[format2];
|
|
10905
10922
|
return {
|
|
10906
10923
|
...options,
|
|
10907
|
-
dir: dir?.replace("[custom-format]", replacement),
|
|
10908
|
-
entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
|
|
10924
|
+
dir: dir?.replace("[custom-format]", () => replacement),
|
|
10925
|
+
entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
|
|
10926
|
+
"[custom-format]",
|
|
10927
|
+
() => replacement
|
|
10928
|
+
) : entryFileNames
|
|
10909
10929
|
};
|
|
10910
10930
|
}
|
|
10911
10931
|
};
|
|
@@ -11166,12 +11186,11 @@ ${indent}`);
|
|
|
11166
11186
|
// src/utils/pretty-list.ts
|
|
11167
11187
|
function prettyList(deps, predicate) {
|
|
11168
11188
|
const filtered = predicate ? deps.filter(predicate) : deps;
|
|
11169
|
-
filtered.sort();
|
|
11189
|
+
filtered.sort((a, b) => a.localeCompare(b));
|
|
11170
11190
|
if (filtered.length > 0) {
|
|
11171
11191
|
return ["", ...filtered.map((it2) => ` - ${it2}`)].join("\n");
|
|
11172
|
-
} else {
|
|
11173
|
-
return "(none)";
|
|
11174
11192
|
}
|
|
11193
|
+
return "(none)";
|
|
11175
11194
|
}
|
|
11176
11195
|
|
|
11177
11196
|
// src/vite.config.ts
|
package/dist/vite.config.mjs
CHANGED
|
@@ -1699,7 +1699,11 @@ var require_parse = __commonJS({
|
|
|
1699
1699
|
}
|
|
1700
1700
|
}
|
|
1701
1701
|
};
|
|
1702
|
-
var
|
|
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
|
-
|
|
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
|
|
1751
|
-
if (
|
|
1752
|
-
|
|
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) => {
|
|
@@ -10896,8 +10913,11 @@ function customMappingPlugin() {
|
|
|
10896
10913
|
const replacement = folder[format2];
|
|
10897
10914
|
return {
|
|
10898
10915
|
...options,
|
|
10899
|
-
dir: dir?.replace("[custom-format]", replacement),
|
|
10900
|
-
entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
|
|
10916
|
+
dir: dir?.replace("[custom-format]", () => replacement),
|
|
10917
|
+
entryFileNames: typeof entryFileNames === "string" ? entryFileNames.replace(
|
|
10918
|
+
"[custom-format]",
|
|
10919
|
+
() => replacement
|
|
10920
|
+
) : entryFileNames
|
|
10901
10921
|
};
|
|
10902
10922
|
}
|
|
10903
10923
|
};
|
|
@@ -11158,12 +11178,11 @@ ${indent}`);
|
|
|
11158
11178
|
// src/utils/pretty-list.ts
|
|
11159
11179
|
function prettyList(deps, predicate) {
|
|
11160
11180
|
const filtered = predicate ? deps.filter(predicate) : deps;
|
|
11161
|
-
filtered.sort();
|
|
11181
|
+
filtered.sort((a, b) => a.localeCompare(b));
|
|
11162
11182
|
if (filtered.length > 0) {
|
|
11163
11183
|
return ["", ...filtered.map((it2) => ` - ${it2}`)].join("\n");
|
|
11164
|
-
} else {
|
|
11165
|
-
return "(none)";
|
|
11166
11184
|
}
|
|
11185
|
+
return "(none)";
|
|
11167
11186
|
}
|
|
11168
11187
|
|
|
11169
11188
|
// src/vite.config.ts
|
package/dist/write-config.mjs
CHANGED
|
@@ -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/
|
|
16
|
+
// node_modules/yocto-queue/index.js
|
|
17
17
|
var Node, Queue;
|
|
18
18
|
var init_yocto_queue = __esm({
|
|
19
|
-
"node_modules/
|
|
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-
|
|
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-
|
|
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
|
-
}
|
|
495
|
-
|
|
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
|
|
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)
|
|
662
|
-
|
|
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.
|
|
3
|
+
"version": "5.2.0",
|
|
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
|
}
|