Compare commits

...

37 Commits

Author SHA1 Message Date
Sebastian McKenzie
6145f0a03b v1.10.11 2014-11-07 13:17:41 +11:00
Sebastian McKenzie
54f901f131 require: add missing blacklistTests, implement opts.whitelist and opts.only - closes #125
Conflicts:
	lib/6to5/register.js
2014-11-07 13:16:26 +11:00
Sebastian McKenzie
5deeae1aa2 travis: ignore experimental branch 2014-11-03 18:26:50 +11:00
Sebastian McKenzie
c17878913b add classProps declaration to simplify/nicen up class property defining - closes #88 2014-11-03 13:36:23 +11:00
Sebastian McKenzie
c8139317ee add static property inherit warning for IE <= 9 to README - closes #116 2014-11-03 13:09:36 +11:00
Sebastian McKenzie
74f11dfddf add chai to devDependencies 2014-11-03 12:35:59 +11:00
Sebastian McKenzie
6332e725fe update bin tests to match updated use strict behaviour 2014-11-03 12:34:00 +11:00
Sebastian McKenzie
89ecd46b77 move _moduleFormatter transformer before useStrict transformer and remove duplicate use strict removing - fixes #114 2014-11-03 12:20:47 +11:00
Sebastian McKenzie
7e8c5cd20f Merge pull request #118 from amsul/patch-1
Added ability to register 6to5 with a blacklist
2014-11-02 10:39:13 +11:00
amsul
ddbb522392 Updated blacklist option to replace reference 2014-11-01 19:36:10 -04:00
amsul
288cfd1f00 Added ability to register 6to5 with a blacklist
Currently, to achieve this, I have to use this workaround:

```js
var to5 = require('6to5')
delete to5.transform.transformers.generators
require('6to5/register')
```

After this simple change, I can make it much nicer:

```js
require('6to5/register')({
    blacklist: ['generators']
})
```

Cheers!
2014-11-01 14:15:52 -04:00
Sebastian McKenzie
1841f5c8a0 v1.10.10 2014-11-01 16:08:11 +11:00
Sebastian McKenzie
33f8988313 support for numeric literals with recast - fixes #117 2014-11-01 16:06:46 +11:00
Sebastian McKenzie
af997b9945 Merge pull request #115 from djindjic/patch-1
Just a little info added
2014-11-01 08:39:33 +11:00
Aleksandar Djindjic
a2332f08bc Just a little info added
I needed this and it maybe help to someone else
2014-10-31 14:58:46 +01:00
Sebastian McKenzie
115dca56b6 v1.10.9 2014-10-31 21:39:17 +11:00
Sebastian McKenzie
251e4d01c8 join together declarations in destructuring to return a single node if possible - fixes #113 2014-10-31 21:38:22 +11:00
Sebastian McKenzie
530ad78428 fix & html entity in travis badge branch url - thanks @davidchambers 2014-10-31 11:51:49 +11:00
Sebastian McKenzie
51f72ace57 Merge pull request #112 from thejameskyle/travis-badge
Add ?branch=master to Travis CI badge
2014-10-31 11:47:50 +11:00
James Kyle
2fa36b30d5 Add ?branch=master to Travis CI badge 2014-10-30 17:46:08 -07:00
Sebastian McKenzie
6f8cbf0ad1 v1.10.8 2014-10-31 11:43:36 +11:00
Sebastian McKenzie
6696d5fcf4 fix rest parameters in arrow functions containing wrong arguments reference - fixes #11 2014-10-31 11:42:09 +11:00
Sebastian McKenzie
ecedc23892 v1.10.7 2014-10-29 20:59:35 +11:00
Sebastian McKenzie
163c68dd6a fix lint errors 2014-10-29 20:57:43 +11:00
Sebastian McKenzie
4dc6147348 update acorn-recast 2014-10-29 20:53:25 +11:00
Sebastian McKenzie
fa6e50ea28 Merge pull request #103 from eventualbuddha/remove-unused-vars
Remove unused vars & fix typo
2014-10-28 14:31:24 +11:00
Sebastian McKenzie
a72c839a73 add bin and benchmark directories to jshint test #103 2014-10-28 14:31:09 +11:00
Brian Donovan
32b5edb711 Remove unused requires. 2014-10-27 20:28:31 -07:00
Brian Donovan
8cbb121e3f Fix typo. 2014-10-27 20:28:08 -07:00
Sebastian McKenzie
75ece96475 v1.10.6 2014-10-28 13:18:47 +11:00
Sebastian McKenzie
b016fda8af add browser.js to .gitignore 2014-10-28 13:18:00 +11:00
Sebastian McKenzie
2cffad61fa more reliable destructuring building 2014-10-28 13:16:31 +11:00
Sebastian McKenzie
4e248c0a16 add member expression destructuring test 2014-10-28 13:16:21 +11:00
Sebastian McKenzie
4f5026101b fix cache-templates build script position - fixes #101 2014-10-28 13:16:08 +11:00
Sebastian McKenzie
4ce38eab37 v1.10.5 2014-10-28 10:59:28 +11:00
Sebastian McKenzie
0a7ce115ff remove browser.js in make publish 2014-10-28 10:58:29 +11:00
Sebastian McKenzie
21ed438fd8 alias functions in scope call wrapping - fixes #99 2014-10-28 10:58:20 +11:00
62 changed files with 327 additions and 164 deletions

