@prisma/get-platform 7.5.0-dev.23 → 7.5.0-dev.25

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.
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var magic_string_es_3WRPFX2A_exports = {};
20
- __export(magic_string_es_3WRPFX2A_exports, {
19
+ var magic_string_es_SDTMJBWP_exports = {};
20
+ __export(magic_string_es_SDTMJBWP_exports, {
21
21
  Bundle: () => Bundle,
22
22
  SourceMap: () => SourceMap,
23
23
  default: () => MagicString
24
24
  });
25
- module.exports = __toCommonJS(magic_string_es_3WRPFX2A_exports);
25
+ module.exports = __toCommonJS(magic_string_es_SDTMJBWP_exports);
26
26
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
27
27
  var comma = ",".charCodeAt(0);
28
28
  var semicolon = ";".charCodeAt(0);
@@ -40,8 +40,7 @@ function encodeInteger(builder, num, relative) {
40
40
  do {
41
41
  let clamped = delta & 31;
42
42
  delta >>>= 5;
43
- if (delta > 0)
44
- clamped |= 32;
43
+ if (delta > 0) clamped |= 32;
45
44
  builder.write(intToChar[clamped]);
46
45
  } while (delta > 0);
47
46
  return num;
@@ -88,23 +87,18 @@ function encode(decoded) {
88
87
  let namesIndex = 0;
89
88
  for (let i = 0; i < decoded.length; i++) {
90
89
  const line = decoded[i];
91
- if (i > 0)
92
- writer.write(semicolon);
93
- if (line.length === 0)
94
- continue;
90
+ if (i > 0) writer.write(semicolon);
91
+ if (line.length === 0) continue;
95
92
  let genColumn = 0;
96
93
  for (let j = 0; j < line.length; j++) {
97
94
  const segment = line[j];
98
- if (j > 0)
99
- writer.write(comma);
95
+ if (j > 0) writer.write(comma);
100
96
  genColumn = encodeInteger(writer, segment[0], genColumn);
101
- if (segment.length === 1)
102
- continue;
97
+ if (segment.length === 1) continue;
103
98
  sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
104
99
  sourceLine = encodeInteger(writer, segment[2], sourceLine);
105
100
  sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
106
- if (segment.length === 4)
107
- continue;
101
+ if (segment.length === 4) continue;
108
102
  namesIndex = encodeInteger(writer, segment[4], namesIndex);
109
103
  }
110
104
  }
@@ -546,6 +540,9 @@ var MagicString = class _MagicString {
546
540
  }
547
541
  if (chunk.outro.length) mappings.advance(chunk.outro);
548
542
  });
543
+ if (this.outro) {
544
+ mappings.advance(this.outro);
545
+ }
549
546
  return {
550
547
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
551
548
  sources: [
@@ -903,10 +900,13 @@ var MagicString = class _MagicString {
903
900
  _split(index) {
904
901
  if (this.byStart[index] || this.byEnd[index]) return;
905
902
  let chunk = this.lastSearchedChunk;
903
+ let previousChunk = chunk;
906
904
  const searchForward = index > chunk.end;
907
905
  while (chunk) {
908
906
  if (chunk.contains(index)) return this._splitChunk(chunk, index);
909
907
  chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
908
+ if (chunk === previousChunk) return;
909
+ previousChunk = chunk;
910
910
  }
911
911
  }
912
912
  _splitChunk(chunk, index) {
@@ -1053,7 +1053,12 @@ var MagicString = class _MagicString {
1053
1053
  const { original } = this;
1054
1054
  const index = original.indexOf(string);
1055
1055
  if (index !== -1) {
1056
- this.overwrite(index, index + string.length, replacement);
1056
+ if (typeof replacement === "function") {
1057
+ replacement = replacement(string, index, original);
1058
+ }
1059
+ if (string !== replacement) {
1060
+ this.overwrite(index, index + string.length, replacement);
1061
+ }
1057
1062
  }
1058
1063
  return this;
1059
1064
  }
@@ -1068,7 +1073,11 @@ var MagicString = class _MagicString {
1068
1073
  const stringLength = string.length;
1069
1074
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
1070
1075
  const previous = original.slice(index, index + stringLength);
1071
- if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1076
+ let _replacement = replacement;
1077
+ if (typeof replacement === "function") {
1078
+ _replacement = replacement(previous, index, original);
1079
+ }
1080
+ if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);
1072
1081
  }
1073
1082
  return this;
1074
1083
  }