Begin transition of Babel to a more scalable architecture, async flow to allow for RPC and better build system for multiple packages

This commit is contained in:
Sebastian McKenzie
2015-07-11 12:39:54 +01:00
parent 4b3b6970b4
commit fedf894904
1952 changed files with 9425 additions and 5366 deletions

View File

@@ -20,9 +20,9 @@
"slash": "^1.0.0"
},
"bin": {
"babel": "./bin/babel/index.js",
"babel-node": "./bin/babel-node",
"babel-external-helpers": "./bin/babel-external-helpers",
"babel-plugin": "./bin/babel-plugin/index.js"
"babel": "./lib/babel/index.js",
"babel-node": "./lib/babel-node",
"babel-external-helpers": "./lib/babel-external-helpers",
"babel-plugin": "./lib/babel-plugin/index.js"
}
}

View File

@@ -10,4 +10,6 @@ commander.option("-t, --output-type [type]", "Type of output (global|umd|var)",
commander.usage("[options]");
commander.parse(process.argv);
console.log(runtime(commander.whitelist, commander.outputType));
util.ensureTemplates().then(function () {
console.log(runtime(commander.whitelist, commander.outputType));
});

View File

@@ -2,7 +2,7 @@
require("babel-core");
var moduleFormatters = require("babel-core/lib/babel/transformation/modules");
var moduleFormatters = require("babel-core/lib/transformation/modules");
var pathExists = require("path-exists");
var commander = require("commander");
var transform = require("babel-core").transform;

View File

@@ -35,7 +35,7 @@ exports.transform = function (filename, code, opts) {
opts.ignore = null;
opts.only = null;
var result = babel.transform(code, opts);
var result = babel.__plsDontUseThis(code, opts);
result.filename = filename;
result.actual = code;
return result;

View File

@@ -0,0 +1,3 @@
{
"breakConfig": true
}

View File

@@ -0,0 +1,3 @@
{
"args": ["--whitelist", "nonexistent"]
}

View File

@@ -0,0 +1,3 @@
(function (global) {
var babelHelpers = global.babelHelpers = {};
})(typeof global === "undefined" ? self : global);

View File

@@ -0,0 +1,3 @@
{
"args": ["--whitelist", "nonexistent", "--output-type", "umd"]
}

View File

@@ -0,0 +1,11 @@
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else if (typeof exports === "object") {
factory(exports);
} else {
factory(root.babelHelpers = {});
}
})(this, function (global) {
var babelHelpers = global;
})

View File

@@ -0,0 +1,3 @@
{
"args": ["--whitelist", "nenexistent", "--output-type", "var"]
}

View File

@@ -0,0 +1 @@
var babelHelpers = {};

View File

@@ -0,0 +1,3 @@
{
"args": ["--whitelist", "slice,has-own"]
}

View File

@@ -0,0 +1,5 @@
(function (global) {
var babelHelpers = global.babelHelpers = {};
babelHelpers.hasOwn = Object.prototype.hasOwnProperty;
babelHelpers.slice = Array.prototype.slice;
})(typeof global === "undefined" ? self : global);

View File

