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)
| 1697 | |
| 1698 | |
| 1699 | def 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 | |
| 1727 | def build( |
no test coverage detected