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

aether

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aether - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

2

bower.json
{
"name": "aether",
"version": "0.2.5",
"version": "0.2.6",
"homepage": "https://github.com/codecombat/aether",

@@ -5,0 +5,0 @@ "authors": [

(function() {
var Clojure, Language, assertions, closer, closerCore, estraverse,
var Clojure, Language, assertions, callParser, closer, closerCore,
__hasProp = {}.hasOwnProperty,

@@ -14,3 +14,31 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

estraverse = require('estraverse');
callParser = function(code, aether, loose) {
var ast, lastStmt, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
ast = closer.parse(code, {
loc: true,
range: true,
loose: loose
});
if ((_ref = ast.body[0]) != null) {
if ((_ref1 = _ref.declarations) != null) {
if ((_ref2 = _ref1[0]) != null) {
if ((_ref3 = _ref2.init) != null) {
if ((_ref4 = _ref3.body) != null) {
if ((_ref5 = _ref4.body) != null) {
_ref5.splice(0, 1);
}
}
}
}
}
}
closerCore.$wireCallsToCoreFunctions(ast);
lastStmt = ast.body[ast.body.length - 1];
if ((lastStmt != null ? lastStmt.type : void 0) === 'ExpressionStatement') {
lastStmt.type = 'ReturnStatement';
lastStmt.argument = lastStmt.expression;
delete lastStmt.expression;
}
return ast;
};

@@ -41,32 +69,31 @@ module.exports = Clojure = (function(_super) {

Clojure.prototype.parse = function(code, aether) {
var ast;
ast = closer.parse(code, {
loc: true,
range: true
});
ast.body[0].declarations[0].init.body.body.splice(0, 1);
estraverse.replace(ast, {
leave: function(node) {
var lastStmt, obj, prop;
if (node.type === 'Identifier' && node.name in closerCore) {
obj = closer.node('Identifier', 'closerCore', node.loc);
prop = closer.node('Identifier', node.name, node.loc);
node = closer.node('MemberExpression', obj, prop, false, node.loc);
} else if (node.type === 'MemberExpression' && node.object.type === 'Identifier' && node.object.name === 'closerCore' && node.property.type === 'MemberExpression' && node.property.object.type === 'Identifier' && node.property.object.name === 'closerCore') {
return node.property;
} else if (node.type === 'Program') {
lastStmt = node.body[node.body.length - 1];
if (lastStmt.type === 'ExpressionStatement') {
lastStmt.type = 'ReturnStatement';
lastStmt.argument = lastStmt.expression;
delete lastStmt.expression;
}
}
return node;
Clojure.prototype.lint = function(rawCode, aether) {
var ast, error, lintProblems, _i, _len, _ref;
lintProblems = [];
ast = callParser(rawCode, aether, true);
if (ast.errors) {
_ref = ast.errors;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
error = _ref[_i];
lintProblems.push(aether.createUserCodeProblem({
type: 'transpile',
reporter: 'closer',
level: 'warning',
error: error,
code: rawCode,
codePrefix: ''
}));
}
});
return ast;
}
return lintProblems;
};
Clojure.prototype.parse = function(code, aether) {
return callParser(code, aether, false);
};
Clojure.prototype.parseDammit = function(code, aether) {
return callParser(code, aether, true);
};
return Clojure;

@@ -73,0 +100,0 @@

(function() {
var Language, Lua, lua2js, _ref,
var Language, Lua, lua2js, ranges, _ref,
__hasProp = {}.hasOwnProperty,

@@ -10,2 +10,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

ranges = require('../ranges');
module.exports = Lua = (function(_super) {

@@ -31,5 +33,6 @@ __extends(Lua, _super);

Lua.prototype.parse = function(code, aether) {
Lua.prototype.callParser = function(code, loose) {
var ast;
ast = lua2js.parse(code, {
loose: loose,
forceVar: false,

@@ -41,2 +44,40 @@ decorateLuaObjects: true,

});
return ast;
};
Lua.prototype.lint = function(rawCode, aether) {
var ast, e, error, lintProblems, rng, _i, _len, _ref1;
lintProblems = [];
try {
ast = this.callParser(rawCode, true);
} catch (_error) {
e = _error;
return [];
return [
aether.createUserCodeProblem({
type: 'transpile',
reporter: 'lua2js',
error: e,
code: rawCode,
codePrefix: ""
})
];
}
_ref1 = ast.errors;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
error = _ref1[_i];
rng = ranges.offsetsToRange(error.range[0], error.range[1], rawCode, '');
lintProblems.push(aether.createUserCodeProblem({
type: 'transpile',
reporter: 'lua2js',
message: error.msg,
code: rawCode,
codePrefix: "",
range: [rng.start, rng.end]
}));
}
return lintProblems;
};
Lua.prototype.wrapResult = function(ast, name) {
ast = {

@@ -49,3 +90,3 @@ type: "Program",

type: "Identifier",
name: aether.options.functionName
name: name || 'foo'
},

@@ -76,2 +117,26 @@ params: [],

Lua.prototype.parse = function(code, aether) {
return Lua.prototype.wrapResult(Lua.prototype.callParser(code, false), aether.options.functionName);
};
Lua.prototype.parseDammit = function(code, aether) {
var error;
try {
return Lua.prototype.wrapResult(Lua.prototype.callParser(code, true), aether.options.functionName);
} catch (_error) {
error = _error;
return {
"type": {
"BlockStatement": {
body: [
{
type: "EmptyStatement"
}
]
}
}
};
}
};
return Lua;

@@ -78,0 +143,0 @@

@@ -38,3 +38,3 @@ (function() {

extractTranspileErrorDetails = function(options) {
var code, codePrefix, endCol, error, line, lineOffset, originalLines, startCol, _ref, _ref1;
var code, codePrefix, endCol, error, line, lineOffset, originalLines, range, rng, startCol, _ref, _ref1;
code = options.code || '';

@@ -87,6 +87,13 @@ codePrefix = options.codePrefix || 'function wrapped() {\n"use strict";\n';

case 'closer':
null;
if (error.startOffset && error.endOffset) {
range = ranges.offsetsToRange(error.startOffset, error.endOffset, code);
options.range = [range.start, range.end];
}
break;
case 'lua2js':
null;
if (options.message == null) {
options.message = error.message;
}
rng = ranges.offsetsToRange(error.offset, error.offset, code, '');
options.range = [rng.start, rng.end];
break;

@@ -93,0 +100,0 @@ case 'filbert':

{
"name": "aether",
"version": "0.2.5",
"version": "0.2.6",
"description": "Analyzes, instruments, and transpiles JS to help beginners.",

@@ -39,3 +39,3 @@ "keywords": [

"grunt": "~0.4.1",
"grunt-browserify": "https://github.com/nwinter/grunt-browserify/tarball/master",
"grunt-browserify": "~2.1.0",
"grunt-coffeelint": "~0.0.7",

@@ -42,0 +42,0 @@ "grunt-contrib-coffee": "~0.7.0",

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