@nuxt/kit 4.0.1 → 4.0.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/README.md CHANGED
@@ -44,7 +44,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
44
44
  Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
45
45
 
46
46
  ```bash
47
- npm create nuxt <my-project>
47
+ npm create nuxt@latest <my-project>
48
48
  ```
49
49
 
50
50
  > [!TIP]
package/dist/index.mjs CHANGED
@@ -372,10 +372,16 @@ async function resolveNuxtModule(base, paths) {
372
372
  for (const path of paths) {
373
373
  if (path.startsWith(base)) {
374
374
  resolved.push(path.split("/index.ts")[0]);
375
- } else {
376
- const resolvedPath = await resolver.resolvePath(path);
377
- resolved.push(resolvedPath.slice(0, resolvedPath.lastIndexOf(path) + path.length));
375
+ continue;
376
+ }
377
+ const resolvedPath = await resolver.resolvePath(path);
378
+ const dir = parseNodeModulePath(resolvedPath).dir;
379
+ if (dir) {
380
+ resolved.push(dir);
381
+ continue;
378
382
  }
383
+ const index = resolvedPath.lastIndexOf(path);
384
+ resolved.push(index === -1 ? dirname(resolvedPath) : resolvedPath.slice(0, index + path.length));
379
385
  }
380
386
  return resolved;
381
387
  }
@@ -647,7 +653,7 @@ async function loadNuxtConfig(opts) {
647
653
  nuxtConfig.alias ||= {};
648
654
  if (meta?.name) {
649
655
  const alias = `#layers/${meta.name}`;
650
- nuxtConfig.alias[alias] ||= nuxtConfig.rootDir;
656
+ nuxtConfig.alias[alias] ||= withTrailingSlash(nuxtConfig.rootDir);
651
657
  }
652
658
  const defaultBuildDir = join(nuxtConfig.rootDir, ".nuxt");
653
659
  if (!opts.overrides?._prepare && !nuxtConfig.dev && !nuxtConfig.buildDir && existsSync(defaultBuildDir)) {
@@ -681,7 +687,7 @@ async function loadNuxtConfig(opts) {
681
687
  }
682
688
  if (layer.meta?.name) {
683
689
  const alias = `#layers/${layer.meta.name}`;
684
- nuxtConfig.alias[alias] ||= layer.config.rootDir || layer.cwd;
690
+ nuxtConfig.alias[alias] ||= withTrailingSlash(layer.config.rootDir || layer.cwd);
685
691
  }
686
692
  _layers.push(layer);
687
693
  }
@@ -1216,14 +1222,15 @@ async function _generateTypes(nuxt) {
1216
1222
  }
1217
1223
  const moduleEntryPaths = [];
1218
1224
  for (const m of nuxt.options._installedModules) {
1219
- if (m.entryPath) {
1220
- moduleEntryPaths.push(getDirectory(m.entryPath));
1225
+ const path = m.meta?.rawPath || m.entryPath;
1226
+ if (path) {
1227
+ moduleEntryPaths.push(getDirectory(path));
1221
1228
  }
1222
1229
  }
1223
1230
  const modulePaths = await resolveNuxtModule(rootDirWithSlash, moduleEntryPaths);
1224
1231
  for (const path of modulePaths) {
1225
1232
  const relative2 = relativeWithDot(nuxt.options.buildDir, path);
1226
- if (!path.includes("node_modules")) {
1233
+ if (!path.includes("node_modules") && path.startsWith(rootDirWithSlash)) {
1227
1234
  include.add(join(relative2, "runtime"));
1228
1235
  include.add(join(relative2, "dist/runtime"));
1229
1236
  nodeInclude.add(join(relative2, "*.*"));
@@ -1235,6 +1242,7 @@ async function _generateTypes(nuxt) {
1235
1242
  exclude.add(join(relative2, "runtime/server"));
1236
1243
  exclude.add(join(relative2, "dist/runtime/server"));
1237
1244
  exclude.add(join(relative2, "*.*"));
1245
+ exclude.add(join(relative2, "dist/*.*"));
1238
1246
  legacyExclude.add(join(relative2, "runtime/server"));
1239
1247
  legacyExclude.add(join(relative2, "dist/runtime/server"));
1240
1248
  }
@@ -1392,7 +1400,7 @@ async function _generateTypes(nuxt) {
1392
1400
  }
1393
1401
  }
1394
1402
  const relativePath = relativeWithDot(nuxt.options.buildDir, absolutePath);
1395
- if (stats?.isDirectory()) {
1403
+ if (stats?.isDirectory() || aliases[alias].endsWith("/")) {
1396
1404
  tsConfig.compilerOptions.paths[alias] = [relativePath];
1397
1405
  tsConfig.compilerOptions.paths[`${alias}/*`] = [`${relativePath}/*`];
1398
1406
  } else {
@@ -1411,10 +1419,12 @@ async function _generateTypes(nuxt) {
1411
1419
  const pkg = await readPackageJSON(id, { parent }).catch(() => null);
1412
1420
  if (pkg) {
1413
1421
  nodeReferences.push({ types: pkg.name ?? id });
1422
+ references.push({ types: pkg.name ?? id });
1414
1423
  return;
1415
1424
  }
1416
1425
  }
1417
1426
  nodeReferences.push({ types: id });
1427
+ references.push({ types: id });
1418
1428
  }));
1419
1429
  const declarations = [];
1420
1430
  await nuxt.callHook("prepare:types", { references, declarations, tsConfig, nodeTsConfig, nodeReferences, sharedTsConfig, sharedReferences });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -30,7 +30,7 @@
30
30
  "errx": "^0.1.0",
31
31
  "exsolve": "^1.0.7",
32
32
  "ignore": "^7.0.5",
33
- "jiti": "^2.4.2",
33
+ "jiti": "^2.5.1",
34
34
  "klona": "^2.0.6",
35
35
  "mlly": "^1.7.4",
36
36
  "ohash": "^2.0.11",
@@ -42,19 +42,19 @@
42
42
  "tinyglobby": "^0.2.14",
43
43
  "ufo": "^1.6.1",
44
44
  "unctx": "^2.4.1",
45
- "unimport": "^5.1.0",
45
+ "unimport": "^5.2.0",
46
46
  "untyped": "^2.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@rspack/core": "1.4.8",
49
+ "@rspack/core": "1.4.10",
50
50
  "@types/semver": "7.7.0",
51
51
  "hookable": "5.5.3",
52
- "nitropack": "2.12.3",
53
- "unbuild": "3.5.0",
54
- "vite": "7.0.5",
52
+ "nitropack": "2.12.4",
53
+ "unbuild": "3.6.0",
54
+ "vite": "7.0.6",
55
55
  "vitest": "3.2.4",
56
56
  "webpack": "5.99.9",
57
- "@nuxt/schema": "4.0.1"
57
+ "@nuxt/schema": "4.0.2"
58
58
  },
59
59
  "engines": {
60
60
  "node": ">=18.12.0"