@@ -0,0 +1,4 @@
{
"args": ["--eval", "console.log([1, 2, 3].map(x => x * x));"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1 @@
console.log([1, 2, 3].map(x => x * x));

View File

@@ -0,0 +1,4 @@
{
"args": ["foo", "--extensions", ".bar"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1,4 @@
{
"args": ["--print", "--eval", "([1, 2, 3].map(x => x * x))"],
"stdout": "[ 1, 4, 9 ]"
}

View File

@@ -0,0 +1,2 @@
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,3 @@
{
"args": ["foo"]
}

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1,2 @@
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,3 @@
{
"args": ["bar"]
}

View File

@@ -0,0 +1 @@
foo

View File

@@ -0,0 +1,2 @@
var bar = () => console.log("bar");
bar();

View File

@@ -0,0 +1,5 @@
import "./bar2";
import "./not_node_modules";
var foo = () => console.log("foo");
foo();

View File

@@ -0,0 +1,10 @@
/*
The purpose of this file is to test that the node_modules check in the require
hook doesn't mistakenly exclude something like "not_node_modules". To pass, this
file merely needs to be transpiled. The transpiled code won't, and doesn't need
to, execute without error. It won't execute because React will be undefined.
*/
try {
<Some jsx="element" />;
}
catch (e) {}

View File

@@ -0,0 +1,3 @@
{
"args": ["foo2"]
}

View File

@@ -0,0 +1,2 @@
bar
foo

View File

@@ -0,0 +1,3 @@
{
"args": ["--blacklist", "es6.arrowFunctions"]
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
"use strict";
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1 @@
bar;

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib", "--ignore", "src/foo/*"]
}

View File

@@ -0,0 +1,3 @@
"use strict";
bar;

View File

@@ -0,0 +1 @@
src/bar/index.js -> lib/bar/index.js

View File

@@ -0,0 +1 @@
bar;

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib", "--only", "src/bar/*"]
}

View File

@@ -0,0 +1,3 @@
"use strict";
bar;

View File

@@ -0,0 +1 @@
src/bar/index.js -> lib/bar/index.js

View File

@@ -0,0 +1,3 @@
{
"args": ["--whitelist", "es6.arrowFunctions"]
}

View File

@@ -0,0 +1,2 @@
let MULTIPLER = 5;
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,4 @@
let MULTIPLER = 5;
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,3 @@
{
"args": ["--source-maps", "--out-file", "test.js"]
}

View File

@@ -0,0 +1,7 @@
"use strict";
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=test.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["stdin"],"names":[],"mappings":";;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,CAAC;CAAA,CAAC,CAAC","file":"test.js","sourcesContent":["arr.map(x => x * x);"]}

View File

@@ -0,0 +1 @@
arr.map(x => x * x);

View File

@@ -0,0 +1,3 @@
{
"args": ["--source-maps", "inline"]
}

View File

@@ -0,0 +1 @@
arr.map(x => x * x);

View File

@@ -0,0 +1,7 @@
"use strict";
arr.map(function (x) {
return x * x;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsQ0FBQztDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ==

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--source-maps", "inline", "--out-dir", "lib"]
}

View File

@@ -0,0 +1,8 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7SUFBTSxJQUFJLFlBQUosSUFBSTt3QkFBSixJQUFJIiwiZmlsZSI6ImJhci5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59Il19

View File

@@ -0,0 +1,6 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxHQUFHLENBQUMsR0FBRyxDQUFDLFVBQUEsQ0FBQztTQUFJLENBQUMsR0FBRyxVQUFVO0NBQUEsQ0FBQyxDQUFDIiwiZmlsZSI6ImZvby5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19

View File

@@ -0,0 +1,2 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--source-maps", "--out-dir", "lib"]
}

View File

@@ -0,0 +1,8 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};
//# sourceMappingURL=bar.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/bar/bar.js"],"names":[],"mappings":";;;;IAAM,IAAI,YAAJ,IAAI;wBAAJ,IAAI","file":"bar.js","sourcesContent":["class Test {\n\n}"]}

View File

@@ -0,0 +1,6 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=foo.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/foo.js"],"names":[],"mappings":";;AAAA,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,UAAU;CAAA,CAAC,CAAC","file":"foo.js","sourcesContent":["arr.map(x => x * MULTIPLIER);"]}

View File

@@ -0,0 +1,2 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["src", "--out-dir", "lib"]
}

View File

@@ -0,0 +1,7 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,2 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "--source-maps", "inline", "--out-file", "script2.js"]
}

View File

@@ -0,0 +1,7 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLEdBQUcsQ0FBQyxHQUFHLENBQUMsVUFBQSxDQUFDO1NBQUksQ0FBQyxHQUFHLFVBQVU7Q0FBQSxDQUFDLENBQUMiLCJmaWxlIjoic2NyaXB0Mi5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "--out-file", "script2.js"]
}

View File

@@ -0,0 +1,5 @@
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "script2.js", "--source-maps", "inline", "--out-file", "script3.js"]
}

View File

@@ -0,0 +1,14 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztJQUFNLElBQUksWUFBSixJQUFJO3dCQUFKLElBQUk7Ozs7O0FDQVYsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsVUFBVTtDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzY3JpcHQzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgVGVzdCB7XG5cbn0iLCJhcnIubWFwKHggPT4geCAqIE1VTFRJUExJRVIpOyJdfQ==

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "script2.js", "--source-maps", "--out-file", "script3.js"]
}

View File

@@ -0,0 +1,14 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});
//# sourceMappingURL=script3.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;;;IAAM,IAAI,YAAJ,IAAI;wBAAJ,IAAI;;;;;ACAV,GAAG,CAAC,GAAG,CAAC,UAAA,CAAC;SAAI,CAAC,GAAG,UAAU;CAAA,CAAC,CAAC","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]}

View File

@@ -0,0 +1,3 @@
class Test {
}

View File

@@ -0,0 +1 @@
arr.map(x => x * MULTIPLIER);

View File

@@ -0,0 +1,3 @@
{
"args": ["script.js", "script2.js", "--out-file", "script3.js"]
}

View File

@@ -0,0 +1,12 @@
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Test = function Test() {
_classCallCheck(this, Test);
};
"use strict";
arr.map(function (x) {
return x * MULTIPLIER;
});

View File

@@ -0,0 +1,4 @@
{
"args": ["--filename", "test.js"],
"stderrContains": true
}

View File

@@ -0,0 +1 @@
SyntaxError: test.js: Unexpected token (2:10)

View File

@@ -0,0 +1,3 @@
arr.map(function () {
return $]!;
});

Some files were not shown because too many files have changed in this diff Show More