@vite-hub/cli 0.7.0 → 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 CHANGED
@@ -37,8 +37,9 @@ pnpm vitehub --help
37
37
  ```
38
38
 
39
39
  Every project includes `inspect` and `provision`. Other namespaces appear when their Vite integrations are active.
40
+ The CLI can reuse root and namespace help in Vite projects after successful discovery. It does not cache Nuxt help because Nuxt does not report all config imports.
40
41
  When the config throws, `vitehub --help` and `vitehub env --help` print the error, show reduced help, and exit with code 1. Of the listed commands, only `deploy`, `provision run`, and `provision status` load the config.
41
- Each CLI invocation resolves every active plugin's CLI contributor once. Commands and Provision Steps use that contribution for the invocation; the next invocation resolves it again.
42
+ When the CLI loads the project, it resolves each active plugin's CLI contributor once. Commands and Provision Steps use that contribution for the invocation.
42
43
 
43
44
  The CLI owns the `inspect` namespace. Plugin command contributions with that name are ignored. Generated operations cannot use the built-in `inspect` or `provision` namespaces: registry creation rejects them. Set the operation's `cli.namespace` to another name.
44
45
 
@@ -1,18 +1,22 @@
1
- import { r as __exportAll } from "./console-env-MPzeOLqu.js";
2
- import { At as insertViteHubConfig, Bt as hasDefinitionFiles, Ct as declaresNuxt5, Dt as readSetupProject, Et as pnpmWorkspaceFile, Ft as setupFailure, It as table, Lt as writeSetupError, Mt as isSetupFailure, Nt as readSetupArgs, Ot as setupLockfiles, Pt as setupExitCodes, Rt as writeSetupJson, St as whoamiCommand, Tt as nuxtReleases, Vt as listMatchingFiles, Y as appsCommand, at as missingProviderOption, cn as featureHosts, ct as setupStatus, dn as features, f as ignoredFolders, fn as impliedFeatures, h as readSetupLinkState, it as installCommand, jt as locateViteHubConfig, kt as editViteHubConfig, ln as featureIds, lt as shellQuote, m as readLinkHostOption, nt as formatInstallCommand, ot as rateLimitUsesVercelKV, p as linkSetupProject, pn as installSpecifier, rt as installArgs, s as SETUP_LINK_FILE, st as setupFeaturePackages, u as gitignoreWith, un as featureSupport, ut as uninstallArgs, vt as loginCommand, wn as isRecord$2, wt as detectPackageManager, y as unlinkSetupProject, yt as logoutCommand, zt as cliErrorDiagnostics } from "./provision-DWEZYLWJ.js";
3
- import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, o as liveLabel, s as readSetupLive, t as deployCommand } from "./deploy-CGRf9Pq-.js";
1
+ import { _ as featureSupport, b as impliedFeatures, d as cliErrorDiagnostics, h as featureIds, m as featureHosts, v as features, w as isRecord, x as installSpecifier } from "./provision-9QsGgeiq.js";
2
+ import { _ as setupLockfiles, b as locateViteHubConfig, c as logoutCommand, d as whoamiCommand, f as declaresNuxt5, g as readSetupProject, h as pnpmWorkspaceFile, m as nuxtReleases, p as detectPackageManager, s as loginCommand, v as editViteHubConfig, y as insertViteHubConfig } from "./console-auth-cCodgT_T.js";
3
+ import { a as table, c as __exportAll, i as setupFailure, n as readSetupArgs, o as writeSetupError, r as setupExitCodes, s as writeSetupJson, t as isSetupFailure } from "./envelope-BJQ7xPyX.js";
4
+ import { a as rateLimitUsesVercelKV, c as shellQuote, f as hasDefinitionFiles, i as missingProviderOption, l as uninstallArgs, n as installArgs, o as setupFeaturePackages, p as listMatchingFiles, r as installCommand, s as setupStatus, t as formatInstallCommand } from "./status-gjvZVutV.js";
5
+ import { t as appsCommand } from "./console-apps-BQX-Np9Q.js";
6
+ import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, o as liveLabel, s as readSetupLive, t as deployCommand } from "./deploy-CqR6pJa-.js";
7
+ import { i as gitignoreWith, l as readLinkHostOption, m as unlinkSetupProject, o as ignoredFolders, s as linkSetupProject, t as SETUP_LINK_FILE, u as readSetupLinkState } from "./link-BRNWNqT9.js";
4
8
  import { createRequire } from "node:module";
5
9
  import { existsSync, readFileSync } from "node:fs";
6
10
  import process from "node:process";
11
+ import { pathToFileURL } from "node:url";
7
12
  import { basename, dirname, join, relative, resolve } from "pathe";
8
13
  import { glob, mkdir, readFile, readdir, rm, rmdir, writeFile } from "node:fs/promises";
9
14
  import { join as join$1, matchesGlob } from "node:path";
10
15
  import { createInterface } from "node:readline/promises";
11
- import { pathToFileURL } from "node:url";
16
+ import { createTwoFilesPatch } from "diff";
12
17
  import { isDeepStrictEqual, parseArgs, stripVTControlCharacters } from "node:util";
13
- import semver, { minVersion, satisfies, subset, validRange } from "semver";
14
18
  import { isMap, parseDocument } from "yaml";
15
- import { createTwoFilesPatch } from "diff";
19
+ import semver, { minVersion, satisfies, subset, validRange } from "semver";
16
20
  // ../internal/dist/feature-inputs.js
17
21
  function isLocaleTag(value) {
18
22
  try {
@@ -51,10 +55,10 @@ function declinedBuilds(project, host, features) {
51
55
  ];
52
56
  }
53
57
  function named(policy, name) {
54
- if (!isRecord$2(policy)) return false;
58
+ if (!isRecord(policy)) return false;
55
59
  if (policy.dangerouslyAllowAllBuilds === true) return true;
56
60
  const matches = (key) => typeof key === "string" && (key === name || key.startsWith(`${name}@`));
57
- if (isRecord$2(policy.allowBuilds) && Object.keys(policy.allowBuilds).some(matches)) return true;
61
+ if (isRecord(policy.allowBuilds) && Object.keys(policy.allowBuilds).some(matches)) return true;
58
62
  return [
59
63
  "onlyBuiltDependencies",
60
64
  "ignoredBuiltDependencies",
@@ -71,7 +75,7 @@ function pnpmBuildPolicyFile(root) {
71
75
  const document = parseDocument(readFileSync(workspace, "utf8"));
72
76
  if (document.errors.length) return workspace;
73
77
  const policy = document.toJS();
74
- if (!isRecord$2(policy) || !Array.isArray(policy.packages)) return workspace;
78
+ if (!isRecord(policy) || !Array.isArray(policy.packages)) return workspace;
75
79
  const path = relative(dirname(workspace), root);
76
80
  const patterns = policy.packages.filter((pattern) => typeof pattern === "string");
77
81
  const includes = (pattern) => matchesGlob(path, pattern.replace(/^\.\//u, "").replace(/\/$/u, ""));
@@ -176,9 +180,9 @@ const optionExamples = {
176
180
  };
177
181
  const providerKeys = ["driver", "store"];
178
182
  function selectsProvider(id, value, host) {
179
- if (!isRecord$1(value)) return false;
183
+ if (!isRecord(value)) return false;
180
184
  if (id === "workflow" && host !== "netlify") {
181
- const configured = (storage, key) => isRecord$1(storage) && (typeof storage[key] === "string" ? !!storage[key].trim() : isRecord$1(storage[key]));
185
+ const configured = (storage, key) => isRecord(storage) && (typeof storage[key] === "string" ? !!storage[key].trim() : isRecord(storage[key]));
182
186
  if (configured(value.postgres, "url") || configured(value.sqlite, "path")) return true;
183
187
  }
184
188
  return providerKeys.some((key) => value[key] !== void 0);
@@ -191,7 +195,7 @@ function hostSupport(id, host, env) {
191
195
  const enabledValues = { env: {} };
192
196
  function installSpecifiers(packages) {
193
197
  const manifest = JSON.parse(readFileSync(new URL(import.meta.resolve("@vite-hub/cli/package.json")), "utf8"));
194
- const dependencies = isRecord$1(manifest) && isRecord$1(manifest.dependencies) ? manifest.dependencies : {};
198
+ const dependencies = isRecord(manifest) && isRecord(manifest.dependencies) ? manifest.dependencies : {};
195
199
  const preview = Object.entries(dependencies).flatMap(([name, specifier]) => {
196
200
  if (!name.startsWith("@vite-hub/") || typeof specifier !== "string" || !specifier.startsWith("https://pkg.pr.new/")) return [];
197
201
  const [base, ref] = specifier.split(`/${name}@`);
@@ -228,13 +232,10 @@ function setPath(target, path, value) {
228
232
  return;
229
233
  }
230
234
  const child = target[key];
231
- const next = isRecord$1(child) ? { ...child } : {};
235
+ const next = isRecord(child) ? { ...child } : {};
232
236
  setPath(next, rest, value);
233
237
  target[key] = next;
234
238
  }
235
- function isRecord$1(value) {
236
- return !!value && typeof value === "object" && !Array.isArray(value);
237
- }
238
239
  /** Reads the arguments. Throws `CLI_R0003` for an unknown flag, feature, or option. */
239
240
  function readAddArgs(args) {
240
241
  const parsed = {
@@ -280,7 +281,7 @@ function readAddArgs(args) {
280
281
  }
281
282
  /** `value` as `--option` values under `prefix`, such as `["email.driver=resend"]`. */
282
283
  function flattenOptions(prefix, value, out = []) {
283
- if (isRecord$1(value)) for (const [key, child] of Object.entries(value)) flattenOptions(`${prefix}.${key}`, child, out);
284
+ if (isRecord(value)) for (const [key, child] of Object.entries(value)) flattenOptions(`${prefix}.${key}`, child, out);
284
285
  else out.push(`${prefix}=${value === null || typeof value !== "object" ? String(value) : JSON.stringify(value)}`);
285
286
  return out;
286
287
  }
@@ -292,7 +293,7 @@ function rerunCommand$1(args, extra = {}, extraFeatures = []) {
292
293
  ...Object.keys(extra)
293
294
  ])].flatMap((id) => {
294
295
  const merged = mergeValue(args.options[id], extra[id]);
295
- return isRecord$1(merged) ? flattenOptions(id, merged) : [];
296
+ return isRecord(merged) ? flattenOptions(id, merged) : [];
296
297
  });
297
298
  return [
298
299
  "vitehub add",
@@ -307,18 +308,18 @@ function rerunCommand$1(args, extra = {}, extraFeatures = []) {
307
308
  /** Merges `patch` into `base`, object key by object key. */
308
309
  function mergeValue(base, patch) {
309
310
  if (patch === void 0) return base;
310
- if (!isRecord$1(base) || !isRecord$1(patch)) return patch;
311
+ if (!isRecord(base) || !isRecord(patch)) return patch;
311
312
  const merged = { ...base };
312
313
  for (const [key, value] of Object.entries(patch)) merged[key] = mergeValue(base[key], value);
313
314
  return merged;
314
315
  }
315
316
  function sameValue(left, right) {
316
- if (isRecord$1(left) && isRecord$1(right)) return [.../* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])].every((key) => sameValue(left[key], right[key]));
317
+ if (isRecord(left) && isRecord(right)) return [.../* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])].every((key) => sameValue(left[key], right[key]));
317
318
  return JSON.stringify(left) === JSON.stringify(right);
318
319
  }
319
320
  function toSource(value) {
320
321
  if (Array.isArray(value)) return `[${value.map(toSource).join(", ")}]`;
321
- if (isRecord$1(value)) {
322
+ if (isRecord(value)) {
322
323
  const entries = Object.entries(value).map(([key, child]) => `${/^[A-Z_$][\w$]*$/iu.test(key) ? key : JSON.stringify(key)}: ${toSource(child)}`);
323
324
  return entries.length ? `{ ${entries.join(", ")} }` : "{}";
324
325
  }
@@ -333,7 +334,7 @@ function nextValue(id, status, project, options) {
333
334
  if (current?.kind === "expression") return "expression";
334
335
  const literal = current?.value;
335
336
  if (!options) return status.features.find((item) => item.id === id).enabled === "on" ? void 0 : { value: enabledValues[id] ?? true };
336
- const merged = mergeValue(isRecord$1(literal) ? literal : {}, options);
337
+ const merged = mergeValue(isRecord(literal) ? literal : {}, options);
337
338
  return sameValue(literal, merged) ? void 0 : { value: merged };
338
339
  }
339
340
  /** Plans `vitehub add` without writing anything. Throws `SetupFailure` when the change needs input or is not possible. */
@@ -354,7 +355,7 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
354
355
  for (const id of args.features) {
355
356
  const support = featureSupport(id, host);
356
357
  const current = project.config?.ok ? project.config.site.keys[id] : void 0;
357
- const driver = args.options[id]?.driver ?? (current?.kind === "literal" && isRecord$1(current.value) ? current.value.driver : void 0);
358
+ const driver = args.options[id]?.driver ?? (current?.kind === "literal" && isRecord(current.value) ? current.value.driver : void 0);
358
359
  if (id === "email" && driver === "cloudflare" && host !== "cloudflare") throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
359
360
  detail: "The cloudflare driver requires Cloudflare. Choose email.driver=resend, or email.driver=log to print each message and send nothing.",
360
361
  feature: id,
@@ -393,9 +394,9 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
393
394
  const support = featureSupport(id, host);
394
395
  const current = project.config?.ok ? project.config.site.keys[id] : void 0;
395
396
  const value = valueFor(id);
396
- if (id === "observability" && isRecord$1(value) && value.papercuts) {
397
+ if (id === "observability" && isRecord(value) && value.papercuts) {
397
398
  const agent = valueFor("agent");
398
- if (host === "netlify" || isRecord$1(agent) && agent.runtime === "deno") throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
399
+ if (host === "netlify" || isRecord(agent) && agent.runtime === "deno") throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
399
400
  detail: "observability.papercuts requires Nitro-hosted Agents. Netlify and the Agent Deno runtime are not supported.",
400
401
  feature: id,
401
402
  host
@@ -403,14 +404,14 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
403
404
  requireFeature("agent");
404
405
  requireFeature("console");
405
406
  }
406
- if (id === "observability" && isRecord$1(value) && value.posthog) requireFeature("env");
407
+ if (id === "observability" && isRecord(value) && value.posthog) requireFeature("env");
407
408
  if (id === "realtime" && args.name !== void 0) requireFeature("workspace");
408
- if (id === "agent" && host === "deno" && isRecord$1(value) && value.runtime === "deno") throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
409
+ if (id === "agent" && host === "deno" && isRecord(value) && value.runtime === "deno") throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
409
410
  detail: "The Deno host cannot deploy the Agent Deno runtime outside its Nitro entrypoint. Use the host's Nitro runtime instead.",
410
411
  feature: id,
411
412
  host
412
413
  }), setupExitCodes.conflict);
413
- if (id === "realtime" && isRecord$1(value) && value.driver !== void 0) {
414
+ if (id === "realtime" && isRecord(value) && value.driver !== void 0) {
414
415
  const choices = host === "cloudflare" ? ["cloudflare", "auto"] : host === "node" ? [
415
416
  "auto",
416
417
  "postgres",
@@ -423,7 +424,7 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
423
424
  host
424
425
  }), setupExitCodes.conflict);
425
426
  }
426
- if (id === "cache" && isRecord$1(value) && value.driver !== void 0) {
427
+ if (id === "cache" && isRecord(value) && value.driver !== void 0) {
427
428
  const nativeDriver = {
428
429
  cloudflare: "cloudflare",
429
430
  deno: "deno-kv",
@@ -437,13 +438,13 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
437
438
  host
438
439
  }), setupExitCodes.conflict);
439
440
  }
440
- const invocations = id === "agent" && isRecord$1(value) ? value.invocations : void 0;
441
+ const invocations = id === "agent" && isRecord(value) ? value.invocations : void 0;
441
442
  if (host === "netlify" && invocations !== void 0 && invocations !== false) throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
442
443
  detail: "agent.invocations requires Nitro-hosted Agents. Set invocations on each Agent Definition instead, or use agent.invocations=false.",
443
444
  feature: id,
444
445
  host
445
446
  }), setupExitCodes.conflict);
446
- if (invocations === "database" || isRecord$1(invocations) && invocations.store === "database") requireFeature("database");
447
+ if (invocations === "database" || isRecord(invocations) && invocations.store === "database") requireFeature("database");
447
448
  const storageSelected = id === "workflow" && host !== "netlify" && selectsProvider(id, value, host);
448
449
  if (support.level === "explicit" && !storageSelected) {
449
450
  const field = missingProviderOption(project, support.option, value);
@@ -464,19 +465,19 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
464
465
  for (const [field, choice] of Object.entries(optionChoices)) {
465
466
  if (!choice?.requires || !field.startsWith(`${id}.`)) continue;
466
467
  const key = field.slice(id.length + 1);
467
- const selected = (isRecord$1(value) ? value[key] : void 0) ?? defaults[id]?.[key];
468
+ const selected = (isRecord(value) ? value[key] : void 0) ?? defaults[id]?.[key];
468
469
  if (typeof selected !== "string" || !choice.values.includes(selected)) continue;
469
470
  requireFeature(choice.requires);
470
471
  }
471
- if (id === "schedule" && host === "node" && current?.kind !== "expression" && !(isRecord$1(value) && value.providerOutput === false)) {
472
- if (isRecord$1(value) && (value.providerOutput === "nitro" || value.providerOutput === "standalone")) {
472
+ if (id === "schedule" && host === "node" && current?.kind !== "expression" && !(isRecord(value) && value.providerOutput === false)) {
473
+ if (isRecord(value) && (value.providerOutput === "nitro" || value.providerOutput === "standalone")) {
473
474
  missing.push({
474
475
  choices: ["auto"],
475
476
  field: "schedule.providerOutput"
476
477
  });
477
478
  setPath(defaults.schedule ??= {}, ["providerOutput"], "auto");
478
479
  }
479
- if (isRecord$1(value) && value.runtime !== void 0 && (!isRecord$1(value.runtime) || value.runtime.driver !== "process")) {
480
+ if (isRecord(value) && value.runtime !== void 0 && (!isRecord(value.runtime) || value.runtime.driver !== "process")) {
480
481
  missing.push({
481
482
  choices: ["process"],
482
483
  field: "schedule.runtime.driver"
@@ -488,8 +489,8 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
488
489
  const enabledAfter = (id) => inputFeatures.includes(id) || status.features.find((item) => item.id === id)?.enabled === "on";
489
490
  const agent = valueFor("agent");
490
491
  const observabilityValue = valueFor("observability");
491
- const telemetry = isRecord$1(observabilityValue) && typeof observabilityValue.service === "string";
492
- if (inputFeatures.some((id) => id === "agent" || id === "observability") && enabledAfter("observability") && telemetry && enabledAfter("agent") && (host === "netlify" || isRecord$1(agent) && agent.runtime === "deno")) throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
492
+ const telemetry = isRecord(observabilityValue) && typeof observabilityValue.service === "string";
493
+ if (inputFeatures.some((id) => id === "agent" || id === "observability") && enabledAfter("observability") && telemetry && enabledAfter("agent") && (host === "netlify" || isRecord(agent) && agent.runtime === "deno")) throw setupFailure(cliErrorDiagnostics.SETUP_FEATURE_UNSUPPORTED({
493
494
  detail: "Observability requires Nitro-hosted Agents. Netlify and the Agent Deno runtime are not supported.",
494
495
  feature: "observability",
495
496
  host
@@ -498,7 +499,7 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
498
499
  const site = project.config?.ok ? project.config.site : void 0;
499
500
  if (inputFeatures.includes("i18n") && site?.keys.i18n?.kind !== "expression") {
500
501
  const i18n = valueFor("i18n");
501
- const problem = i18nLocaleListProblem(isRecord$1(i18n) ? i18n.locales : void 0);
502
+ const problem = i18nLocaleListProblem(isRecord(i18n) ? i18n.locales : void 0);
502
503
  if (problem) {
503
504
  missing.push({ field: "i18n.locales" });
504
505
  inputFixes.push(`${problem} Pass a nonempty JSON array, such as \`--option 'i18n.locales=["en","es"]'\`.`);
