@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.
@@ -86,6 +86,7 @@ interface ProvisionStep {
86
86
  id: string;
87
87
  provider: ProvisionProvider;
88
88
  plan: (context: ProvisionContext) => Promise<ProvisionAction[]>;
89
+ hasResources?: (context: Pick<ProvisionContext, "env">) => boolean;
89
90
  /** Describes the Provision State this step records. Runs without network access, also without credentials. */
90
91
  recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
91
92
  }
@@ -102,10 +103,13 @@ interface ViteHubCliSpawnResult {
102
103
  signal?: NodeJS.Signals | null;
103
104
  /** The output of the child when `stdout` is `pipe`. */
104
105
  stdout?: string;
106
+ /** The error output of the child when `stderr` is `pipe`. */
107
+ stderr?: string;
105
108
  }
106
109
  interface ViteHubCliSpawnOptions {
107
110
  cwd?: string;
108
111
  env?: NodeJS.ProcessEnv;
112
+ onOutput?: (text: string, stream: "stdout" | "stderr") => void;
109
113
  stderr?: "inherit" | "pipe";
110
114
  /** `ignore` gives the child no terminal input, so a tool that asks questions on a terminal does not ask. */
111
115
  stdin?: "ignore" | "inherit";
@@ -113,7 +117,17 @@ interface ViteHubCliSpawnOptions {
113
117
  stdout?: "inherit" | "pipe" | "stderr";
114
118
  }
115
119
  type ViteHubCliSpawn = (command: string, args: string[], options?: ViteHubCliSpawnOptions) => Promise<ViteHubCliSpawnResult>;
120
+ /** Where a call to an app goes through the Console: the operation endpoint of the app's Console project, and the token of `vitehub login`. */
121
+ interface ViteHubCliConsoleRoute {
122
+ authorization: string;
123
+ target: string;
124
+ }
116
125
  interface ViteHubCliContext extends ViteHubCliStreams {
126
+ /**
127
+ * Finds the app at `url` in the Console of `vitehub login` and returns the route that lets the Console sign the call.
128
+ * Returns nothing when the command must call the app directly, such as when a `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>` is set.
129
+ */
130
+ consoleRoute?: (url: string, signal: AbortSignal) => Promise<ViteHubCliConsoleRoute | undefined>;
117
131
  cwd: string;
118
132
  env: NodeJS.ProcessEnv;
119
133
  /** Replaces `fetch` for commands that call a running app, so tests need no server. */
@@ -132,6 +146,7 @@ interface ViteHubCliContext extends ViteHubCliStreams {
132
146
  spawn: ViteHubCliSpawn;
133
147
  }
134
148
  interface ViteHubCliProvision {
149
+ env?: NodeJS.ProcessEnv;
135
150
  rootDir: string;
136
151
  steps: readonly ProvisionStep[];
137
152
  }
@@ -159,4 +174,4 @@ interface ViteHubCliCommandNamespace {
159
174
  name: string;
160
175
  }
161
176
  type StdoutWriteCallback = (error?: Error | null) => void;
162
- export { ProvisionProvider as a, HostCliRun as c, ViteHubCliProvision as i, HostCredentials as l, ViteHubCliCommandNamespace as n, CredentialHost as o, ViteHubCliContext as r, CredentialSource as s, ViteHubCliCommand as t, HostCredentialsDescription as u };
177
+ export { ViteHubCliSpawn as a, CredentialSource as c, HostCredentialsDescription as d, ViteHubCliProvision as i, HostCliRun as l, ViteHubCliCommandNamespace as n, ProvisionProvider as o, ViteHubCliContext as r, CredentialHost as s, ViteHubCliCommand as t, HostCredentials as u };