@sailfish-ai/sf-veritas 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,750 +0,0 @@
1
- import { parse as ce } from "@babel/parser";
2
- import J from "@babel/traverse";
3
- import V from "@babel/generator";
4
- import * as u from "@babel/types";
5
- import { relative as pe, resolve as F, dirname as I } from "path";
6
- import { readFileSync as ge } from "fs";
7
- var Q, H, $ = {}, D = {}, N = {}, k = {};
8
- function de() {
9
- if (Q) return k;
10
- Q = 1;
11
- var l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
12
- return k.encode = function(p) {
13
- if (0 <= p && p < l.length) return l[p];
14
- throw new TypeError("Must be between 0 and 63: " + p);
15
- }, k.decode = function(p) {
16
- return 65 <= p && p <= 90 ? p - 65 : 97 <= p && p <= 122 ? p - 97 + 26 : 48 <= p && p <= 57 ? p - 48 + 52 : p == 43 ? 62 : p == 47 ? 63 : -1;
17
- }, k;
18
- }
19
- function ue() {
20
- if (H) return N;
21
- H = 1;
22
- var l = de();
23
- return N.encode = function(p) {
24
- var m, _ = "", g = (function(t) {
25
- return t < 0 ? 1 + (-t << 1) : 0 + (t << 1);
26
- })(p);
27
- do
28
- m = 31 & g, (g >>>= 5) > 0 && (m |= 32), _ += l.encode(m);
29
- while (g > 0);
30
- return _;
31
- }, N.decode = function(p, m, _) {
32
- var g, t, o, c, d = p.length, h = 0, v = 0;
33
- do {
34
- if (m >= d) throw new Error("Expected more digits in base 64 VLQ value.");
35
- if ((t = l.decode(p.charCodeAt(m++))) === -1) throw new Error("Invalid base64 digit: " + p.charAt(m - 1));
36
- g = !!(32 & t), h += (t &= 31) << v, v += 5;
37
- } while (g);
38
- _.value = (c = (o = h) >> 1, 1 & ~o ? c : -c), _.rest = m;
39
- }, N;
40
- }
41
- var K, X = {};
42
- function P() {
43
- return K || (K = 1, (function(l) {
44
- l.getArg = function(n, e, i) {
45
- if (e in n) return n[e];
46
- if (arguments.length === 3) return i;
47
- throw new Error('"' + e + '" is a required argument.');
48
- };
49
- var p = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/, m = /^data:.+\,.+$/;
50
- function _(n) {
51
- var e = n.match(p);
52
- return e ? { scheme: e[1], auth: e[2], host: e[3], port: e[4], path: e[5] } : null;
53
- }
54
- function g(n) {
55
- var e = "";
56
- return n.scheme && (e += n.scheme + ":"), e += "//", n.auth && (e += n.auth + "@"), n.host && (e += n.host), n.port && (e += ":" + n.port), n.path && (e += n.path), e;
57
- }
58
- l.urlParse = _, l.urlGenerate = g;
59
- var t, o, c = (t = function(n) {
60
- var e = n, i = _(n);
61
- if (i) {
62
- if (!i.path) return n;
63
- e = i.path;
64
- }
65
- for (var r = l.isAbsolute(e), f = [], y = 0, C = 0; ; ) {
66
- if (y = C, (C = e.indexOf("/", y)) === -1) {
67
- f.push(e.slice(y));
68
- break;
69
- }
70
- for (f.push(e.slice(y, C)); C < e.length && e[C] === "/"; ) C++;
71
- }
72
- var L, S = 0;
73
- for (C = f.length - 1; C >= 0; C--) (L = f[C]) === "." ? f.splice(C, 1) : L === ".." ? S++ : S > 0 && (L === "" ? (f.splice(C + 1, S), S = 0) : (f.splice(C, 2), S--));
74
- return (e = f.join("/")) === "" && (e = r ? "/" : "."), i ? (i.path = e, g(i)) : e;
75
- }, o = [], function(n) {
76
- for (var e = 0; e < o.length; e++) if (o[e].input === n) {
77
- var i = o[0];
78
- return o[0] = o[e], o[e] = i, o[0].result;
79
- }
80
- var r = t(n);
81
- return o.unshift({ input: n, result: r }), o.length > 32 && o.pop(), r;
82
- });
83
- function d(n, e) {
84
- n === "" && (n = "."), e === "" && (e = ".");
85
- var i = _(e), r = _(n);
86
- if (r && (n = r.path || "/"), i && !i.scheme) return r && (i.scheme = r.scheme), g(i);
87
- if (i || e.match(m)) return e;
88
- if (r && !r.host && !r.path) return r.host = e, g(r);
89
- var f = e.charAt(0) === "/" ? e : c(n.replace(/\/+$/, "") + "/" + e);
90
- return r ? (r.path = f, g(r)) : f;
91
- }
92
- l.normalize = c, l.join = d, l.isAbsolute = function(n) {
93
- return n.charAt(0) === "/" || p.test(n);
94
- }, l.relative = function(n, e) {
95
- n === "" && (n = "."), n = n.replace(/\/$/, "");
96
- for (var i = 0; e.indexOf(n + "/") !== 0; ) {
97
- var r = n.lastIndexOf("/");
98
- if (r < 0 || (n = n.slice(0, r)).match(/^([^\/]+:\/)?\/*$/)) return e;
99
- ++i;
100
- }
101
- return Array(i + 1).join("../") + e.substr(n.length + 1);
102
- };
103
- var h = !("__proto__" in /* @__PURE__ */ Object.create(null));
104
- function v(n) {
105
- return n;
106
- }
107
- function s(n) {
108
- if (!n) return !1;
109
- var e = n.length;
110
- if (e < 9 || n.charCodeAt(e - 1) !== 95 || n.charCodeAt(e - 2) !== 95 || n.charCodeAt(e - 3) !== 111 || n.charCodeAt(e - 4) !== 116 || n.charCodeAt(e - 5) !== 111 || n.charCodeAt(e - 6) !== 114 || n.charCodeAt(e - 7) !== 112 || n.charCodeAt(e - 8) !== 95 || n.charCodeAt(e - 9) !== 95) return !1;
111
- for (var i = e - 10; i >= 0; i--) if (n.charCodeAt(i) !== 36) return !1;
112
- return !0;
113
- }
114
- function a(n, e) {
115
- return n === e ? 0 : n === null ? 1 : e === null ? -1 : n > e ? 1 : -1;
116
- }
117
- l.toSetString = h ? v : function(n) {
118
- return s(n) ? "$" + n : n;
119
- }, l.fromSetString = h ? v : function(n) {
120
- return s(n) ? n.slice(1) : n;
121
- }, l.compareByOriginalPositions = function(n, e, i) {
122
- var r = a(n.source, e.source);
123
- return r !== 0 || (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 || i || (r = n.generatedColumn - e.generatedColumn) !== 0 || (r = n.generatedLine - e.generatedLine) !== 0 ? r : a(n.name, e.name);
124
- }, l.compareByOriginalPositionsNoSource = function(n, e, i) {
125
- var r;
126
- return (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 || i || (r = n.generatedColumn - e.generatedColumn) !== 0 || (r = n.generatedLine - e.generatedLine) !== 0 ? r : a(n.name, e.name);
127
- }, l.compareByGeneratedPositionsDeflated = function(n, e, i) {
128
- var r = n.generatedLine - e.generatedLine;
129
- return r !== 0 || (r = n.generatedColumn - e.generatedColumn) !== 0 || i || (r = a(n.source, e.source)) !== 0 || (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 ? r : a(n.name, e.name);
130
- }, l.compareByGeneratedPositionsDeflatedNoLine = function(n, e, i) {
131
- var r = n.generatedColumn - e.generatedColumn;
132
- return r !== 0 || i || (r = a(n.source, e.source)) !== 0 || (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 ? r : a(n.name, e.name);
133
- }, l.compareByGeneratedPositionsInflated = function(n, e) {
134
- var i = n.generatedLine - e.generatedLine;
135
- return i !== 0 || (i = n.generatedColumn - e.generatedColumn) !== 0 || (i = a(n.source, e.source)) !== 0 || (i = n.originalLine - e.originalLine) !== 0 || (i = n.originalColumn - e.originalColumn) !== 0 ? i : a(n.name, e.name);
136
- }, l.parseSourceMapInput = function(n) {
137
- return JSON.parse(n.replace(/^\)]}'[^\n]*\n/, ""));
138
- }, l.computeSourceURL = function(n, e, i) {
139
- if (e = e || "", n && (n[n.length - 1] !== "/" && e[0] !== "/" && (n += "/"), e = n + e), i) {
140
- var r = _(i);
141
- if (!r) throw new Error("sourceMapURL could not be parsed");
142
- if (r.path) {
143
- var f = r.path.lastIndexOf("/");
144
- f >= 0 && (r.path = r.path.substring(0, f + 1));
145
- }
146
- e = d(g(r), e);
147
- }
148
- return c(e);
149
- };
150
- })(X)), X;
151
- }
152
- var Y, U = {};
153
- function le() {
154
- if (Y) return U;
155
- Y = 1;
156
- var l = P(), p = Object.prototype.hasOwnProperty, m = typeof Map < "u";
157
- function _() {
158
- this._array = [], this._set = m ? /* @__PURE__ */ new Map() : /* @__PURE__ */ Object.create(null);
159
- }
160
- return _.fromArray = function(g, t) {
161
- for (var o = new _(), c = 0, d = g.length; c < d; c++) o.add(g[c], t);
162
- return o;
163
- }, _.prototype.size = function() {
164
- return m ? this._set.size : Object.getOwnPropertyNames(this._set).length;
165
- }, _.prototype.add = function(g, t) {
166
- var o = m ? g : l.toSetString(g), c = m ? this.has(g) : p.call(this._set, o), d = this._array.length;
167
- c && !t || this._array.push(g), c || (m ? this._set.set(g, d) : this._set[o] = d);
168
- }, _.prototype.has = function(g) {
169
- if (m) return this._set.has(g);
170
- var t = l.toSetString(g);
171
- return p.call(this._set, t);
172
- }, _.prototype.indexOf = function(g) {
173
- if (m) {
174
- var t = this._set.get(g);
175
- if (t >= 0) return t;
176
- } else {
177
- var o = l.toSetString(g);
178
- if (p.call(this._set, o)) return this._set[o];
179
- }
180
- throw new Error('"' + g + '" is not in the set.');
181
- }, _.prototype.at = function(g) {
182
- if (g >= 0 && g < this._array.length) return this._array[g];
183
- throw new Error("No element indexed by " + g);
184
- }, _.prototype.toArray = function() {
185
- return this._array.slice();
186
- }, U.ArraySet = _, U;
187
- }
188
- var Z, ee, B = {};
189
- function fe() {
190
- if (Z) return B;
191
- Z = 1;
192
- var l = P();
193
- function p() {
194
- this._array = [], this._sorted = !0, this._last = { generatedLine: -1, generatedColumn: 0 };
195
- }
196
- return p.prototype.unsortedForEach = function(m, _) {
197
- this._array.forEach(m, _);
198
- }, p.prototype.add = function(m) {
199
- var _, g, t, o, c, d;
200
- _ = this._last, g = m, t = _.generatedLine, o = g.generatedLine, c = _.generatedColumn, d = g.generatedColumn, o > t || o == t && d >= c || l.compareByGeneratedPositionsInflated(_, g) <= 0 ? (this._last = m, this._array.push(m)) : (this._sorted = !1, this._array.push(m));
201
- }, p.prototype.toArray = function() {
202
- return this._sorted || (this._array.sort(l.compareByGeneratedPositionsInflated), this._sorted = !0), this._array;
203
- }, B.MappingList = p, B;
204
- }
205
- function ne() {
206
- if (ee) return D;
207
- ee = 1;
208
- var l = ue(), p = P(), m = le().ArraySet, _ = fe().MappingList;
209
- function g(t) {
210
- t || (t = {}), this._file = p.getArg(t, "file", null), this._sourceRoot = p.getArg(t, "sourceRoot", null), this._skipValidation = p.getArg(t, "skipValidation", !1), this._ignoreInvalidMapping = p.getArg(t, "ignoreInvalidMapping", !1), this._sources = new m(), this._names = new m(), this._mappings = new _(), this._sourcesContents = null;
211
- }
212
- return g.prototype._version = 3, g.fromSourceMap = function(t, o) {
213
- var c = t.sourceRoot, d = new g(Object.assign(o || {}, { file: t.file, sourceRoot: c }));
214
- return t.eachMapping(function(h) {
215
- var v = { generated: { line: h.generatedLine, column: h.generatedColumn } };
216
- h.source != null && (v.source = h.source, c != null && (v.source = p.relative(c, v.source)), v.original = { line: h.originalLine, column: h.originalColumn }, h.name != null && (v.name = h.name)), d.addMapping(v);
217
- }), t.sources.forEach(function(h) {
218
- var v = h;
219
- c !== null && (v = p.relative(c, h)), d._sources.has(v) || d._sources.add(v);
220
- var s = t.sourceContentFor(h);
221
- s != null && d.setSourceContent(h, s);
222
- }), d;
223
- }, g.prototype.addMapping = function(t) {
224
- var o = p.getArg(t, "generated"), c = p.getArg(t, "original", null), d = p.getArg(t, "source", null), h = p.getArg(t, "name", null);
225
- (this._skipValidation || this._validateMapping(o, c, d, h) !== !1) && (d != null && (d = String(d), this._sources.has(d) || this._sources.add(d)), h != null && (h = String(h), this._names.has(h) || this._names.add(h)), this._mappings.add({ generatedLine: o.line, generatedColumn: o.column, originalLine: c != null && c.line, originalColumn: c != null && c.column, source: d, name: h }));
226
- }, g.prototype.setSourceContent = function(t, o) {
227
- var c = t;
228
- this._sourceRoot != null && (c = p.relative(this._sourceRoot, c)), o != null ? (this._sourcesContents || (this._sourcesContents = /* @__PURE__ */ Object.create(null)), this._sourcesContents[p.toSetString(c)] = o) : this._sourcesContents && (delete this._sourcesContents[p.toSetString(c)], Object.keys(this._sourcesContents).length === 0 && (this._sourcesContents = null));
229
- }, g.prototype.applySourceMap = function(t, o, c) {
230
- var d = o;
231
- if (o == null) {
232
- if (t.file == null) throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);
233
- d = t.file;
234
- }
235
- var h = this._sourceRoot;
236
- h != null && (d = p.relative(h, d));
237
- var v = new m(), s = new m();
238
- this._mappings.unsortedForEach(function(a) {
239
- if (a.source === d && a.originalLine != null) {
240
- var n = t.originalPositionFor({ line: a.originalLine, column: a.originalColumn });
241
- n.source != null && (a.source = n.source, c != null && (a.source = p.join(c, a.source)), h != null && (a.source = p.relative(h, a.source)), a.originalLine = n.line, a.originalColumn = n.column, n.name != null && (a.name = n.name));
242
- }
243
- var e = a.source;
244
- e == null || v.has(e) || v.add(e);
245
- var i = a.name;
246
- i == null || s.has(i) || s.add(i);
247
- }, this), this._sources = v, this._names = s, t.sources.forEach(function(a) {
248
- var n = t.sourceContentFor(a);
249
- n != null && (c != null && (a = p.join(c, a)), h != null && (a = p.relative(h, a)), this.setSourceContent(a, n));
250
- }, this);
251
- }, g.prototype._validateMapping = function(t, o, c, d) {
252
- if (o && typeof o.line != "number" && typeof o.column != "number") {
253
- var h = "original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.";
254
- if (this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(h), !1;
255
- throw new Error(h);
256
- }
257
- if ((!(t && "line" in t && "column" in t && t.line > 0 && t.column >= 0) || o || c || d) && !(t && "line" in t && "column" in t && o && "line" in o && "column" in o && t.line > 0 && t.column >= 0 && o.line > 0 && o.column >= 0 && c)) {
258
- if (h = "Invalid mapping: " + JSON.stringify({ generated: t, source: c, original: o, name: d }), this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(h), !1;
259
- throw new Error(h);
260
- }
261
- }, g.prototype._serializeMappings = function() {
262
- for (var t, o, c, d, h = 0, v = 1, s = 0, a = 0, n = 0, e = 0, i = "", r = this._mappings.toArray(), f = 0, y = r.length; f < y; f++) {
263
- if (t = "", (o = r[f]).generatedLine !== v) for (h = 0; o.generatedLine !== v; ) t += ";", v++;
264
- else if (f > 0) {
265
- if (!p.compareByGeneratedPositionsInflated(o, r[f - 1])) continue;
266
- t += ",";
267
- }
268
- t += l.encode(o.generatedColumn - h), h = o.generatedColumn, o.source != null && (d = this._sources.indexOf(o.source), t += l.encode(d - e), e = d, t += l.encode(o.originalLine - 1 - a), a = o.originalLine - 1, t += l.encode(o.originalColumn - s), s = o.originalColumn, o.name != null && (c = this._names.indexOf(o.name), t += l.encode(c - n), n = c)), i += t;
269
- }
270
- return i;
271
- }, g.prototype._generateSourcesContent = function(t, o) {
272
- return t.map(function(c) {
273
- if (!this._sourcesContents) return null;
274
- o != null && (c = p.relative(o, c));
275
- var d = p.toSetString(c);
276
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, d) ? this._sourcesContents[d] : null;
277
- }, this);
278
- }, g.prototype.toJSON = function() {
279
- var t = { version: this._version, sources: this._sources.toArray(), names: this._names.toArray(), mappings: this._serializeMappings() };
280
- return this._file != null && (t.file = this._file), this._sourceRoot != null && (t.sourceRoot = this._sourceRoot), this._sourcesContents && (t.sourcesContent = this._generateSourcesContent(t.sources, t.sourceRoot)), t;
281
- }, g.prototype.toString = function() {
282
- return JSON.stringify(this.toJSON());
283
- }, D.SourceMapGenerator = g, D;
284
- }
285
- var re, R = {}, te = {};
286
- function he() {
287
- return re || (re = 1, (function(l) {
288
- function p(m, _, g, t, o, c) {
289
- var d = Math.floor((_ - m) / 2) + m, h = o(g, t[d], !0);
290
- return h === 0 ? d : h > 0 ? _ - d > 1 ? p(d, _, g, t, o, c) : c == l.LEAST_UPPER_BOUND ? _ < t.length ? _ : -1 : d : d - m > 1 ? p(m, d, g, t, o, c) : c == l.LEAST_UPPER_BOUND ? d : m < 0 ? -1 : m;
291
- }
292
- l.GREATEST_LOWER_BOUND = 1, l.LEAST_UPPER_BOUND = 2, l.search = function(m, _, g, t) {
293
- if (_.length === 0) return -1;
294
- var o = p(-1, _.length, m, _, g, t || l.GREATEST_LOWER_BOUND);
295
- if (o < 0) return -1;
296
- for (; o - 1 >= 0 && g(_[o], _[o - 1], !0) === 0; ) --o;
297
- return o;
298
- };
299
- })(te)), te;
300
- }
301
- var oe, ie, W = {};
302
- function me() {
303
- if (oe) return W;
304
- function l(m) {
305
- function _(g, t, o) {
306
- var c = g[t];
307
- g[t] = g[o], g[o] = c;
308
- }
309
- return function g(t, o, c, d) {
310
- if (c < d) {
311
- var h = c - 1;
312
- _(t, (n = c, e = d, Math.round(n + Math.random() * (e - n))), d);
313
- for (var v = t[d], s = c; s < d; s++) o(t[s], v, !1) <= 0 && _(t, h += 1, s);
314
- _(t, h + 1, s);
315
- var a = h + 1;
316
- g(t, o, c, a - 1), g(t, o, a + 1, d);
317
- }
318
- var n, e;
319
- };
320
- }
321
- oe = 1;
322
- let p = /* @__PURE__ */ new WeakMap();
323
- return W.quickSort = function(m, _, g = 0) {
324
- let t = p.get(_);
325
- t === void 0 && (t = (function(o) {
326
- let c = l.toString();
327
- return new Function(`return ${c}`)()(o);
328
- })(_), p.set(_, t)), t(m, _, g, m.length - 1);
329
- }, W;
330
- }
331
- var se, ae, q = {}, _e = (ae || (ae = 1, $.SourceMapGenerator = ne().SourceMapGenerator, $.SourceMapConsumer = (function() {
332
- if (ie) return R;
333
- ie = 1;
334
- var l = P(), p = he(), m = le().ArraySet, _ = ue(), g = me().quickSort;
335
- function t(s, a) {
336
- var n = s;
337
- return typeof s == "string" && (n = l.parseSourceMapInput(s)), n.sections != null ? new v(n, a) : new o(n, a);
338
- }
339
- function o(s, a) {
340
- var n = s;
341
- typeof s == "string" && (n = l.parseSourceMapInput(s));
342
- var e = l.getArg(n, "version"), i = l.getArg(n, "sources"), r = l.getArg(n, "names", []), f = l.getArg(n, "sourceRoot", null), y = l.getArg(n, "sourcesContent", null), C = l.getArg(n, "mappings"), L = l.getArg(n, "file", null);
343
- if (e != this._version) throw new Error("Unsupported version: " + e);
344
- f && (f = l.normalize(f)), i = i.map(String).map(l.normalize).map(function(S) {
345
- return f && l.isAbsolute(f) && l.isAbsolute(S) ? l.relative(f, S) : S;
346
- }), this._names = m.fromArray(r.map(String), !0), this._sources = m.fromArray(i, !0), this._absoluteSources = this._sources.toArray().map(function(S) {
347
- return l.computeSourceURL(f, S, a);
348
- }), this.sourceRoot = f, this.sourcesContent = y, this._mappings = C, this._sourceMapURL = a, this.file = L;
349
- }
350
- function c() {
351
- this.generatedLine = 0, this.generatedColumn = 0, this.source = null, this.originalLine = null, this.originalColumn = null, this.name = null;
352
- }
353
- t.fromSourceMap = function(s, a) {
354
- return o.fromSourceMap(s, a);
355
- }, t.prototype._version = 3, t.prototype.__generatedMappings = null, Object.defineProperty(t.prototype, "_generatedMappings", { configurable: !0, enumerable: !0, get: function() {
356
- return this.__generatedMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__generatedMappings;
357
- } }), t.prototype.__originalMappings = null, Object.defineProperty(t.prototype, "_originalMappings", { configurable: !0, enumerable: !0, get: function() {
358
- return this.__originalMappings || this._parseMappings(this._mappings, this.sourceRoot), this.__originalMappings;
359
- } }), t.prototype._charIsMappingSeparator = function(s, a) {
360
- var n = s.charAt(a);
361
- return n === ";" || n === ",";
362
- }, t.prototype._parseMappings = function(s, a) {
363
- throw new Error("Subclasses must implement _parseMappings");
364
- }, t.GENERATED_ORDER = 1, t.ORIGINAL_ORDER = 2, t.GREATEST_LOWER_BOUND = 1, t.LEAST_UPPER_BOUND = 2, t.prototype.eachMapping = function(s, a, n) {
365
- var e, i = a || null;
366
- switch (n || t.GENERATED_ORDER) {
367
- case t.GENERATED_ORDER:
368
- e = this._generatedMappings;
369
- break;
370
- case t.ORIGINAL_ORDER:
371
- e = this._originalMappings;
372
- break;
373
- default:
374
- throw new Error("Unknown order of iteration.");
375
- }
376
- for (var r = this.sourceRoot, f = s.bind(i), y = this._names, C = this._sources, L = this._sourceMapURL, S = 0, A = e.length; S < A; S++) {
377
- var b = e[S], M = b.source === null ? null : C.at(b.source);
378
- M !== null && (M = l.computeSourceURL(r, M, L)), f({ source: M, generatedLine: b.generatedLine, generatedColumn: b.generatedColumn, originalLine: b.originalLine, originalColumn: b.originalColumn, name: b.name === null ? null : y.at(b.name) });
379
- }
380
- }, t.prototype.allGeneratedPositionsFor = function(s) {
381
- var a = l.getArg(s, "line"), n = { source: l.getArg(s, "source"), originalLine: a, originalColumn: l.getArg(s, "column", 0) };
382
- if (n.source = this._findSourceIndex(n.source), n.source < 0) return [];
383
- var e = [], i = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", l.compareByOriginalPositions, p.LEAST_UPPER_BOUND);
384
- if (i >= 0) {
385
- var r = this._originalMappings[i];
386
- if (s.column === void 0) for (var f = r.originalLine; r && r.originalLine === f; ) e.push({ line: l.getArg(r, "generatedLine", null), column: l.getArg(r, "generatedColumn", null), lastColumn: l.getArg(r, "lastGeneratedColumn", null) }), r = this._originalMappings[++i];
387
- else for (var y = r.originalColumn; r && r.originalLine === a && r.originalColumn == y; ) e.push({ line: l.getArg(r, "generatedLine", null), column: l.getArg(r, "generatedColumn", null), lastColumn: l.getArg(r, "lastGeneratedColumn", null) }), r = this._originalMappings[++i];
388
- }
389
- return e;
390
- }, R.SourceMapConsumer = t, o.prototype = Object.create(t.prototype), o.prototype.consumer = t, o.prototype._findSourceIndex = function(s) {
391
- var a, n = s;
392
- if (this.sourceRoot != null && (n = l.relative(this.sourceRoot, n)), this._sources.has(n)) return this._sources.indexOf(n);
393
- for (a = 0; a < this._absoluteSources.length; ++a) if (this._absoluteSources[a] == s) return a;
394
- return -1;
395
- }, o.fromSourceMap = function(s, a) {
396
- var n = Object.create(o.prototype), e = n._names = m.fromArray(s._names.toArray(), !0), i = n._sources = m.fromArray(s._sources.toArray(), !0);
397
- n.sourceRoot = s._sourceRoot, n.sourcesContent = s._generateSourcesContent(n._sources.toArray(), n.sourceRoot), n.file = s._file, n._sourceMapURL = a, n._absoluteSources = n._sources.toArray().map(function(b) {
398
- return l.computeSourceURL(n.sourceRoot, b, a);
399
- });
400
- for (var r = s._mappings.toArray().slice(), f = n.__generatedMappings = [], y = n.__originalMappings = [], C = 0, L = r.length; C < L; C++) {
401
- var S = r[C], A = new c();
402
- A.generatedLine = S.generatedLine, A.generatedColumn = S.generatedColumn, S.source && (A.source = i.indexOf(S.source), A.originalLine = S.originalLine, A.originalColumn = S.originalColumn, S.name && (A.name = e.indexOf(S.name)), y.push(A)), f.push(A);
403
- }
404
- return g(n.__originalMappings, l.compareByOriginalPositions), n;
405
- }, o.prototype._version = 3, Object.defineProperty(o.prototype, "sources", { get: function() {
406
- return this._absoluteSources.slice();
407
- } });
408
- const d = l.compareByGeneratedPositionsDeflatedNoLine;
409
- function h(s, a) {
410
- let n = s.length, e = s.length - a;
411
- if (!(e <= 1)) if (e == 2) {
412
- let i = s[a], r = s[a + 1];
413
- d(i, r) > 0 && (s[a] = r, s[a + 1] = i);
414
- } else if (e < 20) for (let i = a; i < n; i++) for (let r = i; r > a; r--) {
415
- let f = s[r - 1], y = s[r];
416
- if (d(f, y) <= 0) break;
417
- s[r - 1] = y, s[r] = f;
418
- }
419
- else g(s, d, a);
420
- }
421
- function v(s, a) {
422
- var n = s;
423
- typeof s == "string" && (n = l.parseSourceMapInput(s));
424
- var e = l.getArg(n, "version"), i = l.getArg(n, "sections");
425
- if (e != this._version) throw new Error("Unsupported version: " + e);
426
- this._sources = new m(), this._names = new m();
427
- var r = { line: -1, column: 0 };
428
- this._sections = i.map(function(f) {
429
- if (f.url) throw new Error("Support for url field in sections not implemented.");
430
- var y = l.getArg(f, "offset"), C = l.getArg(y, "line"), L = l.getArg(y, "column");
431
- if (C < r.line || C === r.line && L < r.column) throw new Error("Section offsets must be ordered and non-overlapping.");
432
- return r = y, { generatedOffset: { generatedLine: C + 1, generatedColumn: L + 1 }, consumer: new t(l.getArg(f, "map"), a) };
433
- });
434
- }
435
- return o.prototype._parseMappings = function(s, a) {
436
- var n, e, i, r, f = 1, y = 0, C = 0, L = 0, S = 0, A = 0, b = s.length, M = 0, w = {}, E = [], O = [];
437
- let T = 0;
438
- for (; M < b; ) if (s.charAt(M) === ";") f++, M++, y = 0, h(O, T), T = O.length;
439
- else if (s.charAt(M) === ",") M++;
440
- else {
441
- for ((n = new c()).generatedLine = f, i = M; i < b && !this._charIsMappingSeparator(s, i); i++) ;
442
- for (s.slice(M, i), e = []; M < i; ) _.decode(s, M, w), r = w.value, M = w.rest, e.push(r);
443
- if (e.length === 2) throw new Error("Found a source, but no line and column");
444
- if (e.length === 3) throw new Error("Found a source and line, but no column");
445
- if (n.generatedColumn = y + e[0], y = n.generatedColumn, e.length > 1 && (n.source = S + e[1], S += e[1], n.originalLine = C + e[2], C = n.originalLine, n.originalLine += 1, n.originalColumn = L + e[3], L = n.originalColumn, e.length > 4 && (n.name = A + e[4], A += e[4])), O.push(n), typeof n.originalLine == "number") {
446
- let x = n.source;
447
- for (; E.length <= x; ) E.push(null);
448
- E[x] === null && (E[x] = []), E[x].push(n);
449
- }
450
- }
451
- h(O, T), this.__generatedMappings = O;
452
- for (var j = 0; j < E.length; j++) E[j] != null && g(E[j], l.compareByOriginalPositionsNoSource);
453
- this.__originalMappings = [].concat(...E);
454
- }, o.prototype._findMapping = function(s, a, n, e, i, r) {
455
- if (s[n] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + s[n]);
456
- if (s[e] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + s[e]);
457
- return p.search(s, a, i, r);
458
- }, o.prototype.computeColumnSpans = function() {
459
- for (var s = 0; s < this._generatedMappings.length; ++s) {
460
- var a = this._generatedMappings[s];
461
- if (s + 1 < this._generatedMappings.length) {
462
- var n = this._generatedMappings[s + 1];
463
- if (a.generatedLine === n.generatedLine) {
464
- a.lastGeneratedColumn = n.generatedColumn - 1;
465
- continue;
466
- }
467
- }
468
- a.lastGeneratedColumn = 1 / 0;
469
- }
470
- }, o.prototype.originalPositionFor = function(s) {
471
- var a = { generatedLine: l.getArg(s, "line"), generatedColumn: l.getArg(s, "column") }, n = this._findMapping(a, this._generatedMappings, "generatedLine", "generatedColumn", l.compareByGeneratedPositionsDeflated, l.getArg(s, "bias", t.GREATEST_LOWER_BOUND));
472
- if (n >= 0) {
473
- var e = this._generatedMappings[n];
474
- if (e.generatedLine === a.generatedLine) {
475
- var i = l.getArg(e, "source", null);
476
- i !== null && (i = this._sources.at(i), i = l.computeSourceURL(this.sourceRoot, i, this._sourceMapURL));
477
- var r = l.getArg(e, "name", null);
478
- return r !== null && (r = this._names.at(r)), { source: i, line: l.getArg(e, "originalLine", null), column: l.getArg(e, "originalColumn", null), name: r };
479
- }
480
- }
481
- return { source: null, line: null, column: null, name: null };
482
- }, o.prototype.hasContentsOfAllSources = function() {
483
- return !!this.sourcesContent && this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function(s) {
484
- return s == null;
485
- });
486
- }, o.prototype.sourceContentFor = function(s, a) {
487
- if (!this.sourcesContent) return null;
488
- var n = this._findSourceIndex(s);
489
- if (n >= 0) return this.sourcesContent[n];
490
- var e, i = s;
491
- if (this.sourceRoot != null && (i = l.relative(this.sourceRoot, i)), this.sourceRoot != null && (e = l.urlParse(this.sourceRoot))) {
492
- var r = i.replace(/^file:\/\//, "");
493
- if (e.scheme == "file" && this._sources.has(r)) return this.sourcesContent[this._sources.indexOf(r)];
494
- if ((!e.path || e.path == "/") && this._sources.has("/" + i)) return this.sourcesContent[this._sources.indexOf("/" + i)];
495
- }
496
- if (a) return null;
497
- throw new Error('"' + i + '" is not in the SourceMap.');
498
- }, o.prototype.generatedPositionFor = function(s) {
499
- var a = l.getArg(s, "source");
500
- if ((a = this._findSourceIndex(a)) < 0) return { line: null, column: null, lastColumn: null };
501
- var n = { source: a, originalLine: l.getArg(s, "line"), originalColumn: l.getArg(s, "column") }, e = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", l.compareByOriginalPositions, l.getArg(s, "bias", t.GREATEST_LOWER_BOUND));
502
- if (e >= 0) {
503
- var i = this._originalMappings[e];
504
- if (i.source === n.source) return { line: l.getArg(i, "generatedLine", null), column: l.getArg(i, "generatedColumn", null), lastColumn: l.getArg(i, "lastGeneratedColumn", null) };
505
- }
506
- return { line: null, column: null, lastColumn: null };
507
- }, R.BasicSourceMapConsumer = o, v.prototype = Object.create(t.prototype), v.prototype.constructor = t, v.prototype._version = 3, Object.defineProperty(v.prototype, "sources", { get: function() {
508
- for (var s = [], a = 0; a < this._sections.length; a++) for (var n = 0; n < this._sections[a].consumer.sources.length; n++) s.push(this._sections[a].consumer.sources[n]);
509
- return s;
510
- } }), v.prototype.originalPositionFor = function(s) {
511
- var a = { generatedLine: l.getArg(s, "line"), generatedColumn: l.getArg(s, "column") }, n = p.search(a, this._sections, function(i, r) {
512
- return i.generatedLine - r.generatedOffset.generatedLine || i.generatedColumn - r.generatedOffset.generatedColumn;
513
- }), e = this._sections[n];
514
- return e ? e.consumer.originalPositionFor({ line: a.generatedLine - (e.generatedOffset.generatedLine - 1), column: a.generatedColumn - (e.generatedOffset.generatedLine === a.generatedLine ? e.generatedOffset.generatedColumn - 1 : 0), bias: s.bias }) : { source: null, line: null, column: null, name: null };
515
- }, v.prototype.hasContentsOfAllSources = function() {
516
- return this._sections.every(function(s) {
517
- return s.consumer.hasContentsOfAllSources();
518
- });
519
- }, v.prototype.sourceContentFor = function(s, a) {
520
- for (var n = 0; n < this._sections.length; n++) {
521
- var e = this._sections[n].consumer.sourceContentFor(s, !0);
522
- if (e || e === "") return e;
523
- }
524
- if (a) return null;
525
- throw new Error('"' + s + '" is not in the SourceMap.');
526
- }, v.prototype.generatedPositionFor = function(s) {
527
- for (var a = 0; a < this._sections.length; a++) {
528
- var n = this._sections[a];
529
- if (n.consumer._findSourceIndex(l.getArg(s, "source")) !== -1) {
530
- var e = n.consumer.generatedPositionFor(s);
531
- if (e) return { line: e.line + (n.generatedOffset.generatedLine - 1), column: e.column + (n.generatedOffset.generatedLine === e.line ? n.generatedOffset.generatedColumn - 1 : 0) };
532
- }
533
- }
534
- return { line: null, column: null };
535
- }, v.prototype._parseMappings = function(s, a) {
536
- this.__generatedMappings = [], this.__originalMappings = [];
537
- for (var n = 0; n < this._sections.length; n++) for (var e = this._sections[n], i = e.consumer._generatedMappings, r = 0; r < i.length; r++) {
538
- var f = i[r], y = e.consumer._sources.at(f.source);
539
- y !== null && (y = l.computeSourceURL(e.consumer.sourceRoot, y, this._sourceMapURL)), this._sources.add(y), y = this._sources.indexOf(y);
540
- var C = null;
541
- f.name && (C = e.consumer._names.at(f.name), this._names.add(C), C = this._names.indexOf(C));
542
- var L = { source: y, generatedLine: f.generatedLine + (e.generatedOffset.generatedLine - 1), generatedColumn: f.generatedColumn + (e.generatedOffset.generatedLine === f.generatedLine ? e.generatedOffset.generatedColumn - 1 : 0), originalLine: f.originalLine, originalColumn: f.originalColumn, name: C };
543
- this.__generatedMappings.push(L), typeof L.originalLine == "number" && this.__originalMappings.push(L);
544
- }
545
- g(this.__generatedMappings, l.compareByGeneratedPositionsDeflated), g(this.__originalMappings, l.compareByOriginalPositions);
546
- }, R.IndexedSourceMapConsumer = v, R;
547
- })().SourceMapConsumer, $.SourceNode = (function() {
548
- if (se) return q;
549
- se = 1;
550
- var l = ne().SourceMapGenerator, p = P(), m = /(\r?\n)/, _ = "$$$isSourceNode$$$";
551
- function g(t, o, c, d, h) {
552
- this.children = [], this.sourceContents = {}, this.line = t ?? null, this.column = o ?? null, this.source = c ?? null, this.name = h ?? null, this[_] = !0, d != null && this.add(d);
553
- }
554
- return g.fromStringWithSourceMap = function(t, o, c) {
555
- var d = new g(), h = t.split(m), v = 0, s = function() {
556
- return r() + (r() || "");
557
- function r() {
558
- return v < h.length ? h[v++] : void 0;
559
- }
560
- }, a = 1, n = 0, e = null;
561
- return o.eachMapping(function(r) {
562
- if (e !== null) {
563
- if (!(a < r.generatedLine)) {
564
- var f = (y = h[v] || "").substr(0, r.generatedColumn - n);
565
- return h[v] = y.substr(r.generatedColumn - n), n = r.generatedColumn, i(e, f), void (e = r);
566
- }
567
- i(e, s()), a++, n = 0;
568
- }
569
- for (; a < r.generatedLine; ) d.add(s()), a++;
570
- if (n < r.generatedColumn) {
571
- var y = h[v] || "";
572
- d.add(y.substr(0, r.generatedColumn)), h[v] = y.substr(r.generatedColumn), n = r.generatedColumn;
573
- }
574
- e = r;
575
- }, this), v < h.length && (e && i(e, s()), d.add(h.splice(v).join(""))), o.sources.forEach(function(r) {
576
- var f = o.sourceContentFor(r);
577
- f != null && (c != null && (r = p.join(c, r)), d.setSourceContent(r, f));
578
- }), d;
579
- function i(r, f) {
580
- if (r === null || r.source === void 0) d.add(f);
581
- else {
582
- var y = c ? p.join(c, r.source) : r.source;
583
- d.add(new g(r.originalLine, r.originalColumn, y, f, r.name));
584
- }
585
- }
586
- }, g.prototype.add = function(t) {
587
- if (Array.isArray(t)) t.forEach(function(o) {
588
- this.add(o);
589
- }, this);
590
- else {
591
- if (!t[_] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
592
- t && this.children.push(t);
593
- }
594
- return this;
595
- }, g.prototype.prepend = function(t) {
596
- if (Array.isArray(t)) for (var o = t.length - 1; o >= 0; o--) this.prepend(t[o]);
597
- else {
598
- if (!t[_] && typeof t != "string") throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + t);
599
- this.children.unshift(t);
600
- }
601
- return this;
602
- }, g.prototype.walk = function(t) {
603
- for (var o, c = 0, d = this.children.length; c < d; c++) (o = this.children[c])[_] ? o.walk(t) : o !== "" && t(o, { source: this.source, line: this.line, column: this.column, name: this.name });
604
- }, g.prototype.join = function(t) {
605
- var o, c, d = this.children.length;
606
- if (d > 0) {
607
- for (o = [], c = 0; c < d - 1; c++) o.push(this.children[c]), o.push(t);
608
- o.push(this.children[c]), this.children = o;
609
- }
610
- return this;
611
- }, g.prototype.replaceRight = function(t, o) {
612
- var c = this.children[this.children.length - 1];
613
- return c[_] ? c.replaceRight(t, o) : typeof c == "string" ? this.children[this.children.length - 1] = c.replace(t, o) : this.children.push("".replace(t, o)), this;
614
- }, g.prototype.setSourceContent = function(t, o) {
615
- this.sourceContents[p.toSetString(t)] = o;
616
- }, g.prototype.walkSourceContents = function(t) {
617
- for (var o = 0, c = this.children.length; o < c; o++) this.children[o][_] && this.children[o].walkSourceContents(t);
618
- var d = Object.keys(this.sourceContents);
619
- for (o = 0, c = d.length; o < c; o++) t(p.fromSetString(d[o]), this.sourceContents[d[o]]);
620
- }, g.prototype.toString = function() {
621
- var t = "";
622
- return this.walk(function(o) {
623
- t += o;
624
- }), t;
625
- }, g.prototype.toStringWithSourceMap = function(t) {
626
- var o = { code: "", line: 1, column: 0 }, c = new l(t), d = !1, h = null, v = null, s = null, a = null;
627
- return this.walk(function(n, e) {
628
- o.code += n, e.source !== null && e.line !== null && e.column !== null ? (h === e.source && v === e.line && s === e.column && a === e.name || c.addMapping({ source: e.source, original: { line: e.line, column: e.column }, generated: { line: o.line, column: o.column }, name: e.name }), h = e.source, v = e.line, s = e.column, a = e.name, d = !0) : d && (c.addMapping({ generated: { line: o.line, column: o.column } }), h = null, d = !1);
629
- for (var i = 0, r = n.length; i < r; i++) n.charCodeAt(i) === 10 ? (o.line++, o.column = 0, i + 1 === r ? (h = null, d = !1) : d && c.addMapping({ source: e.source, original: { line: e.line, column: e.column }, generated: { line: o.line, column: o.column }, name: e.name })) : o.column++;
630
- }), this.walkSourceContents(function(n, e) {
631
- c.setSourceContent(n, e);
632
- }), { code: o.code, map: c };
633
- }, q.SourceNode = g, q;
634
- })().SourceNode), $);
635
- const z = J.default || J, ye = V.default || V;
636
- async function Me(l, p, m = {}) {
637
- const { projectRoot: _ = process.cwd(), includeNodeModules: g = [], debug: t = !1 } = m;
638
- if (p.includes("node_modules") && !g.some((e) => p.includes(`node_modules/${e}`))) return { code: l, modified: !1, functionsWrapped: 0 };
639
- const o = pe(_, p).replace(/\\/g, "/");
640
- let c;
641
- t && console.log(`[FuncSpan Transform] Processing: ${o}`);
642
- try {
643
- c = ce(l, { sourceType: "module", plugins: ["typescript", "jsx", "decorators-legacy", "classProperties", "objectRestSpread", "asyncGenerators", "dynamicImport", "optionalCatchBinding", "optionalChaining", "nullishCoalescingOperator"] });
644
- } catch (e) {
645
- return t && console.error(`[FuncSpan Transform] Parse error in ${o}:`, e), { code: l, modified: !1, functionsWrapped: 0 };
646
- }
647
- let d = null, h = null;
648
- try {
649
- const e = ge(`${p}.map`, "utf-8");
650
- d = await new _e.SourceMapConsumer(JSON.parse(e));
651
- } catch {
652
- }
653
- const v = (e, i) => {
654
- if (d) {
655
- const r = d.originalPositionFor({ line: e, column: i });
656
- if (r.line !== null && r.column !== null) return !h && r.source && (h = r.source), { line: r.line, column: r.column, source: r.source || void 0 };
657
- }
658
- return { line: e, column: i };
659
- };
660
- let s = !1, a = 0;
661
- const n = /* @__PURE__ */ new Set();
662
- if (z(c, { FunctionDeclaration(e) {
663
- const i = e.node.id?.name;
664
- if (!i) return;
665
- const r = `decl_${i}`;
666
- if (n.has(r)) return;
667
- t && console.log(`[FuncSpan Transform] Wrapping function declaration: ${i}`);
668
- const f = e.node.loc?.start.line ?? 0, y = e.node.loc?.start.column ?? 0, C = v(f, y), { line: L, column: S } = C;
669
- let A = p;
670
- C.source && (A = F(I(p), C.source)), !t || L === f && S === y || console.log(`[FuncSpan Transform] Mapped ${f}:${y} → ${L}:${S} in ${A}`);
671
- const b = G(e.node.params), M = u.callExpression(u.identifier("captureFunctionSpan"), [u.identifier(i), u.stringLiteral(i), u.stringLiteral(A), u.objectExpression([u.objectProperty(u.identifier("line"), u.numericLiteral(L)), u.objectProperty(u.identifier("column"), u.numericLiteral(S)), u.objectProperty(u.identifier("paramNames"), u.arrayExpression(b.map((E) => u.stringLiteral(E))))])]), w = u.expressionStatement(u.assignmentExpression("=", u.identifier(i), M));
672
- e.insertAfter(w), s = !0, a++, n.add(r);
673
- }, VariableDeclarator(e) {
674
- const i = e.node.id, r = e.node.init;
675
- if (!u.isIdentifier(i) || !r || !u.isFunctionExpression(r) && !u.isArrowFunctionExpression(r)) return;
676
- const f = i.name, y = `var_${f}`;
677
- if (n.has(y)) return;
678
- t && console.log(`[FuncSpan Transform] Wrapping variable function: ${f}`);
679
- const C = r.loc?.start.line ?? 0, L = r.loc?.start.column ?? 0, S = v(C, L), { line: A, column: b } = S;
680
- let M = p;
681
- S.source && (M = F(I(p), S.source)), !t || A === C && b === L || console.log(`[FuncSpan Transform] Mapped ${C}:${L} → ${A}:${b} in ${M}`);
682
- const w = G(r.params), E = u.callExpression(u.identifier("captureFunctionSpan"), [r, u.stringLiteral(f), u.stringLiteral(M), u.objectExpression([u.objectProperty(u.identifier("line"), u.numericLiteral(A)), u.objectProperty(u.identifier("column"), u.numericLiteral(b)), u.objectProperty(u.identifier("paramNames"), u.arrayExpression(w.map((O) => u.stringLiteral(O))))])]);
683
- e.node.init = E, s = !0, a++, n.add(y);
684
- }, ClassMethod(e) {
685
- if (e.node.kind === "constructor" || e.node.kind === "get" || e.node.kind === "set") return;
686
- const i = u.isIdentifier(e.node.key) ? e.node.key.name : "anonymous", r = `method_${i}_${e.node.start}`;
687
- if (n.has(r)) return;
688
- t && console.log(`[FuncSpan Transform] Wrapping class method: ${i}`);
689
- const f = e.node.body, y = u.functionExpression(null, e.node.params, f, e.node.generator, e.node.async), C = u.callExpression(u.identifier("captureFunctionSpan"), [y, u.stringLiteral(i), u.stringLiteral(o)]), L = u.blockStatement([u.returnStatement(u.callExpression(u.memberExpression(C, u.identifier("call")), [u.thisExpression(), u.spreadElement(u.identifier("arguments"))]))]);
690
- e.node.body = L, s = !0, a++, n.add(r);
691
- }, ObjectMethod(e) {
692
- if (e.node.kind === "get" || e.node.kind === "set") return;
693
- const i = u.isIdentifier(e.node.key) ? e.node.key.name : u.isStringLiteral(e.node.key) ? e.node.key.value : "anonymous", r = `objmethod_${i}_${e.node.start}`;
694
- if (n.has(r)) return;
695
- t && console.log(`[FuncSpan Transform] Wrapping object method: ${i}`);
696
- const f = e.node.loc?.start.line ?? 0, y = e.node.loc?.start.column ?? 0, C = v(f, y), { line: L, column: S } = C;
697
- let A = p;
698
- C.source && (A = F(I(p), C.source));
699
- const b = G(e.node.params), M = u.functionExpression(u.identifier(i), e.node.params, e.node.body, e.node.generator, e.node.async), w = u.callExpression(u.identifier("captureFunctionSpan"), [M, u.stringLiteral(i), u.stringLiteral(A), u.objectExpression([u.objectProperty(u.identifier("line"), u.numericLiteral(L)), u.objectProperty(u.identifier("column"), u.numericLiteral(S)), u.objectProperty(u.identifier("paramNames"), u.arrayExpression(b.map((O) => u.stringLiteral(O))))])]), E = u.objectProperty(e.node.key, w, e.node.computed, !1);
700
- e.replaceWith(E), s = !0, a++, n.add(r);
701
- }, ClassProperty(e) {
702
- const i = e.node.key, r = e.node.value;
703
- if (!u.isIdentifier(i) || !r || !u.isFunctionExpression(r) && !u.isArrowFunctionExpression(r)) return;
704
- const f = i.name, y = `classprop_${f}_${e.node.start}`;
705
- if (n.has(y)) return;
706
- t && console.log(`[FuncSpan Transform] Wrapping class property function: ${f}`);
707
- const C = r.loc?.start.line ?? 0, L = r.loc?.start.column ?? 0, S = v(C, L), { line: A, column: b } = S;
708
- let M = p;
709
- S.source && (M = F(I(p), S.source));
710
- const w = G(r.params), E = u.callExpression(u.identifier("captureFunctionSpan"), [r, u.stringLiteral(f), u.stringLiteral(M), u.objectExpression([u.objectProperty(u.identifier("line"), u.numericLiteral(A)), u.objectProperty(u.identifier("column"), u.numericLiteral(b)), u.objectProperty(u.identifier("paramNames"), u.arrayExpression(w.map((O) => u.stringLiteral(O))))])]);
711
- e.node.value = E, s = !0, a++, n.add(y);
712
- } }), s && !(function(e) {
713
- let i = !1;
714
- return z(e, { ImportDeclaration(r) {
715
- u.isStringLiteral(r.node.source) && r.node.source.value === "@sailfish-ai/sf-veritas" && r.node.specifiers.some((f) => u.isImportSpecifier(f) && u.isIdentifier(f.imported) && f.imported.name === "captureFunctionSpan") && (i = !0, r.stop());
716
- }, VariableDeclarator(r) {
717
- if (u.isObjectPattern(r.node.id) && u.isCallExpression(r.node.init) && u.isIdentifier(r.node.init.callee) && r.node.init.callee.name === "require") {
718
- const f = r.node.init.arguments;
719
- f.length > 0 && u.isStringLiteral(f[0]) && f[0].value === "@sailfish-ai/sf-veritas" && r.node.id.properties.some((y) => u.isObjectProperty(y) && u.isIdentifier(y.key) && y.key.name === "captureFunctionSpan") && (i = !0, r.stop());
720
- }
721
- } }), i;
722
- })(c)) if ((function(e) {
723
- let i = !1;
724
- return z(e, { CallExpression(r) {
725
- u.isIdentifier(r.node.callee) && r.node.callee.name === "require" && (i = !0, r.stop());
726
- }, MemberExpression(r) {
727
- !u.isIdentifier(r.node.object) || r.node.object.name !== "module" && r.node.object.name !== "exports" || (i = !0, r.stop());
728
- } }), i;
729
- })(c)) {
730
- const e = u.variableDeclaration("const", [u.variableDeclarator(u.objectPattern([u.objectProperty(u.identifier("captureFunctionSpan"), u.identifier("captureFunctionSpan"), !1, !0)]), u.callExpression(u.identifier("require"), [u.stringLiteral("@sailfish-ai/sf-veritas")]))]);
731
- c.program.body.unshift(e);
732
- } else {
733
- const e = u.importDeclaration([u.importSpecifier(u.identifier("captureFunctionSpan"), u.identifier("captureFunctionSpan"))], u.stringLiteral("@sailfish-ai/sf-veritas"));
734
- c.program.body.unshift(e);
735
- }
736
- if (a > 0) {
737
- const e = ye(c, { retainLines: !0, compact: !1, sourceMaps: !0, sourceFileName: p }, l);
738
- return t && console.log(`[FuncSpan Transform] ✅ Wrapped ${a} functions in ${o}`), { code: e.code, map: e.map, modified: !0, functionsWrapped: a };
739
- }
740
- return { code: l, modified: !1, functionsWrapped: 0 };
741
- }
742
- function G(l) {
743
- const p = [];
744
- for (const m of l) u.isIdentifier(m) ? p.push(m.name) : u.isRestElement(m) && u.isIdentifier(m.argument) ? p.push(`...${m.argument.name}`) : u.isAssignmentPattern(m) && u.isIdentifier(m.left) ? p.push(m.left.name) : u.isObjectPattern(m) ? p.push("{}") : u.isArrayPattern(m) ? p.push("[]") : p.push("_");
745
- return p;
746
- }
747
- export {
748
- _e as s,
749
- Me as t
750
- };