@nuxt/cli-nightly 3.31.0-20251112-163840-1b26dec → 3.31.0-20251115-162206-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-BA37QABT.mjs +11 -0
- package/dist/{add-yCkF7lke.mjs → add-BB21duDN.mjs} +25 -24
- package/dist/{add-CHVmfYrF.mjs → add-Cf7OzHv-.mjs} +17 -8
- package/dist/{analyze-6tANI65A.mjs → analyze-BJlJCX8O.mjs} +21 -10
- package/dist/banner-Blpi9Hr_.mjs +42 -0
- package/dist/{build-CVr-ruAe.mjs → build-Bj6SvxBM.mjs} +17 -11
- package/dist/build-DBWvcFW-.mjs +10 -0
- package/dist/{cleanup-X4v95Xqm.mjs → cleanup-BzlkRxus.mjs} +6 -5
- package/dist/dev/index.mjs +7 -6
- package/dist/{dev-Bf9P_WmH.mjs → dev-C4gdru5j.mjs} +4 -5
- package/dist/dev-IrffMl9I.mjs +9 -0
- package/dist/{dev-aS1afvp8.mjs → dev-OExs7NSz.mjs} +15 -13
- package/dist/{dev-child-GqhyRU2G.mjs → dev-child-I1Z58r9P.mjs} +2 -2
- package/dist/{devtools-BLGzUSNU.mjs → devtools-ChsGaImC.mjs} +4 -3
- package/dist/{env-CamzysGq.mjs → env-CsJKZjUY.mjs} +3 -2
- package/dist/formatting-V2rnOEP4.mjs +56 -0
- package/dist/{fs--ofMleGo.mjs → fs-DXG4022E.mjs} +2 -2
- package/dist/{generate-DZJF1Xf_.mjs → generate-vNNE4Ubc.mjs} +8 -7
- package/dist/index.mjs +22 -21
- package/dist/info-jlb3gDir.mjs +139 -0
- package/dist/{init-DX0yoR1B.mjs → init-WZcHIKB5.mjs} +56 -43
- package/dist/logger-B4ge7MhP.mjs +9 -0
- package/dist/{module-t-MDBA3Y.mjs → module-D0Vj5XRW.mjs} +2 -2
- package/dist/{nuxt-CfBR40hD.mjs → nuxt-tDl7zzU6.mjs} +2 -2
- package/dist/paths-h9M30EVL.mjs +11 -0
- package/dist/{prepare-DjR-jyiQ.mjs → prepare-CCNpwaXH.mjs} +8 -6
- package/dist/prepare-CZ03U8-g.mjs +8 -0
- package/dist/{preview-CgpLKg-X.mjs → preview-Cry38UiP.mjs} +30 -20
- package/dist/{search-D_JLXbhF.mjs → search-CwS3Uket.mjs} +32 -25
- package/dist/{test-CBt1emEB.mjs → test-pxuzy0gI.mjs} +2 -2
- package/dist/{typecheck-egvrxpjV.mjs → typecheck-BBhxRLKG.mjs} +3 -3
- package/dist/{upgrade-CblzcPw0.mjs → upgrade-yAnYW_ZG.mjs} +68 -43
- package/dist/versions-qQooIDFs.mjs +35 -0
- package/package.json +10 -8
- 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/{_shared-C3vB2YLc.mjs → _shared-BCYCnX0T.mjs} +0 -0
- /package/dist/{_utils-DTrPahho.mjs → _utils-MODGKAqe.mjs} +0 -0
- /package/dist/{kit-f7zsnm10.mjs → kit-xFxVGu6d.mjs} +0 -0
- /package/dist/{packageManagers-DbVB5cXf.mjs → packageManagers-BKxN4oEl.mjs} +0 -0
|
@@ -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-B4ge7MhP.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
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-
|
|
2
|
-
import "./logger-
|
|
3
|
-
import "./kit-
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
1
|
+
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import "./versions-qQooIDFs.mjs";
|
|
5
|
+
import "./banner-Blpi9Hr_.mjs";
|
|
6
|
+
import "./fs-DXG4022E.mjs";
|
|
7
|
+
import "./env-CsJKZjUY.mjs";
|
|
8
|
+
import { t as build_default } from "./build-Bj6SvxBM.mjs";
|
|
8
9
|
import { defineCommand } from "citty";
|
|
9
10
|
|
|
10
11
|
//#region ../nuxi/src/commands/generate.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { t as cwdArgs } from "./_shared-
|
|
2
|
-
import {
|
|
1
|
+
import { t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { defineCommand, runCommand as runCommand$1, runMain as runMain$1 } from "citty";
|
|
6
6
|
import { provider } from "std-env";
|
|
7
7
|
import { consola } from "consola";
|
|
8
|
+
import { colors } from "consola/utils";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
9
10
|
import tab from "@bomb.sh/tab/citty";
|
|
10
11
|
|
|
11
12
|
//#region ../nuxi/src/commands/index.ts
|
|
12
13
|
const _rDefault = (r) => r.default || r;
|
|
13
14
|
const commands = {
|
|
14
|
-
add: () => import("./add-
|
|
15
|
-
analyze: () => import("./analyze-
|
|
16
|
-
build: () => import("./build-
|
|
17
|
-
cleanup: () => import("./cleanup-
|
|
18
|
-
_dev: () => import("./dev-child-
|
|
19
|
-
dev: () => import("./dev-
|
|
20
|
-
devtools: () => import("./devtools-
|
|
21
|
-
generate: () => import("./generate-
|
|
22
|
-
info: () => import("./info-
|
|
23
|
-
init: () => import("./init-
|
|
24
|
-
module: () => import("./module-
|
|
25
|
-
prepare: () => import("./prepare-
|
|
26
|
-
preview: () => import("./preview-
|
|
27
|
-
start: () => import("./preview-
|
|
28
|
-
test: () => import("./test-
|
|
29
|
-
typecheck: () => import("./typecheck-
|
|
30
|
-
upgrade: () => import("./upgrade-
|
|
15
|
+
add: () => import("./add-Cf7OzHv-.mjs").then(_rDefault),
|
|
16
|
+
analyze: () => import("./analyze-BJlJCX8O.mjs").then(_rDefault),
|
|
17
|
+
build: () => import("./build-DBWvcFW-.mjs").then(_rDefault),
|
|
18
|
+
cleanup: () => import("./cleanup-BzlkRxus.mjs").then(_rDefault),
|
|
19
|
+
_dev: () => import("./dev-child-I1Z58r9P.mjs").then(_rDefault),
|
|
20
|
+
dev: () => import("./dev-OExs7NSz.mjs").then(_rDefault),
|
|
21
|
+
devtools: () => import("./devtools-ChsGaImC.mjs").then(_rDefault),
|
|
22
|
+
generate: () => import("./generate-vNNE4Ubc.mjs").then(_rDefault),
|
|
23
|
+
info: () => import("./info-jlb3gDir.mjs").then(_rDefault),
|
|
24
|
+
init: () => import("./init-WZcHIKB5.mjs").then(_rDefault),
|
|
25
|
+
module: () => import("./module-D0Vj5XRW.mjs").then(_rDefault),
|
|
26
|
+
prepare: () => import("./prepare-CZ03U8-g.mjs").then(_rDefault),
|
|
27
|
+
preview: () => import("./preview-Cry38UiP.mjs").then(_rDefault),
|
|
28
|
+
start: () => import("./preview-Cry38UiP.mjs").then(_rDefault),
|
|
29
|
+
test: () => import("./test-pxuzy0gI.mjs").then(_rDefault),
|
|
30
|
+
typecheck: () => import("./typecheck-BBhxRLKG.mjs").then(_rDefault),
|
|
31
|
+
upgrade: () => import("./upgrade-yAnYW_ZG.mjs").then(_rDefault)
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
//#endregion
|
|
@@ -58,13 +59,13 @@ async function checkEngines() {
|
|
|
58
59
|
const satisfies = await import("semver/functions/satisfies.js").then((r) => r.default || r);
|
|
59
60
|
const currentNode = process.versions.node;
|
|
60
61
|
const nodeRange = ">= 18.0.0";
|
|
61
|
-
if (!satisfies(currentNode, nodeRange)) logger.warn(`Current version of Node.js (
|
|
62
|
+
if (!satisfies(currentNode, nodeRange)) logger.warn(`Current version of Node.js (${colors.cyan(currentNode)}) is unsupported and might cause issues.\n Please upgrade to a compatible version ${colors.cyan(nodeRange)}.`);
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
//#endregion
|
|
65
66
|
//#region package.json
|
|
66
67
|
var name = "@nuxt/cli-nightly";
|
|
67
|
-
var version = "3.31.0-
|
|
68
|
+
var version = "3.31.0-20251115-162206-ab4e0c6";
|
|
68
69
|
var description = "Nuxt CLI";
|
|
69
70
|
|
|
70
71
|
//#endregion
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { a as legacyRootDirArgs, t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import { n as tryResolveNuxt } from "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import "./versions-qQooIDFs.mjs";
|
|
5
|
+
import { t as getBuilder } from "./banner-Blpi9Hr_.mjs";
|
|
6
|
+
import { t as formatInfoBox } from "./formatting-V2rnOEP4.mjs";
|
|
7
|
+
import { t as getPackageManagerVersion } from "./packageManagers-BKxN4oEl.mjs";
|
|
8
|
+
import process from "node:process";
|
|
9
|
+
import { defineCommand } from "citty";
|
|
10
|
+
import { isBun, isDeno, isMinimal } from "std-env";
|
|
11
|
+
import { colors } from "consola/utils";
|
|
12
|
+
import { box } from "@clack/prompts";
|
|
13
|
+
import { resolve } from "pathe";
|
|
14
|
+
import { readPackageJSON } from "pkg-types";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import { copy } from "copy-paste";
|
|
17
|
+
import { detectPackageManager } from "nypm";
|
|
18
|
+
|
|
19
|
+
//#region ../nuxi/package.json
|
|
20
|
+
var version = "3.31.0-20251115-162155-ab4e0c6";
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../nuxi/src/commands/info.ts
|
|
24
|
+
var info_default = defineCommand({
|
|
25
|
+
meta: {
|
|
26
|
+
name: "info",
|
|
27
|
+
description: "Get information about Nuxt project"
|
|
28
|
+
},
|
|
29
|
+
args: {
|
|
30
|
+
...cwdArgs,
|
|
31
|
+
...legacyRootDirArgs
|
|
32
|
+
},
|
|
33
|
+
async run(ctx) {
|
|
34
|
+
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
35
|
+
const nuxtConfig = await getNuxtConfig(cwd);
|
|
36
|
+
const { dependencies = {}, devDependencies = {} } = await readPackageJSON(cwd).catch(() => ({}));
|
|
37
|
+
const nuxtPath = tryResolveNuxt(cwd);
|
|
38
|
+
async function getDepVersion(name) {
|
|
39
|
+
for (const url of [cwd, nuxtPath]) {
|
|
40
|
+
if (!url) continue;
|
|
41
|
+
const pkg = await readPackageJSON(name, { url }).catch(() => null);
|
|
42
|
+
if (pkg) return pkg.version;
|
|
43
|
+
}
|
|
44
|
+
return dependencies[name] || devDependencies[name];
|
|
45
|
+
}
|
|
46
|
+
async function listModules(arr = []) {
|
|
47
|
+
const info = [];
|
|
48
|
+
for (let m of arr) {
|
|
49
|
+
if (Array.isArray(m)) m = m[0];
|
|
50
|
+
const name = normalizeConfigModule(m, cwd);
|
|
51
|
+
if (name) {
|
|
52
|
+
const v = await getDepVersion(name.split("/").splice(0, 2).join("/"));
|
|
53
|
+
info.push(`\`${v ? `${name}@${v}` : name}\``);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return info.join(", ");
|
|
57
|
+
}
|
|
58
|
+
const nuxtVersion = await getDepVersion("nuxt") || await getDepVersion("nuxt-nightly") || await getDepVersion("nuxt-edge") || await getDepVersion("nuxt3") || "-";
|
|
59
|
+
const isLegacy = nuxtVersion.startsWith("2");
|
|
60
|
+
const builder = !isLegacy ? nuxtConfig.builder || "vite" : nuxtConfig.bridge?.vite ? "vite" : nuxtConfig.buildModules?.includes("nuxt-vite") ? "vite" : "webpack";
|
|
61
|
+
let packageManager = (await detectPackageManager(cwd))?.name;
|
|
62
|
+
if (packageManager) packageManager += `@${getPackageManagerVersion(packageManager)}`;
|
|
63
|
+
const osType = os.type();
|
|
64
|
+
const builderInfo = typeof builder === "string" ? getBuilder(cwd, builder) : {
|
|
65
|
+
name: "custom",
|
|
66
|
+
version: "0.0.0"
|
|
67
|
+
};
|
|
68
|
+
const infoObj = {
|
|
69
|
+
"Operating system": osType === "Darwin" ? `macOS ${os.release()}` : osType === "Windows_NT" ? `Windows ${os.release()}` : `${osType} ${os.release()}`,
|
|
70
|
+
"CPU": `${os.cpus()[0]?.model || "unknown"} (${os.cpus().length} cores)`,
|
|
71
|
+
...isBun ? { "Bun version": Bun?.version } : isDeno ? { "Deno version": Deno?.version.deno } : { "Node.js version": process.version },
|
|
72
|
+
"nuxt/cli version": version,
|
|
73
|
+
"Package manager": packageManager ?? "unknown",
|
|
74
|
+
"Nuxt version": nuxtVersion,
|
|
75
|
+
"Nitro version": await getDepVersion("nitropack") || await getDepVersion("nitro"),
|
|
76
|
+
"Builder": builderInfo.name === "custom" ? "custom" : `${builderInfo.name.toLowerCase()}@${builderInfo.version}`,
|
|
77
|
+
"Config": Object.keys(nuxtConfig).map((key) => `\`${key}\``).sort().join(", "),
|
|
78
|
+
"Modules": await listModules(nuxtConfig.modules),
|
|
79
|
+
...isLegacy ? { "Build modules": await listModules(nuxtConfig.buildModules || []) } : {}
|
|
80
|
+
};
|
|
81
|
+
logger.info(`Nuxt root directory: ${colors.cyan(nuxtConfig.rootDir || cwd)}\n`);
|
|
82
|
+
const boxStr = formatInfoBox(infoObj);
|
|
83
|
+
let firstColumnLength = 0;
|
|
84
|
+
let secondColumnLength = 0;
|
|
85
|
+
const entries = Object.entries(infoObj).map(([label, val]) => {
|
|
86
|
+
if (label.length > firstColumnLength) firstColumnLength = label.length + 4;
|
|
87
|
+
if ((val || "").length > secondColumnLength) secondColumnLength = (val || "").length + 2;
|
|
88
|
+
return [label, val || "-"];
|
|
89
|
+
});
|
|
90
|
+
let copyStr = `| ${" ".repeat(firstColumnLength)} | ${" ".repeat(secondColumnLength)} |\n| ${"-".repeat(firstColumnLength)} | ${"-".repeat(secondColumnLength)} |\n`;
|
|
91
|
+
for (const [label, value] of entries) if (!isMinimal) copyStr += `| ${`**${label}**`.padEnd(firstColumnLength)} | ${(value.includes("`") ? value : `\`${value}\``).padEnd(secondColumnLength)} |\n`;
|
|
92
|
+
const copied = !isMinimal && await new Promise((resolve$1) => copy(copyStr, (err) => resolve$1(!err)));
|
|
93
|
+
box(`\n${boxStr}`, ` Nuxt project info ${copied ? colors.gray("(copied to clipboard) ") : ""}`, {
|
|
94
|
+
contentAlign: "left",
|
|
95
|
+
titleAlign: "left",
|
|
96
|
+
width: "auto",
|
|
97
|
+
titlePadding: 2,
|
|
98
|
+
contentPadding: 2,
|
|
99
|
+
rounded: true
|
|
100
|
+
});
|
|
101
|
+
const isNuxt3 = !isLegacy;
|
|
102
|
+
const isBridge = !isNuxt3 && infoObj["Build modules"]?.includes("bridge");
|
|
103
|
+
const repo = isBridge ? "nuxt/bridge" : "nuxt/nuxt";
|
|
104
|
+
const docsURL = isNuxt3 || isBridge ? "https://nuxt.com" : "https://v2.nuxt.com";
|
|
105
|
+
logger.info(`👉 Read documentation: ${colors.cyan(docsURL)}`);
|
|
106
|
+
if (isNuxt3 || isBridge) {
|
|
107
|
+
logger.info(`👉 Report an issue: ${colors.cyan(`https://github.com/${repo}/issues/new?template=bug-report.yml`)}`, { spacing: 0 });
|
|
108
|
+
logger.info(`👉 Suggest an improvement: ${colors.cyan(`https://github.com/${repo}/discussions/new`)}`, { spacing: 0 });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
function normalizeConfigModule(module, rootDir) {
|
|
113
|
+
if (!module) return null;
|
|
114
|
+
if (typeof module === "string") return module.split(rootDir).pop().split("node_modules").pop().replace(/^\//, "");
|
|
115
|
+
if (typeof module === "function") return `${module.name}()`;
|
|
116
|
+
if (Array.isArray(module)) return normalizeConfigModule(module[0], rootDir);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
async function getNuxtConfig(rootDir) {
|
|
120
|
+
try {
|
|
121
|
+
const { createJiti } = await import("jiti");
|
|
122
|
+
const jiti = createJiti(rootDir, {
|
|
123
|
+
interopDefault: true,
|
|
124
|
+
alias: {
|
|
125
|
+
"~": rootDir,
|
|
126
|
+
"@": rootDir
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
globalThis.defineNuxtConfig = (c) => c;
|
|
130
|
+
const result = await jiti.import("./nuxt.config", { default: true });
|
|
131
|
+
delete globalThis.defineNuxtConfig;
|
|
132
|
+
return result;
|
|
133
|
+
} catch {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
//#endregion
|
|
139
|
+
export { info_default as default };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { o as logLevelArgs, t as cwdArgs } from "./_shared-
|
|
2
|
-
import {
|
|
3
|
-
import "./kit-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import "./
|
|
8
|
-
import "./
|
|
1
|
+
import { o as logLevelArgs, t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import "./versions-qQooIDFs.mjs";
|
|
5
|
+
import "./fs-DXG4022E.mjs";
|
|
6
|
+
import { t as relativeToProcess } from "./paths-h9M30EVL.mjs";
|
|
7
|
+
import { n as runCommand$1, t as add_default } from "./add-BB21duDN.mjs";
|
|
8
|
+
import "./prepare-CCNpwaXH.mjs";
|
|
9
|
+
import "./_utils-MODGKAqe.mjs";
|
|
9
10
|
import process from "node:process";
|
|
10
11
|
import { defineCommand } from "citty";
|
|
11
12
|
import { hasTTY } from "std-env";
|
|
13
|
+
import { colors } from "consola/utils";
|
|
14
|
+
import { box, cancel, confirm, intro, isCancel, multiselect, outro, select, spinner, tasks, text } from "@clack/prompts";
|
|
12
15
|
import { existsSync } from "node:fs";
|
|
13
16
|
import { basename, join, relative, resolve } from "pathe";
|
|
14
|
-
import {
|
|
17
|
+
import { findFile, readPackageJSON, writePackageJSON } from "pkg-types";
|
|
15
18
|
import { x } from "tinyexec";
|
|
16
19
|
import { installDependencies } from "nypm";
|
|
17
|
-
import { findFile, readPackageJSON, writePackageJSON } from "pkg-types";
|
|
18
|
-
import { box as box$1, cancel, confirm, isCancel, multiselect, outro, select, text } from "@clack/prompts";
|
|
19
20
|
import { downloadTemplate, startShell } from "giget";
|
|
20
21
|
import { $fetch } from "ofetch";
|
|
21
22
|
|
|
@@ -53,7 +54,7 @@ async function getModuleDependencies(moduleName) {
|
|
|
53
54
|
const dependencies = (await $fetch(`https://registry.npmjs.org/${moduleName}/latest`)).dependencies || {};
|
|
54
55
|
return Object.keys(dependencies);
|
|
55
56
|
} catch (err) {
|
|
56
|
-
logger.warn(`Could not get dependencies for ${moduleName}: ${err}`);
|
|
57
|
+
logger.warn(`Could not get dependencies for ${colors.cyan(moduleName)}: ${err}`);
|
|
57
58
|
return [];
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -151,7 +152,7 @@ var init_default = defineCommand({
|
|
|
151
152
|
},
|
|
152
153
|
async run(ctx) {
|
|
153
154
|
if (hasTTY) process.stdout.write(`\n${nuxtIcon}\n\n`);
|
|
154
|
-
|
|
155
|
+
intro(colors.bold(`Welcome to Nuxt!`.split("").map((m) => `${themeColor}${m}`).join("")));
|
|
155
156
|
if (ctx.args.dir === "") {
|
|
156
157
|
const result = await text({
|
|
157
158
|
message: "Where would you like to create your project?",
|
|
@@ -166,7 +167,7 @@ var init_default = defineCommand({
|
|
|
166
167
|
}
|
|
167
168
|
const cwd = resolve(ctx.args.cwd);
|
|
168
169
|
let templateDownloadPath = resolve(cwd, ctx.args.dir);
|
|
169
|
-
logger.
|
|
170
|
+
logger.step(`Creating project in ${colors.cyan(relativeToProcess(templateDownloadPath))}`);
|
|
170
171
|
const templateName = ctx.args.template || DEFAULT_TEMPLATE_NAME;
|
|
171
172
|
if (typeof templateName !== "string") {
|
|
172
173
|
logger.error("Please specify a template!");
|
|
@@ -175,7 +176,7 @@ var init_default = defineCommand({
|
|
|
175
176
|
let shouldForce = Boolean(ctx.args.force);
|
|
176
177
|
if (!shouldForce && existsSync(templateDownloadPath)) {
|
|
177
178
|
const selectedAction = await select({
|
|
178
|
-
message: `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`,
|
|
179
|
+
message: `The directory ${colors.cyan(relativeToProcess(templateDownloadPath))} already exists. What would you like to do?`,
|
|
179
180
|
options: [
|
|
180
181
|
{
|
|
181
182
|
value: "override",
|
|
@@ -213,6 +214,8 @@ var init_default = defineCommand({
|
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
let template;
|
|
217
|
+
const downloadSpinner = spinner();
|
|
218
|
+
downloadSpinner.start(`Downloading ${colors.cyan(templateName)} template`);
|
|
216
219
|
try {
|
|
217
220
|
template = await downloadTemplate(templateName, {
|
|
218
221
|
dir: templateDownloadPath,
|
|
@@ -237,7 +240,9 @@ var init_default = defineCommand({
|
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
}
|
|
243
|
+
downloadSpinner.stop(`Downloaded ${colors.cyan(template.name)} template`);
|
|
240
244
|
} catch (err) {
|
|
245
|
+
downloadSpinner.stop("Template download failed", 1);
|
|
241
246
|
if (process.env.DEBUG) throw err;
|
|
242
247
|
logger.error(err.toString());
|
|
243
248
|
process.exit(1);
|
|
@@ -251,7 +256,7 @@ var init_default = defineCommand({
|
|
|
251
256
|
}
|
|
252
257
|
const nightlyChannelVersion = response["dist-tags"][nightlyChannelTag];
|
|
253
258
|
if (!nightlyChannelVersion) {
|
|
254
|
-
logger.error(`Nightly channel version for tag
|
|
259
|
+
logger.error(`Nightly channel version for tag ${colors.cyan(nightlyChannelTag)} not found.`);
|
|
255
260
|
process.exit(1);
|
|
256
261
|
}
|
|
257
262
|
const nightlyNuxtPackageJsonVersion = `npm:nuxt-nightly@${nightlyChannelVersion}`;
|
|
@@ -288,24 +293,6 @@ var init_default = defineCommand({
|
|
|
288
293
|
}
|
|
289
294
|
selectedPackageManager = result;
|
|
290
295
|
}
|
|
291
|
-
if (ctx.args.install === false) logger.info("Skipping install dependencies step.");
|
|
292
|
-
else {
|
|
293
|
-
logger.start("Installing dependencies...");
|
|
294
|
-
try {
|
|
295
|
-
await installDependencies({
|
|
296
|
-
cwd: template.dir,
|
|
297
|
-
packageManager: {
|
|
298
|
-
name: selectedPackageManager,
|
|
299
|
-
command: selectedPackageManager
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
} catch (err) {
|
|
303
|
-
if (process.env.DEBUG) throw err;
|
|
304
|
-
logger.error(err.toString());
|
|
305
|
-
process.exit(1);
|
|
306
|
-
}
|
|
307
|
-
logger.success("Installation completed.");
|
|
308
|
-
}
|
|
309
296
|
if (ctx.args.gitInit === void 0) {
|
|
310
297
|
const result = await confirm({ message: "Initialize git repository?" });
|
|
311
298
|
if (isCancel(result)) {
|
|
@@ -314,15 +301,41 @@ var init_default = defineCommand({
|
|
|
314
301
|
}
|
|
315
302
|
ctx.args.gitInit = result;
|
|
316
303
|
}
|
|
317
|
-
if (ctx.args.
|
|
318
|
-
|
|
304
|
+
if (ctx.args.install === false) logger.info("Skipping install dependencies step.");
|
|
305
|
+
else {
|
|
306
|
+
const setupTasks = [{
|
|
307
|
+
title: `Installing dependencies with ${colors.cyan(selectedPackageManager)}`,
|
|
308
|
+
task: async () => {
|
|
309
|
+
await installDependencies({
|
|
310
|
+
cwd: template.dir,
|
|
311
|
+
packageManager: {
|
|
312
|
+
name: selectedPackageManager,
|
|
313
|
+
command: selectedPackageManager
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
return "Dependencies installed";
|
|
317
|
+
}
|
|
318
|
+
}];
|
|
319
|
+
if (ctx.args.gitInit) setupTasks.push({
|
|
320
|
+
title: "Initializing git repository",
|
|
321
|
+
task: async () => {
|
|
322
|
+
try {
|
|
323
|
+
await x("git", ["init", template.dir], {
|
|
324
|
+
throwOnError: true,
|
|
325
|
+
nodeOptions: { stdio: "inherit" }
|
|
326
|
+
});
|
|
327
|
+
return "Git repository initialized";
|
|
328
|
+
} catch (err) {
|
|
329
|
+
return `Git initialization failed: ${err}`;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
});
|
|
319
333
|
try {
|
|
320
|
-
await
|
|
321
|
-
throwOnError: true,
|
|
322
|
-
nodeOptions: { stdio: "inherit" }
|
|
323
|
-
});
|
|
334
|
+
await tasks(setupTasks);
|
|
324
335
|
} catch (err) {
|
|
325
|
-
|
|
336
|
+
if (process.env.DEBUG) throw err;
|
|
337
|
+
logger.error(err.toString());
|
|
338
|
+
process.exit(1);
|
|
326
339
|
}
|
|
327
340
|
}
|
|
328
341
|
const modulesToAdd = [];
|
|
@@ -366,10 +379,10 @@ var init_default = defineCommand({
|
|
|
366
379
|
ctx.args.install ? "" : "--skipInstall",
|
|
367
380
|
ctx.args.logLevel ? `--logLevel=${ctx.args.logLevel}` : ""
|
|
368
381
|
].filter(Boolean));
|
|
369
|
-
outro(`✨ Nuxt project has been created with the
|
|
382
|
+
outro(`✨ Nuxt project has been created with the ${colors.cyan(template.name)} template.`);
|
|
370
383
|
const relativeTemplateDir = relative(process.cwd(), template.dir) || ".";
|
|
371
384
|
const runCmd = selectedPackageManager === "deno" ? "task" : "run";
|
|
372
|
-
box
|
|
385
|
+
box(`\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 `, {
|
|
373
386
|
contentAlign: "left",
|
|
374
387
|
titleAlign: "left",
|
|
375
388
|
width: "auto",
|
|
@@ -8,8 +8,8 @@ var module_default = defineCommand({
|
|
|
8
8
|
},
|
|
9
9
|
args: {},
|
|
10
10
|
subCommands: {
|
|
11
|
-
add: () => import("./add-
|
|
12
|
-
search: () => import("./search-
|
|
11
|
+
add: () => import("./add-BA37QABT.mjs").then((r) => r.default || r),
|
|
12
|
+
search: () => import("./search-CwS3Uket.mjs").then((r) => r.default || r)
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as rmRecursive } from "./fs
|
|
1
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
2
|
+
import { r as rmRecursive } from "./fs-DXG4022E.mjs";
|
|
3
3
|
import { promises } from "node:fs";
|
|
4
4
|
import { dirname, resolve } from "pathe";
|
|
5
5
|
import { hash } from "ohash";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { relative } from "pathe";
|
|
3
|
+
|
|
4
|
+
//#region ../nuxi/src/utils/paths.ts
|
|
5
|
+
const cwd = process.cwd();
|
|
6
|
+
function relativeToProcess(path) {
|
|
7
|
+
return relative(cwd, path) || path;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { relativeToProcess as t };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-
|
|
2
|
-
import {
|
|
3
|
-
import { t as loadKit } from "./kit-
|
|
4
|
-
import { t as clearBuildDir } from "./fs
|
|
1
|
+
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import { t as loadKit } from "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import { t as clearBuildDir } from "./fs-DXG4022E.mjs";
|
|
5
|
+
import { t as relativeToProcess } from "./paths-h9M30EVL.mjs";
|
|
5
6
|
import process from "node:process";
|
|
6
7
|
import { defineCommand } from "citty";
|
|
7
|
-
import {
|
|
8
|
+
import { colors } from "consola/utils";
|
|
9
|
+
import { resolve } from "pathe";
|
|
8
10
|
|
|
9
11
|
//#region ../nuxi/src/commands/prepare.ts
|
|
10
12
|
var prepare_default = defineCommand({
|
|
@@ -41,7 +43,7 @@ var prepare_default = defineCommand({
|
|
|
41
43
|
await clearBuildDir(nuxt.options.buildDir);
|
|
42
44
|
await buildNuxt(nuxt);
|
|
43
45
|
await writeTypes(nuxt);
|
|
44
|
-
logger.success(
|
|
46
|
+
logger.success(`Types generated in ${colors.cyan(relativeToProcess(nuxt.options.buildDir))}.`);
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import "./fs-DXG4022E.mjs";
|
|
5
|
+
import "./paths-h9M30EVL.mjs";
|
|
6
|
+
import { t as prepare_default } from "./prepare-CCNpwaXH.mjs";
|
|
7
|
+
|
|
8
|
+
export { prepare_default as default };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-
|
|
2
|
-
import {
|
|
3
|
-
import { t as loadKit } from "./kit-
|
|
4
|
-
import {
|
|
1
|
+
import { a as legacyRootDirArgs, i as extendsArgs, n as dotEnvArgs, o as logLevelArgs, r as envNameArgs, t as cwdArgs } from "./_shared-BCYCnX0T.mjs";
|
|
2
|
+
import { n as logger } from "./logger-B4ge7MhP.mjs";
|
|
3
|
+
import { t as loadKit } from "./kit-xFxVGu6d.mjs";
|
|
4
|
+
import { t as relativeToProcess } from "./paths-h9M30EVL.mjs";
|
|
5
|
+
import { dirname } from "node:path";
|
|
5
6
|
import process from "node:process";
|
|
6
7
|
import { defineCommand } from "citty";
|
|
8
|
+
import { colors } from "consola/utils";
|
|
9
|
+
import { box, outro } from "@clack/prompts";
|
|
7
10
|
import { existsSync, promises } from "node:fs";
|
|
8
11
|
import { resolve as resolve$1 } from "pathe";
|
|
9
|
-
import { box, colors } from "consola/utils";
|
|
10
12
|
import { x } from "tinyexec";
|
|
11
13
|
import { setupDotenv } from "c12";
|
|
12
14
|
|
|
@@ -50,7 +52,7 @@ const command = defineCommand({
|
|
|
50
52
|
}), resolve$1(cwd, ".output", "nitro.json")].filter(Boolean);
|
|
51
53
|
const nitroJSONPath = nitroJSONPaths.find((p) => existsSync(p));
|
|
52
54
|
if (!nitroJSONPath) {
|
|
53
|
-
logger.error(
|
|
55
|
+
logger.error(`Cannot find ${colors.cyan("nitro.json")}. Did you run ${colors.cyan("nuxi build")} first? Search path:\n${nitroJSONPaths.join("\n")}`);
|
|
54
56
|
process.exit(1);
|
|
55
57
|
}
|
|
56
58
|
const outputPath = dirname(nitroJSONPath);
|
|
@@ -61,31 +63,39 @@ const command = defineCommand({
|
|
|
61
63
|
}
|
|
62
64
|
const info = [
|
|
63
65
|
["Node.js:", `v${process.versions.node}`],
|
|
64
|
-
["Nitro
|
|
65
|
-
["Working directory:",
|
|
66
|
+
["Nitro preset:", nitroJSON.preset],
|
|
67
|
+
["Working directory:", relativeToProcess(outputPath)]
|
|
66
68
|
];
|
|
67
69
|
const _infoKeyLen = Math.max(...info.map(([label]) => label.length));
|
|
68
|
-
logger.
|
|
69
|
-
|
|
70
|
-
`For production deployments, please directly use ${colors.cyan(nitroJSON.commands.preview)} command.`,
|
|
70
|
+
logger.message("");
|
|
71
|
+
box([
|
|
71
72
|
"",
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
"You are previewing a Nuxt app. In production, do not use this CLI. ",
|
|
74
|
+
`Instead, run ${colors.cyan(nitroJSON.commands.preview)} directly.`,
|
|
75
|
+
"",
|
|
76
|
+
...info.map(([label, value]) => `${label.padEnd(_infoKeyLen, " ")} ${colors.cyan(value)}`),
|
|
77
|
+
""
|
|
78
|
+
].join("\n"), colors.yellow(" Previewing Nuxt app "), {
|
|
79
|
+
contentAlign: "left",
|
|
80
|
+
titleAlign: "left",
|
|
81
|
+
width: "auto",
|
|
82
|
+
titlePadding: 2,
|
|
83
|
+
contentPadding: 2,
|
|
84
|
+
rounded: true,
|
|
85
|
+
includePrefix: true,
|
|
86
|
+
formatBorder: (text$1) => colors.yellow(text$1)
|
|
87
|
+
});
|
|
77
88
|
const envFileName = ctx.args.dotenv || ".env";
|
|
78
89
|
if (existsSync(resolve$1(cwd, envFileName))) {
|
|
79
|
-
logger.info(`Loading
|
|
90
|
+
logger.info(`Loading ${colors.cyan(envFileName)}. This will not be loaded when running the server in production.`);
|
|
80
91
|
await setupDotenv({
|
|
81
92
|
cwd,
|
|
82
93
|
fileName: envFileName
|
|
83
94
|
});
|
|
84
|
-
} else if (ctx.args.dotenv) logger.error(`Cannot find
|
|
95
|
+
} else if (ctx.args.dotenv) logger.error(`Cannot find ${colors.cyan(envFileName)}.`);
|
|
85
96
|
const port = ctx.args.port ?? process.env.NUXT_PORT ?? process.env.NITRO_PORT ?? process.env.PORT;
|
|
86
|
-
|
|
97
|
+
outro(`Running ${colors.cyan(nitroJSON.commands.preview)} in ${colors.cyan(relativeToProcess(outputPath))}`);
|
|
87
98
|
const [command$1, ...commandArgs] = nitroJSON.commands.preview.split(" ");
|
|
88
|
-
logger.log("");
|
|
89
99
|
await x(command$1, commandArgs, {
|
|
90
100
|
throwOnError: true,
|
|
91
101
|
nodeOptions: {
|