deps: update acorn-walk to 8.3.1

PR-URL: https://github.com/nodejs/node/pull/50457
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Node.js GitHub Bot
2023-12-10 00:26:41 +00:00
parent 0281296bfe
commit 14e3444a66
6 changed files with 25 additions and 13 deletions

View File

@@ -1,3 +1,11 @@
## 8.3.1 (2023-12-06)
### Bug fixes
Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error.
Visitor functions are now called in such a way that their `this` refers to the object they are part of.
## 8.3.0 (2023-10-26)
### New features

View File

@@ -16,6 +16,8 @@ export type FullAncestorWalkerCallback<TState> = (
type AggregateType = {
Expression: acorn.Expression,
Statement: acorn.Statement,
Function: acorn.Function,
Class: acorn.Class,
Pattern: acorn.Pattern,
ForInit: acorn.VariableDeclaration | acorn.Expression
}

View File

@@ -16,6 +16,8 @@ export type FullAncestorWalkerCallback<TState> = (
type AggregateType = {
Expression: acorn.Expression,
Statement: acorn.Statement,
Function: acorn.Function,
Class: acorn.Class,
Pattern: acorn.Pattern,
ForInit: acorn.VariableDeclaration | acorn.Expression
}

View File

@@ -4,7 +4,7 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.acorn = global.acorn || {}, global.acorn.walk = {})));
})(this, (function (exports) { 'use strict';
// AST walker module for Mozilla Parser API compatible trees
// AST walker module for ESTree compatible trees
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
@@ -14,7 +14,7 @@
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// to do something with all expressions. All ESTree node types
// can be used to identify node types, as well as Expression and
// Statement, which denote categories of nodes.
//
@@ -25,9 +25,9 @@
function simple(node, visitors, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type];
var type = override || node.type;
baseVisitor[type](node, st, c);
if (found) { found(node, st); }
if (visitors[type]) { visitors[type](node, st); }
})(node, state, override);
}
@@ -38,11 +38,11 @@
var ancestors = [];
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type];
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (found) { found(node, st || ancestors, ancestors); }
if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); }
if (isNew) { ancestors.pop(); }
})(node, state, override);
}

View File

@@ -1,4 +1,4 @@
// AST walker module for Mozilla Parser API compatible trees
// AST walker module for ESTree compatible trees
// A simple walk is one where you simply specify callbacks to be
// called on specific nodes. The last two arguments are optional. A
@@ -8,7 +8,7 @@
// Expression: function(node) { ... }
// });
//
// to do something with all expressions. All Parser API node types
// to do something with all expressions. All ESTree node types
// can be used to identify node types, as well as Expression and
// Statement, which denote categories of nodes.
//
@@ -19,9 +19,9 @@
function simple(node, visitors, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type];
var type = override || node.type;
baseVisitor[type](node, st, c);
if (found) { found(node, st); }
if (visitors[type]) { visitors[type](node, st); }
})(node, state, override);
}
@@ -32,11 +32,11 @@ function ancestor(node, visitors, baseVisitor, state, override) {
var ancestors = [];
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
var type = override || node.type, found = visitors[type];
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (found) { found(node, st || ancestors, ancestors); }
if (visitors[type]) { visitors[type](node, st || ancestors, ancestors); }
if (isNew) { ancestors.pop(); }
})(node, state, override);
}

View File

@@ -16,7 +16,7 @@
],
"./package.json": "./package.json"
},
"version": "8.3.0",
"version": "8.3.1",
"engines": {
"node": ">=0.4.0"
},