@getmikk/core 2.0.17 → 2.0.18
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/package.json
CHANGED
|
@@ -209,7 +209,8 @@ export class LockCompiler {
|
|
|
209
209
|
const params = metadata.params || []
|
|
210
210
|
const returnType = metadata.returnType || 'void'
|
|
211
211
|
const signatureHash = hashContent(`${displayName}(${params.map(p => p.type).join(',')}):${returnType}`)
|
|
212
|
-
|
|
212
|
+
// Token vector generation is slow - skip for now, semantic search uses embeddings anyway
|
|
213
|
+
// const tokenVector = this.generateTokenVector(displayName, params, returnType, metadata.purpose)
|
|
213
214
|
|
|
214
215
|
result[id] = {
|
|
215
216
|
id,
|
|
@@ -234,13 +235,13 @@ export class LockCompiler {
|
|
|
234
235
|
edgeCasesHandled: metadata.edgeCasesHandled,
|
|
235
236
|
errorHandling: metadata.errorHandling,
|
|
236
237
|
signatureHash,
|
|
237
|
-
tokenVector,
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
return result
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/** @deprecated Token vectors are no longer generated - semantic search uses embeddings instead */
|
|
244
245
|
private generateTokenVector(
|
|
245
246
|
name: string,
|
|
246
247
|
params: Array<{ name: string; type: string; optional?: boolean }>,
|
|
@@ -395,19 +396,46 @@ export class LockCompiler {
|
|
|
395
396
|
parsedFiles: ParsedFile[]
|
|
396
397
|
): Record<string, MikkLock['modules'][string]> {
|
|
397
398
|
const result: Record<string, MikkLock['modules'][string]> = {}
|
|
398
|
-
|
|
399
|
-
// Build
|
|
399
|
+
|
|
400
|
+
// Build file hash map
|
|
400
401
|
const fileHashMap = new Map<string, string>()
|
|
401
402
|
for (const file of parsedFiles) {
|
|
402
403
|
fileHashMap.set(file.path, file.hash)
|
|
403
404
|
}
|
|
404
|
-
|
|
405
|
+
|
|
406
|
+
// Pre-compute normalized paths for all files (do once)
|
|
407
|
+
const filePathCache = parsedFiles.map(f => ({
|
|
408
|
+
path: f.path,
|
|
409
|
+
normalizedRelative: getModuleMatchPath(f.path, this.projectRootPath).replace(/\\/g, '/').toLowerCase(),
|
|
410
|
+
normalizedAbsolute: f.path.replace(/\\/g, '/').toLowerCase(),
|
|
411
|
+
isVendor: this.isVendorPath(f.path)
|
|
412
|
+
}))
|
|
413
|
+
|
|
414
|
+
// For each module, find matching files
|
|
405
415
|
for (const module of contract.declared.modules) {
|
|
406
416
|
const moduleFiles: string[] = []
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
417
|
+
|
|
418
|
+
// Pre-compute normalized patterns for this module
|
|
419
|
+
const normalizedProjectRoot = this.projectRootPath
|
|
420
|
+
? this.projectRootPath.replace(/\\/g, '/').toLowerCase()
|
|
421
|
+
: null
|
|
422
|
+
const patterns = module.paths.map(p => {
|
|
423
|
+
const np = p.replace(/\\/g, '/').toLowerCase()
|
|
424
|
+
return normalizedProjectRoot && np.startsWith(`${normalizedProjectRoot}/`)
|
|
425
|
+
? np.slice(normalizedProjectRoot.length + 1)
|
|
426
|
+
: np
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
// Check each file against this module's patterns
|
|
430
|
+
for (let i = 0; i < filePathCache.length; i++) {
|
|
431
|
+
const f = filePathCache[i]
|
|
432
|
+
if (f.isVendor) continue
|
|
433
|
+
|
|
434
|
+
for (const pattern of patterns) {
|
|
435
|
+
if (minimatch(f.normalizedRelative, pattern) || minimatch(f.normalizedAbsolute, pattern)) {
|
|
436
|
+
moduleFiles.push(f.path)
|
|
437
|
+
break // found match, no need to check more patterns
|
|
438
|
+
}
|
|
411
439
|
}
|
|
412
440
|
}
|
|
413
441
|
|