@kimesh/kit 0.2.5 → 0.2.6-nightly.20260123095416

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
@@ -2552,12 +2552,34 @@ function kimeshPlugin(options = {}) {
2552
2552
  //#endregion
2553
2553
  //#region src/config.ts
2554
2554
  /**
2555
+ * Wrap a function with defineKmConfig injected into globalThis.
2556
+ * This allows kimesh.config.ts to use defineKmConfig without explicit import (like Nuxt).
2557
+ *
2558
+ * @internal
2559
+ */
2560
+ async function withDefineKmConfig(fn) {
2561
+ const key = "defineKmConfig";
2562
+ const globalSelf = globalThis;
2563
+ if (!globalSelf[key]) {
2564
+ globalSelf[key] = defineKmConfig;
2565
+ globalSelf[key].count = 0;
2566
+ }
2567
+ globalSelf[key].count++;
2568
+ try {
2569
+ return await fn();
2570
+ } finally {
2571
+ globalSelf[key].count--;
2572
+ if (!globalSelf[key].count) delete globalSelf[key];
2573
+ }
2574
+ }
2575
+ /**
2555
2576
  * Load kimesh.config.ts using c12
2556
2577
  */
2557
2578
  async function loadConfig(options = {}) {
2558
- const { config, configFile } = await loadConfig$1({
2579
+ const root = options.root || process.cwd();
2580
+ const { config, configFile } = await withDefineKmConfig(() => loadConfig$1({
2559
2581
  name: "kimesh",
2560
- cwd: options.root || process.cwd(),
2582
+ cwd: root,
2561
2583
  configFile: options.configFile,
2562
2584
  defaultConfig: {
2563
2585
  name: "kimesh-app",
@@ -2566,7 +2588,7 @@ async function loadConfig(options = {}) {
2566
2588
  host: "localhost"
2567
2589
  }
2568
2590
  }
2569
- });
2591
+ }));
2570
2592
  if (configFile) consola.debug(`[Kimesh] Config loaded from: ${configFile}`);
2571
2593
  return config || {};
2572
2594
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/kit",
3
- "version": "0.2.5",
3
+ "version": "0.2.6-nightly.20260123095416",
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.5",
34
- "@kimesh/layers": "0.2.5",
35
- "@kimesh/router-generator": "0.2.5",
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",