@kimesh/kit 0.2.6 → 0.2.7-nightly.20260123101933

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/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Hookable } from "hookable";
2
2
  import { Ignore } from "ignore";
3
- import * as vite0 from "vite";
3
+ import * as vite3 from "vite";
4
4
  import { Plugin, Plugin as VitePlugin, PluginOption, PluginOption as VitePluginOption, ResolvedConfig, UserConfig, ViteDevServer } from "vite";
5
5
  import { KimeshLayerConfig, LayerAutoImportConfig, LayerComponentConfig, LayerComposableConfig, LayerRouteConfig, ResolvedLayer, ResolvedLayer as ResolvedLayer$1, generateLayerAliases, mergeLayerConfigs, prepareLayers, resolveLayers } from "@kimesh/layers";
6
6
  import { AutoImportConfig, ImportPreset, LayerAutoImportSource as ImportSource, buildImportRegistry, generateDts, kimeshAutoImport, scanExports } from "@kimesh/auto-import";
@@ -138,7 +138,7 @@ interface KimeshHooks {
138
138
  /** Called to extend Vite config before it's resolved */
139
139
  "vite:extend": (ctx: {
140
140
  kimesh: Kimesh;
141
- config: vite0.UserConfig;
141
+ config: vite3.UserConfig;
142
142
  }) => HookResult;
143
143
  /** Called after Vite config is resolved */
144
144
  "vite:configResolved": (config: ResolvedConfig, kimesh: Kimesh) => HookResult;
@@ -448,7 +448,7 @@ interface KimeshPluginDefinition {
448
448
  * Setup function that returns Vite plugin(s)
449
449
  * @param kimesh - Kimesh context
450
450
  */
451
- setup: (kimesh: Kimesh) => vite0.PluginOption | vite0.PluginOption[];
451
+ setup: (kimesh: Kimesh) => vite3.PluginOption | vite3.PluginOption[];
452
452
  }
453
453
  interface KimeshPlugin {
454
454
  /** Plugin definition */
@@ -456,7 +456,7 @@ interface KimeshPlugin {
456
456
  /** Plugin name */
457
457
  name: string;
458
458
  /** Get Vite plugins */
459
- getPlugins: (kimesh: Kimesh) => vite0.PluginOption[];
459
+ getPlugins: (kimesh: Kimesh) => vite3.PluginOption[];
460
460
  }
461
461
  //#endregion
462
462
  //#region src/types/config.d.ts
@@ -2250,7 +2250,7 @@ interface KimeshPluginOptions {
2250
2250
  /**
2251
2251
  * Additional Vite plugins added programmatically.
2252
2252
  */
2253
- additionalPlugins?: vite0.PluginOption[];
2253
+ additionalPlugins?: vite3.PluginOption[];
2254
2254
  }
2255
2255
  //#endregion
2256
2256
  export { type AddRuntimePluginOptions, type AutoImportConfig, type AutoImportOptions, type ComponentsConfig, DEFAULT_ALIASES, DEFAULT_IGNORE_PATTERNS, type DebugConfig, type DiscoveredPlugin, type EnvOptions, type ErrorContext, type FormattedError, type GeneratePluginsTemplateOptions, type HMRContext, type HMRWatcherOptions, type HookResult, type IgnoreOptions, type ImportPreset, type ImportSource, type Kimesh, type KimeshAlias, type KimeshAppContext, type KimeshComponent, type KimeshComponentsDir, type KimeshConfig, type KimeshHooks, type KimeshImport, type KimeshImportPreset, type KimeshImportsDir, type KimeshLayerConfig, type KimeshModule, type KimeshModuleDefaults, type KimeshModuleDefinition, type KimeshModuleInput, type KimeshModuleMeta, type KimeshModuleOptions, type KimeshOptions, type KimeshPlugin, type KimeshPluginDefinition, KimeshPluginOptions, type KimeshRegistries, type KimeshResolver, type KimeshRoute, type KimeshRouteMiddleware, type KimeshRuntimeHooks, type KimeshRuntimePlugin, type KimeshRuntimePluginDefinition, type KimeshRuntimePluginEntry, type KimeshRuntimePluginMeta, type KimeshRuntimePluginResult, type KimeshTemplate, type KimeshTypeTemplate, type KimeshViteConfig, type KimeshVitePluginEntry, type LayerAutoImportConfig, type LayerComponentConfig, type LayerComposableConfig, type LayerRouteConfig, type LayersConfig, type LoadConfigOptions, type PrepareOptions, type PrepareResult, type ResolvedLayer, type ResolvedTemplate, type RouteRule, type RuntimeConfig, type RuntimeConfigPublic, type ScanPluginsOptions, type VitePlugin, type VitePluginOption, addAlias, addBuildPlugin, addComponent, addComponentResolver, addComponentsDir, addImports, addImportsDir, addImportsPreset, addPluginsTemplate, addRuntimePlugin, addTemplate, addTypeTemplate, addVitePlugin, applyEnv, buildAliases, buildImportRegistry, createDebugLogger, createDefaultRuntimeConfig, createHMRWatcher, createIgnoreFilter, createIgnoreMatcher, createKimesh, createResolver, createTimer, debug, debugTable, defineKimeshModule, defineKimeshPlugin, defineKmConfig, envToKey, executeModule, executeModules, filterIgnored, findMatchingRules, formatConflictWarning, formatError, formatTiming, formatWarning, generateDts, generateLayerAliases, generatePluginsTemplate, generateRouteRulesManifest, getIgnorePatterns, getRedirectInfo, getRouteRule, getRuntimePlugins, hasPlugins, hasRuntimePlugin, isDebug, isDebugEnabled, keyToEnv, kimeshAutoImport, kimeshPlugin, loadConfig, matchRoutePattern, mergeLayerConfigs, mergeRouteRules, normalizeDebugConfig, normalizeModuleInput, prepare, prepareLayers, removeRuntimePlugin, resolveAlias, resolveAliasPath, resolveLayers, resolvePathFromBuild, resolvePathFromRoot, scanExports, scanPluginsDir, setDebugConfig, shouldIgnore, toTsConfigPaths, toViteAliases, tryUseKimesh, updateTemplates, useKimesh, writeTemplates };
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import consola from "consola";
8
8
  import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
9
9
  import { dirname, isAbsolute, join, resolve } from "node:path";
10
10
  import fg from "fast-glob";
11
- import { basename, extname, isAbsolute as isAbsolute$1, join as join$1, relative, resolve as resolve$1 } from "pathe";
11
+ import { basename, dirname as dirname$1, extname, isAbsolute as isAbsolute$1, join as join$1, relative, resolve as resolve$1 } from "pathe";
12
12
  import ignore from "ignore";
13
13
  import pc from "picocolors";
14
14
  import { defu } from "defu";
@@ -2163,6 +2163,44 @@ function findWorkspaceRoot(startDir) {
2163
2163
  return startDir;
2164
2164
  }
2165
2165
  /**
2166
+ * Try to resolve a package path from multiple locations
2167
+ * This handles various package manager layouts (npm, pnpm, bun, yarn)
2168
+ */
2169
+ function tryResolvePackage(packageName, fromDir) {
2170
+ const require = createRequire(join$1(fromDir, "package.json"));
2171
+ try {
2172
+ return dirname$1(require.resolve(`${packageName}/package.json`));
2173
+ } catch {
2174
+ const locations = [join$1(fromDir, "node_modules", packageName), join$1(findWorkspaceRoot(fromDir), "node_modules", packageName)];
2175
+ for (const loc of locations) if (existsSync(join$1(loc, "package.json"))) return loc;
2176
+ return null;
2177
+ }
2178
+ }
2179
+ /**
2180
+ * Build aliases for @kimesh/* packages
2181
+ * This ensures Vite can resolve these packages regardless of package manager
2182
+ */
2183
+ function buildKimeshPackageAliases(rootDir, debug$1) {
2184
+ const packages = [
2185
+ "@kimesh/router-runtime",
2186
+ "@kimesh/head",
2187
+ "@kimesh/query",
2188
+ "@kimesh/kit",
2189
+ "@kimesh/layers",
2190
+ "@kimesh/auto-import",
2191
+ "@kimesh/router-generator"
2192
+ ];
2193
+ const aliases = {};
2194
+ for (const pkg of packages) {
2195
+ const resolved = tryResolvePackage(pkg, rootDir);
2196
+ if (resolved) {
2197
+ aliases[pkg] = resolved;
2198
+ if (debug$1) consola.debug(`[Kimesh] Resolved ${pkg} -> ${resolved}`);
2199
+ } else if (debug$1) consola.warn(`[Kimesh] Could not resolve ${pkg}`);
2200
+ }
2201
+ return aliases;
2202
+ }
2203
+ /**
2166
2204
  * Process all configured modules using the new v2 system
2167
2205
  */
2168
2206
  async function processModules(kimesh, debug$1) {
@@ -2300,6 +2338,7 @@ function kimeshPlugin(options = {}) {
2300
2338
  generateModulesTypeDeclaration(config.modules, state.generatedDir);
2301
2339
  await writeTemplates(state.kimesh);
2302
2340
  const userAliases = buildAliases(config, resolvedDirs.srcDir, configRoot);
2341
+ const kimeshPackageAliases = buildKimeshPackageAliases(configRoot, debug$1);
2303
2342
  const moduleAliases = {};
2304
2343
  for (const alias of state.kimesh._registries.aliases) if (typeof alias.find === "string") moduleAliases[alias.find] = alias.replacement;
2305
2344
  const appVuePath = resolve$1(resolvedDirs.srcDir, "app.vue");
@@ -2352,6 +2391,7 @@ function kimeshPlugin(options = {}) {
2352
2391
  __KIMESH_LAYERS_CONFIG__: JSON.stringify(layerConfigMap)
2353
2392
  },
2354
2393
  resolve: { alias: {
2394
+ ...kimeshPackageAliases,
2355
2395
  "#kimesh/routes": join$1(resolvedDirs.buildDir, "routes.gen.ts"),
2356
2396
  "#kimesh/app": existsSync(appVuePath) ? appVuePath : "@kimesh/router-runtime/default-app",
2357
2397
  "#kimesh/context": join$1(resolvedDirs.srcDir, "app.context.ts"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/kit",
3
- "version": "0.2.6",
3
+ "version": "0.2.7-nightly.20260123101933",
4
4
  "description": "Build-time engine for Kimesh framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -30,9 +30,9 @@
30
30
  "vue": "^3.5.0"
31
31
  },
32
32
  "dependencies": {
33
- "@kimesh/auto-import": "0.2.6",
34
- "@kimesh/layers": "0.2.6",
35
- "@kimesh/router-generator": "0.2.6",
33
+ "@kimesh/auto-import": "workspace:*",
34
+ "@kimesh/layers": "workspace:*",
35
+ "@kimesh/router-generator": "workspace:*",
36
36
  "@vitejs/plugin-vue": "^6.0.3",
37
37
  "c12": "^3.3.3",
38
38
  "consola": "^3.4.2",