@nuxt/cli-nightly 3.29.4-20251009-171833-0915ec9 → 3.29.4-20251021-190716-bbf70fc

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.
Files changed (69) hide show
  1. package/dist/_shared-C3vB2YLc.mjs +42 -0
  2. package/dist/_utils-DTrPahho.mjs +29 -0
  3. package/dist/add-BGMHIn5L.mjs +333 -0
  4. package/dist/add-CRBwIlDF.mjs +298 -0
  5. package/dist/add-hFFIzkcy.mjs +10 -0
  6. package/dist/analyze-CUKAi_IN.mjs +115 -0
  7. package/dist/banner-CqfM_0Qo.mjs +55 -0
  8. package/dist/build-BSxJLNs_.mjs +78 -0
  9. package/dist/build-KNIBU0AI.mjs +9 -0
  10. package/dist/cleanup-8GRakeLu.mjs +31 -0
  11. package/dist/dev/index.d.mts +87 -83
  12. package/dist/dev/index.mjs +7 -23
  13. package/dist/dev-Bs_0dzlh.mjs +591 -0
  14. package/dist/dev-CnQwDUaD.mjs +7 -0
  15. package/dist/dev-L7lhoThJ.mjs +438 -0
  16. package/dist/dev-child-CSiX6Uyv.mjs +37 -0
  17. package/dist/devtools-BLGzUSNU.mjs +44 -0
  18. package/dist/env-Dz4K_NkM.mjs +12 -0
  19. package/dist/fs-ewAp6tjM.mjs +40 -0
  20. package/dist/generate-CGy3-x2K.mjs +35 -0
  21. package/dist/index.d.mts +9 -18
  22. package/dist/index.mjs +129 -8
  23. package/dist/info-BDdsghj1.mjs +120 -0
  24. package/dist/init-_n9DXzzY.mjs +336 -0
  25. package/dist/kit-xFxVGu6d.mjs +37 -0
  26. package/dist/logger-Dk0gkCkX.mjs +7 -0
  27. package/dist/module-CqBrGD-s.mjs +17 -0
  28. package/dist/nuxt-Cc9ZTk7m.mjs +44 -0
  29. package/dist/packageManagers-DbVB5cXf.mjs +9 -0
  30. package/dist/prepare-B0KOhO-L.mjs +7 -0
  31. package/dist/prepare-xI978yFg.mjs +49 -0
  32. package/dist/preview-C5fNqrC6.mjs +109 -0
  33. package/dist/search-DCyXfxzn.mjs +113 -0
  34. package/dist/test-CBt1emEB.mjs +55 -0
  35. package/dist/typecheck-DCWe7Iej.mjs +102 -0
  36. package/dist/upgrade-BMSFcUWJ.mjs +184 -0
  37. package/dist/versions-CSy_3o_-.mjs +18 -0
  38. package/package.json +13 -13
  39. package/dist/chunks/add.mjs +0 -381
  40. package/dist/chunks/add2.mjs +0 -319
  41. package/dist/chunks/analyze.mjs +0 -139
  42. package/dist/chunks/build.mjs +0 -94
  43. package/dist/chunks/cleanup.mjs +0 -34
  44. package/dist/chunks/dev-child.mjs +0 -38
  45. package/dist/chunks/dev.mjs +0 -709
  46. package/dist/chunks/devtools.mjs +0 -46
  47. package/dist/chunks/generate.mjs +0 -45
  48. package/dist/chunks/index.mjs +0 -507
  49. package/dist/chunks/index2.mjs +0 -15
  50. package/dist/chunks/info.mjs +0 -150
  51. package/dist/chunks/init.mjs +0 -413
  52. package/dist/chunks/prepare.mjs +0 -57
  53. package/dist/chunks/preview.mjs +0 -131
  54. package/dist/chunks/search.mjs +0 -114
  55. package/dist/chunks/test.mjs +0 -62
  56. package/dist/chunks/typecheck.mjs +0 -85
  57. package/dist/chunks/upgrade.mjs +0 -214
  58. package/dist/dev/index.d.ts +0 -94
  59. package/dist/index.d.ts +0 -23
  60. package/dist/shared/cli-nightly.B9AmABr3.mjs +0 -5
  61. package/dist/shared/cli-nightly.BRlCc6aT.mjs +0 -204
  62. package/dist/shared/cli-nightly.BSm0_9Hr.mjs +0 -7
  63. package/dist/shared/cli-nightly.Bu_9IHj2.mjs +0 -51
  64. package/dist/shared/cli-nightly.Cr-OCgdO.mjs +0 -37
  65. package/dist/shared/cli-nightly.DHenkA1C.mjs +0 -14
  66. package/dist/shared/cli-nightly.DPmMxQ6h.mjs +0 -33
  67. package/dist/shared/cli-nightly.DS8guhZv.mjs +0 -52
  68. package/dist/shared/cli-nightly.DkO5RR_e.mjs +0 -14
  69. package/dist/shared/cli-nightly.qKvs7FJ2.mjs +0 -36
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/cli-nightly",
3
3
  "type": "module",
