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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/cac@7.0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/cac@7.0.1/node_modules/cac/dist/index.js
|
|
2
2
|
function toArr(any) {
|
|
3
3
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
4
4
|
}
|
|
@@ -99,23 +99,23 @@ function findAllBrackets(v) {
|
|
|
99
99
|
}
|
|
100
100
|
function getMriOptions(options) {
|
|
101
101
|
const result = {
|
|
102
|
-
alias:
|
|
102
|
+
alias: Object.create(null),
|
|
103
103
|
boolean: []
|
|
104
104
|
};
|
|
105
105
|
for (const [index, option] of options.entries()) {
|
|
106
106
|
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
|
|
107
|
-
if (option.isBoolean)
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
if (option.isBoolean) {
|
|
108
|
+
if (option.negated) {
|
|
109
|
+
if (!options.some((o, i) => {
|
|
110
|
+
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
|
|
111
|
+
})) result.boolean.push(option.names[0]);
|
|
112
|
+
} else result.boolean.push(option.names[0]);
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
return result;
|
|
114
116
|
}
|
|
115
117
|
function findLongest(arr) {
|
|
116
|
-
return arr.sort((a, b) =>
|
|
117
|
-
return a.length > b.length ? -1 : 1;
|
|
118
|
-
})[0];
|
|
118
|
+
return arr.sort((a, b) => b.length - a.length)[0];
|
|
119
119
|
}
|
|
120
120
|
function padRight(str, length) {
|
|
121
121
|
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
|
|
@@ -125,7 +125,13 @@ function camelcase(input) {
|
|
|
125
125
|
return p1 + p2.toUpperCase();
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
+
const UNSAFE_KEYS = /* @__PURE__ */ new Set([
|
|
129
|
+
"__proto__",
|
|
130
|
+
"constructor",
|
|
131
|
+
"prototype"
|
|
132
|
+
]);
|
|
128
133
|
function setDotProp(obj, keys, val) {
|
|
134
|
+
if (keys.some((key) => UNSAFE_KEYS.has(key))) return;
|
|
129
135
|
let current = obj;
|
|
130
136
|
for (let i = 0; i < keys.length; i++) {
|
|
131
137
|
const key = keys[i];
|
|
@@ -141,12 +147,9 @@ function setDotProp(obj, keys, val) {
|
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
149
|
function setByType(obj, transforms) {
|
|
144
|
-
for (const key of Object.
|
|
145
|
-
|
|
146
|
-
if (transform.
|
|
147
|
-
obj[key] = [obj[key]].flat();
|
|
148
|
-
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
149
|
-
}
|
|
150
|
+
for (const [key, transform] of Object.entries(transforms)) if (transform.shouldTransform) {
|
|
151
|
+
obj[key] = [obj[key]].flat();
|
|
152
|
+
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
function getFileName(input) {
|
|
@@ -189,7 +192,7 @@ var Option = class {
|
|
|
189
192
|
name = name.replace(/^no-/, "");
|
|
190
193
|
}
|
|
191
194
|
return camelcaseOptionName(name);
|
|
192
|
-
}).sort((a, b) => a.length
|
|
195
|
+
}).sort((a, b) => a.length - b.length);
|
|
193
196
|
this.name = this.names.at(-1);
|
|
194
197
|
if (this.negated && this.config.default == null) this.config.default = true;
|
|
195
198
|
if (rawName.includes("<")) this.required = true;
|
|
@@ -292,7 +295,7 @@ var Command = class {
|
|
|
292
295
|
* @param name Option name
|
|
293
296
|
*/
|
|
294
297
|
hasOption(name) {
|
|
295
|
-
name = name.split(".")[0];
|
|
298
|
+
name = name.split(".", 1)[0];
|
|
296
299
|
return this.options.find((option) => {
|
|
297
300
|
return option.names.includes(name);
|
|
298
301
|
});
|
|
@@ -367,7 +370,7 @@ var Command = class {
|
|
|
367
370
|
const { options: parsedOptions, globalCommand } = this.cli;
|
|
368
371
|
const options = [...globalCommand.options, ...this.options];
|
|
369
372
|
for (const option of options) {
|
|
370
|
-
const value = parsedOptions[option.name.split(".")[0]];
|
|
373
|
+
const value = parsedOptions[option.name.split(".", 1)[0]];
|
|
371
374
|
if (option.required) {
|
|
372
375
|
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
|
|
373
376
|
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
|
|
@@ -586,8 +589,8 @@ var CAC = class extends EventTarget {
|
|
|
586
589
|
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
|
|
587
590
|
}
|
|
588
591
|
}
|
|
589
|
-
for (const key of Object.
|
|
590
|
-
setDotProp(options, key.split("."),
|
|
592
|
+
for (const [key, value] of Object.entries(parsed)) if (key !== "_") {
|
|
593
|
+
setDotProp(options, key.split("."), value);
|
|
591
594
|
setByType(options, transforms);
|
|
592
595
|
}
|
|
593
596
|
return {
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { r as __toESM } from "./rolldown-runtime-CMFfr-1z.js";
|
|
2
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-
|
|
4
|
-
import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-
|
|
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-BW3g7VnD.js";
|
|
4
|
+
import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-Dx-ZY2MN.js";
|
|
5
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 {
|
|
6
|
+
import { c as getNpmRegistry, n as detectPackageMetadata, r as getScopeFromPackageName, s as fetchNpmResource } from "./package-BP16iQby.js";
|
|
7
7
|
import { n as isAlignableVitestEcosystemPackage } from "./vitest-ecosystem-BU0AqZq-.js";
|
|
8
|
-
import { C as multiselect, S as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { C as confirm, E as multiselect, M as isCancel, O as select, S as normalize$2, T as log, _ as getSpinner, b as coerce, d as readYamlFile, f as scalarString, g as getSilentSpinner, t as cancelAndExit, u as editYamlFile, y as PackageManager } from "./prompts-BGpQtC5z.js";
|
|
9
|
+
import { _ as isGreaterThanOrEqual, h as compareReversed, v as isLessThanOrEqual } from "./comparison-CmVirWIW-DUGaiYqF.js";
|
|
10
|
+
import { i as normalizeRange, s as satisfies, t as extractOverrideTargetName } from "./package-overrides-D1RcXSFl.js";
|
|
11
|
+
import { l as displayRelative, u as rulesDir } from "./agent-KeDc6vmg.js";
|
|
11
12
|
import { n as addMigrationWarning, t as addManualStep } from "./report-NhQk8VHb.js";
|
|
12
13
|
import { n as runCommandSilently, r as require_cross_spawn } from "./command-CguLh2KL.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { i as findUnsafeHookInstallPath, t as SUPPORTED_GIT_HOOK_NAMES } from "./hooks-
|
|
14
|
+
import { t as require_dist } from "./dist-Bi7ZEK3c.js";
|
|
15
|
+
import { a as hasBaseUrlInTsconfig, c as hasVitestTypesInTsconfig, l as removeDeprecatedTsconfigFalseOption, n as findTsconfigFiles, s as hasTypesToRewriteInTsconfig, u as rewriteTypesInTsconfig } from "./tsconfig-D2DzAQ_D.js";
|
|
16
|
+
import { i as findUnsafeHookInstallPath, t as SUPPORTED_GIT_HOOK_NAMES } from "./hooks-DhwsWb46.js";
|
|
16
17
|
import path, { posix, win32 } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
import { detectWorkspace, getVpDirs, hasConfigKey, mergeJsonConfig, mergeTsdownConfig, migrateTaskCacheConfig, rewriteEslint, rewriteImportsInDirectory, rewritePrettier, rewriteScripts, wrapLazyPlugins } from "../binding/index.js";
|
|
19
20
|
import { styleText } from "node:util";
|
|
20
|
-
import * as actualFS from "node:fs";
|
|
21
|
-
import fs from "node:fs";
|
|
21
|
+
import fs, * as actualFS from "node:fs";
|
|
22
22
|
import os from "node:os";
|
|
23
23
|
import "oxlint";
|
|
24
24
|
import { lstatSync as lstatSync$1, readdir, readdirSync as readdirSync$1, readlinkSync, realpathSync as realpathSync$1 } from "fs";
|
|
@@ -28,7 +28,6 @@ import { EventEmitter } from "node:events";
|
|
|
28
28
|
import Stream from "node:stream";
|
|
29
29
|
import { StringDecoder } from "node:string_decoder";
|
|
30
30
|
//#region src/migration/migrator/shared.ts
|
|
31
|
-
var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
|
|
32
31
|
const LINT_STAGED_JSON_CONFIG_FILES = [".lintstagedrc.json", ".lintstagedrc"];
|
|
33
32
|
const LINT_STAGED_OTHER_CONFIG_FILES = [
|
|
34
33
|
".lintstagedrc.yaml",
|
|
@@ -144,7 +143,7 @@ function checkVitestVersion(projectPath) {
|
|
|
144
143
|
function checkPackageVersion(projectPath, name, minVersion) {
|
|
145
144
|
const metadata = detectPackageMetadata(projectPath, name);
|
|
146
145
|
if (!metadata || metadata.name !== name) return true;
|
|
147
|
-
if (
|
|
146
|
+
if (satisfies(metadata.version, `<${minVersion}`)) {
|
|
148
147
|
const packageJsonFilePath = path.join(projectPath, "package.json");
|
|
149
148
|
log.error(`✘ ${name}@${metadata.version} in ${displayRelative(packageJsonFilePath)} is not supported by auto migration`);
|
|
150
149
|
log.info(`Please upgrade ${name} to version >=${minVersion} first`);
|
|
@@ -164,8 +163,7 @@ function readPackageJsonIfExists(packageJsonPath) {
|
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
165
|
function pnpmMajor(version) {
|
|
167
|
-
|
|
168
|
-
return coerced ? import_semver.default.major(coerced) : void 0;
|
|
166
|
+
return version ? coerce(version)?.major : void 0;
|
|
169
167
|
}
|
|
170
168
|
const OXLINT_PLUGINS_PACKAGE = "@oxlint/plugins";
|
|
171
169
|
const OXLINT_PLUGIN_API_PACKAGES = ["oxlint", OXLINT_PLUGINS_PACKAGE];
|
|
@@ -318,6 +316,29 @@ const OXLINT_NATIVE_PLUGINS = /* @__PURE__ */ new Set([
|
|
|
318
316
|
"node",
|
|
319
317
|
"vue"
|
|
320
318
|
]);
|
|
319
|
+
const OXLINT_SCHEMA_PATH = fileURLToPath(new URL("configuration_schema.json", import.meta.resolve("oxlint/package.json")));
|
|
320
|
+
const OXLINT_SCHEMA = readJsonFile(OXLINT_SCHEMA_PATH);
|
|
321
|
+
const OXLINT_BUILTIN_RULES = new Set(Object.keys(OXLINT_SCHEMA.definitions.DummyRuleMap.properties));
|
|
322
|
+
const TYPESCRIPT_COMPATIBLE_ESLINT_RULES = /* @__PURE__ */ new Set([
|
|
323
|
+
"class-methods-use-this",
|
|
324
|
+
"default-param-last",
|
|
325
|
+
"init-declarations",
|
|
326
|
+
"max-params",
|
|
327
|
+
"no-array-constructor",
|
|
328
|
+
"no-dupe-class-members",
|
|
329
|
+
"no-empty-function",
|
|
330
|
+
"no-invalid-this",
|
|
331
|
+
"no-loop-func",
|
|
332
|
+
"no-loss-of-precision",
|
|
333
|
+
"no-magic-numbers",
|
|
334
|
+
"no-redeclare",
|
|
335
|
+
"no-restricted-imports",
|
|
336
|
+
"no-shadow",
|
|
337
|
+
"no-unused-expressions",
|
|
338
|
+
"no-unused-vars",
|
|
339
|
+
"no-use-before-define",
|
|
340
|
+
"no-useless-constructor"
|
|
341
|
+
]);
|
|
321
342
|
function detectEslintProject(projectPath, packages) {
|
|
322
343
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
323
344
|
if (!fs.existsSync(packageJsonPath)) return { hasDependency: false };
|
|
@@ -370,8 +391,8 @@ async function resolveOxlintMigrateVersion(oxlintVersion) {
|
|
|
370
391
|
if (!response.ok) return oxlintVersion;
|
|
371
392
|
const packument = await response.json();
|
|
372
393
|
if (packument.versions && Object.hasOwn(packument.versions, oxlintVersion)) return oxlintVersion;
|
|
373
|
-
const candidates = Object.keys(packument.versions ?? {}).filter((version) =>
|
|
374
|
-
return candidates.length > 0 ? candidates.toSorted(
|
|
394
|
+
const candidates = Object.keys(packument.versions ?? {}).filter((version) => normalize$2(version) && isLessThanOrEqual(version, oxlintVersion));
|
|
395
|
+
return candidates.length > 0 ? candidates.toSorted(compareReversed)[0] : oxlintVersion;
|
|
375
396
|
} catch {
|
|
376
397
|
return oxlintVersion;
|
|
377
398
|
}
|
|
@@ -654,7 +675,7 @@ function collectInstalledPackageNames(projectPath, packages) {
|
|
|
654
675
|
* prefixes until one matches or we run out of slashes.
|
|
655
676
|
*/
|
|
656
677
|
function ruleKeyMatchesNamespace(key, namespaces) {
|
|
657
|
-
if (!key.includes("/")) return
|
|
678
|
+
if (!key.includes("/")) return false;
|
|
658
679
|
let idx = key.indexOf("/");
|
|
659
680
|
while (idx !== -1) {
|
|
660
681
|
if (namespaces.has(key.slice(0, idx))) return true;
|
|
@@ -662,10 +683,46 @@ function ruleKeyMatchesNamespace(key, namespaces) {
|
|
|
662
683
|
}
|
|
663
684
|
return false;
|
|
664
685
|
}
|
|
665
|
-
|
|
666
|
-
|
|
686
|
+
const OXLINT_PLUGIN_ALIASES = /* @__PURE__ */ new Map([
|
|
687
|
+
["@typescript-eslint", "typescript"],
|
|
688
|
+
["typescript-eslint", "typescript"],
|
|
689
|
+
["typescript_eslint", "typescript"],
|
|
690
|
+
["react-hooks", "react"],
|
|
691
|
+
["react_hooks", "react"],
|
|
692
|
+
["deepscan", "oxc"],
|
|
693
|
+
["import-x", "import"],
|
|
694
|
+
["jsx-a11y-x", "jsx-a11y"],
|
|
695
|
+
["jsx_a11y-x", "jsx-a11y"],
|
|
696
|
+
["jsx_a11y", "jsx-a11y"],
|
|
697
|
+
["react_perf", "react-perf"],
|
|
698
|
+
["@next", "nextjs"],
|
|
699
|
+
["@next/next", "nextjs"]
|
|
700
|
+
]);
|
|
701
|
+
function normalizeOxlintRuleNamespace(key) {
|
|
702
|
+
const separator = key.startsWith("@") ? key.lastIndexOf("/") : key.indexOf("/");
|
|
703
|
+
if (separator < 0) return key;
|
|
704
|
+
const plugin = deriveJsPluginNamespace(key.slice(0, separator));
|
|
705
|
+
return `${OXLINT_PLUGIN_ALIASES.get(plugin) ?? plugin}${key.slice(separator)}`;
|
|
706
|
+
}
|
|
707
|
+
function isBuiltinOxlintRule(key) {
|
|
708
|
+
const normalizedKey = normalizeOxlintRuleNamespace(key);
|
|
709
|
+
const firstSlash = normalizedKey.indexOf("/");
|
|
710
|
+
if (firstSlash === -1) return OXLINT_BUILTIN_RULES.has(normalizedKey) || [...OXLINT_BUILTIN_RULES].some((rule) => rule.endsWith(`/${normalizedKey}`));
|
|
711
|
+
const separator = normalizedKey.startsWith("@") ? normalizedKey.lastIndexOf("/") : firstSlash;
|
|
712
|
+
const plugin = normalizedKey.slice(0, separator);
|
|
713
|
+
const rule = normalizedKey.slice(separator + 1);
|
|
714
|
+
if (plugin === "eslint" || plugin === "typescript" && TYPESCRIPT_COMPATIBLE_ESLINT_RULES.has(rule)) return OXLINT_BUILTIN_RULES.has(rule);
|
|
715
|
+
return OXLINT_BUILTIN_RULES.has(`${plugin}/${rule}`);
|
|
716
|
+
}
|
|
717
|
+
function hasBuiltinOxlintNamespace(key) {
|
|
718
|
+
if (!key.includes("/")) return true;
|
|
719
|
+
return ruleKeyMatchesNamespace(normalizeOxlintRuleNamespace(key), OXLINT_NATIVE_PLUGINS);
|
|
720
|
+
}
|
|
721
|
+
/** Filter a rules object to Oxlint rules or rules under a configured JS plugin namespace. */
|
|
722
|
+
function filterRulesAgainstNamespaces(rules, jsPluginNamespaces, droppedRules) {
|
|
667
723
|
const out = {};
|
|
668
|
-
for (const [key, value] of Object.entries(rules)) if (ruleKeyMatchesNamespace(key,
|
|
724
|
+
for (const [key, value] of Object.entries(rules)) if (isBuiltinOxlintRule(key) || ruleKeyMatchesNamespace(key, jsPluginNamespaces) || ruleKeyMatchesNamespace(normalizeOxlintRuleNamespace(key), jsPluginNamespaces)) out[key] = value;
|
|
725
|
+
else if (hasBuiltinOxlintNamespace(key)) droppedRules.add(key);
|
|
669
726
|
return out;
|
|
670
727
|
}
|
|
671
728
|
/**
|
|
@@ -703,14 +760,6 @@ function jsPluginsToNamespaces(entries) {
|
|
|
703
760
|
ns.delete("");
|
|
704
761
|
return ns;
|
|
705
762
|
}
|
|
706
|
-
function stripUnsupportedReactRefreshOption(rules) {
|
|
707
|
-
const rule = rules?.["react/only-export-components"];
|
|
708
|
-
if (!Array.isArray(rule)) return false;
|
|
709
|
-
const options = rule[1];
|
|
710
|
-
if (!options || typeof options !== "object" || Array.isArray(options) || !("allowCompoundComponents" in options)) return false;
|
|
711
|
-
delete options.allowCompoundComponents;
|
|
712
|
-
return true;
|
|
713
|
-
}
|
|
714
763
|
/**
|
|
715
764
|
* Sanitize the `.oxlintrc.json` produced by `@oxlint/migrate` (in-place)
|
|
716
765
|
* before it gets merged into `vite.config.ts`. Drop references that
|
|
@@ -732,12 +781,13 @@ function stripUnsupportedReactRefreshOption(rules) {
|
|
|
732
781
|
function sanitizeMigratedOxlintConfig(config, availablePackages, report) {
|
|
733
782
|
const allDroppedJsPlugins = /* @__PURE__ */ new Set();
|
|
734
783
|
const allDroppedPlugins = /* @__PURE__ */ new Set();
|
|
735
|
-
|
|
784
|
+
const allDroppedRules = /* @__PURE__ */ new Set();
|
|
736
785
|
const baseSplit = partitionJsPlugins(config.jsPlugins ?? [], availablePackages);
|
|
737
786
|
for (const n of baseSplit.dropped) allDroppedJsPlugins.add(n);
|
|
738
787
|
if (config.jsPlugins && baseSplit.dropped.length > 0) config.jsPlugins = baseSplit.kept;
|
|
788
|
+
const jsPluginNamespaces = jsPluginsToNamespaces(baseSplit.kept);
|
|
739
789
|
const baseNamespaces = new Set(OXLINT_NATIVE_PLUGINS);
|
|
740
|
-
for (const ns of
|
|
790
|
+
for (const ns of jsPluginNamespaces) baseNamespaces.add(ns);
|
|
741
791
|
if (config.plugins) {
|
|
742
792
|
const keptPlugins = [];
|
|
743
793
|
for (const p of config.plugins) if (baseNamespaces.has(p)) keptPlugins.push(p);
|
|
@@ -745,11 +795,10 @@ function sanitizeMigratedOxlintConfig(config, availablePackages, report) {
|
|
|
745
795
|
if (keptPlugins.length !== config.plugins.length) config.plugins = keptPlugins;
|
|
746
796
|
}
|
|
747
797
|
if (config.rules) {
|
|
748
|
-
const filtered = filterRulesAgainstNamespaces(config.rules,
|
|
798
|
+
const filtered = filterRulesAgainstNamespaces(config.rules, jsPluginNamespaces, allDroppedRules);
|
|
749
799
|
if (Object.keys(filtered).length !== Object.keys(config.rules).length) config.rules = filtered;
|
|
750
800
|
}
|
|
751
801
|
if (Array.isArray(config.overrides)) for (const override of config.overrides) {
|
|
752
|
-
if (stripUnsupportedReactRefreshOption(override.rules)) droppedReactRefreshOption = true;
|
|
753
802
|
let overrideSurvivors = [];
|
|
754
803
|
if (override.jsPlugins) {
|
|
755
804
|
const split = partitionJsPlugins(override.jsPlugins, availablePackages);
|
|
@@ -757,8 +806,9 @@ function sanitizeMigratedOxlintConfig(config, availablePackages, report) {
|
|
|
757
806
|
if (split.dropped.length > 0) override.jsPlugins = split.kept;
|
|
758
807
|
overrideSurvivors = split.kept;
|
|
759
808
|
}
|
|
760
|
-
const
|
|
761
|
-
for (const ns of jsPluginsToNamespaces(overrideSurvivors))
|
|
809
|
+
const overrideJsPluginNamespaces = new Set(jsPluginNamespaces);
|
|
810
|
+
for (const ns of jsPluginsToNamespaces(overrideSurvivors)) overrideJsPluginNamespaces.add(ns);
|
|
811
|
+
const overrideNamespaces = /* @__PURE__ */ new Set([...OXLINT_NATIVE_PLUGINS, ...overrideJsPluginNamespaces]);
|
|
762
812
|
if (override.plugins) {
|
|
763
813
|
const keptOverridePlugins = [];
|
|
764
814
|
for (const p of override.plugins) if (overrideNamespaces.has(p)) keptOverridePlugins.push(p);
|
|
@@ -766,13 +816,13 @@ function sanitizeMigratedOxlintConfig(config, availablePackages, report) {
|
|
|
766
816
|
if (keptOverridePlugins.length !== override.plugins.length) override.plugins = keptOverridePlugins;
|
|
767
817
|
}
|
|
768
818
|
if (override.rules) {
|
|
769
|
-
const filtered = filterRulesAgainstNamespaces(override.rules,
|
|
819
|
+
const filtered = filterRulesAgainstNamespaces(override.rules, overrideJsPluginNamespaces, allDroppedRules);
|
|
770
820
|
if (Object.keys(filtered).length !== Object.keys(override.rules).length) override.rules = filtered;
|
|
771
821
|
}
|
|
772
822
|
}
|
|
773
|
-
if (droppedReactRefreshOption) warnMigration("The bundled Oxlint does not support react/only-export-components.allowCompoundComponents. Removed this option from the migrated config; compound component exports may now report lint errors.", report);
|
|
774
823
|
if (allDroppedJsPlugins.size > 0) warnMigration(`Stripped JS plugin reference(s) from the generated lint config: ${[...allDroppedJsPlugins].join(", ")}. No matching package is present in this workspace, so loading them at lint time would fail. If you want their Oxlint coverage back, install each package (e.g. \`vp install <name>\`) and add its name back to \`lint.jsPlugins\` in vite.config.ts.`, report);
|
|
775
824
|
if (allDroppedPlugins.size > 0) warnMigration(`Stripped unknown plugin reference(s) from the generated lint config: ${[...allDroppedPlugins].join(", ")}. These aren't native Oxlint plugins and no surviving JS plugin contributes them.`, report);
|
|
825
|
+
if (allDroppedRules.size > 0) warnMigration(`Stripped unsupported Oxlint rule(s) from the generated lint config: ${[...allDroppedRules].join(", ")}. These rule(s) are not available in Oxlint.`, report);
|
|
776
826
|
}
|
|
777
827
|
function warnPackageLevelEslint() {
|
|
778
828
|
log.warn("ESLint detected in workspace packages but no root config found. Package-level ESLint must be migrated manually.");
|
|
@@ -858,7 +908,7 @@ function detectPrettierProject(projectPath, packages) {
|
|
|
858
908
|
}
|
|
859
909
|
/**
|
|
860
910
|
* Run `vp fmt --migrate=prettier` step with graceful error handling.
|
|
861
|
-
*
|
|
911
|
+
* Unsupported config formats are skipped; other errors still fail migration.
|
|
862
912
|
*/
|
|
863
913
|
async function runPrettierMigrateStep(vpBin, cwd, spinner, failMessage, manualHint) {
|
|
864
914
|
try {
|
|
@@ -869,17 +919,22 @@ async function runPrettierMigrateStep(vpBin, cwd, spinner, failMessage, manualHi
|
|
|
869
919
|
envs: process.env
|
|
870
920
|
});
|
|
871
921
|
if (result.exitCode !== 0) {
|
|
872
|
-
spinner.stop(failMessage);
|
|
873
922
|
const stderr = result.stderr.toString().trim();
|
|
923
|
+
const unsupportedConfig = stderr.includes("Failed to load Prettier config at:") && (stderr.includes("YAML, JSON5 and TOML formats are not supported.") || stderr.includes("Only JSON format is supported for `.prettierrc`."));
|
|
924
|
+
spinner.stop(unsupportedConfig ? "Prettier migration skipped" : failMessage);
|
|
874
925
|
if (stderr) log.warn(`⚠ ${stderr}`);
|
|
926
|
+
if (unsupportedConfig) {
|
|
927
|
+
log.info("Keeping Prettier. Convert its config to JSON or JS and run `vp migrate --full` to migrate it later.");
|
|
928
|
+
return "skipped";
|
|
929
|
+
}
|
|
875
930
|
log.info(manualHint);
|
|
876
|
-
return
|
|
931
|
+
return "failed";
|
|
877
932
|
}
|
|
878
|
-
return
|
|
933
|
+
return "migrated";
|
|
879
934
|
} catch {
|
|
880
935
|
spinner.stop(failMessage);
|
|
881
936
|
log.info(manualHint);
|
|
882
|
-
return
|
|
937
|
+
return "failed";
|
|
883
938
|
}
|
|
884
939
|
}
|
|
885
940
|
async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFile, packages, options) {
|
|
@@ -893,11 +948,12 @@ async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFi
|
|
|
893
948
|
if (pkg.prettier) {
|
|
894
949
|
tempPrettierConfig = path.join(projectPath, ".prettierrc.json");
|
|
895
950
|
fs.writeFileSync(tempPrettierConfig, JSON.stringify(pkg.prettier, null, 2));
|
|
896
|
-
} else return
|
|
951
|
+
} else return "skipped";
|
|
897
952
|
}
|
|
898
953
|
try {
|
|
899
954
|
spinner.start("Migrating Prettier config to Oxfmt...");
|
|
900
|
-
|
|
955
|
+
const result = await runPrettierMigrateStep(vpBin, projectPath, spinner, "Prettier migration failed", "You can run `vp fmt --migrate=prettier` manually later");
|
|
956
|
+
if (result !== "migrated") return result;
|
|
901
957
|
spinner.stop("Prettier config migrated to .oxfmtrc.json");
|
|
902
958
|
} finally {
|
|
903
959
|
if (tempPrettierConfig) try {
|
|
@@ -912,7 +968,7 @@ async function migratePrettierToOxfmt(projectPath, interactive, prettierConfigFi
|
|
|
912
968
|
rewritePrettierLintStagedConfigFiles(projectPath, options?.report);
|
|
913
969
|
const prettierIgnorePath = path.join(projectPath, ".prettierignore");
|
|
914
970
|
if (fs.existsSync(prettierIgnorePath)) warnMigration(`${displayRelative(prettierIgnorePath)} found — Oxfmt supports .prettierignore, but using the \`ignorePatterns\` option is recommended.`, options?.report);
|
|
915
|
-
return
|
|
971
|
+
return "migrated";
|
|
916
972
|
}
|
|
917
973
|
function deletePrettierConfigFiles(basePath, report, silent = false) {
|
|
918
974
|
const configs = detectConfigs(basePath);
|
|
@@ -999,8 +1055,9 @@ async function promptPrettierMigration(projectPath, interactive, packages) {
|
|
|
999
1055
|
return false;
|
|
1000
1056
|
}
|
|
1001
1057
|
if (!await confirmPrettierMigration(interactive)) return false;
|
|
1002
|
-
|
|
1003
|
-
|
|
1058
|
+
const result = await migratePrettierToOxfmt(projectPath, interactive, prettierProject.configFile, packages);
|
|
1059
|
+
if (result === "failed") cancelAndExit("Prettier migration failed.", 1);
|
|
1060
|
+
return result === "migrated";
|
|
1004
1061
|
}
|
|
1005
1062
|
//#endregion
|
|
1006
1063
|
//#region src/migration/migrator/tsup.ts
|
|
@@ -1741,7 +1798,7 @@ function vitestEcosystemCatalogReferencesPending(pkg, catalogDependencyResolver)
|
|
|
1741
1798
|
pkg.optionalDependencies
|
|
1742
1799
|
]) {
|
|
1743
1800
|
if (!dependencies) continue;
|
|
1744
|
-
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "5.0.
|
|
1801
|
+
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "5.0.4") return true;
|
|
1745
1802
|
}
|
|
1746
1803
|
return false;
|
|
1747
1804
|
}
|
|
@@ -7349,8 +7406,8 @@ const PNPM_MINIMUM_RELEASE_AGE_EXCLUDES = [
|
|
|
7349
7406
|
...VITEST_AGE_GATE_EXEMPT_PACKAGES
|
|
7350
7407
|
];
|
|
7351
7408
|
function versionAtLeast(version, minVersion, tags) {
|
|
7352
|
-
const coerced =
|
|
7353
|
-
if (coerced) return
|
|
7409
|
+
const coerced = coerce(version);
|
|
7410
|
+
if (coerced) return isGreaterThanOrEqual(coerced, minVersion);
|
|
7354
7411
|
return tags.includes(version);
|
|
7355
7412
|
}
|
|
7356
7413
|
const PNPM_WORKSPACE_SETTINGS_MIN_VERSION = "10.6.2";
|
|
@@ -8000,7 +8057,7 @@ function resolveEffectiveYarnConfigValue(workspaceRootDir, key, envVar) {
|
|
|
8000
8057
|
* treated as modern because that is the version `vp` will provision.
|
|
8001
8058
|
*/
|
|
8002
8059
|
function detectYarnPnpMode(projectPath, yarnVersion) {
|
|
8003
|
-
if (
|
|
8060
|
+
if (coerce(yarnVersion)?.major === 1) return;
|
|
8004
8061
|
const environmentLinker = process.env.YARN_NODE_LINKER?.trim();
|
|
8005
8062
|
if (environmentLinker) return environmentLinker.toLowerCase() === "pnp" ? { source: "environment" } : void 0;
|
|
8006
8063
|
const configuredLinker = resolveEffectiveYarnConfigValue(projectPath, "nodeLinker", "YARN_NODE_LINKER");
|
|
@@ -8344,7 +8401,7 @@ function isSemanticVitePlusOverrideSpec(dependencyName, spec) {
|
|
|
8344
8401
|
if (!spec) return false;
|
|
8345
8402
|
if (isLegacyWrapperSpec(spec)) return false;
|
|
8346
8403
|
if (spec === VITE_PLUS_OVERRIDE_PACKAGES[dependencyName]) return true;
|
|
8347
|
-
if (dependencyName === "@vitest/browser" && spec === "5.0.
|
|
8404
|
+
if (dependencyName === "@vitest/browser" && spec === "5.0.4") return true;
|
|
8348
8405
|
return false;
|
|
8349
8406
|
}
|
|
8350
8407
|
function overrideSpecSatisfiesVitePlus(dependencyName, spec, catalogDependencyResolver) {
|
|
@@ -8359,9 +8416,6 @@ function overridesSatisfyVitePlus(overrides, usesVitest, catalogDependencyResolv
|
|
|
8359
8416
|
if (keyStyle === "pnpm-ranged" && Object.keys(managed).some((dependencyName) => typeof overrides?.[dependencyName] === "string")) return false;
|
|
8360
8417
|
return Object.keys(managed).every((dependencyName) => overrideSpecSatisfiesVitePlus(dependencyName, overrides?.[managedOverrideKey(dependencyName, keyStyle)], catalogDependencyResolver));
|
|
8361
8418
|
}
|
|
8362
|
-
function hasPackageManagerPin(pkg) {
|
|
8363
|
-
return Boolean(pkg.packageManager || pkg.devEngines?.packageManager);
|
|
8364
|
-
}
|
|
8365
8419
|
function pinnedPackageManagerVersion(pkg) {
|
|
8366
8420
|
if (typeof pkg.packageManager === "string") {
|
|
8367
8421
|
const separator = pkg.packageManager.indexOf("@");
|
|
@@ -8553,9 +8607,9 @@ function detectVitePlusBootstrapPending(projectPath, packageManager, packages, p
|
|
|
8553
8607
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
8554
8608
|
if (!fs.existsSync(packageJsonPath)) return false;
|
|
8555
8609
|
const pkg = readJsonFile(packageJsonPath);
|
|
8556
|
-
if (!hasDirectVitePlusInstallEntry(pkg)
|
|
8610
|
+
if (!hasDirectVitePlusInstallEntry(pkg)) return true;
|
|
8557
8611
|
if (packageManager === void 0) return true;
|
|
8558
|
-
const resolvedPackageManagerVersion = packageManagerVersion ?? pinnedPackageManagerVersion(pkg)
|
|
8612
|
+
const resolvedPackageManagerVersion = (packageManagerVersion ?? pinnedPackageManagerVersion(pkg)) || "latest";
|
|
8559
8613
|
const usePnpmWorkspaceYaml = packageManager === PackageManager.pnpm && pnpmSupportsWorkspaceSettings(resolvedPackageManagerVersion);
|
|
8560
8614
|
if (usePnpmWorkspaceYaml && pnpmPackageJsonSettingsPending(pkg)) return true;
|
|
8561
8615
|
const supportCatalog = !VITE_PLUS_VERSION.startsWith("file:") && supportsCatalog(packageManager, resolvedPackageManagerVersion, packageManager === PackageManager.bun && bunWorkspaceDeclaresPackages(pkg.workspaces));
|
|
@@ -8774,10 +8828,7 @@ function ensureVitePlusBootstrap(workspaceInfo, report) {
|
|
|
8774
8828
|
const after = fs.readFileSync(packageJsonPath, "utf-8");
|
|
8775
8829
|
result.packageJson = result.packageJson || before !== after;
|
|
8776
8830
|
}
|
|
8777
|
-
|
|
8778
|
-
setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
|
|
8779
|
-
result.packageManagerField = beforePackageManager !== fs.readFileSync(packageJsonPath, "utf-8");
|
|
8780
|
-
result.changed = result.packageJson || result.packageManagerConfig || result.packageManagerField;
|
|
8831
|
+
result.changed = result.packageJson || result.packageManagerConfig;
|
|
8781
8832
|
if (result.changed && report) report.packageManagerBootstrapConfigured = true;
|
|
8782
8833
|
return result;
|
|
8783
8834
|
}
|
|
@@ -9554,7 +9605,7 @@ function parseNvmrcVersion(alias) {
|
|
|
9554
9605
|
if (version === "iojs" || version === "system" || version === "default") return null;
|
|
9555
9606
|
if (version.startsWith("lts/")) return version;
|
|
9556
9607
|
const normalized = version.startsWith("v") ? version.slice(1) : version;
|
|
9557
|
-
if (!normalized || !
|
|
9608
|
+
if (!normalized || !normalizeRange(normalized)) return null;
|
|
9558
9609
|
return normalized;
|
|
9559
9610
|
}
|
|
9560
9611
|
/**
|
|
@@ -9662,7 +9713,7 @@ function migrateNodeVersionManagerFile(projectPath, detection, report) {
|
|
|
9662
9713
|
if (detection.file === "package.json") {
|
|
9663
9714
|
const { voltaNodeVersion } = detection;
|
|
9664
9715
|
const resolvedVersion = voltaNodeVersion === "lts" ? "lts/*" : voltaNodeVersion;
|
|
9665
|
-
if (!
|
|
9716
|
+
if (!normalize$2(resolvedVersion) && resolvedVersion !== "lts/*") {
|
|
9666
9717
|
warnMigration(`package.json volta.node "${voltaNodeVersion}" is not an exact version. Pin an exact version (e.g. ${voltaNodeVersion}.0 or run \`volta pin node@${voltaNodeVersion}\`) then re-run migration.`, report);
|
|
9667
9718
|
return false;
|
|
9668
9719
|
}
|
|
@@ -9883,7 +9934,6 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
9883
9934
|
dropDeadOxlintPluginsDependency(projectPath, workspaceInfo.packages, originalOxlintDependencies);
|
|
9884
9935
|
wrapLazyPluginsInViteConfig(projectPath, silent, report);
|
|
9885
9936
|
migrateTaskCacheConfigInViteConfig(projectPath, silent, report);
|
|
9886
|
-
setPackageManager(projectPath, workspaceInfo.downloadPackageManager);
|
|
9887
9937
|
}
|
|
9888
9938
|
/**
|
|
9889
9939
|
* Rewrite monorepo to add vite-plus dependencies
|
|
@@ -9929,7 +9979,6 @@ function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, rep
|
|
|
9929
9979
|
wrapLazyPluginsInViteConfig(projectPath, silent, report);
|
|
9930
9980
|
migrateTaskCacheConfigInViteConfig(projectPath, silent, report);
|
|
9931
9981
|
}
|
|
9932
|
-
setPackageManager(workspaceInfo.rootDir, workspaceInfo.downloadPackageManager);
|
|
9933
9982
|
}
|
|
9934
9983
|
/**
|
|
9935
9984
|
* Rewrite monorepo project to add vite-plus dependencies
|
package/dist/fmt.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { format };
|
|
1
|
+
export { format } from "oxfmt";
|
package/dist/hooks/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as log } from "../terminal-MKGAuy-p.js";
|
|
2
|
-
import { l as status, n as disable, r as enable } from "../hooks-
|
|
2
|
+
import { l as status, n as disable, r as enable } from "../hooks-DhwsWb46.js";
|
|
3
3
|
import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
|
|
4
4
|
import { parseHooksArgs } from "../../binding/index.js";
|
|
5
5
|
//#region src/hooks/bin.ts
|
|
@@ -50,15 +50,6 @@ d=${nestedDirname(dir.split(separators).filter((s) => s !== "" && s !== ".").len
|
|
|
50
50
|
__vp_shell=/bin/sh
|
|
51
51
|
[ -x "$__vp_shell" ] || __vp_shell=$(command -v sh)
|
|
52
52
|
|
|
53
|
-
if [ -n "\${VP_HOME-}" ]; then
|
|
54
|
-
__vp_bin="$VP_HOME/bin"
|
|
55
|
-
elif [ -n "\${HOME-}" ]; then
|
|
56
|
-
__vp_bin="$HOME/.vite-plus/bin"
|
|
57
|
-
else
|
|
58
|
-
__vp_bin=""
|
|
59
|
-
fi
|
|
60
|
-
[ -n "$__vp_bin" ] && [ -d "$__vp_bin" ] && export PATH="$PATH:$__vp_bin"
|
|
61
|
-
|
|
62
53
|
export PATH="$d/node_modules/.bin:$PATH"
|
|
63
54
|
"$__vp_shell" -e "$s" "$@"
|
|
64
55
|
c=$?
|
|
@@ -158,7 +149,25 @@ function gitConfigGet(key, options) {
|
|
|
158
149
|
if (result.status !== 0) return null;
|
|
159
150
|
return result.stdout?.toString().trim() || null;
|
|
160
151
|
}
|
|
152
|
+
function gitConfigLocalHas(key, value) {
|
|
153
|
+
const result = spawnSync("git", [
|
|
154
|
+
"config",
|
|
155
|
+
"--local",
|
|
156
|
+
"--get-all",
|
|
157
|
+
key
|
|
158
|
+
]);
|
|
159
|
+
return result.status === 0 && result.stdout?.toString() === `${value}\n`;
|
|
160
|
+
}
|
|
161
|
+
function gitConfigLocalMissing(key) {
|
|
162
|
+
return spawnSync("git", [
|
|
163
|
+
"config",
|
|
164
|
+
"--local",
|
|
165
|
+
"--get-all",
|
|
166
|
+
key
|
|
167
|
+
]).status === 1;
|
|
168
|
+
}
|
|
161
169
|
function gitConfigSet(key, value) {
|
|
170
|
+
if (gitConfigLocalHas(key, value)) return { ok: true };
|
|
162
171
|
const result = spawnSync("git", [
|
|
163
172
|
"config",
|
|
164
173
|
"--local",
|
|
@@ -176,6 +185,7 @@ function gitConfigSet(key, value) {
|
|
|
176
185
|
return { ok: true };
|
|
177
186
|
}
|
|
178
187
|
function gitConfigUnset(key) {
|
|
188
|
+
if (gitConfigLocalMissing(key)) return { ok: true };
|
|
179
189
|
const result = spawnSync("git", [
|
|
180
190
|
"config",
|
|
181
191
|
"--local",
|
|
@@ -414,19 +424,21 @@ function install(dir, options = {}) {
|
|
|
414
424
|
writeFileSync(internal(hook), `#!/usr/bin/env sh\n. "$(dirname "$0")/h"`, { mode: 493 });
|
|
415
425
|
chmodSync(internal(hook), 493);
|
|
416
426
|
}
|
|
417
|
-
|
|
418
|
-
"
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
427
|
+
if (!gitConfigLocalHas("core.hooksPath", location.target)) {
|
|
428
|
+
const { status, stderr } = spawnSync("git", [
|
|
429
|
+
"config",
|
|
430
|
+
"core.hooksPath",
|
|
431
|
+
location.target
|
|
432
|
+
]);
|
|
433
|
+
if (status == null) return {
|
|
434
|
+
message: "git command not found",
|
|
435
|
+
isError: true
|
|
436
|
+
};
|
|
437
|
+
if (status) return {
|
|
438
|
+
message: "" + stderr,
|
|
439
|
+
isError: true
|
|
440
|
+
};
|
|
441
|
+
}
|
|
430
442
|
const clearDisabled = setHooksUserDisabled(false);
|
|
431
443
|
if (!clearDisabled.ok) return {
|
|
432
444
|
message: clearDisabled.error || "failed to clear hooks disabled preference",
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_define_config = require("./define-config-
|
|
1
|
+
const require_define_config = require("./define-config-Dq_23Eyr.cjs");
|
|
2
2
|
//#region src/index.cts
|
|
3
3
|
const vite = require("vite");
|
|
4
4
|
const { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } = require("vitest/config");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-Bexdd6RZ.js";
|
|
2
2
|
import { TestProjectConfiguration, TestProjectInlineConfiguration, TestTagDefinition, TestUserConfig, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig, ViteUserConfig, ViteUserConfigExport, ViteUserConfigFn, ViteUserConfigFnObject, ViteUserConfigFnPromise, WatcherTriggerPattern, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
|
|
3
3
|
export * from "vite";
|
|
4
4
|
export { type TestProjectConfiguration, type TestProjectInlineConfiguration, type TestTagDefinition, type TestUserConfig, type UserProjectConfigExport, type UserProjectConfigFn, type UserWorkspaceConfig, type ViteUserConfig, type ViteUserConfigExport, type ViteUserConfigFn, type ViteUserConfigFnObject, type ViteUserConfigFnPromise, type WatcherTriggerPattern, configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, o as defineProject } from "./define-config-CIlk9scU.js";
|
|
2
2
|
import { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
|
|
3
3
|
export * from "vite";
|
|
4
4
|
export { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
|
package/dist/lint-plugins-dev.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { RuleTester };
|
|
1
|
+
export { RuleTester } from "oxlint/plugins-dev";
|
package/dist/lint-plugins.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./define-config-
|
|
2
|
+
require("./define-config-Dq_23Eyr.cjs");
|
|
3
3
|
let _oxlint_plugins = require("@oxlint/plugins");
|
|
4
4
|
Object.defineProperty(exports, "definePlugin", {
|
|
5
5
|
enumerable: true,
|