diff --git a/.changeset/orange-lands-admire.md b/.changeset/orange-lands-admire.md new file mode 100644 index 00000000..6b4518cd --- /dev/null +++ b/.changeset/orange-lands-admire.md @@ -0,0 +1,5 @@ +--- +"@nodesecure/js-x-ray": major +--- + +Migrate to meriyah v7 diff --git a/workspaces/estree-ast-utils/package.json b/workspaces/estree-ast-utils/package.json index 7b03dd41..913890f5 100644 --- a/workspaces/estree-ast-utils/package.json +++ b/workspaces/estree-ast-utils/package.json @@ -37,6 +37,6 @@ "homepage": "https://github.com/NodeSecure/js-x-ray/tree/master/workspaces/estree-ast-utils#readme", "dependencies": { "@nodesecure/sec-literal": "^1.1.0", - "meriyah": "^6.1.3" + "meriyah": "7.0.0" } } diff --git a/workspaces/estree-ast-utils/test/utils.ts b/workspaces/estree-ast-utils/test/utils.ts index f952bf1a..7ea680fb 100644 --- a/workspaces/estree-ast-utils/test/utils.ts +++ b/workspaces/estree-ast-utils/test/utils.ts @@ -7,9 +7,7 @@ export function codeToAst( const estreeRootNode = meriyah.parseScript(code, { next: true, loc: true, - raw: true, - module: true, - globalReturn: false + raw: true }); return estreeRootNode.body; diff --git a/workspaces/js-x-ray-ai/package-lock.json b/workspaces/js-x-ray-ai/package-lock.json deleted file mode 100644 index 82b12b80..00000000 --- a/workspaces/js-x-ray-ai/package-lock.json +++ /dev/null @@ -1,597 +0,0 @@ -{ - "name": "@nodesecure/ai", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@nodesecure/ai", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@google/genai": "^1.21.0", - "@nodesecure/js-x-ray": "^10.0.0", - "openai": "^5.23.1" - } - }, - "node_modules/@google/genai": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.21.0.tgz", - "integrity": "sha512-k47DECR8BF9z7IJxQd3reKuH2eUnOH5NlJWSe+CKM6nbXx+wH3hmtWQxUQR9M8gzWW1EvFuRVgjQssEIreNZsw==", - "license": "Apache-2.0", - "dependencies": { - "google-auth-library": "^9.14.2", - "ws": "^8.18.0" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "@modelcontextprotocol/sdk": "^1.11.4" - }, - "peerDependenciesMeta": { - "@modelcontextprotocol/sdk": { - "optional": true - } - } - }, - "node_modules/@nodesecure/estree-ast-utils": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@nodesecure/estree-ast-utils/-/estree-ast-utils-4.2.0.tgz", - "integrity": "sha512-SsS+e4HfTYB9aBNud46HxXkWMOQsPcogunLv+l5rZ3g8071qc4kJIfZ4UKHJIKUv5fBUR31LoPf8WVX5Lwqw3g==", - "license": "MIT", - "dependencies": { - "@nodesecure/sec-literal": "^1.1.0", - "meriyah": "^6.1.3" - } - }, - "node_modules/@nodesecure/js-x-ray": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@nodesecure/js-x-ray/-/js-x-ray-10.0.0.tgz", - "integrity": "sha512-kYHk1b2c5To7xf7YG/RMS8m70dfY8vXWJmiSwp62BjUdamsICQb95bshNKQPxZcvwRMuiWG2ttPNWujUSGeZ2w==", - "license": "MIT", - "dependencies": { - "@nodesecure/estree-ast-utils": "^4.2.0", - "@nodesecure/sec-literal": "^1.2.0", - "@nodesecure/tracer": "^3.0.0", - "digraph-js": "^2.2.3", - "frequency-set": "^1.0.2", - "is-minified-code": "^2.0.0", - "meriyah": "^6.0.0", - "safe-regex": "^2.1.1", - "ts-pattern": "^5.0.6" - }, - "engines": { - "node": ">=20.0.0" - } - }, - "node_modules/@nodesecure/sec-literal": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@nodesecure/sec-literal/-/sec-literal-1.2.0.tgz", - "integrity": "sha512-LGgJmBtnIVHwjZ1QA62YyDvPysdYvGcGn6/JADjY23snTNZS+D9JrkxnChggoNDYj3/GtjutbY/cSlLXEcUJRw==", - "license": "MIT", - "dependencies": { - "frequency-set": "^1.0.2", - "is-base64": "^1.1.0", - "is-svg": "^4.3.2", - "string-width": "^5.1.2" - } - }, - "node_modules/@nodesecure/tracer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@nodesecure/tracer/-/tracer-3.0.0.tgz", - "integrity": "sha512-g7UsgZ3JWARuGcvGBupbv8AizjF8t+VPIjMSGjur4smVWMmrT9nHTNjWtnY14Lvq4zV+fgartSq5+vvhTRdTaw==", - "license": "MIT", - "dependencies": { - "@nodesecure/estree-ast-utils": "^4.2.0", - "meriyah": "^6.1.3", - "ts-pattern": "^5.7.1" - } - }, - "node_modules/agent-base": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", - "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", - "license": "MIT", - "engines": { - "node": ">= 14" - } - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/bignumber.js": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", - "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", - "license": "BSD-3-Clause" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/digraph-js": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/digraph-js/-/digraph-js-2.2.3.tgz", - "integrity": "sha512-btynrARSW6pBmDz9+cwCxkBJ91CGBxIaNQo7V+ul9/rCRr3HddwehpEMnL6Ru2OeC2pKdRteB1v5TgZRrAAYKQ==", - "license": "MIT", - "dependencies": { - "lodash.isequal": "^4.5.0", - "lodash.uniqwith": "^4.5.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "license": "MIT" - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "license": "MIT" - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "license": "MIT" - }, - "node_modules/fast-xml-parser": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.5.3.tgz", - "integrity": "sha512-RKihhV+SHsIUGXObeVy9AXiBbFwkVk7Syp8XgwN5U3JV416+Gwp/GO9i0JYKmikykgz/UHRrrV4ROuZEo/T0ig==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT", - "dependencies": { - "strnum": "^1.1.1" - }, - "bin": { - "fxparser": "src/cli/cli.js" - } - }, - "node_modules/frequency-set": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/frequency-set/-/frequency-set-1.0.2.tgz", - "integrity": "sha512-Qip6vS0fY/et08sZXumws05weoYvj2ZLkBq3xIwFDFLg8v5IMQiRa+P30tXL0CU6DiYUPLuN3HyRcwW6yWPdeA==", - "license": "MIT" - }, - "node_modules/gaxios": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", - "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==", - "license": "Apache-2.0", - "dependencies": { - "extend": "^3.0.2", - "https-proxy-agent": "^7.0.1", - "is-stream": "^2.0.0", - "node-fetch": "^2.6.9", - "uuid": "^9.0.1" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/gcp-metadata": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", - "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", - "license": "Apache-2.0", - "dependencies": { - "gaxios": "^6.1.1", - "google-logging-utils": "^0.0.2", - "json-bigint": "^1.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/google-auth-library": { - "version": "9.15.1", - "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", - "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", - "license": "Apache-2.0", - "dependencies": { - "base64-js": "^1.3.0", - "ecdsa-sig-formatter": "^1.0.11", - "gaxios": "^6.1.1", - "gcp-metadata": "^6.1.0", - "gtoken": "^7.0.0", - "jws": "^4.0.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/google-logging-utils": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", - "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", - "license": "Apache-2.0", - "engines": { - "node": ">=14" - } - }, - "node_modules/gtoken": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", - "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", - "license": "MIT", - "dependencies": { - "gaxios": "^6.0.0", - "jws": "^4.0.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/https-proxy-agent": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", - "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/is-base64": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-base64/-/is-base64-1.1.0.tgz", - "integrity": "sha512-Nlhg7Z2dVC4/PTvIFkgVVNvPHSO2eR/Yd0XzhGiXCXEvWnptXlXa/clQ8aePPiMuxEGcWfzWbGw2Fe3d+Y3v1g==", - "license": "MIT", - "bin": { - "is_base64": "bin/is-base64", - "is-base64": "bin/is-base64" - } - }, - "node_modules/is-minified-code": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-minified-code/-/is-minified-code-2.0.0.tgz", - "integrity": "sha512-I1BHmOxm7owypunUWnYx2Ggdhg3lzdyJXLepi8NuR/IsvgVgkwjLj+12iYAGUklu0Xvy3nXGcDSKGbE0Q0Nkag==", - "license": "MIT" - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-svg": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-4.4.0.tgz", - "integrity": "sha512-v+AgVwiK5DsGtT9ng+m4mClp6zDAmwrW8nZi6Gg15qzvBnRWWdfWA1TGaXyCDnWq5g5asofIgMVl3PjKxvk1ug==", - "license": "MIT", - "dependencies": { - "fast-xml-parser": "^4.1.3" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "license": "MIT", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, - "node_modules/jwa": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", - "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", - "license": "MIT", - "dependencies": { - "buffer-equal-constant-time": "^1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", - "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", - "license": "MIT", - "dependencies": { - "jwa": "^2.0.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "deprecated": "This package is deprecated. Use require('node:util').isDeepStrictEqual instead.", - "license": "MIT" - }, - "node_modules/lodash.uniqwith": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", - "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==", - "license": "MIT" - }, - "node_modules/meriyah": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/meriyah/-/meriyah-6.1.4.tgz", - "integrity": "sha512-Sz8FzjzI0kN13GK/6MVEsVzMZEPvOhnmmI1lU5+/1cGOiK3QUahntrNNtdVeihrO7t9JpoH75iMNXg6R6uWflQ==", - "license": "ISC", - "engines": { - "node": ">=18.0.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/openai": { - "version": "5.23.1", - "resolved": "https://registry.npmjs.org/openai/-/openai-5.23.1.tgz", - "integrity": "sha512-APxMtm5mln4jhKhAr0d5zP9lNsClx4QwJtg8RUvYSSyxYCTHLNJnLEcSHbJ6t0ori8Pbr9HZGfcPJ7LEy73rvQ==", - "license": "Apache-2.0", - "bin": { - "openai": "bin/cli" - }, - "peerDependencies": { - "ws": "^8.18.0", - "zod": "^3.23.8" - }, - "peerDependenciesMeta": { - "ws": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, - "node_modules/regexp-tree": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.27.tgz", - "integrity": "sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==", - "license": "MIT", - "bin": { - "regexp-tree": "bin/regexp-tree" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safe-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-2.1.1.tgz", - "integrity": "sha512-rx+x8AMzKb5Q5lQ95Zoi6ZbJqwCLkqi3XuJXp5P3rT8OEc6sZCJG5AE5dU3lsgRr/F4Bs31jSlVN+j5KrsGu9A==", - "license": "MIT", - "dependencies": { - "regexp-tree": "~0.1.1" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strnum": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", - "integrity": "sha512-vrN+B7DBIoTTZjnPNewwhx6cBA/H+IS7rfW68n7XxC1y7uoiGQBxaKzqucGUgavX15dJgiGztLJ8vxuEzwqBdA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/NaturalIntelligence" - } - ], - "license": "MIT" - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "license": "MIT" - }, - "node_modules/ts-pattern": { - "version": "5.8.0", - "resolved": "https://registry.npmjs.org/ts-pattern/-/ts-pattern-5.8.0.tgz", - "integrity": "sha512-kIjN2qmWiHnhgr5DAkAafF9fwb0T5OhMVSWrm8XEdTFnX6+wfXwYOFjeF86UZ54vduqiR7BfqScFmXSzSaH8oA==", - "license": "MIT" - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/ws": { - "version": "8.18.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", - "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - } - } -} diff --git a/workspaces/js-x-ray/docs/AstAnalyser.md b/workspaces/js-x-ray/docs/AstAnalyser.md index b2e01720..8a8a2a31 100644 --- a/workspaces/js-x-ray/docs/AstAnalyser.md +++ b/workspaces/js-x-ray/docs/AstAnalyser.md @@ -61,7 +61,7 @@ class AstAnalyser { } ``` -The `analyseFile` and `analyseFileSync` methods is a superset of `analyse` with the ability to read the file on the local filesystem with additional features like detecting if the file is ESM/CJS (using the extension). +The `analyseFile` and `analyseFileSync` methods is a superset of `analyse` with the ability to read the file on the local filesystem. ```ts interface RuntimeOptions { @@ -69,10 +69,6 @@ interface RuntimeOptions { * A filesystem location for the given source code. */ location?: string; - /** - * @default true - */ - module?: boolean; /** * @default false */ diff --git a/workspaces/js-x-ray/package.json b/workspaces/js-x-ray/package.json index 3f201c3a..2d522949 100644 --- a/workspaces/js-x-ray/package.json +++ b/workspaces/js-x-ray/package.json @@ -57,7 +57,7 @@ "digraph-js": "2.2.4", "frequency-set": "^2.1.0", "ipaddr.js": "2.2.0", - "meriyah": "^6.0.0", + "meriyah": "7.0.0", "safe-regex": "^2.1.1", "ts-pattern": "^5.0.6" } diff --git a/workspaces/js-x-ray/src/AstAnalyser.ts b/workspaces/js-x-ray/src/AstAnalyser.ts index 5ffb2c9b..1d307f34 100644 --- a/workspaces/js-x-ray/src/AstAnalyser.ts +++ b/workspaces/js-x-ray/src/AstAnalyser.ts @@ -40,10 +40,6 @@ export interface RuntimeOptions { * A filesystem location for the given source code. */ location?: string; - /** - * @default true - */ - module?: boolean; /** * @default false */ @@ -150,7 +146,6 @@ export class AstAnalyser { const { location, isMinified = false, - module = true, removeHTMLComments = false, initialize, finalize @@ -158,9 +153,10 @@ export class AstAnalyser { const parser = options.customParser ?? AstAnalyser.DefaultParser; - const body = parser.parse(this.prepareSource(str, { removeHTMLComments }), { - isEcmaScriptModule: Boolean(module) - }); + const body = parser.parse( + this.prepareSource(str, { removeHTMLComments }), + void 0 + ); const source = new SourceFile(location); if (trojan.verify(str)) { @@ -219,7 +215,6 @@ export class AstAnalyser { try { const { packageName = null, - module = true, removeHTMLComments = false, initialize, finalize, @@ -233,7 +228,6 @@ export class AstAnalyser { const data = this.analyse(str, { location: path.dirname(filePathString), isMinified: isMin, - module: path.extname(filePathString) === ".mjs" ? true : module, removeHTMLComments, initialize, finalize, @@ -275,7 +269,6 @@ export class AstAnalyser { try { const { packageName = null, - module = true, removeHTMLComments = false, initialize, finalize, @@ -289,7 +282,6 @@ export class AstAnalyser { const data = this.analyse(str, { location: path.dirname(filePathString), isMinified: isMin, - module: path.extname(filePathString) === ".mjs" ? true : module, removeHTMLComments, initialize, finalize, diff --git a/workspaces/js-x-ray/src/JsSourceParser.ts b/workspaces/js-x-ray/src/JsSourceParser.ts index 717c454e..7865f365 100644 --- a/workspaces/js-x-ray/src/JsSourceParser.ts +++ b/workspaces/js-x-ray/src/JsSourceParser.ts @@ -1,6 +1,7 @@ // Import Third-party Dependencies import { - parseScript, + parseModule, + parse, type ESTree, type Options } from "meriyah"; @@ -25,27 +26,14 @@ export interface SourceParser { parse(source: string, options: unknown): ESTree.Statement[]; } -export interface JsSourceParserOptions { - isEcmaScriptModule?: boolean; -} - export class JsSourceParser implements SourceParser { parse( - source: string, - options: JsSourceParserOptions = {} + source: string ): ESTree.Program["body"] { - const { - isEcmaScriptModule - } = options; - try { - const { body } = parseScript( + const { body } = parseModule( source, - { - ...kParsingOptions, - module: isEcmaScriptModule, - globalReturn: !isEcmaScriptModule - } + structuredClone(kParsingOptions) ); return body; @@ -54,17 +42,12 @@ export class JsSourceParser implements SourceParser { const syntaxError = error as SourceParserSyntaxError; const isIllegalReturn = syntaxError.description.includes("Illegal return statement"); - if (syntaxError.name === "SyntaxError" && ( - syntaxError.description.includes("The import keyword") || - syntaxError.description.includes("The export keyword") || - isIllegalReturn - )) { - const { body } = parseScript( + if (isIllegalReturn) { + const { body } = parse( source, { - ...kParsingOptions, - module: true, - globalReturn: isIllegalReturn + ...structuredClone(kParsingOptions), + sourceType: "commonjs" } ); diff --git a/workspaces/js-x-ray/test/AstAnalyser.spec.ts b/workspaces/js-x-ray/test/AstAnalyser.spec.ts index c68c4185..7ccfdd18 100644 --- a/workspaces/js-x-ray/test/AstAnalyser.spec.ts +++ b/workspaces/js-x-ray/test/AstAnalyser.spec.ts @@ -41,7 +41,7 @@ describe("AstAnalyser", () => { const myVar = "path"; require(myVar); - `, { module: false }); + `); assert.strictEqual(warnings.length, 0); assert.deepEqual([...dependencies.keys()], @@ -153,7 +153,7 @@ describe("AstAnalyser", () => { import * as http from "http"; import fs from "fs"; import { foo } from "xd"; - `, { module: true }); + `); assert.strictEqual(warnings.length, 0); assert.deepEqual( @@ -189,16 +189,16 @@ describe("AstAnalyser", () => { const astAnalyserMock = t.mock.method(AstAnalyser.prototype, "analyse"); const source = "const http = require(\"http\");"; - new AstAnalyser().analyse(source, { module: true, removeHTMLComments: true }); + new AstAnalyser().analyse(source, { removeHTMLComments: true }); const source2 = "const fs = require(\"fs\");"; - new AstAnalyser().analyse(source2, { module: false, removeHTMLComments: false }); + new AstAnalyser().analyse(source2, { removeHTMLComments: false }); const calls = astAnalyserMock.mock.calls; assert.strictEqual(calls.length, 2); - assert.deepEqual(calls[0].arguments, [source, { module: true, removeHTMLComments: true }]); - assert.deepEqual(calls[1].arguments, [source2, { module: false, removeHTMLComments: false }]); + assert.deepEqual(calls[0].arguments, [source, { removeHTMLComments: true }]); + assert.deepEqual(calls[1].arguments, [source2, { removeHTMLComments: false }]); }); describe("hooks", () => { @@ -285,7 +285,7 @@ describe("AstAnalyser", () => { it("remove the packageName from the dependencies list", async() => { const result = await getAnalyser().analyseFile( new URL("depName.js", kFixtureURL), - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); assert.ok(result.ok); @@ -298,7 +298,7 @@ describe("AstAnalyser", () => { it("should fail with a parsing error", async() => { const result = await getAnalyser().analyseFile( new URL("parsingError.js", kFixtureURL), - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); assert.strictEqual(result.ok, false); @@ -314,20 +314,20 @@ describe("AstAnalyser", () => { const url = new URL("depName.js", kFixtureURL); await new AstAnalyser().analyseFile( url, - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); const url2 = new URL("parsingError.js", kFixtureURL); await new AstAnalyser().analyseFile( url2, - { module: true, packageName: "foobar2" } + { packageName: "foobar2" } ); const calls = astAnalyserMock.mock.calls; assert.strictEqual(calls.length, 2); - assert.deepEqual(calls[0].arguments, [url, { module: false, packageName: "foobar" }]); - assert.deepEqual(calls[1].arguments, [url2, { module: true, packageName: "foobar2" }]); + assert.deepEqual(calls[0].arguments, [url, { packageName: "foobar" }]); + assert.deepEqual(calls[1].arguments, [url2, { packageName: "foobar2" }]); }); it("should implement new customProbes while keeping default probes", async() => { @@ -471,7 +471,7 @@ describe("AstAnalyser", () => { it("remove the packageName from the dependencies list", () => { const result = getAnalyser().analyseFileSync( new URL("depName.js", kFixtureURL), - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); assert.ok(result.ok); @@ -484,7 +484,7 @@ describe("AstAnalyser", () => { it("should fail with a parsing error", () => { const result = getAnalyser().analyseFileSync( new URL("parsingError.js", kFixtureURL), - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); assert.strictEqual(result.ok, false); @@ -703,13 +703,12 @@ describe("AstAnalyser", () => { await new AstAnalyser().analyseFile( new URL("depName.js", kFixtureURL), - { module: false, packageName: "foobar" } + { packageName: "foobar" } ); await new AstAnalyser().analyseFile( new URL("parsingError.js", kFixtureURL), { - module: true, packageName: "foobar2", customParser: new FakeSourceParser() } @@ -729,11 +728,10 @@ describe("AstAnalyser", () => { const jsSourceParserMock = t.mock.method(JsSourceParser.prototype, "parse"); const fakeSourceParserMock = t.mock.method(FakeSourceParser.prototype, "parse"); - new AstAnalyser().analyse("const http = require(\"http\");", { module: true, removeHTMLComments: true }); + new AstAnalyser().analyse("const http = require(\"http\");", { removeHTMLComments: true }); new AstAnalyser().analyse("const fs = require(\"fs\");", { - module: false, removeHTMLComments: false, customParser: new FakeSourceParser() } diff --git a/workspaces/js-x-ray/test/JsSourceParser.spec.ts b/workspaces/js-x-ray/test/JsSourceParser.spec.ts index 42d5e78f..2f8455da 100644 --- a/workspaces/js-x-ray/test/JsSourceParser.spec.ts +++ b/workspaces/js-x-ray/test/JsSourceParser.spec.ts @@ -6,16 +6,12 @@ import { JsSourceParser } from "../src/index.js"; describe("JsSourceParser", () => { describe("parse", () => { - it("should not crash even if isEcmaScriptModule 'false' is provided (import keyword)", () => { - new JsSourceParser().parse("import * as foo from \"foo\";", { - isEcmaScriptModule: false - }); + it("should not crash when using import keyword", () => { + new JsSourceParser().parse("import * as foo from \"foo\";"); }); - it("should not crash even if isEcmaScriptModule 'false' is provided (export keyword)", () => { - new JsSourceParser().parse("export const foo = 5;", { - isEcmaScriptModule: false - }); + it("should not crash when using export keyword", () => { + new JsSourceParser().parse("export const foo = 5;"); }); it("should not crash with a source code containing JSX", () => { @@ -25,17 +21,13 @@ describe("JsSourceParser", () => { return {children({ ...props, open })}; });`; - new JsSourceParser().parse(code, { - isEcmaScriptModule: false - }); + new JsSourceParser().parse(code); }); it("should not crash with a source code containing import attributes", () => { const code = `import data from "./data.json" with { type: "json" }; export default data;`; - new JsSourceParser().parse(code, { - isEcmaScriptModule: false - }); + new JsSourceParser().parse(code); }); }); }); diff --git a/workspaces/js-x-ray/test/issues/163-illegalReturnStatement.spec.ts b/workspaces/js-x-ray/test/issues/163-illegalReturnStatement.spec.ts index ef58aa17..eae2720a 100644 --- a/workspaces/js-x-ray/test/issues/163-illegalReturnStatement.spec.ts +++ b/workspaces/js-x-ray/test/issues/163-illegalReturnStatement.spec.ts @@ -21,11 +21,8 @@ if (!argv.length) { } `; -test("it should not throw error whatever module is true or false", () => { +test("it should not throw error for a global return statement", () => { assert.doesNotThrow(() => { - new AstAnalyser().analyse(kIncriminedCodeSample, { module: false }); - }); - assert.doesNotThrow(() => { - new AstAnalyser().analyse(kIncriminedCodeSample, { module: true }); + new AstAnalyser().analyse(kIncriminedCodeSample); }); }); diff --git a/workspaces/js-x-ray/test/probes/isImportDeclaration.spec.ts b/workspaces/js-x-ray/test/probes/isImportDeclaration.spec.ts index f0551af5..0124777b 100644 --- a/workspaces/js-x-ray/test/probes/isImportDeclaration.spec.ts +++ b/workspaces/js-x-ray/test/probes/isImportDeclaration.spec.ts @@ -72,6 +72,6 @@ test("should detect an unsafe import using data:text/javascript and throw a unsa assert.strictEqual(sastAnalysis.warnings().length, 1); const unsafeImport = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(unsafeImport.value, expectedValue); + assert.strictEqual(unsafeImport!.value, expectedValue); }); }); diff --git a/workspaces/js-x-ray/test/probes/isRequire.spec.ts b/workspaces/js-x-ray/test/probes/isRequire.spec.ts index 5cda0f73..64da1dda 100644 --- a/workspaces/js-x-ray/test/probes/isRequire.spec.ts +++ b/workspaces/js-x-ray/test/probes/isRequire.spec.ts @@ -129,7 +129,7 @@ test("it should throw an 'unsafe-import' warning for a require with an unknown I assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); }); test("it should throw an 'unsafe-import' warning for a require with an unknown MemberExpression", () => { @@ -142,7 +142,7 @@ test("it should throw an 'unsafe-import' warning for a require with an unknown M assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); }); test("it should catch require with a Literal argument having for value the Node.js core http module", () => { @@ -219,7 +219,7 @@ where all Literals values concatened is equal to an empty string`, () => { assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); }); test(`it should catch require with a BinaryExpression where all level of operands flattened @@ -266,7 +266,7 @@ with an operator not equal to '+' as require argument`, () => { assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); }); test("it should throw an 'unsafe-import' warning for using a BinaryExpression with one or many unresolvable Operands", () => { @@ -279,7 +279,7 @@ test("it should throw an 'unsafe-import' warning for using a BinaryExpression wi assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); }); test("(require CallExpression): it should always throw an 'unsafe-import' warning when using a CallExpression", () => { @@ -295,7 +295,7 @@ test("(require CallExpression): it should always throw an 'unsafe-import' warnin assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 0); @@ -316,7 +316,7 @@ and then add the unobfuscated value in the dependency list`, () => { assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 1); @@ -333,7 +333,7 @@ test("(require CallExpression): it should detect MemberExpression Buffer.from", assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 1); @@ -350,7 +350,7 @@ test("(require CallExpression): it should detect MemberExpression Buffer.from (w assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 1); @@ -371,7 +371,7 @@ test("(require CallExpression): it should detect MemberExpression require.resolv "must have one unsafe-import warning" ); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 1); @@ -390,7 +390,7 @@ test("(require CallExpression): it should detect obfuscated atob value", () => { assert.strictEqual(sastAnalysis.warnings().length, 1); const warning = sastAnalysis.getWarning("unsafe-import"); - assert.strictEqual(warning.kind, "unsafe-import"); + assert.strictEqual(warning!.kind, "unsafe-import"); const dependencies = sastAnalysis.dependencies(); assert.strictEqual(dependencies.size, 1); diff --git a/workspaces/js-x-ray/test/utils/index.ts b/workspaces/js-x-ray/test/utils/index.ts index c1c02b92..f60afc17 100644 --- a/workspaces/js-x-ray/test/utils/index.ts +++ b/workspaces/js-x-ray/test/utils/index.ts @@ -22,13 +22,18 @@ export function getWarningKind( export function parseScript( str: string ) { - return meriyah.parseScript(str, { + const options = { next: true, loc: true, - raw: true, - module: true, - globalReturn: false - }); + raw: true + }; + + try { + return meriyah.parseModule(str, options); + } + catch { + return meriyah.parseScript(str, options); + } } export function getSastAnalysis( diff --git a/workspaces/tracer/package.json b/workspaces/tracer/package.json index f77d18d4..2dc44844 100644 --- a/workspaces/tracer/package.json +++ b/workspaces/tracer/package.json @@ -33,7 +33,7 @@ "homepage": "https://github.com/NodeSecure/js-x-ray/tree/master/workspaces/tracer#readme", "dependencies": { "@nodesecure/estree-ast-utils": "^4.2.0", - "meriyah": "^6.1.3", + "meriyah": "7.0.0", "ts-pattern": "^5.7.1" }, "devDependencies": { diff --git a/workspaces/tracer/test/utils.ts b/workspaces/tracer/test/utils.ts index 0ee386b7..1e9eca25 100644 --- a/workspaces/tracer/test/utils.ts +++ b/workspaces/tracer/test/utils.ts @@ -6,12 +6,11 @@ import { walk } from "estree-walker"; import { VariableTracer } from "../src/index.js"; function codeToAst(code: string) { - const estreeRootNode = meriyah.parseScript(code, { + const estreeRootNode = meriyah.parse(code, { next: true, loc: true, raw: true, - module: true, - globalReturn: false + sourceType: "module" }); return estreeRootNode.body;