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.
- package/index.cjs +1 -1
- package/loader.mjs +9 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
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")) {
|