@nuxt/kit 4.0.0-0 → 4.0.0-alpha.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 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +15 -18
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { WebpackPluginInstance, Configuration } from 'webpack';
|
|
|
6
6
|
import { RspackPluginInstance } from '@rspack/core';
|
|
7
7
|
import { Plugin, UserConfig } from 'vite';
|
|
8
8
|
import * as unctx from 'unctx';
|
|
9
|
-
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from '
|
|
9
|
+
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
|
|
10
10
|
import * as consola from 'consola';
|
|
11
11
|
import { ConsolaOptions } from 'consola';
|
|
12
12
|
|
|
@@ -372,7 +372,7 @@ declare function useNitro(): Nitro;
|
|
|
372
372
|
/**
|
|
373
373
|
* Add server imports to be auto-imported by Nitro
|
|
374
374
|
*/
|
|
375
|
-
declare function addServerImports(imports: Import[]): void;
|
|
375
|
+
declare function addServerImports(imports: Import | Import[]): void;
|
|
376
376
|
/**
|
|
377
377
|
* Add directories to be scanned for auto-imports by Nitro
|
|
378
378
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { WebpackPluginInstance, Configuration } from 'webpack';
|
|
|
6
6
|
import { RspackPluginInstance } from '@rspack/core';
|
|
7
7
|
import { Plugin, UserConfig } from 'vite';
|
|
8
8
|
import * as unctx from 'unctx';
|
|
9
|
-
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from '
|
|
9
|
+
import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
|
|
10
10
|
import * as consola from 'consola';
|
|
11
11
|
import { ConsolaOptions } from 'consola';
|
|
12
12
|
|
|
@@ -372,7 +372,7 @@ declare function useNitro(): Nitro;
|
|
|
372
372
|
/**
|
|
373
373
|
* Add server imports to be auto-imported by Nitro
|
|
374
374
|
*/
|
|
375
|
-
declare function addServerImports(imports: Import[]): void;
|
|
375
|
+
declare function addServerImports(imports: Import | Import[]): void;
|
|
376
376
|
/**
|
|
377
377
|
* Add directories to be scanned for auto-imports by Nitro
|
|
378
378
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -457,8 +457,8 @@ async function _resolvePathGranularly(path, opts = {}) {
|
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
459
|
async function existsSensitive(path) {
|
|
460
|
-
const dirFiles = await promises.readdir(dirname(path)).catch(() =>
|
|
461
|
-
return dirFiles
|
|
460
|
+
const dirFiles = new Set(await promises.readdir(dirname(path)).catch(() => []));
|
|
461
|
+
return dirFiles.has(basename(path));
|
|
462
462
|
}
|
|
463
463
|
function existsInVFS(path, nuxt = tryUseNuxt()) {
|
|
464
464
|
if (!nuxt) {
|
|
@@ -635,8 +635,8 @@ async function loadNuxtConfig(opts) {
|
|
|
635
635
|
extend: { extendKey: ["theme", "_extends", "extends"] },
|
|
636
636
|
dotenv: true,
|
|
637
637
|
globalRc: true,
|
|
638
|
+
// @ts-expect-error TODO: fix type in c12, it should accept createDefu directly
|
|
638
639
|
merger,
|
|
639
|
-
// TODO: fix type in c12, it should accept createDefu directly
|
|
640
640
|
...opts
|
|
641
641
|
});
|
|
642
642
|
delete globalSelf.defineNuxtConfig;
|
|
@@ -663,6 +663,7 @@ async function loadNuxtConfig(opts) {
|
|
|
663
663
|
}
|
|
664
664
|
const _layers = [];
|
|
665
665
|
const processedLayers = /* @__PURE__ */ new Set();
|
|
666
|
+
const localRelativePaths = new Set(localLayers);
|
|
666
667
|
for (const layer of layers) {
|
|
667
668
|
layer.config ||= {};
|
|
668
669
|
layer.config.rootDir ??= layer.cwd;
|
|
@@ -674,7 +675,7 @@ async function loadNuxtConfig(opts) {
|
|
|
674
675
|
if (!layer.configFile || layer.configFile.endsWith(".nuxtrc")) {
|
|
675
676
|
continue;
|
|
676
677
|
}
|
|
677
|
-
if (layer.cwd && cwd &&
|
|
678
|
+
if (layer.cwd && cwd && localRelativePaths.has(relative(cwd, layer.cwd))) {
|
|
678
679
|
layer.meta ||= {};
|
|
679
680
|
layer.meta.name ||= basename(layer.cwd);
|
|
680
681
|
}
|
|
@@ -701,7 +702,7 @@ async function loadNuxtSchema(cwd) {
|
|
|
701
702
|
const urls = [url];
|
|
702
703
|
const nuxtPath = resolveModuleURL("nuxt", { try: true, from: url }) ?? resolveModuleURL("nuxt-nightly", { try: true, from: url });
|
|
703
704
|
if (nuxtPath) {
|
|
704
|
-
urls.unshift(
|
|
705
|
+
urls.unshift(nuxtPath);
|
|
705
706
|
}
|
|
706
707
|
const schemaPath = resolveModuleURL("@nuxt/schema", { try: true, from: urls }) ?? "@nuxt/schema";
|
|
707
708
|
return await import(schemaPath).then((r) => r.NuxtConfigSchema);
|
|
@@ -793,10 +794,11 @@ function useNitro() {
|
|
|
793
794
|
}
|
|
794
795
|
function addServerImports(imports) {
|
|
795
796
|
const nuxt = useNuxt();
|
|
797
|
+
const _imports = toArray(imports);
|
|
796
798
|
nuxt.hook("nitro:config", (config) => {
|
|
797
799
|
config.imports ||= {};
|
|
798
800
|
config.imports.imports ||= [];
|
|
799
|
-
config.imports.imports.push(...
|
|
801
|
+
config.imports.imports.push(..._imports);
|
|
800
802
|
});
|
|
801
803
|
}
|
|
802
804
|
function addServerImportsDir(dirs, opts = {}) {
|
|
@@ -1144,7 +1146,6 @@ async function _generateTypes(nuxt) {
|
|
|
1144
1146
|
include.add(join(relative2, "dist/runtime"));
|
|
1145
1147
|
exclude.add(join(relative2, "dist/runtime/server"));
|
|
1146
1148
|
}
|
|
1147
|
-
const isV4 = nuxt.options.future?.compatibilityVersion === 4;
|
|
1148
1149
|
const nestedModulesDirs = [];
|
|
1149
1150
|
for (const dir of [...nuxt.options.modulesDir].sort()) {
|
|
1150
1151
|
const withSlash = withTrailingSlash(dir);
|
|
@@ -1156,7 +1157,7 @@ async function _generateTypes(nuxt) {
|
|
|
1156
1157
|
for (const parent of nestedModulesDirs) {
|
|
1157
1158
|
hasTypescriptVersionWithModulePreserve ??= await readPackageJSON("typescript", { parent }).then((r) => r?.version && gte(r.version, "5.4.0")).catch(() => void 0);
|
|
1158
1159
|
}
|
|
1159
|
-
hasTypescriptVersionWithModulePreserve ??=
|
|
1160
|
+
hasTypescriptVersionWithModulePreserve ??= true;
|
|
1160
1161
|
const useDecorators = Boolean(nuxt.options.experimental?.decorators);
|
|
1161
1162
|
const tsConfig = defu(nuxt.options.typescript?.tsConfig, {
|
|
1162
1163
|
compilerOptions: {
|
|
@@ -1171,7 +1172,7 @@ async function _generateTypes(nuxt) {
|
|
|
1171
1172
|
verbatimModuleSyntax: true,
|
|
1172
1173
|
/* Strictness */
|
|
1173
1174
|
strict: nuxt.options.typescript?.strict ?? true,
|
|
1174
|
-
noUncheckedIndexedAccess:
|
|
1175
|
+
noUncheckedIndexedAccess: true,
|
|
1175
1176
|
forceConsistentCasingInFileNames: true,
|
|
1176
1177
|
noImplicitOverride: true,
|
|
1177
1178
|
/* Decorator support */
|
|
@@ -1300,15 +1301,11 @@ async function _generateTypes(nuxt) {
|
|
|
1300
1301
|
}
|
|
1301
1302
|
async function writeTypes(nuxt) {
|
|
1302
1303
|
const { tsConfig, declaration } = await _generateTypes(nuxt);
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
const declarationPath = resolve(nuxt.options.buildDir, "nuxt.d.ts");
|
|
1309
|
-
await promises.writeFile(declarationPath, GeneratedBy + "\n" + declaration);
|
|
1310
|
-
}
|
|
1311
|
-
await writeFile();
|
|
1304
|
+
const tsConfigPath = resolve(nuxt.options.buildDir, "tsconfig.json");
|
|
1305
|
+
await promises.mkdir(nuxt.options.buildDir, { recursive: true });
|
|
1306
|
+
await promises.writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2));
|
|
1307
|
+
const declarationPath = resolve(nuxt.options.buildDir, "nuxt.d.ts");
|
|
1308
|
+
await promises.writeFile(declarationPath, declaration);
|
|
1312
1309
|
}
|
|
1313
1310
|
function sortTsPaths(paths) {
|
|
1314
1311
|
for (const pathKey in paths) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/kit",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"c12": "^3.0.
|
|
26
|
+
"c12": "^3.0.4",
|
|
27
27
|
"consola": "^3.4.2",
|
|
28
28
|
"defu": "^6.1.4",
|
|
29
29
|
"destr": "^2.0.5",
|
|
30
30
|
"errx": "^0.1.0",
|
|
31
31
|
"exsolve": "^1.0.5",
|
|
32
|
-
"ignore": "^7.0.
|
|
32
|
+
"ignore": "^7.0.5",
|
|
33
33
|
"jiti": "^2.4.2",
|
|
34
34
|
"klona": "^2.0.6",
|
|
35
35
|
"mlly": "^1.7.4",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"scule": "^1.3.0",
|
|
40
40
|
"semver": "^7.7.2",
|
|
41
41
|
"std-env": "^3.9.0",
|
|
42
|
-
"tinyglobby": "^0.2.
|
|
42
|
+
"tinyglobby": "^0.2.14",
|
|
43
43
|
"ufo": "^1.6.1",
|
|
44
44
|
"unctx": "^2.4.1",
|
|
45
45
|
"unimport": "^5.0.1",
|
|
46
46
|
"untyped": "^2.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@rspack/core": "1.3.
|
|
49
|
+
"@rspack/core": "1.3.15",
|
|
50
50
|
"@types/semver": "7.7.0",
|
|
51
51
|
"hookable": "5.5.3",
|
|
52
|
-
"
|
|
52
|
+
"nitropack": "2.11.12",
|
|
53
53
|
"unbuild": "3.5.0",
|
|
54
54
|
"vite": "6.3.5",
|
|
55
|
-
"vitest": "3.
|
|
56
|
-
"webpack": "5.99.
|
|
57
|
-
"@nuxt/schema": "4.0.0-
|
|
55
|
+
"vitest": "3.2.3",
|
|
56
|
+
"webpack": "5.99.9",
|
|
57
|
+
"@nuxt/schema": "4.0.0-alpha.2"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=18.12.0"
|