@oh-my-pi/pi-natives 9.6.3 → 9.6.4

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "9.6.3",
3
+ "version": "9.6.4",
4
4
  "description": "Native Rust functionality via N-API",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -30,7 +30,7 @@
30
30
  "directory": "packages/natives"
31
31
  },
32
32
  "dependencies": {
33
- "@oh-my-pi/pi-utils": "9.6.3"
33
+ "@oh-my-pi/pi-utils": "9.6.4"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^25.0.10"
package/src/grep/index.ts CHANGED
@@ -34,7 +34,9 @@ export type {
34
34
  * Search files for a regex pattern with optional streaming callback.
35
35
  */
36
36
  export async function grep(options: GrepOptions, onMatch?: (match: GrepMatch) => void): Promise<GrepResult> {
37
- return wrapRequestOptions(() => native.grep(options, onMatch), options);
37
+ // napi-rs ThreadsafeFunction passes (error, value) - skip callback on error
38
+ const cb = onMatch ? (err: Error | null, m: GrepMatch) => !err && onMatch(m) : undefined;
39
+ return wrapRequestOptions(() => native.grep(options, cb), options);
38
40
  }
39
41
 
40
42
  /**
package/src/index.ts CHANGED
@@ -42,6 +42,9 @@ export async function find(options: FindOptions, onMatch?: (match: FindMatch) =>
42
42
  // Convert simple patterns to recursive globs if needed
43
43
  const globPattern = pattern.includes("/") || pattern.startsWith("**") ? pattern : `**/${pattern}`;
44
44
 
45
+ // napi-rs ThreadsafeFunction passes (error, value) - skip callback on error
46
+ const cb = onMatch ? (err: Error | null, m: FindMatch) => !err && onMatch(m) : undefined;
47
+
45
48
  return native.find(
46
49
  {
47
50
  ...options,
@@ -50,7 +53,7 @@ export async function find(options: FindOptions, onMatch?: (match: FindMatch) =>
50
53
  hidden: options.hidden ?? false,
51
54
  gitignore: options.gitignore ?? true,
52
55
  },
53
- onMatch,
56
+ cb,
54
57
  );
55
58
  }
56
59
 
package/src/native.ts CHANGED
@@ -39,9 +39,9 @@ export interface NativeSamplingFilter {
39
39
  import type { GrepMatch } from "./grep/types";
40
40
 
41
41
  export interface NativeBindings {
42
- find(options: FindOptions, onMatch?: (match: FindMatch) => void): Promise<FindResult>;
42
+ find(options: FindOptions, onMatch?: (error: Error | null, match: FindMatch) => void): Promise<FindResult>;
43
43
  fuzzyFind(options: FuzzyFindOptions): Promise<FuzzyFindResult>;
44
- grep(options: GrepOptions, onMatch?: (match: GrepMatch) => void): Promise<GrepResult>;
44
+ grep(options: GrepOptions, onMatch?: (error: Error | null, match: GrepMatch) => void): Promise<GrepResult>;
45
45
  search(content: string | Uint8Array, options: SearchOptions): SearchResult;
46
46
  hasMatch(
47
47
  content: string | Uint8Array,