@oh-my-pi/pi-natives 12.0.0 → 12.1.0

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": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Native Rust functionality via N-API",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -32,7 +32,7 @@
32
32
  "directory": "packages/natives"
33
33
  },
34
34
  "dependencies": {
35
- "@oh-my-pi/pi-utils": "12.0.0"
35
+ "@oh-my-pi/pi-utils": "12.1.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/bun": "^1.3.9"
package/src/glob/index.ts CHANGED
@@ -34,3 +34,13 @@ export async function glob(options: GlobOptions, onMatch?: (match: GlobMatch) =>
34
34
  cb,
35
35
  );
36
36
  }
37
+
38
+ /**
39
+ * Invalidate the filesystem scan cache.
40
+ *
41
+ * When called with a path, removes entries for roots containing that path.
42
+ * When called without a path, clears the entire cache.
43
+ */
44
+ export function invalidateFsScanCache(path?: string): void {
45
+ native.invalidateFsScanCache(path);
46
+ }
package/src/glob/types.ts CHANGED
@@ -27,8 +27,12 @@ export interface GlobOptions extends Cancellable {
27
27
  maxResults?: number;
28
28
  /** Respect .gitignore files (default: true). */
29
29
  gitignore?: boolean;
30
+ /** Enable shared filesystem scan cache (default: false). */
31
+ cache?: boolean;
30
32
  /** Sort results by mtime (most recent first) before applying limit. */
31
33
  sortByMtime?: boolean;
34
+ /** Include node_modules entries even when pattern does not mention node_modules. */
35
+ includeNodeModules?: boolean;
32
36
  }
33
37
 
34
38
  /** A single filesystem match. */
@@ -57,5 +61,7 @@ declare module "../bindings" {
57
61
  * @param onMatch Optional callback for streaming matches as they are found.
58
62
  */
59
63
  glob(options: GlobOptions, onMatch?: TsFunc<GlobMatch>): Promise<GlobResult>;
64
+ /** Invalidate the filesystem scan cache for the given path (or all caches if omitted). */
65
+ invalidateFsScanCache(path?: string): void;
60
66
  }
61
67
  }
package/src/grep/types.ts CHANGED
@@ -20,6 +20,8 @@ export interface GrepOptions extends Cancellable {
20
20
  multiline?: boolean;
21
21
  /** Include hidden files (default: true) */
22
22
  hidden?: boolean;
23
+ /** Enable shared filesystem scan cache (default: false). */
24
+ cache?: boolean;
23
25
  /** Maximum number of matches to return */
24
26
  maxCount?: number;
25
27
  /** Skip first N matches */
@@ -132,7 +134,7 @@ export interface SearchResult {
132
134
 
133
135
  /** Options for fuzzy file path search. */
134
136
  export interface FuzzyFindOptions extends Cancellable {
135
- /** Substring query to match against file paths (case-insensitive). */
137
+ /** Fuzzy query to match against file paths (case-insensitive). */
136
138
  query: string;
137
139
  /** Directory to search. */
138
140
  path: string;
@@ -140,6 +142,8 @@ export interface FuzzyFindOptions extends Cancellable {
140
142
  hidden?: boolean;
141
143
  /** Respect .gitignore (default: true). */
142
144
  gitignore?: boolean;
145
+ /** Enable shared filesystem scan cache (default: false). */
146
+ cache?: boolean;
143
147
  /** Maximum number of matches to return (default: 100). */
144
148
  maxResults?: number;
145
149
  }
@@ -150,6 +154,8 @@ export interface FuzzyFindMatch {
150
154
  path: string;
151
155
  /** Whether this entry is a directory. */
152
156
  isDirectory: boolean;
157
+ /** Match quality score (higher is better). */
158
+ score: number;
153
159
  }
154
160
 
155
161
  /** Result of fuzzy file path search. */
package/src/index.ts CHANGED
@@ -37,6 +37,7 @@ export {
37
37
  type GlobOptions,
38
38
  type GlobResult,
39
39
  glob,
40
+ invalidateFsScanCache,
40
41
  } from "./glob";
41
42
 
42
43
  // =============================================================================
package/src/native.ts CHANGED
@@ -9,6 +9,7 @@ import { createRequire } from "node:module";
9
9
  import * as os from "node:os";
10
10
  import * as path from "node:path";
11
11
  import { $env } from "@oh-my-pi/pi-utils";
12
+ import { getNativesDir } from "@oh-my-pi/pi-utils/dirs";
12
13
 
13
14
  import packageJson from "../package.json";
14
15
  import type { NativeBindings } from "./bindings";
@@ -37,7 +38,7 @@ const addonFilename = `pi_natives.${platformTag}.node`;
37
38
  const packageVersion = (packageJson as { version: string }).version;
38
39
  const nativeDir = path.join(import.meta.dir, "..", "native");
39
40
  const execDir = path.dirname(process.execPath);
40
- const versionedDir = path.join(os.homedir(), ".omp", "natives", packageVersion);
41
+ const versionedDir = path.join(getNativesDir(), packageVersion);
41
42
  const versionedAddonPath = path.join(versionedDir, addonFilename);
42
43
  const legacyUserDataDir =
43
44
  process.platform === "win32"
@@ -185,6 +186,7 @@ function validateNative(bindings: NativeBindings, source: string): void {
185
186
  checkFn("listDescendants");
186
187
  checkFn("getSystemInfo");
187
188
  checkFn("getWorkProfile");
189
+ checkFn("invalidateFsScanCache");
188
190
 
189
191
  if (missing.length) {
190
192
  throw new Error(