vite-plus 0.2.3 → 0.2.5
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/README.md +4 -4
- package/binding/index.cjs +53 -52
- package/binding/index.d.cts +17 -26
- package/dist/{agent-D3nZAMGI.js → agent-CTwqJqX_.js} +23 -101
- package/dist/bin.js +8 -5
- package/dist/config/bin.js +2 -2
- package/dist/{constants-CZ7Mnq-C.js → constants-JhDwfMS8.js} +2 -2
- package/dist/create/bin.js +73 -22
- package/dist/{define-config-D2jo1xVA.js → define-config-BRT5X5UW.js} +2 -2
- package/dist/{define-config-Dut6XD42.cjs → define-config-DD3MUyPC.cjs} +2 -2
- package/dist/{define-config-BuMs_LKa.d.ts → define-config-eLQH9us2.d.ts} +2 -3
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{editor-D1BZiU1h.js → editor-H_E_5XOt.js} +95 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/migration/bin.js +5 -5
- package/dist/{oxlint-plugin-config-BSbv66Qn.js → oxlint-plugin-config-CnUfwCp9.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/{pack-Ciiho0Tq.d.ts → pack-PvUg_xpv.d.ts} +0 -1
- package/dist/pack-bin.js +1 -1
- package/dist/pack.d.ts +1 -1
- package/dist/{package-Cpo2ei_V.js → package-BILvlUYF.js} +1 -1
- package/dist/{resolve-vite-config-DX2o0SWM.js → resolve-vite-config-BheiDkKa.js} +1 -1
- package/dist/staged/bin.js +47 -17
- package/dist/{tsconfig-D6sTl0dN.js → tsconfig-D2NvUjn3.js} +86 -78
- package/dist/version.js +2 -2
- package/dist/versions.js +6 -6
- package/docs/config/run.md +3 -6
- package/docs/guide/docker.md +46 -2
- package/docs/guide/env.md +12 -0
- package/docs/guide/index.md +2 -0
- package/docs/guide/installer-env-vars.md +195 -0
- package/package.json +31 -34
- package/templates/monorepo/_gitignore +5 -0
- package/templates/monorepo/_yarnrc.yml +1 -1
- package/templates/monorepo/pnpm-workspace.yaml +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { r as __toESM } from "./rolldown-runtime-C7HZzL1F.js";
|
|
2
|
-
import { a as VITEST_AGE_GATE_EXEMPT_PACKAGES, c as VITE_PLUS_OVERRIDE_PACKAGES, d as isForceOverrideMode, l as VITE_PLUS_VERSION, n as BASEURL_TSCONFIG_WARNING, o as VITEST_VERSION, s as VITE_PLUS_NAME } from "./constants-
|
|
3
|
-
import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-
|
|
4
|
-
import { B as runCommandSilently, D as require_semver, E as PackageManager, M as multiselect, P as select, R as isCancel, V as require_cross_spawn, a as hasTypesToRewriteInTsconfig, b as scalarString, c as rewriteTypesInTsconfig, i as hasBaseUrlInTsconfig, j as log, k as confirm, l as cancelAndExit, n as findTsconfigFiles, o as hasVitestTypesInTsconfig, s as removeDeprecatedTsconfigFalseOption, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-
|
|
2
|
+
import { a as VITEST_AGE_GATE_EXEMPT_PACKAGES, c as VITE_PLUS_OVERRIDE_PACKAGES, d as isForceOverrideMode, l as VITE_PLUS_VERSION, n as BASEURL_TSCONFIG_WARNING, o as VITEST_VERSION, s as VITE_PLUS_NAME } from "./constants-JhDwfMS8.js";
|
|
3
|
+
import { i as ensureVitePlusImportRuleDefaults, r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-CnUfwCp9.js";
|
|
4
|
+
import { B as runCommandSilently, D as require_semver, E as PackageManager, M as multiselect, P as select, R as isCancel, V as require_cross_spawn, a as hasTypesToRewriteInTsconfig, b as scalarString, c as rewriteTypesInTsconfig, i as hasBaseUrlInTsconfig, j as log, k as confirm, l as cancelAndExit, n as findTsconfigFiles, o as hasVitestTypesInTsconfig, s as removeDeprecatedTsconfigFalseOption, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-D2NvUjn3.js";
|
|
5
5
|
import { a as writeJsonFile, i as readJsonFile, n as editJsonFile, r as isJsonFile } from "./json-DiRs8ceZ.js";
|
|
6
6
|
import { t as require_dist } from "./dist-CKz3vcoG.js";
|
|
7
|
-
import { n as detectPackageMetadata
|
|
7
|
+
import { n as detectPackageMetadata } from "./package-BILvlUYF.js";
|
|
8
8
|
import { n as addMigrationWarning, t as addManualStep } from "./report-BS7ULx7A.js";
|
|
9
9
|
import path, { posix, win32 } from "node:path";
|
|
10
|
-
import {
|
|
10
|
+
import { hasConfigKey, mergeJsonConfig, mergeTsdownConfig, rewriteEslint, rewriteImportsInDirectory, rewriteScripts, wrapLazyPlugins } from "../binding/index.js";
|
|
11
11
|
import * as actualFS from "node:fs";
|
|
12
12
|
import fs from "node:fs";
|
|
13
13
|
import { lstatSync, readdir, readdirSync, readlinkSync, realpathSync as realpathSync$1 } from "fs";
|
|
@@ -1042,7 +1042,7 @@ function vitestEcosystemCatalogReferencesPending(pkg, catalogDependencyResolver)
|
|
|
1042
1042
|
pkg.optionalDependencies
|
|
1043
1043
|
]) {
|
|
1044
1044
|
if (!dependencies) continue;
|
|
1045
|
-
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "4.1.
|
|
1045
|
+
for (const [name, spec] of Object.entries(dependencies)) if (isAlignableVitestEcosystemPackage(name) && spec.startsWith("catalog:") && catalogDependencyResolver(spec, name) !== "4.1.10") return true;
|
|
1046
1046
|
}
|
|
1047
1047
|
return false;
|
|
1048
1048
|
}
|
|
@@ -1062,6 +1062,7 @@ function collectVitestEcosystemInstallDependencyNames(rootDir, packages) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
//#endregion
|
|
1064
1064
|
//#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
1065
|
+
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
1065
1066
|
const balanced = (a, b, str) => {
|
|
1066
1067
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
1067
1068
|
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
@@ -2556,9 +2557,14 @@ minimatch.escape = escape;
|
|
|
2556
2557
|
minimatch.unescape = unescape;
|
|
2557
2558
|
//#endregion
|
|
2558
2559
|
//#region ../../node_modules/.pnpm/lru-cache@11.2.7/node_modules/lru-cache/dist/esm/index.min.js
|
|
2559
|
-
var x = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date
|
|
2560
|
+
var x = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
2561
|
+
var I = /* @__PURE__ */ new Set();
|
|
2562
|
+
var R = typeof process == "object" && process ? process : {};
|
|
2563
|
+
var U = (c, t, e, i) => {
|
|
2560
2564
|
typeof R.emitWarning == "function" ? R.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
2561
|
-
}
|
|
2565
|
+
};
|
|
2566
|
+
var C = globalThis.AbortController;
|
|
2567
|
+
var D = globalThis.AbortSignal;
|
|
2562
2568
|
if (typeof C > "u") {
|
|
2563
2569
|
D = class {
|
|
2564
2570
|
onabort;
|
|
@@ -2585,11 +2591,15 @@ if (typeof C > "u") {
|
|
|
2585
2591
|
c && (c = !1, U("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
2586
2592
|
};
|
|
2587
2593
|
}
|
|
2588
|
-
var G = (c) => !I.has(c)
|
|
2594
|
+
var G = (c) => !I.has(c);
|
|
2595
|
+
var y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
2596
|
+
var M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null;
|
|
2597
|
+
var z = class extends Array {
|
|
2589
2598
|
constructor(t) {
|
|
2590
2599
|
super(t), this.fill(0);
|
|
2591
2600
|
}
|
|
2592
|
-
}
|
|
2601
|
+
};
|
|
2602
|
+
var W = class c {
|
|
2593
2603
|
heap;
|
|
2594
2604
|
length;
|
|
2595
2605
|
static #o = !1;
|
|
@@ -2610,7 +2620,8 @@ var G = (c) => !I.has(c), y = (c) => c && c === Math.floor(c) && c > 0 && isFini
|
|
|
2610
2620
|
pop() {
|
|
2611
2621
|
return this.heap[--this.length];
|
|
2612
2622
|
}
|
|
2613
|
-
}
|
|
2623
|
+
};
|
|
2624
|
+
var L = class c {
|
|
2614
2625
|
#o;
|
|
2615
2626
|
#c;
|
|
2616
2627
|
#w;
|
|
@@ -6493,94 +6504,6 @@ const glob = Object.assign(glob_, {
|
|
|
6493
6504
|
});
|
|
6494
6505
|
glob.glob = glob;
|
|
6495
6506
|
//#endregion
|
|
6496
|
-
//#region src/utils/workspace.ts
|
|
6497
|
-
async function detectWorkspace$1(rootDir) {
|
|
6498
|
-
const bindingResult = await detectWorkspace(rootDir);
|
|
6499
|
-
const result = {
|
|
6500
|
-
rootDir,
|
|
6501
|
-
packageManager: void 0,
|
|
6502
|
-
packageManagerVersion: "latest",
|
|
6503
|
-
isMonorepo: false,
|
|
6504
|
-
monorepoScope: "",
|
|
6505
|
-
workspacePatterns: [],
|
|
6506
|
-
parentDirs: [],
|
|
6507
|
-
packages: []
|
|
6508
|
-
};
|
|
6509
|
-
if (bindingResult.packageManagerName) result.packageManager = bindingResult.packageManagerName;
|
|
6510
|
-
if (bindingResult.packageManagerVersion) result.packageManagerVersion = bindingResult.packageManagerVersion;
|
|
6511
|
-
if (bindingResult.isMonorepo) result.isMonorepo = bindingResult.isMonorepo;
|
|
6512
|
-
if (bindingResult.root) result.rootDir = bindingResult.root;
|
|
6513
|
-
if (result.isMonorepo) {
|
|
6514
|
-
const pnpmWorkspaceFile = path.join(result.rootDir, "pnpm-workspace.yaml");
|
|
6515
|
-
const packageJsonFile = path.join(result.rootDir, "package.json");
|
|
6516
|
-
if (fs.existsSync(pnpmWorkspaceFile)) {
|
|
6517
|
-
const workspaceConfig = readYamlFile(pnpmWorkspaceFile);
|
|
6518
|
-
if (Array.isArray(workspaceConfig.packages)) result.workspacePatterns = workspaceConfig.packages;
|
|
6519
|
-
} else if (fs.existsSync(packageJsonFile)) {
|
|
6520
|
-
const pkg = readJsonFile(packageJsonFile);
|
|
6521
|
-
if (Array.isArray(pkg.workspaces)) result.workspacePatterns = pkg.workspaces;
|
|
6522
|
-
else if (pkg.workspaces && Array.isArray(pkg.workspaces.packages)) result.workspacePatterns = pkg.workspaces.packages;
|
|
6523
|
-
}
|
|
6524
|
-
const dirs = /* @__PURE__ */ new Set();
|
|
6525
|
-
for (const pattern of result.workspacePatterns) {
|
|
6526
|
-
if (!pattern.endsWith("*")) continue;
|
|
6527
|
-
const dir = pattern.replace(/\/\*{1,2}$/, "");
|
|
6528
|
-
if (dir) dirs.add(dir);
|
|
6529
|
-
}
|
|
6530
|
-
result.parentDirs = Array.from(dirs).sort();
|
|
6531
|
-
const pkg = readJsonFile(packageJsonFile);
|
|
6532
|
-
if (pkg.name) result.monorepoScope = getScopeFromPackageName(pkg.name);
|
|
6533
|
-
result.packages = discoverWorkspacePackages(result.workspacePatterns, result.rootDir);
|
|
6534
|
-
}
|
|
6535
|
-
return result;
|
|
6536
|
-
}
|
|
6537
|
-
function isBingoTemplate(pkg) {
|
|
6538
|
-
return !!pkg.dependencies?.bingo;
|
|
6539
|
-
}
|
|
6540
|
-
function discoverWorkspacePackages(workspacePatterns, rootDir) {
|
|
6541
|
-
const packages = [];
|
|
6542
|
-
if (workspacePatterns.length === 0) return packages;
|
|
6543
|
-
const packageJsonRelativePaths = globSync(workspacePatterns.map((pattern) => `${pattern}/package.json`), {
|
|
6544
|
-
absolute: false,
|
|
6545
|
-
cwd: rootDir,
|
|
6546
|
-
ignore: ["**/node_modules/**"]
|
|
6547
|
-
});
|
|
6548
|
-
for (const packageJsonRelativePath of packageJsonRelativePaths) {
|
|
6549
|
-
const pkg = readJsonFile(path.join(rootDir, packageJsonRelativePath));
|
|
6550
|
-
if (!pkg.name) continue;
|
|
6551
|
-
packages.push({
|
|
6552
|
-
name: pkg.name,
|
|
6553
|
-
path: path.dirname(packageJsonRelativePath).split(path.sep).join("/"),
|
|
6554
|
-
description: pkg.description,
|
|
6555
|
-
version: pkg.version
|
|
6556
|
-
});
|
|
6557
|
-
}
|
|
6558
|
-
return packages;
|
|
6559
|
-
}
|
|
6560
|
-
function updatePackageJsonWithDeps(rootDir, projectDir, dependencies, dependencyType) {
|
|
6561
|
-
editJsonFile(path.join(rootDir, projectDir, "package.json"), (pkg) => {
|
|
6562
|
-
if (!pkg[dependencyType]) pkg[dependencyType] = {};
|
|
6563
|
-
for (const dep of dependencies) pkg[dependencyType][dep] = "workspace:*";
|
|
6564
|
-
return pkg;
|
|
6565
|
-
});
|
|
6566
|
-
}
|
|
6567
|
-
function updateWorkspaceConfig(projectPath, workspaceInfo) {
|
|
6568
|
-
for (const pattern of workspaceInfo.workspacePatterns) if (minimatch(projectPath, pattern)) return;
|
|
6569
|
-
const parentDir = path.dirname(projectPath);
|
|
6570
|
-
const pattern = parentDir === "." ? projectPath : `${parentDir}/*`;
|
|
6571
|
-
if (workspaceInfo.packageManager === PackageManager.pnpm) editYamlFile(path.join(workspaceInfo.rootDir, "pnpm-workspace.yaml"), (doc) => {
|
|
6572
|
-
let packages = doc.getIn(["packages"]);
|
|
6573
|
-
if (!packages) packages = new import_dist.YAMLSeq();
|
|
6574
|
-
packages.add(new import_dist.Scalar(pattern));
|
|
6575
|
-
doc.setIn(["packages"], packages);
|
|
6576
|
-
});
|
|
6577
|
-
else editJsonFile(path.join(workspaceInfo.rootDir, "package.json"), (pkg) => {
|
|
6578
|
-
if (pkg.workspaces && !Array.isArray(pkg.workspaces)) pkg.workspaces.packages = [...pkg.workspaces.packages || [], pattern];
|
|
6579
|
-
else pkg.workspaces = [...pkg.workspaces || [], pattern];
|
|
6580
|
-
return pkg;
|
|
6581
|
-
});
|
|
6582
|
-
}
|
|
6583
|
-
//#endregion
|
|
6584
6507
|
//#region src/migration/migrator/catalog.ts
|
|
6585
6508
|
const BROWSER_PROVIDER_POSTINSTALL_PACKAGES = ["edgedriver", "geckodriver"];
|
|
6586
6509
|
const PUBLIC_PEER_DEPENDENCY_FALLBACKS = {
|
|
@@ -8370,7 +8293,6 @@ function rewriteAllImports(projectPath, silent = false, report, preserveNuxtVite
|
|
|
8370
8293
|
}
|
|
8371
8294
|
//#endregion
|
|
8372
8295
|
//#region src/migration/migrator/git-hooks.ts
|
|
8373
|
-
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
8374
8296
|
/**
|
|
8375
8297
|
* Check if the project has an unsupported husky version (<9.0.0).
|
|
8376
8298
|
* Uses `semver.coerce` to handle ranges like `^8.0.0` → `8.0.0`.
|
|
@@ -9453,4 +9375,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
9453
9375
|
};
|
|
9454
9376
|
}
|
|
9455
9377
|
//#endregion
|
|
9456
|
-
export {
|
|
9378
|
+
export { globSync as A, warnPackageLevelEslint as B, injectLintTypeCheckDefaults as C, ensureVitePlusBootstrap as D, detectVitePlusBootstrapPending as E, migrateEslintToOxlint as F, checkVitestVersion as G, PRETTIER_PACKAGE_JSON_CONFIG as H, promptEslintMigration as I, templatesDir as J, warnMigration as K, rewriteToolLintStagedConfigFiles as L, confirmEslintMigration as M, detectEslintProject as N, configureYarnNodeModulesMode as O, detectIncompatibleEslintIntegration as P, warnIncompatibleEslintIntegration as R, injectCreateDefaultTemplate as S, collectToolchainVersionChanges as T, detectConfigs as U, PRETTIER_CONFIG_FILES as V, checkViteVersion as W, detectLegacyGitHooksMigrationCandidate as _, selectAgentTargets as a, preflightGitHooksSetup as b, writeCopilotSetupWorkflow as c, rewriteStandaloneProject as d, detectPendingCoreMigration as f, setPackageManager as g, migrateNodeVersionManagerFile as h, selectAgentTargetPaths as i, minimatch as j, detectYarnPnpMode as k, rewriteMonorepo as l, detectNodeVersionManagerFile as m, detectAgentConflicts as n, updateExistingAgentInstructions as o, finalizeCoreMigrationForExistingVitePlus as p, displayRelative as q, detectExistingAgentTargetPaths as r, writeAgentInstructions as s, COPILOT_AGENT_ID as t, rewriteMonorepoProject as u, ensurePreCommitHook as v, mergeViteConfigFiles as w, hasStagedConfigInViteConfig as x, installGitHooks as y, warnLegacyEslintConfig as z };
|
package/dist/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as resolve$1, i as DEFAULT_ENVS, n as BASEURL_TSCONFIG_WARNING, p as resolveBundled, r as CONFIG_METADATA_ENV, s as VITE_PLUS_NAME } from "./constants-
|
|
2
|
-
import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-
|
|
3
|
-
import { B as runCommandSilently, i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-
|
|
1
|
+
import { f as resolve$1, i as DEFAULT_ENVS, n as BASEURL_TSCONFIG_WARNING, p as resolveBundled, r as CONFIG_METADATA_ENV, s as VITE_PLUS_NAME } from "./constants-JhDwfMS8.js";
|
|
2
|
+
import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-CnUfwCp9.js";
|
|
3
|
+
import { B as runCommandSilently, i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-D2NvUjn3.js";
|
|
4
4
|
import { n as errorMsg, r as log, s as warnMsg, t as accent } from "./terminal-uTv0ZaMr.js";
|
|
5
5
|
import { t as resolveTsgolintExecutable } from "./tsgolint-path-B-yOos8p.js";
|
|
6
|
-
import { i as resolveUniversalViteConfig } from "./resolve-vite-config-
|
|
6
|
+
import { i as resolveUniversalViteConfig } from "./resolve-vite-config-BheiDkKa.js";
|
|
7
7
|
import path, { dirname, join } from "node:path";
|
|
8
|
-
import { hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
|
|
8
|
+
import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
|
|
9
9
|
import fs, { readFileSync } from "node:fs";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
//#region src/resolve-fmt.ts
|
|
@@ -390,6 +390,9 @@ async function vite() {
|
|
|
390
390
|
* vite-plus installation using oxc_resolver and runs its dist/bin.js directly.
|
|
391
391
|
* If no local installation is found, this global dist/bin.js is used as fallback.
|
|
392
392
|
*/
|
|
393
|
+
process.stdout;
|
|
394
|
+
process.stderr;
|
|
395
|
+
ensureBlockingStdio();
|
|
393
396
|
function getErrorMessage(err) {
|
|
394
397
|
if (err instanceof Error) return err.message;
|
|
395
398
|
if (typeof err === "object" && err && "message" in err && typeof err.message === "string") return err.message;
|
package/dist/config/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as promptGitHooks, u as defaultInteractive } from "../tsconfig-
|
|
1
|
+
import { f as promptGitHooks, u as defaultInteractive } from "../tsconfig-D2NvUjn3.js";
|
|
2
2
|
import { a as printHeader, r as log } from "../terminal-uTv0ZaMr.js";
|
|
3
3
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
4
|
-
import { o as updateExistingAgentInstructions, v as ensurePreCommitHook, x as hasStagedConfigInViteConfig } from "../agent-
|
|
4
|
+
import { o as updateExistingAgentInstructions, v as ensurePreCommitHook, x as hasStagedConfigInViteConfig } from "../agent-CTwqJqX_.js";
|
|
5
5
|
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
//#region package.json
|
|
3
|
-
var version = "0.2.
|
|
3
|
+
var version = "0.2.5";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/utils/constants.ts
|
|
6
6
|
const VITE_PLUS_NAME = "vite-plus";
|
|
7
7
|
const VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
8
|
-
const VITEST_VERSION = "4.1.
|
|
8
|
+
const VITEST_VERSION = "4.1.10";
|
|
9
9
|
const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
|
|
10
10
|
vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
|
|
11
11
|
vitest: VITEST_VERSION
|
package/dist/create/bin.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-C7HZzL1F.js";
|
|
2
|
-
import { s as VITE_PLUS_NAME } from "../constants-
|
|
3
|
-
import { A as intro, B as runCommandSilently, C as resolveApproveBuildTargets, E as PackageManager, F as spinner, I as text, L as require_picocolors, M as multiselect, O as cancel, P as select, R as isCancel, S as detectGatedBuilds, T as DependencyType, V as require_cross_spawn, d as downloadPackageManager$1, f as promptGitHooks, g as selectPackageManager, h as runViteInstall, j as log, k as confirm, m as runViteFmt, p as resolveGitInit, u as defaultInteractive, x as approveBuilds, z as runCommand$1 } from "../tsconfig-
|
|
2
|
+
import { s as VITE_PLUS_NAME } from "../constants-JhDwfMS8.js";
|
|
3
|
+
import { A as intro, B as runCommandSilently, C as resolveApproveBuildTargets, E as PackageManager, F as spinner, I as text, L as require_picocolors, M as multiselect, O as cancel, P as select, R as isCancel, S as detectGatedBuilds, T as DependencyType, V as require_cross_spawn, d as downloadPackageManager$1, f as promptGitHooks, g as selectPackageManager, h as runViteInstall, j as log, k as confirm, m as runViteFmt, p as resolveGitInit, u as defaultInteractive, v as editYamlFile, x as approveBuilds, y as readYamlFile, z as runCommand$1 } from "../tsconfig-D2NvUjn3.js";
|
|
4
4
|
import { a as printHeader, i as muted, o as success, r as log$1, t as accent } from "../terminal-uTv0ZaMr.js";
|
|
5
5
|
import { i as readJsonFile, n as editJsonFile } from "../json-DiRs8ceZ.js";
|
|
6
|
-
import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-
|
|
6
|
+
import { a as resolveViteConfig, n as findWorkspaceRoot, r as hasViteConfig, t as findViteConfig } from "../resolve-vite-config-BheiDkKa.js";
|
|
7
7
|
import { t as lib_default } from "../lib-L3DWSRQp.js";
|
|
8
|
-
import { o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-
|
|
9
|
-
import {
|
|
10
|
-
import { a as writeEditorConfigs, c as
|
|
8
|
+
import { o as fetchNpmResource, s as getNpmRegistry, t as checkNpmPackageExists } from "../package-BILvlUYF.js";
|
|
9
|
+
import { I as promptEslintMigration, J as templatesDir, N as detectEslintProject, S as injectCreateDefaultTemplate, a as selectAgentTargets, c as writeCopilotSetupWorkflow, d as rewriteStandaloneProject, g as setPackageManager, l as rewriteMonorepo, q as displayRelative, r as detectExistingAgentTargetPaths, s as writeAgentInstructions, t as COPILOT_AGENT_ID, u as rewriteMonorepoProject, y as installGitHooks } from "../agent-CTwqJqX_.js";
|
|
10
|
+
import { a as writeEditorConfigs, c as updatePackageJsonWithDeps, d as detectFramework, f as hasFrameworkShim, g as promptPrettierMigration, i as selectEditors, l as updateWorkspaceConfig, m as detectPrettierProject, n as detectExistingEditors, o as detectWorkspace$1, s as isBingoTemplate, u as addFrameworkShim } from "../editor-H_E_5XOt.js";
|
|
11
11
|
import { t as renderCliDoc } from "../help-YP84FSEz.js";
|
|
12
12
|
import path from "node:path";
|
|
13
13
|
import { runCommand, upsertJsonConfig, vitePlusHeader } from "../../binding/index.js";
|
|
14
14
|
import fs from "node:fs";
|
|
15
15
|
import { styleText } from "node:util";
|
|
16
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
16
17
|
import os from "node:os";
|
|
17
18
|
import fsPromises from "node:fs/promises";
|
|
18
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
19
19
|
import assert from "node:assert";
|
|
20
20
|
//#region src/utils/git.ts
|
|
21
21
|
var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
|
|
@@ -3951,23 +3951,46 @@ function renameFiles(projectDir) {
|
|
|
3951
3951
|
if (fs.existsSync(fromPath)) fs.renameSync(fromPath, path.join(projectDir, to));
|
|
3952
3952
|
}
|
|
3953
3953
|
}
|
|
3954
|
+
const DOTENV_GITIGNORE_LINES = [
|
|
3955
|
+
"# dotenv environment variable files",
|
|
3956
|
+
".env",
|
|
3957
|
+
".env.*",
|
|
3958
|
+
"!.env.example"
|
|
3959
|
+
];
|
|
3954
3960
|
/**
|
|
3955
|
-
* Make sure the scaffolded project's `.gitignore` excludes
|
|
3961
|
+
* Make sure the scaffolded project's `.gitignore` excludes default generated
|
|
3962
|
+
* project artifacts.
|
|
3956
3963
|
*
|
|
3957
3964
|
* Called right after `git init` so even bundled `@org` templates (which
|
|
3958
|
-
* may ship without a `.gitignore`) don't end up tracking
|
|
3959
|
-
*
|
|
3960
|
-
* `.gitignore` already lists `node_modules`.
|
|
3965
|
+
* may ship without a `.gitignore`) don't end up tracking dependencies or
|
|
3966
|
+
* local environment files on the user's first commit.
|
|
3961
3967
|
*/
|
|
3962
|
-
function
|
|
3968
|
+
function ensureDefaultGitignoreEntries(projectDir) {
|
|
3963
3969
|
const gitignorePath = path.join(projectDir, ".gitignore");
|
|
3964
3970
|
let content = "";
|
|
3965
3971
|
try {
|
|
3966
3972
|
content = fs.readFileSync(gitignorePath, "utf-8");
|
|
3967
3973
|
} catch {}
|
|
3968
|
-
|
|
3974
|
+
const lines = [];
|
|
3975
|
+
if (!hasNodeModulesGitignoreLine(content)) lines.push("node_modules");
|
|
3976
|
+
const missingDotenvLines = DOTENV_GITIGNORE_LINES.filter((line) => !hasGitignoreLine(content, line));
|
|
3977
|
+
if (missingDotenvLines.length > 0) {
|
|
3978
|
+
const startsDotenvSection = missingDotenvLines[0] === DOTENV_GITIGNORE_LINES[0];
|
|
3979
|
+
if (lines.length > 0 || startsDotenvSection && content.trim() !== "") lines.push("");
|
|
3980
|
+
lines.push(...missingDotenvLines);
|
|
3981
|
+
}
|
|
3982
|
+
appendGitignoreLines(gitignorePath, content, lines);
|
|
3983
|
+
}
|
|
3984
|
+
function hasNodeModulesGitignoreLine(content) {
|
|
3985
|
+
return /^\s*node_modules\/?\s*$/m.test(content);
|
|
3986
|
+
}
|
|
3987
|
+
function hasGitignoreLine(content, line) {
|
|
3988
|
+
return content.split(/\r?\n/).some((entry) => entry.trim() === line);
|
|
3989
|
+
}
|
|
3990
|
+
function appendGitignoreLines(gitignorePath, content, lines) {
|
|
3991
|
+
if (lines.length === 0) return;
|
|
3969
3992
|
const prefix = content === "" || content.endsWith("\n") ? "" : "\n";
|
|
3970
|
-
fs.appendFileSync(gitignorePath, `${prefix}
|
|
3993
|
+
fs.appendFileSync(gitignorePath, `${prefix}${lines.join("\n")}\n`);
|
|
3971
3994
|
}
|
|
3972
3995
|
const VSCODE_SETTINGS_PATH = ".vscode/settings.json";
|
|
3973
3996
|
const VSCODE_CONFIG_UNIGNORE_BLOCK = [
|
|
@@ -3993,11 +4016,6 @@ function appendGitignoreVsCodeEditorConfigsBlock(gitignorePath, content) {
|
|
|
3993
4016
|
if (content.trimEnd().endsWith(VSCODE_CONFIG_UNIGNORE_BLOCK.join("\n"))) return;
|
|
3994
4017
|
appendGitignoreLines(gitignorePath, content, VSCODE_CONFIG_UNIGNORE_BLOCK);
|
|
3995
4018
|
}
|
|
3996
|
-
function appendGitignoreLines(gitignorePath, content, lines) {
|
|
3997
|
-
if (lines.length === 0) return;
|
|
3998
|
-
const prefix = content === "" || content.endsWith("\n") ? "" : "\n";
|
|
3999
|
-
fs.appendFileSync(gitignorePath, `${prefix}${lines.join("\n")}\n`);
|
|
4000
|
-
}
|
|
4001
4019
|
function formatDisplayTargetDir(targetDir) {
|
|
4002
4020
|
const normalized = targetDir.split(path.sep).join("/");
|
|
4003
4021
|
if (normalized === "" || normalized === ".") return "./";
|
|
@@ -4594,12 +4612,45 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, options) {
|
|
|
4594
4612
|
const libraryProjectPath = path.join(fullPath, libraryDir);
|
|
4595
4613
|
setPackageName(libraryProjectPath, libraryPackageName);
|
|
4596
4614
|
rewriteMonorepoProject(libraryProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
|
|
4615
|
+
alignMonorepoTypeScriptVersion(fullPath, appProjectPath, libraryProjectPath);
|
|
4597
4616
|
return {
|
|
4598
4617
|
exitCode: 0,
|
|
4599
4618
|
projectDir: templateInfo.targetDir
|
|
4600
4619
|
};
|
|
4601
4620
|
}
|
|
4602
4621
|
/**
|
|
4622
|
+
* Keep every scaffolded workspace member on the same TypeScript version.
|
|
4623
|
+
*
|
|
4624
|
+
* The app and library come from independently updated remote templates. If
|
|
4625
|
+
* their TypeScript ranges resolve to different versions, `typescript` — an
|
|
4626
|
+
* optional peer of vite-plus — resolves differently per member, so package
|
|
4627
|
+
* managers either create separate vite-plus peer instances (pnpm) or hoist a
|
|
4628
|
+
* compiler the other workspace member did not ask for (npm/Yarn). The library
|
|
4629
|
+
* template is the compatibility baseline because its declaration build may
|
|
4630
|
+
* require a newer compiler, so the app adopts its TypeScript range instead of
|
|
4631
|
+
* silently downgrading the library. The workspace catalog entry follows the
|
|
4632
|
+
* same baseline so members that reference `typescript: "catalog:"` (e.g. a
|
|
4633
|
+
* later `vite:generator` scaffold) stay on the workspace's compiler.
|
|
4634
|
+
*/
|
|
4635
|
+
function alignMonorepoTypeScriptVersion(workspaceRootPath, appProjectPath, libraryProjectPath) {
|
|
4636
|
+
const typescriptVersion = JSON.parse(fs.readFileSync(path.join(libraryProjectPath, "package.json"), "utf8")).devDependencies?.typescript;
|
|
4637
|
+
if (!typescriptVersion) return;
|
|
4638
|
+
editJsonFile(path.join(appProjectPath, "package.json"), (pkg) => {
|
|
4639
|
+
if (!pkg.devDependencies?.typescript || pkg.devDependencies.typescript === typescriptVersion) return;
|
|
4640
|
+
pkg.devDependencies.typescript = typescriptVersion;
|
|
4641
|
+
return pkg;
|
|
4642
|
+
});
|
|
4643
|
+
for (const catalogFile of ["pnpm-workspace.yaml", ".yarnrc.yml"]) {
|
|
4644
|
+
const catalogPath = path.join(workspaceRootPath, catalogFile);
|
|
4645
|
+
if (!fs.existsSync(catalogPath)) continue;
|
|
4646
|
+
const catalogEntry = readYamlFile(catalogPath)?.catalog?.typescript;
|
|
4647
|
+
if (catalogEntry === void 0 || catalogEntry === typescriptVersion) continue;
|
|
4648
|
+
editYamlFile(catalogPath, (doc) => {
|
|
4649
|
+
doc.setIn(["catalog", "typescript"], typescriptVersion);
|
|
4650
|
+
});
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
/**
|
|
4603
4654
|
* Drop the aliased `vite` / `vitest` devDeps that `create-vite` leaves on a
|
|
4604
4655
|
* scaffolded sub-package. After migration its scripts already use `vp ...` and
|
|
4605
4656
|
* nothing imports `'vite'` directly, so `vite-plus` provides them transitively.
|
|
@@ -5274,7 +5325,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5274
5325
|
});
|
|
5275
5326
|
if (gitResult.status === 0) {
|
|
5276
5327
|
if (!compactOutput) log.success("Git repository initialized");
|
|
5277
|
-
|
|
5328
|
+
ensureDefaultGitignoreEntries(fullPath);
|
|
5278
5329
|
} else {
|
|
5279
5330
|
log.warn("Failed to initialize git repository");
|
|
5280
5331
|
if (gitResult.stderr) log.info(gitResult.stderr.toString());
|
|
@@ -5309,7 +5360,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5309
5360
|
rewriteMonorepo(workspaceInfo, void 0, compactOutput);
|
|
5310
5361
|
if (shouldSetupGit) {
|
|
5311
5362
|
updateCreateProgress("Initializing git repository");
|
|
5312
|
-
await initGitRepository(fullPath);
|
|
5363
|
+
if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
|
|
5313
5364
|
}
|
|
5314
5365
|
if (bundled?.monorepo) injectCreateDefaultTemplate(fullPath, bundled.scope, compactOutput);
|
|
5315
5366
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
|
|
@@ -5501,7 +5552,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
5501
5552
|
for (const framework of detectFramework(fullPath)) if (!hasFrameworkShim(fullPath, framework)) addFrameworkShim(fullPath, framework);
|
|
5502
5553
|
if (shouldSetupGit) {
|
|
5503
5554
|
updateCreateProgress("Initializing git repository");
|
|
5504
|
-
await initGitRepository(fullPath);
|
|
5555
|
+
if (await initGitRepository(fullPath)) ensureDefaultGitignoreEntries(fullPath);
|
|
5505
5556
|
}
|
|
5506
5557
|
if (shouldSetupHooks) installGitHooks(fullPath, compactOutput, void 0, workspaceInfo.packageManager);
|
|
5507
5558
|
updateCreateProgress("Installing dependencies");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-
|
|
1
|
+
import { o as VITEST_VERSION, r as CONFIG_METADATA_ENV } from "./constants-JhDwfMS8.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { defineConfig, defineProject } from "vitest/config";
|
|
7
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.
|
|
7
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.7_@arethetypeswrong+core@0.18.2_@tsdown+css@0.22.7_@tsdown+exe@0.22.7_@type_53c241a653f2227a5df8ba2949047afe/node_modules/tsdown/esm-shims.js
|
|
8
8
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
9
9
|
const getDirname = () => path.dirname(getFilename());
|
|
10
10
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -37,10 +37,10 @@ let node_module = require("node:module");
|
|
|
37
37
|
let node_url = require("node:url");
|
|
38
38
|
let vitest_config = require("vitest/config");
|
|
39
39
|
//#region package.json
|
|
40
|
-
var version = "0.2.
|
|
40
|
+
var version = "0.2.5", VITE_PLUS_VERSION, VITEST_VERSION, CONFIG_METADATA_ENV;
|
|
41
41
|
var init_constants = __esmMin((() => {
|
|
42
42
|
VITE_PLUS_VERSION = process.env.VP_VERSION || version;
|
|
43
|
-
VITEST_VERSION = "4.1.
|
|
43
|
+
VITEST_VERSION = "4.1.10";
|
|
44
44
|
process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : `${VITE_PLUS_VERSION}`;
|
|
45
45
|
(0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
46
46
|
process.versions.node, process.release.name;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { t as PackUserConfig } from "./pack-
|
|
1
|
+
import { t as PackUserConfig } from "./pack-PvUg_xpv.js";
|
|
2
2
|
import { ConfigEnv, UserProjectConfigExport, UserProjectConfigFn, UserWorkspaceConfig } from "vitest/config";
|
|
3
3
|
import { PluginOption, UserConfig } from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
import { OxfmtConfig } from "oxfmt";
|
|
5
5
|
import { OxlintConfig } from "oxlint";
|
|
6
6
|
import { InlineConfig } from "vitest/node";
|
|
7
|
-
|
|
8
7
|
//#region src/create/org-manifest.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* A single template entry shared by org manifests (`createConfig.templates`)
|
|
@@ -142,7 +141,7 @@ type RunConfig = {
|
|
|
142
141
|
/**
|
|
143
142
|
* Task definitions: full task objects, command strings, or command string arrays.
|
|
144
143
|
*/
|
|
145
|
-
tasks?: { [key in string]: TaskDefinition };
|
|
144
|
+
tasks?: { [key in string]: TaskDefinition; };
|
|
146
145
|
/**
|
|
147
146
|
* Whether to automatically run `preX`/`postX` package.json scripts as
|
|
148
147
|
* lifecycle hooks when script `X` is executed.
|
package/dist/define-config.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_define_config = require("./define-config-
|
|
2
|
+
const require_define_config = require("./define-config-DD3MUyPC.cjs");
|
|
3
3
|
require_define_config.init_define_config();
|
|
4
4
|
exports.AUTO_INLINE_DEPS = require_define_config.AUTO_INLINE_DEPS;
|
|
5
5
|
exports.assertCoverageProviderVersionMatch = require_define_config.assertCoverageProviderVersionMatch;
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-eLQH9us2.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
package/dist/define-config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-
|
|
1
|
+
import { a as defineConfig, c as lazyPlugins, i as computeAutoInlineList, l as resolveCoverageProviderToCheck, n as assertCoverageProviderVersionMatch, o as defineProject, r as checkCoverageProviderVersion, s as isVitestFamilySpecifier, t as AUTO_INLINE_DEPS, u as withConfigMetadataResolution } from "./define-config-BRT5X5UW.js";
|
|
2
2
|
export { AUTO_INLINE_DEPS, assertCoverageProviderVersionMatch, checkCoverageProviderVersion, computeAutoInlineList, defineConfig, defineProject, isVitestFamilySpecifier, lazyPlugins, resolveCoverageProviderToCheck, withConfigMetadataResolution };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { B as runCommandSilently, M as multiselect, P as select, R as isCancel, j as log, k as confirm, l as cancelAndExit, w as getSpinner } from "./tsconfig-
|
|
1
|
+
import { B as runCommandSilently, E as PackageManager, M as multiselect, P as select, R as isCancel, j as log, k as confirm, l as cancelAndExit, v as editYamlFile, w as getSpinner, y as readYamlFile } from "./tsconfig-D2NvUjn3.js";
|
|
2
2
|
import { a as writeJsonFile, c as parse, i as readJsonFile, n as editJsonFile, o as applyEdits, s as modify, t as detectFormattingOptions } from "./json-DiRs8ceZ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { t as require_dist } from "./dist-CKz3vcoG.js";
|
|
4
|
+
import { r as getScopeFromPackageName } from "./package-BILvlUYF.js";
|
|
5
|
+
import { A as globSync, K as warnMigration, L as rewriteToolLintStagedConfigFiles, U as detectConfigs, V as PRETTIER_CONFIG_FILES, j as minimatch, q as displayRelative } from "./agent-CTwqJqX_.js";
|
|
4
6
|
import path from "node:path";
|
|
5
|
-
import { rewritePrettier } from "../binding/index.js";
|
|
7
|
+
import { detectWorkspace, rewritePrettier } from "../binding/index.js";
|
|
6
8
|
import fs from "node:fs";
|
|
7
9
|
import { styleText } from "node:util";
|
|
8
10
|
import fsPromises from "node:fs/promises";
|
|
@@ -242,6 +244,95 @@ function addFrameworkShim(projectPath, framework, report) {
|
|
|
242
244
|
}
|
|
243
245
|
if (report) report.frameworkShimAdded = true;
|
|
244
246
|
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/utils/workspace.ts
|
|
249
|
+
var import_dist = require_dist();
|
|
250
|
+
async function detectWorkspace$1(rootDir) {
|
|
251
|
+
const bindingResult = await detectWorkspace(rootDir);
|
|
252
|
+
const result = {
|
|
253
|
+
rootDir,
|
|
254
|
+
packageManager: void 0,
|
|
255
|
+
packageManagerVersion: "latest",
|
|
256
|
+
isMonorepo: false,
|
|
257
|
+
monorepoScope: "",
|
|
258
|
+
workspacePatterns: [],
|
|
259
|
+
parentDirs: [],
|
|
260
|
+
packages: []
|
|
261
|
+
};
|
|
262
|
+
if (bindingResult.packageManagerName) result.packageManager = bindingResult.packageManagerName;
|
|
263
|
+
if (bindingResult.packageManagerVersion) result.packageManagerVersion = bindingResult.packageManagerVersion;
|
|
264
|
+
if (bindingResult.isMonorepo) result.isMonorepo = bindingResult.isMonorepo;
|
|
265
|
+
if (bindingResult.root) result.rootDir = bindingResult.root;
|
|
266
|
+
if (result.isMonorepo) {
|
|
267
|
+
const pnpmWorkspaceFile = path.join(result.rootDir, "pnpm-workspace.yaml");
|
|
268
|
+
const packageJsonFile = path.join(result.rootDir, "package.json");
|
|
269
|
+
if (fs.existsSync(pnpmWorkspaceFile)) {
|
|
270
|
+
const workspaceConfig = readYamlFile(pnpmWorkspaceFile);
|
|
271
|
+
if (Array.isArray(workspaceConfig.packages)) result.workspacePatterns = workspaceConfig.packages;
|
|
272
|
+
} else if (fs.existsSync(packageJsonFile)) {
|
|
273
|
+
const pkg = readJsonFile(packageJsonFile);
|
|
274
|
+
if (Array.isArray(pkg.workspaces)) result.workspacePatterns = pkg.workspaces;
|
|
275
|
+
else if (pkg.workspaces && Array.isArray(pkg.workspaces.packages)) result.workspacePatterns = pkg.workspaces.packages;
|
|
276
|
+
}
|
|
277
|
+
const dirs = /* @__PURE__ */ new Set();
|
|
278
|
+
for (const pattern of result.workspacePatterns) {
|
|
279
|
+
if (!pattern.endsWith("*")) continue;
|
|
280
|
+
const dir = pattern.replace(/\/\*{1,2}$/, "");
|
|
281
|
+
if (dir) dirs.add(dir);
|
|
282
|
+
}
|
|
283
|
+
result.parentDirs = Array.from(dirs).sort();
|
|
284
|
+
const pkg = readJsonFile(packageJsonFile);
|
|
285
|
+
if (pkg.name) result.monorepoScope = getScopeFromPackageName(pkg.name);
|
|
286
|
+
result.packages = discoverWorkspacePackages(result.workspacePatterns, result.rootDir);
|
|
287
|
+
}
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
function isBingoTemplate(pkg) {
|
|
291
|
+
return !!pkg.dependencies?.bingo;
|
|
292
|
+
}
|
|
293
|
+
function discoverWorkspacePackages(workspacePatterns, rootDir) {
|
|
294
|
+
const packages = [];
|
|
295
|
+
if (workspacePatterns.length === 0) return packages;
|
|
296
|
+
const packageJsonRelativePaths = globSync(workspacePatterns.map((pattern) => `${pattern}/package.json`), {
|
|
297
|
+
absolute: false,
|
|
298
|
+
cwd: rootDir,
|
|
299
|
+
ignore: ["**/node_modules/**"]
|
|
300
|
+
});
|
|
301
|
+
for (const packageJsonRelativePath of packageJsonRelativePaths) {
|
|
302
|
+
const pkg = readJsonFile(path.join(rootDir, packageJsonRelativePath));
|
|
303
|
+
if (!pkg.name) continue;
|
|
304
|
+
packages.push({
|
|
305
|
+
name: pkg.name,
|
|
306
|
+
path: path.dirname(packageJsonRelativePath).split(path.sep).join("/"),
|
|
307
|
+
description: pkg.description,
|
|
308
|
+
version: pkg.version
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
return packages;
|
|
312
|
+
}
|
|
313
|
+
function updatePackageJsonWithDeps(rootDir, projectDir, dependencies, dependencyType) {
|
|
314
|
+
editJsonFile(path.join(rootDir, projectDir, "package.json"), (pkg) => {
|
|
315
|
+
if (!pkg[dependencyType]) pkg[dependencyType] = {};
|
|
316
|
+
for (const dep of dependencies) pkg[dependencyType][dep] = "workspace:*";
|
|
317
|
+
return pkg;
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function updateWorkspaceConfig(projectPath, workspaceInfo) {
|
|
321
|
+
for (const pattern of workspaceInfo.workspacePatterns) if (minimatch(projectPath, pattern)) return;
|
|
322
|
+
const parentDir = path.dirname(projectPath);
|
|
323
|
+
const pattern = parentDir === "." ? projectPath : `${parentDir}/*`;
|
|
324
|
+
if (workspaceInfo.packageManager === PackageManager.pnpm) editYamlFile(path.join(workspaceInfo.rootDir, "pnpm-workspace.yaml"), (doc) => {
|
|
325
|
+
let packages = doc.getIn(["packages"]);
|
|
326
|
+
if (!packages) packages = new import_dist.YAMLSeq();
|
|
327
|
+
packages.add(new import_dist.Scalar(pattern));
|
|
328
|
+
doc.setIn(["packages"], packages);
|
|
329
|
+
});
|
|
330
|
+
else editJsonFile(path.join(workspaceInfo.rootDir, "package.json"), (pkg) => {
|
|
331
|
+
if (pkg.workspaces && !Array.isArray(pkg.workspaces)) pkg.workspaces.packages = [...pkg.workspaces.packages || [], pattern];
|
|
332
|
+
else pkg.workspaces = [...pkg.workspaces || [], pattern];
|
|
333
|
+
return pkg;
|
|
334
|
+
});
|
|
335
|
+
}
|
|
245
336
|
const EDITORS = [{
|
|
246
337
|
id: "vscode",
|
|
247
338
|
label: "VSCode",
|
|
@@ -581,4 +672,4 @@ function resolveEditorIds(editors) {
|
|
|
581
672
|
return uniqueEditorIds.length === 0 ? void 0 : uniqueEditorIds;
|
|
582
673
|
}
|
|
583
674
|
//#endregion
|
|
584
|
-
export { writeEditorConfigs as a,
|
|
675
|
+
export { warnPackageLevelPrettier as _, writeEditorConfigs as a, updatePackageJsonWithDeps as c, detectFramework as d, hasFrameworkShim as f, promptPrettierMigration as g, migratePrettierToOxfmt as h, selectEditors as i, updateWorkspaceConfig as l, detectPrettierProject as m, detectExistingEditors as n, detectWorkspace$1 as o, confirmPrettierMigration as p, selectEditor as r, isBingoTemplate as s, detectEditorConflicts as t, addFrameworkShim as u };
|
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-DD3MUyPC.cjs");
|
|
2
2
|
//#region src/index.cts
|
|
3
3
|
const vite = require("@voidzero-dev/vite-plus-core");
|
|
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-eLQH9us2.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 "@voidzero-dev/vite-plus-core";
|
|
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-BRT5X5UW.js";
|
|
2
2
|
import { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude } from "vitest/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { configDefaults, coverageConfigDefaults, defaultBrowserPort, defaultExclude, defaultInclude, defineConfig, defineProject, lazyPlugins };
|