vite-plus 1.1.0 → 1.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/LICENSE +29 -1
- package/binding/index.cjs +54 -54
- package/binding/index.d.cts +3 -0
- package/dist/{agent-eISuMXJb.js → agent-KeDc6vmg.js} +2 -2
- package/dist/bin.js +10 -10
- package/dist/command-DaRqSNpP.js +1 -0
- package/dist/comparison-CmVirWIW-DUGaiYqF.js +121 -0
- package/dist/config/bin.js +4 -4
- package/dist/{constants-CCQkpaxK.js → constants-BW3g7VnD.js} +3 -3
- package/dist/create/bin.d.ts +2 -1
- package/dist/create/bin.js +91 -23
- package/dist/{define-config-CeW9DETl.d.ts → define-config-Bexdd6RZ.d.ts} +1 -1
- package/dist/{define-config-Ro6PS4dP.js → define-config-CIlk9scU.js} +111 -6
- package/dist/{define-config-CREUiMmM.cjs → define-config-Dq_23Eyr.cjs} +89 -3
- 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-BsAzy8OW.js → dist-Bi7ZEK3c.js} +1 -2
- package/dist/dist-CBWGibx8.js +3 -0
- package/dist/{dist-DfmT__Aw.js → dist-Cqz8OtiO.js} +24 -21
- package/dist/{editor-B8tkz7nL.js → editor-b1XUwt9v.js} +30 -23
- 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 +17 -15
- package/dist/{oxlint-plugin-config-CbG58Kzr.js → oxlint-plugin-config-Dx-ZY2MN.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +2 -2
- package/dist/{package-BS84eWrW.js → package-BP16iQby.js} +1 -1
- package/dist/{package-overrides-CpoQngt3.js → package-overrides-D1RcXSFl.js} +1 -1
- package/dist/{prompts-ByOzbMBG.js → prompts-BGpQtC5z.js} +15 -14
- package/dist/resolve-vite-config-CGzlyhGr.js +1 -0
- package/dist/{resolve-vite-config-Be237LWp.js → resolve-vite-config-x47JetlI.js} +2 -2
- package/dist/staged/bin.js +2 -2
- package/dist/sync-versions/bin.js +4759 -3369
- package/dist/sync-versions/bin.mjs +4893 -3500
- 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-C5PnJfW4.js +1 -0
- package/dist/{tsconfig-DzZ-nrx2.js → tsconfig-D2DzAQ_D.js} +2 -2
- 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 +14 -4
- package/docs/guide/env.md +9 -2
- 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 +20 -4
- package/docs/guide/migrate-rules.md +3 -3
- package/docs/guide/migrate.md +9 -9
- package/docs/guide/{install.md → package-management.md} +25 -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 +30 -29
- 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
|
@@ -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-BGpQtC5z.js";
|
|
3
|
+
import { o as updateExistingAgentInstructions } from "../agent-KeDc6vmg.js";
|
|
4
|
+
import { t as require_dist } from "../dist-Bi7ZEK3c.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.2.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.4";
|
|
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
|
@@ -2,23 +2,24 @@ import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.j
|
|
|
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-BW3g7VnD.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 { 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-B8tkz7nL.js";
|
|
7
|
+
import { c as getNpmRegistry, r as getScopeFromPackageName, s as fetchNpmResource, t as checkNpmPackageExists } from "../package-BP16iQby.js";
|
|
8
|
+
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-x47JetlI.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-BGpQtC5z.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-KeDc6vmg.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-b1XUwt9v.js";
|
|
13
12
|
import { n as runCommandSilently, t as runCommand$1 } from "../command-CguLh2KL.js";
|
|
13
|
+
import { t as require_dist } from "../dist-Bi7ZEK3c.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);
|
|
@@ -4407,13 +4473,12 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
|
|
|
4407
4473
|
const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4408
4474
|
copyDir(path.join(templatesDir, "generator"), fullPath);
|
|
4409
4475
|
fs.chmodSync(path.join(fullPath, "bin/index.ts"), "755");
|
|
4476
|
+
const catalogResolver = supportsCatalog(workspaceInfo.packageManager, workspaceInfo.downloadPackageManager.version, workspaceInfo.isMonorepo) ? createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager) : void 0;
|
|
4477
|
+
const { catalog } = readYamlFile(path.join(templatesDir, "monorepo/pnpm-workspace.yaml"));
|
|
4410
4478
|
editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
|
|
4411
4479
|
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
|
-
}
|
|
4480
|
+
const devDependencies = pkg.devDependencies;
|
|
4481
|
+
for (const [name, spec] of Object.entries(devDependencies)) if (spec === "catalog:" && catalogResolver?.(spec, name) === void 0 && catalog[name]) devDependencies[name] = catalog[name];
|
|
4417
4482
|
if (description) pkg.description = description;
|
|
4418
4483
|
return pkg;
|
|
4419
4484
|
});
|
|
@@ -5076,7 +5141,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5076
5141
|
const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? await selectPackageManager(options.interactive, compactOutput);
|
|
5077
5142
|
const packageManagerVersion = packageManager === detectedPackageManager ? workspaceInfoOptional.packageManagerVersion : "latest";
|
|
5078
5143
|
const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
|
|
5079
|
-
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
|
|
5144
|
+
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog, workspaceInfoOptional.rootDir);
|
|
5080
5145
|
const workspaceInfo = {
|
|
5081
5146
|
...workspaceInfoOptional,
|
|
5082
5147
|
packageManager,
|
|
@@ -5278,11 +5343,14 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5278
5343
|
await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
|
|
5279
5344
|
resumeCreateProgress();
|
|
5280
5345
|
updateCreateProgress("Generating project");
|
|
5346
|
+
const isGenerator = templateInfo.command === BuiltinTemplate.generator;
|
|
5347
|
+
if (isGenerator) pauseCreateProgress();
|
|
5281
5348
|
result = await executeBuiltinTemplate(workspaceInfo, {
|
|
5282
5349
|
...templateInfo,
|
|
5283
5350
|
packageName,
|
|
5284
5351
|
targetDir
|
|
5285
5352
|
}, { silent: compactOutput });
|
|
5353
|
+
if (isGenerator) resumeCreateProgress();
|
|
5286
5354
|
} else {
|
|
5287
5355
|
updateCreateProgress("Generating project");
|
|
5288
5356
|
result = await executeRemoteTemplate(workspaceInfo, templateInfo, { silent: compactOutput });
|
|
@@ -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";
|
|
@@ -1,15 +1,73 @@
|
|
|
1
|
-
import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-
|
|
1
|
+
import { c as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-BW3g7VnD.js";
|
|
2
2
|
import { t as VITEST_RESOLVER_PACKAGES } from "./vitest-ecosystem-BU0AqZq-.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import path, { resolve } from "node:path";
|
|
4
|
+
import path, { join, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
|
+
import { searchForWorkspaceRoot } from "vite";
|
|
7
8
|
import { defineConfig, defineProject } from "vitest/config";
|
|
8
|
-
//#region ../../node_modules/.pnpm/tsdown@0.23.
|
|
9
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.1_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.1_@tsdown+exe@0.23.1_@type_1c5668b23b89ab367f1fd43e24d0d72d/node_modules/tsdown/esm-shims.js
|
|
9
10
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
10
11
|
const getDirname = () => path.dirname(getFilename());
|
|
11
12
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
12
13
|
//#endregion
|
|
14
|
+
//#region ../../node_modules/.pnpm/@voidzero-dev+vite-task-client@0.2.0/node_modules/@voidzero-dev/vite-task-client/src/index.js
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {{ tracked?: boolean }} GetEnvOptions
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {string | { prefix: string }} GetEnvsQuery
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Methods exposed by the napi addon. Keep this shape in sync with the
|
|
23
|
+
* `RunnerClient` returned by `load()` in
|
|
24
|
+
* `crates/vite_task_client_napi/src/lib.rs` — any new method added there
|
|
25
|
+
* needs a matching entry here, and vice versa.
|
|
26
|
+
*
|
|
27
|
+
* @type {{
|
|
28
|
+
* ignoreInput: (path: string) => void,
|
|
29
|
+
* ignoreOutput: (path: string) => void,
|
|
30
|
+
* disableCache: () => void,
|
|
31
|
+
* getEnv: (name: string, options?: GetEnvOptions) => string | undefined,
|
|
32
|
+
* getEnvs: (query: GetEnvsQuery, options?: GetEnvOptions) => Record<string, string>,
|
|
33
|
+
* } | null | undefined}
|
|
34
|
+
*/
|
|
35
|
+
let addon;
|
|
36
|
+
function load() {
|
|
37
|
+
if (addon !== void 0) return addon;
|
|
38
|
+
try {
|
|
39
|
+
const path = process.env["VP_RUN_NODE_CLIENT_PATH"];
|
|
40
|
+
if (path) {
|
|
41
|
+
addon = createRequire(import.meta.url)(path).load();
|
|
42
|
+
return addon;
|
|
43
|
+
}
|
|
44
|
+
} catch {}
|
|
45
|
+
addon = null;
|
|
46
|
+
return addon;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Tell the runner to ignore reads under `path` when inferring cache inputs.
|
|
50
|
+
*
|
|
51
|
+
* No-op when not running inside a runner.
|
|
52
|
+
*
|
|
53
|
+
* @param {string} path
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
function ignoreInput(path) {
|
|
57
|
+
load()?.ignoreInput(path);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Tell the runner to ignore writes under `path` when inferring cache outputs.
|
|
61
|
+
*
|
|
62
|
+
* No-op when not running inside a runner.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} path
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
function ignoreOutput(path) {
|
|
68
|
+
load()?.ignoreOutput(path);
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
13
71
|
//#region src/define-config.ts
|
|
14
72
|
/**
|
|
15
73
|
* `require` anchored at THIS module's location so `require.resolve` reaches
|
|
@@ -434,8 +492,53 @@ function vitePlusCoverageVersionGuardPlugin() {
|
|
|
434
492
|
};
|
|
435
493
|
}
|
|
436
494
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
495
|
+
* Vitest 5.0.4 enables its on-disk caches by default: the results cache
|
|
496
|
+
* (`<cacheDir>/results.json`, written atomically through `.tmp-*` siblings)
|
|
497
|
+
* and the fs module cache (`<workspaceRoot>/node_modules/.vitest-cache`, or
|
|
498
|
+
* `fsModuleCachePath` when overridden). Under `vp run`, file-system tracking
|
|
499
|
+
* would record those cache reads/writes as task inputs the run itself
|
|
500
|
+
* modifies, so every `vp test` task would stay permanently uncacheable
|
|
501
|
+
* ("not cached because it modified its input"). Tell the runner these
|
|
502
|
+
* tool-managed paths are neither inputs nor outputs, mirroring what Vite
|
|
503
|
+
* does for `.vite-temp` and the optimizer cache dir.
|
|
504
|
+
*
|
|
505
|
+
* Runtime project injection appends to `vitest.projects` without calling
|
|
506
|
+
* `configureVitest` again. Observe those attachments as well as the initial
|
|
507
|
+
* list. Both ignore calls are no-ops outside `vp run`.
|
|
508
|
+
*/
|
|
509
|
+
function vitePlusVitestCachePathsPlugin() {
|
|
510
|
+
const observedProjectLists = /* @__PURE__ */ new WeakSet();
|
|
511
|
+
return {
|
|
512
|
+
name: "vite-plus:vitest-cache-paths",
|
|
513
|
+
configureVitest(context) {
|
|
514
|
+
const { vitest } = context;
|
|
515
|
+
const { projects } = vitest;
|
|
516
|
+
if (observedProjectLists.has(projects)) return;
|
|
517
|
+
observedProjectLists.add(projects);
|
|
518
|
+
const ignoredPaths = /* @__PURE__ */ new Set();
|
|
519
|
+
const ignoreCachePath = (path) => {
|
|
520
|
+
if (!path || ignoredPaths.has(path)) return;
|
|
521
|
+
ignoredPaths.add(path);
|
|
522
|
+
ignoreInput(path);
|
|
523
|
+
ignoreOutput(path);
|
|
524
|
+
};
|
|
525
|
+
ignoreCachePath(vitest.viteConfig.cacheDir);
|
|
526
|
+
const rootCache = vitest.config.fsModuleCachePath || join(searchForWorkspaceRoot(vitest.viteConfig.root), "node_modules", ".vitest-cache");
|
|
527
|
+
ignoreCachePath(rootCache);
|
|
528
|
+
for (const project of projects) ignoreCachePath(project.config.fsModuleCachePath || rootCache);
|
|
529
|
+
const push = projects.push;
|
|
530
|
+
projects.push = function(...addedProjects) {
|
|
531
|
+
const length = push.apply(this, addedProjects);
|
|
532
|
+
for (const project of addedProjects) ignoreCachePath(project.config.fsModuleCachePath || rootCache);
|
|
533
|
+
return length;
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Inject the vitest resolver plugin, the auto-inline matcher plugin, the
|
|
540
|
+
* coverage version guard, and the cache-paths plugin into a single inline
|
|
541
|
+
* project config. Used both for
|
|
439
542
|
* root configs and for object-shaped entries inside `test.projects`.
|
|
440
543
|
*
|
|
441
544
|
* The shapes overlap (both have an optional top-level `plugins` array and
|
|
@@ -445,7 +548,8 @@ function vitePlusCoverageVersionGuardPlugin() {
|
|
|
445
548
|
const VITE_PLUS_TEST_PLUGIN_NAMES = /* @__PURE__ */ new Set([
|
|
446
549
|
"vite-plus:vitest-resolver",
|
|
447
550
|
"vite-plus:auto-inline-matcher-deps",
|
|
448
|
-
"vite-plus:coverage-version-guard"
|
|
551
|
+
"vite-plus:coverage-version-guard",
|
|
552
|
+
"vite-plus:vitest-cache-paths"
|
|
449
553
|
]);
|
|
450
554
|
function withoutVitePlusTestPlugins(plugin) {
|
|
451
555
|
if (Array.isArray(plugin)) return plugin.filter(keepUserPlugin).map(withoutVitePlusTestPlugins);
|
|
@@ -462,6 +566,7 @@ function injectPluginIntoInlineConfig(config) {
|
|
|
462
566
|
vitePlusVitestResolverPlugin(),
|
|
463
567
|
vitePlusAutoInlineMatcherPlugin(),
|
|
464
568
|
vitePlusCoverageVersionGuardPlugin(),
|
|
569
|
+
vitePlusVitestCachePathsPlugin(),
|
|
465
570
|
...(config.plugins ?? []).filter(keepUserPlugin).map(withoutVitePlusTestPlugins)
|
|
466
571
|
]
|
|
467
572
|
};
|
|
@@ -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.2.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.4";
|
|
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
|
}));
|
package/dist/define-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define_config = require("./define-config-
|
|
2
|
+
const require_define_config = require("./define-config-Dq_23Eyr.cjs");
|
|
3
3
|
require_define_config.init_define_config();
|
|
4
4
|
exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
|
|
5
5
|
exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-Bexdd6RZ.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|