@nuxt/kit-nightly 4.4.7-29652037.eb785fd0 → 4.4.7-29673425.78b1e698

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.
Files changed (2) hide show
  1. package/dist/index.mjs +19 -6
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -1297,7 +1297,20 @@ function resolveLayerPaths(dirs, projectBuildDir) {
1297
1297
  globalDeclarations: [join(relativeRootDir, `*.d.ts`), join(relativeRootDir, `layers/*/*.d.ts`)]
1298
1298
  };
1299
1299
  }
1300
- const EXTENSION_RE = /\b(?:\.d\.[cm]?ts|\.\w+)$/g;
1300
+ const STRIPPABLE_EXT_RE = /\b\.(?:d\.ts|tsx?|jsx?)$/;
1301
+ const RUNTIME_EXT_RE = /\.([cm])(?:ts|js)$/;
1302
+ async function getPathSubstitution(absolutePath, buildDir) {
1303
+ const stripped = absolutePath.replace(STRIPPABLE_EXT_RE, "");
1304
+ if (stripped !== absolutePath) return relativeWithDot(buildDir, stripped);
1305
+ const runtimeMatch = absolutePath.match(RUNTIME_EXT_RE);
1306
+ if (runtimeMatch) {
1307
+ const base = absolutePath.slice(0, -runtimeMatch[0].length);
1308
+ if (await promises.stat(`${base}.d.ts`).then((s) => s.isFile(), () => false)) return relativeWithDot(buildDir, base);
1309
+ const declaration = `${base}.d.${runtimeMatch[1]}ts`;
1310
+ if (await promises.stat(declaration).then((s) => s.isFile(), () => false)) return relativeWithDot(buildDir, declaration);
1311
+ }
1312
+ return relativeWithDot(buildDir, absolutePath);
1313
+ }
1301
1314
  const excludedAlias = [/^@vue\/.*$/, /^#internal\/nuxt/];
1302
1315
  async function _generateTypes(nuxt) {
1303
1316
  const include = new Set(["./nuxt.d.ts"]);
@@ -1379,7 +1392,7 @@ async function _generateTypes(nuxt) {
1379
1392
  legacyExclude.add(join(relative, "dist/runtime/server"));
1380
1393
  }
1381
1394
  const nestedModulesDirs = [];
1382
- for (const dir of [...nuxt.options.modulesDir].sort()) {
1395
+ for (const dir of nuxt.options.modulesDir.toSorted()) {
1383
1396
  const withSlash = withTrailingSlash$1(dir);
1384
1397
  if (nestedModulesDirs.every((d) => !d.startsWith(withSlash))) nestedModulesDirs.push(withSlash);
1385
1398
  }
@@ -1387,6 +1400,7 @@ async function _generateTypes(nuxt) {
1387
1400
  for (const parent of nestedModulesDirs) hasTypescriptVersionWithModulePreserve ??= await readPackageJSON("typescript", { parent }).then((r) => r?.version && gte(r.version, "5.4.0")).catch(() => void 0);
1388
1401
  hasTypescriptVersionWithModulePreserve ??= true;
1389
1402
  const useDecorators = Boolean(nuxt.options.experimental?.decorators);
1403
+ const userExclude = nuxt.options.typescript?.tsConfig?.exclude ?? [];
1390
1404
  const tsConfig = defu(nuxt.options.typescript?.tsConfig, {
1391
1405
  compilerOptions: {
1392
1406
  esModuleInterop: true,
@@ -1510,7 +1524,7 @@ async function _generateTypes(nuxt) {
1510
1524
  tsConfig.compilerOptions.paths[alias] = [relativePath];
1511
1525
  tsConfig.compilerOptions.paths[`${alias}/*`] = [`${relativePath}/*`];
1512
1526
  } else {
1513
- const path = stats?.isFile() ? relativePath.replace(EXTENSION_RE, "") : aliases[alias];
1527
+ const path = stats?.isFile() ? await getPathSubstitution(absolutePath, nuxt.options.buildDir) : aliases[alias];
1514
1528
  tsConfig.compilerOptions.paths[alias] = [path];
1515
1529
  }
1516
1530
  }
@@ -1543,15 +1557,14 @@ async function _generateTypes(nuxt) {
1543
1557
  const legacyTsConfig = defu({}, {
1544
1558
  ...tsConfig,
1545
1559
  include: [...tsConfig.include, ...legacyInclude],
1546
- exclude: [...tsConfig.exclude, ...legacyExclude]
1560
+ exclude: [...userExclude, ...legacyExclude]
1547
1561
  });
1548
1562
  async function resolveConfig(tsConfig) {
1549
1563
  for (const alias in tsConfig.compilerOptions.paths) {
1550
1564
  const paths = tsConfig.compilerOptions.paths[alias];
1551
1565
  tsConfig.compilerOptions.paths[alias] = [...new Set(await Promise.all(paths.map(async (path) => {
1552
1566
  if (!isAbsolute(path)) return path;
1553
- const stats = await promises.stat(path).catch(() => null);
1554
- return relativeWithDot(nuxt.options.buildDir, stats?.isFile() ? path.replace(EXTENSION_RE, "") : path);
1567
+ return (await promises.stat(path).catch(() => null))?.isFile() ? getPathSubstitution(path, nuxt.options.buildDir) : relativeWithDot(nuxt.options.buildDir, path);
1555
1568
  })))];
1556
1569
  }
1557
1570
  sortTsPaths(tsConfig.compilerOptions.paths);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/kit-nightly",
3
- "version": "4.4.7-29652037.eb785fd0",
3
+ "version": "4.4.7-29673425.78b1e698",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -34,24 +34,24 @@
34
34
  "pkg-types": "^2.3.1",
35
35
  "rc9": "^3.0.1",
36
36
  "scule": "^1.3.0",
37
- "semver": "^7.8.0",
38
- "tinyglobby": "^0.2.16",
37
+ "semver": "^7.8.1",
38
+ "tinyglobby": "^0.2.17",
39
39
  "ufo": "^1.6.4",
40
40
  "unctx": "^2.5.0",
41
41
  "untyped": "^2.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.7-29652037.eb785fd0",
44
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.7-29673425.78b1e698",
45
45
  "@rspack/core": "1.7.11",
46
46
  "@types/semver": "7.7.1",
47
47
  "hookable": "6.1.1",
48
48
  "nitro": "3.0.260311-beta",
49
49
  "nitropack": "2.13.4",
50
- "obuild": "0.4.35",
50
+ "obuild": "0.4.36",
51
51
  "unimport": "6.3.0",
52
52
  "vite": "7.3.3",
53
- "vitest": "4.1.6",
54
- "webpack": "5.106.2"
53
+ "vitest": "4.1.7",
54
+ "webpack": "5.107.2"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=18.12.0"