@nuxt/kit 3.17.7 → 3.18.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 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.d.mts CHANGED
@@ -381,7 +381,7 @@ declare function useNitro(): Nitro;
381
381
  /**
382
382
  * Add server imports to be auto-imported by Nitro
383
383
  */
384
- declare function addServerImports(imports: Import[]): void;
384
+ declare function addServerImports(imports: Import | Import[]): void;
385
385
  /**
386
386
  * Add directories to be scanned for auto-imports by Nitro
387
387
  */
package/dist/index.d.ts CHANGED
@@ -381,7 +381,7 @@ declare function useNitro(): Nitro;
381
381
  /**
382
382
  * Add server imports to be auto-imported by Nitro
383
383
  */
384
- declare function addServerImports(imports: Import[]): void;
384
+ declare function addServerImports(imports: Import | Import[]): void;
385
385
  /**
386
386
  * Add directories to be scanned for auto-imports by Nitro
387
387
  */
package/dist/index.mjs CHANGED
@@ -2372,10 +2372,16 @@ async function resolveNuxtModule(base, paths) {
2372
2372
  for (const path of paths) {
2373
2373
  if (path.startsWith(base)) {
2374
2374
  resolved.push(path.split("/index.ts")[0]);
2375
- } else {
2376
- const resolvedPath = await resolver.resolvePath(path);
2377
- resolved.push(resolvedPath.slice(0, resolvedPath.lastIndexOf(path) + path.length));
2375
+ continue;
2376
+ }
2377
+ const resolvedPath = await resolver.resolvePath(path);
2378
+ const dir = parseNodeModulePath(resolvedPath).dir;
2379
+ if (dir) {
2380
+ resolved.push(dir);
2381
+ continue;
2378
2382
  }
2383
+ const index = resolvedPath.lastIndexOf(path);
2384
+ resolved.push(index === -1 ? dirname(resolvedPath) : resolvedPath.slice(0, index + path.length));
2379
2385
  }
2380
2386
  return resolved;
2381
2387
  }
@@ -2638,7 +2644,7 @@ async function loadNuxtConfig(opts) {
2638
2644
  nuxtConfig.alias ||= {};
2639
2645
  if (meta?.name) {
2640
2646
  const alias = `#layers/${meta.name}`;
2641
- nuxtConfig.alias[alias] ||= nuxtConfig.rootDir;
2647
+ nuxtConfig.alias[alias] ||= withTrailingSlash(nuxtConfig.rootDir);
2642
2648
  }
2643
2649
  const defaultBuildDir = join(nuxtConfig.rootDir, ".nuxt");
2644
2650
  if (!opts.overrides?._prepare && !nuxtConfig.dev && !nuxtConfig.buildDir && nuxtConfig.future?.compatibilityVersion === 4 && existsSync(defaultBuildDir)) {
@@ -2672,7 +2678,7 @@ async function loadNuxtConfig(opts) {
2672
2678
  }
2673
2679
  if (layer.meta?.name) {
2674
2680
  const alias = `#layers/${layer.meta.name}`;
2675
- nuxtConfig.alias[alias] ||= layer.config.rootDir || layer.cwd;
2681
+ nuxtConfig.alias[alias] ||= withTrailingSlash(layer.config.rootDir || layer.cwd);
2676
2682
  }
2677
2683
  _layers.push(layer);
2678
2684
  }
@@ -2817,10 +2823,11 @@ function useNitro() {
2817
2823
  }
2818
2824
  function addServerImports(imports) {
2819
2825
  const nuxt = useNuxt();
2826
+ const _imports = toArray(imports);
2820
2827
  nuxt.hook("nitro:config", (config) => {
2821
2828
  config.imports ||= {};
2822
2829
  config.imports.imports ||= [];
2823
- config.imports.imports.push(...imports);
2830
+ config.imports.imports.push(..._imports);
2824
2831
  });
2825
2832
  }
2826
2833
  function addServerImportsDir(dirs, opts = {}) {
@@ -2889,7 +2896,7 @@ function applyEnv(obj, opts, parentKey = "") {
2889
2896
  }
2890
2897
  return obj;
2891
2898
  }
2892
- const envExpandRx = /\{\{(.*?)\}\}/g;
2899
+ const envExpandRx = /\{\{([^{}]*)\}\}/g;
2893
2900
  function _expandFromEnv(value, env = process$1.env) {
2894
2901
  return value.replace(envExpandRx, (match, key) => {
2895
2902
  return env[key] || match;
@@ -3162,8 +3169,9 @@ async function _generateTypes(nuxt) {
3162
3169
  }
3163
3170
  const moduleEntryPaths = [];
3164
3171
  for (const m of nuxt.options._installedModules) {
3165
- if (m.entryPath) {
3166
- moduleEntryPaths.push(getDirectory(m.entryPath));
3172
+ const path = m.meta?.rawPath || m.entryPath;
3173
+ if (path) {
3174
+ moduleEntryPaths.push(getDirectory(path));
3167
3175
  }
3168
3176
  }
3169
3177
  const modulePaths = await resolveNuxtModule(rootDirWithSlash, moduleEntryPaths);
@@ -3265,7 +3273,7 @@ async function _generateTypes(nuxt) {
3265
3273
  }
3266
3274
  }
3267
3275
  const relativePath = relativeWithDot(nuxt.options.buildDir, absolutePath);
3268
- if (stats?.isDirectory()) {
3276
+ if (stats?.isDirectory() || aliases[alias].endsWith("/")) {
3269
3277
  tsConfig.compilerOptions.paths[alias] = [relativePath];
3270
3278
  tsConfig.compilerOptions.paths[`${alias}/*`] = [`${relativePath}/*`];
3271
3279
  if (!absolutePath.startsWith(rootDirWithSlash)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit",
3
- "version": "3.17.7",
3
+ "version": "3.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,14 +23,14 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "c12": "^3.0.4",
26
+ "c12": "^3.1.0",
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.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
  "knitwork": "^1.2.0",
36
36
  "mlly": "^1.7.4",
@@ -43,21 +43,21 @@
43
43
  "tinyglobby": "^0.2.14",
44
44
  "ufo": "^1.6.1",
45
45
  "unctx": "^2.4.1",
46
- "unimport": "^5.1.0",
46
+ "unimport": "^5.2.0",
47
47
  "untyped": "^2.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@rspack/core": "1.4.6",
50
+ "@rspack/core": "1.4.10",
51
51
  "@types/lodash-es": "4.17.12",
52
52
  "@types/semver": "7.7.0",
53
53
  "hookable": "5.5.3",
54
54
  "lodash-es": "4.17.21",
55
- "nitropack": "2.11.13",
56
- "unbuild": "3.5.0",
57
- "vite": "6.3.5",
55
+ "nitropack": "2.12.4",
56
+ "unbuild": "3.6.0",
57
+ "vite": "7.0.6",
58
58
  "vitest": "3.2.4",
59
59
  "webpack": "5.99.9",
60
- "@nuxt/schema": "3.17.7"
60
+ "@nuxt/schema": "3.18.0"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=18.12.0"