@depup/nuxt__kit 4.5.0-depup.0 → 4.5.2-depup.0
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/README.md +3 -3
- package/changes.json +4 -4
- package/dist/index.d.mts +101 -17
- package/dist/index.mjs +420 -105
- package/package.json +17 -18
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/nuxt__kit
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@nuxt/kit](https://www.npmjs.com/package/@nuxt/kit) @ 4.5.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@nuxt/kit](https://www.npmjs.com/package/@nuxt/kit) @ 4.5.2 |
|
|
17
|
+
| Processed | 2026-08-05 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 2 |
|
|
20
20
|
|
|
@@ -23,7 +23,7 @@ npm install @depup/nuxt__kit
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
25
|
| c12 | ^3.3.4 | ^4.0.0-beta.5 |
|
|
26
|
-
|
|
|
26
|
+
| verkit | ^0.3.1 | ^0.3.2 |
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
package/changes.json
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"from": "^3.3.4",
|
|
5
5
|
"to": "^4.0.0-beta.5"
|
|
6
6
|
},
|
|
7
|
-
"
|
|
8
|
-
"from": "^
|
|
9
|
-
"to": "^
|
|
7
|
+
"verkit": {
|
|
8
|
+
"from": "^0.3.1",
|
|
9
|
+
"to": "^0.3.2"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"timestamp": "2026-
|
|
12
|
+
"timestamp": "2026-08-05T16:34:27.674Z",
|
|
13
13
|
"totalUpdated": 2
|
|
14
14
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ConsolaInstance, ConsolaOptions } from "consola";
|
|
2
2
|
import { UseContext } from "unctx";
|
|
3
|
+
import "pkg-types";
|
|
3
4
|
import { GlobOptions } from "tinyglobby";
|
|
4
5
|
import { LoadConfigOptions } from "c12";
|
|
5
6
|
import { Component, ComponentsDir, ModuleDefinition, ModuleMeta, ModuleOptions, Nuxt, NuxtAppConfig, NuxtBuildOutputs, NuxtCompatibility, NuxtCompatibilityIssues, NuxtConfig, NuxtHooks, NuxtMiddleware, NuxtModule, NuxtOptions, NuxtPlugin, NuxtPluginTemplate, NuxtServerTemplate, NuxtTemplate, NuxtTypeTemplate, ResolvedNuxtTemplate, SchemaDefinition } from "@nuxt/schema";
|
|
6
7
|
import { Import, Preset } from "unimport";
|
|
7
8
|
import { Configuration, WebpackPluginInstance } from "webpack";
|
|
8
9
|
import { Plugin, UserConfig } from "vite";
|
|
9
|
-
import
|
|
10
|
-
import * as NitroV3 from "nitro/types";
|
|
11
|
-
|
|
10
|
+
import { Nitro, NitroDevEventHandler, NitroEventHandler, NitroRouteConfig } from "nitropack/types";
|
|
12
11
|
//#region src/module/define.d.ts
|
|
13
12
|
/**
|
|
14
13
|
* Define a Nuxt module, automatically merging defaults with user provided options, installing
|
|
@@ -118,6 +117,15 @@ interface LayerDirectories {
|
|
|
118
117
|
*/
|
|
119
118
|
declare function getLayerDirectories(nuxt?: Nuxt): LayerDirectories[];
|
|
120
119
|
//#endregion
|
|
120
|
+
//#region src/constants.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Default extensions for files that may contain JSX.
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
declare const DEFAULT_JSX_FILE_EXTENSIONS: string[];
|
|
126
|
+
/** Default extensions for JavaScript/TypeScript files, in order of resolution priority. */
|
|
127
|
+
declare const DEFAULT_JS_FILE_EXTENSIONS: string[];
|
|
128
|
+
//#endregion
|
|
121
129
|
//#region src/head.d.ts
|
|
122
130
|
declare function setGlobalHead(head: NuxtAppConfig['head']): void;
|
|
123
131
|
//#endregion
|
|
@@ -339,14 +347,6 @@ declare function resolveIgnorePatterns(relativePath?: string): string[];
|
|
|
339
347
|
//#region src/layout.d.ts
|
|
340
348
|
declare function addLayout(template: NuxtTemplate | string, name?: string): void;
|
|
341
349
|
//#endregion
|
|
342
|
-
//#region src/nitro-types.d.ts
|
|
343
|
-
type isNitroV2 = 'options' extends keyof NitroV2.Nitro ? '___INVALID' extends keyof NitroV2.Nitro ? false : true : false;
|
|
344
|
-
type isNitroV3 = 'options' extends keyof NitroV3.Nitro ? '___INVALID' extends keyof NitroV3.Nitro ? false : true : false;
|
|
345
|
-
type Nitro = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.Nitro | NitroV3.Nitro : NitroV2.Nitro : NitroV3.Nitro;
|
|
346
|
-
type NitroDevEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroDevEventHandler | NitroV3.NitroDevEventHandler : NitroV2.NitroDevEventHandler : NitroV3.NitroDevEventHandler;
|
|
347
|
-
type NitroEventHandler = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroEventHandler | NitroV3.NitroEventHandler : NitroV2.NitroEventHandler : NitroV3.NitroEventHandler;
|
|
348
|
-
type NitroRouteConfig = isNitroV2 extends true ? isNitroV3 extends true ? NitroV2.NitroRouteConfig | NitroV3.NitroRouteConfig : NitroV2.NitroRouteConfig : NitroV3.NitroRouteConfig;
|
|
349
|
-
//#endregion
|
|
350
350
|
//#region src/pages.d.ts
|
|
351
351
|
declare function extendPages(cb: NuxtHooks['pages:extend']): void;
|
|
352
352
|
interface ExtendRouteRulesOptions {
|
|
@@ -581,6 +581,35 @@ declare function packageName(specifier: string): string;
|
|
|
581
581
|
*/
|
|
582
582
|
declare function resolveTypePaths(packages: string[], searchPaths: string[]): Promise<Array<[string, string]>>;
|
|
583
583
|
//#endregion
|
|
584
|
+
//#region src/watch.d.ts
|
|
585
|
+
/**
|
|
586
|
+
* The subset of a chokidar `FSWatcher` this helper needs. Callers hold
|
|
587
|
+
* different chokidar majors (Nuxt core watches with v5, Vite bundles v3), so
|
|
588
|
+
* the parameter is structural rather than an import of either package.
|
|
589
|
+
*/
|
|
590
|
+
interface RecoverableWatcher {
|
|
591
|
+
on: (event: any, listener: (...args: any[]) => void) => any;
|
|
592
|
+
emit: (event: any, ...args: any[]) => any;
|
|
593
|
+
options?: {
|
|
594
|
+
cwd?: string | undefined;
|
|
595
|
+
} | undefined;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* chokidar suppresses a `change` event that lands within 50ms of the previous
|
|
599
|
+
* `change` for the same path, and never replays it. A save that follows a fast
|
|
600
|
+
* HMR round trip is therefore silently lost until the file is touched again,
|
|
601
|
+
* which looks exactly like broken HMR. This is true of every chokidar major
|
|
602
|
+
* Nuxt uses.
|
|
603
|
+
*
|
|
604
|
+
* Raw fs events are not throttled, so once chokidar has reported a file at
|
|
605
|
+
* least once we can use them to notice a modification that never surfaced as a
|
|
606
|
+
* `change` event, and re-emit it after the throttle window has passed.
|
|
607
|
+
*
|
|
608
|
+
* @param watcher the chokidar watcher to patch
|
|
609
|
+
* @returns a disposer releasing the recovery state; call it when the watcher closes
|
|
610
|
+
*/
|
|
611
|
+
declare function recoverThrottledChanges(watcher: RecoverableWatcher): () => void;
|
|
612
|
+
//#endregion
|
|
584
613
|
//#region src/logger.d.ts
|
|
585
614
|
declare const logger: ConsolaInstance;
|
|
586
615
|
declare function useLogger(tag?: string, options?: Partial<ConsolaOptions>): ConsolaInstance;
|
|
@@ -671,21 +700,21 @@ declare const buildDiagnostics: import("nostics").Diagnostics<{
|
|
|
671
700
|
readonly why: (p: {
|
|
672
701
|
file: string;
|
|
673
702
|
}) => string;
|
|
674
|
-
readonly fix: "Check that the file exists and is readable, or try clearing the build cache with `
|
|
703
|
+
readonly fix: "Check that the file exists and is readable, or try clearing the build cache with `nuxt clean`.";
|
|
675
704
|
readonly docs: false;
|
|
676
705
|
};
|
|
677
706
|
readonly NUXT_B1012: {
|
|
678
707
|
readonly why: (p: {
|
|
679
708
|
path: string;
|
|
680
709
|
}) => string;
|
|
681
|
-
readonly fix: "Delete the cache with `
|
|
710
|
+
readonly fix: "Delete the cache with `nuxt clean` and rebuild.";
|
|
682
711
|
readonly docs: false;
|
|
683
712
|
};
|
|
684
713
|
readonly NUXT_B1013: {
|
|
685
714
|
readonly why: (p: {
|
|
686
715
|
file: string;
|
|
687
716
|
}) => string;
|
|
688
|
-
readonly fix: "Try clearing the build cache with `
|
|
717
|
+
readonly fix: "Try clearing the build cache with `nuxt clean` and rebuilding from scratch.";
|
|
689
718
|
readonly docs: false;
|
|
690
719
|
};
|
|
691
720
|
readonly NUXT_B1014: {
|
|
@@ -820,6 +849,15 @@ declare const pluginDiagnostics: import("nostics").Diagnostics<{
|
|
|
820
849
|
readonly fix: "Pass a string path, or an object with a `src` property, to `addPlugin()`.";
|
|
821
850
|
readonly docs: false;
|
|
822
851
|
};
|
|
852
|
+
readonly NUXT_B2012: {
|
|
853
|
+
readonly why: (p: {
|
|
854
|
+
name: string;
|
|
855
|
+
dependencies: string[];
|
|
856
|
+
mode: "client" | "server";
|
|
857
|
+
}) => string;
|
|
858
|
+
readonly fix: "Do not depend on plugins that are unavailable in the same build environment; remove them from the `dependsOn` array.";
|
|
859
|
+
readonly docs: false;
|
|
860
|
+
};
|
|
823
861
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
824
862
|
method?: import("nostics").ConsoleMethod;
|
|
825
863
|
}>]>;
|
|
@@ -999,6 +1037,16 @@ declare const pageDiagnostics: import("nostics").Diagnostics<{
|
|
|
999
1037
|
readonly fix: "Use only JSON-serializable values (strings, numbers, booleans, arrays, plain objects) in `defineRouteRules()`.";
|
|
1000
1038
|
readonly docs: false;
|
|
1001
1039
|
};
|
|
1040
|
+
readonly NUXT_B4007: {
|
|
1041
|
+
readonly why: (p: {
|
|
1042
|
+
fnName: string;
|
|
1043
|
+
file: string;
|
|
1044
|
+
}) => string;
|
|
1045
|
+
readonly fix: (p: {
|
|
1046
|
+
fnName: string;
|
|
1047
|
+
}) => string;
|
|
1048
|
+
readonly docs: false;
|
|
1049
|
+
};
|
|
1002
1050
|
readonly NUXT_B4008: {
|
|
1003
1051
|
readonly why: "Server pages with `ssr: false` are not supported while component islands are auto-detected.";
|
|
1004
1052
|
readonly fix: "Set `experimental.componentIslands` to `true`.";
|
|
@@ -1050,6 +1098,22 @@ declare const pageDiagnostics: import("nostics").Diagnostics<{
|
|
|
1050
1098
|
readonly fix: "Rename one of the layouts, or remove the duplicate layout registration.";
|
|
1051
1099
|
readonly docs: false;
|
|
1052
1100
|
};
|
|
1101
|
+
readonly NUXT_B4016: {
|
|
1102
|
+
readonly why: (p: {
|
|
1103
|
+
path: string;
|
|
1104
|
+
detail: string;
|
|
1105
|
+
}) => string;
|
|
1106
|
+
readonly fix: "Define the affected route rules explicitly in `nitro.routeRules`.";
|
|
1107
|
+
readonly docs: false;
|
|
1108
|
+
};
|
|
1109
|
+
readonly NUXT_B4017: {
|
|
1110
|
+
readonly why: (p: {
|
|
1111
|
+
path: string;
|
|
1112
|
+
pattern: string;
|
|
1113
|
+
}) => string;
|
|
1114
|
+
readonly fix: "The later inline route rules override the earlier ones. Use distinct routes, or define the rules explicitly in `nitro.routeRules`.";
|
|
1115
|
+
readonly docs: false;
|
|
1116
|
+
};
|
|
1053
1117
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1054
1118
|
method?: import("nostics").ConsoleMethod;
|
|
1055
1119
|
}>]>;
|
|
@@ -1171,6 +1235,14 @@ declare const headDiagnostics: import("nostics").Diagnostics<{
|
|
|
1171
1235
|
readonly fix: "Remove `experimental.headNext` from your `nuxt.config`, or set `unhead.legacy: true` to opt out temporarily.";
|
|
1172
1236
|
readonly docs: false;
|
|
1173
1237
|
};
|
|
1238
|
+
readonly NUXT_B6005: {
|
|
1239
|
+
readonly why: (p: {
|
|
1240
|
+
name: string;
|
|
1241
|
+
from: string;
|
|
1242
|
+
}) => string;
|
|
1243
|
+
readonly fix: "Check the `from` path in `imports.presets` (or the module that registered this import). Auto-imports from an unresolvable module are silently skipped and can surface as unrelated type errors elsewhere.";
|
|
1244
|
+
readonly docs: false;
|
|
1245
|
+
};
|
|
1174
1246
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1175
1247
|
method?: import("nostics").ConsoleMethod;
|
|
1176
1248
|
}>]>;
|
|
@@ -1272,7 +1344,7 @@ declare const bundlerDiagnostics: import("nostics").Diagnostics<{
|
|
|
1272
1344
|
readonly why: (p: {
|
|
1273
1345
|
name: string;
|
|
1274
1346
|
}) => string;
|
|
1275
|
-
readonly fix: "Fix the build errors listed above. If the errors are unclear, try running `
|
|
1347
|
+
readonly fix: "Fix the build errors listed above. If the errors are unclear, try running `nuxt cleanup` and rebuilding.";
|
|
1276
1348
|
readonly docs: false;
|
|
1277
1349
|
};
|
|
1278
1350
|
readonly NUXT_B7015: {
|
|
@@ -1302,6 +1374,18 @@ declare const bundlerDiagnostics: import("nostics").Diagnostics<{
|
|
|
1302
1374
|
readonly fix: "Externalize dependencies in the server build (`externals`) for better build performance.";
|
|
1303
1375
|
readonly docs: false;
|
|
1304
1376
|
};
|
|
1377
|
+
readonly NUXT_B7020: {
|
|
1378
|
+
readonly why: "The client build manifest is disabled, but Nuxt requires it to render the correct assets for each route.";
|
|
1379
|
+
readonly fix: "Remove any `build.manifest: false` override from your `nuxt.config` `vite` options or from a Vite plugin `config`/`configEnvironment` hook.";
|
|
1380
|
+
readonly docs: false;
|
|
1381
|
+
};
|
|
1382
|
+
readonly NUXT_B7021: {
|
|
1383
|
+
readonly why: (p: {
|
|
1384
|
+
manifestFile: string;
|
|
1385
|
+
}) => string;
|
|
1386
|
+
readonly fix: "Check that no Vite plugin removes or renames the client build manifest in a `generateBundle`/`writeBundle` hook. If this happens with no such plugin, please report it at https://github.com/nuxt/nuxt/issues.";
|
|
1387
|
+
readonly docs: false;
|
|
1388
|
+
};
|
|
1305
1389
|
}, readonly [import("nostics").DiagnosticReporter<{
|
|
1306
1390
|
method?: import("nostics").ConsoleMethod;
|
|
1307
1391
|
}>]>;
|
|
@@ -1311,7 +1395,7 @@ interface ResolveModuleOptions {
|
|
|
1311
1395
|
/** @deprecated use `url` with URLs pointing at a file - never a directory */
|
|
1312
1396
|
paths?: string | string[];
|
|
1313
1397
|
url?: URL | URL[];
|
|
1314
|
-
/** @default ['.
|
|
1398
|
+
/** @default ['.mjs', '.js', '.cjs', '.mts', '.ts', '.cts', '.tsx', '.jsx'] */
|
|
1315
1399
|
extensions?: string[];
|
|
1316
1400
|
}
|
|
1317
1401
|
declare function directoryToURL(dir: string): URL;
|
|
@@ -1340,4 +1424,4 @@ declare function requireModule<T = unknown>(id: string, opts?: ImportModuleOptio
|
|
|
1340
1424
|
*/
|
|
1341
1425
|
declare function tryRequireModule<T = unknown>(id: string, opts?: ImportModuleOptions): T | undefined;
|
|
1342
1426
|
//#endregion
|
|
1343
|
-
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NuxtMajorVersion, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildDiagnostics, buildNuxt, bundlerDiagnostics, checkNuxtCompatibility, componentDiagnostics, configDiagnostics, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, headDiagnostics, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, pageDiagnostics, pluginDiagnostics, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
1427
|
+
export { type AddComponentOptions, type AddPluginOptions, type AddRouteMiddlewareOptions, DEFAULT_JSX_FILE_EXTENSIONS, DEFAULT_JS_FILE_EXTENSIONS, type ExtendConfigOptions, type ExtendRouteRulesOptions, type ExtendViteConfigOptions, type ExtendWebpackConfigOptions, type ImportModuleOptions, type LayerDirectories, type LoadNuxtConfigOptions, type LoadNuxtOptions, type NuxtMajorVersion, type RecoverableWatcher, type ResolveModuleOptions, type ResolvePathOptions, type Resolver, addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildDiagnostics, buildNuxt, bundlerDiagnostics, checkNuxtCompatibility, componentDiagnostics, configDiagnostics, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, headDiagnostics, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, pageDiagnostics, pluginDiagnostics, recoverThrottledChanges, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { performance } from "node:perf_hooks";
|
|
2
2
|
import { createDefu, defu } from "defu";
|
|
3
|
-
import { applyDefaults } from "untyped";
|
|
4
3
|
import { consola } from "consola";
|
|
5
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
5
|
import { getContext } from "unctx";
|
|
@@ -8,27 +7,28 @@ import { createConsoleReporter, defineDiagnostics } from "nostics";
|
|
|
8
7
|
import process from "node:process";
|
|
9
8
|
import { ansiFormatter } from "nostics/formatters/ansi";
|
|
10
9
|
import { colors } from "consola/utils";
|
|
11
|
-
import satisfies from "
|
|
10
|
+
import { isGreater, isGreaterOrEqual, satisfies } from "verkit";
|
|
12
11
|
import { readPackageJSON, resolvePackageJSON } from "pkg-types";
|
|
13
|
-
import { existsSync, lstatSync, promises, readFileSync } from "node:fs";
|
|
12
|
+
import { existsSync, lstatSync, promises, readFileSync, realpathSync, statSync } from "node:fs";
|
|
14
13
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
15
14
|
import { basename, dirname, isAbsolute, join, normalize, parse, relative, resolve } from "pathe";
|
|
16
|
-
import { createJiti } from "jiti";
|
|
17
15
|
import { interopDefault, lookupNodeModuleSubpath, parseNodeModulePath, resolveModuleExportNames } from "mlly";
|
|
18
16
|
import { resolveModulePath, resolveModuleURL } from "exsolve";
|
|
19
17
|
import { isRelative, withTrailingSlash, withoutTrailingSlash } from "ufo";
|
|
20
18
|
import { read, update } from "rc9";
|
|
21
|
-
import
|
|
19
|
+
import { createJiti } from "jiti";
|
|
22
20
|
import { captureStackTrace } from "errx";
|
|
23
21
|
import { glob } from "tinyglobby";
|
|
24
22
|
import { resolveAlias as resolveAlias$1, reverseResolveAlias } from "pathe/utils";
|
|
25
23
|
import ignore from "ignore";
|
|
24
|
+
import { applyDefaults } from "untyped";
|
|
26
25
|
import { loadConfig, setupDotenv } from "c12";
|
|
26
|
+
import { klona } from "klona";
|
|
27
27
|
import destr from "destr";
|
|
28
28
|
import { kebabCase, pascalCase, snakeCase } from "scule";
|
|
29
|
-
import { klona } from "klona";
|
|
30
29
|
import { hash } from "ohash";
|
|
31
|
-
import { isAbsolute as isAbsolute$1 } from "node:path";
|
|
30
|
+
import { isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "node:path";
|
|
31
|
+
import { stat } from "node:fs/promises";
|
|
32
32
|
//#region src/logger.ts
|
|
33
33
|
const logger = consola;
|
|
34
34
|
function useLogger(tag, options = {}) {
|
|
@@ -209,7 +209,8 @@ const builderMap = {
|
|
|
209
209
|
"@nuxt/webpack-builder": "webpack"
|
|
210
210
|
};
|
|
211
211
|
function checkNuxtVersion(version, nuxt = useNuxt()) {
|
|
212
|
-
|
|
212
|
+
const nuxtVersion = getNuxtVersion(nuxt);
|
|
213
|
+
return satisfies(normalizeSemanticVersion(nuxtVersion), version, { includePrerelease: true });
|
|
213
214
|
}
|
|
214
215
|
/**
|
|
215
216
|
* Check version constraints and return incompatibility issues as an array
|
|
@@ -305,8 +306,13 @@ function _defineNuxtModule(definition) {
|
|
|
305
306
|
module.meta.configKey ||= module.meta.name;
|
|
306
307
|
async function getOptions(inlineOptions, nuxt = useNuxt()) {
|
|
307
308
|
const nuxtConfigOptionsKey = module.meta.configKey || module.meta.name;
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
const nuxtConfigOptions = nuxtConfigOptionsKey && nuxtConfigOptionsKey in nuxt.options ? nuxt.options[nuxtConfigOptionsKey] : {};
|
|
310
|
+
const optionsDefaults = module.defaults instanceof Function ? await module.defaults(nuxt) : module.defaults ?? {};
|
|
311
|
+
let options = defu(inlineOptions, nuxtConfigOptions, optionsDefaults);
|
|
312
|
+
if (module.schema) {
|
|
313
|
+
const { applyDefaults } = await import("untyped");
|
|
314
|
+
options = await applyDefaults(module.schema, options);
|
|
315
|
+
}
|
|
310
316
|
return Promise.resolve(options);
|
|
311
317
|
}
|
|
312
318
|
function getModuleDependencies(nuxt = useNuxt()) {
|
|
@@ -504,6 +510,23 @@ function filterInPlace(array, predicate) {
|
|
|
504
510
|
const MODE_RE = /\.(server|client)(\.\w+)*$/;
|
|
505
511
|
const distDirURL = new URL(".", import.meta.url);
|
|
506
512
|
//#endregion
|
|
513
|
+
//#region src/constants.ts
|
|
514
|
+
/**
|
|
515
|
+
* Default extensions for files that may contain JSX.
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
const DEFAULT_JSX_FILE_EXTENSIONS = [".tsx", ".jsx"];
|
|
519
|
+
/** Default extensions for JavaScript/TypeScript files, in order of resolution priority. */
|
|
520
|
+
const DEFAULT_JS_FILE_EXTENSIONS = [
|
|
521
|
+
".mjs",
|
|
522
|
+
".js",
|
|
523
|
+
".cjs",
|
|
524
|
+
".mts",
|
|
525
|
+
".ts",
|
|
526
|
+
".cts",
|
|
527
|
+
...DEFAULT_JSX_FILE_EXTENSIONS
|
|
528
|
+
];
|
|
529
|
+
//#endregion
|
|
507
530
|
//#region src/resolve.ts
|
|
508
531
|
/**
|
|
509
532
|
* Resolve the full path to a file or a directory (based on the provided type), respecting Nuxt alias and extensions options.
|
|
@@ -602,12 +625,7 @@ async function _resolvePathGranularly(path, opts = { type: "file" }) {
|
|
|
602
625
|
}
|
|
603
626
|
const nuxt = tryUseNuxt();
|
|
604
627
|
const cwd = opts.cwd || (nuxt ? nuxt.options.rootDir : process.cwd());
|
|
605
|
-
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [
|
|
606
|
-
".ts",
|
|
607
|
-
".mjs",
|
|
608
|
-
".cjs",
|
|
609
|
-
".json"
|
|
610
|
-
]);
|
|
628
|
+
const extensions = opts.extensions || (nuxt ? nuxt.options.extensions : [...DEFAULT_JS_FILE_EXTENSIONS, ".json"]);
|
|
611
629
|
const modulesDir = nuxt ? nuxt.options.modulesDir : [];
|
|
612
630
|
path = resolveAlias$1(path, opts.alias ?? nuxt?.options.alias ?? {});
|
|
613
631
|
if (!isAbsolute(path)) path = resolve(cwd, path);
|
|
@@ -676,18 +694,12 @@ function tryResolveModule(id, url = import.meta.url) {
|
|
|
676
694
|
function resolveModule(id, options) {
|
|
677
695
|
return resolveModulePath(id, {
|
|
678
696
|
from: options?.url ?? options?.paths ?? [import.meta.url],
|
|
679
|
-
extensions: options?.extensions ??
|
|
680
|
-
".js",
|
|
681
|
-
".mjs",
|
|
682
|
-
".cjs",
|
|
683
|
-
".ts",
|
|
684
|
-
".mts",
|
|
685
|
-
".cts"
|
|
686
|
-
]
|
|
697
|
+
extensions: options?.extensions ?? DEFAULT_JS_FILE_EXTENSIONS
|
|
687
698
|
});
|
|
688
699
|
}
|
|
689
700
|
async function importModule(id, opts) {
|
|
690
|
-
|
|
701
|
+
const resolvedPath = resolveModule(id, opts);
|
|
702
|
+
return await import(pathToFileURL(resolvedPath).href).then((r) => opts?.interopDefault !== false ? interopDefault(r) : r);
|
|
691
703
|
}
|
|
692
704
|
function tryImportModule(id, opts) {
|
|
693
705
|
try {
|
|
@@ -763,8 +775,9 @@ async function installModules(modulesToInstall, resolvedModulePaths, nuxt = useN
|
|
|
763
775
|
continue;
|
|
764
776
|
}
|
|
765
777
|
if (value.version) {
|
|
766
|
-
const
|
|
767
|
-
|
|
778
|
+
const resolvePaths = [res.resolvedModulePath, ...nuxt.options.modulesDir].filter(Boolean);
|
|
779
|
+
const pkg = await readPackageJSON(name, { from: resolvePaths }).catch(() => null);
|
|
780
|
+
if (pkg?.version && !satisfies(pkg.version, value.version, { includePrerelease: true })) {
|
|
768
781
|
const message = `Module \`${name}\` version (\`${pkg.version}\`) does not satisfy \`${value.version}\` (requested by ${moduleToAttribute}).`;
|
|
769
782
|
error = new TypeError(message);
|
|
770
783
|
}
|
|
@@ -881,14 +894,7 @@ function resolveModuleWithOptions(definition, nuxt) {
|
|
|
881
894
|
"",
|
|
882
895
|
"index"
|
|
883
896
|
],
|
|
884
|
-
extensions:
|
|
885
|
-
".js",
|
|
886
|
-
".mjs",
|
|
887
|
-
".cjs",
|
|
888
|
-
".ts",
|
|
889
|
-
".mts",
|
|
890
|
-
".cts"
|
|
891
|
-
]
|
|
897
|
+
extensions: DEFAULT_JS_FILE_EXTENSIONS
|
|
892
898
|
}) || modAlias,
|
|
893
899
|
options
|
|
894
900
|
};
|
|
@@ -898,7 +904,7 @@ function getSharedJiti(nuxt) {
|
|
|
898
904
|
_jitiCache ||= /* @__PURE__ */ new WeakMap();
|
|
899
905
|
let jiti = _jitiCache.get(nuxt);
|
|
900
906
|
if (!jiti) {
|
|
901
|
-
jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias });
|
|
907
|
+
jiti = import("jiti").then(({ createJiti }) => createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias }));
|
|
902
908
|
_jitiCache.set(nuxt, jiti);
|
|
903
909
|
}
|
|
904
910
|
return jiti;
|
|
@@ -910,11 +916,12 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
910
916
|
buildTimeModuleMeta
|
|
911
917
|
};
|
|
912
918
|
if (typeof nuxtModule !== "string") throw kitDiagnostics.NUXT_B8015({ received: `${typeof nuxtModule} (${JSON.stringify(nuxtModule)})` });
|
|
913
|
-
const jiti = getSharedJiti(nuxt);
|
|
919
|
+
const jiti = await getSharedJiti(nuxt);
|
|
914
920
|
nuxtModule = resolveAlias(nuxtModule, nuxt.options.alias);
|
|
915
921
|
if (isRelative(nuxtModule)) nuxtModule = resolve(nuxt.options.rootDir, nuxtModule);
|
|
922
|
+
let src;
|
|
916
923
|
try {
|
|
917
|
-
|
|
924
|
+
src = resolveModuleURL(nuxtModule, {
|
|
918
925
|
from: nuxt.options.modulesDir.map((m) => directoryToURL(m.replace(/\/node_modules\/?$/, "/"))),
|
|
919
926
|
suffixes: [
|
|
920
927
|
"nuxt",
|
|
@@ -924,41 +931,33 @@ async function loadNuxtModuleInstance(nuxtModule, nuxt = useNuxt()) {
|
|
|
924
931
|
"",
|
|
925
932
|
"index"
|
|
926
933
|
],
|
|
927
|
-
extensions:
|
|
928
|
-
".js",
|
|
929
|
-
".mjs",
|
|
930
|
-
".cjs",
|
|
931
|
-
".ts",
|
|
932
|
-
".mts",
|
|
933
|
-
".cts"
|
|
934
|
-
]
|
|
934
|
+
extensions: DEFAULT_JS_FILE_EXTENSIONS
|
|
935
935
|
});
|
|
936
|
-
const resolvedModulePath = fileURLToPath(src);
|
|
937
|
-
const resolvedNuxtModule = await jiti.import(src, { default: true });
|
|
938
|
-
if (typeof resolvedNuxtModule !== "function") throw kitDiagnostics.NUXT_B8016({ module: nuxtModule });
|
|
939
|
-
const moduleMetadataPath = new URL("module.json", src);
|
|
940
|
-
if (existsSync(moduleMetadataPath)) buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
941
|
-
return {
|
|
942
|
-
nuxtModule: resolvedNuxtModule,
|
|
943
|
-
buildTimeModuleMeta,
|
|
944
|
-
resolvedModulePath
|
|
945
|
-
};
|
|
946
936
|
} catch (error) {
|
|
947
|
-
|
|
948
|
-
if (code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_UNSUPPORTED_DIR_IMPORT" || code === "ENOTDIR") throw kitDiagnostics.NUXT_B8017({
|
|
937
|
+
throw kitDiagnostics.NUXT_B8017({
|
|
949
938
|
module: nuxtModule,
|
|
950
939
|
cause: error
|
|
951
940
|
});
|
|
952
|
-
if (code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND") {
|
|
953
|
-
const module = MissingModuleMatcher.exec(error.message)?.[1];
|
|
954
|
-
if (module && !module.includes(nuxtModule)) throw kitDiagnostics.NUXT_B8018({
|
|
955
|
-
module: nuxtModule,
|
|
956
|
-
error: String(error),
|
|
957
|
-
cause: error
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
941
|
}
|
|
961
|
-
|
|
942
|
+
const resolvedModulePath = fileURLToPath(src);
|
|
943
|
+
let resolvedNuxtModule;
|
|
944
|
+
try {
|
|
945
|
+
resolvedNuxtModule = await jiti.import(src, { default: true });
|
|
946
|
+
} catch (error) {
|
|
947
|
+
throw kitDiagnostics.NUXT_B8018({
|
|
948
|
+
module: nuxtModule,
|
|
949
|
+
error: String(error),
|
|
950
|
+
cause: error
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
if (typeof resolvedNuxtModule !== "function") throw kitDiagnostics.NUXT_B8016({ module: nuxtModule });
|
|
954
|
+
const moduleMetadataPath = new URL("module.json", src);
|
|
955
|
+
if (existsSync(moduleMetadataPath)) buildTimeModuleMeta = JSON.parse(await promises.readFile(moduleMetadataPath, "utf-8"));
|
|
956
|
+
return {
|
|
957
|
+
nuxtModule: resolvedNuxtModule,
|
|
958
|
+
buildTimeModuleMeta,
|
|
959
|
+
resolvedModulePath
|
|
960
|
+
};
|
|
962
961
|
}
|
|
963
962
|
function getDirectory(p) {
|
|
964
963
|
try {
|
|
@@ -969,7 +968,6 @@ function getDirectory(p) {
|
|
|
969
968
|
const normalizeModuleTranspilePath = (p) => {
|
|
970
969
|
return getDirectory(p).split("node_modules/").pop();
|
|
971
970
|
};
|
|
972
|
-
const MissingModuleMatcher = /Cannot find module\s+['"]?([^'")\s]+)['"]?/i;
|
|
973
971
|
async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions, nuxt = useNuxt()) {
|
|
974
972
|
if (!meta.name || !meta.version) return;
|
|
975
973
|
if (!nuxtModule.onInstall && !nuxtModule.onUpgrade) return;
|
|
@@ -979,7 +977,7 @@ async function callLifecycleHooks(nuxtModule, meta = {}, inlineOptions, nuxt = u
|
|
|
979
977
|
})?.setups?.[meta.name];
|
|
980
978
|
try {
|
|
981
979
|
if (!previousVersion) await nuxtModule.onInstall?.(nuxt);
|
|
982
|
-
else if (
|
|
980
|
+
else if (isGreater(meta.version, previousVersion)) await nuxtModule.onUpgrade?.(nuxt, inlineOptions, previousVersion);
|
|
983
981
|
if (previousVersion !== meta.version) update({ setups: { [meta.name]: meta?.version } }, {
|
|
984
982
|
dir: nuxt.options.rootDir,
|
|
985
983
|
name: ".nuxtrc"
|
|
@@ -1073,17 +1071,22 @@ const merger = createDefu((obj, key, value) => {
|
|
|
1073
1071
|
}
|
|
1074
1072
|
});
|
|
1075
1073
|
async function loadNuxtConfig(opts) {
|
|
1074
|
+
const rootCwd = resolve(opts.cwd || process.cwd());
|
|
1076
1075
|
const localLayers = (await glob("layers/*", {
|
|
1077
1076
|
onlyDirectories: true,
|
|
1078
|
-
cwd:
|
|
1077
|
+
cwd: rootCwd
|
|
1079
1078
|
})).map((d) => withTrailingSlash(d)).sort((a, b) => b.localeCompare(a));
|
|
1080
1079
|
opts.overrides = defu(opts.overrides, { _extends: localLayers });
|
|
1080
|
+
const autoScanSources = new Set(localLayers);
|
|
1081
|
+
const localLayerDirs = new Set(localLayers.map((dir) => canonicalLayerDir(resolve(rootCwd, withoutTrailingSlash(dir)))));
|
|
1082
|
+
const extendsLocalLayerOrder = [];
|
|
1081
1083
|
if (opts.dotenv !== false) await setupDotenv({
|
|
1082
1084
|
cwd: opts.cwd || process.cwd(),
|
|
1083
1085
|
...typeof opts.dotenv === "object" ? opts.dotenv : {}
|
|
1084
1086
|
});
|
|
1085
1087
|
const schemaPromise = loadNuxtSchema(opts.cwd || process.cwd());
|
|
1086
|
-
const
|
|
1088
|
+
const seenLayerDirs = /* @__PURE__ */ new Set();
|
|
1089
|
+
const resolved = await withDefineNuxtConfig(() => loadConfig({
|
|
1087
1090
|
name: "nuxt",
|
|
1088
1091
|
configFile: "nuxt.config",
|
|
1089
1092
|
rcFile: ".nuxtrc",
|
|
@@ -1095,8 +1098,48 @@ async function loadNuxtConfig(opts) {
|
|
|
1095
1098
|
globalRc: true,
|
|
1096
1099
|
merger,
|
|
1097
1100
|
...opts,
|
|
1098
|
-
dotenv: false
|
|
1101
|
+
dotenv: false,
|
|
1102
|
+
async resolve(source, resolveOptions) {
|
|
1103
|
+
const custom = await opts.resolve?.(source, resolveOptions);
|
|
1104
|
+
if (custom) return custom;
|
|
1105
|
+
if (typeof source !== "string") return;
|
|
1106
|
+
const base = resolveOptions.cwd ? resolve(resolveOptions.cwd) : rootCwd;
|
|
1107
|
+
const aliased = resolveLayerExtendsAlias(source, rootCwd);
|
|
1108
|
+
const path = aliased ?? resolve(base, source);
|
|
1109
|
+
if (!existsSync(path)) return;
|
|
1110
|
+
const layerDir = canonicalLayerDir(path);
|
|
1111
|
+
if (base === rootCwd && !autoScanSources.has(source) && localLayerDirs.has(layerDir)) extendsLocalLayerOrder.push(layerDir);
|
|
1112
|
+
if (seenLayerDirs.has(layerDir)) return {
|
|
1113
|
+
config: {},
|
|
1114
|
+
cwd: layerDir,
|
|
1115
|
+
source
|
|
1116
|
+
};
|
|
1117
|
+
seenLayerDirs.add(layerDir);
|
|
1118
|
+
if (aliased) {
|
|
1119
|
+
const layer = await loadConfig({
|
|
1120
|
+
cwd: aliased,
|
|
1121
|
+
name: "nuxt",
|
|
1122
|
+
configFile: "nuxt.config",
|
|
1123
|
+
rcFile: false,
|
|
1124
|
+
extend: false,
|
|
1125
|
+
jiti: resolveOptions.jiti
|
|
1126
|
+
});
|
|
1127
|
+
return layer.configFile ? {
|
|
1128
|
+
config: layer.config,
|
|
1129
|
+
configFile: layer.configFile,
|
|
1130
|
+
cwd: aliased,
|
|
1131
|
+
source: aliased,
|
|
1132
|
+
meta: layer.meta
|
|
1133
|
+
} : {
|
|
1134
|
+
config: {},
|
|
1135
|
+
cwd: aliased,
|
|
1136
|
+
source
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1099
1140
|
}));
|
|
1141
|
+
const { configFile, layers = [], cwd, meta } = resolved;
|
|
1142
|
+
const nuxtConfig = klona(resolved.config);
|
|
1100
1143
|
nuxtConfig.rootDir ||= cwd;
|
|
1101
1144
|
nuxtConfig._nuxtConfigFile = configFile;
|
|
1102
1145
|
nuxtConfig._nuxtConfigFiles = [configFile];
|
|
@@ -1142,6 +1185,7 @@ async function loadNuxtConfig(opts) {
|
|
|
1142
1185
|
}
|
|
1143
1186
|
_layers.push(layer);
|
|
1144
1187
|
}
|
|
1188
|
+
if (extendsLocalLayerOrder.length) reorderLocalLayersByExtends(_layers, extendsLocalLayerOrder, localLayerDirs);
|
|
1145
1189
|
nuxtConfig._layers = _layers;
|
|
1146
1190
|
if (!_layers.length) _layers.push({
|
|
1147
1191
|
cwd,
|
|
@@ -1152,6 +1196,63 @@ async function loadNuxtConfig(opts) {
|
|
|
1152
1196
|
});
|
|
1153
1197
|
return await applyDefaults(NuxtConfigSchema, nuxtConfig);
|
|
1154
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Canonicalise a filesystem path to a layer directory: config-file paths collapse to their
|
|
1201
|
+
* directory and symlinks resolve to their target, so different spellings of the same layer
|
|
1202
|
+
* share one identity. The path must exist.
|
|
1203
|
+
*/
|
|
1204
|
+
function canonicalLayerDir(path) {
|
|
1205
|
+
return normalize(realpathSync(statSync(path).isDirectory() ? path : dirname(path)));
|
|
1206
|
+
}
|
|
1207
|
+
const LAYER_EXTENDS_ALIASES = [
|
|
1208
|
+
"~~",
|
|
1209
|
+
"@@",
|
|
1210
|
+
"~",
|
|
1211
|
+
"@"
|
|
1212
|
+
];
|
|
1213
|
+
/**
|
|
1214
|
+
* Resolve a leading `~`, `~~`, `@` or `@@` alias in an `extends` source to an absolute path.
|
|
1215
|
+
* Local layers live at the project root, so every alias resolves against `rootDir`. Returns
|
|
1216
|
+
* `undefined` when the source is not alias-prefixed.
|
|
1217
|
+
*/
|
|
1218
|
+
function resolveLayerExtendsAlias(source, rootDir) {
|
|
1219
|
+
for (const alias of LAYER_EXTENDS_ALIASES) {
|
|
1220
|
+
if (source === alias) return rootDir;
|
|
1221
|
+
if (source.startsWith(`${alias}/`)) return join(rootDir, source.slice(alias.length + 1));
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Reorder local layers (from the `~~/layers/` directory) in place to match the order they are
|
|
1226
|
+
* listed in `extends` (first entry = highest priority). Listed layers come first in that order;
|
|
1227
|
+
* unlisted local layers keep their existing alphabetical order after them. Non-local layers keep
|
|
1228
|
+
* their positions.
|
|
1229
|
+
*/
|
|
1230
|
+
function reorderLocalLayersByExtends(layers, extendsOrder, localLayerDirs) {
|
|
1231
|
+
const layerDir = (layer) => {
|
|
1232
|
+
const dir = withoutTrailingSlash(layer.config?.rootDir ?? layer.cwd ?? "");
|
|
1233
|
+
try {
|
|
1234
|
+
return normalize(realpathSync(dir));
|
|
1235
|
+
} catch {
|
|
1236
|
+
return normalize(dir);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
const priorityByDir = new Map(extendsOrder.map((dir, index) => [dir, index]));
|
|
1240
|
+
const localSlots = [];
|
|
1241
|
+
const localLayers = [];
|
|
1242
|
+
for (let index = 0; index < layers.length; index++) if (localLayerDirs.has(layerDir(layers[index]))) {
|
|
1243
|
+
localSlots.push(index);
|
|
1244
|
+
localLayers.push(layers[index]);
|
|
1245
|
+
}
|
|
1246
|
+
const orderedLocalLayers = localLayers.map((layer, index) => ({
|
|
1247
|
+
layer,
|
|
1248
|
+
index
|
|
1249
|
+
})).sort((a, b) => {
|
|
1250
|
+
return (priorityByDir.get(layerDir(a.layer)) ?? Number.POSITIVE_INFINITY) - (priorityByDir.get(layerDir(b.layer)) ?? Number.POSITIVE_INFINITY) || a.index - b.index;
|
|
1251
|
+
}).map((entry) => entry.layer);
|
|
1252
|
+
localSlots.forEach((slot, index) => {
|
|
1253
|
+
layers[slot] = orderedLocalLayers[index];
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1155
1256
|
function loadNuxtSchema(cwd) {
|
|
1156
1257
|
const url = directoryToURL(cwd);
|
|
1157
1258
|
const urls = [url];
|
|
@@ -1488,14 +1589,18 @@ function addVitePlugin(pluginOrGetter, options = {}) {
|
|
|
1488
1589
|
return;
|
|
1489
1590
|
}
|
|
1490
1591
|
const environmentName = options.server === false ? "client" : "ssr";
|
|
1491
|
-
const
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1592
|
+
const defaultEnforce = options?.prepend ? "pre" : "post";
|
|
1593
|
+
const method = options?.prepend ? "unshift" : "push";
|
|
1594
|
+
for (const [enforce, plugins] of groupByEnforce(plugin, defaultEnforce)) {
|
|
1595
|
+
const pluginName = plugins.map((p) => p.name).join("|");
|
|
1596
|
+
config.plugins[method]({
|
|
1597
|
+
name: `${pluginName}:wrapper`,
|
|
1598
|
+
enforce,
|
|
1599
|
+
applyToEnvironment(environment) {
|
|
1600
|
+
if (environment.name === environmentName) return resolveNestedPlugins(plugins, config, environment, nuxt);
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1499
1604
|
});
|
|
1500
1605
|
nuxt.hook("vite:extendConfig", async (config, env) => {
|
|
1501
1606
|
if (!needsEnvInjection) return;
|
|
@@ -1505,6 +1610,53 @@ function addVitePlugin(pluginOrGetter, options = {}) {
|
|
|
1505
1610
|
if (env.isServer && options.client === false) config.plugins[method](...plugin);
|
|
1506
1611
|
});
|
|
1507
1612
|
}
|
|
1613
|
+
function groupByEnforce(plugins, defaultEnforce) {
|
|
1614
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1615
|
+
for (const plugin of plugins) {
|
|
1616
|
+
const enforce = plugin.enforce ?? defaultEnforce;
|
|
1617
|
+
const group = groups.get(enforce);
|
|
1618
|
+
if (group) group.push(plugin);
|
|
1619
|
+
else groups.set(enforce, [plugin]);
|
|
1620
|
+
}
|
|
1621
|
+
return groups;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Vite only honours `apply` and `applyToEnvironment` for plugins it finds in the
|
|
1625
|
+
* top-level plugin array, so plugins nested behind a wrapper have to be resolved
|
|
1626
|
+
* by hand or (for example) dev-only plugins would leak into production builds.
|
|
1627
|
+
*/
|
|
1628
|
+
async function resolveNestedPlugins(plugins, config, environment, nuxt) {
|
|
1629
|
+
const configEnv = resolveConfigEnv(environment, config, nuxt);
|
|
1630
|
+
const resolved = [];
|
|
1631
|
+
for (const plugin of plugins) {
|
|
1632
|
+
const { apply, applyToEnvironment } = plugin;
|
|
1633
|
+
if (apply && (typeof apply === "function" ? !apply(config, configEnv) : apply !== configEnv.command)) continue;
|
|
1634
|
+
const applied = applyToEnvironment ? await applyToEnvironment(environment) : true;
|
|
1635
|
+
if (applied === true) {
|
|
1636
|
+
resolved.push(plugin);
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1639
|
+
resolved.push(...await flattenPlugins(applied));
|
|
1640
|
+
}
|
|
1641
|
+
return resolved;
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* `getTopLevelConfig` is only available from Vite 6, and kit is used with older
|
|
1645
|
+
* versions of nuxt (and therefore vite), so fall back to what we can infer.
|
|
1646
|
+
*/
|
|
1647
|
+
function resolveConfigEnv(environment, config, nuxt) {
|
|
1648
|
+
const topLevelConfig = environment.getTopLevelConfig?.() ?? environment.config;
|
|
1649
|
+
return {
|
|
1650
|
+
command: topLevelConfig?.command ?? (nuxt.options.dev ? "serve" : "build"),
|
|
1651
|
+
mode: topLevelConfig?.mode ?? config.mode ?? nuxt.options.vite?.mode ?? (nuxt.options.dev ? "development" : "production")
|
|
1652
|
+
};
|
|
1653
|
+
}
|
|
1654
|
+
async function flattenPlugins(option) {
|
|
1655
|
+
const resolved = await option;
|
|
1656
|
+
if (!resolved) return [];
|
|
1657
|
+
if (Array.isArray(resolved)) return (await Promise.all(resolved.map(flattenPlugins))).flat();
|
|
1658
|
+
return [resolved];
|
|
1659
|
+
}
|
|
1508
1660
|
function addBuildPlugin(pluginFactory, options) {
|
|
1509
1661
|
if (pluginFactory.vite) addVitePlugin(pluginFactory.vite, options);
|
|
1510
1662
|
if (pluginFactory.webpack) addWebpackPlugin(pluginFactory.webpack, options);
|
|
@@ -1615,7 +1767,8 @@ function addComponentExports(opts) {
|
|
|
1615
1767
|
const nuxt = useNuxt();
|
|
1616
1768
|
const components = [];
|
|
1617
1769
|
nuxt.hook("components:dirs", async () => {
|
|
1618
|
-
const
|
|
1770
|
+
const filePath = await resolvePath(opts.filePath);
|
|
1771
|
+
const names = await resolveModuleExportNames(filePath, { extensions: nuxt.options.extensions });
|
|
1619
1772
|
components.length = 0;
|
|
1620
1773
|
for (const name of names) components.push(normalizeComponent({
|
|
1621
1774
|
name: pascalCase([opts.prefix || "", name === "default" ? "" : name]),
|
|
@@ -1713,6 +1866,11 @@ const pageDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
1713
1866
|
fix: "Use only JSON-serializable values (strings, numbers, booleans, arrays, plain objects) in `defineRouteRules()`.",
|
|
1714
1867
|
docs: false
|
|
1715
1868
|
},
|
|
1869
|
+
NUXT_B4007: {
|
|
1870
|
+
why: (p) => `\`${p.fnName}\` is called conditionally or used as an expression in \`${p.file}\`, but it is a compiler macro that is extracted at build time and always applies.`,
|
|
1871
|
+
fix: (p) => `Call \`${p.fnName}({ ... })\` once, as a statement at the top level of the \`<script setup>\` block.`,
|
|
1872
|
+
docs: false
|
|
1873
|
+
},
|
|
1716
1874
|
NUXT_B4008: {
|
|
1717
1875
|
why: "Server pages with `ssr: false` are not supported while component islands are auto-detected.",
|
|
1718
1876
|
fix: "Set `experimental.componentIslands` to `true`.",
|
|
@@ -1747,6 +1905,16 @@ const pageDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
1747
1905
|
why: (p) => `Layout \`${p.layoutName}\` is already provided by \`${p.existingPath}\` and was not overridden with \`${p.newPath}\`.`,
|
|
1748
1906
|
fix: "Rename one of the layouts, or remove the duplicate layout registration.",
|
|
1749
1907
|
docs: false
|
|
1908
|
+
},
|
|
1909
|
+
NUXT_B4016: {
|
|
1910
|
+
why: (p) => `Inline route rules for \`${p.path}\` cannot be represented exactly by Nitro route rules, so they were not applied: ${p.detail}.`,
|
|
1911
|
+
fix: "Define the affected route rules explicitly in `nitro.routeRules`.",
|
|
1912
|
+
docs: false
|
|
1913
|
+
},
|
|
1914
|
+
NUXT_B4017: {
|
|
1915
|
+
why: (p) => `Inline route rules for \`${p.path}\` generated \`${p.pattern}\`, which is already used by another page.`,
|
|
1916
|
+
fix: "The later inline route rules override the earlier ones. Use distinct routes, or define the rules explicitly in `nitro.routeRules`.",
|
|
1917
|
+
docs: false
|
|
1750
1918
|
}
|
|
1751
1919
|
}
|
|
1752
1920
|
});
|
|
@@ -1803,10 +1971,11 @@ function resolveRoot(basePkg, from) {
|
|
|
1803
1971
|
if (rootCache.has(cacheKey)) return rootCache.get(cacheKey);
|
|
1804
1972
|
const promise = (async () => {
|
|
1805
1973
|
try {
|
|
1806
|
-
|
|
1974
|
+
const r = resolveModulePath(basePkg, {
|
|
1807
1975
|
from,
|
|
1808
1976
|
...TYPE_RESOLVE_OPTIONS
|
|
1809
|
-
})
|
|
1977
|
+
});
|
|
1978
|
+
return dirname(await resolvePackageJSON(r));
|
|
1810
1979
|
} catch {
|
|
1811
1980
|
return;
|
|
1812
1981
|
}
|
|
@@ -2057,7 +2226,7 @@ async function _generateTypes(nuxt) {
|
|
|
2057
2226
|
if (nestedModulesDirs.every((d) => !d.startsWith(withSlash))) nestedModulesDirs.push(withSlash);
|
|
2058
2227
|
}
|
|
2059
2228
|
let hasTypescriptVersionWithModulePreserve;
|
|
2060
|
-
for (const parent of nestedModulesDirs) hasTypescriptVersionWithModulePreserve ??= await readPackageJSON("typescript", { parent }).then((r) => r?.version &&
|
|
2229
|
+
for (const parent of nestedModulesDirs) hasTypescriptVersionWithModulePreserve ??= await readPackageJSON("typescript", { parent }).then((r) => r?.version && isGreaterOrEqual(r.version, "5.4.0")).catch(() => void 0);
|
|
2061
2230
|
hasTypescriptVersionWithModulePreserve ??= true;
|
|
2062
2231
|
const useDecorators = Boolean(nuxt.options.experimental?.decorators);
|
|
2063
2232
|
const isV5OrHigher = (nuxt.options.future?.compatibilityVersion ?? 4) >= 5;
|
|
@@ -2283,16 +2452,25 @@ async function writeTypes(nuxt) {
|
|
|
2283
2452
|
const sharedDeclarationPath = resolve(nuxt.options.buildDir, "nuxt.shared.d.ts");
|
|
2284
2453
|
await promises.mkdir(nuxt.options.buildDir, { recursive: true });
|
|
2285
2454
|
await Promise.all([
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2455
|
+
writeIfChanged(appTsConfigPath, JSON.stringify(tsConfig, null, 2)),
|
|
2456
|
+
writeIfChanged(legacyTsConfigPath, JSON.stringify(legacyTsConfig, null, 2)),
|
|
2457
|
+
writeIfChanged(nodeTsConfigPath, JSON.stringify(nodeTsConfig, null, 2)),
|
|
2458
|
+
writeIfChanged(sharedTsConfigPath, JSON.stringify(sharedTsConfig, null, 2)),
|
|
2459
|
+
writeIfChanged(declarationPath, declaration),
|
|
2460
|
+
writeIfChanged(nodeDeclarationPath, nodeDeclaration),
|
|
2461
|
+
writeIfChanged(sharedDeclarationPath, sharedDeclaration)
|
|
2293
2462
|
]);
|
|
2294
2463
|
}
|
|
2295
2464
|
/**
|
|
2465
|
+
* Types are regenerated on every start and are usually identical, so avoid
|
|
2466
|
+
* touching the files: an unchanged mtime keeps editors and `tsc --watch` from
|
|
2467
|
+
* redoing work they have already done.
|
|
2468
|
+
*/
|
|
2469
|
+
async function writeIfChanged(path, contents) {
|
|
2470
|
+
if (await promises.readFile(path, "utf8").catch(() => void 0) === contents) return;
|
|
2471
|
+
await promises.writeFile(path, contents);
|
|
2472
|
+
}
|
|
2473
|
+
/**
|
|
2296
2474
|
* Sort the paths in the tsconfig.json file, so
|
|
2297
2475
|
* - Hoisted package paths stay at the top (`typescript.hoist`)
|
|
2298
2476
|
* - Custom layer aliases follow, then generic `#layers/*` aliases
|
|
@@ -2472,6 +2650,15 @@ const pluginDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
2472
2650
|
why: (p) => `Invalid plugin \`${p.src}\`. The \`src\` option is required.`,
|
|
2473
2651
|
fix: "Pass a string path, or an object with a `src` property, to `addPlugin()`.",
|
|
2474
2652
|
docs: false
|
|
2653
|
+
},
|
|
2654
|
+
NUXT_B2012: {
|
|
2655
|
+
why: (p) => {
|
|
2656
|
+
const dependencies = p.dependencies.map((name) => `\`${name}\``).join(", ");
|
|
2657
|
+
const plural = p.dependencies.length > 1;
|
|
2658
|
+
return `Plugin \`${p.name}\` depends on ${dependencies}, but ${plural ? "these dependencies are" : "this dependency is"} unavailable in the ${p.mode} build and will be ignored.`;
|
|
2659
|
+
},
|
|
2660
|
+
fix: "Do not depend on plugins that are unavailable in the same build environment; remove them from the `dependsOn` array.",
|
|
2661
|
+
docs: false
|
|
2475
2662
|
}
|
|
2476
2663
|
}
|
|
2477
2664
|
});
|
|
@@ -2488,15 +2675,7 @@ function normalizePlugin(plugin) {
|
|
|
2488
2675
|
if (!plugin.src) throw pluginDiagnostics.NUXT_B2011({ src: JSON.stringify(plugin) });
|
|
2489
2676
|
plugin.src = normalize(resolveAlias(plugin.src));
|
|
2490
2677
|
if (!existsSync(plugin.src) && isAbsolute$1(plugin.src)) try {
|
|
2491
|
-
plugin.src = resolveModulePath(plugin.src, { extensions: tryUseNuxt()?.options.extensions ??
|
|
2492
|
-
".js",
|
|
2493
|
-
".mjs",
|
|
2494
|
-
".cjs",
|
|
2495
|
-
".ts",
|
|
2496
|
-
".tsx",
|
|
2497
|
-
".mts",
|
|
2498
|
-
".cts"
|
|
2499
|
-
] });
|
|
2678
|
+
plugin.src = resolveModulePath(plugin.src, { extensions: tryUseNuxt()?.options.extensions ?? DEFAULT_JS_FILE_EXTENSIONS });
|
|
2500
2679
|
} catch {}
|
|
2501
2680
|
if (plugin.ssr) plugin.mode = "server";
|
|
2502
2681
|
if (!plugin.mode) {
|
|
@@ -2523,6 +2702,127 @@ function addPluginTemplate(plugin, opts = {}) {
|
|
|
2523
2702
|
}, opts);
|
|
2524
2703
|
}
|
|
2525
2704
|
//#endregion
|
|
2705
|
+
//#region src/watch.ts
|
|
2706
|
+
const RECHECK_DELAY = 70;
|
|
2707
|
+
/**
|
|
2708
|
+
* A single write moves the mtime more than once (truncate, then write) and
|
|
2709
|
+
* chokidar may dispatch `change` off the first of those, so a mtime a hair
|
|
2710
|
+
* newer than the one recorded is the tail of a write that *was* reported
|
|
2711
|
+
* rather than one that was dropped.
|
|
2712
|
+
*/
|
|
2713
|
+
const MTIME_EPSILON = 10;
|
|
2714
|
+
const RECOVERY_FLAG = Symbol.for("nuxt:watch-recovery");
|
|
2715
|
+
/**
|
|
2716
|
+
* chokidar suppresses a `change` event that lands within 50ms of the previous
|
|
2717
|
+
* `change` for the same path, and never replays it. A save that follows a fast
|
|
2718
|
+
* HMR round trip is therefore silently lost until the file is touched again,
|
|
2719
|
+
* which looks exactly like broken HMR. This is true of every chokidar major
|
|
2720
|
+
* Nuxt uses.
|
|
2721
|
+
*
|
|
2722
|
+
* Raw fs events are not throttled, so once chokidar has reported a file at
|
|
2723
|
+
* least once we can use them to notice a modification that never surfaced as a
|
|
2724
|
+
* `change` event, and re-emit it after the throttle window has passed.
|
|
2725
|
+
*
|
|
2726
|
+
* @param watcher the chokidar watcher to patch
|
|
2727
|
+
* @returns a disposer releasing the recovery state; call it when the watcher closes
|
|
2728
|
+
*/
|
|
2729
|
+
function recoverThrottledChanges(watcher) {
|
|
2730
|
+
if (watcher[RECOVERY_FLAG]) return () => {};
|
|
2731
|
+
Object.defineProperty(watcher, RECOVERY_FLAG, {
|
|
2732
|
+
value: true,
|
|
2733
|
+
configurable: true
|
|
2734
|
+
});
|
|
2735
|
+
const tracked = /* @__PURE__ */ new Map();
|
|
2736
|
+
const pending = /* @__PURE__ */ new Map();
|
|
2737
|
+
let disposed = false;
|
|
2738
|
+
/**
|
|
2739
|
+
* With `cwd` set, chokidar emits high-level events relative to it while raw
|
|
2740
|
+
* events carry an absolute `watchedPath`, so everything is keyed absolutely
|
|
2741
|
+
* and the emitted path is kept alongside to re-emit in chokidar's namespace.
|
|
2742
|
+
*/
|
|
2743
|
+
const cwd = watcher.options?.cwd;
|
|
2744
|
+
const toKey = (path) => cwd ? resolve$1(cwd, path) : path;
|
|
2745
|
+
/**
|
|
2746
|
+
* `watchedPath` is the (possibly relative) path chokidar handed to `fs.watch`
|
|
2747
|
+
* and `path` is the name `fs.watch` reported, which is a basename both when
|
|
2748
|
+
* the file itself is watched and when its parent directory is. The two are
|
|
2749
|
+
* indistinguishable for a directory containing a child of the same name, so
|
|
2750
|
+
* pick whichever candidate chokidar has already reported a modification time
|
|
2751
|
+
* for, and use native separators to match the paths chokidar emits.
|
|
2752
|
+
*/
|
|
2753
|
+
const resolveTracked = (path, details) => {
|
|
2754
|
+
const watched = typeof details?.watchedPath === "string" ? details.watchedPath : void 0;
|
|
2755
|
+
if (!watched) {
|
|
2756
|
+
const key = toKey(path);
|
|
2757
|
+
return tracked.has(key) ? key : void 0;
|
|
2758
|
+
}
|
|
2759
|
+
const child = toKey(join$1(watched, path));
|
|
2760
|
+
if (tracked.has(child)) return child;
|
|
2761
|
+
const parent = toKey(watched);
|
|
2762
|
+
return tracked.has(parent) ? parent : void 0;
|
|
2763
|
+
};
|
|
2764
|
+
const track = (path, stats) => {
|
|
2765
|
+
if (disposed) return;
|
|
2766
|
+
const key = toKey(path);
|
|
2767
|
+
if (stats) {
|
|
2768
|
+
tracked.set(key, {
|
|
2769
|
+
mtimeMs: stats.mtimeMs,
|
|
2770
|
+
path
|
|
2771
|
+
});
|
|
2772
|
+
return;
|
|
2773
|
+
}
|
|
2774
|
+
stat(key).then((s) => {
|
|
2775
|
+
if (!disposed) tracked.set(key, {
|
|
2776
|
+
mtimeMs: s.mtimeMs,
|
|
2777
|
+
path
|
|
2778
|
+
});
|
|
2779
|
+
}, () => {});
|
|
2780
|
+
};
|
|
2781
|
+
const forget = (path) => {
|
|
2782
|
+
const key = toKey(path);
|
|
2783
|
+
tracked.delete(key);
|
|
2784
|
+
const timeout = pending.get(key);
|
|
2785
|
+
if (timeout) {
|
|
2786
|
+
clearTimeout(timeout);
|
|
2787
|
+
pending.delete(key);
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2790
|
+
watcher.on("add", track);
|
|
2791
|
+
watcher.on("change", track);
|
|
2792
|
+
watcher.on("unlink", forget);
|
|
2793
|
+
watcher.on("raw", (event, path, details) => {
|
|
2794
|
+
if (disposed) return;
|
|
2795
|
+
if (event !== "change" && event !== "rename" && event !== "modified") return;
|
|
2796
|
+
if (typeof path !== "string" || !path) return;
|
|
2797
|
+
const file = resolveTracked(path, details);
|
|
2798
|
+
if (!file || pending.has(file)) return;
|
|
2799
|
+
const timeout = setTimeout(() => {
|
|
2800
|
+
pending.delete(file);
|
|
2801
|
+
if (disposed) return;
|
|
2802
|
+
stat(file).then((stats) => {
|
|
2803
|
+
if (disposed) return;
|
|
2804
|
+
const previous = tracked.get(file);
|
|
2805
|
+
if (!previous) return;
|
|
2806
|
+
tracked.set(file, {
|
|
2807
|
+
mtimeMs: stats.mtimeMs,
|
|
2808
|
+
path: previous.path
|
|
2809
|
+
});
|
|
2810
|
+
if (stats.mtimeMs - previous.mtimeMs <= MTIME_EPSILON) return;
|
|
2811
|
+
watcher.emit("change", previous.path, stats);
|
|
2812
|
+
watcher.emit("all", "change", previous.path, stats);
|
|
2813
|
+
}, () => {});
|
|
2814
|
+
}, RECHECK_DELAY);
|
|
2815
|
+
timeout.unref();
|
|
2816
|
+
pending.set(file, timeout);
|
|
2817
|
+
});
|
|
2818
|
+
return () => {
|
|
2819
|
+
disposed = true;
|
|
2820
|
+
for (const timeout of pending.values()) clearTimeout(timeout);
|
|
2821
|
+
pending.clear();
|
|
2822
|
+
tracked.clear();
|
|
2823
|
+
};
|
|
2824
|
+
}
|
|
2825
|
+
//#endregion
|
|
2526
2826
|
//#region src/diagnostics/build.ts
|
|
2527
2827
|
/**
|
|
2528
2828
|
* B1xxx
|
|
@@ -2586,17 +2886,17 @@ const buildDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
2586
2886
|
},
|
|
2587
2887
|
NUXT_B1011: {
|
|
2588
2888
|
why: (p) => `Failed to read file \`${p.file}\`.`,
|
|
2589
|
-
fix: "Check that the file exists and is readable, or try clearing the build cache with `
|
|
2889
|
+
fix: "Check that the file exists and is readable, or try clearing the build cache with `nuxt clean`.",
|
|
2590
2890
|
docs: false
|
|
2591
2891
|
},
|
|
2592
2892
|
NUXT_B1012: {
|
|
2593
2893
|
why: (p) => `Skipping unsafe cache path: ${p.path}. This cache file has a path that escapes the project directory (possible path traversal).`,
|
|
2594
|
-
fix: "Delete the cache with `
|
|
2894
|
+
fix: "Delete the cache with `nuxt clean` and rebuild.",
|
|
2595
2895
|
docs: false
|
|
2596
2896
|
},
|
|
2597
2897
|
NUXT_B1013: {
|
|
2598
2898
|
why: (p) => `Failed to restore cached file \`${p.file}\`.`,
|
|
2599
|
-
fix: "Try clearing the build cache with `
|
|
2899
|
+
fix: "Try clearing the build cache with `nuxt clean` and rebuilding from scratch.",
|
|
2600
2900
|
docs: false
|
|
2601
2901
|
},
|
|
2602
2902
|
NUXT_B1014: {
|
|
@@ -2728,6 +3028,11 @@ const headDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
2728
3028
|
why: "`experimental.headNext` is deprecated. CAPO sorting is now the default.",
|
|
2729
3029
|
fix: "Remove `experimental.headNext` from your `nuxt.config`, or set `unhead.legacy: true` to opt out temporarily.",
|
|
2730
3030
|
docs: false
|
|
3031
|
+
},
|
|
3032
|
+
NUXT_B6005: {
|
|
3033
|
+
why: (p) => `Could not resolve \`${p.from}\` used by the auto-import \`${p.name}\`.`,
|
|
3034
|
+
fix: "Check the `from` path in `imports.presets` (or the module that registered this import). Auto-imports from an unresolvable module are silently skipped and can surface as unrelated type errors elsewhere.",
|
|
3035
|
+
docs: false
|
|
2731
3036
|
}
|
|
2732
3037
|
}
|
|
2733
3038
|
});
|
|
@@ -2805,7 +3110,7 @@ const bundlerDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
2805
3110
|
},
|
|
2806
3111
|
NUXT_B7014: {
|
|
2807
3112
|
why: (p) => `The webpack \`${p.name}\` build failed with errors.`,
|
|
2808
|
-
fix: "Fix the build errors listed above. If the errors are unclear, try running `
|
|
3113
|
+
fix: "Fix the build errors listed above. If the errors are unclear, try running `nuxt cleanup` and rebuilding.",
|
|
2809
3114
|
docs: false
|
|
2810
3115
|
},
|
|
2811
3116
|
NUXT_B7015: {
|
|
@@ -2832,8 +3137,18 @@ const bundlerDiagnostics = /* #__PURE__ */ defineDiagnostics({
|
|
|
2832
3137
|
why: "The server webpack build does not externalize dependencies.",
|
|
2833
3138
|
fix: "Externalize dependencies in the server build (`externals`) for better build performance.",
|
|
2834
3139
|
docs: false
|
|
3140
|
+
},
|
|
3141
|
+
NUXT_B7020: {
|
|
3142
|
+
why: "The client build manifest is disabled, but Nuxt requires it to render the correct assets for each route.",
|
|
3143
|
+
fix: "Remove any `build.manifest: false` override from your `nuxt.config` `vite` options or from a Vite plugin `config`/`configEnvironment` hook.",
|
|
3144
|
+
docs: false
|
|
3145
|
+
},
|
|
3146
|
+
NUXT_B7021: {
|
|
3147
|
+
why: (p) => `The client build manifest was expected at \`${p.manifestFile}\` but was not emitted by the client build.`,
|
|
3148
|
+
fix: "Check that no Vite plugin removes or renames the client build manifest in a `generateBundle`/`writeBundle` hook. If this happens with no such plugin, please report it at https://github.com/nuxt/nuxt/issues.",
|
|
3149
|
+
docs: false
|
|
2835
3150
|
}
|
|
2836
3151
|
}
|
|
2837
3152
|
});
|
|
2838
3153
|
//#endregion
|
|
2839
|
-
export { addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildDiagnostics, buildNuxt, bundlerDiagnostics, checkNuxtCompatibility, componentDiagnostics, configDiagnostics, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, headDiagnostics, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, pageDiagnostics, pluginDiagnostics, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
|
3154
|
+
export { DEFAULT_JSX_FILE_EXTENSIONS, DEFAULT_JS_FILE_EXTENSIONS, addBuildPlugin, addComponent, addComponentExports, addComponentsDir, addDevServerHandler, addImports, addImportsDir, addImportsSources, addLayout, addPlugin, addPluginTemplate, addPrerenderRoutes, addRouteMiddleware, addRspackPlugin, addServerHandler, addServerImports, addServerImportsDir, addServerPlugin, addServerScanDir, addServerTemplate, addTemplate, addTypeTemplate, addVitePlugin, addWebpackPlugin, assertNuxtCompatibility, buildDiagnostics, buildNuxt, bundlerDiagnostics, checkNuxtCompatibility, componentDiagnostics, configDiagnostics, createIsIgnored, createResolver, defineNuxtModule, directoryToURL, extendNuxtSchema, extendPages, extendRouteRules, extendRspackConfig, extendViteConfig, extendWebpackConfig, findPath, getDirectory, getLayerDirectories, getNuxtCtx, getNuxtModuleVersion, getNuxtVersion, hasNuxtCompatibility, hasNuxtModule, hasNuxtModuleCompatibility, headDiagnostics, importModule, installModule, installModules, isIgnored, isNuxt2, isNuxt3, isNuxtMajorVersion, loadNuxt, loadNuxtConfig, loadNuxtModuleInstance, logger, normalizeModuleTranspilePath, normalizePlugin, normalizeSemanticVersion, normalizeTemplate, nuxtCtx, packageName, pageDiagnostics, pluginDiagnostics, recoverThrottledChanges, requireModule, resolveAlias, resolveDeclarationPath, resolveFiles, resolveIgnorePatterns, resolveModule, resolveModuleWithOptions, resolveNuxtModule, resolvePath, resolveTypePaths, runWithNuxtContext, setBuildOutput, setGlobalHead, tryImportModule, tryRequireModule, tryResolveModule, tryUseNuxt, updateAppConfig, updateRuntimeConfig, updateTemplates, useLogger, useNitro, useNuxt, useRuntimeConfig, writeTypes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/nuxt__kit",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2-depup.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"consola": "^3.4.2",
|
|
26
26
|
"defu": "^6.1.7",
|
|
27
27
|
"destr": "^2.0.5",
|
|
28
|
-
"errx": "^0.1.
|
|
29
|
-
"exsolve": "^1.1.
|
|
28
|
+
"errx": "^0.1.2",
|
|
29
|
+
"exsolve": "^1.1.1",
|
|
30
30
|
"ignore": "^7.0.6",
|
|
31
31
|
"jiti": "^2.7.0",
|
|
32
32
|
"klona": "^2.0.6",
|
|
@@ -37,23 +37,22 @@
|
|
|
37
37
|
"pkg-types": "^2.3.1",
|
|
38
38
|
"rc9": "^3.0.1",
|
|
39
39
|
"scule": "^1.3.0",
|
|
40
|
-
"semver": "^7.8.5",
|
|
41
40
|
"tinyglobby": "^0.2.17",
|
|
42
41
|
"ufo": "^1.6.4",
|
|
43
42
|
"unctx": "^3.0.0",
|
|
44
|
-
"untyped": "^2.0.0"
|
|
43
|
+
"untyped": "^2.0.0",
|
|
44
|
+
"verkit": "^0.3.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"
|
|
48
|
-
"hookable": "6.1.1",
|
|
49
|
-
"nitro": "3.0.260311-beta",
|
|
47
|
+
"chokidar": "^5.0.0",
|
|
48
|
+
"hookable": "^6.1.1",
|
|
50
49
|
"nitropack": "2.13.4",
|
|
51
|
-
"tsdown": "0.22.
|
|
52
|
-
"unimport": "6.
|
|
53
|
-
"vite": "8.
|
|
50
|
+
"tsdown": "0.22.14",
|
|
51
|
+
"unimport": "^6.4.0",
|
|
52
|
+
"vite": "^8.2.0",
|
|
54
53
|
"vitest": "4.1.10",
|
|
55
|
-
"webpack": "5.
|
|
56
|
-
"@nuxt/schema": "4.5.
|
|
54
|
+
"webpack": "^5.109.2",
|
|
55
|
+
"@nuxt/schema": "4.5.2"
|
|
57
56
|
},
|
|
58
57
|
"engines": {
|
|
59
58
|
"node": ">=18.12.0"
|
|
@@ -76,15 +75,15 @@
|
|
|
76
75
|
"from": "^3.3.4",
|
|
77
76
|
"to": "^4.0.0-beta.5"
|
|
78
77
|
},
|
|
79
|
-
"
|
|
80
|
-
"from": "^
|
|
81
|
-
"to": "^
|
|
78
|
+
"verkit": {
|
|
79
|
+
"from": "^0.3.1",
|
|
80
|
+
"to": "^0.3.2"
|
|
82
81
|
}
|
|
83
82
|
},
|
|
84
83
|
"depsUpdated": 2,
|
|
85
84
|
"originalPackage": "@nuxt/kit",
|
|
86
|
-
"originalVersion": "4.5.
|
|
87
|
-
"processedAt": "2026-
|
|
85
|
+
"originalVersion": "4.5.2",
|
|
86
|
+
"processedAt": "2026-08-05T16:35:04.236Z",
|
|
88
87
|
"smokeTest": "passed"
|
|
89
88
|
}
|
|
90
89
|
}
|