Socket
Socket
Sign inDemoInstall

escodegen

Package Overview
Dependencies
16
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.4.1 to 1.4.2

benchmark/asts.js

42

bin/escodegen.js

@@ -33,14 +33,46 @@ #!/usr/bin/env node

escodegen = require(root),
files = process.argv.splice(2);
optionator = require('optionator')({
prepend: 'Usage: escodegen [options] file...',
options: [
{
option: 'config',
alias: 'c',
type: 'String',
description: 'configuration json for escodegen'
}
]
}),
args = optionator.parse(process.argv),
files = args._,
options,
esprimaOptions = {
raw: true,
tokens: true,
range: true,
comment: true
};
if (files.length === 0) {
console.log('Usage:');
console.log(' escodegen file.js');
console.log(optionator.generateHelp());
process.exit(1);
}
if (args.config) {
try {
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'));
} catch (err) {
console.error('Error parsing config: ', err);
}
}
files.forEach(function (filename) {
var content = fs.readFileSync(filename, 'utf-8');
console.log(escodegen.generate(esprima.parse(content)));
var content = fs.readFileSync(filename, 'utf-8'),
syntax = esprima.parse(content, esprimaOptions);
if (options.comment) {
escodegen.attachComments(syntax, syntax.comments, syntax.tokens);
}
console.log(escodegen.generate(syntax, options));
});
/* vim: set sw=4 ts=4 et tw=80 : */

@@ -31,16 +31,35 @@ #!/usr/bin/env node

root = path.join(path.dirname(fs.realpathSync(__filename)), '..'),
esprima = require('esprima'),
escodegen = require(root),
files = process.argv.splice(2);
optionator = require('optionator')({
prepend: 'Usage: esgenerate [options] file.json ...',
options: [
{
option: 'config',
alias: 'c',
type: 'String',
description: 'configuration json for escodegen'
}
]
}),
args = optionator.parse(process.argv),
files = args._,
options;
if (files.length === 0) {
console.log('Usage:');
console.log(' esgenerate file.json');
console.log(optionator.generateHelp());
process.exit(1);
}
if (args.config) {
try {
options = JSON.parse(fs.readFileSync(args.config, 'utf-8'))
} catch (err) {
console.error('Error parsing config: ', err);
}
}
files.forEach(function (filename) {
var content = fs.readFileSync(filename, 'utf-8');
console.log(escodegen.generate(JSON.parse(content)));
console.log(escodegen.generate(JSON.parse(content), options));
});
/* vim: set sw=4 ts=4 et tw=80 : */

27

component.json
{
"name": "escodegen",
"description": "ECMAScript code generator",
"homepage": "http://github.com/Constellation/escodegen",
"homepage": "http://github.com/estools/escodegen",
"main": "escodegen.js",

@@ -10,3 +10,3 @@ "bin": {

},
"version": "1.4.1",
"version": "1.4.2",
"engines": {

@@ -24,8 +24,9 @@ "node": ">=0.10.0"

"type": "git",
"url": "http://github.com/Constellation/escodegen.git"
"url": "http://github.com/estools/escodegen.git"
},
"dependencies": {
"esutils": "^1.1.4",
"optionator": "^0.4.0",
"esprima": "^1.2.2",
"estraverse": "^1.5.1"
"esutils": "^1.1.6",
"estraverse": "^1.9.0"
},

@@ -35,11 +36,9 @@ "optionalDependencies": {},

"esprima-moz": "*",
"semver": "^3.0.1",
"bluebird": "^2.2.2",
"jshint-stylish": "^0.4.0",
"chai": "^1.9.1",
"gulp-mocha": "^1.0.0",
"gulp-eslint": "^0.1.8",
"gulp": "^3.8.6",
"semver": "^4.1.0",
"bluebird": "^2.3.11",
"chai": "^1.10.0",
"gulp-mocha": "^2.0.0",
"gulp-eslint": "^0.2.0",
"gulp": "^3.8.10",
"bower-registry-client": "^0.2.1",
"gulp-jshint": "^1.8.0",
"commonjs-everywhere": "^0.9.7"

@@ -50,3 +49,3 @@ },

"type": "BSD",
"url": "http://github.com/Constellation/escodegen/raw/master/LICENSE.BSD"
"url": "http://github.com/estools/escodegen/raw/master/LICENSE.BSD"
}

@@ -53,0 +52,0 @@ ],

