drizzle-kit 0.31.9 → 0.31.10

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 (6) hide show
  1. package/api.js +237 -182
  2. package/api.mjs +238 -187
  3. package/bin.cjs +3989 -5706
  4. package/package.json +3 -4
  5. package/utils.js +71 -39
  6. package/utils.mjs +71 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.31.9",
3
+ "version": "0.31.10",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -46,7 +46,7 @@
46
46
  "@drizzle-team/brocli": "^0.10.2",
47
47
  "@esbuild-kit/esm-loader": "^2.5.5",
48
48
  "esbuild": "^0.25.4",
49
- "esbuild-register": "^3.5.0"
49
+ "tsx": "^4.21.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@arethetypeswrong/cli": "^0.15.3",
@@ -92,7 +92,7 @@
92
92
  "gel": "^2.0.0",
93
93
  "get-port": "^6.1.2",
94
94
  "glob": "^8.1.0",
95
- "hanji": "^0.0.5",
95
+ "hanji": "^0.0.8",
96
96
  "hono": "^4.7.9",
97
97
  "json-diff": "1.0.6",
98
98
  "micromatch": "^4.0.8",
@@ -107,7 +107,6 @@
107
107
  "semver": "^7.7.2",
108
108
  "superjson": "^2.2.1",
109
109
  "tsup": "^8.3.5",
110
- "tsx": "^3.12.1",
111
110
  "typescript": "^5.6.3",
112
111
  "uuid": "^9.0.1",
113
112
  "vite-tsconfig-paths": "^4.3.2",
package/utils.js CHANGED
@@ -31,28 +31,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
33
 
34
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
34
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js
35
35
  var require_readline = __commonJS({
36
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports2) {
36
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js"(exports2) {
37
37
  "use strict";
38
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
39
+ return mod && mod.__esModule ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports2, "__esModule", { value: true });
39
- exports2.prepareReadLine = void 0;
40
- var prepareReadLine = () => {
41
- const stdin = process.stdin;
42
- const stdout = process.stdout;
43
- const readline = require("readline");
44
- const rl = readline.createInterface({
45
- input: stdin,
42
+ exports2.createClosable = exports2.stdout = exports2.stdin = void 0;
43
+ var readline_1 = __importDefault(require("readline"));
44
+ exports2.stdin = process.stdin;
45
+ exports2.stdout = process.stdout;
46
+ readline_1.default.emitKeypressEvents(exports2.stdin);
47
+ var createClosable = () => {
48
+ return readline_1.default.createInterface({
49
+ input: exports2.stdin,
46
50
  escapeCodeTimeout: 50
47
51
  });
48
- readline.emitKeypressEvents(stdin, rl);
49
- return {
50
- stdin,
51
- stdout,
52
- closable: rl
53
- };
54
52
  };
55
- exports2.prepareReadLine = prepareReadLine;
53
+ exports2.createClosable = createClosable;
56
54
  }
57
55
  });
58
56
 
@@ -112,12 +110,12 @@ var require_src = __commonJS({
112
110
  }
113
111
  });
114
112
 
115
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
113
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js
116
114
  var require_utils = __commonJS({
117
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports2) {
115
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js"(exports2) {
118
116
  "use strict";
119
117
  Object.defineProperty(exports2, "__esModule", { value: true });
120
- exports2.clear = void 0;
118
+ exports2.clear = exports2.stringWidth = exports2.fallbackStringWidth = exports2.stripAnsi = exports2.strip = void 0;
121
119
  var sisteransi_1 = require_src();
122
120
  var strip = (str) => {
123
121
  const pattern = [
@@ -127,14 +125,35 @@ var require_utils = __commonJS({
127
125
  const RGX = new RegExp(pattern, "g");
128
126
  return typeof str === "string" ? str.replace(RGX, "") : str;
129
127
  };
130
- var stringWidth = (str) => [...strip(str)].length;
128
+ exports2.strip = strip;
129
+ var stripAnsi = (str) => {
130
+ if (typeof Bun !== "undefined" && Bun.stripANSI) {
131
+ return Bun.stripANSI(str);
132
+ }
133
+ return (0, exports2.strip)(str);
134
+ };
135
+ exports2.stripAnsi = stripAnsi;
136
+ var fallbackStringWidth = (str) => {
137
+ let len = 0;
138
+ const stripped = (0, exports2.stripAnsi)(str);
139
+ for (const _ of stripped)
140
+ len++;
141
+ return len;
142
+ };
143
+ exports2.fallbackStringWidth = fallbackStringWidth;
144
+ var stringWidth = (str) => {
145
+ if (typeof Bun !== "undefined" && Bun.stringWidth)
146
+ return Bun.stringWidth(str);
147
+ return (0, exports2.fallbackStringWidth)(str);
148
+ };
149
+ exports2.stringWidth = stringWidth;
131
150
  var clear = function(prompt, perLine) {
132
151
  if (!perLine)
133
152
  return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
134
153
  let rows = 0;
135
154
  const lines = prompt.split(/\r?\n/);
136
155
  for (let line of lines) {
137
- rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
156
+ rows += 1 + Math.floor(Math.max((0, exports2.stringWidth)(line) - 1, 0) / perLine);
138
157
  }
139
158
  return sisteransi_1.erase.lines(rows);
140
159
  };
@@ -290,9 +309,9 @@ var require_lodash = __commonJS({
290
309
  }
291
310
  });
292
311
 
293
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
312
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js
294
313
  var require_hanji = __commonJS({
295
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports2) {
314
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js"(exports2) {
296
315
  "use strict";
297
316
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
298
317
  function adopt(value) {
@@ -325,7 +344,10 @@ var require_hanji = __commonJS({
325
344
  return mod && mod.__esModule ? mod : { "default": mod };
326
345
  };
327
346
  Object.defineProperty(exports2, "__esModule", { value: true });
328
- exports2.onTerminate = exports2.renderWithTask = exports2.render = exports2.TaskTerminal = exports2.TaskView = exports2.Terminal = exports2.deferred = exports2.SelectState = exports2.Prompt = void 0;
347
+ exports2.TaskTerminal = exports2.TaskView = exports2.Terminal = exports2.deferred = exports2.SelectState = exports2.Prompt = void 0;
348
+ exports2.render = render2;
349
+ exports2.renderWithTask = renderWithTask;
350
+ exports2.onTerminate = onTerminate;
329
351
  var readline_1 = require_readline();
330
352
  var sisteransi_1 = require_src();
331
353
  var utils_1 = require_utils();
@@ -523,36 +545,46 @@ var require_hanji = __commonJS({
523
545
  const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
524
546
  this.stdout.write(`${clearPrefix}${string}`);
525
547
  }
548
+ reject(err) {
549
+ const string = this.view.render("rejected", err);
550
+ this.view.detach(this);
551
+ const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
552
+ this.stdout.write(`${clearPrefix}${string}`);
553
+ }
526
554
  };
527
555
  exports2.TaskTerminal = TaskTerminal;
528
556
  function render2(view5) {
529
- const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
530
- if (view5 instanceof Prompt2) {
531
- const terminal = new Terminal(view5, stdin, stdout, closable);
532
- terminal.requestLayout();
533
- return terminal.result();
534
- }
535
- stdout.write(`${view5}
557
+ if (typeof view5 === "string") {
558
+ process.stdout.write(`${view5}
536
559
  `);
537
- closable.close();
538
- return;
560
+ return;
561
+ }
562
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
563
+ return Promise.reject(new Error("Interactive prompts require a TTY terminal (process.stdin.isTTY or process.stdout.isTTY is false). This can happen when running in CI, piped input, or non-interactive shells."));
564
+ }
565
+ const closable = (0, readline_1.createClosable)();
566
+ const terminal = new Terminal(view5, readline_1.stdin, readline_1.stdout, closable);
567
+ terminal.requestLayout();
568
+ return terminal.result();
539
569
  }
540
- exports2.render = render2;
541
570
  function renderWithTask(view5, task) {
542
571
  return __awaiter(this, void 0, void 0, function* () {
543
572
  const terminal = new TaskTerminal(view5, process.stdout);
544
573
  terminal.requestLayout();
545
- const result = yield task;
546
- terminal.clear();
547
- return result;
574
+ try {
575
+ const result = yield task;
576
+ terminal.clear();
577
+ return result;
578
+ } catch (err) {
579
+ terminal.reject(err);
580
+ process.exit(1);
581
+ }
548
582
  });
549
583
  }
550
- exports2.renderWithTask = renderWithTask;
551
584
  var terminateHandler;
552
585
  function onTerminate(callback) {
553
586
  terminateHandler = callback;
554
587
  }
555
- exports2.onTerminate = onTerminate;
556
588
  }
557
589
  });
558
590
 
package/utils.mjs CHANGED
@@ -31,28 +31,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  mod
32
32
  ));
33
33
 
34
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
34
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js
35
35
  var require_readline = __commonJS({
36
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
36
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js"(exports) {
37
37
  "use strict";
38
+ var __importDefault = exports && exports.__importDefault || function(mod) {
39
+ return mod && mod.__esModule ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.prepareReadLine = void 0;
40
- var prepareReadLine = () => {
41
- const stdin = process.stdin;
42
- const stdout = process.stdout;
43
- const readline = __require("readline");
44
- const rl = readline.createInterface({
45
- input: stdin,
42
+ exports.createClosable = exports.stdout = exports.stdin = void 0;
43
+ var readline_1 = __importDefault(__require("readline"));
44
+ exports.stdin = process.stdin;
45
+ exports.stdout = process.stdout;
46
+ readline_1.default.emitKeypressEvents(exports.stdin);
47
+ var createClosable = () => {
48
+ return readline_1.default.createInterface({
49
+ input: exports.stdin,
46
50
  escapeCodeTimeout: 50
47
51
  });
48
- readline.emitKeypressEvents(stdin, rl);
49
- return {
50
- stdin,
51
- stdout,
52
- closable: rl
53
- };
54
52
  };
55
- exports.prepareReadLine = prepareReadLine;
53
+ exports.createClosable = createClosable;
56
54
  }
57
55
  });
58
56
 
@@ -112,12 +110,12 @@ var require_src = __commonJS({
112
110
  }
113
111
  });
114
112
 
115
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
113
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js
116
114
  var require_utils = __commonJS({
117
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports) {
115
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js"(exports) {
118
116
  "use strict";
119
117
  Object.defineProperty(exports, "__esModule", { value: true });
120
- exports.clear = void 0;
118
+ exports.clear = exports.stringWidth = exports.fallbackStringWidth = exports.stripAnsi = exports.strip = void 0;
121
119
  var sisteransi_1 = require_src();
122
120
  var strip = (str) => {
123
121
  const pattern = [
@@ -127,14 +125,35 @@ var require_utils = __commonJS({
127
125
  const RGX = new RegExp(pattern, "g");
128
126
  return typeof str === "string" ? str.replace(RGX, "") : str;
129
127
  };
130
- var stringWidth = (str) => [...strip(str)].length;
128
+ exports.strip = strip;
129
+ var stripAnsi = (str) => {
130
+ if (typeof Bun !== "undefined" && Bun.stripANSI) {
131
+ return Bun.stripANSI(str);
132
+ }
133
+ return (0, exports.strip)(str);
134
+ };
135
+ exports.stripAnsi = stripAnsi;
136
+ var fallbackStringWidth = (str) => {
137
+ let len = 0;
138
+ const stripped = (0, exports.stripAnsi)(str);
139
+ for (const _ of stripped)
140
+ len++;
141
+ return len;
142
+ };
143
+ exports.fallbackStringWidth = fallbackStringWidth;
144
+ var stringWidth = (str) => {
145
+ if (typeof Bun !== "undefined" && Bun.stringWidth)
146
+ return Bun.stringWidth(str);
147
+ return (0, exports.fallbackStringWidth)(str);
148
+ };
149
+ exports.stringWidth = stringWidth;
131
150
  var clear = function(prompt, perLine) {
132
151
  if (!perLine)
133
152
  return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
134
153
  let rows = 0;
135
154
  const lines = prompt.split(/\r?\n/);
136
155
  for (let line of lines) {
137
- rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
156
+ rows += 1 + Math.floor(Math.max((0, exports.stringWidth)(line) - 1, 0) / perLine);
138
157
  }
139
158
  return sisteransi_1.erase.lines(rows);
140
159
  };
@@ -290,9 +309,9 @@ var require_lodash = __commonJS({
290
309
  }
291
310
  });
292
311
 
293
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
312
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js
294
313
  var require_hanji = __commonJS({
295
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports) {
314
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js"(exports) {
296
315
  "use strict";
297
316
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
298
317
  function adopt(value) {
@@ -325,7 +344,10 @@ var require_hanji = __commonJS({
325
344
  return mod && mod.__esModule ? mod : { "default": mod };
326
345
  };
327
346
  Object.defineProperty(exports, "__esModule", { value: true });
328
- exports.onTerminate = exports.renderWithTask = exports.render = exports.TaskTerminal = exports.TaskView = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
347
+ exports.TaskTerminal = exports.TaskView = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
348
+ exports.render = render2;
349
+ exports.renderWithTask = renderWithTask;
350
+ exports.onTerminate = onTerminate;
329
351
  var readline_1 = require_readline();
330
352
  var sisteransi_1 = require_src();
331
353
  var utils_1 = require_utils();
@@ -523,36 +545,46 @@ var require_hanji = __commonJS({
523
545
  const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
524
546
  this.stdout.write(`${clearPrefix}${string}`);
525
547
  }
548
+ reject(err) {
549
+ const string = this.view.render("rejected", err);
550
+ this.view.detach(this);
551
+ const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
552
+ this.stdout.write(`${clearPrefix}${string}`);
553
+ }
526
554
  };
527
555
  exports.TaskTerminal = TaskTerminal;
528
556
  function render2(view5) {
529
- const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
530
- if (view5 instanceof Prompt2) {
531
- const terminal = new Terminal(view5, stdin, stdout, closable);
532
- terminal.requestLayout();
533
- return terminal.result();
534
- }
535
- stdout.write(`${view5}
557
+ if (typeof view5 === "string") {
558
+ process.stdout.write(`${view5}
536
559
  `);
537
- closable.close();
538
- return;
560
+ return;
561
+ }
562
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
563
+ return Promise.reject(new Error("Interactive prompts require a TTY terminal (process.stdin.isTTY or process.stdout.isTTY is false). This can happen when running in CI, piped input, or non-interactive shells."));
564
+ }
565
+ const closable = (0, readline_1.createClosable)();
566
+ const terminal = new Terminal(view5, readline_1.stdin, readline_1.stdout, closable);
567
+ terminal.requestLayout();
568
+ return terminal.result();
539
569
  }
540
- exports.render = render2;
541
570
  function renderWithTask(view5, task) {
542
571
  return __awaiter(this, void 0, void 0, function* () {
543
572
  const terminal = new TaskTerminal(view5, process.stdout);
544
573
  terminal.requestLayout();
545
- const result = yield task;
546
- terminal.clear();
547
- return result;
574
+ try {
575
+ const result = yield task;
576
+ terminal.clear();
577
+ return result;
578
+ } catch (err) {
579
+ terminal.reject(err);
580
+ process.exit(1);
581
+ }
548
582
  });
549
583
  }
550
- exports.renderWithTask = renderWithTask;
551
584
  var terminateHandler;
552
585
  function onTerminate(callback) {
553
586
  terminateHandler = callback;
554
587
  }
555
- exports.onTerminate = onTerminate;
556
588
  }
557
589
  });
558
590