@vite-hub/cli 0.3.1 → 0.5.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.
@@ -1,5 +1,5 @@
1
1
  import "nostics";
2
- //#region ../internal/dist/host-credentials-MN0OQ2os.d.ts
2
+ //#region ../internal/dist/host-credentials-NQkTpoab.d.ts
3
3
  //#region src/host-credentials.d.ts
4
4
  type CredentialHost = "cloudflare" | "vercel" | "netlify" | "deno";
5
5
  type CredentialSource = "env" | "host-cli";
@@ -32,6 +32,7 @@ type HostCredentialsDescription = {
32
32
  interface HostCliRunResult {
33
33
  exitCode: number | null;
34
34
  stdout: string;
35
+ stderr?: string;
35
36
  }
36
37
  /** Runs a host CLI with an argument array and no shell, and returns its stdout. */
37
38
  type HostCliRun = (command: string, args: readonly string[], options: {
@@ -95,7 +96,6 @@ interface ProvisionStep {
95
96
  }
96
97
  //#endregion
97
98
  //#region ../internal/dist/cli.d.ts
98
- //#region src/cli.d.ts
99
99
  interface ViteHubCliStreams {
100
100
  stderr: {
101
101
  write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
@@ -0,0 +1,14 @@
1
+ import "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __exportAll = (all, no_symbols) => {
5
+ let target = {};
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
+ return target;
12
+ };
13
+ //#endregion
14
+ export { __exportAll as t };
@@ -1,4 +1,4 @@
1
- import { l as HostCredentials, o as CredentialHost, r as ViteHubCliContext, s as CredentialSource, t as ViteHubCliCommand, u as HostCredentialsDescription } from "../provision-C9p1wSzq.js";
1
+ import { l as HostCredentials, o as CredentialHost, r as ViteHubCliContext, s as CredentialSource, t as ViteHubCliCommand, u as HostCredentialsDescription } from "../provision-bhi-xnCG.js";
2
2
  //#region ../internal/dist/config-edit.d.ts
3
3
  //#region src/config-edit.d.ts
4
4
  type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
@@ -89,13 +89,6 @@ type HostSupport = NativeHostSupport | {
89
89
  /** A feature that this feature turns on, unless the app sets the other feature to `false`. */
90
90
  interface FeatureImplication {
91
91
  feature: FeatureId;
92
- /** Hosts where the implication does not apply. */
93
- except?: readonly ViteHubHost[];
94
- /**
95
- * Hosts where the implied feature needs no provider option, because it runs inline in the request process. A
96
- * restart loses its work. The feature still needs its option when the app turns it on itself.
97
- */
98
- inline?: readonly ViteHubHost[];
99
92
  }
100
93
  /** The starter Definition file that `vitehub add <feature> --name <name>` creates. */
101
94
  interface FeatureStarter {
@@ -124,12 +117,19 @@ interface FeatureDefinition<TId extends FeatureId = FeatureId> {
124
117
  docs: `/docs/${string}`;
125
118
  /** Whether the feature is unconditionally on when the app does not set its key. */
126
119
  enabledByDefault: boolean;
127
- /** File names in the configured server directories (default `server/`) that enable an unset feature. `false` disables discovery. */
120
+ /**
121
+ * Files and folders in the configured server directories (default `server/`) that turn on a feature whose key is
122
+ * unset. A key of `false` keeps the feature off.
123
+ */
128
124
  enabledByDiscovery?: readonly string[];
129
125
  /** Packages that the app installs for this feature, in `pnpm add` order. */
130
126
  packages: readonly string[];
131
127
  /** Additional packages selected by literal provider options. */
132
128
  providerPackages?: Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
129
+ requiredOptions?: readonly {
130
+ option: `${TId}.${string}`;
131
+ detail: string;
132
+ }[];
133
133
  /** Development dependencies that the app installs for this feature. */
134
134
  devPackages: readonly string[];
135
135
  implies: readonly FeatureImplication[];
@@ -205,7 +205,7 @@ interface SetupStatus {
205
205
  features: readonly SetupFeatureStatus[];
206
206
  }
207
207
  /** What the project enables, on which host, and what each enabled feature still needs. Reads the config without running it. */
208
- export declare function setupStatus(project: SetupProject, env: NodeJS.ProcessEnv): SetupStatus;
208
+ export declare function setupStatus(project: SetupProject, env: NodeJS.ProcessEnv, withoutDefinitions?: ReadonlySet<FeatureId>): SetupStatus;
209
209
  //#endregion
210
210
  //#region src/setup/add.d.ts
211
211
  interface SetupAddArgs {
@@ -259,6 +259,7 @@ interface SetupAddPlanned {
259
259
  before: string;
260
260
  after: string;
261
261
  };
262
+ restartRequired: boolean;
262
263
  files: {
263
264
  path: string;
264
265
  content: string;
@@ -377,7 +378,7 @@ interface SetupLinkAccount {
377
378
  }
378
379
  /** One host target of `.vitehub/link.json`. */
379
380
  interface SetupLinkTarget {
380
- /** Absent only for a Deno link without `--account`. */
381
+ /** Can be absent for an unverified Deno link. */
381
382
  account?: SetupLinkAccount;
382
383
  project: {
383
384
  id?: string;
@@ -699,6 +700,15 @@ export declare function readSetupLive(root: string, link: SetupLink | undefined,
699
700
  signal?: AbortSignal;
700
701
  }): Promise<SetupLiveStatus>;
701
702
  //#endregion
703
+ //#region src/setup/stack.d.ts
704
+ interface SetupStack {
705
+ command: string | null;
706
+ omits: readonly {
707
+ path: string;
708
+ reason: "opaque-config" | "spread" | "expression" | "unresolved-host" | "unresolved-feature" | "disabled-feature" | "unsupported-feature" | "non-replayable-option" | "credential-option" | "required-option" | "unplannable-stack";
709
+ }[];
710
+ }
711
+ //#endregion
702
712
  //#region src/setup/init.d.ts
703
713
  declare const initHosts: readonly ["cloudflare", "vercel", "netlify", "deno", "node"];
704
714
  type InitHost = typeof initHosts[number];
@@ -750,18 +760,11 @@ interface SetupInitPlan {
750
760
  devPackages: readonly string[];
751
761
  command?: string;
752
762
  };
753
- /** The command that creates the same stack. README.md keeps it. */
754
- stack: {
755
- command: string;
756
- };
763
+ stack: SetupStack;
757
764
  nextSteps: readonly string[];
758
765
  }
759
766
  /** Reads the arguments. Throws `CLI_R0003` for an unknown flag or value. */
760
767
  export declare function readInitArgs(args: readonly string[]): SetupInitArgs;
761
- /** The stack command in the README.md block of `root`, for `vitehub status`. `null` when there is no block. */
762
- export declare function readSetupStack(root: string): Promise<{
763
- command: string;
764
- } | null>;
765
768
  export declare const initCommandDefinition: ViteHubCliCommand;
766
769
  //#endregion
767
770
  //#region src/setup/remove.d.ts
@@ -821,6 +824,7 @@ interface PlannedRemove {
821
824
  before: string;
822
825
  after: string;
823
826
  };
827
+ restartRequired: boolean;
824
828
  /** Starter Definitions to delete. */
825
829
  deletes: {
826
830
  path: string;
@@ -836,6 +840,52 @@ export declare function applySetupRemove(project: SetupProject, planned: Planned
836
840
  }): Promise<void>;
837
841
  export declare const removeCommand: ViteHubCliCommand;
838
842
  //#endregion
843
+ //#region src/setup/update.d.ts
844
+ interface SetupUpdateArgs {
845
+ dryRun: boolean;
846
+ help: boolean;
847
+ install: boolean;
848
+ json: boolean;
849
+ /** A commit of vite-hub/vitehub. Its pkg.pr.new build replaces the npm release. */
850
+ preview?: string;
851
+ }
852
+ interface SetupUpdatePlan {
853
+ /** `planned` for a dry run, `applied` when done, `unchanged` when every package is already on the target. */
854
+ status: "planned" | "applied" | "unchanged";
855
+ /** The npm version, such as `0.2.0`, or the pkg.pr.new commit of `--preview`. */
856
+ target: {
857
+ version: string;
858
+ } | {
859
+ preview: string;
860
+ };
861
+ /** The root of the workspace that the command updated. */
862
+ root: string;
863
+ /** Each ViteHub package that the project names, with the specifier it now uses. */
864
+ packages: Readonly<Record<string, string>>;
865
+ changes: readonly Pick<SetupChange, "diff" | "kind" | "path">[];
866
+ install: {
867
+ command: string;
868
+ };
869
+ }
870
+ interface WorkspaceFile {
871
+ path: string;
872
+ before: string;
873
+ after: string;
874
+ }
875
+ /** The command that installs the new specifiers. pnpm resolves ViteHub peers again only with `update`. */
876
+ export declare function updateInstallArgs(packageManager: SetupPackageManager, workspace: boolean): string[];
877
+ /** Reads the arguments. Throws `CLI_R0003` for an unknown flag or a value that is not a commit. */
878
+ export declare function readUpdateArgs(args: readonly string[]): SetupUpdateArgs;
879
+ interface PlannedUpdate {
880
+ plan: SetupUpdatePlan;
881
+ files: readonly WorkspaceFile[];
882
+ packageManager: SetupPackageManager;
883
+ installArgs: string[];
884
+ }
885
+ /** Plans the update: finds every ViteHub specifier, resolves the target, and computes the new files. Writes nothing. */
886
+ export declare function planSetupUpdate(rootDir: string, args: Pick<SetupUpdateArgs, "preview">, context: Pick<ViteHubCliContext, "env" | "fetch">): Promise<PlannedUpdate>;
887
+ export declare const updateCommand: ViteHubCliCommand;
888
+ //#endregion
839
889
  //#region src/setup/session.d.ts
840
890
  /**
841
891
  * Runs the package manager with an argument array and no shell. `onOutput` gets its stdout and stderr as they arrive.
@@ -885,6 +935,7 @@ interface SetupSessionPlanFields {
885
935
  command: string;
886
936
  /** True when applying writes the config file, so the dev server restarts. */
887
937
  restart: boolean;
938
+ restartRequired?: true;
888
939
  }
889
940
  interface SetupSession {
890
941
  catalog: () => SetupSessionResult;
@@ -916,4 +967,4 @@ export declare function setupRequestArgs(request: unknown): {
916
967
  */
917
968
  export declare function createSetupSession(options: SetupSessionOptions): SetupSession;
918
969
  //#endregion
919
- 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 };
970
+ 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 };
@@ -1,8 +1,9 @@
1
- import { P as setupStatus, R as readSetupProject, c as linkSetupProject, d as readSetupLinkStatus, f as readSetupLinks, m as unlinkSetupProject, p as selectSetupLink, r as SETUP_LINK_FILE, u as readSetupLinkState } from "../env-DzoVtVJO.js";
2
- import { m as cliErrorDiagnostics } from "../provision-D8OvBBzi.js";
3
- import { i as setupFailure, o as writeSetupError, r as setupExitCodes } from "../envelope-Cf56AJLa.js";
4
- import { S as shellQuote, _ as setupCatalog, a as readRemoveArgs, b as planSetupAdd, c as initPackages, d as readSetupStack, f as deployCommand, g as readSetupLive, h as deploymentsCommand, i as planSetupRemove, l as nuxiPackage, m as STATUS_HOST_TIMEOUT_MS, n as setupCommands, o as removeCommand, p as readDeployArgs, r as applySetupRemove, s as initCommandDefinition, u as readInitArgs, v as addCommand, x as readAddArgs, y as applySetupAdd } from "../commands-DPg3kL8m.js";
5
- import { a as defaultConsoleUrl, c as readConsoleCredential, i as consoleUrlVariable, l as whoamiCommand, n as consoleOrigin, o as loginCommand, r as consoleTokenVariable, s as logoutCommand, t as consoleCredentialsFile } from "../console-auth-xl7kLQNt.js";
1
+ import { m as cliErrorDiagnostics } from "../provision-DgT_lpyn.js";
2
+ import { F as setupStatus, H as readSetupProject, I as shellQuote, c as linkSetupProject, d as readSetupLinkStatus, f as readSetupLinks, m as unlinkSetupProject, p as selectSetupLink, r as SETUP_LINK_FILE, u as readSetupLinkState } from "../env-MtXhP7A7.js";
3
+ 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-W0ijB5R6.js";
4
+ import { i as setupFailure, o as writeSetupError, r as setupExitCodes } from "../envelope-C7e408hm.js";
5
+ import { a as defaultConsoleUrl, c as readConsoleCredential, i as consoleUrlVariable, l as whoamiCommand, n as consoleOrigin, o as loginCommand, r as consoleTokenVariable, s as logoutCommand, t as consoleCredentialsFile } from "../console-auth-Dz9HHP2G.js";
6
+ import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-CHW75le_.js";
6
7
  import { join } from "pathe";
7
8
  import { readFile } from "node:fs/promises";
8
9
  import { createHash, randomUUID } from "node:crypto";
@@ -63,7 +64,6 @@ function setupRequestArgs(request) {
63
64
  argv
64
65
  };
65
66
  }
66
- /** The SHA-256 of each file, or `absent`. */
67
67
  async function fingerprint(root, paths) {
68
68
  const files = /* @__PURE__ */ new Map();
69
69
  for (const path of new Set(paths)) {
@@ -116,7 +116,8 @@ function createSetupSession(options) {
116
116
  args,
117
117
  fields: {
118
118
  command,
119
- restart: !!planned.configFile
119
+ restart: !!planned.configFile,
120
+ ...planned.restartRequired ? { restartRequired: true } : {}
120
121
  },
121
122
  files: /* @__PURE__ */ new Map(),
122
123
  planned
@@ -133,7 +134,8 @@ function createSetupSession(options) {
133
134
  args,
134
135
  fields: {
135
136
  command,
136
- restart: !!planned.configFile
137
+ restart: !!planned.configFile,
138
+ ...planned.restartRequired ? { restartRequired: true } : {}
137
139
  },
138
140
  files: /* @__PURE__ */ new Map(),
139
141
  planned
@@ -228,4 +230,4 @@ function createSetupSession(options) {
228
230
  };
229
231
  }
230
232
  //#endregion
231
- export { SETUP_LINK_FILE, STATUS_HOST_TIMEOUT_MS, addCommand, applySetupAdd, applySetupRemove, consoleCredentialsFile, consoleOrigin, consoleTokenVariable, consoleUrlVariable, createSetupSession, defaultConsoleUrl, deployCommand, deploymentsCommand, initCommandDefinition, initPackages, linkSetupProject, loginCommand, logoutCommand, nuxiPackage, planSetupAdd, planSetupRemove, readAddArgs, readConsoleCredential, readDeployArgs, readInitArgs, readRemoveArgs, readSetupLinkState, readSetupLinkStatus, readSetupLinks, readSetupLive, readSetupProject, readSetupStack, removeCommand, selectSetupLink, setupCatalog, setupCommands, setupExitCodes, setupRequestArgs, setupStatus, unlinkSetupProject, whoamiCommand };
233
+ export { SETUP_LINK_FILE, STATUS_HOST_TIMEOUT_MS, addCommand, applySetupAdd, applySetupRemove, consoleCredentialsFile, consoleOrigin, consoleTokenVariable, consoleUrlVariable, createSetupSession, defaultConsoleUrl, deployCommand, deploymentsCommand, initCommandDefinition, initPackages, linkSetupProject, loginCommand, logoutCommand, nuxiPackage, planSetupAdd, planSetupRemove, planSetupUpdate, readAddArgs, readConsoleCredential, readDeployArgs, readInitArgs, readRemoveArgs, readSetupLinkState, readSetupLinkStatus, readSetupLinks, readSetupLive, readSetupProject, readUpdateArgs, removeCommand, selectSetupLink, setupCatalog, setupCommands, setupExitCodes, setupRequestArgs, setupStatus, unlinkSetupProject, updateCommand, updateInstallArgs, whoamiCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/cli",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "description": "Command-line workflows for ViteHub projects.",
5
5
  "keywords": [
6
6
  "agent",
@@ -46,17 +46,18 @@
46
46
  "@dotenvx/primitives": "^4.4.0",
47
47
  "@noble/ciphers": "^2.4.0",
48
48
  "@noble/hashes": "^2.4.0",
49
- "@vite-hub/runtime": "0.3.1",
49
+ "@vite-hub/runtime": "0.5.0",
50
50
  "birpc": "^4.2.0",
51
51
  "diff": "^9.0.0",
52
52
  "nostics": "1.4.0",
53
53
  "pathe": "^2.0.3",
54
+ "rc9": "^3.1.0",
54
55
  "semver": "^7.8.5"
55
56
  },
56
57
  "devDependencies": {
57
58
  "@types/node": "^24.19.1",
58
59
  "@types/semver": "^7.8.0",
59
- "@vite-hub/forge": "0.3.1",
60
+ "@vite-hub/forge": "0.5.0",
60
61
  "@vite-hub/internal": "0.0.1",
61
62
  "nuxt": "npm:nuxt-nightly@5.0.0-2611052317-a04317f",
62
63
  "typescript": "^6.0.3",
@@ -66,12 +67,12 @@
66
67
  "vitest": "^4.1.11"
67
68
  },
68
69
  "peerDependencies": {
69
- "@vite-hub/forge": "0.3.1",
70
+ "@vite-hub/forge": "0.5.0",
70
71
  "nuxt": ">=5.0.0-0",
71
72
  "vite": ">=8.0.0"
72
73
  },
73
74
  "engines": {
74
- "node": ">=22.18.0"
75
+ "node": ">=24.15.0"
75
76
  },
76
77
  "peerDependenciesMeta": {
77
78
  "@vite-hub/forge": {