4
- "version": "3.29.4-20251009-171833-0915ec9",
4
+ "version": "3.29.4-20251021-190716-bbf70fc",
5
5
  "description": "Nuxt CLI",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -28,16 +28,16 @@
28
28
  "node": "^16.10.0 || >=18.0.0"
29
29
  },
30
30
  "scripts": {
31
- "build": "unbuild",
32
- "dev:prepare": "unbuild --stub",
33
- "prepack": "unbuild"
31
+ "build": "tsdown",
32
+ "dev:prepare": "tsdown --watch",
33
+ "prepack": "tsdown"
34
34
  },
35
35
  "dependencies": {
36
- "c12": "^3.3.0",
36
+ "c12": "^3.3.1",
37
37
  "citty": "^0.1.6",
38
- "clipboardy": "^5.0.0",
39
38
  "confbox": "^0.2.2",
40
39
  "consola": "^3.4.2",
40
+ "copy-paste": "^2.2.0",
41
41
  "defu": "^6.1.4",
42
42
  "exsolve": "^1.0.7",
43
43
  "fuse.js": "^7.1.0",
@@ -53,9 +53,9 @@
53
53
  "perfect-debounce": "^2.0.0",
54
54
  "pkg-types": "^2.3.0",
55
55
  "scule": "^1.3.0",
56
- "semver": "^7.7.2",
57
- "srvx": "^0.8.9",
58
- "std-env": "^3.9.0",
56
+ "semver": "^7.7.3",
57
+ "srvx": "^0.8.16",
58
+ "std-env": "^3.10.0",
59
59
  "tinyexec": "^1.0.1",
60
60
  "ufo": "^1.6.1",
61
61
  "undici": "^7.16.0",
@@ -64,11 +64,11 @@
64
64
  "devDependencies": {
65
65
  "@nuxt/kit": "^4.1.3",
66
66
  "@nuxt/schema": "^4.1.3",
67
- "@types/node": "^22.18.8",
68
- "rollup": "^4.52.4",
69
- "rollup-plugin-visualizer": "^6.0.4",
67
+ "@types/node": "^22.18.12",
68
+ "rollup": "^4.52.5",
69
+ "rollup-plugin-visualizer": "^6.0.5",
70
+ "tsdown": "^0.15.9",
70
71
  "typescript": "^5.9.3",
71
- "unbuild": "^3.6.1",
72
72
  "unplugin-purge-polyfills": "^0.1.0",
73
73
  "vitest": "^3.2.4",
74
74
  "youch": "^4.1.0-beta.11"
@@ -1,381 +0,0 @@
1
- import * as fs from 'node:fs';
2
- import { homedir } from 'node:os';
3
- import { join } from 'node:path';
4
- import process from 'node:process';
5
- import { updateConfig } from 'c12/update';
6
- import { runCommand as runCommand$1, defineCommand } from 'citty';
7
- import { colors } from 'consola/utils';
8
- import { addDependency } from 'nypm';
9
- import { $fetch } from 'ofetch';
10
- import { resolve } from 'pathe';
11
- import { readPackageJSON } from 'pkg-types';
12
- import { satisfies } from 'semver';
13
- import { joinURL } from 'ufo';
14
- import { fileURLToPath } from 'node:url';
15
- import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
16
- import { g as getNuxtVersion } from '../shared/cli-nightly.DHenkA1C.mjs';
17
- import { a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BRlCc6aT.mjs';
18
- import prepareCommand from './prepare.mjs';
19
- import { f as fetchModules, c as checkNuxtCompatibility, g as getRegistryFromContent } from '../shared/cli-nightly.Cr-OCgdO.mjs';
20
-
21
- const nuxiCommands = [
22
- "add",
23
- "analyze",
24
- "build",
25
- "cleanup",
26
- "_dev",
27
- "dev",
28
- "devtools",
29
- "generate",
30
- "info",
31
- "init",
32
- "module",
33
- "prepare",
34
- "preview",
35
- "start",
36
- "test",
37
- "typecheck",
38
- "upgrade"
39
- ];
40
- function isNuxiCommand(command) {
41
- return nuxiCommands.includes(command);
42
- }
43
-
44
- globalThis.__nuxt_cli__ = globalThis.__nuxt_cli__ || {
45
- // Programmatic usage fallback
46
- startTime: Date.now(),
47
- entry: fileURLToPath(
48
- new URL("../../bin/nuxi.mjs", import.meta.url)
49
- ),
50
- devEntry: fileURLToPath(
51
- new URL("../dev/index.mjs", import.meta.url)
52
- )
53
- };
54
- async function runCommand(command, argv = process.argv.slice(2), data = {}) {
55
- argv.push("--no-clear");
56
- if (command.meta && "name" in command.meta && typeof command.meta.name === "string") {
57
- const name = command.meta.name;
58
- if (!isNuxiCommand(name)) {
59
- throw new Error(`Invalid command ${name}`);
60
- }
61
- } else {
62
- throw new Error(`Invalid command, must be named`);
63
- }
64
- return await runCommand$1(command, {
65
- rawArgs: argv,
66
- data: {
67
- overrides: data.overrides || {}
68
- }
69
- });
70
- }
71
-
72
- const addModuleCommand = defineCommand({
73
- meta: {
74
- name: "add",
75
- description: "Add Nuxt modules"
76
- },
77
- args: {
78
- ...cwdArgs,
79
- ...logLevelArgs,
80
- moduleName: {
81
- type: "positional",
82
- description: "Specify one or more modules to install by name, separated by spaces"
83
- },
84
- skipInstall: {
85
- type: "boolean",
86
- description: "Skip npm install"
87
- },
88
- skipConfig: {
89
- type: "boolean",
90
- description: "Skip nuxt.config.ts update"
91
- },
92
- dev: {
93
- type: "boolean",
94
- description: "Install modules as dev dependencies"
95
- }
96
- },
97
- async setup(ctx) {
98
- const cwd = resolve(ctx.args.cwd);
99
- const modules = ctx.args._.map((e) => e.trim()).filter(Boolean);
100
- const projectPkg = await readPackageJSON(cwd).catch(() => ({}));
101
- if (!projectPkg.dependencies?.nuxt && !projectPkg.devDependencies?.nuxt) {
102
- logger.warn(`No \`nuxt\` dependency detected in \`${cwd}\`.`);
103
- const shouldContinue = await logger.prompt(
104
- `Do you want to continue anyway?`,
105
- {
106
- type: "confirm",
107
- initial: false,
108
- cancel: "default"
109
- }
110
- );
111
- if (shouldContinue !== true) {
112
- process.exit(1);
113
- }
114
- }
115
- const maybeResolvedModules = await Promise.all(modules.map((moduleName) => resolveModule(moduleName, cwd)));
116
- const resolvedModules = maybeResolvedModules.filter((x) => x != null);
117
- logger.info(`Resolved \`${resolvedModules.map((x) => x.pkgName).join("`, `")}\`, adding module${resolvedModules.length > 1 ? "s" : ""}...`);
118
- await addModules(resolvedModules, { ...ctx.args, cwd }, projectPkg);
119
- if (!ctx.args.skipInstall) {
120
- const args = Object.entries(ctx.args).filter(([k]) => k in cwdArgs || k in logLevelArgs).map(([k, v]) => `--${k}=${v}`);
121
- await runCommand(prepareCommand, args);
122
- }
123
- }
124
- });
125
- async function addModules(modules, { skipInstall, skipConfig, cwd, dev }, projectPkg) {
126
- if (!skipInstall) {
127
- const installedModules = [];
128
- const notInstalledModules = [];
129
- const dependencies = /* @__PURE__ */ new Set([
130
- ...Object.keys(projectPkg.dependencies || {}),
131
- ...Object.keys(projectPkg.devDependencies || {})
132
- ]);
133
- for (const module of modules) {
134
- if (dependencies.has(module.pkgName)) {
135
- installedModules.push(module);
136
- } else {
137
- notInstalledModules.push(module);
138
- }
139
- }
140
- if (installedModules.length > 0) {
141
- const installedModulesList = installedModules.map((module) => module.pkgName).join("`, `");
142
- const are = installedModules.length > 1 ? "are" : "is";
143
- logger.info(`\`${installedModulesList}\` ${are} already installed`);
144
- }
145
- if (notInstalledModules.length > 0) {
146
- const isDev = Boolean(projectPkg.devDependencies?.nuxt) || dev;
147
- const notInstalledModulesList = notInstalledModules.map((module) => module.pkg).join("`, `");
148
- const dependency = notInstalledModules.length > 1 ? "dependencies" : "dependency";
149
- const a = notInstalledModules.length > 1 ? "" : " a";
150
- logger.info(`Installing \`${notInstalledModulesList}\` as${a}${isDev ? " development" : ""} ${dependency}`);
151
- const res = await addDependency(notInstalledModules.map((module) => module.pkg), {
152
- cwd,
153
- dev: isDev,
154
- installPeerDependencies: true
155
- }).then(() => true).catch(
156
- (error) => {
157
- logger.error(error);
158
- const failedModulesList = notInstalledModules.map((module) => colors.cyan(module.pkg)).join("`, `");
159
- const s = notInstalledModules.length > 1 ? "s" : "";
160
- return logger.prompt(`Install failed for \`${failedModulesList}\`. Do you want to continue adding the module${s} to ${colors.cyan("nuxt.config")}?`, {
161
- type: "confirm",
162
- initial: false,
163
- cancel: "default"
164
- });
165
- }
166
- );
167
- if (res !== true) {
168
- return;
169
- }
170
- }
171
- }
172
- if (!skipConfig) {
173
- await updateConfig({
174
- cwd,
175
- configFile: "nuxt.config",
176
- async onCreate() {
177
- logger.info(`Creating \`nuxt.config.ts\``);
178
- return getDefaultNuxtConfig();
179
- },
180
- async onUpdate(config) {
181
- if (!config.modules) {
182
- config.modules = [];
183
- }
184
- for (const resolved of modules) {
185
- if (config.modules.includes(resolved.pkgName)) {
186
- logger.info(`\`${resolved.pkgName}\` is already in the \`modules\``);
187
- continue;
188
- }
189
- logger.info(`Adding \`${resolved.pkgName}\` to the \`modules\``);
190
- config.modules.push(resolved.pkgName);
191
- }
192
- }
193
- }).catch((error) => {
194
- logger.error(`Failed to update \`nuxt.config\`: ${error.message}`);
195
- logger.error(`Please manually add \`${modules.map((module) => module.pkgName).join("`, `")}\` to the \`modules\` in \`nuxt.config.ts\``);
196
- return null;
197
- });
198
- }
199
- }
200
- function getDefaultNuxtConfig() {
201
- return `
202
- // https://nuxt.com/docs/api/configuration/nuxt-config
203
- export default defineNuxtConfig({
204
- modules: []
205
- })`;
206
- }
207
- const packageRegex = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?([a-z0-9-~][a-z0-9-._~]*)(@[^@]+)?$/;
208
- async function resolveModule(moduleName, cwd) {
209
- let pkgName = moduleName;
210
- let pkgVersion;
211
- const reMatch = moduleName.match(packageRegex);
212
- if (reMatch) {
213
- if (reMatch[3]) {
214
- pkgName = `${reMatch[1] || ""}${reMatch[2] || ""}`;
215
- pkgVersion = reMatch[3].slice(1);
216
- }
217
- } else {
218
- logger.error(`Invalid package name \`${pkgName}\`.`);
219
- return false;
220
- }
221
- const modulesDB = await fetchModules().catch((err) => {
222
- logger.warn(`Cannot search in the Nuxt Modules database: ${err}`);
223
- return [];
224
- });
225
- const matchedModule = modulesDB.find(
226
- (module) => module.name === moduleName || pkgVersion && module.name === pkgName || module.npm === pkgName || module.aliases?.includes(pkgName)
227
- );
228
- if (matchedModule?.npm) {
229
- pkgName = matchedModule.npm;
230
- }
231
- if (matchedModule && matchedModule.compatibility.nuxt) {
232
- const nuxtVersion = await getNuxtVersion(cwd);
233
- if (!checkNuxtCompatibility(matchedModule, nuxtVersion)) {
234
- logger.warn(
235
- `The module \`${pkgName}\` is not compatible with Nuxt \`${nuxtVersion}\` (requires \`${matchedModule.compatibility.nuxt}\`)`
236
- );
237
- const shouldContinue = await logger.prompt(
238
- "Do you want to continue installing incompatible version?",
239
- {
240
- type: "confirm",
241
- initial: false,
242
- cancel: "default"
243
- }
244
- );
245
- if (!shouldContinue) {
246
- return false;
247
- }
248
- }
249
- const versionMap = matchedModule.compatibility.versionMap;
250
- if (versionMap) {
251
- for (const [_nuxtVersion, _moduleVersion] of Object.entries(versionMap)) {
252
- if (satisfies(nuxtVersion, _nuxtVersion)) {
253
- if (!pkgVersion) {
254
- pkgVersion = _moduleVersion;
255
- } else {
256
- logger.warn(
257
- `Recommended version of \`${pkgName}\` for Nuxt \`${nuxtVersion}\` is \`${_moduleVersion}\` but you have requested \`${pkgVersion}\``
258
- );
259
- pkgVersion = await logger.prompt("Choose a version:", {
260
- type: "select",
261
- options: [_moduleVersion, pkgVersion],
262
- cancel: "undefined"
263
- });
264
- if (!pkgVersion) {
265
- return false;
266
- }
267
- }
268
- break;
269
- }
270
- }
271
- }
272
- }
273
- let version = pkgVersion || "latest";
274
- const pkgScope = pkgName.startsWith("@") ? pkgName.split("/")[0] : null;
275
- const meta = await detectNpmRegistry(pkgScope);
276
- const headers = {};
277
- if (meta.authToken) {
278
- headers.Authorization = `Bearer ${meta.authToken}`;
279
- }
280
- const pkgDetails = await $fetch(joinURL(meta.registry, `${pkgName}`), { headers });
281
- if (pkgDetails["dist-tags"]?.[version]) {
282
- version = pkgDetails["dist-tags"][version];
283
- } else {
284
- version = Object.keys(pkgDetails.versions)?.findLast((v) => satisfies(v, version)) || version;
285
- }
286
- const pkg = pkgDetails.versions[version];
287
- const pkgDependencies = Object.assign(
288
- pkg.dependencies || {},
289
- pkg.devDependencies || {}
290
- );
291
- if (!pkgDependencies.nuxt && !pkgDependencies["nuxt-edge"] && !pkgDependencies["@nuxt/kit"]) {
292
- logger.warn(`It seems that \`${pkgName}\` is not a Nuxt module.`);
293
- const shouldContinue = await logger.prompt(
294
- `Do you want to continue installing ${colors.cyan(pkgName)} anyway?`,
295
- {
296
- type: "confirm",
297
- initial: false,
298
- cancel: "default"
299
- }
300
- );
301
- if (!shouldContinue) {
302
- return false;
303
- }
304
- }
305
- return {
306
- nuxtModule: matchedModule,
307
- pkg: `${pkgName}@${version}`,
308
- pkgName,
309
- pkgVersion: version
310
- };
311
- }
312
- function getNpmrcPaths() {
313
- const userNpmrcPath = join(homedir(), ".npmrc");
314
- const cwdNpmrcPath = join(process.cwd(), ".npmrc");
315
- return [cwdNpmrcPath, userNpmrcPath];
316
- }
317
- async function getAuthToken(registry) {
318
- const paths = getNpmrcPaths();
319
- const authTokenRegex = new RegExp(`^//${registry.replace(/^https?:\/\//, "").replace(/\/$/, "")}/:_authToken=(.+)$`, "m");
320
- for (const npmrcPath of paths) {
321
- let fd;
322
- try {
323
- fd = await fs.promises.open(npmrcPath, "r");
324
- if (await fd.stat().then((r) => r.isFile())) {
325
- const npmrcContent = await fd.readFile("utf-8");
326
- const authTokenMatch = npmrcContent.match(authTokenRegex)?.[1];
327
- if (authTokenMatch) {
328
- return authTokenMatch.trim();
329
- }
330
- }
331
- } catch {
332
- } finally {
333
- await fd?.close();
334
- }
335
- }
336
- return null;
337
- }
338
- async function detectNpmRegistry(scope) {
339
- const registry = await getRegistry(scope);
340
- const authToken = await getAuthToken(registry);
341
- return {
342
- registry,
343
- authToken
344
- };
345
- }
346
- async function getRegistry(scope) {
347
- if (process.env.COREPACK_NPM_REGISTRY) {
348
- return process.env.COREPACK_NPM_REGISTRY;
349
- }
350
- const registry = await getRegistryFromFile(getNpmrcPaths(), scope);
351
- if (registry) {
352
- process.env.COREPACK_NPM_REGISTRY = registry;
353
- }
354
- return registry || "https://registry.npmjs.org";
355
- }
356
- async function getRegistryFromFile(paths, scope) {
357
- for (const npmrcPath of paths) {
358
- let fd;
359
- try {
360
- fd = await fs.promises.open(npmrcPath, "r");
361
- if (await fd.stat().then((r) => r.isFile())) {
362
- const npmrcContent = await fd.readFile("utf-8");
363
- const registry = getRegistryFromContent(npmrcContent, scope);
364
- if (registry) {
365
- return registry;
366
- }
367
- }
368
- } catch {
369
- } finally {
370
- await fd?.close();
371
- }
372
- }
373
- return null;
374
- }
375
-
376
- const add = {
377
- __proto__: null,
378
- default: addModuleCommand
379
- };
380
-
381
- export { addModuleCommand as a, add as b, runCommand as r };