@oh-my-pi/pi-natives 18.3.4 → 18.4.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.
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
@@ -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
  *
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.4",
3
+ "version": "18.4.0",
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.4",
111
- "@oh-my-pi/pi-natives-linux-arm64": "18.3.4",
112
- "@oh-my-pi/pi-natives-darwin-x64": "18.3.4",
113
- "@oh-my-pi/pi-natives-darwin-arm64": "18.3.4",
114
- "@oh-my-pi/pi-natives-win32-x64": "18.3.4",
115
- "@oh-my-pi/pi-natives-win32-arm64": "18.3.4"
117
+ "@oh-my-pi/pi-natives-linux-x64": "18.4.0",
118
+ "@oh-my-pi/pi-natives-linux-arm64": "18.4.0",
119
+ "@oh-my-pi/pi-natives-darwin-x64": "18.4.0",
120
+ "@oh-my-pi/pi-natives-darwin-arm64": "18.4.0",
121
+ "@oh-my-pi/pi-natives-win32-x64": "18.4.0",
122
+ "@oh-my-pi/pi-natives-win32-arm64": "18.4.0"
116
123
  }
117
124
  }