@vite-hub/cli 0.6.1 → 0.8.0
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 +6 -3
- package/dist/{commands-FOmqEZUi.js → commands-w7tEEJph.js} +469 -160
- package/dist/console-apps-BQX-Np9Q.js +271 -0
- package/dist/console-auth-cCodgT_T.js +2813 -0
- package/dist/{console-env-lQ3_eMOy.js → console-env-eXdVI6kw.js} +7 -4
- package/dist/{deploy-DDen0JC0.js → deploy-CqR6pJa-.js} +49 -17
- package/dist/dist-CEIUyD15.js +2495 -0
- package/dist/env-D_CN5DyX.js +2169 -0
- package/dist/envelope-BJQ7xPyX.js +99 -0
- package/dist/help-cache-BI6y5pN8.js +195 -0
- package/dist/index.d.ts +13 -14
- package/dist/index.js +217 -66
- package/dist/link-BRNWNqT9.js +663 -0
- package/dist/provision-9QsGgeiq.js +1741 -0
- package/dist/{provision-kiD8Emd7.d.ts → provision-ByxmUa19.d.ts} +16 -1
- package/dist/provision-Fiosv3Un.js +1391 -0
- package/dist/setup/index.d.ts +37 -15
- package/dist/setup/index.js +12 -9
- package/dist/status-gjvZVutV.js +599 -0
- package/dist/vercel-B5CJLsT0.js +701 -0
- package/package.json +5 -4
- package/dist/env-DzYHxq9A.js +0 -5657
- package/dist/provision-YzxNsbhs.js +0 -4139
- package/dist/rolldown-runtime-BJohB4LM.js +0 -13
package/dist/setup/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as CredentialSource, d as HostCredentialsDescription, r as ViteHubCliContext, s as CredentialHost, t as ViteHubCliCommand, u as HostCredentials } from "../provision-ByxmUa19.js";
|
|
2
2
|
type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
3
3
|
readonly [key: string]: JsonValue;
|
|
4
4
|
};
|
|
@@ -19,6 +19,7 @@ interface ViteHubConfigSite {
|
|
|
19
19
|
start: number;
|
|
20
20
|
end: number;
|
|
21
21
|
};
|
|
22
|
+
consoleUrl?: string;
|
|
22
23
|
keys: Readonly<Record<string, ConfigValue>>;
|
|
23
24
|
/** True when a spread can supply keys that are not in `keys`. */
|
|
24
25
|
spread: boolean;
|
|
@@ -27,6 +28,7 @@ interface ViteHubConfigSite {
|
|
|
27
28
|
keys: Readonly<Record<string, ConfigValue>>;
|
|
28
29
|
spread: boolean;
|
|
29
30
|
};
|
|
31
|
+
viteRoot?: string | false;
|
|
30
32
|
}
|
|
31
33
|
type LocateResult = {
|
|
32
34
|
ok: true;
|
|
@@ -161,6 +163,13 @@ interface SetupProject {
|
|
|
161
163
|
* Throws `SETUP_NOT_A_PROJECT` when `root` has no package.json and no Vite or Nuxt config.
|
|
162
164
|
*/
|
|
163
165
|
export declare function readSetupProject(root: string, env: NodeJS.ProcessEnv): Promise<SetupProject>;
|
|
166
|
+
/** A change to the pnpm build policy. `path` is relative to the project root, and `file` is absolute. */
|
|
167
|
+
interface PnpmBuildsChange {
|
|
168
|
+
path: string;
|
|
169
|
+
file: string;
|
|
170
|
+
before?: string;
|
|
171
|
+
after: string;
|
|
172
|
+
}
|
|
164
173
|
interface SetupFeatureStatus {
|
|
165
174
|
id: FeatureId;
|
|
166
175
|
enabled: "on" | "off" | "unknown";
|
|
@@ -256,11 +265,18 @@ interface SetupAddPlanned {
|
|
|
256
265
|
prod: string[];
|
|
257
266
|
dev: string[];
|
|
258
267
|
};
|
|
268
|
+
/** The features that are on after the change. */
|
|
269
|
+
enabled: FeatureId[];
|
|
270
|
+
/** The pnpm build policy that the install needs. It is written before the install. */
|
|
271
|
+
workspace?: PnpmBuildsChange;
|
|
259
272
|
}
|
|
260
273
|
/** Plans `vitehub add` without writing anything. Throws `SetupFailure` when the change needs input or is not possible. */
|
|
261
274
|
export declare function planSetupAdd(project: SetupProject, args: SetupAddArgs, env: NodeJS.ProcessEnv, rerun?: SetupRerun): Promise<SetupAddPlanned>;
|
|
262
|
-
/**
|
|
263
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Applies a `vitehub add` plan: writes the pnpm build policy, installs the packages, writes the starter Definitions,
|
|
277
|
+
* and writes the config last.
|
|
278
|
+
*/
|
|
279
|
+
export declare function applySetupAdd(project: SetupProject, planned: SetupAddPlanned, args: Pick<SetupAddArgs, "install">, context: Pick<ViteHubCliContext, "env" | "spawn"> & Partial<Pick<ViteHubCliContext, "stderr">>): Promise<void>;
|
|
264
280
|
export declare const addCommand: ViteHubCliCommand;
|
|
265
281
|
interface SetupCatalog {
|
|
266
282
|
schemaVersion: 1;
|
|
@@ -271,9 +287,9 @@ interface SetupCatalog {
|
|
|
271
287
|
export declare function setupCatalog(): SetupCatalog;
|
|
272
288
|
/** The setup commands. They run before the CLI loads the project config. */
|
|
273
289
|
export declare const setupCommands: readonly ViteHubCliCommand[];
|
|
274
|
-
/** The hosted Console. `--console` and `
|
|
290
|
+
/** The hosted Console. `--console`, `VITEHUB_CONSOLE_URL`, and `vitehub({ console: { url } })` name a self-hosted one. */
|
|
275
291
|
export declare const defaultConsoleUrl = "https://console.vitehub.dev";
|
|
276
|
-
/** An API key for CI. It wins over the saved key, and `vitehub logout` does not remove it. */
|
|
292
|
+
/** An API key for CI. It wins over the saved key for its origin, and `vitehub logout` does not remove it. */
|
|
277
293
|
export declare const consoleTokenVariable = "VITEHUB_CONSOLE_TOKEN";
|
|
278
294
|
export declare const consoleUrlVariable = "VITEHUB_CONSOLE_URL";
|
|
279
295
|
/** What `vitehub login` keeps for one Console. The file is readable only by its owner. */
|
|
@@ -283,7 +299,7 @@ interface ConsoleCredential {
|
|
|
283
299
|
user: {
|
|
284
300
|
id: string;
|
|
285
301
|
name: string;
|
|
286
|
-
email
|
|
302
|
+
email?: string;
|
|
287
303
|
};
|
|
288
304
|
team: {
|
|
289
305
|
id: string;
|
|
@@ -296,17 +312,14 @@ interface ConsoleCredential {
|
|
|
296
312
|
export declare function consoleCredentialsFile(env: NodeJS.ProcessEnv): string;
|
|
297
313
|
/** The origin of a Console URL. Plain `http` is accepted only for a Console on this machine. */
|
|
298
314
|
export declare function consoleOrigin(value: string): string;
|
|
299
|
-
/**
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
* Console, else console.vitehub.dev. `undefined` when there is no key.
|
|
303
|
-
*/
|
|
304
|
-
export declare function readConsoleCredential(env: NodeJS.ProcessEnv, console?: string, signal?: AbortSignal): Promise<{
|
|
315
|
+
/** Reads the key for an explicit Console or the saved-login fallback, without consulting app config. */
|
|
316
|
+
export declare function readConsoleCredential(env: NodeJS.ProcessEnv, console?: string, signal?: AbortSignal): Promise<ResolvedCredential | undefined>;
|
|
317
|
+
type ResolvedCredential = {
|
|
305
318
|
origin: string;
|
|
306
319
|
token: string;
|
|
307
320
|
source: "env" | "file";
|
|
308
321
|
saved?: ConsoleCredential;
|
|
309
|
-
}
|
|
322
|
+
};
|
|
310
323
|
export declare const loginCommand: ViteHubCliCommand;
|
|
311
324
|
export declare const whoamiCommand: ViteHubCliCommand;
|
|
312
325
|
export declare const logoutCommand: ViteHubCliCommand;
|
|
@@ -362,6 +375,7 @@ interface SetupLinkTarget {
|
|
|
362
375
|
id?: string;
|
|
363
376
|
name: string;
|
|
364
377
|
};
|
|
378
|
+
resourceScope?: string;
|
|
365
379
|
/** True when the host API confirmed that the project exists. */
|
|
366
380
|
verified: boolean;
|
|
367
381
|
linkedAt: string;
|
|
@@ -436,8 +450,16 @@ interface SetupLinkStatus {
|
|
|
436
450
|
/** The host that `vitehub deploy` uses without `--host`. */
|
|
437
451
|
default: SetupLinkHost | null;
|
|
438
452
|
/** For the `link` host, else the config host. Never includes the token. `null` on a host without credentials (Node). */
|
|
439
|
-
credentials:
|
|
453
|
+
credentials: SetupCredentialsStatus | null;
|
|
440
454
|
}
|
|
455
|
+
/** The credentials of `vitehub status`. `unknown: "timeout"` when the host CLI login check ran past the status deadline, so a login can still exist. */
|
|
456
|
+
type SetupCredentialsStatus = HostCredentialsDescription | {
|
|
457
|
+
ok: false;
|
|
458
|
+
host: CredentialHost;
|
|
459
|
+
missing: readonly string[];
|
|
460
|
+
fix: string;
|
|
461
|
+
unknown: "timeout";
|
|
462
|
+
};
|
|
441
463
|
/** The link file and the credentials that `vitehub status` reads. `credentials` holds the token and never goes in output. */
|
|
442
464
|
interface SetupLinkState {
|
|
443
465
|
status: SetupLinkStatus;
|
|
@@ -942,4 +964,4 @@ export declare function setupRequestArgs(request: unknown): {
|
|
|
942
964
|
* `add`, and `remove` do, with the same documents, and keeps each plan until one `apply()` uses it.
|
|
943
965
|
*/
|
|
944
966
|
export declare function createSetupSession(options: SetupSessionOptions): SetupSession;
|
|
945
|
-
export type { ConsoleCredential, DeployCommit, HostDeployment, HostDeploymentSource, PlannedRemove, SetupAddArgs, SetupAddPlan, SetupAddPlanned, SetupCatalog, SetupChange, SetupChoice, SetupCommandRunner, SetupDeployArgs, SetupDeployOutput, SetupDeploymentsOutput, SetupError, SetupFailure, SetupFailureDetails, SetupFeatureStatus, SetupFramework, SetupInitArgs, SetupInitPlan, SetupLink, SetupLinkAccount, SetupLinkFile, SetupLinkHost, SetupLinkOptions, SetupLinkResult, SetupLinkSelection, SetupLinkState, SetupLinkStatus, SetupLinkSummary, SetupLinkTarget, SetupLinks, SetupLive, SetupLiveReason, SetupLiveStatus, SetupMissing, SetupOptions, SetupPackageManager, SetupPlanRequest, SetupProject, SetupReference, SetupRemoveArgs, SetupRemovePlan, SetupRerun, SetupSession, SetupSessionOptions, SetupSessionPlanFields, SetupSessionResult, SetupStatus, SetupUpdateArgs, SetupUpdatePlan };
|
|
967
|
+
export type { ConsoleCredential, DeployCommit, HostDeployment, HostDeploymentSource, PlannedRemove, SetupAddArgs, SetupAddPlan, SetupAddPlanned, SetupCatalog, SetupChange, SetupChoice, SetupCommandRunner, SetupCredentialsStatus, SetupDeployArgs, SetupDeployOutput, SetupDeploymentsOutput, SetupError, SetupFailure, SetupFailureDetails, SetupFeatureStatus, SetupFramework, SetupInitArgs, SetupInitPlan, SetupLink, SetupLinkAccount, SetupLinkFile, SetupLinkHost, SetupLinkOptions, SetupLinkResult, SetupLinkSelection, SetupLinkState, SetupLinkStatus, SetupLinkSummary, SetupLinkTarget, SetupLinks, SetupLive, SetupLiveReason, SetupLiveStatus, SetupMissing, SetupOptions, SetupPackageManager, SetupPlanRequest, SetupProject, SetupReference, SetupRemoveArgs, SetupRemovePlan, SetupRerun, SetupSession, SetupSessionOptions, SetupSessionPlanFields, SetupSessionResult, SetupStatus, SetupUpdateArgs, SetupUpdatePlan };
|
package/dist/setup/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { _ as applySetupAdd, a as updateCommand, c as planSetupRemove, d as initCommandDefinition, f as initPackages, g as addCommand, h as setupCatalog, i as readUpdateArgs, l as readRemoveArgs, m as readInitArgs, n as setupCommands, o as updateInstallArgs, p as nuxiPackage, r as planSetupUpdate, s as applySetupRemove, u as removeCommand, v as planSetupAdd, y as readAddArgs } from "../commands-
|
|
2
|
-
import {
|
|
3
|
-
import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-
|
|
4
|
-
import {
|
|
1
|
+
import { _ as applySetupAdd, a as updateCommand, c as planSetupRemove, d as initCommandDefinition, f as initPackages, g as addCommand, h as setupCatalog, i as readUpdateArgs, l as readRemoveArgs, m as readInitArgs, n as setupCommands, o as updateInstallArgs, p as nuxiPackage, r as planSetupUpdate, s as applySetupRemove, u as removeCommand, v as planSetupAdd, y as readAddArgs } from "../commands-w7tEEJph.js";
|
|
2
|
+
import { c as logoutCommand, d as whoamiCommand, g as readSetupProject, i as consoleUrlVariable, l as readConsoleCredential, n as consoleOrigin, o as defaultConsoleUrl, r as consoleTokenVariable, s as loginCommand, t as consoleCredentialsFile } from "../console-auth-cCodgT_T.js";
|
|
3
|
+
import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-CqR6pJa-.js";
|
|
4
|
+
import { i as setupFailure, o as writeSetupError, r as setupExitCodes } from "../envelope-BJQ7xPyX.js";
|
|
5
|
+
import { d as readSetupLinkStatus, f as readSetupLinks, m as unlinkSetupProject, p as selectSetupLink, s as linkSetupProject, t as SETUP_LINK_FILE, u as readSetupLinkState } from "../link-BRNWNqT9.js";
|
|
6
|
+
import { c as shellQuote, s as setupStatus } from "../status-gjvZVutV.js";
|
|
7
|
+
import { d as cliErrorDiagnostics, w as isRecord } from "../provision-9QsGgeiq.js";
|
|
5
8
|
import { join } from "pathe";
|
|
6
9
|
import { readFile } from "node:fs/promises";
|
|
7
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -10,9 +13,6 @@ const featurePattern = /^[a-z][a-z-]*$/iu;
|
|
|
10
13
|
function invalid(message) {
|
|
11
14
|
return cliErrorDiagnostics.CLI_R0003({ message: `[vitehub] ${message}` });
|
|
12
15
|
}
|
|
13
|
-
function isObject(value) {
|
|
14
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
15
|
-
}
|
|
16
16
|
function readStrings(value, field) {
|
|
17
17
|
if (value === void 0) return [];
|
|
18
18
|
if (!Array.isArray(value) || !value.every((item) => typeof item === "string")) throw invalid(`\`${field}\` must be a list of strings.`);
|
|
@@ -24,7 +24,7 @@ function readFlag(value, field) {
|
|
|
24
24
|
}
|
|
25
25
|
/** The CLI arguments of a request. Every value goes inline after `=`, so no value can become another flag. */
|
|
26
26
|
function setupRequestArgs(request) {
|
|
27
|
-
if (!
|
|
27
|
+
if (!isRecord(request)) throw invalid("The request must be a JSON object.");
|
|
28
28
|
const action = request.action;
|
|
29
29
|
if (action !== "add" && action !== "remove") throw invalid("`action` must be \"add\" or \"remove\".");
|
|
30
30
|
const allowed = action === "add" ? [
|
|
@@ -179,7 +179,10 @@ function createSetupSession(options) {
|
|
|
179
179
|
const spawn = async (command, args, spawnOptions) => await options.run(command, args, {
|
|
180
180
|
cwd: spawnOptions?.cwd ?? project.root,
|
|
181
181
|
env: spawnOptions?.env ?? options.env,
|
|
182
|
-
onOutput
|
|
182
|
+
onOutput: (text, stream) => {
|
|
183
|
+
onOutput(text, stream);
|
|
184
|
+
spawnOptions?.onOutput?.(text, stream);
|
|
185
|
+
}
|
|
183
186
|
});
|
|
184
187
|
const context = {
|
|
185
188
|
env: options.env,
|