@sailfish-ai/sf-veritas 0.2.20 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consoleLocationTransformer-BSSB5msZ.cjs +1 -0
- package/dist/consoleLocationTransformer-DZu_9MDA.js +51 -0
- package/dist/contextManager-0D8uHQ1_.cjs +1 -0
- package/dist/{contextManager-Dw7Yot7r.js → contextManager-RxrMXs5c.js} +106 -83
- package/dist/plugins/funcspanEsbuildPlugin.cjs +1 -1
- package/dist/plugins/funcspanEsbuildPlugin.mjs +20 -16
- package/dist/plugins/funcspanRollupPlugin.cjs +1 -1
- package/dist/plugins/funcspanRollupPlugin.mjs +17 -13
- package/dist/plugins/funcspanTscPlugin.cjs +1 -1
- package/dist/plugins/funcspanTscPlugin.mjs +34 -30
- package/dist/plugins/funcspanVitePlugin.cjs +1 -1
- package/dist/plugins/funcspanVitePlugin.mjs +16 -12
- package/dist/plugins/funcspanWebpackLoader.cjs +1 -1
- package/dist/plugins/funcspanWebpackLoader.mjs +55 -50
- package/dist/plugins/funcspanWebpackPlugin.cjs +1 -1
- package/dist/plugins/funcspanWebpackPlugin.mjs +1 -1
- package/dist/runtimeConfig-BZ61efqE.js +485 -0
- package/dist/runtimeConfig-CWpFWsmz.cjs +6 -0
- package/dist/sf-veritas.cjs +25 -13
- package/dist/sf-veritas.mjs +453 -393
- package/dist/telemetryWorker.cjs +1 -0
- package/dist/types/dataTransmitter.d.ts +6 -5
- package/dist/types/exceptionTransmitter.d.ts +2 -1
- package/dist/types/frameworkDetection.d.ts +18 -0
- package/dist/types/networkHopTransmitter.d.ts +2 -1
- package/dist/types/networkRequestTransmitter.d.ts +2 -1
- package/dist/types/plugins/consoleLocationTransformer.d.ts +37 -0
- package/dist/types/requestUtils.d.ts +17 -6
- package/dist/types/setupConfig.d.ts +3 -0
- package/dist/types/sourceLocation.d.ts +19 -19
- package/dist/types/telemetryWorker.d.ts +1 -0
- package/dist/worker-pool-capture.cjs +1 -1
- package/dist/worker-pool-capture.mjs +1 -1
- package/dist/workerPoolSpanCapture-Bg5av6gn.cjs +83 -0
- package/dist/{workerPoolSpanCapture-Dm4Reseo.js → workerPoolSpanCapture-BjdZn3LE.js} +222 -168
- package/package.json +1 -1
- package/dist/contextManager-DQMeQfS_.cjs +0 -1
- package/dist/runtimeConfig-Bfqf33tO.js +0 -444
- package/dist/runtimeConfig-DmD4lUhG.cjs +0 -9
- package/dist/workerPoolSpanCapture-CAM2z9Jx.cjs +0 -83
|
@@ -1,44 +1,48 @@
|
|
|
1
|
-
import { readFileSync as
|
|
2
|
-
import { sync as
|
|
3
|
-
import { resolve as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { readFileSync as N, writeFileSync as m } from "fs";
|
|
2
|
+
import { sync as _ } from "glob";
|
|
3
|
+
import { resolve as D } from "path";
|
|
4
|
+
import { t as T } from "../funcSpanTransformer-S_WeAt_m.js";
|
|
5
|
+
import { t as U } from "../consoleLocationTransformer-DZu_9MDA.js";
|
|
6
|
+
import { s as $ } from "../runtimeConfig-BZ61efqE.js";
|
|
7
|
+
async function v(n = {}) {
|
|
7
8
|
try {
|
|
8
|
-
if (
|
|
9
|
+
if ($()) return void console.warn("[FuncSpan TSC Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation");
|
|
9
10
|
} catch {
|
|
10
11
|
}
|
|
11
|
-
const { outDir:
|
|
12
|
-
console.log("[FuncSpan TSC] Starting post-build function instrumentation..."), console.log(`[FuncSpan TSC] Output directory: ${
|
|
13
|
-
const
|
|
14
|
-
for (const o of
|
|
15
|
-
const
|
|
16
|
-
|
|
12
|
+
const { outDir: F = "dist", include: g = ["**/*.js"], exclude: C = ["**/*.test.js", "**/*.spec.js", "**/__tests__/**"], projectRoot: s = process.cwd(), includeNodeModules: l = [], debug: c = !1 } = n, p = D(s, F);
|
|
13
|
+
console.log("[FuncSpan TSC] Starting post-build function instrumentation..."), console.log(`[FuncSpan TSC] Output directory: ${p}`), console.log(`[FuncSpan TSC] Project root: ${s}`);
|
|
14
|
+
const i = [];
|
|
15
|
+
for (const o of g) {
|
|
16
|
+
const e = _(o, { cwd: p, absolute: !0, ignore: C });
|
|
17
|
+
i.push(...e);
|
|
17
18
|
}
|
|
18
|
-
console.log(`[FuncSpan TSC] Found ${
|
|
19
|
-
let
|
|
20
|
-
for (const o of
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
console.log(`[FuncSpan TSC] Found ${i.length} JavaScript files to process`);
|
|
20
|
+
let d = 0, S = 0;
|
|
21
|
+
for (const o of i) try {
|
|
22
|
+
let e = N(o, "utf-8"), r = null, u = !1;
|
|
23
|
+
const t = await T(e, o, { projectRoot: s, includeNodeModules: l, debug: c });
|
|
24
|
+
t.modified && (e = t.code, r = t.map, u = !0);
|
|
25
|
+
const a = await U(e, o, { projectRoot: s, includeNodeModules: l, debug: c });
|
|
26
|
+
if (a.modified && (e = a.code, r = a.map, u = !0), u) {
|
|
27
|
+
if (m(o, e, "utf-8"), r) {
|
|
28
|
+
const f = `${o}.map`;
|
|
29
|
+
m(f, JSON.stringify(r), "utf-8"), c && console.log(`[FuncSpan TSC] Generated source map: ${f}`);
|
|
26
30
|
}
|
|
27
|
-
|
|
31
|
+
d++, S += t.functionsWrapped, c && console.log(`[FuncSpan TSC] Modified: ${o} (${t.functionsWrapped} functions)`);
|
|
28
32
|
}
|
|
29
|
-
} catch (
|
|
30
|
-
console.error(`[FuncSpan TSC] Error processing ${o}:`,
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(`[FuncSpan TSC] Error processing ${o}:`, e);
|
|
31
35
|
}
|
|
32
|
-
console.log(`[FuncSpan TSC] ✅ Completed: Modified ${
|
|
36
|
+
console.log(`[FuncSpan TSC] ✅ Completed: Modified ${d} files, wrapped ${S} functions`);
|
|
33
37
|
}
|
|
34
|
-
async function
|
|
38
|
+
async function y() {
|
|
35
39
|
const n = { outDir: process.env.SF_FUNCSPAN_OUT_DIR || "dist", debug: process.env.SF_FUNCSPAN_DEBUG === "true", includeNodeModules: process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES ? process.env.SF_FUNCSPAN_INCLUDE_NODE_MODULES.split(",") : [] };
|
|
36
|
-
await
|
|
40
|
+
await v(n);
|
|
37
41
|
}
|
|
38
|
-
require.main === module &&
|
|
42
|
+
require.main === module && y().catch((n) => {
|
|
39
43
|
console.error("[FuncSpan TSC] Fatal error:", n), process.exit(1);
|
|
40
44
|
});
|
|
41
45
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
y as cli,
|
|
47
|
+
v as processTscFiles
|
|
44
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../funcSpanTransformer-D0W2t41q.cjs"),a=require("../consoleLocationTransformer-BSSB5msZ.cjs"),f=require("../runtimeConfig-CWpFWsmz.cjs");exports.funcspanVitePlugin=function(l={}){try{if(f.shouldEnableRuntimeHooks())return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"),{name:"sailfish-funcspan-vite-disabled"}}catch{}const{enabled:c=!0,includeNodeModules:t=[],debug:o=!1}=l;return{name:"sailfish-funcspan-vite",enforce:"pre",async transform(s,e){if(!c||!e.match(/\.(js|ts|jsx|tsx)$/)||e.startsWith("\0")||e.includes("node_modules")&&!t.some(n=>e.includes(`node_modules/${n}`))||e.includes("@sailfish-ai/sf-veritas")||e.includes("jsts-backend/dist"))return null;try{let n=s,i=!1;const u=await d.transformFunctionSpans(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});u.modified&&(n=u.code,i=!0);const r=await a.transformConsoleLocations(n,e,{projectRoot:process.cwd(),includeNodeModules:t,debug:o});if(r.modified&&(n=r.code,i=!0),i)return{code:n,map:null}}catch(n){o&&console.error(`[FuncSpan Vite] Error transforming ${e}:`,n)}return null}}};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { t as d } from "../funcSpanTransformer-S_WeAt_m.js";
|
|
2
|
+
import { t as a } from "../consoleLocationTransformer-DZu_9MDA.js";
|
|
3
|
+
import { s as f } from "../runtimeConfig-BZ61efqE.js";
|
|
4
|
+
function g(l = {}) {
|
|
4
5
|
try {
|
|
5
|
-
if (
|
|
6
|
+
if (f()) return console.warn("[FuncSpan Vite Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation"), { name: "sailfish-funcspan-vite-disabled" };
|
|
6
7
|
} catch {
|
|
7
8
|
}
|
|
8
|
-
const { enabled:
|
|
9
|
-
return { name: "sailfish-funcspan-vite", enforce: "pre", async transform(
|
|
10
|
-
if (!
|
|
9
|
+
const { enabled: c = !0, includeNodeModules: t = [], debug: i = !1 } = l;
|
|
10
|
+
return { name: "sailfish-funcspan-vite", enforce: "pre", async transform(o, e) {
|
|
11
|
+
if (!c || !e.match(/\.(js|ts|jsx|tsx)$/) || e.startsWith("\0") || e.includes("node_modules") && !t.some((n) => e.includes(`node_modules/${n}`)) || e.includes("@sailfish-ai/sf-veritas") || e.includes("jsts-backend/dist")) return null;
|
|
11
12
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
let n = o, s = !1;
|
|
14
|
+
const u = await d(n, e, { projectRoot: process.cwd(), includeNodeModules: t, debug: i });
|
|
15
|
+
u.modified && (n = u.code, s = !0);
|
|
16
|
+
const r = await a(n, e, { projectRoot: process.cwd(), includeNodeModules: t, debug: i });
|
|
17
|
+
if (r.modified && (n = r.code, s = !0), s) return { code: n, map: null };
|
|
18
|
+
} catch (n) {
|
|
19
|
+
i && console.error(`[FuncSpan Vite] Error transforming ${e}:`, n);
|
|
16
20
|
}
|
|
17
21
|
return null;
|
|
18
22
|
} };
|
|
19
23
|
}
|
|
20
24
|
export {
|
|
21
|
-
|
|
25
|
+
g as funcspanVitePlugin
|
|
22
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const q=require("../funcSpanTransformer-D0W2t41q.cjs"),E=require("@babel/parser"),C=require("@babel/traverse"),x=require("@babel/generator"),I=require("@babel/types"),L=require("path"),N=require("../consoleLocationTransformer-BSSB5msZ.cjs");function z(n){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const r in n)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(d,r,c.get?c:{enumerable:!0,get:()=>n[r]})}}return d.default=n,Object.freeze(d)}const e=z(I),O=C.default||C,Z=x.default||x,A=["lookup","lookupService","resolve","resolve4","resolve6","resolveAny","resolveCname","resolveMx","resolveNs","resolvePtr","resolveSoa","resolveSrv","resolveTxt","reverse","setServers","getServers"],B=["readFile","writeFile","appendFile","readdir","stat","lstat","mkdir","rmdir","unlink","rename","copyFile","open","close","read","write","access"],G=["pbkdf2","randomBytes","randomFill","scrypt"],V=["deflate","deflateRaw","gzip","gunzip","inflate","inflateRaw","unzip","brotliCompress","brotliDecompress"];module.exports=function(n){const d=this.async(),r=this.getOptions();(async()=>{try{let c=await q.transformFunctionSpans(n,this.resourcePath,{projectRoot:r.projectRoot||process.cwd(),includeNodeModules:r.includeNodeModules||[],debug:r.debug||!1}),f=c.modified?c.code:n,k=c.map;if(r.enableWorkerPoolTracking){const p=await(async function(b,h,D={}){const{projectRoot:M=process.cwd(),trackDns:W=!1,trackFs:w=!1,trackCrypto:j=!1,trackZlib:T=!1,debug:u=!1}=D;if(!(W||w||j||T))return{code:b,modified:!1,callsWrapped:0};const P=L.relative(M,h).replace(/\\/g,"/");let m;u&&console.log(`[WorkerPool Transform] Processing: ${P}`);try{m=E.parse(b,{sourceType:"module",plugins:["typescript","jsx","decorators-legacy","classProperties","objectRestSpread","asyncGenerators","dynamicImport","optionalCatchBinding","optionalChaining","nullishCoalescingOperator"]})}catch(t){return u&&console.error(`[WorkerPool Transform] Parse error in ${P}:`,t),{code:b,modified:!1,callsWrapped:0}}let F=!1,y=0,S=!1;const v=new Map,l=new Map;if(W&&l.set("dns",A),w&&l.set("fs",B),j&&l.set("crypto",G),T&&l.set("zlib",V),O(m,{VariableDeclarator(t){const o=t.node.init,i=t.node.id;if(o&&e.isCallExpression(o)&&e.isIdentifier(o.callee,{name:"require"})&&o.arguments.length===1&&e.isStringLiteral(o.arguments[0])){const s=o.arguments[0].value;for(const[a]of l)s!==a&&s!==`node:${a}`||e.isIdentifier(i)&&(v.set(i.name,a),u&&console.log(`[WorkerPool Transform] Found ${a} binding: ${i.name}`))}},ImportDeclaration(t){const o=t.node.source.value;for(const[i]of l)if(o===i||o===`node:${i}`){for(const s of t.node.specifiers)if(e.isImportDefaultSpecifier(s)||e.isImportNamespaceSpecifier(s)){const a=s.local.name;v.set(a,i),u&&console.log(`[WorkerPool Transform] Found ${i} import: ${a}`)}}}}),O(m,{CallExpression(t){const o=t.node.callee;if(e.isMemberExpression(o)&&e.isIdentifier(o.object)){const i=o.object.name,s=v.get(i);if(s&&l.has(s)){const a=l.get(s),g=e.isIdentifier(o.property)?o.property.name:null;if(g&&a.includes(g)){u&&console.log(`[WorkerPool Transform] Wrapping ${s}.${g}()`);const R=e.callExpression(e.identifier("captureWorkerPoolOperation"),[e.stringLiteral(s),e.stringLiteral(g),e.memberExpression(e.identifier(i),e.identifier(g)),e.arrayExpression(t.node.arguments),e.identifier(i)]);t.replaceWith(R),S=!0,y++,F=!0}}}}}),S){const t=e.variableDeclaration("const",[e.variableDeclarator(e.objectPattern([e.objectProperty(e.identifier("captureWorkerPoolOperation"),e.identifier("captureWorkerPoolOperation"),!1,!0)]),e.callExpression(e.identifier("require"),[e.stringLiteral("@sailfish-ai/sf-veritas/worker-pool-capture")]))]);m.program.body.length>0&&m.program.body.unshift(t),u&&console.log("[WorkerPool Transform] Added captureWorkerPoolOperation import")}if(!F)return{code:b,modified:!1,callsWrapped:0};const $=Z(m,{sourceMaps:!0,sourceFileName:h});return u&&console.log(`[WorkerPool Transform] Wrapped ${y} calls in ${P}`),{code:$.code,map:$.map,modified:!0,callsWrapped:y}})(f,this.resourcePath,{projectRoot:r.projectRoot||process.cwd(),trackDns:r.workerPoolTrackDns||!1,trackFs:r.workerPoolTrackFs||!1,trackCrypto:r.workerPoolTrackCrypto||!1,trackZlib:r.workerPoolTrackZlib||!1,debug:r.debug||!1});p.modified&&(f=p.code,k=p.map)}if(r.enableConsoleLocationTracking!==!1){const p=await N.transformConsoleLocations(f,this.resourcePath,{projectRoot:r.projectRoot||process.cwd(),includeNodeModules:r.includeNodeModules||[],debug:r.debug||!1});p.modified&&(f=p.code,k=p.map)}f!==n?d(null,f,k):d(null,n)}catch(c){r.debug&&console.error(`[FuncSpan Webpack Loader] Error transforming ${this.resourcePath}:`,c),d(null,n)}})()};
|
|
@@ -1,72 +1,77 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { parse as
|
|
1
|
+
import { t as I } from "../funcSpanTransformer-S_WeAt_m.js";
|
|
2
|
+
import { parse as N } from "@babel/parser";
|
|
3
3
|
import C from "@babel/traverse";
|
|
4
|
-
import
|
|
4
|
+
import R from "@babel/generator";
|
|
5
5
|
import * as e from "@babel/types";
|
|
6
6
|
import { relative as L } from "path";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { t as O } from "../consoleLocationTransformer-DZu_9MDA.js";
|
|
8
|
+
const S = C.default || C, z = R.default || R, Z = ["lookup", "lookupService", "resolve", "resolve4", "resolve6", "resolveAny", "resolveCname", "resolveMx", "resolveNs", "resolvePtr", "resolveSoa", "resolveSrv", "resolveTxt", "reverse", "setServers", "getServers"], q = ["readFile", "writeFile", "appendFile", "readdir", "stat", "lstat", "mkdir", "rmdir", "unlink", "rename", "copyFile", "open", "close", "read", "write", "access"], A = ["pbkdf2", "randomBytes", "randomFill", "scrypt"], B = ["deflate", "deflateRaw", "gzip", "gunzip", "inflate", "inflateRaw", "unzip", "brotliCompress", "brotliDecompress"];
|
|
9
|
+
function U(m) {
|
|
10
|
+
const k = this.async(), o = this.getOptions();
|
|
10
11
|
(async () => {
|
|
11
12
|
try {
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
const { projectRoot:
|
|
16
|
-
if (!(
|
|
17
|
-
const
|
|
18
|
-
let
|
|
19
|
-
|
|
13
|
+
let f = await I(m, this.resourcePath, { projectRoot: o.projectRoot || process.cwd(), includeNodeModules: o.includeNodeModules || [], debug: o.debug || !1 }), p = f.modified ? f.code : m, b = f.map;
|
|
14
|
+
if (o.enableWorkerPoolTracking) {
|
|
15
|
+
const l = await (async function(g, h, D = {}) {
|
|
16
|
+
const { projectRoot: M = process.cwd(), trackDns: W = !1, trackFs: w = !1, trackCrypto: T = !1, trackZlib: j = !1, debug: c = !1 } = D;
|
|
17
|
+
if (!(W || w || T || j)) return { code: g, modified: !1, callsWrapped: 0 };
|
|
18
|
+
const P = L(M, h).replace(/\\/g, "/");
|
|
19
|
+
let d;
|
|
20
|
+
c && console.log(`[WorkerPool Transform] Processing: ${P}`);
|
|
20
21
|
try {
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
return
|
|
22
|
+
d = N(g, { sourceType: "module", plugins: ["typescript", "jsx", "decorators-legacy", "classProperties", "objectRestSpread", "asyncGenerators", "dynamicImport", "optionalCatchBinding", "optionalChaining", "nullishCoalescingOperator"] });
|
|
23
|
+
} catch (t) {
|
|
24
|
+
return c && console.error(`[WorkerPool Transform] Parse error in ${P}:`, t), { code: g, modified: !1, callsWrapped: 0 };
|
|
24
25
|
}
|
|
25
|
-
let
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const r =
|
|
26
|
+
let $ = !1, y = 0, F = !1;
|
|
27
|
+
const v = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
28
|
+
if (W && n.set("dns", Z), w && n.set("fs", q), T && n.set("crypto", A), j && n.set("zlib", B), S(d, { VariableDeclarator(t) {
|
|
29
|
+
const r = t.node.init, i = t.node.id;
|
|
29
30
|
if (r && e.isCallExpression(r) && e.isIdentifier(r.callee, { name: "require" }) && r.arguments.length === 1 && e.isStringLiteral(r.arguments[0])) {
|
|
30
|
-
const
|
|
31
|
-
for (const [a] of n)
|
|
31
|
+
const s = r.arguments[0].value;
|
|
32
|
+
for (const [a] of n) s !== a && s !== `node:${a}` || e.isIdentifier(i) && (v.set(i.name, a), c && console.log(`[WorkerPool Transform] Found ${a} binding: ${i.name}`));
|
|
32
33
|
}
|
|
33
|
-
}, ImportDeclaration(
|
|
34
|
-
const r =
|
|
35
|
-
for (const [
|
|
36
|
-
for (const
|
|
37
|
-
const a =
|
|
38
|
-
|
|
34
|
+
}, ImportDeclaration(t) {
|
|
35
|
+
const r = t.node.source.value;
|
|
36
|
+
for (const [i] of n) if (r === i || r === `node:${i}`) {
|
|
37
|
+
for (const s of t.node.specifiers) if (e.isImportDefaultSpecifier(s) || e.isImportNamespaceSpecifier(s)) {
|
|
38
|
+
const a = s.local.name;
|
|
39
|
+
v.set(a, i), c && console.log(`[WorkerPool Transform] Found ${i} import: ${a}`);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
} }),
|
|
42
|
-
const r =
|
|
42
|
+
} }), S(d, { CallExpression(t) {
|
|
43
|
+
const r = t.node.callee;
|
|
43
44
|
if (e.isMemberExpression(r) && e.isIdentifier(r.object)) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const a = n.get(
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
45
|
+
const i = r.object.name, s = v.get(i);
|
|
46
|
+
if (s && n.has(s)) {
|
|
47
|
+
const a = n.get(s), u = e.isIdentifier(r.property) ? r.property.name : null;
|
|
48
|
+
if (u && a.includes(u)) {
|
|
49
|
+
c && console.log(`[WorkerPool Transform] Wrapping ${s}.${u}()`);
|
|
50
|
+
const E = e.callExpression(e.identifier("captureWorkerPoolOperation"), [e.stringLiteral(s), e.stringLiteral(u), e.memberExpression(e.identifier(i), e.identifier(u)), e.arrayExpression(t.node.arguments), e.identifier(i)]);
|
|
51
|
+
t.replaceWith(E), F = !0, y++, $ = !0;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
} }),
|
|
55
|
-
const
|
|
56
|
-
|
|
55
|
+
} }), F) {
|
|
56
|
+
const t = e.variableDeclaration("const", [e.variableDeclarator(e.objectPattern([e.objectProperty(e.identifier("captureWorkerPoolOperation"), e.identifier("captureWorkerPoolOperation"), !1, !0)]), e.callExpression(e.identifier("require"), [e.stringLiteral("@sailfish-ai/sf-veritas/worker-pool-capture")]))]);
|
|
57
|
+
d.program.body.length > 0 && d.program.body.unshift(t), c && console.log("[WorkerPool Transform] Added captureWorkerPoolOperation import");
|
|
57
58
|
}
|
|
58
|
-
if (
|
|
59
|
-
const x =
|
|
60
|
-
return
|
|
61
|
-
})(
|
|
62
|
-
|
|
59
|
+
if (!$) return { code: g, modified: !1, callsWrapped: 0 };
|
|
60
|
+
const x = z(d, { sourceMaps: !0, sourceFileName: h });
|
|
61
|
+
return c && console.log(`[WorkerPool Transform] Wrapped ${y} calls in ${P}`), { code: x.code, map: x.map, modified: !0, callsWrapped: y };
|
|
62
|
+
})(p, this.resourcePath, { projectRoot: o.projectRoot || process.cwd(), trackDns: o.workerPoolTrackDns || !1, trackFs: o.workerPoolTrackFs || !1, trackCrypto: o.workerPoolTrackCrypto || !1, trackZlib: o.workerPoolTrackZlib || !1, debug: o.debug || !1 });
|
|
63
|
+
l.modified && (p = l.code, b = l.map);
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
if (o.enableConsoleLocationTracking !== !1) {
|
|
66
|
+
const l = await O(p, this.resourcePath, { projectRoot: o.projectRoot || process.cwd(), includeNodeModules: o.includeNodeModules || [], debug: o.debug || !1 });
|
|
67
|
+
l.modified && (p = l.code, b = l.map);
|
|
68
|
+
}
|
|
69
|
+
p !== m ? k(null, p, b) : k(null, m);
|
|
70
|
+
} catch (f) {
|
|
71
|
+
o.debug && console.error(`[FuncSpan Webpack Loader] Error transforming ${this.resourcePath}:`, f), k(null, m);
|
|
67
72
|
}
|
|
68
73
|
})();
|
|
69
74
|
}
|
|
70
75
|
export {
|
|
71
|
-
|
|
76
|
+
U as default
|
|
72
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("../runtimeConfig-CWpFWsmz.cjs"),a=require("path"),P=require("url");function m(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const f=m(a);class u{options;constructor(o={}){this.options={enabled:!0,includeNodeModules:[],debug:!1,enableWorkerPoolTracking:!1,workerPoolTrackDns:!1,workerPoolTrackFs:!1,workerPoolTrackCrypto:!1,workerPoolTrackZlib:!1,...o}}apply(o){try{if(b.shouldEnableRuntimeHooks())return void console.warn("[FuncSpan Webpack Plugin] Runtime mode active - build plugin DISABLED to prevent double-instrumentation")}catch{}const{enabled:n,includeNodeModules:t,debug:c}=this.options;if(!n)return;const l="FuncspanWebpackPlugin";o.hooks.compilation.tap(l,s=>{s.hooks.buildModule.tap(l,i=>{i.resource&&i.resource.match(/\.(js|ts|jsx|tsx)$/)&&(!i.resource.includes("node_modules")||t?.some(e=>i.resource.includes(`node_modules/${e}`)))}),o.webpack.NormalModule.getCompilationHooks(s).loader.tap(l,(i,e)=>{if(!e.resource||!e.resource.match(/\.(js|ts|jsx|tsx)$/)||e.resource.includes("node_modules")&&!t?.some(p=>e.resource.includes(`node_modules/${p}`)))return;const d=typeof __dirname<"u"?__dirname:a.dirname(P.fileURLToPath(require("node:url").pathToFileURL(__filename).href)),k=f.join(d,"funcspanWebpackLoader.cjs");e.loaders.push({loader:k,options:{projectRoot:o.context,includeNodeModules:t,debug:c,enableWorkerPoolTracking:this.options.enableWorkerPoolTracking,workerPoolTrackDns:this.options.workerPoolTrackDns,workerPoolTrackFs:this.options.workerPoolTrackFs,workerPoolTrackCrypto:this.options.workerPoolTrackCrypto,workerPoolTrackZlib:this.options.workerPoolTrackZlib}})})}),c&&console.log("[FuncSpan Webpack] Plugin initialized")}}exports.FuncspanWebpackPlugin=u,exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
2
|
var m = (r, o, s) => o in r ? k(r, o, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[o] = s;
|
|
3
3
|
var c = (r, o, s) => m(r, typeof o != "symbol" ? o + "" : o, s);
|
|
4
|
-
import { s as b } from "../runtimeConfig-
|
|
4
|
+
import { s as b } from "../runtimeConfig-BZ61efqE.js";
|
|
5
5
|
import * as P from "path";
|
|
6
6
|
import { dirname as T } from "path";
|
|
7
7
|
import { fileURLToPath as f } from "url";
|