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

Function getNativePackageRoot

apps/kimi-code/src/native/native-assets.ts:243–259  ·  view source on GitHub ↗
(
  packageName: string,
  options: NativeAssetOptions = {},
)

Source from the content-addressed store, hash-verified

241}
242
243export function getNativePackageRoot(
244 packageName: string,
245 options: NativeAssetOptions = {},
246): string | null {
247 const source = options.source ?? getSeaAssetSource();
248 if (source === null) return null;
249
250 const manifest =
251 options.manifest ?? getEmbeddedNativeAssetManifest(source, currentTarget());
252 if (manifest === null) return null;
253
254 const pkg = manifest.packages.find((entry) => entry.name === packageName);
255 if (pkg === undefined) return null;
256
257 const cacheRoot = ensureNativeAssetTree({ ...options, source, manifest });
258 return cacheRoot === null ? null : join(cacheRoot, pkg.root);
259}
260
261export function hasNativePackage(packageName: string, manifest: NativeAssetManifest): boolean {
262 return manifest.packages.some((pkg) => pkg.name === packageName);

Callers 5

installNativeModuleHookFunction · 0.90
nativeAssetCacheExistsFunction · 0.85

Calls 4

getSeaAssetSourceFunction · 0.85
ensureNativeAssetTreeFunction · 0.85
currentTargetFunction · 0.70

Tested by

no test coverage detected