Releases: e-dant/watcher
0.13.4
- readme: Grammar fixes.
- watcher-nodejs: Moved
node-gyp
todevDependencies
fromdependencies
, where it should be. - watcher-nodejs: Maintenance on the Node.js tests, which now ignore the very much non-idempotent
event.effectTime
field when comparing events. - watcher-nodejs: Updated a transitive development dependency (
cross-spawn
) to a non-vulnerable version.
0.13.3
On Linux:
- Fixed the behavior of reporting on very quickly added nested directories.
Previously, we'd mostly only report on what either inotify or fanotify told us about
events on paths which we already had marked. If a nested directory (a/b
) was added
before we markeda
, then we wouldn't report ona/b
. Now, we will. The fix was to
walk the newly-created directory tree (in this case, walkinga
), marking and reporting
on every child we find within it. - For inotify, fixed the reporting of the path name on associated events. Previously,
we did not lookup which(watch descript, path name)
pair the event was relative to.
The kernel documents the behavior here.
Our behavior was changed to always perform this lookup on associated events, whereas
before the behavior was to only perform this lookup on the "base" event. Note that
currently, and probably for all time, the only associated event is a rename event.
0.13.2
CMake now:
- Does not optimize away our entire library (no
-fwhole-program
when building libraries) - Uses a linker version script on linux when building the watcher-c shared library
- Defaults to not build sanitizer and test targets
- Adds an RPATH to the library targets (i.e.
watcher-c
) when building for Apple targets - Uses a more conventional
BUILD_TESTING
to control whether test targets are produced (instead ofBUILD_TEST
)
Various documentation improvements in the readme and CMake build file.
0.13.1
Added watcher-c
, as a (versioned) shared library, as a static library, and with headers, to the CMake build file.
They are included in the "lib" and "include" components, respectively.
0.13.0
Added a Rust crate for the Watcher.
use futures::StreamExt;
use wtr_watcher::Watch;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let show = |e| async move { println!("{e:?}") };
let events = Watch::try_new(".")?;
events.for_each(show).await;
Ok(())
}
The crate is available on crates.io.
Made the Github release CI depend on Wheels being built (and from uploading stale wheels because of that).
Various documentations improvements:
- Example usage for the new Rust crate
- PyPi and Crates.io badges in the readme
Various chores around the watcher-nodejs project:
- Simplified the napi bindings
- Left more of the type definitions to the typescript side (instead of the napi side)
- Various C paranoia fixes, out of caution, in case napi doesn't initialize various things
Fixed (was missing) the effect_time
field in the watcher-nodejs project's event type.
Made the Python project consistent with our other languages:
- The event object's field are in the same order as C/Rust/Js
- The output of the "example" CLI is the same JSON event format as the other languages (was previously a Python object dump)
- The effect time is represented as a number (nanosecond since epoch), not a datetime (which loses precision and is inconsistent with the other languages)
- The associated path name is an optional string, not a maybe empty string
0.12.2
Added CI for Github releases and Python/pip publishing.
Updated the readme to reflect the Python package name: wtr-watcher
.
Fixed shared library loading, naming in the Python ffi.
0.12.1
0.12.0
0.12.0
Various documentation improvements in the readme, especially around new features.
The readme for the C project was contributed by @AlliBalliBaba in #53
Added (heavily optimized) builds in CI for our "important" artifacts:
- The "minimal" CLI:
tw
- The "full" CLI:
wtr.watcher
- The new C (currently built as a shared) library:
watcher.so.<version>
andwatcher-c.h
- Python wheels
These artifacts are available for a wide range of platforms. The CLI and C
shared library are built for these triplets:
aarch64-apple-darwin
aarch64-pc-windows-msvc
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabihf
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
The Python wheels are built for these platforms Linux and Apple on Python 3.8 and up.
On Linux, the musl and gnu libcs, and the architectures x86_64
and aarch64
, are supported.
On Apple, only aarch64
is supported (because of a bug on intel runners; see the workflow).
Added support for using this project in C, Python and Node.js:
- C support as a shared or static library (one with a C-ABI)
- Node.js support as an NPM package for a "native addon"
- Python support as a Wheel for an FFI bridge to the C shared library
Each of the new bindings have a basic test suite.
Some examples for these new languages.
Each of the examples has similar behavior:
- Watch for and display all events
- Watch for events on every filesystem under the root directory
/
- Stop when any terminal input is received
C
#include "wtr/watcher-c.h"
#include <stdio.h>
void callback(struct wtr_watcher_event event, void* _ctx) {
printf(
"path name: %s, effect type: %d path type: %d, effect time: %lld, associated path name: %s\n",
event.path_name,
event.effect_type,
event.path_type,
event.effect_time,
event.associated_path_name ? event.associated_path_name : ""
);
}
int main() {
void* watcher = wtr_watcher_open("/", callback, NULL);
getchar();
return ! wtr_watcher_close(watcher);
}
Python
from watcher import Watch
with Watch("/", print):
input()
Node.js/TypeScript/JavaScript
import * as watcher from 'watcher';
var w = watcher.watch('/', (event) => {
console.log(event);
});
process.stdin.on('data', () => {
w.close();
process.exit();
});