@oh-my-pi/pi-natives 18.15.0 → 18.16.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/native/index.d.ts +52 -0
- package/native/index.js +9 -0
- package/native/sqlite-locks.d.ts +12 -0
- package/native/sqlite-locks.js +26 -0
- package/package.json +14 -7
package/native/index.d.ts
CHANGED
|
@@ -428,6 +428,24 @@ export declare class MacAppearanceObserver {
|
|
|
428
428
|
stop(): void
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
/** The app the user had in front when `macOSFrontApp()` read it. */
|
|
432
|
+
export declare class MacOSFrontApp {
|
|
433
|
+
/**
|
|
434
|
+
* Puts this app back in front, without raising its windows, each time the
|
|
435
|
+
* app that took the front from it takes it again during the next
|
|
436
|
+
* `durationMs`. Ends early once a hardware mouse button or ⌘/⌃ is used
|
|
437
|
+
* after the app was read, the app came from a launcher or Spotlight panel,
|
|
438
|
+
* or a different app comes forward: that is the user picking an app.
|
|
439
|
+
* Typing does not end it, and a hand-back macOS refuses for a key typed
|
|
440
|
+
* meanwhile is asked again. Holds nothing when called over a second after
|
|
441
|
+
* the latest read, as picks made since then went unwatched. Owns desktop
|
|
442
|
+
* input/focus control only for each hand-back, and rejects if another
|
|
443
|
+
* operation owns it then. Resolves how many times it put the app back.
|
|
444
|
+
*/
|
|
445
|
+
keepInFront(durationMs: number): Promise<number>
|
|
446
|
+
}
|
|
447
|
+
export type MacosFrontApp = MacOSFrontApp
|
|
448
|
+
|
|
431
449
|
/** A transactional, process-owned native OAuth callback receiver. */
|
|
432
450
|
export declare class NativeOAuthCallback {
|
|
433
451
|
/** Create a receiver without touching the filesystem or OS registration. */
|
|
@@ -2377,6 +2395,25 @@ export declare function hashlineStripPrefixes(lines: Array<string>): Array<strin
|
|
|
2377
2395
|
*/
|
|
2378
2396
|
export declare function hasMatch(content: string | Uint8Array, pattern: string | Uint8Array, ignoreCase?: boolean | undefined | null, multiline?: boolean | undefined | null): boolean
|
|
2379
2397
|
|
|
2398
|
+
/**
|
|
2399
|
+
* How `path` is held by this process: open through another descriptor and
|
|
2400
|
+
* locked. `null` when it is not, and always outside Linux.
|
|
2401
|
+
*
|
|
2402
|
+
* Looks at the path's inode through the descriptors already open, without
|
|
2403
|
+
* opening the file.
|
|
2404
|
+
*/
|
|
2405
|
+
export declare function heldFileKind(path: string): HeldFileKind | null
|
|
2406
|
+
|
|
2407
|
+
/** What a file this process holds locked is. */
|
|
2408
|
+
export declare enum HeldFileKind {
|
|
2409
|
+
/** A SQLite database this process has open with its locks. */
|
|
2410
|
+
Database = 'database',
|
|
2411
|
+
/** A SQLite WAL-index (`-shm`) file this process has open with its locks. */
|
|
2412
|
+
WalIndex = 'wal-index',
|
|
2413
|
+
/** Another file this process holds open with a record lock. */
|
|
2414
|
+
Locked = 'locked'
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2380
2417
|
/**
|
|
2381
2418
|
* Highlight code and return ANSI-colored lines.
|
|
2382
2419
|
*
|
|
@@ -2467,6 +2504,15 @@ export interface InlineSloppyRegion {
|
|
|
2467
2504
|
payload: string
|
|
2468
2505
|
}
|
|
2469
2506
|
|
|
2507
|
+
/**
|
|
2508
|
+
* Moves this process's SQLite record locks onto open-file-description locks.
|
|
2509
|
+
*
|
|
2510
|
+
* No other close of the file can release those (see `ofd_locks.rs`). Call it
|
|
2511
|
+
* before the process opens any SQLite database. Returns whether SQLite now
|
|
2512
|
+
* uses them: `false` outside Linux, or when Bun's SQLite is not found.
|
|
2513
|
+
*/
|
|
2514
|
+
export declare function installSqliteLockShim(): boolean
|
|
2515
|
+
|
|
2470
2516
|
/** Options for `IpcConnection.connect`. */
|
|
2471
2517
|
export interface IpcConnectOptions {
|
|
2472
2518
|
/**
|
|
@@ -2739,6 +2785,12 @@ export declare function macOSAutocorrectWord(text: string, start: number, length
|
|
|
2739
2785
|
*/
|
|
2740
2786
|
export declare function macOSCheckSpelling(text: string): Promise<Array<SpellingRange>>
|
|
2741
2787
|
|
|
2788
|
+
/**
|
|
2789
|
+
* The app macOS `WindowServer` has in front. `null` off macOS and when the
|
|
2790
|
+
* front-process SPI is unavailable.
|
|
2791
|
+
*/
|
|
2792
|
+
export declare function macOSFrontApp(): MacOSFrontApp | null
|
|
2793
|
+
|
|
2742
2794
|
/** Whether the host can use Apple's native spelling service. */
|
|
2743
2795
|
export declare function macOSSpellCheckerAvailable(): boolean
|
|
2744
2796
|
|
package/native/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export const IpcServer = nativeBindings.IpcServer;
|
|
|
36
36
|
export const LineMatcher = nativeBindings.LineMatcher;
|
|
37
37
|
export const LiveWebRtcPeer = nativeBindings.LiveWebRtcPeer;
|
|
38
38
|
export const MacAppearanceObserver = nativeBindings.MacAppearanceObserver;
|
|
39
|
+
export const MacOSFrontApp = nativeBindings.MacOSFrontApp;
|
|
39
40
|
export const NativeOAuthCallback = nativeBindings.NativeOAuthCallback;
|
|
40
41
|
export const PipeStreams = nativeBindings.PipeStreams;
|
|
41
42
|
export const PowerAssertion = nativeBindings.PowerAssertion;
|
|
@@ -100,8 +101,10 @@ export const hashlineFormatNumberedLines = nativeBindings.hashlineFormatNumbered
|
|
|
100
101
|
export const hashlineIsReadTruncationNotice = nativeBindings.hashlineIsReadTruncationNotice ?? missingNativeExport("hashlineIsReadTruncationNotice");
|
|
101
102
|
export const hashlineStripPrefixes = nativeBindings.hashlineStripPrefixes ?? missingNativeExport("hashlineStripPrefixes");
|
|
102
103
|
export const hasMatch = nativeBindings.hasMatch ?? missingNativeExport("hasMatch");
|
|
104
|
+
export const heldFileKind = nativeBindings.heldFileKind ?? missingNativeExport("heldFileKind");
|
|
103
105
|
export const highlightCode = nativeBindings.highlightCode ?? missingNativeExport("highlightCode");
|
|
104
106
|
export const htmlToMarkdown = nativeBindings.htmlToMarkdown ?? missingNativeExport("htmlToMarkdown");
|
|
107
|
+
export const installSqliteLockShim = nativeBindings.installSqliteLockShim ?? missingNativeExport("installSqliteLockShim");
|
|
105
108
|
export const ipcEndpoint = nativeBindings.ipcEndpoint ?? missingNativeExport("ipcEndpoint");
|
|
106
109
|
export const isoBackend = nativeBindings.isoBackend ?? missingNativeExport("isoBackend");
|
|
107
110
|
export const isoDiff = nativeBindings.isoDiff ?? missingNativeExport("isoDiff");
|
|
@@ -113,6 +116,7 @@ export const isoStop = nativeBindings.isoStop ?? missingNativeExport("isoStop");
|
|
|
113
116
|
export const listWorkspace = nativeBindings.listWorkspace ?? missingNativeExport("listWorkspace");
|
|
114
117
|
export const macOSAutocorrectWord = nativeBindings.macOSAutocorrectWord ?? missingNativeExport("macOSAutocorrectWord");
|
|
115
118
|
export const macOSCheckSpelling = nativeBindings.macOSCheckSpelling ?? missingNativeExport("macOSCheckSpelling");
|
|
119
|
+
export const macOSFrontApp = nativeBindings.macOSFrontApp ?? missingNativeExport("macOSFrontApp");
|
|
116
120
|
export const macOSSpellCheckerAvailable = nativeBindings.macOSSpellCheckerAvailable ?? missingNativeExport("macOSSpellCheckerAvailable");
|
|
117
121
|
export const macOSSpellingGuesses = nativeBindings.macOSSpellingGuesses ?? missingNativeExport("macOSSpellingGuesses");
|
|
118
122
|
export const matchesKey = nativeBindings.matchesKey ?? missingNativeExport("matchesKey");
|
|
@@ -198,6 +202,11 @@ export const GrepOutputMode = {
|
|
|
198
202
|
Count: "count",
|
|
199
203
|
FilesWithMatches: "filesWithMatches",
|
|
200
204
|
};
|
|
205
|
+
export const HeldFileKind = {
|
|
206
|
+
Database: "database",
|
|
207
|
+
WalIndex: "wal-index",
|
|
208
|
+
Locked: "locked",
|
|
209
|
+
};
|
|
201
210
|
export const IsoBackendKind = {
|
|
202
211
|
Apfs: 0,
|
|
203
212
|
Btrfs: 1,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HeldFileKind } from "./index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lazily loading forms of the SQLite lock exports in `index.d.ts`: the addon
|
|
5
|
+
* loads on the first call instead of at import.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Moves this process's SQLite record locks onto open-file-description locks; `false` when unavailable. */
|
|
9
|
+
export declare function installSqliteLockShim(): boolean;
|
|
10
|
+
|
|
11
|
+
/** How `path` is held by this process (open elsewhere and locked), or `null`. */
|
|
12
|
+
export declare function heldFileKind(path: string): HeldFileKind | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { loadNative } from "./loader-state.js";
|
|
2
|
+
|
|
3
|
+
let bindings;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Load the addon on first use, so importing this module (pi-utils' SQLite
|
|
7
|
+
* helpers) costs nothing in processes that never open a database. An addon
|
|
8
|
+
* built before these exports existed (a stale local build, or PR CI, which
|
|
9
|
+
* tests against main's newest addon) yields `undefined`: the store still opens,
|
|
10
|
+
* unprotected, and `ensureSqliteLockShim` reports it.
|
|
11
|
+
*/
|
|
12
|
+
function native(symbolName) {
|
|
13
|
+
bindings ??= loadNative();
|
|
14
|
+
const value = bindings[symbolName];
|
|
15
|
+
return typeof value === "function" ? value : undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** See `installSqliteLockShim` in `index.d.ts`; `false` from an addon predating it. */
|
|
19
|
+
export function installSqliteLockShim() {
|
|
20
|
+
return native("installSqliteLockShim")?.() ?? false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** See `heldFileKind` in `index.d.ts`; `null` from an addon predating it. */
|
|
24
|
+
export function heldFileKind(path) {
|
|
25
|
+
return native("heldFileKind")?.(path) ?? null;
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.16.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",
|
|
@@ -78,6 +78,8 @@
|
|
|
78
78
|
"native/loader-state.d.ts",
|
|
79
79
|
"native/path.js",
|
|
80
80
|
"native/path.d.ts",
|
|
81
|
+
"native/sqlite-locks.js",
|
|
82
|
+
"native/sqlite-locks.d.ts",
|
|
81
83
|
"native/vcs.js",
|
|
82
84
|
"native/vcs.d.ts",
|
|
83
85
|
"native/embedded-addon.js",
|
|
@@ -111,14 +113,19 @@
|
|
|
111
113
|
"types": "./native/vcs.d.ts",
|
|
112
114
|
"import": "./native/vcs.js",
|
|
113
115
|
"default": "./native/vcs.js"
|
|
116
|
+
},
|
|
117
|
+
"./sqlite-locks": {
|
|
118
|
+
"types": "./native/sqlite-locks.d.ts",
|
|
119
|
+
"import": "./native/sqlite-locks.js",
|
|
120
|
+
"default": "./native/sqlite-locks.js"
|
|
114
121
|
}
|
|
115
122
|
},
|
|
116
123
|
"optionalDependencies": {
|
|
117
|
-
"@oh-my-pi/pi-natives-linux-x64": "18.
|
|
118
|
-
"@oh-my-pi/pi-natives-linux-arm64": "18.
|
|
119
|
-
"@oh-my-pi/pi-natives-darwin-x64": "18.
|
|
120
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "18.
|
|
121
|
-
"@oh-my-pi/pi-natives-win32-x64": "18.
|
|
122
|
-
"@oh-my-pi/pi-natives-win32-arm64": "18.
|
|
124
|
+
"@oh-my-pi/pi-natives-linux-x64": "18.16.0",
|
|
125
|
+
"@oh-my-pi/pi-natives-linux-arm64": "18.16.0",
|
|
126
|
+
"@oh-my-pi/pi-natives-darwin-x64": "18.16.0",
|
|
127
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "18.16.0",
|
|
128
|
+
"@oh-my-pi/pi-natives-win32-x64": "18.16.0",
|
|
129
|
+
"@oh-my-pi/pi-natives-win32-arm64": "18.16.0"
|
|
123
130
|
}
|
|
124
131
|
}
|