@vite-hub/cli 0.5.0 → 0.5.1
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/dist/{commands-W0ijB5R6.js → commands-C003KqWY.js} +40 -34
- package/dist/{console-auth-Dz9HHP2G.js → console-auth-CpOpbA7U.js} +3 -4
- package/dist/{console-env--3nqqpCV.js → console-env-CsBruJnE.js} +4 -5
- package/dist/{deploy-CHW75le_.js → deploy-BZ2iQjZL.js} +10 -19
- package/dist/{env-MtXhP7A7.js → env-DRI0QH4-.js} +927 -354
- package/dist/{envelope-C7e408hm.js → envelope-DbplCDko.js} +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +13 -21
- package/dist/{provision-DgT_lpyn.js → provision-DlknnTAt.js} +191 -201
- package/dist/{provision-bhi-xnCG.d.ts → provision-kiD8Emd7.d.ts} +0 -8
- package/dist/{rolldown-runtime-8H4AJuhK.js → rolldown-runtime-BJohB4LM.js} +1 -2
- package/dist/setup/index.d.ts +3 -54
- package/dist/setup/index.js +7 -8
- package/package.json +12 -12
|
@@ -10,17 +10,7 @@ import "node:url";
|
|
|
10
10
|
import { tmpdir } from "node:os";
|
|
11
11
|
import { createBirpc } from "birpc";
|
|
12
12
|
import { formatRuntimeDiagnosticError } from "@vite-hub/runtime";
|
|
13
|
-
|
|
14
|
-
/** A non-null object that is not an array. Functions do not pass. */
|
|
15
|
-
function isRecord(value) {
|
|
16
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
-
}
|
|
18
|
-
/** A non-null object or a function that is not an array. */
|
|
19
|
-
function isRecordOrFunction(value) {
|
|
20
|
-
return Object(value) === value && !Array.isArray(value);
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region ../internal/dist/error-diagnostics-B11Jh1zF.js
|
|
13
|
+
// ../internal/dist/error-diagnostics-B5oT1e3D.js
|
|
24
14
|
const dynamicError$1 = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
25
15
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
26
16
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -277,6 +267,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
277
267
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
278
268
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
279
269
|
},
|
|
270
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
271
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
272
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
273
|
+
},
|
|
280
274
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
281
275
|
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
282
276
|
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
@@ -291,8 +285,16 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
291
285
|
}
|
|
292
286
|
}
|
|
293
287
|
});
|
|
294
|
-
|
|
295
|
-
|
|
288
|
+
// ../internal/dist/object.js
|
|
289
|
+
/** A non-null object that is not an array. Functions do not pass. */
|
|
290
|
+
function isRecord(value) {
|
|
291
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
292
|
+
}
|
|
293
|
+
/** A non-null object or a function that is not an array. */
|
|
294
|
+
function isRecordOrFunction(value) {
|
|
295
|
+
return Object(value) === value && !Array.isArray(value);
|
|
296
|
+
}
|
|
297
|
+
// ../internal/dist/cli.js
|
|
296
298
|
/** Validate an explicit `--url` before sending a Console request. The caller adds the RPC path. */
|
|
297
299
|
function appUrlError(url) {
|
|
298
300
|
let base;
|
|
@@ -473,8 +475,7 @@ function findViteHubDevServerUrl(roots, env) {
|
|
|
473
475
|
}
|
|
474
476
|
return env["VITEHUB_DEV_SERVER_URL"] || void 0;
|
|
475
477
|
}
|
|
476
|
-
|
|
477
|
-
//#region ../internal/dist/invariant.js
|
|
478
|
+
// ../internal/dist/invariant.js
|
|
478
479
|
const invariantDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
479
480
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
480
481
|
codes: { INTERNAL_INVARIANT_FAILED: {
|
|
@@ -493,8 +494,7 @@ function invariantError(what) {
|
|
|
493
494
|
function invariant(condition, what) {
|
|
494
495
|
if (!condition) throw invariantError(what);
|
|
495
496
|
}
|
|
496
|
-
|
|
497
|
-
//#region ../internal/dist/features.js
|
|
497
|
+
// ../internal/dist/features.js
|
|
498
498
|
/**
|
|
499
499
|
* The feature keys of `vitehub({...})`. `vitehub add <feature>` and `vitehub status` read this list before the owner
|
|
500
500
|
* package of a feature is installed, so the catalog is plain data with no owner imports.
|
|
@@ -817,7 +817,7 @@ ${name === "default" ? "" : ` name: ${JSON.stringify(name)},\n`} schema: {
|
|
|
817
817
|
}),
|
|
818
818
|
i18n: feature({
|
|
819
819
|
docs: "/docs/i18n",
|
|
820
|
-
hosts: everywhere("nitro", "Nitro 3", "Requires Nitro 3 with request async context
|
|
820
|
+
hosts: everywhere("nitro", "Nitro 3", "Requires Nitro 3 with request async context: Nuxt 4.7 or newer with the nitro package, Nuxt 5, or Vite with Nitro 3. On Nuxt 4, use i18n without i18n.workspace. Nitro 2 and Nuxt before 4.7 are unsupported."),
|
|
821
821
|
id: "i18n",
|
|
822
822
|
packages: ["@vite-hub/i18n"],
|
|
823
823
|
requiredOptions: [{
|
|
@@ -1076,13 +1076,13 @@ const vercelProviderPackages = {
|
|
|
1076
1076
|
queue: ["@vercel/queue", "@vercel/functions"],
|
|
1077
1077
|
workflow: ["@vercel/functions"]
|
|
1078
1078
|
};
|
|
1079
|
-
const drizzleRange = "1.0.0-rc.5 || ^1.0.0";
|
|
1079
|
+
const drizzleRange = "1.0.0-rc.5 || 1.0.0-rc.6 || ^1.0.0";
|
|
1080
1080
|
const installRanges = {
|
|
1081
1081
|
"drizzle-kit": drizzleRange,
|
|
1082
1082
|
"drizzle-orm": drizzleRange
|
|
1083
1083
|
};
|
|
1084
1084
|
/**
|
|
1085
|
-
* The package manager argument that installs `name`, such as `drizzle-orm@1.0.0-rc.5 || ^1.0.0`. Drizzle tags 0.x as
|
|
1085
|
+
* The package manager argument that installs `name`, such as `drizzle-orm@1.0.0-rc.5 || 1.0.0-rc.6 || ^1.0.0`. Drizzle tags 0.x as
|
|
1086
1086
|
* `latest` and the next 1.0 candidate as `rc`, so a plain name installs a version that ViteHub cannot import. npm saves
|
|
1087
1087
|
* the range as written, and an exact version would be saved as `^1.0.0-rc.5`, which also matches later candidates.
|
|
1088
1088
|
* Other packages keep their name. Feature catalogs, status, and removal use the plain name.
|
|
@@ -1129,8 +1129,159 @@ function impliedFeatures(enabled, disabled = []) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
return implied;
|
|
1131
1131
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1132
|
+
// ../internal/dist/vite-CELQZdD3.js
|
|
1133
|
+
const projectRootDirectoryMarkers = [
|
|
1134
|
+
["server", "agents"],
|
|
1135
|
+
["server", "channels"],
|
|
1136
|
+
["server", "connections"],
|
|
1137
|
+
["server", "browsers"],
|
|
1138
|
+
["server", "emails"],
|
|
1139
|
+
["server", "schedules"],
|
|
1140
|
+
["server", "workspaces"]
|
|
1141
|
+
];
|
|
1142
|
+
const projectRootFileMarkers = [
|
|
1143
|
+
["package.json"],
|
|
1144
|
+
["nuxt.config.ts"],
|
|
1145
|
+
["nuxt.config.mts"],
|
|
1146
|
+
["nuxt.config.js"],
|
|
1147
|
+
["nuxt.config.mjs"]
|
|
1148
|
+
];
|
|
1149
|
+
function resolveViteHubProjectRoot(root, options = {}) {
|
|
1150
|
+
const resolvedRoot = resolve$1(root);
|
|
1151
|
+
const temporaryRoot = resolve$1(tmpdir());
|
|
1152
|
+
const sharedTemporaryRoot = dirname$1(temporaryRoot) === parse(temporaryRoot).root ? temporaryRoot : void 0;
|
|
1153
|
+
if (options.projectRoot) return resolve$1(resolvedRoot, options.projectRoot);
|
|
1154
|
+
if (basename$1(resolvedRoot) === "app") {
|
|
1155
|
+
const parent = dirname$1(resolvedRoot);
|
|
1156
|
+
if (parent !== sharedTemporaryRoot && (hasProjectRootDirectoryMarker(parent) || hasProjectRootFileMarker(parent, [
|
|
1157
|
+
"nuxt.config.ts",
|
|
1158
|
+
"nuxt.config.mts",
|
|
1159
|
+
"nuxt.config.js",
|
|
1160
|
+
"nuxt.config.mjs"
|
|
1161
|
+
]))) return parent;
|
|
1162
|
+
}
|
|
1163
|
+
let current = resolvedRoot;
|
|
1164
|
+
while (true) {
|
|
1165
|
+
if (current === sharedTemporaryRoot && resolvedRoot !== current) return resolvedRoot;
|
|
1166
|
+
if (hasProjectRootMarker(current)) return current;
|
|
1167
|
+
const parent = dirname$1(current);
|
|
1168
|
+
if (parent === current) return resolvedRoot;
|
|
1169
|
+
current = parent;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
function hasProjectRootDirectoryMarker(root) {
|
|
1173
|
+
for (const marker of projectRootDirectoryMarkers) try {
|
|
1174
|
+
if (statSync(resolve$1(root, ...marker)).isDirectory()) return true;
|
|
1175
|
+
} catch (error) {
|
|
1176
|
+
if (!isMissingProjectMarker(error)) throw error;
|
|
1177
|
+
}
|
|
1178
|
+
return false;
|
|
1179
|
+
}
|
|
1180
|
+
function hasProjectRootMarker(root) {
|
|
1181
|
+
if (hasProjectRootDirectoryMarker(root)) return true;
|
|
1182
|
+
return hasProjectRootFileMarker(root, projectRootFileMarkers.flat());
|
|
1183
|
+
}
|
|
1184
|
+
function hasProjectRootFileMarker(root, markers) {
|
|
1185
|
+
for (const marker of markers) {
|
|
1186
|
+
const path = Array.isArray(marker) ? marker : [marker];
|
|
1187
|
+
try {
|
|
1188
|
+
if (statSync(resolve$1(root, ...path)).isFile()) return true;
|
|
1189
|
+
} catch (error) {
|
|
1190
|
+
if (!isMissingProjectMarker(error)) throw error;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return false;
|
|
1194
|
+
}
|
|
1195
|
+
function isMissingProjectMarker(error) {
|
|
1196
|
+
const code = error.code;
|
|
1197
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
1198
|
+
}
|
|
1199
|
+
// ../internal/dist/operation-rpc.js
|
|
1200
|
+
/** Path of the operation RPC under the app. Dev servers and deployed apps serve it the same way, one birpc call per POST. */
|
|
1201
|
+
const operationRpcPath = "/_vitehub/rpc";
|
|
1202
|
+
function text(value) {
|
|
1203
|
+
return String(value) === value && value ? value : void 0;
|
|
1204
|
+
}
|
|
1205
|
+
/** Read an untrusted failure body. It keeps only the diagnostic fields, so a stack never passes through. */
|
|
1206
|
+
function readOperationRpcError(value) {
|
|
1207
|
+
if (!isRecord(value)) return void 0;
|
|
1208
|
+
const code = text(value.code);
|
|
1209
|
+
const message = text(value.message);
|
|
1210
|
+
const status = value.status;
|
|
1211
|
+
if (!code || !message || !Number.isInteger(status)) return void 0;
|
|
1212
|
+
const failure = {
|
|
1213
|
+
code,
|
|
1214
|
+
message,
|
|
1215
|
+
status: Number(status)
|
|
1216
|
+
};
|
|
1217
|
+
if (text(value.fix)) failure.fix = text(value.fix);
|
|
1218
|
+
if (text(value.docs)) failure.docs = text(value.docs);
|
|
1219
|
+
if (isRecord(value.details)) failure.details = value.details;
|
|
1220
|
+
return failure;
|
|
1221
|
+
}
|
|
1222
|
+
/** Read one response message. */
|
|
1223
|
+
function readOperationRpcReply(value) {
|
|
1224
|
+
if (!isRecord(value) || value.t !== "s") return void 0;
|
|
1225
|
+
const id = text(value.i);
|
|
1226
|
+
if (Object.hasOwn(value, "e")) {
|
|
1227
|
+
const error = readOperationRpcError(value.e);
|
|
1228
|
+
return error ? {
|
|
1229
|
+
t: "s",
|
|
1230
|
+
...id ? { i: id } : {},
|
|
1231
|
+
e: error
|
|
1232
|
+
} : void 0;
|
|
1233
|
+
}
|
|
1234
|
+
return id ? {
|
|
1235
|
+
t: "s",
|
|
1236
|
+
i: id,
|
|
1237
|
+
r: value.r
|
|
1238
|
+
} : void 0;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Call one operation with birpc over a request and answer transport, such as one HTTP POST per call. `send` posts the
|
|
1242
|
+
* JSON message and returns the parsed answer; its own failures, such as a network error or an abort, reject.
|
|
1243
|
+
*/
|
|
1244
|
+
async function callOperationRpc(name, input, send) {
|
|
1245
|
+
let receive;
|
|
1246
|
+
let answer;
|
|
1247
|
+
const notReply = /* @__PURE__ */ new Error("The answer is not a reply to the operation call.");
|
|
1248
|
+
const rpc = createBirpc({}, {
|
|
1249
|
+
on: (listener) => {
|
|
1250
|
+
receive = listener;
|
|
1251
|
+
},
|
|
1252
|
+
post: async (message) => {
|
|
1253
|
+
answer = await send(JSON.stringify(message));
|
|
1254
|
+
const reply = readOperationRpcReply(answer.body);
|
|
1255
|
+
if (!reply || reply.i !== void 0 && reply.i !== message.i) throw notReply;
|
|
1256
|
+
await receive({
|
|
1257
|
+
...reply,
|
|
1258
|
+
i: message.i
|
|
1259
|
+
});
|
|
1260
|
+
},
|
|
1261
|
+
proxify: false,
|
|
1262
|
+
timeout: -1
|
|
1263
|
+
});
|
|
1264
|
+
try {
|
|
1265
|
+
return {
|
|
1266
|
+
ok: true,
|
|
1267
|
+
value: await rpc.$call(name, ...input === void 0 ? [] : [input]),
|
|
1268
|
+
answer
|
|
1269
|
+
};
|
|
1270
|
+
} catch (error) {
|
|
1271
|
+
if (!answer) throw error;
|
|
1272
|
+
if (error === notReply) return {
|
|
1273
|
+
ok: false,
|
|
1274
|
+
error: void 0,
|
|
1275
|
+
answer
|
|
1276
|
+
};
|
|
1277
|
+
return {
|
|
1278
|
+
ok: false,
|
|
1279
|
+
error: readOperationRpcError(error),
|
|
1280
|
+
answer
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
// ../internal/dist/console-signature.js
|
|
1134
1285
|
/**
|
|
1135
1286
|
* Signed requests to the Console endpoint of an app, `POST /_vitehub/rpc`. Each caller, such as one Console link or one
|
|
1136
1287
|
* CI job, has an Ed25519 key pair. The app keeps only the public keys, in `VITEHUB_CONSOLE_KEY_<NAME>`, so a copy of
|
|
@@ -1259,76 +1410,7 @@ function readConsoleSigningKey(env) {
|
|
|
1259
1410
|
privateKey
|
|
1260
1411
|
};
|
|
1261
1412
|
}
|
|
1262
|
-
|
|
1263
|
-
//#region ../internal/dist/vite-DGZFNpcx.js
|
|
1264
|
-
const projectRootDirectoryMarkers = [
|
|
1265
|
-
["server", "agents"],
|
|
1266
|
-
["server", "channels"],
|
|
1267
|
-
["server", "connections"],
|
|
1268
|
-
["server", "browsers"],
|
|
1269
|
-
["server", "emails"],
|
|
1270
|
-
["server", "schedules"],
|
|
1271
|
-
["server", "workspaces"]
|
|
1272
|
-
];
|
|
1273
|
-
const projectRootFileMarkers = [
|
|
1274
|
-
["package.json"],
|
|
1275
|
-
["nuxt.config.ts"],
|
|
1276
|
-
["nuxt.config.mts"],
|
|
1277
|
-
["nuxt.config.js"],
|
|
1278
|
-
["nuxt.config.mjs"]
|
|
1279
|
-
];
|
|
1280
|
-
function resolveViteHubProjectRoot(root, options = {}) {
|
|
1281
|
-
const resolvedRoot = resolve$1(root);
|
|
1282
|
-
const temporaryRoot = resolve$1(tmpdir());
|
|
1283
|
-
const sharedTemporaryRoot = dirname$1(temporaryRoot) === parse(temporaryRoot).root ? temporaryRoot : void 0;
|
|
1284
|
-
if (options.projectRoot) return resolve$1(resolvedRoot, options.projectRoot);
|
|
1285
|
-
if (basename$1(resolvedRoot) === "app") {
|
|
1286
|
-
const parent = dirname$1(resolvedRoot);
|
|
1287
|
-
if (parent !== sharedTemporaryRoot && (hasProjectRootDirectoryMarker(parent) || hasProjectRootFileMarker(parent, [
|
|
1288
|
-
"nuxt.config.ts",
|
|
1289
|
-
"nuxt.config.mts",
|
|
1290
|
-
"nuxt.config.js",
|
|
1291
|
-
"nuxt.config.mjs"
|
|
1292
|
-
]))) return parent;
|
|
1293
|
-
}
|
|
1294
|
-
let current = resolvedRoot;
|
|
1295
|
-
while (true) {
|
|
1296
|
-
if (current === sharedTemporaryRoot && resolvedRoot !== current) return resolvedRoot;
|
|
1297
|
-
if (hasProjectRootMarker(current)) return current;
|
|
1298
|
-
const parent = dirname$1(current);
|
|
1299
|
-
if (parent === current) return resolvedRoot;
|
|
1300
|
-
current = parent;
|
|
1301
|
-
}
|
|
1302
|
-
}
|
|
1303
|
-
function hasProjectRootDirectoryMarker(root) {
|
|
1304
|
-
for (const marker of projectRootDirectoryMarkers) try {
|
|
1305
|
-
if (statSync(resolve$1(root, ...marker)).isDirectory()) return true;
|
|
1306
|
-
} catch (error) {
|
|
1307
|
-
if (!isMissingProjectMarker(error)) throw error;
|
|
1308
|
-
}
|
|
1309
|
-
return false;
|
|
1310
|
-
}
|
|
1311
|
-
function hasProjectRootMarker(root) {
|
|
1312
|
-
if (hasProjectRootDirectoryMarker(root)) return true;
|
|
1313
|
-
return hasProjectRootFileMarker(root, projectRootFileMarkers.flat());
|
|
1314
|
-
}
|
|
1315
|
-
function hasProjectRootFileMarker(root, markers) {
|
|
1316
|
-
for (const marker of markers) {
|
|
1317
|
-
const path = Array.isArray(marker) ? marker : [marker];
|
|
1318
|
-
try {
|
|
1319
|
-
if (statSync(resolve$1(root, ...path)).isFile()) return true;
|
|
1320
|
-
} catch (error) {
|
|
1321
|
-
if (!isMissingProjectMarker(error)) throw error;
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
return false;
|
|
1325
|
-
}
|
|
1326
|
-
function isMissingProjectMarker(error) {
|
|
1327
|
-
const code = error.code;
|
|
1328
|
-
return code === "ENOENT" || code === "ENOTDIR";
|
|
1329
|
-
}
|
|
1330
|
-
//#endregion
|
|
1331
|
-
//#region ../internal/dist/standard-schema.js
|
|
1413
|
+
// ../internal/dist/standard-schema.js
|
|
1332
1414
|
function readOwn(value, key) {
|
|
1333
1415
|
if (value === null || Object(value) !== value) return;
|
|
1334
1416
|
try {
|
|
@@ -1357,8 +1439,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
|
|
|
1357
1439
|
return;
|
|
1358
1440
|
}
|
|
1359
1441
|
}
|
|
1360
|
-
|
|
1361
|
-
//#region ../internal/dist/operation-definition.js
|
|
1442
|
+
// ../internal/dist/operation-definition.js
|
|
1362
1443
|
const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
|
|
1363
1444
|
const kinds = /* @__PURE__ */ new Set([
|
|
1364
1445
|
"read",
|
|
@@ -1427,94 +1508,7 @@ function isSectionId(section) {
|
|
|
1427
1508
|
function operationInputJsonSchema(operation) {
|
|
1428
1509
|
return standardJsonSchema(operation.input, "input") ?? { type: "object" };
|
|
1429
1510
|
}
|
|
1430
|
-
|
|
1431
|
-
//#region ../internal/dist/operation-rpc.js
|
|
1432
|
-
/** Path of the operation RPC under the app. Dev servers and deployed apps serve it the same way, one birpc call per POST. */
|
|
1433
|
-
const operationRpcPath = "/_vitehub/rpc";
|
|
1434
|
-
function text(value) {
|
|
1435
|
-
return String(value) === value && value ? value : void 0;
|
|
1436
|
-
}
|
|
1437
|
-
/** Read an untrusted failure body. It keeps only the diagnostic fields, so a stack never passes through. */
|
|
1438
|
-
function readOperationRpcError(value) {
|
|
1439
|
-
if (!isRecord(value)) return void 0;
|
|
1440
|
-
const code = text(value.code);
|
|
1441
|
-
const message = text(value.message);
|
|
1442
|
-
const status = value.status;
|
|
1443
|
-
if (!code || !message || !Number.isInteger(status)) return void 0;
|
|
1444
|
-
const failure = {
|
|
1445
|
-
code,
|
|
1446
|
-
message,
|
|
1447
|
-
status: Number(status)
|
|
1448
|
-
};
|
|
1449
|
-
if (text(value.fix)) failure.fix = text(value.fix);
|
|
1450
|
-
if (text(value.docs)) failure.docs = text(value.docs);
|
|
1451
|
-
if (isRecord(value.details)) failure.details = value.details;
|
|
1452
|
-
return failure;
|
|
1453
|
-
}
|
|
1454
|
-
/** Read one response message. */
|
|
1455
|
-
function readOperationRpcReply(value) {
|
|
1456
|
-
if (!isRecord(value) || value.t !== "s") return void 0;
|
|
1457
|
-
const id = text(value.i);
|
|
1458
|
-
if (Object.hasOwn(value, "e")) {
|
|
1459
|
-
const error = readOperationRpcError(value.e);
|
|
1460
|
-
return error ? {
|
|
1461
|
-
t: "s",
|
|
1462
|
-
...id ? { i: id } : {},
|
|
1463
|
-
e: error
|
|
1464
|
-
} : void 0;
|
|
1465
|
-
}
|
|
1466
|
-
return id ? {
|
|
1467
|
-
t: "s",
|
|
1468
|
-
i: id,
|
|
1469
|
-
r: value.r
|
|
1470
|
-
} : void 0;
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Call one operation with birpc over a request and answer transport, such as one HTTP POST per call. `send` posts the
|
|
1474
|
-
* JSON message and returns the parsed answer; its own failures, such as a network error or an abort, reject.
|
|
1475
|
-
*/
|
|
1476
|
-
async function callOperationRpc(name, input, send) {
|
|
1477
|
-
let receive;
|
|
1478
|
-
let answer;
|
|
1479
|
-
const notReply = /* @__PURE__ */ new Error("The answer is not a reply to the operation call.");
|
|
1480
|
-
const rpc = createBirpc({}, {
|
|
1481
|
-
on: (listener) => {
|
|
1482
|
-
receive = listener;
|
|
1483
|
-
},
|
|
1484
|
-
post: async (message) => {
|
|
1485
|
-
answer = await send(JSON.stringify(message));
|
|
1486
|
-
const reply = readOperationRpcReply(answer.body);
|
|
1487
|
-
if (!reply || reply.i !== void 0 && reply.i !== message.i) throw notReply;
|
|
1488
|
-
await receive({
|
|
1489
|
-
...reply,
|
|
1490
|
-
i: message.i
|
|
1491
|
-
});
|
|
1492
|
-
},
|
|
1493
|
-
proxify: false,
|
|
1494
|
-
timeout: -1
|
|
1495
|
-
});
|
|
1496
|
-
try {
|
|
1497
|
-
return {
|
|
1498
|
-
ok: true,
|
|
1499
|
-
value: await rpc.$call(name, ...input === void 0 ? [] : [input]),
|
|
1500
|
-
answer
|
|
1501
|
-
};
|
|
1502
|
-
} catch (error) {
|
|
1503
|
-
if (!answer) throw error;
|
|
1504
|
-
if (error === notReply) return {
|
|
1505
|
-
ok: false,
|
|
1506
|
-
error: void 0,
|
|
1507
|
-
answer
|
|
1508
|
-
};
|
|
1509
|
-
return {
|
|
1510
|
-
ok: false,
|
|
1511
|
-
error: readOperationRpcError(error),
|
|
1512
|
-
answer
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
}
|
|
1516
|
-
//#endregion
|
|
1517
|
-
//#region ../internal/dist/operations.js
|
|
1511
|
+
// ../internal/dist/operations.js
|
|
1518
1512
|
/** Header that proves the caller is not a browser page. A foreign page cannot send it without a CORS preflight. */
|
|
1519
1513
|
const operationRpcHeader = "x-vitehub-console";
|
|
1520
1514
|
/** Response header of the local dev RPC. Its value is {@link projectRootHash} of the project that the server runs. */
|
|
@@ -1811,8 +1805,7 @@ async function callOperationFromCli(call, name, input) {
|
|
|
1811
1805
|
url
|
|
1812
1806
|
}, name, input);
|
|
1813
1807
|
}
|
|
1814
|
-
|
|
1815
|
-
//#region ../internal/dist/vite-stage.js
|
|
1808
|
+
// ../internal/dist/vite-stage.js
|
|
1816
1809
|
/**
|
|
1817
1810
|
* Vite's `loadEnv(mode, envDir, "")`: every `.env` value of the mode and the whole shell. With `DEBUG=vite:env`, Vite
|
|
1818
1811
|
* logs that result to stderr, secrets included. loadEnv is synchronous, so this drops only the writes of this call.
|
|
@@ -1853,8 +1846,7 @@ async function withViteStageEnvironment(env, callback) {
|
|
|
1853
1846
|
release();
|
|
1854
1847
|
}
|
|
1855
1848
|
}
|
|
1856
|
-
|
|
1857
|
-
//#region ../internal/dist/provision-state.js
|
|
1849
|
+
// ../internal/dist/provision-state.js
|
|
1858
1850
|
const PROVISION_STATE_FILE = ".vitehub/provision.json";
|
|
1859
1851
|
function getProvisionStatePath(rootDir) {
|
|
1860
1852
|
return resolve(rootDir, PROVISION_STATE_FILE);
|
|
@@ -1935,8 +1927,7 @@ function sortKeys(value) {
|
|
|
1935
1927
|
if (!value || typeof value !== "object" || Array.isArray(value)) return value;
|
|
1936
1928
|
return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortKeys(value[key])]));
|
|
1937
1929
|
}
|
|
1938
|
-
|
|
1939
|
-
//#region src/error-diagnostics.ts
|
|
1930
|
+
// src/error-diagnostics.ts
|
|
1940
1931
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
1941
1932
|
const cliErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
1942
1933
|
docsBase: "https://vitehub.dev/docs/cli/diagnostics",
|
|
@@ -2097,9 +2088,13 @@ const cliErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
2097
2088
|
fix: "Use the app's current host, or migrate its enabled features, providers and Definitions in the config before running init again.",
|
|
2098
2089
|
why: ({ host }) => `init cannot change an enabled ViteHub stack to the ${String(host)} host.`
|
|
2099
2090
|
},
|
|
2091
|
+
SETUP_INIT_NITRO_VERSION: {
|
|
2092
|
+
fix: ({ dir, range, scaffolded }) => `${scaffolded ? `The scaffold files remain in ${String(dir)}. ` : ""}Set nitro to \`${String(range)}\` in each section of package.json that declares it, then run init again.`,
|
|
2093
|
+
why: ({ dir, range }) => `${String(dir)} declares a Nitro version that init cannot verify against Nuxt 4.7's requirement (${String(range)}). ViteHub did not adopt it.`
|
|
2094
|
+
},
|
|
2100
2095
|
SETUP_INIT_NUXT_VERSION: {
|
|
2101
|
-
fix: ({ dir, scaffolded }) => `${scaffolded ? `The scaffold files remain in ${String(dir)}. ` : ""}
|
|
2102
|
-
why: ({ dir }) => `${String(dir)} does not declare a
|
|
2096
|
+
fix: ({ dir, scaffolded }) => `${scaffolded ? `The scaffold files remain in ${String(dir)}. ` : ""}Upgrade to Nuxt 4.7 with Nitro 3 (\`pnpm add nuxt@^4.7.0 nitro\`), or set nuxt to a Nuxt 5 version. Then run init on that folder again.`,
|
|
2097
|
+
why: ({ dir }) => `${String(dir)} does not declare a supported Nuxt version. ViteHub needs Nitro 3, which runs on Nuxt 4.7 with the nitro package, or on Nuxt 5. ViteHub did not adopt it.`
|
|
2103
2098
|
},
|
|
2104
2099
|
SETUP_DEPLOY_HOST_UNSUPPORTED: {
|
|
2105
2100
|
fix: "Set `host` in vitehub() to cloudflare, vercel, netlify, or deno, or start the Node server from `.output` yourself.",
|
|
@@ -2247,8 +2242,7 @@ const cliErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
2247
2242
|
}
|
|
2248
2243
|
}
|
|
2249
2244
|
});
|
|
2250
|
-
|
|
2251
|
-
//#region ../internal/dist/host-credentials.js
|
|
2245
|
+
// ../internal/dist/host-credentials.js
|
|
2252
2246
|
const missingFixes = {
|
|
2253
2247
|
cloudflare: {
|
|
2254
2248
|
missing: ["CLOUDFLARE_API_TOKEN"],
|
|
@@ -2422,8 +2416,7 @@ function trimmed(value) {
|
|
|
2422
2416
|
const result = value?.trim();
|
|
2423
2417
|
return result ? result : void 0;
|
|
2424
2418
|
}
|
|
2425
|
-
|
|
2426
|
-
//#region ../internal/dist/provider-failure.js
|
|
2419
|
+
// ../internal/dist/provider-failure.js
|
|
2427
2420
|
const cloudflareCodes = {
|
|
2428
2421
|
d1: {},
|
|
2429
2422
|
kv: { 10014: "conflict" },
|
|
@@ -2525,8 +2518,7 @@ function readProviderErrorCodes(body) {
|
|
|
2525
2518
|
const errors = Reflect.get(body, "errors");
|
|
2526
2519
|
return [error && typeof error === "object" ? Reflect.get(error, "code") : void 0, ...Array.isArray(errors) ? errors.map((entry) => entry && typeof entry === "object" ? Reflect.get(entry, "code") : void 0) : []].filter((code) => typeof code === "number" && Number.isFinite(code) || typeof code === "string" && /^[\w.-]{1,128}$/.test(code));
|
|
2527
2520
|
}
|
|
2528
|
-
|
|
2529
|
-
//#region ../internal/dist/provision.js
|
|
2521
|
+
// ../internal/dist/provision.js
|
|
2530
2522
|
/** Plans one provider in step order and collects warnings and explicit unchecked state. */
|
|
2531
2523
|
async function planProvisionSteps(provider, steps, context) {
|
|
2532
2524
|
const warnings = [];
|
|
@@ -2663,8 +2655,7 @@ function createVercelProvisionClient(config, fetchImpl = globalThis.fetch) {
|
|
|
2663
2655
|
function createNetlifyApiClient(token, fetchImpl = globalThis.fetch) {
|
|
2664
2656
|
return createJsonClient(() => ({ host: "netlify" }), "https://api.netlify.com/api/v1", { authorization: `Bearer ${token}` }, fetchImpl);
|
|
2665
2657
|
}
|
|
2666
|
-
|
|
2667
|
-
//#region src/provision.ts
|
|
2658
|
+
// src/provision.ts
|
|
2668
2659
|
const PROVISION_HOSTS = ["cloudflare", "vercel"];
|
|
2669
2660
|
const HOST_CREDENTIALS = {
|
|
2670
2661
|
cloudflare: "CLOUDFLARE_ACCOUNT_ID and a Cloudflare login (`wrangler login` or CLOUDFLARE_API_TOKEN)",
|
|
@@ -2783,7 +2774,7 @@ async function resolveHost(command, parsed, context) {
|
|
|
2783
2774
|
let host = parsed.host;
|
|
2784
2775
|
let link;
|
|
2785
2776
|
if (host === void 0) {
|
|
2786
|
-
const { resolveDefaultDeployTarget } = await import("./deploy-
|
|
2777
|
+
const { resolveDefaultDeployTarget } = await import("./deploy-BZ2iQjZL.js").then((n) => n.n);
|
|
2787
2778
|
try {
|
|
2788
2779
|
const target = await resolveDefaultDeployTarget(resolveViteHubProjectRoot(context.rootDir), context.env, `vitehub provision ${command}`);
|
|
2789
2780
|
host = target.host;
|
|
@@ -3041,5 +3032,4 @@ function createProvisionNamespace(load) {
|
|
|
3041
3032
|
name: "provision"
|
|
3042
3033
|
};
|
|
3043
3034
|
}
|
|
3044
|
-
|
|
3045
|
-
export { isRecord as $, parseOperationInput as A, formatInstallArgument as B, callOperationFromCli as C, operationCliOptions as D, operationCall as E, featureHosts as F, appUrlError as G, installSpecifier as H, featureIds as I, findViteHubDevServerUrl as J, collectViteHubCliContribution as K, featurePackages as L, reservedOperationNamespaces as M, setupCommandNames as N, operationCliPath as O, resolveViteHubProjectRoot as P, internalErrorDiagnostics as Q, featureSupport as R, callOperation as S, createOperationRegistry as T, quoteSupportedInstallSpecifier as U, impliedFeatures as V, invariant as W, viteCliProjectConfig as X, getStableStdoutWrite as Y, withStdoutOnStderr as Z, readProvisionState as _, writeProvisionActions as a, loadAllEnv as b, createNetlifyApiClient as c, planProvisionSteps as d, resolveHostCredentials as f, mergeProvisionState as g, PROVISION_STATE_FILE as h, provisionEnv as i, operationInputJsonSchema as j, operationsOf as k, createVercelProvisionClient as l, cliErrorDiagnostics as m, isProvisionHost as n, createCloudflareApiClient as o, runHostCli as p, createCliDiscoveryNitroCloser as q, provisionActionStatus as r, createCloudflareProvisionClient as s, createProvisionNamespace as t, isProvisionRequestError as u, readProvisionStateSync as v, collectOperationContributions as w, withViteStageEnvironment as x, writeProvisionState as y, features as z };
|
|
3035
|
+
export { internalErrorDiagnostics as $, parseOperationInput as A, formatInstallArgument as B, callOperationFromCli as C, operationCliOptions as D, operationCall as E, featureHosts as F, appUrlError as G, installSpecifier as H, featureIds as I, findViteHubDevServerUrl as J, collectViteHubCliContribution as K, featurePackages as L, reservedOperationNamespaces as M, setupCommandNames as N, operationCliPath as O, resolveViteHubProjectRoot as P, isRecord as Q, featureSupport as R, callOperation as S, createOperationRegistry as T, quoteSupportedInstallSpecifier as U, impliedFeatures as V, invariant as W, viteCliProjectConfig as X, getStableStdoutWrite as Y, withStdoutOnStderr as Z, readProvisionState as _, writeProvisionActions as a, loadAllEnv as b, createNetlifyApiClient as c, planProvisionSteps as d, resolveHostCredentials as f, mergeProvisionState as g, PROVISION_STATE_FILE as h, provisionEnv as i, operationInputJsonSchema as j, operationsOf as k, createVercelProvisionClient as l, cliErrorDiagnostics as m, isProvisionHost as n, createCloudflareApiClient as o, runHostCli as p, createCliDiscoveryNitroCloser as q, provisionActionStatus as r, createCloudflareProvisionClient as s, createProvisionNamespace as t, isProvisionRequestError as u, readProvisionStateSync as v, collectOperationContributions as w, withViteStageEnvironment as x, writeProvisionState as y, features as z };
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import "nostics";
|
|
2
|
-
//#region ../internal/dist/host-credentials-NQkTpoab.d.ts
|
|
3
|
-
//#region src/host-credentials.d.ts
|
|
4
2
|
type CredentialHost = "cloudflare" | "vercel" | "netlify" | "deno";
|
|
5
3
|
type CredentialSource = "env" | "host-cli";
|
|
6
4
|
type HostCredentials = {
|
|
@@ -40,9 +38,6 @@ type HostCliRun = (command: string, args: readonly string[], options: {
|
|
|
40
38
|
env: NodeJS.ProcessEnv;
|
|
41
39
|
signal?: AbortSignal;
|
|
42
40
|
}) => Promise<HostCliRunResult>;
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region ../internal/dist/provision-k67k9T1h.d.ts
|
|
45
|
-
//#region src/provision.d.ts
|
|
46
41
|
type ProvisionProvider = "cloudflare" | "vercel";
|
|
47
42
|
interface ProvisionLogger {
|
|
48
43
|
log: (message: string) => void;
|
|
@@ -94,8 +89,6 @@ interface ProvisionStep {
|
|
|
94
89
|
/** Describes the Provision State this step records. Runs without network access, also without credentials. */
|
|
95
90
|
recordedState?: (context: Pick<ProvisionContext, "env">) => ProvisionStateCategory[];
|
|
96
91
|
}
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region ../internal/dist/cli.d.ts
|
|
99
92
|
interface ViteHubCliStreams {
|
|
100
93
|
stderr: {
|
|
101
94
|
write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
|
|
@@ -166,5 +159,4 @@ interface ViteHubCliCommandNamespace {
|
|
|
166
159
|
name: string;
|
|
167
160
|
}
|
|
168
161
|
type StdoutWriteCallback = (error?: Error | null) => void;
|
|
169
|
-
//#endregion
|
|
170
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __exportAll = (all, no_symbols) => {
|
|
5
5
|
let target = {};
|
|
@@ -10,5 +10,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
10
10
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
11
11
|
return target;
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { __exportAll as t };
|