From 2f28de5d70066174e523123eb363613bd7c438fb Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 11 Apr 2017 11:45:16 -0500 Subject: [PATCH 01/10] Add Android browser to name map --- experimental/babel-preset-env/src/index.js | 1 + .../test/debug-fixtures/android/options.json | 11 ++ .../test/debug-fixtures/android/stdout.txt | 121 ++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 experimental/babel-preset-env/test/debug-fixtures/android/options.json create mode 100644 experimental/babel-preset-env/test/debug-fixtures/android/stdout.txt diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index d709ed0763..c94c222e11 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -47,6 +47,7 @@ const isBrowsersQueryValid = (browsers) => { }; const browserNameMap = { + android: "android", chrome: "chrome", edge: "edge", firefox: "firefox", diff --git a/experimental/babel-preset-env/test/debug-fixtures/android/options.json b/experimental/babel-preset-env/test/debug-fixtures/android/options.json new file mode 100644 index 0000000000..76d1b23aed --- /dev/null +++ b/experimental/babel-preset-env/test/debug-fixtures/android/options.json @@ -0,0 +1,11 @@ +{ + "presets": [ + ["../../lib", { + "debug": true, + "targets": { + "browsers": [ "Android >= 4" ] + }, + "useBuiltIns": true + }] + ] +} diff --git a/experimental/babel-preset-env/test/debug-fixtures/android/stdout.txt b/experimental/babel-preset-env/test/debug-fixtures/android/stdout.txt new file mode 100644 index 0000000000..3e79295670 --- /dev/null +++ b/experimental/babel-preset-env/test/debug-fixtures/android/stdout.txt @@ -0,0 +1,121 @@ +babel-preset-env: `DEBUG` option + +Using targets: +{ + "android": 4 +} + +Modules transform: commonjs + +Using plugins: + check-es2015-constants {"android":4} + transform-es2015-arrow-functions {"android":4} + transform-es2015-block-scoped-functions {"android":4} + transform-es2015-block-scoping {"android":4} + transform-es2015-classes {"android":4} + transform-es2015-computed-properties {"android":4} + transform-es2015-destructuring {"android":4} + transform-es2015-duplicate-keys {"android":4} + transform-es2015-for-of {"android":4} + transform-es2015-function-name {"android":4} + transform-es2015-literals {"android":4} + transform-es2015-object-super {"android":4} + transform-es2015-parameters {"android":4} + transform-es2015-shorthand-properties {"android":4} + transform-es2015-spread {"android":4} + transform-es2015-sticky-regex {"android":4} + transform-es2015-template-literals {"android":4} + transform-es2015-typeof-symbol {"android":4} + transform-es2015-unicode-regex {"android":4} + transform-regenerator {"android":4} + transform-exponentiation-operator {"android":4} + transform-async-to-generator {"android":4} + syntax-trailing-function-commas {"android":4} + +Using polyfills: + es6.typed.array-buffer {"android":4} + es6.typed.int8-array {"android":4} + es6.typed.uint8-array {"android":4} + es6.typed.uint8-clamped-array {"android":4} + es6.typed.int16-array {"android":4} + es6.typed.uint16-array {"android":4} + es6.typed.int32-array {"android":4} + es6.typed.uint32-array {"android":4} + es6.typed.float32-array {"android":4} + es6.typed.float64-array {"android":4} + es6.map {"android":4} + es6.set {"android":4} + es6.weak-map {"android":4} + es6.weak-set {"android":4} + es6.reflect.apply {"android":4} + es6.reflect.construct {"android":4} + es6.reflect.define-property {"android":4} + es6.reflect.delete-property {"android":4} + es6.reflect.get {"android":4} + es6.reflect.get-own-property-descriptor {"android":4} + es6.reflect.get-prototype-of {"android":4} + es6.reflect.has {"android":4} + es6.reflect.is-extensible {"android":4} + es6.reflect.own-keys {"android":4} + es6.reflect.prevent-extensions {"android":4} + es6.reflect.set {"android":4} + es6.reflect.set-prototype-of {"android":4} + es6.promise {"android":4} + es6.symbol {"android":4} + es6.object.assign {"android":4} + es6.object.is {"android":4} + es6.object.set-prototype-of {"android":4} + es6.function.name {"android":4} + es6.string.raw {"android":4} + es6.string.from-code-point {"android":4} + es6.string.code-point-at {"android":4} + es6.string.repeat {"android":4} + es6.string.starts-with {"android":4} + es6.string.ends-with {"android":4} + es6.string.includes {"android":4} + es6.regexp.flags {"android":4} + es6.regexp.match {"android":4} + es6.regexp.replace {"android":4} + es6.regexp.split {"android":4} + es6.regexp.search {"android":4} + es6.array.from {"android":4} + es6.array.of {"android":4} + es6.array.copy-within {"android":4} + es6.array.find {"android":4} + es6.array.find-index {"android":4} + es6.array.fill {"android":4} + es6.array.iterator {"android":4} + es6.number.is-finite {"android":4} + es6.number.is-integer {"android":4} + es6.number.is-safe-integer {"android":4} + es6.number.is-nan {"android":4} + es6.number.epsilon {"android":4} + es6.number.min-safe-integer {"android":4} + es6.number.max-safe-integer {"android":4} + es6.math.acosh {"android":4} + es6.math.asinh {"android":4} + es6.math.atanh {"android":4} + es6.math.cbrt {"android":4} + es6.math.clz32 {"android":4} + es6.math.cosh {"android":4} + es6.math.expm1 {"android":4} + es6.math.fround {"android":4} + es6.math.hypot {"android":4} + es6.math.imul {"android":4} + es6.math.log1p {"android":4} + es6.math.log10 {"android":4} + es6.math.log2 {"android":4} + es6.math.sign {"android":4} + es6.math.sinh {"android":4} + es6.math.tanh {"android":4} + es6.math.trunc {"android":4} + es7.array.includes {"android":4} + es7.object.values {"android":4} + es7.object.entries {"android":4} + es7.object.get-own-property-descriptors {"android":4} + es7.string.pad-start {"android":4} + es7.string.pad-end {"android":4} + web.timers {"android":4} + web.immediate {"android":4} + web.dom.iterable {"android":4} +src/in.js -> lib/in.js \ No newline at end of file From d60cd65213dcb86d201a95965b85e1c1f0c1463d Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Tue, 11 Apr 2017 20:53:33 +0300 Subject: [PATCH 02/10] Remove deprecated comment (#271) --- experimental/babel-preset-env/src/normalize-options.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/experimental/babel-preset-env/src/normalize-options.js b/experimental/babel-preset-env/src/normalize-options.js index 7c9cb340d8..b57aa48de2 100644 --- a/experimental/babel-preset-env/src/normalize-options.js +++ b/experimental/babel-preset-env/src/normalize-options.js @@ -53,9 +53,6 @@ export const checkDuplicateIncludeExcludes = (include = [], exclude = []) => { ); }; -// TODO: Allow specifying plugins as either shortened or full name -// babel-plugin-transform-es2015-classes -// transform-es2015-classes export const validateLooseOption = (looseOpt = false) => { invariant( typeof looseOpt === "boolean", From 9abd056ccdf52c0136254960cd84b43f42f2f588 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 11 Apr 2017 16:40:36 -0500 Subject: [PATCH 03/10] Bump compat-table for Edge 15 support --- .../babel-preset-env/data/plugins.json | 1 + experimental/babel-preset-env/package.json | 2 +- experimental/babel-preset-env/yarn.lock | 282 +++++++----------- 3 files changed, 115 insertions(+), 170 deletions(-) diff --git a/experimental/babel-preset-env/data/plugins.json b/experimental/babel-preset-env/data/plugins.json index f5b6c10888..caa81ba278 100644 --- a/experimental/babel-preset-env/data/plugins.json +++ b/experimental/babel-preset-env/data/plugins.json @@ -211,6 +211,7 @@ }, "transform-async-to-generator": { "chrome": 55, + "edge": 15, "firefox": 52, "safari": 10.1, "node": 7.6, diff --git a/experimental/babel-preset-env/package.json b/experimental/babel-preset-env/package.json index ea3bf95d0c..f30a5a504b 100644 --- a/experimental/babel-preset-env/package.json +++ b/experimental/babel-preset-env/package.json @@ -63,7 +63,7 @@ "babel-register": "^6.23.0", "chai": "^3.5.0", "codecov": "^1.0.1", - "compat-table": "kangax/compat-table#c38f039b8ea7fadf347d3e300fec3611645e31e9", + "compat-table": "kangax/compat-table#861954b6e13d3eaa1ba9ef1a016906c0fc1072db", "eslint": "^3.17.1", "eslint-config-babel": "^6.0.0", "eslint-plugin-flowtype": "^2.29.1", diff --git a/experimental/babel-preset-env/yarn.lock b/experimental/babel-preset-env/yarn.lock index b157427e67..770e5af733 100644 --- a/experimental/babel-preset-env/yarn.lock +++ b/experimental/babel-preset-env/yarn.lock @@ -1,5 +1,7 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 + + abab@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" @@ -20,6 +22,10 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" +acorn@4.0.4, acorn@^4.0.3: + version "4.0.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" + acorn@^2.1.0, acorn@^2.4.0: version "2.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-2.7.0.tgz#ab6e7d9d886aaca8b085bc3312b79a198433f0e7" @@ -28,18 +34,10 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^4.0.3: - version "4.0.11" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" - acorn@^5.0.1: version "5.0.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.2.tgz#dc1c8fb907f64db2ab573de2326b73527c24de36" -acorn@4.0.4: - 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" @@ -51,13 +49,6 @@ ajv@^4.7.0: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^4.9.1: - version "4.11.5" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" - 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" @@ -1130,10 +1121,6 @@ caseless@~0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.11.0.tgz#715b96ea9841593cc33067923f5ec60ebda4f7d7" -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - center-align@^0.1.1: version "0.1.3" resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" @@ -1258,7 +1245,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@^2.5.0, commander@^2.8.1, commander@^2.9.0, commander@2.9.0, commander@2.9.x: +commander@2.9.0, commander@2.9.x, commander@^2.5.0, commander@^2.8.1, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1282,11 +1269,33 @@ commoner@^0.10.1: q "^1.1.2" recast "^0.11.17" -compat-table@kangax/compat-table#c38f039b8ea7fadf347d3e300fec3611645e31e9: +compat-table@kangax/compat-table#861954b6e13d3eaa1ba9ef1a016906c0fc1072db: version "0.0.0" - resolved "https://codeload.github.com/kangax/compat-table/tar.gz/c38f039b8ea7fadf347d3e300fec3611645e31e9" + resolved "https://codeload.github.com/kangax/compat-table/tar.gz/861954b6e13d3eaa1ba9ef1a016906c0fc1072db" dependencies: + babel-core latest + babel-polyfill latest + babel-preset-es2015 latest + babel-preset-es2016 latest + babel-preset-es2017 latest + babel-preset-stage-0 latest + chalk "^1.1.3" + cheerio "^0.20.0" + closurecompiler latest + core-js latest + es5-shim latest + es6-shim latest + es6-transpiler latest + es7-shim latest + esdown latest + espree latest + esprima latest + jshint latest + jstransform latest + lodash.pickby "^4.6.0" object.assign "^4.0.4" + traceur latest + typescript latest concat-map@0.0.1: version "0.0.1" @@ -1348,7 +1357,7 @@ css-what@2.1: version "2.1.0" resolved "https://registry.yarnpkg.com/css-what/-/css-what-2.1.0.tgz#9467d032c38cfaefb9f2d79501253062f87fa1bd" -"cssom@>= 0.3.0 < 0.4.0", cssom@0.3.x: +cssom@0.3.x, "cssom@>= 0.3.0 < 0.4.0": version "0.3.2" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.2.tgz#b8036170c79f07a90ff2f16e22284027a243848b" @@ -1378,7 +1387,7 @@ 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.1.1, debug@^2.2.0, debug@~2.2.0, debug@2.2.0: +debug@2.2.0, debug@^2.1.1, 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: @@ -1467,21 +1476,17 @@ doctrine@^1.2.2: esutils "^2.0.2" isarray "^1.0.0" -dom-serializer@~0.1.0, dom-serializer@0: +dom-serializer@0, dom-serializer@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" dependencies: domelementtype "~1.1.1" entities "~1.1.1" -domelementtype@~1.1.1: +domelementtype@1, domelementtype@~1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b" -domelementtype@1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2" - domhandler@2.3: version "2.3.0" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.3.0.tgz#2de59a0822d5027fabff6f032c2b25a2a8abe738" @@ -1505,14 +1510,14 @@ electron-to-chromium@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.2.tgz#b8ce5c93b308db0e92f6d0435c46ddec8f6363ab" -entities@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" - entities@1.0: version "1.0.0" resolved "https://registry.yarnpkg.com/entities/-/entities-1.0.0.tgz#b2987aa3821347fcde642b24fdfc9e4fb712bf26" +entities@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.1.tgz#6e5c2d0a5621b5dadaecef80b90edfb5cd7772f0" + error-ex@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" @@ -1543,14 +1548,14 @@ es5-ext@^0.10.7, es5-ext@^0.10.8, es5-ext@~0.10.11, es5-ext@~0.10.2, es5-ext@~0. es6-iterator "2" es6-symbol "~3.1" -es5-shim@~4.0.0: - version "4.0.6" - resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.0.6.tgz#443bf1f0503cdeabceb01ec80a84af1b8f1ca9f7" - es5-shim@latest: version "4.5.9" resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.9.tgz#2a1e2b9e583ff5fed0c20a3ee2cbf3f75230a5c0" +es5-shim@~4.0.0: + version "4.0.6" + resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.0.6.tgz#443bf1f0503cdeabceb01ec80a84af1b8f1ca9f7" + es6-iterator@2: version "2.0.0" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac" @@ -1584,7 +1589,7 @@ es6-shim@latest: version "0.35.3" resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.3.tgz#9bfb7363feffff87a6cdb6cd93e405ec3c4b6f26" -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: @@ -1630,7 +1635,7 @@ es7-shim@latest: string.prototype.trimleft "^2.0.0" string.prototype.trimright "^2.0.0" -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" @@ -1729,7 +1734,7 @@ esprima@^2.6.0, esprima@^2.7.1: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" -esprima@~3.1.0, esprima@latest: +esprima@latest, esprima@~3.1.0: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" @@ -1982,7 +1987,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^5.0.15, glob@5.0.x: +glob@5.0.x, glob@^5.0.15: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" dependencies: @@ -1992,7 +1997,7 @@ glob@^5.0.15, glob@5.0.x: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@7.0.5: +glob@7.0.5, glob@^7.0.0, glob@^7.0.3: version "7.0.5" resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" dependencies: @@ -2055,10 +2060,6 @@ handlebars@^4.0.3: optionalDependencies: uglify-js "^2.6" -har-schema@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" - har-validator@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" @@ -2068,13 +2069,6 @@ har-validator@~2.0.6: is-my-json-valid "^2.12.4" pinkie-promise "^2.0.0" -har-validator@~4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-4.2.1.tgz#33481d0f1bbff600dd203d75812a6a5fba002e2a" - dependencies: - ajv "^4.9.1" - har-schema "^1.0.5" - has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -2119,7 +2113,7 @@ hosted-git-info@^2.1.4: version "2.2.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.2.0.tgz#7a0d097863d886c0fabbdcd37bf1758d8becf8a5" -htmlparser2@~3.8.1, htmlparser2@3.8.x: +htmlparser2@3.8.x, htmlparser2@~3.8.1: version "3.8.3" resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-3.8.3.tgz#996c28b191516a8be86501a7d79757e5c70c1068" dependencies: @@ -2156,7 +2150,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@2: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" @@ -2331,14 +2325,14 @@ is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" -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: 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" @@ -2450,14 +2444,14 @@ 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" - jsesc@latest: version "2.4.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.4.0.tgz#8568d223ff69c0b5e081b4f8edf5a23d978c9867" +jsesc@~0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" + jshint@latest: version "2.9.4" resolved "https://registry.yarnpkg.com/jshint/-/jshint-2.9.4.tgz#5e3ba97848d5290273db514aee47fe24cf592934" @@ -2609,14 +2603,14 @@ lodash.pickby@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" -lodash@^4.0.0, lodash@^4.1.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" - lodash@3.7.x: version "3.7.0" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.7.0.tgz#3678bd8ab995057c07ade836ed2ef087da811d45" +lodash@^4.0.0, lodash@^4.1.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" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -2678,21 +2672,21 @@ mime-types@^2.1.12, mime-types@~2.1.7: dependencies: mime-db "~1.25.0" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@~3.0.2, "minimatch@2 || 3": +"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, 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" +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.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.1, mkdirp@0.5.1: +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: @@ -2975,10 +2969,6 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -performance-now@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" - pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -3011,14 +3001,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -private@^0.1.6: +private@^0.1.6, private@~0.1.5: version "0.1.6" resolved "https://registry.yarnpkg.com/private/-/private-0.1.6.tgz#55c6a976d0f9bafb9924851350fe47b9b5fbb7c1" -private@~0.1.5: - version "0.1.7" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" - 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" @@ -3043,10 +3029,6 @@ qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" -qs@~6.4.0: - version "6.4.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.4.0.tgz#13e26d28ad6b0ffaa91312cd3bf708ed351e7233" - randomatic@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb" @@ -3078,6 +3060,15 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" +readable-stream@1.1: + version "1.1.13" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" + 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.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.2.tgz#a9e6fec3c7dda85f8bb1b3ba7028604556fc825e" @@ -3111,15 +3102,6 @@ readable-stream@~2.1.4: string_decoder "~0.10.x" util-deprecate "~1.0.1" -readable-stream@1.1: - version "1.1.13" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.13.tgz#f6eef764f514c89e2b9e23146a75ba106756d23e" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.1" - isarray "0.0.1" - string_decoder "~0.10.x" - readdirp@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78" @@ -3207,34 +3189,7 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@^2.55.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - 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" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - -request@^2.79.0, request@>=2.42.0: +request@>=2.42.0, request@^2.55.0, request@^2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" dependencies: @@ -3299,7 +3254,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.6.1, 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.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: @@ -3331,22 +3286,18 @@ rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" -safe-buffer@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" - sax@^1.1.4: version "1.2.2" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.2.tgz#fd8631a23bc7826bef5d871bdb87378c95647828" +"semver@2 || 3 || 4 || 5", 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.3.3: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" -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" - 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" @@ -3355,6 +3306,10 @@ 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" +shelljs@0.3.x: + version "0.3.0" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.3.0.tgz#3596e6307a781544f591f37da618360f31db57b1" + shelljs@^0.7.5: version "0.7.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.5.tgz#2eef7a50a21e1ccf37da00df767ec69e30ad0675" @@ -3363,10 +3318,6 @@ shelljs@^0.7.5: interpret "^1.0.0" rechoir "^0.6.2" -shelljs@0.3.x: - version "0.3.0" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.3.0.tgz#3596e6307a781544f591f37da618360f31db57b1" - signal-exit@^2.0.0: version "2.1.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-2.1.2.tgz#375879b1f92ebc3b334480d038dc546a6d558564" @@ -3413,6 +3364,12 @@ source-map-support@~0.2.8: dependencies: source-map "0.1.32" +source-map@0.1.32: + version "0.1.32" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.32.tgz#c8b6c167797ba4740a8ea33252162ff08591b266" + dependencies: + amdefine ">=0.0.4" + source-map@^0.4.2, source-map@^0.4.4: version "0.4.4" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -3429,12 +3386,6 @@ source-map@~0.2.0: dependencies: amdefine ">=0.0.4" -source-map@0.1.32: - version "0.1.32" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.32.tgz#c8b6c167797ba4740a8ea33252162ff08591b266" - dependencies: - amdefine ">=0.0.4" - spawn-wrap@1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-1.2.4.tgz#920eb211a769c093eebfbd5b0e7a5d2e68ab2e40" @@ -3479,10 +3430,6 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.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-alter@latest: version "0.7.3" resolved "https://registry.yarnpkg.com/string-alter/-/string-alter-0.7.3.tgz#a99f203d7293396348b49fc723dd7ab0a0b8d892" @@ -3540,6 +3487,10 @@ string.prototype.trimright@^2.0.0: define-properties "^1.1.2" function-bind "^1.0.2" +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + stringmap@~0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/stringmap/-/stringmap-0.2.2.tgz#556c137b258f942b8776f5b2ef582aa069d7d1b1" @@ -3568,7 +3519,7 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" -strip-json-comments@~1.0.4, strip-json-comments@1.0.x: +strip-json-comments@1.0.x, 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" @@ -3576,6 +3527,12 @@ 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" +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" @@ -3584,12 +3541,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" - "symbol-tree@>= 3.1.0 < 4.0.0": version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" @@ -3686,12 +3637,6 @@ tryit@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - dependencies: - safe-buffer "^5.0.1" - tunnel-agent@~0.4.1: version "0.4.3" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.4.3.tgz#6373db76909fe570e08d73583365ed828a74eeeb" @@ -3706,14 +3651,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.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -3809,6 +3754,10 @@ 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: + version "0.0.2" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" + wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" @@ -3817,10 +3766,6 @@ wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" - wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" @@ -3894,4 +3839,3 @@ yargs@~3.10.0: cliui "^2.1.0" decamelize "^1.0.0" window-size "0.1.0" - From f9517db4612f3145fee673504aaf91689cb17b02 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Thu, 13 Apr 2017 18:05:59 +0300 Subject: [PATCH 04/10] Chore: reduce package size. (#281) [skip ci] --- experimental/babel-preset-env/.npmignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/experimental/babel-preset-env/.npmignore b/experimental/babel-preset-env/.npmignore index bf67f6570e..e40dccdc5b 100644 --- a/experimental/babel-preset-env/.npmignore +++ b/experimental/babel-preset-env/.npmignore @@ -1,3 +1,4 @@ +coverage src test node_modules @@ -8,4 +9,5 @@ codecov.yml yarn.lock .nyc_output .vscode +.eslintrc babel-preset-env-*.tgz From a139b12a868dd507748972c139b1252c40b9def3 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 13 Apr 2017 10:08:44 -0500 Subject: [PATCH 05/10] Add a reminder about include/exclude options (#275) * Add a reminder about include/exclude options [skip ci] * include note about adding plugin [skip ci] --- experimental/babel-preset-env/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index 02d47d5dd2..6068bc0d57 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -170,6 +170,8 @@ This option is useful if there is a bug in a native implementation, or a combina For example, Node 4 supports native classes but not spread. If `super` is used with a spread argument, then the `transform-es2015-classes` transform needs to be `include`d, as it is not possible to transpile a spread with `super` otherwise. +> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `transform-do-expressions` or excluding `transform-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly. + ### `exclude` `Array`, defaults to `[]`. From 4648bb6022d7e0dc587c4ea610bdffdf74e67a60 Mon Sep 17 00:00:00 2001 From: Dara Hak Date: Thu, 13 Apr 2017 18:00:00 +0200 Subject: [PATCH 06/10] Clarify note about loading polyfills only once (#282) --- experimental/babel-preset-env/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index 6068bc0d57..5884ae151c 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -197,7 +197,9 @@ npm install babel-polyfill --save This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment. -> NOTE: Only use `require("babel-polyfill");` once in your whole app. One option is to create a single entry file that only contains the require statement. +> NOTE: Only use `require("babel-polyfill");` once in your whole app. +> Multiple imports or requires of `babel-polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace. +> We recommend creating a single entry file that only contains the `require` statement. **In** From 75db91940ef9d5c0b1c218410fd8eda39dafcad6 Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Sat, 15 Apr 2017 00:11:36 +0900 Subject: [PATCH 07/10] Support `spec` option (#98) --- experimental/babel-preset-env/README.md | 6 ++++++ experimental/babel-preset-env/src/index.js | 7 ++++--- .../babel-preset-env/src/normalize-options.js | 19 +++++++++++++------ .../fixtures/preset-options/spec/actual.js | 2 ++ .../fixtures/preset-options/spec/expected.js | 10 ++++++++++ .../fixtures/preset-options/spec/options.json | 7 +++++++ .../test/normalize-options.spec.js | 17 ++++++++++++++++- 7 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/spec/actual.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/spec/expected.js create mode 100644 experimental/babel-preset-env/test/fixtures/preset-options/spec/options.json diff --git a/experimental/babel-preset-env/README.md b/experimental/babel-preset-env/README.md index 5884ae151c..b3d9e01f94 100644 --- a/experimental/babel-preset-env/README.md +++ b/experimental/babel-preset-env/README.md @@ -132,6 +132,12 @@ To prevent these errors - specify the uglify option, which will enable all plugi > NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of ES6 support, but it is not yet stable. You can follow its progress in [UglifyJS2 issue #448](https://github.com/mishoo/UglifyJS2/issues/448). If you require an alternative minifier which _does_ support ES6 syntax, we recommend using [Babili](https://github.com/babel/babili). +### `spec` + +`boolean`, defaults to `false`. + +Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them. + ### `loose` `boolean`, defaults to `false`. diff --git a/experimental/babel-preset-env/src/index.js b/experimental/babel-preset-env/src/index.js index c94c222e11..fe68ea2339 100644 --- a/experimental/babel-preset-env/src/index.js +++ b/experimental/babel-preset-env/src/index.js @@ -165,13 +165,12 @@ function getPlatformSpecificDefaultFor(targets) { export default function buildPreset(context, opts = {}) { const validatedOptions = normalizeOptions(opts); - const { debug, loose, moduleType, useBuiltIns } = validatedOptions; + const { debug, loose, moduleType, spec, useBuiltIns } = validatedOptions; const targets = getTargets(validatedOptions.targets); const include = transformIncludesAndExcludes(validatedOptions.include); const exclude = transformIncludesAndExcludes(validatedOptions.exclude); - const filterPlugins = filterItem.bind(null, targets, exclude.plugins, pluginList); const transformations = Object.keys(pluginList) .filter(filterPlugins) @@ -210,11 +209,13 @@ export default function buildPreset(context, opts = {}) { const modulePlugin = moduleType !== false && moduleTransformations[moduleType]; const plugins = []; + // NOTE: not giving spec here yet to avoid compatibility issues when + // babel-plugin-transform-es2015-modules-commonjs gets its spec mode modulePlugin && plugins.push([require(`babel-plugin-${modulePlugin}`), { loose }]); plugins.push(...transformations.map((pluginName) => - [require(`babel-plugin-${pluginName}`), { loose }] + [require(`babel-plugin-${pluginName}`), { spec, loose }] )); useBuiltIns && diff --git a/experimental/babel-preset-env/src/normalize-options.js b/experimental/babel-preset-env/src/normalize-options.js index b57aa48de2..9b8ebd014a 100644 --- a/experimental/babel-preset-env/src/normalize-options.js +++ b/experimental/babel-preset-env/src/normalize-options.js @@ -53,15 +53,21 @@ export const checkDuplicateIncludeExcludes = (include = [], exclude = []) => { ); }; -export const validateLooseOption = (looseOpt = false) => { - invariant( - typeof looseOpt === "boolean", - "Invalid Option: The 'loose' option must be a boolean." - ); +export const validateBoolOption = (name, value, defaultValue) => { + if (typeof value === "undefined") { + value = defaultValue; + } - return looseOpt; + if (typeof value !== "boolean") { + throw new Error(`Preset env: '${name}' option must be a boolean.`); + } + + return value; }; +export const validateLooseOption = (looseOpt) => validateBoolOption("loose", looseOpt, false); +export const validateSpecOption = (specOpt) => validateBoolOption("spec", specOpt, false); + export const validateModulesOption = (modulesOpt = "commonjs") => { invariant( modulesOpt === false || Object.keys(moduleTransformations).indexOf(modulesOpt) > -1, @@ -104,6 +110,7 @@ export default function normalizeOptions(opts) { include: validateIncludesAndExcludes(opts.include, "include"), loose: validateLooseOption(opts.loose), moduleType: validateModulesOption(opts.modules), + spec: validateSpecOption(opts.spec), targets: opts.targets, useBuiltIns: opts.useBuiltIns }; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/spec/actual.js b/experimental/babel-preset-env/test/fixtures/preset-options/spec/actual.js new file mode 100644 index 0000000000..51403eebdc --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options/spec/actual.js @@ -0,0 +1,2 @@ +const bar = "bar"; +const x = () => `foo${bar}`; diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/spec/expected.js b/experimental/babel-preset-env/test/fixtures/preset-options/spec/expected.js new file mode 100644 index 0000000000..67366fe06e --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options/spec/expected.js @@ -0,0 +1,10 @@ +"use strict"; + +function _newArrowCheck(innerThis, boundThis) { if (innerThis !== boundThis) { throw new TypeError("Cannot instantiate an arrow function"); } } + +var bar = "bar"; +var x = function () { + _newArrowCheck(undefined, undefined); + + return "foo" + bar; +}.bind(undefined); \ No newline at end of file diff --git a/experimental/babel-preset-env/test/fixtures/preset-options/spec/options.json b/experimental/babel-preset-env/test/fixtures/preset-options/spec/options.json new file mode 100644 index 0000000000..8aefcdc8ed --- /dev/null +++ b/experimental/babel-preset-env/test/fixtures/preset-options/spec/options.json @@ -0,0 +1,7 @@ +{ + "presets": [ + ["../../../../lib", { + "spec": true + }] + ] +} diff --git a/experimental/babel-preset-env/test/normalize-options.spec.js b/experimental/babel-preset-env/test/normalize-options.spec.js index da5632198c..2db9bb388d 100644 --- a/experimental/babel-preset-env/test/normalize-options.spec.js +++ b/experimental/babel-preset-env/test/normalize-options.spec.js @@ -5,10 +5,11 @@ const assert = require("assert"); const { checkDuplicateIncludeExcludes, + normalizePluginNames, validateIncludesAndExcludes, validateLooseOption, validateModulesOption, - normalizePluginNames + validateSpecOption, } = normalizeOptions; describe("normalize-options", () => { @@ -60,6 +61,20 @@ describe("normalize-options", () => { }); }); + describe("validateSpecOption", () => { + it("`undefined` option returns false", () => { + assert(validateSpecOption() === false); + }); + + it("`false` option returns false", () => { + assert(validateSpecOption(false) === false); + }); + + it("`true` option returns true", () => { + assert(validateSpecOption(true) === true); + }); + }); + describe("checkDuplicateIncludeExcludes", function() { it("should throw if duplicate names in both", function() { assert.throws(() => { From 88856fc1f2b2b7d05983f333f1b439bf1007bc77 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 14 Apr 2017 10:30:47 -0500 Subject: [PATCH 08/10] Update changelog [skip ci] --- experimental/babel-preset-env/CHANGELOG.md | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/experimental/babel-preset-env/CHANGELOG.md b/experimental/babel-preset-env/CHANGELOG.md index 5e0ee9997d..bc9d5f2806 100644 --- a/experimental/babel-preset-env/CHANGELOG.md +++ b/experimental/babel-preset-env/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## v1.4.0 (2017-04-14) + +### :rocket: New Feature + +- Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky) + +Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them. + +- Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism) + +We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15! + +### :bug: Bug Fix + +- Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism) + +Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4"). + +### :memo: Documentation + +- Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak) +- Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism) + +### :house: Internal + +- Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi) +- Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky) + ## v1.3.3 (2017-04-07) ### :bug: Bug Fix From c478c429eac492081dd8a7b841bebd9c655984ff Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Fri, 14 Apr 2017 10:43:19 -0500 Subject: [PATCH 09/10] 1.4.0 --- experimental/babel-preset-env/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/babel-preset-env/package.json b/experimental/babel-preset-env/package.json index f30a5a504b..0ee7f2ac05 100644 --- a/experimental/babel-preset-env/package.json +++ b/experimental/babel-preset-env/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-env", - "version": "1.3.3", + "version": "1.4.0", "description": "A Babel preset for each environment.", "author": "Henry Zhu ", "homepage": "https://babeljs.io/", From e54cef60a5f00795c49b6dfbf85bb3d235a8129c Mon Sep 17 00:00:00 2001 From: Artem Yavorsky Date: Mon, 17 Apr 2017 19:07:29 +0300 Subject: [PATCH 10/10] Remove hidden files from debug fixtures targets. (#287) --- experimental/babel-preset-env/test/debug-fixtures.js | 1 + 1 file changed, 1 insertion(+) diff --git a/experimental/babel-preset-env/test/debug-fixtures.js b/experimental/babel-preset-env/test/debug-fixtures.js index 76fcbf1509..cfc72fbc3e 100644 --- a/experimental/babel-preset-env/test/debug-fixtures.js +++ b/experimental/babel-preset-env/test/debug-fixtures.js @@ -75,6 +75,7 @@ const buildTest = (opts) => { describe("debug output", () => { fs.readdirSync(fixtureLoc).forEach((testName) => { + if (testName.slice(0, 1) === ".") return; const testLoc = path.join(fixtureLoc, testName); const opts = {