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

Function generate_asset_manifest

ci/wasm_build.py:1699–1724  ·  view source on GitHub ↗

Generate the v1 asset manifest for ` /data/*.lnk` files. Part of FastLED issue #2284. Scans the sketch's ``data/`` directory for ``*.lnk`` asset-link files, parses each into ``{url, sha256, fallback}`` (sha256/fallback are reserved and not enforced in v1), and writes the resu

(example_name: str, output_dir: Path)

Source from the content-addressed store, hash-verified

1697
1698
1699def generate_asset_manifest(example_name: str, output_dir: Path) -> None:
1700 """Generate the v1 asset manifest for `<sketch>/data/*.lnk` files.
1701
1702 Part of FastLED issue #2284. Scans the sketch's ``data/`` directory for
1703 ``*.lnk`` asset-link files, parses each into ``{url, sha256, fallback}``
1704 (sha256/fallback are reserved and not enforced in v1), and writes the
1705 resulting manifest to ``<output_dir>/asset_manifest.json``.
1706
1707 The HTML bootstrap (``src/platforms/wasm/compiler/index.ts``) fetches
1708 this file and injects it as ``window.fastledAssetManifest``. The C++
1709 runtime side consumes the same data via ``fl::register_asset`` calls
1710 emitted into generated C++ (see ``ci/compiler/asset_scanner.py``).
1711 """
1712 from ci.compiler.asset_scanner import scan_sketch_assets, write_manifest_json
1713
1714 sketch_dir = PROJECT_ROOT / "examples" / example_name
1715 scan = scan_sketch_assets(sketch_dir)
1716 for warning in scan.warnings:
1717 print(f"[WASM] {warning}", file=sys.stderr)
1718
1719 manifest_path = output_dir / "asset_manifest.json"
1720 write_manifest_json(scan, manifest_path)
1721 if scan.manifest:
1722 print(
1723 f"[WASM] Wrote asset manifest ({len(scan.manifest)} entries) -> {manifest_path}"
1724 )
1725
1726
1727def build(

Callers 1

buildFunction · 0.85

Calls 3

scan_sketch_assetsFunction · 0.90
write_manifest_jsonFunction · 0.90
printFunction · 0.50

Tested by

no test coverage detected