pi-hashline-edit-pro 0.17.3 → 0.17.5
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/package.json
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
const { execSync } = require("child_process");
|
|
2
|
+
const fs = require("fs");
|
|
2
3
|
const path = require("path");
|
|
3
4
|
|
|
4
5
|
const root = path.resolve(__dirname, "..");
|
|
6
|
+
const bsqlDir = path.join(root, "node_modules", "better-sqlite3");
|
|
5
7
|
|
|
6
8
|
try {
|
|
7
|
-
require(
|
|
9
|
+
require(bsqlDir);
|
|
8
10
|
process.exit(0);
|
|
9
11
|
} catch (e) {
|
|
10
12
|
const msg = e && typeof e.message === "string" ? e.message : String(e);
|
|
11
|
-
if (/GLIBC|Cannot find module|
|
|
13
|
+
if (/GLIBC|Cannot find module|dlo|not found/i.test(msg)) {
|
|
12
14
|
console.error("better-sqlite3 prebuilt incompatible, rebuilding from source...");
|
|
15
|
+
|
|
16
|
+
const prebuildDir = path.join(bsqlDir, "prebuilds");
|
|
17
|
+
if (fs.existsSync(prebuildDir)) {
|
|
18
|
+
const platform = process.platform + "-" + process.arch;
|
|
19
|
+
const prebuilt = path.join(prebuildDir, platform + ".node");
|
|
20
|
+
if (fs.existsSync(prebuilt)) {
|
|
21
|
+
fs.unlinkSync(prebuilt);
|
|
22
|
+
console.error("Removed incompatible prebuilt:", platform + ".node");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const buildDir = path.join(bsqlDir, "build");
|
|
27
|
+
if (fs.existsSync(buildDir)) {
|
|
28
|
+
fs.rmSync(buildDir, { recursive: true, force: true });
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
try {
|
|
14
|
-
execSync("
|
|
15
|
-
cwd:
|
|
32
|
+
execSync("npx --yes node-gyp rebuild", {
|
|
33
|
+
cwd: bsqlDir,
|
|
16
34
|
stdio: "inherit",
|
|
17
|
-
timeout:
|
|
35
|
+
timeout: 300000,
|
|
18
36
|
});
|
|
19
37
|
console.error("better-sqlite3 rebuilt successfully from source.");
|
|
20
38
|
} catch (rebuildErr) {
|