@dbcube/core 1.0.40 → 1.0.43

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
  }
@@ -715,6 +720,7 @@ import { exec } from "child_process";
715
720
  import * as path4 from "path";
716
721
  import * as fs3 from "fs";
717
722
  import { promisify } from "util";
723
+ import { createRequire as createRequire2 } from "module";
718
724
  var execAsync = promisify(exec);
719
725
  var SqliteExecutor = class {
720
726
  binaryPath;
@@ -846,7 +852,9 @@ var SqliteExecutor = class {
846
852
  }
847
853
  // Para compatibilidad con better-sqlite3 API sincrona usando deasync si es necesario
848
854
  prepareSync(sql) {
849
- const deasync = __require("deasync");
855
+ const requireUrl = typeof __filename !== "undefined" ? __filename : process.cwd();
856
+ const require2 = createRequire2(requireUrl);
857
+ const deasync = require2("deasync");
850
858
  return {
851
859
  all: (...params) => {
852
860
  let result;