@dbcube/core 1.0.40 → 1.0.44

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
@@ -1,10 +1,3 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
1
  // src/lib/Engine.ts
9
2
  import path3 from "path";
10
3
 
@@ -555,6 +548,7 @@ var Config = class {
555
548
 
556
549
  // src/lib/Engine.ts
557
550
  import { spawn } from "child_process";
551
+ import { createRequire } from "module";
558
552
  var Engine = class {
559
553
  name;
560
554
  config;
@@ -609,12 +603,23 @@ var Engine = class {
609
603
  }
610
604
  setConfig(name) {
611
605
  const configInstance = new Config();
612
- const configFilePath = path3.resolve(process.cwd(), "dbcube.config.js");
613
- const configFn = __require(configFilePath);
614
- if (typeof configFn === "function") {
615
- configFn(configInstance);
616
- } else {
617
- console.error("\u274C El archivo dbcube.config.js no exporta una funci\xF3n.");
606
+ try {
607
+ const configFilePath = path3.resolve(process.cwd(), "dbcube.config.js");
608
+ const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
609
+ const require2 = createRequire(requireUrl);
610
+ delete require2.cache[require2.resolve(configFilePath)];
611
+ const configModule = require2(configFilePath);
612
+ const configFn = configModule.default || configModule;
613
+ if (typeof configFn === "function") {
614
+ configFn(configInstance);
615
+ } else {
616
+ console.error("\u274C El archivo dbcube.config.js no exporta una funci\xF3n.");
617
+ }
618
+ } catch (error) {
619
+ console.error("\u274C Error loading config file:", error.message);
620
+ if (error.code === "MODULE_NOT_FOUND") {
621
+ console.error("\u274C Config file not found, please create a dbcube.config.js file");
622
+ }
618
623
  }
619
624
  return configInstance.getDatabase(name);
620
625
  }
@@ -647,6 +652,7 @@ var Engine = class {
647
652
  };
648
653
  child.stdout.on("data", (data) => {
649
654
  stdoutBuffer += data.toString();
655
+ console.log(stdoutBuffer);
650
656
  const match = stdoutBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
651
657
  if (match) {
652
658
  try {
@@ -667,6 +673,7 @@ var Engine = class {
667
673
  });
668
674
  child.stderr.on("data", (data) => {
669
675
  stderrBuffer += data.toString();
676
+ console.log(stderrBuffer);
670
677
  const match = stderrBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
671
678
  if (match) {
672
679
  try {
@@ -715,6 +722,7 @@ import { exec } from "child_process";
715
722
  import * as path4 from "path";
716
723
  import * as fs3 from "fs";
717
724
  import { promisify } from "util";
725
+ import { createRequire as createRequire2 } from "module";
718
726
  var execAsync = promisify(exec);
719
727
  var SqliteExecutor = class {
720
728
  binaryPath;
@@ -846,7 +854,9 @@ var SqliteExecutor = class {
846
854
  }
847
855
  // Para compatibilidad con better-sqlite3 API sincrona usando deasync si es necesario
848
856
  prepareSync(sql) {
849
- const deasync = __require("deasync");
857
+ const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
858
+ const require2 = createRequire2(requireUrl);
859
+ const deasync = require2("deasync");
850
860
  return {
851
861
  all: (...params) => {
852
862
  let result;