Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eselement

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eselement - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

CHANGELOG.md

24

lib/Element/core.js
var esquery = require("esquery")
, escodegen = require("escodegen");
, recast = require("recast");

@@ -72,3 +72,13 @@ // AST data

this.parentAttribute = parentAttribute;
this.recastPrelude = null;
if (ast.type === "File") {
ast = ast.program;
this.recastPrelude = {
type: "File"
, loc: ast.loc
, comments: ast.comments
};
}
// copy ast information onto object

@@ -127,3 +137,4 @@ forEachObject(ast, function (attr, value) {

this._forEachAttribute(function (attr, value) {
forEachObject(ATTR[this.type], function (attr) {
var value = this[attr];
if (arrayInstanceOf(value, Element)) {

@@ -136,3 +147,3 @@ children = children.concat(value);

}
});
}.bind(this));

@@ -333,2 +344,7 @@ return children;

if (this.recastPrelude !== null && this.parentElement === null) {
this.recastPrelude.program = element;
return this.recastPrelude.program;
}
return element;

@@ -338,3 +354,3 @@ };

Element.prototype.outerCode = function (opts) {
return escodegen.generate(this.outerAST(), opts);
return recast.print(this.outerAST(), opts).code;
};

@@ -10,2 +10,10 @@ {

},
"ArrayPattern": {
"elements": [
[
"Pattern",
"null"
]
]
},
"ArrowExpression": {

@@ -414,2 +422,10 @@ "body": [

},
"ObjectPattern": {
"properties": [
[
null
]
]
},
"Pattern": {},
"Position": {

@@ -416,0 +432,0 @@ "column": [

81

lib/Element/data/inherit.json

@@ -5,4 +5,10 @@ {

"Expression",
"ArrayExpression"
"ArrayExpression",
"Pattern"
],
"ArrayPattern": [
"Node",
"Pattern",
"ArrayPattern"
],
"ArrowExpression": [

@@ -12,3 +18,4 @@ "Node",

"Expression",
"ArrowExpression"
"ArrowExpression",
"Pattern"
],

@@ -18,3 +25,4 @@ "AssignmentExpression": [

"Expression",
"AssignmentExpression"
"AssignmentExpression",
"Pattern"
],

@@ -24,3 +32,4 @@ "BinaryExpression": [

"Expression",
"BinaryExpression"
"BinaryExpression",
"Pattern"
],

@@ -40,3 +49,4 @@ "BlockStatement": [

"Expression",
"CallExpression"
"CallExpression",
"Pattern"
],

@@ -54,3 +64,4 @@ "CatchClause": [

"Expression",
"ComprehensionExpression"
"ComprehensionExpression",
"Pattern"
],

@@ -60,3 +71,4 @@ "ConditionalExpression": [

"Expression",
"ConditionalExpression"
"ConditionalExpression",
"Pattern"
],

@@ -90,3 +102,4 @@ "ContinueStatement": [

"Node",
"Expression"
"Expression",
"Pattern"
],

@@ -128,3 +141,4 @@ "ExpressionStatement": [

"Expression",
"FunctionExpression"
"FunctionExpression",
"Pattern"
],

@@ -134,3 +148,4 @@ "GeneratorExpression": [

"Expression",
"GeneratorExpression"
"GeneratorExpression",
"Pattern"
],

@@ -140,3 +155,4 @@ "GraphExpression": [

"Expression",
"GraphExpression"
"GraphExpression",
"Pattern"
],

@@ -146,3 +162,4 @@ "GraphIndexExpression": [

"Expression",
"GraphIndexExpression"
"GraphIndexExpression",
"Pattern"
],

@@ -168,3 +185,4 @@ "Identifier": [

"Expression",
"LetExpression"
"LetExpression",
"Pattern"
],

@@ -179,2 +197,3 @@ "LetStatement": [

"Expression",
"Pattern",
"Literal"

@@ -185,3 +204,4 @@ ],

"Expression",
"LogicalExpression"
"LogicalExpression",
"Pattern"
],

@@ -191,3 +211,4 @@ "MemberExpression": [

"Expression",
"MemberExpression"
"MemberExpression",
"Pattern"
],

@@ -197,3 +218,4 @@ "NewExpression": [

"Expression",
"NewExpression"
"NewExpression",
"Pattern"
],

@@ -206,4 +228,14 @@ "Node": [

"Expression",
"ObjectExpression"
"ObjectExpression",
"Pattern"
],
"ObjectPattern": [
"Node",
"Pattern",
"ObjectPattern"
],
"Pattern": [
"Node",
"Pattern"
],
"Position": [

@@ -228,3 +260,4 @@ "Position"

"Expression",
"SequenceExpression"
"SequenceExpression",
"Pattern"
],

@@ -250,3 +283,4 @@ "SourceLocation": [

"Expression",
"ThisExpression"
"ThisExpression",
"Pattern"
],

@@ -266,3 +300,4 @@ "ThrowStatement": [

"Expression",
"UnaryExpression"
"UnaryExpression",
"Pattern"
],

@@ -272,3 +307,4 @@ "UpdateExpression": [

"Expression",
"UpdateExpression"
"UpdateExpression",
"Pattern"
],

@@ -298,4 +334,5 @@ "VariableDeclaration": [

"Expression",
"YieldExpression"
"YieldExpression",
"Pattern"
]
}
var fs = require("fs")
, esprima = require("esprima");
, recast = require("recast");

@@ -11,4 +11,4 @@ var Element = require("./Element");

var ast = esprima.parse(content, opts);
var ast = recast.parse(content, opts);
return new Element(null, null, ast);
};
{
"name": "eselement"
, "version": "0.1.0"
, "version": "0.1.1"
, "description": "DOM-like wrapper around the Javascript AST"
, "main": "./lib/index.js"
, "dependencies": {
"esprima": "^2.0.0"
"recast": "^0.10.0"
, "esquery": "^0.3.0"
, "escodegen": "^1.6.1"
}

@@ -15,3 +14,2 @@ , "devDependencies": {

, "istanbul": "^0.3.5"
, "pegjs": "^0.8.0"
}

@@ -30,3 +28,5 @@ , "scripts": {

, "esprima"
, "recast"
, "ecmascript"
, "refactor"
]

@@ -33,0 +33,0 @@ , "author": "Ola Holmström"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc