vite-plus 0.1.14 → 0.1.15-alpha.1
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/config/bin.js +10 -4
- package/dist/global/{agent-CYJwIPT1.js → agent-BJ8PFvbU.js} +3 -3
- package/dist/global/config.js +4 -3
- package/dist/global/create.js +10 -4
- package/dist/global/migrate.js +2 -2
- package/dist/global/staged.js +218 -10
- package/dist/global/{workspace-CRwqPC_4.js → workspace-BnY0PTee.js} +1 -1
- package/dist/run-config.d.ts +21 -10
- package/package.json +15 -15
package/dist/config/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { existsSync } from 'node:fs';
|
|
|
7
7
|
import { join } from 'node:path';
|
|
8
8
|
import mri from 'mri';
|
|
9
9
|
import { vitePlusHeader } from '../../binding/index.js';
|
|
10
|
-
import { ensurePreCommitHook } from '../migration/migrator.js';
|
|
10
|
+
import { ensurePreCommitHook, hasStagedConfigInViteConfig } from '../migration/migrator.js';
|
|
11
11
|
import { updateExistingAgentInstructions } from '../utils/agent.js';
|
|
12
12
|
import { renderCliDoc } from '../utils/help.js';
|
|
13
13
|
import { defaultInteractive, promptGitHooks } from '../utils/prompts.js';
|
|
@@ -48,15 +48,21 @@ async function main() {
|
|
|
48
48
|
const dir = args['hooks-dir'];
|
|
49
49
|
const hooksOnly = args['hooks-only'];
|
|
50
50
|
const interactive = defaultInteractive();
|
|
51
|
-
const
|
|
51
|
+
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
52
|
+
const isLifecycleScript = lifecycleEvent === 'prepare' || lifecycleEvent === 'postinstall';
|
|
52
53
|
const root = process.cwd();
|
|
53
54
|
// --- Step 1: Hooks setup ---
|
|
54
55
|
const hooksDir = dir ?? '.vite-hooks';
|
|
55
56
|
const isFirstHooksRun = !existsSync(join(root, hooksDir, '_', 'pre-commit'));
|
|
56
57
|
let shouldSetupHooks = true;
|
|
57
|
-
if (interactive &&
|
|
58
|
+
if (interactive &&
|
|
59
|
+
isFirstHooksRun &&
|
|
60
|
+
!dir &&
|
|
61
|
+
!isLifecycleScript &&
|
|
62
|
+
!hasStagedConfigInViteConfig(root)) {
|
|
58
63
|
// --hooks-dir implies agreement; only prompt when using default dir on first run
|
|
59
|
-
//
|
|
64
|
+
// lifecycle script (prepare/postinstall) implies the project opted into hooks — install automatically
|
|
65
|
+
// existing staged config in vite.config.ts implies the project already opted in
|
|
60
66
|
shouldSetupHooks = await promptGitHooks({ interactive });
|
|
61
67
|
}
|
|
62
68
|
if (shouldSetupHooks) {
|
|
@@ -7,7 +7,7 @@ import path from "node:path";
|
|
|
7
7
|
import { stripVTControlCharacters, styleText } from "node:util";
|
|
8
8
|
import process$1, { stdin, stdout } from "node:process";
|
|
9
9
|
import * as k from "node:readline";
|
|
10
|
-
import
|
|
10
|
+
import c from "node:readline";
|
|
11
11
|
import { ReadStream } from "node:tty";
|
|
12
12
|
import color from "picocolors";
|
|
13
13
|
import fs from "node:fs";
|
|
@@ -359,7 +359,7 @@ var B = class {
|
|
|
359
359
|
this.state = "cancel", this.close();
|
|
360
360
|
}, { once: !0 });
|
|
361
361
|
}
|
|
362
|
-
this.rl =
|
|
362
|
+
this.rl = c.createInterface({
|
|
363
363
|
input: this.input,
|
|
364
364
|
tabSize: 2,
|
|
365
365
|
prompt: "",
|
|
@@ -4597,4 +4597,4 @@ function getMarkedRange(content, startMarker, endMarker) {
|
|
|
4597
4597
|
};
|
|
4598
4598
|
}
|
|
4599
4599
|
//#endregion
|
|
4600
|
-
export {
|
|
4600
|
+
export { displayRelative as A, outro as B, defaultInteractive as C, runViteInstall as D, runViteFmt as E, cancel as F, spinner as H, confirm as I, intro as L, DependencyType as M, PackageManager as N, selectPackageManager as O, require_semver as P, log as R, cancelAndExit as S, promptGitHooks as T, text as U, select as V, Ct as W, rewriteMonorepo as _, writeAgentInstructions as a, editYamlFile as b, detectEslintProject as c, hasStagedConfigInViteConfig as d, installGitHooks as f, preflightGitHooksSetup as g, migratePrettierToOxfmt as h, updateExistingAgentInstructions as i, templatesDir as j, upgradeYarn as k, detectPrettierProject as l, migrateEslintToOxlint as m, detectExistingAgentTargetPaths as n, checkViteVersion as o, mergeViteConfigFiles as p, selectAgentTargetPaths as r, checkVitestVersion as s, detectAgentConflicts as t, ensurePreCommitHook as u, rewriteMonorepoProject as v, downloadPackageManager$1 as w, readYamlFile as x, rewriteStandaloneProject as y, multiselect as z };
|
package/dist/global/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as defaultInteractive, T as promptGitHooks, d as hasStagedConfigInViteConfig, i as updateExistingAgentInstructions, u as ensurePreCommitHook } from "./agent-BJ8PFvbU.js";
|
|
2
2
|
import { t as lib_default } from "./lib-DxappLRQ.js";
|
|
3
3
|
import { i as log, t as renderCliDoc } from "./help-HviKaKAU.js";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -141,12 +141,13 @@ async function main() {
|
|
|
141
141
|
const dir = args["hooks-dir"];
|
|
142
142
|
const hooksOnly = args["hooks-only"];
|
|
143
143
|
const interactive = defaultInteractive();
|
|
144
|
-
const
|
|
144
|
+
const lifecycleEvent = process.env.npm_lifecycle_event;
|
|
145
|
+
const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
|
|
145
146
|
const root = process.cwd();
|
|
146
147
|
const hooksDir = dir ?? ".vite-hooks";
|
|
147
148
|
const isFirstHooksRun = !existsSync(join(root, hooksDir, "_", "pre-commit"));
|
|
148
149
|
let shouldSetupHooks = true;
|
|
149
|
-
if (interactive && isFirstHooksRun && !dir && !
|
|
150
|
+
if (interactive && isFirstHooksRun && !dir && !isLifecycleScript && !hasStagedConfigInViteConfig(root)) shouldSetupHooks = await promptGitHooks({ interactive });
|
|
150
151
|
if (shouldSetupHooks) {
|
|
151
152
|
const { message, isError } = install(dir);
|
|
152
153
|
if (message) {
|
package/dist/global/create.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./chunk-BoAXSpZd.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as displayRelative, C as defaultInteractive, D as runViteInstall, E as runViteFmt, F as cancel, H as spinner, I as confirm, L as intro, M as DependencyType, N as PackageManager, O as selectPackageManager, R as log, T as promptGitHooks, U as text, V as select, W as Ct, _ as rewriteMonorepo, a as writeAgentInstructions, f as installGitHooks, j as templatesDir, n as detectExistingAgentTargetPaths, r as selectAgentTargetPaths, v as rewriteMonorepoProject, w as downloadPackageManager$1, y as rewriteStandaloneProject, z as multiselect } from "./agent-BJ8PFvbU.js";
|
|
3
3
|
import { t as lib_default } from "./lib-DxappLRQ.js";
|
|
4
4
|
import { c as readJsonFile, o as editJsonFile, t as checkNpmPackageExists } from "./package-Y1UTfJnZ.js";
|
|
5
5
|
import { a as muted, i as log$1, n as accent, o as success, t as renderCliDoc } from "./help-HviKaKAU.js";
|
|
6
|
-
import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-
|
|
6
|
+
import { a as detectExistingEditor, n as updatePackageJsonWithDeps, o as selectEditor, r as updateWorkspaceConfig, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BnY0PTee.js";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { styleText } from "node:util";
|
|
9
9
|
import color from "picocolors";
|
|
@@ -3511,13 +3511,19 @@ async function executeBuiltinTemplate(workspaceInfo, templateInfo, options) {
|
|
|
3511
3511
|
} else if (templateInfo.command === BuiltinTemplate.library) {
|
|
3512
3512
|
const libraryTemplateInfo = discoverTemplate(LibraryTemplateRepo, [templateInfo.targetDir], workspaceInfo);
|
|
3513
3513
|
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, libraryTemplateInfo, false, options?.silent ?? false);
|
|
3514
|
+
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
3514
3515
|
setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
|
|
3515
3516
|
return {
|
|
3516
3517
|
...result,
|
|
3517
3518
|
projectDir: templateInfo.targetDir
|
|
3518
3519
|
};
|
|
3519
3520
|
}
|
|
3521
|
+
if (templateInfo.command.startsWith("vite:")) {
|
|
3522
|
+
if (!options?.silent) log.error(`Unknown builtin template "${templateInfo.command}". Run ${color.yellow("vp create --list")} to see available templates.`);
|
|
3523
|
+
return { exitCode: 1 };
|
|
3524
|
+
}
|
|
3520
3525
|
const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false, options?.silent ?? false);
|
|
3526
|
+
if (result.exitCode !== 0) return { exitCode: result.exitCode };
|
|
3521
3527
|
setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
|
|
3522
3528
|
return {
|
|
3523
3529
|
...result,
|
|
@@ -4150,7 +4156,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4150
4156
|
showCreateSummary({
|
|
4151
4157
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
4152
4158
|
installSummary,
|
|
4153
|
-
nextCommand: getNextCommand(projectDir,
|
|
4159
|
+
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
4154
4160
|
packageManager: workspaceInfo.packageManager,
|
|
4155
4161
|
packageManagerVersion: workspaceInfo.downloadPackageManager.version,
|
|
4156
4162
|
projectDir
|
|
@@ -4263,7 +4269,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
|
|
|
4263
4269
|
showCreateSummary({
|
|
4264
4270
|
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
|
|
4265
4271
|
installSummary,
|
|
4266
|
-
nextCommand:
|
|
4272
|
+
nextCommand: getNextCommand(projectDir, "vp run"),
|
|
4267
4273
|
packageManager: workspaceInfo.packageManager,
|
|
4268
4274
|
packageManagerVersion: workspaceInfo.downloadPackageManager.version,
|
|
4269
4275
|
projectDir
|
package/dist/global/migrate.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as __toESM } from "./chunk-BoAXSpZd.js";
|
|
2
|
-
import { B as
|
|
2
|
+
import { A as displayRelative, B as outro, C as defaultInteractive, D as runViteInstall, H as spinner, I as confirm, N as PackageManager, O as selectPackageManager, P as require_semver, R as log, S as cancelAndExit, T as promptGitHooks, V as select, W as Ct, _ as rewriteMonorepo, a as writeAgentInstructions, c as detectEslintProject, f as installGitHooks, g as preflightGitHooksSetup, h as migratePrettierToOxfmt, k as upgradeYarn, l as detectPrettierProject, m as migrateEslintToOxlint, n as detectExistingAgentTargetPaths, o as checkViteVersion, p as mergeViteConfigFiles, r as selectAgentTargetPaths, s as checkVitestVersion, t as detectAgentConflicts, w as downloadPackageManager$1, y as rewriteStandaloneProject } from "./agent-BJ8PFvbU.js";
|
|
3
3
|
import { t as lib_default } from "./lib-DxappLRQ.js";
|
|
4
4
|
import { a as readNearestPackageJson, i as hasVitePlusDependency, m as isForceOverrideMode } from "./package-Y1UTfJnZ.js";
|
|
5
5
|
import { a as muted, i as log$1, n as accent, t as renderCliDoc } from "./help-HviKaKAU.js";
|
|
6
6
|
import { r as createMigrationReport } from "./report-C7xbSNED.js";
|
|
7
|
-
import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-
|
|
7
|
+
import { i as detectEditorConflicts, o as selectEditor, s as writeEditorConfigs, t as detectWorkspace$1 } from "./workspace-BnY0PTee.js";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import { styleText } from "node:util";
|
|
10
10
|
import { vitePlusHeader } from "../../binding/index.js";
|
package/dist/global/staged.js
CHANGED
|
@@ -4,7 +4,7 @@ import { i as log, r as errorMsg, t as renderCliDoc } from "./help-HviKaKAU.js";
|
|
|
4
4
|
import path, { delimiter, dirname, normalize, resolve } from "node:path";
|
|
5
5
|
import { formatWithOptions, inspect, promisify } from "node:util";
|
|
6
6
|
import { cwd } from "node:process";
|
|
7
|
-
import
|
|
7
|
+
import c from "node:readline";
|
|
8
8
|
import nodeTty from "node:tty";
|
|
9
9
|
import fs, { constants } from "node:fs";
|
|
10
10
|
import { vitePlusHeader } from "../../binding/index.js";
|
|
@@ -637,7 +637,7 @@ var L = class {
|
|
|
637
637
|
if (this._streamErr) t.push(this._streamErr);
|
|
638
638
|
if (this._streamOut) t.push(this._streamOut);
|
|
639
639
|
const n = g(t);
|
|
640
|
-
const r =
|
|
640
|
+
const r = c.createInterface({ input: n });
|
|
641
641
|
for await (const e of r) yield e.toString();
|
|
642
642
|
await this._processClosed;
|
|
643
643
|
e.removeAllListeners();
|
|
@@ -3229,10 +3229,11 @@ const chunkFiles = ({ files, baseDir, maxArgLength = null, relative = false }) =
|
|
|
3229
3229
|
return chunkArray(normalizedFiles, chunkCount);
|
|
3230
3230
|
};
|
|
3231
3231
|
//#endregion
|
|
3232
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3232
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
|
|
3233
3233
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3234
3234
|
const WIN_SLASH = "\\\\/";
|
|
3235
3235
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
3236
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
3236
3237
|
/**
|
|
3237
3238
|
* Posix glob regex
|
|
3238
3239
|
*/
|
|
@@ -3282,8 +3283,10 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3282
3283
|
SEP: "\\"
|
|
3283
3284
|
};
|
|
3284
3285
|
module.exports = {
|
|
3286
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
3285
3287
|
MAX_LENGTH: 1024 * 64,
|
|
3286
3288
|
POSIX_REGEX_SOURCE: {
|
|
3289
|
+
__proto__: null,
|
|
3287
3290
|
alnum: "a-zA-Z0-9",
|
|
3288
3291
|
alpha: "a-zA-Z",
|
|
3289
3292
|
ascii: "\\x00-\\x7F",
|
|
@@ -3389,7 +3392,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3389
3392
|
};
|
|
3390
3393
|
}));
|
|
3391
3394
|
//#endregion
|
|
3392
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3395
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/utils.js
|
|
3393
3396
|
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3394
3397
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
3395
3398
|
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
@@ -3437,7 +3440,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3437
3440
|
};
|
|
3438
3441
|
}));
|
|
3439
3442
|
//#endregion
|
|
3440
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3443
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/scan.js
|
|
3441
3444
|
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3442
3445
|
const utils = require_utils();
|
|
3443
3446
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
@@ -3724,7 +3727,7 @@ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3724
3727
|
module.exports = scan;
|
|
3725
3728
|
}));
|
|
3726
3729
|
//#endregion
|
|
3727
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
3730
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/parse.js
|
|
3728
3731
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3729
3732
|
const constants = require_constants();
|
|
3730
3733
|
const utils = require_utils();
|
|
@@ -3752,6 +3755,177 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3752
3755
|
const syntaxError = (type, char) => {
|
|
3753
3756
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
3754
3757
|
};
|
|
3758
|
+
const splitTopLevel = (input) => {
|
|
3759
|
+
const parts = [];
|
|
3760
|
+
let bracket = 0;
|
|
3761
|
+
let paren = 0;
|
|
3762
|
+
let quote = 0;
|
|
3763
|
+
let value = "";
|
|
3764
|
+
let escaped = false;
|
|
3765
|
+
for (const ch of input) {
|
|
3766
|
+
if (escaped === true) {
|
|
3767
|
+
value += ch;
|
|
3768
|
+
escaped = false;
|
|
3769
|
+
continue;
|
|
3770
|
+
}
|
|
3771
|
+
if (ch === "\\") {
|
|
3772
|
+
value += ch;
|
|
3773
|
+
escaped = true;
|
|
3774
|
+
continue;
|
|
3775
|
+
}
|
|
3776
|
+
if (ch === "\"") {
|
|
3777
|
+
quote = quote === 1 ? 0 : 1;
|
|
3778
|
+
value += ch;
|
|
3779
|
+
continue;
|
|
3780
|
+
}
|
|
3781
|
+
if (quote === 0) {
|
|
3782
|
+
if (ch === "[") bracket++;
|
|
3783
|
+
else if (ch === "]" && bracket > 0) bracket--;
|
|
3784
|
+
else if (bracket === 0) {
|
|
3785
|
+
if (ch === "(") paren++;
|
|
3786
|
+
else if (ch === ")" && paren > 0) paren--;
|
|
3787
|
+
else if (ch === "|" && paren === 0) {
|
|
3788
|
+
parts.push(value);
|
|
3789
|
+
value = "";
|
|
3790
|
+
continue;
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
value += ch;
|
|
3795
|
+
}
|
|
3796
|
+
parts.push(value);
|
|
3797
|
+
return parts;
|
|
3798
|
+
};
|
|
3799
|
+
const isPlainBranch = (branch) => {
|
|
3800
|
+
let escaped = false;
|
|
3801
|
+
for (const ch of branch) {
|
|
3802
|
+
if (escaped === true) {
|
|
3803
|
+
escaped = false;
|
|
3804
|
+
continue;
|
|
3805
|
+
}
|
|
3806
|
+
if (ch === "\\") {
|
|
3807
|
+
escaped = true;
|
|
3808
|
+
continue;
|
|
3809
|
+
}
|
|
3810
|
+
if (/[?*+@!()[\]{}]/.test(ch)) return false;
|
|
3811
|
+
}
|
|
3812
|
+
return true;
|
|
3813
|
+
};
|
|
3814
|
+
const normalizeSimpleBranch = (branch) => {
|
|
3815
|
+
let value = branch.trim();
|
|
3816
|
+
let changed = true;
|
|
3817
|
+
while (changed === true) {
|
|
3818
|
+
changed = false;
|
|
3819
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
3820
|
+
value = value.slice(2, -1);
|
|
3821
|
+
changed = true;
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
if (!isPlainBranch(value)) return;
|
|
3825
|
+
return value.replace(/\\(.)/g, "$1");
|
|
3826
|
+
};
|
|
3827
|
+
const hasRepeatedCharPrefixOverlap = (branches) => {
|
|
3828
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
3829
|
+
for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
|
|
3830
|
+
const a = values[i];
|
|
3831
|
+
const b = values[j];
|
|
3832
|
+
const char = a[0];
|
|
3833
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
|
|
3834
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
|
|
3835
|
+
}
|
|
3836
|
+
return false;
|
|
3837
|
+
};
|
|
3838
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
3839
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
|
|
3840
|
+
let bracket = 0;
|
|
3841
|
+
let paren = 0;
|
|
3842
|
+
let quote = 0;
|
|
3843
|
+
let escaped = false;
|
|
3844
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
3845
|
+
const ch = pattern[i];
|
|
3846
|
+
if (escaped === true) {
|
|
3847
|
+
escaped = false;
|
|
3848
|
+
continue;
|
|
3849
|
+
}
|
|
3850
|
+
if (ch === "\\") {
|
|
3851
|
+
escaped = true;
|
|
3852
|
+
continue;
|
|
3853
|
+
}
|
|
3854
|
+
if (ch === "\"") {
|
|
3855
|
+
quote = quote === 1 ? 0 : 1;
|
|
3856
|
+
continue;
|
|
3857
|
+
}
|
|
3858
|
+
if (quote === 1) continue;
|
|
3859
|
+
if (ch === "[") {
|
|
3860
|
+
bracket++;
|
|
3861
|
+
continue;
|
|
3862
|
+
}
|
|
3863
|
+
if (ch === "]" && bracket > 0) {
|
|
3864
|
+
bracket--;
|
|
3865
|
+
continue;
|
|
3866
|
+
}
|
|
3867
|
+
if (bracket > 0) continue;
|
|
3868
|
+
if (ch === "(") {
|
|
3869
|
+
paren++;
|
|
3870
|
+
continue;
|
|
3871
|
+
}
|
|
3872
|
+
if (ch === ")") {
|
|
3873
|
+
paren--;
|
|
3874
|
+
if (paren === 0) {
|
|
3875
|
+
if (requireEnd === true && i !== pattern.length - 1) return;
|
|
3876
|
+
return {
|
|
3877
|
+
type: pattern[0],
|
|
3878
|
+
body: pattern.slice(2, i),
|
|
3879
|
+
end: i
|
|
3880
|
+
};
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
};
|
|
3885
|
+
const getStarExtglobSequenceOutput = (pattern) => {
|
|
3886
|
+
let index = 0;
|
|
3887
|
+
const chars = [];
|
|
3888
|
+
while (index < pattern.length) {
|
|
3889
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
3890
|
+
if (!match || match.type !== "*") return;
|
|
3891
|
+
const branches = splitTopLevel(match.body).map((branch) => branch.trim());
|
|
3892
|
+
if (branches.length !== 1) return;
|
|
3893
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
3894
|
+
if (!branch || branch.length !== 1) return;
|
|
3895
|
+
chars.push(branch);
|
|
3896
|
+
index += match.end + 1;
|
|
3897
|
+
}
|
|
3898
|
+
if (chars.length < 1) return;
|
|
3899
|
+
return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
|
|
3900
|
+
};
|
|
3901
|
+
const repeatedExtglobRecursion = (pattern) => {
|
|
3902
|
+
let depth = 0;
|
|
3903
|
+
let value = pattern.trim();
|
|
3904
|
+
let match = parseRepeatedExtglob(value);
|
|
3905
|
+
while (match) {
|
|
3906
|
+
depth++;
|
|
3907
|
+
value = match.body.trim();
|
|
3908
|
+
match = parseRepeatedExtglob(value);
|
|
3909
|
+
}
|
|
3910
|
+
return depth;
|
|
3911
|
+
};
|
|
3912
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
3913
|
+
if (options.maxExtglobRecursion === false) return { risky: false };
|
|
3914
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
3915
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
3916
|
+
if (branches.length > 1) {
|
|
3917
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
|
|
3918
|
+
}
|
|
3919
|
+
for (const branch of branches) {
|
|
3920
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
3921
|
+
if (safeOutput) return {
|
|
3922
|
+
risky: true,
|
|
3923
|
+
safeOutput
|
|
3924
|
+
};
|
|
3925
|
+
if (repeatedExtglobRecursion(branch) > max) return { risky: true };
|
|
3926
|
+
}
|
|
3927
|
+
return { risky: false };
|
|
3928
|
+
};
|
|
3755
3929
|
/**
|
|
3756
3930
|
* Parse the given input string.
|
|
3757
3931
|
* @param {String} input
|
|
@@ -3881,6 +4055,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3881
4055
|
token.prev = prev;
|
|
3882
4056
|
token.parens = state.parens;
|
|
3883
4057
|
token.output = state.output;
|
|
4058
|
+
token.startIndex = state.index;
|
|
4059
|
+
token.tokensIndex = tokens.length;
|
|
3884
4060
|
const output = (opts.capture ? "(" : "") + token.open;
|
|
3885
4061
|
increment("parens");
|
|
3886
4062
|
push({
|
|
@@ -3897,6 +4073,30 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
3897
4073
|
extglobs.push(token);
|
|
3898
4074
|
};
|
|
3899
4075
|
const extglobClose = (token) => {
|
|
4076
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
4077
|
+
const analysis = analyzeRepeatedExtglob(input.slice(token.startIndex + 2, state.index), opts);
|
|
4078
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
4079
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
4080
|
+
const open = tokens[token.tokensIndex];
|
|
4081
|
+
open.type = "text";
|
|
4082
|
+
open.value = literal;
|
|
4083
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
4084
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
4085
|
+
tokens[i].value = "";
|
|
4086
|
+
tokens[i].output = "";
|
|
4087
|
+
delete tokens[i].suffix;
|
|
4088
|
+
}
|
|
4089
|
+
state.output = token.output + open.output;
|
|
4090
|
+
state.backtrack = true;
|
|
4091
|
+
push({
|
|
4092
|
+
type: "paren",
|
|
4093
|
+
extglob: true,
|
|
4094
|
+
value,
|
|
4095
|
+
output: ""
|
|
4096
|
+
});
|
|
4097
|
+
decrement("parens");
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
3900
4100
|
let output = token.close + (opts.capture ? ")" : "");
|
|
3901
4101
|
let rest;
|
|
3902
4102
|
if (token.type === "negate") {
|
|
@@ -4582,7 +4782,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4582
4782
|
module.exports = parse;
|
|
4583
4783
|
}));
|
|
4584
4784
|
//#endregion
|
|
4585
|
-
//#region ../../node_modules/.pnpm/picomatch@4.0.
|
|
4785
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.4/node_modules/picomatch/lib/picomatch.js
|
|
4586
4786
|
var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4587
4787
|
const scan = require_scan();
|
|
4588
4788
|
const parse = require_parse();
|
|
@@ -4792,6 +4992,14 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4792
4992
|
* Compile a regular expression from the `state` object returned by the
|
|
4793
4993
|
* [parse()](#parse) method.
|
|
4794
4994
|
*
|
|
4995
|
+
* ```js
|
|
4996
|
+
* const picomatch = require('picomatch');
|
|
4997
|
+
* const state = picomatch.parse('*.js');
|
|
4998
|
+
* // picomatch.compileRe(state[, options]);
|
|
4999
|
+
*
|
|
5000
|
+
* console.log(picomatch.compileRe(state));
|
|
5001
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
5002
|
+
* ```
|
|
4795
5003
|
* @param {Object} `state`
|
|
4796
5004
|
* @param {Object} `options`
|
|
4797
5005
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -4815,10 +5023,10 @@ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4815
5023
|
*
|
|
4816
5024
|
* ```js
|
|
4817
5025
|
* const picomatch = require('picomatch');
|
|
4818
|
-
*
|
|
4819
|
-
* // picomatch.compileRe(state[, options]);
|
|
5026
|
+
* // picomatch.makeRe(state[, options]);
|
|
4820
5027
|
*
|
|
4821
|
-
*
|
|
5028
|
+
* const result = picomatch.makeRe('*.js');
|
|
5029
|
+
* console.log(result);
|
|
4822
5030
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4823
5031
|
* ```
|
|
4824
5032
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as PackageManager, R as log, V as select, W as Ct, b as editYamlFile, x as readYamlFile } from "./agent-BJ8PFvbU.js";
|
|
2
2
|
import { g as YAMLSeq, y as Scalar } from "./browser-09BZLUYM.js";
|
|
3
3
|
import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-Y1UTfJnZ.js";
|
|
4
4
|
import path, { posix, win32 } from "node:path";
|
package/dist/run-config.d.ts
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
export type AutoInput = {
|
|
2
|
+
/**
|
|
3
|
+
* Automatically track which files the task reads
|
|
4
|
+
*/
|
|
5
|
+
auto: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type GlobWithBase = {
|
|
8
|
+
/**
|
|
9
|
+
* The glob pattern (positive or negative starting with `!`)
|
|
10
|
+
*/
|
|
11
|
+
pattern: string;
|
|
12
|
+
/**
|
|
13
|
+
* The base directory for resolving the pattern
|
|
14
|
+
*/
|
|
15
|
+
base: InputBase;
|
|
16
|
+
};
|
|
17
|
+
export type InputBase = 'package' | 'workspace';
|
|
1
18
|
export type Task = {
|
|
2
19
|
/**
|
|
3
20
|
* The command to run for the task.
|
|
@@ -29,18 +46,12 @@ export type Task = {
|
|
|
29
46
|
*
|
|
30
47
|
* - Omitted: automatically tracks which files the task reads
|
|
31
48
|
* - `[]` (empty): disables file tracking entirely
|
|
32
|
-
* - Glob patterns (e.g. `"src/**"`) select specific files
|
|
49
|
+
* - Glob patterns (e.g. `"src/**"`) select specific files, relative to the package directory
|
|
50
|
+
* - `{pattern: "...", base: "workspace" | "package"}` specifies a glob with an explicit base directory
|
|
33
51
|
* - `{auto: true}` enables automatic file tracking
|
|
34
52
|
* - Negative patterns (e.g. `"!dist/**"`) exclude matched files
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
input?: Array<string | {
|
|
39
|
-
/**
|
|
40
|
-
* Automatically track which files the task reads
|
|
41
|
-
*/
|
|
42
|
-
auto: boolean;
|
|
43
|
-
}>;
|
|
53
|
+
*/
|
|
54
|
+
input?: Array<string | GlobWithBase | AutoInput>;
|
|
44
55
|
} | {
|
|
45
56
|
/**
|
|
46
57
|
* Whether to cache the task
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15-alpha.1",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -315,10 +315,10 @@
|
|
|
315
315
|
"cross-spawn": "^7.0.5",
|
|
316
316
|
"oxfmt": "=0.42.0",
|
|
317
317
|
"oxlint": "=1.57.0",
|
|
318
|
-
"oxlint-tsgolint": "=0.17.
|
|
318
|
+
"oxlint-tsgolint": "=0.17.4",
|
|
319
319
|
"picocolors": "^1.1.1",
|
|
320
|
-
"@voidzero-dev/vite-plus-core": "0.1.
|
|
321
|
-
"@voidzero-dev/vite-plus-test": "0.1.
|
|
320
|
+
"@voidzero-dev/vite-plus-core": "0.1.15-alpha.1",
|
|
321
|
+
"@voidzero-dev/vite-plus-test": "0.1.15-alpha.1"
|
|
322
322
|
},
|
|
323
323
|
"devDependencies": {
|
|
324
324
|
"@napi-rs/cli": "^3.4.1",
|
|
@@ -337,12 +337,12 @@
|
|
|
337
337
|
"mri": "^1.2.0",
|
|
338
338
|
"rolldown-plugin-dts": "^0.22.0",
|
|
339
339
|
"semver": "^7.7.3",
|
|
340
|
-
"tsdown": "^0.21.
|
|
340
|
+
"tsdown": "^0.21.5",
|
|
341
341
|
"validate-npm-package-name": "^7.0.2",
|
|
342
342
|
"yaml": "^2.8.1",
|
|
343
343
|
"@voidzero-dev/vite-plus-prompts": "0.0.0",
|
|
344
|
-
"
|
|
345
|
-
"
|
|
344
|
+
"rolldown": "1.0.0-rc.12",
|
|
345
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.1"
|
|
346
346
|
},
|
|
347
347
|
"napi": {
|
|
348
348
|
"binaryName": "vite-plus",
|
|
@@ -362,14 +362,14 @@
|
|
|
362
362
|
"node": "^20.19.0 || >=22.12.0"
|
|
363
363
|
},
|
|
364
364
|
"optionalDependencies": {
|
|
365
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.
|
|
366
|
-
"@voidzero-dev/vite-plus-darwin-x64": "0.1.
|
|
367
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.
|
|
368
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.
|
|
369
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.
|
|
370
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.
|
|
371
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.
|
|
372
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.
|
|
365
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.15-alpha.1",
|
|
366
|
+
"@voidzero-dev/vite-plus-darwin-x64": "0.1.15-alpha.1",
|
|
367
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.15-alpha.1",
|
|
368
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.15-alpha.1",
|
|
369
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.15-alpha.1",
|
|
370
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.15-alpha.1",
|
|
371
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.15-alpha.1",
|
|
372
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.15-alpha.1"
|
|
373
373
|
},
|
|
374
374
|
"scripts": {
|
|
375
375
|
"build": "oxnode -C dev ./build.ts",
|