rake-db 2.10.63 → 2.10.64

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
@@ -5,7 +5,7 @@ var orchidCore = require('orchid-core');
5
5
  var path = require('path');
6
6
  var promises = require('fs/promises');
7
7
  var prompts = require('prompts');
8
- var url = require('url');
8
+ var node_url = require('node:url');
9
9
 
10
10
  var __defProp$7 = Object.defineProperty;
11
11
  var __defProps$5 = Object.defineProperties;
@@ -71,12 +71,15 @@ const processRakeDbConfig = (config) => {
71
71
  delete result.logger;
72
72
  }
73
73
  if (!result.basePath || !result.dbScript) {
74
- const filePath = (_a = orchidCore.getStackTrace()) == null ? void 0 : _a[3].getFileName();
74
+ let filePath = (_a = orchidCore.getStackTrace()) == null ? void 0 : _a[3].getFileName();
75
75
  if (!filePath) {
76
76
  throw new Error(
77
77
  "Failed to determine path to db script. Please set basePath option of rakeDb"
78
78
  );
79
79
  }
80
+ if (filePath.startsWith("file://")) {
81
+ filePath = node_url.fileURLToPath(filePath);
82
+ }
80
83
  const ext = path.extname(filePath);
81
84
  if (ext !== ".ts" && ext !== ".js" && ext !== ".mjs") {
82
85
  throw new Error(
@@ -267,7 +270,7 @@ async function getMigrationsFromFiles(config, up) {
267
270
  } catch (err) {
268
271
  if (err.code !== "ERR_UNSUPPORTED_ESM_URL_SCHEME")
269
272
  throw err;
270
- await imp(url.pathToFileURL(filePath).pathname);
273
+ await imp(node_url.pathToFileURL(filePath).pathname);
271
274
  }
272
275
  }
273
276
  };