@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.
@@ -0,0 +1,599 @@
1
+ import { E as internalErrorDiagnostics, _ as featureSupport, b as impliedFeatures, g as featurePackages, h as featureIds, v as features, w as isRecord, x as installSpecifier, y as formatInstallArgument } from "./provision-9QsGgeiq.js";
2
+ import { existsSync, readdirSync, statSync } from "node:fs";
3
+ import { join, relative, resolve } from "pathe";
4
+ import "node:fs/promises";
5
+ // ../internal/dist/source-files.js
6
+ const ignoredDirs = /* @__PURE__ */ new Set([
7
+ "node_modules",
8
+ "dist",
9
+ ".output",
10
+ ".nuxt",
11
+ ".vercel",
12
+ ".git",
13
+ ".vitehub"
14
+ ]);
15
+ const racyWindowNs = 2000000000n;
16
+ const storeKey = Symbol.for("vite-hub.source-files.v1");
17
+ function store() {
18
+ const existing = Reflect.get(globalThis, storeKey);
19
+ if (isStore(existing)) return existing;
20
+ const created = {
21
+ derived: /* @__PURE__ */ new Map(),
22
+ texts: /* @__PURE__ */ new Map(),
23
+ trees: /* @__PURE__ */ new Map()
24
+ };
25
+ Reflect.set(globalThis, storeKey, created);
26
+ return created;
27
+ }
28
+ function isStore(value) {
29
+ return typeof value === "object" && value !== null && "texts" in value && "trees" in value && "derived" in value;
30
+ }
31
+ function errorCode(error) {
32
+ return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
33
+ }
34
+ function statOrMissing(path) {
35
+ try {
36
+ return statSync(path, { bigint: true });
37
+ } catch (error) {
38
+ if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR") return;
39
+ throw error;
40
+ }
41
+ }
42
+ function signature(stats) {
43
+ return `${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`;
44
+ }
45
+ function isSettled(stats) {
46
+ const changed = stats.mtimeNs > stats.ctimeNs ? stats.mtimeNs : stats.ctimeNs;
47
+ return BigInt(Date.now()) * 1000000n - changed > racyWindowNs;
48
+ }
49
+ function readDirEntries(root) {
50
+ try {
51
+ return readdirSync(root, { withFileTypes: true });
52
+ } catch (error) {
53
+ if (errorCode(error) === "ENOENT") return [];
54
+ throw error;
55
+ }
56
+ }
57
+ function walkTree(root, directories, files, nested = false) {
58
+ const before = statOrMissing(root);
59
+ let trusted = before !== void 0 && isSettled(before);
60
+ if (before) directories.set(root, signature(before));
61
+ if (nested && existsSync(resolve(root, ".git"))) return trusted;
62
+ for (const entry of readDirEntries(root)) {
63
+ const path = resolve(root, entry.name);
64
+ if (entry.isDirectory() && !entry.isSymbolicLink()) {
65
+ if (entry.name.startsWith(".") || ignoredDirs.has(entry.name)) continue;
66
+ if (!walkTree(path, directories, files, true)) trusted = false;
67
+ continue;
68
+ }
69
+ if (entry.isFile()) files.push({
70
+ hidden: entry.name.startsWith("."),
71
+ name: entry.name,
72
+ path
73
+ });
74
+ }
75
+ return trusted;
76
+ }
77
+ function isCurrent(tree) {
78
+ for (const [directory, stored] of tree.directories) {
79
+ const stats = statOrMissing(directory);
80
+ if (!stats || signature(stats) !== stored) return false;
81
+ }
82
+ return true;
83
+ }
84
+ function sourceTree(root) {
85
+ const trees = store().trees;
86
+ const cached = trees.get(root);
87
+ if (cached && isCurrent(cached)) return cached;
88
+ const directories = /* @__PURE__ */ new Map();
89
+ const files = [];
90
+ const trusted = walkTree(root, directories, files);
91
+ files.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
92
+ const tree = {
93
+ directories,
94
+ files
95
+ };
96
+ if (trusted) trees.set(root, tree);
97
+ else trees.delete(root);
98
+ return tree;
99
+ }
100
+ /**
101
+ * The files below `root` whose name matches `predicate`, sorted by path. The walk skips hidden folders, Git
102
+ * repositories, and build output folders such as `node_modules`, `dist`, and `.vitehub`. Hidden files need
103
+ * `includeHidden`. Symbolic links are skipped.
104
+ */
105
+ function listSourceTreeFiles(root, predicate, options = {}) {
106
+ const files = [];
107
+ for (const file of sourceTree(resolve(root)).files) {
108
+ if (file.hidden && !options.includeHidden) continue;
109
+ if (predicate(file.name)) files.push(file.path);
110
+ }
111
+ return files;
112
+ }
113
+ // ../internal/dist/definition-catalog.js
114
+ const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
115
+ const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
116
+ const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
117
+ function listMatchingFiles(root, predicate, options = {}) {
118
+ return listSourceTreeFiles(root, predicate, options);
119
+ }
120
+ /** A module that a Definitions folder can hold: JavaScript or TypeScript, and not a declaration, test, or spec file. */
121
+ function isDefinitionSourceFile(name) {
122
+ return sourceFilePattern.test(name) && !declarationFilePattern.test(name) && !testFilePattern.test(name);
123
+ }
124
+ function listSourceFiles(root, options = {}) {
125
+ return listMatchingFiles(root, isDefinitionSourceFile, options);
126
+ }
127
+ /**
128
+ * Whether `path` is a file, or a folder that holds a Definition source file. A Definition file in a server directory,
129
+ * such as `server/auth.ts` or a file in `server/queues/`, turns its feature on without a key. An empty folder, which
130
+ * Git does not keep, turns nothing on.
131
+ */
132
+ function hasDefinitionFiles(path) {
133
+ if (!existsSync(path)) return false;
134
+ return statSync(path).isFile() || listSourceFiles(path).length > 0;
135
+ }
136
+ const databaseExtension = /\.(?:c|m)?[jt]s$/i;
137
+ const databaseIndexFiles = [
138
+ "index.ts",
139
+ "index.mts",
140
+ "index.cts",
141
+ "index.js",
142
+ "index.mjs",
143
+ "index.cjs"
144
+ ];
145
+ function serverDatabaseDefinitionName(directory, file) {
146
+ const path = relative(directory, file).replace(/\\/g, "/");
147
+ if (!databaseExtension.test(path) || declarationFilePattern.test(path)) return;
148
+ const parts = path.split("/");
149
+ const fileName = parts.at(-1);
150
+ for (let depth = 1; depth < parts.length; depth++) {
151
+ const folder = resolve(directory, ...parts.slice(0, depth));
152
+ if (!databaseIndexFiles.some((name) => existsSync(resolve(folder, name)))) continue;
153
+ return depth === parts.length - 1 && /^index\.(?:c|m)?[jt]s$/i.test(fileName) ? parts.slice(0, depth).join("/") : void 0;
154
+ }
155
+ if (parts.includes("migrations") || parts.length > 1 && /^seed\.m?[jt]s$/i.test(fileName)) return;
156
+ return path.replace(databaseExtension, "");
157
+ }
158
+ function hasServerDatabaseDefinitions(directory) {
159
+ return listSourceFiles(directory).some((file) => serverDatabaseDefinitionName(directory, file) !== void 0);
160
+ }
161
+ // ../internal/dist/deployment.js
162
+ const unsupported = (reason) => ({
163
+ reason,
164
+ supported: false
165
+ });
166
+ const plans = {
167
+ cloudflare: {
168
+ host: "cloudflare",
169
+ nitroPreset: "cloudflare-module",
170
+ output: {
171
+ directory: ".output",
172
+ entry: "server/index.mjs",
173
+ packaging: "none"
174
+ },
175
+ runtime: "workerd",
176
+ services: {
177
+ blob: {
178
+ driver: "cloudflare",
179
+ guarantee: "native",
180
+ supported: true
181
+ },
182
+ browser: {
183
+ driver: "cloudflare",
184
+ guarantee: "native",
185
+ supported: true
186
+ },
187
+ queue: {
188
+ driver: "cloudflare",
189
+ guarantee: "native",
190
+ supported: true
191
+ },
192
+ rateLimit: {
193
+ driver: "cloudflare",
194
+ guarantee: "native",
195
+ supported: true
196
+ },
197
+ realtime: {
198
+ driver: "cloudflare",
199
+ guarantee: "native",
200
+ supported: true
201
+ },
202
+ sandbox: {
203
+ driver: "cloudflare",
204
+ guarantee: "native",
205
+ supported: true
206
+ }
207
+ }
208
+ },
209
+ deno: {
210
+ host: "deno",
211
+ nitroPreset: "deno-deploy",
212
+ output: {
213
+ directory: ".output",
214
+ entry: "server/index.mjs",
215
+ packaging: "deno-node-modules"
216
+ },
217
+ runtime: "deno",
218
+ services: {
219
+ blob: unsupported("Deno Deploy has no built-in durable Blob Store with ViteHub's object-storage contract."),
220
+ browser: unsupported("Deno Deploy has no built-in Browser Provider."),
221
+ queue: unsupported("Deno Deploy has no built-in Queue Provider with ViteHub's delivery contract."),
222
+ rateLimit: unsupported("Deno Deploy has no built-in distributed Rate Limit driver."),
223
+ realtime: unsupported("Deno Deploy has no shared room authority for Realtime."),
224
+ sandbox: unsupported("Deno Deploy has no built-in isolated Sandbox Provider.")
225
+ }
226
+ },
227
+ netlify: {
228
+ host: "netlify",
229
+ nitroPreset: "netlify",
230
+ output: {
231
+ directory: ".netlify",
232
+ entry: "v1/functions/server/server.mjs",
233
+ packaging: "none"
234
+ },
235
+ runtime: "node",
236
+ services: {
237
+ blob: {
238
+ driver: "netlify-blobs",
239
+ guarantee: "native",
240
+ supported: true
241
+ },
242
+ browser: unsupported("Netlify has no built-in Browser Provider."),
243
+ queue: unsupported("Netlify has no built-in Queue Provider with ViteHub's delivery contract."),
244
+ rateLimit: unsupported("Netlify has no built-in distributed Rate Limit driver."),
245
+ realtime: unsupported("Netlify has no shared room authority for Realtime."),
246
+ sandbox: unsupported("Netlify has no built-in isolated Sandbox Provider.")
247
+ }
248
+ },
249
+ node: {
250
+ host: "node",
251
+ nitroPreset: "node-server",
252
+ output: {
253
+ directory: ".output",
254
+ entry: "server/index.mjs",
255
+ packaging: "none"
256
+ },
257
+ runtime: "node",
258
+ services: {
259
+ blob: {
260
+ driver: "fs",
261
+ guarantee: "single-host",
262
+ supported: true
263
+ },
264
+ browser: {
265
+ driver: "local",
266
+ guarantee: "single-host",
267
+ supported: true
268
+ },
269
+ queue: {
270
+ driver: "local",
271
+ guarantee: "single-host",
272
+ supported: true
273
+ },
274
+ rateLimit: {
275
+ driver: "memory",
276
+ guarantee: "process-local",
277
+ supported: true
278
+ },
279
+ realtime: {
280
+ driver: "node",
281
+ guarantee: "native",
282
+ supported: true
283
+ },
284
+ sandbox: {
285
+ driver: "container",
286
+ guarantee: "single-host",
287
+ supported: true
288
+ }
289
+ }
290
+ },
291
+ vercel: {
292
+ host: "vercel",
293
+ nitroPreset: "vercel",
294
+ output: {
295
+ directory: ".vercel/output",
296
+ entry: "functions/__server.func/index.mjs",
297
+ packaging: "none"
298
+ },
299
+ runtime: "node",
300
+ services: {
301
+ blob: {
302
+ driver: "vercel",
303
+ guarantee: "native",
304
+ supported: true
305
+ },
306
+ browser: {
307
+ driver: "cdp",
308
+ guarantee: "native",
309
+ supported: true
310
+ },
311
+ queue: {
312
+ driver: "vercel",
313
+ guarantee: "native",
314
+ supported: true
315
+ },
316
+ rateLimit: {
317
+ driver: "kv",
318
+ guarantee: "native",
319
+ supported: true
320
+ },
321
+ realtime: {
322
+ driver: "node",
323
+ guarantee: "native",
324
+ supported: true
325
+ },
326
+ sandbox: {
327
+ driver: "vercel",
328
+ guarantee: "native",
329
+ supported: true
330
+ }
331
+ }
332
+ }
333
+ };
334
+ function resolveDeploymentPlan(host) {
335
+ const plan = plans[host];
336
+ if (!plan) throw internalErrorDiagnostics.INTERNAL_R0001({ message: `Unknown ViteHub host: ${JSON.stringify(host)}.` });
337
+ return plan;
338
+ }
339
+ /** Maps a host name or a Nitro preset name, such as `cloudflare-module` or `node-server`, to its ViteHub host. */
340
+ function hostFromNitroPreset(value) {
341
+ const normalized = value?.trim().toLowerCase().replaceAll("_", "-");
342
+ if (!normalized) return;
343
+ if (normalized.startsWith("cloudflare")) return "cloudflare";
344
+ if (normalized.startsWith("deno")) return "deno";
345
+ if (normalized.startsWith("netlify")) return "netlify";
346
+ if (normalized === "node" || normalized.startsWith("node-")) return "node";
347
+ if (normalized.startsWith("vercel")) return "vercel";
348
+ }
349
+ const providerHosts = [
350
+ ["WORKERS_CI", "cloudflare"],
351
+ ["NETLIFY", "netlify"],
352
+ ["NOW_BUILDER", "vercel"],
353
+ ["VERCEL", "vercel"],
354
+ ["VERCEL_ENV", "vercel"],
355
+ ["DENO_DEPLOY", "deno"],
356
+ ["DENO_DEPLOYMENT_ID", "deno"]
357
+ ];
358
+ /**
359
+ * Returns the ViteHub host that this process builds or runs on, or `undefined` when no variable names a host.
360
+ * The order is `VITEHUB_HOST`, `NITRO_PRESET`, `SERVER_PRESET`, then the provider variables:
361
+ * `WORKERS_CI` (Cloudflare Workers Builds), `NETLIFY`, `NOW_BUILDER`, `VERCEL` or `VERCEL_ENV`, then `DENO_DEPLOY` or `DENO_DEPLOYMENT_ID`.
362
+ * `vitehub()` uses this result when `host` is omitted, and `"node"` when it is `undefined`.
363
+ */
364
+ function detectHost(env = process.env) {
365
+ for (const name of [
366
+ "VITEHUB_HOST",
367
+ "NITRO_PRESET",
368
+ "SERVER_PRESET"
369
+ ]) {
370
+ const host = hostFromNitroPreset(env[name]);
371
+ if (host) return host;
372
+ }
373
+ return providerHosts.find(([name]) => env[name]?.trim())?.[1];
374
+ }
375
+ // src/setup/status.ts
376
+ const addArgs = {
377
+ bun: {
378
+ dev: ["add", "-d"],
379
+ prod: ["add"]
380
+ },
381
+ npm: {
382
+ dev: ["install", "-D"],
383
+ prod: ["install"]
384
+ },
385
+ pnpm: {
386
+ dev: ["add", "-D"],
387
+ prod: ["add"]
388
+ },
389
+ yarn: {
390
+ dev: ["add", "-D"],
391
+ prod: ["add"]
392
+ }
393
+ };
394
+ /** Quotes `value` for a POSIX shell when it needs quotes. */
395
+ function shellQuote(value) {
396
+ return /^[\w@%+=:,./-]+$/u.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
397
+ }
398
+ /** The arguments of the `packageManager` command that installs `packages`, such as `["add", "-D", "drizzle-kit"]`. */
399
+ function installArgs(packageManager, packages, dev) {
400
+ return [...addArgs[packageManager][dev ? "dev" : "prod"], ...packages];
401
+ }
402
+ const removeArgs = {
403
+ bun: ["remove"],
404
+ npm: ["uninstall"],
405
+ pnpm: ["remove"],
406
+ yarn: ["remove"]
407
+ };
408
+ /** The arguments of the `packageManager` command that uninstalls `packages`, such as `["remove", "@vite-hub/queue"]`. */
409
+ function uninstallArgs(packageManager, packages) {
410
+ return [...removeArgs[packageManager], ...packages];
411
+ }
412
+ function formatInstallCommand(command, args) {
413
+ return [command, ...args].map(formatInstallArgument).join(" ");
414
+ }
415
+ function installCommand(packageManager, prod, dev) {
416
+ const commands = [...prod.length ? [formatInstallCommand(packageManager, installArgs(packageManager, prod, false))] : [], ...dev.length ? [formatInstallCommand(packageManager, installArgs(packageManager, dev, true))] : []];
417
+ return commands.length ? commands.join(" && ") : void 0;
418
+ }
419
+ function readHost(project, env) {
420
+ const config = project.config;
421
+ if (config && !config.ok && config.reason !== "no-vitehub") return {
422
+ name: "unknown",
423
+ source: "config"
424
+ };
425
+ const site = config?.ok ? config.site : void 0;
426
+ const host = site?.keys.host;
427
+ const fromConfig = host?.kind === "literal" && typeof host.value === "string" ? hostFromNitroPreset(host.value) : void 0;
428
+ if (fromConfig) return {
429
+ name: fromConfig,
430
+ source: "config"
431
+ };
432
+ if (host || site?.spread) return {
433
+ name: "unknown",
434
+ source: "config"
435
+ };
436
+ const fromEnv = detectHost(env);
437
+ return fromEnv ? {
438
+ name: fromEnv,
439
+ source: "env"
440
+ } : {
441
+ name: "node",
442
+ source: "default"
443
+ };
444
+ }
445
+ function readEnabled(project, id, withoutDefinitions) {
446
+ const config = project.config;
447
+ if (!config || !config.ok && config.reason === "no-vitehub") return {
448
+ enabled: "off",
449
+ reason: "default"
450
+ };
451
+ if (!config.ok) return {
452
+ enabled: "unknown",
453
+ reason: "config"
454
+ };
455
+ const value = config.site.keys[id];
456
+ if (value?.kind === "expression") return {
457
+ enabled: "unknown",
458
+ reason: "config"
459
+ };
460
+ if (value) return {
461
+ enabled: value.value === false ? "off" : "on",
462
+ reason: "config"
463
+ };
464
+ if (config.site.spread) return {
465
+ enabled: "unknown",
466
+ reason: "config"
467
+ };
468
+ if (features[id].enabledByDefault) return {
469
+ enabled: "on",
470
+ reason: "default"
471
+ };
472
+ if (withoutDefinitions?.has(id)) return {
473
+ enabled: "off",
474
+ reason: "default"
475
+ };
476
+ const discovery = features[id].enabledByDiscovery;
477
+ const viteRoot = id === "database" ? config.site.viteRoot : void 0;
478
+ const directories = viteRoot === false ? void 0 : viteRoot !== void 0 ? [resolve(project.root, viteRoot, "server")] : project.serverDirs ?? (project.framework === "nuxt" ? void 0 : [join(project.root, "server")]);
479
+ if (discovery && !directories) return {
480
+ enabled: "unknown",
481
+ reason: "default"
482
+ };
483
+ const hasDefinitions = id === "database" ? hasServerDatabaseDefinitions : hasDefinitionFiles;
484
+ return {
485
+ enabled: discovery?.some((file) => directories?.some((directory) => hasDefinitions(join(directory, file)))) ? "on" : "off",
486
+ reason: "default"
487
+ };
488
+ }
489
+ const kvDefaultStoreOption = "kv.stores.default.driver";
490
+ function kvStores(value) {
491
+ return isRecord(value) && isRecord(value.stores) ? value.stores : void 0;
492
+ }
493
+ function missingProviderOption(project, option, value) {
494
+ const [id, key] = option.split(".");
495
+ const configured = project.config?.ok ? project.config.site.keys[id] : void 0;
496
+ if (configured?.kind === "expression") return;
497
+ const options = value ?? configured?.value;
498
+ const stores = option === "kv.driver" ? kvStores(options) : void 0;
499
+ if (stores) {
500
+ const store = stores.default;
501
+ const driver = isRecord(store) ? store.driver : void 0;
502
+ if (driver !== "upstash" && driver !== "redis" && driver !== "database") return kvDefaultStoreOption;
503
+ return;
504
+ }
505
+ if (!isRecord(options) || !(key in options)) return option;
506
+ }
507
+ function rateLimitUsesVercelKV(host, value) {
508
+ const driver = isRecord(value) ? value.driver : void 0;
509
+ return host === "vercel" && (driver === void 0 || driver === "auto" || driver === "kv");
510
+ }
511
+ function vercelKVPackages(value) {
512
+ const options = isRecord(value) && (value.driver !== void 0 || value.stores !== void 0) ? value : { driver: "upstash" };
513
+ return featurePackages("kv", options, "vercel");
514
+ }
515
+ function setupFeaturePackages(id, valueOf, host, enabled) {
516
+ const value = valueOf(id);
517
+ if (id === "kv" && host === "vercel" && value !== false) return vercelKVPackages(value);
518
+ const packages = featurePackages(id, value, host, enabled);
519
+ if (id !== "rateLimit" || !rateLimitUsesVercelKV(host, value)) return packages;
520
+ const kv = valueOf("kv");
521
+ return kv === false ? packages : [.../* @__PURE__ */ new Set([...packages, ...vercelKVPackages(kv)])];
522
+ }
523
+ function featureFix(project, id, support, host, missing, providerChosen) {
524
+ const install = installCommand(project.packageManager, missing.prod.map(installSpecifier), missing.dev.map(installSpecifier));
525
+ if (install) return install;
526
+ if (support.level === "unsupported") return `Set \`${id}: false\`, or build for another host than ${host}.`;
527
+ if (support.level === "explicit" && !providerChosen) {
528
+ const option = missingProviderOption(project, support.option);
529
+ if (option) return `Set \`${option}\` in vitehub() to choose a provider on ${host}.`;
530
+ }
531
+ }
532
+ /** What the project enables, on which host, and what each enabled feature still needs. Reads the config without running it. */
533
+ function setupStatus(project, env, withoutDefinitions) {
534
+ const host = readHost(project, env);
535
+ const enabled = new Map(featureIds.map((id) => [id, readEnabled(project, id, withoutDefinitions)]));
536
+ const on = featureIds.filter((id) => enabled.get(id).enabled === "on");
537
+ const keep = featureIds.filter((id) => enabled.get(id).enabled !== "on" && enabled.get(id).reason === "config");
538
+ const maybeOn = featureIds.filter((id) => enabled.get(id).enabled !== "off");
539
+ const disabled = keep.filter((id) => enabled.get(id).enabled === "off");
540
+ const definite = impliedFeatures(on, keep);
541
+ for (const id of impliedFeatures(maybeOn, disabled)) {
542
+ const state = enabled.get(id);
543
+ if (state.enabled === "off" && state.reason === "default") enabled.set(id, {
544
+ enabled: definite.includes(id) ? "on" : "unknown",
545
+ reason: "implied"
546
+ });
547
+ }
548
+ const config = !project.config ? { manual: "no-vitehub" } : project.config.ok ? {
549
+ file: project.configFile,
550
+ form: project.config.site.form
551
+ } : {
552
+ file: project.configFile,
553
+ manual: project.config.reason,
554
+ ...project.config.line === void 0 ? {} : { line: project.config.line }
555
+ };
556
+ const literalValue = (id) => {
557
+ const value = project.config?.ok ? project.config.site.keys[id] : void 0;
558
+ return value?.kind === "literal" ? value.value : void 0;
559
+ };
560
+ return {
561
+ config,
562
+ features: featureIds.map((id) => {
563
+ const state = enabled.get(id);
564
+ const support = host.name === "unknown" ? {
565
+ level: "unknown",
566
+ detail: "The config does not statically identify the deployment host."
567
+ } : featureSupport(id, host.name);
568
+ const definition = features[id];
569
+ const literal = literalValue(id);
570
+ const packages = setupFeaturePackages(id, literalValue, host.name, featureIds.filter((feature) => enabled.get(feature)?.enabled === "on"));
571
+ const missing = state.enabled === "on" ? {
572
+ dev: definition.devPackages.filter((name) => !project.installed(name)),
573
+ prod: packages.filter((name) => !project.installed(name))
574
+ } : {
575
+ dev: [],
576
+ prod: []
577
+ };
578
+ const providerChosen = id === "workflow" && host.name !== "netlify" && packages.includes("openworkflow");
579
+ const fix = state.enabled === "on" ? featureFix(project, id, support, host.name, missing, providerChosen) : void 0;
580
+ const resolvedSupport = support.level === "explicit" && support.option === "kv.driver" && kvStores(literal) ? {
581
+ ...support,
582
+ option: kvDefaultStoreOption
583
+ } : support;
584
+ return {
585
+ id,
586
+ ...state,
587
+ missingPackages: [...missing.prod, ...missing.dev],
588
+ support: resolvedSupport,
589
+ ...fix ? { fix } : {}
590
+ };
591
+ }),
592
+ framework: project.framework,
593
+ host,
594
+ packageManager: project.packageManager,
595
+ root: project.root,
596
+ schemaVersion: 1
597
+ };
598
+ }
599
+ export { rateLimitUsesVercelKV as a, shellQuote as c, resolveDeploymentPlan as d, hasDefinitionFiles as f, missingProviderOption as i, uninstallArgs as l, installArgs as n, setupFeaturePackages as o, listMatchingFiles as p, installCommand as r, setupStatus as s, formatInstallCommand as t, hostFromNitroPreset as u };