diff --git a/react-packager/src/Bundler/base64-vlq.js b/react-packager/src/Bundler/base64-vlq.js index 4483a507..fabbd804 100644 --- a/react-packager/src/Bundler/base64-vlq.js +++ b/react-packager/src/Bundler/base64-vlq.js @@ -1,5 +1,4 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* +/** * Copyright 2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE or: * http://opensource.org/licenses/BSD-3-Clause @@ -33,9 +32,15 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @copyright + * @noflow */ -/*eslint no-bitwise:0,quotes:0,global-strict:0*/ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* eslint-disable no-bitwise, quotes, global-strict */ + +'use strict'; var charToIntMap = {}; var intToCharMap = {}; diff --git a/react-packager/src/Resolver/polyfills/Array.es6.js b/react-packager/src/Resolver/polyfills/Array.es6.js index ae3ac25e..8f9088fa 100644 --- a/react-packager/src/Resolver/polyfills/Array.es6.js +++ b/react-packager/src/Resolver/polyfills/Array.es6.js @@ -1,10 +1,16 @@ /** - * Copyright 2013-2014 Facebook, Inc. + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * * @provides Array.es6 * @polyfill */ -/*eslint-disable */ +/* eslint-disable */ /** * Creates an array from array like objects. diff --git a/react-packager/src/Resolver/polyfills/Array.prototype.es6.js b/react-packager/src/Resolver/polyfills/Array.prototype.es6.js index 7e2078f8..767eec74 100644 --- a/react-packager/src/Resolver/polyfills/Array.prototype.es6.js +++ b/react-packager/src/Resolver/polyfills/Array.prototype.es6.js @@ -1,5 +1,10 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @provides Array.prototype.es6 * @polyfill diff --git a/react-packager/src/Resolver/polyfills/Number.es6.js b/react-packager/src/Resolver/polyfills/Number.es6.js index abd59bba..6f077316 100644 --- a/react-packager/src/Resolver/polyfills/Number.es6.js +++ b/react-packager/src/Resolver/polyfills/Number.es6.js @@ -1,5 +1,5 @@ /** - * Copyright (c) 2013-present, Facebook, Inc. + * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -10,6 +10,8 @@ * @polyfill */ +/* eslint-disable strict */ + if (Number.EPSILON === undefined) { Object.defineProperty(Number, 'EPSILON', { value: Math.pow(2, -52), diff --git a/react-packager/src/Resolver/polyfills/Object.es7.js b/react-packager/src/Resolver/polyfills/Object.es7.js index 597c49e7..1516fc20 100644 --- a/react-packager/src/Resolver/polyfills/Object.es7.js +++ b/react-packager/src/Resolver/polyfills/Object.es7.js @@ -1,18 +1,23 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @provides Object.es7 * @polyfill */ (function() { + 'use strict'; const hasOwnProperty = Object.prototype.hasOwnProperty; /** * Returns an array of the given object's own enumerable entries. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries - * */ if (typeof Object.entries !== 'function') { Object.entries = function(object) { @@ -21,8 +26,8 @@ throw new TypeError('Object.entries called on non-object'); } - let entries = []; - for (let key in object) { + const entries = []; + for (const key in object) { if (hasOwnProperty.call(object, key)) { entries.push([key, object[key]]); } @@ -34,7 +39,6 @@ /** * Returns an array of the given object's own enumerable entries. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values - * */ if (typeof Object.values !== 'function') { Object.values = function(object) { @@ -43,8 +47,8 @@ throw new TypeError('Object.values called on non-object'); } - let values = []; - for (let key in object) { + const values = []; + for (const key in object) { if (hasOwnProperty.call(object, key)) { values.push(object[key]); } @@ -53,4 +57,4 @@ }; } -})(); \ No newline at end of file +})(); diff --git a/react-packager/src/Resolver/polyfills/String.prototype.es6.js b/react-packager/src/Resolver/polyfills/String.prototype.es6.js index 52bbc314..6bfc421f 100644 --- a/react-packager/src/Resolver/polyfills/String.prototype.es6.js +++ b/react-packager/src/Resolver/polyfills/String.prototype.es6.js @@ -1,10 +1,16 @@ /** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * * @provides String.prototype.es6 * @polyfill */ -/*eslint global-strict:0, no-extend-native:0, no-bitwise:0 */ -/*jshint bitwise:false*/ +/* eslint-disable strict, no-extend-native, no-bitwise */ /* * NOTE: We use (Number(x) || 0) to replace NaN values with zero. diff --git a/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js b/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js deleted file mode 100644 index c15d38b0..00000000 --- a/react-packager/src/Resolver/polyfills/__tests__/Number.es6-test.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @emails oncall+jsinfra - */ - -jest.disableAutomock(); - -describe('Number (ES6)', () => { - describe('EPSILON', () => { - beforeEach(() => { - delete Number.EPSILON; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is 2^(-52)', () => { - expect(Number.EPSILON).toBe(Math.pow(2, -52)); - }); - it('can be used to test equality', () => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/EPSILON#Testing_equality - expect(Number.EPSILON).toBeGreaterThan(Math.abs(0.2 - 0.3 + 0.1)); - }); - }); - describe('MAX_SAFE_INTEGER', () => { - beforeEach(() => { - delete Number.MAX_SAFE_INTEGER; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is 2^53 - 1', () => { - expect(Number.MAX_SAFE_INTEGER).toBe(Math.pow(2, 53) - 1); - }); - }); - describe('MIN_SAFE_INTEGER', () => { - beforeEach(() => { - delete Number.MIN_SAFE_INTEGER; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('is -(2^53 - 1)', () => { - expect(Number.MIN_SAFE_INTEGER).toBe(-(Math.pow(2, 53) - 1)); - }); - }); - describe('isNaN()', () => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN#Examples - beforeEach(() => { - delete Number.isNaN; - jest.resetModuleRegistry(); - require('../Number.es6'); - }); - it('returns true when fed something that is not-a-number', () => { - [ - NaN, - Number.NaN, - 0 / 0, - ].forEach(value => expect(Number.isNaN(value)).toBe(true)); - }); - it('returns false when fed something other than not-a-number', () => { - [ - 'NaN', - undefined, - {}, - 'blabla', - true, - null, - 37, - '37', - '37.37', - '', - ' ', - ].forEach(value => expect(Number.isNaN(value)).toBe(false)); - }); - }); -}); diff --git a/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js b/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js index 8d34e2bf..016ab9e4 100644 --- a/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js +++ b/react-packager/src/Resolver/polyfills/__tests__/Object.es7-test.js @@ -1,10 +1,17 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * * @emails oncall+jsinfra */ - /* eslint-disable fb-www/object-create-only-one-param */ +/* eslint-disable fb-www/object-create-only-one-param */ + +'use strict'; jest.disableAutomock(); @@ -35,19 +42,19 @@ describe('Object (ES7)', () => { }); it('should return enumerable entries', () => { - let foo = Object.defineProperties({}, { + const foo = Object.defineProperties({}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); expect(Object.entries(foo)).toEqual([['x', 10]]); - let bar = {x: 10, y: 20}; + const bar = {x: 10, y: 20}; expect(Object.entries(bar)).toEqual([['x', 10], ['y', 20]]); }); it('should work with proto-less objects', () => { - let foo = Object.create(null, { + const foo = Object.create(null, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -56,7 +63,7 @@ describe('Object (ES7)', () => { }); it('should return only own entries', () => { - let foo = Object.create({z: 30}, { + const foo = Object.create({z: 30}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -84,19 +91,19 @@ describe('Object (ES7)', () => { }); it('should return enumerable values', () => { - let foo = Object.defineProperties({}, { + const foo = Object.defineProperties({}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); expect(Object.values(foo)).toEqual([10]); - let bar = {x: 10, y: 20}; + const bar = {x: 10, y: 20}; expect(Object.values(bar)).toEqual([10, 20]); }); it('should work with proto-less objects', () => { - let foo = Object.create(null, { + const foo = Object.create(null, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -105,7 +112,7 @@ describe('Object (ES7)', () => { }); it('should return only own values', () => { - let foo = Object.create({z: 30}, { + const foo = Object.create({z: 30}, { x: {value: 10, enumerable: true}, y: {value: 20}, }); @@ -117,4 +124,4 @@ describe('Object (ES7)', () => { expect(Object.values('ab')).toEqual(['a', 'b']); }); }); -}); \ No newline at end of file +}); diff --git a/react-packager/src/Resolver/polyfills/babelHelpers.js b/react-packager/src/Resolver/polyfills/babelHelpers.js index ff442257..95b4ba8a 100644 --- a/react-packager/src/Resolver/polyfills/babelHelpers.js +++ b/react-packager/src/Resolver/polyfills/babelHelpers.js @@ -5,6 +5,8 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill */ /* eslint-disable */ diff --git a/react-packager/src/Resolver/polyfills/console.js b/react-packager/src/Resolver/polyfills/console.js index e8d82e3f..9e5b7ebb 100644 --- a/react-packager/src/Resolver/polyfills/console.js +++ b/react-packager/src/Resolver/polyfills/console.js @@ -6,9 +6,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * This pipes all of our console logging functions to native logging so that - * JavaScript errors in required modules show up in Xcode via NSLog. - * * @provides console * @polyfill * @nolint @@ -16,6 +13,10 @@ /* eslint-disable */ +/** + * This pipes all of our console logging functions to native logging so that + * JavaScript errors in required modules show up in Xcode via NSLog. + */ const inspect = (function() { // Copyright Joyent, Inc. and other Node contributors. // diff --git a/react-packager/src/Resolver/polyfills/error-guard.js b/react-packager/src/Resolver/polyfills/error-guard.js index cf3dc956..feb3e761 100644 --- a/react-packager/src/Resolver/polyfills/error-guard.js +++ b/react-packager/src/Resolver/polyfills/error-guard.js @@ -6,15 +6,11 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * The particular require runtime that we are using looks for a global - * `ErrorUtils` object and if it exists, then it requires modules with the - * error handler specified via ErrorUtils.setGlobalHandler by calling the - * require function with applyWithGuard. Since the require module is loaded - * before any of the modules, this ErrorUtils must be defined (and the handler - * set) globally before requiring anything. + * @polyfill */ -/* eslint strict:0 */ +/* eslint-disable strict */ + let _inGuard = 0; /** @@ -26,6 +22,14 @@ let _globalHandler = function onError(e) { throw e; }; +/** + * The particular require runtime that we are using looks for a global + * `ErrorUtils` object and if it exists, then it requires modules with the + * error handler specified via ErrorUtils.setGlobalHandler by calling the + * require function with applyWithGuard. Since the require module is loaded + * before any of the modules, this ErrorUtils must be defined (and the handler + * set) globally before requiring anything. + */ const ErrorUtils = { setGlobalHandler: function(fun) { _globalHandler = fun; diff --git a/react-packager/src/Resolver/polyfills/polyfills.js b/react-packager/src/Resolver/polyfills/polyfills.js index c625f9ef..db656714 100644 --- a/react-packager/src/Resolver/polyfills/polyfills.js +++ b/react-packager/src/Resolver/polyfills/polyfills.js @@ -6,17 +6,16 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * - * This pipes all of our console logging functions to native logging so that - * JavaScript errors in required modules show up in Xcode via NSLog. - * * @provides Object.es6 * @polyfill */ +/* eslint-disable strict */ + // WARNING: This is an optimized version that fails on hasOwnProperty checks // and non objects. It's not spec-compliant. It's a perf optimization. -// This is only needed for iOS 8 and current Android JSC. -/* eslint strict:0 */ +// This is only needed for iOS 8 and current Android JSC. + Object.assign = function(target, sources) { if (__DEV__) { if (target == null) { diff --git a/react-packager/src/Resolver/polyfills/prelude.js b/react-packager/src/Resolver/polyfills/prelude.js index 02386ae1..0451a75b 100644 --- a/react-packager/src/Resolver/polyfills/prelude.js +++ b/react-packager/src/Resolver/polyfills/prelude.js @@ -1,4 +1,16 @@ -/* eslint strict:0 */ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill + */ + +/* eslint-disable strict */ + global.__DEV__ = false; global.__BUNDLE_START_TIME__ = Date.now(); diff --git a/react-packager/src/Resolver/polyfills/prelude_dev.js b/react-packager/src/Resolver/polyfills/prelude_dev.js index 99b9de2c..0f086fb9 100644 --- a/react-packager/src/Resolver/polyfills/prelude_dev.js +++ b/react-packager/src/Resolver/polyfills/prelude_dev.js @@ -1,4 +1,16 @@ -/* eslint strict:0 */ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @polyfill + */ + +/* eslint-disable strict */ + global.__DEV__ = true; global.__BUNDLE_START_TIME__ = Date.now(); diff --git a/react-packager/src/Resolver/polyfills/require.js b/react-packager/src/Resolver/polyfills/require.js index fb2fe0e7..27f81a92 100644 --- a/react-packager/src/Resolver/polyfills/require.js +++ b/react-packager/src/Resolver/polyfills/require.js @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * + * @polyfill * @flow */ diff --git a/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js b/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js index e5ed0eb0..1c98b337 100644 --- a/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js +++ b/react-packager/src/node-haste/DependencyGraph/assets/empty-module.js @@ -1,4 +1,4 @@ - /** +/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. *