Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: Yash Singh <[email protected]>
53 lines
1.6 KiB
Diff
53 lines
1.6 KiB
Diff
diff --git a/package.json b/package.json
|
|
index e000a78..8432546 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -11,7 +11,7 @@
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.js",
|
|
- "require": "./dist/index.cjs",
|
|
+ "require": "./dist/index.js",
|
|
"default": "./dist/index.js"
|
|
},
|
|
"./package.json": "./package.json"
|
|
diff --git a/dist/index.js b/dist/index.js
|
|
index 7c1d722..1d0bc27 100644
|
|
--- a/dist/index.js
|
|
+++ b/dist/index.js
|
|
@@ -1,7 +1,7 @@
|
|
// src/binary.ts
|
|
import { existsSync, readFileSync } from "fs";
|
|
import { createRequire } from "module";
|
|
-import { dirname, join } from "path";
|
|
+import { dirname, join, sep } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
// src/platform.ts
|
|
@@ -120,6 +120,16 @@ function getPackageDir() {
|
|
function binaryExists() {
|
|
return findBinary() !== null;
|
|
}
|
|
+function resolveUnpackedAsarPath(binaryPath) {
|
|
+ const pathSegments = binaryPath.split(sep);
|
|
+ const asarIndex = pathSegments.findLastIndex((segment) => segment.endsWith(".asar"));
|
|
+ if (asarIndex === -1) {
|
|
+ return binaryPath;
|
|
+ }
|
|
+ pathSegments[asarIndex] = `${pathSegments[asarIndex]}.unpacked`;
|
|
+ const unpackedPath = pathSegments.join(sep);
|
|
+ return existsSync(unpackedPath) ? unpackedPath : binaryPath;
|
|
+}
|
|
function resolveFromNpmPackage() {
|
|
const packageName = getNpmPackageName();
|
|
try {
|
|
@@ -128,7 +138,7 @@ function resolveFromNpmPackage() {
|
|
const packageDir = dirname(packageJsonPath);
|
|
const binaryPath = join(packageDir, getLibFilename());
|
|
if (existsSync(binaryPath)) {
|
|
- return binaryPath;
|
|
+ return resolveUnpackedAsarPath(binaryPath);
|
|
}
|
|
} catch {
|
|
}
|