vite-plus 0.1.21 → 0.1.22
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/AGENTS.md +1 -0
- package/binding/index.cjs +53 -52
- package/binding/index.d.cts +10 -0
- package/dist/{agent-D2ocSU01.js → agent-BWLe0i9g.js} +34 -17
- package/dist/bin.js +8 -14
- package/dist/{cli-truncate-DJcN4dJ8.js → cli-truncate-B62YnW2m.js} +2 -2
- package/dist/{compat-DdC7fHjB.js → compat-OlmU9EQz.js} +1 -1
- package/dist/config/bin.js +4 -4
- package/dist/constants-kDaYqyWd.js +28 -0
- package/dist/create/bin.js +91 -24
- package/dist/{define-config-cWg3Z2bC.d.ts → define-config-IMCGDS2K.d.ts} +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/dist-DZfItHAr.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{log-update-CLxR0iRf.js → log-update-NRrY6krx.js} +3 -3
- package/dist/{main-A6UrSTYb.js → main-DhsO6ndq.js} +1 -28
- package/dist/migration/bin.js +9 -9
- package/dist/oxlint-plugin-config-BkQeR4FR.js +37 -0
- package/dist/oxlint-plugin.d.ts +8 -0
- package/dist/oxlint-plugin.js +91 -0
- package/dist/pack-bin.js +1 -1
- package/dist/pack.d.ts +1 -1
- package/dist/{package-CrKanQYM.js → package-BoLLED6j.js} +2 -1
- package/dist/{slice-ansi-CwJYd1aw.js → slice-ansi-e4todZeH.js} +1 -1
- package/dist/staged/bin.js +8 -8
- package/dist/{tsconfig-lBAWm4sf.js → tsconfig-BVyzXJ_o.js} +1 -1
- package/dist/version.js +5 -5
- package/dist/versions.js +1 -1
- package/dist/{workspace-QXeJWs3P.js → workspace-Bi_9spVt.js} +5 -6
- package/dist/wrap-ansi-3S3qJ7j8.js +2 -0
- package/dist/{wrap-ansi-Dy0LjO7Q.js → wrap-ansi-DtUeUCjE.js} +1 -1
- package/docs/guide/create.md +3 -1
- package/docs/guide/env.md +23 -1
- package/docs/guide/install.md +4 -0
- package/docs/package.json +3 -1
- package/docs/pnpm-lock.yaml +798 -62
- package/package.json +21 -13
- package/dist/dist-D2_BiE1V.js +0 -3
- package/dist/wrap-ansi-DbY7Idw_.js +0 -2
- /package/dist/{define-config-B62DkkqH.js → define-config-CzWdQTt2.js} +0 -0
- /package/dist/{dist-DjG9AYbK.js → dist-owlRxmBM.js} +0 -0
- /package/dist/{help-BtkjXtRM.js → help-DK5wuu34.js} +0 -0
- /package/dist/{lib-BamM40b7.js → lib-DpwyUJWo.js} +0 -0
- /package/dist/{pack-BcBvbQgt.d.ts → pack-K7H72Cum.d.ts} +0 -0
- /package/dist/{report-DbrfjWiP.js → report-CYPv1VK1.js} +0 -0
- /package/dist/{resolve-vite-config-C1KX9CZU.js → resolve-vite-config-C5AjksTj.js} +0 -0
- /package/dist/{strip-ansi-D86nYqKl.js → strip-ansi-D-eYYcD2.js} +0 -0
- /package/dist/{terminal-CxTMfsxZ.js → terminal-D_Kg-AA6.js} +0 -0
package/dist/create/bin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import { a as runCommand$1, o as runCommandSilently, s as require_cross_spawn } from "../tsconfig-
|
|
3
|
-
import { a as printHeader, i as muted, o as success, r as log, t as accent } from "../terminal-
|
|
4
|
-
import { i as resolveViteConfig, n as hasViteConfig, t as findWorkspaceRoot } from "../resolve-vite-config-
|
|
5
|
-
import { $ as
|
|
6
|
-
import { t as lib_default } from "../lib-
|
|
7
|
-
import { c as editJsonFile, o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists, u as readJsonFile } from "../package-
|
|
8
|
-
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-
|
|
9
|
-
import { t as renderCliDoc } from "../help-
|
|
2
|
+
import { a as runCommand$1, o as runCommandSilently, s as require_cross_spawn } from "../tsconfig-BVyzXJ_o.js";
|
|
3
|
+
import { a as printHeader, i as muted, o as success, r as log, t as accent } from "../terminal-D_Kg-AA6.js";
|
|
4
|
+
import { i as resolveViteConfig, n as hasViteConfig, t as findWorkspaceRoot } from "../resolve-vite-config-C5AjksTj.js";
|
|
5
|
+
import { $ as log$1, A as setPackageManager, B as promptGitInit, D as rewriteMonorepo, E as promptPrettierMigration, G as displayRelative, H as runViteInstall, J as PackageManager, K as templatesDir, L as defaultInteractive, O as rewriteMonorepoProject, Q as intro, R as downloadPackageManager$1, T as promptEslintMigration, U as selectPackageManager, V as runViteFmt, X as cancel, Z as confirm, a as writeAgentInstructions, at as require_picocolors, d as detectEslintProject, et as multiselect, f as detectFramework, g as hasFrameworkShim, it as text, k as rewriteStandaloneProject, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as select, o as addFrameworkShim, ot as q, q as DependencyType, r as selectAgentTargetPaths, rt as spinner, v as injectCreateDefaultTemplate, y as installGitHooks, z as promptGitHooks } from "../agent-BWLe0i9g.js";
|
|
6
|
+
import { t as lib_default } from "../lib-DpwyUJWo.js";
|
|
7
|
+
import { c as editJsonFile, o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists, u as readJsonFile } from "../package-BoLLED6j.js";
|
|
8
|
+
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-Bi_9spVt.js";
|
|
9
|
+
import { t as renderCliDoc } from "../help-DK5wuu34.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { runCommand, vitePlusHeader } from "../../binding/index.js";
|
|
12
12
|
import fs from "node:fs";
|
|
@@ -15,8 +15,36 @@ import os from "node:os";
|
|
|
15
15
|
import fsPromises from "node:fs/promises";
|
|
16
16
|
import { createHash, randomUUID } from "node:crypto";
|
|
17
17
|
import assert from "node:assert";
|
|
18
|
-
//#region src/
|
|
18
|
+
//#region src/utils/git.ts
|
|
19
19
|
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
20
|
+
async function initGitRepository(cwd) {
|
|
21
|
+
return (await runCommandSilently({
|
|
22
|
+
command: "git",
|
|
23
|
+
args: ["init"],
|
|
24
|
+
cwd,
|
|
25
|
+
envs: process.env
|
|
26
|
+
})).exitCode === 0;
|
|
27
|
+
}
|
|
28
|
+
async function createInitialCommit(cwd) {
|
|
29
|
+
await runCommandSilently({
|
|
30
|
+
command: "git",
|
|
31
|
+
args: ["add", "-A"],
|
|
32
|
+
cwd,
|
|
33
|
+
envs: process.env
|
|
34
|
+
});
|
|
35
|
+
return (await runCommandSilently({
|
|
36
|
+
command: "git",
|
|
37
|
+
args: [
|
|
38
|
+
"commit",
|
|
39
|
+
"-m",
|
|
40
|
+
"Initial commit from Vite+"
|
|
41
|
+
],
|
|
42
|
+
cwd,
|
|
43
|
+
envs: process.env
|
|
44
|
+
})).exitCode === 0;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/create/command.ts
|
|
20
48
|
async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
21
49
|
const cwd = parentDir ? path.join(options.cwd, parentDir) : options.cwd;
|
|
22
50
|
const existingDirs = /* @__PURE__ */ new Set();
|
|
@@ -32,10 +60,14 @@ async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
|
32
60
|
cwd
|
|
33
61
|
});
|
|
34
62
|
let projectDir;
|
|
63
|
+
let currentDirPackageJsonWritten = false;
|
|
35
64
|
let minDepth = Infinity;
|
|
36
65
|
for (const [filePath, pathAccess] of Object.entries(result.pathAccesses)) if (pathAccess.write && filePath.endsWith("package.json") && !filePath.includes("node_modules")) {
|
|
37
66
|
const dir = path.dirname(filePath);
|
|
38
|
-
if (dir === "." || dir === "")
|
|
67
|
+
if (dir === "." || dir === "") {
|
|
68
|
+
currentDirPackageJsonWritten = true;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
39
71
|
if (existingDirs.has(dir)) continue;
|
|
40
72
|
const depth = dir.split(path.sep).length;
|
|
41
73
|
if (depth < minDepth) {
|
|
@@ -43,6 +75,7 @@ async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
|
43
75
|
projectDir = dir;
|
|
44
76
|
}
|
|
45
77
|
}
|
|
78
|
+
if (!projectDir && currentDirPackageJsonWritten) projectDir = ".";
|
|
46
79
|
if (parentDir && projectDir) projectDir = path.join(parentDir, projectDir);
|
|
47
80
|
return {
|
|
48
81
|
exitCode: result.exitCode,
|
|
@@ -3807,6 +3840,18 @@ function setPackageName(projectDir, packageName) {
|
|
|
3807
3840
|
return pkg;
|
|
3808
3841
|
});
|
|
3809
3842
|
}
|
|
3843
|
+
const RENAME_FILES = {
|
|
3844
|
+
_gitignore: ".gitignore",
|
|
3845
|
+
_npmrc: ".npmrc",
|
|
3846
|
+
"_yarnrc.yml": ".yarnrc.yml"
|
|
3847
|
+
};
|
|
3848
|
+
/** Rename underscore-prefixed scaffold files to their dotfile names in `projectDir`. */
|
|
3849
|
+
function renameFiles(projectDir) {
|
|
3850
|
+
for (const [from, to] of Object.entries(RENAME_FILES)) {
|
|
3851
|
+
const fromPath = path.join(projectDir, from);
|
|
3852
|
+
if (fs.existsSync(fromPath)) fs.renameSync(fromPath, path.join(projectDir, to));
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3810
3855
|
/**
|
|
3811
3856
|
* Make sure the scaffolded project's `.gitignore` excludes `node_modules`.
|
|
3812
3857
|
*
|
|
@@ -4232,6 +4277,7 @@ async function executeBundledTemplate(workspaceInfo, templateInfo) {
|
|
|
4232
4277
|
if (error.code === "ENOENT") throw new Error(`bundled template directory not found: ${templateInfo.localPath}`, { cause: error });
|
|
4233
4278
|
throw error;
|
|
4234
4279
|
}
|
|
4280
|
+
renameFiles(destDir);
|
|
4235
4281
|
try {
|
|
4236
4282
|
setPackageName(destDir, templateInfo.packageName);
|
|
4237
4283
|
} catch {}
|
|
@@ -4315,17 +4361,6 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4315
4361
|
projectDir: templateInfo.targetDir
|
|
4316
4362
|
};
|
|
4317
4363
|
}
|
|
4318
|
-
const RENAME_FILES = {
|
|
4319
|
-
_gitignore: ".gitignore",
|
|
4320
|
-
_npmrc: ".npmrc",
|
|
4321
|
-
"_yarnrc.yml": ".yarnrc.yml"
|
|
4322
|
-
};
|
|
4323
|
-
function renameFiles(projectDir) {
|
|
4324
|
-
for (const [from, to] of Object.entries(RENAME_FILES)) {
|
|
4325
|
-
const fromPath = path.join(projectDir, from);
|
|
4326
|
-
if (fs.existsSync(fromPath)) fs.renameSync(fromPath, path.join(projectDir, to));
|
|
4327
|
-
}
|
|
4328
|
-
}
|
|
4329
4364
|
function getScopeFromPackageName(packageName) {
|
|
4330
4365
|
if (packageName.startsWith("@")) return packageName.split("/")[0];
|
|
4331
4366
|
return "";
|
|
@@ -4368,6 +4403,14 @@ const helpMessage = renderCliDoc({
|
|
|
4368
4403
|
label: "--editor NAME",
|
|
4369
4404
|
description: "Write editor config files for the specified editor."
|
|
4370
4405
|
},
|
|
4406
|
+
{
|
|
4407
|
+
label: "--git",
|
|
4408
|
+
description: "Initialize a git repository with an initial commit"
|
|
4409
|
+
},
|
|
4410
|
+
{
|
|
4411
|
+
label: "--no-git",
|
|
4412
|
+
description: "Skip git repository initialization"
|
|
4413
|
+
},
|
|
4371
4414
|
{
|
|
4372
4415
|
label: "--hooks",
|
|
4373
4416
|
description: "Set up pre-commit hooks (default in non-interactive mode)"
|
|
@@ -4522,7 +4565,8 @@ function parseArgs() {
|
|
|
4522
4565
|
"all",
|
|
4523
4566
|
"interactive",
|
|
4524
4567
|
"hooks",
|
|
4525
|
-
"verbose"
|
|
4568
|
+
"verbose",
|
|
4569
|
+
"git"
|
|
4526
4570
|
],
|
|
4527
4571
|
string: [
|
|
4528
4572
|
"directory",
|
|
@@ -4542,6 +4586,7 @@ function parseArgs() {
|
|
|
4542
4586
|
verbose: parsed.verbose || false,
|
|
4543
4587
|
agent: parsed.agent,
|
|
4544
4588
|
editor: parsed.editor,
|
|
4589
|
+
git: parsed.git,
|
|
4545
4590
|
hooks: parsed.hooks,
|
|
4546
4591
|
packageManager: parsed["package-manager"]
|
|
4547
4592
|
},
|
|
@@ -4791,6 +4836,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4791
4836
|
editor: options.editor,
|
|
4792
4837
|
onCancel: () => cancelAndExit()
|
|
4793
4838
|
});
|
|
4839
|
+
const shouldSetupGit = await promptGitInit(options);
|
|
4794
4840
|
if (!isMonorepo) shouldSetupHooks = await promptGitHooks(options);
|
|
4795
4841
|
const createProgress = options.interactive && compactOutput ? spinner({ indicator: "timer" }) : void 0;
|
|
4796
4842
|
let createProgressStarted = false;
|
|
@@ -4840,7 +4886,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4840
4886
|
resumeCreateProgress();
|
|
4841
4887
|
}
|
|
4842
4888
|
if (templateInfo.command === BuiltinTemplate.monorepo || isBundledMonorepo) {
|
|
4843
|
-
let shouldInitGit =
|
|
4889
|
+
let shouldInitGit = shouldSetupGit;
|
|
4844
4890
|
if (options.interactive && !compactOutput) {
|
|
4845
4891
|
pauseCreateProgress();
|
|
4846
4892
|
const selected = await confirm({
|
|
@@ -4852,7 +4898,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4852
4898
|
log$1.info("Operation cancelled. Skipping git initialization");
|
|
4853
4899
|
shouldInitGit = false;
|
|
4854
4900
|
} else shouldInitGit = selected;
|
|
4855
|
-
} else if (!compactOutput) log$1.info("Initializing git repository (default: yes)");
|
|
4901
|
+
} else if (shouldInitGit && !compactOutput) log$1.info("Initializing git repository (default: yes)");
|
|
4856
4902
|
updateCreateProgress("Creating monorepo");
|
|
4857
4903
|
await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
|
|
4858
4904
|
const result = isBundledMonorepo ? await executeBundledTemplate(workspaceInfo, {
|
|
@@ -4905,6 +4951,10 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4905
4951
|
workspaceInfo.rootDir = fullPath;
|
|
4906
4952
|
updateCreateProgress("Integrating monorepo");
|
|
4907
4953
|
rewriteMonorepo(workspaceInfo, void 0, compactOutput);
|
|
4954
|
+
if (shouldSetupGit) {
|
|
4955
|
+
updateCreateProgress("Initializing git repository");
|
|
4956
|
+
await initGitRepository(fullPath);
|
|
4957
|
+
}
|
|
4908
4958
|
if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
|
|
4909
4959
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
|
|
4910
4960
|
updateCreateProgress("Installing dependencies");
|
|
@@ -4915,6 +4965,10 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4915
4965
|
});
|
|
4916
4966
|
updateCreateProgress("Formatting code");
|
|
4917
4967
|
await runViteFmt(fullPath, options.interactive, void 0, { silent: compactOutput });
|
|
4968
|
+
if (shouldSetupGit) {
|
|
4969
|
+
updateCreateProgress("Creating initial commit");
|
|
4970
|
+
if (!await createInitialCommit(fullPath)) log$1.warn("Initial commit failed. Check your git user.name/user.email config");
|
|
4971
|
+
}
|
|
4918
4972
|
clearCreateProgress();
|
|
4919
4973
|
showCreateSummary({
|
|
4920
4974
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
@@ -5056,11 +5110,20 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5056
5110
|
});
|
|
5057
5111
|
updateCreateProgress("Formatting code");
|
|
5058
5112
|
await runViteFmt(workspaceInfo.rootDir, options.interactive, [projectDir], { silent: compactOutput });
|
|
5113
|
+
if (shouldSetupGit) {
|
|
5114
|
+
updateCreateProgress("Creating initial commit");
|
|
5115
|
+
await initGitRepository(workspaceInfo.rootDir);
|
|
5116
|
+
await createInitialCommit(workspaceInfo.rootDir);
|
|
5117
|
+
}
|
|
5059
5118
|
} else {
|
|
5060
5119
|
if (shouldMigrateLintFmtTools) await installAndMigrate(fullPath);
|
|
5061
5120
|
updateCreateProgress("Applying Vite+ project setup");
|
|
5062
5121
|
rewriteStandaloneProject(fullPath, workspaceInfo, void 0, compactOutput);
|
|
5063
5122
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
5123
|
+
if (shouldSetupGit) {
|
|
5124
|
+
updateCreateProgress("Initializing git repository");
|
|
5125
|
+
await initGitRepository(fullPath);
|
|
5126
|
+
}
|
|
5064
5127
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
|
|
5065
5128
|
updateCreateProgress("Installing dependencies");
|
|
5066
5129
|
installSummary = await runViteInstall(fullPath, options.interactive, installArgs, {
|
|
@@ -5070,6 +5133,10 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5070
5133
|
});
|
|
5071
5134
|
updateCreateProgress("Formatting code");
|
|
5072
5135
|
await runViteFmt(fullPath, options.interactive, void 0, { silent: compactOutput });
|
|
5136
|
+
if (shouldSetupGit) {
|
|
5137
|
+
updateCreateProgress("Creating initial commit");
|
|
5138
|
+
if (!await createInitialCommit(fullPath)) log$1.warn("Initial commit failed. Check your git user.name/user.email config");
|
|
5139
|
+
}
|
|
5073
5140
|
}
|
|
5074
5141
|
clearCreateProgress();
|
|
5075
5142
|
showCreateSummary({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PackUserConfig } from "./pack-
|
|
1
|
+
import { t as PackUserConfig } from "./pack-K7H72Cum.js";
|
|
2
2
|
import { ConfigEnv } from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
import { PluginOption, UserConfig } from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
import { OxfmtConfig } from "oxfmt";
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-IMCGDS2K.js";
|
|
2
2
|
export { defineConfig, lazyPlugins };
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-CzWdQTt2.js";
|
|
2
2
|
export { defineConfig, lazyPlugins };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-IMCGDS2K.js";
|
|
2
2
|
export * from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { defineConfig, lazyPlugins };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-CzWdQTt2.js";
|
|
2
2
|
export * from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { defineConfig, lazyPlugins };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as stripAnsi } from "./strip-ansi-
|
|
2
|
-
import { t as sliceAnsi } from "./slice-ansi-
|
|
3
|
-
import { t as wrapAnsi } from "./wrap-ansi-
|
|
1
|
+
import { t as stripAnsi } from "./strip-ansi-D-eYYcD2.js";
|
|
2
|
+
import { t as sliceAnsi } from "./slice-ansi-e4todZeH.js";
|
|
3
|
+
import { t as wrapAnsi } from "./wrap-ansi-DtUeUCjE.js";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
//#region ../../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region src/utils/constants.ts
|
|
3
|
-
const VITE_PLUS_NAME = "vite-plus";
|
|
4
|
-
const VITE_PLUS_VERSION = process.env.VP_VERSION || "latest";
|
|
5
|
-
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
6
|
-
vite: "npm:@voidzero-dev/vite-plus-core@latest",
|
|
7
|
-
vitest: "npm:@voidzero-dev/vite-plus-test@latest"
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* When VP_FORCE_MIGRATE is set, force full dependency rewriting
|
|
11
|
-
* even for projects already using vite-plus. Used by ecosystem CI to
|
|
12
|
-
* override dependencies with locally built tgz packages.
|
|
13
|
-
*/
|
|
14
|
-
function isForceOverrideMode() {
|
|
15
|
-
return process.env.VP_FORCE_MIGRATE === "1";
|
|
16
|
-
}
|
|
17
|
-
const require = createRequire(import.meta.url);
|
|
18
|
-
function resolve(path) {
|
|
19
|
-
return require.resolve(path, { paths: [process.cwd(), import.meta.dirname] });
|
|
20
|
-
}
|
|
21
|
-
const BASEURL_TSCONFIG_WARNING = "Skipped typeAware/typeCheck: tsconfig.json contains baseUrl which is not yet supported by the oxlint type checker.\n Run `npx @andrewbranch/ts5to6 --fixBaseUrl .` to remove baseUrl from your tsconfig.";
|
|
22
|
-
const DEFAULT_ENVS = {
|
|
23
|
-
JS_RUNTIME_VERSION: process.versions.node,
|
|
24
|
-
JS_RUNTIME_NAME: process.release.name,
|
|
25
|
-
NODE_PACKAGE_MANAGER: "vite-plus"
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
1
|
//#region ../../node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
29
2
|
/**
|
|
30
3
|
* Creates a JSON scanner on the given text.
|
|
@@ -1250,4 +1223,4 @@ function applyEdits(text, edits) {
|
|
|
1250
1223
|
return text;
|
|
1251
1224
|
}
|
|
1252
1225
|
//#endregion
|
|
1253
|
-
export {
|
|
1226
|
+
export { modify as n, parse as r, applyEdits as t };
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-
|
|
4
|
-
import { C as migratePrettierToOxfmt, D as rewriteMonorepo, E as promptPrettierMigration, H as
|
|
5
|
-
import { t as lib_default } from "../lib-
|
|
6
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
7
|
-
import { r as createMigrationReport } from "../report-
|
|
8
|
-
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-
|
|
9
|
-
import { t as renderCliDoc } from "../help-
|
|
2
|
+
import { o as isForceOverrideMode } from "../constants-kDaYqyWd.js";
|
|
3
|
+
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-D_Kg-AA6.js";
|
|
4
|
+
import { $ as log$1, C as migratePrettierToOxfmt, D as rewriteMonorepo, E as promptPrettierMigration, G as displayRelative, H as runViteInstall, I as cancelAndExit, J as PackageManager, L as defaultInteractive, M as warnPackageLevelEslint, N as warnPackageLevelPrettier, R as downloadPackageManager, S as migrateNodeVersionManagerFile, T as promptEslintMigration, U as selectPackageManager, W as upgradeYarn, Y as require_semver, Z as confirm, a as writeAgentInstructions, b as mergeViteConfigFiles, c as checkVitestVersion, d as detectEslintProject, f as detectFramework, g as hasFrameworkShim, j as warnLegacyEslintConfig, k as rewriteStandaloneProject, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as select, o as addFrameworkShim, ot as q, p as detectNodeVersionManagerFile, r as selectAgentTargetPaths, rt as spinner, s as checkViteVersion, t as detectAgentConflicts, tt as outro, u as confirmPrettierMigration, w as preflightGitHooksSetup, x as migrateEslintToOxlint, y as installGitHooks, z as promptGitHooks } from "../agent-BWLe0i9g.js";
|
|
5
|
+
import { t as lib_default } from "../lib-DpwyUJWo.js";
|
|
6
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-BoLLED6j.js";
|
|
7
|
+
import { r as createMigrationReport } from "../report-CYPv1VK1.js";
|
|
8
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-Bi_9spVt.js";
|
|
9
|
+
import { t as renderCliDoc } from "../help-DK5wuu34.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { styleText } from "node:util";
|
|
12
12
|
//#region src/migration/bin.ts
|
|
@@ -308,7 +308,7 @@ function showMigrationSummary(options) {
|
|
|
308
308
|
async function checkRolldownCompatibility(rootDir, report) {
|
|
309
309
|
try {
|
|
310
310
|
const { resolveConfig } = await import("../index.js");
|
|
311
|
-
const { checkManualChunksCompat } = await import("../compat-
|
|
311
|
+
const { checkManualChunksCompat } = await import("../compat-OlmU9EQz.js");
|
|
312
312
|
checkManualChunksCompat((await resolveConfig({
|
|
313
313
|
root: rootDir,
|
|
314
314
|
logLevel: "silent",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { r as VITE_PLUS_NAME } from "./constants-kDaYqyWd.js";
|
|
2
|
+
//#region src/oxlint-plugin-config.ts
|
|
3
|
+
const VITE_PLUS_OXLINT_PLUGIN_NAME = VITE_PLUS_NAME;
|
|
4
|
+
const VITE_PLUS_OXLINT_PLUGIN_SPECIFIER = `${VITE_PLUS_NAME}/oxlint-plugin`;
|
|
5
|
+
const PREFER_VITE_PLUS_IMPORTS_RULE_NAME = "prefer-vite-plus-imports";
|
|
6
|
+
const PREFER_VITE_PLUS_IMPORTS_RULE = `${VITE_PLUS_OXLINT_PLUGIN_NAME}/${PREFER_VITE_PLUS_IMPORTS_RULE_NAME}`;
|
|
7
|
+
function hasVitePlusPlugin(entry) {
|
|
8
|
+
if (typeof entry === "string") return entry === VITE_PLUS_OXLINT_PLUGIN_SPECIFIER;
|
|
9
|
+
return entry.specifier === VITE_PLUS_OXLINT_PLUGIN_SPECIFIER;
|
|
10
|
+
}
|
|
11
|
+
function isRuleRecord(value) {
|
|
12
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13
|
+
}
|
|
14
|
+
function ensureVitePlusImportRuleDefaults(config) {
|
|
15
|
+
const jsPlugins = Array.isArray(config.jsPlugins) ? [...config.jsPlugins] : [];
|
|
16
|
+
if (!jsPlugins.some(hasVitePlusPlugin)) jsPlugins.push({
|
|
17
|
+
name: VITE_PLUS_OXLINT_PLUGIN_NAME,
|
|
18
|
+
specifier: VITE_PLUS_OXLINT_PLUGIN_SPECIFIER
|
|
19
|
+
});
|
|
20
|
+
const rules = isRuleRecord(config.rules) ? { ...config.rules } : {};
|
|
21
|
+
if (!(PREFER_VITE_PLUS_IMPORTS_RULE in rules)) rules[PREFER_VITE_PLUS_IMPORTS_RULE] = "error";
|
|
22
|
+
return {
|
|
23
|
+
...config,
|
|
24
|
+
jsPlugins,
|
|
25
|
+
rules
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function createDefaultVitePlusLintConfig(options) {
|
|
29
|
+
const config = ensureVitePlusImportRuleDefaults({});
|
|
30
|
+
if (options?.includeTypeAwareDefaults) config.options = {
|
|
31
|
+
typeAware: true,
|
|
32
|
+
typeCheck: true
|
|
33
|
+
};
|
|
34
|
+
return config;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { ensureVitePlusImportRuleDefaults as i, VITE_PLUS_OXLINT_PLUGIN_NAME as n, createDefaultVitePlusLintConfig as r, PREFER_VITE_PLUS_IMPORTS_RULE_NAME as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as _$_oxlint_plugins0 from "@oxlint/plugins";
|
|
2
|
+
|
|
3
|
+
//#region src/oxlint-plugin.d.ts
|
|
4
|
+
declare function rewriteVitePlusImportSpecifier(specifier: string): string | null;
|
|
5
|
+
declare const preferVitePlusImportsRule: _$_oxlint_plugins0.Rule;
|
|
6
|
+
declare const plugin: _$_oxlint_plugins0.Plugin;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { plugin as default, preferVitePlusImportsRule, rewriteVitePlusImportSpecifier };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { n as VITE_PLUS_OXLINT_PLUGIN_NAME, t as PREFER_VITE_PLUS_IMPORTS_RULE_NAME } from "./oxlint-plugin-config-BkQeR4FR.js";
|
|
2
|
+
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
3
|
+
//#region src/oxlint-plugin.ts
|
|
4
|
+
function rewriteVitePlusImportSpecifier(specifier) {
|
|
5
|
+
if (specifier === "vite") return "vite-plus";
|
|
6
|
+
if (specifier.startsWith("vite/")) return `vite-plus/${specifier.slice(5)}`;
|
|
7
|
+
if (specifier === "vitest/config") return "vite-plus";
|
|
8
|
+
if (specifier === "vitest") return "vite-plus/test";
|
|
9
|
+
if (specifier.startsWith("vitest/")) return `vite-plus/test/${specifier.slice(7)}`;
|
|
10
|
+
if (specifier === "@vitest/browser") return "vite-plus/test/browser";
|
|
11
|
+
const browserSubpathRewrites = {
|
|
12
|
+
"@vitest/browser/context": "vite-plus/test/browser/context",
|
|
13
|
+
"@vitest/browser/client": "vite-plus/test/client",
|
|
14
|
+
"@vitest/browser/locators": "vite-plus/test/locators"
|
|
15
|
+
};
|
|
16
|
+
if (specifier in browserSubpathRewrites) return browserSubpathRewrites[specifier];
|
|
17
|
+
for (const [prefix, provider] of [
|
|
18
|
+
["@vitest/browser-playwright", "playwright"],
|
|
19
|
+
["@vitest/browser-preview", "preview"],
|
|
20
|
+
["@vitest/browser-webdriverio", "webdriverio"]
|
|
21
|
+
]) {
|
|
22
|
+
if (specifier === prefix) return `vite-plus/test/${prefix.slice(8)}`;
|
|
23
|
+
if (specifier === `${prefix}/context`) return "vite-plus/test/browser/context";
|
|
24
|
+
if (specifier === `${prefix}/provider`) return `vite-plus/test/browser/providers/${provider}`;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function quoteSpecifier(literal, replacement) {
|
|
29
|
+
const quote = literal.raw?.startsWith("'") ? "'" : "\"";
|
|
30
|
+
return `${quote}${replacement}${quote}`;
|
|
31
|
+
}
|
|
32
|
+
function maybeReportLiteral(context, literal) {
|
|
33
|
+
if (!literal || literal.type !== "Literal" || typeof literal.value !== "string") return;
|
|
34
|
+
const replacement = rewriteVitePlusImportSpecifier(literal.value);
|
|
35
|
+
if (!replacement) return;
|
|
36
|
+
context.report({
|
|
37
|
+
node: literal,
|
|
38
|
+
messageId: "preferVitePlusImports",
|
|
39
|
+
data: {
|
|
40
|
+
from: literal.value,
|
|
41
|
+
to: replacement
|
|
42
|
+
},
|
|
43
|
+
fix(fixer) {
|
|
44
|
+
return fixer.replaceText(literal, quoteSpecifier(literal, replacement));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const preferVitePlusImportsRule = defineRule({
|
|
49
|
+
meta: {
|
|
50
|
+
type: "problem",
|
|
51
|
+
docs: {
|
|
52
|
+
description: "Prefer vite-plus module specifiers over vite and vitest packages.",
|
|
53
|
+
recommended: true,
|
|
54
|
+
url: "https://github.com/voidzero-dev/vite-plus/issues/1301"
|
|
55
|
+
},
|
|
56
|
+
fixable: "code",
|
|
57
|
+
messages: { preferVitePlusImports: "Use '{{to}}' instead of '{{from}}' in Vite+ projects." }
|
|
58
|
+
},
|
|
59
|
+
createOnce(context) {
|
|
60
|
+
return {
|
|
61
|
+
ImportDeclaration(node) {
|
|
62
|
+
maybeReportLiteral(context, node.source);
|
|
63
|
+
},
|
|
64
|
+
ExportAllDeclaration(node) {
|
|
65
|
+
maybeReportLiteral(context, node.source);
|
|
66
|
+
},
|
|
67
|
+
ExportNamedDeclaration(node) {
|
|
68
|
+
maybeReportLiteral(context, node.source);
|
|
69
|
+
},
|
|
70
|
+
ImportExpression(node) {
|
|
71
|
+
maybeReportLiteral(context, node.source);
|
|
72
|
+
},
|
|
73
|
+
TSImportType(node) {
|
|
74
|
+
maybeReportLiteral(context, node.source);
|
|
75
|
+
},
|
|
76
|
+
TSExternalModuleReference(node) {
|
|
77
|
+
maybeReportLiteral(context, node.expression);
|
|
78
|
+
},
|
|
79
|
+
TSModuleDeclaration(node) {
|
|
80
|
+
if (node.global) return;
|
|
81
|
+
maybeReportLiteral(context, node.id);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const plugin = definePlugin({
|
|
87
|
+
meta: { name: VITE_PLUS_OXLINT_PLUGIN_NAME },
|
|
88
|
+
rules: { [PREFER_VITE_PLUS_IMPORTS_RULE_NAME]: preferVitePlusImportsRule }
|
|
89
|
+
});
|
|
90
|
+
//#endregion
|
|
91
|
+
export { plugin as default, preferVitePlusImportsRule, rewriteVitePlusImportSpecifier };
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as resolveViteConfig } from "./resolve-vite-config-
|
|
2
|
+
import { i as resolveViteConfig } from "./resolve-vite-config-C5AjksTj.js";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "@voidzero-dev/vite-plus-core/pack";
|
|
5
5
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
package/dist/pack.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ansiStyles, i as isWide, r as isFullWidth } from "./strip-ansi-
|
|
1
|
+
import { a as ansiStyles, i as isWide, r as isFullWidth } from "./strip-ansi-D-eYYcD2.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/is-fullwidth-code-point@5.1.0/node_modules/is-fullwidth-code-point/index.js
|
|
3
3
|
function isFullwidthCodePoint(codePoint) {
|
|
4
4
|
if (!Number.isInteger(codePoint)) return false;
|
package/dist/staged/bin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import { a as printHeader, n as errorMsg, r as log } from "../terminal-
|
|
3
|
-
import { i as resolveViteConfig } from "../resolve-vite-config-
|
|
4
|
-
import { t as lib_default } from "../lib-
|
|
5
|
-
import { t as renderCliDoc } from "../help-
|
|
2
|
+
import { a as printHeader, n as errorMsg, r as log } from "../terminal-D_Kg-AA6.js";
|
|
3
|
+
import { i as resolveViteConfig } from "../resolve-vite-config-C5AjksTj.js";
|
|
4
|
+
import { t as lib_default } from "../lib-DpwyUJWo.js";
|
|
5
|
+
import { t as renderCliDoc } from "../help-DK5wuu34.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import path, { delimiter, dirname, resolve } from "node:path";
|
|
8
8
|
import { constants } from "node:fs";
|
|
@@ -1811,9 +1811,9 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1811
1811
|
this.logger.options.color = this.options.color;
|
|
1812
1812
|
}
|
|
1813
1813
|
async render() {
|
|
1814
|
-
const { createLogUpdate } = await import("../log-update-
|
|
1815
|
-
const { default: truncate } = await import("../cli-truncate-
|
|
1816
|
-
const { default: wrap } = await import("../wrap-ansi-
|
|
1814
|
+
const { createLogUpdate } = await import("../log-update-NRrY6krx.js");
|
|
1815
|
+
const { default: truncate } = await import("../cli-truncate-B62YnW2m.js");
|
|
1816
|
+
const { default: wrap } = await import("../wrap-ansi-3S3qJ7j8.js");
|
|
1817
1817
|
this.updater = createLogUpdate(this.logger.process.stdout);
|
|
1818
1818
|
this.truncate = truncate;
|
|
1819
1819
|
this.wrap = wrap;
|
|
@@ -6179,7 +6179,7 @@ const jsonParse = async (filename) => {
|
|
|
6179
6179
|
const yamlParse = async (filename) => {
|
|
6180
6180
|
const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filename));
|
|
6181
6181
|
try {
|
|
6182
|
-
const [YAML, content] = await Promise.all([import("../dist-
|
|
6182
|
+
const [YAML, content] = await Promise.all([import("../dist-DZfItHAr.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1)), readFile(filename)]);
|
|
6183
6183
|
const yaml = YAML.parse(content);
|
|
6184
6184
|
return isPackageFile ? yaml[CONFIG_NAME] : yaml;
|
|
6185
6185
|
} catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
|
|
2
|
-
import { n as modify, r as parse, t as applyEdits } from "./main-
|
|
2
|
+
import { n as modify, r as parse, t as applyEdits } from "./main-DhsO6ndq.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
package/dist/version.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { a as printHeader, r as log, t as accent } from "./terminal-
|
|
3
|
-
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-
|
|
4
|
-
import { t as renderCliDoc } from "./help-
|
|
1
|
+
import "./constants-kDaYqyWd.js";
|
|
2
|
+
import { a as printHeader, r as log, t as accent } from "./terminal-D_Kg-AA6.js";
|
|
3
|
+
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-BoLLED6j.js";
|
|
4
|
+
import { t as renderCliDoc } from "./help-DK5wuu34.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "0.
|
|
8
|
+
var version = "0.1.22";
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/version.ts
|
|
11
11
|
/** Tool display names in the order shown by `vp --version`. */
|
package/dist/versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { t as require_dist } from "./dist-
|
|
3
|
-
import { c as editJsonFile, d as writeJsonFile, r as getScopeFromPackageName, u as readJsonFile } from "./package-
|
|
1
|
+
import { $ as log, F as readYamlFile, J as PackageManager, P as editYamlFile, et as multiselect, nt as select, ot as q } from "./agent-BWLe0i9g.js";
|
|
2
|
+
import { t as require_dist } from "./dist-owlRxmBM.js";
|
|
3
|
+
import { c as editJsonFile, d as writeJsonFile, r as getScopeFromPackageName, u as readJsonFile } from "./package-BoLLED6j.js";
|
|
4
4
|
import path, { posix, win32 } from "node:path";
|
|
5
5
|
import { detectWorkspace } from "../binding/index.js";
|
|
6
6
|
import * as actualFS from "node:fs";
|
|
@@ -5809,9 +5809,8 @@ function updatePackageJsonWithDeps(rootDir, projectDir, dependencies, dependency
|
|
|
5809
5809
|
}
|
|
5810
5810
|
function updateWorkspaceConfig(projectPath, workspaceInfo) {
|
|
5811
5811
|
for (const pattern of workspaceInfo.workspacePatterns) if (minimatch(projectPath, pattern)) return;
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
else pattern = `${pattern}/*`;
|
|
5812
|
+
const parentDir = path.dirname(projectPath);
|
|
5813
|
+
const pattern = parentDir === "." ? projectPath : `${parentDir}/*`;
|
|
5815
5814
|
if (workspaceInfo.packageManager === PackageManager.pnpm) editYamlFile(path.join(workspaceInfo.rootDir, "pnpm-workspace.yaml"), (doc) => {
|
|
5816
5815
|
let packages = doc.getIn(["packages"]);
|
|
5817
5816
|
if (!packages) packages = new import_dist.YAMLSeq();
|