From 06cf7face24d0f06e7b690dfc30912ec1e3e1bfb Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Thu, 4 Apr 2019 15:15:34 -0700 Subject: [PATCH] Remove Polyfills from RN Open Source Summary: We don't need these polyfills in RN Open Source any longer because JSC supports these features natively. We also don't need these internally at FB, but I want the removal to be a step by step process and separate from the open source work. Reviewed By: rickhanlonii Differential Revision: D14762827 fbshipit-source-id: 114626bd18516c42ced43c3f7aa29d42d1d95335 --- Libraries/polyfills/Array.es6.js | 81 --- Libraries/polyfills/Array.prototype.es6.js | 95 --- Libraries/polyfills/Number.es6.js | 38 -- Libraries/polyfills/Object.es6.js | 39 -- Libraries/polyfills/String.prototype.es6.js | 160 ------ Libraries/polyfills/babelHelpers.js | 608 -------------------- jest/setup.js | 1 - rn-get-polyfills.js | 5 - 8 files changed, 1027 deletions(-) delete mode 100644 Libraries/polyfills/Array.es6.js delete mode 100644 Libraries/polyfills/Array.prototype.es6.js delete mode 100644 Libraries/polyfills/Number.es6.js delete mode 100644 Libraries/polyfills/Object.es6.js delete mode 100644 Libraries/polyfills/String.prototype.es6.js delete mode 100644 Libraries/polyfills/babelHelpers.js diff --git a/Libraries/polyfills/Array.es6.js b/Libraries/polyfills/Array.es6.js deleted file mode 100644 index 64c012c7d6d15e..00000000000000 --- a/Libraries/polyfills/Array.es6.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @polyfill - * @nolint - */ - -/* eslint-disable consistent-this */ - -/** - * Creates an array from array like objects. - * - * https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from - */ -if (!Array.from) { - Array.from = function(arrayLike /*, mapFn, thisArg */) { - if (arrayLike == null) { - throw new TypeError('Object is null or undefined'); - } - - // Optional args. - var mapFn = arguments[1]; - var thisArg = arguments[2]; - - var C = this; - var items = Object(arrayLike); - var symbolIterator = - typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'; - var mapping = typeof mapFn === 'function'; - var usingIterator = typeof items[symbolIterator] === 'function'; - var key = 0; - var ret; - var value; - - if (usingIterator) { - ret = typeof C === 'function' ? new C() : []; - var it = items[symbolIterator](); - var next; - - while (!(next = it.next()).done) { - value = next.value; - - if (mapping) { - value = mapFn.call(thisArg, value, key); - } - - ret[key] = value; - key += 1; - } - - ret.length = key; - return ret; - } - - var len = items.length; - if (isNaN(len) || len < 0) { - len = 0; - } - - ret = typeof C === 'function' ? new C(len) : new Array(len); - - while (key < len) { - value = items[key]; - - if (mapping) { - value = mapFn.call(thisArg, value, key); - } - - ret[key] = value; - - key += 1; - } - - ret.length = key; - return ret; - }; -} diff --git a/Libraries/polyfills/Array.prototype.es6.js b/Libraries/polyfills/Array.prototype.es6.js deleted file mode 100644 index 1b2395d064db4b..00000000000000 --- a/Libraries/polyfills/Array.prototype.es6.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @polyfill - * @nolint - */ - -/* eslint-disable no-bitwise, no-extend-native, radix, no-self-compare */ - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex -function findIndex(predicate, context) { - if (this == null) { - throw new TypeError( - 'Array.prototype.findIndex called on null or undefined', - ); - } - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - var list = Object(this); - var length = list.length >>> 0; - for (var i = 0; i < length; i++) { - if (predicate.call(context, list[i], i, list)) { - return i; - } - } - return -1; -} - -if (!Array.prototype.findIndex) { - Object.defineProperty(Array.prototype, 'findIndex', { - enumerable: false, - writable: true, - configurable: true, - value: findIndex, - }); -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find -if (!Array.prototype.find) { - Object.defineProperty(Array.prototype, 'find', { - enumerable: false, - writable: true, - configurable: true, - value: function(predicate, context) { - if (this == null) { - throw new TypeError('Array.prototype.find called on null or undefined'); - } - var index = findIndex.call(this, predicate, context); - return index === -1 ? undefined : this[index]; - }, - }); -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes -if (!Array.prototype.includes) { - Object.defineProperty(Array.prototype, 'includes', { - enumerable: false, - writable: true, - configurable: true, - value: function(searchElement) { - var O = Object(this); - var len = parseInt(O.length) || 0; - if (len === 0) { - return false; - } - var n = parseInt(arguments[1]) || 0; - var k; - if (n >= 0) { - k = n; - } else { - k = len + n; - if (k < 0) { - k = 0; - } - } - var currentElement; - while (k < len) { - currentElement = O[k]; - if ( - searchElement === currentElement || - (searchElement !== searchElement && currentElement !== currentElement) - ) { - return true; - } - k++; - } - return false; - }, - }); -} diff --git a/Libraries/polyfills/Number.es6.js b/Libraries/polyfills/Number.es6.js deleted file mode 100644 index 8fd538f425d0a9..00000000000000 --- a/Libraries/polyfills/Number.es6.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @polyfill - * @nolint - */ - -if (Number.EPSILON === undefined) { - Object.defineProperty(Number, 'EPSILON', { - value: Math.pow(2, -52), - }); -} -if (Number.MAX_SAFE_INTEGER === undefined) { - Object.defineProperty(Number, 'MAX_SAFE_INTEGER', { - value: Math.pow(2, 53) - 1, - }); -} -if (Number.MIN_SAFE_INTEGER === undefined) { - Object.defineProperty(Number, 'MIN_SAFE_INTEGER', { - value: -(Math.pow(2, 53) - 1), - }); -} -if (!Number.isNaN) { - // https://github.com/dherman/tc39-codex-wiki/blob/master/data/es6/number/index.md#polyfill-for-numberisnan - const globalIsNaN = global.isNaN; - Object.defineProperty(Number, 'isNaN', { - configurable: true, - enumerable: false, - value: function isNaN(value) { - return typeof value === 'number' && globalIsNaN(value); - }, - writable: true, - }); -} diff --git a/Libraries/polyfills/Object.es6.js b/Libraries/polyfills/Object.es6.js deleted file mode 100644 index b6c09479f6a307..00000000000000 --- a/Libraries/polyfills/Object.es6.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @polyfill - */ - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign - -if (typeof Object.assign !== 'function') { - Object.defineProperty(Object, 'assign', { - value: function assign(target, varArgs) { - 'use strict'; - if (target == null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - - let to = Object(target); - - for (let index = 1; index < arguments.length; index++) { - let nextSource = arguments[index]; - - if (nextSource != null) { - for (let nextKey in nextSource) { - if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { - to[nextKey] = nextSource[nextKey]; - } - } - } - } - return to; - }, - writable: true, - configurable: true, - }); -} diff --git a/Libraries/polyfills/String.prototype.es6.js b/Libraries/polyfills/String.prototype.es6.js deleted file mode 100644 index 0c312c06d0de2c..00000000000000 --- a/Libraries/polyfills/String.prototype.es6.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @polyfill - * @nolint - */ - -/* eslint-disable no-extend-native, no-bitwise */ - -/* - * NOTE: We use (Number(x) || 0) to replace NaN values with zero. - */ - -if (!String.prototype.startsWith) { - String.prototype.startsWith = function(search) { - 'use strict'; - if (this == null) { - throw TypeError(); - } - var string = String(this); - var pos = arguments.length > 1 ? Number(arguments[1]) || 0 : 0; - var start = Math.min(Math.max(pos, 0), string.length); - return string.indexOf(String(search), pos) === start; - }; -} - -if (!String.prototype.endsWith) { - String.prototype.endsWith = function(search) { - 'use strict'; - if (this == null) { - throw TypeError(); - } - var string = String(this); - var stringLength = string.length; - var searchString = String(search); - var pos = arguments.length > 1 ? Number(arguments[1]) || 0 : stringLength; - var end = Math.min(Math.max(pos, 0), stringLength); - var start = end - searchString.length; - if (start < 0) { - return false; - } - return string.lastIndexOf(searchString, start) === start; - }; -} - -if (!String.prototype.repeat) { - String.prototype.repeat = function(count) { - 'use strict'; - if (this == null) { - throw TypeError(); - } - var string = String(this); - count = Number(count) || 0; - if (count < 0 || count === Infinity) { - throw RangeError(); - } - if (count === 1) { - return string; - } - var result = ''; - while (count) { - if (count & 1) { - result += string; - } - if ((count >>= 1)) { - string += string; - } - } - return result; - }; -} - -if (!String.prototype.includes) { - String.prototype.includes = function(search, start) { - 'use strict'; - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > this.length) { - return false; - } else { - return this.indexOf(search, start) !== -1; - } - }; -} - -if (!String.prototype.codePointAt) { - String.prototype.codePointAt = function(position) { - if (this == null) { - throw TypeError(); - } - var string = String(this); - var size = string.length; - // `ToInteger` - var index = position ? Number(position) : 0; - if (Number.isNaN(index)) { - index = 0; - } - // Account for out-of-bounds indices: - if (index < 0 || index >= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( - // check if it’s the start of a surrogate pair - first >= 0xd800 && - first <= 0xdbff && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xdc00 && second <= 0xdfff) { - // low surrogate - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xd800) * 0x400 + second - 0xdc00 + 0x10000; - } - } - return first; - }; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padEnd -if (!String.prototype.padEnd) { - String.prototype.padEnd = function padEnd(targetLength, padString) { - targetLength = targetLength >> 0; //floor if number or convert non-number to 0; - padString = String(typeof padString !== 'undefined' ? padString : ' '); - if (this.length > targetLength) { - return String(this); - } else { - targetLength = targetLength - this.length; - if (targetLength > padString.length) { - padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed - } - return String(this) + padString.slice(0, targetLength); - } - }; -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart -if (!String.prototype.padStart) { - String.prototype.padStart = function padStart(targetLength, padString) { - targetLength = targetLength >> 0; //truncate if number or convert non-number to 0; - padString = String(typeof padString !== 'undefined' ? padString : ' '); - if (this.length > targetLength) { - return String(this); - } else { - targetLength = targetLength - this.length; - if (targetLength > padString.length) { - padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed - } - return padString.slice(0, targetLength) + String(this); - } - }; -} diff --git a/Libraries/polyfills/babelHelpers.js b/Libraries/polyfills/babelHelpers.js deleted file mode 100644 index 605f6daaaa85d2..00000000000000 --- a/Libraries/polyfills/babelHelpers.js +++ /dev/null @@ -1,608 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * Regenerate through - * `js1 upgrade babel-helpers` + manual tweaks - * - * Components used for this file; - * - arrayWithHoles - * - arrayWithoutHoles - * - assertThisInitialized - * - classCallCheck - * - construct - * - createClass - * - defineProperty - * - extends - * - get - * - getPrototypeOf - * - inherits - * - interopRequireDefault - * - interopRequireWildcard - * - iterableToArray - * - iterableToArrayLimit - * - nonIterableRest - * - nonIterableSpread - * - objectSpread - * - objectWithoutProperties - * - possibleConstructorReturn - * - setPrototypeOf - * - slicedToArray - * - superPropBase - * - taggedTemplateLiteral - * - taggedTemplateLiteralLoose - * - toArray - * - toConsumableArray - * - wrapNativeSuper - * - * @flow - * @generated (with babel 7.0.0-beta.47) - * @format - * @nolint - * @polyfill - */ - -/* eslint-disable no-func-assign, no-shadow, no-proto, no-void, no-undef-init */ - -'use strict'; - -var babelHelpers = (global.babelHelpers = {}); - -// ### classCallCheck ### - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } -} - -babelHelpers.classCallCheck = _classCallCheck; - -// ### createClass ### - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ('value' in descriptor) { - descriptor.writable = true; - } - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) { - _defineProperties(Constructor.prototype, protoProps); - } - if (staticProps) { - _defineProperties(Constructor, staticProps); - } - return Constructor; -} - -babelHelpers.createClass = _createClass; - -// ### defineProperty ### - -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; -} - -babelHelpers.defineProperty = _defineProperty; - -// ### extends ### - -function _extends() { - babelHelpers.extends = _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; - }; - - return _extends.apply(this, arguments); -} - -babelHelpers.extends = _extends; - -// ### setPrototypeOf ### - -function _setPrototypeOf(o, p) { - babelHelpers.setPrototypeOf = _setPrototypeOf = - Object.setPrototypeOf || - function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -babelHelpers.setPrototypeOf = _setPrototypeOf; - -// ### superPropBase ### - -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = babelHelpers.getPrototypeOf(object); - if (object === null) { - break; - } - } - - return object; -} - -babelHelpers.superPropBase = _superPropBase; - -// ### get ### - -// FB: -// TODO: prepack does not like Reflect (and we can use the fallback just fine) -// function _get(target, property, receiver) { -// if (typeof Reflect !== 'undefined' && Reflect.get) { -// babelHelpers.get = _get = Reflect.get; -// } else { -// babelHelpers.get = _get = function _get(target, property, receiver) { -// var base = babelHelpers.superPropBase(target, property); -// if (!base) { -// return; -// } -// var desc = Object.getOwnPropertyDescriptor(base, property); -// -// if (desc.get) { -// return desc.get.call(receiver); -// } -// -// return desc.value; -// }; -// } -// -// return _get(target, property, receiver || target); -// } -// -// babelHelpers.get = _get; - -babelHelpers.get = function _get(target, property, receiver = target) { - var base = babelHelpers.superPropBase(target, property); - if (!base) { - return; - } - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; -}; - -// ### inherits ### - -function _inherits(subClass, superClass) { - if (typeof superClass !== 'function' && superClass !== null) { - throw new TypeError('Super expression must either be null or a function'); - } - - babelHelpers.setPrototypeOf( - subClass.prototype, - superClass && superClass.prototype, - ); - if (superClass) { - babelHelpers.setPrototypeOf(subClass, superClass); - } -} - -babelHelpers.inherits = _inherits; - -// ### construct ### - -function _construct(Parent, args, Class) { - // FB: - // TODO: prepack does not like this line (and we can use the fallback just fine) - // if (typeof Reflect !== 'undefined' && Reflect.construct) { - // babelHelpers.construct = _construct = Reflect.construct; - // } else { - babelHelpers.construct = _construct = function _construct( - Parent, - args, - Class, - ) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Parent.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) { - babelHelpers.setPrototypeOf(instance, Class.prototype); - } - return instance; - }; - // } - - return _construct.apply(null, arguments); -} - -babelHelpers.construct = _construct; - -// ### getPrototypeOf ### - -function _getPrototypeOf(o) { - babelHelpers.getPrototypeOf = _getPrototypeOf = - Object.getPrototypeOf || - function _getPrototypeOf(o) { - return o.__proto__; - }; - - return _getPrototypeOf(o); -} - -babelHelpers.getPrototypeOf = _getPrototypeOf; - -// ### assertThisInitialized ### - -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError( - "this hasn't been initialised - super() hasn't been called", - ); - } - - return self; -} - -babelHelpers.assertThisInitialized = _assertThisInitialized; - -// ### wrapNativeSuper ### - -function _wrapNativeSuper(Class) { - var _cache = typeof Map === 'function' ? new Map() : undefined; - - babelHelpers.wrapNativeSuper = _wrapNativeSuper = function _wrapNativeSuper( - Class, - ) { - if (typeof Class !== 'function') { - throw new TypeError('Super expression must either be null or a function'); - } - - if (typeof _cache !== 'undefined') { - if (_cache.has(Class)) { - return _cache.get(Class); - } - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - // FB: - // this is a temporary fix for a babel bug (it's invoking the wrong func - // when you do `super()`) - return _construct(Class, arguments, _getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true, - }, - }); - return babelHelpers.setPrototypeOf( - Wrapper, - babelHelpers.setPrototypeOf(function Super() { - return babelHelpers.construct( - Class, - arguments, - babelHelpers.getPrototypeOf(this).constructor, - ); - }, Class), - ); - }; - - return _wrapNativeSuper(Class); -} - -babelHelpers.wrapNativeSuper = _wrapNativeSuper; - -// ### interopRequireDefault ### - -function _interopRequireDefault(obj) { - return obj && obj.__esModule - ? obj - : { - default: obj, - }; -} - -babelHelpers.interopRequireDefault = _interopRequireDefault; - -// ### interopRequireWildcard ### - -function _interopRequireWildcard(obj) { - if (obj && obj.__esModule) { - return obj; - } else { - var newObj = {}; - - if (obj != null) { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = - Object.defineProperty && Object.getOwnPropertyDescriptor - ? Object.getOwnPropertyDescriptor(obj, key) - : {}; - - if (desc.get || desc.set) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - } - - newObj.default = obj; - return newObj; - } -} - -babelHelpers.interopRequireWildcard = _interopRequireWildcard; - -// ### objectWithoutProperties ### - -function _objectWithoutProperties(source, excluded) { - if (source == null) { - return {}; - } - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) { - continue; - } - target[key] = source[key]; - } - - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) { - continue; - } - if (!Object.prototype.propertyIsEnumerable.call(source, key)) { - continue; - } - target[key] = source[key]; - } - } - - return target; -} - -babelHelpers.objectWithoutProperties = _objectWithoutProperties; - -// ### possibleConstructorReturn ### - -function _possibleConstructorReturn(self, call) { - if (call && (typeof call === 'object' || typeof call === 'function')) { - return call; - } - - return babelHelpers.assertThisInitialized(self); -} - -babelHelpers.possibleConstructorReturn = _possibleConstructorReturn; - -// ### arrayWithHoles ### - -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) { - return arr; - } -} - -babelHelpers.arrayWithHoles = _arrayWithHoles; - -// ### arrayWithoutHoles ### - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { - arr2[i] = arr[i]; - } - - return arr2; - } -} - -babelHelpers.arrayWithoutHoles = _arrayWithoutHoles; - -// ### iterableToArrayLimit ### - -function _iterableToArrayLimit(arr, i) { - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for ( - var _i = arr[Symbol.iterator](), _s; - !(_n = (_s = _i.next()).done); - _n = true - ) { - _arr.push(_s.value); - - if (i && _arr.length === i) { - break; - } - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i.return != null) { - _i.return(); - } - } finally { - if (_d) { - throw _e; - } - } - } - - return _arr; -} - -babelHelpers.iterableToArrayLimit = _iterableToArrayLimit; - -// ### nonIterableRest ### - -function _nonIterableRest() { - throw new TypeError('Invalid attempt to destructure non-iterable instance'); -} - -babelHelpers.nonIterableRest = _nonIterableRest; - -// ### nonIterableSpread ### - -function _nonIterableSpread() { - throw new TypeError('Invalid attempt to spread non-iterable instance'); -} - -babelHelpers.nonIterableSpread = _nonIterableSpread; - -// ### slicedToArray ### - -function _slicedToArray(arr, i) { - return ( - babelHelpers.arrayWithHoles(arr) || - babelHelpers.iterableToArrayLimit(arr, i) || - babelHelpers.nonIterableRest() - ); -} - -babelHelpers.slicedToArray = _slicedToArray; - -// ### taggedTemplateLiteral ### - -function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - return Object.freeze( - Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw), - }, - }), - ); -} - -babelHelpers.taggedTemplateLiteral = _taggedTemplateLiteral; - -// ### toArray ### - -function _toArray(arr) { - return ( - babelHelpers.arrayWithHoles(arr) || - babelHelpers.iterableToArray(arr) || - babelHelpers.nonIterableRest() - ); -} - -babelHelpers.toArray = _toArray; - -// ### toConsumableArray ### - -function _toConsumableArray(arr) { - return ( - babelHelpers.arrayWithoutHoles(arr) || - babelHelpers.iterableToArray(arr) || - babelHelpers.nonIterableSpread() - ); -} - -babelHelpers.toConsumableArray = _toConsumableArray; - -// ### taggedTemplateLiteralLoose ### - -function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - - strings.raw = raw; - return strings; -} - -babelHelpers.taggedTemplateLiteralLoose = _taggedTemplateLiteralLoose; - -// ### objectSpread ### - -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - var ownKeys = Object.keys(source); - - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys = ownKeys.concat( - Object.getOwnPropertySymbols(source).filter(function(sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - }), - ); - } - - ownKeys.forEach(function(key) { - babelHelpers.defineProperty(target, key, source[key]); - }); - } - - return target; -} - -babelHelpers.objectSpread = _objectSpread; - -// ### iterableToArray ### - -function _iterableToArray(iter) { - if ( - Symbol.iterator in Object(iter) || - Object.prototype.toString.call(iter) === '[object Arguments]' - ) { - return Array.from(iter); - } -} - -babelHelpers.iterableToArray = _iterableToArray; diff --git a/jest/setup.js b/jest/setup.js index 17aa9ccc5f9369..d7fefdfd426494 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -12,7 +12,6 @@ const MockNativeMethods = jest.requireActual('./MockNativeMethods'); const mockComponent = jest.requireActual('./mockComponent'); -jest.requireActual('../Libraries/polyfills/babelHelpers.js'); jest.requireActual('../Libraries/polyfills/Object.es7.js'); jest.requireActual('../Libraries/polyfills/error-guard'); diff --git a/rn-get-polyfills.js b/rn-get-polyfills.js index 121fa00ab66543..a0041d6ef17410 100644 --- a/rn-get-polyfills.js +++ b/rn-get-polyfills.js @@ -10,12 +10,7 @@ 'use strict'; module.exports = () => [ - require.resolve('./Libraries/polyfills/Object.es6.js'), require.resolve('./Libraries/polyfills/console.js'), require.resolve('./Libraries/polyfills/error-guard.js'), - require.resolve('./Libraries/polyfills/Number.es6.js'), - require.resolve('./Libraries/polyfills/String.prototype.es6.js'), - require.resolve('./Libraries/polyfills/Array.prototype.es6.js'), - require.resolve('./Libraries/polyfills/Array.es6.js'), require.resolve('./Libraries/polyfills/Object.es7.js'), ];