perf: prefilter extension boundary parsing

This commit is contained in:
Peter Steinberger
2026-04-11 13:02:56 +01:00
parent 850182b502
commit 48ac72f0ee
3 changed files with 13 additions and 0 deletions
@@ -47,6 +47,10 @@ function shouldSkipFile(filePath) {
return relativeFile.startsWith("packages/plugin-sdk/dist/");
}
function shouldParseSource(source) {
return source.includes(BUNDLED_PLUGIN_PATH_PREFIX);
}
function scanImportBoundaryViolations(sourceFile, filePath) {
const entries = [];
const relativeFile = normalizeRepoPath(repoRoot, filePath);
@@ -87,6 +91,7 @@ export async function collectSdkPackageExtensionImportBoundaryInventory() {
collectEntries(sourceFile, filePath) {
return scanImportBoundaryViolations(sourceFile, filePath);
},
shouldParseSource,
});
})();
@@ -52,6 +52,10 @@ function shouldSkipFile(filePath) {
);
}
function shouldParseSource(source) {
return source.includes(BUNDLED_PLUGIN_PATH_PREFIX);
}
function scanImportBoundaryViolations(sourceFile, filePath) {
const entries = [];
const relativeFile = normalizeRepoPath(repoRoot, filePath);
@@ -92,6 +96,7 @@ export async function collectSrcExtensionImportBoundaryInventory() {
collectEntries(sourceFile, filePath) {
return scanImportBoundaryViolations(sourceFile, filePath);
},
shouldParseSource,
});
})();
+3
View File
@@ -83,6 +83,9 @@ export async function collectTypeScriptInventory(params) {
let sourceFile = parsedTypeScriptSourceCache.get(cacheKey);
if (!sourceFile) {
const source = await fs.readFile(filePath, "utf8");
if (params.shouldParseSource && !params.shouldParseSource(source, filePath)) {
continue;
}
sourceFile = params.ts.createSourceFile(
filePath,
source,