Update fbjs dependency
- remove a file that got moved over there - update for renamed babel transform
This commit is contained in:
parent
fab001aa80
commit
be5c09c24d
|
@ -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'),
|
||||
};
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
});
|
|
@ -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;
|
Loading…
Reference in New Issue