vite-plus 1.0.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 +59 -6
- package/README.md +7 -7
- package/binding/index.cjs +54 -55
- package/binding/index.d.cts +53 -12
- package/dist/{agent-CKMI1a8W.js → agent-KeDc6vmg.js} +2 -2
- package/dist/bin.js +14 -11
- 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-BqJiMVVU.js → constants-BW3g7VnD.js} +3 -3
- package/dist/create/bin.d.ts +2 -1
- package/dist/create/bin.js +126 -26
- package/dist/{define-config-Cf_5GHmY.d.ts → define-config-Bexdd6RZ.d.ts} +25 -9
- package/dist/{define-config-DhEJaYRc.js → define-config-CIlk9scU.js} +111 -6
- package/dist/{define-config-C_KGDLUZ.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-CHfGUhxP.js → editor-b1XUwt9v.js} +114 -65
- 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 +63 -57
- package/dist/{oxlint-plugin-config-lMMD5fAC.js → oxlint-plugin-config-Dx-ZY2MN.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +4 -3
- package/dist/{package-Cgdlhamw.js → package-BP16iQby.js} +7 -2
- package/dist/package-overrides-D1RcXSFl.js +411 -0
- package/dist/{prompts-jMH8S4Wp.js → prompts-BGpQtC5z.js} +548 -262
- package/dist/resolve-vite-config-CGzlyhGr.js +1 -0
- package/dist/{resolve-vite-config-BJYYtfY3.js → resolve-vite-config-x47JetlI.js} +2 -2
- package/dist/staged/bin.js +792 -743
- package/dist/sync-versions/bin.js +4761 -3373
- package/dist/sync-versions/bin.mjs +5304 -5083
- 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-BoYTBNX_.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/ci.md +3 -4
- package/docs/guide/commit-hooks.md +3 -1
- package/docs/guide/create.md +14 -4
- package/docs/guide/env.md +19 -7
- package/docs/guide/github-actions-cache.md +2 -4
- package/docs/guide/global-cli.md +36 -10
- package/docs/guide/ide-integration.md +4 -2
- package/docs/guide/implode.md +2 -0
- package/docs/guide/index.md +8 -8
- package/docs/guide/local-cli.md +27 -11
- package/docs/guide/migrate-rules.md +11 -3
- package/docs/guide/migrate.md +11 -11
- package/docs/guide/{install.md → package-management.md} +28 -4
- package/docs/guide/run.md +10 -8
- package/docs/guide/test.md +3 -1
- package/docs/guide/troubleshooting.md +9 -7
- package/docs/guide/upgrade-project.md +2 -6
- package/docs/guide/upgrade.md +6 -0
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +5 -5
- package/package.json +37 -33
- 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-BWiANxFS.js +0 -8052
- package/dist/package-overrides-Dpn4scvN.js +0 -17
- package/dist/resolve-vite-config-BPgpYMYp.js +0 -2
- package/dist/tsconfig-CmKidmRD.js +0 -2
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 { 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 {
|
|
8
|
-
import { i as hasViteConfig, o as resolveViteConfig, r as findWorkspaceRoot, t as findViteConfig } from "../resolve-vite-config-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { a as
|
|
12
|
-
import { 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-CHfGUhxP.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) {
|
|
@@ -98,7 +99,6 @@ function prependToPathToEnvs(extraPath, envs) {
|
|
|
98
99
|
}
|
|
99
100
|
//#endregion
|
|
100
101
|
//#region ../../node_modules/.pnpm/nanotar@0.3.0/node_modules/nanotar/dist/index.mjs
|
|
101
|
-
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
102
102
|
const tarItemTypeMap = {
|
|
103
103
|
"0": "file",
|
|
104
104
|
"1": "hardLink",
|
|
@@ -205,13 +205,6 @@ function parseTar(data, opts) {
|
|
|
205
205
|
}
|
|
206
206
|
return files;
|
|
207
207
|
}
|
|
208
|
-
async function parseTarGzip(data, opts = {}) {
|
|
209
|
-
const stream = new ReadableStream({ start(controller) {
|
|
210
|
-
controller.enqueue(new Uint8Array(data));
|
|
211
|
-
controller.close();
|
|
212
|
-
} }).pipeThrough(new DecompressionStream(opts.compression ?? "gzip"));
|
|
213
|
-
return parseTar(await new Response(stream).arrayBuffer(), opts);
|
|
214
|
-
}
|
|
215
208
|
function _sanitizePath(path) {
|
|
216
209
|
let normalized = path.replace(/\\/g, "/");
|
|
217
210
|
normalized = normalized.replace(/^[a-zA-Z]:\//, "");
|
|
@@ -247,6 +240,78 @@ function _parseExtendedHeaders(data) {
|
|
|
247
240
|
return headers;
|
|
248
241
|
}
|
|
249
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
|
|
250
315
|
//#region src/create/org-tarball.ts
|
|
251
316
|
function getCacheRoot() {
|
|
252
317
|
return path.join(getVpDirs().cache, "create-org");
|
|
@@ -336,7 +401,7 @@ async function downloadTarball(url) {
|
|
|
336
401
|
async function readPackageJsonFromTarball(tarballUrl, integrity) {
|
|
337
402
|
const bytes = await downloadTarball(tarballUrl);
|
|
338
403
|
verifyIntegrity(bytes, integrity);
|
|
339
|
-
const entries = await
|
|
404
|
+
const entries = await parseOrgTarball(bytes);
|
|
340
405
|
for (const entry of entries) {
|
|
341
406
|
if (normalizeEntryName(entry.name) !== "package.json" || !entry.data) continue;
|
|
342
407
|
const text = new TextDecoder().decode(entry.data);
|
|
@@ -374,7 +439,7 @@ function normalizeEntryName(rawName) {
|
|
|
374
439
|
return name.slice(8);
|
|
375
440
|
}
|
|
376
441
|
async function extractTarballTo(bytes, destDir) {
|
|
377
|
-
const entries = await
|
|
442
|
+
const entries = await parseOrgTarball(bytes);
|
|
378
443
|
const stagingDir = `${destDir}${STAGING_SUFFIX_PREFIX}${process.pid}-${Date.now()}`;
|
|
379
444
|
await fs.promises.mkdir(stagingDir, { recursive: true });
|
|
380
445
|
const resolvedStaging = path.resolve(stagingDir);
|
|
@@ -677,7 +742,7 @@ async function readOrgManifest(scope, requestedVersion) {
|
|
|
677
742
|
resolvedVersion = packument["dist-tags"]?.latest;
|
|
678
743
|
if (!resolvedVersion) return null;
|
|
679
744
|
}
|
|
680
|
-
if (
|
|
745
|
+
if (normalize$1(resolvedVersion) === null) throw new OrgManifestSchemaError(`invalid version "${resolvedVersion}" (expected a semantic version)`, packageName);
|
|
681
746
|
const meta = packument.versions?.[resolvedVersion];
|
|
682
747
|
if (!meta) return null;
|
|
683
748
|
let templates = validateManifest(meta, packageName);
|
|
@@ -3984,6 +4049,36 @@ function getRandomProjectName(options = {}) {
|
|
|
3984
4049
|
}
|
|
3985
4050
|
//#endregion
|
|
3986
4051
|
//#region src/create/utils.ts
|
|
4052
|
+
var import_dist = require_dist();
|
|
4053
|
+
/** Complete only the managed catalog references of a newly created workspace member.
|
|
4054
|
+
* Running the full root migrator here would also change unrelated packages and overrides.
|
|
4055
|
+
*/
|
|
4056
|
+
function ensurePnpmCreateCatalogEntries(rootDir, projectDir) {
|
|
4057
|
+
const workspacePath = path.join(rootDir, "pnpm-workspace.yaml");
|
|
4058
|
+
const packageJsonPath = path.join(projectDir, "package.json");
|
|
4059
|
+
if (!fs.existsSync(workspacePath) || !fs.existsSync(packageJsonPath)) return;
|
|
4060
|
+
const doc = (0, import_dist.parseDocument)(fs.readFileSync(workspacePath, "utf8"));
|
|
4061
|
+
const pkg = readJsonFile(packageJsonPath);
|
|
4062
|
+
const versions = {
|
|
4063
|
+
...VITE_PLUS_OVERRIDE_PACKAGES,
|
|
4064
|
+
[VITE_PLUS_NAME]: VITE_PLUS_VERSION
|
|
4065
|
+
};
|
|
4066
|
+
let changed = false;
|
|
4067
|
+
for (const field of [
|
|
4068
|
+
"dependencies",
|
|
4069
|
+
"devDependencies",
|
|
4070
|
+
"optionalDependencies"
|
|
4071
|
+
]) for (const [name, spec] of Object.entries(pkg[field] ?? {})) {
|
|
4072
|
+
if (!Object.hasOwn(versions, name) || !spec.startsWith("catalog:")) continue;
|
|
4073
|
+
const catalogName = spec.slice(8);
|
|
4074
|
+
const entryPath = [...catalogName && catalogName !== "default" ? ["catalogs", catalogName] : doc.has("catalog") || !doc.hasIn(["catalogs", "default"]) ? ["catalog"] : ["catalogs", "default"], name];
|
|
4075
|
+
if (!doc.hasIn(entryPath)) {
|
|
4076
|
+
doc.setIn(entryPath, versions[name]);
|
|
4077
|
+
changed = true;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
if (changed) fs.writeFileSync(workspacePath, doc.toString({ singleQuote: true }));
|
|
4081
|
+
}
|
|
3987
4082
|
function hasExplicitEditorOptIn(editor) {
|
|
3988
4083
|
return typeof editor === "string" && editor.trim() !== "";
|
|
3989
4084
|
}
|
|
@@ -4378,13 +4473,12 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
|
|
|
4378
4473
|
const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
|
|
4379
4474
|
copyDir(path.join(templatesDir, "generator"), fullPath);
|
|
4380
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"));
|
|
4381
4478
|
editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
|
|
4382
4479
|
pkg.name = templateInfo.packageName;
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
const devDependencies = pkg.devDependencies;
|
|
4386
|
-
for (const [name, spec] of Object.entries(devDependencies)) if (spec === "catalog:" && catalog[name]) devDependencies[name] = catalog[name];
|
|
4387
|
-
}
|
|
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];
|
|
4388
4482
|
if (description) pkg.description = description;
|
|
4389
4483
|
return pkg;
|
|
4390
4484
|
});
|
|
@@ -5047,7 +5141,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5047
5141
|
const packageManager = (isMonorepo ? detectedPackageManager ?? requestedPackageManager : requestedPackageManager ?? detectedPackageManager) ?? await selectPackageManager(options.interactive, compactOutput);
|
|
5048
5142
|
const packageManagerVersion = packageManager === detectedPackageManager ? workspaceInfoOptional.packageManagerVersion : "latest";
|
|
5049
5143
|
const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
|
|
5050
|
-
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
|
|
5144
|
+
const downloadResult = await downloadPackageManager$1(packageManager, packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog, workspaceInfoOptional.rootDir);
|
|
5051
5145
|
const workspaceInfo = {
|
|
5052
5146
|
...workspaceInfoOptional,
|
|
5053
5147
|
packageManager,
|
|
@@ -5200,6 +5294,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5200
5294
|
updateCreateProgress("Integrating monorepo");
|
|
5201
5295
|
const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager, workspaceInfo.packages);
|
|
5202
5296
|
rewriteMonorepo(workspaceInfo, skipStagedMigration, compactOutput);
|
|
5297
|
+
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
|
|
5203
5298
|
if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
|
|
5204
5299
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager, workspaceInfo.packages);
|
|
5205
5300
|
updateCreateProgress("Installing dependencies");
|
|
@@ -5248,11 +5343,14 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5248
5343
|
await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
|
|
5249
5344
|
resumeCreateProgress();
|
|
5250
5345
|
updateCreateProgress("Generating project");
|
|
5346
|
+
const isGenerator = templateInfo.command === BuiltinTemplate.generator;
|
|
5347
|
+
if (isGenerator) pauseCreateProgress();
|
|
5251
5348
|
result = await executeBuiltinTemplate(workspaceInfo, {
|
|
5252
5349
|
...templateInfo,
|
|
5253
5350
|
packageName,
|
|
5254
5351
|
targetDir
|
|
5255
5352
|
}, { silent: compactOutput });
|
|
5353
|
+
if (isGenerator) resumeCreateProgress();
|
|
5256
5354
|
} else {
|
|
5257
5355
|
updateCreateProgress("Generating project");
|
|
5258
5356
|
result = await executeRemoteTemplate(workspaceInfo, templateInfo, { silent: compactOutput });
|
|
@@ -5374,7 +5472,8 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5374
5472
|
if (shouldMigrateLintFmtTools) await installAndMigrate(workspaceInfo.rootDir);
|
|
5375
5473
|
updateCreateProgress("Integrating into monorepo");
|
|
5376
5474
|
const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager);
|
|
5377
|
-
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, skipStagedMigration, compactOutput);
|
|
5475
|
+
rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, skipStagedMigration, compactOutput, void 0, workspaceInfo.packageManager === PackageManager.pnpm ? createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager) : void 0);
|
|
5476
|
+
if (workspaceInfo.packageManager === PackageManager.pnpm) ensurePnpmCreateCatalogEntries(workspaceInfo.rootDir, fullPath);
|
|
5378
5477
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
5379
5478
|
updateCreateProgress("Installing dependencies");
|
|
5380
5479
|
installSummary = await runViteInstall(workspaceInfo.rootDir, options.interactive, installArgs, {
|
|
@@ -5397,6 +5496,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5397
5496
|
updateCreateProgress("Applying Vite+ project setup");
|
|
5398
5497
|
const skipStagedMigration = shouldSkipStagedMigrationForHooks(fullPath, shouldSetupHooks, workspaceInfo.packageManager);
|
|
5399
5498
|
rewriteStandaloneProject(fullPath, workspaceInfo, skipStagedMigration, compactOutput);
|
|
5499
|
+
setPackageManager(fullPath, workspaceInfo.downloadPackageManager);
|
|
5400
5500
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
5401
5501
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
|
|
5402
5502
|
updateCreateProgress("Installing dependencies");
|
|
@@ -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";
|
|
@@ -157,38 +157,54 @@ type RunConfig = {
|
|
|
157
157
|
enablePrePostScripts?: boolean;
|
|
158
158
|
};
|
|
159
159
|
//#endregion
|
|
160
|
-
//#region ../../node_modules/.pnpm/lint-staged@17.
|
|
160
|
+
//#region ../../node_modules/.pnpm/lint-staged@17.6.0/node_modules/lint-staged/lib/config.d.ts
|
|
161
161
|
/**
|
|
162
162
|
* A single task that will be spawned
|
|
163
163
|
*
|
|
164
164
|
* @example "eslint --fix"
|
|
165
165
|
*/
|
|
166
166
|
type SpawnedTask = string;
|
|
167
|
-
type SyncGenerateTask = (files: readonly string[]) =>
|
|
168
|
-
type AsyncGenerateTask = (files: readonly string[]) => Promise<
|
|
167
|
+
type SyncGenerateTask<Result> = (files: readonly string[]) => Result;
|
|
168
|
+
type AsyncGenerateTask<Result> = (files: readonly string[]) => Promise<Result>;
|
|
169
169
|
/**
|
|
170
170
|
* A function that returns one or more tasks that will be spawned and run sequentially, in order.
|
|
171
|
-
*
|
|
171
|
+
* Tasks can be nested in one extra level of array to run them in parallel.
|
|
172
|
+
* The function receives list of the matched staged files as its argument and should return the
|
|
173
|
+
* complete command to be run, including passing filenames. Can be sync or async.
|
|
172
174
|
*
|
|
173
175
|
* @example <caption>Return a command after manipulating list of staged files</caption>
|
|
174
176
|
* (files: string) => `eslint --fix ${files.map((f) => `'${f}'`).join(' ')}`
|
|
175
177
|
*
|
|
176
178
|
* @example <caption>Ignore staged files and run "tsc" and "vitest" without any arguments</caption>
|
|
177
179
|
* () => ['tsc', 'vitest']
|
|
180
|
+
*
|
|
181
|
+
* @example <caption>Run "tsc" and "vitest" concurrently</caption>
|
|
182
|
+
* () => [['tsc', 'vitest']]
|
|
178
183
|
*/
|
|
179
|
-
type GenerateTask = SyncGenerateTask | AsyncGenerateTask
|
|
184
|
+
type GenerateTask<Result = string | (string | string[])[]> = SyncGenerateTask<Result> | AsyncGenerateTask<Result>;
|
|
180
185
|
/**
|
|
181
186
|
* List of tasks that will be run in parallel
|
|
182
187
|
*
|
|
183
188
|
* @example ["prettier --write", "eslint --fix"]
|
|
184
189
|
*/
|
|
185
|
-
type ParallelTasks = (SpawnedTask | GenerateTask)[];
|
|
190
|
+
type ParallelTasks = (SpawnedTask | GenerateTask<string>)[];
|
|
186
191
|
/**
|
|
187
192
|
* List of tasks that will be run sequentially, in order
|
|
188
193
|
*
|
|
189
194
|
* @example ["prettier --write", "eslint --fix"]
|
|
190
195
|
*/
|
|
191
|
-
type SequentialTasks = (SpawnedTask | GenerateTask | ParallelTasks)[];
|
|
196
|
+
type SequentialTasks = (SpawnedTask | GenerateTask<string | string[]> | ParallelTasks)[];
|
|
197
|
+
type TaskFunctionContext = {
|
|
198
|
+
/**
|
|
199
|
+
* Emit output from the task. All arguments of the call will be passed to Node.js `util.format()`.
|
|
200
|
+
* The output will only be shown on error, unless `--verbose` is used.
|
|
201
|
+
*
|
|
202
|
+
* @example log('Hello from task')
|
|
203
|
+
*
|
|
204
|
+
* @see https://nodejs.org/api/util.html#utilformatformat-args
|
|
205
|
+
*/
|
|
206
|
+
log: (format: any, ...param: any[]) => void;
|
|
207
|
+
};
|
|
192
208
|
/**
|
|
193
209
|
* A single Node.js/JavaScript task that defines its title and the function which will be
|
|
194
210
|
* run with the list of the matched staged files as its argument.
|
|
@@ -203,7 +219,7 @@ type SequentialTasks = (SpawnedTask | GenerateTask | ParallelTasks)[];
|
|
|
203
219
|
*/
|
|
204
220
|
type TaskFunction = {
|
|
205
221
|
title: string;
|
|
206
|
-
task: (filepaths: readonly string[]) => void | Promise<void>;
|
|
222
|
+
task: (filepaths: readonly string[], context: TaskFunctionContext) => void | Promise<void>;
|
|
207
223
|
};
|
|
208
224
|
/** An entire `lint-staged` configuration, or a function that returns one */
|
|
209
225
|
type Configuration = Record<string, SpawnedTask | TaskFunction | GenerateTask | SequentialTasks> | GenerateTask;
|
|
@@ -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 };
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
|
1
|
+
export { t as AUTO_INLINE_DEPS, n as assertCoverageProviderVersionMatch, r as checkCoverageProviderVersion, i as computeAutoInlineList, a as defineConfig, o as defineProject, s as isVitestFamilySpecifier, c as lazyPlugins, l as resolveCoverageProviderToCheck, u as withConfigMetadataResolution } from "./define-config-CIlk9scU.js";
|