@@ -29,3 +29,2 @@ /*

var mocha = require('gulp-mocha');
var jshint = require('gulp-jshint');
var eslint = require('gulp-eslint');

@@ -41,9 +40,23 @@

var ESLINT_OPTION = {
'rulesdir': 'tools/rules/',
'rulesPaths': [ 'tools/rules/' ],
'rules': {
'push-with-multiple-arguments': 2,
// 'push-with-multiple-arguments': 2,
'quotes': 0,
'eqeqeq': 0,
'no-use-before-define': 0,
'no-shadow': 0
'no-shadow': 0,
'no-unused-vars': [
2,
{
'vars': 'all',
'args': 'none'
}
],
'no-multi-spaces': false,
'new-cap': [
2,
{
'capIsNew': false
}
]
},

@@ -65,7 +78,4 @@ 'env': {

return gulp.src(LINT)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(require('jshint-stylish')))
.pipe(jshint.reporter('fail'))
.pipe(eslint(ESLINT_OPTION))
.pipe(eslint.formatEach('compact', process.stderr))
.pipe(eslint.formatEach('stylish', process.stderr))
.pipe(eslint.failOnError());

@@ -72,0 +82,0 @@ });

{
"name": "escodegen",
"description": "ECMAScript code generator",
"homepage": "http://github.com/Constellation/escodegen",
"homepage": "http://github.com/estools/escodegen",
"main": "escodegen.js",

@@ -10,3 +10,3 @@ "bin": {

},
"version": "1.4.1",
"version": "1.4.2",
"engines": {

@@ -24,23 +24,22 @@ "node": ">=0.10.0"

"type": "git",
"url": "http://github.com/Constellation/escodegen.git"
"url": "http://github.com/estools/escodegen.git"
},
"dependencies": {
"estraverse": "^1.5.1",
"esutils": "^1.1.4",
"esprima": "^1.2.2"
"estraverse": "^1.9.0",
"esutils": "^1.1.6",
"esprima": "^1.2.2",
"optionator": "^0.4.0"
},
"optionalDependencies": {
"source-map": "~0.1.37"
"source-map": "~0.1.40"
},
"devDependencies": {
"esprima-moz": "*",
"semver": "^3.0.1",
"bluebird": "^2.2.2",
"jshint-stylish": "^0.4.0",
"chai": "^1.9.1",
"gulp-mocha": "^1.0.0",
"gulp-eslint": "^0.1.8",
"gulp": "^3.8.6",
"semver": "^4.1.0",
"bluebird": "^2.3.11",
"chai": "^1.10.0",
"gulp-mocha": "^2.0.0",
"gulp-eslint": "^0.2.0",
"gulp": "^3.8.10",
"bower-registry-client": "^0.2.1",
"gulp-jshint": "^1.8.0",
"commonjs-everywhere": "^0.9.7"

@@ -51,3 +50,3 @@ },

"type": "BSD",
"url": "http://github.com/Constellation/escodegen/raw/master/LICENSE.BSD"
"url": "http://github.com/estools/escodegen/raw/master/LICENSE.BSD"
}

@@ -54,0 +53,0 @@ ],

@@ -1,8 +0,12 @@

### Escodegen [![Build Status](https://secure.travis-ci.org/Constellation/escodegen.svg)](http://travis-ci.org/Constellation/escodegen) [![Build Status](https://drone.io/github.com/Constellation/escodegen/status.png)](https://drone.io/github.com/Constellation/escodegen/latest) [![devDependency Status](https://david-dm.org/Constellation/escodegen/dev-status.svg)](https://david-dm.org/Constellation/escodegen#info=devDependencies)
## Escodegen
[![npm version](https://badge.fury.io/js/escodegen.svg)](http://badge.fury.io/js/escodegen)
[![Build Status](https://secure.travis-ci.org/estools/escodegen.svg)](http://travis-ci.org/estools/escodegen)
[![Dependency Status](https://david-dm.org/estools/escodegen.svg)](https://david-dm.org/estools/escodegen)
[![devDependency Status](https://david-dm.org/estools/escodegen/dev-status.svg)](https://david-dm.org/estools/escodegen#info=devDependencies)
Escodegen ([escodegen](http://github.com/Constellation/escodegen)) is an
Escodegen ([escodegen](http://github.com/estools/escodegen)) is an
[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
(also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript))
code generator from [Mozilla'ss Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
AST. See the [online generator](https://constellation.github.io/escodegen/demo/index.html)
code generator from [Mozilla's Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
AST. See the [online generator](https://estools.github.io/escodegen/demo/index.html)
for a demo.

@@ -36,3 +40,3 @@

See the [API page](https://github.com/Constellation/escodegen/wiki/API) for
See the [API page](https://github.com/estools/escodegen/wiki/API) for
options. To run the tests, execute `npm test` in the root directory.

@@ -39,0 +43,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc