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:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"breakConfig": true
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
(function(exports) {
|
||||
var tests = [];
|
||||
|
||||
exports.test = function(code, ast, options) {
|
||||
tests.push({code: code, ast: ast, options: options});
|
||||
};
|
||||
exports.testFail = function(code, message, options) {
|
||||
tests.push({code: code, error: message, options: options});
|
||||
};
|
||||
exports.testAssert = function(code, assert, options) {
|
||||
tests.push({code: code, assert: assert, options: options});
|
||||
};
|
||||
|
||||
exports.runTests = function(config, callback) {
|
||||
var parse = config.parse;
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
var test = tests[i];
|
||||
if (config.filter && !config.filter(test)) continue;
|
||||
var testOpts = test.options || {locations: true};
|
||||
var expected = {};
|
||||
if (expected.onComment = testOpts.onComment)
|
||||
testOpts.onComment = []
|
||||
if (expected.onToken = testOpts.onToken)
|
||||
testOpts.onToken = [];
|
||||
|
||||
try {
|
||||
var ast = parse(test.code, testOpts);
|
||||
} catch(e) {
|
||||
if (!(e instanceof SyntaxError)) { console.log(e.stack); throw e; }
|
||||
if (test.error) {
|
||||
if (e.message == test.error) callback("ok", test.code);
|
||||
else callback("fail", test.code,
|
||||
"Expected error message: " + test.error + "\nGot error message: " + e.message);
|
||||
} else {
|
||||
callback("error", test.code, e.stack || e.toString());
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (test.error) {
|
||||
if (config.loose) callback("ok", test.code);
|
||||
else callback("fail", test.code, "Expected error message: " + test.error + "\nBut parsing succeeded.");
|
||||
} else if (test.assert) {
|
||||
var error = test.assert(ast);
|
||||
if (error) callback("fail", test.code, "\n Assertion failed:\n " + error);
|
||||
else callback("ok", test.code);
|
||||
} else {
|
||||
var mis = misMatch(test.ast, ast);
|
||||
for (var name in expected) {
|
||||
if (mis) break;
|
||||
if (expected[name]) {
|
||||
mis = misMatch(expected[name], testOpts[name]);
|
||||
testOpts[name] = expected[name];
|
||||
}
|
||||
}
|
||||
if (mis) callback("fail", test.code, mis);
|
||||
else callback("ok", test.code);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function ppJSON(v) { return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); }
|
||||
function addPath(str, pt) {
|
||||
if (str.charAt(str.length-1) == ")")
|
||||
return str.slice(0, str.length-1) + "/" + pt + ")";
|
||||
return str + " (" + pt + ")";
|
||||
}
|
||||
|
||||
var misMatch = exports.misMatch = function(exp, act) {
|
||||
if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) {
|
||||
if (exp !== act && typeof exp != "function")
|
||||
return ppJSON(exp) + " !== " + ppJSON(act);
|
||||
} else if (exp instanceof RegExp || act instanceof RegExp) {
|
||||
var left = ppJSON(exp), right = ppJSON(act);
|
||||
if (left !== right) return left + " !== " + right;
|
||||
} else if (exp.splice) {
|
||||
if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act);
|
||||
if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length;
|
||||
for (var i = 0; i < act.length; ++i) {
|
||||
var mis = misMatch(exp[i], act[i]);
|
||||
if (mis) return addPath(mis, i);
|
||||
}
|
||||
} else {
|
||||
for (var prop in exp) {
|
||||
var mis = misMatch(exp[prop], act[prop]);
|
||||
if (mis) return addPath(mis, prop);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function mangle(ast) {
|
||||
if (typeof ast != "object" || !ast) return;
|
||||
if (ast.slice) {
|
||||
for (var i = 0; i < ast.length; ++i) mangle(ast[i]);
|
||||
} else {
|
||||
var loc = ast.start && ast.end && {start: ast.start, end: ast.end};
|
||||
if (loc) { delete ast.start; delete ast.end; }
|
||||
for (var name in ast) if (ast.hasOwnProperty(name)) mangle(ast[name]);
|
||||
if (loc) ast.loc = loc;
|
||||
}
|
||||
}
|
||||
|
||||
exports.printTests = function() {
|
||||
var out = "";
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
if (tests[i].error) continue;
|
||||
mangle(tests[i].ast);
|
||||
out += "test(" + JSON.stringify(tests[i].code) + ", " + JSON.stringify(tests[i].ast, null, 2) + ");\n\n";
|
||||
}
|
||||
document.body.innerHTML = "";
|
||||
document.body.appendChild(document.createElement("pre")).appendChild(document.createTextNode(out));
|
||||
};
|
||||
})(typeof exports == "undefined" ? window : exports);
|
||||
@@ -1,103 +0,0 @@
|
||||
(function() {
|
||||
var driver, acorn;
|
||||
|
||||
if (typeof require !== "undefined") {
|
||||
driver = require("./driver.js");
|
||||
require("./tests.js");
|
||||
require("./tests-harmony.js");
|
||||
require("./tests-flow.js");
|
||||
require("./tests-babel.js");
|
||||
require("babel/register")
|
||||
acorn = require("../../lib/acorn")
|
||||
} else {
|
||||
driver = window;
|
||||
acorn = window.acorn;
|
||||
}
|
||||
|
||||
var htmlLog = typeof document === "object" && document.getElementById('log');
|
||||
var htmlGroup = htmlLog;
|
||||
|
||||
function group(name) {
|
||||
if (htmlGroup) {
|
||||
var parentGroup = htmlGroup;
|
||||
htmlGroup = document.createElement("ul");
|
||||
var item = document.createElement("li");
|
||||
item.textContent = name;
|
||||
item.appendChild(htmlGroup);
|
||||
parentGroup.appendChild(item);
|
||||
}
|
||||
if (typeof console === "object" && console.group) {
|
||||
console.group(name);
|
||||
}
|
||||
}
|
||||
|
||||
function groupEnd() {
|
||||
if (htmlGroup) {
|
||||
htmlGroup = htmlGroup.parentElement.parentElement;
|
||||
}
|
||||
if (typeof console === "object" && console.groupEnd) {
|
||||
console.groupEnd(name);
|
||||
}
|
||||
}
|
||||
|
||||
function log(title, message) {
|
||||
if (htmlGroup) {
|
||||
var elem = document.createElement("li");
|
||||
elem.innerHTML = "<b>" + title + "</b> " + message;
|
||||
htmlGroup.appendChild(elem);
|
||||
}
|
||||
if (typeof console === "object") console.log(title, message);
|
||||
}
|
||||
|
||||
var stats, modes = {
|
||||
Normal: {
|
||||
config: {
|
||||
parse: acorn.parse
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function report(state, code, message) {
|
||||
if (state != "ok") {++stats.failed; log(code, message);}
|
||||
++stats.testsRun;
|
||||
}
|
||||
|
||||
group("Errors");
|
||||
|
||||
for (var name in modes) {
|
||||
group(name);
|
||||
var mode = modes[name];
|
||||
stats = mode.stats = {testsRun: 0, failed: 0};
|
||||
var t0 = +new Date;
|
||||
driver.runTests(mode.config, report);
|
||||
mode.stats.duration = +new Date - t0;
|
||||
groupEnd();
|
||||
}
|
||||
|
||||
groupEnd();
|
||||
|
||||
function outputStats(name, stats) {
|
||||
log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " +
|
||||
(stats.failed ? stats.failed + " failures." : "all passed."));
|
||||
}
|
||||
|
||||
var total = {testsRun: 0, failed: 0, duration: 0};
|
||||
|
||||
group("Stats");
|
||||
|
||||
for (var name in modes) {
|
||||
var stats = modes[name].stats;
|
||||
outputStats(name + " parser", stats);
|
||||
for (var key in stats) total[key] += stats[key];
|
||||
}
|
||||
|
||||
outputStats("Total", total);
|
||||
|
||||
groupEnd();
|
||||
|
||||
if (total.failed && typeof process === "object") {
|
||||
process.stdout.write("", function() {
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
})();
|
||||
File diff suppressed because it is too large
Load Diff
11245
test/acorn/tests-flow.js
11245
test/acorn/tests-flow.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
28999
test/acorn/tests.js
28999
test/acorn/tests.js
File diff suppressed because it is too large
Load Diff
@@ -6,10 +6,9 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../node_modules/lodash/lodash.js"></script>
|
||||
<script src="../node_modules/mocha/mocha.js"></script>
|
||||
<script>mocha.setup("tdd");</script>
|
||||
<script src="../dist/babel-test.js"></script>
|
||||
<script src="../dist/browser-test.js"></script>
|
||||
<script>
|
||||
mocha.globals(["regeneratorRuntime"]);
|
||||
mocha.checkLeaks();
|
||||
|
||||
4
test/browser.js
Normal file
4
test/browser.js
Normal file
@@ -0,0 +1,4 @@
|
||||
if (process.browser) {
|
||||
require("../packages/babel/test/_browser");
|
||||
require("../packages/babylon/test/_browser");
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
if (process.browser) {
|
||||
require("../../lib/babel/api/browser");
|
||||
require("./generation");
|
||||
require("./transformation");
|
||||
require("./traverse");
|
||||
require("./util");
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
var pathExists = require("path-exists");
|
||||
var esvalid = require("esvalid");
|
||||
var util = require("../../lib/babel/util");
|
||||
var path = require("path");
|
||||
var fs = require("fs");
|
||||
var _ = require("lodash");
|
||||
|
||||
var humanize = function (val, noext) {
|
||||
if (noext) val = path.basename(val, path.extname(val));
|
||||
return val.replace(/-/g, " ");
|
||||
};
|
||||
|
||||
var readFile = exports.readFile = function (filename) {
|
||||
if (pathExists.sync(filename)) {
|
||||
var file = fs.readFileSync(filename, "utf8").trim();
|
||||
file = file.replace(/\r\n/g, "\n");
|
||||
return file;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
exports.esvalid = function (ast, code, loc) {
|
||||
var errors = esvalid.errors(ast);
|
||||
if (errors.length) {
|
||||
var msg = [];
|
||||
_.each(errors, function (err) {
|
||||
msg.push(err.message + " - " + util.inspect(err.node));
|
||||
});
|
||||
throw new Error(loc + ": " + msg.join(". ") + "\n" + code);
|
||||
}
|
||||
};
|
||||
|
||||
exports.assertVendor = function (name) {
|
||||
if (!pathExists.sync(__dirname + "/../../vendor/" + name)) {
|
||||
console.error("No vendor/" + name + " - run `make bootstrap`");
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
exports.get = function (entryName, entryLoc) {
|
||||
if (exports.cache[entryName]) return exports.cache[entryName];
|
||||
|
||||
var suites = [];
|
||||
var entryLoc = entryLoc || __dirname + "/fixtures/" + entryName;
|
||||
|
||||
_.each(fs.readdirSync(entryLoc), function (suiteName) {
|
||||
if (suiteName[0] === ".") return;
|
||||
|
||||
var suite = {
|
||||
options: {},
|
||||
tests: [],
|
||||
title: humanize(suiteName),
|
||||
filename: entryLoc + "/" + suiteName
|
||||
};
|
||||
suites.push(suite);
|
||||
|
||||
var suiteOptsLoc = util.resolve(suite.filename + "/options");
|
||||
if (suiteOptsLoc) suite.options = require(suiteOptsLoc);
|
||||
|
||||
if (fs.statSync(suite.filename).isFile()) {
|
||||
push(suiteName, suite.filename);
|
||||
} else {
|
||||
_.each(fs.readdirSync(suite.filename), function (taskName) {
|
||||
var taskDir = suite.filename + "/" + taskName;
|
||||
push(taskName, taskDir);
|
||||
});
|
||||
}
|
||||
|
||||
function push(taskName, taskDir) {
|
||||
// tracuer error tests
|
||||
if (taskName.indexOf("Error_") >= 0) return;
|
||||
|
||||
var actualLocAlias = suiteName + "/" + taskName + "/actual.js";
|
||||
var expectLocAlias = suiteName + "/" + taskName + "/expected.js";
|
||||
var execLocAlias = suiteName + "/" + taskName + "/exec.js";
|
||||
|
||||
var actualLoc = taskDir + "/actual.js";
|
||||
var expectLoc = taskDir + "/expected.js";
|
||||
var execLoc = taskDir + "/exec.js";
|
||||
|
||||
if (fs.statSync(taskDir).isFile()) {
|
||||
var ext = path.extname(taskDir);
|
||||
if (ext !== ".js" && ext !== ".module.js") return;
|
||||
|
||||
execLoc = taskDir;
|
||||
}
|
||||
|
||||
var taskOpts = _.merge({
|
||||
filenameRelative: expectLocAlias,
|
||||
sourceFileName: actualLocAlias,
|
||||
sourceMapName: expectLocAlias
|
||||
}, _.cloneDeep(suite.options));
|
||||
|
||||
var taskOptsLoc = util.resolve(taskDir + "/options");
|
||||
if (taskOptsLoc) _.merge(taskOpts, require(taskOptsLoc));
|
||||
|
||||
var test = {
|
||||
title: humanize(taskName, true),
|
||||
disabled: taskName[0] === ".",
|
||||
options: taskOpts,
|
||||
exec: {
|
||||
loc: execLoc,
|
||||
code: readFile(execLoc),
|
||||
filename: execLocAlias,
|
||||
},
|
||||
actual: {
|
||||
loc: actualLoc,
|
||||
code: readFile(actualLoc),
|
||||
filename: actualLocAlias,
|
||||
},
|
||||
expect: {
|
||||
loc: expectLoc,
|
||||
code: readFile(expectLoc),
|
||||
filename: expectLocAlias
|
||||
}
|
||||
};
|
||||
|
||||
// traceur checks
|
||||
|
||||
var shouldSkip = function (code) {
|
||||
return code.indexOf("// Error:") >= 0 || code.indexOf("// Skip.") >= 0;
|
||||
};
|
||||
|
||||
if (shouldSkip(test.actual.code) || shouldSkip(test.exec.code)) {
|
||||
return;
|
||||
} else if (test.exec.code.indexOf("// Async.") >= 0) {
|
||||
//test.options.asyncExec = true;
|
||||
}
|
||||
|
||||
suite.tests.push(test);
|
||||
|
||||
var sourceMappingsLoc = taskDir + "/source-mappings.json";
|
||||
if (pathExists.sync(sourceMappingsLoc)) {
|
||||
test.options.sourceMap = true;
|
||||
test.sourceMappings = require(sourceMappingsLoc);
|
||||
}
|
||||
|
||||
var sourceMap = taskDir + "/source-map.json";
|
||||
if (pathExists.sync(sourceMap)) {
|
||||
test.options.sourceMap = true;
|
||||
test.sourceMap = require(sourceMap);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return exports.cache[entryName] = suites;
|
||||
};
|
||||
|
||||
try {
|
||||
exports.cache = require("../../tests.json");
|
||||
} catch (err) {
|
||||
if (err.code !== "MODULE_NOT_FOUND") throw err;
|
||||
|
||||
var cache = exports.cache = {};
|
||||
cache.transformation = exports.get("transformation");
|
||||
cache.generation = exports.get("generation");
|
||||
cache.esnext = exports.get("esnext");
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
var transform = require("../../lib/babel/transformation");
|
||||
var buildExernalHelpers = require("../../lib/babel/tools/build-external-helpers");
|
||||
var sourceMap = require("source-map");
|
||||
var codeFrame = require("../../lib/babel/helpers/code-frame");
|
||||
var Module = require("module");
|
||||
var helper = require("./_helper");
|
||||
var assert = require("assert");
|
||||
var chai = require("chai");
|
||||
var path = require("path");
|
||||
var util = require("../../lib/babel/util");
|
||||
var _ = require("lodash");
|
||||
|
||||
require("../../lib/babel/polyfill");
|
||||
|
||||
eval(buildExernalHelpers());
|
||||
|
||||
global.assertNoOwnProperties = function (obj) {
|
||||
assert.equal(Object.getOwnPropertyNames(obj).length, 0);
|
||||
};
|
||||
|
||||
global.assertHasOwnProperty = function () {
|
||||
|
||||
};
|
||||
|
||||
global.assertLacksOwnProperty = function () {
|
||||
|
||||
};
|
||||
|
||||
global.assertArrayEquals = assert.deepEqual;
|
||||
global.assert = chai.assert;
|
||||
global.chai = chai;
|
||||
|
||||
// Different Traceur generator message
|
||||
chai.assert._throw = chai.assert.throw;
|
||||
chai.assert.throw = function (fn, msg) {
|
||||
if (msg === '"throw" on executing generator' ||
|
||||
msg === '"next" on executing generator') {
|
||||
msg = "Generator is already running";
|
||||
} else if (msg === "Sent value to newborn generator") {
|
||||
msg = /^attempt to send (.*?) to newborn generator$/;
|
||||
} else if (msg === "super prototype must be an Object or null") {
|
||||
msg = "Object prototype may only be an Object or null";
|
||||
}
|
||||
|
||||
return chai.assert._throw(fn, msg);
|
||||
};
|
||||
|
||||
var run = function (task, done) {
|
||||
var actual = task.actual;
|
||||
var expect = task.expect;
|
||||
var exec = task.exec;
|
||||
var opts = task.options;
|
||||
|
||||
var getOpts = function (self) {
|
||||
return _.merge({
|
||||
suppressDeprecationMessages: true,
|
||||
filename: self.loc
|
||||
}, opts);
|
||||
};
|
||||
|
||||
var execCode = exec.code;
|
||||
var result;
|
||||
|
||||
var noCheckAst = opts.noCheckAst;
|
||||
delete opts.noCheckAst;
|
||||
|
||||
var checkAst = function (result, opts) {
|
||||
if (noCheckAst) return;
|
||||
helper.esvalid(result.ast.program, result.code, opts.loc);
|
||||
};
|
||||
|
||||
if (execCode) {
|
||||
result = transform(execCode, getOpts(exec));
|
||||
execCode = result.code;
|
||||
|
||||
try {
|
||||
var fakeRequire = function (loc) {
|
||||
if (loc === "../../../src/runtime/polyfills/Number.js") {
|
||||
return Number;
|
||||
} else if (loc === "../../../src/runtime/polyfills/Math.js") {
|
||||
return Math;
|
||||
} else {
|
||||
return require(path.resolve(exec.loc, "..", loc));
|
||||
}
|
||||
};
|
||||
|
||||
var fn = new Function("require", "done", "exports", execCode);
|
||||
fn.call(global, fakeRequire, chai.assert, {}, done);
|
||||
} catch (err) {
|
||||
err.message = exec.loc + ": " + err.message;
|
||||
err.message += codeFrame(execCode);
|
||||
throw err;
|
||||
}
|
||||
|
||||
checkAst(result, exec);
|
||||
}
|
||||
|
||||
var actualCode = actual.code;
|
||||
var expectCode = expect.code;
|
||||
if (!execCode || actualCode) {
|
||||
result = transform(actualCode, getOpts(actual));
|
||||
actualCode = result.code.trim();
|
||||
|
||||
try {
|
||||
chai.expect(actualCode).to.be.equal(expectCode, actual.loc + " !== " + expect.loc);
|
||||
} catch (err) {
|
||||
//require("fs").writeFileSync(expect.loc, actualCode);
|
||||
throw err;
|
||||
}
|
||||
|
||||
checkAst(result, actual);
|
||||
}
|
||||
|
||||
if (task.sourceMap) {
|
||||
chai.expect(result.map).to.deep.equal(task.sourceMap);
|
||||
}
|
||||
|
||||
if (task.sourceMappings) {
|
||||
var consumer = new sourceMap.SourceMapConsumer(result.map);
|
||||
|
||||
_.each(task.sourceMappings, function (mapping, i) {
|
||||
var actual = mapping.original;
|
||||
|
||||
var expect = consumer.originalPositionFor(mapping.generated);
|
||||
chai.expect({ line: expect.line, column: expect.column }).to.deep.equal(actual);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function (suiteOpts, taskOpts, dynamicOpts) {
|
||||
taskOpts = taskOpts || {};
|
||||
|
||||
_.each(helper.get(suiteOpts.name, suiteOpts.loc), function (testSuite) {
|
||||
if (_.contains(suiteOpts.ignoreSuites, testSuite.title)) return;
|
||||
|
||||
suite(suiteOpts.name + "/" + testSuite.title, function () {
|
||||
setup(function () {
|
||||
require("../../register")(taskOpts);
|
||||
});
|
||||
|
||||
_.each(testSuite.tests, function (task) {
|
||||
if (_.contains(suiteOpts.ignoreTasks, task.title) || _.contains(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) return;
|
||||
|
||||
var runTest = function (done) {
|
||||
var runTask = function () {
|
||||
run(task, done);
|
||||
};
|
||||
|
||||
_.extend(task.options, taskOpts);
|
||||
if (dynamicOpts) dynamicOpts(task.options, task);
|
||||
|
||||
var throwMsg = task.options.throws;
|
||||
if (throwMsg) {
|
||||
// internal api doesn't have this option but it's best not to pollute
|
||||
// the options object with useless options
|
||||
delete task.options.throws;
|
||||
|
||||
assert.throws(runTask, function (err) {
|
||||
return throwMsg === true || err.message.indexOf(throwMsg) >= 0;
|
||||
});
|
||||
} else {
|
||||
runTask();
|
||||
}
|
||||
};
|
||||
|
||||
var callback;
|
||||
if (task.options.asyncExec) {
|
||||
callback = runTest;
|
||||
} else {
|
||||
callback = function () {
|
||||
return runTest();
|
||||
};
|
||||
}
|
||||
|
||||
test(task.title, !task.disabled && callback);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
413
test/core/api.js
413
test/core/api.js
@@ -1,413 +0,0 @@
|
||||
require("../../lib/babel/api/node");
|
||||
|
||||
var buildExternalHelpers = require("../../lib/babel/tools/build-external-helpers");
|
||||
var PluginManager = require("../../lib/babel/transformation/file/plugin-manager");
|
||||
var Transformer = require("../../lib/babel/transformation/transformer");
|
||||
var transform = require("../../lib/babel/transformation");
|
||||
var assert = require("assert");
|
||||
var File = require("../../lib/babel/transformation/file");
|
||||
|
||||
suite("api", function () {
|
||||
test("code option false", function () {
|
||||
var result = transform("foo('bar');", { code: false });
|
||||
assert.ok(!result.code);
|
||||
});
|
||||
|
||||
test("ast option false", function () {
|
||||
var result = transform("foo('bar');", { ast: false });
|
||||
assert.ok(!result.ast);
|
||||
});
|
||||
|
||||
test("auxiliaryCommentBefore option", function () {
|
||||
assert.ok(transform("class Foo {}", {
|
||||
auxiliaryCommentBefore: "foobar"
|
||||
}).code.indexOf("foobar") >= 0);
|
||||
|
||||
assert.ok(transform("for (let i in bar) { foo(function () { i; }); break; continue; }", {
|
||||
auxiliaryCommentBefore: "foobar"
|
||||
}).code.indexOf("foobar") >= 0);
|
||||
});
|
||||
|
||||
test("auxiliaryCommentAfter option", function () {
|
||||
assert.ok(transform("class Foo {}", {
|
||||
auxiliaryCommentAfter: "foobar"
|
||||
}).code.indexOf("foobar") >= 0);
|
||||
|
||||
assert.ok(transform("for (let i in bar) { foo(function () { i; }); break; continue; }", {
|
||||
auxiliaryCommentAfter: "foobar"
|
||||
}).code.indexOf("foobar") >= 0);
|
||||
});
|
||||
|
||||
test("modules metadata", function () {
|
||||
assert.deepEqual(transform('import { externalName as localName } from "external";').metadata.modules.imports[0], {
|
||||
source: "external",
|
||||
imported: ["externalName"],
|
||||
specifiers: [{
|
||||
kind: "named",
|
||||
imported: "externalName",
|
||||
local: "localName"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('import * as localName2 from "external";').metadata.modules.imports[0], {
|
||||
source: "external",
|
||||
imported: ["*"],
|
||||
specifiers: [{
|
||||
kind: "namespace",
|
||||
local: "localName2"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('import localName3 from "external";').metadata.modules.imports[0], {
|
||||
source: "external",
|
||||
imported: ["default"],
|
||||
specifiers: [{
|
||||
kind: "named",
|
||||
imported: "default",
|
||||
local: "localName3"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('import localName from "./array";', {
|
||||
resolveModuleSource: function() {
|
||||
return "override-source";
|
||||
}
|
||||
}).metadata.modules.imports, [
|
||||
{
|
||||
source: "override-source",
|
||||
imported: ["default"],
|
||||
specifiers: [
|
||||
{
|
||||
"kind": "named",
|
||||
"imported": "default",
|
||||
"local": "localName"
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
assert.deepEqual(transform('export * as externalName1 from "external";', {
|
||||
stage: 0
|
||||
}).metadata.modules.exports, {
|
||||
exported: ['externalName1'],
|
||||
specifiers: [{
|
||||
kind: "external-namespace",
|
||||
exported: "externalName1",
|
||||
source: "external",
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('export externalName2 from "external";', {
|
||||
stage: 0
|
||||
}).metadata.modules.exports, {
|
||||
exported: ["externalName2"],
|
||||
specifiers: [{
|
||||
kind: "external",
|
||||
local: "externalName2",
|
||||
exported: "externalName2",
|
||||
source: "external"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('export function namedFunction() {}').metadata.modules.exports, {
|
||||
exported: ["namedFunction"],
|
||||
specifiers: [{
|
||||
kind: "local",
|
||||
local: "namedFunction",
|
||||
exported: "namedFunction"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('export var foo = "bar";').metadata.modules.exports, {
|
||||
"exported": ["foo"],
|
||||
specifiers: [{
|
||||
kind: "local",
|
||||
local: "foo",
|
||||
exported: "foo"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform("export { localName as externalName3 };").metadata.modules.exports, {
|
||||
exported: ["externalName3"],
|
||||
specifiers: [{
|
||||
kind: "local",
|
||||
local: "localName",
|
||||
exported: "externalName3"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('export { externalName4 } from "external";').metadata.modules.exports, {
|
||||
exported: ["externalName4"],
|
||||
specifiers: [{
|
||||
kind: "external",
|
||||
local: "externalName4",
|
||||
exported: "externalName4",
|
||||
source: "external"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform('export * from "external";').metadata.modules.exports, {
|
||||
exported: [],
|
||||
specifiers: [{
|
||||
kind: "external-all",
|
||||
source: "external"
|
||||
}]
|
||||
});
|
||||
|
||||
assert.deepEqual(transform("export default function defaultFunction() {}").metadata.modules.exports, {
|
||||
exported: ["defaultFunction"],
|
||||
specifiers: [{
|
||||
kind: "local",
|
||||
local: "defaultFunction",
|
||||
exported: "default"
|
||||
}]
|
||||
});
|
||||
});
|
||||
|
||||
test("ignore option", function () {
|
||||
assert.ok(transform("", {
|
||||
ignore: "node_modules",
|
||||
filename: "/foo/node_modules/bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(transform("", {
|
||||
ignore: "foo/node_modules",
|
||||
filename: "/foo/node_modules/bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(transform("", {
|
||||
ignore: "foo/node_modules/*.bar",
|
||||
filename: "/foo/node_modules/foo.bar"
|
||||
}).ignored);
|
||||
});
|
||||
|
||||
test("only option", function () {
|
||||
assert.ok(!transform("", {
|
||||
only: "node_modules",
|
||||
filename: "/foo/node_modules/bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(!transform("", {
|
||||
only: "foo/node_modules",
|
||||
filename: "/foo/node_modules/bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(!transform("", {
|
||||
only: "foo/node_modules/*.bar",
|
||||
filename: "/foo/node_modules/foo.bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(transform("", {
|
||||
only: "node_modules",
|
||||
filename: "/foo/node_module/bar"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(transform("", {
|
||||
only: "foo/node_modules",
|
||||
filename: "/bar/node_modules/foo"
|
||||
}).ignored);
|
||||
|
||||
assert.ok(transform("", {
|
||||
only: "foo/node_modules/*.bar",
|
||||
filename: "/foo/node_modules/bar.foo"
|
||||
}).ignored);
|
||||
});
|
||||
|
||||
suite("getModuleId option", function () {
|
||||
// As of this commit, `getModuleId` is the only option that isn't JSON
|
||||
// compatible which is why it's not inside /test/core/fixtures/transformation
|
||||
|
||||
function getModuleNameTest(moduleFormat, expected) {
|
||||
var result = transform("foo('bar');", {
|
||||
filename: "/foo/bar/index",
|
||||
modules: moduleFormat,
|
||||
moduleIds: true,
|
||||
getModuleId: function (name) {
|
||||
return name.replace(/\/index$/, "");
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(result.code, expected);
|
||||
}
|
||||
|
||||
test("amd", function () {
|
||||
var expected = [
|
||||
"define('/foo/bar', ['exports'], function (exports) {",
|
||||
" 'use strict';",
|
||||
"",
|
||||
" foo('bar');",
|
||||
"});"
|
||||
].join("\n");
|
||||
|
||||
getModuleNameTest("amd", expected);
|
||||
});
|
||||
|
||||
test("umd", function () {
|
||||
var expected = [
|
||||
"(function (global, factory) {",
|
||||
" if (typeof define === 'function' && define.amd) {",
|
||||
" define('/foo/bar', ['exports'], factory);",
|
||||
" } else if (typeof exports !== 'undefined') {",
|
||||
" factory(exports);",
|
||||
" } else {",
|
||||
" var mod = {",
|
||||
" exports: {}",
|
||||
" };",
|
||||
" factory(mod.exports);",
|
||||
" global.fooBar = mod.exports;",
|
||||
" }",
|
||||
"})(this, function (exports) {",
|
||||
" 'use strict';",
|
||||
"",
|
||||
" foo('bar');",
|
||||
"});",
|
||||
].join("\n");
|
||||
|
||||
getModuleNameTest("umd", expected);
|
||||
});
|
||||
|
||||
test("system", function () {
|
||||
var expected = [
|
||||
"System.register('/foo/bar', [], function (_export) {",
|
||||
" 'use strict';",
|
||||
"",
|
||||
" return {",
|
||||
" setters: [],",
|
||||
" execute: function () {",
|
||||
" foo('bar');",
|
||||
" }",
|
||||
" };",
|
||||
"});",
|
||||
].join("\n");
|
||||
|
||||
getModuleNameTest("system", expected);
|
||||
});
|
||||
});
|
||||
|
||||
suite("env option", function () {
|
||||
var oldBabelEnv = process.env.BABEL_ENV;
|
||||
var oldNodeEnv = process.env.NODE_ENV;
|
||||
|
||||
before(function () {
|
||||
delete process.env.BABEL_ENV;
|
||||
delete process.env.NODE_ENV;
|
||||
});
|
||||
|
||||
after(function () {
|
||||
process.env.BABEL_ENV = oldBabelEnv;
|
||||
process.env.NODE_ENV = oldNodeEnv;
|
||||
});
|
||||
|
||||
test("default", function () {
|
||||
assert.equal(transform("foo;", {
|
||||
env: {
|
||||
development: { blacklist: "strict" }
|
||||
}
|
||||
}).code, "foo;");
|
||||
});
|
||||
|
||||
test("BABEL_ENV", function () {
|
||||
process.env.BABEL_ENV = "foo";
|
||||
assert.equal(transform("foo;", {
|
||||
env: {
|
||||
foo: { blacklist: "strict" }
|
||||
}
|
||||
}).code, "foo;");
|
||||
});
|
||||
|
||||
test("NODE_ENV", function () {
|
||||
process.env.NODE_ENV = "foo";
|
||||
assert.equal(transform("foo;", {
|
||||
env: {
|
||||
foo: { blacklist: "strict" }
|
||||
}
|
||||
}).code, "foo;");
|
||||
});
|
||||
});
|
||||
|
||||
test("addHelper unknown", function () {
|
||||
var file = new File({}, transform.pipeline);
|
||||
assert.throws(function () {
|
||||
file.addHelper("foob");
|
||||
}, /Unknown helper foob/);
|
||||
});
|
||||
|
||||
test("resolveModuleSource option", function () {
|
||||
var actual = 'import foo from "foo-import-default";\nimport "foo-import-bare";\nexport { foo } from "foo-export-named";';
|
||||
var expected = 'import foo from "resolved/foo-import-default";\nimport "resolved/foo-import-bare";\nexport { foo } from "resolved/foo-export-named";';
|
||||
|
||||
actual = transform(actual, {
|
||||
blacklist: ["es6.modules", "strict"],
|
||||
resolveModuleSource: function (originalSource) {
|
||||
return "resolved/" + originalSource;
|
||||
}
|
||||
}).code.trim();
|
||||
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
|
||||
test("extra options", function () {
|
||||
var file1 = new File({ extra: { foo: "bar" } }, transform.pipeline);
|
||||
assert.equal(file1.opts.extra.foo, "bar");
|
||||
|
||||
var file2 = new File({}, transform.pipeline);
|
||||
var file3 = new File({}, transform.pipeline);
|
||||
assert.ok(file2.opts.extra !== file3.opts.extra);
|
||||
});
|
||||
|
||||
suite("buildExternalHelpers", function () {
|
||||
test("all", function () {
|
||||
var script = buildExternalHelpers();
|
||||
assert.ok(script.indexOf("classCallCheck") >= -1);
|
||||
assert.ok(script.indexOf("inherits") >= 0);
|
||||
});
|
||||
|
||||
test("whitelist", function () {
|
||||
var script = buildExternalHelpers(["inherits"]);
|
||||
assert.ok(script.indexOf("classCallCheck") === -1);
|
||||
assert.ok(script.indexOf("inherits") >= 0);
|
||||
});
|
||||
|
||||
test("empty whitelist", function () {
|
||||
var script = buildExternalHelpers([]);
|
||||
assert.ok(script.indexOf("classCallCheck") === -1);
|
||||
assert.ok(script.indexOf("inherits") === -1);
|
||||
});
|
||||
});
|
||||
|
||||
suite("plugins", function () {
|
||||
test("unknown plugin", function () {
|
||||
assert.throws(function () {
|
||||
new PluginManager().subnormaliseString("foo bar");
|
||||
}, /Unknown plugin/);
|
||||
});
|
||||
|
||||
test("key collision", function () {
|
||||
assert.throws(function () {
|
||||
new PluginManager({
|
||||
transformers: { "es6.arrowFunctions": true }
|
||||
}).validate("foobar", { key: "es6.arrowFunctions" });
|
||||
}, /collides with another/);
|
||||
});
|
||||
|
||||
test("not transformer", function () {
|
||||
assert.throws(function () {
|
||||
new PluginManager().validate("foobar", {});
|
||||
}, /didn't export a Plugin instance/);
|
||||
|
||||
assert.throws(function () {
|
||||
new PluginManager().validate("foobar", "");
|
||||
}, /didn't export a Plugin instance/);
|
||||
|
||||
assert.throws(function () {
|
||||
new PluginManager().validate("foobar", []);
|
||||
}, /didn't export a Plugin instance/);
|
||||
});
|
||||
|
||||
test("object request");
|
||||
|
||||
test("string request");
|
||||
|
||||
test("transformer request");
|
||||
});
|
||||
});
|
||||
153
test/core/bin.js
153
test/core/bin.js
@@ -1,153 +0,0 @@
|
||||
if (process.env.running_under_istanbul) return;
|
||||
|
||||
var readdir = require("fs-readdir-recursive");
|
||||
var helper = require("./_helper");
|
||||
var assert = require("assert");
|
||||
var rimraf = require("rimraf");
|
||||
var outputFileSync = require("output-file-sync");
|
||||
var child = require("child_process");
|
||||
var path = require("path");
|
||||
var chai = require("chai");
|
||||
var fs = require("fs");
|
||||
var pathExists = require("path-exists");
|
||||
var _ = require("lodash");
|
||||
|
||||
var fixtureLoc = __dirname + "/fixtures/bin";
|
||||
var tmpLoc = __dirname + "/tmp";
|
||||
|
||||
var readDir = function (loc) {
|
||||
var files = {};
|
||||
if (pathExists.sync(loc)) {
|
||||
_.each(readdir(loc), function (filename) {
|
||||
var contents = helper.readFile(loc + "/" + filename);
|
||||
files[filename] = contents;
|
||||
});
|
||||
}
|
||||
return files;
|
||||
};
|
||||
|
||||
var saveInFiles = function (files) {
|
||||
_.each(files, function (content, filename) {
|
||||
outputFileSync(filename, content);
|
||||
});
|
||||
};
|
||||
|
||||
var assertTest = function (stdout, stderr, opts) {
|
||||
var expectStderr = opts.stderr.trim();
|
||||
stderr = stderr.trim();
|
||||
|
||||
if (opts.stderr) {
|
||||
if (opts.stderrContains) {
|
||||
assert.ok(_.contains(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr));
|
||||
} else {
|
||||
chai.expect(stderr).to.equal(expectStderr, "stderr didn't match");
|
||||
}
|
||||
} else if (stderr) {
|
||||
throw new Error("stderr: " + JSON.stringify(stderr));
|
||||
}
|
||||
|
||||
var expectStdout = opts.stdout.trim();
|
||||
stdout = stdout.trim();
|
||||
stdout = stdout.replace(/\\/g, "/");
|
||||
|
||||
if (opts.stdout) {
|
||||
if (opts.stdoutContains) {
|
||||
assert.ok(_.contains(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout));
|
||||
} else {
|
||||
chai.expect(stdout).to.equal(expectStdout, "stdout didn't match");
|
||||
}
|
||||
} else if (stdout) {
|
||||
throw new Error("stdout: " + JSON.stringify(stdout));
|
||||
}
|
||||
|
||||
_.each(opts.outFiles, function (expect, filename) {
|
||||
var actual = helper.readFile(filename);
|
||||
chai.expect(actual).to.equal(expect, "out-file " + filename);
|
||||
});
|
||||
};
|
||||
|
||||
var buildTest = function (binName, testName, opts) {
|
||||
var binLoc = path.normalize(__dirname + "/../../packages/babel-cli/bin/" + binName);
|
||||
|
||||
return function (callback) {
|
||||
this.timeout(5000);
|
||||
clear();
|
||||
saveInFiles(opts.inFiles);
|
||||
|
||||
var args = [binLoc].concat(opts.args);
|
||||
var spawn = child.spawn(process.execPath, args);
|
||||
|
||||
var stderr = "";
|
||||
var stdout = "";
|
||||
|
||||
spawn.stderr.on("data", function (chunk) {
|
||||
stderr += chunk;
|
||||
});
|
||||
|
||||
spawn.stdout.on("data", function (chunk) {
|
||||
stdout += chunk;
|
||||
});
|
||||
|
||||
spawn.on("close", function () {
|
||||
var err;
|
||||
|
||||
try {
|
||||
assertTest(stdout, stderr, opts);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
err.message = args.join(" ") + ": " + err.message;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
});
|
||||
|
||||
if (opts.stdin) {
|
||||
spawn.stdin.write(opts.stdin);
|
||||
spawn.stdin.end();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var clear = function () {
|
||||
process.chdir(__dirname);
|
||||
if (pathExists.sync(tmpLoc)) rimraf.sync(tmpLoc);
|
||||
fs.mkdirSync(tmpLoc);
|
||||
process.chdir(tmpLoc);
|
||||
};
|
||||
|
||||
_.each(fs.readdirSync(fixtureLoc), function (binName) {
|
||||
if (binName[0] === ".") return;
|
||||
|
||||
var suiteLoc = fixtureLoc + "/" + binName;
|
||||
suite("bin/" + binName, function () {
|
||||
_.each(fs.readdirSync(fixtureLoc + "/" + binName), function (testName) {
|
||||
if (testName[0] === ".") return;
|
||||
|
||||
var testLoc = suiteLoc + "/" + testName;
|
||||
|
||||
var opts = {
|
||||
args: []
|
||||
};
|
||||
|
||||
var optionsLoc = testLoc + "/options.json"
|
||||
if (pathExists.sync(optionsLoc)) _.merge(opts, require(optionsLoc));
|
||||
|
||||
_.each(["stdout", "stdin", "stderr"], function (key) {
|
||||
var loc = testLoc + "/" + key + ".txt";
|
||||
if (pathExists.sync(loc)) {
|
||||
opts[key] = helper.readFile(loc);
|
||||
} else {
|
||||
opts[key] = opts[key] || "";
|
||||
}
|
||||
});
|
||||
|
||||
opts.outFiles = readDir(testLoc + "/out-files");
|
||||
opts.inFiles = readDir(testLoc + "/in-files");
|
||||
|
||||
test(testName, buildTest(binName, testName, opts));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
var browserify = require("browserify");
|
||||
var assert = require("assert");
|
||||
var path = require("path");
|
||||
var vm = require("vm");
|
||||
|
||||
suite("browserify", function() {
|
||||
test("babel/register may be used without breaking browserify", function(done) {
|
||||
var bundler = browserify(path.join(__dirname, "fixtures/browserify/register.js"));
|
||||
|
||||
bundler.bundle(function(err, bundle) {
|
||||
if (err) return done(err);
|
||||
assert.ok(bundle.length, "bundle output code");
|
||||
|
||||
// ensure that the code runs without throwing an exception
|
||||
vm.runInNewContext("var global = this;\n" + bundle, {});
|
||||
done();
|
||||
})
|
||||
})
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
require("./_transformation-helper")({
|
||||
name: "esnext"
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--whitelist", "nonexistent"]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
(function (global) {
|
||||
var babelHelpers = global.babelHelpers = {};
|
||||
})(typeof global === "undefined" ? self : global);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--whitelist", "nonexistent", "--output-type", "umd"]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
(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;
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--whitelist", "nenexistent", "--output-type", "var"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
var babelHelpers = {};
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--whitelist", "slice,has-own"]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
(function (global) {
|
||||
var babelHelpers = global.babelHelpers = {};
|
||||
babelHelpers.hasOwn = Object.prototype.hasOwnProperty;
|
||||
babelHelpers.slice = Array.prototype.slice;
|
||||
})(typeof global === "undefined" ? self : global);
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"args": ["--eval", "console.log([1, 2, 3].map(x => x * x));"],
|
||||
"stdout": "[ 1, 4, 9 ]"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
console.log([1, 2, 3].map(x => x * x));
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"args": ["foo", "--extensions", ".bar"],
|
||||
"stdout": "[ 1, 4, 9 ]"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"args": ["--print", "--eval", "([1, 2, 3].map(x => x * x))"],
|
||||
"stdout": "[ 1, 4, 9 ]"
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
var foo = () => console.log("foo");
|
||||
foo();
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["foo"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
foo
|
||||
@@ -1,2 +0,0 @@
|
||||
var foo = () => console.log("foo");
|
||||
foo();
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["bar"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
foo
|
||||
@@ -1,2 +0,0 @@
|
||||
var bar = () => console.log("bar");
|
||||
bar();
|
||||
@@ -1,5 +0,0 @@
|
||||
import "./bar2";
|
||||
import "./not_node_modules";
|
||||
|
||||
var foo = () => console.log("foo");
|
||||
foo();
|
||||
@@ -1,10 +0,0 @@
|
||||
/*
|
||||
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) {}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["foo2"]
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
bar
|
||||
foo
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--blacklist", "es6.arrowFunctions"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1 +0,0 @@
|
||||
bar;
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/foo/*"]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
bar;
|
||||
@@ -1 +0,0 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
@@ -1 +0,0 @@
|
||||
bar;
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--only", "src/bar/*"]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
bar;
|
||||
@@ -1 +0,0 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--whitelist", "es6.arrowFunctions"]
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
let MULTIPLER = 5;
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,4 +0,0 @@
|
||||
let MULTIPLER = 5;
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--source-maps", "--out-file", "test.js"]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * x;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=test.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"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);"]}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * x);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["--source-maps", "inline"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * x);
|
||||
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * x;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZGluIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsR0FBRyxDQUFDLEdBQUcsQ0FBQyxVQUFBLENBQUM7U0FBSSxDQUFDLEdBQUcsQ0FBQztDQUFBLENBQUMsQ0FBQyIsImZpbGUiOiJzdGRvdXQiLCJzb3VyY2VzQ29udGVudCI6WyJhcnIubWFwKHggPT4geCAqIHgpOyJdfQ==
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["src", "--source-maps", "inline", "--out-dir", "lib"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
"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
|
||||
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxHQUFHLENBQUMsR0FBRyxDQUFDLFVBQUEsQ0FBQztTQUFJLENBQUMsR0FBRyxVQUFVO0NBQUEsQ0FBQyxDQUFDIiwiZmlsZSI6ImZvby5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19
|
||||
@@ -1,2 +0,0 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["src", "--source-maps", "--out-dir", "lib"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
"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
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/bar/bar.js"],"names":[],"mappings":";;;;IAAM,IAAI,YAAJ,IAAI;wBAAJ,IAAI","file":"bar.js","sourcesContent":["class Test {\n\n}"]}
|
||||
@@ -1,6 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
//# sourceMappingURL=foo.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"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);"]}
|
||||
@@ -1,2 +0,0 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib"]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
"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);
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["script.js", "--source-maps", "inline", "--out-file", "script2.js"]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLEdBQUcsQ0FBQyxHQUFHLENBQUMsVUFBQSxDQUFDO1NBQUksQ0FBQyxHQUFHLFVBQVU7Q0FBQSxDQUFDLENBQUMiLCJmaWxlIjoic2NyaXB0Mi5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["script.js", "--out-file", "script2.js"]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["script.js", "script2.js", "--source-maps", "inline", "--out-file", "script3.js"]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
"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==
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["script.js", "script2.js", "--source-maps", "--out-file", "script3.js"]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
"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
|
||||
@@ -1 +0,0 @@
|
||||
{"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);"]}
|
||||
@@ -1,3 +0,0 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"args": ["script.js", "script2.js", "--out-file", "script3.js"]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user