@kenkaiiii/gg-pixel 4.3.88 → 4.3.89
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/dist/index.cjs +16 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/index.ts
|
|
@@ -385,8 +375,21 @@ var NodeHttpSink = class extends HttpSink {
|
|
|
385
375
|
// src/core/sinks/local-sqlite.ts
|
|
386
376
|
var import_node_os = require("os");
|
|
387
377
|
var import_node_fs2 = require("fs");
|
|
378
|
+
var import_node_module = require("module");
|
|
388
379
|
var import_node_path = require("path");
|
|
389
|
-
var
|
|
380
|
+
var import_meta = {};
|
|
381
|
+
var requireBSQ = (0, import_node_module.createRequire)(import_meta.url);
|
|
382
|
+
function loadBetterSqlite3() {
|
|
383
|
+
try {
|
|
384
|
+
const mod = requireBSQ("better-sqlite3");
|
|
385
|
+
return typeof mod === "function" ? mod : mod.default;
|
|
386
|
+
} catch (err) {
|
|
387
|
+
throw new Error(
|
|
388
|
+
`@kenkaiiii/gg-pixel: \`kind: "local"\` requires the optional peer dependency \`better-sqlite3\`. Install it with \`npm install better-sqlite3\` (or your package manager's equivalent). Underlying error: ${err.message}`,
|
|
389
|
+
{ cause: err }
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
390
393
|
var SCHEMA = `
|
|
391
394
|
CREATE TABLE IF NOT EXISTS events (
|
|
392
395
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -410,9 +413,10 @@ var LocalSqliteSink = class {
|
|
|
410
413
|
db;
|
|
411
414
|
insert;
|
|
412
415
|
constructor(path) {
|
|
416
|
+
const Database = loadBetterSqlite3();
|
|
413
417
|
const resolved = path ?? (0, import_node_path.join)((0, import_node_os.homedir)(), ".gg", "errors.db");
|
|
414
418
|
(0, import_node_fs2.mkdirSync)((0, import_node_path.dirname)(resolved), { recursive: true });
|
|
415
|
-
this.db = new
|
|
419
|
+
this.db = new Database(resolved);
|
|
416
420
|
this.db.pragma("journal_mode = WAL");
|
|
417
421
|
this.db.exec(SCHEMA);
|
|
418
422
|
this.insert = this.db.prepare(`
|