fix(scripts): bound guard inventory file reads · openclaw/openclaw@6defcb0
vincentkoc
·
2026-05-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,6 +15,7 @@ import {
|
15 | 15 | resolveSourceRoots, |
16 | 16 | runAsScript, |
17 | 17 | } from "./lib/ts-guard-utils.mjs"; |
| 18 | +import { mapWithConcurrency } from "./lib/source-file-scan-cache.mjs"; |
18 | 19 | |
19 | 20 | const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); |
20 | 21 | const scanRoots = resolveSourceRoots(repoRoot, ["src/plugin-sdk", "src/plugins/runtime"]); |
@@ -170,14 +171,16 @@ export async function collectArchitectureSmells() {
|
170 | 171 | const files = (await collectTypeScriptFilesFromRoots(scanRoots)).toSorted((left, right) => |
171 | 172 | normalizeRepoPath(repoRoot, left).localeCompare(normalizeRepoPath(repoRoot, right)), |
172 | 173 | ); |
173 | | -const entriesByFile = await Promise.all( |
174 | | -files.map(async (filePath) => { |
| 174 | +const entriesByFile = await mapWithConcurrency( |
| 175 | +files, |
| 176 | +undefined, |
| 177 | +async (filePath) => { |
175 | 178 | const source = await fs.readFile(filePath, "utf8"); |
176 | 179 | const entries = scanPluginSdkExtensionFacadeSmells(source, filePath); |
177 | 180 | entries.push(...scanRuntimeTypeImplementationSmells(source, filePath)); |
178 | 181 | entries.push(...scanRuntimeServiceLocatorSmells(source, filePath)); |
179 | 182 | return entries; |
180 | | -}), |
| 183 | +}, |
181 | 184 | ); |
182 | 185 | return entriesByFile.flat().toSorted(compareEntries); |
183 | 186 | })(); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,6 +13,7 @@ import {
|
13 | 13 | resolveRepoRoot, |
14 | 14 | resolveSourceRoots, |
15 | 15 | } from "./ts-guard-utils.mjs"; |
| 16 | +import { mapWithConcurrency } from "./source-file-scan-cache.mjs"; |
16 | 17 | |
17 | 18 | const repoRoot = resolveRepoRoot(import.meta.url); |
18 | 19 | |
@@ -72,8 +73,10 @@ export function createExtensionImportBoundaryChecker(params) {
|
72 | 73 | .toSorted((left, right) => |
73 | 74 | normalizeRepoPath(repoRoot, left).localeCompare(normalizeRepoPath(repoRoot, right)), |
74 | 75 | ); |
75 | | -const entriesByFile = await Promise.all( |
76 | | -files.map(async (filePath) => { |
| 76 | +const entriesByFile = await mapWithConcurrency( |
| 77 | +files, |
| 78 | +undefined, |
| 79 | +async (filePath) => { |
77 | 80 | const source = await fs.readFile(filePath, "utf8"); |
78 | 81 | if ( |
79 | 82 | params.skipSourcesWithoutBundledPluginPrefix && |
@@ -87,7 +90,7 @@ export function createExtensionImportBoundaryChecker(params) {
|
87 | 90 | params.boundaryLabel, |
88 | 91 | params.allowResolvedPath, |
89 | 92 | ); |
90 | | -}), |
| 93 | +}, |
91 | 94 | ); |
92 | 95 | const inventory = entriesByFile.flat(); |
93 | 96 | return inventory.toSorted(compareEntries); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。