drizzle-kit 0.19.1 → 0.19.2-144c09c

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 +6 -6
  2. package/loader.mjs +20 -13
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -5532,7 +5532,7 @@ var init_mysqlImports = __esm({
5532
5532
  const schemas = [];
5533
5533
  for (let i = 0; i < imports.length; i++) {
5534
5534
  const it = imports[i];
5535
- const i0 = await import(`drizzle://${it}`);
5535
+ const i0 = await import(`__drizzle__${it}`);
5536
5536
  const i0values = Object.values(i0);
5537
5537
  i0values.forEach((t) => {
5538
5538
  if ((0, import_drizzle_orm.is)(t, import_mysql_core.MySqlTable)) {
@@ -5943,7 +5943,7 @@ var init_pgImports = __esm({
5943
5943
  const schemas = [];
5944
5944
  for (let i = 0; i < imports.length; i++) {
5945
5945
  const it = imports[i];
5946
- const i0 = await import(`drizzle://${it}`);
5946
+ const i0 = await import(`__drizzle__${it}`);
5947
5947
  const i0values = Object.values(i0);
5948
5948
  i0values.forEach((t) => {
5949
5949
  if ((0, import_pg_core.isPgEnum)(t)) {
@@ -6473,7 +6473,7 @@ var init_sqliteImports = __esm({
6473
6473
  const enums = [];
6474
6474
  for (let i = 0; i < imports.length; i++) {
6475
6475
  const it = imports[i];
6476
- const i0 = await import(`drizzle://${it}`);
6476
+ const i0 = await import(`__drizzle__${it}`);
6477
6477
  const i0values = Object.values(i0);
6478
6478
  i0values.forEach((t) => {
6479
6479
  if ((0, import_drizzle_orm7.is)(t, import_sqlite_core.SQLiteTable)) {
@@ -44774,7 +44774,7 @@ init_source();
44774
44774
  // package.json
44775
44775
  var package_default = {
44776
44776
  name: "drizzle-kit",
44777
- version: "0.19.1",
44777
+ version: "0.19.2",
44778
44778
  repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
44779
44779
  author: "Drizzle Team",
44780
44780
  license: "MIT",
@@ -45083,7 +45083,7 @@ var drizzleConfigFromFile = async (configPath) => {
45083
45083
  process.exit(1);
45084
45084
  }
45085
45085
  console.log(source_default.grey(`Reading config file '${path3}'`));
45086
- const required = await import(`drizzle://${path3}`);
45086
+ const required = await import(`__drizzle__${path3}`);
45087
45087
  const content = required.default ?? required;
45088
45088
  const res = mySqlCliConfigSchema.safeParse(content);
45089
45089
  if (!res.success) {
@@ -45113,7 +45113,7 @@ var readDrizzleConfig = async (configPath) => {
45113
45113
  process.exit(1);
45114
45114
  }
45115
45115
  console.log(source_default.grey(`Reading config file '${path3}'`));
45116
- const required = await import(`drizzle://${path3}`);
45116
+ const required = await import(`__drizzle__${path3}`);
45117
45117
  const content = required.default ?? required;
45118
45118
  return content;
45119
45119
  };
package/loader.mjs CHANGED
@@ -2,33 +2,40 @@ import esbuild from "esbuild";
2
2
  import * as path from "path";
3
3
  import { readFileSync } from "fs";
4
4
 
5
+ const parse = (it) => {
6
+ if (it.endsWith("__drizzle__")) {
7
+ const clean = it.slice(-"__drizzle__".length);
8
+ return { drizzle: true, clean, original: it };
9
+ }
10
+ return { drizzle: false, clean: it };
11
+ };
12
+
5
13
  export function resolve(specifier, context, nextResolve) {
6
- if (specifier.startsWith("drizzle://")) {
7
- if (!specifier.endsWith(".ts")) {
8
- const url = specifier.slice("drizzle://".length).toString();
9
- return nextResolve(url);
10
- }
14
+ const { drizzle, clean } = parse(specifier);
15
+ if (drizzle && !specifier.endsWith(".ts") && !specifier.endsWith(".mts")) {
16
+ return nextResolve(clean);
17
+ }
11
18
 
19
+ if (drizzle) {
12
20
  return {
13
21
  shortCircuit: true,
14
22
  url: specifier,
15
23
  };
16
24
  }
17
25
 
18
- const { parentURL: url } = context;
19
- const parentURL = url?.startsWith("drizzle://")
20
- ? new URL(`file://${path.resolve(url.slice("drizzle://".length))}`)
21
- : url;
26
+ const parsedParent = parse(context.parentURL);
27
+ const parentURL = parsedParent.drizzle
28
+ ? new URL(`file://${path.resolve(parsedParent.clean)}`)
29
+ : context.parentURL;
22
30
 
23
31
  // Let Node.js handle all other specifiers.
24
32
  return nextResolve(specifier, { ...context, parentURL });
25
33
  }
26
34
 
27
35
  export async function load(url, context, defaultLoad) {
28
- if (url.startsWith("drizzle://")) {
29
-
30
- const path = url.slice("drizzle://".length).trim();
31
- const file = readFileSync(path, "utf-8");
36
+ const { drizzle, clean } = parse(url);
37
+ if (drizzle) {
38
+ const file = readFileSync(clean, "utf-8");
32
39
  if (path.endsWith(".ts") || path.endsWith(".mts")) {
33
40
  const source = esbuild.transformSync(file, {
34
41
  loader: "ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.19.1",
3
+ "version": "0.19.2-144c09c",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",