@nuxt/cli-nightly 3.31.0-20251112-163840-1b26dec → 3.31.0-20251114-183659-ab4e0c6
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/add-B-g5qEtw.mjs +11 -0
- package/dist/{add-CHVmfYrF.mjs → add-DYl9eciR.mjs} +15 -6
- package/dist/{add-yCkF7lke.mjs → add-ZaZI_ZJH.mjs} +24 -23
- package/dist/{analyze-6tANI65A.mjs → analyze-DjqZOzwX.mjs} +18 -7
- package/dist/banner-DQx8x98i.mjs +42 -0
- package/dist/{build-CVr-ruAe.mjs → build-BaZrKRCS.mjs} +15 -9
- package/dist/build-Do6kFHyH.mjs +10 -0
- package/dist/{cleanup-X4v95Xqm.mjs → cleanup-BAQaKzUm.mjs} +4 -3
- package/dist/dev/index.mjs +6 -5
- package/dist/{dev-aS1afvp8.mjs → dev-BhmbxmPd.mjs} +13 -11
- package/dist/{dev-Bf9P_WmH.mjs → dev-DjmBDZYe.mjs} +3 -3
- package/dist/{dev-child-GqhyRU2G.mjs → dev-child-B9APIXlC.mjs} +1 -1
- package/dist/dev-pecSeV9d.mjs +9 -0
- package/dist/{devtools-BLGzUSNU.mjs → devtools-CbKpNDhe.mjs} +3 -2
- package/dist/{env-CamzysGq.mjs → env-N36fDvz0.mjs} +3 -2
- package/dist/formatting-CAvhu26Q.mjs +56 -0
- package/dist/{fs--ofMleGo.mjs → fs-CGUBNEba.mjs} +2 -2
- package/dist/{generate-DZJF1Xf_.mjs → generate-C7nZZjW0.mjs} +6 -5
- package/dist/index.mjs +21 -20
- package/dist/info-cPa08hVq.mjs +139 -0
- package/dist/{init-DX0yoR1B.mjs → init-D13kJvE3.mjs} +54 -41
- package/dist/logger-Dd47z9E7.mjs +9 -0
- package/dist/{module-t-MDBA3Y.mjs → module-D0pcWR-5.mjs} +2 -2
- package/dist/{nuxt-CfBR40hD.mjs → nuxt-8UELXZ2y.mjs} +2 -2
- package/dist/paths-C4ma0oRK.mjs +11 -0
- package/dist/prepare-Bp6yMU36.mjs +8 -0
- package/dist/{prepare-DjR-jyiQ.mjs → prepare-CWzUtiE9.mjs} +6 -4
- package/dist/{preview-CgpLKg-X.mjs → preview-DDiSySPF.mjs} +28 -18
- package/dist/{search-D_JLXbhF.mjs → search-D48sLs_4.mjs} +31 -24
- package/dist/{test-CBt1emEB.mjs → test-DKBo3m_m.mjs} +1 -1
- package/dist/{typecheck-egvrxpjV.mjs → typecheck-34AvFcmE.mjs} +1 -1
- package/dist/{upgrade-CblzcPw0.mjs → upgrade-BuybH3Cn.mjs} +66 -41
- package/dist/versions-CUHtwDOW.mjs +35 -0
- package/package.json +4 -2
- package/dist/add-CC8PhdIc.mjs +0 -10
- package/dist/banner-CWBLwDiB.mjs +0 -55
- package/dist/build-BEXmJONc.mjs +0 -9
- package/dist/dev-CNjdVPgl.mjs +0 -8
- package/dist/info-DwTP8b9l.mjs +0 -120
- package/dist/logger-Dk0gkCkX.mjs +0 -7
- package/dist/prepare-ZByeo9vQ.mjs +0 -7
- package/dist/versions-CSy_3o_-.mjs +0 -18
- /package/dist/{_utils-DTrPahho.mjs → _utils-B8YNEdpq.mjs} +0 -0
- /package/dist/{packageManagers-DbVB5cXf.mjs → packageManagers-Dd1BN02x.mjs} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./_shared-C3vB2YLc.mjs";
|
|
2
|
+
import "./logger-Dd47z9E7.mjs";
|
|
3
|
+
import "./kit-f7zsnm10.mjs";
|
|
4
|
+
import "./versions-CUHtwDOW.mjs";
|
|
5
|
+
import "./fs-CGUBNEba.mjs";
|
|
6
|
+
import "./paths-C4ma0oRK.mjs";
|
|
7
|
+
import { t as add_default } from "./add-ZaZI_ZJH.mjs";
|
|
8
|
+
import "./prepare-CWzUtiE9.mjs";
|
|
9
|
+
import "./_utils-B8YNEdpq.mjs";
|
|
10
|
+
|
|
11
|
+
export { add_default as default };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { o as logLevelArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
3
|
import { t as loadKit } from "./kit-f7zsnm10.mjs";
|
|
4
|
+
import { t as relativeToProcess } from "./paths-C4ma0oRK.mjs";
|
|
4
5
|
import process from "node:process";
|
|
5
6
|
import { defineCommand } from "citty";
|
|
7
|
+
import { colors } from "consola/utils";
|
|
8
|
+
import { cancel, intro, outro } from "@clack/prompts";
|
|
6
9
|
import { existsSync, promises } from "node:fs";
|
|
7
10
|
import { dirname, extname, resolve } from "pathe";
|
|
8
11
|
import { camelCase, pascalCase } from "scule";
|
|
@@ -296,15 +299,19 @@ var add_default = defineCommand({
|
|
|
296
299
|
},
|
|
297
300
|
async run(ctx) {
|
|
298
301
|
const cwd = resolve(ctx.args.cwd);
|
|
302
|
+
intro(colors.cyan("Adding template..."));
|
|
299
303
|
const templateName = ctx.args.template;
|
|
300
304
|
if (!templateNames.includes(templateName)) {
|
|
301
|
-
|
|
305
|
+
const templateNames$1 = Object.keys(templates).map((name$1) => colors.cyan(name$1));
|
|
306
|
+
const lastTemplateName = templateNames$1.pop();
|
|
307
|
+
logger.error(`Template ${colors.cyan(templateName)} is not supported.`);
|
|
308
|
+
logger.info(`Possible values are ${templateNames$1.join(", ")} or ${lastTemplateName}.`);
|
|
302
309
|
process.exit(1);
|
|
303
310
|
}
|
|
304
311
|
const ext = extname(ctx.args.name);
|
|
305
312
|
const name = ext === ".vue" || ext === ".ts" ? ctx.args.name.replace(ext, "") : ctx.args.name;
|
|
306
313
|
if (!name) {
|
|
307
|
-
|
|
314
|
+
cancel("name argument is missing!");
|
|
308
315
|
process.exit(1);
|
|
309
316
|
}
|
|
310
317
|
const config = await (await loadKit(cwd)).loadNuxtConfig({ cwd });
|
|
@@ -315,17 +322,19 @@ var add_default = defineCommand({
|
|
|
315
322
|
nuxtOptions: config
|
|
316
323
|
});
|
|
317
324
|
if (!ctx.args.force && existsSync(res.path)) {
|
|
318
|
-
logger.error(`File exists
|
|
325
|
+
logger.error(`File exists at ${colors.cyan(relativeToProcess(res.path))}.`);
|
|
326
|
+
logger.info(`Use ${colors.cyan("--force")} to override or use a different name.`);
|
|
319
327
|
process.exit(1);
|
|
320
328
|
}
|
|
321
329
|
const parentDir = dirname(res.path);
|
|
322
330
|
if (!existsSync(parentDir)) {
|
|
323
|
-
logger.
|
|
331
|
+
logger.step(`Creating directory ${colors.cyan(relativeToProcess(parentDir))}.`);
|
|
324
332
|
if (templateName === "page") logger.info("This enables vue-router functionality!");
|
|
325
333
|
await promises.mkdir(parentDir, { recursive: true });
|
|
326
334
|
}
|
|
327
335
|
await promises.writeFile(res.path, `${res.contents.trim()}\n`);
|
|
328
|
-
logger.
|
|
336
|
+
logger.success(`Created ${colors.cyan(relativeToProcess(res.path))}.`);
|
|
337
|
+
outro(`Generated a new ${colors.cyan(templateName)}!`);
|
|
329
338
|
}
|
|
330
339
|
});
|
|
331
340
|
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { o as logLevelArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as getNuxtVersion } from "./versions-
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
|
+
import { t as getNuxtVersion } from "./versions-CUHtwDOW.mjs";
|
|
4
|
+
import { t as relativeToProcess } from "./paths-C4ma0oRK.mjs";
|
|
5
|
+
import { t as prepare_default } from "./prepare-CWzUtiE9.mjs";
|
|
6
|
+
import { n as fetchModules, r as getRegistryFromContent, t as checkNuxtCompatibility } from "./_utils-B8YNEdpq.mjs";
|
|
6
7
|
import { join } from "node:path";
|
|
7
8
|
import process from "node:process";
|
|
8
9
|
import { defineCommand, runCommand } from "citty";
|
|
10
|
+
import { colors } from "consola/utils";
|
|
11
|
+
import { confirm, isCancel, select } from "@clack/prompts";
|
|
9
12
|
import { fileURLToPath } from "node:url";
|
|
10
13
|
import * as fs from "node:fs";
|
|
11
14
|
import { existsSync } from "node:fs";
|
|
12
15
|
import { joinURL } from "ufo";
|
|
13
16
|
import { resolve as resolve$1 } from "pathe";
|
|
14
|
-
import {
|
|
17
|
+
import { readPackageJSON } from "pkg-types";
|
|
15
18
|
import { satisfies } from "semver";
|
|
16
19
|
import { homedir } from "node:os";
|
|
17
20
|
import { addDependency, detectPackageManager } from "nypm";
|
|
18
|
-
import { readPackageJSON } from "pkg-types";
|
|
19
|
-
import { confirm, isCancel, select } from "@clack/prompts";
|
|
20
21
|
import { $fetch } from "ofetch";
|
|
21
22
|
import { updateConfig } from "c12/update";
|
|
22
23
|
|
|
@@ -95,7 +96,7 @@ var add_default = defineCommand({
|
|
|
95
96
|
const modules = ctx.args._.map((e) => e.trim()).filter(Boolean);
|
|
96
97
|
const projectPkg = await readPackageJSON(cwd).catch(() => ({}));
|
|
97
98
|
if (!projectPkg.dependencies?.nuxt && !projectPkg.devDependencies?.nuxt) {
|
|
98
|
-
logger.warn(`No
|
|
99
|
+
logger.warn(`No ${colors.cyan("nuxt")} dependency detected in ${colors.cyan(relativeToProcess(cwd))}.`);
|
|
99
100
|
const shouldContinue = await confirm({
|
|
100
101
|
message: `Do you want to continue anyway?`,
|
|
101
102
|
initialValue: false
|
|
@@ -103,7 +104,7 @@ var add_default = defineCommand({
|
|
|
103
104
|
if (isCancel(shouldContinue) || shouldContinue !== true) process.exit(1);
|
|
104
105
|
}
|
|
105
106
|
const resolvedModules = (await Promise.all(modules.map((moduleName) => resolveModule(moduleName, cwd)))).filter((x) => x != null);
|
|
106
|
-
logger.info(`Resolved
|
|
107
|
+
logger.info(`Resolved ${resolvedModules.map((x) => colors.cyan(x.pkgName)).join(", ")}, adding module${resolvedModules.length > 1 ? "s" : ""}...`);
|
|
107
108
|
await addModules(resolvedModules, {
|
|
108
109
|
...ctx.args,
|
|
109
110
|
cwd
|
|
@@ -119,16 +120,16 @@ async function addModules(modules, { skipInstall, skipConfig, cwd, dev }, projec
|
|
|
119
120
|
for (const module of modules) if (dependencies.has(module.pkgName)) installedModules.push(module);
|
|
120
121
|
else notInstalledModules.push(module);
|
|
121
122
|
if (installedModules.length > 0) {
|
|
122
|
-
const installedModulesList = installedModules.map((module) => module.pkgName).join("
|
|
123
|
+
const installedModulesList = installedModules.map((module) => colors.cyan(module.pkgName)).join(", ");
|
|
123
124
|
const are = installedModules.length > 1 ? "are" : "is";
|
|
124
|
-
logger.info(
|
|
125
|
+
logger.info(`${installedModulesList} ${are} already installed`);
|
|
125
126
|
}
|
|
126
127
|
if (notInstalledModules.length > 0) {
|
|
127
128
|
const isDev = Boolean(projectPkg.devDependencies?.nuxt) || dev;
|
|
128
|
-
const notInstalledModulesList = notInstalledModules.map((module) => module.pkg).join("
|
|
129
|
+
const notInstalledModulesList = notInstalledModules.map((module) => colors.cyan(module.pkg)).join(", ");
|
|
129
130
|
const dependency = notInstalledModules.length > 1 ? "dependencies" : "dependency";
|
|
130
131
|
const a = notInstalledModules.length > 1 ? "" : " a";
|
|
131
|
-
logger.info(`Installing
|
|
132
|
+
logger.info(`Installing ${notInstalledModulesList} as${a}${isDev ? " development" : ""} ${dependency}`);
|
|
132
133
|
const packageManager = await detectPackageManager(cwd);
|
|
133
134
|
if (await addDependency(notInstalledModules.map((module) => module.pkg), {
|
|
134
135
|
cwd,
|
|
@@ -139,7 +140,7 @@ async function addModules(modules, { skipInstall, skipConfig, cwd, dev }, projec
|
|
|
139
140
|
}).then(() => true).catch(async (error) => {
|
|
140
141
|
logger.error(error);
|
|
141
142
|
const result = await confirm({
|
|
142
|
-
message: `Install failed for
|
|
143
|
+
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
144
|
initialValue: false
|
|
144
145
|
});
|
|
145
146
|
if (isCancel(result)) return false;
|
|
@@ -151,23 +152,23 @@ async function addModules(modules, { skipInstall, skipConfig, cwd, dev }, projec
|
|
|
151
152
|
cwd,
|
|
152
153
|
configFile: "nuxt.config",
|
|
153
154
|
async onCreate() {
|
|
154
|
-
logger.info(`Creating
|
|
155
|
+
logger.info(`Creating ${colors.cyan("nuxt.config.ts")}`);
|
|
155
156
|
return getDefaultNuxtConfig();
|
|
156
157
|
},
|
|
157
158
|
async onUpdate(config) {
|
|
158
159
|
if (!config.modules) config.modules = [];
|
|
159
160
|
for (const resolved of modules) {
|
|
160
161
|
if (config.modules.includes(resolved.pkgName)) {
|
|
161
|
-
logger.info(
|
|
162
|
+
logger.info(`${colors.cyan(resolved.pkgName)} is already in the ${colors.cyan("modules")}`);
|
|
162
163
|
continue;
|
|
163
164
|
}
|
|
164
|
-
logger.info(`Adding
|
|
165
|
+
logger.info(`Adding ${colors.cyan(resolved.pkgName)} to the ${colors.cyan("modules")}`);
|
|
165
166
|
config.modules.push(resolved.pkgName);
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
}).catch((error) => {
|
|
169
|
-
logger.error(`Failed to update
|
|
170
|
-
logger.error(`Please manually add
|
|
170
|
+
logger.error(`Failed to update ${colors.cyan("nuxt.config")}: ${error.message}`);
|
|
171
|
+
logger.error(`Please manually add ${colors.cyan(modules.map((module) => module.pkgName).join(", "))} to the ${colors.cyan("modules")} in ${colors.cyan("nuxt.config.ts")}`);
|
|
171
172
|
return null;
|
|
172
173
|
});
|
|
173
174
|
}
|
|
@@ -189,7 +190,7 @@ async function resolveModule(moduleName, cwd) {
|
|
|
189
190
|
pkgVersion = reMatch[3].slice(1);
|
|
190
191
|
}
|
|
191
192
|
} else {
|
|
192
|
-
logger.error(`Invalid package name
|
|
193
|
+
logger.error(`Invalid package name ${colors.cyan(pkgName)}.`);
|
|
193
194
|
return false;
|
|
194
195
|
}
|
|
195
196
|
const matchedModule = (await fetchModules().catch((err) => {
|
|
@@ -200,7 +201,7 @@ async function resolveModule(moduleName, cwd) {
|
|
|
200
201
|
if (matchedModule && matchedModule.compatibility.nuxt) {
|
|
201
202
|
const nuxtVersion = await getNuxtVersion(cwd);
|
|
202
203
|
if (!checkNuxtCompatibility(matchedModule, nuxtVersion)) {
|
|
203
|
-
logger.warn(`The module
|
|
204
|
+
logger.warn(`The module ${colors.cyan(pkgName)} is not compatible with Nuxt ${colors.cyan(nuxtVersion)} (requires ${colors.cyan(matchedModule.compatibility.nuxt)})`);
|
|
204
205
|
const shouldContinue = await confirm({
|
|
205
206
|
message: "Do you want to continue installing incompatible version?",
|
|
206
207
|
initialValue: false
|
|
@@ -212,7 +213,7 @@ async function resolveModule(moduleName, cwd) {
|
|
|
212
213
|
for (const [_nuxtVersion, _moduleVersion] of Object.entries(versionMap)) if (satisfies(nuxtVersion, _nuxtVersion)) {
|
|
213
214
|
if (!pkgVersion) pkgVersion = _moduleVersion;
|
|
214
215
|
else {
|
|
215
|
-
logger.warn(`Recommended version of
|
|
216
|
+
logger.warn(`Recommended version of ${colors.cyan(pkgName)} for Nuxt ${colors.cyan(nuxtVersion)} is ${colors.cyan(_moduleVersion)} but you have requested ${colors.cyan(pkgVersion)}.`);
|
|
216
217
|
const result = await select({
|
|
217
218
|
message: "Choose a version:",
|
|
218
219
|
options: [{
|
|
@@ -240,7 +241,7 @@ async function resolveModule(moduleName, cwd) {
|
|
|
240
241
|
const pkg = pkgDetails.versions[version];
|
|
241
242
|
const pkgDependencies = Object.assign(pkg.dependencies || {}, pkg.devDependencies || {});
|
|
242
243
|
if (!pkgDependencies.nuxt && !pkgDependencies["nuxt-edge"] && !pkgDependencies["@nuxt/kit"]) {
|
|
243
|
-
logger.warn(`It seems that
|
|
244
|
+
logger.warn(`It seems that ${colors.cyan(pkgName)} is not a Nuxt module.`);
|
|
244
245
|
const shouldContinue = await confirm({
|
|
245
246
|
message: `Do you want to continue installing ${colors.cyan(pkgName)} anyway?`,
|
|
246
247
|
initialValue: false
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
3
|
import { t as loadKit } from "./kit-f7zsnm10.mjs";
|
|
4
|
-
import { n as clearDir } from "./fs
|
|
5
|
-
import { t as
|
|
4
|
+
import { n as clearDir } from "./fs-CGUBNEba.mjs";
|
|
5
|
+
import { t as relativeToProcess } from "./paths-C4ma0oRK.mjs";
|
|
6
|
+
import { t as overrideEnv } from "./env-N36fDvz0.mjs";
|
|
6
7
|
import process from "node:process";
|
|
7
8
|
import { defineCommand } from "citty";
|
|
9
|
+
import { colors } from "consola/utils";
|
|
10
|
+
import { intro, note, outro, taskLog } from "@clack/prompts";
|
|
8
11
|
import { defu as defu$1 } from "defu";
|
|
9
12
|
import { promises } from "node:fs";
|
|
10
13
|
import { join, resolve } from "pathe";
|
|
@@ -753,6 +756,7 @@ var analyze_default = defineCommand({
|
|
|
753
756
|
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
754
757
|
const name = ctx.args.name || "default";
|
|
755
758
|
const slug = name.trim().replace(/[^\w-]/g, "_");
|
|
759
|
+
intro(colors.cyan("Analyzing bundle size..."));
|
|
756
760
|
const startTime = Date.now();
|
|
757
761
|
const { loadNuxt, buildNuxt } = await loadKit(cwd);
|
|
758
762
|
const nuxt = await loadNuxt({
|
|
@@ -775,8 +779,16 @@ var analyze_default = defineCommand({
|
|
|
775
779
|
const buildDir = nuxt.options.buildDir;
|
|
776
780
|
const outDir = nuxt.options.nitro.output?.dir || join(nuxt.options.rootDir, ".output");
|
|
777
781
|
nuxt.options.build.analyze = defu$1(nuxt.options.build.analyze, { filename: join(analyzeDir, "client.html") });
|
|
782
|
+
const tasklog = taskLog({
|
|
783
|
+
title: "Building Nuxt with analysis enabled",
|
|
784
|
+
retainLog: false,
|
|
785
|
+
limit: 1
|
|
786
|
+
});
|
|
787
|
+
tasklog.message("Clearing analyze directory...");
|
|
778
788
|
await clearDir(analyzeDir);
|
|
789
|
+
tasklog.message("Building Nuxt...");
|
|
779
790
|
await buildNuxt(nuxt);
|
|
791
|
+
tasklog.success("Build complete");
|
|
780
792
|
const meta = {
|
|
781
793
|
name,
|
|
782
794
|
slug,
|
|
@@ -788,8 +800,7 @@ var analyze_default = defineCommand({
|
|
|
788
800
|
};
|
|
789
801
|
await nuxt.callHook("build:analyze:done", meta);
|
|
790
802
|
await promises.writeFile(join(analyzeDir, "meta.json"), JSON.stringify(meta, null, 2), "utf-8");
|
|
791
|
-
|
|
792
|
-
logger.warn("Do not deploy analyze results! Use `nuxi build` before deploying.");
|
|
803
|
+
note(`${relativeToProcess(analyzeDir)}\n\nDo not deploy analyze results! Use ${colors.cyan("nuxt build")} before deploying.`, "Build location");
|
|
793
804
|
if (ctx.args.serve !== false && !process.env.CI) {
|
|
794
805
|
const app = new H3();
|
|
795
806
|
const opts = { headers: { "content-type": "text/html" } };
|
|
@@ -797,12 +808,12 @@ var analyze_default = defineCommand({
|
|
|
797
808
|
const contents = await promises.readFile(filePath, "utf-8");
|
|
798
809
|
return () => new Response(contents, opts);
|
|
799
810
|
});
|
|
800
|
-
logger.
|
|
811
|
+
logger.step("Starting stats server...");
|
|
801
812
|
app.use("/client", serveFile(join(analyzeDir, "client.html")));
|
|
802
813
|
app.use("/nitro", serveFile(join(analyzeDir, "nitro.html")));
|
|
803
814
|
app.use(() => new Response(indexHtml, opts));
|
|
804
815
|
await serve(app).serve();
|
|
805
|
-
}
|
|
816
|
+
} else outro("✨ Analysis build complete!");
|
|
806
817
|
}
|
|
807
818
|
});
|
|
808
819
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
2
|
+
import { n as getPkgJSON, r as getPkgVersion } from "./versions-CUHtwDOW.mjs";
|
|
3
|
+
import { colors } from "consola/utils";
|
|
4
|
+
|
|
5
|
+
//#region ../nuxi/src/utils/banner.ts
|
|
6
|
+
function getBuilder(cwd, builder) {
|
|
7
|
+
switch (builder) {
|
|
8
|
+
case "rspack":
|
|
9
|
+
case "@nuxt/rspack-builder": return {
|
|
10
|
+
name: "Rspack",
|
|
11
|
+
version: getPkgVersion(cwd, "@rspack/core")
|
|
12
|
+
};
|
|
13
|
+
case "webpack":
|
|
14
|
+
case "@nuxt/webpack-builder": return {
|
|
15
|
+
name: "Webpack",
|
|
16
|
+
version: getPkgVersion(cwd, "webpack")
|
|
17
|
+
};
|
|
18
|
+
case "vite":
|
|
19
|
+
case "@nuxt/vite-builder":
|
|
20
|
+
default: {
|
|
21
|
+
const pkgJSON = getPkgJSON(cwd, "vite");
|
|
22
|
+
return {
|
|
23
|
+
name: pkgJSON.name.includes("rolldown") ? "Rolldown-Vite" : "Vite",
|
|
24
|
+
version: pkgJSON.version
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function showVersionsFromConfig(cwd, config) {
|
|
30
|
+
const { bold, gray, green } = colors;
|
|
31
|
+
const nuxtVersion = getPkgVersion(cwd, "nuxt") || getPkgVersion(cwd, "nuxt-nightly") || getPkgVersion(cwd, "nuxt3") || getPkgVersion(cwd, "nuxt-edge");
|
|
32
|
+
const nitroVersion = getPkgVersion(cwd, "nitropack") || getPkgVersion(cwd, "nitro") || getPkgVersion(cwd, "nitropack-nightly") || getPkgVersion(cwd, "nitropack-edge");
|
|
33
|
+
const builder = getBuilder(cwd, config.builder);
|
|
34
|
+
const vueVersion = getPkgVersion(cwd, "vue") || null;
|
|
35
|
+
logger.info(green(`Nuxt ${bold(nuxtVersion)}`) + gray(" (with ") + (nitroVersion ? gray(`Nitro ${bold(nitroVersion)}`) : "") + gray(`, ${builder.name} ${bold(builder.version)}`) + (vueVersion ? gray(` and Vue ${bold(vueVersion)}`) : "") + gray(")"));
|
|
36
|
+
}
|
|
37
|
+
async function showVersions(cwd, kit) {
|
|
38
|
+
return showVersionsFromConfig(cwd, await kit.loadNuxtConfig({ cwd }));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { showVersions as n, showVersionsFromConfig as r, getBuilder as t };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
3
|
import { t as loadKit } from "./kit-f7zsnm10.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { t as clearBuildDir } from "./fs
|
|
6
|
-
import { t as overrideEnv } from "./env-
|
|
4
|
+
import { n as showVersions } from "./banner-DQx8x98i.mjs";
|
|
5
|
+
import { t as clearBuildDir } from "./fs-CGUBNEba.mjs";
|
|
6
|
+
import { t as overrideEnv } from "./env-N36fDvz0.mjs";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { defineCommand } from "citty";
|
|
9
|
+
import { colors } from "consola/utils";
|
|
10
|
+
import { intro, outro } from "@clack/prompts";
|
|
9
11
|
import { relative, resolve } from "pathe";
|
|
10
12
|
|
|
11
13
|
//#region ../nuxi/src/commands/build.ts
|
|
@@ -33,6 +35,7 @@ var build_default = defineCommand({
|
|
|
33
35
|
async run(ctx) {
|
|
34
36
|
overrideEnv("production");
|
|
35
37
|
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
38
|
+
intro(colors.cyan("Building Nuxt for production..."));
|
|
36
39
|
const kit = await loadKit(cwd);
|
|
37
40
|
await showVersions(cwd, kit);
|
|
38
41
|
const nuxt = await kit.loadNuxt({
|
|
@@ -56,21 +59,24 @@ var build_default = defineCommand({
|
|
|
56
59
|
let nitro;
|
|
57
60
|
try {
|
|
58
61
|
nitro = kit.useNitro?.();
|
|
59
|
-
if (nitro) logger.info(`
|
|
62
|
+
if (nitro) logger.info(`Nitro preset: ${colors.cyan(nitro.options.preset)}`);
|
|
60
63
|
} catch {}
|
|
61
64
|
await clearBuildDir(nuxt.options.buildDir);
|
|
62
65
|
await kit.writeTypes(nuxt);
|
|
63
66
|
nuxt.hook("build:error", (err) => {
|
|
64
|
-
logger.error(
|
|
67
|
+
logger.error(`Nuxt build error: ${err}`);
|
|
65
68
|
process.exit(1);
|
|
66
69
|
});
|
|
67
70
|
await kit.buildNuxt(nuxt);
|
|
68
71
|
if (ctx.args.prerender) {
|
|
69
|
-
if (!nuxt.options.ssr)
|
|
72
|
+
if (!nuxt.options.ssr) {
|
|
73
|
+
logger.warn(`HTML content not prerendered because ${colors.cyan("ssr: false")} was set.`);
|
|
74
|
+
logger.info(`You can read more in ${colors.cyan("https://nuxt.com/docs/getting-started/deployment#static-hosting")}.`);
|
|
75
|
+
}
|
|
70
76
|
const dir = nitro?.options.output.publicDir;
|
|
71
77
|
const publicDir = dir ? relative(process.cwd(), dir) : ".output/public";
|
|
72
|
-
|
|
73
|
-
}
|
|
78
|
+
outro(`✨ You can now deploy ${colors.cyan(publicDir)} to any static hosting!`);
|
|
79
|
+
} else outro("✨ Build complete!");
|
|
74
80
|
}
|
|
75
81
|
});
|
|
76
82
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./_shared-C3vB2YLc.mjs";
|
|
2
|
+
import "./logger-Dd47z9E7.mjs";
|
|
3
|
+
import "./kit-f7zsnm10.mjs";
|
|
4
|
+
import "./versions-CUHtwDOW.mjs";
|
|
5
|
+
import "./banner-DQx8x98i.mjs";
|
|
6
|
+
import "./fs-CGUBNEba.mjs";
|
|
7
|
+
import "./env-N36fDvz0.mjs";
|
|
8
|
+
import { t as build_default } from "./build-BaZrKRCS.mjs";
|
|
9
|
+
|
|
10
|
+
export { build_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as legacyRootDirArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import "./logger-
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
3
|
import { t as loadKit } from "./kit-f7zsnm10.mjs";
|
|
4
|
-
import "./fs
|
|
5
|
-
import { t as cleanupNuxtDirs } from "./nuxt-
|
|
4
|
+
import "./fs-CGUBNEba.mjs";
|
|
5
|
+
import { t as cleanupNuxtDirs } from "./nuxt-8UELXZ2y.mjs";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
import { resolve } from "pathe";
|
|
8
8
|
|
|
@@ -24,6 +24,7 @@ var cleanup_default = defineCommand({
|
|
|
24
24
|
overrides: { dev: true }
|
|
25
25
|
});
|
|
26
26
|
await cleanupNuxtDirs(nuxtOptions.rootDir, nuxtOptions.buildDir);
|
|
27
|
+
logger.success("Cleanup complete!");
|
|
27
28
|
}
|
|
28
29
|
});
|
|
29
30
|
|
package/dist/dev/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import "../logger-
|
|
2
|
-
import { t as initialize } from "../dev-
|
|
1
|
+
import "../logger-Dd47z9E7.mjs";
|
|
2
|
+
import { t as initialize } from "../dev-DjmBDZYe.mjs";
|
|
3
3
|
import "../kit-f7zsnm10.mjs";
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
4
|
+
import "../versions-CUHtwDOW.mjs";
|
|
5
|
+
import "../banner-DQx8x98i.mjs";
|
|
6
|
+
import "../fs-CGUBNEba.mjs";
|
|
7
|
+
import "../nuxt-8UELXZ2y.mjs";
|
|
7
8
|
|
|
8
9
|
export { initialize };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as initialize } from "./dev-
|
|
2
|
+
import { n as logger, t as debug } from "./logger-Dd47z9E7.mjs";
|
|
3
|
+
import { t as initialize } from "./dev-DjmBDZYe.mjs";
|
|
4
4
|
import "./kit-f7zsnm10.mjs";
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import
|
|
5
|
+
import "./versions-CUHtwDOW.mjs";
|
|
6
|
+
import "./banner-DQx8x98i.mjs";
|
|
7
|
+
import "./fs-CGUBNEba.mjs";
|
|
8
|
+
import "./nuxt-8UELXZ2y.mjs";
|
|
9
|
+
import { t as overrideEnv } from "./env-N36fDvz0.mjs";
|
|
9
10
|
import process from "node:process";
|
|
10
11
|
import { defineCommand } from "citty";
|
|
11
12
|
import { isBun, isDeno, isTest } from "std-env";
|
|
13
|
+
import { colors } from "consola/utils";
|
|
12
14
|
import { resolve } from "pathe";
|
|
13
|
-
import { getArgs } from "listhen/cli";
|
|
14
15
|
import { satisfies } from "semver";
|
|
16
|
+
import { getArgs } from "listhen/cli";
|
|
15
17
|
import { fork } from "node:child_process";
|
|
16
18
|
|
|
17
19
|
//#region ../nuxi/src/dev/pool.ts
|
|
@@ -57,7 +59,7 @@ var ForkPool = class {
|
|
|
57
59
|
if (this.warming) this.warmFork();
|
|
58
60
|
return () => this.killFork(warmingFork);
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
debug("No pre-warmed forks available, starting cold fork");
|
|
61
63
|
const coldFork = this.createFork();
|
|
62
64
|
await coldFork.ready;
|
|
63
65
|
coldFork.state = "active";
|
|
@@ -224,7 +226,7 @@ const command = defineCommand({
|
|
|
224
226
|
});
|
|
225
227
|
onReady((_address) => {
|
|
226
228
|
pool.startWarming();
|
|
227
|
-
if (startTime)
|
|
229
|
+
if (startTime) debug(`Dev server ready for connections in ${Date.now() - startTime}ms`);
|
|
228
230
|
});
|
|
229
231
|
let cleanupCurrentFork;
|
|
230
232
|
async function restartWithFork() {
|
|
@@ -235,10 +237,10 @@ const command = defineCommand({
|
|
|
235
237
|
cleanupCurrentFork?.();
|
|
236
238
|
cleanupCurrentFork = await pool.getFork(context, (message) => {
|
|
237
239
|
if (message.type === "nuxt:internal:dev:ready") {
|
|
238
|
-
if (startTime)
|
|
240
|
+
if (startTime) debug(`Dev server ready for connections in ${Date.now() - startTime}ms`);
|
|
239
241
|
} else if (message.type === "nuxt:internal:dev:restart") restartWithFork();
|
|
240
242
|
else if (message.type === "nuxt:internal:dev:rejection") {
|
|
241
|
-
logger.info(`Restarting Nuxt due to error:
|
|
243
|
+
logger.info(`Restarting Nuxt due to error: ${colors.cyan(message.message)}`);
|
|
242
244
|
restartWithFork();
|
|
243
245
|
}
|
|
244
246
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as loadKit } from "./kit-f7zsnm10.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { t as clearBuildDir } from "./fs
|
|
4
|
-
import { a as writeNuxtManifest, i as resolveNuxtManifest, n as loadNuxtManifest } from "./nuxt-
|
|
2
|
+
import { r as showVersionsFromConfig } from "./banner-DQx8x98i.mjs";
|
|
3
|
+
import { t as clearBuildDir } from "./fs-CGUBNEba.mjs";
|
|
4
|
+
import { a as writeNuxtManifest, i as resolveNuxtManifest, n as loadNuxtManifest } from "./nuxt-8UELXZ2y.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { provider } from "std-env";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
@@ -25,7 +25,7 @@ var dev_child_default = defineCommand({
|
|
|
25
25
|
async run(ctx) {
|
|
26
26
|
if (!process.send && !isTest) console.warn("`nuxi _dev` is an internal command and should not be used directly. Please use `nuxi dev` instead.");
|
|
27
27
|
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
28
|
-
const { initialize } = await import("./dev-
|
|
28
|
+
const { initialize } = await import("./dev-pecSeV9d.mjs");
|
|
29
29
|
await initialize({
|
|
30
30
|
cwd,
|
|
31
31
|
args: ctx.args
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./logger-Dd47z9E7.mjs";
|
|
2
|
+
import { t as initialize } from "./dev-DjmBDZYe.mjs";
|
|
3
|
+
import "./kit-f7zsnm10.mjs";
|
|
4
|
+
import "./versions-CUHtwDOW.mjs";
|
|
5
|
+
import "./banner-DQx8x98i.mjs";
|
|
6
|
+
import "./fs-CGUBNEba.mjs";
|
|
7
|
+
import "./nuxt-8UELXZ2y.mjs";
|
|
8
|
+
|
|
9
|
+
export { initialize };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { a as legacyRootDirArgs, t as cwdArgs } from "./_shared-C3vB2YLc.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
|
+
import { colors } from "consola/utils";
|
|
5
6
|
import { resolve } from "pathe";
|
|
6
7
|
import { x } from "tinyexec";
|
|
7
8
|
|
|
@@ -23,7 +24,7 @@ var devtools_default = defineCommand({
|
|
|
23
24
|
async run(ctx) {
|
|
24
25
|
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
25
26
|
if (!["enable", "disable"].includes(ctx.args.command)) {
|
|
26
|
-
logger.error(`Unknown command
|
|
27
|
+
logger.error(`Unknown command ${colors.cyan(ctx.args.command)}.`);
|
|
27
28
|
process.exit(1);
|
|
28
29
|
}
|
|
29
30
|
await x("npx", [
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as logger } from "./logger-Dd47z9E7.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
|
+
import { colors } from "consola/utils";
|
|
3
4
|
|
|
4
5
|
//#region ../nuxi/src/utils/env.ts
|
|
5
6
|
function overrideEnv(targetEnv) {
|
|
6
7
|
const currentEnv = process.env.NODE_ENV;
|
|
7
|
-
if (currentEnv && currentEnv !== targetEnv) logger.warn(`Changing
|
|
8
|
+
if (currentEnv && currentEnv !== targetEnv) logger.warn(`Changing ${colors.cyan("NODE_ENV")} from ${colors.cyan(currentEnv)} to ${colors.cyan(targetEnv)}, to avoid unintended behavior.`);
|
|
8
9
|
process.env.NODE_ENV = targetEnv;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { colors } from "consola/utils";
|
|
3
|
+
import { stripVTControlCharacters } from "node:util";
|
|
4
|
+
|
|
5
|
+
//#region ../nuxi/src/utils/formatting.ts
|
|
6
|
+
function getStringWidth(str) {
|
|
7
|
+
const stripped = stripVTControlCharacters(str);
|
|
8
|
+
let width = 0;
|
|
9
|
+
for (const char of stripped) {
|
|
10
|
+
const code = char.codePointAt(0);
|
|
11
|
+
if (!code) continue;
|
|
12
|
+
if (code >= 65024 && code <= 65039) continue;
|
|
13
|
+
if (code >= 127744 && code <= 129535 || code >= 128512 && code <= 128591 || code >= 128640 && code <= 128767 || code >= 9728 && code <= 9983 || code >= 9984 && code <= 10175 || code >= 129280 && code <= 129535 || code >= 129648 && code <= 129791) width += 2;
|
|
14
|
+
else width += 1;
|
|
15
|
+
}
|
|
16
|
+
return width;
|
|
17
|
+
}
|
|
18
|
+
function formatInfoBox(infoObj) {
|
|
19
|
+
let firstColumnLength = 0;
|
|
20
|
+
let ansiFirstColumnLength = 0;
|
|
21
|
+
const entries = Object.entries(infoObj).map(([label, val]) => {
|
|
22
|
+
if (label.length > firstColumnLength) {
|
|
23
|
+
ansiFirstColumnLength = colors.bold(colors.whiteBright(label)).length + 6;
|
|
24
|
+
firstColumnLength = label.length + 6;
|
|
25
|
+
}
|
|
26
|
+
return [label, val || "-"];
|
|
27
|
+
});
|
|
28
|
+
const terminalWidth = Math.max(process.stdout.columns || 80, firstColumnLength) - 8;
|
|
29
|
+
let boxStr = "";
|
|
30
|
+
for (const [label, value] of entries) {
|
|
31
|
+
const formattedValue = value.replace(/\b@([^, ]+)/g, (_, r) => colors.gray(` ${r}`)).replace(/`([^`]*)`/g, (_, r) => r);
|
|
32
|
+
boxStr += `${colors.bold(colors.whiteBright(label))}`.padEnd(ansiFirstColumnLength);
|
|
33
|
+
let boxRowLength = firstColumnLength;
|
|
34
|
+
const words = formattedValue.split(" ");
|
|
35
|
+
let currentLine = "";
|
|
36
|
+
for (const word of words) {
|
|
37
|
+
const wordLength = getStringWidth(word);
|
|
38
|
+
const spaceLength = currentLine ? 1 : 0;
|
|
39
|
+
if (boxRowLength + wordLength + spaceLength > terminalWidth) {
|
|
40
|
+
if (currentLine) boxStr += colors.cyan(currentLine);
|
|
41
|
+
boxStr += `\n${" ".repeat(firstColumnLength)}`;
|
|
42
|
+
currentLine = word;
|
|
43
|
+
boxRowLength = firstColumnLength + wordLength;
|
|
44
|
+
} else {
|
|
45
|
+
currentLine += (currentLine ? " " : "") + word;
|
|
46
|
+
boxRowLength += wordLength + spaceLength;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (currentLine) boxStr += colors.cyan(currentLine);
|
|
50
|
+
boxStr += "\n";
|
|
51
|
+
}
|
|
52
|
+
return boxStr;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { formatInfoBox as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as debug } from "./logger-Dd47z9E7.mjs";
|
|
2
2
|
import { existsSync, promises } from "node:fs";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
|
|
@@ -28,7 +28,7 @@ function clearBuildDir(path) {
|
|
|
28
28
|
}
|
|
29
29
|
async function rmRecursive(paths) {
|
|
30
30
|
await Promise.all(paths.filter((p) => typeof p === "string").map(async (path) => {
|
|
31
|
-
|
|
31
|
+
debug(`Removing recursive path: ${path}`);
|
|
32
32
|
await promises.rm(path, {
|
|
33
33
|
recursive: true,
|
|
34
34
|
force: true
|