chokidar4bare
v0.1.0
Published
A faithful port of chokidar to the Bare runtime
Downloads
738
Maintainers
Readme
chokidar4bare
chokidar4bare is a port of chokidar to the Bare runtime. It copies chokidar as closely as we could.
We love and trust chokidar. It has watched files for most of the JavaScript ecosystem since 2012, and a great deal of hard-won knowledge is built into its code. chokidar needs Node.js, and we needed the same thing on Bare. Rather than design a new watcher, we copied chokidar's code, its architecture, its algorithms and its design patterns as faithfully as we could, and stayed as close to the original as Bare allows.
Most of the intellectual property in this package belongs to chokidar's authors and contributors (Copyright (c) 2012 Paul Miller, Elan Shanker, and contributors), not to us. The source files carry chokidar's MIT copyright notice, and UPSTREAM.md maps every function back to its chokidar original at the commit we ported from.
What is ours is limited to:
- the changes Bare forces (no
fs.watchFile, noprocess, watch failures thatbare-fsdoes not report, the inotify and open-file budgets); - a short, numbered list of divergences, each one explained in UPSTREAM.md;
- a deliberately narrow scope: only the features one application needs today.
chokidar4bare is an independent project. It is not affiliated with or endorsed by chokidar or its maintainers. Please report problems with chokidar4bare here, not to chokidar. If you run on Node.js, use chokidar.
If chokidar has saved you time, please consider supporting its author.
Status
0.1.0 — the first release. The port of chokidar v6 (74adf65) is complete; its own test suites
pass against chokidar4bare on macOS, Linux and Windows, under Bare and under Node (docs/testing.md
has the numbers). Two bare-fs defects that limited a watcher under Bare — a failed fs.watch() returning a dead
handle (bare-fs#51) and a crash on a burst of
changes on Windows (bare-fs#52) — were fixed
in bare-fs 4.8.2, which chokidar4bare requires. The reproductions live in
ok/bare-fs-watch-repros.
See UPSTREAM.md for the pinned chokidar commit and every divergence from it.
Development
npm install
npm test # brittle under Bare, then under Node
npm run lint # prettier, lunte, provenance headersThe ported test suite can also be run against the upstream chokidar build it was ported from, which is how the port is verified:
CHOKIDAR4BARE_ORACLE=/path/to/chokidar-upstream npx brittle-node "test/*.js"docs/testing.md explains the method, the recorded numbers per platform and runtime, and the
Docker scripts for Linux (scripts/linux-run.sh, scripts/linux-enospc.sh).
