@kimesh/kit 0.2.32 → 0.2.33

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 +26 -2
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { klona } from "klona/json";
5
5
  import destr from "destr";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
7
  import consola from "consola";
8
- import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
8
+ import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
9
9
  import { dirname, isAbsolute, join, resolve } from "node:path";
10
10
  import fg from "fast-glob";
11
11
  import { basename, dirname as dirname$1, extname, isAbsolute as isAbsolute$1, join as join$1, normalize, relative, resolve as resolve$1 } from "pathe";
@@ -2775,7 +2775,21 @@ function layerAliasPlugin(options) {
2775
2775
  if (aliasKey && moduleAliases[aliasKey]) {
2776
2776
  const relativePath = id.slice(2);
2777
2777
  const resolved = join$1(moduleAliases[aliasKey], relativePath);
2778
- if (existsSync(resolved)) return resolved;
2778
+ if (existsSync(resolved)) {
2779
+ try {
2780
+ if (statSync(resolved).isDirectory()) for (const indexFile of [
2781
+ "index.ts",
2782
+ "index.js",
2783
+ "index.vue",
2784
+ "index.mjs",
2785
+ "index.mts"
2786
+ ]) {
2787
+ const indexPath = join$1(resolved, indexFile);
2788
+ if (existsSync(indexPath)) return indexPath;
2789
+ }
2790
+ } catch {}
2791
+ return resolved;
2792
+ }
2779
2793
  for (const ext of [
2780
2794
  ".ts",
2781
2795
  ".js",
@@ -2788,6 +2802,16 @@ function layerAliasPlugin(options) {
2788
2802
  const withExt = resolved + ext;
2789
2803
  if (existsSync(withExt)) return withExt;
2790
2804
  }
2805
+ for (const indexFile of [
2806
+ "index.ts",
2807
+ "index.js",
2808
+ "index.vue",
2809
+ "index.mjs",
2810
+ "index.mts"
2811
+ ]) {
2812
+ const indexPath = join$1(resolved, indexFile);
2813
+ if (existsSync(indexPath)) return indexPath;
2814
+ }
2791
2815
  return resolved;
2792
2816
  }
2793
2817
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/kit",
3
- "version": "0.2.32",
3
+ "version": "0.2.33",
4
4
  "description": "Build-time engine for Kimesh framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "test:watch": "vitest"
28
28
  },
29
29
  "dependencies": {
30
- "@kimesh/auto-import": "0.2.32",
31
- "@kimesh/layers": "0.2.32",
32
- "@kimesh/router-generator": "0.2.32",
30
+ "@kimesh/auto-import": "0.2.33",
31
+ "@kimesh/layers": "0.2.33",
32
+ "@kimesh/router-generator": "0.2.33",
33
33
  "@vitejs/plugin-vue": "^6.0.3",
34
34
  "c12": "^3.3.3",
35
35
  "consola": "^3.4.2",