@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 +6 -2
- package/package.json +1 -1
- package/src/probes/isRequire.js +0 -1
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
package/src/probes/isRequire.js
CHANGED