Copy linked .js and .wasm from sketch cache to final output directory.
(sketch_cache_dir: Path, output_js: Path)
| 1548 | |
| 1549 | |
| 1550 | def _copy_linked_output(sketch_cache_dir: Path, output_js: Path) -> None: |
| 1551 | """Copy linked .js and .wasm from sketch cache to final output directory.""" |
| 1552 | output_dir = output_js.parent |
| 1553 | output_dir.mkdir(parents=True, exist_ok=True) |
| 1554 | |
| 1555 | cached_js = sketch_cache_dir / "fastled.js" |
| 1556 | cached_wasm = sketch_cache_dir / "fastled.wasm" |
| 1557 | |
| 1558 | if cached_js.exists(): |
| 1559 | shutil.copy2(str(cached_js), str(output_js)) |
| 1560 | if cached_wasm.exists(): |
| 1561 | shutil.copy2(str(cached_wasm), str(output_js.with_suffix(".wasm"))) |
| 1562 | |
| 1563 | # Copy DWARF debug info if present (produced by SEPARATE_DWARF_URL) |
| 1564 | cached_dwarf = sketch_cache_dir / "fastled.wasm.dwarf" |
| 1565 | if cached_dwarf.exists(): |
| 1566 | shutil.copy2(str(cached_dwarf), str(output_dir / cached_dwarf.name)) |
| 1567 | |
| 1568 | # Copy any other generated files (worker JS, etc.) |
| 1569 | for f in sketch_cache_dir.iterdir(): |
| 1570 | if f.suffix in (".js", ".wasm") and f.name not in ( |
| 1571 | "fastled.js", |
| 1572 | "fastled.wasm", |
| 1573 | ): |
| 1574 | shutil.copy2(str(f), str(output_dir / f.name)) |
| 1575 | |
| 1576 | |
| 1577 | def _clear_linked_output(sketch_cache_dir: Path, output_js: Path) -> None: |