@nuxt/kit 3.15.0 → 3.15.2
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 +2 -5
- package/dist/index.d.ts +2 -5
- package/dist/index.mjs +76 -55
- package/package.json +11 -10
package/dist/index.d.mts
CHANGED
|
@@ -257,9 +257,6 @@ interface AddRouteMiddlewareOptions {
|
|
|
257
257
|
}
|
|
258
258
|
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
259
259
|
|
|
260
|
-
/**
|
|
261
|
-
* Normalize a nuxt plugin object
|
|
262
|
-
*/
|
|
263
260
|
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
264
261
|
/**
|
|
265
262
|
* Registers a nuxt plugin and to the plugins array.
|
|
@@ -386,7 +383,7 @@ declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
|
386
383
|
}): void;
|
|
387
384
|
|
|
388
385
|
/**
|
|
389
|
-
* Renders given template
|
|
386
|
+
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
390
387
|
*/
|
|
391
388
|
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
392
389
|
/**
|
|
@@ -394,7 +391,7 @@ declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNu
|
|
|
394
391
|
*/
|
|
395
392
|
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
396
393
|
/**
|
|
397
|
-
* Renders given types
|
|
394
|
+
* Renders given types during build to disk in the project `buildDir`
|
|
398
395
|
* and register them as types.
|
|
399
396
|
*/
|
|
400
397
|
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>): ResolvedNuxtTemplate<T>;
|
package/dist/index.d.ts
CHANGED
|
@@ -257,9 +257,6 @@ interface AddRouteMiddlewareOptions {
|
|
|
257
257
|
}
|
|
258
258
|
declare function addRouteMiddleware(input: NuxtMiddleware | NuxtMiddleware[], options?: AddRouteMiddlewareOptions): void;
|
|
259
259
|
|
|
260
|
-
/**
|
|
261
|
-
* Normalize a nuxt plugin object
|
|
262
|
-
*/
|
|
263
260
|
declare function normalizePlugin(plugin: NuxtPlugin | string): NuxtPlugin;
|
|
264
261
|
/**
|
|
265
262
|
* Registers a nuxt plugin and to the plugins array.
|
|
@@ -386,7 +383,7 @@ declare function addServerScanDir(dirs: string | string[], opts?: {
|
|
|
386
383
|
}): void;
|
|
387
384
|
|
|
388
385
|
/**
|
|
389
|
-
* Renders given template
|
|
386
|
+
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
|
390
387
|
*/
|
|
391
388
|
declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNuxtTemplate<T>;
|
|
392
389
|
/**
|
|
@@ -394,7 +391,7 @@ declare function addTemplate<T>(_template: NuxtTemplate<T> | string): ResolvedNu
|
|
|
394
391
|
*/
|
|
395
392
|
declare function addServerTemplate(template: NuxtServerTemplate): NuxtServerTemplate;
|
|
396
393
|
/**
|
|
397
|
-
* Renders given types
|
|
394
|
+
* Renders given types during build to disk in the project `buildDir`
|
|
398
395
|
* and register them as types.
|
|
399
396
|
*/
|
|
400
397
|
declare function addTypeTemplate<T>(_template: NuxtTypeTemplate<T>): ResolvedNuxtTemplate<T>;
|
package/dist/index.mjs
CHANGED
|
@@ -23,6 +23,8 @@ import { snakeCase, kebabCase, pascalCase } from 'scule';
|
|
|
23
23
|
import { klona } from 'klona';
|
|
24
24
|
import { hash } from 'ohash';
|
|
25
25
|
import { gte } from 'semver';
|
|
26
|
+
import { isAbsolute as isAbsolute$1 } from 'node:path';
|
|
27
|
+
import { isWindows } from 'std-env';
|
|
26
28
|
|
|
27
29
|
const logger = consola;
|
|
28
30
|
function useLogger(tag, options = {}) {
|
|
@@ -86,7 +88,7 @@ async function checkNuxtCompatibility(constraints, nuxt = useNuxt()) {
|
|
|
86
88
|
message: `Not compatible with \`${nuxt.options.builder}\`.`
|
|
87
89
|
});
|
|
88
90
|
} else {
|
|
89
|
-
const builderVersion = await readPackageJSON(nuxt.options.builder, { url: nuxt.options.modulesDir }).then((r) => r.version).catch(() =>
|
|
91
|
+
const builderVersion = await readPackageJSON(nuxt.options.builder, { url: nuxt.options.modulesDir }).then((r) => r.version).catch(() => undefined);
|
|
90
92
|
if (builderVersion && !satisfies(normalizeSemanticVersion(builderVersion), constraint, { includePrerelease: true })) {
|
|
91
93
|
issues.push({
|
|
92
94
|
name: "builder",
|
|
@@ -140,7 +142,7 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
|
|
140
142
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
141
143
|
|
|
142
144
|
/** Built-in value references. */
|
|
143
|
-
var Symbol = root.Symbol;
|
|
145
|
+
var Symbol$1 = root.Symbol;
|
|
144
146
|
|
|
145
147
|
/** Used for built-in method references. */
|
|
146
148
|
var objectProto$b = Object.prototype;
|
|
@@ -156,7 +158,7 @@ var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
|
|
|
156
158
|
var nativeObjectToString$1 = objectProto$b.toString;
|
|
157
159
|
|
|
158
160
|
/** Built-in value references. */
|
|
159
|
-
var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
|
|
161
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
160
162
|
|
|
161
163
|
/**
|
|
162
164
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
@@ -211,7 +213,7 @@ var nullTag = '[object Null]',
|
|
|
211
213
|
undefinedTag = '[object Undefined]';
|
|
212
214
|
|
|
213
215
|
/** Built-in value references. */
|
|
214
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
216
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
215
217
|
|
|
216
218
|
/**
|
|
217
219
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
@@ -327,11 +329,8 @@ function arrayMap(array, iteratee) {
|
|
|
327
329
|
*/
|
|
328
330
|
var isArray = Array.isArray;
|
|
329
331
|
|
|
330
|
-
/** Used as references for various `Number` constants. */
|
|
331
|
-
var INFINITY = 1 / 0;
|
|
332
|
-
|
|
333
332
|
/** Used to convert symbols to primitives and strings. */
|
|
334
|
-
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
333
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
|
|
335
334
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
336
335
|
|
|
337
336
|
/**
|
|
@@ -355,7 +354,7 @@ function baseToString(value) {
|
|
|
355
354
|
return symbolToString ? symbolToString.call(value) : '';
|
|
356
355
|
}
|
|
357
356
|
var result = (value + '');
|
|
358
|
-
return (result == '0' && (1 / value) == -
|
|
357
|
+
return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
|
|
359
358
|
}
|
|
360
359
|
|
|
361
360
|
/**
|
|
@@ -2055,6 +2054,14 @@ function template(string, options, guard) {
|
|
|
2055
2054
|
function toArray(value) {
|
|
2056
2055
|
return Array.isArray(value) ? value : [value];
|
|
2057
2056
|
}
|
|
2057
|
+
function filterInPlace(array, predicate) {
|
|
2058
|
+
for (let i = array.length; i--; i >= 0) {
|
|
2059
|
+
if (!predicate(array[i], i, array)) {
|
|
2060
|
+
array.splice(i, 1);
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
return array;
|
|
2064
|
+
}
|
|
2058
2065
|
const MODE_RE = /\.(server|client)(\.\w+)*$/;
|
|
2059
2066
|
|
|
2060
2067
|
async function compileTemplate(template$1, ctx) {
|
|
@@ -2116,7 +2123,7 @@ function _defineNuxtModule(definition) {
|
|
|
2116
2123
|
}
|
|
2117
2124
|
const uniqueKey = module.meta.name || module.meta.configKey;
|
|
2118
2125
|
if (uniqueKey) {
|
|
2119
|
-
nuxt.options._requiredModules
|
|
2126
|
+
nuxt.options._requiredModules ||= {};
|
|
2120
2127
|
if (nuxt.options._requiredModules[uniqueKey]) {
|
|
2121
2128
|
return false;
|
|
2122
2129
|
}
|
|
@@ -2305,7 +2312,7 @@ async function resolvePath(path, opts = {}) {
|
|
|
2305
2312
|
return opts.fallbackToOriginal ? _path : path;
|
|
2306
2313
|
}
|
|
2307
2314
|
async function findPath(paths, opts, pathType = "file") {
|
|
2308
|
-
const nuxt = opts?.virtual ? tryUseNuxt() :
|
|
2315
|
+
const nuxt = opts?.virtual ? tryUseNuxt() : undefined;
|
|
2309
2316
|
for (const path of toArray(paths)) {
|
|
2310
2317
|
const rPath = await resolvePath(path, opts);
|
|
2311
2318
|
if (opts?.virtual && existsInVFS(rPath, nuxt)) {
|
|
@@ -2407,8 +2414,8 @@ async function installModule(moduleToInstall, inlineOptions, nuxt = useNuxt()) {
|
|
|
2407
2414
|
nuxt.options.modulesDir.push(resolve(directory, "node_modules"));
|
|
2408
2415
|
}
|
|
2409
2416
|
}
|
|
2410
|
-
nuxt.options._installedModules
|
|
2411
|
-
const entryPath = typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall) :
|
|
2417
|
+
nuxt.options._installedModules ||= [];
|
|
2418
|
+
const entryPath = typeof moduleToInstall === "string" ? resolveAlias(moduleToInstall) : undefined;
|
|
2412
2419
|
if (typeof moduleToInstall === "string" && entryPath !== moduleToInstall) {
|
|
2413
2420
|
buildTimeModuleMeta.rawPath = moduleToInstall;
|
|
2414
2421
|
}
|
|
@@ -2442,27 +2449,22 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
2442
2449
|
paths.add(join(nuxtModule, "module"));
|
|
2443
2450
|
paths.add(nuxtModule);
|
|
2444
2451
|
for (const path of paths) {
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
2453
|
-
}
|
|
2454
|
-
break;
|
|
2455
|
-
} catch (error) {
|
|
2456
|
-
const code = error.code;
|
|
2457
|
-
if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_UNSUPPORTED_DIR_IMPORT" || code === "ENOTDIR") {
|
|
2458
|
-
continue;
|
|
2459
|
-
}
|
|
2460
|
-
logger.error(`Error while importing module \`${nuxtModule}\`: ${error}`);
|
|
2461
|
-
throw error;
|
|
2452
|
+
try {
|
|
2453
|
+
const src = isAbsolute(path) ? pathToFileURL(await resolvePath(path, { fallbackToOriginal: false, extensions: nuxt.options.extensions })).href : await resolve$1(path, { url: nuxt.options.modulesDir.map((m) => pathToFileURL(m.replace(/\/node_modules\/?$/, ""))), extensions: nuxt.options.extensions });
|
|
2454
|
+
nuxtModule = await jiti.import(src, { default: true });
|
|
2455
|
+
resolvedModulePath = fileURLToPath(new URL(src));
|
|
2456
|
+
const moduleMetadataPath = new URL("module.json", src);
|
|
2457
|
+
if (existsSync(moduleMetadataPath)) {
|
|
2458
|
+
buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
2462
2459
|
}
|
|
2463
|
-
}
|
|
2464
|
-
if (typeof nuxtModule !== "string") {
|
|
2465
2460
|
break;
|
|
2461
|
+
} catch (error) {
|
|
2462
|
+
const code = error.code;
|
|
2463
|
+
if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_UNSUPPORTED_DIR_IMPORT" || code === "ENOTDIR") {
|
|
2464
|
+
continue;
|
|
2465
|
+
}
|
|
2466
|
+
logger.error(`Error while importing module \`${nuxtModule}\`: ${error}`);
|
|
2467
|
+
throw error;
|
|
2466
2468
|
}
|
|
2467
2469
|
}
|
|
2468
2470
|
}
|
|
@@ -2554,7 +2556,7 @@ async function loadNuxtConfig(opts) {
|
|
|
2554
2556
|
const _layers = [];
|
|
2555
2557
|
const processedLayers = /* @__PURE__ */ new Set();
|
|
2556
2558
|
for (const layer of layers) {
|
|
2557
|
-
layer.config
|
|
2559
|
+
layer.config ||= {};
|
|
2558
2560
|
layer.config.rootDir = layer.config.rootDir ?? layer.cwd;
|
|
2559
2561
|
if (processedLayers.has(layer.config.rootDir)) {
|
|
2560
2562
|
continue;
|
|
@@ -2626,7 +2628,7 @@ function tryRequireModule(id, opts) {
|
|
|
2626
2628
|
|
|
2627
2629
|
async function loadNuxt(opts) {
|
|
2628
2630
|
opts.cwd = opts.cwd || opts.rootDir;
|
|
2629
|
-
opts.overrides
|
|
2631
|
+
opts.overrides ||= opts.config || {};
|
|
2630
2632
|
opts.overrides.dev = !!opts.dev;
|
|
2631
2633
|
const nearestNuxtPkg = await Promise.all(["nuxt-nightly", "nuxt3", "nuxt", "nuxt-edge"].map((pkg2) => resolvePackageJSON(pkg2, { url: opts.cwd }).catch(() => null))).then((r) => r.filter(Boolean).sort((a, b) => b.length - a.length)[0]);
|
|
2632
2634
|
if (!nearestNuxtPkg) {
|
|
@@ -2696,7 +2698,7 @@ function addImportsSources(presets) {
|
|
|
2696
2698
|
|
|
2697
2699
|
const HANDLER_METHOD_RE = /\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/;
|
|
2698
2700
|
function normalizeHandlerMethod(handler) {
|
|
2699
|
-
const [, method =
|
|
2701
|
+
const [, method = undefined] = handler.handler.match(HANDLER_METHOD_RE) || [];
|
|
2700
2702
|
return {
|
|
2701
2703
|
method,
|
|
2702
2704
|
...handler,
|
|
@@ -2711,7 +2713,7 @@ function addDevServerHandler(handler) {
|
|
|
2711
2713
|
}
|
|
2712
2714
|
function addServerPlugin(plugin) {
|
|
2713
2715
|
const nuxt = useNuxt();
|
|
2714
|
-
nuxt.options.nitro.plugins
|
|
2716
|
+
nuxt.options.nitro.plugins ||= [];
|
|
2715
2717
|
nuxt.options.nitro.plugins.push(normalize(plugin));
|
|
2716
2718
|
}
|
|
2717
2719
|
function addPrerenderRoutes(routes) {
|
|
@@ -2736,8 +2738,8 @@ function useNitro() {
|
|
|
2736
2738
|
function addServerImports(imports) {
|
|
2737
2739
|
const nuxt = useNuxt();
|
|
2738
2740
|
nuxt.hook("nitro:config", (config) => {
|
|
2739
|
-
config.imports
|
|
2740
|
-
config.imports.imports
|
|
2741
|
+
config.imports ||= {};
|
|
2742
|
+
config.imports.imports ||= [];
|
|
2741
2743
|
config.imports.imports.push(...imports);
|
|
2742
2744
|
});
|
|
2743
2745
|
}
|
|
@@ -2745,15 +2747,15 @@ function addServerImportsDir(dirs, opts = {}) {
|
|
|
2745
2747
|
const nuxt = useNuxt();
|
|
2746
2748
|
const _dirs = toArray(dirs);
|
|
2747
2749
|
nuxt.hook("nitro:config", (config) => {
|
|
2748
|
-
config.imports
|
|
2749
|
-
config.imports.dirs
|
|
2750
|
+
config.imports ||= {};
|
|
2751
|
+
config.imports.dirs ||= [];
|
|
2750
2752
|
config.imports.dirs[opts.prepend ? "unshift" : "push"](..._dirs);
|
|
2751
2753
|
});
|
|
2752
2754
|
}
|
|
2753
2755
|
function addServerScanDir(dirs, opts = {}) {
|
|
2754
2756
|
const nuxt = useNuxt();
|
|
2755
2757
|
nuxt.hook("nitro:config", (config) => {
|
|
2756
|
-
config.scanDirs
|
|
2758
|
+
config.scanDirs ||= [];
|
|
2757
2759
|
for (const dir of toArray(dirs)) {
|
|
2758
2760
|
config.scanDirs[opts.prepend ? "unshift" : "push"](dir);
|
|
2759
2761
|
}
|
|
@@ -2793,7 +2795,7 @@ function applyEnv(obj, opts, parentKey = "") {
|
|
|
2793
2795
|
if (_isObject(envValue)) {
|
|
2794
2796
|
obj[key] = { ...obj[key], ...envValue };
|
|
2795
2797
|
applyEnv(obj[key], opts, subKey);
|
|
2796
|
-
} else if (envValue ===
|
|
2798
|
+
} else if (envValue === undefined) {
|
|
2797
2799
|
applyEnv(obj[key], opts, subKey);
|
|
2798
2800
|
} else {
|
|
2799
2801
|
obj[key] = envValue ?? obj[key];
|
|
@@ -2863,7 +2865,7 @@ function addWebpackPlugin(pluginOrGetter, options) {
|
|
|
2863
2865
|
extendWebpackConfig((config) => {
|
|
2864
2866
|
const method = options?.prepend ? "unshift" : "push";
|
|
2865
2867
|
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
2866
|
-
config.plugins
|
|
2868
|
+
config.plugins ||= [];
|
|
2867
2869
|
config.plugins[method](...toArray(plugin));
|
|
2868
2870
|
}, options);
|
|
2869
2871
|
}
|
|
@@ -2871,7 +2873,7 @@ function addRspackPlugin(pluginOrGetter, options) {
|
|
|
2871
2873
|
extendRspackConfig((config) => {
|
|
2872
2874
|
const method = options?.prepend ? "unshift" : "push";
|
|
2873
2875
|
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
2874
|
-
config.plugins
|
|
2876
|
+
config.plugins ||= [];
|
|
2875
2877
|
config.plugins[method](...toArray(plugin));
|
|
2876
2878
|
}, options);
|
|
2877
2879
|
}
|
|
@@ -2879,7 +2881,7 @@ function addVitePlugin(pluginOrGetter, options) {
|
|
|
2879
2881
|
extendViteConfig((config) => {
|
|
2880
2882
|
const method = options?.prepend ? "unshift" : "push";
|
|
2881
2883
|
const plugin = typeof pluginOrGetter === "function" ? pluginOrGetter() : pluginOrGetter;
|
|
2882
|
-
config.plugins
|
|
2884
|
+
config.plugins ||= [];
|
|
2883
2885
|
config.plugins[method](...toArray(plugin));
|
|
2884
2886
|
}, options);
|
|
2885
2887
|
}
|
|
@@ -2898,7 +2900,7 @@ function addBuildPlugin(pluginFactory, options) {
|
|
|
2898
2900
|
async function addComponentsDir(dir, opts = {}) {
|
|
2899
2901
|
const nuxt = useNuxt();
|
|
2900
2902
|
await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
|
|
2901
|
-
nuxt.options.components
|
|
2903
|
+
nuxt.options.components ||= [];
|
|
2902
2904
|
dir.priority ||= 0;
|
|
2903
2905
|
nuxt.hook("components:dirs", (dirs) => {
|
|
2904
2906
|
dirs[opts.prepend ? "unshift" : "push"](dir);
|
|
@@ -2907,7 +2909,7 @@ async function addComponentsDir(dir, opts = {}) {
|
|
|
2907
2909
|
async function addComponent(opts) {
|
|
2908
2910
|
const nuxt = useNuxt();
|
|
2909
2911
|
await assertNuxtCompatibility({ nuxt: ">=2.13" }, nuxt);
|
|
2910
|
-
nuxt.options.components
|
|
2912
|
+
nuxt.options.components ||= [];
|
|
2911
2913
|
if (!opts.mode) {
|
|
2912
2914
|
const [, mode = "all"] = opts.filePath.match(MODE_RE) || [];
|
|
2913
2915
|
opts.mode = mode;
|
|
@@ -2949,7 +2951,7 @@ async function addComponent(opts) {
|
|
|
2949
2951
|
function addTemplate(_template) {
|
|
2950
2952
|
const nuxt = useNuxt();
|
|
2951
2953
|
const template = normalizeTemplate(_template);
|
|
2952
|
-
nuxt.options.build.templates
|
|
2954
|
+
filterInPlace(nuxt.options.build.templates, (p) => normalizeTemplate(p).dst !== template.dst);
|
|
2953
2955
|
nuxt.options.build.templates.push(template);
|
|
2954
2956
|
return template;
|
|
2955
2957
|
}
|
|
@@ -3097,9 +3099,9 @@ async function _generateTypes(nuxt) {
|
|
|
3097
3099
|
});
|
|
3098
3100
|
const aliases = nuxt.options.alias;
|
|
3099
3101
|
const basePath = tsConfig.compilerOptions.baseUrl ? resolve(nuxt.options.buildDir, tsConfig.compilerOptions.baseUrl) : nuxt.options.buildDir;
|
|
3100
|
-
tsConfig.compilerOptions
|
|
3101
|
-
tsConfig.compilerOptions.paths
|
|
3102
|
-
tsConfig.include
|
|
3102
|
+
tsConfig.compilerOptions ||= {};
|
|
3103
|
+
tsConfig.compilerOptions.paths ||= {};
|
|
3104
|
+
tsConfig.include ||= [];
|
|
3103
3105
|
for (const alias in aliases) {
|
|
3104
3106
|
if (excludedAlias.some((re) => re.test(alias))) {
|
|
3105
3107
|
continue;
|
|
@@ -3154,6 +3156,7 @@ async function _generateTypes(nuxt) {
|
|
|
3154
3156
|
return relativeWithDot(nuxt.options.buildDir, stats?.isFile() ? path.replace(EXTENSION_RE, "") : path);
|
|
3155
3157
|
}));
|
|
3156
3158
|
}
|
|
3159
|
+
sortTsPaths(tsConfig.compilerOptions.paths);
|
|
3157
3160
|
tsConfig.include = [...new Set(tsConfig.include.map((p) => isAbsolute(p) ? relativeWithDot(nuxt.options.buildDir, p) : p))];
|
|
3158
3161
|
tsConfig.exclude = [...new Set(tsConfig.exclude.map((p) => isAbsolute(p) ? relativeWithDot(nuxt.options.buildDir, p) : p))];
|
|
3159
3162
|
const declaration = [
|
|
@@ -3186,6 +3189,15 @@ async function writeTypes(nuxt) {
|
|
|
3186
3189
|
nuxt.hook("builder:prepared", writeFile);
|
|
3187
3190
|
await writeFile();
|
|
3188
3191
|
}
|
|
3192
|
+
function sortTsPaths(paths) {
|
|
3193
|
+
for (const pathKey in paths) {
|
|
3194
|
+
if (pathKey.startsWith("#build")) {
|
|
3195
|
+
const pathValue = paths[pathKey];
|
|
3196
|
+
delete paths[pathKey];
|
|
3197
|
+
paths[pathKey] = pathValue;
|
|
3198
|
+
}
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3189
3201
|
function renderAttrs(obj) {
|
|
3190
3202
|
const attrs = [];
|
|
3191
3203
|
for (const key in obj) {
|
|
@@ -3244,9 +3256,7 @@ function extendPages(cb) {
|
|
|
3244
3256
|
function extendRouteRules(route, rule, options = {}) {
|
|
3245
3257
|
const nuxt = useNuxt();
|
|
3246
3258
|
for (const opts of [nuxt.options, nuxt.options.nitro]) {
|
|
3247
|
-
|
|
3248
|
-
opts.routeRules = {};
|
|
3249
|
-
}
|
|
3259
|
+
opts.routeRules ||= {};
|
|
3250
3260
|
opts.routeRules[route] = options.override ? defu(rule, opts.routeRules[route]) : defu(opts.routeRules[route], rule);
|
|
3251
3261
|
}
|
|
3252
3262
|
}
|
|
@@ -3275,16 +3285,26 @@ function addRouteMiddleware(input, options = {}) {
|
|
|
3275
3285
|
});
|
|
3276
3286
|
}
|
|
3277
3287
|
|
|
3288
|
+
const pluginSymbol = Symbol.for("nuxt plugin");
|
|
3278
3289
|
function normalizePlugin(plugin) {
|
|
3279
3290
|
if (typeof plugin === "string") {
|
|
3280
3291
|
plugin = { src: plugin };
|
|
3281
3292
|
} else {
|
|
3282
3293
|
plugin = { ...plugin };
|
|
3283
3294
|
}
|
|
3295
|
+
if (pluginSymbol in plugin) {
|
|
3296
|
+
return plugin;
|
|
3297
|
+
}
|
|
3284
3298
|
if (!plugin.src) {
|
|
3285
3299
|
throw new Error("Invalid plugin. src option is required: " + JSON.stringify(plugin));
|
|
3286
3300
|
}
|
|
3287
3301
|
plugin.src = normalize(resolveAlias(plugin.src));
|
|
3302
|
+
if (!existsSync(plugin.src) && isAbsolute$1(plugin.src)) {
|
|
3303
|
+
try {
|
|
3304
|
+
plugin.src = resolvePathSync(isWindows ? pathToFileURL(plugin.src).href : plugin.src, { extensions: tryUseNuxt()?.options.extensions });
|
|
3305
|
+
} catch {
|
|
3306
|
+
}
|
|
3307
|
+
}
|
|
3288
3308
|
if (plugin.ssr) {
|
|
3289
3309
|
plugin.mode = "server";
|
|
3290
3310
|
}
|
|
@@ -3292,12 +3312,13 @@ function normalizePlugin(plugin) {
|
|
|
3292
3312
|
const [, mode = "all"] = plugin.src.match(MODE_RE) || [];
|
|
3293
3313
|
plugin.mode = mode;
|
|
3294
3314
|
}
|
|
3315
|
+
plugin[pluginSymbol] = true;
|
|
3295
3316
|
return plugin;
|
|
3296
3317
|
}
|
|
3297
3318
|
function addPlugin(_plugin, opts = {}) {
|
|
3298
3319
|
const nuxt = useNuxt();
|
|
3299
3320
|
const plugin = normalizePlugin(_plugin);
|
|
3300
|
-
nuxt.options.plugins
|
|
3321
|
+
filterInPlace(nuxt.options.plugins, (p) => normalizePlugin(p).src !== plugin.src);
|
|
3301
3322
|
nuxt.options.plugins[opts.append ? "push" : "unshift"](plugin);
|
|
3302
3323
|
return plugin;
|
|
3303
3324
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -24,25 +24,26 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"c12": "^2.0.1",
|
|
27
|
-
"consola": "^3.
|
|
27
|
+
"consola": "^3.4.0",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
29
|
"destr": "^2.0.3",
|
|
30
30
|
"globby": "^14.0.2",
|
|
31
|
-
"ignore": "^7.0.
|
|
31
|
+
"ignore": "^7.0.3",
|
|
32
32
|
"jiti": "^2.4.2",
|
|
33
33
|
"klona": "^2.0.6",
|
|
34
34
|
"knitwork": "^1.2.0",
|
|
35
|
-
"mlly": "^1.7.
|
|
35
|
+
"mlly": "^1.7.4",
|
|
36
36
|
"ohash": "^1.1.4",
|
|
37
|
-
"pathe": "^
|
|
38
|
-
"pkg-types": "^1.
|
|
37
|
+
"pathe": "^2.0.1",
|
|
38
|
+
"pkg-types": "^1.3.1",
|
|
39
39
|
"scule": "^1.3.0",
|
|
40
40
|
"semver": "^7.6.3",
|
|
41
|
+
"std-env": "^3.8.0",
|
|
41
42
|
"ufo": "^1.5.4",
|
|
42
43
|
"unctx": "^2.4.1",
|
|
43
|
-
"unimport": "^3.14.
|
|
44
|
+
"unimport": "^3.14.6",
|
|
44
45
|
"untyped": "^1.5.2",
|
|
45
|
-
"@nuxt/schema": "3.15.
|
|
46
|
+
"@nuxt/schema": "3.15.2"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@rspack/core": "1.1.8",
|
|
@@ -51,12 +52,12 @@
|
|
|
51
52
|
"lodash-es": "4.17.21",
|
|
52
53
|
"nitropack": "2.10.4",
|
|
53
54
|
"unbuild": "latest",
|
|
54
|
-
"vite": "6.0.
|
|
55
|
+
"vite": "6.0.7",
|
|
55
56
|
"vitest": "2.1.8",
|
|
56
57
|
"webpack": "5.96.1"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
|
59
|
-
"node": ">=18.
|
|
60
|
+
"node": ">=18.0.0"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"test:attw": "attw --pack"
|