@contrast/rewriter 1.0.4 → 1.1.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.
Files changed (2) hide show
  1. package/lib/index.js +6 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -72,7 +72,6 @@ class Rewriter {
72
72
  body: path.node.body
73
73
  })
74
74
  ];
75
- return;
76
75
  }
77
76
 
78
77
  if (state.inject) {
@@ -89,6 +88,11 @@ class Rewriter {
89
88
  t.callExpression(expression('global.ContrastMethods.eval')(), path.node.arguments)
90
89
  ];
91
90
  }
91
+ if (path.node.callee.name === 'Function') {
92
+ path.node.arguments = [
93
+ t.callExpression(expression('global.ContrastMethods.Function')(), path.node.arguments)
94
+ ];
95
+ }
92
96
  },
93
97
  };
94
98
  this.unwriteTransforms = {
@@ -125,7 +129,7 @@ class Rewriter {
125
129
  ...opts
126
130
  };
127
131
 
128
- if (state.orig.indexOf('eval') === -1) {
132
+ if (state.orig.indexOf('eval') === -1 && state.orig.indexOf('Function') === -1) {
129
133
  return { code: state.orig };
130
134
  }
131
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/rewriter",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "A transpilation tool mainly used for instrumentation",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",