@prisma/client-generator-js 7.2.0 → 7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1

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 (33) hide show
  1. package/dist/TSClient/Args.d.ts +5 -5
  2. package/dist/TSClient/Datasources.d.ts +7 -0
  3. package/dist/TSClient/GenerateContext.d.ts +2 -5
  4. package/dist/TSClient/PrismaClient.d.ts +2 -2
  5. package/dist/TSClient/TSClient.d.ts +7 -2
  6. package/dist/TSClient/common.d.ts +2 -2
  7. package/dist/extractSqliteSources.d.ts +6 -0
  8. package/dist/extractSqliteSources.test.d.ts +1 -0
  9. package/dist/generateClient.d.ts +7 -1
  10. package/dist/generator.d.ts +1 -1
  11. package/dist/index.d.mts +7 -1
  12. package/dist/index.d.ts +7 -1
  13. package/dist/index.js +2973 -351
  14. package/dist/index.mjs +2962 -334
  15. package/dist/resolveDatasources.d.ts +1 -0
  16. package/dist/resolveDatasources.test.d.ts +1 -0
  17. package/dist/resolvePrismaClient.d.ts +5 -0
  18. package/dist/serializeDatasources.d.ts +4 -0
  19. package/dist/serializeDatasources.test.d.ts +1 -0
  20. package/dist/typedSql/buildIndex.d.ts +2 -2
  21. package/dist/typedSql/typedSql.d.ts +1 -1
  22. package/dist/utils/buildDMMF.d.ts +1 -1
  23. package/dist/utils/buildDebugInitialization.d.ts +1 -1
  24. package/dist/utils/buildDirname.d.ts +7 -0
  25. package/dist/utils/buildGetQueryCompilerWasmModule.d.ts +1 -1
  26. package/dist/utils/buildGetQueryEngineWasmModule.d.ts +6 -0
  27. package/dist/utils/buildInjectableEdgeEnv.d.ts +20 -0
  28. package/dist/utils/buildInlineDatasources.d.ts +3 -0
  29. package/dist/utils/buildNFTAnnotations.d.ts +11 -0
  30. package/dist/utils/buildNFTAnnotations.test.d.ts +1 -0
  31. package/dist/utils/buildWarnEnvConflicts.d.ts +10 -0
  32. package/dist/utils/runtimeImport.d.ts +8 -1
  33. package/package.json +11 -10
