vite-plus 0.1.22 → 0.1.23

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.
Files changed (62) hide show
  1. package/binding/index.cjs +119 -52
  2. package/binding/index.d.cts +3222 -2
  3. package/dist/agent-aSGY0osq.js +2461 -0
  4. package/dist/bin.js +6 -5
  5. package/dist/cli-truncate-CWsmbK3p.js +867 -0
  6. package/dist/{compat-OlmU9EQz.js → compat-DXZgnEyq.js} +1 -1
  7. package/dist/config/bin.js +18 -5
  8. package/dist/{constants-kDaYqyWd.js → constants-DCBWlNrn.js} +7 -2
  9. package/dist/create/bin.js +135 -64
  10. package/dist/{define-config-IMCGDS2K.d.ts → define-config-COdn-tsn.d.ts} +7 -5
  11. package/dist/define-config.cjs +1 -1
  12. package/dist/define-config.d.ts +1 -1
  13. package/dist/define-config.js +1 -1
  14. package/dist/dist-Bapm49IR.js +3 -0
  15. package/dist/{dist-owlRxmBM.js → dist-BgQuvbtq.js} +136 -110
  16. package/dist/fmt.d.ts +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/is-fullwidth-code-point-BUNlIICg.js +8 -0
  21. package/dist/lint.d.ts +1 -1
  22. package/dist/{log-update-NRrY6krx.js → log-update-lyIiuflf.js} +111 -24
  23. package/dist/migration/bin.js +71 -30
  24. package/dist/{oxlint-plugin-config-BkQeR4FR.js → oxlint-plugin-config-B89iKTKN.js} +1 -1
  25. package/dist/oxlint-plugin.d.ts +2 -4
  26. package/dist/oxlint-plugin.js +1 -1
  27. package/dist/pack-bin.js +1 -1
  28. package/dist/pack.d.ts +1 -1
  29. package/dist/{package-BoLLED6j.js → package-PmBUZ-ve.js} +2 -2
  30. package/dist/staged/bin.js +10 -10
  31. package/dist/strip-ansi-C3wrWz9t.js +853 -0
  32. package/dist/{agent-BWLe0i9g.js → tsconfig-DlUVXT3J.js} +648 -2089
  33. package/dist/version.js +5 -5
  34. package/dist/versions.js +6 -6
  35. package/dist/{workspace-Bi_9spVt.js → workspace-DElv730L.js} +13 -12
  36. package/dist/wrap-ansi-CeQuiQ31.js +2 -0
  37. package/dist/{wrap-ansi-DtUeUCjE.js → wrap-ansi-k7Dn4VtV.js} +1 -1
  38. package/docs/config/run.md +39 -4
  39. package/docs/guide/cache.md +10 -1
  40. package/docs/guide/env.md +3 -0
  41. package/docs/guide/ide-integration.md +2 -2
  42. package/docs/guide/install.md +2 -0
  43. package/docs/guide/run.md +2 -0
  44. package/docs/guide/troubleshooting.md +5 -2
  45. package/package.json +18 -18
  46. package/templates/monorepo/_gitignore +1 -0
  47. package/dist/cli-truncate-B62YnW2m.js +0 -138
  48. package/dist/dist-DZfItHAr.js +0 -3
  49. package/dist/slice-ansi-e4todZeH.js +0 -113
  50. package/dist/strip-ansi-D-eYYcD2.js +0 -198
  51. package/dist/tsconfig-BVyzXJ_o.js +0 -517
  52. package/dist/wrap-ansi-3S3qJ7j8.js +0 -2
  53. /package/dist/{chunk-q7NCDQ7-.js → chunk-DnnnRqeS.js} +0 -0
  54. /package/dist/{define-config-GqLoRwH9.cjs → define-config-BR1Y88zz.cjs} +0 -0
  55. /package/dist/{define-config-CzWdQTt2.js → define-config-BRC7qPNE.js} +0 -0
  56. /package/dist/{help-DK5wuu34.js → help-YP84FSEz.js} +0 -0
  57. /package/dist/{lib-DpwyUJWo.js → lib-L3DWSRQp.js} +0 -0
  58. /package/dist/{main-DhsO6ndq.js → main-DpJl3LoU.js} +0 -0
  59. /package/dist/{pack-K7H72Cum.d.ts → pack-Ciiho0Tq.d.ts} +0 -0
  60. /package/dist/{report-CYPv1VK1.js → report-DgSBQUdz.js} +0 -0
  61. /package/dist/{resolve-vite-config-C5AjksTj.js → resolve-vite-config-TTvhycU1.js} +0 -0
  62. /package/dist/{terminal-D_Kg-AA6.js → terminal-uTv0ZaMr.js} +0 -0
