vite-plus 0.3.3 → 1.0.0-rc.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 +35 -146
- package/README.md +3 -3
- package/binding/index.cjs +57 -54
- package/binding/index.d.cts +9 -0
- package/dist/{agent-Cu6-tXIP.js → agent-Dinpyd-k.js} +6 -5
- package/dist/bin.js +48 -18
- package/dist/config/bin.js +2 -2
- package/dist/constants-CiKwrA0v.js +356 -0
- package/dist/create/bin.js +18 -12
- package/dist/{define-config-DPNEJxPz.d.ts → define-config-B9usMnEa.d.ts} +51 -10
- package/dist/{define-config-D0mevyb3.cjs → define-config-CBccpane.cjs} +173 -44
- package/dist/{define-config-IgzmnvvV.js → define-config-jhuYJ7Tb.js} +158 -42
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/documentation-DqcZSthV.js +11 -0
- package/dist/{editor-4sjlHmUh.js → editor-DMBczTdj.js} +205 -152
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-cULBl7Pi.js → json-JP24qHUF.js} +14 -6
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +3122 -15
- package/dist/{oxlint-plugin-config-BVqEe9KY.js → oxlint-plugin-config-BgsDA6ua.js} +1 -1
- package/dist/oxlint-plugin.js +9 -7
- package/dist/pack-bin.js +1 -1
- package/dist/{package-CHH8jWan.js → package-B85H2Nw0.js} +6 -2
- package/dist/{vitest-ecosystem-BiRqcaRI.js → package-overrides-Dpn4scvN.js} +1 -7
- package/dist/{prompts-k14KgthC.js → prompts-CQobX7uP.js} +2 -2
- package/dist/{resolve-vite-config-BqvS2P98.js → resolve-vite-config-BUFUmi8h.js} +2 -2
- package/dist/{resolve-vite-config-CTOTuqTi.js → resolve-vite-config-I8fmpR7I.js} +1 -1
- package/dist/staged/bin.js +1205 -3317
- package/dist/sync-versions/bin.js +3 -2
- package/dist/sync-versions/bin.mjs +17 -2
- package/dist/test/browser/context.js +1 -1
- package/dist/test/browser/providers/playwright/context.js +1 -1
- package/dist/test/browser/providers/preview/context.js +1 -1
- package/dist/test/browser-playwright/context.js +1 -1
- package/dist/test/browser-preview/context.js +1 -1
- package/dist/test/context.d.ts +2 -942
- package/dist/test/context.js +1 -1
- package/dist/test/internal/traces.js +1 -0
- package/dist/test/locators.d.ts +2 -294
- package/dist/test/matchers.d.ts +2 -29
- package/dist/test/mocker.d.ts +2 -0
- package/dist/test/mocker.js +1 -0
- package/dist/test/{browser-webdriverio/context.js → plugins/browser-context.d.ts} +1 -0
- package/dist/test/plugins/browser-context.js +1 -1
- package/dist/test/plugins/browser-locators.d.ts +2 -0
- package/dist/test/plugins/browser-playwright.d.ts +2 -0
- package/dist/test/plugins/browser-preview.d.ts +2 -0
- package/dist/test/plugins/browser.d.ts +2 -0
- package/dist/test/plugins/mocker-automock.d.ts +2 -0
- package/dist/test/plugins/mocker-browser.d.ts +2 -0
- package/dist/test/plugins/mocker-node.d.ts +2 -0
- package/dist/test/plugins/mocker-redirect.d.ts +2 -0
- package/dist/test/plugins/mocker-register.d.ts +2 -0
- package/dist/test/plugins/mocker-transforms.d.ts +2 -0
- package/dist/test/plugins/mocker.d.ts +2 -0
- package/dist/test/plugins/pretty-format.d.ts +2 -0
- package/dist/test/plugins/snapshot-environment.d.ts +2 -0
- package/dist/test/plugins/snapshot-manager.d.ts +2 -0
- package/dist/test/plugins/snapshot.d.ts +2 -0
- package/dist/test/plugins/spy.d.ts +2 -0
- package/dist/test/plugins/utils-constants.d.ts +2 -0
- package/dist/test/plugins/utils-diff.d.ts +2 -0
- package/dist/test/plugins/utils-display.d.ts +2 -0
- package/dist/test/plugins/utils-error.d.ts +2 -0
- package/dist/test/plugins/utils-helpers.d.ts +2 -0
- package/dist/test/plugins/utils-offset.d.ts +2 -0
- package/dist/test/plugins/utils-resolver.d.ts +2 -0
- package/dist/test/plugins/utils-serialize.d.ts +2 -0
- package/dist/test/plugins/utils-source-map-node.d.ts +2 -0
- package/dist/test/plugins/utils-source-map.d.ts +2 -0
- package/dist/test/plugins/utils-timers.d.ts +2 -0
- package/dist/test/plugins/utils.d.ts +2 -0
- package/dist/toolchain.js +8 -8
- package/dist/toolchain.json +8 -8
- package/dist/{tsconfig-C3h9CVTA.js → tsconfig-Buo0RSzz.js} +8 -4
- package/dist/{tsconfig-euB-GmIE.js → tsconfig-C1VeTG9k.js} +1 -1
- package/dist/version.js +5 -3
- package/dist/versions.js +4 -4
- package/dist/vitest-ecosystem-BU0AqZq-.js +23 -0
- package/dist/vitest-v5-entry-points-DthU1e_O.js +25 -0
- package/docs/config/fmt.md +2 -2
- package/docs/config/lint.md +2 -2
- package/docs/config/run.md +1 -1
- package/docs/guide/check.md +2 -0
- package/docs/guide/commit-hooks.md +8 -1
- package/docs/guide/env.md +18 -13
- package/docs/guide/fmt.md +4 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +1 -1
- package/docs/guide/lint.md +3 -1
- package/docs/guide/local-cli.md +3 -3
- package/docs/guide/migrate-rules.md +16 -12
- package/docs/guide/migrate.md +86 -20
- package/docs/guide/monorepo.md +5 -1
- package/docs/guide/test.md +2 -0
- package/docs/guide/troubleshooting.md +3 -3
- package/docs/guide/vitest-v5.md +221 -0
- package/package.json +64 -87
- package/bin/oxfmt +0 -33
- package/bin/oxlint +0 -38
- package/dist/cli-truncate-Bg3RDXpi.js +0 -865
- package/dist/constants-C2dTOTe-.js +0 -80
- package/dist/is-fullwidth-code-point-BUNlIICg.js +0 -8
- package/dist/log-update-CoW8Z4Dl.js +0 -491
- package/dist/strip-ansi-C3wrWz9t.js +0 -853
- package/dist/test/browser/providers/webdriverio/context.d.ts +0 -1
- package/dist/test/browser/providers/webdriverio/context.js +0 -1
- package/dist/test/browser/providers/webdriverio.d.ts +0 -77
- package/dist/test/browser/providers/webdriverio.js +0 -1
- package/dist/test/browser-webdriverio/context.d.ts +0 -1
- package/dist/test/browser-webdriverio.d.ts +0 -77
- package/dist/test/browser-webdriverio.js +0 -1
- package/dist/test/coverage.d.ts +0 -2
- package/dist/test/coverage.js +0 -1
- package/dist/test/environments.d.ts +0 -2
- package/dist/test/environments.js +0 -1
- package/dist/test/plugins/browser-webdriverio.js +0 -1
- package/dist/test/plugins/expect.js +0 -1
- package/dist/test/plugins/runner-types.js +0 -1
- package/dist/test/plugins/runner-utils.js +0 -1
- package/dist/test/plugins/runner.js +0 -1
- package/dist/test/reporters.d.ts +0 -2
- package/dist/test/reporters.js +0 -1
- package/dist/test/runners.d.ts +0 -2
- package/dist/test/runners.js +0 -1
- package/dist/test/snapshot.d.ts +0 -2
- package/dist/test/snapshot.js +0 -1
- package/dist/test/suite.d.ts +0 -2
- package/dist/test/suite.js +0 -1
- package/dist/tsgolint-path-CbDReEOx.js +0 -34
- package/dist/tsgolint-path.d.ts +0 -7
- package/dist/tsgolint-path.js +0 -2
- package/dist/wrap-ansi-DNjkuBEp.js +0 -157
- package/dist/wrap-ansi-DUi52C6W.js +0 -2
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { r as __toESM } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
6
|
-
import {
|
|
2
|
+
import { t as documentationUrl$1 } from "./documentation-DqcZSthV.js";
|
|
3
|
+
import { a as SETUP_VP_VERSION, c as VITEST_VERSION, d as VITE_PLUS_OVERRIDE_PACKAGES, f as VITE_PLUS_VERSION, l as VITE_CONFIG_FILES, m as isForceOverrideMode, n as BASEURL_TSCONFIG_WARNING, o as TSDOWN_MIGRATION_SKILL_URL, s as VITEST_AGE_GATE_EXEMPT_PACKAGES, u as VITE_PLUS_NAME } from "./constants-CiKwrA0v.js";
|
|
4
|
+
import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BgsDA6ua.js";
|
|
5
|
+
import { a as writeJsonFile, c as modify, i as readJsonFile, l as parse, n as editJsonFile, o as applyEdits, r as isJsonFile, t as detectFormattingOptions } from "./json-JP24qHUF.js";
|
|
6
|
+
import { n as detectPackageMetadata, o as fetchNpmResource, r as getScopeFromPackageName, s as getNpmRegistry } from "./package-B85H2Nw0.js";
|
|
7
|
+
import { n as isAlignableVitestEcosystemPackage } from "./vitest-ecosystem-BU0AqZq-.js";
|
|
8
|
+
import { C as multiselect, S as log, T as select, _ as getSpinner, b as confirm, d as readYamlFile, f as scalarString, g as getSilentSpinner, k as isCancel, t as cancelAndExit, u as editYamlFile, y as PackageManager } from "./prompts-CQobX7uP.js";
|
|
7
9
|
import { t as require_semver } from "./semver-CaDAb8vV.js";
|
|
8
|
-
import { l as displayRelative, u as rulesDir } from "./agent-
|
|
10
|
+
import { l as displayRelative, u as rulesDir } from "./agent-Dinpyd-k.js";
|
|
9
11
|
import { n as addMigrationWarning, t as addManualStep } from "./report-CK5TnTsr.js";
|
|
10
12
|
import { n as runCommandSilently, r as require_cross_spawn } from "./command-CguLh2KL.js";
|
|
11
13
|
import { t as require_dist } from "./dist-BDYZP12R.js";
|
|
12
|
-
import { a as hasBaseUrlInTsconfig, c as hasVitestTypesInTsconfig, l as removeDeprecatedTsconfigFalseOption, n as findTsconfigFiles, s as hasTypesToRewriteInTsconfig, u as rewriteTypesInTsconfig } from "./tsconfig-
|
|
13
|
-
import {
|
|
14
|
+
import { a as hasBaseUrlInTsconfig, c as hasVitestTypesInTsconfig, l as removeDeprecatedTsconfigFalseOption, n as findTsconfigFiles, s as hasTypesToRewriteInTsconfig, u as rewriteTypesInTsconfig } from "./tsconfig-Buo0RSzz.js";
|
|
15
|
+
import { t as extractOverrideTargetName } from "./package-overrides-Dpn4scvN.js";
|
|
14
16
|
import { i as findUnsafeHookInstallPath, t as SUPPORTED_GIT_HOOK_NAMES } from "./hooks-C-4gykWR.js";
|
|
15
17
|
import path, { posix, win32 } from "node:path";
|
|
16
18
|
import { fileURLToPath } from "node:url";
|
|
@@ -56,28 +58,18 @@ const REMOVE_PACKAGES = [
|
|
|
56
58
|
];
|
|
57
59
|
const WEBDRIVERIO_PROVIDER = "@vitest/browser-webdriverio";
|
|
58
60
|
const PLAYWRIGHT_PROVIDER = "@vitest/browser-playwright";
|
|
59
|
-
const OPT_IN_BROWSER_PROVIDERS = [
|
|
61
|
+
const OPT_IN_BROWSER_PROVIDERS = [PLAYWRIGHT_PROVIDER];
|
|
60
62
|
const PROVIDER_OVERRIDE_DROP_NAMES = [...REMOVE_PACKAGES, ...OPT_IN_BROWSER_PROVIDERS];
|
|
61
|
-
const BROWSER_PROVIDER_PEER_DEPS = {
|
|
62
|
-
"@vitest/browser-playwright": "playwright",
|
|
63
|
-
"@vitest/browser-webdriverio": "webdriverio"
|
|
64
|
-
};
|
|
63
|
+
const BROWSER_PROVIDER_PEER_DEPS = { "@vitest/browser-playwright": "playwright" };
|
|
65
64
|
const RUNTIME_PEER_INCLUDED_BY = { playwright: ["@playwright/test"] };
|
|
66
|
-
const PROVIDER_PEER_VERSION_SIBLINGS = { webdriverio: ["@wdio/cli", "@wdio/globals"] };
|
|
67
65
|
function findDeclaredSpec(pkg, name) {
|
|
68
66
|
return pkg.dependencies?.[name] ?? pkg.devDependencies?.[name] ?? pkg.peerDependencies?.[name] ?? pkg.optionalDependencies?.[name];
|
|
69
67
|
}
|
|
70
68
|
function hasProviderPeerDependency(pkg, runtimePeer) {
|
|
71
69
|
return findDeclaredSpec(pkg, runtimePeer) !== void 0 || (RUNTIME_PEER_INCLUDED_BY[runtimePeer] ?? []).some((packageName) => findDeclaredSpec(pkg, packageName) !== void 0);
|
|
72
70
|
}
|
|
73
|
-
function resolveProviderPeerSpec(
|
|
74
|
-
|
|
75
|
-
for (const sibling of PROVIDER_PEER_VERSION_SIBLINGS[peer] ?? []) {
|
|
76
|
-
const spec = findDeclaredSpec(pkg, sibling);
|
|
77
|
-
const resolved = spec?.startsWith("catalog:") ? catalogDependencyResolver?.(spec, sibling) : spec;
|
|
78
|
-
if (resolved && !resolved.includes(":")) return resolved;
|
|
79
|
-
}
|
|
80
|
-
return "*";
|
|
71
|
+
function resolveProviderPeerSpec(peer, supportCatalog, catalogDependencyResolver) {
|
|
72
|
+
return supportCatalog && catalogDependencyResolver?.("catalog:", peer) !== void 0 ? "catalog:" : "*";
|
|
81
73
|
}
|
|
82
74
|
const VITEST_BROWSER_DEP_NAMES = [
|
|
83
75
|
"@vitest/browser",
|
|
@@ -363,6 +355,29 @@ function extractSkippedRules(output) {
|
|
|
363
355
|
return block.join("\n");
|
|
364
356
|
}
|
|
365
357
|
/**
|
|
358
|
+
* Resolve the `@oxlint/migrate` version to install. `@oxlint/migrate`
|
|
359
|
+
* trails `oxlint` releases (published minutes to days later), so the exact
|
|
360
|
+
* bundled-oxlint pin can name a version the registry does not have yet.
|
|
361
|
+
* Pick the greatest published version that is not newer than the bundled
|
|
362
|
+
* Oxlint. Fall back to the exact pin when the registry cannot be reached
|
|
363
|
+
* and let the dlx step surface the failure.
|
|
364
|
+
*/
|
|
365
|
+
async function resolveOxlintMigrateVersion(oxlintVersion) {
|
|
366
|
+
try {
|
|
367
|
+
const response = await fetchNpmResource(`${getNpmRegistry("@oxlint")}/@oxlint/migrate`, {
|
|
368
|
+
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
369
|
+
timeoutMs: 5e3
|
|
370
|
+
});
|
|
371
|
+
if (!response.ok) return oxlintVersion;
|
|
372
|
+
const packument = await response.json();
|
|
373
|
+
if (packument.versions && Object.hasOwn(packument.versions, oxlintVersion)) return oxlintVersion;
|
|
374
|
+
const candidates = Object.keys(packument.versions ?? {}).filter((version) => import_semver.default.valid(version) && import_semver.default.lte(version, oxlintVersion));
|
|
375
|
+
return candidates.length > 0 ? candidates.toSorted(import_semver.default.rcompare)[0] : oxlintVersion;
|
|
376
|
+
} catch {
|
|
377
|
+
return oxlintVersion;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
366
381
|
* Run a `vp dlx @oxlint/migrate` step with graceful error handling.
|
|
367
382
|
* Returns true on success, false on failure (spawn error or non-zero exit).
|
|
368
383
|
*/
|
|
@@ -400,7 +415,7 @@ async function migrateEslintToOxlint(projectPath, interactive, eslintConfigFile,
|
|
|
400
415
|
const spinner = options?.silent ? getSilentSpinner() : getSpinner(interactive);
|
|
401
416
|
if (eslintConfigFile) {
|
|
402
417
|
const { versions } = await import("./versions.js");
|
|
403
|
-
const migratePackage = `@oxlint/migrate@${versions.oxlint}`;
|
|
418
|
+
const migratePackage = `@oxlint/migrate@${await resolveOxlintMigrateVersion(versions.oxlint)}`;
|
|
404
419
|
const migrateArgs = [
|
|
405
420
|
"--merge",
|
|
406
421
|
...!hasBaseUrlInTsconfig(projectPath) ? ["--type-aware"] : [],
|
|
@@ -1572,9 +1587,12 @@ function dropRemovePackageOverrideKeys(overrides, ancestorChain = []) {
|
|
|
1572
1587
|
}
|
|
1573
1588
|
return removed;
|
|
1574
1589
|
}
|
|
1575
|
-
function managedOverridePackages(usesVitest) {
|
|
1576
|
-
|
|
1577
|
-
return
|
|
1590
|
+
function managedOverridePackages(usesVitest, usesWebdriverioProvider = false) {
|
|
1591
|
+
const managed = usesVitest ? VITE_PLUS_OVERRIDE_PACKAGES : Object.fromEntries(Object.entries(VITE_PLUS_OVERRIDE_PACKAGES).filter(([key]) => key !== "vitest"));
|
|
1592
|
+
return usesWebdriverioProvider && VITEST_IS_MANAGED_OVERRIDE ? {
|
|
1593
|
+
...managed,
|
|
1594
|
+
"@vitest/browser": VITEST_VERSION
|
|
1595
|
+
} : managed;
|
|
1578
1596
|
}
|
|
1579
1597
|
function projectListsVitestEcosystemDep(pkg) {
|
|
1580
1598
|
return [
|
|
@@ -1724,7 +1742,7 @@ function vitestEcosystemCatalogReferencesPending(pkg, catalogDependencyResolver)
|
|
|
1724
1742
|
pkg.optionalDependencies
|
|
1725
1743
|
]) {
|
|
1726
1744
|
if (!dependencies) continue;
|
|
1727
|
-
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "
|
|
1745
|
+
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "5.0.1") return true;
|
|
1728
1746
|
}
|
|
1729
1747
|
return false;
|
|
1730
1748
|
}
|
|
@@ -1743,6 +1761,37 @@ function collectVitestEcosystemInstallDependencyNames(rootDir, packages) {
|
|
|
1743
1761
|
return names;
|
|
1744
1762
|
}
|
|
1745
1763
|
//#endregion
|
|
1764
|
+
//#region src/utils/git.ts
|
|
1765
|
+
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
1766
|
+
/**
|
|
1767
|
+
* Walk up from `startPath` looking for `.git` (directory or file — submodules
|
|
1768
|
+
* use a `.git` file). Returns the directory that contains `.git`, or `null`.
|
|
1769
|
+
*/
|
|
1770
|
+
function findGitRoot(startPath) {
|
|
1771
|
+
let dir = startPath;
|
|
1772
|
+
while (true) {
|
|
1773
|
+
if (fs.existsSync(path.join(dir, ".git"))) return dir;
|
|
1774
|
+
const parent = path.dirname(dir);
|
|
1775
|
+
if (parent === dir) return null;
|
|
1776
|
+
dir = parent;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
async function initGitRepository(cwd) {
|
|
1780
|
+
const result = await runCommandSilently({
|
|
1781
|
+
command: "git",
|
|
1782
|
+
args: ["init"],
|
|
1783
|
+
cwd,
|
|
1784
|
+
envs: process.env
|
|
1785
|
+
});
|
|
1786
|
+
if (result.exitCode !== 0) {
|
|
1787
|
+
log.warn("Failed to initialize git repository");
|
|
1788
|
+
const stderr = result.stderr.toString().trim();
|
|
1789
|
+
if (stderr) log.info(stderr);
|
|
1790
|
+
return false;
|
|
1791
|
+
}
|
|
1792
|
+
return true;
|
|
1793
|
+
}
|
|
1794
|
+
//#endregion
|
|
1746
1795
|
//#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
1747
1796
|
const balanced = (a, b, str) => {
|
|
1748
1797
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
@@ -3848,7 +3897,7 @@ var L = class c {
|
|
|
3848
3897
|
}
|
|
3849
3898
|
};
|
|
3850
3899
|
//#endregion
|
|
3851
|
-
//#region ../../node_modules/.pnpm/minipass@7.1.
|
|
3900
|
+
//#region ../../node_modules/.pnpm/minipass@7.1.3/node_modules/minipass/dist/esm/index.js
|
|
3852
3901
|
const proc = typeof process === "object" && process ? process : {
|
|
3853
3902
|
stdout: null,
|
|
3854
3903
|
stderr: null
|
|
@@ -3943,7 +3992,7 @@ var PipeProxyErrors = class extends Pipe {
|
|
|
3943
3992
|
}
|
|
3944
3993
|
constructor(src, dest, opts) {
|
|
3945
3994
|
super(src, dest, opts);
|
|
3946
|
-
this.proxyErrors = (er) => dest.emit("error", er);
|
|
3995
|
+
this.proxyErrors = (er) => this.dest.emit("error", er);
|
|
3947
3996
|
src.on("error", this.proxyErrors);
|
|
3948
3997
|
}
|
|
3949
3998
|
};
|
|
@@ -4582,7 +4631,8 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
|
|
|
4582
4631
|
return: stop,
|
|
4583
4632
|
[Symbol.asyncIterator]() {
|
|
4584
4633
|
return this;
|
|
4585
|
-
}
|
|
4634
|
+
},
|
|
4635
|
+
[Symbol.asyncDispose]: async () => {}
|
|
4586
4636
|
};
|
|
4587
4637
|
}
|
|
4588
4638
|
/**
|
|
@@ -4622,7 +4672,8 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
|
|
|
4622
4672
|
return: stop,
|
|
4623
4673
|
[Symbol.iterator]() {
|
|
4624
4674
|
return this;
|
|
4625
|
-
}
|
|
4675
|
+
},
|
|
4676
|
+
[Symbol.dispose]: () => {}
|
|
4626
4677
|
};
|
|
4627
4678
|
}
|
|
4628
4679
|
/**
|
|
@@ -4665,7 +4716,7 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
|
|
|
4665
4716
|
}
|
|
4666
4717
|
};
|
|
4667
4718
|
//#endregion
|
|
4668
|
-
//#region ../../node_modules/.pnpm/path-scurry@2.0.
|
|
4719
|
+
//#region ../../node_modules/.pnpm/path-scurry@2.0.2/node_modules/path-scurry/dist/esm/index.js
|
|
4669
4720
|
const realpathSync$2 = realpathSync$1.native;
|
|
4670
4721
|
const defaultFS = {
|
|
4671
4722
|
lstatSync: lstatSync$1,
|
|
@@ -7402,10 +7453,10 @@ function migratePnpmSettingsToWorkspaceYaml(projectPath, settings) {
|
|
|
7402
7453
|
* Rewrite pnpm-workspace.yaml to add vite-plus dependencies
|
|
7403
7454
|
* @param projectPath - The path to the project
|
|
7404
7455
|
*/
|
|
7405
|
-
function rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, writeWorkspaceSettings = true, catalogAdditions = /* @__PURE__ */ new Set()) {
|
|
7456
|
+
function rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, writeWorkspaceSettings = true, catalogAdditions = /* @__PURE__ */ new Set(), usesWebdriverioProvider = false) {
|
|
7406
7457
|
const pnpmWorkspaceYamlPath = path.join(projectPath, "pnpm-workspace.yaml");
|
|
7407
7458
|
if (!fs.existsSync(pnpmWorkspaceYamlPath)) fs.writeFileSync(pnpmWorkspaceYamlPath, "");
|
|
7408
|
-
const managed = managedOverridePackages(usesVitest);
|
|
7459
|
+
const managed = managedOverridePackages(usesVitest, usesWebdriverioProvider);
|
|
7409
7460
|
editYamlFile(pnpmWorkspaceYamlPath, (doc) => {
|
|
7410
7461
|
const preferredCatalogSpec = rewriteCatalog(doc, usesVitest, vitestEcosystemPackages, catalogAdditions);
|
|
7411
7462
|
if (!writeWorkspaceSettings) return;
|
|
@@ -7420,7 +7471,9 @@ function rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrow
|
|
|
7420
7471
|
if (!usesVitest) removeYamlMapVitestEntry(doc.getIn(["overrides"]), "pnpm-ranged");
|
|
7421
7472
|
for (const key of Object.keys(managed)) {
|
|
7422
7473
|
const overrideKey = pnpmOverrideKey(key);
|
|
7423
|
-
const
|
|
7474
|
+
const currentVersion = getYamlMapScalarStringValue(overrides, overrideKey) ?? getYamlMapScalarStringValue(overrides, key);
|
|
7475
|
+
// @vitest/browser is an override-only entry: migration removes its direct
|
|
7476
|
+
const version = key === "@vitest/browser" ? managed[key] : getCatalogDependencySpec(currentVersion, managed[key], true, { preferredCatalogSpec });
|
|
7424
7477
|
if (overrides instanceof import_dist.YAMLMap) overrides.delete(key);
|
|
7425
7478
|
doc.setIn(["overrides", scalarString(overrideKey)], scalarString(version));
|
|
7426
7479
|
}
|
|
@@ -7439,14 +7492,14 @@ function rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrow
|
|
|
7439
7492
|
}
|
|
7440
7493
|
if (!usesVitest && VITEST_IS_MANAGED_OVERRIDE) allowAny.items = allowAny.items.filter((n) => n.value !== "vitest");
|
|
7441
7494
|
const existing = new Set(allowAny.items.map((n) => n.value));
|
|
7442
|
-
for (const key of Object.keys(
|
|
7495
|
+
for (const key of Object.keys(managedOverridePackages(usesVitest))) if (!existing.has(key)) allowAny.add(scalarString(key));
|
|
7443
7496
|
doc.setIn(["peerDependencyRules", "allowAny"], allowAny);
|
|
7444
7497
|
const allowedVersionsNode = doc.getIn(["peerDependencyRules", "allowedVersions"]);
|
|
7445
7498
|
let allowedVersions;
|
|
7446
7499
|
if (allowedVersionsNode instanceof import_dist.YAMLMap) allowedVersions = allowedVersionsNode;
|
|
7447
7500
|
else allowedVersions = new import_dist.YAMLMap();
|
|
7448
7501
|
if (!usesVitest) removeYamlMapVitestEntry(allowedVersions);
|
|
7449
|
-
for (const key of Object.keys(
|
|
7502
|
+
for (const key of Object.keys(managedOverridePackages(usesVitest))) allowedVersions.set(scalarString(key), scalarString("*"));
|
|
7450
7503
|
doc.setIn(["peerDependencyRules", "allowedVersions"], allowedVersions);
|
|
7451
7504
|
if (doc.has("minimumReleaseAge")) {
|
|
7452
7505
|
let minimumReleaseAgeExclude = doc.getIn(["minimumReleaseAgeExclude"]);
|
|
@@ -7520,38 +7573,10 @@ function getCatalogDependencySpec(currentValue, version, supportCatalog, options
|
|
|
7520
7573
|
return currentValue?.startsWith("catalog:") ? currentValue : options?.preferredCatalogSpec ?? "catalog:";
|
|
7521
7574
|
}
|
|
7522
7575
|
/**
|
|
7523
|
-
* #1932: under pnpm, an importer that depends on `vite-plus` (which bundles
|
|
7524
|
-
* `vitest`) needs a DIRECT `vite` devDep pointing at @voidzero-dev/vite-plus-core
|
|
7525
|
-
* so vitest's required `vite` peer binds to it. Without a direct edge, pnpm's
|
|
7526
|
-
* `autoInstallPeers` fabricates a separate upstream `vite` to satisfy the
|
|
7527
|
-
* peer, splitting vite-plus / vite / vitest into duplicate instances (the extra
|
|
7528
|
-
* vite also lacks vite's `@voidzero-dev/vite-task-client` integration, breaking
|
|
7529
|
-
* the `vp test` cache). Under a catalog the edge is a `catalog:` reference and
|
|
7530
|
-
* the catalog entry carries the alias; the `vite@*` workspace override covers
|
|
7531
|
-
* transitive and peer declarations instead of this one (see `pnpmOverrideKey`).
|
|
7532
|
-
* npm/yarn/bun redirect transitive/peer vite via root overrides/resolutions (and
|
|
7533
|
-
* drop the aliased vite), so this is pnpm-only, mirroring the bun root-package
|
|
7534
|
-
* branch in `rewriteRootWorkspacePackageJson`.
|
|
7535
|
-
*
|
|
7536
|
-
* A package that already declares `vite` in ANY dependency field, including
|
|
7537
|
-
* `peerDependencies` (e.g. a vite plugin pinning `vite ^6`), is left untouched
|
|
7538
|
-
* so its existing version contract is preserved. Call this AFTER `vite-plus`
|
|
7539
|
-
* has been ensured in the package, so the dependency check sees it.
|
|
7540
|
-
*/
|
|
7541
|
-
function ensureDirectViteForPnpm(pkg, packageManager, supportCatalog, catalogDependencyResolver) {
|
|
7542
|
-
const viteOverride = VITE_PLUS_OVERRIDE_PACKAGES.vite;
|
|
7543
|
-
if (packageManager !== PackageManager.pnpm || !viteOverride) return false;
|
|
7544
|
-
const dependsOnVitePlus = pkg.dependencies?.["vite-plus"] !== void 0 || pkg.devDependencies?.["vite-plus"] !== void 0;
|
|
7545
|
-
const viteAlreadyDirect = pkg.dependencies?.vite !== void 0 || pkg.devDependencies?.vite !== void 0 || pkg.optionalDependencies?.vite !== void 0 || pkg.peerDependencies?.vite !== void 0;
|
|
7546
|
-
if (!dependsOnVitePlus || viteAlreadyDirect) return false;
|
|
7547
|
-
setDirectViteEdge(pkg, supportCatalog, catalogDependencyResolver);
|
|
7548
|
-
return true;
|
|
7549
|
-
}
|
|
7550
|
-
/**
|
|
7551
7576
|
* Insert (or overwrite) a DIRECT `vite` devDependency edge in SORTED position.
|
|
7552
7577
|
*
|
|
7553
7578
|
* Several migration paths need a direct `vite` devDep for different reasons
|
|
7554
|
-
* (
|
|
7579
|
+
* (bun peer pre-resolution oven-sh/bun#8406; npm
|
|
7555
7580
|
* `@vitest/mocker` hoisting for opt-in providers), but they all want the SAME
|
|
7556
7581
|
* spec and the SAME placement, so both are centralized here. Each caller keeps
|
|
7557
7582
|
* its OWN gate for WHEN a direct edge is needed; this owns only the spec +
|
|
@@ -7759,10 +7784,10 @@ function rewriteCatalogsObject(catalogs, usesVitest, vitestEcosystemPackages) {
|
|
|
7759
7784
|
* unlike pnpm which uses pnpm-workspace.yaml.
|
|
7760
7785
|
* @see https://bun.sh/docs/pm/catalogs
|
|
7761
7786
|
*/
|
|
7762
|
-
function rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages) {
|
|
7787
|
+
function rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages, usesWebdriverioProvider = false) {
|
|
7763
7788
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
7764
7789
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
7765
|
-
const managed = managedOverridePackages(usesVitest);
|
|
7790
|
+
const managed = managedOverridePackages(usesVitest, usesWebdriverioProvider);
|
|
7766
7791
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
7767
7792
|
const workspacesObj = pkg.workspaces && !Array.isArray(pkg.workspaces) ? pkg.workspaces : void 0;
|
|
7768
7793
|
const useWorkspacesCatalog = workspacesObj?.catalog != null || pkg.catalog == null && workspacesObj?.catalogs != null;
|
|
@@ -7796,7 +7821,7 @@ function rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages) {
|
|
|
7796
7821
|
for (const [key, value] of Object.entries(managed)) {
|
|
7797
7822
|
const current = overrides[key];
|
|
7798
7823
|
if (current !== void 0 && typeof current !== "string") continue;
|
|
7799
|
-
overrides[key] = getCatalogDependencySpec(current, value, true);
|
|
7824
|
+
overrides[key] = key === "@vitest/browser" ? value : getCatalogDependencySpec(current, value, true);
|
|
7800
7825
|
}
|
|
7801
7826
|
pkg.overrides = overrides;
|
|
7802
7827
|
return pkg;
|
|
@@ -7809,7 +7834,7 @@ function rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages) {
|
|
|
7809
7834
|
function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStagedMigration, catalogDependencyResolver, packages, pnpmMajorVersion, pnpmVersion, shouldAllowBrowserBuilds = false, workspaceUsesVitest = true, supportCatalog = true) {
|
|
7810
7835
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
7811
7836
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
7812
|
-
const managed = managedOverridePackages(workspaceUsesVitest);
|
|
7837
|
+
const managed = managedOverridePackages(workspaceUsesVitest, workspaceUsesWebdriverioProvider(projectPath, packages));
|
|
7813
7838
|
let movedPnpmSettings;
|
|
7814
7839
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
7815
7840
|
pruneLegacyWrapperAliases(pkg.resolutions);
|
|
@@ -7829,9 +7854,14 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
|
|
|
7829
7854
|
...pkg.overrides,
|
|
7830
7855
|
...managed
|
|
7831
7856
|
};
|
|
7832
|
-
else if (packageManager === PackageManager.bun)
|
|
7833
|
-
|
|
7834
|
-
|
|
7857
|
+
else if (packageManager === PackageManager.bun) {
|
|
7858
|
+
if (managed["@vitest/browser"]) pkg.overrides = {
|
|
7859
|
+
...pkg.overrides,
|
|
7860
|
+
"@vitest/browser": managed["@vitest/browser"]
|
|
7861
|
+
};
|
|
7862
|
+
setDirectViteEdge(pkg, true, catalogDependencyResolver);
|
|
7863
|
+
} else if (packageManager === PackageManager.pnpm) {
|
|
7864
|
+
const overrideKeys = Object.keys(managedOverridePackages(workspaceUsesVitest));
|
|
7835
7865
|
if (!pnpmSupportsWorkspaceSettings(pnpmVersion ?? "")) {
|
|
7836
7866
|
dropRemovePackageOverrideKeys(pkg.pnpm?.overrides);
|
|
7837
7867
|
if (!workspaceUsesVitest) removeManagedVitestEntry(pkg.pnpm?.overrides, "pnpm-ranged");
|
|
@@ -7862,7 +7892,6 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
|
|
|
7862
7892
|
...pkg.devDependencies,
|
|
7863
7893
|
[VITE_PLUS_NAME]: packageManager === PackageManager.npm || !supportCatalog || VITE_PLUS_VERSION.startsWith("file:") ? VITE_PLUS_VERSION : catalogDependencyResolver?.preferredCatalogSpec ?? "catalog:"
|
|
7864
7894
|
};
|
|
7865
|
-
ensureDirectViteForPnpm(pkg, packageManager, supportCatalog, catalogDependencyResolver);
|
|
7866
7895
|
return pkg;
|
|
7867
7896
|
});
|
|
7868
7897
|
migratePnpmSettingsToWorkspaceYaml(projectPath, movedPnpmSettings);
|
|
@@ -7918,6 +7947,12 @@ function readBunCatalogDependencyResolver(pkg) {
|
|
|
7918
7947
|
//#endregion
|
|
7919
7948
|
//#region src/migration/migrator/yarn.ts
|
|
7920
7949
|
const WEBDRIVERIO_ALLOW_SIGNAL_DEPS = ["webdriverio", WEBDRIVERIO_PROVIDER];
|
|
7950
|
+
function workspaceUsesWebdriverioProvider(rootDir, packages) {
|
|
7951
|
+
return [rootDir, ...(packages ?? []).map((pkg) => path.join(rootDir, pkg.path))].some((dir) => {
|
|
7952
|
+
const pkg = readPackageJsonIfExists(path.join(dir, "package.json"));
|
|
7953
|
+
return Boolean(pkg && findDeclaredSpec(pkg, "@vitest/browser-webdriverio") || usesWebdriverioProvider(dir));
|
|
7954
|
+
});
|
|
7955
|
+
}
|
|
7921
7956
|
function hasOwnWebdriverioDependency(pkg) {
|
|
7922
7957
|
for (const name of WEBDRIVERIO_ALLOW_SIGNAL_DEPS) if (pkg.dependencies?.[name] ?? pkg.devDependencies?.[name] ?? pkg.optionalDependencies?.[name] ?? pkg.peerDependencies?.[name]) return true;
|
|
7923
7958
|
return false;
|
|
@@ -8089,10 +8124,7 @@ const PLAYWRIGHT_PROVIDER_SPECIFIER_HINTS = [
|
|
|
8089
8124
|
"vite-plus/test/browser/providers/playwright",
|
|
8090
8125
|
"vite-plus/test/plugins/browser-playwright"
|
|
8091
8126
|
];
|
|
8092
|
-
const BROWSER_PROVIDER_SPECIFIER_HINTS = {
|
|
8093
|
-
[WEBDRIVERIO_PROVIDER]: WEBDRIVERIO_PROVIDER_SPECIFIER_HINTS,
|
|
8094
|
-
[PLAYWRIGHT_PROVIDER]: PLAYWRIGHT_PROVIDER_SPECIFIER_HINTS
|
|
8095
|
-
};
|
|
8127
|
+
const BROWSER_PROVIDER_SPECIFIER_HINTS = { [PLAYWRIGHT_PROVIDER]: PLAYWRIGHT_PROVIDER_SPECIFIER_HINTS };
|
|
8096
8128
|
const VITEST_SCAN_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
8097
8129
|
".ts",
|
|
8098
8130
|
".mts",
|
|
@@ -8114,7 +8146,8 @@ const VITEST_SCAN_SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
|
8114
8146
|
".nuxt",
|
|
8115
8147
|
".svelte-kit",
|
|
8116
8148
|
".vite",
|
|
8117
|
-
".cache"
|
|
8149
|
+
".cache",
|
|
8150
|
+
".yarn"
|
|
8118
8151
|
]);
|
|
8119
8152
|
const OXLINT_RETENTION_SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
8120
8153
|
"node_modules",
|
|
@@ -8161,10 +8194,11 @@ function sourceTreeMatches(projectPath, matchesContent, options = {}) {
|
|
|
8161
8194
|
if (entry.isDirectory()) {
|
|
8162
8195
|
if (skipDirs.has(entry.name)) continue;
|
|
8163
8196
|
if (scanDir(entryPath, false)) return true;
|
|
8164
|
-
} else if (entry.isFile() && (VITEST_SCAN_EXTENSIONS.has(path.extname(entry.name)) || options.includePackageReferences && entry.name === "package.json")) try {
|
|
8197
|
+
} else if (entry.isFile() && ![".pnp.cjs", ".pnp.loader.mjs"].includes(entry.name) && (VITEST_SCAN_EXTENSIONS.has(path.extname(entry.name)) || options.includeExtensionless && path.extname(entry.name) === "" || options.includePackageReferences && entry.name === "package.json")) try {
|
|
8165
8198
|
let content = fs.readFileSync(entryPath, "utf8");
|
|
8166
8199
|
if (entry.name === "package.json") {
|
|
8167
8200
|
const pkg = JSON.parse(content);
|
|
8201
|
+
if (options.matchesPackage?.(dir, pkg)) return true;
|
|
8168
8202
|
content = JSON.stringify({
|
|
8169
8203
|
imports: pkg.imports,
|
|
8170
8204
|
scripts: pkg.scripts
|
|
@@ -8224,37 +8258,81 @@ function collectProviderSourceModes(projectPath) {
|
|
|
8224
8258
|
return modes;
|
|
8225
8259
|
}
|
|
8226
8260
|
/**
|
|
8227
|
-
* Check final source, build output,
|
|
8261
|
+
* Check final source, build output, aliases, scripts, and dependency peers.
|
|
8228
8262
|
* A substring scan conservatively retains references the rewriter leaves alone,
|
|
8229
8263
|
* including require calls, type references, and strings.
|
|
8230
8264
|
*/
|
|
8231
|
-
function sourceTreeReferencesOxlintPluginsPackage(projectPath) {
|
|
8265
|
+
function sourceTreeReferencesOxlintPluginsPackage(projectPath, originalDependencies = collectOxlintDependencyNames(projectPath)) {
|
|
8232
8266
|
return sourceTreeMatches(projectPath, (content) => content.includes(OXLINT_PLUGINS_PACKAGE), {
|
|
8233
8267
|
crossPackageBoundaries: true,
|
|
8234
8268
|
includePackageReferences: true,
|
|
8269
|
+
includeExtensionless: true,
|
|
8270
|
+
matchesPackage: (dir, pkg) => projectListsRequiredOxlintPluginsPeer(dir, pkg, {
|
|
8271
|
+
retainUnknownPeers: originalDependencies.has(dir),
|
|
8272
|
+
originalDependencyNames: originalDependencies.get(dir)
|
|
8273
|
+
}),
|
|
8235
8274
|
skipDirs: OXLINT_RETENTION_SKIP_DIRS
|
|
8236
8275
|
});
|
|
8237
8276
|
}
|
|
8277
|
+
function projectListsRequiredOxlintPluginsPeer(projectPath, pkg, { retainUnknownPeers = true, originalDependencyNames } = {}) {
|
|
8278
|
+
const dependencyNames = collectInstallDependencyNames(pkg);
|
|
8279
|
+
dependencyNames.delete(OXLINT_PLUGINS_PACKAGE);
|
|
8280
|
+
dependencyNames.delete(VITE_PLUS_NAME);
|
|
8281
|
+
dependencyNames.delete("vite");
|
|
8282
|
+
for (const name of dependencyNames) {
|
|
8283
|
+
if (originalDependencyNames && !originalDependencyNames.has(name)) continue;
|
|
8284
|
+
const metadata = detectPackageMetadata(projectPath, name);
|
|
8285
|
+
if (!metadata) {
|
|
8286
|
+
if (retainUnknownPeers) return true;
|
|
8287
|
+
continue;
|
|
8288
|
+
}
|
|
8289
|
+
try {
|
|
8290
|
+
const installedPkg = readJsonFile(path.join(metadata.path, "package.json"));
|
|
8291
|
+
if (typeof installedPkg.peerDependencies?.["@oxlint/plugins"] === "string" && installedPkg.peerDependenciesMeta?.["@oxlint/plugins"]?.optional !== true) return true;
|
|
8292
|
+
} catch {
|
|
8293
|
+
if (retainUnknownPeers) return true;
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
return false;
|
|
8297
|
+
}
|
|
8298
|
+
function collectInstallDependencyNames(pkg) {
|
|
8299
|
+
return /* @__PURE__ */ new Set([
|
|
8300
|
+
...Object.keys(pkg?.dependencies ?? {}),
|
|
8301
|
+
...Object.keys(pkg?.devDependencies ?? {}),
|
|
8302
|
+
...Object.keys(pkg?.optionalDependencies ?? {})
|
|
8303
|
+
]);
|
|
8304
|
+
}
|
|
8305
|
+
function collectOxlintDependencyNames(rootDir, packages) {
|
|
8306
|
+
const names = /* @__PURE__ */ new Map();
|
|
8307
|
+
for (const dir of [rootDir, ...(packages ?? []).map((pkg) => path.join(rootDir, pkg.path))]) {
|
|
8308
|
+
const pkg = readPackageJsonIfExists(path.join(dir, "package.json"));
|
|
8309
|
+
names.set(dir, collectInstallDependencyNames(pkg));
|
|
8310
|
+
}
|
|
8311
|
+
return names;
|
|
8312
|
+
}
|
|
8238
8313
|
/**
|
|
8239
8314
|
* Drop `@oxlint/plugins` from devDependencies once nothing names it any more.
|
|
8240
8315
|
*
|
|
8241
8316
|
* Runs AFTER the import rewrite, so the scan sees final source. Skips a package
|
|
8242
8317
|
* that owns the API as a runtime or peer dependency, and skips any package
|
|
8243
|
-
* whose source
|
|
8318
|
+
* whose source, build output, or installed dependencies still require it.
|
|
8244
8319
|
*/
|
|
8245
|
-
function dropDeadOxlintPluginsDependency(rootDir, packages) {
|
|
8320
|
+
function dropDeadOxlintPluginsDependency(rootDir, packages, originalDependencies = collectOxlintDependencyNames(rootDir, packages)) {
|
|
8321
|
+
let changed = false;
|
|
8246
8322
|
const dirs = [rootDir, ...(packages ?? []).map((pkg) => path.join(rootDir, pkg.path))];
|
|
8247
8323
|
for (const dir of dirs) {
|
|
8248
8324
|
const packageJsonPath = path.join(dir, "package.json");
|
|
8249
8325
|
const pkg = readPackageJsonIfExists(packageJsonPath);
|
|
8250
8326
|
if (pkg?.devDependencies?.["@oxlint/plugins"] === void 0) continue;
|
|
8251
|
-
if (packageOwnsOxlintApi(pkg) || sourceTreeReferencesOxlintPluginsPackage(dir)) continue;
|
|
8327
|
+
if (packageOwnsOxlintApi(pkg) || sourceTreeReferencesOxlintPluginsPackage(dir, originalDependencies)) continue;
|
|
8252
8328
|
editJsonFile(packageJsonPath, (json) => {
|
|
8253
8329
|
if (json.devDependencies?.["@oxlint/plugins"] === void 0) return;
|
|
8254
8330
|
delete json.devDependencies[OXLINT_PLUGINS_PACKAGE];
|
|
8331
|
+
changed = true;
|
|
8255
8332
|
return json;
|
|
8256
8333
|
});
|
|
8257
8334
|
}
|
|
8335
|
+
return changed;
|
|
8258
8336
|
}
|
|
8259
8337
|
//#endregion
|
|
8260
8338
|
//#region src/migration/migrator/vite-plus-bootstrap.ts
|
|
@@ -8267,6 +8345,7 @@ function isSemanticVitePlusOverrideSpec(dependencyName, spec) {
|
|
|
8267
8345
|
if (!spec) return false;
|
|
8268
8346
|
if (isLegacyWrapperSpec(spec)) return false;
|
|
8269
8347
|
if (spec === VITE_PLUS_OVERRIDE_PACKAGES[dependencyName]) return true;
|
|
8348
|
+
if (dependencyName === "@vitest/browser" && spec === "5.0.1") return true;
|
|
8270
8349
|
return false;
|
|
8271
8350
|
}
|
|
8272
8351
|
function overrideSpecSatisfiesVitePlus(dependencyName, spec, catalogDependencyResolver) {
|
|
@@ -8275,8 +8354,8 @@ function overrideSpecSatisfiesVitePlus(dependencyName, spec, catalogDependencyRe
|
|
|
8275
8354
|
if (!spec.startsWith("catalog:")) return false;
|
|
8276
8355
|
return isSemanticVitePlusOverrideSpec(dependencyName, catalogDependencyResolver?.(spec, dependencyName));
|
|
8277
8356
|
}
|
|
8278
|
-
function overridesSatisfyVitePlus(overrides, usesVitest, catalogDependencyResolver, keyStyle = "bare") {
|
|
8279
|
-
const managed = managedOverridePackages(usesVitest);
|
|
8357
|
+
function overridesSatisfyVitePlus(overrides, usesVitest, catalogDependencyResolver, keyStyle = "bare", usesWebdriverioProvider = false) {
|
|
8358
|
+
const managed = managedOverridePackages(usesVitest, usesWebdriverioProvider);
|
|
8280
8359
|
if (!usesVitest && VITEST_IS_MANAGED_OVERRIDE && (typeof overrides?.vitest === "string" || keyStyle === "pnpm-ranged" && typeof overrides?.[pnpmOverrideKey("vitest")] === "string")) return false;
|
|
8281
8360
|
if (keyStyle === "pnpm-ranged" && Object.keys(managed).some((dependencyName) => typeof overrides?.[dependencyName] === "string")) return false;
|
|
8282
8361
|
return Object.keys(managed).every((dependencyName) => overrideSpecSatisfiesVitePlus(dependencyName, overrides?.[managedOverrideKey(dependencyName, keyStyle)], catalogDependencyResolver));
|
|
@@ -8398,7 +8477,7 @@ function reconcileVitePlusBootstrapPackage(projectPath, pkg, vitePlusVersion, pa
|
|
|
8398
8477
|
const frameworkPeer = BROWSER_PROVIDER_PEER_DEPS[provider];
|
|
8399
8478
|
if (!hasProviderPeerDependency(pkg, frameworkPeer)) {
|
|
8400
8479
|
pkg.devDependencies ??= {};
|
|
8401
|
-
pkg.devDependencies[frameworkPeer] = resolveProviderPeerSpec(
|
|
8480
|
+
pkg.devDependencies[frameworkPeer] = resolveProviderPeerSpec(frameworkPeer, supportCatalog, catalogDependencyResolver);
|
|
8402
8481
|
}
|
|
8403
8482
|
}
|
|
8404
8483
|
for (const bundledPackage of REMOVE_PACKAGES) for (const dependencies of installGroups) if (dependencies?.[bundledPackage] !== void 0) delete dependencies[bundledPackage];
|
|
@@ -8419,7 +8498,6 @@ function reconcileVitePlusBootstrapPackage(projectPath, pkg, vitePlusVersion, pa
|
|
|
8419
8498
|
pkg.devDependencies.vitest = getCatalogDependencySpec(void 0, VITEST_VERSION, supportCatalog, { preferredCatalogSpec: catalogDependencyResolver?.preferredCatalogSpec });
|
|
8420
8499
|
}
|
|
8421
8500
|
} else for (const dependencies of installGroups) removeManagedVitestEntry(dependencies);
|
|
8422
|
-
ensureDirectViteForPnpm(pkg, packageManager, supportCatalog, catalogDependencyResolver);
|
|
8423
8501
|
return before !== JSON.stringify(pkg);
|
|
8424
8502
|
}
|
|
8425
8503
|
function bootstrapProjectPaths(rootDir, packages) {
|
|
@@ -8493,17 +8571,18 @@ function detectVitePlusBootstrapPending(projectPath, packageManager, packages, p
|
|
|
8493
8571
|
if (reconcileVitePlusBootstrapPackage(packagePath, JSON.parse(JSON.stringify(childPkg)), canonicalVitePlusSpec, packageManager, supportCatalog, index === 0, catalogDependencyResolver, providerCatalogAdditions)) return true;
|
|
8494
8572
|
}
|
|
8495
8573
|
const usesVitest = workspaceUsesVitestDirectly(projectPath, packages, true);
|
|
8496
|
-
|
|
8497
|
-
if (packageManager === PackageManager.
|
|
8498
|
-
if (packageManager === PackageManager.
|
|
8574
|
+
const usesWebdriverio = workspaceUsesWebdriverioProvider(projectPath, packages);
|
|
8575
|
+
if (packageManager === PackageManager.yarn) return !overridesSatisfyVitePlus(pkg.resolutions, usesVitest, void 0, "bare", usesWebdriverio) || !yarnrcSatisfiesVitePlus(projectPath, usesVitest, supportCatalog) || yarnWorkspaceHoistingOptOutPending(projectPath, packageManager, packages);
|
|
8576
|
+
if (packageManager === PackageManager.npm) return vitePlusDependencyNeedsConcreteVersion(pkg) || !overridesSatisfyVitePlus(pkg.overrides, usesVitest, void 0, "bare", usesWebdriverio) || npmVitePlusManagedDependenciesPending(pkg, usesVitest);
|
|
8577
|
+
if (packageManager === PackageManager.bun) return !overridesSatisfyVitePlus(pkg.overrides, usesVitest, supportCatalog ? readBunCatalogDependencyResolver(pkg) : void 0, "bare", usesWebdriverio);
|
|
8499
8578
|
if (packageManager === PackageManager.pnpm) {
|
|
8500
8579
|
if (!pnpmWorkspaceExoticSubdepsSettingSatisfied(projectPath)) return true;
|
|
8501
8580
|
if (!usePnpmWorkspaceYaml) {
|
|
8502
|
-
if (supportCatalog) return catalogVitePlusDependencyPending(pkg, catalogDependencyResolver) || !overridesSatisfyVitePlus(pkg.pnpm?.overrides, usesVitest, catalogDependencyResolver, "pnpm-ranged") || !pnpmPeerDependencyRulesSatisfyVitePlus(pkg.pnpm?.peerDependencyRules, usesVitest);
|
|
8503
|
-
return vitePlusDependencyNeedsConcreteVersion(pkg) || !overridesSatisfyVitePlus(pkg.pnpm?.overrides, usesVitest, void 0, "pnpm-ranged") || !pnpmPeerDependencyRulesSatisfyVitePlus(pkg.pnpm?.peerDependencyRules, usesVitest);
|
|
8581
|
+
if (supportCatalog) return catalogVitePlusDependencyPending(pkg, catalogDependencyResolver) || !overridesSatisfyVitePlus(pkg.pnpm?.overrides, usesVitest, catalogDependencyResolver, "pnpm-ranged", usesWebdriverio) || !pnpmPeerDependencyRulesSatisfyVitePlus(pkg.pnpm?.peerDependencyRules, usesVitest);
|
|
8582
|
+
return vitePlusDependencyNeedsConcreteVersion(pkg) || !overridesSatisfyVitePlus(pkg.pnpm?.overrides, usesVitest, void 0, "pnpm-ranged", usesWebdriverio) || !pnpmPeerDependencyRulesSatisfyVitePlus(pkg.pnpm?.peerDependencyRules, usesVitest);
|
|
8504
8583
|
}
|
|
8505
8584
|
const resolver = readPnpmWorkspaceCatalogDependencyResolver(projectPath);
|
|
8506
|
-
return workspaceCatalogVitePlusDependencyPending(projectPath, packages, resolver) || !overridesSatisfyVitePlus(readPnpmWorkspaceOverrides(projectPath), usesVitest, resolver, "pnpm-ranged") || !pnpmPeerDependencyRulesSatisfyVitePlus(readPnpmWorkspacePeerDependencyRules(projectPath), usesVitest) || pnpmWorkspaceMinimumReleaseAgeExemptionsPending(projectPath);
|
|
8585
|
+
return workspaceCatalogVitePlusDependencyPending(projectPath, packages, resolver) || !overridesSatisfyVitePlus(readPnpmWorkspaceOverrides(projectPath), usesVitest, resolver, "pnpm-ranged", usesWebdriverio) || !pnpmPeerDependencyRulesSatisfyVitePlus(readPnpmWorkspacePeerDependencyRules(projectPath), usesVitest) || pnpmWorkspaceMinimumReleaseAgeExemptionsPending(projectPath);
|
|
8507
8586
|
}
|
|
8508
8587
|
return false;
|
|
8509
8588
|
}
|
|
@@ -8542,11 +8621,11 @@ function ensureVitePlusDependencySpecs(pkg, version, ensurePresent = true) {
|
|
|
8542
8621
|
function readTextFileIfExists(filePath) {
|
|
8543
8622
|
return fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf-8") : void 0;
|
|
8544
8623
|
}
|
|
8545
|
-
function ensureOverrideEntries(overrides, usesVitest, catalogDependencyResolver, keyStyle = "bare") {
|
|
8624
|
+
function ensureOverrideEntries(overrides, usesVitest, catalogDependencyResolver, keyStyle = "bare", usesWebdriverioProvider = false) {
|
|
8546
8625
|
const next = { ...overrides };
|
|
8547
8626
|
let changed = false;
|
|
8548
8627
|
if (!usesVitest && removeManagedVitestEntry(next, keyStyle)) changed = true;
|
|
8549
|
-
for (const [dependencyName, overrideSpec] of Object.entries(managedOverridePackages(usesVitest))) {
|
|
8628
|
+
for (const [dependencyName, overrideSpec] of Object.entries(managedOverridePackages(usesVitest, usesWebdriverioProvider))) {
|
|
8550
8629
|
const overrideKey = managedOverrideKey(dependencyName, keyStyle);
|
|
8551
8630
|
if (overrideKey !== dependencyName && next[dependencyName] !== void 0) {
|
|
8552
8631
|
next[overrideKey] ??= next[dependencyName];
|
|
@@ -8597,6 +8676,7 @@ function ensureVitePlusBootstrap(workspaceInfo, report) {
|
|
|
8597
8676
|
};
|
|
8598
8677
|
if (!fs.existsSync(packageJsonPath)) return result;
|
|
8599
8678
|
const usesVitest = workspaceUsesVitestDirectly(projectPath, workspaceInfo.packages, true);
|
|
8679
|
+
const usesWebdriverio = workspaceUsesWebdriverioProvider(projectPath, workspaceInfo.packages);
|
|
8600
8680
|
const pnpmMajorVersion = pnpmMajor(workspaceInfo.downloadPackageManager.version);
|
|
8601
8681
|
const shouldAllowBrowserBuilds = workspaceUsesWebdriverio(projectPath, workspaceInfo.packages);
|
|
8602
8682
|
const usePnpmWorkspaceYaml = workspaceInfo.packageManager === PackageManager.pnpm && pnpmSupportsWorkspaceSettings(workspaceInfo.downloadPackageManager.version);
|
|
@@ -8612,31 +8692,31 @@ function ensureVitePlusBootstrap(workspaceInfo, report) {
|
|
|
8612
8692
|
let pnpmWorkspaceCatalogBefore;
|
|
8613
8693
|
if (workspaceInfo.packageManager === PackageManager.pnpm && !usePnpmWorkspaceYaml) {
|
|
8614
8694
|
pnpmWorkspaceCatalogBefore = readTextFileIfExists(pnpmWorkspaceYamlPath);
|
|
8615
|
-
if (supportCatalog) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, false, providerCatalogAdditions);
|
|
8695
|
+
if (supportCatalog) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, false, providerCatalogAdditions, usesWebdriverio);
|
|
8616
8696
|
}
|
|
8617
8697
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
8618
8698
|
let packageJsonChanged = reconcileVitePlusBootstrapPackage(projectPath, pkg, canonicalVitePlusSpec, workspaceInfo.packageManager, supportCatalog, true, catalogDependencyResolver, providerCatalogAdditions);
|
|
8619
8699
|
if (workspaceInfo.packageManager === PackageManager.yarn) {
|
|
8620
|
-
const ensured = ensureOverrideEntries(pkg.resolutions, usesVitest);
|
|
8700
|
+
const ensured = ensureOverrideEntries(pkg.resolutions, usesVitest, void 0, "bare", usesWebdriverio);
|
|
8621
8701
|
if (ensured.changed) {
|
|
8622
8702
|
pkg.resolutions = ensured.overrides;
|
|
8623
8703
|
packageJsonChanged = true;
|
|
8624
8704
|
}
|
|
8625
8705
|
} else if (workspaceInfo.packageManager === PackageManager.npm) {
|
|
8626
|
-
const ensured = ensureOverrideEntries(pkg.overrides, usesVitest);
|
|
8706
|
+
const ensured = ensureOverrideEntries(pkg.overrides, usesVitest, void 0, "bare", usesWebdriverio);
|
|
8627
8707
|
if (ensured.changed) {
|
|
8628
8708
|
pkg.overrides = ensured.overrides;
|
|
8629
8709
|
packageJsonChanged = true;
|
|
8630
8710
|
}
|
|
8631
8711
|
} else if (workspaceInfo.packageManager === PackageManager.bun) {
|
|
8632
|
-
const ensured = ensureOverrideEntries(pkg.overrides, usesVitest, supportCatalog ? readBunCatalogDependencyResolver(pkg) : void 0);
|
|
8712
|
+
const ensured = ensureOverrideEntries(pkg.overrides, usesVitest, supportCatalog ? readBunCatalogDependencyResolver(pkg) : void 0, "bare", usesWebdriverio);
|
|
8633
8713
|
if (ensured.changed) {
|
|
8634
8714
|
pkg.overrides = ensured.overrides;
|
|
8635
8715
|
packageJsonChanged = true;
|
|
8636
8716
|
}
|
|
8637
8717
|
} else if (workspaceInfo.packageManager === PackageManager.pnpm && !usePnpmWorkspaceYaml) {
|
|
8638
8718
|
pkg.pnpm ??= {};
|
|
8639
|
-
const ensured = ensureOverrideEntries(pkg.pnpm.overrides, usesVitest, supportCatalog ? readPnpmWorkspaceCatalogDependencyResolver(projectPath) : void 0, "pnpm-ranged");
|
|
8719
|
+
const ensured = ensureOverrideEntries(pkg.pnpm.overrides, usesVitest, supportCatalog ? readPnpmWorkspaceCatalogDependencyResolver(projectPath) : void 0, "pnpm-ranged", usesWebdriverio);
|
|
8640
8720
|
if (ensured.changed) {
|
|
8641
8721
|
pkg.pnpm.overrides = ensured.overrides;
|
|
8642
8722
|
packageJsonChanged = true;
|
|
@@ -8675,7 +8755,7 @@ function ensureVitePlusBootstrap(workspaceInfo, report) {
|
|
|
8675
8755
|
const before = readTextFileIfExists(pnpmWorkspaceYamlPath);
|
|
8676
8756
|
migratePnpmSettingsToWorkspaceYaml(projectPath, movedPnpmSettings);
|
|
8677
8757
|
const catalogDependencyResolver = readPnpmWorkspaceCatalogDependencyResolver(projectPath);
|
|
8678
|
-
if (movedPnpmSettings !== void 0 || result.packageJson || ecosystemCatalogReferencesPending || !pnpmWorkspaceExoticSubdepsSettingSatisfied(projectPath) || pnpmWorkspaceMinimumReleaseAgeExemptionsPending(projectPath) || workspaceCatalogVitePlusDependencyPending(projectPath, workspaceInfo.packages, catalogDependencyResolver) || !overridesSatisfyVitePlus(readPnpmWorkspaceOverrides(projectPath), usesVitest, catalogDependencyResolver, "pnpm-ranged") || !pnpmPeerDependencyRulesSatisfyVitePlus(readPnpmWorkspacePeerDependencyRules(projectPath), usesVitest)) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, true, providerCatalogAdditions);
|
|
8758
|
+
if (movedPnpmSettings !== void 0 || result.packageJson || ecosystemCatalogReferencesPending || !pnpmWorkspaceExoticSubdepsSettingSatisfied(projectPath) || pnpmWorkspaceMinimumReleaseAgeExemptionsPending(projectPath) || workspaceCatalogVitePlusDependencyPending(projectPath, workspaceInfo.packages, catalogDependencyResolver) || !overridesSatisfyVitePlus(readPnpmWorkspaceOverrides(projectPath), usesVitest, catalogDependencyResolver, "pnpm-ranged", usesWebdriverio) || !pnpmPeerDependencyRulesSatisfyVitePlus(readPnpmWorkspacePeerDependencyRules(projectPath), usesVitest)) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserBuilds, usesVitest, vitestEcosystemPackages, true, providerCatalogAdditions, usesWebdriverio);
|
|
8679
8759
|
if (fs.existsSync(pnpmWorkspaceYamlPath)) ensurePnpmWorkspacePackages(projectPath, workspaceInfo.workspacePatterns);
|
|
8680
8760
|
result.packageManagerConfig = before !== readTextFileIfExists(pnpmWorkspaceYamlPath);
|
|
8681
8761
|
} else {
|
|
@@ -8691,7 +8771,7 @@ function ensureVitePlusBootstrap(workspaceInfo, report) {
|
|
|
8691
8771
|
result.packageManagerConfig = before !== fs.readFileSync(yarnrcYmlPath, "utf-8");
|
|
8692
8772
|
} else if (isBunWorkspace) {
|
|
8693
8773
|
const before = fs.readFileSync(packageJsonPath, "utf-8");
|
|
8694
|
-
rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages);
|
|
8774
|
+
rewriteBunCatalog(projectPath, usesVitest, vitestEcosystemPackages, usesWebdriverio);
|
|
8695
8775
|
const after = fs.readFileSync(packageJsonPath, "utf-8");
|
|
8696
8776
|
result.packageJson = result.packageJson || before !== after;
|
|
8697
8777
|
}
|
|
@@ -8890,7 +8970,7 @@ function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration
|
|
|
8890
8970
|
const peer = BROWSER_PROVIDER_PEER_DEPS[provider];
|
|
8891
8971
|
if (!hasProviderPeerDependency(pkg, peer)) {
|
|
8892
8972
|
pkg.devDependencies ??= {};
|
|
8893
|
-
pkg.devDependencies[peer] = resolveProviderPeerSpec(
|
|
8973
|
+
pkg.devDependencies[peer] = resolveProviderPeerSpec(peer, supportCatalog, catalogDependencyResolver);
|
|
8894
8974
|
}
|
|
8895
8975
|
needVitePlus = true;
|
|
8896
8976
|
}
|
|
@@ -8922,7 +9002,6 @@ function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration
|
|
|
8922
9002
|
...pkg.devDependencies,
|
|
8923
9003
|
[VITE_PLUS_NAME]: canonicalVitePlusSpec
|
|
8924
9004
|
};
|
|
8925
|
-
ensureDirectViteForPnpm(pkg, packageManager, supportCatalog, catalogDependencyResolver);
|
|
8926
9005
|
if (needDirectVitest) {
|
|
8927
9006
|
if (!{
|
|
8928
9007
|
...pkg.dependencies,
|
|
@@ -8990,7 +9069,7 @@ function rewriteLintStagedConfigFile(projectPath, report) {
|
|
|
8990
9069
|
warnMigration(`${displayRelative(configPath)} — please migrate to "staged" in vite.config.ts manually`, report);
|
|
8991
9070
|
hasUnsupported = true;
|
|
8992
9071
|
}
|
|
8993
|
-
if (hasUnsupported) infoMigration(
|
|
9072
|
+
if (hasUnsupported) infoMigration(`Only "staged" in vite.config.ts is supported. See ${documentationUrl$1("/guide/migrate#lint-staged")}`, report);
|
|
8994
9073
|
}
|
|
8995
9074
|
/**
|
|
8996
9075
|
* Ensure vite.config.ts exists, create it if not
|
|
@@ -9028,7 +9107,7 @@ function mergeTsdownConfigFile(projectPath, silent = false, report) {
|
|
|
9028
9107
|
const tsdownRelativePath = `./${configs.tsdownConfig}`;
|
|
9029
9108
|
if (hasConfigKey(fullViteConfigPath, "pack")) {
|
|
9030
9109
|
const viteConfigContent = fs.readFileSync(fullViteConfigPath, "utf8");
|
|
9031
|
-
if (![tsdownRelativePath, tsdownRelativePath.replace(/\.mts$/, ".mjs").replace(/\.cts$/, ".cjs").replace(/\.ts$/, ".js")].some((importPath) => viteConfigContent.includes(`from '${importPath}'`) || viteConfigContent.includes(`from "${importPath}"`))) infoMigration(`Please manually merge ${displayRelative(fullTsdownConfigPath)} into ${displayRelative(fullViteConfigPath)}, see
|
|
9110
|
+
if (![tsdownRelativePath, tsdownRelativePath.replace(/\.mts$/, ".mjs").replace(/\.cts$/, ".cjs").replace(/\.ts$/, ".js")].some((importPath) => viteConfigContent.includes(`from '${importPath}'`) || viteConfigContent.includes(`from "${importPath}"`))) infoMigration(`Please manually merge ${displayRelative(fullTsdownConfigPath)} into ${displayRelative(fullViteConfigPath)}, see ${documentationUrl$1("/guide/migrate#tsdown")}`, report);
|
|
9032
9111
|
return false;
|
|
9033
9112
|
}
|
|
9034
9113
|
const result = mergeTsdownConfig(fullViteConfigPath, tsdownRelativePath);
|
|
@@ -9037,7 +9116,7 @@ function mergeTsdownConfigFile(projectPath, silent = false, report) {
|
|
|
9037
9116
|
if (report) report.tsdownImportCount++;
|
|
9038
9117
|
if (!silent) log.success(`✔ Added import for ${displayRelative(fullTsdownConfigPath)} in ${displayRelative(fullViteConfigPath)}`);
|
|
9039
9118
|
}
|
|
9040
|
-
infoMigration(`Please manually merge ${displayRelative(fullTsdownConfigPath)} into ${displayRelative(fullViteConfigPath)}, see
|
|
9119
|
+
infoMigration(`Please manually merge ${displayRelative(fullTsdownConfigPath)} into ${displayRelative(fullViteConfigPath)}, see ${documentationUrl$1("/guide/migrate#tsdown")}`, report);
|
|
9041
9120
|
return createdViteConfig || result.updated;
|
|
9042
9121
|
}
|
|
9043
9122
|
/**
|
|
@@ -9121,7 +9200,7 @@ function mergeAndRemoveJsonConfig(projectPath, viteConfigPath, jsonConfigPath, c
|
|
|
9121
9200
|
if (!silent) log.success(`✔ Merged ${displayRelative(fullJsonConfigPath)} into ${displayRelative(fullViteConfigPath)}`);
|
|
9122
9201
|
} else {
|
|
9123
9202
|
warnMigration(`Failed to merge ${displayRelative(fullJsonConfigPath)} into ${displayRelative(fullViteConfigPath)}`, report);
|
|
9124
|
-
infoMigration(
|
|
9203
|
+
infoMigration(`Please complete the merge manually and follow the instructions in the documentation: ${documentationUrl$1("/config/")}`, report);
|
|
9125
9204
|
}
|
|
9126
9205
|
}
|
|
9127
9206
|
/**
|
|
@@ -9146,7 +9225,7 @@ function mergeStagedConfigToViteConfig(projectPath, stagedConfig, silent = false
|
|
|
9146
9225
|
return true;
|
|
9147
9226
|
} else {
|
|
9148
9227
|
warnMigration(`Failed to merge staged config into ${displayRelative(fullViteConfigPath)}`, report);
|
|
9149
|
-
infoMigration(`Please add staged config to ${displayRelative(fullViteConfigPath)} manually, see
|
|
9228
|
+
infoMigration(`Please add staged config to ${displayRelative(fullViteConfigPath)} manually, see ${documentationUrl$1("/guide/migrate#lint-staged")}`, report);
|
|
9150
9229
|
return false;
|
|
9151
9230
|
}
|
|
9152
9231
|
}
|
|
@@ -9207,37 +9286,6 @@ function rewriteAllImports(projectPath, silent = false, report, preserveNuxtVite
|
|
|
9207
9286
|
return modified > 0;
|
|
9208
9287
|
}
|
|
9209
9288
|
//#endregion
|
|
9210
|
-
//#region src/utils/git.ts
|
|
9211
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
9212
|
-
/**
|
|
9213
|
-
* Walk up from `startPath` looking for `.git` (directory or file — submodules
|
|
9214
|
-
* use a `.git` file). Returns the directory that contains `.git`, or `null`.
|
|
9215
|
-
*/
|
|
9216
|
-
function findGitRoot(startPath) {
|
|
9217
|
-
let dir = startPath;
|
|
9218
|
-
while (true) {
|
|
9219
|
-
if (fs.existsSync(path.join(dir, ".git"))) return dir;
|
|
9220
|
-
const parent = path.dirname(dir);
|
|
9221
|
-
if (parent === dir) return null;
|
|
9222
|
-
dir = parent;
|
|
9223
|
-
}
|
|
9224
|
-
}
|
|
9225
|
-
async function initGitRepository(cwd) {
|
|
9226
|
-
const result = await runCommandSilently({
|
|
9227
|
-
command: "git",
|
|
9228
|
-
args: ["init"],
|
|
9229
|
-
cwd,
|
|
9230
|
-
envs: process.env
|
|
9231
|
-
});
|
|
9232
|
-
if (result.exitCode !== 0) {
|
|
9233
|
-
log.warn("Failed to initialize git repository");
|
|
9234
|
-
const stderr = result.stderr.toString().trim();
|
|
9235
|
-
if (stderr) log.info(stderr);
|
|
9236
|
-
return false;
|
|
9237
|
-
}
|
|
9238
|
-
return true;
|
|
9239
|
-
}
|
|
9240
|
-
//#endregion
|
|
9241
9289
|
//#region src/migration/migrator/git-hooks.ts
|
|
9242
9290
|
const OTHER_HOOK_TOOLS = [
|
|
9243
9291
|
"simple-git-hooks",
|
|
@@ -9334,7 +9382,7 @@ function preflightGitHooksSetup(projectPath, _packageManager, packages = []) {
|
|
|
9334
9382
|
const configuredHooksPath = gitRoot ? getConfiguredHooksPath(projectPath) : "";
|
|
9335
9383
|
const normalizedHooksPath = normalizeGitHooksPath(configuredHooksPath);
|
|
9336
9384
|
if (hasHuskySetup(projectPath, pkgContent) || normalizedHooksPath === ".husky" || normalizedHooksPath.startsWith(".husky/")) return "Detected Husky — leaving its hooks, configuration, and dependencies unchanged. Migrate Husky manually before enabling Vite+ hooks.";
|
|
9337
|
-
for (const tool of OTHER_HOOK_TOOLS) if (deps?.[tool] || prodDeps?.[tool] || pkgContent[tool]) return `Detected ${tool} — skipping git hooks setup. Please configure git hooks manually, see
|
|
9385
|
+
for (const tool of OTHER_HOOK_TOOLS) if (deps?.[tool] || prodDeps?.[tool] || pkgContent[tool]) return `Detected ${tool} — skipping git hooks setup. Please configure git hooks manually, see ${documentationUrl$1("/guide/migrate#git-hook-tools")}`;
|
|
9338
9386
|
const workspacePackageReason = findWorkspacePackageHookPolicy(projectPath, packages);
|
|
9339
9387
|
if (workspacePackageReason) return workspacePackageReason;
|
|
9340
9388
|
const disabledHooksEnvironment = [
|
|
@@ -9687,6 +9735,7 @@ function detectPendingCoreMigration(workspaceInfo) {
|
|
|
9687
9735
|
function finalizeCoreMigrationForExistingVitePlus(workspaceInfo, silent = false, report, pending = detectPendingCoreMigration(workspaceInfo)) {
|
|
9688
9736
|
const projectPaths = getCoreMigrationProjectPaths(workspaceInfo);
|
|
9689
9737
|
const result = {
|
|
9738
|
+
dependencies: false,
|
|
9690
9739
|
scripts: false,
|
|
9691
9740
|
tsconfigTypes: false,
|
|
9692
9741
|
imports: false,
|
|
@@ -9695,6 +9744,7 @@ function finalizeCoreMigrationForExistingVitePlus(workspaceInfo, silent = false,
|
|
|
9695
9744
|
if (pending.scripts) for (const projectPath of projectPaths) result.scripts = rewriteCorePackageScripts(projectPath) || result.scripts;
|
|
9696
9745
|
if (pending.tsconfigTypes) for (const projectPath of projectPaths) result.tsconfigTypes = rewriteTsconfigTypes(projectPath, silent, report) || result.tsconfigTypes;
|
|
9697
9746
|
result.imports = rewriteAllImports(workspaceInfo.rootDir, silent, report, true);
|
|
9747
|
+
result.dependencies = dropDeadOxlintPluginsDependency(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9698
9748
|
for (const projectPath of projectPaths) result.tsdownConfig = mergeTsdownConfigFile(projectPath, silent, report) || result.tsdownConfig;
|
|
9699
9749
|
return result;
|
|
9700
9750
|
}
|
|
@@ -9707,7 +9757,9 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9707
9757
|
const catalogDependencyResolver = createCatalogDependencyResolver(projectPath, packageManager);
|
|
9708
9758
|
const vitestEcosystemPackages = collectVitestEcosystemInstallDependencyNames(projectPath);
|
|
9709
9759
|
const oxlintOwnerDirs = collectOxlintOwnerDirs(projectPath, workspaceInfo.packages);
|
|
9760
|
+
const originalOxlintDependencies = collectOxlintDependencyNames(projectPath, workspaceInfo.packages);
|
|
9710
9761
|
const providerSourceModes = collectProviderSourceModes(projectPath);
|
|
9762
|
+
const usesWebdriverio = workspaceUsesWebdriverioProvider(projectPath);
|
|
9711
9763
|
const browserMode = usesVitestBrowserMode(projectPath);
|
|
9712
9764
|
const retainedVitestModule = sourceTreeReferencesRetainedVitestModule(projectPath);
|
|
9713
9765
|
const providerCatalogAdditions = collectInjectedProviderNames(projectPath, void 0, /* @__PURE__ */ new Map([[projectPath, providerSourceModes]]));
|
|
@@ -9726,7 +9778,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9726
9778
|
browserMode,
|
|
9727
9779
|
retainedModule: retainedVitestModule
|
|
9728
9780
|
});
|
|
9729
|
-
const managed = managedOverridePackages(usesVitest);
|
|
9781
|
+
const managed = managedOverridePackages(usesVitest, usesWebdriverio);
|
|
9730
9782
|
pruneLegacyWrapperAliases(pkg.resolutions);
|
|
9731
9783
|
pruneLegacyWrapperAliases(pkg.overrides);
|
|
9732
9784
|
pruneLegacyWrapperAliases(pkg.pnpm?.overrides);
|
|
@@ -9748,7 +9800,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9748
9800
|
if (packageManager === PackageManager.bun) setDirectViteEdge(pkg, supportCatalog, catalogDependencyResolver);
|
|
9749
9801
|
} else if (packageManager === PackageManager.pnpm) {
|
|
9750
9802
|
if (usePnpmWorkspaceYaml) shouldAddPnpmWorkspaceVitePlusOverride = isForceOverrideMode();
|
|
9751
|
-
const overrideKeys = Object.keys(
|
|
9803
|
+
const overrideKeys = Object.keys(managedOverridePackages(usesVitest));
|
|
9752
9804
|
if (!usePnpmWorkspaceYaml) {
|
|
9753
9805
|
dropRemovePackageOverrideKeys(pkg.pnpm?.overrides);
|
|
9754
9806
|
if (!usesVitest) {
|
|
@@ -9785,11 +9837,10 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9785
9837
|
[VITE_PLUS_NAME]: version
|
|
9786
9838
|
};
|
|
9787
9839
|
}
|
|
9788
|
-
ensureDirectViteForPnpm(pkg, packageManager, supportCatalog, catalogDependencyResolver);
|
|
9789
9840
|
return pkg;
|
|
9790
9841
|
});
|
|
9791
9842
|
migratePnpmSettingsToWorkspaceYaml(projectPath, movedPnpmSettings);
|
|
9792
|
-
if (packageManager === PackageManager.pnpm && (usePnpmWorkspaceYaml || supportCatalog)) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserProviderBuilds, usesVitest, vitestEcosystemPackages, usePnpmWorkspaceYaml, providerCatalogAdditions);
|
|
9843
|
+
if (packageManager === PackageManager.pnpm && (usePnpmWorkspaceYaml || supportCatalog)) rewritePnpmWorkspaceYaml(projectPath, pnpmMajorVersion, shouldAllowBrowserProviderBuilds, usesVitest, vitestEcosystemPackages, usePnpmWorkspaceYaml, providerCatalogAdditions, usesWebdriverio);
|
|
9793
9844
|
if (shouldAddPnpmWorkspaceVitePlusOverride) migratePnpmOverridesToWorkspaceYaml(projectPath, { [VITE_PLUS_NAME]: VITE_PLUS_VERSION });
|
|
9794
9845
|
if (packageManager === PackageManager.pnpm) ensurePnpmWorkspaceExoticSubdepsSetting(projectPath);
|
|
9795
9846
|
if (packageManager === PackageManager.yarn) rewriteYarnrcYml(projectPath, usesVitest, vitestEcosystemPackages, providerCatalogAdditions, supportCatalog);
|
|
@@ -9804,7 +9855,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9804
9855
|
injectFmtDefaults(projectPath, silent, report);
|
|
9805
9856
|
mergeTsdownConfigFile(projectPath, silent, report);
|
|
9806
9857
|
rewriteAllImports(projectPath, silent, report, true, oxlintOwnerDirs);
|
|
9807
|
-
dropDeadOxlintPluginsDependency(projectPath, workspaceInfo.packages);
|
|
9858
|
+
dropDeadOxlintPluginsDependency(projectPath, workspaceInfo.packages, originalOxlintDependencies);
|
|
9808
9859
|
wrapLazyPluginsInViteConfig(projectPath, silent, report);
|
|
9809
9860
|
setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
|
|
9810
9861
|
}
|
|
@@ -9815,18 +9866,20 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9815
9866
|
function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, report) {
|
|
9816
9867
|
const catalogDependencyResolver = createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager);
|
|
9817
9868
|
const oxlintOwnerDirs = collectOxlintOwnerDirs(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9869
|
+
const originalOxlintDependencies = collectOxlintDependencyNames(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9818
9870
|
const pnpmMajorVersion = pnpmMajor(workspaceInfo.downloadPackageManager.version);
|
|
9819
9871
|
const usePnpmWorkspaceSettings = pnpmSupportsWorkspaceSettings(workspaceInfo.downloadPackageManager.version);
|
|
9820
9872
|
const workspaceShouldAllowBrowserBuilds = workspaceUsesWebdriverio(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9873
|
+
const usesWebdriverio = workspaceUsesWebdriverioProvider(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9821
9874
|
const workspaceUsesVitest = workspaceUsesVitestDirectly(workspaceInfo.rootDir, workspaceInfo.packages, true);
|
|
9822
9875
|
const vitestEcosystemPackages = collectVitestEcosystemInstallDependencyNames(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9823
9876
|
const providerCatalogAdditions = collectInjectedProviderNames(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9824
9877
|
const supportCatalog = supportsCatalog(workspaceInfo.packageManager, workspaceInfo.downloadPackageManager.version, true);
|
|
9825
9878
|
if (workspaceInfo.packageManager === PackageManager.yarn) rewriteYarnrcYml(workspaceInfo.rootDir, workspaceUsesVitest, vitestEcosystemPackages, providerCatalogAdditions, supportCatalog);
|
|
9826
|
-
else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir, workspaceUsesVitest, vitestEcosystemPackages);
|
|
9879
|
+
else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir, workspaceUsesVitest, vitestEcosystemPackages, usesWebdriverio);
|
|
9827
9880
|
rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration, catalogDependencyResolver, workspaceInfo.packages, pnpmMajorVersion, workspaceInfo.downloadPackageManager.version, workspaceShouldAllowBrowserBuilds, workspaceUsesVitest, supportCatalog);
|
|
9828
9881
|
if (workspaceInfo.packageManager === PackageManager.pnpm) {
|
|
9829
|
-
rewritePnpmWorkspaceYaml(workspaceInfo.rootDir, pnpmMajorVersion, workspaceShouldAllowBrowserBuilds, workspaceUsesVitest, vitestEcosystemPackages, usePnpmWorkspaceSettings, providerCatalogAdditions);
|
|
9882
|
+
rewritePnpmWorkspaceYaml(workspaceInfo.rootDir, pnpmMajorVersion, workspaceShouldAllowBrowserBuilds, workspaceUsesVitest, vitestEcosystemPackages, usePnpmWorkspaceSettings, providerCatalogAdditions, usesWebdriverio);
|
|
9830
9883
|
if (usePnpmWorkspaceSettings && isForceOverrideMode()) migratePnpmOverridesToWorkspaceYaml(workspaceInfo.rootDir, { [VITE_PLUS_NAME]: VITE_PLUS_VERSION });
|
|
9831
9884
|
}
|
|
9832
9885
|
const workspaceContext = {
|
|
@@ -9842,7 +9895,7 @@ function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, rep
|
|
|
9842
9895
|
injectFmtDefaults(workspaceInfo.rootDir, silent, report);
|
|
9843
9896
|
mergeTsdownConfigFile(workspaceInfo.rootDir, silent, report);
|
|
9844
9897
|
rewriteAllImports(workspaceInfo.rootDir, silent, report, true, oxlintOwnerDirs);
|
|
9845
|
-
dropDeadOxlintPluginsDependency(workspaceInfo.rootDir, workspaceInfo.packages);
|
|
9898
|
+
dropDeadOxlintPluginsDependency(workspaceInfo.rootDir, workspaceInfo.packages, originalOxlintDependencies);
|
|
9846
9899
|
wrapLazyPluginsInViteConfig(workspaceInfo.rootDir, silent, report);
|
|
9847
9900
|
for (const pkg of workspaceInfo.packages) wrapLazyPluginsInViteConfig(path.join(workspaceInfo.rootDir, pkg.path), silent, report);
|
|
9848
9901
|
setPackageManager(workspaceInfo.rootDir, workspaceInfo.downloadPackageManager);
|
|
@@ -10237,4 +10290,4 @@ function resolveEditorIds(editors) {
|
|
|
10237
10290
|
return uniqueEditorIds.length === 0 ? void 0 : uniqueEditorIds;
|
|
10238
10291
|
}
|
|
10239
10292
|
//#endregion
|
|
10240
|
-
export {
|
|
10293
|
+
export { confirmEslintMigration as $, createCatalogDependencyResolver as A, addFrameworkShim as B, mergeViteConfigFiles as C, usesWebdriverioProvider as D, ensureVitePlusBootstrap as E, updateWorkspaceConfig as F, migrateTsupToTsdown as G, hasFrameworkShim as H, minimatch as I, confirmPrettierMigration as J, promptTsupMigration as K, findGitRoot as L, detectWorkspace$1 as M, isBingoTemplate as N, configureYarnNodeModulesMode as O, updatePackageJsonWithDeps as P, warnPackageLevelPrettier as Q, initGitRepository as R, mergeTsdownConfigFile as S, detectVitePlusBootstrapPending as T, confirmTsupMigration as U, detectFramework as V, detectTsupProject as W, migratePrettierToOxfmt as X, detectPrettierProject as Y, promptPrettierMigration as Z, installGitHooks as _, selectEditors as a, warnLegacyEslintConfig as at, injectCreateDefaultTemplate as b, rewriteMonorepoProject as c, checkViteVersion as ct, finalizeCoreMigrationForExistingVitePlus as d, detectEslintProject as et, detectNodeVersionManagerFile as f, detectLegacyGitHooksMigrationCandidate as g, setPackageManager as h, selectEditor as i, warnIncompatibleEslintIntegration as it, supportsCatalog as j, detectYarnPnpMode as k, rewriteStandaloneProject as l, checkVitestVersion as lt, migrateSetupVpVersion as m, detectExistingEditors as n, migrateEslintToOxlint as nt, writeEditorConfigs as o, warnPackageLevelEslint as ot, migrateNodeVersionManagerFile as p, warnMissingTsupConfig as q, isJsonLikeFile as r, promptEslintMigration as rt, rewriteMonorepo as s, WEBDRIVERIO_PROVIDER as st, detectEditorConflicts as t, detectIncompatibleEslintIntegration as tt, detectPendingCoreMigration as u, preflightGitHooksSetup as v, collectToolchainVersionChanges as w, injectLintTypeCheckDefaults as x, shouldSkipStagedMigrationForHooks as y, extractOverrideParentSegments as z };
|