@rust-gear/glob 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +18 -35
  2. package/package.json +11 -10
  3. package/index.mjs +0 -5
package/README.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # @rust-gear/glob
2
2
 
3
- A high-performance globbing library for Node.js, powered by native Rust code.
3
+ A high-performance napi-rs glob library powered by Rust's [globset](https://docs.rs/globset).
4
+
5
+ ## ⚡ Performance
6
+
7
+ Significantly faster than Node.js built-in `fs.globSync`:
8
+
9
+ - **2-3x faster** for typical glob patterns
10
+ - **8x faster** for large file sets (5000+ files)
11
+
12
+ Based on benchmarks with 4,000-12,000 files across various patterns.
4
13
 
5
14
  ## Installation
6
15
 
@@ -14,51 +23,25 @@ npm install --save-dev @rust-gear/glob
14
23
  import { globSync, glob } from "@rust-gear/glob";
15
24
 
16
25
  const files = globSync("src/**/*.rs");
17
- console.log(files);
18
26
 
19
27
  const filesAsync = await glob("src/**/*.rs");
20
- console.log(filesAsync);
21
- ```
22
-
23
- ## Options
24
28
 
25
- You can pass an options object as the second argument to `globSync/glob`.
26
-
27
- > **Return path type:**
28
- > If the pattern is absolute, absolute paths are returned.
29
- > If the pattern is relative, paths are returned relative to the specified `cwd`.
30
-
31
- | Option | Type | Description |
32
- | :------ | :------- | :-------------------------------------- |
33
- | cwd | string | Current working directory for searching |
34
- | exclude | string[] | Array of glob patterns to exclude |
35
-
36
- ### Example
37
-
38
- ```js
39
- // Relative pattern, returns paths relative to cwd
40
29
  const files = globSync("**/*.rs", {
41
30
  cwd: "src",
42
31
  exclude: ["**/test/**", "**/target/**"],
43
32
  });
44
-
45
- // Convert all relative paths to absolute paths
46
- const absFiles = globSync("**/*.rs", {
47
- cwd: "src",
48
- exclude: ["**/test/**", "**/target/**"],
49
- }).map((f) => path.resolve(cwd(), f));
50
-
51
- // Absolute pattern, returns absolute paths
52
- const absoluteFiles = globSync("/Users/foo/project/src/**/*.rs");
53
33
  ```
54
34
 
55
- ## API
35
+ > **Return path type:**
36
+ > Absolute patterns return absolute paths.
37
+ > Relative patterns return paths relative to the specified `cwd`.
56
38
 
57
- **globSync(pattern: string \| string[], options?: GlobOptions): string[]**
58
- Synchronously returns an array of file paths.
39
+ ## Options
59
40
 
60
- **glob(pattern: string \| string[], options?: GlobOptions): Promise<string[]>**
61
- Asynchronously returns an array of file paths.
41
+ | Option | Type | Description |
42
+ | :------ | :------- | :-------------------------------------- |
43
+ | cwd | string | Current working directory for searching |
44
+ | exclude | string[] | Array of glob patterns to exclude |
62
45
 
63
46
  ## License
64
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rust-gear/glob",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Node.js bindings for Rust glob library",
5
5
  "keywords": [
6
6
  "rust-gear",
@@ -40,6 +40,7 @@
40
40
  "build": "napi build --platform --release",
41
41
  "packages": "node ../../scripts/generate-platform-packages.js",
42
42
  "readme": "node ../../scripts/generate-platform-readme.js",
43
+ "update:main": "node ../../scripts/update-main-package.js",
43
44
  "test": "ava"
44
45
  },
45
46
  "engines": {
@@ -53,14 +54,14 @@
53
54
  "@napi-rs/cli": "^2.18.4"
54
55
  },
55
56
  "optionalDependencies": {
56
- "@rust-gear/glob-darwin-arm64": "0.2.3",
57
- "@rust-gear/glob-darwin-x64": "0.2.3",
58
- "@rust-gear/glob-linux-arm64-gnu": "0.2.3",
59
- "@rust-gear/glob-linux-arm64-musl": "0.2.3",
60
- "@rust-gear/glob-linux-x64-gnu": "0.2.3",
61
- "@rust-gear/glob-linux-x64-musl": "0.2.3",
62
- "@rust-gear/glob-win32-arm64-msvc": "0.2.3",
63
- "@rust-gear/glob-win32-ia32-msvc": "0.2.3",
64
- "@rust-gear/glob-win32-x64-msvc": "0.2.3"
57
+ "@rust-gear/glob-darwin-arm64": "0.2.5",
58
+ "@rust-gear/glob-darwin-x64": "0.2.5",
59
+ "@rust-gear/glob-linux-arm64-gnu": "0.2.5",
60
+ "@rust-gear/glob-linux-arm64-musl": "0.2.5",
61
+ "@rust-gear/glob-linux-x64-gnu": "0.2.5",
62
+ "@rust-gear/glob-linux-x64-musl": "0.2.5",
63
+ "@rust-gear/glob-win32-arm64-msvc": "0.2.5",
64
+ "@rust-gear/glob-win32-ia32-msvc": "0.2.5",
65
+ "@rust-gear/glob-win32-x64-msvc": "0.2.5"
65
66
  }
66
67
  }
package/index.mjs DELETED
@@ -1,5 +0,0 @@
1
- import { createRequire } from "node:module";
2
- const require = createRequire(import.meta.url);
3
- const { globSync, glob } = require("./index.js");
4
-
5
- export { globSync, glob };