@oh-my-pi/pi-natives 18.0.4 → 18.0.6
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/native/index.d.ts +91 -1
- package/native/index.js +8 -1
- package/package.json +6 -6
package/native/index.d.ts
CHANGED
|
@@ -61,6 +61,43 @@ export declare class DesktopSession {
|
|
|
61
61
|
close(): Promise<undefined>
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Incrementally ingests old/new text and computes an exact line diff on a
|
|
66
|
+
* worker thread once both sides finish.
|
|
67
|
+
*
|
|
68
|
+
* Complete lines are observable during ingestion. Only equal leading lines
|
|
69
|
+
* are declared stable before EOF; future input can change Myers alignment
|
|
70
|
+
* after the first mismatch.
|
|
71
|
+
*/
|
|
72
|
+
export declare class DiffStream {
|
|
73
|
+
/** Create an empty two-sided stream. */
|
|
74
|
+
constructor()
|
|
75
|
+
/** Append a JavaScript text chunk to one side. */
|
|
76
|
+
push(side: DiffSide, chunk: string): DiffStreamProgress
|
|
77
|
+
/** Append a UTF-8 subprocess/file chunk without a JS string conversion. */
|
|
78
|
+
pushBytes(side: DiffSide, chunk: Uint8Array): DiffStreamProgress
|
|
79
|
+
/** Mark one side complete; an unfinished final line then becomes visible. */
|
|
80
|
+
finishSide(side: DiffSide): DiffStreamProgress
|
|
81
|
+
/** Mark one side too large and complete without further ingestion. */
|
|
82
|
+
markTooLarge(side: DiffSide): DiffStreamProgress
|
|
83
|
+
/** Current ingestion state. */
|
|
84
|
+
progress(): DiffStreamProgress
|
|
85
|
+
/** Complete display lines from `from`, excluding newline terminators. */
|
|
86
|
+
lines(side: DiffSide, from: number, limit?: number | undefined | null): Array<string>
|
|
87
|
+
/** Snapshot all ingested text for one side. */
|
|
88
|
+
text(side: DiffSide): string
|
|
89
|
+
/**
|
|
90
|
+
* Read a filesystem path directly into one side on the native worker pool.
|
|
91
|
+
*
|
|
92
|
+
* JavaScript can poll [`DiffStream::progress`] and [`DiffStream::lines`]
|
|
93
|
+
* while this promise is pending; file bytes never need to cross into JS
|
|
94
|
+
* and back into the differ.
|
|
95
|
+
*/
|
|
96
|
+
openFile(side: DiffSide, path: string, maxBytes?: number | undefined | null, signal?: unknown | undefined | null): Promise<DiffStreamProgress>
|
|
97
|
+
/** Compute exact Myers runs and unified hunks off the JavaScript thread. */
|
|
98
|
+
finish(context?: number | undefined | null): Promise<DiffStreamResult>
|
|
99
|
+
}
|
|
100
|
+
|
|
64
101
|
/**
|
|
65
102
|
* Process-owned cross-platform advisory lock.
|
|
66
103
|
*
|
|
@@ -339,7 +376,7 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
339
376
|
* `packages/natives/native/index.js` (which derives the name from
|
|
340
377
|
* `package.json#version`).
|
|
341
378
|
*/
|
|
342
|
-
export declare function
|
|
379
|
+
export declare function __piNativesV18_0_6(): void
|
|
343
380
|
|
|
344
381
|
/**
|
|
345
382
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
|
@@ -855,6 +892,44 @@ export interface DiffRun {
|
|
|
855
892
|
removed: boolean
|
|
856
893
|
}
|
|
857
894
|
|
|
895
|
+
/** One side of a streamed line diff. */
|
|
896
|
+
export declare enum DiffSide {
|
|
897
|
+
/** Original/base text. */
|
|
898
|
+
Old = 'Old',
|
|
899
|
+
/** Updated/target text. */
|
|
900
|
+
New = 'New'
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/** Observable ingestion state for [`DiffStream`]. */
|
|
904
|
+
export interface DiffStreamProgress {
|
|
905
|
+
/** Complete old-side lines available for rendering. */
|
|
906
|
+
oldLines: number
|
|
907
|
+
/** Complete new-side lines available for rendering. */
|
|
908
|
+
newLines: number
|
|
909
|
+
/** Leading complete lines proven equal on both sides. */
|
|
910
|
+
stableCommonLines: number
|
|
911
|
+
/** Whether old-side ingestion has finished. */
|
|
912
|
+
oldDone: boolean
|
|
913
|
+
/** Whether new-side ingestion has finished. */
|
|
914
|
+
newDone: boolean
|
|
915
|
+
/** Whether either side contains a NUL byte/code unit. */
|
|
916
|
+
binary: boolean
|
|
917
|
+
/** Whether either native file exceeded its caller-provided size limit. */
|
|
918
|
+
tooLarge: boolean
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/** Exact line-diff output produced when a [`DiffStream`] finishes. */
|
|
922
|
+
export interface DiffStreamResult {
|
|
923
|
+
/** Line-token Myers runs used to align the complete files. */
|
|
924
|
+
runs: Array<DiffRun>
|
|
925
|
+
/** Unified hunks for the requested context. */
|
|
926
|
+
hunks: Array<PatchHunk>
|
|
927
|
+
/** Whether the old text ends in a newline. */
|
|
928
|
+
oldEndsNewline: boolean
|
|
929
|
+
/** Whether the new text ends in a newline. */
|
|
930
|
+
newEndsNewline: boolean
|
|
931
|
+
}
|
|
932
|
+
|
|
858
933
|
/**
|
|
859
934
|
* Word diff with jsdiff `diffWords(oldText, newText)` semantics (default
|
|
860
935
|
* options).
|
|
@@ -1829,6 +1904,18 @@ export interface PtyStartOptions {
|
|
|
1829
1904
|
shell?: string
|
|
1830
1905
|
}
|
|
1831
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* Rasterize SVG/SVGZ bytes into a bounded PNG without resolving local files.
|
|
1909
|
+
*
|
|
1910
|
+
* Conversion runs on the native blocking pool so parsing and rendering do not
|
|
1911
|
+
* stall the JavaScript event loop.
|
|
1912
|
+
*
|
|
1913
|
+
* # Errors
|
|
1914
|
+
* Returns an error for invalid SVG data, zero/oversized limits, allocation
|
|
1915
|
+
* failure, or PNG encoding failure.
|
|
1916
|
+
*/
|
|
1917
|
+
export declare function rasterizeSvg(input: Uint8Array, maxWidthPx: number, maxHeightPx: number): Promise<Uint8Array>
|
|
1918
|
+
|
|
1832
1919
|
/**
|
|
1833
1920
|
* Read an image from the system clipboard.
|
|
1834
1921
|
*
|
|
@@ -2158,6 +2245,9 @@ export interface VectorTopK {
|
|
|
2158
2245
|
*/
|
|
2159
2246
|
export declare function visibleWidth(text: string, tabWidth: number): number
|
|
2160
2247
|
|
|
2248
|
+
/** Warm syntax grammars and scope matchers on the native worker pool. */
|
|
2249
|
+
export declare function warmHighlighter(): Promise<undefined>
|
|
2250
|
+
|
|
2161
2251
|
/** Profiling results returned to JavaScript. */
|
|
2162
2252
|
export interface WorkProfile {
|
|
2163
2253
|
/** Folded stack format for flamegraph tools. */
|
package/native/index.js
CHANGED
|
@@ -20,6 +20,7 @@ const nativeBindings = loadNative();
|
|
|
20
20
|
export const AudioCapture = nativeBindings.AudioCapture;
|
|
21
21
|
export const AudioPlayback = nativeBindings.AudioPlayback;
|
|
22
22
|
export const DesktopSession = adaptDesktopSession(nativeBindings.DesktopSession);
|
|
23
|
+
export const DiffStream = nativeBindings.DiffStream;
|
|
23
24
|
export const FileLock = nativeBindings.FileLock;
|
|
24
25
|
export const HighlightStream = nativeBindings.HighlightStream;
|
|
25
26
|
export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
|
|
@@ -32,7 +33,7 @@ export const TtyWriter = nativeBindings.TtyWriter;
|
|
|
32
33
|
|
|
33
34
|
// functions
|
|
34
35
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
|
|
35
|
-
export const
|
|
36
|
+
export const __piNativesV18_0_6 = nativeBindings.__piNativesV18_0_6;
|
|
36
37
|
export const astEdit = nativeBindings.astEdit;
|
|
37
38
|
export const astGrep = nativeBindings.astGrep;
|
|
38
39
|
export const astMatch = nativeBindings.astMatch;
|
|
@@ -79,6 +80,7 @@ export const nodeChainAt = nativeBindings.nodeChainAt;
|
|
|
79
80
|
export const parseKey = nativeBindings.parseKey;
|
|
80
81
|
export const parseKittySequence = nativeBindings.parseKittySequence;
|
|
81
82
|
export const pdfToMarkdown = nativeBindings.pdfToMarkdown;
|
|
83
|
+
export const rasterizeSvg = nativeBindings.rasterizeSvg;
|
|
82
84
|
export const readImageFromClipboard = nativeBindings.readImageFromClipboard;
|
|
83
85
|
export const renderSnapcompactPng = nativeBindings.renderSnapcompactPng;
|
|
84
86
|
export const search = nativeBindings.search;
|
|
@@ -91,6 +93,7 @@ export const supportsLanguage = nativeBindings.supportsLanguage;
|
|
|
91
93
|
export const truncateToWidth = nativeBindings.truncateToWidth;
|
|
92
94
|
export const vectorIndexTopK = nativeBindings.vectorIndexTopK;
|
|
93
95
|
export const visibleWidth = nativeBindings.visibleWidth;
|
|
96
|
+
export const warmHighlighter = nativeBindings.warmHighlighter;
|
|
94
97
|
export const wrapTextWithAnsi = nativeBindings.wrapTextWithAnsi;
|
|
95
98
|
|
|
96
99
|
// string/numeric enums (napi-rs string_enum produces TS-only const enum)
|
|
@@ -102,6 +105,10 @@ export const AstMatchStrictness = {
|
|
|
102
105
|
Signature: "signature",
|
|
103
106
|
Template: "template",
|
|
104
107
|
};
|
|
108
|
+
export const DiffSide = {
|
|
109
|
+
Old: "Old",
|
|
110
|
+
New: "New",
|
|
111
|
+
};
|
|
105
112
|
export const Ellipsis = {
|
|
106
113
|
Unicode: 0,
|
|
107
114
|
Ascii: 1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.6",
|
|
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",
|
|
@@ -92,10 +92,10 @@
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
"optionalDependencies": {
|
|
95
|
-
"@oh-my-pi/pi-natives-linux-x64": "18.0.
|
|
96
|
-
"@oh-my-pi/pi-natives-linux-arm64": "18.0.
|
|
97
|
-
"@oh-my-pi/pi-natives-darwin-x64": "18.0.
|
|
98
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "18.0.
|
|
99
|
-
"@oh-my-pi/pi-natives-win32-x64": "18.0.
|
|
95
|
+
"@oh-my-pi/pi-natives-linux-x64": "18.0.6",
|
|
96
|
+
"@oh-my-pi/pi-natives-linux-arm64": "18.0.6",
|
|
97
|
+
"@oh-my-pi/pi-natives-darwin-x64": "18.0.6",
|
|
98
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "18.0.6",
|
|
99
|
+
"@oh-my-pi/pi-natives-win32-x64": "18.0.6"
|
|
100
100
|
}
|
|
101
101
|
}
|