From 0dac601979a6266f885cfe196ec2de379598ec7f Mon Sep 17 00:00:00 2001 From: Ayush Pahwa Date: Fri, 22 Nov 2024 04:23:58 +0800 Subject: [PATCH] chore: upgrade version of acorn and acron walk (#37641) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description acorn and acorn walk did not have a fixed version, this pr fixes the versions to `"acorn": "8.14.0", "acorn-walk": "8.3.4"` respectively. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /test all ### :mag: Cypress test results > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: > Commit: 518c41104561b6f0df8f546eb5a4e0b3e82c2676 > Cypress dashboard. > Tags: `@tag.All` > Spec: >
Thu, 21 Nov 2024 19:47:19 UTC ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No ## Summary by CodeRabbit - **Chores** - Updated dependency versions for improved performance and security: - `acorn` updated to version `8.14.0` - `acorn-walk` updated to version `8.3.4` - **Bug Fixes** - Enhanced error handling in `canTranslateToUI` function for better conditional and logical expression processing. - Improved logic in `getMainAction` function to ensure accurate function name generation based on call expression structure. --- app/client/packages/ast/package.json | 4 +- .../packages/ast/src/actionCreator/index.ts | 5 --- app/client/yarn.lock | 38 +++++++++---------- 3 files changed, 21 insertions(+), 26 deletions(-) diff --git a/app/client/packages/ast/package.json b/app/client/packages/ast/package.json index e982902dd1b1..351e5b9602a8 100644 --- a/app/client/packages/ast/package.json +++ b/app/client/packages/ast/package.json @@ -16,8 +16,8 @@ "@rollup/plugin-commonjs": "^22.0.0", "@types/escodegen": "^0.0.7", "@types/lodash": "^4.14.120", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", + "acorn": "8.14.0", + "acorn-walk": "8.3.4", "astravel": "^0.6.1", "astring": "^1.7.5", "escodegen": "^2.0.0", diff --git a/app/client/packages/ast/src/actionCreator/index.ts b/app/client/packages/ast/src/actionCreator/index.ts index 100734a2c02c..de42fb42b5c5 100644 --- a/app/client/packages/ast/src/actionCreator/index.ts +++ b/app/client/packages/ast/src/actionCreator/index.ts @@ -800,16 +800,13 @@ export function canTranslateToUI( simple(astWithComments, { ConditionalExpression(node) { if ( - // @ts-expect-error: types not matched isCallExpressionNode(node.consequent) || - // @ts-expect-error: types not matched isCallExpressionNode(node.alternate) ) { canTranslate = false; } }, LogicalExpression(node) { - // @ts-expect-error: types not matched if (isCallExpressionNode(node.left) || isCallExpressionNode(node.right)) { canTranslate = false; } @@ -912,12 +909,10 @@ export function getMainAction( ExpressionStatement(node) { simple(node, { CallExpression(node) { - // @ts-expect-error: types not matched if (node.callee.type === NodeTypes.Identifier) { mainAction = generate(node, { comments: true }).trim(); } else { mainAction = - // @ts-expect-error: types not matched generate(node.callee, { comments: true }).trim() + "()"; } }, diff --git a/app/client/yarn.lock b/app/client/yarn.lock index dc86e9a1ddeb..abcbd21fa8b1 100644 --- a/app/client/yarn.lock +++ b/app/client/yarn.lock @@ -8405,8 +8405,8 @@ __metadata: "@types/lodash": ^4.14.120 "@typescript-eslint/eslint-plugin": ^5.25.0 "@typescript-eslint/parser": ^5.25.0 - acorn: ^8.8.0 - acorn-walk: ^8.2.0 + acorn: 8.14.0 + acorn-walk: 8.3.4 astravel: ^0.6.1 astring: ^1.7.5 escodegen: ^2.0.0 @@ -12463,14 +12463,7 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^7.0.0, acorn-walk@npm:^7.1.1, acorn-walk@npm:^7.2.0": - version: 7.2.0 - resolution: "acorn-walk@npm:7.2.0" - checksum: 9252158a79b9d92f1bc0dd6acc0fcfb87a67339e84bcc301bb33d6078936d27e35d606b4d35626d2962cd43c256d6f27717e70cbe15c04fff999ab0b2260b21f - languageName: node - linkType: hard - -"acorn-walk@npm:^8.0.2, acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.2.0": +"acorn-walk@npm:8.3.4, acorn-walk@npm:^8.0.2, acorn-walk@npm:^8.1.1, acorn-walk@npm:^8.2.0": version: 8.3.4 resolution: "acorn-walk@npm:8.3.4" dependencies: @@ -12479,6 +12472,13 @@ __metadata: languageName: node linkType: hard +"acorn-walk@npm:^7.0.0, acorn-walk@npm:^7.1.1, acorn-walk@npm:^7.2.0": + version: 7.2.0 + resolution: "acorn-walk@npm:7.2.0" + checksum: 9252158a79b9d92f1bc0dd6acc0fcfb87a67339e84bcc301bb33d6078936d27e35d606b4d35626d2962cd43c256d6f27717e70cbe15c04fff999ab0b2260b21f + languageName: node + linkType: hard + "acorn@npm:8.10.0": version: 8.10.0 resolution: "acorn@npm:8.10.0" @@ -12488,6 +12488,15 @@ __metadata: languageName: node linkType: hard +"acorn@npm:8.14.0, acorn@npm:^8.1.0, acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.7.1, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": + version: 8.14.0 + resolution: "acorn@npm:8.14.0" + bin: + acorn: bin/acorn + checksum: 8755074ba55fff94e84e81c72f1013c2d9c78e973c31231c8ae505a5f966859baf654bddd75046bffd73ce816b149298977fff5077a3033dedba0ae2aad152d4 + languageName: node + linkType: hard + "acorn@npm:^4.0.9": version: 4.0.13 resolution: "acorn@npm:4.0.13" @@ -12506,15 +12515,6 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.1.0, acorn@npm:^8.11.0, acorn@npm:^8.2.4, acorn@npm:^8.4.1, acorn@npm:^8.7.1, acorn@npm:^8.8.0, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": - version: 8.14.0 - resolution: "acorn@npm:8.14.0" - bin: - acorn: bin/acorn - checksum: 8755074ba55fff94e84e81c72f1013c2d9c78e973c31231c8ae505a5f966859baf654bddd75046bffd73ce816b149298977fff5077a3033dedba0ae2aad152d4 - languageName: node - linkType: hard - "add-px-to-style@npm:1.0.0": version: 1.0.0 resolution: "add-px-to-style@npm:1.0.0"