@prisma/migrate 5.22.0-integration-remove-custom-yarn-logic.1 → 5.22.0-integration-engines-5-22-0-8-integration-itx-refactor-9bb49c906d23e0946061d551777bdac14ae4d17d.2

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.
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,38 +15,21 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_YKUZUAXA_exports = {};
30
- __export(chunk_YKUZUAXA_exports, {
31
- executeSeedCommand: () => executeSeedCommand,
32
- getSeedCommandFromPackageJson: () => getSeedCommandFromPackageJson,
33
- init_seed: () => init_seed,
34
- legacyTsNodeScriptWarning: () => legacyTsNodeScriptWarning,
35
- verifySeedConfigAndReturnMessage: () => verifySeedConfigAndReturnMessage
19
+ var chunk_WIZM7TFT_exports = {};
20
+ __export(chunk_WIZM7TFT_exports, {
21
+ require_execa: () => require_execa
36
22
  });
37
- module.exports = __toCommonJS(chunk_YKUZUAXA_exports);
23
+ module.exports = __toCommonJS(chunk_WIZM7TFT_exports);
38
24
  var import_chunk_J46BJQHT = require("./chunk-J46BJQHT.js");
39
- var import_chunk_6TE2RIPN = require("./chunk-6TE2RIPN.js");
40
25
  var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
41
- var import_debug = __toESM(require("@prisma/debug"));
42
- var import_internals = require("@prisma/internals");
43
- var import_fs = __toESM(require("fs"));
44
- var import_path = __toESM(require("path"));
45
26
  var require_windows = (0, import_chunk_WWAWV7DQ.__commonJS)({
46
27
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module2) {
47
28
  "use strict";
48
29
  module2.exports = isexe;
49
30
  isexe.sync = sync;
50
- var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
51
- function checkPathExt(path2, options) {
31
+ var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
32
+ function checkPathExt(path, options) {
52
33
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
53
34
  if (!pathext) {
54
35
  return true;
@@ -59,25 +40,25 @@ var require_windows = (0, import_chunk_WWAWV7DQ.__commonJS)({
59
40
  }
60
41
  for (var i = 0; i < pathext.length; i++) {
61
42
  var p = pathext[i].toLowerCase();
62
- if (p && path2.substr(-p.length).toLowerCase() === p) {
43
+ if (p && path.substr(-p.length).toLowerCase() === p) {
63
44
  return true;
64
45
  }
65
46
  }
66
47
  return false;
67
48
  }
68
- function checkStat(stat, path2, options) {
49
+ function checkStat(stat, path, options) {
69
50
  if (!stat.isSymbolicLink() && !stat.isFile()) {
70
51
  return false;
71
52
  }
72
- return checkPathExt(path2, options);
53
+ return checkPathExt(path, options);
73
54
  }
74
- function isexe(path2, options, cb) {
75
- fs2.stat(path2, function(er, stat) {
76
- cb(er, er ? false : checkStat(stat, path2, options));
55
+ function isexe(path, options, cb) {
56
+ fs.stat(path, function(er, stat) {
57
+ cb(er, er ? false : checkStat(stat, path, options));
77
58
  });
78
59
  }
79
- function sync(path2, options) {
80
- return checkStat(fs2.statSync(path2), path2, options);
60
+ function sync(path, options) {
61
+ return checkStat(fs.statSync(path), path, options);
81
62
  }
82
63
  }
83
64
  });
@@ -86,14 +67,14 @@ var require_mode = (0, import_chunk_WWAWV7DQ.__commonJS)({
86
67
  "use strict";
87
68
  module2.exports = isexe;
88
69
  isexe.sync = sync;
89
- var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
90
- function isexe(path2, options, cb) {
91
- fs2.stat(path2, function(er, stat) {
70
+ var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
71
+ function isexe(path, options, cb) {
72
+ fs.stat(path, function(er, stat) {
92
73
  cb(er, er ? false : checkStat(stat, options));
93
74
  });
94
75
  }
95
- function sync(path2, options) {
96
- return checkStat(fs2.statSync(path2), options);
76
+ function sync(path, options) {
77
+ return checkStat(fs.statSync(path), options);
97
78
  }
98
79
  function checkStat(stat, options) {
99
80
  return stat.isFile() && checkMode(stat, options);
@@ -116,7 +97,7 @@ var require_mode = (0, import_chunk_WWAWV7DQ.__commonJS)({
116
97
  var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
117
98
  "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module2) {
118
99
  "use strict";
119
- var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
100
+ var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
120
101
  var core;
121
102
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
122
103
  core = require_windows();
@@ -125,7 +106,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
125
106
  }
126
107
  module2.exports = isexe;
127
108
  isexe.sync = sync;
128
- function isexe(path2, options, cb) {
109
+ function isexe(path, options, cb) {
129
110
  if (typeof options === "function") {
130
111
  cb = options;
131
112
  options = {};
@@ -135,7 +116,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
135
116
  throw new TypeError("callback not provided");
136
117
  }
137
118
  return new Promise(function(resolve, reject) {
138
- isexe(path2, options || {}, function(er, is) {
119
+ isexe(path, options || {}, function(er, is) {
139
120
  if (er) {
140
121
  reject(er);
141
122
  } else {
@@ -144,7 +125,7 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
144
125
  });
145
126
  });
146
127
  }
147
- core(path2, options || {}, function(er, is) {
128
+ core(path, options || {}, function(er, is) {
148
129
  if (er) {
149
130
  if (er.code === "EACCES" || options && options.ignoreErrors) {
150
131
  er = null;
@@ -154,9 +135,9 @@ var require_isexe = (0, import_chunk_WWAWV7DQ.__commonJS)({
154
135
  cb(er, is);
155
136
  });
156
137
  }
157
- function sync(path2, options) {
138
+ function sync(path, options) {
158
139
  try {
159
- return core.sync(path2, options || {});
140
+ return core.sync(path, options || {});
160
141
  } catch (er) {
161
142
  if (options && options.ignoreErrors || er.code === "EACCES") {
162
143
  return false;
@@ -171,7 +152,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
171
152
  "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module2) {
172
153
  "use strict";
173
154
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
174
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
155
+ var path = (0, import_chunk_WWAWV7DQ.__require)("path");
175
156
  var COLON = isWindows ? ";" : ":";
176
157
  var isexe = require_isexe();
177
158
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -209,7 +190,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
209
190
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
210
191
  const ppRaw = pathEnv[i];
211
192
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
212
- const pCmd = path2.join(pathPart, cmd);
193
+ const pCmd = path.join(pathPart, cmd);
213
194
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
214
195
  resolve(subStep(p, i, 0));
215
196
  });
@@ -236,7 +217,7 @@ var require_which = (0, import_chunk_WWAWV7DQ.__commonJS)({
236
217
  for (let i = 0; i < pathEnv.length; i++) {
237
218
  const ppRaw = pathEnv[i];
238
219
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
239
- const pCmd = path2.join(pathPart, cmd);
220
+ const pCmd = path.join(pathPart, cmd);
240
221
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
241
222
  for (let j = 0; j < pathExt.length; j++) {
242
223
  const cur = p + pathExt[j];
@@ -280,7 +261,7 @@ var require_path_key = (0, import_chunk_WWAWV7DQ.__commonJS)({
280
261
  var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
281
262
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
282
263
  "use strict";
283
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
264
+ var path = (0, import_chunk_WWAWV7DQ.__require)("path");
284
265
  var which = require_which();
285
266
  var getPathKey = require_path_key();
286
267
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -298,7 +279,7 @@ var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
298
279
  try {
299
280
  resolved = which.sync(parsed.command, {
300
281
  path: env[getPathKey({ env })],
301
- pathExt: withoutPathExt ? path2.delimiter : void 0
282
+ pathExt: withoutPathExt ? path.delimiter : void 0
302
283
  });
303
284
  } catch (e) {
304
285
  } finally {
@@ -307,7 +288,7 @@ var require_resolveCommand = (0, import_chunk_WWAWV7DQ.__commonJS)({
307
288
  }
308
289
  }
309
290
  if (resolved) {
310
- resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
291
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
311
292
  }
312
293
  return resolved;
313
294
  }
@@ -355,8 +336,8 @@ var require_shebang_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
355
336
  if (!match) {
356
337
  return null;
357
338
  }
358
- const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
359
- const binary = path2.split("/").pop();
339
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
340
+ const binary = path.split("/").pop();
360
341
  if (binary === "env") {
361
342
  return argument;
362
343
  }
@@ -367,16 +348,16 @@ var require_shebang_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
367
348
  var require_readShebang = (0, import_chunk_WWAWV7DQ.__commonJS)({
368
349
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
369
350
  "use strict";
370
- var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
351
+ var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
371
352
  var shebangCommand = require_shebang_command();
372
353
  function readShebang(command) {
373
354
  const size = 150;
374
355
  const buffer = Buffer.alloc(size);
375
356
  let fd;
376
357
  try {
377
- fd = fs2.openSync(command, "r");
378
- fs2.readSync(fd, buffer, 0, size, 0);
379
- fs2.closeSync(fd);
358
+ fd = fs.openSync(command, "r");
359
+ fs.readSync(fd, buffer, 0, size, 0);
360
+ fs.closeSync(fd);
380
361
  } catch (e) {
381
362
  }
382
363
  return shebangCommand(buffer.toString());
@@ -387,7 +368,7 @@ var require_readShebang = (0, import_chunk_WWAWV7DQ.__commonJS)({
387
368
  var require_parse = (0, import_chunk_WWAWV7DQ.__commonJS)({
388
369
  "../../node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
389
370
  "use strict";
390
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
371
+ var path = (0, import_chunk_WWAWV7DQ.__require)("path");
391
372
  var resolveCommand = require_resolveCommand();
392
373
  var escape = require_escape();
393
374
  var readShebang = require_readShebang();
@@ -412,7 +393,7 @@ var require_parse = (0, import_chunk_WWAWV7DQ.__commonJS)({
412
393
  const needsShell = !isExecutableRegExp.test(commandFile);
413
394
  if (parsed.options.forceShell || needsShell) {
414
395
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
415
- parsed.command = path2.normalize(parsed.command);
396
+ parsed.command = path.normalize(parsed.command);
416
397
  parsed.command = escape.command(parsed.command);
417
398
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
418
399
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -536,7 +517,7 @@ var require_strip_final_newline = (0, import_chunk_WWAWV7DQ.__commonJS)({
536
517
  var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
537
518
  "../../node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js"(exports, module2) {
538
519
  "use strict";
539
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
520
+ var path = (0, import_chunk_WWAWV7DQ.__require)("path");
540
521
  var pathKey = require_path_key();
541
522
  var npmRunPath = (options) => {
542
523
  options = {
@@ -546,16 +527,16 @@ var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
546
527
  ...options
547
528
  };
548
529
  let previous;
549
- let cwdPath = path2.resolve(options.cwd);
530
+ let cwdPath = path.resolve(options.cwd);
550
531
  const result = [];
551
532
  while (previous !== cwdPath) {
552
- result.push(path2.join(cwdPath, "node_modules/.bin"));
533
+ result.push(path.join(cwdPath, "node_modules/.bin"));
553
534
  previous = cwdPath;
554
- cwdPath = path2.resolve(cwdPath, "..");
535
+ cwdPath = path.resolve(cwdPath, "..");
555
536
  }
556
- const execPathDir = path2.resolve(options.cwd, options.execPath, "..");
537
+ const execPathDir = path.resolve(options.cwd, options.execPath, "..");
557
538
  result.push(execPathDir);
558
- return result.concat(options.path).join(path2.delimiter);
539
+ return result.concat(options.path).join(path.delimiter);
559
540
  };
560
541
  module2.exports = npmRunPath;
561
542
  module2.exports.default = npmRunPath;
@@ -565,9 +546,9 @@ var require_npm_run_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
565
546
  ...options
566
547
  };
567
548
  const env = { ...options.env };
568
- const path3 = pathKey({ env });
569
- options.path = env[path3];
570
- env[path3] = module2.exports(options);
549
+ const path2 = pathKey({ env });
550
+ options.path = env[path2];
551
+ env[path2] = module2.exports(options);
571
552
  return env;
572
553
  };
573
554
  }
@@ -1470,7 +1451,7 @@ var require_command = (0, import_chunk_WWAWV7DQ.__commonJS)({
1470
1451
  var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1471
1452
  "../../node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js"(exports, module2) {
1472
1453
  "use strict";
1473
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1454
+ var path = (0, import_chunk_WWAWV7DQ.__require)("path");
1474
1455
  var childProcess = (0, import_chunk_WWAWV7DQ.__require)("child_process");
1475
1456
  var crossSpawn = require_cross_spawn();
1476
1457
  var stripFinalNewline = require_strip_final_newline();
@@ -1512,7 +1493,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1512
1493
  };
1513
1494
  options.env = getEnv(options);
1514
1495
  options.stdio = normalizeStdio(options);
1515
- if (process.platform === "win32" && path2.basename(file, ".exe") === "cmd") {
1496
+ if (process.platform === "win32" && path.basename(file, ".exe") === "cmd") {
1516
1497
  args.unshift("/q");
1517
1498
  }
1518
1499
  return { file, args, options, parsed };
@@ -1526,7 +1507,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1526
1507
  }
1527
1508
  return value;
1528
1509
  };
1529
- var execa2 = (file, args, options) => {
1510
+ var execa = (file, args, options) => {
1530
1511
  const parsed = handleArguments(file, args, options);
1531
1512
  const command = joinCommand(file, args);
1532
1513
  const escapedCommand = getEscapedCommand(file, args);
@@ -1599,7 +1580,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1599
1580
  spawned.all = makeAllStream(spawned, parsed.options);
1600
1581
  return mergePromise(spawned, handlePromiseOnce);
1601
1582
  };
1602
- module2.exports = execa2;
1583
+ module2.exports = execa;
1603
1584
  module2.exports.sync = (file, args, options) => {
1604
1585
  const parsed = handleArguments(file, args, options);
1605
1586
  const command = joinCommand(file, args);
@@ -1657,11 +1638,11 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1657
1638
  };
1658
1639
  module2.exports.command = (command, options) => {
1659
1640
  const [file, ...args] = parseCommand(command);
1660
- return execa2(file, args, options);
1641
+ return execa(file, args, options);
1661
1642
  };
1662
1643
  module2.exports.commandSync = (command, options) => {
1663
1644
  const [file, ...args] = parseCommand(command);
1664
- return execa2.sync(file, args, options);
1645
+ return execa.sync(file, args, options);
1665
1646
  };
1666
1647
  module2.exports.node = (scriptPath, args, options = {}) => {
1667
1648
  if (args && !Array.isArray(args) && typeof args === "object") {
@@ -1674,7 +1655,7 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1674
1655
  nodePath = process.execPath,
1675
1656
  nodeOptions = defaultExecArgv
1676
1657
  } = options;
1677
- return execa2(
1658
+ return execa(
1678
1659
  nodePath,
1679
1660
  [
1680
1661
  ...nodeOptions,
@@ -1693,372 +1674,3 @@ var require_execa = (0, import_chunk_WWAWV7DQ.__commonJS)({
1693
1674
  };
1694
1675
  }
1695
1676
  });
1696
- var require_path_exists = (0, import_chunk_WWAWV7DQ.__commonJS)({
1697
- "../../node_modules/.pnpm/path-exists@3.0.0/node_modules/path-exists/index.js"(exports, module2) {
1698
- "use strict";
1699
- var fs2 = (0, import_chunk_WWAWV7DQ.__require)("fs");
1700
- module2.exports = (fp) => new Promise((resolve) => {
1701
- fs2.access(fp, (err) => {
1702
- resolve(!err);
1703
- });
1704
- });
1705
- module2.exports.sync = (fp) => {
1706
- try {
1707
- fs2.accessSync(fp);
1708
- return true;
1709
- } catch (err) {
1710
- return false;
1711
- }
1712
- };
1713
- }
1714
- });
1715
- var require_p_try = (0, import_chunk_WWAWV7DQ.__commonJS)({
1716
- "../../node_modules/.pnpm/p-try@2.2.0/node_modules/p-try/index.js"(exports, module2) {
1717
- "use strict";
1718
- var pTry = (fn, ...arguments_) => new Promise((resolve) => {
1719
- resolve(fn(...arguments_));
1720
- });
1721
- module2.exports = pTry;
1722
- module2.exports.default = pTry;
1723
- }
1724
- });
1725
- var require_p_limit = (0, import_chunk_WWAWV7DQ.__commonJS)({
1726
- "../../node_modules/.pnpm/p-limit@2.3.0/node_modules/p-limit/index.js"(exports, module2) {
1727
- "use strict";
1728
- var pTry = require_p_try();
1729
- var pLimit = (concurrency) => {
1730
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
1731
- return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
1732
- }
1733
- const queue = [];
1734
- let activeCount = 0;
1735
- const next = () => {
1736
- activeCount--;
1737
- if (queue.length > 0) {
1738
- queue.shift()();
1739
- }
1740
- };
1741
- const run = (fn, resolve, ...args) => {
1742
- activeCount++;
1743
- const result = pTry(fn, ...args);
1744
- resolve(result);
1745
- result.then(next, next);
1746
- };
1747
- const enqueue = (fn, resolve, ...args) => {
1748
- if (activeCount < concurrency) {
1749
- run(fn, resolve, ...args);
1750
- } else {
1751
- queue.push(run.bind(null, fn, resolve, ...args));
1752
- }
1753
- };
1754
- const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args));
1755
- Object.defineProperties(generator, {
1756
- activeCount: {
1757
- get: () => activeCount
1758
- },
1759
- pendingCount: {
1760
- get: () => queue.length
1761
- },
1762
- clearQueue: {
1763
- value: () => {
1764
- queue.length = 0;
1765
- }
1766
- }
1767
- });
1768
- return generator;
1769
- };
1770
- module2.exports = pLimit;
1771
- module2.exports.default = pLimit;
1772
- }
1773
- });
1774
- var require_p_locate = (0, import_chunk_WWAWV7DQ.__commonJS)({
1775
- "../../node_modules/.pnpm/p-locate@3.0.0/node_modules/p-locate/index.js"(exports, module2) {
1776
- "use strict";
1777
- var pLimit = require_p_limit();
1778
- var EndError = class extends Error {
1779
- constructor(value) {
1780
- super();
1781
- this.value = value;
1782
- }
1783
- };
1784
- var testElement = (el, tester) => Promise.resolve(el).then(tester);
1785
- var finder = (el) => Promise.all(el).then((val) => val[1] === true && Promise.reject(new EndError(val[0])));
1786
- module2.exports = (iterable, tester, opts) => {
1787
- opts = Object.assign({
1788
- concurrency: Infinity,
1789
- preserveOrder: true
1790
- }, opts);
1791
- const limit = pLimit(opts.concurrency);
1792
- const items = [...iterable].map((el) => [el, limit(testElement, el, tester)]);
1793
- const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
1794
- return Promise.all(items.map((el) => checkLimit(finder, el))).then(() => {
1795
- }).catch((err) => err instanceof EndError ? err.value : Promise.reject(err));
1796
- };
1797
- }
1798
- });
1799
- var require_locate_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
1800
- "../../node_modules/.pnpm/locate-path@3.0.0/node_modules/locate-path/index.js"(exports, module2) {
1801
- "use strict";
1802
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1803
- var pathExists = require_path_exists();
1804
- var pLocate = require_p_locate();
1805
- module2.exports = (iterable, options) => {
1806
- options = Object.assign({
1807
- cwd: process.cwd()
1808
- }, options);
1809
- return pLocate(iterable, (el) => pathExists(path2.resolve(options.cwd, el)), options);
1810
- };
1811
- module2.exports.sync = (iterable, options) => {
1812
- options = Object.assign({
1813
- cwd: process.cwd()
1814
- }, options);
1815
- for (const el of iterable) {
1816
- if (pathExists.sync(path2.resolve(options.cwd, el))) {
1817
- return el;
1818
- }
1819
- }
1820
- };
1821
- }
1822
- });
1823
- var require_find_up = (0, import_chunk_WWAWV7DQ.__commonJS)({
1824
- "../../node_modules/.pnpm/find-up@3.0.0/node_modules/find-up/index.js"(exports, module2) {
1825
- "use strict";
1826
- var path2 = (0, import_chunk_WWAWV7DQ.__require)("path");
1827
- var locatePath = require_locate_path();
1828
- module2.exports = (filename, opts = {}) => {
1829
- const startDir = path2.resolve(opts.cwd || "");
1830
- const { root } = path2.parse(startDir);
1831
- const filenames = [].concat(filename);
1832
- return new Promise((resolve) => {
1833
- (function find(dir) {
1834
- locatePath(filenames, { cwd: dir }).then((file) => {
1835
- if (file) {
1836
- resolve(path2.join(dir, file));
1837
- } else if (dir === root) {
1838
- resolve(null);
1839
- } else {
1840
- find(path2.dirname(dir));
1841
- }
1842
- });
1843
- })(startDir);
1844
- });
1845
- };
1846
- module2.exports.sync = (filename, opts = {}) => {
1847
- let dir = path2.resolve(opts.cwd || "");
1848
- const { root } = path2.parse(dir);
1849
- const filenames = [].concat(filename);
1850
- while (true) {
1851
- const file = locatePath.sync(filenames, { cwd: dir });
1852
- if (file) {
1853
- return path2.join(dir, file);
1854
- }
1855
- if (dir === root) {
1856
- return null;
1857
- }
1858
- dir = path2.dirname(dir);
1859
- }
1860
- };
1861
- }
1862
- });
1863
- var require_pkg_up = (0, import_chunk_WWAWV7DQ.__commonJS)({
1864
- "../../node_modules/.pnpm/pkg-up@3.1.0/node_modules/pkg-up/index.js"(exports, module2) {
1865
- "use strict";
1866
- var findUp = require_find_up();
1867
- module2.exports = async ({ cwd } = {}) => findUp("package.json", { cwd });
1868
- module2.exports.sync = ({ cwd } = {}) => findUp.sync("package.json", { cwd });
1869
- }
1870
- });
1871
- async function verifySeedConfigAndReturnMessage(schemaPath) {
1872
- const cwd = process.cwd();
1873
- const detected = detectSeedFiles(cwd, schemaPath);
1874
- const prismaConfig = await (0, import_internals.getPrismaConfigFromPackageJson)(cwd);
1875
- if (prismaConfig && prismaConfig.data?.seed) {
1876
- return void 0;
1877
- }
1878
- const packageManager = "npm i -D";
1879
- let message = `${(0, import_chunk_6TE2RIPN.red)(
1880
- 'To configure seeding in your project you need to add a "prisma.seed" property in your package.json with the command to execute it:'
1881
- )}
1882
-
1883
- 1. Open the package.json of your project
1884
- `;
1885
- if (detected.numberOfSeedFiles) {
1886
- await legacyTsNodeScriptWarning();
1887
- message += `2. Add the following example to it:`;
1888
- if (detected.js) {
1889
- message += `
1890
- \`\`\`
1891
- "prisma": {
1892
- "seed": "node ${detected.js}"
1893
- }
1894
- \`\`\`
1895
- `;
1896
- } else if (detected.ts) {
1897
- message += `
1898
- \`\`\`
1899
- "prisma": {
1900
- "seed": "ts-node ${detected.ts}"
1901
- }
1902
- \`\`\`
1903
- If you are using ESM (ECMAScript modules):
1904
- \`\`\`
1905
- "prisma": {
1906
- "seed": "node --loader ts-node/esm ${detected.ts}"
1907
- }
1908
- \`\`\`
1909
-
1910
- 3. Install the required dependencies by running:
1911
- ${(0, import_chunk_6TE2RIPN.green)(`${packageManager} ts-node typescript @types/node`)}
1912
- `;
1913
- } else if (detected.sh) {
1914
- message += `
1915
- \`\`\`
1916
- "prisma": {
1917
- "seed": "${detected.sh}"
1918
- }
1919
- \`\`\`
1920
- And run \`chmod +x ${detected.sh}\` to make it executable.`;
1921
- }
1922
- } else {
1923
- message += `2. Add one of the following examples to your package.json:
1924
-
1925
- ${(0, import_chunk_6TE2RIPN.bold)("TypeScript:")}
1926
- \`\`\`
1927
- "prisma": {
1928
- "seed": "ts-node ./prisma/seed.ts"
1929
- }
1930
- \`\`\`
1931
- If you are using ESM (ECMAScript modules):
1932
- \`\`\`
1933
- "prisma": {
1934
- "seed": "node --loader ts-node/esm ./prisma/seed.ts"
1935
- }
1936
- \`\`\`
1937
-
1938
- And install the required dependencies by running:
1939
- ${packageManager} ts-node typescript @types/node
1940
-
1941
- ${(0, import_chunk_6TE2RIPN.bold)("JavaScript:")}
1942
- \`\`\`
1943
- "prisma": {
1944
- "seed": "node ./prisma/seed.js"
1945
- }
1946
- \`\`\`
1947
-
1948
- ${(0, import_chunk_6TE2RIPN.bold)("Bash:")}
1949
- \`\`\`
1950
- "prisma": {
1951
- "seed": "./prisma/seed.sh"
1952
- }
1953
- \`\`\`
1954
- And run \`chmod +x prisma/seed.sh\` to make it executable.`;
1955
- }
1956
- message += `
1957
- More information in our documentation:
1958
- ${(0, import_internals.link)("https://pris.ly/d/seeding")}`;
1959
- return message;
1960
- }
1961
- async function getSeedCommandFromPackageJson(cwd) {
1962
- const prismaConfig = await (0, import_internals.getPrismaConfigFromPackageJson)(cwd);
1963
- debug({ prismaConfig });
1964
- if (!prismaConfig || !prismaConfig.data?.seed) {
1965
- return null;
1966
- }
1967
- const seedCommandFromPkgJson = prismaConfig.data.seed;
1968
- if (typeof seedCommandFromPkgJson !== "string") {
1969
- throw new Error(
1970
- `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_path.default.relative(
1971
- cwd,
1972
- prismaConfig.packagePath
1973
- )}\` must be of type string`
1974
- );
1975
- }
1976
- if (!seedCommandFromPkgJson) {
1977
- throw new Error(
1978
- `Provided seed command \`${seedCommandFromPkgJson}\` from \`${import_path.default.relative(
1979
- cwd,
1980
- prismaConfig.packagePath
1981
- )}\` cannot be empty`
1982
- );
1983
- }
1984
- return seedCommandFromPkgJson;
1985
- }
1986
- async function executeSeedCommand({
1987
- commandFromConfig,
1988
- extraArgs
1989
- }) {
1990
- const command = extraArgs ? `${commandFromConfig} ${extraArgs}` : commandFromConfig;
1991
- process.stdout.write(`Running seed command \`${(0, import_chunk_6TE2RIPN.italic)(command)}\` ...
1992
- `);
1993
- try {
1994
- await import_execa.default.command(command, {
1995
- stdout: "inherit",
1996
- stderr: "inherit"
1997
- });
1998
- } catch (_e) {
1999
- const e = _e;
2000
- debug({ e });
2001
- console.error((0, import_chunk_6TE2RIPN.bold)((0, import_chunk_6TE2RIPN.red)(`
2002
- An error occurred while running the seed command:`)));
2003
- console.error((0, import_chunk_6TE2RIPN.red)(e.stderr || String(e)));
2004
- return false;
2005
- }
2006
- return true;
2007
- }
2008
- function detectSeedFiles(cwd, schemaPath) {
2009
- let parentDirectory = import_path.default.relative(cwd, import_path.default.join(cwd, "prisma"));
2010
- if (schemaPath) {
2011
- parentDirectory = import_path.default.relative(cwd, import_path.default.dirname(schemaPath));
2012
- }
2013
- const seedPath = import_path.default.join(parentDirectory, "seed.");
2014
- const detected = {
2015
- seedPath,
2016
- numberOfSeedFiles: 0,
2017
- js: "",
2018
- ts: "",
2019
- sh: ""
2020
- };
2021
- const extensions = ["js", "ts", "sh"];
2022
- for (const extension of extensions) {
2023
- const fullPath = seedPath + extension;
2024
- if (!import_fs.default.existsSync(fullPath)) {
2025
- continue;
2026
- }
2027
- detected[extension] = fullPath;
2028
- detected.numberOfSeedFiles++;
2029
- }
2030
- debug({ detected });
2031
- return detected;
2032
- }
2033
- async function legacyTsNodeScriptWarning() {
2034
- const scripts = await getScriptsFromPackageJson();
2035
- if (scripts?.["ts-node"]) {
2036
- import_internals.logger.warn(
2037
- (0, import_chunk_6TE2RIPN.yellow)(`The "ts-node" script in the package.json is not used anymore since version 3.0 and can now be removed.`)
2038
- );
2039
- }
2040
- return void 0;
2041
- }
2042
- async function getScriptsFromPackageJson(cwd = process.cwd()) {
2043
- try {
2044
- const pkgJsonPath = await (0, import_pkg_up.default)({ cwd });
2045
- if (!pkgJsonPath) {
2046
- return null;
2047
- }
2048
- const pkgJsonString = await import_fs.default.promises.readFile(pkgJsonPath, "utf-8");
2049
- const pkgJson = JSON.parse(pkgJsonString);
2050
- const { "ts-node": tsnode } = pkgJson.scripts;
2051
- return { "ts-node": tsnode };
2052
- } catch {
2053
- return null;
2054
- }
2055
- }
2056
- var import_execa, import_pkg_up, debug;
2057
- var init_seed = (0, import_chunk_WWAWV7DQ.__esm)({
2058
- "src/utils/seed.ts"() {
2059
- import_execa = (0, import_chunk_WWAWV7DQ.__toESM)(require_execa());
2060
- (0, import_chunk_6TE2RIPN.init_colors)();
2061
- import_pkg_up = (0, import_chunk_WWAWV7DQ.__toESM)(require_pkg_up());
2062
- debug = (0, import_debug.default)("prisma:migrate:seed");
2063
- }
2064
- });