@sailfish-ai/sf-veritas 0.2.7 → 0.2.9

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 (40) hide show
  1. package/dist/contextManager-CEPhVu9T.js +197 -0
  2. package/dist/contextManager-CGINtRN5.cjs +1 -0
  3. package/dist/funcSpanTransformer-B9WWl-g1.cjs +1 -0
  4. package/dist/funcSpanTransformer-CWNEWRxq.js +225 -0
  5. package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -1
  6. package/dist/plugins/funcspanEsbuildPlugin.mjs +17 -11
  7. package/dist/plugins/funcspanRollupPlugin.cjs +1 -1
  8. package/dist/plugins/funcspanRollupPlugin.mjs +13 -8
  9. package/dist/plugins/funcspanTscPlugin.cjs +1 -1
  10. package/dist/plugins/funcspanTscPlugin.mjs +19 -14
  11. package/dist/plugins/funcspanVitePlugin.cjs +1 -1
  12. package/dist/plugins/funcspanVitePlugin.mjs +15 -10
  13. package/dist/plugins/funcspanWebpackLoader.cjs +1 -1
  14. package/dist/plugins/funcspanWebpackLoader.mjs +1 -1
  15. package/dist/plugins/funcspanWebpackPlugin.cjs +1 -1
  16. package/dist/plugins/funcspanWebpackPlugin.mjs +22 -17
  17. package/dist/runtime/funcspanRegister.cjs +276 -0
  18. package/dist/runtimeConfig-CpQ27dZD.cjs +8 -0
  19. package/dist/runtimeConfig-emBNO3lJ.js +350 -0
  20. package/dist/sf-veritas.cjs +18 -18
  21. package/dist/sf-veritas.mjs +417 -619
  22. package/dist/source-map-Cr6YkjTd.js +631 -0
  23. package/dist/source-map-rHHEdpre.cjs +1 -0
  24. package/dist/types/dataTransmitter.d.ts +1 -0
  25. package/dist/types/funcSpanConfigLoader.d.ts +10 -0
  26. package/dist/types/index.d.ts +3 -1
  27. package/dist/types/logHandler.d.ts +5 -0
  28. package/dist/types/plugins/funcSpanTransformer.d.ts +13 -0
  29. package/dist/types/runtime/instrumentationDetector.d.ts +33 -0
  30. package/dist/types/runtime/runtimeConfig.d.ts +48 -0
  31. package/dist/types/sourceLocation.d.ts +30 -0
  32. package/dist/worker-pool-capture.cjs +1 -1
  33. package/dist/worker-pool-capture.mjs +1 -1
  34. package/dist/workerPoolSpanCapture-B5KN-q4b.js +528 -0
  35. package/dist/workerPoolSpanCapture-Dg_WGjmO.cjs +86 -0
  36. package/package.json +5 -2
  37. package/dist/funcSpanTransformer-BLhIRZqX.js +0 -765
  38. package/dist/funcSpanTransformer-BpWuHXKT.cjs +0 -1
  39. package/dist/workerPoolSpanCapture-D0-0Z0Jw.js +0 -718
  40. package/dist/workerPoolSpanCapture-DEwlTq0a.cjs +0 -86
@@ -1,765 +0,0 @@
1
- import { parse as pe } from "@babel/parser";
2
- import J from "@babel/traverse";
3
- import V from "@babel/generator";
4
- import * as s from "@babel/types";
5
- import { relative as ge, resolve as P, dirname as R } from "path";
6
- import { readFileSync as de } from "fs";
7
- var K, Q, N = {}, D = {}, k = {}, T = {};
8
- function fe() {
9
- if (K) return T;
10
- K = 1;
11
- var l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");
12
- return T.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
- }, T.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
- }, T;
18
- }
19
- function le() {
20
- if (Q) return k;
21
- Q = 1;
22
- var l = fe();
23
- return k.encode = function(p) {
24
- var m, _ = "", d = (function(t) {
25
- return t < 0 ? 1 + (-t << 1) : 0 + (t << 1);
26
- })(p);
27
- do
28
- m = 31 & d, (d >>>= 5) > 0 && (m |= 32), _ += l.encode(m);
29
- while (d > 0);
30
- return _;
31
- }, k.decode = function(p, m, _) {
32
- var d, t, o, c, f = p.length, h = 0, v = 0;
33
- do {
34
- if (m >= f) 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
- d = !!(32 & t), h += (t &= 31) << v, v += 5;
37
- } while (d);
38
- _.value = (c = (o = h) >> 1, 1 & ~o ? c : -c), _.rest = m;
39
- }, k;
40
- }
41
- var H, X = {};
42
- function F() {
43
- return H || (H = 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 d(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 = d;
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), g = [], y = 0, C = 0; ; ) {
66
- if (y = C, (C = e.indexOf("/", y)) === -1) {
67
- g.push(e.slice(y));
68
- break;
69
- }
70
- for (g.push(e.slice(y, C)); C < e.length && e[C] === "/"; ) C++;
71
- }
72
- var L, S = 0;
73
- for (C = g.length - 1; C >= 0; C--) (L = g[C]) === "." ? g.splice(C, 1) : L === ".." ? S++ : S > 0 && (L === "" ? (g.splice(C + 1, S), S = 0) : (g.splice(C, 2), S--));
74
- return (e = g.join("/")) === "" && (e = r ? "/" : "."), i ? (i.path = e, d(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 f(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), d(i);
87
- if (i || e.match(m)) return e;
88
- if (r && !r.host && !r.path) return r.host = e, d(r);
89
- var g = e.charAt(0) === "/" ? e : c(n.replace(/\/+$/, "") + "/" + e);
90
- return r ? (r.path = g, d(r)) : g;
91
- }
92
- l.normalize = c, l.join = f, 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 a(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 u(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 a(n) ? "$" + n : n;
119
- }, l.fromSetString = h ? v : function(n) {
120
- return a(n) ? n.slice(1) : n;
121
- }, l.compareByOriginalPositions = function(n, e, i) {
122
- var r = u(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 : u(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 : u(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 = u(n.source, e.source)) !== 0 || (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 ? r : u(n.name, e.name);
130
- }, l.compareByGeneratedPositionsDeflatedNoLine = function(n, e, i) {
131
- var r = n.generatedColumn - e.generatedColumn;
132
- return r !== 0 || i || (r = u(n.source, e.source)) !== 0 || (r = n.originalLine - e.originalLine) !== 0 || (r = n.originalColumn - e.originalColumn) !== 0 ? r : u(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 = u(n.source, e.source)) !== 0 || (i = n.originalLine - e.originalLine) !== 0 || (i = n.originalColumn - e.originalColumn) !== 0 ? i : u(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 g = r.path.lastIndexOf("/");
144
- g >= 0 && (r.path = r.path.substring(0, g + 1));
145
- }
146
- e = f(d(r), e);
147
- }
148
- return c(e);
149
- };
150
- })(X)), X;
151
- }
152
- var Y, U = {};
153
- function ce() {
154
- if (Y) return U;
155
- Y = 1;
156
- var l = F(), 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(d, t) {
161
- for (var o = new _(), c = 0, f = d.length; c < f; c++) o.add(d[c], t);
162
- return o;
163
- }, _.prototype.size = function() {
164
- return m ? this._set.size : Object.getOwnPropertyNames(this._set).length;
165
- }, _.prototype.add = function(d, t) {
166
- var o = m ? d : l.toSetString(d), c = m ? this.has(d) : p.call(this._set, o), f = this._array.length;
167
- c && !t || this._array.push(d), c || (m ? this._set.set(d, f) : this._set[o] = f);
168
- }, _.prototype.has = function(d) {
169
- if (m) return this._set.has(d);
170
- var t = l.toSetString(d);
171
- return p.call(this._set, t);
172
- }, _.prototype.indexOf = function(d) {
173
- if (m) {
174
- var t = this._set.get(d);
175
- if (t >= 0) return t;
176
- } else {
177
- var o = l.toSetString(d);
178
- if (p.call(this._set, o)) return this._set[o];
179
- }
180
- throw new Error('"' + d + '" is not in the set.');
181
- }, _.prototype.at = function(d) {
182
- if (d >= 0 && d < this._array.length) return this._array[d];
183
- throw new Error("No element indexed by " + d);
184
- }, _.prototype.toArray = function() {
185
- return this._array.slice();
186
- }, U.ArraySet = _, U;
187
- }
188
- var Z, ee, B = {};
189
- function he() {
190
- if (Z) return B;
191
- Z = 1;
192
- var l = F();
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 _, d, t, o, c, f;
200
- _ = this._last, d = m, t = _.generatedLine, o = d.generatedLine, c = _.generatedColumn, f = d.generatedColumn, o > t || o == t && f >= c || l.compareByGeneratedPositionsInflated(_, d) <= 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 = le(), p = F(), m = ce().ArraySet, _ = he().MappingList;
209
- function d(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 d.prototype._version = 3, d.fromSourceMap = function(t, o) {
213
- var c = t.sourceRoot, f = new d(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)), f.addMapping(v);
217
- }), t.sources.forEach(function(h) {
218
- var v = h;
219
- c !== null && (v = p.relative(c, h)), f._sources.has(v) || f._sources.add(v);
220
- var a = t.sourceContentFor(h);
221
- a != null && f.setSourceContent(h, a);
222
- }), f;
223
- }, d.prototype.addMapping = function(t) {
224
- var o = p.getArg(t, "generated"), c = p.getArg(t, "original", null), f = p.getArg(t, "source", null), h = p.getArg(t, "name", null);
225
- (this._skipValidation || this._validateMapping(o, c, f, h) !== !1) && (f != null && (f = String(f), this._sources.has(f) || this._sources.add(f)), 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: f, name: h }));
226
- }, d.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
- }, d.prototype.applySourceMap = function(t, o, c) {
230
- var f = 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
- f = t.file;
234
- }
235
- var h = this._sourceRoot;
236
- h != null && (f = p.relative(h, f));
237
- var v = new m(), a = new m();
238
- this._mappings.unsortedForEach(function(u) {
239
- if (u.source === f && u.originalLine != null) {
240
- var n = t.originalPositionFor({ line: u.originalLine, column: u.originalColumn });
241
- n.source != null && (u.source = n.source, c != null && (u.source = p.join(c, u.source)), h != null && (u.source = p.relative(h, u.source)), u.originalLine = n.line, u.originalColumn = n.column, n.name != null && (u.name = n.name));
242
- }
243
- var e = u.source;
244
- e == null || v.has(e) || v.add(e);
245
- var i = u.name;
246
- i == null || a.has(i) || a.add(i);
247
- }, this), this._sources = v, this._names = a, t.sources.forEach(function(u) {
248
- var n = t.sourceContentFor(u);
249
- n != null && (c != null && (u = p.join(c, u)), h != null && (u = p.relative(h, u)), this.setSourceContent(u, n));
250
- }, this);
251
- }, d.prototype._validateMapping = function(t, o, c, f) {
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 || f) && !(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: f }), this._ignoreInvalidMapping) return typeof console < "u" && console.warn && console.warn(h), !1;
259
- throw new Error(h);
260
- }
261
- }, d.prototype._serializeMappings = function() {
262
- for (var t, o, c, f, h = 0, v = 1, a = 0, u = 0, n = 0, e = 0, i = "", r = this._mappings.toArray(), g = 0, y = r.length; g < y; g++) {
263
- if (t = "", (o = r[g]).generatedLine !== v) for (h = 0; o.generatedLine !== v; ) t += ";", v++;
264
- else if (g > 0) {
265
- if (!p.compareByGeneratedPositionsInflated(o, r[g - 1])) continue;
266
- t += ",";
267
- }
268
- t += l.encode(o.generatedColumn - h), h = o.generatedColumn, o.source != null && (f = this._sources.indexOf(o.source), t += l.encode(f - e), e = f, t += l.encode(o.originalLine - 1 - u), u = o.originalLine - 1, t += l.encode(o.originalColumn - a), a = 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
- }, d.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 f = p.toSetString(c);
276
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, f) ? this._sourcesContents[f] : null;
277
- }, this);
278
- }, d.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
- }, d.prototype.toString = function() {
282
- return JSON.stringify(this.toJSON());
283
- }, D.SourceMapGenerator = d, D;
284
- }
285
- var re, j = {}, te = {};
286
- function me() {
287
- return re || (re = 1, (function(l) {
288
- function p(m, _, d, t, o, c) {
289
- var f = Math.floor((_ - m) / 2) + m, h = o(d, t[f], !0);
290
- return h === 0 ? f : h > 0 ? _ - f > 1 ? p(f, _, d, t, o, c) : c == l.LEAST_UPPER_BOUND ? _ < t.length ? _ : -1 : f : f - m > 1 ? p(m, f, d, t, o, c) : c == l.LEAST_UPPER_BOUND ? f : m < 0 ? -1 : m;
291
- }
292
- l.GREATEST_LOWER_BOUND = 1, l.LEAST_UPPER_BOUND = 2, l.search = function(m, _, d, t) {
293
- if (_.length === 0) return -1;
294
- var o = p(-1, _.length, m, _, d, t || l.GREATEST_LOWER_BOUND);
295
- if (o < 0) return -1;
296
- for (; o - 1 >= 0 && d(_[o], _[o - 1], !0) === 0; ) --o;
297
- return o;
298
- };
299
- })(te)), te;
300
- }
301
- var oe, ie, W = {};
302
- function _e() {
303
- if (oe) return W;
304
- function l(m) {
305
- function _(d, t, o) {
306
- var c = d[t];
307
- d[t] = d[o], d[o] = c;
308
- }
309
- return function d(t, o, c, f) {
310
- if (c < f) {
311
- var h = c - 1;
312
- _(t, (n = c, e = f, Math.round(n + Math.random() * (e - n))), f);
313
- for (var v = t[f], a = c; a < f; a++) o(t[a], v, !1) <= 0 && _(t, h += 1, a);
314
- _(t, h + 1, a);
315
- var u = h + 1;
316
- d(t, o, c, u - 1), d(t, o, u + 1, f);
317
- }
318
- var n, e;
319
- };
320
- }
321
- oe = 1;
322
- let p = /* @__PURE__ */ new WeakMap();
323
- return W.quickSort = function(m, _, d = 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, _, d, m.length - 1);
329
- }, W;
330
- }
331
- var se, ae, z = {}, ye = (ae || (ae = 1, N.SourceMapGenerator = ne().SourceMapGenerator, N.SourceMapConsumer = (function() {
332
- if (ie) return j;
333
- ie = 1;
334
- var l = F(), p = me(), m = ce().ArraySet, _ = le(), d = _e().quickSort;
335
- function t(a, u) {
336
- var n = a;
337
- return typeof a == "string" && (n = l.parseSourceMapInput(a)), n.sections != null ? new v(n, u) : new o(n, u);
338
- }
339
- function o(a, u) {
340
- var n = a;
341
- typeof a == "string" && (n = l.parseSourceMapInput(a));
342
- var e = l.getArg(n, "version"), i = l.getArg(n, "sources"), r = l.getArg(n, "names", []), g = 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
- g && (g = l.normalize(g)), i = i.map(String).map(l.normalize).map(function(S) {
345
- return g && l.isAbsolute(g) && l.isAbsolute(S) ? l.relative(g, 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(g, S, u);
348
- }), this.sourceRoot = g, this.sourcesContent = y, this._mappings = C, this._sourceMapURL = u, 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(a, u) {
354
- return o.fromSourceMap(a, u);
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(a, u) {
360
- var n = a.charAt(u);
361
- return n === ";" || n === ",";
362
- }, t.prototype._parseMappings = function(a, u) {
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(a, u, n) {
365
- var e, i = u || 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, g = a.bind(i), y = this._names, C = this._sources, L = this._sourceMapURL, S = 0, b = e.length; S < b; S++) {
377
- var M = e[S], A = M.source === null ? null : C.at(M.source);
378
- A !== null && (A = l.computeSourceURL(r, A, L)), g({ source: A, generatedLine: M.generatedLine, generatedColumn: M.generatedColumn, originalLine: M.originalLine, originalColumn: M.originalColumn, name: M.name === null ? null : y.at(M.name) });
379
- }
380
- }, t.prototype.allGeneratedPositionsFor = function(a) {
381
- var u = l.getArg(a, "line"), n = { source: l.getArg(a, "source"), originalLine: u, originalColumn: l.getArg(a, "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 (a.column === void 0) for (var g = r.originalLine; r && r.originalLine === g; ) 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 === u && 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
- }, j.SourceMapConsumer = t, o.prototype = Object.create(t.prototype), o.prototype.consumer = t, o.prototype._findSourceIndex = function(a) {
391
- var u, n = a;
392
- if (this.sourceRoot != null && (n = l.relative(this.sourceRoot, n)), this._sources.has(n)) return this._sources.indexOf(n);
393
- for (u = 0; u < this._absoluteSources.length; ++u) if (this._absoluteSources[u] == a) return u;
394
- return -1;
395
- }, o.fromSourceMap = function(a, u) {
396
- var n = Object.create(o.prototype), e = n._names = m.fromArray(a._names.toArray(), !0), i = n._sources = m.fromArray(a._sources.toArray(), !0);
397
- n.sourceRoot = a._sourceRoot, n.sourcesContent = a._generateSourcesContent(n._sources.toArray(), n.sourceRoot), n.file = a._file, n._sourceMapURL = u, n._absoluteSources = n._sources.toArray().map(function(M) {
398
- return l.computeSourceURL(n.sourceRoot, M, u);
399
- });
400
- for (var r = a._mappings.toArray().slice(), g = n.__generatedMappings = [], y = n.__originalMappings = [], C = 0, L = r.length; C < L; C++) {
401
- var S = r[C], b = new c();
402
- b.generatedLine = S.generatedLine, b.generatedColumn = S.generatedColumn, S.source && (b.source = i.indexOf(S.source), b.originalLine = S.originalLine, b.originalColumn = S.originalColumn, S.name && (b.name = e.indexOf(S.name)), y.push(b)), g.push(b);
403
- }
404
- return d(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 f = l.compareByGeneratedPositionsDeflatedNoLine;
409
- function h(a, u) {
410
- let n = a.length, e = a.length - u;
411
- if (!(e <= 1)) if (e == 2) {
412
- let i = a[u], r = a[u + 1];
413
- f(i, r) > 0 && (a[u] = r, a[u + 1] = i);
414
- } else if (e < 20) for (let i = u; i < n; i++) for (let r = i; r > u; r--) {
415
- let g = a[r - 1], y = a[r];
416
- if (f(g, y) <= 0) break;
417
- a[r - 1] = y, a[r] = g;
418
- }
419
- else d(a, f, u);
420
- }
421
- function v(a, u) {
422
- var n = a;
423
- typeof a == "string" && (n = l.parseSourceMapInput(a));
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(g) {
429
- if (g.url) throw new Error("Support for url field in sections not implemented.");
430
- var y = l.getArg(g, "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(g, "map"), u) };
433
- });
434
- }
435
- return o.prototype._parseMappings = function(a, u) {
436
- var n, e, i, r, g = 1, y = 0, C = 0, L = 0, S = 0, b = 0, M = a.length, A = 0, w = {}, E = [], O = [];
437
- let G = 0;
438
- for (; A < M; ) if (a.charAt(A) === ";") g++, A++, y = 0, h(O, G), G = O.length;
439
- else if (a.charAt(A) === ",") A++;
440
- else {
441
- for ((n = new c()).generatedLine = g, i = A; i < M && !this._charIsMappingSeparator(a, i); i++) ;
442
- for (a.slice(A, i), e = []; A < i; ) _.decode(a, A, w), r = w.value, A = 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 = b + e[4], b += e[4])), O.push(n), typeof n.originalLine == "number") {
446
- let $ = n.source;
447
- for (; E.length <= $; ) E.push(null);
448
- E[$] === null && (E[$] = []), E[$].push(n);
449
- }
450
- }
451
- h(O, G), this.__generatedMappings = O;
452
- for (var I = 0; I < E.length; I++) E[I] != null && d(E[I], l.compareByOriginalPositionsNoSource);
453
- this.__originalMappings = [].concat(...E);
454
- }, o.prototype._findMapping = function(a, u, n, e, i, r) {
455
- if (a[n] <= 0) throw new TypeError("Line must be greater than or equal to 1, got " + a[n]);
456
- if (a[e] < 0) throw new TypeError("Column must be greater than or equal to 0, got " + a[e]);
457
- return p.search(a, u, i, r);
458
- }, o.prototype.computeColumnSpans = function() {
459
- for (var a = 0; a < this._generatedMappings.length; ++a) {
460
- var u = this._generatedMappings[a];
461
- if (a + 1 < this._generatedMappings.length) {
462
- var n = this._generatedMappings[a + 1];
463
- if (u.generatedLine === n.generatedLine) {
464
- u.lastGeneratedColumn = n.generatedColumn - 1;
465
- continue;
466
- }
467
- }
468
- u.lastGeneratedColumn = 1 / 0;
469
- }
470
- }, o.prototype.originalPositionFor = function(a) {
471
- var u = { generatedLine: l.getArg(a, "line"), generatedColumn: l.getArg(a, "column") }, n = this._findMapping(u, this._generatedMappings, "generatedLine", "generatedColumn", l.compareByGeneratedPositionsDeflated, l.getArg(a, "bias", t.GREATEST_LOWER_BOUND));
472
- if (n >= 0) {
473
- var e = this._generatedMappings[n];
474
- if (e.generatedLine === u.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(a) {
484
- return a == null;
485
- });
486
- }, o.prototype.sourceContentFor = function(a, u) {
487
- if (!this.sourcesContent) return null;
488
- var n = this._findSourceIndex(a);
489
- if (n >= 0) return this.sourcesContent[n];
490
- var e, i = a;
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 (u) return null;
497
- throw new Error('"' + i + '" is not in the SourceMap.');
498
- }, o.prototype.generatedPositionFor = function(a) {
499
- var u = l.getArg(a, "source");
500
- if ((u = this._findSourceIndex(u)) < 0) return { line: null, column: null, lastColumn: null };
501
- var n = { source: u, originalLine: l.getArg(a, "line"), originalColumn: l.getArg(a, "column") }, e = this._findMapping(n, this._originalMappings, "originalLine", "originalColumn", l.compareByOriginalPositions, l.getArg(a, "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
- }, j.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 a = [], u = 0; u < this._sections.length; u++) for (var n = 0; n < this._sections[u].consumer.sources.length; n++) a.push(this._sections[u].consumer.sources[n]);
509
- return a;
510
- } }), v.prototype.originalPositionFor = function(a) {
511
- var u = { generatedLine: l.getArg(a, "line"), generatedColumn: l.getArg(a, "column") }, n = p.search(u, 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: u.generatedLine - (e.generatedOffset.generatedLine - 1), column: u.generatedColumn - (e.generatedOffset.generatedLine === u.generatedLine ? e.generatedOffset.generatedColumn - 1 : 0), bias: a.bias }) : { source: null, line: null, column: null, name: null };
515
- }, v.prototype.hasContentsOfAllSources = function() {
516
- return this._sections.every(function(a) {
517
- return a.consumer.hasContentsOfAllSources();
518
- });
519
- }, v.prototype.sourceContentFor = function(a, u) {
520
- for (var n = 0; n < this._sections.length; n++) {
521
- var e = this._sections[n].consumer.sourceContentFor(a, !0);
522
- if (e || e === "") return e;
523
- }
524
- if (u) return null;
525
- throw new Error('"' + a + '" is not in the SourceMap.');
526
- }, v.prototype.generatedPositionFor = function(a) {
527
- for (var u = 0; u < this._sections.length; u++) {
528
- var n = this._sections[u];
529
- if (n.consumer._findSourceIndex(l.getArg(a, "source")) !== -1) {
530
- var e = n.consumer.generatedPositionFor(a);
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(a, u) {
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 g = i[r], y = e.consumer._sources.at(g.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
- g.name && (C = e.consumer._names.at(g.name), this._names.add(C), C = this._names.indexOf(C));
542
- var L = { source: y, generatedLine: g.generatedLine + (e.generatedOffset.generatedLine - 1), generatedColumn: g.generatedColumn + (e.generatedOffset.generatedLine === g.generatedLine ? e.generatedOffset.generatedColumn - 1 : 0), originalLine: g.originalLine, originalColumn: g.originalColumn, name: C };
543
- this.__generatedMappings.push(L), typeof L.originalLine == "number" && this.__originalMappings.push(L);
544
- }
545
- d(this.__generatedMappings, l.compareByGeneratedPositionsDeflated), d(this.__originalMappings, l.compareByOriginalPositions);
546
- }, j.IndexedSourceMapConsumer = v, j;
547
- })().SourceMapConsumer, N.SourceNode = (function() {
548
- if (se) return z;
549
- se = 1;
550
- var l = ne().SourceMapGenerator, p = F(), m = /(\r?\n)/, _ = "$$$isSourceNode$$$";
551
- function d(t, o, c, f, h) {
552
- this.children = [], this.sourceContents = {}, this.line = t ?? null, this.column = o ?? null, this.source = c ?? null, this.name = h ?? null, this[_] = !0, f != null && this.add(f);
553
- }
554
- return d.fromStringWithSourceMap = function(t, o, c) {
555
- var f = new d(), h = t.split(m), v = 0, a = function() {
556
- return r() + (r() || "");
557
- function r() {
558
- return v < h.length ? h[v++] : void 0;
559
- }
560
- }, u = 1, n = 0, e = null;
561
- return o.eachMapping(function(r) {
562
- if (e !== null) {
563
- if (!(u < r.generatedLine)) {
564
- var g = (y = h[v] || "").substr(0, r.generatedColumn - n);
565
- return h[v] = y.substr(r.generatedColumn - n), n = r.generatedColumn, i(e, g), void (e = r);
566
- }
567
- i(e, a()), u++, n = 0;
568
- }
569
- for (; u < r.generatedLine; ) f.add(a()), u++;
570
- if (n < r.generatedColumn) {
571
- var y = h[v] || "";
572
- f.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, a()), f.add(h.splice(v).join(""))), o.sources.forEach(function(r) {
576
- var g = o.sourceContentFor(r);
577
- g != null && (c != null && (r = p.join(c, r)), f.setSourceContent(r, g));
578
- }), f;
579
- function i(r, g) {
580
- if (r === null || r.source === void 0) f.add(g);
581
- else {
582
- var y = c ? p.join(c, r.source) : r.source;
583
- f.add(new d(r.originalLine, r.originalColumn, y, g, r.name));
584
- }
585
- }
586
- }, d.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
- }, d.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
- }, d.prototype.walk = function(t) {
603
- for (var o, c = 0, f = this.children.length; c < f; c++) (o = this.children[c])[_] ? o.walk(t) : o !== "" && t(o, { source: this.source, line: this.line, column: this.column, name: this.name });
604
- }, d.prototype.join = function(t) {
605
- var o, c, f = this.children.length;
606
- if (f > 0) {
607
- for (o = [], c = 0; c < f - 1; c++) o.push(this.children[c]), o.push(t);
608
- o.push(this.children[c]), this.children = o;
609
- }
610
- return this;
611
- }, d.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
- }, d.prototype.setSourceContent = function(t, o) {
615
- this.sourceContents[p.toSetString(t)] = o;
616
- }, d.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 f = Object.keys(this.sourceContents);
619
- for (o = 0, c = f.length; o < c; o++) t(p.fromSetString(f[o]), this.sourceContents[f[o]]);
620
- }, d.prototype.toString = function() {
621
- var t = "";
622
- return this.walk(function(o) {
623
- t += o;
624
- }), t;
625
- }, d.prototype.toStringWithSourceMap = function(t) {
626
- var o = { code: "", line: 1, column: 0 }, c = new l(t), f = !1, h = null, v = null, a = null, u = 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 && a === e.column && u === 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, a = e.column, u = e.name, f = !0) : f && (c.addMapping({ generated: { line: o.line, column: o.column } }), h = null, f = !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, f = !1) : f && 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
- }, z.SourceNode = d, z;
634
- })().SourceNode), N);
635
- const ue = /* @__PURE__ */ new Set(["register", "setupInterceptors", "initializeConfigLoader", "initializeWorkerPoolPatching"]), ve = [/instrumentation\.(ts|js|tsx|jsx)$/, /unifiedInterceptor\.(ts|js)$/], q = J.default || J, Ce = V.default || V;
636
- async function Ee(l, p, m = {}) {
637
- const { projectRoot: _ = process.cwd(), includeNodeModules: d = [], debug: t = !1 } = m;
638
- if (p.includes("node_modules") && !d.some((e) => p.includes(`node_modules/${e}`))) return { code: l, modified: !1, functionsWrapped: 0 };
639
- if (ve.some((e) => e.test(p))) return t && console.log(`[FuncSpan Transform] SKIPPING instrumentation entry point file: ${p}`), { code: l, modified: !1, functionsWrapped: 0 };
640
- const o = ge(_, p).replace(/\\/g, "/");
641
- let c;
642
- t && console.log(`[FuncSpan Transform] Processing: ${o}`);
643
- try {
644
- c = pe(l, { sourceType: "module", plugins: ["typescript", "jsx", "decorators-legacy", "classProperties", "objectRestSpread", "asyncGenerators", "dynamicImport", "optionalCatchBinding", "optionalChaining", "nullishCoalescingOperator"] });
645
- } catch (e) {
646
- return t && console.error(`[FuncSpan Transform] Parse error in ${o}:`, e), { code: l, modified: !1, functionsWrapped: 0 };
647
- }
648
- let f = null, h = null;
649
- try {
650
- const e = de(`${p}.map`, "utf-8");
651
- f = await new ye.SourceMapConsumer(JSON.parse(e));
652
- } catch {
653
- }
654
- const v = (e, i) => {
655
- if (f) {
656
- const r = f.originalPositionFor({ line: e, column: i });
657
- 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 };
658
- }
659
- return { line: e, column: i };
660
- };
661
- let a = !1, u = 0;
662
- const n = /* @__PURE__ */ new Set();
663
- if (q(c, { FunctionDeclaration(e) {
664
- const i = e.node.id?.name;
665
- if (!i) return;
666
- if (ue.has(i)) return void (t && console.log(`[FuncSpan Transform] SKIPPING entry point function: ${i}`));
667
- const r = `decl_${i}`;
668
- if (n.has(r)) return;
669
- t && console.log(`[FuncSpan Transform] Wrapping function declaration: ${i}`);
670
- const g = e.node.loc?.start.line ?? 0, y = e.node.loc?.start.column ?? 0, C = v(g, y), { line: L, column: S } = C;
671
- let b = p;
672
- C.source && (b = P(R(p), C.source)), !t || L === g && S === y || console.log(`[FuncSpan Transform] Mapped ${g}:${y} → ${L}:${S} in ${b}`);
673
- const M = x(e.node.params), A = s.callExpression(s.identifier("captureFunctionSpan"), [s.identifier(i), s.stringLiteral(i), s.stringLiteral(b), s.objectExpression([s.objectProperty(s.identifier("line"), s.numericLiteral(L)), s.objectProperty(s.identifier("column"), s.numericLiteral(S)), s.objectProperty(s.identifier("paramNames"), s.arrayExpression(M.map((E) => s.stringLiteral(E))))])]), w = s.expressionStatement(s.assignmentExpression("=", s.identifier(i), A));
674
- e.insertAfter(w), a = !0, u++, n.add(r);
675
- }, VariableDeclarator(e) {
676
- const i = e.node.id, r = e.node.init;
677
- if (!s.isIdentifier(i) || !r || !s.isFunctionExpression(r) && !s.isArrowFunctionExpression(r)) return;
678
- const g = i.name;
679
- if (ue.has(g)) return void (t && console.log(`[FuncSpan Transform] SKIPPING entry point function: ${g}`));
680
- const y = `var_${g}`;
681
- if (n.has(y)) return;
682
- t && console.log(`[FuncSpan Transform] Wrapping variable function: ${g}`);
683
- const C = r.loc?.start.line ?? 0, L = r.loc?.start.column ?? 0, S = v(C, L), { line: b, column: M } = S;
684
- let A = p;
685
- S.source && (A = P(R(p), S.source)), !t || b === C && M === L || console.log(`[FuncSpan Transform] Mapped ${C}:${L} → ${b}:${M} in ${A}`);
686
- const w = x(r.params), E = s.callExpression(s.identifier("captureFunctionSpan"), [r, s.stringLiteral(g), s.stringLiteral(A), s.objectExpression([s.objectProperty(s.identifier("line"), s.numericLiteral(b)), s.objectProperty(s.identifier("column"), s.numericLiteral(M)), s.objectProperty(s.identifier("paramNames"), s.arrayExpression(w.map((O) => s.stringLiteral(O))))])]);
687
- e.node.init = E, a = !0, u++, n.add(y);
688
- }, ClassMethod(e) {
689
- if (e.node.kind === "constructor" || e.node.kind === "get" || e.node.kind === "set") return;
690
- const i = s.isIdentifier(e.node.key) ? e.node.key.name : "anonymous", r = `method_${i}_${e.node.start}`;
691
- if (n.has(r)) return;
692
- t && console.log(`[FuncSpan Transform] Wrapping class method: ${i}`);
693
- const g = e.node.body, y = s.functionExpression(null, e.node.params, g, e.node.generator, e.node.async), C = s.callExpression(s.identifier("captureFunctionSpan"), [y, s.stringLiteral(i), s.stringLiteral(o)]), L = s.blockStatement([s.returnStatement(s.callExpression(s.memberExpression(C, s.identifier("call")), [s.thisExpression(), s.spreadElement(s.identifier("arguments"))]))]);
694
- e.node.body = L, a = !0, u++, n.add(r);
695
- }, ObjectMethod(e) {
696
- if (e.node.kind === "get" || e.node.kind === "set") return;
697
- const i = s.isIdentifier(e.node.key) ? e.node.key.name : s.isStringLiteral(e.node.key) ? e.node.key.value : "anonymous", r = `objmethod_${i}_${e.node.start}`;
698
- if (n.has(r)) return;
699
- t && console.log(`[FuncSpan Transform] Wrapping object method: ${i}`);
700
- const g = e.node.loc?.start.line ?? 0, y = e.node.loc?.start.column ?? 0, C = v(g, y), { line: L, column: S } = C;
701
- let b = p;
702
- C.source && (b = P(R(p), C.source));
703
- const M = x(e.node.params), A = s.functionExpression(s.identifier(i), e.node.params, e.node.body, e.node.generator, e.node.async), w = s.callExpression(s.identifier("captureFunctionSpan"), [A, s.stringLiteral(i), s.stringLiteral(b), s.objectExpression([s.objectProperty(s.identifier("line"), s.numericLiteral(L)), s.objectProperty(s.identifier("column"), s.numericLiteral(S)), s.objectProperty(s.identifier("paramNames"), s.arrayExpression(M.map((O) => s.stringLiteral(O))))])]), E = s.objectProperty(e.node.key, w, e.node.computed, !1);
704
- e.replaceWith(E), a = !0, u++, n.add(r);
705
- }, ClassProperty(e) {
706
- const i = e.node.key, r = e.node.value;
707
- if (!s.isIdentifier(i) || !r || !s.isFunctionExpression(r) && !s.isArrowFunctionExpression(r)) return;
708
- const g = i.name, y = `classprop_${g}_${e.node.start}`;
709
- if (n.has(y)) return;
710
- t && console.log(`[FuncSpan Transform] Wrapping class property function: ${g}`);
711
- const C = r.loc?.start.line ?? 0, L = r.loc?.start.column ?? 0, S = v(C, L), { line: b, column: M } = S;
712
- let A = p;
713
- S.source && (A = P(R(p), S.source));
714
- const w = x(r.params), E = s.callExpression(s.identifier("captureFunctionSpan"), [r, s.stringLiteral(g), s.stringLiteral(A), s.objectExpression([s.objectProperty(s.identifier("line"), s.numericLiteral(b)), s.objectProperty(s.identifier("column"), s.numericLiteral(M)), s.objectProperty(s.identifier("paramNames"), s.arrayExpression(w.map((O) => s.stringLiteral(O))))])]);
715
- e.node.value = E, a = !0, u++, n.add(y);
716
- }, ObjectProperty(e) {
717
- const i = e.node.key, r = e.node.value;
718
- if (!s.isIdentifier(i) && !s.isStringLiteral(i) || !r || !s.isFunctionExpression(r) && !s.isArrowFunctionExpression(r)) return;
719
- const g = s.isIdentifier(i) ? i.name : i.value, y = `objprop_${g}_${e.node.start}`;
720
- if (n.has(y)) return;
721
- t && console.log(`[FuncSpan Transform] Wrapping object property function: ${g}`);
722
- const C = r.loc?.start.line ?? 0, L = r.loc?.start.column ?? 0, S = v(C, L), { line: b, column: M } = S;
723
- let A = p;
724
- S.source && (A = P(R(p), S.source));
725
- const w = x(r.params), E = s.callExpression(s.identifier("captureFunctionSpan"), [r, s.stringLiteral(g), s.stringLiteral(A), s.objectExpression([s.objectProperty(s.identifier("line"), s.numericLiteral(b)), s.objectProperty(s.identifier("column"), s.numericLiteral(M)), s.objectProperty(s.identifier("paramNames"), s.arrayExpression(w.map((O) => s.stringLiteral(O))))])]);
726
- e.node.value = E, a = !0, u++, n.add(y);
727
- } }), a && !(function(e) {
728
- let i = !1;
729
- return q(e, { ImportDeclaration(r) {
730
- s.isStringLiteral(r.node.source) && r.node.source.value === "@sailfish-ai/sf-veritas" && r.node.specifiers.some((g) => s.isImportSpecifier(g) && s.isIdentifier(g.imported) && g.imported.name === "captureFunctionSpan") && (i = !0, r.stop());
731
- }, VariableDeclarator(r) {
732
- if (s.isObjectPattern(r.node.id) && s.isCallExpression(r.node.init) && s.isIdentifier(r.node.init.callee) && r.node.init.callee.name === "require") {
733
- const g = r.node.init.arguments;
734
- g.length > 0 && s.isStringLiteral(g[0]) && g[0].value === "@sailfish-ai/sf-veritas" && r.node.id.properties.some((y) => s.isObjectProperty(y) && s.isIdentifier(y.key) && y.key.name === "captureFunctionSpan") && (i = !0, r.stop());
735
- }
736
- } }), i;
737
- })(c)) if ((function(e) {
738
- let i = !1;
739
- return q(e, { CallExpression(r) {
740
- s.isIdentifier(r.node.callee) && r.node.callee.name === "require" && (i = !0, r.stop());
741
- }, MemberExpression(r) {
742
- !s.isIdentifier(r.node.object) || r.node.object.name !== "module" && r.node.object.name !== "exports" || (i = !0, r.stop());
743
- } }), i;
744
- })(c)) {
745
- const e = s.variableDeclaration("const", [s.variableDeclarator(s.objectPattern([s.objectProperty(s.identifier("captureFunctionSpan"), s.identifier("captureFunctionSpan"), !1, !0)]), s.callExpression(s.identifier("require"), [s.stringLiteral("@sailfish-ai/sf-veritas")]))]);
746
- c.program.body.unshift(e);
747
- } else {
748
- const e = s.importDeclaration([s.importSpecifier(s.identifier("captureFunctionSpan"), s.identifier("captureFunctionSpan"))], s.stringLiteral("@sailfish-ai/sf-veritas"));
749
- c.program.body.unshift(e);
750
- }
751
- if (u > 0) {
752
- const e = Ce(c, { retainLines: !0, compact: !1, sourceMaps: !0, sourceFileName: p }, l);
753
- return t && console.log(`[FuncSpan Transform] ✅ Wrapped ${u} functions in ${o}`), { code: e.code, map: e.map, modified: !0, functionsWrapped: u };
754
- }
755
- return { code: l, modified: !1, functionsWrapped: 0 };
756
- }
757
- function x(l) {
758
- const p = [];
759
- for (const m of l) s.isIdentifier(m) ? p.push(m.name) : s.isRestElement(m) && s.isIdentifier(m.argument) ? p.push(`...${m.argument.name}`) : s.isAssignmentPattern(m) && s.isIdentifier(m.left) ? p.push(m.left.name) : s.isObjectPattern(m) ? p.push("{}") : s.isArrayPattern(m) ? p.push("[]") : p.push("_");
760
- return p;
761
- }
762
- export {
763
- ye as s,
764
- Ee as t
765
- };