package/dist/index.mjs CHANGED
@@ -62,7 +62,7 @@ var require_universalify = __commonJS({
62
62
  var require_polyfills = __commonJS({
63
63
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module) {
64
64
  "use strict";
65
- var constants = __require("constants");
65
+ var constants3 = __require("constants");
66
66
  var origCwd = process.cwd;
67
67
  var cwd = null;
68
68
  var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
@@ -86,7 +86,7 @@ var require_polyfills = __commonJS({
86
86
  var chdir;
87
87
  module.exports = patch;
88
88
  function patch(fs3) {
89
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
89
+ if (constants3.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
90
90
  patchLchmod(fs3);
91
91
  }
92
92
  if (!fs3.lutimes) {
@@ -111,14 +111,14 @@ var require_polyfills = __commonJS({
111
111
  fs3.fstatSync = statFixSync(fs3.fstatSync);
112
112
  fs3.lstatSync = statFixSync(fs3.lstatSync);
113
113
  if (fs3.chmod && !fs3.lchmod) {
114
- fs3.lchmod = function(path5, mode, cb) {
114
+ fs3.lchmod = function(path9, mode, cb) {
115
115
  if (cb) process.nextTick(cb);
116
116
  };
117
117
  fs3.lchmodSync = function() {
118
118
  };
119
119
  }
120
120
  if (fs3.chown && !fs3.lchown) {
121
- fs3.lchown = function(path5, uid, gid, cb) {
121
+ fs3.lchown = function(path9, uid, gid, cb) {
122
122
  if (cb) process.nextTick(cb);
123
123
  };
124
124
  fs3.lchownSync = function() {
@@ -185,10 +185,10 @@ var require_polyfills = __commonJS({
185
185
  };
186
186
  }(fs3.readSync);
187
187
  function patchLchmod(fs4) {
188
- fs4.lchmod = function(path5, mode, callback) {
188
+ fs4.lchmod = function(path9, mode, callback) {
189
189
  fs4.open(
190
- path5,
191
- constants.O_WRONLY | constants.O_SYMLINK,
190
+ path9,
191
+ constants3.O_WRONLY | constants3.O_SYMLINK,
192
192
  mode,
193
193
  function(err, fd) {
194
194
  if (err) {
@@ -203,8 +203,8 @@ var require_polyfills = __commonJS({
203
203
  }
204
204
  );
205
205
  };
206
- fs4.lchmodSync = function(path5, mode) {
207
- var fd = fs4.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
206
+ fs4.lchmodSync = function(path9, mode) {
207
+ var fd = fs4.openSync(path9, constants3.O_WRONLY | constants3.O_SYMLINK, mode);
208
208
  var threw = true;
209
209
  var ret;
210
210
  try {
@@ -224,9 +224,9 @@ var require_polyfills = __commonJS({
224
224
  };
225
225
  }
226
226
  function patchLutimes(fs4) {
227
- if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
228
- fs4.lutimes = function(path5, at, mt, cb) {
229
- fs4.open(path5, constants.O_SYMLINK, function(er, fd) {
227
+ if (constants3.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
228
+ fs4.lutimes = function(path9, at, mt, cb) {
229
+ fs4.open(path9, constants3.O_SYMLINK, function(er, fd) {
230
230
  if (er) {
231
231
  if (cb) cb(er);
232
232
  return;
@@ -238,8 +238,8 @@ var require_polyfills = __commonJS({
238
238
  });
239
239
  });
240
240
  };
241
- fs4.lutimesSync = function(path5, at, mt) {
242
- var fd = fs4.openSync(path5, constants.O_SYMLINK);
241
+ fs4.lutimesSync = function(path9, at, mt) {
242
+ var fd = fs4.openSync(path9, constants3.O_SYMLINK);
243
243
  var ret;
244
244
  var threw = true;
245
245
  try {
@@ -358,11 +358,11 @@ var require_legacy_streams = __commonJS({
358
358
  ReadStream,
359
359
  WriteStream
360
360
  };
361
- function ReadStream(path5, options) {
362
- if (!(this instanceof ReadStream)) return new ReadStream(path5, options);
361
+ function ReadStream(path9, options) {
362
+ if (!(this instanceof ReadStream)) return new ReadStream(path9, options);
363
363
  Stream.call(this);
364
364
  var self = this;
365
- this.path = path5;
365
+ this.path = path9;
366
366
  this.fd = null;
367
367
  this.readable = true;
368
368
  this.paused = false;
@@ -407,10 +407,10 @@ var require_legacy_streams = __commonJS({
407
407
  self._read();
408
408
  });
409
409
  }
410
- function WriteStream(path5, options) {
411
- if (!(this instanceof WriteStream)) return new WriteStream(path5, options);
410
+ function WriteStream(path9, options) {
411
+ if (!(this instanceof WriteStream)) return new WriteStream(path9, options);
412
412
  Stream.call(this);
413
- this.path = path5;
413
+ this.path = path9;
414
414
  this.fd = null;
415
415
  this.writable = true;
416
416
  this.flags = "w";
@@ -485,7 +485,7 @@ var require_graceful_fs = __commonJS({
485
485
  gracefulQueue = "___graceful-fs.queue";
486
486
  previousSymbol = "___graceful-fs.previous";
487
487
  }
488
- function noop() {
488
+ function noop2() {
489
489
  }
490
490
  function publishQueue(context, queue2) {
491
491
  Object.defineProperty(context, gracefulQueue, {
@@ -494,11 +494,11 @@ var require_graceful_fs = __commonJS({
494
494
  }
495
495
  });
496
496
  }
497
- var debug2 = noop;
497
+ var debug4 = noop2;
498
498
  if (util.debuglog)
499
- debug2 = util.debuglog("gfs4");
499
+ debug4 = util.debuglog("gfs4");
500
500
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
501
- debug2 = function() {
501
+ debug4 = function() {
502
502
  var m = util.format.apply(util, arguments);
503
503
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
504
504
  console.error(m);
@@ -533,7 +533,7 @@ var require_graceful_fs = __commonJS({
533
533
  }(fs3.closeSync);
534
534
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
535
535
  process.on("exit", function() {
536
- debug2(fs3[gracefulQueue]);
536
+ debug4(fs3[gracefulQueue]);
537
537
  __require("assert").equal(fs3[gracefulQueue].length, 0);
538
538
  });
539
539
  }
@@ -550,18 +550,18 @@ var require_graceful_fs = __commonJS({
550
550
  function patch(fs4) {
551
551
  polyfills(fs4);
552
552
  fs4.gracefulify = patch;
553
- fs4.createReadStream = createReadStream;
554
- fs4.createWriteStream = createWriteStream;
553
+ fs4.createReadStream = createReadStream2;
554
+ fs4.createWriteStream = createWriteStream2;
555
555
  var fs$readFile = fs4.readFile;
556
556
  fs4.readFile = readFile;
557
- function readFile(path5, options, cb) {
557
+ function readFile(path9, options, cb) {
558
558
  if (typeof options === "function")
559
559
  cb = options, options = null;
560
- return go$readFile(path5, options, cb);
561
- function go$readFile(path6, options2, cb2, startTime) {
562
- return fs$readFile(path6, options2, function(err) {
560
+ return go$readFile(path9, options, cb);
561
+ function go$readFile(path10, options2, cb2, startTime) {
562
+ return fs$readFile(path10, options2, function(err) {
563
563
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
564
- enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
564
+ enqueue([go$readFile, [path10, options2, cb2], err, startTime || Date.now(), Date.now()]);
565
565
  else {
566
566
  if (typeof cb2 === "function")
567
567
  cb2.apply(this, arguments);
@@ -571,14 +571,14 @@ var require_graceful_fs = __commonJS({
571
571
  }
572
572
  var fs$writeFile = fs4.writeFile;
573
573
  fs4.writeFile = writeFile;
574
- function writeFile(path5, data, options, cb) {
574
+ function writeFile(path9, data, options, cb) {
575
575
  if (typeof options === "function")
576
576
  cb = options, options = null;
577
- return go$writeFile(path5, data, options, cb);
578
- function go$writeFile(path6, data2, options2, cb2, startTime) {
579
- return fs$writeFile(path6, data2, options2, function(err) {
577
+ return go$writeFile(path9, data, options, cb);
578
+ function go$writeFile(path10, data2, options2, cb2, startTime) {
579
+ return fs$writeFile(path10, data2, options2, function(err) {
580
580
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
581
- enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
581
+ enqueue([go$writeFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
582
582
  else {
583
583
  if (typeof cb2 === "function")
584
584
  cb2.apply(this, arguments);
@@ -589,14 +589,14 @@ var require_graceful_fs = __commonJS({
589
589
  var fs$appendFile = fs4.appendFile;
590
590
  if (fs$appendFile)
591
591
  fs4.appendFile = appendFile;
592
- function appendFile(path5, data, options, cb) {
592
+ function appendFile(path9, data, options, cb) {
593
593
  if (typeof options === "function")
594
594
  cb = options, options = null;
595
- return go$appendFile(path5, data, options, cb);
596
- function go$appendFile(path6, data2, options2, cb2, startTime) {
597
- return fs$appendFile(path6, data2, options2, function(err) {
595
+ return go$appendFile(path9, data, options, cb);
596
+ function go$appendFile(path10, data2, options2, cb2, startTime) {
597
+ return fs$appendFile(path10, data2, options2, function(err) {
598
598
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
599
- enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
599
+ enqueue([go$appendFile, [path10, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
600
600
  else {
601
601
  if (typeof cb2 === "function")
602
602
  cb2.apply(this, arguments);
@@ -627,31 +627,31 @@ var require_graceful_fs = __commonJS({
627
627
  var fs$readdir = fs4.readdir;
628
628
  fs4.readdir = readdir;
629
629
  var noReaddirOptionVersions = /^v[0-5]\./;
630
- function readdir(path5, options, cb) {
630
+ function readdir(path9, options, cb) {
631
631
  if (typeof options === "function")
632
632
  cb = options, options = null;
633
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
634
- return fs$readdir(path6, fs$readdirCallback(
635
- path6,
633
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path10, options2, cb2, startTime) {
634
+ return fs$readdir(path10, fs$readdirCallback(
635
+ path10,
636
636
  options2,
637
637
  cb2,
638
638
  startTime
639
639
  ));
640
- } : function go$readdir2(path6, options2, cb2, startTime) {
641
- return fs$readdir(path6, options2, fs$readdirCallback(
642
- path6,
640
+ } : function go$readdir2(path10, options2, cb2, startTime) {
641
+ return fs$readdir(path10, options2, fs$readdirCallback(
642
+ path10,
643
643
  options2,
644
644
  cb2,
645
645
  startTime
646
646
  ));
647
647
  };
648
- return go$readdir(path5, options, cb);
649
- function fs$readdirCallback(path6, options2, cb2, startTime) {
648
+ return go$readdir(path9, options, cb);
649
+ function fs$readdirCallback(path10, options2, cb2, startTime) {
650
650
  return function(err, files) {
651
651
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
652
652
  enqueue([
653
653
  go$readdir,
654
- [path6, options2, cb2],
654
+ [path10, options2, cb2],
655
655
  err,
656
656
  startTime || Date.now(),
657
657
  Date.now()
@@ -722,7 +722,7 @@ var require_graceful_fs = __commonJS({
722
722
  enumerable: true,
723
723
  configurable: true
724
724
  });
725
- function ReadStream(path5, options) {
725
+ function ReadStream(path9, options) {
726
726
  if (this instanceof ReadStream)
727
727
  return fs$ReadStream.apply(this, arguments), this;
728
728
  else
@@ -742,7 +742,7 @@ var require_graceful_fs = __commonJS({
742
742
  }
743
743
  });
744
744
  }
745
- function WriteStream(path5, options) {
745
+ function WriteStream(path9, options) {
746
746
  if (this instanceof WriteStream)
747
747
  return fs$WriteStream.apply(this, arguments), this;
748
748
  else
@@ -760,22 +760,22 @@ var require_graceful_fs = __commonJS({
760
760
  }
761
761
  });
762
762
  }
763
- function createReadStream(path5, options) {
764
- return new fs4.ReadStream(path5, options);
763
+ function createReadStream2(path9, options) {
764
+ return new fs4.ReadStream(path9, options);
765
765
  }
766
- function createWriteStream(path5, options) {
767
- return new fs4.WriteStream(path5, options);
766
+ function createWriteStream2(path9, options) {
767
+ return new fs4.WriteStream(path9, options);
768
768
  }
769
769
  var fs$open = fs4.open;
770
770
  fs4.open = open;
771
- function open(path5, flags, mode, cb) {
771
+ function open(path9, flags, mode, cb) {
772
772
  if (typeof mode === "function")
773
773
  cb = mode, mode = null;
774
- return go$open(path5, flags, mode, cb);
775
- function go$open(path6, flags2, mode2, cb2, startTime) {
776
- return fs$open(path6, flags2, mode2, function(err, fd) {
774
+ return go$open(path9, flags, mode, cb);
775
+ function go$open(path10, flags2, mode2, cb2, startTime) {
776
+ return fs$open(path10, flags2, mode2, function(err, fd) {
777
777
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
778
- enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
778
+ enqueue([go$open, [path10, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
779
779
  else {
780
780
  if (typeof cb2 === "function")
781
781
  cb2.apply(this, arguments);
@@ -786,7 +786,7 @@ var require_graceful_fs = __commonJS({
786
786
  return fs4;
787
787
  }
788
788
  function enqueue(elem) {
789
- debug2("ENQUEUE", elem[0].name, elem[1]);
789
+ debug4("ENQUEUE", elem[0].name, elem[1]);
790
790
  fs3[gracefulQueue].push(elem);
791
791
  retry();
792
792
  }
@@ -813,10 +813,10 @@ var require_graceful_fs = __commonJS({
813
813
  var startTime = elem[3];
814
814
  var lastTime = elem[4];
815
815
  if (startTime === void 0) {
816
- debug2("RETRY", fn.name, args);
816
+ debug4("RETRY", fn.name, args);
817
817
  fn.apply(null, args);
818
818
  } else if (Date.now() - startTime >= 6e4) {
819
- debug2("TIMEOUT", fn.name, args);
819
+ debug4("TIMEOUT", fn.name, args);
820
820
  var cb = args.pop();
821
821
  if (typeof cb === "function")
822
822
  cb.call(null, err);
@@ -825,7 +825,7 @@ var require_graceful_fs = __commonJS({
825
825
  var sinceStart = Math.max(lastTime - startTime, 1);
826
826
  var desiredDelay = Math.min(sinceStart * 1.2, 100);
827
827
  if (sinceAttempt >= desiredDelay) {
828
- debug2("RETRY", fn.name, args);
828
+ debug4("RETRY", fn.name, args);
829
829
  fn.apply(null, args.concat([startTime]));
830
830
  } else {
831
831
  fs3[gracefulQueue].push(elem);
@@ -958,10 +958,10 @@ var require_fs = __commonJS({
958
958
  var require_utils = __commonJS({
959
959
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
960
960
  "use strict";
961
- var path5 = __require("path");
961
+ var path9 = __require("path");
962
962
  module.exports.checkPath = function checkPath(pth) {
963
963
  if (process.platform === "win32") {
964
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path5.parse(pth).root, ""));
964
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path9.parse(pth).root, ""));
965
965
  if (pathHasInvalidWinCharacters) {
966
966
  const error = new Error(`Path contains invalid characters: ${pth}`);
967
967
  error.code = "EINVAL";
@@ -1025,8 +1025,8 @@ var require_path_exists = __commonJS({
1025
1025
  "use strict";
1026
1026
  var u = require_universalify().fromPromise;
1027
1027
  var fs3 = require_fs();
1028
- function pathExists(path5) {
1029
- return fs3.access(path5).then(() => true).catch(() => false);
1028
+ function pathExists(path9) {
1029
+ return fs3.access(path9).then(() => true).catch(() => false);
1030
1030
  }
1031
1031
  module.exports = {
1032
1032
  pathExists: u(pathExists),
@@ -1041,8 +1041,8 @@ var require_utimes = __commonJS({
1041
1041
  "use strict";
1042
1042
  var fs3 = require_fs();
1043
1043
  var u = require_universalify().fromPromise;
1044
- async function utimesMillis(path5, atime, mtime) {
1045
- const fd = await fs3.open(path5, "r+");
1044
+ async function utimesMillis(path9, atime, mtime) {
1045
+ const fd = await fs3.open(path9, "r+");
1046
1046
  let closeErr = null;
1047
1047
  try {
1048
1048
  await fs3.futimes(fd, atime, mtime);
@@ -1057,8 +1057,8 @@ var require_utimes = __commonJS({
1057
1057
  throw closeErr;
1058
1058
  }
1059
1059
  }
1060
- function utimesMillisSync(path5, atime, mtime) {
1061
- const fd = fs3.openSync(path5, "r+");
1060
+ function utimesMillisSync(path9, atime, mtime) {
1061
+ const fd = fs3.openSync(path9, "r+");
1062
1062
  fs3.futimesSync(fd, atime, mtime);
1063
1063
  return fs3.closeSync(fd);
1064
1064
  }
@@ -1074,7 +1074,7 @@ var require_stat = __commonJS({
1074
1074
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js"(exports, module) {
1075
1075
  "use strict";
1076
1076
  var fs3 = require_fs();
1077
- var path5 = __require("path");
1077
+ var path9 = __require("path");
1078
1078
  var u = require_universalify().fromPromise;
1079
1079
  function getStats(src, dest, opts) {
1080
1080
  const statFunc = opts.dereference ? (file4) => fs3.stat(file4, { bigint: true }) : (file4) => fs3.lstat(file4, { bigint: true });
@@ -1102,8 +1102,8 @@ var require_stat = __commonJS({
1102
1102
  const { srcStat, destStat } = await getStats(src, dest, opts);
1103
1103
  if (destStat) {
1104
1104
  if (areIdentical(srcStat, destStat)) {
1105
- const srcBaseName = path5.basename(src);
1106
- const destBaseName = path5.basename(dest);
1105
+ const srcBaseName = path9.basename(src);
1106
+ const destBaseName = path9.basename(dest);
1107
1107
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1108
1108
  return { srcStat, destStat, isChangingCase: true };
1109
1109
  }
@@ -1125,8 +1125,8 @@ var require_stat = __commonJS({
1125
1125
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
1126
1126
  if (destStat) {
1127
1127
  if (areIdentical(srcStat, destStat)) {
1128
- const srcBaseName = path5.basename(src);
1129
- const destBaseName = path5.basename(dest);
1128
+ const srcBaseName = path9.basename(src);
1129
+ const destBaseName = path9.basename(dest);
1130
1130
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1131
1131
  return { srcStat, destStat, isChangingCase: true };
1132
1132
  }
@@ -1145,9 +1145,9 @@ var require_stat = __commonJS({
1145
1145
  return { srcStat, destStat };
1146
1146
  }
1147
1147
  async function checkParentPaths(src, srcStat, dest, funcName) {
1148
- const srcParent = path5.resolve(path5.dirname(src));
1149
- const destParent = path5.resolve(path5.dirname(dest));
1150
- if (destParent === srcParent || destParent === path5.parse(destParent).root) return;
1148
+ const srcParent = path9.resolve(path9.dirname(src));
1149
+ const destParent = path9.resolve(path9.dirname(dest));
1150
+ if (destParent === srcParent || destParent === path9.parse(destParent).root) return;
1151
1151
  let destStat;
1152
1152
  try {
1153
1153
  destStat = await fs3.stat(destParent, { bigint: true });
@@ -1161,9 +1161,9 @@ var require_stat = __commonJS({
1161
1161
  return checkParentPaths(src, srcStat, destParent, funcName);
1162
1162
  }
1163
1163
  function checkParentPathsSync(src, srcStat, dest, funcName) {
1164
- const srcParent = path5.resolve(path5.dirname(src));
1165
- const destParent = path5.resolve(path5.dirname(dest));
1166
- if (destParent === srcParent || destParent === path5.parse(destParent).root) return;
1164
+ const srcParent = path9.resolve(path9.dirname(src));
1165
+ const destParent = path9.resolve(path9.dirname(dest));
1166
+ if (destParent === srcParent || destParent === path9.parse(destParent).root) return;
1167
1167
  let destStat;
1168
1168
  try {
1169
1169
  destStat = fs3.statSync(destParent, { bigint: true });
@@ -1180,8 +1180,8 @@ var require_stat = __commonJS({
1180
1180
  return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1181
1181
  }
1182
1182
  function isSrcSubdir(src, dest) {
1183
- const srcArr = path5.resolve(src).split(path5.sep).filter((i) => i);
1184
- const destArr = path5.resolve(dest).split(path5.sep).filter((i) => i);
1183
+ const srcArr = path9.resolve(src).split(path9.sep).filter((i) => i);
1184
+ const destArr = path9.resolve(dest).split(path9.sep).filter((i) => i);
1185
1185
  return srcArr.every((cur, i) => destArr[i] === cur);
1186
1186
  }
1187
1187
  function errMsg(src, dest, funcName) {
@@ -1206,7 +1206,7 @@ var require_copy = __commonJS({
1206
1206
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
1207
1207
  "use strict";
1208
1208
  var fs3 = require_fs();
1209
- var path5 = __require("path");
1209
+ var path9 = __require("path");
1210
1210
  var { mkdirs } = require_mkdirs();
1211
1211
  var { pathExists } = require_path_exists();
1212
1212
  var { utimesMillis } = require_utimes();
@@ -1228,7 +1228,7 @@ var require_copy = __commonJS({
1228
1228
  await stat.checkParentPaths(src, srcStat, dest, "copy");
1229
1229
  const include = await runFilter(src, dest, opts);
1230
1230
  if (!include) return;
1231
- const destParent = path5.dirname(dest);
1231
+ const destParent = path9.dirname(dest);
1232
1232
  const dirExists = await pathExists(destParent);
1233
1233
  if (!dirExists) {
1234
1234
  await mkdirs(destParent);
@@ -1282,8 +1282,8 @@ var require_copy = __commonJS({
1282
1282
  }
1283
1283
  const promises = [];
1284
1284
  for await (const item of await fs3.opendir(src)) {
1285
- const srcItem = path5.join(src, item.name);
1286
- const destItem = path5.join(dest, item.name);
1285
+ const srcItem = path9.join(src, item.name);
1286
+ const destItem = path9.join(dest, item.name);
1287
1287
  promises.push(
1288
1288
  runFilter(srcItem, destItem, opts).then((include) => {
1289
1289
  if (include) {
@@ -1302,7 +1302,7 @@ var require_copy = __commonJS({
1302
1302
  async function onLink(destStat, src, dest, opts) {
1303
1303
  let resolvedSrc = await fs3.readlink(src);
1304
1304
  if (opts.dereference) {
1305
- resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
1305
+ resolvedSrc = path9.resolve(process.cwd(), resolvedSrc);
1306
1306
  }
1307
1307
  if (!destStat) {
1308
1308
  return fs3.symlink(resolvedSrc, dest);
@@ -1315,7 +1315,7 @@ var require_copy = __commonJS({
1315
1315
  throw e;
1316
1316
  }
1317
1317
  if (opts.dereference) {
1318
- resolvedDest = path5.resolve(process.cwd(), resolvedDest);
1318
+ resolvedDest = path9.resolve(process.cwd(), resolvedDest);
1319
1319
  }
1320
1320
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1321
1321
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1335,7 +1335,7 @@ var require_copy_sync = __commonJS({
1335
1335
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
1336
1336
  "use strict";
1337
1337
  var fs3 = require_graceful_fs();
1338
- var path5 = __require("path");
1338
+ var path9 = __require("path");
1339
1339
  var mkdirsSync = require_mkdirs().mkdirsSync;
1340
1340
  var utimesMillisSync = require_utimes().utimesMillisSync;
1341
1341
  var stat = require_stat();
@@ -1356,7 +1356,7 @@ var require_copy_sync = __commonJS({
1356
1356
  const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1357
1357
  stat.checkParentPathsSync(src, srcStat, dest, "copy");
1358
1358
  if (opts.filter && !opts.filter(src, dest)) return;
1359
- const destParent = path5.dirname(dest);
1359
+ const destParent = path9.dirname(dest);
1360
1360
  if (!fs3.existsSync(destParent)) mkdirsSync(destParent);
1361
1361
  return getStats(destStat, src, dest, opts);
1362
1362
  }
@@ -1425,8 +1425,8 @@ var require_copy_sync = __commonJS({
1425
1425
  }
1426
1426
  }
1427
1427
  function copyDirItem(item, src, dest, opts) {
1428
- const srcItem = path5.join(src, item);
1429
- const destItem = path5.join(dest, item);
1428
+ const srcItem = path9.join(src, item);
1429
+ const destItem = path9.join(dest, item);
1430
1430
  if (opts.filter && !opts.filter(srcItem, destItem)) return;
1431
1431
  const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1432
1432
  return getStats(destStat, srcItem, destItem, opts);
@@ -1434,7 +1434,7 @@ var require_copy_sync = __commonJS({
1434
1434
  function onLink(destStat, src, dest, opts) {
1435
1435
  let resolvedSrc = fs3.readlinkSync(src);
1436
1436
  if (opts.dereference) {
1437
- resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
1437
+ resolvedSrc = path9.resolve(process.cwd(), resolvedSrc);
1438
1438
  }
1439
1439
  if (!destStat) {
1440
1440
  return fs3.symlinkSync(resolvedSrc, dest);
@@ -1447,7 +1447,7 @@ var require_copy_sync = __commonJS({
1447
1447
  throw err;
1448
1448
  }
1449
1449
  if (opts.dereference) {
1450
- resolvedDest = path5.resolve(process.cwd(), resolvedDest);
1450
+ resolvedDest = path9.resolve(process.cwd(), resolvedDest);
1451
1451
  }
1452
1452
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1453
1453
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1484,11 +1484,11 @@ var require_remove = __commonJS({
1484
1484
  "use strict";
1485
1485
  var fs3 = require_graceful_fs();
1486
1486
  var u = require_universalify().fromCallback;
1487
- function remove(path5, callback) {
1488
- fs3.rm(path5, { recursive: true, force: true }, callback);
1487
+ function remove(path9, callback) {
1488
+ fs3.rm(path9, { recursive: true, force: true }, callback);
1489
1489
  }
1490
- function removeSync(path5) {
1491
- fs3.rmSync(path5, { recursive: true, force: true });
1490
+ function removeSync(path9) {
1491
+ fs3.rmSync(path9, { recursive: true, force: true });
1492
1492
  }
1493
1493
  module.exports = {
1494
1494
  remove: u(remove),
@@ -1503,7 +1503,7 @@ var require_empty = __commonJS({
1503
1503
  "use strict";
1504
1504
  var u = require_universalify().fromPromise;
1505
1505
  var fs3 = require_fs();
1506
- var path5 = __require("path");
1506
+ var path9 = __require("path");
1507
1507
  var mkdir = require_mkdirs();
1508
1508
  var remove = require_remove();
1509
1509
  var emptyDir = u(async function emptyDir2(dir) {
@@ -1513,7 +1513,7 @@ var require_empty = __commonJS({
1513
1513
  } catch {
1514
1514
  return mkdir.mkdirs(dir);
1515
1515
  }
1516
- return Promise.all(items.map((item) => remove.remove(path5.join(dir, item))));
1516
+ return Promise.all(items.map((item) => remove.remove(path9.join(dir, item))));
1517
1517
  });
1518
1518
  function emptyDirSync(dir) {
1519
1519
  let items;
@@ -1523,7 +1523,7 @@ var require_empty = __commonJS({
1523
1523
  return mkdir.mkdirsSync(dir);
1524
1524
  }
1525
1525
  items.forEach((item) => {
1526
- item = path5.join(dir, item);
1526
+ item = path9.join(dir, item);
1527
1527
  remove.removeSync(item);
1528
1528
  });
1529
1529
  }
@@ -1541,7 +1541,7 @@ var require_file = __commonJS({
1541
1541
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
1542
1542
  "use strict";
1543
1543
  var u = require_universalify().fromPromise;
1544
- var path5 = __require("path");
1544
+ var path9 = __require("path");
1545
1545
  var fs3 = require_fs();
1546
1546
  var mkdir = require_mkdirs();
1547
1547
  async function createFile(file4) {
@@ -1551,7 +1551,7 @@ var require_file = __commonJS({
1551
1551
  } catch {
1552
1552
  }
1553
1553
  if (stats && stats.isFile()) return;
1554
- const dir = path5.dirname(file4);
1554
+ const dir = path9.dirname(file4);
1555
1555
  let dirStats = null;
1556
1556
  try {
1557
1557
  dirStats = await fs3.stat(dir);
@@ -1577,7 +1577,7 @@ var require_file = __commonJS({
1577
1577
  } catch {
1578
1578
  }
1579
1579
  if (stats && stats.isFile()) return;
1580
- const dir = path5.dirname(file4);
1580
+ const dir = path9.dirname(file4);
1581
1581
  try {
1582
1582
  if (!fs3.statSync(dir).isDirectory()) {
1583
1583
  fs3.readdirSync(dir);
@@ -1600,7 +1600,7 @@ var require_link = __commonJS({
1600
1600
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
1601
1601
  "use strict";
1602
1602
  var u = require_universalify().fromPromise;
1603
- var path5 = __require("path");
1603
+ var path9 = __require("path");
1604
1604
  var fs3 = require_fs();
1605
1605
  var mkdir = require_mkdirs();
1606
1606
  var { pathExists } = require_path_exists();
@@ -1619,7 +1619,7 @@ var require_link = __commonJS({
1619
1619
  throw err;
1620
1620
  }
1621
1621
  if (dstStat && areIdentical(srcStat, dstStat)) return;
1622
- const dir = path5.dirname(dstpath);
1622
+ const dir = path9.dirname(dstpath);
1623
1623
  const dirExists = await pathExists(dir);
1624
1624
  if (!dirExists) {
1625
1625
  await mkdir.mkdirs(dir);
@@ -1639,7 +1639,7 @@ var require_link = __commonJS({
1639
1639
  err.message = err.message.replace("lstat", "ensureLink");
1640
1640
  throw err;
1641
1641
  }
1642
- const dir = path5.dirname(dstpath);
1642
+ const dir = path9.dirname(dstpath);
1643
1643
  const dirExists = fs3.existsSync(dir);
1644
1644
  if (dirExists) return fs3.linkSync(srcpath, dstpath);
1645
1645
  mkdir.mkdirsSync(dir);
@@ -1656,12 +1656,12 @@ var require_link = __commonJS({
1656
1656
  var require_symlink_paths = __commonJS({
1657
1657
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
1658
1658
  "use strict";
1659
- var path5 = __require("path");
1659
+ var path9 = __require("path");
1660
1660
  var fs3 = require_fs();
1661
1661
  var { pathExists } = require_path_exists();
1662
1662
  var u = require_universalify().fromPromise;
1663
1663
  async function symlinkPaths(srcpath, dstpath) {
1664
- if (path5.isAbsolute(srcpath)) {
1664
+ if (path9.isAbsolute(srcpath)) {
1665
1665
  try {
1666
1666
  await fs3.lstat(srcpath);
1667
1667
  } catch (err) {
@@ -1673,8 +1673,8 @@ var require_symlink_paths = __commonJS({
1673
1673
  toDst: srcpath
1674
1674
  };
1675
1675
  }
1676
- const dstdir = path5.dirname(dstpath);
1677
- const relativeToDst = path5.join(dstdir, srcpath);
1676
+ const dstdir = path9.dirname(dstpath);
1677
+ const relativeToDst = path9.join(dstdir, srcpath);
1678
1678
  const exists = await pathExists(relativeToDst);
1679
1679
  if (exists) {
1680
1680
  return {
@@ -1690,11 +1690,11 @@ var require_symlink_paths = __commonJS({
1690
1690
  }
1691
1691
  return {
1692
1692
  toCwd: srcpath,
1693
- toDst: path5.relative(dstdir, srcpath)
1693
+ toDst: path9.relative(dstdir, srcpath)
1694
1694
  };
1695
1695
  }
1696
1696
  function symlinkPathsSync(srcpath, dstpath) {
1697
- if (path5.isAbsolute(srcpath)) {
1697
+ if (path9.isAbsolute(srcpath)) {
1698
1698
  const exists2 = fs3.existsSync(srcpath);
1699
1699
  if (!exists2) throw new Error("absolute srcpath does not exist");
1700
1700
  return {
@@ -1702,8 +1702,8 @@ var require_symlink_paths = __commonJS({
1702
1702
  toDst: srcpath
1703
1703
  };
1704
1704
  }
1705
- const dstdir = path5.dirname(dstpath);
1706
- const relativeToDst = path5.join(dstdir, srcpath);
1705
+ const dstdir = path9.dirname(dstpath);
1706
+ const relativeToDst = path9.join(dstdir, srcpath);
1707
1707
  const exists = fs3.existsSync(relativeToDst);
1708
1708
  if (exists) {
1709
1709
  return {
@@ -1715,7 +1715,7 @@ var require_symlink_paths = __commonJS({
1715
1715
  if (!srcExists) throw new Error("relative srcpath does not exist");
1716
1716
  return {
1717
1717
  toCwd: srcpath,
1718
- toDst: path5.relative(dstdir, srcpath)
1718
+ toDst: path9.relative(dstdir, srcpath)
1719
1719
  };
1720
1720
  }
1721
1721
  module.exports = {
@@ -1763,7 +1763,7 @@ var require_symlink = __commonJS({
1763
1763
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
1764
1764
  "use strict";
1765
1765
  var u = require_universalify().fromPromise;
1766
- var path5 = __require("path");
1766
+ var path9 = __require("path");
1767
1767
  var fs3 = require_fs();
1768
1768
  var { mkdirs, mkdirsSync } = require_mkdirs();
1769
1769
  var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
@@ -1786,7 +1786,7 @@ var require_symlink = __commonJS({
1786
1786
  const relative = await symlinkPaths(srcpath, dstpath);
1787
1787
  srcpath = relative.toDst;
1788
1788
  const toType = await symlinkType(relative.toCwd, type);
1789
- const dir = path5.dirname(dstpath);
1789
+ const dir = path9.dirname(dstpath);
1790
1790
  if (!await pathExists(dir)) {
1791
1791
  await mkdirs(dir);
1792
1792
  }
@@ -1806,7 +1806,7 @@ var require_symlink = __commonJS({
1806
1806
  const relative = symlinkPathsSync(srcpath, dstpath);
1807
1807
  srcpath = relative.toDst;
1808
1808
  type = symlinkTypeSync(relative.toCwd, type);
1809
- const dir = path5.dirname(dstpath);
1809
+ const dir = path9.dirname(dstpath);
1810
1810
  const exists = fs3.existsSync(dir);
1811
1811
  if (exists) return fs3.symlinkSync(srcpath, dstpath, type);
1812
1812
  mkdirsSync(dir);
@@ -1897,7 +1897,7 @@ var require_jsonfile = __commonJS({
1897
1897
  return obj;
1898
1898
  }
1899
1899
  var readFile = universalify.fromPromise(_readFile);
1900
- function readFileSync(file4, options = {}) {
1900
+ function readFileSync2(file4, options = {}) {
1901
1901
  if (typeof options === "string") {
1902
1902
  options = { encoding: options };
1903
1903
  }
@@ -1929,7 +1929,7 @@ var require_jsonfile = __commonJS({
1929
1929
  }
1930
1930
  var jsonfile = {
1931
1931
  readFile,
1932
- readFileSync,
1932
+ readFileSync: readFileSync2,
1933
1933
  writeFile,
1934
1934
  writeFileSync
1935
1935
  };
@@ -1958,18 +1958,18 @@ var require_output_file = __commonJS({
1958
1958
  "use strict";
1959
1959
  var u = require_universalify().fromPromise;
1960
1960
  var fs3 = require_fs();
1961
- var path5 = __require("path");
1961
+ var path9 = __require("path");
1962
1962
  var mkdir = require_mkdirs();
1963
1963
  var pathExists = require_path_exists().pathExists;
1964
1964
  async function outputFile(file4, data, encoding = "utf-8") {
1965
- const dir = path5.dirname(file4);
1965
+ const dir = path9.dirname(file4);
1966
1966
  if (!await pathExists(dir)) {
1967
1967
  await mkdir.mkdirs(dir);
1968
1968
  }
1969
1969
  return fs3.writeFile(file4, data, encoding);
1970
1970
  }
1971
1971
  function outputFileSync(file4, ...args) {
1972
- const dir = path5.dirname(file4);
1972
+ const dir = path9.dirname(file4);
1973
1973
  if (!fs3.existsSync(dir)) {
1974
1974
  mkdir.mkdirsSync(dir);
1975
1975
  }
@@ -2033,7 +2033,7 @@ var require_move = __commonJS({
2033
2033
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js"(exports, module) {
2034
2034
  "use strict";
2035
2035
  var fs3 = require_fs();
2036
- var path5 = __require("path");
2036
+ var path9 = __require("path");
2037
2037
  var { copy } = require_copy2();
2038
2038
  var { remove } = require_remove();
2039
2039
  var { mkdirp } = require_mkdirs();
@@ -2043,8 +2043,8 @@ var require_move = __commonJS({
2043
2043
  const overwrite = opts.overwrite || opts.clobber || false;
2044
2044
  const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2045
2045
  await stat.checkParentPaths(src, srcStat, dest, "move");
2046
- const destParent = path5.dirname(dest);
2047
- const parsedParentPath = path5.parse(destParent);
2046
+ const destParent = path9.dirname(dest);
2047
+ const parsedParentPath = path9.parse(destParent);
2048
2048
  if (parsedParentPath.root !== destParent) {
2049
2049
  await mkdirp(destParent);
2050
2050
  }
@@ -2085,7 +2085,7 @@ var require_move_sync = __commonJS({
2085
2085
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
2086
2086
  "use strict";
2087
2087
  var fs3 = require_graceful_fs();
2088
- var path5 = __require("path");
2088
+ var path9 = __require("path");
2089
2089
  var copySync = require_copy2().copySync;
2090
2090
  var removeSync = require_remove().removeSync;
2091
2091
  var mkdirpSync = require_mkdirs().mkdirpSync;
@@ -2095,12 +2095,12 @@ var require_move_sync = __commonJS({
2095
2095
  const overwrite = opts.overwrite || opts.clobber || false;
2096
2096
  const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2097
2097
  stat.checkParentPathsSync(src, srcStat, dest, "move");
2098
- if (!isParentRoot(dest)) mkdirpSync(path5.dirname(dest));
2098
+ if (!isParentRoot(dest)) mkdirpSync(path9.dirname(dest));
2099
2099
  return doRename(src, dest, overwrite, isChangingCase);
2100
2100
  }
2101
2101
  function isParentRoot(dest) {
2102
- const parent = path5.dirname(dest);
2103
- const parsedPath = path5.parse(parent);
2102
+ const parent = path9.dirname(dest);
2103
+ const parsedPath = path9.parse(parent);
2104
2104
  return parsedPath.root === parent;
2105
2105
  }
2106
2106
  function doRename(src, dest, overwrite, isChangingCase) {
@@ -2166,6 +2166,547 @@ var require_lib = __commonJS({
2166
2166
  }
2167
2167
  });
2168
2168
 
2169
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
2170
+ var require_windows = __commonJS({
2171
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
2172
+ "use strict";
2173
+ module.exports = isexe;
2174
+ isexe.sync = sync;
2175
+ var fs3 = __require("fs");
2176
+ function checkPathExt(path9, options) {
2177
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
2178
+ if (!pathext) {
2179
+ return true;
2180
+ }
2181
+ pathext = pathext.split(";");
2182
+ if (pathext.indexOf("") !== -1) {
2183
+ return true;
2184
+ }
2185
+ for (var i = 0; i < pathext.length; i++) {
2186
+ var p = pathext[i].toLowerCase();
2187
+ if (p && path9.substr(-p.length).toLowerCase() === p) {
2188
+ return true;
2189
+ }
2190
+ }
2191
+ return false;
2192
+ }
2193
+ function checkStat(stat, path9, options) {
2194
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
2195
+ return false;
2196
+ }
2197
+ return checkPathExt(path9, options);
2198
+ }
2199
+ function isexe(path9, options, cb) {
2200
+ fs3.stat(path9, function(er, stat) {
2201
+ cb(er, er ? false : checkStat(stat, path9, options));
2202
+ });
2203
+ }
2204
+ function sync(path9, options) {
2205
+ return checkStat(fs3.statSync(path9), path9, options);
2206
+ }
2207
+ }
2208
+ });
2209
+
2210
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
2211
+ var require_mode = __commonJS({
2212
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
2213
+ "use strict";
2214
+ module.exports = isexe;
2215
+ isexe.sync = sync;
2216
+ var fs3 = __require("fs");
2217
+ function isexe(path9, options, cb) {
2218
+ fs3.stat(path9, function(er, stat) {
2219
+ cb(er, er ? false : checkStat(stat, options));
2220
+ });
2221
+ }
2222
+ function sync(path9, options) {
2223
+ return checkStat(fs3.statSync(path9), options);
2224
+ }
2225
+ function checkStat(stat, options) {
2226
+ return stat.isFile() && checkMode(stat, options);
2227
+ }
2228
+ function checkMode(stat, options) {
2229
+ var mod = stat.mode;
2230
+ var uid = stat.uid;
2231
+ var gid = stat.gid;
2232
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
2233
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
2234
+ var u = parseInt("100", 8);
2235
+ var g = parseInt("010", 8);
2236
+ var o = parseInt("001", 8);
2237
+ var ug = u | g;
2238
+ var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
2239
+ return ret;
2240
+ }
2241
+ }
2242
+ });
2243
+
2244
+ // ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
2245
+ var require_isexe = __commonJS({
2246
+ "../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
2247
+ "use strict";
2248
+ var fs3 = __require("fs");
2249
+ var core;
2250
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
2251
+ core = require_windows();
2252
+ } else {
2253
+ core = require_mode();
2254
+ }
2255
+ module.exports = isexe;
2256
+ isexe.sync = sync;
2257
+ function isexe(path9, options, cb) {
2258
+ if (typeof options === "function") {
2259
+ cb = options;
2260
+ options = {};
2261
+ }
2262
+ if (!cb) {
2263
+ if (typeof Promise !== "function") {
2264
+ throw new TypeError("callback not provided");
2265
+ }
2266
+ return new Promise(function(resolve, reject) {
2267
+ isexe(path9, options || {}, function(er, is) {
2268
+ if (er) {
2269
+ reject(er);
2270
+ } else {
2271
+ resolve(is);
2272
+ }
2273
+ });
2274
+ });
2275
+ }
2276
+ core(path9, options || {}, function(er, is) {
2277
+ if (er) {
2278
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
2279
+ er = null;
2280
+ is = false;
2281
+ }
2282
+ }
2283
+ cb(er, is);
2284
+ });
2285
+ }
2286
+ function sync(path9, options) {
2287
+ try {
2288
+ return core.sync(path9, options || {});
2289
+ } catch (er) {
2290
+ if (options && options.ignoreErrors || er.code === "EACCES") {
2291
+ return false;
2292
+ } else {
2293
+ throw er;
2294
+ }
2295
+ }
2296
+ }
2297
+ }
2298
+ });
2299
+
2300
+ // ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
2301
+ var require_which = __commonJS({
2302
+ "../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
2303
+ "use strict";
2304
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
2305
+ var path9 = __require("path");
2306
+ var COLON = isWindows ? ";" : ":";
2307
+ var isexe = require_isexe();
2308
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
2309
+ var getPathInfo = (cmd, opt) => {
2310
+ const colon = opt.colon || COLON;
2311
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
2312
+ // windows always checks the cwd first
2313
+ ...isWindows ? [process.cwd()] : [],
2314
+ ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
2315
+ "").split(colon)
2316
+ ];
2317
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
2318
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
2319
+ if (isWindows) {
2320
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
2321
+ pathExt.unshift("");
2322
+ }
2323
+ return {
2324
+ pathEnv,
2325
+ pathExt,
2326
+ pathExtExe
2327
+ };
2328
+ };
2329
+ var which = (cmd, opt, cb) => {
2330
+ if (typeof opt === "function") {
2331
+ cb = opt;
2332
+ opt = {};
2333
+ }
2334
+ if (!opt)
2335
+ opt = {};
2336
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2337
+ const found = [];
2338
+ const step = (i) => new Promise((resolve, reject) => {
2339
+ if (i === pathEnv.length)
2340
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
2341
+ const ppRaw = pathEnv[i];
2342
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2343
+ const pCmd = path9.join(pathPart, cmd);
2344
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2345
+ resolve(subStep(p, i, 0));
2346
+ });
2347
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
2348
+ if (ii === pathExt.length)
2349
+ return resolve(step(i + 1));
2350
+ const ext = pathExt[ii];
2351
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
2352
+ if (!er && is) {
2353
+ if (opt.all)
2354
+ found.push(p + ext);
2355
+ else
2356
+ return resolve(p + ext);
2357
+ }
2358
+ return resolve(subStep(p, i, ii + 1));
2359
+ });
2360
+ });
2361
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
2362
+ };
2363
+ var whichSync = (cmd, opt) => {
2364
+ opt = opt || {};
2365
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
2366
+ const found = [];
2367
+ for (let i = 0; i < pathEnv.length; i++) {
2368
+ const ppRaw = pathEnv[i];
2369
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
2370
+ const pCmd = path9.join(pathPart, cmd);
2371
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
2372
+ for (let j = 0; j < pathExt.length; j++) {
2373
+ const cur = p + pathExt[j];
2374
+ try {
2375
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
2376
+ if (is) {
2377
+ if (opt.all)
2378
+ found.push(cur);
2379
+ else
2380
+ return cur;
2381
+ }
2382
+ } catch (ex) {
2383
+ }
2384
+ }
2385
+ }
2386
+ if (opt.all && found.length)
2387
+ return found;
2388
+ if (opt.nothrow)
2389
+ return null;
2390
+ throw getNotFoundError(cmd);
2391
+ };
2392
+ module.exports = which;
2393
+ which.sync = whichSync;
2394
+ }
2395
+ });
2396
+
2397
+ // ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
2398
+ var require_path_key = __commonJS({
2399
+ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
2400
+ "use strict";
2401
+ var pathKey2 = (options = {}) => {
2402
+ const environment = options.env || process.env;
2403
+ const platform = options.platform || process.platform;
2404
+ if (platform !== "win32") {
2405
+ return "PATH";
2406
+ }
2407
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
2408
+ };
2409
+ module.exports = pathKey2;
2410
+ module.exports.default = pathKey2;
2411
+ }
2412
+ });
2413
+
2414
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
2415
+ var require_resolveCommand = __commonJS({
2416
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
2417
+ "use strict";
2418
+ var path9 = __require("path");
2419
+ var which = require_which();
2420
+ var getPathKey = require_path_key();
2421
+ function resolveCommandAttempt(parsed, withoutPathExt) {
2422
+ const env = parsed.options.env || process.env;
2423
+ const cwd = process.cwd();
2424
+ const hasCustomCwd = parsed.options.cwd != null;
2425
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
2426
+ if (shouldSwitchCwd) {
2427
+ try {
2428
+ process.chdir(parsed.options.cwd);
2429
+ } catch (err) {
2430
+ }
2431
+ }
2432
+ let resolved;
2433
+ try {
2434
+ resolved = which.sync(parsed.command, {
2435
+ path: env[getPathKey({ env })],
2436
+ pathExt: withoutPathExt ? path9.delimiter : void 0
2437
+ });
2438
+ } catch (e) {
2439
+ } finally {
2440
+ if (shouldSwitchCwd) {
2441
+ process.chdir(cwd);
2442
+ }
2443
+ }
2444
+ if (resolved) {
2445
+ resolved = path9.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
2446
+ }
2447
+ return resolved;
2448
+ }
2449
+ function resolveCommand(parsed) {
2450
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
2451
+ }
2452
+ module.exports = resolveCommand;
2453
+ }
2454
+ });
2455
+
2456
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
2457
+ var require_escape = __commonJS({
2458
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
2459
+ "use strict";
2460
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
2461
+ function escapeCommand(arg) {
2462
+ arg = arg.replace(metaCharsRegExp, "^$1");
2463
+ return arg;
2464
+ }
2465
+ function escapeArgument(arg, doubleEscapeMetaChars) {
2466
+ arg = `${arg}`;
2467
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
2468
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
2469
+ arg = `"${arg}"`;
2470
+ arg = arg.replace(metaCharsRegExp, "^$1");
2471
+ if (doubleEscapeMetaChars) {
2472
+ arg = arg.replace(metaCharsRegExp, "^$1");
2473
+ }
2474
+ return arg;
2475
+ }
2476
+ module.exports.command = escapeCommand;
2477
+ module.exports.argument = escapeArgument;
2478
+ }
2479
+ });
2480
+
2481
+ // ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
2482
+ var require_shebang_regex = __commonJS({
2483
+ "../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
2484
+ "use strict";
2485
+ module.exports = /^#!(.*)/;
2486
+ }
2487
+ });
2488
+
2489
+ // ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
2490
+ var require_shebang_command = __commonJS({
2491
+ "../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
2492
+ "use strict";
2493
+ var shebangRegex = require_shebang_regex();
2494
+ module.exports = (string = "") => {
2495
+ const match2 = string.match(shebangRegex);
2496
+ if (!match2) {
2497
+ return null;
2498
+ }
2499
+ const [path9, argument] = match2[0].replace(/#! ?/, "").split(" ");
2500
+ const binary = path9.split("/").pop();
2501
+ if (binary === "env") {
2502
+ return argument;
2503
+ }
2504
+ return argument ? `${binary} ${argument}` : binary;
2505
+ };
2506
+ }
2507
+ });
2508
+
2509
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
2510
+ var require_readShebang = __commonJS({
2511
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
2512
+ "use strict";
2513
+ var fs3 = __require("fs");
2514
+ var shebangCommand = require_shebang_command();
2515
+ function readShebang(command) {
2516
+ const size = 150;
2517
+ const buffer = Buffer.alloc(size);
2518
+ let fd;
2519
+ try {
2520
+ fd = fs3.openSync(command, "r");
2521
+ fs3.readSync(fd, buffer, 0, size, 0);
2522
+ fs3.closeSync(fd);
2523
+ } catch (e) {
2524
+ }
2525
+ return shebangCommand(buffer.toString());
2526
+ }
2527
+ module.exports = readShebang;
2528
+ }
2529
+ });
2530
+
2531
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
2532
+ var require_parse = __commonJS({
2533
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
2534
+ "use strict";
2535
+ var path9 = __require("path");
2536
+ var resolveCommand = require_resolveCommand();
2537
+ var escape = require_escape();
2538
+ var readShebang = require_readShebang();
2539
+ var isWin = process.platform === "win32";
2540
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
2541
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
2542
+ function detectShebang(parsed) {
2543
+ parsed.file = resolveCommand(parsed);
2544
+ const shebang = parsed.file && readShebang(parsed.file);
2545
+ if (shebang) {
2546
+ parsed.args.unshift(parsed.file);
2547
+ parsed.command = shebang;
2548
+ return resolveCommand(parsed);
2549
+ }
2550
+ return parsed.file;
2551
+ }
2552
+ function parseNonShell(parsed) {
2553
+ if (!isWin) {
2554
+ return parsed;
2555
+ }
2556
+ const commandFile = detectShebang(parsed);
2557
+ const needsShell = !isExecutableRegExp.test(commandFile);
2558
+ if (parsed.options.forceShell || needsShell) {
2559
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
2560
+ parsed.command = path9.normalize(parsed.command);
2561
+ parsed.command = escape.command(parsed.command);
2562
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
2563
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
2564
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
2565
+ parsed.command = process.env.comspec || "cmd.exe";
2566
+ parsed.options.windowsVerbatimArguments = true;
2567
+ }
2568
+ return parsed;
2569
+ }
2570
+ function parse(command, args, options) {
2571
+ if (args && !Array.isArray(args)) {
2572
+ options = args;
2573
+ args = null;
2574
+ }
2575
+ args = args ? args.slice(0) : [];
2576
+ options = Object.assign({}, options);
2577
+ const parsed = {
2578
+ command,
2579
+ args,
2580
+ options,
2581
+ file: void 0,
2582
+ original: {
2583
+ command,
2584
+ args
2585
+ }
2586
+ };
2587
+ return options.shell ? parsed : parseNonShell(parsed);
2588
+ }
2589
+ module.exports = parse;
2590
+ }
2591
+ });
2592
+
2593
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
2594
+ var require_enoent = __commonJS({
2595
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
2596
+ "use strict";
2597
+ var isWin = process.platform === "win32";
2598
+ function notFoundError(original, syscall) {
2599
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
2600
+ code: "ENOENT",
2601
+ errno: "ENOENT",
2602
+ syscall: `${syscall} ${original.command}`,
2603
+ path: original.command,
2604
+ spawnargs: original.args
2605
+ });
2606
+ }
2607
+ function hookChildProcess(cp, parsed) {
2608
+ if (!isWin) {
2609
+ return;
2610
+ }
2611
+ const originalEmit = cp.emit;
2612
+ cp.emit = function(name, arg1) {
2613
+ if (name === "exit") {
2614
+ const err = verifyENOENT(arg1, parsed);
2615
+ if (err) {
2616
+ return originalEmit.call(cp, "error", err);
2617
+ }
2618
+ }
2619
+ return originalEmit.apply(cp, arguments);
2620
+ };
2621
+ }
2622
+ function verifyENOENT(status, parsed) {
2623
+ if (isWin && status === 1 && !parsed.file) {
2624
+ return notFoundError(parsed.original, "spawn");
2625
+ }
2626
+ return null;
2627
+ }
2628
+ function verifyENOENTSync(status, parsed) {
2629
+ if (isWin && status === 1 && !parsed.file) {
2630
+ return notFoundError(parsed.original, "spawnSync");
2631
+ }
2632
+ return null;
2633
+ }
2634
+ module.exports = {
2635
+ hookChildProcess,
2636
+ verifyENOENT,
2637
+ verifyENOENTSync,
2638
+ notFoundError
2639
+ };
2640
+ }
2641
+ });
2642
+
2643
+ // ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
2644
+ var require_cross_spawn = __commonJS({
2645
+ "../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
2646
+ "use strict";
2647
+ var cp = __require("child_process");
2648
+ var parse = require_parse();
2649
+ var enoent = require_enoent();
2650
+ function spawn(command, args, options) {
2651
+ const parsed = parse(command, args, options);
2652
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
2653
+ enoent.hookChildProcess(spawned, parsed);
2654
+ return spawned;
2655
+ }
2656
+ function spawnSync(command, args, options) {
2657
+ const parsed = parse(command, args, options);
2658
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
2659
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
2660
+ return result;
2661
+ }
2662
+ module.exports = spawn;
2663
+ module.exports.spawn = spawn;
2664
+ module.exports.sync = spawnSync;
2665
+ module.exports._parse = parse;
2666
+ module.exports._enoent = enoent;
2667
+ }
2668
+ });
2669
+
2670
+ // ../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js
2671
+ var require_merge_stream = __commonJS({
2672
+ "../../node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js"(exports, module) {
2673
+ "use strict";
2674
+ var { PassThrough } = __require("stream");
2675
+ module.exports = function() {
2676
+ var sources = [];
2677
+ var output = new PassThrough({ objectMode: true });
2678
+ output.setMaxListeners(0);
2679
+ output.add = add;
2680
+ output.isEmpty = isEmpty;
2681
+ output.on("unpipe", remove);
2682
+ Array.prototype.slice.call(arguments).forEach(add);
2683
+ return output;
2684
+ function add(source) {
2685
+ if (Array.isArray(source)) {
2686
+ source.forEach(add);
2687
+ return this;
2688
+ }
2689
+ sources.push(source);
2690
+ source.once("end", remove.bind(null, source));
2691
+ source.once("error", output.emit.bind(output, "error"));
2692
+ source.pipe(output, { end: false });
2693
+ return this;
2694
+ }
2695
+ function isEmpty() {
2696
+ return sources.length == 0;
2697
+ }
2698
+ function remove(source) {
2699
+ sources = sources.filter(function(it) {
2700
+ return it !== source;
2701
+ });
2702
+ if (!sources.length && output.readable) {
2703
+ output.end();
2704
+ }
2705
+ }
2706
+ };
2707
+ }
2708
+ });
2709
+
2169
2710
  // src/externalToInternalDmmf.ts
2170
2711
  import { capitalize, uncapitalize } from "@prisma/client-common";
2171
2712
  import pluralize from "pluralize";
@@ -2213,9 +2754,18 @@ function getMappings(mappings, datamodel) {
2213
2754
 
2214
2755
  // src/generateClient.ts
2215
2756
  var import_fs_extra = __toESM(require_lib());
2216
- import { pathToPosix, setClassName } from "@prisma/internals";
2757
+ import { Debug } from "@prisma/debug";
2758
+ import { overwriteFile } from "@prisma/fetch-engine";
2759
+ import {
2760
+ assertNever as assertNever3,
2761
+ ClientEngineType as ClientEngineType3,
2762
+ getClientEngineType as getClientEngineType2,
2763
+ pathToPosix as pathToPosix4,
2764
+ setClassName
2765
+ } from "@prisma/internals";
2217
2766
  import { createHash } from "crypto";
2218
2767
  import paths from "env-paths";
2768
+ import { existsSync } from "fs";
2219
2769
  import fs from "fs/promises";
2220
2770
 
2221
2771
  // ../../node_modules/.pnpm/kleur@4.1.5/node_modules/kleur/colors.mjs
@@ -2268,7 +2818,7 @@ var bgWhite = init(47, 49);
2268
2818
 
2269
2819
  // src/generateClient.ts
2270
2820
  import { packageUp } from "package-up";
2271
- import path from "path";
2821
+ import path3 from "path";
2272
2822
 
2273
2823
  // ../client/package.json
2274
2824
  var package_default = {
@@ -2300,7 +2850,8 @@ var package_default = {
2300
2850
  "MSSQL",
2301
2851
  "SQL Server",
2302
2852
  "SQLServer",
2303
- "MongoDB"
2853
+ "MongoDB",
2854
+ "react-native"
2304
2855
  ],
2305
2856
  main: "default.js",
2306
2857
  types: "default.d.ts",
@@ -2326,6 +2877,18 @@ var package_default = {
2326
2877
  },
2327
2878
  default: "./default.js"
2328
2879
  },
2880
+ "./edge": {
2881
+ types: "./edge.d.ts",
2882
+ require: "./edge.js",
2883
+ import: "./edge.js",
2884
+ default: "./edge.js"
2885
+ },
2886
+ "./react-native": {
2887
+ types: "./react-native.d.ts",
2888
+ require: "./react-native.js",
2889
+ import: "./react-native.js",
2890
+ default: "./react-native.js"
2891
+ },
2329
2892
  "./extension": {
2330
2893
  types: "./extension.d.ts",
2331
2894
  require: "./extension.js",
@@ -2344,11 +2907,11 @@ var package_default = {
2344
2907
  import: "./index.js",
2345
2908
  default: "./index.js"
2346
2909
  },
2347
- "./edge": {
2348
- types: "./edge.d.ts",
2349
- require: "./edge.js",
2350
- import: "./edge.js",
2351
- default: "./edge.js"
2910
+ "./wasm": {
2911
+ types: "./wasm.d.ts",
2912
+ require: "./wasm.js",
2913
+ import: "./wasm.mjs",
2914
+ default: "./wasm.mjs"
2352
2915
  },
2353
2916
  "./runtime/client": {
2354
2917
  types: "./runtime/client.d.ts",
@@ -2360,12 +2923,42 @@ var package_default = {
2360
2923
  import: "./runtime/client.mjs",
2361
2924
  default: "./runtime/client.mjs"
2362
2925
  },
2926
+ "./runtime/library": {
2927
+ types: "./runtime/library.d.ts",
2928
+ require: "./runtime/library.js",
2929
+ import: "./runtime/library.mjs",
2930
+ default: "./runtime/library.mjs"
2931
+ },
2932
+ "./runtime/binary": {
2933
+ types: "./runtime/binary.d.ts",
2934
+ require: "./runtime/binary.js",
2935
+ import: "./runtime/binary.mjs",
2936
+ default: "./runtime/binary.mjs"
2937
+ },
2938
+ "./runtime/wasm-engine-edge": {
2939
+ types: "./runtime/wasm-engine-edge.d.ts",
2940
+ require: "./runtime/wasm-engine-edge.js",
2941
+ import: "./runtime/wasm-engine-edge.mjs",
2942
+ default: "./runtime/wasm-engine-edge.mjs"
2943
+ },
2363
2944
  "./runtime/wasm-compiler-edge": {
2364
2945
  types: "./runtime/wasm-compiler-edge.d.ts",
2365
2946
  require: "./runtime/wasm-compiler-edge.js",
2366
2947
  import: "./runtime/wasm-compiler-edge.mjs",
2367
2948
  default: "./runtime/wasm-compiler-edge.mjs"
2368
2949
  },
2950
+ "./runtime/edge": {
2951
+ types: "./runtime/edge.d.ts",
2952
+ require: "./runtime/edge.js",
2953
+ import: "./runtime/edge-esm.js",
2954
+ default: "./runtime/edge-esm.js"
2955
+ },
2956
+ "./runtime/react-native": {
2957
+ types: "./runtime/react-native.d.ts",
2958
+ require: "./runtime/react-native.js",
2959
+ import: "./runtime/react-native.js",
2960
+ default: "./runtime/react-native.js"
2961
+ },
2369
2962
  "./runtime/index-browser": {
2370
2963
  types: "./runtime/index-browser.d.ts",
2371
2964
  require: "./runtime/index-browser.js",
@@ -2394,7 +2987,7 @@ var package_default = {
2394
2987
  },
2395
2988
  license: "Apache-2.0",
2396
2989
  engines: {
2397
- node: "^20.19 || ^22.12 || >=24.0"
2990
+ node: ">=18.18"
2398
2991
  },
2399
2992
  homepage: "https://www.prisma.io",
2400
2993
  repository: {
@@ -2410,11 +3003,13 @@ var package_default = {
2410
3003
  test: "dotenv -e ../../.db.env -- jest --silent",
2411
3004
  "test:e2e": "dotenv -e ../../.db.env -- tsx tests/e2e/_utils/run.ts",
2412
3005
  "test:functional": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts",
2413
- "test:functional:client": "pnpm run test:functional --client-runtime client",
3006
+ "test:functional:client": "pnpm run test:functional --client-runtime client --engine-type client",
2414
3007
  "test:memory": "dotenv -e ../../.db.env -- tsx helpers/memory-tests.ts",
2415
3008
  "test:functional:code": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --no-types",
2416
3009
  "test:functional:types": "dotenv -e ../../.db.env -- tsx helpers/functional-test/run-tests.ts --types-only",
2417
3010
  "test-notypes": "dotenv -e ../../.db.env -- jest --testPathIgnorePatterns src/__tests__/types/types.test.ts",
3011
+ generate: "node scripts/postinstall.js",
3012
+ postinstall: "node scripts/postinstall.js",
2418
3013
  prepublishOnly: "pnpm run build",
2419
3014
  "new-test": "tsx ./helpers/new-test/new-test.ts"
2420
3015
  },
@@ -2425,8 +3020,12 @@ var package_default = {
2425
3020
  "generator-build",
2426
3021
  "edge.js",
2427
3022
  "edge.d.ts",
3023
+ "wasm.js",
3024
+ "wasm.d.ts",
2428
3025
  "index.js",
2429
3026
  "index.d.ts",
3027
+ "react-native.js",
3028
+ "react-native.d.ts",
2430
3029
  "default.js",
2431
3030
  "default.d.ts",
2432
3031
  "index-browser.js",
@@ -2437,7 +3036,7 @@ var package_default = {
2437
3036
  "sql.mjs"
2438
3037
  ],
2439
3038
  devDependencies: {
2440
- "@cloudflare/workers-types": "^4.20251014.0",
3039
+ "@cloudflare/workers-types": "^4.20250408.0",
2441
3040
  "@codspeed/benchmark.js-plugin": "4.0.0",
2442
3041
  "@faker-js/faker": "9.6.0",
2443
3042
  "@fast-check/jest": "2.0.3",
@@ -2472,20 +3071,18 @@ var package_default = {
2472
3071
  "@prisma/dmmf": "workspace:*",
2473
3072
  "@prisma/driver-adapter-utils": "workspace:*",
2474
3073
  "@prisma/engines": "workspace:*",
2475
- "@prisma/engines-version": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
3074
+ "@prisma/engines-version": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
2476
3075
  "@prisma/fetch-engine": "workspace:*",
2477
3076
  "@prisma/generator": "workspace:*",
2478
3077
  "@prisma/generator-helper": "workspace:*",
2479
3078
  "@prisma/get-platform": "workspace:*",
2480
3079
  "@prisma/instrumentation": "workspace:*",
2481
- "@prisma/instrumentation-contract": "workspace:*",
2482
3080
  "@prisma/internals": "workspace:*",
2483
- "@prisma/json-protocol": "workspace:*",
2484
3081
  "@prisma/migrate": "workspace:*",
2485
- "@prisma/query-compiler-wasm": "7.2.0-4.0c8ef2ce45c83248ab3df073180d5eda9e8be7a3",
3082
+ "@prisma/mini-proxy": "0.9.5",
3083
+ "@prisma/query-compiler-wasm": "7.1.1-3.c2990dca591cba766e3b7ef5d9e8a84796e47ab7",
3084
+ "@prisma/query-engine-wasm": "6.19.0-26.2ba551f319ab1df4bc874a89965d8b3641056773",
2486
3085
  "@prisma/query-plan-executor": "workspace:*",
2487
- "@prisma/sqlcommenter": "workspace:*",
2488
- "@prisma/sqlcommenter-trace-context": "workspace:*",
2489
3086
  "@prisma/ts-builders": "workspace:*",
2490
3087
  "@snaplet/copycat": "6.0.0",
2491
3088
  "@swc-node/register": "1.10.9",
@@ -2497,11 +3094,12 @@ var package_default = {
2497
3094
  "@types/jest": "29.5.14",
2498
3095
  "@types/js-levenshtein": "1.1.3",
2499
3096
  "@types/mssql": "9.1.8",
2500
- "@types/node": "~20.19.24",
3097
+ "@types/node": "18.19.76",
2501
3098
  "@types/pg": "8.11.11",
2502
3099
  arg: "5.0.2",
2503
3100
  benchmark: "2.1.4",
2504
3101
  "cookie-es": "2.0.0",
3102
+ "decimal.js": "10.5.0",
2505
3103
  execa: "8.0.1",
2506
3104
  "expect-type": "1.2.2",
2507
3105
  "fs-extra": "11.3.0",
@@ -2526,6 +3124,7 @@ var package_default = {
2526
3124
  "simple-statistics": "7.8.8",
2527
3125
  "sort-keys": "5.1.0",
2528
3126
  "source-map-support": "0.5.21",
3127
+ "sql-template-tag": "5.2.1",
2529
3128
  "stacktrace-parser": "0.1.11",
2530
3129
  "strip-ansi": "7.1.0",
2531
3130
  "strip-indent": "4.0.0",
@@ -2536,12 +3135,9 @@ var package_default = {
2536
3135
  undici: "7.4.0",
2537
3136
  zx: "8.4.1"
2538
3137
  },
2539
- dependencies: {
2540
- "@prisma/client-runtime-utils": "workspace:*"
2541
- },
2542
3138
  peerDependencies: {
2543
3139
  prisma: "*",
2544
- typescript: ">=5.4.0"
3140
+ typescript: ">=5.1.0"
2545
3141
  },
2546
3142
  peerDependenciesMeta: {
2547
3143
  prisma: {
@@ -2586,7 +3182,7 @@ var Enum = class {
2586
3182
  toJS() {
2587
3183
  const { type } = this;
2588
3184
  const enumVariants = `{
2589
- ${indent(type.data.map((v) => `${v.key}: ${this.getValueJS(v.value)}`).join(",\n"), TAB_SIZE)}
3185
+ ${indent(type.values.map((v) => `${v}: ${this.getValueJS(v)}`).join(",\n"), TAB_SIZE)}
2590
3186
  }`;
2591
3187
  const enumBody = this.isStrictEnum() ? `makeStrictEnum(${enumVariants})` : enumVariants;
2592
3188
  return this.useNamespace ? `exports.Prisma.${type.name} = ${enumBody};` : `exports.${type.name} = exports.$Enums.${type.name} = ${enumBody};`;
@@ -2597,7 +3193,7 @@ ${indent(type.data.map((v) => `${v.key}: ${this.getValueJS(v.value)}`).join(",\n
2597
3193
  toTS() {
2598
3194
  const { type } = this;
2599
3195
  return `export const ${type.name}: {
2600
- ${indent(type.data.map((v) => `${v.key}: ${this.getValueTS(v.value)}`).join(",\n"), TAB_SIZE)}
3196
+ ${indent(type.values.map((v) => `${v}: ${this.getValueTS(v)}`).join(",\n"), TAB_SIZE)}
2601
3197
  };
2602
3198
 
2603
3199
  export type ${type.name} = (typeof ${type.name})[keyof typeof ${type.name}]
@@ -4323,9 +4919,13 @@ function fluentWrapperName(modelName) {
4323
4919
  }
4324
4920
 
4325
4921
  // src/TSClient/TSClient.ts
4326
- import { datamodelEnumToSchemaEnum, datamodelSchemaEnumToSchemaEnum } from "@prisma/dmmf";
4922
+ import { datamodelEnumToSchemaEnum } from "@prisma/dmmf";
4923
+ import { ClientEngineType as ClientEngineType2, getClientEngineType, pathToPosix as pathToPosix3 } from "@prisma/internals";
4327
4924
  import * as ts12 from "@prisma/ts-builders";
4328
- import indent7 from "indent-string";
4925
+ import ciInfo from "ci-info";
4926
+ import crypto from "crypto";
4927
+ import indent8 from "indent-string";
4928
+ import path2 from "path";
4329
4929
 
4330
4930
  // src/dmmf.ts
4331
4931
  import { keyBy } from "@prisma/client-common";
@@ -4520,27 +5120,90 @@ var GenericArgsInfo = class {
4520
5120
  }
4521
5121
  };
4522
5122
 
5123
+ // src/utils/buildInjectableEdgeEnv.ts
5124
+ function buildInjectableEdgeEnv(edge, datasources) {
5125
+ if (edge === true) {
5126
+ return declareInjectableEdgeEnv(datasources);
5127
+ }
5128
+ return ``;
5129
+ }
5130
+ function declareInjectableEdgeEnv(datasources) {
5131
+ const injectableEdgeEnv = { parsed: {} };
5132
+ const envVarNames = getSelectedEnvVarNames(datasources);
5133
+ for (const envVarName of envVarNames) {
5134
+ injectableEdgeEnv.parsed[envVarName] = getRuntimeEdgeEnvVar(envVarName);
5135
+ }
5136
+ const injectableEdgeEnvJson = JSON.stringify(injectableEdgeEnv, null, 2);
5137
+ const injectableEdgeEnvCode = injectableEdgeEnvJson.replace(/"/g, "");
5138
+ return `
5139
+ config.injectableEdgeEnv = () => (${injectableEdgeEnvCode})`;
5140
+ }
5141
+ function getSelectedEnvVarNames(datasources) {
5142
+ return datasources.reduce((acc, datasource) => {
5143
+ if (datasource.url.fromEnvVar) {
5144
+ return [...acc, datasource.url.fromEnvVar];
5145
+ }
5146
+ return acc;
5147
+ }, []);
5148
+ }
5149
+ function getRuntimeEdgeEnvVar(envVarName) {
5150
+ const cfwEnv = `typeof globalThis !== 'undefined' && globalThis['${envVarName}']`;
5151
+ const nodeOrVercelEnv = `typeof process !== 'undefined' && process.env && process.env.${envVarName}`;
5152
+ return `${cfwEnv} || ${nodeOrVercelEnv} || undefined`;
5153
+ }
5154
+
4523
5155
  // src/utils/buildDebugInitialization.ts
4524
5156
  function buildDebugInitialization(edge) {
4525
5157
  if (!edge) {
4526
5158
  return "";
4527
5159
  }
4528
- const debugVar = `typeof globalThis !== 'undefined' && globalThis['DEBUG'] || (typeof process !== 'undefined' && process.env && process.env.DEBUG) || undefined`;
5160
+ const debugVar = getRuntimeEdgeEnvVar("DEBUG");
4529
5161
  return `if (${debugVar}) {
4530
5162
  Debug.enable(${debugVar})
4531
5163
  }
4532
5164
  `;
4533
5165
  }
4534
5166
 
5167
+ // src/utils/buildDirname.ts
5168
+ import { pathToPosix } from "@prisma/internals";
5169
+ function buildDirname(edge, relativeOutdir) {
5170
+ if (edge === true) {
5171
+ return buildDirnameDefault();
5172
+ }
5173
+ return buildDirnameFind(relativeOutdir);
5174
+ }
5175
+ function buildDirnameFind(relativeOutdir) {
5176
+ return `
5177
+ const fs = require('fs')
5178
+
5179
+ config.dirname = __dirname
5180
+ if (!fs.existsSync(path.join(__dirname, 'schema.prisma'))) {
5181
+ const alternativePaths = [
5182
+ ${JSON.stringify(pathToPosix(relativeOutdir))},
5183
+ ${JSON.stringify(pathToPosix(relativeOutdir).split("/").slice(1).join("/"))},
5184
+ ]
5185
+
5186
+ const alternativePath = alternativePaths.find((altPath) => {
5187
+ return fs.existsSync(path.join(process.cwd(), altPath, 'schema.prisma'))
5188
+ }) ?? alternativePaths[0]
5189
+
5190
+ config.dirname = path.join(process.cwd(), alternativePath)
5191
+ config.isBundled = true
5192
+ }`;
5193
+ }
5194
+ function buildDirnameDefault() {
5195
+ return `config.dirname = '/'`;
5196
+ }
5197
+
4535
5198
  // src/utils/buildDMMF.ts
4536
5199
  import {
4537
5200
  dmmfToRuntimeDataModel,
4538
5201
  pruneRuntimeDataModel
4539
5202
  } from "@prisma/client-common";
4540
- function buildRuntimeDataModel(datamodel, runtimeName) {
5203
+ function buildRuntimeDataModel(datamodel, runtimeNameJs) {
4541
5204
  const runtimeDataModel = dmmfToRuntimeDataModel(datamodel);
4542
5205
  let prunedDataModel;
4543
- if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
5206
+ if (runtimeNameJs === "wasm-engine-edge" || runtimeNameJs === "wasm-compiler-edge" || runtimeNameJs === "client") {
4544
5207
  prunedDataModel = pruneRuntimeDataModel(runtimeDataModel);
4545
5208
  } else {
4546
5209
  prunedDataModel = runtimeDataModel;
@@ -4552,20 +5215,19 @@ defineDmmfProperty(exports.Prisma, config.runtimeDataModel)`;
4552
5215
  }
4553
5216
 
4554
5217
  // src/utils/buildGetQueryCompilerWasmModule.ts
4555
- function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName) {
4556
- if (runtimeName === "client" && !forceEdgeWasmLoader) {
5218
+ function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeNameJs) {
5219
+ if (runtimeNameJs === "client" && !forceEdgeWasmLoader) {
4557
5220
  return `config.compilerWasm = {
4558
5221
  getRuntime: async () => require('./query_compiler_bg.js'),
4559
5222
  getQueryCompilerWasmModule: async () => {
4560
- const { Buffer } = require('node:buffer')
4561
- const { wasm } = require('./query_compiler_bg.wasm-base64.js')
4562
- const queryCompilerWasmFileBytes = Buffer.from(wasm, 'base64')
5223
+ const queryCompilerWasmFilePath = require('path').join(config.dirname, 'query_compiler_bg.wasm')
5224
+ const queryCompilerWasmFileBytes = require('fs').readFileSync(queryCompilerWasmFilePath)
4563
5225
 
4564
5226
  return new WebAssembly.Module(queryCompilerWasmFileBytes)
4565
5227
  }
4566
5228
  }`;
4567
5229
  }
4568
- if (runtimeName === "client" && forceEdgeWasmLoader || runtimeName === "wasm-compiler-edge") {
5230
+ if (runtimeNameJs === "client" && forceEdgeWasmLoader || runtimeNameJs === "wasm-compiler-edge") {
4569
5231
  return `config.compilerWasm = {
4570
5232
  getRuntime: async () => require('./query_compiler_bg.js'),
4571
5233
  getQueryCompilerWasmModule: async () => {
@@ -4578,6 +5240,90 @@ function buildQueryCompilerWasmModule(forceEdgeWasmLoader, runtimeName) {
4578
5240
  return `config.compilerWasm = undefined`;
4579
5241
  }
4580
5242
 
5243
+ // src/utils/buildGetQueryEngineWasmModule.ts
5244
+ function buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs) {
5245
+ if (copyEngine && runtimeNameJs === "library" && process.env.PRISMA_CLIENT_FORCE_WASM) {
5246
+ return `config.engineWasm = {
5247
+ getRuntime: async () => require('./query_engine_bg.js'),
5248
+ getQueryEngineWasmModule: async () => {
5249
+ const queryEngineWasmFilePath = require('path').join(config.dirname, 'query_engine_bg.wasm')
5250
+ const queryEngineWasmFileBytes = require('fs').readFileSync(queryEngineWasmFilePath)
5251
+
5252
+ return new WebAssembly.Module(queryEngineWasmFileBytes)
5253
+ }
5254
+ }`;
5255
+ }
5256
+ if (copyEngine && wasm === true && runtimeNameJs === "wasm-engine-edge") {
5257
+ return `config.engineWasm = {
5258
+ getRuntime: async () => require('./query_engine_bg.js'),
5259
+ getQueryEngineWasmModule: async () => {
5260
+ const loader = (await import('#wasm-engine-loader')).default
5261
+ const engine = (await loader).default
5262
+ return engine
5263
+ }
5264
+ }`;
5265
+ }
5266
+ return `config.engineWasm = undefined`;
5267
+ }
5268
+
5269
+ // src/utils/buildInlineDatasources.ts
5270
+ function buildInlineDatasources(datasources) {
5271
+ return datasources.reduce((acc, ds) => {
5272
+ return acc[ds.name] = buildInlineDatasource(ds), acc;
5273
+ }, {});
5274
+ }
5275
+ function buildInlineDatasource(ds) {
5276
+ if (ds.url.fromEnvVar) {
5277
+ return { url: { fromEnvVar: ds.url.fromEnvVar, value: null } };
5278
+ } else {
5279
+ return { url: { fromEnvVar: null, value: ds.url.value } };
5280
+ }
5281
+ }
5282
+
5283
+ // src/utils/buildNFTAnnotations.ts
5284
+ import { getNodeAPIName } from "@prisma/get-platform";
5285
+ import { ClientEngineType, parseAWSNodejsRuntimeEnvVarVersion, pathToPosix as pathToPosix2 } from "@prisma/internals";
5286
+ import path from "path";
5287
+ function buildNFTAnnotations(noEngine, engineType, binaryTargets, relativeOutdir) {
5288
+ if (noEngine === true) return "";
5289
+ if (binaryTargets === void 0) {
5290
+ return "";
5291
+ }
5292
+ if (process.env.NETLIFY) {
5293
+ const isNodeMajor20OrUp = parseInt(process.versions.node.split(".")[0]) >= 20;
5294
+ const awsRuntimeVersion = parseAWSNodejsRuntimeEnvVarVersion();
5295
+ const isRuntimeEnvVar20OrUp = awsRuntimeVersion && awsRuntimeVersion >= 20;
5296
+ const isRuntimeEnvVar18OrDown = awsRuntimeVersion && awsRuntimeVersion <= 18;
5297
+ if ((isNodeMajor20OrUp || isRuntimeEnvVar20OrUp) && !isRuntimeEnvVar18OrDown) {
5298
+ binaryTargets = ["rhel-openssl-3.0.x"];
5299
+ } else {
5300
+ binaryTargets = ["rhel-openssl-1.0.x"];
5301
+ }
5302
+ }
5303
+ const engineAnnotations = binaryTargets.map((binaryTarget) => {
5304
+ const engineFilename = getQueryEngineFilename(engineType, binaryTarget);
5305
+ return engineFilename ? buildNFTAnnotation(engineFilename, relativeOutdir) : "";
5306
+ }).join("\n");
5307
+ const schemaAnnotations = buildNFTAnnotation("schema.prisma", relativeOutdir);
5308
+ return `${engineAnnotations}${schemaAnnotations}`;
5309
+ }
5310
+ function getQueryEngineFilename(engineType, binaryTarget) {
5311
+ if (engineType === ClientEngineType.Library) {
5312
+ return getNodeAPIName(binaryTarget, "fs");
5313
+ }
5314
+ if (engineType === ClientEngineType.Binary) {
5315
+ return `query-engine-${binaryTarget}`;
5316
+ }
5317
+ return void 0;
5318
+ }
5319
+ function buildNFTAnnotation(fileName, relativeOutdir) {
5320
+ const relativeFilePath = path.join(relativeOutdir, fileName);
5321
+ return `
5322
+ // file annotations for bundling tools to include these files
5323
+ path.join(__dirname, ${JSON.stringify(pathToPosix2(fileName))});
5324
+ path.join(process.cwd(), ${JSON.stringify(pathToPosix2(relativeFilePath))})`;
5325
+ }
5326
+
4581
5327
  // src/utils/buildRequirePath.ts
4582
5328
  function buildRequirePath(edge) {
4583
5329
  if (edge === true) return "";
@@ -4585,11 +5331,23 @@ function buildRequirePath(edge) {
4585
5331
  const path = require('path')`;
4586
5332
  }
4587
5333
 
5334
+ // src/utils/buildWarnEnvConflicts.ts
5335
+ function buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs) {
5336
+ if (edge === true) return "";
5337
+ return `
5338
+ const { warnEnvConflicts } = require('${runtimeBase}/${runtimeNameJs}.js')
5339
+
5340
+ warnEnvConflicts({
5341
+ rootEnvPath: config.relativeEnvPaths.rootEnvPath && path.resolve(config.dirname, config.relativeEnvPaths.rootEnvPath),
5342
+ schemaEnvPath: config.relativeEnvPaths.schemaEnvPath && path.resolve(config.dirname, config.relativeEnvPaths.schemaEnvPath)
5343
+ })`;
5344
+ }
5345
+
4588
5346
  // src/TSClient/common.ts
4589
5347
  import indent4 from "indent-string";
4590
5348
  var commonCodeJS = ({
4591
5349
  runtimeBase,
4592
- runtimeName,
5350
+ runtimeNameJs,
4593
5351
  browser,
4594
5352
  clientVersion,
4595
5353
  engineVersion,
@@ -4599,15 +5357,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4599
5357
  ${browser ? `
4600
5358
  const {
4601
5359
  Decimal,
4602
- DbNull,
4603
- JsonNull,
4604
- AnyNull,
4605
- NullTypes,
5360
+ objectEnumValues,
4606
5361
  makeStrictEnum,
4607
5362
  Public,
4608
5363
  getRuntime,
4609
5364
  skip
4610
- } = require('${runtimeBase}/${runtimeName}.js')
5365
+ } = require('${runtimeBase}/${runtimeNameJs}.js')
4611
5366
  ` : `
4612
5367
  const {
4613
5368
  PrismaClientKnownRequestError,
@@ -4623,10 +5378,7 @@ const {
4623
5378
  skip,
4624
5379
  Decimal,
4625
5380
  Debug,
4626
- DbNull,
4627
- JsonNull,
4628
- AnyNull,
4629
- NullTypes,
5381
+ objectEnumValues,
4630
5382
  makeStrictEnum,
4631
5383
  Extensions,
4632
5384
  warnOnce,
@@ -4634,7 +5386,7 @@ const {
4634
5386
  Public,
4635
5387
  getRuntime,
4636
5388
  createParam,
4637
- } = require('${runtimeBase}/${runtimeName}.js')
5389
+ } = require('${runtimeBase}/${runtimeNameJs}.js')
4638
5390
  `}
4639
5391
 
4640
5392
  const Prisma = {}
@@ -4676,11 +5428,15 @@ Prisma.defineExtension = ${notSupportOnBrowser("Extensions.defineExtension", bro
4676
5428
  /**
4677
5429
  * Shorthand utilities for JSON filtering
4678
5430
  */
4679
- Prisma.DbNull = DbNull
4680
- Prisma.JsonNull = JsonNull
4681
- Prisma.AnyNull = AnyNull
5431
+ Prisma.DbNull = objectEnumValues.instances.DbNull
5432
+ Prisma.JsonNull = objectEnumValues.instances.JsonNull
5433
+ Prisma.AnyNull = objectEnumValues.instances.AnyNull
4682
5434
 
4683
- Prisma.NullTypes = NullTypes
5435
+ Prisma.NullTypes = {
5436
+ DbNull: objectEnumValues.classes.DbNull,
5437
+ JsonNull: objectEnumValues.classes.JsonNull,
5438
+ AnyNull: objectEnumValues.classes.AnyNull
5439
+ }
4684
5440
 
4685
5441
  ${buildPrismaSkipJs(generator.previewFeatures)}
4686
5442
  `;
@@ -4696,12 +5452,12 @@ In case this error is unexpected for you, please report it in https://pris.ly/pr
4696
5452
  };
4697
5453
  var commonCodeTS = ({
4698
5454
  runtimeBase,
4699
- runtimeName,
5455
+ runtimeNameTs,
4700
5456
  clientVersion,
4701
5457
  engineVersion,
4702
5458
  generator
4703
5459
  }) => ({
4704
- tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeName}.js';
5460
+ tsWithoutNamespace: () => `import * as runtime from '${runtimeBase}/${runtimeNameTs}';
4705
5461
  import $Types = runtime.Types // general types
4706
5462
  import $Public = runtime.Types.Public
4707
5463
  import $Utils = runtime.Types.Utils
@@ -4746,6 +5502,14 @@ export import Decimal = runtime.Decimal
4746
5502
 
4747
5503
  export type DecimalJsLike = runtime.DecimalJsLike
4748
5504
 
5505
+ /**
5506
+ * Metrics
5507
+ */
5508
+ export type Metrics = runtime.Metrics
5509
+ export type Metric<T> = runtime.Metric<T>
5510
+ export type MetricHistogram = runtime.MetricHistogram
5511
+ export type MetricHistogramBucket = runtime.MetricHistogramBucket
5512
+
4749
5513
  /**
4750
5514
  * Extensions
4751
5515
  */
@@ -4762,7 +5526,6 @@ export import Exact = $Public.Exact
4762
5526
  */
4763
5527
  export type PrismaVersion = {
4764
5528
  client: string
4765
- engine: string
4766
5529
  }
4767
5530
 
4768
5531
  export const prismaVersion: PrismaVersion
@@ -5228,33 +5991,45 @@ var GenerateContext = class {
5228
5991
  dmmf;
5229
5992
  genericArgsInfo;
5230
5993
  generator;
5231
- provider;
5232
- constructor({ dmmf, genericArgsInfo, generator, provider }) {
5994
+ constructor({ dmmf, genericArgsInfo, generator }) {
5233
5995
  this.dmmf = dmmf;
5234
5996
  this.genericArgsInfo = genericArgsInfo;
5235
5997
  this.generator = generator;
5236
- this.provider = provider;
5237
5998
  }
5238
5999
  isPreviewFeatureOn(previewFeature) {
5239
6000
  return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
5240
6001
  }
5241
- isSqlProvider() {
5242
- return this.provider !== "mongodb";
5243
- }
5244
6002
  };
5245
6003
 
5246
6004
  // src/TSClient/PrismaClient.ts
5247
6005
  import { capitalize as capitalize7, uncapitalize as uncapitalize7 } from "@prisma/client-common";
5248
6006
  import { assertNever as assertNever2 } from "@prisma/internals";
5249
6007
  import * as ts11 from "@prisma/ts-builders";
5250
- import indent6 from "indent-string";
6008
+ import indent7 from "indent-string";
5251
6009
 
5252
6010
  // src/utils/runtimeImport.ts
5253
6011
  import * as ts9 from "@prisma/ts-builders";
6012
+ function runtimeImport(name) {
6013
+ return name;
6014
+ }
5254
6015
  function runtimeImportedType(name) {
5255
6016
  return ts9.namedType(`runtime.${name}`);
5256
6017
  }
5257
6018
 
6019
+ // src/TSClient/Datasources.ts
6020
+ import indent6 from "indent-string";
6021
+ var Datasources = class {
6022
+ constructor(internalDatasources) {
6023
+ this.internalDatasources = internalDatasources;
6024
+ }
6025
+ toTS() {
6026
+ const sources = this.internalDatasources;
6027
+ return `export type Datasources = {
6028
+ ${indent6(sources.map((s) => `${s.name}?: Datasource`).join("\n"), 2)}
6029
+ }`;
6030
+ }
6031
+ };
6032
+
5258
6033
  // src/TSClient/globalOmit.ts
5259
6034
  import { uncapitalize as uncapitalize6 } from "@prisma/client-common";
5260
6035
  import * as ts10 from "@prisma/ts-builders";
@@ -5435,7 +6210,7 @@ function queryRawDefinition(context) {
5435
6210
  * const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
5436
6211
  * \`\`\`
5437
6212
  *
5438
- * Read more in our [docs](https://pris.ly/d/raw-queries).
6213
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
5439
6214
  */
5440
6215
  $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
5441
6216
 
@@ -5447,7 +6222,7 @@ function queryRawDefinition(context) {
5447
6222
  * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
5448
6223
  * \`\`\`
5449
6224
  *
5450
- * Read more in our [docs](https://pris.ly/d/raw-queries).
6225
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
5451
6226
  */
5452
6227
  $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
5453
6228
  }
@@ -5463,7 +6238,7 @@ function executeRawDefinition(context) {
5463
6238
  * const result = await prisma.$executeRaw\`UPDATE User SET cool = \${true} WHERE email = \${'user@email.com'};\`
5464
6239
  * \`\`\`
5465
6240
  *
5466
- * Read more in our [docs](https://pris.ly/d/raw-queries).
6241
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
5467
6242
  */
5468
6243
  $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
5469
6244
 
@@ -5475,7 +6250,7 @@ function executeRawDefinition(context) {
5475
6250
  * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
5476
6251
  * \`\`\`
5477
6252
  *
5478
- * Read more in our [docs](https://pris.ly/d/raw-queries).
6253
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
5479
6254
  */
5480
6255
  $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
5481
6256
  }
@@ -5505,6 +6280,24 @@ function queryRawTypedDefinition(context) {
5505
6280
  ).setReturnType(prismaPromise(ts11.array(param.toArgument())));
5506
6281
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5507
6282
  }
6283
+ function metricDefinition(context) {
6284
+ if (!context.isPreviewFeatureOn("metrics")) {
6285
+ return "";
6286
+ }
6287
+ const property11 = ts11.property("$metrics", ts11.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
6288
+ ts11.docComment`
6289
+ Gives access to the client metrics in json or prometheus format.
6290
+
6291
+ @example
6292
+ \`\`\`
6293
+ const metrics = await prisma.$metrics.json()
6294
+ // or
6295
+ const metrics = await prisma.$metrics.prometheus()
6296
+ \`\`\`
6297
+ `
6298
+ ).readonly();
6299
+ return ts11.stringify(property11, { indentLevel: 1, newLine: "leading" });
6300
+ }
5508
6301
  function runCommandRawDefinition(context) {
5509
6302
  if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
5510
6303
  return "";
@@ -5520,16 +6313,32 @@ function runCommandRawDefinition(context) {
5520
6313
  })
5521
6314
  \`\`\`
5522
6315
 
5523
- Read more in our [docs](https://pris.ly/d/raw-queries).
6316
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
5524
6317
  `);
5525
6318
  return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
5526
6319
  }
5527
- var PrismaClientClass = class {
5528
- constructor(context, internalDatasources, outputDir, runtimeName, browser) {
5529
- this.context = context;
5530
- this.internalDatasources = internalDatasources;
6320
+ function applyPendingMigrationsDefinition() {
6321
+ if (this.runtimeNameTs !== "react-native") {
6322
+ return null;
6323
+ }
6324
+ const method3 = ts11.method("$applyPendingMigrations").setReturnType(promise(ts11.voidType)).setDocComment(
6325
+ ts11.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
6326
+ );
6327
+ return ts11.stringify(method3, { indentLevel: 1, newLine: "leading" });
6328
+ }
6329
+ function eventRegistrationMethodDeclaration(runtimeNameTs) {
6330
+ if (runtimeNameTs === "binary.js") {
6331
+ return `$on<V extends (U | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => $Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
6332
+ } else {
6333
+ return `$on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
6334
+ }
6335
+ }
6336
+ var PrismaClientClass = class {
6337
+ constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
6338
+ this.context = context;
6339
+ this.internalDatasources = internalDatasources;
5531
6340
  this.outputDir = outputDir;
5532
- this.runtimeName = runtimeName;
6341
+ this.runtimeNameTs = runtimeNameTs;
5533
6342
  this.browser = browser;
5534
6343
  }
5535
6344
  get jsDoc() {
@@ -5555,7 +6364,7 @@ var PrismaClientClass = class {
5555
6364
  * \`\`\`
5556
6365
  *
5557
6366
  *
5558
- * Read more in our [docs](https://pris.ly/d/client).
6367
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
5559
6368
  */`;
5560
6369
  }
5561
6370
  toTSWithoutNamespace() {
@@ -5568,10 +6377,10 @@ export class PrismaClient<
5568
6377
  > {
5569
6378
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
5570
6379
 
5571
- ${indent6(this.jsDoc, TAB_SIZE)}
6380
+ ${indent7(this.jsDoc, TAB_SIZE)}
5572
6381
 
5573
6382
  constructor(optionsArg ?: Prisma.Subset<ClientOptions, Prisma.PrismaClientOptions>);
5574
- $on<V extends U>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
6383
+ ${eventRegistrationMethodDeclaration(this.runtimeNameTs)}
5575
6384
 
5576
6385
  /**
5577
6386
  * Connect with the database
@@ -5590,10 +6399,12 @@ ${[
5590
6399
  batchingTransactionDefinition(this.context),
5591
6400
  interactiveTransactionDefinition(this.context),
5592
6401
  runCommandRawDefinition(this.context),
6402
+ metricDefinition(this.context),
6403
+ applyPendingMigrationsDefinition.bind(this)(),
5593
6404
  extendsPropertyDefinition()
5594
6405
  ].filter((d) => d !== null).join("\n").trim()}
5595
6406
 
5596
- ${indent6(
6407
+ ${indent7(
5597
6408
  dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
5598
6409
  let methodName = uncapitalize7(m.model);
5599
6410
  if (methodName === "constructor") {
@@ -5616,7 +6427,8 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
5616
6427
  }
5617
6428
  toTS() {
5618
6429
  const clientOptions = this.buildClientOptions();
5619
- return `${clientExtensionsDefinitions(this.context)}
6430
+ return `${new Datasources(this.internalDatasources).toTS()}
6431
+ ${clientExtensionsDefinitions(this.context)}
5620
6432
  export type DefaultPrismaClient = PrismaClient
5621
6433
  export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
5622
6434
  ${ts11.stringify(ts11.moduleExport(clientOptions))}
@@ -5689,6 +6501,10 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5689
6501
  }
5690
6502
  buildClientOptions() {
5691
6503
  const clientOptions = ts11.interfaceDeclaration("PrismaClientOptions").add(
6504
+ ts11.property("datasources", ts11.namedType("Datasources")).optional().setDocComment(ts11.docComment("Overwrites the datasource url from your schema.prisma file"))
6505
+ ).add(
6506
+ ts11.property("datasourceUrl", ts11.stringType).optional().setDocComment(ts11.docComment("Overwrites the datasource url from your schema.prisma file"))
6507
+ ).add(
5692
6508
  ts11.property("errorFormat", ts11.namedType("ErrorFormat")).optional().setDocComment(ts11.docComment('@default "colorless"'))
5693
6509
  ).add(
5694
6510
  ts11.property("log", ts11.array(ts11.unionType([ts11.namedType("LogLevel"), ts11.namedType("LogDefinition")]))).optional().setDocComment(ts11.docComment`
@@ -5713,7 +6529,7 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5713
6529
  { emit: 'stdout', level: 'error' }
5714
6530
  ]
5715
6531
  \`\`\`
5716
- Read more in our [docs](https://pris.ly/d/logging).
6532
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
5717
6533
  `)
5718
6534
  );
5719
6535
  const transactionOptions = ts11.objectType().add(ts11.property("maxWait", ts11.numberType).optional()).add(ts11.property("timeout", ts11.numberType).optional());
@@ -5727,23 +6543,14 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5727
6543
  timeout ?= 5000
5728
6544
  `)
5729
6545
  );
5730
- if (
5731
- // We don't support a custom adapter with MongoDB for now.
5732
- this.internalDatasources.some((d) => d.provider !== "mongodb")
5733
- ) {
6546
+ if (["library.js", "client.js"].includes(this.runtimeNameTs) && // We don't support a custom adapter with MongoDB for now.
6547
+ this.internalDatasources.some((d) => d.provider !== "mongodb")) {
5734
6548
  clientOptions.add(
5735
- ts11.property("adapter", ts11.namedType("runtime.SqlDriverAdapterFactory")).optional().setDocComment(
6549
+ ts11.property("adapter", ts11.unionType([ts11.namedType("runtime.SqlDriverAdapterFactory"), ts11.namedType("null")])).optional().setDocComment(
5736
6550
  ts11.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5737
6551
  )
5738
6552
  );
5739
6553
  }
5740
- clientOptions.add(
5741
- ts11.property("accelerateUrl", ts11.stringType).optional().setDocComment(
5742
- ts11.docComment(
5743
- "Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database."
5744
- )
5745
- )
5746
- );
5747
6554
  clientOptions.add(
5748
6555
  ts11.property("omit", ts11.namedType("Prisma.GlobalOmitConfig")).optional().setDocComment(ts11.docComment`
5749
6556
  Global configuration for omitting model fields by default.
@@ -5760,25 +6567,6 @@ export type TransactionClient = Omit<Prisma.DefaultPrismaClient, runtime.ITXClie
5760
6567
  \`\`\`
5761
6568
  `)
5762
6569
  );
5763
- if (this.context.isSqlProvider()) {
5764
- clientOptions.add(
5765
- ts11.property("comments", ts11.array(ts11.namedType("runtime.SqlCommenterPlugin"))).optional().setDocComment(ts11.docComment`
5766
- SQL commenter plugins that add metadata to SQL queries as comments.
5767
- Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
5768
-
5769
- @example
5770
- \`\`\`
5771
- const prisma = new PrismaClient({
5772
- adapter,
5773
- comments: [
5774
- traceContext(),
5775
- queryInsights(),
5776
- ],
5777
- })
5778
- \`\`\`
5779
- `)
5780
- );
5781
- }
5782
6570
  return clientOptions;
5783
6571
  }
5784
6572
  };
@@ -5793,33 +6581,61 @@ var TSClient = class {
5793
6581
  dmmf;
5794
6582
  genericsInfo;
5795
6583
  toJS() {
5796
- const { edge, wasm, generator, datamodel: inlineSchema, runtimeName, reusedJs } = this.options;
6584
+ const {
6585
+ edge,
6586
+ wasm,
6587
+ binaryPaths,
6588
+ generator,
6589
+ outputDir,
6590
+ datamodel: inlineSchema,
6591
+ runtimeBase,
6592
+ runtimeNameJs,
6593
+ datasources,
6594
+ copyEngine = true,
6595
+ reusedJs,
6596
+ envPaths
6597
+ } = this.options;
5797
6598
  if (reusedJs) {
5798
6599
  return `module.exports = { ...require('${reusedJs}') }`;
5799
6600
  }
6601
+ const relativeEnvPaths = {
6602
+ rootEnvPath: envPaths.rootEnvPath && pathToPosix3(path2.relative(outputDir, envPaths.rootEnvPath)),
6603
+ schemaEnvPath: envPaths.schemaEnvPath && pathToPosix3(path2.relative(outputDir, envPaths.schemaEnvPath))
6604
+ };
6605
+ const clientEngineType = getClientEngineType(generator);
6606
+ generator.config.engineType = clientEngineType;
6607
+ const binaryTargets = clientEngineType === ClientEngineType2.Library ? Object.keys(binaryPaths.libqueryEngine ?? {}) : Object.keys(binaryPaths.queryEngine ?? {});
6608
+ const inlineSchemaHash = crypto.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
6609
+ const datasourceFilePath = datasources[0].sourceFilePath;
5800
6610
  const config = {
5801
- previewFeatures: generator.previewFeatures,
6611
+ generator,
6612
+ relativeEnvPaths,
6613
+ relativePath: pathToPosix3(path2.relative(outputDir, path2.dirname(datasourceFilePath))),
5802
6614
  clientVersion: this.options.clientVersion,
5803
6615
  engineVersion: this.options.engineVersion,
6616
+ datasourceNames: datasources.map((d) => d.name),
5804
6617
  activeProvider: this.options.activeProvider,
5805
- inlineSchema
6618
+ postinstall: this.options.postinstall,
6619
+ ciName: ciInfo.name ?? void 0,
6620
+ inlineDatasources: buildInlineDatasources(datasources),
6621
+ inlineSchema,
6622
+ inlineSchemaHash,
6623
+ copyEngine
5806
6624
  };
6625
+ const relativeOutdir = path2.relative(process.cwd(), outputDir);
5807
6626
  const code = `${commonCodeJS({ ...this.options, browser: false })}
5808
6627
  ${buildRequirePath(edge)}
5809
6628
 
5810
6629
  /**
5811
6630
  * Enums
5812
6631
  */
5813
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toJS()).join("\n\n")}
6632
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
5814
6633
  ${this.dmmf.datamodel.enums.map((datamodelEnum) => new Enum(datamodelEnumToSchemaEnum(datamodelEnum), false).toJS()).join("\n\n")}
5815
6634
 
5816
6635
  ${new Enum(
5817
6636
  {
5818
6637
  name: "ModelName",
5819
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5820
- key: m.model,
5821
- value: m.model
5822
- }))
6638
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5823
6639
  },
5824
6640
  true
5825
6641
  ).toJS()}
@@ -5827,12 +6643,17 @@ ${new Enum(
5827
6643
  * Create the Client
5828
6644
  */
5829
6645
  const config = ${JSON.stringify(config, null, 2)}
5830
- ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeName)}
5831
- ${buildQueryCompilerWasmModule(wasm, runtimeName)}
6646
+ ${buildDirname(edge, relativeOutdir)}
6647
+ ${buildRuntimeDataModel(this.dmmf.datamodel, runtimeNameJs)}
6648
+ ${buildQueryEngineWasmModule(wasm, copyEngine, runtimeNameJs)}
6649
+ ${buildQueryCompilerWasmModule(wasm, runtimeNameJs)}
6650
+ ${buildInjectableEdgeEnv(edge, datasources)}
6651
+ ${buildWarnEnvConflicts(edge, runtimeBase, runtimeNameJs)}
5832
6652
  ${buildDebugInitialization(edge)}
5833
6653
  const PrismaClient = getPrismaClient(config)
5834
6654
  exports.PrismaClient = PrismaClient
5835
6655
  Object.assign(exports, Prisma)
6656
+ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
5836
6657
  `;
5837
6658
  return code;
5838
6659
  }
@@ -5845,14 +6666,13 @@ Object.assign(exports, Prisma)
5845
6666
  const context = new GenerateContext({
5846
6667
  dmmf: this.dmmf,
5847
6668
  genericArgsInfo: this.genericsInfo,
5848
- generator: this.options.generator,
5849
- provider: this.options.activeProvider
6669
+ generator: this.options.generator
5850
6670
  });
5851
6671
  const prismaClientClass = new PrismaClientClass(
5852
6672
  context,
5853
6673
  this.options.datasources,
5854
6674
  this.options.outputDir,
5855
- this.options.runtimeName,
6675
+ this.options.runtimeNameTs,
5856
6676
  this.options.browser
5857
6677
  );
5858
6678
  const commonCode = commonCodeTS(this.options);
@@ -5862,9 +6682,7 @@ Object.assign(exports, Prisma)
5862
6682
  }
5863
6683
  return acc;
5864
6684
  }, []);
5865
- const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map(
5866
- (type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toTS()
5867
- );
6685
+ const prismaEnums = this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5868
6686
  const modelEnums = [];
5869
6687
  const modelEnumsAliases = [];
5870
6688
  for (const datamodelEnum of this.dmmf.datamodel.enums) {
@@ -5901,15 +6719,12 @@ ${modelEnumsAliases.join("\n\n")}
5901
6719
  ${prismaClientClass.toTSWithoutNamespace()}
5902
6720
 
5903
6721
  export namespace Prisma {
5904
- ${indent7(
6722
+ ${indent8(
5905
6723
  `${commonCode.ts()}
5906
6724
  ${new Enum(
5907
6725
  {
5908
6726
  name: "ModelName",
5909
- data: this.dmmf.mappings.modelOperations.map((m) => ({
5910
- key: m.model,
5911
- value: m.model
5912
- }))
6727
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
5913
6728
  },
5914
6729
  true
5915
6730
  ).toTS()}
@@ -5986,23 +6801,20 @@ export const dmmf: runtime.BaseDMMF
5986
6801
  toBrowserJS() {
5987
6802
  const code = `${commonCodeJS({
5988
6803
  ...this.options,
5989
- runtimeName: "index-browser",
6804
+ runtimeNameJs: "index-browser",
5990
6805
  browser: true
5991
6806
  })}
5992
6807
  /**
5993
6808
  * Enums
5994
6809
  */
5995
6810
 
5996
- ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), true).toJS()).join("\n\n")}
5997
- ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum(datamodelSchemaEnumToSchemaEnum(type), false).toJS()).join("\n\n") ?? ""}
6811
+ ${this.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toJS()).join("\n\n")}
6812
+ ${this.dmmf.schema.enumTypes.model?.map((type) => new Enum(type, false).toJS()).join("\n\n") ?? ""}
5998
6813
 
5999
6814
  ${new Enum(
6000
6815
  {
6001
6816
  name: "ModelName",
6002
- data: this.dmmf.mappings.modelOperations.map((m) => ({
6003
- key: m.model,
6004
- value: m.model
6005
- }))
6817
+ values: this.dmmf.mappings.modelOperations.map((m) => m.model)
6006
6818
  },
6007
6819
  true
6008
6820
  ).toJS()}
@@ -6340,6 +7152,7 @@ function addPreamble(fileContent) {
6340
7152
  }
6341
7153
 
6342
7154
  // src/generateClient.ts
7155
+ var debug = Debug("prisma:client:generateClient");
6343
7156
  var DenylistError = class extends Error {
6344
7157
  constructor(message) {
6345
7158
  super(message);
@@ -6360,10 +7173,15 @@ async function buildClient({
6360
7173
  engineVersion,
6361
7174
  clientVersion,
6362
7175
  activeProvider,
7176
+ postinstall,
7177
+ copyEngine,
7178
+ envPaths,
6363
7179
  typedSql
6364
7180
  }) {
7181
+ const clientEngineType = getClientEngineType2(generator);
6365
7182
  const baseClientOptions = {
6366
7183
  dmmf: getPrismaClientDMMF(dmmf),
7184
+ envPaths: envPaths ?? { rootEnvPath: null, schemaEnvPath: void 0 },
6367
7185
  datasources,
6368
7186
  generator,
6369
7187
  binaryPaths,
@@ -6374,6 +7192,8 @@ async function buildClient({
6374
7192
  clientVersion,
6375
7193
  engineVersion,
6376
7194
  activeProvider,
7195
+ postinstall,
7196
+ copyEngine,
6377
7197
  datamodel,
6378
7198
  browser: false,
6379
7199
  edge: false,
@@ -6381,7 +7201,8 @@ async function buildClient({
6381
7201
  };
6382
7202
  const nodeClientOptions = {
6383
7203
  ...baseClientOptions,
6384
- runtimeName: "client"
7204
+ runtimeNameJs: getNodeRuntimeName(clientEngineType),
7205
+ runtimeNameTs: `${getNodeRuntimeName(clientEngineType)}.js`
6385
7206
  };
6386
7207
  const nodeClient = new TSClient(nodeClientOptions);
6387
7208
  const defaultClient = new TSClient({
@@ -6389,6 +7210,19 @@ async function buildClient({
6389
7210
  reusedTs: "index",
6390
7211
  reusedJs: "."
6391
7212
  });
7213
+ const edgeClient = new TSClient({
7214
+ ...baseClientOptions,
7215
+ runtimeNameJs: "edge",
7216
+ runtimeNameTs: "library.js",
7217
+ reusedTs: "default",
7218
+ edge: true
7219
+ });
7220
+ const rnTsClient = new TSClient({
7221
+ ...baseClientOptions,
7222
+ runtimeNameJs: "react-native",
7223
+ runtimeNameTs: "react-native",
7224
+ edge: true
7225
+ });
6392
7226
  const trampolineTsClient = new TSClient({
6393
7227
  ...nodeClientOptions,
6394
7228
  reusedTs: "index",
@@ -6396,9 +7230,9 @@ async function buildClient({
6396
7230
  });
6397
7231
  const exportsMapBase = {
6398
7232
  node: "./index.js",
6399
- "edge-light": "./edge.js",
6400
- workerd: "./edge.js",
6401
- worker: "./edge.js",
7233
+ "edge-light": "./wasm.js",
7234
+ workerd: "./wasm.js",
7235
+ worker: "./wasm.js",
6402
7236
  browser: "./index-browser.js",
6403
7237
  default: "./index.js"
6404
7238
  };
@@ -6422,10 +7256,7 @@ async function buildClient({
6422
7256
  ".": exportsMapDefault
6423
7257
  },
6424
7258
  version: clientVersion,
6425
- sideEffects: false,
6426
- dependencies: {
6427
- "@prisma/client-runtime-utils": clientVersion
6428
- }
7259
+ sideEffects: false
6429
7260
  };
6430
7261
  const fileMap = {};
6431
7262
  fileMap["index.js"] = JS(nodeClient);
@@ -6433,16 +7264,28 @@ async function buildClient({
6433
7264
  fileMap["default.js"] = JS(defaultClient);
6434
7265
  fileMap["default.d.ts"] = TS(defaultClient);
6435
7266
  fileMap["index-browser.js"] = BrowserJS(nodeClient);
7267
+ fileMap["edge.js"] = JS(edgeClient);
7268
+ fileMap["edge.d.ts"] = TS(edgeClient);
6436
7269
  fileMap["client.js"] = JS(defaultClient);
6437
7270
  fileMap["client.d.ts"] = TS(defaultClient);
7271
+ if (generator.previewFeatures.includes("reactNative")) {
7272
+ fileMap["react-native.js"] = JS(rnTsClient);
7273
+ fileMap["react-native.d.ts"] = TS(rnTsClient);
7274
+ }
7275
+ const usesClientEngine = clientEngineType === ClientEngineType3.Client;
6438
7276
  fileMap["default.js"] = JS(trampolineTsClient);
6439
7277
  fileMap["default.d.ts"] = TS(trampolineTsClient);
6440
- fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
6441
- fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
7278
+ if (usesClientEngine) {
7279
+ fileMap["wasm-worker-loader.mjs"] = `export default import('./query_compiler_bg.wasm')`;
7280
+ fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_compiler_bg.wasm?module')`;
7281
+ } else {
7282
+ fileMap["wasm-worker-loader.mjs"] = `export default import('./query_engine_bg.wasm')`;
7283
+ fileMap["wasm-edge-light-loader.mjs"] = `export default import('./query_engine_bg.wasm?module')`;
7284
+ }
6442
7285
  pkgJson["browser"] = "default.js";
6443
7286
  pkgJson["imports"] = {
6444
- // when `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
6445
- "#wasm-compiler-loader": {
7287
+ // when `import('#wasm-engine-loader')` or `import('#wasm-compiler-loader')` is called, it will be resolved to the correct file
7288
+ [usesClientEngine ? "#wasm-compiler-loader" : "#wasm-engine-loader"]: {
6446
7289
  // Keys reference: https://runtime-keys.proposal.wintercg.org/#keys
6447
7290
  /**
6448
7291
  * Vercel Edge Functions / Next.js Middlewares
@@ -6467,15 +7310,16 @@ async function buildClient({
6467
7310
  };
6468
7311
  const wasmClient = new TSClient({
6469
7312
  ...baseClientOptions,
6470
- runtimeName: "wasm-compiler-edge",
7313
+ runtimeNameJs: usesClientEngine ? "wasm-compiler-edge" : "wasm-engine-edge",
7314
+ runtimeNameTs: "library.js",
6471
7315
  reusedTs: "default",
6472
7316
  edge: true,
6473
7317
  wasm: true
6474
7318
  });
6475
- fileMap["edge.js"] = JS(wasmClient);
6476
- fileMap["edge.d.ts"] = TS(wasmClient);
7319
+ fileMap["wasm.js"] = JS(wasmClient);
7320
+ fileMap["wasm.d.ts"] = TS(wasmClient);
6477
7321
  if (typedSql && typedSql.length > 0) {
6478
- const edgeRuntimeName = "wasm-compiler-edge";
7322
+ const edgeRuntimeName = usesClientEngine ? "wasm-compiler-edge" : "edge";
6479
7323
  const cjsEdgeIndex = `./sql/index.${edgeRuntimeName}.js`;
6480
7324
  const esmEdgeIndex = `./sql/index.${edgeRuntimeName}.mjs`;
6481
7325
  pkgJson.exports["./sql"] = {
@@ -6500,7 +7344,7 @@ async function buildClient({
6500
7344
  fileMap["sql"] = buildTypedSql({
6501
7345
  dmmf,
6502
7346
  runtimeBase: getTypedSqlRuntimeBase(runtimeBase),
6503
- mainRuntimeName: "client",
7347
+ mainRuntimeName: getNodeRuntimeName(clientEngineType),
6504
7348
  queries: typedSql,
6505
7349
  edgeRuntimeName
6506
7350
  });
@@ -6523,11 +7367,20 @@ function getTypedSqlRuntimeBase(runtimeBase) {
6523
7367
  }
6524
7368
  return `../${runtimeBase}`;
6525
7369
  }
6526
- function getDefaultOutdir(outputDir) {
6527
- if (outputDir.endsWith(path.normalize("node_modules/@prisma/client"))) {
6528
- return path.join(outputDir, "../../.prisma/client");
7370
+ async function getDefaultOutdir(outputDir) {
7371
+ if (outputDir.endsWith(path3.normalize("node_modules/@prisma/client"))) {
7372
+ return path3.join(outputDir, "../../.prisma/client");
7373
+ }
7374
+ if (process.env.INIT_CWD && process.env.npm_lifecycle_event === "postinstall" && !process.env.PWD?.includes(".pnpm")) {
7375
+ if (existsSync(path3.join(process.env.INIT_CWD, "package.json"))) {
7376
+ return path3.join(process.env.INIT_CWD, "node_modules/.prisma/client");
7377
+ }
7378
+ const packagePath = await packageUp({ cwd: process.env.INIT_CWD });
7379
+ if (packagePath) {
7380
+ return path3.join(path3.dirname(packagePath), "node_modules/.prisma/client");
7381
+ }
6529
7382
  }
6530
- return path.join(outputDir, "../../.prisma/client");
7383
+ return path3.join(outputDir, "../../.prisma/client");
6531
7384
  }
6532
7385
  async function generateClient(options) {
6533
7386
  const {
@@ -6544,8 +7397,12 @@ async function generateClient(options) {
6544
7397
  clientVersion,
6545
7398
  engineVersion,
6546
7399
  activeProvider,
7400
+ postinstall,
7401
+ envPaths,
7402
+ copyEngine = true,
6547
7403
  typedSql
6548
7404
  } = options;
7405
+ const clientEngineType = getClientEngineType2(generator);
6549
7406
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6550
7407
  const { prismaClientDmmf, fileMap } = await buildClient({
6551
7408
  datamodel,
@@ -6560,7 +7417,10 @@ async function generateClient(options) {
6560
7417
  clientVersion,
6561
7418
  engineVersion,
6562
7419
  activeProvider,
7420
+ postinstall,
7421
+ copyEngine,
6563
7422
  testMode,
7423
+ envPaths,
6564
7424
  typedSql
6565
7425
  });
6566
7426
  const provider = datasources[0].provider;
@@ -6577,32 +7437,51 @@ async function generateClient(options) {
6577
7437
  To learn more about how to rename models, check out https://pris.ly/d/naming-models`;
6578
7438
  throw new DenylistError(message);
6579
7439
  }
7440
+ if (!copyEngine) {
7441
+ await deleteOutputDir(outputDir);
7442
+ }
6580
7443
  await (0, import_fs_extra.ensureDir)(outputDir);
6581
7444
  await writeFileMap(outputDir, fileMap);
6582
7445
  if (copyRuntime || generator.isCustomOutput === true) {
6583
- const copiedRuntimeDir = path.join(outputDir, "runtime");
7446
+ const copiedRuntimeDir = path3.join(outputDir, "runtime");
6584
7447
  await (0, import_fs_extra.ensureDir)(copiedRuntimeDir);
6585
7448
  await copyRuntimeFiles({
6586
7449
  from: runtimeSourcePath,
6587
7450
  to: copiedRuntimeDir,
6588
7451
  sourceMaps: copyRuntimeSourceMaps,
6589
- runtimeName: "client"
7452
+ runtimeName: getNodeRuntimeName(clientEngineType)
6590
7453
  });
6591
7454
  }
6592
- const schemaTargetPath = path.join(outputDir, "schema.prisma");
7455
+ const enginePath = clientEngineType === ClientEngineType3.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
7456
+ if (copyEngine && enginePath) {
7457
+ if (process.env.NETLIFY) {
7458
+ await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
7459
+ }
7460
+ for (const [binaryTarget, filePath] of Object.entries(enginePath)) {
7461
+ const fileName = path3.basename(filePath);
7462
+ let target;
7463
+ if (process.env.NETLIFY && !["rhel-openssl-1.0.x", "rhel-openssl-3.0.x"].includes(binaryTarget)) {
7464
+ target = path3.join("/tmp/prisma-engines", fileName);
7465
+ } else {
7466
+ target = path3.join(outputDir, fileName);
7467
+ }
7468
+ await overwriteFile(filePath, target);
7469
+ }
7470
+ }
7471
+ const schemaTargetPath = path3.join(outputDir, "schema.prisma");
6593
7472
  await fs.writeFile(schemaTargetPath, datamodel, { encoding: "utf-8" });
6594
- if (isWasmEngineSupported(provider)) {
7473
+ const runtimeNeedsWasmEngine = clientEngineType === ClientEngineType3.Client || copyEngine;
7474
+ if (runtimeNeedsWasmEngine && isWasmEngineSupported(provider) && !testMode) {
6595
7475
  const suffix = provider === "postgres" ? "postgresql" : provider;
6596
- const filename = "query_compiler_bg";
6597
- const wasmJsBundlePath = path.join(runtimeSourcePath, `${filename}.${suffix}.wasm-base64.js`);
7476
+ const filename = clientEngineType === ClientEngineType3.Client ? "query_compiler_bg" : "query_engine_bg";
7477
+ const wasmJsBundlePath = path3.join(runtimeSourcePath, `${filename}.${suffix}.wasm-base64.js`);
6598
7478
  const wasmBase64 = __require(wasmJsBundlePath).wasm;
6599
- await fs.writeFile(path.join(outputDir, `${filename}.wasm`), Buffer.from(wasmBase64, "base64"));
6600
- await fs.copyFile(path.join(runtimeSourcePath, `${filename}.${suffix}.js`), path.join(outputDir, `${filename}.js`));
6601
- await fs.copyFile(wasmJsBundlePath, path.join(outputDir, `${filename}.wasm-base64.js`));
7479
+ await fs.writeFile(path3.join(outputDir, `${filename}.wasm`), Buffer.from(wasmBase64, "base64"));
7480
+ await fs.copyFile(path3.join(runtimeSourcePath, `${filename}.${suffix}.js`), path3.join(outputDir, `${filename}.js`));
6602
7481
  }
6603
7482
  try {
6604
7483
  const prismaCache = paths("prisma").cache;
6605
- const signalsPath = path.join(prismaCache, "last-generate");
7484
+ const signalsPath = path3.join(prismaCache, "last-generate");
6606
7485
  await fs.mkdir(prismaCache, { recursive: true });
6607
7486
  await fs.writeFile(signalsPath, Date.now().toString());
6608
7487
  } catch {
@@ -6611,7 +7490,7 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6611
7490
  function writeFileMap(outputDir, fileMap) {
6612
7491
  return Promise.all(
6613
7492
  Object.entries(fileMap).map(async ([fileName, content]) => {
6614
- const absolutePath = path.join(outputDir, fileName);
7493
+ const absolutePath = path3.join(outputDir, fileName);
6615
7494
  await fs.rm(absolutePath, { recursive: true, force: true });
6616
7495
  if (typeof content === "string") {
6617
7496
  await fs.writeFile(absolutePath, content);
@@ -6623,7 +7502,7 @@ function writeFileMap(outputDir, fileMap) {
6623
7502
  );
6624
7503
  }
6625
7504
  function isWasmEngineSupported(provider) {
6626
- return provider === "postgresql" || provider === "postgres" || provider === "cockroachdb" || provider === "mysql" || provider === "sqlite" || provider === "sqlserver";
7505
+ return provider === "postgresql" || provider === "postgres" || provider === "mysql" || provider === "sqlite" || provider === "sqlserver";
6627
7506
  }
6628
7507
  function validateDmmfAgainstDenylists(prismaClientDmmf) {
6629
7508
  const errorArray = [];
@@ -6711,18 +7590,18 @@ async function getGenerationDirs({
6711
7590
  testMode
6712
7591
  }) {
6713
7592
  const isCustomOutput = generator.isCustomOutput === true;
6714
- const normalizedOutputDir = path.normalize(outputDir);
7593
+ const normalizedOutputDir = path3.normalize(outputDir);
6715
7594
  let userRuntimeImport = isCustomOutput ? "./runtime" : "@prisma/client/runtime";
6716
- let userOutputDir = isCustomOutput ? normalizedOutputDir : getDefaultOutdir(normalizedOutputDir);
7595
+ let userOutputDir = isCustomOutput ? normalizedOutputDir : await getDefaultOutdir(normalizedOutputDir);
6717
7596
  if (testMode && runtimeBase) {
6718
7597
  userOutputDir = outputDir;
6719
- userRuntimeImport = pathToPosix(runtimeBase);
7598
+ userRuntimeImport = pathToPosix4(runtimeBase);
6720
7599
  }
6721
7600
  if (isCustomOutput) {
6722
7601
  await verifyOutputDirectory(userOutputDir, datamodel, schemaPath);
6723
7602
  }
6724
- const userPackageRoot = await packageUp({ cwd: path.dirname(userOutputDir) });
6725
- const userProjectRoot = userPackageRoot ? path.dirname(userPackageRoot) : process.cwd();
7603
+ const userPackageRoot = await packageUp({ cwd: path3.dirname(userOutputDir) });
7604
+ const userProjectRoot = userPackageRoot ? path3.dirname(userPackageRoot) : process.cwd();
6726
7605
  return {
6727
7606
  runtimeBase: userRuntimeImport,
6728
7607
  outputDir: userOutputDir,
@@ -6732,7 +7611,7 @@ async function getGenerationDirs({
6732
7611
  async function verifyOutputDirectory(directory, datamodel, schemaPath) {
6733
7612
  let content;
6734
7613
  try {
6735
- content = await fs.readFile(path.join(directory, "package.json"), "utf8");
7614
+ content = await fs.readFile(path3.join(directory, "package.json"), "utf8");
6736
7615
  } catch (e) {
6737
7616
  if (e.code === "ENOENT") {
6738
7617
  return;
@@ -6775,17 +7654,43 @@ function findOutputPathDeclaration(datamodel) {
6775
7654
  }
6776
7655
  return null;
6777
7656
  }
7657
+ function getNodeRuntimeName(engineType) {
7658
+ if (engineType === ClientEngineType3.Binary) {
7659
+ return "binary";
7660
+ }
7661
+ if (engineType === ClientEngineType3.Library) {
7662
+ return "library";
7663
+ }
7664
+ if (engineType === ClientEngineType3.Client) {
7665
+ return "client";
7666
+ }
7667
+ assertNever3(engineType, "Unknown engine type");
7668
+ }
6778
7669
  async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
6779
- const files = ["index-browser.js", "index-browser.d.ts", "wasm-compiler-edge.js"];
7670
+ const files = [
7671
+ // library.d.ts is always included, as it contains the actual runtime type
7672
+ // definitions. Rest of the `runtime.d.ts` files just re-export everything
7673
+ // from `library.d.ts`
7674
+ "library.d.ts",
7675
+ "index-browser.js",
7676
+ "index-browser.d.ts",
7677
+ "edge.js",
7678
+ "edge-esm.js",
7679
+ "react-native.js",
7680
+ "wasm-engine-edge.js",
7681
+ "wasm-compiler-edge.js"
7682
+ ];
6780
7683
  files.push(`${runtimeName}.js`);
6781
- files.push(`${runtimeName}.d.ts`);
7684
+ if (runtimeName !== "library") {
7685
+ files.push(`${runtimeName}.d.ts`);
7686
+ }
6782
7687
  if (sourceMaps) {
6783
7688
  files.push(...files.filter((file4) => file4.endsWith(".js")).map((file4) => `${file4}.map`));
6784
7689
  }
6785
7690
  await Promise.all(
6786
7691
  files.map(async (file4) => {
6787
- const sourcePath = path.join(from, file4);
6788
- const targetPath = path.join(to, file4);
7692
+ const sourcePath = path3.join(from, file4);
7693
+ const targetPath = path3.join(to, file4);
6789
7694
  if (file4.endsWith(".js")) {
6790
7695
  const content = await fs.readFile(sourcePath, "utf-8");
6791
7696
  await fs.writeFile(targetPath, addPreamble(content));
@@ -6795,6 +7700,18 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
6795
7700
  })
6796
7701
  );
6797
7702
  }
7703
+ async function deleteOutputDir(outputDir) {
7704
+ try {
7705
+ debug(`attempting to delete ${outputDir} recursively`);
7706
+ if (__require(`${outputDir}/package.json`).name?.startsWith(GENERATED_PACKAGE_NAME_PREFIX)) {
7707
+ await fs.rmdir(outputDir, { recursive: true }).catch(() => {
7708
+ debug(`failed to delete ${outputDir} recursively`);
7709
+ });
7710
+ }
7711
+ } catch {
7712
+ debug(`failed to delete ${outputDir} recursively, not found`);
7713
+ }
7714
+ }
6798
7715
  function getUniquePackageName(datamodel) {
6799
7716
  const hash = createHash("sha256");
6800
7717
  hash.write(datamodel);
@@ -6803,23 +7720,1631 @@ function getUniquePackageName(datamodel) {
6803
7720
  var GENERATED_PACKAGE_NAME_PREFIX = "prisma-client-";
6804
7721
 
6805
7722
  // src/generator.ts
6806
- import path3 from "node:path";
7723
+ import path7 from "node:path";
7724
+ import { Debug as Debug3 } from "@prisma/debug";
6807
7725
  import { enginesVersion } from "@prisma/engines-version";
6808
- import { parseEnvValue } from "@prisma/internals";
7726
+ import { ClientEngineType as ClientEngineType4, getClientEngineType as getClientEngineType3, parseEnvValue } from "@prisma/internals";
7727
+ import { match } from "ts-pattern";
6809
7728
 
6810
7729
  // package.json
6811
- var version = "7.2.0";
7730
+ var version = "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1";
6812
7731
 
6813
7732
  // src/resolvePrismaClient.ts
6814
7733
  import fs2 from "node:fs/promises";
6815
- import path2 from "node:path";
7734
+ import path6 from "node:path";
6816
7735
  import { detect, getCommand } from "@antfu/ni";
6817
- import { Debug } from "@prisma/debug";
6818
- import { resolvePkg } from "@prisma/internals";
6819
- var debug = Debug("prisma:generator");
7736
+ import { Debug as Debug2 } from "@prisma/debug";
7737
+ import { longestCommonPathPrefix, resolvePkg } from "@prisma/internals";
7738
+
7739
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
7740
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
7741
+ import { Buffer as Buffer3 } from "node:buffer";
7742
+ import path5 from "node:path";
7743
+ import childProcess from "node:child_process";
7744
+ import process6 from "node:process";
7745
+
7746
+ // ../../node_modules/.pnpm/strip-final-newline@3.0.0/node_modules/strip-final-newline/index.js
7747
+ function stripFinalNewline(input) {
7748
+ const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
7749
+ const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
7750
+ if (input[input.length - 1] === LF) {
7751
+ input = input.slice(0, -1);
7752
+ }
7753
+ if (input[input.length - 1] === CR) {
7754
+ input = input.slice(0, -1);
7755
+ }
7756
+ return input;
7757
+ }
7758
+
7759
+ // ../../node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
7760
+ import process2 from "node:process";
7761
+ import path4 from "node:path";
7762
+ import { fileURLToPath } from "node:url";
7763
+
7764
+ // ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
7765
+ function pathKey(options = {}) {
7766
+ const {
7767
+ env = process.env,
7768
+ platform = process.platform
7769
+ } = options;
7770
+ if (platform !== "win32") {
7771
+ return "PATH";
7772
+ }
7773
+ return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
7774
+ }
7775
+
7776
+ // ../../node_modules/.pnpm/npm-run-path@5.3.0/node_modules/npm-run-path/index.js
7777
+ var npmRunPath = ({
7778
+ cwd = process2.cwd(),
7779
+ path: pathOption = process2.env[pathKey()],
7780
+ preferLocal = true,
7781
+ execPath = process2.execPath,
7782
+ addExecPath = true
7783
+ } = {}) => {
7784
+ const cwdString = cwd instanceof URL ? fileURLToPath(cwd) : cwd;
7785
+ const cwdPath = path4.resolve(cwdString);
7786
+ const result = [];
7787
+ if (preferLocal) {
7788
+ applyPreferLocal(result, cwdPath);
7789
+ }
7790
+ if (addExecPath) {
7791
+ applyExecPath(result, execPath, cwdPath);
7792
+ }
7793
+ return [...result, pathOption].join(path4.delimiter);
7794
+ };
7795
+ var applyPreferLocal = (result, cwdPath) => {
7796
+ let previous;
7797
+ while (previous !== cwdPath) {
7798
+ result.push(path4.join(cwdPath, "node_modules/.bin"));
7799
+ previous = cwdPath;
7800
+ cwdPath = path4.resolve(cwdPath, "..");
7801
+ }
7802
+ };
7803
+ var applyExecPath = (result, execPath, cwdPath) => {
7804
+ const execPathString = execPath instanceof URL ? fileURLToPath(execPath) : execPath;
7805
+ result.push(path4.resolve(cwdPath, execPathString, ".."));
7806
+ };
7807
+ var npmRunPathEnv = ({ env = process2.env, ...options } = {}) => {
7808
+ env = { ...env };
7809
+ const pathName = pathKey({ env });
7810
+ options.path = env[pathName];
7811
+ env[pathName] = npmRunPath(options);
7812
+ return env;
7813
+ };
7814
+
7815
+ // ../../node_modules/.pnpm/mimic-fn@4.0.0/node_modules/mimic-fn/index.js
7816
+ var copyProperty = (to, from, property11, ignoreNonConfigurable) => {
7817
+ if (property11 === "length" || property11 === "prototype") {
7818
+ return;
7819
+ }
7820
+ if (property11 === "arguments" || property11 === "caller") {
7821
+ return;
7822
+ }
7823
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property11);
7824
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property11);
7825
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
7826
+ return;
7827
+ }
7828
+ Object.defineProperty(to, property11, fromDescriptor);
7829
+ };
7830
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
7831
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
7832
+ };
7833
+ var changePrototype = (to, from) => {
7834
+ const fromPrototype = Object.getPrototypeOf(from);
7835
+ if (fromPrototype === Object.getPrototypeOf(to)) {
7836
+ return;
7837
+ }
7838
+ Object.setPrototypeOf(to, fromPrototype);
7839
+ };
7840
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
7841
+ ${fromBody}`;
7842
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
7843
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
7844
+ var changeToString = (to, from, name) => {
7845
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
7846
+ const newToString = wrappedToString.bind(null, withName, from.toString());
7847
+ Object.defineProperty(newToString, "name", toStringName);
7848
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
7849
+ };
7850
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
7851
+ const { name } = to;
7852
+ for (const property11 of Reflect.ownKeys(from)) {
7853
+ copyProperty(to, from, property11, ignoreNonConfigurable);
7854
+ }
7855
+ changePrototype(to, from);
7856
+ changeToString(to, from, name);
7857
+ return to;
7858
+ }
7859
+
7860
+ // ../../node_modules/.pnpm/onetime@6.0.0/node_modules/onetime/index.js
7861
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
7862
+ var onetime = (function_, options = {}) => {
7863
+ if (typeof function_ !== "function") {
7864
+ throw new TypeError("Expected a function");
7865
+ }
7866
+ let returnValue;
7867
+ let callCount = 0;
7868
+ const functionName = function_.displayName || function_.name || "<anonymous>";
7869
+ const onetime2 = function(...arguments_) {
7870
+ calledFunctions.set(onetime2, ++callCount);
7871
+ if (callCount === 1) {
7872
+ returnValue = function_.apply(this, arguments_);
7873
+ function_ = null;
7874
+ } else if (options.throw === true) {
7875
+ throw new Error(`Function \`${functionName}\` can only be called once`);
7876
+ }
7877
+ return returnValue;
7878
+ };
7879
+ mimicFunction(onetime2, function_);
7880
+ calledFunctions.set(onetime2, callCount);
7881
+ return onetime2;
7882
+ };
7883
+ onetime.callCount = (function_) => {
7884
+ if (!calledFunctions.has(function_)) {
7885
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
7886
+ }
7887
+ return calledFunctions.get(function_);
7888
+ };
7889
+ var onetime_default = onetime;
7890
+
7891
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
7892
+ import process3 from "node:process";
7893
+
7894
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
7895
+ import { constants as constants2 } from "node:os";
7896
+
7897
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/realtime.js
7898
+ var getRealtimeSignals = () => {
7899
+ const length = SIGRTMAX - SIGRTMIN + 1;
7900
+ return Array.from({ length }, getRealtimeSignal);
7901
+ };
7902
+ var getRealtimeSignal = (value, index) => ({
7903
+ name: `SIGRT${index + 1}`,
7904
+ number: SIGRTMIN + index,
7905
+ action: "terminate",
7906
+ description: "Application-specific signal (realtime)",
7907
+ standard: "posix"
7908
+ });
7909
+ var SIGRTMIN = 34;
7910
+ var SIGRTMAX = 64;
7911
+
7912
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
7913
+ import { constants } from "node:os";
7914
+
7915
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/core.js
7916
+ var SIGNALS = [
7917
+ {
7918
+ name: "SIGHUP",
7919
+ number: 1,
7920
+ action: "terminate",
7921
+ description: "Terminal closed",
7922
+ standard: "posix"
7923
+ },
7924
+ {
7925
+ name: "SIGINT",
7926
+ number: 2,
7927
+ action: "terminate",
7928
+ description: "User interruption with CTRL-C",
7929
+ standard: "ansi"
7930
+ },
7931
+ {
7932
+ name: "SIGQUIT",
7933
+ number: 3,
7934
+ action: "core",
7935
+ description: "User interruption with CTRL-\\",
7936
+ standard: "posix"
7937
+ },
7938
+ {
7939
+ name: "SIGILL",
7940
+ number: 4,
7941
+ action: "core",
7942
+ description: "Invalid machine instruction",
7943
+ standard: "ansi"
7944
+ },
7945
+ {
7946
+ name: "SIGTRAP",
7947
+ number: 5,
7948
+ action: "core",
7949
+ description: "Debugger breakpoint",
7950
+ standard: "posix"
7951
+ },
7952
+ {
7953
+ name: "SIGABRT",
7954
+ number: 6,
7955
+ action: "core",
7956
+ description: "Aborted",
7957
+ standard: "ansi"
7958
+ },
7959
+ {
7960
+ name: "SIGIOT",
7961
+ number: 6,
7962
+ action: "core",
7963
+ description: "Aborted",
7964
+ standard: "bsd"
7965
+ },
7966
+ {
7967
+ name: "SIGBUS",
7968
+ number: 7,
7969
+ action: "core",
7970
+ description: "Bus error due to misaligned, non-existing address or paging error",
7971
+ standard: "bsd"
7972
+ },
7973
+ {
7974
+ name: "SIGEMT",
7975
+ number: 7,
7976
+ action: "terminate",
7977
+ description: "Command should be emulated but is not implemented",
7978
+ standard: "other"
7979
+ },
7980
+ {
7981
+ name: "SIGFPE",
7982
+ number: 8,
7983
+ action: "core",
7984
+ description: "Floating point arithmetic error",
7985
+ standard: "ansi"
7986
+ },
7987
+ {
7988
+ name: "SIGKILL",
7989
+ number: 9,
7990
+ action: "terminate",
7991
+ description: "Forced termination",
7992
+ standard: "posix",
7993
+ forced: true
7994
+ },
7995
+ {
7996
+ name: "SIGUSR1",
7997
+ number: 10,
7998
+ action: "terminate",
7999
+ description: "Application-specific signal",
8000
+ standard: "posix"
8001
+ },
8002
+ {
8003
+ name: "SIGSEGV",
8004
+ number: 11,
8005
+ action: "core",
8006
+ description: "Segmentation fault",
8007
+ standard: "ansi"
8008
+ },
8009
+ {
8010
+ name: "SIGUSR2",
8011
+ number: 12,
8012
+ action: "terminate",
8013
+ description: "Application-specific signal",
8014
+ standard: "posix"
8015
+ },
8016
+ {
8017
+ name: "SIGPIPE",
8018
+ number: 13,
8019
+ action: "terminate",
8020
+ description: "Broken pipe or socket",
8021
+ standard: "posix"
8022
+ },
8023
+ {
8024
+ name: "SIGALRM",
8025
+ number: 14,
8026
+ action: "terminate",
8027
+ description: "Timeout or timer",
8028
+ standard: "posix"
8029
+ },
8030
+ {
8031
+ name: "SIGTERM",
8032
+ number: 15,
8033
+ action: "terminate",
8034
+ description: "Termination",
8035
+ standard: "ansi"
8036
+ },
8037
+ {
8038
+ name: "SIGSTKFLT",
8039
+ number: 16,
8040
+ action: "terminate",
8041
+ description: "Stack is empty or overflowed",
8042
+ standard: "other"
8043
+ },
8044
+ {
8045
+ name: "SIGCHLD",
8046
+ number: 17,
8047
+ action: "ignore",
8048
+ description: "Child process terminated, paused or unpaused",
8049
+ standard: "posix"
8050
+ },
8051
+ {
8052
+ name: "SIGCLD",
8053
+ number: 17,
8054
+ action: "ignore",
8055
+ description: "Child process terminated, paused or unpaused",
8056
+ standard: "other"
8057
+ },
8058
+ {
8059
+ name: "SIGCONT",
8060
+ number: 18,
8061
+ action: "unpause",
8062
+ description: "Unpaused",
8063
+ standard: "posix",
8064
+ forced: true
8065
+ },
8066
+ {
8067
+ name: "SIGSTOP",
8068
+ number: 19,
8069
+ action: "pause",
8070
+ description: "Paused",
8071
+ standard: "posix",
8072
+ forced: true
8073
+ },
8074
+ {
8075
+ name: "SIGTSTP",
8076
+ number: 20,
8077
+ action: "pause",
8078
+ description: 'Paused using CTRL-Z or "suspend"',
8079
+ standard: "posix"
8080
+ },
8081
+ {
8082
+ name: "SIGTTIN",
8083
+ number: 21,
8084
+ action: "pause",
8085
+ description: "Background process cannot read terminal input",
8086
+ standard: "posix"
8087
+ },
8088
+ {
8089
+ name: "SIGBREAK",
8090
+ number: 21,
8091
+ action: "terminate",
8092
+ description: "User interruption with CTRL-BREAK",
8093
+ standard: "other"
8094
+ },
8095
+ {
8096
+ name: "SIGTTOU",
8097
+ number: 22,
8098
+ action: "pause",
8099
+ description: "Background process cannot write to terminal output",
8100
+ standard: "posix"
8101
+ },
8102
+ {
8103
+ name: "SIGURG",
8104
+ number: 23,
8105
+ action: "ignore",
8106
+ description: "Socket received out-of-band data",
8107
+ standard: "bsd"
8108
+ },
8109
+ {
8110
+ name: "SIGXCPU",
8111
+ number: 24,
8112
+ action: "core",
8113
+ description: "Process timed out",
8114
+ standard: "bsd"
8115
+ },
8116
+ {
8117
+ name: "SIGXFSZ",
8118
+ number: 25,
8119
+ action: "core",
8120
+ description: "File too big",
8121
+ standard: "bsd"
8122
+ },
8123
+ {
8124
+ name: "SIGVTALRM",
8125
+ number: 26,
8126
+ action: "terminate",
8127
+ description: "Timeout or timer",
8128
+ standard: "bsd"
8129
+ },
8130
+ {
8131
+ name: "SIGPROF",
8132
+ number: 27,
8133
+ action: "terminate",
8134
+ description: "Timeout or timer",
8135
+ standard: "bsd"
8136
+ },
8137
+ {
8138
+ name: "SIGWINCH",
8139
+ number: 28,
8140
+ action: "ignore",
8141
+ description: "Terminal window size changed",
8142
+ standard: "bsd"
8143
+ },
8144
+ {
8145
+ name: "SIGIO",
8146
+ number: 29,
8147
+ action: "terminate",
8148
+ description: "I/O is available",
8149
+ standard: "other"
8150
+ },
8151
+ {
8152
+ name: "SIGPOLL",
8153
+ number: 29,
8154
+ action: "terminate",
8155
+ description: "Watched event",
8156
+ standard: "other"
8157
+ },
8158
+ {
8159
+ name: "SIGINFO",
8160
+ number: 29,
8161
+ action: "ignore",
8162
+ description: "Request for process information",
8163
+ standard: "other"
8164
+ },
8165
+ {
8166
+ name: "SIGPWR",
8167
+ number: 30,
8168
+ action: "terminate",
8169
+ description: "Device running out of power",
8170
+ standard: "systemv"
8171
+ },
8172
+ {
8173
+ name: "SIGSYS",
8174
+ number: 31,
8175
+ action: "core",
8176
+ description: "Invalid system call",
8177
+ standard: "other"
8178
+ },
8179
+ {
8180
+ name: "SIGUNUSED",
8181
+ number: 31,
8182
+ action: "terminate",
8183
+ description: "Invalid system call",
8184
+ standard: "other"
8185
+ }
8186
+ ];
8187
+
8188
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/signals.js
8189
+ var getSignals = () => {
8190
+ const realtimeSignals = getRealtimeSignals();
8191
+ const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
8192
+ return signals2;
8193
+ };
8194
+ var normalizeSignal = ({
8195
+ name,
8196
+ number: defaultNumber,
8197
+ description,
8198
+ action,
8199
+ forced = false,
8200
+ standard
8201
+ }) => {
8202
+ const {
8203
+ signals: { [name]: constantSignal }
8204
+ } = constants;
8205
+ const supported = constantSignal !== void 0;
8206
+ const number = supported ? constantSignal : defaultNumber;
8207
+ return { name, number, description, supported, action, forced, standard };
8208
+ };
8209
+
8210
+ // ../../node_modules/.pnpm/human-signals@5.0.0/node_modules/human-signals/build/src/main.js
8211
+ var getSignalsByName = () => {
8212
+ const signals2 = getSignals();
8213
+ return Object.fromEntries(signals2.map(getSignalByName));
8214
+ };
8215
+ var getSignalByName = ({
8216
+ name,
8217
+ number,
8218
+ description,
8219
+ supported,
8220
+ action,
8221
+ forced,
8222
+ standard
8223
+ }) => [name, { name, number, description, supported, action, forced, standard }];
8224
+ var signalsByName = getSignalsByName();
8225
+ var getSignalsByNumber = () => {
8226
+ const signals2 = getSignals();
8227
+ const length = SIGRTMAX + 1;
8228
+ const signalsA = Array.from(
8229
+ { length },
8230
+ (value, number) => getSignalByNumber(number, signals2)
8231
+ );
8232
+ return Object.assign({}, ...signalsA);
8233
+ };
8234
+ var getSignalByNumber = (number, signals2) => {
8235
+ const signal = findSignalByNumber(number, signals2);
8236
+ if (signal === void 0) {
8237
+ return {};
8238
+ }
8239
+ const { name, description, supported, action, forced, standard } = signal;
8240
+ return {
8241
+ [number]: {
8242
+ name,
8243
+ number,
8244
+ description,
8245
+ supported,
8246
+ action,
8247
+ forced,
8248
+ standard
8249
+ }
8250
+ };
8251
+ };
8252
+ var findSignalByNumber = (number, signals2) => {
8253
+ const signal = signals2.find(({ name }) => constants2.signals[name] === number);
8254
+ if (signal !== void 0) {
8255
+ return signal;
8256
+ }
8257
+ return signals2.find((signalA) => signalA.number === number);
8258
+ };
8259
+ var signalsByNumber = getSignalsByNumber();
8260
+
8261
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/error.js
8262
+ var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
8263
+ if (timedOut) {
8264
+ return `timed out after ${timeout} milliseconds`;
8265
+ }
8266
+ if (isCanceled) {
8267
+ return "was canceled";
8268
+ }
8269
+ if (errorCode !== void 0) {
8270
+ return `failed with ${errorCode}`;
8271
+ }
8272
+ if (signal !== void 0) {
8273
+ return `was killed with ${signal} (${signalDescription})`;
8274
+ }
8275
+ if (exitCode !== void 0) {
8276
+ return `failed with exit code ${exitCode}`;
8277
+ }
8278
+ return "failed";
8279
+ };
8280
+ var makeError = ({
8281
+ stdout,
8282
+ stderr,
8283
+ all,
8284
+ error,
8285
+ signal,
8286
+ exitCode,
8287
+ command,
8288
+ escapedCommand,
8289
+ timedOut,
8290
+ isCanceled,
8291
+ killed,
8292
+ parsed: { options: { timeout, cwd = process3.cwd() } }
8293
+ }) => {
8294
+ exitCode = exitCode === null ? void 0 : exitCode;
8295
+ signal = signal === null ? void 0 : signal;
8296
+ const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
8297
+ const errorCode = error && error.code;
8298
+ const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
8299
+ const execaMessage = `Command ${prefix}: ${command}`;
8300
+ const isError = Object.prototype.toString.call(error) === "[object Error]";
8301
+ const shortMessage = isError ? `${execaMessage}
8302
+ ${error.message}` : execaMessage;
8303
+ const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
8304
+ if (isError) {
8305
+ error.originalMessage = error.message;
8306
+ error.message = message;
8307
+ } else {
8308
+ error = new Error(message);
8309
+ }
8310
+ error.shortMessage = shortMessage;
8311
+ error.command = command;
8312
+ error.escapedCommand = escapedCommand;
8313
+ error.exitCode = exitCode;
8314
+ error.signal = signal;
8315
+ error.signalDescription = signalDescription;
8316
+ error.stdout = stdout;
8317
+ error.stderr = stderr;
8318
+ error.cwd = cwd;
8319
+ if (all !== void 0) {
8320
+ error.all = all;
8321
+ }
8322
+ if ("bufferedData" in error) {
8323
+ delete error.bufferedData;
8324
+ }
8325
+ error.failed = true;
8326
+ error.timedOut = Boolean(timedOut);
8327
+ error.isCanceled = isCanceled;
8328
+ error.killed = killed && !timedOut;
8329
+ return error;
8330
+ };
8331
+
8332
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stdio.js
8333
+ var aliases = ["stdin", "stdout", "stderr"];
8334
+ var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
8335
+ var normalizeStdio = (options) => {
8336
+ if (!options) {
8337
+ return;
8338
+ }
8339
+ const { stdio } = options;
8340
+ if (stdio === void 0) {
8341
+ return aliases.map((alias) => options[alias]);
8342
+ }
8343
+ if (hasAlias(options)) {
8344
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
8345
+ }
8346
+ if (typeof stdio === "string") {
8347
+ return stdio;
8348
+ }
8349
+ if (!Array.isArray(stdio)) {
8350
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
8351
+ }
8352
+ const length = Math.max(stdio.length, aliases.length);
8353
+ return Array.from({ length }, (value, index) => stdio[index]);
8354
+ };
8355
+
8356
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
8357
+ import os from "node:os";
8358
+
8359
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
8360
+ var signals = [];
8361
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
8362
+ if (process.platform !== "win32") {
8363
+ signals.push(
8364
+ "SIGALRM",
8365
+ "SIGABRT",
8366
+ "SIGVTALRM",
8367
+ "SIGXCPU",
8368
+ "SIGXFSZ",
8369
+ "SIGUSR2",
8370
+ "SIGTRAP",
8371
+ "SIGSYS",
8372
+ "SIGQUIT",
8373
+ "SIGIOT"
8374
+ // should detect profiler and enable/disable accordingly.
8375
+ // see #21
8376
+ // 'SIGPROF'
8377
+ );
8378
+ }
8379
+ if (process.platform === "linux") {
8380
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
8381
+ }
8382
+
8383
+ // ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
8384
+ var processOk = (process7) => !!process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
8385
+ var kExitEmitter = Symbol.for("signal-exit emitter");
8386
+ var global2 = globalThis;
8387
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
8388
+ var Emitter = class {
8389
+ emitted = {
8390
+ afterExit: false,
8391
+ exit: false
8392
+ };
8393
+ listeners = {
8394
+ afterExit: [],
8395
+ exit: []
8396
+ };
8397
+ count = 0;
8398
+ id = Math.random();
8399
+ constructor() {
8400
+ if (global2[kExitEmitter]) {
8401
+ return global2[kExitEmitter];
8402
+ }
8403
+ ObjectDefineProperty(global2, kExitEmitter, {
8404
+ value: this,
8405
+ writable: false,
8406
+ enumerable: false,
8407
+ configurable: false
8408
+ });
8409
+ }
8410
+ on(ev, fn) {
8411
+ this.listeners[ev].push(fn);
8412
+ }
8413
+ removeListener(ev, fn) {
8414
+ const list = this.listeners[ev];
8415
+ const i = list.indexOf(fn);
8416
+ if (i === -1) {
8417
+ return;
8418
+ }
8419
+ if (i === 0 && list.length === 1) {
8420
+ list.length = 0;
8421
+ } else {
8422
+ list.splice(i, 1);
8423
+ }
8424
+ }
8425
+ emit(ev, code, signal) {
8426
+ if (this.emitted[ev]) {
8427
+ return false;
8428
+ }
8429
+ this.emitted[ev] = true;
8430
+ let ret = false;
8431
+ for (const fn of this.listeners[ev]) {
8432
+ ret = fn(code, signal) === true || ret;
8433
+ }
8434
+ if (ev === "exit") {
8435
+ ret = this.emit("afterExit", code, signal) || ret;
8436
+ }
8437
+ return ret;
8438
+ }
8439
+ };
8440
+ var SignalExitBase = class {
8441
+ };
8442
+ var signalExitWrap = (handler) => {
8443
+ return {
8444
+ onExit(cb, opts) {
8445
+ return handler.onExit(cb, opts);
8446
+ },
8447
+ load() {
8448
+ return handler.load();
8449
+ },
8450
+ unload() {
8451
+ return handler.unload();
8452
+ }
8453
+ };
8454
+ };
8455
+ var SignalExitFallback = class extends SignalExitBase {
8456
+ onExit() {
8457
+ return () => {
8458
+ };
8459
+ }
8460
+ load() {
8461
+ }
8462
+ unload() {
8463
+ }
8464
+ };
8465
+ var SignalExit = class extends SignalExitBase {
8466
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
8467
+ // so use a supported signal instead
8468
+ /* c8 ignore start */
8469
+ #hupSig = process4.platform === "win32" ? "SIGINT" : "SIGHUP";
8470
+ /* c8 ignore stop */
8471
+ #emitter = new Emitter();
8472
+ #process;
8473
+ #originalProcessEmit;
8474
+ #originalProcessReallyExit;
8475
+ #sigListeners = {};
8476
+ #loaded = false;
8477
+ constructor(process7) {
8478
+ super();
8479
+ this.#process = process7;
8480
+ this.#sigListeners = {};
8481
+ for (const sig of signals) {
8482
+ this.#sigListeners[sig] = () => {
8483
+ const listeners = this.#process.listeners(sig);
8484
+ let { count } = this.#emitter;
8485
+ const p = process7;
8486
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
8487
+ count += p.__signal_exit_emitter__.count;
8488
+ }
8489
+ if (listeners.length === count) {
8490
+ this.unload();
8491
+ const ret = this.#emitter.emit("exit", null, sig);
8492
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
8493
+ if (!ret)
8494
+ process7.kill(process7.pid, s);
8495
+ }
8496
+ };
8497
+ }
8498
+ this.#originalProcessReallyExit = process7.reallyExit;
8499
+ this.#originalProcessEmit = process7.emit;
8500
+ }
8501
+ onExit(cb, opts) {
8502
+ if (!processOk(this.#process)) {
8503
+ return () => {
8504
+ };
8505
+ }
8506
+ if (this.#loaded === false) {
8507
+ this.load();
8508
+ }
8509
+ const ev = opts?.alwaysLast ? "afterExit" : "exit";
8510
+ this.#emitter.on(ev, cb);
8511
+ return () => {
8512
+ this.#emitter.removeListener(ev, cb);
8513
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
8514
+ this.unload();
8515
+ }
8516
+ };
8517
+ }
8518
+ load() {
8519
+ if (this.#loaded) {
8520
+ return;
8521
+ }
8522
+ this.#loaded = true;
8523
+ this.#emitter.count += 1;
8524
+ for (const sig of signals) {
8525
+ try {
8526
+ const fn = this.#sigListeners[sig];
8527
+ if (fn)
8528
+ this.#process.on(sig, fn);
8529
+ } catch (_) {
8530
+ }
8531
+ }
8532
+ this.#process.emit = (ev, ...a) => {
8533
+ return this.#processEmit(ev, ...a);
8534
+ };
8535
+ this.#process.reallyExit = (code) => {
8536
+ return this.#processReallyExit(code);
8537
+ };
8538
+ }
8539
+ unload() {
8540
+ if (!this.#loaded) {
8541
+ return;
8542
+ }
8543
+ this.#loaded = false;
8544
+ signals.forEach((sig) => {
8545
+ const listener = this.#sigListeners[sig];
8546
+ if (!listener) {
8547
+ throw new Error("Listener not defined for signal: " + sig);
8548
+ }
8549
+ try {
8550
+ this.#process.removeListener(sig, listener);
8551
+ } catch (_) {
8552
+ }
8553
+ });
8554
+ this.#process.emit = this.#originalProcessEmit;
8555
+ this.#process.reallyExit = this.#originalProcessReallyExit;
8556
+ this.#emitter.count -= 1;
8557
+ }
8558
+ #processReallyExit(code) {
8559
+ if (!processOk(this.#process)) {
8560
+ return 0;
8561
+ }
8562
+ this.#process.exitCode = code || 0;
8563
+ this.#emitter.emit("exit", this.#process.exitCode, null);
8564
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
8565
+ }
8566
+ #processEmit(ev, ...args) {
8567
+ const og = this.#originalProcessEmit;
8568
+ if (ev === "exit" && processOk(this.#process)) {
8569
+ if (typeof args[0] === "number") {
8570
+ this.#process.exitCode = args[0];
8571
+ }
8572
+ const ret = og.call(this.#process, ev, ...args);
8573
+ this.#emitter.emit("exit", this.#process.exitCode, null);
8574
+ return ret;
8575
+ } else {
8576
+ return og.call(this.#process, ev, ...args);
8577
+ }
8578
+ }
8579
+ };
8580
+ var process4 = globalThis.process;
8581
+ var {
8582
+ /**
8583
+ * Called when the process is exiting, whether via signal, explicit
8584
+ * exit, or running out of stuff to do.
8585
+ *
8586
+ * If the global process object is not suitable for instrumentation,
8587
+ * then this will be a no-op.
8588
+ *
8589
+ * Returns a function that may be used to unload signal-exit.
8590
+ */
8591
+ onExit,
8592
+ /**
8593
+ * Load the listeners. Likely you never need to call this, unless
8594
+ * doing a rather deep integration with signal-exit functionality.
8595
+ * Mostly exposed for the benefit of testing.
8596
+ *
8597
+ * @internal
8598
+ */
8599
+ load,
8600
+ /**
8601
+ * Unload the listeners. Likely you never need to call this, unless
8602
+ * doing a rather deep integration with signal-exit functionality.
8603
+ * Mostly exposed for the benefit of testing.
8604
+ *
8605
+ * @internal
8606
+ */
8607
+ unload
8608
+ } = signalExitWrap(processOk(process4) ? new SignalExit(process4) : new SignalExitFallback());
8609
+
8610
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/kill.js
8611
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
8612
+ var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
8613
+ const killResult = kill(signal);
8614
+ setKillTimeout(kill, signal, options, killResult);
8615
+ return killResult;
8616
+ };
8617
+ var setKillTimeout = (kill, signal, options, killResult) => {
8618
+ if (!shouldForceKill(signal, options, killResult)) {
8619
+ return;
8620
+ }
8621
+ const timeout = getForceKillAfterTimeout(options);
8622
+ const t = setTimeout(() => {
8623
+ kill("SIGKILL");
8624
+ }, timeout);
8625
+ if (t.unref) {
8626
+ t.unref();
8627
+ }
8628
+ };
8629
+ var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
8630
+ var isSigterm = (signal) => signal === os.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
8631
+ var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
8632
+ if (forceKillAfterTimeout === true) {
8633
+ return DEFAULT_FORCE_KILL_TIMEOUT;
8634
+ }
8635
+ if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
8636
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
8637
+ }
8638
+ return forceKillAfterTimeout;
8639
+ };
8640
+ var spawnedCancel = (spawned, context) => {
8641
+ const killResult = spawned.kill();
8642
+ if (killResult) {
8643
+ context.isCanceled = true;
8644
+ }
8645
+ };
8646
+ var timeoutKill = (spawned, signal, reject) => {
8647
+ spawned.kill(signal);
8648
+ reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
8649
+ };
8650
+ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
8651
+ if (timeout === 0 || timeout === void 0) {
8652
+ return spawnedPromise;
8653
+ }
8654
+ let timeoutId;
8655
+ const timeoutPromise = new Promise((resolve, reject) => {
8656
+ timeoutId = setTimeout(() => {
8657
+ timeoutKill(spawned, killSignal, reject);
8658
+ }, timeout);
8659
+ });
8660
+ const safeSpawnedPromise = spawnedPromise.finally(() => {
8661
+ clearTimeout(timeoutId);
8662
+ });
8663
+ return Promise.race([timeoutPromise, safeSpawnedPromise]);
8664
+ };
8665
+ var validateTimeout = ({ timeout }) => {
8666
+ if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
8667
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
8668
+ }
8669
+ };
8670
+ var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
8671
+ if (!cleanup || detached) {
8672
+ return timedPromise;
8673
+ }
8674
+ const removeExitHandler = onExit(() => {
8675
+ spawned.kill();
8676
+ });
8677
+ return timedPromise.finally(() => {
8678
+ removeExitHandler();
8679
+ });
8680
+ };
8681
+
8682
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
8683
+ import { createWriteStream } from "node:fs";
8684
+ import { ChildProcess } from "node:child_process";
8685
+
8686
+ // ../../node_modules/.pnpm/is-stream@3.0.0/node_modules/is-stream/index.js
8687
+ function isStream(stream) {
8688
+ return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
8689
+ }
8690
+ function isWritableStream(stream) {
8691
+ return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
8692
+ }
8693
+
8694
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/pipe.js
8695
+ var isExecaChildProcess = (target) => target instanceof ChildProcess && typeof target.then === "function";
8696
+ var pipeToTarget = (spawned, streamName, target) => {
8697
+ if (typeof target === "string") {
8698
+ spawned[streamName].pipe(createWriteStream(target));
8699
+ return spawned;
8700
+ }
8701
+ if (isWritableStream(target)) {
8702
+ spawned[streamName].pipe(target);
8703
+ return spawned;
8704
+ }
8705
+ if (!isExecaChildProcess(target)) {
8706
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
8707
+ }
8708
+ if (!isWritableStream(target.stdin)) {
8709
+ throw new TypeError("The target child process's stdin must be available.");
8710
+ }
8711
+ spawned[streamName].pipe(target.stdin);
8712
+ return target;
8713
+ };
8714
+ var addPipeMethods = (spawned) => {
8715
+ if (spawned.stdout !== null) {
8716
+ spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
8717
+ }
8718
+ if (spawned.stderr !== null) {
8719
+ spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
8720
+ }
8721
+ if (spawned.all !== void 0) {
8722
+ spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
8723
+ }
8724
+ };
8725
+
8726
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
8727
+ import { createReadStream, readFileSync } from "node:fs";
8728
+ import { setTimeout as setTimeout2 } from "node:timers/promises";
8729
+
8730
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/contents.js
8731
+ var getStreamContents = async (stream, { init: init2, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
8732
+ if (!isAsyncIterable(stream)) {
8733
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
8734
+ }
8735
+ const state = init2();
8736
+ state.length = 0;
8737
+ try {
8738
+ for await (const chunk of stream) {
8739
+ const chunkType = getChunkType(chunk);
8740
+ const convertedChunk = convertChunk[chunkType](chunk, state);
8741
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
8742
+ }
8743
+ appendFinalChunk({ state, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer });
8744
+ return finalize(state);
8745
+ } catch (error) {
8746
+ error.bufferedData = finalize(state);
8747
+ throw error;
8748
+ }
8749
+ };
8750
+ var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
8751
+ const convertedChunk = getFinalChunk(state);
8752
+ if (convertedChunk !== void 0) {
8753
+ appendChunk({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer });
8754
+ }
8755
+ };
8756
+ var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
8757
+ const chunkSize = getSize(convertedChunk);
8758
+ const newLength = state.length + chunkSize;
8759
+ if (newLength <= maxBuffer) {
8760
+ addNewChunk(convertedChunk, state, addChunk, newLength);
8761
+ return;
8762
+ }
8763
+ const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
8764
+ if (truncatedChunk !== void 0) {
8765
+ addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
8766
+ }
8767
+ throw new MaxBufferError();
8768
+ };
8769
+ var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
8770
+ state.contents = addChunk(convertedChunk, state, newLength);
8771
+ state.length = newLength;
8772
+ };
8773
+ var isAsyncIterable = (stream) => typeof stream === "object" && stream !== null && typeof stream[Symbol.asyncIterator] === "function";
8774
+ var getChunkType = (chunk) => {
8775
+ const typeOfChunk = typeof chunk;
8776
+ if (typeOfChunk === "string") {
8777
+ return "string";
8778
+ }
8779
+ if (typeOfChunk !== "object" || chunk === null) {
8780
+ return "others";
8781
+ }
8782
+ if (globalThis.Buffer?.isBuffer(chunk)) {
8783
+ return "buffer";
8784
+ }
8785
+ const prototypeName = objectToString.call(chunk);
8786
+ if (prototypeName === "[object ArrayBuffer]") {
8787
+ return "arrayBuffer";
8788
+ }
8789
+ if (prototypeName === "[object DataView]") {
8790
+ return "dataView";
8791
+ }
8792
+ if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString.call(chunk.buffer) === "[object ArrayBuffer]") {
8793
+ return "typedArray";
8794
+ }
8795
+ return "others";
8796
+ };
8797
+ var { toString: objectToString } = Object.prototype;
8798
+ var MaxBufferError = class extends Error {
8799
+ name = "MaxBufferError";
8800
+ constructor() {
8801
+ super("maxBuffer exceeded");
8802
+ }
8803
+ };
8804
+
8805
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/utils.js
8806
+ var identity = (value) => value;
8807
+ var noop = () => void 0;
8808
+ var getContentsProp = ({ contents }) => contents;
8809
+ var throwObjectStream = (chunk) => {
8810
+ throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
8811
+ };
8812
+ var getLengthProp = (convertedChunk) => convertedChunk.length;
8813
+
8814
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/array-buffer.js
8815
+ async function getStreamAsArrayBuffer(stream, options) {
8816
+ return getStreamContents(stream, arrayBufferMethods, options);
8817
+ }
8818
+ var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
8819
+ var useTextEncoder = (chunk) => textEncoder.encode(chunk);
8820
+ var textEncoder = new TextEncoder();
8821
+ var useUint8Array = (chunk) => new Uint8Array(chunk);
8822
+ var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
8823
+ var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
8824
+ var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
8825
+ const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
8826
+ new Uint8Array(newContents).set(convertedChunk, previousLength);
8827
+ return newContents;
8828
+ };
8829
+ var resizeArrayBufferSlow = (contents, length) => {
8830
+ if (length <= contents.byteLength) {
8831
+ return contents;
8832
+ }
8833
+ const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
8834
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
8835
+ return arrayBuffer;
8836
+ };
8837
+ var resizeArrayBuffer = (contents, length) => {
8838
+ if (length <= contents.maxByteLength) {
8839
+ contents.resize(length);
8840
+ return contents;
8841
+ }
8842
+ const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
8843
+ new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
8844
+ return arrayBuffer;
8845
+ };
8846
+ var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
8847
+ var SCALE_FACTOR = 2;
8848
+ var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
8849
+ var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
8850
+ var arrayBufferMethods = {
8851
+ init: initArrayBuffer,
8852
+ convertChunk: {
8853
+ string: useTextEncoder,
8854
+ buffer: useUint8Array,
8855
+ arrayBuffer: useUint8Array,
8856
+ dataView: useUint8ArrayWithOffset,
8857
+ typedArray: useUint8ArrayWithOffset,
8858
+ others: throwObjectStream
8859
+ },
8860
+ getSize: getLengthProp,
8861
+ truncateChunk: truncateArrayBufferChunk,
8862
+ addChunk: addArrayBufferChunk,
8863
+ getFinalChunk: noop,
8864
+ finalize: finalizeArrayBuffer
8865
+ };
8866
+
8867
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/buffer.js
8868
+ async function getStreamAsBuffer(stream, options) {
8869
+ if (!("Buffer" in globalThis)) {
8870
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
8871
+ }
8872
+ try {
8873
+ return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
8874
+ } catch (error) {
8875
+ if (error.bufferedData !== void 0) {
8876
+ error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
8877
+ }
8878
+ throw error;
8879
+ }
8880
+ }
8881
+ var arrayBufferToNodeBuffer = (arrayBuffer) => globalThis.Buffer.from(arrayBuffer);
8882
+
8883
+ // ../../node_modules/.pnpm/get-stream@8.0.1/node_modules/get-stream/source/string.js
8884
+ async function getStreamAsString(stream, options) {
8885
+ return getStreamContents(stream, stringMethods, options);
8886
+ }
8887
+ var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
8888
+ var useTextDecoder = (chunk, { textDecoder }) => textDecoder.decode(chunk, { stream: true });
8889
+ var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
8890
+ var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
8891
+ var getFinalStringChunk = ({ textDecoder }) => {
8892
+ const finalChunk = textDecoder.decode();
8893
+ return finalChunk === "" ? void 0 : finalChunk;
8894
+ };
8895
+ var stringMethods = {
8896
+ init: initString,
8897
+ convertChunk: {
8898
+ string: identity,
8899
+ buffer: useTextDecoder,
8900
+ arrayBuffer: useTextDecoder,
8901
+ dataView: useTextDecoder,
8902
+ typedArray: useTextDecoder,
8903
+ others: throwObjectStream
8904
+ },
8905
+ getSize: getLengthProp,
8906
+ truncateChunk: truncateStringChunk,
8907
+ addChunk: addStringChunk,
8908
+ getFinalChunk: getFinalStringChunk,
8909
+ finalize: getContentsProp
8910
+ };
8911
+
8912
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/stream.js
8913
+ var import_merge_stream = __toESM(require_merge_stream(), 1);
8914
+ var validateInputOptions = (input) => {
8915
+ if (input !== void 0) {
8916
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
8917
+ }
8918
+ };
8919
+ var getInputSync = ({ input, inputFile }) => {
8920
+ if (typeof inputFile !== "string") {
8921
+ return input;
8922
+ }
8923
+ validateInputOptions(input);
8924
+ return readFileSync(inputFile);
8925
+ };
8926
+ var handleInputSync = (options) => {
8927
+ const input = getInputSync(options);
8928
+ if (isStream(input)) {
8929
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
8930
+ }
8931
+ return input;
8932
+ };
8933
+ var getInput = ({ input, inputFile }) => {
8934
+ if (typeof inputFile !== "string") {
8935
+ return input;
8936
+ }
8937
+ validateInputOptions(input);
8938
+ return createReadStream(inputFile);
8939
+ };
8940
+ var handleInput = (spawned, options) => {
8941
+ const input = getInput(options);
8942
+ if (input === void 0) {
8943
+ return;
8944
+ }
8945
+ if (isStream(input)) {
8946
+ input.pipe(spawned.stdin);
8947
+ } else {
8948
+ spawned.stdin.end(input);
8949
+ }
8950
+ };
8951
+ var makeAllStream = (spawned, { all }) => {
8952
+ if (!all || !spawned.stdout && !spawned.stderr) {
8953
+ return;
8954
+ }
8955
+ const mixed = (0, import_merge_stream.default)();
8956
+ if (spawned.stdout) {
8957
+ mixed.add(spawned.stdout);
8958
+ }
8959
+ if (spawned.stderr) {
8960
+ mixed.add(spawned.stderr);
8961
+ }
8962
+ return mixed;
8963
+ };
8964
+ var getBufferedData = async (stream, streamPromise) => {
8965
+ if (!stream || streamPromise === void 0) {
8966
+ return;
8967
+ }
8968
+ await setTimeout2(0);
8969
+ stream.destroy();
8970
+ try {
8971
+ return await streamPromise;
8972
+ } catch (error) {
8973
+ return error.bufferedData;
8974
+ }
8975
+ };
8976
+ var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
8977
+ if (!stream || !buffer) {
8978
+ return;
8979
+ }
8980
+ if (encoding === "utf8" || encoding === "utf-8") {
8981
+ return getStreamAsString(stream, { maxBuffer });
8982
+ }
8983
+ if (encoding === null || encoding === "buffer") {
8984
+ return getStreamAsBuffer(stream, { maxBuffer });
8985
+ }
8986
+ return applyEncoding(stream, maxBuffer, encoding);
8987
+ };
8988
+ var applyEncoding = async (stream, maxBuffer, encoding) => {
8989
+ const buffer = await getStreamAsBuffer(stream, { maxBuffer });
8990
+ return buffer.toString(encoding);
8991
+ };
8992
+ var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
8993
+ const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
8994
+ const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
8995
+ const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
8996
+ try {
8997
+ return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
8998
+ } catch (error) {
8999
+ return Promise.all([
9000
+ { error, signal: error.signal, timedOut: error.timedOut },
9001
+ getBufferedData(stdout, stdoutPromise),
9002
+ getBufferedData(stderr, stderrPromise),
9003
+ getBufferedData(all, allPromise)
9004
+ ]);
9005
+ }
9006
+ };
9007
+
9008
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/promise.js
9009
+ var nativePromisePrototype = (async () => {
9010
+ })().constructor.prototype;
9011
+ var descriptors = ["then", "catch", "finally"].map((property11) => [
9012
+ property11,
9013
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property11)
9014
+ ]);
9015
+ var mergePromise = (spawned, promise2) => {
9016
+ for (const [property11, descriptor] of descriptors) {
9017
+ const value = typeof promise2 === "function" ? (...args) => Reflect.apply(descriptor.value, promise2(), args) : descriptor.value.bind(promise2);
9018
+ Reflect.defineProperty(spawned, property11, { ...descriptor, value });
9019
+ }
9020
+ };
9021
+ var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
9022
+ spawned.on("exit", (exitCode, signal) => {
9023
+ resolve({ exitCode, signal });
9024
+ });
9025
+ spawned.on("error", (error) => {
9026
+ reject(error);
9027
+ });
9028
+ if (spawned.stdin) {
9029
+ spawned.stdin.on("error", (error) => {
9030
+ reject(error);
9031
+ });
9032
+ }
9033
+ });
9034
+
9035
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/command.js
9036
+ import { Buffer as Buffer2 } from "node:buffer";
9037
+ import { ChildProcess as ChildProcess2 } from "node:child_process";
9038
+ var normalizeArgs = (file4, args = []) => {
9039
+ if (!Array.isArray(args)) {
9040
+ return [file4];
9041
+ }
9042
+ return [file4, ...args];
9043
+ };
9044
+ var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
9045
+ var escapeArg = (arg) => {
9046
+ if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
9047
+ return arg;
9048
+ }
9049
+ return `"${arg.replaceAll('"', '\\"')}"`;
9050
+ };
9051
+ var joinCommand = (file4, args) => normalizeArgs(file4, args).join(" ");
9052
+ var getEscapedCommand = (file4, args) => normalizeArgs(file4, args).map((arg) => escapeArg(arg)).join(" ");
9053
+ var SPACES_REGEXP = / +/g;
9054
+ var parseCommand = (command) => {
9055
+ const tokens = [];
9056
+ for (const token of command.trim().split(SPACES_REGEXP)) {
9057
+ const previousToken = tokens.at(-1);
9058
+ if (previousToken && previousToken.endsWith("\\")) {
9059
+ tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
9060
+ } else {
9061
+ tokens.push(token);
9062
+ }
9063
+ }
9064
+ return tokens;
9065
+ };
9066
+ var parseExpression = (expression) => {
9067
+ const typeOfExpression = typeof expression;
9068
+ if (typeOfExpression === "string") {
9069
+ return expression;
9070
+ }
9071
+ if (typeOfExpression === "number") {
9072
+ return String(expression);
9073
+ }
9074
+ if (typeOfExpression === "object" && expression !== null && !(expression instanceof ChildProcess2) && "stdout" in expression) {
9075
+ const typeOfStdout = typeof expression.stdout;
9076
+ if (typeOfStdout === "string") {
9077
+ return expression.stdout;
9078
+ }
9079
+ if (Buffer2.isBuffer(expression.stdout)) {
9080
+ return expression.stdout.toString();
9081
+ }
9082
+ throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
9083
+ }
9084
+ throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
9085
+ };
9086
+ var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
9087
+ ...tokens.slice(0, -1),
9088
+ `${tokens.at(-1)}${nextTokens[0]}`,
9089
+ ...nextTokens.slice(1)
9090
+ ];
9091
+ var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
9092
+ const templateString = template ?? templates.raw[index];
9093
+ const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
9094
+ const newTokens = concatTokens(
9095
+ tokens,
9096
+ templateTokens,
9097
+ templateString.startsWith(" ")
9098
+ );
9099
+ if (index === expressions.length) {
9100
+ return newTokens;
9101
+ }
9102
+ const expression = expressions[index];
9103
+ const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
9104
+ return concatTokens(
9105
+ newTokens,
9106
+ expressionTokens,
9107
+ templateString.endsWith(" ")
9108
+ );
9109
+ };
9110
+ var parseTemplates = (templates, expressions) => {
9111
+ let tokens = [];
9112
+ for (const [index, template] of templates.entries()) {
9113
+ tokens = parseTemplate({ templates, expressions, tokens, index, template });
9114
+ }
9115
+ return tokens;
9116
+ };
9117
+
9118
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/lib/verbose.js
9119
+ import { debuglog } from "node:util";
9120
+ import process5 from "node:process";
9121
+ var verboseDefault = debuglog("execa").enabled;
9122
+ var padField = (field, padding) => String(field).padStart(padding, "0");
9123
+ var getTimestamp = () => {
9124
+ const date2 = /* @__PURE__ */ new Date();
9125
+ return `${padField(date2.getHours(), 2)}:${padField(date2.getMinutes(), 2)}:${padField(date2.getSeconds(), 2)}.${padField(date2.getMilliseconds(), 3)}`;
9126
+ };
9127
+ var logCommand = (escapedCommand, { verbose }) => {
9128
+ if (!verbose) {
9129
+ return;
9130
+ }
9131
+ process5.stderr.write(`[${getTimestamp()}] ${escapedCommand}
9132
+ `);
9133
+ };
9134
+
9135
+ // ../../node_modules/.pnpm/execa@8.0.1/node_modules/execa/index.js
9136
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
9137
+ var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
9138
+ const env = extendEnv ? { ...process6.env, ...envOption } : envOption;
9139
+ if (preferLocal) {
9140
+ return npmRunPathEnv({ env, cwd: localDir, execPath });
9141
+ }
9142
+ return env;
9143
+ };
9144
+ var handleArguments = (file4, args, options = {}) => {
9145
+ const parsed = import_cross_spawn.default._parse(file4, args, options);
9146
+ file4 = parsed.command;
9147
+ args = parsed.args;
9148
+ options = parsed.options;
9149
+ options = {
9150
+ maxBuffer: DEFAULT_MAX_BUFFER,
9151
+ buffer: true,
9152
+ stripFinalNewline: true,
9153
+ extendEnv: true,
9154
+ preferLocal: false,
9155
+ localDir: options.cwd || process6.cwd(),
9156
+ execPath: process6.execPath,
9157
+ encoding: "utf8",
9158
+ reject: true,
9159
+ cleanup: true,
9160
+ all: false,
9161
+ windowsHide: true,
9162
+ verbose: verboseDefault,
9163
+ ...options
9164
+ };
9165
+ options.env = getEnv(options);
9166
+ options.stdio = normalizeStdio(options);
9167
+ if (process6.platform === "win32" && path5.basename(file4, ".exe") === "cmd") {
9168
+ args.unshift("/q");
9169
+ }
9170
+ return { file: file4, args, options, parsed };
9171
+ };
9172
+ var handleOutput = (options, value, error) => {
9173
+ if (typeof value !== "string" && !Buffer3.isBuffer(value)) {
9174
+ return error === void 0 ? void 0 : "";
9175
+ }
9176
+ if (options.stripFinalNewline) {
9177
+ return stripFinalNewline(value);
9178
+ }
9179
+ return value;
9180
+ };
9181
+ function execa(file4, args, options) {
9182
+ const parsed = handleArguments(file4, args, options);
9183
+ const command = joinCommand(file4, args);
9184
+ const escapedCommand = getEscapedCommand(file4, args);
9185
+ logCommand(escapedCommand, parsed.options);
9186
+ validateTimeout(parsed.options);
9187
+ let spawned;
9188
+ try {
9189
+ spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
9190
+ } catch (error) {
9191
+ const dummySpawned = new childProcess.ChildProcess();
9192
+ const errorPromise = Promise.reject(makeError({
9193
+ error,
9194
+ stdout: "",
9195
+ stderr: "",
9196
+ all: "",
9197
+ command,
9198
+ escapedCommand,
9199
+ parsed,
9200
+ timedOut: false,
9201
+ isCanceled: false,
9202
+ killed: false
9203
+ }));
9204
+ mergePromise(dummySpawned, errorPromise);
9205
+ return dummySpawned;
9206
+ }
9207
+ const spawnedPromise = getSpawnedPromise(spawned);
9208
+ const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
9209
+ const processDone = setExitHandler(spawned, parsed.options, timedPromise);
9210
+ const context = { isCanceled: false };
9211
+ spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
9212
+ spawned.cancel = spawnedCancel.bind(null, spawned, context);
9213
+ const handlePromise = async () => {
9214
+ const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
9215
+ const stdout = handleOutput(parsed.options, stdoutResult);
9216
+ const stderr = handleOutput(parsed.options, stderrResult);
9217
+ const all = handleOutput(parsed.options, allResult);
9218
+ if (error || exitCode !== 0 || signal !== null) {
9219
+ const returnedError = makeError({
9220
+ error,
9221
+ exitCode,
9222
+ signal,
9223
+ stdout,
9224
+ stderr,
9225
+ all,
9226
+ command,
9227
+ escapedCommand,
9228
+ parsed,
9229
+ timedOut,
9230
+ isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
9231
+ killed: spawned.killed
9232
+ });
9233
+ if (!parsed.options.reject) {
9234
+ return returnedError;
9235
+ }
9236
+ throw returnedError;
9237
+ }
9238
+ return {
9239
+ command,
9240
+ escapedCommand,
9241
+ exitCode: 0,
9242
+ stdout,
9243
+ stderr,
9244
+ all,
9245
+ failed: false,
9246
+ timedOut: false,
9247
+ isCanceled: false,
9248
+ killed: false
9249
+ };
9250
+ };
9251
+ const handlePromiseOnce = onetime_default(handlePromise);
9252
+ handleInput(spawned, parsed.options);
9253
+ spawned.all = makeAllStream(spawned, parsed.options);
9254
+ addPipeMethods(spawned);
9255
+ mergePromise(spawned, handlePromiseOnce);
9256
+ return spawned;
9257
+ }
9258
+ function execaSync(file4, args, options) {
9259
+ const parsed = handleArguments(file4, args, options);
9260
+ const command = joinCommand(file4, args);
9261
+ const escapedCommand = getEscapedCommand(file4, args);
9262
+ logCommand(escapedCommand, parsed.options);
9263
+ const input = handleInputSync(parsed.options);
9264
+ let result;
9265
+ try {
9266
+ result = childProcess.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
9267
+ } catch (error) {
9268
+ throw makeError({
9269
+ error,
9270
+ stdout: "",
9271
+ stderr: "",
9272
+ all: "",
9273
+ command,
9274
+ escapedCommand,
9275
+ parsed,
9276
+ timedOut: false,
9277
+ isCanceled: false,
9278
+ killed: false
9279
+ });
9280
+ }
9281
+ const stdout = handleOutput(parsed.options, result.stdout, result.error);
9282
+ const stderr = handleOutput(parsed.options, result.stderr, result.error);
9283
+ if (result.error || result.status !== 0 || result.signal !== null) {
9284
+ const error = makeError({
9285
+ stdout,
9286
+ stderr,
9287
+ error: result.error,
9288
+ signal: result.signal,
9289
+ exitCode: result.status,
9290
+ command,
9291
+ escapedCommand,
9292
+ parsed,
9293
+ timedOut: result.error && result.error.code === "ETIMEDOUT",
9294
+ isCanceled: false,
9295
+ killed: result.signal !== null
9296
+ });
9297
+ if (!parsed.options.reject) {
9298
+ return error;
9299
+ }
9300
+ throw error;
9301
+ }
9302
+ return {
9303
+ command,
9304
+ escapedCommand,
9305
+ exitCode: 0,
9306
+ stdout,
9307
+ stderr,
9308
+ failed: false,
9309
+ timedOut: false,
9310
+ isCanceled: false,
9311
+ killed: false
9312
+ };
9313
+ }
9314
+ var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
9315
+ var normalizeScriptOptions = (options = {}) => ({
9316
+ preferLocal: true,
9317
+ ...normalizeScriptStdin(options),
9318
+ ...options
9319
+ });
9320
+ function create$(options) {
9321
+ function $3(templatesOrOptions, ...expressions) {
9322
+ if (!Array.isArray(templatesOrOptions)) {
9323
+ return create$({ ...options, ...templatesOrOptions });
9324
+ }
9325
+ const [file4, ...args] = parseTemplates(templatesOrOptions, expressions);
9326
+ return execa(file4, args, normalizeScriptOptions(options));
9327
+ }
9328
+ $3.sync = (templates, ...expressions) => {
9329
+ if (!Array.isArray(templates)) {
9330
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
9331
+ }
9332
+ const [file4, ...args] = parseTemplates(templates, expressions);
9333
+ return execaSync(file4, args, normalizeScriptOptions(options));
9334
+ };
9335
+ return $3;
9336
+ }
9337
+ var $2 = create$();
9338
+ function execaCommand(command, options) {
9339
+ const [file4, ...args] = parseCommand(command);
9340
+ return execa(file4, args, options);
9341
+ }
9342
+
9343
+ // src/resolvePrismaClient.ts
9344
+ var debug2 = Debug2("prisma:generator");
6820
9345
  async function resolvePrismaClient(baseDir) {
6821
9346
  const prismaClientDir = await findPrismaClientDir(baseDir);
6822
- debug("baseDir", baseDir);
9347
+ debug2("baseDir", baseDir);
6823
9348
  if (!prismaClientDir) {
6824
9349
  throw new Error(
6825
9350
  `Could not resolve @prisma/client.
@@ -6830,16 +9355,83 @@ Please try to install it with ${bold(
6830
9355
  }
6831
9356
  return prismaClientDir;
6832
9357
  }
9358
+ async function resolveOrInstallPrismaClient(baseDir, version2) {
9359
+ let prismaClientDir = await findPrismaClientDir(baseDir);
9360
+ debug2("baseDir", baseDir);
9361
+ if (prismaClientDir) {
9362
+ return prismaClientDir;
9363
+ }
9364
+ let projectRoot = longestCommonPathPrefix(baseDir, process.cwd());
9365
+ debug2("projectRoot", projectRoot);
9366
+ const warningTag = `${bold("Warning:")} ${dim("[Prisma auto-install on generate]")}`;
9367
+ if (projectRoot === void 0) {
9368
+ console.warn(
9369
+ yellow(
9370
+ `${warningTag} The Prisma schema directory ${bold(baseDir)} and the current working directory ${bold(
9371
+ process.cwd()
9372
+ )} have no common ancestor. The Prisma schema directory will be used as the project root.`
9373
+ )
9374
+ );
9375
+ projectRoot = baseDir;
9376
+ }
9377
+ try {
9378
+ await fs2.stat(path6.join(projectRoot, "package.json"));
9379
+ } catch (err) {
9380
+ if (err.code === "ENOENT") {
9381
+ console.warn(
9382
+ yellow(
9383
+ `${warningTag} Prisma could not find a ${bold("package.json")} file in the inferred project root ${bold(
9384
+ projectRoot
9385
+ )}. During the next step, when an auto-install of Prisma package(s) will be attempted, it will then be created by your package manager on the appropriate level if necessary.`
9386
+ )
9387
+ );
9388
+ } else {
9389
+ throw err;
9390
+ }
9391
+ }
9392
+ const prismaCliDir = await resolvePkg("prisma", { basedir: baseDir });
9393
+ if (process.platform === "win32" && await isYarnUsed(baseDir)) {
9394
+ const hasCli = (s) => prismaCliDir !== void 0 ? s : "";
9395
+ const missingCli = (s) => prismaCliDir === void 0 ? s : "";
9396
+ throw new Error(
9397
+ `Could not resolve ${missingCli(`${bold("prisma")} and `)}${bold(
9398
+ "@prisma/client"
9399
+ )} in the current project. Please install ${hasCli("it")}${missingCli("them")} with ${missingCli(
9400
+ `${bold(green(`${await getPackageCmd(baseDir, "add", "prisma", "-D")}`))} and `
9401
+ )}${bold(green(`${await getPackageCmd(baseDir, "add", "@prisma/client")}`))}, and rerun ${bold(
9402
+ await getPackageCmd(baseDir, "execute", "prisma generate")
9403
+ )} \u{1F64F}.`
9404
+ );
9405
+ }
9406
+ if (!prismaCliDir) {
9407
+ await runPackageCmd(projectRoot, "add", `prisma@${version2}`, "-D", "--silent");
9408
+ }
9409
+ await runPackageCmd(projectRoot, "add", `@prisma/client@${version2}`, "--silent");
9410
+ prismaClientDir = await findPrismaClientDir(path6.join(".", baseDir));
9411
+ if (!prismaClientDir) {
9412
+ throw new Error(
9413
+ `Could not resolve @prisma/client despite the installation that we just tried.
9414
+ Please try to install it by hand with ${bold(
9415
+ green(`${await getPackageCmd(baseDir, "add", "@prisma/client")}`)
9416
+ )} and rerun ${bold(await getPackageCmd(baseDir, "execute", "prisma generate"))} \u{1F64F}.`
9417
+ );
9418
+ }
9419
+ console.info(
9420
+ `
9421
+ \u2714 Installed the ${bold(green("@prisma/client"))} and ${bold(green("prisma"))} packages in your project`
9422
+ );
9423
+ return prismaClientDir;
9424
+ }
6833
9425
  async function findPrismaClientDir(baseDir) {
6834
9426
  const resolveOpts = { basedir: baseDir, preserveSymlinks: true };
6835
9427
  const cliDir = await resolvePkg("prisma", resolveOpts);
6836
9428
  const clientDir = await resolvePkg("@prisma/client", resolveOpts);
6837
9429
  const resolvedClientDir = clientDir && await fs2.realpath(clientDir);
6838
- debug("prismaCliDir", cliDir);
6839
- debug("prismaClientDir", clientDir);
9430
+ debug2("prismaCliDir", cliDir);
9431
+ debug2("prismaClientDir", clientDir);
6840
9432
  if (cliDir === void 0) return resolvedClientDir;
6841
9433
  if (clientDir === void 0) return resolvedClientDir;
6842
- const relDir = path2.relative(cliDir, clientDir).split(path2.sep);
9434
+ const relDir = path6.relative(cliDir, clientDir).split(path6.sep);
6843
9435
  if (relDir[0] !== ".." || relDir[1] === "..") return void 0;
6844
9436
  return resolvedClientDir;
6845
9437
  }
@@ -6847,24 +9439,45 @@ async function getPackageCmd(cwd, cmd, ...args) {
6847
9439
  const agent = await detect({ cwd, autoInstall: false, programmatic: true });
6848
9440
  return getCommand(agent ?? "npm", cmd, args);
6849
9441
  }
9442
+ async function isYarnUsed(baseDir) {
9443
+ const agent = await detect({ cwd: baseDir, autoInstall: false, programmatic: true });
9444
+ return agent === "yarn" || agent === "yarn@berry";
9445
+ }
9446
+ async function runPackageCmd(cwd, cmd, ...args) {
9447
+ await execaCommand(await getPackageCmd(cwd, cmd, ...args), {
9448
+ // we skip this because we are already in the generator
9449
+ env: { PRISMA_SKIP_POSTINSTALL_GENERATE: "true" },
9450
+ stdio: "inherit",
9451
+ cwd
9452
+ });
9453
+ }
6850
9454
 
6851
9455
  // src/generator.ts
9456
+ var debug3 = Debug3("prisma:client:generator");
6852
9457
  var PrismaClientJsGenerator = class {
6853
9458
  name = "prisma-client-js";
6854
9459
  #shouldResolvePrismaClient;
9460
+ #shouldInstallMissingPackages;
6855
9461
  #runtimePath;
6856
9462
  #cachedPrismaClientPath;
6857
- constructor({ shouldResolvePrismaClient = true, runtimePath } = {}) {
9463
+ constructor({
9464
+ shouldResolvePrismaClient = true,
9465
+ shouldInstallMissingPackages = true,
9466
+ runtimePath
9467
+ } = {}) {
6858
9468
  this.#shouldResolvePrismaClient = shouldResolvePrismaClient;
9469
+ this.#shouldInstallMissingPackages = shouldInstallMissingPackages;
6859
9470
  this.#runtimePath = runtimePath;
6860
9471
  }
6861
9472
  async getManifest(config) {
9473
+ const requiresEngines = match(getClientEngineType3(config)).with(ClientEngineType4.Library, () => ["libqueryEngine"]).with(ClientEngineType4.Binary, () => ["queryEngine"]).with(ClientEngineType4.Client, () => []).exhaustive();
9474
+ debug3("requiresEngines", requiresEngines);
6862
9475
  const defaultOutput = this.#shouldResolvePrismaClient ? await this.#getPrismaClientPath(config) : ".prisma/client";
6863
9476
  return {
6864
9477
  defaultOutput,
6865
9478
  prettyName: "Prisma Client",
6866
9479
  version,
6867
- requiresEngines: [],
9480
+ requiresEngines,
6868
9481
  requiresEngineVersion: enginesVersion
6869
9482
  };
6870
9483
  }
@@ -6875,6 +9488,7 @@ var PrismaClientJsGenerator = class {
6875
9488
  schemaPath: options.schemaPath,
6876
9489
  binaryPaths: options.binaryPaths,
6877
9490
  datasources: options.datasources,
9491
+ envPaths: options.envPaths,
6878
9492
  outputDir,
6879
9493
  copyRuntime: Boolean(options.generator.config.copyRuntime),
6880
9494
  copyRuntimeSourceMaps: Boolean(process.env.PRISMA_COPY_RUNTIME_SOURCEMAPS),
@@ -6884,6 +9498,8 @@ var PrismaClientJsGenerator = class {
6884
9498
  engineVersion: options.version,
6885
9499
  clientVersion: version,
6886
9500
  activeProvider: options.datasources[0]?.activeProvider,
9501
+ postinstall: options.postinstall,
9502
+ copyEngine: !options.noEngine,
6887
9503
  typedSql: options.typedSql
6888
9504
  });
6889
9505
  }
@@ -6891,20 +9507,27 @@ var PrismaClientJsGenerator = class {
6891
9507
  if (this.#cachedPrismaClientPath) {
6892
9508
  return this.#cachedPrismaClientPath;
6893
9509
  }
6894
- this.#cachedPrismaClientPath = await resolvePrismaClient(path3.dirname(config.sourceFilePath));
9510
+ this.#cachedPrismaClientPath = await this.#resolveOrInstallPrismaClient(path7.dirname(config.sourceFilePath));
6895
9511
  return this.#cachedPrismaClientPath;
6896
9512
  }
6897
9513
  async #getRuntimePath(config) {
6898
9514
  if (this.#runtimePath) {
6899
9515
  return this.#runtimePath;
6900
9516
  }
6901
- this.#runtimePath = path3.join(await this.#getPrismaClientPath(config), "runtime");
9517
+ this.#runtimePath = path7.join(await this.#getPrismaClientPath(config), "runtime");
6902
9518
  return this.#runtimePath;
6903
9519
  }
9520
+ async #resolveOrInstallPrismaClient(baseDir) {
9521
+ if (this.#shouldInstallMissingPackages && !process.env.PRISMA_GENERATE_SKIP_AUTOINSTALL) {
9522
+ return await resolveOrInstallPrismaClient(baseDir, version);
9523
+ } else {
9524
+ return await resolvePrismaClient(baseDir);
9525
+ }
9526
+ }
6904
9527
  };
6905
9528
 
6906
9529
  // src/utils/types/dmmfToTypes.ts
6907
- import path4 from "node:path";
9530
+ import path8 from "node:path";
6908
9531
  function dmmfToTypes(dmmf) {
6909
9532
  return new TSClient({
6910
9533
  dmmf,
@@ -6912,8 +9535,9 @@ function dmmfToTypes(dmmf) {
6912
9535
  clientVersion: "",
6913
9536
  engineVersion: "",
6914
9537
  runtimeBase: "@prisma/client",
6915
- runtimeName: "client",
6916
- runtimeSourcePath: path4.join(__dirname, "../../../runtime"),
9538
+ runtimeNameJs: "library",
9539
+ runtimeNameTs: "library",
9540
+ runtimeSourcePath: path8.join(__dirname, "../../../runtime"),
6917
9541
  schemaPath: "",
6918
9542
  outputDir: "",
6919
9543
  activeProvider: "",
@@ -6931,7 +9555,11 @@ function dmmfToTypes(dmmf) {
6931
9555
  datamodel: "",
6932
9556
  browser: false,
6933
9557
  edge: false,
6934
- wasm: false
9558
+ wasm: false,
9559
+ envPaths: {
9560
+ rootEnvPath: null,
9561
+ schemaEnvPath: void 0
9562
+ }
6935
9563
  }).toTS();
6936
9564
  }
6937
9565
  export {