Skip to content

Commit

Permalink
Update core libraries for React 0.14 final
Browse files Browse the repository at this point in the history
Summary: All minor changes since we were already on the beta: most notable is that destructors are required in pooling to help prevent memory leaks.

public

Reviewed By: sebmarkbage

Differential Revision: D2608692

fb-gh-sync-id: acdad38768f7f48c0f0e7e44cbff6f0db316f4ca
  • Loading branch information
sophiebits authored and facebook-github-bot-7 committed Nov 7, 2015
1 parent 3b9cc4c commit bbee3c6
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 203 deletions.
18 changes: 12 additions & 6 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*

# Ignore react-tools where there are overlaps, but don't ignore anything that
# react-native relies on
.*/node_modules/react-tools/src/React.js
.*/node_modules/react-tools/src/renderers/shared/event/EventPropagators.js
.*/node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
.*/node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js
# Ignore react and fbjs where there are overlaps, but don't ignore
# anything that react-native relies on
.*/node_modules/fbjs-haste/.*/__tests__/.*
.*/node_modules/fbjs-haste/__forks__/Map.js
.*/node_modules/fbjs-haste/__forks__/Promise.js
.*/node_modules/fbjs-haste/__forks__/fetch.js
.*/node_modules/fbjs-haste/core/ExecutionEnvironment.js
.*/node_modules/fbjs-haste/core/isEmpty.js
.*/node_modules/fbjs-haste/crypto/crc32.js
.*/node_modules/fbjs-haste/stubs/ErrorUtils.js
.*/node_modules/react-haste/React.js
.*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js

# Ignore commoner tests
.*/node_modules/commoner/test/.*
Expand Down
5 changes: 5 additions & 0 deletions Libraries/Components/Touchable/BoundingDimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function BoundingDimensions(width, height) {
this.height = height;
}

BoundingDimensions.prototype.destructor = function() {
this.width = null;
this.height = null;
};

