vite-plus 0.1.20-alpha.3 → 0.1.20
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/LICENSE +0 -28
- package/README.md +0 -10
- package/dist/{agent-C8Me6C5u.js → agent-D_WSpD0r.js} +2 -14
- package/dist/bin.js +1 -1
- package/dist/config/bin.js +1 -1
- package/dist/create/bin.js +57 -847
- package/dist/{define-config-bKSulJaG.d.ts → define-config-hLuWEqIf.d.ts} +0 -14
- package/dist/define-config.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/migration/bin.js +3 -3
- package/dist/pack-bin.js +1 -1
- package/dist/{package-CrKanQYM.js → package-D_LD1iiI.js} +4 -135
- package/dist/{resolve-vite-config-C1KX9CZU.js → resolve-vite-config-B_w1u1j4.js} +1 -1
- package/dist/staged/bin.js +17 -17
- package/dist/version.js +1 -1
- package/dist/{workspace-Du9O0xar.js → workspace-DVOyShUK.js} +6 -2
- package/docs/guide/create.md +1 -148
- package/docs/guide/ide-integration.md +5 -1
- package/package.json +14 -15
- package/docs/config/create.md +0 -35
|
@@ -135,20 +135,6 @@ declare module '@voidzero-dev/vite-plus-core' {
|
|
|
135
135
|
pack?: PackUserConfig | PackUserConfig[];
|
|
136
136
|
run?: RunConfig;
|
|
137
137
|
staged?: StagedConfig;
|
|
138
|
-
/**
|
|
139
|
-
* Options for `vp create`.
|
|
140
|
-
*
|
|
141
|
-
* See `rfcs/create-org-default-templates.md` for the full specification.
|
|
142
|
-
*/
|
|
143
|
-
create?: {
|
|
144
|
-
/**
|
|
145
|
-
* When `vp create` is invoked with no template argument, use this
|
|
146
|
-
* value as if the user had typed it — typically a scope like
|
|
147
|
-
* `'@your-org'` paired with a `@your-org/create` package that exposes a
|
|
148
|
-
* `createConfig.templates` manifest.
|
|
149
|
-
*/
|
|
150
|
-
defaultTemplate?: string;
|
|
151
|
-
};
|
|
152
138
|
}
|
|
153
139
|
}
|
|
154
140
|
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
|
package/dist/define-config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-hLuWEqIf.js";
|
|
2
2
|
export { defineConfig, lazyPlugins };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as lazyPlugins, t as defineConfig } from "./define-config-
|
|
1
|
+
import { n as lazyPlugins, t as defineConfig } from "./define-config-hLuWEqIf.js";
|
|
2
2
|
export * from "@voidzero-dev/vite-plus-test/config";
|
|
3
3
|
export * from "@voidzero-dev/vite-plus-core";
|
|
4
4
|
export { defineConfig, lazyPlugins };
|
package/dist/migration/bin.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as __toESM } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { l as isForceOverrideMode } from "../main-A6UrSTYb.js";
|
|
3
3
|
import { a as printHeader, i as muted, r as log, t as accent } from "../terminal-CxTMfsxZ.js";
|
|
4
|
-
import {
|
|
4
|
+
import { $ as outro, A as warnLegacyEslintConfig, B as runViteInstall, C as preflightGitHooksSetup, E as rewriteMonorepo, F as cancelAndExit, H as upgradeYarn, I as defaultInteractive, K as PackageManager, L as downloadPackageManager, M as warnPackageLevelPrettier, O as rewriteStandaloneProject, R as promptGitHooks, S as migratePrettierToOxfmt, T as promptPrettierMigration, U as displayRelative, V as selectPackageManager, Y as confirm, Z as log$1, a as writeAgentInstructions, b as migrateEslintToOxlint, c as checkVitestVersion, d as detectEslintProject, et as select, f as detectFramework, g as hasFrameworkShim, it as q, j as warnPackageLevelEslint, l as confirmEslintMigration, m as detectPrettierProject, n as detectExistingAgentTargetPaths, o as addFrameworkShim, p as detectNodeVersionManagerFile, q as require_semver, r as selectAgentTargetPaths, s as checkViteVersion, t as detectAgentConflicts, tt as spinner, u as confirmPrettierMigration, v as installGitHooks, w as promptEslintMigration, x as migrateNodeVersionManagerFile, y as mergeViteConfigFiles } from "../agent-D_WSpD0r.js";
|
|
5
5
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
6
|
-
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-
|
|
6
|
+
import { a as readNearestPackageJson, i as hasVitePlusDependency } from "../package-D_LD1iiI.js";
|
|
7
7
|
import { r as createMigrationReport } from "../report-DbrfjWiP.js";
|
|
8
|
-
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-
|
|
8
|
+
import { c as writeEditorConfigs, i as detectEditorConflicts, o as selectEditor, t as detectWorkspace } from "../workspace-DVOyShUK.js";
|
|
9
9
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { styleText } from "node:util";
|
package/dist/pack-bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { n as resolveViteConfig } from "./resolve-vite-config-B_w1u1j4.js";
|
|
3
3
|
import module from "node:module";
|
|
4
4
|
import { buildWithConfigs, enableDebug, globalLogger, resolveUserConfig } from "@voidzero-dev/vite-plus-core/pack";
|
|
5
5
|
//#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
|
|
@@ -2,7 +2,6 @@ import { r as parse } from "./main-A6UrSTYb.js";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import fs from "node:fs";
|
|
5
|
-
import os from "node:os";
|
|
6
5
|
//#region ../../node_modules/.pnpm/detect-indent@7.0.2/node_modules/detect-indent/index.js
|
|
7
6
|
const INDENT_REGEX = /^(?:( )+|\t+)/;
|
|
8
7
|
const INDENT_TYPE_SPACE = "space";
|
|
@@ -138,135 +137,6 @@ function isJsonFile(file) {
|
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
//#endregion
|
|
141
|
-
//#region src/utils/npm-config.ts
|
|
142
|
-
function expandNpmrcValue(raw) {
|
|
143
|
-
let value = raw.trim();
|
|
144
|
-
if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) value = value.slice(1, -1);
|
|
145
|
-
return value.replaceAll(/\$\{([A-Z0-9_]+)\}/gi, (_, name) => process.env[name] ?? "");
|
|
146
|
-
}
|
|
147
|
-
function parseNpmrc(contents, into) {
|
|
148
|
-
for (const rawLine of contents.split(/\r?\n/)) {
|
|
149
|
-
const line = rawLine.trim();
|
|
150
|
-
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
151
|
-
const eq = line.indexOf("=");
|
|
152
|
-
if (eq === -1) continue;
|
|
153
|
-
const key = line.slice(0, eq).trim();
|
|
154
|
-
const value = expandNpmrcValue(line.slice(eq + 1));
|
|
155
|
-
if (key) into.set(key, value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function loadFileInto(filePath, config) {
|
|
159
|
-
try {
|
|
160
|
-
parseNpmrc(fs.readFileSync(filePath, "utf8"), config);
|
|
161
|
-
} catch {}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Rebuilt on every call so tests that mutate `process.env` mid-run see
|
|
165
|
-
* fresh config. Each `vp create` hits this ≤4 times (registry + auth on
|
|
166
|
-
* packument + auth on tarball), which is cheap enough vs. the network
|
|
167
|
-
* work that a cache isn't worth the test-determinism cost.
|
|
168
|
-
*/
|
|
169
|
-
function getNpmConfig() {
|
|
170
|
-
const config = /* @__PURE__ */ new Map();
|
|
171
|
-
const homeNpmrc = path.resolve(os.homedir(), ".npmrc");
|
|
172
|
-
loadFileInto(homeNpmrc, config);
|
|
173
|
-
const projectRcs = [];
|
|
174
|
-
let dir = path.resolve(process.cwd());
|
|
175
|
-
const seen = /* @__PURE__ */ new Set();
|
|
176
|
-
while (dir && !seen.has(dir)) {
|
|
177
|
-
seen.add(dir);
|
|
178
|
-
const candidate = path.resolve(dir, ".npmrc");
|
|
179
|
-
if (candidate !== homeNpmrc && fs.existsSync(candidate)) projectRcs.push(candidate);
|
|
180
|
-
const parent = path.dirname(dir);
|
|
181
|
-
if (parent === dir) break;
|
|
182
|
-
dir = parent;
|
|
183
|
-
}
|
|
184
|
-
for (let i = projectRcs.length - 1; i >= 0; i -= 1) loadFileInto(projectRcs[i], config);
|
|
185
|
-
for (const [envKey, envValue] of Object.entries(process.env)) {
|
|
186
|
-
if (envValue === void 0) continue;
|
|
187
|
-
if (envKey.startsWith("npm_config_")) config.set(envKey.slice(11), envValue);
|
|
188
|
-
else if (envKey.startsWith("NPM_CONFIG_")) config.set(envKey.slice(11).toLowerCase(), envValue);
|
|
189
|
-
}
|
|
190
|
-
return config;
|
|
191
|
-
}
|
|
192
|
-
function normalizeRegistryUrl(url) {
|
|
193
|
-
return url.replace(/\/+$/, "");
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Resolve the npm registry base URL for the given scope (or the default
|
|
197
|
-
* registry when `scope` is omitted). Honors `@scope:registry=...` entries
|
|
198
|
-
* in `.npmrc` files and the matching `npm_config_@scope:registry` env
|
|
199
|
-
* vars so private / mirrored registries work for org manifest fetches.
|
|
200
|
-
*/
|
|
201
|
-
function getNpmRegistry(scope) {
|
|
202
|
-
const config = getNpmConfig();
|
|
203
|
-
if (scope) {
|
|
204
|
-
const normalizedScope = scope.startsWith("@") ? scope : `@${scope}`;
|
|
205
|
-
const scoped = config.get(`${normalizedScope}:registry`);
|
|
206
|
-
if (scoped) return normalizeRegistryUrl(scoped);
|
|
207
|
-
}
|
|
208
|
-
return normalizeRegistryUrl(config.get("registry") || "https://registry.npmjs.org");
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Build the `Authorization` header value for a registry URL by matching
|
|
212
|
-
* the URL against `//host[/path]/:_authToken=...` / `:_auth=...` entries
|
|
213
|
-
* in `.npmrc`. Returns `undefined` when no credential is configured.
|
|
214
|
-
*/
|
|
215
|
-
function getNpmAuthHeader(registryOrUrl) {
|
|
216
|
-
let parsed;
|
|
217
|
-
try {
|
|
218
|
-
parsed = new URL(registryOrUrl);
|
|
219
|
-
} catch {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const config = getNpmConfig();
|
|
223
|
-
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
224
|
-
const candidates = [];
|
|
225
|
-
for (let i = segments.length; i >= 0; i -= 1) {
|
|
226
|
-
const subPath = i === 0 ? "/" : `/${segments.slice(0, i).join("/")}/`;
|
|
227
|
-
candidates.push(`//${parsed.host}${subPath}`);
|
|
228
|
-
}
|
|
229
|
-
for (const prefix of candidates) {
|
|
230
|
-
const token = config.get(`${prefix}:_authToken`);
|
|
231
|
-
if (token) return `Bearer ${token}`;
|
|
232
|
-
const basic = config.get(`${prefix}:_auth`);
|
|
233
|
-
if (basic) return `Basic ${basic}`;
|
|
234
|
-
const username = config.get(`${prefix}:username`);
|
|
235
|
-
const passwordB64 = config.get(`${prefix}:_password`);
|
|
236
|
-
if (username && passwordB64) {
|
|
237
|
-
const password = Buffer.from(passwordB64, "base64").toString("utf8");
|
|
238
|
-
return `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* `fetch` wrapper for npm registry URLs that retries with an
|
|
244
|
-
* `Authorization` header on 401/403. Public registries never see the
|
|
245
|
-
* token — we only reach into `.npmrc` when the server challenges us.
|
|
246
|
-
*
|
|
247
|
-
* `init.headers` is forwarded verbatim on both attempts (the retry
|
|
248
|
-
* merges in the discovered auth header on top).
|
|
249
|
-
*/
|
|
250
|
-
async function fetchNpmResource(url, init) {
|
|
251
|
-
const { timeoutMs, headers: callerHeaders, ...rest } = init;
|
|
252
|
-
const first = await fetch(url, {
|
|
253
|
-
...rest,
|
|
254
|
-
headers: callerHeaders,
|
|
255
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
256
|
-
});
|
|
257
|
-
if (first.status !== 401 && first.status !== 403) return first;
|
|
258
|
-
const authorization = getNpmAuthHeader(url);
|
|
259
|
-
if (!authorization) return first;
|
|
260
|
-
return fetch(url, {
|
|
261
|
-
...rest,
|
|
262
|
-
headers: {
|
|
263
|
-
...callerHeaders,
|
|
264
|
-
authorization
|
|
265
|
-
},
|
|
266
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
//#endregion
|
|
270
140
|
//#region src/utils/package.ts
|
|
271
141
|
function getScopeFromPackageName(packageName) {
|
|
272
142
|
if (packageName.startsWith("@")) return packageName.split("/")[0];
|
|
@@ -302,22 +172,21 @@ function hasVitePlusDependency(pkg) {
|
|
|
302
172
|
return Boolean(pkg?.dependencies?.["vite-plus"] || pkg?.devDependencies?.["vite-plus"]);
|
|
303
173
|
}
|
|
304
174
|
/**
|
|
305
|
-
* Check if an npm package exists
|
|
175
|
+
* Check if an npm package exists in the public registry.
|
|
306
176
|
* Returns true if the package exists or if the check could not be performed (network error, timeout).
|
|
307
177
|
* Returns false only if the registry definitively responds with 404.
|
|
308
178
|
*/
|
|
309
179
|
async function checkNpmPackageExists(packageName) {
|
|
310
180
|
const atIndex = packageName.indexOf("@", 2);
|
|
311
181
|
const name = atIndex === -1 ? packageName : packageName.slice(0, atIndex);
|
|
312
|
-
const scope = getScopeFromPackageName(name);
|
|
313
182
|
try {
|
|
314
|
-
return (await
|
|
183
|
+
return (await fetch(`https://registry.npmjs.org/${name}`, {
|
|
315
184
|
method: "HEAD",
|
|
316
|
-
|
|
185
|
+
signal: AbortSignal.timeout(3e3)
|
|
317
186
|
})).status !== 404;
|
|
318
187
|
} catch {
|
|
319
188
|
return true;
|
|
320
189
|
}
|
|
321
190
|
}
|
|
322
191
|
//#endregion
|
|
323
|
-
export { readNearestPackageJson as a,
|
|
192
|
+
export { readNearestPackageJson as a, readJsonFile as c, hasVitePlusDependency as i, writeJsonFile as l, detectPackageMetadata as n, editJsonFile as o, getScopeFromPackageName as r, isJsonFile as s, checkNpmPackageExists as t };
|
|
@@ -81,4 +81,4 @@ async function resolveUniversalViteConfig(err, viteConfigCwd) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
export { resolveViteConfig as
|
|
84
|
+
export { resolveViteConfig as n, resolveUniversalViteConfig as t };
|
package/dist/staged/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "../chunk-q7NCDQ7-.js";
|
|
2
2
|
import { a as printHeader, n as errorMsg, r as log } from "../terminal-CxTMfsxZ.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as resolveViteConfig } from "../resolve-vite-config-B_w1u1j4.js";
|
|
4
4
|
import { t as lib_default } from "../lib-BamM40b7.js";
|
|
5
5
|
import { t as renderCliDoc } from "../help-BtkjXtRM.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
@@ -11,18 +11,18 @@ import { pathToFileURL } from "node:url";
|
|
|
11
11
|
import { cwd } from "node:process";
|
|
12
12
|
import P from "node:readline";
|
|
13
13
|
import nodeTty from "node:tty";
|
|
14
|
-
import { EOL } from "node:os";
|
|
15
14
|
import fsPromises, { constants as constants$1 } from "node:fs/promises";
|
|
16
15
|
import { PassThrough, Writable } from "node:stream";
|
|
17
|
-
import crypto from "node:crypto";
|
|
18
16
|
import { exec, spawn } from "node:child_process";
|
|
19
17
|
import { pipeline } from "node:stream/promises";
|
|
20
18
|
import * as tty from "tty";
|
|
21
19
|
import { format } from "util";
|
|
22
|
-
import { EOL
|
|
20
|
+
import { EOL } from "os";
|
|
23
21
|
import { StringDecoder } from "string_decoder";
|
|
24
22
|
import { Writable as Writable$1 } from "stream";
|
|
25
|
-
import { randomUUID
|
|
23
|
+
import { randomUUID } from "crypto";
|
|
24
|
+
import { EOL as EOL$1 } from "node:os";
|
|
25
|
+
import crypto from "node:crypto";
|
|
26
26
|
//#region ../../node_modules/.pnpm/lint-staged@16.4.0/node_modules/lint-staged/lib/colors.js
|
|
27
27
|
/**
|
|
28
28
|
* @example NO_COLOR
|
|
@@ -1495,12 +1495,12 @@ var ListrLogger = class {
|
|
|
1495
1495
|
}
|
|
1496
1496
|
format(level, message, options) {
|
|
1497
1497
|
if (!Array.isArray(message)) message = [message];
|
|
1498
|
-
message = this.splat(message.shift(), ...message).toString().split(EOL
|
|
1498
|
+
message = this.splat(message.shift(), ...message).toString().split(EOL).filter((m) => !m || m.trim() !== "").map((m) => {
|
|
1499
1499
|
return this.style(level, this.fields(m, {
|
|
1500
1500
|
prefix: Array.isArray(options?.prefix) ? options.prefix : [options?.prefix],
|
|
1501
1501
|
suffix: Array.isArray(options?.suffix) ? options.suffix : [options?.suffix]
|
|
1502
1502
|
}));
|
|
1503
|
-
}).join(EOL
|
|
1503
|
+
}).join(EOL);
|
|
1504
1504
|
return message;
|
|
1505
1505
|
}
|
|
1506
1506
|
style(level, message) {
|
|
@@ -1616,20 +1616,20 @@ var ProcessOutput = class {
|
|
|
1616
1616
|
};
|
|
1617
1617
|
}).filter((message) => message.entry);
|
|
1618
1618
|
if (output.length > 0) {
|
|
1619
|
-
if (this.options.leaveEmptyLine) this.stdout.write(EOL
|
|
1619
|
+
if (this.options.leaveEmptyLine) this.stdout.write(EOL);
|
|
1620
1620
|
output.forEach((message) => {
|
|
1621
|
-
(message.stream ?? this.stdout).write(message.entry + EOL
|
|
1621
|
+
(message.stream ?? this.stdout).write(message.entry + EOL);
|
|
1622
1622
|
});
|
|
1623
1623
|
}
|
|
1624
1624
|
this.stream.stdout.write(ANSI_ESCAPE_CODES.CURSOR_SHOW);
|
|
1625
1625
|
this.active = false;
|
|
1626
1626
|
}
|
|
1627
1627
|
toStdout(buffer, eol = true) {
|
|
1628
|
-
if (eol) buffer = buffer + EOL
|
|
1628
|
+
if (eol) buffer = buffer + EOL;
|
|
1629
1629
|
return this.stream.stdout.write(buffer);
|
|
1630
1630
|
}
|
|
1631
1631
|
toStderr(buffer, eol = true) {
|
|
1632
|
-
if (eol) buffer = buffer + EOL
|
|
1632
|
+
if (eol) buffer = buffer + EOL;
|
|
1633
1633
|
return this.stream.stderr.write(buffer);
|
|
1634
1634
|
}
|
|
1635
1635
|
};
|
|
@@ -1864,7 +1864,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1864
1864
|
if (render.length > 0) render.push("");
|
|
1865
1865
|
render.push(...renderPrompt);
|
|
1866
1866
|
}
|
|
1867
|
-
return render.join(EOL
|
|
1867
|
+
return render.join(EOL);
|
|
1868
1868
|
}
|
|
1869
1869
|
style(task, output = false) {
|
|
1870
1870
|
const rendererOptions = this.cache.rendererOptions.get(task.id);
|
|
@@ -1897,7 +1897,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1897
1897
|
const columns = (process.stdout.columns ?? 80) - level * this.options.indentation - 2;
|
|
1898
1898
|
switch (this.options.formatOutput) {
|
|
1899
1899
|
case "truncate":
|
|
1900
|
-
parsed = message.split(EOL
|
|
1900
|
+
parsed = message.split(EOL).map((s, i) => {
|
|
1901
1901
|
return this.truncate(this.indent(s, i), columns);
|
|
1902
1902
|
});
|
|
1903
1903
|
break;
|
|
@@ -1905,7 +1905,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
1905
1905
|
parsed = this.wrap(message, columns, {
|
|
1906
1906
|
hard: true,
|
|
1907
1907
|
trim: false
|
|
1908
|
-
}).split(EOL
|
|
1908
|
+
}).split(EOL).map((s, i) => this.indent(s, i));
|
|
1909
1909
|
break;
|
|
1910
1910
|
default: throw new ListrRendererError("Format option for the renderer is wrong.");
|
|
1911
1911
|
}
|
|
@@ -2023,7 +2023,7 @@ var DefaultRenderer = class DefaultRenderer {
|
|
|
2023
2023
|
this.buffer.bottom.set(task.id, new ProcessOutputBuffer({ limit: typeof rendererTaskOptions.bottomBar === "number" ? rendererTaskOptions.bottomBar : 1 }));
|
|
2024
2024
|
task.on(ListrTaskEventType.OUTPUT, (output) => {
|
|
2025
2025
|
const data = this.dump(task, -1, ListrLogLevels.OUTPUT, output);
|
|
2026
|
-
this.buffer.bottom.get(task.id).write(data.join(EOL
|
|
2026
|
+
this.buffer.bottom.get(task.id).write(data.join(EOL));
|
|
2027
2027
|
});
|
|
2028
2028
|
task.on(ListrTaskEventType.STATE, (state) => {
|
|
2029
2029
|
switch (state) {
|
|
@@ -2659,7 +2659,7 @@ var ListrTaskEventManager = class extends EventManager {};
|
|
|
2659
2659
|
*/
|
|
2660
2660
|
var Task = class extends ListrTaskEventManager {
|
|
2661
2661
|
/** Unique id per task, can be used for identifying a Task. */
|
|
2662
|
-
id = randomUUID
|
|
2662
|
+
id = randomUUID();
|
|
2663
2663
|
/** The current state of the task. */
|
|
2664
2664
|
state = ListrTaskState.WAITING;
|
|
2665
2665
|
/** Subtasks of the current task. */
|
|
@@ -5415,7 +5415,7 @@ const getFunctionTask = async (command, files) => {
|
|
|
5415
5415
|
};
|
|
5416
5416
|
//#endregion
|
|
5417
5417
|
//#region ../../node_modules/.pnpm/lint-staged@16.4.0/node_modules/lint-staged/lib/getRenderer.js
|
|
5418
|
-
const EOLRegex = new RegExp(EOL + "$");
|
|
5418
|
+
const EOLRegex = new RegExp(EOL$1 + "$");
|
|
5419
5419
|
const bindLogger = (consoleLogMethod) => new Writable({ write: function(chunk, encoding, next) {
|
|
5420
5420
|
consoleLogMethod(chunk.toString().replace(EOLRegex, ""));
|
|
5421
5421
|
next();
|
package/dist/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./main-A6UrSTYb.js";
|
|
2
2
|
import { a as printHeader, r as log, t as accent } from "./terminal-CxTMfsxZ.js";
|
|
3
|
-
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-
|
|
3
|
+
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-D_LD1iiI.js";
|
|
4
4
|
import { t as renderCliDoc } from "./help-BtkjXtRM.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { K as PackageManager, N as editYamlFile, P as readYamlFile, Q as multiselect, Z as log, et as select, it as q } from "./agent-D_WSpD0r.js";
|
|
2
2
|
import { t as require_dist } from "./dist-DjG9AYbK.js";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as readJsonFile, l as writeJsonFile, o as editJsonFile, r as getScopeFromPackageName } from "./package-D_LD1iiI.js";
|
|
4
4
|
import path, { posix, win32 } from "node:path";
|
|
5
5
|
import { detectWorkspace } from "../binding/index.js";
|
|
6
6
|
import * as actualFS from "node:fs";
|
|
@@ -19,6 +19,10 @@ const EDITORS = [{
|
|
|
19
19
|
files: {
|
|
20
20
|
"settings.json": {
|
|
21
21
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
|
22
|
+
"[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
23
|
+
"[javascriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
24
|
+
"[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
25
|
+
"[typescriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
22
26
|
"oxc.fmt.configPath": "./vite.config.ts",
|
|
23
27
|
"editor.formatOnSave": true,
|
|
24
28
|
"editor.formatOnSaveMode": "file",
|
package/docs/guide/create.md
CHANGED
|
@@ -35,7 +35,7 @@ Vite+ ships with these built-in templates:
|
|
|
35
35
|
|
|
36
36
|
- Use shorthand templates like `vite`, `@tanstack/start`, `svelte`, `next-app`, `nuxt`, `react-router`, and `vue`
|
|
37
37
|
- Use full package names like `create-vite` or `create-next-app`
|
|
38
|
-
- Use local templates such as `./tools/create-ui-component` or `@
|
|
38
|
+
- Use local templates such as `./tools/create-ui-component` or `@acme/generator-*`
|
|
39
39
|
- Use remote templates such as `github:user/repo` or `https://github.com/user/template-repo`
|
|
40
40
|
|
|
41
41
|
Run `vp create --list` to see the built-in templates and the common shorthand templates Vite+ recognizes.
|
|
@@ -86,150 +86,3 @@ vp create create-next-app
|
|
|
86
86
|
vp create github:user/repo
|
|
87
87
|
vp create https://github.com/user/template-repo
|
|
88
88
|
```
|
|
89
|
-
|
|
90
|
-
## Organization Templates
|
|
91
|
-
|
|
92
|
-
An organization can publish a curated set of templates under a single npm scope by shipping an `@org/create` package whose `package.json` carries a `createConfig.templates` manifest. Once published, `vp create @org` opens an interactive picker over those templates.
|
|
93
|
-
|
|
94
|
-
### Pick from an org
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
# Open an interactive picker over @your-org/create's manifest
|
|
98
|
-
vp create @your-org
|
|
99
|
-
|
|
100
|
-
# Run a specific manifest entry directly
|
|
101
|
-
vp create @your-org:web
|
|
102
|
-
|
|
103
|
-
# Pin to an exact version or a dist-tag
|
|
104
|
-
vp create @your-org@1.2.3
|
|
105
|
-
vp create @your-org:web@next
|
|
106
|
-
|
|
107
|
-
# Set the org as the default for a repo (see create.defaultTemplate config)
|
|
108
|
-
vp create
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Behind the scenes, `vp create @org` maps to `@org/create` (the existing npm `create-*` convention). If that package has no `createConfig.templates` field, Vite+ falls back to running the package normally — so adopting the manifest is zero-risk for orgs that already publish `@org/create`.
|
|
112
|
-
|
|
113
|
-
Private registries work automatically: Vite+ reads `.npmrc` files from the project root and `~/`, honoring `@your-org:registry=...` scope mappings and `//host/:_authToken=...` credentials.
|
|
114
|
-
|
|
115
|
-
### Authoring `@org/create`
|
|
116
|
-
|
|
117
|
-
There are two common layouts. Pick the one that matches the org's template count and release cadence.
|
|
118
|
-
|
|
119
|
-
**Bundled (recommended for most orgs).** All templates live as subdirectories of `@org/create` itself. Manifest entries use relative `./path` values. One repo, one publish, one versioning story — the same pattern used by `create-vite` and `create-next-app`.
|
|
120
|
-
|
|
121
|
-
```
|
|
122
|
-
@your-org/create/
|
|
123
|
-
├── package.json # "createConfig": { "templates": [{ "template": "./templates/web" }, ...] }
|
|
124
|
-
├── templates/
|
|
125
|
-
│ ├── web/
|
|
126
|
-
│ │ ├── package.json
|
|
127
|
-
│ │ └── src/...
|
|
128
|
-
│ └── library/...
|
|
129
|
-
└── README.md
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**Manifest-only.** When the org already publishes independent `@org/template-*` packages (or hosts them on GitHub), `@org/create` stays a thin index.
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
@your-org/create/
|
|
136
|
-
├── package.json # "createConfig": { "templates": [{ "template": "@your-org/template-web" }, ...] }
|
|
137
|
-
└── README.md
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
The two layouts can be mixed — a manifest can point most entries at external packages and keep a few as bundled subdirectories.
|
|
141
|
-
|
|
142
|
-
Optionally, provide a `bin` script so `npm create @org` (the legacy path) keeps working for non-Vite+ users. `vp create @org` reads the manifest directly and never runs the `bin`.
|
|
143
|
-
|
|
144
|
-
### Manifest schema
|
|
145
|
-
|
|
146
|
-
The manifest lives at `createConfig.templates` in `@org/create`'s `package.json`:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"name": "@your-org/create",
|
|
151
|
-
"version": "1.0.0",
|
|
152
|
-
"createConfig": {
|
|
153
|
-
"templates": [
|
|
154
|
-
{
|
|
155
|
-
"name": "monorepo",
|
|
156
|
-
"description": "Monorepo",
|
|
157
|
-
"template": "@your-org/template-monorepo",
|
|
158
|
-
"monorepo": true
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
"name": "web",
|
|
162
|
-
"description": "Web app template (Vite + React)",
|
|
163
|
-
"template": "@your-org/template-web"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"name": "demo",
|
|
167
|
-
"description": "Bundled demo template",
|
|
168
|
-
"template": "./templates/demo"
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Each entry supports:
|
|
176
|
-
|
|
177
|
-
| Field | Required | Notes |
|
|
178
|
-
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
179
|
-
| `name` | yes | Kebab-case identifier. Used by `vp create @org:<name>` for direct selection. Must be unique within the array. |
|
|
180
|
-
| `description` | yes | One-line description shown in the picker. |
|
|
181
|
-
| `template` | yes | An npm specifier (`@org/template-foo`, optionally `@version`), a GitHub URL (`github:user/repo`), a `vite:*` builtin, a local workspace package name, or a relative path (`./templates/foo`) that resolves against the `@org/create` root. |
|
|
182
|
-
| `monorepo` | no | If `true`, marks this entry as a monorepo-creating template. Hidden from the picker when `vp create` runs inside an existing monorepo, mirroring the built-in `vite:monorepo` filter. |
|
|
183
|
-
|
|
184
|
-
An invalid manifest is a hard error, not a silent fall-through — a maintainer who shipped a manifest should hear about the offending field, e.g. `@your-org/create: createConfig.templates[2].template must be a non-empty string`.
|
|
185
|
-
|
|
186
|
-
### Bundled subdirectory templates
|
|
187
|
-
|
|
188
|
-
Relative `./...` paths resolve against the enclosing `@org/create` package root — **not** the user's cwd. The referenced directory is copied verbatim into the target project (no template-engine processing). Paths that escape the package root are rejected.
|
|
189
|
-
|
|
190
|
-
### Make the org the default in a repo
|
|
191
|
-
|
|
192
|
-
Commit this in `vite.config.ts` at the project root:
|
|
193
|
-
|
|
194
|
-
```ts
|
|
195
|
-
import { defineConfig } from 'vite-plus';
|
|
196
|
-
|
|
197
|
-
export default defineConfig({
|
|
198
|
-
create: { defaultTemplate: '@your-org' },
|
|
199
|
-
});
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
Now `vp create` (with no argument) drops straight into the `@your-org` picker. See [`create.defaultTemplate`](/config/create) for details.
|
|
203
|
-
|
|
204
|
-
The picker always appends a trailing **Vite+ built-in templates** entry so `vite:monorepo` / `vite:application` / `vite:library` / `vite:generator` stay reachable from the picker — selecting it routes to the standard built-in flow. For scripts and CI, explicit specifiers (`vp create vite:library`) bypass the configured default.
|
|
205
|
-
|
|
206
|
-
### Non-interactive inspection
|
|
207
|
-
|
|
208
|
-
`vp create @org --no-interactive` prints the manifest as a table and exits 1:
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
A template name is required when running `vp create @your-org` in non-interactive mode.
|
|
212
|
-
|
|
213
|
-
Available templates in @your-org/create:
|
|
214
|
-
|
|
215
|
-
NAME DESCRIPTION TEMPLATE
|
|
216
|
-
web Web app template (Vite + React) @your-org/template-web
|
|
217
|
-
library TypeScript library template @your-org/template-library
|
|
218
|
-
demo Bundled demo template ./templates/demo
|
|
219
|
-
|
|
220
|
-
Examples:
|
|
221
|
-
# Scaffold a specific template from the org
|
|
222
|
-
vp create @your-org:web --no-interactive
|
|
223
|
-
|
|
224
|
-
# Or use a Vite+ built-in template
|
|
225
|
-
vp create vite:application --no-interactive
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Publishing checklist
|
|
229
|
-
|
|
230
|
-
1. Create `@org/create` (scoped npm package) if you don't already have one.
|
|
231
|
-
2. Add a `createConfig.templates` array to `package.json`. (Bundle the templates under `./templates/...` or point at external packages.)
|
|
232
|
-
3. (Optional) Provide a `bin` launcher for `npm create @org` compatibility.
|
|
233
|
-
4. Publish.
|
|
234
|
-
5. Verify: `vp create @org --no-interactive` prints the manifest table; `vp create @org` opens the picker.
|
|
235
|
-
6. (Optional) Commit `create: { defaultTemplate: '@org' }` in your internal template repos.
|
|
@@ -22,6 +22,10 @@ You can also manually set up the VS Code config:
|
|
|
22
22
|
```json [.vscode/settings.json]
|
|
23
23
|
{
|
|
24
24
|
"editor.defaultFormatter": "oxc.oxc-vscode",
|
|
25
|
+
"[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
26
|
+
"[javascriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
27
|
+
"[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
28
|
+
"[typescriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
|
|
25
29
|
"oxc.fmt.configPath": "./vite.config.ts",
|
|
26
30
|
"editor.formatOnSave": true,
|
|
27
31
|
"editor.formatOnSaveMode": "file",
|
|
@@ -31,7 +35,7 @@ You can also manually set up the VS Code config:
|
|
|
31
35
|
}
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
This gives the project a shared default formatter and enables Oxc-powered fix actions on save. Setting `oxc.fmt.configPath` to `./vite.config.ts` keeps editor format-on-save aligned with the `fmt` block in your Vite+ config. Vite+ uses `formatOnSaveMode: "file"` because Oxfmt does not support partial formatting.
|
|
38
|
+
This gives the project a shared default formatter and enables Oxc-powered fix actions on save. The language-specific override blocks (`[javascript]`, `[typescript]`, etc.) are required because VS Code prioritizes user-level `[language]` settings over the workspace-level `editor.defaultFormatter` — without them, a global Prettier configuration would silently take over. Setting `oxc.fmt.configPath` to `./vite.config.ts` keeps editor format-on-save aligned with the `fmt` block in your Vite+ config. Vite+ uses `formatOnSaveMode: "file"` because Oxfmt does not support partial formatting.
|
|
35
39
|
|
|
36
40
|
To let the VS Code NPM Scripts panel run scripts through `vp`, add the following to your `.vscode/settings.json`:
|
|
37
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "0.1.20
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -322,8 +322,8 @@
|
|
|
322
322
|
"oxfmt": "=0.46.0",
|
|
323
323
|
"oxlint": "=1.61.0",
|
|
324
324
|
"oxlint-tsgolint": "=0.22.0",
|
|
325
|
-
"@voidzero-dev/vite-plus-core": "0.1.20
|
|
326
|
-
"@voidzero-dev/vite-plus-test": "0.1.20
|
|
325
|
+
"@voidzero-dev/vite-plus-core": "0.1.20",
|
|
326
|
+
"@voidzero-dev/vite-plus-test": "0.1.20"
|
|
327
327
|
},
|
|
328
328
|
"devDependencies": {
|
|
329
329
|
"@napi-rs/cli": "^3.6.1",
|
|
@@ -341,16 +341,15 @@
|
|
|
341
341
|
"lint-staged": "^16.2.6",
|
|
342
342
|
"minimatch": "^10.0.3",
|
|
343
343
|
"mri": "^1.2.0",
|
|
344
|
-
"nanotar": "^0.3.0",
|
|
345
344
|
"picocolors": "^1.1.1",
|
|
346
345
|
"rolldown-plugin-dts": "^0.23.0",
|
|
347
346
|
"semver": "^7.7.3",
|
|
348
347
|
"tsdown": "^0.21.10",
|
|
349
348
|
"validate-npm-package-name": "^7.0.2",
|
|
350
349
|
"yaml": "^2.8.1",
|
|
351
|
-
"@voidzero-dev/vite-plus-
|
|
352
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20
|
|
353
|
-
"@voidzero-dev/vite-plus-
|
|
350
|
+
"@voidzero-dev/vite-plus-tools": "0.0.0",
|
|
351
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.20",
|
|
352
|
+
"@voidzero-dev/vite-plus-prompts": "0.0.0"
|
|
354
353
|
},
|
|
355
354
|
"napi": {
|
|
356
355
|
"binaryName": "vite-plus",
|
|
@@ -370,14 +369,14 @@
|
|
|
370
369
|
"node": "^20.19.0 || >=22.12.0"
|
|
371
370
|
},
|
|
372
371
|
"optionalDependencies": {
|
|
373
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.20
|
|
374
|
-
"@voidzero-dev/vite-plus-darwin-x64": "0.1.20
|
|
375
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.20
|
|
376
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.20
|
|
377
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.20
|
|
378
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.20
|
|
379
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.20
|
|
380
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.20
|
|
372
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "0.1.20",
|
|
373
|
+
"@voidzero-dev/vite-plus-darwin-x64": "0.1.20",
|
|
374
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.20",
|
|
375
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.20",
|
|
376
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.20",
|
|
377
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "0.1.20",
|
|
378
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.20",
|
|
379
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.20"
|
|
381
380
|
},
|
|
382
381
|
"scripts": {
|
|
383
382
|
"build": "oxnode -C dev ./build.ts",
|