@rust-gear/glob 0.2.4 → 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 +8 -52
  2. package/package.json +11 -10
  3. package/index.mjs +0 -5
package/README.md CHANGED
@@ -1,6 +1,6 @@
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
4
 
5
5
  ## ⚡ Performance
6
6
 
@@ -22,71 +22,27 @@ npm install --save-dev @rust-gear/glob
22
22
  ```js
23
23
  import { globSync, glob } from "@rust-gear/glob";
24
24
 
25
- // Synchronous
26
25
  const files = globSync("src/**/*.rs");
27
- console.log(files);
28
26
 
29
- // Asynchronous
30
27
  const filesAsync = await glob("src/**/*.rs");
31
- console.log(filesAsync);
32
- ```
33
-
34
- ## Options
35
28
 
36
- Both `globSync` and `glob` accept an optional options object as the second argument.
29
+ const files = globSync("**/*.rs", {
30
+ cwd: "src",
31
+ exclude: ["**/test/**", "**/target/**"],
32
+ });
33
+ ```
37
34
 
38
35
  > **Return path type:**
39
36
  > Absolute patterns return absolute paths.
40
37
  > Relative patterns return paths relative to the specified `cwd`.
41
38
 
39
+ ## Options
40
+
42
41
  | Option | Type | Description |
43
42
  | :------ | :------- | :-------------------------------------- |
44
43
  | cwd | string | Current working directory for searching |
45
44
  | exclude | string[] | Array of glob patterns to exclude |
46
45
 
47
- ### Examples
48
-
49
- ```js
50
- // Relative pattern - returns paths relative to cwd
51
- const files = globSync("**/*.rs", {
52
- cwd: "src",
53
- exclude: ["**/test/**", "**/target/**"],
54
- });
55
-
56
- // Convert relative paths to absolute
57
- const absFiles = globSync("**/*.rs", {
58
- cwd: "src",
59
- exclude: ["**/test/**", "**/target/**"],
60
- }).map((f) => path.resolve(cwd(), f));
61
-
62
- // Absolute pattern - returns absolute paths
63
- const absoluteFiles = globSync("/Users/foo/project/src/**/*.rs");
64
- ```
65
-
66
- ## API
67
-
68
- ### `globSync(pattern, options?)`
69
-
70
- Synchronously returns an array of file paths matching the pattern.
71
-
72
- **Parameters:**
73
-
74
- - `pattern` - A glob pattern string or array of patterns
75
- - `options?` - Optional configuration object
76
-
77
- **Returns:** `string[]`
78
-
79
- ### `glob(pattern, options?)`
80
-
81
- Asynchronously returns an array of file paths matching the pattern.
82
-
83
- **Parameters:**
84
-
85
- - `pattern` - A glob pattern string or array of patterns
86
- - `options?` - Optional configuration object
87
-
88
- **Returns:** `Promise<string[]>`
89
-
90
46
  ## License
91
47
 
92
48
  Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rust-gear/glob",
3
- "version": "0.2.4",
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.4",
57
- "@rust-gear/glob-darwin-x64": "0.2.4",
58
- "@rust-gear/glob-linux-arm64-gnu": "0.2.4",
59
- "@rust-gear/glob-linux-arm64-musl": "0.2.4",
60
- "@rust-gear/glob-linux-x64-gnu": "0.2.4",
61
- "@rust-gear/glob-linux-x64-musl": "0.2.4",
62
- "@rust-gear/glob-win32-arm64-msvc": "0.2.4",
63
- "@rust-gear/glob-win32-ia32-msvc": "0.2.4",
64
- "@rust-gear/glob-win32-x64-msvc": "0.2.4"
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 };