I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
This commit is contained in:
Sebastian McKenzie
2015-10-29 17:51:24 +00:00
parent 3974dd762d
commit ae7d5367f1
1501 changed files with 16477 additions and 19786 deletions

View File

@@ -1,7 +1,8 @@
var outputFile = require("output-file-sync");
var transform = require("../../babel-core/lib/transformation");
var template = require("babel-template");
var helpers = require("babel-helpers");
var babel = require("../../babel-core");
var each = require("lodash/collection/each");
var File = require("../../babel-core/lib/transformation/file");
var util = require("../../babel-core/lib/util");
var fs = require("fs");
var t = require("../../babel-types");
@@ -31,30 +32,38 @@ function writeRootFile(filename, content) {
outputFile(filename, content);
}
var buildHelperHead = template("exports.default = HELPER; exports.__esModule = true;");
function writeFile(filename, content) {
return writeRootFile(filename, content);
}
var transformOpts = {
presets: [
require("../../babel-preset-es2015")
],
plugins: [
require("../../babel-plugin-transform-runtime"),
require("../../babel-plugin-transform-es2015-modules-commonjs")
]
};
function selfContainify(code) {
return transform(code, {
optional: ["runtime"]
}).code;
return babel.transform(code, transformOpts).code;
}
function buildHelper(helperName) {
var tree = t.program(
util.template("self-contained-helpers-head", {
HELPER: util.template("helper-" + helperName)
buildHelperHead({
HELPER: helpers.get(helperName)
})
);
return transform.fromAst(tree, null, {
optional: ["runtime"]
}).code;
return babel.transformFromAst(tree, null, transformOpts).code;
}
each(File.helpers, function (helperName) {
each(helpers.list, function (helperName) {
writeFile("helpers/" + helperName + ".js", buildHelper(helperName));
});