@nodesecure/js-x-ray 6.2.0 → 6.2.1

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/index.js CHANGED
@@ -122,15 +122,19 @@ function parseScriptExtended(strToAnalyze, options = {}) {
122
122
  return body;
123
123
  }
124
124
  catch (error) {
125
+ const isIllegalReturn = error.description.includes("Illegal return statement");
126
+
125
127
  if (error.name === "SyntaxError" && (
126
128
  error.description.includes("The import keyword") ||
127
- error.description.includes("The export keyword")
129
+ error.description.includes("The export keyword") ||
130
+ isIllegalReturn
128
131
  )) {
129
132
  const { body } = meriyah.parseScript(
130
133
  cleanedStrToAnalyze,
131
134
  {
132
135
  ...kMeriyahDefaultOptions,
133
- module: true
136
+ module: true,
137
+ globalReturn: isIllegalReturn
134
138
  }
135
139
  );
136
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodesecure/js-x-ray",
3
- "version": "6.2.0",
3
+ "version": "6.2.1",
4
4
  "description": "JavaScript AST XRay analysis",
5
5
  "type": "module",
6
6
  "exports": "./index.js",
@@ -146,7 +146,6 @@ function walkRequireCallExpression(nodeToWalk, tracer) {
146
146
  break;
147
147
  }
148
148
  case "require.resolve": {
149
- console.log("require.resolve!");
150
149
  if (rootArgument.type === "Literal") {
151
150
  dependencies.add(rootArgument.value);
152
151
  }