jstransform
Advanced tools
Comparing version 4.0.1 to 5.0.0
{ | ||
"name": "jstransform", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "A simple AST visitor-based JS transformer", | ||
@@ -24,3 +24,3 @@ "contributors": [ | ||
"base62": "0.1.1", | ||
"esprima-fb": "~3001.1.0-dev-harmony-fb", | ||
"esprima-fb": "~4001.1.0-dev-harmony-fb", | ||
"source-map": "0.1.31" | ||
@@ -36,3 +36,13 @@ }, | ||
"node": ">=0.8.8" | ||
}, | ||
"devDependencies": { | ||
"jest-cli": "0.1.5" | ||
}, | ||
"jest": { | ||
"scriptPreprocessor": "<rootDir>/jestPreprocessor.js" | ||
}, | ||
"scripts": { | ||
"prepublish": "jest", | ||
"test": "jest" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# JSTransform | ||
# JSTransform [![Build Status](https://travis-ci.org/facebook/jstransform.svg?branch=master)](https://travis-ci.org/facebook/jstransform) | ||
@@ -3,0 +3,0 @@ A simple utility for pluggable JS syntax transforms using the esprima parser. |
@@ -21,3 +21,3 @@ /** | ||
require('mock-modules').autoMockOff(); | ||
jest.autoMockOff(); | ||
@@ -29,3 +29,2 @@ describe('es6-classes', function() { | ||
beforeEach(function() { | ||
require('mock-modules').dumpCache(); | ||
visitors = require('../es6-class-visitors').visitorList; | ||
@@ -355,3 +354,7 @@ transformFn = require('../../src/jstransform').transform; | ||
eval(code); | ||
var exports = new Function( | ||
code + 'return {Child: Child, Parent: Parent};' | ||
)(); | ||
var Child = exports.Child; | ||
var Parent = exports.Parent; | ||
@@ -377,3 +380,7 @@ expect(Child.protoProp).toBe(undefined); | ||
eval(code); | ||
var exports = new Function( | ||
code + 'return {Parent1: Parent1, Child: Child};' | ||
)(); | ||
var Child = exports.Child; | ||
var Parent1 = exports.Parent1; | ||
@@ -401,3 +408,3 @@ expect(Child.protoProp).toBe(undefined); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -415,3 +422,3 @@ var childInst = new Child('a', 'b'); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -439,3 +446,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -466,3 +473,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -498,3 +505,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -523,3 +530,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -546,3 +553,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -570,3 +577,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -595,3 +602,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -728,3 +735,3 @@ var childInst = new Child(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -793,3 +800,3 @@ var childInst = new Child('foo', 'bar'); | ||
eval(code); | ||
var Foo = new Function(code + 'return Foo;')(); | ||
@@ -812,3 +819,3 @@ var fooInst = new Foo(); | ||
eval(code); | ||
var Foo = new Function(code + 'return Foo;')(); | ||
@@ -846,3 +853,5 @@ var fooInst = new Foo(); | ||
eval(code); | ||
var exports = new Function(code + 'return {_bar: _bar, Foo: Foo};')(); | ||
var _bar = exports._bar; | ||
var Foo = exports.Foo; | ||
@@ -926,3 +935,3 @@ var fooInst = new Foo(); | ||
eval(code); | ||
var Child = new Function(code + 'return Child;')(); | ||
@@ -959,4 +968,7 @@ var childInst = new Child(); | ||
eval(code1); | ||
eval(code2); | ||
var exports = new Function( | ||
code1 + code2 + 'return {Parent: Parent, Child: Child};' | ||
)(); | ||
var Parent = exports.Parent; | ||
var Child = exports.Child; | ||
@@ -963,0 +975,0 @@ var childInst = new Child(); |
@@ -89,2 +89,3 @@ /** | ||
expectTransform('`${foo} ${bar}`', '(foo + " " + bar)'); | ||
expectTransform('`${foo}${bar}`', '(foo + bar)'); | ||
}); | ||
@@ -91,0 +92,0 @@ |
@@ -45,3 +45,12 @@ /** | ||
utils.catchupNewlines(templateElement.range[1], state); | ||
} else { // templateElement.value.raw === '' | ||
// Concatenat adjacent substitutions, e.g. `${x}${y}`. Empty templates | ||
// appear before the first and after the last element - nothing to add in | ||
// those cases. | ||
if (ii > 0 && !templateElement.tail) { | ||
// + between substitution and substitution | ||
utils.append(' + ', state); | ||
} | ||
} | ||
utils.move(templateElement.range[1], state); | ||
@@ -48,0 +57,0 @@ if (!templateElement.tail) { |
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
142649
23
3911
67
1
+ Addedesprima-fb@4001.1.0-dev-harmony-fb(transitive)
- Removedesprima-fb@3001.1.0-dev-harmony-fb(transitive)