rake-db 2.3.20 → 2.3.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rake-db",
3
- "version": "2.3.20",
3
+ "version": "2.3.21",
4
4
  "description": "Migrations tool for Postgresql DB",
5
5
  "homepage": "https://orchid-orm.netlify.app/guide/migration-setup-and-overview.html",
6
6
  "repository": {
package/src/common.ts CHANGED
@@ -11,7 +11,6 @@ import Enquirer from 'enquirer';
11
11
  import path from 'path';
12
12
  import { readdir } from 'fs/promises';
13
13
  import { RakeDbAst } from './ast';
14
- import CallSite = NodeJS.CallSite;
15
14
 
16
15
  type Db = DbResult<DefaultColumnTypes>;
17
16
 
@@ -60,7 +59,7 @@ export const processRakeDbConfig = (
60
59
  const result = { ...migrationConfigDefaults, ...config };
61
60
 
62
61
  if (!result.basePath) {
63
- let stack: CallSite[] | undefined;
62
+ let stack: NodeJS.CallSite[] | undefined;
64
63
  Error.prepareStackTrace = (_, s) => (stack = s);
65
64
  new Error().stack;
66
65
  if (stack) {
@@ -71,11 +70,15 @@ export const processRakeDbConfig = (
71
70
  continue;
72
71
  }
73
72
 
74
- // sometimes file can be in format file:///path/to/file.ts, sometimes it's a normal path
75
- // casting it to a normal path
76
- try {
77
- file = new URL(file).pathname;
78
- } catch (_) {}
73
+ // on Windows with ESM file is file:///C:/path/to/file.ts
74
+ // it is not a valid URL
75
+ if (/file:\/\/\/\w+:\//.test(file)) {
76
+ file = decodeURI(file.slice(8));
77
+ } else {
78
+ try {
79
+ file = new URL(file).pathname;
80
+ } catch (_) {}
81
+ }
79
82
 
80
83
  result.basePath = path.dirname(file);
81
84
  break;