pi-goosedump 0.10.6 → 0.10.7
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/index.ts +29 -2
- package/package.json +2 -2
package/index.ts
CHANGED
|
@@ -271,6 +271,33 @@ function resolveGoosedumpBinary(): string {
|
|
|
271
271
|
return require.resolve('@jarkkojs/goosedump/bin/goosedump.js');
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
function resolveNativeGoosedumpBinary(): string {
|
|
275
|
+
const target = `${process.platform}-${process.arch}`;
|
|
276
|
+
let packageName: string;
|
|
277
|
+
let binaryName = 'goosedump';
|
|
278
|
+
|
|
279
|
+
switch (target) {
|
|
280
|
+
case 'linux-x64':
|
|
281
|
+
packageName = '@jarkkojs/goosedump-linux-x64';
|
|
282
|
+
break;
|
|
283
|
+
case 'darwin-arm64':
|
|
284
|
+
packageName = '@jarkkojs/goosedump-darwin-arm64';
|
|
285
|
+
break;
|
|
286
|
+
case 'win32-x64':
|
|
287
|
+
packageName = '@jarkkojs/goosedump-win32-x64';
|
|
288
|
+
binaryName = 'goosedump.exe';
|
|
289
|
+
break;
|
|
290
|
+
default:
|
|
291
|
+
throw new Error(`unsupported platform architecture: ${target}`);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const wrapperRequire = createRequire(resolveGoosedumpBinary());
|
|
295
|
+
const packageDir = dirname(wrapperRequire.resolve(`${packageName}/package.json`));
|
|
296
|
+
const binaryPath = join(packageDir, 'bin', binaryName);
|
|
297
|
+
if (!existsSync(binaryPath)) throw new Error(`binary not found: ${binaryPath}`);
|
|
298
|
+
return binaryPath;
|
|
299
|
+
}
|
|
300
|
+
|
|
274
301
|
function clip(value: string, max: number): string {
|
|
275
302
|
return value.length > max ? `${value.slice(0, max)}...` : value;
|
|
276
303
|
}
|
|
@@ -437,8 +464,8 @@ function runGoosedump(args: string[]): string {
|
|
|
437
464
|
function runGoosedumpAsync(args: string[], signal?: AbortSignal): Promise<GoosedumpCommandOutput> {
|
|
438
465
|
return new Promise((resolve, reject) => {
|
|
439
466
|
execFile(
|
|
440
|
-
|
|
441
|
-
|
|
467
|
+
resolveNativeGoosedumpBinary(),
|
|
468
|
+
args,
|
|
442
469
|
{
|
|
443
470
|
encoding: 'utf-8',
|
|
444
471
|
maxBuffer: 16 * 1024 * 1024,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-goosedump",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Pi extension for goosedump-backed session-history search, entry expansion, and compaction",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compaction",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@earendil-works/pi-tui": "^0.78.0",
|
|
36
|
-
"@jarkkojs/goosedump": "^0.10.
|
|
36
|
+
"@jarkkojs/goosedump": "^0.10.7",
|
|
37
37
|
"@sinclair/typebox": "^0.34.49"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|