@nuxt/cli-nightly 3.30.1-20251104-163602-2b2b434 → 3.30.1-20251104-170129-78f27f8

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.
@@ -2,7 +2,7 @@ import "./_shared-C3vB2YLc.mjs";
2
2
  import "./logger-Dk0gkCkX.mjs";
3
3
  import "./kit-f7zsnm10.mjs";
4
4
  import "./fs--ofMleGo.mjs";
5
- import { t as add_default } from "./add-kZRi0oTW.mjs";
5
+ import { t as add_default } from "./add-yCkF7lke.mjs";
6
6
  import "./versions-CSy_3o_-.mjs";
7
7
  import "./prepare-DjR-jyiQ.mjs";
8
8
  import "./_utils-DTrPahho.mjs";
@@ -16,6 +16,7 @@ import { satisfies } from "semver";
16
16
  import { homedir } from "node:os";
17
17
  import { addDependency, detectPackageManager } from "nypm";
18
18
  import { readPackageJSON } from "pkg-types";
19
+ import { confirm, isCancel, select } from "@clack/prompts";
19
20
  import { $fetch } from "ofetch";
20
21
  import { updateConfig } from "c12/update";
21
22
 
@@ -95,11 +96,11 @@ var add_default = defineCommand({
95
96
  const projectPkg = await readPackageJSON(cwd).catch(() => ({}));
96
97
  if (!projectPkg.dependencies?.nuxt && !projectPkg.devDependencies?.nuxt) {
97
98
  logger.warn(`No \`nuxt\` dependency detected in \`${cwd}\`.`);
98
- if (await logger.prompt(`Do you want to continue anyway?`, {
99
- type: "confirm",
100
- initial: false,
101
- cancel: "default"
102
- }) !== true) process.exit(1);
99
+ const shouldContinue = await confirm({
100
+ message: `Do you want to continue anyway?`,
101
+ initialValue: false
102
+ });
103
+ if (isCancel(shouldContinue) || shouldContinue !== true) process.exit(1);
103
104
  }
104
105
  const resolvedModules = (await Promise.all(modules.map((moduleName) => resolveModule(moduleName, cwd)))).filter((x) => x != null);
105
106
  logger.info(`Resolved \`${resolvedModules.map((x) => x.pkgName).join("`, `")}\`, adding module${resolvedModules.length > 1 ? "s" : ""}...`);
@@ -135,15 +136,14 @@ async function addModules(modules, { skipInstall, skipConfig, cwd, dev }, projec
135
136
  installPeerDependencies: true,
136
137
  packageManager,
137
138
  workspace: packageManager?.name === "pnpm" && existsSync(resolve$1(cwd, "pnpm-workspace.yaml"))
138
- }).then(() => true).catch((error) => {
139
+ }).then(() => true).catch(async (error) => {
139
140
  logger.error(error);
140
- const failedModulesList = notInstalledModules.map((module) => colors.cyan(module.pkg)).join("`, `");
141
- const s = notInstalledModules.length > 1 ? "s" : "";
142
- return logger.prompt(`Install failed for \`${failedModulesList}\`. Do you want to continue adding the module${s} to ${colors.cyan("nuxt.config")}?`, {
143
- type: "confirm",
144
- initial: false,
145
- cancel: "default"
141
+ const result = await confirm({
142
+ message: `Install failed for \`${notInstalledModules.map((module) => colors.cyan(module.pkg)).join("`, `")}\`. Do you want to continue adding the module${notInstalledModules.length > 1 ? "s" : ""} to ${colors.cyan("nuxt.config")}?`,
143
+ initialValue: false
146
144
  });
145
+ if (isCancel(result)) return false;
146
+ return result;
147
147
  }) !== true) return;
148
148
  }
149
149
  }
