From be5c09c24d0e09ecec21246fdd9b08e4158f2c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Mon, 27 Jul 2015 13:37:33 -0700 Subject: [PATCH] Update fbjs dependency - remove a file that got moved over there - update for renamed babel transform --- gulpfile.js | 4 +- package.json | 2 +- scripts/jest/preprocessor.js | 4 +- .../utils/__tests__/shallowEqual-test.js | 89 ------------------- src/shared/utils/shallowEqual.js | 49 ---------- 5 files changed, 5 insertions(+), 143 deletions(-) delete mode 100644 src/shared/utils/__tests__/shallowEqual-test.js delete mode 100644 src/shared/utils/shallowEqual.js diff --git a/gulpfile.js b/gulpfile.js index 8f5eed35b9..4adf9b564b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,7 +15,7 @@ var flatten = require('gulp-flatten'); var del = require('del'); var babelPluginDEV = require('fbjs/scripts/babel/dev-expression'); -var babelPluginRequires = require('fbjs/scripts/babel/rewrite-requires'); +var babelPluginModules = require('fbjs/scripts/babel/rewrite-modules'); var paths = { react: { @@ -36,7 +36,7 @@ var babelOpts = { optional: [ 'es7.trailingFunctionCommas', ], - plugins: [babelPluginDEV, babelPluginRequires], + plugins: [babelPluginDEV, babelPluginModules], ignore: ['third_party'], _moduleMap: require('fbjs/module-map'), }; diff --git a/package.json b/package.json index 6583271138..07381338cd 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "eslint-plugin-react": "^2.5.0", "eslint-plugin-react-internal": "file:eslint-rules", "eslint-tester": "^0.7.0", - "fbjs": "^0.1.0-alpha.0", + "fbjs": "0.1.0-alpha.3", "grunt": "^0.4.5", "grunt-cli": "^0.1.13", "grunt-compare-size": "^0.4.0", diff --git a/scripts/jest/preprocessor.js b/scripts/jest/preprocessor.js index 38810e156a..788f40fa31 100644 --- a/scripts/jest/preprocessor.js +++ b/scripts/jest/preprocessor.js @@ -16,7 +16,7 @@ var ts = tsPreprocessor(defaultLibraries); // We should consider consuming this from a built fbjs module from npm. var moduleMap = require('fbjs/module-map'); var babelPluginDEV = require('fbjs/scripts/babel/dev-expression'); -var babelPluginRequires = require('fbjs/scripts/babel/rewrite-requires'); +var babelPluginModules = require('fbjs/scripts/babel/rewrite-modules'); module.exports = { process: function(src, path) { @@ -37,7 +37,7 @@ module.exports = { optional: [ 'es7.trailingFunctionCommas', ], - plugins: [babelPluginDEV, babelPluginRequires], + plugins: [babelPluginDEV, babelPluginModules], ignore: ['third_party'], filename: path, retainLines: true, diff --git a/src/shared/utils/__tests__/shallowEqual-test.js b/src/shared/utils/__tests__/shallowEqual-test.js deleted file mode 100644 index 5f93bedd05..0000000000 --- a/src/shared/utils/__tests__/shallowEqual-test.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2014-2015, 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 react-core - */ - -'use strict'; - -require('mock-modules') - .dontMock('shallowEqual'); - -var shallowEqual; - -describe('shallowEqual', function() { - - beforeEach(function() { - shallowEqual = require('shallowEqual'); - }); - - it('returns false if either argument is null', function() { - expect(shallowEqual(null, {})).toBe(false); - expect(shallowEqual({}, null)).toBe(false); - }); - - it('returns true if both arguments are null or undefined', function() { - expect(shallowEqual(null, null)).toBe(true); - expect(shallowEqual(undefined, undefined)).toBe(true); - }); - - it('returns true if arguments are shallow equal', function() { - expect( - shallowEqual( - {a: 1, b: 2, c: 3}, - {a: 1, b: 2, c: 3} - ) - ).toBe(true); - }); - - it('returns false if arguments are not objects and not equal', function() { - expect( - shallowEqual( - 1, - 2 - ) - ).toBe(false); - }); - - it('returns false if only one argument is not an object', function() { - expect( - shallowEqual( - 1, - {} - ) - ).toBe(false); - }); - - it('returns false if first argument has too many keys', function() { - expect( - shallowEqual( - {a: 1, b: 2, c: 3}, - {a: 1, b: 2} - ) - ).toBe(false); - }); - - it('returns false if second argument has too many keys', function() { - expect( - shallowEqual( - {a: 1, b: 2}, - {a: 1, b: 2, c: 3} - ) - ).toBe(false); - }); - - it('returns false if arguments are not shallow equal', function() { - expect( - shallowEqual( - {a: 1, b: 2, c: {}}, - {a: 1, b: 2, c: {}} - ) - ).toBe(false); - }); - -}); diff --git a/src/shared/utils/shallowEqual.js b/src/shared/utils/shallowEqual.js deleted file mode 100644 index 78d4848b9a..0000000000 --- a/src/shared/utils/shallowEqual.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2013-2015, 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. - * - * @providesModule shallowEqual - */ - -'use strict'; - -/** - * Performs equality by iterating through keys on an object and returning - * false when any key has values which are not strictly equal between - * objA and objB. Returns true when the values of all keys are strictly equal. - * - * @return {boolean} - */ -function shallowEqual(objA, objB) { - if (objA === objB) { - return true; - } - - if (typeof objA !== 'object' || objA === null || - typeof objB !== 'object' || objB === null) { - return false; - } - - var keysA = Object.keys(objA); - var keysB = Object.keys(objB); - - if (keysA.length !== keysB.length) { - return false; - } - - // Test for A's keys different from B. - var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); - for (var i = 0; i < keysA.length; i++) { - if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { - return false; - } - } - - return true; -} - -module.exports = shallowEqual;