@nuxt/kit 3.0.0-rc.4 → 3.0.0-rc.7
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/index.d.ts +11 -6
- package/dist/index.mjs +127 -75
- package/package.json +11 -11
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Nuxt, ModuleContainer, ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, NuxtOptions, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtHooks, NuxtPlugin, NuxtPluginTemplate
|
|
1
|
+
import { Nuxt, ModuleContainer, ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, NuxtOptions, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtPlugin, NuxtPluginTemplate } from '@nuxt/schema';
|
|
2
2
|
import { LoadConfigOptions } from 'c12';
|
|
3
3
|
import { Import } from 'unimport';
|
|
4
4
|
import { Configuration, WebpackPluginInstance } from 'webpack';
|
|
@@ -53,8 +53,6 @@ interface ExtendConfigOptions {
|
|
|
53
53
|
* @default true
|
|
54
54
|
*/
|
|
55
55
|
build?: boolean;
|
|
56
|
-
}
|
|
57
|
-
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
58
56
|
/**
|
|
59
57
|
* Install plugin on server side
|
|
60
58
|
*
|
|
@@ -67,6 +65,8 @@ interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
|
67
65
|
* @default true
|
|
68
66
|
*/
|
|
69
67
|
client?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {
|
|
70
70
|
/**
|
|
71
71
|
* Install plugin on modern build
|
|
72
72
|
*
|
|
@@ -87,7 +87,7 @@ declare function extendWebpackConfig(fn: ((config: Configuration) => void), opti
|
|
|
87
87
|
/**
|
|
88
88
|
* Extend Vite config
|
|
89
89
|
*/
|
|
90
|
-
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): void;
|
|
90
|
+
declare function extendViteConfig(fn: ((config: UserConfig) => void), options?: ExtendViteConfigOptions): () => void;
|
|
91
91
|
/**
|
|
92
92
|
* Append Webpack plugin to the config.
|
|
93
93
|
*/
|
|
@@ -172,6 +172,8 @@ declare function tryUseNuxt(): Nuxt | null;
|
|
|
172
172
|
*/
|
|
173
173
|
declare function isIgnored(pathname: string): boolean;
|
|
174
174
|
|
|
175
|
+
declare function addLayout(tmpl: NuxtTemplate, name?: string): void;
|
|
176
|
+
|
|
175
177
|
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
176
178
|
|
|
177
179
|
/**
|
|
@@ -233,7 +235,9 @@ interface Resolver {
|
|
|
233
235
|
* Create a relative resolver
|
|
234
236
|
*/
|
|
235
237
|
declare function createResolver(base: string | URL): Resolver;
|
|
236
|
-
declare function resolveFiles(path: string, pattern: string | string[]
|
|
238
|
+
declare function resolveFiles(path: string, pattern: string | string[], opts?: {
|
|
239
|
+
followSymbolicLinks?: boolean;
|
|
240
|
+
}): Promise<string[]>;
|
|
237
241
|
|
|
238
242
|
interface LegacyServerMiddleware {
|
|
239
243
|
route?: string;
|
|
@@ -298,6 +302,7 @@ declare function tryImportModule(id: string, opts?: RequireModuleOptions): Promi
|
|
|
298
302
|
declare function tryRequireModule(id: string, opts?: RequireModuleOptions): any;
|
|
299
303
|
|
|
300
304
|
declare function compileTemplate(template: NuxtTemplate, ctx: any): Promise<string>;
|
|
305
|
+
/** @deprecated */
|
|
301
306
|
declare const templateUtils: {
|
|
302
307
|
serialize: (data: any) => string;
|
|
303
308
|
importName: typeof genSafeVariableName;
|
|
@@ -306,4 +311,4 @@ declare const templateUtils: {
|
|
|
306
311
|
}) => string;
|
|
307
312
|
};
|
|
308
313
|
|
|
309
|
-
export { AddComponentOptions, AddPluginOptions, ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, LegacyServerMiddleware, LoadNuxtConfigOptions, LoadNuxtOptions, RequireModuleOptions, ResolveModuleOptions, ResolvePathOptions, Resolver, addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNuxt };
|
|
314
|
+
export { AddComponentOptions, AddPluginOptions, ExtendConfigOptions, ExtendViteConfigOptions, ExtendWebpackConfigOptions, LegacyServerMiddleware, LoadNuxtConfigOptions, LoadNuxtOptions, RequireModuleOptions, ResolveModuleOptions, ResolvePathOptions, Resolver, addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addLayout, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNuxt };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { parse, basename, resolve,
|
|
2
|
-
import consola from 'consola';
|
|
1
|
+
import { parse, basename, resolve, relative, join, normalize, isAbsolute, dirname } from 'pathe';
|
|
3
2
|
import { existsSync, readFileSync, promises } from 'node:fs';
|
|
4
3
|
import hash from 'hash-sum';
|
|
5
4
|
import { getContext } from 'unctx';
|
|
5
|
+
import { kebabCase, pascalCase } from 'scule';
|
|
6
6
|
import satisfies from 'semver/functions/satisfies.js';
|
|
7
|
+
import consola from 'consola';
|
|
7
8
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
9
|
+
import { globby } from 'globby';
|
|
8
10
|
import { interopDefault } from 'mlly';
|
|
9
11
|
import jiti from 'jiti';
|
|
10
|
-
import { globby } from 'globby';
|
|
11
12
|
import ignore from 'ignore';
|
|
12
13
|
import defu from 'defu';
|
|
13
14
|
import { applyDefaults } from 'untyped';
|
|
@@ -16,12 +17,6 @@ import { genSafeVariableName, genDynamicImport, genImport } from 'knitwork';
|
|
|
16
17
|
import { loadConfig } from 'c12';
|
|
17
18
|
import { NuxtConfigSchema } from '@nuxt/schema';
|
|
18
19
|
import { resolvePackageJSON, readPackageJSON } from 'pkg-types';
|
|
19
|
-
import { kebabCase, pascalCase } from 'scule';
|
|
20
|
-
|
|
21
|
-
const logger = consola;
|
|
22
|
-
function useLogger(scope) {
|
|
23
|
-
return scope ? logger.withScope(scope) : logger;
|
|
24
|
-
}
|
|
25
20
|
|
|
26
21
|
function chainFn(base, fn) {
|
|
27
22
|
if (typeof fn !== "function") {
|
|
@@ -35,7 +30,11 @@ function chainFn(base, fn) {
|
|
|
35
30
|
if (baseResult === void 0) {
|
|
36
31
|
[baseResult] = args;
|
|
37
32
|
}
|
|
38
|
-
const fnResult = fn.call(
|
|
33
|
+
const fnResult = fn.call(
|
|
34
|
+
this,
|
|
35
|
+
baseResult,
|
|
36
|
+
...Array.prototype.slice.call(args, 1)
|
|
37
|
+
);
|
|
39
38
|
if (fnResult === void 0) {
|
|
40
39
|
return baseResult;
|
|
41
40
|
}
|
|
@@ -45,14 +44,14 @@ function chainFn(base, fn) {
|
|
|
45
44
|
|
|
46
45
|
const nuxtCtx = getContext("nuxt");
|
|
47
46
|
function useNuxt() {
|
|
48
|
-
const instance = nuxtCtx.
|
|
47
|
+
const instance = nuxtCtx.tryUse();
|
|
49
48
|
if (!instance) {
|
|
50
49
|
throw new Error("Nuxt instance is unavailable!");
|
|
51
50
|
}
|
|
52
51
|
return instance;
|
|
53
52
|
}
|
|
54
53
|
function tryUseNuxt() {
|
|
55
|
-
return nuxtCtx.
|
|
54
|
+
return nuxtCtx.tryUse();
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
function addTemplate(_template) {
|
|
@@ -96,16 +95,6 @@ function normalizeTemplate(template) {
|
|
|
96
95
|
return template;
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
function addServerMiddleware(middleware) {
|
|
100
|
-
useNuxt().options.serverMiddleware.push(middleware);
|
|
101
|
-
}
|
|
102
|
-
function addServerHandler(handler) {
|
|
103
|
-
useNuxt().options.serverHandlers.push(handler);
|
|
104
|
-
}
|
|
105
|
-
function addDevServerHandler(handler) {
|
|
106
|
-
useNuxt().options.devServerHandlers.push(handler);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
98
|
async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
|
|
110
99
|
const issues = [];
|
|
111
100
|
if (constraints.nuxt) {
|
|
@@ -162,38 +151,60 @@ function getNuxtVersion(nuxt = useNuxt()) {
|
|
|
162
151
|
return version;
|
|
163
152
|
}
|
|
164
153
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
} else {
|
|
169
|
-
plugin = { ...plugin };
|
|
170
|
-
}
|
|
171
|
-
if (!plugin.src) {
|
|
172
|
-
throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
|
|
173
|
-
}
|
|
174
|
-
plugin.src = normalize(plugin.src);
|
|
175
|
-
if (plugin.ssr) {
|
|
176
|
-
plugin.mode = "server";
|
|
177
|
-
}
|
|
178
|
-
if (!plugin.mode) {
|
|
179
|
-
const [, mode = "all"] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || [];
|
|
180
|
-
plugin.mode = mode;
|
|
181
|
-
}
|
|
182
|
-
return plugin;
|
|
154
|
+
const logger = consola;
|
|
155
|
+
function useLogger(scope) {
|
|
156
|
+
return scope ? logger.withScope(scope) : logger;
|
|
183
157
|
}
|
|
184
|
-
|
|
158
|
+
|
|
159
|
+
function addLayout(tmpl, name) {
|
|
185
160
|
const nuxt = useNuxt();
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
161
|
+
const { filename, src } = addTemplate(tmpl);
|
|
162
|
+
const layoutName = kebabCase(name || parse(tmpl.filename).name).replace(/["']/g, "");
|
|
163
|
+
if (isNuxt2(nuxt)) {
|
|
164
|
+
const layout = nuxt.options.layouts[layoutName];
|
|
165
|
+
if (layout) {
|
|
166
|
+
return logger.warn(
|
|
167
|
+
`Not overriding \`${layoutName}\` (provided by \`${layout}\`) with \`${src || filename}\`.`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
nuxt.options.layouts[layoutName] = `./${filename}`;
|
|
171
|
+
if (name === "error") {
|
|
172
|
+
this.addErrorLayout(filename);
|
|
173
|
+
}
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
nuxt.hook("app:templates", (app) => {
|
|
177
|
+
if (layoutName in app.layouts) {
|
|
178
|
+
const relativePath = relative(nuxt.options.srcDir, app.layouts[layoutName].file);
|
|
179
|
+
return logger.warn(
|
|
180
|
+
`Not overriding \`${layoutName}\` (provided by \`~/${relativePath}\`) with \`${src || filename}\`.`
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
app.layouts[layoutName] = {
|
|
184
|
+
file: join("#build", filename),
|
|
185
|
+
name: layoutName
|
|
186
|
+
};
|
|
187
|
+
});
|
|
190
188
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
|
|
190
|
+
function normalizeHandlerMethod(handler) {
|
|
191
|
+
const [, method = void 0] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || [];
|
|
192
|
+
return {
|
|
193
|
+
method,
|
|
194
|
+
...handler
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function addServerMiddleware(middleware) {
|
|
198
|
+
useNuxt().options.serverMiddleware.push(middleware);
|
|
199
|
+
}
|
|
200
|
+
function addServerHandler(handler) {
|
|
201
|
+
useNuxt().options.serverHandlers.push(normalizeHandlerMethod(handler));
|
|
202
|
+
}
|
|
203
|
+
function addDevServerHandler(handler) {
|
|
204
|
+
useNuxt().options.devServerHandlers.push(handler);
|
|
194
205
|
}
|
|
195
206
|
|
|
196
|
-
const _require = jiti(process.cwd(), { interopDefault: true });
|
|
207
|
+
const _require = jiti(process.cwd(), { interopDefault: true, esmResolve: true });
|
|
197
208
|
function isNodeModules(id) {
|
|
198
209
|
return /[/\\]node_modules[/\\]/.test(id);
|
|
199
210
|
}
|
|
@@ -240,7 +251,12 @@ function requireModulePkg(id, opts = {}) {
|
|
|
240
251
|
}
|
|
241
252
|
function resolveModule(id, opts = {}) {
|
|
242
253
|
return normalize(_require.resolve(id, {
|
|
243
|
-
paths: [].concat(
|
|
254
|
+
paths: [].concat(
|
|
255
|
+
global.__NUXT_PREPATHS__,
|
|
256
|
+
opts.paths,
|
|
257
|
+
process.cwd(),
|
|
258
|
+
global.__NUXT_PATHS__
|
|
259
|
+
).filter(Boolean)
|
|
244
260
|
}));
|
|
245
261
|
}
|
|
246
262
|
function tryResolveModule(path, opts = {}) {
|
|
@@ -304,7 +320,7 @@ function isIgnored(pathname) {
|
|
|
304
320
|
async function resolvePath(path, opts = {}) {
|
|
305
321
|
const _path = path;
|
|
306
322
|
path = normalize(path);
|
|
307
|
-
if (isAbsolute(path) && existsSync(path)) {
|
|
323
|
+
if (isAbsolute(path) && existsSync(path) && !await isDirectory(path)) {
|
|
308
324
|
return path;
|
|
309
325
|
}
|
|
310
326
|
const nuxt = useNuxt();
|
|
@@ -315,10 +331,10 @@ async function resolvePath(path, opts = {}) {
|
|
|
315
331
|
if (!isAbsolute(path)) {
|
|
316
332
|
path = resolve(cwd, path);
|
|
317
333
|
}
|
|
318
|
-
let
|
|
334
|
+
let _isDir = false;
|
|
319
335
|
if (existsSync(path)) {
|
|
320
|
-
|
|
321
|
-
if (!
|
|
336
|
+
_isDir = await isDirectory(path);
|
|
337
|
+
if (!_isDir) {
|
|
322
338
|
return path;
|
|
323
339
|
}
|
|
324
340
|
}
|
|
@@ -328,7 +344,7 @@ async function resolvePath(path, opts = {}) {
|
|
|
328
344
|
return pathWithExt;
|
|
329
345
|
}
|
|
330
346
|
const pathWithIndex = join(path, "index" + ext);
|
|
331
|
-
if (
|
|
347
|
+
if (_isDir && existsSync(pathWithIndex)) {
|
|
332
348
|
return pathWithIndex;
|
|
333
349
|
}
|
|
334
350
|
}
|
|
@@ -345,8 +361,8 @@ async function findPath(paths, opts, pathType = "file") {
|
|
|
345
361
|
for (const path of paths) {
|
|
346
362
|
const rPath = await resolvePath(path, opts);
|
|
347
363
|
if (await existsSensitive(rPath)) {
|
|
348
|
-
const
|
|
349
|
-
if (!pathType || pathType === "file" && !
|
|
364
|
+
const _isDir = await isDirectory(rPath);
|
|
365
|
+
if (!pathType || pathType === "file" && !_isDir || pathType === "dir" && _isDir) {
|
|
350
366
|
return rPath;
|
|
351
367
|
}
|
|
352
368
|
}
|
|
@@ -387,9 +403,43 @@ async function existsSensitive(path) {
|
|
|
387
403
|
const dirFiles = await promises.readdir(dirname(path));
|
|
388
404
|
return dirFiles.includes(basename(path));
|
|
389
405
|
}
|
|
390
|
-
async function
|
|
391
|
-
|
|
392
|
-
|
|
406
|
+
async function isDirectory(path) {
|
|
407
|
+
return (await promises.lstat(path)).isDirectory();
|
|
408
|
+
}
|
|
409
|
+
async function resolveFiles(path, pattern, opts = {}) {
|
|
410
|
+
const files = await globby(pattern, { cwd: path, followSymbolicLinks: opts.followSymbolicLinks ?? true });
|
|
411
|
+
return files.map((p) => resolve(path, p)).filter((p) => !isIgnored(p)).sort();
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function normalizePlugin(plugin) {
|
|
415
|
+
if (typeof plugin === "string") {
|
|
416
|
+
plugin = { src: plugin };
|
|
417
|
+
} else {
|
|
418
|
+
plugin = { ...plugin };
|
|
419
|
+
}
|
|
420
|
+
if (!plugin.src) {
|
|
421
|
+
throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
|
|
422
|
+
}
|
|
423
|
+
plugin.src = normalize(resolveAlias(plugin.src));
|
|
424
|
+
if (plugin.ssr) {
|
|
425
|
+
plugin.mode = "server";
|
|
426
|
+
}
|
|
427
|
+
if (!plugin.mode) {
|
|
428
|
+
const [, mode = "all"] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || [];
|
|
429
|
+
plugin.mode = mode;
|
|
430
|
+
}
|
|
431
|
+
return plugin;
|
|
432
|
+
}
|
|
433
|
+
function addPlugin(_plugin, opts = {}) {
|
|
434
|
+
const nuxt = useNuxt();
|
|
435
|
+
const plugin = normalizePlugin(_plugin);
|
|
436
|
+
nuxt.options.plugins = nuxt.options.plugins.filter((p) => normalizePlugin(p).src !== plugin.src);
|
|
437
|
+
nuxt.options.plugins[opts.append ? "push" : "unshift"](plugin);
|
|
438
|
+
return plugin;
|
|
439
|
+
}
|
|
440
|
+
function addPluginTemplate(plugin, opts = {}) {
|
|
441
|
+
const normalizedPlugin = typeof plugin === "string" ? { src: plugin } : { ...plugin, src: addTemplate(plugin).dst };
|
|
442
|
+
return addPlugin(normalizedPlugin, opts);
|
|
393
443
|
}
|
|
394
444
|
|
|
395
445
|
async function installModule(moduleToInstall, _inlineOptions, _nuxt) {
|
|
@@ -466,16 +516,7 @@ function useModuleContainer(nuxt = useNuxt()) {
|
|
|
466
516
|
return addPluginTemplate(pluginTemplate);
|
|
467
517
|
},
|
|
468
518
|
addLayout(tmpl, name) {
|
|
469
|
-
|
|
470
|
-
const layoutName = name || parse(src).name;
|
|
471
|
-
const layout = nuxt.options.layouts[layoutName];
|
|
472
|
-
if (layout) {
|
|
473
|
-
logger.warn(`Duplicate layout registration, "${layoutName}" has been registered as "${layout}"`);
|
|
474
|
-
}
|
|
475
|
-
nuxt.options.layouts[layoutName] = `./${filename}`;
|
|
476
|
-
if (name === "error") {
|
|
477
|
-
this.addErrorLayout(filename);
|
|
478
|
-
}
|
|
519
|
+
return addLayout(tmpl, name);
|
|
479
520
|
},
|
|
480
521
|
addErrorLayout(dst) {
|
|
481
522
|
const relativeBuildDir = relative(nuxt.options.rootDir, nuxt.options.buildDir);
|
|
@@ -531,7 +572,8 @@ const importSources = (sources, { lazy = false } = {}) => {
|
|
|
531
572
|
return genImport(src, genSafeVariableName(src));
|
|
532
573
|
}).join("\n");
|
|
533
574
|
};
|
|
534
|
-
const
|
|
575
|
+
const importName = genSafeVariableName;
|
|
576
|
+
const templateUtils = { serialize, importName, importSources };
|
|
535
577
|
|
|
536
578
|
function defineNuxtModule(definition) {
|
|
537
579
|
if (typeof definition === "function") {
|
|
@@ -592,7 +634,7 @@ function nuxt2Shims(nuxt) {
|
|
|
592
634
|
}
|
|
593
635
|
nuxt[NUXT2_SHIMS_KEY] = true;
|
|
594
636
|
nuxt.hooks = nuxt;
|
|
595
|
-
if (!nuxtCtx.
|
|
637
|
+
if (!nuxtCtx.tryUse()) {
|
|
596
638
|
nuxtCtx.set(nuxt);
|
|
597
639
|
nuxt.hook("close", () => nuxtCtx.unset());
|
|
598
640
|
}
|
|
@@ -734,7 +776,17 @@ function extendViteConfig(fn, options = {}) {
|
|
|
734
776
|
if (options.build === false && nuxt.options.build) {
|
|
735
777
|
return;
|
|
736
778
|
}
|
|
737
|
-
|
|
779
|
+
if (options.server !== false && options.client !== false) {
|
|
780
|
+
return nuxt.hook("vite:extend", ({ config }) => fn(config));
|
|
781
|
+
}
|
|
782
|
+
nuxt.hook("vite:extendConfig", (config, { isClient, isServer }) => {
|
|
783
|
+
if (options.server !== false && isServer) {
|
|
784
|
+
return fn(config);
|
|
785
|
+
}
|
|
786
|
+
if (options.client !== false && isClient) {
|
|
787
|
+
return fn(config);
|
|
788
|
+
}
|
|
789
|
+
});
|
|
738
790
|
}
|
|
739
791
|
function addWebpackPlugin(plugin, options) {
|
|
740
792
|
extendWebpackConfig((config) => {
|
|
@@ -778,7 +830,7 @@ async function addComponent(opts) {
|
|
|
778
830
|
...opts
|
|
779
831
|
};
|
|
780
832
|
nuxt.hook("components:extend", (components) => {
|
|
781
|
-
const existingComponent = components.find((c) => c.pascalName === component.pascalName || c.kebabName === component.kebabName);
|
|
833
|
+
const existingComponent = components.find((c) => (c.pascalName === component.pascalName || c.kebabName === component.kebabName) && c.mode === component.mode);
|
|
782
834
|
if (existingComponent) {
|
|
783
835
|
const name = existingComponent.pascalName || existingComponent.kebabName;
|
|
784
836
|
console.warn(`Overriding ${name} component.`);
|
|
@@ -798,4 +850,4 @@ function extendPages(cb) {
|
|
|
798
850
|
}
|
|
799
851
|
}
|
|
800
852
|
|
|
801
|
-
export { addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNuxt };
|
|
853
|
+
export { addAutoImport, addAutoImportDir, addComponent, addComponentsDir, addDevServerHandler, addLayout, addPlugin, addPluginTemplate, addServerHandler, addServerMiddleware, addTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, clearRequireCache, compileTemplate, createResolver, defineNuxtModule, extendPages, extendViteConfig, extendWebpackConfig, findPath, getNuxtVersion, getRequireCacheItem, hasNuxtCompatibility, importModule, installModule, isIgnored, isNodeModules, isNuxt2, isNuxt3, loadNuxt, loadNuxtConfig, logger, normalizePlugin, normalizeTemplate, nuxtCtx, requireModule, requireModulePkg, resolveAlias, resolveFiles, resolveModule, resolvePath, scanRequireTree, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, useLogger, useModuleContainer, useNuxt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.7",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,24 +13,24 @@
|
|
|
13
13
|
"prepack": "unbuild"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@nuxt/schema": "
|
|
17
|
-
"c12": "^0.2.
|
|
16
|
+
"@nuxt/schema": "3.0.0-rc.7",
|
|
17
|
+
"c12": "^0.2.9",
|
|
18
18
|
"consola": "^2.15.3",
|
|
19
19
|
"defu": "^6.0.0",
|
|
20
20
|
"globby": "^13.1.2",
|
|
21
21
|
"hash-sum": "^2.0.0",
|
|
22
22
|
"ignore": "^5.2.0",
|
|
23
|
-
"jiti": "^1.
|
|
23
|
+
"jiti": "^1.14.0",
|
|
24
24
|
"knitwork": "^0.1.2",
|
|
25
25
|
"lodash.template": "^4.5.0",
|
|
26
|
-
"mlly": "^0.5.
|
|
27
|
-
"pathe": "^0.3.
|
|
28
|
-
"pkg-types": "^0.3.
|
|
29
|
-
"scule": "^0.2
|
|
26
|
+
"mlly": "^0.5.10",
|
|
27
|
+
"pathe": "^0.3.4",
|
|
28
|
+
"pkg-types": "^0.3.3",
|
|
29
|
+
"scule": "^0.3.2",
|
|
30
30
|
"semver": "^7.3.7",
|
|
31
|
-
"unctx": "^
|
|
32
|
-
"unimport": "^0.
|
|
33
|
-
"untyped": "^0.4.
|
|
31
|
+
"unctx": "^2.0.1",
|
|
32
|
+
"unimport": "^0.6.7",
|
|
33
|
+
"untyped": "^0.4.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/lodash.template": "^4",
|