vite-plus 1.1.0 → 1.3.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/LICENSE +58 -1
- package/binding/index.cjs +54 -54
- package/binding/index.d.cts +7 -0
- package/dist/{agent-eISuMXJb.js → agent-97KmGCyL.js} +4 -4
- package/dist/bin.js +12 -12
- package/dist/{command-CguLh2KL.js → command-CdMBoZFD.js} +13 -13
- package/dist/command-DVTILtS-.js +1 -0
- package/dist/comparison-CmVirWIW-DUGaiYqF.js +121 -0
- package/dist/config/bin.js +4 -4
- package/dist/{constants-CCQkpaxK.js → constants-DR55DpRm.js} +3 -3
- package/dist/create/bin.d.ts +2 -1
- package/dist/create/bin.js +112 -29
- package/dist/{define-config-CeW9DETl.d.ts → define-config-Bexdd6RZ.d.ts} +1 -1
- package/dist/{define-config-CREUiMmM.cjs → define-config-BxDc_9BK.cjs} +89 -3
- package/dist/{define-config-Ro6PS4dP.js → define-config-CvE5pHqB.js} +111 -6
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -2
- package/dist/{dist-DfmT__Aw.js → dist-Cqz8OtiO.js} +24 -21
- package/dist/{dist-BsAzy8OW.js → dist-DIpm7mot.js} +6 -7
- package/dist/dist-Dhu07wmN.js +3 -0
- package/dist/{editor-B8tkz7nL.js → editor-CtJGQP7C.js} +34 -27
- package/dist/fmt.js +1 -2
- package/dist/hooks/bin.js +1 -1
- package/dist/{hooks-C-4gykWR.js → hooks-DhwsWb46.js} +34 -22
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins-dev.js +1 -2
- package/dist/lint-plugins.cjs +1 -1
- package/dist/lint-plugins.js +1 -2
- package/dist/migration/bin.js +18 -16
- package/dist/{oxlint-plugin-config-CbG58Kzr.js → oxlint-plugin-config-BIzrO2y2.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +2 -2
- package/dist/{package-BS84eWrW.js → package-CQDXTm6j.js} +1 -1
- package/dist/{package-overrides-CpoQngt3.js → package-overrides-D1RcXSFl.js} +1 -1
- package/dist/{prompts-ByOzbMBG.js → prompts-1xNz_ne0.js} +103 -208
- package/dist/resolve-vite-config-7WDtXO4G.js +1 -0
- package/dist/{resolve-vite-config-Be237LWp.js → resolve-vite-config-BVr1SUNg.js} +2 -2
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-kJ_i4yPo.js} +1 -1
- package/dist/staged/bin.js +33 -5
- package/dist/sync-versions/bin.js +4760 -3369
- package/dist/sync-versions/bin.mjs +4899 -3505
- package/dist/test/browser/providers/playwright.d.ts +7 -2
- package/dist/test/browser-playwright.d.ts +7 -2
- package/dist/toolchain.js +12 -12
- package/dist/toolchain.json +12 -12
- package/dist/{tsconfig-DzZ-nrx2.js → tsconfig-BZu7kl-x.js} +3 -3
- package/dist/tsconfig-zWgHiQ3X.js +1 -0
- package/dist/version.js +2 -2
- package/dist/versions.js +7 -7
- package/docs/config/run.md +9 -5
- package/docs/config/staged.md +1 -1
- package/docs/guide/automatic-data-tracking.md +7 -6
- package/docs/guide/cache.md +3 -3
- package/docs/guide/check.md +7 -7
- package/docs/guide/commit-hooks.md +3 -1
- package/docs/guide/create.md +48 -4
- package/docs/guide/env.md +25 -11
- package/docs/guide/github-actions-cache.md +1 -1
- package/docs/guide/global-cli.md +36 -10
- package/docs/guide/ide-integration.md +1 -1
- package/docs/guide/index.md +8 -8
- package/docs/guide/local-cli.md +24 -8
- package/docs/guide/migrate-rules.md +3 -3
- package/docs/guide/migrate.md +9 -9
- package/docs/guide/{install.md → package-management.md} +42 -4
- package/docs/guide/run.md +10 -8
- package/docs/guide/test.md +3 -1
- package/docs/guide/troubleshooting.md +7 -5
- package/docs/guide/upgrade-project.md +1 -5
- package/docs/guide/upgrade.md +6 -0
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +3 -3
- package/package.json +32 -31
- package/templates/generator/bin/index.ts +0 -0
- package/templates/generator/package.json +2 -2
- package/templates/generator/src/template.ts +1 -0
- package/dist/command-CLJK5jGW.js +0 -2
- package/dist/dist-DUsqQuw8.js +0 -6774
- package/dist/resolve-vite-config-CofpYgnY.js +0 -2
- package/dist/tsconfig-3ONY2k2K.js +0 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-
|
|
1
|
+
import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-kJ_i4yPo.js";
|
|
2
2
|
import { constants } from "node:os";
|
|
3
3
|
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
4
4
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
5
|
module.exports = isexe;
|
|
6
6
|
isexe.sync = sync;
|
|
7
|
-
var fs
|
|
7
|
+
var fs = __require("fs");
|
|
8
8
|
function checkPathExt(path, options) {
|
|
9
9
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
10
10
|
if (!pathext) return true;
|
|
@@ -21,12 +21,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
21
21
|
return checkPathExt(path, options);
|
|
22
22
|
}
|
|
23
23
|
function isexe(path, options, cb) {
|
|
24
|
-
fs
|
|
24
|
+
fs.stat(path, function(er, stat) {
|
|
25
25
|
cb(er, er ? false : checkStat(stat, path, options));
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function sync(path, options) {
|
|
29
|
-
return checkStat(fs
|
|
29
|
+
return checkStat(fs.statSync(path), path, options);
|
|
30
30
|
}
|
|
31
31
|
}));
|
|
32
32
|
//#endregion
|
|
@@ -34,14 +34,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
34
34
|
var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
35
35
|
module.exports = isexe;
|
|
36
36
|
isexe.sync = sync;
|
|
37
|
-
var fs
|
|
37
|
+
var fs = __require("fs");
|
|
38
38
|
function isexe(path, options, cb) {
|
|
39
|
-
fs
|
|
39
|
+
fs.stat(path, function(er, stat) {
|
|
40
40
|
cb(er, er ? false : checkStat(stat, options));
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function sync(path, options) {
|
|
44
|
-
return checkStat(fs
|
|
44
|
+
return checkStat(fs.statSync(path), options);
|
|
45
45
|
}
|
|
46
46
|
function checkStat(stat, options) {
|
|
47
47
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -105,7 +105,7 @@ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
105
105
|
//#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
|
|
106
106
|
var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
107
107
|
const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
108
|
-
const path
|
|
108
|
+
const path = __require("path");
|
|
109
109
|
const COLON = isWindows ? ";" : ":";
|
|
110
110
|
const isexe = require_isexe();
|
|
111
111
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -136,7 +136,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
136
136
|
if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
137
137
|
const ppRaw = pathEnv[i];
|
|
138
138
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
139
|
-
const pCmd = path
|
|
139
|
+
const pCmd = path.join(pathPart, cmd);
|
|
140
140
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
141
141
|
resolve(subStep(p, i, 0));
|
|
142
142
|
});
|
|
@@ -160,7 +160,7 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160
160
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
161
161
|
const ppRaw = pathEnv[i];
|
|
162
162
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
163
|
-
const pCmd = path
|
|
163
|
+
const pCmd = path.join(pathPart, cmd);
|
|
164
164
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
165
165
|
for (let j = 0; j < pathExt.length; j++) {
|
|
166
166
|
const cur = p + pathExt[j];
|
|
@@ -193,7 +193,7 @@ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
195
195
|
var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
196
|
-
const path
|
|
196
|
+
const path = __require("path");
|
|
197
197
|
const which = require_which();
|
|
198
198
|
const getPathKey = require_path_key();
|
|
199
199
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -208,12 +208,12 @@ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
208
208
|
try {
|
|
209
209
|
resolved = which.sync(parsed.command, {
|
|
210
210
|
path: env[getPathKey({ env })],
|
|
211
|
-
pathExt: withoutPathExt ? path
|
|
211
|
+
pathExt: withoutPathExt ? path.delimiter : void 0
|
|
212
212
|
});
|
|
213
213
|
} catch (e) {} finally {
|
|
214
214
|
if (shouldSwitchCwd) process.chdir(cwd);
|
|
215
215
|
}
|
|
216
|
-
if (resolved) resolved = path
|
|
216
|
+
if (resolved) resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
217
217
|
return resolved;
|
|
218
218
|
}
|
|
219
219
|
function resolveCommand(parsed) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as runCommandSilently } from "./command-CdMBoZFD.js";
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/verkit@0.5.0/node_modules/verkit/dist/comparison-CmVirWIW.js
|
|
2
|
+
const LETTER_DASH_NUMBER = "[a-zA-Z0-9-]";
|
|
3
|
+
const NUMERIC_IDENTIFIER = String.raw`0|[1-9]\d*`;
|
|
4
|
+
const NUMERIC_IDENTIFIER_LOOSE = String.raw`\d+`;
|
|
5
|
+
const NON_NUMERIC_IDENTIFIER = String.raw`\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;
|
|
6
|
+
const MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})`;
|
|
7
|
+
const MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
8
|
+
const PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;
|
|
9
|
+
const PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
10
|
+
const PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\.${PRERELEASE_IDENTIFIER})*))`;
|
|
11
|
+
const PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;
|
|
12
|
+
const BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;
|
|
13
|
+
const BUILD = String.raw`(?:\+(${BUILD_IDENTIFIER}(?:\.${BUILD_IDENTIFIER})*))`;
|
|
14
|
+
const FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;
|
|
15
|
+
const LOOSE_PLAIN = String.raw`[v=\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;
|
|
16
|
+
const GREATER_LESS_THAN = "((?:<|>)?=?)";
|
|
17
|
+
const XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\*`;
|
|
18
|
+
const XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\*`;
|
|
19
|
+
const XRANGE_PLAIN = String.raw`[v=\s]*(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;
|
|
20
|
+
const XRANGE_PLAIN_LOOSE = String.raw`[v=\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;
|
|
21
|
+
const LONE_TILDE = "(?:~>?)";
|
|
22
|
+
const LONE_CARET = String.raw`(?:\^)`;
|
|
23
|
+
const COERCE_PLAIN = String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;
|
|
24
|
+
const COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\d])`;
|
|
25
|
+
const COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\d])`;
|
|
26
|
+
function makeSafeRegexSource(source) {
|
|
27
|
+
const replacements = [
|
|
28
|
+
[String.raw`\s`, 1],
|
|
29
|
+
[String.raw`\d`, 256],
|
|
30
|
+
[LETTER_DASH_NUMBER, 250]
|
|
31
|
+
];
|
|
32
|
+
for (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);
|
|
33
|
+
return source;
|
|
34
|
+
}
|
|
35
|
+
function safeRegex(source, flags) {
|
|
36
|
+
return new RegExp(makeSafeRegexSource(source), flags);
|
|
37
|
+
}
|
|
38
|
+
const FULL = safeRegex(`^${FULL_PLAIN}$`);
|
|
39
|
+
const LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);
|
|
40
|
+
const NUMERIC$1 = /^\d+$/;
|
|
41
|
+
function formatComparableVersion(version) {
|
|
42
|
+
const base = `${version.major}.${version.minor}.${version.patch}`;
|
|
43
|
+
return version.prerelease?.length ? `${base}-${version.prerelease.join(".")}` : base;
|
|
44
|
+
}
|
|
45
|
+
function parse(version, options = {}) {
|
|
46
|
+
if (typeof version !== "string") return version;
|
|
47
|
+
if (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);
|
|
48
|
+
const match = version.trim().match(options.loose ? LOOSE : FULL);
|
|
49
|
+
if (!match) throw new TypeError(`Invalid version syntax: ${version}`);
|
|
50
|
+
const major = Number(match[1]);
|
|
51
|
+
const minor = Number(match[2]);
|
|
52
|
+
const patch = Number(match[3]);
|
|
53
|
+
if (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);
|
|
54
|
+
if (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);
|
|
55
|
+
if (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);
|
|
56
|
+
const prerelease = match[4] ? match[4].split(".").map((identifier) => {
|
|
57
|
+
if (NUMERIC$1.test(identifier)) {
|
|
58
|
+
const numeric = Number(identifier);
|
|
59
|
+
if (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;
|
|
60
|
+
}
|
|
61
|
+
return identifier;
|
|
62
|
+
}) : void 0;
|
|
63
|
+
return {
|
|
64
|
+
build: match[5]?.split("."),
|
|
65
|
+
major,
|
|
66
|
+
minor,
|
|
67
|
+
patch,
|
|
68
|
+
prerelease
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function tryParse(version, options = {}) {
|
|
72
|
+
try {
|
|
73
|
+
return parse(version, options);
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const NUMERIC = /^\d+$/;
|
|
79
|
+
function compareIdentifiers(left, right) {
|
|
80
|
+
if (typeof left === "number" && typeof right === "number") return left === right ? 0 : left < right ? -1 : 1;
|
|
81
|
+
const leftNumeric = NUMERIC.test(String(left));
|
|
82
|
+
const rightNumeric = NUMERIC.test(String(right));
|
|
83
|
+
const normalizedLeft = leftNumeric ? Number(left) : left;
|
|
84
|
+
const normalizedRight = rightNumeric ? Number(right) : right;
|
|
85
|
+
return normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;
|
|
86
|
+
}
|
|
87
|
+
function compareMainParsed(left, right) {
|
|
88
|
+
return left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;
|
|
89
|
+
}
|
|
90
|
+
function comparePrereleaseParsed(left, right) {
|
|
91
|
+
const leftPrerelease = left.prerelease;
|
|
92
|
+
const rightPrerelease = right.prerelease;
|
|
93
|
+
if (leftPrerelease?.length && !rightPrerelease?.length) return -1;
|
|
94
|
+
if (!leftPrerelease?.length && rightPrerelease?.length) return 1;
|
|
95
|
+
if (!leftPrerelease?.length && !rightPrerelease?.length) return 0;
|
|
96
|
+
for (let index = 0;; index++) {
|
|
97
|
+
const leftIdentifier = leftPrerelease?.[index];
|
|
98
|
+
const rightIdentifier = rightPrerelease?.[index];
|
|
99
|
+
if (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;
|
|
100
|
+
if (rightIdentifier === void 0) return 1;
|
|
101
|
+
if (leftIdentifier === void 0) return -1;
|
|
102
|
+
if (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function compareParsed(left, right) {
|
|
106
|
+
return compareMainParsed(left, right) || comparePrereleaseParsed(left, right);
|
|
107
|
+
}
|
|
108
|
+
function compare(left, right, options = {}) {
|
|
109
|
+
return compareParsed(parse(left, options), parse(right, options));
|
|
110
|
+
}
|
|
111
|
+
function compareReversed(left, right, options = {}) {
|
|
112
|
+
return compare(right, left, options);
|
|
113
|
+
}
|
|
114
|
+
function isGreaterThanOrEqual(left, right, options = {}) {
|
|
115
|
+
return compare(left, right, options) >= 0;
|
|
116
|
+
}
|
|
117
|
+
function isLessThanOrEqual(left, right, options = {}) {
|
|
118
|
+
return compare(left, right, options) <= 0;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { isGreaterThanOrEqual as _, GREATER_LESS_THAN as a, safeRegex as b, LOOSE_PLAIN as c, XRANGE_PLAIN as d, XRANGE_PLAIN_LOOSE as f, formatComparableVersion as g, compareReversed as h, FULL_PLAIN as i, PRERELEASE as l, compareParsed as m, COERCE as n, LONE_CARET as o, compare as p, COERCE_FULL as r, LONE_TILDE as s, BUILD as t, PRERELEASE_LOOSE as u, isLessThanOrEqual as v, tryParse as x, parse as y };
|
package/dist/config/bin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
|
|
2
|
-
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-
|
|
2
|
+
import { i as promptGitHooks, n as defaultInteractive } from "../prompts-1xNz_ne0.js";
|
|
3
|
+
import { o as updateExistingAgentInstructions } from "../agent-97KmGCyL.js";
|
|
4
|
+
import { t as require_dist } from "../dist-DIpm7mot.js";
|
|
5
|
+
import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-DhwsWb46.js";
|
|
6
6
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
7
7
|
import path, { join, relative } from "node:path";
|
|
8
8
|
import { parseConfigArgs } from "../../binding/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "1.
|
|
3
|
+
var version = "1.3.0";
|
|
4
4
|
var exports = {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -289,8 +289,8 @@ const VITE_CONFIG_FILES = [
|
|
|
289
289
|
"vite.config.mts",
|
|
290
290
|
"vite.config.cts"
|
|
291
291
|
];
|
|
292
|
-
const VITEST_VERSION = "5.0.
|
|
293
|
-
const SETUP_VP_VERSION = "v1.21.
|
|
292
|
+
const VITEST_VERSION = "5.0.5";
|
|
293
|
+
const SETUP_VP_VERSION = "v1.21.2";
|
|
294
294
|
const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
|
|
295
295
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
296
296
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
package/dist/create/bin.d.ts
CHANGED
package/dist/create/bin.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-kJ_i4yPo.js";
|
|
2
2
|
import { t as documentationUrl$1 } from "../documentation-DqcZSthV.js";
|
|
3
3
|
import { t as renderCliDoc } from "../help-BmKpeOP9.js";
|
|
4
4
|
import { a as muted, i as log, o as printHeader, r as formatDuration, s as success, t as accent } from "../terminal-MKGAuy-p.js";
|
|
5
|
-
import { d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, u as VITE_PLUS_NAME } from "../constants-
|
|
5
|
+
import { d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, u as VITE_PLUS_NAME } from "../constants-DR55DpRm.js";
|
|
6
6
|
import { i as readJsonFile, n as editJsonFile } from "../json-JP24qHUF.js";
|
|
7
|
-
import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-
|
|
8
|
-
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-
|
|
9
|
-
import { A as text, E as multiselect, M as isCancel, O as select, S as normalize$1, T as log$1, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as require_picocolors, k as spinner, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as intro, y as PackageManager } from "../prompts-
|
|
10
|
-
import { t as
|
|
11
|
-
import { a as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-CQDXTm6j.js";
|
|
8
|
+
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-BVr1SUNg.js";
|
|
9
|
+
import { A as text, E as multiselect, M as isCancel, O as select, S as normalize$1, T as log$1, a as resolveGitInit, c as selectPackageManager, d as readYamlFile, h as resolveApproveBuildTargets, i as promptGitHooks, j as require_picocolors, k as spinner, m as detectGatedBuilds, n as defaultInteractive, o as runViteFmt, p as approveBuilds, r as downloadPackageManager$1, s as runViteInstall, t as cancelAndExit, u as editYamlFile, v as DependencyType, w as intro, y as PackageManager } from "../prompts-1xNz_ne0.js";
|
|
10
|
+
import { a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as templatesDir, l as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID } from "../agent-97KmGCyL.js";
|
|
11
|
+
import { A as createCatalogDependencyResolver, B as addFrameworkShim, F as updateWorkspaceConfig, H as hasFrameworkShim, K as promptTsupMigration, L as findGitRoot, M as detectWorkspace$1, N as isBingoTemplate, P as updatePackageJsonWithDeps, R as initGitRepository, V as detectFramework, W as detectTsupProject, Y as detectPrettierProject, Z as promptPrettierMigration, _ as installGitHooks, a as selectEditors, b as injectCreateDefaultTemplate, c as rewriteMonorepoProject, et as detectEslintProject, h as setPackageManager, j as supportsCatalog, l as rewriteStandaloneProject, n as detectExistingEditors, o as writeEditorConfigs, rt as promptEslintMigration, s as rewriteMonorepo, y as shouldSkipStagedMigrationForHooks } from "../editor-CtJGQP7C.js";
|
|
12
|
+
import { n as runCommandSilently, t as runCommand$1 } from "../command-CdMBoZFD.js";
|
|
13
|
+
import { t as require_dist } from "../dist-DIpm7mot.js";
|
|
14
14
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
15
15
|
import path from "node:path";
|
|
16
16
|
import { getVpDirs, parseCreateArgs, removeConfigKey, runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
17
|
-
import { styleText } from "node:util";
|
|
17
|
+
import { promisify, styleText } from "node:util";
|
|
18
18
|
import fs from "node:fs";
|
|
19
19
|
import os from "node:os";
|
|
20
20
|
import { createHash, randomUUID } from "node:crypto";
|
|
21
21
|
import fsPromises from "node:fs/promises";
|
|
22
|
+
import { gunzip } from "node:zlib";
|
|
22
23
|
import assert from "node:assert";
|
|
23
24
|
//#region src/create/command.ts
|
|
24
25
|
async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
@@ -204,13 +205,6 @@ function parseTar(data, opts) {
|
|
|
204
205
|
}
|
|
205
206
|
return files;
|
|
206
207
|
}
|
|
207
|
-
async function parseTarGzip(data, opts = {}) {
|
|
208
|
-
const stream = new ReadableStream({ start(controller) {
|
|
209
|
-
controller.enqueue(new Uint8Array(data));
|
|
210
|
-
controller.close();
|
|
211
|
-
} }).pipeThrough(new DecompressionStream(opts.compression ?? "gzip"));
|
|
212
|
-
return parseTar(await new Response(stream).arrayBuffer(), opts);
|
|
213
|
-
}
|
|
214
208
|
function _sanitizePath(path) {
|
|
215
209
|
let normalized = path.replace(/\\/g, "/");
|
|
216
210
|
normalized = normalized.replace(/^[a-zA-Z]:\//, "");
|
|
@@ -246,6 +240,78 @@ function _parseExtendedHeaders(data) {
|
|
|
246
240
|
return headers;
|
|
247
241
|
}
|
|
248
242
|
//#endregion
|
|
243
|
+
//#region src/create/org-tarball-reader.ts
|
|
244
|
+
const decompress = promisify(gunzip);
|
|
245
|
+
const TAR_BLOCK_BYTES = 512;
|
|
246
|
+
const ORG_TARBALL_LIMITS = {
|
|
247
|
+
expandedBytes: 104857600,
|
|
248
|
+
entryBytes: 20971520,
|
|
249
|
+
entries: 1e4,
|
|
250
|
+
pathBytes: 4096,
|
|
251
|
+
metadataBytes: 1048576,
|
|
252
|
+
globalMetadataFields: 128,
|
|
253
|
+
compressionRatio: 200,
|
|
254
|
+
ratioAllowanceBytes: 1048576
|
|
255
|
+
};
|
|
256
|
+
/** Check raw records, including metadata that nanotar processes before its filter. */
|
|
257
|
+
function validateTarRecords(tar, limits) {
|
|
258
|
+
let offset = 0;
|
|
259
|
+
let entries = 0;
|
|
260
|
+
let metadataBytes = 0;
|
|
261
|
+
let globalMetadataFields = 0;
|
|
262
|
+
while (offset < tar.byteLength) {
|
|
263
|
+
if (offset + TAR_BLOCK_BYTES > tar.byteLength) throw new Error("truncated tarball header");
|
|
264
|
+
if (tar[offset] === 0) return;
|
|
265
|
+
entries++;
|
|
266
|
+
if (entries > limits.entries) throw new Error(`tarball exceeds ${limits.entries} entry count limit`);
|
|
267
|
+
const rawSize = tar.toString("latin1", offset + 124, offset + 136).split("\0", 1)[0].trim();
|
|
268
|
+
const size = Number.parseInt(rawSize, 8);
|
|
269
|
+
if (!/^[0-7]+$/.test(rawSize) || !Number.isSafeInteger(size)) throw new Error("tarball entry has an invalid size");
|
|
270
|
+
if (size > limits.entryBytes) throw new Error(`tarball entry exceeds ${limits.entryBytes} byte size limit`);
|
|
271
|
+
const dataOffset = offset + TAR_BLOCK_BYTES;
|
|
272
|
+
const nextOffset = dataOffset + Math.ceil(size / TAR_BLOCK_BYTES) * TAR_BLOCK_BYTES;
|
|
273
|
+
if (nextOffset > tar.byteLength) throw new Error("truncated tarball entry");
|
|
274
|
+
const type = String.fromCharCode(tar[offset + 156]);
|
|
275
|
+
if ([
|
|
276
|
+
"x",
|
|
277
|
+
"g",
|
|
278
|
+
"L",
|
|
279
|
+
"K",
|
|
280
|
+
"N"
|
|
281
|
+
].includes(type)) {
|
|
282
|
+
metadataBytes += size;
|
|
283
|
+
if (metadataBytes > limits.metadataBytes) throw new Error(`tarball exceeds ${limits.metadataBytes} byte metadata size limit`);
|
|
284
|
+
}
|
|
285
|
+
if (type === "g") {
|
|
286
|
+
globalMetadataFields++;
|
|
287
|
+
for (const byte of tar.subarray(dataOffset, dataOffset + size)) if (byte === 10) globalMetadataFields++;
|
|
288
|
+
if (globalMetadataFields > limits.globalMetadataFields) throw new Error(`tarball exceeds ${limits.globalMetadataFields} global metadata field limit`);
|
|
289
|
+
}
|
|
290
|
+
offset = nextOffset;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/** Bound decompression and parser allocations before exposing entries to callers. */
|
|
294
|
+
async function parseOrgTarball(bytes, limits = ORG_TARBALL_LIMITS) {
|
|
295
|
+
const expandedLimit = Math.min(limits.expandedBytes, Math.max(limits.ratioAllowanceBytes, bytes.byteLength * limits.compressionRatio));
|
|
296
|
+
let tar;
|
|
297
|
+
try {
|
|
298
|
+
tar = await decompress(bytes, { maxOutputLength: expandedLimit });
|
|
299
|
+
} catch (error) {
|
|
300
|
+
if (error.code === "ERR_BUFFER_TOO_LARGE") throw new Error(`tarball exceeds ${expandedLimit} byte decompressed size limit`, { cause: error });
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
validateTarRecords(tar, limits);
|
|
304
|
+
return parseTar(new Uint8Array(tar), { filter(entry) {
|
|
305
|
+
const attrs = entry.attrs;
|
|
306
|
+
for (const name of [
|
|
307
|
+
entry.name,
|
|
308
|
+
attrs?.path,
|
|
309
|
+
attrs?.linkpath
|
|
310
|
+
]) if (typeof name === "string" && Buffer.byteLength(name) > limits.pathBytes) throw new Error(`tarball entry exceeds ${limits.pathBytes} byte path length limit`);
|
|
311
|
+
return true;
|
|
312
|
+
} });
|
|
313
|
+
}
|
|
314
|
+
//#endregion
|
|
249
315
|
//#region src/create/org-tarball.ts
|
|
250
316
|
function getCacheRoot() {
|
|
251
317
|
return path.join(getVpDirs().cache, "create-org");
|
|
@@ -335,7 +401,7 @@ async function downloadTarball(url) {
|
|
|
335
401
|
async function readPackageJsonFromTarball(tarballUrl, integrity) {
|
|
336
402
|
const bytes = await downloadTarball(tarballUrl);
|
|
337
403
|
verifyIntegrity(bytes, integrity);
|
|
338
|
-
const entries = await
|
|
404
|
+
const entries = await parseOrgTarball(bytes);
|
|
339
405
|
for (const entry of entries) {
|
|
340
406
|
if (normalizeEntryName(entry.name) !== "package.json" || !entry.data) continue;
|
|
341
407
|
const text = new TextDecoder().decode(entry.data);
|
|
@@ -373,7 +439,7 @@ function normalizeEntryName(rawName) {
|
|
|
373
439
|
return name.slice(8);
|
|
374
440
|
}
|
|
375
441
|
async function extractTarballTo(bytes, destDir) {
|
|
376
|
-
const entries = await
|
|
442
|
+
const entries = await parseOrgTarball(bytes);
|
|
377
443
|
const stagingDir = `${destDir}${STAGING_SUFFIX_PREFIX}${process.pid}-${Date.now()}`;
|
|
378
444
|
await fs.promises.mkdir(stagingDir, { recursive: true });
|
|
379
445
|
const resolvedStaging = path.resolve(stagingDir);
|
|
@@ -1096,7 +1162,7 @@ async function getConfiguredDefaultTemplate(startDir) {
|
|
|
1096
1162
|
}
|
|
1097
1163
|
}
|
|
1098
1164
|
//#endregion
|
|
1099
|
-
//#region ../../node_modules/.pnpm/validate-npm-package-name@
|
|
1165
|
+
//#region ../../node_modules/.pnpm/validate-npm-package-name@8.0.0/node_modules/validate-npm-package-name/lib/builtin-modules.json
|
|
1100
1166
|
var require_builtin_modules = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1101
1167
|
module.exports = [
|
|
1102
1168
|
"_http_agent",
|
|
@@ -4021,6 +4087,19 @@ function shouldConfigureEditorsForCreate({ editor, isMonorepo }) {
|
|
|
4021
4087
|
if (!isMonorepo) return true;
|
|
4022
4088
|
return hasExplicitEditorOptIn(editor);
|
|
4023
4089
|
}
|
|
4090
|
+
function detectLauncherPackageManager() {
|
|
4091
|
+
const name = process.env.npm_config_user_agent?.split("/")[0];
|
|
4092
|
+
return Object.values(PackageManager).find((packageManager) => packageManager === name);
|
|
4093
|
+
}
|
|
4094
|
+
function formatLocalVpCommand(packageManager, command) {
|
|
4095
|
+
switch (packageManager) {
|
|
4096
|
+
case PackageManager.pnpm: return `pnpm exec ${command}`;
|
|
4097
|
+
case PackageManager.yarn: return `yarn exec ${command}`;
|
|
4098
|
+
case PackageManager.bun: return `bunx ${command}`;
|
|
4099
|
+
case PackageManager.npm:
|
|
4100
|
+
default: return `npx ${command}`;
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4024
4103
|
function copy(src, dest) {
|
|
4025
4104
|
if (fs.statSync(src).isDirectory()) copyDir(src, dest);
|
|
4026
4105
|
else fs.copyFileSync(src, dest);
|
|
@@ -4407,13 +4486,12 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
|
|
|
4407
4486
|
const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4408
4487
|
copyDir(path.join(templatesDir, "generator"), fullPath);
|
|
4409
4488
|
fs.chmodSync(path.join(fullPath, "bin/index.ts"), "755");
|
|
4489
|
+
const catalogResolver = supportsCatalog(workspaceInfo.packageManager, workspaceInfo.downloadPackageManager.version, workspaceInfo.isMonorepo) ? createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager) : void 0;
|
|
4490
|
+
const { catalog } = readYamlFile(path.join(templatesDir, "monorepo/pnpm-workspace.yaml"));
|
|
4410
4491
|
editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
|
|
4411
4492
|
pkg.name = templateInfo.packageName;
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
const devDependencies = pkg.devDependencies;
|
|
4415
|
-
for (const [name, spec] of Object.entries(devDependencies)) if (spec === "catalog:" && catalog[name]) devDependencies[name] = catalog[name];
|
|
4416
|
-
}
|
|
4493
|
+
const devDependencies = pkg.devDependencies;
|
|
4494
|
+
for (const [name, spec] of Object.entries(devDependencies)) if (spec === "catalog:" && catalogResolver?.(spec, name) === void 0 && catalog[name]) devDependencies[name] = catalog[name];
|
|
4417
4495
|
if (description) pkg.description = description;
|
|
4418
4496
|
return pkg;
|
|
4419
4497
|
});
|
|
@@ -5073,15 +5151,17 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5073
5151
|
}
|
|
5074
5152
|
const requestedPackageManager = options.packageManager;
|
|
5075
5153
|
const detectedPackageManager = workspaceInfoOptional.packageManager;
|
|
5076
|
-
const
|
|
5154
|
+
const launcherPackageManager = detectLauncherPackageManager();
|
|
5155
|
+
const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? launcherPackageManager ?? await selectPackageManager(options.interactive, compactOutput);
|
|
5077
5156
|
const packageManagerVersion = packageManager === detectedPackageManager ? workspaceInfoOptional.packageManagerVersion : "latest";
|
|
5078
5157
|
const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
|
|
5079
|
-
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
|
|
5158
|
+
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog, workspaceInfoOptional.rootDir);
|
|
5080
5159
|
const workspaceInfo = {
|
|
5081
5160
|
...workspaceInfoOptional,
|
|
5082
5161
|
packageManager,
|
|
5083
5162
|
downloadPackageManager: downloadResult
|
|
5084
5163
|
};
|
|
5164
|
+
const vpRunCommand = launcherPackageManager ? formatLocalVpCommand(packageManager, "vp run") : "vp run";
|
|
5085
5165
|
const existingAgentTargetPaths = options.agent !== void 0 || !options.interactive ? void 0 : detectExistingAgentTargetPaths(workspaceInfoOptional.rootDir);
|
|
5086
5166
|
if (existingAgentTargetPaths !== void 0) selectedAgentTargetPaths = existingAgentTargetPaths;
|
|
5087
5167
|
else {
|
|
@@ -5247,7 +5327,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5247
5327
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5248
5328
|
gitInitialized,
|
|
5249
5329
|
installSummary,
|
|
5250
|
-
nextCommand: getNextCommand(projectDir,
|
|
5330
|
+
nextCommand: getNextCommand(projectDir, vpRunCommand),
|
|
5251
5331
|
packageManager: workspaceInfo.packageManager,
|
|
5252
5332
|
packageManagerVersion: workspaceInfo.downloadPackageManager.version,
|
|
5253
5333
|
projectDir
|
|
@@ -5278,11 +5358,14 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5278
5358
|
await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
|
|
5279
5359
|
resumeCreateProgress();
|
|
5280
5360
|
updateCreateProgress("Generating project");
|
|
5361
|
+
const isGenerator = templateInfo.command === BuiltinTemplate.generator;
|
|
5362
|
+
if (isGenerator) pauseCreateProgress();
|
|
5281
5363
|
result = await executeBuiltinTemplate(workspaceInfo, {
|
|
5282
5364
|
...templateInfo,
|
|
5283
5365
|
packageName,
|
|
5284
5366
|
targetDir
|
|
5285
5367
|
}, { silent: compactOutput });
|
|
5368
|
+
if (isGenerator) resumeCreateProgress();
|
|
5286
5369
|
} else {
|
|
5287
5370
|
updateCreateProgress("Generating project");
|
|
5288
5371
|
result = await executeRemoteTemplate(workspaceInfo, templateInfo, { silent: compactOutput });
|
|
@@ -5447,7 +5530,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5447
5530
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
5448
5531
|
gitInitialized,
|
|
5449
5532
|
installSummary,
|
|
5450
|
-
nextCommand: getNextCommand(projectDir,
|
|
5533
|
+
nextCommand: getNextCommand(projectDir, vpRunCommand),
|
|
5451
5534
|
packageManager: workspaceInfo.packageManager,
|
|
5452
5535
|
packageManagerVersion: workspaceInfo.downloadPackageManager.version,
|
|
5453
5536
|
projectDir
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as PackUserConfig } from "./pack-BK38MLVZ.js";
|
|
2
|
-
import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
|
|
3
2
|
import { PluginOption, UserConfig } from "vite";
|
|
3
|
+
import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
|
|
4
4
|
import { OxfmtConfig } from "oxfmt";
|
|
5
5
|
import { OxlintConfig } from "oxlint";
|
|
6
6
|
import { InlineConfig } from "vitest/node";
|
|
@@ -36,12 +36,51 @@ let node_fs = require("node:fs");
|
|
|
36
36
|
let node_module = require("node:module");
|
|
37
37
|
let node_path = require("node:path");
|
|
38
38
|
let node_url = require("node:url");
|
|
39
|
+
let vite = require("vite");
|
|
39
40
|
let vitest_config = require("vitest/config");
|
|
41
|
+
//#region ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
|
|
42
|
+
function load() {
|
|
43
|
+
if (addon !== void 0) return addon;
|
|
44
|
+
try {
|
|
45
|
+
const path = process.env["VP_RUN_NODE_CLIENT_PATH"];
|
|
46
|
+
if (path) {
|
|
47
|
+
addon = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)(path).load();
|
|
48
|
+
return addon;
|
|
49
|
+
}
|
|
50
|
+
} catch {}
|
|
51
|
+
addon = null;
|
|
52
|
+
return addon;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tell the runner to ignore reads under `path` when inferring cache inputs.
|
|
56
|
+
*
|
|
57
|
+
* No-op when not running inside a runner.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} path
|
|
60
|
+
* @returns {void}
|
|
61
|
+
*/
|
|
62
|
+
function ignoreInput(path) {
|
|
63
|
+
load()?.ignoreInput(path);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Tell the runner to ignore writes under `path` when inferring cache outputs.
|
|
67
|
+
*
|
|
68
|
+
* No-op when not running inside a runner.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} path
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
73
|
+
function ignoreOutput(path) {
|
|
74
|
+
load()?.ignoreOutput(path);
|
|
75
|
+
}
|
|
76
|
+
var addon;
|
|
77
|
+
var init_src = __esmMin((() => {}));
|
|
78
|
+
//#endregion
|
|
40
79
|
//#region package.json
|
|
41
|
-
var version = "1.
|
|
80
|
+
var version = "1.3.0", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
|
|
42
81
|
var init_constants = __esmMin((() => {
|
|
43
82
|
VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
44
|
-
VITEST_VERSION = "5.0.
|
|
83
|
+
VITEST_VERSION = "5.0.5";
|
|
45
84
|
process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
|
|
46
85
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
47
86
|
process.versions.node, process.release.name;
|
|
@@ -422,6 +461,50 @@ function vitePlusCoverageVersionGuardPlugin() {
|
|
|
422
461
|
}
|
|
423
462
|
};
|
|
424
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Vitest 5.0.4 enables its on-disk caches by default: the results cache
|
|
466
|
+
* (`<cacheDir>/results.json`, written atomically through `.tmp-*` siblings)
|
|
467
|
+
* and the fs module cache (`<workspaceRoot>/node_modules/.vitest-cache`, or
|
|
468
|
+
* `fsModuleCachePath` when overridden). Under `vp run`, file-system tracking
|
|
469
|
+
* would record those cache reads/writes as task inputs the run itself
|
|
470
|
+
* modifies, so every `vp test` task would stay permanently uncacheable
|
|
471
|
+
* ("not cached because it modified its input"). Tell the runner these
|
|
472
|
+
* tool-managed paths are neither inputs nor outputs, mirroring what Vite
|
|
473
|
+
* does for `.vite-temp` and the optimizer cache dir.
|
|
474
|
+
*
|
|
475
|
+
* Runtime project injection appends to `vitest.projects` without calling
|
|
476
|
+
* `configureVitest` again. Observe those attachments as well as the initial
|
|
477
|
+
* list. Both ignore calls are no-ops outside `vp run`.
|
|
478
|
+
*/
|
|
479
|
+
function vitePlusVitestCachePathsPlugin() {
|
|
480
|
+
const observedProjectLists = /* @__PURE__ */ new WeakSet();
|
|
481
|
+
return {
|
|
482
|
+
name: "vite-plus:vitest-cache-paths",
|
|
483
|
+
configureVitest(context) {
|
|
484
|
+
const { vitest } = context;
|
|
485
|
+
const { projects } = vitest;
|
|
486
|
+
if (observedProjectLists.has(projects)) return;
|
|
487
|
+
observedProjectLists.add(projects);
|
|
488
|
+
const ignoredPaths = /* @__PURE__ */ new Set();
|
|
489
|
+
const ignoreCachePath = (path) => {
|
|
490
|
+
if (!path || ignoredPaths.has(path)) return;
|
|
491
|
+
ignoredPaths.add(path);
|
|
492
|
+
ignoreInput(path);
|
|
493
|
+
ignoreOutput(path);
|
|
494
|
+
};
|
|
495
|
+
ignoreCachePath(vitest.viteConfig.cacheDir);
|
|
496
|
+
const rootCache = vitest.config.fsModuleCachePath || (0, node_path.join)((0, vite.searchForWorkspaceRoot)(vitest.viteConfig.root), "node_modules", ".vitest-cache");
|
|
497
|
+
ignoreCachePath(rootCache);
|
|
498
|
+
for (const project of projects) ignoreCachePath(project.config.fsModuleCachePath || rootCache);
|
|
499
|
+
const push = projects.push;
|
|
500
|
+
projects.push = function(...addedProjects) {
|
|
501
|
+
const length = push.apply(this, addedProjects);
|
|
502
|
+
for (const project of addedProjects) ignoreCachePath(project.config.fsModuleCachePath || rootCache);
|
|
503
|
+
return length;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
}
|
|
425
508
|
function withoutVitePlusTestPlugins(plugin) {
|
|
426
509
|
if (Array.isArray(plugin)) return plugin.filter(keepUserPlugin).map(withoutVitePlusTestPlugins);
|
|
427
510
|
if (plugin instanceof Promise) return plugin.then(withoutVitePlusTestPlugins);
|
|
@@ -437,6 +520,7 @@ function injectPluginIntoInlineConfig(config) {
|
|
|
437
520
|
vitePlusVitestResolverPlugin(),
|
|
438
521
|
vitePlusAutoInlineMatcherPlugin(),
|
|
439
522
|
vitePlusCoverageVersionGuardPlugin(),
|
|
523
|
+
vitePlusVitestCachePathsPlugin(),
|
|
440
524
|
...(config.plugins ?? []).filter(keepUserPlugin).map(withoutVitePlusTestPlugins)
|
|
441
525
|
]
|
|
442
526
|
};
|
|
@@ -563,6 +647,7 @@ function lazyPlugins(cb) {
|
|
|
563
647
|
}
|
|
564
648
|
var vitePlusRequire, vitePlusModuleFile, vitestAnchor, vitestExports, AUTO_INLINE_DEPS, KNOWN_COVERAGE_PROVIDERS, bundledVitestAnchorCache, coverageGuardedVitestInstances, VITE_PLUS_TEST_PLUGIN_NAMES, configMetadataDepth, configMetadataSavedValue;
|
|
565
649
|
var init_define_config = __esmMin((() => {
|
|
650
|
+
init_src();
|
|
566
651
|
init_constants();
|
|
567
652
|
init_vitest_ecosystem();
|
|
568
653
|
vitePlusRequire = (0, node_module.createRequire)(typeof __dirname !== "undefined" ? __dirname : require("url").pathToFileURL(__filename).href);
|
|
@@ -577,7 +662,8 @@ var init_define_config = __esmMin((() => {
|
|
|
577
662
|
VITE_PLUS_TEST_PLUGIN_NAMES = /* @__PURE__ */ new Set([
|
|
578
663
|
"vite-plus:vitest-resolver",
|
|
579
664
|
"vite-plus:auto-inline-matcher-deps",
|
|
580
|
-
"vite-plus:coverage-version-guard"
|
|
665
|
+
"vite-plus:coverage-version-guard",
|
|
666
|
+
"vite-plus:vitest-cache-paths"
|
|
581
667
|
]);
|
|
582
668
|
configMetadataDepth = 0;
|
|
583
669
|
}));
|