wowok 2.2.8 → 2.2.10

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.
Files changed (48) hide show
  1. package/NOTICE +4 -4
  2. package/README.md +0 -10
  3. package/THIRD_PARTY_LICENSES/MIT_LICENSE.txt +2 -2
  4. package/dist/cjs/w/call/guard-ins.js +1 -1
  5. package/dist/cjs/w/call/guard.d.ts +1 -1
  6. package/dist/cjs/w/call/guard.js +1 -1
  7. package/dist/cjs/w/call/permission.js +1 -1
  8. package/dist/cjs/w/call/service.d.ts +3 -3
  9. package/dist/cjs/w/call/service.js +1 -1
  10. package/dist/cjs/w/exception.js +1 -1
  11. package/dist/cjs/w/local/storage.d.ts +1 -1
  12. package/dist/cjs/w/local/storage.js +1 -1
  13. package/dist/cjs/w/messenger/pq/store-adapter.d.ts +1 -1
  14. package/dist/cjs/w/messenger/storage.d.ts +1 -1
  15. package/dist/cjs/w/messenger/storage.js +1 -1
  16. package/dist/cjs/w/query/object.d.ts +1 -1
  17. package/dist/cjs/w/query/object.js +1 -1
  18. package/dist/esm/w/call/guard-ins.js +1 -1
  19. package/dist/esm/w/call/guard.d.ts +1 -1
  20. package/dist/esm/w/call/guard.js +1 -1
  21. package/dist/esm/w/call/permission.js +1 -1
  22. package/dist/esm/w/call/service.d.ts +3 -3
  23. package/dist/esm/w/call/service.js +1 -1
  24. package/dist/esm/w/exception.js +1 -1
  25. package/dist/esm/w/local/storage.d.ts +1 -1
  26. package/dist/esm/w/local/storage.js +1 -1
  27. package/dist/esm/w/messenger/pq/store-adapter.d.ts +1 -1
  28. package/dist/esm/w/messenger/storage.d.ts +1 -1
  29. package/dist/esm/w/messenger/storage.js +1 -1
  30. package/dist/esm/w/query/object.d.ts +1 -1
  31. package/dist/esm/w/query/object.js +1 -1
  32. package/package.json +2 -15
  33. package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-arm64.node +0 -0
  34. package/prebuilds/better-sqlite3-v12.9.0-node-v115-darwin-x64.node +0 -0
  35. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm.node +0 -0
  36. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-arm64.node +0 -0
  37. package/prebuilds/better-sqlite3-v12.9.0-node-v115-linux-x64.node +0 -0
  38. package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-arm64.node +0 -0
  39. package/prebuilds/better-sqlite3-v12.9.0-node-v115-win32-x64.node +0 -0
  40. package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-arm64.node +0 -0
  41. package/prebuilds/better-sqlite3-v12.9.0-node-v127-darwin-x64.node +0 -0
  42. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm.node +0 -0
  43. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-arm64.node +0 -0
  44. package/prebuilds/better-sqlite3-v12.9.0-node-v127-linux-x64.node +0 -0
  45. package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-arm64.node +0 -0
  46. package/prebuilds/better-sqlite3-v12.9.0-node-v127-win32-x64.node +0 -0
  47. package/scripts/download-prebuilds.js +0 -252
  48. package/scripts/install-better-sqlite3.js +0 -377
