From 32232dd30eb331ee0ef401b1ad23e8d8a909c68e Mon Sep 17 00:00:00 2001 From: Howard Yeh Date: Sat, 3 Sep 2016 16:32:39 +0800 Subject: [PATCH 001/222] Watch mode should wait for file change. (T7411) --- packages/babel-cli/src/babel/dir.js | 6 +++++- packages/babel-cli/src/babel/file.js | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 6bdb2fc194..362ce10858 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -71,7 +71,11 @@ module.exports = function (commander, filenames) { _.each(filenames, function (dirname) { let watcher = chokidar.watch(dirname, { persistent: true, - ignoreInitial: true + ignoreInitial: true, + awaitWriteFinish: { + stabilityThreshold: 50, + pollInterval: 10, + } }); _.each(["add", "change"], function (type) { diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 36195ca722..8f852216b4 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -138,7 +138,11 @@ module.exports = function (commander, filenames, opts) { let chokidar = util.requireChokidar(); chokidar.watch(filenames, { persistent: true, - ignoreInitial: true + ignoreInitial: true, + awaitWriteFinish: { + stabilityThreshold: 50, + pollInterval: 10, + } }).on("all", function (type, filename) { if (util.shouldIgnore(filename) || !util.canCompile(filename, commander.extensions)) return; From f4389a1886498195b3f43065a152a01d61f21646 Mon Sep 17 00:00:00 2001 From: Richard Macklin Date: Fri, 14 Oct 2016 14:49:37 -0700 Subject: [PATCH 002/222] Extract resolvePlugin method to babel-core public API This encapsulates the logic for turning an acceptable plugin name into the absolute path for that plugin. It can be used to preprocess a plugins list to map each plugin to its absolute path, which is necessary if `babel.transform` is going to be executed on a file outside the directory subtree where the plugins are installed. This adds a getPossiblePluginNames helper encapsulating the logic for what plugin names we should try to resolve, and the resolvePlugin method just calls this helper and actually resolves them. --- packages/babel-core/src/api/node.js | 1 + .../babel-core/src/helpers/get-possible-plugin-names.js | 3 +++ packages/babel-core/src/helpers/resolve-plugin.js | 6 ++++++ .../src/transformation/file/options/option-manager.js | 3 ++- packages/babel-core/test/api.js | 4 ++++ packages/babel-core/test/get-possible-plugin-names.js | 8 ++++++++ 6 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 packages/babel-core/src/helpers/get-possible-plugin-names.js create mode 100644 packages/babel-core/src/helpers/resolve-plugin.js create mode 100644 packages/babel-core/test/get-possible-plugin-names.js diff --git a/packages/babel-core/src/api/node.js b/packages/babel-core/src/api/node.js index 72492e95a5..7899ed2fd4 100644 --- a/packages/babel-core/src/api/node.js +++ b/packages/babel-core/src/api/node.js @@ -5,6 +5,7 @@ export { default as File } from "../transformation/file"; export { default as options } from "../transformation/file/options/config"; export { default as buildExternalHelpers } from "../tools/build-external-helpers"; export { default as template } from "babel-template"; +export { default as resolvePlugin } from "../helpers/resolve-plugin"; export { version } from "../../package"; import * as util from "../util"; diff --git a/packages/babel-core/src/helpers/get-possible-plugin-names.js b/packages/babel-core/src/helpers/get-possible-plugin-names.js new file mode 100644 index 0000000000..9aa95920a8 --- /dev/null +++ b/packages/babel-core/src/helpers/get-possible-plugin-names.js @@ -0,0 +1,3 @@ +export default function getPossiblePluginNames(pluginName: string): Array { + return [`babel-plugin-${pluginName}`, pluginName]; +} diff --git a/packages/babel-core/src/helpers/resolve-plugin.js b/packages/babel-core/src/helpers/resolve-plugin.js new file mode 100644 index 0000000000..7375845d44 --- /dev/null +++ b/packages/babel-core/src/helpers/resolve-plugin.js @@ -0,0 +1,6 @@ +import resolve from "./resolve"; +import getPossiblePluginNames from "./get-possible-plugin-names"; + +export default function resolvePlugin(pluginName: string, dirname: string = process.cwd()): ?string { + return getPossiblePluginNames(pluginName).reduce((accum, curr) => accum || resolve(curr, dirname), null); +} diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index 5af5f58fc9..06a4ff6fe6 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -6,6 +6,7 @@ import Plugin from "../../plugin"; import * as messages from "babel-messages"; import { normaliseOptions } from "./index"; import resolve from "../../../helpers/resolve"; +import resolvePlugin from "../../../helpers/resolve-plugin"; import cloneDeepWith from "lodash/cloneDeepWith"; import clone from "lodash/clone"; import merge from "../../../helpers/merge"; @@ -123,7 +124,7 @@ export default class OptionManager { // allow plugins to be specified as strings if (typeof plugin === "string") { - let pluginLoc = resolve(`babel-plugin-${plugin}`, dirname) || resolve(plugin, dirname); + let pluginLoc = resolvePlugin(plugin, dirname); if (pluginLoc) { plugin = require(pluginLoc); } else { diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 1122e497e8..d0fbadd48e 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -114,6 +114,10 @@ describe("api", function () { }).marked[0].message, "foobar"); }); + it("exposes the resolvePlugin method", function() { + assert.equal(babel.resolvePlugin("nonexistent-plugin"), null); + }); + it("transformFile", function (done) { babel.transformFile(__dirname + "/fixtures/api/file.js", {}, function (err, res) { if (err) return done(err); diff --git a/packages/babel-core/test/get-possible-plugin-names.js b/packages/babel-core/test/get-possible-plugin-names.js new file mode 100644 index 0000000000..4a9ec2d080 --- /dev/null +++ b/packages/babel-core/test/get-possible-plugin-names.js @@ -0,0 +1,8 @@ +let assert = require("assert"); +let getPossiblePluginNames = require("../lib/helpers/get-possible-plugin-names"); + +describe("getPossiblePluginNames", function () { + it("adds the babel-plugin prefix", function() { + assert.deepEqual(getPossiblePluginNames("foobar"), ["babel-plugin-foobar", "foobar"]); + }); +}); From e24f07dfda1d6976c0018dfc7d22a74d273132a3 Mon Sep 17 00:00:00 2001 From: Richard Macklin Date: Fri, 14 Oct 2016 15:09:04 -0700 Subject: [PATCH 003/222] Extract resolvePreset method to babel-core public API This encapsulates the logic for turning an acceptable preset name into the absolute path for that preset. It can be used to preprocess a presets list to map each preset to its absolute path, which is necessary if `babel.transform` is going to be executed on a file outside the directory subtree where the presets are installed. This adds a getPossiblePresetNames helper encapsulating the logic for what preset names we should try to resolve, and the resolvePreset method just calls this helper and actually resolves them. --- packages/babel-core/src/api/node.js | 1 + .../src/helpers/get-possible-preset-names.js | 13 +++++++++++ .../babel-core/src/helpers/resolve-preset.js | 6 +++++ .../file/options/option-manager.js | 15 ++----------- packages/babel-core/test/api.js | 8 +++++-- .../test/get-possible-preset-names.js | 22 +++++++++++++++++++ 6 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 packages/babel-core/src/helpers/get-possible-preset-names.js create mode 100644 packages/babel-core/src/helpers/resolve-preset.js create mode 100644 packages/babel-core/test/get-possible-preset-names.js diff --git a/packages/babel-core/src/api/node.js b/packages/babel-core/src/api/node.js index 7899ed2fd4..a9e4792465 100644 --- a/packages/babel-core/src/api/node.js +++ b/packages/babel-core/src/api/node.js @@ -6,6 +6,7 @@ export { default as options } from "../transformation/file/options/config"; export { default as buildExternalHelpers } from "../tools/build-external-helpers"; export { default as template } from "babel-template"; export { default as resolvePlugin } from "../helpers/resolve-plugin"; +export { default as resolvePreset } from "../helpers/resolve-preset"; export { version } from "../../package"; import * as util from "../util"; diff --git a/packages/babel-core/src/helpers/get-possible-preset-names.js b/packages/babel-core/src/helpers/get-possible-preset-names.js new file mode 100644 index 0000000000..b9fb1726bd --- /dev/null +++ b/packages/babel-core/src/helpers/get-possible-preset-names.js @@ -0,0 +1,13 @@ +export default function getPossiblePresetNames(presetName: string): Array { + let possibleNames = [`babel-preset-${presetName}`, presetName]; + + // trying to resolve @organization shortcat + // @foo/es2015 -> @foo/babel-preset-es2015 + let matches = presetName.match(/^(@[^/]+)\/(.+)$/); + if (matches) { + let [, orgName, presetPath] = matches; + possibleNames.push(`${orgName}/babel-preset-${presetPath}`); + } + + return possibleNames; +} diff --git a/packages/babel-core/src/helpers/resolve-preset.js b/packages/babel-core/src/helpers/resolve-preset.js new file mode 100644 index 0000000000..a7c1784ce9 --- /dev/null +++ b/packages/babel-core/src/helpers/resolve-preset.js @@ -0,0 +1,6 @@ +import resolve from "./resolve"; +import getPossiblePresetNames from "./get-possible-preset-names"; + +export default function resolvePreset(presetName: string, dirname: string = process.cwd()): ?string { + return getPossiblePresetNames(presetName).reduce((accum, curr) => accum || resolve(curr, dirname), null); +} diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index 06a4ff6fe6..3b0c78993b 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -5,8 +5,8 @@ import type Logger from "../logger"; import Plugin from "../../plugin"; import * as messages from "babel-messages"; import { normaliseOptions } from "./index"; -import resolve from "../../../helpers/resolve"; import resolvePlugin from "../../../helpers/resolve-plugin"; +import resolvePreset from "../../../helpers/resolve-preset"; import cloneDeepWith from "lodash/cloneDeepWith"; import clone from "lodash/clone"; import merge from "../../../helpers/merge"; @@ -262,18 +262,7 @@ export default class OptionManager { let presetLoc; try { if (typeof val === "string") { - presetLoc = resolve(`babel-preset-${val}`, dirname) || resolve(val, dirname); - - // trying to resolve @organization shortcat - // @foo/es2015 -> @foo/babel-preset-es2015 - if (!presetLoc) { - let matches = val.match(/^(@[^/]+)\/(.+)$/); - if (matches) { - let [, orgName, presetPath] = matches; - val = `${orgName}/babel-preset-${presetPath}`; - presetLoc = resolve(val, dirname); - } - } + presetLoc = resolvePreset(val, dirname); if (!presetLoc) { throw new Error(`Couldn't find preset ${JSON.stringify(val)} relative to directory ` + diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index d0fbadd48e..55fc0d013a 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -118,6 +118,10 @@ describe("api", function () { assert.equal(babel.resolvePlugin("nonexistent-plugin"), null); }); + it("exposes the resolvePreset method", function() { + assert.equal(babel.resolvePreset("nonexistent-preset"), null); + }); + it("transformFile", function (done) { babel.transformFile(__dirname + "/fixtures/api/file.js", {}, function (err, res) { if (err) return done(err); @@ -266,7 +270,7 @@ describe("api", function () { presets: ["@babel/es2015"] }); }, - /Couldn\'t find preset \"\@babel\/babel\-preset\-es2015\" relative to directory/ + /Couldn\'t find preset \"\@babel\/es2015\" relative to directory/ ); }); @@ -277,7 +281,7 @@ describe("api", function () { presets: ["@babel/react/optimizations"] }); }, - /Couldn\'t find preset \"\@babel\/babel\-preset\-react\/optimizations\" relative to directory/ + /Couldn\'t find preset \"\@babel\/react\/optimizations\" relative to directory/ ); }); diff --git a/packages/babel-core/test/get-possible-preset-names.js b/packages/babel-core/test/get-possible-preset-names.js new file mode 100644 index 0000000000..88f9166c83 --- /dev/null +++ b/packages/babel-core/test/get-possible-preset-names.js @@ -0,0 +1,22 @@ +let assert = require("assert"); +let getPossiblePresetNames = require("../lib/helpers/get-possible-preset-names"); + +describe("getPossiblePresetNames", function () { + it("adds the babel-preset prefix", function() { + assert.deepEqual(getPossiblePresetNames("foobar"), ["babel-preset-foobar", "foobar"]); + }); + + it("inserts babel-preset after @org/", function() { + assert.deepEqual(getPossiblePresetNames("@babel/es2015"), [ + "babel-preset-@babel/es2015", + "@babel/es2015", + "@babel/babel-preset-es2015" + ]); + + assert.deepEqual(getPossiblePresetNames("@babel/react/optimizations"), [ + "babel-preset-@babel/react/optimizations", + "@babel/react/optimizations", + "@babel/babel-preset-react/optimizations" + ]); + }); +}); From 4ea100764559c931cb6c6b4f716fbc533964fa33 Mon Sep 17 00:00:00 2001 From: Richard Macklin Date: Sat, 15 Oct 2016 14:41:03 -0700 Subject: [PATCH 004/222] Remove unneeded tests Previously these were testing the logic that is now encapsulated in getPossiblePresetNames and tested in a unit test --- packages/babel-core/test/api.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 55fc0d013a..0b997fb4a0 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -263,28 +263,6 @@ describe("api", function () { }); - it("handles preset shortcuts (adds babel-preset-)", function () { - return assert.throws( - function () { - babel.transform("", { - presets: ["@babel/es2015"] - }); - }, - /Couldn\'t find preset \"\@babel\/es2015\" relative to directory/ - ); - }); - - it("handles preset shortcuts 2 (adds babel-preset-)", function () { - return assert.throws( - function () { - babel.transform("", { - presets: ["@babel/react/optimizations"] - }); - }, - /Couldn\'t find preset \"\@babel\/react\/optimizations\" relative to directory/ - ); - }); - it("source map merging", function () { let result = babel.transform([ "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }", From 6ec93d782b730a0312fde00533a848385a866f0b Mon Sep 17 00:00:00 2001 From: Richard Macklin Date: Sat, 15 Oct 2016 14:46:24 -0700 Subject: [PATCH 005/222] Extract resolveFromPossibleNames to remove duplicated logic "DRY"s the duplicated algorithm in resolvePlugin and resolvePreset --- .../babel-core/src/helpers/resolve-from-possible-names.js | 5 +++++ packages/babel-core/src/helpers/resolve-plugin.js | 4 ++-- packages/babel-core/src/helpers/resolve-preset.js | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 packages/babel-core/src/helpers/resolve-from-possible-names.js diff --git a/packages/babel-core/src/helpers/resolve-from-possible-names.js b/packages/babel-core/src/helpers/resolve-from-possible-names.js new file mode 100644 index 0000000000..e7a34adf01 --- /dev/null +++ b/packages/babel-core/src/helpers/resolve-from-possible-names.js @@ -0,0 +1,5 @@ +import resolve from "./resolve"; + +export default function resolveFromPossibleNames(possibleNames: Array, dirname: string): ?string { + return possibleNames.reduce((accum, curr) => accum || resolve(curr, dirname), null); +} diff --git a/packages/babel-core/src/helpers/resolve-plugin.js b/packages/babel-core/src/helpers/resolve-plugin.js index 7375845d44..65aba0138b 100644 --- a/packages/babel-core/src/helpers/resolve-plugin.js +++ b/packages/babel-core/src/helpers/resolve-plugin.js @@ -1,6 +1,6 @@ -import resolve from "./resolve"; +import resolveFromPossibleNames from "./resolve-from-possible-names"; import getPossiblePluginNames from "./get-possible-plugin-names"; export default function resolvePlugin(pluginName: string, dirname: string = process.cwd()): ?string { - return getPossiblePluginNames(pluginName).reduce((accum, curr) => accum || resolve(curr, dirname), null); + return resolveFromPossibleNames(getPossiblePluginNames(pluginName), dirname); } diff --git a/packages/babel-core/src/helpers/resolve-preset.js b/packages/babel-core/src/helpers/resolve-preset.js index a7c1784ce9..417aaf9a01 100644 --- a/packages/babel-core/src/helpers/resolve-preset.js +++ b/packages/babel-core/src/helpers/resolve-preset.js @@ -1,6 +1,6 @@ -import resolve from "./resolve"; +import resolveFromPossibleNames from "./resolve-from-possible-names"; import getPossiblePresetNames from "./get-possible-preset-names"; export default function resolvePreset(presetName: string, dirname: string = process.cwd()): ?string { - return getPossiblePresetNames(presetName).reduce((accum, curr) => accum || resolve(curr, dirname), null); + return resolveFromPossibleNames(getPossiblePresetNames(presetName), dirname); } From fad6483aac4ba59f71f8d0af0ade46a733509179 Mon Sep 17 00:00:00 2001 From: Peter Mikula Date: Fri, 28 Oct 2016 20:41:10 +0300 Subject: [PATCH 006/222] fixes invalid line offsets in merged sourcemaps --- packages/babel-cli/src/babel/file.js | 2 +- .../out-files/script3.js | 2 +- .../filenames --out-file --source-maps/out-files/script3.js.map | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 1feb8d2aad..b44b27266d 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -52,7 +52,7 @@ module.exports = function (commander, filenames, opts) { } }); - offset = code.split("\n").length; + offset = code.split("\n").length -1; } }); diff --git a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js index cd0326f68f..5ab4d85cee 100644 --- a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js +++ b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps inline/out-files/script3.js @@ -11,4 +11,4 @@ arr.map(function (x) { return x * MULTIPLIER; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztJQUFNLEk7Ozs7OztBQ0FOLElBQUksR0FBSixDQUFRO0FBQUEsU0FBSyxJQUFJLFVBQVQ7QUFBQSxDQUFSIiwiZmlsZSI6InNjcmlwdDMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJjbGFzcyBUZXN0IHtcblxufSIsImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19 +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjcmlwdC5qcyIsInNjcmlwdDIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztJQUFNLEk7Ozs7O0FDQU4sSUFBSSxHQUFKLENBQVE7QUFBQSxTQUFLLElBQUksVUFBVDtBQUFBLENBQVIiLCJmaWxlIjoic2NyaXB0My5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59IiwiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXX0= diff --git a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map index 6dc6dd4027..cd5df70d02 100644 --- a/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map +++ b/packages/babel-cli/test/fixtures/babel/filenames --out-file --source-maps/out-files/script3.js.map @@ -1 +1 @@ -{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;;;IAAM,I;;;;;;ACAN,IAAI,GAAJ,CAAQ;AAAA,SAAK,IAAI,UAAT;AAAA,CAAR","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]} +{"version":3,"sources":["script.js","script2.js"],"names":[],"mappings":";;;;IAAM,I;;;;;ACAN,IAAI,GAAJ,CAAQ;AAAA,SAAK,IAAI,UAAT;AAAA,CAAR","file":"script3.js","sourcesContent":["class Test {\n\n}","arr.map(x => x * MULTIPLIER);"]} From ccf2f56085708a9eac3c39fcf104473a5165b5e7 Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Fri, 16 Dec 2016 11:14:39 +0900 Subject: [PATCH 007/222] Don't try to visit ArrowFunctionExpression, they cannot be named They will still be visited if the arrow functions are transformed to regular functions. Fixes #5004 --- .../src/index.js | 2 +- .../with-arrow-functions-transform/actual.js | 3 +++ .../with-arrow-functions-transform/expected.js | 9 +++++++++ .../with-arrow-functions-transform/options.json | 3 +++ .../test/fixtures/issues/5004/actual.js | 2 ++ .../test/fixtures/issues/5004/expected.js | 2 ++ .../test/fixtures/issues/5004/options.json | 3 +++ 7 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/actual.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/expected.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/options.json create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json diff --git a/packages/babel-plugin-transform-es2015-function-name/src/index.js b/packages/babel-plugin-transform-es2015-function-name/src/index.js index ab403e6ec5..d0d870377f 100644 --- a/packages/babel-plugin-transform-es2015-function-name/src/index.js +++ b/packages/babel-plugin-transform-es2015-function-name/src/index.js @@ -3,7 +3,7 @@ import nameFunction from "babel-helper-function-name"; export default function () { return { visitor: { - "ArrowFunctionExpression|FunctionExpression": { + FunctionExpression: { exit(path) { if (path.key !== "value" && !path.parentPath.isObjectProperty()) { let replacement = nameFunction(path); diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/actual.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/actual.js new file mode 100644 index 0000000000..c1e980a79f --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/actual.js @@ -0,0 +1,3 @@ +const x = () => x; +const y = x => x(); +const z = { z: () => y(x) }.z; diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/expected.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/expected.js new file mode 100644 index 0000000000..096e218d2d --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/expected.js @@ -0,0 +1,9 @@ +const x = function x() { + return x; +}; +const y = function y(x) { + return x(); +}; +const z = { z: function z() { + return y(x); + } }.z; \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/options.json b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/options.json new file mode 100644 index 0000000000..32ac45253f --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", "transform-es2015-function-name", "transform-es2015-arrow-functions"] +} diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js new file mode 100644 index 0000000000..c8b74de50e --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/actual.js @@ -0,0 +1,2 @@ +export const x = ({x}) => x; +export const y = function () {}; diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js new file mode 100644 index 0000000000..e7a7ae72b4 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/expected.js @@ -0,0 +1,2 @@ +export const x = ({ x }) => x; +export const y = function y() {}; \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json new file mode 100644 index 0000000000..f2178b7ef6 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/issues/5004/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", "transform-es2015-function-name"] +} From 31b85a36dde8428fe6aefffa7cc94d6daff2d3af Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Fri, 16 Dec 2016 11:25:42 +0900 Subject: [PATCH 008/222] Add fixture for known bug --- .../actual.js | 5 +++++ .../expected.js | 16 ++++++++++++++++ .../options.json | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js create mode 100644 packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js new file mode 100644 index 0000000000..f56af5c601 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/actual.js @@ -0,0 +1,5 @@ +// I don't know if this is a bug with arrow-functions spec: true +// or with function-name, but the functions are missing their names. +const x = () => x; +const y = x => x(); +const z = { z: () => y(x) }.z; diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js new file mode 100644 index 0000000000..b842455dae --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/expected.js @@ -0,0 +1,16 @@ +var _this = this; + +// I don't know if this is a bug with arrow-functions spec: true +// or with function-name, but the functions are missing their names. +const x = function () { + babelHelpers.newArrowCheck(this, _this); + return x; +}.bind(this); +const y = function (x) { + babelHelpers.newArrowCheck(this, _this); + return x(); +}.bind(this); +const z = { z: function z() { + babelHelpers.newArrowCheck(this, _this); + return y(x); + }.bind(this) }.z; \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json new file mode 100644 index 0000000000..d66c99f262 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-function-name/test/fixtures/function-name/with-arrow-functions-transform-spec/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", "transform-es2015-function-name", [ "transform-es2015-arrow-functions", { "spec": true } ]] +} From 96084983e6b5a7f2e3f4128cdf162663e56e68be Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 14 Dec 2016 12:12:46 -0500 Subject: [PATCH 009/222] Add Team section [skip ci] --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 04057583fe..7145d3f2d7 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Try it out at our [REPL](https://babeljs.io/repl/#?babili=false&evaluate=true&li - [Syntax Plugins](#syntax-plugins) - [Misc Packages](#misc-packages) - [License](#license) +- [Team](#team) # FAQ @@ -241,3 +242,25 @@ These are mostly for internal use in various plugins: `babel-helper-x`. ## License [MIT](https://github.com/babel/babel/blob/master/LICENSE) + +## Team + +[![Babel](https://avatars.githubusercontent.com/u/9637642?s=64)](https://github.com/babel) | [![Daniel Tschinder](https://avatars.githubusercontent.com/u/231804?s=64)](https://github.com/danez) | [![Logan Smyth](https://avatars.githubusercontent.com/u/132260?s=64)](https://github.com/loganfsmyth) | [![Henry Zhu](https://avatars.githubusercontent.com/u/588473?s=64)](https://github.com/hzoo) | +|---|---|---|---|---| +Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | +:octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) | +:bird: [@babeljs](https://twitter.com/babeljs) | [@TschinderDaniel](https://twitter.com/TschinderDaniel) | [@loganfsmyth](https://twitter.com/loganfsmyth) | [@left_pad](https://twitter.com/left_pad) | + +[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | +|---|---|---|---|---|---|---|---| +| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Juriy Zaytsev | Kai Cataldo | Moti Zilberman | +| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | +| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | + +### Inactive + +[![Amjad Masad](https://avatars.githubusercontent.com/u/587518?s=64)](https://github.com/amasad) | [![James Kyle](https://avatars.githubusercontent.com/u/952783?s=64)](https://github.com/thejameskyle) | [![Jesse McCarthy](https://avatars.githubusercontent.com/u/129203?s=64)](https://github.com/jmm) | [![Sebastian McKenzie](https://avatars.githubusercontent.com/u/853712?s=64)](https://github.com/kittens) (Creator) | +|---|---|---|---| +Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie | +[@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) | +| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens) From 84bae86ae2025166ea55b2310d28a864165cc533 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 17 Dec 2016 10:50:24 +0100 Subject: [PATCH 010/222] [skip ci] update README Add xtuc to members --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7145d3f2d7..193a6b5d60 100644 --- a/README.md +++ b/README.md @@ -251,11 +251,11 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | :octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) | :bird: [@babeljs](https://twitter.com/babeljs) | [@TschinderDaniel](https://twitter.com/TschinderDaniel) | [@loganfsmyth](https://twitter.com/loganfsmyth) | [@left_pad](https://twitter.com/left_pad) | -[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | -|---|---|---|---|---|---|---|---| -| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Juriy Zaytsev | Kai Cataldo | Moti Zilberman | -| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | -| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | +[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | +|---|---|---|---|---|---|---|---|---| +| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | +| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | +| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | ### Inactive From 9fd3f204dd9c3ea42b8a98d333182c45b0afe9d5 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 17 Dec 2016 11:12:36 +0100 Subject: [PATCH 011/222] [skip ci] update README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 193a6b5d60..f9d9475833 100644 --- a/README.md +++ b/README.md @@ -245,19 +245,23 @@ These are mostly for internal use in various plugins: `babel-helper-x`. ## Team +### Core members + [![Babel](https://avatars.githubusercontent.com/u/9637642?s=64)](https://github.com/babel) | [![Daniel Tschinder](https://avatars.githubusercontent.com/u/231804?s=64)](https://github.com/danez) | [![Logan Smyth](https://avatars.githubusercontent.com/u/132260?s=64)](https://github.com/loganfsmyth) | [![Henry Zhu](https://avatars.githubusercontent.com/u/588473?s=64)](https://github.com/hzoo) | |---|---|---|---|---| Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | :octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) | :bird: [@babeljs](https://twitter.com/babeljs) | [@TschinderDaniel](https://twitter.com/TschinderDaniel) | [@loganfsmyth](https://twitter.com/loganfsmyth) | [@left_pad](https://twitter.com/left_pad) | +### Members + [![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | |---|---|---|---|---|---|---|---|---| | Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | | [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | | [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | -### Inactive +### Inactive members [![Amjad Masad](https://avatars.githubusercontent.com/u/587518?s=64)](https://github.com/amasad) | [![James Kyle](https://avatars.githubusercontent.com/u/952783?s=64)](https://github.com/thejameskyle) | [![Jesse McCarthy](https://avatars.githubusercontent.com/u/129203?s=64)](https://github.com/jmm) | [![Sebastian McKenzie](https://avatars.githubusercontent.com/u/853712?s=64)](https://github.com/kittens) (Creator) | |---|---|---|---| From aaa250c17ac1b692a381b5fd129f1cf7530c3049 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 17 Dec 2016 11:20:02 +0100 Subject: [PATCH 012/222] [skip ci] Split members in README --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f9d9475833..75bf7a227f 100644 --- a/README.md +++ b/README.md @@ -255,11 +255,17 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | ### Members -[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | +[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | |---|---|---|---|---|---|---|---|---| -| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | -| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | -| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | +| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | +| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | +| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | + +[![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | +|---|---|---|---|---|---|---|---|---| +| Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | +| [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | +| [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | ### Inactive members @@ -268,3 +274,4 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie | [@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) | | [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens) + From 3ef8e61d72ed38441d21a0023fc7b5d0aa3000f3 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 17 Dec 2016 12:41:49 +0100 Subject: [PATCH 013/222] [skip ci] update babel-core's README --- packages/babel-core/README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/babel-core/README.md b/packages/babel-core/README.md index 3db09945ec..9dc2dac20c 100644 --- a/packages/babel-core/README.md +++ b/packages/babel-core/README.md @@ -9,7 +9,9 @@ import { transform } from 'babel-core'; import * as babel from 'babel-core'; ``` -## babel.transform(code: string, [options?](/docs/usage/api/#options): Object) +All transformation will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it. + +## babel.transform(code: string, [options?](#options): Object) Transforms the passed in `code`. Returning an object with the generated code, source map, and AST. @@ -27,7 +29,7 @@ result.map; result.ast; ``` -## babel.transformFile(filename: string, [options?](/docs/usage/api/#options): Object, callback: Function) +## babel.transformFile(filename: string, [options?](#options): Object, callback: Function) Asynchronously transforms the entire contents of a file. @@ -43,7 +45,7 @@ babel.transformFile("filename.js", options, function (err, result) { }); ``` -## babel.transformFileSync(filename: string, [options?](/docs/usage/api/#options): Object) +## babel.transformFileSync(filename: string, [options?](#options): Object) Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`. @@ -58,7 +60,7 @@ babel.transformFileSync(filename, options) // => { code, map, ast } babel.transformFileSync("filename.js", options).code; ``` -## babel.transformFromAst(ast: Object, code?: string, [options?](/docs/usage/api/#options): Object) +## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object) Given, an [AST](https://astexplorer.net/), transform it. From 9d76f0b2de7b03ee8f0aea099083c80b073ae45e Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 17 Dec 2016 16:37:45 +0100 Subject: [PATCH 014/222] [skip ci] update README --- packages/babel-core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/README.md b/packages/babel-core/README.md index 9dc2dac20c..eda73abf48 100644 --- a/packages/babel-core/README.md +++ b/packages/babel-core/README.md @@ -9,7 +9,7 @@ import { transform } from 'babel-core'; import * as babel from 'babel-core'; ``` -All transformation will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it. +All transformations will use your local configuration files (.babelrc or in package.json). See [options](#options) to disable it. ## babel.transform(code: string, [options?](#options): Object) From dbc07220ae9188a3fb2bdea3d826ff7f48532a2e Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sat, 17 Dec 2016 20:50:03 -0800 Subject: [PATCH 015/222] Revert babel-helper-builder-react-jsx change from #4988 --- packages/babel-helper-builder-react-jsx/src/index.js | 4 ---- .../fixtures/react/should-disallow-spread-children/actual.js | 1 - .../react/should-disallow-spread-children/options.json | 3 --- 3 files changed, 8 deletions(-) delete mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/actual.js delete mode 100644 packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/options.json diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 22f963e342..2438070df0 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -17,10 +17,6 @@ export default function (opts) { throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML."); }; - visitor.JSXSpreadChild = function(path) { - throw path.buildCodeFrameError("Spread children are not supported."); - }; - visitor.JSXElement = { exit(path, file) { let callExpr = buildElementCall(path.get("openingElement"), file); diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/actual.js b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/actual.js deleted file mode 100644 index 6a05e108dc..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/actual.js +++ /dev/null @@ -1 +0,0 @@ -
{...children}
; diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/options.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/options.json deleted file mode 100644 index ec71024507..0000000000 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-disallow-spread-children/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Spread children are not supported." -} From 405697558e977fff0a2e16e88d726340f6bf6e52 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sat, 17 Dec 2016 21:09:23 -0800 Subject: [PATCH 016/222] v6.21.1 changelog [skip ci] --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9c0c57728..7311807047 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.21.1 (2016-12-17) + +#### :bug: Bug Fix +* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx` + * [#5015](https://github.com/babel/babel/pull/5015) Revert the introduction of a new error message that ended up introducing its own error ([@loganfsmyth](https://github.com/loganfsmyth)) + ## 6.21.0 (2016-12-16) #### :rocket: New Feature From 1a8150ef973ccaeadef93d6d42aa8f562ace142f Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sat, 17 Dec 2016 21:15:33 -0800 Subject: [PATCH 017/222] v6.21.1 --- lerna.json | 2 +- packages/babel-helper-builder-react-jsx/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index d2ff6578fb..6ad6cc309f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.21.0", + "version": "6.21.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index 908e3a2c34..d9877f0fe9 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-builder-react-jsx", - "version": "6.21.0", + "version": "6.21.1", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", From 7135751750c2d1f0029ecfc66b04f5f21bc0b624 Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Wed, 21 Dec 2016 12:28:28 +0530 Subject: [PATCH 018/222] Drop support for Node 0.12 :skull: --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index edc8e157cb..992e8e61c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ node_js: - '6' - '5' - '4' -- '0.12' script: - 'if [ -n "${LINT-}" ]; then make lint ; fi' - 'if [ -z "${LINT-}" ]; then make test-ci ; fi' From 868c9ecc11d23bf3c991550d6c1054efec7ba87d Mon Sep 17 00:00:00 2001 From: Siddharth Kshetrapal Date: Wed, 21 Dec 2016 12:35:16 +0530 Subject: [PATCH 019/222] change node version in contributing --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80c27d86d3..a3e0254067 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ Feel free to check out the `#discussion`/`#development` channels on our [slack]( **Note:** Versions `< 5.1.10` can't be built. -Babel is built for node 0.10 and up but we develop using node 6. Make sure you are on npm 3. +Babel is built for node 4 and up but we develop using node 6. Make sure you are on npm 3. You can check this with `node -v` and `npm -v`. From 2d7703afd972a2168b8b510a8c9af5f2863368b3 Mon Sep 17 00:00:00 2001 From: chico Date: Wed, 21 Dec 2016 19:14:39 +0300 Subject: [PATCH 020/222] Like was discussed in Slack chat with @ljharb and @hzoo spaces was added with no particular reason. https://babeljs.slack.com/archives/discussion/p1481744017001806 I'm still not sure if everything here is correct (for example source maps) --- .../src/generators/template-literals.js | 2 -- .../templates-indentation/expected.js | 8 ++++---- .../harmony-edgecase/templates/expected.js | 14 +++++++------- .../expected.js | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/packages/babel-generator/src/generators/template-literals.js b/packages/babel-generator/src/generators/template-literals.js index a8234a00a8..127b64b0cd 100644 --- a/packages/babel-generator/src/generators/template-literals.js +++ b/packages/babel-generator/src/generators/template-literals.js @@ -9,9 +9,7 @@ export function TemplateElement(node: Object, parent: Object) { let value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); - if (!isFirst) this.space(); this.token(value); - if (!isLast) this.space(); } export function TemplateLiteral(node: Object) { diff --git a/packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js b/packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js index 1f664f0ae2..50f361c162 100644 --- a/packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js +++ b/packages/babel-generator/test/fixtures/harmony-edgecase/templates-indentation/expected.js @@ -1,15 +1,15 @@ function multilineTemplate() { return `I'm done reconfoobling -${ 'the energy motron' } - ${ '...or whatever' }`; +${'the energy motron'} + ${'...or whatever'}`; } { const foo = `spam and eggs!`; - const bar = `${ 4 + 2 }`; + const bar = `${4 + 2}`; const hello = `Hello -${ 'world' }`; +${'world'}`; } diff --git a/packages/babel-generator/test/fixtures/harmony-edgecase/templates/expected.js b/packages/babel-generator/test/fixtures/harmony-edgecase/templates/expected.js index 93ff1e3ebb..476203f277 100644 --- a/packages/babel-generator/test/fixtures/harmony-edgecase/templates/expected.js +++ b/packages/babel-generator/test/fixtures/harmony-edgecase/templates/expected.js @@ -15,17 +15,17 @@ Is the order a rabbit? `; var middles = ` -Is the order ${ order }? +Is the order ${order}? `; var middles = ` -Is the order ${ order }? +Is the order ${order}? `; var middles = ` -1. ${ cocoa } -2. ${ chino } -3. ${ rize } -4. ${ syaro } -5. ${ chiya } +1. ${cocoa} +2. ${chino} +3. ${rize} +4. ${syaro} +5. ${chiya} `; diff --git a/packages/babel-generator/test/fixtures/types/TemplateLiteral-TaggedTemplateExpression-TemplateElement/expected.js b/packages/babel-generator/test/fixtures/types/TemplateLiteral-TaggedTemplateExpression-TemplateElement/expected.js index 455ed642b5..b1cd86e7e2 100644 --- a/packages/babel-generator/test/fixtures/types/TemplateLiteral-TaggedTemplateExpression-TemplateElement/expected.js +++ b/packages/babel-generator/test/fixtures/types/TemplateLiteral-TaggedTemplateExpression-TemplateElement/expected.js @@ -3,7 +3,7 @@ html``; `multi lines`; -`test ${ interpolation } test`; +`test ${interpolation} test`; `foob From 07b5b0edf83b2f735564400252c9039322b709b4 Mon Sep 17 00:00:00 2001 From: chico Date: Wed, 21 Dec 2016 19:28:36 +0300 Subject: [PATCH 021/222] fix one more fixture --- .../test/fixtures/regression/4403/expected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/regression/4403/expected.js b/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/regression/4403/expected.js index dbf2e9bdb1..32e1b04280 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/regression/4403/expected.js +++ b/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/regression/4403/expected.js @@ -1,3 +1,3 @@ var a, b; -var _ref = `${ b++ }`; +var _ref = `${b++}`; a[_ref] = Math.pow(a[_ref], 1) From b583829809e4dc1d6e98299729d9220d6f8473f4 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 22 Dec 2016 11:06:00 -0500 Subject: [PATCH 022/222] remove plugin links, just use the website [skip ci] (#5031) --- README.md | 76 +++++-------------------------------------------------- 1 file changed, 6 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 75bf7a227f..e255712a25 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ Try it out at our [REPL](https://babeljs.io/repl/#?babili=false&evaluate=true&li - [Transform Plugins](#transform-plugins) - [Syntax Plugins](#syntax-plugins) - [Misc Packages](#misc-packages) -- [License](#license) - [Team](#team) +- [License](#license) # FAQ @@ -166,83 +166,16 @@ Plugins are the heart of Babel and what make it work. #### Transform Plugins -There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. - -| Package | Version | External Deps | -|--------|-------|------------| -| [`babel-plugin-check-es2015-constants`](/packages/babel-plugin-check-es2015-constants) | [![npm](https://img.shields.io/npm/v/babel-plugin-check-es2015-constants.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-check-es2015-constants) | | -| [`babel-plugin-transform-async-functions`](/packages/babel-plugin-transform-async-functions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-async-functions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-async-functions) | | -| [`babel-plugin-transform-async-generator-functions`](/packages/babel-plugin-transform-async-generator-functions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-async-generator-functions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-async-generator-functions) | -| [`babel-plugin-transform-async-to-generator`](/packages/babel-plugin-transform-async-to-generator) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-async-to-generator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-async-to-generator) | | -| [`babel-plugin-transform-async-to-module-method`](/packages/babel-plugin-transform-async-to-module-method) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-async-to-module-method.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-async-to-module-method) | | -| [`babel-plugin-transform-class-properties`](/packages/babel-plugin-transform-class-properties) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-class-properties.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-class-properties) | | -| [`babel-plugin-transform-decorators`](/packages/babel-plugin-transform-decorators) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-decorators.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-decorators) | | -| [`babel-plugin-transform-do-expressions`](/packages/babel-plugin-transform-do-expressions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-do-expressions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-do-expressions) | | -| [`babel-plugin-transform-es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-arrow-functions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-arrow-functions) | | -| [`babel-plugin-transform-es2015-block-scoped-functions`](/packages/babel-plugin-transform-es2015-block-scoped-functions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-block-scoped-functions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-block-scoped-functions) | | -| [`babel-plugin-transform-es2015-block-scoping`](/packages/babel-plugin-transform-es2015-block-scoping) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-block-scoping.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-block-scoping) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-plugin-transform-es2015-block-scoping)](https://david-dm.org/babel/babel?path=packages/babel-plugin-transform-es2015-block-scoping) | -| [`babel-plugin-transform-es2015-classes`](/packages/babel-plugin-transform-es2015-classes) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-classes.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-classes) | | -| [`babel-plugin-transform-es2015-computed-properties`](/packages/babel-plugin-transform-es2015-computed-properties) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-computed-properties.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-computed-properties) | | -| [`babel-plugin-transform-es2015-destructuring`](/packages/babel-plugin-transform-es2015-destructuring) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-destructuring.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-destructuring) | | -| [`babel-plugin-transform-es2015-duplicate-keys`](/packages/babel-plugin-transform-es2015-duplicate-keys) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-duplicate-keys.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-duplicate-keys) | | -| [`babel-plugin-transform-es2015-for-of`](/packages/babel-plugin-transform-es2015-for-of) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-for-of.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-for-of) | | -| [`babel-plugin-transform-es2015-function-name`](/packages/babel-plugin-transform-es2015-function-name) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-function-name.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-function-name) | | -| [`babel-plugin-transform-es2015-instanceof`](/packages/babel-plugin-transform-es2015-instanceof) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-instanceof.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-instanceof) | | -| [`babel-plugin-transform-es2015-literals`](/packages/babel-plugin-transform-es2015-literals) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-literals.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-literals) | | -| [`babel-plugin-transform-es2015-modules-amd`](/packages/babel-plugin-transform-es2015-modules-amd) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-modules-amd.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-modules-amd) | | -| [`babel-plugin-transform-es2015-modules-commonjs`](/packages/babel-plugin-transform-es2015-modules-commonjs) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-modules-commonjs.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-modules-commonjs) | | -| [`babel-plugin-transform-es2015-modules-systemjs`](/packages/babel-plugin-transform-es2015-modules-systemjs) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-modules-systemjs.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-modules-systemjs) | | -| [`babel-plugin-transform-es2015-modules-umd`](/packages/babel-plugin-transform-es2015-modules-umd) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-modules-umd.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-modules-umd) | | -| [`babel-plugin-transform-es2015-object-super`](/packages/babel-plugin-transform-es2015-object-super) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-object-super.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-object-super) | | -| [`babel-plugin-transform-es2015-parameters`](/packages/babel-plugin-transform-es2015-parameters) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-parameters.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-parameters) | | -| [`babel-plugin-transform-es2015-shorthand-properties`](/packages/babel-plugin-transform-es2015-shorthand-properties) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-shorthand-properties.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-shorthand-properties) | | -| [`babel-plugin-transform-es2015-spread`](/packages/babel-plugin-transform-es2015-spread) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-spread.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-spread) | | -| [`babel-plugin-transform-es2015-sticky-regex`](/packages/babel-plugin-transform-es2015-sticky-regex) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-sticky-regex.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-sticky-regex) | | -| [`babel-plugin-transform-es2015-template-literals`](/packages/babel-plugin-transform-es2015-template-literals) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-template-literals.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-template-literals) | | -| [`babel-plugin-transform-es2015-typeof-symbol`](/packages/babel-plugin-transform-es2015-typeof-symbol) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-typeof-symbol.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-typeof-symbol) | | -| [`babel-plugin-transform-es2015-unicode-regex`](/packages/babel-plugin-transform-es2015-unicode-regex) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es2015-unicode-regex.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es2015-unicode-regex) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-plugin-transform-es2015-unicode-regex)](https://david-dm.org/babel/babel?path=packages/babel-plugin-transform-es2015-unicode-regex) | -| [`babel-plugin-transform-es3-member-expression-literals`](/packages/babel-plugin-transform-es3-member-expression-literals) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es3-member-expression-literals.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es3-member-expression-literals) | | -| [`babel-plugin-transform-es3-property-literals`](/packages/babel-plugin-transform-es3-property-literals) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es3-property-literals.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es3-property-literals) | | -| [`babel-plugin-transform-es5-property-mutators`](/packages/babel-plugin-transform-es5-property-mutators) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-es5-property-mutators.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-es5-property-mutators) | | -| [`babel-plugin-transform-eval`](/packages/babel-plugin-transform-eval) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-eval.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-eval) | | -| [`babel-plugin-transform-exponentiation-operator`](/packages/babel-plugin-transform-exponentiation-operator) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-exponentiation-operator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-exponentiation-operator) | | -| [`babel-plugin-transform-export-extensions`](/packages/babel-plugin-transform-export-extensions) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-export-extensions.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-export-extensions) | | -| [`babel-plugin-transform-flow-comments`](/packages/babel-plugin-transform-flow-comments) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-flow-comments.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-flow-comments) | | -| [`babel-plugin-transform-flow-strip-types`](/packages/babel-plugin-transform-flow-strip-types) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-flow-strip-types.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-flow-strip-types) | | -| [`babel-plugin-transform-function-bind`](/packages/babel-plugin-transform-function-bind) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-function-bind.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-function-bind) | | -| [`babel-plugin-transform-jscript`](/packages/babel-plugin-transform-jscript) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-jscript.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-jscript) | | -| [`babel-plugin-transform-object-assign`](/packages/babel-plugin-transform-object-assign) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-object-assign.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-object-assign) | | -| [`babel-plugin-transform-object-rest-spread`](/packages/babel-plugin-transform-object-rest-spread) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-object-rest-spread.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-object-rest-spread) | | -| [`babel-plugin-transform-object-set-prototype-of-to-assign`](/packages/babel-plugin-transform-object-set-prototype-of-to-assign) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-object-set-prototype-of-to-assign.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-object-set-prototype-of-to-assign) | | -| [`babel-plugin-transform-proto-to-assign`](/packages/babel-plugin-transform-proto-to-assign) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-proto-to-assign.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-proto-to-assign) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-plugin-transform-proto-to-assign)](https://david-dm.org/babel/babel?path=packages/babel-plugin-transform-proto-to-assign) | -| [`babel-plugin-transform-react-constant-elements`](/packages/babel-plugin-transform-react-constant-elements) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-constant-elements.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-constant-elements) | | -| [`babel-plugin-transform-react-display-name`](/packages/babel-plugin-transform-react-display-name) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-display-name.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-display-name) | | -| [`babel-plugin-transform-react-inline-elements`](/packages/babel-plugin-transform-react-inline-elements) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-inline-elements.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-inline-elements) | | -| [`babel-plugin-transform-react-jsx`](/packages/babel-plugin-transform-react-jsx) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-jsx.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-jsx) | | -| [`babel-plugin-transform-react-jsx-compat`](/packages/babel-plugin-transform-react-jsx-compat) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-jsx-compat.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-compat) | | -| [`babel-plugin-transform-react-jsx-self`](/packages/babel-plugin-transform-react-jsx-self) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-jsx-self.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-self) | | -| [`babel-plugin-transform-react-jsx-source`](/packages/babel-plugin-transform-react-jsx-source) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-react-jsx-source.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-react-jsx-source) | | -| [`babel-plugin-transform-regenerator`](/packages/babel-plugin-transform-regenerator) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-regenerator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-regenerator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-plugin-transform-regenerator)](https://david-dm.org/babel/babel?path=packages/babel-plugin-transform-regenerator) | -| [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-runtime.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-runtime) | | -| [`babel-plugin-transform-strict-mode`](/packages/babel-plugin-transform-strict-mode) | [![npm](https://img.shields.io/npm/v/babel-plugin-transform-strict-mode.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-plugin-transform-strict-mode) | | +There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. Check out our [website for more](http://babeljs.io/docs/plugins/#transform-plugins). #### Syntax Plugins -These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. +These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins). ### Helpers These are mostly for internal use in various plugins: `babel-helper-x`. -### Misc Packages - -- [`babel`](/packages/babel) the deprecated `babel` package on npm that was used in Babel 5. -- [`babel-messages`](/packages/babel-messages) a package to keep error messages, etc (not always used) - -## License - -[MIT](https://github.com/babel/babel/blob/master/LICENSE) - ## Team ### Core members @@ -275,3 +208,6 @@ Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie | [@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) | | [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens) +## License + +[MIT](https://github.com/babel/babel/blob/master/LICENSE) From b2e6926042751f63ec51fe23f2e64c32680405f5 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Thu, 22 Dec 2016 23:57:53 +0100 Subject: [PATCH 023/222] Upgrade glob to v7 (#5027) --- packages/babel-cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 9dfdd70124..1fbe3bebd8 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -14,7 +14,7 @@ "commander": "^2.8.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.0.0", - "glob": "^5.0.5", + "glob": "^7.0.0", "lodash": "^4.2.0", "output-file-sync": "^1.1.0", "path-is-absolute": "^1.0.0", From 8b25e215207b3788cc1c9bb94d6ef2a452682360 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sun, 25 Dec 2016 20:54:20 +0100 Subject: [PATCH 024/222] build: remove Circle CI --- circle.yml | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 circle.yml diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 8aa7e6da90..0000000000 --- a/circle.yml +++ /dev/null @@ -1,8 +0,0 @@ -machine: - node: - version: - 0.10.46 - -test: - override: - - make test-ci From 90279f102f2b4b6972f26b858e5faae4783117f2 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sun, 25 Dec 2016 20:54:38 +0100 Subject: [PATCH 025/222] docs: remove compiler support for 0.10 --- doc/design/compiler-environment-support.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/design/compiler-environment-support.md b/doc/design/compiler-environment-support.md index 77c01b0878..30b016cb15 100644 --- a/doc/design/compiler-environment-support.md +++ b/doc/design/compiler-environment-support.md @@ -2,12 +2,12 @@ **NOTE:** Compiler support does not dictate the runtime requirements of compiled code. -## Supported environments +## Officially supported environments The Babel compiler is **only** supported in these environments: - Modern browsers such as Chrome, Firefox, Safari, Edge etc. - - Node 0.10+ + - Node 4 ## Unsupported environments From b1635f8c05084a0093f5c55c6d6ece9ff632b6d0 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 27 Dec 2016 08:30:14 -0600 Subject: [PATCH 026/222] Fix some README links [skip ci] (#5045) --- packages/babel-plugin-check-es2015-constants/README.md | 2 +- .../babel-plugin-transform-es2015-modules-umd/README.md | 2 +- .../babel-plugin-transform-es2015-typeof-symbol/README.md | 2 +- packages/babel-register/README.md | 7 +++++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/babel-plugin-check-es2015-constants/README.md b/packages/babel-plugin-check-es2015-constants/README.md index ee85b823e7..608891b3d2 100644 --- a/packages/babel-plugin-check-es2015-constants/README.md +++ b/packages/babel-plugin-check-es2015-constants/README.md @@ -56,4 +56,4 @@ require("babel-core").transform("code", { ## Note -This check will only validate consts. If you need it to compile down to `var` then you must also install and enable [`transform-es2015-block-scoping`](../babel-plugin-transform-es2015-block-scoping). +This check will only validate consts. If you need it to compile down to `var` then you must also install and enable [`transform-es2015-block-scoping`](http://babeljs.io/docs/plugins/transform-es2015-block-scoping/). diff --git a/packages/babel-plugin-transform-es2015-modules-umd/README.md b/packages/babel-plugin-transform-es2015-modules-umd/README.md index 31fc415480..fe32773781 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/README.md +++ b/packages/babel-plugin-transform-es2015-modules-umd/README.md @@ -110,7 +110,7 @@ factory(global.fooBAR, global.fooBAR); because again the transform is only using the basename of the import. _Second_, the specified override will still be passed to the `toIdentifier` -function in [babel-types/src/converters](../babel-types/src/converters.js). +function in [babel-types/src/converters](https://github.com/babel/babel/blob/master/packages/babel-types/src/converters.js). This means that if you specify an override as a member expression like: ```json diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/README.md b/packages/babel-plugin-transform-es2015-typeof-symbol/README.md index 53b9236ab3..92a7d2d61c 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/README.md +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/README.md @@ -1,6 +1,6 @@ # babel-plugin-transform-es2015-typeof-symbol -> ES6 introduces a new native type called [symbols](http://babeljs.io/docs/learn-es6#symbols). This transformer wraps all `typeof` expressions with a method that replicates native behaviour. (ie. returning "symbol" for symbols) +> ES6 introduces a new native type called [symbols](https://babeljs.io/learn-es2015/#ecmascript-2015-features-symbols). This transformer wraps all `typeof` expressions with a method that replicates native behaviour. (ie. returning "symbol" for symbols) ## Example diff --git a/packages/babel-register/README.md b/packages/babel-register/README.md index 0abbe9b81f..2f05d6a7f7 100644 --- a/packages/babel-register/README.md +++ b/packages/babel-register/README.md @@ -25,7 +25,8 @@ and `.js` will be transformed by Babel.

Polyfill not included

- You must include the polyfill separately when using features that require it, like generators. + You must include the polyfill separately + when using features that require it, like generators.

@@ -69,7 +70,9 @@ require("babel-register")({ }); ``` -You can pass in all other [options](/docs/usage/options/#options) as well, including `plugins` and `presets`. But note that the closest [`.babelrc`](/docs/usage/babelrc/) to each file still applies, and takes precedence over any options you pass in here. +You can pass in all other [options](https://babeljs.io/docs/usage/api/#options) as well, +including `plugins` and `presets`. But note that the closest [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) +to each file still applies, and takes precedence over any options you pass in here. ## Environment variables From 438c872e64b0d611a65c171e08c55e0ac4744c32 Mon Sep 17 00:00:00 2001 From: gitanupam Date: Wed, 28 Dec 2016 16:24:00 +0530 Subject: [PATCH 027/222] Adding more info to the Install section It was confusing to see the Install command for babel-present-react again when the earlier command to install CLI also included babel-preset-react. Hence the edit. --- packages/babel-preset-react/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/babel-preset-react/README.md b/packages/babel-preset-react/README.md index 827160b246..57a51b2984 100644 --- a/packages/babel-preset-react/README.md +++ b/packages/babel-preset-react/README.md @@ -4,6 +4,8 @@ ## Install +(Note: Run the following command to install without the CLI (for example, if CLI is already installed)) + ```sh npm install --save-dev babel-preset-react ``` From fbeadc46eac3cba7eb7dc312d9fd9bb8f2440786 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Wed, 28 Dec 2016 21:49:40 +0100 Subject: [PATCH 028/222] [skip ci] merge documentation with the website --- packages/babel-preset-react/README.md | 34 +++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/babel-preset-react/README.md b/packages/babel-preset-react/README.md index 57a51b2984..aceb108aff 100644 --- a/packages/babel-preset-react/README.md +++ b/packages/babel-preset-react/README.md @@ -2,12 +2,42 @@ > Babel preset for all React plugins. +This preset includes the following plugins: + +- [syntax-flow](https://babeljs.io/docs/plugins/syntax-flow/) +- [syntax-jsx](https://babeljs.io/docs/plugins/syntax-jsx/) +- [transform-flow-strip-types](https://babeljs.io/docs/plugins/transform-flow-strip-types/) +- [transform-react-jsx](https://babeljs.io/docs/plugins/transform-react-jsx/) +- [transform-react-display-name](https://babeljs.io/docs/plugins/transform-react-display-name/) + ## Install -(Note: Run the following command to install without the CLI (for example, if CLI is already installed)) +> You can also check out the React [Getting Started page](https://facebook.github.io/react/docs/hello-world.html) + +> For more info, check out the setup page on the [cli](/docs/setup/) and the [usage](/docs/usage/cli/) docs. + +Install the CLI and this preset ```sh -npm install --save-dev babel-preset-react +npm install --save-dev babel-cli babel-preset-react +``` + +Make a .babelrc config file with the preset + +```sh +echo '{ "presets": ["react"] }' > .babelrc +``` + +Create a file to run on + +```sh +echo '

Hello, world!

' > index.js +``` + +View the output + +```sh +./node_modules/.bin/babel index.js ``` ## Usage From 39cda64fe2d351bfd2c53d9b28ee82f8b7a0d353 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sun, 1 Jan 2017 14:59:50 +0100 Subject: [PATCH 029/222] docs: [skip ci] incorrect snippet language (#5059) --- packages/babel-helpers/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-helpers/README.md b/packages/babel-helpers/README.md index 5a57c5d46a..2614f1160e 100644 --- a/packages/babel-helpers/README.md +++ b/packages/babel-helpers/README.md @@ -4,7 +4,7 @@ ## Install -```js +```sh npm install --save-dev babel-helpers ``` From f611cab0f517351e8862581e483ba44a77dcc611 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 2 Jan 2017 02:01:08 -0600 Subject: [PATCH 030/222] Fix some doc lint issues (#5061) * Remove duplicate usage section from transform-es2015-classes [skip ci] * Fix doc lint issue with transform-function-bind [skip ci] --- .../README.md | 22 ------------------- .../README.md | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/packages/babel-plugin-transform-es2015-classes/README.md b/packages/babel-plugin-transform-es2015-classes/README.md index aa68fde1ca..e115f62cfa 100644 --- a/packages/babel-plugin-transform-es2015-classes/README.md +++ b/packages/babel-plugin-transform-es2015-classes/README.md @@ -79,25 +79,3 @@ class Bar extends Foo { When `Bar.prototype.foo` is defined it triggers the setter on `Foo`. This is a case that is very unlikely to appear in production code however it's something to keep in mind. - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```js -// without options -{ - "plugins": ["transform-es2015-classes"] -} - -// with options -{ - "plugins": [ - ["transform-es2015-classes", { - "loose": true - }] - ] -} -``` diff --git a/packages/babel-plugin-transform-function-bind/README.md b/packages/babel-plugin-transform-function-bind/README.md index 8e11aeae86..0de2810294 100644 --- a/packages/babel-plugin-transform-function-bind/README.md +++ b/packages/babel-plugin-transform-function-bind/README.md @@ -117,4 +117,4 @@ require("babel-core").transform("code", { ## References * [Proposal](https://github.com/zenparsing/es-function-bind) -* [Babel Blog: Function Bind Syntax](/blog/2015/05/14/function-bind) \ No newline at end of file +* [Babel Blog: Function Bind Syntax](/blog/2015/05/14/function-bind) From 2a8d3173d3530963293fe59b08ae36cb867a0253 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 5 Jan 2017 07:16:35 -0600 Subject: [PATCH 031/222] Remove unused define-map helper from computed-properties (#5053) --- .../package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-computed-properties/package.json b/packages/babel-plugin-transform-es2015-computed-properties/package.json index e86661c43c..62deca861f 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/package.json +++ b/packages/babel-plugin-transform-es2015-computed-properties/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-helper-define-map": "^6.8.0", "babel-template": "^6.8.0", "babel-runtime": "^6.0.0" }, From 796c6c07632f93b15e7481cca42b2751e1129205 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Thu, 5 Jan 2017 08:17:16 -0500 Subject: [PATCH 032/222] Remove unused dependency (#5038) --- packages/babel-plugin-transform-decorators/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index 05b2e6e480..f8f1b5c5ca 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -10,7 +10,6 @@ ], "dependencies": { "babel-types": "^6.13.0", - "babel-helper-define-map": "^6.8.0", "babel-plugin-syntax-decorators": "^6.13.0", "babel-helper-explode-class": "^6.8.0", "babel-template": "^6.8.0", From 3ef99d1467fc456c08b296708e625b77cbb6fe2a Mon Sep 17 00:00:00 2001 From: Andrii Bida Date: Thu, 5 Jan 2017 22:43:26 +0200 Subject: [PATCH 033/222] Fix typo in README.md (#5070) Minor typo fix: added the missing space. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e255712a25..00afe123e6 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ https://phabricator.babeljs.io/T2168 mostly corresponds to https://github.com/ba ## Want to report an issue with [babeljs.io](https://babeljs.io) (the website)? -For documentation and website issues please visit the [babel/babel.github.io](https://github.com/babel/babel.github.io)repo. +For documentation and website issues please visit the [babel/babel.github.io](https://github.com/babel/babel.github.io) repo. ## Want to contribute to Babel? From d1cd179c457fcbd5f3396dcc077df062b751f259 Mon Sep 17 00:00:00 2001 From: Anthony Zotti Date: Thu, 5 Jan 2017 13:12:12 -0800 Subject: [PATCH 034/222] Update LICENSE (#5058) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 6a5e2b14bd..d6b2e00435 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2016 Sebastian McKenzie +Copyright (c) 2014-2017 Sebastian McKenzie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From de1a76413fce425fca48a736cdba997f592c44ad Mon Sep 17 00:00:00 2001 From: Karsten Gohm Date: Mon, 9 Jan 2017 15:02:19 +0100 Subject: [PATCH 035/222] Static function call result comment does not match variable content (#5077) static staticProperty, defined in line 18, value is 'babeliscool' but comment on line 33 the given sample output is 'babelIsCool'. this commit fixes this inconsistency --- packages/babel-plugin-transform-class-properties/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-class-properties/README.md b/packages/babel-plugin-transform-class-properties/README.md index a4c7ea02c0..9dbe559082 100644 --- a/packages/babel-plugin-transform-class-properties/README.md +++ b/packages/babel-plugin-transform-class-properties/README.md @@ -15,7 +15,7 @@ Below is a class with four class properties which will be transformed. } //Static class properties - static staticProperty = "babeliscool"; + static staticProperty = "babelIsCool"; static staticFunction = function() { return Bork.staticProperty; } From dc617129f63ca513a18c4f9922518a33dca63e92 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Mon, 9 Jan 2017 15:05:23 +0100 Subject: [PATCH 036/222] Optimize removal-hooks for ArrowFunctions (#5076) --- packages/babel-traverse/package.json | 3 ++ .../src/path/lib/removal-hooks.js | 9 +---- packages/babel-traverse/test/removal.js | 34 +++++++++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 packages/babel-traverse/test/removal.js diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index f88baac088..cca9351535 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -17,5 +17,8 @@ "globals": "^9.0.0", "invariant": "^2.2.0", "lodash": "^4.2.0" + }, + "devDependencies": { + "babel-generator": "^6.21.0" } } diff --git a/packages/babel-traverse/src/path/lib/removal-hooks.js b/packages/babel-traverse/src/path/lib/removal-hooks.js index e016c712f3..07cc98ab46 100644 --- a/packages/babel-traverse/src/path/lib/removal-hooks.js +++ b/packages/babel-traverse/src/path/lib/removal-hooks.js @@ -5,13 +5,6 @@ */ export let hooks = [ - function (self, parent) { - if (self.key === "body" && parent.isArrowFunctionExpression()) { - self.replaceWith(self.scope.buildUndefinedNode()); - return true; - } - }, - function (self, parent) { let removeParent = false; @@ -69,7 +62,7 @@ export let hooks = [ function (self, parent) { if ( (parent.isIfStatement() && (self.key === "consequent" || self.key === "alternate")) || - (parent.isLoop() && self.key === "body") + (self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) ) { self.replaceWith({ type: "BlockStatement", diff --git a/packages/babel-traverse/test/removal.js b/packages/babel-traverse/test/removal.js new file mode 100644 index 0000000000..d09091db0e --- /dev/null +++ b/packages/babel-traverse/test/removal.js @@ -0,0 +1,34 @@ +import traverse from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; +import generate from "babel-generator"; + +function getPath(code) { + const ast = parse(code); + let path; + traverse(ast, { + Program: function (_path) { + path = _path; + _path.stop(); + } + }); + + return path; +} + +function generateCode(path) { + return generate(path.node).code; +} + +describe("removal", function () { + describe("ArrowFunction", function () { + it("remove body", function () { + const rootPath = getPath("x = () => b;"); + const path = rootPath.get("body")[0].get("expression").get("right"); + const body = path.get("body"); + body.remove(); + + assert.equal(generateCode(rootPath), "x = () => {};", "body should be replaced with BlockStatement"); + }); + }); +}); From 39d18679e1e6f50b7141473d9bf404c0e73bb8fd Mon Sep 17 00:00:00 2001 From: Ryan Tsao Date: Mon, 9 Jan 2017 06:08:07 -0800 Subject: [PATCH 037/222] Fix getBindingIdentifiers in babel-types (#5068) * Added getBindingIdentifier tests * Added failing test for getBindingIdentifiers * Fix babel-types getBindingIdentifiers --- packages/babel-types/src/retrievers.js | 4 ++-- packages/babel-types/test/retrievers.js | 27 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 packages/babel-types/test/retrievers.js diff --git a/packages/babel-types/src/retrievers.js b/packages/babel-types/src/retrievers.js index 12bba815b0..c4d7647b4a 100644 --- a/packages/babel-types/src/retrievers.js +++ b/packages/babel-types/src/retrievers.js @@ -29,8 +29,8 @@ export function getBindingIdentifiers( } if (t.isExportDeclaration(id)) { - if (t.isDeclaration(node.declaration)) { - search.push(node.declaration); + if (t.isDeclaration(id.declaration)) { + search.push(id.declaration); } continue; } diff --git a/packages/babel-types/test/retrievers.js b/packages/babel-types/test/retrievers.js new file mode 100644 index 0000000000..68eb34c4f3 --- /dev/null +++ b/packages/babel-types/test/retrievers.js @@ -0,0 +1,27 @@ +import * as t from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; + +function getBody(program) { + return parse(program, {sourceType: "module"}).program.body; +} + +describe("retrievers", function () { + describe("getBindingIdentifiers", function () { + it("variable declarations", function () { + const program = "var a = 1; let b = 2; const c = 3;"; + const ids = t.getBindingIdentifiers(getBody(program)); + assert.deepEqual(Object.keys(ids), ["a", "b", "c"]); + }); + it("function declarations", function () { + const program = "var foo = 1; function bar() { var baz = 2; }"; + const ids = t.getBindingIdentifiers(getBody(program)); + assert.deepEqual(Object.keys(ids), ["bar", "foo"]); + }); + it("export named declarations", function () { + const program = "export const foo = 'foo';"; + const ids = t.getBindingIdentifiers(getBody(program)); + assert.deepEqual(Object.keys(ids), ["foo"]); + }); + }); +}); From a749907bc2cfd757d2e23922f7952ab79fce2b51 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 11 Jan 2017 09:23:21 -0600 Subject: [PATCH 038/222] Ensure array is always copied during destructure --- .../src/index.js | 5 +---- .../test/fixtures/destructuring/issue-5090/exec.js | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index 3fe8c9fd3b..b82ac321dd 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -294,10 +294,7 @@ export default function ({ types: t }) { if (t.isRestElement(elem)) { elemRef = this.toArray(arrayRef); - - if (i > 0) { - elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]); - } + elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]); // set the element to the rest element argument since we've dealt with it // being a rest already diff --git a/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js b/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js new file mode 100644 index 0000000000..d295a9c9f6 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js @@ -0,0 +1,9 @@ +const assign = ([...arr], index, value) => { + arr[index] = value; + return arr; +} + +const arr = [1, 2, 3]; +assign(arr, 1, 42); + +assert.deepEqual(arr, [1, 2, 3]); From 46d9339488829e482ec7190eed7e64ae8935dcb1 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 11 Jan 2017 17:12:09 -0600 Subject: [PATCH 039/222] arrow --- .../test/fixtures/destructuring/issue-5090/exec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js b/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js index d295a9c9f6..b7727da604 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js +++ b/packages/babel-plugin-transform-es2015-destructuring/test/fixtures/destructuring/issue-5090/exec.js @@ -1,4 +1,4 @@ -const assign = ([...arr], index, value) => { +const assign = function([...arr], index, value) { arr[index] = value; return arr; } From 3a1c0c84fb3f54dcfd4c472e6d4ec4b0175b400c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Batista?= Date: Fri, 13 Jan 2017 15:16:07 +0100 Subject: [PATCH 040/222] Fix broken repository url (#5100) --- packages/babel-plugin-transform-react-jsx/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index c80e86560f..fd57cffaa3 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -2,7 +2,7 @@ "name": "babel-plugin-transform-react-jsx", "version": "6.8.0", "description": "Turn JSX into React function calls", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jsx", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", "main": "lib/index.js", "keywords": [ From d2113d4881371e410ad434cad4167e2d3b9da0dd Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Fri, 13 Jan 2017 18:11:44 +0100 Subject: [PATCH 041/222] babel-code-frame: Upgrade to js-tokens@3 (#5094) That version brings a big performance boost. --- packages/babel-code-frame/package.json | 2 +- packages/babel-code-frame/src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-code-frame/package.json b/packages/babel-code-frame/package.json index f480727283..82b2bcdc10 100644 --- a/packages/babel-code-frame/package.json +++ b/packages/babel-code-frame/package.json @@ -10,6 +10,6 @@ "dependencies": { "chalk": "^1.1.0", "esutils": "^2.0.2", - "js-tokens": "^2.0.0" + "js-tokens": "^3.0.0" } } diff --git a/packages/babel-code-frame/src/index.js b/packages/babel-code-frame/src/index.js index 05637e9e40..1e570ab692 100644 --- a/packages/babel-code-frame/src/index.js +++ b/packages/babel-code-frame/src/index.js @@ -1,4 +1,4 @@ -import jsTokens from "js-tokens"; +import jsTokens, {matchToToken} from "js-tokens"; import esutils from "esutils"; import Chalk from "chalk"; @@ -47,7 +47,7 @@ const BRACKET = /^[()\[\]{}]$/; function getTokenType(match) { let [offset, text] = match.slice(-2); - let token = jsTokens.matchToToken(match); + let token = matchToToken(match); if (token.type === "name") { if (esutils.keyword.isReservedWordES6(token.value)) { From b820d8ebc9e2f39daad2048cd5329dba09382bb4 Mon Sep 17 00:00:00 2001 From: Jeff Morrison Date: Sat, 24 Dec 2016 17:30:13 -0600 Subject: [PATCH 042/222] Strip Flow's new shorthand import-type specifiers --- .../fixtures/strip-types/strip-type-annotations/actual.js | 4 ++++ .../fixtures/strip-types/strip-type-annotations/expected.js | 5 +++++ packages/babel-traverse/package.json | 2 +- packages/babel-traverse/src/path/lib/virtual-types.js | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/actual.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/actual.js index 36cfd7f425..f602db2cbc 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/actual.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/actual.js @@ -97,5 +97,9 @@ import type2, { foo3 } from "bar"; import type * as namespace from "bar"; export type { foo }; export type { foo2 } from "bar"; +import {type T} from "foo"; +import {type T2, V1} from "foo"; +import {typeof V2} from "foo"; +import {typeof V3, V4} from "foo"; export interface foo5 { p: number } export interface foo6 { p: T } diff --git a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/expected.js b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/expected.js index 62bf507aae..a6c982a6a3 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/expected.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/fixtures/strip-types/strip-type-annotations/expected.js @@ -90,3 +90,8 @@ var identity; import type from "foo"; import type2, { foo3 } from "bar"; + +import "foo"; +import { V1 } from "foo"; +import "foo"; +import { V4 } from "foo"; diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index cca9351535..b42120c302 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -12,7 +12,7 @@ "babel-messages": "^6.8.0", "babel-runtime": "^6.20.0", "babel-types": "^6.21.0", - "babylon": "^6.11.0", + "babylon": "^6.15.0", "debug": "^2.2.0", "globals": "^9.0.0", "invariant": "^2.2.0", diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index 396be80b90..fec4dea2ef 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -105,7 +105,7 @@ export let Pure = { }; export let Flow = { - types: ["Flow", "ImportDeclaration", "ExportDeclaration"], + types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"], checkPath({ node }: NodePath): boolean { if (t.isFlow(node)) { return true; @@ -113,6 +113,8 @@ export let Flow = { return node.importKind === "type" || node.importKind === "typeof"; } else if (t.isExportDeclaration(node)) { return node.exportKind === "type"; + } else if (t.isImportSpecifier(node)) { + return node.importKind === "type" || node.importKind === "typeof"; } else { return false; } From 761079fac0e6b76e359824706f2e6f41f3f4e97b Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 13 Jan 2017 19:23:13 -0600 Subject: [PATCH 043/222] Add examples to computed-props and for-of READMEs [skip ci] (#5096) --- .../README.md | 77 ++++++++++++++++- .../README.md | 83 +++++++++++++------ 2 files changed, 133 insertions(+), 27 deletions(-) diff --git a/packages/babel-plugin-transform-es2015-computed-properties/README.md b/packages/babel-plugin-transform-es2015-computed-properties/README.md index db0e270a38..573996ff5b 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/README.md +++ b/packages/babel-plugin-transform-es2015-computed-properties/README.md @@ -2,6 +2,49 @@ > Compile ES2015 computed properties to ES5 +## Example + +**In** + +```js +var obj = { + ["x" + foo]: "heh", + ["y" + bar]: "noo", + foo: "foo", + bar: "bar" +}; +``` + +**Out** + +```js +var _obj; + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +var obj = ( + _obj = {}, + _defineProperty(_obj, "x" + foo, "heh"), + _defineProperty(_obj, "y" + bar, "noo"), + _defineProperty(_obj, "foo", "foo"), + _defineProperty(_obj, "bar", "bar"), + _obj +); +``` + ## Installation ```sh @@ -46,6 +89,38 @@ require("babel-core").transform("code", { ## Options -* `loose` - Just like method assignment in classes, in loose mode, computed property names +### `loose` + +`boolean`, defaults to `false` + +Just like method assignment in classes, in loose mode, computed property names use simple assignments instead of being defined. This is unlikely to be an issue in production code. + +#### Example + +***In*** + +```js +var obj = { + ["x" + foo]: "heh", + ["y" + bar]: "noo", + foo: "foo", + bar: "bar" +}; +``` + +***Out*** + +```js +var _obj; + +var obj = ( + _obj = {}, + _obj["x" + foo] = "heh", + _obj["y" + bar] = "noo", + _obj.foo = "foo", + _obj.bar = "bar", + _obj +); +``` diff --git a/packages/babel-plugin-transform-es2015-for-of/README.md b/packages/babel-plugin-transform-es2015-for-of/README.md index 22aae1b1a0..7aff9a00f2 100644 --- a/packages/babel-plugin-transform-es2015-for-of/README.md +++ b/packages/babel-plugin-transform-es2015-for-of/README.md @@ -2,6 +2,41 @@ > Compile ES2015 for...of to ES5 +## Example + +**In** + +```js +for (var i of foo) {} +``` + +**Out** + +```js +var _iteratorNormalCompletion = true; +var _didIteratorError = false; +var _iteratorError = undefined; + +try { + for (var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var i = _step.value; + } +} catch (err) { + _didIteratorError = true; + _iteratorError = err; +} finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } +} +``` + ## Installation ```sh @@ -44,52 +79,48 @@ require("babel-core").transform("code", { }); ``` -## Options `loose` +## Options -#### Abrupt completions +### `loose` -In loose mode an iterators `return` method will not be called on abrupt completions caused by thrown errors. +`boolean`, defaults to `false` -Please see [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and -[babel/babel#838](https://github.com/babel/babel/issues/838) for more information. +In loose mode, arrays are put in a fast path, thus heavily increasing performance. +All other iterables will continue to work fine. -#### Arrays +#### Example -Under loose mode the `forOf` transformer will output more verbose iteration code. +**In** -For example the following: - -```javascript +```js for (var i of foo) {} ``` -is normally output as: +**Out** -```javascript -for (var _iterator = foo[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) { - var i = _step.value; -} -``` - -Under loose mode however it's output as: - -```javascript +```js for (var _iterator = foo, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var i; + var _ref; + if (_isArray) { if (_i >= _iterator.length) break; - i = _iterator[_i++]; + _ref = _iterator[_i++]; } else { _i = _iterator.next(); if (_i.done) break; - i = _i.value; + _ref = _i.value; } + + var i = _ref; } ``` -The result is that arrays are put in a fast path, heavily increasing performance. -All other iterables will continue to work fine but array iteration will be -significantly faster. +#### Abrupt completions + +In loose mode an iterator's `return` method will not be called on abrupt completions caused by thrown errors. + +Please see [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and +[babel/babel#838](https://github.com/babel/babel/issues/838) for more information. ### Optimization From 80a757819f0697b86d37c3f8f0521b3fc894a289 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 13 Jan 2017 22:13:27 -0800 Subject: [PATCH 044/222] Validate importKind and ensure code generation exists. --- packages/babel-generator/src/generators/modules.js | 5 +++++ .../test/fixtures/flow/type-annotations/actual.js | 4 ++++ .../test/fixtures/flow/type-annotations/expected.js | 4 ++++ packages/babel-types/src/definitions/es2015.js | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/packages/babel-generator/src/generators/modules.js b/packages/babel-generator/src/generators/modules.js index 6a87a02512..f92ed919e4 100644 --- a/packages/babel-generator/src/generators/modules.js +++ b/packages/babel-generator/src/generators/modules.js @@ -1,6 +1,11 @@ import * as t from "babel-types"; export function ImportSpecifier(node: Object) { + if (node.importKind === "type" || node.importKind === "typeof") { + this.word(node.importKind); + this.space(); + } + this.print(node.imported, node); if (node.local && node.local.name !== node.imported.name) { this.space(); diff --git a/packages/babel-generator/test/fixtures/flow/type-annotations/actual.js b/packages/babel-generator/test/fixtures/flow/type-annotations/actual.js index 2690152d34..d252ef635a 100644 --- a/packages/babel-generator/test/fixtures/flow/type-annotations/actual.js +++ b/packages/babel-generator/test/fixtures/flow/type-annotations/actual.js @@ -97,6 +97,10 @@ import type { foo as bar } from "baz"; import type from "foo"; import type, { foo } from "bar"; import type * as namespace from "bar"; +import { type Foo } from "bar"; +import { typeof Foo } from "bar"; +import { type Foo as Bar } from "bar"; +import { typeof Foo as Bar } from "bar"; export type { foo }; export type { bar } from "bar"; export interface baz { p: number }; diff --git a/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js b/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js index 7a9406eaa3..205513cb00 100644 --- a/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js +++ b/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js @@ -101,6 +101,10 @@ import type { foo as bar } from "baz"; import type from "foo"; import type, { foo } from "bar"; import type * as namespace from "bar"; +import { type Foo } from "bar"; +import { typeof Foo } from "bar"; +import { type Foo as Bar } from "bar"; +import { typeof Foo as Bar } from "bar"; export type { foo }; export type { bar } from "bar"; export interface baz { p: number }; diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 4f4ff0807c..820ddcf238 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -227,6 +227,10 @@ defineType("ImportSpecifier", { }, imported: { validate: assertNodeType("Identifier") + }, + importKind: { + // Handle Flowtype's extension "import {typeof foo} from" + validate: assertOneOf(null, "type", "typeof") } } }); From 1691fc959f0021ba2af365d2ade85270d88fb8ca Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 14 Jan 2017 14:21:58 +0100 Subject: [PATCH 045/222] Add mention-bot (#5057) [skip ci] --- .mention-bot | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .mention-bot diff --git a/.mention-bot b/.mention-bot new file mode 100644 index 0000000000..6c013ed41f --- /dev/null +++ b/.mention-bot @@ -0,0 +1,6 @@ +{ + "userBlacklist": [ "amasad", "thejameskyle", "jmm", "kittens" ], + "fileBlacklist": ["*.md"], // mention-bot will ignore any files that match these file globs + "skipAlreadyAssignedPR": true, // mention-bot will ignore already assigned PR's, + "createReviewRequest": true +} From d3f3aced40d354b3a3e085f78089b6cddd126685 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 14 Jan 2017 09:29:45 -0500 Subject: [PATCH 046/222] mention-bot: remove comments [skip ci] --- .mention-bot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mention-bot b/.mention-bot index 6c013ed41f..32b2d0479e 100644 --- a/.mention-bot +++ b/.mention-bot @@ -1,6 +1,6 @@ { "userBlacklist": [ "amasad", "thejameskyle", "jmm", "kittens" ], - "fileBlacklist": ["*.md"], // mention-bot will ignore any files that match these file globs - "skipAlreadyAssignedPR": true, // mention-bot will ignore already assigned PR's, + "fileBlacklist": ["*.md"], + "skipAlreadyAssignedPR": true, "createReviewRequest": true } From 982850731e67005f17720f74bc10a4e54f87839b Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 14 Jan 2017 15:45:20 +0100 Subject: [PATCH 047/222] fix: [skip ci] consistent documentation (#5111) --- .../babel-plugin-transform-es2015-duplicate-keys/README.md | 4 +++- packages/babel-plugin-transform-es2015-parameters/README.md | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/README.md b/packages/babel-plugin-transform-es2015-duplicate-keys/README.md index bfcb7c4257..aa502cce50 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/README.md +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/README.md @@ -1,6 +1,8 @@ # babel-plugin-transform-es2015-duplicate-keys -> Compile objects with duplicate keys to valid strict ES5. This plugin actually converts duplicate keys in objects to be computed properties, which then must be handled by the [transform-es2015-computed-properties](http://babeljs.io/docs/plugins/transform-es2015-computed-properties) plugin. The final result won't contain any object literals with duplicate keys. +> Compile objects with duplicate keys to valid strict ES5. + +This plugin actually converts duplicate keys in objects to be computed properties, which then must be handled by the [transform-es2015-computed-properties](http://babeljs.io/docs/plugins/transform-es2015-computed-properties) plugin. The final result won't contain any object literals with duplicate keys. ## Example diff --git a/packages/babel-plugin-transform-es2015-parameters/README.md b/packages/babel-plugin-transform-es2015-parameters/README.md index bd55bbc350..5c52e0c0c8 100644 --- a/packages/babel-plugin-transform-es2015-parameters/README.md +++ b/packages/babel-plugin-transform-es2015-parameters/README.md @@ -2,6 +2,12 @@ > Compile ES2015 default and rest parameters to ES5 +This plugin transforms ES2015 parameters to ES5, this includes: + +- Destructuring parameters +- Default parameters +- Rest parameters + ## Installation ```sh From 672adba9a14aa3b4d4676ef6b8699616d2062a55 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 14 Jan 2017 09:48:52 -0500 Subject: [PATCH 048/222] enable prefer const (#5113) --- package.json | 3 +- packages/babel-cli/src/_babel-node.js | 18 +- packages/babel-cli/src/babel-node.js | 12 +- packages/babel-cli/src/babel/dir.js | 32 ++-- packages/babel-cli/src/babel/file.js | 48 +++--- packages/babel-cli/src/babel/index.js | 24 +-- packages/babel-cli/src/babel/util.js | 22 +-- packages/babel-cli/test/index.js | 62 +++---- packages/babel-code-frame/src/index.js | 32 ++-- packages/babel-code-frame/test/index.js | 18 +- packages/babel-core/src/api/browser.js | 18 +- packages/babel-core/src/api/node.js | 8 +- .../src/helpers/get-possible-preset-names.js | 6 +- packages/babel-core/src/helpers/merge.js | 4 +- packages/babel-core/src/helpers/resolve.js | 4 +- packages/babel-core/src/store.js | 2 +- .../src/tools/build-external-helpers.js | 20 +-- .../src/transformation/file/index.js | 112 ++++++------ .../src/transformation/file/logger.js | 6 +- .../src/transformation/file/metadata.js | 36 ++-- .../file/options/build-config-chain.js | 24 +-- .../src/transformation/file/options/index.js | 4 +- .../file/options/option-manager.js | 34 ++-- .../transformation/file/options/parsers.js | 2 +- .../internal-plugins/block-hoist.js | 2 +- .../internal-plugins/shadow-functions.js | 12 +- .../babel-core/src/transformation/pipeline.js | 6 +- .../babel-core/src/transformation/plugin.js | 12 +- packages/babel-core/src/util.js | 10 +- packages/babel-core/test/api.js | 50 +++--- packages/babel-core/test/browserify.js | 10 +- packages/babel-core/test/config-chain.js | 32 ++-- packages/babel-core/test/evaluation.js | 10 +- .../test/get-possible-plugin-names.js | 4 +- .../test/get-possible-preset-names.js | 4 +- packages/babel-core/test/option-manager.js | 12 +- packages/babel-core/test/path.js | 34 ++-- packages/babel-core/test/resolution.js | 16 +- packages/babel-core/test/util.js | 12 +- packages/babel-generator/src/buffer.js | 10 +- .../babel-generator/src/generators/base.js | 2 +- .../src/generators/expressions.js | 10 +- .../babel-generator/src/generators/flow.js | 2 +- .../babel-generator/src/generators/jsx.js | 4 +- .../babel-generator/src/generators/methods.js | 4 +- .../babel-generator/src/generators/modules.js | 10 +- .../src/generators/statements.js | 24 +-- .../src/generators/template-literals.js | 4 +- .../babel-generator/src/generators/types.js | 12 +- packages/babel-generator/src/index.js | 16 +- packages/babel-generator/src/node/index.js | 22 +-- .../babel-generator/src/node/parentheses.js | 8 +- .../babel-generator/src/node/whitespace.js | 6 +- packages/babel-generator/src/printer.js | 26 +-- packages/babel-generator/src/whitespace.js | 8 +- packages/babel-generator/test/index.js | 78 ++++----- .../src/index.js | 10 +- .../src/index.js | 16 +- .../src/index.js | 14 +- .../src/index.js | 18 +- .../babel-helper-call-delegate/src/index.js | 8 +- packages/babel-helper-define-map/src/index.js | 24 +-- .../src/index.js | 12 +- .../babel-helper-explode-class/src/index.js | 10 +- packages/babel-helper-fixtures/src/index.js | 40 ++--- .../babel-helper-function-name/src/index.js | 20 +-- .../src/index.js | 4 +- .../babel-helper-hoist-variables/src/index.js | 10 +- .../src/index.js | 2 +- packages/babel-helper-regex/src/index.js | 2 +- .../src/for-await.js | 20 +-- .../src/index.js | 34 ++-- .../babel-helper-replace-supers/src/index.js | 30 ++-- .../src/helpers.js | 2 +- .../src/index.js | 40 ++--- packages/babel-helpers/src/helpers.js | 2 +- packages/babel-helpers/src/index.js | 4 +- packages/babel-messages/src/index.js | 2 +- .../src/index.js | 6 +- .../src/index.js | 4 +- .../src/index.js | 14 +- .../src/index.js | 40 ++--- .../src/index.js | 26 +-- .../src/index.js | 2 +- .../src/index.js | 4 +- .../src/index.js | 10 +- .../src/index.js | 152 ++++++++--------- .../src/tdz.js | 24 +-- .../src/index.js | 14 +- .../src/lib/memoise-decorators.js | 8 +- .../src/loose.js | 6 +- .../src/vanilla.js | 70 ++++---- .../src/index.js | 32 ++-- .../src/index.js | 94 +++++----- .../src/index.js | 36 ++-- .../src/index.js | 56 +++--- .../src/index.js | 6 +- .../src/index.js | 2 +- .../src/index.js | 22 +-- .../src/index.js | 128 +++++++------- .../test/esmodule-flag.js | 10 +- .../src/index.js | 74 ++++---- .../src/index.js | 42 ++--- .../src/index.js | 10 +- .../src/default.js | 34 ++-- .../src/destructuring.js | 14 +- .../src/index.js | 4 +- .../src/rest.js | 44 ++--- .../src/index.js | 2 +- .../src/index.js | 28 +-- .../src/index.js | 2 +- .../src/index.js | 16 +- .../src/index.js | 12 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 6 +- .../babel-plugin-transform-eval/src/index.js | 6 +- .../src/index.js | 10 +- .../src/index.js | 10 +- .../src/index.js | 4 +- .../src/index.js | 14 +- .../src/index.js | 2 +- .../src/index.js | 54 +++--- .../src/index.js | 16 +- .../src/index.js | 6 +- .../src/index.js | 14 +- .../src/index.js | 20 +-- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 14 +- .../src/index.js | 20 +-- .../src/index.js | 4 +- .../src/index.js | 10 +- packages/babel-polyfill/src/index.js | 2 +- packages/babel-preset-es2015/test/index.js | 4 +- packages/babel-preset-es2015/test/traceur.js | 2 +- packages/babel-register/src/node.js | 16 +- packages/babel-template/src/index.js | 10 +- packages/babel-template/test/index.js | 14 +- packages/babel-traverse/src/context.js | 20 +-- packages/babel-traverse/src/index.js | 8 +- packages/babel-traverse/src/path/ancestry.js | 28 +-- packages/babel-traverse/src/path/comments.js | 10 +- packages/babel-traverse/src/path/context.js | 18 +- .../babel-traverse/src/path/conversion.js | 4 +- .../babel-traverse/src/path/evaluation.js | 74 ++++---- packages/babel-traverse/src/path/family.js | 24 +-- packages/babel-traverse/src/path/index.js | 18 +- .../src/path/inference/index.js | 14 +- .../src/path/inference/inferer-reference.js | 38 ++--- .../src/path/inference/inferers.js | 12 +- .../babel-traverse/src/path/introspection.js | 76 ++++----- .../babel-traverse/src/path/lib/hoister.js | 34 ++-- .../src/path/lib/removal-hooks.js | 2 +- .../src/path/lib/virtual-types.js | 26 +-- .../babel-traverse/src/path/modification.js | 36 ++-- packages/babel-traverse/src/path/removal.js | 2 +- .../babel-traverse/src/path/replacement.js | 30 ++-- packages/babel-traverse/src/scope/index.js | 160 +++++++++--------- .../babel-traverse/src/scope/lib/renamer.js | 28 +-- packages/babel-traverse/src/visitors.js | 62 +++---- packages/babel-traverse/test/ancestry.js | 26 +-- packages/babel-traverse/test/evaluation.js | 8 +- packages/babel-traverse/test/family.js | 8 +- packages/babel-traverse/test/scope.js | 8 +- packages/babel-traverse/test/traverse.js | 44 ++--- packages/babel-types/src/converters.js | 26 +-- packages/babel-types/src/definitions/core.js | 6 +- .../babel-types/src/definitions/es2015.js | 2 +- packages/babel-types/src/definitions/index.js | 28 +-- packages/babel-types/src/flow.js | 18 +- packages/babel-types/src/index.js | 74 ++++---- packages/babel-types/src/react.js | 14 +- packages/babel-types/src/retrievers.js | 10 +- packages/babel-types/src/validators.js | 10 +- packages/babel-types/test/cloning.js | 44 ++--- packages/babel-types/test/validators.js | 14 +- 177 files changed, 1862 insertions(+), 1863 deletions(-) diff --git a/package.json b/package.json index e62332ff19..6f082e6cd1 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,7 @@ "codecov": "^1.0.1", "derequire": "^2.0.2", "eslint": "^3.9.0", - "eslint-config-babel": "^2.0.1", - "eslint-plugin-babel": "^3.3.0", + "eslint-config-babel": "^5.0.0", "eslint-plugin-flowtype": "^2.20.0", "flow-bin": "^0.34.0", "gulp": "^3.9.0", diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 3c7c40ed4d..40471639bd 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -11,7 +11,7 @@ import _ from "lodash"; import "babel-polyfill"; import register from "babel-register"; -let program = new commander.Command("babel-node"); +const program = new commander.Command("babel-node"); program.option("-e, --eval [script]", "Evaluate script"); program.option("-p, --print [code]", "Evaluate script and print result"); @@ -21,7 +21,7 @@ program.option("-x, --extensions [extensions]", "List of extensions to hook into program.option("-w, --plugins [string]", "", util.list); program.option("-b, --presets [string]", "", util.list); -let pkg = require("../package.json"); +const pkg = require("../package.json"); program.version(pkg.version); program.usage("[options] [ -e script | script.js ] [arguments]"); program.parse(process.argv); @@ -38,7 +38,7 @@ register({ // -let replPlugin = ({ types: t }) => ({ +const replPlugin = ({ types: t }) => ({ visitor: { ModuleDeclaration(path) { throw path.buildCodeFrameError("Modules aren't supported in the REPL"); @@ -62,7 +62,7 @@ let replPlugin = ({ types: t }) => ({ // -let _eval = function (code, filename) { +const _eval = function (code, filename) { code = code.trim(); if (!code) return undefined; @@ -84,7 +84,7 @@ if (program.eval || program.print) { global.__filename = "[eval]"; global.__dirname = process.cwd(); - let module = new Module(global.__filename); + const module = new Module(global.__filename); module.filename = global.__filename; module.paths = Module._nodeModulePaths(global.__dirname); @@ -92,9 +92,9 @@ if (program.eval || program.print) { global.module = module; global.require = module.require.bind(module); - let result = _eval(code, global.__filename); + const result = _eval(code, global.__filename); if (program.print) { - let output = _.isString(result) ? result : inspect(result); + const output = _.isString(result) ? result : inspect(result); process.stdout.write(output + "\n"); } } else { @@ -111,7 +111,7 @@ if (program.eval || program.print) { } if (arg[0] === "-") { - let parsedArg = program[arg.slice(2)]; + const parsedArg = program[arg.slice(2)]; if (parsedArg && parsedArg !== true) { ignoreNext = true; } @@ -123,7 +123,7 @@ if (program.eval || program.print) { args = args.slice(i); // make the filename absolute - let filename = args[0]; + const filename = args[0]; if (!pathIsAbsolute(filename)) args[0] = path.join(process.cwd(), filename); // add back on node and concat the sliced args diff --git a/packages/babel-cli/src/babel-node.js b/packages/babel-cli/src/babel-node.js index 0830a2313d..e3d0c2e901 100755 --- a/packages/babel-cli/src/babel-node.js +++ b/packages/babel-cli/src/babel-node.js @@ -5,8 +5,8 @@ * when found, before invoking the "real" _babel-node(1) executable. */ -let getV8Flags = require("v8flags"); -let path = require("path"); +const getV8Flags = require("v8flags"); +const path = require("path"); let args = [path.join(__dirname, "_babel-node")]; @@ -14,7 +14,7 @@ let babelArgs = process.argv.slice(2); let userArgs; // separate node arguments from script arguments -let argSeparator = babelArgs.indexOf("--"); +const argSeparator = babelArgs.indexOf("--"); if (argSeparator > -1) { userArgs = babelArgs.slice(argSeparator); // including the -- babelArgs = babelArgs.slice(0, argSeparator); @@ -75,13 +75,13 @@ getV8Flags(function (err, v8Flags) { } try { - let kexec = require("kexec"); + const kexec = require("kexec"); kexec(process.argv[0], args); } catch (err) { if (err.code !== "MODULE_NOT_FOUND") throw err; - let child_process = require("child_process"); - let proc = child_process.spawn(process.argv[0], args, { stdio: "inherit" }); + const child_process = require("child_process"); + const proc = child_process.spawn(process.argv[0], args, { stdio: "inherit" }); proc.on("exit", function (code, signal) { process.on("exit", function () { if (signal) { diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 78be975c88..f097874a2a 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,18 +1,18 @@ -let outputFileSync = require("output-file-sync"); -let slash = require("slash"); -let path = require("path"); -let util = require("./util"); -let fs = require("fs"); -let _ = require("lodash"); +const outputFileSync = require("output-file-sync"); +const slash = require("slash"); +const path = require("path"); +const util = require("./util"); +const fs = require("fs"); +const _ = require("lodash"); module.exports = function (commander, filenames) { function write(src, relative) { // remove extension and then append back on .js relative = relative.replace(/\.(\w*?)$/, "") + ".js"; - let dest = path.join(commander.outDir, relative); + const dest = path.join(commander.outDir, relative); - let data = util.compile(src, { + const data = util.compile(src, { sourceFileName: slash(path.relative(dest + "/..", src)), sourceMapTarget: path.basename(relative) }); @@ -20,7 +20,7 @@ module.exports = function (commander, filenames) { // we've requested explicit sourcemaps to be written to disk if (data.map && commander.sourceMaps && commander.sourceMaps !== "inline") { - let mapLoc = dest + ".map"; + const mapLoc = dest + ".map"; data.code = util.addSourceMappingUrl(data.code, mapLoc); outputFileSync(mapLoc, JSON.stringify(data.map)); } @@ -37,7 +37,7 @@ module.exports = function (commander, filenames) { if (util.canCompile(filename, commander.extensions)) { write(src, filename); } else if (commander.copyFiles) { - let dest = path.join(commander.outDir, filename); + const dest = path.join(commander.outDir, filename); outputFileSync(dest, fs.readFileSync(src)); util.chmod(src, dest); } @@ -46,13 +46,13 @@ module.exports = function (commander, filenames) { function handle(filename) { if (!fs.existsSync(filename)) return; - let stat = fs.statSync(filename); + const stat = fs.statSync(filename); if (stat.isDirectory(filename)) { - let dirname = filename; + const dirname = filename; _.each(util.readdir(dirname), function (filename) { - let src = path.join(dirname, filename); + const src = path.join(dirname, filename); handleFile(src, filename); }); } else { @@ -65,17 +65,17 @@ module.exports = function (commander, filenames) { } if (commander.watch) { - let chokidar = util.requireChokidar(); + const chokidar = util.requireChokidar(); _.each(filenames, function (dirname) { - let watcher = chokidar.watch(dirname, { + const watcher = chokidar.watch(dirname, { persistent: true, ignoreInitial: true }); _.each(["add", "change"], function (type) { watcher.on(type, function (filename) { - let relative = path.relative(dirname, filename) || filename; + const relative = path.relative(dirname, filename) || filename; try { handleFile(filename, relative); } catch (err) { diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 1feb8d2aad..bb1f6e9494 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -1,10 +1,10 @@ -let convertSourceMap = require("convert-source-map"); -let sourceMap = require("source-map"); -let slash = require("slash"); -let path = require("path"); -let util = require("./util"); -let fs = require("fs"); -let _ = require("lodash"); +const convertSourceMap = require("convert-source-map"); +const sourceMap = require("source-map"); +const slash = require("slash"); +const path = require("path"); +const util = require("./util"); +const fs = require("fs"); +const _ = require("lodash"); module.exports = function (commander, filenames, opts) { if (commander.sourceMaps === "inline") { @@ -13,8 +13,8 @@ module.exports = function (commander, filenames, opts) { let results = []; - let buildResult = function () { - let map = new sourceMap.SourceMapGenerator({ + const buildResult = function () { + const map = new sourceMap.SourceMapGenerator({ file: path.basename(commander.outFile || "") || "stdout", sourceRoot: opts.sourceRoot }); @@ -26,8 +26,8 @@ module.exports = function (commander, filenames, opts) { code += result.code + "\n"; if (result.map) { - let consumer = new sourceMap.SourceMapConsumer(result.map); - let sources = new Set(); + const consumer = new sourceMap.SourceMapConsumer(result.map); + const sources = new Set(); consumer.eachMapping(function (mapping) { if (mapping.source != null) sources.add(mapping.source); @@ -46,7 +46,7 @@ module.exports = function (commander, filenames, opts) { }); sources.forEach((source) => { - let content = consumer.sourceContentFor(source, true); + const content = consumer.sourceContentFor(source, true); if (content !== null) { map.setSourceContent(source, content); } @@ -68,13 +68,13 @@ module.exports = function (commander, filenames, opts) { }; }; - let output = function () { - let result = buildResult(); + const output = function () { + const result = buildResult(); if (commander.outFile) { // we've requested for a sourcemap to be written to disk if (commander.sourceMaps && commander.sourceMaps !== "inline") { - let mapLoc = commander.outFile + ".map"; + const mapLoc = commander.outFile + ".map"; result.code = util.addSourceMappingUrl(result.code, mapLoc); fs.writeFileSync(mapLoc, JSON.stringify(result.map)); } @@ -85,13 +85,13 @@ module.exports = function (commander, filenames, opts) { } }; - let stdin = function () { + const stdin = function () { let code = ""; process.stdin.setEncoding("utf8"); process.stdin.on("readable", function () { - let chunk = process.stdin.read(); + const chunk = process.stdin.read(); if (chunk !== null) code += chunk; }); @@ -103,16 +103,16 @@ module.exports = function (commander, filenames, opts) { }); }; - let walk = function () { - let _filenames = []; + const walk = function () { + const _filenames = []; results = []; _.each(filenames, function (filename) { if (!fs.existsSync(filename)) return; - let stat = fs.statSync(filename); + const stat = fs.statSync(filename); if (stat.isDirectory()) { - let dirname = filename; + const dirname = filename; _.each(util.readdirFilter(filename), function (filename) { _filenames.push(path.join(dirname, filename)); @@ -131,7 +131,7 @@ module.exports = function (commander, filenames, opts) { } sourceFilename = slash(sourceFilename); - let data = util.compile(filename, { + const data = util.compile(filename, { sourceFileName: sourceFilename, }); @@ -142,14 +142,14 @@ module.exports = function (commander, filenames, opts) { output(); }; - let files = function () { + const files = function () { if (!commander.skipInitialBuild) { walk(); } if (commander.watch) { - let chokidar = util.requireChokidar(); + const chokidar = util.requireChokidar(); chokidar.watch(filenames, { persistent: true, ignoreInitial: true diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 236c2df72a..0e1472d953 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -3,14 +3,14 @@ require("babel-core"); -let fs = require("fs"); -let commander = require("commander"); -let kebabCase = require("lodash/kebabCase"); -let options = require("babel-core").options; -let util = require("babel-core").util; -let uniq = require("lodash/uniq"); -let each = require("lodash/each"); -let glob = require("glob"); +const fs = require("fs"); +const commander = require("commander"); +const kebabCase = require("lodash/kebabCase"); +const options = require("babel-core").options; +const util = require("babel-core").util; +const uniq = require("lodash/uniq"); +const each = require("lodash/each"); +const glob = require("glob"); each(options, function (option, key) { if (option.hidden) return; @@ -31,7 +31,7 @@ each(options, function (option, key) { arg = "-" + option.shorthand + ", " + arg; } - let desc = []; + const desc = []; if (option.deprecated) desc.push("[DEPRECATED] " + option.deprecated); if (option.description) desc.push(option.description); @@ -46,7 +46,7 @@ commander.option("-d, --out-dir [out]", "Compile an input directory of modules i commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files"); commander.option("-q, --quiet", "Don't log anything"); -let pkg = require("../../package.json"); +const pkg = require("../../package.json"); commander.version(pkg.version + " (babel-core " + require("babel-core").version + ")"); commander.usage("[options] "); commander.parse(process.argv); @@ -59,7 +59,7 @@ if (commander.extensions) { // -let errors = []; +const errors = []; let filenames = commander.args.reduce(function (globbed, input) { let files = glob.sync(input); @@ -104,7 +104,7 @@ if (errors.length) { // -let opts = exports.opts = {}; +const opts = exports.opts = {}; each(options, function (opt, key) { if (commander[key] !== undefined && commander[key] !== opt.default) { diff --git a/packages/babel-cli/src/babel/util.js b/packages/babel-cli/src/babel/util.js index fd06aa6ce7..df8c72b3aa 100644 --- a/packages/babel-cli/src/babel/util.js +++ b/packages/babel-cli/src/babel/util.js @@ -1,11 +1,11 @@ -let commander = require("commander"); -let readdir = require("fs-readdir-recursive"); -let index = require("./index"); -let babel = require("babel-core"); -let util = require("babel-core").util; -let path = require("path"); -let fs = require("fs"); -let _ = require("lodash"); +const commander = require("commander"); +const readdir = require("fs-readdir-recursive"); +const index = require("./index"); +const babel = require("babel-core"); +const util = require("babel-core").util; +const path = require("path"); +const fs = require("fs"); +const _ = require("lodash"); export function chmod(src, dest) { fs.chmodSync(dest, fs.statSync(src).mode); @@ -19,7 +19,7 @@ export function readdirFilter(filename) { export { readdir }; -export let canCompile = util.canCompile; +export const canCompile = util.canCompile; export function shouldIgnore(loc) { return util.shouldIgnore(loc, index.opts.ignore, index.opts.only); @@ -37,7 +37,7 @@ export function transform(filename, code, opts) { opts = _.defaults(opts || {}, index.opts); opts.filename = filename; - let result = babel.transform(code, opts); + const result = babel.transform(code, opts); result.filename = filename; result.actual = code; return result; @@ -45,7 +45,7 @@ export function transform(filename, code, opts) { export function compile(filename, opts) { try { - let code = fs.readFileSync(filename, "utf8"); + const code = fs.readFileSync(filename, "utf8"); return transform(filename, code, opts); } catch (err) { if (commander.watch) { diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 61cb19aed9..9a5d9f0594 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,29 +1,29 @@ -let readdir = require("fs-readdir-recursive"); -let helper = require("babel-helper-fixtures"); -let assert = require("assert"); -let rimraf = require("rimraf"); -let outputFileSync = require("output-file-sync"); -let child = require("child_process"); -let path = require("path"); -let chai = require("chai"); -let fs = require("fs"); -let _ = require("lodash"); +const readdir = require("fs-readdir-recursive"); +const helper = require("babel-helper-fixtures"); +const assert = require("assert"); +const rimraf = require("rimraf"); +const outputFileSync = require("output-file-sync"); +const child = require("child_process"); +const path = require("path"); +const chai = require("chai"); +const fs = require("fs"); +const _ = require("lodash"); -let fixtureLoc = path.join(__dirname, "fixtures"); -let tmpLoc = path.join(__dirname, "tmp"); +const fixtureLoc = path.join(__dirname, "fixtures"); +const tmpLoc = path.join(__dirname, "tmp"); -let presetLocs = [ +const presetLocs = [ path.join(__dirname, "../../babel-preset-es2015"), path.join(__dirname, "../../babel-preset-react") ].join(","); -let pluginLocs = [ +const pluginLocs = [ path.join(__dirname, "/../../babel-plugin-transform-strict-mode"), path.join(__dirname, "/../../babel-plugin-transform-es2015-modules-commonjs"), ].join(","); -let readDir = function (loc) { - let files = {}; +const readDir = function (loc) { + const files = {}; if (fs.existsSync(loc)) { _.each(readdir(loc), function (filename) { files[filename] = helper.readFile(path.join(loc, filename)); @@ -32,14 +32,14 @@ let readDir = function (loc) { return files; }; -let saveInFiles = function (files) { +const saveInFiles = function (files) { _.each(files, function (content, filename) { outputFileSync(filename, content); }); }; -let assertTest = function (stdout, stderr, opts) { - let expectStderr = opts.stderr.trim(); +const assertTest = function (stdout, stderr, opts) { + const expectStderr = opts.stderr.trim(); stderr = stderr.trim(); if (opts.stderr) { @@ -52,7 +52,7 @@ let assertTest = function (stdout, stderr, opts) { throw new Error("stderr:\n" + stderr); } - let expectStdout = opts.stdout.trim(); + const expectStdout = opts.stdout.trim(); stdout = stdout.trim(); stdout = stdout.replace(/\\/g, "/"); @@ -67,13 +67,13 @@ let assertTest = function (stdout, stderr, opts) { } _.each(opts.outFiles, function (expect, filename) { - let actual = helper.readFile(filename); + const actual = helper.readFile(filename); chai.expect(actual).to.equal(expect, "out-file " + filename); }); }; -let buildTest = function (binName, testName, opts) { - let binLoc = path.join(__dirname, "../lib", binName); +const buildTest = function (binName, testName, opts) { + const binLoc = path.join(__dirname, "../lib", binName); return function (callback) { clear(); @@ -91,7 +91,7 @@ let buildTest = function (binName, testName, opts) { args = args.concat(opts.args); - let spawn = child.spawn(process.execPath, args); + const spawn = child.spawn(process.execPath, args); let stderr = ""; let stdout = ""; @@ -127,7 +127,7 @@ let buildTest = function (binName, testName, opts) { }; }; -let clear = function () { +const clear = function () { process.chdir(__dirname); if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc); fs.mkdirSync(tmpLoc); @@ -137,22 +137,22 @@ let clear = function () { _.each(fs.readdirSync(fixtureLoc), function (binName) { if (binName[0] === ".") return; - let suiteLoc = path.join(fixtureLoc, binName); + const suiteLoc = path.join(fixtureLoc, binName); describe("bin/" + binName, function () { _.each(fs.readdirSync(suiteLoc), function (testName) { if (testName[0] === ".") return; - let testLoc = path.join(suiteLoc, testName); + const testLoc = path.join(suiteLoc, testName); - let opts = { + const opts = { args: [] }; - let optionsLoc = path.join(testLoc, "options.json"); + const optionsLoc = path.join(testLoc, "options.json"); if (fs.existsSync(optionsLoc)) _.merge(opts, require(optionsLoc)); _.each(["stdout", "stdin", "stderr"], function (key) { - let loc = path.join(testLoc, key + ".txt"); + const loc = path.join(testLoc, key + ".txt"); if (fs.existsSync(loc)) { opts[key] = helper.readFile(loc); } else { @@ -163,7 +163,7 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { opts.outFiles = readDir(path.join(testLoc, "out-files")); opts.inFiles = readDir(path.join(testLoc, "in-files")); - let babelrcLoc = path.join(testLoc, ".babelrc"); + const babelrcLoc = path.join(testLoc, ".babelrc"); if (fs.existsSync(babelrcLoc)) { // copy .babelrc file to tmp directory opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc); diff --git a/packages/babel-code-frame/src/index.js b/packages/babel-code-frame/src/index.js index 1e570ab692..9476ef617d 100644 --- a/packages/babel-code-frame/src/index.js +++ b/packages/babel-code-frame/src/index.js @@ -46,8 +46,8 @@ const BRACKET = /^[()\[\]{}]$/; */ function getTokenType(match) { - let [offset, text] = match.slice(-2); - let token = matchToToken(match); + const [offset, text] = match.slice(-2); + const token = matchToToken(match); if (token.type === "name") { if (esutils.keyword.isReservedWordES6(token.value)) { @@ -79,8 +79,8 @@ function getTokenType(match) { function highlight(defs: Object, text: string) { return text.replace(jsTokens, function (...args) { - let type = getTokenType(args); - let colorize = defs[type]; + const type = getTokenType(args); + const colorize = defs[type]; if (colorize) { return args[0].split(NEWLINE).map((str) => colorize(str)).join("\n"); } else { @@ -101,21 +101,21 @@ export default function ( ): string { colNumber = Math.max(colNumber, 0); - let highlighted = (opts.highlightCode && Chalk.supportsColor) || opts.forceColor; + const highlighted = (opts.highlightCode && Chalk.supportsColor) || opts.forceColor; let chalk = Chalk; if (opts.forceColor) { chalk = new Chalk.constructor({ enabled: true }); } - let maybeHighlight = (chalkFn, string) => { + const maybeHighlight = (chalkFn, string) => { return highlighted ? chalkFn(string) : string; }; - let defs = getDefs(chalk); + const defs = getDefs(chalk); if (highlighted) rawLines = highlight(defs, rawLines); - let linesAbove = opts.linesAbove || 2; - let linesBelow = opts.linesBelow || 3; + const linesAbove = opts.linesAbove || 2; + const linesBelow = opts.linesBelow || 3; - let lines = rawLines.split(NEWLINE); + const lines = rawLines.split(NEWLINE); let start = Math.max(lineNumber - (linesAbove + 1), 0); let end = Math.min(lines.length, lineNumber + linesBelow); @@ -124,16 +124,16 @@ export default function ( end = lines.length; } - let numberMaxWidth = String(end).length; + const numberMaxWidth = String(end).length; - let frame = lines.slice(start, end).map((line, index) => { - let number = start + 1 + index; - let paddedNumber = ` ${number}`.slice(-numberMaxWidth); - let gutter = ` ${paddedNumber} | `; + const frame = lines.slice(start, end).map((line, index) => { + const number = start + 1 + index; + const paddedNumber = ` ${number}`.slice(-numberMaxWidth); + const gutter = ` ${paddedNumber} | `; if (number === lineNumber) { let markerLine = ""; if (colNumber) { - let markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " "); + const markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " "); markerLine = [ "\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index c85d59ddec..b00b88386d 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -1,6 +1,6 @@ -let assert = require("assert"); -let chalk = require("chalk"); -let codeFrame = require(".."); +const assert = require("assert"); +const chalk = require("chalk"); +const codeFrame = require(".."); describe("babel-code-frame", function () { it("basic usage", function () { @@ -119,7 +119,7 @@ describe("babel-code-frame", function () { }); it("opts.linesAbove", function () { - let rawLines = [ + const rawLines = [ "/**", " * Sums two numbers.", " *", @@ -143,7 +143,7 @@ describe("babel-code-frame", function () { }); it("opts.linesBelow", function () { - let rawLines = [ + const rawLines = [ "/**", " * Sums two numbers.", " *", @@ -166,7 +166,7 @@ describe("babel-code-frame", function () { }); it("opts.linesAbove and opts.linesBelow", function () { - let rawLines = [ + const rawLines = [ "/**", " * Sums two numbers.", " *", @@ -188,10 +188,10 @@ describe("babel-code-frame", function () { }); it("opts.forceColor", function() { - let marker = chalk.red.bold; - let gutter = chalk.grey; + const marker = chalk.red.bold; + const gutter = chalk.grey; - let rawLines = [ + const rawLines = [ "", "", "", diff --git a/packages/babel-core/src/api/browser.js b/packages/babel-core/src/api/browser.js index 1c53951acf..d5d89f6b71 100644 --- a/packages/babel-core/src/api/browser.js +++ b/packages/babel-core/src/api/browser.js @@ -29,16 +29,16 @@ export function run(code: string, opts: Object = {}): any { export function load(url: string, callback: Function, opts: Object = {}, hold?: boolean) { opts.filename = opts.filename || url; - let xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); + const xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); xhr.open("GET", url, true); if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain"); xhr.onreadystatechange = function () { if (xhr.readyState !== 4) return; - let status = xhr.status; + const status = xhr.status; if (status === 0 || status === 200) { - let param = [xhr.responseText, opts]; + const param = [xhr.responseText, opts]; if (!hold) run(param); if (callback) callback(param); } else { @@ -50,8 +50,8 @@ export function load(url: string, callback: Function, opts: Object = {}, hold?: } function runScripts() { - let scripts: Array | Object> = []; - let types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; + const scripts: Array | Object> = []; + const types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; let index = 0; /** @@ -59,7 +59,7 @@ function runScripts() { */ function exec() { - let param = scripts[index]; + const param = scripts[index]; if (param instanceof Array) { run(param, index); index++; @@ -72,7 +72,7 @@ function runScripts() { */ function run(script: Object, i: number) { - let opts = {}; + const opts = {}; if (script.src) { load(script.src, function (param) { @@ -87,10 +87,10 @@ function runScripts() { // Collect scripts with Babel `types`. - let _scripts = global.document.getElementsByTagName("script"); + const _scripts = global.document.getElementsByTagName("script"); for (let i = 0; i < _scripts.length; ++i) { - let _script = _scripts[i]; + const _script = _scripts[i]; if (types.indexOf(_script.type) >= 0) scripts.push(_script); } diff --git a/packages/babel-core/src/api/node.js b/packages/babel-core/src/api/node.js index a9e4792465..de1cfea682 100644 --- a/packages/babel-core/src/api/node.js +++ b/packages/babel-core/src/api/node.js @@ -31,10 +31,10 @@ export function Plugin(alias) { import Pipeline from "../transformation/pipeline"; export { Pipeline }; -let pipeline = new Pipeline; -export let analyse = pipeline.analyse.bind(pipeline); -export let transform = pipeline.transform.bind(pipeline); -export let transformFromAst = pipeline.transformFromAst.bind(pipeline); +const pipeline = new Pipeline; +export const analyse = pipeline.analyse.bind(pipeline); +export const transform = pipeline.transform.bind(pipeline); +export const transformFromAst = pipeline.transformFromAst.bind(pipeline); export function transformFile(filename: string, opts?: Object, callback: Function) { if (isFunction(opts)) { diff --git a/packages/babel-core/src/helpers/get-possible-preset-names.js b/packages/babel-core/src/helpers/get-possible-preset-names.js index b9fb1726bd..a2140b9887 100644 --- a/packages/babel-core/src/helpers/get-possible-preset-names.js +++ b/packages/babel-core/src/helpers/get-possible-preset-names.js @@ -1,11 +1,11 @@ export default function getPossiblePresetNames(presetName: string): Array { - let possibleNames = [`babel-preset-${presetName}`, presetName]; + const possibleNames = [`babel-preset-${presetName}`, presetName]; // trying to resolve @organization shortcat // @foo/es2015 -> @foo/babel-preset-es2015 - let matches = presetName.match(/^(@[^/]+)\/(.+)$/); + const matches = presetName.match(/^(@[^/]+)\/(.+)$/); if (matches) { - let [, orgName, presetPath] = matches; + const [, orgName, presetPath] = matches; possibleNames.push(`${orgName}/babel-preset-${presetPath}`); } diff --git a/packages/babel-core/src/helpers/merge.js b/packages/babel-core/src/helpers/merge.js index 5a695f6afa..1a01e22889 100644 --- a/packages/babel-core/src/helpers/merge.js +++ b/packages/babel-core/src/helpers/merge.js @@ -5,9 +5,9 @@ export default function (dest?: Object, src?: Object): ?Object { return mergeWith(dest, src, function (a, b) { if (b && Array.isArray(a)) { - let newArray = b.slice(0); + const newArray = b.slice(0); - for (let item of a) { + for (const item of a) { if (newArray.indexOf(item) < 0) { newArray.push(item); } diff --git a/packages/babel-core/src/helpers/resolve.js b/packages/babel-core/src/helpers/resolve.js index 623a910cbf..e8493ac8f5 100644 --- a/packages/babel-core/src/helpers/resolve.js +++ b/packages/babel-core/src/helpers/resolve.js @@ -1,7 +1,7 @@ import Module from "module"; import path from "path"; -let relativeModules = {}; +const relativeModules = {}; export default function (loc: string, relative: string = process.cwd()): ?string { // we're in the browser, probably @@ -18,7 +18,7 @@ export default function (loc: string, relative: string = process.cwd()): ?string // Node presumes "." is process.cwd(), not our relative path. // Since this fake module is never "loaded", we don't have to worry about mutating // any global Node module cache state here. - let filename = path.join(relative, ".babelrc"); + const filename = path.join(relative, ".babelrc"); relativeMod.id = filename; relativeMod.filename = filename; diff --git a/packages/babel-core/src/store.js b/packages/babel-core/src/store.js index fab3d10f34..1b172efbe0 100644 --- a/packages/babel-core/src/store.js +++ b/packages/babel-core/src/store.js @@ -15,7 +15,7 @@ export default class Store extends Map { return super.get(key); } else { if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) { - let val = this.dynamicData[key](); + const val = this.dynamicData[key](); this.set(key, val); return val; } diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index a26febd34b..237daf532c 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -7,7 +7,7 @@ import template from "babel-template"; import each from "lodash/each"; import * as t from "babel-types"; -let buildUmdWrapper = template(` +const buildUmdWrapper = template(` (function (root, factory) { if (typeof define === "function" && define.amd) { define(AMD_ARGUMENTS, factory); @@ -22,9 +22,9 @@ let buildUmdWrapper = template(` `); function buildGlobal(namespace, builder) { - let body = []; - let container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); - let tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); + const body = []; + const container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); + const tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); body.push(t.variableDeclaration("var", [ t.variableDeclarator( @@ -39,7 +39,7 @@ function buildGlobal(namespace, builder) { } function buildUmd(namespace, builder) { - let body = []; + const body = []; body.push(t.variableDeclaration("var", [ t.variableDeclarator(namespace, t.identifier("global")) ])); @@ -63,7 +63,7 @@ function buildUmd(namespace, builder) { } function buildVar(namespace, builder) { - let body = []; + const body = []; body.push(t.variableDeclaration("var", [ t.variableDeclarator(namespace, t.objectExpression([])) ])); @@ -76,7 +76,7 @@ function buildHelpers(body, namespace, whitelist) { each(helpers.list, function (name) { if (whitelist && whitelist.indexOf(name) < 0) return; - let key = t.identifier(name); + const key = t.identifier(name); body.push(t.expressionStatement( t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name)) )); @@ -86,15 +86,15 @@ export default function ( whitelist?: Array, outputType: "global" | "umd" | "var" = "global", ) { - let namespace = t.identifier("babelHelpers"); + const namespace = t.identifier("babelHelpers"); - let builder = function (body) { + const builder = function (body) { return buildHelpers(body, namespace, whitelist); }; let tree; - let build = { + const build = { global: buildGlobal, umd: buildUmd, var: buildVar, diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 01d5b7efc9..a013eb5d6a 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -32,9 +32,9 @@ const INTERNAL_PLUGINS = [ [shadowFunctionsPlugin] ]; -let errorVisitor = { +const errorVisitor = { enter(path, state) { - let loc = path.node.loc; + const loc = path.node.loc; if (loc) { state.loc = loc; path.stop(); @@ -69,7 +69,7 @@ export default class File extends Store { // All the "per preset" options are inherited from the main options. this.perPresetOpts = []; this.opts.presets.forEach((presetOpts) => { - let perPresetOpts = Object.assign(Object.create(this.opts), presetOpts); + const perPresetOpts = Object.assign(Object.create(this.opts), presetOpts); this.perPresetOpts.push(perPresetOpts); this.buildPluginsForOptions(perPresetOpts); }); @@ -125,7 +125,7 @@ export default class File extends Store { getMetadata() { let has = false; - for (let node of (this.ast.program.body: Array)) { + for (const node of (this.ast.program.body: Array)) { if (t.isModuleDeclaration(node)) { has = true; break; @@ -165,7 +165,7 @@ export default class File extends Store { filenameRelative: opts.filename }); - let basenameRelative = path.basename(opts.filenameRelative); + const basenameRelative = path.basename(opts.filenameRelative); defaults(opts, { sourceFileName: basenameRelative, @@ -180,13 +180,13 @@ export default class File extends Store { return; } - let plugins: Array<[PluginPass, Object]> = opts.plugins.concat(INTERNAL_PLUGINS); - let currentPluginVisitors = []; - let currentPluginPasses = []; + const plugins: Array<[PluginPass, Object]> = opts.plugins.concat(INTERNAL_PLUGINS); + const currentPluginVisitors = []; + const currentPluginPasses = []; // init plugins! - for (let ref of plugins) { - let [plugin, pluginOpts] = ref; // todo: fix - can't embed in loop head because of flow bug + for (const ref of plugins) { + const [plugin, pluginOpts] = ref; // todo: fix - can't embed in loop head because of flow bug currentPluginVisitors.push(plugin.visitor); currentPluginPasses.push(new PluginPass(this, plugin, pluginOpts)); @@ -201,7 +201,7 @@ export default class File extends Store { } getModuleName(): ?string { - let opts = this.opts; + const opts = this.opts; if (!opts.moduleIds) { return null; } @@ -224,7 +224,7 @@ export default class File extends Store { if (opts.sourceRoot != null) { // remove sourceRoot from filename - let sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); + const sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?"); filenameRelative = filenameRelative.replace(sourceRootRegEx, ""); } @@ -245,20 +245,20 @@ export default class File extends Store { } resolveModuleSource(source: string): string { - let resolveModuleSource = this.opts.resolveModuleSource; + const resolveModuleSource = this.opts.resolveModuleSource; if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename); return source; } addImport(source: string, imported: string, name?: string = imported): Object { - let alias = `${source}:${imported}`; + const alias = `${source}:${imported}`; let id = this.dynamicImportIds[alias]; if (!id) { source = this.resolveModuleSource(source); id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name); - let specifiers = []; + const specifiers = []; if (imported === "*") { specifiers.push(t.importNamespaceSpecifier(id)); @@ -268,7 +268,7 @@ export default class File extends Store { specifiers.push(t.importSpecifier(id, t.identifier(imported))); } - let declar = t.importDeclaration(specifiers, t.stringLiteral(source)); + const declar = t.importDeclaration(specifiers, t.stringLiteral(source)); declar._blockHoist = 3; this.path.unshiftContainer("body", declar); @@ -278,7 +278,7 @@ export default class File extends Store { } addHelper(name: string): Object { - let declar = this.declarations[name]; + const declar = this.declarations[name]; if (declar) return declar; if (!this.usedHelpers[name]) { @@ -286,17 +286,17 @@ export default class File extends Store { this.usedHelpers[name] = true; } - let generator = this.get("helperGenerator"); - let runtime = this.get("helpersNamespace"); + const generator = this.get("helperGenerator"); + const runtime = this.get("helpersNamespace"); if (generator) { - let res = generator(name); + const res = generator(name); if (res) return res; } else if (runtime) { return t.memberExpression(runtime, t.identifier(name)); } - let ref = getHelper(name); - let uid = this.declarations[name] = this.scope.generateUidIdentifier(name); + const ref = getHelper(name); + const uid = this.declarations[name] = this.scope.generateUidIdentifier(name); if (t.isFunctionExpression(ref) && !ref.id) { ref.body._compact = true; @@ -323,18 +323,18 @@ export default class File extends Store { ): Object { // Generate a unique name based on the string literals so we dedupe // identical strings used in the program. - let stringIds = raw.elements.map(function(string) { + const stringIds = raw.elements.map(function(string) { return string.value; }); - let name = `${helperName}_${raw.elements.length}_${stringIds.join(",")}`; + const name = `${helperName}_${raw.elements.length}_${stringIds.join(",")}`; - let declar = this.declarations[name]; + const declar = this.declarations[name]; if (declar) return declar; - let uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); + const uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject"); - let helperId = this.addHelper(helperName); - let init = t.callExpression(helperId, [strings, raw]); + const helperId = this.addHelper(helperName); + const init = t.callExpression(helperId, [strings, raw]); init._compact = true; this.scope.push({ id: uid, @@ -345,9 +345,9 @@ export default class File extends Store { } buildCodeFrameError(node: Object, msg: string, Error: typeof Error = SyntaxError): Error { - let loc = node && (node.loc || node._loc); + const loc = node && (node.loc || node._loc); - let err = new Error(msg); + const err = new Error(msg); if (loc) { err.loc = loc.start; @@ -367,13 +367,13 @@ export default class File extends Store { } mergeSourceMap(map: Object) { - let inputMap = this.opts.inputSourceMap; + const inputMap = this.opts.inputSourceMap; if (inputMap) { - let inputMapConsumer = new sourceMap.SourceMapConsumer(inputMap); - let outputMapConsumer = new sourceMap.SourceMapConsumer(map); + const inputMapConsumer = new sourceMap.SourceMapConsumer(inputMap); + const outputMapConsumer = new sourceMap.SourceMapConsumer(map); - let mergedGenerator = new sourceMap.SourceMapGenerator({ + const mergedGenerator = new sourceMap.SourceMapGenerator({ file: inputMapConsumer.file, sourceRoot: inputMapConsumer.sourceRoot }); @@ -402,7 +402,7 @@ export default class File extends Store { } }); - let mergedMap = mergedGenerator.toJSON(); + const mergedMap = mergedGenerator.toJSON(); inputMap.mappings = mergedMap.mappings; return inputMap; } else { @@ -419,8 +419,8 @@ export default class File extends Store { if (parserOpts.parser) { if (typeof parserOpts.parser === "string") { - let dirname = path.dirname(this.opts.filename) || process.cwd(); - let parser = resolve(parserOpts.parser, dirname); + const dirname = path.dirname(this.opts.filename) || process.cwd(); + const parser = resolve(parserOpts.parser, dirname); if (parser) { parseCode = require(parser).parse; } else { @@ -439,7 +439,7 @@ export default class File extends Store { } this.log.debug("Parse start"); - let ast = parseCode(code, parserOpts || this.parserOpts); + const ast = parseCode(code, parserOpts || this.parserOpts); this.log.debug("Parse stop"); return ast; } @@ -472,7 +472,7 @@ export default class File extends Store { this.log.debug("Start transform traverse"); // merge all plugin visitors into a single visitor - let visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod); + const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod); traverse(this.ast, visitor, this.scope); this.log.debug("End transform traverse"); @@ -500,7 +500,7 @@ export default class File extends Store { let message = err.message = `${this.opts.filename}: ${err.message}`; - let loc = err.loc; + const loc = err.loc; if (loc) { err.codeFrame = codeFrame(code, loc.line, loc.column + 1, this.opts); message += "\n" + err.codeFrame; @@ -513,7 +513,7 @@ export default class File extends Store { } if (err.stack) { - let newStack = err.stack.replace(err.message, message); + const newStack = err.stack.replace(err.message, message); err.stack = newStack; } @@ -529,28 +529,28 @@ export default class File extends Store { parseCode() { this.parseShebang(); - let ast = this.parse(this.code); + const ast = this.parse(this.code); this.addAst(ast); } shouldIgnore() { - let opts = this.opts; + const opts = this.opts; return util.shouldIgnore(opts.filename, opts.ignore, opts.only); } call(key: "pre" | "post", pluginPasses: Array) { - for (let pass of pluginPasses) { - let plugin = pass.plugin; - let fn = plugin[key]; + for (const pass of pluginPasses) { + const plugin = pass.plugin; + const fn = plugin[key]; if (fn) fn.call(pass, this); } } parseInputSourceMap(code: string): string { - let opts = this.opts; + const opts = this.opts; if (opts.inputSourceMap !== false) { - let inputMap = convertSourceMap.fromSource(code); + const inputMap = convertSourceMap.fromSource(code); if (inputMap) { opts.inputSourceMap = inputMap.toObject(); code = convertSourceMap.removeComments(code); @@ -561,7 +561,7 @@ export default class File extends Store { } parseShebang() { - let shebangMatch = shebangRegex.exec(this.code); + const shebangMatch = shebangRegex.exec(this.code); if (shebangMatch) { this.shebang = shebangMatch[0]; this.code = this.code.replace(shebangRegex, ""); @@ -569,7 +569,7 @@ export default class File extends Store { } makeResult({ code, map, ast, ignored }: BabelFileResult): BabelFileResult { - let result = { + const result = { metadata: null, options: this.opts, ignored: !!ignored, @@ -594,10 +594,10 @@ export default class File extends Store { } generate(): BabelFileResult { - let opts = this.opts; - let ast = this.ast; + const opts = this.opts; + const ast = this.ast; - let result: BabelFileResult = { ast }; + const result: BabelFileResult = { ast }; if (!opts.code) return this.makeResult(result); let gen = generate; @@ -605,8 +605,8 @@ export default class File extends Store { gen = opts.generatorOpts.generator; if (typeof gen === "string") { - let dirname = path.dirname(this.opts.filename) || process.cwd(); - let generator = resolve(gen, dirname); + const dirname = path.dirname(this.opts.filename) || process.cwd(); + const generator = resolve(gen, dirname); if (generator) { gen = require(generator).print; } else { @@ -617,7 +617,7 @@ export default class File extends Store { this.log.debug("Generation start"); - let _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, this.code); + const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, this.code); result.code = _result.code; result.map = _result.map; diff --git a/packages/babel-core/src/transformation/file/logger.js b/packages/babel-core/src/transformation/file/logger.js index 3573c968e4..31bf92ac62 100644 --- a/packages/babel-core/src/transformation/file/logger.js +++ b/packages/babel-core/src/transformation/file/logger.js @@ -1,10 +1,10 @@ import type File from "./index"; import buildDebug from "debug/node"; -let verboseDebug = buildDebug("babel:verbose"); -let generalDebug = buildDebug("babel"); +const verboseDebug = buildDebug("babel:verbose"); +const generalDebug = buildDebug("babel"); -let seenDeprecatedMessages = []; +const seenDeprecatedMessages = []; export default class Logger { constructor(file: File, filename: string) { diff --git a/packages/babel-core/src/transformation/file/metadata.js b/packages/babel-core/src/transformation/file/metadata.js index 0183006ffb..83b3580819 100644 --- a/packages/babel-core/src/transformation/file/metadata.js +++ b/packages/babel-core/src/transformation/file/metadata.js @@ -1,28 +1,28 @@ import * as t from "babel-types"; -export let ModuleDeclaration = { +export const ModuleDeclaration = { enter(path, file) { - let { node } = path; + const { node } = path; if (node.source) { node.source.value = file.resolveModuleSource(node.source.value); } } }; -export let ImportDeclaration = { +export const ImportDeclaration = { exit(path, file) { - let { node } = path; + const { node } = path; - let specifiers = []; - let imported = []; + const specifiers = []; + const imported = []; file.metadata.modules.imports.push({ source: node.source.value, imported, specifiers }); - for (let specifier of (path.get("specifiers"): Array)) { - let local = specifier.node.local.name; + for (const specifier of (path.get("specifiers"): Array)) { + const local = specifier.node.local.name; if (specifier.isImportDefaultSpecifier()) { imported.push("default"); @@ -34,7 +34,7 @@ export let ImportDeclaration = { } if (specifier.isImportSpecifier()) { - let importedName = specifier.node.imported.name; + const importedName = specifier.node.imported.name; imported.push(importedName); specifiers.push({ kind: "named", @@ -55,18 +55,18 @@ export let ImportDeclaration = { }; export function ExportDeclaration(path, file) { - let { node } = path; + const { node } = path; - let source = node.source ? node.source.value : null; - let exports = file.metadata.modules.exports; + const source = node.source ? node.source.value : null; + const exports = file.metadata.modules.exports; // export function foo() {} // export let foo = "bar"; - let declar = path.get("declaration"); + const declar = path.get("declaration"); if (declar.isStatement()) { - let bindings = declar.getBindingIdentifiers(); + const bindings = declar.getBindingIdentifiers(); - for (let name in bindings) { + for (const name in bindings) { exports.exported.push(name); exports.specifiers.push({ kind: "local", @@ -77,8 +77,8 @@ export function ExportDeclaration(path, file) { } if (path.isExportNamedDeclaration() && node.specifiers) { - for (let specifier of (node.specifiers: Array)) { - let exported = specifier.exported.name; + for (const specifier of (node.specifiers: Array)) { + const exported = specifier.exported.name; exports.exported.push(exported); // export foo from "bar"; @@ -100,7 +100,7 @@ export function ExportDeclaration(path, file) { }); } - let local = specifier.local; + const local = specifier.local; if (!local) continue; // export { foo } from "bar"; diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index 02ce737641..f546f45b32 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -6,15 +6,15 @@ import isAbsolute from "path-is-absolute"; import path from "path"; import fs from "fs"; -let existsCache = {}; -let jsonCache = {}; +const existsCache = {}; +const jsonCache = {}; const BABELIGNORE_FILENAME = ".babelignore"; const BABELRC_FILENAME = ".babelrc"; const PACKAGE_FILENAME = "package.json"; function exists(filename) { - let cached = existsCache[filename]; + const cached = existsCache[filename]; if (cached == null) { return existsCache[filename] = fs.existsSync(filename); } else { @@ -23,8 +23,8 @@ function exists(filename) { } export default function buildConfigChain(opts: Object = {}, log?: Logger) { - let filename = opts.filename; - let builder = new ConfigChainBuilder(log); + const filename = opts.filename; + const builder = new ConfigChainBuilder(log); // resolve all .babelrc files if (opts.babelrc !== false) { @@ -59,20 +59,20 @@ class ConfigChainBuilder { while (loc !== (loc = path.dirname(loc))) { if (!foundConfig) { - let configLoc = path.join(loc, BABELRC_FILENAME); + const configLoc = path.join(loc, BABELRC_FILENAME); if (exists(configLoc)) { this.addConfig(configLoc); foundConfig = true; } - let pkgLoc = path.join(loc, PACKAGE_FILENAME); + const pkgLoc = path.join(loc, PACKAGE_FILENAME); if (!foundConfig && exists(pkgLoc)) { foundConfig = this.addConfig(pkgLoc, "babel", JSON); } } if (!foundIgnore) { - let ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); + const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME); if (exists(ignoreLoc)) { this.addIgnoreConfig(ignoreLoc); foundIgnore = true; @@ -84,7 +84,7 @@ class ConfigChainBuilder { } addIgnoreConfig(loc) { - let file = fs.readFileSync(loc, "utf8"); + const file = fs.readFileSync(loc, "utf8"); let lines = file.split("\n"); lines = lines @@ -107,7 +107,7 @@ class ConfigChainBuilder { this.resolvedConfigs.push(loc); - let content = fs.readFileSync(loc, "utf8"); + const content = fs.readFileSync(loc, "utf8"); let options; try { @@ -144,7 +144,7 @@ class ConfigChainBuilder { // add extends clause if (options.extends) { - let extendsLoc = resolve(options.extends, dirname); + const extendsLoc = resolve(options.extends, dirname); if (extendsLoc) { this.addConfig(extendsLoc); } else { @@ -162,7 +162,7 @@ class ConfigChainBuilder { // env let envOpts; - let envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; + const envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development"; if (options.env) { envOpts = options.env[envKey]; delete options.env; diff --git a/packages/babel-core/src/transformation/file/options/index.js b/packages/babel-core/src/transformation/file/options/index.js index 69792cc65e..c5f8a73c51 100644 --- a/packages/babel-core/src/transformation/file/options/index.js +++ b/packages/babel-core/src/transformation/file/options/index.js @@ -4,7 +4,7 @@ import config from "./config"; export { config }; export function normaliseOptions(options: Object = {}): Object { - for (let key in options) { + for (const key in options) { let val = options[key]; if (val == null) continue; @@ -12,7 +12,7 @@ export function normaliseOptions(options: Object = {}): Object { if (opt && opt.alias) opt = config[opt.alias]; if (!opt) continue; - let parser = parsers[opt.type]; + const parser = parsers[opt.type]; if (parser) val = parser(val); options[key] = val; diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index ed0eab6a48..c4736355a6 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -53,7 +53,7 @@ export default class OptionManager { }>; static memoisePluginContainer(fn, loc, i, alias) { - for (let cache of (OptionManager.memoisedPlugins: Array)) { + for (const cache of (OptionManager.memoisedPlugins: Array)) { if (cache.container === fn) return cache.plugin; } @@ -66,7 +66,7 @@ export default class OptionManager { } if (typeof obj === "object") { - let plugin = new Plugin(obj, alias); + const plugin = new Plugin(obj, alias); OptionManager.memoisedPlugins.push({ container: fn, plugin: plugin @@ -78,10 +78,10 @@ export default class OptionManager { } static createBareOptions() { - let opts = {}; + const opts = {}; - for (let key in config) { - let opt = config[key]; + for (const key in config) { + const opt = config[key]; opts[key] = clone(opt.default); } @@ -120,11 +120,11 @@ export default class OptionManager { plugin = val; } - let alias = typeof plugin === "string" ? plugin : `${loc}$${i}`; + const alias = typeof plugin === "string" ? plugin : `${loc}$${i}`; // allow plugins to be specified as strings if (typeof plugin === "string") { - let pluginLoc = resolvePlugin(plugin, dirname); + const pluginLoc = resolvePlugin(plugin, dirname); if (pluginLoc) { plugin = require(pluginLoc); } else { @@ -164,7 +164,7 @@ export default class OptionManager { } // - let opts = cloneDeepWith(rawOpts, (val) => { + const opts = cloneDeepWith(rawOpts, (val) => { if (val instanceof Plugin) { return val; } @@ -174,16 +174,16 @@ export default class OptionManager { dirname = dirname || process.cwd(); loc = loc || alias; - for (let key in opts) { - let option = config[key]; + for (const key in opts) { + const option = config[key]; // check for an unknown option if (!option && this.log) { if (removed[key]) { this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, ReferenceError); } else { - let unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; - let presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; + const unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; + const presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; this.log.error(`${unknownOptErr}\n\n${presetConfigErr}`, ReferenceError); } @@ -316,11 +316,11 @@ export default class OptionManager { } normaliseOptions() { - let opts = this.options; + const opts = this.options; - for (let key in config) { - let option = config[key]; - let val = opts[key]; + for (const key in config) { + const option = config[key]; + const val = opts[key]; // optional if (!val && option.optional) continue; @@ -335,7 +335,7 @@ export default class OptionManager { } init(opts: Object = {}): Object { - for (let config of buildConfigChain(opts, this.log)) { + for (const config of buildConfigChain(opts, this.log)) { this.mergeOptions(config); } diff --git a/packages/babel-core/src/transformation/file/options/parsers.js b/packages/babel-core/src/transformation/file/options/parsers.js index fa8dbae260..2dcf5b7a71 100644 --- a/packages/babel-core/src/transformation/file/options/parsers.js +++ b/packages/babel-core/src/transformation/file/options/parsers.js @@ -1,7 +1,7 @@ import slash from "slash"; import * as util from "../../../util"; -export let filename = slash; +export const filename = slash; export function boolean(val: any): boolean { return !!val; diff --git a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js index de8bedf5bb..d546b9abd5 100644 --- a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js +++ b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js @@ -20,7 +20,7 @@ export default new Plugin({ exit({ node }) { let hasChange = false; for (let i = 0; i < node.body.length; i++) { - let bodyNode = node.body[i]; + const bodyNode = node.body[i]; if (bodyNode && bodyNode._blockHoist != null) { hasChange = true; break; diff --git a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js index 572b9bb379..6b5995fc27 100644 --- a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js +++ b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js @@ -41,10 +41,10 @@ function shouldShadow(path, shadowPath) { function remap(path, key) { // ensure that we're shadowed - let shadowPath = path.inShadow(key); + const shadowPath = path.inShadow(key); if (!shouldShadow(path, shadowPath)) return; - let shadowFunction = path.node._shadowedFunctionLiteral; + const shadowFunction = path.node._shadowedFunctionLiteral; let currentFunction; let passedShadowFunction = false; @@ -91,15 +91,15 @@ function remap(path, key) { // binding since arrow function syntax already does that. if (!passedShadowFunction) return; - let cached = fnPath.getData(key); + const cached = fnPath.getData(key); if (cached) return path.replaceWith(cached); - let id = path.scope.generateUidIdentifier(key); + const id = path.scope.generateUidIdentifier(key); fnPath.setData(key, id); - let classPath = fnPath.findParent((p) => p.isClass()); - let hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); + const classPath = fnPath.findParent((p) => p.isClass()); + const hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); if (key === "this" && fnPath.isMethod({kind: "constructor"}) && hasSuperClass) { fnPath.scope.push({ id }); diff --git a/packages/babel-core/src/transformation/pipeline.js b/packages/babel-core/src/transformation/pipeline.js index 12b1edbba3..15b3f0cffd 100644 --- a/packages/babel-core/src/transformation/pipeline.js +++ b/packages/babel-core/src/transformation/pipeline.js @@ -11,7 +11,7 @@ export default class Pipeline { } pretransform(code: string, opts?: Object): BabelFileResult { - let file = new File(opts, this); + const file = new File(opts, this); return file.wrap(code, function () { file.addCode(code); file.parseCode(code); @@ -20,7 +20,7 @@ export default class Pipeline { } transform(code: string, opts?: Object): BabelFileResult { - let file = new File(opts, this); + const file = new File(opts, this); return file.wrap(code, function () { file.addCode(code); file.parseCode(code); @@ -40,7 +40,7 @@ export default class Pipeline { transformFromAst(ast: Object, code: string, opts: Object): BabelFileResult { ast = normalizeAst(ast); - let file = new File(opts, this); + const file = new File(opts, this); return file.wrap(code, function () { file.addCode(code); file.addAst(ast); diff --git a/packages/babel-core/src/transformation/plugin.js b/packages/babel-core/src/transformation/plugin.js index afca4c882b..f3461ae9bf 100644 --- a/packages/babel-core/src/transformation/plugin.js +++ b/packages/babel-core/src/transformation/plugin.js @@ -31,7 +31,7 @@ export default class Plugin extends Store { visitor: Object; take(key) { - let val = this.raw[key]; + const val = this.raw[key]; delete this.raw[key]; return val; } @@ -40,13 +40,13 @@ export default class Plugin extends Store { if (!target[key]) return this[key]; if (!this[key]) return target[key]; - let fns: Array = [target[key], this[key]]; + const fns: Array = [target[key], this[key]]; return function (...args) { let val; - for (let fn of fns) { + for (const fn of fns) { if (fn) { - let ret = fn.apply(this, args); + const ret = fn.apply(this, args); if (ret != null) val = ret; } } @@ -77,13 +77,13 @@ export default class Plugin extends Store { this.maybeInherit(loc); - for (let key in this.raw) { + for (const key in this.raw) { throw new Error(messages.get("pluginInvalidProperty", loc, i, key)); } } normaliseVisitor(visitor: Object): Object { - for (let key of GLOBAL_VISITOR_PROPS) { + for (const key of GLOBAL_VISITOR_PROPS) { if (visitor[key]) { throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes."); } diff --git a/packages/babel-core/src/util.js b/packages/babel-core/src/util.js index 4da7503e8c..97726e2640 100644 --- a/packages/babel-core/src/util.js +++ b/packages/babel-core/src/util.js @@ -15,8 +15,8 @@ export { inherits, inspect } from "util"; */ export function canCompile(filename: string, altExts?: Array): boolean { - let exts = altExts || canCompile.EXTENSIONS; - let ext = path.extname(filename); + const exts = altExts || canCompile.EXTENSIONS; + const ext = path.extname(filename); return includes(exts, ext); } @@ -63,7 +63,7 @@ export function regexify(val: any): RegExp { if (startsWith(val, "./") || startsWith(val, "*/")) val = val.slice(2); if (startsWith(val, "**/")) val = val.slice(3); - let regex = minimatch.makeRe(val, { nocase: true }); + const regex = minimatch.makeRe(val, { nocase: true }); return new RegExp(regex.source.slice(1, -1), "i"); } @@ -119,12 +119,12 @@ export function shouldIgnore( filename = filename.replace(/\\/g, "/"); if (only) { - for (let pattern of only) { + for (const pattern of only) { if (_shouldIgnore(pattern, filename)) return false; } return true; } else if (ignore.length) { - for (let pattern of ignore) { + for (const pattern of ignore) { if (_shouldIgnore(pattern, filename)) return true; } } diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 0b997fb4a0..70823258e5 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -1,9 +1,9 @@ -let babel = require("../lib/api/node"); -let buildExternalHelpers = require("../lib/tools/build-external-helpers"); -let sourceMap = require("source-map"); -let assert = require("assert"); -let Plugin = require("../lib/transformation/plugin"); -let generator = require("babel-generator").default; +const babel = require("../lib/api/node"); +const buildExternalHelpers = require("../lib/tools/build-external-helpers"); +const sourceMap = require("source-map"); +const assert = require("assert"); +const Plugin = require("../lib/transformation/plugin"); +const generator = require("babel-generator").default; function assertIgnored(result) { assert.ok(result.ignored); @@ -23,7 +23,7 @@ function transformAsync(code, opts) { } describe("parser and generator options", function() { - let recast = { + const recast = { parse: function(code, opts) { return opts.parser.parse(code); }, @@ -46,13 +46,13 @@ describe("parser and generator options", function() { } it("options", function() { - let string = "original;"; + const string = "original;"; assert.deepEqual(newTransform(string).ast, babel.transform(string).ast); assert.equal(newTransform(string).code, string); }); it("experimental syntax", function() { - let experimental = "var a: number = 1;"; + const experimental = "var a: number = 1;"; assert.deepEqual(newTransform(experimental).ast, babel.transform(experimental, { parserOpts: { @@ -82,7 +82,7 @@ describe("parser and generator options", function() { }); it("other options", function() { - let experimental = "if (true) {\n import a from 'a';\n}"; + const experimental = "if (true) {\n import a from 'a';\n}"; assert.notEqual(newTransform(experimental).ast, babel.transform(experimental, { parserOpts: { @@ -199,7 +199,7 @@ describe("api", function () { new Plugin({ visitor: { Function: function(path) { - let alias = path.scope.getProgramParent().path.get("body")[0].node; + const alias = path.scope.getProgramParent().path.get("body")[0].node; if (!babel.types.isTypeAlias(alias)) return; // In case of `passPerPreset` being `false`, the @@ -264,7 +264,7 @@ describe("api", function () { }); it("source map merging", function () { - let result = babel.transform([ + const result = babel.transform([ "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }", "", "let Foo = function Foo() {", @@ -288,7 +288,7 @@ describe("api", function () { "};" ].join("\n"), result.code); - let consumer = new sourceMap.SourceMapConsumer(result.map); + const consumer = new sourceMap.SourceMapConsumer(result.map); assert.deepEqual(consumer.originalPositionFor({ line: 7, @@ -318,7 +318,7 @@ describe("api", function () { auxiliaryCommentBefore: "before", auxiliaryCommentAfter: "after", plugins: [function (babel) { - let t = babel.types; + const t = babel.types; return { visitor: { Program: function (path) { @@ -539,8 +539,8 @@ describe("api", function () { }); describe("env option", function () { - let oldBabelEnv = process.env.BABEL_ENV; - let oldNodeEnv = process.env.NODE_ENV; + const oldBabelEnv = process.env.BABEL_ENV; + const oldNodeEnv = process.env.NODE_ENV; setup(function () { // Tests need to run with the default and specific values for these. They @@ -555,7 +555,7 @@ describe("api", function () { }); it("default", function () { - let result = babel.transform("foo;", { + const result = babel.transform("foo;", { env: { development: { code: false } } @@ -566,7 +566,7 @@ describe("api", function () { it("BABEL_ENV", function () { process.env.BABEL_ENV = "foo"; - let result = babel.transform("foo;", { + const result = babel.transform("foo;", { env: { foo: { code: false } } @@ -576,7 +576,7 @@ describe("api", function () { it("NODE_ENV", function () { process.env.NODE_ENV = "foo"; - let result = babel.transform("foo;", { + const result = babel.transform("foo;", { env: { foo: { code: false } } @@ -586,8 +586,8 @@ describe("api", function () { }); it("resolveModuleSource option", function () { - let actual = "import foo from \"foo-import-default\";\nimport \"foo-import-bare\";\nexport { foo } from \"foo-export-named\";"; - let expected = "import foo from \"resolved/foo-import-default\";\nimport \"resolved/foo-import-bare\";\nexport { foo } from \"resolved/foo-export-named\";"; + const actual = "import foo from \"foo-import-default\";\nimport \"foo-import-bare\";\nexport { foo } from \"foo-export-named\";"; + const expected = "import foo from \"resolved/foo-import-default\";\nimport \"resolved/foo-import-bare\";\nexport { foo } from \"resolved/foo-export-named\";"; return transformAsync(actual, { resolveModuleSource: function (originalSource) { @@ -600,25 +600,25 @@ describe("api", function () { describe("buildExternalHelpers", function () { it("all", function () { - let script = buildExternalHelpers(); + const script = buildExternalHelpers(); assert.ok(script.indexOf("classCallCheck") >= -1); assert.ok(script.indexOf("inherits") >= 0); }); it("whitelist", function () { - let script = buildExternalHelpers(["inherits"]); + const script = buildExternalHelpers(["inherits"]); assert.ok(script.indexOf("classCallCheck") === -1); assert.ok(script.indexOf("inherits") >= 0); }); it("empty whitelist", function () { - let script = buildExternalHelpers([]); + const script = buildExternalHelpers([]); assert.ok(script.indexOf("classCallCheck") === -1); assert.ok(script.indexOf("inherits") === -1); }); it("underscored", function () { - let script = buildExternalHelpers(["typeof"]); + const script = buildExternalHelpers(["typeof"]); assert.ok(script.indexOf("typeof") >= 0); }); }); diff --git a/packages/babel-core/test/browserify.js b/packages/babel-core/test/browserify.js index 9923f6c52e..730ace945a 100644 --- a/packages/babel-core/test/browserify.js +++ b/packages/babel-core/test/browserify.js @@ -1,11 +1,11 @@ -let browserify = require("browserify"); -let assert = require("assert"); -let path = require("path"); -let vm = require("vm"); +const browserify = require("browserify"); +const assert = require("assert"); +const path = require("path"); +const vm = require("vm"); describe("browserify", function() { it("babel/register may be used without breaking browserify", function(done) { - let bundler = browserify(path.join(__dirname, "fixtures/browserify/register.js")); + const bundler = browserify(path.join(__dirname, "fixtures/browserify/register.js")); bundler.bundle(function(err, bundle) { if (err) return done(err); diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 0a0b952d51..95d17eeb15 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -1,9 +1,9 @@ -let assert = require("assert"); -let path = require("path"); -let buildConfigChain = require("../lib/transformation/file/options/build-config-chain"); +const assert = require("assert"); +const path = require("path"); +const buildConfigChain = require("../lib/transformation/file/options/build-config-chain"); function fixture() { - let args = [__dirname, "fixtures", "config"]; + const args = [__dirname, "fixtures", "config"]; for (let i = 0; i < arguments.length; i ++) { args.push(arguments[i]); } @@ -28,11 +28,11 @@ describe("buildConfigChain", function () { }); it("dir1", function () { - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("dir1", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: [ @@ -77,11 +77,11 @@ describe("buildConfigChain", function () { }); it("dir2", function () { - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("dir2", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: [ @@ -116,11 +116,11 @@ describe("buildConfigChain", function () { }); it("env - base", function () { - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("env", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: [ @@ -157,11 +157,11 @@ describe("buildConfigChain", function () { it("env - foo", function () { process.env.NODE_ENV = "foo"; - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("env", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: [ @@ -209,11 +209,11 @@ describe("buildConfigChain", function () { process.env.NODE_ENV = "foo"; // overridden process.env.NODE_ENV = "bar"; - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("env", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: [ @@ -261,11 +261,11 @@ describe("buildConfigChain", function () { it("env - foo", function () { process.env.NODE_ENV = "foo"; - let chain = buildConfigChain({ + const chain = buildConfigChain({ filename: fixture("pkg", "src.js") }); - let expected = [ + const expected = [ { options: { plugins: ["pkg-plugin"] diff --git a/packages/babel-core/test/evaluation.js b/packages/babel-core/test/evaluation.js index 1af3bc7399..4378bb4176 100644 --- a/packages/babel-core/test/evaluation.js +++ b/packages/babel-core/test/evaluation.js @@ -1,14 +1,14 @@ -let traverse = require("babel-traverse").default; -let assert = require("assert"); -let parse = require("babylon").parse; +const traverse = require("babel-traverse").default; +const assert = require("assert"); +const parse = require("babylon").parse; describe("evaluation", function () { function addTest(code, type, value, notConfident) { it(type + ": " + code, function () { - let visitor = {}; + const visitor = {}; visitor[type] = function (path) { - let evaluate = path.evaluate(); + const evaluate = path.evaluate(); assert.equal(evaluate.confident, !notConfident); assert.deepEqual(evaluate.value, value); }; diff --git a/packages/babel-core/test/get-possible-plugin-names.js b/packages/babel-core/test/get-possible-plugin-names.js index 4a9ec2d080..d9d730bd6c 100644 --- a/packages/babel-core/test/get-possible-plugin-names.js +++ b/packages/babel-core/test/get-possible-plugin-names.js @@ -1,5 +1,5 @@ -let assert = require("assert"); -let getPossiblePluginNames = require("../lib/helpers/get-possible-plugin-names"); +const assert = require("assert"); +const getPossiblePluginNames = require("../lib/helpers/get-possible-plugin-names"); describe("getPossiblePluginNames", function () { it("adds the babel-plugin prefix", function() { diff --git a/packages/babel-core/test/get-possible-preset-names.js b/packages/babel-core/test/get-possible-preset-names.js index 88f9166c83..64de8897b8 100644 --- a/packages/babel-core/test/get-possible-preset-names.js +++ b/packages/babel-core/test/get-possible-preset-names.js @@ -1,5 +1,5 @@ -let assert = require("assert"); -let getPossiblePresetNames = require("../lib/helpers/get-possible-preset-names"); +const assert = require("assert"); +const getPossiblePresetNames = require("../lib/helpers/get-possible-preset-names"); describe("getPossiblePresetNames", function () { it("adds the babel-preset prefix", function() { diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 592c431d54..2606a4bca0 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -17,7 +17,7 @@ describe("option-manager", () => { it("throws for removed babel 5 options", () => { return assert.throws( () => { - let opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ "randomOption": true }); @@ -29,7 +29,7 @@ describe("option-manager", () => { it("throws for removed babel 5 options", () => { return assert.throws( () => { - let opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ "auxiliaryComment": true, "blacklist": true @@ -42,7 +42,7 @@ describe("option-manager", () => { it("throws for resolved but erroring preset", () => { return assert.throws( () => { - let opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/not-a-preset")] }); @@ -54,7 +54,7 @@ describe("option-manager", () => { it("throws for invalid preset configuration", function() { return assert.throws( function () { - let opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ "presets": [{ option: "value" }] }); @@ -67,8 +67,8 @@ describe("option-manager", () => { describe("presets", function () { function presetTest(name) { it(name, function () { - let opt = new OptionManager(new Logger(null, "unknown")); - let options = opt.init({ + const opt = new OptionManager(new Logger(null, "unknown")); + const options = opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)] }); diff --git a/packages/babel-core/test/path.js b/packages/babel-core/test/path.js index c76fc31e59..e60c68c9f8 100644 --- a/packages/babel-core/test/path.js +++ b/packages/babel-core/test/path.js @@ -1,12 +1,12 @@ -let transform = require("../lib/api/node").transform; -let Plugin = require("../lib/transformation/plugin"); -let chai = require("chai"); +const transform = require("../lib/api/node").transform; +const Plugin = require("../lib/transformation/plugin"); +const chai = require("chai"); describe("traversal path", function () { it("replaceWithSourceString", function () { - let expectCode = "function foo() {}"; + const expectCode = "function foo() {}"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { FunctionDeclaration: function (path) { @@ -20,9 +20,9 @@ describe("traversal path", function () { }); it("replaceWith (arrow expression body to block statement body)", function () { - let expectCode = "var fn = () => true;"; + const expectCode = "var fn = () => true;"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ArrowFunctionExpression: function (path) { @@ -45,9 +45,9 @@ describe("traversal path", function () { }); it("replaceWith (arrow block statement body to expression body)", function () { - let expectCode = "var fn = () => { return true; }"; + const expectCode = "var fn = () => { return true; }"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ArrowFunctionExpression: function (path) { @@ -64,9 +64,9 @@ describe("traversal path", function () { }); it("replaceWith (for-in left expression to variable declaration)", function () { - let expectCode = "for (KEY in right);"; + const expectCode = "for (KEY in right);"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ForInStatement: function (path) { @@ -90,9 +90,9 @@ describe("traversal path", function () { }); it("replaceWith (for-in left variable declaration to expression)", function () { - let expectCode = "for (var KEY in right);"; + const expectCode = "for (var KEY in right);"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ForInStatement: function (path) { @@ -109,9 +109,9 @@ describe("traversal path", function () { }); it("replaceWith (for-loop left expression to variable declaration)", function () { - let expectCode = "for (KEY;;);"; + const expectCode = "for (KEY;;);"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ForStatement: function (path) { @@ -135,9 +135,9 @@ describe("traversal path", function () { }); it("replaceWith (for-loop left variable declaration to expression)", function () { - let expectCode = "for (var KEY;;);"; + const expectCode = "for (var KEY;;);"; - let actualCode = transform(expectCode, { + const actualCode = transform(expectCode, { plugins: [new Plugin({ visitor: { ForStatement: function (path) { diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index bdffce466d..622ddac038 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -1,14 +1,14 @@ -let assert = require("assert"); -let async = require("async"); -let babel = require("../lib/api/node"); -let fs = require("fs"); -let path = require("path"); +const assert = require("assert"); +const async = require("async"); +const babel = require("../lib/api/node"); +const fs = require("fs"); +const path = require("path"); // Test that plugins & presets are resolved relative to `filename`. describe("addon resolution", function () { it("addon resolution", function (done) { - let fixtures = {}; - let paths = {}; + const fixtures = {}; + const paths = {}; paths.fixtures = path.join( __dirname, @@ -33,7 +33,7 @@ describe("addon resolution", function () { function fixturesReady (err) { if (err) return done(err); - let actual = babel.transform(fixtures.actual, { + const actual = babel.transform(fixtures.actual, { filename: paths.actual, plugins: ["addons/plugin"], presets: ["addons/preset"], diff --git a/packages/babel-core/test/util.js b/packages/babel-core/test/util.js index ae1e83e913..1e879f41a5 100644 --- a/packages/babel-core/test/util.js +++ b/packages/babel-core/test/util.js @@ -1,6 +1,6 @@ -let assert = require("assert"); -let util = require("../lib/util"); -let t = require("babel-types"); +const assert = require("assert"); +const util = require("../lib/util"); +const t = require("babel-types"); describe("util", function () { it("canCompile", function () { @@ -36,7 +36,7 @@ describe("util", function () { assert.deepEqual(util.list(["foo", "bar"]), ["foo", "bar"]); assert.deepEqual(util.list(/foo/), [/foo/]); - let date = new Date; + const date = new Date; assert.deepEqual(util.list(date), [date]); }); @@ -84,8 +84,8 @@ describe("util", function () { }); it("shouldIgnore", function () { - let reIgnore = /\-reIgnore\.js/; - let fnIgnore = function (src) { + const reIgnore = /\-reIgnore\.js/; + const fnIgnore = function (src) { if (src.indexOf("fnIgnore") > 0) { return true; } diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index 69c61db864..72894c440a 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -153,7 +153,7 @@ export default class Buffer { source(prop: string, loc: Location): void { if (prop && !loc) return; - let pos = loc ? loc[prop] : null; + const pos = loc ? loc[prop] : null; this._sourcePosition.identifierName = loc && loc.identifierName || null; this._sourcePosition.line = pos ? pos.line : null; @@ -169,10 +169,10 @@ export default class Buffer { if (!this._map) return cb(); // Use the call stack to manage a stack of "source location" data. - let originalLine = this._sourcePosition.line; - let originalColumn = this._sourcePosition.column; - let originalFilename = this._sourcePosition.filename; - let originalIdentifierName = this._sourcePosition.identifierName; + const originalLine = this._sourcePosition.line; + const originalColumn = this._sourcePosition.column; + const originalFilename = this._sourcePosition.filename; + const originalIdentifierName = this._sourcePosition.identifierName; this.source(prop, loc); diff --git a/packages/babel-generator/src/generators/base.js b/packages/babel-generator/src/generators/base.js index dec9fe11bf..ec2dd76364 100644 --- a/packages/babel-generator/src/generators/base.js +++ b/packages/babel-generator/src/generators/base.js @@ -15,7 +15,7 @@ export function BlockStatement(node: Object) { this.token("{"); this.printInnerComments(node); - let hasDirectives = node.directives && node.directives.length; + const hasDirectives = node.directives && node.directives.length; if (node.body.length || hasDirectives) { this.newline(); diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index b38cebed54..c4c581eddf 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -94,7 +94,7 @@ export function CallExpression(node: Object) { this.token("("); - let isPrettyCall = node._prettyCall; + const isPrettyCall = node._prettyCall; let separator; if (isPrettyCall) { @@ -127,15 +127,15 @@ function buildYieldAwait(keyword: string) { if (node.argument) { this.space(); - let terminatorState = this.startTerminatorless(); + const terminatorState = this.startTerminatorless(); this.print(node.argument, node); this.endTerminatorless(terminatorState); } }; } -export let YieldExpression = buildYieldAwait("yield"); -export let AwaitExpression = buildYieldAwait("await"); +export const YieldExpression = buildYieldAwait("yield"); +export const AwaitExpression = buildYieldAwait("await"); export function EmptyStatement() { this.semicolon(true /* force */); @@ -159,7 +159,7 @@ export function AssignmentPattern(node: Object) { export function AssignmentExpression(node: Object, parent: Object) { // Somewhere inside a for statement `init` node but doesn't usually // needs a paren except for `in` expressions: `for (a in b ? a : b;;)` - let parens = this.inForStatementInitCounter && node.operator === "in" && + const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); if (parens) { diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 9ef56bdde4..668ba0e2b3 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -264,7 +264,7 @@ export function ObjectTypeAnnotation(node: Object) { this.token("{"); } - let props = node.properties.concat(node.callProperties, node.indexers); + const props = node.properties.concat(node.callProperties, node.indexers); if (props.length) { this.space(); diff --git a/packages/babel-generator/src/generators/jsx.js b/packages/babel-generator/src/generators/jsx.js index 7da237ff6a..521b479ae0 100644 --- a/packages/babel-generator/src/generators/jsx.js +++ b/packages/babel-generator/src/generators/jsx.js @@ -47,12 +47,12 @@ export function JSXText(node: Object) { } export function JSXElement(node: Object) { - let open = node.openingElement; + const open = node.openingElement; this.print(open, node); if (open.selfClosing) return; this.indent(); - for (let child of (node.children: Array)) { + for (const child of (node.children: Array)) { this.print(child, node); } this.dedent(); diff --git a/packages/babel-generator/src/generators/methods.js b/packages/babel-generator/src/generators/methods.js index 720aa0c87b..97bbcd3129 100644 --- a/packages/babel-generator/src/generators/methods.js +++ b/packages/babel-generator/src/generators/methods.js @@ -17,8 +17,8 @@ export function _params(node: Object) { } export function _method(node: Object) { - let kind = node.kind; - let key = node.key; + const kind = node.kind; + const key = node.key; if (kind === "method" || kind === "init") { if (node.generator) { diff --git a/packages/babel-generator/src/generators/modules.js b/packages/babel-generator/src/generators/modules.js index 6a87a02512..59f19aa8dd 100644 --- a/packages/babel-generator/src/generators/modules.js +++ b/packages/babel-generator/src/generators/modules.js @@ -69,7 +69,7 @@ export function ExportDefaultDeclaration() { function ExportDeclaration(node: Object) { if (node.declaration) { - let declar = node.declaration; + const declar = node.declaration; this.print(declar, node); if (!t.isStatement(declar)) this.semicolon(); } else { @@ -78,12 +78,12 @@ function ExportDeclaration(node: Object) { this.space(); } - let specifiers = node.specifiers.slice(0); + const specifiers = node.specifiers.slice(0); // print "special" specifiers first let hasSpecial = false; while (true) { - let first = specifiers[0]; + const first = specifiers[0]; if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) { hasSpecial = true; this.print(specifiers.shift(), node); @@ -126,11 +126,11 @@ export function ImportDeclaration(node: Object) { this.space(); } - let specifiers = node.specifiers.slice(0); + const specifiers = node.specifiers.slice(0); if (specifiers && specifiers.length) { // print "special" specifiers first while (true) { - let first = specifiers[0]; + const first = specifiers[0]; if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) { this.print(specifiers.shift(), node); if (specifiers.length) { diff --git a/packages/babel-generator/src/generators/statements.js b/packages/babel-generator/src/generators/statements.js index a5ec481882..b9e8e736b3 100644 --- a/packages/babel-generator/src/generators/statements.js +++ b/packages/babel-generator/src/generators/statements.js @@ -17,7 +17,7 @@ export function IfStatement(node: Object) { this.token(")"); this.space(); - let needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent)); + const needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent)); if (needsBlock) { this.token("{"); this.newline(); @@ -80,7 +80,7 @@ export function WhileStatement(node: Object) { this.printBlock(node); } -let buildForXStatement = function (op) { +const buildForXStatement = function (op) { return function (node: Object) { this.word("for"); this.space(); @@ -101,9 +101,9 @@ let buildForXStatement = function (op) { }; }; -export let ForInStatement = buildForXStatement("in"); -export let ForOfStatement = buildForXStatement("of"); -export let ForAwaitStatement = buildForXStatement("await"); +export const ForInStatement = buildForXStatement("in"); +export const ForOfStatement = buildForXStatement("of"); +export const ForAwaitStatement = buildForXStatement("await"); export function DoWhileStatement(node: Object) { this.word("do"); @@ -122,11 +122,11 @@ function buildLabelStatement(prefix, key = "label") { return function (node: Object) { this.word(prefix); - let label = node[key]; + const label = node[key]; if (label) { this.space(); - let terminatorState = this.startTerminatorless(); + const terminatorState = this.startTerminatorless(); this.print(label, node); this.endTerminatorless(terminatorState); } @@ -135,10 +135,10 @@ function buildLabelStatement(prefix, key = "label") { }; } -export let ContinueStatement = buildLabelStatement("continue"); -export let ReturnStatement = buildLabelStatement("return", "argument"); -export let BreakStatement = buildLabelStatement("break"); -export let ThrowStatement = buildLabelStatement("throw", "argument"); +export const ContinueStatement = buildLabelStatement("continue"); +export const ReturnStatement = buildLabelStatement("return", "argument"); +export const BreakStatement = buildLabelStatement("break"); +export const ThrowStatement = buildLabelStatement("throw", "argument"); export function LabeledStatement(node: Object) { this.print(node.label, node); @@ -242,7 +242,7 @@ export function VariableDeclaration(node: Object, parent: Object) { let hasInits = false; // don't add whitespace to loop heads if (!t.isFor(parent)) { - for (let declar of (node.declarations: Array)) { + for (const declar of (node.declarations: Array)) { if (declar.init) { // has an init so let's split it up over multiple lines hasInits = true; diff --git a/packages/babel-generator/src/generators/template-literals.js b/packages/babel-generator/src/generators/template-literals.js index 127b64b0cd..a49b8615ed 100644 --- a/packages/babel-generator/src/generators/template-literals.js +++ b/packages/babel-generator/src/generators/template-literals.js @@ -7,13 +7,13 @@ export function TemplateElement(node: Object, parent: Object) { const isFirst = parent.quasis[0] === node; const isLast = parent.quasis[parent.quasis.length - 1] === node; - let value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); + const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); this.token(value); } export function TemplateLiteral(node: Object) { - let quasis = node.quasis; + const quasis = node.quasis; for (let i = 0; i < quasis.length; i++) { this.print(quasis[i], node); diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index 3f803c8e11..fa8498aff7 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -32,7 +32,7 @@ export { }; export function ObjectExpression(node: Object) { - let props = node.properties; + const props = node.properties; this.token("{"); this.printInnerComments(node); @@ -84,14 +84,14 @@ export function ObjectProperty(node: Object) { } export function ArrayExpression(node: Object) { - let elems = node.elements; - let len = elems.length; + const elems = node.elements; + const len = elems.length; this.token("["); this.printInnerComments(node); for (let i = 0; i < elems.length; i++) { - let elem = elems[i]; + const elem = elems[i]; if (elem) { if (i > 0) this.space(); this.print(elem, node); @@ -136,7 +136,7 @@ export function NumericLiteral(node: Object) { } export function StringLiteral(node: Object, parent: Object) { - let raw = this.getPossibleRaw(node); + const raw = this.getPossibleRaw(node); if (!this.format.minified && raw != null) { this.token(raw); return; @@ -150,7 +150,7 @@ export function StringLiteral(node: Object, parent: Object) { if (this.format.jsonCompatibleStrings) { opts.json = true; } - let val = jsesc(node.value, opts); + const val = jsesc(node.value, opts); return this.token(val); } diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index c212cbdf7c..a3031f1679 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -14,8 +14,8 @@ class Generator extends Printer { opts = opts || {}; const tokens = ast.tokens || []; - let format = normalizeOptions(code, opts, tokens); - let map = opts.sourceMaps ? new SourceMap(opts, code) : null; + const format = normalizeOptions(code, opts, tokens); + const map = opts.sourceMaps ? new SourceMap(opts, code) : null; super(format, map, tokens); this.ast = ast; @@ -44,11 +44,11 @@ class Generator extends Printer { function normalizeOptions(code, opts, tokens): Format { let style = " "; if (code && typeof code === "string") { - let indent = detectIndent(code).indent; + const indent = detectIndent(code).indent; if (indent && indent !== " ") style = indent; } - let format = { + const format = { auxiliaryCommentBefore: opts.auxiliaryCommentBefore, auxiliaryCommentAfter: opts.auxiliaryCommentAfter, shouldPrintComment: opts.shouldPrintComment, @@ -101,7 +101,7 @@ function findCommonStringDelimiter(code, tokens) { return DEFAULT_STRING_DELIMITER; } - let occurences = { + const occurences = { single: 0, double: 0 }; @@ -109,10 +109,10 @@ function findCommonStringDelimiter(code, tokens) { let checked = 0; for (let i = 0; i < tokens.length; i++) { - let token = tokens[i]; + const token = tokens[i]; if (token.type.label !== "string") continue; - let raw = code.slice(token.start, token.end); + const raw = code.slice(token.start, token.end); if (raw[0] === "'") { occurences.single++; } else { @@ -145,6 +145,6 @@ export class CodeGenerator { } export default function (ast: Object, opts: Object, code: string): Object { - let gen = new Generator(ast, opts, code); + const gen = new Generator(ast, opts, code); return gen.generate(); } diff --git a/packages/babel-generator/src/node/index.js b/packages/babel-generator/src/node/index.js index 971f478a3d..c885f8032b 100644 --- a/packages/babel-generator/src/node/index.js +++ b/packages/babel-generator/src/node/index.js @@ -3,22 +3,22 @@ import * as parens from "./parentheses"; import * as t from "babel-types"; function expandAliases(obj) { - let newObj = {}; + const newObj = {}; function add(type, func) { - let fn = newObj[type]; + const fn = newObj[type]; newObj[type] = fn ? function(node, parent, stack) { - let result = fn(node, parent, stack); + const result = fn(node, parent, stack); return result == null ? func(node, parent, stack) : result; } : func; } - for (let type of Object.keys(obj)) { + for (const type of Object.keys(obj)) { - let aliases = t.FLIPPED_ALIAS_KEYS[type]; + const aliases = t.FLIPPED_ALIAS_KEYS[type]; if (aliases) { - for (let alias of aliases) { + for (const alias of aliases) { add(alias, obj[type]); } } else { @@ -31,12 +31,12 @@ function expandAliases(obj) { // Rather than using `t.is` on each object property, we pre-expand any type aliases // into concrete types so that the 'find' call below can be as fast as possible. -let expandedParens = expandAliases(parens); -let expandedWhitespaceNodes = expandAliases(whitespace.nodes); -let expandedWhitespaceList = expandAliases(whitespace.list); +const expandedParens = expandAliases(parens); +const expandedWhitespaceNodes = expandAliases(whitespace.nodes); +const expandedWhitespaceList = expandAliases(whitespace.list); function find(obj, node, parent, printStack) { - let fn = obj[node.type]; + const fn = obj[node.type]; return fn ? fn(node, parent, printStack) : null; } @@ -63,7 +63,7 @@ export function needsWhitespace(node, parent, type) { let linesInfo = find(expandedWhitespaceNodes, node, parent); if (!linesInfo) { - let items = find(expandedWhitespaceList, node, parent); + const items = find(expandedWhitespaceList, node, parent); if (items) { for (let i = 0; i < items.length; i++) { linesInfo = needsWhitespace(items[i], node, type); diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 199252d96e..203ed8a3aa 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -60,11 +60,11 @@ export function Binary(node: Object, parent: Object): boolean { } if (t.isBinary(parent)) { - let parentOp = parent.operator; - let parentPos = PRECEDENCE[parentOp]; + const parentOp = parent.operator; + const parentPos = PRECEDENCE[parentOp]; - let nodeOp = node.operator; - let nodePos = PRECEDENCE[nodeOp]; + const nodeOp = node.operator; + const nodePos = PRECEDENCE[nodeOp]; if (parentPos > nodePos) { return true; diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index 6ba8522e08..21320e33d3 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -69,7 +69,7 @@ exports.nodes = { */ AssignmentExpression(node: Object): ?WhitespaceObject { - let state = crawl(node.right); + const state = crawl(node.right); if ((state.hasCall && state.hasHelper) || state.hasFunction) { return { before: state.hasFunction, @@ -131,11 +131,11 @@ exports.nodes = { VariableDeclaration(node: Object): ?WhitespaceObject { for (let i = 0; i < node.declarations.length; i++) { - let declar = node.declarations[i]; + const declar = node.declarations[i]; let enabled = isHelper(declar.id) && !isType(declar.init); if (!enabled) { - let state = crawl(declar.init); + const state = crawl(declar.init); enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction; } diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index a9af009429..e03298d1f9 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -238,7 +238,7 @@ export default class Printer { _maybeAddParen(str: string): void { // see startTerminatorless() instance method - let parenPushNewlineState = this._parenPushNewlineState; + const parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; this._parenPushNewlineState = null; @@ -314,19 +314,19 @@ export default class Printer { print(node, parent) { if (!node) return; - let oldConcise = this.format.concise; + const oldConcise = this.format.concise; if (node._compact) { this.format.concise = true; } - let printMethod = this[node.type]; + const printMethod = this[node.type]; if (!printMethod) { throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`); } this._printStack.push(node); - let oldInAux = this._insideAux; + const oldInAux = this._insideAux; this._insideAux = !node.loc; this._maybeAddAuxComment(this._insideAux && !oldInAux); @@ -340,7 +340,7 @@ export default class Printer { this._printLeadingComments(node, parent); - let loc = (t.isProgram(node) || t.isFile(node)) ? null : node.loc; + const loc = (t.isProgram(node) || t.isFile(node)) ? null : node.loc; this.withSource("start", loc, () => { this[node.type](node, parent); }); @@ -388,7 +388,7 @@ export default class Printer { } getPossibleRaw(node) { - let extra = node.extra; + const extra = node.extra; if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { return extra.raw; } @@ -426,14 +426,14 @@ export default class Printer { } printAndIndentOnComments(node, parent) { - let indent = !!node.leadingComments; + const indent = !!node.leadingComments; if (indent) this.indent(); this.print(node, parent); if (indent) this.dedent(); } printBlock(parent) { - let node = parent.body; + const node = parent.body; if (!t.isEmptyStatement(node)) { this.space(); @@ -544,13 +544,13 @@ export default class Printer { // if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) { - let offset = comment.loc && comment.loc.start.column; + const offset = comment.loc && comment.loc.start.column; if (offset) { - let newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); + const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); val = val.replace(newlineRegex, "\n"); } - let indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); + const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); val = val.replace(/\n(?!$)/g, `\n${repeat(" ", indentSize)}`); } @@ -567,7 +567,7 @@ export default class Printer { _printComments(comments?: Array) { if (!comments || !comments.length) return; - for (let comment of comments) { + for (const comment of comments) { this._printComment(comment); } } @@ -578,7 +578,7 @@ function commaSeparator() { this.space(); } -for (let generator of [ +for (const generator of [ require("./generators/template-literals"), require("./generators/expressions"), require("./generators/statements"), diff --git a/packages/babel-generator/src/whitespace.js b/packages/babel-generator/src/whitespace.js index 2eb4f9b308..6a055e02e2 100644 --- a/packages/babel-generator/src/whitespace.js +++ b/packages/babel-generator/src/whitespace.js @@ -15,7 +15,7 @@ export default class Whitespace { getNewlinesBefore(node) { let startToken; let endToken; - let tokens = this.tokens; + const tokens = this.tokens; let index = this._findToken((token) => token.start - node.start, 0, tokens.length); if (index >= 0) { @@ -34,7 +34,7 @@ export default class Whitespace { getNewlinesAfter(node) { let startToken; let endToken; - let tokens = this.tokens; + const tokens = this.tokens; let index = this._findToken((token) => token.end - node.end, 0, tokens.length); if (index >= 0) { @@ -58,8 +58,8 @@ export default class Whitespace { _getNewlinesBetween(startToken, endToken) { if (!endToken || !endToken.loc) return 0; - let start = startToken ? startToken.loc.end.line : 1; - let end = endToken.loc.start.line; + const start = startToken ? startToken.loc.end.line : 1; + const end = endToken.loc.start.line; let lines = 0; for (let line = start; line < end; line++) { diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 40d8402d34..cd84698ba5 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -1,13 +1,13 @@ -let Whitespace = require("../lib/whitespace"); -let Printer = require("../lib/printer"); -let generate = require("../lib"); -let assert = require("assert"); -let parse = require("babylon").parse; -let chai = require("chai"); -let t = require("babel-types"); -let _ = require("lodash"); -let fs = require("fs"); -let path = require("path"); +const Whitespace = require("../lib/whitespace"); +const Printer = require("../lib/printer"); +const generate = require("../lib"); +const assert = require("assert"); +const parse = require("babylon").parse; +const chai = require("chai"); +const t = require("babel-types"); +const _ = require("lodash"); +const fs = require("fs"); +const path = require("path"); describe("generation", function () { it("completeness", function () { @@ -22,16 +22,16 @@ describe("generation", function () { }); it("multiple sources", function () { - let sources = { + const sources = { "a.js": "function hi (msg) { console.log(msg); }\n", "b.js": "hi('hello');\n" }; - let parsed = _.keys(sources).reduce(function (_parsed, filename) { + const parsed = _.keys(sources).reduce(function (_parsed, filename) { _parsed[filename] = parse(sources[filename], { sourceFilename: filename }); return _parsed; }, {}); - let combinedAst = { + const combinedAst = { "type": "File", "program": { "type": "Program", @@ -40,7 +40,7 @@ describe("generation", function () { } }; - let generated = generate.default(combinedAst, { sourceMaps: true }, sources); + const generated = generate.default(combinedAst, { sourceMaps: true }, sources); chai.expect(generated.map).to.deep.equal({ version: 3, @@ -128,20 +128,20 @@ describe("generation", function () { }); it("identifierName", function () { - let code = "function foo() { bar; }\n"; + const code = "function foo() { bar; }\n"; - let ast = parse(code, { filename: "inline" }).program; - let fn = ast.body[0]; + const ast = parse(code, { filename: "inline" }).program; + const fn = ast.body[0]; - let id = fn.id; + const id = fn.id; id.name += "2"; id.loc.identifierName = "foo"; - let id2 = fn.body.body[0].expression; + const id2 = fn.body.body[0].expression; id2.name += "2"; id2.loc.identiferName = "bar"; - let generated = generate.default(ast, { + const generated = generate.default(ast, { filename: "inline", sourceFileName: "inline", sourceMaps: true @@ -189,10 +189,10 @@ describe("generation", function () { }); it("lazy source map generation", function() { - let code = "function hi (msg) { console.log(msg); }\n"; + const code = "function hi (msg) { console.log(msg); }\n"; - let ast = parse(code, { filename: "a.js" }).program; - let generated = generate.default(ast, { + const ast = parse(code, { filename: "a.js" }).program; + const generated = generate.default(ast, { sourceFileName: "a.js", sourceMaps: true, }); @@ -209,12 +209,12 @@ describe("generation", function () { describe("programmatic generation", function() { it("numeric member expression", function() { // Should not generate `0.foo` - let mem = t.memberExpression(t.numericLiteral(60702), t.identifier("foo")); + const mem = t.memberExpression(t.numericLiteral(60702), t.identifier("foo")); new Function(generate.default(mem).code); }); it("nested if statements needs block", function() { - let ifStatement = t.ifStatement( + const ifStatement = t.ifStatement( t.stringLiteral("top cond"), t.whileStatement( t.stringLiteral("while cond"), @@ -226,17 +226,17 @@ describe("programmatic generation", function() { t.expressionStatement(t.stringLiteral("alt")) ); - let ast = parse(generate.default(ifStatement).code); + const ast = parse(generate.default(ifStatement).code); assert.equal(ast.program.body[0].consequent.type, "BlockStatement"); }); it("prints directives in block with empty body", function() { - let blockStatement = t.blockStatement( + const blockStatement = t.blockStatement( [], [t.directive(t.directiveLiteral("use strict"))] ); - let output = generate.default(blockStatement).code; + const output = generate.default(blockStatement).code; assert.equal(output, [ "{", " \"use strict\";", @@ -245,7 +245,7 @@ describe("programmatic generation", function() { }); it("flow object indentation", function() { - let objectStatement = t.objectTypeAnnotation( + const objectStatement = t.objectTypeAnnotation( [ t.objectTypeProperty( t.identifier("bar"), @@ -256,7 +256,7 @@ describe("programmatic generation", function() { null ); - let output = generate.default(objectStatement).code; + const output = generate.default(objectStatement).code; assert.equal(output, [ "{", " bar: string;", @@ -265,7 +265,7 @@ describe("programmatic generation", function() { }); it("flow object indentation with empty leading ObjectTypeProperty", function() { - let objectStatement = t.objectTypeAnnotation( + const objectStatement = t.objectTypeAnnotation( [], [ t.objectTypeIndexer( @@ -276,7 +276,7 @@ describe("programmatic generation", function() { ] ); - let output = generate.default(objectStatement).code; + const output = generate.default(objectStatement).code; assert.equal(output, [ "{", @@ -288,29 +288,29 @@ describe("programmatic generation", function() { describe("whitespace", function () { it("empty token list", function () { - let w = new Whitespace([]); + const w = new Whitespace([]); assert.equal(w.getNewlinesBefore(t.stringLiteral("1")), 0); }); }); -let suites = require("babel-helper-fixtures").default(__dirname + "/fixtures"); +const suites = require("babel-helper-fixtures").default(__dirname + "/fixtures"); suites.forEach(function (testSuite) { describe("generation/" + testSuite.title, function () { _.each(testSuite.tests, function (task) { it(task.title, !task.disabled && function () { - let expect = task.expect; - let actual = task.actual; - let actualCode = actual.code; + const expect = task.expect; + const actual = task.actual; + const actualCode = actual.code; if (actualCode) { - let actualAst = parse(actualCode, { + const actualAst = parse(actualCode, { filename: actual.loc, plugins: ["*"], strictMode: false, sourceType: "module", }); - let result = generate.default(actualAst, task.options, actualCode); + const result = generate.default(actualAst, task.options, actualCode); if (!expect.code && result.code && fs.statSync(path.dirname(expect.loc)).isDirectory() && !process.env.CI) { console.log(`New test file created: ${expect.loc}`); diff --git a/packages/babel-helper-bindify-decorators/src/index.js b/packages/babel-helper-bindify-decorators/src/index.js index 750c00f56f..debc145a4f 100644 --- a/packages/babel-helper-bindify-decorators/src/index.js +++ b/packages/babel-helper-bindify-decorators/src/index.js @@ -2,15 +2,15 @@ import type { NodePath } from "babel-traverse"; import * as t from "babel-types"; export default function bindifyDecorators(decorators: Array): Array { - for (let decoratorPath of decorators) { - let decorator = decoratorPath.node; - let expression = decorator.expression; + for (const decoratorPath of decorators) { + const decorator = decoratorPath.node; + const expression = decorator.expression; if (!t.isMemberExpression(expression)) continue; - let temp = decoratorPath.scope.maybeGenerateMemoised(expression.object); + const temp = decoratorPath.scope.maybeGenerateMemoised(expression.object); let ref; - let nodes = []; + const nodes = []; if (temp) { ref = temp; diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js index 0c07eecf9f..b3e41d9f7e 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js @@ -5,7 +5,7 @@ export default function (opts: { build: Function; operator: string; }): Object { - let visitor = {}; + const visitor = {}; function isAssignment(node) { return node && node.operator === opts.operator + "="; @@ -19,11 +19,11 @@ export default function (opts: { // hit the `AssignmentExpression` one below if (path.isCompletionRecord()) return; - let expr = path.node.expression; + const expr = path.node.expression; if (!isAssignment(expr)) return; - let nodes = []; - let exploded = explode(expr.left, nodes, file, path.scope, true); + const nodes = []; + const exploded = explode(expr.left, nodes, file, path.scope, true); nodes.push(t.expressionStatement( buildAssignment(exploded.ref, opts.build(exploded.uid, expr.right)) @@ -33,17 +33,17 @@ export default function (opts: { }; visitor.AssignmentExpression = function (path, file) { - let { node, scope } = path; + const { node, scope } = path; if (!isAssignment(node)) return; - let nodes = []; - let exploded = explode(node.left, nodes, file, scope); + const nodes = []; + const exploded = explode(node.left, nodes, file, scope); nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right))); path.replaceWithMultiple(nodes); }; visitor.BinaryExpression = function (path) { - let { node } = path; + const { node } = path; if (node.operator === opts.operator) { path.replaceWith(opts.build(node.left, node.right)); } diff --git a/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js b/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js index bf8f9d48b9..335f2e50fa 100644 --- a/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js +++ b/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js @@ -8,7 +8,7 @@ export default function ( is: Function; }, ) { - let buildAssignment = function (left, right) { + const buildAssignment = function (left, right) { return t.assignmentExpression("=", left, right); }; @@ -16,12 +16,12 @@ export default function ( // hit the `AssignmentExpression` one below if (path.isCompletionRecord()) return; - let expr = path.node.expression; + const expr = path.node.expression; if (!opts.is(expr, file)) return; - let nodes = []; + const nodes = []; - let exploded = explode(expr.left, nodes, file, path.scope); + const exploded = explode(expr.left, nodes, file, path.scope); nodes.push(t.ifStatement( opts.build(exploded.uid, file), @@ -32,11 +32,11 @@ export default function ( }; exports.AssignmentExpression = function (path, file) { - let node = path.node; + const node = path.node; if (!opts.is(node, file)) return; - let nodes = []; - let exploded = explode(node.left, nodes, file, path.scope); + const nodes = []; + const exploded = explode(node.left, nodes, file, path.scope); nodes.push(t.logicalExpression( "&&", diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 2438070df0..1a0a1ca626 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -11,7 +11,7 @@ type ElementState = { }; export default function (opts) { - let visitor = {}; + const visitor = {}; visitor.JSXNamespacedName = function (path) { throw path.buildCodeFrameError("Namespace tags are not supported. ReactJSX is not XML."); @@ -19,7 +19,7 @@ export default function (opts) { visitor.JSXElement = { exit(path, file) { - let callExpr = buildElementCall(path.get("openingElement"), file); + const callExpr = buildElementCall(path.get("openingElement"), file); callExpr.arguments = callExpr.arguments.concat(path.node.children); @@ -61,7 +61,7 @@ export default function (opts) { } function convertAttribute(node) { - let value = convertAttributeValue(node.value || t.booleanLiteral(true)); + const value = convertAttributeValue(node.value || t.booleanLiteral(true)); if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) { value.value = value.value.replace(/\n\s+/g, " "); @@ -79,8 +79,8 @@ export default function (opts) { function buildElementCall(path, file) { path.parent.children = t.react.buildChildren(path.parent); - let tagExpr = convertJSXIdentifier(path.node.name, path.node); - let args = []; + const tagExpr = convertJSXIdentifier(path.node.name, path.node); + const args = []; let tagName; if (t.isIdentifier(tagExpr)) { @@ -89,7 +89,7 @@ export default function (opts) { tagName = tagExpr.value; } - let state: ElementState = { + const state: ElementState = { tagExpr: tagExpr, tagName: tagName, args: args @@ -124,9 +124,9 @@ export default function (opts) { function buildOpeningElementAttributes(attribs, file) { let _props = []; - let objs = []; + const objs = []; - let useBuiltIns = file.opts.useBuiltIns || false; + const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { throw new Error("transform-react-jsx currently only accepts a boolean option for useBuiltIns (defaults to false)"); } @@ -139,7 +139,7 @@ export default function (opts) { } while (attribs.length) { - let prop = attribs.shift(); + const prop = attribs.shift(); if (t.isJSXSpreadAttribute(prop)) { pushProps(); objs.push(prop.argument); diff --git a/packages/babel-helper-call-delegate/src/index.js b/packages/babel-helper-call-delegate/src/index.js index 1319a662fc..653a48b172 100644 --- a/packages/babel-helper-call-delegate/src/index.js +++ b/packages/babel-helper-call-delegate/src/index.js @@ -2,7 +2,7 @@ import hoistVariables from "babel-helper-hoist-variables"; import type { NodePath } from "babel-traverse"; import * as t from "babel-types"; -let visitor = { +const visitor = { enter(path, state) { if (path.isThisExpression()) { state.foundThis = true; @@ -19,8 +19,8 @@ let visitor = { }; export default function (path: NodePath, scope = path.scope) { - let { node } = path; - let container = t.functionExpression(null, [], node.body, node.generator, node.async); + const { node } = path; + const container = t.functionExpression(null, [], node.body, node.generator, node.async); let callee = container; let args = []; @@ -28,7 +28,7 @@ export default function (path: NodePath, scope = path.scope) { // todo: only hoist if necessary hoistVariables(path, (id) => scope.push({ id })); - let state = { + const state = { foundThis: false, foundArguments: false }; diff --git a/packages/babel-helper-define-map/src/index.js b/packages/babel-helper-define-map/src/index.js index 6536747555..09de4f9b58 100644 --- a/packages/babel-helper-define-map/src/index.js +++ b/packages/babel-helper-define-map/src/index.js @@ -16,7 +16,7 @@ function toKind(node: Object) { } export function push(mutatorMap: Object, node: Object, kind: string, file, scope?): Object { - let alias = t.toKeyAlias(node); + const alias = t.toKeyAlias(node); // @@ -36,7 +36,7 @@ export function push(mutatorMap: Object, node: Object, kind: string, file, scope } if (node.decorators) { - let decorators = map.decorators = map.decorators || t.arrayExpression([]); + const decorators = map.decorators = map.decorators || t.arrayExpression([]); decorators.elements = decorators.elements.concat(node.decorators.map((dec) => dec.expression).reverse()); } @@ -58,7 +58,7 @@ export function push(mutatorMap: Object, node: Object, kind: string, file, scope value.returnType = node.returnType; } - let inheritedKind = toKind(node); + const inheritedKind = toKind(node); if (!kind || inheritedKind !== "value") { kind = inheritedKind; } @@ -77,7 +77,7 @@ export function push(mutatorMap: Object, node: Object, kind: string, file, scope } export function hasComputed(mutatorMap: Object): boolean { - for (let key in mutatorMap) { + for (const key in mutatorMap) { if (mutatorMap[key]._computed) { return true; } @@ -86,11 +86,11 @@ export function hasComputed(mutatorMap: Object): boolean { } export function toComputedObjectFromClass(obj: Object): Object { - let objExpr = t.arrayExpression([]); + const objExpr = t.arrayExpression([]); for (let i = 0; i < obj.properties.length; i++) { - let prop = obj.properties[i]; - let val = prop.value; + const prop = obj.properties[i]; + const val = prop.value; val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop))); objExpr.elements.push(val); } @@ -99,20 +99,20 @@ export function toComputedObjectFromClass(obj: Object): Object { } export function toClassObject(mutatorMap: Object): Object { - let objExpr = t.objectExpression([]); + const objExpr = t.objectExpression([]); each(mutatorMap, function (map) { - let mapNode = t.objectExpression([]); + const mapNode = t.objectExpression([]); - let propNode = t.objectProperty(map._key, mapNode, map._computed); + const propNode = t.objectProperty(map._key, mapNode, map._computed); each(map, function (node, key) { if (key[0] === "_") return; - let inheritNode = node; + const inheritNode = node; if (t.isClassMethod(node) || t.isClassProperty(node)) node = node.value; - let prop = t.objectProperty(t.identifier(key), node); + const prop = t.objectProperty(t.identifier(key), node); t.inheritsComments(prop, inheritNode); t.removeComments(inheritNode); diff --git a/packages/babel-helper-explode-assignable-expression/src/index.js b/packages/babel-helper-explode-assignable-expression/src/index.js index 8ffdd95fa2..04052f5e34 100644 --- a/packages/babel-helper-explode-assignable-expression/src/index.js +++ b/packages/babel-helper-explode-assignable-expression/src/index.js @@ -31,7 +31,7 @@ function getObjRef(node, nodes, file, scope) { throw new Error(`We can't explode this node type ${node.type}`); } - let temp = scope.generateUidIdentifierBasedOnNode(ref); + const temp = scope.generateUidIdentifierBasedOnNode(ref); nodes.push(t.variableDeclaration("var", [ t.variableDeclarator(temp, ref) ])); @@ -39,11 +39,11 @@ function getObjRef(node, nodes, file, scope) { } function getPropRef(node, nodes, file, scope) { - let prop = node.property; - let key = t.toComputedKey(node, prop); + const prop = node.property; + const key = t.toComputedKey(node, prop); if (t.isLiteral(key) && t.isPureish(key)) return key; - let temp = scope.generateUidIdentifierBasedOnNode(prop); + const temp = scope.generateUidIdentifierBasedOnNode(prop); nodes.push(t.variableDeclaration("var", [ t.variableDeclarator(temp, prop) ])); @@ -73,8 +73,8 @@ export default function ( ref = node; uid = obj; } else { - let prop = getPropRef(node, nodes, file, scope); - let computed = node.computed || t.isLiteral(prop); + const prop = getPropRef(node, nodes, file, scope); + const computed = node.computed || t.isLiteral(prop); uid = ref = t.memberExpression(obj, prop, computed); } diff --git a/packages/babel-helper-explode-class/src/index.js b/packages/babel-helper-explode-class/src/index.js index 1091e1ba06..2ced5be5b1 100644 --- a/packages/babel-helper-explode-class/src/index.js +++ b/packages/babel-helper-explode-class/src/index.js @@ -5,12 +5,12 @@ import * as t from "babel-types"; export default function (classPath) { classPath.assertClass(); - let memoisedExpressions = []; + const memoisedExpressions = []; function maybeMemoise(path) { if (!path.node || path.isPure()) return; - let uid = classPath.scope.generateDeclaredUidIdentifier(); + const uid = classPath.scope.generateDeclaredUidIdentifier(); memoisedExpressions.push(t.assignmentExpression("=", uid, path.node)); path.replaceWith(uid); } @@ -24,7 +24,7 @@ export default function (classPath) { // bind decorators if they're member expressions bindifyDecorators(paths); - for (let path of paths) { + for (const path of paths) { maybeMemoise(path); } } @@ -32,8 +32,8 @@ export default function (classPath) { maybeMemoise(classPath.get("superClass")); memoiseDecorators(classPath.get("decorators"), true); - let methods: Array = classPath.get("body.body"); - for (let methodPath of methods) { + const methods: Array = classPath.get("body.body"); + for (const methodPath of methods) { if (methodPath.is("computed")) { maybeMemoise(methodPath.get("key")); } diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index 40faaf1530..e7fcebf1d9 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -41,23 +41,23 @@ function shouldIgnore(name, blacklist?: Array) { return true; } - let ext = path.extname(name); - let base = path.basename(name, ext); + const ext = path.extname(name); + const base = path.basename(name, ext); return name[0] === "." || ext === ".md" || base === "LICENSE" || base === "options"; } export default function get(entryLoc): Array { - let suites = []; + const suites = []; let rootOpts = {}; - let rootOptsLoc = resolve(entryLoc + "/options"); + const rootOptsLoc = resolve(entryLoc + "/options"); if (rootOptsLoc) rootOpts = require(rootOptsLoc); - for (let suiteName of fs.readdirSync(entryLoc)) { + for (const suiteName of fs.readdirSync(entryLoc)) { if (shouldIgnore(suiteName)) continue; - let suite = { + const suite = { options: _.clone(rootOpts), tests: [], title: humanize(suiteName), @@ -67,24 +67,24 @@ export default function get(entryLoc): Array { assertDirectory(suite.filename); suites.push(suite); - let suiteOptsLoc = resolve(suite.filename + "/options"); + const suiteOptsLoc = resolve(suite.filename + "/options"); if (suiteOptsLoc) suite.options = require(suiteOptsLoc); - for (let taskName of fs.readdirSync(suite.filename)) { + for (const taskName of fs.readdirSync(suite.filename)) { push(taskName, suite.filename + "/" + taskName); } function push(taskName, taskDir) { - let actualLocAlias = suiteName + "/" + taskName + "/actual.js"; + const actualLocAlias = suiteName + "/" + taskName + "/actual.js"; let expectLocAlias = suiteName + "/" + taskName + "/expected.js"; - let execLocAlias = suiteName + "/" + taskName + "/exec.js"; + const execLocAlias = suiteName + "/" + taskName + "/exec.js"; - let actualLoc = taskDir + "/actual.js"; + const actualLoc = taskDir + "/actual.js"; let expectLoc = taskDir + "/expected.js"; let execLoc = taskDir + "/exec.js"; if (fs.statSync(taskDir).isFile()) { - let ext = path.extname(taskDir); + const ext = path.extname(taskDir); if (ext !== ".js" && ext !== ".module.js") return; execLoc = taskDir; @@ -95,12 +95,12 @@ export default function get(entryLoc): Array { expectLocAlias += "on"; } - let taskOpts = _.cloneDeep(suite.options); + const taskOpts = _.cloneDeep(suite.options); - let taskOptsLoc = resolve(taskDir + "/options"); + const taskOptsLoc = resolve(taskDir + "/options"); if (taskOptsLoc) _.merge(taskOpts, require(taskOptsLoc)); - let test = { + const test = { optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, title: humanize(taskName, true), disabled: taskName[0] === ".", @@ -130,12 +130,12 @@ export default function get(entryLoc): Array { suite.tests.push(test); - let sourceMappingsLoc = taskDir + "/source-mappings.json"; + const sourceMappingsLoc = taskDir + "/source-mappings.json"; if (fs.existsSync(sourceMappingsLoc)) { test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc)); } - let sourceMapLoc = taskDir + "/source-map.json"; + const sourceMapLoc = taskDir + "/source-map.json"; if (fs.existsSync(sourceMapLoc)) { test.sourceMap = JSON.parse(readFile(sourceMapLoc)); } @@ -146,12 +146,12 @@ export default function get(entryLoc): Array { } export function multiple(entryLoc, ignore?: Array) { - let categories = {}; + const categories = {}; - for (let name of fs.readdirSync(entryLoc)) { + for (const name of fs.readdirSync(entryLoc)) { if (shouldIgnore(name, ignore)) continue; - let loc = path.join(entryLoc, name); + const loc = path.join(entryLoc, name); assertDirectory(loc); categories[name] = get(loc); diff --git a/packages/babel-helper-function-name/src/index.js b/packages/babel-helper-function-name/src/index.js index 1e6d8add9d..7623bf0a10 100644 --- a/packages/babel-helper-function-name/src/index.js +++ b/packages/babel-helper-function-name/src/index.js @@ -4,7 +4,7 @@ import getFunctionArity from "babel-helper-get-function-arity"; import template from "babel-template"; import * as t from "babel-types"; -let buildPropertyMethodAssignmentWrapper = template(` +const buildPropertyMethodAssignmentWrapper = template(` (function (FUNCTION_KEY) { function FUNCTION_ID() { return FUNCTION_KEY.apply(this, arguments); @@ -18,7 +18,7 @@ let buildPropertyMethodAssignmentWrapper = template(` })(FUNCTION) `); -let buildGeneratorPropertyMethodAssignmentWrapper = template(` +const buildGeneratorPropertyMethodAssignmentWrapper = template(` (function (FUNCTION_KEY) { function* FUNCTION_ID() { return yield* FUNCTION_KEY.apply(this, arguments); @@ -32,14 +32,14 @@ let buildGeneratorPropertyMethodAssignmentWrapper = template(` })(FUNCTION) `); -let visitor = { +const visitor = { "ReferencedIdentifier|BindingIdentifier"(path, state) { // check if this node matches our function id if (path.node.name !== state.name) return; // check that we don't have a local variable declared as that removes the need // for the wrapper - let localDeclar = path.scope.getBindingIdentifier(state.name); + const localDeclar = path.scope.getBindingIdentifier(state.name); if (localDeclar !== state.outerDeclar) return; state.selfReference = true; @@ -59,7 +59,7 @@ function wrap(state, method, id, scope) { // need to add a wrapper since we can't change the references let build = buildPropertyMethodAssignmentWrapper; if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper; - let template = build({ + const template = build({ FUNCTION: method, FUNCTION_ID: id, FUNCTION_KEY: scope.generateUidIdentifier(id.name) @@ -68,7 +68,7 @@ function wrap(state, method, id, scope) { // shim in dummy params to retain function arity, if you try to read the // source then you'll get the original since it's proxied so it's all good - let params = template.callee.body.body[0].params; + const params = template.callee.body.body[0].params; for (let i = 0, len = getFunctionArity(method); i < len; i++) { params.push(scope.generateUidIdentifier("x")); } @@ -82,7 +82,7 @@ function wrap(state, method, id, scope) { } function visit(node, name, scope) { - let state = { + const state = { selfAssignment: false, selfReference: false, outerDeclar: scope.getBindingIdentifier(name), @@ -93,7 +93,7 @@ function visit(node, name, scope) { // check to see if we have a local binding of the id we're setting inside of // the function, this is important as there are caveats associated - let binding = scope.getOwnBinding(name); + const binding = scope.getOwnBinding(name); if (binding) { if (binding.kind === "param") { @@ -139,7 +139,7 @@ export default function ({ node, parent, scope, id }) { id = parent.id; if (t.isIdentifier(id)) { - let binding = scope.parent.getBinding(id.name); + const binding = scope.parent.getBinding(id.name); if (binding && binding.constant && scope.getBinding(id.name) === binding) { // always going to reference this method node.id = id; @@ -171,6 +171,6 @@ export default function ({ node, parent, scope, id }) { // a local binding. id[t.NOT_LOCAL_BINDING] = true; - let state = visit(node, name, scope); + const state = visit(node, name, scope); return wrap(state, node, id, scope) || node; } diff --git a/packages/babel-helper-get-function-arity/src/index.js b/packages/babel-helper-get-function-arity/src/index.js index a3c60a5a61..c54613f6fe 100644 --- a/packages/babel-helper-get-function-arity/src/index.js +++ b/packages/babel-helper-get-function-arity/src/index.js @@ -1,9 +1,9 @@ import * as t from "babel-types"; export default function (node): number { - let params: Array = node.params; + const params: Array = node.params; for (let i = 0; i < params.length; i++) { - let param = params[i]; + const param = params[i]; if (t.isAssignmentPattern(param) || t.isRestElement(param)) { return i; } diff --git a/packages/babel-helper-hoist-variables/src/index.js b/packages/babel-helper-hoist-variables/src/index.js index de36a3f591..dafcc98ca8 100644 --- a/packages/babel-helper-hoist-variables/src/index.js +++ b/packages/babel-helper-hoist-variables/src/index.js @@ -1,6 +1,6 @@ import * as t from "babel-types"; -let visitor = { +const visitor = { Scope(path, state) { if (state.kind === "let") path.skip(); }, @@ -12,12 +12,12 @@ let visitor = { VariableDeclaration(path, state) { if (state.kind && path.node.kind !== state.kind) return; - let nodes = []; + const nodes = []; - let declarations: Array = path.get("declarations"); + const declarations: Array = path.get("declarations"); let firstId; - for (let declar of declarations) { + for (const declar of declarations) { firstId = declar.node.id; if (declar.node.init) { @@ -26,7 +26,7 @@ let visitor = { )); } - for (let name in declar.getBindingIdentifiers()) { + for (const name in declar.getBindingIdentifiers()) { state.emit(t.identifier(name), name); } } diff --git a/packages/babel-helper-plugin-test-runner/src/index.js b/packages/babel-helper-plugin-test-runner/src/index.js index 749f964aa3..37bcc4360c 100644 --- a/packages/babel-helper-plugin-test-runner/src/index.js +++ b/packages/babel-helper-plugin-test-runner/src/index.js @@ -2,6 +2,6 @@ import testRunner from "babel-helper-transform-fixture-test-runner"; import path from "path"; export default function (loc) { - let name = path.basename(path.dirname(loc)); + const name = path.basename(path.dirname(loc)); testRunner(loc + "/fixtures", name); } diff --git a/packages/babel-helper-regex/src/index.js b/packages/babel-helper-regex/src/index.js index b59a30f7d5..998bbe4716 100644 --- a/packages/babel-helper-regex/src/index.js +++ b/packages/babel-helper-regex/src/index.js @@ -6,7 +6,7 @@ export function is(node: Object, flag: string): boolean { } export function pullFlag(node: Object, flag: string) { - let flags = node.flags.split(""); + const flags = node.flags.split(""); if (node.flags.indexOf(flag) < 0) return; pull(flags, flag); node.flags = flags.join(""); diff --git a/packages/babel-helper-remap-async-to-generator/src/for-await.js b/packages/babel-helper-remap-async-to-generator/src/for-await.js index 5e3fe1f0bc..77b7738b7c 100644 --- a/packages/babel-helper-remap-async-to-generator/src/for-await.js +++ b/packages/babel-helper-remap-async-to-generator/src/for-await.js @@ -2,7 +2,7 @@ import * as t from "babel-types"; import template from "babel-template"; import traverse from "babel-traverse"; -let buildForAwait = template(` +const buildForAwait = template(` function* wrapper() { var ITERATOR_COMPLETION = true; var ITERATOR_HAD_ERROR_KEY = false; @@ -35,7 +35,7 @@ let buildForAwait = template(` } `); -let forAwaitVisitor = { +const forAwaitVisitor = { noScope: true, Identifier(path, replacements) { @@ -45,7 +45,7 @@ let forAwaitVisitor = { }, CallExpression(path, replacements) { - let callee = path.node.callee; + const callee = path.node.callee; // if no await wrapping is being applied, unwrap the call expression if (t.isIdentifier(callee) && callee.name === "AWAIT" && !replacements.AWAIT) { @@ -55,11 +55,11 @@ let forAwaitVisitor = { }; export default function (path, helpers) { - let { node, scope, parent } = path; + const { node, scope, parent } = path; - let stepKey = scope.generateUidIdentifier("step"); - let stepValue = scope.generateUidIdentifier("value"); - let left = node.left; + const stepKey = scope.generateUidIdentifier("step"); + const stepValue = scope.generateUidIdentifier("value"); + const left = node.left; let declar; if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { @@ -89,9 +89,9 @@ export default function (path, helpers) { // remove generator function wrapper template = template.body.body; - let isLabeledParent = t.isLabeledStatement(parent); - let tryBody = template[3].block.body; - let loop = tryBody[0]; + const isLabeledParent = t.isLabeledStatement(parent); + const tryBody = template[3].block.body; + const loop = tryBody[0]; if (isLabeledParent) { tryBody[0] = t.labeledStatement(parent.label, loop); diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index 840a195d8a..deca1eb650 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -6,7 +6,7 @@ import template from "babel-template"; import * as t from "babel-types"; import rewriteForAwait from "./for-await"; -let buildWrapper = template(` +const buildWrapper = template(` (() => { var REF = FUNCTION; return function NAME(PARAMS) { @@ -15,7 +15,7 @@ let buildWrapper = template(` }) `); -let namedBuildWrapper = template(` +const namedBuildWrapper = template(` (() => { var REF = FUNCTION; function NAME(PARAMS) { @@ -25,7 +25,7 @@ let namedBuildWrapper = template(` }) `); -let awaitVisitor = { +const awaitVisitor = { Function(path) { if (path.isArrowFunctionExpression() && !path.node.async) { path.arrowFunctionToShadowed(); @@ -42,15 +42,15 @@ let awaitVisitor = { }, ForAwaitStatement(path, { file, wrapAwait }) { - let { node } = path; + const { node } = path; - let build = rewriteForAwait(path, { + const build = rewriteForAwait(path, { getAsyncIterator: file.addHelper("asyncIterator"), wrapAwait }); - let { declar, loop } = build; - let block = loop.body; + const { declar, loop } = build; + const block = loop.body; // ensure that it's a block so we can take all its statements path.ensureBlock(); @@ -77,12 +77,12 @@ let awaitVisitor = { }; function classOrObjectMethod(path: NodePath, callId: Object) { - let node = path.node; - let body = node.body; + const node = path.node; + const body = node.body; node.async = false; - let container = t.functionExpression(null, [], t.blockStatement(body.body), true); + const container = t.functionExpression(null, [], t.blockStatement(body.body), true); container.shadow = true; body.body = [ t.returnStatement(t.callExpression( @@ -97,9 +97,9 @@ function classOrObjectMethod(path: NodePath, callId: Object) { } function plainFunction(path: NodePath, callId: Object) { - let node = path.node; - let isDeclaration = path.isFunctionDeclaration(); - let asyncFnId = node.id; + const node = path.node; + const isDeclaration = path.isFunctionDeclaration(); + const asyncFnId = node.id; let wrapper = buildWrapper; if (path.isArrowFunctionExpression()) { @@ -117,8 +117,8 @@ function plainFunction(path: NodePath, callId: Object) { node.type = "FunctionExpression"; } - let built = t.callExpression(callId, [node]); - let container = wrapper({ + const built = t.callExpression(callId, [node]); + const container = wrapper({ NAME: asyncFnId, REF: path.scope.generateUidIdentifier("ref"), FUNCTION: built, @@ -137,7 +137,7 @@ function plainFunction(path: NodePath, callId: Object) { }).expression; if (isDeclaration) { - let declar = t.variableDeclaration("let", [ + const declar = t.variableDeclaration("let", [ t.variableDeclarator( t.identifier(asyncFnId.name), t.callExpression(container, []) @@ -147,7 +147,7 @@ function plainFunction(path: NodePath, callId: Object) { path.replaceWith(declar); } else { - let retFunction = container.body.body[1].argument; + const retFunction = container.body.body[1].argument; if (!asyncFnId) { nameFunction({ node: retFunction, diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index 8465df1936..8214753552 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -6,7 +6,7 @@ import * as messages from "babel-messages"; import * as t from "babel-types"; // ✌️ -let HARDCORE_THIS_REF = Symbol(); +const HARDCORE_THIS_REF = Symbol(); function isIllegalBareSuper(node, parent) { if (!t.isSuper(node)) return false; @@ -46,7 +46,7 @@ function getPrototypeOfExpression(objectRef, isStatic) { ); } -let visitor = { +const visitor = { Function(path) { if (!path.inShadow("this")) { path.skip(); @@ -69,9 +69,9 @@ let visitor = { let callback = state.specHandle; if (state.isLoose) callback = state.looseHandle; - let isBareSuper = path.isCallExpression() && path.get("callee").isSuper(); + const isBareSuper = path.isCallExpression() && path.get("callee").isSuper(); - let result = callback.call(state, path); + const result = callback.call(state, path); if (result) { state.hasSuper = true; @@ -185,8 +185,8 @@ export default class ReplaceSupers { } getLooseSuperProperty(id: Object, parent: Object) { - let methodNode = this.methodNode; - let superRef = this.superRef || t.identifier("Function"); + const methodNode = this.methodNode; + const superRef = this.superRef || t.identifier("Function"); if (parent.property === id) { return; @@ -201,11 +201,11 @@ export default class ReplaceSupers { } looseHandle(path: NodePath) { - let node = path.node; + const node = path.node; if (path.isSuper()) { return this.getLooseSuperProperty(node, path.parent); } else if (path.isCallExpression()) { - let callee = node.callee; + const callee = node.callee; if (!t.isMemberExpression(callee)) return; if (!t.isSuper(callee.object)) return; @@ -239,15 +239,15 @@ export default class ReplaceSupers { let computed; let args; - let parent = path.parent; - let node = path.node; + const parent = path.parent; + const node = path.node; if (isIllegalBareSuper(node, parent)) { throw path.buildCodeFrameError(messages.get("classesIllegalBareSuper")); } if (t.isCallExpression(node)) { - let callee = node.callee; + const callee = node.callee; if (t.isSuper(callee)) { return; } else if (isMemberExpressionSuper(callee)) { @@ -261,13 +261,13 @@ export default class ReplaceSupers { property = node.property; computed = node.computed; } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) { - let binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1)); + const binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1)); if (node.prefix) { // ++super.foo; -> super.foo += 1; return this.specHandleAssignmentExpression(null, path, binary); } else { // super.foo++; -> let _ref = super.foo; super.foo = _ref + 1; - let ref = path.scope.generateUidIdentifier("ref"); + const ref = path.scope.generateUidIdentifier("ref"); return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref)); } } else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) { @@ -276,7 +276,7 @@ export default class ReplaceSupers { if (!property) return; - let superProperty = this.getSuperProperty(property, computed); + const superProperty = this.getSuperProperty(property, computed); if (args) { return this.optimiseCall(superProperty, args); @@ -286,7 +286,7 @@ export default class ReplaceSupers { } optimiseCall(callee, args) { - let thisNode = t.thisExpression(); + const thisNode = t.thisExpression(); thisNode[HARDCORE_THIS_REF] = true; return optimiseCall(callee, thisNode, args); } diff --git a/packages/babel-helper-transform-fixture-test-runner/src/helpers.js b/packages/babel-helper-transform-fixture-test-runner/src/helpers.js index bd4a61d3b9..f289042638 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/helpers.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/helpers.js @@ -16,4 +16,4 @@ export function multiline(arr) { return arr.join("\n"); } -export let assertArrayEquals = assert.deepEqual; +export const assertArrayEquals = assert.deepEqual; diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 9fced3069f..11220e77ff 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -11,7 +11,7 @@ import "babel-polyfill"; import fs from "fs"; import path from "path"; -let babelHelpers = eval(buildExternalHelpers(null, "var")); +const babelHelpers = eval(buildExternalHelpers(null, "var")); function wrapPackagesArray(type, names, optionsDir) { return (names || []).map(function (val) { @@ -36,14 +36,14 @@ function wrapPackagesArray(type, names, optionsDir) { } function run(task) { - let actual = task.actual; - let expect = task.expect; - let exec = task.exec; - let opts = task.options; - let optionsDir = task.optionsDir; + const actual = task.actual; + const expect = task.expect; + const exec = task.exec; + const opts = task.options; + const optionsDir = task.optionsDir; function getOpts(self) { - let newOpts = _.merge({ + const newOpts = _.merge({ filename: self.loc, }, opts); @@ -64,8 +64,8 @@ function run(task) { let resultExec; if (execCode) { - let execOpts = getOpts(exec); - let execDirName = path.dirname(exec.loc); + const execOpts = getOpts(exec); + const execDirName = path.dirname(exec.loc); result = babel.transform(execCode, execOpts); execCode = result.code; @@ -79,7 +79,7 @@ function run(task) { } let actualCode = actual.code; - let expectCode = expect.code; + const expectCode = expect.code; if (!execCode || actualCode) { result = babel.transform(actualCode, getOpts(actual)); if (!expect.code && result.code && !opts.throws && fs.statSync(path.dirname(expect.loc)).isDirectory() && !process.env.CI) { @@ -96,12 +96,12 @@ function run(task) { } if (task.sourceMappings) { - let consumer = new sourceMap.SourceMapConsumer(result.map); + const consumer = new sourceMap.SourceMapConsumer(result.map); _.each(task.sourceMappings, function (mapping) { - let actual = mapping.original; + const actual = mapping.original; - let expect = consumer.originalPositionFor(mapping.generated); + const expect = consumer.originalPositionFor(mapping.generated); chai.expect({ line: expect.line, column: expect.column }).to.deep.equal(actual); }); } @@ -112,7 +112,7 @@ function run(task) { } function runExec(opts, execCode, execDirname) { - let sandbox = { + const sandbox = { ...helpers, babelHelpers, assert: chai.assert, @@ -124,7 +124,7 @@ function runExec(opts, execCode, execDirname) { } }; - let fn = new Function(...Object.keys(sandbox), execCode); + const fn = new Function(...Object.keys(sandbox), execCode); return fn.apply(null, Object.values(sandbox)); } @@ -135,13 +135,13 @@ export default function ( taskOpts = {}, dynamicOpts?: Function, ) { - let suites = getFixtures(fixturesLoc); + const suites = getFixtures(fixturesLoc); - for (let testSuite of suites) { + for (const testSuite of suites) { if (_.includes(suiteOpts.ignoreSuites, testSuite.title)) continue; describe(name + "/" + testSuite.title, function () { - for (let task of testSuite.tests) { + for (const task of testSuite.tests) { if (_.includes(suiteOpts.ignoreTasks, task.title) || _.includes(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) continue; @@ -163,7 +163,7 @@ export default function ( if (dynamicOpts) dynamicOpts(task.options, task); - let throwMsg = task.options.throws; + const 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 @@ -174,7 +174,7 @@ export default function ( }); } else { if (task.exec.code) { - let result = run(task); + const result = run(task); if (result && typeof result.then === "function") { return result; } diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index 87a58c3dc9..cdd63768da 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -2,7 +2,7 @@ import template from "babel-template"; -let helpers = {}; +const helpers = {}; export default helpers; helpers.typeof = template(` diff --git a/packages/babel-helpers/src/index.js b/packages/babel-helpers/src/index.js index e742f224a3..207318cf27 100644 --- a/packages/babel-helpers/src/index.js +++ b/packages/babel-helpers/src/index.js @@ -3,13 +3,13 @@ import helpers from "./helpers"; export function get(name) { - let fn = helpers[name]; + const fn = helpers[name]; if (!fn) throw new ReferenceError(`Unknown helper ${name}`); return fn().expression; } -export let list = Object.keys(helpers) +export const list = Object.keys(helpers) .map((name) => name[0] === "_" ? name.slice(1) : name) .filter((name) => name !== "__esModule"); diff --git a/packages/babel-messages/src/index.js b/packages/babel-messages/src/index.js index 3fce2e2cf2..7064bd69b9 100644 --- a/packages/babel-messages/src/index.js +++ b/packages/babel-messages/src/index.js @@ -48,7 +48,7 @@ export const MESSAGES = { */ export function get(key: string, ...args: Array): string { - let msg = MESSAGES[key]; + const msg = MESSAGES[key]; if (!msg) throw new ReferenceError(`Unknown message ${JSON.stringify(key)}`); // stringify args diff --git a/packages/babel-plugin-check-es2015-constants/src/index.js b/packages/babel-plugin-check-es2015-constants/src/index.js index 4269b0385c..b090052bf5 100644 --- a/packages/babel-plugin-check-es2015-constants/src/index.js +++ b/packages/babel-plugin-check-es2015-constants/src/index.js @@ -2,11 +2,11 @@ export default function ({ messages }) { return { visitor: { Scope({ scope }) { - for (let name in scope.bindings) { - let binding = scope.bindings[name]; + for (const name in scope.bindings) { + const binding = scope.bindings[name]; if (binding.kind !== "const" && binding.kind !== "module") continue; - for (let violation of (binding.constantViolations: Array)) { + for (const violation of (binding.constantViolations: Array)) { throw violation.buildCodeFrameError(messages.get("readOnly", name)); } } diff --git a/packages/babel-plugin-transform-async-generator-functions/src/index.js b/packages/babel-plugin-transform-async-generator-functions/src/index.js index 409b14f364..3da5e7d19b 100644 --- a/packages/babel-plugin-transform-async-generator-functions/src/index.js +++ b/packages/babel-plugin-transform-async-generator-functions/src/index.js @@ -1,14 +1,14 @@ import remapAsyncToGenerator from "babel-helper-remap-async-to-generator"; export default function ({ types: t }) { - let yieldStarVisitor = { + const yieldStarVisitor = { Function(path) { path.skip(); }, YieldExpression({ node }, state) { if (!node.delegate) return; - let callee = state.addHelper("asyncGeneratorDelegate"); + const callee = state.addHelper("asyncGeneratorDelegate"); node.argument = t.callExpression(callee, [ t.callExpression(state.addHelper("asyncIterator"), [node.argument]), t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("await")) diff --git a/packages/babel-plugin-transform-class-constructor-call/src/index.js b/packages/babel-plugin-transform-class-constructor-call/src/index.js index 5d2e80f90f..09de2b5baa 100644 --- a/packages/babel-plugin-transform-class-constructor-call/src/index.js +++ b/packages/babel-plugin-transform-class-constructor-call/src/index.js @@ -1,6 +1,6 @@ import template from "babel-template"; -let buildWrapper = template(` +const buildWrapper = template(` let CLASS_REF = CLASS; var CALL_REF = CALL; var WRAPPER_REF = function (...args) { @@ -15,12 +15,12 @@ let buildWrapper = template(` `); export default function ({ types: t }) { - let ALREADY_VISITED = Symbol(); + const ALREADY_VISITED = Symbol(); function findConstructorCall(path): ?Object { - let methods: Array = path.get("body.body"); + const methods: Array = path.get("body.body"); - for (let method of methods) { + for (const method of methods) { if (method.node.kind === "constructorCall") { return method; } @@ -30,8 +30,8 @@ export default function ({ types: t }) { } function handleClassWithCall(constructorCall, classPath) { - let { node } = classPath; - let ref = node.id || classPath.scope.generateUidIdentifier("class"); + const { node } = classPath; + const ref = node.id || classPath.scope.generateUidIdentifier("class"); if (classPath.parentPath.isExportDefaultDeclaration()) { classPath = classPath.parentPath; @@ -57,7 +57,7 @@ export default function ({ types: t }) { if (path.node[ALREADY_VISITED]) return; path.node[ALREADY_VISITED] = true; - let constructorCall = findConstructorCall(path); + const constructorCall = findConstructorCall(path); if (constructorCall) { handleClassWithCall(constructorCall, path); diff --git a/packages/babel-plugin-transform-class-properties/src/index.js b/packages/babel-plugin-transform-class-properties/src/index.js index 10451b3779..af383d44bd 100644 --- a/packages/babel-plugin-transform-class-properties/src/index.js +++ b/packages/babel-plugin-transform-class-properties/src/index.js @@ -3,7 +3,7 @@ import nameFunction from "babel-helper-function-name"; import template from "babel-template"; export default function ({ types: t }) { - let findBareSupers = { + const findBareSupers = { Super(path) { if (path.parentPath.isCallExpression({ callee: path.node })) { this.push(path.parentPath); @@ -11,7 +11,7 @@ export default function ({ types: t }) { } }; - let referenceVisitor = { + const referenceVisitor = { ReferencedIdentifier(path) { if (this.scope.hasOwnBinding(path.node.name)) { this.collision = true; @@ -45,12 +45,12 @@ export default function ({ types: t }) { visitor: { Class(path, state) { const buildClassProperty = state.opts.spec ? buildClassPropertySpec : buildClassPropertyNonSpec; - let isDerived = !!path.node.superClass; + const isDerived = !!path.node.superClass; let constructor; - let props = []; - let body = path.get("body"); + const props = []; + const body = path.get("body"); - for (let path of body.get("body")) { + for (const path of body.get("body")) { if (path.isClassProperty()) { props.push(path); } else if (path.isClassMethod({ kind: "constructor" })) { @@ -60,7 +60,7 @@ export default function ({ types: t }) { if (!props.length) return; - let nodes = []; + const nodes = []; let ref; if (path.isClassExpression() || !path.node.id) { @@ -72,15 +72,15 @@ export default function ({ types: t }) { let instanceBody = []; - for (let prop of props) { - let propNode = prop.node; + for (const prop of props) { + const propNode = prop.node; if (propNode.decorators && propNode.decorators.length > 0) continue; // In non-spec mode, all properties without values are ignored. // In spec mode, *static* properties without values are still defined (see below). if (!state.opts.spec && !propNode.value) continue; - let isStatic = propNode.static; + const isStatic = propNode.static; if (isStatic) { nodes.push(buildClassProperty(ref, propNode)); @@ -92,7 +92,7 @@ export default function ({ types: t }) { if (instanceBody.length) { if (!constructor) { - let newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([])); + const newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([])); if (isDerived) { newConstructor.params = [t.restElement(t.identifier("args"))]; newConstructor.body.body.push( @@ -107,18 +107,18 @@ export default function ({ types: t }) { [constructor] = body.unshiftContainer("body", newConstructor); } - let collisionState = { + const collisionState = { collision: false, scope: constructor.scope }; - for (let prop of props) { + for (const prop of props) { prop.traverse(referenceVisitor, collisionState); if (collisionState.collision) break; } if (collisionState.collision) { - let initialisePropsRef = path.scope.generateUidIdentifier("initialiseProps"); + const initialisePropsRef = path.scope.generateUidIdentifier("initialiseProps"); nodes.push(t.variableDeclaration("var", [ t.variableDeclarator( @@ -137,9 +137,9 @@ export default function ({ types: t }) { // if (isDerived) { - let bareSupers = []; + const bareSupers = []; constructor.traverse(findBareSupers, bareSupers); - for (let bareSuper of bareSupers) { + for (const bareSuper of bareSupers) { bareSuper.insertAfter(instanceBody); } } else { @@ -147,7 +147,7 @@ export default function ({ types: t }) { } } - for (let prop of props) { + for (const prop of props) { prop.remove(); } @@ -169,11 +169,11 @@ export default function ({ types: t }) { path.insertAfter(nodes); }, ArrowFunctionExpression(path) { - let classExp = path.get("body"); + const classExp = path.get("body"); if (!classExp.isClassExpression()) return; - let body = classExp.get("body"); - let members = body.get("body"); + const body = classExp.get("body"); + const members = body.get("body"); if (members.some((member) => member.isClassProperty())) { path.ensureBlock(); } diff --git a/packages/babel-plugin-transform-decorators/src/index.js b/packages/babel-plugin-transform-decorators/src/index.js index 1b3fbed6f8..e1156b6903 100644 --- a/packages/babel-plugin-transform-decorators/src/index.js +++ b/packages/babel-plugin-transform-decorators/src/index.js @@ -1,7 +1,7 @@ import template from "babel-template"; import explodeClass from "babel-helper-explode-class"; -let buildClassDecorator = template(` +const buildClassDecorator = template(` CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF; `); @@ -11,7 +11,7 @@ export default function ({ types: t }) { } function transformClass(path, ref, state) { - let nodes = []; + const nodes = []; state; @@ -20,7 +20,7 @@ export default function ({ types: t }) { path.node.decorators = null; classDecorators = cleanDecorators(classDecorators); - for (let decorator of classDecorators) { + for (const decorator of classDecorators) { nodes.push(buildClassDecorator({ CLASS_REF: ref, DECORATOR: decorator @@ -28,21 +28,21 @@ export default function ({ types: t }) { } } - let map = Object.create(null); + const map = Object.create(null); - for (let method of path.get("body.body")) { - let decorators = method.node.decorators; + for (const method of path.get("body.body")) { + const decorators = method.node.decorators; if (!decorators) continue; - let alias = t.toKeyAlias(method.node); + const alias = t.toKeyAlias(method.node); map[alias] = map[alias] || []; map[alias].push(method.node); method.remove(); } - for (let alias in map) { - let items = map[alias]; + for (const alias in map) { + const items = map[alias]; items; } @@ -54,13 +54,13 @@ export default function ({ types: t }) { if (path.isClass()) { if (path.node.decorators) return true; - for (let method of (path.node.body.body: Array)) { + for (const method of (path.node.body.body: Array)) { if (method.decorators) { return true; } } } else if (path.isObjectExpression()) { - for (let prop of (path.node.properties: Array)) { + for (const prop of (path.node.properties: Array)) { if (prop.decorators) { return true; } @@ -97,7 +97,7 @@ The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorator explodeClass(path); - let ref = path.scope.generateDeclaredUidIdentifier("ref"); + const ref = path.scope.generateDeclaredUidIdentifier("ref"); let nodes = []; nodes.push(t.assignmentExpression("=", ref, path.node)); @@ -114,7 +114,7 @@ The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorator doError(path); explodeClass(path); - let ref = path.node.id; + const ref = path.node.id; let nodes = []; nodes = nodes.concat(transformClass(path, ref, this).map((expr) => t.expressionStatement(expr))); diff --git a/packages/babel-plugin-transform-do-expressions/src/index.js b/packages/babel-plugin-transform-do-expressions/src/index.js index 8bfe9c0dc5..1354c4ecfa 100644 --- a/packages/babel-plugin-transform-do-expressions/src/index.js +++ b/packages/babel-plugin-transform-do-expressions/src/index.js @@ -4,7 +4,7 @@ export default function () { visitor: { DoExpression(path) { - let body = path.node.body.body; + const body = path.node.body.body; if (body.length) { path.replaceWithMultiple(body); } else { diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js b/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js index 1d4c91fee7..70b6103556 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js +++ b/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js @@ -3,13 +3,13 @@ export default function ({ types: t }) { visitor: { ArrowFunctionExpression(path, state) { if (state.opts.spec) { - let { node } = path; + const { node } = path; if (node.shadow) return; node.shadow = { this: false }; node.type = "FunctionExpression"; - let boundThis = t.thisExpression(); + const boundThis = t.thisExpression(); boundThis._forceShadow = path; // make sure that arrow function won't be instantiated diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js b/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js index a1aac15dc3..54d27f224c 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js @@ -1,12 +1,12 @@ export default function ({ types: t }) { function statementList(key, path) { - let paths: Array = path.get(key); + const paths: Array = path.get(key); - for (let path of paths) { - let func = path.node; + for (const path of paths) { + const func = path.node; if (!path.isFunctionDeclaration()) continue; - let declar = t.variableDeclaration("let", [ + const declar = t.variableDeclaration("let", [ t.variableDeclarator(func.id, t.toExpression(func)) ]); @@ -23,7 +23,7 @@ export default function ({ types: t }) { return { visitor: { BlockStatement(path) { - let { node, parent } = path; + const { node, parent } = path; if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) { return; } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index 95b63d36b3..19a36f558c 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -14,17 +14,17 @@ export default function () { return { visitor: { VariableDeclaration(path, file) { - let { node, parent, scope } = path; + const { node, parent, scope } = path; if (!isBlockScoped(node)) return; convertBlockScopedToVar(path, null, parent, scope, true); if (node._tdzThis) { - let nodes = [node]; + const nodes = [node]; for (let i = 0; i < node.declarations.length; i++) { - let decl = node.declarations[i]; + const decl = node.declarations[i]; if (decl.init) { - let assign = t.assignmentExpression("=", decl.id, decl.init); + const assign = t.assignmentExpression("=", decl.id, decl.init); assign._ignoreBlockScopingTDZ = true; nodes.push(t.expressionStatement(assign)); } @@ -44,22 +44,22 @@ export default function () { }, Loop(path, file) { - let { node, parent, scope } = path; + const { node, parent, scope } = path; t.ensureBlock(node); - let blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file); - let replace = blockScoping.run(); + const blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file); + const replace = blockScoping.run(); if (replace) path.replaceWith(replace); }, CatchClause(path, file) { - let { parent, scope } = path; - let blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file); + const { parent, scope } = path; + const blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file); blockScoping.run(); }, "BlockStatement|SwitchStatement|Program"(path, file) { if (!ignoreBlock(path)) { - let blockScoping = new BlockScoping(null, path, path.parent, path.scope, file); + const blockScoping = new BlockScoping(null, path, path.parent, path.scope, file); blockScoping.run(); } } @@ -71,7 +71,7 @@ function ignoreBlock(path) { return t.isLoop(path.parent) || t.isCatchClause(path.parent); } -let buildRetCheck = template(` +const buildRetCheck = template(` if (typeof RETURN === "object") return RETURN.v; `); @@ -89,7 +89,7 @@ function convertBlockScopedToVar(path, node, parent, scope, moveBindingsToParent // https://github.com/babel/babel/issues/255 if (!t.isFor(parent)) { for (let i = 0; i < node.declarations.length; i++) { - let declar = node.declarations[i]; + const declar = node.declarations[i]; declar.init = declar.init || scope.buildUndefinedNode(); } } @@ -101,8 +101,8 @@ function convertBlockScopedToVar(path, node, parent, scope, moveBindingsToParent if (moveBindingsToParent) { const parentScope = scope.getFunctionParent(); const ids = path.getBindingIdentifiers(); - for (let name in ids) { - let binding = scope.getOwnBinding(name); + for (const name in ids) { + const binding = scope.getOwnBinding(name); if (binding) binding.kind = "var"; scope.moveBindingTo(name, parentScope); } @@ -113,36 +113,36 @@ function isVar(node) { return t.isVariableDeclaration(node, { kind: "var" }) && !isBlockScoped(node); } -let letReferenceBlockVisitor = traverse.visitors.merge([{ +const letReferenceBlockVisitor = traverse.visitors.merge([{ Function(path, state) { path.traverse(letReferenceFunctionVisitor, state); return path.skip(); } }, tdzVisitor]); -let letReferenceFunctionVisitor = traverse.visitors.merge([{ +const letReferenceFunctionVisitor = traverse.visitors.merge([{ ReferencedIdentifier(path, state) { - let ref = state.letReferences[path.node.name]; + const ref = state.letReferences[path.node.name]; // not a part of our scope if (!ref) return; // this scope has a variable with the same name so it couldn't belong // to our let scope - let localBinding = path.scope.getBindingIdentifier(path.node.name); + const localBinding = path.scope.getBindingIdentifier(path.node.name); if (localBinding && localBinding !== ref) return; state.closurify = true; } }, tdzVisitor]); -let hoistVarDeclarationsVisitor = { +const hoistVarDeclarationsVisitor = { enter(path, self) { - let { node, parent } = path; + const { node, parent } = path; if (path.isForStatement()) { if (isVar(node.init, node)) { - let nodes = self.pushDeclar(node.init); + const nodes = self.pushDeclar(node.init); if (nodes.length === 1) { node.init = nodes[0]; } else { @@ -162,17 +162,17 @@ let hoistVarDeclarationsVisitor = { } }; -let loopLabelVisitor = { +const loopLabelVisitor = { LabeledStatement({ node }, state) { state.innerLabels.push(node.label.name); } }; -let continuationVisitor = { +const continuationVisitor = { enter(path, state) { if (path.isAssignmentExpression() || path.isUpdateExpression()) { - let bindings = path.getBindingIdentifiers(); - for (let name in bindings) { + const bindings = path.getBindingIdentifiers(); + for (const name in bindings) { if (state.outsideReferences[name] !== path.scope.getBindingIdentifier(name)) continue; state.reassignments[name] = true; } @@ -188,9 +188,9 @@ function loopNodeTo(node) { } } -let loopVisitor = { +const loopVisitor = { Loop(path, state) { - let oldIgnoreLabeless = state.ignoreLabeless; + const oldIgnoreLabeless = state.ignoreLabeless; state.ignoreLabeless = true; path.traverse(loopVisitor, state); state.ignoreLabeless = oldIgnoreLabeless; @@ -202,7 +202,7 @@ let loopVisitor = { }, SwitchCase(path, state) { - let oldInSwitchCase = state.inSwitchCase; + const oldInSwitchCase = state.inSwitchCase; state.inSwitchCase = true; path.traverse(loopVisitor, state); state.inSwitchCase = oldInSwitchCase; @@ -210,7 +210,7 @@ let loopVisitor = { }, "BreakStatement|ContinueStatement|ReturnStatement"(path, state) { - let { node, parent, scope } = path; + const { node, parent, scope } = path; if (node[this.LOOP_IGNORE]) return; let replace; @@ -284,11 +284,11 @@ class BlockScoping { */ run() { - let block = this.block; + const block = this.block; if (block._letDone) return; block._letDone = true; - let needsClosure = this.getLetReferences(); + const needsClosure = this.getLetReferences(); // this is a block within a `Function/Program` so we can safely leave it be if (t.isFunction(this.parent) || t.isProgram(this.block)) { @@ -313,12 +313,12 @@ class BlockScoping { } updateScopeInfo(wrappedInClosure) { - let scope = this.scope; - let parentScope = scope.getFunctionParent(); - let letRefs = this.letReferences; + const scope = this.scope; + const parentScope = scope.getFunctionParent(); + const letRefs = this.letReferences; - for (let key in letRefs) { - let ref = letRefs[key]; + for (const key in letRefs) { + const ref = letRefs[key]; const binding = scope.getBinding(ref.name); if (!binding) continue; if (binding.kind === "let" || binding.kind === "const") { @@ -334,18 +334,18 @@ class BlockScoping { } remap() { - let letRefs = this.letReferences; - let scope = this.scope; + const letRefs = this.letReferences; + const scope = this.scope; // alright, so since we aren't wrapping this block in a closure // we have to check if any of our let variables collide with // those in upper scopes and then if they do, generate a uid // for them and replace all references with it - for (let key in letRefs) { + for (const key in letRefs) { // just an Identifier node we collected in `getLetReferences` // this is the defining identifier of a declaration - let ref = letRefs[key]; + const ref = letRefs[key]; // todo: could skip this if the colliding binding is in another function if (scope.parentHasBinding(key) || scope.hasGlobal(key)) { @@ -362,14 +362,14 @@ class BlockScoping { } wrapClosure() { - let block = this.block; + const block = this.block; - let outsideRefs = this.outsideLetReferences; + const outsideRefs = this.outsideLetReferences; // remap loop heads with colliding variables if (this.loop) { - for (let name in outsideRefs) { - let id = outsideRefs[name]; + for (const name in outsideRefs) { + const id = outsideRefs[name]; if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) { delete outsideRefs[id.name]; @@ -391,13 +391,13 @@ class BlockScoping { this.hoistVarDeclarations(); // turn outsideLetReferences into an array - let params = values(outsideRefs); - let args = values(outsideRefs); + const params = values(outsideRefs); + const args = values(outsideRefs); const isSwitch = this.blockPath.isSwitchStatement(); // build the closure that we're going to wrap the block with, possible wrapping switch(){} - let fn = t.functionExpression(null, params, t.blockStatement(isSwitch ? [block] : block.body)); + const fn = t.functionExpression(null, params, t.blockStatement(isSwitch ? [block] : block.body)); fn.shadow = true; // continuation @@ -414,17 +414,17 @@ class BlockScoping { // build a call and a unique id that we can assign the return value to let call = t.callExpression(ref, args); - let ret = this.scope.generateUidIdentifier("ret"); + const ret = this.scope.generateUidIdentifier("ret"); // handle generators - let hasYield = traverse.hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES); + const hasYield = traverse.hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES); if (hasYield) { fn.generator = true; call = t.yieldExpression(call, true); } // handlers async functions - let hasAsync = traverse.hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES); + const hasAsync = traverse.hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES); if (hasAsync) { fn.async = true; call = t.awaitExpression(call); @@ -442,7 +442,7 @@ class BlockScoping { */ buildClosure(ret: { type: "Identifier" }, call: { type: "CallExpression" }) { - let has = this.has; + const has = this.has; if (has.hasReturn || has.hasBreakContinue) { this.buildHas(ret, call); } else { @@ -459,7 +459,7 @@ class BlockScoping { */ addContinuations(fn) { - let state = { + const state = { reassignments: {}, outsideReferences: this.outsideLetReferences }; @@ -467,10 +467,10 @@ class BlockScoping { this.scope.traverse(fn, continuationVisitor, state); for (let i = 0; i < fn.params.length; i++) { - let param = fn.params[i]; + const param = fn.params[i]; if (!state.reassignments[param.name]) continue; - let newParam = this.scope.generateUidIdentifier(param.name); + const newParam = this.scope.generateUidIdentifier(param.name); fn.params[i] = newParam; this.scope.rename(param.name, newParam.name, fn); @@ -481,12 +481,12 @@ class BlockScoping { } getLetReferences() { - let block = this.block; + const block = this.block; let declarators = []; if (this.loop) { - let init = this.loop.left || this.loop.init; + const init = this.loop.left || this.loop.init; if (isBlockScoped(init)) { declarators.push(init); extend(this.outsideLetReferences, t.getBindingIdentifiers(init)); @@ -509,18 +509,18 @@ class BlockScoping { // if (block.body) { for (let i = 0; i < block.body.length; i++) { - let declarPath = this.blockPath.get("body")[i]; + const declarPath = this.blockPath.get("body")[i]; addDeclarationsFromChild(declarPath); } } if (block.cases) { for (let i = 0; i < block.cases.length; i++) { - let consequents = block.cases[i].consequent; + const consequents = block.cases[i].consequent; for (let j = 0; j < consequents.length; j++) { - let declarPath = this.blockPath.get("cases")[i]; - let declar = consequents[j]; + const declarPath = this.blockPath.get("cases")[i]; + const declar = consequents[j]; addDeclarationsFromChild(declarPath, declar); } } @@ -528,12 +528,12 @@ class BlockScoping { // for (let i = 0; i < declarators.length; i++) { - let declar = declarators[i]; + const declar = declarators[i]; // Passing true as the third argument causes t.getBindingIdentifiers // to return only the *outer* binding identifiers of this // declaration, rather than (for example) mistakenly including the // parameters of a function declaration. Fixes #4880. - let keys = t.getBindingIdentifiers(declar, false, true); + const keys = t.getBindingIdentifiers(declar, false, true); extend(this.letReferences, keys); this.hasLetReferences = true; } @@ -541,7 +541,7 @@ class BlockScoping { // no let references so we can just quit if (!this.hasLetReferences) return; - let state = { + const state = { letReferences: this.letReferences, closurify: false, file: this.file @@ -562,7 +562,7 @@ class BlockScoping { */ checkLoop(): Object { - let state = { + const state = { hasBreakContinue: false, ignoreLabeless: false, inSwitchCase: false, @@ -594,21 +594,21 @@ class BlockScoping { */ pushDeclar(node: { type: "VariableDeclaration" }): Array { - let declars = []; - let names = t.getBindingIdentifiers(node); - for (let name in names) { + const declars = []; + const names = t.getBindingIdentifiers(node); + for (const name in names) { declars.push(t.variableDeclarator(names[name])); } this.body.push(t.variableDeclaration(node.kind, declars)); - let replace = []; + const replace = []; for (let i = 0; i < node.declarations.length; i++) { - let declar = node.declarations[i]; + const declar = node.declarations[i]; if (!declar.init) continue; - let expr = t.assignmentExpression("=", declar.id, declar.init); + const expr = t.assignmentExpression("=", declar.id, declar.init); replace.push(t.inherits(expr, declar)); } @@ -616,15 +616,15 @@ class BlockScoping { } buildHas(ret: { type: "Identifier" }, call: { type: "CallExpression" }) { - let body = this.body; + const body = this.body; body.push(t.variableDeclaration("var", [ t.variableDeclarator(ret, call) ])); let retCheck; - let has = this.has; - let cases = []; + const has = this.has; + const cases = []; if (has.hasReturn) { // typeof ret === "object" @@ -634,7 +634,7 @@ class BlockScoping { } if (has.hasBreakContinue) { - for (let key in has.map) { + for (const key in has.map) { cases.push(t.switchCase(t.stringLiteral(key), [has.map[key]])); } @@ -643,7 +643,7 @@ class BlockScoping { } if (cases.length === 1) { - let single = cases[0]; + const single = cases[0]; body.push(t.ifStatement( t.binaryExpression("===", ret, single.test), single.consequent[0] @@ -652,7 +652,7 @@ class BlockScoping { if (this.loop) { // https://github.com/babel/babel/issues/998 for (let i = 0; i < cases.length; i++) { - let caseConsequent = cases[i].consequent[0]; + const caseConsequent = cases[i].consequent[0]; if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) { caseConsequent.label = this.loopLabel = this.loopLabel || this.scope.generateUidIdentifier("loop"); } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js b/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js index 10d68c174d..17a3c2d210 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js @@ -1,7 +1,7 @@ import * as t from "babel-types"; function getTDZStatus(refPath, bindingPath) { - let executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath); + const executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath); if (executionStatus === "before") { return "inside"; @@ -20,29 +20,29 @@ function buildTDZAssert(node, file) { } function isReference(node, scope, state) { - let declared = state.letReferences[node.name]; + const declared = state.letReferences[node.name]; if (!declared) return false; // declared node is different in this scope return scope.getBindingIdentifier(node.name) === declared; } -export let visitor = { +export const visitor = { ReferencedIdentifier(path, state) { if (!this.file.opts.tdz) return; - let { node, parent, scope } = path; + const { node, parent, scope } = path; if (path.parentPath.isFor({ left: node })) return; if (!isReference(node, scope, state)) return; - let bindingPath = scope.getBinding(node.name).path; + const bindingPath = scope.getBinding(node.name).path; - let status = getTDZStatus(path, bindingPath); + const status = getTDZStatus(path, bindingPath); if (status === "inside") return; if (status === "maybe") { - let assert = buildTDZAssert(node, state.file); + const assert = buildTDZAssert(node, state.file); // add tdzThis to parent variable declarator so it's exploded bindingPath.parent._tdzThis = true; @@ -69,14 +69,14 @@ export let visitor = { exit(path, state) { if (!this.file.opts.tdz) return; - let { node } = path; + const { node } = path; if (node._ignoreBlockScopingTDZ) return; - let nodes = []; - let ids = path.getBindingIdentifiers(); + const nodes = []; + const ids = path.getBindingIdentifiers(); - for (let name in ids) { - let id = ids[name]; + for (const name in ids) { + const id = ids[name]; if (isReference(id, path.scope, state)) { nodes.push(buildTDZAssert(id, state.file)); diff --git a/packages/babel-plugin-transform-es2015-classes/src/index.js b/packages/babel-plugin-transform-es2015-classes/src/index.js index 9b4d371e5c..2dc8e3337d 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/index.js +++ b/packages/babel-plugin-transform-es2015-classes/src/index.js @@ -4,15 +4,15 @@ import nameFunction from "babel-helper-function-name"; export default function ({ types: t }) { // todo: investigate traversal requeueing - let VISITED = Symbol(); + const VISITED = Symbol(); return { visitor: { ExportDefaultDeclaration(path) { if (!path.get("declaration").isClassDeclaration()) return; - let { node } = path; - let ref = node.declaration.id || path.scope.generateUidIdentifier("class"); + const { node } = path; + const ref = node.declaration.id || path.scope.generateUidIdentifier("class"); node.declaration.id = ref; // Split the class declaration and the export into two separate statements. @@ -21,9 +21,9 @@ export default function ({ types: t }) { }, ClassDeclaration(path) { - let { node } = path; + const { node } = path; - let ref = node.id || path.scope.generateUidIdentifier("class"); + const ref = node.id || path.scope.generateUidIdentifier("class"); path.replaceWith(t.variableDeclaration("let", [ t.variableDeclarator(ref, t.toExpression(node)) @@ -31,10 +31,10 @@ export default function ({ types: t }) { }, ClassExpression(path, state) { - let { node } = path; + const { node } = path; if (node[VISITED]) return; - let inferred = nameFunction(path); + const inferred = nameFunction(path); if (inferred && inferred !== node) return path.replaceWith(inferred); node[VISITED] = true; diff --git a/packages/babel-plugin-transform-es2015-classes/src/lib/memoise-decorators.js b/packages/babel-plugin-transform-es2015-classes/src/lib/memoise-decorators.js index 2948528182..6583d081dc 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/lib/memoise-decorators.js +++ b/packages/babel-plugin-transform-es2015-classes/src/lib/memoise-decorators.js @@ -2,14 +2,14 @@ import type { Scope } from "babel-traverse"; import * as t from "babel-types"; export default function (decorators: Array, scope: Scope): Array { - for (let decorator of decorators) { - let expression = decorator.expression; + for (const decorator of decorators) { + const expression = decorator.expression; if (!t.isMemberExpression(expression)) continue; - let temp = scope.maybeGenerateMemoised(expression.object); + const temp = scope.maybeGenerateMemoised(expression.object); let ref; - let nodes = []; + const nodes = []; if (temp) { ref = temp; diff --git a/packages/babel-plugin-transform-es2015-classes/src/loose.js b/packages/babel-plugin-transform-es2015-classes/src/loose.js index 5c9122bacc..b94cd6be05 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/loose.js +++ b/packages/babel-plugin-transform-es2015-classes/src/loose.js @@ -14,11 +14,11 @@ export default class LooseClassTransformer extends VanillaTransformer { let classRef = this.classRef; if (!node.static) classRef = t.memberExpression(classRef, t.identifier("prototype")); - let methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key)); + const methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key)); let func = t.functionExpression(null, node.params, node.body, node.generator, node.async); func.returnType = node.returnType; - let key = t.toComputedKey(node, node.key); + const key = t.toComputedKey(node, node.key); if (t.isStringLiteral(key)) { func = nameFunction({ node: func, @@ -27,7 +27,7 @@ export default class LooseClassTransformer extends VanillaTransformer { }); } - let expr = t.expressionStatement(t.assignmentExpression("=", methodName, func)); + const expr = t.expressionStatement(t.assignmentExpression("=", methodName, func)); t.inheritsComments(expr, node); this.body.push(expr); return true; diff --git a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js index 34109568af..b38a00fa02 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js +++ b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js @@ -8,13 +8,13 @@ import * as defineMap from "babel-helper-define-map"; import template from "babel-template"; import * as t from "babel-types"; -let buildDerivedConstructor = template(` +const buildDerivedConstructor = template(` (function () { super(...arguments); }) `); -let noMethodVisitor = { +const noMethodVisitor = { "FunctionExpression|FunctionDeclaration"(path) { if (!path.is("shadow")) { path.skip(); @@ -26,7 +26,7 @@ let noMethodVisitor = { } }; -let verifyConstructorVisitor = visitors.merge([noMethodVisitor, { +const verifyConstructorVisitor = visitors.merge([noMethodVisitor, { Super(path) { if (this.isDerived && !this.hasBareSuper && !path.parentPath.isCallExpression({ callee: path.node })) { throw path.buildCodeFrameError("'super.*' is not allowed before super()"); @@ -54,7 +54,7 @@ let verifyConstructorVisitor = visitors.merge([noMethodVisitor, { } }]); -let findThisesVisitor = visitors.merge([noMethodVisitor, { +const findThisesVisitor = visitors.merge([noMethodVisitor, { ThisExpression(path) { this.superThises.push(path); } @@ -96,18 +96,18 @@ export default class ClassTransformer { run() { let superName = this.superName; - let file = this.file; + const file = this.file; let body = this.body; // - let constructorBody = this.constructorBody = t.blockStatement([]); + const constructorBody = this.constructorBody = t.blockStatement([]); this.constructor = this.buildConstructor(); // - let closureParams = []; - let closureArgs = []; + const closureParams = []; + const closureArgs = []; // if (this.isDerived) { @@ -138,13 +138,13 @@ export default class ClassTransformer { // body.push(t.returnStatement(this.classRef)); - let container = t.functionExpression(null, closureParams, t.blockStatement(body)); + const container = t.functionExpression(null, closureParams, t.blockStatement(body)); container.shadow = true; return t.callExpression(container, closureArgs); } buildConstructor() { - let func = t.functionDeclaration(this.classRef, [], this.constructorBody); + const func = t.functionDeclaration(this.classRef, [], this.constructorBody); t.inherits(func, this.node); return func; } @@ -159,7 +159,7 @@ export default class ClassTransformer { mutatorMap = this.instanceMutatorMap; } - let map = defineMap.push(mutatorMap, node, kind, this.file, scope); + const map = defineMap.push(mutatorMap, node, kind, this.file, scope); if (enumerable) { map.enumerable = t.booleanLiteral(true); @@ -175,8 +175,8 @@ export default class ClassTransformer { constructorMeMaybe() { let hasConstructor = false; - let paths = this.path.get("body.body"); - for (let path of (paths: Array)) { + const paths = this.path.get("body.body"); + for (const path of (paths: Array)) { hasConstructor = path.equals("kind", "constructor"); if (hasConstructor) break; } @@ -185,7 +185,7 @@ export default class ClassTransformer { let params, body; if (this.isDerived) { - let constructor = buildDerivedConstructor().expression; + const constructor = buildDerivedConstructor().expression; params = constructor.params; body = constructor.body; } else { @@ -207,7 +207,7 @@ export default class ClassTransformer { this.verifyConstructor(); if (this.userConstructor) { - let constructorBody = this.constructorBody; + const constructorBody = this.constructorBody; constructorBody.body = constructorBody.body.concat(this.userConstructor.body.body); t.inherits(this.constructor, this.userConstructor); t.inherits(constructorBody, this.userConstructor.body); @@ -217,10 +217,10 @@ export default class ClassTransformer { } pushBody() { - let classBodyPaths: Array = this.path.get("body.body"); + const classBodyPaths: Array = this.path.get("body.body"); - for (let path of classBodyPaths) { - let node = path.node; + for (const path of classBodyPaths) { + const node = path.node; if (path.isClassProperty()) { throw path.buildCodeFrameError("Missing class properties transform."); @@ -231,7 +231,7 @@ export default class ClassTransformer { } if (t.isClassMethod(node)) { - let isConstructor = node.kind === "constructor"; + const isConstructor = node.kind === "constructor"; if (isConstructor) { path.traverse(verifyConstructorVisitor, this); @@ -241,7 +241,7 @@ export default class ClassTransformer { } } - let replaceSupers = new ReplaceSupers({ + const replaceSupers = new ReplaceSupers({ forceSuperMemoisation: isConstructor, methodPath: path, methodNode: node, @@ -275,7 +275,7 @@ export default class ClassTransformer { pushDescriptors() { this.pushInherits(); - let body = this.body; + const body = this.body; let instanceProps; let staticProps; @@ -292,7 +292,7 @@ export default class ClassTransformer { if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps); if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps); - let nullNode = t.nullLiteral(); + const nullNode = t.nullLiteral(); // (Constructor, instanceDescriptors, staticDescriptors, instanceInitializers, staticInitializers) let args = [this.classRef, nullNode, nullNode, nullNode, nullNode]; @@ -363,7 +363,7 @@ export default class ClassTransformer { [t.thisExpression(), bareSuperNode] ); - let bareSuperAfter = this.bareSuperAfter.map((fn) => fn(thisRef)); + const bareSuperAfter = this.bareSuperAfter.map((fn) => fn(thisRef)); if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) { // this super call is the last statement in the body so we can just straight up @@ -394,17 +394,17 @@ export default class ClassTransformer { verifyConstructor() { if (!this.isDerived) return; - let path = this.userConstructorPath; - let body = path.get("body"); + const path = this.userConstructorPath; + const body = path.get("body"); path.traverse(findThisesVisitor, this); let guaranteedSuperBeforeFinish = !!this.bareSupers.length; - let superRef = this.superName || t.identifier("Function"); - let thisRef = path.scope.generateUidIdentifier("this"); + const superRef = this.superName || t.identifier("Function"); + const thisRef = path.scope.generateUidIdentifier("this"); - for (let bareSuper of this.bareSupers) { + for (const bareSuper of this.bareSupers) { this.wrapSuperCall(bareSuper, superRef, thisRef, body); if (guaranteedSuperBeforeFinish) { @@ -422,25 +422,25 @@ export default class ClassTransformer { } } - for (let thisPath of this.superThises) { + for (const thisPath of this.superThises) { thisPath.replaceWith(thisRef); } - let wrapReturn = (returnArg) => t.callExpression( + const wrapReturn = (returnArg) => t.callExpression( this.file.addHelper("possibleConstructorReturn"), [thisRef].concat(returnArg || []) ); // if we have a return as the last node in the body then we've already caught that // return - let bodyPaths = body.get("body"); + const bodyPaths = body.get("body"); if (bodyPaths.length && !bodyPaths.pop().isReturnStatement()) { body.pushContainer("body", t.returnStatement(guaranteedSuperBeforeFinish ? thisRef : wrapReturn())); } - for (let returnPath of this.superReturns) { + for (const returnPath of this.superReturns) { if (returnPath.node.argument) { - let ref = returnPath.scope.generateDeclaredUidIdentifier("ret"); + const ref = returnPath.scope.generateDeclaredUidIdentifier("ret"); returnPath.get("argument").replaceWithMultiple([ t.assignmentExpression("=", ref, returnPath.node.argument), wrapReturn(ref) @@ -456,7 +456,7 @@ export default class ClassTransformer { */ pushMethod(node: { type: "ClassMethod" }, path?: NodePath) { - let scope = path ? path.scope : this.scope; + const scope = path ? path.scope : this.scope; if (node.kind === "method") { if (this._processMethod(node, scope)) return; @@ -482,7 +482,7 @@ export default class ClassTransformer { path.scope.rename(this.classRef.name); } - let construct = this.constructor; + const construct = this.constructor; this.userConstructorPath = path; this.userConstructor = method; diff --git a/packages/babel-plugin-transform-es2015-computed-properties/src/index.js b/packages/babel-plugin-transform-es2015-computed-properties/src/index.js index 6bf843aaab..ac0ef38fc8 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/src/index.js +++ b/packages/babel-plugin-transform-es2015-computed-properties/src/index.js @@ -1,5 +1,5 @@ export default function ({ types: t, template }) { - let buildMutatorMapAssign = template(` + const buildMutatorMapAssign = template(` MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {}; MUTATOR_MAP_REF[KEY].KIND = VALUE; `); @@ -29,7 +29,7 @@ export default function ({ types: t, template }) { function pushMutatorDefine({ objId, body, getMutatorId, scope }, prop) { let key = !prop.computed && t.isIdentifier(prop.key) ? t.stringLiteral(prop.key.name) : prop.key; - let maybeMemoise = scope.maybeGenerateMemoised(key); + const maybeMemoise = scope.maybeGenerateMemoised(key); if (maybeMemoise) { body.push(t.expressionStatement(t.assignmentExpression("=", maybeMemoise, key))); key = maybeMemoise; @@ -44,7 +44,7 @@ export default function ({ types: t, template }) { } function loose(info) { - for (let prop of info.computedProps) { + for (const prop of info.computedProps) { if (prop.kind === "get" || prop.kind === "set") { pushMutatorDefine(info, prop); } else { @@ -54,10 +54,10 @@ export default function ({ types: t, template }) { } function spec(info) { - let { objId, body, computedProps, state } = info; + const { objId, body, computedProps, state } = info; - for (let prop of computedProps) { - let key = t.toComputedKey(prop); + for (const prop of computedProps) { + const key = t.toComputedKey(prop); if (prop.kind === "get" || prop.kind === "set") { pushMutatorDefine(info, prop); @@ -87,9 +87,9 @@ export default function ({ types: t, template }) { visitor: { ObjectExpression: { exit(path, state) { - let { node, parent, scope } = path; + const { node, parent, scope } = path; let hasComputed = false; - for (let prop of (node.properties: Array)) { + for (const prop of (node.properties: Array)) { hasComputed = prop.computed === true; if (hasComputed) break; } @@ -98,11 +98,11 @@ export default function ({ types: t, template }) { // put all getters/setters into the first object expression as well as all initialisers up // to the first computed property - let initProps = []; - let computedProps = []; + const initProps = []; + const computedProps = []; let foundComputed = false; - for (let prop of node.properties) { + for (const prop of node.properties) { if (prop.computed) { foundComputed = true; } @@ -114,9 +114,9 @@ export default function ({ types: t, template }) { } } - let objId = scope.generateUidIdentifierBasedOnNode(parent); - let initPropExpression = t.objectExpression(initProps); - let body = []; + const objId = scope.generateUidIdentifierBasedOnNode(parent); + const initPropExpression = t.objectExpression(initProps); + const body = []; body.push(t.variableDeclaration("var", [ t.variableDeclarator(objId, initPropExpression) @@ -127,7 +127,7 @@ export default function ({ types: t, template }) { let mutatorRef; - let getMutatorId = function () { + const getMutatorId = function () { if (!mutatorRef) { mutatorRef = scope.generateUidIdentifier("mutatorMap"); @@ -139,7 +139,7 @@ export default function ({ types: t, template }) { return mutatorRef; }; - let single = callback({ + const single = callback({ scope, objId, body, diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index 3fe8c9fd3b..6184cf2547 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -7,7 +7,7 @@ export default function ({ types: t }) { */ function variableDeclarationHasPattern(node) { - for (let declar of (node.declarations: Array)) { + for (const declar of (node.declarations: Array)) { if (t.isPattern(declar.id)) { return true; } @@ -20,7 +20,7 @@ export default function ({ types: t }) { */ function hasRest(pattern) { - for (let elem of (pattern.elements: Array)) { + for (const elem of (pattern.elements: Array)) { if (t.isRestElement(elem)) { return true; } @@ -28,7 +28,7 @@ export default function ({ types: t }) { return false; } - let arrayUnpackVisitor = { + const arrayUnpackVisitor = { ReferencedIdentifier(path, state) { if (state.bindings[path.node.name]) { state.deopt = true; @@ -68,7 +68,7 @@ export default function ({ types: t }) { } buildVariableDeclaration(id, init) { - let declar = t.variableDeclaration("var", [ + const declar = t.variableDeclaration("var", [ t.variableDeclarator(id, init) ]); declar._blockHoist = this.blockHoist; @@ -99,9 +99,9 @@ export default function ({ types: t }) { // we need to assign the current value of the assignment to avoid evaluating // it more than once - let tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef); + const tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef); - let declar = t.variableDeclaration("var", [ + const declar = t.variableDeclaration("var", [ t.variableDeclarator(tempValueRef, valueRef) ]); declar._blockHoist = this.blockHoist; @@ -109,15 +109,15 @@ export default function ({ types: t }) { // - let tempConditional = t.conditionalExpression( + const tempConditional = t.conditionalExpression( t.binaryExpression("===", tempValueRef, t.identifier("undefined")), pattern.right, tempValueRef ); - let left = pattern.left; + const left = pattern.left; if (t.isPattern(left)) { - let tempValueDefault = t.expressionStatement( + const tempValueDefault = t.expressionStatement( t.assignmentExpression("=", tempValueRef, tempConditional) ); tempValueDefault._blockHoist = this.blockHoist; @@ -135,7 +135,7 @@ export default function ({ types: t }) { let keys = []; for (let i = 0; i < pattern.properties.length; i++) { - let prop = pattern.properties[i]; + const prop = pattern.properties[i]; // we've exceeded the index of the spread property to all properties to the // right need to be ignored @@ -153,15 +153,15 @@ export default function ({ types: t }) { // - let value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]); + const value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]); this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value)); } pushObjectProperty(prop, propRef) { if (t.isLiteral(prop.key)) prop.computed = true; - let pattern = prop.value; - let objRef = t.memberExpression(propRef, prop.key, prop.computed); + const pattern = prop.value; + const objRef = t.memberExpression(propRef, prop.key, prop.computed); if (t.isPattern(pattern)) { this.push(pattern, objRef); @@ -184,7 +184,7 @@ export default function ({ types: t }) { // only evaluated once if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) { - let temp = this.scope.generateUidIdentifierBasedOnNode(objRef); + const temp = this.scope.generateUidIdentifierBasedOnNode(objRef); this.nodes.push(this.buildVariableDeclaration(temp, objRef)); objRef = temp; } @@ -192,7 +192,7 @@ export default function ({ types: t }) { // for (let i = 0; i < pattern.properties.length; i++) { - let prop = pattern.properties[i]; + const prop = pattern.properties[i]; if (t.isRestProperty(prop)) { this.pushObjectRest(pattern, objRef, prop, i); } else { @@ -210,7 +210,7 @@ export default function ({ types: t }) { if (pattern.elements.length > arr.elements.length) return; if (pattern.elements.length < arr.elements.length && !hasRest(pattern)) return false; - for (let elem of (pattern.elements: Array)) { + for (const elem of (pattern.elements: Array)) { // deopt on holes if (!elem) return false; @@ -218,7 +218,7 @@ export default function ({ types: t }) { if (t.isMemberExpression(elem)) return false; } - for (let elem of (arr.elements: Array)) { + for (const elem of (arr.elements: Array)) { // deopt on spread elements if (t.isSpreadElement(elem)) return false; @@ -230,15 +230,15 @@ export default function ({ types: t }) { } // deopt on reference to left side identifiers - let bindings = t.getBindingIdentifiers(pattern); - let state = { deopt: false, bindings }; + const bindings = t.getBindingIdentifiers(pattern); + const state = { deopt: false, bindings }; this.scope.traverse(arr, arrayUnpackVisitor, state); return !state.deopt; } pushUnpackedArrayPattern(pattern, arr) { for (let i = 0; i < pattern.elements.length; i++) { - let elem = pattern.elements[i]; + const elem = pattern.elements[i]; if (t.isRestElement(elem)) { this.push(elem.argument, t.arrayExpression(arr.elements.slice(i))); } else { @@ -264,13 +264,13 @@ export default function ({ types: t }) { // if we have a rest then we need all the elements so don't tell // `scope.toArray` to only get a certain amount - let count = !hasRest(pattern) && pattern.elements.length; + const count = !hasRest(pattern) && pattern.elements.length; // so we need to ensure that the `arrayRef` is an array, `scope.toArray` will // return a locally bound identifier if it's been inferred to be an array, // otherwise it'll be a call to a helper that will ensure it's one - let toArray = this.toArray(arrayRef, count); + const toArray = this.toArray(arrayRef, count); if (t.isIdentifier(toArray)) { // we've been given an identifier so it must have been inferred to be an @@ -315,7 +315,7 @@ export default function ({ types: t }) { // need to save it to a variable if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) { - let memo = this.scope.maybeGenerateMemoised(ref, true); + const memo = this.scope.maybeGenerateMemoised(ref, true); if (memo) { this.nodes.push(this.buildVariableDeclaration(memo, ref)); ref = memo; @@ -334,14 +334,14 @@ export default function ({ types: t }) { return { visitor: { ExportNamedDeclaration(path) { - let declaration = path.get("declaration"); + const declaration = path.get("declaration"); if (!declaration.isVariableDeclaration()) return; if (!variableDeclarationHasPattern(declaration.node)) return; - let specifiers = []; + const specifiers = []; - for (let name in path.getOuterBindingIdentifiers(path)) { - let id = t.identifier(name); + for (const name in path.getOuterBindingIdentifiers(path)) { + const id = t.identifier(name); specifiers.push(t.exportSpecifier(id, id)); } @@ -353,13 +353,13 @@ export default function ({ types: t }) { }, ForXStatement(path, file) { - let { node, scope } = path; - let left = node.left; + const { node, scope } = path; + const left = node.left; if (t.isPattern(left)) { // for ({ length: k } in { abc: 3 }); - let temp = scope.generateUidIdentifier("ref"); + const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ t.variableDeclarator(temp) @@ -376,17 +376,17 @@ export default function ({ types: t }) { if (!t.isVariableDeclaration(left)) return; - let pattern = left.declarations[0].id; + const pattern = left.declarations[0].id; if (!t.isPattern(pattern)) return; - let key = scope.generateUidIdentifier("ref"); + const key = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration(left.kind, [ t.variableDeclarator(key, null) ]); - let nodes = []; + const nodes = []; - let destructuring = new DestructuringTransformer({ + const destructuring = new DestructuringTransformer({ kind: left.kind, file: file, scope: scope, @@ -397,20 +397,20 @@ export default function ({ types: t }) { path.ensureBlock(); - let block = node.body; + const block = node.body; block.body = nodes.concat(block.body); }, CatchClause({ node, scope }, file) { - let pattern = node.param; + const pattern = node.param; if (!t.isPattern(pattern)) return; - let ref = scope.generateUidIdentifier("ref"); + const ref = scope.generateUidIdentifier("ref"); node.param = ref; - let nodes = []; + const nodes = []; - let destructuring = new DestructuringTransformer({ + const destructuring = new DestructuringTransformer({ kind: "let", file: file, scope: scope, @@ -422,12 +422,12 @@ export default function ({ types: t }) { }, AssignmentExpression(path, file) { - let { node, scope } = path; + const { node, scope } = path; if (!t.isPattern(node.left)) return; - let nodes = []; + const nodes = []; - let destructuring = new DestructuringTransformer({ + const destructuring = new DestructuringTransformer({ operator: node.operator, file: file, scope: scope, @@ -457,21 +457,21 @@ export default function ({ types: t }) { }, VariableDeclaration(path, file) { - let { node, scope, parent } = path; + const { node, scope, parent } = path; if (t.isForXStatement(parent)) return; if (!parent || !path.container) return; // i don't know why this is necessary - TODO if (!variableDeclarationHasPattern(node)) return; - let nodes = []; + const nodes = []; let declar; for (let i = 0; i < node.declarations.length; i++) { declar = node.declarations[i]; - let patternId = declar.init; - let pattern = declar.id; + const patternId = declar.init; + const pattern = declar.id; - let destructuring = new DestructuringTransformer({ + const destructuring = new DestructuringTransformer({ blockHoist: node._blockHoist, nodes: nodes, scope: scope, diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js index 551e27a4ec..f2d7a6990f 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js @@ -26,27 +26,27 @@ export default function() { const alreadySeenGetters = Object.create(null); const alreadySeenSetters = Object.create(null); - for (let prop of plainProps) { + for (const prop of plainProps) { const name = getName(prop.key); let isDuplicate = false; switch (prop.kind) { - case "get": - if (alreadySeenData[name] || alreadySeenGetters[name]) { - isDuplicate = true; - } - alreadySeenGetters[name] = true; - break; - case "set": - if (alreadySeenData[name] || alreadySeenSetters[name]) { - isDuplicate = true; - } - alreadySeenSetters[name] = true; - break; - default: - if (alreadySeenData[name] || alreadySeenGetters[name] || alreadySeenSetters[name]) { - isDuplicate = true; - } - alreadySeenData[name] = true; + case "get": + if (alreadySeenData[name] || alreadySeenGetters[name]) { + isDuplicate = true; + } + alreadySeenGetters[name] = true; + break; + case "set": + if (alreadySeenData[name] || alreadySeenSetters[name]) { + isDuplicate = true; + } + alreadySeenSetters[name] = true; + break; + default: + if (alreadySeenData[name] || alreadySeenGetters[name] || alreadySeenSetters[name]) { + isDuplicate = true; + } + alreadySeenData[name] = true; } if (isDuplicate) { diff --git a/packages/babel-plugin-transform-es2015-for-of/src/index.js b/packages/babel-plugin-transform-es2015-for-of/src/index.js index ca5ab6c090..760e0e69b0 100644 --- a/packages/babel-plugin-transform-es2015-for-of/src/index.js +++ b/packages/babel-plugin-transform-es2015-for-of/src/index.js @@ -1,11 +1,11 @@ /* eslint max-len: 0 */ export default function ({ messages, template, types: t }) { - let buildForOfArray = template(` + const buildForOfArray = template(` for (var KEY = 0; KEY < ARR.length; KEY++) BODY; `); - let buildForOfLoose = template(` + const buildForOfLoose = template(` for (var LOOP_OBJECT = OBJECT, IS_ARRAY = Array.isArray(LOOP_OBJECT), INDEX = 0, @@ -22,7 +22,7 @@ export default function ({ messages, template, types: t }) { } `); - let buildForOf = template(` + const buildForOf = template(` var ITERATOR_COMPLETION = true; var ITERATOR_HAD_ERROR_KEY = false; var ITERATOR_ERROR_KEY = undefined; @@ -46,19 +46,19 @@ export default function ({ messages, template, types: t }) { `); function _ForOfStatementArray(path) { - let { node, scope } = path; - let nodes = []; + const { node, scope } = path; + const nodes = []; let right = node.right; if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) { - let uid = scope.generateUidIdentifier("arr"); + const uid = scope.generateUidIdentifier("arr"); nodes.push(t.variableDeclaration("var", [ t.variableDeclarator(uid, right) ])); right = uid; } - let iterationKey = scope.generateUidIdentifier("i"); + const iterationKey = scope.generateUidIdentifier("i"); let loop = buildForOfArray({ BODY: node.body, @@ -69,9 +69,9 @@ export default function ({ messages, template, types: t }) { t.inherits(loop, node); t.ensureBlock(loop); - let iterationValue = t.memberExpression(right, iterationKey, true); + const iterationValue = t.memberExpression(right, iterationKey, true); - let left = node.left; + const left = node.left; if (t.isVariableDeclaration(left)) { left.declarations[0].init = iterationValue; loop.body.body.unshift(left); @@ -103,11 +103,11 @@ export default function ({ messages, template, types: t }) { let callback = spec; if (state.opts.loose) callback = loose; - let { node } = path; - let build = callback(path, state); - let declar = build.declar; - let loop = build.loop; - let block = loop.body; + const { node } = path; + const build = callback(path, state); + const declar = build.declar; + const loop = build.loop; + const block = loop.body; // ensure that it's a block so we can take all its statements path.ensureBlock(); @@ -134,9 +134,9 @@ export default function ({ messages, template, types: t }) { }; function loose(path, file) { - let { node, scope } = path; + const { node, scope } = path; - let left = node.left; + const left = node.left; let declar, id; if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { @@ -152,10 +152,10 @@ export default function ({ messages, template, types: t }) { throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); } - let iteratorKey = scope.generateUidIdentifier("iterator"); - let isArrayKey = scope.generateUidIdentifier("isArray"); + const iteratorKey = scope.generateUidIdentifier("iterator"); + const isArrayKey = scope.generateUidIdentifier("isArray"); - let loop = buildForOfLoose({ + const loop = buildForOfLoose({ LOOP_OBJECT: iteratorKey, IS_ARRAY: isArrayKey, OBJECT: node.right, @@ -179,12 +179,12 @@ export default function ({ messages, template, types: t }) { } function spec(path, file) { - let { node, scope, parent } = path; - let left = node.left; + const { node, scope, parent } = path; + const left = node.left; let declar; - let stepKey = scope.generateUidIdentifier("step"); - let stepValue = t.memberExpression(stepKey, t.identifier("value")); + const stepKey = scope.generateUidIdentifier("step"); + const stepValue = t.memberExpression(stepKey, t.identifier("value")); if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { // for (i of test), for ({ i } of test) @@ -200,9 +200,9 @@ export default function ({ messages, template, types: t }) { // - let iteratorKey = scope.generateUidIdentifier("iterator"); + const iteratorKey = scope.generateUidIdentifier("iterator"); - let template = buildForOf({ + const template = buildForOf({ ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), @@ -212,10 +212,10 @@ export default function ({ messages, template, types: t }) { BODY: null }); - let isLabeledParent = t.isLabeledStatement(parent); + const isLabeledParent = t.isLabeledStatement(parent); - let tryBody = template[3].block.body; - let loop = tryBody[0]; + const tryBody = template[3].block.body; + const loop = tryBody[0]; if (isLabeledParent) { tryBody[0] = t.labeledStatement(parent.label, loop); diff --git a/packages/babel-plugin-transform-es2015-function-name/src/index.js b/packages/babel-plugin-transform-es2015-function-name/src/index.js index ab403e6ec5..6fdeedd069 100644 --- a/packages/babel-plugin-transform-es2015-function-name/src/index.js +++ b/packages/babel-plugin-transform-es2015-function-name/src/index.js @@ -6,16 +6,16 @@ export default function () { "ArrowFunctionExpression|FunctionExpression": { exit(path) { if (path.key !== "value" && !path.parentPath.isObjectProperty()) { - let replacement = nameFunction(path); + const replacement = nameFunction(path); if (replacement) path.replaceWith(replacement); } } }, ObjectProperty(path) { - let value = path.get("value"); + const value = path.get("value"); if (value.isFunction()) { - let newNode = nameFunction(value); + const newNode = nameFunction(value); if (newNode) value.replaceWith(newNode); } } diff --git a/packages/babel-plugin-transform-es2015-instanceof/src/index.js b/packages/babel-plugin-transform-es2015-instanceof/src/index.js index d12f4c6fc9..ff744f9cff 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/src/index.js +++ b/packages/babel-plugin-transform-es2015-instanceof/src/index.js @@ -2,7 +2,7 @@ export default function ({ types: t }) { return { visitor: { BinaryExpression(path) { - let { node } = path; + const { node } = path; if (node.operator === "instanceof") { path.replaceWith(t.callExpression(this.addHelper("instanceof"), [node.left, node.right])); } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js index 3c5f9243bc..bb9eb42c96 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js @@ -1,10 +1,10 @@ import template from "babel-template"; -let buildDefine = template(` +const buildDefine = template(` define(MODULE_NAME, [SOURCES], FACTORY); `); -let buildFactory = template(` +const buildFactory = template(` (function (PARAMS) { BODY; }) @@ -16,16 +16,16 @@ export default function ({ types: t }) { if (!path.get("callee").isIdentifier({ name: "require" })) return false; if (path.scope.getBinding("require")) return false; - let args = path.get("arguments"); + const args = path.get("arguments"); if (args.length !== 1) return false; - let arg = args[0]; + const arg = args[0]; if (!arg.isStringLiteral()) return false; return true; } - let amdVisitor = { + const amdVisitor = { ReferencedIdentifier({ node, scope }) { if (node.name === "exports" && !scope.getBinding("exports")) { this.hasExports = true; @@ -43,13 +43,13 @@ export default function ({ types: t }) { }, VariableDeclarator(path) { - let id = path.get("id"); + const id = path.get("id"); if (!id.isIdentifier()) return; - let init = path.get("init"); + const init = path.get("init"); if (!isValidRequireCall(init)) return; - let source = init.node.arguments[0]; + const source = init.node.arguments[0]; this.sourceNames[source.value] = true; this.sources.push([id.node, source]); @@ -80,7 +80,7 @@ export default function ({ types: t }) { path.traverse(amdVisitor, this); - let params = this.sources.map((source) => source[0]); + const params = this.sources.map((source) => source[0]); let sources = this.sources.map((source) => source[1]); sources = sources.concat(this.bareSources.filter((str) => { @@ -100,8 +100,8 @@ export default function ({ types: t }) { params.unshift(t.identifier("module")); } - let { node } = path; - let factory = buildFactory({ + const { node } = path; + const factory = buildFactory({ PARAMS: params, BODY: node.body }); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 8d3351bfa9..a7285da446 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -4,17 +4,17 @@ import { basename, extname } from "path"; import template from "babel-template"; import * as t from "babel-types"; -let buildRequire = template(` +const buildRequire = template(` require($0); `); -let buildExportsModuleDeclaration = template(` +const buildExportsModuleDeclaration = template(` Object.defineProperty(exports, "__esModule", { value: true }); `); -let buildExportsFrom = template(` +const buildExportsFrom = template(` Object.defineProperty(exports, $0, { enumerable: true, get: function () { @@ -23,15 +23,15 @@ let buildExportsFrom = template(` }); `); -let buildLooseExportsModuleDeclaration = template(` +const buildLooseExportsModuleDeclaration = template(` exports.__esModule = true; `); -let buildExportsAssignment = template(` +const buildExportsAssignment = template(` exports.$0 = $1; `); -let buildExportAll = template(` +const buildExportAll = template(` Object.keys(OBJECT).forEach(function (key) { if (key === "default" || key === "__esModule") return; Object.defineProperty(exports, key, { @@ -46,12 +46,12 @@ let buildExportAll = template(` const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"]; export default function () { - let REASSIGN_REMAP_SKIP = Symbol(); + const REASSIGN_REMAP_SKIP = Symbol(); - let reassignmentVisitor = { + const reassignmentVisitor = { ReferencedIdentifier(path) { - let name = path.node.name; - let remap = this.remaps[name]; + const name = path.node.name; + const remap = this.remaps[name]; if (!remap) return; // redeclared in this scope @@ -72,11 +72,11 @@ export default function () { let node = path.node; if (node[REASSIGN_REMAP_SKIP]) return; - let left = path.get("left"); + const left = path.get("left"); if (!left.isIdentifier()) return; - let name = left.node.name; - let exports = this.exports[name]; + const name = left.node.name; + const exports = this.exports[name]; if (!exports) return; // redeclared in this scope @@ -84,7 +84,7 @@ export default function () { node[REASSIGN_REMAP_SKIP] = true; - for (let reid of exports) { + for (const reid of exports) { node = buildExportsAssignment(reid, node).expression; } @@ -93,17 +93,17 @@ export default function () { }, UpdateExpression(path) { - let arg = path.get("argument"); + const arg = path.get("argument"); if (!arg.isIdentifier()) return; - let name = arg.node.name; - let exports = this.exports[name]; + const name = arg.node.name; + const exports = this.exports[name]; if (!exports) return; // redeclared in this scope if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; - let node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1)); + const node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1)); if ((path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) || path.node.prefix) { path.replaceWith(node); @@ -111,7 +111,7 @@ export default function () { return; } - let nodes = []; + const nodes = []; nodes.push(node); let operator; @@ -149,9 +149,9 @@ export default function () { exit(path) { this.ranCommonJS = true; - let strict = !!this.opts.strict; + const strict = !!this.opts.strict; - let { scope } = path; + const { scope } = path; // rename these commonjs variables if they're declared in the file scope.rename("module"); @@ -161,24 +161,24 @@ export default function () { let hasExports = false; let hasImports = false; - let body: Array = path.get("body"); - let imports = Object.create(null); - let exports = Object.create(null); + const body: Array = path.get("body"); + const imports = Object.create(null); + const exports = Object.create(null); - let nonHoistedExportNames = Object.create(null); + const nonHoistedExportNames = Object.create(null); - let topNodes = []; - let remaps = Object.create(null); + const topNodes = []; + const remaps = Object.create(null); - let requires = Object.create(null); + const requires = Object.create(null); function addRequire(source, blockHoist) { - let cached = requires[source]; + const cached = requires[source]; if (cached) return cached; - let ref = path.scope.generateUidIdentifier(basename(source, extname(source))); + const ref = path.scope.generateUidIdentifier(basename(source, extname(source))); - let varDecl = t.variableDeclaration("var", [ + const varDecl = t.variableDeclaration("var", [ t.variableDeclarator(ref, buildRequire( t.stringLiteral(source) ).expression) @@ -200,17 +200,17 @@ export default function () { } function addTo(obj, key, arr) { - let existing = obj[key] || []; + const existing = obj[key] || []; obj[key] = existing.concat(arr); } - for (let path of body) { + for (const path of body) { if (path.isExportDeclaration()) { hasExports = true; - let specifiers = [].concat(path.get("declaration"), path.get("specifiers")); - for (let specifier of specifiers) { - let ids = specifier.getBindingIdentifiers(); + const specifiers = [].concat(path.get("declaration"), path.get("specifiers")); + for (const specifier of specifiers) { + const ids = specifier.getBindingIdentifiers(); if (ids.__esModule) { throw specifier.buildCodeFrameError("Illegal export \"__esModule\""); } @@ -220,8 +220,8 @@ export default function () { if (path.isImportDeclaration()) { hasImports = true; - let key = path.node.source.value; - let importsEntry = imports[key] || { + const key = path.node.source.value; + const importsEntry = imports[key] || { specifiers: [], maxBlockHoist: 0, loc: path.node.loc, @@ -240,10 +240,10 @@ export default function () { path.remove(); } else if (path.isExportDefaultDeclaration()) { - let declaration = path.get("declaration"); + const declaration = path.get("declaration"); if (declaration.isFunctionDeclaration()) { - let id = declaration.node.id; - let defNode = t.identifier("default"); + const id = declaration.node.id; + const defNode = t.identifier("default"); if (id) { addTo(exports, id.name, defNode); topNodes.push(buildExportsAssignment(defNode, id)); @@ -253,8 +253,8 @@ export default function () { path.remove(); } } else if (declaration.isClassDeclaration()) { - let id = declaration.node.id; - let defNode = t.identifier("default"); + const id = declaration.node.id; + const defNode = t.identifier("default"); if (id) { addTo(exports, id.name, defNode); path.replaceWithMultiple([ @@ -278,15 +278,15 @@ export default function () { path.parentPath.requeue(path.get("expression.left")); } } else if (path.isExportNamedDeclaration()) { - let declaration = path.get("declaration"); + const declaration = path.get("declaration"); if (declaration.node) { if (declaration.isFunctionDeclaration()) { - let id = declaration.node.id; + const id = declaration.node.id; addTo(exports, id.name, id); topNodes.push(buildExportsAssignment(id, id)); path.replaceWith(declaration.node); } else if (declaration.isClassDeclaration()) { - let id = declaration.node.id; + const id = declaration.node.id; addTo(exports, id.name, id); path.replaceWithMultiple([ declaration.node, @@ -294,11 +294,11 @@ export default function () { ]); nonHoistedExportNames[id.name] = true; } else if (declaration.isVariableDeclaration()) { - let declarators = declaration.get("declarations"); - for (let decl of declarators) { - let id = decl.get("id"); + const declarators = declaration.get("declarations"); + for (const decl of declarators) { + const id = decl.get("id"); - let init = decl.get("init"); + const init = decl.get("init"); if (!init.node) init.replaceWith(t.identifier("undefined")); if (id.isIdentifier()) { @@ -314,13 +314,13 @@ export default function () { continue; } - let specifiers = path.get("specifiers"); - let nodes = []; - let source = path.node.source; + const specifiers = path.get("specifiers"); + const nodes = []; + const source = path.node.source; if (source) { - let ref = addRequire(source.value, path.node._blockHoist); + const ref = addRequire(source.value, path.node._blockHoist); - for (let specifier of specifiers) { + for (const specifier of specifiers) { if (specifier.isExportNamespaceSpecifier()) { // todo } else if (specifier.isExportDefaultSpecifier()) { @@ -335,7 +335,7 @@ export default function () { } } } else { - for (let specifier of specifiers) { + for (const specifier of specifiers) { if (specifier.isExportSpecifier()) { addTo(exports, specifier.node.local.name, specifier.node.exported); nonHoistedExportNames[specifier.node.exported.name] = true; @@ -345,7 +345,7 @@ export default function () { } path.replaceWithMultiple(nodes); } else if (path.isExportAllDeclaration()) { - let exportNode = buildExportAll({ + const exportNode = buildExportAll({ OBJECT: addRequire(path.node.source.value, path.node._blockHoist) }); exportNode.loc = path.node.loc; @@ -354,15 +354,15 @@ export default function () { } } - for (let source in imports) { - let {specifiers, maxBlockHoist} = imports[source]; + for (const source in imports) { + const {specifiers, maxBlockHoist} = imports[source]; if (specifiers.length) { - let uid = addRequire(source, maxBlockHoist); + const uid = addRequire(source, maxBlockHoist); let wildcard; for (let i = 0; i < specifiers.length; i++) { - let specifier = specifiers[i]; + const specifier = specifiers[i]; if (t.isImportNamespaceSpecifier(specifier)) { if (strict) { remaps[specifier.local.name] = uid; @@ -389,7 +389,7 @@ export default function () { } } - for (let specifier of specifiers) { + for (const specifier of specifiers) { if (t.isImportSpecifier(specifier)) { let target = uid; if (specifier.imported.name === "default") { @@ -419,7 +419,7 @@ export default function () { } } else { // bare import - let requireNode = buildRequire(t.stringLiteral(source)); + const requireNode = buildRequire(t.stringLiteral(source)); requireNode.loc = imports[source].loc; topNodes.push(requireNode); } @@ -428,7 +428,7 @@ export default function () { if (hasImports && Object.keys(nonHoistedExportNames).length) { let hoistedExportsNode = t.identifier("undefined"); - for (let name in nonHoistedExportNames) { + for (const name in nonHoistedExportNames) { hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js index beee1e9cd3..2ab422c89b 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js @@ -1,14 +1,14 @@ -let assert = require("assert"); -let babel = require("babel-core"); -let vm = require("vm"); +const assert = require("assert"); +const babel = require("babel-core"); +const vm = require("vm"); test("Re-export doesn't overwrite __esModule flag", function () { let code = "export * from \"./dep\";"; - let depStub = { + const depStub = { __esModule: false, }; - let context = { + const context = { module: { exports: {} }, diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js index 93091bac29..c79baab12b 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js @@ -3,7 +3,7 @@ import hoistVariables from "babel-helper-hoist-variables"; import template from "babel-template"; -let buildTemplate = template(` +const buildTemplate = template(` SYSTEM_REGISTER(MODULE_NAME, [SOURCES], function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) { "use strict"; BEFORE_BODY; @@ -16,7 +16,7 @@ let buildTemplate = template(` }); `); -let buildExportAll = template(` +const buildExportAll = template(` for (var KEY in TARGET) { if (KEY !== "default" && KEY !== "__esModule") EXPORT_OBJ[KEY] = TARGET[KEY]; } @@ -26,22 +26,22 @@ let buildExportAll = template(` const TYPE_IMPORT = "Import"; export default function ({ types: t }) { - let IGNORE_REASSIGNMENT_SYMBOL = Symbol(); + const IGNORE_REASSIGNMENT_SYMBOL = Symbol(); - let reassignmentVisitor = { + const reassignmentVisitor = { "AssignmentExpression|UpdateExpression"(path) { if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return; path.node[IGNORE_REASSIGNMENT_SYMBOL] = true; - let arg = path.get(path.isAssignmentExpression() ? "left" : "argument"); + const arg = path.get(path.isAssignmentExpression() ? "left" : "argument"); if (!arg.isIdentifier()) return; - let name = arg.node.name; + const name = arg.node.name; // redeclared in this scope if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return; - let exportedNames = this.exports[name]; + const exportedNames = this.exports[name]; if (!exportedNames) return; let node = path.node; @@ -59,7 +59,7 @@ export default function ({ types: t }) { isPostUpdateExpression = false; } - for (let exportedName of exportedNames) { + for (const exportedName of exportedNames) { node = this.buildCall(exportedName, node).expression; } @@ -75,7 +75,7 @@ export default function ({ types: t }) { CallExpression(path, state) { if (path.node.callee.type === TYPE_IMPORT) { - let contextIdent = state.contextIdent; + const contextIdent = state.contextIdent; path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), path.node.arguments)); } }, @@ -91,17 +91,17 @@ export default function ({ types: t }) { state.contextIdent = path.scope.generateUidIdentifier("context"); }, exit(path, state) { - let exportIdent = path.scope.generateUidIdentifier("export"); - let contextIdent = state.contextIdent; + const exportIdent = path.scope.generateUidIdentifier("export"); + const contextIdent = state.contextIdent; - let exportNames = Object.create(null); - let modules = []; + const exportNames = Object.create(null); + const modules = []; let beforeBody = []; - let setters = []; - let sources = []; - let variableIds = []; - let removedPaths = []; + const setters = []; + const sources = []; + const variableIds = []; + const removedPaths = []; function addExportName(key, val) { exportNames[key] = exportNames[key] || []; @@ -127,7 +127,7 @@ export default function ({ types: t }) { ); } - let body: Array = path.get("body"); + const body: Array = path.get("body"); let canHoist = true; for (let path of body) { @@ -138,14 +138,14 @@ export default function ({ types: t }) { } } - for (let path of body) { + for (const path of body) { if (canHoist && path.isFunctionDeclaration()) { beforeBody.push(path.node); removedPaths.push(path); } else if (path.isImportDeclaration()) { - let source = path.node.source.value; + const source = path.node.source.value; pushModule(source, "imports", path.node.specifiers); - for (let name in path.getBindingIdentifiers()) { + for (const name in path.getBindingIdentifiers()) { path.scope.removeBinding(name); variableIds.push(t.identifier(name)); } @@ -154,10 +154,10 @@ export default function ({ types: t }) { pushModule(path.node.source.value, "exports", path.node); path.remove(); } else if (path.isExportDefaultDeclaration()) { - let declar = path.get("declaration"); + const declar = path.get("declaration"); if (declar.isClassDeclaration() || declar.isFunctionDeclaration()) { - let id = declar.node.id; - let nodes = []; + const id = declar.node.id; + const nodes = []; if (id) { nodes.push(declar.node); @@ -177,16 +177,16 @@ export default function ({ types: t }) { path.replaceWith(buildExportCall("default", declar.node)); } } else if (path.isExportNamedDeclaration()) { - let declar = path.get("declaration"); + const declar = path.get("declaration"); if (declar.node) { path.replaceWith(declar); - let nodes = []; + const nodes = []; let bindingIdentifiers; if (path.isFunction()) { - let node = declar.node; - let name = node.id.name; + const node = declar.node; + const name = node.id.name; if (canHoist) { addExportName(name, name); beforeBody.push(node); @@ -198,21 +198,21 @@ export default function ({ types: t }) { } else { bindingIdentifiers = declar.getBindingIdentifiers(); } - for (let name in bindingIdentifiers) { + for (const name in bindingIdentifiers) { addExportName(name, name); nodes.push(buildExportCall(name, t.identifier(name))); } path.insertAfter(nodes); } else { - let specifiers = path.node.specifiers; + const specifiers = path.node.specifiers; if (specifiers && specifiers.length) { if (path.node.source) { pushModule(path.node.source.value, "exports", specifiers); path.remove(); } else { - let nodes = []; + const nodes = []; - for (let specifier of specifiers) { + for (const specifier of specifiers) { nodes.push(buildExportCall(specifier.exported.name, specifier.local)); addExportName(specifier.local.name, specifier.exported.name); } @@ -225,8 +225,8 @@ export default function ({ types: t }) { } modules.forEach(function (specifiers) { - let setterBody = []; - let target = path.scope.generateUidIdentifier(specifiers.key); + const setterBody = []; + const target = path.scope.generateUidIdentifier(specifiers.key); for (let specifier of specifiers.imports) { if (t.isImportNamespaceSpecifier(specifier)) { @@ -241,13 +241,13 @@ export default function ({ types: t }) { } if (specifiers.exports.length) { - let exportObjRef = path.scope.generateUidIdentifier("exportObj"); + const exportObjRef = path.scope.generateUidIdentifier("exportObj"); setterBody.push(t.variableDeclaration("var", [ t.variableDeclarator(exportObjRef, t.objectExpression([])) ])); - for (let node of specifiers.exports) { + for (const node of specifiers.exports) { if (t.isExportAllDeclaration(node)) { setterBody.push(buildExportAll({ KEY: path.scope.generateUidIdentifier("key"), @@ -288,7 +288,7 @@ export default function ({ types: t }) { scope: path.scope }); - for (let path of removedPaths) { + for (const path of removedPaths) { path.remove(); } diff --git a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js index 44b88ee55d..b13ab6af37 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js @@ -3,18 +3,18 @@ import { basename, extname } from "path"; import template from "babel-template"; -let buildPrerequisiteAssignment = template(` +const buildPrerequisiteAssignment = template(` GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} `); -let buildGlobalExport = template(` +const buildGlobalExport = template(` var mod = { exports: {} }; factory(BROWSER_ARGUMENTS); PREREQUISITE_ASSIGNMENTS GLOBAL_TO_ASSIGN = mod.exports; `); -let buildWrapper = template(` +const buildWrapper = template(` (function (global, factory) { if (typeof define === "function" && define.amd) { define(MODULE_NAME, AMD_ARGUMENTS, factory); @@ -30,11 +30,11 @@ export default function ({ types: t }) { function isValidDefine(path) { if (!path.isExpressionStatement()) return; - let expr = path.get("expression"); + const expr = path.get("expression"); if (!expr.isCallExpression()) return false; if (!expr.get("callee").isIdentifier({ name: "define" })) return false; - let args = expr.get("arguments"); + const args = expr.get("arguments"); if (args.length === 3 && !args.shift().isStringLiteral()) return false; if (args.length !== 2) return false; if (!args.shift().isArrayExpression()) return false; @@ -49,18 +49,18 @@ export default function ({ types: t }) { visitor: { Program: { exit(path, state) { - let last = path.get("body").pop(); + const last = path.get("body").pop(); if (!isValidDefine(last)) return; - let call = last.node.expression; - let args = call.arguments; + const call = last.node.expression; + const args = call.arguments; - let moduleName = args.length === 3 ? args.shift() : null; - let amdArgs = call.arguments[0]; - let func = call.arguments[1]; - let browserGlobals = state.opts.globals || {}; + const moduleName = args.length === 3 ? args.shift() : null; + const amdArgs = call.arguments[0]; + const func = call.arguments[1]; + const browserGlobals = state.opts.globals || {}; - let commonArgs = amdArgs.elements.map((arg) => { + const commonArgs = amdArgs.elements.map((arg) => { if (arg.value === "module" || arg.value === "exports") { return t.identifier(arg.value); } else { @@ -68,7 +68,7 @@ export default function ({ types: t }) { } }); - let browserArgs = amdArgs.elements.map((arg) => { + const browserArgs = amdArgs.elements.map((arg) => { if (arg.value === "module") { return t.identifier("mod"); } else if (arg.value === "exports") { @@ -77,7 +77,7 @@ export default function ({ types: t }) { let memberExpression; if (state.opts.exactGlobals) { - let globalRef = browserGlobals[arg.value]; + const globalRef = browserGlobals[arg.value]; if (globalRef) { memberExpression = globalRef.split(".").reduce( (accum, curr) => t.memberExpression(accum, t.identifier(curr)), t.identifier("global") @@ -88,8 +88,8 @@ export default function ({ types: t }) { ); } } else { - let requireName = basename(arg.value, extname(arg.value)); - let globalName = browserGlobals[requireName] || requireName; + const requireName = basename(arg.value, extname(arg.value)); + const globalName = browserGlobals[requireName] || requireName; memberExpression = t.memberExpression( t.identifier("global"), t.identifier(t.toIdentifier(globalName)) ); @@ -99,19 +99,19 @@ export default function ({ types: t }) { } }); - let moduleNameOrBasename = moduleName ? moduleName.value : this.file.opts.basename; + const moduleNameOrBasename = moduleName ? moduleName.value : this.file.opts.basename; let globalToAssign = t.memberExpression( t.identifier("global"), t.identifier(t.toIdentifier(moduleNameOrBasename)) ); let prerequisiteAssignments = null; if (state.opts.exactGlobals) { - let globalName = browserGlobals[moduleNameOrBasename]; + const globalName = browserGlobals[moduleNameOrBasename]; if (globalName) { prerequisiteAssignments = []; - let members = globalName.split("."); + const members = globalName.split("."); globalToAssign = members.slice(1).reduce((accum, curr) => { prerequisiteAssignments.push(buildPrerequisiteAssignment({ GLOBAL_REFERENCE: accum })); return t.memberExpression(accum, t.identifier(curr)); @@ -119,7 +119,7 @@ export default function ({ types: t }) { } } - let globalExport = buildGlobalExport({ + const globalExport = buildGlobalExport({ BROWSER_ARGUMENTS: browserArgs, PREREQUISITE_ASSIGNMENTS: prerequisiteAssignments, GLOBAL_TO_ASSIGN: globalToAssign diff --git a/packages/babel-plugin-transform-es2015-object-super/src/index.js b/packages/babel-plugin-transform-es2015-object-super/src/index.js index 95098fda8a..5e633fe447 100644 --- a/packages/babel-plugin-transform-es2015-object-super/src/index.js +++ b/packages/babel-plugin-transform-es2015-object-super/src/index.js @@ -2,7 +2,7 @@ import ReplaceSupers from "babel-helper-replace-supers"; export default function ({ types: t }) { function Property(path, node, scope, getObjectRef, file) { - let replaceSupers = new ReplaceSupers({ + const replaceSupers = new ReplaceSupers({ getObjectRef: getObjectRef, methodNode: node, methodPath: path, @@ -14,12 +14,12 @@ export default function ({ types: t }) { replaceSupers.replace(); } - let CONTAINS_SUPER = Symbol(); + const CONTAINS_SUPER = Symbol(); return { visitor: { Super(path) { - let parentObj = path.findParent((path) => path.isObjectExpression()); + const parentObj = path.findParent((path) => path.isObjectExpression()); if (parentObj) parentObj.node[CONTAINS_SUPER] = true; }, @@ -28,9 +28,9 @@ export default function ({ types: t }) { if (!path.node[CONTAINS_SUPER]) return; let objectRef; - let getObjectRef = () => objectRef = objectRef || path.scope.generateUidIdentifier("obj"); + const getObjectRef = () => objectRef = objectRef || path.scope.generateUidIdentifier("obj"); - let propPaths: Array = path.get("properties"); + const propPaths: Array = path.get("properties"); for (let propPath of propPaths) { if (propPath.isObjectProperty()) propPath = propPath.get("value"); Property(propPath, propPath.node, path.scope, getObjectRef, file); diff --git a/packages/babel-plugin-transform-es2015-parameters/src/default.js b/packages/babel-plugin-transform-es2015-parameters/src/default.js index 445000fadb..f123ed195e 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/default.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/default.js @@ -5,7 +5,7 @@ import callDelegate from "babel-helper-call-delegate"; import template from "babel-template"; import * as t from "babel-types"; -let buildDefaultParam = template(` +const buildDefaultParam = template(` let VARIABLE_NAME = ARGUMENTS.length > ARGUMENT_KEY && ARGUMENTS[ARGUMENT_KEY] !== undefined ? ARGUMENTS[ARGUMENT_KEY] @@ -13,12 +13,12 @@ let buildDefaultParam = template(` DEFAULT_VALUE; `); -let buildCutOff = template(` +const buildCutOff = template(` let $0 = $1[$2]; `); function hasDefaults(node) { - for (let param of (node.params: Array)) { + for (const param of (node.params: Array)) { if (!t.isIdentifier(param)) return true; } return false; @@ -30,7 +30,7 @@ function isSafeBinding(scope, node) { return kind === "param" || kind === "local"; } -let iifeVisitor = { +const iifeVisitor = { ReferencedIdentifier(path, state) { const { scope, node } = path; if (node.name === "eval" || !isSafeBinding(scope, node)) { @@ -45,23 +45,23 @@ let iifeVisitor = { } }; -export let visitor = { +export const visitor = { Function(path) { - let { node, scope } = path; + const { node, scope } = path; if (!hasDefaults(node)) return; // ensure it's a block, useful for arrow functions path.ensureBlock(); - let state = { + const state = { iife: false, scope: scope }; - let body = []; + const body = []; // - let argsIdentifier = t.identifier("arguments"); + const argsIdentifier = t.identifier("arguments"); argsIdentifier._shadowedFunctionLiteral = path; // push a default parameter definition @@ -77,12 +77,12 @@ export let visitor = { } // - let lastNonDefaultParam = getFunctionArity(node); + const lastNonDefaultParam = getFunctionArity(node); // - let params = path.get("params"); + const params = path.get("params"); for (let i = 0; i < params.length; i++) { - let param = params[i]; + const param = params[i]; if (!param.isAssignmentPattern()) { if (!state.iife && !param.isIdentifier()) { @@ -92,12 +92,12 @@ export let visitor = { continue; } - let left = param.get("left"); - let right = param.get("right"); + const left = param.get("left"); + const right = param.get("right"); // if (i >= lastNonDefaultParam || left.isPattern()) { - let placeholder = scope.generateUidIdentifier("x"); + const placeholder = scope.generateUidIdentifier("x"); placeholder._isDefaultPlaceholder = true; node.params[i] = placeholder; } else { @@ -119,10 +119,10 @@ export let visitor = { // add declarations for trailing parameters for (let i = lastNonDefaultParam + 1; i < node.params.length; i++) { - let param = node.params[i]; + const param = node.params[i]; if (param._isDefaultPlaceholder) continue; - let declar = buildCutOff(param, argsIdentifier, t.numericLiteral(i)); + const declar = buildCutOff(param, argsIdentifier, t.numericLiteral(i)); declar._blockHoist = node.params.length - i; body.push(declar); } diff --git a/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js b/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js index e3a7e10494..495ac06050 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js @@ -1,20 +1,20 @@ import * as t from "babel-types"; -export let visitor = { +export const visitor = { Function(path) { - let params: Array = path.get("params"); + const params: Array = path.get("params"); // If there's a rest param, no need to loop through it. Also, we need to // hoist one more level to get `declar` at the right spot. - let hoistTweak = t.isRestElement(params[params.length - 1]) ? 1 : 0; - let outputParamsLength = params.length - hoistTweak; + const hoistTweak = t.isRestElement(params[params.length - 1]) ? 1 : 0; + const outputParamsLength = params.length - hoistTweak; for (let i = 0; i < outputParamsLength; i++) { - let param = params[i]; + const param = params[i]; if (param.isArrayPattern() || param.isObjectPattern()) { - let uid = path.scope.generateUidIdentifier("ref"); + const uid = path.scope.generateUidIdentifier("ref"); - let declar = t.variableDeclaration("let", [ + const declar = t.variableDeclaration("let", [ t.variableDeclarator(param.node, uid) ]); declar._blockHoist = outputParamsLength - i; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/index.js b/packages/babel-plugin-transform-es2015-parameters/src/index.js index 6279147062..d59d21b3bf 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/index.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/index.js @@ -10,8 +10,8 @@ export default function () { visitor: visitors.merge([{ ArrowFunctionExpression(path) { // default/rest visitors require access to `arguments` - let params: Array = path.get("params"); - for (let param of params) { + const params: Array = path.get("params"); + for (const param of params) { if (param.isRestElement() || param.isAssignmentPattern()) { path.arrowFunctionToShadowed(); break; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/rest.js b/packages/babel-plugin-transform-es2015-parameters/src/rest.js index bda77d8c11..3ae51ed548 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/rest.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/rest.js @@ -3,7 +3,7 @@ import template from "babel-template"; import * as t from "babel-types"; -let buildRest = template(` +const buildRest = template(` for (var LEN = ARGUMENTS.length, ARRAY = Array(ARRAY_LEN), KEY = START; @@ -13,19 +13,19 @@ let buildRest = template(` } `); -let restIndex = template(` +const restIndex = template(` ARGUMENTS.length <= INDEX ? undefined : ARGUMENTS[INDEX] `); -let restIndexImpure = template(` +const restIndexImpure = template(` REF = INDEX, ARGUMENTS.length <= REF ? undefined : ARGUMENTS[REF] `); -let restLength = template(` +const restLength = template(` ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET `); -let memberExpressionOptimisationVisitor = { +const memberExpressionOptimisationVisitor = { Scope(path, state) { // check if this scope has a local binding that will shadow the rest parameter if (!path.scope.bindingIdentifierEquals(state.name, state.outerBinding)) { @@ -43,7 +43,7 @@ let memberExpressionOptimisationVisitor = { "Function|ClassProperty": function (path, state) { // Detect whether any reference to rest is contained in nested functions to // determine if deopt is necessary. - let oldNoOptimise = state.noOptimise; + const oldNoOptimise = state.noOptimise; state.noOptimise = true; path.traverse(memberExpressionOptimisationVisitor, state); state.noOptimise = oldNoOptimise; @@ -54,7 +54,7 @@ let memberExpressionOptimisationVisitor = { }, ReferencedIdentifier(path, state) { - let { node } = path; + const { node } = path; // we can't guarantee the purity of arguments if (node.name === "arguments") { @@ -67,7 +67,7 @@ let memberExpressionOptimisationVisitor = { if (state.noOptimise) { state.deopted = true; } else { - let {parentPath} = path; + const {parentPath} = path; // Is this identifier the right hand side of a default parameter? if (parentPath.listKey === "params" && parentPath.key < state.offset) { @@ -77,9 +77,9 @@ let memberExpressionOptimisationVisitor = { // ex: `args[0]` // ex: `args.whatever` if (parentPath.isMemberExpression({ object: node })) { - let grandparentPath = parentPath.parentPath; + const grandparentPath = parentPath.parentPath; - let argsOptEligible = !state.deopted && !( + const argsOptEligible = !state.deopted && !( // ex: `args[0] = "whatever"` ( grandparentPath.isAssignmentExpression() && @@ -134,7 +134,7 @@ let memberExpressionOptimisationVisitor = { // optimise single spread args in calls // ex: fn(...args) if (state.offset === 0 && parentPath.isSpreadElement()) { - let call = parentPath.parentPath; + const call = parentPath.parentPath; if (call.isCallExpression() && call.node.arguments.length === 1) { state.candidates.push({cause: "argSpread", path}); return; @@ -175,7 +175,7 @@ function optimiseIndexGetter(path, argsId, offset) { const { scope } = path; if (!scope.isPure(index)) { - let temp = scope.generateUidIdentifierBasedOnNode(index); + const temp = scope.generateUidIdentifierBasedOnNode(index); scope.push({id: temp, kind: "var"}); path.parentPath.replaceWith(restIndexImpure({ ARGUMENTS: argsId, @@ -201,20 +201,20 @@ function optimiseLengthGetter(path, argsId, offset) { } } -export let visitor = { +export const visitor = { Function(path) { - let { node, scope } = path; + const { node, scope } = path; if (!hasRest(node)) return; - let rest = node.params.pop().argument; + const rest = node.params.pop().argument; - let argsId = t.identifier("arguments"); + const argsId = t.identifier("arguments"); // otherwise `arguments` will be remapped in arrow functions argsId._shadowedFunctionLiteral = path; // check and optimise for extremely common cases - let state = { + const state = { references: [], offset: node.params.length, @@ -246,7 +246,7 @@ export let visitor = { // There are only "shorthand" references if (!state.deopted && !state.references.length) { - for (let {path, cause} of (state.candidates: Array)) { + for (const {path, cause} of (state.candidates: Array)) { switch (cause) { case "indexGetter": optimiseIndexGetter(path, argsId, state.offset); @@ -268,9 +268,9 @@ export let visitor = { // deopt shadowed functions as transforms like regenerator may try touch the allocation loop state.deopted = state.deopted || !!node.shadow; - let start = t.numericLiteral(node.params.length); - let key = scope.generateUidIdentifier("key"); - let len = scope.generateUidIdentifier("len"); + const start = t.numericLiteral(node.params.length); + const key = scope.generateUidIdentifier("key"); + const len = scope.generateUidIdentifier("len"); let arrKey = key; let arrLen = len; @@ -293,7 +293,7 @@ export let visitor = { ); } - let loop = buildRest({ + const loop = buildRest({ ARGUMENTS: argsId, ARRAY_KEY: arrKey, ARRAY_LEN: arrLen, diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js b/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js index c3aa80e4f5..3bc612ab0e 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js @@ -4,7 +4,7 @@ export default function () { return { visitor: { ObjectMethod(path) { - let { node } = path; + const { node } = path; if (node.kind === "method") { const func = t.functionExpression(null, node.params, node.body, node.generator, node.async); func.returnType = node.returnType; diff --git a/packages/babel-plugin-transform-es2015-spread/src/index.js b/packages/babel-plugin-transform-es2015-spread/src/index.js index d7768cb161..14dfd52492 100644 --- a/packages/babel-plugin-transform-es2015-spread/src/index.js +++ b/packages/babel-plugin-transform-es2015-spread/src/index.js @@ -17,7 +17,7 @@ export default function ({ types: t }) { } function build(props: Array, scope, state) { - let nodes = []; + const nodes = []; let _props = []; @@ -27,7 +27,7 @@ export default function ({ types: t }) { _props = []; } - for (let prop of props) { + for (const prop of props) { if (t.isSpreadElement(prop)) { push(); nodes.push(getSpreadLiteral(prop, scope, state)); @@ -44,11 +44,11 @@ export default function ({ types: t }) { return { visitor: { ArrayExpression(path, state) { - let { node, scope } = path; - let elements = node.elements; + const { node, scope } = path; + const elements = node.elements; if (!hasSpread(elements)) return; - let nodes = build(elements, scope, state); + const nodes = build(elements, scope, state); let first = nodes.shift(); if (!t.isArrayExpression(first)) { @@ -60,12 +60,12 @@ export default function ({ types: t }) { }, CallExpression(path, state) { - let { node, scope } = path; + const { node, scope } = path; - let args = node.arguments; + const args = node.arguments; if (!hasSpread(args)) return; - let calleePath = path.get("callee"); + const calleePath = path.get("callee"); if (calleePath.isSuper()) return; let contextLiteral = t.identifier("undefined"); @@ -79,17 +79,17 @@ export default function ({ types: t }) { nodes = build(args, scope, state); } - let first = nodes.shift(); + const first = nodes.shift(); if (nodes.length) { node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes)); } else { node.arguments.push(first); } - let callee = node.callee; + const callee = node.callee; if (calleePath.isMemberExpression()) { - let temp = scope.maybeGenerateMemoised(callee.object); + const temp = scope.maybeGenerateMemoised(callee.object); if (temp) { callee.object = t.assignmentExpression("=", temp, callee.object); contextLiteral = temp; @@ -109,13 +109,13 @@ export default function ({ types: t }) { }, NewExpression(path, state) { - let { node, scope } = path; + const { node, scope } = path; let args = node.arguments; if (!hasSpread(args)) return; - let nodes = build(args, scope, state); + const nodes = build(args, scope, state); - let context = t.arrayExpression([t.nullLiteral()]); + const context = t.arrayExpression([t.nullLiteral()]); args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes); diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js b/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js index 8b703e85c8..409b6d9027 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js +++ b/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js @@ -5,7 +5,7 @@ export default function () { return { visitor: { RegExpLiteral(path) { - let { node } = path; + const { node } = path; if (!regex.is(node, "y")) return; path.replaceWith(t.newExpression(t.identifier("RegExp"), [ diff --git a/packages/babel-plugin-transform-es2015-template-literals/src/index.js b/packages/babel-plugin-transform-es2015-template-literals/src/index.js index 7359598f99..40d3a4d24b 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/src/index.js +++ b/packages/babel-plugin-transform-es2015-template-literals/src/index.js @@ -10,14 +10,14 @@ export default function ({ types: t }) { return { visitor: { TaggedTemplateExpression(path, state) { - let { node } = path; - let quasi = node.quasi; + const { node } = path; + const quasi = node.quasi; let args = []; let strings = []; let raw = []; - for (let elem of (quasi.quasis: Array)) { + for (const elem of (quasi.quasis: Array)) { strings.push(t.stringLiteral(elem.value.cooked)); raw.push(t.stringLiteral(elem.value.raw)); } @@ -28,7 +28,7 @@ export default function ({ types: t }) { let templateName = "taggedTemplateLiteral"; if (state.opts.loose) templateName += "Loose"; - let templateObject = state.file.addTemplateObject(templateName, strings, raw); + const templateObject = state.file.addTemplateObject(templateName, strings, raw); args.push(templateObject); args = args.concat(quasi.expressions); @@ -39,12 +39,12 @@ export default function ({ types: t }) { TemplateLiteral(path, state) { let nodes: Array = []; - let expressions = path.get("expressions"); + const expressions = path.get("expressions"); - for (let elem of (path.node.quasis: Array)) { + for (const elem of (path.node.quasis: Array)) { nodes.push(t.stringLiteral(elem.value.cooked)); - let expr = expressions.shift(); + const expr = expressions.shift(); if (expr) { if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) { nodes.push(t.callExpression(t.identifier("String"), [expr.node])); @@ -66,7 +66,7 @@ export default function ({ types: t }) { if (nodes.length > 1) { let root = buildBinaryExpression(nodes.shift(), nodes.shift()); - for (let node of nodes) { + for (const node of nodes) { root = buildBinaryExpression(root, node); } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js index b2291af302..4cea5acd1a 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js @@ -1,7 +1,7 @@ /* eslint max-len: 0 */ export default function ({ types: t }) { - let IGNORE = Symbol(); + const IGNORE = Symbol(); return { visitor: { @@ -14,23 +14,23 @@ export default function ({ types: t }) { }, UnaryExpression(path) { - let { node, parent } = path; + const { node, parent } = path; if (node[IGNORE]) return; if (path.find((path) => path.node && !!path.node._generated)) return; if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) { // optimise `typeof foo === "string"` since we can determine that they'll never need to handle symbols - let opposite = path.getOpposite(); + const opposite = path.getOpposite(); if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") { return; } } if (node.operator === "typeof") { - let call = t.callExpression(this.addHelper("typeof"), [node.argument]); + const call = t.callExpression(this.addHelper("typeof"), [node.argument]); if (path.get("argument").isIdentifier()) { - let undefLiteral = t.stringLiteral("undefined"); - let unary = t.unaryExpression("typeof", node.argument); + const undefLiteral = t.stringLiteral("undefined"); + const unary = t.unaryExpression("typeof", node.argument); unary[IGNORE] = true; path.replaceWith(t.conditionalExpression( t.binaryExpression("===", unary, undefLiteral), diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js b/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js index fa78563a23..2aa02f1208 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js +++ b/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js @@ -3,7 +3,7 @@ export default function ({ types: t }) { visitor: { MemberExpression: { exit({ node }) { - let prop = node.property; + const prop = node.property; if (!node.computed && t.isIdentifier(prop) && !t.isValidIdentifier(prop.name)) { // foo.default -> foo["default"] node.property = t.stringLiteral(prop.name); diff --git a/packages/babel-plugin-transform-es3-property-literals/src/index.js b/packages/babel-plugin-transform-es3-property-literals/src/index.js index b8f6f412c2..e62a88f8ee 100644 --- a/packages/babel-plugin-transform-es3-property-literals/src/index.js +++ b/packages/babel-plugin-transform-es3-property-literals/src/index.js @@ -3,7 +3,7 @@ export default function ({ types: t }) { visitor: { ObjectProperty: { exit({node}) { - let key = node.key; + const key = node.key; if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) { // default: "bar" -> "default": "bar" node.key = t.stringLiteral(key.name); diff --git a/packages/babel-plugin-transform-es5-property-mutators/src/index.js b/packages/babel-plugin-transform-es5-property-mutators/src/index.js index 46d810f6f5..83727bb0a5 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/src/index.js +++ b/packages/babel-plugin-transform-es5-property-mutators/src/index.js @@ -4,9 +4,9 @@ export default function ({ types: t }) { return { visitor: { ObjectExpression(path, file) { - let { node } = path; + const { node } = path; let hasAny = false; - for (let prop of (node.properties: Array)) { + for (const prop of (node.properties: Array)) { if (prop.kind === "get" || prop.kind === "set") { hasAny = true; break; @@ -14,7 +14,7 @@ export default function ({ types: t }) { } if (!hasAny) return; - let mutatorMap = {}; + const mutatorMap = {}; node.properties = node.properties.filter(function (prop) { if (!prop.computed && (prop.kind === "get" || prop.kind === "set")) { diff --git a/packages/babel-plugin-transform-eval/src/index.js b/packages/babel-plugin-transform-eval/src/index.js index 677401057a..ec92ec40f2 100644 --- a/packages/babel-plugin-transform-eval/src/index.js +++ b/packages/babel-plugin-transform-eval/src/index.js @@ -3,13 +3,13 @@ export default function ({ parse, traverse }) { visitor: { CallExpression(path) { if (path.get("callee").isIdentifier({ name: "eval" }) && path.node.arguments.length === 1) { - let evaluate = path.get("arguments")[0].evaluate(); + const evaluate = path.get("arguments")[0].evaluate(); if (!evaluate.confident) return; - let code = evaluate.value; + const code = evaluate.value; if (typeof code !== "string") return; - let ast = parse(code); + const ast = parse(code); traverse.removeProperties(ast); return ast.program; } diff --git a/packages/babel-plugin-transform-export-extensions/src/index.js b/packages/babel-plugin-transform-export-extensions/src/index.js index 6b0afad0ce..5951b9e42d 100644 --- a/packages/babel-plugin-transform-export-extensions/src/index.js +++ b/packages/babel-plugin-transform-export-extensions/src/index.js @@ -1,10 +1,10 @@ export default function ({ types: t }) { function build(node, nodes, scope) { - let first = node.specifiers[0]; + const first = node.specifiers[0]; if (!t.isExportNamespaceSpecifier(first) && !t.isExportDefaultSpecifier(first)) return; - let specifier = node.specifiers.shift(); - let uid = scope.generateUidIdentifier(specifier.exported.name); + const specifier = node.specifiers.shift(); + const uid = scope.generateUidIdentifier(specifier.exported.name); let newSpecifier; if (t.isExportNamespaceSpecifier(specifier)) { @@ -24,8 +24,8 @@ export default function ({ types: t }) { visitor: { ExportNamedDeclaration(path) { - let { node, scope } = path; - let nodes = []; + const { node, scope } = path; + const nodes = []; build(node, nodes, scope); if (!nodes.length) return; diff --git a/packages/babel-plugin-transform-flow-comments/src/index.js b/packages/babel-plugin-transform-flow-comments/src/index.js index ece00a024a..8abf61aa41 100644 --- a/packages/babel-plugin-transform-flow-comments/src/index.js +++ b/packages/babel-plugin-transform-flow-comments/src/index.js @@ -16,14 +16,14 @@ export default function ({ types: t }) { visitor: { TypeCastExpression(path) { - let { node } = path; + const { node } = path; path.get("expression").addComment("trailing", generateComment(path.get("typeAnnotation"))); path.replaceWith(t.parenthesizedExpression(node.expression)); }, // support function a(b?) {} Identifier(path) { - let { node } = path; + const { node } = path; if (!node.optional || node.typeAnnotation) { return; } @@ -45,13 +45,13 @@ export default function ({ types: t }) { // support for `class X { foo: string }` - #4622 ClassProperty(path) { - let { node, parent } = path; + const { node, parent } = path; if (!node.value) wrapInFlowComment(path, parent); }, // support `export type a = {}` - #8 Error: You passed path.replaceWith() a falsy node "ExportNamedDeclaration|Flow"(path) { - let { node, parent } = path; + const { node, parent } = path; if (t.isExportNamedDeclaration(node) && !t.isFlow(node.declaration)) { return; } @@ -60,7 +60,7 @@ export default function ({ types: t }) { // support `import type A` and `import typeof A` #10 ImportDeclaration(path) { - let { node, parent } = path; + const { node, parent } = path; if (t.isImportDeclaration(node) && node.importKind !== "type" && node.importKind !== "typeof") { return; } diff --git a/packages/babel-plugin-transform-flow-strip-types/src/index.js b/packages/babel-plugin-transform-flow-strip-types/src/index.js index c64abb9a52..4b080f9258 100644 --- a/packages/babel-plugin-transform-flow-strip-types/src/index.js +++ b/packages/babel-plugin-transform-flow-strip-types/src/index.js @@ -6,7 +6,7 @@ export default function ({ types: t }) { visitor: { Program(path, { file: { ast: { comments } } }) { - for (let comment of (comments: Array)) { + for (const comment of (comments: Array)) { if (comment.value.indexOf(FLOW_DIRECTIVE) >= 0) { // remove flow directive comment.value = comment.value.replace(FLOW_DIRECTIVE, ""); @@ -46,7 +46,7 @@ export default function ({ types: t }) { Function({ node }) { for (let i = 0; i < node.params.length; i++) { - let param = node.params[i]; + const param = node.params[i]; param.optional = false; } }, diff --git a/packages/babel-plugin-transform-function-bind/src/index.js b/packages/babel-plugin-transform-function-bind/src/index.js index 0d3099930f..27c20faa1e 100644 --- a/packages/babel-plugin-transform-function-bind/src/index.js +++ b/packages/babel-plugin-transform-function-bind/src/index.js @@ -8,15 +8,15 @@ export default function ({ types: t }) { } function getStaticContext(bind, scope) { - let object = bind.object || bind.callee.object; + const object = bind.object || bind.callee.object; return scope.isStatic(object) && object; } function inferBindContext(bind, scope) { - let staticContext = getStaticContext(bind, scope); + const staticContext = getStaticContext(bind, scope); if (staticContext) return staticContext; - let tempId = getTempId(scope); + const tempId = getTempId(scope); if (bind.object) { bind.callee = t.sequenceExpression([ t.assignmentExpression("=", tempId, bind.object), @@ -33,17 +33,17 @@ export default function ({ types: t }) { visitor: { CallExpression({ node, scope }) { - let bind = node.callee; + const bind = node.callee; if (!t.isBindExpression(bind)) return; - let context = inferBindContext(bind, scope); + const context = inferBindContext(bind, scope); node.callee = t.memberExpression(bind.callee, t.identifier("call")); node.arguments.unshift(context); }, BindExpression(path) { - let { node, scope } = path; - let context = inferBindContext(node, scope); + const { node, scope } = path; + const context = inferBindContext(node, scope); path.replaceWith(t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context])); } } diff --git a/packages/babel-plugin-transform-jscript/src/index.js b/packages/babel-plugin-transform-jscript/src/index.js index 1361821acf..87f83c2bed 100644 --- a/packages/babel-plugin-transform-jscript/src/index.js +++ b/packages/babel-plugin-transform-jscript/src/index.js @@ -3,7 +3,7 @@ export default function ({ types: t }) { visitor: { FunctionExpression: { exit(path) { - let { node } = path; + const { node } = path; if (!node.id) return; node._ignoreUserWhitespace = true; diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index dbc357be07..b705529236 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -11,7 +11,7 @@ export default function ({ types: t }) { } function hasSpread(node) { - for (let prop of (node.properties)) { + for (const prop of (node.properties)) { if (t.isSpreadProperty(prop)) { return true; } @@ -22,8 +22,8 @@ export default function ({ types: t }) { function createObjectSpread(file, props, objRef) { const restProperty = props.pop(); - let keys = []; - for (let prop of props) { + const keys = []; + for (const prop of props) { let key = prop.key; if (t.isIdentifier(key) && !prop.computed) { key = t.stringLiteral(prop.key.name); @@ -44,10 +44,10 @@ export default function ({ types: t }) { function replaceRestProperty(paramsPath, i, numParams) { if (paramsPath.isObjectPattern() && hasRestProperty(paramsPath)) { - let parentPath = paramsPath.parentPath; - let uid = parentPath.scope.generateUidIdentifier("ref"); + const parentPath = paramsPath.parentPath; + const uid = parentPath.scope.generateUidIdentifier("ref"); - let declar = t.variableDeclaration("let", [ + const declar = t.variableDeclaration("let", [ t.variableDeclarator(paramsPath.node, uid) ]); declar._blockHoist = i ? numParams - i : 1; @@ -65,7 +65,7 @@ export default function ({ types: t }) { // taken from transform-es2015-parameters/src/destructuring.js // function a({ b, ...c }) {} Function(path) { - let params = path.get("params"); + const params = path.get("params"); for (let i = 0; i < params.length; i++) { replaceRestProperty(params[i], i, params.length); } @@ -75,7 +75,7 @@ export default function ({ types: t }) { VariableDeclarator(path, file) { if (!path.get("id").isObjectPattern()) { return; } const kind = path.parentPath.node.kind; - let nodes = []; + const nodes = []; path.traverse({ RestProperty(path) { @@ -89,7 +89,7 @@ export default function ({ types: t }) { } }); - let [ argument, callExpression ] = createObjectSpread( + const [ argument, callExpression ] = createObjectSpread( file, path.parentPath.node.properties, ref @@ -108,7 +108,7 @@ export default function ({ types: t }) { ).remove(); } } - },{ + }, { originalPath: path }); @@ -122,14 +122,14 @@ export default function ({ types: t }) { // taken from transform-es2015-destructuring/src/index.js#visitor // export var { a, ...b } = c; ExportNamedDeclaration(path) { - let declaration = path.get("declaration"); + const declaration = path.get("declaration"); if (!declaration.isVariableDeclaration()) return; if (!hasRestProperty(declaration)) return; - let specifiers = []; + const specifiers = []; - for (let name in path.getOuterBindingIdentifiers(path)) { - let id = t.identifier(name); + for (const name in path.getOuterBindingIdentifiers(path)) { + const id = t.identifier(name); specifiers.push(t.exportSpecifier(id, id)); } @@ -145,9 +145,9 @@ export default function ({ types: t }) { }, // ({a, ...b} = c); AssignmentExpression(path, file) { - let leftPath = path.get("left"); + const leftPath = path.get("left"); if (leftPath.isObjectPattern() && hasRestProperty(leftPath)) { - let nodes = []; + const nodes = []; let ref; if (path.isCompletionRecord() || path.parentPath.isExpressionStatement()) { @@ -158,13 +158,13 @@ export default function ({ types: t }) { ])); } - let [ argument, callExpression ] = createObjectSpread( + const [ argument, callExpression ] = createObjectSpread( file, path.node.left.properties, ref ); - let nodeWithoutSpread = t.clone(path.node); + const nodeWithoutSpread = t.clone(path.node); nodeWithoutSpread.right = ref; nodes.push(t.expressionStatement(nodeWithoutSpread)); nodes.push(t.toStatement(t.assignmentExpression( @@ -182,13 +182,13 @@ export default function ({ types: t }) { }, // taken from transform-es2015-destructuring/src/index.js#visitor ForXStatement(path) { - let { node, scope } = path; - let leftPath = path.get("left"); - let left = node.left; + const { node, scope } = path; + const leftPath = path.get("left"); + const left = node.left; // for ({a, ...b} of []) {} if (t.isObjectPattern(left) && hasRestProperty(leftPath)) { - let temp = scope.generateUidIdentifier("ref"); + const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ t.variableDeclarator(temp) @@ -205,10 +205,10 @@ export default function ({ types: t }) { if (!t.isVariableDeclaration(left)) return; - let pattern = left.declarations[0].id; + const pattern = left.declarations[0].id; if (!t.isObjectPattern(pattern)) return; - let key = scope.generateUidIdentifier("ref"); + const key = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration(left.kind, [ t.variableDeclarator(key, null) ]); @@ -225,12 +225,12 @@ export default function ({ types: t }) { ObjectExpression(path, file) { if (!hasSpread(path.node)) return; - let useBuiltIns = file.opts.useBuiltIns || false; + const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { throw new Error("transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"); } - let args = []; + const args = []; let props = []; function push() { @@ -239,7 +239,7 @@ export default function ({ types: t }) { props = []; } - for (let prop of (path.node.properties: Array)) { + for (const prop of (path.node.properties: Array)) { if (t.isSpreadProperty(prop)) { push(); args.push(prop.argument); diff --git a/packages/babel-plugin-transform-proto-to-assign/src/index.js b/packages/babel-plugin-transform-proto-to-assign/src/index.js index d17f857c18..41b0ff442d 100644 --- a/packages/babel-plugin-transform-proto-to-assign/src/index.js +++ b/packages/babel-plugin-transform-proto-to-assign/src/index.js @@ -8,7 +8,7 @@ export default function ({ types: t }) { } function isProtoAssignmentExpression(node) { - let left = node.left; + const left = node.left; return t.isMemberExpression(left) && t.isLiteral(t.toComputedKey(left, left.property), { value: "__proto__" }); } @@ -21,9 +21,9 @@ export default function ({ types: t }) { AssignmentExpression(path, file) { if (!isProtoAssignmentExpression(path.node)) return; - let nodes = []; - let left = path.node.left.object; - let temp = path.scope.maybeGenerateMemoised(left); + const nodes = []; + const left = path.node.left.object; + const temp = path.scope.maybeGenerateMemoised(left); if (temp) nodes.push(t.expressionStatement(t.assignmentExpression("=", temp, left))); nodes.push(buildDefaultsCallExpression(path.node, temp || left, file)); @@ -33,7 +33,7 @@ export default function ({ types: t }) { }, ExpressionStatement(path, file) { - let expr = path.node.expression; + const expr = path.node.expression; if (!t.isAssignmentExpression(expr, { operator: "=" })) return; if (isProtoAssignmentExpression(expr)) { @@ -43,9 +43,9 @@ export default function ({ types: t }) { ObjectExpression(path, file) { let proto; - let { node } = path; + const { node } = path; - for (let prop of (node.properties: Array)) { + for (const prop of (node.properties: Array)) { if (isProtoKey(prop)) { proto = prop.value; pull(node.properties, prop); @@ -53,7 +53,7 @@ export default function ({ types: t }) { } if (proto) { - let args = [t.objectExpression([]), proto]; + const args = [t.objectExpression([]), proto]; if (node.properties.length) args.push(node); path.replaceWith(t.callExpression(file.addHelper("extends"), args)); } diff --git a/packages/babel-plugin-transform-react-constant-elements/src/index.js b/packages/babel-plugin-transform-react-constant-elements/src/index.js index 9673af7c26..a25fb67e6c 100644 --- a/packages/babel-plugin-transform-react-constant-elements/src/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/src/index.js @@ -1,7 +1,7 @@ export default function () { - let immutabilityVisitor = { + const immutabilityVisitor = { enter(path, state) { - let stop = () => { + const stop = () => { state.isImmutable = false; path.stop(); }; @@ -28,7 +28,7 @@ export default function () { JSXElement(path) { if (path.node._hoisted) return; - let state = { isImmutable: true }; + const state = { isImmutable: true }; path.traverse(immutabilityVisitor, state); if (state.isImmutable) { diff --git a/packages/babel-plugin-transform-react-display-name/src/index.js b/packages/babel-plugin-transform-react-display-name/src/index.js index 43206810e7..ce73d4db74 100644 --- a/packages/babel-plugin-transform-react-display-name/src/index.js +++ b/packages/babel-plugin-transform-react-display-name/src/index.js @@ -2,12 +2,12 @@ import path from "path"; export default function ({ types: t }) { function addDisplayName(id, call) { - let props = call.arguments[0].properties; + const props = call.arguments[0].properties; let safe = true; for (let i = 0; i < props.length; i++) { - let prop = props[i]; - let key = t.toComputedKey(prop); + const prop = props[i]; + const key = t.toComputedKey(prop); if (t.isLiteral(key, { value: "displayName" })) { safe = false; break; @@ -19,7 +19,7 @@ export default function ({ types: t }) { } } - let isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass"); + const isCreateClassCallExpression = t.buildMatchMemberExpression("React.createClass"); function isCreateClass(node) { if (!node || !t.isCallExpression(node)) return false; @@ -28,11 +28,11 @@ export default function ({ types: t }) { if (!isCreateClassCallExpression(node.callee)) return false; // no call arguments - let args = node.arguments; + const args = node.arguments; if (args.length !== 1) return false; // first node arg is not an object - let first = args[0]; + const first = args[0]; if (!t.isObjectExpression(first)) return false; return true; @@ -54,7 +54,7 @@ export default function ({ types: t }) { }, CallExpression(path) { - let { node } = path; + const { node } = path; if (!isCreateClass(node)) return; let id; diff --git a/packages/babel-plugin-transform-react-inline-elements/src/index.js b/packages/babel-plugin-transform-react-inline-elements/src/index.js index 5f394fc3f8..cb0e5a12c1 100644 --- a/packages/babel-plugin-transform-react-inline-elements/src/index.js +++ b/packages/babel-plugin-transform-react-inline-elements/src/index.js @@ -1,7 +1,7 @@ export default function ({ types: t }) { function hasRefOrSpread(attrs) { for (let i = 0; i < attrs.length; i++) { - let attr = attrs[i]; + const attr = attrs[i]; if (t.isJSXSpreadAttribute(attr)) return true; if (isJSXAttributeOfName(attr, "ref")) return true; } @@ -22,14 +22,14 @@ export default function ({ types: t }) { return { visitor: { JSXElement(path, file) { - let { node } = path; + const { node } = path; // filter - let open = node.openingElement; + const open = node.openingElement; if (hasRefOrSpread(open.attributes)) return; // init - let props = t.objectExpression([]); + const props = t.objectExpression([]); let key = null; let type = open.name; @@ -42,26 +42,26 @@ export default function ({ types: t }) { } // props - for (let attr of (open.attributes: Array)) { + for (const attr of (open.attributes: Array)) { if (isJSXAttributeOfName(attr, "key")) { key = getAttributeValue(attr); } else { - let name = attr.name.name; - let propertyKey = t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name); + const name = attr.name.name; + const propertyKey = t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name); pushProp(props.properties, propertyKey, getAttributeValue(attr)); } } - let args = [type, props]; + const args = [type, props]; if (key || node.children.length) { - let children = t.react.buildChildren(node); + const children = t.react.buildChildren(node); args.push( key || t.unaryExpression("void", t.numericLiteral(0), true), ...children ); } - let el = t.callExpression(file.addHelper("jsx"), args); + const el = t.callExpression(file.addHelper("jsx"), args); path.replaceWith(el); } } diff --git a/packages/babel-plugin-transform-react-jsx-self/src/index.js b/packages/babel-plugin-transform-react-jsx-self/src/index.js index 2fd02a77ed..39f223df64 100644 --- a/packages/babel-plugin-transform-react-jsx-self/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-self/src/index.js @@ -15,7 +15,7 @@ const TRACE_ID = "__self"; export default function ({ types: t }) { - let visitor = { + const visitor = { JSXOpeningElement({ node }) { const id = t.jSXIdentifier(TRACE_ID); const trace = t.thisExpression(); diff --git a/packages/babel-plugin-transform-react-jsx-source/src/index.js b/packages/babel-plugin-transform-react-jsx-source/src/index.js index cd296af979..039e9e5adc 100644 --- a/packages/babel-plugin-transform-react-jsx-source/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-source/src/index.js @@ -26,7 +26,7 @@ export default function ({ types: t }) { return t.objectExpression([fileNameProperty, lineNumberProperty]); } - let visitor = { + const visitor = { JSXOpeningElement(path, state) { const id = t.jSXIdentifier(TRACE_ID); const location = path.container.openingElement.loc; diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index 0a80ffac4b..12e127c909 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -1,12 +1,12 @@ /* eslint max-len: 0 */ export default function ({ types: t }) { - let JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; + const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; - let visitor = require("babel-helper-builder-react-jsx")({ + const visitor = require("babel-helper-builder-react-jsx")({ pre(state) { - let tagName = state.tagName; - let args = state.args; + const tagName = state.tagName; + const args = state.args; if (t.react.isCompatTag(tagName)) { args.push(t.stringLiteral(tagName)); } else { @@ -20,11 +20,11 @@ export default function ({ types: t }) { }); visitor.Program = function (path, state) { - let { file } = state; + const { file } = state; let id = state.opts.pragma || "React.createElement"; - for (let comment of (file.ast.comments: Array)) { - let matches = JSX_ANNOTATION_REGEX.exec(comment.value); + for (const comment of (file.ast.comments: Array)) { + const matches = JSX_ANNOTATION_REGEX.exec(comment.value); if (matches) { id = matches[1]; if (id === "React.DOM") { diff --git a/packages/babel-plugin-transform-runtime/src/index.js b/packages/babel-plugin-transform-runtime/src/index.js index 805df686ae..8299547e91 100644 --- a/packages/babel-plugin-transform-runtime/src/index.js +++ b/packages/babel-plugin-transform-runtime/src/index.js @@ -9,7 +9,7 @@ export default function ({ types: t }) { return Object.prototype.hasOwnProperty.call(obj, key); } - let HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; + const HELPER_BLACKLIST = ["interopRequireWildcard", "interopRequireDefault"]; return { pre(file) { @@ -30,7 +30,7 @@ export default function ({ types: t }) { visitor: { ReferencedIdentifier(path, state) { - let { node, parent, scope } = path; + const { node, parent, scope } = path; if (node.name === "regeneratorRuntime" && state.opts.regenerator !== false) { path.replaceWith(state.get("regeneratorIdentifier")); @@ -59,7 +59,7 @@ export default function ({ types: t }) { // we can't compile this if (path.node.arguments.length) return; - let callee = path.node.callee; + const callee = path.node.callee; if (!t.isMemberExpression(callee)) return; if (!callee.computed) return; if (!path.get("callee.property").matchesPattern("Symbol.iterator")) return; @@ -99,15 +99,15 @@ export default function ({ types: t }) { if (state.opts.polyfill === false) return; if (!path.isReferenced()) return; - let { node } = path; - let obj = node.object; - let prop = node.property; + const { node } = path; + const obj = node.object; + const prop = node.property; if (!t.isReferenced(obj, node)) return; if (node.computed) return; if (!has(definitions.methods, obj.name)) return; - let methods = definitions.methods[obj.name]; + const methods = definitions.methods[obj.name]; if (!has(methods, prop.name)) return; // doesn't reference the global @@ -115,7 +115,7 @@ export default function ({ types: t }) { // special case Object.defineProperty to not use core-js when using string keys if (obj.name === "Object" && prop.name === "defineProperty" && path.parentPath.isCallExpression()) { - let call = path.parentPath.node; + const call = path.parentPath.node; if (call.arguments.length === 3 && t.isLiteral(call.arguments[1])) return; } @@ -131,8 +131,8 @@ export default function ({ types: t }) { if (state.opts.polyfill === false) return; if (!path.isReferenced()) return; - let { node } = path; - let obj = node.object; + const { node } = path; + const obj = node.object; if (!has(definitions.builtins, obj.name)) return; if (path.scope.getBindingIdentifier(obj.name)) return; diff --git a/packages/babel-plugin-transform-strict-mode/src/index.js b/packages/babel-plugin-transform-strict-mode/src/index.js index 8ed2d181fb..fbd1dd9137 100644 --- a/packages/babel-plugin-transform-strict-mode/src/index.js +++ b/packages/babel-plugin-transform-strict-mode/src/index.js @@ -6,9 +6,9 @@ export default function () { Program(path, state) { if (state.opts.strict === false || state.opts.strictMode === false) return; - let { node } = path; + const { node } = path; - for (let directive of (node.directives: Array)) { + for (const directive of (node.directives: Array)) { if (directive.value.value === "use strict") return; } diff --git a/packages/babel-plugin-undeclared-variables-check/src/index.js b/packages/babel-plugin-undeclared-variables-check/src/index.js index a6400dd8c7..9c63b00aab 100644 --- a/packages/babel-plugin-undeclared-variables-check/src/index.js +++ b/packages/babel-plugin-undeclared-variables-check/src/index.js @@ -4,9 +4,9 @@ export default function ({ messages }) { return { visitor: { ReferencedIdentifier(path) { - let { node, scope } = path; + const { node, scope } = path; - let binding = scope.getBinding(node.name); + const binding = scope.getBinding(node.name); if (binding && binding.kind === "type" && !path.parentPath.isFlow()) { throw path.buildCodeFrameError(messages.get("undeclaredVariableType", node.name), ReferenceError); } @@ -16,13 +16,13 @@ export default function ({ messages }) { // get the closest declaration to offer as a suggestion // the variable name may have just been mistyped - let bindings = scope.getAllBindings(); + const bindings = scope.getAllBindings(); let closest; let shortest = -1; - for (let name in bindings) { - let distance = leven(node.name, name); + for (const name in bindings) { + const distance = leven(node.name, name); if (distance <= 0 || distance > 3) continue; if (distance <= shortest) continue; diff --git a/packages/babel-polyfill/src/index.js b/packages/babel-polyfill/src/index.js index 0cb9b282d6..2dfde7b6d7 100644 --- a/packages/babel-polyfill/src/index.js +++ b/packages/babel-polyfill/src/index.js @@ -12,7 +12,7 @@ import "regenerator-runtime/runtime"; import "core-js/fn/regexp/escape"; -let DEFINE_PROPERTY = "defineProperty"; +const DEFINE_PROPERTY = "defineProperty"; function define(O, key, value) { O[key] || Object[DEFINE_PROPERTY](O, key, { writable: true, diff --git a/packages/babel-preset-es2015/test/index.js b/packages/babel-preset-es2015/test/index.js index 7653dbb6f9..8047319eb6 100644 --- a/packages/babel-preset-es2015/test/index.js +++ b/packages/babel-preset-es2015/test/index.js @@ -1,5 +1,5 @@ -let es2015 = require("../lib"); -let expect = require("chai").expect; +const es2015 = require("../lib"); +const expect = require("chai").expect; describe("es2015 preset", function () { it("exposes an object", function () { diff --git a/packages/babel-preset-es2015/test/traceur.js b/packages/babel-preset-es2015/test/traceur.js index a4bfd87c3f..da8c33beae 100644 --- a/packages/babel-preset-es2015/test/traceur.js +++ b/packages/babel-preset-es2015/test/traceur.js @@ -1,4 +1,4 @@ -let _ = require("lodash"); +const _ = require("lodash"); require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/traceur", "traceur", { ignoreSuites: [ diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 91edc8c65b..19e052f500 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -12,7 +12,7 @@ sourceMapSupport.install({ handleUncaughtExceptions: false, environment : "node", retrieveSourceMap(source) { - let map = maps && maps[source]; + const map = maps && maps[source]; if (map) { return { url: null, @@ -27,15 +27,15 @@ sourceMapSupport.install({ registerCache.load(); let cache = registerCache.get(); -let transformOpts = {}; +const transformOpts = {}; let ignore; let only; let oldHandlers = {}; -let maps = {}; +const maps = {}; -let cwd = process.cwd(); +const cwd = process.cwd(); function getRelativePath(filename) { return path.relative(cwd, filename); @@ -49,7 +49,7 @@ function compile(filename) { let result; // merge in base options and resolve all the plugins and presets relative to this file - let opts = new OptionManager().init(extend( + const opts = new OptionManager().init(extend( { sourceRoot: path.dirname(filename) }, // sourceRoot can be overwritten deepClone(transformOpts), { filename } @@ -57,11 +57,11 @@ function compile(filename) { let cacheKey = `${JSON.stringify(opts)}:${babel.version}`; - let env = process.env.BABEL_ENV || process.env.NODE_ENV; + const env = process.env.BABEL_ENV || process.env.NODE_ENV; if (env) cacheKey += `:${env}`; if (cache) { - let cached = cache[cacheKey]; + const cached = cache[cacheKey]; if (cached && cached.mtime === mtime(filename)) { result = cached; } @@ -100,7 +100,7 @@ function loader(m, filename) { } function registerExtension(ext) { - let old = oldHandlers[ext] || oldHandlers[".js"] || require.extensions[".js"]; + const old = oldHandlers[ext] || oldHandlers[".js"] || require.extensions[".js"]; require.extensions[ext] = function (m, filename) { if (shouldIgnore(filename)) { diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index 5413e5d6ab..4abd2a4608 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -7,8 +7,8 @@ import traverse from "babel-traverse"; import * as babylon from "babylon"; import * as t from "babel-types"; -let FROM_TEMPLATE = "_fromTemplate"; //Symbol(); // todo: probably wont get copied over -let TEMPLATE_SKIP = Symbol(); +const FROM_TEMPLATE = "_fromTemplate"; //Symbol(); // todo: probably wont get copied over +const TEMPLATE_SKIP = Symbol(); export default function (code: string, opts?: Object): Function { // since we lazy parse the template, we get the current stack so we have the @@ -60,7 +60,7 @@ export default function (code: string, opts?: Object): Function { function useTemplate(ast, nodes?: Array) { ast = cloneDeep(ast); - let { program } = ast; + const { program } = ast; if (nodes.length) { traverse(ast, templateVisitor, null, nodes); @@ -73,7 +73,7 @@ function useTemplate(ast, nodes?: Array) { } } -let templateVisitor = { +const templateVisitor = { // 360 noScope: true, @@ -91,7 +91,7 @@ let templateVisitor = { if (has(args[0], node.name)) { replacement = args[0][node.name]; } else if (node.name[0] === "$") { - let i = +node.name.slice(1); + const i = +node.name.slice(1); if (args[i]) replacement = args[i]; } } diff --git a/packages/babel-template/test/index.js b/packages/babel-template/test/index.js index f64090e4a8..6e4ae78544 100644 --- a/packages/babel-template/test/index.js +++ b/packages/babel-template/test/index.js @@ -1,8 +1,8 @@ -let generator = require("../../babel-generator").default; -let template = require("../lib"); -let chai = require("chai"); +const generator = require("../../babel-generator").default; +const template = require("../lib"); +const chai = require("chai"); -let comments = "// Sum two numbers\nconst add = (a, b) => a + b;"; +const comments = "// Sum two numbers\nconst add = (a, b) => a + b;"; describe("templating", function () { it("import statement will cause parser to throw by default", function () { @@ -18,13 +18,13 @@ describe("templating", function () { }); it("should strip comments by default", function () { - let code = "const add = (a, b) => a + b;"; - let output = template(comments)(); + const code = "const add = (a, b) => a + b;"; + const output = template(comments)(); chai.expect(generator(output).code).to.be.equal(code); }); it("should preserve comments with a flag", function () { - let output = template(comments, {preserveComments: true})(); + const output = template(comments, {preserveComments: true})(); chai.expect(generator(output).code).to.be.equal(comments); }); }); diff --git a/packages/babel-traverse/src/context.js b/packages/babel-traverse/src/context.js index b73ff3f7bf..3be2d90f85 100644 --- a/packages/babel-traverse/src/context.js +++ b/packages/babel-traverse/src/context.js @@ -1,7 +1,7 @@ import NodePath from "./path"; import * as t from "babel-types"; -let testing = process.env.NODE_ENV === "test"; +const testing = process.env.NODE_ENV === "test"; export default class TraversalContext { constructor(scope, opts, state, parentPath) { @@ -23,18 +23,18 @@ export default class TraversalContext { */ shouldVisit(node): boolean { - let opts = this.opts; + const opts = this.opts; if (opts.enter || opts.exit) return true; // check if we have a visitor for this node if (opts[node.type]) return true; // check if we're going to traverse into this node - let keys: ?Array = t.VISITOR_KEYS[node.type]; + const keys: ?Array = t.VISITOR_KEYS[node.type]; if (!keys || !keys.length) return false; // we need to traverse into this node so ensure that it has children to traverse into! - for (let key of keys) { + for (const key of keys) { if (node[key]) return true; } @@ -69,11 +69,11 @@ export default class TraversalContext { // nothing to traverse! if (container.length === 0) return false; - let queue = []; + const queue = []; // build up initial queue for (let key = 0; key < container.length; key++) { - let node = container[key]; + const node = container[key]; if (node && this.shouldVisit(node)) { queue.push(this.create(parent, container, key, listKey)); } @@ -97,11 +97,11 @@ export default class TraversalContext { this.queue = queue; this.priorityQueue = []; - let visited = []; + const visited = []; let stop = false; // visit the queue - for (let path of queue) { + for (const path of queue) { path.resync(); if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) { @@ -136,7 +136,7 @@ export default class TraversalContext { } // clear queue - for (let path of queue) { + for (const path of queue) { path.popContext(); } @@ -147,7 +147,7 @@ export default class TraversalContext { } visit(node, key) { - let nodes = node[key]; + const nodes = node[key]; if (!nodes) return false; if (Array.isArray(nodes)) { diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 6a3d4660a4..464a5a150f 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -46,11 +46,11 @@ traverse.cheap = function (node, enter) { }; traverse.node = function (node: Object, opts: Object, scope: Object, state: Object, parentPath: Object, skipKeys?) { - let keys: Array = t.VISITOR_KEYS[node.type]; + const keys: Array = t.VISITOR_KEYS[node.type]; if (!keys) return; - let context = new TraversalContext(scope, opts, state, parentPath); - for (let key of keys) { + const context = new TraversalContext(scope, opts, state, parentPath); + for (const key of keys) { if (skipKeys && skipKeys[key]) continue; if (context.visit(node, key)) return; } @@ -81,7 +81,7 @@ traverse.hasType = function (tree: Object, scope: Object, type: Object, blacklis // the type we're looking for is the same as the passed node if (tree.type === type) return true; - let state = { + const state = { has: false, type: type }; diff --git a/packages/babel-traverse/src/path/ancestry.js b/packages/babel-traverse/src/path/ancestry.js index 35fb7b3435..245910aa6a 100644 --- a/packages/babel-traverse/src/path/ancestry.js +++ b/packages/babel-traverse/src/path/ancestry.js @@ -60,10 +60,10 @@ export function getStatementParent() { export function getEarliestCommonAncestorFrom(paths: Array): NodePath { return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) { let earliest; - let keys = t.VISITOR_KEYS[deepest.type]; + const keys = t.VISITOR_KEYS[deepest.type]; - for (let ancestry of (ancestries: Array)) { - let path = ancestry[i + 1]; + for (const ancestry of (ancestries: Array)) { + const path = ancestry[i + 1]; // first path if (!earliest) { @@ -81,8 +81,8 @@ export function getEarliestCommonAncestorFrom(paths: Array): NodePath } // handle keys - let earliestKeyIndex = keys.indexOf(earliest.parentKey); - let currentKeyIndex = keys.indexOf(path.parentKey); + const earliestKeyIndex = keys.indexOf(earliest.parentKey); + const currentKeyIndex = keys.indexOf(path.parentKey); if (earliestKeyIndex > currentKeyIndex) { // key appears before so it's earlier earliest = path; @@ -115,8 +115,8 @@ export function getDeepestCommonAncestorFrom(paths: Array, filter?: Fu let lastCommonIndex, lastCommon; // get the ancestors of the path, breaking when the parent exceeds ourselves - let ancestries = paths.map((path) => { - let ancestry = []; + const ancestries = paths.map((path) => { + const ancestry = []; do { ancestry.unshift(path); @@ -131,13 +131,13 @@ export function getDeepestCommonAncestorFrom(paths: Array, filter?: Fu }); // get the first ancestry so we have a seed to assess all other ancestries with - let first = ancestries[0]; + const first = ancestries[0]; // check ancestor equality depthLoop: for (let i = 0; i < minDepth; i++) { - let shouldMatch = first[i]; + const shouldMatch = first[i]; - for (let ancestry of (ancestries: Array)) { + for (const ancestry of (ancestries: Array)) { if (ancestry[i] !== shouldMatch) { // we've hit a snag break depthLoop; @@ -168,7 +168,7 @@ export function getDeepestCommonAncestorFrom(paths: Array, filter?: Fu export function getAncestry() { let path = this; - let paths = []; + const paths = []; do { paths.push(path); } while (path = path.parentPath); @@ -192,7 +192,7 @@ export function isDescendant(maybeAncestor) { export function inType() { let path = this; while (path) { - for (let type of (arguments: Array)) { + for (const type of (arguments: Array)) { if (path.node.type === type) return true; } path = path.parentPath; @@ -235,11 +235,11 @@ export function inType() { */ export function inShadow(key?) { - let parentFn = this.isFunction() ? this : this.findParent((p) => p.isFunction()); + const parentFn = this.isFunction() ? this : this.findParent((p) => p.isFunction()); if (!parentFn) return; if (parentFn.isFunctionExpression() || parentFn.isFunctionDeclaration()) { - let shadow = parentFn.node.shadow; + const shadow = parentFn.node.shadow; // this is because sometimes we may have a `shadow` value of: // diff --git a/packages/babel-traverse/src/path/comments.js b/packages/babel-traverse/src/path/comments.js index b7f0ae1a07..8aec4d5fa5 100644 --- a/packages/babel-traverse/src/path/comments.js +++ b/packages/babel-traverse/src/path/comments.js @@ -8,11 +8,11 @@ export function shareCommentsWithSiblings() { // NOTE: this assumes numbered keys if (typeof this.key === "string") return; - let node = this.node; + const node = this.node; if (!node) return; - let trailing = node.trailingComments; - let leading = node.leadingComments; + const trailing = node.trailingComments; + const leading = node.leadingComments; if (!trailing && !leading) return; let prev = this.getSibling(this.key - 1); @@ -39,10 +39,10 @@ export function addComment(type, content, line?) { export function addComments(type: string, comments: Array) { if (!comments) return; - let node = this.node; + const node = this.node; if (!node) return; - let key = `${type}Comments`; + const key = `${type}Comments`; if (node[key]) { node[key] = node[key].concat(comments); diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index 6710171c57..c74cb356dd 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -3,7 +3,7 @@ import traverse from "../index"; export function call(key): boolean { - let opts = this.opts; + const opts = this.opts; this.debug(() => key); @@ -21,13 +21,13 @@ export function call(key): boolean { export function _call(fns?: Array): boolean { if (!fns) return false; - for (let fn of fns) { + for (const fn of fns) { if (!fn) continue; - let node = this.node; + const node = this.node; if (!node) return true; - let ret = fn.call(this.state, this, this.state); + const ret = fn.call(this.state, this, this.state); if (ret) throw new Error(`Unexpected return value from visitor method ${fn}`); // node has been replaced, it will have been requeued @@ -40,7 +40,7 @@ export function _call(fns?: Array): boolean { } export function isBlacklisted(): boolean { - let blacklist = this.opts.blacklist; + const blacklist = this.opts.blacklist; return blacklist && blacklist.indexOf(this.node.type) > -1; } @@ -155,7 +155,7 @@ export function _resyncKey() { } } } else { - for (let key in this.container) { + for (const key in this.container) { if (this.container[key] === this.node) { return this.setKey(key); } @@ -169,7 +169,7 @@ export function _resyncKey() { export function _resyncList() { if (!this.parent || !this.inList) return; - let newContainer = this.parent[this.listKey]; + const newContainer = this.parent[this.listKey]; if (this.container === newContainer) return; // container is out of sync. this is likely the result of it being reassigned @@ -214,9 +214,9 @@ export function requeue(pathToQueue = this) { // TODO(loganfsmyth): This should be switched back to queue in parent contexts // automatically once #2892 and #4135 have been resolved. See #4140. // let contexts = this._getQueueContexts(); - let contexts = this.contexts; + const contexts = this.contexts; - for (let context of contexts) { + for (const context of contexts) { context.maybeQueue(pathToQueue); } } diff --git a/packages/babel-traverse/src/path/conversion.js b/packages/babel-traverse/src/path/conversion.js index 27079529d7..a9ff22fc64 100644 --- a/packages/babel-traverse/src/path/conversion.js +++ b/packages/babel-traverse/src/path/conversion.js @@ -3,7 +3,7 @@ import * as t from "babel-types"; export function toComputedKey(): Object { - let node = this.node; + const node = this.node; let key; if (this.isMemberExpression()) { @@ -31,7 +31,7 @@ export function arrowFunctionToShadowed() { this.ensureBlock(); - let { node } = this; + const { node } = this; node.expression = false; node.type = "FunctionExpression"; node.shadow = node.shadow || true; diff --git a/packages/babel-traverse/src/path/evaluation.js b/packages/babel-traverse/src/path/evaluation.js index 3b41b188c6..82c15a743e 100644 --- a/packages/babel-traverse/src/path/evaluation.js +++ b/packages/babel-traverse/src/path/evaluation.js @@ -29,7 +29,7 @@ const INVALID_METHODS = ["random"]; */ export function evaluateTruthy(): boolean { - let res = this.evaluate(); + const res = this.evaluate(); if (res.confident) return !!res.value; } @@ -51,7 +51,7 @@ export function evaluateTruthy(): boolean { export function evaluate(): { confident: boolean; value: any } { let confident = true; let deoptPath: ?NodePath; - let seen = new Map; + const seen = new Map; function deopt(path) { if (!confident) return; @@ -75,10 +75,10 @@ export function evaluate(): { confident: boolean; value: any } { // a = g * this.foo // function evaluate(path) { - let { node } = path; + const { node } = path; if (seen.has(node)) { - let existing = seen.get(node); + const existing = seen.get(node); if (existing.resolved) { return existing.value; } else { @@ -86,10 +86,10 @@ export function evaluate(): { confident: boolean; value: any } { return; } } else { - let item = { resolved: false }; + const item = { resolved: false }; seen.set(node, item); - let val = _evaluate(path); + const val = _evaluate(path); if (confident) { item.resolved = true; item.value = val; @@ -101,10 +101,10 @@ export function evaluate(): { confident: boolean; value: any } { function _evaluate(path) { if (!confident) return; - let { node } = path; + const { node } = path; if (path.isSequenceExpression()) { - let exprs = path.get("expressions"); + const exprs = path.get("expressions"); return evaluate(exprs[exprs.length - 1]); } @@ -120,9 +120,9 @@ export function evaluate(): { confident: boolean; value: any } { let str = ""; let i = 0; - let exprs = path.get("expressions"); + const exprs = path.get("expressions"); - for (let elem of (node.quasis: Array)) { + for (const elem of (node.quasis: Array)) { // not confident, evaluated an expression we don't like if (!confident) break; @@ -130,7 +130,7 @@ export function evaluate(): { confident: boolean; value: any } { str += elem.value.cooked; // add on interpolated expression if it's present - let expr = exprs[i++]; + const expr = exprs[i++]; if (expr) str += String(evaluate(expr)); } @@ -139,7 +139,7 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isConditionalExpression()) { - let testResult = evaluate(path.get("test")); + const testResult = evaluate(path.get("test")); if (!confident) return; if (testResult) { return evaluate(path.get("consequent")); @@ -154,12 +154,12 @@ export function evaluate(): { confident: boolean; value: any } { // "foo".length if (path.isMemberExpression() && !path.parentPath.isCallExpression({ callee: node })) { - let property = path.get("property"); - let object = path.get("object"); + const property = path.get("property"); + const object = path.get("object"); if (object.isLiteral() && property.isIdentifier()) { - let value = object.node.value; - let type = typeof value; + const value = object.node.value; + const type = typeof value; if (type === "number" || type === "string") { return value[property.node.name]; } @@ -167,7 +167,7 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isReferencedIdentifier()) { - let binding = path.scope.getBinding(node.name); + const binding = path.scope.getBinding(node.name); if (binding && binding.constantViolations.length > 0) { return deopt(binding.path); @@ -188,7 +188,7 @@ export function evaluate(): { confident: boolean; value: any } { return NaN; } - let resolved = path.resolve(); + const resolved = path.resolve(); if (resolved === path) { return deopt(path); } else { @@ -203,12 +203,12 @@ export function evaluate(): { confident: boolean; value: any } { return undefined; } - let argument = path.get("argument"); + const argument = path.get("argument"); if (node.operator === "typeof" && (argument.isFunction() || argument.isClass())) { return "function"; } - let arg = evaluate(argument); + const arg = evaluate(argument); if (!confident) return; switch (node.operator) { case "!": return !arg; @@ -220,8 +220,8 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isArrayExpression()) { - let arr = []; - let elems: Array = path.get("elements"); + const arr = []; + const elems: Array = path.get("elements"); for (let elem of elems) { elem = elem.evaluate(); @@ -235,9 +235,9 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isObjectExpression()) { - let obj = {}; - let props: Array = path.get("properties"); - for (let prop of props) { + const obj = {}; + const props: Array = path.get("properties"); + for (const prop of props) { if (prop.isObjectMethod() || prop.isSpreadProperty()) { return deopt(prop); } @@ -268,12 +268,12 @@ export function evaluate(): { confident: boolean; value: any } { if (path.isLogicalExpression()) { // If we are confident that one side of an && is false, or the left // side of an || is true, we can be confident about the entire expression - let wasConfident = confident; - let left = evaluate(path.get("left")); - let leftConfident = confident; + const wasConfident = confident; + const left = evaluate(path.get("left")); + const leftConfident = confident; confident = wasConfident; - let right = evaluate(path.get("right")); - let rightConfident = confident; + const right = evaluate(path.get("right")); + const rightConfident = confident; confident = leftConfident && rightConfident; switch (node.operator) { @@ -300,9 +300,9 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isBinaryExpression()) { - let left = evaluate(path.get("left")); + const left = evaluate(path.get("left")); if (!confident) return; - let right = evaluate(path.get("right")); + const right = evaluate(path.get("right")); if (!confident) return; switch (node.operator) { @@ -330,7 +330,7 @@ export function evaluate(): { confident: boolean; value: any } { } if (path.isCallExpression()) { - let callee = path.get("callee"); + const callee = path.get("callee"); let context; let func; @@ -340,8 +340,8 @@ export function evaluate(): { confident: boolean; value: any } { } if (callee.isMemberExpression()) { - let object = callee.get("object"); - let property = callee.get("property"); + const object = callee.get("object"); + const property = callee.get("property"); // Math.min(1, 2) if (object.isIdentifier() && property.isIdentifier() && VALID_CALLEES.indexOf(object.node.name) >= 0 && INVALID_METHODS.indexOf(property.node.name) < 0) { @@ -351,7 +351,7 @@ export function evaluate(): { confident: boolean; value: any } { // "abc".charCodeAt(4) if (object.isLiteral() && property.isIdentifier()) { - let type = typeof object.node.value; + const type = typeof object.node.value; if (type === "string" || type === "number") { context = object.node.value; func = context[property.node.name]; @@ -360,7 +360,7 @@ export function evaluate(): { confident: boolean; value: any } { } if (func) { - let args = path.get("arguments").map(evaluate); + const args = path.get("arguments").map(evaluate); if (!confident) return; return func.apply(context, args); diff --git a/packages/babel-traverse/src/path/family.js b/packages/babel-traverse/src/path/family.js index f7a630d0a7..d17ae8aed7 100644 --- a/packages/babel-traverse/src/path/family.js +++ b/packages/babel-traverse/src/path/family.js @@ -33,7 +33,7 @@ export function getOpposite() { export function getCompletionRecords(): Array { let paths = []; - let add = function (path) { + const add = function (path) { if (path) paths = paths.concat(path.getCompletionRecords()); }; @@ -69,7 +69,7 @@ export function getSibling(key) { export function get(key: string, context?: boolean | TraversalContext): NodePath { if (context === true) context = this.context; - let parts = key.split("."); + const parts = key.split("."); if (parts.length === 1) { // "foo" return this._getKey(key, context); } else { // "foo.bar" @@ -78,8 +78,8 @@ export function get(key: string, context?: boolean | TraversalContext): NodePath } export function _getKey(key, context?) { - let node = this.node; - let container = node[key]; + const node = this.node; + const container = node[key]; if (Array.isArray(container)) { // requested a container so give them all the paths @@ -104,7 +104,7 @@ export function _getKey(key, context?) { export function _getPattern(parts, context) { let path = this; - for (let part of (parts: Array)) { + for (const part of (parts: Array)) { if (part === ".") { path = path.parentPath; } else { @@ -130,20 +130,20 @@ export function getOuterBindingIdentifiers(duplicates?) { // path.getBindingIdentifiers returns nodes where the following re-implementation // returns paths export function getBindingIdentifierPaths(duplicates = false, outerOnly = false) { - let path = this; + const path = this; let search = [].concat(path); - let ids = Object.create(null); + const ids = Object.create(null); while (search.length) { - let id = search.shift(); + const id = search.shift(); if (!id) continue; if (!id.node) continue; - let keys = t.getBindingIdentifiers.keys[id.node.type]; + const keys = t.getBindingIdentifiers.keys[id.node.type]; if (id.isIdentifier()) { if (duplicates) { - let _ids = ids[id.node.name] = ids[id.node.name] || []; + const _ids = ids[id.node.name] = ids[id.node.name] || []; _ids.push(id); } else { ids[id.node.name] = id; @@ -171,8 +171,8 @@ export function getBindingIdentifierPaths(duplicates = false, outerOnly = false) if (keys) { for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - let child = id.get(key); + const key = keys[i]; + const child = id.get(key); if (Array.isArray(child) || child.node) { search = search.concat(child); } diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index 1b5b589190..853a735bb8 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -11,7 +11,7 @@ import Scope from "../scope"; import * as t from "babel-types"; import { path as pathCache } from "../cache"; -let debug = buildDebug("babel"); +const debug = buildDebug("babel"); export default class NodePath { constructor(hub: Hub, parent: Object) { @@ -67,9 +67,9 @@ export default class NodePath { invariant(parent, "To get a node path the parent needs to exist"); - let targetNode = container[key]; + const targetNode = container[key]; - let paths = pathCache.get(parent) || []; + const paths = pathCache.get(parent) || []; if (!pathCache.has(parent)) { pathCache.set(parent, paths); } @@ -77,7 +77,7 @@ export default class NodePath { let path; for (let i = 0; i < paths.length; i++) { - let pathCheck = paths[i]; + const pathCheck = paths[i]; if (pathCheck.node === targetNode) { path = pathCheck; break; @@ -137,7 +137,7 @@ export default class NodePath { } getPathLocation(): string { - let parts = []; + const parts = []; let path = this; do { let key = path.key; @@ -165,8 +165,8 @@ assign(NodePath.prototype, require("./modification")); assign(NodePath.prototype, require("./family")); assign(NodePath.prototype, require("./comments")); -for (let type of (t.TYPES: Array)) { - let typeKey = `is${type}`; +for (const type of (t.TYPES: Array)) { + const typeKey = `is${type}`; NodePath.prototype[typeKey] = function (opts) { return t[typeKey](this.node, opts); }; @@ -178,11 +178,11 @@ for (let type of (t.TYPES: Array)) { }; } -for (let type in virtualTypes) { +for (const type in virtualTypes) { if (type[0] === "_") continue; if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type); - let virtualType = virtualTypes[type]; + const virtualType = virtualTypes[type]; NodePath.prototype[`is${type}`] = function (opts) { return virtualType.checkPath(this, opts); diff --git a/packages/babel-traverse/src/path/inference/index.js b/packages/babel-traverse/src/path/inference/index.js index 55a52911a6..976d327082 100644 --- a/packages/babel-traverse/src/path/inference/index.js +++ b/packages/babel-traverse/src/path/inference/index.js @@ -19,13 +19,13 @@ export function getTypeAnnotation(): Object { */ export function _getTypeAnnotation(): ?Object { - let node = this.node; + const node = this.node; if (!node) { // handle initializerless variables, add in checks for loop initializers too if (this.key === "init" && this.parentPath.isVariableDeclarator()) { - let declar = this.parentPath.parentPath; - let declarParent = declar.parentPath; + const declar = this.parentPath.parentPath; + const declarParent = declar.parentPath; // for (let NODE in bar) {} if (declar.key === "left" && declarParent.isForInStatement()) { @@ -87,11 +87,11 @@ function _isBaseType(baseName: string, type?, soft?): boolean { } export function couldBeBaseType(name: string): boolean { - let type = this.getTypeAnnotation(); + const type = this.getTypeAnnotation(); if (t.isAnyTypeAnnotation(type)) return true; if (t.isUnionTypeAnnotation(type)) { - for (let type2 of (type.types: Array)) { + for (const type2 of (type.types: Array)) { if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) { return true; } @@ -103,7 +103,7 @@ export function couldBeBaseType(name: string): boolean { } export function baseTypeStrictlyMatches(right: NodePath) { - let left = this.getTypeAnnotation(); + const left = this.getTypeAnnotation(); right = right.getTypeAnnotation(); if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) { @@ -112,6 +112,6 @@ export function baseTypeStrictlyMatches(right: NodePath) { } export function isGenericType(genericName: string): boolean { - let type = this.getTypeAnnotation(); + const type = this.getTypeAnnotation(); return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName }); } diff --git a/packages/babel-traverse/src/path/inference/inferer-reference.js b/packages/babel-traverse/src/path/inference/inferer-reference.js index 4b1d8e58a9..16effb0943 100644 --- a/packages/babel-traverse/src/path/inference/inferer-reference.js +++ b/packages/babel-traverse/src/path/inference/inferer-reference.js @@ -6,7 +6,7 @@ export default function (node: Object) { // check if a binding exists of this value and if so then return a union type of all // possible types that the binding could be - let binding = this.scope.getBinding(node.name); + const binding = this.scope.getBinding(node.name); if (binding) { if (binding.identifier.typeAnnotation) { return binding.identifier.typeAnnotation; @@ -26,17 +26,17 @@ export default function (node: Object) { } function getTypeAnnotationBindingConstantViolations(path, name) { - let binding = path.scope.getBinding(name); + const binding = path.scope.getBinding(name); - let types = []; + const types = []; path.typeAnnotation = t.unionTypeAnnotation(types); - let functionConstantViolations = []; + const functionConstantViolations = []; let constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations); - let testType = getConditionalAnnotation(path, name); + const testType = getConditionalAnnotation(path, name); if (testType) { - let testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement); + const testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement); // remove constant violations observed before the IfStatement constantViolations = constantViolations.filter((path) => testConstantViolations.indexOf(path) < 0); @@ -76,7 +76,7 @@ function getTypeAnnotationBindingConstantViolations(path, name) { constantViolations = constantViolations.concat(functionConstantViolations); // push on inferred types of violated paths - for (let violation of (constantViolations: Array)) { + for (const violation of (constantViolations: Array)) { types.push(violation.getTypeAnnotation()); } } @@ -87,21 +87,21 @@ function getTypeAnnotationBindingConstantViolations(path, name) { } function getConstantViolationsBefore(binding, path, functions) { - let violations = binding.constantViolations.slice(); + const violations = binding.constantViolations.slice(); violations.unshift(binding.path); return violations.filter((violation) => { violation = violation.resolve(); - let status = violation._guessExecutionStatusRelativeTo(path); + const status = violation._guessExecutionStatusRelativeTo(path); if (functions && status === "function") functions.push(violation); return status === "before"; }); } function inferAnnotationFromBinaryExpression(name, path) { - let operator = path.node.operator; + const operator = path.node.operator; - let right = path.get("right").resolve(); - let left = path.get("left").resolve(); + const right = path.get("right").resolve(); + const left = path.get("left").resolve(); let target; if (left.isIdentifier({ name })) { @@ -138,7 +138,7 @@ function inferAnnotationFromBinaryExpression(name, path) { if (!typePath.isLiteral()) return; // and that it's a string so we can infer it - let typeValue = typePath.node.value; + const typeValue = typePath.node.value; if (typeof typeValue !== "string") return; // and that the argument of the typeof path references us! @@ -164,15 +164,15 @@ function getParentConditionalPath(path) { } function getConditionalAnnotation(path, name) { - let ifStatement = getParentConditionalPath(path); + const ifStatement = getParentConditionalPath(path); if (!ifStatement) return; - let test = ifStatement.get("test"); - let paths = [test]; - let types = []; + const test = ifStatement.get("test"); + const paths = [test]; + const types = []; do { - let path = paths.shift().resolve(); + const path = paths.shift().resolve(); if (path.isLogicalExpression()) { paths.push(path.get("left")); @@ -180,7 +180,7 @@ function getConditionalAnnotation(path, name) { } if (path.isBinaryExpression()) { - let type = inferAnnotationFromBinaryExpression(name, path); + const type = inferAnnotationFromBinaryExpression(name, path); if (type) types.push(type); } } while (paths.length); diff --git a/packages/babel-traverse/src/path/inference/inferers.js b/packages/babel-traverse/src/path/inference/inferers.js index ec372f6825..be90de0cc0 100644 --- a/packages/babel-traverse/src/path/inference/inferers.js +++ b/packages/babel-traverse/src/path/inference/inferers.js @@ -3,7 +3,7 @@ import * as t from "babel-types"; export { default as Identifier } from "./inferer-reference"; export function VariableDeclarator() { - let id = this.get("id"); + const id = this.get("id"); if (id.isIdentifier()) { return this.get("init").getTypeAnnotation(); @@ -30,7 +30,7 @@ export function TemplateLiteral() { } export function UnaryExpression(node) { - let operator = node.operator; + const operator = node.operator; if (operator === "void") { return t.voidTypeAnnotation(); @@ -44,15 +44,15 @@ export function UnaryExpression(node) { } export function BinaryExpression(node) { - let operator = node.operator; + const operator = node.operator; if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) { return t.numberTypeAnnotation(); } else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) { return t.booleanTypeAnnotation(); } else if (operator === "+") { - let right = this.get("right"); - let left = this.get("left"); + const right = this.get("right"); + const left = this.get("left"); if (left.isBaseType("number") && right.isBaseType("number")) { // both numbers so this will be a number @@ -93,7 +93,7 @@ export function AssignmentExpression() { } export function UpdateExpression(node) { - let operator = node.operator; + const operator = node.operator; if (operator === "++" || operator === "--") { return t.numberTypeAnnotation(); } diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index be7a2755c5..e8e54f18c0 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -15,17 +15,17 @@ export function matchesPattern(pattern: string, allowPartial?: boolean): boolean // not a member expression if (!this.isMemberExpression()) return false; - let parts = pattern.split("."); - let search = [this.node]; + const parts = pattern.split("."); + const search = [this.node]; let i = 0; function matches(name) { - let part = parts[i]; + const part = parts[i]; return part === "*" || name === part; } while (search.length) { - let node = search.shift(); + const node = search.shift(); if (allowPartial && i === parts.length) { return true; @@ -68,7 +68,7 @@ export function matchesPattern(pattern: string, allowPartial?: boolean): boolean */ export function has(key): boolean { - let val = this.node && this.node[key]; + const val = this.node && this.node[key]; if (val && Array.isArray(val)) { return !!val.length; } else { @@ -88,7 +88,7 @@ export function isStatic() { * Alias of `has`. */ -export let is = has; +export const is = has; /** * Opposite of `has`. @@ -160,7 +160,7 @@ export function isCompletionRecord(allowInsideFunction?) { let first = true; do { - let container = path.container; + const container = path.container; // we're in a function so can't be a completion record if (path.isFunction() && !first) { @@ -199,11 +199,11 @@ export function isStatementOrBlock() { export function referencesImport(moduleSource, importName) { if (!this.isReferencedIdentifier()) return false; - let binding = this.scope.getBinding(this.node.name); + const binding = this.scope.getBinding(this.node.name); if (!binding || binding.kind !== "module") return false; - let path = binding.path; - let parent = path.parentPath; + const path = binding.path; + const parent = path.parentPath; if (!parent.isImportDeclaration()) return false; // check moduleSource @@ -233,7 +233,7 @@ export function referencesImport(moduleSource, importName) { */ export function getSource() { - let node = this.node; + const node = this.node; if (node.end) { return this.hub.file.code.slice(node.start, node.end); } else { @@ -254,13 +254,13 @@ export function willIMaybeExecuteBefore(target) { export function _guessExecutionStatusRelativeTo(target) { // check if the two paths are in different functions, we can't track execution of these - let targetFuncParent = target.scope.getFunctionParent(); - let selfFuncParent = this.scope.getFunctionParent(); + const targetFuncParent = target.scope.getFunctionParent(); + const selfFuncParent = this.scope.getFunctionParent(); // here we check the `node` equality as sometimes we may have different paths for the // same node due to path thrashing if (targetFuncParent.node !== selfFuncParent.node) { - let status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent); + const status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent); if (status) { return status; } else { @@ -268,17 +268,17 @@ export function _guessExecutionStatusRelativeTo(target) { } } - let targetPaths = target.getAncestry(); + const targetPaths = target.getAncestry(); if (targetPaths.indexOf(this) >= 0) return "after"; - let selfPaths = this.getAncestry(); + const selfPaths = this.getAncestry(); // get ancestor where the branches intersect let commonPath; let targetIndex; let selfIndex; for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) { - let selfPath = selfPaths[selfIndex]; + const selfPath = selfPaths[selfIndex]; targetIndex = targetPaths.indexOf(selfPath); if (targetIndex >= 0) { commonPath = selfPath; @@ -290,8 +290,8 @@ export function _guessExecutionStatusRelativeTo(target) { } // get the relationship paths that associate these nodes to their common ancestor - let targetRelationship = targetPaths[targetIndex - 1]; - let selfRelationship = selfPaths[selfIndex - 1]; + const targetRelationship = targetPaths[targetIndex - 1]; + const selfRelationship = selfPaths[selfIndex - 1]; if (!targetRelationship || !selfRelationship) { return "before"; } @@ -302,28 +302,28 @@ export function _guessExecutionStatusRelativeTo(target) { } // otherwise we're associated by a parent node, check which key comes before the other - let targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key); - let selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); + const targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key); + const selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); return targetKeyPosition > selfKeyPosition ? "before" : "after"; } export function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) { - let targetFuncPath = targetFuncParent.path; + const targetFuncPath = targetFuncParent.path; if (!targetFuncPath.isFunctionDeclaration()) return; // so we're in a completely different function, if this is a function declaration // then we can be a bit smarter and handle cases where the function is either // a. not called at all (part of an export) // b. called directly - let binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name); + const binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name); // no references! if (!binding.references) return "before"; - let referencePaths: Array = binding.referencePaths; + const referencePaths: Array = binding.referencePaths; // verify that all of the references are calls - for (let path of referencePaths) { + for (const path of referencePaths) { if (path.key !== "callee" || !path.parentPath.isCallExpression()) { return; } @@ -332,13 +332,13 @@ export function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncPare let allStatus; // verify that all the calls have the same execution status - for (let path of referencePaths) { + for (const path of referencePaths) { // if a reference is a child of the function we're checking against then we can // safelty ignore it - let childOfFunction = !!path.find((path) => path.node === targetFuncPath.node); + const childOfFunction = !!path.find((path) => path.node === targetFuncPath.node); if (childOfFunction) continue; - let status = this._guessExecutionStatusRelativeTo(path); + const status = this._guessExecutionStatusRelativeTo(path); if (allStatus) { if (allStatus !== status) return; @@ -374,7 +374,7 @@ export function _resolve(dangerous?, resolved?): ?NodePath { // otherwise it's a request for a pattern and that's a bit more tricky } } else if (this.isReferencedIdentifier()) { - let binding = this.scope.getBinding(this.node.name); + const binding = this.scope.getBinding(this.node.name); if (!binding) return; // reassigned so we can't really resolve it @@ -384,7 +384,7 @@ export function _resolve(dangerous?, resolved?): ?NodePath { if (binding.kind === "module") return; if (binding.path !== this) { - let ret = binding.path.resolve(dangerous, resolved); + const ret = binding.path.resolve(dangerous, resolved); // If the identifier resolves to parent node then we can't really resolve it. if (this.find((parent) => parent.node === ret.node)) return; return ret; @@ -395,19 +395,19 @@ export function _resolve(dangerous?, resolved?): ?NodePath { // this is dangerous, as non-direct target assignments will mutate it's state // making this resolution inaccurate - let targetKey = this.toComputedKey(); + const targetKey = this.toComputedKey(); if (!t.isLiteral(targetKey)) return; - let targetName = targetKey.value; + const targetName = targetKey.value; - let target = this.get("object").resolve(dangerous, resolved); + const target = this.get("object").resolve(dangerous, resolved); if (target.isObjectExpression()) { - let props = target.get("properties"); - for (let prop of (props: Array)) { + const props = target.get("properties"); + for (const prop of (props: Array)) { if (!prop.isProperty()) continue; - let key = prop.get("key"); + const key = prop.get("key"); // { foo: obj } let match = prop.isnt("computed") && key.isIdentifier({ name: targetName }); @@ -418,8 +418,8 @@ export function _resolve(dangerous?, resolved?): ?NodePath { if (match) return prop.get("value").resolve(dangerous, resolved); } } else if (target.isArrayExpression() && !isNaN(+targetName)) { - let elems = target.get("elements"); - let elem = elems[targetName]; + const elems = target.get("elements"); + const elem = elems[targetName]; if (elem) return elem.resolve(dangerous, resolved); } } diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 3776b2d30e..8a36031f1e 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -1,14 +1,14 @@ import { react } from "babel-types"; import * as t from "babel-types"; -let referenceVisitor = { +const referenceVisitor = { ReferencedIdentifier(path, state) { if (path.isJSXIdentifier() && react.isCompatTag(path.node.name)) { return; } // direct references that we need to track to hoist this to the highest scope we can - let binding = path.scope.getBinding(path.node.name); + const binding = path.scope.getBinding(path.node.name); if (!binding) return; // this binding isn't accessible from the parent scope so we can safely ignore it @@ -18,7 +18,7 @@ let referenceVisitor = { if (binding.constant) { state.bindings[path.node.name] = binding; } else { - for (let violationPath of (binding.constantViolations: Array)) { + for (const violationPath of (binding.constantViolations: Array)) { state.breakOnScopePaths = state.breakOnScopePaths.concat(violationPath.getAncestry()); } } @@ -35,8 +35,8 @@ export default class PathHoister { } isCompatibleScope(scope) { - for (let key in this.bindings) { - let binding = this.bindings[key]; + for (const key in this.bindings) { + const binding = this.bindings[key]; if (!scope.bindingIdentifierEquals(key, binding.identifier)) { return false; } @@ -61,7 +61,7 @@ export default class PathHoister { } getAttachmentPath() { - let path = this._getAttachmentPath(); + const path = this._getAttachmentPath(); if (!path) return; let targetScope = path.scope; @@ -73,11 +73,11 @@ export default class PathHoister { // avoid hoisting to a scope that contains bindings that are executed after our attachment path if (targetScope.path.isProgram() || targetScope.path.isFunction()) { - for (let name in this.bindings) { + for (const name in this.bindings) { // check binding is a direct child of this paths scope if (!targetScope.hasOwnBinding(name)) continue; - let binding = this.bindings[name]; + const binding = this.bindings[name]; // allow parameter references if (binding.kind === "param") continue; @@ -91,9 +91,9 @@ export default class PathHoister { } _getAttachmentPath() { - let scopes = this.scopes; + const scopes = this.scopes; - let scope = scopes.pop(); + const scope = scopes.pop(); if (!scope) return; if (scope.path.isFunction()) { @@ -113,7 +113,7 @@ export default class PathHoister { } getNextScopeAttachmentParent() { - let scope = this.scopes.pop(); + const scope = this.scopes.pop(); if (scope) return this.getAttachmentParentForPath(scope.path); } @@ -127,17 +127,17 @@ export default class PathHoister { } hasOwnParamBindings(scope) { - for (let name in this.bindings) { + for (const name in this.bindings) { if (!scope.hasOwnBinding(name)) continue; - let binding = this.bindings[name]; + const binding = this.bindings[name]; if (binding.kind === "param") return true; } return false; } run() { - let node = this.path.node; + const node = this.path.node; if (node._hoisted) return; node._hoisted = true; @@ -145,7 +145,7 @@ export default class PathHoister { this.getCompatibleScopes(); - let attachTo = this.getAttachmentPath(); + const attachTo = this.getAttachmentPath(); if (!attachTo) return; // don't bother hoisting to the same function as this will cause multiple branches to be evaluated more than once leading to a bad optimisation @@ -153,13 +153,13 @@ export default class PathHoister { // generate declaration and insert it to our point let uid = attachTo.scope.generateUidIdentifier("ref"); - let declarator = t.variableDeclarator(uid, this.path.node); + const declarator = t.variableDeclarator(uid, this.path.node); attachTo.insertBefore([ attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator]) ]); - let parent = this.path.parentPath; + const parent = this.path.parentPath; if (parent.isJSXElement() && this.path.container === parent.node.children) { // turning the `span` in `
` to an expression so we need to wrap it with // an expression container diff --git a/packages/babel-traverse/src/path/lib/removal-hooks.js b/packages/babel-traverse/src/path/lib/removal-hooks.js index 07cc98ab46..0678d1da28 100644 --- a/packages/babel-traverse/src/path/lib/removal-hooks.js +++ b/packages/babel-traverse/src/path/lib/removal-hooks.js @@ -4,7 +4,7 @@ * Pre hooks should be used for either rejecting removal or delegating removal */ -export let hooks = [ +export const hooks = [ function (self, parent) { let removeParent = false; diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index fec4dea2ef..07ba907144 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -2,7 +2,7 @@ import type NodePath from "../index"; import { react } from "babel-types"; import * as t from "babel-types"; -export let ReferencedIdentifier = { +export const ReferencedIdentifier = { types: ["Identifier", "JSXIdentifier"], checkPath({ node, parent }: NodePath, opts?: Object): boolean { if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) { @@ -19,21 +19,21 @@ export let ReferencedIdentifier = { } }; -export let ReferencedMemberExpression = { +export const ReferencedMemberExpression = { types: ["MemberExpression"], checkPath({ node, parent }) { return t.isMemberExpression(node) && t.isReferenced(node, parent); } }; -export let BindingIdentifier = { +export const BindingIdentifier = { types: ["Identifier"], checkPath({ node, parent }: NodePath): boolean { return t.isIdentifier(node) && t.isBinding(node, parent); } }; -export let Statement = { +export const Statement = { types: ["Statement"], checkPath({ node, parent }: NodePath): boolean { if (t.isStatement(node)) { @@ -49,7 +49,7 @@ export let Statement = { } }; -export let Expression = { +export const Expression = { types: ["Expression"], checkPath(path: NodePath): boolean { if (path.isIdentifier()) { @@ -60,51 +60,51 @@ export let Expression = { } }; -export let Scope = { +export const Scope = { types: ["Scopable"], checkPath(path) { return t.isScope(path.node, path.parent); } }; -export let Referenced = { +export const Referenced = { checkPath(path: NodePath): boolean { return t.isReferenced(path.node, path.parent); } }; -export let BlockScoped = { +export const BlockScoped = { checkPath(path: NodePath): boolean { return t.isBlockScoped(path.node); } }; -export let Var = { +export const Var = { types: ["VariableDeclaration"], checkPath(path: NodePath): boolean { return t.isVar(path.node); } }; -export let User = { +export const User = { checkPath(path: NodePath): boolean { return path.node && !!path.node.loc; } }; -export let Generated = { +export const Generated = { checkPath(path: NodePath): boolean { return !path.isUser(); } }; -export let Pure = { +export const Pure = { checkPath(path: NodePath, opts?): boolean { return path.scope.isPure(path.node, opts); } }; -export let Flow = { +export const Flow = { types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"], checkPath({ node }: NodePath): boolean { if (t.isFlow(node)) { diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index cb4568240c..704014c16e 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -38,15 +38,15 @@ export function insertBefore(nodes) { export function _containerInsert(from, nodes) { this.updateSiblingKeys(from, nodes.length); - let paths = []; + const paths = []; for (let i = 0; i < nodes.length; i++) { - let to = from + i; - let node = nodes[i]; + const to = from + i; + const node = nodes[i]; this.container.splice(to, 0, node); if (this.context) { - let path = this.context.create(this.parent, this.container, to, this.listKey); + const path = this.context.create(this.parent, this.container, to, this.listKey); // While this path may have a context, there is currently no guarantee that the context // will be the active context, because `popContext` may leave a final context in place. @@ -64,13 +64,13 @@ export function _containerInsert(from, nodes) { } } - let contexts = this._getQueueContexts(); + const contexts = this._getQueueContexts(); - for (let path of paths) { + for (const path of paths) { path.setScope(); path.debug(() => "Inserted."); - for (let context of contexts) { + for (const context of contexts) { context.maybeQueue(path, true); } } @@ -87,8 +87,8 @@ export function _containerInsertAfter(nodes) { } export function _maybePopFromStatements(nodes) { - let last = nodes[nodes.length - 1]; - let isIdentifier = t.isIdentifier(last) || (t.isExpressionStatement(last) && t.isIdentifier(last.expression)); + const last = nodes[nodes.length - 1]; + const isIdentifier = t.isIdentifier(last) || (t.isExpressionStatement(last) && t.isIdentifier(last.expression)); if (isIdentifier && !this.isCompletionRecord()) { nodes.pop(); @@ -109,7 +109,7 @@ export function insertAfter(nodes) { return this.parentPath.insertAfter(nodes); } else if (this.isNodeType("Expression") || (this.parentPath.isForStatement() && this.key === "init")) { if (this.node) { - let temp = this.scope.generateDeclaredUidIdentifier(); + const temp = this.scope.generateDeclaredUidIdentifier(); nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node))); nodes.push(t.expressionStatement(temp)); } @@ -136,9 +136,9 @@ export function insertAfter(nodes) { export function updateSiblingKeys(fromIndex, incrementBy) { if (!this.parent) return; - let paths = pathCache.get(this.parent); + const paths = pathCache.get(this.parent); for (let i = 0; i < paths.length; i++) { - let path = paths[i]; + const path = paths[i]; if (path.key >= fromIndex) { path.key += incrementBy; } @@ -155,7 +155,7 @@ export function _verifyNodeList(nodes) { } for (let i = 0; i < nodes.length; i++) { - let node = nodes[i]; + const node = nodes[i]; let msg; if (!node) { @@ -169,7 +169,7 @@ export function _verifyNodeList(nodes) { } if (msg) { - let type = Array.isArray(node) ? "array" : typeof node; + const type = Array.isArray(node) ? "array" : typeof node; throw new Error(`Node list ${msg} with the index of ${i} and type of ${type}`); } } @@ -184,7 +184,7 @@ export function unshiftContainer(listKey, nodes) { // get the first path and insert our nodes before it, if it doesn't exist then it // doesn't matter, our nodes will be inserted anyway - let path = NodePath.get({ + const path = NodePath.get({ parentPath: this, parent: this.node, container: this.node[listKey], @@ -203,8 +203,8 @@ export function pushContainer(listKey, nodes) { // get an invisible path that represents the last node + 1 and replace it with our // nodes, effectively inlining it - let container = this.node[listKey]; - let path = NodePath.get({ + const container = this.node[listKey]; + const path = NodePath.get({ parentPath: this, parent: this.node, container: container, @@ -221,6 +221,6 @@ export function pushContainer(listKey, nodes) { */ export function hoist(scope = this.scope) { - let hoister = new PathHoister(this, scope); + const hoister = new PathHoister(this, scope); return hoister.run(); } diff --git a/packages/babel-traverse/src/path/removal.js b/packages/babel-traverse/src/path/removal.js index f7686fce6b..76556e92eb 100644 --- a/packages/babel-traverse/src/path/removal.js +++ b/packages/babel-traverse/src/path/removal.js @@ -18,7 +18,7 @@ export function remove() { } export function _callRemovalHooks() { - for (let fn of (hooks: Array)) { + for (const fn of (hooks: Array)) { if (fn(this, this.parentPath)) return true; } } diff --git a/packages/babel-traverse/src/path/replacement.js b/packages/babel-traverse/src/path/replacement.js index 8ca15a4c09..08df6ce16c 100644 --- a/packages/babel-traverse/src/path/replacement.js +++ b/packages/babel-traverse/src/path/replacement.js @@ -7,7 +7,7 @@ import NodePath from "./index"; import { parse } from "babylon"; import * as t from "babel-types"; -let hoistVariablesVisitor = { +const hoistVariablesVisitor = { Function(path) { path.skip(); }, @@ -15,14 +15,14 @@ let hoistVariablesVisitor = { VariableDeclaration(path) { if (path.node.kind !== "var") return; - let bindings = path.getBindingIdentifiers(); - for (let key in bindings) { + const bindings = path.getBindingIdentifiers(); + for (const key in bindings) { path.scope.push({ id: bindings[key] }); } - let exprs = []; + const exprs = []; - for (let declar of (path.node.declarations: Array)) { + for (const declar of (path.node.declarations: Array)) { if (declar.init) { exprs.push(t.expressionStatement( t.assignmentExpression("=", declar.id, declar.init) @@ -73,7 +73,7 @@ export function replaceWithSourceString(replacement) { replacement = `(${replacement})`; replacement = parse(replacement); } catch (err) { - let loc = err.loc; + const loc = err.loc; if (loc) { err.message += " - make sure this is an expression."; err.message += "\n" + codeFrame(replacement, loc.line, loc.column + 1); @@ -135,7 +135,7 @@ export function replaceWith(replacement) { } } - let oldNode = this.node; + const oldNode = this.node; if (oldNode) { t.inheritsComments(replacement, oldNode); t.removeComments(oldNode); @@ -181,10 +181,10 @@ export function _replaceWith(node) { export function replaceExpressionWithStatements(nodes: Array) { this.resync(); - let toSequenceExpression = t.toSequenceExpression(nodes, this.scope); + const toSequenceExpression = t.toSequenceExpression(nodes, this.scope); if (t.isSequenceExpression(toSequenceExpression)) { - let exprs = toSequenceExpression.expressions; + const exprs = toSequenceExpression.expressions; if (exprs.length >= 2 && this.parentPath.isExpressionStatement()) { this._maybePopFromStatements(exprs); @@ -199,22 +199,22 @@ export function replaceExpressionWithStatements(nodes: Array) { } else if (toSequenceExpression) { this.replaceWith(toSequenceExpression); } else { - let container = t.functionExpression(null, [], t.blockStatement(nodes)); + const container = t.functionExpression(null, [], t.blockStatement(nodes)); container.shadow = true; this.replaceWith(t.callExpression(container, [])); this.traverse(hoistVariablesVisitor); // add implicit returns to all ending expression statements - let completionRecords: Array = this.get("callee").getCompletionRecords(); - for (let path of completionRecords) { + const completionRecords: Array = this.get("callee").getCompletionRecords(); + for (const path of completionRecords) { if (!path.isExpressionStatement()) continue; - let loop = path.findParent((path) => path.isLoop()); + const loop = path.findParent((path) => path.isLoop()); if (loop) { - let callee = this.get("callee"); + const callee = this.get("callee"); - let uid = callee.scope.generateDeclaredUidIdentifier("ret"); + const uid = callee.scope.generateDeclaredUidIdentifier("ret"); callee.get("body").pushContainer("body", t.returnStatement(uid)); path.get("expression").replaceWith( diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index 83e80df926..b7b3388b8d 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -24,9 +24,9 @@ let _crawlCallsCount = 0; */ function getCache(path, parentScope, self) { - let scopes: Array = scopeCache.get(path.node) || []; + const scopes: Array = scopeCache.get(path.node) || []; - for (let scope of scopes) { + for (const scope of scopes) { if (scope.parent === parentScope && scope.path === path) return scope; } @@ -43,7 +43,7 @@ function gatherNodeParts(node: Object, parts: Array) { if (node.source) { gatherNodeParts(node.source, parts); } else if (node.specifiers && node.specifiers.length) { - for (let specifier of (node.specifiers: Array)) { + for (const specifier of (node.specifiers: Array)) { gatherNodeParts(specifier, parts); } } else if (node.declaration) { @@ -61,7 +61,7 @@ function gatherNodeParts(node: Object, parts: Array) { } else if (t.isCallExpression(node)) { gatherNodeParts(node.callee, parts); } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) { - for (let prop of (node.properties: Array)) { + for (const prop of (node.properties: Array)) { gatherNodeParts(prop.key || prop.argument, parts); } } @@ -69,10 +69,10 @@ function gatherNodeParts(node: Object, parts: Array) { // -let collectorVisitor = { +const collectorVisitor = { For(path) { - for (let key of (t.FOR_INIT_KEYS: Array)) { - let declar = path.get(key); + for (const key of (t.FOR_INIT_KEYS: Array)) { + const declar = path.get(key); if (declar.isVar()) path.scope.getFunctionParent().registerBinding("var", declar); } }, @@ -96,7 +96,7 @@ let collectorVisitor = { }, ForXStatement(path, state) { - let left = path.get("left"); + const left = path.get("left"); if (left.isPattern() || left.isIdentifier()) { state.constantViolations.push(left); } @@ -105,18 +105,18 @@ let collectorVisitor = { ExportDeclaration: { exit(path) { const { node, scope } = path; - let declar = node.declaration; + const declar = node.declaration; if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) { - let id = declar.id; + const id = declar.id; if (!id) return; - let binding = scope.getBinding(id.name); + const binding = scope.getBinding(id.name); if (binding) binding.reference(path); } else if (t.isVariableDeclaration(declar)) { - for (let decl of (declar.declarations: Array)) { - let ids = t.getBindingIdentifiers(decl); - for (let name in ids) { - let binding = scope.getBinding(name); + for (const decl of (declar.declarations: Array)) { + const ids = t.getBindingIdentifiers(decl); + for (const name in ids) { + const binding = scope.getBinding(name); if (binding) binding.reference(path); } } @@ -150,16 +150,16 @@ let collectorVisitor = { }, ClassDeclaration(path) { - let id = path.node.id; + const id = path.node.id; if (!id) return; - let name = id.name; + const name = id.name; path.scope.bindings[name] = path.scope.getBinding(name); }, Block(path) { - let paths = path.get("body"); - for (let bodyPath of (paths: Array)) { + const paths = path.get("body"); + for (const bodyPath of (paths: Array)) { if (bodyPath.isFunctionDeclaration()) { path.scope.getBlockParent().registerDeclaration(bodyPath); } @@ -181,7 +181,7 @@ export default class Scope { return parentScope; } - let cached = getCache(path, parentScope, this); + const cached = getCache(path, parentScope, this); if (cached) return cached; this.uid = uid++; @@ -225,7 +225,7 @@ export default class Scope { */ generateDeclaredUidIdentifier(name: string = "temp") { - let id = this.generateUidIdentifier(name); + const id = this.generateUidIdentifier(name); this.push({ id }); return id; } @@ -252,7 +252,7 @@ export default class Scope { i++; } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid)); - let program = this.getProgramParent(); + const program = this.getProgramParent(); program.references[uid] = true; program.uids[uid] = true; @@ -309,7 +309,7 @@ export default class Scope { } if (t.isIdentifier(node)) { - let binding = this.getBinding(node.name); + const binding = this.getBinding(node.name); if (binding) { return binding.constant; } else { @@ -328,7 +328,7 @@ export default class Scope { if (this.isStatic(node)) { return null; } else { - let id = this.generateUidIdentifierBasedOnNode(node); + const id = this.generateUidIdentifierBasedOnNode(node); if (!dontPush) this.push({ id }); return id; } @@ -355,7 +355,7 @@ export default class Scope { } rename(oldName: string, newName: string, block?) { - let binding = this.getBinding(oldName); + const binding = this.getBinding(oldName); if (binding) { newName = newName || this.generateUidIdentifier(oldName).name; return new Renamer(binding, oldName, newName).rename(block); @@ -370,13 +370,13 @@ export default class Scope { } dump() { - let sep = repeat("-", 60); + const sep = repeat("-", 60); console.log(sep); let scope = this; do { console.log("#", scope.block.type); - for (let name in scope.bindings) { - let binding = scope.bindings[name]; + for (const name in scope.bindings) { + const binding = scope.bindings[name]; console.log(" -", name, { constant: binding.constant, references: binding.references, @@ -389,10 +389,10 @@ export default class Scope { } toArray(node: Object, i?: number) { - let file = this.hub.file; + const file = this.hub.file; if (t.isIdentifier(node)) { - let binding = this.getBinding(node.name); + const binding = this.getBinding(node.name); if (binding && binding.constant && binding.path.isGenericType("Array")) return node; } @@ -417,7 +417,7 @@ export default class Scope { } let helperName = "toArray"; - let args = [node]; + const args = [node]; if (i === true) { helperName = "toConsumableArray"; } else if (i) { @@ -446,19 +446,19 @@ export default class Scope { } else if (path.isFunctionDeclaration()) { this.registerBinding("hoisted", path.get("id"), path); } else if (path.isVariableDeclaration()) { - let declarations = path.get("declarations"); - for (let declar of (declarations: Array)) { + const declarations = path.get("declarations"); + for (const declar of (declarations: Array)) { this.registerBinding(path.node.kind, declar); } } else if (path.isClassDeclaration()) { this.registerBinding("let", path); } else if (path.isImportDeclaration()) { - let specifiers = path.get("specifiers"); - for (let specifier of (specifiers: Array)) { + const specifiers = path.get("specifiers"); + for (const specifier of (specifiers: Array)) { this.registerBinding("module", specifier); } } else if (path.isExportDeclaration()) { - let declar = path.get("declaration"); + const declar = path.get("declaration"); if (declar.isClassDeclaration() || declar.isFunctionDeclaration() || declar.isVariableDeclaration()) { this.registerDeclaration(declar); } @@ -476,9 +476,9 @@ export default class Scope { } registerConstantViolation(path: NodePath) { - let ids = path.getBindingIdentifiers(); - for (let name in ids) { - let binding = this.getBinding(name); + const ids = path.getBindingIdentifiers(); + for (const name in ids) { + const binding = this.getBinding(name); if (binding) binding.reassign(path); } } @@ -487,18 +487,18 @@ export default class Scope { if (!kind) throw new ReferenceError("no `kind`"); if (path.isVariableDeclaration()) { - let declarators: Array = path.get("declarations"); - for (let declar of declarators) { + const declarators: Array = path.get("declarations"); + for (const declar of declarators) { this.registerBinding(kind, declar); } return; } - let parent = this.getProgramParent(); - let ids = path.getBindingIdentifiers(true); + const parent = this.getProgramParent(); + const ids = path.getBindingIdentifiers(true); - for (let name in ids) { - for (let id of (ids[name]: Array)) { + for (const name in ids) { + for (const id of (ids[name]: Array)) { let local = this.getOwnBinding(name); if (local) { // same identifier so continue safely as we're likely trying to register it @@ -562,7 +562,7 @@ export default class Scope { isPure(node, constantsOnly?: boolean) { if (t.isIdentifier(node)) { - let binding = this.getBinding(node.name); + const binding = this.getBinding(node.name); if (!binding) return false; if (constantsOnly) return binding.constant; return true; @@ -570,19 +570,19 @@ export default class Scope { if (node.superClass && !this.isPure(node.superClass, constantsOnly)) return false; return this.isPure(node.body, constantsOnly); } else if (t.isClassBody(node)) { - for (let method of node.body) { + for (const method of node.body) { if (!this.isPure(method, constantsOnly)) return false; } return true; } else if (t.isBinary(node)) { return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly); } else if (t.isArrayExpression(node)) { - for (let elem of (node.elements: Array)) { + for (const elem of (node.elements: Array)) { if (!this.isPure(elem, constantsOnly)) return false; } return true; } else if (t.isObjectExpression(node)) { - for (let prop of (node.properties: Array)) { + for (const prop of (node.properties: Array)) { if (!this.isPure(prop, constantsOnly)) return false; } return true; @@ -615,7 +615,7 @@ export default class Scope { getData(key) { let scope = this; do { - let data = scope.data[key]; + const data = scope.data[key]; if (data != null) return data; } while (scope = scope.parent); } @@ -628,7 +628,7 @@ export default class Scope { removeData(key) { let scope = this; do { - let data = scope.data[key]; + const data = scope.data[key]; if (data != null) scope.data[key] = null; } while (scope = scope.parent); } @@ -644,7 +644,7 @@ export default class Scope { } _crawl() { - let path = this.path; + const path = this.path; // @@ -657,8 +657,8 @@ export default class Scope { // ForStatement - left, init if (path.isLoop()) { - for (let key of (t.FOR_INIT_KEYS: Array)) { - let node = path.get(key); + for (const key of (t.FOR_INIT_KEYS: Array)) { + const node = path.get(key); if (node.isBlockScoped()) this.registerBinding(node.node.kind, node); } } @@ -682,8 +682,8 @@ export default class Scope { // Function - params, rest if (path.isFunction()) { - let params: Array = path.get("params"); - for (let param of params) { + const params: Array = path.get("params"); + for (const param of params) { this.registerBinding("param", param); } } @@ -696,10 +696,10 @@ export default class Scope { // Program - let parent = this.getProgramParent(); + const parent = this.getProgramParent(); if (parent.crawling) return; - let state = { + const state = { references: [], constantViolations: [], assignments: [], @@ -710,11 +710,11 @@ export default class Scope { this.crawling = false; // register assignments - for (let path of state.assignments) { + for (const path of state.assignments) { // register undeclared bindings as globals - let ids = path.getBindingIdentifiers(); + const ids = path.getBindingIdentifiers(); let programParent; - for (let name in ids) { + for (const name in ids) { if (path.scope.getBinding(name)) continue; programParent = programParent || path.scope.getProgramParent(); @@ -726,8 +726,8 @@ export default class Scope { } // register references - for (let ref of state.references) { - let binding = ref.scope.getBinding(ref.node.name); + for (const ref of state.references) { + const binding = ref.scope.getBinding(ref.node.name); if (binding) { binding.reference(ref); } else { @@ -736,7 +736,7 @@ export default class Scope { } // register constant violations - for (let path of state.constantViolations) { + for (const path of state.constantViolations) { path.scope.registerConstantViolation(path); } } @@ -763,15 +763,15 @@ export default class Scope { path = path.get("body"); } - let unique = opts.unique; - let kind = opts.kind || "var"; - let blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; + const unique = opts.unique; + const kind = opts.kind || "var"; + const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; - let dataKey = `declaration:${kind}:${blockHoist}`; + const dataKey = `declaration:${kind}:${blockHoist}`; let declarPath = !unique && path.getData(dataKey); if (!declarPath) { - let declar = t.variableDeclaration(kind, []); + const declar = t.variableDeclaration(kind, []); declar._generated = true; declar._blockHoist = blockHoist; @@ -779,7 +779,7 @@ export default class Scope { if (!unique) path.setData(dataKey, declarPath); } - let declarator = t.variableDeclarator(opts.id, opts.init); + const declarator = t.variableDeclarator(opts.id, opts.init); declarPath.node.declarations.push(declarator); this.registerBinding(kind, declarPath.get("declarations").pop()); } @@ -833,7 +833,7 @@ export default class Scope { */ getAllBindings(): Object { - let ids = Object.create(null); + const ids = Object.create(null); let scope = this; do { @@ -849,13 +849,13 @@ export default class Scope { */ getAllBindingsOfKind(): Object { - let ids = Object.create(null); + const ids = Object.create(null); - for (let kind of (arguments: Array)) { + for (const kind of (arguments: Array)) { let scope = this; do { - for (let name in scope.bindings) { - let binding = scope.bindings[name]; + for (const name in scope.bindings) { + const binding = scope.bindings[name]; if (binding.kind === kind) ids[name] = binding; } scope = scope.parent; @@ -884,7 +884,7 @@ export default class Scope { let scope = this; do { - let binding = scope.getOwnBinding(name); + const binding = scope.getOwnBinding(name); if (binding) return this.warnOnFlowBinding(binding); } while (scope = scope.parent); } @@ -894,12 +894,12 @@ export default class Scope { } getBindingIdentifier(name: string) { - let info = this.getBinding(name); + const info = this.getBinding(name); return info && info.identifier; } getOwnBindingIdentifier(name: string) { - let binding = this.bindings[name]; + const binding = this.bindings[name]; return binding && binding.identifier; } @@ -926,7 +926,7 @@ export default class Scope { */ moveBindingTo(name, scope) { - let info = this.getBinding(name); + const info = this.getBinding(name); if (info) { info.scope.removeOwnBinding(name); info.scope = scope; @@ -940,7 +940,7 @@ export default class Scope { removeBinding(name: string) { // clear literal binding - let info = this.getBinding(name); + const info = this.getBinding(name); if (info) { info.scope.removeOwnBinding(name); } diff --git a/packages/babel-traverse/src/scope/lib/renamer.js b/packages/babel-traverse/src/scope/lib/renamer.js index b8c1fb3b9c..1f05cb221a 100644 --- a/packages/babel-traverse/src/scope/lib/renamer.js +++ b/packages/babel-traverse/src/scope/lib/renamer.js @@ -1,7 +1,7 @@ import Binding from "../binding"; import * as t from "babel-types"; -let renameVisitor = { +const renameVisitor = { ReferencedIdentifier({ node }, state) { if (node.name === state.oldName) { node.name = state.newName; @@ -15,9 +15,9 @@ let renameVisitor = { }, "AssignmentExpression|Declaration"(path, state) { - let ids = path.getOuterBindingIdentifiers(); + const ids = path.getOuterBindingIdentifiers(); - for (let name in ids) { + for (const name in ids) { if (name === state.oldName) ids[name].name = state.newName; } } @@ -35,11 +35,11 @@ export default class Renamer { binding: Binding; maybeConvertFromExportDeclaration(parentDeclar) { - let exportDeclar = parentDeclar.parentPath.isExportDeclaration() && parentDeclar.parentPath; + const exportDeclar = parentDeclar.parentPath.isExportDeclaration() && parentDeclar.parentPath; if (!exportDeclar) return; // build specifiers that point back to this export declaration - let isDefault = exportDeclar.isExportDefaultDeclaration(); + const isDefault = exportDeclar.isExportDefaultDeclaration(); if (isDefault && (parentDeclar.isFunctionDeclaration() || parentDeclar.isClassDeclaration()) && !parentDeclar.node.id) { @@ -48,17 +48,17 @@ export default class Renamer { parentDeclar.node.id = parentDeclar.scope.generateUidIdentifier("default"); } - let bindingIdentifiers = parentDeclar.getOuterBindingIdentifiers(); - let specifiers = []; + const bindingIdentifiers = parentDeclar.getOuterBindingIdentifiers(); + const specifiers = []; - for (let name in bindingIdentifiers) { - let localName = name === this.oldName ? this.newName : name; - let exportedName = isDefault ? "default" : name; + for (const name in bindingIdentifiers) { + const localName = name === this.oldName ? this.newName : name; + const exportedName = isDefault ? "default" : name; specifiers.push(t.exportSpecifier(t.identifier(localName), t.identifier(exportedName))); } if (specifiers.length) { - let aliasDeclar = t.exportNamedDeclaration(null, specifiers); + const aliasDeclar = t.exportNamedDeclaration(null, specifiers); // hoist to the top if it's a function if (parentDeclar.isFunctionDeclaration()) { @@ -104,10 +104,10 @@ export default class Renamer { } rename(block?) { - let { binding, oldName, newName } = this; - let { scope, path } = binding; + const { binding, oldName, newName } = this; + const { scope, path } = binding; - let parentDeclar = path.find((path) => path.isDeclaration() || path.isFunctionExpression()); + const parentDeclar = path.find((path) => path.isDeclaration() || path.isFunctionExpression()); if (parentDeclar) { this.maybeConvertFromExportDeclaration(parentDeclar); } diff --git a/packages/babel-traverse/src/visitors.js b/packages/babel-traverse/src/visitors.js index 023cdb186c..f8de5b791d 100644 --- a/packages/babel-traverse/src/visitors.js +++ b/packages/babel-traverse/src/visitors.js @@ -24,16 +24,16 @@ export function explode(visitor) { visitor._exploded = true; // normalise pipes - for (let nodeType in visitor) { + for (const nodeType in visitor) { if (shouldIgnoreKey(nodeType)) continue; - let parts: Array = nodeType.split("|"); + const parts: Array = nodeType.split("|"); if (parts.length === 1) continue; - let fns = visitor[nodeType]; + const fns = visitor[nodeType]; delete visitor[nodeType]; - for (let part of parts) { + for (const part of parts) { visitor[part] = fns; } } @@ -52,15 +52,15 @@ export function explode(visitor) { ensureCallbackArrays(visitor); // add type wrappers - for (let nodeType of (Object.keys(visitor): Array)) { + for (const nodeType of (Object.keys(visitor): Array)) { if (shouldIgnoreKey(nodeType)) continue; - let wrapper = virtualTypes[nodeType]; + const wrapper = virtualTypes[nodeType]; if (!wrapper) continue; // wrap all the functions - let fns = visitor[nodeType]; - for (let type in fns) { + const fns = visitor[nodeType]; + for (const type in fns) { fns[type] = wrapCheck(wrapper, fns[type]); } @@ -68,7 +68,7 @@ export function explode(visitor) { delete visitor[nodeType]; if (wrapper.types) { - for (let type of (wrapper.types: Array)) { + for (const type of (wrapper.types: Array)) { // merge the visitor if necessary or just put it back in if (visitor[type]) { mergePair(visitor[type], fns); @@ -82,14 +82,14 @@ export function explode(visitor) { } // add aliases - for (let nodeType in visitor) { + for (const nodeType in visitor) { if (shouldIgnoreKey(nodeType)) continue; - let fns = visitor[nodeType]; + const fns = visitor[nodeType]; let aliases: ?Array = t.FLIPPED_ALIAS_KEYS[nodeType]; - let deprecratedKey = t.DEPRECATED_KEYS[nodeType]; + const deprecratedKey = t.DEPRECATED_KEYS[nodeType]; if (deprecratedKey) { console.trace(`Visitor defined for ${nodeType} but it has been renamed to ${deprecratedKey}`); aliases = [deprecratedKey]; @@ -100,8 +100,8 @@ export function explode(visitor) { // clear it from the visitor delete visitor[nodeType]; - for (let alias of aliases) { - let existing = visitor[alias]; + for (const alias of aliases) { + const existing = visitor[alias]; if (existing) { mergePair(existing, fns); } else { @@ -110,7 +110,7 @@ export function explode(visitor) { } } - for (let nodeType in visitor) { + for (const nodeType in visitor) { if (shouldIgnoreKey(nodeType)) continue; ensureCallbackArrays(visitor[nodeType]); @@ -126,7 +126,7 @@ export function verify(visitor) { throw new Error(messages.get("traverseVerifyRootFunction")); } - for (let nodeType in visitor) { + for (const nodeType in visitor) { if (nodeType === "enter" || nodeType === "exit") { validateVisitorMethods(nodeType, visitor[nodeType]); } @@ -137,9 +137,9 @@ export function verify(visitor) { throw new Error(messages.get("traverseVerifyNodeType", nodeType)); } - let visitors = visitor[nodeType]; + const visitors = visitor[nodeType]; if (typeof visitors === "object") { - for (let visitorKey in visitors) { + for (const visitorKey in visitors) { if (visitorKey === "enter" || visitorKey === "exit") { // verify that it just contains functions validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]); @@ -154,8 +154,8 @@ export function verify(visitor) { } function validateVisitorMethods(path, val) { - let fns = [].concat(val); - for (let fn of fns) { + const fns = [].concat(val); + for (const fn of fns) { if (typeof fn !== "function") { throw new TypeError(`Non-function found defined in ${path} with type ${typeof fn}`); } @@ -163,15 +163,15 @@ function validateVisitorMethods(path, val) { } export function merge(visitors: Array, states: Array = [], wrapper?: ?Function) { - let rootVisitor = {}; + const rootVisitor = {}; for (let i = 0; i < visitors.length; i++) { - let visitor = visitors[i]; - let state = states[i]; + const visitor = visitors[i]; + const state = states[i]; explode(visitor); - for (let type in visitor) { + for (const type in visitor) { let visitorType = visitor[type]; // if we have state or wrapper then overload the callbacks to take it @@ -179,7 +179,7 @@ export function merge(visitors: Array, states: Array = [], wrapper?: ?Function) visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper); } - let nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; + const nodeVisitor = rootVisitor[type] = rootVisitor[type] || {}; mergePair(nodeVisitor, visitorType); } } @@ -188,9 +188,9 @@ export function merge(visitors: Array, states: Array = [], wrapper?: ?Function) } function wrapWithStateOrWrapper(oldVisitor, state, wrapper: ?Function) { - let newVisitor = {}; + const newVisitor = {}; - for (let key in oldVisitor) { + for (const key in oldVisitor) { let fns = oldVisitor[key]; // not an enter/exit array of callbacks @@ -219,10 +219,10 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper: ?Function) { } function ensureEntranceObjects(obj) { - for (let key in obj) { + for (const key in obj) { if (shouldIgnoreKey(key)) continue; - let fns = obj[key]; + const fns = obj[key]; if (typeof fns === "function") { obj[key] = { enter: fns }; } @@ -235,7 +235,7 @@ function ensureCallbackArrays(obj) { } function wrapCheck(wrapper, fn) { - let newFn = function (path) { + const newFn = function (path) { if (wrapper.checkPath(path)) { return fn.apply(this, arguments); } @@ -258,7 +258,7 @@ function shouldIgnoreKey(key) { } function mergePair(dest, src) { - for (let key in src) { + for (const key in src) { dest[key] = [].concat(dest[key] || [], src[key]); } } diff --git a/packages/babel-traverse/test/ancestry.js b/packages/babel-traverse/test/ancestry.js index 43e09859ef..8d8f013948 100644 --- a/packages/babel-traverse/test/ancestry.js +++ b/packages/babel-traverse/test/ancestry.js @@ -1,63 +1,63 @@ -let traverse = require("../lib").default; -let assert = require("assert"); -let parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; describe("path/ancestry", function () { describe("isAncestor", function () { - let ast = parse("var a = 1; 'a';"); + const ast = parse("var a = 1; 'a';"); it("returns true if ancestor", function() { - let paths = []; + const paths = []; traverse(ast, { "Program|NumericLiteral"(path) { paths.push(path); }, }); - let [ programPath, numberPath ] = paths; + const [ programPath, numberPath ] = paths; assert(programPath.isAncestor(numberPath)); }); it("returns false if not ancestor", function() { - let paths = []; + const paths = []; traverse(ast, { "Program|NumericLiteral|StringLiteral"(path) { paths.push(path); } }); - let [ , numberPath, stringPath ] = paths; + const [ , numberPath, stringPath ] = paths; assert(!stringPath.isAncestor(numberPath)); }); }); describe("isDescendant", function () { - let ast = parse("var a = 1; 'a';"); + const ast = parse("var a = 1; 'a';"); it("returns true if descendant", function() { - let paths = []; + const paths = []; traverse(ast, { "Program|NumericLiteral"(path) { paths.push(path); }, }); - let [ programPath, numberPath ] = paths; + const [ programPath, numberPath ] = paths; assert(numberPath.isDescendant(programPath)); }); it("returns false if not descendant", function() { - let paths = []; + const paths = []; traverse(ast, { "Program|NumericLiteral|StringLiteral"(path) { paths.push(path); } }); - let [ , numberPath, stringPath ] = paths; + const [ , numberPath, stringPath ] = paths; assert(!numberPath.isDescendant(stringPath)); }); diff --git a/packages/babel-traverse/test/evaluation.js b/packages/babel-traverse/test/evaluation.js index 956d656eb3..3c53fbf615 100644 --- a/packages/babel-traverse/test/evaluation.js +++ b/packages/babel-traverse/test/evaluation.js @@ -1,9 +1,9 @@ -let traverse = require("../lib").default; -let assert = require("assert"); -let parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; function getPath(code) { - let ast = parse(code); + const ast = parse(code); let path; traverse(ast, { Program: function (_path) { diff --git a/packages/babel-traverse/test/family.js b/packages/babel-traverse/test/family.js index c6fc297f86..6e9a497df7 100644 --- a/packages/babel-traverse/test/family.js +++ b/packages/babel-traverse/test/family.js @@ -1,10 +1,10 @@ -let traverse = require("../lib").default; -let assert = require("assert"); -let parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; describe("path/family", function () { describe("getBindingIdentifiers", function () { - let ast = parse("var a = 1, {b} = c, [d] = e; function f() {}"); + const ast = parse("var a = 1, {b} = c, [d] = e; function f() {}"); let nodes = {}, paths = {}, outerNodes = {}, outerPaths = {}; traverse(ast, { VariableDeclaration(path) { diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index 332a3eabd9..db51118fcf 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -1,9 +1,9 @@ -let traverse = require("../lib").default; -let assert = require("assert"); -let parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; function getPath(code) { - let ast = parse(code); + const ast = parse(code); let path; traverse(ast, { Program: function (_path) { diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index cee7157150..ce87f9973f 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -1,23 +1,23 @@ -let traverse = require("../lib").default; -let assert = require("assert"); -let _ = require("lodash"); -let parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const _ = require("lodash"); +const parse = require("babylon").parse; describe("traverse", function () { - let code = ` + const code = ` var foo = "bar"; this.test = "wow"; `; - let ast = parse(code); - let program = ast.program; - let body = program.body; + const ast = parse(code); + const program = ast.program; + const body = program.body; it("traverse replace", function () { - let replacement = { + const replacement = { type: "StringLiteral", value: "foo" }; - let ast2 = _.cloneDeep(program); + const ast2 = _.cloneDeep(program); traverse(ast2, { enter: function (path) { @@ -29,12 +29,12 @@ describe("traverse", function () { }); it("traverse", function () { - let expect = [ + const expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, body[1], body[1].expression, body[1].expression.left, body[1].expression.left.object, body[1].expression.left.property, body[1].expression.right ]; - let actual = []; + const actual = []; traverse(program, { enter: function (path) { @@ -54,12 +54,12 @@ describe("traverse", function () { }); it("traverse blacklistTypes", function () { - let expect = [ + const expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, body[1], body[1].expression, body[1].expression.right ]; - let actual = []; + const actual = []; traverse(program, { blacklist: ["MemberExpression"], @@ -85,8 +85,8 @@ describe("traverse", function () { }); it("clearCache", function () { - let paths = []; - let scopes = []; + const paths = []; + const scopes = []; traverse(ast, { enter(path) { scopes.push(path.scope); @@ -97,8 +97,8 @@ describe("traverse", function () { traverse.clearCache(); - let paths2 = []; - let scopes2 = []; + const paths2 = []; + const scopes2 = []; traverse(ast, { enter(path) { scopes2.push(path.scope); @@ -114,7 +114,7 @@ describe("traverse", function () { }); it("clearPath", function () { - let paths = []; + const paths = []; traverse(ast, { enter(path) { paths.push(path); @@ -123,7 +123,7 @@ describe("traverse", function () { traverse.clearCache.clearPath(); - let paths2 = []; + const paths2 = []; traverse(ast, { enter(path) { paths2.push(path); @@ -136,7 +136,7 @@ describe("traverse", function () { }); it("clearScope", function () { - let scopes = []; + const scopes = []; traverse(ast, { enter(path) { scopes.push(path.scope); @@ -146,7 +146,7 @@ describe("traverse", function () { traverse.clearCache.clearScope(); - let scopes2 = []; + const scopes2 = []; traverse(ast, { enter(path) { scopes2.push(path.scope); diff --git a/packages/babel-types/src/converters.js b/packages/babel-types/src/converters.js index dcfc14d9f9..f350230ddf 100644 --- a/packages/babel-types/src/converters.js +++ b/packages/babel-types/src/converters.js @@ -24,10 +24,10 @@ export function toComputedKey(node: Object, key: Object = node.key || node.prope export function toSequenceExpression(nodes: Array, scope: Scope): ?Object { if (!nodes || !nodes.length) return; - let declars = []; + const declars = []; let bailed = false; - let result = convert(nodes); + const result = convert(nodes); if (bailed) return; for (let i = 0; i < declars.length; i++) { @@ -38,9 +38,9 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec function convert(nodes) { let ensureLastUndefined = false; - let exprs = []; + const exprs = []; - for (let node of (nodes: Array)) { + for (const node of (nodes: Array)) { if (t.isExpression(node)) { exprs.push(node); } else if (t.isExpressionStatement(node)) { @@ -48,9 +48,9 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec } else if (t.isVariableDeclaration(node)) { if (node.kind !== "var") return bailed = true; // bailed - for (let declar of (node.declarations: Array)) { - let bindings = t.getBindingIdentifiers(declar); - for (let key in bindings) { + for (const declar of (node.declarations: Array)) { + const bindings = t.getBindingIdentifiers(declar); + for (const key in bindings) { declars.push({ kind: node.kind, id: bindings[key] @@ -65,8 +65,8 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec ensureLastUndefined = true; continue; } else if (t.isIfStatement(node)) { - let consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode(); - let alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode(); + const consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode(); + const alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode(); if (!consequent || !alternate) return bailed = true; exprs.push(t.conditionalExpression(node.test, consequent, alternate)); @@ -283,8 +283,8 @@ export function valueToNode(value: any): Object { // regexes if (isRegExp(value)) { - let pattern = value.source; - let flags = value.toString().match(/\/([a-z]+|)$/)[1]; + const pattern = value.source; + const flags = value.toString().match(/\/([a-z]+|)$/)[1]; return t.regExpLiteral(pattern, flags); } @@ -295,8 +295,8 @@ export function valueToNode(value: any): Object { // object if (isPlainObject(value)) { - let props = []; - for (let key in value) { + const props = []; + for (const key in value) { let nodeKey; if (t.isValidIdentifier(key)) { nodeKey = t.identifier(key); diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 19a37158a7..276db2048a 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -425,7 +425,7 @@ defineType("MemberExpression", { }, property: { validate(node, key, val) { - let expectedType = node.computed ? "Expression" : "Identifier"; + const expectedType = node.computed ? "Expression" : "Identifier"; assertNodeType(expectedType)(node, key, val); } }, @@ -489,7 +489,7 @@ defineType("ObjectMethod", { }, key: { validate(node, key, val) { - let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); } }, @@ -521,7 +521,7 @@ defineType("ObjectProperty", { }, key: { validate(node, key, val) { - let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); } }, diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 4f4ff0807c..47c0298577 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -264,7 +264,7 @@ defineType("ClassMethod", { }, key: { validate(node, key, val) { - let expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; + const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); } }, diff --git a/packages/babel-types/src/definitions/index.js b/packages/babel-types/src/definitions/index.js index d4ae802350..17e3ca24a6 100644 --- a/packages/babel-types/src/definitions/index.js +++ b/packages/babel-types/src/definitions/index.js @@ -1,10 +1,10 @@ import * as t from "../index"; -export let VISITOR_KEYS = {}; -export let ALIAS_KEYS = {}; -export let NODE_FIELDS = {}; -export let BUILDER_KEYS = {}; -export let DEPRECATED_KEYS = {}; +export const VISITOR_KEYS = {}; +export const ALIAS_KEYS = {}; +export const NODE_FIELDS = {}; +export const BUILDER_KEYS = {}; +export const DEPRECATED_KEYS = {}; function getType(val) { if (Array.isArray(val)) { @@ -48,7 +48,7 @@ export function assertNodeType(...types: Array): Function { function validate(node, key, val) { let valid = false; - for (let type of types) { + for (const type of types) { if (t.is(type, val)) { valid = true; break; @@ -72,7 +72,7 @@ export function assertNodeOrValueType(...types: Array): Function { function validate(node, key, val) { let valid = false; - for (let type of types) { + for (const type of types) { if (getType(val) === type || t.is(type, val)) { valid = true; break; @@ -94,7 +94,7 @@ export function assertNodeOrValueType(...types: Array): Function { export function assertValueType(type: string): Function { function validate(node, key, val) { - let valid = getType(val) === type; + const valid = getType(val) === type; if (!valid) { throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); @@ -108,7 +108,7 @@ export function assertValueType(type: string): Function { export function chain(...fns: Array): Function { function validate(...args) { - for (let fn of fns) { + for (const fn of fns) { fn(...args); } } @@ -127,7 +127,7 @@ export default function defineType( deprecatedAlias?: string; } = {}, ) { - let inherits = (opts.inherits && store[opts.inherits]) || {}; + const inherits = (opts.inherits && store[opts.inherits]) || {}; opts.fields = opts.fields || inherits.fields || {}; opts.visitor = opts.visitor || inherits.visitor || []; @@ -139,12 +139,12 @@ export default function defineType( } // ensure all field keys are represented in `fields` - for (let key of (opts.visitor.concat(opts.builder): Array)) { + for (const key of (opts.visitor.concat(opts.builder): Array)) { opts.fields[key] = opts.fields[key] || {}; } - for (let key in opts.fields) { - let field = opts.fields[key]; + for (const key in opts.fields) { + const field = opts.fields[key]; if (opts.builder.indexOf(key) === -1) { field.optional = true; @@ -164,4 +164,4 @@ export default function defineType( store[type] = opts; } -let store = {}; +const store = {}; diff --git a/packages/babel-types/src/flow.js b/packages/babel-types/src/flow.js index b2dbd43dbc..996a11c8f4 100644 --- a/packages/babel-types/src/flow.js +++ b/packages/babel-types/src/flow.js @@ -6,7 +6,7 @@ import * as t from "./index"; */ export function createUnionTypeAnnotation(types: Array) { - let flattened = removeTypeDuplicates(types); + const flattened = removeTypeDuplicates(types); if (flattened.length === 1) { return flattened[0]; @@ -20,16 +20,16 @@ export function createUnionTypeAnnotation(types: Array) { */ export function removeTypeDuplicates(nodes: Array): Array { - let generics = {}; - let bases = {}; + const generics = {}; + const bases = {}; // store union type groups to circular references - let typeGroups = []; + const typeGroups = []; - let types = []; + const types = []; for (let i = 0; i < nodes.length; i++) { - let node = nodes[i]; + const node = nodes[i]; if (!node) continue; // detect duplicates @@ -59,7 +59,7 @@ export function removeTypeDuplicates(nodes: Array): Array { // find a matching generic type and merge and deduplicate the type parameters if (t.isGenericTypeAnnotation(node)) { - let name = node.id.name; + const name = node.id.name; if (generics[name]) { let existing = generics[name]; @@ -83,12 +83,12 @@ export function removeTypeDuplicates(nodes: Array): Array { } // add back in bases - for (let type in bases) { + for (const type in bases) { types.push(bases[type]); } // add back in generics - for (let name in generics) { + for (const name in generics) { types.push(generics[name]); } diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index a5ae2c9325..09cbe39ad1 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -4,7 +4,7 @@ import loClone from "lodash/clone"; import each from "lodash/each"; import uniq from "lodash/uniq"; -let t = exports; +const t = exports; /** * Registers `is[Type]` and `assert[Type]` generated functions for a given `type`. @@ -62,7 +62,7 @@ export { _react as react }; * Registers `is[Type]` and `assert[Type]` for all types. */ -for (let type in t.VISITOR_KEYS) { +for (const type in t.VISITOR_KEYS) { registerType(type); } @@ -74,7 +74,7 @@ t.FLIPPED_ALIAS_KEYS = {}; each(t.ALIAS_KEYS, function (aliases, type) { each(aliases, function (alias) { - let types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; + const types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; types.push(type); }); }); @@ -102,7 +102,7 @@ export const TYPES = Object.keys(t.VISITOR_KEYS) export function is(type: string, node: Object, opts?: Object): boolean { if (!node) return false; - let matches = isType(node.type, type); + const matches = isType(node.type, type); if (!matches) return false; if (typeof opts === "undefined") { @@ -123,11 +123,11 @@ export function isType(nodeType: string, targetType: string): boolean { // targetType was a primary node type, so there's no need to check the aliases. if (t.ALIAS_KEYS[targetType]) return false; - let aliases: ?Array = t.FLIPPED_ALIAS_KEYS[targetType]; + const aliases: ?Array = t.FLIPPED_ALIAS_KEYS[targetType]; if (aliases) { if (aliases[0] === nodeType) return true; - for (let alias of aliases) { + for (const alias of aliases) { if (nodeType === alias) return true; } } @@ -148,13 +148,13 @@ each(t.BUILDER_KEYS, function (keys, type) { ); } - let node = {}; + const node = {}; node.type = type; let i = 0; - for (let key of (keys: Array)) { - let field = t.NODE_FIELDS[type][key]; + for (const key of (keys: Array)) { + const field = t.NODE_FIELDS[type][key]; let arg = arguments[i++]; if (arg === undefined) arg = loClone(field.default); @@ -162,7 +162,7 @@ each(t.BUILDER_KEYS, function (keys, type) { node[key] = arg; } - for (let key in node) { + for (const key in node) { validate(node, key, node[key]); } @@ -177,8 +177,8 @@ each(t.BUILDER_KEYS, function (keys, type) { * Description */ -for (let type in t.DEPRECATED_KEYS) { - let newType = t.DEPRECATED_KEYS[type]; +for (const type in t.DEPRECATED_KEYS) { + const newType = t.DEPRECATED_KEYS[type]; function proxy(fn) { return function () { @@ -199,10 +199,10 @@ for (let type in t.DEPRECATED_KEYS) { export function validate(node?: Object, key: string, val: any) { if (!node) return; - let fields = t.NODE_FIELDS[node.type]; + const fields = t.NODE_FIELDS[node.type]; if (!fields) return; - let field = fields[key]; + const field = fields[key]; if (!field || !field.validate) return; if (field.optional && val == null) return; @@ -214,9 +214,9 @@ export function validate(node?: Object, key: string, val: any) { */ export function shallowEqual(actual: Object, expected: Object): boolean { - let keys = Object.keys(expected); + const keys = Object.keys(expected); - for (let key of (keys: Array)) { + for (const key of (keys: Array)) { if (actual[key] !== expected[key]) { return false; } @@ -260,8 +260,8 @@ export function ensureBlock(node: Object, key: string = "body"): Object { export function clone(node: Object): Object { if (!node) return node; - let newNode = {}; - for (let key in node) { + const newNode = {}; + for (const key in node) { if (key[0] === "_") continue; newNode[key] = node[key]; } @@ -273,7 +273,7 @@ export function clone(node: Object): Object { */ export function cloneWithoutLoc(node: Object): Object { - let newNode = clone(node); + const newNode = clone(node); delete newNode.loc; return newNode; } @@ -285,9 +285,9 @@ export function cloneWithoutLoc(node: Object): Object { export function cloneDeep(node: Object): Object { if (!node) return node; - let newNode = {}; + const newNode = {}; - for (let key in node) { + for (const key in node) { if (key[0] === "_") continue; let val = node[key]; @@ -315,17 +315,17 @@ export function cloneDeep(node: Object): Object { */ export function buildMatchMemberExpression(match:string, allowPartial?: boolean): Function { - let parts = match.split("."); + const parts = match.split("."); return function (member) { // not a member expression if (!t.isMemberExpression(member)) return false; - let search = [member]; + const search = [member]; let i = 0; while (search.length) { - let node = search.shift(); + const node = search.shift(); if (allowPartial && i === parts.length) { return true; @@ -366,7 +366,7 @@ export function buildMatchMemberExpression(match:string, allowPartial?: boolean) */ export function removeComments(node: Object): Object { - for (let key of t.COMMENT_KEYS) { + for (const key of t.COMMENT_KEYS) { delete node[key]; } return node; @@ -409,19 +409,19 @@ export function inherits(child: Object, parent: Object): Object { if (!child || !parent) return child; // optionally inherit specific properties if not null - for (let key of (t.INHERIT_KEYS.optional: Array)) { + for (const key of (t.INHERIT_KEYS.optional: Array)) { if (child[key] == null) { child[key] = parent[key]; } } // force inherit "private" properties - for (let key in parent) { + for (const key in parent) { if (key[0] === "_") child[key] = parent[key]; } // force inherit select properties - for (let key of (t.INHERIT_KEYS.force: Array)) { + for (const key of (t.INHERIT_KEYS.force: Array)) { child[key] = parent[key]; } @@ -460,17 +460,17 @@ toFastProperties(t.VISITOR_KEYS); export function traverseFast(node: Node, enter: (node: Node) => void, opts?: Object) { if (!node) return; - let keys = t.VISITOR_KEYS[node.type]; + const keys = t.VISITOR_KEYS[node.type]; if (!keys) return; opts = opts || {}; enter(node, opts); - for (let key of keys) { - let subNode = node[key]; + for (const key of keys) { + const subNode = node[key]; if (Array.isArray(subNode)) { - for (let node of subNode) { + for (const node of subNode) { traverseFast(node, enter, opts); } } else { @@ -496,17 +496,17 @@ const CLEAR_KEYS_PLUS_COMMENTS: Array = t.COMMENT_KEYS.concat([ export function removeProperties(node: Node, opts?: Object): void { opts = opts || {}; - let map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; - for (let key of map) { + const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; + for (const key of map) { if (node[key] != null) node[key] = undefined; } - for (let key in node) { + for (const key in node) { if (key[0] === "_" && node[key] != null) node[key] = undefined; } - let syms: Array = Object.getOwnPropertySymbols(node); - for (let sym of syms) { + const syms: Array = Object.getOwnPropertySymbols(node); + for (const sym of syms) { node[sym] = null; } } diff --git a/packages/babel-types/src/react.js b/packages/babel-types/src/react.js index 9b665d224d..ebf3829cae 100644 --- a/packages/babel-types/src/react.js +++ b/packages/babel-types/src/react.js @@ -1,6 +1,6 @@ import * as t from "./index"; -export let isReactComponent = t.buildMatchMemberExpression("React.Component"); +export const isReactComponent = t.buildMatchMemberExpression("React.Component"); export function isCompatTag(tagName?: string): boolean { return !!tagName && /^[a-z]|\-/.test(tagName); @@ -10,7 +10,7 @@ function cleanJSXElementLiteralChild( child: { value: string }, args: Array, ) { - let lines = child.value.split(/\r\n|\n|\r/); + const lines = child.value.split(/\r\n|\n|\r/); let lastNonEmptyLine = 0; @@ -23,11 +23,11 @@ function cleanJSXElementLiteralChild( let str = ""; for (let i = 0; i < lines.length; i++) { - let line = lines[i]; + const line = lines[i]; - let isFirstLine = i === 0; - let isLastLine = i === lines.length - 1; - let isLastNonEmptyLine = i === lastNonEmptyLine; + const isFirstLine = i === 0; + const isLastLine = i === lines.length - 1; + const isLastNonEmptyLine = i === lastNonEmptyLine; // replace rendered whitespace tabs with spaces let trimmedLine = line.replace(/\t/g, " "); @@ -55,7 +55,7 @@ function cleanJSXElementLiteralChild( } export function buildChildren(node: Object): Array { - let elems = []; + const elems = []; for (let i = 0; i < node.children.length; i++) { let child = node.children[i]; diff --git a/packages/babel-types/src/retrievers.js b/packages/babel-types/src/retrievers.js index c4d7647b4a..2395ba3046 100644 --- a/packages/babel-types/src/retrievers.js +++ b/packages/babel-types/src/retrievers.js @@ -10,17 +10,17 @@ export function getBindingIdentifiers( outerOnly?: boolean ): Object { let search = [].concat(node); - let ids = Object.create(null); + const ids = Object.create(null); while (search.length) { - let id = search.shift(); + const id = search.shift(); if (!id) continue; - let keys = t.getBindingIdentifiers.keys[id.type]; + const keys = t.getBindingIdentifiers.keys[id.type]; if (t.isIdentifier(id)) { if (duplicates) { - let _ids = ids[id.name] = ids[id.name] || []; + const _ids = ids[id.name] = ids[id.name] || []; _ids.push(id); } else { ids[id.name] = id; @@ -48,7 +48,7 @@ export function getBindingIdentifiers( if (keys) { for (let i = 0; i < keys.length; i++) { - let key = keys[i]; + const key = keys[i]; if (id[key]) { search = search.concat(id[key]); } diff --git a/packages/babel-types/src/validators.js b/packages/babel-types/src/validators.js index 78ea84cb40..183a304a9b 100644 --- a/packages/babel-types/src/validators.js +++ b/packages/babel-types/src/validators.js @@ -10,11 +10,11 @@ import { BLOCK_SCOPED_SYMBOL } from "./constants"; */ export function isBinding(node: Object, parent: Object): boolean { - let keys = getBindingIdentifiers.keys[parent.type]; + const keys = getBindingIdentifiers.keys[parent.type]; if (keys) { for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - let val = parent[key]; + const key = keys[i]; + const val = parent[key]; if (Array.isArray(val)) { if (val.indexOf(node) >= 0) return true; } else { @@ -73,7 +73,7 @@ export function isReferenced(node: Object, parent: Object): boolean { case "ArrowFunctionExpression": case "FunctionDeclaration": case "FunctionExpression": - for (let param of (parent.params: Array)) { + for (const param of (parent.params: Array)) { if (param === node) return false; } @@ -254,7 +254,7 @@ export function isNodesEquivalent(a, b) { const fields = Object.keys(t.NODE_FIELDS[a.type] || a.type); - for (let field of fields) { + for (const field of fields) { if (typeof a[field] !== typeof b[field]) { return false; } diff --git a/packages/babel-types/test/cloning.js b/packages/babel-types/test/cloning.js index 817a4e1ec4..1280f94bd0 100644 --- a/packages/babel-types/test/cloning.js +++ b/packages/babel-types/test/cloning.js @@ -1,24 +1,24 @@ -let t = require("../lib"); -let assert = require("assert"); -let parse = require("babylon").parse; +const t = require("../lib"); +const assert = require("assert"); +const parse = require("babylon").parse; suite("cloning", function () { suite("clone", function () { it("should handle undefined", function () { - let node = undefined; - let cloned = t.clone(node); + const node = undefined; + const cloned = t.clone(node); assert(cloned === undefined); }); it("should handle null", function () { - let node = null; - let cloned = t.clone(node); + const node = null; + const cloned = t.clone(node); assert(cloned === null); }); it("should handle simple cases", function () { - let node = t.arrayExpression([null, t.identifier("a")]); - let cloned = t.clone(node); + const node = t.arrayExpression([null, t.identifier("a")]); + const cloned = t.clone(node); assert(node !== cloned); assert(t.isNodesEquivalent(node, cloned) === true); }); @@ -26,42 +26,42 @@ suite("cloning", function () { suite("cloneDeep", function () { it("should handle undefined", function () { - let node = undefined; - let cloned = t.cloneDeep(node); + const node = undefined; + const cloned = t.cloneDeep(node); assert(cloned === undefined); }); it("should handle null", function () { - let node = null; - let cloned = t.cloneDeep(node); + const node = null; + const cloned = t.cloneDeep(node); assert(cloned === null); }); it("should handle simple cases", function () { - let node = t.arrayExpression([null, t.identifier("a")]); - let cloned = t.cloneDeep(node); + const node = t.arrayExpression([null, t.identifier("a")]); + const cloned = t.cloneDeep(node); assert(node !== cloned); assert(t.isNodesEquivalent(node, cloned) === true); }); it("should handle full programs", function () { - let node = parse("1 + 1"); - let cloned = t.cloneDeep(node); + const node = parse("1 + 1"); + const cloned = t.cloneDeep(node); assert(node !== cloned); assert(t.isNodesEquivalent(node, cloned) === true); }); it("should handle complex programs", function () { - let program = "'use strict'; function lol() { wow();return 1; }"; - let node = parse(program); - let cloned = t.cloneDeep(node); + const program = "'use strict'; function lol() { wow();return 1; }"; + const node = parse(program); + const cloned = t.cloneDeep(node); assert(node !== cloned); assert(t.isNodesEquivalent(node, cloned) === true); }); it("should handle missing array element", function () { - let node = parse("[,0]"); - let cloned = t.cloneDeep(node); + const node = parse("[,0]"); + const cloned = t.cloneDeep(node); assert(node !== cloned); assert(t.isNodesEquivalent(node, cloned) === true); }); diff --git a/packages/babel-types/test/validators.js b/packages/babel-types/test/validators.js index c269614f48..b6f6f31782 100644 --- a/packages/babel-types/test/validators.js +++ b/packages/babel-types/test/validators.js @@ -1,14 +1,14 @@ -let t = require("../lib"); -let assert = require("assert"); -let parse = require("babylon").parse; +const t = require("../lib"); +const assert = require("assert"); +const parse = require("babylon").parse; suite("validators", function () { suite("isNodesEquivalent", function () { it("should handle simple cases", function () { - let mem = t.memberExpression(t.identifier("a"), t.identifier("b")); + const mem = t.memberExpression(t.identifier("a"), t.identifier("b")); assert(t.isNodesEquivalent(mem, mem) === true); - let mem2 = t.memberExpression(t.identifier("a"), t.identifier("c")); + const mem2 = t.memberExpression(t.identifier("a"), t.identifier("c")); assert(t.isNodesEquivalent(mem, mem2) === false); }); @@ -18,11 +18,11 @@ suite("validators", function () { }); it("should handle complex programs", function () { - let program = "'use strict'; function lol() { wow();return 1; }"; + const program = "'use strict'; function lol() { wow();return 1; }"; assert(t.isNodesEquivalent(parse(program), parse(program)) === true); - let program2 = "'use strict'; function lol() { wow();return -1; }"; + const program2 = "'use strict'; function lol() { wow();return -1; }"; assert(t.isNodesEquivalent(parse(program), parse(program2)) === false); }); From 47bb77d35276a54016025bdc1621fb27be1f4baa Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 14 Jan 2017 15:01:52 -0600 Subject: [PATCH 049/222] Update babel-core options in README (#5114) * Add wrapPluginVisitorMethod option to babel-core README [skip ci] * fix typo * alpha-sort options * add note about introspection [skip ci] --- packages/babel-core/README.md | 51 ++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/packages/babel-core/README.md b/packages/babel-core/README.md index eda73abf48..b4eb1c621b 100644 --- a/packages/babel-core/README.md +++ b/packages/babel-core/README.md @@ -86,34 +86,35 @@ Following is a table of the options you can use: | Option | Default | Description | | ------------------------ | -------------------- | ------------------------------- | +| `ast` | `true` | Include the AST in the returned object | +| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. | +| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. | +| `code` | `true` | Enable code generation | +| `comments` | `true` | Output comments in generated output. | +| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. | +| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the environment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` | +| `extends` | `null` | A path to an `.babelrc` file to extend | | `filename` | `"unknown"` | Filename for use in errors etc. | | `filenameRelative` | `(filename)` | Filename relative to `sourceRoot`. | -| `presets` | `[]` | List of [presets](/docs/plugins/#presets) (a set of plugins) to load and use. | -| `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. | -| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon | | `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, babel-generator | -| `highlightCode` | `true` | ANSI highlight syntax error code frames | -| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | -| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. | -| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. | -| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. | -| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. | -| `inputSourceMap` | `null` | A source map object that the output source map will be based on. | -| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. | -| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. | -| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. | -| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | -| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) | -| `moduleId` | `null` | Specify a custom name for module ids. | | `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used. | -| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. | -| `code` | `true` | Enable code generation | -| `no-babelrc` | [CLI flag](http://babeljs.io/docs/usage/cli/#ignoring-babelrc) | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. | -| `ast` | `true` | Include the AST in the returned object | -| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. | +| `highlightCode` | `true` | ANSI highlight syntax error code frames | +| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified. | +| `inputSourceMap` | `null` | A source map object that the output source map will be based on. | | `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) | -| `comments` | `true` | Output comments in generated output. | -| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. | -| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the enviroment variable `BABEL_ENV` is set to `"production"`. If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"` | +| `moduleId` | `null` | Specify a custom name for module ids. | +| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) | +| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | +| `no-babelrc` | [CLI flag](http://babeljs.io/docs/usage/cli/#ignoring-babelrc) | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. | +| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | +| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon | +| `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. | +| `presets` | `[]` | List of [presets](/docs/plugins/#presets) (a set of plugins) to load and use. | | `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) | -| `extends` | `null` | A path to an `.babelrc` file to extend | +| `resolveModuleSource` | `null` | Resolve a module source ie. `import "SOURCE";` to a custom value. Called as `resolveModuleSource(source, filename)`. | +| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used. | +| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. | +| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. | +| `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. | +| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. | +| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`. From d67b55e88fe561cd45080b1fec1db460a1b5f63f Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sun, 15 Jan 2017 19:45:07 +0100 Subject: [PATCH 050/222] fix: [skip ci] update supported environments --- doc/design/compiler-environment-support.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/design/compiler-environment-support.md b/doc/design/compiler-environment-support.md index 30b016cb15..1d5a867205 100644 --- a/doc/design/compiler-environment-support.md +++ b/doc/design/compiler-environment-support.md @@ -7,7 +7,7 @@ The Babel compiler is **only** supported in these environments: - Modern browsers such as Chrome, Firefox, Safari, Edge etc. - - Node 4 + - Node.js 4 and upper versions ## Unsupported environments @@ -17,7 +17,6 @@ to: - Rhino - Nashorn - Internet Explorer - - ... **NOTE:** If Babel works in any of the unsupported environments, it is purely coincidental and has no bearing on future compatibility. Use at your own risk. From 00a34b9c2e74f689f97306e48df58866d9638eec Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sun, 15 Jan 2017 21:48:47 +0100 Subject: [PATCH 051/222] fix: [skip ci] removed description (#5130) --- packages/babel-plugin-syntax-class-constructor-call/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/babel-plugin-syntax-class-constructor-call/README.md b/packages/babel-plugin-syntax-class-constructor-call/README.md index 6b3a3e804e..6a063d8d56 100644 --- a/packages/babel-plugin-syntax-class-constructor-call/README.md +++ b/packages/babel-plugin-syntax-class-constructor-call/README.md @@ -2,8 +2,6 @@ > Proposal Withdrawn: can be solved with decorators. -Allow parsing of call constructors. - ## Installation ```sh From 85b3aec747aefcdf480f2a34e487946aa041c275 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sun, 25 Dec 2016 22:10:10 -0500 Subject: [PATCH 052/222] Use native or lodash util module where full "lodash" is required --- packages/babel-cli/src/_babel-node.js | 5 ++-- packages/babel-cli/src/babel/dir.js | 9 ++++---- packages/babel-cli/src/babel/file.js | 9 ++++---- packages/babel-cli/src/babel/util.js | 4 ++-- packages/babel-cli/test/index.js | 23 +++++++++++-------- packages/babel-generator/test/index.js | 9 ++++---- packages/babel-helper-fixtures/src/index.js | 13 +++++++---- .../src/index.js | 19 ++++++++------- packages/babel-preset-es2015/test/traceur.js | 4 ++-- packages/babel-runtime/scripts/build-dist.js | 4 ++-- packages/babel-traverse/test/traverse.js | 10 ++++---- 11 files changed, 57 insertions(+), 52 deletions(-) diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 40471639bd..70bf813a48 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -7,7 +7,6 @@ import repl from "repl"; import { util } from "babel-core"; import * as babel from "babel-core"; import vm from "vm"; -import _ from "lodash"; import "babel-polyfill"; import register from "babel-register"; @@ -94,7 +93,7 @@ if (program.eval || program.print) { const result = _eval(code, global.__filename); if (program.print) { - const output = _.isString(result) ? result : inspect(result); + const output = typeof result === "string" ? result : inspect(result); process.stdout.write(output + "\n"); } } else { @@ -104,7 +103,7 @@ if (program.eval || program.print) { let i = 0; let ignoreNext = false; - _.each(args, function (arg, i2) { + args.forEach(function (arg, i2) { if (ignoreNext) { ignoreNext = false; return; diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index f097874a2a..076c6a43ee 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -3,7 +3,6 @@ const slash = require("slash"); const path = require("path"); const util = require("./util"); const fs = require("fs"); -const _ = require("lodash"); module.exports = function (commander, filenames) { function write(src, relative) { @@ -51,7 +50,7 @@ module.exports = function (commander, filenames) { if (stat.isDirectory(filename)) { const dirname = filename; - _.each(util.readdir(dirname), function (filename) { + util.readdir(dirname).forEach(function (filename) { const src = path.join(dirname, filename); handleFile(src, filename); }); @@ -61,19 +60,19 @@ module.exports = function (commander, filenames) { } if (!commander.skipInitialBuild) { - _.each(filenames, handle); + filenames.forEach(handle); } if (commander.watch) { const chokidar = util.requireChokidar(); - _.each(filenames, function (dirname) { + filenames.forEach(function (dirname) { const watcher = chokidar.watch(dirname, { persistent: true, ignoreInitial: true }); - _.each(["add", "change"], function (type) { + ["add", "change"].forEach(function (type) { watcher.on(type, function (filename) { const relative = path.relative(dirname, filename) || filename; try { diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index bb1f6e9494..150c5642e3 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -4,7 +4,6 @@ const slash = require("slash"); const path = require("path"); const util = require("./util"); const fs = require("fs"); -const _ = require("lodash"); module.exports = function (commander, filenames, opts) { if (commander.sourceMaps === "inline") { @@ -22,7 +21,7 @@ module.exports = function (commander, filenames, opts) { let code = ""; let offset = 0; - _.each(results, function (result) { + results.forEach(function (result) { code += result.code + "\n"; if (result.map) { @@ -107,14 +106,14 @@ module.exports = function (commander, filenames, opts) { const _filenames = []; results = []; - _.each(filenames, function (filename) { + filenames.forEach(function (filename) { if (!fs.existsSync(filename)) return; const stat = fs.statSync(filename); if (stat.isDirectory()) { const dirname = filename; - _.each(util.readdirFilter(filename), function (filename) { + util.readdirFilter(filename).forEach(function (filename) { _filenames.push(path.join(dirname, filename)); }); } else { @@ -122,7 +121,7 @@ module.exports = function (commander, filenames, opts) { } }); - _.each(_filenames, function (filename) { + _filenames.forEach(function (filename) { if (util.shouldIgnore(filename)) return; let sourceFilename = filename; diff --git a/packages/babel-cli/src/babel/util.js b/packages/babel-cli/src/babel/util.js index df8c72b3aa..7cdff17222 100644 --- a/packages/babel-cli/src/babel/util.js +++ b/packages/babel-cli/src/babel/util.js @@ -1,11 +1,11 @@ const commander = require("commander"); +const defaults = require("lodash/defaults"); const readdir = require("fs-readdir-recursive"); const index = require("./index"); const babel = require("babel-core"); const util = require("babel-core").util; const path = require("path"); const fs = require("fs"); -const _ = require("lodash"); export function chmod(src, dest) { fs.chmodSync(dest, fs.statSync(src).mode); @@ -34,7 +34,7 @@ export function log(msg) { } export function transform(filename, code, opts) { - opts = _.defaults(opts || {}, index.opts); + opts = defaults(opts || {}, index.opts); opts.filename = filename; const result = babel.transform(code, opts); diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 9a5d9f0594..1655a4e79b 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,13 +1,14 @@ +const includes = require("lodash/includes"); const readdir = require("fs-readdir-recursive"); const helper = require("babel-helper-fixtures"); const assert = require("assert"); const rimraf = require("rimraf"); const outputFileSync = require("output-file-sync"); const child = require("child_process"); +const merge = require("lodash/merge"); const path = require("path"); const chai = require("chai"); const fs = require("fs"); -const _ = require("lodash"); const fixtureLoc = path.join(__dirname, "fixtures"); const tmpLoc = path.join(__dirname, "tmp"); @@ -25,7 +26,7 @@ const pluginLocs = [ const readDir = function (loc) { const files = {}; if (fs.existsSync(loc)) { - _.each(readdir(loc), function (filename) { + readdir(loc).forEach(function (filename) { files[filename] = helper.readFile(path.join(loc, filename)); }); } @@ -33,7 +34,8 @@ const readDir = function (loc) { }; const saveInFiles = function (files) { - _.each(files, function (content, filename) { + Object.keys(files).forEach(function (filename) { + const content = files[filename]; outputFileSync(filename, content); }); }; @@ -44,7 +46,7 @@ const assertTest = function (stdout, stderr, opts) { if (opts.stderr) { if (opts.stderrContains) { - assert.ok(_.includes(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr)); + assert.ok(includes(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr)); } else { chai.expect(stderr).to.equal(expectStderr, "stderr didn't match"); } @@ -58,7 +60,7 @@ const assertTest = function (stdout, stderr, opts) { if (opts.stdout) { if (opts.stdoutContains) { - assert.ok(_.includes(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout)); + assert.ok(includes(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout)); } else { chai.expect(stdout).to.equal(expectStdout, "stdout didn't match"); } @@ -66,7 +68,8 @@ const assertTest = function (stdout, stderr, opts) { throw new Error("stdout:\n" + stdout); } - _.each(opts.outFiles, function (expect, filename) { + Object.keys(opts.outFiles, function (filename) { + const expect = opts.outFiles[filename]; const actual = helper.readFile(filename); chai.expect(actual).to.equal(expect, "out-file " + filename); }); @@ -134,12 +137,12 @@ const clear = function () { process.chdir(tmpLoc); }; -_.each(fs.readdirSync(fixtureLoc), function (binName) { +fs.readdirSync(fixtureLoc).forEach(function (binName) { if (binName[0] === ".") return; const suiteLoc = path.join(fixtureLoc, binName); describe("bin/" + binName, function () { - _.each(fs.readdirSync(suiteLoc), function (testName) { + fs.readdirSync(suiteLoc).forEach(function (testName) { if (testName[0] === ".") return; const testLoc = path.join(suiteLoc, testName); @@ -149,9 +152,9 @@ _.each(fs.readdirSync(fixtureLoc), function (binName) { }; const optionsLoc = path.join(testLoc, "options.json"); - if (fs.existsSync(optionsLoc)) _.merge(opts, require(optionsLoc)); + if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc)); - _.each(["stdout", "stdin", "stderr"], function (key) { + ["stdout", "stdin", "stderr"].forEach(function (key) { const loc = path.join(testLoc, key + ".txt"); if (fs.existsSync(loc)) { opts[key] = helper.readFile(loc); diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index cd84698ba5..cb4141d92b 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -5,17 +5,16 @@ const assert = require("assert"); const parse = require("babylon").parse; const chai = require("chai"); const t = require("babel-types"); -const _ = require("lodash"); const fs = require("fs"); const path = require("path"); describe("generation", function () { it("completeness", function () { - _.each(t.VISITOR_KEYS, function (keys, type) { + Object.keys(t.VISITOR_KEYS).forEach(function (type) { assert.ok(!!Printer.prototype[type], type + " should exist"); }); - _.each(Printer.prototype, function (fn, type) { + Object.keys(Printer.prototype).forEach(function (type) { if (!/[A-Z]/.test(type[0])) return; assert.ok(t.VISITOR_KEYS[type], type + " should not exist"); }); @@ -26,7 +25,7 @@ describe("generation", function () { "a.js": "function hi (msg) { console.log(msg); }\n", "b.js": "hi('hello');\n" }; - const parsed = _.keys(sources).reduce(function (_parsed, filename) { + const parsed = Object.keys(sources).reduce(function (_parsed, filename) { _parsed[filename] = parse(sources[filename], { sourceFilename: filename }); return _parsed; }, {}); @@ -297,7 +296,7 @@ const suites = require("babel-helper-fixtures").default(__dirname + "/fixtures") suites.forEach(function (testSuite) { describe("generation/" + testSuite.title, function () { - _.each(testSuite.tests, function (task) { + testSuite.tests.forEach(function (task) { it(task.title, !task.disabled && function () { const expect = task.expect; const actual = task.actual; diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index e7fcebf1d9..598937c51b 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -1,7 +1,10 @@ +import cloneDeep from "lodash/cloneDeep"; +import trimEnd from "lodash/trimEnd"; import resolve from "try-resolve"; +import clone from "lodash/clone"; +import merge from "lodash/merge"; import path from "path"; import fs from "fs"; -import _ from "lodash"; function humanize(val, noext) { if (noext) val = path.basename(val, path.extname(val)); @@ -58,7 +61,7 @@ export default function get(entryLoc): Array { if (shouldIgnore(suiteName)) continue; const suite = { - options: _.clone(rootOpts), + options: clone(rootOpts), tests: [], title: humanize(suiteName), filename: entryLoc + "/" + suiteName @@ -95,10 +98,10 @@ export default function get(entryLoc): Array { expectLocAlias += "on"; } - const taskOpts = _.cloneDeep(suite.options); + const taskOpts = cloneDeep(suite.options); const taskOptsLoc = resolve(taskDir + "/options"); - if (taskOptsLoc) _.merge(taskOpts, require(taskOptsLoc)); + if (taskOptsLoc) merge(taskOpts, require(taskOptsLoc)); const test = { optionsDir: taskOptsLoc ? path.dirname(taskOptsLoc) : null, @@ -162,7 +165,7 @@ export function multiple(entryLoc, ignore?: Array) { export function readFile(filename) { if (fs.existsSync(filename)) { - let file = _.trimEnd(fs.readFileSync(filename, "utf8")); + let file = trimEnd(fs.readFileSync(filename, "utf8")); file = file.replace(/\r\n/g, "\n"); return file; } else { diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 11220e77ff..39a8aa8d33 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -3,10 +3,13 @@ import { buildExternalHelpers } from "babel-core"; import getFixtures from "babel-helper-fixtures"; import sourceMap from "source-map"; import codeFrame from "babel-code-frame"; +import defaults from "lodash/defaults"; +import includes from "lodash/includes"; import * as helpers from "./helpers"; +import extend from "lodash/extend"; +import merge from "lodash/merge"; import assert from "assert"; import chai from "chai"; -import _ from "lodash"; import "babel-polyfill"; import fs from "fs"; import path from "path"; @@ -43,7 +46,7 @@ function run(task) { const optionsDir = task.optionsDir; function getOpts(self) { - const newOpts = _.merge({ + const newOpts = merge({ filename: self.loc, }, opts); @@ -98,7 +101,7 @@ function run(task) { if (task.sourceMappings) { const consumer = new sourceMap.SourceMapConsumer(result.map); - _.each(task.sourceMappings, function (mapping) { + task.sourceMappings.forEach(function (mapping) { const actual = mapping.original; const expect = consumer.originalPositionFor(mapping.generated); @@ -138,19 +141,19 @@ export default function ( const suites = getFixtures(fixturesLoc); for (const testSuite of suites) { - if (_.includes(suiteOpts.ignoreSuites, testSuite.title)) continue; + if (includes(suiteOpts.ignoreSuites, testSuite.title)) continue; describe(name + "/" + testSuite.title, function () { for (const task of testSuite.tests) { - if (_.includes(suiteOpts.ignoreTasks, task.title) || - _.includes(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) continue; + if (includes(suiteOpts.ignoreTasks, task.title) || + includes(suiteOpts.ignoreTasks, testSuite.title + "/" + task.title)) continue; it(task.title, !task.disabled && function () { function runTask() { run(task); } - _.defaults(task.options, { + defaults(task.options, { filenameRelative: task.expect.filename, sourceFileName: task.actual.filename, sourceMapTarget: task.expect.filename, @@ -159,7 +162,7 @@ export default function ( sourceMap: !!(task.sourceMappings || task.sourceMap), }); - _.extend(task.options, taskOpts); + extend(task.options, taskOpts); if (dynamicOpts) dynamicOpts(task.options, task); diff --git a/packages/babel-preset-es2015/test/traceur.js b/packages/babel-preset-es2015/test/traceur.js index da8c33beae..cce144becc 100644 --- a/packages/babel-preset-es2015/test/traceur.js +++ b/packages/babel-preset-es2015/test/traceur.js @@ -1,4 +1,4 @@ -const _ = require("lodash"); +const includes = require("lodash/includes"); require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/traceur", "traceur", { ignoreSuites: [ @@ -79,7 +79,7 @@ require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/tra }, { }, function (opts, task) { - if (_.includes(task.exec.loc, "module.js")) { + if (includes(task.exec.loc, "module.js")) { opts.plugins.push("transform-es2015-modules-commonjs"); } else { opts.sourceType = "script"; diff --git a/packages/babel-runtime/scripts/build-dist.js b/packages/babel-runtime/scripts/build-dist.js index 25799b68c6..2b06be4c79 100644 --- a/packages/babel-runtime/scripts/build-dist.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -1,7 +1,7 @@ var outputFile = require("output-file-sync"); +var kebabCase = require("lodash/kebabCase"); var each = require("lodash/each"); var fs = require("fs"); -var _ = require("lodash"); var coreDefinitions = require("babel-plugin-transform-runtime").definitions; @@ -122,7 +122,7 @@ each(helpers.list, function (helperName) { writeFile("helpers/" + helperName + ".js", buildHelper(helperName)); // compat - var helperAlias = _.kebabCase(helperName); + var helperAlias = kebabCase(helperName); var content = "module.exports = require(\"./" + helperName + ".js\");"; writeFile("helpers/_" + helperAlias + ".js", content); if (helperAlias !== helperName) writeFile("helpers/" + helperAlias + ".js", content); diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index ce87f9973f..3f62821ce5 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -1,7 +1,7 @@ -const traverse = require("../lib").default; -const assert = require("assert"); -const _ = require("lodash"); -const parse = require("babylon").parse; +const cloneDeep = require("lodash/cloneDeep"); +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; describe("traverse", function () { const code = ` @@ -17,7 +17,7 @@ describe("traverse", function () { type: "StringLiteral", value: "foo" }; - const ast2 = _.cloneDeep(program); + const ast2 = cloneDeep(program); traverse(ast2, { enter: function (path) { From 2bee765e6b1d7cce0d868d6fd5e93966d164d1c5 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sun, 25 Dec 2016 23:01:00 -0500 Subject: [PATCH 053/222] Replace lodash is* with equivalent typeof check --- packages/babel-core/src/api/node.js | 3 +-- packages/babel-core/src/util.js | 6 ++---- packages/babel-generator/src/generators/expressions.js | 3 +-- packages/babel-generator/src/node/whitespace.js | 3 +-- packages/babel-types/src/converters.js | 6 ++---- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/babel-core/src/api/node.js b/packages/babel-core/src/api/node.js index de1cfea682..3ff92f9d7f 100644 --- a/packages/babel-core/src/api/node.js +++ b/packages/babel-core/src/api/node.js @@ -1,4 +1,3 @@ -import isFunction from "lodash/isFunction"; import fs from "fs"; export { default as File } from "../transformation/file"; @@ -37,7 +36,7 @@ export const transform = pipeline.transform.bind(pipeline); export const transformFromAst = pipeline.transformFromAst.bind(pipeline); export function transformFile(filename: string, opts?: Object, callback: Function) { - if (isFunction(opts)) { + if (typeof opts === "function") { callback = opts; opts = {}; } diff --git a/packages/babel-core/src/util.js b/packages/babel-core/src/util.js index 97726e2640..8d3ba4142e 100644 --- a/packages/babel-core/src/util.js +++ b/packages/babel-core/src/util.js @@ -1,9 +1,7 @@ import escapeRegExp from "lodash/escapeRegExp"; import startsWith from "lodash/startsWith"; -import isBoolean from "lodash/isBoolean"; import minimatch from "minimatch"; import includes from "lodash/includes"; -import isString from "lodash/isString"; import isRegExp from "lodash/isRegExp"; import path from "path"; import slash from "slash"; @@ -80,8 +78,8 @@ export function regexify(val: any): RegExp { export function arrayify(val: any, mapFn?: Function): Array { if (!val) return []; - if (isBoolean(val)) return arrayify([val], mapFn); - if (isString(val)) return arrayify(list(val), mapFn); + if (typeof val === "boolean") return arrayify([val], mapFn); + if (typeof val === "string") return arrayify(list(val), mapFn); if (Array.isArray(val)) { if (mapFn) val = val.map(mapFn); diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index c4c581eddf..0cf5f2093e 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -1,6 +1,5 @@ /* eslint max-len: 0 */ -import isNumber from "lodash/isNumber"; import * as t from "babel-types"; import * as n from "../node"; @@ -202,7 +201,7 @@ export function MemberExpression(node: Object) { } let computed = node.computed; - if (t.isLiteral(node.property) && isNumber(node.property.value)) { + if (t.isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index 21320e33d3..c3d7c89a61 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -1,4 +1,3 @@ -import isBoolean from "lodash/isBoolean"; import each from "lodash/each"; import map from "lodash/map"; import * as t from "babel-types"; @@ -220,7 +219,7 @@ each({ SwitchStatement: true, TryStatement: true }, function (amounts, type) { - if (isBoolean(amounts)) { + if (typeof amounts === "boolean") { amounts = { after: amounts, before: amounts }; } diff --git a/packages/babel-types/src/converters.js b/packages/babel-types/src/converters.js index f350230ddf..d18ea38af7 100644 --- a/packages/babel-types/src/converters.js +++ b/packages/babel-types/src/converters.js @@ -1,7 +1,5 @@ import isPlainObject from "lodash/isPlainObject"; -import isNumber from "lodash/isNumber"; import isRegExp from "lodash/isRegExp"; -import isString from "lodash/isString"; import type { Scope } from "babel-traverse"; import * as t from "./index"; @@ -272,12 +270,12 @@ export function valueToNode(value: any): Object { } // strings - if (isString(value)) { + if (typeof value === "string") { return t.stringLiteral(value); } // numbers - if (isNumber(value)) { + if (typeof value === "number") { return t.numericLiteral(value); } From 658f13e030e1c526a44bfb1714982348dd3e9541 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sun, 25 Dec 2016 23:50:49 -0500 Subject: [PATCH 054/222] Replace uses of "lodash/each" with native equivalents --- packages/babel-cli/src/babel/index.js | 9 ++++--- .../src/tools/build-external-helpers.js | 3 +-- .../babel-generator/src/node/whitespace.js | 20 +++++++------- packages/babel-helper-define-map/src/index.js | 10 ++++--- packages/babel-register/src/node.js | 6 ++--- packages/babel-runtime/scripts/build-dist.js | 26 ++++++++++--------- packages/babel-types/src/index.js | 13 +++++----- 7 files changed, 45 insertions(+), 42 deletions(-) diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 0e1472d953..3f7f143987 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -9,10 +9,10 @@ const kebabCase = require("lodash/kebabCase"); const options = require("babel-core").options; const util = require("babel-core").util; const uniq = require("lodash/uniq"); -const each = require("lodash/each"); const glob = require("glob"); -each(options, function (option, key) { +Object.keys(options).forEach(function (key) { + const option = options[key]; if (option.hidden) return; let arg = kebabCase(key); @@ -69,7 +69,7 @@ let filenames = commander.args.reduce(function (globbed, input) { filenames = uniq(filenames); -each(filenames, function (filename) { +filenames.forEach(function (filename) { if (!fs.existsSync(filename)) { errors.push(filename + " doesn't exist"); } @@ -106,7 +106,8 @@ if (errors.length) { const opts = exports.opts = {}; -each(options, function (opt, key) { +Object.keys(options).forEach(function (key) { + const opt = options[key]; if (commander[key] !== undefined && commander[key] !== opt.default) { opts[key] = commander[key]; } diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index 237daf532c..b97d25c2d1 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -4,7 +4,6 @@ import * as helpers from "babel-helpers"; import generator from "babel-generator"; import * as messages from "babel-messages"; import template from "babel-template"; -import each from "lodash/each"; import * as t from "babel-types"; const buildUmdWrapper = template(` @@ -73,7 +72,7 @@ function buildVar(namespace, builder) { } function buildHelpers(body, namespace, whitelist) { - each(helpers.list, function (name) { + helpers.list.forEach(function (name) { if (whitelist && whitelist.indexOf(name) < 0) return; const key = t.identifier(name); diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index c3d7c89a61..1c47e594ec 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -1,4 +1,3 @@ -import each from "lodash/each"; import map from "lodash/map"; import * as t from "babel-types"; @@ -211,19 +210,18 @@ exports.list = { * Add whitespace tests for nodes and their aliases. */ -each({ - Function: true, - Class: true, - Loop: true, - LabeledStatement: true, - SwitchStatement: true, - TryStatement: true -}, function (amounts, type) { +[ + ["Function", true], + ["Class", true], + ["Loop", true], + ["LabeledStatement", true], + ["SwitchStatement", true], + ["TryStatement", true] +].forEach(function ([type, amounts]) { if (typeof amounts === "boolean") { amounts = { after: amounts, before: amounts }; } - - each([type].concat(t.FLIPPED_ALIAS_KEYS[type] || []), function (type) { + [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { exports.nodes[type] = function () { return amounts; }; diff --git a/packages/babel-helper-define-map/src/index.js b/packages/babel-helper-define-map/src/index.js index 09de4f9b58..05fa5ee886 100644 --- a/packages/babel-helper-define-map/src/index.js +++ b/packages/babel-helper-define-map/src/index.js @@ -1,7 +1,6 @@ /* eslint max-len: 0 */ import nameFunction from "babel-helper-function-name"; -import each from "lodash/each"; import has from "lodash/has"; import * as t from "babel-types"; @@ -101,12 +100,14 @@ export function toComputedObjectFromClass(obj: Object): Object { export function toClassObject(mutatorMap: Object): Object { const objExpr = t.objectExpression([]); - each(mutatorMap, function (map) { + Object.keys(mutatorMap).forEach(function (mutatorMapKey) { + const map = mutatorMap[mutatorMapKey]; const mapNode = t.objectExpression([]); const propNode = t.objectProperty(map._key, mapNode, map._computed); - each(map, function (node, key) { + Object.keys(map).forEach(function (key) { + let node = map[key]; if (key[0] === "_") return; const inheritNode = node; @@ -126,7 +127,8 @@ export function toClassObject(mutatorMap: Object): Object { } export function toDefineObject(mutatorMap: Object): Object { - each(mutatorMap, function (map) { + Object.keys(mutatorMap).forEach(function (key) { + const map = mutatorMap[key]; if (map.value) map.writable = t.booleanLiteral(true); map.configurable = t.booleanLiteral(true); map.enumerable = t.booleanLiteral(true); diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 19e052f500..87f92d7a24 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -3,7 +3,6 @@ import sourceMapSupport from "source-map-support"; import * as registerCache from "./cache"; import extend from "lodash/extend"; import * as babel from "babel-core"; -import each from "lodash/each"; import { util, OptionManager } from "babel-core"; import fs from "fs"; import path from "path"; @@ -112,7 +111,8 @@ function registerExtension(ext) { } function hookExtensions(_exts) { - each(oldHandlers, function (old, ext) { + Object.keys(oldHandlers).forEach(function (ext) { + const old = oldHandlers[ext]; if (old === undefined) { delete require.extensions[ext]; } else { @@ -122,7 +122,7 @@ function hookExtensions(_exts) { oldHandlers = {}; - each(_exts, function (ext) { + _exts.forEach(function (ext) { oldHandlers[ext] = require.extensions[ext]; registerExtension(ext); }); diff --git a/packages/babel-runtime/scripts/build-dist.js b/packages/babel-runtime/scripts/build-dist.js index 2b06be4c79..8933c6e135 100644 --- a/packages/babel-runtime/scripts/build-dist.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -1,34 +1,36 @@ var outputFile = require("output-file-sync"); var kebabCase = require("lodash/kebabCase"); -var each = require("lodash/each"); var fs = require("fs"); var coreDefinitions = require("babel-plugin-transform-runtime").definitions; var paths = ["is-iterable", "get-iterator"]; -each(coreDefinitions.builtins, function (path) { +Object.keys(coreDefinitions.builtins).forEach(function (key) { + const path = coreDefinitions.builtins[key]; paths.push(path); }); -each(coreDefinitions.methods, function (props) { - each(props, function (path) { +Object.keys(coreDefinitions.methods).forEach(function (key) { + const props = coreDefinitions.methods[key]; + Object.keys(props).forEach(function (key2) { + const path = props[key2]; paths.push(path); }); }); -each(paths, function (path) { +paths.forEach(function (path) { writeFile("core-js/" + path + ".js", defaultify('require("core-js/library/fn/' + path + '")')); }); // Should be removed in the next major release: -var legacy = { - "string/pad-left": "string/pad-start", - "string/pad-right": "string/pad-end" -}; +var legacy = [ + ["string/pad-left", "string/pad-start"], + ["string/pad-right", "string/pad-end"] +]; -each(legacy, function (value, key) { - writeFile("core-js/" + key + ".js", defaultify('require("core-js/library/fn/' + value + '")')); +legacy.forEach(function([a, b]) { + writeFile("core-js/" + a + ".js", defaultify('require("core-js/library/fn/' + b + '")')); }); var helpers = require("babel-helpers"); @@ -118,7 +120,7 @@ function buildHelper(helperName) { }).code; } -each(helpers.list, function (helperName) { +helpers.list.forEach(function (helperName) { writeFile("helpers/" + helperName + ".js", buildHelper(helperName)); // compat diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index 09cbe39ad1..54edc7d981 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -1,7 +1,6 @@ import toFastProperties from "to-fast-properties"; import compact from "lodash/compact"; import loClone from "lodash/clone"; -import each from "lodash/each"; import uniq from "lodash/uniq"; const t = exports; @@ -72,8 +71,8 @@ for (const type in t.VISITOR_KEYS) { t.FLIPPED_ALIAS_KEYS = {}; -each(t.ALIAS_KEYS, function (aliases, type) { - each(aliases, function (alias) { +Object.keys(t.ALIAS_KEYS).forEach(function (type) { + t.ALIAS_KEYS[type].forEach(function (alias) { const types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || []; types.push(type); }); @@ -83,8 +82,8 @@ each(t.ALIAS_KEYS, function (aliases, type) { * Registers `is[Alias]` and `assert[Alias]` functions for all aliases. */ -each(t.FLIPPED_ALIAS_KEYS, function (types, type) { - t[type.toUpperCase() + "_TYPES"] = types; +Object.keys(t.FLIPPED_ALIAS_KEYS).forEach(function (type) { + t[type.toUpperCase() + "_TYPES"] = t.FLIPPED_ALIAS_KEYS[type]; registerType(type); }); @@ -139,7 +138,9 @@ export function isType(nodeType: string, targetType: string): boolean { * Description */ -each(t.BUILDER_KEYS, function (keys, type) { +Object.keys(t.BUILDER_KEYS).forEach(function (type) { + const keys = t.BUILDER_KEYS[type]; + function builder() { if (arguments.length > keys.length) { throw new Error( From e18dc7a6d3535dbcbf6e320fb74340470fef9da7 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 15 Jan 2017 13:46:41 -0800 Subject: [PATCH 055/222] Avoid destructuring in untranspiled script. --- packages/babel-runtime/scripts/build-dist.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/babel-runtime/scripts/build-dist.js b/packages/babel-runtime/scripts/build-dist.js index 8933c6e135..4685c13abd 100644 --- a/packages/babel-runtime/scripts/build-dist.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -29,7 +29,9 @@ var legacy = [ ["string/pad-right", "string/pad-end"] ]; -legacy.forEach(function([a, b]) { +legacy.forEach(function(pair) { + const a = pair[0]; + const b = pair[1]; writeFile("core-js/" + a + ".js", defaultify('require("core-js/library/fn/' + b + '")')); }); From 4a1965511f3bb91ce44f8936fd7324781ebcd3bd Mon Sep 17 00:00:00 2001 From: Christophe Hurpeau Date: Tue, 10 Jan 2017 22:31:43 +0100 Subject: [PATCH 056/222] fix: plugin-transform-object-rest-spread param with default value --- .../src/index.js | 19 ++++++++++++------- .../fixtures/object-rest/parameters/actual.js | 1 + .../object-rest/parameters/expected.js | 4 ++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index b705529236..4e2be6de80 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -42,19 +42,23 @@ export default function ({ types: t }) { ]; } - function replaceRestProperty(paramsPath, i, numParams) { - if (paramsPath.isObjectPattern() && hasRestProperty(paramsPath)) { - const parentPath = paramsPath.parentPath; + function replaceRestProperty(parentPath, paramPath, i, numParams) { + if (paramPath.isAssignmentPattern()) { + replaceRestProperty(parentPath, paramPath.get("left"), i, numParams); + return; + } + + if (paramPath.isObjectPattern() && hasRestProperty(paramPath)) { const uid = parentPath.scope.generateUidIdentifier("ref"); const declar = t.variableDeclaration("let", [ - t.variableDeclarator(paramsPath.node, uid) + t.variableDeclarator(paramPath.node, uid) ]); declar._blockHoist = i ? numParams - i : 1; parentPath.ensureBlock(); parentPath.get("body").unshiftContainer("body", declar); - paramsPath.replaceWith(uid); + paramPath.replaceWith(uid); } } @@ -67,7 +71,7 @@ export default function ({ types: t }) { Function(path) { const params = path.get("params"); for (let i = 0; i < params.length; i++) { - replaceRestProperty(params[i], i, params.length); + replaceRestProperty(params[i].parentPath, params[i], i, params.length); } }, // adapted from transform-es2015-destructuring/src/index.js#pushObjectRest @@ -141,7 +145,8 @@ export default function ({ types: t }) { }, // try {} catch ({a, ...b}) {} CatchClause(path) { - replaceRestProperty(path.get("param")); + const paramPath = path.get("param"); + replaceRestProperty(paramPath.parentPath, paramPath); }, // ({a, ...b} = c); AssignmentExpression(path, file) { diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/actual.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/actual.js index a3beccb8a4..553131f613 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/actual.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/actual.js @@ -4,6 +4,7 @@ function a3({a2, b2, ...c2}) {} function a4({a3, ...c3}, {a5, ...c5}) {} function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {} function a6({a3, b2: { ba1, ...ba2 } }) {} +function a7({a1 = 1, ...b1} = {}) {} // Unchanged function b(a) {} function b2(a, ...b) {} diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js index a3ec9786f7..71c7876f13 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js @@ -24,6 +24,10 @@ function a6(_ref7) { let { a3, b2: { ba1 } } = _ref7; let ba2 = babelHelpers.objectWithoutProperties(_ref7.b2, ["ba1"]); } +function a7(_ref8 = {}) { + let { a1 = 1 } = _ref8; + let b1 = babelHelpers.objectWithoutProperties(_ref8, ["a1"]); +} // Unchanged function b(a) {} function b2(a, ...b) {} From 20c9dca79879be5709f5f259b2651e5a117ef545 Mon Sep 17 00:00:00 2001 From: Mark Wubben Date: Sun, 15 Jan 2017 22:04:23 +0000 Subject: [PATCH 057/222] Document babelrc option (#5101) The core package accepts a babelrc option, which if set to false stops the transforms from using .babelrc and .babelignore files. Document this option and remove the --no-babelrc CLI flag, referring to the CLI documentation instead. [skip ci] --- packages/babel-core/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/README.md b/packages/babel-core/README.md index b4eb1c621b..c4b0f93016 100644 --- a/packages/babel-core/README.md +++ b/packages/babel-core/README.md @@ -89,6 +89,7 @@ Following is a table of the options you can use: | `ast` | `true` | Include the AST in the returned object | | `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code. | | `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code. | +| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/usage/cli/#babel-ignoring-babelrc). | | `code` | `true` | Enable code generation | | `comments` | `true` | Output comments in generated output. | | `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB. | @@ -105,7 +106,6 @@ Following is a table of the options you can use: | `moduleId` | `null` | Specify a custom name for module ids. | | `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) | | `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | -| `no-babelrc` | [CLI flag](http://babeljs.io/docs/usage/cli/#ignoring-babelrc) | Specify whether or not to use .babelrc and .babelignore files. Only available when using the CLI. | | `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim. | | `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, babylon | | `plugins` | `[]` | List of [plugins](/docs/plugins/) to load and use. | From c5fb56e66c51e0530d3e04607f4eec8d38ccea44 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 15 Jan 2017 14:45:48 -0800 Subject: [PATCH 058/222] Bump out chokidar dependency for the new awaitWriteFinish option. --- packages/babel-cli/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 1fbe3bebd8..e22d9742a7 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -23,7 +23,7 @@ "v8flags": "^2.0.10" }, "optionalDependencies": { - "chokidar": "^1.0.0" + "chokidar": "^1.6.1" }, "devDependencies": { "babel-helper-fixtures": "^6.18.0" From e863790e7e09aa346202b2039baddf449661fe7c Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 15 Jan 2017 15:29:26 -0800 Subject: [PATCH 059/222] Fix linting error from merged PR. --- packages/babel-cli/src/babel/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 6f5cadb06c..e143be1a39 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -51,7 +51,7 @@ module.exports = function (commander, filenames, opts) { } }); - offset = code.split("\n").length -1; + offset = code.split("\n").length - 1; } }); From b315fc613519cd8c2397d5ad47da24498b6bc27e Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Mon, 16 Jan 2017 15:35:01 +0200 Subject: [PATCH 060/222] [skip ci] Add babel-preset-env to maintained list. (#5136) --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 00afe123e6..befcea7094 100644 --- a/README.md +++ b/README.md @@ -124,8 +124,8 @@ Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/ - [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/). - [`babel-types`](/packages/babel-types) is used to validate, build, change AST nodes. - [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/). -- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/) -- [`babel-register`](/packages/babel-register) is a way to automatically compile files with babel on the fly by binding to node's require. Check out the [docs](http://babeljs.io/docs/usage/require/) +- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/). +- [`babel-register`](/packages/babel-register) is a way to automatically compile files with babel on the fly by binding to node's require. Check out the [docs](http://babeljs.io/docs/usage/require/). - [`babel-template`](/packages/babel-template) is a helper function to make AST nodes. Instead you can pass a string representing the code you want to create rather than tediously building them using `babel-types`. - [`babel-helpers`](/packages/babel-helpers) is a set of premade `babel-template` functions that are used in some babel plugins. - [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that prints the source code and points to error locations. @@ -149,12 +149,14 @@ There are a few presets that we maintain officially. | [`babel-preset-stage-2`](/packages/babel-preset-stage-2) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-2.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-2) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-2)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-2) | | [`babel-preset-stage-3`](/packages/babel-preset-stage-3) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-3.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-3) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-3)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-3) | | [`babel-preset-react`](/packages/babel-preset-react) | [![npm](https://img.shields.io/npm/v/babel-preset-react.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-react) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-react)](https://david-dm.org/babel/babel?path=packages/babel-preset-react) | +| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env)](https://david-dm.org/babel/babel-preset-env) | We maintain: -- a preset for each yearly release of ECMAScript (Javascript) starting from ES6/ES2015 -- a preset for react (JSX/Flow) +- a preset for each yearly release of ECMAScript (Javascript) starting from ES6/ES2015. +- a preset for react (JSX/Flow). - a preset for each [stage (0-3)](http://babeljs.io/docs/plugins/#stage-x-experimental-presets) of the [TC-39 Process](https://tc39.github.io/process-document/) for ECMAScript proposals. +- a preset that can automatically determine plugins and polyfills you need based on your supported environments. > You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset) From 292c3ca2061c6b86a09622d6552621eb57ec3b38 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Mon, 16 Jan 2017 19:25:04 +0300 Subject: [PATCH 061/222] Refactor test packages to use ES modules instead of CJS (#5138) --- packages/babel-code-frame/test/index.js | 6 +-- packages/babel-core/test/api.js | 12 +++--- packages/babel-core/test/browserify.js | 8 ++-- packages/babel-core/test/config-chain.js | 6 +-- packages/babel-core/test/evaluation.js | 6 +-- .../test/get-possible-plugin-names.js | 4 +- .../test/get-possible-preset-names.js | 4 +- packages/babel-core/test/path.js | 6 +-- packages/babel-core/test/plugins.js | 4 +- packages/babel-core/test/resolution.js | 10 ++--- packages/babel-core/test/transformation.js | 4 +- packages/babel-core/test/util.js | 6 +-- packages/babel-generator/test/index.js | 39 ++++++++++--------- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../src/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../src/index.js | 7 +++- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- .../test/index.js | 4 +- packages/babel-preset-es2015/test/esnext.js | 4 +- packages/babel-preset-es2015/test/index.js | 4 +- .../test/preset-options.js | 4 +- packages/babel-preset-es2015/test/traceur.js | 5 ++- packages/babel-preset-latest/test/index.js | 4 +- packages/babel-template/test/index.js | 6 +-- packages/babel-types/test/cloning.js | 6 +-- packages/babel-types/test/validators.js | 6 +-- 75 files changed, 247 insertions(+), 126 deletions(-) diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index b00b88386d..e11f0c8a7f 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -1,6 +1,6 @@ -const assert = require("assert"); -const chalk = require("chalk"); -const codeFrame = require(".."); +import assert from "assert"; +import chalk from "chalk"; +import codeFrame from ".."; describe("babel-code-frame", function () { it("basic usage", function () { diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 70823258e5..6342792020 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -1,9 +1,9 @@ -const babel = require("../lib/api/node"); -const buildExternalHelpers = require("../lib/tools/build-external-helpers"); -const sourceMap = require("source-map"); -const assert = require("assert"); -const Plugin = require("../lib/transformation/plugin"); -const generator = require("babel-generator").default; +import * as babel from "../lib/api/node"; +import buildExternalHelpers from "../lib/tools/build-external-helpers"; +import sourceMap from "source-map"; +import assert from "assert"; +import Plugin from "../lib/transformation/plugin"; +import generator from "babel-generator"; function assertIgnored(result) { assert.ok(result.ignored); diff --git a/packages/babel-core/test/browserify.js b/packages/babel-core/test/browserify.js index 730ace945a..e8e8f27c82 100644 --- a/packages/babel-core/test/browserify.js +++ b/packages/babel-core/test/browserify.js @@ -1,7 +1,7 @@ -const browserify = require("browserify"); -const assert = require("assert"); -const path = require("path"); -const vm = require("vm"); +import browserify from "browserify"; +import assert from "assert"; +import path from "path"; +import vm from "vm"; describe("browserify", function() { it("babel/register may be used without breaking browserify", function(done) { diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 95d17eeb15..71df017004 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -1,6 +1,6 @@ -const assert = require("assert"); -const path = require("path"); -const buildConfigChain = require("../lib/transformation/file/options/build-config-chain"); +import assert from "assert"; +import path from "path"; +import buildConfigChain from "../lib/transformation/file/options/build-config-chain"; function fixture() { const args = [__dirname, "fixtures", "config"]; diff --git a/packages/babel-core/test/evaluation.js b/packages/babel-core/test/evaluation.js index 4378bb4176..b0741a5149 100644 --- a/packages/babel-core/test/evaluation.js +++ b/packages/babel-core/test/evaluation.js @@ -1,6 +1,6 @@ -const traverse = require("babel-traverse").default; -const assert = require("assert"); -const parse = require("babylon").parse; +import traverse from "babel-traverse"; +import assert from "assert"; +import { parse } from "babylon"; describe("evaluation", function () { function addTest(code, type, value, notConfident) { diff --git a/packages/babel-core/test/get-possible-plugin-names.js b/packages/babel-core/test/get-possible-plugin-names.js index d9d730bd6c..7ce8644769 100644 --- a/packages/babel-core/test/get-possible-plugin-names.js +++ b/packages/babel-core/test/get-possible-plugin-names.js @@ -1,5 +1,5 @@ -const assert = require("assert"); -const getPossiblePluginNames = require("../lib/helpers/get-possible-plugin-names"); +import assert from "assert"; +import getPossiblePluginNames from "../lib/helpers/get-possible-plugin-names"; describe("getPossiblePluginNames", function () { it("adds the babel-plugin prefix", function() { diff --git a/packages/babel-core/test/get-possible-preset-names.js b/packages/babel-core/test/get-possible-preset-names.js index 64de8897b8..df32d037ee 100644 --- a/packages/babel-core/test/get-possible-preset-names.js +++ b/packages/babel-core/test/get-possible-preset-names.js @@ -1,5 +1,5 @@ -const assert = require("assert"); -const getPossiblePresetNames = require("../lib/helpers/get-possible-preset-names"); +import assert from "assert"; +import getPossiblePresetNames from "../lib/helpers/get-possible-preset-names"; describe("getPossiblePresetNames", function () { it("adds the babel-preset prefix", function() { diff --git a/packages/babel-core/test/path.js b/packages/babel-core/test/path.js index e60c68c9f8..72642c6480 100644 --- a/packages/babel-core/test/path.js +++ b/packages/babel-core/test/path.js @@ -1,6 +1,6 @@ -const transform = require("../lib/api/node").transform; -const Plugin = require("../lib/transformation/plugin"); -const chai = require("chai"); +import { transform } from "../lib/api/node"; +import Plugin from "../lib/transformation/plugin"; +import chai from "chai"; describe("traversal path", function () { it("replaceWithSourceString", function () { diff --git a/packages/babel-core/test/plugins.js b/packages/babel-core/test/plugins.js index 1ca0caf9ca..0f1e3245ad 100644 --- a/packages/babel-core/test/plugins.js +++ b/packages/babel-core/test/plugins.js @@ -1 +1,3 @@ -require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/plugins", "plugins"); +import runner from "babel-helper-transform-fixture-test-runner"; + +runner(`${__dirname}/fixtures/plugins`, "plugins"); diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index 622ddac038..21d945706d 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -1,8 +1,8 @@ -const assert = require("assert"); -const async = require("async"); -const babel = require("../lib/api/node"); -const fs = require("fs"); -const path = require("path"); +import assert from "assert"; +import async from "async"; +import * as babel from "../lib/api/node"; +import fs from "fs"; +import path from "path"; // Test that plugins & presets are resolved relative to `filename`. describe("addon resolution", function () { diff --git a/packages/babel-core/test/transformation.js b/packages/babel-core/test/transformation.js index 1bacd85623..6b663895d6 100644 --- a/packages/babel-core/test/transformation.js +++ b/packages/babel-core/test/transformation.js @@ -1 +1,3 @@ -require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/transformation", "transformation"); +import runner from "babel-helper-transform-fixture-test-runner"; + +runner(`${__dirname}/fixtures/transformation`, "transformation"); diff --git a/packages/babel-core/test/util.js b/packages/babel-core/test/util.js index 1e879f41a5..5d84ad41f6 100644 --- a/packages/babel-core/test/util.js +++ b/packages/babel-core/test/util.js @@ -1,6 +1,6 @@ -const assert = require("assert"); -const util = require("../lib/util"); -const t = require("babel-types"); +import assert from "assert"; +import * as util from "../lib/util"; +import * as t from "babel-types"; describe("util", function () { it("canCompile", function () { diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index cb4141d92b..813bd57f59 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -1,12 +1,13 @@ -const Whitespace = require("../lib/whitespace"); -const Printer = require("../lib/printer"); -const generate = require("../lib"); -const assert = require("assert"); -const parse = require("babylon").parse; -const chai = require("chai"); -const t = require("babel-types"); -const fs = require("fs"); -const path = require("path"); +import Whitespace from "../lib/whitespace"; +import Printer from "../lib/printer"; +import generate from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; +import chai from "chai"; +import * as t from "babel-types"; +import fs from "fs"; +import path from "path"; +import fixtures from "babel-helper-fixtures"; describe("generation", function () { it("completeness", function () { @@ -39,7 +40,7 @@ describe("generation", function () { } }; - const generated = generate.default(combinedAst, { sourceMaps: true }, sources); + const generated = generate(combinedAst, { sourceMaps: true }, sources); chai.expect(generated.map).to.deep.equal({ version: 3, @@ -140,7 +141,7 @@ describe("generation", function () { id2.name += "2"; id2.loc.identiferName = "bar"; - const generated = generate.default(ast, { + const generated = generate(ast, { filename: "inline", sourceFileName: "inline", sourceMaps: true @@ -191,7 +192,7 @@ describe("generation", function () { const code = "function hi (msg) { console.log(msg); }\n"; const ast = parse(code, { filename: "a.js" }).program; - const generated = generate.default(ast, { + const generated = generate(ast, { sourceFileName: "a.js", sourceMaps: true, }); @@ -209,7 +210,7 @@ describe("programmatic generation", function() { it("numeric member expression", function() { // Should not generate `0.foo` const mem = t.memberExpression(t.numericLiteral(60702), t.identifier("foo")); - new Function(generate.default(mem).code); + new Function(generate(mem).code); }); it("nested if statements needs block", function() { @@ -225,7 +226,7 @@ describe("programmatic generation", function() { t.expressionStatement(t.stringLiteral("alt")) ); - const ast = parse(generate.default(ifStatement).code); + const ast = parse(generate(ifStatement).code); assert.equal(ast.program.body[0].consequent.type, "BlockStatement"); }); @@ -235,7 +236,7 @@ describe("programmatic generation", function() { [t.directive(t.directiveLiteral("use strict"))] ); - const output = generate.default(blockStatement).code; + const output = generate(blockStatement).code; assert.equal(output, [ "{", " \"use strict\";", @@ -255,7 +256,7 @@ describe("programmatic generation", function() { null ); - const output = generate.default(objectStatement).code; + const output = generate(objectStatement).code; assert.equal(output, [ "{", " bar: string;", @@ -275,7 +276,7 @@ describe("programmatic generation", function() { ] ); - const output = generate.default(objectStatement).code; + const output = generate(objectStatement).code; assert.equal(output, [ "{", @@ -292,7 +293,7 @@ describe("whitespace", function () { }); }); -const suites = require("babel-helper-fixtures").default(__dirname + "/fixtures"); +const suites = fixtures(`${__dirname}/fixtures`); suites.forEach(function (testSuite) { describe("generation/" + testSuite.title, function () { @@ -309,7 +310,7 @@ suites.forEach(function (testSuite) { strictMode: false, sourceType: "module", }); - const result = generate.default(actualAst, task.options, actualCode); + const result = generate(actualAst, task.options, actualCode); if (!expect.code && result.code && fs.statSync(path.dirname(expect.loc)).isDirectory() && !process.env.CI) { console.log(`New test file created: ${expect.loc}`); diff --git a/packages/babel-plugin-check-es2015-constants/test/index.js b/packages/babel-plugin-check-es2015-constants/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-check-es2015-constants/test/index.js +++ b/packages/babel-plugin-check-es2015-constants/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-syntax-trailing-function-commas/test/index.js b/packages/babel-plugin-syntax-trailing-function-commas/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/test/index.js +++ b/packages/babel-plugin-syntax-trailing-function-commas/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-async-generator-functions/test/index.js b/packages/babel-plugin-transform-async-generator-functions/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-async-generator-functions/test/index.js +++ b/packages/babel-plugin-transform-async-generator-functions/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-async-to-generator/test/index.js b/packages/babel-plugin-transform-async-to-generator/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-async-to-generator/test/index.js +++ b/packages/babel-plugin-transform-async-to-generator/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-async-to-module-method/test/index.js b/packages/babel-plugin-transform-async-to-module-method/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-async-to-module-method/test/index.js +++ b/packages/babel-plugin-transform-async-to-module-method/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-class-constructor-call/test/index.js b/packages/babel-plugin-transform-class-constructor-call/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-class-constructor-call/test/index.js +++ b/packages/babel-plugin-transform-class-constructor-call/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-class-properties/test/index.js b/packages/babel-plugin-transform-class-properties/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-class-properties/test/index.js +++ b/packages/babel-plugin-transform-class-properties/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-decorators/test/index.js b/packages/babel-plugin-transform-decorators/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-decorators/test/index.js +++ b/packages/babel-plugin-transform-decorators/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-do-expressions/test/index.js b/packages/babel-plugin-transform-do-expressions/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-do-expressions/test/index.js +++ b/packages/babel-plugin-transform-do-expressions/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/test/index.js b/packages/babel-plugin-transform-es2015-arrow-functions/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/test/index.js +++ b/packages/babel-plugin-transform-es2015-arrow-functions/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/index.js b/packages/babel-plugin-transform-es2015-block-scoping/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-classes/test/index.js b/packages/babel-plugin-transform-es2015-classes/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-classes/test/index.js +++ b/packages/babel-plugin-transform-es2015-classes/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-computed-properties/test/index.js b/packages/babel-plugin-transform-es2015-computed-properties/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/test/index.js +++ b/packages/babel-plugin-transform-es2015-computed-properties/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-destructuring/test/index.js b/packages/babel-plugin-transform-es2015-destructuring/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/test/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/test/index.js b/packages/babel-plugin-transform-es2015-duplicate-keys/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/test/index.js +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-for-of/test/index.js b/packages/babel-plugin-transform-es2015-for-of/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-for-of/test/index.js +++ b/packages/babel-plugin-transform-es2015-for-of/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-function-name/test/index.js b/packages/babel-plugin-transform-es2015-function-name/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-function-name/test/index.js +++ b/packages/babel-plugin-transform-es2015-function-name/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-instanceof/test/index.js b/packages/babel-plugin-transform-es2015-instanceof/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/test/index.js +++ b/packages/babel-plugin-transform-es2015-instanceof/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/index.js b/packages/babel-plugin-transform-es2015-modules-amd/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/test/index.js +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/test/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/test/index.js b/packages/babel-plugin-transform-es2015-modules-systemjs/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/test/index.js +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-modules-umd/test/index.js b/packages/babel-plugin-transform-es2015-modules-umd/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/test/index.js +++ b/packages/babel-plugin-transform-es2015-modules-umd/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-object-super/test/index.js b/packages/babel-plugin-transform-es2015-object-super/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-object-super/test/index.js +++ b/packages/babel-plugin-transform-es2015-object-super/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-parameters/test/index.js b/packages/babel-plugin-transform-es2015-parameters/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-parameters/test/index.js +++ b/packages/babel-plugin-transform-es2015-parameters/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/test/index.js b/packages/babel-plugin-transform-es2015-shorthand-properties/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/test/index.js +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-spread/test/index.js b/packages/babel-plugin-transform-es2015-spread/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-spread/test/index.js +++ b/packages/babel-plugin-transform-es2015-spread/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/test/index.js b/packages/babel-plugin-transform-es2015-sticky-regex/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/test/index.js +++ b/packages/babel-plugin-transform-es2015-sticky-regex/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-template-literals/test/index.js b/packages/babel-plugin-transform-es2015-template-literals/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/test/index.js +++ b/packages/babel-plugin-transform-es2015-template-literals/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/test/index.js b/packages/babel-plugin-transform-es2015-typeof-symbol/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/test/index.js +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/test/index.js b/packages/babel-plugin-transform-es2015-unicode-regex/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/test/index.js +++ b/packages/babel-plugin-transform-es2015-unicode-regex/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/test/index.js b/packages/babel-plugin-transform-es3-member-expression-literals/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/test/index.js +++ b/packages/babel-plugin-transform-es3-member-expression-literals/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es3-property-literals/test/index.js b/packages/babel-plugin-transform-es3-property-literals/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es3-property-literals/test/index.js +++ b/packages/babel-plugin-transform-es3-property-literals/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-es5-property-mutators/test/index.js b/packages/babel-plugin-transform-es5-property-mutators/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/test/index.js +++ b/packages/babel-plugin-transform-es5-property-mutators/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-exponentiation-operator/test/index.js b/packages/babel-plugin-transform-exponentiation-operator/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/test/index.js +++ b/packages/babel-plugin-transform-exponentiation-operator/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-export-extensions/test/index.js b/packages/babel-plugin-transform-export-extensions/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-export-extensions/test/index.js +++ b/packages/babel-plugin-transform-export-extensions/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-flow-comments/test/index.js b/packages/babel-plugin-transform-flow-comments/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-flow-comments/test/index.js +++ b/packages/babel-plugin-transform-flow-comments/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-flow-strip-types/test/index.js b/packages/babel-plugin-transform-flow-strip-types/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-flow-strip-types/test/index.js +++ b/packages/babel-plugin-transform-flow-strip-types/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-function-bind/test/index.js b/packages/babel-plugin-transform-function-bind/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-function-bind/test/index.js +++ b/packages/babel-plugin-transform-function-bind/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-jscript/test/index.js b/packages/babel-plugin-transform-jscript/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-jscript/test/index.js +++ b/packages/babel-plugin-transform-jscript/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/index.js b/packages/babel-plugin-transform-object-rest-spread/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-proto-to-assign/test/index.js b/packages/babel-plugin-transform-proto-to-assign/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-proto-to-assign/test/index.js +++ b/packages/babel-plugin-transform-proto-to-assign/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-constant-elements/test/index.js b/packages/babel-plugin-transform-react-constant-elements/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-display-name/test/index.js b/packages/babel-plugin-transform-react-display-name/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-display-name/test/index.js +++ b/packages/babel-plugin-transform-react-display-name/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-inline-elements/test/index.js b/packages/babel-plugin-transform-react-inline-elements/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-inline-elements/test/index.js +++ b/packages/babel-plugin-transform-react-inline-elements/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-jsx-compat/src/index.js b/packages/babel-plugin-transform-react-jsx-compat/src/index.js index edb9ee5a45..ba591ecaf5 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-compat/src/index.js @@ -1,10 +1,12 @@ +import helper from "babel-helper-builder-react-jsx"; + export default function ({ types: t }) { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("jsx"); }, - visitor: require("babel-helper-builder-react-jsx")({ + visitor: helper({ pre(state) { state.callee = state.tagExpr; }, diff --git a/packages/babel-plugin-transform-react-jsx-compat/test/index.js b/packages/babel-plugin-transform-react-jsx-compat/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/test/index.js +++ b/packages/babel-plugin-transform-react-jsx-compat/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-jsx-self/test/index.js b/packages/babel-plugin-transform-react-jsx-self/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-jsx-self/test/index.js +++ b/packages/babel-plugin-transform-react-jsx-self/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-jsx-source/test/index.js b/packages/babel-plugin-transform-react-jsx-source/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-jsx-source/test/index.js +++ b/packages/babel-plugin-transform-react-jsx-source/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index 12e127c909..65758283c0 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -1,9 +1,12 @@ /* eslint max-len: 0 */ +import jsx from "babel-plugin-syntax-jsx"; +import helper from "babel-helper-builder-react-jsx"; + export default function ({ types: t }) { const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/; - const visitor = require("babel-helper-builder-react-jsx")({ + const visitor = helper({ pre(state) { const tagName = state.tagName; const args = state.args; @@ -44,7 +47,7 @@ export default function ({ types: t }) { }; return { - inherits: require("babel-plugin-syntax-jsx"), + inherits: jsx, visitor }; } diff --git a/packages/babel-plugin-transform-react-jsx/test/index.js b/packages/babel-plugin-transform-react-jsx/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-react-jsx/test/index.js +++ b/packages/babel-plugin-transform-react-jsx/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-regenerator/test/index.js b/packages/babel-plugin-transform-regenerator/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-regenerator/test/index.js +++ b/packages/babel-plugin-transform-regenerator/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-runtime/test/index.js b/packages/babel-plugin-transform-runtime/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-runtime/test/index.js +++ b/packages/babel-plugin-transform-runtime/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-transform-strict-mode/test/index.js b/packages/babel-plugin-transform-strict-mode/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-transform-strict-mode/test/index.js +++ b/packages/babel-plugin-transform-strict-mode/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-plugin-undeclared-variables-check/test/index.js b/packages/babel-plugin-undeclared-variables-check/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-plugin-undeclared-variables-check/test/index.js +++ b/packages/babel-plugin-undeclared-variables-check/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-preset-es2015/test/esnext.js b/packages/babel-preset-es2015/test/esnext.js index 95896efa51..97f8aaad47 100644 --- a/packages/babel-preset-es2015/test/esnext.js +++ b/packages/babel-preset-es2015/test/esnext.js @@ -1 +1,3 @@ -require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/esnext", "esnext"); +import runner from "babel-helper-transform-fixture-test-runner"; + +runner(`${__dirname}/fixtures/esnext`, "esnext"); diff --git a/packages/babel-preset-es2015/test/index.js b/packages/babel-preset-es2015/test/index.js index 8047319eb6..b04436210b 100644 --- a/packages/babel-preset-es2015/test/index.js +++ b/packages/babel-preset-es2015/test/index.js @@ -1,5 +1,5 @@ -const es2015 = require("../lib"); -const expect = require("chai").expect; +import es2015 from "../lib"; +import { expect } from "chai"; describe("es2015 preset", function () { it("exposes an object", function () { diff --git a/packages/babel-preset-es2015/test/preset-options.js b/packages/babel-preset-es2015/test/preset-options.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-preset-es2015/test/preset-options.js +++ b/packages/babel-preset-es2015/test/preset-options.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-preset-es2015/test/traceur.js b/packages/babel-preset-es2015/test/traceur.js index cce144becc..bac5885f86 100644 --- a/packages/babel-preset-es2015/test/traceur.js +++ b/packages/babel-preset-es2015/test/traceur.js @@ -1,6 +1,7 @@ -const includes = require("lodash/includes"); +import includes from "lodash/includes"; +import runner from "babel-helper-transform-fixture-test-runner"; -require("babel-helper-transform-fixture-test-runner")(__dirname + "/fixtures/traceur", "traceur", { +runner(`${__dirname}/fixtures/traceur`, "traceur", { ignoreSuites: [ // weird environmental issue make these hard to test "Modules", diff --git a/packages/babel-preset-latest/test/index.js b/packages/babel-preset-latest/test/index.js index 1f6634aabd..09cfbc31f5 100644 --- a/packages/babel-preset-latest/test/index.js +++ b/packages/babel-preset-latest/test/index.js @@ -1 +1,3 @@ -require("babel-helper-plugin-test-runner")(__dirname); +import runner from "babel-helper-plugin-test-runner"; + +runner(__dirname); diff --git a/packages/babel-template/test/index.js b/packages/babel-template/test/index.js index 6e4ae78544..bad7d69f8d 100644 --- a/packages/babel-template/test/index.js +++ b/packages/babel-template/test/index.js @@ -1,6 +1,6 @@ -const generator = require("../../babel-generator").default; -const template = require("../lib"); -const chai = require("chai"); +import generator from "../../babel-generator"; +import template from "../lib"; +import chai from "chai"; const comments = "// Sum two numbers\nconst add = (a, b) => a + b;"; diff --git a/packages/babel-types/test/cloning.js b/packages/babel-types/test/cloning.js index 1280f94bd0..9e3b41f475 100644 --- a/packages/babel-types/test/cloning.js +++ b/packages/babel-types/test/cloning.js @@ -1,6 +1,6 @@ -const t = require("../lib"); -const assert = require("assert"); -const parse = require("babylon").parse; +import * as t from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; suite("cloning", function () { suite("clone", function () { diff --git a/packages/babel-types/test/validators.js b/packages/babel-types/test/validators.js index b6f6f31782..2e7e55d085 100644 --- a/packages/babel-types/test/validators.js +++ b/packages/babel-types/test/validators.js @@ -1,6 +1,6 @@ -const t = require("../lib"); -const assert = require("assert"); -const parse = require("babylon").parse; +import * as t from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; suite("validators", function () { suite("isNodesEquivalent", function () { From 2457c8ee14470e4cc660912989462a2210ad0a10 Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Tue, 17 Jan 2017 01:28:55 +0200 Subject: [PATCH 062/222] [skip ci] Fix dependency status extension. (#5144) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index befcea7094..fad6cfada4 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ There are a few presets that we maintain officially. | [`babel-preset-stage-2`](/packages/babel-preset-stage-2) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-2.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-2) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-2)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-2) | | [`babel-preset-stage-3`](/packages/babel-preset-stage-3) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-3.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-3) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-3)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-3) | | [`babel-preset-react`](/packages/babel-preset-react) | [![npm](https://img.shields.io/npm/v/babel-preset-react.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-react) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-react)](https://david-dm.org/babel/babel?path=packages/babel-preset-react) | -| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env)](https://david-dm.org/babel/babel-preset-env) | +| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | We maintain: From 8c35b320d37a957b629e75f59a9f52292cfd6b8e Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 17 Jan 2017 03:51:16 -0600 Subject: [PATCH 063/222] Bump eslint-config-babel and fix lint (#5129) --- package.json | 2 +- packages/babel-code-frame/src/index.js | 2 +- packages/babel-code-frame/test/index.js | 2 +- .../internal-plugins/shadow-functions.js | 4 ++-- packages/babel-core/test/evaluation.js | 4 ++-- packages/babel-generator/src/buffer.js | 2 +- packages/babel-generator/src/index.js | 2 +- packages/babel-generator/src/node/parentheses.js | 6 +++--- .../src/index.js | 4 ++-- .../src/index.js | 2 +- .../src/index.js | 2 +- .../test/esmodule-flag.js | 2 +- .../src/rest.js | 12 ++++++------ .../src/index.js | 2 +- .../src/index.js | 2 +- packages/babel-preset-es2015/test/index.js | 2 +- packages/babel-template/src/index.js | 2 +- packages/babel-template/test/index.js | 4 ++-- packages/babel-traverse/test/inference.js | 2 +- packages/babel-types/test/retrievers.js | 2 +- 20 files changed, 31 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 6f082e6cd1..30fdfe6149 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "codecov": "^1.0.1", "derequire": "^2.0.2", "eslint": "^3.9.0", - "eslint-config-babel": "^5.0.0", + "eslint-config-babel": "^6.0.0", "eslint-plugin-flowtype": "^2.20.0", "flow-bin": "^0.34.0", "gulp": "^3.9.0", diff --git a/packages/babel-code-frame/src/index.js b/packages/babel-code-frame/src/index.js index 9476ef617d..e2a1b84ebe 100644 --- a/packages/babel-code-frame/src/index.js +++ b/packages/babel-code-frame/src/index.js @@ -1,4 +1,4 @@ -import jsTokens, {matchToToken} from "js-tokens"; +import jsTokens, { matchToToken } from "js-tokens"; import esutils from "esutils"; import Chalk from "chalk"; diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index e11f0c8a7f..b6906100ee 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -109,7 +109,7 @@ describe("babel-code-frame", function () { it("opts.highlightCode", function () { const rawLines = "console.log('babel')"; - const result = codeFrame(rawLines, 1, 9, {highlightCode: true}); + const result = codeFrame(rawLines, 1, 9, { highlightCode: true }); const stripped = chalk.stripColor(result); assert.ok(result.length > stripped.length); assert.equal(stripped, [ diff --git a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js index 6b5995fc27..1b50aa759c 100644 --- a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js +++ b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js @@ -7,7 +7,7 @@ const superVisitor = { CallExpression(path) { if (!path.get("callee").isSuper()) return; - const {node} = path; + const { node } = path; if (node[SUPER_THIS_BOUND]) return; node[SUPER_THIS_BOUND] = true; @@ -101,7 +101,7 @@ function remap(path, key) { const classPath = fnPath.findParent((p) => p.isClass()); const hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass); - if (key === "this" && fnPath.isMethod({kind: "constructor"}) && hasSuperClass) { + if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) { fnPath.scope.push({ id }); fnPath.traverse(superVisitor, { id }); diff --git a/packages/babel-core/test/evaluation.js b/packages/babel-core/test/evaluation.js index b0741a5149..f7ee8ef479 100644 --- a/packages/babel-core/test/evaluation.js +++ b/packages/babel-core/test/evaluation.js @@ -64,6 +64,6 @@ describe("evaluation", function () { addTest("'abc' === 'xyz' || (1 === 1 && 'four' === 'four')", "LogicalExpression", true); addTest("'abc' === 'abc' && (1 === 1 && 'four' === 'four')", "LogicalExpression", true); addTest("({})", "ObjectExpression", {}); - addTest("({a: '1'})", "ObjectExpression", {a: "1"}); - addTest("({['a' + 'b']: 10 * 20, 'z': [1, 2, 3]})", "ObjectExpression", {ab: 200, z: [1, 2, 3]}); + addTest("({a: '1'})", "ObjectExpression", { a: "1" }); + addTest("({['a' + 'b']: 10 * 20, 'z': [1, 2, 3]})", "ObjectExpression", { ab: 200, z: [1, 2, 3] }); }); diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index 72894c440a..d1187be275 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -55,7 +55,7 @@ export default class Buffer { return this.map = map.get(); }, set(value) { - Object.defineProperty(this, "map", {value, writable: true}); + Object.defineProperty(this, "map", { value, writable: true }); }, }); } diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index a3031f1679..138336546c 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -2,7 +2,7 @@ import detectIndent from "detect-indent"; import SourceMap from "./source-map"; import * as messages from "babel-messages"; import Printer from "./printer"; -import type {Format} from "./printer"; +import type { Format } from "./printer"; /** * Babel's code generator, turns an ast into code, maintaining sourcemaps, diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 203ed8a3aa..e6424aced6 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -43,7 +43,7 @@ export function UpdateExpression(node: Object, parent: Object): boolean { } export function ObjectExpression(node: Object, parent: Object, printStack: Array): boolean { - return isFirstInStatement(printStack, {considerArrow: true}); + return isFirstInStatement(printStack, { considerArrow: true }); } export function Binary(node: Object, parent: Object): boolean { @@ -150,7 +150,7 @@ export function YieldExpression(node: Object, parent: Object): boolean { export { YieldExpression as AwaitExpression }; export function ClassExpression(node: Object, parent: Object, printStack: Array): boolean { - return isFirstInStatement(printStack, {considerDefaultExports: true}); + return isFirstInStatement(printStack, { considerDefaultExports: true }); } export function UnaryLike(node: Object, parent: Object): boolean { @@ -166,7 +166,7 @@ export function UnaryLike(node: Object, parent: Object): boolean { } export function FunctionExpression(node: Object, parent: Object, printStack: Array): boolean { - return isFirstInStatement(printStack, {considerDefaultExports: true}); + return isFirstInStatement(printStack, { considerDefaultExports: true }); } export function ArrowFunctionExpression(node: Object, parent: Object): boolean { diff --git a/packages/babel-plugin-transform-class-properties/src/index.js b/packages/babel-plugin-transform-class-properties/src/index.js index af383d44bd..9c5e7d24a2 100644 --- a/packages/babel-plugin-transform-class-properties/src/index.js +++ b/packages/babel-plugin-transform-class-properties/src/index.js @@ -29,13 +29,13 @@ export default function ({ types: t }) { }); `); - const buildClassPropertySpec = (ref, {key, value, computed}) => buildObjectDefineProperty({ + const buildClassPropertySpec = (ref, { key, value, computed }) => buildObjectDefineProperty({ REF: ref, KEY: (t.isIdentifier(key) && !computed) ? t.stringLiteral(key.name) : key, VALUE: value ? value : t.identifier("undefined") }); - const buildClassPropertyNonSpec = (ref, {key, value, computed}) => t.expressionStatement( + const buildClassPropertyNonSpec = (ref, { key, value, computed }) => t.expressionStatement( t.assignmentExpression("=", t.memberExpression(ref, key, computed || t.isLiteral(key)), value) ); diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index bbe1f9018f..0bdfb8b695 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -506,7 +506,7 @@ export default function ({ types: t }) { for (const nodeOut of nodesOut) { if (!nodeOut.declarations) continue; for (const declaration of nodeOut.declarations) { - const {name} = declaration.id; + const { name } = declaration.id; if (scope.bindings[name]) { scope.bindings[name].kind = nodeOut.kind; } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index a7285da446..1b491ea723 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -355,7 +355,7 @@ export default function () { } for (const source in imports) { - const {specifiers, maxBlockHoist} = imports[source]; + const { specifiers, maxBlockHoist } = imports[source]; if (specifiers.length) { const uid = addRequire(source, maxBlockHoist); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js index 2ab422c89b..920733e616 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js @@ -21,7 +21,7 @@ test("Re-export doesn't overwrite __esModule flag", function () { code = babel.transform(code, { "plugins": [ - [require("../"), {loose: true}], + [require("../"), { loose: true }], ], "ast": false, }).code; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/rest.js b/packages/babel-plugin-transform-es2015-parameters/src/rest.js index 3ae51ed548..d0ff2846cb 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/rest.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/rest.js @@ -67,7 +67,7 @@ const memberExpressionOptimisationVisitor = { if (state.noOptimise) { state.deopted = true; } else { - const {parentPath} = path; + const { parentPath } = path; // Is this identifier the right hand side of a default parameter? if (parentPath.listKey === "params" && parentPath.key < state.offset) { @@ -117,13 +117,13 @@ const memberExpressionOptimisationVisitor = { // if we know that this member expression is referencing a number then // we can safely optimise it if (parentPath.get("property").isBaseType("number")) { - state.candidates.push({cause: "indexGetter", path}); + state.candidates.push({ cause: "indexGetter", path }); return; } } // args.length else if (parentPath.node.property.name === "length") { - state.candidates.push({cause: "lengthGetter", path}); + state.candidates.push({ cause: "lengthGetter", path }); return; } } @@ -136,7 +136,7 @@ const memberExpressionOptimisationVisitor = { if (state.offset === 0 && parentPath.isSpreadElement()) { const call = parentPath.parentPath; if (call.isCallExpression() && call.node.arguments.length === 1) { - state.candidates.push({cause: "argSpread", path}); + state.candidates.push({ cause: "argSpread", path }); return; } } @@ -176,7 +176,7 @@ function optimiseIndexGetter(path, argsId, offset) { const { scope } = path; if (!scope.isPure(index)) { const temp = scope.generateUidIdentifierBasedOnNode(index); - scope.push({id: temp, kind: "var"}); + scope.push({ id: temp, kind: "var" }); path.parentPath.replaceWith(restIndexImpure({ ARGUMENTS: argsId, INDEX: index, @@ -246,7 +246,7 @@ export const visitor = { // There are only "shorthand" references if (!state.deopted && !state.references.length) { - for (const {path, cause} of (state.candidates: Array)) { + for (const { path, cause } of (state.candidates: Array)) { switch (cause) { case "indexGetter": optimiseIndexGetter(path, argsId, state.offset); diff --git a/packages/babel-plugin-transform-es3-property-literals/src/index.js b/packages/babel-plugin-transform-es3-property-literals/src/index.js index e62a88f8ee..0dbb2ee215 100644 --- a/packages/babel-plugin-transform-es3-property-literals/src/index.js +++ b/packages/babel-plugin-transform-es3-property-literals/src/index.js @@ -2,7 +2,7 @@ export default function ({ types: t }) { return { visitor: { ObjectProperty: { - exit({node}) { + exit({ node }) { const key = node.key; if (!node.computed && t.isIdentifier(key) && !t.isValidIdentifier(key.name)) { // default: "bar" -> "default": "bar" diff --git a/packages/babel-plugin-transform-react-jsx-source/src/index.js b/packages/babel-plugin-transform-react-jsx-source/src/index.js index 039e9e5adc..9bde066500 100644 --- a/packages/babel-plugin-transform-react-jsx-source/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-source/src/index.js @@ -50,7 +50,7 @@ export default function ({ types: t }) { : null; const fileNameIdentifier = path.scope.generateUidIdentifier(FILE_NAME_VAR); - path.hub.file.scope.push({id: fileNameIdentifier, init: t.stringLiteral(fileName)}); + path.hub.file.scope.push({ id: fileNameIdentifier, init: t.stringLiteral(fileName) }); state.fileNameIdentifier = fileNameIdentifier; } diff --git a/packages/babel-preset-es2015/test/index.js b/packages/babel-preset-es2015/test/index.js index b04436210b..b7847d1b83 100644 --- a/packages/babel-preset-es2015/test/index.js +++ b/packages/babel-preset-es2015/test/index.js @@ -21,7 +21,7 @@ describe("es2015 preset", function () { describe("loose", function () { it("throws on non-boolean value", function () { expect(function () { - es2015.buildPreset(null, { loose: 1}); + es2015.buildPreset(null, { loose: 1 }); }).to.throw(/must be a boolean/); }); }); diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index 4abd2a4608..164652c143 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -36,7 +36,7 @@ export default function (code: string, opts?: Object): Function { try { ast = babylon.parse(code, opts); - ast = traverse.removeProperties(ast, {preserveComments: opts.preserveComments}); + ast = traverse.removeProperties(ast, { preserveComments: opts.preserveComments }); traverse.cheap(ast, function (node) { node[FROM_TEMPLATE] = true; diff --git a/packages/babel-template/test/index.js b/packages/babel-template/test/index.js index bad7d69f8d..216d6a8939 100644 --- a/packages/babel-template/test/index.js +++ b/packages/babel-template/test/index.js @@ -13,7 +13,7 @@ describe("templating", function () { it("import statements are allowed with sourceType: module", function () { chai.expect(function () { - template("import foo from 'foo'", {sourceType: "module"})({}); + template("import foo from 'foo'", { sourceType: "module" })({}); }).not.to.throw(); }); @@ -24,7 +24,7 @@ describe("templating", function () { }); it("should preserve comments with a flag", function () { - const output = template(comments, {preserveComments: true})(); + const output = template(comments, { preserveComments: true })(); chai.expect(generator(output).code).to.be.equal(comments); }); }); diff --git a/packages/babel-traverse/test/inference.js b/packages/babel-traverse/test/inference.js index 5819cd1b06..225f2c7430 100644 --- a/packages/babel-traverse/test/inference.js +++ b/packages/babel-traverse/test/inference.js @@ -4,7 +4,7 @@ import { parse } from "babylon"; import * as t from "babel-types"; function getPath(code) { - const ast = parse(code, {plugins: ["flow", "asyncGenerators"]}); + const ast = parse(code, { plugins: ["flow", "asyncGenerators"] }); let path; traverse(ast, { Program: function (_path) { diff --git a/packages/babel-types/test/retrievers.js b/packages/babel-types/test/retrievers.js index 68eb34c4f3..15f4149cd1 100644 --- a/packages/babel-types/test/retrievers.js +++ b/packages/babel-types/test/retrievers.js @@ -3,7 +3,7 @@ import assert from "assert"; import { parse } from "babylon"; function getBody(program) { - return parse(program, {sourceType: "module"}).program.body; + return parse(program, { sourceType: "module" }).program.body; } describe("retrievers", function () { From 7d4de327d004650414d33a5eb25158b279c9d397 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 17 Jan 2017 11:03:16 +0100 Subject: [PATCH 064/222] remove style flat as it is default now --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fad6cfada4..d05e4f6168 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@

- Travis Status - CircleCI Status - Coverage Status + Travis Status + CircleCI Status + Coverage Status Slack Status NPM Downloads

From 56ac8b8f833b6436932ad1d9b2c6cb9d9fdce384 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 17 Jan 2017 11:16:30 +0100 Subject: [PATCH 065/222] Increase cache timeout to 12h for top badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d05e4f6168..dca5d6b564 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@

- Travis Status - CircleCI Status - Coverage Status + Travis Status + CircleCI Status + Coverage Status Slack Status - NPM Downloads + NPM Downloads

Babel is a community-driven tool that helps you write the latest version of JavaScript. From c76b8eec829e493698d6019e327b6c5ef7e568f4 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Tue, 17 Jan 2017 11:46:23 -0800 Subject: [PATCH 066/222] Run Babel's unittests in a custom sandbox. (#5135) --- .../src/index.js | 110 ++++++++++++++---- 1 file changed, 89 insertions(+), 21 deletions(-) diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 39a8aa8d33..14f3343849 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -10,11 +10,97 @@ import extend from "lodash/extend"; import merge from "lodash/merge"; import assert from "assert"; import chai from "chai"; -import "babel-polyfill"; import fs from "fs"; import path from "path"; +import vm from "vm"; +import Module from "module"; -const babelHelpers = eval(buildExternalHelpers(null, "var")); +const moduleCache = {}; +const testContext = { + ...helpers, + babelHelpers: null, + assert: chai.assert, + transform: babel.transform, + global: null, +}; +testContext.global = testContext; +vm.createContext(testContext); + +// Initialize the test context with the polyfill, and then freeze the global to prevent implicit +// global creation in tests, which could cause things to bleed between tests. +runModuleInTestContext("babel-polyfill", __filename); + +// Populate the "babelHelpers" global with Babel's helper utilities. +runCodeInTestContext(buildExternalHelpers()); + +/** + * A basic implementation of CommonJS so we can execute `babel-polyfill` inside our test context. + * This allows us to run our unittests + */ +function runModuleInTestContext(id: string, relativeFilename: string) { + let filename; + if (id[0] === ".") { + filename = require.resolve(path.resolve(path.dirname(relativeFilename), id)); + } else { + // This code is a gross hack using internal APIs, but we also have the same logic in babel-core + // to resolve presets and plugins, so if this breaks, we'll have even worse issues to deal with. + const relativeMod = new Module(); + relativeMod.id = relativeFilename; + relativeMod.filename = relativeFilename; + relativeMod.paths = Module._nodeModulePaths(path.dirname(relativeFilename)); + try { + filename = Module._resolveFilename(id, relativeMod); + } catch (err) { + filename = null; + } + + // Expose Node-internal modules if the tests want them. Note, this will not execute inside + // the context's global scope. + if (filename === id) return require(id); + } + + if (moduleCache[filename]) return moduleCache[filename].exports; + + const module = moduleCache[filename] = { + id: filename, + exports: {}, + }; + const dirname = path.dirname(filename); + const req = (id) => runModuleInTestContext(id, filename); + + const src = fs.readFileSync(filename, "utf8"); + const code = `(function (exports, require, module, __filename, __dirname) {${src}\n});`; + + vm.runInContext(code, testContext, { + filename, + displayErrors: true, + }).call(module.exports, module.exports, req, module, filename, dirname); + + return module.exports; +} + +/** + * Run the given snippet of code inside a CommonJS module + */ +function runCodeInTestContext(code: string, opts: {filename?: string} = {}) { + const filename = opts.filename || null; + const dirname = filename ? path.dirname(filename) : null; + const req = filename ? ((id) => runModuleInTestContext(id, filename)) : null; + + const module = { + id: filename, + exports: {}, + }; + + // Expose the test options as "opts", but otherwise run the test in a CommonJS-like environment. + // Note: This isn't doing .call(module.exports, ...) because some of our tests currently + // rely on 'this === global'. + const src = `(function(exports, require, module, __filename, __dirname, opts) {${code}\n});`; + return vm.runInContext(src, testContext, { + filename, + displayErrors: true, + })(module.exports, req, module, filename, dirname, opts); +} function wrapPackagesArray(type, names, optionsDir) { return (names || []).map(function (val) { @@ -68,12 +154,11 @@ function run(task) { if (execCode) { const execOpts = getOpts(exec); - const execDirName = path.dirname(exec.loc); result = babel.transform(execCode, execOpts); execCode = result.code; try { - resultExec = runExec(execOpts, execCode, execDirName); + resultExec = runCodeInTestContext(execCode, execOpts); } catch (err) { err.message = exec.loc + ": " + err.message; err.message += codeFrame(execCode); @@ -114,23 +199,6 @@ function run(task) { } } -function runExec(opts, execCode, execDirname) { - const sandbox = { - ...helpers, - babelHelpers, - assert: chai.assert, - transform: babel.transform, - opts, - exports: {}, - require(id) { - return require(id[0] === "." ? path.resolve(execDirname, id) : id); - } - }; - - const fn = new Function(...Object.keys(sandbox), execCode); - return fn.apply(null, Object.values(sandbox)); -} - export default function ( fixturesLoc: string, name: string, From 387123672396bbcdd048bdd9d045f0e088a36b2b Mon Sep 17 00:00:00 2001 From: Toru Kobayashi Date: Wed, 18 Jan 2017 04:47:04 +0900 Subject: [PATCH 067/222] transform-react-constant-elements hoists Composite Components (#5137) [skip ci] --- .../README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/babel-plugin-transform-react-constant-elements/README.md b/packages/babel-plugin-transform-react-constant-elements/README.md index 6a75ab7a4a..4f0db40e03 100644 --- a/packages/babel-plugin-transform-react-constant-elements/README.md +++ b/packages/babel-plugin-transform-react-constant-elements/README.md @@ -37,12 +37,6 @@ const Hr = () => {
this.node = node} /> ``` -- **Composite Components** - - ```js - const ComponentA = () =>
; - ``` - ## Installation ```sh From bca170ad79e8297ee29391a2dec93d563c975173 Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Wed, 18 Jan 2017 21:32:44 -0500 Subject: [PATCH 068/222] Avoid duplicating impure expressions in object rest destructuring (#5151) * avoid duplicating impure initializers in object rest destructuring * reuse existing VariableDeclarations in object rest destructuring, to fix two issues: 1. inserting an additional VariableDeclaration after the current one may change order of operations, which is unsafe if a future VariableDeclarator refers to a destructured variable. 2. The entire VariableDeclaration is removed when all properties are rest properties, indiscriminately removing other variables --- .../src/index.js | 39 +++++++++++++------ .../object-rest/catch-clause/expected.js | 12 +++--- .../fixtures/object-rest/export/expected.js | 6 +-- .../fixtures/object-rest/for-x/expected.js | 14 +++---- .../object-rest/parameters/expected.js | 28 ++++++------- .../variable-destructuring/expected.js | 31 +++++++-------- .../fixtures/regression/gh-4904/actual.js | 7 ++++ .../fixtures/regression/gh-4904/expected.js | 15 +++++++ .../fixtures/regression/gh-5151/actual.js | 10 +++++ .../fixtures/regression/gh-5151/expected.js | 14 +++++++ .../test/fixtures/regression/options.json | 6 +++ 11 files changed, 124 insertions(+), 58 deletions(-) create mode 100644 packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/actual.js create mode 100644 packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/expected.js create mode 100644 packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/actual.js create mode 100644 packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/expected.js create mode 100644 packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/options.json diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index 4e2be6de80..8de5e5eea2 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -78,11 +78,31 @@ export default function ({ types: t }) { // const { a, ...b } = c; VariableDeclarator(path, file) { if (!path.get("id").isObjectPattern()) { return; } - const kind = path.parentPath.node.kind; - const nodes = []; - path.traverse({ + let insertionPath = path; + + path.get("id").traverse({ RestProperty(path) { + if ( + // skip single-property case, e.g. + // const { ...x } = foo(); + // since the RHS will not be duplicated + this.originalPath.node.id.properties.length > 1 && + !t.isIdentifier(this.originalPath.node.init) + ) { + // const { a, ...b } = foo(); + // to avoid calling foo() twice, as a first step convert it to: + // const _foo = foo(), + // { a, ...b } = _foo; + const initRef = path.scope.generateUidIdentifierBasedOnNode(this.originalPath.node.init, "ref"); + // insert _foo = foo() + this.originalPath.insertBefore(t.variableDeclarator(initRef, this.originalPath.node.init)); + // replace foo() with _foo + this.originalPath.replaceWith(t.variableDeclarator(this.originalPath.node.id, initRef)); + + return; + } + let ref = this.originalPath.node.init; path.findParent((path) => { @@ -99,29 +119,24 @@ export default function ({ types: t }) { ref ); - nodes.push( + insertionPath.insertAfter( t.variableDeclarator( argument, callExpression ) ); + insertionPath = insertionPath.getSibling(insertionPath.key + 1); + if (path.parentPath.node.properties.length === 0) { path.findParent( - (path) => path.isObjectProperty() || path.isVariableDeclaration() + (path) => path.isObjectProperty() || path.isVariableDeclarator() ).remove(); } } }, { originalPath: path }); - - if (nodes.length > 0) { - path.parentPath.getSibling(path.parentPath.key + 1) - .insertBefore( - t.variableDeclaration(kind, nodes) - ); - } }, // taken from transform-es2015-destructuring/src/index.js#visitor // export var { a, ...b } = c; diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/catch-clause/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/catch-clause/expected.js index c1695cf2ed..a311c3e537 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/catch-clause/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/catch-clause/expected.js @@ -2,16 +2,16 @@ try {} catch (_ref) { let a34 = babelHelpers.objectWithoutProperties(_ref, []); } try {} catch (_ref2) { - let { a1 } = _ref2; - let b1 = babelHelpers.objectWithoutProperties(_ref2, ["a1"]); + let { a1 } = _ref2, + b1 = babelHelpers.objectWithoutProperties(_ref2, ["a1"]); } try {} catch (_ref3) { - let { a2, b2 } = _ref3; - let c2 = babelHelpers.objectWithoutProperties(_ref3, ["a2", "b2"]); + let { a2, b2 } = _ref3, + c2 = babelHelpers.objectWithoutProperties(_ref3, ["a2", "b2"]); } try {} catch (_ref4) { - let { a2, b2, c2: { c3 } } = _ref4; - let c4 = babelHelpers.objectWithoutProperties(_ref4.c2, ["c3"]); + let { a2, b2, c2: { c3 } } = _ref4, + c4 = babelHelpers.objectWithoutProperties(_ref4.c2, ["c3"]); } // Unchanged diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/export/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/export/expected.js index d3d2967d6e..95af7b2702 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/export/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/export/expected.js @@ -1,7 +1,7 @@ // ExportNamedDeclaration -var { b } = asdf2; +var { b } = asdf2, + c = babelHelpers.objectWithoutProperties(asdf2, ["b"]); // Skip -var c = babelHelpers.objectWithoutProperties(asdf2, ["b"]); export { b, c }; export var { bb, cc } = ads; -export var [dd, ee] = ads; \ No newline at end of file +export var [dd, ee] = ads; diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js index 59b38ec57f..9617d7b78f 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js @@ -1,16 +1,16 @@ // ForXStatement for (var _ref of []) { - var { a } = _ref; - var b = babelHelpers.objectWithoutProperties(_ref, ["a"]); + var { a } = _ref, + b = babelHelpers.objectWithoutProperties(_ref, ["a"]); } for (var _ref2 of []) { - var { a } = _ref2; - var b = babelHelpers.objectWithoutProperties(_ref2, ["a"]); + var { a } = _ref2, + b = babelHelpers.objectWithoutProperties(_ref2, ["a"]); } async function a() { for await (var _ref3 of []) { - var { a } = _ref3; - var b = babelHelpers.objectWithoutProperties(_ref3, ["a"]); + var { a } = _ref3, + b = babelHelpers.objectWithoutProperties(_ref3, ["a"]); } } @@ -25,4 +25,4 @@ for (a in {}) {} for (a of []) {} async function a() { for (a of []) {} -} \ No newline at end of file +} diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js index 71c7876f13..abaf34d76d 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/parameters/expected.js @@ -2,31 +2,31 @@ function a(_ref) { let a34 = babelHelpers.objectWithoutProperties(_ref, []); } function a2(_ref2) { - let { a1 } = _ref2; - let b1 = babelHelpers.objectWithoutProperties(_ref2, ["a1"]); + let { a1 } = _ref2, + b1 = babelHelpers.objectWithoutProperties(_ref2, ["a1"]); } function a3(_ref3) { - let { a2, b2 } = _ref3; - let c2 = babelHelpers.objectWithoutProperties(_ref3, ["a2", "b2"]); + let { a2, b2 } = _ref3, + c2 = babelHelpers.objectWithoutProperties(_ref3, ["a2", "b2"]); } function a4(_ref4, _ref5) { - let { a5 } = _ref5; - let c5 = babelHelpers.objectWithoutProperties(_ref5, ["a5"]); - let { a3 } = _ref4; - let c3 = babelHelpers.objectWithoutProperties(_ref4, ["a3"]); + let { a5 } = _ref5, + c5 = babelHelpers.objectWithoutProperties(_ref5, ["a5"]); + let { a3 } = _ref4, + c3 = babelHelpers.objectWithoutProperties(_ref4, ["a3"]); } function a5(_ref6) { - let { a3, b2: { ba1 } } = _ref6; - let ba2 = babelHelpers.objectWithoutProperties(_ref6.b2, ["ba1"]), + let { a3, b2: { ba1 } } = _ref6, + ba2 = babelHelpers.objectWithoutProperties(_ref6.b2, ["ba1"]), c3 = babelHelpers.objectWithoutProperties(_ref6, ["a3", "b2"]); } function a6(_ref7) { - let { a3, b2: { ba1 } } = _ref7; - let ba2 = babelHelpers.objectWithoutProperties(_ref7.b2, ["ba1"]); + let { a3, b2: { ba1 } } = _ref7, + ba2 = babelHelpers.objectWithoutProperties(_ref7.b2, ["ba1"]); } function a7(_ref8 = {}) { - let { a1 = 1 } = _ref8; - let b1 = babelHelpers.objectWithoutProperties(_ref8, ["a1"]); + let { a1 = 1 } = _ref8, + b1 = babelHelpers.objectWithoutProperties(_ref8, ["a1"]); } // Unchanged function b(a) {} diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/variable-destructuring/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/variable-destructuring/expected.js index c7d81cdf99..b9b3cfe2d3 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/variable-destructuring/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/variable-destructuring/expected.js @@ -3,25 +3,24 @@ var x = babelHelpers.objectWithoutProperties(z, []); var a = babelHelpers.objectWithoutProperties({ a: 1 }, []); var x = babelHelpers.objectWithoutProperties(a.b, []); var x = babelHelpers.objectWithoutProperties(a(), []); - -var { x1 } = z; -var y1 = babelHelpers.objectWithoutProperties(z, ["x1"]); +var { x1 } = z, + y1 = babelHelpers.objectWithoutProperties(z, ["x1"]); x1++; -var { [a]: b } = z; -var c = babelHelpers.objectWithoutProperties(z, [a]); -var { x1 } = z; -var y1 = babelHelpers.objectWithoutProperties(z, ["x1"]); -let { x2, y2 } = z; -let z2 = babelHelpers.objectWithoutProperties(z, ["x2", "y2"]); -const { w3, x3, y3 } = z; +var { [a]: b } = z, + c = babelHelpers.objectWithoutProperties(z, [a]); +var { x1 } = z, + y1 = babelHelpers.objectWithoutProperties(z, ["x1"]); +let { x2, y2 } = z, + z2 = babelHelpers.objectWithoutProperties(z, ["x2", "y2"]); +const { w3, x3, y3 } = z, + z4 = babelHelpers.objectWithoutProperties(z, ["w3", "x3", "y3"]); -const z4 = babelHelpers.objectWithoutProperties(z, ["w3", "x3", "y3"]); let { x: { a: xa, [d]: f } -} = complex; - -let asdf = babelHelpers.objectWithoutProperties(complex.x, ["a", d]), +} = complex, + asdf = babelHelpers.objectWithoutProperties(complex.x, ["a", d]), d = babelHelpers.objectWithoutProperties(complex.y, []), g = babelHelpers.objectWithoutProperties(complex, ["x"]); -let {} = z; -let y4 = babelHelpers.objectWithoutProperties(z.x4, []); + +let {} = z, + y4 = babelHelpers.objectWithoutProperties(z.x4, []); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/actual.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/actual.js new file mode 100644 index 0000000000..261723058d --- /dev/null +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/actual.js @@ -0,0 +1,7 @@ +const { s, ...t } = foo(); + +const { s: { q1, ...q2 }, ...q3 } = bar(); + +const { a } = foo(({ b, ...c }) => { + console.log(b, c); +}); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/expected.js new file mode 100644 index 0000000000..a07001af1b --- /dev/null +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-4904/expected.js @@ -0,0 +1,15 @@ +const _foo = foo(), + { s } = _foo, + t = babelHelpers.objectWithoutProperties(_foo, ["s"]); + +const _bar = bar(), + { s: { q1 } } = _bar, + q2 = babelHelpers.objectWithoutProperties(_bar.s, ["q1"]), + q3 = babelHelpers.objectWithoutProperties(_bar, ["s"]); + +const { a } = foo((_ref) => { + let { b } = _ref, + c = babelHelpers.objectWithoutProperties(_ref, ["b"]); + + console.log(b, c); +}); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/actual.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/actual.js new file mode 100644 index 0000000000..a57f76549a --- /dev/null +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/actual.js @@ -0,0 +1,10 @@ +const { x, ...y } = a, + z = foo(y); + +const { ...s } = r, + t = foo(s); + +// ordering is preserved +var l = foo(), + { m: { n, ...o }, ...p } = bar(), + q = baz(); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/expected.js new file mode 100644 index 0000000000..ef6147befd --- /dev/null +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/gh-5151/expected.js @@ -0,0 +1,14 @@ +const { x } = a, + y = babelHelpers.objectWithoutProperties(a, ["x"]), + z = foo(y); + +const s = babelHelpers.objectWithoutProperties(r, []), + t = foo(s); + +// ordering is preserved +var l = foo(), + _bar = bar(), + { m: { n } } = _bar, + o = babelHelpers.objectWithoutProperties(_bar.m, ["n"]), + p = babelHelpers.objectWithoutProperties(_bar, ["m"]), + q = baz(); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/options.json b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/options.json new file mode 100644 index 0000000000..e155c0bd07 --- /dev/null +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/regression/options.json @@ -0,0 +1,6 @@ +{ + "plugins": [ + "transform-object-rest-spread", + "external-helpers" + ] +} From 4106dd3db186deb978f45fc70a10ed7a9f0026b2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 18:43:50 -0500 Subject: [PATCH 069/222] Revert "Run Babel's unittests in a custom sandbox." --- .../src/index.js | 110 ++++-------------- 1 file changed, 21 insertions(+), 89 deletions(-) diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 14f3343849..39a8aa8d33 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -10,97 +10,11 @@ import extend from "lodash/extend"; import merge from "lodash/merge"; import assert from "assert"; import chai from "chai"; +import "babel-polyfill"; import fs from "fs"; import path from "path"; -import vm from "vm"; -import Module from "module"; -const moduleCache = {}; -const testContext = { - ...helpers, - babelHelpers: null, - assert: chai.assert, - transform: babel.transform, - global: null, -}; -testContext.global = testContext; -vm.createContext(testContext); - -// Initialize the test context with the polyfill, and then freeze the global to prevent implicit -// global creation in tests, which could cause things to bleed between tests. -runModuleInTestContext("babel-polyfill", __filename); - -// Populate the "babelHelpers" global with Babel's helper utilities. -runCodeInTestContext(buildExternalHelpers()); - -/** - * A basic implementation of CommonJS so we can execute `babel-polyfill` inside our test context. - * This allows us to run our unittests - */ -function runModuleInTestContext(id: string, relativeFilename: string) { - let filename; - if (id[0] === ".") { - filename = require.resolve(path.resolve(path.dirname(relativeFilename), id)); - } else { - // This code is a gross hack using internal APIs, but we also have the same logic in babel-core - // to resolve presets and plugins, so if this breaks, we'll have even worse issues to deal with. - const relativeMod = new Module(); - relativeMod.id = relativeFilename; - relativeMod.filename = relativeFilename; - relativeMod.paths = Module._nodeModulePaths(path.dirname(relativeFilename)); - try { - filename = Module._resolveFilename(id, relativeMod); - } catch (err) { - filename = null; - } - - // Expose Node-internal modules if the tests want them. Note, this will not execute inside - // the context's global scope. - if (filename === id) return require(id); - } - - if (moduleCache[filename]) return moduleCache[filename].exports; - - const module = moduleCache[filename] = { - id: filename, - exports: {}, - }; - const dirname = path.dirname(filename); - const req = (id) => runModuleInTestContext(id, filename); - - const src = fs.readFileSync(filename, "utf8"); - const code = `(function (exports, require, module, __filename, __dirname) {${src}\n});`; - - vm.runInContext(code, testContext, { - filename, - displayErrors: true, - }).call(module.exports, module.exports, req, module, filename, dirname); - - return module.exports; -} - -/** - * Run the given snippet of code inside a CommonJS module - */ -function runCodeInTestContext(code: string, opts: {filename?: string} = {}) { - const filename = opts.filename || null; - const dirname = filename ? path.dirname(filename) : null; - const req = filename ? ((id) => runModuleInTestContext(id, filename)) : null; - - const module = { - id: filename, - exports: {}, - }; - - // Expose the test options as "opts", but otherwise run the test in a CommonJS-like environment. - // Note: This isn't doing .call(module.exports, ...) because some of our tests currently - // rely on 'this === global'. - const src = `(function(exports, require, module, __filename, __dirname, opts) {${code}\n});`; - return vm.runInContext(src, testContext, { - filename, - displayErrors: true, - })(module.exports, req, module, filename, dirname, opts); -} +const babelHelpers = eval(buildExternalHelpers(null, "var")); function wrapPackagesArray(type, names, optionsDir) { return (names || []).map(function (val) { @@ -154,11 +68,12 @@ function run(task) { if (execCode) { const execOpts = getOpts(exec); + const execDirName = path.dirname(exec.loc); result = babel.transform(execCode, execOpts); execCode = result.code; try { - resultExec = runCodeInTestContext(execCode, execOpts); + resultExec = runExec(execOpts, execCode, execDirName); } catch (err) { err.message = exec.loc + ": " + err.message; err.message += codeFrame(execCode); @@ -199,6 +114,23 @@ function run(task) { } } +function runExec(opts, execCode, execDirname) { + const sandbox = { + ...helpers, + babelHelpers, + assert: chai.assert, + transform: babel.transform, + opts, + exports: {}, + require(id) { + return require(id[0] === "." ? path.resolve(execDirname, id) : id); + } + }; + + const fn = new Function(...Object.keys(sandbox), execCode); + return fn.apply(null, Object.values(sandbox)); +} + export default function ( fixturesLoc: string, name: string, From 03c88baf8d37e3f8478ed5b6d6085046d431ae44 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 19:24:23 -0500 Subject: [PATCH 070/222] 6.22.0 changelog [skip ci] (#5158) --- CHANGELOG.md | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7311807047..06bc3a24f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,188 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.22.0 (2017-01-19) + +A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes! + +We'll be merging in our current 7.0 PRs on a 7.0 branch soon and I'l be making some more issues (most should be beginner-friendly). + +To follow our progress check out our [7.0 milestone](https://github.com/babel/babel/milestone/9), the [wiki](https://github.com/babel/babel/wiki/Babel-7) and upcoming announcements on [twitter](https://twitter.com/babeljs)! + +We support stripping out and generating the new shorthand import syntax in Flow (parser support was added in [babylon@6.15.0](https://github.com/babel/babylon/releases/tag/v6.15.0). + +```js +import { + someValue, + type someType, + typeof someOtherValue, +} from "blah"; +``` + +#### :rocket: New Feature +* `babel-generator`, `babel-types` + * [#5110](https://github.com/babel/babel/pull/5110) Validate importKind and ensure code generation exists.. ([@loganfsmyth](https://github.com/loganfsmyth)) +* `babel-plugin-transform-flow-strip-types`, `babel-traverse` + * [#5035](https://github.com/babel/babel/pull/5035) Strip Flow's new shorthand import-type specifiers. ([@jeffmo](https://github.com/jeffmo)) +* `babel-core` + * [#4729](https://github.com/babel/babel/pull/4729) Add resolvePlugin and resolvePreset methods to babel-core API. ([@rmacklin](https://github.com/rmacklin)) + +#### :bug: Bug Fix +* `babel-plugin-transform-object-rest-spread` + * [#5151](https://github.com/babel/babel/pull/5151) Avoid duplicating impure expressions in object rest destructuring. ([@erikdesjardins](https://github.com/erikdesjardins)) + +```js +const { x, ...y } = foo(); +``` + +Old Behavior + +```js +const { x } = foo(); +const y = _objectWithoutProperties(foo(), ["x"]); +``` + +New/Expected Behavior + +```js +const _ref = foo(); // should only be called once +const { x } = _ref; +const y = _objectWithoutProperties(_ref, ["x"]); +``` + +* `babel-cli` + * [#4790](https://github.com/babel/babel/pull/4790) fixes invalid line offsets in merged sourcemaps. ([@peterm0x](https://github.com/peterm0x)) +* `babel-plugin-transform-object-rest-spread` + * [#5088](https://github.com/babel/babel/pull/5088) fix: plugin-transform-object-rest-spread param with default value. ([@christophehurpeau](https://github.com/christophehurpeau)) + +Accounts for default values in object rest params + +```js +function fn({a = 1, ...b} = {}) { + return {a, b}; +} +``` + +* `babel-plugin-transform-es2015-destructuring` + * [#5093](https://github.com/babel/babel/pull/5093) Ensure array is always copied during destructure. ([@existentialism](https://github.com/existentialism)) + +```js +const assign = ([...arr], index, value) => { + arr[index] = value + return arr +} + +const arr = [1, 2, 3] +assign(arr, 1, 42) +console.log(arr) // [1, 2, 3] +``` + +* `babel-plugin-transform-es2015-function-name` + * [#5008](https://github.com/babel/babel/pull/5008) Don't try to visit ArrowFunctionExpression, they cannot be named. ([@Kovensky](https://github.com/Kovensky)) + +Input + +```js +export const x = ({ x }) => x; +export const y = function () {}; +``` + +Output + +```js +export const x = ({ x }) => x; +export const y = function y() {}; +``` + +* `babel-types` + * [#5068](https://github.com/babel/babel/pull/5068) Fix getBindingIdentifiers in babel-types. ([@rtsao](https://github.com/rtsao)) +* `babel-cli` + * [#3698](https://github.com/babel/babel/pull/3698) Watch mode should wait for file write. (T7411) ([@hayeah](https://github.com/hayeah)) + +#### :nail_care: Polish +* `babel-traverse` + * [#5076](https://github.com/babel/babel/pull/5076) Optimize removal-hooks for ArrowFunctions. ([@danez](https://github.com/danez)) +* `babel-generator`, `babel-plugin-transform-exponentiation-operator` + * [#5026](https://github.com/babel/babel/pull/5026) Remove unnecessary spaces around template element. ([@chicoxyzzy](https://github.com/chicoxyzzy)) + +#### :memo: Documentation +* Other + * [#5144](https://github.com/babel/babel/pull/5144) Fix dependency status extension.. ([@yavorsky](https://github.com/yavorsky)) + * [#5136](https://github.com/babel/babel/pull/5136) Add babel-preset-env to maintained list.. ([@yavorsky](https://github.com/yavorsky)) +* `babel-core` + * [#5101](https://github.com/babel/babel/pull/5101) Document babelrc option. ([@novemberborn](https://github.com/novemberborn)) + * [#5114](https://github.com/babel/babel/pull/5114) Update babel-core options in README. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-syntax-class-constructor-call` + * [#5130](https://github.com/babel/babel/pull/5130) update syntax-class-constructor-call documentation. ([@xtuc](https://github.com/xtuc)) +* `babel-plugin-transform-es2015-duplicate-keys`, `babel-plugin-transform-es2015-parameters` + * [#5111](https://github.com/babel/babel/pull/5111) Fixes some inconsistent documentation. ([@xtuc](https://github.com/xtuc)) +* `babel-plugin-transform-es2015-computed-properties`, `babel-plugin-transform-es2015-for-of` + * [#5096](https://github.com/babel/babel/pull/5096) Add examples to computed-props and for-of READMEs [skip ci]. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-class-properties` + * [#5077](https://github.com/babel/babel/pull/5077) Static function call result comment does not match variable content [skip ci]. ([@kasn](https://github.com/kasn)) +* Other + * [#5070](https://github.com/babel/babel/pull/5070) Fix typo in README.md. ([@nomicos](https://github.com/nomicos)) + * [#5031](https://github.com/babel/babel/pull/5031) remove plugin links, just use the website [skip ci]. ([@hzoo](https://github.com/hzoo)) + * [#5011](https://github.com/babel/babel/pull/5011) Add Team section [skip ci]. ([@hzoo](https://github.com/hzoo)) +* `babel-plugin-transform-es2015-classes`, `babel-plugin-transform-function-bind` + * [#5061](https://github.com/babel/babel/pull/5061) Fix some doc lint issues. ([@existentialism](https://github.com/existentialism)) +* `babel-helpers` + * [#5059](https://github.com/babel/babel/pull/5059) Fix incorrect snippet language in babel-helpers. ([@xtuc](https://github.com/xtuc)) +* `babel-preset-react` + * [#5051](https://github.com/babel/babel/pull/5051) Adding more info to the Install section. ([@gitanupam](https://github.com/gitanupam)) +* `babel-plugin-check-es2015-constants`, `babel-plugin-transform-es2015-modules-umd`, `babel-plugin-transform-es2015-typeof-symbol`, `babel-register` + * [#5045](https://github.com/babel/babel/pull/5045) Fix some README links. ([@existentialism](https://github.com/existentialism)) +* `babel-core` + * [#5014](https://github.com/babel/babel/pull/5014) Update babel-core's README. ([@xtuc](https://github.com/xtuc)) + +#### :house: Internal +* `babel-*` + * [#5129](https://github.com/babel/babel/pull/5129) Bump eslint-config-babel and fix lint. ([@existentialism](https://github.com/existentialism)) + * [#5138](https://github.com/babel/babel/pull/5138) Refactor packages to use ES modules instead of CJS. ([@chicoxyzzy](https://github.com/chicoxyzzy)) + * [#5113](https://github.com/babel/babel/pull/5113) Kaicataldo enable prefer const. ([@hzoo](https://github.com/hzoo)) +* `babel-helper-transform-fixture-test-runner` + * [#5135](https://github.com/babel/babel/pull/5135) Run Babel's unittests in a custom sandbox.. ([@loganfsmyth](https://github.com/loganfsmyth)) +* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-define-map`, `babel-register`, `babel-runtime`, `babel-types` + * [#5043](https://github.com/babel/babel/pull/5043) Replace "lodash/is*" and "lodash/each" with native equivalents. ([@zertosh](https://github.com/zertosh)) +* `babel-cli`, `babel-generator`, `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-es2015`, `babel-runtime`, `babel-traverse` + * [#5042](https://github.com/babel/babel/pull/5042) Use native or lodash util module where full "lodash" is required. ([@zertosh](https://github.com/zertosh)) +* `babel-code-frame` + * [#5094](https://github.com/babel/babel/pull/5094) babel-code-frame: Upgrade to js-tokens@3. ([@lydell](https://github.com/lydell)) +* `babel-plugin-transform-react-jsx` + * [#5100](https://github.com/babel/babel/pull/5100) Fix broken repository url. ([@batista](https://github.com/batista)) +* `babel-plugin-transform-decorators` + * [#5038](https://github.com/babel/babel/pull/5038) Remove unused dependency. ([@zertosh](https://github.com/zertosh)) +* `babel-plugin-transform-es2015-computed-properties` + * [#5053](https://github.com/babel/babel/pull/5053) Remove unused define-map helper from computed-properties. ([@existentialism](https://github.com/existentialism)) +* `babel-cli` + * [#5027](https://github.com/babel/babel/pull/5027) Dependencies: Upgrade glob to v7. ([@ysangkok](https://github.com/ysangkok)) + +#### Committers: 23, First PRs: 10 +- Andres Suarez ([zertosh](https://github.com/zertosh)) +- Andrii Bida ([nomicos](https://github.com/nomicos)) First PR! +- Anthony Zotti ([amZotti](https://github.com/amZotti)) First PR! +- Anupam ([gitanupam](https://github.com/gitanupam)) First PR! +- Artem Yavorsky ([yavorsky](https://github.com/yavorsky)) First PR! +- Brian Ng ([existentialism](https://github.com/existentialism)) +- Christophe Hurpeau ([christophehurpeau](https://github.com/christophehurpeau)) +- Daniel Tschinder ([danez](https://github.com/danez)) +- Diogo Franco ([Kovensky](https://github.com/Kovensky)) +- Erik Desjardins ([erikdesjardins](https://github.com/erikdesjardins)) +- Henry Zhu ([hzoo](https://github.com/hzoo)) +- Howard Yeh ([hayeah](https://github.com/hayeah)) First PR! +- Janus Troelsen ([ysangkok](https://github.com/ysangkok)) First PR! +- Jeff Morrison ([jeffmo](https://github.com/jeffmo)) +- Karsten Gohm ([kasn](https://github.com/kasn)) First PR! +- Logan Smyth ([loganfsmyth](https://github.com/loganfsmyth)) +- Mark Wubben ([novemberborn](https://github.com/novemberborn)) First PR! +- Peter Mikula ([peterm0x](https://github.com/peterm0x)) +- Ryan Tsao ([rtsao](https://github.com/rtsao)) First PR! +- Sergey Rubanov ([chicoxyzzy](https://github.com/chicoxyzzy)) +- Simon Lydell ([lydell](https://github.com/lydell)) +- Sven SAULEAU ([xtuc](https://github.com/xtuc)) +- Sérgio Batista ([batista](https://github.com/batista)) First PR! +- [rmacklin](https://github.com/rmacklin) + ## 6.21.1 (2016-12-17) #### :bug: Bug Fix From e9fc38bcd30226bb8ca97a0701804322e9382c01 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 19:33:22 -0500 Subject: [PATCH 071/222] v6.22.0 --- lerna.json | 2 +- packages/babel-cli/package.json | 12 ++--- packages/babel-code-frame/package.json | 2 +- packages/babel-core/package.json | 26 ++++----- packages/babel-generator/package.json | 10 ++-- .../package.json | 8 +-- .../package.json | 8 +-- .../package.json | 8 +-- .../package.json | 6 +-- .../babel-helper-call-delegate/package.json | 10 ++-- packages/babel-helper-define-map/package.json | 8 +-- .../package.json | 8 +-- .../babel-helper-explode-class/package.json | 10 ++-- packages/babel-helper-fixtures/package.json | 4 +- .../babel-helper-function-name/package.json | 12 ++--- .../package.json | 6 +-- .../babel-helper-hoist-variables/package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- packages/babel-helper-regex/package.json | 6 +-- .../package.json | 12 ++--- .../babel-helper-replace-supers/package.json | 14 ++--- .../package.json | 12 ++--- packages/babel-helpers/package.json | 6 +-- packages/babel-messages/package.json | 4 +- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 8 +-- .../package.json | 10 ++-- .../package.json | 8 +-- .../package.json | 10 ++-- .../package.json | 12 ++--- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 12 ++--- .../package.json | 22 ++++---- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 10 ++-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 10 ++-- .../package.json | 12 ++--- .../package.json | 10 ++-- .../package.json | 10 ++-- .../package.json | 8 +-- .../package.json | 16 +++--- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 10 ++-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../babel-plugin-transform-eval/package.json | 6 +-- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 6 +-- packages/babel-polyfill/package.json | 4 +- packages/babel-preset-es2015/package.json | 54 +++++++++---------- packages/babel-preset-es2016/package.json | 4 +- packages/babel-preset-es2017/package.json | 6 +-- packages/babel-preset-latest/package.json | 10 ++-- packages/babel-preset-react/package.json | 12 ++--- packages/babel-preset-stage-0/package.json | 8 +-- packages/babel-preset-stage-1/package.json | 8 +-- packages/babel-preset-stage-2/package.json | 8 +-- packages/babel-preset-stage-3/package.json | 12 ++--- packages/babel-register/package.json | 6 +-- packages/babel-runtime/package.json | 6 +-- packages/babel-template/package.json | 8 +-- packages/babel-traverse/package.json | 12 ++--- packages/babel-types/package.json | 4 +- 99 files changed, 411 insertions(+), 411 deletions(-) diff --git a/lerna.json b/lerna.json index 6ad6cc309f..4fc063c9a9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.21.1", + "version": "6.22.0", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index e22d9742a7..d32f989965 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,16 +1,16 @@ { "name": "babel-cli", - "version": "6.18.0", + "version": "6.22.0", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-cli", "dependencies": { - "babel-core": "^6.18.0", - "babel-register": "^6.18.0", - "babel-polyfill": "^6.16.0", - "babel-runtime": "^6.9.0", + "babel-core": "^6.22.0", + "babel-register": "^6.22.0", + "babel-polyfill": "^6.22.0", + "babel-runtime": "^6.22.0", "commander": "^2.8.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.0.0", @@ -26,7 +26,7 @@ "chokidar": "^1.6.1" }, "devDependencies": { - "babel-helper-fixtures": "^6.18.0" + "babel-helper-fixtures": "^6.22.0" }, "bin": { "babel-doctor": "./bin/babel-doctor.js", diff --git a/packages/babel-code-frame/package.json b/packages/babel-code-frame/package.json index 82b2bcdc10..692187128a 100644 --- a/packages/babel-code-frame/package.json +++ b/packages/babel-code-frame/package.json @@ -1,6 +1,6 @@ { "name": "babel-code-frame", - "version": "6.20.0", + "version": "6.22.0", "description": "Generate errors that contain a code frame that point to source locations.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index cff80e6a2d..0e62b668a5 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.21.0", + "version": "6.22.0", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -25,15 +25,15 @@ "test": "make test" }, "dependencies": { - "babel-code-frame": "^6.20.0", - "babel-generator": "^6.21.0", - "babel-helpers": "^6.16.0", - "babel-messages": "^6.8.0", - "babel-template": "^6.16.0", - "babel-runtime": "^6.20.0", - "babel-register": "^6.18.0", - "babel-traverse": "^6.21.0", - "babel-types": "^6.21.0", + "babel-code-frame": "^6.22.0", + "babel-generator": "^6.22.0", + "babel-helpers": "^6.22.0", + "babel-messages": "^6.22.0", + "babel-template": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-register": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-types": "^6.22.0", "babylon": "^6.11.0", "convert-source-map": "^1.1.0", "debug": "^2.1.1", @@ -46,8 +46,8 @@ "source-map": "^0.5.0" }, "devDependencies": { - "babel-helper-fixtures": "^6.20.0", - "babel-helper-transform-fixture-test-runner": "^6.21.0", - "babel-polyfill": "^6.20.0" + "babel-helper-fixtures": "^6.22.0", + "babel-helper-transform-fixture-test-runner": "^6.22.0", + "babel-polyfill": "^6.22.0" } } diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 3a1dc1ab2a..418f105dc6 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "babel-generator", - "version": "6.21.0", + "version": "6.22.0", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,16 +11,16 @@ "lib" ], "dependencies": { - "babel-messages": "^6.8.0", - "babel-runtime": "^6.20.0", - "babel-types": "^6.21.0", + "babel-messages": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0", "detect-indent": "^4.0.0", "jsesc": "^1.3.0", "lodash": "^4.2.0", "source-map": "^0.5.0" }, "devDependencies": { - "babel-helper-fixtures": "^6.20.0", + "babel-helper-fixtures": "^6.22.0", "babylon": "^6.11.0" } } diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index 65d88770a2..ba8d4b6ed3 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-bindify-decorators", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to bindify decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index 3dabe28676..1170a03986 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-builder-binary-assignment-operator-visitor", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to build binary assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-explode-assignable-expression": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-helper-explode-assignable-expression": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json index 5ef4606b9e..d693b0dab6 100644 --- a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-builder-conditional-assignment-operator-visitor", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to build conditional assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-conditional-assignment-operator-visitor", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-explode-assignable-expression": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-helper-explode-assignable-expression": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index d9877f0fe9..96eda6166a 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-builder-react-jsx", - "version": "6.21.1", + "version": "6.22.0", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.9.0", - "babel-types": "^6.21.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0", "esutils": "^2.0.0", "lodash": "^4.2.0" } diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index d0f5ae0986..258f15ebef 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -1,14 +1,14 @@ { "name": "babel-helper-call-delegate", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to call delegate", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0", - "babel-helper-hoist-variables": "^6.18.0" + "babel-traverse": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0", + "babel-helper-hoist-variables": "^6.22.0" } } diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index a417778656..615b8f7a05 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,14 +1,14 @@ { "name": "babel-helper-define-map", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.9.0", + "babel-runtime": "^6.22.0", "lodash": "^4.2.0", - "babel-types": "^6.18.0", - "babel-helper-function-name": "^6.18.0" + "babel-types": "^6.22.0", + "babel-helper-function-name": "^6.22.0" } } diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index 61accc3d91..5baba21edd 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-explode-assignable-expression", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to explode an assignable expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-traverse": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index b1c339f57a..0bbd09cc0a 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -1,14 +1,14 @@ { "name": "babel-helper-explode-class", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to explode class", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0", - "babel-helper-bindify-decorators": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-types": "^6.22.0", + "babel-helper-bindify-decorators": "^6.22.0" } } diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index 974ea43217..f02d590a3e 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-fixtures", - "version": "6.20.0", + "version": "6.22.0", "description": "Helper function to support fixtures", "author": "Sebastian McKenzie ", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-fixtures", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.20.0", + "babel-runtime": "^6.22.0", "lodash": "^4.2.0", "try-resolve": "^1.0.0" } diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index af03cdcd9d..a6482601d9 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,15 +1,15 @@ { "name": "babel-helper-function-name", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0", - "babel-traverse": "^6.18.0", - "babel-helper-get-function-arity": "^6.18.0", - "babel-template": "^6.8.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-helper-get-function-arity": "^6.22.0", + "babel-template": "^6.22.0" } } diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index 29f7cb4734..d6878a1758 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-get-function-arity", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to get function arity", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index 1fdc14f062..6d303b2765 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-hoist-variables", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to hoist variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index 9e2f16c49e..a033ad6dd9 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-optimise-call-expression", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index 2d8ff34519..c8b0dfa1f2 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-plugin-test-runner", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to support test runner", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-helper-transform-fixture-test-runner": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-helper-transform-fixture-test-runner": "^6.22.0" } } diff --git a/packages/babel-helper-regex/package.json b/packages/babel-helper-regex/package.json index 787533a89e..0a3e92f249 100644 --- a/packages/babel-helper-regex/package.json +++ b/packages/babel-helper-regex/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-regex", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to check for literal RegEx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.9.0", + "babel-runtime": "^6.22.0", "lodash": "^4.2.0", - "babel-types": "^6.18.0" + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index 0e633745d6..e1ec449760 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -1,15 +1,15 @@ { "name": "babel-helper-remap-async-to-generator", - "version": "6.20.3", + "version": "6.22.0", "description": "Helper function to remap async functions to generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.20.0", - "babel-template": "^6.16.0", - "babel-types": "^6.20.0", - "babel-traverse": "^6.20.0", - "babel-helper-function-name": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-template": "^6.22.0", + "babel-types": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-helper-function-name": "^6.22.0" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index a9da5aa291..e9fd9c65eb 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,16 +1,16 @@ { "name": "babel-helper-replace-supers", - "version": "6.18.0", + "version": "6.22.0", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-traverse": "^6.18.0", - "babel-messages": "^6.8.0", - "babel-template": "^6.16.0", - "babel-types": "^6.18.0" + "babel-helper-optimise-call-expression": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-messages": "^6.22.0", + "babel-template": "^6.22.0", + "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index b95f3b57d4..61e7603096 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-transform-fixture-test-runner", - "version": "6.21.0", + "version": "6.22.0", "description": "Transform test runner for babel-helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,12 +8,12 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.20.0", - "babel-core": "^6.21.0", - "babel-polyfill": "^6.20.0", - "babel-helper-fixtures": "^6.20.0", + "babel-runtime": "^6.22.0", + "babel-core": "^6.22.0", + "babel-polyfill": "^6.22.0", + "babel-helper-fixtures": "^6.22.0", "source-map": "^0.5.0", - "babel-code-frame": "^6.20.0", + "babel-code-frame": "^6.22.0", "chai": "^3.0.0", "lodash": "^4.2.0" } diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index 645ca47f51..a88c869426 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "babel-helpers", - "version": "6.16.0", + "version": "6.22.0", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0", - "babel-template": "^6.16.0" + "babel-runtime": "^6.22.0", + "babel-template": "^6.22.0" } } diff --git a/packages/babel-messages/package.json b/packages/babel-messages/package.json index 5f621dc458..13f11c756a 100644 --- a/packages/babel-messages/package.json +++ b/packages/babel-messages/package.json @@ -1,6 +1,6 @@ { "name": "babel-messages", - "version": "6.8.0", + "version": "6.22.0", "description": "Collection of debug messages used by Babel.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,6 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-messages", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" } } diff --git a/packages/babel-plugin-check-es2015-constants/package.json b/packages/babel-plugin-check-es2015-constants/package.json index 7c9a0ac58b..b335fbf3f8 100644 --- a/packages/babel-plugin-check-es2015-constants/package.json +++ b/packages/babel-plugin-check-es2015-constants/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-check-es2015-constants", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 constants to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-check-es2015-constants", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index c03298e29a..c178ef6555 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-external-helpers", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin contains helper functions that’ll be placed at the top of the generated code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-external-helpers", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-syntax-trailing-function-commas/package.json b/packages/babel-plugin-syntax-trailing-function-commas/package.json index 74d448be81..174e92d096 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/package.json +++ b/packages/babel-plugin-syntax-trailing-function-commas/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-trailing-function-commas", - "version": "6.20.0", + "version": "6.22.0", "description": "Compile trailing function commas to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-trailing-function-commas", "license": "MIT", @@ -10,6 +10,6 @@ ], "dependencies": {}, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-async-functions/package.json b/packages/babel-plugin-transform-async-functions/package.json index 779c3bcf2e..98f9ad738b 100644 --- a/packages/babel-plugin-transform-async-functions/package.json +++ b/packages/babel-plugin-transform-async-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-functions", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile async functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-functions", "license": "MIT", @@ -10,9 +10,9 @@ ], "dependencies": { "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-async-generator-functions/package.json b/packages/babel-plugin-transform-async-generator-functions/package.json index ecd3a8d0d9..0fdff521fb 100644 --- a/packages/babel-plugin-transform-async-generator-functions/package.json +++ b/packages/babel-plugin-transform-async-generator-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-generator-functions", - "version": "6.17.0", + "version": "6.22.0", "description": "Turn async generator functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-generator-functions", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-remap-async-to-generator": "^6.16.2", + "babel-helper-remap-async-to-generator": "^6.22.0", "babel-plugin-syntax-async-generators": "^6.5.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.3.13" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index caadd159e7..9dcbc1e179 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-to-generator", - "version": "6.16.0", + "version": "6.22.0", "description": "Turn async functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-remap-async-to-generator": "^6.16.0", + "babel-helper-remap-async-to-generator": "^6.22.0", "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-async-to-module-method/package.json b/packages/babel-plugin-transform-async-to-module-method/package.json index d867a68fb4..1d5029e79b 100644 --- a/packages/babel-plugin-transform-async-to-module-method/package.json +++ b/packages/babel-plugin-transform-async-to-module-method/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-to-module-method", - "version": "6.16.0", + "version": "6.22.0", "description": "Turn async functions into a module method", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-module-method", "license": "MIT", @@ -10,11 +10,11 @@ ], "dependencies": { "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-helper-remap-async-to-generator": "^6.16.0", - "babel-types": "^6.16.0", - "babel-runtime": "^6.0.0" + "babel-helper-remap-async-to-generator": "^6.22.0", + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-class-constructor-call/package.json b/packages/babel-plugin-transform-class-constructor-call/package.json index ccf696c3da..b150c05137 100644 --- a/packages/babel-plugin-transform-class-constructor-call/package.json +++ b/packages/babel-plugin-transform-class-constructor-call/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-class-constructor-call", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin allows Babel to transform class constructors (deprecated)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-class-constructor-call", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-template": "^6.8.0", + "babel-template": "^6.22.0", "babel-plugin-syntax-class-constructor-call": "^6.18.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-class-properties/package.json b/packages/babel-plugin-transform-class-properties/package.json index 63288d330a..6bb3fd5012 100644 --- a/packages/babel-plugin-transform-class-properties/package.json +++ b/packages/babel-plugin-transform-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-class-properties", - "version": "6.19.0", + "version": "6.22.0", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-class-properties", "license": "MIT", @@ -9,12 +9,12 @@ "babel-plugin" ], "dependencies": { - "babel-helper-function-name": "^6.18.0", + "babel-helper-function-name": "^6.22.0", "babel-plugin-syntax-class-properties": "^6.8.0", - "babel-runtime": "^6.9.1", - "babel-template": "^6.15.0" + "babel-runtime": "^6.22.0", + "babel-template": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index f8f1b5c5ca..e8df3a76d0 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-decorators", - "version": "6.13.0", + "version": "6.22.0", "description": "Compile class and object decorators to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-decorators", "license": "MIT", @@ -9,13 +9,13 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.13.0", + "babel-types": "^6.22.0", "babel-plugin-syntax-decorators": "^6.13.0", - "babel-helper-explode-class": "^6.8.0", - "babel-template": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-helper-explode-class": "^6.22.0", + "babel-template": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-do-expressions/package.json b/packages/babel-plugin-transform-do-expressions/package.json index 401176ed10..7df5dc01b7 100644 --- a/packages/babel-plugin-transform-do-expressions/package.json +++ b/packages/babel-plugin-transform-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-do-expressions", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile do expressions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-do-expressions", "license": "MIT", @@ -10,9 +10,9 @@ ], "dependencies": { "babel-plugin-syntax-do-expressions": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/package.json b/packages/babel-plugin-transform-es2015-arrow-functions/package.json index 766e4b851b..0db0959e50 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/package.json +++ b/packages/babel-plugin-transform-es2015-arrow-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-arrow-functions", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 arrow functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-arrow-functions", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json index db3b0a0318..922e711887 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-block-scoped-functions", - "version": "6.8.0", + "version": "6.22.0", "description": "Babel plugin to ensure function declarations at the block level are block scoped", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-block-scoped-functions", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/package.json b/packages/babel-plugin-transform-es2015-block-scoping/package.json index d8dd65f9a5..15bedf9241 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoping/package.json @@ -1,21 +1,21 @@ { "name": "babel-plugin-transform-es2015-block-scoping", - "version": "6.21.0", + "version": "6.22.0", "description": "Compile ES2015 block scoping (const and let) to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-block-scoping", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.21.0", - "babel-types": "^6.21.0", - "babel-template": "^6.15.0", + "babel-traverse": "^6.22.0", + "babel-types": "^6.22.0", + "babel-template": "^6.22.0", "lodash": "^4.2.0", - "babel-runtime": "^6.20.0" + "babel-runtime": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-classes/package.json b/packages/babel-plugin-transform-es2015-classes/package.json index 43e0d24ef8..7288800d7e 100644 --- a/packages/babel-plugin-transform-es2015-classes/package.json +++ b/packages/babel-plugin-transform-es2015-classes/package.json @@ -1,25 +1,25 @@ { "name": "babel-plugin-transform-es2015-classes", - "version": "6.18.0", + "version": "6.22.0", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-classes", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.18.0", - "babel-helper-function-name": "^6.18.0", - "babel-helper-replace-supers": "^6.18.0", - "babel-template": "^6.14.0", - "babel-traverse": "^6.18.0", - "babel-helper-define-map": "^6.18.0", - "babel-messages": "^6.8.0", - "babel-runtime": "^6.9.0", - "babel-types": "^6.18.0" + "babel-helper-optimise-call-expression": "^6.22.0", + "babel-helper-function-name": "^6.22.0", + "babel-helper-replace-supers": "^6.22.0", + "babel-template": "^6.22.0", + "babel-traverse": "^6.22.0", + "babel-helper-define-map": "^6.22.0", + "babel-messages": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-computed-properties/package.json b/packages/babel-plugin-transform-es2015-computed-properties/package.json index 62deca861f..5eb95c5463 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/package.json +++ b/packages/babel-plugin-transform-es2015-computed-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-computed-properties", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 computed properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-computed-properties", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-template": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-template": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-destructuring/package.json b/packages/babel-plugin-transform-es2015-destructuring/package.json index 2d8f9fc233..1eb1c832d7 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/package.json +++ b/packages/babel-plugin-transform-es2015-destructuring/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-destructuring", - "version": "6.19.0", + "version": "6.22.0", "description": "Compile ES2015 destructuring to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-destructuring", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json index 80f4a294b5..6b67a6e48d 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-duplicate-keys", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile objects with duplicate keys to valid strict ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-duplicate-keys", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.8.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-for-of/package.json b/packages/babel-plugin-transform-es2015-for-of/package.json index 37d0d82808..5c1aa3b7e4 100644 --- a/packages/babel-plugin-transform-es2015-for-of/package.json +++ b/packages/babel-plugin-transform-es2015-for-of/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-for-of", - "version": "6.18.0", + "version": "6.22.0", "description": "Compile ES2015 for...of to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-for-of", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-function-name/package.json b/packages/babel-plugin-transform-es2015-function-name/package.json index 291bd84c7b..27d81478bc 100644 --- a/packages/babel-plugin-transform-es2015-function-name/package.json +++ b/packages/babel-plugin-transform-es2015-function-name/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-function-name", - "version": "6.9.0", + "version": "6.22.0", "description": "Apply ES2015 function.name semantics to all functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-function-name", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-function-name": "^6.8.0", - "babel-types": "^6.9.0", - "babel-runtime": "^6.9.0" + "babel-helper-function-name": "^6.22.0", + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-instanceof/package.json b/packages/babel-plugin-transform-es2015-instanceof/package.json index f597d17ec3..7f214ad6ac 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/package.json +++ b/packages/babel-plugin-transform-es2015-instanceof/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-instanceof", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin transforms all the ES2015 'instanceof' methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-instanceof", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-literals/package.json b/packages/babel-plugin-transform-es2015-literals/package.json index 0d3047c0e0..f99175fe37 100644 --- a/packages/babel-plugin-transform-es2015-literals/package.json +++ b/packages/babel-plugin-transform-es2015-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-literals", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 unicode string and number literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-literals", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/package.json b/packages/babel-plugin-transform-es2015-modules-amd/package.json index d17ea42bb0..81560058ad 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-amd/package.json @@ -1,19 +1,19 @@ { "name": "babel-plugin-transform-es2015-modules-amd", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin transforms ES2015 modules to AMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-amd", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", - "babel-template": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", + "babel-template": "^6.22.0", + "babel-runtime": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json index bc8f84282f..d27c57c5af 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json @@ -1,20 +1,20 @@ { "name": "babel-plugin-transform-es2015-modules-commonjs", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-commonjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.18.0", - "babel-runtime": "^6.0.0", - "babel-template": "^6.16.0", - "babel-plugin-transform-strict-mode": "^6.18.0" + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.22.0", + "babel-plugin-transform-strict-mode": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json index 7a9e82b159..4a2955ebfc 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json @@ -1,20 +1,20 @@ { "name": "babel-plugin-transform-es2015-modules-systemjs", - "version": "6.19.0", + "version": "6.22.0", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-systemjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-template": "^6.14.0", - "babel-helper-hoist-variables": "^6.18.0", - "babel-runtime": "^6.11.6" + "babel-template": "^6.22.0", + "babel-helper-hoist-variables": "^6.22.0", + "babel-runtime": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0", + "babel-helper-plugin-test-runner": "^6.22.0", "babel-plugin-syntax-dynamic-import": "^6.18.0" } } diff --git a/packages/babel-plugin-transform-es2015-modules-umd/package.json b/packages/babel-plugin-transform-es2015-modules-umd/package.json index a41001b674..1fc3b03b9b 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-umd/package.json @@ -1,19 +1,19 @@ { "name": "babel-plugin-transform-es2015-modules-umd", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-umd", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-es2015-modules-amd": "^6.18.0", - "babel-template": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-plugin-transform-es2015-modules-amd": "^6.22.0", + "babel-template": "^6.22.0", + "babel-runtime": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-object-super/package.json b/packages/babel-plugin-transform-es2015-object-super/package.json index a9e61b0cb1..df33b3d904 100644 --- a/packages/babel-plugin-transform-es2015-object-super/package.json +++ b/packages/babel-plugin-transform-es2015-object-super/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-object-super", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 object super to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-object-super", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-replace-supers": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-helper-replace-supers": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-parameters/package.json b/packages/babel-plugin-transform-es2015-parameters/package.json index 9b3ede5825..4715c8086b 100644 --- a/packages/babel-plugin-transform-es2015-parameters/package.json +++ b/packages/babel-plugin-transform-es2015-parameters/package.json @@ -1,22 +1,22 @@ { "name": "babel-plugin-transform-es2015-parameters", - "version": "6.21.0", + "version": "6.22.0", "description": "Compile ES2015 default and rest parameters to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-parameters", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.21.0", - "babel-helper-call-delegate": "^6.18.0", - "babel-helper-get-function-arity": "^6.18.0", - "babel-template": "^6.16.0", - "babel-types": "^6.21.0", - "babel-runtime": "^6.9.0" + "babel-traverse": "^6.22.0", + "babel-helper-call-delegate": "^6.22.0", + "babel-helper-get-function-arity": "^6.22.0", + "babel-template": "^6.22.0", + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json index 34d8b72f7e..f3d831b323 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-shorthand-properties", - "version": "6.18.0", + "version": "6.22.0", "description": "Compile ES2015 shorthand properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-shorthand-properties", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.18.0", - "babel-runtime": "^6.0.0" + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-spread/package.json b/packages/babel-plugin-transform-es2015-spread/package.json index f2809d2374..f852ac3186 100644 --- a/packages/babel-plugin-transform-es2015-spread/package.json +++ b/packages/babel-plugin-transform-es2015-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-spread", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-spread", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/package.json b/packages/babel-plugin-transform-es2015-sticky-regex/package.json index 2903d76e48..066ca612df 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/package.json +++ b/packages/babel-plugin-transform-es2015-sticky-regex/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-sticky-regex", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 sticky regex to an ES5 RegExp constructor", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-sticky-regex", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-regex": "^6.8.0", - "babel-types": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-helper-regex": "^6.22.0", + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-template-literals/package.json b/packages/babel-plugin-transform-es2015-template-literals/package.json index 5791baed70..e24bb6d91c 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/package.json +++ b/packages/babel-plugin-transform-es2015-template-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-template-literals", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES2015 template literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-template-literals", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json index ba886f993f..db7ba27eb0 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-typeof-symbol", - "version": "6.18.0", + "version": "6.22.0", "description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-typeof-symbol", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/package.json b/packages/babel-plugin-transform-es2015-unicode-regex/package.json index 4872b046a5..116b9035f3 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/package.json +++ b/packages/babel-plugin-transform-es2015-unicode-regex/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-unicode-regex", - "version": "6.11.0", + "version": "6.22.0", "description": "Compile ES2015 Unicode regex to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-unicode-regex", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-regex": "^6.8.0", - "babel-runtime": "^6.0.0", + "babel-helper-regex": "^6.22.0", + "babel-runtime": "^6.22.0", "regexpu-core": "^2.0.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/package.json b/packages/babel-plugin-transform-es3-member-expression-literals/package.json index 3f25880c4e..4fcbd64c14 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-es3-member-expression-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es3-member-expression-literals", - "version": "6.8.0", + "version": "6.22.0", "description": "Ensure that reserved words are quoted in property accesses", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es3-member-expression-literals", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es3-property-literals/package.json b/packages/babel-plugin-transform-es3-property-literals/package.json index 43ec94a753..7409bed336 100644 --- a/packages/babel-plugin-transform-es3-property-literals/package.json +++ b/packages/babel-plugin-transform-es3-property-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es3-property-literals", - "version": "6.8.0", + "version": "6.22.0", "description": "Ensure that reserved words are quoted in object property keys", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es3-property-literals", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-es5-property-mutators/package.json b/packages/babel-plugin-transform-es5-property-mutators/package.json index 9e411e0d98..b2cdbb72e7 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/package.json +++ b/packages/babel-plugin-transform-es5-property-mutators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es5-property-mutators", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile ES5 property mutator shorthand syntax to Object.defineProperty", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es5-property-mutators", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-define-map": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-helper-define-map": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-eval/package.json b/packages/babel-plugin-transform-eval/package.json index 61a511bf0e..bccdad7b70 100644 --- a/packages/babel-plugin-transform-eval/package.json +++ b/packages/babel-plugin-transform-eval/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-eval", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile eval calls with string literals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-eval", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index d50b5908d2..17b67800e9 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-exponentiation-operator", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile exponentiation operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator", "license": "MIT", @@ -10,10 +10,10 @@ ], "dependencies": { "babel-plugin-syntax-exponentiation-operator": "^6.8.0", - "babel-helper-builder-binary-assignment-operator-visitor": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-helper-builder-binary-assignment-operator-visitor": "^6.22.0", + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-export-extensions/package.json b/packages/babel-plugin-transform-export-extensions/package.json index 88bb380f8e..d46c645073 100644 --- a/packages/babel-plugin-transform-export-extensions/package.json +++ b/packages/babel-plugin-transform-export-extensions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-export-extensions", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile export extensions to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-export-extensions", "license": "MIT", @@ -10,9 +10,9 @@ ], "dependencies": { "babel-plugin-syntax-export-extensions": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index 39ab99a2f2..b6cc439158 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-flow-comments", - "version": "6.21.0", + "version": "6.22.0", "description": "Turn flow type annotations into comments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-comments", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", + "babel-runtime": "^6.22.0", "babel-plugin-syntax-flow": "^6.8.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index 441d32c50a..58647d4487 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-flow-strip-types", - "version": "6.21.0", + "version": "6.22.0", "description": "Strip flow type annotations from your output code.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-strip-types", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", + "babel-runtime": "^6.22.0", "babel-plugin-syntax-flow": "^6.18.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-function-bind/package.json b/packages/babel-plugin-transform-function-bind/package.json index 872891dc4c..1aa3363dc9 100644 --- a/packages/babel-plugin-transform-function-bind/package.json +++ b/packages/babel-plugin-transform-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-function-bind", - "version": "6.8.0", + "version": "6.22.0", "description": "Compile function bind operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-bind", "license": "MIT", @@ -10,9 +10,9 @@ ], "dependencies": { "babel-plugin-syntax-function-bind": "^6.8.0", - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 427c2645cb..5b6d73e62b 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-jscript", - "version": "6.8.0", + "version": "6.22.0", "description": "Babel plugin to fix buggy JScript named function expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jscript", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index f68603e5a6..c024adffff 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-assign", - "version": "6.8.0", + "version": "6.22.0", "description": "Replace Object.assign with an inline helper", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-assign", "author": "Jed Watson", @@ -10,9 +10,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-object-rest-spread/package.json b/packages/babel-plugin-transform-object-rest-spread/package.json index 572fc9c516..9052c3e695 100644 --- a/packages/babel-plugin-transform-object-rest-spread/package.json +++ b/packages/babel-plugin-transform-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-rest-spread", - "version": "6.20.2", + "version": "6.22.0", "description": "Compile object rest and spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread", "license": "MIT", @@ -10,9 +10,9 @@ ], "dependencies": { "babel-plugin-syntax-object-rest-spread": "^6.8.0", - "babel-runtime": "^6.20.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index 62bdee5e52..a78df644be 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-set-prototype-of-to-assign", - "version": "6.8.0", + "version": "6.22.0", "description": "Turn Object.setPrototypeOf to assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-set-prototype-of-to-assign", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index 7613bff4b2..e26181cc7b 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-proto-to-assign", - "version": "6.9.0", + "version": "6.22.0", "description": "Babel plugin for turning __proto__ into a shallow property clone", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.0", + "babel-runtime": "^6.22.0", "lodash": "^4.2.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index 144dc0f8a8..fe30acd07f 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-constant-elements", - "version": "6.9.1", + "version": "6.22.0", "description": "Treat React JSX elements as value types and hoist them to the highest scope", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.1" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 03acc9556a..e08f45f41b 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-display-name", - "version": "6.8.0", + "version": "6.22.0", "description": "Add displayName to React.createClass calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-display-name", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/package.json b/packages/babel-plugin-transform-react-inline-elements/package.json index 2d69aca9a4..2fe071ba14 100644 --- a/packages/babel-plugin-transform-react-inline-elements/package.json +++ b/packages/babel-plugin-transform-react-inline-elements/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-inline-elements", - "version": "6.8.0", + "version": "6.22.0", "description": "Turn JSX elements into exploded React objects", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-inline-elements", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index fef317568b..7b853f1a64 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-compat", - "version": "6.8.0", + "version": "6.22.0", "description": "Turn JSX into React Pre-0.12 function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-compat", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", - "babel-helper-builder-react-jsx": "^6.8.0" + "babel-runtime": "^6.22.0", + "babel-helper-builder-react-jsx": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index 655bf9f9c2..45f1018b3f 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-self", - "version": "6.11.0", + "version": "6.22.0", "description": "Add a __self prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.0", + "babel-runtime": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index fa5674b673..e7e5c87747 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-source", - "version": "6.9.0", + "version": "6.22.0", "description": "Add a __source prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.0", + "babel-runtime": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index fd57cffaa3..0b242a701e 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx", - "version": "6.8.0", + "version": "6.22.0", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", - "babel-helper-builder-react-jsx": "^6.8.0", + "babel-runtime": "^6.22.0", + "babel-helper-builder-react-jsx": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index a44902ca1d..39d2c085bc 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -2,7 +2,7 @@ "name": "babel-plugin-transform-regenerator", "author": "Ben Newman ", "description": "Explode async and generator functions into a state machine.", - "version": "6.21.0", + "version": "6.22.0", "homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "main": "lib/index.js", @@ -11,6 +11,6 @@ }, "license": "MIT", "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index eb6ef08fbf..9f01577ebd 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-runtime", - "version": "6.15.0", + "version": "6.22.0", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.9.0" + "babel-runtime": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index 679eaaee9a..c006ccf966 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-strict-mode", - "version": "6.18.0", + "version": "6.22.0", "description": "This plugin places a 'use strict'; directive at the top of all files to enable strict mode", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-strict-mode", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", - "babel-types": "^6.18.0" + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-plugin-undeclared-variables-check/package.json b/packages/babel-plugin-undeclared-variables-check/package.json index 5ecc97376a..36566b54bc 100644 --- a/packages/babel-plugin-undeclared-variables-check/package.json +++ b/packages/babel-plugin-undeclared-variables-check/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-undeclared-variables-check", - "version": "6.8.0", + "version": "6.22.0", "description": "Throw a compile-time error on references to undeclared variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-undeclared-variables-check", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.0.0", + "babel-runtime": "^6.22.0", "leven": "^1.0.2" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 15cd6f4379..5e74561a7a 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "babel-polyfill", - "version": "6.20.0", + "version": "6.22.0", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,7 +9,7 @@ "main": "lib/index.js", "dependencies": { "core-js": "^2.4.0", - "babel-runtime": "^6.20.0", + "babel-runtime": "^6.22.0", "regenerator-runtime": "^0.10.0" } } diff --git a/packages/babel-preset-es2015/package.json b/packages/babel-preset-es2015/package.json index 0c8384381e..78d66ad217 100644 --- a/packages/babel-preset-es2015/package.json +++ b/packages/babel-preset-es2015/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2015", - "version": "6.18.0", + "version": "6.22.0", "description": "Babel preset for all es2015 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,33 +8,33 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2015", "main": "lib/index.js", "dependencies": { - "babel-plugin-check-es2015-constants": "^6.3.13", - "babel-plugin-transform-es2015-arrow-functions": "^6.3.13", - "babel-plugin-transform-es2015-block-scoped-functions": "^6.3.13", - "babel-plugin-transform-es2015-block-scoping": "^6.18.0", - "babel-plugin-transform-es2015-classes": "^6.18.0", - "babel-plugin-transform-es2015-computed-properties": "^6.3.13", - "babel-plugin-transform-es2015-destructuring": "^6.18.0", - "babel-plugin-transform-es2015-duplicate-keys": "^6.6.0", - "babel-plugin-transform-es2015-for-of": "^6.18.0", - "babel-plugin-transform-es2015-function-name": "^6.9.0", - "babel-plugin-transform-es2015-literals": "^6.3.13", - "babel-plugin-transform-es2015-modules-amd": "^6.18.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0", - "babel-plugin-transform-es2015-modules-systemjs": "^6.18.0", - "babel-plugin-transform-es2015-modules-umd": "^6.18.0", - "babel-plugin-transform-es2015-object-super": "^6.3.13", - "babel-plugin-transform-es2015-parameters": "^6.18.0", - "babel-plugin-transform-es2015-shorthand-properties": "^6.18.0", - "babel-plugin-transform-es2015-spread": "^6.3.13", - "babel-plugin-transform-es2015-sticky-regex": "^6.3.13", - "babel-plugin-transform-es2015-template-literals": "^6.6.0", - "babel-plugin-transform-es2015-typeof-symbol": "^6.18.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.3.13", - "babel-plugin-transform-regenerator": "^6.16.0" + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.22.0", + "babel-plugin-transform-es2015-classes": "^6.22.0", + "babel-plugin-transform-es2015-computed-properties": "^6.22.0", + "babel-plugin-transform-es2015-destructuring": "^6.22.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.22.0", + "babel-plugin-transform-es2015-for-of": "^6.22.0", + "babel-plugin-transform-es2015-function-name": "^6.22.0", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.22.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", + "babel-plugin-transform-es2015-modules-systemjs": "^6.22.0", + "babel-plugin-transform-es2015-modules-umd": "^6.22.0", + "babel-plugin-transform-es2015-object-super": "^6.22.0", + "babel-plugin-transform-es2015-parameters": "^6.22.0", + "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.22.0", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", + "babel-plugin-transform-regenerator": "^6.22.0" }, "devDependencies": { - "babel-helper-transform-fixture-test-runner": "^6.18.0", - "babel-helper-plugin-test-runner": "^6.18.0" + "babel-helper-transform-fixture-test-runner": "^6.22.0", + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-preset-es2016/package.json b/packages/babel-preset-es2016/package.json index a467e23cb5..9df7e0dfd8 100644 --- a/packages/babel-preset-es2016/package.json +++ b/packages/babel-preset-es2016/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2016", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset for all es2016 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,6 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2016", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-exponentiation-operator": "^6.3.13" + "babel-plugin-transform-exponentiation-operator": "^6.22.0" } } diff --git a/packages/babel-preset-es2017/package.json b/packages/babel-preset-es2017/package.json index cee5d6e8b2..2db56d5ae4 100644 --- a/packages/babel-preset-es2017/package.json +++ b/packages/babel-preset-es2017/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2017", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset for all es2017 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2017", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-trailing-function-commas": "^6.8.0", - "babel-plugin-transform-async-to-generator": "^6.16.0" + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.22.0" } } diff --git a/packages/babel-preset-latest/package.json b/packages/babel-preset-latest/package.json index 743b60c59b..f5a306981d 100644 --- a/packages/babel-preset-latest/package.json +++ b/packages/babel-preset-latest/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-latest", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset including es2015+", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,11 +8,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-latest", "main": "lib/index.js", "dependencies": { - "babel-preset-es2015": "^6.16.0", - "babel-preset-es2016": "^6.16.0", - "babel-preset-es2017": "^6.16.0" + "babel-preset-es2015": "^6.22.0", + "babel-preset-es2016": "^6.22.0", + "babel-preset-es2017": "^6.22.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.8.0" + "babel-helper-plugin-test-runner": "^6.22.0" } } diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index 984aca9053..378b3a0456 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -10,10 +10,10 @@ "dependencies": { "babel-plugin-syntax-flow": "^6.3.13", "babel-plugin-syntax-jsx": "^6.3.13", - "babel-plugin-transform-flow-strip-types": "^6.3.13", - "babel-plugin-transform-react-display-name": "^6.3.13", - "babel-plugin-transform-react-jsx": "^6.3.13", - "babel-plugin-transform-react-jsx-source": "^6.3.13", - "babel-plugin-transform-react-jsx-self": "^6.11.0" + "babel-plugin-transform-flow-strip-types": "^6.22.0", + "babel-plugin-transform-react-display-name": "^6.22.0", + "babel-plugin-transform-react-jsx": "^6.22.0", + "babel-plugin-transform-react-jsx-source": "^6.22.0", + "babel-plugin-transform-react-jsx-self": "^6.22.0" } } diff --git a/packages/babel-preset-stage-0/package.json b/packages/babel-preset-stage-0/package.json index 8fececabc1..398e12bc61 100644 --- a/packages/babel-preset-stage-0/package.json +++ b/packages/babel-preset-stage-0/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-0", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset for stage 0 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,8 +8,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-0", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-do-expressions": "^6.3.13", - "babel-plugin-transform-function-bind": "^6.3.13", - "babel-preset-stage-1": "^6.16.0" + "babel-plugin-transform-do-expressions": "^6.22.0", + "babel-plugin-transform-function-bind": "^6.22.0", + "babel-preset-stage-1": "^6.22.0" } } diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index 63a34a5cf3..7ba8cdaffd 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-1", - "version": "6.16.0", + "version": "6.22.0", "description": "Babel preset for stage 1 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,8 +8,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-class-constructor-call": "^6.3.13", - "babel-plugin-transform-export-extensions": "^6.3.13", - "babel-preset-stage-2": "^6.16.0" + "babel-plugin-transform-class-constructor-call": "^6.22.0", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-preset-stage-2": "^6.22.0" } } diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json index bd93ad2a13..b47b116be7 100644 --- a/packages/babel-preset-stage-2/package.json +++ b/packages/babel-preset-stage-2/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-2", - "version": "6.18.0", + "version": "6.22.0", "description": "Babel preset for stage 2 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,9 +8,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-class-properties": "^6.18.0", - "babel-plugin-transform-decorators": "^6.13.0", + "babel-plugin-transform-class-properties": "^6.22.0", + "babel-plugin-transform-decorators": "^6.22.0", "babel-plugin-syntax-dynamic-import": "^6.18.0", - "babel-preset-stage-3": "^6.17.0" + "babel-preset-stage-3": "^6.22.0" } } diff --git a/packages/babel-preset-stage-3/package.json b/packages/babel-preset-stage-3/package.json index 9a39f1a46b..256406caed 100644 --- a/packages/babel-preset-stage-3/package.json +++ b/packages/babel-preset-stage-3/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-3", - "version": "6.17.0", + "version": "6.22.0", "description": "Babel preset for stage 3 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,10 +8,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-3", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-trailing-function-commas": "^6.3.13", - "babel-plugin-transform-async-generator-functions": "^6.17.0", - "babel-plugin-transform-async-to-generator": "^6.16.0", - "babel-plugin-transform-exponentiation-operator": "^6.3.13", - "babel-plugin-transform-object-rest-spread": "^6.16.0" + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-generator-functions": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-exponentiation-operator": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.22.0" } } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index b2b25e9cd9..de6c6897fd 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "babel-register", - "version": "6.18.0", + "version": "6.22.0", "description": "babel require hook", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-register", @@ -8,8 +8,8 @@ "main": "lib/node.js", "browser": "lib/browser.js", "dependencies": { - "babel-core": "^6.18.0", - "babel-runtime": "^6.11.6", + "babel-core": "^6.22.0", + "babel-runtime": "^6.22.0", "core-js": "^2.4.0", "home-or-tmp": "^2.0.0", "lodash": "^4.2.0", diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 73eb96ec15..50c0c37b87 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-runtime", - "version": "6.20.0", + "version": "6.22.0", "description": "babel selfContained runtime", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime", @@ -10,7 +10,7 @@ "regenerator-runtime": "^0.10.0" }, "devDependencies": { - "babel-helpers": "^6.6.0", - "babel-plugin-transform-runtime": "^6.9.0" + "babel-helpers": "^6.22.0", + "babel-plugin-transform-runtime": "^6.22.0" } } diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 4446d9c5d0..956384f9ee 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "babel-template", - "version": "6.16.0", + "version": "6.22.0", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,9 +9,9 @@ "main": "lib/index.js", "dependencies": { "babylon": "^6.11.0", - "babel-traverse": "^6.16.0", - "babel-types": "^6.16.0", - "babel-runtime": "^6.9.0", + "babel-traverse": "^6.22.0", + "babel-types": "^6.22.0", + "babel-runtime": "^6.22.0", "lodash": "^4.2.0" } } diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index b42120c302..cb68f38bf1 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.21.0", + "version": "6.22.0", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,10 +8,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-traverse", "main": "lib/index.js", "dependencies": { - "babel-code-frame": "^6.20.0", - "babel-messages": "^6.8.0", - "babel-runtime": "^6.20.0", - "babel-types": "^6.21.0", + "babel-code-frame": "^6.22.0", + "babel-messages": "^6.22.0", + "babel-runtime": "^6.22.0", + "babel-types": "^6.22.0", "babylon": "^6.15.0", "debug": "^2.2.0", "globals": "^9.0.0", @@ -19,6 +19,6 @@ "lodash": "^4.2.0" }, "devDependencies": { - "babel-generator": "^6.21.0" + "babel-generator": "^6.22.0" } } diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 99172ac9bc..0f8cb8565d 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "babel-types", - "version": "6.21.0", + "version": "6.22.0", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-types", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.20.0", + "babel-runtime": "^6.22.0", "esutils": "^2.0.2", "lodash": "^4.2.0", "to-fast-properties": "^1.0.1" From e2c5a513f6e646d6e088472f394ed33f2e434800 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 20:39:59 -0500 Subject: [PATCH 072/222] Create circle.yml --- circle.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000000..42bf0b0ea2 --- /dev/null +++ b/circle.yml @@ -0,0 +1,8 @@ +machine: + node: + version: + 6 + +test: + override: + - make test-ci From ef25bebfa81a389deb53ab5d0cdc0466197f0179 Mon Sep 17 00:00:00 2001 From: Jason Aslakson Date: Thu, 19 Jan 2017 21:36:18 -0500 Subject: [PATCH 073/222] fix issue #5012 - Cannot read property 'declarations' of null (#5019) - temporary fix --- .../constant-elements/destructure/actual.js | 10 ++++++++++ .../constant-elements/destructure/expected.js | 13 +++++++++++++ .../constant-elements/destructure/options.json | 7 +++++++ packages/babel-traverse/src/path/lib/hoister.js | 7 ++++++- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js new file mode 100644 index 0000000000..fbd1ed5555 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js @@ -0,0 +1,10 @@ +class AnchorLink extends Component { + render() { + const { isExternal, children } = this.props; + if (isExternal) { + return ({children}); + } + + return ({children}); + } +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js new file mode 100644 index 0000000000..4f730edf03 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js @@ -0,0 +1,13 @@ +class AnchorLink extends Component { + render() { + var _props = this.props; + const isExternal = _props.isExternal, + children = _props.children; + + if (isExternal) { + return {children}; + } + + return {children}; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json new file mode 100644 index 0000000000..dc9272a969 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "syntax-jsx", + "transform-es2015-destructuring", + "transform-react-constant-elements" + ] +} diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 8a36031f1e..243e9c18ac 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -121,7 +121,12 @@ export default class PathHoister { do { if (!path.parentPath || (Array.isArray(path.container) && path.isStatement()) || - (path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1)) + ( + path.isVariableDeclarator() && + path.parentPath.node !== null && + path.parentPath.node.declarations.length > 1 + ) + ) return path; } while ((path = path.parentPath)); } From b06763f1a32557542f525904539ccf185ef49739 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 22:09:37 -0500 Subject: [PATCH 074/222] force update core/cli --- packages/babel-cli/package.json | 9 +++++++++ packages/babel-core/package.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index d32f989965..79615f7378 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -6,6 +6,15 @@ "homepage": "https://babeljs.io/", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-cli", + "keywords": [ + "6to5", + "babel", + "es6", + "transpile", + "transpiler", + "babel-cli", + "compiler" + ], "dependencies": { "babel-core": "^6.22.0", "babel-register": "^6.22.0", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 0e62b668a5..877288bc99 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -18,7 +18,8 @@ "transpile", "transpiler", "var", - "babel-core" + "babel-core", + "compiler" ], "scripts": { "bench": "make bench", From 368485828fff8aa0341b779776cc41a013577648 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 22:12:53 -0500 Subject: [PATCH 075/222] v6.22.1 --- lerna.json | 2 +- packages/babel-cli/package.json | 4 ++-- packages/babel-core/package.json | 4 ++-- packages/babel-traverse/package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lerna.json b/lerna.json index 4fc063c9a9..d522a2967d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.22.0", + "version": "6.22.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 79615f7378..a4a9444af0 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "babel-cli", - "version": "6.22.0", + "version": "6.22.1", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -16,7 +16,7 @@ "compiler" ], "dependencies": { - "babel-core": "^6.22.0", + "babel-core": "^6.22.1", "babel-register": "^6.22.0", "babel-polyfill": "^6.22.0", "babel-runtime": "^6.22.0", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 877288bc99..a9cbeb1f8b 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.22.0", + "version": "6.22.1", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -33,7 +33,7 @@ "babel-template": "^6.22.0", "babel-runtime": "^6.22.0", "babel-register": "^6.22.0", - "babel-traverse": "^6.22.0", + "babel-traverse": "^6.22.1", "babel-types": "^6.22.0", "babylon": "^6.11.0", "convert-source-map": "^1.1.0", diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index cb68f38bf1..8066c617a8 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.22.0", + "version": "6.22.1", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From fabfc463f10d57a2397d90f2a0a83921ed4a58d0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 19 Jan 2017 22:17:33 -0500 Subject: [PATCH 076/222] v6.22.1 changelog [skip ci] --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06bc3a24f3..b5fc99aa50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.22.1 (2017-01-19) + +#### :bug: Bug Fix + +Temporary fix with `babel-traverse` via [#5019](https://github.com/babel/babel/pull/5019) for transform-react-constant-elements. + ## 6.22.0 (2017-01-19) A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes! From c468b15a15398d2b6adc0d68fec887f284123c50 Mon Sep 17 00:00:00 2001 From: Shubheksha Jalan Date: Fri, 20 Jan 2017 08:50:04 +0530 Subject: [PATCH 077/222] [7.0] removed old code from transform-runtime (#5142) --- .../src/definitions.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/babel-plugin-transform-runtime/src/definitions.js b/packages/babel-plugin-transform-runtime/src/definitions.js index ce059f9634..64a185b695 100644 --- a/packages/babel-plugin-transform-runtime/src/definitions.js +++ b/packages/babel-plugin-transform-runtime/src/definitions.js @@ -16,7 +16,6 @@ module.exports = { methods: { Array: { - concat: "array/concat", // deprecated copyWithin: "array/copy-within", entries: "array/entries", every: "array/every", @@ -34,17 +33,11 @@ module.exports = { lastIndexOf: "array/last-index-of", map: "array/map", of: "array/of", - pop: "array/pop", // deprecated - push: "array/push", // deprecated reduceRight: "array/reduce-right", reduce: "array/reduce", - reverse: "array/reverse", // deprecated - shift: "array/shift", // deprecated - slice: "array/slice", // deprecated some: "array/some", sort: "array/sort", splice: "array/splice", - unshift: "array/unshift", // deprecated values: "array/values" }, @@ -75,10 +68,6 @@ module.exports = { values: "object/values" }, - RegExp: { - escape: "regexp/escape" // deprecated - }, - Math: { acosh: "math/acosh", asinh: "math/asinh", @@ -128,8 +117,6 @@ module.exports = { fromCodePoint: "string/from-code-point", includes: "string/includes", matchAll: "string/match-all", - padLeft: "string/pad-left", // deprecated - padRight: "string/pad-right", // deprecated padStart: "string/pad-start", padEnd: "string/pad-end", raw: "string/raw", @@ -159,7 +146,6 @@ module.exports = { construct: "reflect/construct", defineProperty: "reflect/define-property", deleteProperty: "reflect/delete-property", - enumerate: "reflect/enumerate", // deprecated getOwnPropertyDescriptor: "reflect/get-own-property-descriptor", getPrototypeOf: "reflect/get-prototype-of", get: "reflect/get", @@ -184,10 +170,6 @@ module.exports = { global: "system/global" }, - Error: { - isError: "error/is-error" // deprecated - }, - Date: { //now: "date/now" // temporary disabled }, From 3a5ce620c82e7b6c58dfea7a094a679630e74d4d Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Fri, 20 Jan 2017 06:22:45 +0300 Subject: [PATCH 078/222] [7.0] Deprecate babel-core/register.js (#5132) * Deprecate babel-core/register.js * add error when using `babel-core/register` --- packages/babel-core/register.js | 4 +--- packages/babel-core/test/fixtures/browserify/register.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/babel-core/register.js b/packages/babel-core/register.js index 97d35f276e..2f32d9baaf 100644 --- a/packages/babel-core/register.js +++ b/packages/babel-core/register.js @@ -1,3 +1 @@ -/* eslint max-len: 0 */ -// TODO: eventually deprecate this console.trace("use the `babel-register` package instead of `babel-core/register`"); -module.exports = require("babel-register"); +throw new Error("`babel-core/register` has been moved to `babel-register`."); diff --git a/packages/babel-core/test/fixtures/browserify/register.js b/packages/babel-core/test/fixtures/browserify/register.js index e1100b136b..21e53a30dd 100644 --- a/packages/babel-core/test/fixtures/browserify/register.js +++ b/packages/babel-core/test/fixtures/browserify/register.js @@ -1,3 +1,3 @@ -require("../../../register")({ +require("babel-register")({ ignore: false }); From d710e6dd5bc486ee7f44021552732133744154b8 Mon Sep 17 00:00:00 2001 From: Chau Nguyen Date: Thu, 19 Jan 2017 19:24:13 -0800 Subject: [PATCH 079/222] [7.0] Drop flowUsesCommas option from babel-generator (#5123) --- packages/babel-generator/README.md | 1 - .../babel-generator/src/generators/flow.js | 6 +----- packages/babel-generator/src/index.js | 3 +-- .../fixtures/flow/call-properties/expected.js | 2 +- .../flow/declare-statements/expected.js | 2 +- .../interfaces-module-and-script/expected.js | 2 +- .../flow/type-annotations/expected.js | 20 +++++++++---------- .../test/fixtures/flow/typecasts/expected.js | 2 +- .../test/fixtures/flowUsesCommas/options.json | 3 --- packages/babel-generator/test/index.js | 4 ++-- .../declare-statements/actual.js | 2 +- .../declare-statements/expected.js | 2 +- 12 files changed, 20 insertions(+), 29 deletions(-) delete mode 100644 packages/babel-generator/test/fixtures/flowUsesCommas/options.json diff --git a/packages/babel-generator/README.md b/packages/babel-generator/README.md index 46a4c051b3..e3882c9af2 100644 --- a/packages/babel-generator/README.md +++ b/packages/babel-generator/README.md @@ -37,7 +37,6 @@ minified | boolean | `false` | Should the output be minif concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`) quotes | `'single'` or `'double'` | autodetect based on `ast.tokens` | The type of quote to use in the output filename | string | | Used in warning messages -flowCommaSeparator | boolean | `false` | Set to `true` to use commas instead of semicolons as Flow property separators jsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with "json": true to print "\u00A9" vs. "©"; Options for source maps: diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 668ba0e2b3..2e96843eaf 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -277,11 +277,7 @@ export function ObjectTypeAnnotation(node: Object) { statement: true, iterator: () => { if (props.length !== 1) { - if (this.format.flowCommaSeparator) { - this.token(","); - } else { - this.semicolon(); - } + this.token(","); this.space(); } } diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index 138336546c..fce0c97a03 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -64,8 +64,7 @@ function normalizeOptions(code, opts, tokens): Format { adjustMultilineComment: true, style: style, base: 0 - }, - flowCommaSeparator: opts.flowCommaSeparator, + } }; if (format.minified) { diff --git a/packages/babel-generator/test/fixtures/flow/call-properties/expected.js b/packages/babel-generator/test/fixtures/flow/call-properties/expected.js index 11d4f2a107..f0b5dabbe3 100644 --- a/packages/babel-generator/test/fixtures/flow/call-properties/expected.js +++ b/packages/babel-generator/test/fixtures/flow/call-properties/expected.js @@ -1,5 +1,5 @@ var a: { (): number }; var a: { (): number }; -var a: { y: string; (): number; (x: string): string; }; +var a: { y: string, (): number, (x: string): string, }; var a: { (x: T): number }; interface A { (): number }; diff --git a/packages/babel-generator/test/fixtures/flow/declare-statements/expected.js b/packages/babel-generator/test/fixtures/flow/declare-statements/expected.js index 8f667c0137..7498e25025 100644 --- a/packages/babel-generator/test/fixtures/flow/declare-statements/expected.js +++ b/packages/babel-generator/test/fixtures/flow/declare-statements/expected.js @@ -6,7 +6,7 @@ declare function foo(): void; declare function foo(x: number, y: string): void; declare class A {} declare class A extends B { x: number } -declare class A { static foo: () => number; static x: string; } +declare class A { static foo: () => number, static x: string, } declare class A { static [indexer: number]: string } declare class A { static (): number } declare class A mixins B, C {} diff --git a/packages/babel-generator/test/fixtures/flow/interfaces-module-and-script/expected.js b/packages/babel-generator/test/fixtures/flow/interfaces-module-and-script/expected.js index ee084a80b7..89aa627760 100644 --- a/packages/babel-generator/test/fixtures/flow/interfaces-module-and-script/expected.js +++ b/packages/babel-generator/test/fixtures/flow/interfaces-module-and-script/expected.js @@ -2,7 +2,7 @@ interface A {}; interface A extends B {}; interface A extends B, C {}; interface A { foo: () => number }; -interface Dictionary { length: number; [index: string]: string; }; +interface Dictionary { length: number, [index: string]: string, }; class Foo implements Bar {} class Foo extends Bar implements Bat, Man {} class Foo extends class Bar implements Bat {} {} diff --git a/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js b/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js index 205513cb00..e90a7bcfc4 100644 --- a/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js +++ b/packages/babel-generator/test/fixtures/flow/type-annotations/expected.js @@ -38,14 +38,14 @@ var numVal: number; var numVal: number = otherNumVal; var a: { numVal: number }; var a: { numVal: number }; -var a: { numVal: number; [indexer: string]: number; }; +var a: { numVal: number, [indexer: string]: number, }; var a: ?{ numVal: number }; -var a: { numVal: number; strVal: string; }; +var a: { numVal: number, strVal: string, }; var a: { subObj: { strVal: string } }; var a: { subObj: ?{ strVal: string } }; -var a: { param1: number; param2: string; }; -var a: { param1: number; param2?: string; }; -var a: { [a: number]: string; [b: number]: string; }; +var a: { param1: number, param2: string, }; +var a: { param1: number, param2?: string, }; +var a: { [a: number]: string, [b: number]: string, }; var a: { add: (x: number, ...y: Array) => void }; var a: { subtract: (x: number, ...y: Array) => void }; var a: { id: (x: T) => T }; @@ -112,14 +112,14 @@ export interface qux { p: T }; var a: ?Array; var a: {| numVal: number |}; var a: {| numVal: number |}; -var a: {| numVal: number; [indexer: string]: number; |}; +var a: {| numVal: number, [indexer: string]: number, |}; var a: ?{| numVal: number |}; -var a: {| numVal: number; strVal: string; |}; +var a: {| numVal: number, strVal: string, |}; var a: {| subObj: { strVal: string } |}; var a: {| subObj: ?{ strVal: string } |}; -var a: {| param1: number; param2: string; |}; -var a: {| param1: number; param2?: string; |}; -var a: {| [a: number]: string; [b: number]: string; |}; +var a: {| param1: number, param2: string, |}; +var a: {| param1: number, param2?: string, |}; +var a: {| [a: number]: string, [b: number]: string, |}; var a: {| add: (x: number, ...y: Array) => void |}; var a: {| subtract: (x: number, ...y: Array) => void |}; var a: {| id: (x: T) => T |}; diff --git a/packages/babel-generator/test/fixtures/flow/typecasts/expected.js b/packages/babel-generator/test/fixtures/flow/typecasts/expected.js index 69c9dc4b93..61771958e6 100644 --- a/packages/babel-generator/test/fixtures/flow/typecasts/expected.js +++ b/packages/babel-generator/test/fixtures/flow/typecasts/expected.js @@ -1,4 +1,4 @@ (xxx: number); -({ xxx: 0, yyy: "hey" }: { xxx: number; yyy: string; }); +({ xxx: 0, yyy: "hey" }: { xxx: number, yyy: string, }); (xxx => xxx + 1: (xxx: number) => number); (xxx: number), (yyy: string); diff --git a/packages/babel-generator/test/fixtures/flowUsesCommas/options.json b/packages/babel-generator/test/fixtures/flowUsesCommas/options.json deleted file mode 100644 index f50690ec13..0000000000 --- a/packages/babel-generator/test/fixtures/flowUsesCommas/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "flowCommaSeparator": true -} diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 813bd57f59..6abefd9ccd 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -259,7 +259,7 @@ describe("programmatic generation", function() { const output = generate(objectStatement).code; assert.equal(output, [ "{", - " bar: string;", + " bar: string,", "}", ].join("\n")); }); @@ -280,7 +280,7 @@ describe("programmatic generation", function() { assert.equal(output, [ "{", - " [key: any]: Test;", + " [key: any]: Test,", "}", ].join("\n")); }); diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/actual.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/actual.js index 1c62d8ee90..7c28264794 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/actual.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/actual.js @@ -6,7 +6,7 @@ declare function foo(): void; declare function foo(x: number, y: string): void; declare class A {} declare class A extends B { x: number } -declare class A { static foo(): number; static x : string } +declare class A { static foo(): number, static x : string } declare class A { static [ indexer: number]: string } declare class A { static () : number } declare class A mixins B, C {} diff --git a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/expected.js b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/expected.js index 1e0c0a5b06..95116a0720 100644 --- a/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/expected.js +++ b/packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/declare-statements/expected.js @@ -6,7 +6,7 @@ /*:: declare function foo(x: number, y: string): void;*/ /*:: declare class A {}*/ /*:: declare class A extends B { x: number }*/ -/*:: declare class A { static foo(): number; static x : string }*/ +/*:: declare class A { static foo(): number, static x : string }*/ /*:: declare class A { static [ indexer: number]: string }*/ /*:: declare class A { static () : number }*/ /*:: declare class A mixins B, C {}*/ From 81c3578adcbf17bc5be366be479f53f537f18246 Mon Sep 17 00:00:00 2001 From: Anderson Vasques Date: Fri, 20 Jan 2017 01:32:16 -0200 Subject: [PATCH 080/222] [7.0] Remove old code used for backwards compatibility (#5122) [7.0] Remove old code used for backwards compatibility in babel-polyfill Fixes #5121 --- packages/babel-polyfill/src/index.js | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/packages/babel-polyfill/src/index.js b/packages/babel-polyfill/src/index.js index 2dfde7b6d7..cff406dbbf 100644 --- a/packages/babel-polyfill/src/index.js +++ b/packages/babel-polyfill/src/index.js @@ -7,23 +7,3 @@ global._babelPolyfill = true; import "core-js/shim"; import "regenerator-runtime/runtime"; - -// Should be removed in the next major release: - -import "core-js/fn/regexp/escape"; - -const DEFINE_PROPERTY = "defineProperty"; -function define(O, key, value) { - O[key] || Object[DEFINE_PROPERTY](O, key, { - writable: true, - configurable: true, - value: value - }); -} - -define(String.prototype, "padLeft", "".padStart); -define(String.prototype, "padRight", "".padEnd); - -"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key) { - [][key] && define(Array, key, Function.call.bind([][key])); -}); From e4ba28c294c2a3ed04a2544de09128bc39a0aaf5 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Fri, 20 Jan 2017 04:33:46 +0100 Subject: [PATCH 081/222] [7.0] Dependencies: Upgrade regexpu-core to ^4.0.2 (#5028) --- .../babel-plugin-transform-es2015-unicode-regex/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/package.json b/packages/babel-plugin-transform-es2015-unicode-regex/package.json index 116b9035f3..0946948131 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/package.json +++ b/packages/babel-plugin-transform-es2015-unicode-regex/package.json @@ -11,7 +11,7 @@ "dependencies": { "babel-helper-regex": "^6.22.0", "babel-runtime": "^6.22.0", - "regexpu-core": "^2.0.0" + "regexpu-core": "^4.0.2" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" From 1742035a98a924be375ccfeb7c8af09a722e2288 Mon Sep 17 00:00:00 2001 From: Jordan Jones Date: Thu, 19 Jan 2017 22:43:11 -0500 Subject: [PATCH 082/222] [7.0] Fixes #5108, browser.js and browser.js test removed (#5124) * Fixes #5108, browser.js and browser.js test removed * Moved api/node.js to index.js and adjusted associated file references --- CHANGELOG.md | 6 + lerna.json | 2 +- packages/babel-cli/package.json | 13 +- packages/babel-core/index.js | 2 +- packages/babel-core/package.json | 7 +- packages/babel-core/src/api/browser.js | 112 ------------------ .../babel-core/src/{api/node.js => index.js} | 18 +-- .../file/options/option-manager.js | 2 +- packages/babel-core/test/_browser.js | 7 -- packages/babel-core/test/api.js | 2 +- packages/babel-core/test/path.js | 2 +- packages/babel-core/test/resolution.js | 2 +- .../constant-elements/destructure/actual.js | 10 ++ .../constant-elements/destructure/expected.js | 13 ++ .../destructure/options.json | 7 ++ packages/babel-traverse/package.json | 2 +- .../babel-traverse/src/path/lib/hoister.js | 7 +- 17 files changed, 73 insertions(+), 141 deletions(-) delete mode 100644 packages/babel-core/src/api/browser.js rename packages/babel-core/src/{api/node.js => index.js} (70%) delete mode 100644 packages/babel-core/test/_browser.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 06bc3a24f3..b5fc99aa50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.22.1 (2017-01-19) + +#### :bug: Bug Fix + +Temporary fix with `babel-traverse` via [#5019](https://github.com/babel/babel/pull/5019) for transform-react-constant-elements. + ## 6.22.0 (2017-01-19) A quick update since it's been over a month already: adds support for shorthand import syntax in Flow + some fixes! diff --git a/lerna.json b/lerna.json index 4fc063c9a9..d522a2967d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.22.0", + "version": "6.22.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index d32f989965..a4a9444af0 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,13 +1,22 @@ { "name": "babel-cli", - "version": "6.22.0", + "version": "6.22.1", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-cli", + "keywords": [ + "6to5", + "babel", + "es6", + "transpile", + "transpiler", + "babel-cli", + "compiler" + ], "dependencies": { - "babel-core": "^6.22.0", + "babel-core": "^6.22.1", "babel-register": "^6.22.0", "babel-polyfill": "^6.22.0", "babel-runtime": "^6.22.0", diff --git a/packages/babel-core/index.js b/packages/babel-core/index.js index e8f04775a2..07edf9757c 100644 --- a/packages/babel-core/index.js +++ b/packages/babel-core/index.js @@ -1 +1 @@ -module.exports = require("./lib/api/node.js"); +module.exports = require("./lib/index.js"); diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 0e62b668a5..a9cbeb1f8b 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.22.0", + "version": "6.22.1", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -18,7 +18,8 @@ "transpile", "transpiler", "var", - "babel-core" + "babel-core", + "compiler" ], "scripts": { "bench": "make bench", @@ -32,7 +33,7 @@ "babel-template": "^6.22.0", "babel-runtime": "^6.22.0", "babel-register": "^6.22.0", - "babel-traverse": "^6.22.0", + "babel-traverse": "^6.22.1", "babel-types": "^6.22.0", "babylon": "^6.11.0", "convert-source-map": "^1.1.0", diff --git a/packages/babel-core/src/api/browser.js b/packages/babel-core/src/api/browser.js deleted file mode 100644 index d5d89f6b71..0000000000 --- a/packages/babel-core/src/api/browser.js +++ /dev/null @@ -1,112 +0,0 @@ -/* eslint max-len: 0 */ -/* eslint no-new-func: 0 */ - -import { transform } from "./node"; -export { - File, - options, - buildExternalHelpers, - template, - version, - util, - messages, - types, - traverse, - OptionManager, - Plugin, - Pipeline, - analyse, - transform, - transformFromAst, - transformFile, - transformFileSync -} from "./node"; - -export function run(code: string, opts: Object = {}): any { - return new Function(transform(code, opts).code)(); -} - -export function load(url: string, callback: Function, opts: Object = {}, hold?: boolean) { - opts.filename = opts.filename || url; - - const xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest(); - xhr.open("GET", url, true); - if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain"); - - xhr.onreadystatechange = function () { - if (xhr.readyState !== 4) return; - - const status = xhr.status; - if (status === 0 || status === 200) { - const param = [xhr.responseText, opts]; - if (!hold) run(param); - if (callback) callback(param); - } else { - throw new Error(`Could not load ${url}`); - } - }; - - xhr.send(null); -} - -function runScripts() { - const scripts: Array | Object> = []; - const types = ["text/ecmascript-6", "text/6to5", "text/babel", "module"]; - let index = 0; - - /** - * Transform and execute script. Ensures correct load order. - */ - - function exec() { - const param = scripts[index]; - if (param instanceof Array) { - run(param, index); - index++; - exec(); - } - } - - /** - * Load, transform, and execute all scripts. - */ - - function run(script: Object, i: number) { - const opts = {}; - - if (script.src) { - load(script.src, function (param) { - scripts[i] = param; - exec(); - }, opts, true); - } else { - opts.filename = "embedded"; - scripts[i] = [script.innerHTML, opts]; - } - } - - // Collect scripts with Babel `types`. - - const _scripts = global.document.getElementsByTagName("script"); - - for (let i = 0; i < _scripts.length; ++i) { - const _script = _scripts[i]; - if (types.indexOf(_script.type) >= 0) scripts.push(_script); - } - - for (let i = 0; i < scripts.length; i++) { - run(scripts[i], i); - } - - exec(); -} - -/** - * Register load event to transform and execute scripts. - */ - -if (global.addEventListener) { - global.addEventListener("DOMContentLoaded", runScripts, false); -} else if (global.attachEvent) { - global.attachEvent("onload", runScripts); -} diff --git a/packages/babel-core/src/api/node.js b/packages/babel-core/src/index.js similarity index 70% rename from packages/babel-core/src/api/node.js rename to packages/babel-core/src/index.js index 3ff92f9d7f..86a65bde56 100644 --- a/packages/babel-core/src/api/node.js +++ b/packages/babel-core/src/index.js @@ -1,14 +1,14 @@ import fs from "fs"; -export { default as File } from "../transformation/file"; -export { default as options } from "../transformation/file/options/config"; -export { default as buildExternalHelpers } from "../tools/build-external-helpers"; +export { default as File } from "./transformation/file"; +export { default as options } from "./transformation/file/options/config"; +export { default as buildExternalHelpers } from "./tools/build-external-helpers"; export { default as template } from "babel-template"; -export { default as resolvePlugin } from "../helpers/resolve-plugin"; -export { default as resolvePreset } from "../helpers/resolve-preset"; -export { version } from "../../package"; +export { default as resolvePlugin } from "./helpers/resolve-plugin"; +export { default as resolvePreset } from "./helpers/resolve-preset"; +export { version } from "../package"; -import * as util from "../util"; +import * as util from "./util"; export { util }; import * as messages from "babel-messages"; @@ -20,14 +20,14 @@ export { t as types }; import traverse from "babel-traverse"; export { traverse }; -import OptionManager from "../transformation/file/options/option-manager"; +import OptionManager from "./transformation/file/options/option-manager"; export { OptionManager }; export function Plugin(alias) { throw new Error(`The (${alias}) Babel 5 plugin is being run with Babel 6.`); } -import Pipeline from "../transformation/pipeline"; +import Pipeline from "./transformation/pipeline"; export { Pipeline }; const pipeline = new Pipeline; diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index c4736355a6..8221e3fe19 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -1,6 +1,6 @@ /* eslint max-len: 0 */ -import * as context from "../../../api/node"; +import * as context from "../../../index"; import type Logger from "../logger"; import Plugin from "../../plugin"; import * as messages from "babel-messages"; diff --git a/packages/babel-core/test/_browser.js b/packages/babel-core/test/_browser.js deleted file mode 100644 index 53e16f6e6c..0000000000 --- a/packages/babel-core/test/_browser.js +++ /dev/null @@ -1,7 +0,0 @@ -if (process.browser) { - require("../lib/api/browser"); - require("./generation"); - require("./transformation"); - require("./traverse"); - require("./util"); -} diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 6342792020..910418321b 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -1,4 +1,4 @@ -import * as babel from "../lib/api/node"; +import * as babel from "../lib/index"; import buildExternalHelpers from "../lib/tools/build-external-helpers"; import sourceMap from "source-map"; import assert from "assert"; diff --git a/packages/babel-core/test/path.js b/packages/babel-core/test/path.js index 72642c6480..7628e1033f 100644 --- a/packages/babel-core/test/path.js +++ b/packages/babel-core/test/path.js @@ -1,4 +1,4 @@ -import { transform } from "../lib/api/node"; +import { transform } from "../lib/index"; import Plugin from "../lib/transformation/plugin"; import chai from "chai"; diff --git a/packages/babel-core/test/resolution.js b/packages/babel-core/test/resolution.js index 21d945706d..d65c7e9028 100644 --- a/packages/babel-core/test/resolution.js +++ b/packages/babel-core/test/resolution.js @@ -1,6 +1,6 @@ import assert from "assert"; import async from "async"; -import * as babel from "../lib/api/node"; +import * as babel from "../lib/index"; import fs from "fs"; import path from "path"; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js new file mode 100644 index 0000000000..fbd1ed5555 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/actual.js @@ -0,0 +1,10 @@ +class AnchorLink extends Component { + render() { + const { isExternal, children } = this.props; + if (isExternal) { + return ({children}); + } + + return ({children}); + } +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js new file mode 100644 index 0000000000..4f730edf03 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/expected.js @@ -0,0 +1,13 @@ +class AnchorLink extends Component { + render() { + var _props = this.props; + const isExternal = _props.isExternal, + children = _props.children; + + if (isExternal) { + return {children}; + } + + return {children}; + } +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json new file mode 100644 index 0000000000..dc9272a969 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/destructure/options.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "syntax-jsx", + "transform-es2015-destructuring", + "transform-react-constant-elements" + ] +} diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index cb68f38bf1..8066c617a8 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.22.0", + "version": "6.22.1", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 8a36031f1e..243e9c18ac 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -121,7 +121,12 @@ export default class PathHoister { do { if (!path.parentPath || (Array.isArray(path.container) && path.isStatement()) || - (path.isVariableDeclarator() && path.parentPath.node.declarations.length > 1)) + ( + path.isVariableDeclarator() && + path.parentPath.node !== null && + path.parentPath.node.declarations.length > 1 + ) + ) return path; } while ((path = path.parentPath)); } From b978996ba4ced426a23b0f3756f9e86dafaac604 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Fri, 20 Jan 2017 07:02:19 +0300 Subject: [PATCH 083/222] Remove add-module-exports use internally (#5131) --- package.json | 1 - scripts/add-module-exports.js | 47 ----------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 scripts/add-module-exports.js diff --git a/package.json b/package.json index 30fdfe6149..3df1640fee 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "stage-0" ], "plugins": [ - "./scripts/add-module-exports", "transform-runtime", "transform-class-properties", "transform-flow-strip-types" diff --git a/scripts/add-module-exports.js b/scripts/add-module-exports.js deleted file mode 100644 index d0e89a17cf..0000000000 --- a/scripts/add-module-exports.js +++ /dev/null @@ -1,47 +0,0 @@ -// "add-module-exports" -module.exports = function (babel) { - var t = babel.types; - return { - visitor: { - Program: { - exit: function(path) { - if (path.BABEL_PLUGIN_ADD_MODULE_EXPORTS) { - return; - } - - var hasExportDefault = false; - var hasExportNamed = false; - var body = path.get("body"); - - path.get('body').forEach(function (path) { - if (path.isExportDefaultDeclaration()) { - hasExportDefault = true; - return; - } - - if (path.isExportNamedDeclaration()) { - if (path.node.specifiers.length === 1 && path.node.specifiers[0].exported.name === "default") { - hasExportDefault = true; - } else { - hasExportNamed = true; - } - return; - } - }); - - if (hasExportDefault && !hasExportNamed) { - path.pushContainer("body", [ - t.expressionStatement(t.assignmentExpression( - "=", - t.memberExpression(t.identifier("module"), t.identifier("exports")), - t.memberExpression(t.identifier("exports"), t.stringLiteral("default"), true) - )) - ]); - } - - path.BABEL_PLUGIN_ADD_MODULE_EXPORTS = true; - } - } - } - } -} From 12886ea495b9f726de98d3380d15f85bd55f6308 Mon Sep 17 00:00:00 2001 From: Adonis K Date: Fri, 20 Jan 2017 06:03:49 +0200 Subject: [PATCH 084/222] [7.0] Remove stage 4 plugins from stage 3 preset (#5126) * remove trailing function commas from stage-3 preset (#5117) trailing function commas is now a finished proposal and was moved to stage 4 (https://github.com/tc39/proposal-trailing-function-commas) * remove the exponentiation operator from stage-3 preset (#5117) exponentiation-operator is now a finished proposal and was moved to stage 4 (https://github.com/rwaldron/exponentiation-operator) * remove async function to es2015 generator from stage-3 preset (#5117) async functions is now a finished proposal and was moved to stage 4 (https://github.com/tc39/ecmascript-asyncawait) --- packages/babel-preset-stage-3/package.json | 3 --- packages/babel-preset-stage-3/src/index.js | 6 ------ 2 files changed, 9 deletions(-) diff --git a/packages/babel-preset-stage-3/package.json b/packages/babel-preset-stage-3/package.json index 256406caed..1c4c1b5434 100644 --- a/packages/babel-preset-stage-3/package.json +++ b/packages/babel-preset-stage-3/package.json @@ -8,10 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-3", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-trailing-function-commas": "^6.22.0", "babel-plugin-transform-async-generator-functions": "^6.22.0", - "babel-plugin-transform-async-to-generator": "^6.22.0", - "babel-plugin-transform-exponentiation-operator": "^6.22.0", "babel-plugin-transform-object-rest-spread": "^6.22.0" } } diff --git a/packages/babel-preset-stage-3/src/index.js b/packages/babel-preset-stage-3/src/index.js index 6d57f4af66..dd6e2edbe9 100644 --- a/packages/babel-preset-stage-3/src/index.js +++ b/packages/babel-preset-stage-3/src/index.js @@ -1,14 +1,8 @@ -import syntaxTrailingFunctionCommas from "babel-plugin-syntax-trailing-function-commas"; -import transformAsyncToGenerator from "babel-plugin-transform-async-to-generator"; -import transformExponentiationOperator from "babel-plugin-transform-exponentiation-operator"; import transformObjectRestSpread from "babel-plugin-transform-object-rest-spread"; import transformAsyncGeneratorFunctions from "babel-plugin-transform-async-generator-functions"; export default { plugins: [ - syntaxTrailingFunctionCommas, // in ES2017 (remove as a breaking change) - transformAsyncToGenerator, // in ES2017 (remove as a breaking change) - transformExponentiationOperator, // in ES2016 (remove as a breaking change) transformAsyncGeneratorFunctions, transformObjectRestSpread ] From 6528fe105ee43d13c92e0747d8bd77b89439660b Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Thu, 19 Jan 2017 21:47:11 -0800 Subject: [PATCH 085/222] Break out of argument processing properly. --- packages/babel-cli/src/_babel-node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 70bf813a48..18acc4247f 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -103,7 +103,7 @@ if (program.eval || program.print) { let i = 0; let ignoreNext = false; - args.forEach(function (arg, i2) { + args.some(function (arg, i2) { if (ignoreNext) { ignoreNext = false; return; @@ -116,7 +116,7 @@ if (program.eval || program.print) { } } else { i = i2; - return false; + return true; } }); args = args.slice(i); From 7de9fa07fb8bc9528f33a70475a8d81ddf5b8ff1 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Thu, 19 Jan 2017 22:03:27 -0800 Subject: [PATCH 086/222] v6.22.2 --- lerna.json | 2 +- packages/babel-cli/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index d522a2967d..2858f12c31 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.22.1", + "version": "6.22.2", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index a4a9444af0..f06fccc0be 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "babel-cli", - "version": "6.22.1", + "version": "6.22.2", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 85eec9ffef9f2defbcc4cce29440c5ef230708d2 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Thu, 19 Jan 2017 22:08:10 -0800 Subject: [PATCH 087/222] CHANGELOG for 6.22.2 --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5fc99aa50..7ff3de0e51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,11 +13,19 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.22.2 (2017-01-19) + +#### :bug: Bug Fix + +* `babel-cli` + * Fix issue with `babel-node` throwing errors when passed non-"-" args [#5162](https://github.com/babel/babel/pull/5162). + ## 6.22.1 (2017-01-19) #### :bug: Bug Fix -Temporary fix with `babel-traverse` via [#5019](https://github.com/babel/babel/pull/5019) for transform-react-constant-elements. +* `babel-traverse` + * Temporary fix with `babel-traverse` via [#5019](https://github.com/babel/babel/pull/5019) for transform-react-constant-elements. ## 6.22.0 (2017-01-19) From d0b42d43132a89f2ee684a0502768c30db092ab2 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Fri, 20 Jan 2017 12:29:44 +0300 Subject: [PATCH 088/222] Update babel-core browserify fixture (#5164) --- packages/babel-core/test/fixtures/browserify/register.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/test/fixtures/browserify/register.js b/packages/babel-core/test/fixtures/browserify/register.js index 21e53a30dd..d8f99e94a6 100644 --- a/packages/babel-core/test/fixtures/browserify/register.js +++ b/packages/babel-core/test/fixtures/browserify/register.js @@ -1,3 +1,3 @@ -require("babel-register")({ +require("babel-register").default({ ignore: false }); From 1aa7a2a1a349d16e7d7b9efe9882149a6a86ad61 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 20 Jan 2017 04:42:56 -0500 Subject: [PATCH 089/222] Remove "class-constructor-call" syntax and transform plugins (#5119) * removed class-constructor-call syntax and transform plugins and all references to them * #5112, removed another reference to constructor call --- .../babel-generator/src/generators/classes.js | 5 - .../.npmignore | 3 - .../README.md | 41 ------- .../package.json | 13 --- .../src/index.js | 7 -- .../.npmignore | 4 - .../README.md | 101 ------------------ .../package.json | 19 ---- .../src/index.js | 70 ------------ .../declaration-exec/exec.js | 12 --- .../declaration-exec/options.json | 3 - .../declaration/actual.js | 5 - .../declaration/expected.js | 16 --- .../export-default/actual.js | 5 - .../export-default/expected.js | 14 --- .../expression-completion-record/actual.js | 5 - .../expression-completion-record/expected.js | 16 --- .../expression-exec/exec.js | 12 --- .../expression-exec/options.json | 3 - .../expression/actual.js | 5 - .../expression/expected.js | 18 ---- .../class-constructor-call/none/actual.js | 1 - .../class-constructor-call/none/expected.js | 1 - .../class-constructor-call/options.json | 3 - .../test/index.js | 3 - packages/babel-preset-stage-1/package.json | 1 - packages/babel-preset-stage-1/src/index.js | 2 - 27 files changed, 388 deletions(-) delete mode 100644 packages/babel-plugin-syntax-class-constructor-call/.npmignore delete mode 100644 packages/babel-plugin-syntax-class-constructor-call/README.md delete mode 100644 packages/babel-plugin-syntax-class-constructor-call/package.json delete mode 100644 packages/babel-plugin-syntax-class-constructor-call/src/index.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/.npmignore delete mode 100644 packages/babel-plugin-transform-class-constructor-call/README.md delete mode 100644 packages/babel-plugin-transform-class-constructor-call/package.json delete mode 100644 packages/babel-plugin-transform-class-constructor-call/src/index.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/exec.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/options.json delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/actual.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/expected.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/actual.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/expected.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/actual.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/expected.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/exec.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/options.json delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/actual.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/expected.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/actual.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/expected.js delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/options.json delete mode 100644 packages/babel-plugin-transform-class-constructor-call/test/index.js diff --git a/packages/babel-generator/src/generators/classes.js b/packages/babel-generator/src/generators/classes.js index 67c3aed42b..64066a04cd 100644 --- a/packages/babel-generator/src/generators/classes.js +++ b/packages/babel-generator/src/generators/classes.js @@ -81,10 +81,5 @@ export function ClassMethod(node: Object) { this.space(); } - if (node.kind === "constructorCall") { - this.word("call"); - this.space(); - } - this._method(node); } diff --git a/packages/babel-plugin-syntax-class-constructor-call/.npmignore b/packages/babel-plugin-syntax-class-constructor-call/.npmignore deleted file mode 100644 index cace0d6ddc..0000000000 --- a/packages/babel-plugin-syntax-class-constructor-call/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -*.log -src diff --git a/packages/babel-plugin-syntax-class-constructor-call/README.md b/packages/babel-plugin-syntax-class-constructor-call/README.md deleted file mode 100644 index 6a063d8d56..0000000000 --- a/packages/babel-plugin-syntax-class-constructor-call/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# babel-plugin-syntax-class-constructor-call (deprecated) - -> Proposal Withdrawn: can be solved with decorators. - -## Installation - -```sh -npm install --save-dev babel-plugin-syntax-class-constructor-call -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["syntax-class-constructor-call"] -} -``` - -### Via CLI - -```sh -babel --plugins syntax-class-constructor-call script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["syntax-class-constructor-call"] -}); -``` - -## References - -* [Inactive Proposals](https://github.com/tc39/proposals/blob/master/inactive-proposals.md) -* [Proposal: Call Constructor](https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md) -* [Blog post: ECMAScript proposal: function-callable classes](http://www.2ality.com/2015/10/call-constructor-esprop.html) diff --git a/packages/babel-plugin-syntax-class-constructor-call/package.json b/packages/babel-plugin-syntax-class-constructor-call/package.json deleted file mode 100644 index 2be301b342..0000000000 --- a/packages/babel-plugin-syntax-class-constructor-call/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "babel-plugin-syntax-class-constructor-call", - "version": "6.18.0", - "description": "Allow parsing of class constructor calls (deprecated)", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-class-constructor-call", - "license": "MIT", - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": {}, - "devDependencies": {} -} diff --git a/packages/babel-plugin-syntax-class-constructor-call/src/index.js b/packages/babel-plugin-syntax-class-constructor-call/src/index.js deleted file mode 100644 index d3839a279c..0000000000 --- a/packages/babel-plugin-syntax-class-constructor-call/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function () { - return { - manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push("classConstructorCall"); - } - }; -} diff --git a/packages/babel-plugin-transform-class-constructor-call/.npmignore b/packages/babel-plugin-transform-class-constructor-call/.npmignore deleted file mode 100644 index 31852902b1..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -*.log -src -test diff --git a/packages/babel-plugin-transform-class-constructor-call/README.md b/packages/babel-plugin-transform-class-constructor-call/README.md deleted file mode 100644 index badb23aef9..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# babel-plugin-transform-class-constructor-call (deprecated) - -> Proposal Withdrawn: can be solved with decorators. - -This plugin allows Babel to transform class constructors. - -It basically allows to use the [new.target](http://mdn.io/new.target) feature on ES2015 classes: - -```js -class Point { - - constructor(x, y) { - this.x = x; - this.y = y; - } - - call constructor(x, y) { - return new Point(x, y); - } - -} - -let p1 = new Point(1, 2); // OK -let p2 = Point(3, 4); // OK -``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=class%20Point%20%7B%0A%0A%20%20constructor(x%2C%20y)%20%7B%0A%20%20%20%20this.x%20%3D%20x%3B%0A%20%20%20%20this.y%20%3D%20y%3B%0A%20%20%7D%0A%0A%20%20call%20constructor(x%2C%20y)%20%7B%0A%20%20%20%20return%20new%20Point(x%2C%20y)%3B%0A%20%20%7D%0A%0A%7D%0A%0Alet%20p1%20%3D%20new%20Point(1%2C%202)%3B%20%2F%2F%20OK%0Alet%20p2%20%3D%20Point(3%2C%204)%3B%20%2F%2F%20OK) - -## Example - -### Date example -The javascript [Date](http://mdn.io/date) works this way: - -```js -// You can get a Date instance using the new keyword -let now = new Date(); -console.log(now.getMonth()); // Prints '3' -console.log(now.toString()); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)' - -// You can get a string of the current date using Date as a function: -let nowStr = Date(); -console.log(nowStr); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)' -``` - -It is currently possible to implement something like that using [new.target](http://mdn.io/new.target) (see [example in proposal](https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md#motivating-example)) and this new feature makes it available for ES2015 classes. - -A date implementation could be: - -```js -class Date { - constructor() { - // ... - } - - call constructor() { - let date = new Date(); - return date.toString(); - } -} - -let now = new Date(); // Get a Date instance -let nowStr = Date(); // Use the 'call constructor()' part to get a string value of the current date -``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=class%20Date%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20%2F%2F%20...%0A%20%20%7D%0A%0A%20%20call%20constructor()%20%7B%0A%20%20%20%20let%20date%20%3D%20new%20Date()%3B%0A%20%20%20%20return%20date.toString()%3B%0A%20%20%7D%0A%7D%0A%0Alet%20now%20%3D%20new%20Date()%3B%20%2F%2F%20Get%20a%20Date%20instance%0Alet%20nowStr%20%3D%20Date()%3B%20%2F%2F%20Use%20the%20'call%20constructor()'%20part%20to%20get%20a%20string%20value%20of%20the%20current%20date) - -## Installation - -```sh -npm install --save-dev babel-plugin-transform-class-constructor-call -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["transform-class-constructor-call"] -} -``` - -### Via CLI - -```sh -babel --plugins transform-class-constructor-call script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["transform-class-constructor-call"] -}); -``` - -## References - -* [Inactive Proposals](https://github.com/tc39/proposals/blob/master/inactive-proposals.md) -* [Proposal: Call Constructor](https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md) -* [Blog post: ECMAScript proposal: function-callable classes](http://www.2ality.com/2015/10/call-constructor-esprop.html) diff --git a/packages/babel-plugin-transform-class-constructor-call/package.json b/packages/babel-plugin-transform-class-constructor-call/package.json deleted file mode 100644 index b150c05137..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "babel-plugin-transform-class-constructor-call", - "version": "6.22.0", - "description": "This plugin allows Babel to transform class constructors (deprecated)", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-class-constructor-call", - "license": "MIT", - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "babel-template": "^6.22.0", - "babel-plugin-syntax-class-constructor-call": "^6.18.0", - "babel-runtime": "^6.22.0" - }, - "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" - } -} diff --git a/packages/babel-plugin-transform-class-constructor-call/src/index.js b/packages/babel-plugin-transform-class-constructor-call/src/index.js deleted file mode 100644 index 09de2b5baa..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/src/index.js +++ /dev/null @@ -1,70 +0,0 @@ -import template from "babel-template"; - -const buildWrapper = template(` - let CLASS_REF = CLASS; - var CALL_REF = CALL; - var WRAPPER_REF = function (...args) { - if (this instanceof WRAPPER_REF) { - return Reflect.construct(CLASS_REF, args); - } else { - return CALL_REF.apply(this, args); - } - }; - WRAPPER_REF.__proto__ = CLASS_REF; - WRAPPER_REF; -`); - -export default function ({ types: t }) { - const ALREADY_VISITED = Symbol(); - - function findConstructorCall(path): ?Object { - const methods: Array = path.get("body.body"); - - for (const method of methods) { - if (method.node.kind === "constructorCall") { - return method; - } - } - - return null; - } - - function handleClassWithCall(constructorCall, classPath) { - const { node } = classPath; - const ref = node.id || classPath.scope.generateUidIdentifier("class"); - - if (classPath.parentPath.isExportDefaultDeclaration()) { - classPath = classPath.parentPath; - classPath.insertAfter(t.exportDefaultDeclaration(ref)); - } - - classPath.replaceWithMultiple(buildWrapper({ - CLASS_REF: classPath.scope.generateUidIdentifier(ref.name), - CALL_REF: classPath.scope.generateUidIdentifier(`${ref.name}Call`), - CALL: t.functionExpression(null, constructorCall.node.params, constructorCall.node.body), - CLASS: t.toExpression(node), - WRAPPER_REF: ref - })); - - constructorCall.remove(); - } - - return { - inherits: require("babel-plugin-syntax-class-constructor-call"), - - visitor: { - Class(path) { - if (path.node[ALREADY_VISITED]) return; - path.node[ALREADY_VISITED] = true; - - const constructorCall = findConstructorCall(path); - - if (constructorCall) { - handleClassWithCall(constructorCall, path); - } else { - return; - } - } - } - }; -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/exec.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/exec.js deleted file mode 100644 index 6141a3f65e..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -class Foo { - constructor() { - this.num = 1; - } - - call constructor() { - return { num: 2 }; - } -} - -assert.equal(new Foo().num, 1); -assert.equal(Foo().num, 2); diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/options.json b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/options.json deleted file mode 100644 index 37e52d209d..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration-exec/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["transform-class-constructor-call", "transform-es2015-classes", "transform-es2015-block-scoping", "transform-es2015-parameters"] -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/actual.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/actual.js deleted file mode 100644 index 1f8b64ef4a..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/actual.js +++ /dev/null @@ -1,5 +0,0 @@ -class Foo { - call constructor() { - foo(); - } -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/expected.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/expected.js deleted file mode 100644 index 32e55b668f..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/declaration/expected.js +++ /dev/null @@ -1,16 +0,0 @@ -let _Foo = class Foo {}; - -var _FooCall = function () { - foo(); -}; - -var Foo = function (...args) { - if (this instanceof Foo) { - return Reflect.construct(_Foo, args); - } else { - return _FooCall.apply(this, args); - } -}; - -Foo.__proto__ = _Foo; -Foo; diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/actual.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/actual.js deleted file mode 100644 index aad0d96b1d..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/actual.js +++ /dev/null @@ -1,5 +0,0 @@ -export default class Foo { - call constructor() { - - } -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/expected.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/expected.js deleted file mode 100644 index 2131254c57..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/export-default/expected.js +++ /dev/null @@ -1,14 +0,0 @@ -let _Foo = class Foo {}; - -var _FooCall = function () {}; - -var Foo = function (...args) { - if (this instanceof Foo) { - return Reflect.construct(_Foo, args); - } else { - return _FooCall.apply(this, args); - } -}; - -Foo.__proto__ = _Foo; -export default Foo; diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/actual.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/actual.js deleted file mode 100644 index 0663cd8a88..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/actual.js +++ /dev/null @@ -1,5 +0,0 @@ -(class { - call constructor() { - foo(); - } -}); diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/expected.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/expected.js deleted file mode 100644 index 5bedc84e65..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-completion-record/expected.js +++ /dev/null @@ -1,16 +0,0 @@ -let _class2 = class {}; - -var _classCall = function () { - foo(); -}; - -var _class = function (...args) { - if (this instanceof _class) { - return Reflect.construct(_class2, args); - } else { - return _classCall.apply(this, args); - } -}; - -_class.__proto__ = _class2; -_class; diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/exec.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/exec.js deleted file mode 100644 index c276e23ab3..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/exec.js +++ /dev/null @@ -1,12 +0,0 @@ -let Foo = class { - constructor() { - this.num = 1; - } - - call constructor() { - return { num: 2 }; - } -}; - -assert.equal(new Foo().num, 1); -assert.equal(Foo().num, 2); diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/options.json b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/options.json deleted file mode 100644 index 37e52d209d..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression-exec/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["transform-class-constructor-call", "transform-es2015-classes", "transform-es2015-block-scoping", "transform-es2015-parameters"] -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/actual.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/actual.js deleted file mode 100644 index 0da72faf45..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/actual.js +++ /dev/null @@ -1,5 +0,0 @@ -let Foo = class { - call constructor() { - foo(); - } -}; diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/expected.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/expected.js deleted file mode 100644 index 47ccf7e759..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/expression/expected.js +++ /dev/null @@ -1,18 +0,0 @@ -let Foo = function () { - let _class2 = class {}; - - var _classCall = function () { - foo(); - }; - - var _class = function (...args) { - if (this instanceof _class) { - return Reflect.construct(_class2, args); - } else { - return _classCall.apply(this, args); - } - }; - - _class.__proto__ = _class2; - return _class; -}(); diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/actual.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/actual.js deleted file mode 100644 index 4e6a6de653..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/actual.js +++ /dev/null @@ -1 +0,0 @@ -class Foo {} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/expected.js b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/expected.js deleted file mode 100644 index 4e6a6de653..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/none/expected.js +++ /dev/null @@ -1 +0,0 @@ -class Foo {} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/options.json b/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/options.json deleted file mode 100644 index 98dd15ca98..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/fixtures/class-constructor-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["transform-class-constructor-call"] -} diff --git a/packages/babel-plugin-transform-class-constructor-call/test/index.js b/packages/babel-plugin-transform-class-constructor-call/test/index.js deleted file mode 100644 index 09cfbc31f5..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/test/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import runner from "babel-helper-plugin-test-runner"; - -runner(__dirname); diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index 7ba8cdaffd..b50f378b1b 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -8,7 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-class-constructor-call": "^6.22.0", "babel-plugin-transform-export-extensions": "^6.22.0", "babel-preset-stage-2": "^6.22.0" } diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index 47c5cea3bc..deff6cefbd 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -1,6 +1,5 @@ import presetStage2 from "babel-preset-stage-2"; -import transformClassConstructorCall from "babel-plugin-transform-class-constructor-call"; import transformExportExtensions from "babel-plugin-transform-export-extensions"; export default { @@ -8,7 +7,6 @@ export default { presetStage2 ], plugins: [ - transformClassConstructorCall, transformExportExtensions ] }; From 090f7abda4a381da3a81b466b4271703f5fb5e7b Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 20 Jan 2017 14:17:25 +0100 Subject: [PATCH 090/222] [7.0] babel-preset-stage-2: Add transform-unicode-property-regex (#3683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This enables the use of Unicode property escapes of the form `\p{…}` and `\P{…}` in regular expressions with the `u` flag enabled. More info: https://mathiasbynens.be/notes/es-unicode-property-escapes Proposal: https://github.com/mathiasbynens/es-regexp-unicode-property-escapes Plugin: https://github.com/mathiasbynens/babel-plugin-transform-unicode-property-regex --- packages/babel-preset-stage-2/package.json | 3 ++- packages/babel-preset-stage-2/src/index.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json index b47b116be7..710db5c5c2 100644 --- a/packages/babel-preset-stage-2/package.json +++ b/packages/babel-preset-stage-2/package.json @@ -8,9 +8,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2", "main": "lib/index.js", "dependencies": { + "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-class-properties": "^6.22.0", "babel-plugin-transform-decorators": "^6.22.0", - "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-unicode-property-regex": "^2.0.0", "babel-preset-stage-3": "^6.22.0" } } diff --git a/packages/babel-preset-stage-2/src/index.js b/packages/babel-preset-stage-2/src/index.js index 7e9e8a2864..7bc11d1bc2 100644 --- a/packages/babel-preset-stage-2/src/index.js +++ b/packages/babel-preset-stage-2/src/index.js @@ -1,8 +1,9 @@ import presetStage3 from "babel-preset-stage-3"; +import syntaxDynamicImport from "babel-plugin-syntax-dynamic-import"; import transformClassProperties from "babel-plugin-transform-class-properties"; import transformDecorators from "babel-plugin-transform-decorators"; -import syntaxDynamicImport from "babel-plugin-syntax-dynamic-import"; +import transformUnicodePropertyRegex from "babel-plugin-transform-unicode-property-regex"; export default { presets: [ @@ -11,6 +12,7 @@ export default { plugins: [ syntaxDynamicImport, transformClassProperties, - transformDecorators + transformDecorators, + transformUnicodePropertyRegex ] }; From 7aa6387835508eb75dab92f5b9aa19b30d005333 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Fri, 20 Jan 2017 18:07:32 +0300 Subject: [PATCH 091/222] Add Node 7 to CI (#5165) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index edc8e157cb..60d0fd778c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ cache: directories: - node_modules node_js: +- '7' - '6' - '5' - '4' From d7a0ef19f1c0581c8d4045c2541179d4e253f505 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 20 Jan 2017 10:08:01 -0500 Subject: [PATCH 092/222] Run in dev on build otherwise it runs with coverage plugin (#5159) [skip ci] --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 561846cef5..850316c344 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ export NODE_ENV = test .PHONY: build build-dist watch lint fix clean test-clean test-only test test-cov test-ci publish bootstrap build: clean - ./node_modules/.bin/gulp build + BABEL_ENV=development ./node_modules/.bin/gulp build build-dist: build cd packages/babel-polyfill; \ From 3a0d1599cd593228ef34f242a07d74f86e1154c2 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 20 Jan 2017 17:46:09 -0500 Subject: [PATCH 093/222] Internal: only build once on CI (#5177) --- Makefile | 18 +++++------------- package.json | 2 +- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 850316c344..9dc300ba6c 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ MAKEFLAGS = -j1 export NODE_ENV = test -.PHONY: build build-dist watch lint fix clean test-clean test-only test test-cov test-ci publish bootstrap +.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap build: clean - BABEL_ENV=development ./node_modules/.bin/gulp build + ./node_modules/.bin/gulp build build-dist: build cd packages/babel-polyfill; \ @@ -16,7 +16,7 @@ build-dist: build watch: clean rm -rf packages/*/lib - BABEL_ENV=development ./node_modules/.bin/gulp watch + ./node_modules/.bin/gulp watch lint: ./node_modules/.bin/eslint packages/ --format=codeframe @@ -42,22 +42,15 @@ clean-all: rm -rf packages/*/node_modules make clean -# without lint test-only: ./scripts/test.sh make test-clean test: lint test-only -test-cov: clean - # rebuild with test - rm -rf packages/*/lib - BABEL_ENV=test ./node_modules/.bin/gulp build - ./scripts/test-cov.sh - test-ci: - NODE_ENV=test make bootstrap - make test-cov + NODE_ENV=test BABEL_ENV=cov make bootstrap + ./scripts/test-cov.sh ./node_modules/.bin/codecov -f coverage/coverage-final.json publish: @@ -68,7 +61,6 @@ publish: # not using lerna independent mode atm, so only update packages that have changed since we use ^ ./node_modules/.bin/lerna publish --only-explicit-updates make clean - #./scripts/build-website.sh bootstrap: make clean-all diff --git a/package.json b/package.json index 30fdfe6149..90db588cb8 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "transform-flow-strip-types" ], "env": { - "test": { + "cov": { "auxiliaryCommentBefore": "istanbul ignore next", "plugins": [ "istanbul" From d76092b2ddd86ecaa9df2a23610fd86a34ed379b Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 21 Jan 2017 07:20:03 -0600 Subject: [PATCH 094/222] Internal: Run coverage only once (#5182) --- .travis.yml | 33 ++++++++++++++++++--------------- Makefile | 4 ++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60d0fd778c..1f8f16bb4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,28 +6,31 @@ cache: directories: - node_modules node_js: -- '7' -- '6' -- '5' -- '4' -- '0.12' -script: - - 'if [ -n "${LINT-}" ]; then make lint ; fi' - - 'if [ -z "${LINT-}" ]; then make test-ci ; fi' - - 'if [ -n "${FLOW-}" ]; then make flow ; fi' + - '6' + - '5' + - '4' + - '0.12' + +env: + - JOB=test + +script: + - 'if [ "$JOB" = "test" ]; then make test-ci; fi' + - 'if [ "$JOB" = "test-coverage" ]; then make test-ci-coverage; fi' + - 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi' matrix: fast_finish: true include: + - node_js: "7" + env: JOB=test-coverage - node_js: "node" - env: - - LINT: true - - FLOW: true - + env: JOB=lint + notifications: - on_success: change - on_failure: always slack: + on_success: change + on_failure: always rooms: # Generate with # travis encrypt "babeljs:#activity" --add notifications.slack.rooms diff --git a/Makefile b/Makefile index 9dc300ba6c..823878ed17 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,10 @@ test-only: test: lint test-only test-ci: + NODE_ENV=test make bootstrap + make test-only + +test-ci-coverage: NODE_ENV=test BABEL_ENV=cov make bootstrap ./scripts/test-cov.sh ./node_modules/.bin/codecov -f coverage/coverage-final.json From e9d87ed55cfa5a11cec91003dd4ed29692ddb8e0 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sat, 21 Jan 2017 08:33:34 -0500 Subject: [PATCH 095/222] Remove path-is-absolute in favor of builtin path.isAbsolute (#5179) --- packages/babel-cli/package.json | 1 - packages/babel-cli/src/_babel-node.js | 3 +-- packages/babel-core/package.json | 1 - .../src/transformation/file/options/build-config-chain.js | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index a4a9444af0..9218555fde 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -26,7 +26,6 @@ "glob": "^7.0.0", "lodash": "^4.2.0", "output-file-sync": "^1.1.0", - "path-is-absolute": "^1.0.0", "slash": "^1.0.0", "source-map": "^0.5.0", "v8flags": "^2.0.10" diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 70bf813a48..032d1a1b03 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -1,4 +1,3 @@ -import pathIsAbsolute from "path-is-absolute"; import commander from "commander"; import Module from "module"; import { inspect } from "util"; @@ -123,7 +122,7 @@ if (program.eval || program.print) { // make the filename absolute const filename = args[0]; - if (!pathIsAbsolute(filename)) args[0] = path.join(process.cwd(), filename); + if (!path.isAbsolute(filename)) args[0] = path.join(process.cwd(), filename); // add back on node and concat the sliced args process.argv = ["node"].concat(args); diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index a9cbeb1f8b..8de01d55b1 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -41,7 +41,6 @@ "json5": "^0.5.0", "lodash": "^4.2.0", "minimatch": "^3.0.2", - "path-is-absolute": "^1.0.0", "private": "^0.1.6", "slash": "^1.0.0", "source-map": "^0.5.0" diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index f546f45b32..deee5efffc 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -2,7 +2,6 @@ import type Logger from "../logger"; import resolve from "../../../helpers/resolve"; import json5 from "json5"; -import isAbsolute from "path-is-absolute"; import path from "path"; import fs from "fs"; @@ -50,7 +49,7 @@ class ConfigChainBuilder { findConfigs(loc) { if (!loc) return; - if (!isAbsolute(loc)) { + if (!path.isAbsolute(loc)) { loc = path.join(process.cwd(), loc); } From 20a5249deaa72ff7ab64855f4eb5d21c2754fb8d Mon Sep 17 00:00:00 2001 From: Scott Arnold Date: Sat, 21 Jan 2017 10:14:49 -0500 Subject: [PATCH 096/222] [7.0] Drop support for Node 5 (#5186) --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 88481ec651..c4cf2e27fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ cache: - node_modules node_js: - '6' - - '5' - '4' env: From 728072f47b38ace3ce801e4498c20173483383f0 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Bansal Date: Sat, 21 Jan 2017 21:55:29 +0530 Subject: [PATCH 097/222] [7.0] Remove old babel-runtime code (#5187) --- packages/babel-runtime/scripts/build-dist.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/packages/babel-runtime/scripts/build-dist.js b/packages/babel-runtime/scripts/build-dist.js index 4685c13abd..1d1e6c58ad 100644 --- a/packages/babel-runtime/scripts/build-dist.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -23,18 +23,6 @@ paths.forEach(function (path) { writeFile("core-js/" + path + ".js", defaultify('require("core-js/library/fn/' + path + '")')); }); -// Should be removed in the next major release: -var legacy = [ - ["string/pad-left", "string/pad-start"], - ["string/pad-right", "string/pad-end"] -]; - -legacy.forEach(function(pair) { - const a = pair[0]; - const b = pair[1]; - writeFile("core-js/" + a + ".js", defaultify('require("core-js/library/fn/' + b + '")')); -}); - var helpers = require("babel-helpers"); var babel = require("../../babel-core"); var util = require("../../babel-core/lib/util"); From c638985aca823f4341c10ff56689d44136d06ba5 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Mon, 23 Jan 2017 16:48:35 +0100 Subject: [PATCH 098/222] docs: [skip ci] update README (#5194) --- .../README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/README.md b/packages/babel-plugin-transform-es2015-arrow-functions/README.md index 6e1b8f353e..6689b0f85c 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/README.md +++ b/packages/babel-plugin-transform-es2015-arrow-functions/README.md @@ -51,8 +51,6 @@ var bob = { console.log(bob.printFriends()); ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&lineWrap=true&presets=es2015%2Ces2015-loose&experimental=false&loose=false&spec=false&code=var%20a%20%3D%20()%20%3D%3E%20%7B%7D%3B%0Avar%20a%20%3D%20(b)%20%3D%3E%20b%3B%0A%0Aconst%20double%20%3D%20%5B1%2C2%2C3%5D.map((num)%20%3D%3E%20num%20*%202)%3B%0Aconsole.log(double)%3B%20%2F%2F%20%5B2%2C4%2C6%5D%0A%0Avar%20bob%20%3D%20%7B%0A%20%20_name%3A%20%22Bob%22%2C%0A%20%20_friends%3A%20%5B%22Sally%22%2C%20%22Tom%22%5D%2C%0A%20%20printFriends()%20%7B%0A%20%20%20%20this._friends.forEach(f%20%3D%3E%0A%20%20%20%20%20%20console.log(this._name%20%2B%20%22%20knows%20%22%20%2B%20f))%3B%0A%20%20%7D%0A%7D%3B%0Aconsole.log(bob.printFriends())%3B&playground=true) - ## Installation ```sh @@ -65,13 +63,15 @@ npm install --save-dev babel-plugin-transform-es2015-arrow-functions **.babelrc** -```js -// without options +Without options: +```json { "plugins": ["transform-es2015-arrow-functions"] } +``` -// with options +With options +```json { "plugins": [ ["transform-es2015-arrow-functions", { "spec": true }] From b69dc51be0cdb6a959f9d9b43aa085449c6dcda9 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 23 Jan 2017 10:45:57 -0600 Subject: [PATCH 099/222] Fix missing parens when function expressions is tag (#5193) --- .../babel-generator/src/node/parentheses.js | 22 ++++++++++--------- .../tagged-template-expression/actual.js | 2 ++ .../tagged-template-expression/expected.js | 2 ++ 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/actual.js create mode 100644 packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/expected.js diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index e6424aced6..4da106ce99 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -170,16 +170,14 @@ export function FunctionExpression(node: Object, parent: Object, printStack: Arr } export function ArrowFunctionExpression(node: Object, parent: Object): boolean { - // export default (function () {}); - if (t.isExportDeclaration(parent)) { - return true; - } - - if (t.isBinaryExpression(parent) || t.isLogicalExpression(parent)) { - return true; - } - - if (t.isUnaryExpression(parent)) { + if ( + // export default (function () {}); + t.isExportDeclaration(parent) || + t.isBinaryExpression(parent) || + t.isLogicalExpression(parent) || + t.isUnaryExpression(parent) || + t.isTaggedTemplateExpression(parent) + ) { return true; } @@ -225,6 +223,10 @@ function isFirstInStatement(printStack: Array, { return true; } + if (t.isTaggedTemplateExpression(parent)) { + return true; + } + if (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) { return true; } diff --git a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/actual.js b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/actual.js new file mode 100644 index 0000000000..8a19f04a89 --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/actual.js @@ -0,0 +1,2 @@ +(() => {})``; +(function(){}``); diff --git a/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/expected.js b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/expected.js new file mode 100644 index 0000000000..f47cd2e9af --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/tagged-template-expression/expected.js @@ -0,0 +1,2 @@ +(() => {})``; +(function () {})``; \ No newline at end of file From 2ee3a017f04a8cab547b7473f96331bcc238e469 Mon Sep 17 00:00:00 2001 From: Chau Nguyen Date: Mon, 23 Jan 2017 15:15:33 -0800 Subject: [PATCH 100/222] [7.0] Added yarn.lock (#5175) * Added yarn.lock * Updated bootstrap npm install commands to yarn and added yarn caching --- .travis.yml | 1 + Makefile | 2 +- yarn.lock | 4527 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 4529 insertions(+), 1 deletion(-) create mode 100644 yarn.lock diff --git a/.travis.yml b/.travis.yml index c4cf2e27fa..860922b1b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ git: sudo: false language: node_js cache: + yarn: true directories: - node_modules node_js: diff --git a/Makefile b/Makefile index 823878ed17..df498a5323 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ publish: bootstrap: make clean-all - npm install + yarn ./node_modules/.bin/lerna bootstrap make build cd packages/babel-runtime; \ diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000000..7f42f4d322 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4527 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +JSONStream@^1.0.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + +abbrev@1: + version "1.0.9" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + dependencies: + acorn "^3.0.4" + +acorn@^1.0.3: + version "1.2.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-1.2.2.tgz#c8ce27de0acc76d896d2b1fad3df588d9e82f014" + +acorn@^2.1.0, acorn@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" + +acorn@^3.0.4, acorn@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + +acorn@^4.0.1, acorn@^4.0.3: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + +ajv-keywords@^1.0.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.0.tgz#c11e6859eafff83e0dafc416929472eca946aa2c" + +ajv@^4.7.0: + version "4.10.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.10.4.tgz#c0974dd00b3464984892d6010aa9c2c945933254" + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +align-text@^0.1.1, align-text@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" + dependencies: + kind-of "^3.0.2" + longest "^1.0.1" + repeat-string "^1.5.2" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + +ansi-styles@^2.1.0, ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + +anymatch@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507" + dependencies: + arrify "^1.0.0" + micromatch "^2.1.5" + +append-transform@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" + dependencies: + default-require-extensions "^1.0.0" + +aproba@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.0.4.tgz#2713680775e7614c8ba186c065d4e2e52d1072c0" + +archy@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" + +are-we-there-yet@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz#80e470e95a084794fe1899262c5667c6e88de1b3" + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.0 || ^1.1.13" + +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + +argv@>=0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab" + +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + +arr-flatten@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.0.1.tgz#e5ffe54d45e19f32f216e91eb99c8ce892bb604b" + +array-differ@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-1.0.0.tgz#eff52e3758249d33be402b8bb8e564bb2b5d4031" + +array-filter@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" + +array-find-index@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" + +array-map@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" + +array-reduce@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" + +array-union@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" + dependencies: + array-uniq "^1.0.1" + +array-uniq@^1.0.1, array-uniq@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" + +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + +arrify@^1.0.0, arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" + +asn1.js@^4.0.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-4.9.1.tgz#48ba240b45a9280e94748990ba597d216617fd40" + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +asn1@~0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86" + +assert-plus@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" + +assert-plus@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" + +assert@^1.4.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/assert/-/assert-1.4.1.tgz#99912d591836b5a6f5b345c0f07eefc08fc65d91" + dependencies: + util "0.10.3" + +assertion-error@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.0.2.tgz#13ca515d86206da0bac66e834dd397d87581094c" + +astw@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astw/-/astw-2.0.0.tgz#08121ac8288d35611c0ceec663f6cd545604897d" + dependencies: + acorn "^1.0.3" + +async-each@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" + +async@^1.4.0, async@^1.4.2, async@^1.5.0: + version "1.5.2" + resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" + +async@~0.2.6: + version "0.2.10" + resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" + +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + +aws-sign2@~0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" + +aws4@^1.2.1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.5.0.tgz#0a29ffb79c31c9e712eeb087e8e7a64b4a56d755" + +babel-code-frame@^6.16.0, babel-code-frame@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" + dependencies: + chalk "^1.1.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +babel-core@^6.0.2, babel-core@^6.13.2, babel-core@^6.22.0: + version "6.22.1" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.22.1.tgz#9c5fd658ba1772d28d721f6d25d968fc7ae21648" + dependencies: + babel-code-frame "^6.22.0" + babel-generator "^6.22.0" + babel-helpers "^6.22.0" + babel-messages "^6.22.0" + babel-register "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.1" + babel-types "^6.22.0" + babylon "^6.11.0" + convert-source-map "^1.1.0" + debug "^2.1.1" + json5 "^0.5.0" + lodash "^4.2.0" + minimatch "^3.0.2" + path-is-absolute "^1.0.0" + private "^0.1.6" + slash "^1.0.0" + source-map "^0.5.0" + +babel-eslint@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" + dependencies: + babel-code-frame "^6.16.0" + babel-traverse "^6.15.0" + babel-types "^6.15.0" + babylon "^6.13.0" + lodash.pickby "^4.6.0" + +babel-generator@^6.18.0, babel-generator@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.22.0.tgz#d642bf4961911a8adc7c692b0c9297f325cda805" + dependencies: + babel-messages "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + detect-indent "^4.0.0" + jsesc "^1.3.0" + lodash "^4.2.0" + source-map "^0.5.0" + +babel-helper-bindify-decorators@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.22.0.tgz#d7f5bc261275941ac62acfc4e20dacfb8a3fe952" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-builder-binary-assignment-operator-visitor@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.22.0.tgz#29df56be144d81bdeac08262bfa41d2c5e91cdcd" + dependencies: + babel-helper-explode-assignable-expression "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-helper-call-delegate@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-call-delegate/-/babel-helper-call-delegate-6.22.0.tgz#119921b56120f17e9dae3f74b4f5cc7bcc1b37ef" + dependencies: + babel-helper-hoist-variables "^6.22.0" + babel-runtime "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-define-map@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-define-map/-/babel-helper-define-map-6.22.0.tgz#9544e9502b2d6dfe7d00ff60e82bd5a7a89e95b7" + dependencies: + babel-helper-function-name "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + lodash "^4.2.0" + +babel-helper-explode-assignable-expression@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.22.0.tgz#c97bf76eed3e0bae4048121f2b9dae1a4e7d0478" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-explode-class@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-explode-class/-/babel-helper-explode-class-6.22.0.tgz#646304924aa6388a516843ba7f1855ef8dfeb69b" + dependencies: + babel-helper-bindify-decorators "^6.22.0" + babel-runtime "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-function-name@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.22.0.tgz#51f1bdc4bb89b15f57a9b249f33d742816dcbefc" + dependencies: + babel-helper-get-function-arity "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-get-function-arity@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.22.0.tgz#0beb464ad69dc7347410ac6ade9f03a50634f5ce" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-helper-hoist-variables@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.22.0.tgz#3eacbf731d80705845dd2e9718f600cfb9b4ba72" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-helper-optimise-call-expression@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.22.0.tgz#f8d5d4b40a6e2605a6a7f9d537b581bea3756d15" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-helper-regex@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-regex/-/babel-helper-regex-6.22.0.tgz#79f532be1647b1f0ee3474b5f5c3da58001d247d" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + lodash "^4.2.0" + +babel-helper-remap-async-to-generator@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.22.0.tgz#2186ae73278ed03b8b15ced089609da981053383" + dependencies: + babel-helper-function-name "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helper-replace-supers@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helper-replace-supers/-/babel-helper-replace-supers-6.22.0.tgz#1fcee2270657548908c34db16bcc345f9850cf42" + dependencies: + babel-helper-optimise-call-expression "^6.22.0" + babel-messages "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-helpers@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.22.0.tgz#d275f55f2252b8101bff07bc0c556deda657392c" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-messages@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.22.0.tgz#36066a214f1217e4ed4164867669ecb39e3ea575" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-check-es2015-constants@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-istanbul@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-2.0.3.tgz#266b304b9109607d60748474394676982f660df4" + dependencies: + find-up "^1.1.2" + istanbul-lib-instrument "^1.1.4" + object-assign "^4.1.0" + test-exclude "^2.1.1" + +babel-plugin-syntax-async-functions@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95" + +babel-plugin-syntax-async-generators@^6.5.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz#6bc963ebb16eccbae6b92b596eb7f35c342a8b9a" + +babel-plugin-syntax-class-constructor-call@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz#9cb9d39fe43c8600bec8146456ddcbd4e1a76416" + +babel-plugin-syntax-class-properties@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz#d7eb23b79a317f8543962c505b827c7d6cac27de" + +babel-plugin-syntax-decorators@^6.13.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz#312563b4dbde3cc806cee3e416cceeaddd11ac0b" + +babel-plugin-syntax-do-expressions@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-do-expressions/-/babel-plugin-syntax-do-expressions-6.13.0.tgz#5747756139aa26d390d09410b03744ba07e4796d" + +babel-plugin-syntax-dynamic-import@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz#8d6a26229c83745a9982a441051572caa179b1da" + +babel-plugin-syntax-exponentiation-operator@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz#9ee7e8337290da95288201a6a57f4170317830de" + +babel-plugin-syntax-export-extensions@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz#70a1484f0f9089a4e84ad44bac353c95b9b12721" + +babel-plugin-syntax-flow@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz#4c3ab20a2af26aa20cd25995c398c4eb70310c8d" + +babel-plugin-syntax-function-bind@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-function-bind/-/babel-plugin-syntax-function-bind-6.13.0.tgz#48c495f177bdf31a981e732f55adc0bdd2601f46" + +babel-plugin-syntax-object-rest-spread@^6.8.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" + +babel-plugin-syntax-trailing-function-commas@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + +babel-plugin-transform-async-generator-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.22.0.tgz#a720a98153a7596f204099cd5409f4b3c05bab46" + dependencies: + babel-helper-remap-async-to-generator "^6.22.0" + babel-plugin-syntax-async-generators "^6.5.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-async-to-generator@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.22.0.tgz#194b6938ec195ad36efc4c33a971acf00d8cd35e" + dependencies: + babel-helper-remap-async-to-generator "^6.22.0" + babel-plugin-syntax-async-functions "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-class-constructor-call@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.22.0.tgz#11a4d2216abb5b0eef298b493748f4f2f4869120" + dependencies: + babel-plugin-syntax-class-constructor-call "^6.18.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-class-properties@^6.22.0, babel-plugin-transform-class-properties@^6.6.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.22.0.tgz#aa78f8134495c7de06c097118ba061844e1dc1d8" + dependencies: + babel-helper-function-name "^6.22.0" + babel-plugin-syntax-class-properties "^6.8.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-decorators@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.22.0.tgz#c03635b27a23b23b7224f49232c237a73988d27c" + dependencies: + babel-helper-explode-class "^6.22.0" + babel-plugin-syntax-decorators "^6.13.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-do-expressions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-do-expressions/-/babel-plugin-transform-do-expressions-6.22.0.tgz#28ccaf92812d949c2cd1281f690c8fdc468ae9bb" + dependencies: + babel-plugin-syntax-do-expressions "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-arrow-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-block-scoping@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.22.0.tgz#00d6e3a0bebdcfe7536b9d653b44a9141e63e47e" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + lodash "^4.2.0" + +babel-plugin-transform-es2015-classes@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.22.0.tgz#54d44998fd823d9dca15292324161c331c1b6f14" + dependencies: + babel-helper-define-map "^6.22.0" + babel-helper-function-name "^6.22.0" + babel-helper-optimise-call-expression "^6.22.0" + babel-helper-replace-supers "^6.22.0" + babel-messages "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-computed-properties@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz#7c383e9629bba4820c11b0425bdd6290f7f057e7" + dependencies: + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-es2015-destructuring@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.22.0.tgz#8e0af2f885a0b2cf999d47c4c1dd23ce88cfa4c6" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-duplicate-keys@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz#672397031c21610d72dd2bbb0ba9fb6277e1c36b" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-for-of@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.22.0.tgz#180467ad63aeea592a1caeee4bf1c8b3e2616265" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-function-name@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz#f5fcc8b09093f9a23c76ac3d9e392c3ec4b77104" + dependencies: + babel-helper-function-name "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-modules-amd@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.22.0.tgz#bf69cd34889a41c33d90dfb740e0091ccff52f21" + dependencies: + babel-plugin-transform-es2015-modules-commonjs "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-es2015-modules-commonjs@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.22.0.tgz#6ca04e22b8e214fb50169730657e7a07dc941145" + dependencies: + babel-plugin-transform-strict-mode "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-modules-systemjs@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.22.0.tgz#810cd0cd025a08383b84236b92c6e31f88e644ad" + dependencies: + babel-helper-hoist-variables "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-es2015-modules-umd@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.22.0.tgz#60d0ba3bd23258719c64391d9bf492d648dc0fae" + dependencies: + babel-plugin-transform-es2015-modules-amd "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + +babel-plugin-transform-es2015-object-super@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz#daa60e114a042ea769dd53fe528fc82311eb98fc" + dependencies: + babel-helper-replace-supers "^6.22.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-parameters@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.22.0.tgz#57076069232019094f27da8c68bb7162fe208dbb" + dependencies: + babel-helper-call-delegate "^6.22.0" + babel-helper-get-function-arity "^6.22.0" + babel-runtime "^6.22.0" + babel-template "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-shorthand-properties@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz#8ba776e0affaa60bff21e921403b8a652a2ff723" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-spread@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-sticky-regex@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz#ab316829e866ee3f4b9eb96939757d19a5bc4593" + dependencies: + babel-helper-regex "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-plugin-transform-es2015-template-literals@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-typeof-symbol@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.22.0.tgz#87faf2336d3b6a97f68c4d906b0cd0edeae676e1" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-es2015-unicode-regex@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz#8d9cc27e7ee1decfe65454fb986452a04a613d20" + dependencies: + babel-helper-regex "^6.22.0" + babel-runtime "^6.22.0" + regexpu-core "^2.0.0" + +babel-plugin-transform-exponentiation-operator@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.22.0.tgz#d57c8335281918e54ef053118ce6eb108468084d" + dependencies: + babel-helper-builder-binary-assignment-operator-visitor "^6.22.0" + babel-plugin-syntax-exponentiation-operator "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-export-extensions@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz#53738b47e75e8218589eea946cbbd39109bbe653" + dependencies: + babel-plugin-syntax-export-extensions "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-flow-strip-types@^6.3.13: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz#84cb672935d43714fdc32bce84568d87441cf7cf" + dependencies: + babel-plugin-syntax-flow "^6.18.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-function-bind@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-function-bind/-/babel-plugin-transform-function-bind-6.22.0.tgz#c6fb8e96ac296a310b8cf8ea401462407ddf6a97" + dependencies: + babel-plugin-syntax-function-bind "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-object-rest-spread@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.22.0.tgz#1d419b55e68d2e4f64a5ff3373bd67d73c8e83bc" + dependencies: + babel-plugin-syntax-object-rest-spread "^6.8.0" + babel-runtime "^6.22.0" + +babel-plugin-transform-regenerator@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz#65740593a319c44522157538d690b84094617ea6" + dependencies: + regenerator-transform "0.9.8" + +babel-plugin-transform-runtime@^6.3.13: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.22.0.tgz#10968d760bbf6517243081eec778e10fa828551c" + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-transform-strict-mode@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c" + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.22.0" + +babel-preset-es2015@^6.13.2: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.22.0.tgz#af5a98ecb35eb8af764ad8a5a05eb36dc4386835" + dependencies: + babel-plugin-check-es2015-constants "^6.22.0" + babel-plugin-transform-es2015-arrow-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" + babel-plugin-transform-es2015-block-scoping "^6.22.0" + babel-plugin-transform-es2015-classes "^6.22.0" + babel-plugin-transform-es2015-computed-properties "^6.22.0" + babel-plugin-transform-es2015-destructuring "^6.22.0" + babel-plugin-transform-es2015-duplicate-keys "^6.22.0" + babel-plugin-transform-es2015-for-of "^6.22.0" + babel-plugin-transform-es2015-function-name "^6.22.0" + babel-plugin-transform-es2015-literals "^6.22.0" + babel-plugin-transform-es2015-modules-amd "^6.22.0" + babel-plugin-transform-es2015-modules-commonjs "^6.22.0" + babel-plugin-transform-es2015-modules-systemjs "^6.22.0" + babel-plugin-transform-es2015-modules-umd "^6.22.0" + babel-plugin-transform-es2015-object-super "^6.22.0" + babel-plugin-transform-es2015-parameters "^6.22.0" + babel-plugin-transform-es2015-shorthand-properties "^6.22.0" + babel-plugin-transform-es2015-spread "^6.22.0" + babel-plugin-transform-es2015-sticky-regex "^6.22.0" + babel-plugin-transform-es2015-template-literals "^6.22.0" + babel-plugin-transform-es2015-typeof-symbol "^6.22.0" + babel-plugin-transform-es2015-unicode-regex "^6.22.0" + babel-plugin-transform-regenerator "^6.22.0" + +babel-preset-stage-0@^6.0.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-stage-0/-/babel-preset-stage-0-6.22.0.tgz#707eeb5b415da769eff9c42f4547f644f9296ef9" + dependencies: + babel-plugin-transform-do-expressions "^6.22.0" + babel-plugin-transform-function-bind "^6.22.0" + babel-preset-stage-1 "^6.22.0" + +babel-preset-stage-1@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-stage-1/-/babel-preset-stage-1-6.22.0.tgz#7da05bffea6ad5a10aef93e320cfc6dd465dbc1a" + dependencies: + babel-plugin-transform-class-constructor-call "^6.22.0" + babel-plugin-transform-export-extensions "^6.22.0" + babel-preset-stage-2 "^6.22.0" + +babel-preset-stage-2@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-stage-2/-/babel-preset-stage-2-6.22.0.tgz#ccd565f19c245cade394b21216df704a73b27c07" + dependencies: + babel-plugin-syntax-dynamic-import "^6.18.0" + babel-plugin-transform-class-properties "^6.22.0" + babel-plugin-transform-decorators "^6.22.0" + babel-preset-stage-3 "^6.22.0" + +babel-preset-stage-3@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-preset-stage-3/-/babel-preset-stage-3-6.22.0.tgz#a4e92bbace7456fafdf651d7a7657ee0bbca9c2e" + dependencies: + babel-plugin-syntax-trailing-function-commas "^6.22.0" + babel-plugin-transform-async-generator-functions "^6.22.0" + babel-plugin-transform-async-to-generator "^6.22.0" + babel-plugin-transform-exponentiation-operator "^6.22.0" + babel-plugin-transform-object-rest-spread "^6.22.0" + +babel-register@^6.14.0, babel-register@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.22.0.tgz#a61dd83975f9ca4a9e7d6eff3059494cd5ea4c63" + dependencies: + babel-core "^6.22.0" + babel-runtime "^6.22.0" + core-js "^2.4.0" + home-or-tmp "^2.0.0" + lodash "^4.2.0" + mkdirp "^0.5.1" + source-map-support "^0.4.2" + +babel-runtime@^6.0.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611" + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.10.0" + +babel-template@^6.16.0, babel-template@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.22.0.tgz#403d110905a4626b317a2a1fcb8f3b73204b2edb" + dependencies: + babel-runtime "^6.22.0" + babel-traverse "^6.22.0" + babel-types "^6.22.0" + babylon "^6.11.0" + lodash "^4.2.0" + +babel-traverse@^6.15.0, babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1: + version "6.22.1" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.22.1.tgz#3b95cd6b7427d6f1f757704908f2fc9748a5f59f" + dependencies: + babel-code-frame "^6.22.0" + babel-messages "^6.22.0" + babel-runtime "^6.22.0" + babel-types "^6.22.0" + babylon "^6.15.0" + debug "^2.2.0" + globals "^9.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-types@^6.15.0, babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.22.0.tgz#2a447e8d0ea25d2512409e4175479fd78cc8b1db" + dependencies: + babel-runtime "^6.22.0" + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^1.0.1" + +babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: + version "6.15.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e" + +balanced-match@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" + +base64-js@^1.0.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.2.0.tgz#a39992d723584811982be5e290bb6a53d86700f1" + +bcrypt-pbkdf@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz#3ca76b85241c7170bf7d9703e7b9aa74630040d4" + dependencies: + tweetnacl "^0.14.3" + +beeper@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809" + +binary-extensions@^1.0.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774" + +block-stream@*: + version "0.0.9" + resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" + dependencies: + inherits "~2.0.0" + +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: + version "4.11.6" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215" + +boom@2.x.x: + version "2.10.1" + resolved "https://registry.yarnpkg.com/boom/-/boom-2.10.1.tgz#39c8918ceff5799f83f9492a848f625add0c766f" + dependencies: + hoek "2.x.x" + +brace-expansion@^1.0.0: + version "1.1.6" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" + dependencies: + balanced-match "^0.4.1" + concat-map "0.0.1" + +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + +brorand@^1.0.1: + version "1.0.6" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.0.6.tgz#4028706b915f91f7b349a2e0bf3c376039d216e5" + +browser-pack@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d" + dependencies: + JSONStream "^1.0.3" + combine-source-map "~0.6.1" + defined "^1.0.0" + through2 "^1.0.0" + umd "^3.0.0" + +browser-pack@^6.0.1: + version "6.0.2" + resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.2.tgz#f86cd6cef4f5300c8e63e07a4d512f65fbff4531" + dependencies: + JSONStream "^1.0.3" + combine-source-map "~0.7.1" + defined "^1.0.0" + through2 "^2.0.0" + umd "^3.0.0" + +browser-resolve@^1.11.0, browser-resolve@^1.7.0: + version "1.11.2" + resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" + dependencies: + resolve "1.1.7" + +browser-stdout@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" + +browser-unpack@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/browser-unpack/-/browser-unpack-1.1.1.tgz#42d1423bf719074c1ef88d82e6b94752a41882bd" + dependencies: + acorn "^2.1.0" + browser-pack "^5.0.1" + concat-stream "^1.5.0" + minimist "^1.1.1" + +browserify-aes@^1.0.0, browserify-aes@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.0.6.tgz#5e7725dbdef1fd5930d4ebab48567ce451c48a0a" + dependencies: + buffer-xor "^1.0.2" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.0" + inherits "^2.0.1" + +browserify-cipher@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.0.tgz#9988244874bf5ed4e28da95666dcd66ac8fc363a" + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.0.tgz#daa277717470922ed2fe18594118a175439721dd" + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + +browserify-rsa@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524" + dependencies: + bn.js "^4.1.0" + randombytes "^2.0.1" + +browserify-sign@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.0.0.tgz#10773910c3c206d5420a46aad8694f820b85968f" + dependencies: + bn.js "^4.1.1" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.2" + elliptic "^6.0.0" + inherits "^2.0.1" + parse-asn1 "^5.0.0" + +browserify-zlib@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.1.4.tgz#bb35f8a519f600e0fa6b8485241c979d0141fb2d" + dependencies: + pako "~0.2.0" + +browserify@^13.1.1: + version "13.3.0" + resolved "https://registry.yarnpkg.com/browserify/-/browserify-13.3.0.tgz#b5a9c9020243f0c70e4675bec8223bc627e415ce" + dependencies: + JSONStream "^1.0.3" + assert "^1.4.0" + browser-pack "^6.0.1" + browser-resolve "^1.11.0" + browserify-zlib "~0.1.2" + buffer "^4.1.0" + cached-path-relative "^1.0.0" + concat-stream "~1.5.1" + console-browserify "^1.1.0" + constants-browserify "~1.0.0" + crypto-browserify "^3.0.0" + defined "^1.0.0" + deps-sort "^2.0.0" + domain-browser "~1.1.0" + duplexer2 "~0.1.2" + events "~1.1.0" + glob "^7.1.0" + has "^1.0.0" + htmlescape "^1.1.0" + https-browserify "~0.0.0" + inherits "~2.0.1" + insert-module-globals "^7.0.0" + labeled-stream-splicer "^2.0.0" + module-deps "^4.0.8" + os-browserify "~0.1.1" + parents "^1.0.1" + path-browserify "~0.0.0" + process "~0.11.0" + punycode "^1.3.2" + querystring-es3 "~0.2.0" + read-only-stream "^2.0.0" + readable-stream "^2.0.2" + resolve "^1.1.4" + shasum "^1.0.0" + shell-quote "^1.6.1" + stream-browserify "^2.0.0" + stream-http "^2.0.0" + string_decoder "~0.10.0" + subarg "^1.0.0" + syntax-error "^1.1.1" + through2 "^2.0.0" + timers-browserify "^1.0.1" + tty-browserify "~0.0.0" + url "~0.11.0" + util "~0.10.1" + vm-browserify "~0.0.1" + xtend "^4.0.0" + +buffer-shims@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" + +buffer-xor@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + +buffer@^4.1.0: + version "4.9.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-4.9.1.tgz#6d1bb601b07a4efced97094132093027c95bc298" + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + isarray "^1.0.0" + +builtin-modules@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +builtin-status-codes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" + +bundle-collapser@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/bundle-collapser/-/bundle-collapser-1.2.1.tgz#e119afc92638e440b9085f47ae081fa756cba33d" + dependencies: + browser-pack "^5.0.1" + browser-unpack "^1.1.0" + concat-stream "^1.5.0" + falafel "^1.2.0" + minimist "^1.1.1" + through2 "^2.0.0" + +cached-path-relative@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.0.tgz#d1094c577fbd9a8b8bd43c96af6188aa205d05f4" + +caching-transform@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-1.0.1.tgz#6dbdb2f20f8d8fbce79f3e94e9d1742dcdf5c0a1" + dependencies: + md5-hex "^1.2.0" + mkdirp "^0.5.1" + write-file-atomic "^1.1.4" + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + +camelcase-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7" + dependencies: + camelcase "^2.0.0" + map-obj "^1.0.0" + +camelcase@^1.0.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" + +camelcase@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" + +camelcase@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a" + +caseless@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" + +center-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" + dependencies: + align-text "^0.1.3" + lazy-cache "^1.0.3" + +chai@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/chai/-/chai-3.5.0.tgz#4d02637b067fe958bdbfdd3a40ec56fef7373247" + dependencies: + assertion-error "^1.0.1" + deep-eql "^0.1.3" + type-detect "^1.0.0" + +chalk@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.1.tgz#509afb67066e7499f7eb3535c77445772ae2d019" + dependencies: + ansi-styles "^2.1.0" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +chokidar@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" + dependencies: + anymatch "^1.3.0" + async-each "^1.0.0" + glob-parent "^2.0.0" + inherits "^2.0.1" + is-binary-path "^1.0.0" + is-glob "^2.0.0" + path-is-absolute "^1.0.0" + readdirp "^2.0.0" + optionalDependencies: + fsevents "^1.0.0" + +cipher-base@^1.0.0, cipher-base@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.3.tgz#eeabf194419ce900da3018c207d212f2a6df0a07" + dependencies: + inherits "^2.0.1" + +circular-json@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + +cliui@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" + dependencies: + center-align "^0.1.1" + right-align "^0.1.1" + wordwrap "0.0.2" + +cliui@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + wrap-ansi "^2.0.0" + +clone-stats@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1" + +clone@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.2.0.tgz#c6126a90ad4f72dbf5acdb243cc37724fe93fc1f" + +clone@^1.0.0, clone@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + +codecov@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/codecov/-/codecov-1.0.1.tgz#97260ceac0e96b8eda8d562006558a53a139dffd" + dependencies: + argv ">=0.0.2" + execSync "1.0.2" + request ">=2.42.0" + urlgrey ">=0.4.0" + +combine-source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" + dependencies: + convert-source-map "~1.1.0" + inline-source-map "~0.5.0" + lodash.memoize "~3.0.3" + source-map "~0.4.2" + +combine-source-map@~0.7.1: + version "0.7.2" + resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.7.2.tgz#0870312856b307a87cc4ac486f3a9a62aeccc09e" + dependencies: + convert-source-map "~1.1.0" + inline-source-map "~0.6.0" + lodash.memoize "~3.0.3" + source-map "~0.5.3" + +combined-stream@^1.0.5, combined-stream@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" + dependencies: + delayed-stream "~1.0.0" + +commander@2.9.0, commander@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" + dependencies: + graceful-readlink ">= 1.0.0" + +commondir@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + +concat-stream@^1.4.6, concat-stream@^1.5.0, concat-stream@~1.5.0, concat-stream@~1.5.1: + version "1.5.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.5.2.tgz#708978624d856af41a5a741defdd261da752c266" + dependencies: + inherits "~2.0.1" + readable-stream "~2.0.0" + typedarray "~0.0.5" + +console-browserify@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10" + dependencies: + date-now "^0.1.4" + +console-control-strings@^1.0.0, console-control-strings@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" + +constants-browserify@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" + +convert-source-map@^1.1.0, convert-source-map@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.3.0.tgz#e9f3e9c6e2728efc2676696a70eb382f73106a67" + +convert-source-map@~1.1.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" + +core-js@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + +create-ecdh@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.0.tgz#888c723596cdf7612f6498233eebd7a35301737d" + dependencies: + bn.js "^4.1.0" + elliptic "^6.0.0" + +create-hash@^1.1.0, create-hash@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.2.tgz#51210062d7bb7479f6c65bb41a92208b1d61abad" + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + ripemd160 "^1.0.0" + sha.js "^2.3.6" + +create-hmac@^1.1.0, create-hmac@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.4.tgz#d3fb4ba253eb8b3f56e39ea2fbcb8af747bd3170" + dependencies: + create-hash "^1.1.0" + inherits "^2.0.1" + +cross-spawn@^4: + version "4.0.2" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" + dependencies: + lru-cache "^4.0.1" + which "^1.2.9" + +cryptiles@2.x.x: + version "2.0.5" + resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" + dependencies: + boom "2.x.x" + +crypto-browserify@^3.0.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.11.0.tgz#3652a0906ab9b2a7e0c3ce66a408e957a2485522" + dependencies: + browserify-cipher "^1.0.0" + browserify-sign "^4.0.0" + create-ecdh "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.0" + diffie-hellman "^5.0.0" + inherits "^2.0.1" + pbkdf2 "^3.0.3" + public-encrypt "^4.0.0" + randombytes "^2.0.0" + +currently-unhandled@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" + dependencies: + array-find-index "^1.0.1" + +d@^0.1.1, d@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309" + dependencies: + es5-ext "~0.10.2" + +dashdash@^1.12.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" + dependencies: + assert-plus "^1.0.0" + +date-now@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" + +dateformat@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17" + +debug-log@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" + +debug@2.2.0, debug@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + +debug@^2.1.1, debug@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" + dependencies: + ms "0.7.2" + +decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + +deep-eql@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-0.1.3.tgz#ef558acab8de25206cd713906d74e56930eb69f2" + dependencies: + type-detect "0.1.1" + +deep-extend@~0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.1.tgz#efe4113d08085f4e6f9687759810f807469e2253" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + +default-require-extensions@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" + dependencies: + strip-bom "^2.0.0" + +defaults@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + dependencies: + clone "^1.0.2" + +defined@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" + +del@^2.0.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" + dependencies: + globby "^5.0.0" + is-path-cwd "^1.0.0" + is-path-in-cwd "^1.0.0" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + rimraf "^2.2.8" + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +delegates@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" + +deprecated@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/deprecated/-/deprecated-0.0.1.tgz#f9c9af5464afa1e7a971458a8bdef2aa94d5bb19" + +deps-sort@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.0.tgz#091724902e84658260eb910748cccd1af6e21fb5" + dependencies: + JSONStream "^1.0.3" + shasum "^1.0.0" + subarg "^1.0.0" + through2 "^2.0.0" + +derequire@^2.0.2: + version "2.0.6" + resolved "https://registry.yarnpkg.com/derequire/-/derequire-2.0.6.tgz#31a414bb7ca176239fa78b116636ef77d517e768" + dependencies: + acorn "^4.0.3" + concat-stream "^1.4.6" + escope "^3.6.0" + through2 "^2.0.0" + yargs "^6.5.0" + +des.js@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.0.tgz#c074d2e2aa6a8a9a07dbd61f9a15c2cd83ec8ecc" + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +detect-file@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-0.1.0.tgz#4935dedfd9488648e006b0129566e9386711ea63" + dependencies: + fs-exists-sync "^0.1.0" + +detect-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-4.0.0.tgz#f76d064352cdf43a1cb6ce619c4ee3a9475de208" + dependencies: + repeating "^2.0.0" + +detective@^4.0.0: + version "4.3.2" + resolved "https://registry.yarnpkg.com/detective/-/detective-4.3.2.tgz#77697e2e7947ac3fe7c8e26a6d6f115235afa91c" + dependencies: + acorn "^3.1.0" + defined "^1.0.0" + +diff@1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" + +diffie-hellman@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" + dependencies: + bn.js "^4.1.0" + miller-rabin "^4.0.0" + randombytes "^2.0.0" + +doctrine@^1.2.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +domain-browser@~1.1.0: + version "1.1.7" + resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" + +duplexer2@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" + dependencies: + readable-stream "~1.1.9" + +duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + dependencies: + readable-stream "^2.0.2" + +ecc-jsbn@~0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" + dependencies: + jsbn "~0.1.0" + +elliptic@^6.0.0: + version "6.3.2" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.3.2.tgz#e4c81e0829cf0a65ab70e998b8232723b5c1bc48" + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + inherits "^2.0.1" + +end-of-stream@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-0.1.5.tgz#8e177206c3c80837d85632e8b9359dfe8b2f6eaf" + dependencies: + once "~1.3.0" + +error-ex@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.0.tgz#e67b43f3e82c96ea3a584ffee0b9fc3325d802d9" + dependencies: + is-arrayish "^0.2.1" + +es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0.10.7: + version "0.10.12" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047" + dependencies: + es6-iterator "2" + es6-symbol "~3.1" + +es6-iterator@2: + version "2.0.0" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" + dependencies: + d "^0.1.1" + es5-ext "^0.10.7" + es6-symbol "3" + +es6-map@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.4.tgz#a34b147be224773a4d7da8072794cefa3632b897" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-set "~0.1.3" + es6-symbol "~3.1.0" + event-emitter "~0.3.4" + +es6-set@~0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.4.tgz#9516b6761c2964b92ff479456233a247dc707ce8" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + es6-iterator "2" + es6-symbol "3" + event-emitter "~0.3.4" + +es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" + dependencies: + d "~0.1.1" + es5-ext "~0.10.11" + +es6-weak-map@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.1.tgz#0d2bbd8827eb5fb4ba8f97fbfea50d43db21ea81" + dependencies: + d "^0.1.1" + es5-ext "^0.10.8" + es6-iterator "2" + es6-symbol "3" + +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-config-babel@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" + +eslint-plugin-flowtype@^2.20.0: + version "2.30.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.30.0.tgz#3054a265f9c8afe3046c3d41b72d32a736f9b4ae" + dependencies: + lodash "^4.15.0" + +eslint@^3.9.0: + version "3.13.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.13.1.tgz#564d2646b5efded85df96985332edd91a23bff25" + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.4.6" + debug "^2.1.1" + doctrine "^1.2.2" + escope "^3.6.0" + espree "^3.3.1" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.14.0" + ignore "^3.2.0" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~2.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.3.1: + version "3.3.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.3.2.tgz#dbf3fadeb4ecb4d4778303e50103b3d36c88b89c" + dependencies: + acorn "^4.0.1" + acorn-jsx "^3.0.0" + +esprima@^2.6.0: + version "2.7.3" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" + +esrecurse@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + dependencies: + estraverse "~4.1.0" + object-assign "^4.0.1" + +estraverse@^4.1.1, estraverse@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" + +estraverse@~4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" + +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + +event-emitter@~0.3.4: + version "0.3.4" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.4.tgz#8d63ddfb4cfe1fae3b32ca265c4c720222080bb5" + dependencies: + d "~0.1.1" + es5-ext "~0.10.7" + +events@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" + +evp_bytestokey@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz#497b66ad9fef65cd7c08a6180824ba1476b66e53" + dependencies: + create-hash "^1.1.1" + +execSync@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/execSync/-/execSync-1.0.2.tgz#1f42eda582225180053224ecdd3fd1960fdb3139" + dependencies: + temp "~0.5.1" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +expand-tilde@^1.2.1, expand-tilde@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-1.2.2.tgz#0b81eba897e5a3d31d1c3d102f8f01441e559449" + dependencies: + os-homedir "^1.0.1" + +extend@^3.0.0, extend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" + +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + +extsprintf@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550" + +falafel@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/falafel/-/falafel-1.2.0.tgz#c18d24ef5091174a497f318cd24b026a25cddab4" + dependencies: + acorn "^1.0.3" + foreach "^2.0.5" + isarray "0.0.1" + object-keys "^1.0.6" + +fancy-log@^1.1.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.0.tgz#45be17d02bb9917d60ccffd4995c999e6c8c9948" + dependencies: + chalk "^1.1.1" + time-stamp "^1.0.0" + +fast-levenshtein@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +filename-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.0.tgz#996e3e80479b98b9897f15a8a58b3d084e926775" + +fill-range@^2.1.0: + version "2.2.3" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^1.1.3" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + +find-cache-dir@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-0.1.1.tgz#c8defae57c8a52a8a784f9e31c57c742e993a0b9" + dependencies: + commondir "^1.0.1" + mkdirp "^0.5.1" + pkg-dir "^1.0.0" + +find-index@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" + +find-up@^1.0.0, find-up@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +findup-sync@^0.4.2: + version "0.4.3" + resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.4.3.tgz#40043929e7bc60adf0b7f4827c4c6e75a0deca12" + dependencies: + detect-file "^0.1.0" + is-glob "^2.0.1" + micromatch "^2.3.7" + resolve-dir "^0.1.0" + +fined@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fined/-/fined-1.0.2.tgz#5b28424b760d7598960b7ef8480dff8ad3660e97" + dependencies: + expand-tilde "^1.2.1" + lodash.assignwith "^4.0.7" + lodash.isempty "^4.2.1" + lodash.isplainobject "^4.0.4" + lodash.isstring "^4.0.1" + lodash.pick "^4.2.1" + parse-filepath "^1.0.1" + +first-chunk-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz#59bfb50cd905f60d7c394cd3d9acaab4e6ad934e" + +first-chunk-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70" + dependencies: + readable-stream "^2.0.2" + +flagged-respawn@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-0.3.2.tgz#ff191eddcd7088a675b2610fffc976be9b8074b5" + +flat-cache@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + dependencies: + circular-json "^0.3.1" + del "^2.0.2" + graceful-fs "^4.1.2" + write "^0.2.1" + +flow-bin@^0.34.0: + version "0.34.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.34.0.tgz#093ed36981e8fafc39d16f0b0878d0968aa80fad" + +for-in@^0.1.5: + version "0.1.6" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8" + +for-own@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.4.tgz#0149b41a39088c7515f51ebe1c1386d45f935072" + dependencies: + for-in "^0.1.5" + +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + +foreground-child@^1.3.3, foreground-child@^1.5.3: + version "1.5.6" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-1.5.6.tgz#4fd71ad2dfde96789b980a5c0a295937cb2f5ce9" + dependencies: + cross-spawn "^4" + signal-exit "^3.0.0" + +forever-agent@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" + +form-data@~2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.1.2.tgz#89c3534008b97eada4cbb157d58f6f5df025eae4" + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.5" + mime-types "^2.1.12" + +fs-exists-sync@^0.1.0: + version "0.1.0" + resolved "http://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + +fsevents@^1.0.0: + version "1.0.17" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.17.tgz#8537f3f12272678765b4fd6528c0f1f66f8f4558" + dependencies: + nan "^2.3.0" + node-pre-gyp "^0.6.29" + +fstream-ignore@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105" + dependencies: + fstream "^1.0.0" + inherits "2" + minimatch "^3.0.0" + +fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.10.tgz#604e8a92fe26ffd9f6fae30399d4984e1ab22822" + dependencies: + graceful-fs "^4.1.2" + inherits "~2.0.0" + mkdirp ">=0.5 0" + rimraf "2" + +function-bind@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" + +gauge@~2.7.1: + version "2.7.2" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.2.tgz#15cecc31b02d05345a5d6b0e171cdb3ad2307774" + dependencies: + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + supports-color "^0.2.0" + wide-align "^1.1.0" + +gaze@^0.5.1: + version "0.5.2" + resolved "https://registry.yarnpkg.com/gaze/-/gaze-0.5.2.tgz#40b709537d24d1d45767db5a908689dfe69ac44f" + dependencies: + globule "~0.1.0" + +generate-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + dependencies: + is-property "^1.0.0" + +get-caller-file@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" + +get-stdin@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" + +getpass@^0.1.1: + version "0.1.6" + resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.6.tgz#283ffd9fc1256840875311c1b60e8c40187110e6" + dependencies: + assert-plus "^1.0.0" + +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + +glob-parent@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + +glob-stream@^3.1.5: + version "3.1.18" + resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-3.1.18.tgz#9170a5f12b790306fdfe598f313f8f7954fd143b" + dependencies: + glob "^4.3.1" + glob2base "^0.0.12" + minimatch "^2.0.1" + ordered-read-streams "^0.1.0" + through2 "^0.6.1" + unique-stream "^1.0.0" + +glob-watcher@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/glob-watcher/-/glob-watcher-0.0.6.tgz#b95b4a8df74b39c83298b0c05c978b4d9a3b710b" + dependencies: + gaze "^0.5.1" + +glob2base@^0.0.12: + version "0.0.12" + resolved "http://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" + dependencies: + find-index "^0.1.1" + +glob@7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@^4.3.1: + version "4.5.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "^2.0.1" + once "^1.3.0" + +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.0.6, glob@^7.1.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob@~3.1.21: + version "3.1.21" + resolved "https://registry.yarnpkg.com/glob/-/glob-3.1.21.tgz#d29e0a055dea5138f4d07ed40e8982e83c2066cd" + dependencies: + graceful-fs "~1.2.0" + inherits "1" + minimatch "~0.2.11" + +global-modules@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-0.2.3.tgz#ea5a3bed42c6d6ce995a4f8a1269b5dae223828d" + dependencies: + global-prefix "^0.1.4" + is-windows "^0.2.0" + +global-prefix@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/global-prefix/-/global-prefix-0.1.5.tgz#8d3bc6b8da3ca8112a160d8d496ff0462bfef78f" + dependencies: + homedir-polyfill "^1.0.0" + ini "^1.3.4" + is-windows "^0.2.0" + which "^1.2.12" + +globals@^9.0.0, globals@^9.14.0: + version "9.14.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.14.0.tgz#8859936af0038741263053b39d0e76ca241e4034" + +globby@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" + dependencies: + array-union "^1.0.1" + arrify "^1.0.0" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +globule@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/globule/-/globule-0.1.0.tgz#d9c8edde1da79d125a151b79533b978676346ae5" + dependencies: + glob "~3.1.21" + lodash "~1.0.1" + minimatch "~0.2.11" + +glogg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.0.tgz#7fe0f199f57ac906cf512feead8f90ee4a284fc5" + dependencies: + sparkles "^1.0.0" + +graceful-fs@^3.0.0: + version "3.0.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-3.0.11.tgz#7613c778a1afea62f25c630a086d7f3acbbdd818" + dependencies: + natives "^1.1.0" + +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4: + version "4.1.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" + +graceful-fs@~1, graceful-fs@~1.2.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-1.2.3.tgz#15a4806a57547cb2d2dbf27f42e89a8c3451b364" + +"graceful-readlink@>= 1.0.0": + version "1.0.1" + resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" + +growl@1.9.2: + version "1.9.2" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" + +gulp-babel@^6.0.0: + version "6.1.2" + resolved "https://registry.yarnpkg.com/gulp-babel/-/gulp-babel-6.1.2.tgz#7c0176e4ba3f244c60588a0c4b320a45d1adefce" + dependencies: + babel-core "^6.0.2" + gulp-util "^3.0.0" + object-assign "^4.0.1" + replace-ext "0.0.1" + through2 "^2.0.0" + vinyl-sourcemaps-apply "^0.2.0" + +gulp-newer@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/gulp-newer/-/gulp-newer-1.3.0.tgz#d50ecacbb822eda492b57324a6c85a07fd9a55c1" + dependencies: + glob "^7.0.3" + gulp-util "^3.0.7" + kew "^0.7.0" + +gulp-plumber@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/gulp-plumber/-/gulp-plumber-1.1.0.tgz#f12176c2d0422f60306c242fff6a01a394faba09" + dependencies: + gulp-util "^3" + through2 "^2" + +gulp-util@^3, gulp-util@^3.0.0, gulp-util@^3.0.7: + version "3.0.8" + resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f" + dependencies: + array-differ "^1.0.0" + array-uniq "^1.0.2" + beeper "^1.0.0" + chalk "^1.0.0" + dateformat "^2.0.0" + fancy-log "^1.1.0" + gulplog "^1.0.0" + has-gulplog "^0.1.0" + lodash._reescape "^3.0.0" + lodash._reevaluate "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.template "^3.0.0" + minimist "^1.1.0" + multipipe "^0.1.2" + object-assign "^3.0.0" + replace-ext "0.0.1" + through2 "^2.0.0" + vinyl "^0.5.0" + +gulp-watch@^4.3.5: + version "4.3.11" + resolved "https://registry.yarnpkg.com/gulp-watch/-/gulp-watch-4.3.11.tgz#162fc563de9fc770e91f9a7ce3955513a9a118c0" + dependencies: + anymatch "^1.3.0" + chokidar "^1.6.1" + glob-parent "^3.0.1" + gulp-util "^3.0.7" + object-assign "^4.1.0" + path-is-absolute "^1.0.1" + readable-stream "^2.2.2" + slash "^1.0.0" + vinyl "^1.2.0" + vinyl-file "^2.0.0" + +gulp@^3.9.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/gulp/-/gulp-3.9.1.tgz#571ce45928dd40af6514fc4011866016c13845b4" + dependencies: + archy "^1.0.0" + chalk "^1.0.0" + deprecated "^0.0.1" + gulp-util "^3.0.0" + interpret "^1.0.0" + liftoff "^2.1.0" + minimist "^1.1.0" + orchestrator "^0.3.0" + pretty-hrtime "^1.0.0" + semver "^4.1.0" + tildify "^1.0.0" + v8flags "^2.0.2" + vinyl-fs "^0.3.0" + +gulplog@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gulplog/-/gulplog-1.0.0.tgz#e28c4d45d05ecbbed818363ce8f9c5926229ffe5" + dependencies: + glogg "^1.0.0" + +handlebars@^4.0.3: + version "4.0.6" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.6.tgz#2ce4484850537f9c97a8026d5399b935c4ed4ed7" + dependencies: + async "^1.4.0" + optimist "^0.6.1" + source-map "^0.4.4" + optionalDependencies: + uglify-js "^2.6" + +har-validator@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" + dependencies: + chalk "^1.1.1" + commander "^2.9.0" + is-my-json-valid "^2.12.4" + pinkie-promise "^2.0.0" + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + +has-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + +has-gulplog@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce" + dependencies: + sparkles "^1.0.0" + +has-unicode@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" + +has@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +hash.js@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.0.3.tgz#1332ff00156c0a0ffdd8236013d07b77a0451573" + dependencies: + inherits "^2.0.1" + +hawk@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" + dependencies: + boom "2.x.x" + cryptiles "2.x.x" + hoek "2.x.x" + sntp "1.x.x" + +hoek@2.x.x: + version "2.16.3" + resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" + +home-or-tmp@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" + dependencies: + os-homedir "^1.0.0" + os-tmpdir "^1.0.1" + +homedir-polyfill@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + dependencies: + parse-passwd "^1.0.0" + +hosted-git-info@^2.1.4: + version "2.1.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.1.5.tgz#0ba81d90da2e25ab34a332e6ec77936e1598118b" + +htmlescape@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" + +http-signature@~1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" + dependencies: + assert-plus "^0.2.0" + jsprim "^1.2.2" + sshpk "^1.7.0" + +https-browserify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" + +ieee754@^1.1.4: + version "1.1.8" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" + +ignore@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.0.tgz#8d88f03c3002a0ac52114db25d2c673b0bf1e435" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +indexof@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b" + +inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + +inherits@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" + +ini@^1.3.4, ini@~1.3.0: + version "1.3.4" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + +inline-source-map@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.5.0.tgz#4a4c5dd8e4fb5e9b3cda60c822dfadcaee66e0af" + dependencies: + source-map "~0.4.0" + +inline-source-map@~0.6.0: + version "0.6.2" + resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" + dependencies: + source-map "~0.5.3" + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +insert-module-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" + dependencies: + JSONStream "^1.0.3" + combine-source-map "~0.7.1" + concat-stream "~1.5.1" + is-buffer "^1.1.0" + lexical-scope "^1.2.0" + process "~0.11.0" + through2 "^2.0.0" + xtend "^4.0.0" + +interpret@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" + +invariant@^2.2.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + dependencies: + loose-envify "^1.0.0" + +invert-kv@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + +is-absolute@^0.2.3: + version "0.2.6" + resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-0.2.6.tgz#20de69f3db942ef2d87b9c2da36f172235b1b5eb" + dependencies: + is-relative "^0.2.1" + is-windows "^0.2.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-binary-path@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" + dependencies: + binary-extensions "^1.0.0" + +is-buffer@^1.0.2, is-buffer@^1.1.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-dotfile@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.2.tgz#2c132383f39199f8edc268ca01b9b007d205cc4d" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + +is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + +is-extglob@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + dependencies: + is-extglob "^2.1.0" + +is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b" + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-number@^2.0.2, is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + +is-path-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" + +is-path-in-cwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz#6477582b8214d602346094567003be8a9eac04dc" + dependencies: + is-path-inside "^1.0.0" + +is-path-inside@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + dependencies: + path-is-inside "^1.0.1" + +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "http://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + +is-property@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + +is-relative@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-0.2.1.tgz#d27f4c7d516d175fb610db84bbeef23c3bc97aa5" + dependencies: + is-unc-path "^0.1.1" + +is-resolvable@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" + dependencies: + tryit "^1.0.1" + +is-typedarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + +is-unc-path@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-0.1.2.tgz#6ab053a72573c10250ff416a3814c35178af39b9" + dependencies: + unc-path-regex "^0.1.0" + +is-utf8@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" + +is-windows@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" + +isarray@0.0.1, isarray@~0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + +isexe@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.1.2.tgz#36f3e22e60750920f5e7241a476a8c6a42275ad0" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isstream@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" + +istanbul-lib-coverage@^1.0.0, istanbul-lib-coverage@^1.0.0-alpha, istanbul-lib-coverage@^1.0.0-alpha.0, istanbul-lib-coverage@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.1.tgz#f263efb519c051c5f1f3343034fc40e7b43ff212" + +istanbul-lib-hook@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-1.0.0.tgz#fc5367ee27f59268e8f060b0c7aaf051d9c425c5" + dependencies: + append-transform "^0.4.0" + +istanbul-lib-instrument@^1.1.4, istanbul-lib-instrument@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.4.2.tgz#0e2fdfac93c1dabf2e31578637dc78a19089f43e" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.13.0" + istanbul-lib-coverage "^1.0.0" + semver "^5.3.0" + +istanbul-lib-report@^1.0.0-alpha.3: + version "1.0.0-alpha.3" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-1.0.0-alpha.3.tgz#32d5f6ec7f33ca3a602209e278b2e6ff143498af" + dependencies: + async "^1.4.2" + istanbul-lib-coverage "^1.0.0-alpha" + mkdirp "^0.5.1" + path-parse "^1.0.5" + rimraf "^2.4.3" + supports-color "^3.1.2" + +istanbul-lib-source-maps@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.1.0.tgz#9d429218f35b823560ea300a96ff0c3bbdab785f" + dependencies: + istanbul-lib-coverage "^1.0.0-alpha.0" + mkdirp "^0.5.1" + rimraf "^2.4.4" + source-map "^0.5.3" + +istanbul-reports@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-1.0.0.tgz#24b4eb2b1d29d50f103b369bd422f6e640aa0777" + dependencies: + handlebars "^4.0.3" + +jodid25519@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jodid25519/-/jodid25519-1.0.2.tgz#06d4912255093419477d425633606e0e90782967" + dependencies: + jsbn "~0.1.0" + +js-tokens@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.0.tgz#a2f2a969caae142fb3cd56228358c89366957bd1" + +js-yaml@^3.5.1: + version "3.7.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + +jsbn@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" + +jsesc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" + +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + +json-schema@0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + dependencies: + jsonify "~0.0.0" + +json-stable-stringify@~0.0.0: + version "0.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" + dependencies: + jsonify "~0.0.0" + +json-stringify-safe@~5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + +json3@3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" + +json5@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + +jsonparse@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.0.tgz#85fc245b1d9259acc6941960b905adf64e7de0e8" + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + +jsprim@^1.2.2: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.3.1.tgz#2a7256f70412a29ee3670aaca625994c4dcff252" + dependencies: + extsprintf "1.0.2" + json-schema "0.2.3" + verror "1.3.6" + +kew@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b" + +kind-of@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47" + dependencies: + is-buffer "^1.0.2" + +labeled-stream-splicer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz#a52e1d138024c00b86b1c0c91f677918b8ae0a59" + dependencies: + inherits "^2.0.1" + isarray "~0.0.1" + stream-splicer "^2.0.0" + +lazy-cache@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + +lcid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + dependencies: + invert-kv "^1.0.0" + +lerna-changelog@^0.2.0: + version "0.2.3" + resolved "https://registry.yarnpkg.com/lerna-changelog/-/lerna-changelog-0.2.3.tgz#f27b33f924f629338e892db895045bccb3873bce" + dependencies: + chalk "^1.1.3" + mkdirp "^0.5.1" + +lerna@2.0.0-beta.23: + version "2.0.0-beta.23" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-beta.23.tgz#af418121d5ddfae250a49d77fadade6bc790909e" + dependencies: + async "^1.5.0" + chalk "^1.1.1" + inquirer "^0.12.0" + lodash.find "^4.3.0" + lodash.unionwith "^4.2.0" + meow "^3.7.0" + minimatch "^3.0.0" + mkdirp "^0.5.1" + object-assign "^4.0.1" + object-assign-sorted "^1.0.0" + pad "^1.0.0" + path-exists "^2.1.0" + progress "^1.1.8" + rimraf "^2.4.4" + semver "^5.1.0" + signal-exit "^2.1.2" + sync-exec "^0.6.2" + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lexical-scope@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/lexical-scope/-/lexical-scope-1.2.0.tgz#fcea5edc704a4b3a8796cdca419c3a0afaf22df4" + dependencies: + astw "^2.0.0" + +liftoff@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/liftoff/-/liftoff-2.3.0.tgz#a98f2ff67183d8ba7cfaca10548bd7ff0550b385" + dependencies: + extend "^3.0.0" + findup-sync "^0.4.2" + fined "^1.0.1" + flagged-respawn "^0.3.2" + lodash.isplainobject "^4.0.4" + lodash.isstring "^4.0.1" + lodash.mapvalues "^4.4.0" + rechoir "^0.6.2" + resolve "^1.1.7" + +load-json-file@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + +lodash._baseassign@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" + dependencies: + lodash._basecopy "^3.0.0" + lodash.keys "^3.0.0" + +lodash._basecopy@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" + +lodash._basecreate@^3.0.0: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" + +lodash._basetostring@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz#d1861d877f824a52f669832dcaf3ee15566a07d5" + +lodash._basevalues@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz#5b775762802bde3d3297503e26300820fdf661b7" + +lodash._getnative@^3.0.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" + +lodash._isiterateecall@^3.0.0: + version "3.0.9" + resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" + +lodash._reescape@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reescape/-/lodash._reescape-3.0.0.tgz#2b1d6f5dfe07c8a355753e5f27fac7f1cde1616a" + +lodash._reevaluate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz#58bc74c40664953ae0b124d806996daca431e2ed" + +lodash._reinterpolate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" + +lodash._root@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" + +lodash.assignwith@^4.0.7: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz#127a97f02adc41751a954d24b0de17e100e038eb" + +lodash.create@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" + dependencies: + lodash._baseassign "^3.0.0" + lodash._basecreate "^3.0.0" + lodash._isiterateecall "^3.0.0" + +lodash.escape@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698" + dependencies: + lodash._root "^3.0.0" + +lodash.find@^4.3.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" + +lodash.isarguments@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + +lodash.isarray@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" + +lodash.isempty@^4.2.1: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e" + +lodash.isplainobject@^4.0.4: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + +lodash.keys@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" + dependencies: + lodash._getnative "^3.0.0" + lodash.isarguments "^3.0.0" + lodash.isarray "^3.0.0" + +lodash.mapvalues@^4.4.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + +lodash.memoize@~3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" + +lodash.pick@^4.2.1: + version "4.4.0" + resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" + +lodash.pickby@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" + +lodash.restparam@^3.0.0: + version "3.6.1" + resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" + +lodash.template@^3.0.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f" + dependencies: + lodash._basecopy "^3.0.0" + lodash._basetostring "^3.0.0" + lodash._basevalues "^3.0.0" + lodash._isiterateecall "^3.0.0" + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + lodash.keys "^3.0.0" + lodash.restparam "^3.0.0" + lodash.templatesettings "^3.0.0" + +lodash.templatesettings@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5" + dependencies: + lodash._reinterpolate "^3.0.0" + lodash.escape "^3.0.0" + +lodash.unionwith@^4.2.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.unionwith/-/lodash.unionwith-4.6.0.tgz#74d140b5ca8146e6c643c3724f5152538d9ac1f0" + +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" + +lodash@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" + +longest@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" + +loose-envify@^1.0.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" + dependencies: + js-tokens "^3.0.0" + +loud-rejection@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f" + dependencies: + currently-unhandled "^0.4.1" + signal-exit "^3.0.0" + +lru-cache@2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" + +lru-cache@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" + dependencies: + pseudomap "^1.0.1" + yallist "^2.0.0" + +map-cache@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + +map-obj@^1.0.0, map-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" + +md5-hex@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/md5-hex/-/md5-hex-1.3.0.tgz#d2c4afe983c4370662179b8cad145219135046c4" + dependencies: + md5-o-matic "^0.1.1" + +md5-o-matic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/md5-o-matic/-/md5-o-matic-0.1.1.tgz#822bccd65e117c514fab176b25945d54100a03c3" + +meow@^3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" + dependencies: + camelcase-keys "^2.0.0" + decamelize "^1.1.2" + loud-rejection "^1.0.0" + map-obj "^1.0.1" + minimist "^1.1.3" + normalize-package-data "^2.3.4" + object-assign "^4.0.1" + read-pkg-up "^1.0.1" + redent "^1.0.0" + trim-newlines "^1.0.0" + +merge-source-map@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.3.tgz#da1415f2722a5119db07b14c4f973410863a2abf" + dependencies: + source-map "^0.5.3" + +micromatch@^2.1.5, micromatch@^2.3.11, micromatch@^2.3.7: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" + +miller-rabin@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.0.tgz#4a62fb1d42933c05583982f4c716f6fb9e6c6d3d" + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + +mime-db@~1.26.0: + version "1.26.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.26.0.tgz#eaffcd0e4fc6935cf8134da246e2e6c35305adff" + +mime-types@^2.1.12, mime-types@~2.1.7: + version "2.1.14" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee" + dependencies: + mime-db "~1.26.0" + +minimalistic-assert@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" + +minimatch@^2.0.1: + version "2.0.10" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-2.0.10.tgz#8d087c39c6b38c001b97fca7ce6d0e1e80afbac7" + dependencies: + brace-expansion "^1.0.0" + +minimatch@^3.0.0, minimatch@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" + dependencies: + brace-expansion "^1.0.0" + +minimatch@~0.2.11: + version "0.2.14" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.2.14.tgz#c74e780574f63c6f9a090e90efbe6ef53a6a756a" + dependencies: + lru-cache "2" + sigmund "~1.0.0" + +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + dependencies: + minimist "0.0.8" + +mocha@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" + dependencies: + browser-stdout "1.3.0" + commander "2.9.0" + debug "2.2.0" + diff "1.4.0" + escape-string-regexp "1.0.5" + glob "7.0.5" + growl "1.9.2" + json3 "3.3.2" + lodash.create "3.1.1" + mkdirp "0.5.1" + supports-color "3.1.2" + +module-deps@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.0.8.tgz#55fd70623399706c3288bef7a609ff1e8c0ed2bb" + dependencies: + JSONStream "^1.0.3" + browser-resolve "^1.7.0" + cached-path-relative "^1.0.0" + concat-stream "~1.5.0" + defined "^1.0.0" + detective "^4.0.0" + duplexer2 "^0.1.2" + inherits "^2.0.1" + parents "^1.0.0" + readable-stream "^2.0.2" + resolve "^1.1.3" + stream-combiner2 "^1.1.1" + subarg "^1.0.0" + through2 "^2.0.0" + xtend "^4.0.0" + +ms@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + +ms@0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" + +multipipe@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" + dependencies: + duplexer2 "0.0.2" + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + +nan@^2.3.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8" + +natives@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.0.tgz#e9ff841418a6b2ec7a495e939984f78f163e6e31" + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + +node-pre-gyp@^0.6.29: + version "0.6.32" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz#fc452b376e7319b3d255f5f34853ef6fd8fe1fd5" + dependencies: + mkdirp "~0.5.1" + nopt "~3.0.6" + npmlog "^4.0.1" + rc "~1.1.6" + request "^2.79.0" + rimraf "~2.5.4" + semver "~5.3.0" + tar "~2.2.1" + tar-pack "~3.3.0" + +nopt@~3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + dependencies: + abbrev "1" + +normalize-package-data@^2.3.2, normalize-package-data@^2.3.4: + version "2.3.5" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.3.5.tgz#8d924f142960e1777e7ffe170543631cc7cb02df" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-path@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a" + +npmlog@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.1" + set-blocking "~2.0.0" + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + +nyc@^10.0.0: + version "10.1.2" + resolved "https://registry.yarnpkg.com/nyc/-/nyc-10.1.2.tgz#ea7acaa20a235210101604f4e7d56d28453b0274" + dependencies: + archy "^1.0.0" + arrify "^1.0.1" + caching-transform "^1.0.0" + convert-source-map "^1.3.0" + debug-log "^1.0.1" + default-require-extensions "^1.0.0" + find-cache-dir "^0.1.1" + find-up "^1.1.2" + foreground-child "^1.5.3" + glob "^7.0.6" + istanbul-lib-coverage "^1.0.1" + istanbul-lib-hook "^1.0.0" + istanbul-lib-instrument "^1.4.2" + istanbul-lib-report "^1.0.0-alpha.3" + istanbul-lib-source-maps "^1.1.0" + istanbul-reports "^1.0.0" + md5-hex "^1.2.0" + merge-source-map "^1.0.2" + micromatch "^2.3.11" + mkdirp "^0.5.0" + resolve-from "^2.0.0" + rimraf "^2.5.4" + signal-exit "^3.0.1" + spawn-wrap "1.2.4" + test-exclude "^3.3.0" + yargs "^6.6.0" + yargs-parser "^4.0.2" + +oauth-sign@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" + +object-assign-sorted@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/object-assign-sorted/-/object-assign-sorted-1.0.0.tgz#e739f698164014ec1f050f38decabad1e9b228bf" + dependencies: + object-assign "^4.0.1" + sorted-object "^2.0.0" + +object-assign@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + +object-keys@^1.0.6: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + dependencies: + wrappy "1" + +once@~1.3.0, once@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20" + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + +optimist@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" + dependencies: + minimist "~0.0.1" + wordwrap "~0.0.2" + +optionator@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.4" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + wordwrap "~1.0.0" + +orchestrator@^0.3.0: + version "0.3.8" + resolved "https://registry.yarnpkg.com/orchestrator/-/orchestrator-0.3.8.tgz#14e7e9e2764f7315fbac184e506c7aa6df94ad7e" + dependencies: + end-of-stream "~0.1.5" + sequencify "~0.0.7" + stream-consume "~0.1.0" + +ordered-read-streams@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz#fd565a9af8eb4473ba69b6ed8a34352cb552f126" + +os-browserify@~0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.1.2.tgz#49ca0293e0b19590a5f5de10c7f265a617d8fe54" + +os-homedir@^1.0.0, os-homedir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + +os-locale@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9" + dependencies: + lcid "^1.0.0" + +os-tmpdir@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +output-file-sync@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76" + dependencies: + graceful-fs "^4.1.4" + mkdirp "^0.5.1" + object-assign "^4.1.0" + +pad@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pad/-/pad-1.0.2.tgz#f6e36ff3ceb468e4ae2ed33ad5ecf25ace920960" + +pako@~0.2.0: + version "0.2.9" + resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" + +parents@^1.0.0, parents@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" + dependencies: + path-platform "~0.11.15" + +parse-asn1@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.0.0.tgz#35060f6d5015d37628c770f4e091a0b5a278bc23" + dependencies: + asn1.js "^4.0.0" + browserify-aes "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.0" + pbkdf2 "^3.0.3" + +parse-filepath@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.1.tgz#159d6155d43904d16c10ef698911da1e91969b73" + dependencies: + is-absolute "^0.2.3" + map-cache "^0.2.0" + path-root "^0.1.1" + +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse-passwd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + +path-browserify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.0.tgz#a0b870729aae214005b7d5032ec2cbbb0fb4451a" + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + +path-exists@^2.0.0, path-exists@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + +path-parse@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" + +path-platform@~0.11.15: + version "0.11.15" + resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" + +path-root-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + +path-root@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + dependencies: + path-root-regex "^0.1.0" + +path-type@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" + dependencies: + graceful-fs "^4.1.2" + pify "^2.0.0" + pinkie-promise "^2.0.0" + +pbkdf2@^3.0.3: + version "3.0.9" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.9.tgz#f2c4b25a600058b3c3773c086c37dbbee1ffe693" + dependencies: + create-hmac "^1.1.2" + +pify@^2.0.0, pify@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + +pinkie-promise@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" + dependencies: + pinkie "^2.0.0" + +pinkie@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" + +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + +pretty-hrtime@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz#b7e3ea42435a4c9b2759d99e0f201eb195802ee1" + +private@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.6.tgz#55c6a976d0f9bafb9924851350fe47b9b5fbb7c1" + +process-nextick-args@~1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" + +process@~0.11.0: + version "0.11.9" + resolved "https://registry.yarnpkg.com/process/-/process-0.11.9.tgz#7bd5ad21aa6253e7da8682264f1e11d11c0318c1" + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + +pseudomap@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +public-encrypt@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.0.tgz#39f699f3a46560dd5ebacbca693caf7c65c18cc6" + dependencies: + bn.js "^4.1.0" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + parse-asn1 "^5.0.0" + randombytes "^2.0.1" + +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + +punycode@^1.3.2, punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + +qs@~6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" + +querystring-es3@~0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + +randomatic@^1.1.3: + version "1.1.6" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb" + dependencies: + is-number "^2.0.2" + kind-of "^3.0.2" + +randombytes@^2.0.0, randombytes@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.0.3.tgz#674c99760901c3c4112771a31e521dc349cc09ec" + +rc@~1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9" + dependencies: + deep-extend "~0.4.0" + ini "~1.3.0" + minimist "^1.2.0" + strip-json-comments "~1.0.4" + +read-only-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" + dependencies: + readable-stream "^2.0.2" + +read-pkg-up@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-1.0.1.tgz#9d63c13276c065918d57f002a57f40a1b643fb02" + dependencies: + find-up "^1.0.0" + read-pkg "^1.0.0" + +read-pkg@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28" + dependencies: + load-json-file "^1.0.0" + normalize-package-data "^2.3.2" + path-type "^1.0.0" + +"readable-stream@>=1.0.33-1 <1.1.0-0": + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +"readable-stream@>=1.1.13-1 <1.2.0-0", readable-stream@~1.1.9: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readable-stream@~2.0.0: + version "2.0.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readable-stream@~2.1.4: + version "2.1.5" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + +readdirp@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" + dependencies: + graceful-fs "^4.1.2" + minimatch "^3.0.2" + readable-stream "^2.0.2" + set-immediate-shim "^1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + dependencies: + resolve "^1.1.6" + +redent@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-1.0.0.tgz#cf916ab1fd5f1f16dfb20822dd6ec7f730c2afde" + dependencies: + indent-string "^2.1.0" + strip-indent "^1.0.1" + +regenerate@^1.2.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" + +regenerator-runtime@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.1.tgz#257f41961ce44558b18f7814af48c17559f9faeb" + +regenerator-transform@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.9.8.tgz#0f88bb2bc03932ddb7b6b7312e68078f01026d6c" + dependencies: + babel-runtime "^6.18.0" + babel-types "^6.19.0" + private "^0.1.6" + +regex-cache@^0.4.2: + version "0.4.3" + resolved "http://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + dependencies: + is-equal-shallow "^0.1.3" + is-primitive "^2.0.0" + +regexpu-core@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" + dependencies: + regenerate "^1.2.1" + regjsgen "^0.2.0" + regjsparser "^0.1.4" + +regjsgen@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.2.0.tgz#6c016adeac554f75823fe37ac05b92d5a4edb1f7" + +regjsparser@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.1.5.tgz#7ee8f84dc6fa792d3fd0ae228d24bd949ead205c" + dependencies: + jsesc "~0.5.0" + +repeat-element@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" + +repeat-string@^1.5.2: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.0.0" + +replace-ext@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" + +request@>=2.42.0, request@^2.79.0: + version "2.79.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" + dependencies: + aws-sign2 "~0.6.0" + aws4 "^1.2.1" + caseless "~0.11.0" + combined-stream "~1.0.5" + extend "~3.0.0" + forever-agent "~0.6.1" + form-data "~2.1.1" + har-validator "~2.0.6" + hawk "~3.1.3" + http-signature "~1.1.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + qs "~6.3.0" + stringstream "~0.0.4" + tough-cookie "~2.3.0" + tunnel-agent "~0.4.1" + uuid "^3.0.0" + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + +require-main-filename@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-dir@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-0.1.1.tgz#b219259a5602fac5c5c496ad894a6e8cc430261e" + dependencies: + expand-tilde "^1.2.2" + global-modules "^0.2.3" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + +resolve-from@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" + +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + +resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7: + version "1.2.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +right-align@^0.1.1: + version "0.1.3" + resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" + dependencies: + align-text "^0.1.1" + +rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4: + version "2.5.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" + dependencies: + glob "^7.0.5" + +rimraf@~2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.1.4.tgz#5a6eb62eeda068f51ede50f29b3e5cd22f3d9bb2" + optionalDependencies: + graceful-fs "~1" + +ripemd160@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + dependencies: + once "^1.3.0" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + +"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + +semver@^4.1.0: + version "4.3.6" + resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" + +sequencify@~0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c" + +set-blocking@^2.0.0, set-blocking@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + +set-immediate-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + +sha.js@^2.3.6, sha.js@~2.4.4: + version "2.4.8" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f" + dependencies: + inherits "^2.0.1" + +shasum@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" + dependencies: + json-stable-stringify "~0.0.0" + sha.js "~2.4.4" + +shell-quote@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" + dependencies: + array-filter "~0.0.0" + array-map "~0.0.0" + array-reduce "~0.0.0" + jsonify "~0.0.0" + +shelljs@^0.7.5: + version "0.7.6" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +sigmund@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" + +signal-exit@^2.0.0, signal-exit@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-2.1.2.tgz#375879b1f92ebc3b334480d038dc546a6d558564" + +signal-exit@^3.0.0, signal-exit@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + +slash@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + +slide@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" + +sntp@1.x.x: + version "1.0.9" + resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" + dependencies: + hoek "2.x.x" + +sorted-object@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/sorted-object/-/sorted-object-2.0.1.tgz#7d631f4bd3a798a24af1dffcfbfe83337a5df5fc" + +source-map-support@^0.4.2: + version "0.4.10" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.10.tgz#d7b19038040a14c0837a18e630a196453952b378" + dependencies: + source-map "^0.5.3" + +source-map@^0.4.4, source-map@~0.4.0, source-map@~0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" + dependencies: + amdefine ">=0.0.4" + +source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@~0.5.1, source-map@~0.5.3: + version "0.5.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" + +sparkles@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/sparkles/-/sparkles-1.0.0.tgz#1acbbfb592436d10bbe8f785b7cc6f82815012c3" + +spawn-wrap@1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.2.4.tgz#920eb211a769c093eebfbd5b0e7a5d2e68ab2e40" + dependencies: + foreground-child "^1.3.3" + mkdirp "^0.5.0" + os-homedir "^1.0.1" + rimraf "^2.3.3" + signal-exit "^2.0.0" + which "^1.2.4" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + +sshpk@^1.7.0: + version "1.10.2" + resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.2.tgz#d5a804ce22695515638e798dbe23273de070a5fa" + dependencies: + asn1 "~0.2.3" + assert-plus "^1.0.0" + dashdash "^1.12.0" + getpass "^0.1.1" + optionalDependencies: + bcrypt-pbkdf "^1.0.0" + ecc-jsbn "~0.1.1" + jodid25519 "^1.0.0" + jsbn "~0.1.0" + tweetnacl "~0.14.0" + +stream-browserify@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db" + dependencies: + inherits "~2.0.1" + readable-stream "^2.0.2" + +stream-combiner2@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" + dependencies: + duplexer2 "~0.1.0" + readable-stream "^2.0.2" + +stream-consume@~0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-consume/-/stream-consume-0.1.0.tgz#a41ead1a6d6081ceb79f65b061901b6d8f3d1d0f" + +stream-http@^2.0.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.6.3.tgz#4c3ddbf9635968ea2cfd4e48d43de5def2625ac3" + dependencies: + builtin-status-codes "^3.0.0" + inherits "^2.0.1" + readable-stream "^2.1.0" + to-arraybuffer "^1.0.0" + xtend "^4.0.0" + +stream-splicer@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.0.tgz#1b63be438a133e4b671cc1935197600175910d83" + dependencies: + inherits "^2.0.1" + readable-stream "^2.0.2" + +string-width@^1.0.1, string-width@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^3.0.0" + +string_decoder@~0.10.0, string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + +stringstream@~0.0.4: + version "0.0.5" + resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" + +strip-ansi@^3.0.0, strip-ansi@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + dependencies: + ansi-regex "^2.0.0" + +strip-bom-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-2.0.0.tgz#f87db5ef2613f6968aa545abfe1ec728b6a829ca" + dependencies: + first-chunk-stream "^2.0.0" + strip-bom "^2.0.0" + +strip-bom@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-1.0.0.tgz#85b8862f3844b5a6d5ec8467a93598173a36f794" + dependencies: + first-chunk-stream "^1.0.0" + is-utf8 "^0.2.0" + +strip-bom@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" + dependencies: + is-utf8 "^0.2.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + +strip-indent@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" + dependencies: + get-stdin "^4.0.1" + +strip-json-comments@~1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" + +strip-json-comments@~2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" + +subarg@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" + dependencies: + minimist "^1.1.0" + +supports-color@3.1.2, supports-color@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + +supports-color@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + +sync-exec@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/sync-exec/-/sync-exec-0.6.2.tgz#717d22cc53f0ce1def5594362f3a89a2ebb91105" + +syntax-error@^1.1.1: + version "1.1.6" + resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.1.6.tgz#b4549706d386cc1c1dc7c2423f18579b6cade710" + dependencies: + acorn "^2.7.0" + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +tar-pack@~3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae" + dependencies: + debug "~2.2.0" + fstream "~1.0.10" + fstream-ignore "~1.0.5" + once "~1.3.3" + readable-stream "~2.1.4" + rimraf "~2.5.1" + tar "~2.2.1" + uid-number "~0.0.6" + +tar@~2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1" + dependencies: + block-stream "*" + fstream "^1.0.2" + inherits "2" + +temp@~0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.5.1.tgz#77ab19c79aa7b593cbe4fac2441768cad987b8df" + dependencies: + rimraf "~2.1.4" + +test-exclude@^2.1.1: + version "2.1.3" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-2.1.3.tgz#a8d8968e1da83266f9864f2852c55e220f06434a" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +test-exclude@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-3.3.0.tgz#7a17ca1239988c98367b0621456dbb7d4bc38977" + dependencies: + arrify "^1.0.1" + micromatch "^2.3.11" + object-assign "^4.1.0" + read-pkg-up "^1.0.1" + require-main-filename "^1.0.1" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + +through2@^0.6.1: + version "0.6.5" + resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" + dependencies: + readable-stream ">=1.0.33-1 <1.1.0-0" + xtend ">=4.0.0 <4.1.0-0" + +through2@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/through2/-/through2-1.1.1.tgz#0847cbc4449f3405574dbdccd9bb841b83ac3545" + dependencies: + readable-stream ">=1.1.13-1 <1.2.0-0" + xtend ">=4.0.0 <4.1.0-0" + +through2@^2, through2@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" + dependencies: + readable-stream "^2.1.5" + xtend "~4.0.1" + +"through@>=2.2.7 <3", through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + +tildify@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a" + dependencies: + os-homedir "^1.0.0" + +time-stamp@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.0.1.tgz#9f4bd23559c9365966f3302dbba2b07c6b99b151" + +timers-browserify@^1.0.1: + version "1.4.2" + resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" + dependencies: + process "~0.11.0" + +to-arraybuffer@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" + +to-fast-properties@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" + +tough-cookie@~2.3.0: + version "2.3.2" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + dependencies: + punycode "^1.4.1" + +trim-newlines@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" + +tryit@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" + +tty-browserify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" + +tunnel-agent@~0.4.1: + version "0.4.3" + resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" + +tweetnacl@^0.14.3, tweetnacl@~0.14.0: + version "0.14.5" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + dependencies: + prelude-ls "~1.1.2" + +type-detect@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" + +type-detect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" + +typedarray@~0.0.5: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + +uglify-js@^2.4.16, uglify-js@^2.6: + version "2.7.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8" + dependencies: + async "~0.2.6" + source-map "~0.5.1" + uglify-to-browserify "~1.0.0" + yargs "~3.10.0" + +uglify-to-browserify@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + +uid-number@~0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" + +umd@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.1.tgz#8ae556e11011f63c2596708a8837259f01b3d60e" + +unc-path-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + +unique-stream@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-1.0.0.tgz#d59a4a75427447d9aa6c91e70263f8d26a4b104b" + +url@~0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + dependencies: + punycode "1.3.2" + querystring "0.2.0" + +urlgrey@>=0.4.0: + version "0.4.4" + resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f" + +user-home@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + +util@0.10.3, util@~0.10.1: + version "0.10.3" + resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" + dependencies: + inherits "2.0.1" + +uuid@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.1.tgz#6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1" + +v8flags@^2.0.2: + version "2.0.11" + resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.0.11.tgz#bca8f30f0d6d60612cc2c00641e6962d42ae6881" + dependencies: + user-home "^1.1.1" + +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +verror@1.3.6: + version "1.3.6" + resolved "https://registry.yarnpkg.com/verror/-/verror-1.3.6.tgz#cff5df12946d297d2baaefaa2689e25be01c005c" + dependencies: + extsprintf "1.0.2" + +vinyl-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/vinyl-file/-/vinyl-file-2.0.0.tgz#a7ebf5ffbefda1b7d18d140fcb07b223efb6751a" + dependencies: + graceful-fs "^4.1.2" + pify "^2.3.0" + pinkie-promise "^2.0.0" + strip-bom "^2.0.0" + strip-bom-stream "^2.0.0" + vinyl "^1.1.0" + +vinyl-fs@^0.3.0: + version "0.3.14" + resolved "https://registry.yarnpkg.com/vinyl-fs/-/vinyl-fs-0.3.14.tgz#9a6851ce1cac1c1cea5fe86c0931d620c2cfa9e6" + dependencies: + defaults "^1.0.0" + glob-stream "^3.1.5" + glob-watcher "^0.0.6" + graceful-fs "^3.0.0" + mkdirp "^0.5.0" + strip-bom "^1.0.0" + through2 "^0.6.1" + vinyl "^0.4.0" + +vinyl-sourcemaps-apply@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705" + dependencies: + source-map "^0.5.1" + +vinyl@^0.4.0: + version "0.4.6" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.4.6.tgz#2f356c87a550a255461f36bbeb2a5ba8bf784847" + dependencies: + clone "^0.2.0" + clone-stats "^0.0.1" + +vinyl@^0.5.0: + version "0.5.3" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.5.3.tgz#b0455b38fc5e0cf30d4325132e461970c2091cde" + dependencies: + clone "^1.0.0" + clone-stats "^0.0.1" + replace-ext "0.0.1" + +vinyl@^1.1.0, vinyl@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-1.2.0.tgz#5c88036cf565e5df05558bfc911f8656df218884" + dependencies: + clone "^1.0.0" + clone-stats "^0.0.1" + replace-ext "0.0.1" + +vm-browserify@~0.0.1: + version "0.0.4" + resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-0.0.4.tgz#5d7ea45bbef9e4a6ff65f95438e0a87c357d5a73" + dependencies: + indexof "0.0.1" + +which-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" + +which@^1.2.12, which@^1.2.4, which@^1.2.9: + version "1.2.12" + resolved "https://registry.yarnpkg.com/which/-/which-1.2.12.tgz#de67b5e450269f194909ef23ece4ebe416fa1192" + dependencies: + isexe "^1.1.1" + +wide-align@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.0.tgz#40edde802a71fea1f070da3e62dcda2e7add96ad" + dependencies: + string-width "^1.0.1" + +window-size@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" + +wordwrap@0.0.2, wordwrap@~0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + +wordwrap@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + +wrap-ansi@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + dependencies: + string-width "^1.0.1" + strip-ansi "^3.0.1" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + +write-file-atomic@^1.1.4: + version "1.3.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.1.tgz#7d45ba32316328dd1ec7d90f60ebc0d845bb759a" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + slide "^1.1.5" + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + dependencies: + mkdirp "^0.5.1" + +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + +y18n@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + +yallist@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.0.0.tgz#306c543835f09ee1a4cb23b7bce9ab341c91cdd4" + +yargs-parser@^4.0.2, yargs-parser@^4.2.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c" + dependencies: + camelcase "^3.0.0" + +yargs@^6.5.0, yargs@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208" + dependencies: + camelcase "^3.0.0" + cliui "^3.2.0" + decamelize "^1.1.1" + get-caller-file "^1.0.1" + os-locale "^1.4.0" + read-pkg-up "^1.0.1" + require-directory "^2.1.1" + require-main-filename "^1.0.1" + set-blocking "^2.0.0" + string-width "^1.0.2" + which-module "^1.0.0" + y18n "^3.2.1" + yargs-parser "^4.2.0" + +yargs@~3.10.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" + dependencies: + camelcase "^1.0.2" + cliui "^2.1.0" + decamelize "^1.0.0" + window-size "0.1.0" From 398b0326a32f6de9c85a721806801d28ca568b09 Mon Sep 17 00:00:00 2001 From: wtgtybhertgeghgtwtg Date: Mon, 23 Jan 2017 21:35:44 -0700 Subject: [PATCH 101/222] [7.0] Bump `home-or-tmp` for `babel-register`. (#5189) --- packages/babel-register/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index de6c6897fd..1d5554dafc 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -11,7 +11,7 @@ "babel-core": "^6.22.0", "babel-runtime": "^6.22.0", "core-js": "^2.4.0", - "home-or-tmp": "^2.0.0", + "home-or-tmp": "^3.0.0", "lodash": "^4.2.0", "mkdirp": "^0.5.1", "source-map-support": "^0.4.2" From 2a1db1c25048395bbf150cc8e2a4cf8ada881433 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Tue, 24 Jan 2017 15:00:31 +0100 Subject: [PATCH 102/222] docs: [skip ci] update README (#5200) --- .../babel-plugin-transform-es2015-arrow-functions/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/README.md b/packages/babel-plugin-transform-es2015-arrow-functions/README.md index 6689b0f85c..862a6b878d 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/README.md +++ b/packages/babel-plugin-transform-es2015-arrow-functions/README.md @@ -64,13 +64,15 @@ npm install --save-dev babel-plugin-transform-es2015-arrow-functions **.babelrc** Without options: + ```json { "plugins": ["transform-es2015-arrow-functions"] } ``` -With options +With options: + ```json { "plugins": [ From 7fe59c38fed3c44c7964c0c670d1a0f40b00a1aa Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Tue, 24 Jan 2017 15:23:35 +0100 Subject: [PATCH 103/222] docs: [skip ci] update README (#5202) --- .../babel-plugin-transform-regenerator/README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/babel-plugin-transform-regenerator/README.md b/packages/babel-plugin-transform-regenerator/README.md index 18adfa4bca..a9060c769f 100644 --- a/packages/babel-plugin-transform-regenerator/README.md +++ b/packages/babel-plugin-transform-regenerator/README.md @@ -34,8 +34,6 @@ function a() { } ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&lineWrap=true&presets=es2015%2Ces2015-loose%2Creact&experimental=false&loose=false&spec=false&code=function%20*range(max%2C%20step)%20%7B%0A%20%20var%20count%20%3D%200%3B%0A%20%20step%20%3D%20step%20%7C%7C%201%3B%0A%20%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20max%3B%20i%20%2B%3D%20step)%20%7B%0A%20%20%20%20count%2B%2B%3B%0A%20%20%20%20yield%20i%3B%0A%20%20%7D%0A%20%0A%20%20return%20count%3B%0A%7D%0A%20%0Avar%20gen%20%3D%20range(20%2C%203)%2C%20info%3B%0A%20%0Awhile%20(!(info%20%3D%20gen.next()).done)%20%7B%0A%20%20console.log(info.value)%3B%0A%7D%0A%20%0Aconsole.log(%22steps%20taken%3A%20%22%20%2B%20info.value)%3B&playground=true) - ## Installation ```sh @@ -48,12 +46,17 @@ npm install --save-dev babel-plugin-transform-regenerator **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-regenerator"] } -// with options +``` + +With options: + +````json { "plugins": [ ["transform-regenerator", { From aa7817bafb79b67aa25d8f5016381aa626f2f9ea Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Tue, 24 Jan 2017 15:32:18 +0100 Subject: [PATCH 104/222] transform-regenerator README pt2 (#5203) * docs: [skip ci] remove comments in JSON * docs: [skip ci] nit remove duplicated babelrc --- .../babel-plugin-transform-regenerator/README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/babel-plugin-transform-regenerator/README.md b/packages/babel-plugin-transform-regenerator/README.md index a9060c769f..e82f106380 100644 --- a/packages/babel-plugin-transform-regenerator/README.md +++ b/packages/babel-plugin-transform-regenerator/README.md @@ -44,8 +44,6 @@ npm install --save-dev babel-plugin-transform-regenerator ### Via `.babelrc` (Recommended) -**.babelrc** - Without options: ```json @@ -56,13 +54,19 @@ Without options: With options: +|name|default value| +|---|---| +|asyncGenerators|true| +|generators|true| +|async|true| + ````json { "plugins": [ ["transform-regenerator", { - asyncGenerators: false, // true by default - generators: false, // true by default - async: false // true by default + asyncGenerators: false, + generators: false, + async: false }] ] } From 931cee7ab8324235b9fa4c13f697eb01dffd5e8d Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Thu, 26 Jan 2017 14:00:23 +0100 Subject: [PATCH 105/222] docs: [skip ci] update README (#5212) --- packages/babel-plugin-transform-flow-strip-types/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/babel-plugin-transform-flow-strip-types/README.md b/packages/babel-plugin-transform-flow-strip-types/README.md index afde54949b..6e279dbfae 100644 --- a/packages/babel-plugin-transform-flow-strip-types/README.md +++ b/packages/babel-plugin-transform-flow-strip-types/README.md @@ -16,9 +16,6 @@ function foo(one: any, two: number, three?): string {} function foo(one, two, three) {} ``` -[Try in REPL](http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=react&code=function%20foo(one%3A%20any%2C%20two%3A%20number%2C%20three%3F)%3A%20string%20%7B%7D&experimental=false&loose=false&spec=false&playground=false&stage=0 -) - ## Installation ```sh From a52265c79eeffbecc73859d03832972799115060 Mon Sep 17 00:00:00 2001 From: Thomas Roch Date: Thu, 26 Jan 2017 16:04:56 +0000 Subject: [PATCH 106/222] docs: fix do expressions JSX example (#5214) [skip ci] --- packages/babel-plugin-transform-do-expressions/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/babel-plugin-transform-do-expressions/README.md b/packages/babel-plugin-transform-do-expressions/README.md index 44e252e17d..93cb412558 100644 --- a/packages/babel-plugin-transform-do-expressions/README.md +++ b/packages/babel-plugin-transform-do-expressions/README.md @@ -47,8 +47,6 @@ let a = do { }; ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=let%20x%20%3D%20100%3B%0Alet%20y%20%3D%2020%3B%0A%0Alet%20a%20%3D%20do%20%7B%0A%20%20if(x%20%3E%2010)%20%7B%0A%20%20%20%20if(y%20%3E%2020)%20%7B%0A%20%20%20%20%20%20'big%20x%2C%20big%20y'%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20'big%20x%2C%20small%20y'%3B%0A%20%20%20%20%7D%0A%20%20%7D%20else%20%7B%0A%20%20%20%20if(y%20%3E%2010)%20%7B%0A%20%20%20%20%20%20'small%20x%2C%20big%20y'%3B%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20'small%20x%2C%20small%20y'%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%3B%0A%0Aconsole.log(a)%3B) - ## Example ### In JSX @@ -75,8 +73,8 @@ const Component = props =>
{do { if(color === 'blue') { ; } - if(color === 'red') { ; } - if(color === 'green') { ; } + else if(color === 'red') { ; } + else if(color === 'green') { ; } }}
; From 446b4a7dbd7e79fad8fcdfe374bbc04228dafee6 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Thu, 26 Jan 2017 21:50:23 +0100 Subject: [PATCH 107/222] docs: remove link to REPL (#5216) --- packages/babel-plugin-check-es2015-constants/README.md | 1 - .../babel-plugin-syntax-trailing-function-commas/README.md | 1 - .../babel-plugin-transform-class-constructor-call/README.md | 2 -- packages/babel-plugin-transform-class-properties/README.md | 1 - packages/babel-plugin-transform-do-expressions/README.md | 2 -- .../babel-plugin-transform-exponentiation-operator/README.md | 1 - packages/babel-plugin-transform-export-extensions/README.md | 1 - packages/babel-plugin-transform-function-bind/README.md | 3 --- packages/babel-plugin-transform-object-rest-spread/README.md | 1 - 9 files changed, 13 deletions(-) diff --git a/packages/babel-plugin-check-es2015-constants/README.md b/packages/babel-plugin-check-es2015-constants/README.md index 608891b3d2..1ee65e3f07 100644 --- a/packages/babel-plugin-check-es2015-constants/README.md +++ b/packages/babel-plugin-check-es2015-constants/README.md @@ -20,7 +20,6 @@ repl: "a" is read-only | ^ ``` -[Try in REPL](http://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015&experimental=false&loose=false&spec=false&code=const%20a%20%3D%201%3B%0Aa%20%3D%202%3B&playground=true) ## Installation diff --git a/packages/babel-plugin-syntax-trailing-function-commas/README.md b/packages/babel-plugin-syntax-trailing-function-commas/README.md index fd7022b23f..61622bfe69 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/README.md +++ b/packages/babel-plugin-syntax-trailing-function-commas/README.md @@ -14,7 +14,6 @@ clownPuppiesEverywhere( 'bar', ); ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=function%20clownPuppiesEverywhere(%0A%20%20param1%2C%0A%20%20param2%2C%0A)%20%7B%20%2F*%20...%20*%2F%20%7D%0A%0AclownPuppiesEverywhere(%0A%20%20'foo'%2C%0A%20%20'bar'%2C%0A)%3B) ## Example diff --git a/packages/babel-plugin-transform-class-constructor-call/README.md b/packages/babel-plugin-transform-class-constructor-call/README.md index badb23aef9..519c27cc71 100644 --- a/packages/babel-plugin-transform-class-constructor-call/README.md +++ b/packages/babel-plugin-transform-class-constructor-call/README.md @@ -23,7 +23,6 @@ class Point { let p1 = new Point(1, 2); // OK let p2 = Point(3, 4); // OK ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=class%20Point%20%7B%0A%0A%20%20constructor(x%2C%20y)%20%7B%0A%20%20%20%20this.x%20%3D%20x%3B%0A%20%20%20%20this.y%20%3D%20y%3B%0A%20%20%7D%0A%0A%20%20call%20constructor(x%2C%20y)%20%7B%0A%20%20%20%20return%20new%20Point(x%2C%20y)%3B%0A%20%20%7D%0A%0A%7D%0A%0Alet%20p1%20%3D%20new%20Point(1%2C%202)%3B%20%2F%2F%20OK%0Alet%20p2%20%3D%20Point(3%2C%204)%3B%20%2F%2F%20OK) ## Example @@ -60,7 +59,6 @@ class Date { let now = new Date(); // Get a Date instance let nowStr = Date(); // Use the 'call constructor()' part to get a string value of the current date ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=class%20Date%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20%2F%2F%20...%0A%20%20%7D%0A%0A%20%20call%20constructor()%20%7B%0A%20%20%20%20let%20date%20%3D%20new%20Date()%3B%0A%20%20%20%20return%20date.toString()%3B%0A%20%20%7D%0A%7D%0A%0Alet%20now%20%3D%20new%20Date()%3B%20%2F%2F%20Get%20a%20Date%20instance%0Alet%20nowStr%20%3D%20Date()%3B%20%2F%2F%20Use%20the%20'call%20constructor()'%20part%20to%20get%20a%20string%20value%20of%20the%20current%20date) ## Installation diff --git a/packages/babel-plugin-transform-class-properties/README.md b/packages/babel-plugin-transform-class-properties/README.md index 9dbe559082..df28bcab6d 100644 --- a/packages/babel-plugin-transform-class-properties/README.md +++ b/packages/babel-plugin-transform-class-properties/README.md @@ -33,7 +33,6 @@ Below is a class with four class properties which will be transformed. console.log(Bork.staticFunction()); // > "babelIsCool" ``` -[Try in REPL](http://babeljs.io/repl/#?babili=false&evaluate=false&lineWrap=false&presets=es2016%2Clatest%2Cstage-2&code=%20%20class%20Bork%20%7B%0A%20%20%20%20%2F%2FProperty%20initilizer%20syntax%0A%20%20%20%20instanceProperty%20%3D%20%22bork%22%3B%0A%20%20%20%20boundFunction%20%3D%20()%20%3D%3E%20%7B%0A%20%20%20%20%20%20return%20this.instanceProperty%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%2F%2FStatic%20class%20properties%0A%20%20%20%20static%20staticProperty%20%3D%20%22babeliscool%22%3B%0A%20%20%20%20static%20staticFunction%20%3D%20function()%20%7B%0A%20%20%20%20%20%20return%20Bork.staticProperty%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%0A%20%20let%20myBork%20%3D%20new%20Bork%3B%0A%0A%20%20%2F%2FProperty%20initializers%20are%20not%20on%20the%20prototype.%0A%20%20console.log(Bork.prototype.boundFunction)%3B%20%2F%2F%20%3E%20undefined%0A%0A%20%20%2F%2FBound%20functions%20are%20bound%20to%20the%20class%20instance.%0A%20%20console.log(myBork.boundFunction.call(undefined))%3B%20%2F%2F%20%3E%20%22bork%22%0A%0A%20%20%2F%2FStatic%20function%20exists%20on%20the%20class.%0A%20%20console.log(Bork.staticFunction())%3B%20%2F%2F%20%3E%20%22babelIsCool%22) ## Installation diff --git a/packages/babel-plugin-transform-do-expressions/README.md b/packages/babel-plugin-transform-do-expressions/README.md index 93cb412558..3408d8d894 100644 --- a/packages/babel-plugin-transform-do-expressions/README.md +++ b/packages/babel-plugin-transform-do-expressions/README.md @@ -22,7 +22,6 @@ let a = do { let a = x > 10 ? 'big' : 'small'; ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=%0Alet%20x%20%3D%20100%3B%0A%0Alet%20a%20%3D%20do%20%7B%0A%20%20if(x%20%3E%2010)%20%7B%0A%20%20%20%20'big'%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20'small'%3B%0A%20%20%7D%0A%7D%3B%0A%0Aconsole.log(a)%3B) This example is not the best usage because it is too simple and using a ternary operator is a better option but you can have a much more complex condition in the `do { ... }` expression with several `if ... else` chains: @@ -80,7 +79,6 @@ const Component = props => ; ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Creact%2Cstage-0&code=const%20Component%20%3D%20props%20%3D%3E%0A%20%20%3Cdiv%20className%3D'myComponent'%3E%0A%20%20%20%20%7Bdo%20%7B%0A%20%20%20%20%20%20if(color%20%3D%3D%3D%20'blue')%20%7B%20%3CBlueComponent%2F%3E%3B%20%7D%0A%20%20%20%20%20%20if(color%20%3D%3D%3D%20'red')%20%7B%20%3CRedComponent%2F%3E%3B%20%7D%0A%20%20%20%20%20%20if(color%20%3D%3D%3D%20'green')%20%7B%20%3CGreenComponent%2F%3E%3B%20%7D%0A%20%20%20%20%7D%7D%0A%20%20%3C%2Fdiv%3E%0A%3B) ## Installation diff --git a/packages/babel-plugin-transform-exponentiation-operator/README.md b/packages/babel-plugin-transform-exponentiation-operator/README.md index 82769d80a3..274dfe8416 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/README.md +++ b/packages/babel-plugin-transform-exponentiation-operator/README.md @@ -24,7 +24,6 @@ let b = 3; b **= 3; // same as: b = b * b * b; ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=%2F%2F%20x%20**%20y%0A%0Alet%20squared%20%3D%202%20**%202%3B%0A%2F%2F%20same%20as%3A%202%20*%202%0A%0Alet%20cubed%20%3D%202%20**%203%3B%0A%2F%2F%20same%20as%3A%202%20*%202%20*%202%0A%0A%0A%2F%2F%20x%20**%3D%20y%0A%0Alet%20a%20%3D%202%3B%0Aa%20**%3D%202%3B%0A%2F%2F%20same%20as%3A%20a%20%3D%20a%20*%20a%3B%0A%0Alet%20b%20%3D%203%3B%0Ab%20**%3D%203%3B%0A%2F%2F%20same%20as%3A%20b%20%3D%20b%20*%20b%20*%20b%3B) ## Installation diff --git a/packages/babel-plugin-transform-export-extensions/README.md b/packages/babel-plugin-transform-export-extensions/README.md index 26f7d51278..6014dc4c53 100644 --- a/packages/babel-plugin-transform-export-extensions/README.md +++ b/packages/babel-plugin-transform-export-extensions/README.md @@ -8,7 +8,6 @@ export * as ns from 'mod'; export v from 'mod'; ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=export%20*%20as%20ns%20from%20'mod'%3B%0Aexport%20v%20from%20'mod'%3B) ## Installation diff --git a/packages/babel-plugin-transform-function-bind/README.md b/packages/babel-plugin-transform-function-bind/README.md index 0de2810294..76505a17f4 100644 --- a/packages/babel-plugin-transform-function-bind/README.md +++ b/packages/babel-plugin-transform-function-bind/README.md @@ -18,7 +18,6 @@ func.call(obj, val) func.call(obj, val) ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=obj%3A%3Afunc%3B%0A%0Aobj%3A%3Afunc(val)%3B%0A%0A%3A%3Aobj.func(val)%3B) ## Example @@ -43,7 +42,6 @@ function add(val) { return this + val; } console.log(bigBox::getWeight()::add(5)); // prints '15' ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=const%20box%20%3D%20%7B%0A%20%20weight%3A%202%2C%0A%20%20getWeight()%20%7B%20return%20this.weight%3B%20%7D%2C%0A%7D%3B%0A%0Aconst%20%7B%20getWeight%20%7D%20%3D%20box%3B%0A%0Aconsole.log(box.getWeight())%3B%20%2F%2F%20prints%20'2'%0A%0Aconst%20bigBox%20%3D%20%7B%20weight%3A%2010%20%7D%3B%0Aconsole.log(bigBox%3A%3AgetWeight())%3B%20%2F%2F%20prints%20'10'%0A%2F%2F%20bigBox%3A%3AgetWeight()%20is%20equivalent%20to%20getWeight.call(bigBox)%0A%0A%2F%2F%20Can%20be%20chained%3A%0Afunction%20add(val)%20%7B%20return%20this%20%2B%20val%3B%20%7D%0A%0Aconsole.log(bigBox%3A%3AgetWeight()%3A%3Aadd(5))%3B%20%2F%2F%20prints%20'15') ### Using with `document.querySelectorAll` @@ -59,7 +57,6 @@ let sslUrls = document.querySelectorAll('a') console.log(sslUrls); ``` -[Try in REPL](http://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=%0Aconst%20%7B%20map%2C%20filter%20%7D%20%3D%20Array.prototype%3B%0A%0Alet%20sslUrls%20%3D%20document.querySelectorAll('a')%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%3Amap(node%20%3D%3E%20node.href)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3A%3Afilter(href%20%3D%3E%20href.substring(0%2C%205)%20%3D%3D%3D%20'https')%3B%0A%0Aconsole.log(sslUrls)%3B%0A) `document.querySelectorAll` returns a `NodeList` element which is not a plain array, so you normally can't use the `map` function on it, and have to use it this way: `Array.prototype.map.call(document.querySelectorAll(...), node => { ... })`. The above code using the `::` will work because it is equivalent to: diff --git a/packages/babel-plugin-transform-object-rest-spread/README.md b/packages/babel-plugin-transform-object-rest-spread/README.md index 7fd2afe530..b8f365d7af 100644 --- a/packages/babel-plugin-transform-object-rest-spread/README.md +++ b/packages/babel-plugin-transform-object-rest-spread/README.md @@ -16,7 +16,6 @@ let n = { x, y, ...z }; console.log(n); // { x: 1, y: 2, a: 3, b: 4 } ``` -[Try in REPL](https://babeljs.io/repl/#?evaluate=true&presets=es2015%2Cstage-0&code=%2F%2F%20Rest%20properties%0Alet%20%7B%20x%2C%20y%2C%20...z%20%7D%20%3D%20%7B%20x%3A%201%2C%20y%3A%202%2C%20a%3A%203%2C%20b%3A%204%20%7D%3B%0Aconsole.log(x)%3B%20%2F%2F%201%0Aconsole.log(y)%3B%20%2F%2F%202%0Aconsole.log(z)%3B%20%2F%2F%20%7B%20a%3A%203%2C%20b%3A%204%20%7D%0A%0A%2F%2F%20Spread%20properties%0Alet%20n%20%3D%20%7B%20x%2C%20y%2C%20...z%20%7D%3B%0Aconsole.log(n)%3B%20%2F%2F%20%7B%20x%3A%201%2C%20y%3A%202%2C%20a%3A%203%2C%20b%3A%204%20%7D) ## Installation From 0766f29591a0ad96c267613f1447ab54821a02f2 Mon Sep 17 00:00:00 2001 From: Anderson Vasques Date: Thu, 26 Jan 2017 23:01:54 -0200 Subject: [PATCH 108/222] [7.0] Use lerna's --independent mode + changes (fixes #5221) Adding version `independent` and cacheDir `.changelog` --- lerna.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 2858f12c31..2a66b05933 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.23", - "version": "6.22.2", + "version": "independent", "changelog": { "repo": "babel/babel", "labels": { @@ -13,6 +13,7 @@ "tag: internal": ":house: Internal" } }, + "cacheDir": ".changelog", "bootstrapConfig": { "ignore": "babel-runtime" }, From a97be3598476028b07636eeeaa0839734105bc10 Mon Sep 17 00:00:00 2001 From: Fabian Finke Date: Fri, 27 Jan 2017 13:39:39 +0100 Subject: [PATCH 109/222] Add example to spread README [skip ci] (#5227) --- .../README.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/babel-plugin-transform-es2015-spread/README.md b/packages/babel-plugin-transform-es2015-spread/README.md index 9d0e16629d..4a3f66b6cb 100644 --- a/packages/babel-plugin-transform-es2015-spread/README.md +++ b/packages/babel-plugin-transform-es2015-spread/README.md @@ -2,6 +2,40 @@ > Compile ES2015 spread to ES5 +## Example + +**In** + +```js +var a = ['a', 'b', 'c']; +var b = [...a, 'foo']; + +var c = { foo: 'bar', baz: 42 }; +var d = {...o, a: 2}; +``` + +**Out** + +```js +var _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; +} + +var a = [ 'a', 'b', 'c' ]; +var b = [].concat(a, [ 'foo' ]); + +var c = { foo: 'bar', baz: 42 }; +var d = _extends({}, o, { a: 2 }); +``` + ## Installation ```sh From 3f95a767f2d7151669fabf9c4c0f6f1f3d348ef1 Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Fri, 27 Jan 2017 16:02:10 +0200 Subject: [PATCH 110/222] [7.0] Add legacy-decorators to stage-1. Fixes #5220 (#5225) --- packages/babel-preset-stage-1/package.json | 1 + packages/babel-preset-stage-1/src/index.js | 2 ++ packages/babel-preset-stage-2/package.json | 1 - packages/babel-preset-stage-2/src/index.js | 2 -- 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index b50f378b1b..7afcbc840a 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -8,6 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", "main": "lib/index.js", "dependencies": { + "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-export-extensions": "^6.22.0", "babel-preset-stage-2": "^6.22.0" } diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index deff6cefbd..60a9e98050 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -1,5 +1,6 @@ import presetStage2 from "babel-preset-stage-2"; +import transformDecoratorsLegacy from "babel-plugin-transform-decorators-legacy"; import transformExportExtensions from "babel-plugin-transform-export-extensions"; export default { @@ -7,6 +8,7 @@ export default { presetStage2 ], plugins: [ + transformDecoratorsLegacy, transformExportExtensions ] }; diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json index 710db5c5c2..6ba06bc92c 100644 --- a/packages/babel-preset-stage-2/package.json +++ b/packages/babel-preset-stage-2/package.json @@ -10,7 +10,6 @@ "dependencies": { "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-class-properties": "^6.22.0", - "babel-plugin-transform-decorators": "^6.22.0", "babel-plugin-transform-unicode-property-regex": "^2.0.0", "babel-preset-stage-3": "^6.22.0" } diff --git a/packages/babel-preset-stage-2/src/index.js b/packages/babel-preset-stage-2/src/index.js index 7bc11d1bc2..efdd6ac729 100644 --- a/packages/babel-preset-stage-2/src/index.js +++ b/packages/babel-preset-stage-2/src/index.js @@ -2,7 +2,6 @@ import presetStage3 from "babel-preset-stage-3"; import syntaxDynamicImport from "babel-plugin-syntax-dynamic-import"; import transformClassProperties from "babel-plugin-transform-class-properties"; -import transformDecorators from "babel-plugin-transform-decorators"; import transformUnicodePropertyRegex from "babel-plugin-transform-unicode-property-regex"; export default { @@ -12,7 +11,6 @@ export default { plugins: [ syntaxDynamicImport, transformClassProperties, - transformDecorators, transformUnicodePropertyRegex ] }; From e5aa501327593af2a5da08f221aaf6e070b9125c Mon Sep 17 00:00:00 2001 From: wtgtybhertgeghgtwtg Date: Fri, 27 Jan 2017 07:02:48 -0700 Subject: [PATCH 111/222] Bump `detect-indent`. (#5226) --- packages/babel-generator/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 418f105dc6..b305ca829c 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -14,7 +14,7 @@ "babel-messages": "^6.22.0", "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", - "detect-indent": "^4.0.0", + "detect-indent": "^5.0.0", "jsesc": "^1.3.0", "lodash": "^4.2.0", "source-map": "^0.5.0" From e09ea222c9458ced067df1068fd45fa273d2da7b Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 27 Jan 2017 09:04:35 -0500 Subject: [PATCH 112/222] Remove babel-runtime from packages' dependencies (#5218) --- Makefile | 1 - circle.yml | 8 +++++++ lerna.json | 3 --- package.json | 3 --- packages/babel-cli/package.json | 1 - packages/babel-core/package.json | 1 - packages/babel-core/src/store.js | 24 ++++++++++--------- packages/babel-generator/package.json | 1 - .../package.json | 1 - .../package.json | 1 - .../package.json | 1 - .../package.json | 1 - .../babel-helper-call-delegate/package.json | 1 - packages/babel-helper-define-map/package.json | 1 - .../package.json | 1 - .../babel-helper-explode-class/package.json | 1 - packages/babel-helper-fixtures/package.json | 1 - .../babel-helper-function-name/package.json | 1 - .../package.json | 1 - .../babel-helper-hoist-variables/package.json | 1 - .../package.json | 1 - .../package.json | 1 - packages/babel-helper-regex/package.json | 1 - .../package.json | 1 - .../babel-helper-replace-supers/package.json | 1 - .../package.json | 1 - packages/babel-helpers/package.json | 1 - packages/babel-messages/package.json | 5 +--- .../package.json | 3 --- .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 1 - .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 1 - .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 1 - .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 1 - .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 3 --- .../package.json | 1 - .../package.json | 3 --- .../package.json | 3 --- .../package.json | 3 +-- .../babel-plugin-transform-eval/package.json | 3 --- .../package.json | 3 +-- .../package.json | 3 +-- .../package.json | 1 - .../package.json | 1 - .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 3 --- .../package.json | 3 +-- .../package.json | 3 --- .../package.json | 1 - .../package.json | 3 --- .../package.json | 3 --- .../package.json | 1 - .../package.json | 1 - .../package.json | 1 - .../package.json | 1 - .../package.json | 3 --- .../package.json | 1 - .../package.json | 1 - packages/babel-polyfill/package.json | 1 - packages/babel-register/package.json | 1 - packages/babel-runtime/scripts/build-dist.js | 23 +++--------------- packages/babel-template/package.json | 1 - packages/babel-traverse/package.json | 1 - packages/babel-types/package.json | 1 - 89 files changed, 46 insertions(+), 185 deletions(-) diff --git a/Makefile b/Makefile index df498a5323..b35ddf0707 100644 --- a/Makefile +++ b/Makefile @@ -72,5 +72,4 @@ bootstrap: ./node_modules/.bin/lerna bootstrap make build cd packages/babel-runtime; \ - npm install; \ node scripts/build-dist.js diff --git a/circle.yml b/circle.yml index 42bf0b0ea2..df9b1c49ec 100644 --- a/circle.yml +++ b/circle.yml @@ -3,6 +3,14 @@ machine: version: 6 +dependencies: + pre: + - curl -o- -L https://yarnpkg.com/install.sh | bash + cache_directories: + - ~/.yarn-cache + override: + - yarn + test: override: - make test-ci diff --git a/lerna.json b/lerna.json index 2a66b05933..29d69c0eea 100644 --- a/lerna.json +++ b/lerna.json @@ -14,9 +14,6 @@ } }, "cacheDir": ".changelog", - "bootstrapConfig": { - "ignore": "babel-runtime" - }, "publishConfig": { "ignore": [ "*.md", diff --git a/package.json b/package.json index b2cb44e7b8..99d9cf5126 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,9 @@ "babel-plugin-istanbul": "^2.0.1", "babel-plugin-transform-class-properties": "^6.6.0", "babel-plugin-transform-flow-strip-types": "^6.3.13", - "babel-plugin-transform-runtime": "^6.3.13", "babel-preset-es2015": "^6.13.2", "babel-preset-stage-0": "^6.0.0", "babel-register": "^6.14.0", - "babel-runtime": "^6.0.0", "browserify": "^13.1.1", "bundle-collapser": "^1.2.1", "chai": "^3.5.0", @@ -58,7 +56,6 @@ "stage-0" ], "plugins": [ - "transform-runtime", "transform-class-properties", "transform-flow-strip-types" ], diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 4cecd9fe97..dba5eea05a 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -19,7 +19,6 @@ "babel-core": "^6.22.1", "babel-register": "^6.22.0", "babel-polyfill": "^6.22.0", - "babel-runtime": "^6.22.0", "commander": "^2.8.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.0.0", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 8de01d55b1..e28bf0b3c7 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -31,7 +31,6 @@ "babel-helpers": "^6.22.0", "babel-messages": "^6.22.0", "babel-template": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-register": "^6.22.0", "babel-traverse": "^6.22.1", "babel-types": "^6.22.0", diff --git a/packages/babel-core/src/store.js b/packages/babel-core/src/store.js index 1b172efbe0..bf5c984d75 100644 --- a/packages/babel-core/src/store.js +++ b/packages/babel-core/src/store.js @@ -1,22 +1,24 @@ -export default class Store extends Map { +export default class Store { constructor() { - super(); - this.dynamicData = {}; + this._map = new Map(); + this._map.dynamicData = {}; } - dynamicData: Object; - setDynamic(key, fn) { - this.dynamicData[key] = fn; + this._map.dynamicData[key] = fn; + } + + set(key: string, val) { + this._map.set(key, val); } get(key: string): any { - if (this.has(key)) { - return super.get(key); + if (this._map.has(key)) { + return this._map.get(key); } else { - if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) { - const val = this.dynamicData[key](); - this.set(key, val); + if (Object.prototype.hasOwnProperty.call(this._map.dynamicData, key)) { + const val = this._map.dynamicData[key](); + this._map.set(key, val); return val; } } diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index b305ca829c..9a6b38db42 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -12,7 +12,6 @@ ], "dependencies": { "babel-messages": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", "detect-indent": "^5.0.0", "jsesc": "^1.3.0", diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index ba8d4b6ed3..782f453cfa 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-traverse": "^6.22.0", "babel-types": "^6.22.0" } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index 1170a03986..5cceb0d22c 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-helper-explode-assignable-expression": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json index d693b0dab6..215847d2b6 100644 --- a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-helper-explode-assignable-expression": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index 96eda6166a..b42a80759e 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", "esutils": "^2.0.0", "lodash": "^4.2.0" diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index 258f15ebef..f50d9cdd54 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-traverse": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", "babel-helper-hoist-variables": "^6.22.0" } diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index 615b8f7a05..6b37578050 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "lodash": "^4.2.0", "babel-types": "^6.22.0", "babel-helper-function-name": "^6.22.0" diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index 5baba21edd..6a030f9006 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-traverse": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index 0bbd09cc0a..9d2c16a0d0 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-traverse": "^6.22.0", "babel-types": "^6.22.0", "babel-helper-bindify-decorators": "^6.22.0" diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index f02d590a3e..9233a89998 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -7,7 +7,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-fixtures", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "lodash": "^4.2.0", "try-resolve": "^1.0.0" } diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index a6482601d9..e73131de5d 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", "babel-traverse": "^6.22.0", "babel-helper-get-function-arity": "^6.22.0", diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index d6878a1758..199e2bc695 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index 6d303b2765..428b1d04d3 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index a033ad6dd9..b3b8cbdcb4 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index c8b0dfa1f2..e8fc962da4 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-helper-transform-fixture-test-runner": "^6.22.0" } } diff --git a/packages/babel-helper-regex/package.json b/packages/babel-helper-regex/package.json index 0a3e92f249..ab92376eff 100644 --- a/packages/babel-helper-regex/package.json +++ b/packages/babel-helper-regex/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "lodash": "^4.2.0", "babel-types": "^6.22.0" } diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index e1ec449760..d00a0410bd 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -6,7 +6,6 @@ "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-template": "^6.22.0", "babel-types": "^6.22.0", "babel-traverse": "^6.22.0", diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index e9fd9c65eb..d1bb283209 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-helper-optimise-call-expression": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-traverse": "^6.22.0", "babel-messages": "^6.22.0", "babel-template": "^6.22.0", diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index 61e7603096..2d9f78097a 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -8,7 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-core": "^6.22.0", "babel-polyfill": "^6.22.0", "babel-helper-fixtures": "^6.22.0", diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index a88c869426..19e03ccd86 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -8,7 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "babel-template": "^6.22.0" } } diff --git a/packages/babel-messages/package.json b/packages/babel-messages/package.json index 13f11c756a..022d7508ac 100644 --- a/packages/babel-messages/package.json +++ b/packages/babel-messages/package.json @@ -6,8 +6,5 @@ "homepage": "https://babeljs.io/", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-messages", - "main": "lib/index.js", - "dependencies": { - "babel-runtime": "^6.22.0" - } + "main": "lib/index.js" } diff --git a/packages/babel-plugin-check-es2015-constants/package.json b/packages/babel-plugin-check-es2015-constants/package.json index b335fbf3f8..fdceaa851a 100644 --- a/packages/babel-plugin-check-es2015-constants/package.json +++ b/packages/babel-plugin-check-es2015-constants/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index c178ef6555..ba6643c695 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-async-functions/package.json b/packages/babel-plugin-transform-async-functions/package.json index 98f9ad738b..c39e9d439c 100644 --- a/packages/babel-plugin-transform-async-functions/package.json +++ b/packages/babel-plugin-transform-async-functions/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-async-functions": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-async-generator-functions/package.json b/packages/babel-plugin-transform-async-generator-functions/package.json index 0fdff521fb..38e5682b3c 100644 --- a/packages/babel-plugin-transform-async-generator-functions/package.json +++ b/packages/babel-plugin-transform-async-generator-functions/package.json @@ -10,8 +10,7 @@ ], "dependencies": { "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-plugin-syntax-async-generators": "^6.5.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-async-generators": "^6.5.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index 9dcbc1e179..a08251e34b 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -10,8 +10,7 @@ ], "dependencies": { "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-async-functions": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-async-to-module-method/package.json b/packages/babel-plugin-transform-async-to-module-method/package.json index 1d5029e79b..338bc63f30 100644 --- a/packages/babel-plugin-transform-async-to-module-method/package.json +++ b/packages/babel-plugin-transform-async-to-module-method/package.json @@ -11,8 +11,7 @@ "dependencies": { "babel-plugin-syntax-async-functions": "^6.8.0", "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-types": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-class-properties/package.json b/packages/babel-plugin-transform-class-properties/package.json index 6bb3fd5012..7122b69b10 100644 --- a/packages/babel-plugin-transform-class-properties/package.json +++ b/packages/babel-plugin-transform-class-properties/package.json @@ -11,7 +11,6 @@ "dependencies": { "babel-helper-function-name": "^6.22.0", "babel-plugin-syntax-class-properties": "^6.8.0", - "babel-runtime": "^6.22.0", "babel-template": "^6.22.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index e8df3a76d0..0264dc7052 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -12,8 +12,7 @@ "babel-types": "^6.22.0", "babel-plugin-syntax-decorators": "^6.13.0", "babel-helper-explode-class": "^6.22.0", - "babel-template": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-template": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-do-expressions/package.json b/packages/babel-plugin-transform-do-expressions/package.json index 7df5dc01b7..2280a1b7ee 100644 --- a/packages/babel-plugin-transform-do-expressions/package.json +++ b/packages/babel-plugin-transform-do-expressions/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-do-expressions": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-do-expressions": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/package.json b/packages/babel-plugin-transform-es2015-arrow-functions/package.json index 0db0959e50..4616579a78 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/package.json +++ b/packages/babel-plugin-transform-es2015-arrow-functions/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json index 922e711887..a23ad992fa 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/package.json b/packages/babel-plugin-transform-es2015-block-scoping/package.json index 15bedf9241..ef72fdfecf 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoping/package.json @@ -9,8 +9,7 @@ "babel-traverse": "^6.22.0", "babel-types": "^6.22.0", "babel-template": "^6.22.0", - "lodash": "^4.2.0", - "babel-runtime": "^6.22.0" + "lodash": "^4.2.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-classes/package.json b/packages/babel-plugin-transform-es2015-classes/package.json index 7288800d7e..1d17d0b748 100644 --- a/packages/babel-plugin-transform-es2015-classes/package.json +++ b/packages/babel-plugin-transform-es2015-classes/package.json @@ -13,7 +13,6 @@ "babel-traverse": "^6.22.0", "babel-helper-define-map": "^6.22.0", "babel-messages": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" }, "keywords": [ diff --git a/packages/babel-plugin-transform-es2015-computed-properties/package.json b/packages/babel-plugin-transform-es2015-computed-properties/package.json index 5eb95c5463..b0ec2bbc45 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/package.json +++ b/packages/babel-plugin-transform-es2015-computed-properties/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-template": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-template": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-destructuring/package.json b/packages/babel-plugin-transform-es2015-destructuring/package.json index 1eb1c832d7..4eb5eb75ae 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/package.json +++ b/packages/babel-plugin-transform-es2015-destructuring/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json index 6b67a6e48d..085c74f022 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-es2015-for-of/package.json b/packages/babel-plugin-transform-es2015-for-of/package.json index 5c1aa3b7e4..53b2959969 100644 --- a/packages/babel-plugin-transform-es2015-for-of/package.json +++ b/packages/babel-plugin-transform-es2015-for-of/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-function-name/package.json b/packages/babel-plugin-transform-es2015-function-name/package.json index 27d81478bc..806288e82e 100644 --- a/packages/babel-plugin-transform-es2015-function-name/package.json +++ b/packages/babel-plugin-transform-es2015-function-name/package.json @@ -10,8 +10,7 @@ ], "dependencies": { "babel-helper-function-name": "^6.22.0", - "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-types": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-instanceof/package.json b/packages/babel-plugin-transform-es2015-instanceof/package.json index 7f214ad6ac..439f03eadb 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/package.json +++ b/packages/babel-plugin-transform-es2015-instanceof/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-literals/package.json b/packages/babel-plugin-transform-es2015-literals/package.json index f99175fe37..1b856acbd1 100644 --- a/packages/babel-plugin-transform-es2015-literals/package.json +++ b/packages/babel-plugin-transform-es2015-literals/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/package.json b/packages/babel-plugin-transform-es2015-modules-amd/package.json index 81560058ad..b7aee66862 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-amd/package.json @@ -7,8 +7,7 @@ "main": "lib/index.js", "dependencies": { "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", - "babel-template": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-template": "^6.22.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json index d27c57c5af..923bf06419 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json @@ -7,7 +7,6 @@ "main": "lib/index.js", "dependencies": { "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-template": "^6.22.0", "babel-plugin-transform-strict-mode": "^6.22.0" }, diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json index 4a2955ebfc..73cdf2d9c5 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json @@ -7,8 +7,7 @@ "main": "lib/index.js", "dependencies": { "babel-template": "^6.22.0", - "babel-helper-hoist-variables": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-helper-hoist-variables": "^6.22.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-modules-umd/package.json b/packages/babel-plugin-transform-es2015-modules-umd/package.json index 1fc3b03b9b..95944f163b 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-umd/package.json @@ -7,8 +7,7 @@ "main": "lib/index.js", "dependencies": { "babel-plugin-transform-es2015-modules-amd": "^6.22.0", - "babel-template": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-template": "^6.22.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-object-super/package.json b/packages/babel-plugin-transform-es2015-object-super/package.json index df33b3d904..ca04d8f410 100644 --- a/packages/babel-plugin-transform-es2015-object-super/package.json +++ b/packages/babel-plugin-transform-es2015-object-super/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-helper-replace-supers": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-helper-replace-supers": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-parameters/package.json b/packages/babel-plugin-transform-es2015-parameters/package.json index 4715c8086b..72fdeee2a4 100644 --- a/packages/babel-plugin-transform-es2015-parameters/package.json +++ b/packages/babel-plugin-transform-es2015-parameters/package.json @@ -10,8 +10,7 @@ "babel-helper-call-delegate": "^6.22.0", "babel-helper-get-function-arity": "^6.22.0", "babel-template": "^6.22.0", - "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-types": "^6.22.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json index f3d831b323..050bca5f58 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-types": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-spread/package.json b/packages/babel-plugin-transform-es2015-spread/package.json index f852ac3186..ac55dfe8b1 100644 --- a/packages/babel-plugin-transform-es2015-spread/package.json +++ b/packages/babel-plugin-transform-es2015-spread/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/package.json b/packages/babel-plugin-transform-es2015-sticky-regex/package.json index 066ca612df..72dae50f3d 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/package.json +++ b/packages/babel-plugin-transform-es2015-sticky-regex/package.json @@ -10,8 +10,7 @@ ], "dependencies": { "babel-helper-regex": "^6.22.0", - "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-types": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-template-literals/package.json b/packages/babel-plugin-transform-es2015-template-literals/package.json index e24bb6d91c..fb4a761686 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/package.json +++ b/packages/babel-plugin-transform-es2015-template-literals/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json index db7ba27eb0..323c189e93 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/package.json b/packages/babel-plugin-transform-es2015-unicode-regex/package.json index 0946948131..634c4fbe5d 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/package.json +++ b/packages/babel-plugin-transform-es2015-unicode-regex/package.json @@ -10,7 +10,6 @@ ], "dependencies": { "babel-helper-regex": "^6.22.0", - "babel-runtime": "^6.22.0", "regexpu-core": "^4.0.2" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/package.json b/packages/babel-plugin-transform-es3-member-expression-literals/package.json index 4fcbd64c14..a3bb29a196 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-es3-member-expression-literals/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es3-property-literals/package.json b/packages/babel-plugin-transform-es3-property-literals/package.json index 7409bed336..b8d43a4043 100644 --- a/packages/babel-plugin-transform-es3-property-literals/package.json +++ b/packages/babel-plugin-transform-es3-property-literals/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-es5-property-mutators/package.json b/packages/babel-plugin-transform-es5-property-mutators/package.json index b2cdbb72e7..d45b7e8f70 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/package.json +++ b/packages/babel-plugin-transform-es5-property-mutators/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-helper-define-map": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-helper-define-map": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-eval/package.json b/packages/babel-plugin-transform-eval/package.json index bccdad7b70..22ac0cc9fb 100644 --- a/packages/babel-plugin-transform-eval/package.json +++ b/packages/babel-plugin-transform-eval/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index 17b67800e9..13bbfdef79 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -10,8 +10,7 @@ ], "dependencies": { "babel-plugin-syntax-exponentiation-operator": "^6.8.0", - "babel-helper-builder-binary-assignment-operator-visitor": "^6.22.0", - "babel-runtime": "^6.22.0" + "babel-helper-builder-binary-assignment-operator-visitor": "^6.22.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-export-extensions/package.json b/packages/babel-plugin-transform-export-extensions/package.json index d46c645073..535387da3f 100644 --- a/packages/babel-plugin-transform-export-extensions/package.json +++ b/packages/babel-plugin-transform-export-extensions/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-export-extensions": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-export-extensions": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index b6cc439158..1d717b8385 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-plugin-syntax-flow": "^6.8.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index 58647d4487..3c0fd61d27 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-plugin-syntax-flow": "^6.18.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-function-bind/package.json b/packages/babel-plugin-transform-function-bind/package.json index 1aa3363dc9..be80fbc653 100644 --- a/packages/babel-plugin-transform-function-bind/package.json +++ b/packages/babel-plugin-transform-function-bind/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-function-bind": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-function-bind": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 5b6d73e62b..5302d018e1 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index c024adffff..d365679451 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -9,9 +9,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-object-rest-spread/package.json b/packages/babel-plugin-transform-object-rest-spread/package.json index 9052c3e695..b3686266c1 100644 --- a/packages/babel-plugin-transform-object-rest-spread/package.json +++ b/packages/babel-plugin-transform-object-rest-spread/package.json @@ -9,8 +9,7 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-object-rest-spread": "^6.8.0", - "babel-runtime": "^6.22.0" + "babel-plugin-syntax-object-rest-spread": "^6.8.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index a78df644be..c2c8ceb1ce 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index e26181cc7b..b0eb2e46e1 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "lodash": "^4.2.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index fe30acd07f..79d30ac762 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index e08f45f41b..1bb155829a 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index 7b853f1a64..87231cf7f1 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-helper-builder-react-jsx": "^6.22.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index 45f1018b3f..1f26df5265 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index e7e5c87747..150b203d7b 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 0b242a701e..1f60338023 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-helper-builder-react-jsx": "^6.22.0", "babel-plugin-syntax-jsx": "^6.8.0" }, diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index 9f01577ebd..4caf8e6951 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -8,9 +8,6 @@ "keywords": [ "babel-plugin" ], - "dependencies": { - "babel-runtime": "^6.22.0" - }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index c006ccf966..8a2177f347 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0" }, "devDependencies": { diff --git a/packages/babel-plugin-undeclared-variables-check/package.json b/packages/babel-plugin-undeclared-variables-check/package.json index 36566b54bc..71ae4c595b 100644 --- a/packages/babel-plugin-undeclared-variables-check/package.json +++ b/packages/babel-plugin-undeclared-variables-check/package.json @@ -9,7 +9,6 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0", "leven": "^1.0.2" }, "devDependencies": { diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 5e74561a7a..77a62a8485 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -9,7 +9,6 @@ "main": "lib/index.js", "dependencies": { "core-js": "^2.4.0", - "babel-runtime": "^6.22.0", "regenerator-runtime": "^0.10.0" } } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 1d5554dafc..600bd1f920 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -9,7 +9,6 @@ "browser": "lib/browser.js", "dependencies": { "babel-core": "^6.22.0", - "babel-runtime": "^6.22.0", "core-js": "^2.4.0", "home-or-tmp": "^3.0.0", "lodash": "^4.2.0", diff --git a/packages/babel-runtime/scripts/build-dist.js b/packages/babel-runtime/scripts/build-dist.js index 1d1e6c58ad..050aa73b21 100644 --- a/packages/babel-runtime/scripts/build-dist.js +++ b/packages/babel-runtime/scripts/build-dist.js @@ -32,16 +32,6 @@ function relative(filename) { return __dirname + "/../" + filename; } -function readFile(filename, shouldDefaultify) { - var file = fs.readFileSync(require.resolve(filename), "utf8"); - - if (shouldDefaultify) { - file += "\n" + defaultify("module.exports") + "\n"; - } - - return file; -} - function defaultify(name) { return 'module.exports = { "default": ' + name + ', __esModule: true };'; } @@ -63,15 +53,15 @@ var transformOpts = { plugins: [ require("../../babel-plugin-transform-runtime"), - [require("../../babel-plugin-transform-es2015-modules-commonjs"), {loose: true, strict: false}] + [require("../../babel-plugin-transform-es2015-modules-commonjs"), { loose: true, strict: false }] ] }; function buildRuntimeRewritePlugin(relativePath, helperName) { return { - pre: function (file){ + pre: function (file) { var original = file.get("helperGenerator"); - file.set("helperGenerator", function(name){ + file.set("helperGenerator", function(name) { // make sure that helpers won't insert circular references to themselves if (name === helperName) return; @@ -92,13 +82,6 @@ function buildRuntimeRewritePlugin(relativePath, helperName) { }; } -function selfContainify(path, code) { - return babel.transform(code, { - presets: transformOpts.presets, - plugins: transformOpts.plugins.concat([buildRuntimeRewritePlugin(path, null)]) - }).code; -} - function buildHelper(helperName) { var tree = t.program([ t.exportDefaultDeclaration(helpers.get(helperName)) diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 956384f9ee..8c36f1655b 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -11,7 +11,6 @@ "babylon": "^6.11.0", "babel-traverse": "^6.22.0", "babel-types": "^6.22.0", - "babel-runtime": "^6.22.0", "lodash": "^4.2.0" } } diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 8066c617a8..51dff4bfd7 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -10,7 +10,6 @@ "dependencies": { "babel-code-frame": "^6.22.0", "babel-messages": "^6.22.0", - "babel-runtime": "^6.22.0", "babel-types": "^6.22.0", "babylon": "^6.15.0", "debug": "^2.2.0", diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 0f8cb8565d..57c4bc762a 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -8,7 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-types", "main": "lib/index.js", "dependencies": { - "babel-runtime": "^6.22.0", "esutils": "^2.0.2", "lodash": "^4.2.0", "to-fast-properties": "^1.0.1" From e530e3c02530c1db582b704cab0a60eb1fbe6a88 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 28 Jan 2017 08:35:21 -0600 Subject: [PATCH 113/222] [7.0] List babylon plugins instead of * in babel-generator tests (#5231) --- packages/babel-generator/test/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 6abefd9ccd..d15e53807a 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -306,7 +306,19 @@ suites.forEach(function (testSuite) { if (actualCode) { const actualAst = parse(actualCode, { filename: actual.loc, - plugins: ["*"], + plugins: [ + "asyncGenerators", + "classProperties", + "decorators", + "doExpressions", + "dynamicImport", + "exportExtensions", + "flow", + "functionBind", + "functionSent", + "jsx", + "objectRestSpread", + ], strictMode: false, sourceType: "module", }); From d4790888a329d39f91e1cd76619f358e35987bf1 Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Sat, 28 Jan 2017 12:51:37 -0500 Subject: [PATCH 114/222] Limit export node default assignment stack size #4323 Signed-off-by: Matthew Stewart --- .../src/index.js | 25 ++-- .../fixtures/interop/export-from-8/actual.js | 2 + .../interop/export-from-8/expected.js | 111 ++++++++++++++++++ 3 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/expected.js diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 1b491ea723..9c0ef6b69b 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -426,16 +426,25 @@ export default function () { } if (hasImports && Object.keys(nonHoistedExportNames).length) { - let hoistedExportsNode = t.identifier("undefined"); - for (const name in nonHoistedExportNames) { - hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; + // avoid creating too long of export assignment to prevent stack overflow + const maxHoistedExportsNodeAssignmentLength = 100; + const nonHoistedExportNamesArr = Object.keys(nonHoistedExportNames); + + for (let currentExportsNodeAssignmentLength = 0; currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength ) { + const nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice(currentExportsNodeAssignmentLength, currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength); + + let hoistedExportsNode = t.identifier("undefined"); + + nonHoistedExportNamesChunk.forEach(function (name) { + hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; + }); + + const node = t.expressionStatement(hoistedExportsNode); + node._blockHoist = 3; + + topNodes.unshift(node); } - - const node = t.expressionStatement(hoistedExportsNode); - node._blockHoist = 3; - - topNodes.unshift(node); } // add __esModule declaration if this file has any exports diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/actual.js new file mode 100644 index 0000000000..b42963fe70 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/actual.js @@ -0,0 +1,2 @@ +import { foo, foo1, foo2, foo3, foo4, foo5, foo6, foo7, foo8, foo9, foo10, foo11, foo12, foo13, foo14, foo15, foo16, foo17, foo18, foo19, foo20, foo21, foo22, foo23, foo24, foo25, foo26, foo27, foo28, foo29, foo30, foo31, foo32, foo33, foo34, foo35, foo36, foo37, foo38, foo39, foo40, foo41, foo42, foo43, foo44, foo45, foo46, foo47, foo48, foo49, foo50, foo51, foo52, foo53, foo54, foo55, foo56, foo57, foo58, foo59, foo60, foo61, foo62, foo63, foo64, foo65, foo66, foo67, foo68, foo69, foo70, foo71, foo72, foo73, foo74, foo75, foo76, foo77, foo78, foo79, foo80, foo81, foo82, foo83, foo84, foo85, foo86, foo87, foo88, foo89, foo90, foo91, foo92, foo93, foo94, foo95, foo96, foo97, foo98, foo99, foo100 } from "foo"; +export { foo, foo1, foo2, foo3, foo4, foo5, foo6, foo7, foo8, foo9, foo10, foo11, foo12, foo13, foo14, foo15, foo16, foo17, foo18, foo19, foo20, foo21, foo22, foo23, foo24, foo25, foo26, foo27, foo28, foo29, foo30, foo31, foo32, foo33, foo34, foo35, foo36, foo37, foo38, foo39, foo40, foo41, foo42, foo43, foo44, foo45, foo46, foo47, foo48, foo49, foo50, foo51, foo52, foo53, foo54, foo55, foo56, foo57, foo58, foo59, foo60, foo61, foo62, foo63, foo64, foo65, foo66, foo67, foo68, foo69, foo70, foo71, foo72, foo73, foo74, foo75, foo76, foo77, foo78, foo79, foo80, foo81, foo82, foo83, foo84, foo85, foo86, foo87, foo88, foo89, foo90, foo91, foo92, foo93, foo94, foo95, foo96, foo97, foo98, foo99, foo100 } \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/expected.js new file mode 100644 index 0000000000..5f034e9682 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-from-8/expected.js @@ -0,0 +1,111 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.foo100 = undefined; +exports.foo99 = exports.foo98 = exports.foo97 = exports.foo96 = exports.foo95 = exports.foo94 = exports.foo93 = exports.foo92 = exports.foo91 = exports.foo90 = exports.foo89 = exports.foo88 = exports.foo87 = exports.foo86 = exports.foo85 = exports.foo84 = exports.foo83 = exports.foo82 = exports.foo81 = exports.foo80 = exports.foo79 = exports.foo78 = exports.foo77 = exports.foo76 = exports.foo75 = exports.foo74 = exports.foo73 = exports.foo72 = exports.foo71 = exports.foo70 = exports.foo69 = exports.foo68 = exports.foo67 = exports.foo66 = exports.foo65 = exports.foo64 = exports.foo63 = exports.foo62 = exports.foo61 = exports.foo60 = exports.foo59 = exports.foo58 = exports.foo57 = exports.foo56 = exports.foo55 = exports.foo54 = exports.foo53 = exports.foo52 = exports.foo51 = exports.foo50 = exports.foo49 = exports.foo48 = exports.foo47 = exports.foo46 = exports.foo45 = exports.foo44 = exports.foo43 = exports.foo42 = exports.foo41 = exports.foo40 = exports.foo39 = exports.foo38 = exports.foo37 = exports.foo36 = exports.foo35 = exports.foo34 = exports.foo33 = exports.foo32 = exports.foo31 = exports.foo30 = exports.foo29 = exports.foo28 = exports.foo27 = exports.foo26 = exports.foo25 = exports.foo24 = exports.foo23 = exports.foo22 = exports.foo21 = exports.foo20 = exports.foo19 = exports.foo18 = exports.foo17 = exports.foo16 = exports.foo15 = exports.foo14 = exports.foo13 = exports.foo12 = exports.foo11 = exports.foo10 = exports.foo9 = exports.foo8 = exports.foo7 = exports.foo6 = exports.foo5 = exports.foo4 = exports.foo3 = exports.foo2 = exports.foo1 = exports.foo = undefined; + +var _foo = require("foo"); + +exports.foo = _foo.foo; +exports.foo1 = _foo.foo1; +exports.foo2 = _foo.foo2; +exports.foo3 = _foo.foo3; +exports.foo4 = _foo.foo4; +exports.foo5 = _foo.foo5; +exports.foo6 = _foo.foo6; +exports.foo7 = _foo.foo7; +exports.foo8 = _foo.foo8; +exports.foo9 = _foo.foo9; +exports.foo10 = _foo.foo10; +exports.foo11 = _foo.foo11; +exports.foo12 = _foo.foo12; +exports.foo13 = _foo.foo13; +exports.foo14 = _foo.foo14; +exports.foo15 = _foo.foo15; +exports.foo16 = _foo.foo16; +exports.foo17 = _foo.foo17; +exports.foo18 = _foo.foo18; +exports.foo19 = _foo.foo19; +exports.foo20 = _foo.foo20; +exports.foo21 = _foo.foo21; +exports.foo22 = _foo.foo22; +exports.foo23 = _foo.foo23; +exports.foo24 = _foo.foo24; +exports.foo25 = _foo.foo25; +exports.foo26 = _foo.foo26; +exports.foo27 = _foo.foo27; +exports.foo28 = _foo.foo28; +exports.foo29 = _foo.foo29; +exports.foo30 = _foo.foo30; +exports.foo31 = _foo.foo31; +exports.foo32 = _foo.foo32; +exports.foo33 = _foo.foo33; +exports.foo34 = _foo.foo34; +exports.foo35 = _foo.foo35; +exports.foo36 = _foo.foo36; +exports.foo37 = _foo.foo37; +exports.foo38 = _foo.foo38; +exports.foo39 = _foo.foo39; +exports.foo40 = _foo.foo40; +exports.foo41 = _foo.foo41; +exports.foo42 = _foo.foo42; +exports.foo43 = _foo.foo43; +exports.foo44 = _foo.foo44; +exports.foo45 = _foo.foo45; +exports.foo46 = _foo.foo46; +exports.foo47 = _foo.foo47; +exports.foo48 = _foo.foo48; +exports.foo49 = _foo.foo49; +exports.foo50 = _foo.foo50; +exports.foo51 = _foo.foo51; +exports.foo52 = _foo.foo52; +exports.foo53 = _foo.foo53; +exports.foo54 = _foo.foo54; +exports.foo55 = _foo.foo55; +exports.foo56 = _foo.foo56; +exports.foo57 = _foo.foo57; +exports.foo58 = _foo.foo58; +exports.foo59 = _foo.foo59; +exports.foo60 = _foo.foo60; +exports.foo61 = _foo.foo61; +exports.foo62 = _foo.foo62; +exports.foo63 = _foo.foo63; +exports.foo64 = _foo.foo64; +exports.foo65 = _foo.foo65; +exports.foo66 = _foo.foo66; +exports.foo67 = _foo.foo67; +exports.foo68 = _foo.foo68; +exports.foo69 = _foo.foo69; +exports.foo70 = _foo.foo70; +exports.foo71 = _foo.foo71; +exports.foo72 = _foo.foo72; +exports.foo73 = _foo.foo73; +exports.foo74 = _foo.foo74; +exports.foo75 = _foo.foo75; +exports.foo76 = _foo.foo76; +exports.foo77 = _foo.foo77; +exports.foo78 = _foo.foo78; +exports.foo79 = _foo.foo79; +exports.foo80 = _foo.foo80; +exports.foo81 = _foo.foo81; +exports.foo82 = _foo.foo82; +exports.foo83 = _foo.foo83; +exports.foo84 = _foo.foo84; +exports.foo85 = _foo.foo85; +exports.foo86 = _foo.foo86; +exports.foo87 = _foo.foo87; +exports.foo88 = _foo.foo88; +exports.foo89 = _foo.foo89; +exports.foo90 = _foo.foo90; +exports.foo91 = _foo.foo91; +exports.foo92 = _foo.foo92; +exports.foo93 = _foo.foo93; +exports.foo94 = _foo.foo94; +exports.foo95 = _foo.foo95; +exports.foo96 = _foo.foo96; +exports.foo97 = _foo.foo97; +exports.foo98 = _foo.foo98; +exports.foo99 = _foo.foo99; +exports.foo100 = _foo.foo100; \ No newline at end of file From 2104ab6c44e807e50a799f010ba3e896f0c2e54d Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Mon, 30 Jan 2017 12:28:53 -0500 Subject: [PATCH 115/222] Add our business model [skip ci] (#5242) - don't need to run tests for this one --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index dca5d6b564..7987b5b840 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@

+ Business Strategy Status Travis Status CircleCI Status Coverage Status From 160bd3924bcd36a714f70f57ceaf5959d7ccdb49 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 31 Jan 2017 07:46:01 -0600 Subject: [PATCH 116/222] Normalize options sections in docs [skip ci] (#5244) --- packages/babel-code-frame/README.md | 29 +++++++++--- packages/babel-core/README.md | 1 + .../README.md | 6 ++- .../README.md | 8 +++- .../README.md | 6 ++- .../README.md | 6 ++- .../README.md | 6 ++- .../README.md | 7 ++- .../README.md | 16 +++++-- packages/babel-preset-es2015/README.md | 44 ++++++++----------- packages/babel-preset-latest/README.md | 26 ++++++++--- 11 files changed, 108 insertions(+), 47 deletions(-) diff --git a/packages/babel-code-frame/README.md b/packages/babel-code-frame/README.md index 0257a2da1f..7ef5368d31 100644 --- a/packages/babel-code-frame/README.md +++ b/packages/babel-code-frame/README.md @@ -35,9 +35,26 @@ If the column number is not known, you may pass `null` instead. ## Options -name | type | default | description ------------------------|----------|-----------------|------------------------------------------------------ -highlightCode | boolean | `false` | Syntax highlight the code as JavaScript for terminals -linesAbove | number | 2 | The number of lines to show above the error -linesBelow | number | 3 | The number of lines to show below the error -forceColor | boolean | `false` | Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode +### `highlightCode` + +`boolean`, defaults to `false`. + +Toggles syntax highlighting the code as JavaScript for terminals. + +### `linesAbove` + +`number`, defaults to `2`. + +Adjust the number of lines to show above the error. + +### `linesBelow` + +`number`, defaults to `3`. + +Adjust the number of lines to show below the error. + +### `forceColor` + +`boolean`, defaults to `false`. + +Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`. diff --git a/packages/babel-core/README.md b/packages/babel-core/README.md index c4b0f93016..5b2f4d53d1 100644 --- a/packages/babel-core/README.md +++ b/packages/babel-core/README.md @@ -117,4 +117,5 @@ Following is a table of the options you can use: | `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option. | | `sourceMapTarget` | `(filenameRelative)` | Set `file` on returned source map. | | `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. | +| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be either "script" or "module". | | `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`. diff --git a/packages/babel-plugin-transform-class-properties/README.md b/packages/babel-plugin-transform-class-properties/README.md index df28bcab6d..49f48223e4 100644 --- a/packages/babel-plugin-transform-class-properties/README.md +++ b/packages/babel-plugin-transform-class-properties/README.md @@ -76,7 +76,11 @@ require("babel-core").transform("code", { ## Options -* `spec` - Class properties are compiled to use `Object.defineProperty. Static fields are now defined even if they are not initialized +### `spec` + +`boolean`, defaults to `false`. + +Class properties are compiled to use `Object.defineProperty`. Static fields are now defined even if they are not initialized. ## References diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/README.md b/packages/babel-plugin-transform-es2015-arrow-functions/README.md index 862a6b878d..658f413f6c 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/README.md +++ b/packages/babel-plugin-transform-es2015-arrow-functions/README.md @@ -73,7 +73,7 @@ Without options: With options: -```json +```json { "plugins": [ ["transform-es2015-arrow-functions", { "spec": true }] @@ -97,4 +97,8 @@ require("babel-core").transform("code", { ## Options -* `spec` - This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated. +### `spec` + +`boolean`, defaults to `false`. + +This option wraps the generated function in `.bind(this)` and keeps uses of `this` inside the function as-is, instead of using a renamed `this`. It also adds a runtime check to ensure the functions are not instantiated. diff --git a/packages/babel-plugin-transform-es2015-classes/README.md b/packages/babel-plugin-transform-es2015-classes/README.md index e115f62cfa..c189adf3f5 100644 --- a/packages/babel-plugin-transform-es2015-classes/README.md +++ b/packages/babel-plugin-transform-es2015-classes/README.md @@ -50,7 +50,11 @@ require("babel-core").transform("code", { }); ``` -## Options `loose` +## Options + +### `loose` + +`boolean`, defaults to `false`. #### Method enumerability diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/README.md b/packages/babel-plugin-transform-es2015-modules-commonjs/README.md index 0693b91f07..3a802ab571 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/README.md +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/README.md @@ -62,7 +62,11 @@ require("babel-core").transform("code", { }); ``` -## Options `loose` +## Options + +### `loose` + +`boolean`, defaults to `false`. As per the spec, `import` and `export` are only allowed to be used at the top level. When in loose mode these are allowed to be used anywhere. diff --git a/packages/babel-plugin-transform-es2015-spread/README.md b/packages/babel-plugin-transform-es2015-spread/README.md index 4a3f66b6cb..0ba50ddc03 100644 --- a/packages/babel-plugin-transform-es2015-spread/README.md +++ b/packages/babel-plugin-transform-es2015-spread/README.md @@ -80,4 +80,8 @@ require("babel-core").transform("code", { ## Options -* `loose` - All iterables are assumed to be arrays. +### `loose` + +`boolean`, defaults to `false`. + +In loose mode, **all** iterables are assumed to be arrays. diff --git a/packages/babel-plugin-transform-es2015-template-literals/README.md b/packages/babel-plugin-transform-es2015-template-literals/README.md index 854bc74be6..fd0f57bf18 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/README.md +++ b/packages/babel-plugin-transform-es2015-template-literals/README.md @@ -62,10 +62,15 @@ require("babel-core").transform("code", { ## Options ### `loose` + +`boolean`, defaults to `false`. + In loose mode, tagged template literal objects aren't frozen. - ### `spec` + +`boolean`, defaults to `false`. + This option wraps all template literal expressions with `String`. See [babel/babel#1065](https://github.com/babel/babel/issues/1065) for more info. **In** diff --git a/packages/babel-plugin-transform-react-jsx/README.md b/packages/babel-plugin-transform-react-jsx/README.md index 4a7c3ae0fb..44a20066dd 100644 --- a/packages/babel-plugin-transform-react-jsx/README.md +++ b/packages/babel-plugin-transform-react-jsx/README.md @@ -95,6 +95,16 @@ require("babel-core").transform("code", { ## Options -* `pragma` - Replace the function used when compiling JSX expressions (Defaults to `React.createElement`). - - Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12 -* `useBuiltIns` - When spreading props, use Object.assign instead of Babel's extend helper (Disabled by default). +### `pragma` + +`string`, defaults to `React.createElement`. + +Replace the function used when compiling JSX expressions. + +Note that the `@jsx React.DOM` pragma has been deprecated as of React v0.12 + +### `useBuiltIns` + +`boolean`, defaults to `false`. + +When spreading props, use `Object.assign` directly instead of Babel's extend helper. diff --git a/packages/babel-preset-es2015/README.md b/packages/babel-preset-es2015/README.md index dacd924c73..77340ab708 100644 --- a/packages/babel-preset-es2015/README.md +++ b/packages/babel-preset-es2015/README.md @@ -36,30 +36,22 @@ require("babel-core").transform("code", { ## Options -* `loose` - Enable "loose" transformations for any plugins in this preset that allow them (Disabled by default). -* `modules` - Enable transformation of ES6 module syntax to another module type (Enabled by default to `"commonjs"`). - * Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "commonjs"]` -* `spec` - Enable "spec" transformations for any plugins in this preset that allow them (Disabled by default) +### `loose` -```js -{ - presets: [ - ["es2015", { "loose": true }] - ] -} -{ - presets: [ - ["es2015", { "modules": false }] - ] -} -{ - presets: [ - ["es2015", { "loose": true, "modules": false }] - ] -} -{ - presets: [ - ["es2015", { "spec": true }] - ] -} -``` +`boolean`, defaults to `false`. + +Enable "loose" transformations for any plugins in this preset that allow them. + +### `modules` + +`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`. + +Enable transformation of ES6 module syntax to another module type. + +Setting this to `false` will not transform modules. + +### `spec` + +`boolean`, defaults to `false`. + +Enable "spec" transformations for any plugins in this preset that allow them. diff --git a/packages/babel-preset-latest/README.md b/packages/babel-preset-latest/README.md index f46761d1aa..056d95645d 100644 --- a/packages/babel-preset-latest/README.md +++ b/packages/babel-preset-latest/README.md @@ -36,15 +36,17 @@ require("babel-core").transform("code", { ### Options -- `es2015`: Optionally not run any plugins from this preset (defaults to true) -- `es2016`: Optionally not run any plugins from this preset (defaults to true) -- `es2017`: Optionally not run any plugins from this preset (defaults to true) +### `es2015` + +`boolean`, defaults to `true`. + +Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugins/preset-es2015/). ```js { "presets": [ ["latest", { - "es2015": false // defaults to true + "es2015": false }] ] } @@ -57,9 +59,23 @@ You can also pass options down to the `es2015` preset. "presets": [ ["latest", { "es2015": { - "modules": false + "modules": false } }] ] } ``` + +**Note:** This also works for the other preset-year options below. + +### `es2016` + +`boolean`, defaults to `true`. + +Toggles including plugins from the [es2016 preset](https://babeljs.io/docs/plugins/preset-es2016/). + +### `es2017` + +`boolean`, defaults to `true`. + +Toggles including plugins from the [es2017 preset](https://babeljs.io/docs/plugins/preset-es2017/). From 283d9cbb9ef6d5899ea6ba82e1f097e2db488b71 Mon Sep 17 00:00:00 2001 From: StyMaar Date: Tue, 31 Jan 2017 15:27:07 +0100 Subject: [PATCH 117/222] Fix broken repository link in package.json (#5248) [skip ci] --- packages/babel-plugin-transform-react-display-name/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index e08f45f41b..150a8e3f2f 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -2,7 +2,7 @@ "name": "babel-plugin-transform-react-display-name", "version": "6.22.0", "description": "Add displayName to React.createClass calls", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-display-name", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name", "license": "MIT", "main": "lib/index.js", "keywords": [ From ba0df23365f48cea8d0484c08decd1aca2b0b743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20=C5=9Awi=C4=99cicki?= Date: Tue, 31 Jan 2017 21:03:51 +0100 Subject: [PATCH 118/222] [7.0] Remove quotes option (#5154) * remove mention of 'quotes' option from README.md * always infer quotes option's value --- packages/babel-generator/README.md | 1 - packages/babel-generator/src/index.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/babel-generator/README.md b/packages/babel-generator/README.md index e3882c9af2..b71ee3c14f 100644 --- a/packages/babel-generator/README.md +++ b/packages/babel-generator/README.md @@ -35,7 +35,6 @@ comments | boolean | `true` | Should comments be include compact | boolean or `'auto'` | `opts.minified` | Set to `true` to avoid adding whitespace for formatting minified | boolean | `false` | Should the output be minified concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`) -quotes | `'single'` or `'double'` | autodetect based on `ast.tokens` | The type of quote to use in the output filename | string | | Used in warning messages jsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with "json": true to print "\u00A9" vs. "©"; Options for source maps: diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index fce0c97a03..f48e7e83d3 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -58,7 +58,7 @@ function normalizeOptions(code, opts, tokens): Format { compact: opts.compact, minified: opts.minified, concise: opts.concise, - quotes: opts.quotes || findCommonStringDelimiter(code, tokens), + quotes: findCommonStringDelimiter(code, tokens), jsonCompatibleStrings: opts.jsonCompatibleStrings, indent: { adjustMultilineComment: true, From 4d411ef83eee10b81c8b82772496bfb45537876a Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 3 Feb 2017 14:52:29 -0800 Subject: [PATCH 119/222] Add a sublime project [skip ci] (#5264) --- .gitignore | 1 + babel.sublime-project | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 babel.sublime-project diff --git a/.gitignore b/.gitignore index 7e25e4ad05..1b6989d7b1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ dist _babel.github.io /tests/.browser-build.js .nyc_output +/babel.sublime-workspace diff --git a/babel.sublime-project b/babel.sublime-project new file mode 100644 index 0000000000..8fc404b28a --- /dev/null +++ b/babel.sublime-project @@ -0,0 +1,25 @@ +{ + "settings": { + "rulers": [ + 100 + ], + + // Set to false to disable detection of tabs vs. spaces on load + "detect_indentation": false, + + "translate_tabs_to_spaces": true, + + "tab_size": 2 + }, + + "folders": [{ + "path": ".", + "folder_exclude_patterns": [ + "packages/*/lib", + "node_modules" + ], + "file_exclude_patterns": [ + + ] + }] +} From b845f2b69dc2f9548caaf58bd9396da2feb144cc Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sat, 4 Feb 2017 08:07:15 -0800 Subject: [PATCH 120/222] Re-enable the max-len ESLint rule. (#5265) --- .eslintrc | 1 - .gitignore | 1 + babel.sublime-project | 2 +- packages/babel-cli/src/babel-node.js | 2 - packages/babel-cli/src/babel/index.js | 5 +- packages/babel-cli/test/index.js | 6 ++- packages/babel-code-frame/test/index.js | 12 +++-- .../src/tools/build-external-helpers.js | 8 ++-- .../src/transformation/file/index.js | 19 ++++---- .../src/transformation/file/options/config.js | 2 +- .../file/options/option-manager.js | 7 +-- .../transformation/file/options/removed.js | 2 +- .../babel-core/src/transformation/plugin.js | 5 +- packages/babel-core/test/api.js | 8 +++- packages/babel-core/test/option-manager.js | 2 + .../src/generators/expressions.js | 2 - .../babel-generator/src/generators/flow.js | 2 - .../babel-generator/src/generators/methods.js | 3 +- .../babel-generator/src/generators/types.js | 6 +-- packages/babel-generator/src/printer.js | 3 +- packages/babel-generator/test/index.js | 5 +- .../src/index.js | 3 +- packages/babel-helper-define-map/src/index.js | 8 ++-- .../babel-helper-function-name/src/index.js | 5 +- .../src/index.js | 5 +- .../babel-helper-replace-supers/src/index.js | 26 ++++++---- .../src/index.js | 11 +++-- packages/babel-helpers/src/helpers.js | 2 +- packages/babel-helpers/src/index.js | 4 +- packages/babel-messages/src/index.js | 2 +- .../src/index.js | 10 ++-- .../src/index.js | 8 ++-- .../src/vanilla.js | 47 +++++++++++++------ .../src/index.js | 16 ++++--- .../src/index.js | 7 +-- .../src/index.js | 34 ++++++++++---- .../src/index.js | 17 ++++--- .../src/index.js | 2 - .../src/default.js | 2 - .../src/rest.js | 2 - .../src/index.js | 15 ++++-- .../src/index.js | 12 +++-- .../src/index.js | 5 +- .../src/index.js | 5 +- packages/babel-polyfill/src/index.js | 3 +- packages/babel-template/src/index.js | 5 +- packages/babel-traverse/src/index.js | 18 +++++-- .../babel-traverse/src/path/evaluation.js | 18 +++---- packages/babel-traverse/src/path/index.js | 2 - .../babel-traverse/src/path/lib/hoister.js | 3 +- .../src/path/lib/removal-hooks.js | 37 ++++++++------- .../babel-traverse/src/path/modification.js | 20 +++++--- .../babel-traverse/src/path/replacement.js | 17 +++++-- packages/babel-traverse/src/scope/index.js | 14 ++---- packages/babel-traverse/test/evaluation.js | 9 ++-- packages/babel-traverse/test/inference.js | 6 ++- packages/babel-traverse/test/scope.js | 21 ++++++--- packages/babel-traverse/test/traverse.js | 3 +- packages/babel-types/src/constants.js | 2 +- packages/babel-types/src/definitions/core.js | 2 +- .../babel-types/src/definitions/es2015.js | 2 +- packages/babel-types/src/validators.js | 4 +- packages/babel-types/test/converters.js | 3 +- 63 files changed, 317 insertions(+), 223 deletions(-) diff --git a/.eslintrc b/.eslintrc index 00dd6a98ad..02f7711758 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,7 +1,6 @@ { "extends": "babel", "rules": { - "max-len": 0 }, "env": { "node": true, diff --git a/.gitignore b/.gitignore index 1b6989d7b1..702ae50d45 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules test/tmp *.log *.cache +/.eslintcache /templates.json /tests.json /browser.js diff --git a/babel.sublime-project b/babel.sublime-project index 8fc404b28a..1f18a8cc50 100644 --- a/babel.sublime-project +++ b/babel.sublime-project @@ -1,7 +1,7 @@ { "settings": { "rulers": [ - 100 + 110 ], // Set to false to disable detection of tabs vs. spaces on load diff --git a/packages/babel-cli/src/babel-node.js b/packages/babel-cli/src/babel-node.js index e3d0c2e901..ee25b5f48a 100755 --- a/packages/babel-cli/src/babel-node.js +++ b/packages/babel-cli/src/babel-node.js @@ -1,5 +1,3 @@ -/* eslint indent: 0 */ - /** * This tiny wrapper file checks for known node flags and appends them * when found, before invoking the "real" _babel-node(1) executable. diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 3f7f143987..194254bf61 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -1,7 +1,4 @@ #!/usr/bin/env node -/* eslint max-len: 0 */ - -require("babel-core"); const fs = require("fs"); const commander = require("commander"); @@ -38,6 +35,7 @@ Object.keys(options).forEach(function (key) { commander.option(arg, desc.join(" ")); }); +/* eslint-disable max-len */ commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx]"); commander.option("-w, --watch", "Recompile files on changes"); commander.option("--skip-initial-build", "Do not compile files before watching"); @@ -45,6 +43,7 @@ commander.option("-o, --out-file [out]", "Compile all input files into a single commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory"); commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files"); commander.option("-q, --quiet", "Don't log anything"); +/* eslint-enable max-len */ const pkg = require("../../package.json"); commander.version(pkg.version + " (babel-core " + require("babel-core").version + ")"); diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 1655a4e79b..9da8405733 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -46,7 +46,8 @@ const assertTest = function (stdout, stderr, opts) { if (opts.stderr) { if (opts.stderrContains) { - assert.ok(includes(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + " didn't contain " + JSON.stringify(expectStderr)); + assert.ok(includes(stderr, expectStderr), "stderr " + JSON.stringify(stderr) + + " didn't contain " + JSON.stringify(expectStderr)); } else { chai.expect(stderr).to.equal(expectStderr, "stderr didn't match"); } @@ -60,7 +61,8 @@ const assertTest = function (stdout, stderr, opts) { if (opts.stdout) { if (opts.stdoutContains) { - assert.ok(includes(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + " didn't contain " + JSON.stringify(expectStdout)); + assert.ok(includes(stdout, expectStdout), "stdout " + JSON.stringify(stdout) + + " didn't contain " + JSON.stringify(expectStdout)); } else { chai.expect(stdout).to.equal(expectStdout, "stdout didn't match"); } diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index b6906100ee..f91727cb24 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -197,10 +197,12 @@ describe("babel-code-frame", function () { "", "" ].join("\n"); - assert.equal(codeFrame(rawLines, 3, null, { linesAbove: 1, linesBelow: 1, forceColor: true }), chalk.reset([ - " " + gutter(" 2 | "), - marker(">") + gutter(" 3 | "), - " " + gutter(" 4 | ") - ].join("\n"))); + assert.equal(codeFrame(rawLines, 3, null, { linesAbove: 1, linesBelow: 1, forceColor: true }), + chalk.reset([ + " " + gutter(" 2 | "), + marker(">") + gutter(" 3 | "), + " " + gutter(" 4 | ") + ].join("\n")) + ); }); }); diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index b97d25c2d1..8eb206f5ff 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import * as helpers from "babel-helpers"; import generator from "babel-generator"; import * as messages from "babel-messages"; @@ -23,12 +21,14 @@ const buildUmdWrapper = template(` function buildGlobal(namespace, builder) { const body = []; const container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); - const tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); + const tree = t.program([ + t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); body.push(t.variableDeclaration("var", [ t.variableDeclarator( namespace, - t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])) + t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), + t.objectExpression([])) ) ])); diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index a013eb5d6a..50b641c194 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -1,5 +1,4 @@ /* global BabelFileResult, BabelParserOptions, BabelFileMetadata */ -/* eslint max-len: 0 */ import getHelper from "babel-helpers"; import * as metadataVisitor from "./metadata"; @@ -339,7 +338,7 @@ export default class File extends Store { this.scope.push({ id: uid, init: init, - _blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers + _blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers }); return uid; } @@ -378,8 +377,8 @@ export default class File extends Store { sourceRoot: inputMapConsumer.sourceRoot }); - // This assumes the output map always has a single source, since Babel always compiles a single source file to a - // single output file. + // This assumes the output map always has a single source, since Babel always compiles a + // single source file to a single output file. const source = outputMapConsumer.sources[0]; inputMapConsumer.eachMapping(function (mapping) { @@ -424,7 +423,8 @@ export default class File extends Store { if (parser) { parseCode = require(parser).parse; } else { - throw new Error(`Couldn't find parser ${parserOpts.parser} with "parse" method relative to directory ${dirname}`); + throw new Error(`Couldn't find parser ${parserOpts.parser} with "parse" method ` + + `relative to directory ${dirname}`); } } else { parseCode = parserOpts.parser; @@ -472,7 +472,8 @@ export default class File extends Store { this.log.debug("Start transform traverse"); // merge all plugin visitors into a single visitor - const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod); + const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, + this.opts.wrapPluginVisitorMethod); traverse(this.ast, visitor, this.scope); this.log.debug("End transform traverse"); @@ -610,14 +611,16 @@ export default class File extends Store { if (generator) { gen = require(generator).print; } else { - throw new Error(`Couldn't find generator ${gen} with "print" method relative to directory ${dirname}`); + throw new Error(`Couldn't find generator ${gen} with "print" method relative ` + + `to directory ${dirname}`); } } } this.log.debug("Generation start"); - const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, this.code); + const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, + this.code); result.code = _result.code; result.map = _result.map; diff --git a/packages/babel-core/src/transformation/file/options/config.js b/packages/babel-core/src/transformation/file/options/config.js index 7b11963f38..dbc60c6043 100644 --- a/packages/babel-core/src/transformation/file/options/config.js +++ b/packages/babel-core/src/transformation/file/options/config.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ module.exports = { filename: { diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index c4736355a6..f4b25206bc 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import * as context from "../../../api/node"; import type Logger from "../logger"; import Plugin from "../../plugin"; @@ -180,10 +178,13 @@ export default class OptionManager { // check for an unknown option if (!option && this.log) { if (removed[key]) { - this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, ReferenceError); + this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, + ReferenceError); } else { + /* eslint-disable max-len */ const unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; const presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; + /* eslint-enable max-len */ this.log.error(`${unknownOptErr}\n\n${presetConfigErr}`, ReferenceError); } diff --git a/packages/babel-core/src/transformation/file/options/removed.js b/packages/babel-core/src/transformation/file/options/removed.js index 00a24ea61e..cb0077cb92 100644 --- a/packages/babel-core/src/transformation/file/options/removed.js +++ b/packages/babel-core/src/transformation/file/options/removed.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ module.exports = { "auxiliaryComment": { diff --git a/packages/babel-core/src/transformation/plugin.js b/packages/babel-core/src/transformation/plugin.js index f3461ae9bf..d6c5406574 100644 --- a/packages/babel-core/src/transformation/plugin.js +++ b/packages/babel-core/src/transformation/plugin.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import OptionManager from "./file/options/option-manager"; import * as messages from "babel-messages"; import Store from "../store"; @@ -85,7 +83,8 @@ export default class Plugin extends Store { normaliseVisitor(visitor: Object): Object { for (const key of GLOBAL_VISITOR_PROPS) { if (visitor[key]) { - throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. Please target individual nodes."); + throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + + "Please target individual nodes."); } } diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 6342792020..7236f385a0 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -265,6 +265,7 @@ describe("api", function () { it("source map merging", function () { const result = babel.transform([ + /* eslint-disable max-len */ "function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }", "", "let Foo = function Foo() {", @@ -272,6 +273,7 @@ describe("api", function () { "};", "", "//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZG91dCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUFNLEdBQUcsWUFBSCxHQUFHO3dCQUFILEdBQUciLCJmaWxlIjoidW5kZWZpbmVkIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgRm9vIHt9XG4iXX0=" + /* eslint-enable max-len */ ].join("\n"), { sourceMap: true }); @@ -329,12 +331,14 @@ describe("api", function () { }; }] }).then(function (result) { - assert.equal(result.code, "/*before*/start;\n/*after*/class Foo {}\n/*before*/end;\n/*after*/"); + assert.equal(result.code, + "/*before*/start;\n/*after*/class Foo {}\n/*before*/end;\n/*after*/"); }); }); it("modules metadata", function () { return Promise.all([ + // eslint-disable-next-line max-len transformAsync("import { externalName as localName } from \"external\";").then(function (result) { assert.deepEqual(result.metadata.modules.imports[0], { source: "external", @@ -586,8 +590,10 @@ describe("api", function () { }); it("resolveModuleSource option", function () { + /* eslint-disable max-len */ const actual = "import foo from \"foo-import-default\";\nimport \"foo-import-bare\";\nexport { foo } from \"foo-export-named\";"; const expected = "import foo from \"resolved/foo-import-default\";\nimport \"resolved/foo-import-bare\";\nexport { foo } from \"resolved/foo-export-named\";"; + /* eslint-enable max-len */ return transformAsync(actual, { resolveModuleSource: function (originalSource) { diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 2606a4bca0..2ca432dd20 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -35,6 +35,7 @@ describe("option-manager", () => { "blacklist": true }); }, + // eslint-disable-next-line max-len /Using removed Babel 5 option: base.auxiliaryComment - Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`/ ); }); @@ -59,6 +60,7 @@ describe("option-manager", () => { "presets": [{ option: "value" }] }); }, + // eslint-disable-next-line max-len /Unknown option: foreign.option\.(?:.|\n)+A common cause of this error is the presence of a configuration options object without the corresponding preset name/ ); }); diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index 0cf5f2093e..8ba9491071 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import * as t from "babel-types"; import * as n from "../node"; diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 668ba0e2b3..9f5c6f3623 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - export function AnyTypeAnnotation() { this.word("any"); } diff --git a/packages/babel-generator/src/generators/methods.js b/packages/babel-generator/src/generators/methods.js index 97bbcd3129..2ad6d41ffb 100644 --- a/packages/babel-generator/src/generators/methods.js +++ b/packages/babel-generator/src/generators/methods.js @@ -93,5 +93,6 @@ export function ArrowFunctionExpression(node: Object) { } function hasTypes(node, param) { - return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments; + return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || + param.trailingComments; } diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index fa8498aff7..5fada08e79 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -1,6 +1,3 @@ -/* eslint max-len: 0 */ -/* eslint quotes: 0 */ - import * as t from "babel-types"; import jsesc from "jsesc"; @@ -62,7 +59,8 @@ export function ObjectProperty(node: Object) { this.token("]"); } else { // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});` - if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) { + if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && + node.key.name === node.value.left.name) { this.print(node.value, node); return; } diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index e03298d1f9..6d164fc2fe 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import find from "lodash/find"; import findLast from "lodash/findLast"; import isInteger from "lodash/isInteger"; @@ -321,6 +319,7 @@ export default class Printer { const printMethod = this[node.type]; if (!printMethod) { + // eslint-disable-next-line max-len throw new ReferenceError(`unknown node of type ${JSON.stringify(node.type)} with constructor ${JSON.stringify(node && node.constructor.name)}`); } diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 813bd57f59..2aad5ed984 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -312,7 +312,10 @@ suites.forEach(function (testSuite) { }); const result = generate(actualAst, task.options, actualCode); - if (!expect.code && result.code && fs.statSync(path.dirname(expect.loc)).isDirectory() && !process.env.CI) { + if ( + !expect.code && result.code && fs.statSync(path.dirname(expect.loc)).isDirectory() && + !process.env.CI + ) { console.log(`New test file created: ${expect.loc}`); fs.writeFileSync(expect.loc, result.code); } else { diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 1a0a1ca626..86d66d2b4d 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -128,7 +128,8 @@ export default function (opts) { const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { - throw new Error("transform-react-jsx currently only accepts a boolean option for useBuiltIns (defaults to false)"); + throw new Error("transform-react-jsx currently only accepts a boolean option for " + + "useBuiltIns (defaults to false)"); } function pushProps() { diff --git a/packages/babel-helper-define-map/src/index.js b/packages/babel-helper-define-map/src/index.js index 05fa5ee886..b0c45ab7e1 100644 --- a/packages/babel-helper-define-map/src/index.js +++ b/packages/babel-helper-define-map/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import nameFunction from "babel-helper-function-name"; import has from "lodash/has"; import * as t from "babel-types"; @@ -36,7 +34,8 @@ export function push(mutatorMap: Object, node: Object, kind: string, file, scope if (node.decorators) { const decorators = map.decorators = map.decorators || t.arrayExpression([]); - decorators.elements = decorators.elements.concat(node.decorators.map((dec) => dec.expression).reverse()); + decorators.elements = decorators.elements.concat( + node.decorators.map((dec) => dec.expression).reverse()); } if (map.value || map.initializer) { @@ -63,7 +62,8 @@ export function push(mutatorMap: Object, node: Object, kind: string, file, scope } // infer function name - if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) { + if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && + t.isFunctionExpression(value)) { value = nameFunction({ id: key, node: value, scope }); } diff --git a/packages/babel-helper-function-name/src/index.js b/packages/babel-helper-function-name/src/index.js index 7623bf0a10..1c38e531ab 100644 --- a/packages/babel-helper-function-name/src/index.js +++ b/packages/babel-helper-function-name/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import getFunctionArity from "babel-helper-get-function-arity"; import template from "babel-template"; import * as t from "babel-types"; @@ -131,7 +129,8 @@ export default function ({ node, parent, scope, id }) { // has an `id` so we don't need to infer one if (node.id) return; - if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key))) { + if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && + (!parent.computed || t.isLiteral(parent.key))) { // { foo() {} }; id = parent.key; } else if (t.isVariableDeclarator(parent)) { diff --git a/packages/babel-helper-optimise-call-expression/src/index.js b/packages/babel-helper-optimise-call-expression/src/index.js index d96f2e64c6..485f986321 100644 --- a/packages/babel-helper-optimise-call-expression/src/index.js +++ b/packages/babel-helper-optimise-call-expression/src/index.js @@ -1,9 +1,8 @@ -/* eslint max-len: 0 */ - import * as t from "babel-types"; export default function (callee, thisNode, args) { - if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) { + if (args.length === 1 && t.isSpreadElement(args[0]) && + t.isIdentifier(args[0].argument, { name: "arguments" })) { // eg. super(...arguments); return t.callExpression( t.memberExpression(callee, t.identifier("apply")), diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index 8214753552..7fa593bb36 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import type { NodePath, Scope } from "babel-traverse"; import optimiseCall from "babel-helper-optimise-call-expression"; import * as messages from "babel-messages"; @@ -144,7 +142,8 @@ export default class ReplaceSupers { * * @example * - * _set(CLASS.prototype.__proto__ || Object.getPrototypeOf(CLASS.prototype), "METHOD", "VALUE", this) + * _set(CLASS.prototype.__proto__ || Object.getPrototypeOf(CLASS.prototype), "METHOD", "VALUE", + * this) * */ @@ -227,9 +226,8 @@ export default class ReplaceSupers { t.variableDeclaration("var", [ t.variableDeclarator(ref, node.left) ]), - t.expressionStatement( - t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)) - ) + t.expressionStatement(t.assignmentExpression("=", node.left, + t.binaryExpression(node.operator[0], ref, node.right))) ]; } } @@ -251,22 +249,30 @@ export default class ReplaceSupers { if (t.isSuper(callee)) { return; } else if (isMemberExpressionSuper(callee)) { - // super.test(); -> _get(Object.getPrototypeOf(objectRef.prototype), "test", this).call(this); + // super.test(); + // to + // _get(Object.getPrototypeOf(objectRef.prototype), "test", this).call(this); property = callee.property; computed = callee.computed; args = node.arguments; } } else if (t.isMemberExpression(node) && t.isSuper(node.object)) { - // super.name; -> _get(Object.getPrototypeOf(objectRef.prototype), "name", this); + // super.name; + // to + // _get(Object.getPrototypeOf(objectRef.prototype), "name", this); property = node.property; computed = node.computed; } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) { const binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1)); if (node.prefix) { - // ++super.foo; -> super.foo += 1; + // ++super.foo; + // to + // super.foo += 1; return this.specHandleAssignmentExpression(null, path, binary); } else { - // super.foo++; -> let _ref = super.foo; super.foo = _ref + 1; + // super.foo++; + // to + // let _ref = super.foo; super.foo = _ref + 1; const ref = path.scope.generateUidIdentifier("ref"); return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref)); } diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 39a8aa8d33..fbca0c3949 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -24,7 +24,8 @@ function wrapPackagesArray(type, names, optionsDir) { if (val[0][0] === ".") { if (!optionsDir) { - throw new Error("Please provide an options.json in test dir when using a relative plugin path."); + throw new Error("Please provide an options.json in test dir when using a " + + "relative plugin path."); } val[0] = path.resolve(optionsDir, val[0]); @@ -53,7 +54,8 @@ function run(task) { newOpts.plugins = wrapPackagesArray("plugin", newOpts.plugins, optionsDir); newOpts.presets = wrapPackagesArray("preset", newOpts.presets, optionsDir).map(function (val) { if (val.length > 2) { - throw new Error(`Unexpected extra options ${JSON.stringify(val.slice(2))} passed to preset.`); + throw new Error("Unexpected extra options " + JSON.stringify(val.slice(2)) + + " passed to preset."); } return val; @@ -85,7 +87,10 @@ function run(task) { const expectCode = expect.code; if (!execCode || actualCode) { result = babel.transform(actualCode, getOpts(actual)); - if (!expect.code && result.code && !opts.throws && fs.statSync(path.dirname(expect.loc)).isDirectory() && !process.env.CI) { + if ( + !expect.code && result.code && !opts.throws && fs.statSync(path.dirname(expect.loc)).isDirectory() && + !process.env.CI + ) { console.log(`New test file created: ${expect.loc}`); fs.writeFileSync(expect.loc, result.code); } else { diff --git a/packages/babel-helpers/src/helpers.js b/packages/babel-helpers/src/helpers.js index cdd63768da..d7d20aedfd 100644 --- a/packages/babel-helpers/src/helpers.js +++ b/packages/babel-helpers/src/helpers.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ import template from "babel-template"; diff --git a/packages/babel-helpers/src/index.js b/packages/babel-helpers/src/index.js index 207318cf27..c25dce9c14 100644 --- a/packages/babel-helpers/src/index.js +++ b/packages/babel-helpers/src/index.js @@ -1,5 +1,3 @@ -/* eslint no-confusing-arrow: 0 */ - import helpers from "./helpers"; export function get(name) { @@ -10,7 +8,7 @@ export function get(name) { } export const list = Object.keys(helpers) - .map((name) => name[0] === "_" ? name.slice(1) : name) + .map((name) => name.replace(/^_/, "")) .filter((name) => name !== "__esModule"); export default get; diff --git a/packages/babel-messages/src/index.js b/packages/babel-messages/src/index.js index 7064bd69b9..e6f94cab3a 100644 --- a/packages/babel-messages/src/index.js +++ b/packages/babel-messages/src/index.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ import * as util from "util"; diff --git a/packages/babel-plugin-transform-class-properties/src/index.js b/packages/babel-plugin-transform-class-properties/src/index.js index 9c5e7d24a2..1873757ee9 100644 --- a/packages/babel-plugin-transform-class-properties/src/index.js +++ b/packages/babel-plugin-transform-class-properties/src/index.js @@ -1,4 +1,3 @@ -/* eslint max-len: 0 */ import nameFunction from "babel-helper-function-name"; import template from "babel-template"; @@ -44,7 +43,8 @@ export default function ({ types: t }) { visitor: { Class(path, state) { - const buildClassProperty = state.opts.spec ? buildClassPropertySpec : buildClassPropertyNonSpec; + const buildClassProperty = state.opts.spec ? buildClassPropertySpec : + buildClassPropertyNonSpec; const isDerived = !!path.node.superClass; let constructor; const props = []; @@ -92,7 +92,8 @@ export default function ({ types: t }) { if (instanceBody.length) { if (!constructor) { - const newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], t.blockStatement([])); + const newConstructor = t.classMethod("constructor", t.identifier("constructor"), [], + t.blockStatement([])); if (isDerived) { newConstructor.params = [t.restElement(t.identifier("args"))]; newConstructor.body.body.push( @@ -129,7 +130,8 @@ export default function ({ types: t }) { instanceBody = [ t.expressionStatement( - t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [t.thisExpression()]) + t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [ + t.thisExpression()]) ) ]; } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index 19a36f558c..8c698542c2 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import type NodePath from "babel-traverse"; import type Scope from "babel-traverse"; import type File from "../../../file"; @@ -397,7 +395,8 @@ class BlockScoping { const isSwitch = this.blockPath.isSwitchStatement(); // build the closure that we're going to wrap the block with, possible wrapping switch(){} - const fn = t.functionExpression(null, params, t.blockStatement(isSwitch ? [block] : block.body)); + const fn = t.functionExpression(null, params, + t.blockStatement(isSwitch ? [block] : block.body)); fn.shadow = true; // continuation @@ -654,7 +653,8 @@ class BlockScoping { for (let i = 0; i < cases.length; i++) { const caseConsequent = cases[i].consequent[0]; if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) { - caseConsequent.label = this.loopLabel = this.loopLabel || this.scope.generateUidIdentifier("loop"); + caseConsequent.label = this.loopLabel = this.loopLabel || + this.scope.generateUidIdentifier("loop"); } } } diff --git a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js index b38a00fa02..a9a36d4680 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js +++ b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import type { NodePath } from "babel-traverse"; import { visitors } from "babel-traverse"; import ReplaceSupers from "babel-helper-replace-supers"; @@ -28,7 +26,10 @@ const noMethodVisitor = { const verifyConstructorVisitor = visitors.merge([noMethodVisitor, { Super(path) { - if (this.isDerived && !this.hasBareSuper && !path.parentPath.isCallExpression({ callee: path.node })) { + if ( + this.isDerived && !this.hasBareSuper && + !path.parentPath.isCallExpression({ callee: path.node }) + ) { throw path.buildCodeFrameError("'super.*' is not allowed before super()"); } }, @@ -88,7 +89,8 @@ export default class ClassTransformer { this.classId = this.node.id; // this is the name of the binding that will **always** reference the class we've constructed - this.classRef = this.node.id ? t.identifier(this.node.id.name) : this.scope.generateUidIdentifier("class"); + this.classRef = this.node.id ? t.identifier(this.node.id.name) : + this.scope.generateUidIdentifier("class"); this.superName = this.node.superClass || t.identifier("Function"); this.isDerived = !!this.node.superClass; @@ -123,10 +125,12 @@ export default class ClassTransformer { this.buildBody(); // make sure this class isn't directly called - constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("classCallCheck"), [ - t.thisExpression(), - this.classRef - ]))); + constructorBody.body.unshift(t.expressionStatement(t.callExpression( + file.addHelper("classCallCheck"), [ + t.thisExpression(), + this.classRef + ] + ))); body = body.concat(this.staticPropBody.map((fn) => fn(this.classRef))); @@ -227,7 +231,8 @@ export default class ClassTransformer { } if (node.decorators) { - throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one."); + throw path.buildCodeFrameError( + "Method has decorators, put the decorator plugin before the classes one."); } if (t.isClassMethod(node)) { @@ -294,8 +299,13 @@ export default class ClassTransformer { const nullNode = t.nullLiteral(); - // (Constructor, instanceDescriptors, staticDescriptors, instanceInitializers, staticInitializers) - let args = [this.classRef, nullNode, nullNode, nullNode, nullNode]; + let args = [ + this.classRef, // Constructor + nullNode, // instanceDescriptors + nullNode, // staticDescriptors + nullNode, // instanceInitializers + nullNode, // staticInitializers + ]; if (instanceProps) args[1] = instanceProps; if (staticProps) args[2] = staticProps; @@ -336,7 +346,11 @@ export default class ClassTransformer { if (this.isLoose) { bareSuperNode.arguments.unshift(t.thisExpression()); - if (bareSuperNode.arguments.length === 2 && t.isSpreadElement(bareSuperNode.arguments[1]) && t.isIdentifier(bareSuperNode.arguments[1].argument, { name: "arguments" })) { + if ( + bareSuperNode.arguments.length === 2 && + t.isSpreadElement(bareSuperNode.arguments[1]) && + t.isIdentifier(bareSuperNode.arguments[1].argument, { name: "arguments" }) + ) { // special case single arguments spread bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument; bareSuperNode.callee = t.memberExpression(superRef, t.identifier("apply")); @@ -365,7 +379,11 @@ export default class ClassTransformer { const bareSuperAfter = this.bareSuperAfter.map((fn) => fn(thisRef)); - if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) { + if ( + bareSuper.parentPath.isExpressionStatement() && + bareSuper.parentPath.container === body.node.body && + body.node.body.length - 1 === bareSuper.parentPath.key + ) { // this super call is the last statement in the body so we can just straight up // turn it into a return @@ -435,7 +453,8 @@ export default class ClassTransformer { // return const bodyPaths = body.get("body"); if (bodyPaths.length && !bodyPaths.pop().isReturnStatement()) { - body.pushContainer("body", t.returnStatement(guaranteedSuperBeforeFinish ? thisRef : wrapReturn())); + body.pushContainer("body", t.returnStatement( + guaranteedSuperBeforeFinish ? thisRef : wrapReturn())); } for (const returnPath of this.superReturns) { diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index 0bdfb8b695..2609076a80 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - export default function ({ types: t }) { /** @@ -153,7 +151,8 @@ export default function ({ types: t }) { // - const value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]); + const value = t.callExpression( + this.file.addHelper("objectWithoutProperties"), [objRef, keys]); this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value)); } @@ -294,7 +293,8 @@ export default function ({ types: t }) { if (t.isRestElement(elem)) { elemRef = this.toArray(arrayRef); - elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]); + elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), + [t.numericLiteral(i)]); // set the element to the rest element argument since we've dealt with it // being a rest already @@ -485,14 +485,18 @@ export default function ({ types: t }) { t.inherits(nodes[nodes.length - 1], declar); } } else { - nodes.push(t.inherits(destructuring.buildVariableAssignment(declar.id, declar.init), declar)); + nodes.push(t.inherits( + destructuring.buildVariableAssignment(declar.id, declar.init), declar)); } } const nodesOut = []; for (const node of nodes) { const tail = nodesOut[nodesOut.length - 1]; - if (tail && t.isVariableDeclaration(tail) && t.isVariableDeclaration(node) && tail.kind === node.kind) { + if ( + tail && t.isVariableDeclaration(tail) && t.isVariableDeclaration(node) && + tail.kind === node.kind + ) { // Create a single compound let/var rather than many. tail.declarations.push(...node.declarations); } else { diff --git a/packages/babel-plugin-transform-es2015-for-of/src/index.js b/packages/babel-plugin-transform-es2015-for-of/src/index.js index 760e0e69b0..958eae6bce 100644 --- a/packages/babel-plugin-transform-es2015-for-of/src/index.js +++ b/packages/babel-plugin-transform-es2015-for-of/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - export default function ({ messages, template, types: t }) { const buildForOfArray = template(` for (var KEY = 0; KEY < ARR.length; KEY++) BODY; @@ -22,6 +20,7 @@ export default function ({ messages, template, types: t }) { } `); + /* eslint-disable max-len */ const buildForOf = template(` var ITERATOR_COMPLETION = true; var ITERATOR_HAD_ERROR_KEY = false; @@ -44,6 +43,7 @@ export default function ({ messages, template, types: t }) { } } `); + /* eslint-enable max-len */ function _ForOfStatementArray(path) { const { node, scope } = path; @@ -76,7 +76,8 @@ export default function ({ messages, template, types: t }) { left.declarations[0].init = iterationValue; loop.body.body.unshift(left); } else { - loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue))); + loop.body.body.unshift(t.expressionStatement( + t.assignmentExpression("=", left, iterationValue))); } if (path.parentPath.isLabeledStatement()) { diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 9c0ef6b69b..74af212c55 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import { basename, extname } from "path"; import template from "babel-template"; import * as t from "babel-types"; @@ -43,7 +41,8 @@ const buildExportAll = template(` }); `); -const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"]; +const THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", + "ClassMethod", "ObjectMethod"]; export default function () { const REASSIGN_REMAP_SKIP = Symbol(); @@ -61,7 +60,8 @@ export default function () { path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap])); } else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) { const { object, property } = remap; - path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name))); + path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), + t.JSXIdentifier(property.name))); } else { path.replaceWith(remap); } @@ -327,9 +327,15 @@ export default function () { // todo } else if (specifier.isExportSpecifier()) { if (specifier.node.local.name === "default") { - topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), specifier.node.local))); + topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), + t.memberExpression( + t.callExpression(this.addHelper("interopRequireDefault"), [ref]), + specifier.node.local + ) + )); } else { - topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression(ref, specifier.node.local))); + topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), + t.memberExpression(ref, specifier.node.local))); } nonHoistedExportNames[specifier.node.exported.name] = true; } @@ -414,7 +420,8 @@ export default function () { topNodes.push(varDecl); } } - remaps[specifier.local.name] = t.memberExpression(target, t.cloneWithoutLoc(specifier.imported)); + remaps[specifier.local.name] = t.memberExpression(target, + t.cloneWithoutLoc(specifier.imported)); } } } else { @@ -431,13 +438,20 @@ export default function () { const maxHoistedExportsNodeAssignmentLength = 100; const nonHoistedExportNamesArr = Object.keys(nonHoistedExportNames); - for (let currentExportsNodeAssignmentLength = 0; currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength ) { - const nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice(currentExportsNodeAssignmentLength, currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength); + for ( + let currentExportsNodeAssignmentLength = 0; + currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; + currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength + ) { + const nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice( + currentExportsNodeAssignmentLength, + currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength); let hoistedExportsNode = t.identifier("undefined"); nonHoistedExportNamesChunk.forEach(function (name) { - hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression; + hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode) + .expression; }); const node = t.expressionStatement(hoistedExportsNode); diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js index c79baab12b..c995a972b3 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import hoistVariables from "babel-helper-hoist-variables"; import template from "babel-template"; @@ -76,7 +74,8 @@ export default function ({ types: t }) { CallExpression(path, state) { if (path.node.callee.type === TYPE_IMPORT) { const contextIdent = state.contextIdent; - path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), path.node.arguments)); + path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), + path.node.arguments)); } }, @@ -236,7 +235,8 @@ export default function ({ types: t }) { } if (t.isImportSpecifier(specifier)) { - setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, t.memberExpression(target, specifier.imported)))); + setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, + t.memberExpression(target, specifier.imported)))); } } @@ -256,7 +256,8 @@ export default function ({ types: t }) { })); } else if (t.isExportSpecifier(node)) { setterBody.push(t.expressionStatement( - t.assignmentExpression("=", t.memberExpression(exportObjRef, node.exported), t.memberExpression(target, node.local)) + t.assignmentExpression("=", t.memberExpression(exportObjRef, node.exported), + t.memberExpression(target, node.local)) )); } else { // todo @@ -279,7 +280,8 @@ export default function ({ types: t }) { } if (variableIds.length) { - beforeBody.unshift(t.variableDeclaration("var", variableIds.map((id) => t.variableDeclarator(id)))); + beforeBody.unshift(t.variableDeclaration("var", + variableIds.map((id) => t.variableDeclarator(id)))); } path.traverse(reassignmentVisitor, { @@ -294,7 +296,8 @@ export default function ({ types: t }) { path.node.body = [ buildTemplate({ - SYSTEM_REGISTER: t.memberExpression(t.identifier(state.opts.systemGlobal || "System"), t.identifier("register")), + SYSTEM_REGISTER: t.memberExpression( + t.identifier(state.opts.systemGlobal || "System"), t.identifier("register")), BEFORE_BODY: beforeBody, MODULE_NAME: moduleName, SETTERS: setters, diff --git a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js index b13ab6af37..46405fc0f3 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import { basename, extname } from "path"; import template from "babel-template"; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/default.js b/packages/babel-plugin-transform-es2015-parameters/src/default.js index f123ed195e..8213efff57 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/default.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/default.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import getFunctionArity from "babel-helper-get-function-arity"; import callDelegate from "babel-helper-call-delegate"; import template from "babel-template"; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/rest.js b/packages/babel-plugin-transform-es2015-parameters/src/rest.js index d0ff2846cb..1297b13f15 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/rest.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/rest.js @@ -1,5 +1,3 @@ -/* eslint indent: 0 */ - import template from "babel-template"; import * as t from "babel-types"; diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js index 4cea5acd1a..754b496f0e 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - export default function ({ types: t }) { const IGNORE = Symbol(); @@ -18,10 +16,17 @@ export default function ({ types: t }) { if (node[IGNORE]) return; if (path.find((path) => path.node && !!path.node._generated)) return; - if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) { - // optimise `typeof foo === "string"` since we can determine that they'll never need to handle symbols + if ( + path.parentPath.isBinaryExpression() && + t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0 + ) { + // optimise `typeof foo === "string"` since we can determine that they'll never + // need to handle symbols const opposite = path.getOpposite(); - if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") { + if ( + opposite.isLiteral() && opposite.node.value !== "symbol" && + opposite.node.value !== "object" + ) { return; } } diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index 8de5e5eea2..91f7a0c40a 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -94,11 +94,14 @@ export default function ({ types: t }) { // to avoid calling foo() twice, as a first step convert it to: // const _foo = foo(), // { a, ...b } = _foo; - const initRef = path.scope.generateUidIdentifierBasedOnNode(this.originalPath.node.init, "ref"); + const initRef = path.scope.generateUidIdentifierBasedOnNode( + this.originalPath.node.init, "ref"); // insert _foo = foo() - this.originalPath.insertBefore(t.variableDeclarator(initRef, this.originalPath.node.init)); + this.originalPath.insertBefore(t.variableDeclarator(initRef, + this.originalPath.node.init)); // replace foo() with _foo - this.originalPath.replaceWith(t.variableDeclarator(this.originalPath.node.id, initRef)); + this.originalPath.replaceWith(t.variableDeclarator( + this.originalPath.node.id, initRef)); return; } @@ -247,7 +250,8 @@ export default function ({ types: t }) { const useBuiltIns = file.opts.useBuiltIns || false; if (typeof useBuiltIns !== "boolean") { - throw new Error("transform-object-rest-spread currently only accepts a boolean option for useBuiltIns (defaults to false)"); + throw new Error("transform-object-rest-spread currently only accepts a boolean " + + "option for useBuiltIns (defaults to false)"); } const args = []; diff --git a/packages/babel-plugin-transform-proto-to-assign/src/index.js b/packages/babel-plugin-transform-proto-to-assign/src/index.js index 41b0ff442d..c139e20de4 100644 --- a/packages/babel-plugin-transform-proto-to-assign/src/index.js +++ b/packages/babel-plugin-transform-proto-to-assign/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import pull from "lodash/pull"; export default function ({ types: t }) { @@ -9,7 +7,8 @@ export default function ({ types: t }) { function isProtoAssignmentExpression(node) { const left = node.left; - return t.isMemberExpression(left) && t.isLiteral(t.toComputedKey(left, left.property), { value: "__proto__" }); + return t.isMemberExpression(left) && + t.isLiteral(t.toComputedKey(left, left.property), { value: "__proto__" }); } function buildDefaultsCallExpression(expr, ref, file) { diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index 65758283c0..bb57b52d7f 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import jsx from "babel-plugin-syntax-jsx"; import helper from "babel-helper-builder-react-jsx"; @@ -31,7 +29,8 @@ export default function ({ types: t }) { if (matches) { id = matches[1]; if (id === "React.DOM") { - throw file.buildCodeFrameError(comment, "The @jsx React.DOM pragma has been deprecated as of React 0.12"); + throw file.buildCodeFrameError(comment, + "The @jsx React.DOM pragma has been deprecated as of React 0.12"); } else { break; } diff --git a/packages/babel-polyfill/src/index.js b/packages/babel-polyfill/src/index.js index 2dfde7b6d7..61434e6fb5 100644 --- a/packages/babel-polyfill/src/index.js +++ b/packages/babel-polyfill/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - if (global._babelPolyfill) { throw new Error("only one instance of babel-polyfill is allowed"); } @@ -24,6 +22,7 @@ function define(O, key, value) { define(String.prototype, "padLeft", "".padStart); define(String.prototype, "padRight", "".padEnd); +// eslint-disable-next-line max-len "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(key) { [][key] && define(Array, key, Function.call.bind([][key])); }); diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index 164652c143..0384dfec16 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import cloneDeep from "lodash/cloneDeep"; import assign from "lodash/assign"; import has from "lodash/has"; @@ -15,7 +13,8 @@ export default function (code: string, opts?: Object): Function { // original stack to append if it errors when parsing let stack; try { - // error stack gets populated in IE only on throw (https://msdn.microsoft.com/en-us/library/hh699850(v=vs.94).aspx) + // error stack gets populated in IE only on throw + // (https://msdn.microsoft.com/en-us/library/hh699850(v=vs.94).aspx) throw new Error(); } catch (error) { if (error.stack) { diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 464a5a150f..1c5c96b58c 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import TraversalContext from "./context"; import * as visitors from "./visitors"; import * as messages from "babel-messages"; @@ -45,7 +43,14 @@ traverse.cheap = function (node, enter) { return t.traverseFast(node, enter); }; -traverse.node = function (node: Object, opts: Object, scope: Object, state: Object, parentPath: Object, skipKeys?) { +traverse.node = function ( + node: Object, + opts: Object, + scope: Object, + state: Object, + parentPath: Object, + skipKeys? +) { const keys: Array = t.VISITOR_KEYS[node.type]; if (!keys) return; @@ -74,7 +79,12 @@ function hasBlacklistedType(path, state) { } } -traverse.hasType = function (tree: Object, scope: Object, type: Object, blacklistTypes: Array): boolean { +traverse.hasType = function ( + tree: Object, + scope: Object, + type: Object, + blacklistTypes: Array +): boolean { // the node we're searching in is blacklisted if (includes(blacklistTypes, tree.type)) return false; diff --git a/packages/babel-traverse/src/path/evaluation.js b/packages/babel-traverse/src/path/evaluation.js index 82c15a743e..57699b561f 100644 --- a/packages/babel-traverse/src/path/evaluation.js +++ b/packages/babel-traverse/src/path/evaluation.js @@ -1,12 +1,7 @@ -/* eslint indent: 0 */ -/* eslint max-len: 0 */ - import type NodePath from "./index"; // This file contains Babels metainterpreter that can evaluate static code. -/* eslint eqeqeq: 0 */ - const VALID_CALLEES = ["String", "Number", "Math"]; const INVALID_METHODS = ["random"]; @@ -316,7 +311,7 @@ export function evaluate(): { confident: boolean; value: any } { case ">": return left > right; case "<=": return left <= right; case ">=": return left >= right; - case "==": return left == right; + case "==": return left == right; // eslint-disable-line eqeqeq case "!=": return left != right; case "===": return left === right; case "!==": return left !== right; @@ -335,7 +330,10 @@ export function evaluate(): { confident: boolean; value: any } { let func; // Number(1); - if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && VALID_CALLEES.indexOf(callee.node.name) >= 0) { + if ( + callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && + VALID_CALLEES.indexOf(callee.node.name) >= 0 + ) { func = global[node.callee.name]; } @@ -344,7 +342,11 @@ export function evaluate(): { confident: boolean; value: any } { const property = callee.get("property"); // Math.min(1, 2) - if (object.isIdentifier() && property.isIdentifier() && VALID_CALLEES.indexOf(object.node.name) >= 0 && INVALID_METHODS.indexOf(property.node.name) < 0) { + if ( + object.isIdentifier() && property.isIdentifier() && + VALID_CALLEES.indexOf(object.node.name) >= 0 && + INVALID_METHODS.indexOf(property.node.name) < 0 + ) { context = global[object.node.name]; func = context[property.node.name]; } diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index 853a735bb8..c66d0e8482 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import type Hub from "../hub"; import type TraversalContext from "../context"; import * as virtualTypes from "./lib/virtual-types"; diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 243e9c18ac..93b9323bd3 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -153,7 +153,8 @@ export default class PathHoister { const attachTo = this.getAttachmentPath(); if (!attachTo) return; - // don't bother hoisting to the same function as this will cause multiple branches to be evaluated more than once leading to a bad optimisation + // don't bother hoisting to the same function as this will cause multiple branches to be + // evaluated more than once leading to a bad optimisation if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return; // generate declaration and insert it to our point diff --git a/packages/babel-traverse/src/path/lib/removal-hooks.js b/packages/babel-traverse/src/path/lib/removal-hooks.js index 0678d1da28..73341ae651 100644 --- a/packages/babel-traverse/src/path/lib/removal-hooks.js +++ b/packages/babel-traverse/src/path/lib/removal-hooks.js @@ -6,28 +6,29 @@ export const hooks = [ function (self, parent) { - let removeParent = false; + const removeParent = + // while (NODE); + // removing the test of a while/switch, we can either just remove it entirely *or* turn the + // `test` into `true` unlikely that the latter will ever be what's wanted so we just remove + // the loop to avoid infinite recursion + (self.key === "test" && (parent.isWhile() || parent.isSwitchCase())) || - // while (NODE); - // removing the test of a while/switch, we can either just remove it entirely *or* turn the `test` into `true` - // unlikely that the latter will ever be what's wanted so we just remove the loop to avoid infinite recursion - removeParent = removeParent || (self.key === "test" && (parent.isWhile() || parent.isSwitchCase())); + // export NODE; + // just remove a declaration for an export as this is no longer valid + (self.key === "declaration" && parent.isExportDeclaration()) || - // export NODE; - // just remove a declaration for an export as this is no longer valid - removeParent = removeParent || (self.key === "declaration" && parent.isExportDeclaration()); + // label: NODE + // stray labeled statement with no body + (self.key === "body" && parent.isLabeledStatement()) || - // label: NODE - // stray labeled statement with no body - removeParent = removeParent || (self.key === "body" && parent.isLabeledStatement()); + // let NODE; + // remove an entire declaration if there are no declarators left + (self.listKey === "declarations" && parent.isVariableDeclaration() && + parent.node.declarations.length === 1) || - // let NODE; - // remove an entire declaration if there are no declarators left - removeParent = removeParent || (self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1); - - // NODE; - // remove the entire expression statement if there's no expression - removeParent = removeParent || (self.key === "expression" && parent.isExpressionStatement()); + // NODE; + // remove the entire expression statement if there's no expression + (self.key === "expression" && parent.isExpressionStatement()); if (removeParent) { parent.remove(); diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 704014c16e..9df7ecc873 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -1,4 +1,3 @@ -/* eslint max-len: 0 */ // This file contains methods that modify the path/node in some ways. import { path as pathCache } from "../cache"; @@ -17,7 +16,10 @@ export function insertBefore(nodes) { if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { return this.parentPath.insertBefore(nodes); - } else if (this.isNodeType("Expression") || (this.parentPath.isForStatement() && this.key === "init")) { + } else if ( + this.isNodeType("Expression") || + (this.parentPath.isForStatement() && this.key === "init") + ) { if (this.node) nodes.push(this.node); this.replaceExpressionWithStatements(nodes); } else { @@ -28,7 +30,8 @@ export function insertBefore(nodes) { if (this.node) nodes.push(this.node); this._replaceWith(t.blockStatement(nodes)); } else { - throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?"); + throw new Error("We don't know what to do with this node type. " + + "We were previously a Statement but we can't fit in here?"); } } @@ -88,7 +91,8 @@ export function _containerInsertAfter(nodes) { export function _maybePopFromStatements(nodes) { const last = nodes[nodes.length - 1]; - const isIdentifier = t.isIdentifier(last) || (t.isExpressionStatement(last) && t.isIdentifier(last.expression)); + const isIdentifier = t.isIdentifier(last) || + (t.isExpressionStatement(last) && t.isIdentifier(last.expression)); if (isIdentifier && !this.isCompletionRecord()) { nodes.pop(); @@ -107,7 +111,10 @@ export function insertAfter(nodes) { if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) { return this.parentPath.insertAfter(nodes); - } else if (this.isNodeType("Expression") || (this.parentPath.isForStatement() && this.key === "init")) { + } else if ( + this.isNodeType("Expression") || + (this.parentPath.isForStatement() && this.key === "init") + ) { if (this.node) { const temp = this.scope.generateDeclaredUidIdentifier(); nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node))); @@ -122,7 +129,8 @@ export function insertAfter(nodes) { if (this.node) nodes.unshift(this.node); this._replaceWith(t.blockStatement(nodes)); } else { - throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?"); + throw new Error("We don't know what to do with this node type. " + + "We were previously a Statement but we can't fit in here?"); } } diff --git a/packages/babel-traverse/src/path/replacement.js b/packages/babel-traverse/src/path/replacement.js index 08df6ce16c..1a8cdbef54 100644 --- a/packages/babel-traverse/src/path/replacement.js +++ b/packages/babel-traverse/src/path/replacement.js @@ -1,4 +1,3 @@ -/* eslint max-len: 0 */ // This file contains methods responsible for replacing a node with another. import codeFrame from "babel-code-frame"; @@ -114,22 +113,30 @@ export function replaceWith(replacement) { } if (Array.isArray(replacement)) { - throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`"); + throw new Error( + "Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`"); } if (typeof replacement === "string") { - throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`"); + throw new Error( + "Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`"); } if (this.isNodeType("Statement") && t.isExpression(replacement)) { - if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + if ( + !this.canHaveVariableDeclarationOrExpression() && + !this.canSwapBetweenExpressionAndStatement(replacement) + ) { // replacing a statement with an expression so wrap it in an expression statement replacement = t.expressionStatement(replacement); } } if (this.isNodeType("Expression") && t.isStatement(replacement)) { - if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) { + if ( + !this.canHaveVariableDeclarationOrExpression() && + !this.canSwapBetweenExpressionAndStatement(replacement) + ) { // replacing an expression with a statement so let's explode it return this.replaceExpressionWithStatements([replacement]); } diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index b7b3388b8d..25d17f97f0 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -1,5 +1,3 @@ -/* eslint max-len: 0 */ - import includes from "lodash/includes"; import repeat from "lodash/repeat"; import Renamer from "./lib/renamer"; @@ -341,13 +339,11 @@ export default class Scope { // ignore hoisted functions if there's also a local let if (kind === "hoisted" && local.kind === "let") return; - let duplicate = false; - - // don't allow duplicate bindings to exist alongside - if (!duplicate) duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module"; - - // don't allow a local of param with a kind of let - if (!duplicate) duplicate = local.kind === "param" && (kind === "let" || kind === "const"); + const duplicate = + // don't allow duplicate bindings to exist alongside + kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || + // don't allow a local of param with a kind of let + local.kind === "param" && (kind === "let" || kind === "const"); if (duplicate) { throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError); diff --git a/packages/babel-traverse/test/evaluation.js b/packages/babel-traverse/test/evaluation.js index 3c53fbf615..5a3d93f765 100644 --- a/packages/babel-traverse/test/evaluation.js +++ b/packages/babel-traverse/test/evaluation.js @@ -33,7 +33,8 @@ describe("evaluation", function () { it("should bail out on recursive evaluation", function () { assert.strictEqual( - getPath("function fn(a) { var g = a ? 1 : 2, a = g * this.foo; }").get("body.0.body.body.0.declarations.1.init").evaluate().confident, + getPath("function fn(a) { var g = a ? 1 : 2, a = g * this.foo; }") + .get("body.0.body.body.0.declarations.1.init").evaluate().confident, false ); }); @@ -54,7 +55,8 @@ describe("evaluation", function () { it("should deopt when var is redeclared in the same scope", function () { assert.strictEqual( - getPath("var x = 2; var y = x + 2; { var x = 3 }").get("body.1.declarations.0.init").evaluate().confident, + getPath("var x = 2; var y = x + 2; { var x = 3 }") + .get("body.1.declarations.0.init").evaluate().confident, false ); }); @@ -73,7 +75,8 @@ describe("evaluation", function () { it("it should not deopt let/const inside blocks", function () { assert.strictEqual( - getPath("let x = 5; { let x = 1; } let y = x + 5").get("body.2.declarations.0.init").evaluate().value, + getPath("let x = 5; { let x = 1; } let y = x + 5") + .get("body.2.declarations.0.init").evaluate().value, 10 ); const constExample = "const d = true; if (d && true || false) { const d = false; d && 5; }"; diff --git a/packages/babel-traverse/test/inference.js b/packages/babel-traverse/test/inference.js index 225f2c7430..03ff842ecf 100644 --- a/packages/babel-traverse/test/inference.js +++ b/packages/babel-traverse/test/inference.js @@ -36,7 +36,8 @@ describe("inference", function () { }); it("it should bail when type changes", function () { - const path = getPath("var x = 1; if (foo) x = null;else x = 3; x === 2").get("body")[2].get("expression"); + const path = getPath("var x = 1; if (foo) x = null;else x = 3; x === 2") + .get("body")[2].get("expression"); const left = path.get("left"); const right = path.get("right"); @@ -144,7 +145,8 @@ describe("inference", function () { it("should infer call return type using async generator function", function () { const path = getPath("(async function * (): string {})()").get("body")[0].get("expression"); const type = path.getTypeAnnotation(); - assert.ok(t.isGenericTypeAnnotation(type) && type.id.name === "AsyncIterator", "should be AsyncIterator"); + assert.ok(t.isGenericTypeAnnotation(type) && type.id.name === "AsyncIterator", + "should be AsyncIterator"); }); it("should infer number from x/y", function () { const path = getPath("x/y").get("body")[0].get("expression"); diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index db51118fcf..7f823ecfd6 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -17,22 +17,29 @@ function getPath(code) { describe("scope", function () { describe("binding paths", function () { it("function declaration id", function () { - assert.ok(getPath("function foo() {}").scope.getBinding("foo").path.type === "FunctionDeclaration"); + assert.ok(getPath("function foo() {}") + .scope.getBinding("foo").path.type === "FunctionDeclaration"); }); it("function expression id", function () { - assert.ok(getPath("(function foo() {})").get("body")[0].get("expression").scope.getBinding("foo").path.type === "FunctionExpression"); + assert.ok(getPath("(function foo() {})").get("body")[0].get("expression") + .scope.getBinding("foo").path.type === "FunctionExpression"); }); it("function param", function () { - assert.ok(getPath("(function (foo) {})").get("body")[0].get("expression").scope.getBinding("foo").path.type === "Identifier"); + assert.ok(getPath("(function (foo) {})").get("body")[0].get("expression") + .scope.getBinding("foo").path.type === "Identifier"); }); it("variable declaration", function () { - assert.ok(getPath("var foo = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); - assert.ok(getPath("var { foo } = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); - assert.ok(getPath("var [ foo ] = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); - assert.ok(getPath("var { bar: [ foo ] } = null;").scope.getBinding("foo").path.type === "VariableDeclarator"); + assert.ok(getPath("var foo = null;") + .scope.getBinding("foo").path.type === "VariableDeclarator"); + assert.ok(getPath("var { foo } = null;") + .scope.getBinding("foo").path.type === "VariableDeclarator"); + assert.ok(getPath("var [ foo ] = null;") + .scope.getBinding("foo").path.type === "VariableDeclarator"); + assert.ok(getPath("var { bar: [ foo ] } = null;") + .scope.getBinding("foo").path.type === "VariableDeclarator"); }); it("purity", function () { diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index 3f62821ce5..5434620947 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -31,7 +31,8 @@ describe("traverse", function () { it("traverse", function () { const expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, - body[1], body[1].expression, body[1].expression.left, body[1].expression.left.object, body[1].expression.left.property, body[1].expression.right + body[1], body[1].expression, body[1].expression.left, body[1].expression.left.object, + body[1].expression.left.property, body[1].expression.right ]; const actual = []; diff --git a/packages/babel-types/src/constants.js b/packages/babel-types/src/constants.js index 72f0a16387..1ed965382e 100644 --- a/packages/babel-types/src/constants.js +++ b/packages/babel-types/src/constants.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ export const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; export const FLATTENABLE_KEYS = ["body", "expressions"]; diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 276db2048a..e7b7a272e0 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ import * as t from "../index"; diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 843a831fa6..f0231478d3 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -1,4 +1,4 @@ -/* eslint max-len: 0 */ +/* eslint max-len: "off" */ import defineType, { assertNodeType, diff --git a/packages/babel-types/src/validators.js b/packages/babel-types/src/validators.js index 183a304a9b..c5f25327bd 100644 --- a/packages/babel-types/src/validators.js +++ b/packages/babel-types/src/validators.js @@ -1,5 +1,3 @@ -/* eslint indent: 0 */ - import { getBindingIdentifiers } from "./retrievers"; import esutils from "esutils"; import * as t from "./index"; @@ -276,7 +274,7 @@ export function isNodesEquivalent(a, b) { } if (!isNodesEquivalent(a[field], b[field])) { - return false; + return false; } } diff --git a/packages/babel-types/test/converters.js b/packages/babel-types/test/converters.js index 56dabf6586..b89e6dbe3f 100644 --- a/packages/babel-types/test/converters.js +++ b/packages/babel-types/test/converters.js @@ -25,7 +25,8 @@ describe("converters", function () { assert.deepEqual(t.valueToNode(/abc.+/gm), t.regExpLiteral("abc.+", "gm")); }); it("array", function () { - assert.deepEqual(t.valueToNode([1, "a"]), t.arrayExpression([t.numericLiteral(1), t.stringLiteral("a")])); + assert.deepEqual(t.valueToNode([1, "a"]), + t.arrayExpression([t.numericLiteral(1), t.stringLiteral("a")])); }); it("object", function () { assert.deepEqual(t.valueToNode({ From 8c3392f058029d28c637fa07e8e1fc2af23b902c Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sat, 4 Feb 2017 16:01:45 -0500 Subject: [PATCH 121/222] Remove uses of lodash/compact (#5181) --- packages/babel-types/src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index 54edc7d981..fc633e1474 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -1,5 +1,4 @@ import toFastProperties from "to-fast-properties"; -import compact from "lodash/compact"; import loClone from "lodash/clone"; import uniq from "lodash/uniq"; @@ -398,7 +397,10 @@ export function inheritInnerComments(child: Object, parent: Object) { function _inheritComments(key, child, parent) { if (child && parent) { - child[key] = uniq(compact([].concat(child[key], parent[key]))); + child[key] = uniq( + [].concat(child[key], parent[key]) + .filter(Boolean) + ); } } From 6fa6f5924da3892d825e2e5aa01338b151e858b8 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sat, 4 Feb 2017 13:31:33 -0800 Subject: [PATCH 122/222] [7.0] Run Babel's unittests in a custom sandbox (take 2). (#5263) * Run Babel's unittests in a custom sandbox (take 2). * Add tests for sandboxing behavior. --- .../src/index.js | 100 ++++++++++++++---- .../test/index.js | 24 +++++ 2 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 packages/babel-helper-transform-fixture-test-runner/test/index.js diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 39a8aa8d33..d8035b3fa6 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -10,11 +10,87 @@ import extend from "lodash/extend"; import merge from "lodash/merge"; import assert from "assert"; import chai from "chai"; -import "babel-polyfill"; import fs from "fs"; import path from "path"; +import vm from "vm"; +import Module from "module"; -const babelHelpers = eval(buildExternalHelpers(null, "var")); +const moduleCache = {}; +const testContext = vm.createContext({ + ...helpers, + assert: chai.assert, + transform: babel.transform, +}); +testContext.global = testContext; + +// Initialize the test context with the polyfill, and then freeze the global to prevent implicit +// global creation in tests, which could cause things to bleed between tests. +runModuleInTestContext("babel-polyfill", __filename); + +// Populate the "babelHelpers" global with Babel's helper utilities. +runCodeInTestContext(buildExternalHelpers()); + +/** + * A basic implementation of CommonJS so we can execute `babel-polyfill` inside our test context. + * This allows us to run our unittests + */ +function runModuleInTestContext(id: string, relativeFilename: string) { + // This code is a gross hack using internal APIs, but we also have the same logic in babel-core + // to resolve presets and plugins, so if this breaks, we'll have even worse issues to deal with. + const relativeMod = new Module(); + relativeMod.id = relativeFilename; + relativeMod.filename = relativeFilename; + relativeMod.paths = Module._nodeModulePaths(path.dirname(relativeFilename)); + const filename = Module._resolveFilename(id, relativeMod); + + // Expose Node-internal modules if the tests want them. Note, this will not execute inside + // the context's global scope. + if (filename === id) return require(id); + + if (moduleCache[filename]) return moduleCache[filename].exports; + + const module = moduleCache[filename] = { + id: filename, + exports: {}, + }; + const dirname = path.dirname(filename); + const req = (id) => runModuleInTestContext(id, filename); + + const src = fs.readFileSync(filename, "utf8"); + const code = `(function (exports, require, module, __filename, __dirname) {${src}\n});`; + + vm.runInContext(code, testContext, { + filename, + displayErrors: true, + }).call(module.exports, module.exports, req, module, filename, dirname); + + return module.exports; +} + +/** + * Run the given snippet of code inside a CommonJS module. + * + * Exposed for unit tests, not for use as an API. + */ +export function runCodeInTestContext(code: string, opts: {filename?: string} = {}) { + const filename = opts.filename || null; + const dirname = filename ? path.dirname(filename) : null; + const req = filename ? ((id) => runModuleInTestContext(id, filename)) : null; + + const module = { + id: filename, + exports: {}, + }; + + // Expose the test options as "opts", but otherwise run the test in a CommonJS-like environment. + // Note: This isn't doing .call(module.exports, ...) because some of our tests currently + // rely on 'this === global'. + const src = `(function(exports, require, module, __filename, __dirname, opts) {${code}\n});`; + return vm.runInContext(src, testContext, { + filename, + displayErrors: true, + })(module.exports, req, module, filename, dirname, opts); +} function wrapPackagesArray(type, names, optionsDir) { return (names || []).map(function (val) { @@ -68,12 +144,11 @@ function run(task) { if (execCode) { const execOpts = getOpts(exec); - const execDirName = path.dirname(exec.loc); result = babel.transform(execCode, execOpts); execCode = result.code; try { - resultExec = runExec(execOpts, execCode, execDirName); + resultExec = runCodeInTestContext(execCode, execOpts); } catch (err) { err.message = exec.loc + ": " + err.message; err.message += codeFrame(execCode); @@ -114,23 +189,6 @@ function run(task) { } } -function runExec(opts, execCode, execDirname) { - const sandbox = { - ...helpers, - babelHelpers, - assert: chai.assert, - transform: babel.transform, - opts, - exports: {}, - require(id) { - return require(id[0] === "." ? path.resolve(execDirname, id) : id); - } - }; - - const fn = new Function(...Object.keys(sandbox), execCode); - return fn.apply(null, Object.values(sandbox)); -} - export default function ( fixturesLoc: string, name: string, diff --git a/packages/babel-helper-transform-fixture-test-runner/test/index.js b/packages/babel-helper-transform-fixture-test-runner/test/index.js new file mode 100644 index 0000000000..f6c1baefd4 --- /dev/null +++ b/packages/babel-helper-transform-fixture-test-runner/test/index.js @@ -0,0 +1,24 @@ +import assert from "assert"; +import { runCodeInTestContext } from ".."; + +describe("helper-transform-fixture-test-runner", function() { + it("should not execute code in Node's global context", function() { + try { + global.foo = "outer"; + runCodeInTestContext(` + assert.equal(global.foo, undefined); + global.foo = "inner"; + `); + + assert.equal(global.foo, "outer"); + runCodeInTestContext(` + assert.equal(global.foo, "inner"); + `); + } finally { + delete global.foo; + runCodeInTestContext(` + delete global.foo; + `); + } + }); +}); From e9d7757433562e46fd77f9b328dbdfa70f22066d Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Mon, 6 Feb 2017 12:06:48 -0500 Subject: [PATCH 123/222] Emit parens for await (but not yield) of ternary expressions (#5270) --- packages/babel-generator/src/node/parentheses.js | 4 ++++ .../test/fixtures/parentheses/await-expression/actual.js | 1 + .../test/fixtures/parentheses/await-expression/expected.js | 1 + .../test/fixtures/parentheses/yield-expression/actual.js | 1 + .../test/fixtures/parentheses/yield-expression/expected.js | 1 + 5 files changed, 8 insertions(+) diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 4da106ce99..558bceb14c 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -197,6 +197,10 @@ export function ConditionalExpression(node: Object, parent: Object): boolean { return true; } + if (t.isAwaitExpression(parent)) { + return true; + } + return UnaryLike(node, parent); } diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js index 6ac1480c55..d4bdc6b74a 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js @@ -3,6 +3,7 @@ async function asdf() { (await b)(); new (await b)(); true ? (await 1) : (await 2); + await (1 ? 2 : 3); await (await 1); } diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js index a5ec177acd..dc2cb361e0 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js @@ -3,6 +3,7 @@ async function asdf() { (await b)(); new (await b)(); true ? await 1 : await 2; + await (1 ? 2 : 3); await await 1; } diff --git a/packages/babel-generator/test/fixtures/parentheses/yield-expression/actual.js b/packages/babel-generator/test/fixtures/parentheses/yield-expression/actual.js index 97ef823d3c..b000b972b5 100644 --- a/packages/babel-generator/test/fixtures/parentheses/yield-expression/actual.js +++ b/packages/babel-generator/test/fixtures/parentheses/yield-expression/actual.js @@ -3,6 +3,7 @@ function* asdf() { (yield b)(); new (yield b)(); (yield 1) ? (yield 2) : (yield 3); + yield (1 ? 2 : 3); yield (yield 1); } diff --git a/packages/babel-generator/test/fixtures/parentheses/yield-expression/expected.js b/packages/babel-generator/test/fixtures/parentheses/yield-expression/expected.js index cbc86c5c5c..68c2e6b123 100644 --- a/packages/babel-generator/test/fixtures/parentheses/yield-expression/expected.js +++ b/packages/babel-generator/test/fixtures/parentheses/yield-expression/expected.js @@ -3,6 +3,7 @@ function* asdf() { (yield b)(); new (yield b)(); (yield 1) ? yield 2 : yield 3; + yield 1 ? 2 : 3; yield yield 1; } From 6ee7bf6df5f06b61a8970ee9a095d2f0b6afda0c Mon Sep 17 00:00:00 2001 From: Christina Date: Mon, 6 Feb 2017 13:30:56 -0500 Subject: [PATCH 124/222] checks if babel is installed globally and displays correct cli message (#5258) * checks if babel is installed globally and displays correct cli message - fixes #5228 * recommend local installation and fix lint errors * uses babel-cli vs babel * switch back to babel * use process.cwd() to determine if globally executed * checks for /node_module/.bin/babel * compare execPath and module execution path to determine global or local installation * Move the babel/cli.js into a 'src' so the 'const's are compiled Node < 6. --- packages/babel/package.json | 6 +++--- packages/babel/{ => src}/cli.js | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) rename packages/babel/{ => src}/cli.js (58%) diff --git a/packages/babel/package.json b/packages/babel/package.json index a4440b5718..4c03e3eb51 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -7,8 +7,8 @@ "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel", "bin": { - "babel": "./cli.js", - "babel-node": "./cli.js", - "babel-external-helpers": "./cli.js" + "babel": "./lib/cli.js", + "babel-node": "./lib/cli.js", + "babel-external-helpers": "./lib/cli.js" } } diff --git a/packages/babel/cli.js b/packages/babel/src/cli.js similarity index 58% rename from packages/babel/cli.js rename to packages/babel/src/cli.js index 92c1235cd0..0a6c889d7d 100755 --- a/packages/babel/cli.js +++ b/packages/babel/src/cli.js @@ -1,10 +1,13 @@ #!/usr/bin/env node +import path from "path"; + +const globalMessage = path.dirname(process.execPath) === path.dirname(process.env._ || "") ? " -g" : ""; console.error("You have mistakenly installed the `babel` package, which is a no-op in Babel 6.\n" + "Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.\n" + "\n" + - " npm uninstall babel\n" + - " npm install babel-cli\n" + + " npm uninstall" + globalMessage + " babel\n" + + " npm install --save-dev babel-cli\n" + "\n" + "See http://babeljs.io/docs/usage/cli/ for setup instructions."); process.exit(1); From ff8a10e52f91c425c4d1aa90e05c1bc8f152b066 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 6 Feb 2017 10:50:56 -0800 Subject: [PATCH 125/222] Add option to block-scoping to slow on throw code (#5236) The let/const plugin can add closures where you don't expect them. This is undesirable in some perf-sensitive projects (ex: React). I added an option that throws whenever the plugin adds a function (as opposed to simply renaming variables when converting to var). --- .../README.md | 26 +++++++++++++++++++ .../src/index.js | 6 +++++ .../for-const-closure/actual.js | 6 +++++ .../for-const-closure/options.json | 3 +++ .../throwIfClosureRequired/function/actual.js | 3 +++ .../function/expected.js | 3 +++ .../throwIfClosureRequired/options.json | 3 +++ .../superswitch/actual.js | 16 ++++++++++++ .../superswitch/options.json | 3 +++ 9 files changed, 69 insertions(+) create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/actual.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/options.json create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/actual.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/expected.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/options.json create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json diff --git a/packages/babel-plugin-transform-es2015-block-scoping/README.md b/packages/babel-plugin-transform-es2015-block-scoping/README.md index ee1d426600..2890f38d09 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/README.md +++ b/packages/babel-plugin-transform-es2015-block-scoping/README.md @@ -14,12 +14,26 @@ npm install --save-dev babel-plugin-transform-es2015-block-scoping **.babelrc** +Without options: + ```json { "plugins": ["transform-es2015-block-scoping"] } ``` +With options: + +```json +{ + "plugins": [ + ["transform-es2015-block-scoping", { + "throwIfClosureRequired": true + }] + ] +} +``` + ### Via CLI ```sh @@ -33,3 +47,15 @@ require("babel-core").transform("code", { plugins: ["transform-es2015-block-scoping"] }); ``` + +## Options `throwIfClosureRequired` + +In cases such as the following it's impossible to rewrite let/const without adding an additional function and closure while transforming: + +```javascript +for (let i = 0; i < 5; i++) { + setTimeout(() => console.log(i), 1); +} +``` + +In extremely performance-sensitive code, this can be undesirable. If `"throwIfClosureRequired": true` is set, Babel throws when transforming these patterns instead of automatically adding an additional function. diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index 8c698542c2..b1227d3a52 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -360,6 +360,12 @@ class BlockScoping { } wrapClosure() { + if (this.file.opts.throwIfClosureRequired) { + throw this.blockPath.buildCodeFrameError( + "Compiling let/const in this block would add a closure " + + "(throwIfClosureRequired)." + ); + } const block = this.block; const outsideRefs = this.outsideLetReferences; diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/actual.js new file mode 100644 index 0000000000..55dbb21d37 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/actual.js @@ -0,0 +1,6 @@ +for (let i = 0; i < 5; i++) { + const l = i; + setTimeout(function() { + console.log(l); + }, 1); +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/options.json b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/options.json new file mode 100644 index 0000000000..d210fdebfc --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Compiling let/const in this block would add a closure (throwIfClosureRequired)." +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/actual.js new file mode 100644 index 0000000000..2b9635ec33 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/actual.js @@ -0,0 +1,3 @@ +function test() { + let foo = "bar"; +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/expected.js new file mode 100644 index 0000000000..bb4b09c9c5 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/function/expected.js @@ -0,0 +1,3 @@ +function test() { + var foo = "bar"; +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/options.json b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/options.json new file mode 100644 index 0000000000..3228559d0b --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["transform-es2015-block-scoping", { "throwIfClosureRequired": true }], "syntax-jsx", "transform-react-jsx", "transform-es2015-block-scoped-functions", "transform-es2015-arrow-functions"] +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js new file mode 100644 index 0000000000..857b8641f4 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js @@ -0,0 +1,16 @@ +function foo() { + switch (2) { + case 0: { + if (true) { + return; + } + + const stuff = new Map(); + const data = 0; + stuff.forEach(() => { + const d = data; + }); + break; + } + } +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json new file mode 100644 index 0000000000..d210fdebfc --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json @@ -0,0 +1,3 @@ +{ + "throws": "Compiling let/const in this block would add a closure (throwIfClosureRequired)." +} From badce969dafaf3128104cbc6d6bc605e2b47a3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Lity=C5=84ski?= Date: Tue, 7 Feb 2017 01:17:26 +0100 Subject: [PATCH 126/222] Fix confusing comment (#5272) (#5273) --- packages/babel-traverse/src/scope/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index 25d17f97f0..a0b26bc573 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -76,7 +76,7 @@ const collectorVisitor = { }, Declaration(path) { - // delegate block scope handling to the `blockVariableVisitor` + // delegate block scope handling to the `BlockScoped` method if (path.isBlockScoped()) return; // this will be hit again once we traverse into it after this iteration From 1ba4a3fe5dad11ca0db671a345e332bf4c0000e5 Mon Sep 17 00:00:00 2001 From: Vicente Jr Yuchitcho Date: Wed, 8 Feb 2017 03:17:50 +1100 Subject: [PATCH 127/222] Add path sibling traversal methods (#5230) * getPrevSibling * getNextSibling * getAllNextSiblings * getAllPrevSiblings --- packages/babel-traverse/src/path/family.js | 32 +++++++++++++++++++++- packages/babel-traverse/test/family.js | 25 +++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/packages/babel-traverse/src/path/family.js b/packages/babel-traverse/src/path/family.js index d17ae8aed7..3af5c1e022 100644 --- a/packages/babel-traverse/src/path/family.js +++ b/packages/babel-traverse/src/path/family.js @@ -57,7 +57,7 @@ export function getCompletionRecords(): Array { return paths; } -export function getSibling(key) { +export function getSibling(key): NodePath { return NodePath.get({ parentPath: this.parentPath, parent: this.parent, @@ -67,6 +67,36 @@ export function getSibling(key) { }); } +export function getPrevSibling(): NodePath { + return this.getSibling(this.key - 1); +} + +export function getNextSibling(): NodePath { + return this.getSibling(this.key + 1); +} + +export function getAllNextSiblings(): Array { + let _key = this.key; + let sibling:NodePath = this.getSibling(++_key); + const siblings:Array = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(++_key); + } + return siblings; +} + +export function getAllPrevSiblings(): Array { + let _key = this.key; + let sibling:NodePath = this.getSibling(--_key); + const siblings:Array = []; + while (sibling.node) { + siblings.push(sibling); + sibling = this.getSibling(--_key); + } + return siblings; +} + export function get(key: string, context?: boolean | TraversalContext): NodePath { if (context === true) context = this.context; const parts = key.split("."); diff --git a/packages/babel-traverse/test/family.js b/packages/babel-traverse/test/family.js index 6e9a497df7..6c34906c44 100644 --- a/packages/babel-traverse/test/family.js +++ b/packages/babel-traverse/test/family.js @@ -52,6 +52,31 @@ describe("path/family", function () { assert.strictEqual(outerNodes[id], outerPaths[id].node, "nodes match"); }); }); + + }); + describe("getSibling", function () { + const ast = parse("var a = 1, {b} = c, [d] = e; function f() {} function g() {}"); + let sibling = {}, lastSibling = {}; + traverse(ast, { + VariableDeclaration(path) { + sibling = path.getSibling(path.key); + lastSibling = sibling.getNextSibling().getNextSibling(); + } + }); + + it("should return traverse sibling nodes", function () { + assert.ok(sibling.getNextSibling().node, "has property node"); + assert.ok(lastSibling.getPrevSibling().node, "has property node"); + assert.equal(!!sibling.getPrevSibling().node, false, "out of scope"); + assert.equal(!!lastSibling.getNextSibling().node, false, "out of scope"); + }); + + it("should return all preceding and succeeding sibling nodes", function () { + assert.ok(sibling.getAllNextSiblings().length, "Has next sibling"); + assert.ok(lastSibling.getAllPrevSiblings().length, "Has prev sibling"); + assert.equal(sibling.getAllNextSiblings().length, 2, "Has 2 succeeding sibling"); + assert.equal(lastSibling.getAllPrevSiblings().length, 2, "Has 2 preceeding sibling"); + }); }); }); From 9de923258cb3b9635245b7bfdb47e4cb693c5aff Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Tue, 7 Feb 2017 11:19:14 -0500 Subject: [PATCH 128/222] Don't transpile ES7 symbol properties (#5195) --- packages/babel-plugin-transform-runtime/src/definitions.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/babel-plugin-transform-runtime/src/definitions.js b/packages/babel-plugin-transform-runtime/src/definitions.js index ce059f9634..20a5853412 100644 --- a/packages/babel-plugin-transform-runtime/src/definitions.js +++ b/packages/babel-plugin-transform-runtime/src/definitions.js @@ -104,14 +104,12 @@ module.exports = { }, Symbol: { - asyncIterator: "symbol/async-iterator", for: "symbol/for", hasInstance: "symbol/has-instance", isConcatSpreadable: "symbol/is-concat-spreadable", iterator: "symbol/iterator", keyFor: "symbol/key-for", match: "symbol/match", - observable: "symbol/observable", replace: "symbol/replace", search: "symbol/search", species: "symbol/species", From 01eabd0d342922b056d3fe515e6afba4be8472a7 Mon Sep 17 00:00:00 2001 From: Mark Jones Date: Wed, 8 Feb 2017 10:23:54 -0500 Subject: [PATCH 129/222] Add background for stage 1 (#5251) [skip ci] --- packages/babel-preset-stage-1/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/babel-preset-stage-1/README.md b/packages/babel-preset-stage-1/README.md index d0af0ffd58..19692c62a5 100644 --- a/packages/babel-preset-stage-1/README.md +++ b/packages/babel-preset-stage-1/README.md @@ -2,6 +2,16 @@ > Babel preset for stage 1 plugins. +The gist of Stage 1 is: + +> **Stage 1**: proposal +> +> **What is it?** A formal proposal for the feature. +> +> **What’s required?** A so-called champion must be identified who is responsible for the proposal. Either the champion or a co-champion must be a member of TC39 (source). The problem solved by the proposal must be described in prose. The solution must be described via examples, an API and a discussion of semantics and algorithms. Lastly, potential obstacles for the proposal must be identified, such as interactions with other features and implementation challenges. Implementation-wise, polyfills and demos are needed. +> +> **What’s next?** By accepting a proposal for stage 1, TC39 declares its willingness to examine, discuss and contribute to the proposal. Going forward, major changes to the proposal are expected + ## Install ```sh @@ -33,3 +43,7 @@ require("babel-core").transform("code", { presets: ["stage-1"] }); ``` + +## References + +- Chapter "[The TC39 process for ECMAScript features](http://exploringjs.com/es2016-es2017/ch_tc39-process.html)" in "Exploring ES2016 and ES2017" by Axel Rauschmayer From 64e7d76b6b0a355e7a2c421101877cbf66fdf6a2 Mon Sep 17 00:00:00 2001 From: Mark Jones Date: Wed, 8 Feb 2017 10:25:10 -0500 Subject: [PATCH 130/222] Added info about stage 2 (#5252) [skip ci] --- packages/babel-preset-stage-2/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/babel-preset-stage-2/README.md b/packages/babel-preset-stage-2/README.md index 1c6a5f900e..0007aa1a67 100644 --- a/packages/babel-preset-stage-2/README.md +++ b/packages/babel-preset-stage-2/README.md @@ -2,6 +2,18 @@ > Babel preset for stage 2 plugins. +The gist of Stage 2 is: + +> **Stage 2:** draft +> +> **What is it?** A first version of what will be in the specification. At this point, an eventual inclusion of the feature in the standard is likely. +> +> **What’s required?** The proposal must now additionally have a formal description of the syntax and semantics of the feature (using the formal language of the ECMAScript specification). The description should be as complete as possible, but can contain todos and placeholders. Two experimental implementations of the feature are needed, but one of them can be in a transpiler such as Babel. +> +> **What’s next?** Only incremental changes are expected from now on. + + + ## Install ```sh @@ -33,3 +45,6 @@ require("babel-core").transform("code", { presets: ["stage-2"] }); ``` +## References + +- Chapter "[The TC39 process for ECMAScript features](http://exploringjs.com/es2016-es2017/ch_tc39-process.html)" in "Exploring ES2016 and ES2017" by Axel Rauschmayer From 5c5262437e104cad09751a686f21a09bea8661f0 Mon Sep 17 00:00:00 2001 From: Mark Jones Date: Wed, 8 Feb 2017 10:25:43 -0500 Subject: [PATCH 131/222] Add definition of stage 3 (#5253) [skip ci] --- packages/babel-preset-stage-3/README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/babel-preset-stage-3/README.md b/packages/babel-preset-stage-3/README.md index fd29e4670e..656cd0d72c 100644 --- a/packages/babel-preset-stage-3/README.md +++ b/packages/babel-preset-stage-3/README.md @@ -2,6 +2,18 @@ > Babel preset for stage 3 plugins. +The gist of Stage 3 is: + +> **Stage 3**: candidate +> +> **What is it?** The proposal is mostly finished and now needs feedback from implementations and users to progress further. + +> **What’s required?** The spec text must be complete. Designated reviewers (appointed by TC39, not by the champion) and the ECMAScript spec editor must sign off on the spec text. There must be at least two spec-compliant implementations (which don’t have to be enabled by default). +> +> **What’s next?** Henceforth, changes should only be made in response to critical issues raised by the implementations and their use. + + + ## Install ```sh @@ -33,3 +45,7 @@ require("babel-core").transform("code", { presets: ["stage-3"] }); ``` + +## References + +- Chapter "[The TC39 process for ECMAScript features](http://exploringjs.com/es2016-es2017/ch_tc39-process.html)" in "Exploring ES2016 and ES2017" by Axel Rauschmayer From f8ffe03e79d95b2b9ed3481dbb3e90b76c536d90 Mon Sep 17 00:00:00 2001 From: Boopathi Rajaa Date: Wed, 8 Feb 2017 16:37:14 +0100 Subject: [PATCH 132/222] Deopt evaluation of undefined with a local binding. Fix #5204 (#5206) --- packages/babel-traverse/src/path/evaluation.js | 6 +++--- packages/babel-traverse/test/evaluation.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/babel-traverse/src/path/evaluation.js b/packages/babel-traverse/src/path/evaluation.js index 57699b561f..971a66a409 100644 --- a/packages/babel-traverse/src/path/evaluation.js +++ b/packages/babel-traverse/src/path/evaluation.js @@ -176,11 +176,11 @@ export function evaluate(): { confident: boolean; value: any } { return binding.value; } else { if (node.name === "undefined") { - return undefined; + return binding ? deopt(binding.path) : undefined; } else if (node.name === "Infinity") { - return Infinity; + return binding ? deopt(binding.path) : Infinity; } else if (node.name === "NaN") { - return NaN; + return binding ? deopt(binding.path) : NaN; } const resolved = path.resolve(); diff --git a/packages/babel-traverse/test/evaluation.js b/packages/babel-traverse/test/evaluation.js index 5a3d93f765..148173fa7d 100644 --- a/packages/babel-traverse/test/evaluation.js +++ b/packages/babel-traverse/test/evaluation.js @@ -101,4 +101,22 @@ describe("evaluation", function () { false ); }); + + it("should evaluate undefined, NaN and Infinity", () => { + assert.strictEqual(getPath("undefined").get("body.0.expression").evaluate().confident, true); + assert.strictEqual(getPath("NaN").get("body.0.expression").evaluate().confident, true); + assert.strictEqual(getPath("Infinity").get("body.0.expression").evaluate().confident, true); + }); + + it("should deopt redefined primitives - undefined, NaN and Infinity", () => { + const eval_undef = getPath("let undefined; undefined;").get("body.1.expression").evaluate(); + const eval_nan = getPath("let NaN; NaN;").get("body.1.expression").evaluate(); + const eval_inf = getPath("let Infinity; Infinity;").get("body.1.expression").evaluate(); + assert.strictEqual(eval_undef.confident, false); + assert.strictEqual(eval_nan.confident, false); + assert.strictEqual(eval_inf.confident, false); + + assert.strictEqual(eval_undef.deopt.type, "VariableDeclarator"); + assert.strictEqual(eval_undef.deopt.parentPath.node.kind, "let"); + }); }); From fb0a91b75087d4fd477e567374b7d1c21c269778 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Wed, 8 Feb 2017 21:24:23 +0100 Subject: [PATCH 133/222] Fix TypeError with babel-register's cache (#5260) --- packages/babel-register/package.json | 3 + packages/babel-register/src/cache.js | 11 ++-- packages/babel-register/test/index.js | 84 +++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 packages/babel-register/test/index.js diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index de6c6897fd..1bef5676c5 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -15,5 +15,8 @@ "lodash": "^4.2.0", "mkdirp": "^0.5.1", "source-map-support": "^0.4.2" + }, + "devDependencies": { + "decache": "^4.1.0" } } diff --git a/packages/babel-register/src/cache.js b/packages/babel-register/src/cache.js index 4b08e63ac7..204ac04019 100644 --- a/packages/babel-register/src/cache.js +++ b/packages/babel-register/src/cache.js @@ -3,18 +3,20 @@ import fs from "fs"; import { sync as mkdirpSync } from "mkdirp"; import homeOrTmp from "home-or-tmp"; -const FILENAME = process.env.BABEL_CACHE_PATH || path.join(homeOrTmp, ".babel.json"); -let data = {}; +const FILENAME: string = process.env.BABEL_CACHE_PATH || path.join(homeOrTmp, ".babel.json"); +let data: Object = {}; /** * Write stringified cache to disk. */ export function save() { - let serialised = {}; + let serialised: string = "{}"; + try { serialised = JSON.stringify(data, null, " "); } catch (err) { + if (err.message === "Invalid string length") { err.message = "Cache too large so it's been cleared."; console.error(err.stack); @@ -22,6 +24,7 @@ export function save() { throw err; } } + mkdirpSync(path.dirname(FILENAME)); fs.writeFileSync(FILENAME, serialised); } @@ -49,6 +52,6 @@ export function load() { * Retrieve data from cache. */ -export function get() { +export function get(): Object { return data; } diff --git a/packages/babel-register/test/index.js b/packages/babel-register/test/index.js new file mode 100644 index 0000000000..e736f3e484 --- /dev/null +++ b/packages/babel-register/test/index.js @@ -0,0 +1,84 @@ +import { expect } from "chai"; +import fs from "fs"; +import path from "path"; +import decache from "decache"; + +const testCacheFilename = path.join(__dirname, ".babel"); +const oldBabelDisableCacheValue = process.env.BABEL_DISABLE_CACHE; + +process.env.BABEL_CACHE_PATH = testCacheFilename; +delete process.env.BABEL_DISABLE_CACHE; + +function writeCache(data) { + if (typeof data === "object") { + data = JSON.stringify(data); + } + + fs.writeFileSync(testCacheFilename, data); +} + +function cleanCache() { + + try { + fs.unlinkSync(testCacheFilename); + } catch (e) { + // It is convenient to always try to clear + } +} + +function resetCache() { + process.env.BABEL_CACHE_PATH = null; + process.env.BABEL_DISABLE_CACHE = oldBabelDisableCacheValue; +} + +describe("babel register", () => { + + describe("cache", () => { + let load, get, save; + + beforeEach(() => { + // Since lib/cache is a singleton we need to fully reload it + decache("../lib/cache"); + const cache = require("../lib/cache"); + + load = cache.load; + get = cache.get; + save = cache.save; + }); + + afterEach(cleanCache); + after(resetCache); + + it("should load and get cached data", () => { + writeCache({ foo: "bar" }); + + load(); + + expect(get()).to.be.an("object"); + expect(get()).to.deep.equal({ foo: "bar" }); + }); + + it("should load and get an object with no cached data", () => { + load(); + + expect(get()).to.be.an("object"); + expect(get()).to.deep.equal({}); + }); + + it("should load and get an object with invalid cached data", () => { + writeCache("foobar"); + + load(); + + expect(get()).to.be.an("object"); + expect(get()).to.deep.equal({}); + }); + + it("should create the cache on save", () => { + save(); + + expect(fs.existsSync(testCacheFilename)).to.be.true; + expect(get()).to.deep.equal({}); + }); + }); +}); From 1a325ce5d56d38f1f1641dd3b9e49b2b68e64de7 Mon Sep 17 00:00:00 2001 From: jwbay Date: Thu, 9 Feb 2017 16:04:43 -0500 Subject: [PATCH 134/222] codegen performance: use trim-right instead of lodash/trimEnd (#5255) --- packages/babel-generator/package.json | 3 ++- packages/babel-generator/src/buffer.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 418f105dc6..c55b973d6d 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -17,7 +17,8 @@ "detect-indent": "^4.0.0", "jsesc": "^1.3.0", "lodash": "^4.2.0", - "source-map": "^0.5.0" + "source-map": "^0.5.0", + "trim-right": "^1.0.1" }, "devDependencies": { "babel-helper-fixtures": "^6.22.0", diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index d1187be275..3c53ef666d 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -1,5 +1,5 @@ import type SourceMap from "./source-map"; -import trimEnd from "lodash/trimEnd"; +import trimRight from "trim-right"; const SPACES_RE = /^[ \t]+$/; @@ -40,7 +40,9 @@ export default class Buffer { const map = this._map; const result = { - code: trimEnd(this._buf.join("")), + // Whatever trim is used here should not execute a regex against the + // source string since it may be arbitrarily large after all transformations + code: trimRight(this._buf.join("")), map: null, rawMappings: map && map.getRawMappings(), }; From 6da9bb83df4b6340b382d1acae3ebff3a0baf040 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 9 Feb 2017 15:06:41 -0600 Subject: [PATCH 135/222] Prevent multiple return statements in a loop when replacing expressions (#5030) --- .../test/fixtures/do-expressions/while-if/actual.js | 10 ++++++++++ .../fixtures/do-expressions/while-if/expected.js | 13 +++++++++++++ packages/babel-traverse/src/path/replacement.js | 12 +++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/actual.js create mode 100644 packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/expected.js diff --git a/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/actual.js b/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/actual.js new file mode 100644 index 0000000000..d3706c14b3 --- /dev/null +++ b/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/actual.js @@ -0,0 +1,10 @@ +let p +let a = do { + while (p = p.parentPath) { + if (a) { + 'a' + } else { + 'b' + } + } +}; diff --git a/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/expected.js b/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/expected.js new file mode 100644 index 0000000000..5c0298f045 --- /dev/null +++ b/packages/babel-plugin-transform-do-expressions/test/fixtures/do-expressions/while-if/expected.js @@ -0,0 +1,13 @@ +let p; +let a = function () { + var _ret; + + while (p = p.parentPath) { + if (a) { + _ret = 'a'; + } else { + _ret = 'b'; + } + } + return _ret; +}(); diff --git a/packages/babel-traverse/src/path/replacement.js b/packages/babel-traverse/src/path/replacement.js index 1a8cdbef54..47e706d0d2 100644 --- a/packages/babel-traverse/src/path/replacement.js +++ b/packages/babel-traverse/src/path/replacement.js @@ -219,10 +219,16 @@ export function replaceExpressionWithStatements(nodes: Array) { const loop = path.findParent((path) => path.isLoop()); if (loop) { - const callee = this.get("callee"); + let uid = loop.getData("expressionReplacementReturnUid"); - const uid = callee.scope.generateDeclaredUidIdentifier("ret"); - callee.get("body").pushContainer("body", t.returnStatement(uid)); + if (!uid) { + const callee = this.get("callee"); + uid = callee.scope.generateDeclaredUidIdentifier("ret"); + callee.get("body").pushContainer("body", t.returnStatement(uid)); + loop.setData("expressionReplacementReturnUid", uid); + } else { + uid = t.identifier(uid.name); + } path.get("expression").replaceWith( t.assignmentExpression("=", uid, path.node.expression) From ad91c6d186fe1a6e91f665185cf8ed0650aadaff Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 9 Feb 2017 18:47:58 -0500 Subject: [PATCH 136/222] use lerna@2-beta.37 (#5254) --- lerna.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 29d69c0eea..b5ae1cda13 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-beta.23", + "lerna": "2.0.0-beta.37", "version": "independent", "changelog": { "repo": "babel/babel", diff --git a/package.json b/package.json index 99d9cf5126..dc045dc0ee 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "gulp-plumber": "^1.0.1", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", - "lerna": "2.0.0-beta.23", + "lerna": "2.0.0-beta.37", "lerna-changelog": "^0.2.0", "lodash": "^4.2.0", "mocha": "^3.0.0", From 982cdb2a3ac41979b54d2ca21843db684e466e8a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 9 Feb 2017 18:54:42 -0500 Subject: [PATCH 137/222] update yarn --- yarn.lock | 156 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 117 insertions(+), 39 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7f42f4d322..2f54094083 100644 --- a/yarn.lock +++ b/yarn.lock @@ -721,12 +721,6 @@ babel-plugin-transform-regenerator@^6.22.0: dependencies: regenerator-transform "0.9.8" -babel-plugin-transform-runtime@^6.3.13: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.22.0.tgz#10968d760bbf6517243081eec778e10fa828551c" - dependencies: - babel-runtime "^6.22.0" - babel-plugin-transform-strict-mode@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.22.0.tgz#e008df01340fdc87e959da65991b7e05970c8c7c" @@ -810,7 +804,7 @@ babel-register@^6.14.0, babel-register@^6.22.0: mkdirp "^0.5.1" source-map-support "^0.4.2" -babel-runtime@^6.0.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0: +babel-runtime@^6.18.0, babel-runtime@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611" dependencies: @@ -1199,6 +1193,12 @@ cli-cursor@^1.0.1: dependencies: restore-cursor "^1.0.1" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + cli-width@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" @@ -1231,6 +1231,13 @@ clone@^1.0.0, clone@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149" +cmd-shim@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-2.0.2.tgz#6fcbda99483a8fd15d7d30a196ca69d688a2efdb" + dependencies: + graceful-fs "^4.1.2" + mkdirp "~0.5.0" + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -1272,6 +1279,10 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" +command-join@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/command-join/-/command-join-2.0.0.tgz#52e8b984f4872d952ff1bdc8b98397d27c7144cf" + commander@2.9.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" @@ -1347,7 +1358,7 @@ create-hmac@^1.1.0, create-hmac@^1.1.2: create-hash "^1.1.0" inherits "^2.0.1" -cross-spawn@^4: +cross-spawn@^4, cross-spawn@^4.0.0: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" dependencies: @@ -1775,6 +1786,12 @@ extend@^3.0.0, extend@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.0.tgz#5a474353b9f3353ddd8176dfd37b91c83a46f1d4" +external-editor@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.1.tgz#4c597c6c88fa6410e41dbbaa7b1be2336aa31095" + dependencies: + tmp "^0.0.31" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -1812,6 +1829,12 @@ figures@^1.3.5: escape-string-regexp "^1.0.5" object-assign "^4.1.0" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" @@ -2422,6 +2445,24 @@ inquirer@^0.12.0: strip-ansi "^3.0.0" through "^2.3.6" +inquirer@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.0.1.tgz#6dfbffaf4d697dd76c8fe349f919de01c28afc4d" + dependencies: + ansi-escapes "^1.1.0" + chalk "^1.0.0" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^2.0.1" + figures "^2.0.0" + lodash "^4.3.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx "^4.1.0" + string-width "^2.0.0" + strip-ansi "^3.0.0" + through "^2.3.6" + insert-module-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" @@ -2565,6 +2606,10 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -2781,26 +2826,29 @@ lerna-changelog@^0.2.0: chalk "^1.1.3" mkdirp "^0.5.1" -lerna@2.0.0-beta.23: - version "2.0.0-beta.23" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-beta.23.tgz#af418121d5ddfae250a49d77fadade6bc790909e" +lerna@2.0.0-beta.37: + version "2.0.0-beta.37" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-beta.37.tgz#d8e1d25a75102658b12565e4aa12e0423e969aad" dependencies: async "^1.5.0" chalk "^1.1.1" - inquirer "^0.12.0" - lodash.find "^4.3.0" - lodash.unionwith "^4.2.0" + cmd-shim "^2.0.2" + command-join "^2.0.0" + cross-spawn "^4.0.0" + glob "^7.0.6" + inquirer "^3.0.1" + lodash "^4.17.4" meow "^3.7.0" minimatch "^3.0.0" mkdirp "^0.5.1" - object-assign "^4.0.1" - object-assign-sorted "^1.0.0" - pad "^1.0.0" + normalize-path "^2.0.1" + object-assign-sorted "^2.0.1" path-exists "^2.1.0" progress "^1.1.8" + read-cmd-shim "^1.0.1" rimraf "^2.4.4" semver "^5.1.0" - signal-exit "^2.1.2" + signal-exit "^3.0.2" sync-exec "^0.6.2" levn@^0.3.0, levn@~0.3.0: @@ -2905,10 +2953,6 @@ lodash.escape@^3.0.0: dependencies: lodash._root "^3.0.0" -lodash.find@^4.3.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" - lodash.isarguments@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" @@ -2978,11 +3022,7 @@ lodash.templatesettings@^3.0.0: lodash._reinterpolate "^3.0.0" lodash.escape "^3.0.0" -lodash.unionwith@^4.2.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.unionwith/-/lodash.unionwith-4.6.0.tgz#74d140b5ca8146e6c643c3724f5152538d9ac1f0" - -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -3092,6 +3132,10 @@ mime-types@^2.1.12, mime-types@~2.1.7: dependencies: mime-db "~1.26.0" +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + minimalistic-assert@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3" @@ -3123,7 +3167,7 @@ minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1: +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3183,6 +3227,10 @@ mute-stream@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + nan@^2.3.0: version "2.5.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8" @@ -3277,11 +3325,10 @@ oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign-sorted@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/object-assign-sorted/-/object-assign-sorted-1.0.0.tgz#e739f698164014ec1f050f38decabad1e9b228bf" +object-assign-sorted@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object-assign-sorted/-/object-assign-sorted-2.0.1.tgz#c9983fa9e3ed5807b49cf1a9943378f245d9395b" dependencies: - object-assign "^4.0.1" sorted-object "^2.0.0" object-assign@^3.0.0: @@ -3319,6 +3366,12 @@ onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" +onetime@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.0.tgz#52aa8110e52fc5126ffc667bd8ec21c2ed209ce6" + dependencies: + mimic-fn "^1.0.0" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -3363,7 +3416,7 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" -os-tmpdir@^1.0.1: +os-tmpdir@^1.0.1, os-tmpdir@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -3375,10 +3428,6 @@ output-file-sync@^1.1.1: mkdirp "^0.5.1" object-assign "^4.1.0" -pad@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/pad/-/pad-1.0.2.tgz#f6e36ff3ceb468e4ae2ed33ad5ecf25ace920960" - pako@~0.2.0: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" @@ -3586,6 +3635,12 @@ rc@~1.1.6: minimist "^1.2.0" strip-json-comments "~1.0.4" +read-cmd-shim@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" + dependencies: + graceful-fs "^4.1.2" + read-only-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" @@ -3819,6 +3874,13 @@ restore-cursor@^1.0.1: exit-hook "^1.0.0" onetime "^1.0.0" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + right-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" @@ -3847,10 +3909,20 @@ run-async@^0.1.0: dependencies: once "^1.3.0" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" + dependencies: + is-promise "^2.1.0" + rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" + "semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -3905,11 +3977,11 @@ sigmund@~1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590" -signal-exit@^2.0.0, signal-exit@^2.1.2: +signal-exit@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-2.1.2.tgz#375879b1f92ebc3b334480d038dc546a6d558564" -signal-exit@^3.0.0, signal-exit@^3.0.1: +signal-exit@^3.0.0, signal-exit@^3.0.1, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -4234,6 +4306,12 @@ timers-browserify@^1.0.1: dependencies: process "~0.11.0" +tmp@^0.0.31: + version "0.0.31" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" + dependencies: + os-tmpdir "~1.0.1" + to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" From 870a37834c33831d5be8fe4ee4ee5b0edec9fbba Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 9 Feb 2017 19:19:41 -0500 Subject: [PATCH 138/222] .gitignore for test [skip ci] --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 702ae50d45..12a252a120 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ dist /.package.json /packages/babel-runtime/core-js /packages/babel-runtime/helpers/*.js +/packages/babel-register/test/.babel /packages/*/lib _babel.github.io /tests/.browser-build.js From 75ac320cf7b763a438afabb354820fe4806d5df4 Mon Sep 17 00:00:00 2001 From: james kyle Date: Thu, 9 Feb 2017 16:45:38 -0800 Subject: [PATCH 139/222] Add new flow preset (#5288) --- packages/babel-preset-flow/.npmignore | 3 ++ packages/babel-preset-flow/README.md | 53 ++++++++++++++++++++++++ packages/babel-preset-flow/package.json | 18 ++++++++ packages/babel-preset-flow/src/index.js | 7 ++++ packages/babel-preset-react/README.md | 5 +-- packages/babel-preset-react/package.json | 3 +- packages/babel-preset-react/src/index.js | 8 ++-- 7 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 packages/babel-preset-flow/.npmignore create mode 100644 packages/babel-preset-flow/README.md create mode 100644 packages/babel-preset-flow/package.json create mode 100644 packages/babel-preset-flow/src/index.js diff --git a/packages/babel-preset-flow/.npmignore b/packages/babel-preset-flow/.npmignore new file mode 100644 index 0000000000..47cdd2c655 --- /dev/null +++ b/packages/babel-preset-flow/.npmignore @@ -0,0 +1,3 @@ +src +test +node_modules diff --git a/packages/babel-preset-flow/README.md b/packages/babel-preset-flow/README.md new file mode 100644 index 0000000000..26593bd878 --- /dev/null +++ b/packages/babel-preset-flow/README.md @@ -0,0 +1,53 @@ +# babel-preset-flow + +> Babel preset for all Flow plugins. + +This preset includes the following plugins: + +- [transform-flow-strip-types](https://babeljs.io/docs/plugins/transform-flow-strip-types/) + +## Example + +**In** + +```javascript +function foo(one: any, two: number, three?): string {} +``` + +**Out** + +```javascript +function foo(one, two, three) {} +``` + +## Installation + +```sh +npm install --save-dev babel-preset-flow +``` + +## Usage + +### Via `.babelrc` (Recommended) + +**.babelrc** + +```json +{ + "presets": ["flow"] +} +``` + +### Via CLI + +```sh +babel --presets flow script.js +``` + +### Via Node API + +```javascript +require("babel-core").transform("code", { + presets: ["flow"] +}); +``` diff --git a/packages/babel-preset-flow/package.json b/packages/babel-preset-flow/package.json new file mode 100644 index 0000000000..c5503cf2d1 --- /dev/null +++ b/packages/babel-preset-flow/package.json @@ -0,0 +1,18 @@ +{ + "name": "babel-preset-flow", + "version": "6.22.2", + "description": "Babel preset for all Flow plugins.", + "author": "James Kyle ", + "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-flow", + "license": "MIT", + "main": "lib/index.js", + "keywords": [ + "babel-preset", + "flowtype", + "flow", + "types" + ], + "dependencies": { + "babel-plugin-transform-flow-strip-types": "^6.22.0" + } +} diff --git a/packages/babel-preset-flow/src/index.js b/packages/babel-preset-flow/src/index.js new file mode 100644 index 0000000000..8251ca8270 --- /dev/null +++ b/packages/babel-preset-flow/src/index.js @@ -0,0 +1,7 @@ +import transformFlowStripTypes from "babel-plugin-transform-flow-strip-types"; + +export default { + plugins: [ + transformFlowStripTypes + ] +}; diff --git a/packages/babel-preset-react/README.md b/packages/babel-preset-react/README.md index aceb108aff..591a59547b 100644 --- a/packages/babel-preset-react/README.md +++ b/packages/babel-preset-react/README.md @@ -2,11 +2,10 @@ > Babel preset for all React plugins. -This preset includes the following plugins: +This preset includes the following plugins/presets: -- [syntax-flow](https://babeljs.io/docs/plugins/syntax-flow/) +- [preset-flow](https://babeljs.io/docs/plugins/preset-flow/) - [syntax-jsx](https://babeljs.io/docs/plugins/syntax-jsx/) -- [transform-flow-strip-types](https://babeljs.io/docs/plugins/transform-flow-strip-types/) - [transform-react-jsx](https://babeljs.io/docs/plugins/transform-react-jsx/) - [transform-react-display-name](https://babeljs.io/docs/plugins/transform-react-display-name/) diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index 378b3a0456..30a0158521 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -8,9 +8,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-react", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-flow": "^6.3.13", + "babel-preset-flow": "^6.22.2", "babel-plugin-syntax-jsx": "^6.3.13", - "babel-plugin-transform-flow-strip-types": "^6.22.0", "babel-plugin-transform-react-display-name": "^6.22.0", "babel-plugin-transform-react-jsx": "^6.22.0", "babel-plugin-transform-react-jsx-source": "^6.22.0", diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index 55dd6bbd8d..361238658e 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -1,6 +1,5 @@ +import presetFlow from "babel-preset-flow"; import transformReactJSX from "babel-plugin-transform-react-jsx"; -import transformFlowStripTypes from "babel-plugin-transform-flow-strip-types"; -import transformSyntaxFlow from "babel-plugin-syntax-flow"; import transformSyntaxJSX from "babel-plugin-syntax-jsx"; import transformReactDisplayName from "babel-plugin-transform-react-display-name"; @@ -9,10 +8,11 @@ import transformReactDisplayName from "babel-plugin-transform-react-display-name // import transformReactJSXSelf from "babel-plugin-transform-react-jsx-self"; export default { + presets: [ + presetFlow + ], plugins: [ transformReactJSX, - transformFlowStripTypes, - transformSyntaxFlow, transformSyntaxJSX, transformReactDisplayName ], From dde70c0a04112e32f38ad9f27b6a89283a0998d5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Fri, 10 Feb 2017 14:40:24 -0500 Subject: [PATCH 140/222] [7.0] remove standalone babel package (#5293) Having it isn't compatible with the changes for `babel-cli -> @babel/cli` --- packages/babel/.npmignore | 3 --- packages/babel/README.md | 1 - packages/babel/index.js | 1 - packages/babel/package.json | 14 -------------- packages/babel/src/cli.js | 13 ------------- 5 files changed, 32 deletions(-) delete mode 100644 packages/babel/.npmignore delete mode 100644 packages/babel/README.md delete mode 100644 packages/babel/index.js delete mode 100644 packages/babel/package.json delete mode 100755 packages/babel/src/cli.js diff --git a/packages/babel/.npmignore b/packages/babel/.npmignore deleted file mode 100644 index 47cdd2c655..0000000000 --- a/packages/babel/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -src -test -node_modules diff --git a/packages/babel/README.md b/packages/babel/README.md deleted file mode 100644 index 17590de468..0000000000 --- a/packages/babel/README.md +++ /dev/null @@ -1 +0,0 @@ -# babel diff --git a/packages/babel/index.js b/packages/babel/index.js deleted file mode 100644 index 06ca959245..0000000000 --- a/packages/babel/index.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error("The node API for `babel` has been moved to `babel-core`."); diff --git a/packages/babel/package.json b/packages/babel/package.json deleted file mode 100644 index 4c03e3eb51..0000000000 --- a/packages/babel/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "babel", - "version": "6.5.2", - "description": "Turn ES6 code into readable vanilla ES5 with source maps", - "author": "Sebastian McKenzie ", - "homepage": "https://babeljs.io/", - "license": "MIT", - "repository": "https://github.com/babel/babel/tree/master/packages/babel", - "bin": { - "babel": "./lib/cli.js", - "babel-node": "./lib/cli.js", - "babel-external-helpers": "./lib/cli.js" - } -} diff --git a/packages/babel/src/cli.js b/packages/babel/src/cli.js deleted file mode 100755 index 0a6c889d7d..0000000000 --- a/packages/babel/src/cli.js +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node -import path from "path"; - -const globalMessage = path.dirname(process.execPath) === path.dirname(process.env._ || "") ? " -g" : ""; - -console.error("You have mistakenly installed the `babel` package, which is a no-op in Babel 6.\n" + - "Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.\n" + - "\n" + - " npm uninstall" + globalMessage + " babel\n" + - " npm install --save-dev babel-cli\n" + - "\n" + - "See http://babeljs.io/docs/usage/cli/ for setup instructions."); -process.exit(1); From eb91bd831c05443e3ad34b83ad405b9d8137c09a Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Mon, 13 Feb 2017 09:34:07 +0700 Subject: [PATCH 141/222] Fix PathHoister hoisting JSX member expressions on "this". (#5143) The PathHoister ignored member references on "this", causing it to potentially hoist an expression above its function scope. This patch tells the hoister to watch for "this", and if seen, mark the nearest non-arrow function scope as the upper limit for hoistng. This fixes #4397 and is an alternative to #4787. --- .../member-expression-constant/actual.js | 4 ++++ .../member-expression-constant/expected.js | 7 +++++++ .../member-expression-this/actual.js | 5 +++++ .../member-expression-this/expected.js | 12 ++++++++++++ .../member-expression-this/options.json | 3 +++ .../member-expression/actual.js | 6 ++++++ .../member-expression/expected.js | 16 ++++++++++++++++ .../member-expression/options.json | 3 +++ packages/babel-traverse/src/path/lib/hoister.js | 14 +++++++++++++- 9 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/options.json create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/options.json diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/actual.js new file mode 100644 index 0000000000..a6c1f9b6ec --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/actual.js @@ -0,0 +1,4 @@ +function render() { + this.component = "div"; + return () => ; +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/expected.js new file mode 100644 index 0000000000..aa7a9994ba --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-constant/expected.js @@ -0,0 +1,7 @@ +function render() { + this.component = "div"; + + var _ref = ; + + return () => _ref; +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/actual.js new file mode 100644 index 0000000000..bdc61d684a --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/actual.js @@ -0,0 +1,5 @@ +class Component extends React.Component { + subComponent = () => Sub Component + + render = () => +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/expected.js new file mode 100644 index 0000000000..9ce3a08e74 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/expected.js @@ -0,0 +1,12 @@ +var _ref = Sub Component; + +class Component extends React.Component { + constructor(...args) { + var _temp; + + var _ref2 = ; + + return _temp = super(...args), this.subComponent = () => _ref, this.render = () => _ref2, _temp; + } + +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/options.json new file mode 100644 index 0000000000..d4789bbda3 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression-this/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["syntax-jsx", "transform-react-constant-elements", "transform-class-properties"] +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/actual.js new file mode 100644 index 0000000000..2ab59df97b --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/actual.js @@ -0,0 +1,6 @@ +const els = { + subComponent: () => Sub Component +}; +class Component extends React.Component { + render = () => +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/expected.js new file mode 100644 index 0000000000..fe12eb988d --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/expected.js @@ -0,0 +1,16 @@ +var _ref = Sub Component; + +const els = { + subComponent: () => _ref +}; + +var _ref2 = ; + +class Component extends React.Component { + constructor(...args) { + var _temp; + + return _temp = super(...args), this.render = () => _ref2, _temp; + } + +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/options.json b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/options.json new file mode 100644 index 0000000000..d4789bbda3 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/member-expression/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["syntax-jsx", "transform-react-constant-elements", "transform-class-properties"] +} diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 93b9323bd3..c7dbf5cf73 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -2,11 +2,23 @@ import { react } from "babel-types"; import * as t from "babel-types"; const referenceVisitor = { + // This visitor looks for bindings to establish a topmost scope for hoisting. ReferencedIdentifier(path, state) { - if (path.isJSXIdentifier() && react.isCompatTag(path.node.name)) { + // Don't hoist regular JSX identifiers ('div', 'span', etc). + // We do have to consider member expressions for hoisting (e.g. `this.component`) + if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) { return; } + // If the identifier refers to `this`, we need to break on the closest non-arrow scope. + if (path.node.name === "this") { + let scope = path.scope; + do { + if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) break; + } while (scope = scope.parent); + if (scope) state.breakOnScopePaths.push(scope.path); + } + // direct references that we need to track to hoist this to the highest scope we can const binding = path.scope.getBinding(path.node.name); if (!binding) return; From f4e3dfee74e3160277c248c40f0b505ef04a7006 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Mon, 13 Feb 2017 09:35:08 +0700 Subject: [PATCH 142/222] Fix PathHoister hoisting before bindings. (#5153) Fixes #5149 and enables a few additional safe hoists. --- .../expected.js | 17 ++--- .../expected.js | 18 +++--- .../dont-hoist-before-class/actual.js | 15 +++++ .../dont-hoist-before-class/expected.js | 13 ++++ .../dont-hoist-before-declaration/expected.js | 5 +- .../dont-hoist-before-hoc/actual.js | 18 ++++++ .../dont-hoist-before-hoc/expected.js | 18 ++++++ .../babel-traverse/src/path/lib/hoister.js | 62 ++++++++++++------- 8 files changed, 125 insertions(+), 41 deletions(-) create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/expected.js diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/expected.js index cceca3a5e8..46849febf6 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/expected.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope-3/expected.js @@ -1,18 +1,19 @@ -var _ref =

Parent

; - var _ref2 =
child
; +var _ref3 =

Parent

; + (function () { class App extends React.Component { render() { - return
- {_ref} - -
; + return _ref; } } const AppItem = () => { return _ref2; - }; -}); + }, + _ref =
+ {_ref3} + +
; +}); \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/expected.js index 5fc8260845..fe04d4853f 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/expected.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/append-to-end-when-declared-in-scope/expected.js @@ -1,16 +1,14 @@ -var _ref =

Parent

; - export default class App extends React.Component { render() { - return
- {_ref} - -
; + return _ref; } } -var _ref2 =
child
; - -const AppItem = () => { +const _ref2 =
child
, + AppItem = () => { return _ref2; -}; +}, + _ref =
+

Parent

+ +
; \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/actual.js new file mode 100644 index 0000000000..0bcdd9ef7c --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/actual.js @@ -0,0 +1,15 @@ +import React from "react"; + +const Parent = ({}) => ( +
+ +
+); + +export default Parent; + +let Child = () => ( +
+ ChildTextContent +
+); diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/expected.js new file mode 100644 index 0000000000..6bcd6e0ffb --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-class/expected.js @@ -0,0 +1,13 @@ +import React from "react"; + +const Parent = ({}) => _ref; + +export default Parent; + +let _ref2 =
+ ChildTextContent +
, + Child = () => _ref2, + _ref =
+ +
; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/expected.js index d85f9f3244..45b91bd296 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/expected.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-declaration/expected.js @@ -8,8 +8,9 @@ function render() { function render() { const bar = "bar", - renderFoo = () => , - baz = "baz"; + renderFoo = () => _ref2, + baz = "baz", + _ref2 = ; return renderFoo(); } \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/actual.js new file mode 100644 index 0000000000..21f7b2ed90 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/actual.js @@ -0,0 +1,18 @@ +import React from "react"; + +const HOC = component => component; + +const Parent = ({}) => ( +
+ +
+); + +export default Parent; + +let Child = () => ( +
+ ChildTextContent +
+); +Child = HOC(Child); diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/expected.js new file mode 100644 index 0000000000..8da0cc5ad1 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-before-hoc/expected.js @@ -0,0 +1,18 @@ +import React from "react"; + +const HOC = component => component; + +const Parent = ({}) => _ref; + +export default Parent; + +var _ref2 =
+ ChildTextContent +
; + +let Child = () => _ref2; +Child = HOC(Child); + +var _ref =
+ +
; \ No newline at end of file diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index c7dbf5cf73..d39dcba7c0 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -27,25 +27,27 @@ const referenceVisitor = { // eg. it's in a closure etc if (binding !== state.scope.getBinding(path.node.name)) return; - if (binding.constant) { - state.bindings[path.node.name] = binding; - } else { - for (const violationPath of (binding.constantViolations: Array)) { - state.breakOnScopePaths = state.breakOnScopePaths.concat(violationPath.getAncestry()); - } - } + state.bindings[path.node.name] = binding; } }; export default class PathHoister { constructor(path, scope) { + // Storage for scopes we can't hoist above. this.breakOnScopePaths = []; + // Storage for bindings that may affect what path we can hoist to. this.bindings = {}; + // Storage for eligible scopes. this.scopes = []; + // Our original scope and path. this.scope = scope; this.path = path; + // By default, we attach as far up as we can; but if we're trying + // to avoid referencing a binding, we may have to go after. + this.attachAfter = false; } + // A scope is compatible if all required bindings are reachable. isCompatibleScope(scope) { for (const key in this.bindings) { const binding = this.bindings[key]; @@ -57,6 +59,7 @@ export default class PathHoister { return true; } + // Look through all scopes and push compatible ones. getCompatibleScopes() { let scope = this.path.scope; do { @@ -66,6 +69,7 @@ export default class PathHoister { break; } + // deopt: These scopes are set in the visitor on const violations if (this.breakOnScopePaths.indexOf(scope.path) >= 0) { break; } @@ -73,7 +77,7 @@ export default class PathHoister { } getAttachmentPath() { - const path = this._getAttachmentPath(); + let path = this._getAttachmentPath(); if (!path) return; let targetScope = path.scope; @@ -94,8 +98,18 @@ export default class PathHoister { // allow parameter references if (binding.kind === "param") continue; - // if this binding appears after our attachment point then don't hoist it - if (this.getAttachmentParentForPath(binding.path).key > path.key) return; + // if this binding appears after our attachment point, then we move after it. + if (this.getAttachmentParentForPath(binding.path).key > path.key) { + this.attachAfter = true; + path = binding.path; + + // We also move past any constant violations. + for (const violationPath of (binding.constantViolations: Array)) { + if (this.getAttachmentParentForPath(violationPath).key > path.key) { + path = violationPath; + } + } + } } } @@ -106,11 +120,12 @@ export default class PathHoister { const scopes = this.scopes; const scope = scopes.pop(); + // deopt: no compatible scopes if (!scope) return; if (scope.path.isFunction()) { if (this.hasOwnParamBindings(scope)) { - // should ignore this scope since it's ourselves + // deopt: should ignore this scope since it's ourselves if (this.scope === scope) return; // needs to be attached to the body @@ -129,26 +144,30 @@ export default class PathHoister { if (scope) return this.getAttachmentParentForPath(scope.path); } + // Find an attachment for this path. getAttachmentParentForPath(path) { do { - if (!path.parentPath || - (Array.isArray(path.container) && path.isStatement()) || - ( - path.isVariableDeclarator() && - path.parentPath.node !== null && - path.parentPath.node.declarations.length > 1 - ) - ) + if ( + // Beginning of the scope + !path.parentPath || + // Has siblings and is a statement + (Array.isArray(path.container) && path.isStatement()) || + // Is part of multiple var declarations + (path.isVariableDeclarator() && + path.parentPath.node !== null && + path.parentPath.node.declarations.length > 1)) return path; } while ((path = path.parentPath)); } + // Returns true if a scope has param bindings. hasOwnParamBindings(scope) { for (const name in this.bindings) { if (!scope.hasOwnBinding(name)) continue; const binding = this.bindings[name]; - if (binding.kind === "param") return true; + // Ensure constant; without it we could place behind a reassignment + if (binding.kind === "param" && binding.constant) return true; } return false; } @@ -173,7 +192,8 @@ export default class PathHoister { let uid = attachTo.scope.generateUidIdentifier("ref"); const declarator = t.variableDeclarator(uid, this.path.node); - attachTo.insertBefore([ + const insertFn = this.attachAfter ? "insertAfter" : "insertBefore"; + attachTo[insertFn]([ attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator]) ]); From 4edcd0296520197997699f4b6caa498937dd2d51 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 12 Feb 2017 18:48:07 -0800 Subject: [PATCH 143/222] Fix linting error --- packages/babel-traverse/src/path/lib/hoister.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index d39dcba7c0..69154bbc2d 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -6,7 +6,11 @@ const referenceVisitor = { ReferencedIdentifier(path, state) { // Don't hoist regular JSX identifiers ('div', 'span', etc). // We do have to consider member expressions for hoisting (e.g. `this.component`) - if (path.isJSXIdentifier() && react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) { + if ( + path.isJSXIdentifier() && + react.isCompatTag(path.node.name) && + !path.parentPath.isJSXMemberExpression() + ) { return; } From 2aa2de8c6f8ace49ab5a83a7cbab82dea90036a1 Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Mon, 13 Feb 2017 11:02:38 +0700 Subject: [PATCH 144/222] feature: Support pure expressions in transform-react-constant-elements (#4812) --- .../src/index.js | 28 +++++++++++++++++-- .../constant-elements/pure-deopt/actual.js | 5 ++++ .../constant-elements/pure-deopt/expected.js | 5 ++++ .../pure-expression-2/actual.js | 5 ++++ .../pure-expression-2/expected.js | 8 ++++++ .../pure-expression-3/actual.js | 10 +++++++ .../pure-expression-3/expected.js | 10 +++++++ .../pure-expression/actual.js | 11 ++++++++ .../pure-expression/expected.js | 8 ++++++ 9 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/expected.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/actual.js create mode 100644 packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/expected.js diff --git a/packages/babel-plugin-transform-react-constant-elements/src/index.js b/packages/babel-plugin-transform-react-constant-elements/src/index.js index a25fb67e6c..b38f2008d1 100644 --- a/packages/babel-plugin-transform-react-constant-elements/src/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/src/index.js @@ -1,4 +1,4 @@ -export default function () { +export default function ({ types: t }) { const immutabilityVisitor = { enter(path, state) { const stop = () => { @@ -11,15 +11,39 @@ export default function () { return; } + // Elements with refs are not safe to hoist. if (path.isJSXIdentifier({ name: "ref" }) && path.parentPath.isJSXAttribute({ name: path.node })) { return stop(); } + // Ignore identifiers & JSX expressions. if (path.isJSXIdentifier() || path.isIdentifier() || path.isJSXMemberExpression()) { return; } - if (!path.isImmutable()) stop(); + if (!path.isImmutable()) { + // If it's not immutable, it may still be a pure expression, such as string concatenation. + // It is still safe to hoist that, so long as its result is immutable. + // If not, it is not safe to replace as mutable values (like objects) could be mutated after render. + // https://github.com/facebook/react/issues/3226 + if (path.isPure()) { + const expressionResult = path.evaluate(); + if (expressionResult.confident) { + // We know the result; check its mutability. + const { value } = expressionResult; + const isMutable = (value && typeof value === "object") || (typeof value === "function"); + if (!isMutable) { + // It evaluated to an immutable value, so we can hoist it. + return; + } + } else if (t.isIdentifier(expressionResult.deopt)) { + // It's safe to hoist here if the deopt reason is an identifier (e.g. func param). + // The hoister will take care of how high up it can be hoisted. + return; + } + } + stop(); + } } }; diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/actual.js new file mode 100644 index 0000000000..4df51832c7 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/actual.js @@ -0,0 +1,5 @@ +// https://github.com/facebook/react/issues/3226 +// Not safe to reuse because it is mutable +function render() { + return
; +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/expected.js new file mode 100644 index 0000000000..4df51832c7 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-deopt/expected.js @@ -0,0 +1,5 @@ +// https://github.com/facebook/react/issues/3226 +// Not safe to reuse because it is mutable +function render() { + return
; +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/actual.js new file mode 100644 index 0000000000..0acb75cfaf --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/actual.js @@ -0,0 +1,5 @@ +function render(offset) { + return function () { + return
; + }; +} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/expected.js new file mode 100644 index 0000000000..65df627806 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-2/expected.js @@ -0,0 +1,8 @@ +function render(offset) { + var _ref =
; + + return function () { + return _ref; + }; +} + diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/actual.js new file mode 100644 index 0000000000..c6b89c77fd --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/actual.js @@ -0,0 +1,10 @@ +const OFFSET = 3; + +var Foo = React.createClass({ + render: function () { + return ( +
+ ); + } +}); + diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/expected.js new file mode 100644 index 0000000000..e709176c48 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression-3/expected.js @@ -0,0 +1,10 @@ +const OFFSET = 3; + +var _ref =
; + +var Foo = React.createClass({ + render: function () { + return _ref; + } +}); + diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/actual.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/actual.js new file mode 100644 index 0000000000..5131c83989 --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/actual.js @@ -0,0 +1,11 @@ +var Foo = React.createClass({ + render: function () { + return ( +
+ ); + } +}); + diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/expected.js new file mode 100644 index 0000000000..a7afcb1d6e --- /dev/null +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/pure-expression/expected.js @@ -0,0 +1,8 @@ +var _ref =
; + +var Foo = React.createClass({ + render: function () { + return _ref; + } +}); + From ca45904a45e60fe4ebebeb4d0038041bb616f3c7 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Mon, 13 Feb 2017 10:30:36 -0500 Subject: [PATCH 145/222] Fix loose for-of with label (#5298) --- .../src/index.js | 18 +++++++---- .../loose/nested-label-for-of/actual.js | 5 +++ .../loose/nested-label-for-of/expected.js | 31 +++++++++++++++++++ 3 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/actual.js create mode 100644 packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/expected.js diff --git a/packages/babel-plugin-transform-es2015-for-of/src/index.js b/packages/babel-plugin-transform-es2015-for-of/src/index.js index 958eae6bce..b0b3a6bcbf 100644 --- a/packages/babel-plugin-transform-es2015-for-of/src/index.js +++ b/packages/babel-plugin-transform-es2015-for-of/src/index.js @@ -135,9 +135,8 @@ export default function ({ messages, template, types: t }) { }; function loose(path, file) { - const { node, scope } = path; - - const left = node.left; + const { node, scope, parent } = path; + const { left } = node; let declar, id; if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { @@ -171,11 +170,18 @@ export default function ({ messages, template, types: t }) { } // + const isLabeledParent = t.isLabeledStatement(parent); + let labeled; + + if (isLabeledParent) { + labeled = t.labeledStatement(parent.label, loop); + } return { - declar: declar, - node: loop, - loop: loop + replaceParent: isLabeledParent, + declar: declar, + node: labeled || loop, + loop: loop }; } diff --git a/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/actual.js b/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/actual.js new file mode 100644 index 0000000000..73c8203449 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/actual.js @@ -0,0 +1,5 @@ +b: for (let c of d()) { + for (let e of f()) { + continue b; + } +} diff --git a/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/expected.js b/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/expected.js new file mode 100644 index 0000000000..e3e9396649 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-for-of/test/fixtures/loose/nested-label-for-of/expected.js @@ -0,0 +1,31 @@ +b: for (var _iterator = d(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + + let c = _ref; + + for (var _iterator2 = f(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref2; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref2 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref2 = _i2.value; + } + + let e = _ref2; + + continue b; + } +} From 2985597d40339daccd7cf7a2682c61e066a34c21 Mon Sep 17 00:00:00 2001 From: Yongxu Ren Date: Mon, 13 Feb 2017 15:49:10 -0500 Subject: [PATCH 146/222] Rewrite Hub as interface #5047 (#5050) * Rewrite Hub as interface #5047 * Update index.js --- .../src/transformation/file/index.js | 21 ++++++++++++++++--- packages/babel-traverse/src/hub.js | 14 ++++++++++--- packages/babel-traverse/src/index.js | 16 +++++++------- packages/babel-traverse/src/path/index.js | 10 ++++----- .../babel-traverse/src/path/introspection.js | 8 ++++--- packages/babel-traverse/src/scope/index.js | 9 ++++---- packages/babel-traverse/test/hub.js | 13 ++++++++++++ 7 files changed, 64 insertions(+), 27 deletions(-) create mode 100644 packages/babel-traverse/test/hub.js diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 50b641c194..9866b147a8 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -6,7 +6,8 @@ import convertSourceMap from "convert-source-map"; import OptionManager from "./options/option-manager"; import type Pipeline from "../pipeline"; import PluginPass from "../plugin-pass"; -import { NodePath, Hub, Scope } from "babel-traverse"; +import { NodePath, Scope } from "babel-traverse"; +import type { HubInterface } from "babel-traverse"; import sourceMap from "source-map"; import generate from "babel-generator"; import codeFrame from "babel-code-frame"; @@ -98,7 +99,21 @@ export default class File extends Store { this.code = ""; this.shebang = ""; - this.hub = new Hub(this); + this.hub = { + // keep it for the usage in babel-core, ex: path.hub.file.opts.filename + file: this, + mark: (type: string, message: string, loc: Object) => { + this.metadata.marked.push({ + type, + message, + loc + }); + }, + addHelper: this.addHelper.bind(this), + getCode: () => this.code, + getScope: () => this.scope, + buildError: this.buildCodeFrameError.bind(this) + }; } static helpers: Array; @@ -118,7 +133,7 @@ export default class File extends Store { ast: Object; scope: Scope; metadata: BabelFileMetadata; - hub: Hub; + hub: HubInterface; code: string; shebang: string; diff --git a/packages/babel-traverse/src/hub.js b/packages/babel-traverse/src/hub.js index f05eaa8136..d4151a16ed 100644 --- a/packages/babel-traverse/src/hub.js +++ b/packages/babel-traverse/src/hub.js @@ -1,6 +1,14 @@ +import Scope from "./scope"; +export interface HubInterface { + mark?: (type: string, message: string) => void; + addHelper?: (name: string) => Object; + getScope?: () => Scope; + getCode?: () => string; + buildError:(node: Object, msg: string, Error: Error) => Error; +} + export default class Hub { - constructor(file, options) { - this.file = file; - this.options = options; + buildError(node, msg, BuildError = TypeError): Error { + return new BuildError(msg); } } diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 1c5c96b58c..6d6215e308 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -5,10 +5,12 @@ import includes from "lodash/includes"; import * as t from "babel-types"; import * as cache from "./cache"; -export { default as NodePath } from "./path"; -export { default as Scope } from "./scope"; -export { default as Hub } from "./hub"; -export { visitors }; +import NodePath from "./path"; +import Scope from "./scope"; +import Hub from "./hub"; + +export { visitors, NodePath, Scope, Hub }; +export type { HubInterface } from "./hub"; export default function traverse( parent: Object | Array, @@ -35,9 +37,9 @@ traverse.visitors = visitors; traverse.verify = visitors.verify; traverse.explode = visitors.explode; -traverse.NodePath = require("./path"); -traverse.Scope = require("./scope"); -traverse.Hub = require("./hub"); +traverse.NodePath = NodePath; +traverse.Scope = Scope; +traverse.Hub = Hub; traverse.cheap = function (node, enter) { return t.traverseFast(node, enter); diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index c66d0e8482..41d60c3e47 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -114,7 +114,7 @@ export default class NodePath { } buildCodeFrameError(msg: string, Error: typeof Error = SyntaxError): Error { - return this.hub.file.buildCodeFrameError(this.node, msg, Error); + return this.hub.buildError(this.node, msg, Error); } traverse(visitor: Object, state?: any) { @@ -122,11 +122,9 @@ export default class NodePath { } mark(type: string, message: string) { - this.hub.file.metadata.marked.push({ - type, - message, - loc: this.node.loc - }); + if (this.hub.mark) { + this.hub.mark(type, message, this.node.loc); + } } set(key: string, node: Object) { diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index e8e54f18c0..0a722e61be 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -235,10 +235,12 @@ export function referencesImport(moduleSource, importName) { export function getSource() { const node = this.node; if (node.end) { - return this.hub.file.code.slice(node.start, node.end); - } else { - return ""; + const code = this.hub.getCode(); + if (code) { + return code.slice(node.start, node.end); + } } + return ""; } export function willIMaybeExecuteBefore(target) { diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index a0b26bc573..1df4c8e485 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -346,7 +346,8 @@ export default class Scope { local.kind === "param" && (kind === "let" || kind === "const"); if (duplicate) { - throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError); + const errorMsg = messages.get("scopeDuplicateDeclaration", name); + throw this.hub.buildError ? this.hub.buildError(id, errorMsg, TypeError) : new TypeError(errorMsg); } } @@ -385,8 +386,6 @@ export default class Scope { } toArray(node: Object, i?: number) { - const file = this.hub.file; - if (t.isIdentifier(node)) { const binding = this.getBinding(node.name); if (binding && binding.constant && binding.path.isGenericType("Array")) return node; @@ -419,9 +418,9 @@ export default class Scope { } else if (i) { args.push(t.numericLiteral(i)); helperName = "slicedToArray"; - // TODO if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose"; + // TODO if (this.hub.isLoose("es6.forOf")) helperName += "-loose"; } - return t.callExpression(file.addHelper(helperName), args); + return t.callExpression(this.hub.addHelper(helperName), args); } hasLabel(name: string) { diff --git a/packages/babel-traverse/test/hub.js b/packages/babel-traverse/test/hub.js new file mode 100644 index 0000000000..a3d67bb9d8 --- /dev/null +++ b/packages/babel-traverse/test/hub.js @@ -0,0 +1,13 @@ +const assert = require("assert"); +const Hub = require("../lib").default.Hub; + +describe("hub", function () { + it("default buildError should return TypeError", function () { + const hub = new Hub(); + const msg = "test_msg"; + assert.deepEqual( + hub.buildError(null, msg), + new TypeError(msg) + ); + }); +}); From 14d3c2e256246c306d916a171c2d1301c9b7989c Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Mon, 13 Feb 2017 13:46:00 -0800 Subject: [PATCH 147/222] Avoid adding unnecessary closure for block scoping (#5246) When you write ``` for (const x of l) { setTimeout(() => x); } ``` we need to add a closure because the variable is meant to be block-scoped and recreated each time the block runs. We do this. However, we also add the closure when no loop is present. This isn't necessary, because if no loop is present then each piece of code runs at most once. I changed the transform to only add a closure if a variable is referenced from within a loop. --- .../misc/regression-2364/actual.js | 2 +- .../misc/regression-2364/expected.js | 22 ++++---- .../src/index.js | 27 +++++++++- .../fixtures/general/issue-2174/expected.js | 14 +++--- .../general/loops-and-no-loops/actual.js | 34 +++++++++++++ .../general/loops-and-no-loops/expected.js | 42 ++++++++++++++++ .../fixtures/general/sibling-scopes/actual.js | 11 ++++ .../general/sibling-scopes/expected.js | 15 ++++++ .../fixtures/general/superswitch/actual.js | 24 +++++---- .../fixtures/general/superswitch/expected.js | 50 ++++++++++--------- .../general/switch-callbacks/actual.js | 14 +++--- .../general/switch-callbacks/expected.js | 26 +++++----- .../for-const-closure/expected.js | 6 +++ .../superswitch/actual.js | 16 ------ .../superswitch/options.json | 3 -- .../expected.js | 14 ++---- 16 files changed, 217 insertions(+), 103 deletions(-) create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/actual.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/expected.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/actual.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/expected.js create mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/expected.js delete mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js delete mode 100644 packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-2364/actual.js b/packages/babel-core/test/fixtures/transformation/misc/regression-2364/actual.js index e995e0d234..c2ae386b34 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-2364/actual.js +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-2364/actual.js @@ -1,6 +1,6 @@ function wrapper(fn) { return (...args) => { - if (someCondition) { + while (someCondition) { const val = fn(...args); return val.test(() => { console.log(val); diff --git a/packages/babel-core/test/fixtures/transformation/misc/regression-2364/expected.js b/packages/babel-core/test/fixtures/transformation/misc/regression-2364/expected.js index ae32dbb4d3..c1079c01cb 100644 --- a/packages/babel-core/test/fixtures/transformation/misc/regression-2364/expected.js +++ b/packages/babel-core/test/fixtures/transformation/misc/regression-2364/expected.js @@ -2,17 +2,19 @@ function wrapper(fn) { return function () { var _arguments = arguments; - if (someCondition) { - var _ret = function () { - var val = fn(..._arguments); - return { - v: val.test(function () { - console.log(val); - }) - }; - }(); + var _loop = function () { + var val = fn(..._arguments); + return { + v: val.test(function () { + console.log(val); + }) + }; + }; + + while (someCondition) { + var _ret = _loop(); if (typeof _ret === "object") return _ret.v; } }; -} \ No newline at end of file +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index b1227d3a52..f633054622 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -112,8 +112,21 @@ function isVar(node) { } const letReferenceBlockVisitor = traverse.visitors.merge([{ + Loop: { + enter(path, state) { + state.loopDepth++; + }, + exit(path, state) { + state.loopDepth--; + }, + }, Function(path, state) { - path.traverse(letReferenceFunctionVisitor, state); + // References to block-scoped variables only require added closures if it's + // possible for the code to run more than once -- otherwise it is safe to + // simply rename the variables. + if (state.loopDepth > 0) { + path.traverse(letReferenceFunctionVisitor, state); + } return path.skip(); } }, tdzVisitor]); @@ -549,9 +562,19 @@ class BlockScoping { const state = { letReferences: this.letReferences, closurify: false, - file: this.file + file: this.file, + loopDepth: 0, }; + const loopOrFunctionParent = this.blockPath.find( + (path) => path.isLoop() || path.isFunction() + ); + if (loopOrFunctionParent && loopOrFunctionParent.isLoop()) { + // There is a loop ancestor closer than the closest function, so we + // consider ourselves to be in a loop. + state.loopDepth++; + } + // traverse through this block, stopping on functions and checking if they // contain any local let references this.blockPath.traverse(letReferenceBlockVisitor, state); diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/issue-2174/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/issue-2174/expected.js index 1dce9c4c17..9efbc1091f 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/issue-2174/expected.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/issue-2174/expected.js @@ -1,11 +1,9 @@ if (true) { - var x; + var foo = function () {}; - (function () { - function foo() {} - function bar() { - return foo; - } - for (x in {}) {} - })(); + var bar = function () { + return foo; + }; + + for (var x in {}) {} } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/actual.js new file mode 100644 index 0000000000..f030ac811d --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/actual.js @@ -0,0 +1,34 @@ +function foo() { + const x = 5; + console.log(x); + + { + const x = 7; + setTimeout(() => x, 0); + } +} + +function bar() { + const x = 5; + console.log(x); + + for (let i = 0; i < 7; i++) { + { + const x = i; + setTimeout(() => x, 0); + } + } +} + +function baz() { + const x = 5; + console.log(x); + + for (let i = 0; i < 7; i++) { + var qux = function qux(y) { + const x = y; + setTimeout(() => x, 0); + }; + qux(i); + } +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/expected.js new file mode 100644 index 0000000000..a86a2e4811 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/loops-and-no-loops/expected.js @@ -0,0 +1,42 @@ +function foo() { + var x = 5; + console.log(x); + + { + var _x = 7; + setTimeout(function () { + return _x; + }, 0); + } +} + +function bar() { + var x = 5; + console.log(x); + + for (var i = 0; i < 7; i++) { + { + (function () { + var x = i; + setTimeout(function () { + return x; + }, 0); + })(); + } + } +} + +function baz() { + var x = 5; + console.log(x); + + for (var i = 0; i < 7; i++) { + var qux = function qux(y) { + var x = y; + setTimeout(function () { + return x; + }, 0); + }; + qux(i); + } +} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/actual.js new file mode 100644 index 0000000000..e3020dada7 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/actual.js @@ -0,0 +1,11 @@ +var f1, f2; +{ + let z = 'z1 value'; + f1 = function() { return z; }; +} +{ + let z = 'z2 value'; + f2 = function() { return z; }; +} +f1(); +f2(); diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/expected.js new file mode 100644 index 0000000000..8bbdfc7ddf --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/sibling-scopes/expected.js @@ -0,0 +1,15 @@ +var f1, f2; +{ + var z = 'z1 value'; + f1 = function () { + return z; + }; +} +{ + var _z = 'z2 value'; + f2 = function () { + return _z; + }; +} +f1(); +f2(); \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/actual.js index 857b8641f4..5dedf9a592 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/actual.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/actual.js @@ -1,16 +1,18 @@ function foo() { - switch (2) { - case 0: { - if (true) { - return; - } + while (true) { + switch (2) { + case 0: { + if (true) { + return; + } - const stuff = new Map(); - const data = 0; - stuff.forEach(() => { - const d = data; - }); - break; + const stuff = new Map(); + const data = 0; + stuff.forEach(() => { + const d = data; + }); + break; + } } } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/expected.js index 05d7afe3d9..80b21eba9c 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/expected.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/superswitch/expected.js @@ -1,29 +1,31 @@ function foo() { - switch (2) { - case 0: - { - var _ret = function () { - if (true) { - return { - v: void 0 - }; + while (true) { + switch (2) { + case 0: + { + var _ret = function () { + if (true) { + return { + v: void 0 + }; + } + + var stuff = new Map(); + var data = 0; + stuff.forEach(function () { + var d = data; + }); + return "break"; + }(); + + switch (_ret) { + case "break": + break; + + default: + if (typeof _ret === "object") return _ret.v; } - - var stuff = new Map(); - var data = 0; - stuff.forEach(function () { - var d = data; - }); - return "break"; - }(); - - switch (_ret) { - case "break": - break; - - default: - if (typeof _ret === "object") return _ret.v; } - } + } } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/actual.js index c57bdc6e51..99f8726f05 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/actual.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/actual.js @@ -1,10 +1,12 @@ function fn() { - switch (true) { - default: - let foo = 4; - if (true) { - let bar = () => foo; - console.log(bar()); + while (true) { + switch (true) { + default: + let foo = 4; + if (true) { + let bar = () => foo; + console.log(bar()); + } } } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/expected.js index 2efd145af3..40f23daea6 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/expected.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/general/switch-callbacks/expected.js @@ -1,14 +1,16 @@ function fn() { - (function () { - switch (true) { - default: - var foo = 4; - if (true) { - var bar = function () { - return foo; - }; - console.log(bar()); - } - } - })(); + while (true) { + (function () { + switch (true) { + default: + var foo = 4; + if (true) { + var bar = function () { + return foo; + }; + console.log(bar()); + } + } + })(); + } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/expected.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/expected.js new file mode 100644 index 0000000000..c28cb3bf74 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/for-const-closure/expected.js @@ -0,0 +1,6 @@ +for (var i = 0; i < 5; i++) { + var l = i; + setTimeout(function () { + console.log(l); + }, 1); +} \ No newline at end of file diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js deleted file mode 100644 index 857b8641f4..0000000000 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/actual.js +++ /dev/null @@ -1,16 +0,0 @@ -function foo() { - switch (2) { - case 0: { - if (true) { - return; - } - - const stuff = new Map(); - const data = 0; - stuff.forEach(() => { - const d = data; - }); - break; - } - } -} diff --git a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json b/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json deleted file mode 100644 index d210fdebfc..0000000000 --- a/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/throwIfClosureRequired/superswitch/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Compiling let/const in this block would add a closure (throwIfClosureRequired)." -} diff --git a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-block-scoped-variables/expected.js b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-block-scoped-variables/expected.js index 9618e6da02..ab6ad7d4c4 100644 --- a/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-block-scoped-variables/expected.js +++ b/packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/dont-hoist-block-scoped-variables/expected.js @@ -1,17 +1,11 @@ function render(flag) { if (flag) { - var _ret = function () { - var bar = "bar"; + var bar = "bar"; - [].map(() => bar); + [].map(() => bar); - return { - v: - }; - }(); - - if (typeof _ret === "object") return _ret.v; + return ; } return null; -} \ No newline at end of file +} From 6522a255d9bddf5bb925c6303c33df304803c4d3 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 13 Feb 2017 15:56:12 -0600 Subject: [PATCH 148/222] Add greenkeeperio-bot to mention-bot blacklist (#5301) [skip ci] --- .mention-bot | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.mention-bot b/.mention-bot index 32b2d0479e..671103a31c 100644 --- a/.mention-bot +++ b/.mention-bot @@ -1,5 +1,11 @@ { - "userBlacklist": [ "amasad", "thejameskyle", "jmm", "kittens" ], + "userBlacklist": [ + "amasad", + "greenkeeperio-bot", + "jmm", + "kittens", + "thejameskyle" + ], "fileBlacklist": ["*.md"], "skipAlreadyAssignedPR": true, "createReviewRequest": true From 8a28c07d20b90e421ec930b74f71946b205aff4f Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 14:01:57 -0800 Subject: [PATCH 149/222] Upgrade lerna to current beta. (#5300) --- lerna.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 2858f12c31..90806c2590 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-beta.23", + "lerna": "2.0.0-beta.37", "version": "6.22.2", "changelog": { "repo": "babel/babel", diff --git a/package.json b/package.json index 90db588cb8..240cdb5bec 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "gulp-plumber": "^1.0.1", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", - "lerna": "2.0.0-beta.23", + "lerna": "2.0.0-beta.37", "lerna-changelog": "^0.2.0", "lodash": "^4.2.0", "mocha": "^3.0.0", From 1c1e9c764b2e92e708156ef1e5941f991bdcc8e6 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 14:20:10 -0800 Subject: [PATCH 150/222] Revert "Upgrade lerna to current beta." (#5303) --- lerna.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 90806c2590..2858f12c31 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-beta.37", + "lerna": "2.0.0-beta.23", "version": "6.22.2", "changelog": { "repo": "babel/babel", diff --git a/package.json b/package.json index 240cdb5bec..90db588cb8 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "gulp-plumber": "^1.0.1", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", - "lerna": "2.0.0-beta.37", + "lerna": "2.0.0-beta.23", "lerna-changelog": "^0.2.0", "lodash": "^4.2.0", "mocha": "^3.0.0", From e1fee21529f89cf773fcbfa3063db357a6a0fda3 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 14:37:41 -0800 Subject: [PATCH 151/222] Add charset so tests work with convert-source-map@>1.4 (#5302) --- .../test/fixtures/transformation/source-maps/inline/expected.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/inline/expected.js b/packages/babel-core/test/fixtures/transformation/source-maps/inline/expected.js index 00ae47b875..991056b8bf 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/inline/expected.js +++ b/packages/babel-core/test/fixtures/transformation/source-maps/inline/expected.js @@ -1,4 +1,4 @@ arr.map(function (x) { return x * x; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9hY3R1YWwuanMiXSwibmFtZXMiOlsiYXJyIiwibWFwIiwieCJdLCJtYXBwaW5ncyI6IkFBQUFBLElBQUlDLEdBQUosQ0FBUTtBQUFBLFNBQUtDLElBQUlBLENBQVQ7QUFBQSxDQUFSIiwiZmlsZSI6InNvdXJjZS1tYXBzL2lubGluZS9leHBlY3RlZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il19 +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS1tYXBzL2lubGluZS9hY3R1YWwuanMiXSwibmFtZXMiOlsiYXJyIiwibWFwIiwieCJdLCJtYXBwaW5ncyI6IkFBQUFBLElBQUlDLEdBQUosQ0FBUTtBQUFBLFNBQUtDLElBQUlBLENBQVQ7QUFBQSxDQUFSIiwiZmlsZSI6InNvdXJjZS1tYXBzL2lubGluZS9leHBlY3RlZC5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogeCk7Il19 From cc5750d151780e50421db0bdd00da12896e83086 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 14:57:26 -0800 Subject: [PATCH 152/222] Add CHANGELOG for 6.23.0 [skip ci] (#5304) --- CHANGELOG.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ff3de0e51..96d28278e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,96 @@ _Note: Gaps between patch versions are faulty, broken or test releases._ See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog. +## 6.23.0 (2017-02-13) + +#### :rocket: New Feature +* `babel-plugin-transform-react-constant-elements` + * [#4812](https://github.com/babel/babel/pull/4812) feature: Support pure expressions in transform-react-constant-elements. ([@STRML](https://github.com/STRML)) +* `babel-preset-flow`, `babel-preset-react` + * [#5288](https://github.com/babel/babel/pull/5288) Add new flow preset. ([@thejameskyle](https://github.com/thejameskyle)) +* `babel-traverse` + * [#5230](https://github.com/babel/babel/pull/5230) Add path/family sibling traversal methods. ([@chitchu](https://github.com/chitchu)) +* `babel-plugin-transform-es2015-block-scoping` + * [#5236](https://github.com/babel/babel/pull/5236) Add option to block-scoping to throw on slow code. ([@spicyj](https://github.com/spicyj)) + +#### :bug: Bug Fix +* `babel-core`, `babel-traverse` + * [#5050](https://github.com/babel/babel/pull/5050) Rewrite Hub as interface #5047. ([@yongxu](https://github.com/yongxu)) +* `babel-plugin-transform-es2015-for-of` + * [#5298](https://github.com/babel/babel/pull/5298) Fix loose for-of with label. ([@jridgewell](https://github.com/jridgewell)) +* `babel-plugin-transform-react-constant-elements`, `babel-traverse` + * [#5153](https://github.com/babel/babel/pull/5153) Fix react constant elements bindings. ([@STRML](https://github.com/STRML)) + * [#5143](https://github.com/babel/babel/pull/5143) Fix PathHoister hoisting JSX member expressions on "this".. ([@STRML](https://github.com/STRML)) +* `babel-plugin-transform-do-expressions`, `babel-traverse` + * [#5030](https://github.com/babel/babel/pull/5030) Prevent multiple return statements in a loop when replacing expressions. ([@existentialism](https://github.com/existentialism)) +* `babel-register` + * [#5260](https://github.com/babel/babel/pull/5260) Fix TypeError with babel-register's cache. ([@xtuc](https://github.com/xtuc)) +* `babel-traverse` + * [#5206](https://github.com/babel/babel/pull/5206) Deopt evaluation of undefined with a local binding. Closes [#5204](https://github.com/babel/babel/issues/5204). ([@boopathi](https://github.com/boopathi)) +* `babel-plugin-transform-runtime` + * [#5195](https://github.com/babel/babel/pull/5195) Don't transpile ES7 symbol properties. ([@taion](https://github.com/taion)) +* `babel` + * [#5258](https://github.com/babel/babel/pull/5258) checks if babel is installed globally and displays correct cli message. ([@xtina-starr](https://github.com/xtina-starr)) +* `babel-generator` + * [#5270](https://github.com/babel/babel/pull/5270) Emit parens for await of ternary expressions. ([@erikdesjardins](https://github.com/erikdesjardins)) + * [#5193](https://github.com/babel/babel/pull/5193) Fix missing parens when function expressions is tag. ([@existentialism](https://github.com/existentialism)) +* `babel-plugin-transform-es2015-modules-commonjs` + * [#5235](https://github.com/babel/babel/pull/5235) Limit export node default assignment stack size #4323. ([@mattste](https://github.com/mattste)) + +#### :memo: Documentation +* `babel-*` + * [#5244](https://github.com/babel/babel/pull/5244) Normalize options sections in docs [skip ci]. ([@existentialism](https://github.com/existentialism)) + * [#5216](https://github.com/babel/babel/pull/5216) Remove link to REPL. ([@xtuc](https://github.com/xtuc)) +* Other + * [#5242](https://github.com/babel/babel/pull/5242) Add our business model [skip ci]. ([@hzoo](https://github.com/hzoo)) +* `babel-plugin-transform-es2015-spread` + * [#5227](https://github.com/babel/babel/pull/5227) Add example to spread README [skip ci]. ([@finkef](https://github.com/finkef)) +* `babel-plugin-transform-flow-strip-types` + * [#5212](https://github.com/babel/babel/pull/5212) Remove REPL link transform-flow-strip-types doc. ([@xtuc](https://github.com/xtuc)) +* `babel-plugin-transform-regenerator` + * [#5202](https://github.com/babel/babel/pull/5202) Fix transform-regenerator README. ([@xtuc](https://github.com/xtuc)) +* `babel-plugin-transform-es2015-arrow-functions` + * [#5200](https://github.com/babel/babel/pull/5200) Fix transform-es2015-arrow-functions code blocks on the website. ([@xtuc](https://github.com/xtuc)) + * [#5194](https://github.com/babel/babel/pull/5194) Fix transform-es2015-arrow-functions README. ([@xtuc](https://github.com/xtuc)) + +#### :house: Internal +* `babel-core` + * [#5302](https://github.com/babel/babel/pull/5302) Add charset so tests work with convert-source-map@>1.4. ([@loganfsmyth](https://github.com/loganfsmyth)) +* `babel-core`, `babel-traverse` + * [#5050](https://github.com/babel/babel/pull/5050) Rewrite Hub as interface #5047. ([@yongxu](https://github.com/yongxu)) +* `babel-generator` + * [#5255](https://github.com/babel/babel/pull/5255) codegen performance: use trim instead of lodash/trimEnd. ([@jwbay](https://github.com/jwbay)) +* `babel-types` + * [#5181](https://github.com/babel/babel/pull/5181) Remove uses of lodash/compact. ([@zertosh](https://github.com/zertosh)) +* `babel-*` + * [#5265](https://github.com/babel/babel/pull/5265) Re-enable the max-len ESLint rule.. ([@loganfsmyth](https://github.com/loganfsmyth)) +* Other + * [#5264](https://github.com/babel/babel/pull/5264) Add a sublime project file. ([@loganfsmyth](https://github.com/loganfsmyth)) + * [#5182](https://github.com/babel/babel/pull/5182) Run coverage only once. ([@existentialism](https://github.com/existentialism)) + * [#5165](https://github.com/babel/babel/pull/5165) Add Node 7 to CI. ([@chicoxyzzy](https://github.com/chicoxyzzy)) + +#### Committers: 20 +- Andres Suarez ([zertosh](https://github.com/zertosh)) +- Ben Alpert ([spicyj](https://github.com/spicyj)) +- Boopathi Rajaa ([boopathi](https://github.com/boopathi)) +- Brian Ng ([existentialism](https://github.com/existentialism)) +- Christina ([xtina-starr](https://github.com/xtina-starr)) +- Erik Desjardins ([erikdesjardins](https://github.com/erikdesjardins)) +- Fabian Finke ([finkef](https://github.com/finkef)) +- Henry Zhu ([hzoo](https://github.com/hzoo)) +- Jimmy Jia ([taion](https://github.com/taion)) +- Justin Ridgewell ([jridgewell](https://github.com/jridgewell)) +- Logan Smyth ([loganfsmyth](https://github.com/loganfsmyth)) +- Matt Stewart ([mattste](https://github.com/mattste)) +- Samuel Reed ([STRML](https://github.com/STRML)) +- Sergey Rubanov ([chicoxyzzy](https://github.com/chicoxyzzy)) +- Sven SAULEAU ([xtuc](https://github.com/xtuc)) +- Vicente Jr Yuchitcho ([chitchu](https://github.com/chitchu)) +- Yongxu Ren ([yongxu](https://github.com/yongxu)) +- [jwbay](https://github.com/jwbay) +- james kyle ([thejameskyle](https://github.com/thejameskyle)) +- Łukasz Lityński ([hex13](https://github.com/hex13)) + ## 6.22.2 (2017-01-19) #### :bug: Bug Fix From 24400c5b66d002945739e90197ee1ab6cec5ce25 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 15:00:37 -0800 Subject: [PATCH 153/222] Update babel-types README from script. --- packages/babel-types/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index 13b2ec3a5a..6833883629 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -930,6 +930,7 @@ Aliases: `ModuleSpecifier` - `local`: `Identifier` (required) - `imported`: `Identifier` (required) + - `importKind`: `null | 'type' | 'typeof'` (default: `null`) --- From 48573f1fb4e632add2c000bec3f95d88ebea4440 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 17:14:12 -0800 Subject: [PATCH 154/222] v6.23.0 --- lerna.json | 4 ++-- packages/babel-cli/package.json | 8 ++++---- packages/babel-core/package.json | 20 +++++++++---------- packages/babel-generator/package.json | 6 +++--- .../package.json | 4 ++-- packages/babel-helper-define-map/package.json | 6 +++--- .../babel-helper-function-name/package.json | 8 ++++---- .../package.json | 4 ++-- .../babel-helper-replace-supers/package.json | 12 +++++------ .../package.json | 6 +++--- packages/babel-helpers/package.json | 4 ++-- packages/babel-messages/package.json | 2 +- .../package.json | 6 +++--- .../package.json | 8 ++++---- .../package.json | 18 ++++++++--------- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 6 +++--- .../package.json | 4 ++-- .../package.json | 4 ++-- .../package.json | 8 ++++---- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 4 ++-- .../package.json | 2 +- packages/babel-polyfill/package.json | 2 +- packages/babel-preset-flow/package.json | 2 +- packages/babel-preset-react/package.json | 8 ++++---- packages/babel-register/package.json | 4 ++-- packages/babel-template/package.json | 6 +++--- packages/babel-traverse/package.json | 8 ++++---- packages/babel-types/package.json | 2 +- packages/babel/package.json | 2 +- 36 files changed, 96 insertions(+), 96 deletions(-) diff --git a/lerna.json b/lerna.json index 2858f12c31..bbf4c7ff5b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { - "lerna": "2.0.0-beta.23", - "version": "6.22.2", + "lerna": "2.0.0-beta.37", + "version": "6.23.0", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index f06fccc0be..b2f56d6cfa 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "babel-cli", - "version": "6.22.2", + "version": "6.23.0", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -16,9 +16,9 @@ "compiler" ], "dependencies": { - "babel-core": "^6.22.1", - "babel-register": "^6.22.0", - "babel-polyfill": "^6.22.0", + "babel-core": "^6.23.0", + "babel-register": "^6.23.0", + "babel-polyfill": "^6.23.0", "babel-runtime": "^6.22.0", "commander": "^2.8.1", "convert-source-map": "^1.1.0", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index a9cbeb1f8b..bc6c623098 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.22.1", + "version": "6.23.0", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -27,14 +27,14 @@ }, "dependencies": { "babel-code-frame": "^6.22.0", - "babel-generator": "^6.22.0", - "babel-helpers": "^6.22.0", - "babel-messages": "^6.22.0", - "babel-template": "^6.22.0", + "babel-generator": "^6.23.0", + "babel-helpers": "^6.23.0", + "babel-messages": "^6.23.0", + "babel-template": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-register": "^6.22.0", - "babel-traverse": "^6.22.1", - "babel-types": "^6.22.0", + "babel-register": "^6.23.0", + "babel-traverse": "^6.23.0", + "babel-types": "^6.23.0", "babylon": "^6.11.0", "convert-source-map": "^1.1.0", "debug": "^2.1.1", @@ -48,7 +48,7 @@ }, "devDependencies": { "babel-helper-fixtures": "^6.22.0", - "babel-helper-transform-fixture-test-runner": "^6.22.0", - "babel-polyfill": "^6.22.0" + "babel-helper-transform-fixture-test-runner": "^6.23.0", + "babel-polyfill": "^6.23.0" } } diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index c55b973d6d..0212353f43 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "babel-generator", - "version": "6.22.0", + "version": "6.23.0", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,9 +11,9 @@ "lib" ], "dependencies": { - "babel-messages": "^6.22.0", + "babel-messages": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0", + "babel-types": "^6.23.0", "detect-indent": "^4.0.0", "jsesc": "^1.3.0", "lodash": "^4.2.0", diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index 96eda6166a..6fed8d9b0d 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-builder-react-jsx", - "version": "6.22.0", + "version": "6.23.0", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", "main": "lib/index.js", "dependencies": { "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0", + "babel-types": "^6.23.0", "esutils": "^2.0.0", "lodash": "^4.2.0" } diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index 615b8f7a05..d90b57f8b8 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-define-map", - "version": "6.22.0", + "version": "6.23.0", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", @@ -8,7 +8,7 @@ "dependencies": { "babel-runtime": "^6.22.0", "lodash": "^4.2.0", - "babel-types": "^6.22.0", - "babel-helper-function-name": "^6.22.0" + "babel-types": "^6.23.0", + "babel-helper-function-name": "^6.23.0" } } diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index a6482601d9..d131f2e387 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,15 +1,15 @@ { "name": "babel-helper-function-name", - "version": "6.22.0", + "version": "6.23.0", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", "main": "lib/index.js", "dependencies": { "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0", - "babel-traverse": "^6.22.0", + "babel-types": "^6.23.0", + "babel-traverse": "^6.23.0", "babel-helper-get-function-arity": "^6.22.0", - "babel-template": "^6.22.0" + "babel-template": "^6.23.0" } } diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index a033ad6dd9..888f412beb 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-optimise-call-expression", - "version": "6.22.0", + "version": "6.23.0", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", "main": "lib/index.js", "dependencies": { "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0" + "babel-types": "^6.23.0" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index e9fd9c65eb..2401573e5d 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,16 +1,16 @@ { "name": "babel-helper-replace-supers", - "version": "6.22.0", + "version": "6.23.0", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.22.0", + "babel-helper-optimise-call-expression": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-traverse": "^6.22.0", - "babel-messages": "^6.22.0", - "babel-template": "^6.22.0", - "babel-types": "^6.22.0" + "babel-traverse": "^6.23.0", + "babel-messages": "^6.23.0", + "babel-template": "^6.23.0", + "babel-types": "^6.23.0" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index 61e7603096..6b4b60f922 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-transform-fixture-test-runner", - "version": "6.22.0", + "version": "6.23.0", "description": "Transform test runner for babel-helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,8 +9,8 @@ "main": "lib/index.js", "dependencies": { "babel-runtime": "^6.22.0", - "babel-core": "^6.22.0", - "babel-polyfill": "^6.22.0", + "babel-core": "^6.23.0", + "babel-polyfill": "^6.23.0", "babel-helper-fixtures": "^6.22.0", "source-map": "^0.5.0", "babel-code-frame": "^6.22.0", diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index a88c869426..15172747db 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "babel-helpers", - "version": "6.22.0", + "version": "6.23.0", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,6 +9,6 @@ "main": "lib/index.js", "dependencies": { "babel-runtime": "^6.22.0", - "babel-template": "^6.22.0" + "babel-template": "^6.23.0" } } diff --git a/packages/babel-messages/package.json b/packages/babel-messages/package.json index 13f11c756a..348dc5ee01 100644 --- a/packages/babel-messages/package.json +++ b/packages/babel-messages/package.json @@ -1,6 +1,6 @@ { "name": "babel-messages", - "version": "6.22.0", + "version": "6.23.0", "description": "Collection of debug messages used by Babel.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-plugin-transform-class-properties/package.json b/packages/babel-plugin-transform-class-properties/package.json index 6bb3fd5012..6b7df0db15 100644 --- a/packages/babel-plugin-transform-class-properties/package.json +++ b/packages/babel-plugin-transform-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-class-properties", - "version": "6.22.0", + "version": "6.23.0", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-class-properties", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-function-name": "^6.22.0", + "babel-helper-function-name": "^6.23.0", "babel-plugin-syntax-class-properties": "^6.8.0", "babel-runtime": "^6.22.0", - "babel-template": "^6.22.0" + "babel-template": "^6.23.0" }, "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" diff --git a/packages/babel-plugin-transform-es2015-block-scoping/package.json b/packages/babel-plugin-transform-es2015-block-scoping/package.json index 15bedf9241..df7f3c7875 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoping/package.json @@ -1,14 +1,14 @@ { "name": "babel-plugin-transform-es2015-block-scoping", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile ES2015 block scoping (const and let) to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-block-scoping", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0", - "babel-template": "^6.22.0", + "babel-traverse": "^6.23.0", + "babel-types": "^6.23.0", + "babel-template": "^6.23.0", "lodash": "^4.2.0", "babel-runtime": "^6.22.0" }, diff --git a/packages/babel-plugin-transform-es2015-classes/package.json b/packages/babel-plugin-transform-es2015-classes/package.json index 7288800d7e..d07efab036 100644 --- a/packages/babel-plugin-transform-es2015-classes/package.json +++ b/packages/babel-plugin-transform-es2015-classes/package.json @@ -1,20 +1,20 @@ { "name": "babel-plugin-transform-es2015-classes", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-classes", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.22.0", - "babel-helper-function-name": "^6.22.0", - "babel-helper-replace-supers": "^6.22.0", - "babel-template": "^6.22.0", - "babel-traverse": "^6.22.0", - "babel-helper-define-map": "^6.22.0", - "babel-messages": "^6.22.0", + "babel-helper-optimise-call-expression": "^6.23.0", + "babel-helper-function-name": "^6.23.0", + "babel-helper-replace-supers": "^6.23.0", + "babel-template": "^6.23.0", + "babel-traverse": "^6.23.0", + "babel-helper-define-map": "^6.23.0", + "babel-messages": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0" + "babel-types": "^6.23.0" }, "keywords": [ "babel-plugin" diff --git a/packages/babel-plugin-transform-es2015-destructuring/package.json b/packages/babel-plugin-transform-es2015-destructuring/package.json index 1eb1c832d7..93ab9d2b84 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/package.json +++ b/packages/babel-plugin-transform-es2015-destructuring/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-destructuring", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile ES2015 destructuring to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-destructuring", "license": "MIT", diff --git a/packages/babel-plugin-transform-es2015-for-of/package.json b/packages/babel-plugin-transform-es2015-for-of/package.json index 5c1aa3b7e4..470a7f998b 100644 --- a/packages/babel-plugin-transform-es2015-for-of/package.json +++ b/packages/babel-plugin-transform-es2015-for-of/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-for-of", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile ES2015 for...of to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-for-of", "license": "MIT", diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json index d27c57c5af..574befaf5f 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json @@ -1,14 +1,14 @@ { "name": "babel-plugin-transform-es2015-modules-commonjs", - "version": "6.22.0", + "version": "6.23.0", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-commonjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.22.0", + "babel-types": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-template": "^6.22.0", + "babel-template": "^6.23.0", "babel-plugin-transform-strict-mode": "^6.22.0" }, "keywords": [ diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json index 4a2955ebfc..a4d7b43764 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json @@ -1,12 +1,12 @@ { "name": "babel-plugin-transform-es2015-modules-systemjs", - "version": "6.22.0", + "version": "6.23.0", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-systemjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-template": "^6.22.0", + "babel-template": "^6.23.0", "babel-helper-hoist-variables": "^6.22.0", "babel-runtime": "^6.22.0" }, diff --git a/packages/babel-plugin-transform-es2015-modules-umd/package.json b/packages/babel-plugin-transform-es2015-modules-umd/package.json index 1fc3b03b9b..8c424e9f1e 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-umd/package.json @@ -1,13 +1,13 @@ { "name": "babel-plugin-transform-es2015-modules-umd", - "version": "6.22.0", + "version": "6.23.0", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-umd", "license": "MIT", "main": "lib/index.js", "dependencies": { "babel-plugin-transform-es2015-modules-amd": "^6.22.0", - "babel-template": "^6.22.0", + "babel-template": "^6.23.0", "babel-runtime": "^6.22.0" }, "keywords": [ diff --git a/packages/babel-plugin-transform-es2015-parameters/package.json b/packages/babel-plugin-transform-es2015-parameters/package.json index 4715c8086b..f88d30c684 100644 --- a/packages/babel-plugin-transform-es2015-parameters/package.json +++ b/packages/babel-plugin-transform-es2015-parameters/package.json @@ -1,16 +1,16 @@ { "name": "babel-plugin-transform-es2015-parameters", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile ES2015 default and rest parameters to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-parameters", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", + "babel-traverse": "^6.23.0", "babel-helper-call-delegate": "^6.22.0", "babel-helper-get-function-arity": "^6.22.0", - "babel-template": "^6.22.0", - "babel-types": "^6.22.0", + "babel-template": "^6.23.0", + "babel-types": "^6.23.0", "babel-runtime": "^6.22.0" }, "keywords": [ diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json index db7ba27eb0..7a4f28427f 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-typeof-symbol", - "version": "6.22.0", + "version": "6.23.0", "description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-typeof-symbol", "license": "MIT", diff --git a/packages/babel-plugin-transform-object-rest-spread/package.json b/packages/babel-plugin-transform-object-rest-spread/package.json index 9052c3e695..adb9254d9a 100644 --- a/packages/babel-plugin-transform-object-rest-spread/package.json +++ b/packages/babel-plugin-transform-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-rest-spread", - "version": "6.22.0", + "version": "6.23.0", "description": "Compile object rest and spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread", "license": "MIT", diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index e26181cc7b..565d5620f4 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-proto-to-assign", - "version": "6.22.0", + "version": "6.23.0", "description": "Babel plugin for turning __proto__ into a shallow property clone", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", "license": "MIT", diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index fe30acd07f..da8f1e9894 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-constant-elements", - "version": "6.22.0", + "version": "6.23.0", "description": "Treat React JSX elements as value types and hoist them to the highest scope", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements", "license": "MIT", diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 150a8e3f2f..ecabbc98c3 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-display-name", - "version": "6.22.0", + "version": "6.23.0", "description": "Add displayName to React.createClass calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name", "license": "MIT", diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 0b242a701e..b6a25a2dc5 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx", - "version": "6.22.0", + "version": "6.23.0", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -10,7 +10,7 @@ ], "dependencies": { "babel-runtime": "^6.22.0", - "babel-helper-builder-react-jsx": "^6.22.0", + "babel-helper-builder-react-jsx": "^6.23.0", "babel-plugin-syntax-jsx": "^6.8.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index 9f01577ebd..4ca28143bf 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-runtime", - "version": "6.22.0", + "version": "6.23.0", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime", "license": "MIT", diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 5e74561a7a..377f0b1601 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "babel-polyfill", - "version": "6.22.0", + "version": "6.23.0", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-flow/package.json b/packages/babel-preset-flow/package.json index c5503cf2d1..e9f4cb5979 100644 --- a/packages/babel-preset-flow/package.json +++ b/packages/babel-preset-flow/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-flow", - "version": "6.22.2", + "version": "6.23.0", "description": "Babel preset for all Flow plugins.", "author": "James Kyle ", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-flow", diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index 30a0158521..1a4bf7c55d 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react", - "version": "6.22.0", + "version": "6.23.0", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,10 +8,10 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-react", "main": "lib/index.js", "dependencies": { - "babel-preset-flow": "^6.22.2", + "babel-preset-flow": "^6.23.0", "babel-plugin-syntax-jsx": "^6.3.13", - "babel-plugin-transform-react-display-name": "^6.22.0", - "babel-plugin-transform-react-jsx": "^6.22.0", + "babel-plugin-transform-react-display-name": "^6.23.0", + "babel-plugin-transform-react-jsx": "^6.23.0", "babel-plugin-transform-react-jsx-source": "^6.22.0", "babel-plugin-transform-react-jsx-self": "^6.22.0" } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 1bef5676c5..762d9a3360 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "babel-register", - "version": "6.22.0", + "version": "6.23.0", "description": "babel require hook", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-register", @@ -8,7 +8,7 @@ "main": "lib/node.js", "browser": "lib/browser.js", "dependencies": { - "babel-core": "^6.22.0", + "babel-core": "^6.23.0", "babel-runtime": "^6.22.0", "core-js": "^2.4.0", "home-or-tmp": "^2.0.0", diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 956384f9ee..4de89280f4 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "babel-template", - "version": "6.22.0", + "version": "6.23.0", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,8 +9,8 @@ "main": "lib/index.js", "dependencies": { "babylon": "^6.11.0", - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0", + "babel-traverse": "^6.23.0", + "babel-types": "^6.23.0", "babel-runtime": "^6.22.0", "lodash": "^4.2.0" } diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 8066c617a8..96beac15ee 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.22.1", + "version": "6.23.0", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,9 +9,9 @@ "main": "lib/index.js", "dependencies": { "babel-code-frame": "^6.22.0", - "babel-messages": "^6.22.0", + "babel-messages": "^6.23.0", "babel-runtime": "^6.22.0", - "babel-types": "^6.22.0", + "babel-types": "^6.23.0", "babylon": "^6.15.0", "debug": "^2.2.0", "globals": "^9.0.0", @@ -19,6 +19,6 @@ "lodash": "^4.2.0" }, "devDependencies": { - "babel-generator": "^6.22.0" + "babel-generator": "^6.23.0" } } diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 0f8cb8565d..5a3001f1e7 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "babel-types", - "version": "6.22.0", + "version": "6.23.0", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel/package.json b/packages/babel/package.json index 4c03e3eb51..f278b5b05e 100644 --- a/packages/babel/package.json +++ b/packages/babel/package.json @@ -1,6 +1,6 @@ { "name": "babel", - "version": "6.5.2", + "version": "6.23.0", "description": "Turn ES6 code into readable vanilla ES5 with source maps", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 48709e9fa45532f2de7775e5c7fbe2c185c23b83 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 17:20:18 -0800 Subject: [PATCH 155/222] Revert change that lerna force-committed. --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index bbf4c7ff5b..022a98cd2e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-beta.37", + "lerna": "2.0.0-beta.23", "version": "6.23.0", "changelog": { "repo": "babel/babel", From 454933ef7643dd30b625992cddc8420887cf510e Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 18:15:50 -0800 Subject: [PATCH 156/222] Revert "Rewrite Hub as interface #5047" (#5306) --- .../src/transformation/file/index.js | 21 +++---------------- packages/babel-traverse/src/hub.js | 14 +++---------- packages/babel-traverse/src/index.js | 16 +++++++------- packages/babel-traverse/src/path/index.js | 10 +++++---- .../babel-traverse/src/path/introspection.js | 8 +++---- packages/babel-traverse/src/scope/index.js | 9 ++++---- packages/babel-traverse/test/hub.js | 13 ------------ 7 files changed, 27 insertions(+), 64 deletions(-) delete mode 100644 packages/babel-traverse/test/hub.js diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 9866b147a8..50b641c194 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -6,8 +6,7 @@ import convertSourceMap from "convert-source-map"; import OptionManager from "./options/option-manager"; import type Pipeline from "../pipeline"; import PluginPass from "../plugin-pass"; -import { NodePath, Scope } from "babel-traverse"; -import type { HubInterface } from "babel-traverse"; +import { NodePath, Hub, Scope } from "babel-traverse"; import sourceMap from "source-map"; import generate from "babel-generator"; import codeFrame from "babel-code-frame"; @@ -99,21 +98,7 @@ export default class File extends Store { this.code = ""; this.shebang = ""; - this.hub = { - // keep it for the usage in babel-core, ex: path.hub.file.opts.filename - file: this, - mark: (type: string, message: string, loc: Object) => { - this.metadata.marked.push({ - type, - message, - loc - }); - }, - addHelper: this.addHelper.bind(this), - getCode: () => this.code, - getScope: () => this.scope, - buildError: this.buildCodeFrameError.bind(this) - }; + this.hub = new Hub(this); } static helpers: Array; @@ -133,7 +118,7 @@ export default class File extends Store { ast: Object; scope: Scope; metadata: BabelFileMetadata; - hub: HubInterface; + hub: Hub; code: string; shebang: string; diff --git a/packages/babel-traverse/src/hub.js b/packages/babel-traverse/src/hub.js index d4151a16ed..f05eaa8136 100644 --- a/packages/babel-traverse/src/hub.js +++ b/packages/babel-traverse/src/hub.js @@ -1,14 +1,6 @@ -import Scope from "./scope"; -export interface HubInterface { - mark?: (type: string, message: string) => void; - addHelper?: (name: string) => Object; - getScope?: () => Scope; - getCode?: () => string; - buildError:(node: Object, msg: string, Error: Error) => Error; -} - export default class Hub { - buildError(node, msg, BuildError = TypeError): Error { - return new BuildError(msg); + constructor(file, options) { + this.file = file; + this.options = options; } } diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 6d6215e308..1c5c96b58c 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -5,12 +5,10 @@ import includes from "lodash/includes"; import * as t from "babel-types"; import * as cache from "./cache"; -import NodePath from "./path"; -import Scope from "./scope"; -import Hub from "./hub"; - -export { visitors, NodePath, Scope, Hub }; -export type { HubInterface } from "./hub"; +export { default as NodePath } from "./path"; +export { default as Scope } from "./scope"; +export { default as Hub } from "./hub"; +export { visitors }; export default function traverse( parent: Object | Array, @@ -37,9 +35,9 @@ traverse.visitors = visitors; traverse.verify = visitors.verify; traverse.explode = visitors.explode; -traverse.NodePath = NodePath; -traverse.Scope = Scope; -traverse.Hub = Hub; +traverse.NodePath = require("./path"); +traverse.Scope = require("./scope"); +traverse.Hub = require("./hub"); traverse.cheap = function (node, enter) { return t.traverseFast(node, enter); diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index 41d60c3e47..c66d0e8482 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -114,7 +114,7 @@ export default class NodePath { } buildCodeFrameError(msg: string, Error: typeof Error = SyntaxError): Error { - return this.hub.buildError(this.node, msg, Error); + return this.hub.file.buildCodeFrameError(this.node, msg, Error); } traverse(visitor: Object, state?: any) { @@ -122,9 +122,11 @@ export default class NodePath { } mark(type: string, message: string) { - if (this.hub.mark) { - this.hub.mark(type, message, this.node.loc); - } + this.hub.file.metadata.marked.push({ + type, + message, + loc: this.node.loc + }); } set(key: string, node: Object) { diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index 0a722e61be..e8e54f18c0 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -235,12 +235,10 @@ export function referencesImport(moduleSource, importName) { export function getSource() { const node = this.node; if (node.end) { - const code = this.hub.getCode(); - if (code) { - return code.slice(node.start, node.end); - } + return this.hub.file.code.slice(node.start, node.end); + } else { + return ""; } - return ""; } export function willIMaybeExecuteBefore(target) { diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index 1df4c8e485..a0b26bc573 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -346,8 +346,7 @@ export default class Scope { local.kind === "param" && (kind === "let" || kind === "const"); if (duplicate) { - const errorMsg = messages.get("scopeDuplicateDeclaration", name); - throw this.hub.buildError ? this.hub.buildError(id, errorMsg, TypeError) : new TypeError(errorMsg); + throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError); } } @@ -386,6 +385,8 @@ export default class Scope { } toArray(node: Object, i?: number) { + const file = this.hub.file; + if (t.isIdentifier(node)) { const binding = this.getBinding(node.name); if (binding && binding.constant && binding.path.isGenericType("Array")) return node; @@ -418,9 +419,9 @@ export default class Scope { } else if (i) { args.push(t.numericLiteral(i)); helperName = "slicedToArray"; - // TODO if (this.hub.isLoose("es6.forOf")) helperName += "-loose"; + // TODO if (this.hub.file.isLoose("es6.forOf")) helperName += "-loose"; } - return t.callExpression(this.hub.addHelper(helperName), args); + return t.callExpression(file.addHelper(helperName), args); } hasLabel(name: string) { diff --git a/packages/babel-traverse/test/hub.js b/packages/babel-traverse/test/hub.js deleted file mode 100644 index a3d67bb9d8..0000000000 --- a/packages/babel-traverse/test/hub.js +++ /dev/null @@ -1,13 +0,0 @@ -const assert = require("assert"); -const Hub = require("../lib").default.Hub; - -describe("hub", function () { - it("default buildError should return TypeError", function () { - const hub = new Hub(); - const msg = "test_msg"; - assert.deepEqual( - hub.buildError(null, msg), - new TypeError(msg) - ); - }); -}); From 9cae61911d458973c0f424ce06ca0fd820c47345 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 18:18:17 -0800 Subject: [PATCH 157/222] v6.23.1 --- lerna.json | 4 ++-- packages/babel-core/package.json | 4 ++-- packages/babel-traverse/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lerna.json b/lerna.json index 022a98cd2e..9d72463292 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { - "lerna": "2.0.0-beta.23", - "version": "6.23.0", + "lerna": "2.0.0-beta.37", + "version": "6.23.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index bc6c623098..f9eecdac84 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.23.0", + "version": "6.23.1", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -33,7 +33,7 @@ "babel-template": "^6.23.0", "babel-runtime": "^6.22.0", "babel-register": "^6.23.0", - "babel-traverse": "^6.23.0", + "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", "babylon": "^6.11.0", "convert-source-map": "^1.1.0", diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 96beac15ee..f884ed2d8b 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.23.0", + "version": "6.23.1", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From 11cf0e0b501357d1e87a4b108b0130e2a212c68d Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 13 Feb 2017 18:18:45 -0800 Subject: [PATCH 158/222] Revert lerna again --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 9d72463292..169db035c1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-beta.37", + "lerna": "2.0.0-beta.23", "version": "6.23.1", "changelog": { "repo": "babel/babel", From c3098d24371d1074a3be5b64f22bb163b4abdec8 Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Fri, 20 Jan 2017 18:07:32 +0300 Subject: [PATCH 159/222] Add Node 7 to CI (#5165) This reapplies this commit, as it was lost before --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 860922b1b5..7a74acbc31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ cache: directories: - node_modules node_js: + - '7' - '6' - '4' From 7dcc9708e3398fcf7c6668dc4de0e4b8112fe5d1 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Tue, 14 Feb 2017 11:26:49 -0800 Subject: [PATCH 160/222] Manually bump and publish babel-runtime --- packages/babel-runtime/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index 50c0c37b87..aa64eadd57 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-runtime", - "version": "6.22.0", + "version": "6.23.0", "description": "babel selfContained runtime", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime", @@ -11,6 +11,6 @@ }, "devDependencies": { "babel-helpers": "^6.22.0", - "babel-plugin-transform-runtime": "^6.22.0" + "babel-plugin-transform-runtime": "^6.23.0" } } From 958f72ddc28e2f5d02adf44eadd2b1265dd0fa4d Mon Sep 17 00:00:00 2001 From: Sergey Rubanov Date: Wed, 15 Feb 2017 18:55:12 +0300 Subject: [PATCH 161/222] Add name field to package.json (#5311) [skip ci] --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 90db588cb8..254cad0ffb 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "babel", "private": true, "license": "MIT", "scripts": { From b77c435f0f9e7ec5e21ed7d92807ce3c75bdd9d4 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Wed, 15 Feb 2017 13:38:54 -0600 Subject: [PATCH 162/222] Ignore babel-register test artifacts (#5316) [skip ci] --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 702ae50d45..12a252a120 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ dist /.package.json /packages/babel-runtime/core-js /packages/babel-runtime/helpers/*.js +/packages/babel-register/test/.babel /packages/*/lib _babel.github.io /tests/.browser-build.js From b3e208fcd03f27e26eddd90d6fd0c5e940bb1dc1 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 15 Feb 2017 14:45:21 -0500 Subject: [PATCH 163/222] Update to babylon@7.0.0-beta.0 --- packages/babel-core/package.json | 2 +- packages/babel-generator/package.json | 2 +- packages/babel-template/package.json | 2 +- packages/babel-traverse/package.json | 2 +- packages/babel-types/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 4e44376e71..1932064bab 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -34,7 +34,7 @@ "babel-register": "^6.23.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", - "babylon": "^6.11.0", + "babylon": "7.0.0-beta.0", "convert-source-map": "^1.1.0", "debug": "^2.1.1", "json5": "^0.5.0", diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index e45347d974..f6fe18b283 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -21,6 +21,6 @@ }, "devDependencies": { "babel-helper-fixtures": "^6.22.0", - "babylon": "^6.11.0" + "babylon": "7.0.0-beta.0" } } diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index d75b97caaf..927e65ee01 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-template", "main": "lib/index.js", "dependencies": { - "babylon": "^6.11.0", + "babylon": "7.0.0-beta.0", "babel-traverse": "^6.23.0", "babel-types": "^6.23.0", "lodash": "^4.2.0" diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 40de088ff3..f8a095e696 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -11,7 +11,7 @@ "babel-code-frame": "^6.22.0", "babel-messages": "^6.23.0", "babel-types": "^6.23.0", - "babylon": "^6.15.0", + "babylon": "7.0.0-beta.0", "debug": "^2.2.0", "globals": "^9.0.0", "invariant": "^2.2.0", diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 5ed4524a29..9c1508b651 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -13,6 +13,6 @@ "to-fast-properties": "^1.0.1" }, "devDependencies": { - "babylon": "^6.8.2" + "babylon": "7.0.0-beta.0" } } From bc8f476d3333edbf61a0a4256b29f63180f0f568 Mon Sep 17 00:00:00 2001 From: Charles Pick Date: Wed, 15 Feb 2017 19:54:27 +0000 Subject: [PATCH 164/222] [7.0] Rename NumericLiteralTypeAnnotation to NumberLiteralTypeAnnotation (#5229) --- lib/types.js | 10 +++++----- packages/babel-generator/src/generators/flow.js | 2 +- packages/babel-types/README.md | 6 +++--- packages/babel-types/src/definitions/flow.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/types.js b/lib/types.js index e42a516b4a..49b68c99d1 100644 --- a/lib/types.js +++ b/lib/types.js @@ -632,8 +632,8 @@ declare class BabelNodeNullableTypeAnnotation extends BabelNode { typeAnnotation: any; } -declare class BabelNodeNumericLiteralTypeAnnotation extends BabelNode { - type: "NumericLiteralTypeAnnotation"; +declare class BabelNodeNumberLiteralTypeAnnotation extends BabelNode { + type: "NumberLiteralTypeAnnotation"; } declare class BabelNodeNumberTypeAnnotation extends BabelNode { @@ -873,7 +873,7 @@ type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression; type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier; -type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeExistentialTypeParam | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; +type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeExistentialTypeParam | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias; type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText; @@ -974,7 +974,7 @@ declare module "babel-types" { declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation; declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation; declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation; - declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation; + declare function numberLiteralTypeAnnotation(): BabelNodeNumberLiteralTypeAnnotation; declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation; declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation; declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation; @@ -1110,7 +1110,7 @@ declare module "babel-types" { declare function isIntersectionTypeAnnotation(node: Object, opts?: Object): boolean; declare function isMixedTypeAnnotation(node: Object, opts?: Object): boolean; declare function isNullableTypeAnnotation(node: Object, opts?: Object): boolean; - declare function isNumericLiteralTypeAnnotation(node: Object, opts?: Object): boolean; + declare function isNumberLiteralTypeAnnotation(node: Object, opts?: Object): boolean; declare function isNumberTypeAnnotation(node: Object, opts?: Object): boolean; declare function isStringLiteralTypeAnnotation(node: Object, opts?: Object): boolean; declare function isStringTypeAnnotation(node: Object, opts?: Object): boolean; diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index d8de870dee..484b5714d5 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -183,7 +183,7 @@ export function NullableTypeAnnotation(node: Object) { } export { - NumericLiteral as NumericLiteralTypeAnnotation, + NumericLiteral as NumberLiteralTypeAnnotation, StringLiteral as StringLiteralTypeAnnotation, } from "./types"; diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index 6833883629..5f4b25237d 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -1296,12 +1296,12 @@ Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` --- -### numericLiteralTypeAnnotation +### numberLiteralTypeAnnotation ```javascript -t.numericLiteralTypeAnnotation() +t.numberLiteralTypeAnnotation() ``` -See also `t.isNumericLiteralTypeAnnotation(node, opts)` and `t.assertNumericLiteralTypeAnnotation(node, opts)`. +See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`. Aliases: `Flow` diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index 208382420c..c12a16c39b 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -179,7 +179,7 @@ defineType("NullableTypeAnnotation", { } }); -defineType("NumericLiteralTypeAnnotation", { +defineType("NumberLiteralTypeAnnotation", { aliases: ["Flow"], fields: { // todo From 9188be9ed5697e61c26cc62d32379a9e7433ebec Mon Sep 17 00:00:00 2001 From: Toru Kobayashi Date: Thu, 16 Feb 2017 04:58:07 +0900 Subject: [PATCH 165/222] [7.0] Rename flow AST Type ExistentialTypeParam to ExistsTypeAnnotation (#5199) --- lib/types.js | 10 +++++----- packages/babel-generator/src/generators/flow.js | 2 +- packages/babel-types/README.md | 6 +++--- packages/babel-types/src/definitions/flow.js | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/types.js b/lib/types.js index 49b68c99d1..869cd587f8 100644 --- a/lib/types.js +++ b/lib/types.js @@ -581,8 +581,8 @@ declare class BabelNodeDeclareVariable extends BabelNode { id: any; } -declare class BabelNodeExistentialTypeParam extends BabelNode { - type: "ExistentialTypeParam"; +declare class BabelNodeExistsTypeAnnotation extends BabelNode { + type: "ExistsTypeAnnotation"; } declare class BabelNodeFunctionTypeAnnotation extends BabelNode { @@ -873,7 +873,7 @@ type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression; type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration; type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration; type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier; -type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeExistentialTypeParam | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; +type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeExistsTypeAnnotation | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumberLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeNullLiteralTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeThisTypeAnnotation | BabelNodeVoidTypeAnnotation; type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareInterface | BabelNodeDeclareModule | BabelNodeDeclareModuleExports | BabelNodeDeclareTypeAlias | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias; type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText; @@ -965,7 +965,7 @@ declare module "babel-types" { declare function declareModuleExports(typeAnnotation: any): BabelNodeDeclareModuleExports; declare function declareTypeAlias(id: any, typeParameters: any, right: any): BabelNodeDeclareTypeAlias; declare function declareVariable(id: any): BabelNodeDeclareVariable; - declare function existentialTypeParam(): BabelNodeExistentialTypeParam; + declare function existsTypeAnnotation(): BabelNodeExistsTypeAnnotation; declare function functionTypeAnnotation(typeParameters: any, params: any, rest: any, returnType: any): BabelNodeFunctionTypeAnnotation; declare function functionTypeParam(name: any, typeAnnotation: any): BabelNodeFunctionTypeParam; declare function genericTypeAnnotation(id: any, typeParameters: any): BabelNodeGenericTypeAnnotation; @@ -1101,7 +1101,7 @@ declare module "babel-types" { declare function isDeclareModuleExports(node: Object, opts?: Object): boolean; declare function isDeclareTypeAlias(node: Object, opts?: Object): boolean; declare function isDeclareVariable(node: Object, opts?: Object): boolean; - declare function isExistentialTypeParam(node: Object, opts?: Object): boolean; + declare function isExistsTypeAnnotation(node: Object, opts?: Object): boolean; declare function isFunctionTypeAnnotation(node: Object, opts?: Object): boolean; declare function isFunctionTypeParam(node: Object, opts?: Object): boolean; declare function isGenericTypeAnnotation(node: Object, opts?: Object): boolean; diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 484b5714d5..5d15dd379a 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -79,7 +79,7 @@ export function DeclareVariable(node: Object) { this.semicolon(); } -export function ExistentialTypeParam() { +export function ExistsTypeAnnotation() { this.token("*"); } diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index 5f4b25237d..582654eb98 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -575,12 +575,12 @@ Aliases: `Flow`, `FlowBaseAnnotation` --- -### existentialTypeParam +### existsTypeAnnotation ```javascript -t.existentialTypeParam() +t.existsTypeAnnotation() ``` -See also `t.isExistentialTypeParam(node, opts)` and `t.assertExistentialTypeParam(node, opts)`. +See also `t.isExistsTypeAnnotation(node, opts)` and `t.assertExistsTypeAnnotation(node, opts)`. Aliases: `Flow` diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index c12a16c39b..f18e1561b6 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -111,7 +111,7 @@ defineType("DeclareVariable", { } }); -defineType("ExistentialTypeParam", { +defineType("ExistsTypeAnnotation", { aliases: ["Flow"] }); From ff2c24eed28239f28f7b1df2980a67b643168970 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Wed, 15 Feb 2017 12:05:31 -0800 Subject: [PATCH 166/222] Add test for reference paths (#5296) --- packages/babel-traverse/test/scope.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index 7f823ecfd6..ac6e251c26 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -14,6 +14,19 @@ function getPath(code) { return path; } +function getIdentifierPath(code) { + const ast = parse(code); + let nodePath; + traverse(ast, { + Identifier: function(path) { + nodePath = path; + path.stop(); + } + }); + + return nodePath; +} + describe("scope", function () { describe("binding paths", function () { it("function declaration id", function () { @@ -67,5 +80,13 @@ describe("scope", function () { _foo2: { } `).scope.generateUid("foo"), "_foo3"); }); + + it("reference paths", function() { + const path = getIdentifierPath("function square(n) { return n * n}"); + const referencePaths = path.context.scope.bindings.n.referencePaths; + assert.equal(referencePaths.length, 2); + assert.deepEqual(referencePaths[0].node.loc.start, { line: 1, column:28 }); + assert.deepEqual(referencePaths[1].node.loc.start, { line: 1, column:32 }); + }); }); }); From fa2a373acd54d8330a943d3c99cc2f2833391836 Mon Sep 17 00:00:00 2001 From: Alex Kuzmenko Date: Wed, 15 Feb 2017 22:42:50 +0200 Subject: [PATCH 167/222] [7.0] Replacing current decorators with decorators-legacy (#5290) --- .../README.md | 30 +- .../package.json | 12 +- .../src/index.js | 401 +++++++++++++----- .../mutate-existing-constructor/exec.js | 10 + .../return-new-constructor/exec.js | 13 + .../fixtures/class-ordering/order/exec.js | 28 ++ .../class-ordering/reverse-order/exec.js | 29 ++ .../mutate-descriptor/exec.js | 115 +++++ .../numeric-props/exec.js | 10 + .../return-descriptor/exec.js | 117 +++++ .../string-props/exec.js | 10 + .../child-classes-properties/exec.js | 27 ++ .../mutate-descriptor/exec.js | 99 +++++ .../mutate-initialzer/exec.js | 27 ++ .../properties-without-initializer/exec.js | 11 + .../return-descriptor/exec.js | 99 +++++ .../mutate-descriptor/exec.js | 113 +++++ .../numeric-props/exec.js | 10 + .../return-descriptor/exec.js | 114 +++++ .../class-static-methods/string-props/exec.js | 10 + .../mutate-descriptor/exec.js | 99 +++++ .../mutate-initialzer/exec.js | 25 ++ .../properties-without-initializer/exec.js | 10 + .../return-descriptor/exec.js | 99 +++++ .../test/fixtures/exec/options.json | 3 - .../object-methods/mutate-descriptor/exec.js | 113 +++++ .../object-methods/numeric-props/exec.js | 11 + .../object-methods/return-descriptor/exec.js | 113 +++++ .../object-methods/string-props/exec.js | 12 + .../fixtures/object-ordering/order/exec.js | 25 ++ .../object-ordering/reverse-order/exec.js | 26 ++ .../mutate-descriptor/exec.js | 98 +++++ .../mutate-initialzer/exec.js | 25 ++ .../object-properties/numeric-props/exec.js | 10 + .../return-descriptor/exec.js | 97 +++++ .../object-properties/string-props/exec.js | 10 + .../test/fixtures/options.json | 4 + 37 files changed, 1958 insertions(+), 107 deletions(-) create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/mutate-existing-constructor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/return-new-constructor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/order/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/reverse-order/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/numeric-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/return-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/string-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/child-classes-properties/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-initialzer/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/properties-without-initializer/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/return-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/numeric-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/return-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/string-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-initialzer/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/properties-without-initializer/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/return-descriptor/exec.js delete mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/exec/options.json create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-methods/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-methods/numeric-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-methods/return-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-methods/string-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/order/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/reverse-order/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-initialzer/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-properties/numeric-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-properties/return-descriptor/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/object-properties/string-props/exec.js create mode 100644 packages/babel-plugin-transform-decorators/test/fixtures/options.json diff --git a/packages/babel-plugin-transform-decorators/README.md b/packages/babel-plugin-transform-decorators/README.md index 71fee789b4..a19335dfdc 100644 --- a/packages/babel-plugin-transform-decorators/README.md +++ b/packages/babel-plugin-transform-decorators/README.md @@ -54,9 +54,7 @@ npm install --save-dev babel-plugin-transform-decorators ## Usage -### Via `.babelrc` (Recommended) - -**.babelrc** +Add the following line to your .babelrc file: ```json { @@ -64,6 +62,32 @@ npm install --save-dev babel-plugin-transform-decorators } ``` +#### NOTE: Order of Plugins Matters! + +If you are including your plugins manually and using `transform-class-properties`, make sure that `transform-decorators` comes *before* `transform-class-properties`. + +Wrong: + +```json +{ + "plugins": [ + "transform-class-properties", + "transform-decorators" + ] +} +``` + +Right: + +```json +{ + "plugins": [ + "transform-decorators", + "transform-class-properties" + ] +} +``` + ### Via CLI ```sh diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index 0264dc7052..a061cc2632 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -1,17 +1,19 @@ { "name": "babel-plugin-transform-decorators", - "version": "6.22.0", + "version": "1.3.4", + "author": "Logan Smyth ", + "license": "MIT", "description": "Compile class and object decorators to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-decorators", - "license": "MIT", "main": "lib/index.js", "keywords": [ - "babel-plugin" + "babel", + "babel-plugin", + "decorators" ], "dependencies": { - "babel-types": "^6.22.0", "babel-plugin-syntax-decorators": "^6.13.0", - "babel-helper-explode-class": "^6.22.0", + "babel-runtime": "^6.2.0", "babel-template": "^6.22.0" }, "devDependencies": { diff --git a/packages/babel-plugin-transform-decorators/src/index.js b/packages/babel-plugin-transform-decorators/src/index.js index e1156b6903..e05a53e798 100644 --- a/packages/babel-plugin-transform-decorators/src/index.js +++ b/packages/babel-plugin-transform-decorators/src/index.js @@ -1,132 +1,341 @@ +// Fork of https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy + import template from "babel-template"; -import explodeClass from "babel-helper-explode-class"; const buildClassDecorator = template(` - CLASS_REF = DECORATOR(CLASS_REF) || CLASS_REF; + DECORATOR(CLASS_REF = INNER) || CLASS_REF; `); -export default function ({ types: t }) { - function cleanDecorators(decorators) { - return decorators.reverse().map((dec) => dec.expression); - } +const buildClassPrototype = template(` + CLASS_REF.prototype; +`); - function transformClass(path, ref, state) { - const nodes = []; +const buildGetDescriptor = template(` + Object.getOwnPropertyDescriptor(TARGET, PROPERTY); +`); - state; - let classDecorators = path.node.decorators; - if (classDecorators) { - path.node.decorators = null; - classDecorators = cleanDecorators(classDecorators); - - for (const decorator of classDecorators) { - nodes.push(buildClassDecorator({ - CLASS_REF: ref, - DECORATOR: decorator - })); - } - } - - const map = Object.create(null); - - for (const method of path.get("body.body")) { - const decorators = method.node.decorators; - if (!decorators) continue; - - const alias = t.toKeyAlias(method.node); - map[alias] = map[alias] || []; - map[alias].push(method.node); - - method.remove(); - } - - for (const alias in map) { - const items = map[alias]; - - items; - } - - return nodes; - } - - function hasDecorators(path) { - if (path.isClass()) { - if (path.node.decorators) return true; - - for (const method of (path.node.body.body: Array)) { - if (method.decorators) { - return true; +const buildGetObjectInitializer = template(` + (TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), { + enumerable: true, + configurable: true, + writable: true, + initializer: function(){ + return TEMP; } - } - } else if (path.isObjectExpression()) { - for (const prop of (path.node.properties: Array)) { - if (prop.decorators) { - return true; + }) +`); + +const buildInitializerWarningHelper = template(` + function NAME(descriptor, context){ + throw new Error( + 'Decorating class property failed. Please ensure that ' + + 'transform-class-properties is enabled.' + ); + } +`); + +const buildInitializerDefineProperty = template(` + function NAME(target, property, descriptor, context){ + if (!descriptor) return; + + Object.defineProperty(target, property, { + enumerable: descriptor.enumerable, + configurable: descriptor.configurable, + writable: descriptor.writable, + value: descriptor.initializer ? descriptor.initializer.call(context) : void 0, + }); + } +`); + +const buildApplyDecoratedDescriptor = template(` + function NAME(target, property, decorators, descriptor, context){ + var desc = {}; + Object['ke' + 'ys'](descriptor).forEach(function(key){ + desc[key] = descriptor[key]; + }); + desc.enumerable = !!desc.enumerable; + desc.configurable = !!desc.configurable; + if ('value' in desc || desc.initializer){ + desc.writable = true; } - } + + desc = decorators.slice().reverse().reduce(function(desc, decorator){ + return decorator(target, property, desc) || desc; + }, desc); + + if (context && desc.initializer !== void 0){ + desc.value = desc.initializer ? desc.initializer.call(context) : void 0; + desc.initializer = undefined; + } + + if (desc.initializer === void 0){ + // This is a hack to avoid this being processed by 'transform-runtime'. + // See issue #9. + Object['define' + 'Property'](target, property, desc); + desc = null; + } + + return desc; + } +`); + +export default function({ types: t }) { + /** + * Add a helper to take an initial descriptor, apply some decorators to it, and optionally + * define the property. + */ + function ensureApplyDecoratedDescriptorHelper(path, state) { + if (!state.applyDecoratedDescriptor) { + state.applyDecoratedDescriptor = path.scope.generateUidIdentifier("applyDecoratedDescriptor"); + const helper = buildApplyDecoratedDescriptor({ + NAME: state.applyDecoratedDescriptor, + }); + path.scope.getProgramParent().path.unshiftContainer("body", helper); } - return false; + return state.applyDecoratedDescriptor; } - function doError(path) { - throw path.buildCodeFrameError( -`Decorators are not officially supported yet in 6.x pending a proposal update. -However, if you need to use them you can install the legacy decorators transform with: + /** + * Add a helper to call as a replacement for class property definition. + */ + function ensureInitializerDefineProp(path, state) { + if (!state.initializerDefineProp) { + state.initializerDefineProp = path.scope.generateUidIdentifier("initDefineProp"); + const helper = buildInitializerDefineProperty({ + NAME: state.initializerDefineProp, + }); + path.scope.getProgramParent().path.unshiftContainer("body", helper); + } -npm install babel-plugin-transform-decorators-legacy --save-dev + return state.initializerDefineProp; + } -and add the following line to your .babelrc file: + /** + * Add a helper that will throw a useful error if the transform fails to detect the class + * property assignment, so users know something failed. + */ + function ensureInitializerWarning(path, state) { + if (!state.initializerWarningHelper) { + state.initializerWarningHelper = path.scope.generateUidIdentifier("initializerWarningHelper"); + const helper = buildInitializerWarningHelper({ + NAME: state.initializerWarningHelper, + }); + path.scope.getProgramParent().path.unshiftContainer("body", helper); + } -{ - "plugins": ["transform-decorators-legacy"] -} + return state.initializerWarningHelper; + } -The repo url is: https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy. - `); + /** + * If the decorator expressions are non-identifiers, hoist them to before the class so we can be sure + * that they are evaluated in order. + */ + function applyEnsureOrdering(path) { + // TODO: This should probably also hoist computed properties. + const decorators = ( + path.isClass() + ? [path].concat(path.get("body.body")) + : path.get("properties") + ).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []); + + const identDecorators = decorators.filter((decorator) => !t.isIdentifier(decorator.expression)); + if (identDecorators.length === 0) return; + + return t.sequenceExpression(identDecorators.map((decorator) => { + const expression = decorator.expression; + const id = decorator.expression = path.scope.generateDeclaredUidIdentifier("dec"); + return t.assignmentExpression("=", id, expression); + }).concat([path.node])); + } + + /** + * Given a class expression with class-level decorators, create a new expression + * with the proper decorated behavior. + */ + function applyClassDecorators(classPath) { + const decorators = classPath.node.decorators || []; + classPath.node.decorators = null; + + if (decorators.length === 0) return; + + const name = classPath.scope.generateDeclaredUidIdentifier("class"); + + return decorators + .map((dec) => dec.expression) + .reverse() + .reduce(function(acc, decorator) { + return buildClassDecorator({ + CLASS_REF: name, + DECORATOR: decorator, + INNER: acc, + }).expression; + }, classPath.node); + } + + /** + * Given a class expression with method-level decorators, create a new expression + * with the proper decorated behavior. + */ + function applyMethodDecorators(path, state) { + const hasMethodDecorators = path.node.body.body.some(function(node) { + return (node.decorators || []).length > 0; + }); + + if (!hasMethodDecorators) return; + + return applyTargetDecorators(path, state, path.node.body.body); + } + + /** + * Given an object expression with property decorators, create a new expression + * with the proper decorated behavior. + */ + function applyObjectDecorators(path, state) { + const hasMethodDecorators = path.node.properties.some(function(node) { + return (node.decorators || []).length > 0; + }); + + if (!hasMethodDecorators) return; + + return applyTargetDecorators(path, state, path.node.properties); + } + + /** + * A helper to pull out property decorators into a sequence expression. + */ + function applyTargetDecorators(path, state, decoratedProps) { + const name = path.scope.generateDeclaredUidIdentifier(path.isClass() ? "class" : "obj"); + + const exprs = decoratedProps.reduce(function(acc, node) { + const decorators = node.decorators || []; + node.decorators = null; + + if (decorators.length === 0) return acc; + + if (node.computed) { + throw path.buildCodeFrameError("Computed method/property decorators are not yet supported."); + } + + const property = t.isLiteral(node.key) ? node.key : t.stringLiteral(node.key.name); + + const target = (path.isClass() && !node.static) ? buildClassPrototype({ + CLASS_REF: name, + }).expression : name; + + if (t.isClassProperty(node, { static: false })) { + const descriptor = path.scope.generateDeclaredUidIdentifier("descriptor"); + + const initializer = node.value ? + t.functionExpression(null, [], t.blockStatement([t.returnStatement(node.value)])) : + t.nullLiteral(); + node.value = t.callExpression( + ensureInitializerWarning(path, state), [descriptor, t.thisExpression()] + ); + + acc = acc.concat([ + t.assignmentExpression( + "=", descriptor, t.callExpression(ensureApplyDecoratedDescriptorHelper(path, state), [ + target, + property, + t.arrayExpression(decorators.map((dec) => dec.expression)), + t.objectExpression([ + t.objectProperty(t.identifier("enumerable"), t.booleanLiteral(true)), + t.objectProperty(t.identifier("initializer"), initializer), + ]), + ]) + ), + ]); + } else { + acc = acc.concat( + t.callExpression(ensureApplyDecoratedDescriptorHelper(path, state), [ + target, + property, + t.arrayExpression(decorators.map((dec) => dec.expression)), + ( + t.isObjectProperty(node) || + t.isClassProperty(node, { static: true })) ? + buildGetObjectInitializer({ + TEMP: path.scope.generateDeclaredUidIdentifier("init"), + TARGET: target, + PROPERTY: property, + }).expression : buildGetDescriptor({ + TARGET: target, + PROPERTY: property, + } + ).expression, + target, + ]) + ); + } + + return acc; + }, []); + + return t.sequenceExpression([ + t.assignmentExpression("=", name, path.node), + t.sequenceExpression(exprs), + name, + ]); } return { inherits: require("babel-plugin-syntax-decorators"), visitor: { - ClassExpression(path) { - if (!hasDecorators(path)) return; - doError(path); + ExportDefaultDeclaration(path) { + if (!path.get("declaration").isClassDeclaration()) return; - explodeClass(path); + const { node } = path; + const ref = node.declaration.id || path.scope.generateUidIdentifier("default"); + node.declaration.id = ref; - const ref = path.scope.generateDeclaredUidIdentifier("ref"); - let nodes = []; - - nodes.push(t.assignmentExpression("=", ref, path.node)); - - nodes = nodes.concat(transformClass(path, ref, this)); - - nodes.push(ref); - - path.replaceWith(t.sequenceExpression(nodes)); + // Split the class declaration and the export into two separate statements. + path.replaceWith(node.declaration); + path.insertAfter(t.exportNamedDeclaration(null, [t.exportSpecifier(ref, t.identifier("default"))])); }, - ClassDeclaration(path) { - if (!hasDecorators(path)) return; - doError(path); - explodeClass(path); + const { node } = path; - const ref = path.node.id; - let nodes = []; + const ref = node.id || path.scope.generateUidIdentifier("class"); - nodes = nodes.concat(transformClass(path, ref, this).map((expr) => t.expressionStatement(expr))); - nodes.push(t.expressionStatement(ref)); + path.replaceWith(t.variableDeclaration("let", [ + t.variableDeclarator(ref, t.toExpression(node)) + ])); + }, + ClassExpression(path, state) { + // Create a replacement for the class node if there is one. We do one pass to replace classes with + // class decorators, and a second pass to process method decorators. + const decoratedClass = ( + applyEnsureOrdering(path) || + applyClassDecorators(path, state) || + applyMethodDecorators(path, state) + ); - path.insertAfter(nodes); + if (decoratedClass) path.replaceWith(decoratedClass); + }, + ObjectExpression(path, state) { + const decoratedObject = applyEnsureOrdering(path) || applyObjectDecorators(path, state); + + if (decoratedObject) path.replaceWith(decoratedObject); }, - ObjectExpression(path) { - if (!hasDecorators(path)) return; - doError(path); - } + AssignmentExpression(path, state) { + if (!state.initializerWarningHelper) return; + + if (!path.get("left").isMemberExpression()) return; + if (!path.get("left.property").isIdentifier()) return; + if (!path.get("right").isCallExpression()) return; + if (!path.get("right.callee").isIdentifier({ name: state.initializerWarningHelper.name })) return; + + path.replaceWith(t.callExpression(ensureInitializerDefineProp(path, state), [ + path.get("left.object").node, + t.stringLiteral(path.get("left.property").node.name), + path.get("right.arguments")[0].node, + path.get("right.arguments")[1].node, + ])); + }, } }; } diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/mutate-existing-constructor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/mutate-existing-constructor/exec.js new file mode 100644 index 0000000000..22fc0fdfc6 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/mutate-existing-constructor/exec.js @@ -0,0 +1,10 @@ +function dec(cls){ + cls.staticProp = "prop"; +} + +@dec +class Parent { + parent() {}; +} + +assert.equal(Parent.staticProp, "prop"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/return-new-constructor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/return-new-constructor/exec.js new file mode 100644 index 0000000000..e0471eb47f --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-constructors/return-new-constructor/exec.js @@ -0,0 +1,13 @@ +function dec(cls){ + return class Child extends cls { + child(){} + }; +} + +@dec +class Parent { + parent(){} +} + +assert.equal(typeof Parent.prototype.parent, "function") +assert.equal(typeof Parent.prototype.child, "function") diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/order/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/order/exec.js new file mode 100644 index 0000000000..c31dd400aa --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/order/exec.js @@ -0,0 +1,28 @@ +const calls = []; + +function dec(id){ + calls.push(id); + return function() {}; +} + +@dec(1) +@dec(2) +class Example { + @dec(3) + @dec(4) + method1() {}; + + @dec(5) + @dec(6) + prop1 = 1; + + @dec(7) + @dec(8) + method2() {}; + + @dec(9) + @dec(10) + prop2 = 2; +} + +assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/reverse-order/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/reverse-order/exec.js new file mode 100644 index 0000000000..0edd5a76e5 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-ordering/reverse-order/exec.js @@ -0,0 +1,29 @@ +const calls = []; + +function dec(id){ + return function(){ + calls.push(id); + }; +} + +@dec(10) +@dec(9) +class Example2 { + @dec(2) + @dec(1) + method1() {}; + + @dec(4) + @dec(3) + prop1 = 1; + + @dec(6) + @dec(5) + method2() {}; + + @dec(8) + @dec(7) + prop2 = 2; +} + +assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/mutate-descriptor/exec.js new file mode 100644 index 0000000000..16b5ee6f52 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/mutate-descriptor/exec.js @@ -0,0 +1,115 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + Object.assign(descriptor, { + enumerable: name.indexOf("enum") !== -1, + configurable: name.indexOf("conf") !== -1, + writable: name.indexOf("write") !== -1, + value: function(...args) { + return "__" + value.apply(this, args) + "__"; + }, + }); +} + +class Example { + @dec + enumconfwrite(){ + return 1; + } + + @dec + enumconf(){ + return 2; + } + + @dec + enumwrite(){ + return 3; + } + + @dec + enum(){ + return 4; + } + + @dec + confwrite(){ + return 5; + } + + @dec + conf(){ + return 6; + } + + @dec + write(){ + return 7; + } + + @dec + _(){ + return 8; + } +} + +assert(Example.prototype.hasOwnProperty('decoratedProps')); +assert.deepEqual(Example.prototype.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const inst = new Example(); + +const descs = Object.getOwnPropertyDescriptors(Example.prototype); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/numeric-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/numeric-props/exec.js new file mode 100644 index 0000000000..1955a25ee8 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/numeric-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(name, 4); + assert.equal(typeof descriptor, "object"); +} + +class Example { + @dec + 4() {}; +} diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/return-descriptor/exec.js new file mode 100644 index 0000000000..7d614d16a3 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/return-descriptor/exec.js @@ -0,0 +1,117 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + value: function(...args){ + return '__' + value.apply(this, args) + '__'; + }, + }; +} + +class Example { + @dec + enumconfwrite() { + return 1; + } + + @dec + enumconf() { + return 2; + } + + @dec + enumwrite() { + return 3; + } + + @dec + enum() { + return 4; + } + + @dec + confwrite() { + return 5; + } + + @dec + conf() { + return 6; + } + + @dec + write() { + return 7; + } + + @dec + _() { + return 8; + } +} + + +assert(Example.prototype.hasOwnProperty('decoratedProps')); +assert.deepEqual(Example.prototype.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + + +const inst = new Example(); + +const descs = Object.getOwnPropertyDescriptors(Example.prototype); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/string-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/string-props/exec.js new file mode 100644 index 0000000000..46d76bd73a --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-methods/string-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(name, "str"); + assert.equal(typeof descriptor, "object"); +} + +class Example { + @dec + "str"() {}; +} diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/child-classes-properties/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/child-classes-properties/exec.js new file mode 100644 index 0000000000..7d843bdc9f --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/child-classes-properties/exec.js @@ -0,0 +1,27 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + descriptor.initializer = function(...args){ + return "__" + initializer.apply(this, args) + "__"; + }; +} + +class Base { + @dec + prop2 = 4; +} + +class Example extends Base { + @dec + prop = 3; +} + +let inst = new Example(); + +assert.equal(inst.prop, "__3__"); +assert.equal(inst.prop2, "__4__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-descriptor/exec.js new file mode 100644 index 0000000000..e0baa17081 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-descriptor/exec.js @@ -0,0 +1,99 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + Object.assign(descriptor, { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }); +} + +class Example { + @dec + enumconfwrite = 1; + + @dec + enumconf = 2; + + @dec + enumwrite = 3; + + @dec + enum = 4; + + @dec + confwrite = 5; + + @dec + conf = 6; + + @dec + write = 7; + + @dec + _ = 8; +} + +const inst = new Example(); + +assert(Example.prototype.hasOwnProperty("decoratedProps")); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-initialzer/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-initialzer/exec.js new file mode 100644 index 0000000000..e5bd2bf933 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/mutate-initialzer/exec.js @@ -0,0 +1,27 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, "prop"); + assert.equal(typeof descriptor, "object"); + + let {initializer} = descriptor; + delete descriptor.initializer; + delete descriptor.writable; + + let value; + descriptor.get = function(){ + if (initializer){ + value = '__' + initializer.call(this) + '__'; + initializer = null; + } + return value; + }; +} + +class Example { + @dec + prop = 3; +} + +let inst = new Example(); + +assert.equal(inst.prop, "__3__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/properties-without-initializer/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/properties-without-initializer/exec.js new file mode 100644 index 0000000000..3031f7b3cd --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/properties-without-initializer/exec.js @@ -0,0 +1,11 @@ +function dec(target, name, descriptor) { + +} + +class Example { + @dec prop; +} + +let inst = new Example(); +assert(inst.hasOwnProperty("prop")); +assert.equal(inst.prop, undefined); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/return-descriptor/exec.js new file mode 100644 index 0000000000..b98c219651 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-prototype-properties/return-descriptor/exec.js @@ -0,0 +1,99 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }; +} + +class Example { + @dec + enumconfwrite = 1; + + @dec + enumconf = 2; + + @dec + enumwrite = 3; + + @dec + enum = 4; + + @dec + confwrite = 5; + + @dec + conf = 6; + + @dec + write = 7; + + @dec + _ = 8; +} + +const inst = new Example(); + +assert(Example.prototype.hasOwnProperty("decoratedProps")); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/mutate-descriptor/exec.js new file mode 100644 index 0000000000..63c53284bc --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/mutate-descriptor/exec.js @@ -0,0 +1,113 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + Object.assign(descriptor, { + enumerable: name.indexOf("enum") !== -1, + configurable: name.indexOf("conf") !== -1, + writable: name.indexOf("write") !== -1, + value: function(...args) { + return "__" + value.apply(this, args) + "__"; + }, + }); +} + +class Example { + @dec + static enumconfwrite(){ + return 1; + } + + @dec + static enumconf(){ + return 2; + } + + @dec + static enumwrite(){ + return 3; + } + + @dec + static enum(){ + return 4; + } + + @dec + static confwrite(){ + return 5; + } + + @dec + static conf(){ + return 6; + } + + @dec + static write(){ + return 7; + } + + @dec + static _(){ + return 8; + } +} + +assert(Example.hasOwnProperty("decoratedProps")); +assert.deepEqual(Example.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(Example); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(Example.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(Example.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(Example.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(Example.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(Example.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(Example.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(Example.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(Example._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/numeric-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/numeric-props/exec.js new file mode 100644 index 0000000000..61c7b3fc18 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/numeric-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, 4); + assert.equal(typeof descriptor, "object"); +} + +class Example { + @dec + static 4() {} +} diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/return-descriptor/exec.js new file mode 100644 index 0000000000..fc117a5166 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/return-descriptor/exec.js @@ -0,0 +1,114 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + value: function(...args){ + return '__' + value.apply(this, args) + '__'; + }, + }; +} + +class Example { + @dec + static enumconfwrite() { + return 1; + } + + @dec + static enumconf() { + return 2; + } + + @dec + static enumwrite() { + return 3; + } + + @dec + static enum() { + return 4; + } + + @dec + static confwrite() { + return 5; + } + + @dec + static conf() { + return 6; + } + + @dec + static write() { + return 7; + } + + @dec + static _() { + return 8; + } +} + + +assert(Example.hasOwnProperty("decoratedProps")); +assert.deepEqual(Example.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(Example); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(Example.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(Example.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(Example.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(Example.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(Example.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(Example.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(Example.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(Example._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/string-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/string-props/exec.js new file mode 100644 index 0000000000..2e20b5dbce --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-methods/string-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(name, "str"); + assert.equal(typeof descriptor, "object"); +} + +class Example { + @dec + static "str"() {}; +} diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-descriptor/exec.js new file mode 100644 index 0000000000..e936af3d7d --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-descriptor/exec.js @@ -0,0 +1,99 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + Object.assign(descriptor, { + enumerable: name.indexOf("enum") !== -1, + configurable: name.indexOf("conf") !== -1, + writable: name.indexOf("write") !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }); +} + +class Example { + @dec + static enumconfwrite = 1; + + @dec + static enumconf = 2; + + @dec + static enumwrite = 3; + + @dec + static enum = 4; + + @dec + static confwrite = 5; + + @dec + static conf = 6; + + @dec + static write = 7; + + @dec + static _ = 8; +} + +const inst = new Example(); + +assert(Example.hasOwnProperty("decoratedProps")); +assert.deepEqual(Example.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(Example); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(Example.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(Example.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(Example.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(Example.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(Example.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(Example.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(Example.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(Example._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-initialzer/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-initialzer/exec.js new file mode 100644 index 0000000000..e9d60ef728 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/mutate-initialzer/exec.js @@ -0,0 +1,25 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, "prop"); + assert.equal(typeof descriptor, "object"); + + let {initializer} = descriptor; + delete descriptor.initializer; + delete descriptor.writable; + + let value; + descriptor.get = function(){ + if (initializer){ + value = '__' + initializer.call(this) + '__'; + initializer = null; + } + return value; + }; +} + +class Example { + @dec + static prop = 3; +} + +assert.equal(Example.prop, "__3__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/properties-without-initializer/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/properties-without-initializer/exec.js new file mode 100644 index 0000000000..94b5a6ce32 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/properties-without-initializer/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor) { + +} + +class Example { + @dec static prop; +} + +assert(Example.hasOwnProperty("prop")); +assert.equal(Example.prop, undefined); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/return-descriptor/exec.js new file mode 100644 index 0000000000..8aa17ef0bd --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/class-static-properties/return-descriptor/exec.js @@ -0,0 +1,99 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }; +} + +class Example { + @dec + static enumconfwrite = 1; + + @dec + static enumconf = 2; + + @dec + static enumwrite = 3; + + @dec + static enum = 4; + + @dec + static confwrite = 5; + + @dec + static conf = 6; + + @dec + static write = 7; + + @dec + static _ = 8; +} + +const inst = new Example(); + +assert(Example.hasOwnProperty("decoratedProps")); +assert.deepEqual(Example.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(Example); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(Example.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(Example.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(Example.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(Example.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(Example.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(Example.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(Example.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(Example._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/exec/options.json b/packages/babel-plugin-transform-decorators/test/fixtures/exec/options.json deleted file mode 100644 index 0c91a1a362..0000000000 --- a/packages/babel-plugin-transform-decorators/test/fixtures/exec/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["external-helpers", "transform-es2015-destructuring", "transform-es2015-block-scoping", "transform-decorators", "transform-es2015-classes", "transform-class-properties"] -} diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/mutate-descriptor/exec.js new file mode 100644 index 0000000000..f6392e0aea --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/mutate-descriptor/exec.js @@ -0,0 +1,113 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + Object.assign(descriptor, { + enumerable: name.indexOf("enum") !== -1, + configurable: name.indexOf("conf") !== -1, + writable: name.indexOf("write") !== -1, + value: function(...args) { + return "__" + value.apply(this, args) + "__"; + }, + }); +} + +const inst = { + @dec + enumconfwrite(){ + return 1; + }, + + @dec + enumconf(){ + return 2; + }, + + @dec + enumwrite(){ + return 3; + }, + + @dec + enum(){ + return 4; + }, + + @dec + confwrite(){ + return 5; + }, + + @dec + conf(){ + return 6; + }, + + @dec + write(){ + return 7; + }, + + @dec + _(){ + return 8; + }, +} + +assert(inst.hasOwnProperty('decoratedProps')); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/numeric-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/numeric-props/exec.js new file mode 100644 index 0000000000..5474eb7dec --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/numeric-props/exec.js @@ -0,0 +1,11 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, 4); + assert.equal(typeof descriptor, "object"); +} + +const inst = { + @dec + 4(){ + } +}; diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/return-descriptor/exec.js new file mode 100644 index 0000000000..a1ed774df0 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/return-descriptor/exec.js @@ -0,0 +1,113 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let value = descriptor.value; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + value: function(...args){ + return '__' + value.apply(this, args) + '__'; + }, + }; +} + +const inst = { + @dec + enumconfwrite(){ + return 1; + }, + + @dec + enumconf(){ + return 2; + }, + + @dec + enumwrite(){ + return 3; + }, + + @dec + enum(){ + return 4; + }, + + @dec + confwrite(){ + return 5; + }, + + @dec + conf(){ + return 6; + }, + + @dec + write(){ + return 7; + }, + + @dec + _(){ + return 8; + }, +} + +assert(inst.hasOwnProperty('decoratedProps')); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite(), "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf(), "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite(), "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum(), "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite(), "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf(), "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write(), "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._(), "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/string-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/string-props/exec.js new file mode 100644 index 0000000000..d20b0c8096 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-methods/string-props/exec.js @@ -0,0 +1,12 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, "str"); + assert.equal(typeof descriptor, "object"); +} + +const inst = { + @dec + "str"(){ + + } +}; diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/order/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/order/exec.js new file mode 100644 index 0000000000..129a19ef6a --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/order/exec.js @@ -0,0 +1,25 @@ +const calls = []; +function dec(id){ + calls.push(id); + return function(){}; +} + +const obj = { + @dec(1) + @dec(2) + method1(){}, + + @dec(3) + @dec(4) + prop1: 1, + + @dec(5) + @dec(6) + method2(){}, + + @dec(7) + @dec(8) + prop2: 2, +} + +assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8]); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/reverse-order/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/reverse-order/exec.js new file mode 100644 index 0000000000..fc6066b196 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-ordering/reverse-order/exec.js @@ -0,0 +1,26 @@ +const calls = []; +function dec(id){ + return function(){ + calls.push(id); + }; +} + +const obj = { + @dec(2) + @dec(1) + method1(){}, + + @dec(4) + @dec(3) + prop1: 1, + + @dec(6) + @dec(5) + method2(){}, + + @dec(8) + @dec(7) + prop2: 2, +} + +assert.deepEqual(calls, [1, 2, 3, 4, 5, 6, 7, 8]); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-descriptor/exec.js new file mode 100644 index 0000000000..4ff3fc269b --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-descriptor/exec.js @@ -0,0 +1,98 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + Object.assign(descriptor, { + enumerable: name.indexOf("enum") !== -1, + configurable: name.indexOf("conf") !== -1, + writable: name.indexOf("write") !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }); +} + +const inst = { + @dec + enumconfwrite: 1, + + @dec + enumconf: 2, + + @dec + enumwrite: 3, + + @dec + enum: 4, + + @dec + confwrite: 5, + + @dec + conf: 6, + + @dec + write: 7, + + @dec + _: 8, +}; + + +assert(inst.hasOwnProperty("decoratedProps")); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-initialzer/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-initialzer/exec.js new file mode 100644 index 0000000000..1c046d4a7d --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/mutate-initialzer/exec.js @@ -0,0 +1,25 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, "prop"); + assert.equal(typeof descriptor, "object"); + + let {initializer} = descriptor; + delete descriptor.initializer; + delete descriptor.writable; + + let value; + descriptor.get = function(){ + if (initializer){ + value = '__' + initializer.call(this) + '__'; + initializer = null; + } + return value; + }; +} + +let inst = { + @dec + prop: 3 +}; + +assert.equal(inst.prop, "__3__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/numeric-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/numeric-props/exec.js new file mode 100644 index 0000000000..fd0c328a29 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/numeric-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, 4); + assert.equal(typeof descriptor, "object"); +} + +const inst = { + @dec + 4: 1 +}; diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/return-descriptor/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/return-descriptor/exec.js new file mode 100644 index 0000000000..3b79d92dcf --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/return-descriptor/exec.js @@ -0,0 +1,97 @@ +function dec(target, name, descriptor) { + assert(target); + assert.equal(typeof name, "string"); + assert.equal(typeof descriptor, "object"); + + target.decoratedProps = (target.decoratedProps || []).concat([name]); + + let initializer = descriptor.initializer; + return { + enumerable: name.indexOf('enum') !== -1, + configurable: name.indexOf('conf') !== -1, + writable: name.indexOf('write') !== -1, + initializer: function(...args){ + return '__' + initializer.apply(this, args) + '__'; + }, + }; +} + +const inst = { + @dec + enumconfwrite: 1, + + @dec + enumconf: 2, + + @dec + enumwrite: 3, + + @dec + enum: 4, + + @dec + confwrite: 5, + + @dec + conf: 6, + + @dec + write: 7, + + @dec + _: 8, +}; + +assert(inst.hasOwnProperty("decoratedProps")); +assert.deepEqual(inst.decoratedProps, [ + "enumconfwrite", + "enumconf", + "enumwrite", + "enum", + "confwrite", + "conf", + "write", + "_", +]); + +const descs = Object.getOwnPropertyDescriptors(inst); + +assert(descs.enumconfwrite.enumerable); +assert(descs.enumconfwrite.writable); +assert(descs.enumconfwrite.configurable); +assert.equal(inst.enumconfwrite, "__1__"); + +assert(descs.enumconf.enumerable); +assert.equal(descs.enumconf.writable, false); +assert(descs.enumconf.configurable); +assert.equal(inst.enumconf, "__2__"); + +assert(descs.enumwrite.enumerable); +assert(descs.enumwrite.writable); +assert.equal(descs.enumwrite.configurable, false); +assert.equal(inst.enumwrite, "__3__"); + +assert(descs.enum.enumerable); +assert.equal(descs.enum.writable, false); +assert.equal(descs.enum.configurable, false); +assert.equal(inst.enum, "__4__"); + +assert.equal(descs.confwrite.enumerable, false); +assert(descs.confwrite.writable); +assert(descs.confwrite.configurable); +assert.equal(inst.confwrite, "__5__"); + +assert.equal(descs.conf.enumerable, false); +assert.equal(descs.conf.writable, false); +assert(descs.conf.configurable); +assert.equal(inst.conf, "__6__"); + +assert.equal(descs.write.enumerable, false); +assert(descs.write.writable); +assert.equal(descs.write.configurable, false); +assert.equal(inst.write, "__7__"); + +assert.equal(descs._.enumerable, false); +assert.equal(descs._.writable, false); +assert.equal(descs._.configurable, false); +assert.equal(inst._, "__8__"); diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/string-props/exec.js b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/string-props/exec.js new file mode 100644 index 0000000000..8dec1d5e54 --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/object-properties/string-props/exec.js @@ -0,0 +1,10 @@ +function dec(target, name, descriptor){ + assert(target); + assert.equal(name, "str"); + assert.equal(typeof descriptor, "object"); +} + +const inst = { + @dec + "str": 1 +}; diff --git a/packages/babel-plugin-transform-decorators/test/fixtures/options.json b/packages/babel-plugin-transform-decorators/test/fixtures/options.json new file mode 100644 index 0000000000..f2aac002ac --- /dev/null +++ b/packages/babel-plugin-transform-decorators/test/fixtures/options.json @@ -0,0 +1,4 @@ +{ + "presets": ["es2015"], + "plugins": ["transform-decorators", "transform-class-properties"] +} From ca78da65013d36d53da8843534c64561c6bdde35 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 15 Feb 2017 22:37:19 +0100 Subject: [PATCH 168/222] Fix variance (#5320) --- packages/babel-generator/src/generators/flow.js | 10 ++++++---- packages/babel-generator/src/generators/types.js | 8 ++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 5d15dd379a..0d90aa3e1c 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -146,10 +146,12 @@ export function _interfaceish(node: Object) { } export function _variance(node) { - if (node.variance === "plus") { - this.token("+"); - } else if (node.variance === "minus") { - this.token("-"); + if (node.variance) { + if (node.variance.kind === "plus") { + this.token("+"); + } else if (node.variance.kind === "minus") { + this.token("-"); + } } } diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index 5fada08e79..b61b53e142 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -2,14 +2,10 @@ import * as t from "babel-types"; import jsesc from "jsesc"; export function Identifier(node: Object) { - // FIXME: We hang variance off Identifer to support Flow's def-site variance. - // This is a terrible hack, but changing type annotations to use a new, - // dedicated node would be a breaking change. This should be cleaned up in - // the next major. if (node.variance) { - if (node.variance === "plus") { + if (node.variance.kind === "plus") { this.token("+"); - } else if (node.variance === "minus") { + } else if (node.variance.kind === "minus") { this.token("-"); } } From 1ba3269ece093957da7f23f4de44021348a5056d Mon Sep 17 00:00:00 2001 From: Alexander Date: Thu, 16 Feb 2017 00:58:31 +0300 Subject: [PATCH 169/222] [7.0] Switch decorators-legacy to decorators in the Stage 1 Preset (#5318) (#5319) --- packages/babel-preset-stage-1/package.json | 2 +- packages/babel-preset-stage-1/src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index 7afcbc840a..6b2713193e 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-plugin-transform-decorators": "^1.3.4", "babel-plugin-transform-export-extensions": "^6.22.0", "babel-preset-stage-2": "^6.22.0" } diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index 60a9e98050..11ed6e011c 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -1,6 +1,6 @@ import presetStage2 from "babel-preset-stage-2"; -import transformDecoratorsLegacy from "babel-plugin-transform-decorators-legacy"; +import transformDecorators from "babel-plugin-transform-decorators"; import transformExportExtensions from "babel-plugin-transform-export-extensions"; export default { @@ -8,7 +8,7 @@ export default { presetStage2 ], plugins: [ - transformDecoratorsLegacy, + transformDecorators, transformExportExtensions ] }; From 7c62278dcdc12476fc394e0eb60e3e9ed74dfdd6 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 15 Feb 2017 23:29:09 +0100 Subject: [PATCH 170/222] [7.0] Change for-await to use new AST (#5321) --- .../src/generators/statements.js | 4 +--- .../src/index.js | 3 ++- .../fixtures/object-rest/for-x/expected.js | 4 ++-- packages/babel-types/README.md | 18 ++---------------- packages/babel-types/src/definitions/es2015.js | 4 ++++ .../src/definitions/experimental.js | 16 ---------------- 6 files changed, 11 insertions(+), 38 deletions(-) diff --git a/packages/babel-generator/src/generators/statements.js b/packages/babel-generator/src/generators/statements.js index b9e8e736b3..e1492ad77c 100644 --- a/packages/babel-generator/src/generators/statements.js +++ b/packages/babel-generator/src/generators/statements.js @@ -84,10 +84,9 @@ const buildForXStatement = function (op) { return function (node: Object) { this.word("for"); this.space(); - if (op === "await") { + if (op === "of" && node.await) { this.word("await"); this.space(); - op = "of"; } this.token("("); @@ -103,7 +102,6 @@ const buildForXStatement = function (op) { export const ForInStatement = buildForXStatement("in"); export const ForOfStatement = buildForXStatement("of"); -export const ForAwaitStatement = buildForXStatement("await"); export function DoWhileStatement(node: Object) { this.word("do"); diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index deca1eb650..8cabe9ee06 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -41,8 +41,9 @@ const awaitVisitor = { } }, - ForAwaitStatement(path, { file, wrapAwait }) { + ForOfStatement(path, { file, wrapAwait }) { const { node } = path; + if (!node.await) return; const build = rewriteForAwait(path, { getAsyncIterator: file.addHelper("asyncIterator"), diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js index 9617d7b78f..0cffd92db6 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js @@ -18,11 +18,11 @@ async function a() { for ({ a } in {}) {} for ({ a } of []) {} async function a() { - for ({ a } of []) {} + for await ({ a } of []) {} } for (a in {}) {} for (a of []) {} async function a() { - for (a of []) {} + for await (a of []) {} } diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index 582654eb98..d058be9b71 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -694,21 +694,6 @@ See also `t.isFile(node, opts)` and `t.assertFile(node, opts)`. --- -### forAwaitStatement -```javascript -t.forAwaitStatement(left, right, body) -``` - -See also `t.isForAwaitStatement(node, opts)` and `t.assertForAwaitStatement(node, opts)`. - -Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - - - `left`: `VariableDeclaration | LVal` (required) - - `right`: `Expression` (required) - - `body`: `Statement` (required) - ---- - ### forInStatement ```javascript t.forInStatement(left, right, body) @@ -726,7 +711,7 @@ Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` ### forOfStatement ```javascript -t.forOfStatement(left, right, body) +t.forOfStatement(left, right, body, await) ``` See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`. @@ -736,6 +721,7 @@ Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` - `left`: `VariableDeclaration | LVal` (required) - `right`: `Expression` (required) - `body`: `Statement` (required) + - `await`: `boolean` (default: `false`) --- diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index f0231478d3..028e6a0b18 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -178,6 +178,10 @@ defineType("ForOfStatement", { }, body: { validate: assertNodeType("Statement") + }, + await: { + default: false, + validate: assertValueType("boolean") } } }); diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index 17949eaa4c..f7561a864b 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -11,22 +11,6 @@ defineType("AwaitExpression", { } }); -defineType("ForAwaitStatement", { - visitor: ["left", "right", "body"], - aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], - fields: { - left: { - validate: assertNodeType("VariableDeclaration", "LVal") - }, - right: { - validate: assertNodeType("Expression") - }, - body: { - validate: assertNodeType("Statement") - } - } -}); - defineType("BindExpression", { visitor: ["object", "callee"], aliases: ["Expression"], From 28853bf190ce3e6ad405e7bd48336c3180f4e496 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 15 Feb 2017 23:43:06 +0100 Subject: [PATCH 171/222] Fix for-await printing (#5322) Only the first for-await was correctly printed all subsequent for-await statements where printed as for-of as the variable op was changed inside the buildForXStatement --- packages/babel-generator/src/generators/statements.js | 4 ++-- .../test/fixtures/object-rest/for-x/expected.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/babel-generator/src/generators/statements.js b/packages/babel-generator/src/generators/statements.js index b9e8e736b3..0f7f125a6c 100644 --- a/packages/babel-generator/src/generators/statements.js +++ b/packages/babel-generator/src/generators/statements.js @@ -87,13 +87,13 @@ const buildForXStatement = function (op) { if (op === "await") { this.word("await"); this.space(); - op = "of"; + // do not attempt to change op here, as it will break subsequent for-await statements } this.token("("); this.print(node.left, node); this.space(); - this.word(op); + this.word(op === "await" ? "of" : op); this.space(); this.print(node.right, node); this.token(")"); diff --git a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js index 9617d7b78f..0cffd92db6 100644 --- a/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js +++ b/packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/for-x/expected.js @@ -18,11 +18,11 @@ async function a() { for ({ a } in {}) {} for ({ a } of []) {} async function a() { - for ({ a } of []) {} + for await ({ a } of []) {} } for (a in {}) {} for (a of []) {} async function a() { - for (a of []) {} + for await (a of []) {} } From 7e59f8644494f193dfc124b06dd03968c2a34bbd Mon Sep 17 00:00:00 2001 From: Wilhelmina Drengwitz Date: Thu, 16 Feb 2017 15:24:20 -0500 Subject: [PATCH 172/222] Fix 'o' is undefined in example code (#5327) [skip ci] --- packages/babel-plugin-transform-es2015-spread/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/babel-plugin-transform-es2015-spread/README.md b/packages/babel-plugin-transform-es2015-spread/README.md index 0ba50ddc03..af75353e36 100644 --- a/packages/babel-plugin-transform-es2015-spread/README.md +++ b/packages/babel-plugin-transform-es2015-spread/README.md @@ -11,7 +11,7 @@ var a = ['a', 'b', 'c']; var b = [...a, 'foo']; var c = { foo: 'bar', baz: 42 }; -var d = {...o, a: 2}; +var d = {...c, a: 2}; ``` **Out** @@ -33,7 +33,7 @@ var a = [ 'a', 'b', 'c' ]; var b = [].concat(a, [ 'foo' ]); var c = { foo: 'bar', baz: 42 }; -var d = _extends({}, o, { a: 2 }); +var d = _extends({}, c, { a: 2 }); ``` ## Installation From 69c6d277940d1c1fba59de39abdce286f33684a9 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 16 Feb 2017 17:36:05 -0800 Subject: [PATCH 173/222] Improve syntax highlighting in readme for JSX (#5331) [skip ci] --- .../README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/babel-plugin-transform-react-constant-elements/README.md b/packages/babel-plugin-transform-react-constant-elements/README.md index 4f0db40e03..4754c94534 100644 --- a/packages/babel-plugin-transform-react-constant-elements/README.md +++ b/packages/babel-plugin-transform-react-constant-elements/README.md @@ -6,7 +6,7 @@ **In** -```js +```jsx const Hr = () => { return
; }; @@ -14,7 +14,7 @@ const Hr = () => { **Out** -```js +```jsx const _ref =
; const Hr = () => { @@ -26,13 +26,13 @@ const Hr = () => { - **Spread Operator** - ```js + ```jsx
``` - **Refs** - ```js + ```jsx
this.node = node} /> ``` From d55a77502499f10e62ea1f75eb7f77c32c98404b Mon Sep 17 00:00:00 2001 From: Zachary Miller Date: Thu, 16 Feb 2017 21:14:16 -0600 Subject: [PATCH 174/222] Update CONTRIBUTING.md with respect to coverage check [skip ci] (#5329) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80c27d86d3..e34f627436 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,7 +124,7 @@ $ TEST_DEBUG=true make test To test the code coverage, use: ```sh -$ make test-cov +$ ./scripts/test-cov.sh ``` #### Writing tests From 07dd2b1e207071654238319123584f949a7403b0 Mon Sep 17 00:00:00 2001 From: Brendan Houle Date: Fri, 17 Feb 2017 13:01:57 -0500 Subject: [PATCH 175/222] Shorthand properties examples (#5334) --- .../README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/README.md b/packages/babel-plugin-transform-es2015-shorthand-properties/README.md index 171aa1ead7..95c87e2fa3 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/README.md +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/README.md @@ -13,7 +13,7 @@ var o = { a, b, c }; **Out** ```js -var o = { a: a, b: b, c:c }; +var o = { a: a, b: b, c: c }; ``` **In** From 7e540cdcc9a31d42bef50ded1aa55c7244b17b25 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sat, 18 Feb 2017 12:30:46 +0100 Subject: [PATCH 176/222] Remove obsolete code --- packages/babel-generator/src/generators/types.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index b61b53e142..3f39421400 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -2,14 +2,6 @@ import * as t from "babel-types"; import jsesc from "jsesc"; export function Identifier(node: Object) { - if (node.variance) { - if (node.variance.kind === "plus") { - this.token("+"); - } else if (node.variance.kind === "minus") { - this.token("-"); - } - } - this.word(node.name); } From 7b63af0e9194df3da898751a802f8e8d1bba340e Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Mon, 20 Feb 2017 11:37:04 -0600 Subject: [PATCH 177/222] Fix typo in CONTRIBUTING.md [skip ci] --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e34f627436..c4bd85052b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -198,7 +198,7 @@ For both `babel-plugin-x` and `babylon`, you can easily generate an `expected.js #### Internals - AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md)) -- Versionning ([doc/design/versioning.md](./doc/design/versioning.md)) +- Versioning ([doc/design/versioning.md](./doc/design/versioning.md)) - Monorepo ([doc/design/monorepo.md](./doc/design/monorepo.md)) - Compiler environment support ([doc/design/compiler-environment-support.md](./doc/design/compiler-environment-support.md)) - Compiler assumptions ([doc/design/compiler-assumptions.md](./doc/design/compiler-assumptions.md)) From 2974a82df16172dc490f868216b121891c4e4bfd Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 21 Feb 2017 14:44:40 +0100 Subject: [PATCH 178/222] Add babel-bot to team (#5355) [skip ci] --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 7987b5b840..21a845d354 100644 --- a/README.md +++ b/README.md @@ -203,6 +203,14 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | | [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | | [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | +### Non-Human Members + +[](https://github.com/babel-bot) | +|---| +| Babel Bot | +| [@babel-bot](https://github.com/babel-bot) | +| [@babeljs](https://twitter.com/babeljs) | + ### Inactive members [![Amjad Masad](https://avatars.githubusercontent.com/u/587518?s=64)](https://github.com/amasad) | [![James Kyle](https://avatars.githubusercontent.com/u/952783?s=64)](https://github.com/thejameskyle) | [![Jesse McCarthy](https://avatars.githubusercontent.com/u/129203?s=64)](https://github.com/jmm) | [![Sebastian McKenzie](https://avatars.githubusercontent.com/u/853712?s=64)](https://github.com/kittens) (Creator) | From b5246994b57f06af871be6a63dcc4c6fd41d94d6 Mon Sep 17 00:00:00 2001 From: Alex Kuzmenko Date: Tue, 21 Feb 2017 17:09:31 +0200 Subject: [PATCH 179/222] Update CONTRIBUTING.md: include make build (#5349) [skip ci] --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4bd85052b..e54e8ac61d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,6 +124,7 @@ $ TEST_DEBUG=true make test To test the code coverage, use: ```sh +$ BABEL_ENV=cov make build $ ./scripts/test-cov.sh ``` From 4ee385e96cac4b2c0e851932f1b48550b7523dfc Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Mon, 20 Feb 2017 00:52:24 -0800 Subject: [PATCH 180/222] Avoid usage of exports/module.exports/require(). --- packages/babel-cli/src/_babel-node.js | 3 +- packages/babel-cli/src/babel-node.js | 4 +-- packages/babel-cli/src/babel/dir.js | 15 ++++---- packages/babel-cli/src/babel/file.js | 17 ++++----- packages/babel-cli/src/babel/index.js | 34 ++++++++---------- packages/babel-cli/src/babel/util.js | 22 ++++++------ .../src/transformation/file/options/config.js | 2 +- .../transformation/file/options/removed.js | 2 +- .../babel-generator/src/generators/index.js | 10 ++++++ .../src/generators/statements.js | 6 ++-- packages/babel-generator/src/node/index.js | 2 +- .../babel-generator/src/node/whitespace.js | 14 ++++---- packages/babel-generator/src/printer.js | 20 +++-------- .../src/index.js | 4 ++- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 4 ++- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 3 +- .../src/index.js | 4 ++- .../src/index.js | 4 ++- .../src/index.js | 4 ++- .../src/index.js | 4 ++- .../src/index.js | 4 ++- .../src/index.js | 2 +- .../src/definitions.js | 2 +- packages/babel-traverse/src/path/index.js | 36 +++++++++++++------ 32 files changed, 141 insertions(+), 105 deletions(-) create mode 100644 packages/babel-generator/src/generators/index.js diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index bc71abb00d..3d0e1f319d 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -9,6 +9,8 @@ import vm from "vm"; import "babel-polyfill"; import register from "babel-register"; +import pkg from "../package.json"; + const program = new commander.Command("babel-node"); program.option("-e, --eval [script]", "Evaluate script"); @@ -19,7 +21,6 @@ program.option("-x, --extensions [extensions]", "List of extensions to hook into program.option("-w, --plugins [string]", "", util.list); program.option("-b, --presets [string]", "", util.list); -const pkg = require("../package.json"); program.version(pkg.version); program.usage("[options] [ -e script | script.js ] [arguments]"); program.parse(process.argv); diff --git a/packages/babel-cli/src/babel-node.js b/packages/babel-cli/src/babel-node.js index ee25b5f48a..d92f0e863b 100755 --- a/packages/babel-cli/src/babel-node.js +++ b/packages/babel-cli/src/babel-node.js @@ -3,8 +3,8 @@ * when found, before invoking the "real" _babel-node(1) executable. */ -const getV8Flags = require("v8flags"); -const path = require("path"); +import getV8Flags from "v8flags"; +import path from "path"; let args = [path.join(__dirname, "_babel-node")]; diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 364e020733..91731f39fe 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -1,10 +1,11 @@ -const outputFileSync = require("output-file-sync"); -const slash = require("slash"); -const path = require("path"); -const util = require("./util"); -const fs = require("fs"); +import outputFileSync from "output-file-sync"; +import slash from "slash"; +import path from "path"; +import fs from "fs"; -module.exports = function (commander, filenames) { +import * as util from "./util"; + +export default function (commander, filenames) { function write(src, relative) { // remove extension and then append back on .js relative = relative.replace(/\.(\w*?)$/, "") + ".js"; @@ -88,4 +89,4 @@ module.exports = function (commander, filenames) { }); }); } -}; +} diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index e143be1a39..73b5ef14fc 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -1,11 +1,12 @@ -const convertSourceMap = require("convert-source-map"); -const sourceMap = require("source-map"); -const slash = require("slash"); -const path = require("path"); -const util = require("./util"); -const fs = require("fs"); +import convertSourceMap from "convert-source-map"; +import sourceMap from "source-map"; +import slash from "slash"; +import path from "path"; +import fs from "fs"; -module.exports = function (commander, filenames, opts) { +import * as util from "./util"; + +export default function (commander, filenames, opts) { if (commander.sourceMaps === "inline") { opts.sourceMaps = true; } @@ -176,4 +177,4 @@ module.exports = function (commander, filenames, opts) { } else { stdin(); } -}; +} diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 194254bf61..2a5f4f9cd6 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -1,12 +1,16 @@ #!/usr/bin/env node -const fs = require("fs"); -const commander = require("commander"); -const kebabCase = require("lodash/kebabCase"); -const options = require("babel-core").options; -const util = require("babel-core").util; -const uniq = require("lodash/uniq"); -const glob = require("glob"); +import fs from "fs"; +import commander from "commander"; +import kebabCase from "lodash/kebabCase"; +import { options, util, version } from "babel-core"; +import uniq from "lodash/uniq"; +import glob from "glob"; + +import dirCommand from "./dir"; +import fileCommand from "./file"; + +import pkg from "../../package.json"; Object.keys(options).forEach(function (key) { const option = options[key]; @@ -45,8 +49,7 @@ commander.option("-D, --copy-files", "When compiling a directory copy over non-c commander.option("-q, --quiet", "Don't log anything"); /* eslint-enable max-len */ -const pkg = require("../../package.json"); -commander.version(pkg.version + " (babel-core " + require("babel-core").version + ")"); +commander.version(pkg.version + " (babel-core " + version + ")"); commander.usage("[options] "); commander.parse(process.argv); @@ -103,7 +106,7 @@ if (errors.length) { // -const opts = exports.opts = {}; +export const opts = {}; Object.keys(options).forEach(function (key) { const opt = options[key]; @@ -118,12 +121,5 @@ if (opts.only) { opts.only = util.arrayify(opts.only, util.regexify); } -let fn; - -if (commander.outDir) { - fn = require("./dir"); -} else { - fn = require("./file"); -} - -fn(commander, filenames, exports.opts); +const fn = commander.outDir ? dirCommand : fileCommand; +fn(commander, filenames, opts); diff --git a/packages/babel-cli/src/babel/util.js b/packages/babel-cli/src/babel/util.js index 7cdff17222..e92b09c671 100644 --- a/packages/babel-cli/src/babel/util.js +++ b/packages/babel-cli/src/babel/util.js @@ -1,11 +1,11 @@ -const commander = require("commander"); -const defaults = require("lodash/defaults"); -const readdir = require("fs-readdir-recursive"); -const index = require("./index"); -const babel = require("babel-core"); -const util = require("babel-core").util; -const path = require("path"); -const fs = require("fs"); +import commander from "commander"; +import defaults from "lodash/defaults"; +import readdir from "fs-readdir-recursive"; +import * as babel from "babel-core"; +import path from "path"; +import fs from "fs"; + +import * as index from "./index"; export function chmod(src, dest) { fs.chmodSync(dest, fs.statSync(src).mode); @@ -13,16 +13,16 @@ export function chmod(src, dest) { export function readdirFilter(filename) { return readdir(filename).filter(function (filename) { - return util.canCompile(filename); + return babel.util.canCompile(filename); }); } export { readdir }; -export const canCompile = util.canCompile; +export const canCompile = babel.util.canCompile; export function shouldIgnore(loc) { - return util.shouldIgnore(loc, index.opts.ignore, index.opts.only); + return babel.util.shouldIgnore(loc, index.opts.ignore, index.opts.only); } export function addSourceMappingUrl(code, loc) { diff --git a/packages/babel-core/src/transformation/file/options/config.js b/packages/babel-core/src/transformation/file/options/config.js index dbc60c6043..80e8bf7a00 100644 --- a/packages/babel-core/src/transformation/file/options/config.js +++ b/packages/babel-core/src/transformation/file/options/config.js @@ -1,6 +1,6 @@ /* eslint max-len: "off" */ -module.exports = { +export default { filename: { type: "filename", description: "filename to use when reading from stdin - this will be used in source-maps, errors etc", diff --git a/packages/babel-core/src/transformation/file/options/removed.js b/packages/babel-core/src/transformation/file/options/removed.js index cb0077cb92..6fea5223a8 100644 --- a/packages/babel-core/src/transformation/file/options/removed.js +++ b/packages/babel-core/src/transformation/file/options/removed.js @@ -1,6 +1,6 @@ /* eslint max-len: "off" */ -module.exports = { +export default { "auxiliaryComment": { "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`" }, diff --git a/packages/babel-generator/src/generators/index.js b/packages/babel-generator/src/generators/index.js new file mode 100644 index 0000000000..61db3d68ec --- /dev/null +++ b/packages/babel-generator/src/generators/index.js @@ -0,0 +1,10 @@ +export * from "./template-literals"; +export * from "./expressions"; +export * from "./statements"; +export * from "./classes"; +export * from "./methods"; +export * from "./modules"; +export * from "./types"; +export * from "./flow"; +export * from "./base"; +export * from "./jsx"; diff --git a/packages/babel-generator/src/generators/statements.js b/packages/babel-generator/src/generators/statements.js index e1492ad77c..f6291e0165 100644 --- a/packages/babel-generator/src/generators/statements.js +++ b/packages/babel-generator/src/generators/statements.js @@ -219,14 +219,14 @@ export function DebuggerStatement() { this.semicolon(); } -function variableDeclarationIdent() { +function variableDeclarationIndent() { // "let " or "var " indentation. this.token(","); this.newline(); if (this.endsWith("\n")) for (let i = 0; i < 4; i++) this.space(true); } -function constDeclarationIdent() { +function constDeclarationIndent() { // "const " indentation. this.token(","); this.newline(); @@ -262,7 +262,7 @@ export function VariableDeclaration(node: Object, parent: Object) { let separator; if (hasInits) { - separator = node.kind === "const" ? constDeclarationIdent : variableDeclarationIdent; + separator = node.kind === "const" ? constDeclarationIndent : variableDeclarationIndent; } // diff --git a/packages/babel-generator/src/node/index.js b/packages/babel-generator/src/node/index.js index c885f8032b..c3a17cea6c 100644 --- a/packages/babel-generator/src/node/index.js +++ b/packages/babel-generator/src/node/index.js @@ -1,4 +1,4 @@ -import whitespace from "./whitespace"; +import * as whitespace from "./whitespace"; import * as parens from "./parentheses"; import * as t from "babel-types"; diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index 1c47e594ec..e55396768b 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -60,7 +60,7 @@ function isType(node) { * Tests for node types that need whitespace. */ -exports.nodes = { +export const nodes = { /** * Test if AssignmentExpression needs whitespace. @@ -164,10 +164,10 @@ exports.nodes = { * Test if Property or SpreadProperty needs whitespace. */ -exports.nodes.ObjectProperty = -exports.nodes.ObjectTypeProperty = -exports.nodes.ObjectMethod = -exports.nodes.SpreadProperty = function (node: Object, parent): ?WhitespaceObject { +nodes.ObjectProperty = +nodes.ObjectTypeProperty = +nodes.ObjectMethod = +nodes.SpreadProperty = function (node: Object, parent): ?WhitespaceObject { if (parent.properties[0] === node) { return { before: true @@ -179,7 +179,7 @@ exports.nodes.SpreadProperty = function (node: Object, parent): ?WhitespaceObjec * Returns lists from node types that need whitespace. */ -exports.list = { +export const list = { /** * Return VariableDeclaration declarations init properties. @@ -222,7 +222,7 @@ exports.list = { amounts = { after: amounts, before: amounts }; } [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { - exports.nodes[type] = function () { + nodes[type] = function () { return amounts; }; }); diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index 6d164fc2fe..f5557d54f9 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -7,6 +7,8 @@ import * as n from "./node"; import Whitespace from "./whitespace"; import * as t from "babel-types"; +import * as generatorFunctions from "./generators"; + const SCIENTIFIC_NOTATION = /e/i; const ZERO_DECIMAL_INTEGER = /\.0+$/; const NON_DECIMAL_LITERAL = /^0[box]/; @@ -572,22 +574,10 @@ export default class Printer { } } +// Expose the node type functions and helpers on the prototype for easy usage. +Object.assign(Printer.prototype, generatorFunctions); + function commaSeparator() { this.token(","); this.space(); } - -for (const generator of [ - require("./generators/template-literals"), - require("./generators/expressions"), - require("./generators/statements"), - require("./generators/classes"), - require("./generators/methods"), - require("./generators/modules"), - require("./generators/types"), - require("./generators/flow"), - require("./generators/base"), - require("./generators/jsx") -]) { - Object.assign(Printer.prototype, generator); -} diff --git a/packages/babel-plugin-transform-async-functions/src/index.js b/packages/babel-plugin-transform-async-functions/src/index.js index abe7b8a0f7..20eb9f453b 100644 --- a/packages/babel-plugin-transform-async-functions/src/index.js +++ b/packages/babel-plugin-transform-async-functions/src/index.js @@ -1,5 +1,7 @@ +import asyncSyntaxPlugin from "babel-plugin-syntax-async-functions"; + export default function () { return { - inherits: require("babel-plugin-syntax-async-functions") + inherits: asyncSyntaxPlugin, }; } diff --git a/packages/babel-plugin-transform-async-generator-functions/src/index.js b/packages/babel-plugin-transform-async-generator-functions/src/index.js index 3da5e7d19b..de09cfed52 100644 --- a/packages/babel-plugin-transform-async-generator-functions/src/index.js +++ b/packages/babel-plugin-transform-async-generator-functions/src/index.js @@ -1,4 +1,5 @@ import remapAsyncToGenerator from "babel-helper-remap-async-to-generator"; +import syntaxAsyncGenerators from "babel-plugin-syntax-async-generators"; export default function ({ types: t }) { const yieldStarVisitor = { @@ -17,7 +18,7 @@ export default function ({ types: t }) { }; return { - inherits: require("babel-plugin-syntax-async-generators"), + inherits: syntaxAsyncGenerators, visitor: { Function(path, state) { if (!path.node.async || !path.node.generator) return; diff --git a/packages/babel-plugin-transform-async-to-generator/src/index.js b/packages/babel-plugin-transform-async-to-generator/src/index.js index beabecb253..b6c1542dfd 100644 --- a/packages/babel-plugin-transform-async-to-generator/src/index.js +++ b/packages/babel-plugin-transform-async-to-generator/src/index.js @@ -1,8 +1,9 @@ import remapAsyncToGenerator from "babel-helper-remap-async-to-generator"; +import syntaxAsyncFunctions from "babel-plugin-syntax-async-functions"; export default function () { return { - inherits: require("babel-plugin-syntax-async-functions"), + inherits: syntaxAsyncFunctions, visitor: { Function(path, state) { diff --git a/packages/babel-plugin-transform-async-to-module-method/src/index.js b/packages/babel-plugin-transform-async-to-module-method/src/index.js index f9a7706ed1..5ae36b052c 100644 --- a/packages/babel-plugin-transform-async-to-module-method/src/index.js +++ b/packages/babel-plugin-transform-async-to-module-method/src/index.js @@ -1,8 +1,9 @@ import remapAsyncToGenerator from "babel-helper-remap-async-to-generator"; +import syntaxAsyncFunctions from "babel-plugin-syntax-async-functions"; export default function () { return { - inherits: require("babel-plugin-syntax-async-functions"), + inherits: syntaxAsyncFunctions, visitor: { Function(path, state) { diff --git a/packages/babel-plugin-transform-class-properties/src/index.js b/packages/babel-plugin-transform-class-properties/src/index.js index 1873757ee9..e06ea958bf 100644 --- a/packages/babel-plugin-transform-class-properties/src/index.js +++ b/packages/babel-plugin-transform-class-properties/src/index.js @@ -1,5 +1,6 @@ import nameFunction from "babel-helper-function-name"; import template from "babel-template"; +import syntaxClassProperties from "babel-plugin-syntax-class-properties"; export default function ({ types: t }) { const findBareSupers = { @@ -39,7 +40,7 @@ export default function ({ types: t }) { ); return { - inherits: require("babel-plugin-syntax-class-properties"), + inherits: syntaxClassProperties, visitor: { Class(path, state) { diff --git a/packages/babel-plugin-transform-decorators/src/index.js b/packages/babel-plugin-transform-decorators/src/index.js index e05a53e798..3a8aab971f 100644 --- a/packages/babel-plugin-transform-decorators/src/index.js +++ b/packages/babel-plugin-transform-decorators/src/index.js @@ -1,6 +1,7 @@ // Fork of https://github.com/loganfsmyth/babel-plugin-transform-decorators-legacy import template from "babel-template"; +import syntaxDecorators from "babel-plugin-syntax-decorators"; const buildClassDecorator = template(` DECORATOR(CLASS_REF = INNER) || CLASS_REF; @@ -281,7 +282,7 @@ export default function({ types: t }) { } return { - inherits: require("babel-plugin-syntax-decorators"), + inherits: syntaxDecorators, visitor: { ExportDefaultDeclaration(path) { diff --git a/packages/babel-plugin-transform-do-expressions/src/index.js b/packages/babel-plugin-transform-do-expressions/src/index.js index 1354c4ecfa..96cfd8f94d 100644 --- a/packages/babel-plugin-transform-do-expressions/src/index.js +++ b/packages/babel-plugin-transform-do-expressions/src/index.js @@ -1,6 +1,8 @@ +import syntaxDoExpressions from "babel-plugin-syntax-do-expressions"; + export default function () { return { - inherits: require("babel-plugin-syntax-do-expressions"), + inherits: syntaxDoExpressions, visitor: { DoExpression(path) { diff --git a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js index bb9eb42c96..17338358e2 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js @@ -1,4 +1,5 @@ import template from "babel-template"; +import transformCommonjs from "babel-plugin-transform-es2015-modules-commonjs"; const buildDefine = template(` define(MODULE_NAME, [SOURCES], FACTORY); @@ -58,7 +59,7 @@ export default function ({ types: t }) { }; return { - inherits: require("babel-plugin-transform-es2015-modules-commonjs"), + inherits: transformCommonjs, pre() { // source strings diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 74af212c55..832d1cb9dd 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -1,6 +1,7 @@ import { basename, extname } from "path"; import template from "babel-template"; import * as t from "babel-types"; +import transformStrictMode from "babel-plugin-transform-strict-mode"; const buildRequire = template(` require($0); @@ -127,7 +128,7 @@ export default function () { }; return { - inherits: require("babel-plugin-transform-strict-mode"), + inherits: transformStrictMode, visitor: { ThisExpression(path, state) { diff --git a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js index 46405fc0f3..25598c395b 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js @@ -1,5 +1,6 @@ import { basename, extname } from "path"; import template from "babel-template"; +import transformAMD from "babel-plugin-transform-es2015-modules-amd"; const buildPrerequisiteAssignment = template(` GLOBAL_REFERENCE = GLOBAL_REFERENCE || {} @@ -42,7 +43,7 @@ export default function ({ types: t }) { } return { - inherits: require("babel-plugin-transform-es2015-modules-amd"), + inherits: transformAMD, visitor: { Program: { diff --git a/packages/babel-plugin-transform-exponentiation-operator/src/index.js b/packages/babel-plugin-transform-exponentiation-operator/src/index.js index 68d2ef8c69..c58302bb3c 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/src/index.js +++ b/packages/babel-plugin-transform-exponentiation-operator/src/index.js @@ -1,8 +1,9 @@ import build from "babel-helper-builder-binary-assignment-operator-visitor"; +import syntaxExponentiationOperator from "babel-plugin-syntax-exponentiation-operator"; export default function ({ types: t }) { return { - inherits: require("babel-plugin-syntax-exponentiation-operator"), + inherits: syntaxExponentiationOperator, visitor: build({ operator: "**", diff --git a/packages/babel-plugin-transform-export-extensions/src/index.js b/packages/babel-plugin-transform-export-extensions/src/index.js index 5951b9e42d..95de3ef19c 100644 --- a/packages/babel-plugin-transform-export-extensions/src/index.js +++ b/packages/babel-plugin-transform-export-extensions/src/index.js @@ -1,3 +1,5 @@ +import syntaxExportExtensions from "babel-plugin-syntax-export-extensions"; + export default function ({ types: t }) { function build(node, nodes, scope) { const first = node.specifiers[0]; @@ -20,7 +22,7 @@ export default function ({ types: t }) { } return { - inherits: require("babel-plugin-syntax-export-extensions"), + inherits: syntaxExportExtensions, visitor: { ExportNamedDeclaration(path) { diff --git a/packages/babel-plugin-transform-flow-comments/src/index.js b/packages/babel-plugin-transform-flow-comments/src/index.js index 8abf61aa41..9ecad77d06 100644 --- a/packages/babel-plugin-transform-flow-comments/src/index.js +++ b/packages/babel-plugin-transform-flow-comments/src/index.js @@ -1,3 +1,5 @@ +import syntaxFlow from "babel-plugin-syntax-flow"; + export default function ({ types: t }) { function wrapInFlowComment(path, parent) { path.addComment("trailing", generateComment(path, parent)); @@ -12,7 +14,7 @@ export default function ({ types: t }) { } return { - inherits: require("babel-plugin-syntax-flow"), + inherits: syntaxFlow, visitor: { TypeCastExpression(path) { diff --git a/packages/babel-plugin-transform-flow-strip-types/src/index.js b/packages/babel-plugin-transform-flow-strip-types/src/index.js index 4b080f9258..6cbdc999e6 100644 --- a/packages/babel-plugin-transform-flow-strip-types/src/index.js +++ b/packages/babel-plugin-transform-flow-strip-types/src/index.js @@ -1,8 +1,10 @@ +import syntaxFlow from "babel-plugin-syntax-flow"; + export default function ({ types: t }) { const FLOW_DIRECTIVE = "@flow"; return { - inherits: require("babel-plugin-syntax-flow"), + inherits: syntaxFlow, visitor: { Program(path, { file: { ast: { comments } } }) { diff --git a/packages/babel-plugin-transform-function-bind/src/index.js b/packages/babel-plugin-transform-function-bind/src/index.js index 27c20faa1e..db0225ede9 100644 --- a/packages/babel-plugin-transform-function-bind/src/index.js +++ b/packages/babel-plugin-transform-function-bind/src/index.js @@ -1,3 +1,5 @@ +import syntaxFunctionBind from "babel-plugin-syntax-function-bind"; + export default function ({ types: t }) { function getTempId(scope) { let id = scope.path.getData("functionBind"); @@ -29,7 +31,7 @@ export default function ({ types: t }) { } return { - inherits: require("babel-plugin-syntax-function-bind"), + inherits: syntaxFunctionBind, visitor: { CallExpression({ node, scope }) { diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index 91f7a0c40a..8f9b62f85e 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -1,3 +1,5 @@ +import syntaxObjectRestSpread from "babel-plugin-syntax-object-rest-spread"; + export default function ({ types: t }) { function hasRestProperty(path) { let foundRestProperty = false; @@ -63,7 +65,7 @@ export default function ({ types: t }) { } return { - inherits: require("babel-plugin-syntax-object-rest-spread"), + inherits: syntaxObjectRestSpread, visitor: { // taken from transform-es2015-parameters/src/destructuring.js diff --git a/packages/babel-plugin-transform-regenerator/src/index.js b/packages/babel-plugin-transform-regenerator/src/index.js index e8207160e5..aaf6f168f5 100644 --- a/packages/babel-plugin-transform-regenerator/src/index.js +++ b/packages/babel-plugin-transform-regenerator/src/index.js @@ -1 +1 @@ -module.exports = require("regenerator-transform"); +export { default } from "regenerator-transform"; diff --git a/packages/babel-plugin-transform-runtime/src/definitions.js b/packages/babel-plugin-transform-runtime/src/definitions.js index f6a6e25f44..bc8b733204 100644 --- a/packages/babel-plugin-transform-runtime/src/definitions.js +++ b/packages/babel-plugin-transform-runtime/src/definitions.js @@ -1,4 +1,4 @@ -module.exports = { +export default { builtins: { Symbol: "symbol", Promise: "promise", diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index c66d0e8482..9bc92df683 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -9,6 +9,19 @@ import Scope from "../scope"; import * as t from "babel-types"; import { path as pathCache } from "../cache"; +// NodePath is split across many files. +import * as NodePath_ancestry from "./ancestry"; +import * as NodePath_inference from "./inference"; +import * as NodePath_replacement from "./replacement"; +import * as NodePath_evaluation from "./evaluation"; +import * as NodePath_conversion from "./conversion"; +import * as NodePath_introspection from "./introspection"; +import * as NodePath_context from "./context"; +import * as NodePath_removal from "./removal"; +import * as NodePath_modification from "./modification"; +import * as NodePath_family from "./family"; +import * as NodePath_comments from "./comments"; + const debug = buildDebug("babel"); export default class NodePath { @@ -151,17 +164,18 @@ export default class NodePath { } } -assign(NodePath.prototype, require("./ancestry")); -assign(NodePath.prototype, require("./inference")); -assign(NodePath.prototype, require("./replacement")); -assign(NodePath.prototype, require("./evaluation")); -assign(NodePath.prototype, require("./conversion")); -assign(NodePath.prototype, require("./introspection")); -assign(NodePath.prototype, require("./context")); -assign(NodePath.prototype, require("./removal")); -assign(NodePath.prototype, require("./modification")); -assign(NodePath.prototype, require("./family")); -assign(NodePath.prototype, require("./comments")); +assign(NodePath.prototype, + NodePath_ancestry, + NodePath_inference, + NodePath_replacement, + NodePath_evaluation, + NodePath_conversion, + NodePath_introspection, + NodePath_context, + NodePath_removal, + NodePath_modification, + NodePath_family, + NodePath_comments); for (const type of (t.TYPES: Array)) { const typeKey = `is${type}`; From 724c949244c0d25460bcaab7cc3a1451ddc290e5 Mon Sep 17 00:00:00 2001 From: Marcelo Dapper Date: Wed, 22 Feb 2017 00:08:20 -0300 Subject: [PATCH 181/222] Replace lodash/assign with Object.assign (#5356) Remove imports to lodash/assign and replace assign with Object.assign. The lodash/assign is unnecessary for babel 7 as node >4 has the same functionality built-in with Object.assign as used here. This resolve the [issue 5353](https://github.com/babel/babel/issues/5353) --- packages/babel-core/src/transformation/plugin.js | 3 +-- packages/babel-template/src/index.js | 3 +-- packages/babel-traverse/src/path/index.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/babel-core/src/transformation/plugin.js b/packages/babel-core/src/transformation/plugin.js index d6c5406574..8c24404673 100644 --- a/packages/babel-core/src/transformation/plugin.js +++ b/packages/babel-core/src/transformation/plugin.js @@ -2,7 +2,6 @@ import OptionManager from "./file/options/option-manager"; import * as messages from "babel-messages"; import Store from "../store"; import traverse from "babel-traverse"; -import assign from "lodash/assign"; import clone from "lodash/clone"; const GLOBAL_VISITOR_PROPS = ["enter", "exit"]; @@ -12,7 +11,7 @@ export default class Plugin extends Store { super(); this.initialized = false; - this.raw = assign({}, plugin); + this.raw = Object.assign({}, plugin); this.key = this.take("name") || key; this.manipulateOptions = this.take("manipulateOptions"); diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index 0384dfec16..83494cd6f4 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -1,5 +1,4 @@ import cloneDeep from "lodash/cloneDeep"; -import assign from "lodash/assign"; import has from "lodash/has"; import traverse from "babel-traverse"; import * as babylon from "babylon"; @@ -23,7 +22,7 @@ export default function (code: string, opts?: Object): Function { } } - opts = assign({ + opts = Object.assign({ allowReturnOutsideFunction: true, allowSuperOutsideMethod: true, preserveComments: false, diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index 9bc92df683..45200a3504 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -4,7 +4,6 @@ import * as virtualTypes from "./lib/virtual-types"; import buildDebug from "debug"; import invariant from "invariant"; import traverse from "../index"; -import assign from "lodash/assign"; import Scope from "../scope"; import * as t from "babel-types"; import { path as pathCache } from "../cache"; @@ -164,7 +163,7 @@ export default class NodePath { } } -assign(NodePath.prototype, +Object.assign(NodePath.prototype, NodePath_ancestry, NodePath_inference, NodePath_replacement, From 02f51fb7a5f4dd808839088e8b22d46cb0b5b202 Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Wed, 22 Feb 2017 05:10:33 +0200 Subject: [PATCH 182/222] [skip ci] Add devEngines to package.json (#5312) --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 254cad0ffb..2747f458d2 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,10 @@ "through2": "^2.0.0", "uglify-js": "^2.4.16" }, + "devEngines": { + "node": ">= 0.10 <= 7.x", + "npm": "2.x || 3.x || 4.x" + }, "babel": { "comments": false, "presets": [ From 8d9195f8627557f53a8be06324f553f50acd047b Mon Sep 17 00:00:00 2001 From: Izaak Schroeder Date: Tue, 21 Feb 2017 19:13:03 -0800 Subject: [PATCH 183/222] Pass `dirname` as extra metadata to preset constructor. (#4834) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Pass `dirname` as extra metadata to preset constructor. Sometimes a preset would like to know where it should resolve relative paths from (e.g. https://github.com/tleunen/babel-plugin-module-resolver) and this extra information makes that possible. * Test for `dirname` passed into preset constructor This adds a check for `dirname`’s existence and correctness to the `resolve-addons-relative-to-file` test, and serves as a minimal example of a path-aware preset. --- .../src/transformation/file/options/option-manager.js | 2 +- .../node_modules/addons/preset.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index f4b25206bc..4746260a36 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -299,7 +299,7 @@ export default class OptionManager { (presetLoc || "a preset") + " which does not accept options."); } - if (typeof val === "function") val = val(context, options); + if (typeof val === "function") val = val(context, options, { dirname }); if (typeof val !== "object") { throw new Error(`Unsupported preset format: ${val}.`); diff --git a/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js b/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js index a1af16e41f..e08f4b1c61 100644 --- a/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js +++ b/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js @@ -1,5 +1,10 @@ -module.exports = { - plugins: [plugin], +module.exports = function preset (context, options, fileContext) { + if (/resolve-addons-relative-to-file$/.test(fileContext.dirname)) { + return { + plugins: [plugin], + }; + } + return {}; }; function plugin () { From 2de4b08c51d41ebf6c334f272dc68cdf208b52d5 Mon Sep 17 00:00:00 2001 From: "JeongHoon Byun (aka Outsider)" Date: Wed, 22 Feb 2017 12:14:26 +0900 Subject: [PATCH 184/222] Add test for passing arguments to babel-node (#5163) (#5342) --- .../test/fixtures/babel-node/arguments/in-files/bar.js | 1 + .../babel-cli/test/fixtures/babel-node/arguments/options.json | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 packages/babel-cli/test/fixtures/babel-node/arguments/in-files/bar.js create mode 100644 packages/babel-cli/test/fixtures/babel-node/arguments/options.json diff --git a/packages/babel-cli/test/fixtures/babel-node/arguments/in-files/bar.js b/packages/babel-cli/test/fixtures/babel-node/arguments/in-files/bar.js new file mode 100644 index 0000000000..13257ec5e8 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel-node/arguments/in-files/bar.js @@ -0,0 +1 @@ +console.log(process.argv[2]); diff --git a/packages/babel-cli/test/fixtures/babel-node/arguments/options.json b/packages/babel-cli/test/fixtures/babel-node/arguments/options.json new file mode 100644 index 0000000000..5aa934d555 --- /dev/null +++ b/packages/babel-cli/test/fixtures/babel-node/arguments/options.json @@ -0,0 +1,4 @@ +{ + "args": ["bar", "foo"], + "stdout": "foo" +} From 3a6d85e55ed4c577106a9dabbe22f89ca5467e51 Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Tue, 21 Feb 2017 19:14:59 -0800 Subject: [PATCH 185/222] Remove redundant NODE_ENV=test in Makefile (#5350) `NODE_ENV=test` is exported by default. Therefore, targets that set `NODE_ENV` to `test` are cleaned up. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 823878ed17..e1abb3962b 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,11 @@ test-only: test: lint test-only test-ci: - NODE_ENV=test make bootstrap + make bootstrap make test-only test-ci-coverage: - NODE_ENV=test BABEL_ENV=cov make bootstrap + BABEL_ENV=cov make bootstrap ./scripts/test-cov.sh ./node_modules/.bin/codecov -f coverage/coverage-final.json From c1c9ac4e1120f2bbd6d4605df57ca2a183351be5 Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Tue, 21 Feb 2017 19:26:52 -0800 Subject: [PATCH 186/222] Add section to CONTRIBUTING about debugging code (#5354) [skip ci] --- CONTRIBUTING.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e54e8ac61d..340292b203 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,6 +9,8 @@ | Writing tests | + Debugging code + | Internals

@@ -197,6 +199,43 @@ For both `babel-plugin-x` and `babylon`, you can easily generate an `expected.js - expected.json (will be generated if not created) ``` +#### Debugging code + +A common approach to debugging JavaScript code is to walk through the code using the [Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools/) debugger. +For illustration purposes, we are going to assume that we need to get a better understanding of [`Generator.generate()`](https://github.com/babel/babel/blob/b5246994b57f06af871be6a63dcc4c6fd41d94d6/packages/babel-generator/src/index.js#L32), which is responsible for generating code for a given AST. +To get a better understanding of what is actually going on for this particular piece of code, we are going to make use of breakpoints. + +```diff +generate() { ++ debugger; // breakpoint + return super.generate(this.ast); +} +``` + +To include the changes, we have to make sure to build Babel: + +```bash +$ make build +``` + +Next, we need to execute `Generator.generate()`, which can be achieved by running a test case in the `babel-generator` package. +For example, we can run the test case that tests the generation of class declarations: + +```bash +$ TEST_DEBUG=true TEST_GREP=ClassDeclaration make test-only + +./scripts/test.sh +Debugger listening on port 9229. +Warning: This is an experimental feature and could change at any time. +To start debugging, open the following URL in Chrome: + chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/3cdaebd2-be88-4e7b-a94b-432950ab72d0 +``` + +To start the debugging in Chrome DevTools, open the given URL. +The debugger starts at the first executed line of code, which is Mocha's first line by default. +Click _Resume script execution_ Resume script execution button. to jump to the set breakpoint. +Note that the code shown in Chrome DevTools is compiled code and therefore differs. + #### Internals - AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md)) - Versioning ([doc/design/versioning.md](./doc/design/versioning.md)) From be293bd70831672de8f4cc8ebdec4f2a33285984 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 22 Feb 2017 04:40:11 +0100 Subject: [PATCH 187/222] Enable codecov partial coverage (#5336) --- codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..3e31ee1814 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +coverage: + parsers: + javascript: + enable_partials: yes From 45087b258b3574fb423fedb6f8d26ba38cdc98fe Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Wed, 22 Feb 2017 04:50:22 -0800 Subject: [PATCH 188/222] Add Yarn installation to CONTRIBUTING.md (#5358) [skip ci] --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3e0254067..039baaa09e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,9 @@ Babel is built for node 4 and up but we develop using node 6. Make sure you are You can check this with `node -v` and `npm -v`. +In addition, make sure that Yarn is installed. +Installation instructions can be found here: https://yarnpkg.com/en/docs/install. + #### Setup ```sh From 6614a63b3b0f17a1f6e54e96f2ccaf3ea3692fc5 Mon Sep 17 00:00:00 2001 From: Zachary Miller Date: Wed, 22 Feb 2017 06:50:58 -0600 Subject: [PATCH 189/222] Wrap some generated do expressions in parens (#5339) --- packages/babel-generator/src/node/parentheses.js | 4 ++++ .../test/fixtures/parentheses/do-expression/actual.js | 3 +++ .../test/fixtures/parentheses/do-expression/expected.js | 3 +++ 3 files changed, 10 insertions(+) create mode 100644 packages/babel-generator/test/fixtures/parentheses/do-expression/actual.js create mode 100644 packages/babel-generator/test/fixtures/parentheses/do-expression/expected.js diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 558bceb14c..948198f7cb 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -46,6 +46,10 @@ export function ObjectExpression(node: Object, parent: Object, printStack: Array return isFirstInStatement(printStack, { considerArrow: true }); } +export function DoExpression(node: Object, parent: Object, printStack: Array): boolean { + return isFirstInStatement(printStack); +} + export function Binary(node: Object, parent: Object): boolean { if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) { return true; diff --git a/packages/babel-generator/test/fixtures/parentheses/do-expression/actual.js b/packages/babel-generator/test/fixtures/parentheses/do-expression/actual.js new file mode 100644 index 0000000000..21177fdcef --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/do-expression/actual.js @@ -0,0 +1,3 @@ +(do { + foo; +}); diff --git a/packages/babel-generator/test/fixtures/parentheses/do-expression/expected.js b/packages/babel-generator/test/fixtures/parentheses/do-expression/expected.js new file mode 100644 index 0000000000..21177fdcef --- /dev/null +++ b/packages/babel-generator/test/fixtures/parentheses/do-expression/expected.js @@ -0,0 +1,3 @@ +(do { + foo; +}); From 87ca6150ae75f622483c4ae2684b0f7b5c4cde25 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Wed, 22 Feb 2017 14:58:01 +0100 Subject: [PATCH 190/222] [7.0] Remove bc code from preset handling and preset-es2015 (#5128) * Remove bc code from preset handling and preset-es2015 * Add more tests * Only allow functions for presets * Fix lint --- .../file/options/option-manager.js | 85 +++++++++---------- packages/babel-core/test/api.js | 50 ++++++----- .../fixtures/option-manager/not-a-preset.js | 2 +- .../presets/es2015_default_object_function.js | 18 ---- .../option-manager/presets/es2015_function.js | 17 ---- .../presets/es2015_function_fallback.js | 50 ----------- .../option-manager/presets/es5_function.js | 14 ++- .../option-manager/presets/es5_invalid.js | 2 + .../node_modules/addons/preset.js | 6 +- packages/babel-core/test/option-manager.js | 36 ++++---- packages/babel-preset-es2015/src/index.js | 31 +------ packages/babel-preset-es2015/test/index.js | 22 ++--- packages/babel-preset-es2016/src/index.js | 12 +-- packages/babel-preset-es2017/src/index.js | 14 +-- packages/babel-preset-flow/src/index.js | 12 +-- packages/babel-preset-latest/src/index.js | 5 +- packages/babel-preset-react/src/index.js | 36 ++++---- packages/babel-preset-stage-0/src/index.js | 20 +++-- packages/babel-preset-stage-1/src/index.js | 20 +++-- packages/babel-preset-stage-2/src/index.js | 22 ++--- packages/babel-preset-stage-3/src/index.js | 14 +-- 21 files changed, 185 insertions(+), 303 deletions(-) delete mode 100644 packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object_function.js delete mode 100644 packages/babel-core/test/fixtures/option-manager/presets/es2015_function.js delete mode 100644 packages/babel-core/test/fixtures/option-manager/presets/es2015_function_fallback.js create mode 100644 packages/babel-core/test/fixtures/option-manager/presets/es5_invalid.js diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index 3e6209abfc..7a106f8ada 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -181,12 +181,10 @@ export default class OptionManager { this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, ReferenceError); } else { - /* eslint-disable max-len */ + // eslint-disable-next-line max-len const unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; - const presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options."; - /* eslint-enable max-len */ - this.log.error(`${unknownOptErr}\n\n${presetConfigErr}`, ReferenceError); + this.log.error(unknownOptErr, ReferenceError); } } } @@ -250,72 +248,65 @@ export default class OptionManager { * or a module name to require. */ resolvePresets(presets: Array, dirname: string, onResolve?) { - return presets.map((val) => { + return presets.map((preset) => { let options; - if (Array.isArray(val)) { - if (val.length > 2) { - throw new Error(`Unexpected extra options ${JSON.stringify(val.slice(2))} passed to preset.`); + if (Array.isArray(preset)) { + if (preset.length > 2) { + throw new Error(`Unexpected extra options ${JSON.stringify(preset.slice(2))} passed to preset.`); } - [val, options] = val; + [preset, options] = preset; } let presetLoc; try { - if (typeof val === "string") { - presetLoc = resolvePreset(val, dirname); + if (typeof preset === "string") { + presetLoc = resolvePreset(preset, dirname); if (!presetLoc) { - throw new Error(`Couldn't find preset ${JSON.stringify(val)} relative to directory ` + + throw new Error(`Couldn't find preset ${JSON.stringify(preset)} relative to directory ` + JSON.stringify(dirname)); } - - val = require(presetLoc); } + const presetFactory = this.getPresetFactoryForPreset(presetLoc || preset); - // If the imported preset is a transpiled ES2015 module - if (typeof val === "object" && val.__esModule) { - // Try to grab the default export. - if (val.default) { - val = val.default; - } else { - // If there is no default export we treat all named exports as options - // and just remove the __esModule. This is to support presets that have been - // exporting named exports in the past, although we definitely want presets to - // only use the default export (with either an object or a function) - const { __esModule, ...rest } = val; // eslint-disable-line no-unused-vars - val = rest; - } - } + preset = presetFactory(context, options); - // For compatibility with babel-core < 6.13.x, allow presets to export an object with a - // a 'buildPreset' function that will return the preset itself, while still exporting a - // simple object (rather than a function), for supporting old Babel versions. - if (typeof val === "object" && val.buildPreset) val = val.buildPreset; - - - if (typeof val !== "function" && options !== undefined) { - throw new Error(`Options ${JSON.stringify(options)} passed to ` + - (presetLoc || "a preset") + " which does not accept options."); - } - - if (typeof val === "function") val = val(context, options); - - if (typeof val !== "object") { - throw new Error(`Unsupported preset format: ${val}.`); - } - - onResolve && onResolve(val, presetLoc); + if (onResolve) onResolve(preset, presetLoc); } catch (e) { if (presetLoc) { e.message += ` (While processing preset: ${JSON.stringify(presetLoc)})`; } throw e; } - return val; + + return preset; }); } + getPresetFactoryForPreset(preset) { + let presetFactory = preset; + if (typeof presetFactory === "string") { + presetFactory = require(presetFactory); + } + + // If the imported preset is a transpiled ES2015 module + if (typeof presetFactory === "object" && presetFactory.__esModule) { + if (presetFactory.default) { + presetFactory = presetFactory.default; + } else { + throw new Error("Preset must export a default export when using ES6 modules."); + } + } + + if (typeof presetFactory !== "function") { + // eslint-disable-next-line max-len + throw new Error(`Unsupported preset format: ${typeof presetFactory}. Expected preset to return a function.`); + } + + return presetFactory; + } + normaliseOptions() { const opts = this.options; diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 7cd5157afe..8344bacd54 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -194,38 +194,42 @@ describe("api", function () { passPerPreset: passPerPreset, presets: [ // First preset with our plugin, "before" - { - plugins: [ - new Plugin({ - visitor: { - Function: function(path) { - const alias = path.scope.getProgramParent().path.get("body")[0].node; - if (!babel.types.isTypeAlias(alias)) return; + function () { + return { + plugins: [ + new Plugin({ + visitor: { + Function: function (path) { + const alias = path.scope.getProgramParent().path.get("body")[0].node; + if (!babel.types.isTypeAlias(alias)) return; - // In case of `passPerPreset` being `false`, the - // alias node is already removed by Flow plugin. - if (!alias) { - return; + // In case of `passPerPreset` being `false`, the + // alias node is already removed by Flow plugin. + if (!alias) { + return; + } + + // In case of `passPerPreset` being `true`, the + // alias node should still exist. + aliasBaseType = alias.right.type; // NumberTypeAnnotation } - - // In case of `passPerPreset` being `true`, the - // alias node should still exist. - aliasBaseType = alias.right.type; // NumberTypeAnnotation } - } - }) - ] + }) + ] + }; }, // ES2015 preset require(__dirname + "/../../babel-preset-es2015"), // Third preset for Flow. - { - plugins: [ - require(__dirname + "/../../babel-plugin-syntax-flow"), - require(__dirname + "/../../babel-plugin-transform-flow-strip-types"), - ] + function () { + return { + plugins: [ + require(__dirname + "/../../babel-plugin-syntax-flow"), + require(__dirname + "/../../babel-plugin-transform-flow-strip-types"), + ] + }; } ], }); diff --git a/packages/babel-core/test/fixtures/option-manager/not-a-preset.js b/packages/babel-core/test/fixtures/option-manager/not-a-preset.js index 7059dfdbe3..67e7ffccf5 100644 --- a/packages/babel-core/test/fixtures/option-manager/not-a-preset.js +++ b/packages/babel-core/test/fixtures/option-manager/not-a-preset.js @@ -1,3 +1,3 @@ module.exports = function () { throw new Error('Not a real preset'); -} +}; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object_function.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object_function.js deleted file mode 100644 index b5f1eef249..0000000000 --- a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object_function.js +++ /dev/null @@ -1,18 +0,0 @@ -// from code: -// export default { -// buildPreset: function() { -// return { -// plugins: [require('../../../../../babel-plugin-syntax-decorators'),] -// }; -// } -// } -'use strict'; - -exports.__esModule = true; -exports.default = { - buildPreset: function buildPreset() { - return { - plugins: [require('../../../../../babel-plugin-syntax-decorators')] - }; - } -}; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_function.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_function.js deleted file mode 100644 index eddcf7e294..0000000000 --- a/packages/babel-core/test/fixtures/option-manager/presets/es2015_function.js +++ /dev/null @@ -1,17 +0,0 @@ -// from code: -// export const buildPreset = function() { -// return { -// plugins: [require('../../../../../babel-plugin-syntax-decorators'),] -// }; -// } -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var buildPreset = exports.buildPreset = function buildPreset() { - return { - plugins: [require('../../../../../babel-plugin-syntax-decorators')] - }; -}; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_function_fallback.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_function_fallback.js deleted file mode 100644 index d0c11d0258..0000000000 --- a/packages/babel-core/test/fixtures/option-manager/presets/es2015_function_fallback.js +++ /dev/null @@ -1,50 +0,0 @@ -// from code: -// function preset() { -// return { -// plugins: [ -// require('../../../../../babel-plugin-syntax-decorators'), -// ] -// }; -// } -// -// const oldConfig = preset(); -// -// export default oldConfig; -// -// // However, for backward compatibility with babel-core < v6.13.x, we use the 'buildPreset' -// // property of the preset object for the preset creation function with the enumerability -// // caveat mentioned below. -// Object.defineProperty(oldConfig, "buildPreset", { -// configurable: true, -// writable: true, -// // We make this non-enumerable so old versions of babel-core won't see it as an unknown property, -// // while allowing new versions to see it as a preset builder function. -// enumerable: false, -// value: preset, -// }); -// - -"use strict"; - -exports.__esModule = true; -function preset() { - return { - plugins: [require('../../../../../babel-plugin-syntax-decorators')] - }; -} - -var oldConfig = preset(); - -exports.default = oldConfig; - -// However, for backward compatibility with babel-core < v6.13.x, we use the 'buildPreset' -// property of the preset object for the preset creation function with the enumerability -// caveat mentioned below. -Object.defineProperty(oldConfig, "buildPreset", { - configurable: true, - writable: true, - // We make this non-enumerable so old versions of babel-core won't see it as an unknown property, - // while allowing new versions to see it as a preset builder function. - enumerable: false, - value: preset -}); diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js b/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js index 31648d0600..71c789f9df 100644 --- a/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js +++ b/packages/babel-core/test/fixtures/option-manager/presets/es5_function.js @@ -1,9 +1,7 @@ -module.exports = { - buildPreset: function () { - return { - plugins: [ - require('../../../../../babel-plugin-syntax-decorators'), - ] - }; - } +module.exports = function () { + return { + plugins: [ + require('../../../../../babel-plugin-syntax-decorators'), + ] + }; }; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es5_invalid.js b/packages/babel-core/test/fixtures/option-manager/presets/es5_invalid.js new file mode 100644 index 0000000000..258dbaf2cc --- /dev/null +++ b/packages/babel-core/test/fixtures/option-manager/presets/es5_invalid.js @@ -0,0 +1,2 @@ +'use strict'; +module.exports = "invalid"; diff --git a/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js b/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js index a1af16e41f..b2f7d13c73 100644 --- a/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js +++ b/packages/babel-core/test/fixtures/resolution/resolve-addons-relative-to-file/node_modules/addons/preset.js @@ -1,5 +1,7 @@ -module.exports = { - plugins: [plugin], +module.exports = function () { + return { + plugins: [plugin], + } }; function plugin () { diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 2ca432dd20..582b61d8be 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -51,19 +51,6 @@ describe("option-manager", () => { /While processing preset: .*option-manager(?:\/|\\\\)not-a-preset\.js/ ); }); - - it("throws for invalid preset configuration", function() { - return assert.throws( - function () { - const opt = new OptionManager(new Logger(null, "unknown")); - opt.init({ - "presets": [{ option: "value" }] - }); - }, - // eslint-disable-next-line max-len - /Unknown option: foreign.option\.(?:.|\n)+A common cause of this error is the presence of a configuration options object without the corresponding preset name/ - ); - }); }); describe("presets", function () { @@ -79,14 +66,21 @@ describe("option-manager", () => { }); } - presetTest("es5"); - presetTest("es5_function"); - presetTest("es2015_default"); - presetTest("es2015_default_function"); - presetTest("es2015_default_object_function"); - presetTest("es2015_function"); - presetTest("es2015_function_fallback"); - presetTest("es2015_named"); + function presetThrowsTest(name, msg) { + it(name, function () { + const opt = new OptionManager(new Logger(null, "unknown")); + assert.throws(() => opt.init({ + "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)] + }), msg); + }); + } + presetTest("es5_function"); + presetTest("es2015_default_function"); + + presetThrowsTest("es5", /Expected preset to return a function./); + presetThrowsTest("es2015_default", /Expected preset to return a function./); + presetThrowsTest("es2015_named", /Preset must export a default export when using ES6 modules/); + presetThrowsTest("es5_invalid", /Unsupported preset format: string/); }); }); diff --git a/packages/babel-preset-es2015/src/index.js b/packages/babel-preset-es2015/src/index.js index 57d96082d1..dcff99017a 100644 --- a/packages/babel-preset-es2015/src/index.js +++ b/packages/babel-preset-es2015/src/index.js @@ -1,11 +1,3 @@ -/** - * This file is not the canonical way of writing a Babel preset since it strives for - * backward compatibility with babel-core < v6.13.x. If you're looking at it as a - * reference for how to write a preset, it's probably best to look at the other presets - * such as babel-preset-es2016 & babel-preset-latest noting that the former example - * exports via a default object and the latter via a default function. - */ - import transformES2015TemplateLiterals from "babel-plugin-transform-es2015-template-literals"; import transformES2015Literals from "babel-plugin-transform-es2015-literals"; import transformES2015FunctionName from "babel-plugin-transform-es2015-function-name"; @@ -31,7 +23,7 @@ import transformES2015ModulesAMD from "babel-plugin-transform-es2015-modules-amd import transformES2015ModulesUMD from "babel-plugin-transform-es2015-modules-umd"; import transformRegenerator from "babel-plugin-transform-regenerator"; -function preset(context, opts = {}) { +export default function (context, opts = {}) { const moduleTypes = ["commonjs", "amd", "umd", "systemjs"]; let loose = false; let modules = "commonjs"; @@ -82,24 +74,3 @@ function preset(context, opts = {}) { ].filter(Boolean) // filter out falsy values }; } - -/** - * This preset was originally an object, before function-based configurable presets were introduced. - * For backward-compatibility with anything that may have been loading this preset and expecting - * it to be a simple Babel config object, we export the old config here via default object. - */ -const oldConfig = preset({}); - -export default oldConfig; - -// However, for backward compatibility with babel-core < v6.13.x, we use the 'buildPreset' -// property of the preset object for the preset creation function with the enumerability -// caveat mentioned below. -Object.defineProperty(oldConfig, "buildPreset", { - configurable: true, - writable: true, - // We make this non-enumerable so old versions of babel-core won't see it as an unknown property, - // while allowing new versions to see it as a preset builder function. - enumerable: false, - value: preset, -}); diff --git a/packages/babel-preset-es2015/test/index.js b/packages/babel-preset-es2015/test/index.js index b7847d1b83..99ac458986 100644 --- a/packages/babel-preset-es2015/test/index.js +++ b/packages/babel-preset-es2015/test/index.js @@ -2,18 +2,10 @@ import es2015 from "../lib"; import { expect } from "chai"; describe("es2015 preset", function () { - it("exposes an object", function () { - // Changing this will break compatibility with babel-core < 6.13.x. - expect(typeof es2015).to.equal("object"); - }); - - it("exposes a separate list of plugins", function () { - expect(Array.isArray(es2015.plugins)).to.equal(true); - }); it("doesn't throw with no options passed", function () { expect(function () { - es2015.buildPreset(null); + es2015(null); }).not.to.throw(); }); @@ -21,7 +13,7 @@ describe("es2015 preset", function () { describe("loose", function () { it("throws on non-boolean value", function () { expect(function () { - es2015.buildPreset(null, { loose: 1 }); + es2015(null, { loose: 1 }); }).to.throw(/must be a boolean/); }); }); @@ -29,25 +21,25 @@ describe("es2015 preset", function () { describe("modules", function () { it("doesn't throw when passing one false", function () { expect(function () { - es2015.buildPreset(null, { modules: false }); + es2015(null, { modules: false }); }).not.to.throw(); }); it("doesn't throw when passing one of: 'commonjs', 'amd', 'umd', 'systemjs", function () { expect(function () { - es2015.buildPreset(null, { modules: "commonjs" }); + es2015(null, { modules: "commonjs" }); }).not.to.throw(); expect(function () { - es2015.buildPreset(null, { modules: "amd" }); + es2015(null, { modules: "amd" }); }).not.to.throw(); expect(function () { - es2015.buildPreset(null, { modules: "umd" }); + es2015(null, { modules: "umd" }); }).not.to.throw(); expect(function () { - es2015.buildPreset(null, { modules: "systemjs" }); + es2015(null, { modules: "systemjs" }); }).not.to.throw(); }); }); diff --git a/packages/babel-preset-es2016/src/index.js b/packages/babel-preset-es2016/src/index.js index 3ce3c75985..e0857e59c2 100644 --- a/packages/babel-preset-es2016/src/index.js +++ b/packages/babel-preset-es2016/src/index.js @@ -1,7 +1,9 @@ import transformExponentiationOperator from "babel-plugin-transform-exponentiation-operator"; -export default { - plugins: [ - transformExponentiationOperator - ] -}; +export default function () { + return { + plugins: [ + transformExponentiationOperator + ] + }; +} diff --git a/packages/babel-preset-es2017/src/index.js b/packages/babel-preset-es2017/src/index.js index 8c83b453c2..599186b002 100644 --- a/packages/babel-preset-es2017/src/index.js +++ b/packages/babel-preset-es2017/src/index.js @@ -1,9 +1,11 @@ import syntaxTrailingFunctionCommas from "babel-plugin-syntax-trailing-function-commas"; import transformAsyncToGenerator from "babel-plugin-transform-async-to-generator"; -export default { - plugins: [ - syntaxTrailingFunctionCommas, - transformAsyncToGenerator - ] -}; +export default function () { + return { + plugins: [ + syntaxTrailingFunctionCommas, + transformAsyncToGenerator + ] + }; +} diff --git a/packages/babel-preset-flow/src/index.js b/packages/babel-preset-flow/src/index.js index 8251ca8270..ef847d5f57 100644 --- a/packages/babel-preset-flow/src/index.js +++ b/packages/babel-preset-flow/src/index.js @@ -1,7 +1,9 @@ import transformFlowStripTypes from "babel-plugin-transform-flow-strip-types"; -export default { - plugins: [ - transformFlowStripTypes - ] -}; +export default function () { + return { + plugins: [ + transformFlowStripTypes + ] + }; +} diff --git a/packages/babel-preset-latest/src/index.js b/packages/babel-preset-latest/src/index.js index 8571beea98..5469c2146d 100644 --- a/packages/babel-preset-latest/src/index.js +++ b/packages/babel-preset-latest/src/index.js @@ -2,13 +2,10 @@ import presetES2015 from "babel-preset-es2015"; import presetES2016 from "babel-preset-es2016"; import presetES2017 from "babel-preset-es2017"; -// Rather than exporting a default object to represent the preset, we can -// also export a default function instead, as this preset demonstrates. -// This allows one to further configure a preset by way of specific options. export default function (context, opts = {}) { return { presets: [ - opts.es2015 !== false && [presetES2015.buildPreset, opts.es2015], + opts.es2015 !== false && [presetES2015, opts.es2015], opts.es2016 !== false && presetES2016, opts.es2017 !== false && presetES2017 ].filter(Boolean) // filter out falsy values diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index 361238658e..7f30145f70 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -7,21 +7,23 @@ import transformReactDisplayName from "babel-plugin-transform-react-display-name // import transformReactJSXSource from "babel-plugin-transform-react-jsx-source"; // import transformReactJSXSelf from "babel-plugin-transform-react-jsx-self"; -export default { - presets: [ - presetFlow - ], - plugins: [ - transformReactJSX, - transformSyntaxJSX, - transformReactDisplayName - ], - env: { - development: { - plugins: [ - // transformReactJSXSource, - // transformReactJSXSelf - ] +export default function () { + return { + presets: [ + presetFlow + ], + plugins: [ + transformReactJSX, + transformSyntaxJSX, + transformReactDisplayName + ], + env: { + development: { + plugins: [ + // transformReactJSXSource, + // transformReactJSXSelf + ] + } } - } -}; + }; +} diff --git a/packages/babel-preset-stage-0/src/index.js b/packages/babel-preset-stage-0/src/index.js index b9b65f10a0..f134ea884c 100644 --- a/packages/babel-preset-stage-0/src/index.js +++ b/packages/babel-preset-stage-0/src/index.js @@ -3,12 +3,14 @@ import presetStage1 from "babel-preset-stage-1"; import transformDoExpressions from "babel-plugin-transform-do-expressions"; import transformFunctionBind from "babel-plugin-transform-function-bind"; -export default { - presets: [ - presetStage1 - ], - plugins: [ - transformDoExpressions, - transformFunctionBind - ] -}; +export default function () { + return { + presets: [ + presetStage1 + ], + plugins: [ + transformDoExpressions, + transformFunctionBind + ] + }; +} diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index 11ed6e011c..9ab261e3c9 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -3,12 +3,14 @@ import presetStage2 from "babel-preset-stage-2"; import transformDecorators from "babel-plugin-transform-decorators"; import transformExportExtensions from "babel-plugin-transform-export-extensions"; -export default { - presets: [ - presetStage2 - ], - plugins: [ - transformDecorators, - transformExportExtensions - ] -}; +export default function () { + return { + presets: [ + presetStage2 + ], + plugins: [ + transformDecorators, + transformExportExtensions + ] + }; +} diff --git a/packages/babel-preset-stage-2/src/index.js b/packages/babel-preset-stage-2/src/index.js index efdd6ac729..9f251fc38c 100644 --- a/packages/babel-preset-stage-2/src/index.js +++ b/packages/babel-preset-stage-2/src/index.js @@ -4,13 +4,15 @@ import syntaxDynamicImport from "babel-plugin-syntax-dynamic-import"; import transformClassProperties from "babel-plugin-transform-class-properties"; import transformUnicodePropertyRegex from "babel-plugin-transform-unicode-property-regex"; -export default { - presets: [ - presetStage3 - ], - plugins: [ - syntaxDynamicImport, - transformClassProperties, - transformUnicodePropertyRegex - ] -}; +export default function () { + return { + presets: [ + presetStage3 + ], + plugins: [ + syntaxDynamicImport, + transformClassProperties, + transformUnicodePropertyRegex + ] + }; +} diff --git a/packages/babel-preset-stage-3/src/index.js b/packages/babel-preset-stage-3/src/index.js index dd6e2edbe9..20c6c49393 100644 --- a/packages/babel-preset-stage-3/src/index.js +++ b/packages/babel-preset-stage-3/src/index.js @@ -1,9 +1,11 @@ import transformObjectRestSpread from "babel-plugin-transform-object-rest-spread"; import transformAsyncGeneratorFunctions from "babel-plugin-transform-async-generator-functions"; -export default { - plugins: [ - transformAsyncGeneratorFunctions, - transformObjectRestSpread - ] -}; +export default function () { + return { + plugins: [ + transformAsyncGeneratorFunctions, + transformObjectRestSpread + ] + }; +} From f3e92010c5e4a11d34652ce1c46fcd05db85c62d Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 24 Feb 2017 13:28:39 -0800 Subject: [PATCH 191/222] Remove the unneeded Pipeline class. --- packages/babel-core/src/index.js | 9 +-- .../src/transformation/file/index.js | 8 +-- .../babel-core/src/transformation/pipeline.js | 69 +++++++------------ 3 files changed, 30 insertions(+), 56 deletions(-) diff --git a/packages/babel-core/src/index.js b/packages/babel-core/src/index.js index 86a65bde56..1efc832d1f 100644 --- a/packages/babel-core/src/index.js +++ b/packages/babel-core/src/index.js @@ -27,13 +27,8 @@ export function Plugin(alias) { throw new Error(`The (${alias}) Babel 5 plugin is being run with Babel 6.`); } -import Pipeline from "./transformation/pipeline"; -export { Pipeline }; - -const pipeline = new Pipeline; -export const analyse = pipeline.analyse.bind(pipeline); -export const transform = pipeline.transform.bind(pipeline); -export const transformFromAst = pipeline.transformFromAst.bind(pipeline); +import { transform, analyse, transformFromAst } from "./transformation/pipeline"; +export { transform, analyse, transformFromAst }; export function transformFile(filename: string, opts?: Object, callback: Function) { if (typeof opts === "function") { diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 50b641c194..1a5471c115 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -4,7 +4,6 @@ import getHelper from "babel-helpers"; import * as metadataVisitor from "./metadata"; import convertSourceMap from "convert-source-map"; import OptionManager from "./options/option-manager"; -import type Pipeline from "../pipeline"; import PluginPass from "../plugin-pass"; import { NodePath, Hub, Scope } from "babel-traverse"; import sourceMap from "source-map"; @@ -42,11 +41,9 @@ const errorVisitor = { }; export default class File extends Store { - constructor(opts: Object = {}, pipeline: Pipeline) { + constructor(opts: Object = {}) { super(); - this.pipeline = pipeline; - this.log = new Logger(this, opts.filename || "unknown"); this.opts = this.initOptions(opts); @@ -105,7 +102,6 @@ export default class File extends Store { pluginVisitors: Array; pluginPasses: Array; - pipeline: Pipeline; parserOpts: BabelParserOptions; log: Logger; opts: Object; @@ -136,7 +132,7 @@ export default class File extends Store { } initOptions(opts) { - opts = new OptionManager(this.log, this.pipeline).init(opts); + opts = new OptionManager(this.log).init(opts); if (opts.inputSourceMap) { opts.sourceMaps = true; diff --git a/packages/babel-core/src/transformation/pipeline.js b/packages/babel-core/src/transformation/pipeline.js index 15b3f0cffd..c38edd7312 100644 --- a/packages/babel-core/src/transformation/pipeline.js +++ b/packages/babel-core/src/transformation/pipeline.js @@ -3,48 +3,31 @@ import normalizeAst from "../helpers/normalize-ast"; import Plugin from "./plugin"; import File from "./file"; -export default class Pipeline { - lint(code: string, opts?: Object = {}): BabelFileResult { - opts.code = false; - opts.mode = "lint"; - return this.transform(code, opts); - } - - pretransform(code: string, opts?: Object): BabelFileResult { - const file = new File(opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.parseCode(code); - return file; - }); - } - - transform(code: string, opts?: Object): BabelFileResult { - const file = new File(opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.parseCode(code); - return file.transform(); - }); - } - - analyse(code: string, opts: Object = {}, visitor?: Object): ?BabelFileMetadata { - opts.code = false; - if (visitor) { - opts.plugins = opts.plugins || []; - opts.plugins.push(new Plugin({ visitor })); - } - return this.transform(code, opts).metadata; - } - - transformFromAst(ast: Object, code: string, opts: Object): BabelFileResult { - ast = normalizeAst(ast); - - const file = new File(opts, this); - return file.wrap(code, function () { - file.addCode(code); - file.addAst(ast); - return file.transform(); - }); +export function analyse(code: string, opts: Object = {}, visitor?: Object): ?BabelFileMetadata { + opts.code = false; + if (visitor) { + opts.plugins = opts.plugins || []; + opts.plugins.push(new Plugin({ visitor })); } + return transform(code, opts).metadata; +} + +export function transform(code: string, opts?: Object): BabelFileResult { + const file = new File(opts); + return file.wrap(code, function () { + file.addCode(code); + file.parseCode(code); + return file.transform(); + }); +} + +export function transformFromAst(ast: Object, code: string, opts: Object): BabelFileResult { + ast = normalizeAst(ast); + + const file = new File(opts); + return file.wrap(code, function () { + file.addCode(code); + file.addAst(ast); + return file.transform(); + }); } From eb9d699ce9ff2cfb246d4ab2b8a6a4e246888db3 Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 25 Feb 2017 18:19:29 +0100 Subject: [PATCH 192/222] style: [skip ci] lint code snippets in md (#5379) --- README.md | 4 ++-- .../README.md | 10 +++++++--- .../README.md | 10 +++++++--- .../babel-plugin-transform-es2015-for-of/README.md | 8 ++++++-- .../README.md | 10 +++++++--- .../babel-plugin-transform-es2015-spread/README.md | 10 +++++++--- .../README.md | 10 +++++++--- .../README.md | 4 +++- packages/babel-plugin-transform-react-jsx/README.md | 11 ++++++++--- packages/babel-plugin-transform-runtime/README.md | 10 +++++++--- .../babel-plugin-transform-strict-mode/README.md | 10 +++++++--- packages/babel-preset-latest/README.md | 4 ++-- packages/babel-register/README.md | 2 +- packages/babel-template/README.md | 12 ++++++------ 14 files changed, 77 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 21a845d354..b8fe9840ef 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ When your supported environments don't support certain features natively, it wil ```js // ES2015 arrow function -[1,2,3].map(n => n + 1); +[1, 2, 3].map((n) => n + 1); ``` **Out** ```js -[1,2,3].map(function(n) { +[1, 2, 3].map(function(n) { return n + 1; }); ``` diff --git a/packages/babel-plugin-transform-async-to-module-method/README.md b/packages/babel-plugin-transform-async-to-module-method/README.md index 268271a163..116da364f5 100644 --- a/packages/babel-plugin-transform-async-to-module-method/README.md +++ b/packages/babel-plugin-transform-async-to-module-method/README.md @@ -34,13 +34,17 @@ npm install --save-dev babel-plugin-transform-async-to-module-method **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-async-to-module-method"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-async-to-module-method", { diff --git a/packages/babel-plugin-transform-es2015-computed-properties/README.md b/packages/babel-plugin-transform-es2015-computed-properties/README.md index 573996ff5b..4a7c74d026 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/README.md +++ b/packages/babel-plugin-transform-es2015-computed-properties/README.md @@ -57,13 +57,17 @@ npm install --save-dev babel-plugin-transform-es2015-computed-properties **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-computed-properties"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-es2015-computed-properties", { diff --git a/packages/babel-plugin-transform-es2015-for-of/README.md b/packages/babel-plugin-transform-es2015-for-of/README.md index 7aff9a00f2..3e9efe20d9 100644 --- a/packages/babel-plugin-transform-es2015-for-of/README.md +++ b/packages/babel-plugin-transform-es2015-for-of/README.md @@ -49,13 +49,17 @@ npm install --save-dev babel-plugin-transform-es2015-for-of **.babelrc** +Without options: + ```js -// without options { "plugins": ["transform-es2015-for-of"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-es2015-for-of", { diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/README.md b/packages/babel-plugin-transform-es2015-modules-systemjs/README.md index ca205005d9..554421de63 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/README.md +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/README.md @@ -35,13 +35,17 @@ npm install --save-dev babel-plugin-transform-es2015-modules-systemjs **.babelrc** -```javascript -// without options +Without options: + +```json { "plugins": ["transform-es2015-modules-systemjs"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-es2015-modules-systemjs", { diff --git a/packages/babel-plugin-transform-es2015-spread/README.md b/packages/babel-plugin-transform-es2015-spread/README.md index af75353e36..e33a1db7cf 100644 --- a/packages/babel-plugin-transform-es2015-spread/README.md +++ b/packages/babel-plugin-transform-es2015-spread/README.md @@ -48,13 +48,17 @@ npm install --save-dev babel-plugin-transform-es2015-spread **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-spread"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-es2015-spread", { diff --git a/packages/babel-plugin-transform-es2015-template-literals/README.md b/packages/babel-plugin-transform-es2015-template-literals/README.md index fd0f57bf18..477b11cce6 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/README.md +++ b/packages/babel-plugin-transform-es2015-template-literals/README.md @@ -28,13 +28,17 @@ npm install --save-dev babel-plugin-transform-es2015-template-literals **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-es2015-template-literals"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-es2015-template-literals", { diff --git a/packages/babel-plugin-transform-object-rest-spread/README.md b/packages/babel-plugin-transform-object-rest-spread/README.md index b8f365d7af..61c3debfff 100644 --- a/packages/babel-plugin-transform-object-rest-spread/README.md +++ b/packages/babel-plugin-transform-object-rest-spread/README.md @@ -41,13 +41,15 @@ This plugin will use babel's `extends` helper, which will polyfill `Object.assig * `useBuiltIns` - Do not use Babel's helper's and just transform to use the built-in method (Disabled by default). -```js +```json { "plugins": [ ["transform-object-rest-spread", { "useBuiltIns": true }] ] } +``` +```js // source z = { x, ...y }; // compiled diff --git a/packages/babel-plugin-transform-react-jsx/README.md b/packages/babel-plugin-transform-react-jsx/README.md index 44a20066dd..128536db1e 100644 --- a/packages/babel-plugin-transform-react-jsx/README.md +++ b/packages/babel-plugin-transform-react-jsx/README.md @@ -64,12 +64,17 @@ npm install --save-dev babel-plugin-transform-react-jsx **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-react-jsx"] } -// with options +``` + +With options: + +```json { "plugins": [ ["transform-react-jsx", { diff --git a/packages/babel-plugin-transform-runtime/README.md b/packages/babel-plugin-transform-runtime/README.md index ff42d7e9af..011a3eab10 100644 --- a/packages/babel-plugin-transform-runtime/README.md +++ b/packages/babel-plugin-transform-runtime/README.md @@ -40,13 +40,17 @@ The transformation plugin is typically used only in development, but the runtime Add the following line to your `.babelrc` file: -```js -// without options +Without options: + +```json { "plugins": ["transform-runtime"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-runtime", { diff --git a/packages/babel-plugin-transform-strict-mode/README.md b/packages/babel-plugin-transform-strict-mode/README.md index d6c258d300..08c5afe405 100644 --- a/packages/babel-plugin-transform-strict-mode/README.md +++ b/packages/babel-plugin-transform-strict-mode/README.md @@ -34,13 +34,17 @@ npm install --save-dev babel-plugin-transform-strict-mode **.babelrc** -```js -// without options +Without options: + +```json { "plugins": ["transform-strict-mode"] } +``` -// with options +With options: + +```json { "plugins": [ ["transform-strict-mode", { diff --git a/packages/babel-preset-latest/README.md b/packages/babel-preset-latest/README.md index 056d95645d..ec4e16769d 100644 --- a/packages/babel-preset-latest/README.md +++ b/packages/babel-preset-latest/README.md @@ -42,7 +42,7 @@ require("babel-core").transform("code", { Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugins/preset-es2015/). -```js +```json { "presets": [ ["latest", { @@ -54,7 +54,7 @@ Toggles including plugins from the [es2015 preset](https://babeljs.io/docs/plugi You can also pass options down to the `es2015` preset. -```js +```json { "presets": [ ["latest", { diff --git a/packages/babel-register/README.md b/packages/babel-register/README.md index 2f05d6a7f7..6a4682b568 100644 --- a/packages/babel-register/README.md +++ b/packages/babel-register/README.md @@ -53,7 +53,7 @@ require("babel-register")({ // Ignore can also be specified as a function. ignore: function(filename) { - if (filename === '/path/to/es6-file.js') { + if (filename === "/path/to/es6-file.js") { return false; } else { return true; diff --git a/packages/babel-template/README.md b/packages/babel-template/README.md index 9eeb0adf3f..c73507af59 100644 --- a/packages/babel-template/README.md +++ b/packages/babel-template/README.md @@ -13,24 +13,24 @@ npm install --save-dev babel-template ## Usage ```js -import template from 'babel-template'; -import generate from 'babel-generator'; -import * as t from 'babel-types'; +import template from "babel-template"; +import generate from "babel-generator"; +import * as t from "babel-types"; const buildRequire = template(` var IMPORT_NAME = require(SOURCE); `); const ast = buildRequire({ - IMPORT_NAME: t.identifier('myModule'), - SOURCE: t.stringLiteral('my-module') + IMPORT_NAME: t.identifier("myModule"), + SOURCE: t.stringLiteral("my-module") }); console.log(generate(ast).code); ``` ```js -var myModule = require('my-module'); +const myModule = require("my-module"); ``` ## API From 01918c68c196b2dd3ab54a20e2598271041fe50a Mon Sep 17 00:00:00 2001 From: Alex Kuzmenko Date: Sat, 25 Feb 2017 20:26:29 +0200 Subject: [PATCH 193/222] Improve babel-generator's code coverage (#5338) --- packages/babel-generator/src/generators/modules.js | 6 ------ .../test/fixtures/types/DoExpression/actual.js | 7 +++++++ .../test/fixtures/types/DoExpression/expected.js | 7 +++++++ .../test/fixtures/types/LogicalExpression/actual.js | 2 ++ .../test/fixtures/types/LogicalExpression/expected.js | 2 ++ 5 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 packages/babel-generator/test/fixtures/types/DoExpression/actual.js create mode 100644 packages/babel-generator/test/fixtures/types/DoExpression/expected.js create mode 100644 packages/babel-generator/test/fixtures/types/LogicalExpression/actual.js create mode 100644 packages/babel-generator/test/fixtures/types/LogicalExpression/expected.js diff --git a/packages/babel-generator/src/generators/modules.js b/packages/babel-generator/src/generators/modules.js index 71ffe6e9c3..3d6fbae1e2 100644 --- a/packages/babel-generator/src/generators/modules.js +++ b/packages/babel-generator/src/generators/modules.js @@ -45,12 +45,6 @@ export function ExportAllDeclaration(node: Object) { this.word("export"); this.space(); this.token("*"); - if (node.exported) { - this.space(); - this.word("as"); - this.space(); - this.print(node.exported, node); - } this.space(); this.word("from"); this.space(); diff --git a/packages/babel-generator/test/fixtures/types/DoExpression/actual.js b/packages/babel-generator/test/fixtures/types/DoExpression/actual.js new file mode 100644 index 0000000000..d6ec00f889 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/DoExpression/actual.js @@ -0,0 +1,7 @@ +let a = do { + if (x > 10) { + 'big'; + } else { + 'small'; + } +}; diff --git a/packages/babel-generator/test/fixtures/types/DoExpression/expected.js b/packages/babel-generator/test/fixtures/types/DoExpression/expected.js new file mode 100644 index 0000000000..d6ec00f889 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/DoExpression/expected.js @@ -0,0 +1,7 @@ +let a = do { + if (x > 10) { + 'big'; + } else { + 'small'; + } +}; diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/actual.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/actual.js new file mode 100644 index 0000000000..5df2b0728d --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/actual.js @@ -0,0 +1,2 @@ +foo ||bar; +(x => x)|| bar; diff --git a/packages/babel-generator/test/fixtures/types/LogicalExpression/expected.js b/packages/babel-generator/test/fixtures/types/LogicalExpression/expected.js new file mode 100644 index 0000000000..91f0b20ce2 --- /dev/null +++ b/packages/babel-generator/test/fixtures/types/LogicalExpression/expected.js @@ -0,0 +1,2 @@ +foo || bar; +(x => x) || bar; From 6529cb5f01306ab89e9bfb325b6f5eaaf962785e Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Sat, 25 Feb 2017 18:39:18 -0500 Subject: [PATCH 194/222] babel-generator: add another do test --- .../babel-generator/test/fixtures/types/DoExpression/actual.js | 2 ++ .../test/fixtures/types/DoExpression/expected.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/babel-generator/test/fixtures/types/DoExpression/actual.js b/packages/babel-generator/test/fixtures/types/DoExpression/actual.js index d6ec00f889..944d0559dd 100644 --- a/packages/babel-generator/test/fixtures/types/DoExpression/actual.js +++ b/packages/babel-generator/test/fixtures/types/DoExpression/actual.js @@ -1,3 +1,5 @@ +(do {}); + let a = do { if (x > 10) { 'big'; diff --git a/packages/babel-generator/test/fixtures/types/DoExpression/expected.js b/packages/babel-generator/test/fixtures/types/DoExpression/expected.js index d6ec00f889..944d0559dd 100644 --- a/packages/babel-generator/test/fixtures/types/DoExpression/expected.js +++ b/packages/babel-generator/test/fixtures/types/DoExpression/expected.js @@ -1,3 +1,5 @@ +(do {}); + let a = do { if (x > 10) { 'big'; From 6d6cdf6bafeed80dc8056e23a1014a8d7cd5377a Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Tue, 28 Feb 2017 22:39:08 +0100 Subject: [PATCH 195/222] [7.0] Allow presets to be objects (#5385) * Allow presets to be objects * Improve logic to detect preset format --- .../file/options/option-manager.js | 22 ++++++++++++------- ...15_default.js => es2015_default_object.js} | 0 .../option-manager/presets/es2015_invalid.js | 6 +++++ .../presets/{es5.js => es5_object.js} | 0 packages/babel-core/test/option-manager.js | 5 +++-- 5 files changed, 23 insertions(+), 10 deletions(-) rename packages/babel-core/test/fixtures/option-manager/presets/{es2015_default.js => es2015_default_object.js} (100%) create mode 100644 packages/babel-core/test/fixtures/option-manager/presets/es2015_invalid.js rename packages/babel-core/test/fixtures/option-manager/presets/{es5.js => es5_object.js} (100%) diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index 0dd3ecf70d..d50bd2139f 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -268,29 +268,30 @@ export default class OptionManager { JSON.stringify(dirname)); } } - const presetFactory = this.getPresetFactoryForPreset(presetLoc || preset); + const resolvedPreset = this.loadPreset(presetLoc || preset, options, { dirname }); - preset = presetFactory(context, options, { dirname }); + if (onResolve) onResolve(resolvedPreset, presetLoc); - if (onResolve) onResolve(preset, presetLoc); + return resolvedPreset; } catch (e) { if (presetLoc) { e.message += ` (While processing preset: ${JSON.stringify(presetLoc)})`; } throw e; } - - return preset; }); } - getPresetFactoryForPreset(preset) { + /** + * Tries to load one preset. The input is either the module name of the preset, + * a function, or an object + */ + loadPreset(preset, options, meta) { let presetFactory = preset; if (typeof presetFactory === "string") { presetFactory = require(presetFactory); } - // If the imported preset is a transpiled ES2015 module if (typeof presetFactory === "object" && presetFactory.__esModule) { if (presetFactory.default) { presetFactory = presetFactory.default; @@ -299,12 +300,17 @@ export default class OptionManager { } } + // Allow simple object exports + if (typeof presetFactory === "object") { + return presetFactory; + } + if (typeof presetFactory !== "function") { // eslint-disable-next-line max-len throw new Error(`Unsupported preset format: ${typeof presetFactory}. Expected preset to return a function.`); } - return presetFactory; + return presetFactory(context, options, meta); } normaliseOptions() { diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_default.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js similarity index 100% rename from packages/babel-core/test/fixtures/option-manager/presets/es2015_default.js rename to packages/babel-core/test/fixtures/option-manager/presets/es2015_default_object.js diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es2015_invalid.js b/packages/babel-core/test/fixtures/option-manager/presets/es2015_invalid.js new file mode 100644 index 0000000000..88437e1088 --- /dev/null +++ b/packages/babel-core/test/fixtures/option-manager/presets/es2015_invalid.js @@ -0,0 +1,6 @@ +// from code: +// export default "string"; +'use strict'; + +exports.__esModule = true; +exports.default = "string"; diff --git a/packages/babel-core/test/fixtures/option-manager/presets/es5.js b/packages/babel-core/test/fixtures/option-manager/presets/es5_object.js similarity index 100% rename from packages/babel-core/test/fixtures/option-manager/presets/es5.js rename to packages/babel-core/test/fixtures/option-manager/presets/es5_object.js diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 582b61d8be..665a514668 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -76,11 +76,12 @@ describe("option-manager", () => { } presetTest("es5_function"); + presetTest("es5_object"); presetTest("es2015_default_function"); + presetTest("es2015_default_object"); - presetThrowsTest("es5", /Expected preset to return a function./); - presetThrowsTest("es2015_default", /Expected preset to return a function./); presetThrowsTest("es2015_named", /Preset must export a default export when using ES6 modules/); + presetThrowsTest("es2015_invalid", /Unsupported preset format: string/); presetThrowsTest("es5_invalid", /Unsupported preset format: string/); }); }); From 3ff77a61e42cf0686cb1f950742c2053fc957da9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 28 Feb 2017 16:58:19 -0500 Subject: [PATCH 196/222] Update babylon beta 3 (#5394) * Update babylon to v7-beta.3 * convert RestProperty/SpreadProperty to RestElement/SpreadElement * add virtual types to make it easier to upgrade --- packages/babel-core/package.json | 2 +- packages/babel-generator/package.json | 2 +- .../babel-generator/src/generators/types.js | 2 - .../babel-generator/src/node/whitespace.js | 5 +- .../src/index.js | 4 +- .../src/index.js | 2 +- .../src/index.js | 36 +-- packages/babel-template/package.json | 2 +- packages/babel-traverse/package.json | 2 +- .../babel-traverse/src/path/evaluation.js | 2 +- .../src/path/lib/virtual-types.js | 30 +++ packages/babel-types/package.json | 2 +- packages/babel-types/src/definitions/core.js | 2 +- .../babel-types/src/definitions/es2015.js | 2 +- .../src/definitions/experimental.js | 20 -- packages/babel-types/src/retrievers.js | 1 - yarn.lock | 241 +++++++++--------- 17 files changed, 181 insertions(+), 176 deletions(-) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 1932064bab..c7490acbbd 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -34,7 +34,7 @@ "babel-register": "^6.23.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", - "babylon": "7.0.0-beta.0", + "babylon": "7.0.0-beta.3", "convert-source-map": "^1.1.0", "debug": "^2.1.1", "json5": "^0.5.0", diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index f6fe18b283..d4a971e231 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -21,6 +21,6 @@ }, "devDependencies": { "babel-helper-fixtures": "^6.22.0", - "babylon": "7.0.0-beta.0" + "babylon": "7.0.0-beta.3" } } diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index 3f39421400..c3d0bc359d 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -12,8 +12,6 @@ export function RestElement(node: Object) { export { RestElement as SpreadElement, - RestElement as SpreadProperty, - RestElement as RestProperty, }; export function ObjectExpression(node: Object) { diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index e55396768b..36ac02cf47 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -161,13 +161,12 @@ export const nodes = { }; /** - * Test if Property or SpreadProperty needs whitespace. + * Test if Property needs whitespace. */ nodes.ObjectProperty = nodes.ObjectTypeProperty = -nodes.ObjectMethod = -nodes.SpreadProperty = function (node: Object, parent): ?WhitespaceObject { +nodes.ObjectMethod = function (node: Object, parent): ?WhitespaceObject { if (parent.properties[0] === node) { return { before: true diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index 2609076a80..c1521ae573 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -140,7 +140,7 @@ export default function ({ types: t }) { if (i >= spreadPropIndex) break; // ignore other spread properties - if (t.isRestProperty(prop)) continue; + if (t.isRestElement(prop)) continue; let key = prop.key; if (t.isIdentifier(key) && !prop.computed) key = t.stringLiteral(prop.key.name); @@ -192,7 +192,7 @@ export default function ({ types: t }) { for (let i = 0; i < pattern.properties.length; i++) { const prop = pattern.properties[i]; - if (t.isRestProperty(prop)) { + if (t.isRestElement(prop)) { this.pushObjectRest(pattern, objRef, prop, i); } else { this.pushObjectProperty(prop, objRef); diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js index f2d7a6990f..0109d50b2f 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js @@ -12,7 +12,7 @@ export default function() { visitor: { ObjectExpression(path) { const { node } = path; - const plainProps = node.properties.filter((prop) => !t.isSpreadProperty(prop) && !prop.computed); + const plainProps = node.properties.filter((prop) => !t.isSpreadElement(prop) && !prop.computed); // A property is a duplicate key if: // * the property is a data property, and is preceeded by a data, diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index 8f9b62f85e..c0131303ac 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -1,20 +1,20 @@ import syntaxObjectRestSpread from "babel-plugin-syntax-object-rest-spread"; export default function ({ types: t }) { - function hasRestProperty(path) { - let foundRestProperty = false; + function hasRestElement(path) { + let foundRestElement = false; path.traverse({ - RestProperty() { - foundRestProperty = true; + RestElement() { + foundRestElement = true; path.stop(); } }); - return foundRestProperty; + return foundRestElement; } function hasSpread(node) { for (const prop of (node.properties)) { - if (t.isSpreadProperty(prop)) { + if (t.isSpreadElement(prop)) { return true; } } @@ -22,7 +22,7 @@ export default function ({ types: t }) { } function createObjectSpread(file, props, objRef) { - const restProperty = props.pop(); + const restElement = props.pop(); const keys = []; for (const prop of props) { @@ -34,7 +34,7 @@ export default function ({ types: t }) { } return [ - restProperty.argument, + restElement.argument, t.callExpression( file.addHelper("objectWithoutProperties"), [ objRef, @@ -44,13 +44,13 @@ export default function ({ types: t }) { ]; } - function replaceRestProperty(parentPath, paramPath, i, numParams) { + function replaceRestElement(parentPath, paramPath, i, numParams) { if (paramPath.isAssignmentPattern()) { - replaceRestProperty(parentPath, paramPath.get("left"), i, numParams); + replaceRestElement(parentPath, paramPath.get("left"), i, numParams); return; } - if (paramPath.isObjectPattern() && hasRestProperty(paramPath)) { + if (paramPath.isObjectPattern() && hasRestElement(paramPath)) { const uid = parentPath.scope.generateUidIdentifier("ref"); const declar = t.variableDeclaration("let", [ @@ -73,7 +73,7 @@ export default function ({ types: t }) { Function(path) { const params = path.get("params"); for (let i = 0; i < params.length; i++) { - replaceRestProperty(params[i].parentPath, params[i], i, params.length); + replaceRestElement(params[i].parentPath, params[i], i, params.length); } }, // adapted from transform-es2015-destructuring/src/index.js#pushObjectRest @@ -84,7 +84,7 @@ export default function ({ types: t }) { let insertionPath = path; path.get("id").traverse({ - RestProperty(path) { + RestElement(path) { if ( // skip single-property case, e.g. // const { ...x } = foo(); @@ -148,7 +148,7 @@ export default function ({ types: t }) { ExportNamedDeclaration(path) { const declaration = path.get("declaration"); if (!declaration.isVariableDeclaration()) return; - if (!hasRestProperty(declaration)) return; + if (!hasRestElement(declaration)) return; const specifiers = []; @@ -166,12 +166,12 @@ export default function ({ types: t }) { // try {} catch ({a, ...b}) {} CatchClause(path) { const paramPath = path.get("param"); - replaceRestProperty(paramPath.parentPath, paramPath); + replaceRestElement(paramPath.parentPath, paramPath); }, // ({a, ...b} = c); AssignmentExpression(path, file) { const leftPath = path.get("left"); - if (leftPath.isObjectPattern() && hasRestProperty(leftPath)) { + if (leftPath.isObjectPattern() && hasRestElement(leftPath)) { const nodes = []; let ref; @@ -212,7 +212,7 @@ export default function ({ types: t }) { const left = node.left; // for ({a, ...b} of []) {} - if (t.isObjectPattern(left) && hasRestProperty(leftPath)) { + if (t.isObjectPattern(left) && hasRestElement(leftPath)) { const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ @@ -266,7 +266,7 @@ export default function ({ types: t }) { } for (const prop of (path.node.properties: Array)) { - if (t.isSpreadProperty(prop)) { + if (t.isSpreadElement(prop)) { push(); args.push(prop.argument); } else { diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index 927e65ee01..bee9bfa059 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-template", "main": "lib/index.js", "dependencies": { - "babylon": "7.0.0-beta.0", + "babylon": "7.0.0-beta.3", "babel-traverse": "^6.23.0", "babel-types": "^6.23.0", "lodash": "^4.2.0" diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index f8a095e696..3c85f0aabb 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -11,7 +11,7 @@ "babel-code-frame": "^6.22.0", "babel-messages": "^6.23.0", "babel-types": "^6.23.0", - "babylon": "7.0.0-beta.0", + "babylon": "7.0.0-beta.3", "debug": "^2.2.0", "globals": "^9.0.0", "invariant": "^2.2.0", diff --git a/packages/babel-traverse/src/path/evaluation.js b/packages/babel-traverse/src/path/evaluation.js index 971a66a409..e1ce48006b 100644 --- a/packages/babel-traverse/src/path/evaluation.js +++ b/packages/babel-traverse/src/path/evaluation.js @@ -233,7 +233,7 @@ export function evaluate(): { confident: boolean; value: any } { const obj = {}; const props: Array = path.get("properties"); for (const prop of props) { - if (prop.isObjectMethod() || prop.isSpreadProperty()) { + if (prop.isObjectMethod() || prop.isSpreadElement()) { return deopt(prop); } const keyPath = prop.get("key"); diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index 07ba907144..4d287b6f3d 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -120,3 +120,33 @@ export const Flow = { } } }; + +// TODO: 7.0 Backwards Compat +export const RestProperty = { + types: ["RestElement"], + checkPath(path: NodePath): boolean { + return path.parentPath && path.parentPath.isObjectPattern(); + }, +}; + +export const SpreadProperty = { + types: ["RestElement"], + checkPath(path: NodePath): boolean { + return path.parentPath && path.parentPath.isObjectExpression(); + }, +}; + +export const ExistentialTypeParam = { + types: ["ExistsTypeAnnotation"] +}; + +export const NumericLiteralTypeAnnotation = { + types: ["NumberLiteralTypeAnnotation"] +}; + +export const ForAwaitStatement = { + types: ["ForOfStatement"], + checkPath({ node }: NodePath): boolean { + return node.await === true; + } +}; diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 9c1508b651..0e0a3b01cf 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -13,6 +13,6 @@ "to-fast-properties": "^1.0.1" }, "devDependencies": { - "babylon": "7.0.0-beta.0" + "babylon": "7.0.0-beta.3" } } diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index e7b7a272e0..8daef2c492 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -470,7 +470,7 @@ defineType("ObjectExpression", { properties: { validate: chain( assertValueType("array"), - assertEach(assertNodeType("ObjectMethod", "ObjectProperty", "SpreadProperty")) + assertEach(assertNodeType("ObjectMethod", "ObjectProperty", "SpreadElement")) ) } } diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index 028e6a0b18..b170af150e 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -298,7 +298,7 @@ defineType("ObjectPattern", { aliases: ["Pattern", "LVal"], fields: { properties: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("RestProperty", "Property"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("RestElement", "Property"))) }, decorators: { validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index f7561a864b..36e5f46e05 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -61,23 +61,3 @@ defineType("ExportNamespaceSpecifier", { } } }); - -defineType("RestProperty", { - visitor: ["argument"], - aliases: ["UnaryLike"], - fields: { - argument: { - validate: assertNodeType("LVal") - } - } -}); - -defineType("SpreadProperty", { - visitor: ["argument"], - aliases: ["UnaryLike"], - fields: { - argument: { - validate: assertNodeType("Expression") - } - } -}); diff --git a/packages/babel-types/src/retrievers.js b/packages/babel-types/src/retrievers.js index 2395ba3046..caabe9acce 100644 --- a/packages/babel-types/src/retrievers.js +++ b/packages/babel-types/src/retrievers.js @@ -94,7 +94,6 @@ getBindingIdentifiers.keys = { RestElement: ["argument"], UpdateExpression: ["argument"], - RestProperty: ["argument"], ObjectProperty: ["value"], AssignmentPattern: ["left"], diff --git a/yarn.lock b/yarn.lock index 2f54094083..f415529c77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,14 +1,5 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 - - -JSONStream@^1.0.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - abbrev@1: version "1.0.9" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" @@ -909,9 +900,9 @@ browser-pack@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d" dependencies: - JSONStream "^1.0.3" combine-source-map "~0.6.1" defined "^1.0.0" + JSONStream "^1.0.3" through2 "^1.0.0" umd "^3.0.0" @@ -919,9 +910,9 @@ browser-pack@^6.0.1: version "6.0.2" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.2.tgz#f86cd6cef4f5300c8e63e07a4d512f65fbff4531" dependencies: - JSONStream "^1.0.3" combine-source-map "~0.7.1" defined "^1.0.0" + JSONStream "^1.0.3" through2 "^2.0.0" umd "^3.0.0" @@ -999,7 +990,6 @@ browserify@^13.1.1: version "13.3.0" resolved "https://registry.yarnpkg.com/browserify/-/browserify-13.3.0.tgz#b5a9c9020243f0c70e4675bec8223bc627e415ce" dependencies: - JSONStream "^1.0.3" assert "^1.4.0" browser-pack "^6.0.1" browser-resolve "^1.11.0" @@ -1021,6 +1011,7 @@ browserify@^13.1.1: https-browserify "~0.0.0" inherits "~2.0.1" insert-module-globals "^7.0.0" + JSONStream "^1.0.3" labeled-stream-splicer "^2.0.0" module-deps "^4.0.8" os-browserify "~0.1.1" @@ -1142,16 +1133,6 @@ chai@^3.5.0: deep-eql "^0.1.3" type-detect "^1.0.0" -chalk@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.1.tgz#509afb67066e7499f7eb3535c77445772ae2d019" - dependencies: - ansi-styles "^2.1.0" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -1162,6 +1143,16 @@ chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.1.tgz#509afb67066e7499f7eb3535c77445772ae2d019" + dependencies: + ansi-styles "^2.1.0" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + chokidar@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" @@ -1283,7 +1274,7 @@ command-join@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/command-join/-/command-join-2.0.0.tgz#52e8b984f4872d952ff1bdc8b98397d27c7144cf" -commander@2.9.0, commander@^2.9.0: +commander@^2.9.0, commander@2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1416,18 +1407,18 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" -debug@2.2.0, debug@~2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - dependencies: - ms "0.7.1" - debug@^2.1.1, debug@^2.2.0: version "2.6.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" dependencies: ms "0.7.2" +debug@~2.2.0, debug@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1554,18 +1545,18 @@ domain-browser@~1.1.0: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" -duplexer2@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" - dependencies: - readable-stream "~1.1.9" - duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" dependencies: readable-stream "^2.0.2" +duplexer2@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" + dependencies: + readable-stream "~1.1.9" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1629,7 +1620,7 @@ es6-set@~0.1.3: es6-symbol "3" event-emitter "~0.3.4" -es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: +es6-symbol@~3.1, es6-symbol@~3.1.0, es6-symbol@3: version "3.1.0" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" dependencies: @@ -1645,7 +1636,7 @@ es6-weak-map@^2.0.1: es6-iterator "2" es6-symbol "3" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5, escape-string-regexp@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2073,23 +2064,6 @@ glob-watcher@^0.0.6: dependencies: gaze "^0.5.1" -glob2base@^0.0.12: - version "0.0.12" - resolved "http://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" - dependencies: - find-index "^0.1.1" - -glob@7.0.5: - version "7.0.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - glob@^4.3.1: version "4.5.3" resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" @@ -2118,6 +2092,23 @@ glob@~3.1.21: inherits "1" minimatch "~0.2.11" +glob@7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + +glob2base@^0.0.12: + version "0.0.12" + resolved "http://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" + dependencies: + find-index "^0.1.1" + global-modules@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-0.2.3.tgz#ea5a3bed42c6d6ce995a4f8a1269b5dae223828d" @@ -2399,14 +2390,14 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" +inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + inherits@1: version "1.0.2" resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b" -inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" @@ -2467,10 +2458,10 @@ insert-module-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" dependencies: - JSONStream "^1.0.3" combine-source-map "~0.7.1" concat-stream "~1.5.1" is-buffer "^1.1.0" + JSONStream "^1.0.3" lexical-scope "^1.2.0" process "~0.11.0" through2 "^2.0.0" @@ -2644,14 +2635,14 @@ is-windows@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" -isarray@0.0.1, isarray@~0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - -isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: +isarray@^1.0.0, isarray@~1.0.0, isarray@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isarray@~0.0.1, isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + isexe@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.1.2.tgz#36f3e22e60750920f5e7241a476a8c6a42275ad0" @@ -2783,6 +2774,13 @@ jsonpointer@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" +JSONStream@^1.0.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + jsprim@^1.2.2: version "1.3.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.3.1.tgz#2a7256f70412a29ee3670aaca625994c4dcff252" @@ -3047,10 +3045,6 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" -lru-cache@2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" - lru-cache@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" @@ -3058,6 +3052,10 @@ lru-cache@^4.0.1: pseudomap "^1.0.1" yallist "^2.0.0" +lru-cache@2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" + map-cache@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -3159,15 +3157,15 @@ minimatch@~0.2.11: lru-cache "2" sigmund "~1.0.0" -minimist@0.0.8, minimist@~0.0.1: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: +minimist@~0.0.1, minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + +mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.0, mkdirp@~0.5.1, mkdirp@0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3193,7 +3191,6 @@ module-deps@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.0.8.tgz#55fd70623399706c3288bef7a609ff1e8c0ed2bb" dependencies: - JSONStream "^1.0.3" browser-resolve "^1.7.0" cached-path-relative "^1.0.0" concat-stream "~1.5.0" @@ -3201,6 +3198,7 @@ module-deps@^4.0.8: detective "^4.0.0" duplexer2 "^0.1.2" inherits "^2.0.1" + JSONStream "^1.0.3" parents "^1.0.0" readable-stream "^2.0.2" resolve "^1.1.3" @@ -3595,14 +3593,14 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - punycode@^1.3.2, punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" @@ -3662,6 +3660,18 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + "readable-stream@>=1.0.33-1 <1.1.0-0": version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" @@ -3680,18 +3690,6 @@ read-pkg@^1.0.0: isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" - dependencies: - buffer-shims "^1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - readable-stream@~2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" @@ -3804,7 +3802,7 @@ replace-ext@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" -request@>=2.42.0, request@^2.79.0: +request@^2.79.0, request@>=2.42.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -3859,14 +3857,14 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" - resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7: version "1.2.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" +resolve@1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -3887,7 +3885,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4: +rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4, rimraf@2: version "2.5.4" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" dependencies: @@ -3923,14 +3921,14 @@ rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" -"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - semver@^4.1.0: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" +semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0, "semver@2 || 3 || 4 || 5": + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + sequencify@~0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c" @@ -4106,6 +4104,10 @@ stream-splicer@^2.0.0: inherits "^2.0.1" readable-stream "^2.0.2" +string_decoder@~0.10.0, string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -4121,10 +4123,6 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" -string_decoder@~0.10.0, string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -4179,12 +4177,6 @@ subarg@^1.0.0: dependencies: minimist "^1.1.0" -supports-color@3.1.2, supports-color@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" - dependencies: - has-flag "^1.0.0" - supports-color@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" @@ -4193,6 +4185,12 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" +supports-color@^3.1.2, supports-color@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + sync-exec@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/sync-exec/-/sync-exec-0.6.2.tgz#717d22cc53f0ce1def5594362f3a89a2ebb91105" @@ -4265,6 +4263,10 @@ text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" +through@^2.3.6, "through@>=2.2.7 <3": + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + through2@^0.6.1: version "0.6.5" resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" @@ -4286,10 +4288,6 @@ through2@^2, through2@^2.0.0: readable-stream "^2.1.5" xtend "~4.0.1" -"through@>=2.2.7 <3", through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - tildify@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a" @@ -4352,14 +4350,14 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" - type-detect@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" +type-detect@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" + typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -4418,7 +4416,7 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -util@0.10.3, util@~0.10.1: +util@~0.10.1, util@0.10.3: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" dependencies: @@ -4526,7 +4524,7 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" -wordwrap@0.0.2, wordwrap@~0.0.2: +wordwrap@~0.0.2, wordwrap@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" @@ -4559,7 +4557,7 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.1: +xtend@^4.0.0, "xtend@>=4.0.0 <4.1.0-0", xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -4603,3 +4601,4 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" + From 2b9c3735fd179e2828074726cfb6c0f6bf0b9b88 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 1 Mar 2017 12:38:19 -0500 Subject: [PATCH 197/222] update to babylon beta 4 --- packages/babel-core/package.json | 2 +- packages/babel-generator/package.json | 2 +- packages/babel-template/package.json | 2 +- packages/babel-traverse/package.json | 2 +- packages/babel-types/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index c7490acbbd..2bbdd8270b 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -34,7 +34,7 @@ "babel-register": "^6.23.0", "babel-traverse": "^6.23.1", "babel-types": "^6.23.0", - "babylon": "7.0.0-beta.3", + "babylon": "7.0.0-beta.4", "convert-source-map": "^1.1.0", "debug": "^2.1.1", "json5": "^0.5.0", diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index d4a971e231..893ce50df4 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -21,6 +21,6 @@ }, "devDependencies": { "babel-helper-fixtures": "^6.22.0", - "babylon": "7.0.0-beta.3" + "babylon": "7.0.0-beta.4" } } diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index bee9bfa059..ef7ec2e466 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-template", "main": "lib/index.js", "dependencies": { - "babylon": "7.0.0-beta.3", + "babylon": "7.0.0-beta.4", "babel-traverse": "^6.23.0", "babel-types": "^6.23.0", "lodash": "^4.2.0" diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index 3c85f0aabb..dd8422c73b 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -11,7 +11,7 @@ "babel-code-frame": "^6.22.0", "babel-messages": "^6.23.0", "babel-types": "^6.23.0", - "babylon": "7.0.0-beta.3", + "babylon": "7.0.0-beta.4", "debug": "^2.2.0", "globals": "^9.0.0", "invariant": "^2.2.0", diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index 0e0a3b01cf..ce18c4ffc5 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -13,6 +13,6 @@ "to-fast-properties": "^1.0.1" }, "devDependencies": { - "babylon": "7.0.0-beta.3" + "babylon": "7.0.0-beta.4" } } From b363e7b19992b93035978f2f2061e577a351781f Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 1 Mar 2017 12:54:22 -0500 Subject: [PATCH 198/222] add @danez's changes --- .eslintignore | 1 + .../src/index.js | 17 +++++++++++++++++ .../export-async/default-arrow-export/actual.js | 1 + .../default-arrow-export/expected.js | 8 ++++++++ .../export-async/default-export/actual.js | 1 + .../export-async/default-export/expected.js | 15 +++++++++++++++ 6 files changed, 43 insertions(+) create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/actual.js create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/expected.js create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/actual.js create mode 100644 packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/expected.js diff --git a/.eslintignore b/.eslintignore index 5ea6066c60..02e6e29eb7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,6 +6,7 @@ packages/*/node_modules packages/*/lib packages/*/dist packages/*/test/fixtures +packages/*/test/tmp vendor _babel.github.io Gulpfile.js diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index 8cabe9ee06..5cdf041f30 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -146,6 +146,23 @@ function plainFunction(path: NodePath, callId: Object) { ]); declar._blockHoist = true; + if (path.parentPath.isExportDefaultDeclaration()) { + // change the path type so that replaceWith() does not wrap + // the identifier into an expressionStatement + path.parentPath.insertBefore(declar); + path.parentPath.replaceWith( + t.exportNamedDeclaration(null, + [ + t.exportSpecifier( + t.identifier(asyncFnId.name), + t.identifier("default") + ) + ] + ) + ); + return; + } + path.replaceWith(declar); } else { const retFunction = container.body.body[1].argument; diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/actual.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/actual.js new file mode 100644 index 0000000000..22ad33dc07 --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/actual.js @@ -0,0 +1 @@ +export default async () => { return await foo(); } diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/expected.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/expected.js new file mode 100644 index 0000000000..130cbb5e7f --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-arrow-export/expected.js @@ -0,0 +1,8 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = babelHelpers.asyncToGenerator(function* () { + return yield foo(); +}); \ No newline at end of file diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/actual.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/actual.js new file mode 100644 index 0000000000..9c82a22d00 --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/actual.js @@ -0,0 +1 @@ +export default async function myFunc() {} diff --git a/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/expected.js b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/expected.js new file mode 100644 index 0000000000..84d8c21afc --- /dev/null +++ b/packages/babel-plugin-transform-async-to-generator/test/fixtures/export-async/default-export/expected.js @@ -0,0 +1,15 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +let myFunc = (() => { + var _ref = babelHelpers.asyncToGenerator(function* () {}); + + return function myFunc() { + return _ref.apply(this, arguments); + }; +})(); + +exports.default = myFunc; \ No newline at end of file From b9c0f364c44c9590f59bb5ae5e499da9be191b55 Mon Sep 17 00:00:00 2001 From: JPeer264 Date: Wed, 1 Mar 2017 21:32:33 +0100 Subject: [PATCH 199/222] [skip ci] Fix: comments in usage w/ options --- packages/babel-plugin-transform-runtime/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-runtime/README.md b/packages/babel-plugin-transform-runtime/README.md index 011a3eab10..fb82b38de5 100644 --- a/packages/babel-plugin-transform-runtime/README.md +++ b/packages/babel-plugin-transform-runtime/README.md @@ -50,7 +50,7 @@ Without options: With options: -```json +```js { "plugins": [ ["transform-runtime", { From 0847ae055d3445199b3dc1793725759f4ad32d73 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 15:04:54 -0500 Subject: [PATCH 200/222] cleanup + update to lerna 38 (#5406) --- Makefile | 3 +- lerna.json | 4 +- package.json | 2 +- .../README.md | 99 ------- scripts/build-website.sh | 17 -- yarn.lock | 268 +++++++++--------- 6 files changed, 144 insertions(+), 249 deletions(-) delete mode 100644 packages/babel-plugin-transform-class-constructor-call/README.md delete mode 100755 scripts/build-website.sh diff --git a/Makefile b/Makefile index 2eadaffb7a..0d6ba230fc 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,8 @@ publish: BABEL_ENV=production make build-dist make test # not using lerna independent mode atm, so only update packages that have changed since we use ^ - ./node_modules/.bin/lerna publish --only-explicit-updates + # --only-explicit-updates + ./node_modules/.bin/lerna publish --npm-tag=next make clean bootstrap: diff --git a/lerna.json b/lerna.json index b5ae1cda13..7c616d72d4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { - "lerna": "2.0.0-beta.37", - "version": "independent", + "lerna": "2.0.0-beta.38", + "version": "6.23.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/package.json b/package.json index 35b4fbc876..b4ebcee5a0 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "gulp-plumber": "^1.0.1", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", - "lerna": "2.0.0-beta.37", + "lerna": "^2.0.0-beta.38", "lerna-changelog": "^0.2.0", "lodash": "^4.2.0", "mocha": "^3.0.0", diff --git a/packages/babel-plugin-transform-class-constructor-call/README.md b/packages/babel-plugin-transform-class-constructor-call/README.md deleted file mode 100644 index 519c27cc71..0000000000 --- a/packages/babel-plugin-transform-class-constructor-call/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# babel-plugin-transform-class-constructor-call (deprecated) - -> Proposal Withdrawn: can be solved with decorators. - -This plugin allows Babel to transform class constructors. - -It basically allows to use the [new.target](http://mdn.io/new.target) feature on ES2015 classes: - -```js -class Point { - - constructor(x, y) { - this.x = x; - this.y = y; - } - - call constructor(x, y) { - return new Point(x, y); - } - -} - -let p1 = new Point(1, 2); // OK -let p2 = Point(3, 4); // OK -``` - -## Example - -### Date example -The javascript [Date](http://mdn.io/date) works this way: - -```js -// You can get a Date instance using the new keyword -let now = new Date(); -console.log(now.getMonth()); // Prints '3' -console.log(now.toString()); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)' - -// You can get a string of the current date using Date as a function: -let nowStr = Date(); -console.log(nowStr); // Prints 'Mon Apr 11 2016 13:26:07 GMT+0100 (BST)' -``` - -It is currently possible to implement something like that using [new.target](http://mdn.io/new.target) (see [example in proposal](https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md#motivating-example)) and this new feature makes it available for ES2015 classes. - -A date implementation could be: - -```js -class Date { - constructor() { - // ... - } - - call constructor() { - let date = new Date(); - return date.toString(); - } -} - -let now = new Date(); // Get a Date instance -let nowStr = Date(); // Use the 'call constructor()' part to get a string value of the current date -``` - -## Installation - -```sh -npm install --save-dev babel-plugin-transform-class-constructor-call -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["transform-class-constructor-call"] -} -``` - -### Via CLI - -```sh -babel --plugins transform-class-constructor-call script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["transform-class-constructor-call"] -}); -``` - -## References - -* [Inactive Proposals](https://github.com/tc39/proposals/blob/master/inactive-proposals.md) -* [Proposal: Call Constructor](https://github.com/tc39/ecma262/blob/master/workingdocs/callconstructor.md) -* [Blog post: ECMAScript proposal: function-callable classes](http://www.2ality.com/2015/10/call-constructor-esprop.html) diff --git a/scripts/build-website.sh b/scripts/build-website.sh deleted file mode 100755 index aa344fb868..0000000000 --- a/scripts/build-website.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -set -e - -if [ ! -d ./_babel.github.io ]; then - git clone git@github.com:babel/babel.github.io.git _babel.github.io -fi - -cd _babel.github.io - -if [ ! -d ./_babel ]; then - ln -s .. _babel -fi - -git pull -make build -git commit -am "v`babel -V`" -git push diff --git a/yarn.lock b/yarn.lock index f415529c77..b730d5b88e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,5 +1,14 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 + + +JSONStream@^1.0.3: + version "1.3.0" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + abbrev@1: version "1.0.9" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135" @@ -900,9 +909,9 @@ browser-pack@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-5.0.1.tgz#4197719b20c6e0aaa09451c5111e53efb6fbc18d" dependencies: + JSONStream "^1.0.3" combine-source-map "~0.6.1" defined "^1.0.0" - JSONStream "^1.0.3" through2 "^1.0.0" umd "^3.0.0" @@ -910,9 +919,9 @@ browser-pack@^6.0.1: version "6.0.2" resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.0.2.tgz#f86cd6cef4f5300c8e63e07a4d512f65fbff4531" dependencies: + JSONStream "^1.0.3" combine-source-map "~0.7.1" defined "^1.0.0" - JSONStream "^1.0.3" through2 "^2.0.0" umd "^3.0.0" @@ -990,6 +999,7 @@ browserify@^13.1.1: version "13.3.0" resolved "https://registry.yarnpkg.com/browserify/-/browserify-13.3.0.tgz#b5a9c9020243f0c70e4675bec8223bc627e415ce" dependencies: + JSONStream "^1.0.3" assert "^1.4.0" browser-pack "^6.0.1" browser-resolve "^1.11.0" @@ -1011,7 +1021,6 @@ browserify@^13.1.1: https-browserify "~0.0.0" inherits "~2.0.1" insert-module-globals "^7.0.0" - JSONStream "^1.0.3" labeled-stream-splicer "^2.0.0" module-deps "^4.0.8" os-browserify "~0.1.1" @@ -1133,16 +1142,6 @@ chai@^3.5.0: deep-eql "^0.1.3" type-detect "^1.0.0" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - chalk@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.1.tgz#509afb67066e7499f7eb3535c77445772ae2d019" @@ -1153,6 +1152,16 @@ chalk@1.1.1: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + chokidar@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2" @@ -1246,6 +1255,13 @@ codecov@^1.0.1: request ">=2.42.0" urlgrey ">=0.4.0" +columnify@^1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" + dependencies: + strip-ansi "^3.0.0" + wcwidth "^1.0.0" + combine-source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.6.1.tgz#9b4a09c316033d768e0f11e029fa2730e079ad96" @@ -1274,7 +1290,7 @@ command-join@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/command-join/-/command-join-2.0.0.tgz#52e8b984f4872d952ff1bdc8b98397d27c7144cf" -commander@^2.9.0, commander@2.9.0: +commander@2.9.0, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1407,18 +1423,18 @@ debug-log@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f" +debug@2.2.0, debug@~2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" + dependencies: + ms "0.7.1" + debug@^2.1.1, debug@^2.2.0: version "2.6.0" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.0.tgz#bc596bcabe7617f11d9fa15361eded5608b8499b" dependencies: ms "0.7.2" -debug@~2.2.0, debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" - dependencies: - ms "0.7.1" - decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1443,7 +1459,7 @@ default-require-extensions@^1.0.0: dependencies: strip-bom "^2.0.0" -defaults@^1.0.0: +defaults@^1.0.0, defaults@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" dependencies: @@ -1545,18 +1561,18 @@ domain-browser@~1.1.0: version "1.1.7" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" -duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" - dependencies: - readable-stream "^2.0.2" - duplexer2@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.0.2.tgz#c614dcf67e2fb14995a91711e5a617e8a60a31db" dependencies: readable-stream "~1.1.9" +duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" + dependencies: + readable-stream "^2.0.2" + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -1620,7 +1636,7 @@ es6-set@~0.1.3: es6-symbol "3" event-emitter "~0.3.4" -es6-symbol@~3.1, es6-symbol@~3.1.0, es6-symbol@3: +es6-symbol@3, es6-symbol@~3.1, es6-symbol@~3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa" dependencies: @@ -1636,7 +1652,7 @@ es6-weak-map@^2.0.1: es6-iterator "2" es6-symbol "3" -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5, escape-string-regexp@1.0.5: +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2064,6 +2080,23 @@ glob-watcher@^0.0.6: dependencies: gaze "^0.5.1" +glob2base@^0.0.12: + version "0.0.12" + resolved "http://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" + dependencies: + find-index "^0.1.1" + +glob@7.0.5: + version "7.0.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.2" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^4.3.1: version "4.5.3" resolved "https://registry.yarnpkg.com/glob/-/glob-4.5.3.tgz#c6cb73d3226c1efef04de3c56d012f03377ee15f" @@ -2092,23 +2125,6 @@ glob@~3.1.21: inherits "1" minimatch "~0.2.11" -glob@7.0.5: - version "7.0.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob2base@^0.0.12: - version "0.0.12" - resolved "http://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" - dependencies: - find-index "^0.1.1" - global-modules@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-0.2.3.tgz#ea5a3bed42c6d6ce995a4f8a1269b5dae223828d" @@ -2390,14 +2406,14 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1, inherits@2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - inherits@1: version "1.0.2" resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b" +inherits@2, inherits@^2.0.1, inherits@~2.0.0, inherits@~2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" + inherits@2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" @@ -2458,10 +2474,10 @@ insert-module-globals@^7.0.0: version "7.0.1" resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.0.1.tgz#c03bf4e01cb086d5b5e5ace8ad0afe7889d638c3" dependencies: + JSONStream "^1.0.3" combine-source-map "~0.7.1" concat-stream "~1.5.1" is-buffer "^1.1.0" - JSONStream "^1.0.3" lexical-scope "^1.2.0" process "~0.11.0" through2 "^2.0.0" @@ -2635,14 +2651,14 @@ is-windows@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-0.2.0.tgz#de1aa6d63ea29dd248737b69f1ff8b8002d2108c" -isarray@^1.0.0, isarray@~1.0.0, isarray@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - -isarray@~0.0.1, isarray@0.0.1: +isarray@0.0.1, isarray@~0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + isexe@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.1.2.tgz#36f3e22e60750920f5e7241a476a8c6a42275ad0" @@ -2774,13 +2790,6 @@ jsonpointer@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" -JSONStream@^1.0.3: - version "1.3.0" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.0.tgz#680ab9ac6572a8a1a207e0b38721db1c77b215e5" - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - jsprim@^1.2.2: version "1.3.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.3.1.tgz#2a7256f70412a29ee3670aaca625994c4dcff252" @@ -2824,13 +2833,14 @@ lerna-changelog@^0.2.0: chalk "^1.1.3" mkdirp "^0.5.1" -lerna@2.0.0-beta.37: - version "2.0.0-beta.37" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-beta.37.tgz#d8e1d25a75102658b12565e4aa12e0423e969aad" +lerna@^2.0.0-beta.38: + version "2.0.0-beta.38" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-beta.38.tgz#99236416a6699707336dcbdeef83c315d1f71833" dependencies: async "^1.5.0" chalk "^1.1.1" cmd-shim "^2.0.2" + columnify "^1.5.4" command-join "^2.0.0" cross-spawn "^4.0.0" glob "^7.0.6" @@ -2847,7 +2857,6 @@ lerna@2.0.0-beta.37: rimraf "^2.4.4" semver "^5.1.0" signal-exit "^3.0.2" - sync-exec "^0.6.2" levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -3045,6 +3054,10 @@ loud-rejection@^1.0.0: currently-unhandled "^0.4.1" signal-exit "^3.0.0" +lru-cache@2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" + lru-cache@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e" @@ -3052,10 +3065,6 @@ lru-cache@^4.0.1: pseudomap "^1.0.1" yallist "^2.0.0" -lru-cache@2: - version "2.7.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952" - map-cache@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -3157,15 +3166,15 @@ minimatch@~0.2.11: lru-cache "2" sigmund "~1.0.0" +minimist@0.0.8, minimist@~0.0.1: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -minimist@~0.0.1, minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - -mkdirp@^0.5.0, mkdirp@^0.5.1, "mkdirp@>=0.5 0", mkdirp@~0.5.0, mkdirp@~0.5.1, mkdirp@0.5.1: +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -3191,6 +3200,7 @@ module-deps@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-4.0.8.tgz#55fd70623399706c3288bef7a609ff1e8c0ed2bb" dependencies: + JSONStream "^1.0.3" browser-resolve "^1.7.0" cached-path-relative "^1.0.0" concat-stream "~1.5.0" @@ -3198,7 +3208,6 @@ module-deps@^4.0.8: detective "^4.0.0" duplexer2 "^0.1.2" inherits "^2.0.1" - JSONStream "^1.0.3" parents "^1.0.0" readable-stream "^2.0.2" resolve "^1.1.3" @@ -3593,14 +3602,14 @@ public-encrypt@^4.0.0: parse-asn1 "^5.0.0" randombytes "^2.0.1" -punycode@^1.3.2, punycode@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" +punycode@^1.3.2, punycode@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" @@ -3660,18 +3669,6 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" -"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" - dependencies: - buffer-shims "^1.0.0" - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" - util-deprecate "~1.0.1" - "readable-stream@>=1.0.33-1 <1.1.0-0": version "1.0.34" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" @@ -3690,6 +3687,18 @@ read-pkg@^1.0.0: isarray "0.0.1" string_decoder "~0.10.x" +"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.1.5, readable-stream@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" + dependencies: + buffer-shims "^1.0.0" + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "~1.0.0" + process-nextick-args "~1.0.6" + string_decoder "~0.10.x" + util-deprecate "~1.0.1" + readable-stream@~2.0.0: version "2.0.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e" @@ -3802,7 +3811,7 @@ replace-ext@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924" -request@^2.79.0, request@>=2.42.0: +request@>=2.42.0, request@^2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -3857,14 +3866,14 @@ resolve-from@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-2.0.0.tgz#9480ab20e94ffa1d9e80a804c7ea147611966b57" -resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7: - version "1.2.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" - resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" +resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.6, resolve@^1.1.7: + version "1.2.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -3885,7 +3894,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4, rimraf@2: +rimraf@2, rimraf@^2.2.8, rimraf@^2.3.3, rimraf@^2.4.3, rimraf@^2.4.4, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4: version "2.5.4" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" dependencies: @@ -3921,14 +3930,14 @@ rx@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782" +"semver@2 || 3 || 4 || 5", semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + semver@^4.1.0: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" -semver@^5.0.0, semver@^5.1.0, semver@^5.3.0, semver@~5.3.0, "semver@2 || 3 || 4 || 5": - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - sequencify@~0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c" @@ -4104,10 +4113,6 @@ stream-splicer@^2.0.0: inherits "^2.0.1" readable-stream "^2.0.2" -string_decoder@~0.10.0, string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" - string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -4123,6 +4128,10 @@ string-width@^2.0.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^3.0.0" +string_decoder@~0.10.0, string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -4177,6 +4186,12 @@ subarg@^1.0.0: dependencies: minimist "^1.1.0" +supports-color@3.1.2, supports-color@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" + dependencies: + has-flag "^1.0.0" + supports-color@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a" @@ -4185,16 +4200,6 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.1.2, supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" - dependencies: - has-flag "^1.0.0" - -sync-exec@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/sync-exec/-/sync-exec-0.6.2.tgz#717d22cc53f0ce1def5594362f3a89a2ebb91105" - syntax-error@^1.1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.1.6.tgz#b4549706d386cc1c1dc7c2423f18579b6cade710" @@ -4263,10 +4268,6 @@ text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" -through@^2.3.6, "through@>=2.2.7 <3": - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - through2@^0.6.1: version "0.6.5" resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48" @@ -4288,6 +4289,10 @@ through2@^2, through2@^2.0.0: readable-stream "^2.1.5" xtend "~4.0.1" +"through@>=2.2.7 <3", through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + tildify@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/tildify/-/tildify-1.2.0.tgz#dcec03f55dca9b7aa3e5b04f21817eb56e63588a" @@ -4350,14 +4355,14 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" - type-detect@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-0.1.1.tgz#0ba5ec2a885640e470ea4e8505971900dac58822" +type-detect@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-1.0.0.tgz#762217cc06db258ec48908a1298e8b95121e8ea2" + typedarray@~0.0.5: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -4416,7 +4421,7 @@ util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -util@~0.10.1, util@0.10.3: +util@0.10.3, util@~0.10.1: version "0.10.3" resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" dependencies: @@ -4504,6 +4509,12 @@ vm-browserify@~0.0.1: dependencies: indexof "0.0.1" +wcwidth@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + dependencies: + defaults "^1.0.3" + which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" @@ -4524,7 +4535,7 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" -wordwrap@~0.0.2, wordwrap@0.0.2: +wordwrap@0.0.2, wordwrap@~0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" @@ -4557,7 +4568,7 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -xtend@^4.0.0, "xtend@>=4.0.0 <4.1.0-0", xtend@~4.0.1: +"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" @@ -4601,4 +4612,3 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" - From b4b03d48fa294dc1f668fbb52d4a6f2da37f7d02 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 15:53:02 -0500 Subject: [PATCH 201/222] remove undeclared plugin [skip ci] (#5407) --- .../.npmignore | 4 -- .../README.md | 56 ------------------- .../package.json | 17 ------ .../src/index.js | 46 --------------- .../declared/exec.js | 5 -- .../options.json | 3 - .../undeclared-shorthand-property/exec.js | 1 - .../options.json | 3 - .../undeclared/exec.js | 1 - .../undeclared/options.json | 3 - .../test/index.js | 3 - 11 files changed, 142 deletions(-) delete mode 100644 packages/babel-plugin-undeclared-variables-check/.npmignore delete mode 100644 packages/babel-plugin-undeclared-variables-check/README.md delete mode 100644 packages/babel-plugin-undeclared-variables-check/package.json delete mode 100644 packages/babel-plugin-undeclared-variables-check/src/index.js delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/declared/exec.js delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/options.json delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/exec.js delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/options.json delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/exec.js delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/options.json delete mode 100644 packages/babel-plugin-undeclared-variables-check/test/index.js diff --git a/packages/babel-plugin-undeclared-variables-check/.npmignore b/packages/babel-plugin-undeclared-variables-check/.npmignore deleted file mode 100644 index 31852902b1..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -*.log -src -test diff --git a/packages/babel-plugin-undeclared-variables-check/README.md b/packages/babel-plugin-undeclared-variables-check/README.md deleted file mode 100644 index 5bdf1b783a..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# babel-plugin-undeclared-variables-check - -> This plugin throws a compile-time error on references to undeclared variables. - -## Example - -**In** - -```javascript -function foo() {} -foo(); -bar(); -``` - -**Out** - -``` -ReferenceError: stdin: Line 3: Reference to undeclared variable "bar" - did you mean "foo"? - 1 | function foo() {} - 2 | foo(); -> 3 | bar(); - | ^ - 4 | -``` - -## Installation - -```sh -npm install --save-dev babel-plugin-undeclared-variables-check -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["undeclared-variables-check"] -} -``` - -### Via CLI - -```sh -babel --plugins undeclared-variables-check script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["undeclared-variables-check"] -}); -``` diff --git a/packages/babel-plugin-undeclared-variables-check/package.json b/packages/babel-plugin-undeclared-variables-check/package.json deleted file mode 100644 index 71ae4c595b..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "babel-plugin-undeclared-variables-check", - "version": "6.22.0", - "description": "Throw a compile-time error on references to undeclared variables", - "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-undeclared-variables-check", - "license": "MIT", - "main": "lib/index.js", - "keywords": [ - "babel-plugin" - ], - "dependencies": { - "leven": "^1.0.2" - }, - "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" - } -} diff --git a/packages/babel-plugin-undeclared-variables-check/src/index.js b/packages/babel-plugin-undeclared-variables-check/src/index.js deleted file mode 100644 index 9c63b00aab..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/src/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import leven from "leven"; - -export default function ({ messages }) { - return { - visitor: { - ReferencedIdentifier(path) { - const { node, scope } = path; - - const binding = scope.getBinding(node.name); - if (binding && binding.kind === "type" && !path.parentPath.isFlow()) { - throw path.buildCodeFrameError(messages.get("undeclaredVariableType", node.name), ReferenceError); - } - - if (scope.hasBinding(node.name)) return; - - // get the closest declaration to offer as a suggestion - // the variable name may have just been mistyped - - const bindings = scope.getAllBindings(); - - let closest; - let shortest = -1; - - for (const name in bindings) { - const distance = leven(node.name, name); - if (distance <= 0 || distance > 3) continue; - if (distance <= shortest) continue; - - closest = name; - shortest = distance; - } - - let msg; - if (closest) { - msg = messages.get("undeclaredVariableSuggestion", node.name, closest); - } else { - msg = messages.get("undeclaredVariable", node.name); - } - - // - - throw path.buildCodeFrameError(msg, ReferenceError); - } - } - }; -} diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/declared/exec.js b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/declared/exec.js deleted file mode 100644 index e2721feb4a..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/declared/exec.js +++ /dev/null @@ -1,5 +0,0 @@ -function foo() { - -} - -foo(); diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/options.json b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/options.json deleted file mode 100644 index 9aad0a18e2..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["undeclared-variables-check"] -} diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/exec.js b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/exec.js deleted file mode 100644 index ee11821ed0..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/exec.js +++ /dev/null @@ -1 +0,0 @@ -({foo}) diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/options.json b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/options.json deleted file mode 100644 index a661ffc703..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared-shorthand-property/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Reference to undeclared variable" -} diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/exec.js b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/exec.js deleted file mode 100644 index a280f9a5cc..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/exec.js +++ /dev/null @@ -1 +0,0 @@ -foo(); diff --git a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/options.json b/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/options.json deleted file mode 100644 index a661ffc703..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/fixtures/validation.undeclared-variable-check/undeclared/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "Reference to undeclared variable" -} diff --git a/packages/babel-plugin-undeclared-variables-check/test/index.js b/packages/babel-plugin-undeclared-variables-check/test/index.js deleted file mode 100644 index 09cfbc31f5..0000000000 --- a/packages/babel-plugin-undeclared-variables-check/test/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import runner from "babel-helper-plugin-test-runner"; - -runner(__dirname); From c86f922dc75563bfe2eb58b6a05b349d98791eff Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 15:54:47 -0500 Subject: [PATCH 202/222] add exact flag [skip ci] --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0d6ba230fc..236aadb839 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ publish: make test # not using lerna independent mode atm, so only update packages that have changed since we use ^ # --only-explicit-updates - ./node_modules/.bin/lerna publish --npm-tag=next + ./node_modules/.bin/lerna publish --npm-tag=next --exact make clean bootstrap: From 67ed224df0b3165510cf94f9532422384f5e5ec0 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 15:58:12 -0500 Subject: [PATCH 203/222] update babel-types readme [skip ci] --- packages/babel-types/README.md | 56 +++++++++------------------------- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/packages/babel-types/README.md b/packages/babel-types/README.md index d058be9b71..d8532bd44f 100644 --- a/packages/babel-types/README.md +++ b/packages/babel-types/README.md @@ -711,7 +711,7 @@ Aliases: `Scopable`, `Statement`, `For`, `BlockParent`, `Loop`, `ForXStatement` ### forOfStatement ```javascript -t.forOfStatement(left, right, body, await) +t.forOfStatement(left, right, body) ``` See also `t.isForOfStatement(node, opts)` and `t.assertForOfStatement(node, opts)`. @@ -1255,6 +1255,18 @@ Aliases: `Flow` - `typeAnnotation` (required) +--- + +### numberLiteralTypeAnnotation +```javascript +t.numberLiteralTypeAnnotation() +``` + +See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`. + +Aliases: `Flow` + + --- ### numberTypeAnnotation @@ -1280,18 +1292,6 @@ Aliases: `Expression`, `Pureish`, `Literal`, `Immutable` - `value`: `number` (required) ---- - -### numberLiteralTypeAnnotation -```javascript -t.numberLiteralTypeAnnotation() -``` - -See also `t.isNumberLiteralTypeAnnotation(node, opts)` and `t.assertNumberLiteralTypeAnnotation(node, opts)`. - -Aliases: `Flow` - - --- ### objectExpression @@ -1303,7 +1303,7 @@ See also `t.isObjectExpression(node, opts)` and `t.assertObjectExpression(node, Aliases: `Expression` - - `properties`: `Array` (required) + - `properties`: `Array` (required) --- @@ -1338,7 +1338,7 @@ See also `t.isObjectPattern(node, opts)` and `t.assertObjectPattern(node, opts)` Aliases: `Pattern`, `LVal` - - `properties`: `Array` (required) + - `properties`: `Array` (required) - `typeAnnotation` (required) - `decorators`: `Array` (default: `null`) @@ -1488,19 +1488,6 @@ Aliases: `LVal` --- -### restProperty -```javascript -t.restProperty(argument) -``` - -See also `t.isRestProperty(node, opts)` and `t.assertRestProperty(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `LVal` (required) - ---- - ### returnStatement ```javascript t.returnStatement(argument) @@ -1540,19 +1527,6 @@ Aliases: `UnaryLike` --- -### spreadProperty -```javascript -t.spreadProperty(argument) -``` - -See also `t.isSpreadProperty(node, opts)` and `t.assertSpreadProperty(node, opts)`. - -Aliases: `UnaryLike` - - - `argument`: `Expression` (required) - ---- - ### stringLiteral ```javascript t.stringLiteral(value) From 22a5ce43f1c7584c94dfb25978f6b5326902c4d9 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 16:00:44 -0500 Subject: [PATCH 204/222] fix lerna config [skip ci] --- lerna.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lerna.json b/lerna.json index 7c616d72d4..e5cba1d979 100644 --- a/lerna.json +++ b/lerna.json @@ -14,10 +14,12 @@ } }, "cacheDir": ".changelog", - "publishConfig": { - "ignore": [ - "*.md", - "test/**" - ] + "commands": { + "publish": { + "ignore": [ + "*.md", + "test/**" + ] + } } } From 11e54a6bd38b12b1163cb7ea4d5a6cfcff75e9f5 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 16:04:47 -0500 Subject: [PATCH 205/222] v7.0.0-alpha.1 --- lerna.json | 2 +- packages/babel-cli/package.json | 10 ++-- packages/babel-code-frame/package.json | 2 +- packages/babel-core/package.json | 24 ++++----- packages/babel-generator/package.json | 8 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../babel-helper-call-delegate/package.json | 8 +-- packages/babel-helper-define-map/package.json | 6 +-- .../package.json | 6 +-- .../babel-helper-explode-class/package.json | 8 +-- packages/babel-helper-fixtures/package.json | 2 +- .../babel-helper-function-name/package.json | 10 ++-- .../package.json | 4 +- .../babel-helper-hoist-variables/package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- packages/babel-helper-regex/package.json | 4 +- .../package.json | 10 ++-- .../babel-helper-replace-supers/package.json | 12 ++--- .../package.json | 10 ++-- packages/babel-helpers/package.json | 4 +- packages/babel-messages/package.json | 2 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../babel-plugin-syntax-flow/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- packages/babel-plugin-syntax-jsx/package.json | 2 +- .../package.json | 2 +- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 8 +-- .../package.json | 10 ++-- .../package.json | 10 ++-- .../package.json | 10 ++-- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 10 ++-- .../package.json | 20 +++---- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 8 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 8 +-- .../package.json | 10 ++-- .../package.json | 10 ++-- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 14 ++--- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 8 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +-- .../babel-plugin-transform-eval/package.json | 4 +- .../package.json | 8 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 6 +-- .../package.json | 8 +-- .../package.json | 4 +- .../package.json | 4 +- .../package.json | 6 +-- packages/babel-polyfill/package.json | 2 +- packages/babel-preset-es2015/package.json | 54 +++++++++---------- packages/babel-preset-es2016/package.json | 4 +- packages/babel-preset-es2017/package.json | 6 +-- packages/babel-preset-flow/package.json | 4 +- packages/babel-preset-latest/package.json | 10 ++-- packages/babel-preset-react/package.json | 14 ++--- packages/babel-preset-stage-0/package.json | 8 +-- packages/babel-preset-stage-1/package.json | 8 +-- packages/babel-preset-stage-2/package.json | 8 +-- packages/babel-preset-stage-3/package.json | 6 +-- packages/babel-register/package.json | 4 +- packages/babel-runtime/package.json | 6 +-- packages/babel-template/package.json | 6 +-- packages/babel-traverse/package.json | 10 ++-- packages/babel-types/package.json | 2 +- 111 files changed, 351 insertions(+), 351 deletions(-) diff --git a/lerna.json b/lerna.json index e5cba1d979..40dddfaf34 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.38", - "version": "6.23.1", + "version": "7.0.0-alpha.1", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index f836c0d113..87c8d483ac 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "babel-cli", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -16,9 +16,9 @@ "compiler" ], "dependencies": { - "babel-core": "^6.23.0", - "babel-register": "^6.23.0", - "babel-polyfill": "^6.23.0", + "babel-core": "7.0.0-alpha.1", + "babel-register": "7.0.0-alpha.1", + "babel-polyfill": "7.0.0-alpha.1", "commander": "^2.8.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.0.0", @@ -33,7 +33,7 @@ "chokidar": "^1.6.1" }, "devDependencies": { - "babel-helper-fixtures": "^6.22.0" + "babel-helper-fixtures": "7.0.0-alpha.1" }, "bin": { "babel-doctor": "./bin/babel-doctor.js", diff --git a/packages/babel-code-frame/package.json b/packages/babel-code-frame/package.json index 692187128a..d8ac4d99f0 100644 --- a/packages/babel-code-frame/package.json +++ b/packages/babel-code-frame/package.json @@ -1,6 +1,6 @@ { "name": "babel-code-frame", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Generate errors that contain a code frame that point to source locations.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 2bbdd8270b..9e52e8894c 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "6.23.1", + "version": "7.0.0-alpha.1", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -26,14 +26,14 @@ "test": "make test" }, "dependencies": { - "babel-code-frame": "^6.22.0", - "babel-generator": "^6.23.0", - "babel-helpers": "^6.23.0", - "babel-messages": "^6.23.0", - "babel-template": "^6.23.0", - "babel-register": "^6.23.0", - "babel-traverse": "^6.23.1", - "babel-types": "^6.23.0", + "babel-code-frame": "7.0.0-alpha.1", + "babel-generator": "7.0.0-alpha.1", + "babel-helpers": "7.0.0-alpha.1", + "babel-messages": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", + "babel-register": "7.0.0-alpha.1", + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", "babylon": "7.0.0-beta.4", "convert-source-map": "^1.1.0", "debug": "^2.1.1", @@ -45,8 +45,8 @@ "source-map": "^0.5.0" }, "devDependencies": { - "babel-helper-fixtures": "^6.22.0", - "babel-helper-transform-fixture-test-runner": "^6.23.0", - "babel-polyfill": "^6.23.0" + "babel-helper-fixtures": "7.0.0-alpha.1", + "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1", + "babel-polyfill": "7.0.0-alpha.1" } } diff --git a/packages/babel-generator/package.json b/packages/babel-generator/package.json index 893ce50df4..eb9900f150 100644 --- a/packages/babel-generator/package.json +++ b/packages/babel-generator/package.json @@ -1,6 +1,6 @@ { "name": "babel-generator", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Turns an AST into code.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -11,8 +11,8 @@ "lib" ], "dependencies": { - "babel-messages": "^6.23.0", - "babel-types": "^6.23.0", + "babel-messages": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", "detect-indent": "^4.0.0", "jsesc": "^1.3.0", "lodash": "^4.2.0", @@ -20,7 +20,7 @@ "trim-right": "^1.0.1" }, "devDependencies": { - "babel-helper-fixtures": "^6.22.0", + "babel-helper-fixtures": "7.0.0-alpha.1", "babylon": "7.0.0-beta.4" } } diff --git a/packages/babel-helper-bindify-decorators/package.json b/packages/babel-helper-bindify-decorators/package.json index 782f453cfa..db00bb72cd 100644 --- a/packages/babel-helper-bindify-decorators/package.json +++ b/packages/babel-helper-bindify-decorators/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-bindify-decorators", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to bindify decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0" + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json index 5cceb0d22c..94ebb53e66 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-builder-binary-assignment-operator-visitor", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to build binary assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-explode-assignable-expression": "^6.22.0", - "babel-types": "^6.22.0" + "babel-helper-explode-assignable-expression": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json index 215847d2b6..5fea995e98 100644 --- a/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json +++ b/packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-builder-conditional-assignment-operator-visitor", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to build conditional assignment operator visitors", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-conditional-assignment-operator-visitor", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-explode-assignable-expression": "^6.22.0", - "babel-types": "^6.22.0" + "babel-helper-explode-assignable-expression": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-builder-react-jsx/package.json b/packages/babel-helper-builder-react-jsx/package.json index cbeceb179c..312b5a63b1 100644 --- a/packages/babel-helper-builder-react-jsx/package.json +++ b/packages/babel-helper-builder-react-jsx/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-builder-react-jsx", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Helper function to build react jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.23.0", + "babel-types": "7.0.0-alpha.1", "esutils": "^2.0.0", "lodash": "^4.2.0" } diff --git a/packages/babel-helper-call-delegate/package.json b/packages/babel-helper-call-delegate/package.json index f50d9cdd54..4438a7cb84 100644 --- a/packages/babel-helper-call-delegate/package.json +++ b/packages/babel-helper-call-delegate/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-call-delegate", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to call delegate", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0", - "babel-helper-hoist-variables": "^6.22.0" + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", + "babel-helper-hoist-variables": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-define-map/package.json b/packages/babel-helper-define-map/package.json index c16bb59384..6f1399418f 100644 --- a/packages/babel-helper-define-map/package.json +++ b/packages/babel-helper-define-map/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-define-map", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Helper function to define a map", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map", "license": "MIT", "main": "lib/index.js", "dependencies": { "lodash": "^4.2.0", - "babel-types": "^6.23.0", - "babel-helper-function-name": "^6.23.0" + "babel-types": "7.0.0-alpha.1", + "babel-helper-function-name": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-explode-assignable-expression/package.json b/packages/babel-helper-explode-assignable-expression/package.json index 6a030f9006..3127951b84 100644 --- a/packages/babel-helper-explode-assignable-expression/package.json +++ b/packages/babel-helper-explode-assignable-expression/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-explode-assignable-expression", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to explode an assignable expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0" + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-explode-class/package.json b/packages/babel-helper-explode-class/package.json index 9d2c16a0d0..8bdeb3707f 100644 --- a/packages/babel-helper-explode-class/package.json +++ b/packages/babel-helper-explode-class/package.json @@ -1,13 +1,13 @@ { "name": "babel-helper-explode-class", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to explode class", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.22.0", - "babel-types": "^6.22.0", - "babel-helper-bindify-decorators": "^6.22.0" + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", + "babel-helper-bindify-decorators": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-fixtures/package.json b/packages/babel-helper-fixtures/package.json index 9233a89998..79fa866a78 100644 --- a/packages/babel-helper-fixtures/package.json +++ b/packages/babel-helper-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-fixtures", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to support fixtures", "author": "Sebastian McKenzie ", "license": "MIT", diff --git a/packages/babel-helper-function-name/package.json b/packages/babel-helper-function-name/package.json index 62c9f9373f..b9557a60c4 100644 --- a/packages/babel-helper-function-name/package.json +++ b/packages/babel-helper-function-name/package.json @@ -1,14 +1,14 @@ { "name": "babel-helper-function-name", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Helper function to change the property 'name' of every function", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.23.0", - "babel-traverse": "^6.23.0", - "babel-helper-get-function-arity": "^6.22.0", - "babel-template": "^6.23.0" + "babel-types": "7.0.0-alpha.1", + "babel-traverse": "7.0.0-alpha.1", + "babel-helper-get-function-arity": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-get-function-arity/package.json b/packages/babel-helper-get-function-arity/package.json index 199e2bc695..89c0a5c8cb 100644 --- a/packages/babel-helper-get-function-arity/package.json +++ b/packages/babel-helper-get-function-arity/package.json @@ -1,11 +1,11 @@ { "name": "babel-helper-get-function-arity", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to get function arity", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-hoist-variables/package.json b/packages/babel-helper-hoist-variables/package.json index 428b1d04d3..0928124fd6 100644 --- a/packages/babel-helper-hoist-variables/package.json +++ b/packages/babel-helper-hoist-variables/package.json @@ -1,11 +1,11 @@ { "name": "babel-helper-hoist-variables", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to hoist variables", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-optimise-call-expression/package.json b/packages/babel-helper-optimise-call-expression/package.json index 80e1f34242..fb880ab319 100644 --- a/packages/babel-helper-optimise-call-expression/package.json +++ b/packages/babel-helper-optimise-call-expression/package.json @@ -1,11 +1,11 @@ { "name": "babel-helper-optimise-call-expression", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Helper function to optimise call expression", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-optimise-call-expression", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.23.0" + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index e8fc962da4..0729b72150 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -1,11 +1,11 @@ { "name": "babel-helper-plugin-test-runner", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to support test runner", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-transform-fixture-test-runner": "^6.22.0" + "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-regex/package.json b/packages/babel-helper-regex/package.json index ab92376eff..0de910c904 100644 --- a/packages/babel-helper-regex/package.json +++ b/packages/babel-helper-regex/package.json @@ -1,12 +1,12 @@ { "name": "babel-helper-regex", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to check for literal RegEx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-regex", "license": "MIT", "main": "lib/index.js", "dependencies": { "lodash": "^4.2.0", - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-remap-async-to-generator/package.json b/packages/babel-helper-remap-async-to-generator/package.json index d00a0410bd..a173b2228e 100644 --- a/packages/babel-helper-remap-async-to-generator/package.json +++ b/packages/babel-helper-remap-async-to-generator/package.json @@ -1,14 +1,14 @@ { "name": "babel-helper-remap-async-to-generator", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Helper function to remap async functions to generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-remap-async-to-generator", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-template": "^6.22.0", - "babel-types": "^6.22.0", - "babel-traverse": "^6.22.0", - "babel-helper-function-name": "^6.22.0" + "babel-template": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", + "babel-traverse": "7.0.0-alpha.1", + "babel-helper-function-name": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-replace-supers/package.json b/packages/babel-helper-replace-supers/package.json index 24edb82002..798f1299f8 100644 --- a/packages/babel-helper-replace-supers/package.json +++ b/packages/babel-helper-replace-supers/package.json @@ -1,15 +1,15 @@ { "name": "babel-helper-replace-supers", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Helper function to replace supers", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-replace-supers", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.23.0", - "babel-traverse": "^6.23.0", - "babel-messages": "^6.23.0", - "babel-template": "^6.23.0", - "babel-types": "^6.23.0" + "babel-helper-optimise-call-expression": "7.0.0-alpha.1", + "babel-traverse": "7.0.0-alpha.1", + "babel-messages": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index f5c0376289..83c6a054e6 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-transform-fixture-test-runner", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Transform test runner for babel-helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,11 +8,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { - "babel-core": "^6.23.0", - "babel-polyfill": "^6.23.0", - "babel-helper-fixtures": "^6.22.0", + "babel-core": "7.0.0-alpha.1", + "babel-polyfill": "7.0.0-alpha.1", + "babel-helper-fixtures": "7.0.0-alpha.1", "source-map": "^0.5.0", - "babel-code-frame": "^6.22.0", + "babel-code-frame": "7.0.0-alpha.1", "chai": "^3.0.0", "lodash": "^4.2.0" } diff --git a/packages/babel-helpers/package.json b/packages/babel-helpers/package.json index bc88144c05..a2039ecdbd 100644 --- a/packages/babel-helpers/package.json +++ b/packages/babel-helpers/package.json @@ -1,6 +1,6 @@ { "name": "babel-helpers", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Collection of helper functions used by Babel transforms.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,6 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers", "main": "lib/index.js", "dependencies": { - "babel-template": "^6.23.0" + "babel-template": "7.0.0-alpha.1" } } diff --git a/packages/babel-messages/package.json b/packages/babel-messages/package.json index 177efb0499..a769e68278 100644 --- a/packages/babel-messages/package.json +++ b/packages/babel-messages/package.json @@ -1,6 +1,6 @@ { "name": "babel-messages", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Collection of debug messages used by Babel.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-plugin-check-es2015-constants/package.json b/packages/babel-plugin-check-es2015-constants/package.json index fdceaa851a..e78c62a45e 100644 --- a/packages/babel-plugin-check-es2015-constants/package.json +++ b/packages/babel-plugin-check-es2015-constants/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-check-es2015-constants", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 constants to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-check-es2015-constants", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index ba6643c695..0eaf0bc437 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-external-helpers", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "This plugin contains helper functions that’ll be placed at the top of the generated code", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-external-helpers", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-syntax-async-functions/package.json b/packages/babel-plugin-syntax-async-functions/package.json index ef46b578c5..fd2f81d061 100644 --- a/packages/babel-plugin-syntax-async-functions/package.json +++ b/packages/babel-plugin-syntax-async-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-async-functions", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of async functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-functions", "license": "MIT", diff --git a/packages/babel-plugin-syntax-async-generators/package.json b/packages/babel-plugin-syntax-async-generators/package.json index a17544f1ea..de3f839b7a 100644 --- a/packages/babel-plugin-syntax-async-generators/package.json +++ b/packages/babel-plugin-syntax-async-generators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-async-generators", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of async generator functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-async-generators", "license": "MIT", diff --git a/packages/babel-plugin-syntax-class-properties/package.json b/packages/babel-plugin-syntax-class-properties/package.json index 5882a28eab..d8949ccd7a 100644 --- a/packages/babel-plugin-syntax-class-properties/package.json +++ b/packages/babel-plugin-syntax-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-class-properties", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of class properties", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-class-properties", "license": "MIT", diff --git a/packages/babel-plugin-syntax-decorators/package.json b/packages/babel-plugin-syntax-decorators/package.json index aeb4e0b2d7..0278b74a8c 100644 --- a/packages/babel-plugin-syntax-decorators/package.json +++ b/packages/babel-plugin-syntax-decorators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-decorators", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of decorators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-decorators", "license": "MIT", diff --git a/packages/babel-plugin-syntax-do-expressions/package.json b/packages/babel-plugin-syntax-do-expressions/package.json index 027e697816..cb886b7cae 100644 --- a/packages/babel-plugin-syntax-do-expressions/package.json +++ b/packages/babel-plugin-syntax-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-do-expressions", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of do expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-do-expressions", "license": "MIT", diff --git a/packages/babel-plugin-syntax-dynamic-import/package.json b/packages/babel-plugin-syntax-dynamic-import/package.json index 4ef935f7f7..f1b52f3a52 100644 --- a/packages/babel-plugin-syntax-dynamic-import/package.json +++ b/packages/babel-plugin-syntax-dynamic-import/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-dynamic-import", - "version": "6.18.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of import()", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-dynamic-import", "license": "MIT", diff --git a/packages/babel-plugin-syntax-exponentiation-operator/package.json b/packages/babel-plugin-syntax-exponentiation-operator/package.json index 94c1d041e9..1c83d8f509 100644 --- a/packages/babel-plugin-syntax-exponentiation-operator/package.json +++ b/packages/babel-plugin-syntax-exponentiation-operator/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-exponentiation-operator", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of the exponentiation operator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-exponentation-operator", "license": "MIT", diff --git a/packages/babel-plugin-syntax-export-extensions/package.json b/packages/babel-plugin-syntax-export-extensions/package.json index 9a86e90236..83f9afeeb4 100644 --- a/packages/babel-plugin-syntax-export-extensions/package.json +++ b/packages/babel-plugin-syntax-export-extensions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-export-extensions", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of export extensions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-export-extensions", "license": "MIT", diff --git a/packages/babel-plugin-syntax-flow/package.json b/packages/babel-plugin-syntax-flow/package.json index 2a701dd854..a0f4e85651 100644 --- a/packages/babel-plugin-syntax-flow/package.json +++ b/packages/babel-plugin-syntax-flow/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-flow", - "version": "6.18.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of the flow syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-flow", "license": "MIT", diff --git a/packages/babel-plugin-syntax-function-bind/package.json b/packages/babel-plugin-syntax-function-bind/package.json index 8a2de38ac4..5d9a90768c 100644 --- a/packages/babel-plugin-syntax-function-bind/package.json +++ b/packages/babel-plugin-syntax-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-function-bind", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of function bind", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-bind", "license": "MIT", diff --git a/packages/babel-plugin-syntax-function-sent/package.json b/packages/babel-plugin-syntax-function-sent/package.json index bd68fcfaa1..54b6a5b906 100644 --- a/packages/babel-plugin-syntax-function-sent/package.json +++ b/packages/babel-plugin-syntax-function-sent/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-function-sent", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of the function.sent meta property", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-function-sent", "license": "MIT", diff --git a/packages/babel-plugin-syntax-jsx/package.json b/packages/babel-plugin-syntax-jsx/package.json index d9a604d01e..bc8a740dfc 100644 --- a/packages/babel-plugin-syntax-jsx/package.json +++ b/packages/babel-plugin-syntax-jsx/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-jsx", - "version": "6.18.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of jsx", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx", "license": "MIT", diff --git a/packages/babel-plugin-syntax-object-rest-spread/package.json b/packages/babel-plugin-syntax-object-rest-spread/package.json index 15554cd3be..fbf44e4280 100644 --- a/packages/babel-plugin-syntax-object-rest-spread/package.json +++ b/packages/babel-plugin-syntax-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-object-rest-spread", - "version": "6.13.0", + "version": "7.0.0-alpha.1", "description": "Allow parsing of object rest/spread", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-object-rest-spread", "license": "MIT", diff --git a/packages/babel-plugin-syntax-trailing-function-commas/package.json b/packages/babel-plugin-syntax-trailing-function-commas/package.json index 174e92d096..ded8a1bc55 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/package.json +++ b/packages/babel-plugin-syntax-trailing-function-commas/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-syntax-trailing-function-commas", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile trailing function commas to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-trailing-function-commas", "license": "MIT", @@ -10,6 +10,6 @@ ], "dependencies": {}, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-functions/package.json b/packages/babel-plugin-transform-async-functions/package.json index c39e9d439c..48498c669a 100644 --- a/packages/babel-plugin-transform-async-functions/package.json +++ b/packages/babel-plugin-transform-async-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-functions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile async functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-functions", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-async-functions": "^6.8.0" + "babel-plugin-syntax-async-functions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-generator-functions/package.json b/packages/babel-plugin-transform-async-generator-functions/package.json index 38e5682b3c..a69615a612 100644 --- a/packages/babel-plugin-transform-async-generator-functions/package.json +++ b/packages/babel-plugin-transform-async-generator-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-generator-functions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn async generator functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-generator-functions", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-plugin-syntax-async-generators": "^6.5.0" + "babel-helper-remap-async-to-generator": "7.0.0-alpha.1", + "babel-plugin-syntax-async-generators": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index a08251e34b..13e0a80166 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-to-generator", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn async functions into ES2015 generators", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-generator", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-plugin-syntax-async-functions": "^6.8.0" + "babel-helper-remap-async-to-generator": "7.0.0-alpha.1", + "babel-plugin-syntax-async-functions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-to-module-method/package.json b/packages/babel-plugin-transform-async-to-module-method/package.json index 338bc63f30..015cc4ba66 100644 --- a/packages/babel-plugin-transform-async-to-module-method/package.json +++ b/packages/babel-plugin-transform-async-to-module-method/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-async-to-module-method", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn async functions into a module method", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-to-module-method", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-async-functions": "^6.8.0", - "babel-helper-remap-async-to-generator": "^6.22.0", - "babel-types": "^6.22.0" + "babel-plugin-syntax-async-functions": "7.0.0-alpha.1", + "babel-helper-remap-async-to-generator": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-class-properties/package.json b/packages/babel-plugin-transform-class-properties/package.json index 8f0b3d74cd..6ad1e0bf80 100644 --- a/packages/babel-plugin-transform-class-properties/package.json +++ b/packages/babel-plugin-transform-class-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-class-properties", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms static class properties as well as properties declared with the property initializer syntax", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-class-properties", "license": "MIT", @@ -9,11 +9,11 @@ "babel-plugin" ], "dependencies": { - "babel-helper-function-name": "^6.23.0", - "babel-plugin-syntax-class-properties": "^6.8.0", - "babel-template": "^6.23.0" + "babel-helper-function-name": "7.0.0-alpha.1", + "babel-plugin-syntax-class-properties": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index a061cc2632..64c8d416e9 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-decorators", - "version": "1.3.4", + "version": "7.0.0-alpha.1", "author": "Logan Smyth ", "license": "MIT", "description": "Compile class and object decorators to ES5", @@ -12,11 +12,11 @@ "decorators" ], "dependencies": { - "babel-plugin-syntax-decorators": "^6.13.0", - "babel-runtime": "^6.2.0", - "babel-template": "^6.22.0" + "babel-plugin-syntax-decorators": "7.0.0-alpha.1", + "babel-runtime": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-do-expressions/package.json b/packages/babel-plugin-transform-do-expressions/package.json index 2280a1b7ee..c959080f08 100644 --- a/packages/babel-plugin-transform-do-expressions/package.json +++ b/packages/babel-plugin-transform-do-expressions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-do-expressions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile do expressions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-do-expressions", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-do-expressions": "^6.8.0" + "babel-plugin-syntax-do-expressions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/package.json b/packages/babel-plugin-transform-es2015-arrow-functions/package.json index 4616579a78..accf0a2d49 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/package.json +++ b/packages/babel-plugin-transform-es2015-arrow-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-arrow-functions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 arrow functions to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-arrow-functions", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json index a23ad992fa..9cdd5fbf5c 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-block-scoped-functions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel plugin to ensure function declarations at the block level are block scoped", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-block-scoped-functions", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/package.json b/packages/babel-plugin-transform-es2015-block-scoping/package.json index 569706fca1..2bf52f76a1 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoping/package.json @@ -1,20 +1,20 @@ { "name": "babel-plugin-transform-es2015-block-scoping", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 block scoping (const and let) to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-block-scoping", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.23.0", - "babel-types": "^6.23.0", - "babel-template": "^6.23.0", + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", "lodash": "^4.2.0" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-classes/package.json b/packages/babel-plugin-transform-es2015-classes/package.json index cd552e395d..f10b00a9d5 100644 --- a/packages/babel-plugin-transform-es2015-classes/package.json +++ b/packages/babel-plugin-transform-es2015-classes/package.json @@ -1,24 +1,24 @@ { "name": "babel-plugin-transform-es2015-classes", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 classes to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-classes", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-optimise-call-expression": "^6.23.0", - "babel-helper-function-name": "^6.23.0", - "babel-helper-replace-supers": "^6.23.0", - "babel-template": "^6.23.0", - "babel-traverse": "^6.23.0", - "babel-helper-define-map": "^6.23.0", - "babel-messages": "^6.23.0", - "babel-types": "^6.23.0" + "babel-helper-optimise-call-expression": "7.0.0-alpha.1", + "babel-helper-function-name": "7.0.0-alpha.1", + "babel-helper-replace-supers": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", + "babel-traverse": "7.0.0-alpha.1", + "babel-helper-define-map": "7.0.0-alpha.1", + "babel-messages": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-computed-properties/package.json b/packages/babel-plugin-transform-es2015-computed-properties/package.json index b0ec2bbc45..aa17e08054 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/package.json +++ b/packages/babel-plugin-transform-es2015-computed-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-computed-properties", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 computed properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-computed-properties", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-template": "^6.22.0" + "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-destructuring/package.json b/packages/babel-plugin-transform-es2015-destructuring/package.json index 53b5174965..50e7717c96 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/package.json +++ b/packages/babel-plugin-transform-es2015-destructuring/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-destructuring", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 destructuring to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-destructuring", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json index 085c74f022..a10312f853 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-duplicate-keys", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile objects with duplicate keys to valid strict ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-duplicate-keys", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-for-of/package.json b/packages/babel-plugin-transform-es2015-for-of/package.json index 99c92140bf..99753f4eaa 100644 --- a/packages/babel-plugin-transform-es2015-for-of/package.json +++ b/packages/babel-plugin-transform-es2015-for-of/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-for-of", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 for...of to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-for-of", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-function-name/package.json b/packages/babel-plugin-transform-es2015-function-name/package.json index 806288e82e..d992f0123b 100644 --- a/packages/babel-plugin-transform-es2015-function-name/package.json +++ b/packages/babel-plugin-transform-es2015-function-name/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-function-name", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Apply ES2015 function.name semantics to all functions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-function-name", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-function-name": "^6.22.0", - "babel-types": "^6.22.0" + "babel-helper-function-name": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-instanceof/package.json b/packages/babel-plugin-transform-es2015-instanceof/package.json index 439f03eadb..105b87ee18 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/package.json +++ b/packages/babel-plugin-transform-es2015-instanceof/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-instanceof", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms all the ES2015 'instanceof' methods", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-instanceof", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-literals/package.json b/packages/babel-plugin-transform-es2015-literals/package.json index 1b856acbd1..d9bc938774 100644 --- a/packages/babel-plugin-transform-es2015-literals/package.json +++ b/packages/babel-plugin-transform-es2015-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-literals", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 unicode string and number literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-literals", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/package.json b/packages/babel-plugin-transform-es2015-modules-amd/package.json index b7aee66862..4d26e73f91 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-amd/package.json @@ -1,18 +1,18 @@ { "name": "babel-plugin-transform-es2015-modules-amd", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms ES2015 modules to AMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-amd", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", - "babel-template": "^6.22.0" + "babel-plugin-transform-es2015-modules-commonjs": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json index 47cca38a41..0fc442373c 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json @@ -1,19 +1,19 @@ { "name": "babel-plugin-transform-es2015-modules-commonjs", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms ES2015 modules to CommonJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-commonjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-types": "^6.23.0", - "babel-template": "^6.23.0", - "babel-plugin-transform-strict-mode": "^6.22.0" + "babel-types": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", + "babel-plugin-transform-strict-mode": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json index 4d6e0841fb..a5d78cf2e7 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json @@ -1,19 +1,19 @@ { "name": "babel-plugin-transform-es2015-modules-systemjs", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms ES2015 modules to SystemJS", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-systemjs", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-template": "^6.23.0", - "babel-helper-hoist-variables": "^6.22.0" + "babel-template": "7.0.0-alpha.1", + "babel-helper-hoist-variables": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0", - "babel-plugin-syntax-dynamic-import": "^6.18.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1", + "babel-plugin-syntax-dynamic-import": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-umd/package.json b/packages/babel-plugin-transform-es2015-modules-umd/package.json index d4a5a0e71d..7d846e75c7 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-umd/package.json @@ -1,18 +1,18 @@ { "name": "babel-plugin-transform-es2015-modules-umd", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "This plugin transforms ES2015 modules to UMD", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-modules-umd", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-es2015-modules-amd": "^6.22.0", - "babel-template": "^6.23.0" + "babel-plugin-transform-es2015-modules-amd": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-object-super/package.json b/packages/babel-plugin-transform-es2015-object-super/package.json index ca04d8f410..7731843c61 100644 --- a/packages/babel-plugin-transform-es2015-object-super/package.json +++ b/packages/babel-plugin-transform-es2015-object-super/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-object-super", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 object super to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-object-super", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-helper-replace-supers": "^6.22.0" + "babel-helper-replace-supers": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-parameters/package.json b/packages/babel-plugin-transform-es2015-parameters/package.json index 1dec6ec151..01053fdab9 100644 --- a/packages/babel-plugin-transform-es2015-parameters/package.json +++ b/packages/babel-plugin-transform-es2015-parameters/package.json @@ -1,21 +1,21 @@ { "name": "babel-plugin-transform-es2015-parameters", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 default and rest parameters to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-parameters", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-traverse": "^6.23.0", - "babel-helper-call-delegate": "^6.22.0", - "babel-helper-get-function-arity": "^6.22.0", - "babel-template": "^6.23.0", - "babel-types": "^6.23.0" + "babel-traverse": "7.0.0-alpha.1", + "babel-helper-call-delegate": "7.0.0-alpha.1", + "babel-helper-get-function-arity": "7.0.0-alpha.1", + "babel-template": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" }, "keywords": [ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json index 050bca5f58..c37be49ab9 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-shorthand-properties", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 shorthand properties to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-shorthand-properties", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-spread/package.json b/packages/babel-plugin-transform-es2015-spread/package.json index ac55dfe8b1..60f5c64c57 100644 --- a/packages/babel-plugin-transform-es2015-spread/package.json +++ b/packages/babel-plugin-transform-es2015-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-spread", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-spread", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/package.json b/packages/babel-plugin-transform-es2015-sticky-regex/package.json index 72dae50f3d..80670f7ab1 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/package.json +++ b/packages/babel-plugin-transform-es2015-sticky-regex/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-sticky-regex", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 sticky regex to an ES5 RegExp constructor", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-sticky-regex", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-regex": "^6.22.0", - "babel-types": "^6.22.0" + "babel-helper-regex": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-template-literals/package.json b/packages/babel-plugin-transform-es2015-template-literals/package.json index fb4a761686..703615bc04 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/package.json +++ b/packages/babel-plugin-transform-es2015-template-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-template-literals", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 template literals to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-template-literals", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json index 75fb73930e..b9a94b2a6c 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-typeof-symbol", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "This transformer wraps all typeof expressions with a method that replicates native behaviour. (ie. returning “symbol” for symbols)", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-typeof-symbol", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/package.json b/packages/babel-plugin-transform-es2015-unicode-regex/package.json index 634c4fbe5d..92c8155f6f 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/package.json +++ b/packages/babel-plugin-transform-es2015-unicode-regex/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es2015-unicode-regex", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES2015 Unicode regex to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-unicode-regex", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-regex": "^6.22.0", + "babel-helper-regex": "7.0.0-alpha.1", "regexpu-core": "^4.0.2" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/package.json b/packages/babel-plugin-transform-es3-member-expression-literals/package.json index a3bb29a196..69b0561249 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-es3-member-expression-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es3-member-expression-literals", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Ensure that reserved words are quoted in property accesses", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es3-member-expression-literals", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es3-property-literals/package.json b/packages/babel-plugin-transform-es3-property-literals/package.json index b8d43a4043..19e1aa5f1d 100644 --- a/packages/babel-plugin-transform-es3-property-literals/package.json +++ b/packages/babel-plugin-transform-es3-property-literals/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es3-property-literals", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Ensure that reserved words are quoted in object property keys", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es3-property-literals", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es5-property-mutators/package.json b/packages/babel-plugin-transform-es5-property-mutators/package.json index d45b7e8f70..6faac6bc98 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/package.json +++ b/packages/babel-plugin-transform-es5-property-mutators/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-es5-property-mutators", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile ES5 property mutator shorthand syntax to Object.defineProperty", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es5-property-mutators", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-helper-define-map": "^6.22.0" + "babel-helper-define-map": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-eval/package.json b/packages/babel-plugin-transform-eval/package.json index 22ac0cc9fb..e7378f8288 100644 --- a/packages/babel-plugin-transform-eval/package.json +++ b/packages/babel-plugin-transform-eval/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-eval", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile eval calls with string literals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-eval", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index 13bbfdef79..757438a253 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-exponentiation-operator", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile exponentiation operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-exponentiation-operator": "^6.8.0", - "babel-helper-builder-binary-assignment-operator-visitor": "^6.22.0" + "babel-plugin-syntax-exponentiation-operator": "7.0.0-alpha.1", + "babel-helper-builder-binary-assignment-operator-visitor": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-export-extensions/package.json b/packages/babel-plugin-transform-export-extensions/package.json index 535387da3f..4c9fc99b27 100644 --- a/packages/babel-plugin-transform-export-extensions/package.json +++ b/packages/babel-plugin-transform-export-extensions/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-export-extensions", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile export extensions to ES2015", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-export-extensions", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-export-extensions": "^6.8.0" + "babel-plugin-syntax-export-extensions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index 1d717b8385..a44a453c01 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-flow-comments", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn flow type annotations into comments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-comments", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-flow": "^6.8.0" + "babel-plugin-syntax-flow": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index 3c0fd61d27..9ddc454c13 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-flow-strip-types", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Strip flow type annotations from your output code.", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-flow-strip-types", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-flow": "^6.18.0" + "babel-plugin-syntax-flow": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-function-bind/package.json b/packages/babel-plugin-transform-function-bind/package.json index be80fbc653..b7b3c2b957 100644 --- a/packages/babel-plugin-transform-function-bind/package.json +++ b/packages/babel-plugin-transform-function-bind/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-function-bind", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Compile function bind operator to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-bind", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-function-bind": "^6.8.0" + "babel-plugin-syntax-function-bind": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 5302d018e1..2652907040 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-jscript", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel plugin to fix buggy JScript named function expressions", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-jscript", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index d365679451..01e812e89c 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-assign", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Replace Object.assign with an inline helper", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-assign", "author": "Jed Watson", @@ -10,6 +10,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-rest-spread/package.json b/packages/babel-plugin-transform-object-rest-spread/package.json index d4bdce78b5..fd35f3c08c 100644 --- a/packages/babel-plugin-transform-object-rest-spread/package.json +++ b/packages/babel-plugin-transform-object-rest-spread/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-rest-spread", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Compile object rest and spread to ES5", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-object-rest-spread": "^6.8.0" + "babel-plugin-syntax-object-rest-spread": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index c2c8ceb1ce..9afdc54e13 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-object-set-prototype-of-to-assign", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn Object.setPrototypeOf to assignments", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-set-prototype-of-to-assign", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index 8817ae36f6..015ded1ab6 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-proto-to-assign", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Babel plugin for turning __proto__ into a shallow property clone", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", "license": "MIT", @@ -12,6 +12,6 @@ "lodash": "^4.2.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index 77c911d9a7..f02d44c5d0 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-constant-elements", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Treat React JSX elements as value types and hoist them to the highest scope", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 4ae2eb1509..7660d0fedc 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-display-name", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Add displayName to React.createClass calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-display-name", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/package.json b/packages/babel-plugin-transform-react-inline-elements/package.json index 2fe071ba14..eca600b139 100644 --- a/packages/babel-plugin-transform-react-inline-elements/package.json +++ b/packages/babel-plugin-transform-react-inline-elements/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-inline-elements", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn JSX elements into exploded React objects", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-inline-elements", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-runtime": "^6.22.0" + "babel-runtime": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index 87231cf7f1..33f3326a2e 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-compat", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Turn JSX into React Pre-0.12 function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-compat", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-helper-builder-react-jsx": "^6.22.0" + "babel-helper-builder-react-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index 1f26df5265..d1edd9a5e1 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-self", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Add a __self prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-jsx": "^6.8.0" + "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index 150b203d7b..2fd0debd44 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx-source", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Add a __source prop to all JSX Elements", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-plugin-syntax-jsx": "^6.8.0" + "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 17391a3be5..74631ed504 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-react-jsx", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Turn JSX into React function calls", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx", "license": "MIT", @@ -9,10 +9,10 @@ "babel-plugin" ], "dependencies": { - "babel-helper-builder-react-jsx": "^6.23.0", - "babel-plugin-syntax-jsx": "^6.8.0" + "babel-helper-builder-react-jsx": "7.0.0-alpha.1", + "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index 39d2c085bc..9fc402effd 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -2,7 +2,7 @@ "name": "babel-plugin-transform-regenerator", "author": "Ben Newman ", "description": "Explode async and generator functions into a state machine.", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "homepage": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-regenerator", "main": "lib/index.js", @@ -11,6 +11,6 @@ }, "license": "MIT", "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index 98e5430b07..f21cb29054 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-runtime", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime", "license": "MIT", @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index 8a2177f347..ae48917dc0 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -1,6 +1,6 @@ { "name": "babel-plugin-transform-strict-mode", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "This plugin places a 'use strict'; directive at the top of all files to enable strict mode", "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-strict-mode", "license": "MIT", @@ -9,9 +9,9 @@ "babel-plugin" ], "dependencies": { - "babel-types": "^6.22.0" + "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-polyfill/package.json b/packages/babel-polyfill/package.json index 673e8166fe..04e23ce7ec 100644 --- a/packages/babel-polyfill/package.json +++ b/packages/babel-polyfill/package.json @@ -1,6 +1,6 @@ { "name": "babel-polyfill", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Provides polyfills necessary for a full ES2015+ environment", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", diff --git a/packages/babel-preset-es2015/package.json b/packages/babel-preset-es2015/package.json index 78d66ad217..2bd7ed0ac5 100644 --- a/packages/babel-preset-es2015/package.json +++ b/packages/babel-preset-es2015/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2015", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for all es2015 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,33 +8,33 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2015", "main": "lib/index.js", "dependencies": { - "babel-plugin-check-es2015-constants": "^6.22.0", - "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", - "babel-plugin-transform-es2015-block-scoping": "^6.22.0", - "babel-plugin-transform-es2015-classes": "^6.22.0", - "babel-plugin-transform-es2015-computed-properties": "^6.22.0", - "babel-plugin-transform-es2015-destructuring": "^6.22.0", - "babel-plugin-transform-es2015-duplicate-keys": "^6.22.0", - "babel-plugin-transform-es2015-for-of": "^6.22.0", - "babel-plugin-transform-es2015-function-name": "^6.22.0", - "babel-plugin-transform-es2015-literals": "^6.22.0", - "babel-plugin-transform-es2015-modules-amd": "^6.22.0", - "babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", - "babel-plugin-transform-es2015-modules-systemjs": "^6.22.0", - "babel-plugin-transform-es2015-modules-umd": "^6.22.0", - "babel-plugin-transform-es2015-object-super": "^6.22.0", - "babel-plugin-transform-es2015-parameters": "^6.22.0", - "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0", - "babel-plugin-transform-es2015-spread": "^6.22.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.22.0", - "babel-plugin-transform-es2015-template-literals": "^6.22.0", - "babel-plugin-transform-es2015-typeof-symbol": "^6.22.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", - "babel-plugin-transform-regenerator": "^6.22.0" + "babel-plugin-check-es2015-constants": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-arrow-functions": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-block-scoping": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-classes": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-computed-properties": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-destructuring": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-duplicate-keys": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-for-of": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-function-name": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-literals": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-modules-amd": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-modules-commonjs": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-modules-systemjs": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-modules-umd": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-object-super": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-parameters": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-shorthand-properties": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-spread": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-sticky-regex": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-template-literals": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-typeof-symbol": "7.0.0-alpha.1", + "babel-plugin-transform-es2015-unicode-regex": "7.0.0-alpha.1", + "babel-plugin-transform-regenerator": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-transform-fixture-test-runner": "^6.22.0", - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1", + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-es2016/package.json b/packages/babel-preset-es2016/package.json index 9df7e0dfd8..ef113843ce 100644 --- a/packages/babel-preset-es2016/package.json +++ b/packages/babel-preset-es2016/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2016", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for all es2016 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,6 +8,6 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2016", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-exponentiation-operator": "^6.22.0" + "babel-plugin-transform-exponentiation-operator": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-es2017/package.json b/packages/babel-preset-es2017/package.json index 2db56d5ae4..c75189de11 100644 --- a/packages/babel-preset-es2017/package.json +++ b/packages/babel-preset-es2017/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-es2017", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for all es2017 plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-es2017", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-trailing-function-commas": "^6.22.0", - "babel-plugin-transform-async-to-generator": "^6.22.0" + "babel-plugin-syntax-trailing-function-commas": "7.0.0-alpha.1", + "babel-plugin-transform-async-to-generator": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-flow/package.json b/packages/babel-preset-flow/package.json index e9f4cb5979..ecde4039d6 100644 --- a/packages/babel-preset-flow/package.json +++ b/packages/babel-preset-flow/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-flow", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for all Flow plugins.", "author": "James Kyle ", "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-flow", @@ -13,6 +13,6 @@ "types" ], "dependencies": { - "babel-plugin-transform-flow-strip-types": "^6.22.0" + "babel-plugin-transform-flow-strip-types": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-latest/package.json b/packages/babel-preset-latest/package.json index f5a306981d..5211461cce 100644 --- a/packages/babel-preset-latest/package.json +++ b/packages/babel-preset-latest/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-latest", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset including es2015+", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,11 +8,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-latest", "main": "lib/index.js", "dependencies": { - "babel-preset-es2015": "^6.22.0", - "babel-preset-es2016": "^6.22.0", - "babel-preset-es2017": "^6.22.0" + "babel-preset-es2015": "7.0.0-alpha.1", + "babel-preset-es2016": "7.0.0-alpha.1", + "babel-preset-es2017": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "^6.22.0" + "babel-helper-plugin-test-runner": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-react/package.json b/packages/babel-preset-react/package.json index 1a4bf7c55d..91f21948af 100644 --- a/packages/babel-preset-react/package.json +++ b/packages/babel-preset-react/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-react", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for all React plugins.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,11 +8,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-react", "main": "lib/index.js", "dependencies": { - "babel-preset-flow": "^6.23.0", - "babel-plugin-syntax-jsx": "^6.3.13", - "babel-plugin-transform-react-display-name": "^6.23.0", - "babel-plugin-transform-react-jsx": "^6.23.0", - "babel-plugin-transform-react-jsx-source": "^6.22.0", - "babel-plugin-transform-react-jsx-self": "^6.22.0" + "babel-preset-flow": "7.0.0-alpha.1", + "babel-plugin-syntax-jsx": "7.0.0-alpha.1", + "babel-plugin-transform-react-display-name": "7.0.0-alpha.1", + "babel-plugin-transform-react-jsx": "7.0.0-alpha.1", + "babel-plugin-transform-react-jsx-source": "7.0.0-alpha.1", + "babel-plugin-transform-react-jsx-self": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-stage-0/package.json b/packages/babel-preset-stage-0/package.json index 398e12bc61..c3be6411de 100644 --- a/packages/babel-preset-stage-0/package.json +++ b/packages/babel-preset-stage-0/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-0", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for stage 0 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,8 +8,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-0", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-do-expressions": "^6.22.0", - "babel-plugin-transform-function-bind": "^6.22.0", - "babel-preset-stage-1": "^6.22.0" + "babel-plugin-transform-do-expressions": "7.0.0-alpha.1", + "babel-plugin-transform-function-bind": "7.0.0-alpha.1", + "babel-preset-stage-1": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-stage-1/package.json b/packages/babel-preset-stage-1/package.json index 6b2713193e..3d62562948 100644 --- a/packages/babel-preset-stage-1/package.json +++ b/packages/babel-preset-stage-1/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-1", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for stage 1 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,8 +8,8 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-1", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-decorators": "^1.3.4", - "babel-plugin-transform-export-extensions": "^6.22.0", - "babel-preset-stage-2": "^6.22.0" + "babel-plugin-transform-decorators": "7.0.0-alpha.1", + "babel-plugin-transform-export-extensions": "7.0.0-alpha.1", + "babel-preset-stage-2": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-stage-2/package.json b/packages/babel-preset-stage-2/package.json index 6ba06bc92c..bdc0fe94aa 100644 --- a/packages/babel-preset-stage-2/package.json +++ b/packages/babel-preset-stage-2/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-2", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for stage 2 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,9 +8,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2", "main": "lib/index.js", "dependencies": { - "babel-plugin-syntax-dynamic-import": "^6.18.0", - "babel-plugin-transform-class-properties": "^6.22.0", + "babel-plugin-syntax-dynamic-import": "7.0.0-alpha.1", + "babel-plugin-transform-class-properties": "7.0.0-alpha.1", "babel-plugin-transform-unicode-property-regex": "^2.0.0", - "babel-preset-stage-3": "^6.22.0" + "babel-preset-stage-3": "7.0.0-alpha.1" } } diff --git a/packages/babel-preset-stage-3/package.json b/packages/babel-preset-stage-3/package.json index 1c4c1b5434..60ef2805a5 100644 --- a/packages/babel-preset-stage-3/package.json +++ b/packages/babel-preset-stage-3/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-stage-3", - "version": "6.22.0", + "version": "7.0.0-alpha.1", "description": "Babel preset for stage 3 plugins", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,7 +8,7 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-preset-stage-3", "main": "lib/index.js", "dependencies": { - "babel-plugin-transform-async-generator-functions": "^6.22.0", - "babel-plugin-transform-object-rest-spread": "^6.22.0" + "babel-plugin-transform-async-generator-functions": "7.0.0-alpha.1", + "babel-plugin-transform-object-rest-spread": "7.0.0-alpha.1" } } diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index e6e328efc5..7586759738 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "babel-register", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "babel require hook", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-register", @@ -8,7 +8,7 @@ "main": "lib/node.js", "browser": "lib/browser.js", "dependencies": { - "babel-core": "^6.23.0", + "babel-core": "7.0.0-alpha.1", "core-js": "^2.4.0", "home-or-tmp": "^3.0.0", "lodash": "^4.2.0", diff --git a/packages/babel-runtime/package.json b/packages/babel-runtime/package.json index aa64eadd57..92d0356d59 100644 --- a/packages/babel-runtime/package.json +++ b/packages/babel-runtime/package.json @@ -1,6 +1,6 @@ { "name": "babel-runtime", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "babel selfContained runtime", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-runtime", @@ -10,7 +10,7 @@ "regenerator-runtime": "^0.10.0" }, "devDependencies": { - "babel-helpers": "^6.22.0", - "babel-plugin-transform-runtime": "^6.23.0" + "babel-helpers": "7.0.0-alpha.1", + "babel-plugin-transform-runtime": "7.0.0-alpha.1" } } diff --git a/packages/babel-template/package.json b/packages/babel-template/package.json index ef7ec2e466..8bb096ea95 100644 --- a/packages/babel-template/package.json +++ b/packages/babel-template/package.json @@ -1,6 +1,6 @@ { "name": "babel-template", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Generate an AST from a string template.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,8 +9,8 @@ "main": "lib/index.js", "dependencies": { "babylon": "7.0.0-beta.4", - "babel-traverse": "^6.23.0", - "babel-types": "^6.23.0", + "babel-traverse": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", "lodash": "^4.2.0" } } diff --git a/packages/babel-traverse/package.json b/packages/babel-traverse/package.json index dd8422c73b..565159e53e 100644 --- a/packages/babel-traverse/package.json +++ b/packages/babel-traverse/package.json @@ -1,6 +1,6 @@ { "name": "babel-traverse", - "version": "6.23.1", + "version": "7.0.0-alpha.1", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -8,9 +8,9 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-traverse", "main": "lib/index.js", "dependencies": { - "babel-code-frame": "^6.22.0", - "babel-messages": "^6.23.0", - "babel-types": "^6.23.0", + "babel-code-frame": "7.0.0-alpha.1", + "babel-messages": "7.0.0-alpha.1", + "babel-types": "7.0.0-alpha.1", "babylon": "7.0.0-beta.4", "debug": "^2.2.0", "globals": "^9.0.0", @@ -18,6 +18,6 @@ "lodash": "^4.2.0" }, "devDependencies": { - "babel-generator": "^6.23.0" + "babel-generator": "7.0.0-alpha.1" } } diff --git a/packages/babel-types/package.json b/packages/babel-types/package.json index ce18c4ffc5..7c7c6580b5 100644 --- a/packages/babel-types/package.json +++ b/packages/babel-types/package.json @@ -1,6 +1,6 @@ { "name": "babel-types", - "version": "6.23.0", + "version": "7.0.0-alpha.1", "description": "Babel Types is a Lodash-esque utility library for AST nodes", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", From f7e2d88f6c80ab091c1304d32e26245f38c3a0be Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 2 Mar 2017 16:25:18 -0500 Subject: [PATCH 206/222] independent mode [skip ci] --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 40dddfaf34..de8942ffe2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.38", - "version": "7.0.0-alpha.1", + "version": "independent", "changelog": { "repo": "babel/babel", "labels": { From 990d22a8d47ec6625cc528fac430db3368401eca Mon Sep 17 00:00:00 2001 From: Sven SAULEAU Date: Sat, 4 Mar 2017 11:26:13 +0100 Subject: [PATCH 207/222] docs: [skip ci] add new members --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8fe9840ef..3163343a66 100644 --- a/README.md +++ b/README.md @@ -191,17 +191,17 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu | ### Members -[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![Diogo Franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | -|---|---|---|---|---|---|---|---|---| -| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | -| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | -| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | +[![Andrew Levine](https://avatars.githubusercontent.com/u/5233399?s=64)](https://github.com/drewml) | [![Boopathi Rajaa](https://avatars.githubusercontent.com/u/294474?s=64)](https://github.com/boopathi) | [![Brian Ng](https://avatars.githubusercontent.com/u/56288?s=64)](https://github.com/existentialism) | [![Dan Harper](https://avatars.githubusercontent.com/u/510740?s=64)](https://github.com/danharper) | [![diogo franco](https://avatars.githubusercontent.com/u/73085?s=64)](https://github.com/kovensky) | [![Aaron Ang](https://avatars1.githubusercontent.com/u/7579804?s=64)](https://github.com/aaronang) | [![Artem Yavorsky](https://avatars2.githubusercontent.com/u/1521229?s=64)](https://github.com/yavorsky) | +|---|---|---|---|---|---|---|---|---|---|---| +| Andrew Levine | Boopathi Rajaa | Brian Ng | Dan Harper | Diogo Franco | Aaron Ang | Artem Yavorsky | +| [@drewml](https://github.com/drewml) | [@boopathi](https://github.com/boopathi) | [@existentialism](https://github.com/existentialism) | [@danharper](https://github.com/danharper) | [@kovensky](https://github.com/kovensky) | [@aaronang](https://github.com/aaronang) | [@yavorsky](https://github.com/yavorsky) | +| [@drewml](https://twitter.com/drewml) | [@heisenbugger](https://twitter.com/heisenbugger) | [@existentialism](https://twitter.com/existentialism) | [@DanHarper7](https://twitter.com/DanHarper7) | [@kovnsk](https://twitter.com/kovnsk) | [@_aaronang](https://twitter.com/_aaronang) | [@yavorsky_](https://twitter.com/yavorsky_) | -[![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | -|---|---|---|---|---|---|---|---|---| -| Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | -| [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | -| [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | +[![Juriy Zaytsev](https://avatars.githubusercontent.com/u/383?s=64)](https://github.com/kangax) | [![Kai Cataldo](https://avatars.githubusercontent.com/u/7041728?s=64)](https://github.com/kaicataldo) | [![Moti Zilberman](https://avatars.githubusercontent.com/u/2246565?s=64)](https://github.com/motiz88) | [![Sven Sauleau](https://avatars3.githubusercontent.com/u/1493671?s=64)](https://github.com/xtuc) | [![Samuel Reed](https://avatars3.githubusercontent.com/u/1197375?s=64)](https://github.com/STRML) | [![Sergey Rubanov](https://avatars1.githubusercontent.com/u/1507086?s=64)](https://github.com/chicoxyzzy) | +|---|---|---|---|---|---|---|---|---|---|---| +| Juriy Zaytsev | Kai Cataldo | Moti Zilberman | Sven Sauleau | Samuel Reed | Sergey Rubanov | +| [@kangax](https://github.com/kangax) | [@kaicataldo](https://github.com/kaicataldo) | [@motiz88](https://github.com/motiz88) | [@xtuc](https://github.com/xtuc) | [@STRML](https://github.com/STRML) | [@chicoxyzzy](https://github.com/chicoxyzzy) | +| [@kangax](https://twitter.com/kangax) | [@kai_cataldo](https://twitter.com/kai_cataldo) | [@motiz88](https://twitter.com/motiz88) | [@svensauleau](https://twitter.com/svensauleau) | [@STRML_](https://twitter.com/STRML_) | [@chicoxyzzy](https://twitter.com/chicoxyzzy) | ### Non-Human Members @@ -222,3 +222,4 @@ Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie | ## License [MIT](https://github.com/babel/babel/blob/master/LICENSE) + From 8a82cc060ae0ab46bf52e05e592de770bd246f6f Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Sat, 4 Mar 2017 09:46:01 -0600 Subject: [PATCH 208/222] Run new lint rules (#5413) --- .eslintrc | 5 + packages/babel-cli/src/_babel-node.js | 22 +- packages/babel-cli/src/babel-node.js | 2 +- packages/babel-cli/src/babel/dir.js | 4 +- packages/babel-cli/src/babel/file.js | 8 +- packages/babel-cli/src/babel/index.js | 6 +- packages/babel-cli/test/index.js | 26 +- packages/babel-code-frame/src/index.js | 26 +- packages/babel-code-frame/test/index.js | 18 +- packages/babel-core/src/store.js | 2 +- .../src/tools/build-external-helpers.js | 26 +- .../src/transformation/file/index.js | 78 ++-- .../src/transformation/file/logger.js | 2 +- .../src/transformation/file/metadata.js | 24 +- .../file/options/build-config-chain.js | 20 +- .../src/transformation/file/options/config.js | 76 ++-- .../file/options/option-manager.js | 10 +- .../transformation/file/options/removed.js | 28 +- .../internal-plugins/block-hoist.js | 6 +- .../internal-plugins/shadow-functions.js | 8 +- .../src/transformation/plugin-pass.js | 6 +- .../babel-core/src/transformation/plugin.js | 10 +- packages/babel-core/test/api.js | 172 ++++---- packages/babel-core/test/config-chain.js | 134 +++--- packages/babel-core/test/evaluation.js | 2 +- .../test/get-possible-preset-names.js | 4 +- packages/babel-core/test/option-manager.js | 10 +- packages/babel-core/test/path.js | 66 +-- .../src/generators/expressions.js | 2 +- .../babel-generator/src/generators/flow.js | 2 +- .../babel-generator/src/generators/methods.js | 4 +- .../src/generators/statements.js | 8 +- .../babel-generator/src/generators/types.js | 4 +- packages/babel-generator/src/index.js | 6 +- .../babel-generator/src/node/parentheses.js | 6 +- .../babel-generator/src/node/whitespace.js | 22 +- packages/babel-generator/src/printer.js | 6 +- packages/babel-generator/src/whitespace.js | 4 +- packages/babel-generator/test/index.js | 16 +- .../src/index.js | 4 +- .../src/index.js | 2 +- .../src/index.js | 4 +- .../babel-helper-call-delegate/src/index.js | 6 +- .../src/index.js | 6 +- packages/babel-helper-fixtures/src/index.js | 10 +- .../babel-helper-function-name/src/index.js | 12 +- .../babel-helper-hoist-variables/src/index.js | 2 +- .../src/for-await.js | 8 +- .../src/index.js | 14 +- .../babel-helper-replace-supers/src/index.js | 38 +- .../src/index.js | 8 +- packages/babel-messages/src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../babel-plugin-syntax-flow/src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- packages/babel-plugin-syntax-jsx/src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 2 +- .../src/index.js | 10 +- .../src/index.js | 6 +- .../src/index.js | 6 +- .../src/index.js | 16 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 6 +- .../src/index.js | 8 +- .../src/index.js | 76 ++-- .../src/tdz.js | 6 +- .../src/index.js | 6 +- .../src/loose.js | 2 +- .../src/vanilla.js | 70 ++-- .../src/index.js | 16 +- .../src/index.js | 50 +-- .../src/index.js | 4 +- .../src/index.js | 58 +-- .../src/index.js | 6 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 12 +- .../src/index.js | 20 +- .../test/esmodule-flag.js | 2 +- .../src/index.js | 26 +- .../src/index.js | 10 +- .../src/index.js | 16 +- .../src/default.js | 12 +- .../src/destructuring.js | 4 +- .../src/index.js | 4 +- .../src/rest.js | 18 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 6 +- .../src/index.js | 10 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 6 +- .../src/index.js | 6 +- .../src/index.js | 4 +- .../babel-plugin-transform-eval/src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 8 +- .../src/index.js | 4 +- .../src/index.js | 6 +- .../src/index.js | 8 +- .../src/index.js | 4 +- .../src/index.js | 26 +- .../src/index.js | 4 +- .../src/index.js | 8 +- .../src/index.js | 6 +- .../src/index.js | 4 +- .../src/index.js | 10 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 4 +- .../src/index.js | 6 +- .../src/definitions.js | 24 +- .../src/index.js | 6 +- .../src/index.js | 4 +- packages/babel-preset-es2015/src/index.js | 4 +- packages/babel-preset-es2015/test/traceur.js | 2 +- packages/babel-preset-es2016/src/index.js | 4 +- packages/babel-preset-es2017/src/index.js | 4 +- packages/babel-preset-flow/src/index.js | 4 +- packages/babel-preset-latest/src/index.js | 4 +- packages/babel-preset-react/src/index.js | 10 +- packages/babel-preset-stage-0/src/index.js | 6 +- packages/babel-preset-stage-1/src/index.js | 6 +- packages/babel-preset-stage-2/src/index.js | 6 +- packages/babel-preset-stage-3/src/index.js | 4 +- packages/babel-register/src/node.js | 12 +- packages/babel-template/src/index.js | 4 +- packages/babel-traverse/src/context.js | 10 +- packages/babel-traverse/src/index.js | 10 +- packages/babel-traverse/src/path/comments.js | 4 +- packages/babel-traverse/src/path/context.js | 14 +- .../babel-traverse/src/path/evaluation.js | 4 +- packages/babel-traverse/src/path/family.js | 8 +- packages/babel-traverse/src/path/index.js | 2 +- .../src/path/inference/index.js | 2 +- .../src/path/inference/inferer-reference.js | 6 +- .../src/path/inference/inferers.js | 10 +- .../babel-traverse/src/path/introspection.js | 6 +- .../babel-traverse/src/path/lib/hoister.js | 16 +- .../src/path/lib/removal-hooks.js | 4 +- .../src/path/lib/virtual-types.js | 32 +- .../babel-traverse/src/path/modification.js | 6 +- packages/babel-traverse/src/path/removal.js | 4 +- .../babel-traverse/src/path/replacement.js | 2 +- packages/babel-traverse/src/scope/binding.js | 12 +- packages/babel-traverse/src/scope/index.js | 40 +- .../babel-traverse/src/scope/lib/renamer.js | 6 +- packages/babel-traverse/test/ancestry.js | 4 +- packages/babel-traverse/test/evaluation.js | 2 +- packages/babel-traverse/test/family.js | 4 +- packages/babel-traverse/test/inference.js | 2 +- packages/babel-traverse/test/removal.js | 2 +- packages/babel-traverse/test/scope.js | 8 +- packages/babel-traverse/test/traverse.js | 32 +- packages/babel-types/src/constants.js | 26 +- packages/babel-types/src/converters.js | 6 +- packages/babel-types/src/definitions/core.js | 392 +++++++++--------- .../babel-types/src/definitions/es2015.js | 204 ++++----- .../src/definitions/experimental.js | 32 +- packages/babel-types/src/definitions/flow.js | 94 ++--- packages/babel-types/src/definitions/index.js | 6 +- packages/babel-types/src/definitions/jsx.js | 82 ++-- packages/babel-types/src/definitions/misc.js | 8 +- packages/babel-types/src/flow.js | 2 +- packages/babel-types/src/index.js | 16 +- packages/babel-types/src/retrievers.js | 4 +- packages/babel-types/test/converters.js | 4 +- 181 files changed, 1459 insertions(+), 1454 deletions(-) diff --git a/.eslintrc b/.eslintrc index 02f7711758..b081e2ce24 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,11 @@ { "extends": "babel", "rules": { + "comma-dangle": ["error", "always-multiline"], + "curly": ["error", "multi-line"], + "func-call-spacing": "error", + "key-spacing": "error", + "no-multi-spaces": "error" }, "env": { "node": true, diff --git a/packages/babel-cli/src/_babel-node.js b/packages/babel-cli/src/_babel-node.js index 3d0e1f319d..ee6e340c31 100644 --- a/packages/babel-cli/src/_babel-node.js +++ b/packages/babel-cli/src/_babel-node.js @@ -29,10 +29,10 @@ program.parse(process.argv); register({ extensions: program.extensions, - ignore: program.ignore, - only: program.only, - plugins: program.plugins, - presets: program.presets, + ignore: program.ignore, + only: program.only, + plugins: program.plugins, + presets: program.presets, }); // @@ -55,8 +55,8 @@ const replPlugin = ({ types: t }) => ({ // If the executed code doesn't evaluate to a value, // prevent implicit strict mode from printing 'use strict'. path.pushContainer("body", t.expressionStatement(t.identifier("undefined"))); - } - } + }, + }, }); // @@ -68,11 +68,11 @@ const _eval = function (code, filename) { code = babel.transform(code, { filename: filename, presets: program.presets, - plugins: (program.plugins || []).concat([replPlugin]) + plugins: (program.plugins || []).concat([replPlugin]), }).code; return vm.runInThisContext(code, { - filename: filename + filename: filename, }); }; @@ -85,10 +85,10 @@ if (program.eval || program.print) { const module = new Module(global.__filename); module.filename = global.__filename; - module.paths = Module._nodeModulePaths(global.__dirname); + module.paths = Module._nodeModulePaths(global.__dirname); global.exports = module.exports; - global.module = module; + global.module = module; global.require = module.require.bind(module); const result = _eval(code, global.__filename); @@ -141,7 +141,7 @@ function replStart() { input: process.stdin, output: process.stdout, eval: replEval, - useGlobal: true + useGlobal: true, }); } diff --git a/packages/babel-cli/src/babel-node.js b/packages/babel-cli/src/babel-node.js index d92f0e863b..3da22997f7 100755 --- a/packages/babel-cli/src/babel-node.js +++ b/packages/babel-cli/src/babel-node.js @@ -14,7 +14,7 @@ let userArgs; // separate node arguments from script arguments const argSeparator = babelArgs.indexOf("--"); if (argSeparator > -1) { - userArgs = babelArgs.slice(argSeparator); // including the -- + userArgs = babelArgs.slice(argSeparator); // including the -- babelArgs = babelArgs.slice(0, argSeparator); } diff --git a/packages/babel-cli/src/babel/dir.js b/packages/babel-cli/src/babel/dir.js index 91731f39fe..0316062590 100644 --- a/packages/babel-cli/src/babel/dir.js +++ b/packages/babel-cli/src/babel/dir.js @@ -14,7 +14,7 @@ export default function (commander, filenames) { const data = util.compile(src, { sourceFileName: slash(path.relative(dest + "/..", src)), - sourceMapTarget: path.basename(relative) + sourceMapTarget: path.basename(relative), }); if (!commander.copyFiles && data.ignored) return; @@ -74,7 +74,7 @@ export default function (commander, filenames) { awaitWriteFinish: { stabilityThreshold: 50, pollInterval: 10, - } + }, }); ["add", "change"].forEach(function (type) { diff --git a/packages/babel-cli/src/babel/file.js b/packages/babel-cli/src/babel/file.js index 73b5ef14fc..fb4b1f9a0c 100644 --- a/packages/babel-cli/src/babel/file.js +++ b/packages/babel-cli/src/babel/file.js @@ -1,5 +1,5 @@ import convertSourceMap from "convert-source-map"; -import sourceMap from "source-map"; +import sourceMap from "source-map"; import slash from "slash"; import path from "path"; import fs from "fs"; @@ -16,7 +16,7 @@ export default function (commander, filenames, opts) { const buildResult = function () { const map = new sourceMap.SourceMapGenerator({ file: path.basename(commander.outFile || "") || "stdout", - sourceRoot: opts.sourceRoot + sourceRoot: opts.sourceRoot, }); let code = ""; @@ -64,7 +64,7 @@ export default function (commander, filenames, opts) { return { map: map, - code: code + code: code, }; }; @@ -156,7 +156,7 @@ export default function (commander, filenames, opts) { awaitWriteFinish: { stabilityThreshold: 50, pollInterval: 10, - } + }, }).on("all", function (type, filename) { if (util.shouldIgnore(filename) || !util.canCompile(filename, commander.extensions)) return; diff --git a/packages/babel-cli/src/babel/index.js b/packages/babel-cli/src/babel/index.js index 2a5f4f9cd6..a96056b3dc 100755 --- a/packages/babel-cli/src/babel/index.js +++ b/packages/babel-cli/src/babel/index.js @@ -1,11 +1,11 @@ #!/usr/bin/env node -import fs from "fs"; +import fs from "fs"; import commander from "commander"; import kebabCase from "lodash/kebabCase"; import { options, util, version } from "babel-core"; -import uniq from "lodash/uniq"; -import glob from "glob"; +import uniq from "lodash/uniq"; +import glob from "glob"; import dirCommand from "./dir"; import fileCommand from "./file"; diff --git a/packages/babel-cli/test/index.js b/packages/babel-cli/test/index.js index 9da8405733..c2bda15c4c 100644 --- a/packages/babel-cli/test/index.js +++ b/packages/babel-cli/test/index.js @@ -1,21 +1,21 @@ -const includes = require("lodash/includes"); -const readdir = require("fs-readdir-recursive"); -const helper = require("babel-helper-fixtures"); -const assert = require("assert"); -const rimraf = require("rimraf"); +const includes = require("lodash/includes"); +const readdir = require("fs-readdir-recursive"); +const helper = require("babel-helper-fixtures"); +const assert = require("assert"); +const rimraf = require("rimraf"); const outputFileSync = require("output-file-sync"); -const child = require("child_process"); -const merge = require("lodash/merge"); -const path = require("path"); -const chai = require("chai"); -const fs = require("fs"); +const child = require("child_process"); +const merge = require("lodash/merge"); +const path = require("path"); +const chai = require("chai"); +const fs = require("fs"); const fixtureLoc = path.join(__dirname, "fixtures"); const tmpLoc = path.join(__dirname, "tmp"); const presetLocs = [ path.join(__dirname, "../../babel-preset-es2015"), - path.join(__dirname, "../../babel-preset-react") + path.join(__dirname, "../../babel-preset-react"), ].join(","); const pluginLocs = [ @@ -150,7 +150,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { const testLoc = path.join(suiteLoc, testName); const opts = { - args: [] + args: [], }; const optionsLoc = path.join(testLoc, "options.json"); @@ -166,7 +166,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { }); opts.outFiles = readDir(path.join(testLoc, "out-files")); - opts.inFiles = readDir(path.join(testLoc, "in-files")); + opts.inFiles = readDir(path.join(testLoc, "in-files")); const babelrcLoc = path.join(testLoc, ".babelrc"); if (fs.existsSync(babelrcLoc)) { diff --git a/packages/babel-code-frame/src/index.js b/packages/babel-code-frame/src/index.js index e2a1b84ebe..5dbf1b8ada 100644 --- a/packages/babel-code-frame/src/index.js +++ b/packages/babel-code-frame/src/index.js @@ -8,18 +8,18 @@ import Chalk from "chalk"; function getDefs(chalk) { return { - keyword: chalk.cyan, + keyword: chalk.cyan, capitalized: chalk.yellow, - jsx_tag: chalk.yellow, - punctuator: chalk.yellow, + jsx_tag: chalk.yellow, + punctuator: chalk.yellow, // bracket: intentionally omitted. - number: chalk.magenta, - string: chalk.green, - regex: chalk.magenta, - comment: chalk.grey, - invalid: chalk.white.bgRed.bold, - gutter: chalk.grey, - marker: chalk.red.bold, + number: chalk.magenta, + string: chalk.green, + regex: chalk.magenta, + comment: chalk.grey, + invalid: chalk.white.bgRed.bold, + gutter: chalk.grey, + marker: chalk.red.bold, }; } @@ -117,7 +117,7 @@ export default function ( const lines = rawLines.split(NEWLINE); let start = Math.max(lineNumber - (linesAbove + 1), 0); - let end = Math.min(lines.length, lineNumber + linesBelow); + let end = Math.min(lines.length, lineNumber + linesBelow); if (!lineNumber && !colNumber) { start = 0; @@ -138,14 +138,14 @@ export default function ( "\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, - maybeHighlight(defs.marker, "^") + maybeHighlight(defs.marker, "^"), ].join(""); } return [ maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, - markerLine + markerLine, ].join(""); } else { return ` ${maybeHighlight(defs.gutter, gutter)}${line}`; diff --git a/packages/babel-code-frame/test/index.js b/packages/babel-code-frame/test/index.js index f91727cb24..fa1455c496 100644 --- a/packages/babel-code-frame/test/index.js +++ b/packages/babel-code-frame/test/index.js @@ -55,7 +55,7 @@ describe("babel-code-frame", function () { "", "function sum(a, b) {", " return a + b", - "}" + "}", ].join("\n"); assert.equal(codeFrame(rawLines, 7, 2), [ " 5 | * @param b Number", @@ -80,7 +80,7 @@ describe("babel-code-frame", function () { "", "function sum(a, b) {", " return a + b", - "}" + "}", ].join("\n"); assert.equal(codeFrame(rawLines, 6, 2), [ " 4 | * @param a Number", @@ -130,7 +130,7 @@ describe("babel-code-frame", function () { "", "function sum(a, b) {", " return a + b", - "}" + "}", ].join("\n"); assert.equal(codeFrame(rawLines, 7, 2, { linesAbove: 1 }), [ " 6 | * @returns Number", @@ -154,14 +154,14 @@ describe("babel-code-frame", function () { "", "function sum(a, b) {", " return a + b", - "}" + "}", ].join("\n"); assert.equal(codeFrame(rawLines, 7, 2, { linesBelow: 1 }), [ " 5 | * @param b Number", " 6 | * @returns Number", "> 7 | */", " | ^", - " 8 | " + " 8 | ", ].join("\n")); }); @@ -177,13 +177,13 @@ describe("babel-code-frame", function () { "", "function sum(a, b) {", " return a + b", - "}" + "}", ].join("\n"); assert.equal(codeFrame(rawLines, 7, 2, { linesAbove: 1, linesBelow: 1 }), [ " 6 | * @returns Number", "> 7 | */", " | ^", - " 8 | " + " 8 | ", ].join("\n")); }); @@ -195,13 +195,13 @@ describe("babel-code-frame", function () { "", "", "", - "" + "", ].join("\n"); assert.equal(codeFrame(rawLines, 3, null, { linesAbove: 1, linesBelow: 1, forceColor: true }), chalk.reset([ " " + gutter(" 2 | "), marker(">") + gutter(" 3 | "), - " " + gutter(" 4 | ") + " " + gutter(" 4 | "), ].join("\n")) ); }); diff --git a/packages/babel-core/src/store.js b/packages/babel-core/src/store.js index bf5c984d75..7f2f4db6e2 100644 --- a/packages/babel-core/src/store.js +++ b/packages/babel-core/src/store.js @@ -17,7 +17,7 @@ export default class Store { return this._map.get(key); } else { if (Object.prototype.hasOwnProperty.call(this._map.dynamicData, key)) { - const val = this._map.dynamicData[key](); + const val = this._map.dynamicData[key](); this._map.set(key, val); return val; } diff --git a/packages/babel-core/src/tools/build-external-helpers.js b/packages/babel-core/src/tools/build-external-helpers.js index 8eb206f5ff..75a00f0fff 100644 --- a/packages/babel-core/src/tools/build-external-helpers.js +++ b/packages/babel-core/src/tools/build-external-helpers.js @@ -19,9 +19,9 @@ const buildUmdWrapper = template(` `); function buildGlobal(namespace, builder) { - const body = []; + const body = []; const container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body)); - const tree = t.program([ + const tree = t.program([ t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]); body.push(t.variableDeclaration("var", [ @@ -29,7 +29,7 @@ function buildGlobal(namespace, builder) { namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])) - ) + ), ])); builder(body); @@ -40,7 +40,7 @@ function buildGlobal(namespace, builder) { function buildUmd(namespace, builder) { const body = []; body.push(t.variableDeclaration("var", [ - t.variableDeclarator(namespace, t.identifier("global")) + t.variableDeclarator(namespace, t.identifier("global")), ])); builder(body); @@ -48,23 +48,23 @@ function buildUmd(namespace, builder) { return t.program([ buildUmdWrapper({ FACTORY_PARAMETERS: t.identifier("global"), - BROWSER_ARGUMENTS: t.assignmentExpression( + BROWSER_ARGUMENTS: t.assignmentExpression( "=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([]) ), - COMMON_ARGUMENTS: t.identifier("exports"), - AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]), - FACTORY_BODY: body, - UMD_ROOT: t.identifier("this") - }) + COMMON_ARGUMENTS: t.identifier("exports"), + AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]), + FACTORY_BODY: body, + UMD_ROOT: t.identifier("this"), + }), ]); } function buildVar(namespace, builder) { const body = []; body.push(t.variableDeclaration("var", [ - t.variableDeclarator(namespace, t.objectExpression([])) + t.variableDeclarator(namespace, t.objectExpression([])), ])); builder(body); body.push(t.expressionStatement(namespace)); @@ -95,8 +95,8 @@ export default function ( const build = { global: buildGlobal, - umd: buildUmd, - var: buildVar, + umd: buildUmd, + var: buildVar, }[outputType]; if (build) { diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 1a5471c115..dad9ec5b13 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -14,7 +14,7 @@ import traverse from "babel-traverse"; import Logger from "./logger"; import Store from "../../store"; import { parse } from "babylon"; -import * as util from "../../util"; +import * as util from "../../util"; import path from "path"; import * as t from "babel-types"; @@ -27,7 +27,7 @@ const shebangRegex = /^#!.*/; const INTERNAL_PLUGINS = [ [blockHoistPlugin], - [shadowFunctionsPlugin] + [shadowFunctionsPlugin], ]; const errorVisitor = { @@ -37,20 +37,20 @@ const errorVisitor = { state.loc = loc; path.stop(); } - } + }, }; export default class File extends Store { constructor(opts: Object = {}) { super(); - this.log = new Logger(this, opts.filename || "unknown"); + this.log = new Logger(this, opts.filename || "unknown"); this.opts = this.initOptions(opts); this.parserOpts = { - sourceType: this.opts.sourceType, + sourceType: this.opts.sourceType, sourceFileName: this.opts.filename, - plugins: [] + plugins: [], }; this.pluginVisitors = []; @@ -78,21 +78,21 @@ export default class File extends Store { imports: [], exports: { exported: [], - specifiers: [] - } - } + specifiers: [], + }, + }, }; this.dynamicImportTypes = {}; - this.dynamicImportIds = {}; - this.dynamicImports = []; - this.declarations = {}; - this.usedHelpers = {}; + this.dynamicImportIds = {}; + this.dynamicImports = []; + this.declarations = {}; + this.usedHelpers = {}; this.path = null; - this.ast = {}; + this.ast = {}; - this.code = ""; + this.code = ""; this.shebang = ""; this.hub = new Hub(this); @@ -149,22 +149,22 @@ export default class File extends Store { if (opts.only) opts.only = util.arrayify(opts.only, util.regexify); defaults(opts, { - moduleRoot: opts.sourceRoot + moduleRoot: opts.sourceRoot, }); defaults(opts, { - sourceRoot: opts.moduleRoot + sourceRoot: opts.moduleRoot, }); defaults(opts, { - filenameRelative: opts.filename + filenameRelative: opts.filename, }); const basenameRelative = path.basename(opts.filenameRelative); defaults(opts, { - sourceFileName: basenameRelative, - sourceMapTarget: basenameRelative + sourceFileName: basenameRelative, + sourceMapTarget: basenameRelative, }); return opts; @@ -282,7 +282,7 @@ export default class File extends Store { } const generator = this.get("helperGenerator"); - const runtime = this.get("helpersNamespace"); + const runtime = this.get("helpersNamespace"); if (generator) { const res = generator(name); if (res) return res; @@ -304,7 +304,7 @@ export default class File extends Store { this.scope.push({ id: uid, init: ref, - unique: true + unique: true, }); } @@ -334,7 +334,7 @@ export default class File extends Store { this.scope.push({ id: uid, init: init, - _blockHoist: 1.9 // This ensures that we don't fail if not using function expression helpers + _blockHoist: 1.9, // This ensures that we don't fail if not using function expression helpers }); return uid; } @@ -365,12 +365,12 @@ export default class File extends Store { const inputMap = this.opts.inputSourceMap; if (inputMap) { - const inputMapConsumer = new sourceMap.SourceMapConsumer(inputMap); - const outputMapConsumer = new sourceMap.SourceMapConsumer(map); + const inputMapConsumer = new sourceMap.SourceMapConsumer(inputMap); + const outputMapConsumer = new sourceMap.SourceMapConsumer(map); const mergedGenerator = new sourceMap.SourceMapGenerator({ file: inputMapConsumer.file, - sourceRoot: inputMapConsumer.sourceRoot + sourceRoot: inputMapConsumer.sourceRoot, }); // This assumes the output map always has a single source, since Babel always compiles a @@ -381,7 +381,7 @@ export default class File extends Store { const generatedPosition = outputMapConsumer.generatedPositionFor({ line: mapping.generatedLine, column: mapping.generatedColumn, - source: source + source: source, }); if (generatedPosition.column != null) { mergedGenerator.addMapping({ @@ -389,10 +389,10 @@ export default class File extends Store { original: mapping.source == null ? null : { line: mapping.originalLine, - column: mapping.originalColumn + column: mapping.originalColumn, }, - generated: generatedPosition + generated: generatedPosition, }); } }); @@ -429,7 +429,7 @@ export default class File extends Store { parserOpts.parser = { parse(source) { return parse(source, parserOpts); - } + }, }; } } @@ -446,10 +446,10 @@ export default class File extends Store { parentPath: null, parent: ast, container: ast, - key: "program" + key: "program", }).setContext(); this.scope = this.path.scope; - this.ast = ast; + this.ast = ast; this.getMetadata(); } @@ -568,11 +568,11 @@ export default class File extends Store { makeResult({ code, map, ast, ignored }: BabelFileResult): BabelFileResult { const result = { metadata: null, - options: this.opts, - ignored: !!ignored, - code: null, - ast: null, - map: map || null + options: this.opts, + ignored: !!ignored, + code: null, + ast: null, + map: map || null, }; if (this.opts.code) { @@ -592,7 +592,7 @@ export default class File extends Store { generate(): BabelFileResult { const opts = this.opts; - const ast = this.ast; + const ast = this.ast; const result: BabelFileResult = { ast }; if (!opts.code) return this.makeResult(result); @@ -618,7 +618,7 @@ export default class File extends Store { const _result = gen(ast, opts.generatorOpts ? Object.assign(opts, opts.generatorOpts) : opts, this.code); result.code = _result.code; - result.map = _result.map; + result.map = _result.map; this.log.debug("Generation end"); diff --git a/packages/babel-core/src/transformation/file/logger.js b/packages/babel-core/src/transformation/file/logger.js index 31bf92ac62..aa4a57d718 100644 --- a/packages/babel-core/src/transformation/file/logger.js +++ b/packages/babel-core/src/transformation/file/logger.js @@ -9,7 +9,7 @@ const seenDeprecatedMessages = []; export default class Logger { constructor(file: File, filename: string) { this.filename = filename; - this.file = file; + this.file = file; } filename: string; diff --git a/packages/babel-core/src/transformation/file/metadata.js b/packages/babel-core/src/transformation/file/metadata.js index 83b3580819..5fcb0efa79 100644 --- a/packages/babel-core/src/transformation/file/metadata.js +++ b/packages/babel-core/src/transformation/file/metadata.js @@ -6,7 +6,7 @@ export const ModuleDeclaration = { if (node.source) { node.source.value = file.resolveModuleSource(node.source.value); } - } + }, }; export const ImportDeclaration = { @@ -18,7 +18,7 @@ export const ImportDeclaration = { file.metadata.modules.imports.push({ source: node.source.value, imported, - specifiers + specifiers, }); for (const specifier of (path.get("specifiers"): Array)) { @@ -29,7 +29,7 @@ export const ImportDeclaration = { specifiers.push({ kind: "named", imported: "default", - local + local, }); } @@ -39,7 +39,7 @@ export const ImportDeclaration = { specifiers.push({ kind: "named", imported: importedName, - local + local, }); } @@ -47,11 +47,11 @@ export const ImportDeclaration = { imported.push("*"); specifiers.push({ kind: "namespace", - local + local, }); } } - } + }, }; export function ExportDeclaration(path, file) { @@ -71,7 +71,7 @@ export function ExportDeclaration(path, file) { exports.specifiers.push({ kind: "local", local: name, - exported: path.isExportDefaultDeclaration() ? "default" : name + exported: path.isExportDefaultDeclaration() ? "default" : name, }); } } @@ -87,7 +87,7 @@ export function ExportDeclaration(path, file) { kind: "external", local: exported, exported, - source + source, }); } @@ -96,7 +96,7 @@ export function ExportDeclaration(path, file) { exports.specifiers.push({ kind: "external-namespace", exported, - source + source, }); } @@ -110,7 +110,7 @@ export function ExportDeclaration(path, file) { kind: "external", local: local.name, exported, - source + source, }); } @@ -120,7 +120,7 @@ export function ExportDeclaration(path, file) { exports.specifiers.push({ kind: "local", local: local.name, - exported + exported, }); } } @@ -130,7 +130,7 @@ export function ExportDeclaration(path, file) { if (path.isExportAllDeclaration()) { exports.specifiers.push({ kind: "external-all", - source + source, }); } } diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index deee5efffc..5542072f69 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -6,11 +6,11 @@ import path from "path"; import fs from "fs"; const existsCache = {}; -const jsonCache = {}; +const jsonCache = {}; const BABELIGNORE_FILENAME = ".babelignore"; -const BABELRC_FILENAME = ".babelrc"; -const PACKAGE_FILENAME = "package.json"; +const BABELRC_FILENAME = ".babelrc"; +const PACKAGE_FILENAME = "package.json"; function exists(filename) { const cached = existsCache[filename]; @@ -33,7 +33,7 @@ export default function buildConfigChain(opts: Object = {}, log?: Logger) { builder.mergeConfig({ options: opts, alias: "base", - dirname: filename && path.dirname(filename) + dirname: filename && path.dirname(filename), }); return builder.configs; @@ -83,7 +83,7 @@ class ConfigChainBuilder { } addIgnoreConfig(loc) { - const file = fs.readFileSync(loc, "utf8"); + const file = fs.readFileSync(loc, "utf8"); let lines = file.split("\n"); lines = lines @@ -94,7 +94,7 @@ class ConfigChainBuilder { this.mergeConfig({ options: { ignore: lines }, alias: loc, - dirname: path.dirname(loc) + dirname: path.dirname(loc), }); } } @@ -120,7 +120,7 @@ class ConfigChainBuilder { this.mergeConfig({ options, alias: loc, - dirname: path.dirname(loc) + dirname: path.dirname(loc), }); return !!options; @@ -130,7 +130,7 @@ class ConfigChainBuilder { options, alias, loc, - dirname + dirname, }) { if (!options) { return false; @@ -156,7 +156,7 @@ class ConfigChainBuilder { options, alias, loc, - dirname + dirname, }); // env @@ -170,7 +170,7 @@ class ConfigChainBuilder { this.mergeConfig({ options: envOpts, alias: `${alias}.env.${envKey}`, - dirname: dirname + dirname: dirname, }); } } diff --git a/packages/babel-core/src/transformation/file/options/config.js b/packages/babel-core/src/transformation/file/options/config.js index 80e8bf7a00..8c8df2c0c9 100644 --- a/packages/babel-core/src/transformation/file/options/config.js +++ b/packages/babel-core/src/transformation/file/options/config.js @@ -5,191 +5,191 @@ export default { type: "filename", description: "filename to use when reading from stdin - this will be used in source-maps, errors etc", default: "unknown", - shorthand: "f" + shorthand: "f", }, filenameRelative: { hidden: true, - type: "string" + type: "string", }, inputSourceMap: { - hidden: true + hidden: true, }, env: { hidden: true, - default: {} + default: {}, }, mode: { description: "", - hidden: true + hidden: true, }, retainLines: { type: "boolean", default: false, - description: "retain line numbers - will result in really ugly code" + description: "retain line numbers - will result in really ugly code", }, highlightCode: { description: "enable/disable ANSI syntax highlighting of code frames (on by default)", type: "boolean", - default: true + default: true, }, suppressDeprecationMessages: { type: "boolean", default: false, - hidden: true + hidden: true, }, presets: { type: "list", description: "", - default: [] + default: [], }, plugins: { type: "list", default: [], - description: "" + description: "", }, ignore: { type: "list", description: "list of glob paths to **not** compile", - default: [] + default: [], }, only: { type: "list", - description: "list of glob paths to **only** compile" + description: "list of glob paths to **only** compile", }, code: { hidden: true, default: true, - type: "boolean" + type: "boolean", }, metadata: { hidden: true, default: true, - type: "boolean" + type: "boolean", }, ast: { hidden: true, default: true, - type: "boolean" + type: "boolean", }, extends: { type: "string", - hidden: true + hidden: true, }, comments: { type: "boolean", default: true, - description: "write comments to generated output (true by default)" + description: "write comments to generated output (true by default)", }, shouldPrintComment: { hidden: true, - description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored" + description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored", }, wrapPluginVisitorMethod: { hidden: true, - description: "optional callback to wrap all visitor methods" + description: "optional callback to wrap all visitor methods", }, compact: { type: "booleanString", default: "auto", - description: "do not include superfluous whitespace characters and line terminators [true|false|auto]" + description: "do not include superfluous whitespace characters and line terminators [true|false|auto]", }, minified: { type: "boolean", default: false, - description: "save as much bytes when printing [true|false]" + description: "save as much bytes when printing [true|false]", }, sourceMap: { alias: "sourceMaps", - hidden: true + hidden: true, }, sourceMaps: { type: "booleanString", description: "[true|false|inline]", default: false, - shorthand: "s" + shorthand: "s", }, sourceMapTarget: { type: "string", - description: "set `file` on returned source map" + description: "set `file` on returned source map", }, sourceFileName: { type: "string", - description: "set `sources[0]` on returned source map" + description: "set `sources[0]` on returned source map", }, sourceRoot: { type: "filename", - description: "the root from which all sources are relative" + description: "the root from which all sources are relative", }, babelrc: { description: "Whether or not to look up .babelrc and .babelignore files", type: "boolean", - default: true + default: true, }, sourceType: { description: "", - default: "module" + default: "module", }, auxiliaryCommentBefore: { type: "string", - description: "print a comment before any injected non-user code" + description: "print a comment before any injected non-user code", }, auxiliaryCommentAfter: { type: "string", - description: "print a comment after any injected non-user code" + description: "print a comment after any injected non-user code", }, resolveModuleSource: { - hidden: true + hidden: true, }, getModuleId: { - hidden: true + hidden: true, }, moduleRoot: { type: "filename", - description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions" + description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions", }, moduleIds: { type: "boolean", default: false, shorthand: "M", - description: "insert an explicit id for modules" + description: "insert an explicit id for modules", }, moduleId: { description: "specify a custom name for module ids", - type: "string" + type: "string", }, passPerPreset: { @@ -202,12 +202,12 @@ export default { // Deprecate top level parserOpts parserOpts: { description: "Options to pass into the parser, or to change parsers (parserOpts.parser)", - default: false + default: false, }, // Deprecate top level generatorOpts generatorOpts: { description: "Options to pass into the generator, or to change generators (generatorOpts.generator)", - default: false - } + default: false, + }, }; diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index d50bd2139f..6c63ba32fa 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -67,7 +67,7 @@ export default class OptionManager { const plugin = new Plugin(obj, alias); OptionManager.memoisedPlugins.push({ container: fn, - plugin: plugin + plugin: plugin, }); return plugin; } else { @@ -151,7 +151,7 @@ export default class OptionManager { extending: extendingOpts, alias, loc, - dirname + dirname, }: MergeOptions) { alias = alias || "foreign"; if (!rawOpts) return; @@ -208,7 +208,7 @@ export default class OptionManager { extending: preset, alias: presetLoc, loc: presetLoc, - dirname: dirname + dirname: dirname, }); }); } else { @@ -238,7 +238,7 @@ export default class OptionManager { options: presetOpts, alias: presetLoc, loc: presetLoc, - dirname: path.dirname(presetLoc || "") + dirname: path.dirname(presetLoc || ""), }); }); } @@ -318,7 +318,7 @@ export default class OptionManager { for (const key in config) { const option = config[key]; - const val = opts[key]; + const val = opts[key]; // optional if (!val && option.optional) continue; diff --git a/packages/babel-core/src/transformation/file/options/removed.js b/packages/babel-core/src/transformation/file/options/removed.js index 6fea5223a8..c9ccd740a1 100644 --- a/packages/babel-core/src/transformation/file/options/removed.js +++ b/packages/babel-core/src/transformation/file/options/removed.js @@ -2,34 +2,34 @@ export default { "auxiliaryComment": { - "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`" + "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`", }, "blacklist": { - "message": "Put the specific transforms you want in the `plugins` option" + "message": "Put the specific transforms you want in the `plugins` option", }, "breakConfig": { - "message": "This is not a necessary option in Babel 6" + "message": "This is not a necessary option in Babel 6", }, "experimental": { - "message": "Put the specific transforms you want in the `plugins` option" + "message": "Put the specific transforms you want in the `plugins` option", }, "externalHelpers": { - "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/" + "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/", }, "extra": { - "message": "" + "message": "", }, "jsxPragma": { - "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/" + "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/", }, // "keepModuleIdExtensions": { // "message": "" // }, "loose": { - "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option." + "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option.", }, "metadataUsedHelpers": { - "message": "Not required anymore as this is enabled by default" + "message": "Not required anymore as this is enabled by default", }, "modules": { "message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules", @@ -38,15 +38,15 @@ export default { "message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/", }, "optional": { - "message": "Put the specific transforms you want in the `plugins` option" + "message": "Put the specific transforms you want in the `plugins` option", }, "sourceMapName": { - "message": "Use the `sourceMapTarget` option" + "message": "Use the `sourceMapTarget` option", }, "stage": { - "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets" + "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets", }, "whitelist": { - "message": "Put the specific transforms you want in the `plugins` option" - } + "message": "Put the specific transforms you want in the `plugins` option", + }, }; diff --git a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js index d546b9abd5..35dee65312 100644 --- a/packages/babel-core/src/transformation/internal-plugins/block-hoist.js +++ b/packages/babel-core/src/transformation/internal-plugins/block-hoist.js @@ -36,7 +36,7 @@ export default new Plugin({ // Higher priorities should move toward the top. return -1 * priority; }); - } - } - } + }, + }, + }, }); diff --git a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js index 1b50aa759c..ce50d21c01 100644 --- a/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js +++ b/packages/babel-core/src/transformation/internal-plugins/shadow-functions.js @@ -12,7 +12,7 @@ const superVisitor = { node[SUPER_THIS_BOUND] = true; path.replaceWith(t.assignmentExpression("=", this.id, node)); - } + }, }; export default new Plugin({ @@ -27,8 +27,8 @@ export default new Plugin({ if (path.node.name === "arguments") { remap(path, "arguments"); } - } - } + }, + }, }); function shouldShadow(path, shadowPath) { @@ -94,7 +94,7 @@ function remap(path, key) { const cached = fnPath.getData(key); if (cached) return path.replaceWith(cached); - const id = path.scope.generateUidIdentifier(key); + const id = path.scope.generateUidIdentifier(key); fnPath.setData(key, id); diff --git a/packages/babel-core/src/transformation/plugin-pass.js b/packages/babel-core/src/transformation/plugin-pass.js index 1d1d60b01b..5e7ddb205d 100644 --- a/packages/babel-core/src/transformation/plugin-pass.js +++ b/packages/babel-core/src/transformation/plugin-pass.js @@ -6,9 +6,9 @@ export default class PluginPass extends Store { constructor(file: File, plugin: Plugin, options: Object = {}) { super(); this.plugin = plugin; - this.key = plugin.key; - this.file = file; - this.opts = options; + this.key = plugin.key; + this.file = file; + this.opts = options; } key: string; diff --git a/packages/babel-core/src/transformation/plugin.js b/packages/babel-core/src/transformation/plugin.js index 8c24404673..75665c1552 100644 --- a/packages/babel-core/src/transformation/plugin.js +++ b/packages/babel-core/src/transformation/plugin.js @@ -11,13 +11,13 @@ export default class Plugin extends Store { super(); this.initialized = false; - this.raw = Object.assign({}, plugin); - this.key = this.take("name") || key; + this.raw = Object.assign({}, plugin); + this.key = this.take("name") || key; this.manipulateOptions = this.take("manipulateOptions"); - this.post = this.take("post"); - this.pre = this.take("pre"); - this.visitor = this.normaliseVisitor(clone(this.take("visitor")) || {}); + this.post = this.take("post"); + this.pre = this.take("pre"); + this.visitor = this.normaliseVisitor(clone(this.take("visitor")) || {}); } initialized: boolean; diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index 8344bacd54..bf03ff2f46 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -18,7 +18,7 @@ function transformAsync(code, opts) { return { then: function (resolve) { resolve(babel.transform(code, opts)); - } + }, }; } @@ -29,7 +29,7 @@ describe("parser and generator options", function() { }, print: function(ast) { return generator(ast); - } + }, }; function newTransform(string) { @@ -37,11 +37,11 @@ describe("parser and generator options", function() { parserOpts: { parser: recast.parse, plugins: ["flow"], - allowImportExportEverywhere: true + allowImportExportEverywhere: true, }, generatorOpts: { - generator: recast.print - } + generator: recast.print, + }, }); } @@ -56,8 +56,8 @@ describe("parser and generator options", function() { assert.deepEqual(newTransform(experimental).ast, babel.transform(experimental, { parserOpts: { - plugins: ["flow"] - } + plugins: ["flow"], + }, }).ast); assert.equal(newTransform(experimental).code, experimental); @@ -65,18 +65,18 @@ describe("parser and generator options", function() { return babel.transform(string, { plugins: [__dirname + "/../../babel-plugin-syntax-flow"], parserOpts: { - parser: recast.parse + parser: recast.parse, }, generatorOpts: { - generator: recast.print - } + generator: recast.print, + }, }); } assert.deepEqual(newTransformWithPlugins(experimental).ast, babel.transform(experimental, { parserOpts: { - plugins: ["flow"] - } + plugins: ["flow"], + }, }).ast); assert.equal(newTransformWithPlugins(experimental).code, experimental); }); @@ -86,8 +86,8 @@ describe("parser and generator options", function() { assert.notEqual(newTransform(experimental).ast, babel.transform(experimental, { parserOpts: { - allowImportExportEverywhere: true - } + allowImportExportEverywhere: true, + }, }).ast); assert.equal(newTransform(experimental).code, experimental); }); @@ -102,15 +102,15 @@ describe("api", function () { visitor: { Program: function (path) { path.mark("category", "foobar"); - } - } - })] + }, + }, + })], }).marked[0].message, "foobar"); assert.equal(babel.analyse("foobar;", {}, { Program: function (path) { path.mark("category", "foobar"); - } + }, }).marked[0].message, "foobar"); }); @@ -138,7 +138,7 @@ describe("api", function () { return assert.throws( function () { babel.transform("", { - plugins: [__dirname + "/../../babel-plugin-syntax-jsx", false] + plugins: [__dirname + "/../../babel-plugin-syntax-jsx", false], }); }, /TypeError: Falsy value found in plugins/ @@ -148,7 +148,7 @@ describe("api", function () { it("options merge backwards", function () { return transformAsync("", { presets: [__dirname + "/../../babel-preset-es2015"], - plugins: [__dirname + "/../../babel-plugin-syntax-jsx"] + plugins: [__dirname + "/../../babel-plugin-syntax-jsx"], }).then(function (result) { assert.ok(result.options.plugins[0][0].manipulateOptions.toString().indexOf("jsx") >= 0); }); @@ -177,9 +177,9 @@ describe("api", function () { visitor: { "Program|Identifier": function () { calledRaw++; - } - } - })] + }, + }, + })], }); assert.equal(calledRaw, 4); @@ -212,10 +212,10 @@ describe("api", function () { // In case of `passPerPreset` being `true`, the // alias node should still exist. aliasBaseType = alias.right.type; // NumberTypeAnnotation - } - } - }) - ] + }, + }, + }), + ], }; }, @@ -228,9 +228,9 @@ describe("api", function () { plugins: [ require(__dirname + "/../../babel-plugin-syntax-flow"), require(__dirname + "/../../babel-plugin-transform-flow-strip-types"), - ] + ], }; - } + }, ], }); } @@ -246,7 +246,7 @@ describe("api", function () { "", "var x = function x(y) {", " return y;", - "};" + "};", ].join("\n"), result.code); // 2. passPerPreset: false @@ -262,7 +262,7 @@ describe("api", function () { "", "var x = function x(y) {", " return y;", - "};" + "};", ].join("\n"), result.code); }); @@ -276,10 +276,10 @@ describe("api", function () { " _classCallCheck(this, Foo);", "};", "", - "//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZG91dCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUFNLEdBQUcsWUFBSCxHQUFHO3dCQUFILEdBQUciLCJmaWxlIjoidW5kZWZpbmVkIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgRm9vIHt9XG4iXX0=" + "//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0ZG91dCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUFNLEdBQUcsWUFBSCxHQUFHO3dCQUFILEdBQUciLCJmaWxlIjoidW5kZWZpbmVkIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgRm9vIHt9XG4iXX0=", /* eslint-enable max-len */ ].join("\n"), { - sourceMap: true + sourceMap: true, }); assert.deepEqual([ @@ -291,19 +291,19 @@ describe("api", function () { "", "let Foo = function Foo() {", " _classCallCheck(this, Foo);", - "};" + "};", ].join("\n"), result.code); const consumer = new sourceMap.SourceMapConsumer(result.map); assert.deepEqual(consumer.originalPositionFor({ line: 7, - column: 4 + column: 4, }), { name: null, source: "stdout", line: 1, - column: 6 + column: 6, }); }); @@ -330,10 +330,10 @@ describe("api", function () { Program: function (path) { path.unshiftContainer("body", t.expressionStatement(t.identifier("start"))); path.pushContainer("body", t.expressionStatement(t.identifier("end"))); - } - } + }, + }, }; - }] + }], }).then(function (result) { assert.equal(result.code, "/*before*/start;\n/*after*/class Foo {}\n/*before*/end;\n/*after*/"); @@ -350,8 +350,8 @@ describe("api", function () { specifiers: [{ kind: "named", imported: "externalName", - local: "localName" - }] + local: "localName", + }], }); }), @@ -361,8 +361,8 @@ describe("api", function () { imported: ["*"], specifiers: [{ kind: "namespace", - local: "localName2" - }] + local: "localName2", + }], }); }), @@ -373,15 +373,15 @@ describe("api", function () { specifiers: [{ kind: "named", imported: "default", - local: "localName3" - }] + local: "localName3", + }], }); }), transformAsync("import localName from \"./array\";", { resolveModuleSource: function() { return "override-source"; - } + }, }).then(function (result) { assert.deepEqual(result.metadata.modules.imports, [ { @@ -391,15 +391,15 @@ describe("api", function () { { "kind": "named", "imported": "default", - "local": "localName" - } - ] - } + "local": "localName", + }, + ], + }, ]); }), transformAsync("export * as externalName1 from \"external\";", { - plugins: [require("../../babel-plugin-syntax-export-extensions")] + plugins: [require("../../babel-plugin-syntax-export-extensions")], }).then(function (result) { assert.deepEqual(result.metadata.modules.exports, { exported: ["externalName1"], @@ -407,12 +407,12 @@ describe("api", function () { kind: "external-namespace", exported: "externalName1", source: "external", - }] + }], }); }), transformAsync("export externalName2 from \"external\";", { - plugins: [require("../../babel-plugin-syntax-export-extensions")] + plugins: [require("../../babel-plugin-syntax-export-extensions")], }).then(function (result) { assert.deepEqual(result.metadata.modules.exports, { exported: ["externalName2"], @@ -420,8 +420,8 @@ describe("api", function () { kind: "external", local: "externalName2", exported: "externalName2", - source: "external" - }] + source: "external", + }], }); }), @@ -431,8 +431,8 @@ describe("api", function () { specifiers: [{ kind: "local", local: "namedFunction", - exported: "namedFunction" - }] + exported: "namedFunction", + }], }); }), @@ -442,8 +442,8 @@ describe("api", function () { specifiers: [{ kind: "local", local: "foo", - exported: "foo" - }] + exported: "foo", + }], }); }), @@ -453,8 +453,8 @@ describe("api", function () { specifiers: [{ kind: "local", local: "localName", - exported: "externalName3" - }] + exported: "externalName3", + }], }); }), @@ -465,8 +465,8 @@ describe("api", function () { kind: "external", local: "externalName4", exported: "externalName4", - source: "external" - }] + source: "external", + }], }); }), @@ -475,8 +475,8 @@ describe("api", function () { exported: [], specifiers: [{ kind: "external-all", - source: "external" - }] + source: "external", + }], }); }), @@ -486,10 +486,10 @@ describe("api", function () { specifiers: [{ kind: "local", local: "defaultFunction", - exported: "default" - }] + exported: "default", + }], }); - }) + }), ]); }); @@ -497,18 +497,18 @@ describe("api", function () { return Promise.all([ transformAsync("", { ignore: "node_modules", - filename: "/foo/node_modules/bar" + filename: "/foo/node_modules/bar", }).then(assertIgnored), transformAsync("", { ignore: "foo/node_modules", - filename: "/foo/node_modules/bar" + filename: "/foo/node_modules/bar", }).then(assertIgnored), transformAsync("", { ignore: "foo/node_modules/*.bar", - filename: "/foo/node_modules/foo.bar" - }).then(assertIgnored) + filename: "/foo/node_modules/foo.bar", + }).then(assertIgnored), ]); }); @@ -516,33 +516,33 @@ describe("api", function () { return Promise.all([ transformAsync("", { only: "node_modules", - filename: "/foo/node_modules/bar" + filename: "/foo/node_modules/bar", }).then(assertNotIgnored), transformAsync("", { only: "foo/node_modules", - filename: "/foo/node_modules/bar" + filename: "/foo/node_modules/bar", }).then(assertNotIgnored), transformAsync("", { only: "foo/node_modules/*.bar", - filename: "/foo/node_modules/foo.bar" + filename: "/foo/node_modules/foo.bar", }).then(assertNotIgnored), transformAsync("", { only: "node_modules", - filename: "/foo/node_module/bar" + filename: "/foo/node_module/bar", }).then(assertIgnored), transformAsync("", { only: "foo/node_modules", - filename: "/bar/node_modules/foo" + filename: "/bar/node_modules/foo", }).then(assertIgnored), transformAsync("", { only: "foo/node_modules/*.bar", - filename: "/foo/node_modules/bar.foo" - }).then(assertIgnored) + filename: "/foo/node_modules/bar.foo", + }).then(assertIgnored), ]); }); @@ -565,8 +565,8 @@ describe("api", function () { it("default", function () { const result = babel.transform("foo;", { env: { - development: { code: false } - } + development: { code: false }, + }, }); assert.equal(result.code, undefined); @@ -576,8 +576,8 @@ describe("api", function () { process.env.BABEL_ENV = "foo"; const result = babel.transform("foo;", { env: { - foo: { code: false } - } + foo: { code: false }, + }, }); assert.equal(result.code, undefined); }); @@ -586,8 +586,8 @@ describe("api", function () { process.env.NODE_ENV = "foo"; const result = babel.transform("foo;", { env: { - foo: { code: false } - } + foo: { code: false }, + }, }); assert.equal(result.code, undefined); }); @@ -602,7 +602,7 @@ describe("api", function () { return transformAsync(actual, { resolveModuleSource: function (originalSource) { return "resolved/" + originalSource; - } + }, }).then(function (result) { assert.equal(result.code.trim(), expected); }); diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 71df017004..5032973e7d 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -29,48 +29,48 @@ describe("buildConfigChain", function () { it("dir1", function () { const chain = buildConfigChain({ - filename: fixture("dir1", "src.js") + filename: fixture("dir1", "src.js"), }); const expected = [ { options: { plugins: [ - "extended" - ] + "extended", + ], }, alias: fixture("extended.babelrc.json"), loc: fixture("extended.babelrc.json"), - dirname: fixture() + dirname: fixture(), }, { options: { plugins: [ - "root" - ] + "root", + ], }, alias: fixture(".babelrc"), loc: fixture(".babelrc"), - dirname: fixture() + dirname: fixture(), }, { options: { ignore: [ - "root-ignore" - ] + "root-ignore", + ], }, alias: fixture(".babelignore"), loc: fixture(".babelignore"), - dirname: fixture() + dirname: fixture(), }, { options: { - filename: fixture("dir1", "src.js") + filename: fixture("dir1", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("dir1") - } + dirname: fixture("dir1"), + }, ]; assert.deepEqual(chain, expected); @@ -78,38 +78,38 @@ describe("buildConfigChain", function () { it("dir2", function () { const chain = buildConfigChain({ - filename: fixture("dir2", "src.js") + filename: fixture("dir2", "src.js"), }); const expected = [ { options: { plugins: [ - "dir2" - ] + "dir2", + ], }, alias: fixture("dir2", ".babelrc"), loc: fixture("dir2", ".babelrc"), - dirname: fixture("dir2") + dirname: fixture("dir2"), }, { options: { ignore: [ - "root-ignore" - ] + "root-ignore", + ], }, alias: fixture(".babelignore"), loc: fixture(".babelignore"), - dirname: fixture() + dirname: fixture(), }, { options: { - filename: fixture("dir2", "src.js") + filename: fixture("dir2", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("dir2") - } + dirname: fixture("dir2"), + }, ]; assert.deepEqual(chain, expected); @@ -117,38 +117,38 @@ describe("buildConfigChain", function () { it("env - base", function () { const chain = buildConfigChain({ - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }); const expected = [ { options: { plugins: [ - "env-base" - ] + "env-base", + ], }, alias: fixture("env", ".babelrc"), loc: fixture("env", ".babelrc"), - dirname: fixture("env") + dirname: fixture("env"), }, { options: { ignore: [ - "root-ignore" - ] + "root-ignore", + ], }, alias: fixture(".babelignore"), loc: fixture(".babelignore"), - dirname: fixture() + dirname: fixture(), }, { options: { - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("env") - } + dirname: fixture("env"), + }, ]; assert.deepEqual(chain, expected); @@ -158,48 +158,48 @@ describe("buildConfigChain", function () { process.env.NODE_ENV = "foo"; const chain = buildConfigChain({ - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }); const expected = [ { options: { plugins: [ - "env-base" - ] + "env-base", + ], }, alias: fixture("env", ".babelrc"), loc: fixture("env", ".babelrc"), - dirname: fixture("env") + dirname: fixture("env"), }, { options: { plugins: [ - "env-foo" - ] + "env-foo", + ], }, alias: fixture("env", ".babelrc.env.foo"), loc: fixture("env", ".babelrc.env.foo"), - dirname: fixture("env") + dirname: fixture("env"), }, { options: { ignore: [ - "root-ignore" - ] + "root-ignore", + ], }, alias: fixture(".babelignore"), loc: fixture(".babelignore"), - dirname: fixture() + dirname: fixture(), }, { options: { - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("env") - } + dirname: fixture("env"), + }, ]; assert.deepEqual(chain, expected); @@ -210,48 +210,48 @@ describe("buildConfigChain", function () { process.env.NODE_ENV = "bar"; const chain = buildConfigChain({ - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }); const expected = [ { options: { plugins: [ - "env-base" - ] + "env-base", + ], }, alias: fixture("env", ".babelrc"), loc: fixture("env", ".babelrc"), - dirname: fixture("env") + dirname: fixture("env"), }, { options: { plugins: [ - "env-bar" - ] + "env-bar", + ], }, alias: fixture("env", ".babelrc.env.bar"), loc: fixture("env", ".babelrc.env.bar"), - dirname: fixture("env") + dirname: fixture("env"), }, { options: { ignore: [ - "root-ignore" - ] + "root-ignore", + ], }, alias: fixture(".babelignore"), loc: fixture(".babelignore"), - dirname: fixture() + dirname: fixture(), }, { options: { - filename: fixture("env", "src.js") + filename: fixture("env", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("env") - } + dirname: fixture("env"), + }, ]; assert.deepEqual(chain, expected); @@ -262,34 +262,34 @@ describe("buildConfigChain", function () { process.env.NODE_ENV = "foo"; const chain = buildConfigChain({ - filename: fixture("pkg", "src.js") + filename: fixture("pkg", "src.js"), }); const expected = [ { options: { - plugins: ["pkg-plugin"] + plugins: ["pkg-plugin"], }, alias: fixture("pkg", "package.json"), loc: fixture("pkg", "package.json"), - dirname: fixture("pkg") + dirname: fixture("pkg"), }, { options: { - ignore: ["pkg-ignore"] + ignore: ["pkg-ignore"], }, alias: fixture("pkg", ".babelignore"), loc: fixture("pkg", ".babelignore"), - dirname: fixture("pkg") + dirname: fixture("pkg"), }, { options: { - filename: fixture("pkg", "src.js") + filename: fixture("pkg", "src.js"), }, alias: "base", loc: "base", - dirname: fixture("pkg") - } + dirname: fixture("pkg"), + }, ]; assert.deepEqual(chain, expected); diff --git a/packages/babel-core/test/evaluation.js b/packages/babel-core/test/evaluation.js index f7ee8ef479..ca86f51839 100644 --- a/packages/babel-core/test/evaluation.js +++ b/packages/babel-core/test/evaluation.js @@ -14,7 +14,7 @@ describe("evaluation", function () { }; traverse(parse(code, { - plugins: ["*"] + plugins: ["*"], }), visitor); }); } diff --git a/packages/babel-core/test/get-possible-preset-names.js b/packages/babel-core/test/get-possible-preset-names.js index df32d037ee..40052fdfbb 100644 --- a/packages/babel-core/test/get-possible-preset-names.js +++ b/packages/babel-core/test/get-possible-preset-names.js @@ -10,13 +10,13 @@ describe("getPossiblePresetNames", function () { assert.deepEqual(getPossiblePresetNames("@babel/es2015"), [ "babel-preset-@babel/es2015", "@babel/es2015", - "@babel/babel-preset-es2015" + "@babel/babel-preset-es2015", ]); assert.deepEqual(getPossiblePresetNames("@babel/react/optimizations"), [ "babel-preset-@babel/react/optimizations", "@babel/react/optimizations", - "@babel/babel-preset-react/optimizations" + "@babel/babel-preset-react/optimizations", ]); }); }); diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index 665a514668..a38436d197 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -19,7 +19,7 @@ describe("option-manager", () => { () => { const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ - "randomOption": true + "randomOption": true, }); }, /Unknown option: base.randomOption/ @@ -32,7 +32,7 @@ describe("option-manager", () => { const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ "auxiliaryComment": true, - "blacklist": true + "blacklist": true, }); }, // eslint-disable-next-line max-len @@ -45,7 +45,7 @@ describe("option-manager", () => { () => { const opt = new OptionManager(new Logger(null, "unknown")); opt.init({ - "presets": [path.join(__dirname, "fixtures/option-manager/not-a-preset")] + "presets": [path.join(__dirname, "fixtures/option-manager/not-a-preset")], }); }, /While processing preset: .*option-manager(?:\/|\\\\)not-a-preset\.js/ @@ -58,7 +58,7 @@ describe("option-manager", () => { it(name, function () { const opt = new OptionManager(new Logger(null, "unknown")); const options = opt.init({ - "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)] + "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)], }); assert.equal(true, Array.isArray(options.plugins)); @@ -70,7 +70,7 @@ describe("option-manager", () => { it(name, function () { const opt = new OptionManager(new Logger(null, "unknown")); assert.throws(() => opt.init({ - "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)] + "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)], }), msg); }); } diff --git a/packages/babel-core/test/path.js b/packages/babel-core/test/path.js index 7628e1033f..f84d7eef8e 100644 --- a/packages/babel-core/test/path.js +++ b/packages/babel-core/test/path.js @@ -11,9 +11,9 @@ describe("traversal path", function () { visitor: { FunctionDeclaration: function (path) { path.replaceWithSourceString("console.whatever()"); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("console.whatever();"); @@ -32,13 +32,13 @@ describe("traversal path", function () { type: "ReturnStatement", argument: { type: "BooleanLiteral", - value: true - } - }] + value: true, + }, + }], }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("var fn = () => {\n return true;\n};"); @@ -53,11 +53,11 @@ describe("traversal path", function () { ArrowFunctionExpression: function (path) { path.get("body").replaceWith({ type: "BooleanLiteral", - value: true + value: true, }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("var fn = () => true;"); @@ -77,13 +77,13 @@ describe("traversal path", function () { type: "VariableDeclarator", id: { type: "Identifier", - name: "KEY" - } - }] + name: "KEY", + }, + }], }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("for (var KEY in right);"); @@ -98,11 +98,11 @@ describe("traversal path", function () { ForInStatement: function (path) { path.get("left").replaceWith({ type: "Identifier", - name: "KEY" + name: "KEY", }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("for (KEY in right);"); @@ -122,13 +122,13 @@ describe("traversal path", function () { type: "VariableDeclarator", id: { type: "Identifier", - name: "KEY" - } - }] + name: "KEY", + }, + }], }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("for (var KEY;;);"); @@ -143,11 +143,11 @@ describe("traversal path", function () { ForStatement: function (path) { path.get("init").replaceWith({ type: "Identifier", - name: "KEY" + name: "KEY", }); - } - } - })] + }, + }, + })], }).code; chai.expect(actualCode).to.be.equal("for (KEY;;);"); diff --git a/packages/babel-generator/src/generators/expressions.js b/packages/babel-generator/src/generators/expressions.js index 8ba9491071..a3600f83b5 100644 --- a/packages/babel-generator/src/generators/expressions.js +++ b/packages/babel-generator/src/generators/expressions.js @@ -188,7 +188,7 @@ export function BindExpression(node: Object) { export { AssignmentExpression as BinaryExpression, - AssignmentExpression as LogicalExpression + AssignmentExpression as LogicalExpression, }; export function MemberExpression(node: Object) { diff --git a/packages/babel-generator/src/generators/flow.js b/packages/babel-generator/src/generators/flow.js index 0d90aa3e1c..279502b928 100644 --- a/packages/babel-generator/src/generators/flow.js +++ b/packages/babel-generator/src/generators/flow.js @@ -280,7 +280,7 @@ export function ObjectTypeAnnotation(node: Object) { this.token(","); this.space(); } - } + }, }); this.space(); diff --git a/packages/babel-generator/src/generators/methods.js b/packages/babel-generator/src/generators/methods.js index 2ad6d41ffb..4dcc71a251 100644 --- a/packages/babel-generator/src/generators/methods.js +++ b/packages/babel-generator/src/generators/methods.js @@ -7,7 +7,7 @@ export function _params(node: Object) { iterator: (node) => { if (node.optional) this.token("?"); this.print(node.typeAnnotation, node); - } + }, }); this.token(")"); @@ -18,7 +18,7 @@ export function _params(node: Object) { export function _method(node: Object) { const kind = node.kind; - const key = node.key; + const key = node.key; if (kind === "method" || kind === "init") { if (node.generator) { diff --git a/packages/babel-generator/src/generators/statements.js b/packages/babel-generator/src/generators/statements.js index 574ef5c249..8aee284a6d 100644 --- a/packages/babel-generator/src/generators/statements.js +++ b/packages/babel-generator/src/generators/statements.js @@ -133,9 +133,9 @@ function buildLabelStatement(prefix, key = "label") { } export const ContinueStatement = buildLabelStatement("continue"); -export const ReturnStatement = buildLabelStatement("return", "argument"); -export const BreakStatement = buildLabelStatement("break"); -export const ThrowStatement = buildLabelStatement("throw", "argument"); +export const ReturnStatement = buildLabelStatement("return", "argument"); +export const BreakStatement = buildLabelStatement("break"); +export const ThrowStatement = buildLabelStatement("throw", "argument"); export function LabeledStatement(node: Object) { this.print(node.label, node); @@ -190,7 +190,7 @@ export function SwitchStatement(node: Object) { indent: true, addNewlines(leading, cas) { if (!leading && node.cases[node.cases.length - 1] === cas) return -1; - } + }, }); this.token("}"); diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index c3d0bc359d..9895324062 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -69,7 +69,7 @@ export function ObjectProperty(node: Object) { export function ArrayExpression(node: Object) { const elems = node.elements; - const len = elems.length; + const len = elems.length; this.token("["); this.printInnerComments(node); @@ -129,7 +129,7 @@ export function StringLiteral(node: Object, parent: Object) { // ensure the output is ASCII-safe const opts = { quotes: t.isJSX(parent) ? "double" : this.format.quotes, - wrap: true + wrap: true, }; if (this.format.jsonCompatibleStrings) { opts.json = true; diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index f48e7e83d3..d8fbaf2a49 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -63,8 +63,8 @@ function normalizeOptions(code, opts, tokens): Format { indent: { adjustMultilineComment: true, style: style, - base: 0 - } + base: 0, + }, }; if (format.minified) { @@ -102,7 +102,7 @@ function findCommonStringDelimiter(code, tokens) { const occurences = { single: 0, - double: 0 + double: 0, }; let checked = 0; diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 948198f7cb..b469ef1703 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -24,7 +24,7 @@ const PRECEDENCE = { "*": 9, "/": 9, "%": 9, - "**": 10 + "**": 10, }; export function NullableTypeAnnotation(node: Object, parent: Object): boolean { @@ -64,7 +64,7 @@ export function Binary(node: Object, parent: Object): boolean { } if (t.isBinary(parent)) { - const parentOp = parent.operator; + const parentOp = parent.operator; const parentPos = PRECEDENCE[parentOp]; const nodeOp = node.operator; @@ -220,7 +220,7 @@ export function AssignmentExpression(node: Object): boolean { // in statement. function isFirstInStatement(printStack: Array, { considerArrow = false, - considerDefaultExports = false + considerDefaultExports = false, } = {}): boolean { let i = printStack.length - 1; let node = printStack[i]; diff --git a/packages/babel-generator/src/node/whitespace.js b/packages/babel-generator/src/node/whitespace.js index 36ac02cf47..11dce425e6 100644 --- a/packages/babel-generator/src/node/whitespace.js +++ b/packages/babel-generator/src/node/whitespace.js @@ -71,7 +71,7 @@ export const nodes = { if ((state.hasCall && state.hasHelper) || state.hasFunction) { return { before: state.hasFunction, - after: true + after: true, }; } }, @@ -82,7 +82,7 @@ export const nodes = { SwitchCase(node: Object, parent: Object): ?WhitespaceObject { return { - before: node.consequent.length || parent.cases[0] === node + before: node.consequent.length || parent.cases[0] === node, }; }, @@ -93,7 +93,7 @@ export const nodes = { LogicalExpression(node: Object): ?WhitespaceObject { if (t.isFunction(node.left) || t.isFunction(node.right)) { return { - after: true + after: true, }; } }, @@ -105,7 +105,7 @@ export const nodes = { Literal(node: Object): ?WhitespaceObject { if (node.value === "use strict") { return { - after: true + after: true, }; } }, @@ -118,7 +118,7 @@ export const nodes = { if (t.isFunction(node.callee) || isHelper(node)) { return { before: true, - after: true + after: true, }; } }, @@ -140,7 +140,7 @@ export const nodes = { if (enabled) { return { before: true, - after: true + after: true, }; } } @@ -154,10 +154,10 @@ export const nodes = { if (t.isBlockStatement(node.consequent)) { return { before: true, - after: true + after: true, }; } - } + }, }; /** @@ -169,7 +169,7 @@ nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node: Object, parent): ?WhitespaceObject { if (parent.properties[0] === node) { return { - before: true + before: true, }; } }; @@ -202,7 +202,7 @@ export const list = { ObjectExpression(node: Object): Array { return node.properties; - } + }, }; /** @@ -215,7 +215,7 @@ export const list = { ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], - ["TryStatement", true] + ["TryStatement", true], ].forEach(function ([type, amounts]) { if (typeof amounts === "boolean") { amounts = { after: amounts, before: amounts }; diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index f5557d54f9..7a7331e06c 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -295,7 +295,7 @@ export default class Printer { startTerminatorless(): Object { return this._parenPushNewlineState = { - printed: false + printed: false, }; } @@ -370,7 +370,7 @@ export default class Printer { if (comment) { this._printComment({ type: "CommentBlock", - value: comment + value: comment, }); } } @@ -383,7 +383,7 @@ export default class Printer { if (comment) { this._printComment({ type: "CommentBlock", - value: comment + value: comment, }); } } diff --git a/packages/babel-generator/src/whitespace.js b/packages/babel-generator/src/whitespace.js index 6a055e02e2..aabe0d123a 100644 --- a/packages/babel-generator/src/whitespace.js +++ b/packages/babel-generator/src/whitespace.js @@ -5,7 +5,7 @@ export default class Whitespace { constructor(tokens) { this.tokens = tokens; - this.used = {}; + this.used = {}; } /** @@ -59,7 +59,7 @@ export default class Whitespace { if (!endToken || !endToken.loc) return 0; const start = startToken ? startToken.loc.end.line : 1; - const end = endToken.loc.start.line; + const end = endToken.loc.start.line; let lines = 0; for (let line = start; line < end; line++) { diff --git a/packages/babel-generator/test/index.js b/packages/babel-generator/test/index.js index 4a9d52aa36..c0e0ec4584 100644 --- a/packages/babel-generator/test/index.js +++ b/packages/babel-generator/test/index.js @@ -24,7 +24,7 @@ describe("generation", function () { it("multiple sources", function () { const sources = { "a.js": "function hi (msg) { console.log(msg); }\n", - "b.js": "hi('hello');\n" + "b.js": "hi('hello');\n", }; const parsed = Object.keys(sources).reduce(function (_parsed, filename) { _parsed[filename] = parse(sources[filename], { sourceFilename: filename }); @@ -36,8 +36,8 @@ describe("generation", function () { "program": { "type": "Program", "sourceType": "module", - "body": [].concat(parsed["a.js"].program.body, parsed["b.js"].program.body) - } + "body": [].concat(parsed["a.js"].program.body, parsed["b.js"].program.body), + }, }; const generated = generate(combinedAst, { sourceMaps: true }, sources); @@ -54,8 +54,8 @@ describe("generation", function () { ], sourcesContent: [ "function hi (msg) { console.log(msg); }\n", - "hi('hello');\n" - ] + "hi('hello');\n", + ], }, "sourcemap was incorrectly generated"); chai.expect(generated.rawMappings).to.deep.equal([ @@ -144,7 +144,7 @@ describe("generation", function () { const generated = generate(ast, { filename: "inline", sourceFileName: "inline", - sourceMaps: true + sourceMaps: true, }, code); chai.expect(generated.map).to.deep.equal({ @@ -152,7 +152,7 @@ describe("generation", function () { sources: ["inline"], names: ["foo", "bar" ], mappings: "AAAA,SAASA,IAAT,GAAe;AAAEC;AAAM", - sourcesContent: [ "function foo() { bar; }\n" ] + sourcesContent: [ "function foo() { bar; }\n" ], }, "sourcemap was incorrectly generated"); chai.expect(generated.rawMappings).to.deep.equal([ @@ -240,7 +240,7 @@ describe("programmatic generation", function() { assert.equal(output, [ "{", " \"use strict\";", - "}" + "}", ].join("\n")); }); diff --git a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js index b3e41d9f7e..1b03a6681a 100644 --- a/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js +++ b/packages/babel-helper-builder-binary-assignment-operator-visitor/src/index.js @@ -22,7 +22,7 @@ export default function (opts: { const expr = path.node.expression; if (!isAssignment(expr)) return; - const nodes = []; + const nodes = []; const exploded = explode(expr.left, nodes, file, path.scope, true); nodes.push(t.expressionStatement( @@ -36,7 +36,7 @@ export default function (opts: { const { node, scope } = path; if (!isAssignment(node)) return; - const nodes = []; + const nodes = []; const exploded = explode(node.left, nodes, file, scope); nodes.push(buildAssignment(exploded.ref, opts.build(exploded.uid, node.right))); path.replaceWithMultiple(nodes); diff --git a/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js b/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js index 335f2e50fa..ae5c1772cb 100644 --- a/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js +++ b/packages/babel-helper-builder-conditional-assignment-operator-visitor/src/index.js @@ -35,7 +35,7 @@ export default function ( const node = path.node; if (!opts.is(node, file)) return; - const nodes = []; + const nodes = []; const exploded = explode(node.left, nodes, file, path.scope); nodes.push(t.logicalExpression( diff --git a/packages/babel-helper-builder-react-jsx/src/index.js b/packages/babel-helper-builder-react-jsx/src/index.js index 86d66d2b4d..13d205fd4b 100644 --- a/packages/babel-helper-builder-react-jsx/src/index.js +++ b/packages/babel-helper-builder-react-jsx/src/index.js @@ -28,7 +28,7 @@ export default function (opts) { } path.replaceWith(t.inherits(callExpr, path.node)); - } + }, }; return visitor; @@ -92,7 +92,7 @@ export default function (opts) { const state: ElementState = { tagExpr: tagExpr, tagName: tagName, - args: args + args: args, }; if (opts.pre) { diff --git a/packages/babel-helper-call-delegate/src/index.js b/packages/babel-helper-call-delegate/src/index.js index 653a48b172..fdf05257ce 100644 --- a/packages/babel-helper-call-delegate/src/index.js +++ b/packages/babel-helper-call-delegate/src/index.js @@ -15,7 +15,7 @@ const visitor = { Function(path) { path.skip(); - } + }, }; export default function (path: NodePath, scope = path.scope) { @@ -23,14 +23,14 @@ export default function (path: NodePath, scope = path.scope) { const container = t.functionExpression(null, [], node.body, node.generator, node.async); let callee = container; - let args = []; + let args = []; // todo: only hoist if necessary hoistVariables(path, (id) => scope.push({ id })); const state = { foundThis: false, - foundArguments: false + foundArguments: false, }; path.traverse(visitor, state); diff --git a/packages/babel-helper-explode-assignable-expression/src/index.js b/packages/babel-helper-explode-assignable-expression/src/index.js index 04052f5e34..60f4940bb8 100644 --- a/packages/babel-helper-explode-assignable-expression/src/index.js +++ b/packages/babel-helper-explode-assignable-expression/src/index.js @@ -33,7 +33,7 @@ function getObjRef(node, nodes, file, scope) { const temp = scope.generateUidIdentifierBasedOnNode(ref); nodes.push(t.variableDeclaration("var", [ - t.variableDeclarator(temp, ref) + t.variableDeclarator(temp, ref), ])); return temp; } @@ -45,7 +45,7 @@ function getPropRef(node, nodes, file, scope) { const temp = scope.generateUidIdentifierBasedOnNode(prop); nodes.push(t.variableDeclaration("var", [ - t.variableDeclarator(temp, prop) + t.variableDeclarator(temp, prop), ])); return temp; } @@ -80,6 +80,6 @@ export default function ( return { uid: uid, - ref: ref + ref: ref, }; } diff --git a/packages/babel-helper-fixtures/src/index.js b/packages/babel-helper-fixtures/src/index.js index 598937c51b..4b905cc7cd 100644 --- a/packages/babel-helper-fixtures/src/index.js +++ b/packages/babel-helper-fixtures/src/index.js @@ -64,7 +64,7 @@ export default function get(entryLoc): Array { options: clone(rootOpts), tests: [], title: humanize(suiteName), - filename: entryLoc + "/" + suiteName + filename: entryLoc + "/" + suiteName, }; assertDirectory(suite.filename); @@ -80,11 +80,11 @@ export default function get(entryLoc): Array { function push(taskName, taskDir) { const actualLocAlias = suiteName + "/" + taskName + "/actual.js"; let expectLocAlias = suiteName + "/" + taskName + "/expected.js"; - const execLocAlias = suiteName + "/" + taskName + "/exec.js"; + const execLocAlias = suiteName + "/" + taskName + "/exec.js"; const actualLoc = taskDir + "/actual.js"; let expectLoc = taskDir + "/expected.js"; - let execLoc = taskDir + "/exec.js"; + let execLoc = taskDir + "/exec.js"; if (fs.statSync(taskDir).isFile()) { const ext = path.extname(taskDir); @@ -121,8 +121,8 @@ export default function get(entryLoc): Array { expect: { loc: expectLoc, code: readFile(expectLoc), - filename: expectLocAlias - } + filename: expectLocAlias, + }, }; // traceur checks diff --git a/packages/babel-helper-function-name/src/index.js b/packages/babel-helper-function-name/src/index.js index 1c38e531ab..9783c6fc1a 100644 --- a/packages/babel-helper-function-name/src/index.js +++ b/packages/babel-helper-function-name/src/index.js @@ -42,7 +42,7 @@ const visitor = { state.selfReference = true; path.stop(); - } + }, }; function wrap(state, method, id, scope) { @@ -60,7 +60,7 @@ function wrap(state, method, id, scope) { const template = build({ FUNCTION: method, FUNCTION_ID: id, - FUNCTION_KEY: scope.generateUidIdentifier(id.name) + FUNCTION_KEY: scope.generateUidIdentifier(id.name), }).expression; template.callee._skipModulesRemap = true; @@ -82,10 +82,10 @@ function wrap(state, method, id, scope) { function visit(node, name, scope) { const state = { selfAssignment: false, - selfReference: false, - outerDeclar: scope.getBindingIdentifier(name), - references: [], - name: name + selfReference: false, + outerDeclar: scope.getBindingIdentifier(name), + references: [], + name: name, }; // check to see if we have a local binding of the id we're setting inside of diff --git a/packages/babel-helper-hoist-variables/src/index.js b/packages/babel-helper-hoist-variables/src/index.js index dafcc98ca8..ca5e640600 100644 --- a/packages/babel-helper-hoist-variables/src/index.js +++ b/packages/babel-helper-hoist-variables/src/index.js @@ -37,7 +37,7 @@ const visitor = { } else { path.replaceWithMultiple(nodes); } - } + }, }; export default function (path, emit: Function, kind: "var" | "let" = "var") { diff --git a/packages/babel-helper-remap-async-to-generator/src/for-await.js b/packages/babel-helper-remap-async-to-generator/src/for-await.js index 77b7738b7c..c9b638283b 100644 --- a/packages/babel-helper-remap-async-to-generator/src/for-await.js +++ b/packages/babel-helper-remap-async-to-generator/src/for-await.js @@ -51,7 +51,7 @@ const forAwaitVisitor = { if (t.isIdentifier(callee) && callee.name === "AWAIT" && !replacements.AWAIT) { path.replaceWith(path.node.arguments[0]); } - } + }, }; export default function (path, helpers) { @@ -68,7 +68,7 @@ export default function (path, helpers) { } else if (t.isVariableDeclaration(left)) { // for await (let i of test) declar = t.variableDeclaration(left.kind, [ - t.variableDeclarator(left.declarations[0].id, stepValue) + t.variableDeclarator(left.declarations[0].id, stepValue), ]); } @@ -83,7 +83,7 @@ export default function (path, helpers) { OBJECT: node.right, STEP_VALUE: stepValue, STEP_KEY: stepKey, - AWAIT: helpers.wrapAwait + AWAIT: helpers.wrapAwait, }); // remove generator function wrapper @@ -101,6 +101,6 @@ export default function (path, helpers) { replaceParent: isLabeledParent, node: template, declar, - loop + loop, }; } diff --git a/packages/babel-helper-remap-async-to-generator/src/index.js b/packages/babel-helper-remap-async-to-generator/src/index.js index 5cdf041f30..612fe18fbf 100644 --- a/packages/babel-helper-remap-async-to-generator/src/index.js +++ b/packages/babel-helper-remap-async-to-generator/src/index.js @@ -47,7 +47,7 @@ const awaitVisitor = { const build = rewriteForAwait(path, { getAsyncIterator: file.addHelper("asyncIterator"), - wrapAwait + wrapAwait, }); const { declar, loop } = build; @@ -73,7 +73,7 @@ const awaitVisitor = { } else { path.replaceWithMultiple(build.node); } - } + }, }; @@ -89,7 +89,7 @@ function classOrObjectMethod(path: NodePath, callId: Object) { t.returnStatement(t.callExpression( t.callExpression(callId, [container]), [] - )) + )), ]; // Regardless of whether or not the wrapped function is a an async method @@ -142,7 +142,7 @@ function plainFunction(path: NodePath, callId: Object) { t.variableDeclarator( t.identifier(asyncFnId.name), t.callExpression(container, []) - ) + ), ]); declar._blockHoist = true; @@ -156,7 +156,7 @@ function plainFunction(path: NodePath, callId: Object) { t.exportSpecifier( t.identifier(asyncFnId.name), t.identifier("default") - ) + ), ] ) ); @@ -170,7 +170,7 @@ function plainFunction(path: NodePath, callId: Object) { nameFunction({ node: retFunction, parent: path.parent, - scope: path.scope + scope: path.scope, }); } @@ -192,7 +192,7 @@ export default function (path: NodePath, file: Object, helpers: Object) { } path.traverse(awaitVisitor, { file, - wrapAwait: helpers.wrapAwait + wrapAwait: helpers.wrapAwait, }); if (path.isClassMethod() || path.isObjectMethod()) { diff --git a/packages/babel-helper-replace-supers/src/index.js b/packages/babel-helper-replace-supers/src/index.js index 7fa593bb36..2a88d5e296 100644 --- a/packages/babel-helper-replace-supers/src/index.js +++ b/packages/babel-helper-replace-supers/src/index.js @@ -38,7 +38,7 @@ function getPrototypeOfExpression(objectRef, isStatic) { t.callExpression( t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [ - targetRef + targetRef, ] ), ); @@ -90,26 +90,26 @@ const visitor = { path.replaceWith(result); } } - } + }, }; export default class ReplaceSupers { constructor(opts: Object, inClass?: boolean = false) { this.forceSuperMemoisation = opts.forceSuperMemoisation; - this.methodPath = opts.methodPath; - this.methodNode = opts.methodNode; - this.superRef = opts.superRef; - this.isStatic = opts.isStatic; - this.hasSuper = false; - this.inClass = inClass; - this.isLoose = opts.isLoose; - this.scope = this.methodPath.scope; - this.file = opts.file; - this.opts = opts; + this.methodPath = opts.methodPath; + this.methodNode = opts.methodNode; + this.superRef = opts.superRef; + this.isStatic = opts.isStatic; + this.hasSuper = false; + this.inClass = inClass; + this.isLoose = opts.isLoose; + this.scope = this.methodPath.scope; + this.file = opts.file; + this.opts = opts; this.bareSupers = []; - this.returns = []; - this.thises = []; + this.returns = []; + this.thises = []; } forceSuperMemoisation: boolean; @@ -154,7 +154,7 @@ export default class ReplaceSupers { getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), value, - t.thisExpression() + t.thisExpression(), ] ); } @@ -174,7 +174,7 @@ export default class ReplaceSupers { [ getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), - t.thisExpression() + t.thisExpression(), ] ); } @@ -185,7 +185,7 @@ export default class ReplaceSupers { getLooseSuperProperty(id: Object, parent: Object) { const methodNode = this.methodNode; - const superRef = this.superRef || t.identifier("Function"); + const superRef = this.superRef || t.identifier("Function"); if (parent.property === id) { return; @@ -224,10 +224,10 @@ export default class ReplaceSupers { ref = ref || path.scope.generateUidIdentifier("ref"); return [ t.variableDeclaration("var", [ - t.variableDeclarator(ref, node.left) + t.variableDeclarator(ref, node.left), ]), t.expressionStatement(t.assignmentExpression("=", node.left, - t.binaryExpression(node.operator[0], ref, node.right))) + t.binaryExpression(node.operator[0], ref, node.right))), ]; } } diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 6c559e7f8f..2b6d1272c4 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -118,8 +118,8 @@ function wrapPackagesArray(type, names, optionsDir) { function run(task) { const actual = task.actual; const expect = task.expect; - const exec = task.exec; - const opts = task.options; + const exec = task.exec; + const opts = task.options; const optionsDir = task.optionsDir; function getOpts(self) { @@ -218,8 +218,8 @@ export default function ( defaults(task.options, { filenameRelative: task.expect.filename, - sourceFileName: task.actual.filename, - sourceMapTarget: task.expect.filename, + sourceFileName: task.actual.filename, + sourceMapTarget: task.expect.filename, suppressDeprecationMessages: true, babelrc: false, sourceMap: !!(task.sourceMappings || task.sourceMap), diff --git a/packages/babel-messages/src/index.js b/packages/babel-messages/src/index.js index e6f94cab3a..aefd7d46a0 100644 --- a/packages/babel-messages/src/index.js +++ b/packages/babel-messages/src/index.js @@ -40,7 +40,7 @@ export const MESSAGES = { pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3", pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3", pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4", - pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3" + pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3", }; /** diff --git a/packages/babel-plugin-check-es2015-constants/src/index.js b/packages/babel-plugin-check-es2015-constants/src/index.js index b090052bf5..ccc79b1b16 100644 --- a/packages/babel-plugin-check-es2015-constants/src/index.js +++ b/packages/babel-plugin-check-es2015-constants/src/index.js @@ -11,6 +11,6 @@ export default function ({ messages }) { } } }, - } + }, }; } diff --git a/packages/babel-plugin-external-helpers/src/index.js b/packages/babel-plugin-external-helpers/src/index.js index 2103ae9131..5bc3235f86 100644 --- a/packages/babel-plugin-external-helpers/src/index.js +++ b/packages/babel-plugin-external-helpers/src/index.js @@ -2,6 +2,6 @@ export default function ({ types: t }) { return { pre(file) { file.set("helpersNamespace", t.identifier("babelHelpers")); - } + }, }; } diff --git a/packages/babel-plugin-syntax-async-functions/src/index.js b/packages/babel-plugin-syntax-async-functions/src/index.js index a95134d839..11939db7dd 100644 --- a/packages/babel-plugin-syntax-async-functions/src/index.js +++ b/packages/babel-plugin-syntax-async-functions/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("asyncFunctions"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-async-generators/src/index.js b/packages/babel-plugin-syntax-async-generators/src/index.js index 4064178ff1..9bccbfa57a 100644 --- a/packages/babel-plugin-syntax-async-generators/src/index.js +++ b/packages/babel-plugin-syntax-async-generators/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("asyncGenerators"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-class-properties/src/index.js b/packages/babel-plugin-syntax-class-properties/src/index.js index d9ba5cf12f..481b7be1e8 100644 --- a/packages/babel-plugin-syntax-class-properties/src/index.js +++ b/packages/babel-plugin-syntax-class-properties/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("classProperties"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-decorators/src/index.js b/packages/babel-plugin-syntax-decorators/src/index.js index db7392f158..8bd18d37b7 100644 --- a/packages/babel-plugin-syntax-decorators/src/index.js +++ b/packages/babel-plugin-syntax-decorators/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("decorators"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-do-expressions/src/index.js b/packages/babel-plugin-syntax-do-expressions/src/index.js index 469b32173e..bb09f4c9f5 100644 --- a/packages/babel-plugin-syntax-do-expressions/src/index.js +++ b/packages/babel-plugin-syntax-do-expressions/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("doExpressions"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-dynamic-import/src/index.js b/packages/babel-plugin-syntax-dynamic-import/src/index.js index 729c741629..ebcaaa4a19 100644 --- a/packages/babel-plugin-syntax-dynamic-import/src/index.js +++ b/packages/babel-plugin-syntax-dynamic-import/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("dynamicImport"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-exponentiation-operator/src/index.js b/packages/babel-plugin-syntax-exponentiation-operator/src/index.js index 943542f771..a8001e291c 100644 --- a/packages/babel-plugin-syntax-exponentiation-operator/src/index.js +++ b/packages/babel-plugin-syntax-exponentiation-operator/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("exponentiationOperator"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-export-extensions/src/index.js b/packages/babel-plugin-syntax-export-extensions/src/index.js index 8bc33ab44d..b2a6727fce 100644 --- a/packages/babel-plugin-syntax-export-extensions/src/index.js +++ b/packages/babel-plugin-syntax-export-extensions/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("exportExtensions"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-flow/src/index.js b/packages/babel-plugin-syntax-flow/src/index.js index ac230f4a25..01890b3618 100644 --- a/packages/babel-plugin-syntax-flow/src/index.js +++ b/packages/babel-plugin-syntax-flow/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("flow"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-function-bind/src/index.js b/packages/babel-plugin-syntax-function-bind/src/index.js index 2fdf90ffb0..3f05d86ff4 100644 --- a/packages/babel-plugin-syntax-function-bind/src/index.js +++ b/packages/babel-plugin-syntax-function-bind/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("functionBind"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-function-sent/src/index.js b/packages/babel-plugin-syntax-function-sent/src/index.js index b79f1e04fc..f336b24077 100644 --- a/packages/babel-plugin-syntax-function-sent/src/index.js +++ b/packages/babel-plugin-syntax-function-sent/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("functionSent"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-jsx/src/index.js b/packages/babel-plugin-syntax-jsx/src/index.js index 44e80e966a..e7d1697f3d 100644 --- a/packages/babel-plugin-syntax-jsx/src/index.js +++ b/packages/babel-plugin-syntax-jsx/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("jsx"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-object-rest-spread/src/index.js b/packages/babel-plugin-syntax-object-rest-spread/src/index.js index 7792d54dd6..5353e63eed 100644 --- a/packages/babel-plugin-syntax-object-rest-spread/src/index.js +++ b/packages/babel-plugin-syntax-object-rest-spread/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("objectRestSpread"); - } + }, }; } diff --git a/packages/babel-plugin-syntax-trailing-function-commas/src/index.js b/packages/babel-plugin-syntax-trailing-function-commas/src/index.js index d50ddd959c..29d5031933 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/src/index.js +++ b/packages/babel-plugin-syntax-trailing-function-commas/src/index.js @@ -2,6 +2,6 @@ export default function () { return { manipulateOptions(opts, parserOpts) { parserOpts.plugins.push("trailingFunctionCommas"); - } + }, }; } diff --git a/packages/babel-plugin-transform-async-generator-functions/src/index.js b/packages/babel-plugin-transform-async-generator-functions/src/index.js index de09cfed52..ebd5903e1d 100644 --- a/packages/babel-plugin-transform-async-generator-functions/src/index.js +++ b/packages/babel-plugin-transform-async-generator-functions/src/index.js @@ -12,9 +12,9 @@ export default function ({ types: t }) { const callee = state.addHelper("asyncGeneratorDelegate"); node.argument = t.callExpression(callee, [ t.callExpression(state.addHelper("asyncIterator"), [node.argument]), - t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("await")) + t.memberExpression(state.addHelper("asyncGenerator"), t.identifier("await")), ]); - } + }, }; return { @@ -29,9 +29,9 @@ export default function ({ types: t }) { wrapAsync: t.memberExpression( state.addHelper("asyncGenerator"), t.identifier("wrap")), wrapAwait: t.memberExpression( - state.addHelper("asyncGenerator"), t.identifier("await")) + state.addHelper("asyncGenerator"), t.identifier("await")), }); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-async-to-generator/src/index.js b/packages/babel-plugin-transform-async-to-generator/src/index.js index b6c1542dfd..73caf1bebe 100644 --- a/packages/babel-plugin-transform-async-to-generator/src/index.js +++ b/packages/babel-plugin-transform-async-to-generator/src/index.js @@ -10,9 +10,9 @@ export default function () { if (!path.node.async || path.node.generator) return; remapAsyncToGenerator(path, state.file, { - wrapAsync: state.addHelper("asyncToGenerator") + wrapAsync: state.addHelper("asyncToGenerator"), }); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-async-to-module-method/src/index.js b/packages/babel-plugin-transform-async-to-module-method/src/index.js index 5ae36b052c..51a0ab4089 100644 --- a/packages/babel-plugin-transform-async-to-module-method/src/index.js +++ b/packages/babel-plugin-transform-async-to-module-method/src/index.js @@ -10,9 +10,9 @@ export default function () { if (!path.node.async || path.node.generator) return; remapAsyncToGenerator(path, state.file, { - wrapAsync: state.addImport(state.opts.module, state.opts.method) + wrapAsync: state.addImport(state.opts.module, state.opts.method), }); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-class-properties/src/index.js b/packages/babel-plugin-transform-class-properties/src/index.js index e06ea958bf..5d58f767e6 100644 --- a/packages/babel-plugin-transform-class-properties/src/index.js +++ b/packages/babel-plugin-transform-class-properties/src/index.js @@ -8,7 +8,7 @@ export default function ({ types: t }) { if (path.parentPath.isCallExpression({ callee: path.node })) { this.push(path.parentPath); } - } + }, }; const referenceVisitor = { @@ -17,7 +17,7 @@ export default function ({ types: t }) { this.collision = true; path.skip(); } - } + }, }; const buildObjectDefineProperty = template(` @@ -32,7 +32,7 @@ export default function ({ types: t }) { const buildClassPropertySpec = (ref, { key, value, computed }) => buildObjectDefineProperty({ REF: ref, KEY: (t.isIdentifier(key) && !computed) ? t.stringLiteral(key.name) : key, - VALUE: value ? value : t.identifier("undefined") + VALUE: value ? value : t.identifier("undefined"), }); const buildClassPropertyNonSpec = (ref, { key, value, computed }) => t.expressionStatement( @@ -111,7 +111,7 @@ export default function ({ types: t }) { const collisionState = { collision: false, - scope: constructor.scope + scope: constructor.scope, }; for (const prop of props) { @@ -126,14 +126,14 @@ export default function ({ types: t }) { t.variableDeclarator( initialisePropsRef, t.functionExpression(null, [], t.blockStatement(instanceBody)) - ) + ), ])); instanceBody = [ t.expressionStatement( t.callExpression(t.memberExpression(initialisePropsRef, t.identifier("call")), [ t.thisExpression()]) - ) + ), ]; } @@ -180,7 +180,7 @@ export default function ({ types: t }) { if (members.some((member) => member.isClassProperty())) { path.ensureBlock(); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-decorators/src/index.js b/packages/babel-plugin-transform-decorators/src/index.js index 3a8aab971f..700bc50259 100644 --- a/packages/babel-plugin-transform-decorators/src/index.js +++ b/packages/babel-plugin-transform-decorators/src/index.js @@ -302,7 +302,7 @@ export default function({ types: t }) { const ref = node.id || path.scope.generateUidIdentifier("class"); path.replaceWith(t.variableDeclaration("let", [ - t.variableDeclarator(ref, t.toExpression(node)) + t.variableDeclarator(ref, t.toExpression(node)), ])); }, ClassExpression(path, state) { @@ -337,6 +337,6 @@ export default function({ types: t }) { path.get("right.arguments")[1].node, ])); }, - } + }, }; } diff --git a/packages/babel-plugin-transform-do-expressions/src/index.js b/packages/babel-plugin-transform-do-expressions/src/index.js index 96cfd8f94d..2692b98bf4 100644 --- a/packages/babel-plugin-transform-do-expressions/src/index.js +++ b/packages/babel-plugin-transform-do-expressions/src/index.js @@ -12,7 +12,7 @@ export default function () { } else { path.replaceWith(path.scope.buildUndefinedNode()); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js b/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js index 70b6103556..31c1193482 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js +++ b/packages/babel-plugin-transform-es2015-arrow-functions/src/index.js @@ -18,7 +18,7 @@ export default function ({ types: t }) { "body", t.expressionStatement(t.callExpression(state.addHelper("newArrowCheck"), [ t.thisExpression(), - boundThis + boundThis, ])) ); @@ -29,7 +29,7 @@ export default function ({ types: t }) { } else { path.arrowFunctionToShadowed(); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js b/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js index 54d27f224c..dad07b0db7 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/src/index.js @@ -7,7 +7,7 @@ export default function ({ types: t }) { if (!path.isFunctionDeclaration()) continue; const declar = t.variableDeclaration("let", [ - t.variableDeclarator(func.id, t.toExpression(func)) + t.variableDeclarator(func.id, t.toExpression(func)), ]); // hoist it up above everything else @@ -24,7 +24,7 @@ export default function ({ types: t }) { visitor: { BlockStatement(path) { const { node, parent } = path; - if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) { + if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) { return; } @@ -33,7 +33,7 @@ export default function ({ types: t }) { SwitchCase(path) { statementList("consequent", path); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js index f633054622..1942cb8846 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/index.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/index.js @@ -60,8 +60,8 @@ export default function () { const blockScoping = new BlockScoping(null, path, path.parent, path.scope, file); blockScoping.run(); } - } - } + }, + }, }; } @@ -128,7 +128,7 @@ const letReferenceBlockVisitor = traverse.visitors.merge([{ path.traverse(letReferenceFunctionVisitor, state); } return path.skip(); - } + }, }, tdzVisitor]); const letReferenceFunctionVisitor = traverse.visitors.merge([{ @@ -144,7 +144,7 @@ const letReferenceFunctionVisitor = traverse.visitors.merge([{ if (localBinding && localBinding !== ref) return; state.closurify = true; - } + }, }, tdzVisitor]); const hoistVarDeclarationsVisitor = { @@ -170,13 +170,13 @@ const hoistVarDeclarationsVisitor = { } else if (path.isFunction()) { return path.skip(); } - } + }, }; const loopLabelVisitor = { LabeledStatement({ node }, state) { state.innerLabels.push(node.label.name); - } + }, }; const continuationVisitor = { @@ -188,7 +188,7 @@ const continuationVisitor = { state.reassignments[name] = true; } } - } + }, }; function loopNodeTo(node) { @@ -255,7 +255,7 @@ const loopVisitor = { if (path.isReturnStatement()) { state.hasReturn = true; replace = t.objectExpression([ - t.objectProperty(t.identifier("v"), node.argument || scope.buildUndefinedNode()) + t.objectProperty(t.identifier("v"), node.argument || scope.buildUndefinedNode()), ]); } @@ -265,28 +265,28 @@ const loopVisitor = { path.skip(); path.replaceWith(t.inherits(replace, node)); } - } + }, }; class BlockScoping { constructor(loopPath?: NodePath, blockPath: NodePath, parent: Object, scope: Scope, file: File) { this.parent = parent; - this.scope = scope; - this.file = file; + this.scope = scope; + this.file = file; this.blockPath = blockPath; - this.block = blockPath.node; + this.block = blockPath.node; this.outsideLetReferences = Object.create(null); - this.hasLetReferences = false; - this.letReferences = Object.create(null); - this.body = []; + this.hasLetReferences = false; + this.letReferences = Object.create(null); + this.body = []; if (loopPath) { this.loopParent = loopPath.parent; - this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label; - this.loopPath = loopPath; - this.loop = loopPath.node; + this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label; + this.loopPath = loopPath; + this.loop = loopPath.node; } } @@ -345,8 +345,8 @@ class BlockScoping { } remap() { - const letRefs = this.letReferences; - const scope = this.scope; + const letRefs = this.letReferences; + const scope = this.scope; // alright, so since we aren't wrapping this block in a closure // we have to check if any of our let variables collide with @@ -364,10 +364,10 @@ class BlockScoping { // the enclosing scope (e.g. loop or catch statement), so we should handle both // individually if (scope.hasOwnBinding(key)) - scope.rename(ref.name); + {scope.rename(ref.name);} if (this.blockPath.scope.hasOwnBinding(key)) - this.blockPath.scope.rename(ref.name); + {this.blockPath.scope.rename(ref.name);} } } } @@ -409,7 +409,7 @@ class BlockScoping { // turn outsideLetReferences into an array const params = values(outsideRefs); - const args = values(outsideRefs); + const args = values(outsideRefs); const isSwitch = this.blockPath.isSwitchStatement(); @@ -426,13 +426,13 @@ class BlockScoping { if (this.loop) { ref = this.scope.generateUidIdentifier("loop"); this.loopPath.insertBefore(t.variableDeclaration("var", [ - t.variableDeclarator(ref, fn) + t.variableDeclarator(ref, fn), ])); } // build a call and a unique id that we can assign the return value to let call = t.callExpression(ref, args); - const ret = this.scope.generateUidIdentifier("ret"); + const ret = this.scope.generateUidIdentifier("ret"); // handle generators const hasYield = traverse.hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES); @@ -479,7 +479,7 @@ class BlockScoping { addContinuations(fn) { const state = { reassignments: {}, - outsideReferences: this.outsideLetReferences + outsideReferences: this.outsideLetReferences, }; this.scope.traverse(fn, continuationVisitor, state); @@ -561,9 +561,9 @@ class BlockScoping { const state = { letReferences: this.letReferences, - closurify: false, - file: this.file, - loopDepth: 0, + closurify: false, + file: this.file, + loopDepth: 0, }; const loopOrFunctionParent = this.blockPath.find( @@ -592,13 +592,13 @@ class BlockScoping { checkLoop(): Object { const state = { hasBreakContinue: false, - ignoreLabeless: false, - inSwitchCase: false, - innerLabels: [], - hasReturn: false, - isLoop: !!this.loop, - map: {}, - LOOP_IGNORE: Symbol() + ignoreLabeless: false, + inSwitchCase: false, + innerLabels: [], + hasReturn: false, + isLoop: !!this.loop, + map: {}, + LOOP_IGNORE: Symbol(), }; this.blockPath.traverse(loopLabelVisitor, state); @@ -647,7 +647,7 @@ class BlockScoping { const body = this.body; body.push(t.variableDeclaration("var", [ - t.variableDeclarator(ret, call) + t.variableDeclarator(ret, call), ])); let retCheck; @@ -657,7 +657,7 @@ class BlockScoping { if (has.hasReturn) { // typeof ret === "object" retCheck = buildRetCheck({ - RETURN: ret + RETURN: ret, }); } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js b/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js index 17a3c2d210..5b8d55796a 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js +++ b/packages/babel-plugin-transform-es2015-block-scoping/src/tdz.js @@ -58,7 +58,7 @@ export const visitor = { } else if (status === "outside") { path.replaceWith(t.throwStatement(t.inherits( t.newExpression(t.identifier("ReferenceError"), [ - t.stringLiteral(`${node.name} is not defined - temporal dead zone`) + t.stringLiteral(`${node.name} is not defined - temporal dead zone`), ]), node ))); @@ -88,6 +88,6 @@ export const visitor = { nodes.push(node); path.replaceWithMultiple(nodes.map(t.expressionStatement)); } - } - } + }, + }, }; diff --git a/packages/babel-plugin-transform-es2015-classes/src/index.js b/packages/babel-plugin-transform-es2015-classes/src/index.js index 2dc8e3337d..52e06fa3af 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/index.js +++ b/packages/babel-plugin-transform-es2015-classes/src/index.js @@ -26,7 +26,7 @@ export default function ({ types: t }) { const ref = node.id || path.scope.generateUidIdentifier("class"); path.replaceWith(t.variableDeclaration("let", [ - t.variableDeclarator(ref, t.toExpression(node)) + t.variableDeclarator(ref, t.toExpression(node)), ])); }, @@ -43,7 +43,7 @@ export default function ({ types: t }) { if (state.opts.loose) Constructor = LooseTransformer; path.replaceWith(new Constructor(path, state.file).run()); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-classes/src/loose.js b/packages/babel-plugin-transform-es2015-classes/src/loose.js index b94cd6be05..57f7abbbec 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/loose.js +++ b/packages/babel-plugin-transform-es2015-classes/src/loose.js @@ -23,7 +23,7 @@ export default class LooseClassTransformer extends VanillaTransformer { func = nameFunction({ node: func, id: key, - scope + scope, }); } diff --git a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js index a9a36d4680..cdf20beb75 100644 --- a/packages/babel-plugin-transform-es2015-classes/src/vanilla.js +++ b/packages/babel-plugin-transform-es2015-classes/src/vanilla.js @@ -21,7 +21,7 @@ const noMethodVisitor = { Method(path) { path.skip(); - } + }, }; const verifyConstructorVisitor = visitors.merge([noMethodVisitor, { @@ -43,7 +43,7 @@ const verifyConstructorVisitor = visitors.merge([noMethodVisitor, { throw path.buildCodeFrameError("super() is only allowed in a derived constructor"); } } - } + }, }, ThisExpression(path) { @@ -52,36 +52,36 @@ const verifyConstructorVisitor = visitors.merge([noMethodVisitor, { throw path.buildCodeFrameError("'this' is not allowed before super()"); } } - } + }, }]); const findThisesVisitor = visitors.merge([noMethodVisitor, { ThisExpression(path) { this.superThises.push(path); - } + }, }]); export default class ClassTransformer { constructor(path: NodePath, file) { this.parent = path.parent; - this.scope = path.scope; - this.node = path.node; - this.path = path; - this.file = file; + this.scope = path.scope; + this.node = path.node; + this.path = path; + this.file = file; this.clearDescriptors(); this.instancePropBody = []; this.instancePropRefs = {}; - this.staticPropBody = []; - this.body = []; + this.staticPropBody = []; + this.body = []; - this.bareSuperAfter = []; - this.bareSupers = []; + this.bareSuperAfter = []; + this.bareSupers = []; this.pushedConstructor = false; - this.pushedInherits = false; - this.isLoose = false; + this.pushedInherits = false; + this.isLoose = false; this.superThises = []; @@ -98,13 +98,13 @@ export default class ClassTransformer { run() { let superName = this.superName; - const file = this.file; - let body = this.body; + const file = this.file; + let body = this.body; // const constructorBody = this.constructorBody = t.blockStatement([]); - this.constructor = this.buildConstructor(); + this.constructor = this.buildConstructor(); // @@ -128,7 +128,7 @@ export default class ClassTransformer { constructorBody.body.unshift(t.expressionStatement(t.callExpression( file.addHelper("classCallCheck"), [ t.thisExpression(), - this.classRef + this.classRef, ] ))); @@ -248,14 +248,14 @@ export default class ClassTransformer { const replaceSupers = new ReplaceSupers({ forceSuperMemoisation: isConstructor, - methodPath: path, - methodNode: node, - objectRef: this.classRef, - superRef: this.superName, - isStatic: node.static, - isLoose: this.isLoose, - scope: this.scope, - file: this.file + methodPath: path, + methodNode: node, + objectRef: this.classRef, + superRef: this.superName, + isStatic: node.static, + isLoose: this.isLoose, + scope: this.scope, + file: this.file, }, true); replaceSupers.replace(); @@ -271,10 +271,10 @@ export default class ClassTransformer { clearDescriptors() { this.hasInstanceDescriptors = false; - this.hasStaticDescriptors = false; + this.hasStaticDescriptors = false; this.instanceMutatorMap = {}; - this.staticMutatorMap = {}; + this.staticMutatorMap = {}; } pushDescriptors() { @@ -337,7 +337,7 @@ export default class ClassTransformer { buildObjectAssignment(id) { return t.variableDeclaration("var", [ - t.variableDeclarator(id, t.objectExpression([])) + t.variableDeclarator(id, t.objectExpression([])), ]); } @@ -400,10 +400,10 @@ export default class ClassTransformer { } else { bareSuper.replaceWithMultiple([ t.variableDeclaration("var", [ - t.variableDeclarator(thisRef, call) + t.variableDeclarator(thisRef, call), ]), ...bareSuperAfter, - t.expressionStatement(thisRef) + t.expressionStatement(thisRef), ]); } @@ -462,7 +462,7 @@ export default class ClassTransformer { const ref = returnPath.scope.generateDeclaredUidIdentifier("ret"); returnPath.get("argument").replaceWithMultiple([ t.assignmentExpression("=", ref, returnPath.node.argument), - wrapReturn(ref) + wrapReturn(ref), ]); } else { returnPath.get("argument").replaceWith(wrapReturn()); @@ -504,13 +504,13 @@ export default class ClassTransformer { const construct = this.constructor; this.userConstructorPath = path; - this.userConstructor = method; - this.hasConstructor = true; + this.userConstructor = method; + this.hasConstructor = true; t.inheritsComments(construct, method); construct._ignoreUserWhitespace = true; - construct.params = method.params; + construct.params = method.params; t.inherits(construct.body, method.body); construct.body.directives = method.body.directives; diff --git a/packages/babel-plugin-transform-es2015-computed-properties/src/index.js b/packages/babel-plugin-transform-es2015-computed-properties/src/index.js index ac0ef38fc8..87f2de6a33 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/src/index.js +++ b/packages/babel-plugin-transform-es2015-computed-properties/src/index.js @@ -39,7 +39,7 @@ export default function ({ types: t, template }) { MUTATOR_MAP_REF: getMutatorId(), KEY: key, VALUE: getValue(prop), - KIND: t.identifier(prop.kind) + KIND: t.identifier(prop.kind), })); } @@ -68,14 +68,14 @@ export default function ({ types: t, template }) { return t.callExpression(state.addHelper("defineProperty"), [ info.initPropExpression, key, - getValue(prop) + getValue(prop), ]); } else { body.push(t.expressionStatement( t.callExpression(state.addHelper("defineProperty"), [ objId, key, - getValue(prop) + getValue(prop), ]) )); } @@ -119,7 +119,7 @@ export default function ({ types: t, template }) { const body = []; body.push(t.variableDeclaration("var", [ - t.variableDeclarator(objId, initPropExpression) + t.variableDeclarator(objId, initPropExpression), ])); let callback = spec; @@ -132,7 +132,7 @@ export default function ({ types: t, template }) { mutatorRef = scope.generateUidIdentifier("mutatorMap"); body.push(t.variableDeclaration("var", [ - t.variableDeclarator(mutatorRef, t.objectExpression([])) + t.variableDeclarator(mutatorRef, t.objectExpression([])), ])); } @@ -162,8 +162,8 @@ export default function ({ types: t, template }) { body.push(t.expressionStatement(objId)); path.replaceWithMultiple(body); } - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-destructuring/src/index.js b/packages/babel-plugin-transform-es2015-destructuring/src/index.js index c1521ae573..ea6ffe5ab8 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/src/index.js +++ b/packages/babel-plugin-transform-es2015-destructuring/src/index.js @@ -32,18 +32,18 @@ export default function ({ types: t }) { state.deopt = true; path.stop(); } - } + }, }; class DestructuringTransformer { constructor(opts) { this.blockHoist = opts.blockHoist; - this.operator = opts.operator; - this.arrays = {}; - this.nodes = opts.nodes || []; - this.scope = opts.scope; - this.file = opts.file; - this.kind = opts.kind; + this.operator = opts.operator; + this.arrays = {}; + this.nodes = opts.nodes || []; + this.scope = opts.scope; + this.file = opts.file; + this.kind = opts.kind; } buildVariableAssignment(id, init) { @@ -56,7 +56,7 @@ export default function ({ types: t }) { node = t.expressionStatement(t.assignmentExpression(op, id, init)); } else { node = t.variableDeclaration(this.kind, [ - t.variableDeclarator(id, init) + t.variableDeclarator(id, init), ]); } @@ -67,7 +67,7 @@ export default function ({ types: t }) { buildVariableDeclaration(id, init) { const declar = t.variableDeclaration("var", [ - t.variableDeclarator(id, init) + t.variableDeclarator(id, init), ]); declar._blockHoist = this.blockHoist; return declar; @@ -100,7 +100,7 @@ export default function ({ types: t }) { const tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef); const declar = t.variableDeclaration("var", [ - t.variableDeclarator(tempValueRef, valueRef) + t.variableDeclarator(tempValueRef, valueRef), ]); declar._blockHoist = this.blockHoist; this.nodes.push(declar); @@ -160,7 +160,7 @@ export default function ({ types: t }) { if (t.isLiteral(prop.key)) prop.computed = true; const pattern = prop.value; - const objRef = t.memberExpression(propRef, prop.key, prop.computed); + const objRef = t.memberExpression(propRef, prop.key, prop.computed); if (t.isPattern(pattern)) { this.push(pattern, objRef); @@ -359,13 +359,13 @@ export default function ({ types: t }) { const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ - t.variableDeclarator(temp) + t.variableDeclarator(temp), ]); path.ensureBlock(); node.body.body.unshift(t.variableDeclaration("var", [ - t.variableDeclarator(left, temp) + t.variableDeclarator(left, temp), ])); return; @@ -378,7 +378,7 @@ export default function ({ types: t }) { const key = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration(left.kind, [ - t.variableDeclarator(key, null) + t.variableDeclarator(key, null), ]); const nodes = []; @@ -387,7 +387,7 @@ export default function ({ types: t }) { kind: left.kind, file: file, scope: scope, - nodes: nodes + nodes: nodes, }); destructuring.init(pattern, key); @@ -411,7 +411,7 @@ export default function ({ types: t }) { kind: "let", file: file, scope: scope, - nodes: nodes + nodes: nodes, }); destructuring.init(pattern, ref); @@ -428,7 +428,7 @@ export default function ({ types: t }) { operator: node.operator, file: file, scope: scope, - nodes: nodes + nodes: nodes, }); let ref; @@ -436,7 +436,7 @@ export default function ({ types: t }) { ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref"); nodes.push(t.variableDeclaration("var", [ - t.variableDeclarator(ref, node.right) + t.variableDeclarator(ref, node.right), ])); if (t.isArrayExpression(node.right)) { @@ -466,14 +466,14 @@ export default function ({ types: t }) { declar = node.declarations[i]; const patternId = declar.init; - const pattern = declar.id; + const pattern = declar.id; const destructuring = new DestructuringTransformer({ blockHoist: node._blockHoist, - nodes: nodes, - scope: scope, - kind: node.kind, - file: file + nodes: nodes, + scope: scope, + kind: node.kind, + file: file, }); if (t.isPattern(pattern)) { @@ -522,7 +522,7 @@ export default function ({ types: t }) { } else { path.replaceWithMultiple(nodesOut); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js index 0109d50b2f..268af6e513 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/src/index.js @@ -56,7 +56,7 @@ export default function() { prop.key = t.stringLiteral(name); } } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-for-of/src/index.js b/packages/babel-plugin-transform-es2015-for-of/src/index.js index b0b3a6bcbf..9b7c0ed813 100644 --- a/packages/babel-plugin-transform-es2015-for-of/src/index.js +++ b/packages/babel-plugin-transform-es2015-for-of/src/index.js @@ -53,7 +53,7 @@ export default function ({ messages, template, types: t }) { if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) { const uid = scope.generateUidIdentifier("arr"); nodes.push(t.variableDeclaration("var", [ - t.variableDeclarator(uid, right) + t.variableDeclarator(uid, right), ])); right = uid; } @@ -62,8 +62,8 @@ export default function ({ messages, template, types: t }) { let loop = buildForOfArray({ BODY: node.body, - KEY: iterationKey, - ARR: right + KEY: iterationKey, + ARR: right, }); t.inherits(loop, node); @@ -105,10 +105,10 @@ export default function ({ messages, template, types: t }) { if (state.opts.loose) callback = loose; const { node } = path; - const build = callback(path, state); + const build = callback(path, state); const declar = build.declar; - const loop = build.loop; - const block = loop.body; + const loop = build.loop; + const block = loop.body; // ensure that it's a block so we can take all its statements path.ensureBlock(); @@ -130,8 +130,8 @@ export default function ({ messages, template, types: t }) { } else { path.replaceWithMultiple(build.node); } - } - } + }, + }, }; function loose(path, file) { @@ -146,21 +146,21 @@ export default function ({ messages, template, types: t }) { // for (let i of test) id = scope.generateUidIdentifier("ref"); declar = t.variableDeclaration(left.kind, [ - t.variableDeclarator(left.declarations[0].id, id) + t.variableDeclarator(left.declarations[0].id, id), ]); } else { throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); } const iteratorKey = scope.generateUidIdentifier("iterator"); - const isArrayKey = scope.generateUidIdentifier("isArray"); + const isArrayKey = scope.generateUidIdentifier("isArray"); const loop = buildForOfLoose({ - LOOP_OBJECT: iteratorKey, - IS_ARRAY: isArrayKey, - OBJECT: node.right, - INDEX: scope.generateUidIdentifier("i"), - ID: id + LOOP_OBJECT: iteratorKey, + IS_ARRAY: isArrayKey, + OBJECT: node.right, + INDEX: scope.generateUidIdentifier("i"), + ID: id, }); if (!declar) { @@ -179,9 +179,9 @@ export default function ({ messages, template, types: t }) { return { replaceParent: isLabeledParent, - declar: declar, - node: labeled || loop, - loop: loop + declar: declar, + node: labeled || loop, + loop: loop, }; } @@ -190,7 +190,7 @@ export default function ({ messages, template, types: t }) { const left = node.left; let declar; - const stepKey = scope.generateUidIdentifier("step"); + const stepKey = scope.generateUidIdentifier("step"); const stepValue = t.memberExpression(stepKey, t.identifier("value")); if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) { @@ -199,7 +199,7 @@ export default function ({ messages, template, types: t }) { } else if (t.isVariableDeclaration(left)) { // for (let i of test) declar = t.variableDeclaration(left.kind, [ - t.variableDeclarator(left.declarations[0].id, stepValue) + t.variableDeclarator(left.declarations[0].id, stepValue), ]); } else { throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type)); @@ -211,12 +211,12 @@ export default function ({ messages, template, types: t }) { const template = buildForOf({ ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"), - ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), - ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), - ITERATOR_KEY: iteratorKey, - STEP_KEY: stepKey, - OBJECT: node.right, - BODY: null + ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"), + ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"), + ITERATOR_KEY: iteratorKey, + STEP_KEY: stepKey, + OBJECT: node.right, + BODY: null, }); const isLabeledParent = t.isLabeledStatement(parent); @@ -232,9 +232,9 @@ export default function ({ messages, template, types: t }) { return { replaceParent: isLabeledParent, - declar: declar, - loop: loop, - node: template + declar: declar, + loop: loop, + node: template, }; } } diff --git a/packages/babel-plugin-transform-es2015-function-name/src/index.js b/packages/babel-plugin-transform-es2015-function-name/src/index.js index 15551ecd5c..737144c05a 100644 --- a/packages/babel-plugin-transform-es2015-function-name/src/index.js +++ b/packages/babel-plugin-transform-es2015-function-name/src/index.js @@ -9,7 +9,7 @@ export default function () { const replacement = nameFunction(path); if (replacement) path.replaceWith(replacement); } - } + }, }, ObjectProperty(path) { @@ -18,7 +18,7 @@ export default function () { const newNode = nameFunction(value); if (newNode) value.replaceWith(newNode); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-instanceof/src/index.js b/packages/babel-plugin-transform-es2015-instanceof/src/index.js index ff744f9cff..50e10c06c4 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/src/index.js +++ b/packages/babel-plugin-transform-es2015-instanceof/src/index.js @@ -6,7 +6,7 @@ export default function ({ types: t }) { if (node.operator === "instanceof") { path.replaceWith(t.callExpression(this.addHelper("instanceof"), [node.left, node.right])); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-literals/src/index.js b/packages/babel-plugin-transform-es2015-literals/src/index.js index 3f6d33c4ce..4e9dd463d2 100644 --- a/packages/babel-plugin-transform-es2015-literals/src/index.js +++ b/packages/babel-plugin-transform-es2015-literals/src/index.js @@ -13,7 +13,7 @@ export default function () { if (node.extra && /\\[u]/gi.test(node.extra.raw)) { node.extra = undefined; } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js index 17338358e2..12cf89b0d8 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-amd/src/index.js @@ -55,7 +55,7 @@ export default function ({ types: t }) { this.sources.push([id.node, source]); path.remove(); - } + }, }; return { @@ -104,7 +104,7 @@ export default function ({ types: t }) { const { node } = path; const factory = buildFactory({ PARAMS: params, - BODY: node.body + BODY: node.body, }); factory.expression.body.directives = node.directives; node.directives = []; @@ -112,10 +112,10 @@ export default function ({ types: t }) { node.body = [buildDefine({ MODULE_NAME: moduleName, SOURCES: sources, - FACTORY: factory + FACTORY: factory, })]; - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 832d1cb9dd..6c6dc9848e 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -124,7 +124,7 @@ export default function () { nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1))); path.replaceWithMultiple(t.sequenceExpression(nodes)); - } + }, }; return { @@ -182,7 +182,7 @@ export default function () { const varDecl = t.variableDeclaration("var", [ t.variableDeclarator(ref, buildRequire( t.stringLiteral(source) - ).expression) + ).expression), ]); // Copy location from the original import statement for sourcemap @@ -260,7 +260,7 @@ export default function () { addTo(exports, id.name, defNode); path.replaceWithMultiple([ declaration.node, - buildExportsAssignment(defNode, id) + buildExportsAssignment(defNode, id), ]); } else { path.replaceWith(buildExportsAssignment(defNode, t.toExpression(declaration.node))); @@ -291,7 +291,7 @@ export default function () { addTo(exports, id.name, id); path.replaceWithMultiple([ declaration.node, - buildExportsAssignment(id, id) + buildExportsAssignment(id, id), ]); nonHoistedExportNames[id.name] = true; } else if (declaration.isVariableDeclaration()) { @@ -353,7 +353,7 @@ export default function () { path.replaceWithMultiple(nodes); } else if (path.isExportAllDeclaration()) { const exportNode = buildExportAll({ - OBJECT: addRequire(path.node.source.value, path.node._blockHoist) + OBJECT: addRequire(path.node.source.value, path.node._blockHoist), }); exportNode.loc = path.node.loc; topNodes.push(exportNode); @@ -381,7 +381,7 @@ export default function () { this.addHelper("interopRequireWildcard"), [uid] ) - ) + ), ]); if (maxBlockHoist > 0) { @@ -411,7 +411,7 @@ export default function () { this.addHelper("interopRequireDefault"), [uid] ) - ) + ), ]); if (maxBlockHoist > 0) { @@ -480,8 +480,8 @@ export default function () { exports, requeueInParent: (newPath) => path.requeue(newPath), }); - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js index 920733e616..6315e0d83a 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/esmodule-flag.js @@ -10,7 +10,7 @@ test("Re-export doesn't overwrite __esModule flag", function () { const context = { module: { - exports: {} + exports: {}, }, require: function (id) { if (id === "./dep") return depStub; diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js index c995a972b3..10383b609a 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/src/index.js @@ -50,11 +50,11 @@ export default function ({ types: t }) { let isPostUpdateExpression = path.isUpdateExpression() && !node.prefix; if (isPostUpdateExpression) { if (node.operator === "++") - node = t.binaryExpression("+", node.argument, t.numericLiteral(1)); + {node = t.binaryExpression("+", node.argument, t.numericLiteral(1));} else if (node.operator === "--") - node = t.binaryExpression("-", node.argument, t.numericLiteral(1)); + {node = t.binaryExpression("-", node.argument, t.numericLiteral(1));} else - isPostUpdateExpression = false; + {isPostUpdateExpression = false;} } for (const exportedName of exportedNames) { @@ -62,10 +62,10 @@ export default function ({ types: t }) { } if (isPostUpdateExpression) - node = t.sequenceExpression([node, path.node]); + {node = t.sequenceExpression([node, path.node]);} path.replaceWith(node); - } + }, }; return { @@ -244,7 +244,7 @@ export default function ({ types: t }) { const exportObjRef = path.scope.generateUidIdentifier("exportObj"); setterBody.push(t.variableDeclaration("var", [ - t.variableDeclarator(exportObjRef, t.objectExpression([])) + t.variableDeclarator(exportObjRef, t.objectExpression([])), ])); for (const node of specifiers.exports) { @@ -252,7 +252,7 @@ export default function ({ types: t }) { setterBody.push(buildExportAll({ KEY: path.scope.generateUidIdentifier("key"), EXPORT_OBJ: exportObjRef, - TARGET: target + TARGET: target, })); } else if (t.isExportSpecifier(node)) { setterBody.push(t.expressionStatement( @@ -287,7 +287,7 @@ export default function ({ types: t }) { path.traverse(reassignmentVisitor, { exports: exportNames, buildCall: buildExportCall, - scope: path.scope + scope: path.scope, }); for (const path of removedPaths) { @@ -304,11 +304,11 @@ export default function ({ types: t }) { SOURCES: sources, BODY: path.node.body, EXPORT_IDENTIFIER: exportIdent, - CONTEXT_IDENTIFIER: contextIdent - }) + CONTEXT_IDENTIFIER: contextIdent, + }), ]; - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js index 25598c395b..72fd6fe7a5 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-umd/src/index.js @@ -121,7 +121,7 @@ export default function ({ types: t }) { const globalExport = buildGlobalExport({ BROWSER_ARGUMENTS: browserArgs, PREREQUISITE_ASSIGNMENTS: prerequisiteAssignments, - GLOBAL_TO_ASSIGN: globalToAssign + GLOBAL_TO_ASSIGN: globalToAssign, }); last.replaceWith(buildWrapper({ @@ -129,10 +129,10 @@ export default function ({ types: t }) { AMD_ARGUMENTS: amdArgs, COMMON_ARGUMENTS: commonArgs, GLOBAL_EXPORT: globalExport, - FUNC: func + FUNC: func, })); - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-object-super/src/index.js b/packages/babel-plugin-transform-es2015-object-super/src/index.js index 5e633fe447..dd47816a7d 100644 --- a/packages/babel-plugin-transform-es2015-object-super/src/index.js +++ b/packages/babel-plugin-transform-es2015-object-super/src/index.js @@ -4,11 +4,11 @@ export default function ({ types: t }) { function Property(path, node, scope, getObjectRef, file) { const replaceSupers = new ReplaceSupers({ getObjectRef: getObjectRef, - methodNode: node, - methodPath: path, - isStatic: true, - scope: scope, - file: file + methodNode: node, + methodPath: path, + isStatic: true, + scope: scope, + file: file, }); replaceSupers.replace(); @@ -40,8 +40,8 @@ export default function ({ types: t }) { path.scope.push({ id: objectRef }); path.replaceWith(t.assignmentExpression("=", objectRef, path.node)); } - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-parameters/src/default.js b/packages/babel-plugin-transform-es2015-parameters/src/default.js index 8213efff57..6b0d728f5e 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/default.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/default.js @@ -40,7 +40,7 @@ const iifeVisitor = { Scope(path) { // different bindings path.skip(); - } + }, }; export const visitor = { @@ -53,7 +53,7 @@ export const visitor = { const state = { iife: false, - scope: scope + scope: scope, }; const body = []; @@ -67,8 +67,8 @@ export const visitor = { const defNode = buildDefaultParam({ VARIABLE_NAME: left, DEFAULT_VALUE: right, - ARGUMENT_KEY: t.numericLiteral(i), - ARGUMENTS: argsIdentifier + ARGUMENT_KEY: t.numericLiteral(i), + ARGUMENTS: argsIdentifier, }); defNode._blockHoist = node.params.length - i; body.push(defNode); @@ -90,7 +90,7 @@ export const visitor = { continue; } - const left = param.get("left"); + const left = param.get("left"); const right = param.get("right"); // @@ -134,5 +134,5 @@ export const visitor = { } else { path.get("body").unshiftContainer("body", body); } - } + }, }; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js b/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js index 495ac06050..c40db2dac9 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/destructuring.js @@ -15,7 +15,7 @@ export const visitor = { const uid = path.scope.generateUidIdentifier("ref"); const declar = t.variableDeclaration("let", [ - t.variableDeclarator(param.node, uid) + t.variableDeclarator(param.node, uid), ]); declar._blockHoist = outputParamsLength - i; @@ -25,5 +25,5 @@ export const visitor = { param.replaceWith(uid); } } - } + }, }; diff --git a/packages/babel-plugin-transform-es2015-parameters/src/index.js b/packages/babel-plugin-transform-es2015-parameters/src/index.js index d59d21b3bf..c3321d35c3 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/index.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/index.js @@ -17,7 +17,7 @@ export default function () { break; } } - } - }, destructuring.visitor, rest.visitor, def.visitor]) + }, + }, destructuring.visitor, rest.visitor, def.visitor]), }; } diff --git a/packages/babel-plugin-transform-es2015-parameters/src/rest.js b/packages/babel-plugin-transform-es2015-parameters/src/rest.js index 1297b13f15..f0171ed443 100644 --- a/packages/babel-plugin-transform-es2015-parameters/src/rest.js +++ b/packages/babel-plugin-transform-es2015-parameters/src/rest.js @@ -153,7 +153,7 @@ const memberExpressionOptimisationVisitor = { if (node.name === state.name) { state.deopted = true; } - } + }, }; function hasRest(node) { return t.isRestElement(node.params[node.params.length - 1]); @@ -178,7 +178,7 @@ function optimiseIndexGetter(path, argsId, offset) { path.parentPath.replaceWith(restIndexImpure({ ARGUMENTS: argsId, INDEX: index, - REF: temp + REF: temp, })); } else { path.parentPath.replaceWith(restIndex({ @@ -214,10 +214,10 @@ export const visitor = { // check and optimise for extremely common cases const state = { references: [], - offset: node.params.length, + offset: node.params.length, argumentsNode: argsId, - outerBinding: scope.getBindingIdentifier(rest.name), + outerBinding: scope.getBindingIdentifier(rest.name), // candidate member expressions we could optimise if there are no other references candidates: [], @@ -295,10 +295,10 @@ export const visitor = { ARGUMENTS: argsId, ARRAY_KEY: arrKey, ARRAY_LEN: arrLen, - START: start, - ARRAY: rest, - KEY: key, - LEN: len, + START: start, + ARRAY: rest, + KEY: key, + LEN: len, }); if (state.deopted) { @@ -322,5 +322,5 @@ export const visitor = { target.insertBefore(loop); } - } + }, }; diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js b/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js index 3bc612ab0e..fdf4c17fda 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/src/index.js @@ -21,7 +21,7 @@ export default function () { if (node.shorthand) { node.shorthand = false; } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-spread/src/index.js b/packages/babel-plugin-transform-es2015-spread/src/index.js index 14dfd52492..d533d484b5 100644 --- a/packages/babel-plugin-transform-es2015-spread/src/index.js +++ b/packages/babel-plugin-transform-es2015-spread/src/index.js @@ -136,7 +136,7 @@ export default function ({ types: t }) { ), [] )); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js b/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js index 409b6d9027..0798fa002b 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js +++ b/packages/babel-plugin-transform-es2015-sticky-regex/src/index.js @@ -10,9 +10,9 @@ export default function () { path.replaceWith(t.newExpression(t.identifier("RegExp"), [ t.stringLiteral(node.pattern), - t.stringLiteral(node.flags) + t.stringLiteral(node.flags), ])); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-template-literals/src/index.js b/packages/babel-plugin-transform-es2015-template-literals/src/index.js index 40d3a4d24b..8743c990da 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/src/index.js +++ b/packages/babel-plugin-transform-es2015-template-literals/src/index.js @@ -12,10 +12,10 @@ export default function ({ types: t }) { TaggedTemplateExpression(path, state) { const { node } = path; const quasi = node.quasi; - let args = []; + let args = []; let strings = []; - let raw = []; + let raw = []; for (const elem of (quasi.quasis: Array)) { strings.push(t.stringLiteral(elem.value.cooked)); @@ -46,7 +46,7 @@ export default function ({ types: t }) { const expr = expressions.shift(); if (expr) { - if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) { + if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) { nodes.push(t.callExpression(t.identifier("String"), [expr.node])); } else { nodes.push(expr.node); @@ -74,7 +74,7 @@ export default function ({ types: t }) { } else { path.replaceWith(nodes[0]); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js index 754b496f0e..d5d7ae067d 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/src/index.js @@ -46,7 +46,7 @@ export default function ({ types: t }) { path.replaceWith(call); } } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/src/index.js b/packages/babel-plugin-transform-es2015-unicode-regex/src/index.js index e659945dfa..0e537eeb5b 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/src/index.js +++ b/packages/babel-plugin-transform-es2015-unicode-regex/src/index.js @@ -8,7 +8,7 @@ export default function () { if (!regex.is(node, "u")) return; node.pattern = rewritePattern(node.pattern, node.flags); regex.pullFlag(node, "u"); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js b/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js index 2aa02f1208..ddcea660c1 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js +++ b/packages/babel-plugin-transform-es3-member-expression-literals/src/index.js @@ -9,8 +9,8 @@ export default function ({ types: t }) { node.property = t.stringLiteral(prop.name); node.computed = true; } - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es3-property-literals/src/index.js b/packages/babel-plugin-transform-es3-property-literals/src/index.js index 0dbb2ee215..b85cfc84a4 100644 --- a/packages/babel-plugin-transform-es3-property-literals/src/index.js +++ b/packages/babel-plugin-transform-es3-property-literals/src/index.js @@ -8,8 +8,8 @@ export default function ({ types: t }) { // default: "bar" -> "default": "bar" node.key = t.stringLiteral(key.name); } - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-es5-property-mutators/src/index.js b/packages/babel-plugin-transform-es5-property-mutators/src/index.js index 83727bb0a5..243b690227 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/src/index.js +++ b/packages/babel-plugin-transform-es5-property-mutators/src/index.js @@ -29,7 +29,7 @@ export default function ({ types: t }) { t.memberExpression(t.identifier("Object"), t.identifier("defineProperties")), [node, defineMap.toDefineObject(mutatorMap)] )); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-eval/src/index.js b/packages/babel-plugin-transform-eval/src/index.js index ec92ec40f2..14486299c0 100644 --- a/packages/babel-plugin-transform-eval/src/index.js +++ b/packages/babel-plugin-transform-eval/src/index.js @@ -13,7 +13,7 @@ export default function ({ parse, traverse }) { traverse.removeProperties(ast); return ast.program; } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-exponentiation-operator/src/index.js b/packages/babel-plugin-transform-exponentiation-operator/src/index.js index c58302bb3c..8756cd81d0 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/src/index.js +++ b/packages/babel-plugin-transform-exponentiation-operator/src/index.js @@ -10,7 +10,7 @@ export default function ({ types: t }) { build(left, right) { return t.callExpression(t.memberExpression(t.identifier("Math"), t.identifier("pow")), [left, right]); - } - }) + }, + }), }; } diff --git a/packages/babel-plugin-transform-export-extensions/src/index.js b/packages/babel-plugin-transform-export-extensions/src/index.js index 95de3ef19c..b79bfc8b8b 100644 --- a/packages/babel-plugin-transform-export-extensions/src/index.js +++ b/packages/babel-plugin-transform-export-extensions/src/index.js @@ -35,7 +35,7 @@ export default function ({ types: t }) { nodes.push(node); } path.replaceWithMultiple(nodes); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-flow-comments/src/index.js b/packages/babel-plugin-transform-flow-comments/src/index.js index 9ecad77d06..05676fc825 100644 --- a/packages/babel-plugin-transform-flow-comments/src/index.js +++ b/packages/babel-plugin-transform-flow-comments/src/index.js @@ -35,14 +35,14 @@ export default function ({ types: t }) { AssignmentPattern: { exit({ node }) { node.left.optional = false; - } + }, }, // strip optional property from function params - facebook/fbjs#17 Function: { exit({ node }) { node.params.forEach((param) => param.optional = false); - } + }, }, // support for `class X { foo: string }` - #4622 @@ -67,7 +67,7 @@ export default function ({ types: t }) { return; } wrapInFlowComment(path, parent); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-flow-strip-types/src/index.js b/packages/babel-plugin-transform-flow-strip-types/src/index.js index 6cbdc999e6..12f5f4bb8c 100644 --- a/packages/babel-plugin-transform-flow-strip-types/src/index.js +++ b/packages/babel-plugin-transform-flow-strip-types/src/index.js @@ -59,7 +59,7 @@ export default function ({ types: t }) { node = node.expression; } while (t.isTypeCastExpression(node)); path.replaceWith(node); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-function-bind/src/index.js b/packages/babel-plugin-transform-function-bind/src/index.js index db0225ede9..c92e147397 100644 --- a/packages/babel-plugin-transform-function-bind/src/index.js +++ b/packages/babel-plugin-transform-function-bind/src/index.js @@ -22,7 +22,7 @@ export default function ({ types: t }) { if (bind.object) { bind.callee = t.sequenceExpression([ t.assignmentExpression("=", tempId, bind.object), - bind.callee + bind.callee, ]); } else { bind.callee.object = t.assignmentExpression("=", tempId, bind.callee.object); @@ -47,7 +47,7 @@ export default function ({ types: t }) { const { node, scope } = path; const context = inferBindContext(node, scope); path.replaceWith(t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context])); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-jscript/src/index.js b/packages/babel-plugin-transform-jscript/src/index.js index 87f83c2bed..a34268656e 100644 --- a/packages/babel-plugin-transform-jscript/src/index.js +++ b/packages/babel-plugin-transform-jscript/src/index.js @@ -10,12 +10,12 @@ export default function ({ types: t }) { path.replaceWith(t.callExpression( t.functionExpression(null, [], t.blockStatement([ t.toStatement(node), - t.returnStatement(node.id) + t.returnStatement(node.id), ])), [] )); - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-object-assign/src/index.js b/packages/babel-plugin-transform-object-assign/src/index.js index 4b985078df..067a793bdd 100644 --- a/packages/babel-plugin-transform-object-assign/src/index.js +++ b/packages/babel-plugin-transform-object-assign/src/index.js @@ -5,7 +5,7 @@ export default function () { if (path.get("callee").matchesPattern("Object.assign")) { path.node.callee = file.addHelper("extends"); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-object-rest-spread/src/index.js b/packages/babel-plugin-transform-object-rest-spread/src/index.js index c0131303ac..34285cd093 100644 --- a/packages/babel-plugin-transform-object-rest-spread/src/index.js +++ b/packages/babel-plugin-transform-object-rest-spread/src/index.js @@ -7,7 +7,7 @@ export default function ({ types: t }) { RestElement() { foundRestElement = true; path.stop(); - } + }, }); return foundRestElement; } @@ -38,9 +38,9 @@ export default function ({ types: t }) { t.callExpression( file.addHelper("objectWithoutProperties"), [ objRef, - t.arrayExpression(keys) + t.arrayExpression(keys), ] - ) + ), ]; } @@ -54,7 +54,7 @@ export default function ({ types: t }) { const uid = parentPath.scope.generateUidIdentifier("ref"); const declar = t.variableDeclaration("let", [ - t.variableDeclarator(paramPath.node, uid) + t.variableDeclarator(paramPath.node, uid), ]); declar._blockHoist = i ? numParams - i : 1; @@ -138,9 +138,9 @@ export default function ({ types: t }) { (path) => path.isObjectProperty() || path.isVariableDeclarator() ).remove(); } - } + }, }, { - originalPath: path + originalPath: path, }); }, // taken from transform-es2015-destructuring/src/index.js#visitor @@ -179,7 +179,7 @@ export default function ({ types: t }) { ref = path.scope.generateUidIdentifierBasedOnNode(path.node.right, "ref"); nodes.push(t.variableDeclaration("var", [ - t.variableDeclarator(ref, path.node.right) + t.variableDeclarator(ref, path.node.right), ])); } @@ -216,13 +216,13 @@ export default function ({ types: t }) { const temp = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration("var", [ - t.variableDeclarator(temp) + t.variableDeclarator(temp), ]); path.ensureBlock(); node.body.body.unshift(t.variableDeclaration("var", [ - t.variableDeclarator(left, temp) + t.variableDeclarator(left, temp), ])); return; @@ -235,14 +235,14 @@ export default function ({ types: t }) { const key = scope.generateUidIdentifier("ref"); node.left = t.variableDeclaration(left.kind, [ - t.variableDeclarator(key, null) + t.variableDeclarator(key, null), ]); path.ensureBlock(); node.body.body.unshift( t.variableDeclaration(node.left.kind, [ - t.variableDeclarator(pattern, key) + t.variableDeclarator(pattern, key), ]) ); }, @@ -285,7 +285,7 @@ export default function ({ types: t }) { file.addHelper("extends"); path.replaceWith(t.callExpression(helper, args)); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js index dc3575ab48..9f3d99c884 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/src/index.js @@ -5,7 +5,7 @@ export default function () { if (path.get("callee").matchesPattern("Object.setPrototypeOf")) { path.node.callee = file.addHelper("defaults"); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-proto-to-assign/src/index.js b/packages/babel-plugin-transform-proto-to-assign/src/index.js index c139e20de4..83230a6ae4 100644 --- a/packages/babel-plugin-transform-proto-to-assign/src/index.js +++ b/packages/babel-plugin-transform-proto-to-assign/src/index.js @@ -21,8 +21,8 @@ export default function ({ types: t }) { if (!isProtoAssignmentExpression(path.node)) return; const nodes = []; - const left = path.node.left.object; - const temp = path.scope.maybeGenerateMemoised(left); + const left = path.node.left.object; + const temp = path.scope.maybeGenerateMemoised(left); if (temp) nodes.push(t.expressionStatement(t.assignmentExpression("=", temp, left))); nodes.push(buildDefaultsCallExpression(path.node, temp || left, file)); @@ -56,7 +56,7 @@ export default function ({ types: t }) { if (node.properties.length) args.push(node); path.replaceWith(t.callExpression(file.addHelper("extends"), args)); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-react-constant-elements/src/index.js b/packages/babel-plugin-transform-react-constant-elements/src/index.js index b38f2008d1..5b2b18fcc9 100644 --- a/packages/babel-plugin-transform-react-constant-elements/src/index.js +++ b/packages/babel-plugin-transform-react-constant-elements/src/index.js @@ -44,7 +44,7 @@ export default function ({ types: t }) { } stop(); } - } + }, }; return { @@ -60,7 +60,7 @@ export default function ({ types: t }) { } else { path.node._hoisted = true; } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-react-display-name/src/index.js b/packages/babel-plugin-transform-react-display-name/src/index.js index ce73d4db74..f80f67c8dd 100644 --- a/packages/babel-plugin-transform-react-display-name/src/index.js +++ b/packages/babel-plugin-transform-react-display-name/src/index.js @@ -88,7 +88,7 @@ export default function ({ types: t }) { if (t.isIdentifier(id)) { addDisplayName(id.name, node); } - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-react-inline-elements/src/index.js b/packages/babel-plugin-transform-react-inline-elements/src/index.js index cb0e5a12c1..9af3146ec7 100644 --- a/packages/babel-plugin-transform-react-inline-elements/src/index.js +++ b/packages/babel-plugin-transform-react-inline-elements/src/index.js @@ -29,9 +29,9 @@ export default function ({ types: t }) { if (hasRefOrSpread(open.attributes)) return; // init - const props = t.objectExpression([]); - let key = null; - let type = open.name; + const props = t.objectExpression([]); + let key = null; + let type = open.name; if (t.isJSXIdentifier(type) && t.react.isCompatTag(type.name)) { type = t.stringLiteral(type.name); @@ -63,7 +63,7 @@ export default function ({ types: t }) { const el = t.callExpression(file.addHelper("jsx"), args); path.replaceWith(el); - } - } + }, + }, }; } diff --git a/packages/babel-plugin-transform-react-jsx-compat/src/index.js b/packages/babel-plugin-transform-react-jsx-compat/src/index.js index ba591ecaf5..7fa6b05edc 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-compat/src/index.js @@ -22,7 +22,7 @@ export default function ({ types: t }) { state.args ); } - } - }) + }, + }), }; } diff --git a/packages/babel-plugin-transform-react-jsx-self/src/index.js b/packages/babel-plugin-transform-react-jsx-self/src/index.js index 39f223df64..089d1c1775 100644 --- a/packages/babel-plugin-transform-react-jsx-self/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-self/src/index.js @@ -21,10 +21,10 @@ export default function ({ types: t }) { const trace = t.thisExpression(); node.attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); - } + }, }; return { - visitor + visitor, }; } diff --git a/packages/babel-plugin-transform-react-jsx-source/src/index.js b/packages/babel-plugin-transform-react-jsx-source/src/index.js index 9bde066500..1583598f22 100644 --- a/packages/babel-plugin-transform-react-jsx-source/src/index.js +++ b/packages/babel-plugin-transform-react-jsx-source/src/index.js @@ -56,10 +56,10 @@ export default function ({ types: t }) { const trace = makeTrace(state.fileNameIdentifier, location.start.line); attributes.push(t.jSXAttribute(id, t.jSXExpressionContainer(trace))); - } + }, }; return { - visitor + visitor, }; } diff --git a/packages/babel-plugin-transform-react-jsx/src/index.js b/packages/babel-plugin-transform-react-jsx/src/index.js index bb57b52d7f..0c3df28ebc 100644 --- a/packages/babel-plugin-transform-react-jsx/src/index.js +++ b/packages/babel-plugin-transform-react-jsx/src/index.js @@ -7,7 +7,7 @@ export default function ({ types: t }) { const visitor = helper({ pre(state) { const tagName = state.tagName; - const args = state.args; + const args = state.args; if (t.react.isCompatTag(tagName)) { args.push(t.stringLiteral(tagName)); } else { @@ -17,7 +17,7 @@ export default function ({ types: t }) { post(state, pass) { state.callee = pass.get("jsxIdentifier")(); - } + }, }); visitor.Program = function (path, state) { @@ -47,6 +47,6 @@ export default function ({ types: t }) { return { inherits: jsx, - visitor + visitor, }; } diff --git a/packages/babel-plugin-transform-runtime/src/definitions.js b/packages/babel-plugin-transform-runtime/src/definitions.js index bc8b733204..159c4cde68 100644 --- a/packages/babel-plugin-transform-runtime/src/definitions.js +++ b/packages/babel-plugin-transform-runtime/src/definitions.js @@ -9,7 +9,7 @@ export default { Observable: "observable", setImmediate: "set-immediate", clearImmediate: "clear-immediate", - asap: "asap" + asap: "asap", //parseFloat: "parse-float", // temporary disabled //parseInt: "parse-int" // temporary disabled }, @@ -38,11 +38,11 @@ export default { some: "array/some", sort: "array/sort", splice: "array/splice", - values: "array/values" + values: "array/values", }, JSON: { - stringify: "json/stringify" + stringify: "json/stringify", }, Object: { @@ -65,7 +65,7 @@ export default { preventExtensions: "object/prevent-extensions", seal: "object/seal", setPrototypeOf: "object/set-prototype-of", - values: "object/values" + values: "object/values", }, Math: { @@ -89,7 +89,7 @@ export default { iaddh: "math/iaddh", isubh: "math/isubh", imulh: "math/imulh", - umulh: "math/umulh" + umulh: "math/umulh", }, Symbol: { @@ -105,7 +105,7 @@ export default { split: "symbol/split", toPrimitive: "symbol/to-primitive", toStringTag: "symbol/to-string-tag", - unscopables: "symbol/unscopables" + unscopables: "symbol/unscopables", }, String: { @@ -124,7 +124,7 @@ export default { trimLeft: "string/trim-left", trimRight: "string/trim-right", trimStart: "string/trim-start", - trimEnd: "string/trim-end" + trimEnd: "string/trim-end", }, Number: { @@ -136,7 +136,7 @@ export default { MAX_SAFE_INTEGER: "number/max-safe-integer", MIN_SAFE_INTEGER: "number/min-safe-integer", parseFloat: "number/parse-float", - parseInt: "number/parse-int" + parseInt: "number/parse-int", }, Reflect: { @@ -161,11 +161,11 @@ export default { getOwnMetadataKeys: "reflect/get-own-metadata-keys", hasMetadata: "reflect/has-metadata", hasOwnMetadata: "reflect/has-own-metadata", - metadata: "reflect/metadata" + metadata: "reflect/metadata", }, System: { - global: "system/global" + global: "system/global", }, Date: { @@ -175,6 +175,6 @@ export default { Function: { // Warning: /virtual/ method - prototype, not static, version //bind: "function/virtual/bind" // temporary disabled - } - } + }, + }, }; diff --git a/packages/babel-plugin-transform-runtime/src/index.js b/packages/babel-plugin-transform-runtime/src/index.js index 8299547e91..98976b52af 100644 --- a/packages/babel-plugin-transform-runtime/src/index.js +++ b/packages/babel-plugin-transform-runtime/src/index.js @@ -147,9 +147,9 @@ export default function ({ types: t }) { node.property, node.computed )); - } - } - } + }, + }, + }, }; } diff --git a/packages/babel-plugin-transform-strict-mode/src/index.js b/packages/babel-plugin-transform-strict-mode/src/index.js index fbd1dd9137..54b84fad98 100644 --- a/packages/babel-plugin-transform-strict-mode/src/index.js +++ b/packages/babel-plugin-transform-strict-mode/src/index.js @@ -13,7 +13,7 @@ export default function () { } path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict"))); - } - } + }, + }, }; } diff --git a/packages/babel-preset-es2015/src/index.js b/packages/babel-preset-es2015/src/index.js index dcff99017a..162854e9c8 100644 --- a/packages/babel-preset-es2015/src/index.js +++ b/packages/babel-preset-es2015/src/index.js @@ -70,7 +70,7 @@ export default function (context, opts = {}) { modules === "systemjs" && [transformES2015ModulesSystemJS, optsLoose], modules === "amd" && [transformES2015ModulesAMD, optsLoose], modules === "umd" && [transformES2015ModulesUMD, optsLoose], - [transformRegenerator, { async: false, asyncGenerators: false }] - ].filter(Boolean) // filter out falsy values + [transformRegenerator, { async: false, asyncGenerators: false }], + ].filter(Boolean), // filter out falsy values }; } diff --git a/packages/babel-preset-es2015/test/traceur.js b/packages/babel-preset-es2015/test/traceur.js index bac5885f86..ce7577a5e5 100644 --- a/packages/babel-preset-es2015/test/traceur.js +++ b/packages/babel-preset-es2015/test/traceur.js @@ -76,7 +76,7 @@ runner(`${__dirname}/fixtures/traceur`, "traceur", { // TODO "Syntax/StrictKeywordsInPattern", - ] + ], }, { }, function (opts, task) { diff --git a/packages/babel-preset-es2016/src/index.js b/packages/babel-preset-es2016/src/index.js index e0857e59c2..ae2a519918 100644 --- a/packages/babel-preset-es2016/src/index.js +++ b/packages/babel-preset-es2016/src/index.js @@ -3,7 +3,7 @@ import transformExponentiationOperator from "babel-plugin-transform-exponentiati export default function () { return { plugins: [ - transformExponentiationOperator - ] + transformExponentiationOperator, + ], }; } diff --git a/packages/babel-preset-es2017/src/index.js b/packages/babel-preset-es2017/src/index.js index 599186b002..735e5aaf57 100644 --- a/packages/babel-preset-es2017/src/index.js +++ b/packages/babel-preset-es2017/src/index.js @@ -5,7 +5,7 @@ export default function () { return { plugins: [ syntaxTrailingFunctionCommas, - transformAsyncToGenerator - ] + transformAsyncToGenerator, + ], }; } diff --git a/packages/babel-preset-flow/src/index.js b/packages/babel-preset-flow/src/index.js index ef847d5f57..84a144a560 100644 --- a/packages/babel-preset-flow/src/index.js +++ b/packages/babel-preset-flow/src/index.js @@ -3,7 +3,7 @@ import transformFlowStripTypes from "babel-plugin-transform-flow-strip-types"; export default function () { return { plugins: [ - transformFlowStripTypes - ] + transformFlowStripTypes, + ], }; } diff --git a/packages/babel-preset-latest/src/index.js b/packages/babel-preset-latest/src/index.js index 5469c2146d..1ef36d8279 100644 --- a/packages/babel-preset-latest/src/index.js +++ b/packages/babel-preset-latest/src/index.js @@ -7,7 +7,7 @@ export default function (context, opts = {}) { presets: [ opts.es2015 !== false && [presetES2015, opts.es2015], opts.es2016 !== false && presetES2016, - opts.es2017 !== false && presetES2017 - ].filter(Boolean) // filter out falsy values + opts.es2017 !== false && presetES2017, + ].filter(Boolean), // filter out falsy values }; } diff --git a/packages/babel-preset-react/src/index.js b/packages/babel-preset-react/src/index.js index 7f30145f70..5b953685aa 100644 --- a/packages/babel-preset-react/src/index.js +++ b/packages/babel-preset-react/src/index.js @@ -10,20 +10,20 @@ import transformReactDisplayName from "babel-plugin-transform-react-display-name export default function () { return { presets: [ - presetFlow + presetFlow, ], plugins: [ transformReactJSX, transformSyntaxJSX, - transformReactDisplayName + transformReactDisplayName, ], env: { development: { plugins: [ // transformReactJSXSource, // transformReactJSXSelf - ] - } - } + ], + }, + }, }; } diff --git a/packages/babel-preset-stage-0/src/index.js b/packages/babel-preset-stage-0/src/index.js index f134ea884c..7ac934304b 100644 --- a/packages/babel-preset-stage-0/src/index.js +++ b/packages/babel-preset-stage-0/src/index.js @@ -6,11 +6,11 @@ import transformFunctionBind from "babel-plugin-transform-function-bind"; export default function () { return { presets: [ - presetStage1 + presetStage1, ], plugins: [ transformDoExpressions, - transformFunctionBind - ] + transformFunctionBind, + ], }; } diff --git a/packages/babel-preset-stage-1/src/index.js b/packages/babel-preset-stage-1/src/index.js index 9ab261e3c9..15000e690b 100644 --- a/packages/babel-preset-stage-1/src/index.js +++ b/packages/babel-preset-stage-1/src/index.js @@ -6,11 +6,11 @@ import transformExportExtensions from "babel-plugin-transform-export-extensions" export default function () { return { presets: [ - presetStage2 + presetStage2, ], plugins: [ transformDecorators, - transformExportExtensions - ] + transformExportExtensions, + ], }; } diff --git a/packages/babel-preset-stage-2/src/index.js b/packages/babel-preset-stage-2/src/index.js index 9f251fc38c..d927345d74 100644 --- a/packages/babel-preset-stage-2/src/index.js +++ b/packages/babel-preset-stage-2/src/index.js @@ -7,12 +7,12 @@ import transformUnicodePropertyRegex from "babel-plugin-transform-unicode-proper export default function () { return { presets: [ - presetStage3 + presetStage3, ], plugins: [ syntaxDynamicImport, transformClassProperties, - transformUnicodePropertyRegex - ] + transformUnicodePropertyRegex, + ], }; } diff --git a/packages/babel-preset-stage-3/src/index.js b/packages/babel-preset-stage-3/src/index.js index 20c6c49393..62b4854a52 100644 --- a/packages/babel-preset-stage-3/src/index.js +++ b/packages/babel-preset-stage-3/src/index.js @@ -5,7 +5,7 @@ export default function () { return { plugins: [ transformAsyncGeneratorFunctions, - transformObjectRestSpread - ] + transformObjectRestSpread, + ], }; } diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 87f92d7a24..a98d593bcc 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -9,18 +9,18 @@ import path from "path"; sourceMapSupport.install({ handleUncaughtExceptions: false, - environment : "node", + environment: "node", retrieveSourceMap(source) { const map = maps && maps[source]; if (map) { return { url: null, - map: map + map: map, }; } else { return null; } - } + }, }); registerCache.load(); @@ -31,8 +31,8 @@ const transformOpts = {}; let ignore; let only; -let oldHandlers = {}; -const maps = {}; +let oldHandlers = {}; +const maps = {}; const cwd = process.cwd(); @@ -72,7 +72,7 @@ function compile(filename) { // calls above and would introduce duplicates. babelrc: false, sourceMaps: "both", - ast: false + ast: false, })); } diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index 83494cd6f4..3b33f1247a 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -106,6 +106,6 @@ const templateVisitor = { exit({ node }) { if (!node.loc) - traverse.clearNode(node); - } + {traverse.clearNode(node);} + }, }; diff --git a/packages/babel-traverse/src/context.js b/packages/babel-traverse/src/context.js index 3be2d90f85..59ac4817c4 100644 --- a/packages/babel-traverse/src/context.js +++ b/packages/babel-traverse/src/context.js @@ -6,9 +6,9 @@ const testing = process.env.NODE_ENV === "test"; export default class TraversalContext { constructor(scope, opts, state, parentPath) { this.parentPath = parentPath; - this.scope = scope; - this.state = state; - this.opts = opts; + this.scope = scope; + this.state = state; + this.opts = opts; } parentPath: NodePath; @@ -47,7 +47,7 @@ export default class TraversalContext { parent: node, container: obj, key: key, - listKey + listKey, }); } @@ -85,7 +85,7 @@ export default class TraversalContext { visitSingle(node, key): boolean { if (this.shouldVisit(node[key])) { return this.visitQueue([ - this.create(node, node, key) + this.create(node, node, key), ]); } else { return false; diff --git a/packages/babel-traverse/src/index.js b/packages/babel-traverse/src/index.js index 1c5c96b58c..1293dff45e 100644 --- a/packages/babel-traverse/src/index.js +++ b/packages/babel-traverse/src/index.js @@ -36,8 +36,8 @@ traverse.verify = visitors.verify; traverse.explode = visitors.explode; traverse.NodePath = require("./path"); -traverse.Scope = require("./scope"); -traverse.Hub = require("./hub"); +traverse.Scope = require("./scope"); +traverse.Hub = require("./hub"); traverse.cheap = function (node, enter) { return t.traverseFast(node, enter); @@ -92,13 +92,13 @@ traverse.hasType = function ( if (tree.type === type) return true; const state = { - has: false, - type: type + has: false, + type: type, }; traverse(tree, { blacklist: blacklistTypes, - enter: hasBlacklistedType + enter: hasBlacklistedType, }, scope, state); return state.has; diff --git a/packages/babel-traverse/src/path/comments.js b/packages/babel-traverse/src/path/comments.js index 8aec4d5fa5..ab2bda2cec 100644 --- a/packages/babel-traverse/src/path/comments.js +++ b/packages/babel-traverse/src/path/comments.js @@ -12,7 +12,7 @@ export function shareCommentsWithSiblings() { if (!node) return; const trailing = node.trailingComments; - const leading = node.leadingComments; + const leading = node.leadingComments; if (!trailing && !leading) return; let prev = this.getSibling(this.key - 1); @@ -28,7 +28,7 @@ export function shareCommentsWithSiblings() { export function addComment(type, content, line?) { this.addComments(type, [{ type: line ? "CommentLine" : "CommentBlock", - value: content + value: content, }]); } diff --git a/packages/babel-traverse/src/path/context.js b/packages/babel-traverse/src/path/context.js index c74cb356dd..3f393b6680 100644 --- a/packages/babel-traverse/src/path/context.js +++ b/packages/babel-traverse/src/path/context.js @@ -105,13 +105,13 @@ export function setScope() { export function setContext(context) { this.shouldSkip = false; this.shouldStop = false; - this.removed = false; - this.skipKeys = {}; + this.removed = false; + this.skipKeys = {}; if (context) { this.context = context; - this.state = context.state; - this.opts = context.opts; + this.state = context.state; + this.opts = context.opts; } this.setScope(); @@ -193,8 +193,8 @@ export function pushContext(context) { } export function setup(parentPath, container, listKey, key) { - this.inList = !!listKey; - this.listKey = listKey; + this.inList = !!listKey; + this.listKey = listKey; this.parentKey = listKey || key; this.container = container; @@ -203,7 +203,7 @@ export function setup(parentPath, container, listKey, key) { } export function setKey(key) { - this.key = key; + this.key = key; this.node = this.container[this.key]; this.type = this.node && this.node.type; } diff --git a/packages/babel-traverse/src/path/evaluation.js b/packages/babel-traverse/src/path/evaluation.js index e1ce48006b..f28a1e148e 100644 --- a/packages/babel-traverse/src/path/evaluation.js +++ b/packages/babel-traverse/src/path/evaluation.js @@ -58,8 +58,8 @@ export function evaluate(): { confident: boolean; value: any } { if (!confident) value = undefined; return { confident: confident, - deopt: deoptPath, - value: value + deopt: deoptPath, + value: value, }; // we wrap the _evaluate method so we can track `seen` nodes, we push an item diff --git a/packages/babel-traverse/src/path/family.js b/packages/babel-traverse/src/path/family.js index 3af5c1e022..f1fe88dd54 100644 --- a/packages/babel-traverse/src/path/family.js +++ b/packages/babel-traverse/src/path/family.js @@ -63,7 +63,7 @@ export function getSibling(key): NodePath { parent: this.parent, container: this.container, listKey: this.listKey, - key: key + key: key, }); } @@ -108,7 +108,7 @@ export function get(key: string, context?: boolean | TraversalContext): NodePath } export function _getKey(key, context?) { - const node = this.node; + const node = this.node; const container = node[key]; if (Array.isArray(container)) { @@ -119,7 +119,7 @@ export function _getKey(key, context?) { parentPath: this, parent: node, container: container, - key: i + key: i, }).setContext(context); }); } else { @@ -127,7 +127,7 @@ export function _getKey(key, context?) { parentPath: this, parent: node, container: node, - key: key + key: key, }).setContext(context); } } diff --git a/packages/babel-traverse/src/path/index.js b/packages/babel-traverse/src/path/index.js index 45200a3504..b5bdba44a4 100644 --- a/packages/babel-traverse/src/path/index.js +++ b/packages/babel-traverse/src/path/index.js @@ -137,7 +137,7 @@ export default class NodePath { this.hub.file.metadata.marked.push({ type, message, - loc: this.node.loc + loc: this.node.loc, }); } diff --git a/packages/babel-traverse/src/path/inference/index.js b/packages/babel-traverse/src/path/inference/index.js index 976d327082..c782b2779f 100644 --- a/packages/babel-traverse/src/path/inference/index.js +++ b/packages/babel-traverse/src/path/inference/index.js @@ -24,7 +24,7 @@ export function _getTypeAnnotation(): ?Object { if (!node) { // handle initializerless variables, add in checks for loop initializers too if (this.key === "init" && this.parentPath.isVariableDeclarator()) { - const declar = this.parentPath.parentPath; + const declar = this.parentPath.parentPath; const declarParent = declar.parentPath; // for (let NODE in bar) {} diff --git a/packages/babel-traverse/src/path/inference/inferer-reference.js b/packages/babel-traverse/src/path/inference/inferer-reference.js index 16effb0943..9b95794a75 100644 --- a/packages/babel-traverse/src/path/inference/inferer-reference.js +++ b/packages/babel-traverse/src/path/inference/inferer-reference.js @@ -101,7 +101,7 @@ function inferAnnotationFromBinaryExpression(name, path) { const operator = path.node.operator; const right = path.get("right").resolve(); - const left = path.get("left").resolve(); + const left = path.get("left").resolve(); let target; if (left.isIdentifier({ name })) { @@ -167,7 +167,7 @@ function getConditionalAnnotation(path, name) { const ifStatement = getParentConditionalPath(path); if (!ifStatement) return; - const test = ifStatement.get("test"); + const test = ifStatement.get("test"); const paths = [test]; const types = []; @@ -188,7 +188,7 @@ function getConditionalAnnotation(path, name) { if (types.length) { return { typeAnnotation: t.createUnionTypeAnnotation(types), - ifStatement + ifStatement, }; } else { return getConditionalAnnotation(ifStatement, name); diff --git a/packages/babel-traverse/src/path/inference/inferers.js b/packages/babel-traverse/src/path/inference/inferers.js index be90de0cc0..da481e4894 100644 --- a/packages/babel-traverse/src/path/inference/inferers.js +++ b/packages/babel-traverse/src/path/inference/inferers.js @@ -52,7 +52,7 @@ export function BinaryExpression(node) { return t.booleanTypeAnnotation(); } else if (operator === "+") { const right = this.get("right"); - const left = this.get("left"); + const left = this.get("left"); if (left.isBaseType("number") && right.isBaseType("number")) { // both numbers so this will be a number @@ -65,7 +65,7 @@ export function BinaryExpression(node) { // unsure if left and right are strings or numbers so stay on the safe side return t.unionTypeAnnotation([ t.stringTypeAnnotation(), - t.numberTypeAnnotation() + t.numberTypeAnnotation(), ]); } } @@ -73,14 +73,14 @@ export function BinaryExpression(node) { export function LogicalExpression() { return t.createUnionTypeAnnotation([ this.get("left").getTypeAnnotation(), - this.get("right").getTypeAnnotation() + this.get("right").getTypeAnnotation(), ]); } export function ConditionalExpression() { return t.createUnionTypeAnnotation([ this.get("consequent").getTypeAnnotation(), - this.get("alternate").getTypeAnnotation() + this.get("alternate").getTypeAnnotation(), ]); } @@ -142,7 +142,7 @@ export { Func as ArrowFunctionExpression, Func as FunctionDeclaration, Func as ClassExpression, - Func as ClassDeclaration + Func as ClassDeclaration, }; export function CallExpression() { diff --git a/packages/babel-traverse/src/path/introspection.js b/packages/babel-traverse/src/path/introspection.js index e8e54f18c0..9b7e7f9813 100644 --- a/packages/babel-traverse/src/path/introspection.js +++ b/packages/babel-traverse/src/path/introspection.js @@ -271,7 +271,7 @@ export function _guessExecutionStatusRelativeTo(target) { const targetPaths = target.getAncestry(); if (targetPaths.indexOf(this) >= 0) return "after"; - const selfPaths = this.getAncestry(); + const selfPaths = this.getAncestry(); // get ancestor where the branches intersect let commonPath; @@ -291,7 +291,7 @@ export function _guessExecutionStatusRelativeTo(target) { // get the relationship paths that associate these nodes to their common ancestor const targetRelationship = targetPaths[targetIndex - 1]; - const selfRelationship = selfPaths[selfIndex - 1]; + const selfRelationship = selfPaths[selfIndex - 1]; if (!targetRelationship || !selfRelationship) { return "before"; } @@ -303,7 +303,7 @@ export function _guessExecutionStatusRelativeTo(target) { // otherwise we're associated by a parent node, check which key comes before the other const targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key); - const selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); + const selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key); return targetKeyPosition > selfKeyPosition ? "before" : "after"; } diff --git a/packages/babel-traverse/src/path/lib/hoister.js b/packages/babel-traverse/src/path/lib/hoister.js index 69154bbc2d..0a942ecc10 100644 --- a/packages/babel-traverse/src/path/lib/hoister.js +++ b/packages/babel-traverse/src/path/lib/hoister.js @@ -32,7 +32,7 @@ const referenceVisitor = { if (binding !== state.scope.getBinding(path.node.name)) return; state.bindings[path.node.name] = binding; - } + }, }; export default class PathHoister { @@ -40,15 +40,15 @@ export default class PathHoister { // Storage for scopes we can't hoist above. this.breakOnScopePaths = []; // Storage for bindings that may affect what path we can hoist to. - this.bindings = {}; + this.bindings = {}; // Storage for eligible scopes. - this.scopes = []; + this.scopes = []; // Our original scope and path. - this.scope = scope; - this.path = path; + this.scope = scope; + this.path = path; // By default, we attach as far up as we can; but if we're trying // to avoid referencing a binding, we may have to go after. - this.attachAfter = false; + this.attachAfter = false; } // A scope is compatible if all required bindings are reachable. @@ -160,7 +160,7 @@ export default class PathHoister { (path.isVariableDeclarator() && path.parentPath.node !== null && path.parentPath.node.declarations.length > 1)) - return path; + {return path;} } while ((path = path.parentPath)); } @@ -198,7 +198,7 @@ export default class PathHoister { const insertFn = this.attachAfter ? "insertAfter" : "insertBefore"; attachTo[insertFn]([ - attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator]) + attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator]), ]); const parent = this.path.parentPath; diff --git a/packages/babel-traverse/src/path/lib/removal-hooks.js b/packages/babel-traverse/src/path/lib/removal-hooks.js index 73341ae651..bd720222dd 100644 --- a/packages/babel-traverse/src/path/lib/removal-hooks.js +++ b/packages/babel-traverse/src/path/lib/removal-hooks.js @@ -67,9 +67,9 @@ export const hooks = [ ) { self.replaceWith({ type: "BlockStatement", - body: [] + body: [], }); return true; } - } + }, ]; diff --git a/packages/babel-traverse/src/path/lib/virtual-types.js b/packages/babel-traverse/src/path/lib/virtual-types.js index 4d287b6f3d..7bc4e1e2cb 100644 --- a/packages/babel-traverse/src/path/lib/virtual-types.js +++ b/packages/babel-traverse/src/path/lib/virtual-types.js @@ -16,21 +16,21 @@ export const ReferencedIdentifier = { // check if node is referenced return t.isReferenced(node, parent); - } + }, }; export const ReferencedMemberExpression = { types: ["MemberExpression"], checkPath({ node, parent }) { return t.isMemberExpression(node) && t.isReferenced(node, parent); - } + }, }; export const BindingIdentifier = { types: ["Identifier"], checkPath({ node, parent }: NodePath): boolean { return t.isIdentifier(node) && t.isBinding(node, parent); - } + }, }; export const Statement = { @@ -46,7 +46,7 @@ export const Statement = { } else { return false; } - } + }, }; export const Expression = { @@ -57,51 +57,51 @@ export const Expression = { } else { return t.isExpression(path.node); } - } + }, }; export const Scope = { types: ["Scopable"], checkPath(path) { return t.isScope(path.node, path.parent); - } + }, }; export const Referenced = { checkPath(path: NodePath): boolean { return t.isReferenced(path.node, path.parent); - } + }, }; export const BlockScoped = { checkPath(path: NodePath): boolean { return t.isBlockScoped(path.node); - } + }, }; export const Var = { types: ["VariableDeclaration"], checkPath(path: NodePath): boolean { return t.isVar(path.node); - } + }, }; export const User = { checkPath(path: NodePath): boolean { return path.node && !!path.node.loc; - } + }, }; export const Generated = { checkPath(path: NodePath): boolean { return !path.isUser(); - } + }, }; export const Pure = { checkPath(path: NodePath, opts?): boolean { return path.scope.isPure(path.node, opts); - } + }, }; export const Flow = { @@ -118,7 +118,7 @@ export const Flow = { } else { return false; } - } + }, }; // TODO: 7.0 Backwards Compat @@ -137,16 +137,16 @@ export const SpreadProperty = { }; export const ExistentialTypeParam = { - types: ["ExistsTypeAnnotation"] + types: ["ExistsTypeAnnotation"], }; export const NumericLiteralTypeAnnotation = { - types: ["NumberLiteralTypeAnnotation"] + types: ["NumberLiteralTypeAnnotation"], }; export const ForAwaitStatement = { types: ["ForOfStatement"], checkPath({ node }: NodePath): boolean { return node.await === true; - } + }, }; diff --git a/packages/babel-traverse/src/path/modification.js b/packages/babel-traverse/src/path/modification.js index 9df7ecc873..052cd1afec 100644 --- a/packages/babel-traverse/src/path/modification.js +++ b/packages/babel-traverse/src/path/modification.js @@ -62,7 +62,7 @@ export function _containerInsert(from, nodes) { parent: this.parent, container: this.container, listKey: this.listKey, - key: to + key: to, })); } } @@ -197,7 +197,7 @@ export function unshiftContainer(listKey, nodes) { parent: this.node, container: this.node[listKey], listKey, - key: 0 + key: 0, }); return path.insertBefore(nodes); @@ -217,7 +217,7 @@ export function pushContainer(listKey, nodes) { parent: this.node, container: container, listKey, - key: container.length + key: container.length, }); return path.replaceWithMultiple(nodes); diff --git a/packages/babel-traverse/src/path/removal.js b/packages/babel-traverse/src/path/removal.js index 76556e92eb..6f6701ceee 100644 --- a/packages/babel-traverse/src/path/removal.js +++ b/packages/babel-traverse/src/path/removal.js @@ -34,8 +34,8 @@ export function _remove() { export function _markRemoved() { this.shouldSkip = true; - this.removed = true; - this.node = null; + this.removed = true; + this.node = null; } export function _assertUnremoved() { diff --git a/packages/babel-traverse/src/path/replacement.js b/packages/babel-traverse/src/path/replacement.js index 47e706d0d2..a2028e6d8b 100644 --- a/packages/babel-traverse/src/path/replacement.js +++ b/packages/babel-traverse/src/path/replacement.js @@ -30,7 +30,7 @@ const hoistVariablesVisitor = { } path.replaceWithMultiple(exprs); - } + }, }; /** diff --git a/packages/babel-traverse/src/scope/binding.js b/packages/babel-traverse/src/scope/binding.js index 32cfe54b99..3edd9407d4 100644 --- a/packages/babel-traverse/src/scope/binding.js +++ b/packages/babel-traverse/src/scope/binding.js @@ -14,9 +14,9 @@ import type NodePath from "../path"; export default class Binding { constructor({ existing, identifier, scope, path, kind }) { this.identifier = identifier; - this.scope = scope; - this.path = path; - this.kind = kind; + this.scope = scope; + this.path = path; + this.kind = kind; this.constantViolations = []; this.constant = true; @@ -56,13 +56,13 @@ export default class Binding { setValue(value: any) { if (this.hasDeoptedValue) return; this.hasValue = true; - this.value = value; + this.value = value; } clearValue() { this.hasDeoptedValue = false; - this.hasValue = false; - this.value = null; + this.hasValue = false; + this.value = null; } /** diff --git a/packages/babel-traverse/src/scope/index.js b/packages/babel-traverse/src/scope/index.js index a0b26bc573..4b03b0b7c5 100644 --- a/packages/babel-traverse/src/scope/index.js +++ b/packages/babel-traverse/src/scope/index.js @@ -119,7 +119,7 @@ const collectorVisitor = { } } } - } + }, }, LabeledStatement(path) { @@ -162,7 +162,7 @@ const collectorVisitor = { path.scope.getBlockParent().registerDeclaration(bodyPath); } } - } + }, }; let uid = 0; @@ -184,13 +184,13 @@ export default class Scope { this.uid = uid++; this.parent = parentScope; - this.hub = path.hub; + this.hub = path.hub; this.parentBlock = path.parent; - this.block = path.node; - this.path = path; + this.block = path.node; + this.path = path; - this.labels = new Map(); + this.labels = new Map(); } /** @@ -207,7 +207,7 @@ export default class Scope { "arguments", "undefined", "Infinity", - "NaN" + "NaN", ]; /** @@ -271,7 +271,7 @@ export default class Scope { * Generate a unique identifier based on a node. */ - generateUidIdentifierBasedOnNode(parent: Object, defaultName?: String): Object { + generateUidIdentifierBasedOnNode(parent: Object, defaultName?: String): Object { let node = parent; if (t.isAssignmentExpression(parent)) { @@ -377,7 +377,7 @@ export default class Scope { constant: binding.constant, references: binding.references, violations: binding.constantViolations.length, - kind: binding.kind + kind: binding.kind, }); } } while (scope = scope.parent); @@ -513,10 +513,10 @@ export default class Scope { this.bindings[name] = new Binding({ identifier: id, - existing: local, - scope: this, - path: bindingPath, - kind: kind + existing: local, + scope: this, + path: bindingPath, + kind: kind, }); } } @@ -645,10 +645,10 @@ export default class Scope { // this.references = Object.create(null); - this.bindings = Object.create(null); - this.globals = Object.create(null); - this.uids = Object.create(null); - this.data = Object.create(null); + this.bindings = Object.create(null); + this.globals = Object.create(null); + this.uids = Object.create(null); + this.data = Object.create(null); // ForStatement - left, init @@ -713,7 +713,7 @@ export default class Scope { for (const name in ids) { if (path.scope.getBinding(name)) continue; - programParent = programParent || path.scope.getProgramParent(); + programParent = programParent || path.scope.getProgramParent(); programParent.addGlobal(ids[name]); } @@ -760,11 +760,11 @@ export default class Scope { } const unique = opts.unique; - const kind = opts.kind || "var"; + const kind = opts.kind || "var"; const blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist; const dataKey = `declaration:${kind}:${blockHoist}`; - let declarPath = !unique && path.getData(dataKey); + let declarPath = !unique && path.getData(dataKey); if (!declarPath) { const declar = t.variableDeclaration(kind, []); diff --git a/packages/babel-traverse/src/scope/lib/renamer.js b/packages/babel-traverse/src/scope/lib/renamer.js index 1f05cb221a..2079192e1c 100644 --- a/packages/babel-traverse/src/scope/lib/renamer.js +++ b/packages/babel-traverse/src/scope/lib/renamer.js @@ -20,7 +20,7 @@ const renameVisitor = { for (const name in ids) { if (name === state.oldName) ids[name].name = state.newName; } - } + }, }; export default class Renamer { @@ -82,7 +82,7 @@ export default class Renamer { path.node._blockHoist = 3; path.replaceWith(t.variableDeclaration("let", [ - t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node)) + t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node)), ])); } @@ -97,7 +97,7 @@ export default class Renamer { path.node.id = t.identifier(this.oldName); this.binding.scope.parent.push({ - id: t.identifier(this.newName) + id: t.identifier(this.newName), }); path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node)); diff --git a/packages/babel-traverse/test/ancestry.js b/packages/babel-traverse/test/ancestry.js index 8d8f013948..d3587a71d0 100644 --- a/packages/babel-traverse/test/ancestry.js +++ b/packages/babel-traverse/test/ancestry.js @@ -24,7 +24,7 @@ describe("path/ancestry", function () { traverse(ast, { "Program|NumericLiteral|StringLiteral"(path) { paths.push(path); - } + }, }); const [ , numberPath, stringPath ] = paths; @@ -54,7 +54,7 @@ describe("path/ancestry", function () { traverse(ast, { "Program|NumericLiteral|StringLiteral"(path) { paths.push(path); - } + }, }); const [ , numberPath, stringPath ] = paths; diff --git a/packages/babel-traverse/test/evaluation.js b/packages/babel-traverse/test/evaluation.js index 148173fa7d..1269f7c013 100644 --- a/packages/babel-traverse/test/evaluation.js +++ b/packages/babel-traverse/test/evaluation.js @@ -9,7 +9,7 @@ function getPath(code) { Program: function (_path) { path = _path; _path.stop(); - } + }, }); return path; } diff --git a/packages/babel-traverse/test/family.js b/packages/babel-traverse/test/family.js index 6c34906c44..f261d4b87e 100644 --- a/packages/babel-traverse/test/family.js +++ b/packages/babel-traverse/test/family.js @@ -14,7 +14,7 @@ describe("path/family", function () { FunctionDeclaration(path) { outerNodes = path.getOuterBindingIdentifiers(); outerPaths = path.getOuterBindingIdentifierPaths(); - } + }, }); it("should contain keys of nodes in paths", function () { @@ -61,7 +61,7 @@ describe("path/family", function () { VariableDeclaration(path) { sibling = path.getSibling(path.key); lastSibling = sibling.getNextSibling().getNextSibling(); - } + }, }); it("should return traverse sibling nodes", function () { diff --git a/packages/babel-traverse/test/inference.js b/packages/babel-traverse/test/inference.js index 03ff842ecf..7fe06584d5 100644 --- a/packages/babel-traverse/test/inference.js +++ b/packages/babel-traverse/test/inference.js @@ -10,7 +10,7 @@ function getPath(code) { Program: function (_path) { path = _path; _path.stop(); - } + }, }); return path; } diff --git a/packages/babel-traverse/test/removal.js b/packages/babel-traverse/test/removal.js index d09091db0e..a2a43acd34 100644 --- a/packages/babel-traverse/test/removal.js +++ b/packages/babel-traverse/test/removal.js @@ -10,7 +10,7 @@ function getPath(code) { Program: function (_path) { path = _path; _path.stop(); - } + }, }); return path; diff --git a/packages/babel-traverse/test/scope.js b/packages/babel-traverse/test/scope.js index ac6e251c26..75a01c7cdd 100644 --- a/packages/babel-traverse/test/scope.js +++ b/packages/babel-traverse/test/scope.js @@ -9,7 +9,7 @@ function getPath(code) { Program: function (_path) { path = _path; _path.stop(); - } + }, }); return path; } @@ -21,7 +21,7 @@ function getIdentifierPath(code) { Identifier: function(path) { nodePath = path; path.stop(); - } + }, }); return nodePath; @@ -85,8 +85,8 @@ describe("scope", function () { const path = getIdentifierPath("function square(n) { return n * n}"); const referencePaths = path.context.scope.bindings.n.referencePaths; assert.equal(referencePaths.length, 2); - assert.deepEqual(referencePaths[0].node.loc.start, { line: 1, column:28 }); - assert.deepEqual(referencePaths[1].node.loc.start, { line: 1, column:32 }); + assert.deepEqual(referencePaths[0].node.loc.start, { line: 1, column: 28 }); + assert.deepEqual(referencePaths[1].node.loc.start, { line: 1, column: 32 }); }); }); }); diff --git a/packages/babel-traverse/test/traverse.js b/packages/babel-traverse/test/traverse.js index 5434620947..57f6a343c4 100644 --- a/packages/babel-traverse/test/traverse.js +++ b/packages/babel-traverse/test/traverse.js @@ -1,7 +1,7 @@ const cloneDeep = require("lodash/cloneDeep"); -const traverse = require("../lib").default; -const assert = require("assert"); -const parse = require("babylon").parse; +const traverse = require("../lib").default; +const assert = require("assert"); +const parse = require("babylon").parse; describe("traverse", function () { const code = ` @@ -15,14 +15,14 @@ describe("traverse", function () { it("traverse replace", function () { const replacement = { type: "StringLiteral", - value: "foo" + value: "foo", }; const ast2 = cloneDeep(program); traverse(ast2, { enter: function (path) { if (path.node.type === "ThisExpression") path.replaceWith(replacement); - } + }, }); assert.equal(ast2.body[1].expression.left.object, replacement); @@ -32,7 +32,7 @@ describe("traverse", function () { const expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, body[1], body[1].expression, body[1].expression.left, body[1].expression.left.object, - body[1].expression.left.property, body[1].expression.right + body[1].expression.left.property, body[1].expression.right, ]; const actual = []; @@ -40,7 +40,7 @@ describe("traverse", function () { traverse(program, { enter: function (path) { actual.push(path.node); - } + }, }); assert.deepEqual(actual, expect); @@ -50,14 +50,14 @@ describe("traverse", function () { traverse(null, { enter: function () { throw new Error("should not be ran"); - } + }, }); }); it("traverse blacklistTypes", function () { const expect = [ body[0], body[0].declarations[0], body[0].declarations[0].id, body[0].declarations[0].init, - body[1], body[1].expression, body[1].expression.right + body[1], body[1].expression, body[1].expression.right, ]; const actual = []; @@ -66,7 +66,7 @@ describe("traverse", function () { blacklist: ["MemberExpression"], enter: function (path) { actual.push(path.node); - } + }, }); assert.deepEqual(actual, expect); @@ -93,7 +93,7 @@ describe("traverse", function () { scopes.push(path.scope); paths.push(path); path.stop(); - } + }, }); traverse.clearCache(); @@ -105,7 +105,7 @@ describe("traverse", function () { scopes2.push(path.scope); paths2.push(path); path.stop(); - } + }, }); scopes2.forEach(function (_, i) { @@ -119,7 +119,7 @@ describe("traverse", function () { traverse(ast, { enter(path) { paths.push(path); - } + }, }); traverse.clearCache.clearPath(); @@ -128,7 +128,7 @@ describe("traverse", function () { traverse(ast, { enter(path) { paths2.push(path); - } + }, }); paths2.forEach(function (p, i) { @@ -142,7 +142,7 @@ describe("traverse", function () { enter(path) { scopes.push(path.scope); path.stop(); - } + }, }); traverse.clearCache.clearScope(); @@ -152,7 +152,7 @@ describe("traverse", function () { enter(path) { scopes2.push(path.scope); path.stop(); - } + }, }); scopes2.forEach(function (p, i) { diff --git a/packages/babel-types/src/constants.js b/packages/babel-types/src/constants.js index 1ed965382e..84c2aec646 100644 --- a/packages/babel-types/src/constants.js +++ b/packages/babel-types/src/constants.js @@ -1,28 +1,28 @@ /* eslint max-len: "off" */ export const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; -export const FLATTENABLE_KEYS = ["body", "expressions"]; -export const FOR_INIT_KEYS = ["left", "init"]; -export const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; +export const FLATTENABLE_KEYS = ["body", "expressions"]; +export const FOR_INIT_KEYS = ["left", "init"]; +export const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"]; export const LOGICAL_OPERATORS = ["||", "&&"]; -export const UPDATE_OPERATORS = ["++", "--"]; +export const UPDATE_OPERATORS = ["++", "--"]; export const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="]; -export const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; -export const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"]; -export const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS]; -export const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; -export const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS]; +export const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="]; +export const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"]; +export const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS]; +export const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"]; +export const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS]; export const BOOLEAN_UNARY_OPERATORS = ["delete", "!"]; -export const NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; -export const STRING_UNARY_OPERATORS = ["typeof"]; -export const UNARY_OPERATORS = ["void", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS]; +export const NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"]; +export const STRING_UNARY_OPERATORS = ["typeof"]; +export const UNARY_OPERATORS = ["void", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS]; export const INHERIT_KEYS = { optional: ["typeAnnotation", "typeParameters", "returnType"], - force: ["start", "loc", "end"] + force: ["start", "loc", "end"], }; export const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); diff --git a/packages/babel-types/src/converters.js b/packages/babel-types/src/converters.js index d18ea38af7..686ac2d419 100644 --- a/packages/babel-types/src/converters.js +++ b/packages/babel-types/src/converters.js @@ -23,7 +23,7 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec if (!nodes || !nodes.length) return; const declars = []; - let bailed = false; + let bailed = false; const result = convert(nodes); if (bailed) return; @@ -36,7 +36,7 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec function convert(nodes) { let ensureLastUndefined = false; - const exprs = []; + const exprs = []; for (const node of (nodes: Array)) { if (t.isExpression(node)) { @@ -51,7 +51,7 @@ export function toSequenceExpression(nodes: Array, scope: Scope): ?Objec for (const key in bindings) { declars.push({ kind: node.kind, - id: bindings[key] + id: bindings[key], }); } diff --git a/packages/babel-types/src/definitions/core.js b/packages/babel-types/src/definitions/core.js index 8daef2c492..1e206ac50e 100644 --- a/packages/babel-types/src/definitions/core.js +++ b/packages/babel-types/src/definitions/core.js @@ -26,62 +26,62 @@ defineType("ArrayExpression", { assertEach(assertNodeOrValueType("null", "Expression", "SpreadElement")) ), default: [], - } + }, }, visitor: ["elements"], - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("AssignmentExpression", { fields: { operator: { - validate: assertValueType("string") + validate: assertValueType("string"), }, left: { - validate: assertNodeType("LVal") + validate: assertNodeType("LVal"), }, right: { - validate: assertNodeType("Expression") - } + validate: assertNodeType("Expression"), + }, }, builder: ["operator", "left", "right"], visitor: ["left", "right"], - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("BinaryExpression", { builder: ["operator", "left", "right"], fields: { operator: { - validate: assertOneOf(...BINARY_OPERATORS) + validate: assertOneOf(...BINARY_OPERATORS), }, left: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, right: { - validate: assertNodeType("Expression") - } + validate: assertNodeType("Expression"), + }, }, visitor: ["left", "right"], - aliases: ["Binary", "Expression"] + aliases: ["Binary", "Expression"], }); defineType("Directive", { visitor: ["value"], fields: { value: { - validate: assertNodeType("DirectiveLiteral") - } - } + validate: assertNodeType("DirectiveLiteral"), + }, + }, }); defineType("DirectiveLiteral", { builder: ["value"], fields: { value: { - validate: assertValueType("string") - } - } + validate: assertValueType("string"), + }, + }, }); defineType("BlockStatement", { @@ -90,13 +90,13 @@ defineType("BlockStatement", { fields: { directives: { validate: chain(assertValueType("array"), assertEach(assertNodeType("Directive"))), - default: [] + default: [], }, body: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))) - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))), + }, }, - aliases: ["Scopable", "BlockParent", "Block", "Statement"] + aliases: ["Scopable", "BlockParent", "Block", "Statement"], }); defineType("BreakStatement", { @@ -104,52 +104,52 @@ defineType("BreakStatement", { fields: { label: { validate: assertNodeType("Identifier"), - optional: true - } + optional: true, + }, }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] + aliases: ["Statement", "Terminatorless", "CompletionStatement"], }); defineType("CallExpression", { visitor: ["callee", "arguments"], fields: { callee: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, arguments: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement"))) - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement"))), + }, }, - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("CatchClause", { visitor: ["param", "body"], fields: { param: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, body: { - validate: assertNodeType("BlockStatement") - } + validate: assertNodeType("BlockStatement"), + }, }, - aliases: ["Scopable"] + aliases: ["Scopable"], }); defineType("ConditionalExpression", { visitor: ["test", "consequent", "alternate"], fields: { test: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, consequent: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, alternate: { - validate: assertNodeType("Expression") - } + validate: assertNodeType("Expression"), + }, }, - aliases: ["Expression", "Conditional"] + aliases: ["Expression", "Conditional"], }); defineType("ContinueStatement", { @@ -157,41 +157,41 @@ defineType("ContinueStatement", { fields: { label: { validate: assertNodeType("Identifier"), - optional: true - } + optional: true, + }, }, - aliases: ["Statement", "Terminatorless", "CompletionStatement"] + aliases: ["Statement", "Terminatorless", "CompletionStatement"], }); defineType("DebuggerStatement", { - aliases: ["Statement"] + aliases: ["Statement"], }); defineType("DoWhileStatement", { visitor: ["test", "body"], fields: { test: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("Statement") - } + validate: assertNodeType("Statement"), + }, }, - aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"] + aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], }); defineType("EmptyStatement", { - aliases: ["Statement"] + aliases: ["Statement"], }); defineType("ExpressionStatement", { visitor: ["expression"], fields: { expression: { - validate: assertNodeType("Expression") - } + validate: assertNodeType("Expression"), + }, }, - aliases: ["Statement", "ExpressionWrapper"] + aliases: ["Statement", "ExpressionWrapper"], }); defineType("File", { @@ -199,9 +199,9 @@ defineType("File", { visitor: ["program"], fields: { program: { - validate: assertNodeType("Program") - } - } + validate: assertNodeType("Program"), + }, + }, }); defineType("ForInStatement", { @@ -209,15 +209,15 @@ defineType("ForInStatement", { aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal") + validate: assertNodeType("VariableDeclaration", "LVal"), }, right: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("Statement") - } - } + validate: assertNodeType("Statement"), + }, + }, }); defineType("ForStatement", { @@ -226,20 +226,20 @@ defineType("ForStatement", { fields: { init: { validate: assertNodeType("VariableDeclaration", "Expression"), - optional: true + optional: true, }, test: { validate: assertNodeType("Expression"), - optional: true + optional: true, }, update: { validate: assertNodeType("Expression"), - optional: true + optional: true, }, body: { - validate: assertNodeType("Statement") - } - } + validate: assertNodeType("Statement"), + }, + }, }); defineType("FunctionDeclaration", { @@ -247,22 +247,22 @@ defineType("FunctionDeclaration", { visitor: ["id", "params", "body", "returnType", "typeParameters"], fields: { id: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, params: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))), }, body: { - validate: assertNodeType("BlockStatement") + validate: assertNodeType("BlockStatement"), }, generator: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, async: { default: false, - validate: assertValueType("boolean") - } + validate: assertValueType("boolean"), + }, }, aliases: [ "Scopable", @@ -271,8 +271,8 @@ defineType("FunctionDeclaration", { "FunctionParent", "Statement", "Pureish", - "Declaration" - ] + "Declaration", + ], }); defineType("FunctionExpression", { @@ -281,23 +281,23 @@ defineType("FunctionExpression", { fields: { id: { validate: assertNodeType("Identifier"), - optional: true + optional: true, }, params: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))), }, body: { - validate: assertNodeType("BlockStatement") + validate: assertNodeType("BlockStatement"), }, generator: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, async: { default: false, - validate: assertValueType("boolean") - } - } + validate: assertValueType("boolean"), + }, + }, }); defineType("Identifier", { @@ -310,12 +310,12 @@ defineType("Identifier", { if (!t.isValidIdentifier(val)) { // todo } - } + }, }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("IfStatement", { @@ -323,16 +323,16 @@ defineType("IfStatement", { aliases: ["Statement", "Conditional"], fields: { test: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, consequent: { - validate: assertNodeType("Statement") + validate: assertNodeType("Statement"), }, alternate: { optional: true, - validate: assertNodeType("Statement") - } - } + validate: assertNodeType("Statement"), + }, + }, }); defineType("LabeledStatement", { @@ -340,22 +340,22 @@ defineType("LabeledStatement", { aliases: ["Statement"], fields: { label: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, body: { - validate: assertNodeType("Statement") - } - } + validate: assertNodeType("Statement"), + }, + }, }); defineType("StringLiteral", { builder: ["value"], fields: { value: { - validate: assertValueType("string") - } + validate: assertValueType("string"), + }, }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] + aliases: ["Expression", "Pureish", "Literal", "Immutable"], }); defineType("NumericLiteral", { @@ -363,24 +363,24 @@ defineType("NumericLiteral", { deprecatedAlias: "NumberLiteral", fields: { value: { - validate: assertValueType("number") - } + validate: assertValueType("number"), + }, }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] + aliases: ["Expression", "Pureish", "Literal", "Immutable"], }); defineType("NullLiteral", { - aliases: ["Expression", "Pureish", "Literal", "Immutable"] + aliases: ["Expression", "Pureish", "Literal", "Immutable"], }); defineType("BooleanLiteral", { builder: ["value"], fields: { value: { - validate: assertValueType("boolean") - } + validate: assertValueType("boolean"), + }, }, - aliases: ["Expression", "Pureish", "Literal", "Immutable"] + aliases: ["Expression", "Pureish", "Literal", "Immutable"], }); defineType("RegExpLiteral", { @@ -389,13 +389,13 @@ defineType("RegExpLiteral", { aliases: ["Expression", "Literal"], fields: { pattern: { - validate: assertValueType("string") + validate: assertValueType("string"), }, flags: { validate: assertValueType("string"), - default: "" - } - } + default: "", + }, + }, }); defineType("LogicalExpression", { @@ -404,15 +404,15 @@ defineType("LogicalExpression", { aliases: ["Binary", "Expression"], fields: { operator: { - validate: assertOneOf(...LOGICAL_OPERATORS) + validate: assertOneOf(...LOGICAL_OPERATORS), }, left: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, right: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("MemberExpression", { @@ -421,18 +421,18 @@ defineType("MemberExpression", { aliases: ["Expression", "LVal"], fields: { object: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, property: { validate(node, key, val) { const expectedType = node.computed ? "Expression" : "Identifier"; assertNodeType(expectedType)(node, key, val); - } + }, }, computed: { - default: false - } - } + default: false, + }, + }, }); defineType("NewExpression", { @@ -440,12 +440,12 @@ defineType("NewExpression", { aliases: ["Expression"], fields: { callee: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, arguments: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression", "SpreadElement"))), + }, + }, }); defineType("Program", { @@ -454,13 +454,13 @@ defineType("Program", { fields: { directives: { validate: chain(assertValueType("array"), assertEach(assertNodeType("Directive"))), - default: [] + default: [], }, body: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))) - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))), + }, }, - aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"] + aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"], }); defineType("ObjectExpression", { @@ -471,9 +471,9 @@ defineType("ObjectExpression", { validate: chain( assertValueType("array"), assertEach(assertNodeType("ObjectMethod", "ObjectProperty", "SpreadElement")) - ) - } - } + ), + }, + }, }); defineType("ObjectMethod", { @@ -481,35 +481,35 @@ defineType("ObjectMethod", { fields: { kind: { validate: chain(assertValueType("string"), assertOneOf("method", "get", "set")), - default: "method" + default: "method", }, computed: { validate: assertValueType("boolean"), - default: false + default: false, }, key: { validate(node, key, val) { const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); - } + }, }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), }, body: { - validate: assertNodeType("BlockStatement") + validate: assertNodeType("BlockStatement"), }, generator: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, async: { default: false, - validate: assertValueType("boolean") - } + validate: assertValueType("boolean"), + }, }, visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"], - aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"] + aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"], }); defineType("ObjectProperty", { @@ -517,28 +517,28 @@ defineType("ObjectProperty", { fields: { computed: { validate: assertValueType("boolean"), - default: false + default: false, }, key: { validate(node, key, val) { const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); - } + }, }, value: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, shorthand: { validate: assertValueType("boolean"), - default: false + default: false, }, decorators: { validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), - optional: true - } + optional: true, + }, }, visitor: ["key", "value", "decorators"], - aliases: ["UserWhitespacable", "Property", "ObjectMember"] + aliases: ["UserWhitespacable", "Property", "ObjectMember"], }); defineType("RestElement", { @@ -546,12 +546,12 @@ defineType("RestElement", { aliases: ["LVal"], fields: { argument: { - validate: assertNodeType("LVal") + validate: assertNodeType("LVal"), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("ReturnStatement", { @@ -560,19 +560,19 @@ defineType("ReturnStatement", { fields: { argument: { validate: assertNodeType("Expression"), - optional: true - } - } + optional: true, + }, + }, }); defineType("SequenceExpression", { visitor: ["expressions"], fields: { expressions: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))) - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))), + }, }, - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("SwitchCase", { @@ -580,12 +580,12 @@ defineType("SwitchCase", { fields: { test: { validate: assertNodeType("Expression"), - optional: true + optional: true, }, consequent: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Statement"))), + }, + }, }); defineType("SwitchStatement", { @@ -593,16 +593,16 @@ defineType("SwitchStatement", { aliases: ["Statement", "BlockParent", "Scopable"], fields: { discriminant: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, cases: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("SwitchCase"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("SwitchCase"))), + }, + }, }); defineType("ThisExpression", { - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("ThrowStatement", { @@ -610,9 +610,9 @@ defineType("ThrowStatement", { aliases: ["Statement", "Terminatorless", "CompletionStatement"], fields: { argument: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); // todo: at least handler or finalizer should be set to be valid @@ -621,51 +621,51 @@ defineType("TryStatement", { aliases: ["Statement"], fields: { body: { - validate: assertNodeType("BlockStatement") + validate: assertNodeType("BlockStatement"), }, handler: { optional: true, - handler: assertNodeType("BlockStatement") + handler: assertNodeType("BlockStatement"), }, finalizer: { optional: true, - validate: assertNodeType("BlockStatement") - } - } + validate: assertNodeType("BlockStatement"), + }, + }, }); defineType("UnaryExpression", { builder: ["operator", "argument", "prefix"], fields: { prefix: { - default: true + default: true, }, argument: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, operator: { - validate: assertOneOf(...UNARY_OPERATORS) - } + validate: assertOneOf(...UNARY_OPERATORS), + }, }, visitor: ["argument"], - aliases: ["UnaryLike", "Expression"] + aliases: ["UnaryLike", "Expression"], }); defineType("UpdateExpression", { builder: ["operator", "argument", "prefix"], fields: { prefix: { - default: false + default: false, }, argument: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, operator: { - validate: assertOneOf(...UPDATE_OPERATORS) - } + validate: assertOneOf(...UPDATE_OPERATORS), + }, }, visitor: ["argument"], - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("VariableDeclaration", { @@ -674,25 +674,25 @@ defineType("VariableDeclaration", { aliases: ["Statement", "Declaration"], fields: { kind: { - validate: chain(assertValueType("string"), assertOneOf("var", "let", "const")) + validate: chain(assertValueType("string"), assertOneOf("var", "let", "const")), }, declarations: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("VariableDeclarator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("VariableDeclarator"))), + }, + }, }); defineType("VariableDeclarator", { visitor: ["id", "init"], fields: { id: { - validate: assertNodeType("LVal") + validate: assertNodeType("LVal"), }, init: { optional: true, - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("WhileStatement", { @@ -700,12 +700,12 @@ defineType("WhileStatement", { aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"], fields: { test: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement") - } - } + validate: assertNodeType("BlockStatement", "Statement"), + }, + }, }); defineType("WithStatement", { @@ -713,10 +713,10 @@ defineType("WithStatement", { aliases: ["Statement"], fields: { object: { - object: assertNodeType("Expression") + object: assertNodeType("Expression"), }, body: { - validate: assertNodeType("BlockStatement", "Statement") - } - } + validate: assertNodeType("BlockStatement", "Statement"), + }, + }, }); diff --git a/packages/babel-types/src/definitions/es2015.js b/packages/babel-types/src/definitions/es2015.js index b170af150e..450ce3d40b 100644 --- a/packages/babel-types/src/definitions/es2015.js +++ b/packages/babel-types/src/definitions/es2015.js @@ -13,15 +13,15 @@ defineType("AssignmentPattern", { aliases: ["Pattern", "LVal"], fields: { left: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, right: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("ArrayPattern", { @@ -29,12 +29,12 @@ defineType("ArrayPattern", { aliases: ["Pattern", "LVal"], fields: { elements: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("ArrowFunctionExpression", { @@ -43,25 +43,25 @@ defineType("ArrowFunctionExpression", { aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"], fields: { params: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))), }, body: { - validate: assertNodeType("BlockStatement", "Expression") + validate: assertNodeType("BlockStatement", "Expression"), }, async: { validate: assertValueType("boolean"), - default: false - } - } + default: false, + }, + }, }); defineType("ClassBody", { visitor: ["body"], fields: { body: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("ClassMethod", "ClassProperty"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("ClassMethod", "ClassProperty"))), + }, + }, }); defineType("ClassDeclaration", { @@ -74,24 +74,24 @@ defineType("ClassDeclaration", { "typeParameters", "superTypeParameters", "implements", - "decorators" + "decorators", ], aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"], fields: { id: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, body: { - validate: assertNodeType("ClassBody") + validate: assertNodeType("ClassBody"), }, superClass: { optional: true, - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("ClassExpression", { @@ -100,19 +100,19 @@ defineType("ClassExpression", { fields: { id: { optional: true, - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, body: { - validate: assertNodeType("ClassBody") + validate: assertNodeType("ClassBody"), }, superClass: { optional: true, - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("ExportAllDeclaration", { @@ -120,9 +120,9 @@ defineType("ExportAllDeclaration", { aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], fields: { source: { - validate: assertNodeType("StringLiteral") - } - } + validate: assertNodeType("StringLiteral"), + }, + }, }); defineType("ExportDefaultDeclaration", { @@ -130,9 +130,9 @@ defineType("ExportDefaultDeclaration", { aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"], fields: { declaration: { - validate: assertNodeType("FunctionDeclaration", "ClassDeclaration", "Expression") - } - } + validate: assertNodeType("FunctionDeclaration", "ClassDeclaration", "Expression"), + }, + }, }); defineType("ExportNamedDeclaration", { @@ -141,16 +141,16 @@ defineType("ExportNamedDeclaration", { fields: { declaration: { validate: assertNodeType("Declaration"), - optional: true + optional: true, }, specifiers: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("ExportSpecifier"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("ExportSpecifier"))), }, source: { validate: assertNodeType("StringLiteral"), - optional: true - } - } + optional: true, + }, + }, }); defineType("ExportSpecifier", { @@ -158,12 +158,12 @@ defineType("ExportSpecifier", { aliases: ["ModuleSpecifier"], fields: { local: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, exported: { - validate: assertNodeType("Identifier") - } - } + validate: assertNodeType("Identifier"), + }, + }, }); defineType("ForOfStatement", { @@ -171,19 +171,19 @@ defineType("ForOfStatement", { aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"], fields: { left: { - validate: assertNodeType("VariableDeclaration", "LVal") + validate: assertNodeType("VariableDeclaration", "LVal"), }, right: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, body: { - validate: assertNodeType("Statement") + validate: assertNodeType("Statement"), }, await: { default: false, - validate: assertValueType("boolean") - } - } + validate: assertValueType("boolean"), + }, + }, }); defineType("ImportDeclaration", { @@ -194,12 +194,12 @@ defineType("ImportDeclaration", { validate: chain( assertValueType("array"), assertEach(assertNodeType("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")) - ) + ), }, source: { - validate: assertNodeType("StringLiteral") - } - } + validate: assertNodeType("StringLiteral"), + }, + }, }); defineType("ImportDefaultSpecifier", { @@ -207,9 +207,9 @@ defineType("ImportDefaultSpecifier", { aliases: ["ModuleSpecifier"], fields: { local: { - validate: assertNodeType("Identifier") - } - } + validate: assertNodeType("Identifier"), + }, + }, }); defineType("ImportNamespaceSpecifier", { @@ -217,9 +217,9 @@ defineType("ImportNamespaceSpecifier", { aliases: ["ModuleSpecifier"], fields: { local: { - validate: assertNodeType("Identifier") - } - } + validate: assertNodeType("Identifier"), + }, + }, }); defineType("ImportSpecifier", { @@ -227,16 +227,16 @@ defineType("ImportSpecifier", { aliases: ["ModuleSpecifier"], fields: { local: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, imported: { - validate: assertNodeType("Identifier") + validate: assertNodeType("Identifier"), }, importKind: { // Handle Flowtype's extension "import {typeof foo} from" - validate: assertOneOf(null, "type", "typeof") - } - } + validate: assertOneOf(null, "type", "typeof"), + }, + }, }); defineType("MetaProperty", { @@ -245,12 +245,12 @@ defineType("MetaProperty", { fields: { // todo: limit to new.target meta: { - validate: assertValueType("string") + validate: assertValueType("string"), }, property: { - validate: assertValueType("string") - } - } + validate: assertValueType("string"), + }, + }, }); defineType("ClassMethod", { @@ -260,37 +260,37 @@ defineType("ClassMethod", { fields: { kind: { validate: chain(assertValueType("string"), assertOneOf("get", "set", "method", "constructor")), - default: "method" + default: "method", }, computed: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, static: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, key: { validate(node, key, val) { const expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"]; assertNodeType(...expectedTypes)(node, key, val); - } + }, }, params: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("LVal"))), }, body: { - validate: assertNodeType("BlockStatement") + validate: assertNodeType("BlockStatement"), }, generator: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, async: { default: false, - validate: assertValueType("boolean") - } - } + validate: assertValueType("boolean"), + }, + }, }); defineType("ObjectPattern", { @@ -298,12 +298,12 @@ defineType("ObjectPattern", { aliases: ["Pattern", "LVal"], fields: { properties: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("RestElement", "Property"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("RestElement", "Property"))), }, decorators: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Decorator"))), + }, + }, }); defineType("SpreadElement", { @@ -311,13 +311,13 @@ defineType("SpreadElement", { aliases: ["UnaryLike"], fields: { argument: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("Super", { - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("TaggedTemplateExpression", { @@ -325,12 +325,12 @@ defineType("TaggedTemplateExpression", { aliases: ["Expression"], fields: { tag: { - validate: assertNodeType("Expression") + validate: assertNodeType("Expression"), }, quasi: { - validate: assertNodeType("TemplateLiteral") - } - } + validate: assertNodeType("TemplateLiteral"), + }, + }, }); defineType("TemplateElement", { @@ -341,9 +341,9 @@ defineType("TemplateElement", { }, tail: { validate: assertValueType("boolean"), - default: false - } - } + default: false, + }, + }, }); defineType("TemplateLiteral", { @@ -351,12 +351,12 @@ defineType("TemplateLiteral", { aliases: ["Expression", "Literal"], fields: { quasis: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("TemplateElement"))) + validate: chain(assertValueType("array"), assertEach(assertNodeType("TemplateElement"))), }, expressions: { - validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))) - } - } + validate: chain(assertValueType("array"), assertEach(assertNodeType("Expression"))), + }, + }, }); defineType("YieldExpression", { @@ -366,11 +366,11 @@ defineType("YieldExpression", { fields: { delegate: { validate: assertValueType("boolean"), - default: false + default: false, }, argument: { optional: true, validate: assertNodeType("Expression"), - } - } + }, + }, }); diff --git a/packages/babel-types/src/definitions/experimental.js b/packages/babel-types/src/definitions/experimental.js index 36e5f46e05..0bdd4fe7e9 100644 --- a/packages/babel-types/src/definitions/experimental.js +++ b/packages/babel-types/src/definitions/experimental.js @@ -7,8 +7,8 @@ defineType("AwaitExpression", { fields: { argument: { validate: assertNodeType("Expression"), - } - } + }, + }, }); defineType("BindExpression", { @@ -16,20 +16,20 @@ defineType("BindExpression", { aliases: ["Expression"], fields: { // todo - } + }, }); defineType("Import", { - aliases: ["Expression"] + aliases: ["Expression"], }); defineType("Decorator", { visitor: ["expression"], fields: { expression: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("DoExpression", { @@ -37,9 +37,9 @@ defineType("DoExpression", { aliases: ["Expression"], fields: { body: { - validate: assertNodeType("BlockStatement") - } - } + validate: assertNodeType("BlockStatement"), + }, + }, }); defineType("ExportDefaultSpecifier", { @@ -47,9 +47,9 @@ defineType("ExportDefaultSpecifier", { aliases: ["ModuleSpecifier"], fields: { exported: { - validate: assertNodeType("Identifier") - } - } + validate: assertNodeType("Identifier"), + }, + }, }); defineType("ExportNamespaceSpecifier", { @@ -57,7 +57,7 @@ defineType("ExportNamespaceSpecifier", { aliases: ["ModuleSpecifier"], fields: { exported: { - validate: assertNodeType("Identifier") - } - } + validate: assertNodeType("Identifier"), + }, + }, }); diff --git a/packages/babel-types/src/definitions/flow.js b/packages/babel-types/src/definitions/flow.js index f18e1561b6..75388fb4a3 100644 --- a/packages/babel-types/src/definitions/flow.js +++ b/packages/babel-types/src/definitions/flow.js @@ -1,12 +1,12 @@ import defineType, { - assertValueType + assertValueType, } from "./index"; defineType("AnyTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], fields: { // todo - } + }, }); defineType("ArrayTypeAnnotation", { @@ -14,24 +14,24 @@ defineType("ArrayTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("BooleanTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], fields: { // todo - } + }, }); defineType("BooleanLiteralTypeAnnotation", { aliases: ["Flow"], - fields: {} + fields: {}, }); defineType("NullLiteralTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + fields: {}, }); defineType("ClassImplements", { @@ -39,7 +39,7 @@ defineType("ClassImplements", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("ClassProperty", { @@ -49,10 +49,10 @@ defineType("ClassProperty", { fields: { computed: { validate: assertValueType("boolean"), - default: false - } + default: false, + }, // todo - } + }, }); defineType("DeclareClass", { @@ -60,7 +60,7 @@ defineType("DeclareClass", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareFunction", { @@ -68,7 +68,7 @@ defineType("DeclareFunction", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareInterface", { @@ -76,7 +76,7 @@ defineType("DeclareInterface", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareModule", { @@ -84,7 +84,7 @@ defineType("DeclareModule", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareModuleExports", { @@ -92,7 +92,7 @@ defineType("DeclareModuleExports", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareTypeAlias", { @@ -100,7 +100,7 @@ defineType("DeclareTypeAlias", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("DeclareVariable", { @@ -108,11 +108,11 @@ defineType("DeclareVariable", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("ExistsTypeAnnotation", { - aliases: ["Flow"] + aliases: ["Flow"], }); defineType("FunctionTypeAnnotation", { @@ -120,7 +120,7 @@ defineType("FunctionTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("FunctionTypeParam", { @@ -128,7 +128,7 @@ defineType("FunctionTypeParam", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("GenericTypeAnnotation", { @@ -136,7 +136,7 @@ defineType("GenericTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("InterfaceExtends", { @@ -144,7 +144,7 @@ defineType("InterfaceExtends", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("InterfaceDeclaration", { @@ -152,7 +152,7 @@ defineType("InterfaceDeclaration", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("IntersectionTypeAnnotation", { @@ -160,15 +160,15 @@ defineType("IntersectionTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("MixedTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] + aliases: ["Flow", "FlowBaseAnnotation"], }); defineType("EmptyTypeAnnotation", { - aliases: ["Flow", "FlowBaseAnnotation"] + aliases: ["Flow", "FlowBaseAnnotation"], }); defineType("NullableTypeAnnotation", { @@ -176,40 +176,40 @@ defineType("NullableTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("NumberLiteralTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("NumberTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], fields: { // todo - } + }, }); defineType("StringLiteralTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("StringTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], fields: { // todo - } + }, }); defineType("ThisTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], - fields: {} + fields: {}, }); defineType("TupleTypeAnnotation", { @@ -217,7 +217,7 @@ defineType("TupleTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("TypeofTypeAnnotation", { @@ -225,7 +225,7 @@ defineType("TypeofTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("TypeAlias", { @@ -233,7 +233,7 @@ defineType("TypeAlias", { aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"], fields: { // todo - } + }, }); defineType("TypeAnnotation", { @@ -241,7 +241,7 @@ defineType("TypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("TypeCastExpression", { @@ -249,7 +249,7 @@ defineType("TypeCastExpression", { aliases: ["Flow", "ExpressionWrapper", "Expression"], fields: { // todo - } + }, }); defineType("TypeParameter", { @@ -257,7 +257,7 @@ defineType("TypeParameter", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("TypeParameterDeclaration", { @@ -265,7 +265,7 @@ defineType("TypeParameterDeclaration", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("TypeParameterInstantiation", { @@ -273,7 +273,7 @@ defineType("TypeParameterInstantiation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("ObjectTypeAnnotation", { @@ -281,7 +281,7 @@ defineType("ObjectTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("ObjectTypeCallProperty", { @@ -289,7 +289,7 @@ defineType("ObjectTypeCallProperty", { aliases: ["Flow", "UserWhitespacable"], fields: { // todo - } + }, }); defineType("ObjectTypeIndexer", { @@ -297,7 +297,7 @@ defineType("ObjectTypeIndexer", { aliases: ["Flow", "UserWhitespacable"], fields: { // todo - } + }, }); defineType("ObjectTypeProperty", { @@ -305,7 +305,7 @@ defineType("ObjectTypeProperty", { aliases: ["Flow", "UserWhitespacable"], fields: { // todo - } + }, }); defineType("QualifiedTypeIdentifier", { @@ -313,7 +313,7 @@ defineType("QualifiedTypeIdentifier", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("UnionTypeAnnotation", { @@ -321,12 +321,12 @@ defineType("UnionTypeAnnotation", { aliases: ["Flow"], fields: { // todo - } + }, }); defineType("VoidTypeAnnotation", { aliases: ["Flow", "FlowBaseAnnotation"], fields: { // todo - } + }, }); diff --git a/packages/babel-types/src/definitions/index.js b/packages/babel-types/src/definitions/index.js index 17e3ca24a6..750a81193f 100644 --- a/packages/babel-types/src/definitions/index.js +++ b/packages/babel-types/src/definitions/index.js @@ -129,7 +129,7 @@ export default function defineType( ) { const inherits = (opts.inherits && store[opts.inherits]) || {}; - opts.fields = opts.fields || inherits.fields || {}; + opts.fields = opts.fields || inherits.fields || {}; opts.visitor = opts.visitor || inherits.visitor || []; opts.aliases = opts.aliases || inherits.aliases || []; opts.builder = opts.builder || inherits.builder || opts.visitor || []; @@ -158,8 +158,8 @@ export default function defineType( VISITOR_KEYS[type] = opts.visitor; BUILDER_KEYS[type] = opts.builder; - NODE_FIELDS[type] = opts.fields; - ALIAS_KEYS[type] = opts.aliases; + NODE_FIELDS[type] = opts.fields; + ALIAS_KEYS[type] = opts.aliases; store[type] = opts; } diff --git a/packages/babel-types/src/definitions/jsx.js b/packages/babel-types/src/definitions/jsx.js index 51bcf1f9f9..28a8921c23 100644 --- a/packages/babel-types/src/definitions/jsx.js +++ b/packages/babel-types/src/definitions/jsx.js @@ -5,13 +5,13 @@ defineType("JSXAttribute", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXNamespacedName") + validate: assertNodeType("JSXIdentifier", "JSXNamespacedName"), }, value: { optional: true, - validate: assertNodeType("JSXElement", "StringLiteral", "JSXExpressionContainer") - } - } + validate: assertNodeType("JSXElement", "StringLiteral", "JSXExpressionContainer"), + }, + }, }); defineType("JSXClosingElement", { @@ -19,9 +19,9 @@ defineType("JSXClosingElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression") - } - } + validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), + }, + }, }); defineType("JSXElement", { @@ -30,23 +30,23 @@ defineType("JSXElement", { aliases: ["JSX", "Immutable", "Expression"], fields: { openingElement: { - validate: assertNodeType("JSXOpeningElement") + validate: assertNodeType("JSXOpeningElement"), }, closingElement: { optional: true, - validate: assertNodeType("JSXClosingElement") + validate: assertNodeType("JSXClosingElement"), }, children: { validate: chain( assertValueType("array"), assertEach(assertNodeType("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement")) - ) - } - } + ), + }, + }, }); defineType("JSXEmptyExpression", { - aliases: ["JSX", "Expression"] + aliases: ["JSX", "Expression"], }); defineType("JSXExpressionContainer", { @@ -54,9 +54,9 @@ defineType("JSXExpressionContainer", { aliases: ["JSX", "Immutable"], fields: { expression: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("JSXSpreadChild", { @@ -64,9 +64,9 @@ defineType("JSXSpreadChild", { aliases: ["JSX", "Immutable"], fields: { expression: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("JSXIdentifier", { @@ -74,9 +74,9 @@ defineType("JSXIdentifier", { aliases: ["JSX", "Expression"], fields: { name: { - validate: assertValueType("string") - } - } + validate: assertValueType("string"), + }, + }, }); defineType("JSXMemberExpression", { @@ -84,12 +84,12 @@ defineType("JSXMemberExpression", { aliases: ["JSX", "Expression"], fields: { object: { - validate: assertNodeType("JSXMemberExpression", "JSXIdentifier") + validate: assertNodeType("JSXMemberExpression", "JSXIdentifier"), }, property: { - validate: assertNodeType("JSXIdentifier") - } - } + validate: assertNodeType("JSXIdentifier"), + }, + }, }); defineType("JSXNamespacedName", { @@ -97,12 +97,12 @@ defineType("JSXNamespacedName", { aliases: ["JSX"], fields: { namespace: { - validate: assertNodeType("JSXIdentifier") + validate: assertNodeType("JSXIdentifier"), }, name: { - validate: assertNodeType("JSXIdentifier") - } - } + validate: assertNodeType("JSXIdentifier"), + }, + }, }); defineType("JSXOpeningElement", { @@ -111,19 +111,19 @@ defineType("JSXOpeningElement", { aliases: ["JSX", "Immutable"], fields: { name: { - validate: assertNodeType("JSXIdentifier", "JSXMemberExpression") + validate: assertNodeType("JSXIdentifier", "JSXMemberExpression"), }, selfClosing: { default: false, - validate: assertValueType("boolean") + validate: assertValueType("boolean"), }, attributes: { validate: chain( assertValueType("array"), assertEach(assertNodeType("JSXAttribute", "JSXSpreadAttribute")) - ) - } - } + ), + }, + }, }); defineType("JSXSpreadAttribute", { @@ -131,9 +131,9 @@ defineType("JSXSpreadAttribute", { aliases: ["JSX"], fields: { argument: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); defineType("JSXText", { @@ -141,7 +141,7 @@ defineType("JSXText", { builder: ["value"], fields: { value: { - validate: assertValueType("string") - } - } + validate: assertValueType("string"), + }, + }, }); diff --git a/packages/babel-types/src/definitions/misc.js b/packages/babel-types/src/definitions/misc.js index f063e42156..103d76c619 100644 --- a/packages/babel-types/src/definitions/misc.js +++ b/packages/babel-types/src/definitions/misc.js @@ -1,7 +1,7 @@ import defineType, { assertNodeType } from "./index"; defineType("Noop", { - visitor: [] + visitor: [], }); defineType("ParenthesizedExpression", { @@ -9,7 +9,7 @@ defineType("ParenthesizedExpression", { aliases: ["Expression", "ExpressionWrapper"], fields: { expression: { - validate: assertNodeType("Expression") - } - } + validate: assertNodeType("Expression"), + }, + }, }); diff --git a/packages/babel-types/src/flow.js b/packages/babel-types/src/flow.js index 996a11c8f4..6deb48c23d 100644 --- a/packages/babel-types/src/flow.js +++ b/packages/babel-types/src/flow.js @@ -6,7 +6,7 @@ import * as t from "./index"; */ export function createUnionTypeAnnotation(types: Array) { - const flattened = removeTypeDuplicates(types); + const flattened = removeTypeDuplicates(types); if (flattened.length === 1) { return flattened[0]; diff --git a/packages/babel-types/src/index.js b/packages/babel-types/src/index.js index fc633e1474..a885410fc0 100644 --- a/packages/babel-types/src/index.js +++ b/packages/babel-types/src/index.js @@ -46,7 +46,7 @@ export { UNARY_OPERATORS, INHERIT_KEYS, BLOCK_SCOPED_SYMBOL, - NOT_LOCAL_BINDING + NOT_LOCAL_BINDING, } from "./constants"; import "./definitions/init"; @@ -230,7 +230,7 @@ export function shallowEqual(actual: Object, expected: Object): boolean { */ export function appendToMemberExpression(member: Object, append: Object, computed?: boolean): Object { - member.object = t.memberExpression(member.object, member.property, member.computed); + member.object = t.memberExpression(member.object, member.property, member.computed); member.property = append; member.computed = !!computed; return member; @@ -485,11 +485,11 @@ export function traverseFast(node: Node, enter: (node: Node) => void, opts?: Obj const CLEAR_KEYS: Array = [ "tokens", "start", "end", "loc", - "raw", "rawValue" + "raw", "rawValue", ]; const CLEAR_KEYS_PLUS_COMMENTS: Array = t.COMMENT_KEYS.concat([ - "comments" + "comments", ]).concat(CLEAR_KEYS); /** @@ -522,7 +522,7 @@ export function removePropertiesDeep(tree: Node, opts?: Object): Node { // export { getBindingIdentifiers, - getOuterBindingIdentifiers + getOuterBindingIdentifiers, } from "./retrievers"; export { @@ -535,7 +535,7 @@ export { isSpecifierDefault, isScope, isImmutable, - isNodesEquivalent + isNodesEquivalent, } from "./validators"; export { @@ -547,11 +547,11 @@ export { toStatement, toExpression, toBlock, - valueToNode + valueToNode, } from "./converters"; export { createUnionTypeAnnotation, removeTypeDuplicates, - createTypeAnnotationBasedOnTypeof + createTypeAnnotationBasedOnTypeof, } from "./flow"; diff --git a/packages/babel-types/src/retrievers.js b/packages/babel-types/src/retrievers.js index caabe9acce..734e4dfc7e 100644 --- a/packages/babel-types/src/retrievers.js +++ b/packages/babel-types/src/retrievers.js @@ -10,7 +10,7 @@ export function getBindingIdentifiers( outerOnly?: boolean ): Object { let search = [].concat(node); - const ids = Object.create(null); + const ids = Object.create(null); while (search.length) { const id = search.shift(); @@ -101,7 +101,7 @@ getBindingIdentifiers.keys = { ObjectPattern: ["properties"], VariableDeclaration: ["declarations"], - VariableDeclarator: ["id"] + VariableDeclarator: ["id"], }; export function getOuterBindingIdentifiers( diff --git a/packages/babel-types/test/converters.js b/packages/babel-types/test/converters.js index b89e6dbe3f..d787265a7f 100644 --- a/packages/babel-types/test/converters.js +++ b/packages/babel-types/test/converters.js @@ -31,10 +31,10 @@ describe("converters", function () { it("object", function () { assert.deepEqual(t.valueToNode({ a: 1, - "b c": 2 + "b c": 2, }), t.objectExpression([ t.objectProperty(t.identifier("a"), t.numericLiteral(1)), - t.objectProperty(t.stringLiteral("b c"), t.numericLiteral(2)) + t.objectProperty(t.stringLiteral("b c"), t.numericLiteral(2)), ])); }); it("throws if cannot convert", function () { From 0d1edb9811694d25df2ef75a1e8de773624ec6b8 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Mon, 6 Mar 2017 14:21:58 -0500 Subject: [PATCH 209/222] Add `noInterop` option to `babel-plugin-transform-es2015-modules-commonjs`. The intent of this option is to toggle module interop behavior. When `true` no `interopRequireXXX` helper invocations will be emitted. --- .../fixtures/amd/noInterop-export-from/actual.js | 1 + .../fixtures/amd/noInterop-export-from/expected.js | 13 +++++++++++++ .../amd/noInterop-export-from/options.json | 3 +++ .../amd/noInterop-import-default-only/actual.js | 3 +++ .../amd/noInterop-import-default-only/expected.js | 5 +++++ .../amd/noInterop-import-default-only/options.json | 3 +++ .../src/index.js | 7 ++++--- .../test/fixtures/noInterop/export-from/actual.js | 1 + .../fixtures/noInterop/export-from/expected.js | 14 ++++++++++++++ .../noInterop/import-default-only/actual.js | 3 +++ .../noInterop/import-default-only/expected.js | 5 +++++ .../fixtures/noInterop/import-wildcard/actual.js | 4 ++++ .../fixtures/noInterop/import-wildcard/expected.js | 6 ++++++ .../test/fixtures/noInterop/options.json | 3 +++ .../test/fixtures/strict/import-wildcard/actual.js | 4 ++++ .../fixtures/strict/import-wildcard/expected.js | 6 ++++++ 16 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/expected.js create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/options.json create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/expected.js create mode 100644 packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/options.json create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/expected.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/expected.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/expected.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/options.json create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/actual.js create mode 100644 packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/expected.js diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/actual.js b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/actual.js new file mode 100644 index 0000000000..7d2c9b022e --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/actual.js @@ -0,0 +1 @@ +export { default } from 'foo'; diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/expected.js b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/expected.js new file mode 100644 index 0000000000..cd5f804ab6 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/expected.js @@ -0,0 +1,13 @@ +define(['exports', 'foo'], function (exports, _foo) { + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + Object.defineProperty(exports, 'default', { + enumerable: true, + get: function () { + return _foo.default; + } + }); +}); diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/options.json b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/options.json new file mode 100644 index 0000000000..096d2b9404 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-export-from/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", ["transform-es2015-modules-amd", { "noInterop": true }]] +} diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/actual.js b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/actual.js new file mode 100644 index 0000000000..44567cb185 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/actual.js @@ -0,0 +1,3 @@ +import foo from "foo"; + +foo; diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/expected.js b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/expected.js new file mode 100644 index 0000000000..acdfb3b580 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/expected.js @@ -0,0 +1,5 @@ +define(["foo"], function (_foo) { + "use strict"; + + _foo.default; +}); diff --git a/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/options.json b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/options.json new file mode 100644 index 0000000000..096d2b9404 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-amd/test/fixtures/amd/noInterop-import-default-only/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", ["transform-es2015-modules-amd", { "noInterop": true }]] +} diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js index 6c6dc9848e..a9178da61e 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js @@ -151,6 +151,7 @@ export default function () { this.ranCommonJS = true; const strict = !!this.opts.strict; + const noInterop = !!this.opts.noInterop; const { scope } = path; @@ -327,7 +328,7 @@ export default function () { } else if (specifier.isExportDefaultSpecifier()) { // todo } else if (specifier.isExportSpecifier()) { - if (specifier.node.local.name === "default") { + if (!noInterop && specifier.node.local.name === "default") { topNodes.push(buildExportsFrom(t.stringLiteral(specifier.node.exported.name), t.memberExpression( t.callExpression(this.addHelper("interopRequireDefault"), [ref]), @@ -371,7 +372,7 @@ export default function () { for (let i = 0; i < specifiers.length; i++) { const specifier = specifiers[i]; if (t.isImportNamespaceSpecifier(specifier)) { - if (strict) { + if (strict || noInterop) { remaps[specifier.local.name] = uid; } else { const varDecl = t.variableDeclaration("var", [ @@ -402,7 +403,7 @@ export default function () { if (specifier.imported.name === "default") { if (wildcard) { target = wildcard; - } else { + } else if (!noInterop) { target = wildcard = path.scope.generateUidIdentifier(uid.name); const varDecl = t.variableDeclaration("var", [ t.variableDeclarator( diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/actual.js new file mode 100644 index 0000000000..7d2c9b022e --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/actual.js @@ -0,0 +1 @@ +export { default } from 'foo'; diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/expected.js new file mode 100644 index 0000000000..c986dfedbb --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/export-from/expected.js @@ -0,0 +1,14 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _foo = require('foo'); + +Object.defineProperty(exports, 'default', { + enumerable: true, + get: function () { + return _foo.default; + } +}); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/actual.js new file mode 100644 index 0000000000..65b75b7293 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/actual.js @@ -0,0 +1,3 @@ +import foo from "foo"; + +foo(); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/expected.js new file mode 100644 index 0000000000..1bc59ef949 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-default-only/expected.js @@ -0,0 +1,5 @@ +"use strict"; + +var _foo = require("foo"); + +(0, _foo.default)(); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/actual.js new file mode 100644 index 0000000000..bf67ef46a2 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/actual.js @@ -0,0 +1,4 @@ +import * as foo from 'foo'; + +foo.bar(); +foo.baz(); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/expected.js new file mode 100644 index 0000000000..284db9decd --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/import-wildcard/expected.js @@ -0,0 +1,6 @@ +'use strict'; + +var _foo = require('foo'); + +_foo.bar(); +_foo.baz(); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/options.json b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/options.json new file mode 100644 index 0000000000..b2a35b9fc8 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/noInterop/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["external-helpers", ["transform-es2015-modules-commonjs", { "noInterop": true }]] +} diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/actual.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/actual.js new file mode 100644 index 0000000000..bf67ef46a2 --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/actual.js @@ -0,0 +1,4 @@ +import * as foo from 'foo'; + +foo.bar(); +foo.baz(); diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/expected.js b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/expected.js new file mode 100644 index 0000000000..284db9decd --- /dev/null +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/import-wildcard/expected.js @@ -0,0 +1,6 @@ +'use strict'; + +var _foo = require('foo'); + +_foo.bar(); +_foo.baz(); From 23de276718eda141b7a02934851256462e6b762e Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Mon, 6 Mar 2017 20:19:38 -0500 Subject: [PATCH 210/222] Add docs for strict and noInterop with es2015-modules-commonjs. --- .../README.md | 4 ++ .../README.md | 45 ++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/packages/babel-plugin-transform-es2015-modules-amd/README.md b/packages/babel-plugin-transform-es2015-modules-amd/README.md index 04455655ac..bf54c82a75 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/README.md +++ b/packages/babel-plugin-transform-es2015-modules-amd/README.md @@ -55,3 +55,7 @@ require("babel-core").transform("code", { plugins: ["transform-es2015-modules-amd"] }); ``` + +### Options + +See options for `babel-plugin-transform-es2015-commonjs`. diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/README.md b/packages/babel-plugin-transform-es2015-modules-commonjs/README.md index 3a802ab571..33088cc868 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/README.md +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/README.md @@ -82,10 +82,53 @@ Object.defineProperty(exports, "__esModule", { }); ``` -In environments that don't support this you can enable loose mode on `es6.modules` +In environments that don't support this you can enable loose mode on `babel-plugin-transform-es20150-modules-commonjs` and instead of using `Object.defineProperty` an assignment will be used instead. ```javascript var foo = exports.foo = 5; exports.__esModule = true; ``` + +### `strict` + +`boolean`, defaults to `false` + +By default, when using exports with babel a non-enumerable `__esModule` property +is exported. In some cases this property is used to determine if the import _is_ the +default export or if it _contains_ the default export. + +```javascript +var foo = exports.foo = 5; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +``` + +In order to prevent the `__esModule` property from being exported, you can set +the `strict` option to `true`. + +### `noInterop` + +`boolean`, defaults to `false` + +By default, when using exports with babel a non-enumerable `__esModule` property +is exported. This property is then used to determine if the import _is_ the default +export or if it _contains_ the default export. + +```javascript +"use strict"; + +var _foo = require("foo"); + +var _foo2 = _interopRequireDefault(_foo); + +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; +} +``` + +In cases where the auto-unwrapping of `default` is not needed, you can set the +`noInterop` option to `true` to avoid the usage of the `interopRequireDefault` +helper (shown in inline form above). From 39eca8464277878f706e9d1f26fd26c21ab6bb10 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Tue, 7 Mar 2017 12:42:25 -0800 Subject: [PATCH 211/222] Use 'resolve' from npm instead of private 'module' methods. (#5416) --- packages/babel-core/package.json | 1 + packages/babel-core/src/helpers/resolve.js | 29 ++----------------- .../package.json | 7 +++-- .../src/index.js | 10 ++----- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index 9e52e8894c..cc087d70ef 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -41,6 +41,7 @@ "lodash": "^4.2.0", "minimatch": "^3.0.2", "private": "^0.1.6", + "resolve": "^1.3.2", "slash": "^1.0.0", "source-map": "^0.5.0" }, diff --git a/packages/babel-core/src/helpers/resolve.js b/packages/babel-core/src/helpers/resolve.js index e8493ac8f5..f0c6b27f81 100644 --- a/packages/babel-core/src/helpers/resolve.js +++ b/packages/babel-core/src/helpers/resolve.js @@ -1,33 +1,8 @@ -import Module from "module"; -import path from "path"; - -const relativeModules = {}; +import resolve from "resolve"; export default function (loc: string, relative: string = process.cwd()): ?string { - // we're in the browser, probably - if (typeof Module === "object") return null; - - let relativeMod = relativeModules[relative]; - - if (!relativeMod) { - relativeMod = new Module; - - // We need to define an id and filename on our "fake" relative` module so that - // Node knows what "." means in the case of us trying to resolve a plugin - // such as "./myPlugins/somePlugin.js". If we don't specify id and filename here, - // Node presumes "." is process.cwd(), not our relative path. - // Since this fake module is never "loaded", we don't have to worry about mutating - // any global Node module cache state here. - const filename = path.join(relative, ".babelrc"); - relativeMod.id = filename; - relativeMod.filename = filename; - - relativeMod.paths = Module._nodeModulePaths(relative); - relativeModules[relative] = relativeMod; - } - try { - return Module._resolveFilename(loc, relativeMod); + return resolve.sync(loc, { basedir: relative }); } catch (err) { return null; } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index 83c6a054e6..ae3fd9b592 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -8,12 +8,13 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-transform-fixture-test-runner", "main": "lib/index.js", "dependencies": { + "babel-code-frame": "7.0.0-alpha.1", "babel-core": "7.0.0-alpha.1", "babel-polyfill": "7.0.0-alpha.1", "babel-helper-fixtures": "7.0.0-alpha.1", - "source-map": "^0.5.0", - "babel-code-frame": "7.0.0-alpha.1", "chai": "^3.0.0", - "lodash": "^4.2.0" + "lodash": "^4.2.0", + "resolve": "^1.3.2", + "source-map": "^0.5.0" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/src/index.js b/packages/babel-helper-transform-fixture-test-runner/src/index.js index 2b6d1272c4..6afb777bd3 100644 --- a/packages/babel-helper-transform-fixture-test-runner/src/index.js +++ b/packages/babel-helper-transform-fixture-test-runner/src/index.js @@ -8,12 +8,12 @@ import includes from "lodash/includes"; import * as helpers from "./helpers"; import extend from "lodash/extend"; import merge from "lodash/merge"; +import resolve from "resolve"; import assert from "assert"; import chai from "chai"; import fs from "fs"; import path from "path"; import vm from "vm"; -import Module from "module"; const moduleCache = {}; const testContext = vm.createContext({ @@ -35,13 +35,7 @@ runCodeInTestContext(buildExternalHelpers()); * This allows us to run our unittests */ function runModuleInTestContext(id: string, relativeFilename: string) { - // This code is a gross hack using internal APIs, but we also have the same logic in babel-core - // to resolve presets and plugins, so if this breaks, we'll have even worse issues to deal with. - const relativeMod = new Module(); - relativeMod.id = relativeFilename; - relativeMod.filename = relativeFilename; - relativeMod.paths = Module._nodeModulePaths(path.dirname(relativeFilename)); - const filename = Module._resolveFilename(id, relativeMod); + const filename = resolve.sync(id, { basedir: path.dirname(relativeFilename) }); // Expose Node-internal modules if the tests want them. Note, this will not execute inside // the context's global scope. From 6888a2c51b7bb69065f43e016b1d6d5ab3c370c0 Mon Sep 17 00:00:00 2001 From: Artem Gurzhii Date: Thu, 2 Mar 2017 19:14:03 +0100 Subject: [PATCH 212/222] Code refactoring for the babel-generator (#5344) * refactoring code for babel-generator package * removing spaces and refactoring if statement * fixing warnings --- packages/babel-generator/src/index.js | 4 +- .../babel-generator/src/node/parentheses.js | 153 ++++++------------ packages/babel-generator/src/printer.js | 8 +- 3 files changed, 55 insertions(+), 110 deletions(-) diff --git a/packages/babel-generator/src/index.js b/packages/babel-generator/src/index.js index d8fbaf2a49..5be44e2d02 100644 --- a/packages/babel-generator/src/index.js +++ b/packages/babel-generator/src/index.js @@ -10,9 +10,7 @@ import type { Format } from "./printer"; */ class Generator extends Printer { - constructor(ast, opts, code) { - opts = opts || {}; - + constructor(ast, opts = {}, code) { const tokens = ast.tokens || []; const format = normalizeOptions(code, opts, tokens); const map = opts.sourceMaps ? new SourceMap(opts, code) : null; diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index b469ef1703..0175a6312d 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -34,12 +34,8 @@ export function NullableTypeAnnotation(node: Object, parent: Object): boolean { export { NullableTypeAnnotation as FunctionTypeAnnotation }; export function UpdateExpression(node: Object, parent: Object): boolean { - if (t.isMemberExpression(parent) && parent.object === node) { - // (foo++).test() - return true; - } - - return false; + // (foo++).test() + return t.isMemberExpression(parent) && parent.object === node; } export function ObjectExpression(node: Object, parent: Object, printStack: Array): boolean { @@ -51,15 +47,11 @@ export function DoExpression(node: Object, parent: Object, printStack: Array nodePos) { - return true; - } - - // Logical expressions with the same precedence don't need parens. - if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) { + if ( + // Logical expressions with the same precedence don't need parens. + (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) || + parentPos > nodePos + ) { return true; } } @@ -84,55 +75,27 @@ export function Binary(node: Object, parent: Object): boolean { } export function BinaryExpression(node: Object, parent: Object): boolean { - if (node.operator === "in") { - // let i = (1 in []); - if (t.isVariableDeclarator(parent)) { - return true; - } - - // for ((1 in []);;); - if (t.isFor(parent)) { - return true; - } - } - - return false; + // let i = (1 in []); + // for ((1 in []);;); + return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent)); } export function SequenceExpression(node: Object, parent: Object): boolean { - if (t.isForStatement(parent)) { + + if ( // Although parentheses wouldn"t hurt around sequence // expressions in the head of for loops, traditional style // dictates that e.g. i++, j++ should not be wrapped with // parentheses. - return false; - } - - if (t.isExpressionStatement(parent) && parent.expression === node) { - return false; - } - - if (t.isReturnStatement(parent)) { - return false; - } - - if (t.isThrowStatement(parent)) { - return false; - } - - if (t.isSwitchStatement(parent) && parent.discriminant === node) { - return false; - } - - if (t.isWhileStatement(parent) && parent.test === node) { - return false; - } - - if (t.isIfStatement(parent) && parent.test === node) { - return false; - } - - if (t.isForInStatement(parent) && parent.right === node) { + t.isForStatement(parent) || + t.isThrowStatement(parent) || + t.isReturnStatement(parent) || + (t.isIfStatement(parent) && parent.test === node) || + (t.isWhileStatement(parent) && parent.test === node) || + (t.isForInStatement(parent) && parent.right === node) || + (t.isSwitchStatement(parent) && parent.discriminant === node) || + (t.isExpressionStatement(parent) && parent.expression === node) + ) { return false; } @@ -158,15 +121,9 @@ export function ClassExpression(node: Object, parent: Object, printStack: Array< } export function UnaryLike(node: Object, parent: Object): boolean { - if (t.isMemberExpression(parent, { object: node })) { - return true; - } - - if (t.isCallExpression(parent, { callee: node }) || t.isNewExpression(parent, { callee: node })) { - return true; - } - - return false; + return t.isMemberExpression(parent, { object: node }) || + t.isCallExpression(parent, { callee: node }) || + t.isNewExpression(parent, { callee: node }); } export function FunctionExpression(node: Object, parent: Object, printStack: Array): boolean { @@ -189,19 +146,12 @@ export function ArrowFunctionExpression(node: Object, parent: Object): boolean { } export function ConditionalExpression(node: Object, parent: Object): boolean { - if (t.isUnaryLike(parent)) { - return true; - } - - if (t.isBinary(parent)) { - return true; - } - - if (t.isConditionalExpression(parent, { test: node })) { - return true; - } - - if (t.isAwaitExpression(parent)) { + if ( + t.isUnaryLike(parent) || + t.isBinary(parent) || + t.isConditionalExpression(parent, { test: node }) || + t.isAwaitExpression(parent) + ) { return true; } @@ -227,28 +177,23 @@ function isFirstInStatement(printStack: Array, { i--; let parent = printStack[i]; while (i > 0) { - if (t.isExpressionStatement(parent, { expression: node })) { + if ( + t.isExpressionStatement(parent, { expression: node }) || + t.isTaggedTemplateExpression(parent) || + considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node }) || + considerArrow && t.isArrowFunctionExpression(parent, { body: node }) + ) { return true; } - if (t.isTaggedTemplateExpression(parent)) { - return true; - } - - if (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) { - return true; - } - - if (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) { - return true; - } - - if ((t.isCallExpression(parent, { callee: node })) || - (t.isSequenceExpression(parent) && parent.expressions[0] === node) || - (t.isMemberExpression(parent, { object: node })) || - (t.isConditional(parent, { test: node })) || - (t.isBinary(parent, { left: node })) || - (t.isAssignmentExpression(parent, { left: node }))) { + if ( + t.isCallExpression(parent, { callee: node }) || + (t.isSequenceExpression(parent) && parent.expressions[0] === node) || + t.isMemberExpression(parent, { object: node }) || + t.isConditional(parent, { test: node }) || + t.isBinary(parent, { left: node }) || + t.isAssignmentExpression(parent, { left: node }) + ) { node = parent; i--; parent = printStack[i]; diff --git a/packages/babel-generator/src/printer.js b/packages/babel-generator/src/printer.js index 7a7331e06c..1941b94ace 100644 --- a/packages/babel-generator/src/printer.js +++ b/packages/babel-generator/src/printer.js @@ -332,9 +332,11 @@ export default class Printer { this._maybeAddAuxComment(this._insideAux && !oldInAux); let needsParens = n.needsParens(node, parent, this._printStack); - if (this.format.retainFunctionParens && - node.type === "FunctionExpression" && - node.extra && node.extra.parenthesized) { + if ( + this.format.retainFunctionParens && + node.type === "FunctionExpression" && + node.extra && node.extra.parenthesized + ) { needsParens = true; } if (needsParens) this.token("("); From 0336cab75721c4ebc5609cc09d76ab9b5843c591 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 2 Mar 2017 22:29:34 -0600 Subject: [PATCH 213/222] Fix transform-object-rest-spread README [skip ci] (#5409) --- .../README.md | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/packages/babel-plugin-transform-object-rest-spread/README.md b/packages/babel-plugin-transform-object-rest-spread/README.md index 61c3debfff..79f2432d03 100644 --- a/packages/babel-plugin-transform-object-rest-spread/README.md +++ b/packages/babel-plugin-transform-object-rest-spread/README.md @@ -4,19 +4,22 @@ ## Example +### Rest Properties + ```js -// Rest properties let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; console.log(x); // 1 console.log(y); // 2 console.log(z); // { a: 3, b: 4 } +``` -// Spread properties +### Spread Properties + +```js let n = { x, y, ...z }; console.log(n); // { x: 1, y: 2, a: 3, b: 4 } ``` - ## Installation ```sh @@ -35,27 +38,6 @@ npm install --save-dev babel-plugin-transform-object-rest-spread } ``` -## Options - -This plugin will use babel's `extends` helper, which will polyfill `Object.assign` by default. - -* `useBuiltIns` - Do not use Babel's helper's and just transform to use the built-in method (Disabled by default). - -```json -{ - "plugins": [ - ["transform-object-rest-spread", { "useBuiltIns": true }] - ] -} -``` - -```js -// source -z = { x, ...y }; -// compiled -z = Object.assign({ x }, y); -``` - ### Via CLI ```sh @@ -70,6 +52,36 @@ require("babel-core").transform("code", { }); ``` +## Options + +### `useBuiltIns` + +`boolean`, defaults to `false`. + +By default, this plugin uses Babel's `extends` helper which polyfills `Object.assign`. Enabling this option will use `Object.assign` directly. + +**.babelrc** + +```json +{ + "plugins": [ + ["transform-object-rest-spread", { "useBuiltIns": true }] + ] +} +``` + +**In** + +```js +z = { x, ...y }; +``` + +**Out** + +```js +z = Object.assign({ x }, y); +``` + ## References * [Proposal: Object Rest/Spread Properties for ECMAScript](https://github.com/sebmarkbage/ecmascript-rest-spread) From d054cd0ea884043cd8080a4c45396c77692b46d1 Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Thu, 24 Nov 2016 00:04:10 -0500 Subject: [PATCH 214/222] Add support for .babelrc.js files --- .../file/options/build-config-chain.js | 74 ++++-- packages/babel-core/test/config-chain.js | 249 ++++++++++++++++++ .../config/js-config-default/.babelrc.js | 10 + .../fixtures/config/js-config-default/src.js | 1 + .../config/js-config-error/.babelrc.js | 2 + .../fixtures/config/js-config-error/src.js | 1 + .../config/js-config-error2/.babelrc.js | 1 + .../fixtures/config/js-config-error2/src.js | 1 + .../config/js-config-error3/.babelrc.js | 1 + .../fixtures/config/js-config-error3/src.js | 1 + .../config/js-config-extended/.babelrc.js | 6 + .../fixtures/config/js-config-extended/src.js | 1 + .../fixtures/config/js-config/.babelrc.js | 5 + .../test/fixtures/config/js-config/src.js | 1 + .../fixtures/config/js-json-config/.babelrc | 5 + .../config/js-json-config/.babelrc.js | 5 + .../fixtures/config/js-json-config/src.js | 1 + .../fixtures/config/js-pkg-config/.babelrc.js | 5 + .../config/js-pkg-config/package.json | 3 + .../test/fixtures/config/js-pkg-config/src.js | 1 + .../config/json-config-error/.babelrc | 3 + .../fixtures/config/json-config-error/src.js | 1 + .../config/json-pkg-config-no-babel/.babelrc | 5 + .../json-pkg-config-no-babel/package.json | 1 + .../config/json-pkg-config-no-babel/src.js | 1 + .../fixtures/config/json-pkg-config/.babelrc | 5 + .../config/json-pkg-config/package.json | 3 + .../fixtures/config/json-pkg-config/src.js | 1 + 28 files changed, 375 insertions(+), 19 deletions(-) create mode 100644 packages/babel-core/test/fixtures/config/js-config-default/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-default/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error2/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error2/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error3/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-error3/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-extended/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config-extended/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-config/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-config/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-json-config/.babelrc create mode 100644 packages/babel-core/test/fixtures/config/js-json-config/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-json-config/src.js create mode 100644 packages/babel-core/test/fixtures/config/js-pkg-config/.babelrc.js create mode 100644 packages/babel-core/test/fixtures/config/js-pkg-config/package.json create mode 100644 packages/babel-core/test/fixtures/config/js-pkg-config/src.js create mode 100644 packages/babel-core/test/fixtures/config/json-config-error/.babelrc create mode 100644 packages/babel-core/test/fixtures/config/json-config-error/src.js create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/.babelrc create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/package.json create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/src.js create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config/.babelrc create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config/package.json create mode 100644 packages/babel-core/test/fixtures/config/json-pkg-config/src.js diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index 5542072f69..5902d4c16e 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -1,4 +1,3 @@ - import type Logger from "../logger"; import resolve from "../../../helpers/resolve"; import json5 from "json5"; @@ -8,9 +7,10 @@ import fs from "fs"; const existsCache = {}; const jsonCache = {}; -const BABELIGNORE_FILENAME = ".babelignore"; const BABELRC_FILENAME = ".babelrc"; +const BABELRC_JS_FILENAME = ".babelrc.js"; const PACKAGE_FILENAME = "package.json"; +const BABELIGNORE_FILENAME = ".babelignore"; function exists(filename) { const cached = existsCache[filename]; @@ -46,7 +46,12 @@ class ConfigChainBuilder { this.log = log; } - findConfigs(loc) { + errorMultipleConfigs(loc1: string, loc2: string) { + throw new Error(`Multiple configuration files found. Please remove one:\n- ${ + loc1}\n- ${loc2}`); + } + + findConfigs(loc: string) { if (!loc) return; if (!path.isAbsolute(loc)) { @@ -59,15 +64,26 @@ class ConfigChainBuilder { while (loc !== (loc = path.dirname(loc))) { if (!foundConfig) { const configLoc = path.join(loc, BABELRC_FILENAME); - if (exists(configLoc)) { - this.addConfig(configLoc); - foundConfig = true; - } - + const configJSLoc = path.join(loc, BABELRC_JS_FILENAME); const pkgLoc = path.join(loc, PACKAGE_FILENAME); - if (!foundConfig && exists(pkgLoc)) { - foundConfig = this.addConfig(pkgLoc, "babel", JSON); - } + const configLocs = [configLoc, configJSLoc, pkgLoc]; + const foundConfigs = configLocs.reduce((arr, config) => { + if (exists(config)) { + const configAdded = config === pkgLoc + ? this.addConfig(config, "babel", JSON) + : this.addConfig(config); + + if (configAdded && arr.length) { + this.errorMultipleConfigs(arr.pop(), config); + } + + arr.push(config); + } + + return arr; + }, []); + + foundConfig = !!foundConfigs.length; } if (!foundIgnore) { @@ -82,7 +98,7 @@ class ConfigChainBuilder { } } - addIgnoreConfig(loc) { + addIgnoreConfig(loc: string) { const file = fs.readFileSync(loc, "utf8"); let lines = file.split("\n"); @@ -106,15 +122,35 @@ class ConfigChainBuilder { this.resolvedConfigs.push(loc); - const content = fs.readFileSync(loc, "utf8"); let options; + if (path.extname(loc) === ".js") { + try { + const configModule = require(loc); + options = configModule && configModule.__esModule ? configModule.default : configModule; + } catch (err) { + err.message = `${loc}: Error while loading config - ${err.message}`; + throw err; + } - try { - options = jsonCache[content] = jsonCache[content] || json.parse(content); - if (key) options = options[key]; - } catch (err) { - err.message = `${loc}: Error while parsing JSON - ${err.message}`; - throw err; + if (!options || typeof options !== "object") { + throw new Error("Configuration should be an exported JavaScript object."); + } + } else { + const content = fs.readFileSync(loc, "utf8"); + try { + options = jsonCache[content] = jsonCache[content] || json.parse(content); + } catch (err) { + err.message = `${loc}: Error while parsing JSON - ${err.message}`; + throw err; + } + } + + if (key) { + if (!options[key]) { + return false; + } + + options = options[key]; } this.mergeConfig({ diff --git a/packages/babel-core/test/config-chain.js b/packages/babel-core/test/config-chain.js index 5032973e7d..f317eca7d8 100644 --- a/packages/babel-core/test/config-chain.js +++ b/packages/babel-core/test/config-chain.js @@ -294,4 +294,253 @@ describe("buildConfigChain", function () { assert.deepEqual(chain, expected); }); + + it("js-config", function () { + const chain = buildConfigChain({ + filename: fixture("js-config", "src.js"), + }); + + const expected = [ + { + options: { + plugins: [ + "foo", + "bar", + ], + }, + alias: fixture("js-config", ".babelrc.js"), + loc: fixture("js-config", ".babelrc.js"), + dirname: fixture("js-config"), + }, + { + options: { + ignore: [ + "root-ignore", + ], + }, + alias: fixture(".babelignore"), + loc: fixture(".babelignore"), + dirname: fixture(), + }, + { + options: { + filename: fixture("js-config", "src.js"), + }, + alias: "base", + loc: "base", + dirname: fixture("js-config"), + }, + ]; + + assert.deepEqual(chain, expected); + }); + + it("js-config-default - should read transpiled export default", function () { + const chain = buildConfigChain({ + filename: fixture("js-config-default", "src.js"), + }); + + const expected = [ + { + options: { + plugins: [ + "foo", + "bar", + ], + }, + alias: fixture("js-config-default", ".babelrc.js"), + loc: fixture("js-config-default", ".babelrc.js"), + dirname: fixture("js-config-default"), + }, + { + options: { + ignore: [ + "root-ignore", + ], + }, + alias: fixture(".babelignore"), + loc: fixture(".babelignore"), + dirname: fixture(), + }, + { + options: { + filename: fixture("js-config-default", "src.js"), + }, + alias: "base", + loc: "base", + dirname: fixture("js-config-default"), + }, + ]; + + assert.deepEqual(chain, expected); + }); + it("js-config-extended", function () { + const chain = buildConfigChain({ + filename: fixture("js-config-extended", "src.js"), + }); + + const expected = [ + { + options: { + plugins: [ + "extended", + ], + }, + alias: fixture("extended.babelrc.json"), + loc: fixture("extended.babelrc.json"), + dirname: fixture(), + }, + { + options: { + plugins: [ + "foo", + "bar", + ], + }, + alias: fixture("js-config-extended", ".babelrc.js"), + loc: fixture("js-config-extended", ".babelrc.js"), + dirname: fixture("js-config-extended"), + }, + { + options: { + ignore: [ + "root-ignore", + ], + }, + alias: fixture(".babelignore"), + loc: fixture(".babelignore"), + dirname: fixture(), + }, + { + options: { + filename: fixture("js-config-extended", "src.js"), + }, + alias: "base", + loc: "base", + dirname: fixture("js-config-extended"), + }, + ]; + + assert.deepEqual(chain, expected); + }); + + it("json-pkg-config-no-babel - should not throw if" + + " package.json doesn't contain a `babel` field", function () { + const chain = buildConfigChain({ + filename: fixture("json-pkg-config-no-babel", "src.js"), + }); + + const expected = [ + { + options: { + plugins: [ + "json", + ], + }, + alias: fixture("json-pkg-config-no-babel", ".babelrc"), + loc: fixture("json-pkg-config-no-babel", ".babelrc"), + dirname: fixture("json-pkg-config-no-babel"), + }, + { + options: { + ignore: [ + "root-ignore", + ], + }, + alias: fixture(".babelignore"), + loc: fixture(".babelignore"), + dirname: fixture(), + }, + { + options: { + filename: fixture("json-pkg-config-no-babel", "src.js"), + }, + alias: "base", + loc: "base", + dirname: fixture("json-pkg-config-no-babel"), + }, + ]; + + assert.deepEqual(chain, expected); + }); + + it("js-json-config - should throw an error if both a .babelrc" + + " and a .babelrc.js are present", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("js-json-config", "src.js"), + }); + }, + /Multiple configuration files found\.(.|\n)*\.babelrc(.|\n)*\.babelrc\.js/ + ); + }); + + it("js-pkg-config - should throw an error if both a .babelrc.js" + + " and a package.json with a babel field are present", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("js-pkg-config", "src.js"), + }); + }, + /Multiple configuration files found\.(.|\n)*\.babelrc\.js(.|\n)*package\.json/ + ); + }); + + it("json-pkg-config - should throw an error if both a .babelrc" + + " and a package.json with a babel field are present", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("json-pkg-config", "src.js"), + }); + }, + /Multiple configuration files found\.(.|\n)*\.babelrc(.|\n)*package\.json/ + ); + }); + + it("js-config-error", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("js-config-error", "src.js"), + }); + }, + /Error while loading config/ + ); + }); + + it("js-config-error2", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("js-config-error2", "src.js"), + }); + }, + /Configuration should be an exported JavaScript object/ + ); + }); + + it("js-config-error3", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("js-config-error3", "src.js"), + }); + }, + /Configuration should be an exported JavaScript object/ + ); + }); + + it("json-config-error", function () { + assert.throws( + function () { + buildConfigChain({ + filename: fixture("json-config-error", "src.js"), + }); + }, + /Error while parsing JSON/ + ); + }); }); diff --git a/packages/babel-core/test/fixtures/config/js-config-default/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config-default/.babelrc.js new file mode 100644 index 0000000000..de5f1c0244 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-default/.babelrc.js @@ -0,0 +1,10 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var plugins = ["foo", "bar"]; + +exports.default = { + plugins: plugins +}; diff --git a/packages/babel-core/test/fixtures/config/js-config-default/src.js b/packages/babel-core/test/fixtures/config/js-config-default/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-default/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-config-error/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config-error/.babelrc.js new file mode 100644 index 0000000000..d14a2b71a8 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error/.babelrc.js @@ -0,0 +1,2 @@ +throw new Error("Something bad happened!"); +module.exports = {} diff --git a/packages/babel-core/test/fixtures/config/js-config-error/src.js b/packages/babel-core/test/fixtures/config/js-config-error/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-config-error2/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config-error2/.babelrc.js new file mode 100644 index 0000000000..9dc5fc1e4a --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error2/.babelrc.js @@ -0,0 +1 @@ +module.exports = ''; diff --git a/packages/babel-core/test/fixtures/config/js-config-error2/src.js b/packages/babel-core/test/fixtures/config/js-config-error2/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error2/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-config-error3/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config-error3/.babelrc.js new file mode 100644 index 0000000000..b894a23a24 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error3/.babelrc.js @@ -0,0 +1 @@ +module.exports = null; diff --git a/packages/babel-core/test/fixtures/config/js-config-error3/src.js b/packages/babel-core/test/fixtures/config/js-config-error3/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-error3/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-config-extended/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config-extended/.babelrc.js new file mode 100644 index 0000000000..05741c6ef8 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-extended/.babelrc.js @@ -0,0 +1,6 @@ +var plugins = ["foo", "bar"]; + +module.exports = { + extends: "../extended.babelrc.json", + plugins: plugins +} diff --git a/packages/babel-core/test/fixtures/config/js-config-extended/src.js b/packages/babel-core/test/fixtures/config/js-config-extended/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config-extended/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-config/.babelrc.js b/packages/babel-core/test/fixtures/config/js-config/.babelrc.js new file mode 100644 index 0000000000..e6fa0742df --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config/.babelrc.js @@ -0,0 +1,5 @@ +var plugins = ["foo", "bar"]; + +module.exports = { + plugins: plugins +} diff --git a/packages/babel-core/test/fixtures/config/js-config/src.js b/packages/babel-core/test/fixtures/config/js-config/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-config/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-json-config/.babelrc b/packages/babel-core/test/fixtures/config/js-json-config/.babelrc new file mode 100644 index 0000000000..c80e833d70 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-json-config/.babelrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "json" + ] +} diff --git a/packages/babel-core/test/fixtures/config/js-json-config/.babelrc.js b/packages/babel-core/test/fixtures/config/js-json-config/.babelrc.js new file mode 100644 index 0000000000..71bb3e5762 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-json-config/.babelrc.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + "js" + ] +} diff --git a/packages/babel-core/test/fixtures/config/js-json-config/src.js b/packages/babel-core/test/fixtures/config/js-json-config/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-json-config/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/js-pkg-config/.babelrc.js b/packages/babel-core/test/fixtures/config/js-pkg-config/.babelrc.js new file mode 100644 index 0000000000..71bb3e5762 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-pkg-config/.babelrc.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + "js" + ] +} diff --git a/packages/babel-core/test/fixtures/config/js-pkg-config/package.json b/packages/babel-core/test/fixtures/config/js-pkg-config/package.json new file mode 100644 index 0000000000..e25be3ecd2 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-pkg-config/package.json @@ -0,0 +1,3 @@ +{ + "babel": {} +} diff --git a/packages/babel-core/test/fixtures/config/js-pkg-config/src.js b/packages/babel-core/test/fixtures/config/js-pkg-config/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/js-pkg-config/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/json-config-error/.babelrc b/packages/babel-core/test/fixtures/config/json-config-error/.babelrc new file mode 100644 index 0000000000..a07fde17a3 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-config-error/.babelrc @@ -0,0 +1,3 @@ +{ + "bad: "json" +} diff --git a/packages/babel-core/test/fixtures/config/json-config-error/src.js b/packages/babel-core/test/fixtures/config/json-config-error/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-config-error/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/.babelrc b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/.babelrc new file mode 100644 index 0000000000..c80e833d70 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/.babelrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "json" + ] +} diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/package.json b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/package.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/package.json @@ -0,0 +1 @@ +{} diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/src.js b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config-no-babel/src.js @@ -0,0 +1 @@ +// empty diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config/.babelrc b/packages/babel-core/test/fixtures/config/json-pkg-config/.babelrc new file mode 100644 index 0000000000..c80e833d70 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config/.babelrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "json" + ] +} diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config/package.json b/packages/babel-core/test/fixtures/config/json-pkg-config/package.json new file mode 100644 index 0000000000..e25be3ecd2 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config/package.json @@ -0,0 +1,3 @@ +{ + "babel": {} +} diff --git a/packages/babel-core/test/fixtures/config/json-pkg-config/src.js b/packages/babel-core/test/fixtures/config/json-pkg-config/src.js new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/packages/babel-core/test/fixtures/config/json-pkg-config/src.js @@ -0,0 +1 @@ +// empty From 0553d7761d4877bf19d867fa45e30825f023413a Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 8 Mar 2017 13:08:44 -0500 Subject: [PATCH 215/222] Publish - babel-cli@7.0.0-alpha.2 - babel-core@7.0.0-alpha.2 - babel-helper-plugin-test-runner@7.0.0-alpha.2 - babel-helper-transform-fixture-test-runner@7.0.0-alpha.2 - babel-register@7.0.0-alpha.2 --- packages/babel-cli/package.json | 6 +++--- packages/babel-core/package.json | 6 +++--- packages/babel-helper-plugin-test-runner/package.json | 4 ++-- .../babel-helper-transform-fixture-test-runner/package.json | 4 ++-- packages/babel-register/package.json | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/babel-cli/package.json b/packages/babel-cli/package.json index 87c8d483ac..81ca73d32b 100644 --- a/packages/babel-cli/package.json +++ b/packages/babel-cli/package.json @@ -1,6 +1,6 @@ { "name": "babel-cli", - "version": "7.0.0-alpha.1", + "version": "7.0.0-alpha.2", "description": "Babel command line.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -16,8 +16,8 @@ "compiler" ], "dependencies": { - "babel-core": "7.0.0-alpha.1", - "babel-register": "7.0.0-alpha.1", + "babel-core": "7.0.0-alpha.2", + "babel-register": "7.0.0-alpha.2", "babel-polyfill": "7.0.0-alpha.1", "commander": "^2.8.1", "convert-source-map": "^1.1.0", diff --git a/packages/babel-core/package.json b/packages/babel-core/package.json index cc087d70ef..0c99b59385 100644 --- a/packages/babel-core/package.json +++ b/packages/babel-core/package.json @@ -1,6 +1,6 @@ { "name": "babel-core", - "version": "7.0.0-alpha.1", + "version": "7.0.0-alpha.2", "description": "Babel compiler core.", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -31,7 +31,7 @@ "babel-helpers": "7.0.0-alpha.1", "babel-messages": "7.0.0-alpha.1", "babel-template": "7.0.0-alpha.1", - "babel-register": "7.0.0-alpha.1", + "babel-register": "7.0.0-alpha.2", "babel-traverse": "7.0.0-alpha.1", "babel-types": "7.0.0-alpha.1", "babylon": "7.0.0-beta.4", @@ -47,7 +47,7 @@ }, "devDependencies": { "babel-helper-fixtures": "7.0.0-alpha.1", - "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1", + "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.2", "babel-polyfill": "7.0.0-alpha.1" } } diff --git a/packages/babel-helper-plugin-test-runner/package.json b/packages/babel-helper-plugin-test-runner/package.json index 0729b72150..ad893637a1 100644 --- a/packages/babel-helper-plugin-test-runner/package.json +++ b/packages/babel-helper-plugin-test-runner/package.json @@ -1,11 +1,11 @@ { "name": "babel-helper-plugin-test-runner", - "version": "7.0.0-alpha.1", + "version": "7.0.0-alpha.2", "description": "Helper function to support test runner", "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner", "license": "MIT", "main": "lib/index.js", "dependencies": { - "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1" + "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.2" } } diff --git a/packages/babel-helper-transform-fixture-test-runner/package.json b/packages/babel-helper-transform-fixture-test-runner/package.json index ae3fd9b592..01f5ab0d4c 100644 --- a/packages/babel-helper-transform-fixture-test-runner/package.json +++ b/packages/babel-helper-transform-fixture-test-runner/package.json @@ -1,6 +1,6 @@ { "name": "babel-helper-transform-fixture-test-runner", - "version": "7.0.0-alpha.1", + "version": "7.0.0-alpha.2", "description": "Transform test runner for babel-helper-fixtures module", "author": "Sebastian McKenzie ", "homepage": "https://babeljs.io/", @@ -9,7 +9,7 @@ "main": "lib/index.js", "dependencies": { "babel-code-frame": "7.0.0-alpha.1", - "babel-core": "7.0.0-alpha.1", + "babel-core": "7.0.0-alpha.2", "babel-polyfill": "7.0.0-alpha.1", "babel-helper-fixtures": "7.0.0-alpha.1", "chai": "^3.0.0", diff --git a/packages/babel-register/package.json b/packages/babel-register/package.json index 7586759738..f0ab4636f7 100644 --- a/packages/babel-register/package.json +++ b/packages/babel-register/package.json @@ -1,6 +1,6 @@ { "name": "babel-register", - "version": "7.0.0-alpha.1", + "version": "7.0.0-alpha.2", "description": "babel require hook", "license": "MIT", "repository": "https://github.com/babel/babel/tree/master/packages/babel-register", @@ -8,7 +8,7 @@ "main": "lib/node.js", "browser": "lib/browser.js", "dependencies": { - "babel-core": "7.0.0-alpha.1", + "babel-core": "7.0.0-alpha.2", "core-js": "^2.4.0", "home-or-tmp": "^3.0.0", "lodash": "^4.2.0", From 230712e0911dacdb337c17f94dc16547079e0865 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Wed, 8 Mar 2017 22:56:00 -0500 Subject: [PATCH 216/222] Internal: back to fixed, publish everything (#5436) --- Makefile | 2 +- lerna.json | 2 +- packages/babel-plugin-check-es2015-constants/package.json | 2 +- packages/babel-plugin-external-helpers/package.json | 2 +- .../babel-plugin-syntax-trailing-function-commas/package.json | 2 +- packages/babel-plugin-transform-async-functions/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-async-to-generator/package.json | 2 +- .../package.json | 2 +- packages/babel-plugin-transform-class-properties/package.json | 2 +- packages/babel-plugin-transform-decorators/package.json | 2 +- packages/babel-plugin-transform-do-expressions/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-es2015-block-scoping/package.json | 2 +- packages/babel-plugin-transform-es2015-classes/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-es2015-destructuring/package.json | 2 +- .../babel-plugin-transform-es2015-duplicate-keys/package.json | 2 +- packages/babel-plugin-transform-es2015-for-of/package.json | 2 +- .../babel-plugin-transform-es2015-function-name/package.json | 2 +- .../babel-plugin-transform-es2015-instanceof/package.json | 2 +- packages/babel-plugin-transform-es2015-literals/package.json | 2 +- .../babel-plugin-transform-es2015-modules-amd/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-es2015-modules-umd/package.json | 2 +- .../babel-plugin-transform-es2015-object-super/package.json | 2 +- .../babel-plugin-transform-es2015-parameters/package.json | 2 +- .../package.json | 2 +- packages/babel-plugin-transform-es2015-spread/package.json | 2 +- .../babel-plugin-transform-es2015-sticky-regex/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-es2015-typeof-symbol/package.json | 2 +- .../babel-plugin-transform-es2015-unicode-regex/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-es3-property-literals/package.json | 2 +- .../babel-plugin-transform-es5-property-mutators/package.json | 2 +- packages/babel-plugin-transform-eval/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-export-extensions/package.json | 2 +- packages/babel-plugin-transform-flow-comments/package.json | 2 +- packages/babel-plugin-transform-flow-strip-types/package.json | 2 +- packages/babel-plugin-transform-function-bind/package.json | 2 +- packages/babel-plugin-transform-jscript/package.json | 2 +- packages/babel-plugin-transform-object-assign/package.json | 2 +- .../babel-plugin-transform-object-rest-spread/package.json | 2 +- .../package.json | 2 +- packages/babel-plugin-transform-proto-to-assign/package.json | 2 +- .../package.json | 2 +- .../babel-plugin-transform-react-display-name/package.json | 2 +- .../babel-plugin-transform-react-inline-elements/package.json | 2 +- packages/babel-plugin-transform-react-jsx-compat/package.json | 2 +- packages/babel-plugin-transform-react-jsx-self/package.json | 2 +- packages/babel-plugin-transform-react-jsx-source/package.json | 2 +- packages/babel-plugin-transform-react-jsx/package.json | 2 +- packages/babel-plugin-transform-regenerator/package.json | 2 +- packages/babel-plugin-transform-runtime/package.json | 2 +- packages/babel-plugin-transform-strict-mode/package.json | 2 +- packages/babel-preset-es2015/package.json | 4 ++-- packages/babel-preset-latest/package.json | 2 +- 61 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 236aadb839..3f68e4cb04 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ publish: make test # not using lerna independent mode atm, so only update packages that have changed since we use ^ # --only-explicit-updates - ./node_modules/.bin/lerna publish --npm-tag=next --exact + ./node_modules/.bin/lerna publish --npm-tag=next --exact --skip-temp-tag make clean bootstrap: diff --git a/lerna.json b/lerna.json index de8942ffe2..91036a0b36 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.38", - "version": "independent", + "version": "7.0.0-alpha.2", "changelog": { "repo": "babel/babel", "labels": { diff --git a/packages/babel-plugin-check-es2015-constants/package.json b/packages/babel-plugin-check-es2015-constants/package.json index e78c62a45e..c54d9bb856 100644 --- a/packages/babel-plugin-check-es2015-constants/package.json +++ b/packages/babel-plugin-check-es2015-constants/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-external-helpers/package.json b/packages/babel-plugin-external-helpers/package.json index 0eaf0bc437..2820e253c3 100644 --- a/packages/babel-plugin-external-helpers/package.json +++ b/packages/babel-plugin-external-helpers/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-syntax-trailing-function-commas/package.json b/packages/babel-plugin-syntax-trailing-function-commas/package.json index ded8a1bc55..fab5f329cd 100644 --- a/packages/babel-plugin-syntax-trailing-function-commas/package.json +++ b/packages/babel-plugin-syntax-trailing-function-commas/package.json @@ -10,6 +10,6 @@ ], "dependencies": {}, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-functions/package.json b/packages/babel-plugin-transform-async-functions/package.json index 48498c669a..a6d512ecfd 100644 --- a/packages/babel-plugin-transform-async-functions/package.json +++ b/packages/babel-plugin-transform-async-functions/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-async-functions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-generator-functions/package.json b/packages/babel-plugin-transform-async-generator-functions/package.json index a69615a612..84e7abcb7d 100644 --- a/packages/babel-plugin-transform-async-generator-functions/package.json +++ b/packages/babel-plugin-transform-async-generator-functions/package.json @@ -13,6 +13,6 @@ "babel-plugin-syntax-async-generators": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-to-generator/package.json b/packages/babel-plugin-transform-async-to-generator/package.json index 13e0a80166..ab6c8a89dd 100644 --- a/packages/babel-plugin-transform-async-to-generator/package.json +++ b/packages/babel-plugin-transform-async-to-generator/package.json @@ -13,6 +13,6 @@ "babel-plugin-syntax-async-functions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-async-to-module-method/package.json b/packages/babel-plugin-transform-async-to-module-method/package.json index 015cc4ba66..ed52d24946 100644 --- a/packages/babel-plugin-transform-async-to-module-method/package.json +++ b/packages/babel-plugin-transform-async-to-module-method/package.json @@ -14,6 +14,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-class-properties/package.json b/packages/babel-plugin-transform-class-properties/package.json index 6ad1e0bf80..c8462d6102 100644 --- a/packages/babel-plugin-transform-class-properties/package.json +++ b/packages/babel-plugin-transform-class-properties/package.json @@ -14,6 +14,6 @@ "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-decorators/package.json b/packages/babel-plugin-transform-decorators/package.json index 64c8d416e9..0d41ef971e 100644 --- a/packages/babel-plugin-transform-decorators/package.json +++ b/packages/babel-plugin-transform-decorators/package.json @@ -17,6 +17,6 @@ "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-do-expressions/package.json b/packages/babel-plugin-transform-do-expressions/package.json index c959080f08..eea756892c 100644 --- a/packages/babel-plugin-transform-do-expressions/package.json +++ b/packages/babel-plugin-transform-do-expressions/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-do-expressions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-arrow-functions/package.json b/packages/babel-plugin-transform-es2015-arrow-functions/package.json index accf0a2d49..769a11ac31 100644 --- a/packages/babel-plugin-transform-es2015-arrow-functions/package.json +++ b/packages/babel-plugin-transform-es2015-arrow-functions/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json index 9cdd5fbf5c..9dfc7356b8 100644 --- a/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoped-functions/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-block-scoping/package.json b/packages/babel-plugin-transform-es2015-block-scoping/package.json index 2bf52f76a1..839997ebe0 100644 --- a/packages/babel-plugin-transform-es2015-block-scoping/package.json +++ b/packages/babel-plugin-transform-es2015-block-scoping/package.json @@ -15,6 +15,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-classes/package.json b/packages/babel-plugin-transform-es2015-classes/package.json index f10b00a9d5..37e45942a7 100644 --- a/packages/babel-plugin-transform-es2015-classes/package.json +++ b/packages/babel-plugin-transform-es2015-classes/package.json @@ -19,6 +19,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-computed-properties/package.json b/packages/babel-plugin-transform-es2015-computed-properties/package.json index aa17e08054..31b3130408 100644 --- a/packages/babel-plugin-transform-es2015-computed-properties/package.json +++ b/packages/babel-plugin-transform-es2015-computed-properties/package.json @@ -12,6 +12,6 @@ "babel-template": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-destructuring/package.json b/packages/babel-plugin-transform-es2015-destructuring/package.json index 50e7717c96..e3eef565a1 100644 --- a/packages/babel-plugin-transform-es2015-destructuring/package.json +++ b/packages/babel-plugin-transform-es2015-destructuring/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json index a10312f853..fd327fb34d 100644 --- a/packages/babel-plugin-transform-es2015-duplicate-keys/package.json +++ b/packages/babel-plugin-transform-es2015-duplicate-keys/package.json @@ -12,6 +12,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-for-of/package.json b/packages/babel-plugin-transform-es2015-for-of/package.json index 99753f4eaa..24c437586b 100644 --- a/packages/babel-plugin-transform-es2015-for-of/package.json +++ b/packages/babel-plugin-transform-es2015-for-of/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-function-name/package.json b/packages/babel-plugin-transform-es2015-function-name/package.json index d992f0123b..d2458bf881 100644 --- a/packages/babel-plugin-transform-es2015-function-name/package.json +++ b/packages/babel-plugin-transform-es2015-function-name/package.json @@ -13,6 +13,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-instanceof/package.json b/packages/babel-plugin-transform-es2015-instanceof/package.json index 105b87ee18..d997b4c467 100644 --- a/packages/babel-plugin-transform-es2015-instanceof/package.json +++ b/packages/babel-plugin-transform-es2015-instanceof/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-literals/package.json b/packages/babel-plugin-transform-es2015-literals/package.json index d9bc938774..bc81940b1d 100644 --- a/packages/babel-plugin-transform-es2015-literals/package.json +++ b/packages/babel-plugin-transform-es2015-literals/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-amd/package.json b/packages/babel-plugin-transform-es2015-modules-amd/package.json index 4d26e73f91..36969f3150 100644 --- a/packages/babel-plugin-transform-es2015-modules-amd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-amd/package.json @@ -13,6 +13,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json index 0fc442373c..fe000208af 100644 --- a/packages/babel-plugin-transform-es2015-modules-commonjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-commonjs/package.json @@ -14,6 +14,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json index a5d78cf2e7..864028998a 100644 --- a/packages/babel-plugin-transform-es2015-modules-systemjs/package.json +++ b/packages/babel-plugin-transform-es2015-modules-systemjs/package.json @@ -13,7 +13,7 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1", + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1", "babel-plugin-syntax-dynamic-import": "7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-modules-umd/package.json b/packages/babel-plugin-transform-es2015-modules-umd/package.json index 7d846e75c7..b48322db93 100644 --- a/packages/babel-plugin-transform-es2015-modules-umd/package.json +++ b/packages/babel-plugin-transform-es2015-modules-umd/package.json @@ -13,6 +13,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-object-super/package.json b/packages/babel-plugin-transform-es2015-object-super/package.json index 7731843c61..4de65e9bb5 100644 --- a/packages/babel-plugin-transform-es2015-object-super/package.json +++ b/packages/babel-plugin-transform-es2015-object-super/package.json @@ -12,6 +12,6 @@ "babel-helper-replace-supers": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-parameters/package.json b/packages/babel-plugin-transform-es2015-parameters/package.json index 01053fdab9..6347fdbf67 100644 --- a/packages/babel-plugin-transform-es2015-parameters/package.json +++ b/packages/babel-plugin-transform-es2015-parameters/package.json @@ -16,6 +16,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json index c37be49ab9..d7e7ada681 100644 --- a/packages/babel-plugin-transform-es2015-shorthand-properties/package.json +++ b/packages/babel-plugin-transform-es2015-shorthand-properties/package.json @@ -12,6 +12,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-spread/package.json b/packages/babel-plugin-transform-es2015-spread/package.json index 60f5c64c57..9855e702f5 100644 --- a/packages/babel-plugin-transform-es2015-spread/package.json +++ b/packages/babel-plugin-transform-es2015-spread/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-sticky-regex/package.json b/packages/babel-plugin-transform-es2015-sticky-regex/package.json index 80670f7ab1..b8a0342172 100644 --- a/packages/babel-plugin-transform-es2015-sticky-regex/package.json +++ b/packages/babel-plugin-transform-es2015-sticky-regex/package.json @@ -13,6 +13,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-template-literals/package.json b/packages/babel-plugin-transform-es2015-template-literals/package.json index 703615bc04..39072ab9ce 100644 --- a/packages/babel-plugin-transform-es2015-template-literals/package.json +++ b/packages/babel-plugin-transform-es2015-template-literals/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json index b9a94b2a6c..99caefcdb5 100644 --- a/packages/babel-plugin-transform-es2015-typeof-symbol/package.json +++ b/packages/babel-plugin-transform-es2015-typeof-symbol/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es2015-unicode-regex/package.json b/packages/babel-plugin-transform-es2015-unicode-regex/package.json index 92c8155f6f..502acb965e 100644 --- a/packages/babel-plugin-transform-es2015-unicode-regex/package.json +++ b/packages/babel-plugin-transform-es2015-unicode-regex/package.json @@ -13,6 +13,6 @@ "regexpu-core": "^4.0.2" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es3-member-expression-literals/package.json b/packages/babel-plugin-transform-es3-member-expression-literals/package.json index 69b0561249..2738735d1e 100644 --- a/packages/babel-plugin-transform-es3-member-expression-literals/package.json +++ b/packages/babel-plugin-transform-es3-member-expression-literals/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es3-property-literals/package.json b/packages/babel-plugin-transform-es3-property-literals/package.json index 19e1aa5f1d..66887c68fa 100644 --- a/packages/babel-plugin-transform-es3-property-literals/package.json +++ b/packages/babel-plugin-transform-es3-property-literals/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-es5-property-mutators/package.json b/packages/babel-plugin-transform-es5-property-mutators/package.json index 6faac6bc98..2b52a92d8a 100644 --- a/packages/babel-plugin-transform-es5-property-mutators/package.json +++ b/packages/babel-plugin-transform-es5-property-mutators/package.json @@ -12,6 +12,6 @@ "babel-helper-define-map": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-eval/package.json b/packages/babel-plugin-transform-eval/package.json index e7378f8288..0420fd767c 100644 --- a/packages/babel-plugin-transform-eval/package.json +++ b/packages/babel-plugin-transform-eval/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-exponentiation-operator/package.json b/packages/babel-plugin-transform-exponentiation-operator/package.json index 757438a253..904ca600b1 100644 --- a/packages/babel-plugin-transform-exponentiation-operator/package.json +++ b/packages/babel-plugin-transform-exponentiation-operator/package.json @@ -13,6 +13,6 @@ "babel-helper-builder-binary-assignment-operator-visitor": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-export-extensions/package.json b/packages/babel-plugin-transform-export-extensions/package.json index 4c9fc99b27..83b20f22ff 100644 --- a/packages/babel-plugin-transform-export-extensions/package.json +++ b/packages/babel-plugin-transform-export-extensions/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-export-extensions": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-flow-comments/package.json b/packages/babel-plugin-transform-flow-comments/package.json index a44a453c01..54aad70219 100644 --- a/packages/babel-plugin-transform-flow-comments/package.json +++ b/packages/babel-plugin-transform-flow-comments/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-flow": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-flow-strip-types/package.json b/packages/babel-plugin-transform-flow-strip-types/package.json index 9ddc454c13..345e6091f7 100644 --- a/packages/babel-plugin-transform-flow-strip-types/package.json +++ b/packages/babel-plugin-transform-flow-strip-types/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-flow": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-function-bind/package.json b/packages/babel-plugin-transform-function-bind/package.json index b7b3c2b957..608bcde671 100644 --- a/packages/babel-plugin-transform-function-bind/package.json +++ b/packages/babel-plugin-transform-function-bind/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-function-bind": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-jscript/package.json b/packages/babel-plugin-transform-jscript/package.json index 2652907040..a9e7124dd5 100644 --- a/packages/babel-plugin-transform-jscript/package.json +++ b/packages/babel-plugin-transform-jscript/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-assign/package.json b/packages/babel-plugin-transform-object-assign/package.json index 01e812e89c..eccbba7b59 100644 --- a/packages/babel-plugin-transform-object-assign/package.json +++ b/packages/babel-plugin-transform-object-assign/package.json @@ -10,6 +10,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-rest-spread/package.json b/packages/babel-plugin-transform-object-rest-spread/package.json index fd35f3c08c..5e8e352239 100644 --- a/packages/babel-plugin-transform-object-rest-spread/package.json +++ b/packages/babel-plugin-transform-object-rest-spread/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-object-rest-spread": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json index 9afdc54e13..599761b63b 100644 --- a/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json +++ b/packages/babel-plugin-transform-object-set-prototype-of-to-assign/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-proto-to-assign/package.json b/packages/babel-plugin-transform-proto-to-assign/package.json index 015ded1ab6..51b69cc3ad 100644 --- a/packages/babel-plugin-transform-proto-to-assign/package.json +++ b/packages/babel-plugin-transform-proto-to-assign/package.json @@ -12,6 +12,6 @@ "lodash": "^4.2.0" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-constant-elements/package.json b/packages/babel-plugin-transform-react-constant-elements/package.json index f02d44c5d0..45b0d6bf05 100644 --- a/packages/babel-plugin-transform-react-constant-elements/package.json +++ b/packages/babel-plugin-transform-react-constant-elements/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-display-name/package.json b/packages/babel-plugin-transform-react-display-name/package.json index 7660d0fedc..84747a6f53 100644 --- a/packages/babel-plugin-transform-react-display-name/package.json +++ b/packages/babel-plugin-transform-react-display-name/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-inline-elements/package.json b/packages/babel-plugin-transform-react-inline-elements/package.json index eca600b139..f456210517 100644 --- a/packages/babel-plugin-transform-react-inline-elements/package.json +++ b/packages/babel-plugin-transform-react-inline-elements/package.json @@ -12,6 +12,6 @@ "babel-runtime": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-compat/package.json b/packages/babel-plugin-transform-react-jsx-compat/package.json index 33f3326a2e..4788f5e3f0 100644 --- a/packages/babel-plugin-transform-react-jsx-compat/package.json +++ b/packages/babel-plugin-transform-react-jsx-compat/package.json @@ -12,6 +12,6 @@ "babel-helper-builder-react-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-self/package.json b/packages/babel-plugin-transform-react-jsx-self/package.json index d1edd9a5e1..de0fc545ab 100644 --- a/packages/babel-plugin-transform-react-jsx-self/package.json +++ b/packages/babel-plugin-transform-react-jsx-self/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx-source/package.json b/packages/babel-plugin-transform-react-jsx-source/package.json index 2fd0debd44..e9b1f0cc59 100644 --- a/packages/babel-plugin-transform-react-jsx-source/package.json +++ b/packages/babel-plugin-transform-react-jsx-source/package.json @@ -12,6 +12,6 @@ "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-react-jsx/package.json b/packages/babel-plugin-transform-react-jsx/package.json index 74631ed504..954bf14360 100644 --- a/packages/babel-plugin-transform-react-jsx/package.json +++ b/packages/babel-plugin-transform-react-jsx/package.json @@ -13,6 +13,6 @@ "babel-plugin-syntax-jsx": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-regenerator/package.json b/packages/babel-plugin-transform-regenerator/package.json index 9fc402effd..56b1a5ad78 100644 --- a/packages/babel-plugin-transform-regenerator/package.json +++ b/packages/babel-plugin-transform-regenerator/package.json @@ -11,6 +11,6 @@ }, "license": "MIT", "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-runtime/package.json b/packages/babel-plugin-transform-runtime/package.json index f21cb29054..e731d2d8bd 100644 --- a/packages/babel-plugin-transform-runtime/package.json +++ b/packages/babel-plugin-transform-runtime/package.json @@ -9,6 +9,6 @@ "babel-plugin" ], "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-plugin-transform-strict-mode/package.json b/packages/babel-plugin-transform-strict-mode/package.json index ae48917dc0..62212a0f17 100644 --- a/packages/babel-plugin-transform-strict-mode/package.json +++ b/packages/babel-plugin-transform-strict-mode/package.json @@ -12,6 +12,6 @@ "babel-types": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-preset-es2015/package.json b/packages/babel-preset-es2015/package.json index 2bd7ed0ac5..60c1a389e2 100644 --- a/packages/babel-preset-es2015/package.json +++ b/packages/babel-preset-es2015/package.json @@ -34,7 +34,7 @@ "babel-plugin-transform-regenerator": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-transform-fixture-test-runner": "7.0.0-alpha.1", - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-transform-fixture-test-runner": "^7.0.0-alpha.1", + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } diff --git a/packages/babel-preset-latest/package.json b/packages/babel-preset-latest/package.json index 5211461cce..582557770a 100644 --- a/packages/babel-preset-latest/package.json +++ b/packages/babel-preset-latest/package.json @@ -13,6 +13,6 @@ "babel-preset-es2017": "7.0.0-alpha.1" }, "devDependencies": { - "babel-helper-plugin-test-runner": "7.0.0-alpha.1" + "babel-helper-plugin-test-runner": "^7.0.0-alpha.1" } } From 3d987ed6c03c271c995d79b860b4627747e2a24b Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Thu, 9 Mar 2017 06:13:53 -0800 Subject: [PATCH 217/222] Keep parentheses for logical expression when in await expression (fix #5428) (#5433) --- packages/babel-generator/src/node/parentheses.js | 3 ++- .../test/fixtures/parentheses/await-expression/actual.js | 1 + .../test/fixtures/parentheses/await-expression/expected.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/babel-generator/src/node/parentheses.js b/packages/babel-generator/src/node/parentheses.js index 0175a6312d..79ef9b448c 100644 --- a/packages/babel-generator/src/node/parentheses.js +++ b/packages/babel-generator/src/node/parentheses.js @@ -50,7 +50,8 @@ export function Binary(node: Object, parent: Object): boolean { if ( ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) || t.isUnaryLike(parent) || - (t.isMemberExpression(parent) && parent.object === node) + (t.isMemberExpression(parent) && parent.object === node) || + t.isAwaitExpression(parent) ) { return true; } diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js index d4bdc6b74a..8289263007 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/actual.js @@ -5,6 +5,7 @@ async function asdf() { true ? (await 1) : (await 2); await (1 ? 2 : 3); await (await 1); + await (a || b); } async function a(b) { diff --git a/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js b/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js index dc2cb361e0..271a15791e 100644 --- a/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js +++ b/packages/babel-generator/test/fixtures/parentheses/await-expression/expected.js @@ -5,6 +5,7 @@ async function asdf() { true ? await 1 : await 2; await (1 ? 2 : 3); await await 1; + await (a || b); } async function a(b) { From 12eb25c06c4fcd21a8e9ff954fe121ed87f82dbf Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 9 Mar 2017 11:00:25 -0500 Subject: [PATCH 218/222] don't show other presets in readme [skip ci] (#5438) --- README.md | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 3163343a66..367565bba1 100644 --- a/README.md +++ b/README.md @@ -137,27 +137,9 @@ After Babel 6, the default transforms were removed; if you don't specify any plu The transformer[s] used in Babel are the independent pieces of code that transform specific things. For example: the [`es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) transform specifically changes arrow functions into a regular function. Presets are just simply an array of plugins that make it easier to run a whole a set of transforms without specifying each one manually. -There are a few presets that we maintain officially. - -| Package | Version | Dependencies | -|--------|-------|------------| -| [`babel-preset-es2015`](/packages/babel-preset-es2015) | [![npm](https://img.shields.io/npm/v/babel-preset-es2015.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-es2015) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-es2015)](https://david-dm.org/babel/babel?path=packages/babel-preset-es2015) | -| [`babel-preset-es2016`](/packages/babel-preset-es2016) | [![npm](https://img.shields.io/npm/v/babel-preset-es2016.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-es2016) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-es2016)](https://david-dm.org/babel/babel?path=packages/babel-preset-es2016) | -| [`babel-preset-es2017`](/packages/babel-preset-es2017) | [![npm](https://img.shields.io/npm/v/babel-preset-es2017.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-es2017) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-es2017)](https://david-dm.org/babel/babel?path=packages/babel-preset-es2017) | -| [`babel-preset-latest`](/packages/babel-preset-latest) | [![npm](https://img.shields.io/npm/v/babel-preset-latest.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-latest) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-latest)](https://david-dm.org/babel/babel?path=packages/babel-preset-latest) | -| [`babel-preset-stage-0`](/packages/babel-preset-stage-0) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-0.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-0) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-0)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-0) | -| [`babel-preset-stage-1`](/packages/babel-preset-stage-1) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-1.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-1) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-1)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-1) | -| [`babel-preset-stage-2`](/packages/babel-preset-stage-2) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-2.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-2) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-2)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-2) | -| [`babel-preset-stage-3`](/packages/babel-preset-stage-3) | [![npm](https://img.shields.io/npm/v/babel-preset-stage-3.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-stage-3) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-stage-3)](https://david-dm.org/babel/babel?path=packages/babel-preset-stage-3) | -| [`babel-preset-react`](/packages/babel-preset-react) | [![npm](https://img.shields.io/npm/v/babel-preset-react.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-react) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-preset-react)](https://david-dm.org/babel/babel?path=packages/babel-preset-react) | -| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | - -We maintain: - -- a preset for each yearly release of ECMAScript (Javascript) starting from ES6/ES2015. -- a preset for react (JSX/Flow). -- a preset for each [stage (0-3)](http://babeljs.io/docs/plugins/#stage-x-experimental-presets) of the [TC-39 Process](https://tc39.github.io/process-document/) for ECMAScript proposals. -- a preset that can automatically determine plugins and polyfills you need based on your supported environments. +| Package | Version | Dependencies | Description | +|--------|-------|------------|---| +| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments | > You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset) From 305165eda460b4e73a9385e80880817f03094528 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Tue, 7 Mar 2017 15:14:38 -0800 Subject: [PATCH 219/222] Remove Logger usage from options processing. --- .../babel-core/src/transformation/file/index.js | 2 +- .../babel-core/src/transformation/file/logger.js | 9 +++++++++ .../file/options/build-config-chain.js | 10 ++++------ .../file/options/option-manager.js | 16 ++++++---------- packages/babel-core/test/api.js | 2 +- packages/babel-core/test/option-manager.js | 11 +++++------ 6 files changed, 26 insertions(+), 24 deletions(-) diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index dad9ec5b13..24f991623f 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -132,7 +132,7 @@ export default class File extends Store { } initOptions(opts) { - opts = new OptionManager(this.log).init(opts); + opts = this.log.wrap(() => new OptionManager().init(opts)); if (opts.inputSourceMap) { opts.sourceMaps = true; diff --git a/packages/babel-core/src/transformation/file/logger.js b/packages/babel-core/src/transformation/file/logger.js index aa4a57d718..c07273e114 100644 --- a/packages/babel-core/src/transformation/file/logger.js +++ b/packages/babel-core/src/transformation/file/logger.js @@ -21,6 +21,15 @@ export default class Logger { return parts; } + wrap(callback: () => T): T { + try { + return callback(); + } catch (e) { + e.message = this._buildMessage(e.message); + throw e; + } + } + warn(msg: string) { console.warn(this._buildMessage(msg)); } diff --git a/packages/babel-core/src/transformation/file/options/build-config-chain.js b/packages/babel-core/src/transformation/file/options/build-config-chain.js index 5902d4c16e..a5af4e82ba 100644 --- a/packages/babel-core/src/transformation/file/options/build-config-chain.js +++ b/packages/babel-core/src/transformation/file/options/build-config-chain.js @@ -1,4 +1,3 @@ -import type Logger from "../logger"; import resolve from "../../../helpers/resolve"; import json5 from "json5"; import path from "path"; @@ -21,9 +20,9 @@ function exists(filename) { } } -export default function buildConfigChain(opts: Object = {}, log?: Logger) { +export default function buildConfigChain(opts: Object = {}) { const filename = opts.filename; - const builder = new ConfigChainBuilder(log); + const builder = new ConfigChainBuilder(); // resolve all .babelrc files if (opts.babelrc !== false) { @@ -40,10 +39,9 @@ export default function buildConfigChain(opts: Object = {}, log?: Logger) { } class ConfigChainBuilder { - constructor(log?: Logger) { + constructor() { this.resolvedConfigs = []; this.configs = []; - this.log = log; } errorMultipleConfigs(loc1: string, loc2: string) { @@ -183,7 +181,7 @@ class ConfigChainBuilder { if (extendsLoc) { this.addConfig(extendsLoc); } else { - if (this.log) this.log.error(`Couldn't resolve extends clause of ${options.extends} in ${alias}`); + throw new Error(`Couldn't resolve extends clause of ${options.extends} in ${alias}`); } delete options.extends; } diff --git a/packages/babel-core/src/transformation/file/options/option-manager.js b/packages/babel-core/src/transformation/file/options/option-manager.js index 6c63ba32fa..762a643784 100644 --- a/packages/babel-core/src/transformation/file/options/option-manager.js +++ b/packages/babel-core/src/transformation/file/options/option-manager.js @@ -1,5 +1,4 @@ import * as context from "../../../index"; -import type Logger from "../logger"; import Plugin from "../../plugin"; import * as messages from "babel-messages"; import { normaliseOptions } from "./index"; @@ -35,15 +34,13 @@ type MergeOptions = { }; export default class OptionManager { - constructor(log?: Logger) { + constructor() { this.resolvedConfigs = []; this.options = OptionManager.createBareOptions(); - this.log = log; } resolvedConfigs: Array; options: Object; - log: ?Logger; static memoisedPlugins: Array<{ container: Function; @@ -158,7 +155,7 @@ export default class OptionManager { // if (typeof rawOpts !== "object" || Array.isArray(rawOpts)) { - this.log.error(`Invalid options type for ${alias}`, TypeError); + throw new TypeError(`Invalid options type for ${alias}`); } // @@ -176,15 +173,14 @@ export default class OptionManager { const option = config[key]; // check for an unknown option - if (!option && this.log) { + if (!option) { if (removed[key]) { - this.log.error(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`, - ReferenceError); + throw new ReferenceError(`Using removed Babel 5 option: ${alias}.${key} - ${removed[key].message}`); } else { // eslint-disable-next-line max-len const unknownOptErr = `Unknown option: ${alias}.${key}. Check out http://babeljs.io/docs/usage/options/ for more information about options.`; - this.log.error(unknownOptErr, ReferenceError); + throw new ReferenceError(unknownOptErr); } } } @@ -333,7 +329,7 @@ export default class OptionManager { } init(opts: Object = {}): Object { - for (const config of buildConfigChain(opts, this.log)) { + for (const config of buildConfigChain(opts)) { this.mergeOptions(config); } diff --git a/packages/babel-core/test/api.js b/packages/babel-core/test/api.js index bf03ff2f46..097b515b1a 100644 --- a/packages/babel-core/test/api.js +++ b/packages/babel-core/test/api.js @@ -141,7 +141,7 @@ describe("api", function () { plugins: [__dirname + "/../../babel-plugin-syntax-jsx", false], }); }, - /TypeError: Falsy value found in plugins/ + /TypeError: \[BABEL\] unknown: Falsy value found in plugins/ ); }); diff --git a/packages/babel-core/test/option-manager.js b/packages/babel-core/test/option-manager.js index a38436d197..126ed83c27 100644 --- a/packages/babel-core/test/option-manager.js +++ b/packages/babel-core/test/option-manager.js @@ -1,6 +1,5 @@ import assert from "assert"; import OptionManager from "../lib/transformation/file/options/option-manager"; -import Logger from "../lib/transformation/file/logger"; import path from "path"; describe("option-manager", () => { @@ -17,7 +16,7 @@ describe("option-manager", () => { it("throws for removed babel 5 options", () => { return assert.throws( () => { - const opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(); opt.init({ "randomOption": true, }); @@ -29,7 +28,7 @@ describe("option-manager", () => { it("throws for removed babel 5 options", () => { return assert.throws( () => { - const opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(); opt.init({ "auxiliaryComment": true, "blacklist": true, @@ -43,7 +42,7 @@ describe("option-manager", () => { it("throws for resolved but erroring preset", () => { return assert.throws( () => { - const opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(); opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/not-a-preset")], }); @@ -56,7 +55,7 @@ describe("option-manager", () => { describe("presets", function () { function presetTest(name) { it(name, function () { - const opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(); const options = opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)], }); @@ -68,7 +67,7 @@ describe("option-manager", () => { function presetThrowsTest(name, msg) { it(name, function () { - const opt = new OptionManager(new Logger(null, "unknown")); + const opt = new OptionManager(); assert.throws(() => opt.init({ "presets": [path.join(__dirname, "fixtures/option-manager/presets", name)], }), msg); From ca71c7469663d5e4a189c9145b12ab298b7db310 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Tue, 7 Mar 2017 15:37:00 -0800 Subject: [PATCH 220/222] Move plugin and pass initialization into a more central location. --- .../src/transformation/file/index.js | 83 +++++++------------ 1 file changed, 31 insertions(+), 52 deletions(-) diff --git a/packages/babel-core/src/transformation/file/index.js b/packages/babel-core/src/transformation/file/index.js index 24f991623f..f11e750303 100644 --- a/packages/babel-core/src/transformation/file/index.js +++ b/packages/babel-core/src/transformation/file/index.js @@ -45,7 +45,17 @@ export default class File extends Store { super(); this.log = new Logger(this, opts.filename || "unknown"); - this.opts = this.initOptions(opts); + + opts = this.initOptions(opts); + + let passes = []; + if (opts.plugins) passes.push(opts.plugins); + + // With "passPerPreset" enabled there may still be presets in the options. + if (opts.presets) passes = passes.concat(opts.presets.map((preset) => preset.plugins).filter(Boolean)); + + this.pluginPasses = passes; + this.opts = opts; this.parserOpts = { sourceType: this.opts.sourceType, @@ -53,22 +63,12 @@ export default class File extends Store { plugins: [], }; - this.pluginVisitors = []; - this.pluginPasses = []; - - // Plugins for top-level options. - this.buildPluginsForOptions(this.opts); - - // If we are in the "pass per preset" mode, build - // also plugins for each preset. - if (this.opts.passPerPreset) { - // All the "per preset" options are inherited from the main options. - this.perPresetOpts = []; - this.opts.presets.forEach((presetOpts) => { - const perPresetOpts = Object.assign(Object.create(this.opts), presetOpts); - this.perPresetOpts.push(perPresetOpts); - this.buildPluginsForOptions(perPresetOpts); - }); + for (const pluginPairs of passes) { + for (const [ plugin ] of pluginPairs) { + if (plugin.manipulateOptions) { + plugin.manipulateOptions(opts, this.parserOpts, this); + } + } } this.metadata = { @@ -100,8 +100,7 @@ export default class File extends Store { static helpers: Array; - pluginVisitors: Array; - pluginPasses: Array; + pluginPasses: Array>; parserOpts: BabelParserOptions; log: Logger; opts: Object; @@ -170,31 +169,6 @@ export default class File extends Store { return opts; } - buildPluginsForOptions(opts) { - if (!Array.isArray(opts.plugins)) { - return; - } - - const plugins: Array<[PluginPass, Object]> = opts.plugins.concat(INTERNAL_PLUGINS); - const currentPluginVisitors = []; - const currentPluginPasses = []; - - // init plugins! - for (const ref of plugins) { - const [plugin, pluginOpts] = ref; // todo: fix - can't embed in loop head because of flow bug - - currentPluginVisitors.push(plugin.visitor); - currentPluginPasses.push(new PluginPass(this, plugin, pluginOpts)); - - if (plugin.manipulateOptions) { - plugin.manipulateOptions(opts, this.parserOpts, this); - } - } - - this.pluginVisitors.push(currentPluginVisitors); - this.pluginPasses.push(currentPluginPasses); - } - getModuleName(): ?string { const opts = this.opts; if (!opts.moduleIds) { @@ -460,20 +434,25 @@ export default class File extends Store { } transform(): BabelFileResult { - // In the "pass per preset" mode, we have grouped passes. - // Otherwise, there is only one plain pluginPasses array. - for (let i = 0; i < this.pluginPasses.length; i++) { - const pluginPasses = this.pluginPasses[i]; - this.call("pre", pluginPasses); + for (const pluginPairs of this.pluginPasses) { + const passes = []; + const visitors = []; + + for (const [ plugin, pluginOpts ] of pluginPairs.concat(INTERNAL_PLUGINS)) { + const pass = new PluginPass(this, plugin, pluginOpts); + passes.push(pass); + visitors.push(plugin.visitor); + } + + this.call("pre", passes); this.log.debug("Start transform traverse"); // merge all plugin visitors into a single visitor - const visitor = traverse.visitors.merge(this.pluginVisitors[i], pluginPasses, - this.opts.wrapPluginVisitorMethod); + const visitor = traverse.visitors.merge(visitors, passes, this.opts.wrapPluginVisitorMethod); traverse(this.ast, visitor, this.scope); this.log.debug("End transform traverse"); - this.call("post", pluginPasses); + this.call("post", passes); } return this.generate(); From 911b71f2c62d4cefda14449f13b674c6015740b8 Mon Sep 17 00:00:00 2001 From: Aaron Ang Date: Fri, 10 Mar 2017 06:49:28 -0800 Subject: [PATCH 221/222] Use absolute paths in Babel's CONTRIBUTING.md (#5431) --- CONTRIBUTING.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 086a042266..fa6650e420 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ ---- -

+

Setup | Running linting/tests @@ -27,7 +27,7 @@ Contributions are always welcome, no matter how large or small. - If you aren't just making a documentation change, you'll probably want to learn a bit about a few topics. - [ASTs](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (Abstract Syntax Tree): The Babel AST [spec](https://github.com/babel/babylon/blob/master/ast/spec.md) is a bit different from [ESTree](https://github.com/estree/estree). The differences are listed [here](https://github.com/babel/babylon#output). - - This repository's [`/doc`](/doc) directory for notes on Babel's internals + - This repository's [`/doc`](https://github.com/babel/babel/tree/master/doc) directory for notes on Babel's internals - Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin! - Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser - When you feel ready to finally jump into the babel source code a good start is to look out for issues which are labeled with [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and/or [beginner-friendly](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner-friendly%22). @@ -47,7 +47,7 @@ You can check this with `node -v` and `npm -v`. In addition, make sure that Yarn is installed. Installation instructions can be found here: https://yarnpkg.com/en/docs/install. -#### Setup +### Setup ```sh $ git clone https://github.com/babel/babel @@ -77,7 +77,7 @@ If you wish to build a copy of Babel for distribution, then run: $ make build-dist ``` -#### Running linting/tests +### Running linting/tests You can run lint via: @@ -108,7 +108,7 @@ $ make test-only Most likely you'll want to focus in on a specific issue. -To run tests for a specific package in [packages](/packages), you can use the `TEST_ONLY` environment variable: +To run tests for a specific package in [packages](https://github.com/babel/babel/tree/master/packages), you can use the `TEST_ONLY` environment variable: ```sh $ TEST_ONLY=babel-cli make test @@ -133,27 +133,27 @@ $ BABEL_ENV=cov make build $ ./scripts/test-cov.sh ``` -#### Writing tests +### Writing tests -Most packages in [`/packages`](/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](/packages/babel-core/test/fixtures). +Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures). -##### `babel-plugin-x` +#### `babel-plugin-x` All the Babel plugins (and other packages) that have a `/test/fixtures` are written in a similar way. -For example, in [`babel-plugin-transform-exponentiation-operator/test`](/packages/babel-plugin-transform-exponentiation-operator/test): +For example, in [`babel-plugin-transform-exponentiation-operator/test`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test): -- There is an `index.js` file. It imports our [test helper](/packages/babel-helper-plugin-test-runner). (You don't have to worry about this). -- There can be multiple folders under [`/fixtures`](/packages/babel-plugin-transform-exponentiation-operator/test/fixtures) - - There is an [`options.json`](/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. +- There is an `index.js` file. It imports our [test helper](https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-test-runner). (You don't have to worry about this). +- There can be multiple folders under [`/fixtures`](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures) + - There is an [`options.json`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/options.json) file whose function is similar to a `.babelrc` file, allowing you to pass in the plugins and settings you need for your tests. - For this test, we only need the relevant plugin, so it's just `{ "plugins": ["transform-exponentiation-operator"] }`. - If necessary, you can have an `options.json` with different options in each subfolder. - In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix) - Generally, there are two kinds of tests for plugins - - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`actual.js`](packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/actual.js) file and an [`expected.js`](/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/expected.js) file. + - The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`actual.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/actual.js) file and an [`expected.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/expected.js) file. - If you need to expect an error, you can ignore creating the `expected.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created. - - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. + - The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file. In an actual/expected test, you simply write out the code you want transformed in `actual.js`. @@ -186,7 +186,7 @@ If you need to check for an error that is thrown you can add to the `options.jso } ``` -##### Bootstrapping expected output +#### Bootstrapping expected output For both `babel-plugin-x` and `babylon`, you can easily generate an `expected.js`/`expected.json` automatically by just providing `actual.js` and running the tests as you usually would. @@ -202,7 +202,7 @@ For both `babel-plugin-x` and `babylon`, you can easily generate an `expected.js - expected.json (will be generated if not created) ``` -#### Debugging code +### Debugging code A common approach to debugging JavaScript code is to walk through the code using the [Chrome DevTools](https://developers.google.com/web/tools/chrome-devtools/) debugger. For illustration purposes, we are going to assume that we need to get a better understanding of [`Generator.generate()`](https://github.com/babel/babel/blob/b5246994b57f06af871be6a63dcc4c6fd41d94d6/packages/babel-generator/src/index.js#L32), which is responsible for generating code for a given AST. @@ -239,9 +239,9 @@ The debugger starts at the first executed line of code, which is Mocha's first l Click _Resume script execution_ Resume script execution button. to jump to the set breakpoint. Note that the code shown in Chrome DevTools is compiled code and therefore differs. -#### Internals +## Internals - AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md)) -- Versioning ([doc/design/versioning.md](./doc/design/versioning.md)) -- Monorepo ([doc/design/monorepo.md](./doc/design/monorepo.md)) -- Compiler environment support ([doc/design/compiler-environment-support.md](./doc/design/compiler-environment-support.md)) -- Compiler assumptions ([doc/design/compiler-assumptions.md](./doc/design/compiler-assumptions.md)) +- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md) +- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)) +- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/master/doc/design/compiler-environment-support.md)) +- Compiler assumptions ([doc/design/compiler-assumptions.md](https://github.com/babel/babel/blob/master/doc/design/compiler-assumptions.md)) From 5287e138176bc7ea18cb12f6e6e2aa821e1eefb7 Mon Sep 17 00:00:00 2001 From: MrSpider Date: Fri, 10 Mar 2017 20:41:03 +0100 Subject: [PATCH 222/222] Fix replacing function declaration in export default (fixes #4468) (#5444) --- .../babel-traverse/src/path/replacement.js | 3 +- packages/babel-traverse/test/replacement.js | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 packages/babel-traverse/test/replacement.js diff --git a/packages/babel-traverse/src/path/replacement.js b/packages/babel-traverse/src/path/replacement.js index a2028e6d8b..e82bba5b39 100644 --- a/packages/babel-traverse/src/path/replacement.js +++ b/packages/babel-traverse/src/path/replacement.js @@ -125,7 +125,8 @@ export function replaceWith(replacement) { if (this.isNodeType("Statement") && t.isExpression(replacement)) { if ( !this.canHaveVariableDeclarationOrExpression() && - !this.canSwapBetweenExpressionAndStatement(replacement) + !this.canSwapBetweenExpressionAndStatement(replacement) && + !this.parentPath.isExportDefaultDeclaration() ) { // replacing a statement with an expression so wrap it in an expression statement replacement = t.expressionStatement(replacement); diff --git a/packages/babel-traverse/test/replacement.js b/packages/babel-traverse/test/replacement.js new file mode 100644 index 0000000000..eb29364f2f --- /dev/null +++ b/packages/babel-traverse/test/replacement.js @@ -0,0 +1,28 @@ +import traverse from "../lib"; +import assert from "assert"; +import { parse } from "babylon"; +import * as t from "babel-types"; + +describe("path/replacement", function () { + describe("replaceWith", function () { + const ast = parse("export default function() {};", { sourceType: "module" }); + + it("replaces declaration in ExportDefaultDeclaration node", function() { + traverse(ast, { + FunctionDeclaration(path) { + path.replaceWith(t.arrayExpression([ + t.functionExpression( + path.node.id, + path.node.params, + path.node.body, + path.node.generator, + path.node.async + ), + ])); + }, + }); + + assert(ast.program.body[0].declaration.type == "ArrayExpression"); + }); + }); +});