New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aether

Package Overview
Dependencies
Maintainers
3
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.5.7 to 0.5.11

2

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

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

(function() {
var addedGlobals, emptyAST, isStatement, makeYieldFilter, updateState, upgradeEvaluator, _, _ref, _ref1, _ref2;
var addedGlobals, emptyAST, isStatement, makeYieldFilter, shouldFlow, updateState, upgradeEvaluator, _, _ref, _ref1, _ref2;

@@ -9,5 +9,9 @@ _ = (_ref = (_ref1 = (_ref2 = typeof window !== "undefined" && window !== null ? window._ : void 0) != null ? _ref2 : typeof self !== "undefined" && self !== null ? self._ : void 0) != null ? _ref1 : typeof global !== "undefined" && global !== null ? global._ : void 0) != null ? _ref : require('lodash');

isStatement = function(name) {
return name !== 'Literal' && name !== 'Identifier' && name !== 'ThisExpression' && name !== 'BlockStatement' && name !== 'MemberExpression' && name !== 'FunctionExpression' && name !== 'LogicalExpression' && name !== 'BinaryExpression' && name !== 'UnaryExpression';
return name !== 'Literal' && name !== 'Identifier' && name !== 'ThisExpression' && name !== 'BlockStatement' && name !== 'MemberExpression' && name !== 'FunctionExpression' && name !== 'LogicalExpression' && name !== 'BinaryExpression' && name !== 'UnaryExpression' && name !== 'Program';
};
shouldFlow = function(name) {
return name !== 'IfStatement' && name !== 'WhileStatement' && name !== 'DoWhileStatement' && name !== 'ForStatement' && name !== 'ForInStatement' && name !== 'ForOfStatement';
};
updateState = function(aether, evaluator) {

@@ -77,3 +81,3 @@ var astStack, bottom, f, frame_stack, n, p, rng, s, statementStack, top, variables, x, _base, _base1, _base2, _i, _j, _len, _ref3, _ref4;

}
if (bottom.flow != null) {
if ((bottom.flow != null) && shouldFlow(top.ast.type)) {
f = {};

@@ -103,8 +107,7 @@ if (aether._userInfo != null) {

}
if (astStack[0] != null) {
rng = astStack[0].originalRange;
if (rng) {
f.range = [rng.start, rng.end];
}
rng = top.ast.originalRange;
if (rng) {
f.range = [rng.start, rng.end];
}
f.type = top.ast.type;
if (!!f.range) {

@@ -134,2 +137,3 @@ return bottom.flow.statements.push(f);

fxName = aether.options.functionName || 'foo';
aether.language.setupInterpreter(engine);
if (aether.language.injectCode != null) {

@@ -182,14 +186,22 @@ engine.evalASTSync(aether.language.injectCode);

if (frame_stack[1].ast.type === 'WhileStatement' && frame_stack[1].ast.test.type === 'Literal') {
if (!top.marked) {
top.marked = true;
if (aether.whileLoopMarker) {
if (aether.whileLoopMarker != null) {
if (!top.marked) {
top.marked = true;
top.mark = aether.whileLoopMarker();
} else if (top.ast == null) {
currentMark = aether.whileLoopMarker();
if (currentMark === top.mark) {
top.mark = currentMark + 1;
return true;
} else {
top.mark = currentMark;
}
}
} else if (top.ast == null) {
currentMark = aether.whileLoopMarker();
if (!aether.whileLoopMarker || currentMark === top.mark) {
top.mark = currentMark + 1;
return true;
} else {
top.mark = currentMark;
} else {
if (!top.marked) {
top.marked = true;
} else if (top.ast == null) {
if (!top.didYield) {
return true;
}
}

@@ -207,2 +219,3 @@ }

engine = new esper.Engine(aether.esperEngine.options);
engine.realm = aether.esperEngine.realm;
Evaluator = aether.esperEngine.evaluator.constructor;

@@ -209,0 +222,0 @@ engine.evaluator = new Evaluator(aether.esperEngine.realm, aether.esperEngine.evaluator.ast, aether.esperEngine.evaluator.frames[0].scope);

@@ -273,2 +273,5 @@ (function() {

});
if ((ast != null) && ast.body.length !== 1) {
throw new SyntaxError('You seem to have code outside your function. Are your { and } braces matched?');
}
return ast;

@@ -275,0 +278,0 @@ };

@@ -118,2 +118,4 @@ (function() {

Language.prototype.setupInterpreter = function(esper) {};
return Language;

@@ -120,0 +122,0 @@

@@ -15,2 +15,4 @@ (function() {

module.exports = Python = (function(_super) {
var selfToThis;
__extends(Python, _super);

@@ -223,2 +225,3 @@

});
selfToThis(ast);
return ast;

@@ -234,2 +237,3 @@ };

});
selfToThis(ast);
} catch (_error) {

@@ -284,2 +288,45 @@ error = _error;

selfToThis = function(ast) {
ast.body[0].body.body.unshift({
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "self"
},
"init": {
"type": "ThisExpression"
}
}
],
"kind": "var",
"userCode": false
});
return ast;
};
Python.prototype.setupInterpreter = function(esper) {
var realm;
realm = esper.realm;
return realm.options.linkValueCallReturnValueWrapper = function(value) {
var ArrayPrototype, defineProperties, gen, it, listPropertyDescriptor;
ArrayPrototype = realm.ArrayPrototype;
if (value.jsTypeName !== 'object') {
return value;
}
if (value.clazz === 'Array') {
defineProperties = realm.Object.getImmediate('defineProperties');
listPropertyDescriptor = realm.globalScope.get('__pythonRuntime').getImmediate('utils').getImmediate('listPropertyDescriptor');
gen = defineProperties.call(realm.Object, [value, listPropertyDescriptor], realm.globalScope);
it = gen.next();
while (!it.done) {
it = gen.next();
}
}
return value;
};
};
return Python;

@@ -286,0 +333,0 @@

(function() {
var HintCreator, acceptMatchThreshold, extractRuntimeErrorDetails, extractTranspileErrorDetails, getRuntimeHint, getTranspileHint, ranges, scoreFuzziness, string_score,
var HintCreator, acceptMatchThreshold, extractRuntimeErrorDetails, extractTranspileErrorDetails, getRuntimeHint, getTranspileHint, ranges, scoreFuzziness, string_score, _, _ref, _ref1, _ref2,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -9,2 +9,4 @@

_ = (_ref = (_ref1 = (_ref2 = typeof window !== "undefined" && window !== null ? window._ : void 0) != null ? _ref2 : typeof self !== "undefined" && self !== null ? self._ : void 0) != null ? _ref1 : typeof global !== "undefined" && global !== null ? global._ : void 0) != null ? _ref : require('lodash');
scoreFuzziness = 0.8;

@@ -15,3 +17,3 @@

module.exports.createUserCodeProblem = function(options) {
var config, id, kind, p, reporter, _ref, _ref1, _ref2, _ref3;
var config, id, kind, p, reporter, _ref3, _ref4, _ref5, _ref6;
if (options == null) {

@@ -32,3 +34,3 @@ options = {};

id = reporter + '_' + kind;
config = ((_ref = options.aether) != null ? (_ref1 = _ref.options) != null ? (_ref2 = _ref1.problems) != null ? _ref2[id] : void 0 : void 0 : void 0) || {};
config = ((_ref3 = options.aether) != null ? (_ref4 = _ref3.options) != null ? (_ref5 = _ref4.problems) != null ? _ref5[id] : void 0 : void 0 : void 0) || {};
p = {

@@ -43,3 +45,3 @@ isUserCodeProblem: true

p.range = options.range;
p.userInfo = (_ref3 = options.userInfo) != null ? _ref3 : {};
p.userInfo = (_ref6 = options.userInfo) != null ? _ref6 : {};
return p;

@@ -49,3 +51,3 @@ };

extractTranspileErrorDetails = function(options) {
var code, codePrefix, col, columnOffset, doubleVar, end, endCol, error, errorContext, languageID, line, lineOffset, originalLines, range, rng, row, start, startCol, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8;
var code, codePrefix, col, columnOffset, doubleVar, end, endCol, error, errorContext, languageID, line, lineOffset, originalLines, range, rng, row, start, startCol, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
code = options.code || '';

@@ -55,2 +57,4 @@ codePrefix = options.codePrefix || '';

options.message = error.message;
errorContext = options.problemContext || ((_ref3 = options.aether) != null ? (_ref4 = _ref3.options) != null ? _ref4.problemContext : void 0 : void 0);
languageID = (_ref5 = options.aether) != null ? (_ref6 = _ref5.options) != null ? _ref6.language : void 0 : void 0;
originalLines = code.slice(codePrefix.length).split('\n');

@@ -78,7 +82,7 @@ lineOffset = codePrefix.split('\n').length - 1;

if (line >= 0) {
if ((_ref = error.evidence) != null ? _ref.length : void 0) {
if ((_ref7 = error.evidence) != null ? _ref7.length : void 0) {
startCol = originalLines[line].indexOf(error.evidence);
endCol = startCol + error.evidence.length;
} else {
_ref1 = [0, originalLines[line].length - 1], startCol = _ref1[0], endCol = _ref1[1];
_ref8 = [0, originalLines[line].length - 1], startCol = _ref8[0], endCol = _ref8[1];
}

@@ -128,5 +132,2 @@ options.range = [ranges.rowColToPos(line, startCol, code, codePrefix), ranges.rowColToPos(line, endCol, code, codePrefix)];

options.range = [start, end];
errorContext = options.problemContext || ((_ref2 = options.aether) != null ? (_ref3 = _ref2.options) != null ? _ref3.problemContext : void 0 : void 0);
languageID = (_ref4 = options.aether) != null ? (_ref5 = _ref4.options) != null ? _ref5.language : void 0 : void 0;
options.hint = error.hint || getTranspileHint(options.message, errorContext, languageID, options.aether.raw, options.range, (_ref6 = options.aether.options) != null ? _ref6.simpleLoops : void 0);
}

@@ -139,3 +140,2 @@ break;

options.range = [ranges.offsetToPos(error.range[0], code, codePrefix), ranges.offsetToPos(error.range[1], code, codePrefix)];
languageID = (_ref7 = options.aether) != null ? (_ref8 = _ref7.options) != null ? _ref8.language : void 0 : void 0;
options.hint = error.message;

@@ -146,2 +146,3 @@ break;

}
options.hint = error.hint || getTranspileHint(options.message, errorContext, languageID, options.aether.raw, options.range, (_ref9 = options.aether.options) != null ? _ref9.simpleLoops : void 0);
return options;

@@ -151,11 +152,12 @@ };

getTranspileHint = function(msg, context, languageID, code, range, simpleLoops) {
var c, codeSnippet, hintCreator, index, lineStart, lineStartLow, nonAlphNumMatch, parens, prevIndex, quoteCharacter, _i, _len, _ref;
var c, codeSnippet, firstQuoteIndex, hintCreator, index, lineStart, lineStartLow, nonAlphNumMatch, parens, prevIndex, quoteCharacter, _i, _len;
if (simpleLoops == null) {
simpleLoops = false;
}
if (msg === "Unterminated string constant" && (range != null)) {
if ((msg === "Unterminated string constant" || msg === "Unclosed string.") && (range != null)) {
codeSnippet = code.substring(range[0].ofs, range[1].ofs);
if (codeSnippet.length > 0 && ((_ref = codeSnippet[0]) === "'" || _ref === '"')) {
quoteCharacter = codeSnippet[0];
codeSnippet = codeSnippet.slice(1);
firstQuoteIndex = codeSnippet.search(/['"]/);
if (firstQuoteIndex !== -1) {
quoteCharacter = codeSnippet[firstQuoteIndex];
codeSnippet = codeSnippet.slice(firstQuoteIndex + 1);
if (nonAlphNumMatch = codeSnippet.match(/[^\w]/)) {

@@ -177,3 +179,3 @@ codeSnippet = codeSnippet.substring(0, nonAlphNumMatch.index);

return "Code needs to line up.";
} else if (msg.indexOf("Unexpected token") >= 0 && (context != null)) {
} else if (((msg.indexOf("Unexpected token") >= 0) || (msg.indexOf("Unexpected identifier") >= 0)) && (context != null)) {
codeSnippet = code.substring(range[0].ofs, range[1].ofs);

@@ -219,3 +221,3 @@ lineStart = code.substring(range[0].ofs - range[0].col, range[0].ofs);

}
if (/Unexpected token/.test(msg)) {
if (/Unexpected [token|identifier]/.test(msg)) {
return "Please double-check your code carefully.";

@@ -227,5 +229,5 @@ }

extractRuntimeErrorDetails = function(options) {
var error, lineNumber, _ref;
var error, lineNumber, _ref3;
if (options.range == null) {
options.range = (_ref = options.aether) != null ? _ref.lastStatementRange : void 0;
options.range = (_ref3 = options.aether) != null ? _ref3.lastStatementRange : void 0;
}

@@ -262,7 +264,7 @@ if (error = options.error) {

getRuntimeHint = function(options) {
var code, context, hint, hintCreator, index, languageID, simpleLoops, _ref, _ref1, _ref2;
var code, context, hint, hintCreator, index, languageID, simpleLoops, _ref3, _ref4, _ref5;
code = options.aether.raw || '';
context = options.problemContext || ((_ref = options.aether.options) != null ? _ref.problemContext : void 0);
languageID = (_ref1 = options.aether.options) != null ? _ref1.language : void 0;
simpleLoops = (_ref2 = options.aether.options) != null ? _ref2.simpleLoops : void 0;
context = options.problemContext || ((_ref3 = options.aether.options) != null ? _ref3.problemContext : void 0);
languageID = (_ref4 = options.aether.options) != null ? _ref4.language : void 0;
simpleLoops = (_ref5 = options.aether.options) != null ? _ref5.simpleLoops : void 0;
if (options.message === "RangeError: Maximum call stack size exceeded") {

@@ -314,2 +316,10 @@ return "Did you call a function recursively?";

})();
this.newVariableTemplate = (function() {
switch (languageID) {
case 'javascript':
return _.template('var <%= name %> = ');
default:
return _.template('<%= name %> = ');
}
})();
this.methodRegex = (function() {

@@ -344,3 +354,3 @@ switch (languageID) {

hint = target != null ? this.getNoFunctionHint(target) : void 0;
} else if (missingReference = msg.match(/ReferenceError: ([^\s]+) is not defined/)) {
} else if (missingReference = msg.match(/([^\s]+) is not defined/)) {
hint = this.getReferenceErrorHint(missingReference[1]);

@@ -403,3 +413,3 @@ } else if (missingProperty = msg.match(/Cannot (?:read|call) (?:property|method) '([\w]+)' of (?:undefined|null)/)) {

HintCreator.prototype.getReferenceErrorHint = function(target) {
var hint, method, thisPrefixed, _ref,
var hint, method, thisPrefixed, _ref3,
_this = this;

@@ -482,9 +492,14 @@ hint = this.getExactMatch(target, this.context.stringReferences, function(match) {

}
if ((hint == null) && (((_ref = this.context) != null ? _ref.thisMethods : void 0) != null)) {
if (!hint && target.toLowerCase().indexOf('enemy') > -1 && _.contains(this.context.thisMethods, 'findNearestEnemy')) {
hint = "There is no `" + target + "`. Use `" + (this.newVariableTemplate({
name: target
})) + this.thisValueAccess + "findNearestEnemy()` first.";
}
if ((hint == null) && (((_ref3 = this.context) != null ? _ref3.thisMethods : void 0) != null)) {
thisPrefixed = (function() {
var _i, _len, _ref1, _results;
_ref1 = this.context.thisMethods;
var _i, _len, _ref4, _results;
_ref4 = this.context.thisMethods;
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
method = _ref1[_i];
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
method = _ref4[_i];
_results.push(this.thisValueAccess + method);

@@ -535,16 +550,16 @@ }

HintCreator.prototype.getScoreMatch = function(target, candidatesList) {
var closestMatch, closestScore, match, matchScore, msg, set, _i, _j, _len, _len1, _ref, _ref1, _ref2;
var closestMatch, closestScore, match, matchScore, msg, set, _i, _j, _len, _len1, _ref3, _ref4, _ref5;
if (string_score == null) {
return;
}
_ref = ['', 0, ''], closestMatch = _ref[0], closestScore = _ref[1], msg = _ref[2];
_ref3 = ['', 0, ''], closestMatch = _ref3[0], closestScore = _ref3[1], msg = _ref3[2];
for (_i = 0, _len = candidatesList.length; _i < _len; _i++) {
set = candidatesList[_i];
if (set.candidates != null) {
_ref1 = set.candidates;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
match = _ref1[_j];
_ref4 = set.candidates;
for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
match = _ref4[_j];
matchScore = match.score(target, scoreFuzziness);
if (matchScore > closestScore) {
_ref2 = [match, matchScore, set.msgFormatFn(match)], closestMatch = _ref2[0], closestScore = _ref2[1], msg = _ref2[2];
_ref5 = [match, matchScore, set.msgFormatFn(match)], closestMatch = _ref5[0], closestScore = _ref5[1], msg = _ref5[2];
}

@@ -551,0 +566,0 @@ }

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

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

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