@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.
- package/dist/_shared-C3vB2YLc.mjs +42 -0
- package/dist/_utils-DTrPahho.mjs +29 -0
- package/dist/add-BGMHIn5L.mjs +333 -0
- package/dist/add-CRBwIlDF.mjs +298 -0
- package/dist/add-hFFIzkcy.mjs +10 -0
- package/dist/analyze-CUKAi_IN.mjs +115 -0
- package/dist/banner-CqfM_0Qo.mjs +55 -0
- package/dist/build-BSxJLNs_.mjs +78 -0
- package/dist/build-KNIBU0AI.mjs +9 -0
- package/dist/cleanup-8GRakeLu.mjs +31 -0
- package/dist/dev/index.d.mts +87 -83
- package/dist/dev/index.mjs +7 -23
- package/dist/dev-Bs_0dzlh.mjs +591 -0
- package/dist/dev-CnQwDUaD.mjs +7 -0
- package/dist/dev-L7lhoThJ.mjs +438 -0
- package/dist/dev-child-CSiX6Uyv.mjs +37 -0
- package/dist/devtools-BLGzUSNU.mjs +44 -0
- package/dist/env-Dz4K_NkM.mjs +12 -0
- package/dist/fs-ewAp6tjM.mjs +40 -0
- package/dist/generate-CGy3-x2K.mjs +35 -0
- package/dist/index.d.mts +9 -18
- package/dist/index.mjs +129 -8
- package/dist/info-BDdsghj1.mjs +120 -0
- package/dist/init-_n9DXzzY.mjs +336 -0
- package/dist/kit-xFxVGu6d.mjs +37 -0
- package/dist/logger-Dk0gkCkX.mjs +7 -0
- package/dist/module-CqBrGD-s.mjs +17 -0
- package/dist/nuxt-Cc9ZTk7m.mjs +44 -0
- package/dist/packageManagers-DbVB5cXf.mjs +9 -0
- package/dist/prepare-B0KOhO-L.mjs +7 -0
- package/dist/prepare-xI978yFg.mjs +49 -0
- package/dist/preview-C5fNqrC6.mjs +109 -0
- package/dist/search-DCyXfxzn.mjs +113 -0
- package/dist/test-CBt1emEB.mjs +55 -0
- package/dist/typecheck-DCWe7Iej.mjs +102 -0
- package/dist/upgrade-BMSFcUWJ.mjs +184 -0
- package/dist/versions-CSy_3o_-.mjs +18 -0
- package/package.json +13 -13
- package/dist/chunks/add.mjs +0 -381
- package/dist/chunks/add2.mjs +0 -319
- package/dist/chunks/analyze.mjs +0 -139
- package/dist/chunks/build.mjs +0 -94
- package/dist/chunks/cleanup.mjs +0 -34
- package/dist/chunks/dev-child.mjs +0 -38
- package/dist/chunks/dev.mjs +0 -709
- package/dist/chunks/devtools.mjs +0 -46
- package/dist/chunks/generate.mjs +0 -45
- package/dist/chunks/index.mjs +0 -507
- package/dist/chunks/index2.mjs +0 -15
- package/dist/chunks/info.mjs +0 -150
- package/dist/chunks/init.mjs +0 -413
- package/dist/chunks/prepare.mjs +0 -57
- package/dist/chunks/preview.mjs +0 -131
- package/dist/chunks/search.mjs +0 -114
- package/dist/chunks/test.mjs +0 -62
- package/dist/chunks/typecheck.mjs +0 -85
- package/dist/chunks/upgrade.mjs +0 -214
- package/dist/dev/index.d.ts +0 -94
- package/dist/index.d.ts +0 -23
- package/dist/shared/cli-nightly.B9AmABr3.mjs +0 -5
- package/dist/shared/cli-nightly.BRlCc6aT.mjs +0 -204
- package/dist/shared/cli-nightly.BSm0_9Hr.mjs +0 -7
- package/dist/shared/cli-nightly.Bu_9IHj2.mjs +0 -51
- package/dist/shared/cli-nightly.Cr-OCgdO.mjs +0 -37
- package/dist/shared/cli-nightly.DHenkA1C.mjs +0 -14
- package/dist/shared/cli-nightly.DPmMxQ6h.mjs +0 -33
- package/dist/shared/cli-nightly.DS8guhZv.mjs +0 -52
- package/dist/shared/cli-nightly.DkO5RR_e.mjs +0 -14
- package/dist/shared/cli-nightly.qKvs7FJ2.mjs +0 -36
package/dist/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as citty from 'citty';
|
|
2
|
-
|
|
3
|
-
declare const main: citty.CommandDef<{
|
|
4
|
-
command: {
|
|
5
|
-
type: "positional";
|
|
6
|
-
required: false;
|
|
7
|
-
};
|
|
8
|
-
cwd: {
|
|
9
|
-
readonly type: "string";
|
|
10
|
-
readonly description: "Specify the working directory";
|
|
11
|
-
readonly valueHint: "directory";
|
|
12
|
-
readonly default: ".";
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
|
-
declare const runMain: () => Promise<void>;
|
|
17
|
-
declare function runCommand(name: string, argv?: string[], data?: {
|
|
18
|
-
overrides?: Record<string, any>;
|
|
19
|
-
}): Promise<{
|
|
20
|
-
result: unknown;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
export { main, runCommand, runMain };
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import { defineCommand, runMain as runMain$1, runCommand as runCommand$1 } from 'citty';
|
|
4
|
-
import { provider } from 'std-env';
|
|
5
|
-
import { consola } from 'consola';
|
|
6
|
-
import { l as logger } from './cli-nightly.B9AmABr3.mjs';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
|
|
9
|
-
const _rDefault = (r) => r.default || r;
|
|
10
|
-
const commands = {
|
|
11
|
-
add: () => import('../chunks/add2.mjs').then(_rDefault),
|
|
12
|
-
analyze: () => import('../chunks/analyze.mjs').then(_rDefault),
|
|
13
|
-
build: () => import('../chunks/build.mjs').then(_rDefault),
|
|
14
|
-
cleanup: () => import('../chunks/cleanup.mjs').then(_rDefault),
|
|
15
|
-
_dev: () => import('../chunks/dev-child.mjs').then(_rDefault),
|
|
16
|
-
dev: () => import('../chunks/dev.mjs').then(_rDefault),
|
|
17
|
-
devtools: () => import('../chunks/devtools.mjs').then(_rDefault),
|
|
18
|
-
generate: () => import('../chunks/generate.mjs').then(_rDefault),
|
|
19
|
-
info: () => import('../chunks/info.mjs').then(_rDefault),
|
|
20
|
-
init: () => import('../chunks/init.mjs').then(_rDefault),
|
|
21
|
-
module: () => import('../chunks/index2.mjs').then(_rDefault),
|
|
22
|
-
prepare: () => import('../chunks/prepare.mjs').then(_rDefault),
|
|
23
|
-
preview: () => import('../chunks/preview.mjs').then(_rDefault),
|
|
24
|
-
start: () => import('../chunks/preview.mjs').then(_rDefault),
|
|
25
|
-
test: () => import('../chunks/test.mjs').then(_rDefault),
|
|
26
|
-
typecheck: () => import('../chunks/typecheck.mjs').then(_rDefault),
|
|
27
|
-
upgrade: () => import('../chunks/upgrade.mjs').then(_rDefault)
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const cwdArgs = {
|
|
31
|
-
cwd: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: "Specify the working directory",
|
|
34
|
-
valueHint: "directory",
|
|
35
|
-
default: "."
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const logLevelArgs = {
|
|
39
|
-
logLevel: {
|
|
40
|
-
type: "string",
|
|
41
|
-
description: "Specify build-time log level",
|
|
42
|
-
valueHint: "silent|info|verbose"
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const envNameArgs = {
|
|
46
|
-
envName: {
|
|
47
|
-
type: "string",
|
|
48
|
-
description: "The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)"
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const dotEnvArgs = {
|
|
52
|
-
dotenv: {
|
|
53
|
-
type: "string",
|
|
54
|
-
description: "Path to `.env` file to load, relative to the root directory"
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const extendsArgs = {
|
|
58
|
-
extends: {
|
|
59
|
-
type: "string",
|
|
60
|
-
description: "Extend from a Nuxt layer",
|
|
61
|
-
valueHint: "layer-name",
|
|
62
|
-
alias: ["e"]
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const legacyRootDirArgs = {
|
|
66
|
-
// cwd falls back to rootDir's default (indirect default)
|
|
67
|
-
cwd: {
|
|
68
|
-
...cwdArgs.cwd,
|
|
69
|
-
description: "Specify the working directory, this takes precedence over ROOTDIR (default: `.`)",
|
|
70
|
-
default: void 0
|
|
71
|
-
},
|
|
72
|
-
rootDir: {
|
|
73
|
-
type: "positional",
|
|
74
|
-
description: "Specifies the working directory (default: `.`)",
|
|
75
|
-
required: false,
|
|
76
|
-
default: "."
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
function wrapReporter(reporter) {
|
|
81
|
-
return {
|
|
82
|
-
log(logObj, ctx) {
|
|
83
|
-
if (!logObj.args || !logObj.args.length) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const msg = logObj.args[0];
|
|
87
|
-
if (typeof msg === "string" && !process.env.DEBUG) {
|
|
88
|
-
if (msg.startsWith(
|
|
89
|
-
"[Vue Router warn]: No match found for location with path"
|
|
90
|
-
)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (msg.includes(
|
|
94
|
-
"ExperimentalWarning: The Fetch API is an experimental feature"
|
|
95
|
-
)) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (msg.startsWith("Sourcemap") && msg.includes("node_modules")) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return reporter.log(logObj, ctx);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function setupGlobalConsole(opts = {}) {
|
|
107
|
-
consola.options.reporters = consola.options.reporters.map(wrapReporter);
|
|
108
|
-
if (opts.dev) {
|
|
109
|
-
consola.wrapAll();
|
|
110
|
-
} else {
|
|
111
|
-
consola.wrapConsole();
|
|
112
|
-
}
|
|
113
|
-
process.on("unhandledRejection", (err) => consola.error("[unhandledRejection]", err));
|
|
114
|
-
process.on("uncaughtException", (err) => consola.error("[uncaughtException]", err));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async function checkEngines() {
|
|
118
|
-
const satisfies = await import('semver/functions/satisfies.js').then(
|
|
119
|
-
(r) => r.default || r
|
|
120
|
-
);
|
|
121
|
-
const currentNode = process.versions.node;
|
|
122
|
-
const nodeRange = ">= 18.0.0";
|
|
123
|
-
if (!satisfies(currentNode, nodeRange)) {
|
|
124
|
-
logger.warn(
|
|
125
|
-
`Current version of Node.js (\`${currentNode}\`) is unsupported and might cause issues.
|
|
126
|
-
Please upgrade to a compatible version \`${nodeRange}\`.`
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const name = "@nuxt/cli-nightly";
|
|
132
|
-
const version = "3.29.4-20251009-171833-0915ec9";
|
|
133
|
-
const description = "Nuxt CLI";
|
|
134
|
-
|
|
135
|
-
const main = defineCommand({
|
|
136
|
-
meta: {
|
|
137
|
-
name: name.endsWith("nightly") ? name : "nuxi",
|
|
138
|
-
version,
|
|
139
|
-
description
|
|
140
|
-
},
|
|
141
|
-
args: {
|
|
142
|
-
...cwdArgs,
|
|
143
|
-
command: {
|
|
144
|
-
type: "positional",
|
|
145
|
-
required: false
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
subCommands: commands,
|
|
149
|
-
async setup(ctx) {
|
|
150
|
-
const command = ctx.args._[0];
|
|
151
|
-
const dev = command === "dev";
|
|
152
|
-
setupGlobalConsole({ dev });
|
|
153
|
-
let backgroundTasks;
|
|
154
|
-
if (command !== "_dev" && provider !== "stackblitz") {
|
|
155
|
-
backgroundTasks = Promise.all([
|
|
156
|
-
checkEngines()
|
|
157
|
-
]).catch((err) => logger.error(err));
|
|
158
|
-
}
|
|
159
|
-
if (command === "init") {
|
|
160
|
-
await backgroundTasks;
|
|
161
|
-
}
|
|
162
|
-
if (ctx.args.command && !(ctx.args.command in commands)) {
|
|
163
|
-
const cwd = resolve(ctx.args.cwd);
|
|
164
|
-
try {
|
|
165
|
-
const { x } = await import('tinyexec');
|
|
166
|
-
await x(`nuxt-${ctx.args.command}`, ctx.rawArgs.slice(1), {
|
|
167
|
-
nodeOptions: { stdio: "inherit", cwd },
|
|
168
|
-
throwOnError: true
|
|
169
|
-
});
|
|
170
|
-
} catch (err) {
|
|
171
|
-
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
process.exit();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
globalThis.__nuxt_cli__ = globalThis.__nuxt_cli__ || {
|
|
181
|
-
// Programmatic usage fallback
|
|
182
|
-
startTime: Date.now(),
|
|
183
|
-
entry: fileURLToPath(
|
|
184
|
-
new URL("../../bin/nuxi.mjs", import.meta.url)
|
|
185
|
-
),
|
|
186
|
-
devEntry: fileURLToPath(
|
|
187
|
-
new URL("../dev/index.mjs", import.meta.url)
|
|
188
|
-
)
|
|
189
|
-
};
|
|
190
|
-
const runMain = () => runMain$1(main);
|
|
191
|
-
async function runCommand(name, argv = process.argv.slice(2), data = {}) {
|
|
192
|
-
argv.push("--no-clear");
|
|
193
|
-
if (!(name in commands)) {
|
|
194
|
-
throw new Error(`Invalid command ${name}`);
|
|
195
|
-
}
|
|
196
|
-
return await runCommand$1(await commands[name](), {
|
|
197
|
-
rawArgs: argv,
|
|
198
|
-
data: {
|
|
199
|
-
overrides: data.overrides || {}
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export { logLevelArgs as a, envNameArgs as b, cwdArgs as c, dotEnvArgs as d, extendsArgs as e, runMain as f, legacyRootDirArgs as l, main as m, runCommand as r };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { promises } from 'node:fs';
|
|
2
|
-
import { hash } from 'ohash';
|
|
3
|
-
import { resolve, dirname } from 'pathe';
|
|
4
|
-
import { l as logger } from './cli-nightly.B9AmABr3.mjs';
|
|
5
|
-
import { r as rmRecursive } from './cli-nightly.DPmMxQ6h.mjs';
|
|
6
|
-
|
|
7
|
-
async function cleanupNuxtDirs(rootDir, buildDir) {
|
|
8
|
-
logger.info("Cleaning up generated Nuxt files and caches...");
|
|
9
|
-
await rmRecursive(
|
|
10
|
-
[
|
|
11
|
-
buildDir,
|
|
12
|
-
".output",
|
|
13
|
-
"dist",
|
|
14
|
-
"node_modules/.vite",
|
|
15
|
-
"node_modules/.cache"
|
|
16
|
-
].map((dir) => resolve(rootDir, dir))
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
function nuxtVersionToGitIdentifier(version) {
|
|
20
|
-
const id = /\.([0-9a-f]{7,8})$/.exec(version);
|
|
21
|
-
if (id?.[1]) {
|
|
22
|
-
return id[1];
|
|
23
|
-
}
|
|
24
|
-
return `v${version}`;
|
|
25
|
-
}
|
|
26
|
-
function resolveNuxtManifest(nuxt) {
|
|
27
|
-
const manifest = {
|
|
28
|
-
_hash: null,
|
|
29
|
-
project: {
|
|
30
|
-
rootDir: nuxt.options.rootDir
|
|
31
|
-
},
|
|
32
|
-
versions: {
|
|
33
|
-
nuxt: nuxt._version
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
manifest._hash = hash(manifest);
|
|
37
|
-
return manifest;
|
|
38
|
-
}
|
|
39
|
-
async function writeNuxtManifest(nuxt, manifest = resolveNuxtManifest(nuxt)) {
|
|
40
|
-
const manifestPath = resolve(nuxt.options.buildDir, "nuxt.json");
|
|
41
|
-
await promises.mkdir(dirname(manifestPath), { recursive: true });
|
|
42
|
-
await promises.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
43
|
-
return manifest;
|
|
44
|
-
}
|
|
45
|
-
async function loadNuxtManifest(buildDir) {
|
|
46
|
-
const manifestPath = resolve(buildDir, "nuxt.json");
|
|
47
|
-
const manifest = await promises.readFile(manifestPath, "utf-8").then((data) => JSON.parse(data)).catch(() => null);
|
|
48
|
-
return manifest;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { cleanupNuxtDirs as c, loadNuxtManifest as l, nuxtVersionToGitIdentifier as n, resolveNuxtManifest as r, writeNuxtManifest as w };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { parseINI } from 'confbox';
|
|
2
|
-
import { $fetch } from 'ofetch';
|
|
3
|
-
import { satisfies } from 'semver';
|
|
4
|
-
|
|
5
|
-
async function fetchModules() {
|
|
6
|
-
const { modules } = await $fetch(
|
|
7
|
-
`https://api.nuxt.com/modules?version=all`
|
|
8
|
-
);
|
|
9
|
-
return modules;
|
|
10
|
-
}
|
|
11
|
-
function checkNuxtCompatibility(module, nuxtVersion) {
|
|
12
|
-
if (!module.compatibility?.nuxt) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
return satisfies(nuxtVersion, module.compatibility.nuxt, {
|
|
16
|
-
includePrerelease: true
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function getRegistryFromContent(content, scope) {
|
|
20
|
-
try {
|
|
21
|
-
const npmConfig = parseINI(content);
|
|
22
|
-
if (scope) {
|
|
23
|
-
const scopeKey = `${scope}:registry`;
|
|
24
|
-
if (npmConfig[scopeKey]) {
|
|
25
|
-
return npmConfig[scopeKey].trim();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (npmConfig.registry) {
|
|
29
|
-
return npmConfig.registry.trim();
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
} catch {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { checkNuxtCompatibility as c, fetchModules as f, getRegistryFromContent as g };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { readPackageJSON } from 'pkg-types';
|
|
2
|
-
import { coerce } from 'semver';
|
|
3
|
-
|
|
4
|
-
async function getNuxtVersion(cwd, cache = true) {
|
|
5
|
-
const nuxtPkg = await readPackageJSON("nuxt", { url: cwd, try: true, cache });
|
|
6
|
-
if (nuxtPkg) {
|
|
7
|
-
return nuxtPkg.version;
|
|
8
|
-
}
|
|
9
|
-
const pkg = await readPackageJSON(cwd);
|
|
10
|
-
const pkgDep = pkg?.dependencies?.nuxt || pkg?.devDependencies?.nuxt;
|
|
11
|
-
return pkgDep && coerce(pkgDep)?.version || "3.0.0";
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { getNuxtVersion as g };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { promises, existsSync } from 'node:fs';
|
|
2
|
-
import { join } from 'pathe';
|
|
3
|
-
import { l as logger } from './cli-nightly.B9AmABr3.mjs';
|
|
4
|
-
|
|
5
|
-
async function clearDir(path, exclude) {
|
|
6
|
-
if (!exclude) {
|
|
7
|
-
await promises.rm(path, { recursive: true, force: true });
|
|
8
|
-
} else if (existsSync(path)) {
|
|
9
|
-
const files = await promises.readdir(path);
|
|
10
|
-
await Promise.all(
|
|
11
|
-
files.map(async (name) => {
|
|
12
|
-
if (!exclude.includes(name)) {
|
|
13
|
-
await promises.rm(join(path, name), { recursive: true, force: true });
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
await promises.mkdir(path, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
function clearBuildDir(path) {
|
|
21
|
-
return clearDir(path, ["cache", "analyze", "nuxt.json"]);
|
|
22
|
-
}
|
|
23
|
-
async function rmRecursive(paths) {
|
|
24
|
-
await Promise.all(
|
|
25
|
-
paths.filter((p) => typeof p === "string").map(async (path) => {
|
|
26
|
-
logger.debug("Removing recursive path", path);
|
|
27
|
-
await promises.rm(path, { recursive: true, force: true }).catch(() => {
|
|
28
|
-
});
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { clearBuildDir as a, clearDir as c, rmRecursive as r };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { colors } from 'consola/utils';
|
|
3
|
-
import { resolveModulePath } from 'exsolve';
|
|
4
|
-
import { t as tryResolveNuxt } from './cli-nightly.qKvs7FJ2.mjs';
|
|
5
|
-
import { l as logger } from './cli-nightly.B9AmABr3.mjs';
|
|
6
|
-
|
|
7
|
-
function showVersionsFromConfig(cwd, config) {
|
|
8
|
-
const { bold, gray, green } = colors;
|
|
9
|
-
function getBuilder() {
|
|
10
|
-
switch (config.builder) {
|
|
11
|
-
case "@nuxt/rspack-builder":
|
|
12
|
-
return { name: "Rspack", version: getPkgVersion("@rspack/core") };
|
|
13
|
-
case "@nuxt/webpack-builder":
|
|
14
|
-
return { name: "Webpack", version: getPkgVersion("webpack") };
|
|
15
|
-
case "@nuxt/vite-builder":
|
|
16
|
-
default: {
|
|
17
|
-
const pkgJSON = getPkgJSON("vite");
|
|
18
|
-
const isRolldown = pkgJSON.name.includes("rolldown");
|
|
19
|
-
return { name: isRolldown ? "Rolldown-Vite" : "Vite", version: pkgJSON.version };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function getPkgJSON(pkg) {
|
|
24
|
-
for (const url of [cwd, tryResolveNuxt(cwd)]) {
|
|
25
|
-
if (!url) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
const p = resolveModulePath(`${pkg}/package.json`, { from: url, try: true });
|
|
29
|
-
if (p) {
|
|
30
|
-
return JSON.parse(readFileSync(p, "utf-8"));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
function getPkgVersion(pkg) {
|
|
36
|
-
const pkgJSON = getPkgJSON(pkg);
|
|
37
|
-
return pkgJSON?.version ?? "";
|
|
38
|
-
}
|
|
39
|
-
const nuxtVersion = getPkgVersion("nuxt") || getPkgVersion("nuxt-nightly") || getPkgVersion("nuxt3") || getPkgVersion("nuxt-edge");
|
|
40
|
-
const nitroVersion = getPkgVersion("nitropack") || getPkgVersion("nitropack-nightly") || getPkgVersion("nitropack-edge");
|
|
41
|
-
const builder = getBuilder();
|
|
42
|
-
const vueVersion = getPkgVersion("vue") || null;
|
|
43
|
-
logger.log(
|
|
44
|
-
green(`Nuxt ${bold(nuxtVersion)}`) + gray(" (with ") + (nitroVersion ? gray(`Nitro ${bold(nitroVersion)}`) : "") + gray(`, ${builder.name} ${bold(builder.version)}`) + (vueVersion ? gray(` and Vue ${bold(vueVersion)}`) : "") + gray(")")
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
async function showVersions(cwd, kit) {
|
|
48
|
-
const config = await kit.loadNuxtConfig({ cwd });
|
|
49
|
-
return showVersionsFromConfig(cwd, config);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { showVersionsFromConfig as a, showVersions as s };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import process from 'node:process';
|
|
2
|
-
import { l as logger } from './cli-nightly.B9AmABr3.mjs';
|
|
3
|
-
|
|
4
|
-
function overrideEnv(targetEnv) {
|
|
5
|
-
const currentEnv = process.env.NODE_ENV;
|
|
6
|
-
if (currentEnv && currentEnv !== targetEnv) {
|
|
7
|
-
logger.warn(
|
|
8
|
-
`Changing \`NODE_ENV\` from \`${currentEnv}\` to \`${targetEnv}\`, to avoid unintended behavior.`
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
process.env.NODE_ENV = targetEnv;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { overrideEnv as o };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { pathToFileURL } from 'node:url';
|
|
2
|
-
import { resolveModulePath } from 'exsolve';
|
|
3
|
-
|
|
4
|
-
async function loadKit(rootDir) {
|
|
5
|
-
try {
|
|
6
|
-
const kitPath = resolveModulePath("@nuxt/kit", { from: tryResolveNuxt(rootDir) || rootDir });
|
|
7
|
-
let kit = await import(pathToFileURL(kitPath).href);
|
|
8
|
-
if (!kit.writeTypes) {
|
|
9
|
-
kit = {
|
|
10
|
-
...kit,
|
|
11
|
-
writeTypes: () => {
|
|
12
|
-
throw new Error("`writeTypes` is not available in this version of `@nuxt/kit`. Please upgrade to v3.7 or newer.");
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return kit;
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (e.toString().includes("Cannot find module '@nuxt/kit'")) {
|
|
19
|
-
throw new Error(
|
|
20
|
-
"nuxi requires `@nuxt/kit` to be installed in your project. Try installing `nuxt` v3+ or `@nuxt/bridge` first."
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
throw e;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function tryResolveNuxt(rootDir) {
|
|
27
|
-
for (const pkg of ["nuxt-nightly", "nuxt", "nuxt3", "nuxt-edge"]) {
|
|
28
|
-
const path = resolveModulePath(pkg, { from: rootDir, try: true });
|
|
29
|
-
if (path) {
|
|
30
|
-
return path;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { loadKit as l, tryResolveNuxt as t };
|