@nuxt/kit 3.15.2 → 3.15.3
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.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.mjs +106 -77
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
1
2
|
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
2
3
|
import { LoadConfigOptions } from 'c12';
|
|
3
4
|
import { Import } from 'unimport';
|
|
@@ -188,7 +189,7 @@ declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
|
188
189
|
*/
|
|
189
190
|
declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
190
191
|
prepend?: boolean;
|
|
191
|
-
}):
|
|
192
|
+
}): void;
|
|
192
193
|
type AddComponentOptions = {
|
|
193
194
|
name: string;
|
|
194
195
|
filePath: string;
|
|
@@ -198,7 +199,7 @@ type AddComponentOptions = {
|
|
|
198
199
|
*
|
|
199
200
|
* Requires Nuxt 2.13+
|
|
200
201
|
*/
|
|
201
|
-
declare function addComponent(opts: AddComponentOptions):
|
|
202
|
+
declare function addComponent(opts: AddComponentOptions): void;
|
|
202
203
|
|
|
203
204
|
/** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
|
|
204
205
|
declare const nuxtCtx: unctx.UseContext<Nuxt>;
|
|
@@ -226,10 +227,11 @@ declare function useNuxt(): Nuxt;
|
|
|
226
227
|
*/
|
|
227
228
|
declare function tryUseNuxt(): Nuxt | null;
|
|
228
229
|
|
|
230
|
+
declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
|
|
229
231
|
/**
|
|
230
232
|
* Return a filter function to filter an array of paths
|
|
231
233
|
*/
|
|
232
|
-
declare function isIgnored(pathname: string): boolean;
|
|
234
|
+
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
|
|
233
235
|
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
234
236
|
|
|
235
237
|
declare function addLayout(this: any, template: NuxtTemplate | string, name?: string): void;
|
|
@@ -449,4 +451,4 @@ declare const templateUtils: {
|
|
|
449
451
|
}) => string;
|
|
450
452
|
};
|
|
451
453
|
|
|
452
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
454
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createIsIgnored, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
1
2
|
import { ModuleOptions, ModuleDefinition, NuxtModule, NuxtConfig, Nuxt, ModuleMeta, NuxtOptions, SchemaDefinition, ImportPresetWithDeprecation, NuxtCompatibility, NuxtCompatibilityIssues, ComponentsDir, Component, NuxtTemplate, NuxtHooks, NuxtMiddleware, NuxtPlugin, NuxtPluginTemplate, ResolvedNuxtTemplate, NuxtServerTemplate, NuxtTypeTemplate } from '@nuxt/schema';
|
|
2
3
|
import { LoadConfigOptions } from 'c12';
|
|
3
4
|
import { Import } from 'unimport';
|
|
@@ -188,7 +189,7 @@ declare function getNuxtVersion(nuxt?: Nuxt | any): string;
|
|
|
188
189
|
*/
|
|
189
190
|
declare function addComponentsDir(dir: ComponentsDir, opts?: {
|
|
190
191
|
prepend?: boolean;
|
|
191
|
-
}):
|
|
192
|
+
}): void;
|
|
192
193
|
type AddComponentOptions = {
|
|
193
194
|
name: string;
|
|
194
195
|
filePath: string;
|
|
@@ -198,7 +199,7 @@ type AddComponentOptions = {
|
|
|
198
199
|
*
|
|
199
200
|
* Requires Nuxt 2.13+
|
|
200
201
|
*/
|
|
201
|
-
declare function addComponent(opts: AddComponentOptions):
|
|
202
|
+
declare function addComponent(opts: AddComponentOptions): void;
|
|
202
203
|
|
|
203
204
|
/** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
|
|
204
205
|
declare const nuxtCtx: unctx.UseContext<Nuxt>;
|
|
@@ -226,10 +227,11 @@ declare function useNuxt(): Nuxt;
|
|
|
226
227
|
*/
|
|
227
228
|
declare function tryUseNuxt(): Nuxt | null;
|
|
228
229
|
|
|
230
|
+
declare function createIsIgnored(nuxt?: _nuxt_schema.Nuxt | null): (pathname: string, stats?: unknown) => boolean;
|
|
229
231
|
/**
|
|
230
232
|
* Return a filter function to filter an array of paths
|
|
231
233
|
*/
|
|
232
|
-
declare function isIgnored(pathname: string): boolean;
|
|
234
|
+
declare function isIgnored(pathname: string, _stats?: unknown, nuxt?: _nuxt_schema.Nuxt | null): boolean;
|
|
233
235
|
declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
234
236
|
|
|
235
237
|
declare function addLayout(this: any, template: NuxtTemplate | string, name?: string): void;
|
|
@@ -449,4 +451,4 @@ declare const templateUtils: {
|
|
|
449
451
|
}) => string;
|
|
450
452
|
};
|
|
451
453
|
|
|
452
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
454
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LoadNuxtConfigOptions, type LoadNuxtOptions, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createIsIgnored, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -52,11 +52,15 @@ const builderMap = {
|
|
|
52
52
|
"@nuxt/vite-builder": "vite",
|
|
53
53
|
"@nuxt/webpack-builder": "webpack"
|
|
54
54
|
};
|
|
55
|
+
function checkNuxtVersion(version, nuxt = useNuxt()) {
|
|
56
|
+
const nuxtVersion = getNuxtVersion(nuxt);
|
|
57
|
+
return satisfies(normalizeSemanticVersion(nuxtVersion), version, { includePrerelease: true });
|
|
58
|
+
}
|
|
55
59
|
async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
|
|
56
60
|
const issues = [];
|
|
57
61
|
if (constraints.nuxt) {
|
|
58
62
|
const nuxtVersion = getNuxtVersion(nuxt);
|
|
59
|
-
if (!
|
|
63
|
+
if (!checkNuxtVersion(constraints.nuxt, nuxt)) {
|
|
60
64
|
issues.push({
|
|
61
65
|
name: "nuxt",
|
|
62
66
|
message: `Nuxt version \`${constraints.nuxt}\` is required but currently using \`${nuxtVersion}\``
|
|
@@ -2205,8 +2209,10 @@ function nuxt2Shims(nuxt) {
|
|
|
2205
2209
|
});
|
|
2206
2210
|
}
|
|
2207
2211
|
|
|
2208
|
-
function
|
|
2209
|
-
|
|
2212
|
+
function createIsIgnored(nuxt = tryUseNuxt()) {
|
|
2213
|
+
return (pathname, stats) => isIgnored(pathname, stats, nuxt);
|
|
2214
|
+
}
|
|
2215
|
+
function isIgnored(pathname, _stats, nuxt = tryUseNuxt()) {
|
|
2210
2216
|
if (!nuxt) {
|
|
2211
2217
|
return false;
|
|
2212
2218
|
}
|
|
@@ -2261,68 +2267,20 @@ function resolveGroupSyntax(group) {
|
|
|
2261
2267
|
}
|
|
2262
2268
|
|
|
2263
2269
|
async function resolvePath(path, opts = {}) {
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
if (opts?.virtual && existsInVFS(path)) {
|
|
2268
|
-
return path;
|
|
2269
|
-
}
|
|
2270
|
-
if (existsSync(path) && !await isDirectory(path)) {
|
|
2271
|
-
return path;
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
const nuxt = tryUseNuxt();
|
|
2275
|
-
const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd());
|
|
2276
|
-
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [".ts", ".mjs", ".cjs", ".json"]);
|
|
2277
|
-
const modulesDir = nuxt ? nuxt.options.modulesDir : [];
|
|
2278
|
-
path = resolveAlias(path);
|
|
2279
|
-
if (!isAbsolute(path)) {
|
|
2280
|
-
path = resolve(cwd, path);
|
|
2270
|
+
const res = await _resolvePathGranularly(path, opts);
|
|
2271
|
+
if (res.type === "file") {
|
|
2272
|
+
return res.path;
|
|
2281
2273
|
}
|
|
2282
|
-
|
|
2283
|
-
return path;
|
|
2284
|
-
}
|
|
2285
|
-
let _isDir = false;
|
|
2286
|
-
if (existsSync(path)) {
|
|
2287
|
-
_isDir = await isDirectory(path);
|
|
2288
|
-
if (!_isDir) {
|
|
2289
|
-
return path;
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
for (const ext of extensions) {
|
|
2293
|
-
const pathWithExt = path + ext;
|
|
2294
|
-
if (opts?.virtual && existsInVFS(pathWithExt, nuxt)) {
|
|
2295
|
-
return pathWithExt;
|
|
2296
|
-
}
|
|
2297
|
-
if (existsSync(pathWithExt)) {
|
|
2298
|
-
return pathWithExt;
|
|
2299
|
-
}
|
|
2300
|
-
const pathWithIndex = join(path, "index" + ext);
|
|
2301
|
-
if (opts?.virtual && existsInVFS(pathWithIndex, nuxt)) {
|
|
2302
|
-
return pathWithIndex;
|
|
2303
|
-
}
|
|
2304
|
-
if (_isDir && existsSync(pathWithIndex)) {
|
|
2305
|
-
return pathWithIndex;
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
const resolveModulePath = await resolvePath$1(_path, { url: [cwd, ...modulesDir] }).catch(() => null);
|
|
2309
|
-
if (resolveModulePath) {
|
|
2310
|
-
return resolveModulePath;
|
|
2311
|
-
}
|
|
2312
|
-
return opts.fallbackToOriginal ? _path : path;
|
|
2274
|
+
return opts.fallbackToOriginal ? path : res.path;
|
|
2313
2275
|
}
|
|
2314
2276
|
async function findPath(paths, opts, pathType = "file") {
|
|
2315
|
-
const nuxt = opts?.virtual ? tryUseNuxt() : undefined;
|
|
2316
2277
|
for (const path of toArray(paths)) {
|
|
2317
|
-
const
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2320
|
-
}
|
|
2321
|
-
if (await existsSensitive(
|
|
2322
|
-
|
|
2323
|
-
if (!pathType || pathType === "file" && !_isDir || pathType === "dir" && _isDir) {
|
|
2324
|
-
return rPath;
|
|
2325
|
-
}
|
|
2278
|
+
const res = await _resolvePathGranularly(path, opts);
|
|
2279
|
+
if (!res.type || pathType && res.type !== pathType) {
|
|
2280
|
+
continue;
|
|
2281
|
+
}
|
|
2282
|
+
if (res.virtual || await existsSensitive(res.path)) {
|
|
2283
|
+
return res.path;
|
|
2326
2284
|
}
|
|
2327
2285
|
}
|
|
2328
2286
|
return null;
|
|
@@ -2359,15 +2317,82 @@ async function resolveNuxtModule(base, paths) {
|
|
|
2359
2317
|
}
|
|
2360
2318
|
return resolved;
|
|
2361
2319
|
}
|
|
2362
|
-
async function
|
|
2363
|
-
if (
|
|
2364
|
-
return
|
|
2320
|
+
async function _resolvePathType(path, opts = {}, skipFs = false) {
|
|
2321
|
+
if (opts?.virtual && existsInVFS(path)) {
|
|
2322
|
+
return {
|
|
2323
|
+
path,
|
|
2324
|
+
type: "file",
|
|
2325
|
+
virtual: true
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
if (skipFs) {
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
const fd = await promises.open(path, "r").catch(() => null);
|
|
2332
|
+
try {
|
|
2333
|
+
const stats = await fd?.stat();
|
|
2334
|
+
if (stats) {
|
|
2335
|
+
return {
|
|
2336
|
+
path,
|
|
2337
|
+
type: stats.isFile() ? "file" : "dir",
|
|
2338
|
+
virtual: false
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
} finally {
|
|
2342
|
+
fd?.close();
|
|
2365
2343
|
}
|
|
2366
|
-
const dirFiles = await promises.readdir(dirname(path));
|
|
2367
|
-
return dirFiles.includes(basename(path));
|
|
2368
2344
|
}
|
|
2369
|
-
async function
|
|
2370
|
-
|
|
2345
|
+
async function _resolvePathGranularly(path, opts = {}) {
|
|
2346
|
+
const _path = path;
|
|
2347
|
+
path = normalize(path);
|
|
2348
|
+
if (isAbsolute(path)) {
|
|
2349
|
+
const res2 = await _resolvePathType(path, opts);
|
|
2350
|
+
if (res2 && res2.type === "file") {
|
|
2351
|
+
return res2;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
const nuxt = tryUseNuxt();
|
|
2355
|
+
const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd());
|
|
2356
|
+
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [".ts", ".mjs", ".cjs", ".json"]);
|
|
2357
|
+
const modulesDir = nuxt ? nuxt.options.modulesDir : [];
|
|
2358
|
+
path = resolveAlias(path);
|
|
2359
|
+
if (!isAbsolute(path)) {
|
|
2360
|
+
path = resolve(cwd, path);
|
|
2361
|
+
}
|
|
2362
|
+
const res = await _resolvePathType(path, opts);
|
|
2363
|
+
if (res && res.type === "file") {
|
|
2364
|
+
return res;
|
|
2365
|
+
}
|
|
2366
|
+
for (const ext of extensions) {
|
|
2367
|
+
const extPath = await _resolvePathType(path + ext, opts);
|
|
2368
|
+
if (extPath && extPath.type === "file") {
|
|
2369
|
+
return extPath;
|
|
2370
|
+
}
|
|
2371
|
+
const indexPath = await _resolvePathType(
|
|
2372
|
+
join(path, "index" + ext),
|
|
2373
|
+
opts,
|
|
2374
|
+
res?.type !== "dir"
|
|
2375
|
+
/* skip checking if parent is not a directory */
|
|
2376
|
+
);
|
|
2377
|
+
if (indexPath && indexPath.type === "file") {
|
|
2378
|
+
return indexPath;
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
const resolvedModulePath = await resolvePath$1(_path, { url: [cwd, ...modulesDir] }).catch(() => null);
|
|
2382
|
+
if (resolvedModulePath) {
|
|
2383
|
+
return {
|
|
2384
|
+
path: resolvedModulePath,
|
|
2385
|
+
type: "file",
|
|
2386
|
+
virtual: false
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
return {
|
|
2390
|
+
path
|
|
2391
|
+
};
|
|
2392
|
+
}
|
|
2393
|
+
async function existsSensitive(path) {
|
|
2394
|
+
const dirFiles = await promises.readdir(dirname(path)).catch(() => null);
|
|
2395
|
+
return dirFiles && dirFiles.includes(basename(path));
|
|
2371
2396
|
}
|
|
2372
2397
|
function existsInVFS(path, nuxt = tryUseNuxt()) {
|
|
2373
2398
|
if (!nuxt) {
|
|
@@ -2393,11 +2418,11 @@ async function resolveFiles(path, pattern, opts = {}) {
|
|
|
2393
2418
|
const NODE_MODULES_RE = /[/\\]node_modules[/\\]/;
|
|
2394
2419
|
async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
2395
2420
|
const { nuxtModule, buildTimeModuleMeta, resolvedModulePath } = await loadNuxtModuleInstance(moduleToInstall, nuxt);
|
|
2396
|
-
const localLayerModuleDirs =
|
|
2421
|
+
const localLayerModuleDirs = [];
|
|
2397
2422
|
for (const l of nuxt.options._layers) {
|
|
2398
2423
|
const srcDir = l.config.srcDir || l.cwd;
|
|
2399
2424
|
if (!NODE_MODULES_RE.test(srcDir)) {
|
|
2400
|
-
localLayerModuleDirs.
|
|
2425
|
+
localLayerModuleDirs.push(resolve(srcDir, l.config?.dir?.modules || "modules").replace(/\/?$/, "/"));
|
|
2401
2426
|
}
|
|
2402
2427
|
}
|
|
2403
2428
|
const res = (isNuxt2() ? await nuxtModule.call(nuxt.moduleContainer, inlineOptions, nuxt) : await nuxtModule(inlineOptions, nuxt)) ?? {};
|
|
@@ -2409,8 +2434,8 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
2409
2434
|
const parsed = parseNodeModulePath(modulePath);
|
|
2410
2435
|
const moduleRoot = parsed.dir ? parsed.dir + parsed.name : modulePath;
|
|
2411
2436
|
nuxt.options.build.transpile.push(normalizeModuleTranspilePath(moduleRoot));
|
|
2412
|
-
const directory = parsed.dir ? moduleRoot : getDirectory(modulePath);
|
|
2413
|
-
if (directory !== moduleToInstall && !localLayerModuleDirs.
|
|
2437
|
+
const directory = (parsed.dir ? moduleRoot : getDirectory(modulePath)).replace(/\/?$/, "/");
|
|
2438
|
+
if (directory !== moduleToInstall && !localLayerModuleDirs.some((dir) => directory.startsWith(dir))) {
|
|
2414
2439
|
nuxt.options.modulesDir.push(resolve(directory, "node_modules"));
|
|
2415
2440
|
}
|
|
2416
2441
|
}
|
|
@@ -2897,18 +2922,22 @@ function addBuildPlugin(pluginFactory, options) {
|
|
|
2897
2922
|
}
|
|
2898
2923
|
}
|
|
2899
2924
|
|
|
2900
|
-
|
|
2925
|
+
function addComponentsDir(dir, opts = {}) {
|
|
2901
2926
|
const nuxt = useNuxt();
|
|
2902
|
-
|
|
2927
|
+
if (!checkNuxtVersion(">=2.13", nuxt)) {
|
|
2928
|
+
throw new Error(`\`addComponentsDir\` requires Nuxt 2.13 or higher.`);
|
|
2929
|
+
}
|
|
2903
2930
|
nuxt.options.components ||= [];
|
|
2904
2931
|
dir.priority ||= 0;
|
|
2905
2932
|
nuxt.hook("components:dirs", (dirs) => {
|
|
2906
2933
|
dirs[opts.prepend ? "unshift" : "push"](dir);
|
|
2907
2934
|
});
|
|
2908
2935
|
}
|
|
2909
|
-
|
|
2936
|
+
function addComponent(opts) {
|
|
2910
2937
|
const nuxt = useNuxt();
|
|
2911
|
-
|
|
2938
|
+
if (!checkNuxtVersion(">=2.13", nuxt)) {
|
|
2939
|
+
throw new Error(`\`addComponent\` requires Nuxt 2.13 or higher.`);
|
|
2940
|
+
}
|
|
2912
2941
|
nuxt.options.components ||= [];
|
|
2913
2942
|
if (!opts.mode) {
|
|
2914
2943
|
const [, mode = "all"] = opts.filePath.match(MODE_RE) || [];
|
|
@@ -3327,4 +3356,4 @@ function addPluginTemplate(plugin, opts = {}) {
|
|
|
3327
3356
|
return addPlugin(normalizedPlugin, opts);
|
|
3328
3357
|
}
|
|
3329
3358
|
|
|
3330
|
-
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
3359
|
+
export { addBuildPlugin, addComponent, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildNuxt, checkNuxtCompatibility, compileTemplate, createIsIgnored, createResolver, defineNuxtModule, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, importModule, installModule, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, requireModule, resolveAlias, resolveFiles, resolveIgnorePatterns, resolveModule, resolveNuxtModule, resolvePath, templateUtils, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -34,30 +34,30 @@
|
|
|
34
34
|
"knitwork": "^1.2.0",
|
|
35
35
|
"mlly": "^1.7.4",
|
|
36
36
|
"ohash": "^1.1.4",
|
|
37
|
-
"pathe": "^2.0.
|
|
37
|
+
"pathe": "^2.0.2",
|
|
38
38
|
"pkg-types": "^1.3.1",
|
|
39
39
|
"scule": "^1.3.0",
|
|
40
40
|
"semver": "^7.6.3",
|
|
41
41
|
"std-env": "^3.8.0",
|
|
42
42
|
"ufo": "^1.5.4",
|
|
43
43
|
"unctx": "^2.4.1",
|
|
44
|
-
"unimport": "^
|
|
44
|
+
"unimport": "^4.0.0",
|
|
45
45
|
"untyped": "^1.5.2",
|
|
46
|
-
"@nuxt/schema": "3.15.
|
|
46
|
+
"@nuxt/schema": "3.15.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@rspack/core": "1.
|
|
49
|
+
"@rspack/core": "1.2.2",
|
|
50
50
|
"@types/lodash-es": "4.17.12",
|
|
51
51
|
"@types/semver": "7.5.8",
|
|
52
52
|
"lodash-es": "4.17.21",
|
|
53
53
|
"nitropack": "2.10.4",
|
|
54
54
|
"unbuild": "latest",
|
|
55
|
-
"vite": "6.0.
|
|
56
|
-
"vitest": "
|
|
55
|
+
"vite": "6.0.11",
|
|
56
|
+
"vitest": "3.0.4",
|
|
57
57
|
"webpack": "5.96.1"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
|
-
"node": ">=18.
|
|
60
|
+
"node": ">=18.12.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"test:attw": "attw --pack"
|