diff --git a/.travis.yml b/.travis.yml index 4312dc6d..e29bd240 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_install: - nvm use $TRAVIS_NODE_VERSION - npm set loglevel error - npm set progress false - - 'if [ $PKG_CMD = "yarn" ]; then npm i -g yarn@0.18.2 ; fi' + - 'if [ $PKG_CMD = "yarn" ]; then npm i -g yarn@0.22.0 ; fi' install: - $PKG_CMD install script: diff --git a/data/plugin-features.js b/data/plugin-features.js index bd87fd41..82d0e9df 100644 --- a/data/plugin-features.js +++ b/data/plugin-features.js @@ -39,6 +39,11 @@ module.exports = { "destructuring, parameters", ], }, + "transform-es2015-duplicate-keys": { + features: [ + "miscellaneous / duplicate property names in strict mode", + ], + }, "transform-es2015-for-of": { features: [ "for..of loops", diff --git a/data/plugins.json b/data/plugins.json index 6630092e..bf3a8778 100644 --- a/data/plugins.json +++ b/data/plugins.json @@ -34,6 +34,15 @@ "ios": 10, "opera": 33 }, + "transform-es2015-duplicate-keys": { + "chrome": 42, + "edge": 12, + "firefox": 34, + "safari": 9, + "node": 4, + "ios": 9, + "opera": 29 + }, "transform-es2015-computed-properties": { "chrome": 44, "edge": 12, diff --git a/test/debug-fixtures/builtins-uglify/stdout.txt b/test/debug-fixtures/builtins-uglify/stdout.txt index 0cfe3cc4..1ce53032 100644 --- a/test/debug-fixtures/builtins-uglify/stdout.txt +++ b/test/debug-fixtures/builtins-uglify/stdout.txt @@ -13,6 +13,7 @@ Using plugins: transform-es2015-block-scoped-functions {"uglify":true} transform-es2015-block-scoping {"uglify":true} transform-es2015-classes {"uglify":true} + transform-es2015-duplicate-keys {"uglify":true} transform-es2015-computed-properties {"uglify":true} check-es2015-constants {"uglify":true} transform-es2015-destructuring {"uglify":true} diff --git a/test/debug-fixtures/builtins/stdout.txt b/test/debug-fixtures/builtins/stdout.txt index c25134be..11042836 100644 --- a/test/debug-fixtures/builtins/stdout.txt +++ b/test/debug-fixtures/builtins/stdout.txt @@ -14,6 +14,7 @@ Using plugins: transform-es2015-block-scoped-functions {"ie":10} transform-es2015-block-scoping {"ie":10} transform-es2015-classes {"ie":10} + transform-es2015-duplicate-keys {"ie":10} transform-es2015-computed-properties {"ie":10} check-es2015-constants {"ie":10} transform-es2015-destructuring {"ie":10,"node":6} @@ -110,4 +111,4 @@ Using polyfills: web.timers {"chrome":54,"ie":10,"node":6} web.immediate {"chrome":54,"ie":10,"node":6} web.dom.iterable {"chrome":54,"ie":10,"node":6} -src/in.js -> lib/in.js +src/in.js -> lib/in.js \ No newline at end of file diff --git a/test/debug-fixtures/plugins-only/stdout.txt b/test/debug-fixtures/plugins-only/stdout.txt index 5263ed55..a2ccd28b 100644 --- a/test/debug-fixtures/plugins-only/stdout.txt +++ b/test/debug-fixtures/plugins-only/stdout.txt @@ -14,4 +14,4 @@ Using plugins: transform-es2015-function-name {"firefox":52} transform-es2015-literals {"firefox":52} syntax-trailing-function-commas {"node":7.4} -src/in.js -> lib/in.js +src/in.js -> lib/in.js \ No newline at end of file diff --git a/test/debug-fixtures/specific-targets/stdout.txt b/test/debug-fixtures/specific-targets/stdout.txt index 3300cba2..9372c273 100644 --- a/test/debug-fixtures/specific-targets/stdout.txt +++ b/test/debug-fixtures/specific-targets/stdout.txt @@ -17,6 +17,7 @@ Using plugins: transform-es2015-block-scoped-functions {"edge":13,"ie":10,"ios":9,"safari":7} transform-es2015-block-scoping {"edge":13,"firefox":49,"ie":10,"ios":9,"safari":7} transform-es2015-classes {"ie":10,"ios":9,"safari":7} + transform-es2015-duplicate-keys {"ie":10,"safari":7} transform-es2015-computed-properties {"ie":10,"safari":7} check-es2015-constants {"edge":13,"firefox":49,"ie":10,"ios":9,"safari":7} transform-es2015-destructuring {"edge":13,"firefox":49,"ie":10,"ios":9,"safari":7} diff --git a/test/fixtures/preset-options/transform-duplicate-keys/actual.js b/test/fixtures/preset-options/transform-duplicate-keys/actual.js new file mode 100644 index 00000000..d7bc7a47 --- /dev/null +++ b/test/fixtures/preset-options/transform-duplicate-keys/actual.js @@ -0,0 +1 @@ +var a = { b:1, b: 2}; diff --git a/test/fixtures/preset-options/transform-duplicate-keys/expected.js b/test/fixtures/preset-options/transform-duplicate-keys/expected.js new file mode 100644 index 00000000..5f926665 --- /dev/null +++ b/test/fixtures/preset-options/transform-duplicate-keys/expected.js @@ -0,0 +1,3 @@ +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 a = _defineProperty({ b: 1 }, "b", 2); \ No newline at end of file diff --git a/test/fixtures/preset-options/transform-duplicate-keys/options.json b/test/fixtures/preset-options/transform-duplicate-keys/options.json new file mode 100644 index 00000000..1f29c71c --- /dev/null +++ b/test/fixtures/preset-options/transform-duplicate-keys/options.json @@ -0,0 +1,7 @@ +{ + "presets": [ + ["../../../../lib", { + "modules": false + }] + ] +}