@nuxt/kit 4.0.0-0 → 4.0.0-alpha.1

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 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 'nitro/types';
9
+ import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
10
10
  import * as consola from 'consola';
11
11
  import { ConsolaOptions } from 'consola';
12
12
 
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 'nitro/types';
9
+ import { NitroRouteConfig, NitroEventHandler, NitroDevEventHandler, Nitro } from 'nitropack/types';
10
10
  import * as consola from 'consola';
11
11
  import { ConsolaOptions } from 'consola';
12
12
 
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(() => null);
461
- return dirFiles && dirFiles.includes(basename(path));
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 && localLayers.includes(relative(cwd, layer.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
  }
@@ -1144,7 +1145,6 @@ async function _generateTypes(nuxt) {
1144
1145
  include.add(join(relative2, "dist/runtime"));
1145
1146
  exclude.add(join(relative2, "dist/runtime/server"));
1146
1147
  }
1147
- const isV4 = nuxt.options.future?.compatibilityVersion === 4;
1148
1148
  const nestedModulesDirs = [];
1149
1149
  for (const dir of [...nuxt.options.modulesDir].sort()) {
1150
1150
  const withSlash = withTrailingSlash(dir);
@@ -1156,7 +1156,7 @@ async function _generateTypes(nuxt) {
1156
1156
  for (const parent of nestedModulesDirs) {
1157
1157
  hasTypescriptVersionWithModulePreserve ??= await readPackageJSON("typescript", { parent }).then((r) => r?.version && gte(r.version, "5.4.0")).catch(() => void 0);
1158
1158
  }
1159
- hasTypescriptVersionWithModulePreserve ??= isV4;
1159
+ hasTypescriptVersionWithModulePreserve ??= true;
1160
1160
  const useDecorators = Boolean(nuxt.options.experimental?.decorators);
1161
1161
  const tsConfig = defu(nuxt.options.typescript?.tsConfig, {
1162
1162
  compilerOptions: {
@@ -1171,7 +1171,7 @@ async function _generateTypes(nuxt) {
1171
1171
  verbatimModuleSyntax: true,
1172
1172
  /* Strictness */
1173
1173
  strict: nuxt.options.typescript?.strict ?? true,
1174
- noUncheckedIndexedAccess: isV4,
1174
+ noUncheckedIndexedAccess: true,
1175
1175
  forceConsistentCasingInFileNames: true,
1176
1176
  noImplicitOverride: true,
1177
1177
  /* Decorator support */
@@ -1300,15 +1300,11 @@ async function _generateTypes(nuxt) {
1300
1300
  }
1301
1301
  async function writeTypes(nuxt) {
1302
1302
  const { tsConfig, declaration } = await _generateTypes(nuxt);
1303
- async function writeFile() {
1304
- const GeneratedBy = "// Generated by nuxi";
1305
- const tsConfigPath = resolve(nuxt.options.buildDir, "tsconfig.json");
1306
- await promises.mkdir(nuxt.options.buildDir, { recursive: true });
1307
- await promises.writeFile(tsConfigPath, GeneratedBy + "\n" + JSON.stringify(tsConfig, null, 2));
1308
- const declarationPath = resolve(nuxt.options.buildDir, "nuxt.d.ts");
1309
- await promises.writeFile(declarationPath, GeneratedBy + "\n" + declaration);
1310
- }
1311
- await writeFile();
1303
+ const tsConfigPath = resolve(nuxt.options.buildDir, "tsconfig.json");
1304
+ await promises.mkdir(nuxt.options.buildDir, { recursive: true });
1305
+ await promises.writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2));
1306
+ const declarationPath = resolve(nuxt.options.buildDir, "nuxt.d.ts");
1307
+ await promises.writeFile(declarationPath, declaration);
1312
1308
  }
1313
1309
  function sortTsPaths(paths) {
1314
1310
  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-0",
3
+ "version": "4.0.0-alpha.1",
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.3",
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.4",
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.13",
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.9",
49
+ "@rspack/core": "1.3.13",
50
50
  "@types/semver": "7.7.0",
51
51
  "hookable": "5.5.3",
52
- "nitro": "npm:nitro-nightly@3.0.0-20250506-085946.5cc05779",
52
+ "nitropack": "2.11.12",
53
53
  "unbuild": "3.5.0",
54
54
  "vite": "6.3.5",
55
- "vitest": "3.1.3",
55
+ "vitest": "3.2.0",
56
56
  "webpack": "5.99.8",
57
- "@nuxt/schema": "4.0.0-0"
57
+ "@nuxt/schema": "4.0.0-alpha.1"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=18.12.0"