@kimesh/auto-import 0.1.0-nightly.20260119170404 → 0.1.0-nightly.20260119171158

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.
@@ -610,5 +610,4 @@ var RegistryBuilder = class {
610
610
  };
611
611
 
612
612
  //#endregion
613
- export { piniaPreset as a, vuePreset as c, collectExistingDirectories as d, normalizePreset as i, vueRouterPreset as l, builtinPresets as n, resolvePresets as o, kimeshPreset as r, tanstackQueryPreset as s, RegistryBuilder as t, ConflictResolver as u };
614
- //# sourceMappingURL=builder-c6-47OHx.mjs.map
613
+ export { piniaPreset as a, vuePreset as c, collectExistingDirectories as d, normalizePreset as i, vueRouterPreset as l, builtinPresets as n, resolvePresets as o, kimeshPreset as r, tanstackQueryPreset as s, RegistryBuilder as t, ConflictResolver as u };
package/dist/index.d.mts CHANGED
@@ -413,5 +413,4 @@ declare function buildImportRegistry(sources: LayerAutoImportSource[]): Promise<
413
413
  */
414
414
  declare function scanExports(filePath: string): Promise<ScanResult>;
415
415
  //#endregion
416
- export { type AutoImportConfig, type AutoImportPluginOptions, type ConflictReport, ConflictResolver, type ExportInfo, type ImportEntry, ImportInjector, type ImportPreset, type ImportRegistry, type InjectionResult, type KimeshResolverOptions, type LayerAutoImportSource, OxcExportScanner, ReferenceDetector, RegistryBuilder, type ResolvedLayerInfo, type ScanResult, type ScriptPluginOptions, type TemplatePluginOptions, type TransformResult, type UnresolvedReference, autoImportPlugin, autoImportPlugin as default, buildImportRegistry, builtinPresets, createTemplatePlugin as createComponentsPlugin, createTemplatePlugin, createKimeshResolver, createScriptPlugin, generateDtsFiles as generateDts, generateDtsFiles, generateSourceDts, kimeshAutoImport, kimeshPreset, normalizePreset, piniaPreset, resolvePresets, scanExports, tanstackQueryPreset, vuePreset, vueRouterPreset };
417
- //# sourceMappingURL=index.d.mts.map
416
+ export { type AutoImportConfig, type AutoImportPluginOptions, type ConflictReport, ConflictResolver, type ExportInfo, type ImportEntry, ImportInjector, type ImportPreset, type ImportRegistry, type InjectionResult, type KimeshResolverOptions, type LayerAutoImportSource, OxcExportScanner, ReferenceDetector, RegistryBuilder, type ResolvedLayerInfo, type ScanResult, type ScriptPluginOptions, type TemplatePluginOptions, type TransformResult, type UnresolvedReference, autoImportPlugin, autoImportPlugin as default, buildImportRegistry, builtinPresets, createTemplatePlugin as createComponentsPlugin, createTemplatePlugin, createKimeshResolver, createScriptPlugin, generateDtsFiles as generateDts, generateDtsFiles, generateSourceDts, kimeshAutoImport, kimeshPreset, normalizePreset, piniaPreset, resolvePresets, scanExports, tanstackQueryPreset, vuePreset, vueRouterPreset };
package/dist/index.mjs CHANGED
@@ -957,5 +957,4 @@ async function scanExports(filePath) {
957
957
  }
958
958
 
959
959
  //#endregion
960
- export { ConflictResolver, ImportInjector, OxcExportScanner, ReferenceDetector, RegistryBuilder, autoImportPlugin, buildImportRegistry, builtinPresets, createTemplatePlugin as createComponentsPlugin, createTemplatePlugin, createKimeshResolver, createScriptPlugin, plugin_default as default, generateDtsFiles as generateDts, generateDtsFiles, generateSourceDts, kimeshAutoImport, kimeshPreset, normalizePreset, piniaPreset, resolvePresets, scanExports, tanstackQueryPreset, vuePreset, vueRouterPreset };
961
- //# sourceMappingURL=index.mjs.map
960
+ export { ConflictResolver, ImportInjector, OxcExportScanner, ReferenceDetector, RegistryBuilder, autoImportPlugin, buildImportRegistry, builtinPresets, createTemplatePlugin as createComponentsPlugin, createTemplatePlugin, createKimeshResolver, createScriptPlugin, plugin_default as default, generateDtsFiles as generateDts, generateDtsFiles, generateSourceDts, kimeshAutoImport, kimeshPreset, normalizePreset, piniaPreset, resolvePresets, scanExports, tanstackQueryPreset, vuePreset, vueRouterPreset };
@@ -191,5 +191,4 @@ var OxcExportScanner = class {
191
191
  };
192
192
 
193
193
  //#endregion
