ajaxorg / treehugger Goto Github PK
View Code? Open in Web Editor NEWJavaScript AST (Abstract Syntax Tree) transformation tools
Home Page: http://ajaxorg.github.com/treehugger/test.html
License: MIT License
JavaScript AST (Abstract Syntax Tree) transformation tools
Home Page: http://ajaxorg.github.com/treehugger/test.html
License: MIT License
We should wait to see what UglifyJS 2.0 will evolve to, but sooner or later we ought to swap.
function fn(){};
(function fn(){});
all of those are parse as
Function(
"fn",
[],
[]
)
but
(function fn(){ /* fn is *Effective* in this Scope */ }());
console.log(typeof fn);// undefined --> but lost effective when out of "( )";
In parse.js
there is a console.log("Not yet supported: " + nodeName)
line, which feeds chrome's log buffer until it crashes. I had to comment that line to keep cloud9 usable. For me it prints these two:
Not yet supported: TemplateLiteral
Not yet supported: Super
Maybe, if you really want to keep that message, it would be nice to log each unsupported node type just once?
just bumped into the library. Thinking it's still missing the line:col info and range info like esprima does: http://esprima.org/demo/parse.html
Maybe it is good to add it down the road.
<_>
should not bind.
From using your online demo, it seems that comments don't appear in the AST. I am aware that the standard version of Narcissus does not preserve comments, but other products, like JsShaper do preserve comments. Is this possible with treehugger?
I'd love to be able to declare this as a dependency in my node library, but a new version hasn't been released in 2 years. Any chance we could get a version bump and a package deploy?
For better require.js loading behavior.
Just a tweak to the example.
ast.traverseTopDown(
'VarDecl(x)',
function(b) {
declared[b.x.value] = true;
},
'VarDeclInit(x, _)',
function(b) {
declared[b.x.value] = true;
},
'FArg(x)',
function(b) {
declared[b.x.value] = true;
},
'Var(x)',
function(b) {
if (!declared[b.x.value]) {
log("Variable " + b.x.value + " is not declared.");
}
}
);
And requesting that acorn be updated (with a link to the commit that you're modifying somewhere before modification to make it easier to track down just what changes you're doing for future updates). Acorn now handles ECMA 3-6 where 0.4.1 didn't.
Great program, looking forward to working on it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.