MCPcopy Create free account
hub / github.com/FastLED/FastLED / write_manifest_json

Function write_manifest_json

ci/compiler/asset_scanner.py:192–207  ·  view source on GitHub ↗

Serialize the manifest to JSON on disk. The format matches what the WASM bootstrap expects for injection as ``window.fastledAssetManifest``. ``None`` fields are preserved so future JS consumers can detect absent metadata without extra contains-checks. Args: scan: Result of

(scan: AssetScanResult, out_path: Path)

Source from the content-addressed store, hash-verified

190
191
192def write_manifest_json(scan: AssetScanResult, out_path: Path) -> None:
193 """Serialize the manifest to JSON on disk.
194
195 The format matches what the WASM bootstrap expects for injection as
196 ``window.fastledAssetManifest``. ``None`` fields are preserved so future
197 JS consumers can detect absent metadata without extra contains-checks.
198
199 Args:
200 scan: Result of :func:`scan_sketch_assets`.
201 out_path: Destination ``.json`` file. Parent directories are created
202 on demand.
203 """
204 out_path.parent.mkdir(parents=True, exist_ok=True)
205 with out_path.open("w", encoding="utf-8") as f:
206 json.dump(scan.to_json_dict(), f, indent=2, sort_keys=True)
207 f.write("\n")
208
209
210def manifest_to_js_bootstrap(scan: AssetScanResult) -> str:

Callers 2

generate_asset_manifestFunction · 0.90

Calls 4

to_json_dictMethod · 0.80
openMethod · 0.45
dumpMethod · 0.45
writeMethod · 0.45

Tested by 1