194
- export { OxcExportScanner as t };
195
- //# sourceMappingURL=oxc-scanner-DrjjlY9k.mjs.map
194
+ export { OxcExportScanner as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimesh/auto-import",
3
- "version": "0.1.0-nightly.20260119170404",
3
+ "version": "0.1.0-nightly.20260119171158",
4
4
  "description": "OXC-powered auto-import system for Kimesh framework with layer support",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder-c6-47OHx.mjs","names":[],"sources":["../src/registry/utils.ts","../src/registry/conflict-resolver.ts","../src/presets/index.ts","../src/registry/builder.ts"],"sourcesContent":["/**\n * @kimesh/auto-import - Registry Utilities\n *\n * Shared utility functions for registry building and conflict resolution.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'pathe';\n\n/**\n * Convert string to PascalCase\n *\n * @example\n * toPascalCase('foo-bar') // 'FooBar'\n * toPascalCase('some_name') // 'SomeName'\n */\nexport function toPascalCase(str: string): string {\n return str\n .split(/[-_]/)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())\n .join('');\n}\n\n/**\n * Layer name patterns for extracting the meaningful part\n */\nconst LAYER_NAME_PATTERNS = [\n /^@[\\w-]+\\/(?:layer-)?(.+)$/, // Scoped package: @kimesh-layers/cms -> cms\n /^(?:layer-)?(.+)$/, // Regular name: layer-auth -> auth\n];\n\n/**\n * Derive component prefix from layer name\n *\n * @example\n * deriveLayerPrefix('@kimesh-layers/cms') // 'Cms'\n * deriveLayerPrefix('@company/layer-auth') // 'Auth'\n * deriveLayerPrefix('local-layer') // 'LocalLayer'\n */\nexport function deriveLayerPrefix(layerName: string): string {\n for (const pattern of LAYER_NAME_PATTERNS) {\n const match = layerName.match(pattern);\n if (match) {\n return toPascalCase(match[1]);\n }\n }\n return '';\n}\n\n/**\n * Resolve directory path, checking both root and src locations\n *\n * @returns The resolved path if it exists, or null if not found\n */\nexport function resolveDirectory(layerPath: string, dir: string): string | null {\n const srcDir = path.join(layerPath, 'src', dir);\n if (fs.existsSync(srcDir)) {\n return srcDir;\n }\n\n const rootDir = path.join(layerPath, dir);\n if (fs.existsSync(rootDir)) {\n return rootDir;\n }\n\n return null;\n}\n\n/**\n * Collect all existing directories from a list of directory names\n */\nexport function collectExistingDirectories(\n layerPath: string,\n dirs: string[]\n): string[] {\n const result: string[] = [];\n\n for (const dir of dirs) {\n const resolved = resolveDirectory(layerPath, dir);\n if (resolved) {\n result.push(resolved);\n }\n }\n\n return result;\n}\n","/**\n * @kimesh/auto-import - Conflict Resolution\n *\n * Handles conflicts when multiple layers export the same name.\n * Priority-based resolution: lower priority number wins.\n */\n\nimport type { ImportEntry, ConflictReport } from '../types';\nimport { deriveLayerPrefix } from './utils';\n\nexport class ConflictResolver {\n private imports: Map<string, ImportEntry[]> = new Map();\n private resolved: Map<string, ImportEntry> = new Map();\n private conflicts: ConflictReport[] = [];\n\n addImport(entry: ImportEntry): void {\n const existing = this.imports.get(entry.name) ?? [];\n existing.push(entry);\n this.imports.set(entry.name, existing);\n }\n\n resolve(): { resolved: Map<string, ImportEntry>; conflicts: ConflictReport[] } {\n this.conflicts = [];\n this.resolved = new Map();\n\n for (const [name, entries] of this.imports) {\n if (entries.length === 1) {\n this.resolved.set(name, entries[0]);\n continue;\n }\n\n const sorted = [...entries].sort((a, b) => a.priority - b.priority);\n const winner = sorted[0];\n const losers = sorted.slice(1);\n\n this.resolved.set(name, winner);\n\n const uniqueLosers = losers.filter(\n (l) => l.layer !== winner.layer || l.from !== winner.from\n );\n\n if (uniqueLosers.length > 0) {\n this.conflicts.push({\n name,\n winner,\n losers: uniqueLosers,\n suggestion: this.generateSuggestion(name, uniqueLosers),\n });\n }\n }\n\n return { resolved: this.resolved, conflicts: this.conflicts };\n }\n\n private generateSuggestion(name: string, losers: ImportEntry[]): string | undefined {\n const layerNames = [...new Set(losers.map((l) => l.layer))];\n if (layerNames.length === 0) return undefined;\n\n const prefixedNames = layerNames\n .map((layer) => {\n const prefix = deriveLayerPrefix(layer);\n return prefix ? `${prefix}${name}` : name;\n })\n .filter((n) => n !== name);\n\n const uniquePrefixed = [...new Set(prefixedNames)];\n if (uniquePrefixed.length === 0) return undefined;\n\n return `Consider using prefixed versions: ${uniquePrefixed.join(', ')}`;\n }\n\n getConflicts(): ConflictReport[] {\n return this.conflicts;\n }\n\n hasConflict(name: string): boolean {\n return this.conflicts.some((c) => c.name === name);\n }\n\n getConflict(name: string): ConflictReport | undefined {\n return this.conflicts.find((c) => c.name === name);\n }\n\n clear(): void {\n this.imports.clear();\n this.resolved.clear();\n this.conflicts = [];\n }\n}\n","/**\n * @kimesh/auto-import - Built-in Presets\n *\n * Presets for common libraries: Vue, Vue Router, TanStack Query, Pinia.\n */\n\nimport type { ImportPreset } from '../types';\n\n/**\n * Vue core preset\n */\nexport const vuePreset: ImportPreset = {\n name: 'vue',\n from: 'vue',\n imports: [\n // Reactivity\n 'ref',\n 'reactive',\n 'computed',\n 'readonly',\n 'shallowRef',\n 'shallowReactive',\n 'shallowReadonly',\n 'toRef',\n 'toRefs',\n 'toRaw',\n 'unref',\n 'isRef',\n 'isReactive',\n 'isReadonly',\n 'isProxy',\n 'triggerRef',\n 'customRef',\n 'markRaw',\n 'effectScope',\n 'getCurrentScope',\n 'onScopeDispose',\n\n // Watch\n 'watch',\n 'watchEffect',\n 'watchPostEffect',\n 'watchSyncEffect',\n\n // Lifecycle\n 'onMounted',\n 'onUpdated',\n 'onUnmounted',\n 'onBeforeMount',\n 'onBeforeUpdate',\n 'onBeforeUnmount',\n 'onActivated',\n 'onDeactivated',\n 'onErrorCaptured',\n 'onRenderTracked',\n 'onRenderTriggered',\n 'onServerPrefetch',\n\n // Dependency Injection\n 'provide',\n 'inject',\n\n // Composition\n 'defineComponent',\n 'defineAsyncComponent',\n 'getCurrentInstance',\n 'h',\n 'nextTick',\n 'resolveComponent',\n 'resolveDirective',\n 'useAttrs',\n 'useSlots',\n 'useCssModule',\n\n // Types (as type-only imports)\n { name: 'Ref', type: true },\n { name: 'ComputedRef', type: true },\n { name: 'UnwrapRef', type: true },\n { name: 'ShallowRef', type: true },\n { name: 'WritableComputedRef', type: true },\n { name: 'ToRefs', type: true },\n { name: 'PropType', type: true },\n { name: 'Component', type: true },\n { name: 'ComponentPublicInstance', type: true },\n { name: 'VNode', type: true },\n ],\n};\n\n/**\n * Vue Router preset\n */\nexport const vueRouterPreset: ImportPreset = {\n name: 'vue-router',\n from: 'vue-router',\n imports: [\n 'useRouter',\n 'useRoute',\n 'useLink',\n 'onBeforeRouteLeave',\n 'onBeforeRouteUpdate',\n 'createRouter',\n 'createWebHistory',\n 'createWebHashHistory',\n 'createMemoryHistory',\n\n // Types\n { name: 'RouteLocationNormalized', type: true },\n { name: 'RouteLocationNormalizedLoaded', type: true },\n { name: 'RouteRecordRaw', type: true },\n { name: 'NavigationGuard', type: true },\n { name: 'NavigationFailure', type: true },\n { name: 'Router', type: true },\n { name: 'RouteLocation', type: true },\n { name: 'LocationQuery', type: true },\n { name: 'RouteParams', type: true },\n ],\n};\n\n/**\n * TanStack Vue Query preset\n */\nexport const tanstackQueryPreset: ImportPreset = {\n name: 'tanstack-query',\n from: '@tanstack/vue-query',\n imports: [\n 'useQuery',\n 'useMutation',\n 'useQueryClient',\n 'useSuspenseQuery',\n 'useInfiniteQuery',\n 'useSuspenseInfiniteQuery',\n 'useIsFetching',\n 'useIsMutating',\n 'useQueries',\n 'QueryClient',\n 'QueryClientProvider',\n 'VueQueryPlugin',\n\n // Types\n { name: 'UseQueryOptions', type: true },\n { name: 'UseMutationOptions', type: true },\n { name: 'UseQueryReturnType', type: true },\n { name: 'UseMutationReturnType', type: true },\n { name: 'QueryKey', type: true },\n { name: 'MutationKey', type: true },\n ],\n};\n\n/**\n * Pinia preset\n */\nexport const piniaPreset: ImportPreset = {\n name: 'pinia',\n from: 'pinia',\n imports: [\n 'defineStore',\n 'storeToRefs',\n 'acceptHMRUpdate',\n 'createPinia',\n 'setActivePinia',\n 'getActivePinia',\n 'mapStores',\n 'mapState',\n 'mapWritableState',\n 'mapActions',\n 'mapGetters',\n\n // Types\n { name: 'Store', type: true },\n { name: 'StoreDefinition', type: true },\n { name: 'StateTree', type: true },\n { name: 'PiniaPlugin', type: true },\n ],\n};\n\n/**\n * Kimesh runtime preset\n */\nexport const kimeshPreset: ImportPreset = {\n name: 'kimesh',\n from: '@kimesh/router-runtime',\n imports: [\n // Route definition\n 'createFileRoute',\n 'defineRoute',\n // Context\n 'defineContext',\n 'useKimeshContext',\n // Navigation & params\n 'useNavigate',\n 'useParams',\n 'useReactiveParams',\n 'useSearch',\n // Components\n 'KmOutlet',\n 'KmLink',\n 'KmDeferred',\n ],\n};\n\n/**\n * All built-in presets\n */\nexport const builtinPresets: Record<string, ImportPreset> = {\n vue: vuePreset,\n 'vue-router': vueRouterPreset,\n 'tanstack-query': tanstackQueryPreset,\n pinia: piniaPreset,\n kimesh: kimeshPreset,\n};\n\n/**\n * Normalize preset configuration to ImportPreset\n */\nexport function normalizePreset(preset: string | ImportPreset): ImportPreset | null {\n if (typeof preset === 'string') {\n return builtinPresets[preset] || null;\n }\n return preset;\n}\n\n/**\n * Get all enabled presets from configuration\n */\nexport function resolvePresets(\n presets: Array<string | ImportPreset> | undefined\n): ImportPreset[] {\n if (!presets || presets.length === 0) {\n // Default presets when none specified\n return [vuePreset, vueRouterPreset];\n }\n\n const resolved: ImportPreset[] = [];\n\n for (const preset of presets) {\n const normalized = normalizePreset(preset);\n if (normalized) {\n resolved.push(normalized);\n }\n }\n\n return resolved;\n}\n","/**\n * @kimesh/auto-import - Import Registry Builder\n *\n * Builds a unified import registry from all layer sources.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'pathe';\nimport { consola } from 'consola';\nimport { OxcExportScanner } from '../scanner/oxc-scanner';\nimport { ConflictResolver } from './conflict-resolver';\nimport { normalizePreset } from '../presets';\nimport { deriveLayerPrefix, resolveDirectory } from './utils';\nimport type {\n ImportEntry,\n ImportRegistry,\n LayerAutoImportSource,\n AutoImportConfig,\n ImportPreset,\n} from '../types';\n\nconst logger = consola.withTag('kimesh:auto-import:registry');\n\nconst DEFAULT_EXTENSIONS = ['.ts', '.js', '.tsx', '.jsx', '.mts', '.mjs'];\nconst COMPONENT_EXTENSIONS = ['.vue', ...DEFAULT_EXTENSIONS];\n\nexport class RegistryBuilder {\n private scanner = new OxcExportScanner();\n private resolver = new ConflictResolver();\n\n async build(sources: LayerAutoImportSource[]): Promise<ImportRegistry> {\n const startTime = performance.now();\n const sortedSources = [...sources].sort((a, b) => b.priority - a.priority);\n\n for (const source of sortedSources) {\n await this.processLayerSource(source);\n }\n\n const { resolved, conflicts } = this.resolver.resolve();\n const components = this.extractComponents(resolved);\n const scanTime = performance.now() - startTime;\n const stats = this.calculateStats(resolved, conflicts.length, scanTime);\n\n this.logBuildResults(stats, conflicts);\n\n return { imports: resolved, components, conflicts, stats };\n }\n\n private extractComponents(resolved: Map<string, ImportEntry>): Map<string, ImportEntry> {\n const components = new Map<string, ImportEntry>();\n for (const [name, entry] of resolved) {\n const isComponent = entry.type === 'component';\n const isPresetComponent = entry.type === 'preset' && /^[A-Z][a-zA-Z0-9]*$/.test(name);\n if (isComponent || isPresetComponent) {\n components.set(name, entry);\n }\n }\n return components;\n }\n\n private calculateStats(\n resolved: Map<string, ImportEntry>,\n conflictsCount: number,\n scanTimeMs: number\n ): ImportRegistry['stats'] {\n const entries = [...resolved.values()];\n return {\n totalScanned: this.scanner.getCacheStats().size,\n componentsCount: entries.filter((e) => e.type === 'component').length,\n composablesCount: entries.filter((e) => e.type === 'composable').length,\n utilitiesCount: entries.filter((e) => e.type === 'utility').length,\n presetsCount: entries.filter((e) => e.type === 'preset').length,\n conflictsCount,\n scanTimeMs,\n };\n }\n\n private logBuildResults(\n stats: ImportRegistry['stats'],\n conflicts: ImportRegistry['conflicts']\n ): void {\n logger.debug(`Built registry in ${stats.scanTimeMs.toFixed(1)}ms`);\n logger.debug(` Components: ${stats.componentsCount}`);\n logger.debug(` Composables: ${stats.composablesCount}`);\n logger.debug(` Utilities: ${stats.utilitiesCount}`);\n logger.debug(` Presets: ${stats.presetsCount}`);\n logger.debug(` Conflicts: ${stats.conflictsCount}`);\n\n for (const conflict of conflicts) {\n logger.warn(\n `Auto-import conflict for \"${conflict.name}\": ` +\n `Using ${conflict.winner.layer} (priority ${conflict.winner.priority}), ` +\n `ignoring ${conflict.losers.map((l) => l.layer).join(', ')}`\n );\n if (conflict.suggestion) {\n logger.info(` Suggestion: ${conflict.suggestion}`);\n }\n }\n }\n\n private async processLayerSource(source: LayerAutoImportSource): Promise<void> {\n const { layer, priority, layerPath, config } = source;\n\n logger.debug(`Processing layer: ${layer} (priority ${priority})`);\n\n await this.processPresets(config.presets ?? [], layer, priority);\n\n if (config.components) {\n await this.processComponents(config.components, layerPath, layer, priority);\n }\n if (config.composables) {\n const dirs = config.composables.dirs ?? ['composables'];\n const extensions = config.composables.extensions ?? DEFAULT_EXTENSIONS;\n await this.processDirectories(dirs, layerPath, layer, priority, 'composable', extensions);\n }\n if (config.utils) {\n const dirs = config.utils.dirs ?? ['utils'];\n const extensions = config.utils.extensions ?? DEFAULT_EXTENSIONS;\n await this.processDirectories(dirs, layerPath, layer, priority, 'utility', extensions);\n }\n if (config.stores) {\n const dirs = config.stores.dirs ?? ['stores'];\n await this.processDirectories(dirs, layerPath, layer, priority, 'store', DEFAULT_EXTENSIONS);\n }\n if (config.imports) {\n this.processAdditionalImports(config.imports, layer, priority);\n }\n }\n\n private async processPresets(\n presets: Array<string | ImportPreset>,\n layer: string,\n priority: number\n ): Promise<void> {\n for (const presetConfig of presets) {\n const preset = normalizePreset(presetConfig);\n if (!preset) continue;\n\n for (const importItem of preset.imports) {\n const name = typeof importItem === 'string' ? importItem : importItem.name;\n const isType = typeof importItem === 'object' && importItem.type === true;\n const alias = typeof importItem === 'object' ? importItem.as : undefined;\n\n this.resolver.addImport({\n name: alias ?? name,\n as: alias,\n from: preset.from,\n type: 'preset',\n layer,\n priority: priority + 0.5,\n isDefault: false,\n isType,\n });\n }\n }\n }\n\n private async processComponents(\n config: NonNullable<AutoImportConfig['components']>,\n layerPath: string,\n layer: string,\n priority: number\n ): Promise<void> {\n const dirs = config.dirs ?? ['components'];\n const extensions = config.extensions ?? COMPONENT_EXTENSIONS;\n const prefix = config.prefix;\n\n for (const dir of dirs) {\n const dirPath = resolveDirectory(layerPath, dir);\n if (!dirPath) continue;\n\n const files = this.scanDirectory(dirPath, extensions);\n const results = await this.scanner.scanFiles(files);\n\n for (const result of results) {\n for (const exp of result.exports) {\n if (!exp.isDefault) continue;\n\n const componentName = this.resolveComponentName(exp.name, prefix, layer);\n\n this.resolver.addImport({\n name: componentName,\n from: result.filePath,\n type: 'component',\n layer,\n priority,\n isDefault: true,\n isType: false,\n });\n\n if (componentName !== exp.name) {\n this.resolver.addImport({\n name: exp.name,\n from: result.filePath,\n type: 'component',\n layer,\n priority,\n isDefault: true,\n isType: false,\n });\n }\n }\n }\n }\n }\n\n private resolveComponentName(\n name: string,\n prefix: string | false | undefined,\n layer: string\n ): string {\n if (prefix !== false && prefix) {\n return `${prefix}${name}`;\n }\n if (layer !== 'app') {\n return `${deriveLayerPrefix(layer)}${name}`;\n }\n return name;\n }\n\n private async processDirectories(\n dirs: string[],\n layerPath: string,\n layer: string,\n priority: number,\n type: ImportEntry['type'],\n extensions: string[]\n ): Promise<void> {\n for (const dir of dirs) {\n const dirPath = resolveDirectory(layerPath, dir);\n if (!dirPath) continue;\n\n const files = this.scanDirectory(dirPath, extensions);\n const results = await this.scanner.scanFiles(files);\n\n for (const result of results) {\n for (const exp of result.exports) {\n this.resolver.addImport({\n name: exp.name,\n from: result.filePath,\n type,\n layer,\n priority,\n isDefault: exp.isDefault,\n isType: exp.isType,\n });\n }\n }\n }\n }\n\n private processAdditionalImports(\n imports: Array<{ from: string; imports: string[] }>,\n layer: string,\n priority: number\n ): void {\n for (const { from, imports: names } of imports) {\n for (const name of names) {\n this.resolver.addImport({\n name,\n from,\n type: 'utility',\n layer,\n priority,\n isDefault: false,\n isType: false,\n });\n }\n }\n }\n\n private scanDirectory(dirPath: string, extensions: string[]): string[] {\n const files: string[] = [];\n this.scanDirectoryRecursive(dirPath, extensions, files);\n return files;\n }\n\n private scanDirectoryRecursive(\n dir: string,\n extensions: string[],\n files: string[]\n ): void {\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n this.scanDirectoryRecursive(fullPath, extensions, files);\n } else if (entry.isFile() && extensions.includes(path.extname(entry.name))) {\n files.push(fullPath);\n }\n }\n }\n\n invalidate(filePath: string): void {\n this.scanner.invalidate(filePath);\n }\n\n clearCache(): void {\n this.scanner.clearCache();\n this.resolver.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,SAAgB,aAAa,KAAqB;AAChD,QAAO,IACJ,MAAM,OAAO,CACb,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,aAAa,CAAC,CACzE,KAAK,GAAG;;;;;AAMb,MAAM,sBAAsB,CAC1B,8BACA,oBACD;;;;;;;;;AAUD,SAAgB,kBAAkB,WAA2B;AAC3D,MAAK,MAAM,WAAW,qBAAqB;EACzC,MAAM,QAAQ,UAAU,MAAM,QAAQ;AACtC,MAAI,MACF,QAAO,aAAa,MAAM,GAAG;;AAGjC,QAAO;;;;;;;AAQT,SAAgB,iBAAiB,WAAmB,KAA4B;CAC9E,MAAM,SAAS,KAAK,KAAK,WAAW,OAAO,IAAI;AAC/C,KAAI,GAAG,WAAW,OAAO,CACvB,QAAO;CAGT,MAAM,UAAU,KAAK,KAAK,WAAW,IAAI;AACzC,KAAI,GAAG,WAAW,QAAQ,CACxB,QAAO;AAGT,QAAO;;;;;AAMT,SAAgB,2BACd,WACA,MACU;CACV,MAAM,SAAmB,EAAE;AAE3B,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,WAAW,iBAAiB,WAAW,IAAI;AACjD,MAAI,SACF,QAAO,KAAK,SAAS;;AAIzB,QAAO;;;;;AC1ET,IAAa,mBAAb,MAA8B;CAC5B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SAAS,YAAY,MAAM;AACvD,SAAO;;CAGT,AAAQ,uBACN,KACA,YACA,OACM;EACN,MAAM,UAAU,GAAG,YAAY,KAAK,EAAE,eAAe,MAAM,CAAC;AAE5D,OAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK;AAE3C,OAAI,MAAM,aAAa,CACrB,MAAK,uBAAuB,UAAU,YAAY,MAAM;YAC/C,MAAM,QAAQ,IAAI,WAAW,SAAS,KAAK,QAAQ,MAAM,KAAK,CAAC,CACxE,OAAM,KAAK,SAAS;;;CAK1B,WAAW,UAAwB;AACjC,OAAK,QAAQ,WAAW,SAAS;;CAGnC,aAAmB;AACjB,OAAK,QAAQ,YAAY;AACzB,OAAK,SAAS,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/scanner/oxc-scanner.ts","../src/scanner/reference-detector.ts","../src/registry/builder.ts","../src/registry/conflict-resolver.ts","../src/script/injector.ts","../src/script/plugin.ts","../src/template/resolver.ts","../src/template/plugin.ts","../src/presets/index.ts","../src/types/generator.ts","../src/vite/plugin.ts","../src/index.ts"],"mappings":";;;;;;AAOA;AA6BA;;AA7BA;AA6BA;UA7BiB,WAAA;EAAA;EAAA,IAAA;EAAA;EAAA,EAAA;EAAA;EAAA,IAAA;EAAA;EAAA,IAAA;EAAA;EAAA,KAAA;EAAA;EAAA,QAAA;EAAA;EAAA,SAAA;EAAA;EAAA,MAAA;AAAA;AAAA;AA6BjB;AAiBA;AA9CiB,UA6BA,cAAA;EAAA;EAAA,IAAA;EAAA;EAAA,MAAA,EAKP,WAAA;EAAA;EAAA,MAAA,EAGA,WAAA;EAAA;EAAA,UAAA;AAAA;AAAA;AASV;AAoBA;AA7BU,UASO,UAAA;EAAA;EAAA,IAAA;EAAA;EAAA,SAAA;EAAA;EAAA,MAAA;EAAA;EAAA,KAAA;EAAA;EAAA,GAAA;AAAA;AAAA;AAoBjB;AA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AAA;EAAA,KAAA;AAAA;AAAA,iBAWL,oBAAA,CAAA,OAAA,EAA8B,qBAAA,GAAwB,MAAA;;;;ACftE;AAgFA;cAhFa,SAAA,EAAW,YAAA;AAAA;AAgFxB;AA8BA;AA9GwB,cAgFX,eAAA,EAAiB,YAAA;AAAA;AA8B9B;AA8BA;AA5D8B,cA8BjB,mBAAA,EAAqB,YAAA;AAAA;AA8BlC;AA2BA;AAzDkC,cA8BrB,WAAA,EAAa,YAAA;AAAA;AA2B1B;AAyBA;AApD0B,cA2Bb,YAAA,EAAc,YAAA;AAAA;AAyB3B;AAWA;AApC2B,cAyBd,cAAA,EAAgB,MAAA,SAAe,YAAA;AAAA;AAW5C;AAUA;AArB4C,iBAW5B,eAAA,CAAA,MAAA,WAAiC,YAAA,GAAe,YAAA;AAAA;AAUhE;;AAVgE,iBAUhD,cAAA,CAAA,OAAA,EACL,KAAA,UAAe,YAAA,gBACvB,YAAA;;;iBCrNmB,gBAAA,CAAA,QAAA,EACV,cAAA,EAAA,SAAA,WAET,OAAA;AAAA,iBAkJa,iBAAA,CAAA,MAAA,UAAA,OAAA,EAA2C,WAAA;;;iBChJ3C,gBAAA,CAAA,OAAA,EACL,uBAAA,GACR,YAAA;AAAA,cAqBU,gBAAA,SAAgB,gBAAA;;;;ACoD7B;;iBAAsB,mBAAA,CAAA,OAAA,EAAmB,qBAAA,KACW,OAAA,CAAF,cAAA;AAAA;;;AAAA,iBAU5B,WAAA,CAAA,QAAA,WAA4B,OAAA,CAAjB,UAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["parseSFC","logger","logger","RegistryBuilder","OxcExportScanner"],"sources":["../src/scanner/reference-detector.ts","../src/script/injector.ts","../src/types/generator.ts","../src/script/plugin.ts","../src/template/resolver.ts","../src/template/plugin.ts","../src/vite/plugin.ts","../src/index.ts"],"sourcesContent":["/**\n * @kimesh/auto-import - Unresolved Reference Detector\n *\n * Detects unresolved identifiers in source code using OXC AST analysis.\n * These are the identifiers that need auto-importing.\n */\n\nimport { parseSync, type Program } from 'oxc-parser';\nimport { parse as parseSFC } from '@vue/compiler-sfc';\nimport type { UnresolvedReference } from '../types';\n\n/**\n * Global identifiers that should not be auto-imported\n */\nconst GLOBALS = new Set([\n // JavaScript globals\n 'undefined', 'null', 'true', 'false', 'NaN', 'Infinity',\n 'Object', 'Array', 'String', 'Number', 'Boolean', 'Symbol', 'BigInt',\n 'Function', 'Date', 'RegExp', 'Error', 'TypeError', 'SyntaxError',\n 'RangeError', 'ReferenceError', 'EvalError', 'URIError',\n 'Map', 'Set', 'WeakMap', 'WeakSet', 'Promise', 'Proxy', 'Reflect',\n 'JSON', 'Math', 'console', 'window', 'document', 'globalThis',\n 'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',\n 'fetch', 'Request', 'Response', 'Headers', 'URL', 'URLSearchParams',\n 'FormData', 'Blob', 'File', 'FileReader', 'ArrayBuffer', 'DataView',\n 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array',\n 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array',\n 'BigUint64Array', 'TextEncoder', 'TextDecoder',\n 'alert', 'confirm', 'prompt', 'open', 'close', 'print',\n 'localStorage', 'sessionStorage', 'navigator', 'location', 'history',\n 'performance', 'crypto', 'indexedDB', 'caches',\n 'requestAnimationFrame', 'cancelAnimationFrame',\n 'MutationObserver', 'ResizeObserver', 'IntersectionObserver',\n 'CustomEvent', 'Event', 'EventTarget', 'AbortController', 'AbortSignal',\n 'structuredClone', 'atob', 'btoa', 'encodeURI', 'decodeURI',\n 'encodeURIComponent', 'decodeURIComponent', 'escape', 'unescape',\n 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'eval',\n\n // Node.js globals (for SSR)\n 'process', 'Buffer', 'global', '__dirname', '__filename',\n 'require', 'module', 'exports',\n\n // TypeScript utilities\n 'Partial', 'Required', 'Readonly', 'Record', 'Pick', 'Omit',\n 'Exclude', 'Extract', 'NonNullable', 'Parameters', 'ReturnType',\n 'InstanceType', 'ThisType', 'Awaited', 'Uppercase', 'Lowercase',\n 'Capitalize', 'Uncapitalize',\n\n // Vue script setup compiler macros\n 'defineProps', 'defineEmits', 'defineExpose', 'defineOptions',\n 'defineSlots', 'defineModel', 'withDefaults',\n]);\n\n/**\n * Reference detector using scope analysis\n */\nexport class ReferenceDetector {\n /**\n * Detect unresolved references in TypeScript/JavaScript code\n */\n detectInScript(code: string, filePath: string): UnresolvedReference[] {\n try {\n const result = parseSync(filePath, code, {\n sourceType: 'module',\n });\n\n if (result.errors.length > 0) {\n return [];\n }\n\n return this.detectInAST(result.program);\n } catch {\n return [];\n }\n }\n\n /**\n * Detect unresolved references in Vue SFC\n */\n detectInVue(code: string, filePath: string): UnresolvedReference[] {\n try {\n const { descriptor, errors } = parseSFC(code, { filename: filePath });\n\n if (errors.length > 0) {\n return [];\n }\n\n const refs: UnresolvedReference[] = [];\n\n // Check <script setup>\n if (descriptor.scriptSetup) {\n const scriptRefs = this.detectInScript(\n descriptor.scriptSetup.content,\n filePath + '.setup.ts'\n );\n refs.push(...scriptRefs);\n }\n\n // Check regular <script>\n if (descriptor.script) {\n const scriptRefs = this.detectInScript(\n descriptor.script.content,\n filePath + '.ts'\n );\n refs.push(...scriptRefs);\n }\n\n // Note: Template references would need separate handling\n // as they use different resolution rules\n\n return refs;\n } catch {\n return [];\n }\n }\n\n /**\n * Detect unresolved references in parsed AST\n */\n private detectInAST(program: Program): UnresolvedReference[] {\n const declarations = new Set<string>();\n const references: UnresolvedReference[] = [];\n\n // First pass: collect all declarations\n this.collectDeclarations(program, declarations);\n\n // Second pass: find unresolved references\n this.findUnresolvedReferences(program, declarations, references);\n\n return references;\n }\n\n /**\n * Collect all declared identifiers in the scope\n */\n private collectDeclarations(node: any, declarations: Set<string>): void {\n if (!node || typeof node !== 'object') return;\n\n switch (node.type) {\n // Variable declarations\n case 'VariableDeclaration':\n for (const decl of node.declarations || []) {\n this.collectPatternNames(decl.id, declarations);\n }\n break;\n\n // Function declarations\n case 'FunctionDeclaration':\n if (node.id?.name) {\n declarations.add(node.id.name);\n }\n // Collect parameters\n for (const param of node.params || []) {\n this.collectPatternNames(param, declarations);\n }\n break;\n\n // Arrow/function expressions with assigned name\n case 'VariableDeclarator':\n this.collectPatternNames(node.id, declarations);\n break;\n\n // Class declarations\n case 'ClassDeclaration':\n if (node.id?.name) {\n declarations.add(node.id.name);\n }\n break;\n\n // Import declarations\n case 'ImportDeclaration':\n for (const spec of node.specifiers || []) {\n if (spec.local?.name) {\n declarations.add(spec.local.name);\n }\n }\n break;\n\n // Type declarations\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n case 'TSEnumDeclaration':\n if (node.id?.name) {\n declarations.add(node.id.name);\n }\n break;\n\n // Catch clause parameter\n case 'CatchClause':\n if (node.param) {\n this.collectPatternNames(node.param, declarations);\n }\n break;\n\n // For-in/of declarations\n case 'ForInStatement':\n case 'ForOfStatement':\n if (node.left?.type === 'VariableDeclaration') {\n this.collectDeclarations(node.left, declarations);\n }\n break;\n }\n\n // Recurse into children\n for (const key of Object.keys(node)) {\n if (key === 'type' || key === 'start' || key === 'end') continue;\n\n const child = node[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n this.collectDeclarations(item, declarations);\n }\n } else if (child && typeof child === 'object') {\n this.collectDeclarations(child, declarations);\n }\n }\n }\n\n /**\n * Collect names from binding patterns\n */\n private collectPatternNames(pattern: any, names: Set<string>): void {\n if (!pattern) return;\n\n switch (pattern.type) {\n case 'Identifier':\n names.add(pattern.name);\n break;\n\n case 'ObjectPattern':\n for (const prop of pattern.properties || []) {\n if (prop.type === 'RestElement') {\n this.collectPatternNames(prop.argument, names);\n } else {\n this.collectPatternNames(prop.value || prop.key, names);\n }\n }\n break;\n\n case 'ArrayPattern':\n for (const element of pattern.elements || []) {\n if (element) {\n this.collectPatternNames(element, names);\n }\n }\n break;\n\n case 'RestElement':\n this.collectPatternNames(pattern.argument, names);\n break;\n\n case 'AssignmentPattern':\n this.collectPatternNames(pattern.left, names);\n break;\n }\n }\n\n /**\n * Find references to undeclared identifiers\n */\n private findUnresolvedReferences(\n node: any,\n declarations: Set<string>,\n references: UnresolvedReference[]\n ): void {\n if (!node || typeof node !== 'object') return;\n\n // Check for identifier references\n if (node.type === 'Identifier' && node.name) {\n const name = node.name;\n\n // Skip if it's a declaration, global, or property access\n if (\n !declarations.has(name) &&\n !GLOBALS.has(name) &&\n !this.isPropertyAccess(node) &&\n !this.isPropertyKey(node) &&\n !this.isLabelReference(node)\n ) {\n // Check if it's a type reference\n const isType = this.isTypeContext(node);\n\n // Avoid duplicates\n const existing = references.find(\n (r) => r.name === name && r.start === node.start\n );\n if (!existing) {\n references.push({\n name,\n start: node.start,\n end: node.end,\n isType,\n });\n }\n }\n }\n\n // Recurse into children (skip certain properties)\n for (const key of Object.keys(node)) {\n if (this.shouldSkipProperty(key)) continue;\n\n const child = node[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n this.findUnresolvedReferences(item, declarations, references);\n }\n } else if (child && typeof child === 'object') {\n this.findUnresolvedReferences(child, declarations, references);\n }\n }\n }\n\n /**\n * Check if identifier is a property access (obj.prop)\n */\n private isPropertyAccess(node: any): boolean {\n const parent = node._parent;\n return (\n parent?.type === 'MemberExpression' &&\n parent.property === node &&\n !parent.computed\n );\n }\n\n /**\n * Check if identifier is a property key ({ key: value })\n */\n private isPropertyKey(node: any): boolean {\n const parent = node._parent;\n return (\n parent?.type === 'Property' &&\n parent.key === node &&\n !parent.computed\n );\n }\n\n /**\n * Check if identifier is a label reference\n */\n private isLabelReference(node: any): boolean {\n const parent = node._parent;\n return (\n parent?.type === 'LabeledStatement' ||\n parent?.type === 'BreakStatement' ||\n parent?.type === 'ContinueStatement'\n );\n }\n\n /**\n * Check if identifier is in type context\n */\n private isTypeContext(node: any): boolean {\n const parent = node._parent;\n return (\n parent?.type === 'TSTypeReference' ||\n parent?.type === 'TSQualifiedName' ||\n parent?.type === 'TSTypeQuery' ||\n parent?.type === 'TSImportType'\n );\n }\n\n /**\n * Properties to skip when recursing\n */\n private shouldSkipProperty(key: string): boolean {\n return (\n key === 'type' ||\n key === 'start' ||\n key === 'end' ||\n key === '_parent' ||\n key === 'loc' ||\n key === 'range'\n );\n }\n}\n","/**\n * @kimesh/auto-import - Script Import Injector\n *\n * Handles injecting import statements into script code.\n */\n\nimport MagicString from \"magic-string\";\nimport type { ImportEntry } from \"../types\";\n\nexport interface InjectionResult {\n code: string;\n map: ReturnType<MagicString[\"generateMap\"]>;\n count: number;\n}\n\nexport class ImportInjector {\n inject(\n code: string,\n imports: ImportEntry[],\n isVue: boolean\n ): InjectionResult | null {\n if (imports.length === 0) return null;\n\n const s = new MagicString(code);\n const importStatements = this.generateImportStatements(imports);\n const insertPoint = this.findImportInsertionPoint(code, isVue);\n s.appendLeft(insertPoint, \"\\n\" + importStatements + \"\\n\");\n\n return {\n code: s.toString(),\n map: s.generateMap({ hires: true }),\n count: imports.length,\n };\n }\n\n generateImportStatements(imports: ImportEntry[]): string {\n const groups = this.groupImportsBySource(imports);\n const statements: string[] = [];\n\n for (const [source, entries] of groups) {\n const { defaultImports, namedImports, typeImports } =\n this.categorizeImports(entries);\n\n const parts: string[] = [];\n if (defaultImports.length > 0) parts.push(defaultImports[0]);\n if (namedImports.length > 0) parts.push(`{ ${namedImports.join(\", \")} }`);\n\n if (parts.length > 0) {\n statements.push(`import ${parts.join(\", \")} from '${source}';`);\n }\n\n if (typeImports.length > 0) {\n statements.push(\n `import type { ${typeImports.join(\", \")} } from '${source}';`\n );\n }\n }\n\n return statements.join(\"\\n\");\n }\n\n private groupImportsBySource(imports: ImportEntry[]): Map<string, ImportEntry[]> {\n const groups = new Map<string, ImportEntry[]>();\n for (const entry of imports) {\n const existing = groups.get(entry.from) ?? [];\n existing.push(entry);\n groups.set(entry.from, existing);\n }\n return groups;\n }\n\n private categorizeImports(entries: ImportEntry[]): {\n defaultImports: string[];\n namedImports: string[];\n typeImports: string[];\n } {\n const defaultImports: string[] = [];\n const namedImports: string[] = [];\n const typeImports: string[] = [];\n\n for (const entry of entries) {\n const importName = entry.as ? `${entry.name} as ${entry.as}` : entry.name;\n\n if (entry.isDefault) {\n defaultImports.push(entry.as ?? entry.name);\n } else if (entry.isType) {\n typeImports.push(importName);\n } else {\n namedImports.push(importName);\n }\n }\n\n return { defaultImports, namedImports, typeImports };\n }\n\n findImportInsertionPoint(code: string, isVue: boolean): number {\n if (isVue) {\n return this.findVueScriptInsertionPoint(code);\n }\n return this.findJsInsertionPoint(code);\n }\n\n private findVueScriptInsertionPoint(code: string): number {\n const scriptMatch = code.match(/<script(\\s+[^>]*)?>|<script\\s+setup[^>]*>/i);\n if (!scriptMatch || scriptMatch.index === undefined) return 0;\n\n const insertPoint = scriptMatch.index + scriptMatch[0].length;\n const afterScript = code.slice(insertPoint);\n const importMatch = afterScript.match(/^(\\s*\\n?\\s*import\\s+.*?['\"].*?['\"];?\\s*)+/);\n\n return importMatch ? insertPoint + importMatch[0].length : insertPoint;\n }\n\n private findJsInsertionPoint(code: string): number {\n const importRegex = /^import\\s+.*?['\"].*?['\"];?\\s*$/gm;\n let lastImportEnd = 0;\n let match;\n\n while ((match = importRegex.exec(code)) !== null) {\n lastImportEnd = match.index + match[0].length;\n }\n\n if (lastImportEnd > 0) return lastImportEnd;\n\n const useStrictMatch = code.match(/^(['\"]use strict['\"];?\\s*)/);\n if (useStrictMatch) return useStrictMatch[0].length;\n\n const shebangMatch = code.match(/^#!.*\\n/);\n if (shebangMatch) return shebangMatch[0].length;\n\n return 0;\n }\n\n extractExistingImports(code: string, isVue: boolean): Set<string> {\n const imported = new Set<string>();\n\n const scriptContent = isVue ? this.extractVueScriptContent(code) : code;\n if (!scriptContent) return imported;\n\n const importRegex =\n /import\\s+(?:type\\s+)?(?:(\\w+)\\s*,?\\s*)?(?:\\{([^}]*)\\})?\\s*from\\s*['\"][^'\"]+['\"]/g;\n\n let match;\n while ((match = importRegex.exec(scriptContent)) !== null) {\n if (match[1]) imported.add(match[1]);\n\n if (match[2]) {\n for (const name of match[2].split(\",\")) {\n const trimmed = name.trim();\n if (!trimmed) continue;\n\n const asMatch = trimmed.match(/(\\w+)\\s+as\\s+(\\w+)/);\n imported.add(asMatch ? asMatch[2] : trimmed);\n }\n }\n }\n\n return imported;\n }\n\n private extractVueScriptContent(code: string): string | null {\n const scriptMatch = code.match(/<script[^>]*>([\\s\\S]*?)<\\/script>/gi);\n if (!scriptMatch) return null;\n\n return scriptMatch\n .map((m) => {\n const content = m.match(/<script[^>]*>([\\s\\S]*?)<\\/script>/i);\n return content ? content[1] : \"\";\n })\n .join(\"\\n\");\n }\n}\n","/**\n * @kimesh/auto-import - Type Declaration Generator\n *\n * Generates .d.ts files for auto-imported modules.\n */\n\nimport * as fs from \"node:fs\";\nimport * as path from \"pathe\";\nimport { consola } from \"consola\";\nimport type { ImportRegistry, ImportEntry } from \"../types\";\n\nconst logger = consola.withTag(\"kimesh:auto-import:types\");\n\nexport async function generateDtsFiles(\n registry: ImportRegistry,\n outputDir: string\n): Promise<void> {\n fs.mkdirSync(outputDir, { recursive: true });\n\n writeFile(outputDir, \"auto-imports.d.ts\", generateAutoImportsDts(registry));\n\n const presetComponents = generatePresetComponentsDts(registry);\n if (presetComponents) {\n writeFile(outputDir, \"kimesh-components.d.ts\", presetComponents);\n }\n\n writeFile(outputDir, \".eslintrc-auto-import.json\", generateEslintGlobals(registry));\n}\n\nfunction writeFile(outputDir: string, filename: string, content: string): void {\n const filePath = path.join(outputDir, filename);\n fs.writeFileSync(filePath, content, \"utf-8\");\n logger.debug(`Generated: ${filePath}`);\n}\n\nfunction generateAutoImportsDts(registry: ImportRegistry): string {\n const header = [\n \"/* eslint-disable */\",\n \"/* prettier-ignore */\",\n \"// @ts-nocheck\",\n \"// noinspection JSUnusedGlobalSymbols\",\n \"\",\n \"// Auto-generated by @kimesh/auto-import\",\n \"// DO NOT EDIT - changes will be overwritten\",\n \"\",\n \"export {}\",\n \"\",\n \"declare global {\",\n ];\n\n const groups = groupImportsBySource(registry.imports, [\n \"composable\",\n \"utility\",\n \"preset\",\n \"store\",\n ]);\n\n const body: string[] = [];\n for (const [source, entries] of groups) {\n body.push(` // ${source}`);\n for (const entry of entries) {\n body.push(formatGlobalDeclaration(entry));\n }\n body.push(\"\");\n }\n\n return [...header, ...body, \"}\"].join(\"\\n\");\n}\n\nfunction formatGlobalDeclaration(entry: ImportEntry): string {\n const comment = entry.layer !== \"app\" ? ` // from ${entry.layer}` : \"\";\n\n if (entry.isType) {\n return ` type ${entry.name} = import('${entry.from}').${entry.name}${comment}`;\n }\n if (entry.isDefault) {\n return ` const ${entry.name}: typeof import('${entry.from}').default${comment}`;\n }\n return ` const ${entry.name}: typeof import('${entry.from}').${entry.name}${comment}`;\n}\n\nfunction generateEslintGlobals(registry: ImportRegistry): string {\n const globals: Record<string, \"readonly\"> = {};\n\n for (const [name, entry] of registry.imports) {\n if (!entry.isType) {\n globals[name] = \"readonly\";\n }\n }\n\n return JSON.stringify({ globals }, null, 2);\n}\n\nconst EXCLUDED_TYPE_NAMES = new Set([\n // Vue types\n 'Ref', 'ComputedRef', 'UnwrapRef', 'ShallowRef', 'WritableComputedRef',\n 'ToRefs', 'PropType', 'Component', 'ComponentPublicInstance', 'VNode',\n // Vue Router types\n 'RouteLocationNormalized', 'RouteLocationNormalizedLoaded', 'RouteRecordRaw',\n 'NavigationGuard', 'NavigationFailure', 'Router', 'RouteLocation',\n 'LocationQuery', 'RouteParams',\n]);\n\nfunction generatePresetComponentsDts(registry: ImportRegistry): string | null {\n const presetComponents = [...registry.components.entries()]\n .filter(([name, entry]) =>\n entry.type === \"preset\" &&\n /^[A-Z][a-zA-Z0-9]*$/.test(name) &&\n !entry.isType &&\n !EXCLUDED_TYPE_NAMES.has(name)\n )\n .sort((a, b) => a[0].localeCompare(b[0]));\n\n if (presetComponents.length === 0) return null;\n\n const header = [\n \"/* eslint-disable */\",\n \"// @ts-nocheck\",\n \"// Generated by @kimesh/auto-import\",\n \"// Preset components for Vue templates\",\n \"// biome-ignore lint: disable\",\n \"export {}\",\n \"\",\n \"/* prettier-ignore */\",\n \"declare module 'vue' {\",\n \" export interface GlobalComponents {\",\n ];\n\n const componentDeclarations = presetComponents.map(([name, entry]) => {\n const importPath = entry.isDefault\n ? `typeof import('${entry.from}').default`\n : `typeof import('${entry.from}')['${entry.name}']`;\n return ` ${name}: ${importPath}`;\n });\n\n return [...header, ...componentDeclarations, \" }\", \"}\"].join(\"\\n\");\n}\n\nfunction groupImportsBySource(\n imports: Map<string, ImportEntry>,\n types: string[]\n): Map<string, ImportEntry[]> {\n const groups = new Map<string, ImportEntry[]>();\n\n for (const [, entry] of imports) {\n if (!types.includes(entry.type)) continue;\n\n const existing = groups.get(entry.from) ?? [];\n existing.push(entry);\n groups.set(entry.from, existing);\n }\n\n for (const entries of groups.values()) {\n entries.sort((a, b) => {\n if (a.isType !== b.isType) return a.isType ? 1 : -1;\n return a.name.localeCompare(b.name);\n });\n }\n\n return groups;\n}\n\nexport function generateSourceDts(source: string, entries: ImportEntry[]): string {\n const lines: string[] = [\n \"// Auto-generated by @kimesh/auto-import\",\n \"\",\n `// Exports from: ${source}`,\n \"\",\n ];\n\n const defaultExports = entries.filter((e) => e.isDefault);\n const namedExports = entries.filter((e) => !e.isDefault && !e.isType);\n const typeExports = entries.filter((e) => e.isType);\n\n if (defaultExports.length > 0) {\n lines.push(`export { default as ${defaultExports[0].name} } from '${source}'`);\n }\n\n if (namedExports.length > 0) {\n const names = namedExports.map((e) => (e.as ? `${e.name} as ${e.as}` : e.name));\n lines.push(`export { ${names.join(\", \")} } from '${source}'`);\n }\n\n if (typeExports.length > 0) {\n const names = typeExports.map((e) => (e.as ? `${e.name} as ${e.as}` : e.name));\n lines.push(`export type { ${names.join(\", \")} } from '${source}'`);\n }\n\n return lines.join(\"\\n\");\n}\n","/**\n * @kimesh/auto-import - Script Transform Plugin\n *\n * Vite plugin for script-level auto-import.\n * Handles auto-importing composables, utilities, and presets in <script> blocks.\n */\n\nimport type { Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport * as fs from \"node:fs\";\nimport * as path from \"pathe\";\nimport { consola } from \"consola\";\nimport { ReferenceDetector } from \"./detector\";\nimport { ImportInjector } from \"./injector\";\nimport { RegistryBuilder } from \"../registry/builder\";\nimport { collectExistingDirectories } from \"../registry/utils\";\nimport { generateDtsFiles } from \"../types/generator\";\nimport type {\n AutoImportPluginOptions,\n ImportRegistry,\n ImportEntry,\n LayerAutoImportSource,\n ResolvedLayerInfo,\n} from \"../types\";\n\nconst logger = consola.withTag(\"kimesh:auto-import:script\");\n\nconst DEFAULT_INCLUDE = [/\\.[jt]sx?$/, /\\.vue$/, /\\.vue\\?vue/];\nconst DEFAULT_EXCLUDE = [/node_modules/, /\\.d\\.ts$/];\n\nexport interface ScriptPluginOptions extends AutoImportPluginOptions {\n onRegistryUpdate?: (registry: ImportRegistry) => void;\n}\n\nexport interface ScriptPluginState {\n registry: ImportRegistry | null;\n config: ResolvedConfig | null;\n isBuilding: boolean;\n}\n\nfunction debounce<T extends (...args: unknown[]) => void>(\n fn: T,\n ms: number\n): T {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n return ((...args: unknown[]) => {\n if (timeoutId) clearTimeout(timeoutId);\n timeoutId = setTimeout(() => fn(...args), ms);\n }) as T;\n}\n\nexport function createScriptPlugin(options: ScriptPluginOptions): Plugin {\n const {\n sources: staticSources,\n getSources,\n layers: staticLayers = [],\n getLayers,\n include = DEFAULT_INCLUDE,\n exclude = DEFAULT_EXCLUDE,\n dts = \".kimesh\",\n debug = false,\n onRegistryUpdate,\n } = options;\n\n const builder = new RegistryBuilder();\n const detector = new ReferenceDetector();\n const injector = new ImportInjector();\n let registry: ImportRegistry | null = null;\n let config: ResolvedConfig;\n let isBuilding = false;\n let resolvedSources: typeof staticSources = undefined;\n\n function resolveSources(): LayerAutoImportSource[] {\n if (resolvedSources !== undefined) {\n return resolvedSources;\n }\n resolvedSources = getSources ? getSources() : (staticSources ?? []);\n return resolvedSources;\n }\n\n function resolveLayers(): ResolvedLayerInfo[] {\n return getLayers ? getLayers() : staticLayers;\n }\n\n function getRegistry(): ImportRegistry | null {\n return registry;\n }\n\n function resolveDtsDir(): string {\n return path.isAbsolute(dts as string)\n ? (dts as string)\n : path.join(config.root, dts as string);\n }\n\n async function generateDtsForLayers(reg: ImportRegistry): Promise<void> {\n if (dts === false) return;\n\n const hostDtsDir = resolveDtsDir();\n await generateDtsFiles(reg, hostDtsDir);\n logger.debug(`Generated type declarations in ${hostDtsDir}`);\n\n const resolvedLayerList = resolveLayers();\n for (const layer of resolvedLayerList) {\n if (layer.isApp) continue;\n\n // Resolve real path (handle symlinks in node_modules)\n let layerRoot = layer.path;\n try {\n layerRoot = fs.realpathSync(layer.path);\n } catch {\n // Ignore if path doesn't exist\n }\n\n const layerKimeshDir = path.join(layerRoot, \".kimesh\");\n try {\n fs.mkdirSync(layerKimeshDir, { recursive: true });\n await generateDtsFiles(reg, layerKimeshDir);\n logger.debug(`Generated type declarations for layer: ${layer.name} at ${layerKimeshDir}`);\n } catch (err) {\n logger.warn(`Failed to generate .d.ts for layer ${layer.name}: ${err}`);\n }\n }\n }\n\n async function buildAndLogRegistry(): Promise<void> {\n const startTime = performance.now();\n const sources = resolveSources();\n registry = await builder.build(sources);\n const elapsed = performance.now() - startTime;\n\n logger.info(\n `Script auto-import registry built in ${elapsed.toFixed(1)}ms`\n );\n logger.info(\n ` ${registry.stats.composablesCount} composables, ` +\n `${registry.stats.utilitiesCount} utilities, ` +\n `${registry.stats.presetsCount} preset imports`\n );\n\n if (registry.conflicts.length > 0) {\n logger.warn(` ${registry.conflicts.length} conflicts detected`);\n }\n\n await generateDtsForLayers(registry);\n\n onRegistryUpdate?.(registry);\n }\n\n const plugin = {\n name: \"kimesh:auto-import:script\",\n enforce: \"pre\" as const,\n getRegistry,\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n isBuilding = config.command === \"build\";\n },\n\n async buildStart() {\n await buildAndLogRegistry();\n },\n\n configureServer(server: ViteDevServer) {\n if (isBuilding) return;\n\n const sources = resolveSources();\n const watchDirs = getWatchDirs(sources);\n\n if (watchDirs.length === 0) {\n logger.debug(\"No directories to watch for auto-import\");\n return;\n }\n\n logger.debug(\n `Watching ${watchDirs.length} directories for auto-import changes`\n );\n\n const rebuildRegistry = async (): Promise<void> => {\n const startTime = performance.now();\n builder.clearCache();\n\n const sources = resolveSources();\n registry = await builder.build(sources);\n const elapsed = performance.now() - startTime;\n\n logger.info(`Auto-import registry rebuilt in ${elapsed.toFixed(1)}ms`);\n logger.info(\n ` ${registry.stats.componentsCount} components, ` +\n `${registry.stats.composablesCount} composables, ` +\n `${registry.stats.utilitiesCount} utilities`\n );\n\n await generateDtsForLayers(registry);\n\n onRegistryUpdate?.(registry);\n };\n\n const debouncedRebuild = debounce(rebuildRegistry, 300);\n\n const isWatchedFile = (file: string): boolean => {\n const ext = path.extname(file);\n const validExtensions = [\".ts\", \".js\", \".tsx\", \".jsx\", \".mts\", \".mjs\", \".vue\"];\n if (!validExtensions.includes(ext)) return false;\n return watchDirs.some((dir) => file.startsWith(dir));\n };\n\n server.watcher.on(\"add\", (file) => {\n if (!isWatchedFile(file)) return;\n logger.debug(`New file detected: ${path.relative(config.root, file)}`);\n debouncedRebuild();\n });\n\n server.watcher.on(\"unlink\", (file) => {\n if (!isWatchedFile(file)) return;\n logger.debug(`File deleted: ${path.relative(config.root, file)}`);\n debouncedRebuild();\n });\n\n server.watcher.on(\"change\", (file) => {\n if (!isWatchedFile(file)) return;\n logger.debug(`File changed: ${path.relative(config.root, file)}`);\n builder.invalidate(file);\n debouncedRebuild();\n });\n },\n\n transform(code, id) {\n if (!registry) return null;\n if (!shouldTransform(id, include, exclude)) return null;\n\n const startTime = performance.now();\n const isVue = id.endsWith(\".vue\") || id.includes(\".vue?\");\n const refs = isVue\n ? detector.detectInVue(code, id)\n : detector.detectInScript(code, id);\n\n if (refs.length === 0) return null;\n\n const existingImports = injector.extractExistingImports(code, isVue);\n const imports: ImportEntry[] = [];\n const matched = new Set<string>();\n\n for (const ref of refs) {\n if (matched.has(ref.name)) continue;\n if (existingImports.has(ref.name)) continue;\n\n const entry = registry.imports.get(ref.name);\n if (!entry) continue;\n if (ref.isType && !entry.isType) continue;\n\n if (registry.components.has(ref.name)) {\n if (debug) {\n logger.debug(`Skipping component ${ref.name} for template plugin`);\n }\n continue;\n }\n\n imports.push(entry);\n matched.add(ref.name);\n }\n\n if (imports.length === 0) return null;\n\n const result = injector.inject(code, imports, isVue);\n if (!result) return null;\n\n const elapsed = performance.now() - startTime;\n\n if (debug) {\n logger.debug(\n `[${elapsed.toFixed(1)}ms] ${id}: injected ${imports.length} imports`\n );\n }\n\n return {\n code: result.code,\n map: result.map,\n };\n },\n\n handleHotUpdate({ file }) {\n const relativePath = path.relative(config.root, file);\n const sources = resolveSources();\n\n for (const source of sources) {\n if (file.startsWith(source.layerPath)) {\n logger.debug(`HMR update: ${relativePath}`);\n break;\n }\n }\n },\n } satisfies Plugin & { getRegistry: () => ImportRegistry | null };\n\n return plugin;\n}\n\nfunction getWatchDirs(sources: LayerAutoImportSource[]): string[] {\n const dirs: string[] = [];\n\n for (const source of sources) {\n const { layerPath, config: sourceConfig } = source;\n const dirConfigs = [\n sourceConfig.components?.dirs ?? [\"components\"],\n sourceConfig.composables?.dirs ?? [\"composables\"],\n sourceConfig.utils?.dirs ?? [\"utils\"],\n sourceConfig.stores?.dirs ?? [\"stores\"],\n ];\n\n for (const configDirs of dirConfigs) {\n dirs.push(...collectExistingDirectories(layerPath, configDirs));\n }\n }\n\n return [...new Set(dirs)];\n}\n\nfunction matchesPattern(id: string, pattern: string | RegExp): boolean {\n if (typeof pattern === \"string\") {\n return id.includes(pattern);\n }\n return pattern.test(id);\n}\n\nfunction shouldTransform(\n id: string,\n include: Array<string | RegExp>,\n exclude: Array<string | RegExp>\n): boolean {\n if (exclude.some((pattern) => matchesPattern(id, pattern))) {\n return false;\n }\n return include.some((pattern) => matchesPattern(id, pattern));\n}\n\nexport default createScriptPlugin;\n","/**\n * @kimesh/auto-import - Kimesh Component Resolver\n *\n * Custom resolver for unplugin-vue-components that uses\n * the Kimesh import registry to resolve components.\n */\n\nimport type { ComponentResolver } from \"unplugin-vue-components\";\nimport { consola } from \"consola\";\nimport type { ImportRegistry, ImportEntry } from \"../types\";\n\nconst logger = consola.withTag(\"kimesh:auto-import:template:resolver\");\n\nexport interface KimeshResolverOptions {\n getRegistry: () => ImportRegistry | null;\n debug?: boolean;\n}\n\nfunction looksLikeComponent(name: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*$/.test(name);\n}\n\nfunction createResolvedComponent(entry: ImportEntry, name: string) {\n return {\n name: entry.isDefault ? \"default\" : entry.name,\n from: entry.from,\n as: name,\n };\n}\n\nexport function createKimeshResolver(\n options: KimeshResolverOptions\n): ComponentResolver {\n const { getRegistry, debug = false } = options;\n\n return {\n type: \"component\",\n resolve: (name: string) => {\n const registry = getRegistry();\n if (!registry) {\n if (debug) logger.debug(`Registry not ready, skipping ${name}`);\n return undefined;\n }\n\n if (debug) {\n logger.debug(`Resolving component: ${name}`);\n logger.debug(` Components map size: ${registry.components.size}`);\n logger.debug(` Imports map size: ${registry.imports.size}`);\n }\n\n const componentEntry = registry.components.get(name);\n if (componentEntry) {\n if (debug) {\n logger.debug(\n `Resolved component ${name} from ${componentEntry.from} (layer: ${componentEntry.layer})`\n );\n }\n return createResolvedComponent(componentEntry, name);\n }\n\n const importEntry = registry.imports.get(name);\n if (!importEntry) {\n if (debug) logger.debug(`${name} not found in imports map`);\n return undefined;\n }\n\n if (debug) logger.debug(`Found ${name} in imports, type: ${importEntry.type}`);\n\n const isResolvable =\n importEntry.type === \"component\" ||\n (importEntry.type === \"preset\" && looksLikeComponent(name));\n\n if (isResolvable) {\n if (debug) {\n logger.debug(\n `Resolved component ${name} from ${importEntry.from} (layer: ${importEntry.layer})`\n );\n }\n return {\n name: importEntry.isDefault ? \"default\" : name,\n from: importEntry.from,\n as: name,\n };\n }\n\n return undefined;\n },\n };\n}\n\nexport default createKimeshResolver;\n","/**\n * @kimesh/auto-import - Template Auto-Import Plugin\n *\n * Vite plugin for template-level component auto-import.\n * Wraps unplugin-vue-components with Kimesh's custom resolver.\n */\n\nimport type { Plugin } from \"vite\";\nimport Components from \"unplugin-vue-components/vite\";\nimport MagicString from \"magic-string\";\nimport * as path from \"pathe\";\nimport { createKimeshResolver } from \"./resolver\";\nimport type { ImportRegistry } from \"../types\";\n\nexport interface TemplatePluginOptions {\n getRegistry: () => ImportRegistry | null;\n dts?: string | false;\n debug?: boolean;\n}\n\nfunction resolveDtsPath(dts: string | false | undefined): string | boolean {\n if (dts === false) return false;\n if (typeof dts === \"string\") return path.join(dts, \"components.d.ts\");\n return true;\n}\n\nexport function createTemplatePlugin(options: TemplatePluginOptions): Plugin {\n const { getRegistry, dts, debug = false } = options;\n\n const basePlugin = Components({\n resolvers: [createKimeshResolver({ getRegistry, debug })],\n dirs: [],\n dts: resolveDtsPath(dts),\n include: [/\\.vue$/, /\\.vue\\?vue/],\n exclude: [/[\\\\/]node_modules[\\\\/]/],\n deep: true,\n directoryAsNamespace: false,\n collapseSamePrefixes: true,\n version: 3,\n });\n\n const plugin = basePlugin as unknown as Plugin;\n plugin.name = \"kimesh:auto-import:template\";\n\n const api = (basePlugin as any).api as {\n findComponent: (name: string, filename?: string) => Promise<any>;\n stringifyImport: (info: any) => string;\n };\n\n const originalTransform = plugin.transform;\n if (originalTransform) {\n plugin.transform = async function (\n code: string,\n id: string,\n transformOptions: any\n ) {\n const DISABLE_COMMENT = \"/* unplugin-vue-components disabled */\";\n\n if (!code.includes(DISABLE_COMMENT)) {\n return (originalTransform as Function).call(\n this,\n code,\n id,\n transformOptions\n );\n }\n\n const registry = getRegistry();\n if (!registry) return null;\n\n const unresolvedMatches = [\n ...code.matchAll(/_?resolveComponent\\d*\\(\"(.+?)\"\\)/g),\n ];\n if (unresolvedMatches.length === 0) return null;\n\n const existingVars = [...code.matchAll(/__unplugin_components_(\\d+)/g)];\n let nextVarIndex =\n existingVars.length > 0\n ? Math.max(...existingVars.map((m) => parseInt(m[1], 10))) + 1\n : 0;\n\n const s = new MagicString(code);\n const imports: string[] = [];\n const resolved = new Set<string>();\n\n for (const match of unresolvedMatches) {\n const fullMatch = match[0];\n const componentName = match[1];\n\n if (resolved.has(componentName)) continue;\n if (componentName.startsWith(\"_\")) continue;\n\n const entry = resolveComponentEntry(registry, componentName);\n if (!entry) continue;\n\n const varName = `__unplugin_components_${nextVarIndex++}`;\n const importName = entry.isDefault ? \"default\" : entry.name;\n imports.push(\n `import { ${importName} as ${varName} } from \"${entry.from}\";`\n );\n\n replaceAllOccurrences(s, code, fullMatch, varName);\n resolved.add(componentName);\n\n if (api && typeof api.findComponent === \"function\") {\n try {\n await api.findComponent(componentName, id);\n } catch {\n // Ignore errors from API registration\n }\n }\n }\n\n if (imports.length === 0) return null;\n\n s.prepend(imports.join(\"\\n\") + \"\\n\");\n\n return {\n code: s.toString(),\n map: s.generateMap({ source: id, includeContent: true }),\n };\n };\n }\n\n return plugin;\n}\n\nfunction resolveComponentEntry(\n registry: ImportRegistry,\n componentName: string\n): import(\"../types\").ImportEntry | undefined {\n const entry = registry.components.get(componentName);\n if (entry) return entry;\n\n const importEntry = registry.imports.get(componentName);\n if (\n importEntry &&\n importEntry.type === \"preset\" &&\n /^[A-Z][a-zA-Z0-9]*$/.test(componentName)\n ) {\n return importEntry;\n }\n\n return undefined;\n}\n\nfunction replaceAllOccurrences(\n s: MagicString,\n code: string,\n search: string,\n replacement: string\n): void {\n let searchIndex = 0;\n while (true) {\n const idx = code.indexOf(search, searchIndex);\n if (idx === -1) break;\n s.overwrite(idx, idx + search.length, replacement);\n searchIndex = idx + search.length;\n }\n}\n\nexport default createTemplatePlugin;\n","/**\n * @kimesh/auto-import - Unified Vite Plugin\n *\n * Main entry point that combines script and template auto-import plugins.\n * Both plugins share the same import registry for consistent resolution.\n */\n\nimport type { PluginOption } from \"vite\";\nimport { createScriptPlugin } from \"../script/plugin\";\nimport { createTemplatePlugin } from \"../template/plugin\";\nimport type { AutoImportPluginOptions, ImportRegistry } from \"../types\";\n\nfunction resolveDtsDirectory(dts: string | false | undefined): string | false {\n if (dts === false) return false;\n if (typeof dts === \"string\") return dts;\n return \".kimesh\";\n}\n\nexport function autoImportPlugin(\n options: AutoImportPluginOptions\n): PluginOption[] {\n const { dts = \".kimesh\", debug = false } = options;\n\n let sharedRegistry: ImportRegistry | null = null;\n\n const scriptPlugin = createScriptPlugin({\n ...options,\n onRegistryUpdate: (registry) => {\n sharedRegistry = registry;\n },\n });\n\n const templatePlugin = createTemplatePlugin({\n getRegistry: () => sharedRegistry,\n dts: resolveDtsDirectory(dts),\n debug,\n });\n\n return [scriptPlugin, templatePlugin];\n}\n\nexport const kimeshAutoImport = autoImportPlugin;\n\nexport default autoImportPlugin;\n","/**\n * @kimesh/auto-import\n *\n * OXC-powered auto-import system for Kimesh framework with layer support.\n *\n * Features:\n * - High-performance export scanning using OXC parser\n * - Layer-aware import resolution with priority-based conflict handling\n * - Automatic type declaration generation\n * - Built-in presets for Vue, Vue Router, TanStack Query, and Pinia\n * - Clear separation between script and template auto-import\n *\n * Architecture:\n * - `script/` - Handles composables, utilities, presets in <script> blocks\n * - `template/` - Handles components in <template> via unplugin-vue-components\n * - `registry/` - Shared import registry with conflict resolution\n * - `types/` - Type declaration generation\n * - `vite/` - Unified plugin entry point\n *\n * @packageDocumentation\n */\n\n// Type exports\nexport type {\n // Core types\n ImportEntry,\n ImportRegistry,\n ConflictReport,\n ExportInfo,\n ScanResult,\n UnresolvedReference,\n TransformResult,\n\n // Configuration types\n ImportPreset,\n AutoImportConfig,\n LayerAutoImportSource,\n AutoImportPluginOptions,\n ResolvedLayerInfo,\n} from \"./types\";\n\n// Scanner (legacy location, prefer script/ imports)\nexport { OxcExportScanner } from \"./scanner/oxc-scanner\";\nexport { ReferenceDetector } from \"./scanner/reference-detector\";\n\n// Registry\nexport { RegistryBuilder } from \"./registry/builder\";\nexport { ConflictResolver } from \"./registry/conflict-resolver\";\n\n// Script module exports\nexport {\n createScriptPlugin,\n ImportInjector,\n type ScriptPluginOptions,\n type InjectionResult,\n} from \"./script\";\n\n// Template module exports\nexport {\n createTemplatePlugin,\n createKimeshResolver,\n type TemplatePluginOptions,\n type KimeshResolverOptions,\n} from \"./template\";\n\n// Presets\nexport {\n vuePreset,\n vueRouterPreset,\n tanstackQueryPreset,\n piniaPreset,\n kimeshPreset,\n builtinPresets,\n normalizePreset,\n resolvePresets,\n} from \"./presets\";\n\n// Type generation\nexport { generateDtsFiles, generateSourceDts } from \"./types/generator\";\n\n// Vite plugins (unified entry)\nexport {\n autoImportPlugin,\n kimeshAutoImport,\n default as default,\n} from \"./vite/plugin\";\n\n// Backward compatibility: export createComponentsPlugin from vite/components\nexport { createComponentsPlugin } from \"./vite/components\";\n\n/**\n * Build import registry from sources (convenience function)\n */\nexport async function buildImportRegistry(\n sources: import(\"./types\").LayerAutoImportSource[]\n) {\n const { RegistryBuilder } = await import(\"./registry/builder\");\n const builder = new RegistryBuilder();\n return builder.build(sources);\n}\n\n/**\n * Scan exports from a file (convenience function)\n */\nexport async function scanExports(filePath: string) {\n const { OxcExportScanner } = await import(\"./scanner/oxc-scanner\");\n const scanner = new OxcExportScanner();\n return scanner.scanFile(filePath);\n}\n\n// Convenience alias for backward compatibility\nexport { generateDtsFiles as generateDts } from \"./types/generator\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,MAAM,UAAU,IAAI,IAAI;CAEtB;CAAa;CAAQ;CAAQ;CAAS;CAAO;CAC7C;CAAU;CAAS;CAAU;CAAU;CAAW;CAAU;CAC5D;CAAY;CAAQ;CAAU;CAAS;CAAa;CACpD;CAAc;CAAkB;CAAa;CAC7C;CAAO;CAAO;CAAW;CAAW;CAAW;CAAS;CACxD;CAAQ;CAAQ;CAAW;CAAU;CAAY;CACjD;CAAc;CAAe;CAAgB;CAC7C;CAAS;CAAW;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;AACvD,KACE,eACA,YAAY,SAAS,YACrB,sBAAsB,KAAK,cAAc,CAEzC,QAAO;;AAMX,SAAS,sBACP,GACA,MACA,QACA,aACM;CACN,IAAI,cAAc;AAClB,QAAO,MAAM;EACX,MAAM,MAAM,KAAK,QAAQ,QAAQ,YAAY;AAC7C,MAAI,QAAQ,GAAI;AAChB,IAAE,UAAU,KAAK,MAAM,OAAO,QAAQ,YAAY;AAClD,gBAAc,MAAM,OAAO;;;;;;ACjJ/B,SAAS,oBAAoB,KAAiD;AAC5E,KAAI,QAAQ,MAAO,QAAO;AAC1B,KAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,QAAO;;AAGT,SAAgB,iBACd,SACgB;CAChB,MAAM,EAAE,MAAM,WAAW,QAAQ,UAAU;CAE3C,IAAI,iBAAwC;AAe5C,QAAO,CAbc,mBAAmB;EACtC,GAAG;EACH,mBAAmB,aAAa;AAC9B,oBAAiB;;EAEpB,CAAC,EAEqB,qBAAqB;EAC1C,mBAAmB;EACnB,KAAK,oBAAoB,IAAI;EAC7B;EACD,CAAC,CAEmC;;AAGvC,MAAa,mBAAmB;AAEhC,qBAAe;;;;;;;ACkDf,eAAsB,oBACpB,SACA;CACA,MAAM,EAAE,uCAAoB,MAAM,OAAO;AAEzC,QADgB,IAAIC,mBAAiB,CACtB,MAAM,QAAQ;;;;;AAM/B,eAAsB,YAAY,UAAkB;CAClD,MAAM,EAAE,yCAAqB,MAAM,OAAO;AAE1C,QADgB,IAAIC,oBAAkB,CACvB,SAAS,SAAS"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"oxc-scanner-DrjjlY9k.mjs","names":["parseSFC"],"sources":["../src/scanner/oxc-scanner.ts"],"sourcesContent":["/**\n * @kimesh/auto-import - OXC Export Scanner\n *\n * High-performance export scanning using OXC parser.\n */\n\nimport { parseSync, type Program } from 'oxc-parser';\nimport { parse as parseSFC } from '@vue/compiler-sfc';\nimport * as fs from 'node:fs';\nimport * as path from 'pathe';\nimport { createHash } from 'node:crypto';\nimport { consola } from 'consola';\nimport type { ExportInfo, ScanResult } from '../types';\n\nconst logger = consola.withTag('kimesh:auto-import:scanner');\n\ninterface ScanCache {\n version: string;\n entries: Map<string, { hash: string; result: ScanResult }>;\n}\n\nexport class OxcExportScanner {\n private cache: ScanCache = { version: '1.0', entries: new Map() };\n\n async scanFile(filePath: string): Promise<ScanResult> {\n const startTime = performance.now();\n\n let content: string;\n try {\n content = fs.readFileSync(filePath, 'utf-8');\n } catch {\n logger.warn(`Could not read file: ${filePath}`);\n return {\n filePath,\n fileHash: '',\n exports: [],\n parseTime: performance.now() - startTime,\n };\n }\n\n const fileHash = this.hashContent(content);\n const cached = this.cache.entries.get(filePath);\n if (cached && cached.hash === fileHash) {\n return cached.result;\n }\n\n const exports = filePath.endsWith('.vue')\n ? this.scanVueFile(content, filePath)\n : this.scanTsFile(content, filePath);\n\n const result: ScanResult = {\n filePath,\n fileHash,\n exports,\n parseTime: performance.now() - startTime,\n };\n\n this.cache.entries.set(filePath, { hash: fileHash, result });\n return result;\n }\n\n async scanFiles(filePaths: string[]): Promise<ScanResult[]> {\n const startTime = performance.now();\n const results = await Promise.all(filePaths.map((fp) => this.scanFile(fp)));\n const totalTime = performance.now() - startTime;\n\n logger.debug(\n `Scanned ${filePaths.length} files in ${totalTime.toFixed(1)}ms ` +\n `(${(totalTime / filePaths.length).toFixed(2)}ms/file avg)`\n );\n\n return results;\n }\n\n private scanTsFile(content: string, filePath: string): ExportInfo[] {\n try {\n const result = parseSync(filePath, content, { sourceType: 'module' });\n\n if (result.errors.length > 0) {\n logger.debug(`Parse errors in ${filePath}: ${result.errors.length} errors`);\n return [];\n }\n\n return this.extractExports(result.program);\n } catch (error) {\n logger.debug(`Failed to parse ${filePath}: ${error}`);\n return [];\n }\n }\n\n private scanVueFile(content: string, filePath: string): ExportInfo[] {\n try {\n const { descriptor, errors } = parseSFC(content, { filename: filePath });\n\n if (errors.length > 0) {\n logger.debug(`SFC parse errors in ${filePath}: ${errors.length} errors`);\n return [];\n }\n\n const componentName = this.componentNameFromPath(filePath);\n const exports: ExportInfo[] = [\n { name: componentName, isDefault: true, isType: false, start: 0, end: 0 },\n ];\n\n if (descriptor.script) {\n const scriptExports = this.scanTsFile(descriptor.script.content, filePath);\n const namedExports = scriptExports.filter((e) => !e.isDefault);\n exports.push(...namedExports);\n }\n\n if (descriptor.scriptSetup) {\n const exposeExports = this.extractDefineExposeExports(\n descriptor.scriptSetup.content,\n filePath\n );\n exports.push(...exposeExports);\n }\n\n return exports;\n } catch (error) {\n logger.debug(`Failed to parse Vue file ${filePath}: ${error}`);\n return [];\n }\n }\n\n private extractExports(program: Program): ExportInfo[] {\n const exports: ExportInfo[] = [];\n\n for (const node of program.body) {\n if (node.type === 'ExportNamedDeclaration') {\n this.extractNamedExports(node, exports);\n } else if (node.type === 'ExportDefaultDeclaration') {\n this.extractDefaultExport(node, exports);\n }\n }\n\n return exports;\n }\n\n private extractNamedExports(node: any, exports: ExportInfo[]): void {\n if (node.declaration) {\n const names = this.extractDeclarationNames(node.declaration);\n for (const name of names) {\n exports.push({\n name,\n isDefault: false,\n isType: node.exportKind === 'type',\n start: node.start,\n end: node.end,\n });\n }\n }\n\n if (node.specifiers) {\n for (const spec of node.specifiers) {\n const exportedName = spec.exported?.name || spec.local?.name;\n if (exportedName) {\n exports.push({\n name: exportedName,\n isDefault: false,\n isType: spec.exportKind === 'type',\n start: spec.start,\n end: spec.end,\n });\n }\n }\n }\n }\n\n private extractDefaultExport(node: any, exports: ExportInfo[]): void {\n const name = node.declaration?.id?.name ?? 'default';\n exports.push({\n name,\n isDefault: true,\n isType: false,\n start: node.start,\n end: node.end,\n });\n }\n\n private extractDeclarationNames(declaration: any): string[] {\n const names: string[] = [];\n\n if (declaration.type === 'VariableDeclaration') {\n for (const decl of declaration.declarations) {\n if (decl.id.type === 'Identifier') {\n names.push(decl.id.name);\n } else if (decl.id.type === 'ObjectPattern') {\n for (const prop of decl.id.properties) {\n if (prop.value?.name) {\n names.push(prop.value.name);\n }\n }\n }\n }\n } else if (declaration.id?.name) {\n names.push(declaration.id.name);\n }\n\n return names;\n }\n\n private extractDefineExposeExports(content: string, filePath: string): ExportInfo[] {\n const exports: ExportInfo[] = [];\n\n try {\n const result = parseSync(filePath + '.setup.ts', content, { sourceType: 'module' });\n\n this.walkAST(result.program, (node: any) => {\n if (\n node.type === 'CallExpression' &&\n node.callee?.type === 'Identifier' &&\n node.callee.name === 'defineExpose' &&\n node.arguments?.[0]?.type === 'ObjectExpression'\n ) {\n for (const prop of node.arguments[0].properties) {\n if (prop.key?.name) {\n exports.push({\n name: prop.key.name,\n isDefault: false,\n isType: false,\n start: prop.start,\n end: prop.end,\n });\n }\n }\n }\n });\n } catch {\n // Ignore parse errors for expose extraction\n }\n\n return exports;\n }\n\n private walkAST(node: any, visitor: (node: any) => void): void {\n if (!node || typeof node !== 'object') return;\n\n visitor(node);\n\n for (const key of Object.keys(node)) {\n const child = node[key];\n if (Array.isArray(child)) {\n for (const item of child) {\n this.walkAST(item, visitor);\n }\n } else if (child && typeof child === 'object') {\n this.walkAST(child, visitor);\n }\n }\n }\n\n private componentNameFromPath(filePath: string): string {\n const basename = path.basename(filePath, path.extname(filePath));\n return basename === 'index' ? path.basename(path.dirname(filePath)) : basename;\n }\n\n private hashContent(content: string): string {\n return createHash('md5').update(content).digest('hex').slice(0, 8);\n }\n\n invalidate(filePath: string): void {\n this.cache.entries.delete(filePath);\n }\n\n clearCache(): void {\n this.cache.entries.clear();\n }\n\n getCacheStats(): { size: number; version: string } {\n return { size: this.cache.entries.size, version: this.cache.version };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,SAAS,QAAQ,QAAQ,6BAA6B;AAO5D,IAAa,mBAAb,MAA8B;CAC5B,AAAQ,QAAmB;EAAE,SAAS;EAAO,yBAAS,IAAI,KAAK;EAAE;CAEjE,MAAM,SAAS,UAAuC;EACpD,MAAM,YAAY,YAAY,KAAK;EAEnC,IAAI;AACJ,MAAI;AACF,a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