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

Function getEmbeddedWebAssetManifest

apps/kimi-code/src/native/web-assets.ts:121–140  ·  view source on GitHub ↗
(
  source: WebAssetSource | null = getSeaAssetSource(),
  target = currentTarget(),
)

Source from the content-addressed store, hash-verified

119}
120
121export function getEmbeddedWebAssetManifest(
122 source: WebAssetSource | null = getSeaAssetSource(),
123 target = currentTarget(),
124): WebAssetManifest | null {
125 if (source === null) return null;
126 const key = webAssetManifestKey(target);
127 if (!source.getAssetKeys().includes(key)) return null;
128 const raw = source.getRawAsset(key);
129 const manifest = JSON.parse(toBuffer(raw).toString('utf-8')) as RawWebAssetManifest;
130 if (manifest.version !== WEB_ASSET_MANIFEST_VERSION) {
131 throw new Error(`Unsupported web asset manifest version: ${manifest.version}`);
132 }
133 if (manifest.target !== target) {
134 throw new Error(`Web asset manifest target mismatch: ${manifest.target} !== ${target}`);
135 }
136 if (manifest.root !== 'dist-web') {
137 throw new Error(`Unsupported web asset root: ${manifest.root}`);
138 }
139 return manifest as WebAssetManifest;
140}
141
142export function getWebAssetCacheRoot(
143 manifest: WebAssetManifest,

Callers 1

getNativeWebAssetsDirFunction · 0.85

Calls 7

getSeaAssetSourceFunction · 0.90
currentTargetFunction · 0.70
webAssetManifestKeyFunction · 0.70
toBufferFunction · 0.70
getAssetKeysMethod · 0.65
getRawAssetMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected