picomatch-rs 0.1.0

Rust glob matching core for the picomatch-rs workspace.
Documentation
  • Coverage
  • 0%
    0 out of 109 items documented0 out of 19 items with examples
  • Size
  • Source code size: 1.07 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 59s Average build duration of successful builds.
  • all releases: 59s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Maidang1/picomatch-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Maidang1

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

npm install @maidang1/picomatch-rs

Usage

Node.js

require('@maidang1/picomatch-rs') returns a callable matcher factory and also exposes the native helpers as named exports.

const picomatch = require('@maidang1/picomatch-rs');

const isJsFile = picomatch('**/*.js');

console.log(isJsFile('src/index.js'));
console.log(picomatch.isMatch('src/lib.rs', '**/*.rs'));
console.log(picomatch.scan('src/**/*.rs'));

Available exports:

  • default export: callable matcher factory
  • scan
  • parse
  • compileRe
  • makeRe
  • toRegex
  • test
  • matchBase
  • isMatch
  • compileMatcher
  • NativeMatcher

Legacy entrypoints such as ./lib/picomatch, ./posix, and ./lib/scan are thin compatibility shims.

Rust

use picomatch_rs::{is_match, CompileOptions};

let matched = is_match("src/lib.rs", "**/*.rs", CompileOptions::default()).unwrap();
assert!(matched);

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

npm run build       # build the release addon and sync the .node artifact
npm run build:debug # build a debug addon for local debugging
npm run test:rust   # run the Rust workspace tests
npm run test:node   # build the addon and run the Node tests
npm test            # run Rust and Node verification

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, and crates/picomatch-rs/Cargo.toml all use the same version
  • builds and uploads platform-specific .node artifacts
  • publishes the scoped npm package @maidang1/picomatch-rs with all shipped binaries
  • publishes crates/picomatch-rs to crates.io

Required GitHub repository secrets:

  • NPM_TOKEN
  • CARGO_REGISTRY_TOKEN

Notes

  • index.js stays intentionally small: it loads the native addon and provides the callable package surface.
  • index.d.ts re-exports the generated declarations from napi/index.d.ts.
  • The repository no longer uses the old JavaScript implementation path for core matching behavior.

License

MIT