@@ -1,517 +0,0 @@
1
- import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-q7NCDQ7-.js";
2
- import { n as modify, r as parse, t as applyEdits } from "./main-DhsO6ndq.js";
3
- import path from "node:path";
4
- import fs from "node:fs";
5
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
6
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7
- module.exports = isexe;
8
- isexe.sync = sync;
9
- var fs$3 = __require("fs");
10
- function checkPathExt(path, options) {
11
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
12
- if (!pathext) return true;
13
- pathext = pathext.split(";");
14
- if (pathext.indexOf("") !== -1) return true;
15
- for (var i = 0; i < pathext.length; i++) {
16
- var p = pathext[i].toLowerCase();
17
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
18
- }
19
- return false;
20
- }
21
- function checkStat(stat, path, options) {
22
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
23
- return checkPathExt(path, options);
24
- }
25
- function isexe(path, options, cb) {
26
- fs$3.stat(path, function(er, stat) {
27
- cb(er, er ? false : checkStat(stat, path, options));
28
- });
29
- }
30
- function sync(path, options) {
31
- return checkStat(fs$3.statSync(path), path, options);
32
- }
33
- }));
34
- //#endregion
35
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
36
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37
- module.exports = isexe;
38
- isexe.sync = sync;
39
- var fs$2 = __require("fs");
40
- function isexe(path, options, cb) {
41
- fs$2.stat(path, function(er, stat) {
42
- cb(er, er ? false : checkStat(stat, options));
43
- });
44
- }
45
- function sync(path, options) {
46
- return checkStat(fs$2.statSync(path), options);
47
- }
48
- function checkStat(stat, options) {
49
- return stat.isFile() && checkMode(stat, options);
50
- }
51
- function checkMode(stat, options) {
52
- var mod = stat.mode;
53
- var uid = stat.uid;
54
- var gid = stat.gid;
55
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
56
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
57
- var u = parseInt("100", 8);
58
- var g = parseInt("010", 8);
59
- var o = parseInt("001", 8);
60
- var ug = u | g;
61
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
62
- }
63
- }));
64
- //#endregion
65
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
66
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
67
- __require("fs");
68
- var core;
69
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
70
- else core = require_mode();
71
- module.exports = isexe;
72
- isexe.sync = sync;
73
- function isexe(path, options, cb) {
74
- if (typeof options === "function") {
75
- cb = options;
76
- options = {};
77
- }
78
- if (!cb) {
79
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
80
- return new Promise(function(resolve, reject) {
81
- isexe(path, options || {}, function(er, is) {
82
- if (er) reject(er);
83
- else resolve(is);
84
- });
85
- });
86
- }
87
- core(path, options || {}, function(er, is) {
88
- if (er) {
89
- if (er.code === "EACCES" || options && options.ignoreErrors) {
90
- er = null;
91
- is = false;
92
- }
93
- }
94
- cb(er, is);
95
- });
96
- }
97
- function sync(path, options) {
98
- try {
99
- return core.sync(path, options || {});
100
- } catch (er) {
101
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
102
- else throw er;
103
- }
104
- }
105
- }));
106
- //#endregion
107
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
108
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
109
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
110
- const path$3 = __require("path");
111
- const COLON = isWindows ? ";" : ":";
112
- const isexe = require_isexe();
113
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
114
- const getPathInfo = (cmd, opt) => {
115
- const colon = opt.colon || COLON;
116
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH || "").split(colon)];
117
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
118
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
119
- if (isWindows) {
120
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
121
- }
122
- return {
123
- pathEnv,
124
- pathExt,
125
- pathExtExe
126
- };
127
- };
128
- const which = (cmd, opt, cb) => {
129
- if (typeof opt === "function") {
130
- cb = opt;
131
- opt = {};
132
- }
133
- if (!opt) opt = {};
134
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
135
- const found = [];
136
- const step = (i) => new Promise((resolve, reject) => {
137
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
138
- const ppRaw = pathEnv[i];
139
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
140
- const pCmd = path$3.join(pathPart, cmd);
141
- resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i, 0));
142
- });
143
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
144
- if (ii === pathExt.length) return resolve(step(i + 1));
145
- const ext = pathExt[ii];
146
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
147
- if (!er && is) if (opt.all) found.push(p + ext);
148
- else return resolve(p + ext);
149
- return resolve(subStep(p, i, ii + 1));
150
- });
151
- });
152
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
153
- };
154
- const whichSync = (cmd, opt) => {
155
- opt = opt || {};
156
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
157
- const found = [];
158
- for (let i = 0; i < pathEnv.length; i++) {
159
- const ppRaw = pathEnv[i];
160
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
161
- const pCmd = path$3.join(pathPart, cmd);
162
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
163
- for (let j = 0; j < pathExt.length; j++) {
164
- const cur = p + pathExt[j];
165
- try {
166
- if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
167
- else return cur;
168
- } catch (ex) {}
169
- }
170
- }
171
- if (opt.all && found.length) return found;
172
- if (opt.nothrow) return null;
173
- throw getNotFoundError(cmd);
174
- };
175
- module.exports = which;
176
- which.sync = whichSync;
177
- }));
178
- //#endregion
179
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
180
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
181
- const pathKey = (options = {}) => {
182
- const environment = options.env || process.env;
183
- if ((options.platform || process.platform) !== "win32") return "PATH";
184
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
185
- };
186
- module.exports = pathKey;
187
- module.exports.default = pathKey;
188
- }));
189
- //#endregion
190
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
191
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
192
- const path$2 = __require("path");
193
- const which = require_which();
194
- const getPathKey = require_path_key();
195
- function resolveCommandAttempt(parsed, withoutPathExt) {
196
- const env = parsed.options.env || process.env;
197
- const cwd = process.cwd();
198
- const hasCustomCwd = parsed.options.cwd != null;
199
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
200
- if (shouldSwitchCwd) try {
201
- process.chdir(parsed.options.cwd);
202
- } catch (err) {}
203
- let resolved;
204
- try {
205
- resolved = which.sync(parsed.command, {
206
- path: env[getPathKey({ env })],
207
- pathExt: withoutPathExt ? path$2.delimiter : void 0
208
- });
209
- } catch (e) {} finally {
210
- if (shouldSwitchCwd) process.chdir(cwd);
211
- }
212
- if (resolved) resolved = path$2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
213
- return resolved;
214
- }
215
- function resolveCommand(parsed) {
216
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
217
- }
218
- module.exports = resolveCommand;
219
- }));
220
- //#endregion
221
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
222
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
223
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
224
- function escapeCommand(arg) {
225
- arg = arg.replace(metaCharsRegExp, "^$1");
226
- return arg;
227
- }
228
- function escapeArgument(arg, doubleEscapeMetaChars) {
229
- arg = `${arg}`;
230
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
231
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
232
- arg = `"${arg}"`;
233
- arg = arg.replace(metaCharsRegExp, "^$1");
234
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
235
- return arg;
236
- }
237
- module.exports.command = escapeCommand;
238
- module.exports.argument = escapeArgument;
239
- }));
240
- //#endregion
241
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
242
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
243
- module.exports = /^#!(.*)/;
244
- }));
245
- //#endregion
246
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
247
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
248
- const shebangRegex = require_shebang_regex();
249
- module.exports = (string = "") => {
250
- const match = string.match(shebangRegex);
251
- if (!match) return null;
252
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
253
- const binary = path.split("/").pop();
254
- if (binary === "env") return argument;
255
- return argument ? `${binary} ${argument}` : binary;
256
- };
257
- }));
258
- //#endregion
259
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
260
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
261
- const fs$1 = __require("fs");
262
- const shebangCommand = require_shebang_command();
263
- function readShebang(command) {
264
- const size = 150;
265
- const buffer = Buffer.alloc(size);
266
- let fd;
267
- try {
268
- fd = fs$1.openSync(command, "r");
269
- fs$1.readSync(fd, buffer, 0, size, 0);
270
- fs$1.closeSync(fd);
271
- } catch (e) {}
272
- return shebangCommand(buffer.toString());
273
- }
274
- module.exports = readShebang;
275
- }));
276
- //#endregion
277
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
278
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
279
- const path$1 = __require("path");
280
- const resolveCommand = require_resolveCommand();
281
- const escape = require_escape();
282
- const readShebang = require_readShebang();
283
- const isWin = process.platform === "win32";
284
- const isExecutableRegExp = /\.(?:com|exe)$/i;
285
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
286
- function detectShebang(parsed) {
287
- parsed.file = resolveCommand(parsed);
288
- const shebang = parsed.file && readShebang(parsed.file);
289
- if (shebang) {
290
- parsed.args.unshift(parsed.file);
291
- parsed.command = shebang;
292
- return resolveCommand(parsed);
293
- }
294
- return parsed.file;
295
- }
296
- function parseNonShell(parsed) {
297
- if (!isWin) return parsed;
298
- const commandFile = detectShebang(parsed);
299
- const needsShell = !isExecutableRegExp.test(commandFile);
300
- if (parsed.options.forceShell || needsShell) {
301
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
302
- parsed.command = path$1.normalize(parsed.command);
303
- parsed.command = escape.command(parsed.command);
304
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
305
- parsed.args = [
306
- "/d",
307
- "/s",
308
- "/c",
309
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
310
- ];
311
- parsed.command = process.env.comspec || "cmd.exe";
312
- parsed.options.windowsVerbatimArguments = true;
313
- }
314
- return parsed;
315
- }
316
- function parse(command, args, options) {
317
- if (args && !Array.isArray(args)) {
318
- options = args;
319
- args = null;
320
- }
321
- args = args ? args.slice(0) : [];
322
- options = Object.assign({}, options);
323
- const parsed = {
324
- command,
325
- args,
326
- options,
327
- file: void 0,
328
- original: {
329
- command,
330
- args
331
- }
332
- };
333
- return options.shell ? parsed : parseNonShell(parsed);
334
- }
335
- module.exports = parse;
336
- }));
337
- //#endregion
338
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
339
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
340
- const isWin = process.platform === "win32";
341
- function notFoundError(original, syscall) {
342
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
343
- code: "ENOENT",
344
- errno: "ENOENT",
345
- syscall: `${syscall} ${original.command}`,
346
- path: original.command,
347
- spawnargs: original.args
348
- });
349
- }
350
- function hookChildProcess(cp, parsed) {
351
- if (!isWin) return;
352
- const originalEmit = cp.emit;
353
- cp.emit = function(name, arg1) {
354
- if (name === "exit") {
355
- const err = verifyENOENT(arg1, parsed);
356
- if (err) return originalEmit.call(cp, "error", err);
357
- }
358
- return originalEmit.apply(cp, arguments);
359
- };
360
- }
361
- function verifyENOENT(status, parsed) {
362
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
363
- return null;
364
- }
365
- function verifyENOENTSync(status, parsed) {
366
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
367
- return null;
368
- }
369
- module.exports = {
370
- hookChildProcess,
371
- verifyENOENT,
372
- verifyENOENTSync,
373
- notFoundError
374
- };
375
- }));
376
- //#endregion
377
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
378
- var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
379
- const cp = __require("child_process");
380
- const parse = require_parse();
381
- const enoent = require_enoent();
382
- function spawn(command, args, options) {
383
- const parsed = parse(command, args, options);
384
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
385
- enoent.hookChildProcess(spawned, parsed);
386
- return spawned;
387
- }
388
- function spawnSync(command, args, options) {
389
- const parsed = parse(command, args, options);
390
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
391
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
392
- return result;
393
- }
394
- module.exports = spawn;
395
- module.exports.spawn = spawn;
396
- module.exports.sync = spawnSync;
397
- module.exports._parse = parse;
398
- module.exports._enoent = enoent;
399
- }));
400
- //#endregion
401
- //#region src/utils/command.ts
402
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
403
- async function runCommandSilently(options) {
404
- const child = (0, import_cross_spawn.default)(options.command, options.args, {
405
- stdio: [
406
- "ignore",
407
- "pipe",
408
- "pipe"
409
- ],
410
- cwd: options.cwd,
411
- env: options.envs
412
- });
413
- return await new Promise((resolve, reject) => {
414
- const stdout = [];
415
- const stderr = [];
416
- child.stdout?.on("data", (data) => {
417
- stdout.push(data);
418
- });
419
- child.stderr?.on("data", (data) => {
420
- stderr.push(data);
421
- });
422
- child.on("close", (code) => {
423
- resolve({
424
- exitCode: code ?? 0,
425
- stdout: Buffer.concat(stdout),
426
- stderr: Buffer.concat(stderr)
427
- });
428
- });
429
- child.on("error", (err) => {
430
- reject(err);
431
- });
432
- });
433
- }
434
- async function runCommand(options) {
435
- const child = (0, import_cross_spawn.default)(options.command, options.args, {
436
- stdio: "inherit",
437
- cwd: options.cwd,
438
- env: options.envs
439
- });
440
- return new Promise((resolve, reject) => {
441
- child.on("close", (code) => {
442
- resolve({ exitCode: code ?? 0 });
443
- });
444
- child.on("error", (err) => {
445
- reject(err);
446
- });
447
- });
448
- }
449
- //#endregion
450
- //#region src/utils/tsconfig.ts
451
- /**
452
- * Check if tsconfig.json has compilerOptions.baseUrl set.
453
- * oxlint's TypeScript checker (tsgolint) does not support baseUrl,
454
- * so typeAware/typeCheck must be disabled when it is present.
455
- */
456
- function hasBaseUrlInTsconfig(projectPath) {
457
- try {
458
- return JSON.parse(fs.readFileSync(path.join(projectPath, "tsconfig.json"), "utf-8"))?.compilerOptions?.baseUrl !== void 0;
459
- } catch {
460
- return false;
461
- }
462
- }
463
- const TSCONFIG_FILE_RE = /^tsconfig(\.[\w-]+)?\.json$/i;
464
- function findTsconfigFiles(projectPath) {
465
- try {
466
- return fs.readdirSync(projectPath).filter((name) => TSCONFIG_FILE_RE.test(name)).map((name) => path.join(projectPath, name));
467
- } catch {
468
- return [];
469
- }
470
- }
471
- function removeDeprecatedTsconfigFalseOption(filePath, optionName) {
472
- let text;
473
- try {
474
- text = fs.readFileSync(filePath, "utf-8");
475
- } catch {
476
- return false;
477
- }
478
- if (parse(text)?.compilerOptions?.[optionName] !== false) return false;
479
- const edits = modify(text, ["compilerOptions", optionName], void 0, {});
480
- if (edits.length === 0) return false;
481
- const newText = applyEdits(text, edits);
482
- fs.writeFileSync(filePath, newText);
483
- return true;
484
- }
485
- function rewriteTypesInTsconfig(filePath) {
486
- let text;
487
- try {
488
- text = fs.readFileSync(filePath, "utf-8");
489
- } catch {
490
- return false;
491
- }
492
- const types = parse(text)?.compilerOptions?.types;
493
- if (!Array.isArray(types)) return false;
494
- const REPLACEMENTS = {
495
- "tsdown/client": "vite-plus/pack/client",
496
- "vite/client": "vite-plus/client"
497
- };
498
- const toReplace = types.map((t, i) => typeof t === "string" && t in REPLACEMENTS ? {
499
- i,
500
- newVal: REPLACEMENTS[t]
501
- } : null).filter((x) => x !== null);
502
- if (toReplace.length === 0) return false;
503
- let currentText = text;
504
- for (let j = toReplace.length - 1; j >= 0; j--) {
505
- const { i, newVal } = toReplace[j];
506
- const edits = modify(currentText, [
507
- "compilerOptions",
508
- "types",
509
- i
510
- ], newVal, {});
511
- if (edits.length > 0) currentText = applyEdits(currentText, edits);
512
- }
513
- fs.writeFileSync(filePath, currentText);
514
- return true;
515
- }
516
- //#endregion
517
- export { runCommand as a, rewriteTypesInTsconfig as i, hasBaseUrlInTsconfig as n, runCommandSilently as o, removeDeprecatedTsconfigFalseOption as r, require_cross_spawn as s, findTsconfigFiles as t };
@@ -1,2 +0,0 @@
1
- import { t as wrapAnsi } from "./wrap-ansi-DtUeUCjE.js";
2
- export { wrapAnsi as default };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes