@oh-my-pi/pi-natives 17.2.8 → 17.2.9
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 +1 -1
- package/native/index.js +1 -1
- package/native/loader-state.d.ts +2 -0
- package/native/loader-state.js +24 -2
- package/package.json +6 -6
package/native/index.d.ts
CHANGED
|
@@ -279,7 +279,7 @@ export declare function __ompInstallTokioRuntime(): void
|
|
|
279
279
|
* `packages/natives/native/index.js` (which derives the name from
|
|
280
280
|
* `package.json#version`).
|
|
281
281
|
*/
|
|
282
|
-
export declare function
|
|
282
|
+
export declare function __piNativesV17_2_9(): void
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
285
|
* Apply ast-grep rewrite rules to matching files; honors `dryRun` and returns
|
package/native/index.js
CHANGED
|
@@ -29,7 +29,7 @@ export const Shell = nativeBindings.Shell;
|
|
|
29
29
|
|
|
30
30
|
// functions
|
|
31
31
|
export const __ompInstallTokioRuntime = nativeBindings.__ompInstallTokioRuntime;
|
|
32
|
-
export const
|
|
32
|
+
export const __piNativesV17_2_9 = nativeBindings.__piNativesV17_2_9;
|
|
33
33
|
export const astEdit = nativeBindings.astEdit;
|
|
34
34
|
export const astGrep = nativeBindings.astGrep;
|
|
35
35
|
export const astMatch = nativeBindings.astMatch;
|
package/native/loader-state.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ export interface CleanupStaleNativeVersionsInput {
|
|
|
88
88
|
|
|
89
89
|
export function cleanupStaleNativeVersions(input: CleanupStaleNativeVersionsInput): string[];
|
|
90
90
|
|
|
91
|
+
export function prepareNativeVersionDir(versionedDir: string): void;
|
|
92
|
+
|
|
91
93
|
export interface ExtractEmbeddedAddonArchiveInput {
|
|
92
94
|
archivePath: string;
|
|
93
95
|
files: EmbeddedAddonFile[];
|
package/native/loader-state.js
CHANGED
|
@@ -196,6 +196,26 @@ function isOlderReleaseVersion(candidate, current) {
|
|
|
196
196
|
return false;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
// A concurrently starting older OMP binary creates or refreshes this directory
|
|
200
|
+
// before extracting its addon. Keep fresh directories long enough for that
|
|
201
|
+
// startup to finish; a later launch can reclaim them once they are genuinely
|
|
202
|
+
// stale.
|
|
203
|
+
const NATIVE_CACHE_CLEANUP_GRACE_MS = 10 * 60_000;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create a version cache directory and refresh its activity timestamp before
|
|
207
|
+
* extraction or staging begins. Recursive mkdir does not update the mtime of
|
|
208
|
+
* an existing directory, so the explicit touch is what protects interrupted
|
|
209
|
+
* or partially populated caches from concurrent cleanup.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} versionedDir
|
|
212
|
+
*/
|
|
213
|
+
export function prepareNativeVersionDir(versionedDir) {
|
|
214
|
+
fs.mkdirSync(versionedDir, { recursive: true });
|
|
215
|
+
const now = new Date();
|
|
216
|
+
fs.utimesSync(versionedDir, now, now);
|
|
217
|
+
}
|
|
218
|
+
|
|
199
219
|
/**
|
|
200
220
|
* Remove version-pinned native cache directories older than the loaded package.
|
|
201
221
|
* Best-effort by design: permission errors and concurrent processes must not
|
|
@@ -217,6 +237,8 @@ export function cleanupStaleNativeVersions({ nativesDir, currentVersion }) {
|
|
|
217
237
|
if (!entry.isDirectory() || !isOlderReleaseVersion(entry.name, currentVersion)) continue;
|
|
218
238
|
const targetPath = path.join(nativesDir, entry.name);
|
|
219
239
|
try {
|
|
240
|
+
const stat = fs.statSync(targetPath);
|
|
241
|
+
if (Date.now() - stat.mtimeMs < NATIVE_CACHE_CLEANUP_GRACE_MS) continue;
|
|
220
242
|
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
221
243
|
removed.push(targetPath);
|
|
222
244
|
} catch {
|
|
@@ -514,7 +536,7 @@ function maybeExtractEmbeddedAddon(ctx, errors) {
|
|
|
514
536
|
|
|
515
537
|
startupMarker("native:extractEmbeddedAddon:start");
|
|
516
538
|
try {
|
|
517
|
-
|
|
539
|
+
prepareNativeVersionDir(ctx.versionedDir);
|
|
518
540
|
} catch (err) {
|
|
519
541
|
const message = err instanceof Error ? err.message : String(err);
|
|
520
542
|
errors.push(`embedded addon dir: ${message}`);
|
|
@@ -581,7 +603,7 @@ function maybeStageNodeModulesAddon(ctx, errors) {
|
|
|
581
603
|
if (!fs.existsSync(sourcePath)) continue;
|
|
582
604
|
|
|
583
605
|
try {
|
|
584
|
-
|
|
606
|
+
prepareNativeVersionDir(ctx.versionedDir);
|
|
585
607
|
} catch (err) {
|
|
586
608
|
const message = err instanceof Error ? err.message : String(err);
|
|
587
609
|
errors.push(`staged addon dir: ${message}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-natives",
|
|
3
|
-
"version": "17.2.
|
|
3
|
+
"version": "17.2.9",
|
|
4
4
|
"description": "Native Rust bindings for 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",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"optionalDependencies": {
|
|
83
|
-
"@oh-my-pi/pi-natives-linux-x64": "17.2.
|
|
84
|
-
"@oh-my-pi/pi-natives-linux-arm64": "17.2.
|
|
85
|
-
"@oh-my-pi/pi-natives-darwin-x64": "17.2.
|
|
86
|
-
"@oh-my-pi/pi-natives-darwin-arm64": "17.2.
|
|
87
|
-
"@oh-my-pi/pi-natives-win32-x64": "17.2.
|
|
83
|
+
"@oh-my-pi/pi-natives-linux-x64": "17.2.9",
|
|
84
|
+
"@oh-my-pi/pi-natives-linux-arm64": "17.2.9",
|
|
85
|
+
"@oh-my-pi/pi-natives-darwin-x64": "17.2.9",
|
|
86
|
+
"@oh-my-pi/pi-natives-darwin-arm64": "17.2.9",
|
|
87
|
+
"@oh-my-pi/pi-natives-win32-x64": "17.2.9"
|
|
88
88
|
}
|
|
89
89
|
}
|