diff --git a/.babelrc.js b/.babelrc.js index 436e94f974..d09ac00ebe 100644 --- a/.babelrc.js +++ b/.babelrc.js @@ -1,46 +1,14 @@ "use strict"; -// Thanks Logan for this. -// This works around https://github.com/istanbuljs/istanbuljs/issues/92 until -// we have a version of Istanbul that actually works with 7.x. -function istanbulHacks() { - return { - inherits: require("babel-plugin-istanbul").default, - visitor: { - Program: { - exit: function(path) { - if (!this.__dv__) return - - const node = path.node.body[0]; - if ( - node.type !== "VariableDeclaration" || - node.declarations[0].id.type !== "Identifier" || - !node.declarations[0].id.name.match(/cov_/) || - node._blockHoist !== 3 - ) { - throw new Error("Something has gone wrong in Logan's hacks."); - } - - // Gross hacks to put the code coverage block above all compiled - // import statement output. - node._blockHoist = 5; - }, - }, - }, - }; -} - let envOpts = { loose: true, }; const config = { comments: false, - presets: [ - ["@babel/env", envOpts], - ], + presets: [["@babel/env", envOpts]], plugins: [ - // TODO: Use @babel/preset-flow when + // TODO: Use @babel/preset-flow when // https://github.com/babel/babel/issues/7233 is fixed "@babel/plugin-transform-flow-strip-types", ["@babel/proposal-class-properties", { loose: true }], @@ -48,23 +16,25 @@ const config = { "@babel/proposal-numeric-separator", ["@babel/proposal-object-rest-spread", { useBuiltIns: true }], ], - overrides: [{ - test: "packages/babylon", - plugins: [ - "babel-plugin-transform-charcodes", - ["@babel/transform-for-of", { assumeArray: true }], - ], - }], + overrides: [ + { + test: "packages/babylon", + plugins: [ + "babel-plugin-transform-charcodes", + ["@babel/transform-for-of", { assumeArray: true }], + ], + }, + ], }; if (process.env.BABEL_ENV === "cov") { config.auxiliaryCommentBefore = "istanbul ignore next"; - config.plugins.push(istanbulHacks); + config.plugins.push("babel-plugin-istanbul"); } if (process.env.BABEL_ENV === "development") { envOpts.targets = { - node: "current" + node: "current", }; envOpts.debug = true; } diff --git a/package.json b/package.json index baf7716f07..3ee0302b58 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "async": "^1.5.0", "babel-eslint": "^8.0.1", "babel-loader": "8.0.0-beta.0", - "babel-plugin-istanbul": "^4.1.4", + "babel-plugin-istanbul": "^4.1.5", "babel-plugin-transform-charcodes": "0.0.10", "babylon": "7.0.0-beta.39", "browserify": "^13.1.1", diff --git a/yarn.lock b/yarn.lock index 2b1189861f..6f0fef56f7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1167,8 +1167,8 @@ babel-eslint@^8.0.1: eslint-visitor-keys "^1.0.0" babel-generator@^6.18.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" dependencies: babel-messages "^6.23.0" babel-runtime "^6.26.0" @@ -1176,7 +1176,7 @@ babel-generator@^6.18.0: detect-indent "^4.0.0" jsesc "^1.3.0" lodash "^4.17.4" - source-map "^0.5.6" + source-map "^0.5.7" trim-right "^1.0.1" babel-loader@8.0.0-beta.0: @@ -1193,7 +1193,7 @@ babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-istanbul@^4.1.4: +babel-plugin-istanbul@^4.1.5: version "4.1.5" resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.5.tgz#6760cdd977f411d3e175bb064f2bc327d99b2b6e" dependencies: @@ -3835,12 +3835,18 @@ interpret@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" -invariant@^2.2.0, invariant@^2.2.2: +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" +invariant@^2.2.2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.3.tgz#1a827dfde7dcbd7c323f0ca826be8fa7c5e9d688" + 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" @@ -4144,9 +4150,9 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" -istanbul-lib-coverage@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz#73bfb998885299415c93d38a3e9adf784a77a9da" +istanbul-lib-coverage@^1.1.1, istanbul-lib-coverage@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.2.tgz#4113c8ff6b7a40a1ef7350b01016331f63afde14" istanbul-lib-hook@^1.1.0: version "1.1.0" @@ -4154,7 +4160,19 @@ istanbul-lib-hook@^1.1.0: dependencies: append-transform "^0.4.0" -istanbul-lib-instrument@^1.7.5, istanbul-lib-instrument@^1.9.1: +istanbul-lib-instrument@^1.7.5: + version "1.9.2" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.2.tgz#84905bf47f7e0b401d6b840da7bad67086b4aab6" + dependencies: + babel-generator "^6.18.0" + babel-template "^6.16.0" + babel-traverse "^6.18.0" + babel-types "^6.18.0" + babylon "^6.18.0" + istanbul-lib-coverage "^1.1.2" + semver "^5.3.0" + +istanbul-lib-instrument@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-1.9.1.tgz#250b30b3531e5d3251299fdd64b0b2c9db6b558e" dependencies: @@ -4674,10 +4692,14 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "~3.0.0" -lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: +lodash@^4.0.0, lodash@^4.1.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.17.4: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" + lodash@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" @@ -6260,7 +6282,7 @@ source-map-url@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" -source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: +source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -6607,8 +6629,8 @@ tempfile@^1.1.1: uuid "^2.0.1" test-exclude@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.1.1.tgz#4d84964b0966b0087ecc334a2ce002d3d9341e26" + version "4.2.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-4.2.0.tgz#07e3613609a362c74516a717515e13322ab45b3c" dependencies: arrify "^1.0.1" micromatch "^2.3.11"