MCPcopy
hub / github.com/zh-lx/code-inspector / isTargetFileToInject

Function isTargetFileToInject

packages/core/src/server/use-client.ts:275–285  ·  view source on GitHub ↗
(file: string, record: RecordInfo)

Source from the content-addressed store, hash-verified

273
274// target file to inject code
275async function isTargetFileToInject(file: string, record: RecordInfo) {
276 const inputs: string[] = await (record.inputs || []);
277 const recordInfo = getProjectRecord(record);
278 const normalizedFile = normalizePath(file);
279 return (
280 (isJsTypeFile(file) && getFilePathWithoutExt(file) === recordInfo?.entry) ||
281 isAstroToolbarFile(file) ||
282 (recordInfo?.injectTo || []).includes(normalizedFile) ||
283 inputs.includes(normalizedFile)
284 );
285}
286
287function recordInjectTo(record: RecordInfo, options: CodeOptions) {
288 if (options?.injectTo) {

Callers 1

getCodeWithWebComponentFunction · 0.85

Calls 5

getProjectRecordFunction · 0.90
normalizePathFunction · 0.90
isJsTypeFileFunction · 0.90
getFilePathWithoutExtFunction · 0.90
isAstroToolbarFileFunction · 0.90

Tested by

no test coverage detected