drizzle-kit 0.19.2-69e5db4 → 0.19.2-9340465

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 +7 -6
  2. package/loader.mjs +25 -15
  3. package/package.json +2 -1
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env -S node --loader drizzle-kit/loader.mjs --no-warnings
1
+ #!/usr/bin/env -S node --loader @esbuild-kit/esm-loader --no-warnings
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -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(`${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(`${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(`${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)) {
@@ -44849,6 +44849,7 @@ var package_default = {
44849
44849
  "better-sqlite3": "^8.4.0",
44850
44850
  dockerode: "^3.3.4",
44851
44851
  dotenv: "^16.0.3",
44852
+ "drizzle-kit": "0.19.2-e313bce",
44852
44853
  "drizzle-orm": "0.27.0-56b9edc",
44853
44854
  esbuild: "^0.17.19",
44854
44855
  "esbuild-register": "^3.4.2",
@@ -45083,7 +45084,7 @@ var drizzleConfigFromFile = async (configPath) => {
45083
45084
  process.exit(1);
45084
45085
  }
45085
45086
  console.log(source_default.grey(`Reading config file '${path3}'`));
45086
- const required = await import(`__drizzle__${path3}`);
45087
+ const required = await import(`${path3}`);
45087
45088
  const content = required.default ?? required;
45088
45089
  const res = mySqlCliConfigSchema.safeParse(content);
45089
45090
  if (!res.success) {
@@ -45113,7 +45114,7 @@ var readDrizzleConfig = async (configPath) => {
45113
45114
  process.exit(1);
45114
45115
  }
45115
45116
  console.log(source_default.grey(`Reading config file '${path3}'`));
45116
- const required = await import(`__drizzle__${path3}`);
45117
+ const required = await import(`${path3}`);
45117
45118
  const content = required.default ?? required;
45118
45119
  return content;
45119
45120
  };
package/loader.mjs CHANGED
@@ -2,34 +2,44 @@ 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) return { drizzle: false };
7
+
8
+ if (it.endsWith("__drizzle__")) {
9
+ const offset = "file://".length;
10
+ const clean = it.slice(offset, -"__drizzle__".length);
11
+ return { drizzle: true, clean, original: it };
12
+ }
13
+ return { drizzle: false, clean: it };
14
+ };
15
+
5
16
  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
- }
17
+ const { drizzle, clean } = parse(specifier);
18
+ if (drizzle && !clean.endsWith(".ts") && !clean.endsWith(".mts")) {
19
+ return nextResolve(clean);
20
+ }
11
21
 
22
+ if (drizzle) {
12
23
  return {
13
24
  shortCircuit: true,
14
- url: specifier,
25
+ url: `file://${specifier}`,
15
26
  };
16
27
  }
17
28
 
18
- const { parentURL: url } = context;
19
- const parentURL = url?.startsWith("__drizzle__")
20
- ? new URL(`file://${path.resolve(url.slice("__drizzle__".length))}`)
21
- : url;
29
+ const parsedParent = parse(context.parentURL);
30
+ const parentURL = parsedParent.drizzle
31
+ ? new URL(`file://${path.resolve(parsedParent.clean)}`)
32
+ : context.parentURL;
22
33
 
23
34
  // Let Node.js handle all other specifiers.
24
35
  return nextResolve(specifier, { ...context, parentURL });
25
36
  }
26
37
 
27
38
  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");
32
- if (path.endsWith(".ts") || path.endsWith(".mts")) {
39
+ const { drizzle, clean } = parse(url);
40
+ if (drizzle) {
41
+ const file = readFileSync(clean, "utf-8");
42
+ if (clean.endsWith(".ts") || clean.endsWith(".mts")) {
33
43
  const source = esbuild.transformSync(file, {
34
44
  loader: "ts",
35
45
  format: "esm",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.19.2-69e5db4",
3
+ "version": "0.19.2-9340465",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",
@@ -75,6 +75,7 @@
75
75
  "better-sqlite3": "^8.4.0",
76
76
  "dockerode": "^3.3.4",
77
77
  "dotenv": "^16.0.3",
78
+ "drizzle-kit": "0.19.2-e313bce",
78
79
  "drizzle-orm": "0.27.0-56b9edc",
79
80
  "esbuild": "^0.17.19",
80
81
  "esbuild-register": "^3.4.2",