This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+36
View File
@@ -1,3 +1,39 @@
## 8.2.0 (2021-09-06)
### New features
Add support for walking ES2022 class static blocks.
## 8.1.1 (2021-06-29)
### Bug fixes
Include `base` in the type declarations.
## 8.1.0 (2021-04-24)
### New features
Support node types for class fields and private methods.
## 8.0.2 (2021-01-25)
### Bug fixes
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
## 8.0.0 (2021-01-05)
### Bug fixes
Fix a bug where `full` and `fullAncestor` would skip nodes with overridden types.
## 8.0.0 (2020-08-12)
### New features
The package can now be loaded directly as an ECMAScript module in node 13+.
## 7.2.0 (2020-06-17)
### New features
+3 -1
View File
@@ -1,4 +1,6 @@
Copyright (C) 2012-2018 by various contributors (see AUTHORS)
MIT License
Copyright (C) 2012-2020 by various contributors (see AUTHORS)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2
View File
@@ -109,4 +109,6 @@ declare module "acorn-walk" {
): Found<TState> | undefined;
export const findNodeAfter: typeof findNodeAround;
export const base: RecursiveVisitors<any>;
}
+17 -17
View File
@@ -72,11 +72,15 @@
// A full walk triggers the callback on each node
function full(node, callback, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
if (!baseVisitor) { baseVisitor = base; }
var last
;(function c(node, st, override) {
var type = override || node.type;
baseVisitor[type](node, st, c);
if (!override) { callback(node, st, type); }
if (last !== node) {
callback(node, st, type);
last = node;
}
})(node, state, override);
}
@@ -84,13 +88,16 @@
// the callback on each node
function fullAncestor(node, callback, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
var ancestors = []
var ancestors = [], last
;(function c(node, st, override) {
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (!override) { callback(node, st || ancestors, ancestors, type); }
if (last !== node) {
callback(node, st || ancestors, ancestors, type);
last = node;
}
if (isNew) { ancestors.pop(); }
})(node, state);
}
@@ -168,17 +175,10 @@
return max
}
// Fallback to an Object.create polyfill for older environments.
var create = Object.create || function(proto) {
function Ctor() {}
Ctor.prototype = proto;
return new Ctor
};
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
function make(funcs, baseVisitor) {
var visitor = create(baseVisitor || base);
var visitor = Object.create(baseVisitor || base);
for (var type in funcs) { visitor[type] = funcs[type]; }
return visitor
}
@@ -190,7 +190,7 @@
var base = {};
base.Program = base.BlockStatement = function (node, st, c) {
base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{
var stmt = list[i];
@@ -421,7 +421,7 @@
base.ImportExpression = function (node, st, c) {
c(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
@@ -441,9 +441,9 @@
c(elt, st);
}
};
base.MethodDefinition = base.Property = function (node, st, c) {
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
if (node.computed) { c(node.key, st, "Expression"); }
c(node.value, st, "Expression");
if (node.value) { c(node.value, st, "Expression"); }
};
exports.ancestor = ancestor;
+17 -17
View File
@@ -66,11 +66,15 @@ var Found = function Found(node, state) { this.node = node; this.state = state;
// A full walk triggers the callback on each node
function full(node, callback, baseVisitor, state, override) {
if (!baseVisitor) { baseVisitor = base
; }(function c(node, st, override) {
if (!baseVisitor) { baseVisitor = base; }
var last
;(function c(node, st, override) {
var type = override || node.type;
baseVisitor[type](node, st, c);
if (!override) { callback(node, st, type); }
if (last !== node) {
callback(node, st, type);
last = node;
}
})(node, state, override);
}
@@ -78,13 +82,16 @@ function full(node, callback, baseVisitor, state, override) {
// the callback on each node
function fullAncestor(node, callback, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
var ancestors = []
var ancestors = [], last
;(function c(node, st, override) {
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
baseVisitor[type](node, st, c);
if (!override) { callback(node, st || ancestors, ancestors, type); }
if (last !== node) {
callback(node, st || ancestors, ancestors, type);
last = node;
}
if (isNew) { ancestors.pop(); }
})(node, state);
}
@@ -162,17 +169,10 @@ function findNodeBefore(node, pos, test, baseVisitor, state) {
return max
}
// Fallback to an Object.create polyfill for older environments.
var create = Object.create || function(proto) {
function Ctor() {}
Ctor.prototype = proto;
return new Ctor
};
// Used to create a custom walker. Will fill in all missing node
// type properties with the defaults.
function make(funcs, baseVisitor) {
var visitor = create(baseVisitor || base);
var visitor = Object.create(baseVisitor || base);
for (var type in funcs) { visitor[type] = funcs[type]; }
return visitor
}
@@ -184,7 +184,7 @@ function ignore(_node, _st, _c) {}
var base = {};
base.Program = base.BlockStatement = function (node, st, c) {
base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) {
for (var i = 0, list = node.body; i < list.length; i += 1)
{
var stmt = list[i];
@@ -415,7 +415,7 @@ base.ImportDeclaration = function (node, st, c) {
base.ImportExpression = function (node, st, c) {
c(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
@@ -435,9 +435,9 @@ base.ClassBody = function (node, st, c) {
c(elt, st);
}
};
base.MethodDefinition = base.Property = function (node, st, c) {
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
if (node.computed) { c(node.key, st, "Expression"); }
c(node.value, st, "Expression");
if (node.value) { c(node.value, st, "Expression"); }
};
export { ancestor, base, findNodeAfter, findNodeAround, findNodeAt, findNodeBefore, full, fullAncestor, make, recursive, simple };
+23 -12
View File
@@ -1,32 +1,32 @@
{
"_args": [
[
"acorn-walk@7.2.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
"acorn-walk@8.2.0",
"/home/node/nuxt"
]
],
"_from": "acorn-walk@7.2.0",
"_id": "acorn-walk@7.2.0",
"_from": "acorn-walk@8.2.0",
"_id": "acorn-walk@8.2.0",
"_inBundle": false,
"_integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==",
"_integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"_location": "/acorn-walk",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "acorn-walk@7.2.0",
"raw": "acorn-walk@8.2.0",
"name": "acorn-walk",
"escapedName": "acorn-walk",
"rawSpec": "7.2.0",
"rawSpec": "8.2.0",
"saveSpec": null,
"fetchSpec": "7.2.0"
"fetchSpec": "8.2.0"
},
"_requiredBy": [
"/webpack-bundle-analyzer"
],
"_resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz",
"_spec": "7.2.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"_resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"_spec": "8.2.0",
"_where": "/home/node/nuxt",
"bugs": {
"url": "https://github.com/acornjs/acorn/issues"
},
@@ -34,6 +34,17 @@
"engines": {
"node": ">=0.4.0"
},
"exports": {
".": [
{
"import": "./dist/walk.mjs",
"require": "./dist/walk.js",
"default": "./dist/walk.js"
},
"./dist/walk.js"
],
"./package.json": "./package.json"
},
"homepage": "https://github.com/acornjs/acorn",
"license": "MIT",
"main": "dist/walk.js",
@@ -63,5 +74,5 @@
"prepare": "cd ..; npm run build:walk"
},
"types": "dist/walk.d.ts",
"version": "7.2.0"
"version": "8.2.0"
}