@dbcube/core 4.0.3 → 4.1.4

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.js CHANGED
@@ -131,6 +131,8 @@ import followRedirects from "follow-redirects";
131
131
  import * as unzipper from "unzipper";
132
132
  import ora from "ora";
133
133
  import chalk from "chalk";
134
+ import { fileURLToPath } from "url";
135
+ import { dirname } from "path";
134
136
  var { https } = followRedirects;
135
137
  var Downloader = class {
136
138
  static mainSpinner = null;
@@ -361,6 +363,8 @@ var Downloader = class {
361
363
  }
362
364
  }
363
365
  static getDefaultBinDir() {
366
+ const __filename2 = typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath(import.meta.url) : "";
367
+ const __dirname = __filename2 ? dirname(__filename2) : process.cwd();
364
368
  const possibleDirs = [
365
369
  path.resolve(process.cwd(), ".dbcube", "bin"),
366
370
  path.resolve(process.cwd(), "node_modules", ".dbcube", "bin"),
@@ -389,6 +393,8 @@ var Downloader = class {
389
393
  import * as fs2 from "fs";
390
394
  import * as path2 from "path";
391
395
  import * as os3 from "os";
396
+ import { fileURLToPath as fileURLToPath2 } from "url";
397
+ import { dirname as dirname2 } from "path";
392
398
  var Binary = class {
393
399
  static isDownloading = false;
394
400
  static downloadPromise = null;
@@ -429,6 +435,8 @@ var Binary = class {
429
435
  }
430
436
  }
431
437
  static getBinDir() {
438
+ const __filename2 = typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath2(import.meta.url) : "";
439
+ const __dirname = __filename2 ? dirname2(__filename2) : process.cwd();
432
440
  const possibleDirs = [
433
441
  path2.resolve(process.cwd(), ".dbcube", "bin"),
434
442
  path2.resolve(process.cwd(), "node_modules", ".dbcube", "bin"),
@@ -608,7 +616,12 @@ var Engine = class {
608
616
  const configFilePath = path3.resolve(process.cwd(), "dbcube.config.js");
609
617
  const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
610
618
  const require2 = createRequire(requireUrl);
611
- delete require2.cache[require2.resolve(configFilePath)];
619
+ if (require2.cache && require2.resolve) {
620
+ try {
621
+ delete require2.cache[require2.resolve(configFilePath)];
622
+ } catch (e) {
623
+ }
624
+ }
612
625
  const configModule = require2(configFilePath);
613
626
  const configFn = configModule.default || configModule;
614
627
  if (typeof configFn === "function") {
@@ -812,7 +825,12 @@ var QueryEngine = class {
812
825
  const configFilePath = path4.resolve(process.cwd(), "dbcube.config.js");
813
826
  const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
814
827
  const require2 = createRequire2(requireUrl);
815
- delete require2.cache[require2.resolve(configFilePath)];
828
+ if (require2.cache && require2.resolve) {
829
+ try {
830
+ delete require2.cache[require2.resolve(configFilePath)];
831
+ } catch (e) {
832
+ }
833
+ }
816
834
  const configModule = require2(configFilePath);
817
835
  const configFn = configModule.default || configModule;
818
836
  if (typeof configFn === "function") {
@@ -1281,6 +1299,8 @@ import * as path5 from "path";
1281
1299
  import * as fs3 from "fs";
1282
1300
  import { promisify } from "util";
1283
1301
  import { createRequire as createRequire3 } from "module";
1302
+ import { fileURLToPath as fileURLToPath3 } from "url";
1303
+ import { dirname as dirname3 } from "path";
1284
1304
  var execAsync = promisify(exec);
1285
1305
  var SqliteExecutor = class {
1286
1306
  binaryPath;
@@ -1290,6 +1310,8 @@ var SqliteExecutor = class {
1290
1310
  this.binaryPath = this.getBinaryPath();
1291
1311
  }
1292
1312
  getBinaryPath() {
1313
+ const __filename2 = typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath3(import.meta.url) : "";
1314
+ const __dirname = __filename2 ? dirname3(__filename2) : process.cwd();
1293
1315
  const possibleDirs = [
1294
1316
  path5.resolve(process.cwd(), ".dbcube", "bin"),
1295
1317
  path5.resolve(process.cwd(), "node_modules", ".dbcube", "bin"),
@@ -1412,7 +1434,8 @@ var SqliteExecutor = class {
1412
1434
  }
1413
1435
  // Para compatibilidad con better-sqlite3 API sincrona usando deasync si es necesario
1414
1436
  prepareSync(sql) {
1415
- const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
1437
+ const __filename2 = typeof import.meta !== "undefined" && import.meta.url ? fileURLToPath3(import.meta.url) : "";
1438
+ const requireUrl = __filename2 || import.meta.url;
1416
1439
  const require2 = createRequire3(requireUrl);
1417
1440
  const deasync = require2("deasync");
1418
1441
  return {