From dcb0e109ff40c53e06c73348e40748f8b8abb434 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 02:11:18 +0800 Subject: [PATCH] chore(deps): update dependency acorn to v8.15.0 (#17580) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: fisker --- package.json | 2 +- .../__snapshots__/format.test.js.snap | 13 +- tests/format/js/babel-plugins/format.test.js | 1 - .../__snapshots__/format.test.js.snap | 187 +++++------------- .../format.test.js | 25 +-- yarn.lock | 10 +- 6 files changed, 67 insertions(+), 171 deletions(-) diff --git a/package.json b/package.json index a8125ca75..d2e66353b 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@prettier/parse-srcset": "3.1.0", "@typescript-eslint/typescript-estree": "8.33.1", "@typescript-eslint/visitor-keys": "8.33.1", - "acorn": "8.14.1", + "acorn": "8.15.0", "acorn-jsx": "5.3.2", "angular-estree-parser": "12.1.0", "angular-html-parser": "8.1.0", diff --git a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap index e1a88eeb2..d4c9206a4 100644 --- a/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap +++ b/tests/format/js/babel-plugins/__snapshots__/format.test.js.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`async-do-expressions.js [acorn] format 1`] = ` "Unexpected token (1:7) @@ -799,17 +799,6 @@ import(prettier).then((module) => console.log(module)); ================================================================================ `; -exports[`explicit-resource-management.js [acorn] format 1`] = ` -"Unexpected token (2:9) - 1 | function * g() { -> 2 | using handle = acquireFileHandle(); // block-scoped critical resource - | ^ - 3 | } // cleanup - 4 | - 5 | { -Cause: Unexpected token (2:8)" -`; - exports[`explicit-resource-management.js [espree] format 1`] = ` "Unexpected token handle (2:9) 1 | function * g() { diff --git a/tests/format/js/babel-plugins/format.test.js b/tests/format/js/babel-plugins/format.test.js index 5faa3846e..e678b73e3 100644 --- a/tests/format/js/babel-plugins/format.test.js +++ b/tests/format/js/babel-plugins/format.test.js @@ -22,7 +22,6 @@ runFormatTest(import.meta, ["babel", "babel-ts", "babel-flow"], { "module-blocks.js", "async-do-expressions.js", "decorator-auto-accessors.js", - "explicit-resource-management.js", "source-phase-imports.js", "deferred-import-evaluation.js", "optional-chaining-assignment.js", diff --git a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap index f4d9a4825..d38457c3b 100644 --- a/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap +++ b/tests/format/js/explicit-resource-management/__snapshots__/format.test.js.snap @@ -1,12 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`for-await-using-of-comments.js [acorn] format 1`] = ` -"Unexpected token (1:19) -> 1 | /*1*/ for /* 2 */ await /*3*/ ( /*4*/ using /*5*/ fo /*6*/ of /*7*/ of /*8*/) /*9*/; - | ^ - 2 | -Cause: Unexpected token (1:18)" -`; +// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing exports[`for-await-using-of-comments.js [espree] format 1`] = ` "Unexpected token await (1:19) @@ -56,14 +48,14 @@ printWidth: 80 `; exports[`invalid-duplicate-using-bindings.js [acorn] format 1`] = ` -"Unexpected token (2:9) +"Identifier 'f' has already been declared (2:20) 1 | { > 2 | using f = foo(), f = foo(); - | ^ + | ^ 3 | } 4 | { 5 | using g = foo(); -Cause: Unexpected token (2:8)" +Cause: Identifier 'f' has already been declared (2:19)" `; exports[`invalid-duplicate-using-bindings.js [espree] format 1`] = ` @@ -138,14 +130,6 @@ printWidth: 80 ================================================================================ `; -exports[`invalid-script-top-level-using-binding.js [acorn] format 1`] = ` -"Unexpected token (1:7) -> 1 | using x = bar(); - | ^ - 2 | -Cause: Unexpected token (1:6)" -`; - exports[`invalid-script-top-level-using-binding.js [espree] format 1`] = ` "Unexpected token x (1:7) > 1 | using x = bar(); @@ -193,17 +177,6 @@ using x = bar(); ================================================================================ `; -exports[`using-declarations.js [acorn] format 1`] = ` -"Unexpected token (2:17) - 1 | { -> 2 | using /* 1 */ a = foo(), /* 2 */ b = foo() - | ^ - 3 | } - 4 | - 5 | for(using /* 1 */ a = foo(), /* 2 */ b = foo();;); -Cause: Unexpected token (2:16)" -`; - exports[`using-declarations.js [espree] format 1`] = ` "Unexpected token a (2:17) 1 | { @@ -288,6 +261,17 @@ for (using /* 1 */ foo of bar()); ================================================================================ `; +exports[`valid-await-expr-using.js [acorn] format 1`] = ` +"Unexpected token (2:14) + 1 | async function f() { +> 2 | await using[x]; + | ^ + 3 | await using.x + await using(x) ? await using?.x : await using\`x\`; + 4 | } + 5 | +Cause: Unexpected token (2:13)" +`; + exports[`valid-await-expr-using.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -308,6 +292,16 @@ async function f() { ================================================================================ `; +exports[`valid-await-expr-using-in.js [acorn] format 1`] = ` +"Unexpected keyword 'in' (2:15) + 1 | async function f() { +> 2 | await using in foo; + | ^ + 3 | } + 4 | +Cause: Unexpected keyword 'in' (2:14)" +`; + exports[`valid-await-expr-using-in.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -326,6 +320,16 @@ async function f() { ================================================================================ `; +exports[`valid-await-expr-using-instanceof.js [acorn] format 1`] = ` +"Unexpected keyword 'instanceof' (2:15) + 1 | async function f() { +> 2 | await using instanceof foo; + | ^ + 3 | } + 4 | +Cause: Unexpected keyword 'instanceof' (2:14)" +`; + exports[`valid-await-expr-using-instanceof.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -364,16 +368,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-using-binding-basic.js [acorn] format 1`] = ` -"Unexpected token (2:15) - 1 | async function f() { -> 2 | await using basic = getReader(); - | ^ - 3 | } - 4 | -Cause: Unexpected token (2:14)" -`; - exports[`valid-await-using-binding-basic.js [espree] format 1`] = ` "Unexpected token basic (2:15) 1 | async function f() { @@ -433,16 +427,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-using-binding-escaped.js [acorn] format 1`] = ` -"Unexpected token (2:15) - 1 | async function f() { -> 2 | await using \\u0061b = c; - | ^ - 3 | } - 4 | -Cause: Unexpected token (2:14)" -`; - exports[`valid-await-using-binding-escaped.js [espree] format 1`] = ` "Unexpected token \\u0061b (2:15) 1 | async function f() { @@ -502,16 +486,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-using-binding-non-bmp.js [acorn] format 1`] = ` -"Unexpected token (2:15) - 1 | async function f() { -> 2 | await using 𠮷 = foo(); - | ^ - 3 | } - 4 | -Cause: Unexpected token (2:14)" -`; - exports[`valid-await-using-binding-non-bmp.js [espree] format 1`] = ` "Unexpected token 𠮷 (2:15) 1 | async function f() { @@ -570,17 +544,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-using-binding-using.js [acorn] format 1`] = ` -"Unexpected token (2:15) - 1 | async function f() { -> 2 | await using using = of; - | ^ - 3 | for (await using using of of); - 4 | } - 5 | -Cause: Unexpected token (2:14)" -`; - exports[`valid-await-using-binding-using.js [espree] format 1`] = ` "Unexpected token using (2:15) 1 | async function f() { @@ -646,18 +609,6 @@ async function f() { ================================================================================ `; -exports[`valid-await-using-comments.js [acorn] format 1`] = ` -"Unexpected token (3:28) - 1 | async function f() { - 2 | { -> 3 | /*0*/await/*1*/using/*2*/b/*3*/=/*4*/f()/*5*/; - | ^ - 4 | } - 5 | { - 6 | /*0*/for/*1*/(/*2*/await/*3*/using/*4*/b/*5*/=/*6*/x/*7*/;/*8*/;/*9*/)/*10*/; -Cause: Unexpected token (3:27)" -`; - exports[`valid-await-using-comments.js [espree] format 1`] = ` "Unexpected token b (3:28) 1 | async function f() { @@ -796,17 +747,6 @@ printWidth: 80 ================================================================================ `; -exports[`valid-for-using-binding-of-of.js [acorn] format 1`] = ` -"Assigning to rvalue (2:8) - 1 | async function f() { -> 2 | for (await using of of of); - | ^ - 3 | for await (await using of of of); - 4 | } - 5 | -Cause: Assigning to rvalue (2:7)" -`; - exports[`valid-for-using-binding-of-of.js [espree] format 1`] = ` "Assigning to rvalue (2:8) 1 | async function f() { @@ -872,16 +812,6 @@ async function f() { ================================================================================ `; -exports[`valid-for-using-declaration.js [acorn] format 1`] = ` -"Unexpected token (2:20) - 1 | async function f() { -> 2 | for (await using basic = reader();;); - | ^ - 3 | } - 4 | -Cause: Unexpected token (2:19)" -`; - exports[`valid-for-using-declaration.js [espree] format 1`] = ` "Unexpected token basic (2:20) 1 | async function f() { @@ -1208,6 +1138,16 @@ for await (using of of); ================================================================================ `; +exports[`valid-using-as-identifier-for-in.js [acorn] format 1`] = ` +"Unexpected keyword 'in' (1:12) +> 1 | for (using in []); + | ^ + 2 | for (using.foo in []); + 3 | for (using().foo in []); + 4 | for (using\`\`.foo in []); +Cause: Unexpected keyword 'in' (1:11)" +`; + exports[`valid-using-as-identifier-for-in.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1264,6 +1204,14 @@ for (using\`\`.foo of of); ================================================================================ `; +exports[`valid-using-as-identifier-in.js [acorn] format 1`] = ` +"Unexpected keyword 'in' (1:7) +> 1 | using in using instanceof using; + | ^ + 2 | +Cause: Unexpected keyword 'in' (1:6)" +`; + exports[`valid-using-as-identifier-in.js format 1`] = ` ====================================options===================================== parsers: ["babel", "flow", "typescript"] @@ -1278,16 +1226,6 @@ using in using instanceof using; ================================================================================ `; -exports[`valid-using-binding-basic.js [acorn] format 1`] = ` -"Unexpected token (2:9) - 1 | { -> 2 | using basic = getReader(); - | ^ - 3 | } - 4 | -Cause: Unexpected token (2:8)" -`; - exports[`valid-using-binding-basic.js [espree] format 1`] = ` "Unexpected token basic (2:9) 1 | { @@ -1347,14 +1285,6 @@ printWidth: 80 ================================================================================ `; -exports[`valid-using-binding-escaped.js [acorn] format 1`] = ` -"Unexpected token (1:9) -> 1 | { using \\u0061b = c; } - | ^ - 2 | -Cause: Unexpected token (1:8)" -`; - exports[`valid-using-binding-escaped.js [espree] format 1`] = ` "Unexpected token \\u0061b (1:9) > 1 | { using \\u0061b = c; } @@ -1460,17 +1390,6 @@ printWidth: 80 ================================================================================ `; -exports[`valid-using-binding-using.js [acorn] format 1`] = ` -"Unexpected token (2:9) - 1 | { -> 2 | using using = of; - | ^ - 3 | for (using using of of); - 4 | } - 5 | -Cause: Unexpected token (2:8)" -`; - exports[`valid-using-binding-using.js [espree] format 1`] = ` "Unexpected token using (2:9) 1 | { diff --git a/tests/format/js/explicit-resource-management/format.test.js b/tests/format/js/explicit-resource-management/format.test.js index e78bbb0b6..8d01127eb 100644 --- a/tests/format/js/explicit-resource-management/format.test.js +++ b/tests/format/js/explicit-resource-management/format.test.js @@ -105,27 +105,16 @@ runFormatTest(import.meta, ["babel", "flow", "typescript"], { "valid-module-block-top-level-await-using-binding.js", ], acorn: [ - "for-await-using-of-comments.js", "invalid-duplicate-using-bindings.js", - "invalid-script-top-level-using-binding.js", - "using-declarations.js", - // "valid-for-await-using-binding-escaped-of-of.js", - // "valid-for-using-binding-escaped-of-of.js", + // "invalid-script-top-level-using-binding.js", + "valid-await-expr-using-in.js", + "valid-await-expr-using-instanceof.js", + "valid-await-expr-using.js", "valid-module-block-top-level-using-binding.js", - "valid-using-binding-basic.js", - "valid-using-binding-escaped.js", - "valid-using-binding-non-bmp.js", - "valid-using-binding-using.js", - - "valid-await-using-binding-basic.js", - "valid-await-using-binding-escaped.js", - "valid-await-using-binding-non-bmp.js", - "valid-await-using-binding-using.js", - "valid-await-using-comments.js", - "valid-for-lhs-await-as-identifier.js", - "valid-for-using-binding-of-of.js", - "valid-for-using-declaration.js", "valid-module-block-top-level-await-using-binding.js", + "valid-using-as-identifier-for-in.js", + "valid-using-as-identifier-in.js", + "valid-using-binding-non-bmp.js", ], oxc: [ // "invalid-duplicate-using-bindings.js", diff --git a/yarn.lock b/yarn.lock index 78a309756..4fde67288 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2631,12 +2631,12 @@ __metadata: languageName: node linkType: hard -"acorn@npm:8.14.1, acorn@npm:^8.14.0": - version: 8.14.1 - resolution: "acorn@npm:8.14.1" +"acorn@npm:8.15.0, acorn@npm:^8.14.0": + version: 8.15.0 + resolution: "acorn@npm:8.15.0" bin: acorn: bin/acorn - checksum: 10/d1379bbee224e8d44c3c3946e6ba6973e999fbdd4e22e41c3455d7f9b6f72f7ce18d3dc218002e1e48eea789539cf1cb6d1430c81838c6744799c712fb557d92 + checksum: 10/77f2de5051a631cf1729c090e5759148459cdb76b5f5c70f890503d629cf5052357b0ce783c0f976dd8a93c5150f59f6d18df1def3f502396a20f81282482fa4 languageName: node linkType: hard @@ -7327,7 +7327,7 @@ __metadata: "@typescript-eslint/parser": "npm:8.33.1" "@typescript-eslint/typescript-estree": "npm:8.33.1" "@typescript-eslint/visitor-keys": "npm:8.33.1" - acorn: "npm:8.14.1" + acorn: "npm:8.15.0" acorn-jsx: "npm:5.3.2" angular-estree-parser: "npm:12.1.0" angular-html-parser: "npm:8.1.0"