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

Function writeSeaConfig

apps/kimi-code/scripts/native/02-sea-blob.mjs:29–68  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

27}
28
29async function writeSeaConfig(target) {
30 await mkdir(nativeIntermediatesDir(), { recursive: true });
31 const { manifest, manifestJson, assets } = await collectNativeAssets({
32 appRoot,
33 target,
34 });
35 const web = await collectWebAssets({ appRoot, target });
36 const manifestPath = resolve(nativeManifestDir(target), 'manifest.json');
37 const webManifestPath = resolve(nativeIntermediatesDir(), 'web-assets', target, 'manifest.json');
38 await mkdir(dirname(manifestPath), { recursive: true });
39 await mkdir(dirname(webManifestPath), { recursive: true });
40 await writeFile(manifestPath, manifestJson);
41 await writeFile(webManifestPath, web.manifestJson);
42
43 const seaAssets = {
44 [nativeAssetManifestKey(target)]: manifestPath,
45 [webAssetManifestKey(target)]: webManifestPath,
46 ...assets,
47 ...web.assets,
48 };
49 const config = {
50 main: nativeJsBundlePath(),
51 output: nativeBlobPath(),
52 assets: Object.fromEntries(
53 Object.entries(seaAssets).sort(([a], [b]) => a.localeCompare(b)),
54 ),
55 disableExperimentalSEAWarning: true,
56 useCodeCache: false,
57 useSnapshot: false,
58 };
59 await writeFile(nativeSeaConfigPath(), `${JSON.stringify(config, null, 2)}\n`);
60
61 console.log(`Collected native assets for ${manifest.target}:`);
62 for (const line of nativeAssetSummary(manifest)) {
63 console.log(`- ${line}`);
64 }
65 console.log(
66 `Collected web assets for ${web.manifest.target}: ${web.manifest.files.length} files`,
67 );
68}
69
70export async function runSeaBlobStep() {
71 await ensureBundleExists();

Callers 1

runSeaBlobStepFunction · 0.85

Calls 14

nativeIntermediatesDirFunction · 0.90
collectNativeAssetsFunction · 0.90
collectWebAssetsFunction · 0.90
nativeManifestDirFunction · 0.90
webAssetManifestKeyFunction · 0.90
nativeJsBundlePathFunction · 0.90
nativeBlobPathFunction · 0.90
nativeSeaConfigPathFunction · 0.90
nativeAssetSummaryFunction · 0.90
nativeAssetManifestKeyFunction · 0.85
logMethod · 0.65
mkdirFunction · 0.50

Tested by

no test coverage detected