1
.gitignore vendored
View File

@@ -4,5 +4,6 @@ test/tmp
*.log
*.cache
/templates.json
/browser.js
coverage
dist

View File

@@ -17,5 +17,12 @@
"loopfunc": true,
"white": true,
"maxparams": 5,
"maxdepth": 4
"maxdepth": 4,
"globals": {
"suite": true,
"set": true,
"before": true,
"bench": true
}
}

View File

@@ -3,6 +3,10 @@ node_js:
- "0.10"
- "0.11"
branches:
except:
- experimental
before_script: "npm install -g codeclimate-test-reporter"
script: "make test-travis"

View File

@@ -14,7 +14,7 @@ bench:
node node_modules/matcha/bin/_matcha
test:
$(JSHINT_CMD) lib
$(JSHINT_CMD) lib bin benchmark/index.js
$(MOCHA_CMD)
test-cov:
@@ -45,16 +45,16 @@ publish:
make test
node bin/cache-templates
test -f templates.json
make build
cp dist/6to5.js browser.js
node bin/cache-templates
test -f templates.json
read -p "Version: " version; \
npm version $$version --message "v%s"
npm publish
git push --follow-tags
rm -rf templates.json
rm -rf templates.json browser.js

View File

@@ -4,7 +4,7 @@
<p align="center">
<a href="https://travis-ci.org/sebmck/6to5">
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?style=flat&amp;label=travis">
<img alt="Travis Status" src="http://img.shields.io/travis/sebmck/6to5.svg?branch=master&amp;style=flat&amp;label=travis">
</a>
<a href="https://codeclimate.com/github/sebmck/6to5">
@@ -103,6 +103,10 @@ Compile the entire `src` directory and output it to the `lib` directory.
$ 6to5 src --out-dir lib
Compile the entire `src` directory and output it to the one concatenated file.
$ 6to5 src --out-file script-compiled.js
Pipe a file in via stdin and output it to `script-compiled.js`
$ 6to5 --out-file script-compiled.js < script.js
@@ -186,21 +190,26 @@ require("6to5/register");
```
**NOTE:** By default all requires to `node_modules` will be ignored. You can
override this by passing an ignore regex via:
override this by passing an ignore regex with`.
```javascript
require("6to5/register")(/regex/);
```
You can also customise the file extensions that the require hook will use via:
##### Options
```javascript
require("6to5/register")({
// optional ignore regex
ignoreRegex: /regex/,
// Optional ignore regex - if any filenames **do** match this regex then they
// aren't compiled
ignore: /regex/,
// this will remove the currently hooked extensions of .es6 and .js so you'll
// have to add them back if you want them to be used again
// Optional only regex - if any filenames **don't** match this regex then they
// aren't compiled
only: /my_es6_folder/,
// See options above for usage
whitelist: [],
blacklist: [],
// This will remove the currently hooked extensions of .es6 and .js so you'll
// have to add them back if you want them to be used again.
extensions: [".js", ".es6"]
});
```
@@ -279,6 +288,23 @@ If you're inheriting from a class then static properties are inherited from it
via [\_\_proto\_\_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto),
this is widely supported but you may run into problems with much older browsers.
**NOTE:** `__proto__` is not supported on IE <= 9 so static properties
**will not** be inherited. A possible workaround is to use `super();`:
```javascript
class Foo {
static foo() {
}
}
class Bar extends Foo {
static foo() {
super();
}
}
```
### Generators
The [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js)

