MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / addRuntimeDependencyFiles

Function addRuntimeDependencyFiles

apps/kimi-code/scripts/native/assets.mjs:129–156  ·  view source on GitHub ↗
(packageRoot, filePath, selected)

Source from the content-addressed store, hash-verified

127}
128
129async function addRuntimeDependencyFiles(packageRoot, filePath, selected) {
130 const extension = extname(filePath);
131 if (!['.js', '.cjs', '.mjs'].includes(extension)) return;
132
133 let text;
134 try {
135 text = await readFile(filePath, 'utf-8');
136 } catch {
137 return;
138 }
139
140 for (const specifier of relativeRuntimeSpecifiers(text)) {
141 const candidate = resolveFileCandidate(resolve(dirname(filePath), specifier));
142 if (candidate === null) continue;
143 if (candidate.endsWith('.node')) continue;
144 const packageRelativePath = relative(packageRoot, candidate);
145 if (
146 packageRelativePath.startsWith('..') ||
147 isAbsolute(packageRelativePath) ||
148 packageRelativePath.length === 0
149 ) {
150 continue;
151 }
152 if (selected.has(candidate)) continue;
153 selected.add(candidate);
154 await addRuntimeDependencyFiles(packageRoot, candidate, selected);
155 }
156}
157
158async function collectPackageFiles({
159 packageName,

Callers 1

collectPackageFilesFunction · 0.85

Calls 6

resolveFileCandidateFunction · 0.85
hasMethod · 0.65
addMethod · 0.65
readFileFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected