trickle-observe 0.2.79 → 0.2.80

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.
@@ -539,12 +539,13 @@ function transformCjsSource(source, filename, moduleName, env) {
539
539
  destructInsertions = findDestructuredDeclarations(source);
540
540
  }
541
541
  }
542
- // Additional variable patterns: reassignments, for-loops, catch clauses, function params
542
+ // Additional variable patterns: reassignments, for-loops, catch clauses
543
+ // Note: function params are NOT traced here because observe-register already
544
+ // wraps functions with __trickle_wrap which captures param types via wrapFunction.
543
545
  const reassignInsertions = (0, vite_plugin_1.findReassignments)(source);
544
546
  const forLoopInsertions = (0, vite_plugin_1.findForLoopVars)(source);
545
547
  const catchInsertions = (0, vite_plugin_1.findCatchVars)(source);
546
- const funcParamInsertions = (0, vite_plugin_1.findFunctionParams)(source, false);
547
- if (insertions.length === 0 && varInsertions.length === 0 && destructInsertions.length === 0 && reassignInsertions.length === 0 && forLoopInsertions.length === 0 && catchInsertions.length === 0 && funcParamInsertions.length === 0 && classInsertions.length === 0)
548
+ if (insertions.length === 0 && varInsertions.length === 0 && destructInsertions.length === 0 && reassignInsertions.length === 0 && forLoopInsertions.length === 0 && catchInsertions.length === 0 && classInsertions.length === 0)
548
549
  return source;
549
550
  // Resolve the path to the wrap helper (compiled JS)
550
551
  const wrapHelperPath = path_1.default.join(__dirname, 'wrap.js');
@@ -567,7 +568,7 @@ function transformCjsSource(source, filename, moduleName, env) {
567
568
  `};`,
568
569
  ];
569
570
  // Add variable tracing helper if we have var insertions
570
- if (varInsertions.length > 0 || destructInsertions.length > 0 || reassignInsertions.length > 0 || forLoopInsertions.length > 0 || catchInsertions.length > 0 || funcParamInsertions.length > 0) {
571
+ if (varInsertions.length > 0 || destructInsertions.length > 0 || reassignInsertions.length > 0 || forLoopInsertions.length > 0 || catchInsertions.length > 0) {
571
572
  const traceVarPath = path_1.default.join(__dirname, 'trace-var.js');
572
573
  prefixLines.push(`var __trickle_tv_mod = require(${JSON.stringify(traceVarPath)});`, `var __trickle_tv = function(v, n, l) { try { __trickle_tv_mod.traceVar(v, n, l, ${JSON.stringify(moduleName)}, ${JSON.stringify(filename)}); } catch(e){} };`);
573
574
  }
@@ -617,14 +618,6 @@ function transformCjsSource(source, filename, moduleName, env) {
617
618
  code: `\ntry{${calls}}catch(__e2){}\n`,
618
619
  });
619
620
  }
620
- // Function parameter insertions
621
- for (const { bodyStart, paramNames, lineNo } of funcParamInsertions) {
622
- const calls = paramNames.map(n => `__trickle_tv(${n},${JSON.stringify(n)},${lineNo})`).join(';');
623
- allInsertions.push({
624
- position: bodyStart,
625
- code: `\ntry{${calls}}catch(__e){}\n`,
626
- });
627
- }
628
621
  // Add class method wrappings
629
622
  for (const ci of classInsertions) {
630
623
  allInsertions.push(ci);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trickle-observe",
3
- "version": "0.2.79",
3
+ "version": "0.2.80",
4
4
  "description": "Runtime type observability for JavaScript applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,7 +40,6 @@ import {
40
40
  findReassignments,
41
41
  findForLoopVars,
42
42
  findCatchVars,
43
- findFunctionParams,
44
43
  } from './vite-plugin';
45
44
 
46
45
  const M = Module as any;
@@ -514,13 +513,14 @@ function transformCjsSource(source: string, filename: string, moduleName: string
514
513
  }
515
514
  }
516
515
 
517
- // Additional variable patterns: reassignments, for-loops, catch clauses, function params
516
+ // Additional variable patterns: reassignments, for-loops, catch clauses
517
+ // Note: function params are NOT traced here because observe-register already
518
+ // wraps functions with __trickle_wrap which captures param types via wrapFunction.
518
519
  const reassignInsertions = findReassignments(source);
519
520
  const forLoopInsertions = findForLoopVars(source);
520
521
  const catchInsertions = findCatchVars(source);
521
- const funcParamInsertions = findFunctionParams(source, false);
522
522
 
523
- if (insertions.length === 0 && varInsertions.length === 0 && destructInsertions.length === 0 && reassignInsertions.length === 0 && forLoopInsertions.length === 0 && catchInsertions.length === 0 && funcParamInsertions.length === 0 && classInsertions.length === 0) return source;
523
+ if (insertions.length === 0 && varInsertions.length === 0 && destructInsertions.length === 0 && reassignInsertions.length === 0 && forLoopInsertions.length === 0 && catchInsertions.length === 0 && classInsertions.length === 0) return source;
524
524
 
525
525
  // Resolve the path to the wrap helper (compiled JS)
526
526
  const wrapHelperPath = path.join(__dirname, 'wrap.js');
@@ -545,7 +545,7 @@ function transformCjsSource(source: string, filename: string, moduleName: string
545
545
  ];
546
546
 
547
547
  // Add variable tracing helper if we have var insertions
548
- if (varInsertions.length > 0 || destructInsertions.length > 0 || reassignInsertions.length > 0 || forLoopInsertions.length > 0 || catchInsertions.length > 0 || funcParamInsertions.length > 0) {
548
+ if (varInsertions.length > 0 || destructInsertions.length > 0 || reassignInsertions.length > 0 || forLoopInsertions.length > 0 || catchInsertions.length > 0) {
549
549
  const traceVarPath = path.join(__dirname, 'trace-var.js');
550
550
  prefixLines.push(
551
551
  `var __trickle_tv_mod = require(${JSON.stringify(traceVarPath)});`,
@@ -609,15 +609,6 @@ function transformCjsSource(source: string, filename: string, moduleName: string
609
609
  });
610
610
  }
611
611
 
612
- // Function parameter insertions
613
- for (const { bodyStart, paramNames, lineNo } of funcParamInsertions) {
614
- const calls = paramNames.map(n => `__trickle_tv(${n},${JSON.stringify(n)},${lineNo})`).join(';');
615
- allInsertions.push({
616
- position: bodyStart,
617
- code: `\ntry{${calls}}catch(__e){}\n`,
618
- });
619
- }
620
-
621
612
  // Add class method wrappings
622
613
  for (const ci of classInsertions) {
623
614
  allInsertions.push(ci);