@interlace/eslint-devkit 2.0.4 → 2.1.1
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlace/eslint-devkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "ESLint plugin toolkit for building ESLint plugins in TypeScript — AST helpers, type utilities, rule-creation scaffolding, security benchmarks, and SARIF output.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"auto-fix"
|
|
64
64
|
],
|
|
65
65
|
"engines": {
|
|
66
|
-
"node": "
|
|
66
|
+
"node": "^20.19.0 || ^22.13.0 || >=24"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@typescript-eslint/utils": "^7.0.0 || ^8.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PERFORMANCE_DOCS=void 0;exports.clearExportKindCache=clearExportKindCache;exports.exportKindsOf=exportKindsOf;exports.createLRUCache=createLRUCache;exports.isDefinitelyExternal=isDefinitelyExternal;exports.createFileSystemCache=createFileSystemCache;exports.clearCache=clearCache;exports.invalidateSCCCache=invalidateSCCCache;exports.getFileHash=getFileHash;exports.isCacheValid=isCacheValid;exports.fileExists=fileExists;exports.patternToRegexWithCache=patternToRegexWithCache;exports.shouldIgnoreFileWithCache=shouldIgnoreFileWithCache;exports.resolveImportPath=resolveImportPath;exports.getFileImports=getFileImports;exports.hasOnlyTypeImports=hasOnlyTypeImports;exports.computeSCCsFromFile=computeSCCsFromFile;exports.isFileInCycle=isFileInCycle;exports.findShortestCyclePath=findShortestCyclePath;exports.getCycleForFile=getCycleForFile;exports.detectCycleFromImport=detectCycleFromImport;exports.findAllCircularDependencies=findAllCircularDependencies;exports.getMinimalCycle=getMinimalCycle;exports.getCycleHash=getCycleHash;exports.saveCacheToDisk=saveCacheToDisk;exports.loadCacheFromDisk=loadCacheFromDisk;exports.getFilesNeedingReanalysis=getFilesNeedingReanalysis;exports.isIncrementalAvailable=isIncrementalAvailable;const resolver_1=require("./resolver");const node_fs_1=require("node:fs");const fs_1=require("../node/fs");const path_1=require("../node/path");const LRU_MAX_SIZE=5e4;const EXTERNAL_MODULE_PATTERNS=[/^node:/,/^[a-z@][^/]*$/,/node_modules/];const KNOWN_EXTERNAL_PACKAGES=new Set(["react","react-dom","vue","angular","svelte","lodash","underscore","ramda","rxjs","express","koa","fastify","hapi","axios","fetch","node-fetch","got","fs","path","url","http","https","crypto","util","os","child_process","typescript","eslint","prettier","jest","vitest","mocha","webpack","rollup","vite","esbuild","parcel"]);const IMPORT_REGEX=/import\s+(?:(?:[\w*{}\s,]|'[^'\n]*'|"[^"\n]*")+\s+from\s+)?['"]([^'"]+)['"]/g;const DYNAMIC_IMPORT_REGEX=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;const TYPE_IMPORT_REGEX=/import\s+type\s/;const EXPORT_FROM_REGEX=/export\s+\{[\s\S]*?\}\s+from\s+['"]([^'"]+)['"]/g;const BRACED_CLAUSE_ONLY=/^import\s+\{([^}]*)\}\s+from\s+['"]/;const INLINE_TYPE_BINDING=/^type\s+(?!as(?:\s|$))/;function importsOnlyInlineTypes(statement){const clause=BRACED_CLAUSE_ONLY.exec(statement);if(!clause)return false;const bindings=clause[1].split(",").map(binding=>binding.trim()).filter(Boolean);if(!bindings.length)return false;return bindings.every(binding=>INLINE_TYPE_BINDING.test(binding))}const EXPORT_ALL_REGEX=/export\s*\*\s*(?:as\s+[\w$]+\s+)?from\s+['"]([^'"]+)['"]/g;const TOP_LEVEL_REQUIRE_REGEX=/^(?:(?:const|let|var)\s+[\w${}\s,:]+=\s*|import\s+[\w$]+\s*=\s*)?require\s*\(\s*['"]([^'"]+)['"]\s*\)/gm;const exportKindCache=new Map;function clearExportKindCache(){exportKindCache.clear()}function exportKindsOf(target,resolve,visiting=new Set){const hit=exportKindCache.get(target);if(hit)return hit;const kinds=new Map;if(visiting.has(target))return kinds;visiting.add(target);const source=(0,fs_1.readFileSync)(target,"utf-8")??"";const set=(name,kind)=>{if(kinds.get(name)!=="value")kinds.set(name,kind)};for(const m of source.matchAll(/export\s+(?:declare\s+)?(?:abstract\s+)?(?:const|let|var|function|class|enum|namespace|module)\s+([A-Za-z_$][\w$]*)/g)){set(m[1],"value")}for(const m of source.matchAll(/export\s+(?:declare\s+)?(?:interface|type)\s+([A-Za-z_$][\w$]*)/g)){set(m[1],"type")}if(resolve){const local=new Map;for(const m of source.matchAll(/^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:(const|let|var|function|class|enum|namespace|module)|(interface|type))\s+([A-Za-z_$][\w$]*)/gm)){if(local.get(m[3])!=="value")local.set(m[3],m[1]?"value":"type")}const kindIn=(from,name)=>{if(from===void 0)return local.get(name);const file=resolve(from,target);return file?exportKindsOf(file,resolve,visiting).get(name):void 0};for(const m of source.matchAll(/export\s+(type\s+)?\{([^}]*)\}(?:\s*from\s*['"]([^'"]+)['"])?/g)){for(const raw of m[2].split(",")){const spec=raw.trim();if(!spec)continue;const inlineType=/^type\s+(?!as(?:\s|$))/.test(spec);const[orig,alias]=spec.replace(/^type\s+(?!as(?:\s|$))/,"").split(/\s+as\s+/);const exported=(alias??orig).trim();const kind=m[1]||inlineType?"type":kindIn(m[3],orig.trim());if(kind)set(exported,kind)}}for(const m of source.matchAll(/export\s+(type\s+)?\*\s*from\s*['"]([^'"]+)['"]/g)){const file=resolve(m[2],target);if(!file)continue;for(const[name,kind]of exportKindsOf(file,resolve,visiting)){if(!kinds.has(name))kinds.set(name,m[1]?"type":kind)}}}visiting.delete(target);exportKindCache.set(target,kinds);return kinds}function importsOnlyTypesFrom(statement,target,resolve){const clause=BRACED_CLAUSE_ONLY.exec(statement);if(!clause)return false;const bindings=clause[1].split(",").map(binding=>binding.trim()).filter(Boolean);if(!bindings.length)return false;const kinds=exportKindsOf(target,resolve);return bindings.every(binding=>INLINE_TYPE_BINDING.test(binding)||kinds.get(binding.split(/\s+as\s+/)[0])==="type")}const DEFAULT_EXTENSIONS=[".ts",".tsx",".js",".jsx"];class LRUCache{cache=new Map;maxSize;constructor(maxSize=LRU_MAX_SIZE){this.maxSize=maxSize}get(key){const value=this.cache.get(key);if(value!==void 0){this.cache.delete(key);this.cache.set(key,value)}return value}set(key,value){if(this.cache.has(key)){this.cache.delete(key)}else if(this.cache.size>=this.maxSize){const firstKey=this.cache.keys().next().value;if(firstKey!==void 0){this.cache.delete(firstKey)}}this.cache.set(key,value)}has(key){return this.cache.has(key)}delete(key){return this.cache.delete(key)}clear(){this.cache.clear()}get size(){return this.cache.size}}function createLRUCache(maxSize=LRU_MAX_SIZE){return new LRUCache(maxSize)}function isDefinitelyExternal(importPath){const packageName=importPath.split("/")[0].replace(/^@[^/]+\//,"");if(KNOWN_EXTERNAL_PACKAGES.has(packageName)){return true}return EXTERNAL_MODULE_PATTERNS.some(pattern=>pattern.test(importPath))}function createFileSystemCache(){return{dependencies:new Map,fileExists:new Map,fileHashes:new Map,compiledPatterns:(0,path_1.createPatternCache)(),reportedCycles:new Set,sccIndex:new Map,sccs:[],sccComputed:false,graphHash:"",resolvedPaths:new Map,nonCyclicFiles:new Set,pendingCycleReports:new Map}}function clearCache(cache){cache.dependencies.clear();cache.fileExists.clear();cache.fileHashes.clear();cache.compiledPatterns.clear();cache.reportedCycles.clear();cache.sccIndex.clear();cache.sccs=[];cache.sccComputed=false;cache.graphHash="";cache.resolvedPaths=new Map;cache.nonCyclicFiles.clear();cache.pendingCycleReports.clear()}function invalidateSCCCache(cache){cache.sccIndex.clear();cache.sccs=[];cache.sccComputed=false;cache.nonCyclicFiles.clear()}function getFileHash(filePath){const stats=(0,fs_1.statSync)(filePath);if(!stats){return null}return`${stats.mtimeMs}-${stats.size}`}function isCacheValid(filePath,cache){const cachedHash=cache.fileHashes.get(filePath);if(!cachedHash)return false;const currentHash=getFileHash(filePath);return cachedHash===currentHash}function fileExists(filePath,cache){const cached=cache.fileExists.get(filePath);if(cached!==void 0){return cached}const exists=(0,fs_1.fileExistsSync)(filePath);cache.fileExists.set(filePath,exists);return exists}function patternToRegexWithCache(pattern,cache){return(0,path_1.patternToRegex)(pattern,cache.compiledPatterns)}function shouldIgnoreFileWithCache(file,patterns,cache){return(0,path_1.shouldIgnoreFile)(file,patterns,cache.compiledPatterns)}function resolveImportPath(importPath,options){const fromFile=options.fromFile;const extensions=options.extensions||DEFAULT_EXTENSIONS;const cache=options.cache;const resolverSettings=options.resolverSettings;if(isDefinitelyExternal(importPath)){if(!importPath.startsWith("@")){return null}}const isRelative=importPath.startsWith(".");if(!isRelative){const globalCached=cache.resolvedPaths.get(importPath);if(globalCached!==void 0){return globalCached}}const cacheKey=isRelative?`${fromFile}::${importPath}`:importPath;const cached=cache.resolvedPaths.get(cacheKey);if(cached!==void 0){return cached}let result=(0,resolver_1.resolveModule)(importPath,fromFile,{extensions,mainFields:["module","main"],resolverSettings});if(result&&!isRelative&&result.includes("node_modules")){try{const realPath=(0,node_fs_1.realpathSync)(result);if(realPath.includes("node_modules")){cache.resolvedPaths.set(cacheKey,null);return null}result=realPath}catch{cache.resolvedPaths.set(cacheKey,null);return null}}if(!result&&isRelative){result=(0,path_1.resolvePath)((0,path_1.getDirname)(fromFile),importPath)}cache.resolvedPaths.set(cacheKey,result);return result}function getFileImports(file,options){const{workspaceRoot,barrelExports,cache,resolverSettings}=options;const cached=cache.dependencies.get(file);if(cached){return cached}const imports=[];try{if(!fileExists(file,cache)){return imports}const content=(0,fs_1.readFileSync)(file,"utf-8");if(content===null){return imports}const resolveOpts={fromFile:file,workspaceRoot,barrelExports,cache,extensions:DEFAULT_EXTENSIONS,resolverSettings};IMPORT_REGEX.lastIndex=0;DYNAMIC_IMPORT_REGEX.lastIndex=0;EXPORT_FROM_REGEX.lastIndex=0;let match;const seen=new Map;const pushImport=(importPath,dynamic=false,typeOnly=false,inlineTypeOnly=false)=>{const resolved=resolveImportPath(importPath,resolveOpts);if(!resolved||!fileExists(resolved,cache))return;const existing=seen.get(resolved);if(existing){if(dynamic)return;if(!typeOnly&&!inlineTypeOnly){delete existing.typeOnly;delete existing.inlineTypeOnly}else if(inlineTypeOnly&&existing.typeOnly){delete existing.typeOnly;existing.inlineTypeOnly=true}return}const info={path:resolved,source:importPath};if(dynamic)info.dynamic=true;if(typeOnly)info.typeOnly=true;if(inlineTypeOnly)info.inlineTypeOnly=true;seen.set(resolved,info);imports.push(info)};while((match=IMPORT_REGEX.exec(content))!==null){const isTypeImport=/^import\s+type[\s{]/.test(match[0]);let inlineTypeOnly=false;if(!isTypeImport){const target=resolveImportPath(match[1],resolveOpts);inlineTypeOnly=importsOnlyInlineTypes(match[0])||target!==null&&importsOnlyTypesFrom(match[0],target,(spec,fromFile)=>resolveImportPath(spec,{...resolveOpts,fromFile}))}pushImport(match[1],false,isTypeImport,inlineTypeOnly)}while((match=EXPORT_FROM_REGEX.exec(content))!==null)pushImport(match[1]);EXPORT_ALL_REGEX.lastIndex=0;while((match=EXPORT_ALL_REGEX.exec(content))!==null)pushImport(match[1]);TOP_LEVEL_REQUIRE_REGEX.lastIndex=0;while((match=TOP_LEVEL_REQUIRE_REGEX.exec(content))!==null)pushImport(match[1]);while((match=DYNAMIC_IMPORT_REGEX.exec(content))!==null)pushImport(match[1],true);const hash=getFileHash(file);if(hash){const oldHash=cache.fileHashes.get(file);if(oldHash!==hash){invalidateSCCCache(cache)}cache.fileHashes.set(file,hash)}}catch{}cache.dependencies.set(file,imports);return imports}function hasOnlyTypeImports(cycle,cache){for(const file of cycle){if(!fileExists(file,cache))continue;const content=(0,fs_1.readFileSync)(file,"utf-8");if(content===null)return false;const hasRuntimeImport=!TYPE_IMPORT_REGEX.test(content)&&IMPORT_REGEX.test(content);IMPORT_REGEX.lastIndex=0;if(hasRuntimeImport){return false}}return true}function computeSCCsFromFile(startFile,options){try{startFile=(0,node_fs_1.realpathSync)(startFile)}catch{}const{workspaceRoot,barrelExports,cache,resolverSettings}=options;if(cache.sccComputed&&cache.sccs.length>0&&cache.sccIndex.has(startFile)){return cache.sccs}const state={index:0,stack:[],onStack:new Set,indices:new Map,lowlinks:new Map,sccs:[]};const visited=new Set;const filesToProcess=[startFile];while(filesToProcess.length>0){const file=filesToProcess.pop();if(visited.has(file))continue;visited.add(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(!imp.dynamic&&!isErasedEdge(imp,options)&&!visited.has(imp.path)){filesToProcess.push(imp.path)}}}for(const file of visited){if(!state.indices.has(file)){tarjanStrongConnect(file,state,options,0)}}const newResults=state.sccs.map(files=>({files,hasCycle:files.length>1}));const offset=cache.sccs.length;cache.sccs.push(...newResults);cache.sccComputed=true;for(let i=0;i<newResults.length;i++){for(const file of newResults[i].files){if(!cache.sccIndex.has(file)){cache.sccIndex.set(file,offset+i)}}}for(const result of newResults){if(result.hasCycle){for(const file of result.files){cache.nonCyclicFiles.delete(file)}}else{for(const file of result.files){cache.nonCyclicFiles.add(file)}}}return cache.sccs}function tarjanStrongConnect(file,state,options,depth){const{maxDepth,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(depth>maxDepth){return}const enter=(node,nodeDepth)=>{state.indices.set(node,state.index);state.lowlinks.set(node,state.index);state.index++;state.stack.push(node);state.onStack.add(node);const imports=getFileImports(node,{workspaceRoot,barrelExports,cache,resolverSettings});const successors=[];for(const imp of imports){if(imp.dynamic||isErasedEdge(imp,options))continue;successors.push(imp.path)}return{file:node,depth:nodeDepth,successors,next:0}};const relax=(node,candidate)=>{state.lowlinks.set(node,Math.min(state.lowlinks.get(node),candidate))};const frames=[enter(file,depth)];while(frames.length>0){const frame=frames[frames.length-1];if(frame.next<frame.successors.length){const successor=frame.successors[frame.next++];if(!state.indices.has(successor)){if(frame.depth+1>maxDepth){relax(frame.file,0);continue}frames.push(enter(successor,frame.depth+1))}else if(state.onStack.has(successor)){relax(frame.file,state.indices.get(successor))}continue}frames.pop();const lowlink=state.lowlinks.get(frame.file);const index=state.indices.get(frame.file);if(lowlink===index){const scc=[];let w;do{w=state.stack.pop();state.onStack.delete(w);scc.push(w)}while(w!==frame.file);state.sccs.push(scc)}const parent=frames[frames.length-1];if(parent){relax(parent.file,state.lowlinks.get(frame.file))}}}function isFileInCycle(file,cache){const sccIndex=cache.sccIndex.get(file);if(sccIndex===void 0)return false;const scc=cache.sccs[sccIndex];return scc&&scc.hasCycle}function findShortestCyclePath(sourceFile,targetFile,options){const{workspaceRoot,barrelExports,cache,resolverSettings}=options;const maxDepth=options.maxDepth??Infinity;const srcSCC=cache.sccIndex.get(sourceFile);if(srcSCC===void 0)return null;const queue=[[targetFile]];const visited=new Set([targetFile]);while(queue.length>0){const path=queue.shift();if(path.length>maxDepth)break;const current=path[path.length-1];const imports=getFileImports(current,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(imp.dynamic||isErasedEdge(imp,options))continue;if(imp.path===sourceFile){return[...path,sourceFile]}if(visited.has(imp.path))continue;if(cache.sccIndex.get(imp.path)!==srcSCC)continue;visited.add(imp.path);queue.push([...path,imp.path])}}return null}function getCycleForFile(file,cache){const sccIndex=cache.sccIndex.get(file);if(sccIndex===void 0)return null;const scc=cache.sccs[sccIndex];if(!scc||!scc.hasCycle)return null;return scc.files}function isErasedEdge(imp,options){if(imp.typeOnly)return true;return Boolean(imp.inlineTypeOnly)&&!options.verbatimModuleSyntax}function detectCycleFromImport(sourceFile,targetFile,options){try{sourceFile=(0,node_fs_1.realpathSync)(sourceFile)}catch{}try{targetFile=(0,node_fs_1.realpathSync)(targetFile)}catch{}const{maxDepth,reportAllCycles,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(cache.nonCyclicFiles.has(targetFile)){return[]}const allCycles=[];const pathStack=[sourceFile];let depthLimitHit=false;function dfs(file,depth,visited2){if(file===sourceFile){allCycles.push([...pathStack,file]);return}if(depth>=maxDepth){depthLimitHit=true;return}if(visited2.has(file))return;if(cache.nonCyclicFiles.has(file))return;visited2.add(file);pathStack.push(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(imp.dynamic)continue;if(!reportAllCycles&&allCycles.length>0)break;dfs(imp.path,depth+1,visited2)}pathStack.pop()}const visited=new Set;dfs(targetFile,1,visited);if(allCycles.length===0&&!depthLimitHit){cache.nonCyclicFiles.add(targetFile)}return allCycles}function findAllCircularDependencies(file,options,currentPath=[],depth=0,visited=new Set){const{maxDepth,reportAllCycles,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(depth===0){try{file=(0,node_fs_1.realpathSync)(file)}catch{}}if(cache.nonCyclicFiles.has(file)){return[]}if(depth===0){computeSCCsFromFile(file,{maxDepth,workspaceRoot,barrelExports,cache,resolverSettings});if(!isFileInCycle(file,cache)){cache.nonCyclicFiles.add(file);return[]}}if(depth>maxDepth){return[]}if(currentPath.includes(file)){return[[...currentPath,file]]}if(visited.has(file)){return[]}visited.add(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});const newPath=[...currentPath,file];const allCycles=[];for(const imp of imports){if(imp.dynamic){continue}if(!reportAllCycles&&allCycles.length>0){break}const cycles=findAllCircularDependencies(imp.path,options,newPath,depth+1,visited);allCycles.push(...cycles)}if(depth===0&&allCycles.length===0){cache.nonCyclicFiles.add(file)}return allCycles}function getMinimalCycle(cycle){if(cycle.length<2)return cycle;const seen=new Map;for(let i=0;i<cycle.length;i++){const file=cycle[i];if(seen.has(file)){const cycleStart=seen?.get?.(file);return cycle.slice(cycleStart,i+1)}seen.set(file,i)}return cycle}function getCycleHash(cycle){const minimalCycle=getMinimalCycle(cycle);const minIndex=minimalCycle.indexOf(minimalCycle.reduce((min,curr)=>curr<min?curr:min,minimalCycle[0]));const normalized=[...minimalCycle.slice(minIndex),...minimalCycle.slice(0,minIndex)];return normalized.join("->")}const CACHE_VERSION=1;const DEFAULT_CACHE_FILE="node_modules/.cache/forge-eslint/cycles.json";const DEFAULT_MAX_CACHE_AGE=24*60*60*1e3;function saveCacheToDisk(cache,options,workspaceRoot){if(!options.enabled)return;const cacheFile=(0,path_1.resolvePath)(workspaceRoot,options.cacheFile||DEFAULT_CACHE_FILE);const data={version:CACHE_VERSION,createdAt:Date.now(),fileHashes:Object.fromEntries(cache.fileHashes),sccs:cache.sccs,sccIndex:Object.fromEntries(cache.sccIndex),nonCyclicFiles:Array.from(cache.nonCyclicFiles),graphHash:cache.graphHash};const cacheDir=(0,path_1.getDirname)(cacheFile);if(!(0,fs_1.fileExistsSync)(cacheDir)){(0,fs_1.mkdirSync)(cacheDir,{recursive:true})}(0,fs_1.writeFileSync)(cacheFile,JSON.stringify(data),"utf-8")}function loadCacheFromDisk(cache,options,workspaceRoot){if(!options.enabled)return false;const cacheFile=(0,path_1.resolvePath)(workspaceRoot,options.cacheFile||DEFAULT_CACHE_FILE);if(!(0,fs_1.fileExistsSync)(cacheFile)){return false}const content=(0,fs_1.readFileSync)(cacheFile,"utf-8");if(content===null){return false}try{const data=JSON.parse(content);if(data.version!==CACHE_VERSION){return false}const maxAge=options.maxCacheAge??DEFAULT_MAX_CACHE_AGE;if(Date.now()-data.createdAt>maxAge){return false}cache.fileHashes=new Map(Object.entries(data.fileHashes));cache.sccs=data.sccs;cache.sccIndex=new Map(Object.entries(data.sccIndex).map(([k,v])=>[k,v]));cache.nonCyclicFiles=new Set(data.nonCyclicFiles);cache.graphHash=data.graphHash;cache.sccComputed=true;return true}catch{return false}}function getFilesNeedingReanalysis(files,cache,options){if(!options.enabled||!cache.sccComputed){return files}const changedFiles=[];for(const file of files){const cachedHash=cache.fileHashes.get(file);const currentHash=getFileHash(file);if(!cachedHash||cachedHash!==currentHash){changedFiles.push(file)}}if(changedFiles.length>0){const affectedSCCIndices=new Set;for(const file of changedFiles){const sccIndex=cache.sccIndex.get(file);if(sccIndex!==void 0){affectedSCCIndices.add(sccIndex)}}const affectedFiles=new Set(changedFiles);for(const scc of cache.sccs){const sccIndex=cache.sccIndex.get(scc.files[0]);if(sccIndex!==void 0&&affectedSCCIndices.has(sccIndex)){for(const file of scc.files){affectedFiles.add(file);cache.nonCyclicFiles.delete(file)}}}for(const[file,imports]of cache.dependencies){for(const imp of imports){if(changedFiles.includes(imp.path)){affectedFiles.add(file);cache.nonCyclicFiles.delete(file);break}}}return Array.from(affectedFiles)}return[]}function isIncrementalAvailable(cache,options){return Boolean(options?.enabled&&cache.sccComputed&&cache.sccs.length>0)}exports.PERFORMANCE_DOCS={algorithm:"Tarjan SCC + DFS hybrid",timeComplexity:"O(V + E)",spaceComplexity:"O(V)",guaranteedComplete:true};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PERFORMANCE_DOCS=void 0;exports.clearExportKindCache=clearExportKindCache;exports.exportKindsOf=exportKindsOf;exports.createLRUCache=createLRUCache;exports.isDefinitelyExternal=isDefinitelyExternal;exports.createFileSystemCache=createFileSystemCache;exports.clearCache=clearCache;exports.invalidateSCCCache=invalidateSCCCache;exports.getFileHash=getFileHash;exports.isCacheValid=isCacheValid;exports.fileExists=fileExists;exports.patternToRegexWithCache=patternToRegexWithCache;exports.shouldIgnoreFileWithCache=shouldIgnoreFileWithCache;exports.resolveImportPath=resolveImportPath;exports.getFileImports=getFileImports;exports.hasOnlyTypeImports=hasOnlyTypeImports;exports.computeSCCsFromFile=computeSCCsFromFile;exports.isFileInCycle=isFileInCycle;exports.findShortestCyclePath=findShortestCyclePath;exports.getCycleForFile=getCycleForFile;exports.detectCycleFromImport=detectCycleFromImport;exports.findAllCircularDependencies=findAllCircularDependencies;exports.getMinimalCycle=getMinimalCycle;exports.getCycleHash=getCycleHash;exports.saveCacheToDisk=saveCacheToDisk;exports.loadCacheFromDisk=loadCacheFromDisk;exports.getFilesNeedingReanalysis=getFilesNeedingReanalysis;exports.isIncrementalAvailable=isIncrementalAvailable;const resolver_1=require("./resolver");const node_fs_1=require("node:fs");const fs_1=require("../node/fs");const path_1=require("../node/path");const LRU_MAX_SIZE=5e4;const EXTERNAL_MODULE_PATTERNS=[/^node:/,/^[a-z@][^/]*$/,/node_modules/];const KNOWN_EXTERNAL_PACKAGES=new Set(["react","react-dom","vue","angular","svelte","lodash","underscore","ramda","rxjs","express","koa","fastify","hapi","axios","fetch","node-fetch","got","fs","path","url","http","https","crypto","util","os","child_process","typescript","eslint","prettier","jest","vitest","mocha","webpack","rollup","vite","esbuild","parcel"]);const IMPORT_REGEX=/import\s+(?:(?:(?!\bfrom\s+['"])[\w*{}\s,]|'[^'\n]*'|"[^"\n]*")+\s+from\s+)?['"]([^'"]+)['"]/g;const DYNAMIC_IMPORT_REGEX=/import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;const TYPE_IMPORT_REGEX=/import\s+type\s/;const EXPORT_FROM_REGEX=/export\s+\{[\s\S]*?\}\s+from\s+['"]([^'"]+)['"]/g;const BRACED_CLAUSE_ONLY=/^import\s+\{([^}]*)\}\s+from\s+['"]/;const INLINE_TYPE_BINDING=/^type\s+(?!as(?:\s|$))/;function importsOnlyInlineTypes(statement){const clause=BRACED_CLAUSE_ONLY.exec(statement);if(!clause)return false;const bindings=clause[1].split(",").map(binding=>binding.trim()).filter(Boolean);if(!bindings.length)return false;return bindings.every(binding=>INLINE_TYPE_BINDING.test(binding))}const EXPORT_ALL_REGEX=/export\s*\*\s*(?:as\s+[\w$]+\s+)?from\s+['"]([^'"]+)['"]/g;const TOP_LEVEL_REQUIRE_REGEX=/^(?:(?:const|let|var)\s+[\w${}\s,:]+=\s*|import\s+[\w$]+\s*=\s*)?require\s*\(\s*['"]([^'"]+)['"]\s*\)/gm;const exportKindCache=new Map;function clearExportKindCache(){exportKindCache.clear()}function exportKindsOf(target,resolve,visiting=new Set){const hit=exportKindCache.get(target);if(hit)return hit;const kinds=new Map;if(visiting.has(target))return kinds;visiting.add(target);const source=(0,fs_1.readFileSync)(target,"utf-8")??"";const set=(name,kind)=>{if(kinds.get(name)!=="value")kinds.set(name,kind)};for(const m of source.matchAll(/export\s+(?:declare\s+)?(?:abstract\s+)?(?:const|let|var|function|class|enum|namespace|module)\s+([A-Za-z_$][\w$]*)/g)){set(m[1],"value")}for(const m of source.matchAll(/export\s+(?:declare\s+)?(?:interface|type)\s+([A-Za-z_$][\w$]*)/g)){set(m[1],"type")}if(resolve){const local=new Map;for(const m of source.matchAll(/^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:(const|let|var|function|class|enum|namespace|module)|(interface|type))\s+([A-Za-z_$][\w$]*)/gm)){if(local.get(m[3])!=="value")local.set(m[3],m[1]?"value":"type")}const kindIn=(from,name)=>{if(from===void 0)return local.get(name);const file=resolve(from,target);return file?exportKindsOf(file,resolve,visiting).get(name):void 0};for(const m of source.matchAll(/export\s+(type\s+)?\{([^}]*)\}(?:\s*from\s*['"]([^'"]+)['"])?/g)){for(const raw of m[2].split(",")){const spec=raw.trim();if(!spec)continue;const inlineType=/^type\s+(?!as(?:\s|$))/.test(spec);const[orig,alias]=spec.replace(/^type\s+(?!as(?:\s|$))/,"").split(/\s+as\s+/);const exported=(alias??orig).trim();const kind=m[1]||inlineType?"type":kindIn(m[3],orig.trim());if(kind)set(exported,kind)}}for(const m of source.matchAll(/export\s+(type\s+)?\*\s*from\s*['"]([^'"]+)['"]/g)){const file=resolve(m[2],target);if(!file)continue;for(const[name,kind]of exportKindsOf(file,resolve,visiting)){if(!kinds.has(name))kinds.set(name,m[1]?"type":kind)}}}visiting.delete(target);exportKindCache.set(target,kinds);return kinds}function importsOnlyTypesFrom(statement,target,resolve){const clause=BRACED_CLAUSE_ONLY.exec(statement);if(!clause)return false;const bindings=clause[1].split(",").map(binding=>binding.trim()).filter(Boolean);if(!bindings.length)return false;const kinds=exportKindsOf(target,resolve);return bindings.every(binding=>INLINE_TYPE_BINDING.test(binding)||kinds.get(binding.split(/\s+as\s+/)[0])==="type")}const DEFAULT_EXTENSIONS=[".ts",".tsx",".js",".jsx"];class LRUCache{cache=new Map;maxSize;constructor(maxSize=LRU_MAX_SIZE){this.maxSize=maxSize}get(key){const value=this.cache.get(key);if(value!==void 0){this.cache.delete(key);this.cache.set(key,value)}return value}set(key,value){if(this.cache.has(key)){this.cache.delete(key)}else if(this.cache.size>=this.maxSize){const firstKey=this.cache.keys().next().value;if(firstKey!==void 0){this.cache.delete(firstKey)}}this.cache.set(key,value)}has(key){return this.cache.has(key)}delete(key){return this.cache.delete(key)}clear(){this.cache.clear()}get size(){return this.cache.size}}function createLRUCache(maxSize=LRU_MAX_SIZE){return new LRUCache(maxSize)}function isDefinitelyExternal(importPath){const packageName=importPath.split("/")[0].replace(/^@[^/]+\//,"");if(KNOWN_EXTERNAL_PACKAGES.has(packageName)){return true}return EXTERNAL_MODULE_PATTERNS.some(pattern=>pattern.test(importPath))}function createFileSystemCache(){return{dependencies:new Map,fileExists:new Map,fileHashes:new Map,compiledPatterns:(0,path_1.createPatternCache)(),reportedCycles:new Set,sccIndex:new Map,sccs:[],sccComputed:false,graphHash:"",resolvedPaths:new Map,nonCyclicFiles:new Set,pendingCycleReports:new Map}}function clearCache(cache){cache.dependencies.clear();cache.fileExists.clear();cache.fileHashes.clear();cache.compiledPatterns.clear();cache.reportedCycles.clear();cache.sccIndex.clear();cache.sccs=[];cache.sccComputed=false;cache.graphHash="";cache.resolvedPaths=new Map;cache.nonCyclicFiles.clear();cache.pendingCycleReports.clear()}function invalidateSCCCache(cache){cache.sccIndex.clear();cache.sccs=[];cache.sccComputed=false;cache.nonCyclicFiles.clear()}function getFileHash(filePath){const stats=(0,fs_1.statSync)(filePath);if(!stats){return null}return`${stats.mtimeMs}-${stats.size}`}function isCacheValid(filePath,cache){const cachedHash=cache.fileHashes.get(filePath);if(!cachedHash)return false;const currentHash=getFileHash(filePath);return cachedHash===currentHash}function fileExists(filePath,cache){const cached=cache.fileExists.get(filePath);if(cached!==void 0){return cached}const exists=(0,fs_1.fileExistsSync)(filePath);cache.fileExists.set(filePath,exists);return exists}function patternToRegexWithCache(pattern,cache){return(0,path_1.patternToRegex)(pattern,cache.compiledPatterns)}function shouldIgnoreFileWithCache(file,patterns,cache){return(0,path_1.shouldIgnoreFile)(file,patterns,cache.compiledPatterns)}function resolveImportPath(importPath,options){const fromFile=options.fromFile;const extensions=options.extensions||DEFAULT_EXTENSIONS;const cache=options.cache;const resolverSettings=options.resolverSettings;if(isDefinitelyExternal(importPath)){if(!importPath.startsWith("@")){return null}}const isRelative=importPath.startsWith(".");if(!isRelative){const globalCached=cache.resolvedPaths.get(importPath);if(globalCached!==void 0){return globalCached}}const cacheKey=isRelative?`${fromFile}::${importPath}`:importPath;const cached=cache.resolvedPaths.get(cacheKey);if(cached!==void 0){return cached}let result=(0,resolver_1.resolveModule)(importPath,fromFile,{extensions,mainFields:["module","main"],resolverSettings});if(result&&!isRelative&&result.includes("node_modules")){try{const realPath=(0,node_fs_1.realpathSync)(result);if(realPath.includes("node_modules")){cache.resolvedPaths.set(cacheKey,null);return null}result=realPath}catch{cache.resolvedPaths.set(cacheKey,null);return null}}if(!result&&isRelative){result=(0,path_1.resolvePath)((0,path_1.getDirname)(fromFile),importPath)}cache.resolvedPaths.set(cacheKey,result);return result}function getFileImports(file,options){const{workspaceRoot,barrelExports,cache,resolverSettings}=options;const cached=cache.dependencies.get(file);if(cached){return cached}const imports=[];try{if(!fileExists(file,cache)){return imports}const content=(0,fs_1.readFileSync)(file,"utf-8");if(content===null){return imports}const resolveOpts={fromFile:file,workspaceRoot,barrelExports,cache,extensions:DEFAULT_EXTENSIONS,resolverSettings};IMPORT_REGEX.lastIndex=0;DYNAMIC_IMPORT_REGEX.lastIndex=0;EXPORT_FROM_REGEX.lastIndex=0;let match;const seen=new Map;const pushImport=(importPath,dynamic=false,typeOnly=false,inlineTypeOnly=false)=>{const resolved=resolveImportPath(importPath,resolveOpts);if(!resolved||!fileExists(resolved,cache))return;const existing=seen.get(resolved);if(existing){if(dynamic)return;if(!typeOnly&&!inlineTypeOnly){delete existing.typeOnly;delete existing.inlineTypeOnly}else if(inlineTypeOnly&&existing.typeOnly){delete existing.typeOnly;existing.inlineTypeOnly=true}return}const info={path:resolved,source:importPath};if(dynamic)info.dynamic=true;if(typeOnly)info.typeOnly=true;if(inlineTypeOnly)info.inlineTypeOnly=true;seen.set(resolved,info);imports.push(info)};while((match=IMPORT_REGEX.exec(content))!==null){const isTypeImport=/^import\s+type[\s{]/.test(match[0]);let inlineTypeOnly=false;if(!isTypeImport){const target=resolveImportPath(match[1],resolveOpts);inlineTypeOnly=importsOnlyInlineTypes(match[0])||target!==null&&importsOnlyTypesFrom(match[0],target,(spec,fromFile)=>resolveImportPath(spec,{...resolveOpts,fromFile}))}pushImport(match[1],false,isTypeImport,inlineTypeOnly)}while((match=EXPORT_FROM_REGEX.exec(content))!==null)pushImport(match[1]);EXPORT_ALL_REGEX.lastIndex=0;while((match=EXPORT_ALL_REGEX.exec(content))!==null)pushImport(match[1]);TOP_LEVEL_REQUIRE_REGEX.lastIndex=0;while((match=TOP_LEVEL_REQUIRE_REGEX.exec(content))!==null)pushImport(match[1]);while((match=DYNAMIC_IMPORT_REGEX.exec(content))!==null)pushImport(match[1],true);const hash=getFileHash(file);if(hash){const oldHash=cache.fileHashes.get(file);if(oldHash!==hash){invalidateSCCCache(cache)}cache.fileHashes.set(file,hash)}}catch{}cache.dependencies.set(file,imports);return imports}function hasOnlyTypeImports(cycle,cache){for(const file of cycle){if(!fileExists(file,cache))continue;const content=(0,fs_1.readFileSync)(file,"utf-8");if(content===null)return false;const hasRuntimeImport=!TYPE_IMPORT_REGEX.test(content)&&IMPORT_REGEX.test(content);IMPORT_REGEX.lastIndex=0;if(hasRuntimeImport){return false}}return true}function computeSCCsFromFile(startFile,options){try{startFile=(0,node_fs_1.realpathSync)(startFile)}catch{}const{workspaceRoot,barrelExports,cache,resolverSettings}=options;if(cache.sccComputed&&cache.sccs.length>0&&cache.sccIndex.has(startFile)){return cache.sccs}const state={index:0,stack:[],onStack:new Set,indices:new Map,lowlinks:new Map,sccs:[]};const visited=new Set;const filesToProcess=[startFile];while(filesToProcess.length>0){const file=filesToProcess.pop();if(visited.has(file))continue;visited.add(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(!imp.dynamic&&!isErasedEdge(imp,options)&&!visited.has(imp.path)){filesToProcess.push(imp.path)}}}for(const file of visited){if(!state.indices.has(file)){tarjanStrongConnect(file,state,options,0)}}const newResults=state.sccs.map(files=>({files,hasCycle:files.length>1}));const offset=cache.sccs.length;cache.sccs.push(...newResults);cache.sccComputed=true;for(let i=0;i<newResults.length;i++){for(const file of newResults[i].files){if(!cache.sccIndex.has(file)){cache.sccIndex.set(file,offset+i)}}}for(const result of newResults){if(result.hasCycle){for(const file of result.files){cache.nonCyclicFiles.delete(file)}}else{for(const file of result.files){cache.nonCyclicFiles.add(file)}}}return cache.sccs}function tarjanStrongConnect(file,state,options,depth){const{maxDepth,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(depth>maxDepth){return}const enter=(node,nodeDepth)=>{state.indices.set(node,state.index);state.lowlinks.set(node,state.index);state.index++;state.stack.push(node);state.onStack.add(node);const imports=getFileImports(node,{workspaceRoot,barrelExports,cache,resolverSettings});const successors=[];for(const imp of imports){if(imp.dynamic||isErasedEdge(imp,options))continue;successors.push(imp.path)}return{file:node,depth:nodeDepth,successors,next:0}};const relax=(node,candidate)=>{state.lowlinks.set(node,Math.min(state.lowlinks.get(node),candidate))};const frames=[enter(file,depth)];while(frames.length>0){const frame=frames[frames.length-1];if(frame.next<frame.successors.length){const successor=frame.successors[frame.next++];if(!state.indices.has(successor)){if(frame.depth+1>maxDepth){relax(frame.file,0);continue}frames.push(enter(successor,frame.depth+1))}else if(state.onStack.has(successor)){relax(frame.file,state.indices.get(successor))}continue}frames.pop();const lowlink=state.lowlinks.get(frame.file);const index=state.indices.get(frame.file);if(lowlink===index){const scc=[];let w;do{w=state.stack.pop();state.onStack.delete(w);scc.push(w)}while(w!==frame.file);state.sccs.push(scc)}const parent=frames[frames.length-1];if(parent){relax(parent.file,state.lowlinks.get(frame.file))}}}function isFileInCycle(file,cache){const sccIndex=cache.sccIndex.get(file);if(sccIndex===void 0)return false;const scc=cache.sccs[sccIndex];return scc&&scc.hasCycle}function findShortestCyclePath(sourceFile,targetFile,options){const{workspaceRoot,barrelExports,cache,resolverSettings}=options;const maxDepth=options.maxDepth??Infinity;const srcSCC=cache.sccIndex.get(sourceFile);if(srcSCC===void 0)return null;const queue=[[targetFile]];const visited=new Set([targetFile]);while(queue.length>0){const path=queue.shift();if(path.length>maxDepth)break;const current=path[path.length-1];const imports=getFileImports(current,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(imp.dynamic||isErasedEdge(imp,options))continue;if(imp.path===sourceFile){return[...path,sourceFile]}if(visited.has(imp.path))continue;if(cache.sccIndex.get(imp.path)!==srcSCC)continue;visited.add(imp.path);queue.push([...path,imp.path])}}return null}function getCycleForFile(file,cache){const sccIndex=cache.sccIndex.get(file);if(sccIndex===void 0)return null;const scc=cache.sccs[sccIndex];if(!scc||!scc.hasCycle)return null;return scc.files}function isErasedEdge(imp,options){if(imp.typeOnly)return true;return Boolean(imp.inlineTypeOnly)&&!options.verbatimModuleSyntax}function detectCycleFromImport(sourceFile,targetFile,options){try{sourceFile=(0,node_fs_1.realpathSync)(sourceFile)}catch{}try{targetFile=(0,node_fs_1.realpathSync)(targetFile)}catch{}const{maxDepth,reportAllCycles,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(cache.nonCyclicFiles.has(targetFile)){return[]}const allCycles=[];const pathStack=[sourceFile];let depthLimitHit=false;function dfs(file,depth,visited2){if(file===sourceFile){allCycles.push([...pathStack,file]);return}if(depth>=maxDepth){depthLimitHit=true;return}if(visited2.has(file))return;if(cache.nonCyclicFiles.has(file))return;visited2.add(file);pathStack.push(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});for(const imp of imports){if(imp.dynamic)continue;if(!reportAllCycles&&allCycles.length>0)break;dfs(imp.path,depth+1,visited2)}pathStack.pop()}const visited=new Set;dfs(targetFile,1,visited);if(allCycles.length===0&&!depthLimitHit){cache.nonCyclicFiles.add(targetFile)}return allCycles}function findAllCircularDependencies(file,options,currentPath=[],depth=0,visited=new Set){const{maxDepth,reportAllCycles,workspaceRoot,barrelExports,cache,resolverSettings}=options;if(depth===0){try{file=(0,node_fs_1.realpathSync)(file)}catch{}}if(cache.nonCyclicFiles.has(file)){return[]}if(depth===0){computeSCCsFromFile(file,{maxDepth,workspaceRoot,barrelExports,cache,resolverSettings});if(!isFileInCycle(file,cache)){cache.nonCyclicFiles.add(file);return[]}}if(depth>maxDepth){return[]}if(currentPath.includes(file)){return[[...currentPath,file]]}if(visited.has(file)){return[]}visited.add(file);const imports=getFileImports(file,{workspaceRoot,barrelExports,cache,resolverSettings});const newPath=[...currentPath,file];const allCycles=[];for(const imp of imports){if(imp.dynamic){continue}if(!reportAllCycles&&allCycles.length>0){break}const cycles=findAllCircularDependencies(imp.path,options,newPath,depth+1,visited);allCycles.push(...cycles)}if(depth===0&&allCycles.length===0){cache.nonCyclicFiles.add(file)}return allCycles}function getMinimalCycle(cycle){if(cycle.length<2)return cycle;const seen=new Map;for(let i=0;i<cycle.length;i++){const file=cycle[i];if(seen.has(file)){const cycleStart=seen?.get?.(file);return cycle.slice(cycleStart,i+1)}seen.set(file,i)}return cycle}function getCycleHash(cycle){const minimalCycle=getMinimalCycle(cycle);const minIndex=minimalCycle.indexOf(minimalCycle.reduce((min,curr)=>curr<min?curr:min,minimalCycle[0]));const normalized=[...minimalCycle.slice(minIndex),...minimalCycle.slice(0,minIndex)];return normalized.join("->")}const CACHE_VERSION=1;const DEFAULT_CACHE_FILE="node_modules/.cache/forge-eslint/cycles.json";const DEFAULT_MAX_CACHE_AGE=24*60*60*1e3;function saveCacheToDisk(cache,options,workspaceRoot){if(!options.enabled)return;const cacheFile=(0,path_1.resolvePath)(workspaceRoot,options.cacheFile||DEFAULT_CACHE_FILE);const data={version:CACHE_VERSION,createdAt:Date.now(),fileHashes:Object.fromEntries(cache.fileHashes),sccs:cache.sccs,sccIndex:Object.fromEntries(cache.sccIndex),nonCyclicFiles:Array.from(cache.nonCyclicFiles),graphHash:cache.graphHash};const cacheDir=(0,path_1.getDirname)(cacheFile);if(!(0,fs_1.fileExistsSync)(cacheDir)){(0,fs_1.mkdirSync)(cacheDir,{recursive:true})}(0,fs_1.writeFileSync)(cacheFile,JSON.stringify(data),"utf-8")}function loadCacheFromDisk(cache,options,workspaceRoot){if(!options.enabled)return false;const cacheFile=(0,path_1.resolvePath)(workspaceRoot,options.cacheFile||DEFAULT_CACHE_FILE);if(!(0,fs_1.fileExistsSync)(cacheFile)){return false}const content=(0,fs_1.readFileSync)(cacheFile,"utf-8");if(content===null){return false}try{const data=JSON.parse(content);if(data.version!==CACHE_VERSION){return false}const maxAge=options.maxCacheAge??DEFAULT_MAX_CACHE_AGE;if(Date.now()-data.createdAt>maxAge){return false}cache.fileHashes=new Map(Object.entries(data.fileHashes));cache.sccs=data.sccs;cache.sccIndex=new Map(Object.entries(data.sccIndex).map(([k,v])=>[k,v]));cache.nonCyclicFiles=new Set(data.nonCyclicFiles);cache.graphHash=data.graphHash;cache.sccComputed=true;return true}catch{return false}}function getFilesNeedingReanalysis(files,cache,options){if(!options.enabled||!cache.sccComputed){return files}const changedFiles=[];for(const file of files){const cachedHash=cache.fileHashes.get(file);const currentHash=getFileHash(file);if(!cachedHash||cachedHash!==currentHash){changedFiles.push(file)}}if(changedFiles.length>0){const affectedSCCIndices=new Set;for(const file of changedFiles){const sccIndex=cache.sccIndex.get(file);if(sccIndex!==void 0){affectedSCCIndices.add(sccIndex)}}const affectedFiles=new Set(changedFiles);for(const scc of cache.sccs){const sccIndex=cache.sccIndex.get(scc.files[0]);if(sccIndex!==void 0&&affectedSCCIndices.has(sccIndex)){for(const file of scc.files){affectedFiles.add(file);cache.nonCyclicFiles.delete(file)}}}for(const[file,imports]of cache.dependencies){for(const imp of imports){if(changedFiles.includes(imp.path)){affectedFiles.add(file);cache.nonCyclicFiles.delete(file);break}}}return Array.from(affectedFiles)}return[]}function isIncrementalAvailable(cache,options){return Boolean(options?.enabled&&cache.sccComputed&&cache.sccs.length>0)}exports.PERFORMANCE_DOCS={algorithm:"Tarjan SCC + DFS hybrid",timeComplexity:"O(V + E)",spaceComplexity:"O(V)",guaranteedComplete:true};
|