@kimesh/kit 0.2.19 → 0.2.20

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 +17 -5
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1728,7 +1728,7 @@ function generateTsConfig(options) {
1728
1728
  }
1729
1729
  }
1730
1730
  const kimeshDir = resolvePackageDir("kimesh", rootDir);
1731
- let viteTypesPath;
1731
+ let viteClientDtsPath;
1732
1732
  if (kimeshDir) {
1733
1733
  const viteDir = resolvePackageDir("vite", kimeshDir);
1734
1734
  if (viteDir) {
@@ -1736,7 +1736,7 @@ function generateTsConfig(options) {
1736
1736
  const normalizedPath = relativeVitePath.startsWith("..") ? relativeVitePath : "./" + relativeVitePath;
1737
1737
  paths["vite"] = [normalizedPath];
1738
1738
  paths["vite/*"] = [`${normalizedPath}/*`];
1739
- viteTypesPath = `${normalizedPath}/client`;
1739
+ viteClientDtsPath = join$1(viteDir, "client.d.ts");
1740
1740
  }
1741
1741
  }
1742
1742
  return {
@@ -1753,10 +1753,10 @@ function generateTsConfig(options) {
1753
1753
  skipLibCheck: true,
1754
1754
  noEmit: true,
1755
1755
  baseUrl: ".",
1756
- paths,
1757
- ...viteTypesPath ? { types: [viteTypesPath] } : {}
1756
+ paths
1758
1757
  },
1759
- include
1758
+ include,
1759
+ _viteClientDtsPath: viteClientDtsPath
1760
1760
  };
1761
1761
  }
1762
1762
  /**
@@ -1768,12 +1768,24 @@ function writeTsConfig(options) {
1768
1768
  const { buildDir } = options;
1769
1769
  mkdirSync(buildDir, { recursive: true });
1770
1770
  const tsconfig = generateTsConfig(options);
1771
+ const viteClientDtsPath = tsconfig._viteClientDtsPath;
1772
+ delete tsconfig._viteClientDtsPath;
1771
1773
  writeFileSync(join$1(buildDir, "tsconfig.json"), JSON.stringify(tsconfig, null, 2), "utf-8");
1774
+ writeFileSync(join$1(buildDir, "vite-env.d.ts"), generateViteEnvDts(viteClientDtsPath, buildDir), "utf-8");
1772
1775
  writeFileSync(join$1(buildDir, "kimesh.d.ts"), generateKimeshDts(), "utf-8");
1773
1776
  writeFileSync(join$1(buildDir, "plugins.d.ts"), generatePluginsDts(), "utf-8");
1774
1777
  writeFileSync(join$1(buildDir, "route-query.d.ts"), generateRouteQueryDts(), "utf-8");
1775
1778
  }
1776
1779
  /**
1780
+ * Generate vite-env.d.ts with reference to vite/client types
1781
+ */
1782
+ function generateViteEnvDts(viteClientDtsPath, buildDir) {
1783
+ if (viteClientDtsPath) return `/// <reference path="${relative(buildDir, viteClientDtsPath)}" />
1784
+ `;
1785
+ return `/// <reference types="vite/client" />
1786
+ `;
1787
+ }
1788
+ /**
1777
1789
  * Generate kimesh.d.ts content with global type declarations
1778
1790
  *
1779
1791
  * This file directly declares global types instead of using triple-slash references,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/kit",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
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.19",
31
- "@kimesh/layers": "0.2.19",
32
- "@kimesh/router-generator": "0.2.19",
30
+ "@kimesh/auto-import": "0.2.20",
31
+ "@kimesh/layers": "0.2.20",
32
+ "@kimesh/router-generator": "0.2.20",
33
33
  "@vitejs/plugin-vue": "^6.0.3",
34
34
  "c12": "^3.3.3",
35
35
  "consola": "^3.4.2",