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

Function resolvePackageSubpath

packages/node-sdk/scripts/build-dts.mjs:192–205  ·  view source on GitHub ↗
({ emittedFiles, packageDir, subpath, originalSpecifier })

Source from the content-addressed store, hash-verified

190}
191
192function resolvePackageSubpath({ emittedFiles, packageDir, subpath, originalSpecifier }) {
193 const srcRoot = path.join(dtsRoot, packageDir, 'src');
194 const directFile = path.resolve(srcRoot, `${subpath}.d.ts`);
195 if (emittedFiles.has(directFile) || existsSync(directFile)) {
196 return directFile;
197 }
198
199 const indexFile = path.resolve(srcRoot, subpath, 'index.d.ts');
200 if (emittedFiles.has(indexFile) || existsSync(indexFile)) {
201 return indexFile;
202 }
203
204 throw new Error(`Unable to resolve ${originalSpecifier} in emitted declarations`);
205}
206
207function relativeSpecifier(fromFile, toFile) {
208 const fromDir = path.dirname(fromFile);

Callers 1

resolveSpecifierFunction · 0.85

Calls 2

resolveMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected