@oh-my-pi/pi-natives 18.3.5 → 18.4.1

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.
package/README.md CHANGED
@@ -45,6 +45,14 @@ const pdf = await pdfToMarkdown(pdfBytes);
45
45
  console.log(pdf.markdown, pdf.pagesNeedingOcr);
46
46
  ```
47
47
 
48
+ ### Lazy Windows path helpers
49
+
50
+ Import `expandWindowsLongPath` and `getWindowsShortPath` from
51
+ `@oh-my-pi/pi-natives/path` when importing a module must not load the native addon.
52
+ The addon loads only when a helper is called on Windows; other platforms preserve
53
+ the input path without loading it. These helpers change long/8.3 spellings without
54
+ resolving symlinks or junctions.
55
+
48
56
  ## Building
49
57
 
50
58
  ```bash
package/native/index.d.ts CHANGED
@@ -416,9 +416,9 @@ export declare class TextPredictor {
416
416
  /**
417
417
  * Dedicated writer thread for one terminal fd.
418
418
  *
419
- * Constructed by the TUI's `ProcessTerminal` around stdout. The fd is
420
- * `dup(2)`'d at construction and closed on drop, so later manipulation of the
421
- * original descriptor does not affect the pump.
419
+ * `dup(2)`'d at construction and closed on drop. The duplicate keeps the
420
+ * pump's fd alive if the original is closed or replaced; file-status flags
421
+ * such as `O_NONBLOCK` are shared and handled by polling for `POLLOUT`.
422
422
  */
423
423
  export declare class TtyWriter {
424
424
  /**
@@ -1567,6 +1567,9 @@ export declare function execReplace(argv: Array<string>): void
1567
1567
  */
1568
1568
  export declare function executeShell(options: ShellExecuteOptions, onChunk?: ((error: Error | null, chunk: string) => void) | undefined | null): Promise<ShellRunResult>
1569
1569
 
1570
+ /** Expand Windows 8.3 components without resolving symlinks or junctions. */
1571
+ export declare function expandWindowsLongPath(path: string): string
1572
+
1570
1573
  /** Locate `*** Edit File: path` payloads the model emitted as plain text. */
1571
1574
  export declare function extractInlineSloppyRegions(text: string): Array<InlineSloppyRegion>
1572
1575
 
@@ -1644,6 +1647,9 @@ export interface FuzzyFindResult {
1644
1647
  /** Get list of supported languages. */
1645
1648
  export declare function getSupportedLanguages(): Array<string>
1646
1649
 
1650
+ /** Get the existing Windows 8.3 spelling; preserve the input when unavailable. */
1651
+ export declare function getWindowsShortPath(path: string): string
1652
+
1647
1653
  /**
1648
1654
  * Get work profile data from the last N seconds.
1649
1655
  *
@@ -1733,7 +1739,8 @@ export interface GlobResult {
1733
1739
  *
1734
1740
  * # Arguments
1735
1741
  * - `options`: Pattern, path, filters, and output mode.
1736
- * - `on_match`: Optional callback invoked per match/result.
1742
+ * - `on_match`: Optional callback invoked per returned match/result, after the
1743
+ * search (never called when `options.onMatches` streams instead).
1737
1744
  *
1738
1745
  * # Returns
1739
1746
  * Aggregated results across matching files.
@@ -1810,6 +1817,16 @@ export interface GrepOptions {
1810
1817
  * absent).
1811
1818
  */
1812
1819
  filesystem?: ShellFilesystem
1820
+ /**
1821
+ * Stream results instead of returning them: called on the JS thread with
1822
+ * batches (at most 1024 entries, files in no particular order) of what
1823
+ * `matches` would hold, while the search runs. A slow callback pauses the
1824
+ * search instead of buffering, every call returns before the promise
1825
+ * settles, and the result then carries counts with empty `matches`.
1826
+ * A throw rejects the search with it. Incompatible with `maxCount` and
1827
+ * `offset`.
1828
+ */
1829
+ onMatches?: (matches: GrepMatch[]) => void
1813
1830
  }
1814
1831
 
1815
1832
  /** Output mode for [`search`] and [`grep`] (string values match JS callers). */
package/native/index.js CHANGED
@@ -72,10 +72,12 @@ export const enclosingBlockBoundaries = nativeBindings.enclosingBlockBoundaries
72
72
  export const encodeSixel = nativeBindings.encodeSixel ?? missingNativeExport("encodeSixel");
73
73
  export const execReplace = nativeBindings.execReplace ?? missingNativeExport("execReplace");
74
74
  export const executeShell = nativeBindings.executeShell ?? missingNativeExport("executeShell");
75
+ export const expandWindowsLongPath = nativeBindings.expandWindowsLongPath ?? missingNativeExport("expandWindowsLongPath");
75
76
  export const extractInlineSloppyRegions = nativeBindings.extractInlineSloppyRegions ?? missingNativeExport("extractInlineSloppyRegions");
76
77
  export const extractSegments = nativeBindings.extractSegments ?? missingNativeExport("extractSegments");
77
78
  export const fuzzyFind = nativeBindings.fuzzyFind ?? missingNativeExport("fuzzyFind");
78
79
  export const getSupportedLanguages = nativeBindings.getSupportedLanguages ?? missingNativeExport("getSupportedLanguages");
80
+ export const getWindowsShortPath = nativeBindings.getWindowsShortPath ?? missingNativeExport("getWindowsShortPath");
79
81
  export const getWorkProfile = nativeBindings.getWorkProfile ?? missingNativeExport("getWorkProfile");
80
82
  export const glob = nativeBindings.glob ?? missingNativeExport("glob");
81
83
  export const grep = nativeBindings.grep ?? missingNativeExport("grep");
@@ -0,0 +1,5 @@
1
+ /** Expand Windows 8.3 components without resolving symlinks or junctions. Load the addon only on Windows. */
2
+ export declare function expandWindowsLongPath(path: string): string;
3
+
4
+ /** Get the existing Windows 8.3 spelling. Load the addon only on Windows; preserve paths on other platforms. */
5
+ export declare function getWindowsShortPath(path: string): string;
package/native/path.js ADDED
@@ -0,0 +1,21 @@
1
+ import { loadNative, missingNativeExportMessage } from "./loader-state.js";
2
+
3
+ let bindings;
4
+
5
+ /** Load the addon once; an addon built before these helpers existed fails with rebuild guidance. */
6
+ function nativePathFn(symbolName) {
7
+ bindings ??= loadNative();
8
+ const fn = bindings[symbolName];
9
+ if (typeof fn !== "function") throw new Error(missingNativeExportMessage(symbolName));
10
+ return fn;
11
+ }
12
+
13
+ /** Expand Windows 8.3 components without resolving symlinks or junctions. Load the addon only on Windows. */
14
+ export function expandWindowsLongPath(path) {
15
+ return process.platform === "win32" ? nativePathFn("expandWindowsLongPath")(path) : path;
16
+ }
17
+
18
+ /** Get the existing Windows 8.3 spelling. Load the addon only on Windows; preserve paths on other platforms. */
19
+ export function getWindowsShortPath(path) {
20
+ return process.platform === "win32" ? nativePathFn("getWindowsShortPath")(path) : path;
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-natives",
3
- "version": "18.3.5",
3
+ "version": "18.4.1",
4
4
  "description": "Native Rust bindings for PDF conversion, audio, WebRTC, grep, clipboard, image processing, syntax highlighting, PTY, and shell operations via N-API",
5
5
  "type": "module",
6
6
  "homepage": "https://omp.sh",
@@ -77,6 +77,8 @@
77
77
  "native/version-sentinel.d.ts",
78
78
  "native/loader-state.js",
79
79
  "native/loader-state.d.ts",
80
+ "native/path.js",
81
+ "native/path.d.ts",
80
82
  "native/vcs.js",
81
83
  "native/vcs.d.ts",
82
84
  "native/embedded-addon.js",
@@ -90,6 +92,11 @@
90
92
  "import": "./native/index.js",
91
93
  "default": "./native/index.js"
92
94
  },
95
+ "./path": {
96
+ "types": "./native/path.d.ts",
97
+ "import": "./native/path.js",
98
+ "default": "./native/path.js"
99
+ },
93
100
  "./desktop": {
94
101
  "types": "./native/desktop.d.ts",
95
102
  "import": "./native/desktop.js",
@@ -107,11 +114,11 @@
107
114
  }
108
115
  },
109
116
  "optionalDependencies": {
110
- "@oh-my-pi/pi-natives-linux-x64": "18.3.5",
111
- "@oh-my-pi/pi-natives-linux-arm64": "18.3.5",
112
- "@oh-my-pi/pi-natives-darwin-x64": "18.3.5",
113
- "@oh-my-pi/pi-natives-darwin-arm64": "18.3.5",
114
- "@oh-my-pi/pi-natives-win32-x64": "18.3.5",
115
- "@oh-my-pi/pi-natives-win32-arm64": "18.3.5"
117
+ "@oh-my-pi/pi-natives-linux-x64": "18.4.1",
118
+ "@oh-my-pi/pi-natives-linux-arm64": "18.4.1",
119
+ "@oh-my-pi/pi-natives-darwin-x64": "18.4.1",
120
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.4.1",
121
+ "@oh-my-pi/pi-natives-win32-x64": "18.4.1",
122
+ "@oh-my-pi/pi-natives-win32-arm64": "18.4.1"
116
123
  }
117
124
  }