From 046f326ef39481282149dd359fe078eb2e6e3ff7 Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Thu, 30 Mar 2017 15:18:29 -0500 Subject: [PATCH] Add check for ArrayBuffer[Symbol.species] (#233) --- data/built-in-features.js | 4 +- data/built-ins.json | 10 +++ test/debug-fixtures/builtins/stdout.txt | 1 + test/debug-fixtures/electron/stdout.txt | 1 + .../specific-targets/stdout.txt | 1 + .../exclude-regenerator/expected.js | 1 + .../ie-11-built-ins/expected.js | 1 + .../fixtures/preset-options/ios-6/expected.js | 1 + .../use-builtins-all/expected.js | 1 + .../use-builtins-chrome-48/expected.js | 1 + .../use-builtins-chrome-49/expected.js | 1 + .../use-builtins-ie-9/actual.js | 1 + .../use-builtins-ie-9/expected.js | 87 +++++++++++++++++++ .../use-builtins-ie-9/options.json | 12 +++ 14 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/preset-options/use-builtins-ie-9/actual.js create mode 100644 test/fixtures/preset-options/use-builtins-ie-9/expected.js create mode 100644 test/fixtures/preset-options/use-builtins-ie-9/options.json diff --git a/data/built-in-features.js b/data/built-in-features.js index 66e05b52..6073893b 100644 --- a/data/built-in-features.js +++ b/data/built-in-features.js @@ -25,11 +25,11 @@ const typedArrayMethods = [ "typed arrays / %TypedArray%.prototype.values", "typed arrays / %TypedArray%.prototype.entries", "typed arrays / %TypedArray%.prototype[Symbol.iterator]", - "typed arrays / %TypedArray%[Symbol.species]" + "typed arrays / %TypedArray%[Symbol.species]", ]; const es2015 = { - // "es6.typed/array-buffer": "typed arrays / ", + "es6.typed.array-buffer": "typed arrays / ArrayBuffer[Symbol.species]", "es6.typed.data-view": "typed arrays / DataView", "es6.typed.int8-array": { features: ["typed arrays / Int8Array"].concat(typedArrayMethods) diff --git a/data/built-ins.json b/data/built-ins.json index 1040f980..3c91bbf0 100644 --- a/data/built-ins.json +++ b/data/built-ins.json @@ -1,4 +1,14 @@ { + "es6.typed.array-buffer": { + "chrome": 51, + "edge": 13, + "firefox": 48, + "safari": 10, + "node": 6.5, + "ios": 10, + "opera": 38, + "electron": 1.2 + }, "es6.typed.data-view": { "chrome": 5, "opera": 12, diff --git a/test/debug-fixtures/builtins/stdout.txt b/test/debug-fixtures/builtins/stdout.txt index 6c5c4d0b..40aaad88 100644 --- a/test/debug-fixtures/builtins/stdout.txt +++ b/test/debug-fixtures/builtins/stdout.txt @@ -35,6 +35,7 @@ Using plugins: syntax-trailing-function-commas {"chrome":54,"ie":10,"node":6} Using polyfills: + es6.typed.array-buffer {"ie":10,"node":6} es6.typed.int8-array {"ie":10,"node":6} es6.typed.uint8-array {"ie":10,"node":6} es6.typed.uint8-clamped-array {"ie":10,"node":6} diff --git a/test/debug-fixtures/electron/stdout.txt b/test/debug-fixtures/electron/stdout.txt index ac5568ef..7c2efa82 100644 --- a/test/debug-fixtures/electron/stdout.txt +++ b/test/debug-fixtures/electron/stdout.txt @@ -22,6 +22,7 @@ Using plugins: syntax-trailing-function-commas {"electron":0.36} Using polyfills: + es6.typed.array-buffer {"electron":0.36} es6.typed.int8-array {"electron":0.36} es6.typed.uint8-array {"electron":0.36} es6.typed.uint8-clamped-array {"electron":0.36} diff --git a/test/debug-fixtures/specific-targets/stdout.txt b/test/debug-fixtures/specific-targets/stdout.txt index 27609b54..f2b273e7 100644 --- a/test/debug-fixtures/specific-targets/stdout.txt +++ b/test/debug-fixtures/specific-targets/stdout.txt @@ -38,6 +38,7 @@ Using plugins: syntax-trailing-function-commas {"chrome":54,"edge":13,"firefox":49,"ie":10,"ios":9,"safari":7} Using polyfills: + es6.typed.array-buffer {"ie":10,"ios":9,"safari":7} es6.typed.int8-array {"ie":10,"ios":9,"safari":7} es6.typed.uint8-array {"ie":10,"ios":9,"safari":7} es6.typed.uint8-clamped-array {"ie":10,"ios":9,"safari":7} diff --git a/test/fixtures/preset-options/exclude-regenerator/expected.js b/test/fixtures/preset-options/exclude-regenerator/expected.js index 208322c5..0a6d1c06 100644 --- a/test/fixtures/preset-options/exclude-regenerator/expected.js +++ b/test/fixtures/preset-options/exclude-regenerator/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.data-view"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; diff --git a/test/fixtures/preset-options/ie-11-built-ins/expected.js b/test/fixtures/preset-options/ie-11-built-ins/expected.js index c0102226..90d772a4 100644 --- a/test/fixtures/preset-options/ie-11-built-ins/expected.js +++ b/test/fixtures/preset-options/ie-11-built-ins/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; import "core-js/modules/es6.typed.uint8-clamped-array"; diff --git a/test/fixtures/preset-options/ios-6/expected.js b/test/fixtures/preset-options/ios-6/expected.js index 1e0710e1..08cdf3a5 100644 --- a/test/fixtures/preset-options/ios-6/expected.js +++ b/test/fixtures/preset-options/ios-6/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; import "core-js/modules/es6.typed.uint8-clamped-array"; diff --git a/test/fixtures/preset-options/use-builtins-all/expected.js b/test/fixtures/preset-options/use-builtins-all/expected.js index faf52657..66f8810c 100644 --- a/test/fixtures/preset-options/use-builtins-all/expected.js +++ b/test/fixtures/preset-options/use-builtins-all/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.data-view"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; diff --git a/test/fixtures/preset-options/use-builtins-chrome-48/expected.js b/test/fixtures/preset-options/use-builtins-chrome-48/expected.js index a999f888..3a73a587 100644 --- a/test/fixtures/preset-options/use-builtins-chrome-48/expected.js +++ b/test/fixtures/preset-options/use-builtins-chrome-48/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; import "core-js/modules/es6.typed.uint8-clamped-array"; diff --git a/test/fixtures/preset-options/use-builtins-chrome-49/expected.js b/test/fixtures/preset-options/use-builtins-chrome-49/expected.js index f68f7468..d4efb405 100644 --- a/test/fixtures/preset-options/use-builtins-chrome-49/expected.js +++ b/test/fixtures/preset-options/use-builtins-chrome-49/expected.js @@ -1,3 +1,4 @@ +import "core-js/modules/es6.typed.array-buffer"; import "core-js/modules/es6.typed.int8-array"; import "core-js/modules/es6.typed.uint8-array"; import "core-js/modules/es6.typed.uint8-clamped-array"; diff --git a/test/fixtures/preset-options/use-builtins-ie-9/actual.js b/test/fixtures/preset-options/use-builtins-ie-9/actual.js new file mode 100644 index 00000000..d3984c50 --- /dev/null +++ b/test/fixtures/preset-options/use-builtins-ie-9/actual.js @@ -0,0 +1 @@ +import "babel-polyfill"; diff --git a/test/fixtures/preset-options/use-builtins-ie-9/expected.js b/test/fixtures/preset-options/use-builtins-ie-9/expected.js new file mode 100644 index 00000000..abdda365 --- /dev/null +++ b/test/fixtures/preset-options/use-builtins-ie-9/expected.js @@ -0,0 +1,87 @@ +import "core-js/modules/es6.typed.array-buffer"; +import "core-js/modules/es6.typed.data-view"; +import "core-js/modules/es6.typed.int8-array"; +import "core-js/modules/es6.typed.uint8-array"; +import "core-js/modules/es6.typed.uint8-clamped-array"; +import "core-js/modules/es6.typed.int16-array"; +import "core-js/modules/es6.typed.uint16-array"; +import "core-js/modules/es6.typed.int32-array"; +import "core-js/modules/es6.typed.uint32-array"; +import "core-js/modules/es6.typed.float32-array"; +import "core-js/modules/es6.typed.float64-array"; +import "core-js/modules/es6.map"; +import "core-js/modules/es6.set"; +import "core-js/modules/es6.weak-map"; +import "core-js/modules/es6.weak-set"; +import "core-js/modules/es6.reflect.apply"; +import "core-js/modules/es6.reflect.construct"; +import "core-js/modules/es6.reflect.define-property"; +import "core-js/modules/es6.reflect.delete-property"; +import "core-js/modules/es6.reflect.get"; +import "core-js/modules/es6.reflect.get-own-property-descriptor"; +import "core-js/modules/es6.reflect.get-prototype-of"; +import "core-js/modules/es6.reflect.has"; +import "core-js/modules/es6.reflect.is-extensible"; +import "core-js/modules/es6.reflect.own-keys"; +import "core-js/modules/es6.reflect.prevent-extensions"; +import "core-js/modules/es6.reflect.set"; +import "core-js/modules/es6.reflect.set-prototype-of"; +import "core-js/modules/es6.promise"; +import "core-js/modules/es6.symbol"; +import "core-js/modules/es6.object.assign"; +import "core-js/modules/es6.object.is"; +import "core-js/modules/es6.object.set-prototype-of"; +import "core-js/modules/es6.function.name"; +import "core-js/modules/es6.string.raw"; +import "core-js/modules/es6.string.from-code-point"; +import "core-js/modules/es6.string.code-point-at"; +import "core-js/modules/es6.string.repeat"; +import "core-js/modules/es6.string.starts-with"; +import "core-js/modules/es6.string.ends-with"; +import "core-js/modules/es6.string.includes"; +import "core-js/modules/es6.regexp.flags"; +import "core-js/modules/es6.regexp.match"; +import "core-js/modules/es6.regexp.replace"; +import "core-js/modules/es6.regexp.split"; +import "core-js/modules/es6.regexp.search"; +import "core-js/modules/es6.array.from"; +import "core-js/modules/es6.array.of"; +import "core-js/modules/es6.array.copy-within"; +import "core-js/modules/es6.array.find"; +import "core-js/modules/es6.array.find-index"; +import "core-js/modules/es6.array.fill"; +import "core-js/modules/es6.array.iterator"; +import "core-js/modules/es6.number.is-finite"; +import "core-js/modules/es6.number.is-integer"; +import "core-js/modules/es6.number.is-safe-integer"; +import "core-js/modules/es6.number.is-nan"; +import "core-js/modules/es6.number.epsilon"; +import "core-js/modules/es6.number.min-safe-integer"; +import "core-js/modules/es6.number.max-safe-integer"; +import "core-js/modules/es6.math.acosh"; +import "core-js/modules/es6.math.asinh"; +import "core-js/modules/es6.math.atanh"; +import "core-js/modules/es6.math.cbrt"; +import "core-js/modules/es6.math.clz32"; +import "core-js/modules/es6.math.cosh"; +import "core-js/modules/es6.math.expm1"; +import "core-js/modules/es6.math.fround"; +import "core-js/modules/es6.math.hypot"; +import "core-js/modules/es6.math.imul"; +import "core-js/modules/es6.math.log1p"; +import "core-js/modules/es6.math.log10"; +import "core-js/modules/es6.math.log2"; +import "core-js/modules/es6.math.sign"; +import "core-js/modules/es6.math.sinh"; +import "core-js/modules/es6.math.tanh"; +import "core-js/modules/es6.math.trunc"; +import "core-js/modules/es7.array.includes"; +import "core-js/modules/es7.object.values"; +import "core-js/modules/es7.object.entries"; +import "core-js/modules/es7.object.get-own-property-descriptors"; +import "core-js/modules/es7.string.pad-start"; +import "core-js/modules/es7.string.pad-end"; +import "core-js/modules/web.timers"; +import "core-js/modules/web.immediate"; +import "core-js/modules/web.dom.iterable"; +import "regenerator-runtime/runtime"; \ No newline at end of file diff --git a/test/fixtures/preset-options/use-builtins-ie-9/options.json b/test/fixtures/preset-options/use-builtins-ie-9/options.json new file mode 100644 index 00000000..90a95efc --- /dev/null +++ b/test/fixtures/preset-options/use-builtins-ie-9/options.json @@ -0,0 +1,12 @@ +{ + "presets": [ + ["../../../../lib", { + "targets": { + "ie": 9 + }, + "modules": false, + "useBuiltIns": true, + "modules": false + }] + ] +}