@@ -201,11 +201,11 @@ async function resolveModule(moduleName, cwd) {
201
201
  const nuxtVersion = await getNuxtVersion(cwd);
202
202
  if (!checkNuxtCompatibility(matchedModule, nuxtVersion)) {
203
203
  logger.warn(`The module \`${pkgName}\` is not compatible with Nuxt \`${nuxtVersion}\` (requires \`${matchedModule.compatibility.nuxt}\`)`);
204
- if (!await logger.prompt("Do you want to continue installing incompatible version?", {
205
- type: "confirm",
206
- initial: false,
207
- cancel: "default"
208
- })) return false;
204
+ const shouldContinue = await confirm({
205
+ message: "Do you want to continue installing incompatible version?",
206
+ initialValue: false
207
+ });
208
+ if (isCancel(shouldContinue) || !shouldContinue) return false;
209
209
  }
210
210
  const versionMap = matchedModule.compatibility.versionMap;
211
211
  if (versionMap) {
@@ -213,12 +213,18 @@ async function resolveModule(moduleName, cwd) {
213
213
  if (!pkgVersion) pkgVersion = _moduleVersion;
214
214
  else {
215
215
  logger.warn(`Recommended version of \`${pkgName}\` for Nuxt \`${nuxtVersion}\` is \`${_moduleVersion}\` but you have requested \`${pkgVersion}\``);
216
- pkgVersion = await logger.prompt("Choose a version:", {
217
- type: "select",
218
- options: [_moduleVersion, pkgVersion],
219
- cancel: "undefined"
216
+ const result = await select({
217
+ message: "Choose a version:",
218
+ options: [{
219
+ value: _moduleVersion,
220
+ label: _moduleVersion
221
+ }, {
222
+ value: pkgVersion,
223
+ label: pkgVersion
224
+ }]
220
225
  });
221
- if (!pkgVersion) return false;
226
+ if (isCancel(result)) return false;
227
+ pkgVersion = result;
222
228
  }
223
229
  break;
224
230
  }
@@ -235,11 +241,11 @@ async function resolveModule(moduleName, cwd) {
235
241
  const pkgDependencies = Object.assign(pkg.dependencies || {}, pkg.devDependencies || {});
236
242
  if (!pkgDependencies.nuxt && !pkgDependencies["nuxt-edge"] && !pkgDependencies["@nuxt/kit"]) {
237
243
  logger.warn(`It seems that \`${pkgName}\` is not a Nuxt module.`);
238
- if (!await logger.prompt(`Do you want to continue installing ${colors.cyan(pkgName)} anyway?`, {
239
- type: "confirm",
240
- initial: false,
241
- cancel: "default"
242
- })) return false;
244
+ const shouldContinue = await confirm({
245
+ message: `Do you want to continue installing ${colors.cyan(pkgName)} anyway?`,
246
+ initialValue: false
247
+ });
248
+ if (isCancel(shouldContinue) || !shouldContinue) return false;
243
249
  }
244
250
  return {
245
251
  nuxtModule: matchedModule,
package/dist/index.mjs CHANGED
@@ -18,15 +18,15 @@ const commands = {
18
18
  dev: () => import("./dev-nr2jb3A5.mjs").then(_rDefault),
19
19
  devtools: () => import("./devtools-BLGzUSNU.mjs").then(_rDefault),
20
20
  generate: () => import("./generate-DZJF1Xf_.mjs").then(_rDefault),
21
- info: () => import("./info-CMr7aVDt.mjs").then(_rDefault),
22
- init: () => import("./init-C_HSHWzS.mjs").then(_rDefault),
23
- module: () => import("./module-DLtKXRxA.mjs").then(_rDefault),
21
+ info: () => import("./info-BSqWMt0L.mjs").then(_rDefault),
22
+ init: () => import("./init-DX0yoR1B.mjs").then(_rDefault),
23
+ module: () => import("./module-t-MDBA3Y.mjs").then(_rDefault),
24
24
  prepare: () => import("./prepare-ZByeo9vQ.mjs").then(_rDefault),
25
25
  preview: () => import("./preview-CgpLKg-X.mjs").then(_rDefault),
26
26
  start: () => import("./preview-CgpLKg-X.mjs").then(_rDefault),
27
27
  test: () => import("./test-CBt1emEB.mjs").then(_rDefault),
28
28
  typecheck: () => import("./typecheck-egvrxpjV.mjs").then(_rDefault),
29
- upgrade: () => import("./upgrade-knZur6qb.mjs").then(_rDefault)
29
+ upgrade: () => import("./upgrade-DGXExT1z.mjs").then(_rDefault)
30
30
  };
31
31
 
32
32
  //#endregion
@@ -63,7 +63,7 @@ async function checkEngines() {
63
63
  //#endregion
64
64
  //#region package.json
65
65
  var name = "@nuxt/cli-nightly";
66
- var version = "3.30.1-20251104-163602-2b2b434";
66
+ var version = "3.30.1-20251104-170129-78f27f8";
67
67
  var description = "Nuxt CLI";
68
68
 
69
69
  //#endregion
@@ -13,7 +13,7 @@ import { detectPackageManager } from "nypm";
13
13
  import { readPackageJSON } from "pkg-types";
14
14
 
15
15
  //#region ../nuxi/package.json
16
- var version = "3.30.1-20251104-163555-2b2b434";
16
+ var version = "3.30.1-20251104-170121-78f27f8";
17
17
 
18
18
  //#endregion
19
19
  //#region ../nuxi/src/commands/info.ts
@@ -2,7 +2,7 @@ import { o as logLevelArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
2
2
  import { t as logger } from "./logger-Dk0gkCkX.mjs";
3
3
  import "./kit-f7zsnm10.mjs";
4
4
  import "./fs--ofMleGo.mjs";
5
- import { n as runCommand$1, t as add_default } from "./add-kZRi0oTW.mjs";
5
+ import { n as runCommand$1, t as add_default } from "./add-yCkF7lke.mjs";
6
6
  import "./versions-CSy_3o_-.mjs";
7
7
  import "./prepare-DjR-jyiQ.mjs";
8
8
  import "./_utils-DTrPahho.mjs";
@@ -15,7 +15,7 @@ import { colors } from "consola/utils";
15
15
  import { x } from "tinyexec";
16
16
  import { installDependencies } from "nypm";
17
17
  import { findFile, readPackageJSON, writePackageJSON } from "pkg-types";
18
- import * as clack from "@clack/prompts";
18
+ import { box as box$1, cancel, confirm, isCancel, multiselect, outro, select, text } from "@clack/prompts";
19
19
  import { downloadTemplate, startShell } from "giget";
20
20
  import { $fetch } from "ofetch";
21
21
 
@@ -152,12 +152,18 @@ var init_default = defineCommand({
152
152
  async run(ctx) {
153
153
  if (hasTTY) process.stdout.write(`\n${nuxtIcon}\n\n`);
154
154
  logger.info(colors.bold(`Welcome to Nuxt!`.split("").map((m) => `${themeColor}${m}`).join("")));
155
- if (ctx.args.dir === "") ctx.args.dir = await logger.prompt("Where would you like to create your project?", {
156
- placeholder: "./nuxt-app",
157
- type: "text",
158
- default: "nuxt-app",
159
- cancel: "reject"
160
- }).catch(() => process.exit(1));
155
+ if (ctx.args.dir === "") {
156
+ const result = await text({
157
+ message: "Where would you like to create your project?",
158
+ placeholder: "./nuxt-app",
159
+ defaultValue: "nuxt-app"
160
+ });
161
+ if (isCancel(result)) {
162
+ cancel("Operation cancelled.");
163
+ process.exit(1);
164
+ }
165
+ ctx.args.dir = result;
166
+ }
161
167
  const cwd = resolve(ctx.args.cwd);
162
168
  let templateDownloadPath = resolve(cwd, ctx.args.dir);
163
169
  logger.info(`Creating a new project in ${colors.cyan(relative(cwd, templateDownloadPath) || templateDownloadPath)}.`);
@@ -167,24 +173,44 @@ var init_default = defineCommand({
167
173
  process.exit(1);
168
174
  }
169
175
  let shouldForce = Boolean(ctx.args.force);
170
- if (!shouldForce && existsSync(templateDownloadPath)) switch (await logger.prompt(`The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, {
171
- type: "select",
172
- options: [
173
- "Override its contents",
174
- "Select different directory",
175
- "Abort"
176
- ]
177
- })) {
178
- case "Override its contents":
179
- shouldForce = true;
180
- break;
181
- case "Select different directory":
182
- templateDownloadPath = resolve(cwd, await logger.prompt("Please specify a different directory:", {
183
- type: "text",
184
- cancel: "reject"
185
- }).catch(() => process.exit(1)));
186
- break;
187
- default: process.exit(1);
176
+ if (!shouldForce && existsSync(templateDownloadPath)) {
177
+ const selectedAction = await select({
178
+ message: `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`,
179
+ options: [
180
+ {
181
+ value: "override",
182
+ label: "Override its contents"
183
+ },
184
+ {
185
+ value: "different",
186
+ label: "Select different directory"
187
+ },
188
+ {
189
+ value: "abort",
190
+ label: "Abort"
191
+ }
192
+ ]
193
+ });
194
+ if (isCancel(selectedAction)) {
195
+ cancel("Operation cancelled.");
196
+ process.exit(1);
197
+ }
198
+ switch (selectedAction) {
199
+ case "override":
200
+ shouldForce = true;
201
+ break;
202
+ case "different": {
203
+ const result = await text({ message: "Please specify a different directory:" });
204
+ if (isCancel(result)) {
205
+ cancel("Operation cancelled.");
206
+ process.exit(1);
207
+ }
208
+ templateDownloadPath = resolve(cwd, result);
209
+ break;
210
+ }
211
+ case "abort":
212
+ default: process.exit(1);
213
+ }
188
214
  }
189
215
  let template;
190
216
  try {
@@ -248,12 +274,20 @@ var init_default = defineCommand({
248
274
  value: pm,
249
275
  hint: currentPackageManager === pm ? "current" : void 0
250
276
  }));
251
- const selectedPackageManager = packageManagerOptions.includes(packageManagerArg) ? packageManagerArg : await logger.prompt("Which package manager would you like to use?", {
252
- type: "select",
253
- options: packageManagerSelectOptions,
254
- initial: currentPackageManager,
255
- cancel: "reject"
256
- }).catch(() => process.exit(1));
277
+ let selectedPackageManager;
278
+ if (packageManagerOptions.includes(packageManagerArg)) selectedPackageManager = packageManagerArg;
279
+ else {
280
+ const result = await select({
281
+ message: "Which package manager would you like to use?",
282
+ options: packageManagerSelectOptions,
283
+ initialValue: currentPackageManager
284
+ });
285
+ if (isCancel(result)) {
286
+ cancel("Operation cancelled.");
287
+ process.exit(1);
288
+ }
289
+ selectedPackageManager = result;
290
+ }
257
291
  if (ctx.args.install === false) logger.info("Skipping install dependencies step.");
258
292
  else {
259
293
  logger.start("Installing dependencies...");
@@ -272,10 +306,14 @@ var init_default = defineCommand({
272
306
  }
273
307
  logger.success("Installation completed.");
274
308
  }
275
- if (ctx.args.gitInit === void 0) ctx.args.gitInit = await logger.prompt("Initialize git repository?", {
276
- type: "confirm",
277
- cancel: "reject"
278
- }).catch(() => process.exit(1));
309
+ if (ctx.args.gitInit === void 0) {
310
+ const result = await confirm({ message: "Initialize git repository?" });
311
+ if (isCancel(result)) {
312
+ cancel("Operation cancelled.");
313
+ process.exit(1);
314
+ }
315
+ ctx.args.gitInit = result;
316
+ }
279
317
  if (ctx.args.gitInit) {
280
318
  logger.info("Initializing git repository...\n");
281
319
  try {
@@ -291,24 +329,28 @@ var init_default = defineCommand({
291
329
  if (ctx.args.modules !== void 0) modulesToAdd.push(...(ctx.args.modules || "").split(",").map((module) => module.trim()).filter(Boolean));
292
330
  else if (!ctx.args.offline && !ctx.args.preferOffline) {
293
331
  const modulesPromise = $fetch("https://api.nuxt.com/modules");
294
- if (await logger.prompt(`Would you like to install any of the official modules?`, {
295
- initial: false,
296
- type: "confirm",
297
- cancel: "reject"
298
- }).catch(() => process.exit(1))) {
332
+ const wantsUserModules = await confirm({
333
+ message: `Would you like to install any of the official modules?`,
334
+ initialValue: false
335
+ });
336
+ if (isCancel(wantsUserModules)) {
337
+ cancel("Operation cancelled.");
338
+ process.exit(1);
339
+ }
340
+ if (wantsUserModules) {
299
341
  const [response, templateDeps] = await Promise.all([modulesPromise, getTemplateDependencies(template.dir)]);
300
342
  const officialModules = response.modules.filter((module) => module.type === "official" && module.npm !== "@nuxt/devtools").filter((module) => !templateDeps.includes(module.npm));
301
343
  if (officialModules.length === 0) logger.info("All official modules are already included in this template.");
302
344
  else {
303
- const selectedOfficialModules = await logger.prompt("Pick the modules to install:", {
304
- type: "multiselect",
345
+ const selectedOfficialModules = await multiselect({
346
+ message: "Pick the modules to install:",
305
347
  options: officialModules.map((module) => ({
306
348
  label: `${colors.bold(colors.greenBright(module.npm))} – ${module.description.replace(/\.$/, "")}`,
307
349
  value: module.npm
308
350
  })),
309
351
  required: false
310
352
  });
311
- if (selectedOfficialModules === void 0) process.exit(1);
353
+ if (isCancel(selectedOfficialModules)) process.exit(1);
312
354
  if (selectedOfficialModules.length > 0) {
313
355
  const modules = selectedOfficialModules;
314
356
  const { toInstall, skipped } = filterModules(modules, Object.fromEntries(await Promise.all(modules.map(async (module) => [module, await getModuleDependencies(module)]))));
@@ -324,11 +366,10 @@ var init_default = defineCommand({
324
366
  ctx.args.install ? "" : "--skipInstall",
325
367
  ctx.args.logLevel ? `--logLevel=${ctx.args.logLevel}` : ""
326
368
  ].filter(Boolean));
327
- logger.log(`\n✨ Nuxt project has been created with the \`${template.name}\` template.\n`);
369
+ outro(`✨ Nuxt project has been created with the \`${template.name}\` template.`);
328
370
  const relativeTemplateDir = relative(process.cwd(), template.dir) || ".";
329
371
  const runCmd = selectedPackageManager === "deno" ? "task" : "run";
330
- const nextSteps = [!ctx.args.shell && relativeTemplateDir.length > 1 && colors.cyan(`cd ${relativeTemplateDir}`), colors.cyan(`${selectedPackageManager} ${runCmd} dev`)].filter(Boolean);
331
- clack.box(`\n${nextSteps.map((step) => ` › ${step}`).join("\n")}\n`, ` 👉 Next steps `, {
372
+ box$1(`\n${[!ctx.args.shell && relativeTemplateDir.length > 1 && colors.cyan(`cd ${relativeTemplateDir}`), colors.cyan(`${selectedPackageManager} ${runCmd} dev`)].filter(Boolean).map((step) => ` › ${step}`).join("\n")}\n`, ` 👉 Next steps `, {
332
373
  contentAlign: "left",
333
374
  titleAlign: "left",
334
375
  width: "auto",
@@ -336,7 +377,7 @@ var init_default = defineCommand({
336
377
  contentPadding: 2,
337
378
  rounded: true,
338
379
  includePrefix: false,
339
- formatBorder: (text) => `${themeColor + text}\x1B[0m`
380
+ formatBorder: (text$1) => `${themeColor + text$1}\x1B[0m`
340
381
  });
341
382
  if (ctx.args.shell) startShell(template.dir);
342
383
  }
@@ -8,7 +8,7 @@ var module_default = defineCommand({
8
8
  },
9
9
  args: {},
10
10
  subCommands: {
11
- add: () => import("./add-CBEUvaze.mjs").then((r) => r.default || r),
11
+ add: () => import("./add-CC8PhdIc.mjs").then((r) => r.default || r),
12
12
  search: () => import("./search-D_JLXbhF.mjs").then((r) => r.default || r)
13
13
  }
14
14
  });
@@ -12,6 +12,7 @@ import { resolve } from "pathe";
12
12
  import { colors } from "consola/utils";
13
13
  import { addDependency, dedupeDependencies, detectPackageManager } from "nypm";
14
14
  import { readPackageJSON } from "pkg-types";
15
+ import { cancel, isCancel, select } from "@clack/prompts";
15
16
 
16
17
  //#region ../nuxi/src/commands/upgrade.ts
17
18
  function checkNuxtDependencyType(pkg) {
@@ -27,12 +28,22 @@ function getNightlyDependency(dep, nuxtVersion) {
27
28
  return `${dep}@npm:${dep}-nightly@${nuxtVersionTags[nuxtVersion]}`;
28
29
  }
29
30
  async function getNightlyVersion(packageNames) {
30
- const nuxtVersion = await logger.prompt("Which nightly Nuxt release channel do you want to install? (3.x or 4.x)", {
31
- type: "select",
32
- options: ["3.x", "4.x"],
33
- default: "4.x",
34
- cancel: "reject"
35
- }).catch(() => process.exit(1));
31
+ const result = await select({
32
+ message: "Which nightly Nuxt release channel do you want to install?",
33
+ options: [{
34
+ value: "3.x",
35
+ label: "3.x"
36
+ }, {
37
+ value: "4.x",
38
+ label: "4.x"
39
+ }],
40
+ initialValue: "4.x"
41
+ });
42
+ if (isCancel(result)) {
43
+ cancel("Operation cancelled.");
44
+ process.exit(1);
45
+ }
46
+ const nuxtVersion = result;
36
47
  return {
37
48
  npmPackages: packageNames.map((p) => getNightlyDependency(p, nuxtVersion)),
38
49
  nuxtVersion
@@ -116,26 +127,32 @@ var upgrade_default = defineCommand({
116
127
  if (lockFile) toRemove.push(lockFile);
117
128
  const forceRemovals = toRemove.map((p) => colors.cyan(p)).join(" and ");
118
129
  let method = ctx.args.force ? "force" : ctx.args.dedupe ? "dedupe" : void 0;
119
- method ||= await logger.prompt(`Would you like to dedupe your lockfile (recommended) or recreate ${forceRemovals}? This can fix problems with hoisted dependency versions and ensure you have the most up-to-date dependencies.`, {
120
- type: "select",
121
- initial: "dedupe",
122
- cancel: "reject",
123
- options: [
124
- {
125
- label: "dedupe lockfile",
126
- value: "dedupe",
127
- hint: "recommended"
128
- },
129
- {
130
- label: `recreate ${forceRemovals}`,
131
- value: "force"
132
- },
133
- {
134
- label: "skip",
135
- value: "skip"
136
- }
137
- ]
138
- }).catch(() => process.exit(1));
130
+ if (!method) {
131
+ const result = await select({
132
+ message: `Would you like to dedupe your lockfile (recommended) or recreate ${forceRemovals}? This can fix problems with hoisted dependency versions and ensure you have the most up-to-date dependencies.`,
133
+ options: [
134
+ {
135
+ label: "dedupe lockfile",
136
+ value: "dedupe",
137
+ hint: "recommended"
138
+ },
139
+ {
140
+ label: `recreate ${forceRemovals}`,
141
+ value: "force"
142
+ },
143
+ {
144
+ label: "skip",
145
+ value: "skip"
146
+ }
147
+ ],
148
+ initialValue: "dedupe"
149
+ });
150
+ if (isCancel(result)) {
151
+ cancel("Operation cancelled.");
152
+ process.exit(1);
153
+ }
154
+ method = result;
155
+ }
139
156
  const versionType = ctx.args.channel === "nightly" ? "nightly" : `latest ${ctx.args.channel}`;
140
157
  logger.info(`Installing ${versionType} Nuxt ${nuxtVersion} release...`);
141
158
  await addDependency(npmPackages, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/cli-nightly",
3
3
  "type": "module",
4
- "version": "3.30.1-20251104-163602-2b2b434",
4
+ "version": "3.30.1-20251104-170129-78f27f8",
5
5
  "description": "Nuxt CLI",
6
6
  "license": "MIT",
7
7
  "repository": {