@@ -1,252 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Download prebuilt binaries for common platforms
5
- *
6
- * Run this script before publishing to include prebuilt binaries for all common platforms
7
- * Users can then use local prebuilt binaries directly (Option B)
8
- */
9
-
10
- import { execSync } from "child_process";
11
- import fs from "fs";
12
- import path from "path";
13
- import { fileURLToPath } from "url";
14
-
15
- const __filename = fileURLToPath(import.meta.url);
16
- const __dirname = path.dirname(__filename);
17
-
18
- const GREEN = "\x1b[32m";
19
- const YELLOW = "\x1b[33m";
20
- const RED = "\x1b[31m";
21
- const BLUE = "\x1b[34m";
22
- const NC = "\x1b[0m";
23
-
24
- function log(message) {
25
- console.log(message);
26
- }
27
-
28
- function logInfo(message) {
29
- console.log(`${BLUE}${message}${NC}`);
30
- }
31
-
32
- function logSuccess(message) {
33
- console.log(`${GREEN}${message}${NC}`);
34
- }
35
-
36
- function logWarning(message) {
37
- console.log(`${YELLOW}${message}${NC}`);
38
- }
39
-
40
- function logError(message) {
41
- console.log(`${RED}${message}${NC}`);
42
- }
43
-
44
- // Platform list to download (extensive coverage)
45
- // Node ABI versions: 127=Node 22, 120=Node 21, 115=Node 20, 108=Node 18, 93=Node 16
46
- const TARGET_PLATFORMS = [
47
- // ==================== Linux ====================
48
- // Linux x64 (most common)
49
- { platform: "linux", arch: "x64", nodeAbi: "127" }, // Node 22
50
- { platform: "linux", arch: "x64", nodeAbi: "120" }, // Node 21
51
- { platform: "linux", arch: "x64", nodeAbi: "115" }, // Node 20
52
- { platform: "linux", arch: "x64", nodeAbi: "108" }, // Node 18
53
- // Linux arm64 (ARM servers/Raspberry Pi)
54
- { platform: "linux", arch: "arm64", nodeAbi: "127" },
55
- { platform: "linux", arch: "arm64", nodeAbi: "120" },
56
- { platform: "linux", arch: "arm64", nodeAbi: "115" },
57
- // Linux arm (32-bit ARM)
58
- { platform: "linux", arch: "arm", nodeAbi: "127" },
59
- { platform: "linux", arch: "arm", nodeAbi: "115" },
60
-
61
- // ==================== macOS ====================
62
- // macOS x64 (Intel Mac)
63
- { platform: "darwin", arch: "x64", nodeAbi: "127" },
64
- { platform: "darwin", arch: "x64", nodeAbi: "120" },
65
- { platform: "darwin", arch: "x64", nodeAbi: "115" },
66
- { platform: "darwin", arch: "x64", nodeAbi: "108" },
67
- // macOS arm64 (Apple Silicon M1/M2/M3)
68
- { platform: "darwin", arch: "arm64", nodeAbi: "127" },
69
- { platform: "darwin", arch: "arm64", nodeAbi: "120" },
70
- { platform: "darwin", arch: "arm64", nodeAbi: "115" },
71
- { platform: "darwin", arch: "arm64", nodeAbi: "108" },
72
-
73
- // ==================== Windows ====================
74
- // Windows x64 (most common)
75
- { platform: "win32", arch: "x64", nodeAbi: "127" },
76
- { platform: "win32", arch: "x64", nodeAbi: "120" },
77
- { platform: "win32", arch: "x64", nodeAbi: "115" },
78
- { platform: "win32", arch: "x64", nodeAbi: "108" },
79
- // Windows ia32 (32-bit Windows)
80
- { platform: "win32", arch: "ia32", nodeAbi: "127" },
81
- { platform: "win32", arch: "ia32", nodeAbi: "115" },
82
- // Windows arm64 (Windows on ARM)
83
- { platform: "win32", arch: "arm64", nodeAbi: "127" },
84
- { platform: "win32", arch: "arm64", nodeAbi: "115" },
85
-
86
- // ==================== FreeBSD ====================
87
- { platform: "freebsd", arch: "x64", nodeAbi: "127" },
88
- { platform: "freebsd", arch: "x64", nodeAbi: "115" },
89
- ];
90
-
91
- function getBetterSqlite3Version() {
92
- const packageJsonPath = path.join(
93
- process.cwd(),
94
- "node_modules",
95
- "better-sqlite3",
96
- "package.json",
97
- );
98
- if (!fs.existsSync(packageJsonPath)) {
99
- throw new Error(
100
- "better-sqlite3 not installed, please run npm install first",
101
- );
102
- }
103
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
104
- return packageJson.version;
105
- }
106
-
107
- function downloadPrebuilt(version, platformInfo, prebuildsDir) {
108
- const fullKey = `node-v${platformInfo.nodeAbi}-${platformInfo.platform}-${platformInfo.arch}`;
109
- const downloadUrl = `https://github.com/WiseLibs/better-sqlite3/releases/download/v${version}/better-sqlite3-v${version}-${fullKey}.tar.gz`;
110
-
111
- const tempFile = path.join(prebuildsDir, `.temp-${fullKey}.tar.gz`);
112
-
113
- try {
114
- // Download
115
- if (process.platform === "win32") {
116
- execSync(
117
- `powershell -Command "Invoke-WebRequest -Uri '${downloadUrl}' -OutFile '${tempFile}'"`,
118
- {
119
- stdio: "pipe",
120
- },
121
- );
122
- } else {
123
- execSync(`curl -L -o "${tempFile}" "${downloadUrl}"`, {
124
- stdio: "pipe",
125
- });
126
- }
127
-
128
- // Extract
129
- const extractDir = path.join(prebuildsDir, `.temp-${fullKey}`);
130
- fs.mkdirSync(extractDir, { recursive: true });
131
- execSync(`tar -xzf "${tempFile}" -C "${extractDir}"`, {
132
- stdio: "pipe",
133
- });
134
-
135
- // Find extracted .node file
136
- const files = fs.readdirSync(extractDir);
137
- const nodeFile = files.find((f) => f.endsWith(".node"));
138
-
139
- if (!nodeFile) {
140
- throw new Error(".node file not found");
141
- }
142
-
143
- // Rename to standard format
144
- const sourcePath = path.join(extractDir, nodeFile);
145
- const targetName = `better-sqlite3-v${version}-${fullKey}.node`;
146
- const targetPath = path.join(prebuildsDir, targetName);
147
-
148
- fs.copyFileSync(sourcePath, targetPath);
149
-
150
- // Cleanup temp files
151
- fs.rmSync(extractDir, { recursive: true, force: true });
152
- fs.unlinkSync(tempFile);
153
-
154
- return targetName;
155
- } catch (error) {
156
- // Cleanup temp files
157
- if (fs.existsSync(tempFile)) {
158
- fs.unlinkSync(tempFile);
159
- }
160
- const tempDir = path.join(prebuildsDir, `.temp-${fullKey}`);
161
- if (fs.existsSync(tempDir)) {
162
- fs.rmSync(tempDir, { recursive: true, force: true });
163
- }
164
- throw error;
165
- }
166
- }
167
-
168
- function main() {
169
- log(`${BLUE}=== Download better-sqlite3 Prebuilt Binaries ===${NC}`);
170
-
171
- // Check if better-sqlite3 is installed
172
- const betterSqlite3Path = path.join(
173
- process.cwd(),
174
- "node_modules",
175
- "better-sqlite3",
176
- );
177
- if (!fs.existsSync(betterSqlite3Path)) {
178
- logError("better-sqlite3 not installed, please run npm install first");
179
- process.exit(1);
180
- }
181
-
182
- // Get better-sqlite3 version
183
- let version;
184
- try {
185
- version = getBetterSqlite3Version();
186
- logInfo(`better-sqlite3 version: ${version}`);
187
- } catch (error) {
188
- logError(error.message);
189
- process.exit(1);
190
- }
191
-
192
- // Create prebuilds directory
193
- const prebuildsDir = path.join(process.cwd(), "prebuilds");
194
- fs.mkdirSync(prebuildsDir, { recursive: true });
195
-
196
- logInfo(`Prebuilt binaries will be saved to: ${prebuildsDir}`);
197
- logInfo(`Target platforms: ${TARGET_PLATFORMS.length}`);
198
- log("");
199
-
200
- // Download prebuilt binaries for each platform
201
- let successCount = 0;
202
- let failCount = 0;
203
-
204
- for (const platformInfo of TARGET_PLATFORMS) {
205
- const fullKey = `node-v${platformInfo.nodeAbi}-${platformInfo.platform}-${platformInfo.arch}`;
206
- const targetName = `better-sqlite3-v${version}-${fullKey}.node`;
207
- const targetPath = path.join(prebuildsDir, targetName);
208
-
209
- // Check if already exists
210
- if (fs.existsSync(targetPath)) {
211
- logSuccess(`✓ ${fullKey}: already exists`);
212
- successCount++;
213
- continue;
214
- }
215
-
216
- process.stdout.write(` Downloading ${fullKey}... `);
217
-
218
- try {
219
- downloadPrebuilt(version, platformInfo, prebuildsDir);
220
- logSuccess("success");
221
- successCount++;
222
- } catch (error) {
223
- logWarning("failed");
224
- failCount++;
225
- }
226
- }
227
-
228
- log("");
229
- logSuccess(`========================================`);
230
- logSuccess(
231
- `Download complete: ${successCount} success, ${failCount} failed`,
232
- );
233
- logSuccess(`========================================`);
234
- log("");
235
-
236
- // List downloaded files
237
- const files = fs
238
- .readdirSync(prebuildsDir)
239
- .filter((f) => f.endsWith(".node"));
240
- logInfo("Downloaded prebuilt binaries:");
241
- for (const file of files.sort()) {
242
- const stats = fs.statSync(path.join(prebuildsDir, file));
243
- const size = (stats.size / 1024 / 1024).toFixed(2);
244
- log(` - ${file} (${size} MB)`);
245
- }
246
-
247
- log("");
248
- logInfo("Tip: These prebuilt binaries will be included in the npm package");
249
- logInfo(" Users can install without network or compilation tools");
250
- }
251
-
252
- main();
@@ -1,377 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * better-sqlite3 prebuilt binary installation script
5
- *
6
- * Hybrid approach (Option B priority, Option A fallback):
7
- * 1. First check for local prebuilt binaries (Option B) - priority, no network required
8
- * 2. If no matching local version, try downloading from GitHub (Option A)
9
- * 3. If download fails, prompt user for manual installation
10
- *
11
- * This script runs in the following scenarios:
12
- * - During development when running npm install
13
- * - When users install the wowok package
14
- * - When other packages depend on wowok
15
- */
16
-
17
- import { execSync } from "child_process";
18
- import fs from "fs";
19
- import path from "path";
20
- import { fileURLToPath } from "url";
21
-
22
- const __filename = fileURLToPath(import.meta.url);
23
- const __dirname = path.dirname(__filename);
24
-
25
- const GREEN = "\x1b[32m";
26
- const YELLOW = "\x1b[33m";
27
- const RED = "\x1b[31m";
28
- const BLUE = "\x1b[34m";
29
- const NC = "\x1b[0m";
30
-
31
- function log(message) {
32
- console.log(message);
33
- }
34
-
35
- function logInfo(message) {
36
- console.log(`${BLUE}${message}${NC}`);
37
- }
38
-
39
- function logSuccess(message) {
40
- console.log(`${GREEN}${message}${NC}`);
41
- }
42
-
43
- function logWarning(message) {
44
- console.log(`${YELLOW}${message}${NC}`);
45
- }
46
-
47
- function logError(message) {
48
- console.log(`${RED}${message}${NC}`);
49
- }
50
-
51
- // Detect if currently being installed as a dependency
52
- function getInstallContext() {
53
- const cwd = process.cwd();
54
- const isDependency =
55
- cwd.includes("node_modules") ||
56
- !fs.existsSync(path.join(cwd, "package.json"));
57
- return {
58
- cwd,
59
- isDependency,
60
- isDirectInstall: !isDependency,
61
- };
62
- }
63
-
64
- function getPlatformInfo() {
65
- const platform = process.platform;
66
- const arch = process.arch;
67
- const nodeAbi = process.versions.modules;
68
-
69
- const platformMap = {
70
- linux: "linux",
71
- darwin: "darwin",
72
- win32: "win32",
73
- freebsd: "freebsd",
74
- };
75
-
76
- return {
77
- platform: platformMap[platform] || platform,
78
- arch,
79
- nodeAbi,
80
- platformKey: `${platform}-${arch}`,
81
- fullKey: `node-v${nodeAbi}-${platformMap[platform] || platform}-${arch}`,
82
- };
83
- }
84
-
85
- function findLocalPrebuilt(platformInfo, packageRoot) {
86
- const prebuildsDir = path.join(packageRoot, "prebuilds");
87
-
88
- if (fs.existsSync(prebuildsDir)) {
89
- const files = fs.readdirSync(prebuildsDir);
90
-
91
- const exactPattern = new RegExp(
92
- `better-sqlite3-v[\\d.]+-${platformInfo.fullKey}\\.node$`,
93
- );
94
- for (const file of files) {
95
- if (exactPattern.test(file)) {
96
- return {
97
- path: path.join(prebuildsDir, file),
98
- exactMatch: true,
99
- source: "package",
100
- };
101
- }
102
- }
103
-
104
- const platformArchPattern = new RegExp(
105
- `better-sqlite3-v[\\d.]+-node-v[\\d]+-${platformInfo.platform}-${platformInfo.arch}\\.node$`,
106
- );
107
- for (const file of files) {
108
- if (platformArchPattern.test(file)) {
109
- logWarning(
110
- `Found similar version: ${file} (Node ABI may not match)`,
111
- );
112
- return {
113
- path: path.join(prebuildsDir, file),
114
- exactMatch: false,
115
- source: "package",
116
- };
117
- }
118
- }
119
- }
120
-
121
- return null;
122
- }
123
-
124
- function copyPrebuiltToBetterSqlite3(
125
- sourcePath,
126
- betterSqlite3Path,
127
- platformInfo,
128
- ) {
129
- const targetDir = path.join(betterSqlite3Path, "build", "Release");
130
- const targetPath = path.join(targetDir, "better_sqlite3.node");
131
-
132
- fs.mkdirSync(targetDir, { recursive: true });
133
- fs.copyFileSync(sourcePath, targetPath);
134
-
135
- const bindingDir = path.join(
136
- betterSqlite3Path,
137
- "lib",
138
- "binding",
139
- platformInfo.fullKey,
140
- );
141
- fs.mkdirSync(bindingDir, { recursive: true });
142
- fs.copyFileSync(sourcePath, path.join(bindingDir, "better_sqlite3.node"));
143
-
144
- return targetPath;
145
- }
146
-
147
- function downloadPrebuilt(platformInfo, betterSqlite3Path) {
148
- const packageJsonPath = path.join(betterSqlite3Path, "package.json");
149
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
150
- const version = packageJson.version;
151
-
152
- const downloadUrl = `https://github.com/WiseLibs/better-sqlite3/releases/download/v${version}/better-sqlite3-v${version}-${platformInfo.fullKey}.tar.gz`;
153
-
154
- const tempDir = path.join(betterSqlite3Path, ".download-temp");
155
- fs.mkdirSync(tempDir, { recursive: true });
156
- const tempFile = path.join(tempDir, "prebuilt.tar.gz");
157
-
158
- try {
159
- if (process.platform === "win32") {
160
- execSync(
161
- `powershell -Command "Invoke-WebRequest -Uri '${downloadUrl}' -OutFile '${tempFile}'"`,
162
- {
163
- stdio: "pipe",
164
- },
165
- );
166
- } else {
167
- execSync(`curl -L -o "${tempFile}" "${downloadUrl}"`, {
168
- stdio: "pipe",
169
- });
170
- }
171
-
172
- const extractDir = path.join(tempDir, "extracted");
173
- fs.mkdirSync(extractDir, { recursive: true });
174
- execSync(`tar -xzf "${tempFile}" -C "${extractDir}"`, {
175
- stdio: "pipe",
176
- });
177
-
178
- const files = fs.readdirSync(extractDir);
179
- const nodeFile = files.find((f) => f.endsWith(".node"));
180
-
181
- if (!nodeFile) {
182
- throw new Error(".node file not found");
183
- }
184
-
185
- const sourcePath = path.join(extractDir, nodeFile);
186
- const targetPath = copyPrebuiltToBetterSqlite3(
187
- sourcePath,
188
- betterSqlite3Path,
189
- platformInfo,
190
- );
191
-
192
- fs.rmSync(tempDir, { recursive: true, force: true });
193
-
194
- return targetPath;
195
- } catch (error) {
196
- if (fs.existsSync(tempDir)) {
197
- fs.rmSync(tempDir, { recursive: true, force: true });
198
- }
199
- throw error;
200
- }
201
- }
202
-
203
- function tryPrebuildInstall(betterSqlite3Path) {
204
- try {
205
- execSync("npx prebuild-install --verbose", {
206
- cwd: betterSqlite3Path,
207
- stdio: "pipe",
208
- });
209
- return fs.existsSync(
210
- path.join(
211
- betterSqlite3Path,
212
- "build",
213
- "Release",
214
- "better_sqlite3.node",
215
- ),
216
- );
217
- } catch (error) {
218
- return false;
219
- }
220
- }
221
-
222
- function main() {
223
- const context = getInstallContext();
224
- const platformInfo = getPlatformInfo();
225
-
226
- const packageRoot = __dirname.includes("node_modules")
227
- ? path.resolve(__dirname, "..")
228
- : process.cwd();
229
-
230
- const isSilent = context.isDependency;
231
-
232
- if (!isSilent) {
233
- log(`${BLUE}=== better-sqlite3 Prebuilt Binary Installation ===${NC}`);
234
- logInfo(`Platform: ${platformInfo.platform}-${platformInfo.arch}`);
235
- logInfo(`Node.js ABI: node-v${platformInfo.nodeAbi}`);
236
- }
237
-
238
- const possiblePaths = [
239
- path.join(packageRoot, "node_modules", "better-sqlite3"),
240
- path.join(process.cwd(), "node_modules", "better-sqlite3"),
241
- path.join(packageRoot, "..", "better-sqlite3"),
242
- ];
243
-
244
- let betterSqlite3Path = null;
245
- for (const p of possiblePaths) {
246
- if (fs.existsSync(p)) {
247
- betterSqlite3Path = p;
248
- break;
249
- }
250
- }
251
-
252
- if (!betterSqlite3Path) {
253
- if (!isSilent) {
254
- logWarning(
255
- "better-sqlite3 not installed, skipping prebuilt binary installation",
256
- );
257
- logInfo(
258
- "Tip: To use SQLite features, run: npm install better-sqlite3",
259
- );
260
- }
261
- return;
262
- }
263
-
264
- const prebuiltPath = path.join(
265
- betterSqlite3Path,
266
- "build",
267
- "Release",
268
- "better_sqlite3.node",
269
- );
270
- if (fs.existsSync(prebuiltPath)) {
271
- if (!isSilent) {
272
- logSuccess("better-sqlite3 prebuilt binary already exists");
273
- }
274
- return;
275
- }
276
-
277
- if (!isSilent) {
278
- logInfo("");
279
- logInfo("Step 1: Looking for local prebuilt binaries...");
280
- }
281
-
282
- const localPrebuilt = findLocalPrebuilt(platformInfo, packageRoot);
283
-
284
- if (localPrebuilt) {
285
- try {
286
- copyPrebuiltToBetterSqlite3(
287
- localPrebuilt.path,
288
- betterSqlite3Path,
289
- platformInfo,
290
- );
291
- if (!isSilent) {
292
- if (localPrebuilt.exactMatch) {
293
- logSuccess(
294
- "Installed successfully using local prebuilt binary!",
295
- );
296
- } else {
297
- logWarning(
298
- "Installed using similar version, but Node ABI may not match",
299
- );
300
- logInfo(
301
- " If issues occur, consider downloading matching version from GitHub",
302
- );
303
- }
304
- }
305
- return;
306
- } catch (error) {
307
- if (!isSilent) {
308
- logError(`Failed to use local version: ${error.message}`);
309
- }
310
- }
311
- } else if (!isSilent) {
312
- logInfo("No local prebuilt binaries found");
313
- }
314
-
315
- if (!isSilent) {
316
- logInfo("");
317
- logInfo("Step 2: Trying to download prebuilt binary from GitHub...");
318
- }
319
-
320
- if (tryPrebuildInstall(betterSqlite3Path)) {
321
- if (!isSilent) {
322
- logSuccess("Downloaded successfully via prebuild-install!");
323
- }
324
- return;
325
- }
326
-
327
- try {
328
- downloadPrebuilt(platformInfo, betterSqlite3Path);
329
- if (!isSilent) {
330
- logSuccess("Downloaded and installed successfully from GitHub!");
331
- }
332
- return;
333
- } catch (error) {
334
- if (!isSilent) {
335
- logError(`Download failed: ${error.message}`);
336
- }
337
- }
338
-
339
- if (!isSilent) {
340
- logInfo("");
341
- logWarning("========================================");
342
- logWarning("better-sqlite3 prebuilt binary installation failed");
343
- logWarning("========================================");
344
- logInfo("");
345
- logInfo("You can try the following solutions:");
346
- logInfo("");
347
- logInfo("1. Manually download prebuilt binary:");
348
- logInfo(
349
- ` Visit: https://github.com/WiseLibs/better-sqlite3/releases`,
350
- );
351
- logInfo(
352
- ` Download: better-sqlite3-v{version}-${platformInfo.fullKey}.tar.gz`,
353
- );
354
- logInfo(` Extract to: ${betterSqlite3Path}/build/Release/`);
355
- logInfo("");
356
- logInfo("2. Build from source (requires Python and C++ toolchain):");
357
- logInfo(" npm install better-sqlite3 --build-from-source");
358
- logInfo("");
359
- logInfo("3. Use a compatible Node.js version:");
360
- logInfo(
361
- " Check: https://github.com/WiseLibs/better-sqlite3/releases",
362
- );
363
- logInfo(" Find matching prebuilt binaries");
364
- logInfo("");
365
- logWarning("Note: better-sqlite3 will attempt to compile on first use");
366
- logWarning(" Runtime errors may occur if build tools are missing");
367
- } else {
368
- logWarning(
369
- `[wowok] better-sqlite3 prebuilt binary installation failed (${platformInfo.fullKey})`,
370
- );
371
- logWarning(
372
- "[wowok] For SQLite features, manually install prebuilt binary or build toolchain",
373
- );
374
- }
375
- }
376
-
377
- main();