From 12f28f33c224e6947a18024ae72713171c24ee43 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 2 Jan 2024 02:47:20 +0200 Subject: [PATCH] deps: update acorn to 8.11.3 PR-URL: https://github.com/nodejs/node/pull/51317 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca --- deps/acorn/acorn/CHANGELOG.md | 10 ++++++++++ deps/acorn/acorn/dist/acorn.js | 17 +++++++++-------- deps/acorn/acorn/dist/acorn.mjs | 17 +++++++++-------- deps/acorn/acorn/package.json | 2 +- src/acorn_version.h | 2 +- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/deps/acorn/acorn/CHANGELOG.md b/deps/acorn/acorn/CHANGELOG.md index 02a4b546153973..eb848a58b8a091 100644 --- a/deps/acorn/acorn/CHANGELOG.md +++ b/deps/acorn/acorn/CHANGELOG.md @@ -1,3 +1,13 @@ +## 8.11.3 (2023-12-29) + +### Bug fixes + +Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error. + +Make sure `onToken` get an `import` keyword token when parsing `import.meta`. + +Fix a bug where `.loc.start` could be undefined for `new.target` `meta` nodes. + ## 8.11.2 (2023-10-27) ### Bug fixes diff --git a/deps/acorn/acorn/dist/acorn.js b/deps/acorn/acorn/dist/acorn.js index de0096ec9a6a31..3a6a3a2aeed54c 100644 --- a/deps/acorn/acorn/dist/acorn.js +++ b/deps/acorn/acorn/dist/acorn.js @@ -2942,12 +2942,14 @@ // Consume `import` as an identifier for `import.meta`. // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } - var meta = this.parseIdent(true); + this.next(); if (this.type === types$1.parenL && !forNew) { return this.parseDynamicImport(node) } else if (this.type === types$1.dot) { - node.meta = meta; + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); + meta.name = "import"; + node.meta = this.finishNode(meta, "Identifier"); return this.parseImportMeta(node) } else { this.unexpected(); @@ -3097,7 +3099,7 @@ var node = this.startNode(); this.next(); if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) { - var meta = this.startNodeAt(node.start, node.startLoc); + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); meta.name = "new"; node.meta = this.finishNode(meta, "Identifier"); this.next(); @@ -5925,7 +5927,7 @@ // [walk]: util/walk.js - var version = "8.11.2"; + var version = "8.11.3"; Parser.acorn = { Parser: Parser, @@ -5950,11 +5952,10 @@ }; // The main exported interface (under `self.acorn` when in the - // browser) is a `parse` function that takes a code string and - // returns an abstract syntax tree as specified by [Mozilla parser - // API][api]. + // browser) is a `parse` function that takes a code string and returns + // an abstract syntax tree as specified by the [ESTree spec][estree]. // - // [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API + // [estree]: https://github.com/estree/estree function parse(input, options) { return Parser.parse(input, options) diff --git a/deps/acorn/acorn/dist/acorn.mjs b/deps/acorn/acorn/dist/acorn.mjs index 01a49ef94da2a7..d1f81ef48511a4 100644 --- a/deps/acorn/acorn/dist/acorn.mjs +++ b/deps/acorn/acorn/dist/acorn.mjs @@ -2936,12 +2936,14 @@ pp$5.parseExprImport = function(forNew) { // Consume `import` as an identifier for `import.meta`. // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); } - var meta = this.parseIdent(true); + this.next(); if (this.type === types$1.parenL && !forNew) { return this.parseDynamicImport(node) } else if (this.type === types$1.dot) { - node.meta = meta; + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); + meta.name = "import"; + node.meta = this.finishNode(meta, "Identifier"); return this.parseImportMeta(node) } else { this.unexpected(); @@ -3091,7 +3093,7 @@ pp$5.parseNew = function() { var node = this.startNode(); this.next(); if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) { - var meta = this.startNodeAt(node.start, node.startLoc); + var meta = this.startNodeAt(node.start, node.loc && node.loc.start); meta.name = "new"; node.meta = this.finishNode(meta, "Identifier"); this.next(); @@ -5919,7 +5921,7 @@ pp.readWord = function() { // [walk]: util/walk.js -var version = "8.11.2"; +var version = "8.11.3"; Parser.acorn = { Parser: Parser, @@ -5944,11 +5946,10 @@ Parser.acorn = { }; // The main exported interface (under `self.acorn` when in the -// browser) is a `parse` function that takes a code string and -// returns an abstract syntax tree as specified by [Mozilla parser -// API][api]. +// browser) is a `parse` function that takes a code string and returns +// an abstract syntax tree as specified by the [ESTree spec][estree]. // -// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API +// [estree]: https://github.com/estree/estree function parse(input, options) { return Parser.parse(input, options) diff --git a/deps/acorn/acorn/package.json b/deps/acorn/acorn/package.json index 430603dc8c3d57..1b8dc76afc3cf5 100644 --- a/deps/acorn/acorn/package.json +++ b/deps/acorn/acorn/package.json @@ -16,7 +16,7 @@ ], "./package.json": "./package.json" }, - "version": "8.11.2", + "version": "8.11.3", "engines": { "node": ">=0.4.0" }, diff --git a/src/acorn_version.h b/src/acorn_version.h index 7798e9d67af869..1c7253be9312f3 100644 --- a/src/acorn_version.h +++ b/src/acorn_version.h @@ -2,5 +2,5 @@ // Refer to tools/update-acorn.sh #ifndef SRC_ACORN_VERSION_H_ #define SRC_ACORN_VERSION_H_ -#define ACORN_VERSION "8.11.2" +#define ACORN_VERSION "8.11.3" #endif // SRC_ACORN_VERSION_H_