View File

@@ -7,13 +7,10 @@ var es6now = require("es6now");
var esnext = require("esnext");
var to5 = require("../lib/6to5");
var uglify = require("uglify-js");
//var uglify = require("uglify-js");
var matcha = require("matcha");
var stream = require("stream");
var path = require("path");
var zlib = require("zlib");
var fs = require("fs");
var vm = require("vm");
var _ = require("lodash");
var readResolve = function (filename) {
@@ -51,7 +48,7 @@ var compilers = {
traceur: {
runtime: readResolve("traceur/bin/traceur-runtime.js"),
compile: function (code, filename) {
compile: function (code) {
return traceur.compile(code, {
modules: "commonjs",
experimental: true
@@ -61,20 +58,20 @@ var compilers = {
esnext: {
runtime: readResolve("esnext/node_modules/regenerator/runtime.js") || readResolve("regenerator/runtime.js"),
compile: function (code, filename) {
compile: function (code) {
return esnext.compile(code).code;
}
},
es6now: {
runtime: readResolve("es6now/runtime/ES6.js"),
compile: function (code, filename) {
compile: function (code) {
return es6now.translate(code);
}
},
"es6-transpiler": {
compile: function (code, filename) {
compile: function (code) {
var result = es6tr.run({ src: code });
if (result.errors.length) throw new Error(result.join("; "));
return result.src;
@@ -82,7 +79,7 @@ var compilers = {
},
jstransform: {
compile: function (code, filename) {
compile: function (code) {
return jsTrans.transform(jsTransVisitors, code).code;
}
}
@@ -90,7 +87,7 @@ var compilers = {
// versions
var uglifyTitle = "uglify v" + getVersion("uglify-js");
//var uglifyTitle = "uglify v" + getVersion("uglify-js");
_.each(compilers, function (compiler, name) {
compiler.title = name + " v" + (compiler.version || getVersion(name));
@@ -162,7 +159,7 @@ _.each(fs.readdirSync(__dirname + "/fixtures"), function (name) {
});
});
_.each(compilers, function (compiler, name) {
_.each(compilers, function (compiler) {
bench(compiler.title, function () {
compiler.compile(code, loc);
});

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env node
var commander = require("commander");
var Module = require("module");
var util = require("../lib/6to5/util");
var path = require("path");
var repl = require("repl");

View File

@@ -6,7 +6,7 @@ var util = require("./util");
var fs = require("fs");
var _ = require("lodash");
module.exports = function (commander, filenames, opts) {
module.exports = function (commander, filenames) {
var results = [];
var buildResult = function () {
@@ -48,7 +48,7 @@ module.exports = function (commander, filenames, opts) {
return {
map: map,
code: code
}
};
};
var output = function () {
@@ -100,8 +100,8 @@ module.exports = function (commander, filenames, opts) {
}
});
_.each(_filenames, function (filename, i) {
results.push(util.compile(filename, { _noStrict: i != 0 }));
_.each(_filenames, function (filename) {
results.push(util.compile(filename));
});
output();

View File

@@ -1,13 +1,8 @@
#!/usr/bin/env node
var commander = require("commander");
var sourceMap = require("source-map");
var transform = require("../../lib/6to5/transform");
var chokidar = require("chokidar");
var mkdirp = require("mkdirp");
var util2 = require("../../lib/6to5/util");
var util = require("./util");
var path = require("path");
var util = require("../../lib/6to5/util");
var fs = require("fs");
var _ = require("lodash");
@@ -17,8 +12,8 @@ commander.option("-f, --filename [filename]", "Filename to use when reading from
commander.option("-w, --watch", "Recompile files on changes");
commander.option("-m, --modules [modules]", "Module formatter type to use [common]", "common");
commander.option("-w, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", util2.list);
commander.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", util2.list);
commander.option("-w, --whitelist [whitelist]", "Whitelist of transformers to ONLY use", util.list);
commander.option("-b, --blacklist [blacklist]", "Blacklist of transformers to NOT use", util.list);
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");

View File

@@ -20,17 +20,56 @@ sourceMapSupport.install({
//
var blacklist = [];
var blacklistTest = function (transformer, code) {
try {
if (_.isFunction(code)) {
code();
} else {
new Function(code);
}
blacklist.push(transformer);
} catch (err) {
if (err.name !== "SyntaxError") throw err;
}
};
blacklistTest("arrayComprehension", "var foo = [for (foo of bar) foo * foo];");
blacklistTest("arrowFunctions", "var foo = x => x * x;");
blacklistTest("classes", "class Foo {}");
blacklistTest("computedPropertyNames", "var foo = { [foo]: bar };");
//blacklistTest("constants", "const foo = 0;");
blacklistTest("defaultParamaters", "var foo = function (bar = 0) {};");
blacklistTest("destructuring", "var { x, y } = { x: 0, y: 0 };");
blacklistTest("forOf", "for (var foo of bar) {}");
blacklistTest("generators", "function* foo() {}");
blacklistTest("letScoping", "let foo = 0;");
blacklistTest("modules", 'import foo from "from";');
blacklistTest("propertyMethodAssignment", "{ get foo() {} }");
blacklistTest("propertyNameShorthand", "var foo = { x, y };");
blacklistTest("restParameters", "function foo(...bar) {}");
blacklistTest("spread", "foo(...bar);");
blacklistTest("templateLiterals", "`foo`");
blacklistTest("unicodeRegex", function () { new RegExp("foo", "u"); });
//
var ignoreRegex = /node_modules/;
var onlyRegex;
var whitelist = [];
var exts = {};
var maps = {};
var old = require.extensions[".js"];
var loader = function (m, filename) {
if (ignoreRegex && ignoreRegex.test(filename)) {
if ((ignoreRegex && ignoreRegex.test(filename)) || (onlyRegex && !onlyRegex.test(filename))) {
return old.apply(this, arguments);
}
var result = to5.transformFileSync(filename, {
whitelist: whitelist,
blacklist: blacklist,
sourceMap: true
});
@@ -55,12 +94,16 @@ var hookExtensions = function (_exts) {
hookExtensions([".es6", ".js"]);
module.exports = function (opts) {
// normalise options
opts = opts || {};
if (_.isRegExp(opts)) opts = { ignoreRegex: opts };
if (_.isRegExp(opts)) opts = { ignore: opts };
opts.ignore = opts.ignore || opts.ignoreRegex;
if (opts.ignoreRegex != null) {
ignoreRegex = opts.ignoreRegex;
}
if (opts.only != null) onlyRegex = opts.only;
if (opts.ignore != null) ignoreRegex = opts.ignore;
if (opts.extensions) hookExtensions(opts.extensions);
if (opts.blacklist) blacklist = opts.blacklist;
if (opts.whitelist) whitelist = opts.whitelist;
};

View File

@@ -0,0 +1,4 @@
(function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
})

View File

@@ -95,6 +95,7 @@ transform.transformers = {
forOf: require("./transformers/for-of"),
unicodeRegex: require("./transformers/unicode-regex"),
generators: require("./transformers/generators"),
numericLiterals: require("./transformers/numeric-literals"),
react: require("./transformers/react"),
jsx: require("./transformers/jsx"),
@@ -102,9 +103,10 @@ transform.transformers = {
_aliasFunctions: require("./transformers/_alias-functions"),
_blockHoist: require("./transformers/_block-hoist"),
_declarations: require("./transformers/_declarations"),
_moduleFormatter: require("./transformers/_module-formatter"),
useStrict: require("./transformers/use-strict")
useStrict: require("./transformers/use-strict"),
_moduleFormatter: require("./transformers/_module-formatter")
};
transform.moduleFormatters = {

View File

@@ -15,7 +15,7 @@ var go = function (getBody, node, file) {
};
// traverse the function and find all alias functions so we can alias
// arguments and this if neccesary
// arguments and this if necessary
traverse(node, function (node) {
var _aliasFunction = node._aliasFunction;
if (!_aliasFunction) {
@@ -35,6 +35,8 @@ var go = function (getBody, node, file) {
}
}
if (node._ignoreAliasFunctions) return;
var getId;
if (node.type === "Identifier" && node.name === "arguments") {

View File

@@ -56,14 +56,14 @@ var buildClass = function (node, file) {
container.callee.params.push(superClassCallee);
}
buildClassBody(body, className, superName, node);
buildClassBody(file, body, className, superName, node);
body.push(returnStatement);
return container;
};
var buildClassBody = function (body, className, superName, node) {
var buildClassBody = function (file, body, className, superName, node) {
var instanceMutatorMap = {};
var staticMutatorMap = {};
var hasConstructor = false;
@@ -105,16 +105,28 @@ var buildClassBody = function (body, className, superName, node) {
}, true));
}
var instanceProps;
var staticProps;
if (!_.isEmpty(instanceMutatorMap)) {
var protoId = util.template("prototype-identifier", {
CLASS_NAME: className
});
body.push(util.buildDefineProperties(instanceMutatorMap, protoId));
instanceProps = util.buildDefineProperties(instanceMutatorMap, protoId);
}
if (!_.isEmpty(staticMutatorMap)) {
body.push(util.buildDefineProperties(staticMutatorMap, className));
staticProps = util.buildDefineProperties(staticMutatorMap, className);
}
if (instanceProps || staticProps) {
instanceProps = instanceProps || b.literal(null);
staticProps = staticProps || b.literal(null);
body.push(b.expressionStatement(
b.callExpression(file.addDeclaration("class-props"), [className, staticProps, instanceProps])
));
}
};

View File

@@ -13,11 +13,15 @@ var buildVariableAssign = function (kind, id, init) {
}
};
var push = function (kind, nodes, pattern, parentId) {
if (pattern.type === "ObjectPattern") {
pushObjectPattern(kind, nodes, pattern, parentId);
} else if (pattern.type === "ArrayPattern") {
pushArrayPattern(kind, nodes, pattern, parentId);
var push = function (kind, nodes, elem, parentId) {
if (elem.type === "ObjectPattern") {
pushObjectPattern(kind, nodes, elem, parentId);
} else if (elem.type === "ArrayPattern") {
pushArrayPattern(kind, nodes, elem, parentId);
} else if (elem.type === "MemberExpression") {
nodes.push(buildVariableAssign(false, elem, parentId));
} else {
nodes.push(buildVariableAssign(kind, elem, parentId));
}
};
@@ -39,14 +43,7 @@ var pushArrayPattern = function (kind, nodes, pattern, parentId) {
if (!elem) return;
var newPatternId = b.memberExpression(parentId, b.literal(i), true);
if (elem.type === "Identifier") {
nodes.push(buildVariableAssign(kind, elem, newPatternId));
} else if (elem.type === "MemberExpression") {
nodes.push(buildVariableAssign(false, elem, newPatternId));
} else {
push(kind, nodes, elem, newPatternId);
}
push(kind, nodes, elem, newPatternId);
});
};
@@ -151,5 +148,22 @@ exports.VariableDeclaration = function (node, parent, file) {
}
});
if (parent.type !== "Program" && parent.type !== "BlockStatement") {
var declar;
_.each(nodes, function (node) {
declar = declar || b.variableDeclaration(node.kind, []);
if (node.type !== "VariableDeclaration" && declar.kind !== node.kind) {
throw util.errorWithNode(node, "Cannot use this node within the current parent");
}
declar.declarations = declar.declarations.concat(node.declarations);
});
return declar;
}
return nodes;
};

View File

@@ -42,9 +42,11 @@ exports.VariableDeclaration = function (node, parent, file) {
if (node.type === "FunctionDeclaration") {
throw new Error("`FunctionDeclaration`s that use `let` and `constant` references aren't allowed outside of the root scope");
} else {
return b.callExpression(b.functionExpression(null, letReferences, b.blockStatement([
var func = b.functionExpression(null, letReferences, b.blockStatement([
b.returnStatement(node)
])), letReferences);
]));
func._aliasFunction = true;
return b.callExpression(func, letReferences);
}
} else {
return false;

View File

@@ -0,0 +1,6 @@
var _ = require("lodash");
exports.Literal = function (node) {
// TODO: remove this when the new code generator is released
if (_.isNumber(node.value)) delete node.raw;
};

View File

@@ -24,6 +24,9 @@ exports.ObjectExpression = function (node, parent, file) {
return util.template("object-define-properties-closure", {
KEY: objId,
OBJECT: node,
CONTENT: util.buildDefineProperties(mutatorMap, objId).expression
CONTENT: util.template("object-define-properties", {
OBJECT: objId,
PROPS: util.buildDefineProperties(mutatorMap)
})
});
};

View File

@@ -11,9 +11,14 @@ exports.Function = function (node, parent, file) {
if (node.params.length) templateName += "-arg";
util.ensureBlock(node);
node.body.body.unshift(util.template(templateName, {
var template = util.template(templateName, {
SLICE_KEY: file.addDeclaration("slice"),
VARIABLE_NAME: rest,
SLICE_ARG: b.literal(node.params.length)
}));
});
template.declarations[0].init.arguments[0]._ignoreAliasFunctions = true;
node.body.body.unshift(template);
};

View File

@@ -1,15 +1,12 @@
var b = require("acorn-ast-types").builders;
module.exports = function (ast, file) {
module.exports = function (ast) {
var body = ast.program.body;
var first = body[0];
var noStrict = !first || first.type !== "ExpressionStatement" || first.expression.type !== "Literal" || first.expression.value !== "use strict";
if (noStrict) {
if (file.opts._noStrict) return;
body.unshift(b.expressionStatement(b.literal("use strict")));
} else {
if (file.opts._noStrict) body.shift();
}
};

View File

@@ -147,7 +147,7 @@ exports.pushMutatorMap = function (mutatorMap, key, kind, method) {
}
};
exports.buildDefineProperties = function (mutatorMap, keyNode) {
exports.buildDefineProperties = function (mutatorMap) {
var objExpr = b.objectExpression([]);
_.each(mutatorMap, function (map, key) {
@@ -164,10 +164,7 @@ exports.buildDefineProperties = function (mutatorMap, keyNode) {
objExpr.properties.push(propNode);
});
return exports.template("object-define-properties", {
OBJECT: keyNode,
PROPS: objExpr
}, true);
return objExpr;
};
exports.template = function (name, nodes, keepExpression) {

View File

@@ -1,7 +1,7 @@
{
"name": "6to5",
"description": "Turn ES6 code into readable vanilla ES5 with source maps",
"version": "1.10.4",
"version": "1.10.11",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://github.com/sebmck/6to5",
"repository": {
@@ -48,7 +48,7 @@
"source-map-support": "0.2.7",
"esutils": "1.1.4",
"acorn-jsx": "https://github.com/sebmck/acorn-jsx/archive/master.tar.gz",
"acorn-recast": "0.8.0-3",
"acorn-recast": "0.8.0-4",
"acorn-ast-types": "0.5.3-1"
},
"devDependencies": {
@@ -59,6 +59,7 @@
"browserify": "6.1.0",
"proclaim": "2.0.0",
"rimraf": "2.2.8",
"jshint": "2.5.6"
"jshint": "2.5.6",
"chai": "^1.9.2"
}
}

View File

@@ -4,6 +4,7 @@ var rimraf = require("rimraf");
var mkdirp = require("mkdirp");
var child = require("child_process");
var path = require("path");
var chai = require("chai");
var fs = require("fs");
var _ = require("lodash");
@@ -42,7 +43,7 @@ var assertTest = function (stdout, stderr, opts) {
if (opts.stderrContains) {
assert.ok(_.contains(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr));
} else {
assert.equal(stderr, expectStderr, "stderr didn't match");
chai.expect(stderr).to.equal(expectStderr, "stderr didn't match");
}
} else if (stderr) {
throw new Error("stderr: " + JSON.stringify(stderr));
@@ -55,7 +56,7 @@ var assertTest = function (stdout, stderr, opts) {
if (opts.stdoutContains) {
assert.ok(_.contains(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout));
} else {
assert.equal(stdout, expectStdout, "stdout didn't match");
chai.expect(stdout).to.equal(expectStdout, "stdout didn't match");
}
} else if (stdout) {
throw new Error("stdout: " + JSON.stringify(stdout));
@@ -63,7 +64,7 @@ var assertTest = function (stdout, stderr, opts) {
_.each(opts.outFiles, function (expect, filename) {
var actual = readFile(filename);
assert.equal(actual, expect, "out-file " + filename);
chai.expect(actual).to.equal(expect, "out-file " + filename);
});
};

View File

@@ -4,8 +4,9 @@ var Test = function() {
var Test = function Test() {};
return Test;
}();
"use strict";
arr.map(function(x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFBTSxDQUFDLENBQUMsQ0FBQztNQUFILENBQUMsQ0FBQyxDQUFDLGFBQUgsQ0FBQyxDQUFDLENBQUM7U0FBSCxDQUFDLENBQUMsQ0FBQzs7O0FDQVQsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxVQUFDO1NBQUssRUFBRSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0NBQUMsQ0FBQyIsImZpbGUiOiJzY3JpcHQzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgVGVzdCB7XG5cbn0iLCJhcnIubWFwKHggPT4geCAqIE1VTFRJUExJRVIpOyJdfQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFBTSxDQUFDLENBQUMsQ0FBQztNQUFILENBQUMsQ0FBQyxDQUFDLGFBQUgsQ0FBQyxDQUFDLENBQUM7U0FBSCxDQUFDLENBQUMsQ0FBQzs7OztBQ0FULENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsVUFBQztTQUFLLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQztDQUFDLENBQUMiLCJmaWxlIjoic2NyaXB0My5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59IiwiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXX0=

View File

@@ -4,6 +4,7 @@ var Test = function() {
var Test = function Test() {};
return Test;
}();
"use strict";
arr.map(function(x) {
return x * MULTIPLIER;
});

View File

@@ -1 +1 @@
{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;IAAM,CAAC,CAAC,CAAC;MAAH,CAAC,CAAC,CAAC,aAAH,CAAC,CAAC,CAAC;SAAH,CAAC,CAAC,CAAC;;;ACAT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAC;SAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAC","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]}
{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;IAAM,CAAC,CAAC,CAAC;MAAH,CAAC,CAAC,CAAC,aAAH,CAAC,CAAC,CAAC;SAAH,CAAC,CAAC,CAAC;;;;ACAT,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAC;SAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,CAAC","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]}

View File

@@ -4,6 +4,7 @@ var Test = function() {
var Test = function Test() {};
return Test;
}();
"use strict";
arr.map(function(x) {
return x * MULTIPLIER;
});

View File

@@ -1,5 +1,12 @@
"use strict";
var _slice = Array.prototype.slice;
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
@@ -27,7 +34,17 @@ var Test = function(Foo) {
_extends(Test, Foo);
Object.defineProperties(Test.prototype, {
_classProps(Test, {
foo: {
writable: true,
value: function() {
Foo.foo.call(this);
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
}
}
}, {
test: {
writable: true,
@@ -39,17 +56,5 @@ var Test = function(Foo) {
}
});
Object.defineProperties(Test, {
foo: {
writable: true,
value: function() {
Foo.foo.call(this);
Foo.foo.call.apply(Foo.foo, [this].concat(_slice.call(arguments)));
Foo.foo.call.apply(Foo.foo, [this, "test"].concat(_slice.call(arguments)));
}
}
});
return Test;
}(Foo);

View File

@@ -1,5 +1,10 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var _extends = function (child, parent) {
child.prototype = Object.create(parent.prototype, {
constructor: {
@@ -13,7 +18,6 @@ var _extends = function (child, parent) {
child.__proto__ = parent;
};
var Test = function(Foo) {
var Test = function Test() {
Foo.prototype.test.whatever();
@@ -22,7 +26,7 @@ var Test = function(Foo) {
_extends(Test, Foo);
Object.defineProperties(Test, {
_classProps(Test, {
test: {
writable: true,
@@ -30,7 +34,7 @@ var Test = function(Foo) {
return Foo.wow.call(this);
}
}
});
}, null);
return Test;
}(Foo);

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = function() {
var Test = function Test() {};
Object.defineProperties(Test.prototype, {
_classProps(Test, null, {
test: {
get: function() {
return 5 + 5;
@@ -16,4 +21,4 @@ var Test = function() {
});
return Test;
}();
}();

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = function() {
var Test = function Test() {};
Object.defineProperties(Test.prototype, {
_classProps(Test, null, {
test: {
get: function() {
return 5 + 5;
@@ -12,4 +17,4 @@ var Test = function() {
});
return Test;
}();
}();

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = function() {
var Test = function Test() {};
Object.defineProperties(Test.prototype, {
_classProps(Test, null, {
test: {
writable: true,
@@ -14,4 +19,4 @@ var Test = function() {
});
return Test;
}();
}();

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = function() {
var Test = function Test() {};
Object.defineProperties(Test.prototype, {
_classProps(Test, null, {
test: {
set: function(val) {
this._test = val;
@@ -12,4 +17,4 @@ var Test = function() {
});
return Test;
}();
}();

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var A = function() {
var A = function A() {};
Object.defineProperties(A, {
_classProps(A, {
a: {
writable: true,
value: function() {}
@@ -13,7 +18,7 @@ var A = function() {
get: function() {},
set: function(b) {}
}
});
}, null);
return A;
}();
}();

View File

@@ -0,0 +1 @@
[this.foo, this.bar] = [1, 2];

View File

@@ -0,0 +1,4 @@
"use strict";
var _ref = [1, 2];
this.foo = _ref[0];
this.bar = _ref[1];

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports"], function (exports) {
"use strict";
exports.default = 42;
exports.default = {};
exports.default = [];

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports", "foo"], function (exports, _foo) {
"use strict";
(function(obj) {
for (var i in obj) {
exports[i] = obj[i];

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports"], function (exports) {
"use strict";
exports.foo = foo;
exports.foo = foo;
exports.bar = bar;

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports"], function (exports) {
"use strict";
exports.foo7 = foo7;
var foo = 1;
exports.foo = foo;

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports", "./evens"], function (exports, _evens) {
"use strict";
exports.nextOdd = nextOdd;
var isEven = _evens.isEven;

View File

@@ -1,6 +1,5 @@
"use strict";
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var foo = _foo.default;
var foo = _foo.default;
});

View File

@@ -1,5 +1,4 @@
"use strict";
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var foo = _foo;
});

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var foo = _foo.default;
var xyz = _foo.baz;
});

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports", "foo"], function (exports, _foo) {
"use strict";
var bar = _foo.bar;
var bar = _foo.bar;
var baz = _foo.baz;

View File

@@ -1,5 +1,3 @@
"use strict";
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
});

View File

@@ -1,6 +1,6 @@
"use strict";
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
var foo = _foo.default;
var foo = _foo;
var bar = _foo.bar;

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
@@ -7,6 +5,8 @@
factory(exports);
}
})(function (exports) {
"use strict";
exports.default = 42;
exports.default = {};
exports.default = [];

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo"], factory);
@@ -7,6 +5,8 @@
factory(exports, require("foo"));
}
})(function (exports, _foo) {
"use strict";
(function(obj) {
for (var i in obj) {
exports[i] = obj[i];

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
@@ -7,6 +5,8 @@
factory(exports);
}
})(function (exports) {
"use strict";
exports.foo = foo;
exports.foo = foo;
exports.bar = bar;

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
@@ -7,6 +5,8 @@
factory(exports);
}
})(function (exports) {
"use strict";
exports.foo7 = foo7;
var foo = 1;
exports.foo = foo;

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "./evens"], factory);
@@ -7,6 +5,8 @@
factory(exports, require("./evens"));
}
})(function (exports, _evens) {
"use strict";
exports.nextOdd = nextOdd;
var isEven = _evens.isEven;

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo"], factory);
@@ -7,6 +5,8 @@
factory(exports, require("foo"));
}
})(function (exports, _foo) {
"use strict";
var foo = _foo.default;
var foo = _foo.default;
});

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo"], factory);
@@ -7,5 +5,6 @@
factory(exports, require("foo"));
}
})(function (exports, _foo) {
"use strict";
var foo = _foo;
});

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo"], factory);
@@ -7,6 +5,7 @@
factory(exports, require("foo"));
}
})(function (exports, _foo) {
"use strict";
var foo = _foo.default;
var xyz = _foo.baz;
});

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo"], factory);
@@ -7,6 +5,7 @@
factory(exports, require("foo"));
}
})(function (exports, _foo) {
"use strict";
var bar = _foo.bar;
var bar = _foo.bar;
var baz = _foo.baz;

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
@@ -7,5 +5,5 @@
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
}
})(function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
});

View File

@@ -1,5 +1,3 @@
"use strict";
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "foo", "foo-bar", "./directory/foo-bar"], factory);
@@ -7,6 +5,7 @@
factory(exports, require("foo"), require("foo-bar"), require("./directory/foo-bar"));
}
})(function (exports, _foo, _fooBar, _directoryFooBar) {
"use strict";
var foo = _foo.default;
var foo = _foo;
var bar = _foo.bar;

View File

@@ -0,0 +1,3 @@
var concat = (...arrs) => {
};

View File

@@ -0,0 +1,5 @@
"use strict";
var _slice = Array.prototype.slice;
var concat = function () {
var arrs = _slice.call(arguments);
};

View File

@@ -1,9 +1,14 @@
"use strict";
var _classProps = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
var Test = function() {
var Test = function Test() {};
Object.defineProperties(Test.prototype, {
_classProps(Test, null, {
bar: {
get: function() {
throw new Error("wow");
@@ -15,4 +20,4 @@ var Test = function() {
}();
var test = new Test();
test.bar;
test.bar;

View File

@@ -4,7 +4,7 @@
"column": 11
},
"generated": {
"line": 9,
"line": 17,
"column": 15
}
}]