Consumes a dependency that publishes only TypeScript, straight from its git reference, compiled from source by this toolchain.
No npm build, no committed lib/, no Node.
The dependency is esptool-js (Apache-2.0), the library that speaks the ESP32 serial protocol. The page asks a board what it is and prints the answer.
cargo run -p esptool-git
# open http://127.0.0.1:8080/ in Chrome or Edge and connect a board-
A git dependency built from source.
web/package.jsonnames it by git reference and lists it underweb_modules.sourceDependencies:{ "dependencies": { "esptool-js": "github:gronke/fork-esptool-js#gronke" }, "web_modules": { "sourceDependencies": ["esptool-js"] } }source_specs_from_package_jsonturns that into a source spec, andvendorfetches and compiles it into the layout its owntsconfig.jsondeclares — hereoutDir: ./liboverinclude: ["src/**/*"]. What lands inweb_modules/esptool-js/lib/is browser-ready JavaScript, so the bareesptool-jsspecifier resolves exactly as a prebuilt package's would and no.tsis ever served. -
Why it has to work this way. The repository ships
src/*.tsand nothing else. The default browser-asset extraction dropssrc/— reasonably, since a published package's sources are redundant beside its built output — which leaves a source-only package with nothing to vendor.keep_sourceskeeps them instead, and vendoring compiles them with the crate's own TypeScript compiler; no Node, and no build script of the package's own is run. -
Prebuilt and source-built side by side.
pakoandatob-liteare ordinary registry deps, vendored as published output intoweb/web_modules/, and esptool-js imports both. One import map covers both kinds. -
Co-generated map and tsconfig. The runtime import map (
Importmap::from_mounts) and the editortsconfig.json(write_tsconfig_base) come from the same mount set, so an editor resolvesesptool-js/...exactly as the browser does.
web/app.ts imports ESPLoader and Transport from the bare esptool-js, which is the point: the import is unremarkable, and nothing in it hints that the package arrived as TypeScript from a git reference.
It reports the chip's description, MAC, crystal frequency, features and flash size.
It only reads. detectChip() identifies the chip over Web Serial, the flasher stub is never uploaded and nothing is written, so pointing this at a board cannot modify it.
The port picker is filtered to Espressif's USB vendor id (0x303a), so it offers boards rather than every serial port on the machine.
Web Serial means Chrome or Edge, and the page says so and disables the button elsewhere.
web/web_modules/, web/index.html, web/importmap.json and tsconfig.json are all produced at startup from the tracked sources, and gitignored.