drizzle-kit 0.18.1-2ed41af → 0.18.1-47fb399

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.
Files changed (3) hide show
  1. package/index.cjs +1 -1
  2. package/loader.mjs +9 -1
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env -S node --loader drizzle-kit/loader --no-warnings
1
+ #!/usr/bin/env -S node --loader drizzle-kit/loader.mjs --no-warnings
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
package/loader.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import esbuild from "esbuild";
2
+ import * as path from "path";
2
3
  import { readFileSync } from "fs";
3
4
 
4
5
  export function resolve(specifier, context, nextResolve) {
@@ -7,18 +8,25 @@ export function resolve(specifier, context, nextResolve) {
7
8
  const url = specifier.slice("drizzle://".length).toString();
8
9
  return nextResolve(url);
9
10
  }
11
+
10
12
  return {
11
13
  shortCircuit: true,
12
14
  url: specifier,
13
15
  };
14
16
  }
15
17
 
18
+ const { parentURL: url } = context;
19
+ const parentURL = url?.startsWith("drizzle://")
20
+ ? new URL(`file://${path.resolve(url.slice("drizzle://".length))}`)
21
+ : url;
22
+
16
23
  // Let Node.js handle all other specifiers.
17
- return nextResolve(specifier);
24
+ return nextResolve(specifier, { ...context, parentURL });
18
25
  }
19
26
 
20
27
  export async function load(url, context, defaultLoad) {
21
28
  if (url.startsWith("drizzle://")) {
29
+
22
30
  const path = url.slice("drizzle://".length).trim();
23
31
  const file = readFileSync(path, "utf-8");
24
32
  if (path.endsWith(".ts") || path.endsWith(".mts")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.18.1-2ed41af",
3
+ "version": "0.18.1-47fb399",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",