vite-plus 0.1.21-alpha.0 → 0.1.21-alpha.2
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/dist/{agent-C8Me6C5u.js → agent-Ch4JIuSB.js} +181 -60
- package/dist/bin.js +1 -1
- package/dist/config/bin.js +1 -1
- package/dist/create/bin.js +3 -45
- package/dist/migration/bin.js +2 -2
- package/dist/staged/bin.js +88 -96
- package/dist/{tsconfig-DQTf06oN.js → tsconfig-BQeK6Jxp.js} +21 -2
- package/dist/versions.js +4 -4
- package/dist/{workspace-BSMGz0AZ.js → workspace-DxqnDgi4.js} +7 -7
- package/docs/_data/team.ts +121 -0
- package/docs/package.json +1 -1
- package/docs/pnpm-lock.yaml +1 -0
- package/package.json +17 -17
- package/docs/_data/team.js +0 -122
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
|
|
2
2
|
import { c as VITE_PLUS_VERSION, i as BASEURL_TSCONFIG_WARNING, l as isForceOverrideMode, o as VITE_PLUS_NAME, s as VITE_PLUS_OVERRIDE_PACKAGES } from "./main-A6UrSTYb.js";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as runCommandSilently, n as hasBaseUrlInTsconfig, o as require_cross_spawn, r as removeDeprecatedTsconfigFalseOption, t as findTsconfigFiles } from "./tsconfig-BQeK6Jxp.js";
|
|
4
4
|
import { t as accent } from "./terminal-CxTMfsxZ.js";
|
|
5
5
|
import { t as require_dist } from "./dist-DjG9AYbK.js";
|
|
6
6
|
import { c as editJsonFile, l as isJsonFile, n as detectPackageMetadata, u as readJsonFile } from "./package-CrKanQYM.js";
|
|
@@ -845,21 +845,11 @@ const S_STEP_ACTIVE = S_POINTER_ACTIVE;
|
|
|
845
845
|
const S_STEP_CANCEL = unicodeOr("■", "x");
|
|
846
846
|
const S_STEP_ERROR = unicodeOr("▲", "x");
|
|
847
847
|
const S_STEP_SUBMIT = unicodeOr("◇", "o");
|
|
848
|
-
unicodeOr("┌", "T");
|
|
849
848
|
const S_BAR = unicodeOr("│", "|");
|
|
850
849
|
const S_BAR_END = unicodeOr("└", "—");
|
|
851
|
-
unicodeOr("┐", "T");
|
|
852
|
-
unicodeOr("┘", "—");
|
|
853
850
|
const S_CHECKBOX_ACTIVE = unicodeOr("◻", "[•]");
|
|
854
851
|
const S_CHECKBOX_SELECTED = unicodeOr("◼", "[+]");
|
|
855
852
|
const S_CHECKBOX_INACTIVE = unicodeOr("◻", "[ ]");
|
|
856
|
-
unicodeOr("▪", "•");
|
|
857
|
-
unicodeOr("─", "-");
|
|
858
|
-
unicodeOr("╮", "+");
|
|
859
|
-
unicodeOr("├", "+");
|
|
860
|
-
unicodeOr("╯", "+");
|
|
861
|
-
unicodeOr("╰", "+");
|
|
862
|
-
unicodeOr("╭", "+");
|
|
863
853
|
const S_INFO = unicodeOr("●", "•");
|
|
864
854
|
const S_SUCCESS = unicodeOr("◆", "*");
|
|
865
855
|
const S_WARN = unicodeOr("▲", "!");
|
|
@@ -1611,7 +1601,6 @@ const spinner = ({ indicator = "dots", onCancel, output = process.stdout, cancel
|
|
|
1611
1601
|
}
|
|
1612
1602
|
};
|
|
1613
1603
|
};
|
|
1614
|
-
unicodeOr("─", "-"), unicodeOr("━", "="), unicodeOr("█", "#");
|
|
1615
1604
|
const computeLabel = (label, format) => {
|
|
1616
1605
|
if (!label.includes("\n")) return format(label);
|
|
1617
1606
|
return label.split("\n").map((line) => format(line)).join("\n");
|
|
@@ -3403,6 +3392,10 @@ const BROWSER_PROVIDER_PEER_DEPS = {
|
|
|
3403
3392
|
"@vitest/browser-playwright": "playwright",
|
|
3404
3393
|
"@vitest/browser-webdriverio": "webdriverio"
|
|
3405
3394
|
};
|
|
3395
|
+
const PUBLIC_PEER_DEPENDENCY_FALLBACKS = {
|
|
3396
|
+
vite: "*",
|
|
3397
|
+
vitest: "*"
|
|
3398
|
+
};
|
|
3406
3399
|
function warnMigration(message, report) {
|
|
3407
3400
|
addMigrationWarning(report, message);
|
|
3408
3401
|
if (!report) log.warn(message);
|
|
@@ -3811,8 +3804,11 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
3811
3804
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
3812
3805
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
3813
3806
|
const packageManager = workspaceInfo.packageManager;
|
|
3807
|
+
const catalogDependencyResolver = createCatalogDependencyResolver(projectPath, packageManager);
|
|
3814
3808
|
let extractedStagedConfig = null;
|
|
3815
3809
|
let remainingPnpmOverrides;
|
|
3810
|
+
let shouldRewritePnpmWorkspaceYaml = false;
|
|
3811
|
+
let shouldAddPnpmWorkspaceVitePlusOverride = false;
|
|
3816
3812
|
let usePnpmWorkspaceYaml = false;
|
|
3817
3813
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
3818
3814
|
if (packageManager === PackageManager.yarn) pkg.resolutions = {
|
|
@@ -3826,8 +3822,8 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
3826
3822
|
else if (packageManager === PackageManager.pnpm) {
|
|
3827
3823
|
usePnpmWorkspaceYaml = !pkg.pnpm;
|
|
3828
3824
|
if (usePnpmWorkspaceYaml) {
|
|
3829
|
-
|
|
3830
|
-
|
|
3825
|
+
shouldRewritePnpmWorkspaceYaml = true;
|
|
3826
|
+
shouldAddPnpmWorkspaceVitePlusOverride = isForceOverrideMode();
|
|
3831
3827
|
}
|
|
3832
3828
|
const overrideKeys = Object.keys(VITE_PLUS_OVERRIDE_PACKAGES);
|
|
3833
3829
|
if (!usePnpmWorkspaceYaml) pkg.pnpm = {
|
|
@@ -3853,7 +3849,7 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
3853
3849
|
}
|
|
3854
3850
|
for (const key of [...overrideKeys, ...REMOVE_PACKAGES]) if (pkg.resolutions?.[key]) delete pkg.resolutions[key];
|
|
3855
3851
|
}
|
|
3856
|
-
extractedStagedConfig = rewritePackageJson(pkg, packageManager, usePnpmWorkspaceYaml, skipStagedMigration);
|
|
3852
|
+
extractedStagedConfig = rewritePackageJson(pkg, packageManager, usePnpmWorkspaceYaml, skipStagedMigration, catalogDependencyResolver);
|
|
3857
3853
|
if (!pkg.devDependencies?.["vite-plus"] || isForceOverrideMode()) {
|
|
3858
3854
|
const version = usePnpmWorkspaceYaml && !VITE_PLUS_VERSION.startsWith("file:") ? "catalog:" : VITE_PLUS_VERSION;
|
|
3859
3855
|
pkg.devDependencies = {
|
|
@@ -3863,7 +3859,9 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
3863
3859
|
}
|
|
3864
3860
|
return pkg;
|
|
3865
3861
|
});
|
|
3862
|
+
if (shouldRewritePnpmWorkspaceYaml) rewritePnpmWorkspaceYaml(projectPath);
|
|
3866
3863
|
if (remainingPnpmOverrides) migratePnpmOverridesToWorkspaceYaml(projectPath, remainingPnpmOverrides);
|
|
3864
|
+
if (shouldAddPnpmWorkspaceVitePlusOverride) migratePnpmOverridesToWorkspaceYaml(projectPath, { [VITE_PLUS_NAME]: VITE_PLUS_VERSION });
|
|
3867
3865
|
if (packageManager === PackageManager.yarn) rewriteYarnrcYml(projectPath);
|
|
3868
3866
|
if (extractedStagedConfig) {
|
|
3869
3867
|
if (mergeStagedConfigToViteConfig(projectPath, extractedStagedConfig, silent, report)) removeLintStagedFromPackageJson(packageJsonPath);
|
|
@@ -3882,11 +3880,12 @@ function rewriteStandaloneProject(projectPath, workspaceInfo, skipStagedMigratio
|
|
|
3882
3880
|
* @param workspaceInfo - The workspace info
|
|
3883
3881
|
*/
|
|
3884
3882
|
function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, report) {
|
|
3883
|
+
const catalogDependencyResolver = createCatalogDependencyResolver(workspaceInfo.rootDir, workspaceInfo.packageManager);
|
|
3885
3884
|
if (workspaceInfo.packageManager === PackageManager.pnpm) rewritePnpmWorkspaceYaml(workspaceInfo.rootDir);
|
|
3886
3885
|
else if (workspaceInfo.packageManager === PackageManager.yarn) rewriteYarnrcYml(workspaceInfo.rootDir);
|
|
3887
3886
|
else if (workspaceInfo.packageManager === PackageManager.bun) rewriteBunCatalog(workspaceInfo.rootDir);
|
|
3888
|
-
rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration);
|
|
3889
|
-
for (const pkg of workspaceInfo.packages) rewriteMonorepoProject(path.join(workspaceInfo.rootDir, pkg.path), workspaceInfo.packageManager, skipStagedMigration, silent, report);
|
|
3887
|
+
rewriteRootWorkspacePackageJson(workspaceInfo.rootDir, workspaceInfo.packageManager, skipStagedMigration, catalogDependencyResolver);
|
|
3888
|
+
for (const pkg of workspaceInfo.packages) rewriteMonorepoProject(path.join(workspaceInfo.rootDir, pkg.path), workspaceInfo.packageManager, skipStagedMigration, silent, report, catalogDependencyResolver);
|
|
3890
3889
|
if (!skipStagedMigration) rewriteLintStagedConfigFile(workspaceInfo.rootDir, report);
|
|
3891
3890
|
cleanupDeprecatedTsconfigOptions(workspaceInfo.rootDir, silent, report);
|
|
3892
3891
|
mergeViteConfigFiles(workspaceInfo.rootDir, silent, report);
|
|
@@ -3900,7 +3899,7 @@ function rewriteMonorepo(workspaceInfo, skipStagedMigration, silent = false, rep
|
|
|
3900
3899
|
* Rewrite monorepo project to add vite-plus dependencies
|
|
3901
3900
|
* @param projectPath - The path to the project
|
|
3902
3901
|
*/
|
|
3903
|
-
function rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration, silent = false, report) {
|
|
3902
|
+
function rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration, silent = false, report, catalogDependencyResolver) {
|
|
3904
3903
|
cleanupDeprecatedTsconfigOptions(projectPath, silent, report);
|
|
3905
3904
|
mergeViteConfigFiles(projectPath, silent, report);
|
|
3906
3905
|
mergeTsdownConfigFile(projectPath, silent, report);
|
|
@@ -3908,7 +3907,7 @@ function rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration
|
|
|
3908
3907
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
3909
3908
|
let extractedStagedConfig = null;
|
|
3910
3909
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
3911
|
-
extractedStagedConfig = rewritePackageJson(pkg, packageManager, true, skipStagedMigration);
|
|
3910
|
+
extractedStagedConfig = rewritePackageJson(pkg, packageManager, true, skipStagedMigration, catalogDependencyResolver);
|
|
3912
3911
|
return pkg;
|
|
3913
3912
|
});
|
|
3914
3913
|
if (extractedStagedConfig) {
|
|
@@ -3924,15 +3923,15 @@ function rewritePnpmWorkspaceYaml(projectPath) {
|
|
|
3924
3923
|
if (!fs.existsSync(pnpmWorkspaceYamlPath)) fs.writeFileSync(pnpmWorkspaceYamlPath, "");
|
|
3925
3924
|
editYamlFile(pnpmWorkspaceYamlPath, (doc) => {
|
|
3926
3925
|
rewriteCatalog(doc);
|
|
3926
|
+
const overrides = doc.getIn(["overrides"]);
|
|
3927
3927
|
for (const key of Object.keys(VITE_PLUS_OVERRIDE_PACKAGES)) {
|
|
3928
|
-
|
|
3929
|
-
if (!version.startsWith("file:")) version = "catalog:";
|
|
3928
|
+
const version = getCatalogDependencySpec(getYamlMapScalarStringValue(overrides, key), VITE_PLUS_OVERRIDE_PACKAGES[key], true);
|
|
3930
3929
|
doc.setIn(["overrides", scalarString(key)], scalarString(version));
|
|
3931
3930
|
}
|
|
3932
|
-
const
|
|
3933
|
-
for (const item of
|
|
3931
|
+
const updatedOverrides = doc.getIn(["overrides"]);
|
|
3932
|
+
for (const item of updatedOverrides.items) if (item.key.value.includes(">")) {
|
|
3934
3933
|
const splits = item.key.value.split(">");
|
|
3935
|
-
if (splits[splits.length - 1].trim() === "vite")
|
|
3934
|
+
if (splits[splits.length - 1].trim() === "vite") updatedOverrides.delete(item.key);
|
|
3936
3935
|
}
|
|
3937
3936
|
let allowAny = doc.getIn(["peerDependencyRules", "allowAny"]);
|
|
3938
3937
|
if (!allowAny) allowAny = new import_dist.YAMLSeq();
|
|
@@ -3968,13 +3967,25 @@ function rewritePnpmWorkspaceYaml(projectPath) {
|
|
|
3968
3967
|
* moved to pnpm-workspace.yaml.
|
|
3969
3968
|
*/
|
|
3970
3969
|
function cleanupPnpmOverridesForWorkspaceYaml(pkg, overrideKeys) {
|
|
3971
|
-
|
|
3970
|
+
const catalogOverrides = {};
|
|
3971
|
+
const overrides = pkg.pnpm?.overrides;
|
|
3972
|
+
for (const key of [...overrideKeys, ...REMOVE_PACKAGES]) {
|
|
3973
|
+
const value = overrides?.[key];
|
|
3974
|
+
if (value) {
|
|
3975
|
+
if (overrideKeys.includes(key) && value.startsWith("catalog:")) catalogOverrides[key] = value;
|
|
3976
|
+
delete overrides[key];
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3972
3979
|
for (const key in pkg.pnpm?.overrides) if (key.includes(">")) {
|
|
3973
3980
|
const splits = key.split(">");
|
|
3974
3981
|
if (splits[splits.length - 1].trim() === "vite") delete pkg.pnpm.overrides[key];
|
|
3975
3982
|
}
|
|
3976
3983
|
let remaining;
|
|
3977
|
-
if (
|
|
3984
|
+
if (Object.keys(catalogOverrides).length > 0) remaining = { ...catalogOverrides };
|
|
3985
|
+
if (pkg.pnpm?.overrides && Object.keys(pkg.pnpm.overrides).length > 0) remaining = {
|
|
3986
|
+
...remaining,
|
|
3987
|
+
...pkg.pnpm.overrides
|
|
3988
|
+
};
|
|
3978
3989
|
delete pkg.pnpm?.overrides;
|
|
3979
3990
|
cleanupPeerDependencyRules(pkg.pnpm?.peerDependencyRules, overrideKeys);
|
|
3980
3991
|
if (pkg.pnpm?.peerDependencyRules && Object.keys(pkg.pnpm.peerDependencyRules).length === 0) delete pkg.pnpm.peerDependencyRules;
|
|
@@ -4021,6 +4032,58 @@ function rewriteYarnrcYml(projectPath) {
|
|
|
4021
4032
|
* Rewrite catalog in pnpm-workspace.yaml or .yarnrc.yml
|
|
4022
4033
|
* @param doc - The document to rewrite
|
|
4023
4034
|
*/
|
|
4035
|
+
function getCatalogDependencySpec(currentValue, version, supportCatalog, options) {
|
|
4036
|
+
if (options?.dependencyField === "peerDependencies") {
|
|
4037
|
+
if (currentValue?.startsWith("catalog:") && options.dependencyName) {
|
|
4038
|
+
const resolved = options.catalogDependencyResolver?.(currentValue, options.dependencyName);
|
|
4039
|
+
if (resolved && !isVitePlusOverrideSpec(resolved)) return resolved;
|
|
4040
|
+
return PUBLIC_PEER_DEPENDENCY_FALLBACKS[options.dependencyName] ?? currentValue;
|
|
4041
|
+
}
|
|
4042
|
+
return currentValue ?? version;
|
|
4043
|
+
}
|
|
4044
|
+
if (options?.dependencyField === "optionalDependencies" && options?.packageManager === PackageManager.yarn) return version;
|
|
4045
|
+
if (!supportCatalog || version.startsWith("file:")) return version;
|
|
4046
|
+
return currentValue?.startsWith("catalog:") ? currentValue : "catalog:";
|
|
4047
|
+
}
|
|
4048
|
+
function isVitePlusOverrideSpec(value) {
|
|
4049
|
+
return Object.values(VITE_PLUS_OVERRIDE_PACKAGES).includes(value) || value.startsWith("npm:@voidzero-dev/vite-plus-");
|
|
4050
|
+
}
|
|
4051
|
+
function createCatalogDependencyResolver(projectPath, packageManager) {
|
|
4052
|
+
if (packageManager === PackageManager.pnpm) {
|
|
4053
|
+
const pnpmWorkspaceYamlPath = path.join(projectPath, "pnpm-workspace.yaml");
|
|
4054
|
+
if (!fs.existsSync(pnpmWorkspaceYamlPath)) return;
|
|
4055
|
+
const doc = readYamlFile(pnpmWorkspaceYamlPath);
|
|
4056
|
+
return createCatalogDependencyResolverFromCatalogs(doc?.catalog, doc?.catalogs);
|
|
4057
|
+
}
|
|
4058
|
+
if (packageManager === PackageManager.yarn) {
|
|
4059
|
+
const yarnrcYmlPath = path.join(projectPath, ".yarnrc.yml");
|
|
4060
|
+
if (!fs.existsSync(yarnrcYmlPath)) return;
|
|
4061
|
+
const doc = readYamlFile(yarnrcYmlPath);
|
|
4062
|
+
return createCatalogDependencyResolverFromCatalogs(doc?.catalog, doc?.catalogs);
|
|
4063
|
+
}
|
|
4064
|
+
if (packageManager === PackageManager.bun) {
|
|
4065
|
+
const packageJsonPath = path.join(projectPath, "package.json");
|
|
4066
|
+
if (!fs.existsSync(packageJsonPath)) return;
|
|
4067
|
+
const pkg = readJsonFile(packageJsonPath);
|
|
4068
|
+
const workspacesObj = pkg.workspaces && !Array.isArray(pkg.workspaces) ? pkg.workspaces : void 0;
|
|
4069
|
+
return (catalogSpec, dependencyName) => {
|
|
4070
|
+
const catalogName = catalogSpec.slice(8);
|
|
4071
|
+
if (catalogName) return workspacesObj?.catalogs?.[catalogName]?.[dependencyName] ?? pkg.catalogs?.[catalogName]?.[dependencyName];
|
|
4072
|
+
return workspacesObj?.catalog?.[dependencyName] ?? pkg.catalog?.[dependencyName];
|
|
4073
|
+
};
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
function createCatalogDependencyResolverFromCatalogs(catalog, catalogs) {
|
|
4077
|
+
return (catalogSpec, dependencyName) => {
|
|
4078
|
+
const catalogName = catalogSpec.slice(8);
|
|
4079
|
+
if (catalogName) return catalogs?.[catalogName]?.[dependencyName];
|
|
4080
|
+
return catalog?.[dependencyName];
|
|
4081
|
+
};
|
|
4082
|
+
}
|
|
4083
|
+
function getYamlMapScalarStringValue(map, key) {
|
|
4084
|
+
if (!(map instanceof import_dist.YAMLMap)) return;
|
|
4085
|
+
for (const item of map.items) if (item.key instanceof import_dist.Scalar && item.key.value === key && item.value instanceof import_dist.Scalar && typeof item.value.value === "string") return item.value.value;
|
|
4086
|
+
}
|
|
4024
4087
|
function rewriteCatalog(doc) {
|
|
4025
4088
|
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
|
|
4026
4089
|
if (value.startsWith("file:")) continue;
|
|
@@ -4031,6 +4094,45 @@ function rewriteCatalog(doc) {
|
|
|
4031
4094
|
const path = ["catalog", name];
|
|
4032
4095
|
if (doc.hasIn(path)) doc.deleteIn(path);
|
|
4033
4096
|
}
|
|
4097
|
+
const catalogs = doc.getIn(["catalogs"]);
|
|
4098
|
+
if (!(catalogs instanceof import_dist.YAMLMap)) return;
|
|
4099
|
+
for (const item of catalogs.items) {
|
|
4100
|
+
const catalogName = item.key instanceof import_dist.Scalar ? item.key.value : void 0;
|
|
4101
|
+
if (typeof catalogName !== "string" || !(item.value instanceof import_dist.YAMLMap)) continue;
|
|
4102
|
+
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
|
|
4103
|
+
const catalogPath = [
|
|
4104
|
+
"catalogs",
|
|
4105
|
+
catalogName,
|
|
4106
|
+
key
|
|
4107
|
+
];
|
|
4108
|
+
if (!value.startsWith("file:") && doc.hasIn(catalogPath)) doc.setIn(catalogPath, scalarString(value));
|
|
4109
|
+
}
|
|
4110
|
+
const vitePlusPath = [
|
|
4111
|
+
"catalogs",
|
|
4112
|
+
catalogName,
|
|
4113
|
+
VITE_PLUS_NAME
|
|
4114
|
+
];
|
|
4115
|
+
if (!VITE_PLUS_VERSION.startsWith("file:") && doc.hasIn(vitePlusPath)) doc.setIn(vitePlusPath, scalarString(VITE_PLUS_VERSION));
|
|
4116
|
+
for (const name of REMOVE_PACKAGES) {
|
|
4117
|
+
const catalogPath = [
|
|
4118
|
+
"catalogs",
|
|
4119
|
+
catalogName,
|
|
4120
|
+
name
|
|
4121
|
+
];
|
|
4122
|
+
if (doc.hasIn(catalogPath)) doc.deleteIn(catalogPath);
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4126
|
+
function rewriteCatalogObject(catalog, addMissing) {
|
|
4127
|
+
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) {
|
|
4128
|
+
if (value.startsWith("file:") || !addMissing && !(key in catalog)) continue;
|
|
4129
|
+
catalog[key] = value;
|
|
4130
|
+
}
|
|
4131
|
+
if (!VITE_PLUS_VERSION.startsWith("file:") && (addMissing || "vite-plus" in catalog)) catalog[VITE_PLUS_NAME] = VITE_PLUS_VERSION;
|
|
4132
|
+
for (const name of REMOVE_PACKAGES) delete catalog[name];
|
|
4133
|
+
}
|
|
4134
|
+
function rewriteCatalogsObject(catalogs) {
|
|
4135
|
+
for (const catalog of Object.values(catalogs)) rewriteCatalogObject(catalog, false);
|
|
4034
4136
|
}
|
|
4035
4137
|
/**
|
|
4036
4138
|
* Write catalog entries to root package.json for bun.
|
|
@@ -4043,14 +4145,20 @@ function rewriteBunCatalog(projectPath) {
|
|
|
4043
4145
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
4044
4146
|
editJsonFile(packageJsonPath, (pkg) => {
|
|
4045
4147
|
const workspacesObj = pkg.workspaces && !Array.isArray(pkg.workspaces) ? pkg.workspaces : void 0;
|
|
4046
|
-
const
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4148
|
+
const useWorkspacesCatalog = workspacesObj?.catalog != null || pkg.catalog == null && workspacesObj?.catalogs != null;
|
|
4149
|
+
const catalog = { ...useWorkspacesCatalog ? workspacesObj?.catalog : pkg.catalog };
|
|
4150
|
+
rewriteCatalogObject(catalog, true);
|
|
4151
|
+
if (useWorkspacesCatalog) {
|
|
4152
|
+
workspacesObj.catalog = catalog;
|
|
4153
|
+
if (pkg.catalog) rewriteCatalogObject(pkg.catalog, false);
|
|
4154
|
+
} else {
|
|
4155
|
+
pkg.catalog = catalog;
|
|
4156
|
+
if (workspacesObj?.catalog) rewriteCatalogObject(workspacesObj.catalog, false);
|
|
4157
|
+
}
|
|
4158
|
+
if (workspacesObj?.catalogs) rewriteCatalogsObject(workspacesObj.catalogs);
|
|
4159
|
+
if (pkg.catalogs) rewriteCatalogsObject(pkg.catalogs);
|
|
4052
4160
|
const overrides = { ...pkg.overrides };
|
|
4053
|
-
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) overrides[key] =
|
|
4161
|
+
for (const [key, value] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) overrides[key] = getCatalogDependencySpec(overrides[key], value, true);
|
|
4054
4162
|
pkg.overrides = overrides;
|
|
4055
4163
|
return pkg;
|
|
4056
4164
|
});
|
|
@@ -4059,7 +4167,7 @@ function rewriteBunCatalog(projectPath) {
|
|
|
4059
4167
|
* Rewrite root workspace package.json to add vite-plus dependencies
|
|
4060
4168
|
* @param projectPath - The path to the project
|
|
4061
4169
|
*/
|
|
4062
|
-
function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStagedMigration) {
|
|
4170
|
+
function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStagedMigration, catalogDependencyResolver) {
|
|
4063
4171
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
4064
4172
|
if (!fs.existsSync(packageJsonPath)) return;
|
|
4065
4173
|
let remainingPnpmOverrides;
|
|
@@ -4098,7 +4206,7 @@ function rewriteRootWorkspacePackageJson(projectPath, packageManager, skipStaged
|
|
|
4098
4206
|
return pkg;
|
|
4099
4207
|
});
|
|
4100
4208
|
if (remainingPnpmOverrides) migratePnpmOverridesToWorkspaceYaml(projectPath, remainingPnpmOverrides);
|
|
4101
|
-
rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration);
|
|
4209
|
+
rewriteMonorepoProject(projectPath, packageManager, skipStagedMigration, void 0, void 0, catalogDependencyResolver);
|
|
4102
4210
|
}
|
|
4103
4211
|
const RULES_YAML_PATH = path.join(rulesDir, "vite-tools.yml");
|
|
4104
4212
|
const PREPARE_RULES_YAML_PATH = path.join(rulesDir, "vite-prepare.yml");
|
|
@@ -4119,7 +4227,7 @@ function readPrepareRulesYaml() {
|
|
|
4119
4227
|
cachedPrepareRulesYaml ??= fs.readFileSync(PREPARE_RULES_YAML_PATH, "utf8");
|
|
4120
4228
|
return cachedPrepareRulesYaml;
|
|
4121
4229
|
}
|
|
4122
|
-
function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration) {
|
|
4230
|
+
function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration, catalogDependencyResolver) {
|
|
4123
4231
|
if (pkg.scripts) {
|
|
4124
4232
|
const updated = rewriteScripts(JSON.stringify(pkg.scripts), getScriptRulesYaml(skipStagedMigration));
|
|
4125
4233
|
if (updated) pkg.scripts = JSON.parse(updated);
|
|
@@ -4130,32 +4238,44 @@ function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration
|
|
|
4130
4238
|
const updated = rewriteScripts(JSON.stringify(config), readRulesYaml());
|
|
4131
4239
|
extractedStagedConfig = updated ? JSON.parse(updated) : config;
|
|
4132
4240
|
}
|
|
4133
|
-
const supportCatalog = isMonorepo && packageManager !== PackageManager.npm;
|
|
4241
|
+
const supportCatalog = !!isMonorepo && packageManager !== PackageManager.npm;
|
|
4134
4242
|
let needVitePlus = false;
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
pkg.devDependencies
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
pkg.dependencies
|
|
4143
|
-
|
|
4243
|
+
const dependencyGroups = [
|
|
4244
|
+
{
|
|
4245
|
+
dependencyField: "devDependencies",
|
|
4246
|
+
dependencies: pkg.devDependencies
|
|
4247
|
+
},
|
|
4248
|
+
{
|
|
4249
|
+
dependencyField: "dependencies",
|
|
4250
|
+
dependencies: pkg.dependencies
|
|
4251
|
+
},
|
|
4252
|
+
{
|
|
4253
|
+
dependencyField: "peerDependencies",
|
|
4254
|
+
dependencies: pkg.peerDependencies
|
|
4255
|
+
},
|
|
4256
|
+
{
|
|
4257
|
+
dependencyField: "optionalDependencies",
|
|
4258
|
+
dependencies: pkg.optionalDependencies
|
|
4144
4259
|
}
|
|
4260
|
+
];
|
|
4261
|
+
for (const [key, version] of Object.entries(VITE_PLUS_OVERRIDE_PACKAGES)) for (const { dependencyField, dependencies } of dependencyGroups) if (dependencies?.[key]) {
|
|
4262
|
+
dependencies[key] = getCatalogDependencySpec(dependencies[key], version, supportCatalog, {
|
|
4263
|
+
dependencyField,
|
|
4264
|
+
dependencyName: key,
|
|
4265
|
+
packageManager,
|
|
4266
|
+
catalogDependencyResolver
|
|
4267
|
+
});
|
|
4268
|
+
needVitePlus = true;
|
|
4145
4269
|
}
|
|
4146
4270
|
for (const name of REMOVE_PACKAGES) {
|
|
4147
|
-
|
|
4148
|
-
const
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
needVitePlus = true;
|
|
4152
|
-
}
|
|
4153
|
-
if (wasInDeps) {
|
|
4154
|
-
delete pkg.dependencies[name];
|
|
4155
|
-
needVitePlus = true;
|
|
4271
|
+
let wasRemoved = false;
|
|
4272
|
+
for (const { dependencies } of dependencyGroups) if (dependencies?.[name]) {
|
|
4273
|
+
delete dependencies[name];
|
|
4274
|
+
wasRemoved = true;
|
|
4156
4275
|
}
|
|
4276
|
+
if (wasRemoved) needVitePlus = true;
|
|
4157
4277
|
const peerDep = BROWSER_PROVIDER_PEER_DEPS[name];
|
|
4158
|
-
if (
|
|
4278
|
+
if (wasRemoved && peerDep && !pkg.devDependencies?.[peerDep] && !pkg.dependencies?.[peerDep] && !pkg.peerDependencies?.[peerDep] && !pkg.optionalDependencies?.[peerDep]) {
|
|
4159
4279
|
pkg.devDependencies ??= {};
|
|
4160
4280
|
pkg.devDependencies[peerDep] = "*";
|
|
4161
4281
|
}
|
|
@@ -4166,13 +4286,14 @@ function rewritePackageJson(pkg, packageManager, isMonorepo, skipStagedMigration
|
|
|
4166
4286
|
...pkg.devDependencies,
|
|
4167
4287
|
[VITE_PLUS_NAME]: version
|
|
4168
4288
|
};
|
|
4169
|
-
const
|
|
4289
|
+
const installableDeps = {
|
|
4170
4290
|
...pkg.dependencies,
|
|
4171
|
-
...pkg.devDependencies
|
|
4291
|
+
...pkg.devDependencies,
|
|
4292
|
+
...pkg.optionalDependencies
|
|
4172
4293
|
};
|
|
4173
|
-
if (!
|
|
4294
|
+
if (!installableDeps.vitest && Object.keys(installableDeps).some((name) => name.includes("vitest"))) {
|
|
4174
4295
|
const ver = VITE_PLUS_OVERRIDE_PACKAGES.vitest;
|
|
4175
|
-
pkg.devDependencies.vitest =
|
|
4296
|
+
pkg.devDependencies.vitest = getCatalogDependencySpec(void 0, ver, supportCatalog);
|
|
4176
4297
|
}
|
|
4177
4298
|
}
|
|
4178
4299
|
return extractedStagedConfig;
|
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as DEFAULT_ENVS, i as BASEURL_TSCONFIG_WARNING, o as VITE_PLUS_NAME, u as resolve$1 } from "./main-A6UrSTYb.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as runCommandSilently, n as hasBaseUrlInTsconfig } from "./tsconfig-BQeK6Jxp.js";
|
|
3
3
|
import { n as errorMsg, r as log, s as warnMsg, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
4
4
|
import { r as resolveUniversalViteConfig } from "./resolve-vite-config-C1KX9CZU.js";
|
|
5
5
|
import path, { dirname, join } from "node:path";
|
package/dist/config/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as printHeader, r as log } from "../terminal-CxTMfsxZ.js";
|
|
2
|
-
import { L as defaultInteractive, _ as hasStagedConfigInViteConfig, h as ensurePreCommitHook, i as updateExistingAgentInstructions, z as promptGitHooks } from "../agent-
|
|
2
|
+
import { L as defaultInteractive, _ as hasStagedConfigInViteConfig, h as ensurePreCommitHook, i as updateExistingAgentInstructions, z as promptGitHooks } from "../agent-Ch4JIuSB.js";
|
|
3
3
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
4
4
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
5
5
|
import { join } from "node:path";
|
package/dist/create/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
|
-
import { a as require_cross_spawn } from "../tsconfig-
|
|
2
|
+
import { a as runCommandSilently, i as runCommand$1, o as require_cross_spawn } from "../tsconfig-BQeK6Jxp.js";
|
|
3
3
|
import { a as printHeader, i as muted, o as success, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
4
|
import { i as resolveViteConfig, n as hasViteConfig, t as findWorkspaceRoot } from "../resolve-vite-config-C1KX9CZU.js";
|
|
5
|
-
import { $ as multiselect, A as setPackageManager, B as runViteFmt, D as rewriteMonorepo, E as promptPrettierMigration, G as templatesDir, H as selectPackageManager, K as DependencyType, L as defaultInteractive, O as rewriteMonorepoProject, Q as log$1, R as downloadPackageManager$1, T as promptEslintMigration, V as runViteInstall, W as displayRelative, X as confirm, Y as cancel, Z as intro, a as writeAgentInstructions, at as q, d as detectEslintProject, f as detectFramework, g as hasFrameworkShim, it as require_picocolors, k as rewriteStandaloneProject, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as spinner, o as addFrameworkShim, q as PackageManager, r as selectAgentTargetPaths, rt as text, tt as select, v as injectCreateDefaultTemplate, y as installGitHooks, z as promptGitHooks } from "../agent-
|
|
5
|
+
import { $ as multiselect, A as setPackageManager, B as runViteFmt, D as rewriteMonorepo, E as promptPrettierMigration, G as templatesDir, H as selectPackageManager, K as DependencyType, L as defaultInteractive, O as rewriteMonorepoProject, Q as log$1, R as downloadPackageManager$1, T as promptEslintMigration, V as runViteInstall, W as displayRelative, X as confirm, Y as cancel, Z as intro, a as writeAgentInstructions, at as q, d as detectEslintProject, f as detectFramework, g as hasFrameworkShim, it as require_picocolors, k as rewriteStandaloneProject, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as spinner, o as addFrameworkShim, q as PackageManager, r as selectAgentTargetPaths, rt as text, tt as select, v as injectCreateDefaultTemplate, y as installGitHooks, z as promptGitHooks } from "../agent-Ch4JIuSB.js";
|
|
6
6
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
7
7
|
import { c as editJsonFile, o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists, u as readJsonFile } from "../package-CrKanQYM.js";
|
|
8
|
-
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-
|
|
8
|
+
import { a as detectExistingEditors, c as writeEditorConfigs, n as updatePackageJsonWithDeps, r as updateWorkspaceConfig, s as selectEditors, t as detectWorkspace$1 } from "../workspace-DxqnDgi4.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { runCommand, vitePlusHeader } from "../../binding/index.js";
|
|
@@ -49,48 +49,6 @@ async function runCommandAndDetectProjectDir(options, parentDir) {
|
|
|
49
49
|
projectDir
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
async function runCommandSilently(options) {
|
|
53
|
-
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
54
|
-
stdio: "pipe",
|
|
55
|
-
cwd: options.cwd,
|
|
56
|
-
env: options.envs
|
|
57
|
-
});
|
|
58
|
-
return await new Promise((resolve, reject) => {
|
|
59
|
-
const stdout = [];
|
|
60
|
-
const stderr = [];
|
|
61
|
-
child.stdout?.on("data", (data) => {
|
|
62
|
-
stdout.push(data);
|
|
63
|
-
});
|
|
64
|
-
child.stderr?.on("data", (data) => {
|
|
65
|
-
stderr.push(data);
|
|
66
|
-
});
|
|
67
|
-
child.on("close", (code) => {
|
|
68
|
-
resolve({
|
|
69
|
-
exitCode: code ?? 0,
|
|
70
|
-
stdout: Buffer.concat(stdout),
|
|
71
|
-
stderr: Buffer.concat(stderr)
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
child.on("error", (err) => {
|
|
75
|
-
reject(err);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async function runCommand$1(options) {
|
|
80
|
-
const child = (0, import_cross_spawn.default)(options.command, options.args, {
|
|
81
|
-
stdio: "inherit",
|
|
82
|
-
cwd: options.cwd,
|
|
83
|
-
env: options.envs
|
|
84
|
-
});
|
|
85
|
-
return await new Promise((resolve, reject) => {
|
|
86
|
-
child.on("close", (code) => {
|
|
87
|
-
resolve({ exitCode: code ?? 0 });
|
|
88
|
-
});
|
|
89
|
-
child.on("error", (err) => {
|
|
90
|
-
reject(err);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
52
|
function getPackageRunner(workspaceInfo) {
|
|
95
53
|
switch (workspaceInfo.packageManager) {
|
|
96
54
|
case "pnpm": return {
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { l as isForceOverrideMode } from "../main-A6UrSTYb.js";
|
|
3
3
|
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
-
import { C as migratePrettierToOxfmt, D as rewriteMonorepo, E as promptPrettierMigration, H as selectPackageManager, I as cancelAndExit, J as require_semver, L as defaultInteractive, M as warnPackageLevelEslint, N as warnPackageLevelPrettier, Q as log$1, R as downloadPackageManager, S as migrateNodeVersionManagerFile, T as promptEslintMigration, U as upgradeYarn, V as runViteInstall, W as displayRelative, X as confirm, a as writeAgentInstructions, at as q, b as mergeViteConfigFiles, c as checkVitestVersion, d as detectEslintProject, et as outro, f as detectFramework, g as hasFrameworkShim, j as warnLegacyEslintConfig, k as rewriteStandaloneProject, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as spinner, o as addFrameworkShim, p as detectNodeVersionManagerFile, q as PackageManager, r as selectAgentTargetPaths, s as checkViteVersion, t as detectAgentConflicts, tt as select, u as confirmPrettierMigration, w as preflightGitHooksSetup, x as migrateEslintToOxlint, y as installGitHooks, z as promptGitHooks } from "../agent-
|
|
4
|
+
import { C as migratePrettierToOxfmt, D as rewriteMonorepo, E as promptPrettierMigration, H as selectPackageManager, I as cancelAndExit, J as require_semver, L as defaultInteractive, M as warnPackageLevelEslint, N as warnPackageLevelPrettier, Q as log$1, R as downloadPackageManager, S as migrateNodeVersionManagerFile, T as promptEslintMigration, U as upgradeYarn, V as runViteInstall, W as displayRelative, X as confirm, a as writeAgentInstructions, at as q, b as mergeViteConfigFiles, c as checkVitestVersion, d as detectEslintProject, et as outro, f as detectFramework, g as hasFrameworkShim, j as warnLegacyEslintConfig, k as rewriteStandaloneProject, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, nt as spinner, o as addFrameworkShim, p as detectNodeVersionManagerFile, q as PackageManager, r as selectAgentTargetPaths, s as checkViteVersion, t as detectAgentConflicts, tt as select, u as confirmPrettierMigration, w as preflightGitHooksSetup, x as migrateEslintToOxlint, y as installGitHooks, z as promptGitHooks } from "../agent-Ch4JIuSB.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
6
|
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-CrKanQYM.js";
|
|
7
7
|
import { r as createMigrationReport } from "../report-DbrfjWiP.js";
|
|
8
|
-
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-
|
|
8
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-DxqnDgi4.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { styleText } from "node:util";
|