picomatch-rs
Native glob matching for Node.js, implemented in Rust and exposed through napi-rs.
The package root loads the compiled addon and re-exports the native API. The Rust core lives in crates/picomatch-rs/, and the Node binding lives in napi/.
Install
Usage
Node.js
require('@maidang1/picomatch-rs') returns a callable matcher factory and also exposes the native helpers as named exports.
const picomatch = require;
const isJsFile = ;
console.log;
console.log;
console.log;
Available exports:
- default export: callable matcher factory
scanparsecompileRemakeRetoRegextestmatchBaseisMatchcompileMatcherNativeMatcher
Legacy entrypoints such as ./lib/picomatch, ./posix, and ./lib/scan are thin compatibility shims.
Rust
use ;
let matched = is_match.unwrap;
assert!;
Repository Layout
.
├── crates/picomatch-rs/ # Rust matcher core and Rust tests
├── napi/ # Node-API binding crate
├── index.js # package entrypoint
├── index.d.ts # root TypeScript declarations
├── native.js # native addon loader
├── lib/ # compatibility shims
└── test/ # Node smoke and parity tests
Development
Release
Pushing a tag like v0.1.0 triggers .github/workflows/release.yml.
The release workflow:
- verifies that the tag,
package.json,napi/Cargo.toml, andcrates/picomatch-rs/Cargo.tomlall use the same version - builds and uploads platform-specific
.nodeartifacts - publishes the scoped npm package
@maidang1/picomatch-rswith all shipped binaries - publishes
crates/picomatch-rsto crates.io
Required GitHub repository secrets:
NPM_TOKENCARGO_REGISTRY_TOKEN
Notes
index.jsstays intentionally small: it loads the native addon and provides the callable package surface.index.d.tsre-exports the generated declarations fromnapi/index.d.ts.- The repository no longer uses the old JavaScript implementation path for core matching behavior.
License
MIT