@@ -514,15 +515,15 @@ async function planSetupAdd(project, args, env, rerun = rerunCommand$1) {
514
515
  const selectedAuth = args.features.includes("auth") && (!configuredAuth || configuredAuth.kind === "expression" || configuredAuth.value === false);
515
516
  const authEnabled = !args.options.auth && (selectedAuth || configuredAuth?.kind === "literal" && configuredAuth.value === true || discoveredAuth);
516
517
  const mcp = valueFor("mcp");
517
- const mode = isRecord$1(mcp) && Object.hasOwn(mcp, "auth") ? mcp.auth : void 0;
518
- const publicRoute = isRecord$1(mcp) && typeof mcp.publicRoute === "string" ? mcp.publicRoute : void 0;
518
+ const mode = isRecord(mcp) && Object.hasOwn(mcp, "auth") ? mcp.auth : void 0;
519
+ const publicRoute = isRecord(mcp) && typeof mcp.publicRoute === "string" ? mcp.publicRoute : void 0;
519
520
  if ((typeof mode === "boolean" || mode === "optional") && mcpPublicRouteNeedsSignedAuth(publicRoute, mode)) {
520
521
  missing.push({ field: "mcp.publicRoute" });
521
522
  inputFixes.push("Remove `mcp.publicRoute`, or enable Auth, set `mcp.auth=true`, and add `mcpOAuth()` to the Auth Definition.");
522
523
  rerunnable = false;
523
524
  } else if (!authEnabled && authStatus?.enabled === "unknown" && (mode === void 0 || mode === true || mode === "optional")) {
524
525
  const file = project.configFile ?? "vite.config.ts";
525
- const snippet = `mcp: ${toSource(isRecord$1(mcp) ? mcp : true)},`;
526
+ const snippet = `mcp: ${toSource(isRecord(mcp) ? mcp : true)},`;
526
527
  const fix = `Confirm Auth is enabled in the app. ${mcpOAuthSetup}. Add this key to the vitehub() options by hand:\n${snippet}`;
527
528
  throw setupFailure(cliErrorDiagnostics.SETUP_CONFIG_MANUAL({
528
529
  file,
@@ -945,7 +946,7 @@ function containsCredentials(value) {
945
946
  return !!(url && (url.username || url.password || url.search || url.hash));
946
947
  }
947
948
  if (Array.isArray(value)) return value.some(containsCredentials);
948
- return isRecord$1(value) && Object.entries(value).some(([key, child]) => credentialKey(key) || containsCredentials(child));
949
+ return isRecord(value) && Object.entries(value).some(([key, child]) => credentialKey(key) || containsCredentials(child));
949
950
  }
950
951
  function setupStackLabels(stack) {
951
952
  return {
@@ -967,7 +968,7 @@ async function deriveSetupStack(project, status, validate) {
967
968
  });
968
969
  return;
969
970
  }
970
- if (isRecord$1(value) && Object.keys(value).length) {
971
+ if (isRecord(value) && Object.keys(value).length) {
971
972
  for (const [key, child] of Object.entries(value)) collect(id, [...keys, key], child);
972
973
  return;
973
974
  }
@@ -1019,7 +1020,7 @@ async function deriveSetupStack(project, status, validate) {
1019
1020
  continue;
1020
1021
  }
1021
1022
  const value = setting?.value;
1022
- if (features[id].enabledByDefault && (value === void 0 || value === true || isRecord$1(value) && !Object.keys(value).length)) continue;
1023
+ if (features[id].enabledByDefault && (value === void 0 || value === true || isRecord(value) && !Object.keys(value).length)) continue;
1023
1024
  selected.push(id);
1024
1025
  if (value !== void 0 && value !== true) collect(id, [], value);
1025
1026
  }
@@ -1131,9 +1132,6 @@ const nuxt47ViteHub = "vite-hub@>=0.5.1 <1";
1131
1132
  /** The pinned Nuxt CLI that creates a new Nuxt app. */
1132
1133
  const nuxiPackage = "nuxi@3.37.0";
1133
1134
  const nuxtTemplate = "gh:nuxt/starter#d4367031fe43d93d4e2a339f73b519ec35e78b38";
1134
- function isRecord(value) {
1135
- return !!value && typeof value === "object" && !Array.isArray(value);
1136
- }
1137
1135
  function invalid$2(message) {
1138
1136
  return cliErrorDiagnostics.CLI_R0003({ message: `[vitehub] ${message} Usage: ${usage$2}` });
1139
1137
  }
@@ -1237,7 +1235,7 @@ function viteAppFiles(name, host) {
1237
1235
  start: "node .output/server/index.mjs"
1238
1236
  }
1239
1237
  }, null, 2)}\n`,
1240
- "server/api/health.get.ts": "import { defineEventHandler } from \"h3\"\n\nexport default defineEventHandler(() => ({ ok: true }))\n",
1238
+ "server/api/health.get.ts": "import { defineEventHandler } from \"nitro/h3\"\n\nexport default defineEventHandler(() => ({ ok: true }))\n",
1241
1239
  "tsconfig.json": `{
1242
1240
  "extends": ["vite-hub/tsconfig"],
1243
1241
  "compilerOptions": {
@@ -1903,11 +1901,11 @@ function isStarter(starter, path, content) {
1903
1901
  return name !== void 0 && [starter.template, ...starter.previousTemplates ?? []].some((template) => template(name) === content);
1904
1902
  }
1905
1903
  function optionPrerequisites(id, value, unknown) {
1906
- const options = isRecord$1(value) ? value : void 0;
1904
+ const options = isRecord(value) ? value : void 0;
1907
1905
  if (id === "cache" && (unknown || options?.driver === "kv")) return ["kv"];
1908
1906
  if (id === "observability") return [...unknown || options?.posthog ? ["env"] : [], ...unknown || options?.papercuts ? ["agent", "console"] : []];
1909
1907
  const invocations = options?.invocations;
1910
- if (id === "agent" && (unknown || invocations === "database" || isRecord$1(invocations) && invocations.store === "database")) return ["database"];
1908
+ if (id === "agent" && (unknown || invocations === "database" || isRecord(invocations) && invocations.store === "database")) return ["database"];
1911
1909
  return [];
1912
1910
  }
1913
1911
  /** Plans `vitehub remove` without writing anything. Throws `SetupFailure` when the change is not safe or not possible. */
@@ -2284,12 +2282,9 @@ function nextSpecifier(name, current, place, target) {
2284
2282
  if (place === "override") return version;
2285
2283
  return `${/^[\^~]/u.exec(current)?.[0] ?? (semver.valid(current) ? "" : "^")}${version}`;
2286
2284
  }
2287
- function isObject(value) {
2288
- return !!value && typeof value === "object" && !Array.isArray(value);
2289
- }
2290
2285
  function visitManifest(manifest, visit) {
2291
2286
  const entries = (holder, place, nameOf) => {
2292
- if (!isObject(holder)) return;
2287
+ if (!isRecord(holder)) return;
2293
2288
  for (const [key, value] of Object.entries(holder)) {
2294
2289
  const name = nameOf(key);
2295
2290
  if (typeof value === "string") {
@@ -2297,7 +2292,7 @@ function visitManifest(manifest, visit) {
2297
2292
  name,
2298
2293
  place
2299
2294
  });
2300
- } else if (place === "override" && isObject(value)) {
2295
+ } else if (place === "override" && isRecord(value)) {
2301
2296
  if (name && typeof value["."] === "string" && isReplaceable(value["."])) visit(value, ".", {
2302
2297
  name,
2303
2298
  place
@@ -2310,10 +2305,10 @@ function visitManifest(manifest, visit) {
2310
2305
  for (const field of dependencyFields) entries(manifest[field], "dependency", plainName);
2311
2306
  entries(manifest.overrides, "override", overrideTarget);
2312
2307
  entries(manifest.resolutions, "override", overrideTarget);
2313
- if (isObject(manifest.pnpm)) entries(manifest.pnpm.overrides, "override", overrideTarget);
2314
- if (isObject(manifest.workspaces)) {
2308
+ if (isRecord(manifest.pnpm)) entries(manifest.pnpm.overrides, "override", overrideTarget);
2309
+ if (isRecord(manifest.workspaces)) {
2315
2310
  entries(manifest.workspaces.catalog, "dependency", plainName);
2316
- if (isObject(manifest.workspaces.catalogs)) for (const catalog of Object.values(manifest.workspaces.catalogs)) entries(catalog, "dependency", plainName);
2311
+ if (isRecord(manifest.workspaces.catalogs)) for (const catalog of Object.values(manifest.workspaces.catalogs)) entries(catalog, "dependency", plainName);
2317
2312
  }
2318
2313
  }
2319
2314
  function unquote(text) {
@@ -2445,7 +2440,7 @@ function workspacePatterns(yaml, manifest) {
2445
2440
  return yamlList(lines, yamlBlocks(lines).get("packages")).map((item) => item.value);
2446
2441
  }
2447
2442
  const workspaces = manifest.workspaces;
2448
- return (Array.isArray(workspaces) ? workspaces : isObject(workspaces) && Array.isArray(workspaces.packages) ? workspaces.packages : []).filter((item) => typeof item === "string");
2443
+ return (Array.isArray(workspaces) ? workspaces : isRecord(workspaces) && Array.isArray(workspaces.packages) ? workspaces.packages : []).filter((item) => typeof item === "string");
2449
2444
  }
2450
2445
  async function workspaceRoot(start) {
2451
2446
  if (setupLockfiles.some(([file]) => existsSync(join(start, file)))) return start;
@@ -2460,7 +2455,7 @@ async function workspaceRoot(start) {
2460
2455
  }
2461
2456
  async function readJson(file) {
2462
2457
  const value = JSON.parse(await readFile(file, "utf8"));
2463
- return isObject(value) ? value : {};
2458
+ return isRecord(value) ? value : {};
2464
2459
  }
2465
2460
  function stringifyLike(before, value) {
2466
2461
  const indent = /^[ \t]+(?=")/mu.exec(before)?.[0] ?? " ";
@@ -2528,7 +2523,7 @@ async function resolvePackages(names, preview, context) {
2528
2523
  });
2529
2524
  if (preview) return;
2530
2525
  const body = await response.json();
2531
- const version = isObject(body) && typeof body.version === "string" ? body.version : void 0;
2526
+ const version = isRecord(body) && typeof body.version === "string" ? body.version : void 0;
2532
2527
  if (!version) throw cliErrorDiagnostics.CLI_UPDATE_REQUEST_FAILED({
2533
2528
  status: "a response without a version",
2534
2529
  url: target
@@ -2587,7 +2582,7 @@ async function planSetupUpdate(rootDir, args, context) {
2587
2582
  const direct = /* @__PURE__ */ new Map();
2588
2583
  for (const field of dependencyFields) {
2589
2584
  const dependencies = manifest.value[field];
2590
- if (!isObject(dependencies)) continue;
2585
+ if (!isRecord(dependencies)) continue;
2591
2586
  for (const [name, value] of Object.entries(dependencies)) if (isViteHubPackage(name) && typeof value === "string" && isReplaceable(value) && !missing.includes(name)) direct.set(name, nextSpecifier(name, value, "dependency", resolved));
2592
2587
  }
2593
2588
  let edited = false;