@soda-gql/babel 0.11.0

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.
package/dist/index.cjs ADDED
@@ -0,0 +1,878 @@
1
+ const require_transformer = require('./transformer-C9UM_hw8.cjs');
2
+ let __babel_core = require("@babel/core");
3
+ let __babel_generator = require("@babel/generator");
4
+ __babel_generator = require_transformer.__toESM(__babel_generator);
5
+ let __babel_parser = require("@babel/parser");
6
+ let __babel_traverse = require("@babel/traverse");
7
+ __babel_traverse = require_transformer.__toESM(__babel_traverse);
8
+
9
+ //#region node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
10
+ var comma = ",".charCodeAt(0);
11
+ var semicolon = ";".charCodeAt(0);
12
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
13
+ var intToChar = new Uint8Array(64);
14
+ var charToInt = new Uint8Array(128);
15
+ for (let i = 0; i < chars.length; i++) {
16
+ const c = chars.charCodeAt(i);
17
+ intToChar[i] = c;
18
+ charToInt[c] = i;
19
+ }
20
+ function decodeInteger(reader, relative) {
21
+ let value = 0;
22
+ let shift = 0;
23
+ let integer = 0;
24
+ do {
25
+ integer = charToInt[reader.next()];
26
+ value |= (integer & 31) << shift;
27
+ shift += 5;
28
+ } while (integer & 32);
29
+ const shouldNegate = value & 1;
30
+ value >>>= 1;
31
+ if (shouldNegate) value = -2147483648 | -value;
32
+ return relative + value;
33
+ }
34
+ function encodeInteger(builder, num, relative) {
35
+ let delta = num - relative;
36
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
37
+ do {
38
+ let clamped = delta & 31;
39
+ delta >>>= 5;
40
+ if (delta > 0) clamped |= 32;
41
+ builder.write(intToChar[clamped]);
42
+ } while (delta > 0);
43
+ return num;
44
+ }
45
+ function hasMoreVlq(reader, max) {
46
+ if (reader.pos >= max) return false;
47
+ return reader.peek() !== comma;
48
+ }
49
+ var bufLength = 1024 * 16;
50
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
51
+ return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
52
+ } } : { decode(buf) {
53
+ let out = "";
54
+ for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
55
+ return out;
56
+ } };
57
+ var StringWriter = class {
58
+ constructor() {
59
+ this.pos = 0;
60
+ this.out = "";
61
+ this.buffer = new Uint8Array(bufLength);
62
+ }
63
+ write(v) {
64
+ const { buffer } = this;
65
+ buffer[this.pos++] = v;
66
+ if (this.pos === bufLength) {
67
+ this.out += td.decode(buffer);
68
+ this.pos = 0;
69
+ }
70
+ }
71
+ flush() {
72
+ const { buffer, out, pos } = this;
73
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
74
+ }
75
+ };
76
+ var StringReader = class {
77
+ constructor(buffer) {
78
+ this.pos = 0;
79
+ this.buffer = buffer;
80
+ }
81
+ next() {
82
+ return this.buffer.charCodeAt(this.pos++);
83
+ }
84
+ peek() {
85
+ return this.buffer.charCodeAt(this.pos);
86
+ }
87
+ indexOf(char) {
88
+ const { buffer, pos } = this;
89
+ const idx = buffer.indexOf(char, pos);
90
+ return idx === -1 ? buffer.length : idx;
91
+ }
92
+ };
93
+ function decode(mappings) {
94
+ const { length } = mappings;
95
+ const reader = new StringReader(mappings);
96
+ const decoded = [];
97
+ let genColumn = 0;
98
+ let sourcesIndex = 0;
99
+ let sourceLine = 0;
100
+ let sourceColumn = 0;
101
+ let namesIndex = 0;
102
+ do {
103
+ const semi = reader.indexOf(";");
104
+ const line = [];
105
+ let sorted = true;
106
+ let lastCol = 0;
107
+ genColumn = 0;
108
+ while (reader.pos < semi) {
109
+ let seg;
110
+ genColumn = decodeInteger(reader, genColumn);
111
+ if (genColumn < lastCol) sorted = false;
112
+ lastCol = genColumn;
113
+ if (hasMoreVlq(reader, semi)) {
114
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
115
+ sourceLine = decodeInteger(reader, sourceLine);
116
+ sourceColumn = decodeInteger(reader, sourceColumn);
117
+ if (hasMoreVlq(reader, semi)) {
118
+ namesIndex = decodeInteger(reader, namesIndex);
119
+ seg = [
120
+ genColumn,
121
+ sourcesIndex,
122
+ sourceLine,
123
+ sourceColumn,
124
+ namesIndex
125
+ ];
126
+ } else seg = [
127
+ genColumn,
128
+ sourcesIndex,
129
+ sourceLine,
130
+ sourceColumn
131
+ ];
132
+ } else seg = [genColumn];
133
+ line.push(seg);
134
+ reader.pos++;
135
+ }
136
+ if (!sorted) sort(line);
137
+ decoded.push(line);
138
+ reader.pos = semi + 1;
139
+ } while (reader.pos <= length);
140
+ return decoded;
141
+ }
142
+ function sort(line) {
143
+ line.sort(sortComparator$1);
144
+ }
145
+ function sortComparator$1(a, b) {
146
+ return a[0] - b[0];
147
+ }
148
+ function encode(decoded) {
149
+ const writer = new StringWriter();
150
+ let sourcesIndex = 0;
151
+ let sourceLine = 0;
152
+ let sourceColumn = 0;
153
+ let namesIndex = 0;
154
+ for (let i = 0; i < decoded.length; i++) {
155
+ const line = decoded[i];
156
+ if (i > 0) writer.write(semicolon);
157
+ if (line.length === 0) continue;
158
+ let genColumn = 0;
159
+ for (let j = 0; j < line.length; j++) {
160
+ const segment = line[j];
161
+ if (j > 0) writer.write(comma);
162
+ genColumn = encodeInteger(writer, segment[0], genColumn);
163
+ if (segment.length === 1) continue;
164
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
165
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
166
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
167
+ if (segment.length === 4) continue;
168
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
169
+ }
170
+ }
171
+ return writer.flush();
172
+ }
173
+
174
+ //#endregion
175
+ //#region node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
176
+ const schemeRegex = /^[\w+.-]+:\/\//;
177
+ /**
178
+ * Matches the parts of a URL:
179
+ * 1. Scheme, including ":", guaranteed.
180
+ * 2. User/password, including "@", optional.
181
+ * 3. Host, guaranteed.
182
+ * 4. Port, including ":", optional.
183
+ * 5. Path, including "/", optional.
184
+ * 6. Query, including "?", optional.
185
+ * 7. Hash, including "#", optional.
186
+ */
187
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
188
+ /**
189
+ * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start
190
+ * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).
191
+ *
192
+ * 1. Host, optional.
193
+ * 2. Path, which may include "/", guaranteed.
194
+ * 3. Query, including "?", optional.
195
+ * 4. Hash, including "#", optional.
196
+ */
197
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
198
+ function isAbsoluteUrl(input) {
199
+ return schemeRegex.test(input);
200
+ }
201
+ function isSchemeRelativeUrl(input) {
202
+ return input.startsWith("//");
203
+ }
204
+ function isAbsolutePath(input) {
205
+ return input.startsWith("/");
206
+ }
207
+ function isFileUrl(input) {
208
+ return input.startsWith("file:");
209
+ }
210
+ function isRelative(input) {
211
+ return /^[.?#]/.test(input);
212
+ }
213
+ function parseAbsoluteUrl(input) {
214
+ const match = urlRegex.exec(input);
215
+ return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
216
+ }
217
+ function parseFileUrl(input) {
218
+ const match = fileRegex.exec(input);
219
+ const path = match[2];
220
+ return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path) ? path : "/" + path, match[3] || "", match[4] || "");
221
+ }
222
+ function makeUrl(scheme, user, host, port, path, query, hash) {
223
+ return {
224
+ scheme,
225
+ user,
226
+ host,
227
+ port,
228
+ path,
229
+ query,
230
+ hash,
231
+ type: 7
232
+ };
233
+ }
234
+ function parseUrl(input) {
235
+ if (isSchemeRelativeUrl(input)) {
236
+ const url$1 = parseAbsoluteUrl("http:" + input);
237
+ url$1.scheme = "";
238
+ url$1.type = 6;
239
+ return url$1;
240
+ }
241
+ if (isAbsolutePath(input)) {
242
+ const url$1 = parseAbsoluteUrl("http://foo.com" + input);
243
+ url$1.scheme = "";
244
+ url$1.host = "";
245
+ url$1.type = 5;
246
+ return url$1;
247
+ }
248
+ if (isFileUrl(input)) return parseFileUrl(input);
249
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
250
+ const url = parseAbsoluteUrl("http://foo.com/" + input);
251
+ url.scheme = "";
252
+ url.host = "";
253
+ url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
254
+ return url;
255
+ }
256
+ function stripPathFilename(path) {
257
+ if (path.endsWith("/..")) return path;
258
+ const index = path.lastIndexOf("/");
259
+ return path.slice(0, index + 1);
260
+ }
261
+ function mergePaths(url, base) {
262
+ normalizePath(base, base.type);
263
+ if (url.path === "/") url.path = base.path;
264
+ else url.path = stripPathFilename(base.path) + url.path;
265
+ }
266
+ /**
267
+ * The path can have empty directories "//", unneeded parents "foo/..", or current directory
268
+ * "foo/.". We need to normalize to a standard representation.
269
+ */
270
+ function normalizePath(url, type) {
271
+ const rel = type <= 4;
272
+ const pieces = url.path.split("/");
273
+ let pointer = 1;
274
+ let positive = 0;
275
+ let addTrailingSlash = false;
276
+ for (let i = 1; i < pieces.length; i++) {
277
+ const piece = pieces[i];
278
+ if (!piece) {
279
+ addTrailingSlash = true;
280
+ continue;
281
+ }
282
+ addTrailingSlash = false;
283
+ if (piece === ".") continue;
284
+ if (piece === "..") {
285
+ if (positive) {
286
+ addTrailingSlash = true;
287
+ positive--;
288
+ pointer--;
289
+ } else if (rel) pieces[pointer++] = piece;
290
+ continue;
291
+ }
292
+ pieces[pointer++] = piece;
293
+ positive++;
294
+ }
295
+ let path = "";
296
+ for (let i = 1; i < pointer; i++) path += "/" + pieces[i];
297
+ if (!path || addTrailingSlash && !path.endsWith("/..")) path += "/";
298
+ url.path = path;
299
+ }
300
+ /**
301
+ * Attempts to resolve `input` URL/path relative to `base`.
302
+ */
303
+ function resolve(input, base) {
304
+ if (!input && !base) return "";
305
+ const url = parseUrl(input);
306
+ let inputType = url.type;
307
+ if (base && inputType !== 7) {
308
+ const baseUrl = parseUrl(base);
309
+ const baseType = baseUrl.type;
310
+ switch (inputType) {
311
+ case 1: url.hash = baseUrl.hash;
312
+ case 2: url.query = baseUrl.query;
313
+ case 3:
314
+ case 4: mergePaths(url, baseUrl);
315
+ case 5:
316
+ url.user = baseUrl.user;
317
+ url.host = baseUrl.host;
318
+ url.port = baseUrl.port;
319
+ case 6: url.scheme = baseUrl.scheme;
320
+ }
321
+ if (baseType > inputType) inputType = baseType;
322
+ }
323
+ normalizePath(url, inputType);
324
+ const queryHash = url.query + url.hash;
325
+ switch (inputType) {
326
+ case 2:
327
+ case 3: return queryHash;
328
+ case 4: {
329
+ const path = url.path.slice(1);
330
+ if (!path) return queryHash || ".";
331
+ if (isRelative(base || input) && !isRelative(path)) return "./" + path + queryHash;
332
+ return path + queryHash;
333
+ }
334
+ case 5: return url.path + queryHash;
335
+ default: return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
336
+ }
337
+ }
338
+
339
+ //#endregion
340
+ //#region node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
341
+ function stripFilename(path) {
342
+ if (!path) return "";
343
+ const index = path.lastIndexOf("/");
344
+ return path.slice(0, index + 1);
345
+ }
346
+ function resolver(mapUrl, sourceRoot) {
347
+ const from = stripFilename(mapUrl);
348
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
349
+ return (source) => resolve(prefix + (source || ""), from);
350
+ }
351
+ var COLUMN$1 = 0;
352
+ function maybeSort(mappings, owned) {
353
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
354
+ if (unsortedIndex === mappings.length) return mappings;
355
+ if (!owned) mappings = mappings.slice();
356
+ for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
357
+ return mappings;
358
+ }
359
+ function nextUnsortedSegmentLine(mappings, start) {
360
+ for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
361
+ return mappings.length;
362
+ }
363
+ function isSorted(line) {
364
+ for (let j = 1; j < line.length; j++) if (line[j][COLUMN$1] < line[j - 1][COLUMN$1]) return false;
365
+ return true;
366
+ }
367
+ function sortSegments(line, owned) {
368
+ if (!owned) line = line.slice();
369
+ return line.sort(sortComparator);
370
+ }
371
+ function sortComparator(a, b) {
372
+ return a[COLUMN$1] - b[COLUMN$1];
373
+ }
374
+ var found = false;
375
+ function binarySearch(haystack, needle, low, high) {
376
+ while (low <= high) {
377
+ const mid = low + (high - low >> 1);
378
+ const cmp = haystack[mid][COLUMN$1] - needle;
379
+ if (cmp === 0) {
380
+ found = true;
381
+ return mid;
382
+ }
383
+ if (cmp < 0) low = mid + 1;
384
+ else high = mid - 1;
385
+ }
386
+ found = false;
387
+ return low - 1;
388
+ }
389
+ function upperBound(haystack, needle, index) {
390
+ for (let i = index + 1; i < haystack.length; index = i++) if (haystack[i][COLUMN$1] !== needle) break;
391
+ return index;
392
+ }
393
+ function lowerBound(haystack, needle, index) {
394
+ for (let i = index - 1; i >= 0; index = i--) if (haystack[i][COLUMN$1] !== needle) break;
395
+ return index;
396
+ }
397
+ function memoizedState() {
398
+ return {
399
+ lastKey: -1,
400
+ lastNeedle: -1,
401
+ lastIndex: -1
402
+ };
403
+ }
404
+ function memoizedBinarySearch(haystack, needle, state, key) {
405
+ const { lastKey, lastNeedle, lastIndex } = state;
406
+ let low = 0;
407
+ let high = haystack.length - 1;
408
+ if (key === lastKey) {
409
+ if (needle === lastNeedle) {
410
+ found = lastIndex !== -1 && haystack[lastIndex][COLUMN$1] === needle;
411
+ return lastIndex;
412
+ }
413
+ if (needle >= lastNeedle) low = lastIndex === -1 ? 0 : lastIndex;
414
+ else high = lastIndex;
415
+ }
416
+ state.lastKey = key;
417
+ state.lastNeedle = needle;
418
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
419
+ }
420
+ function parse$1(map) {
421
+ return typeof map === "string" ? JSON.parse(map) : map;
422
+ }
423
+ var LEAST_UPPER_BOUND = -1;
424
+ var GREATEST_LOWER_BOUND = 1;
425
+ var TraceMap = class {
426
+ constructor(map, mapUrl) {
427
+ const isString = typeof map === "string";
428
+ if (!isString && map._decodedMemo) return map;
429
+ const parsed = parse$1(map);
430
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
431
+ this.version = version;
432
+ this.file = file;
433
+ this.names = names || [];
434
+ this.sourceRoot = sourceRoot;
435
+ this.sources = sources;
436
+ this.sourcesContent = sourcesContent;
437
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
438
+ const resolve$1 = resolver(mapUrl, sourceRoot);
439
+ this.resolvedSources = sources.map(resolve$1);
440
+ const { mappings } = parsed;
441
+ if (typeof mappings === "string") {
442
+ this._encoded = mappings;
443
+ this._decoded = void 0;
444
+ } else if (Array.isArray(mappings)) {
445
+ this._encoded = void 0;
446
+ this._decoded = maybeSort(mappings, isString);
447
+ } else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
448
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
449
+ this._decodedMemo = memoizedState();
450
+ this._bySources = void 0;
451
+ this._bySourceMemos = void 0;
452
+ }
453
+ };
454
+ function cast$1(map) {
455
+ return map;
456
+ }
457
+ function decodedMappings(map) {
458
+ var _a;
459
+ return (_a = cast$1(map))._decoded || (_a._decoded = decode(cast$1(map)._encoded));
460
+ }
461
+ function traceSegment(map, line, column) {
462
+ const decoded = decodedMappings(map);
463
+ if (line >= decoded.length) return null;
464
+ const segments = decoded[line];
465
+ const index = traceSegmentInternal(segments, cast$1(map)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
466
+ return index === -1 ? null : segments[index];
467
+ }
468
+ function traceSegmentInternal(segments, memo, line, column, bias) {
469
+ let index = memoizedBinarySearch(segments, column, memo, line);
470
+ if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
471
+ else if (bias === LEAST_UPPER_BOUND) index++;
472
+ if (index === -1 || index === segments.length) return -1;
473
+ return index;
474
+ }
475
+
476
+ //#endregion
477
+ //#region node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs
478
+ var SetArray = class {
479
+ constructor() {
480
+ this._indexes = { __proto__: null };
481
+ this.array = [];
482
+ }
483
+ };
484
+ function cast(set) {
485
+ return set;
486
+ }
487
+ function get(setarr, key) {
488
+ return cast(setarr)._indexes[key];
489
+ }
490
+ function put(setarr, key) {
491
+ const index = get(setarr, key);
492
+ if (index !== void 0) return index;
493
+ const { array, _indexes: indexes } = cast(setarr);
494
+ return indexes[key] = array.push(key) - 1;
495
+ }
496
+ function remove(setarr, key) {
497
+ const index = get(setarr, key);
498
+ if (index === void 0) return;
499
+ const { array, _indexes: indexes } = cast(setarr);
500
+ for (let i = index + 1; i < array.length; i++) {
501
+ const k = array[i];
502
+ array[i - 1] = k;
503
+ indexes[k]--;
504
+ }
505
+ indexes[key] = void 0;
506
+ array.pop();
507
+ }
508
+ var COLUMN = 0;
509
+ var SOURCES_INDEX = 1;
510
+ var SOURCE_LINE = 2;
511
+ var SOURCE_COLUMN = 3;
512
+ var NAMES_INDEX = 4;
513
+ var NO_NAME = -1;
514
+ var GenMapping = class {
515
+ constructor({ file, sourceRoot } = {}) {
516
+ this._names = new SetArray();
517
+ this._sources = new SetArray();
518
+ this._sourcesContent = [];
519
+ this._mappings = [];
520
+ this.file = file;
521
+ this.sourceRoot = sourceRoot;
522
+ this._ignoreList = new SetArray();
523
+ }
524
+ };
525
+ function cast2(map) {
526
+ return map;
527
+ }
528
+ var maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => {
529
+ return addSegmentInternal(true, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
530
+ };
531
+ function setSourceContent(map, source, content) {
532
+ const { _sources: sources, _sourcesContent: sourcesContent } = cast2(map);
533
+ const index = put(sources, source);
534
+ sourcesContent[index] = content;
535
+ }
536
+ function setIgnore(map, source, ignore = true) {
537
+ const { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = cast2(map);
538
+ const index = put(sources, source);
539
+ if (index === sourcesContent.length) sourcesContent[index] = null;
540
+ if (ignore) put(ignoreList, index);
541
+ else remove(ignoreList, index);
542
+ }
543
+ function toDecodedMap(map) {
544
+ const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = cast2(map);
545
+ removeEmptyFinalLines(mappings);
546
+ return {
547
+ version: 3,
548
+ file: map.file || void 0,
549
+ names: names.array,
550
+ sourceRoot: map.sourceRoot || void 0,
551
+ sources: sources.array,
552
+ sourcesContent,
553
+ mappings,
554
+ ignoreList: ignoreList.array
555
+ };
556
+ }
557
+ function toEncodedMap(map) {
558
+ const decoded = toDecodedMap(map);
559
+ return Object.assign({}, decoded, { mappings: encode(decoded.mappings) });
560
+ }
561
+ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
562
+ const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = cast2(map);
563
+ const line = getIndex(mappings, genLine);
564
+ const index = getColumnIndex(line, genColumn);
565
+ if (!source) {
566
+ if (skipable && skipSourceless(line, index)) return;
567
+ return insert(line, index, [genColumn]);
568
+ }
569
+ assert(sourceLine);
570
+ assert(sourceColumn);
571
+ const sourcesIndex = put(sources, source);
572
+ const namesIndex = name ? put(names, name) : NO_NAME;
573
+ if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
574
+ if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) return;
575
+ return insert(line, index, name ? [
576
+ genColumn,
577
+ sourcesIndex,
578
+ sourceLine,
579
+ sourceColumn,
580
+ namesIndex
581
+ ] : [
582
+ genColumn,
583
+ sourcesIndex,
584
+ sourceLine,
585
+ sourceColumn
586
+ ]);
587
+ }
588
+ function assert(_val) {}
589
+ function getIndex(arr, index) {
590
+ for (let i = arr.length; i <= index; i++) arr[i] = [];
591
+ return arr[index];
592
+ }
593
+ function getColumnIndex(line, genColumn) {
594
+ let index = line.length;
595
+ for (let i = index - 1; i >= 0; index = i--) if (genColumn >= line[i][COLUMN]) break;
596
+ return index;
597
+ }
598
+ function insert(array, index, value) {
599
+ for (let i = array.length; i > index; i--) array[i] = array[i - 1];
600
+ array[index] = value;
601
+ }
602
+ function removeEmptyFinalLines(mappings) {
603
+ const { length } = mappings;
604
+ let len = length;
605
+ for (let i = len - 1; i >= 0; len = i, i--) if (mappings[i].length > 0) break;
606
+ if (len < length) mappings.length = len;
607
+ }
608
+ function skipSourceless(line, index) {
609
+ if (index === 0) return true;
610
+ return line[index - 1].length === 1;
611
+ }
612
+ function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
613
+ if (index === 0) return false;
614
+ const prev = line[index - 1];
615
+ if (prev.length === 1) return false;
616
+ return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
617
+ }
618
+
619
+ //#endregion
620
+ //#region node_modules/@ampproject/remapping/dist/remapping.mjs
621
+ const SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false);
622
+ const EMPTY_SOURCES = [];
623
+ function SegmentObject(source, line, column, name, content, ignore) {
624
+ return {
625
+ source,
626
+ line,
627
+ column,
628
+ name,
629
+ content,
630
+ ignore
631
+ };
632
+ }
633
+ function Source(map, sources, source, content, ignore) {
634
+ return {
635
+ map,
636
+ sources,
637
+ source,
638
+ content,
639
+ ignore
640
+ };
641
+ }
642
+ /**
643
+ * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
644
+ * (which may themselves be SourceMapTrees).
645
+ */
646
+ function MapSource(map, sources) {
647
+ return Source(map, sources, "", null, false);
648
+ }
649
+ /**
650
+ * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
651
+ * segment tracing ends at the `OriginalSource`.
652
+ */
653
+ function OriginalSource(source, content, ignore) {
654
+ return Source(null, EMPTY_SOURCES, source, content, ignore);
655
+ }
656
+ /**
657
+ * traceMappings is only called on the root level SourceMapTree, and begins the process of
658
+ * resolving each mapping in terms of the original source files.
659
+ */
660
+ function traceMappings(tree) {
661
+ const gen = new GenMapping({ file: tree.map.file });
662
+ const { sources: rootSources, map } = tree;
663
+ const rootNames = map.names;
664
+ const rootMappings = decodedMappings(map);
665
+ for (let i = 0; i < rootMappings.length; i++) {
666
+ const segments = rootMappings[i];
667
+ for (let j = 0; j < segments.length; j++) {
668
+ const segment = segments[j];
669
+ const genCol = segment[0];
670
+ let traced = SOURCELESS_MAPPING;
671
+ if (segment.length !== 1) {
672
+ const source$1 = rootSources[segment[1]];
673
+ traced = originalPositionFor(source$1, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : "");
674
+ if (traced == null) continue;
675
+ }
676
+ const { column, line, name, content, source, ignore } = traced;
677
+ maybeAddSegment(gen, i, genCol, source, line, column, name);
678
+ if (source && content != null) setSourceContent(gen, source, content);
679
+ if (ignore) setIgnore(gen, source, true);
680
+ }
681
+ }
682
+ return gen;
683
+ }
684
+ /**
685
+ * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
686
+ * child SourceMapTrees, until we find the original source map.
687
+ */
688
+ function originalPositionFor(source, line, column, name) {
689
+ if (!source.map) return SegmentObject(source.source, line, column, name, source.content, source.ignore);
690
+ const segment = traceSegment(source.map, line, column);
691
+ if (segment == null) return null;
692
+ if (segment.length === 1) return SOURCELESS_MAPPING;
693
+ return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
694
+ }
695
+ function asArray(value) {
696
+ if (Array.isArray(value)) return value;
697
+ return [value];
698
+ }
699
+ /**
700
+ * Recursively builds a tree structure out of sourcemap files, with each node
701
+ * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
702
+ * `OriginalSource`s and `SourceMapTree`s.
703
+ *
704
+ * Every sourcemap is composed of a collection of source files and mappings
705
+ * into locations of those source files. When we generate a `SourceMapTree` for
706
+ * the sourcemap, we attempt to load each source file's own sourcemap. If it
707
+ * does not have an associated sourcemap, it is considered an original,
708
+ * unmodified source file.
709
+ */
710
+ function buildSourceMapTree(input, loader) {
711
+ const maps = asArray(input).map((m) => new TraceMap(m, ""));
712
+ const map = maps.pop();
713
+ for (let i = 0; i < maps.length; i++) if (maps[i].sources.length > 1) throw new Error(`Transformation map ${i} must have exactly one source file.\nDid you specify these with the most recent transformation maps first?`);
714
+ let tree = build(map, loader, "", 0);
715
+ for (let i = maps.length - 1; i >= 0; i--) tree = MapSource(maps[i], [tree]);
716
+ return tree;
717
+ }
718
+ function build(map, loader, importer, importerDepth) {
719
+ const { resolvedSources, sourcesContent, ignoreList } = map;
720
+ const depth = importerDepth + 1;
721
+ return MapSource(map, resolvedSources.map((sourceFile, i) => {
722
+ const ctx = {
723
+ importer,
724
+ depth,
725
+ source: sourceFile || "",
726
+ content: void 0,
727
+ ignore: void 0
728
+ };
729
+ const sourceMap = loader(ctx.source, ctx);
730
+ const { source, content, ignore } = ctx;
731
+ if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth);
732
+ return OriginalSource(source, content !== void 0 ? content : sourcesContent ? sourcesContent[i] : null, ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i) : false);
733
+ }));
734
+ }
735
+ /**
736
+ * A SourceMap v3 compatible sourcemap, which only includes fields that were
737
+ * provided to it.
738
+ */
739
+ var SourceMap = class {
740
+ constructor(map, options) {
741
+ const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
742
+ this.version = out.version;
743
+ this.file = out.file;
744
+ this.mappings = out.mappings;
745
+ this.names = out.names;
746
+ this.ignoreList = out.ignoreList;
747
+ this.sourceRoot = out.sourceRoot;
748
+ this.sources = out.sources;
749
+ if (!options.excludeContent) this.sourcesContent = out.sourcesContent;
750
+ }
751
+ toString() {
752
+ return JSON.stringify(this);
753
+ }
754
+ };
755
+ /**
756
+ * Traces through all the mappings in the root sourcemap, through the sources
757
+ * (and their sourcemaps), all the way back to the original source location.
758
+ *
759
+ * `loader` will be called every time we encounter a source file. If it returns
760
+ * a sourcemap, we will recurse into that sourcemap to continue the trace. If
761
+ * it returns a falsey value, that source file is treated as an original,
762
+ * unmodified source file.
763
+ *
764
+ * Pass `excludeContent` to exclude any self-containing source file content
765
+ * from the output sourcemap.
766
+ *
767
+ * Pass `decodedMappings` to receive a SourceMap with decoded (instead of
768
+ * VLQ encoded) mappings.
769
+ */
770
+ function remapping(input, loader, options) {
771
+ const opts = typeof options === "object" ? options : {
772
+ excludeContent: !!options,
773
+ decodedMappings: false
774
+ };
775
+ return new SourceMap(traceMappings(buildSourceMapTree(input, loader)), opts);
776
+ }
777
+
778
+ //#endregion
779
+ //#region packages/babel/src/transform.ts
780
+ /**
781
+ * Source-code based transform function for babel-transformer.
782
+ *
783
+ * This provides a similar interface to swc, taking source code
784
+ * as input and returning transformed source code.
785
+ */
786
+ const traverse = typeof __babel_traverse.default === "function" ? __babel_traverse.default : __babel_traverse.default.default;
787
+ const generate = typeof __babel_generator.default === "function" ? __babel_generator.default : __babel_generator.default.default;
788
+ /**
789
+ * Create a transformer instance.
790
+ *
791
+ * @param options - Transform options including config and artifact
792
+ * @returns A transformer that can transform source files
793
+ */
794
+ const createBabelTransformer = (options) => {
795
+ const { config, artifact, sourceMap = false } = options;
796
+ return { transform: ({ sourceCode, sourcePath, inputSourceMap }) => {
797
+ const ast = (0, __babel_parser.parse)(sourceCode, {
798
+ sourceType: "module",
799
+ plugins: ["typescript", "jsx"],
800
+ sourceFilename: sourcePath
801
+ });
802
+ let programPath = null;
803
+ traverse(ast, { Program(path) {
804
+ programPath = path;
805
+ path.stop();
806
+ } });
807
+ if (!programPath) return {
808
+ transformed: false,
809
+ sourceCode,
810
+ sourceMap: void 0
811
+ };
812
+ if (!require_transformer.createTransformer({
813
+ programPath,
814
+ types: __babel_core.types,
815
+ config
816
+ }).transform({
817
+ filename: sourcePath,
818
+ artifactLookup: (canonicalId) => artifact.elements[canonicalId]
819
+ }).transformed) return {
820
+ transformed: false,
821
+ sourceCode,
822
+ sourceMap: void 0
823
+ };
824
+ const output = generate(ast, {
825
+ sourceMaps: sourceMap,
826
+ sourceFileName: sourcePath
827
+ }, sourceCode);
828
+ let finalSourceMap;
829
+ if (sourceMap && output.map) if (inputSourceMap) {
830
+ const merged = remapping([output.map, JSON.parse(inputSourceMap)], () => null);
831
+ finalSourceMap = JSON.stringify(merged);
832
+ } else finalSourceMap = JSON.stringify(output.map);
833
+ return {
834
+ transformed: true,
835
+ sourceCode: output.code,
836
+ sourceMap: finalSourceMap
837
+ };
838
+ } };
839
+ };
840
+ /**
841
+ * Transform a single source file (one-shot).
842
+ *
843
+ * For transforming multiple files, use createBabelTransformer() to reuse the artifact.
844
+ *
845
+ * @param input - Transform input including source, path, artifact, and config
846
+ * @returns Transform output
847
+ */
848
+ const transform = (input) => {
849
+ return createBabelTransformer({
850
+ config: input.config,
851
+ artifact: input.artifact,
852
+ sourceMap: input.sourceMap
853
+ }).transform({
854
+ sourceCode: input.sourceCode,
855
+ sourcePath: input.sourcePath,
856
+ inputSourceMap: input.inputSourceMap
857
+ });
858
+ };
859
+
860
+ //#endregion
861
+ exports.buildFragmentRuntimeCall = require_transformer.buildFragmentRuntimeCall;
862
+ exports.buildLiteralFromValue = require_transformer.buildLiteralFromValue;
863
+ exports.buildObjectExpression = require_transformer.buildObjectExpression;
864
+ exports.buildOperationRuntimeComponents = require_transformer.buildOperationRuntimeComponents;
865
+ exports.clone = require_transformer.clone;
866
+ exports.cloneCallExpression = require_transformer.cloneCallExpression;
867
+ exports.collectGqlDefinitionMetadata = require_transformer.collectGqlDefinitionMetadata;
868
+ exports.createBabelTransformer = createBabelTransformer;
869
+ exports.createTransformer = require_transformer.createTransformer;
870
+ exports.ensureGqlRuntimeImport = require_transformer.ensureGqlRuntimeImport;
871
+ exports.ensureGqlRuntimeRequire = require_transformer.ensureGqlRuntimeRequire;
872
+ exports.extractGqlCall = require_transformer.extractGqlCall;
873
+ exports.insertRuntimeCalls = require_transformer.insertRuntimeCalls;
874
+ exports.removeGraphqlSystemImports = require_transformer.removeGraphqlSystemImports;
875
+ exports.stripTypeAnnotations = require_transformer.stripTypeAnnotations;
876
+ exports.transform = transform;
877
+ exports.transformCallExpression = require_transformer.transformCallExpression;
878
+ //# sourceMappingURL=index.cjs.map