@nuxt/cli-nightly 3.26.0-20250607-210256-59f83b1 → 3.26.0-20250607-215204-1943f84
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/bin/nuxi.mjs +1 -0
- package/dist/chunks/add.mjs +308 -290
- package/dist/chunks/add2.mjs +291 -307
- package/dist/chunks/analyze.mjs +8 -7
- package/dist/chunks/build.mjs +11 -11
- package/dist/chunks/cleanup.mjs +8 -7
- package/dist/chunks/dev-child.mjs +11 -71
- package/dist/chunks/dev.mjs +142 -117
- package/dist/chunks/devtools.mjs +3 -2
- package/dist/chunks/generate.mjs +8 -8
- package/dist/chunks/index.mjs +379 -12
- package/dist/chunks/index2.mjs +15 -0
- package/dist/chunks/info.mjs +8 -6
- package/dist/chunks/init.mjs +4 -3
- package/dist/chunks/prepare.mjs +7 -6
- package/dist/chunks/preview.mjs +6 -5
- package/dist/chunks/search.mjs +3 -2
- package/dist/chunks/test.mjs +3 -2
- package/dist/chunks/typecheck.mjs +6 -6
- package/dist/chunks/upgrade.mjs +9 -8
- package/dist/dev/index.d.mts +75 -0
- package/dist/dev/index.d.ts +75 -0
- package/dist/dev/index.mjs +21 -0
- package/dist/index.mjs +2 -1
- package/dist/shared/{cli-nightly.DTVmTXKJ.mjs → cli-nightly.B4U5vhqQ.mjs} +7 -6
- package/dist/shared/cli-nightly.B9AmABr3.mjs +5 -0
- package/dist/shared/{cli-nightly.CjK7ZDKA.mjs → cli-nightly.BgFMCBoq.mjs} +9 -10
- package/dist/shared/{cli-nightly.DlcAx0De.mjs → cli-nightly.BrKZotr9.mjs} +11 -9
- package/dist/shared/{cli-nightly.DDBHWicM.mjs → cli-nightly.Bu_9IHj2.mjs} +2 -2
- package/dist/shared/{cli-nightly.DPQxxyDx.mjs → cli-nightly.Cf9T6EbF.mjs} +1 -1
- package/dist/shared/{cli-nightly.BnfAj4iy.mjs → cli-nightly.DPmMxQ6h.mjs} +1 -1
- package/dist/shared/cli-nightly.Dc8ncNQ_.mjs +27 -0
- package/dist/shared/{cli-nightly.DdmGgrsK.mjs → cli-nightly.DkO5RR_e.mjs} +1 -1
- package/package.json +2 -1
- package/dist/chunks/dev2.mjs +0 -293
- package/dist/shared/cli-nightly.COGWopdX.mjs +0 -26
package/dist/chunks/index.mjs
CHANGED
|
@@ -1,15 +1,382 @@
|
|
|
1
|
-
import
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import defu from 'defu';
|
|
3
|
+
import EventEmitter from 'node:events';
|
|
4
|
+
import chokidar from 'chokidar';
|
|
5
|
+
import { toNodeListener } from 'h3';
|
|
6
|
+
import { listen } from 'listhen';
|
|
7
|
+
import { resolve, join, relative } from 'pathe';
|
|
8
|
+
import { debounce } from 'perfect-debounce';
|
|
9
|
+
import { provider } from 'std-env';
|
|
10
|
+
import { joinURL } from 'ufo';
|
|
11
|
+
import { a as clearBuildDir } from '../shared/cli-nightly.DPmMxQ6h.mjs';
|
|
12
|
+
import { l as loadKit } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
13
|
+
import { l as loadNuxtManifest, r as resolveNuxtManifest, w as writeNuxtManifest } from '../shared/cli-nightly.Bu_9IHj2.mjs';
|
|
14
|
+
import { Youch } from 'youch';
|
|
2
15
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
async function renderError(req, res, error) {
|
|
17
|
+
const youch = new Youch();
|
|
18
|
+
res.statusCode = 500;
|
|
19
|
+
res.setHeader("Content-Type", "text/html");
|
|
20
|
+
const html = await youch.toHTML(error, {
|
|
21
|
+
request: {
|
|
22
|
+
url: req.url,
|
|
23
|
+
method: req.method,
|
|
24
|
+
headers: req.headers
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
res.end(html);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function createNuxtDevServer(options, listenOptions) {
|
|
31
|
+
const devServer = new NuxtDevServer(options);
|
|
32
|
+
devServer.listener = await listen(
|
|
33
|
+
devServer.handler,
|
|
34
|
+
listenOptions || {
|
|
35
|
+
port: options.port ?? 0,
|
|
36
|
+
hostname: "127.0.0.1",
|
|
37
|
+
showURL: false
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
devServer.listener._url = devServer.listener.url;
|
|
41
|
+
if (options.devContext.proxy?.url) {
|
|
42
|
+
devServer.listener.url = options.devContext.proxy.url;
|
|
43
|
+
}
|
|
44
|
+
if (options.devContext.proxy?.urls) {
|
|
45
|
+
const _getURLs = devServer.listener.getURLs.bind(devServer.listener);
|
|
46
|
+
devServer.listener.getURLs = async () => Array.from(/* @__PURE__ */ new Set([...options.devContext.proxy?.urls || [], ...await _getURLs()]));
|
|
47
|
+
}
|
|
48
|
+
return devServer;
|
|
49
|
+
}
|
|
50
|
+
const RESTART_RE = /^(?:nuxt\.config\.[a-z0-9]+|\.nuxtignore|\.nuxtrc|\.config\/nuxt(?:\.config)?\.[a-z0-9]+)$/;
|
|
51
|
+
class NuxtDevServer extends EventEmitter {
|
|
52
|
+
constructor(options) {
|
|
53
|
+
super();
|
|
54
|
+
this.options = options;
|
|
55
|
+
this.loadDebounced = debounce(this.load);
|
|
56
|
+
let _initResolve;
|
|
57
|
+
const _initPromise = new Promise((resolve2) => {
|
|
58
|
+
_initResolve = resolve2;
|
|
59
|
+
});
|
|
60
|
+
this.once("ready", () => {
|
|
61
|
+
_initResolve();
|
|
62
|
+
});
|
|
63
|
+
this.cwd = options.cwd;
|
|
64
|
+
this.handler = async (req, res) => {
|
|
65
|
+
if (this._loadingError) {
|
|
66
|
+
this._renderError(req, res);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
await _initPromise;
|
|
70
|
+
if (this._handler) {
|
|
71
|
+
this._handler(req, res);
|
|
72
|
+
} else {
|
|
73
|
+
this._renderLoadingScreen(req, res);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
this.listener = void 0;
|
|
77
|
+
}
|
|
78
|
+
_handler;
|
|
79
|
+
_distWatcher;
|
|
80
|
+
_currentNuxt;
|
|
81
|
+
_loadingMessage;
|
|
82
|
+
_loadingError;
|
|
83
|
+
cwd;
|
|
84
|
+
loadDebounced;
|
|
85
|
+
handler;
|
|
86
|
+
listener;
|
|
87
|
+
_renderError(req, res) {
|
|
88
|
+
renderError(req, res, this._loadingError);
|
|
89
|
+
}
|
|
90
|
+
async resolveLoadingTemplate() {
|
|
91
|
+
const { createJiti } = await import('jiti');
|
|
92
|
+
const jiti = createJiti(this.cwd);
|
|
93
|
+
const loading = await jiti.import("@nuxt/ui-templates").then((r) => r.loading).catch(() => {
|
|
94
|
+
});
|
|
95
|
+
return loading || ((params) => `<h2>${params.loading}</h2>`);
|
|
96
|
+
}
|
|
97
|
+
async _renderLoadingScreen(req, res) {
|
|
98
|
+
res.statusCode = 503;
|
|
99
|
+
res.setHeader("Content-Type", "text/html");
|
|
100
|
+
const loadingTemplate = this.options.loadingTemplate || this._currentNuxt?.options.devServer.loadingTemplate || await this.resolveLoadingTemplate();
|
|
101
|
+
res.end(
|
|
102
|
+
loadingTemplate({
|
|
103
|
+
loading: this._loadingMessage || "Loading..."
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
async init() {
|
|
108
|
+
await this.load();
|
|
109
|
+
await this._watchConfig();
|
|
110
|
+
}
|
|
111
|
+
async load(reload, reason) {
|
|
112
|
+
try {
|
|
113
|
+
await this._load(reload, reason);
|
|
114
|
+
this._loadingError = void 0;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error(`Cannot ${reload ? "restart" : "start"} nuxt: `, error);
|
|
117
|
+
this._handler = void 0;
|
|
118
|
+
this._loadingError = error;
|
|
119
|
+
this._loadingMessage = "Error while loading Nuxt. Please check console and fix errors.";
|
|
120
|
+
this.emit("loading:error", error);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async close() {
|
|
124
|
+
if (this._currentNuxt) {
|
|
125
|
+
await this._currentNuxt.close();
|
|
126
|
+
}
|
|
127
|
+
if (this._distWatcher) {
|
|
128
|
+
await this._distWatcher.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async _load(reload, reason) {
|
|
132
|
+
const action = reload ? "Restarting" : "Starting";
|
|
133
|
+
this._loadingMessage = `${reason ? `${reason}. ` : ""}${action} Nuxt...`;
|
|
134
|
+
this._handler = void 0;
|
|
135
|
+
this.emit("loading", this._loadingMessage);
|
|
136
|
+
if (reload) {
|
|
137
|
+
console.info(this._loadingMessage);
|
|
138
|
+
}
|
|
139
|
+
await this.close();
|
|
140
|
+
const kit = await loadKit(this.options.cwd);
|
|
141
|
+
const devServerDefaults = resolveDevServerDefaults({}, await this.listener.getURLs().then((r) => r.map((r2) => r2.url)));
|
|
142
|
+
this._currentNuxt = await kit.loadNuxt({
|
|
143
|
+
cwd: this.options.cwd,
|
|
144
|
+
dev: true,
|
|
145
|
+
ready: false,
|
|
146
|
+
envName: this.options.envName,
|
|
147
|
+
dotenv: {
|
|
148
|
+
cwd: this.options.cwd,
|
|
149
|
+
fileName: this.options.dotenv.fileName
|
|
150
|
+
},
|
|
151
|
+
defaults: defu(this.options.defaults, devServerDefaults),
|
|
152
|
+
overrides: {
|
|
153
|
+
logLevel: this.options.logLevel,
|
|
154
|
+
...this.options.overrides,
|
|
155
|
+
vite: {
|
|
156
|
+
clearScreen: this.options.clear,
|
|
157
|
+
...this.options.overrides.vite
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
if (!process.env.NUXI_DISABLE_VITE_HMR) {
|
|
162
|
+
this._currentNuxt.hooks.hook("vite:extend", ({ config }) => {
|
|
163
|
+
if (config.server) {
|
|
164
|
+
config.server.hmr = {
|
|
165
|
+
protocol: void 0,
|
|
166
|
+
...config.server.hmr,
|
|
167
|
+
port: void 0,
|
|
168
|
+
host: void 0,
|
|
169
|
+
server: this.listener.server
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
this._currentNuxt.hooks.hookOnce("close", () => {
|
|
175
|
+
this.listener.server.removeAllListeners("upgrade");
|
|
176
|
+
});
|
|
177
|
+
if (!reload) {
|
|
178
|
+
const previousManifest = await loadNuxtManifest(this._currentNuxt.options.buildDir);
|
|
179
|
+
const newManifest = resolveNuxtManifest(this._currentNuxt);
|
|
180
|
+
const promise = writeNuxtManifest(this._currentNuxt, newManifest);
|
|
181
|
+
this._currentNuxt.hooks.hookOnce("ready", async () => {
|
|
182
|
+
await promise;
|
|
183
|
+
});
|
|
184
|
+
if (previousManifest && newManifest && previousManifest._hash !== newManifest._hash) {
|
|
185
|
+
await clearBuildDir(this._currentNuxt.options.buildDir);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
await this._currentNuxt.ready();
|
|
189
|
+
const unsub = this._currentNuxt.hooks.hook("restart", async (options) => {
|
|
190
|
+
unsub();
|
|
191
|
+
if (options?.hard) {
|
|
192
|
+
this.emit("restart");
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
await this.load(true);
|
|
196
|
+
});
|
|
197
|
+
if (this._currentNuxt.server && "upgrade" in this._currentNuxt.server) {
|
|
198
|
+
this.listener.server.on("upgrade", (req, socket, head) => {
|
|
199
|
+
const nuxt = this._currentNuxt;
|
|
200
|
+
if (!nuxt || !nuxt.server)
|
|
201
|
+
return;
|
|
202
|
+
const viteHmrPath = joinURL(
|
|
203
|
+
nuxt.options.app.baseURL.startsWith("./") ? nuxt.options.app.baseURL.slice(1) : nuxt.options.app.baseURL,
|
|
204
|
+
nuxt.options.app.buildAssetsDir
|
|
205
|
+
);
|
|
206
|
+
if (req.url?.startsWith(viteHmrPath)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
nuxt.server.upgrade(req, socket, head);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
await this._currentNuxt.hooks.callHook("listen", this.listener.server, this.listener);
|
|
213
|
+
const addr = this.listener.address;
|
|
214
|
+
this._currentNuxt.options.devServer.host = addr.address;
|
|
215
|
+
this._currentNuxt.options.devServer.port = addr.port;
|
|
216
|
+
this._currentNuxt.options.devServer.url = getAddressURL(addr, !!this.listener.https);
|
|
217
|
+
this._currentNuxt.options.devServer.https = this.options.devContext.proxy?.https;
|
|
218
|
+
if (this.listener.https && !process.env.NODE_TLS_REJECT_UNAUTHORIZED) {
|
|
219
|
+
console.warn("You might need `NODE_TLS_REJECT_UNAUTHORIZED=0` environment variable to make https work.");
|
|
220
|
+
}
|
|
221
|
+
await Promise.all([
|
|
222
|
+
kit.writeTypes(this._currentNuxt).catch(console.error),
|
|
223
|
+
kit.buildNuxt(this._currentNuxt)
|
|
224
|
+
]);
|
|
225
|
+
if (!this._currentNuxt.server) {
|
|
226
|
+
throw new Error("Nitro server has not been initialized.");
|
|
227
|
+
}
|
|
228
|
+
this._distWatcher = chokidar.watch(resolve(this._currentNuxt.options.buildDir, "dist"), {
|
|
229
|
+
ignoreInitial: true,
|
|
230
|
+
depth: 0
|
|
231
|
+
});
|
|
232
|
+
this._distWatcher.on("unlinkDir", () => {
|
|
233
|
+
this.loadDebounced(true, ".nuxt/dist directory has been removed");
|
|
234
|
+
});
|
|
235
|
+
this._handler = toNodeListener(this._currentNuxt.server.app);
|
|
236
|
+
this.emit("ready", addr);
|
|
237
|
+
}
|
|
238
|
+
async _watchConfig() {
|
|
239
|
+
const configWatcher = chokidar.watch([this.options.cwd, join(this.options.cwd, ".config")], {
|
|
240
|
+
ignoreInitial: true,
|
|
241
|
+
depth: 0
|
|
242
|
+
});
|
|
243
|
+
configWatcher.on("all", (event, _file) => {
|
|
244
|
+
if (event === "all" || event === "ready" || event === "error" || event === "raw") {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const file = relative(this.options.cwd, _file);
|
|
248
|
+
if (file === (this.options.dotenv.fileName || ".env")) {
|
|
249
|
+
this.emit("restart");
|
|
250
|
+
}
|
|
251
|
+
if (RESTART_RE.test(file)) {
|
|
252
|
+
this.loadDebounced(true, `${file} updated`);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
12
255
|
}
|
|
13
|
-
}
|
|
256
|
+
}
|
|
257
|
+
function getAddressURL(addr, https) {
|
|
258
|
+
const proto = https ? "https" : "http";
|
|
259
|
+
let host = addr.address.includes(":") ? `[${addr.address}]` : addr.address;
|
|
260
|
+
if (host === "[::]") {
|
|
261
|
+
host = "localhost";
|
|
262
|
+
}
|
|
263
|
+
const port = addr.port || 3e3;
|
|
264
|
+
return `${proto}://${host}:${port}/`;
|
|
265
|
+
}
|
|
266
|
+
function resolveDevServerOverrides(listenOptions) {
|
|
267
|
+
if (listenOptions.public || provider === "codesandbox") {
|
|
268
|
+
return {
|
|
269
|
+
devServer: { cors: { origin: "*" } },
|
|
270
|
+
vite: { server: { allowedHosts: true } }
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return {};
|
|
274
|
+
}
|
|
275
|
+
function resolveDevServerDefaults(listenOptions, urls = []) {
|
|
276
|
+
const defaultConfig = {};
|
|
277
|
+
if (urls) {
|
|
278
|
+
defaultConfig.vite = { server: { allowedHosts: urls.map((u) => new URL(u).hostname) } };
|
|
279
|
+
}
|
|
280
|
+
if (listenOptions.hostname) {
|
|
281
|
+
const protocol = listenOptions.https ? "https" : "http";
|
|
282
|
+
defaultConfig.devServer = { cors: { origin: [`${protocol}://${listenOptions.hostname}`, ...urls] } };
|
|
283
|
+
defaultConfig.vite = defu(defaultConfig.vite, { server: { allowedHosts: [listenOptions.hostname] } });
|
|
284
|
+
}
|
|
285
|
+
return defaultConfig;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const start = Date.now();
|
|
289
|
+
process.env.NODE_ENV = "development";
|
|
290
|
+
class IPC {
|
|
291
|
+
enabled = !!process.send && !process.title.includes("vitest") && process.env.__NUXT__FORK;
|
|
292
|
+
constructor() {
|
|
293
|
+
process.once("unhandledRejection", (reason) => {
|
|
294
|
+
this.send({ type: "nuxt:internal:dev:rejection", message: reason instanceof Error ? reason.toString() : "Unhandled Rejection" });
|
|
295
|
+
process.exit();
|
|
296
|
+
});
|
|
297
|
+
process.on("message", (message) => {
|
|
298
|
+
if (message.type === "nuxt:internal:dev:context") {
|
|
299
|
+
initialize(message.context);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
this.send({ type: "nuxt:internal:dev:fork-ready" });
|
|
303
|
+
}
|
|
304
|
+
send(message) {
|
|
305
|
+
if (this.enabled) {
|
|
306
|
+
process.send?.(message);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const ipc = new IPC();
|
|
311
|
+
async function initialize(devContext, ctx = {}, listenOptions) {
|
|
312
|
+
const devServerOverrides = resolveDevServerOverrides({
|
|
313
|
+
public: devContext.public
|
|
314
|
+
});
|
|
315
|
+
const devServerDefaults = resolveDevServerDefaults({
|
|
316
|
+
hostname: devContext.hostname,
|
|
317
|
+
https: devContext.proxy?.https
|
|
318
|
+
}, devContext.publicURLs);
|
|
319
|
+
const devServer = await createNuxtDevServer({
|
|
320
|
+
cwd: devContext.cwd,
|
|
321
|
+
overrides: defu(ctx.data?.overrides, devServerOverrides),
|
|
322
|
+
defaults: devServerDefaults,
|
|
323
|
+
logLevel: devContext.args.logLevel,
|
|
324
|
+
clear: !!devContext.args.clear,
|
|
325
|
+
dotenv: { cwd: devContext.cwd, fileName: devContext.args.dotenv },
|
|
326
|
+
envName: devContext.args.envName,
|
|
327
|
+
port: process.env._PORT ?? void 0,
|
|
328
|
+
devContext
|
|
329
|
+
}, listenOptions);
|
|
330
|
+
let port;
|
|
331
|
+
if (ipc.enabled) {
|
|
332
|
+
devServer.on("loading:error", (_error) => {
|
|
333
|
+
ipc.send({
|
|
334
|
+
type: "nuxt:internal:dev:loading:error",
|
|
335
|
+
error: {
|
|
336
|
+
message: _error.message,
|
|
337
|
+
stack: _error.stack,
|
|
338
|
+
name: _error.name,
|
|
339
|
+
code: _error.code
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
devServer.on("loading", (message) => {
|
|
344
|
+
ipc.send({ type: "nuxt:internal:dev:loading", message });
|
|
345
|
+
});
|
|
346
|
+
devServer.on("restart", () => {
|
|
347
|
+
ipc.send({ type: "nuxt:internal:dev:restart" });
|
|
348
|
+
});
|
|
349
|
+
devServer.on("ready", (payload) => {
|
|
350
|
+
ipc.send({ type: "nuxt:internal:dev:ready", port: payload.port });
|
|
351
|
+
});
|
|
352
|
+
} else {
|
|
353
|
+
devServer.on("ready", (payload) => {
|
|
354
|
+
port = payload.port;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
await devServer.init();
|
|
358
|
+
if (process.env.DEBUG) {
|
|
359
|
+
console.debug(`Dev server (internal) initialized in ${Date.now() - start}ms`);
|
|
360
|
+
}
|
|
361
|
+
return {
|
|
362
|
+
listener: devServer.listener,
|
|
363
|
+
close: () => devServer.close(),
|
|
364
|
+
onReady: (callback) => {
|
|
365
|
+
if (port) {
|
|
366
|
+
callback(port);
|
|
367
|
+
} else {
|
|
368
|
+
devServer.once("ready", (payload) => callback(payload.port));
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
onRestart: (callback) => {
|
|
372
|
+
devServer.once("restart", () => callback(devServer));
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const index = {
|
|
378
|
+
__proto__: null,
|
|
379
|
+
initialize: initialize
|
|
380
|
+
};
|
|
14
381
|
|
|
15
|
-
export { index as
|
|
382
|
+
export { index as a, initialize as i, renderError as r };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from 'citty';
|
|
2
|
+
|
|
3
|
+
const index = defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "module",
|
|
6
|
+
description: "Manage Nuxt modules"
|
|
7
|
+
},
|
|
8
|
+
args: {},
|
|
9
|
+
subCommands: {
|
|
10
|
+
add: () => import('./add.mjs').then((r) => r.default || r),
|
|
11
|
+
search: () => import('./search.mjs').then((r) => r.default || r)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { index as default };
|
package/dist/chunks/info.mjs
CHANGED
|
@@ -8,14 +8,16 @@ import { resolve } from 'pathe';
|
|
|
8
8
|
import { readPackageJSON } from 'pkg-types';
|
|
9
9
|
import { splitByCase } from 'scule';
|
|
10
10
|
import { isMinimal } from 'std-env';
|
|
11
|
-
import { v as version } from '../shared/cli-nightly.
|
|
12
|
-
import { t as tryResolveNuxt } from '../shared/cli-nightly.
|
|
13
|
-
import {
|
|
11
|
+
import { v as version } from '../shared/cli-nightly.Cf9T6EbF.mjs';
|
|
12
|
+
import { t as tryResolveNuxt } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
13
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
14
14
|
import { g as getPackageManagerVersion } from '../shared/cli-nightly.BSm0_9Hr.mjs';
|
|
15
|
-
import '
|
|
16
|
-
import 'consola';
|
|
15
|
+
import { l as legacyRootDirArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
17
16
|
import 'node:url';
|
|
17
|
+
import 'exsolve';
|
|
18
|
+
import 'consola';
|
|
18
19
|
import 'node:child_process';
|
|
20
|
+
import 'node:path';
|
|
19
21
|
|
|
20
22
|
const info = defineCommand({
|
|
21
23
|
meta: {
|
|
@@ -30,7 +32,7 @@ const info = defineCommand({
|
|
|
30
32
|
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir);
|
|
31
33
|
const nuxtConfig = await getNuxtConfig(cwd);
|
|
32
34
|
const { dependencies = {}, devDependencies = {} } = await readPackageJSON(cwd).catch(() => ({}));
|
|
33
|
-
const nuxtPath =
|
|
35
|
+
const nuxtPath = tryResolveNuxt(cwd);
|
|
34
36
|
async function getDepVersion(name) {
|
|
35
37
|
for (const url of [cwd, nuxtPath]) {
|
|
36
38
|
if (!url) {
|
package/dist/chunks/init.mjs
CHANGED
|
@@ -8,12 +8,13 @@ import { $fetch } from 'ofetch';
|
|
|
8
8
|
import { resolve, relative, join } from 'pathe';
|
|
9
9
|
import { hasTTY } from 'std-env';
|
|
10
10
|
import { x } from 'tinyexec';
|
|
11
|
-
import { r as runCommand } from '../shared/cli-nightly.
|
|
12
|
-
import { l as
|
|
11
|
+
import { r as runCommand } from '../shared/cli-nightly.B4U5vhqQ.mjs';
|
|
12
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
13
|
+
import { a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
13
14
|
import 'node:url';
|
|
14
15
|
import 'node:crypto';
|
|
15
16
|
import 'node:path';
|
|
16
|
-
import '../shared/cli-nightly.
|
|
17
|
+
import '../shared/cli-nightly.Cf9T6EbF.mjs';
|
|
17
18
|
import 'consola';
|
|
18
19
|
|
|
19
20
|
const themeColor = "\x1B[38;2;0;220;130m";
|
package/dist/chunks/prepare.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { defineCommand } from 'citty';
|
|
3
3
|
import { resolve, relative } from 'pathe';
|
|
4
|
-
import { a as clearBuildDir } from '../shared/cli-nightly.
|
|
5
|
-
import { l as loadKit } from '../shared/cli-nightly.
|
|
6
|
-
import {
|
|
4
|
+
import { a as clearBuildDir } from '../shared/cli-nightly.DPmMxQ6h.mjs';
|
|
5
|
+
import { l as loadKit } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
6
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
7
|
+
import { l as legacyRootDirArgs, e as envNameArgs, a as logLevelArgs, c as cwdArgs, d as dotEnvArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
7
8
|
import 'node:fs';
|
|
8
|
-
import '
|
|
9
|
+
import 'node:url';
|
|
10
|
+
import 'exsolve';
|
|
11
|
+
import 'consola';
|
|
9
12
|
import 'node:path';
|
|
10
13
|
import 'std-env';
|
|
11
|
-
import 'consola';
|
|
12
|
-
import 'node:url';
|
|
13
14
|
|
|
14
15
|
const prepare = defineCommand({
|
|
15
16
|
meta: {
|
package/dist/chunks/preview.mjs
CHANGED
|
@@ -7,12 +7,13 @@ import { box, colors } from 'consola/utils';
|
|
|
7
7
|
import { getArgs } from 'listhen/cli';
|
|
8
8
|
import { resolve } from 'pathe';
|
|
9
9
|
import { x } from 'tinyexec';
|
|
10
|
-
import { l as loadKit } from '../shared/cli-nightly.
|
|
11
|
-
import {
|
|
12
|
-
import '
|
|
13
|
-
import 'std-env';
|
|
14
|
-
import 'consola';
|
|
10
|
+
import { l as loadKit } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
11
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
12
|
+
import { d as dotEnvArgs, l as legacyRootDirArgs, e as envNameArgs, a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
15
13
|
import 'node:url';
|
|
14
|
+
import 'exsolve';
|
|
15
|
+
import 'consola';
|
|
16
|
+
import 'std-env';
|
|
16
17
|
|
|
17
18
|
const command = defineCommand({
|
|
18
19
|
meta: {
|
package/dist/chunks/search.mjs
CHANGED
|
@@ -2,12 +2,13 @@ import { defineCommand } from 'citty';
|
|
|
2
2
|
import { colors } from 'consola/utils';
|
|
3
3
|
import Fuse from 'fuse.js';
|
|
4
4
|
import { upperFirst, kebabCase } from 'scule';
|
|
5
|
-
import {
|
|
5
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
6
|
+
import { c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
6
7
|
import { g as getNuxtVersion, f as fetchModules, c as checkNuxtCompatibility } from '../shared/cli-nightly.C935N1ss.mjs';
|
|
8
|
+
import 'consola';
|
|
7
9
|
import 'node:path';
|
|
8
10
|
import 'node:process';
|
|
9
11
|
import 'std-env';
|
|
10
|
-
import 'consola';
|
|
11
12
|
import 'node:url';
|
|
12
13
|
import 'ofetch';
|
|
13
14
|
import 'pkg-types';
|
package/dist/chunks/test.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { defineCommand } from 'citty';
|
|
3
3
|
import { resolve } from 'pathe';
|
|
4
|
-
import {
|
|
4
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
5
|
+
import { l as legacyRootDirArgs, a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
6
|
+
import 'consola';
|
|
5
7
|
import 'node:path';
|
|
6
8
|
import 'std-env';
|
|
7
|
-
import 'consola';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
|
|
10
11
|
const test = defineCommand({
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { defineCommand } from 'citty';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveModulePath } from 'exsolve';
|
|
5
5
|
import { resolve } from 'pathe';
|
|
6
6
|
import { isBun } from 'std-env';
|
|
7
7
|
import { x } from 'tinyexec';
|
|
8
|
-
import { l as loadKit } from '../shared/cli-nightly.
|
|
9
|
-
import {
|
|
8
|
+
import { l as loadKit } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
9
|
+
import { l as legacyRootDirArgs, d as dotEnvArgs, a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
10
10
|
import 'node:path';
|
|
11
11
|
import 'consola';
|
|
12
|
+
import '../shared/cli-nightly.B9AmABr3.mjs';
|
|
12
13
|
|
|
13
14
|
const typecheck = defineCommand({
|
|
14
15
|
meta: {
|
|
@@ -36,10 +37,9 @@ const typecheck = defineCommand({
|
|
|
36
37
|
await writeTypes(nuxt);
|
|
37
38
|
await buildNuxt(nuxt);
|
|
38
39
|
await nuxt.close();
|
|
39
|
-
const jiti = createJiti(cwd);
|
|
40
40
|
const [resolvedTypeScript, resolvedVueTsc] = await Promise.all([
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
resolveModulePath("typescript", { try: true }),
|
|
42
|
+
resolveModulePath("vue-tsc/bin/vue-tsc.js", { try: true })
|
|
43
43
|
]);
|
|
44
44
|
if (resolvedTypeScript && resolvedVueTsc) {
|
|
45
45
|
await x(fileURLToPath(resolvedVueTsc), ["--noEmit"], {
|
package/dist/chunks/upgrade.mjs
CHANGED
|
@@ -5,18 +5,19 @@ import { colors } from 'consola/utils';
|
|
|
5
5
|
import { detectPackageManager, addDependency, dedupeDependencies } from 'nypm';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
7
|
import { readPackageJSON } from 'pkg-types';
|
|
8
|
-
import { l as loadKit } from '../shared/cli-nightly.
|
|
9
|
-
import {
|
|
10
|
-
import { c as cleanupNuxtDirs, n as nuxtVersionToGitIdentifier } from '../shared/cli-nightly.
|
|
8
|
+
import { l as loadKit } from '../shared/cli-nightly.BrKZotr9.mjs';
|
|
9
|
+
import { l as logger } from '../shared/cli-nightly.B9AmABr3.mjs';
|
|
10
|
+
import { c as cleanupNuxtDirs, n as nuxtVersionToGitIdentifier } from '../shared/cli-nightly.Bu_9IHj2.mjs';
|
|
11
11
|
import { g as getPackageManagerVersion } from '../shared/cli-nightly.BSm0_9Hr.mjs';
|
|
12
|
-
import '
|
|
13
|
-
import 'node:path';
|
|
14
|
-
import 'std-env';
|
|
15
|
-
import 'consola';
|
|
12
|
+
import { l as legacyRootDirArgs, a as logLevelArgs, c as cwdArgs } from '../shared/cli-nightly.BgFMCBoq.mjs';
|
|
16
13
|
import 'node:url';
|
|
14
|
+
import 'exsolve';
|
|
15
|
+
import 'consola';
|
|
17
16
|
import 'ohash';
|
|
18
|
-
import '../shared/cli-nightly.
|
|
17
|
+
import '../shared/cli-nightly.DPmMxQ6h.mjs';
|
|
19
18
|
import 'node:child_process';
|
|
19
|
+
import 'node:path';
|
|
20
|
+
import 'std-env';
|
|
20
21
|
|
|
21
22
|
async function getNuxtVersion(path) {
|
|
22
23
|
try {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as listhen from 'listhen';
|
|
2
|
+
import { ListenURL, HTTPSOptions, Listener, ListenOptions } from 'listhen';
|
|
3
|
+
import { NuxtConfig } from '@nuxt/schema';
|
|
4
|
+
import { DotenvOptions } from 'c12';
|
|
5
|
+
import { RequestListener, IncomingMessage, ServerResponse } from 'node:http';
|
|
6
|
+
import EventEmitter from 'node:events';
|
|
7
|
+
|
|
8
|
+
interface NuxtDevContext {
|
|
9
|
+
cwd: string;
|
|
10
|
+
public?: boolean;
|
|
11
|
+
hostname?: string;
|
|
12
|
+
publicURLs?: string[];
|
|
13
|
+
args: {
|
|
14
|
+
clear: boolean;
|
|
15
|
+
logLevel: string;
|
|
16
|
+
dotenv: string;
|
|
17
|
+
envName: string;
|
|
18
|
+
};
|
|
19
|
+
proxy?: {
|
|
20
|
+
url?: string;
|
|
21
|
+
urls?: ListenURL[];
|
|
22
|
+
https?: boolean | HTTPSOptions;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
interface NuxtDevServerOptions {
|
|
26
|
+
cwd: string;
|
|
27
|
+
logLevel?: 'silent' | 'info' | 'verbose';
|
|
28
|
+
dotenv: DotenvOptions;
|
|
29
|
+
envName?: string;
|
|
30
|
+
clear?: boolean;
|
|
31
|
+
defaults: NuxtConfig;
|
|
32
|
+
overrides: NuxtConfig;
|
|
33
|
+
port?: string | number;
|
|
34
|
+
loadingTemplate?: ({ loading }: {
|
|
35
|
+
loading: string;
|
|
36
|
+
}) => string;
|
|
37
|
+
devContext: NuxtDevContext;
|
|
38
|
+
}
|
|
39
|
+
declare class NuxtDevServer extends EventEmitter {
|
|
40
|
+
private options;
|
|
41
|
+
private _handler?;
|
|
42
|
+
private _distWatcher?;
|
|
43
|
+
private _currentNuxt?;
|
|
44
|
+
private _loadingMessage?;
|
|
45
|
+
private _loadingError?;
|
|
46
|
+
private cwd;
|
|
47
|
+
loadDebounced: (reload?: boolean, reason?: string) => void;
|
|
48
|
+
handler: RequestListener;
|
|
49
|
+
listener: Listener;
|
|
50
|
+
constructor(options: NuxtDevServerOptions);
|
|
51
|
+
_renderError(req: IncomingMessage, res: ServerResponse): void;
|
|
52
|
+
resolveLoadingTemplate(): Promise<(params: {
|
|
53
|
+
loading: string;
|
|
54
|
+
}) => string>;
|
|
55
|
+
_renderLoadingScreen(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
56
|
+
init(): Promise<void>;
|
|
57
|
+
load(reload?: boolean, reason?: string): Promise<void>;
|
|
58
|
+
close(): Promise<void>;
|
|
59
|
+
_load(reload?: boolean, reason?: string): Promise<void>;
|
|
60
|
+
_watchConfig(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface InitializeOptions {
|
|
64
|
+
data?: {
|
|
65
|
+
overrides?: NuxtConfig;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
declare function initialize(devContext: NuxtDevContext, ctx?: InitializeOptions, listenOptions?: Partial<ListenOptions>): Promise<{
|
|
69
|
+
listener: listhen.Listener;
|
|
70
|
+
close: () => Promise<void>;
|
|
71
|
+
onReady: (callback: (port: number) => void) => void;
|
|
72
|
+
onRestart: (callback: (devServer: NuxtDevServer) => void) => void;
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
export { initialize };
|