/**
* @param {HTMLElement} element Element to return `BoundingDimensions` for.
* @return {BoundingDimensions} Bounding dimensions of `element`.
Expand Down
5 changes: 5 additions & 0 deletions Libraries/Components/Touchable/Position.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ function Position(left, top) {
this.top = top;
}

Position.prototype.destructor = function() {
this.left = null;
this.top = null;
};

PooledClass.addPoolingTo(Position, twoArgumentPooler);

module.exports = Position;
Expand Down
6 changes: 6 additions & 0 deletions Libraries/ReactNative/ReactNativeMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function instanceNumberToChildRootID(rootNodeID, instanceNumber) {
* here.
*/
var TopLevelWrapper = function() {};
TopLevelWrapper.prototype.isReactComponent = {};
if (__DEV__) {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function() {
// this.props is actually a ReactElement
return this.props;
Expand Down Expand Up @@ -111,6 +115,8 @@ var ReactNativeMount = {
null,
null,
null,
null,
null,
nextElement
);

Expand Down
163 changes: 0 additions & 163 deletions Libraries/vendor/react/event/EventPropagators.js

This file was deleted.

65 changes: 43 additions & 22 deletions packager/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,58 @@ var path = require('path');
// Don't forget to everything listed here to `testConfig.json`
// modulePathIgnorePatterns.
var sharedBlacklist = [
'node_modules/react-tools/src/React.js',
'node_modules/react-tools/src/renderers/shared/event/EventPropagators.js',
'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js',
'node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js',
'node_modules/react-tools/docs/js/react.js',
'node_modules/react-tools/src/package.json',
'node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js',
'node_modules/react-haste/React.js',

// Those conflicts with the ones in react-tools/. We need to blacklist the
// For each of these fbjs files (especially the non-forks/stubs), we should
// consider deleting the conflicting copy and just using the fbjs version.
'node_modules/fbjs-haste/__forks__/Map.js',
'node_modules/fbjs-haste/__forks__/Promise.js',
'node_modules/fbjs-haste/__forks__/fetch.js',
'node_modules/fbjs-haste/core/Deferred.js',
'node_modules/fbjs-haste/core/PromiseMap.js',
'node_modules/fbjs-haste/core/areEqual.js',
'node_modules/fbjs-haste/core/flattenArray.js',
'node_modules/fbjs-haste/core/isEmpty.js',
'node_modules/fbjs-haste/core/removeFromArray.js',
'node_modules/fbjs-haste/core/resolveImmediate.js',
'node_modules/fbjs-haste/core/sprintf.js',
'node_modules/fbjs-haste/crypto/crc32.js',
'node_modules/fbjs-haste/fetch/fetchWithRetries.js',
'node_modules/fbjs-haste/functional/everyObject.js',
'node_modules/fbjs-haste/functional/filterObject.js',
'node_modules/fbjs-haste/functional/forEachObject.js',
'node_modules/fbjs-haste/functional/someObject.js',
'node_modules/fbjs-haste/request/xhrSimpleDataSerializer.js',
'node_modules/fbjs-haste/stubs/ErrorUtils.js',
'node_modules/fbjs-haste/stubs/URI.js',
'node_modules/fbjs-haste/useragent/UserAgent.js',
'node_modules/fbjs-haste/utils/nullthrows.js',

// Those conflicts with the ones in fbjs-haste/. We need to blacklist the
// internal version otherwise they won't work in open source.
'downstream/core/invariant.js',
'downstream/key-mirror/keyMirror.js',
'downstream/core/emptyFunction.js',
'downstream/core/emptyObject.js',
'downstream/key-mirror/keyOf.js',
'downstream/core/dom/isNode.js',
'downstream/core/CSSCore.js',
'downstream/core/TouchEventUtils.js',
'downstream/core/nativeRequestAnimationFrame.js',
'downstream/core/dom/containsNode.js',
'downstream/core/dom/isTextNode.js',
'downstream/functional/mapObject.js',
'downstream/core/camelize.js',
'downstream/core/hyphenate.js',
'downstream/core/createArrayFromMixed.js',
'downstream/core/toArray.js',
'downstream/core/dom/getActiveElement.js',
'downstream/core/createNodesFromMarkup.js',
'downstream/core/dom/containsNode.js',
'downstream/core/dom/focusNode.js',
'downstream/core/dom/getActiveElement.js',
'downstream/core/dom/getUnboundedScrollPosition.js',
'downstream/core/createNodesFromMarkup.js',
'downstream/core/CSSCore.js',
'downstream/core/dom/isNode.js',
'downstream/core/dom/isTextNode.js',
'downstream/core/emptyFunction.js',
'downstream/core/emptyObject.js',
'downstream/core/getMarkupWrap.js',
'downstream/core/hyphenate.js',
'downstream/core/hyphenateStyleName.js',
'downstream/core/invariant.js',
'downstream/core/nativeRequestAnimationFrame.js',
'downstream/core/toArray.js',
'downstream/functional/mapObject.js',
'downstream/key-mirror/keyMirror.js',
'downstream/key-mirror/keyOf.js',
];

// Raw unescaped patterns in case you need to use wildcards
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2245,9 +2245,9 @@ describe('DependencyGraph', function() {
'require("wontWork");',
].join('\n'),
'node_modules': {
'react-tools': {
'react-haste': {
'package.json': JSON.stringify({
name: 'react-tools',
name: 'react-haste',
main: 'main.js',
}),
'main.js': [
Expand Down Expand Up @@ -2315,7 +2315,7 @@ describe('DependencyGraph', function() {
},
{
id: 'shouldWork',
path: '/root/node_modules/react-tools/main.js',
path: '/root/node_modules/react-haste/main.js',
dependencies: ['submodule'],
isAsset: false,
isAsset_DEPRECATED: false,
Expand All @@ -2325,7 +2325,7 @@ describe('DependencyGraph', function() {
},
{
id: 'submodule/main.js',
path: '/root/node_modules/react-tools/node_modules/submodule/main.js',
path: '/root/node_modules/react-haste/node_modules/submodule/main.js',
dependencies: [],
isAsset: false,
isAsset_DEPRECATED: false,
Expand All @@ -2338,19 +2338,19 @@ describe('DependencyGraph', function() {
});

pit('should not be confused by prev occuring whitelisted names', function() {
var root = '/react-tools';
var root = '/react-haste';
fs.__setMockFilesystem({
'react-tools': {
'react-haste': {
'index.js': [
'/**',
' * @providesModule index',
' */',
'require("shouldWork");',
].join('\n'),
'node_modules': {
'react-tools': {
'react-haste': {
'package.json': JSON.stringify({
name: 'react-tools',
name: 'react-haste',
main: 'main.js',
}),
'main.js': [
Expand All @@ -2369,12 +2369,12 @@ describe('DependencyGraph', function() {
assetExts: ['png', 'jpg'],
cache: cache,
});
return getOrderedDependenciesAsJSON(dgraph, '/react-tools/index.js').then(function(deps) {
return getOrderedDependenciesAsJSON(dgraph, '/react-haste/index.js').then(function(deps) {
expect(deps)
.toEqual([
{
id: 'index',
path: '/react-tools/index.js',
path: '/react-haste/index.js',
dependencies: ['shouldWork'],
isAsset: false,
isAsset_DEPRECATED: false,
Expand All @@ -2384,7 +2384,7 @@ describe('DependencyGraph', function() {
},
{
id: 'shouldWork',
path: '/react-tools/node_modules/react-tools/main.js',
path: '/react-haste/node_modules/react-haste/main.js',
dependencies: [],
isAsset: false,
isAsset_DEPRECATED: false,
Expand Down
Loading

0 comments on commit bbee3c6

Please sign in to comment.