From 7c03b16a1bc0f8415eaad68362ce06faddfa8f6b Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 9 Feb 2016 17:15:22 -0800 Subject: [PATCH 001/417] / [node-haste] Remove support for asynchronous dependencies (`System.import`) Summary: public Remove the unused feature for async dependencies / bundle layouts. We can bring it back later, if needed. Reviewed By: cpojer Differential Revision: D2916543 fb-gh-sync-id: 3a3890f10d7d275a4cb9371a6e9cace601a82b2c shipit-source-id: 3a3890f10d7d275a4cb9371a6e9cace601a82b2c --- packager/react-packager/src/Bundler/index.js | 12 - .../__tests__/BundlesLayout-test.js | 320 ---------- .../BundlesLayoutIntegration-test.js | 599 ------------------ .../react-packager/src/BundlesLayout/index.js | 219 ------- .../src/DependencyResolver/AssetModule.js | 4 - .../AssetModule_DEPRECATED.js | 4 - .../DependencyGraph/ResolutionRequest.js | 17 - .../DependencyGraph/ResolutionResponse.js | 8 - .../__tests__/DependencyGraph-test.js | 34 - .../DependencyGraph/index.js | 13 +- .../src/DependencyResolver/Module.js | 12 +- .../__tests__/Module-test.js | 70 +- .../DependencyResolver/lib/extractRequires.js | 10 - .../DependencyResolver/lib/replacePatterns.js | 1 - .../src/Resolver/__tests__/Resolver-test.js | 7 +- .../polyfills/__tests__/loadBundles-test.js | 63 -- .../src/Resolver/polyfills/loadBundles.js | 34 - .../babel-plugin-system-import-test.js | 71 --- .../babel-plugin-system-import/index.js | 63 -- 19 files changed, 10 insertions(+), 1551 deletions(-) delete mode 100644 packager/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js delete mode 100644 packager/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js delete mode 100644 packager/react-packager/src/BundlesLayout/index.js delete mode 100644 packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js delete mode 100644 packager/react-packager/src/Resolver/polyfills/loadBundles.js delete mode 100644 packager/react-packager/src/transforms/babel-plugin-system-import/__tests__/babel-plugin-system-import-test.js delete mode 100644 packager/react-packager/src/transforms/babel-plugin-system-import/index.js diff --git a/packager/react-packager/src/Bundler/index.js b/packager/react-packager/src/Bundler/index.js index a07d73f7ac5fc2..99923e6576207e 100644 --- a/packager/react-packager/src/Bundler/index.js +++ b/packager/react-packager/src/Bundler/index.js @@ -13,7 +13,6 @@ const fs = require('fs'); const path = require('path'); const Promise = require('promise'); const ProgressBar = require('progress'); -const BundlesLayout = require('../BundlesLayout'); const Cache = require('../DependencyResolver/Cache'); const Transformer = require('../JSTransformer'); const Resolver = require('../Resolver'); @@ -126,13 +125,6 @@ class Bundler { cache: this._cache, }); - this._bundlesLayout = new BundlesLayout({ - dependencyResolver: this._resolver, - resetCache: opts.resetCache, - cacheVersion: opts.cacheVersion, - projectRoots: opts.projectRoots, - }); - this._transformer = new Transformer({ projectRoots: opts.projectRoots, blacklistRE: opts.blacklistRE, @@ -156,10 +148,6 @@ class Bundler { return this._cache.end(); } - getLayout(main, isDev) { - return this._bundlesLayout.generateLayout(main, isDev); - } - bundle(options) { const {dev, isUnbundle, platform} = options; const moduleSystemDeps = diff --git a/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js b/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js deleted file mode 100644 index dafdb3680ae1b1..00000000000000 --- a/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayout-test.js +++ /dev/null @@ -1,320 +0,0 @@ -/** - * 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. - */ -'use strict'; - -jest.dontMock('../index') - .mock('fs'); - -var Promise = require('promise'); -var BundlesLayout = require('../index'); -var Resolver = require('../../Resolver'); -var loadCacheSync = require('../../DependencyResolver/Cache/lib/loadCacheSync'); - -describe('BundlesLayout', () => { - function newBundlesLayout(options) { - return new BundlesLayout(Object.assign({ - projectRoots: ['/root'], - dependencyResolver: new Resolver(), - }, options)); - } - - describe('layout', () => { - function isPolyfill() { - return false; - } - - describe('getLayout', () => { - function dep(path) { - return { - path: path, - isPolyfill: isPolyfill, - }; - } - - pit('should bundle sync dependencies', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js'), dep('/root/a.js')], - asyncDependencies: [], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - return newBundlesLayout({resetCache: true}) - .getLayout('/root/index.js') - .then(bundles => - expect(bundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js', '/root/a.js'], - children: [], - }) - ); - }); - - pit('should separate async dependencies into different bundle', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js')], - asyncDependencies: [['/root/a.js']], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - return newBundlesLayout({resetCache: true}) - .getLayout('/root/index.js') - .then(bundles => - expect(bundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id:'bundle.0.1', - modules: ['/root/a.js'], - children: [], - }], - }) - ); - }); - - pit('separate async dependencies of async dependencies', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js')], - asyncDependencies: [['/root/a.js']], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js')], - asyncDependencies: [['/root/b.js']], - }); - case '/root/b.js': - return Promise.resolve({ - dependencies: [dep('/root/b.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - return newBundlesLayout({resetCache: true}) - .getLayout('/root/index.js') - .then(bundles => - expect(bundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [{ - id: 'bundle.0.1.2', - modules: ['/root/b.js'], - children: [], - }], - }], - }) - ); - }); - - pit('separate bundle sync dependencies of async ones on same bundle', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js')], - asyncDependencies: [['/root/a.js']], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js'), dep('/root/b.js')], - asyncDependencies: [], - }); - case '/root/b.js': - return Promise.resolve({ - dependencies: [dep('/root/b.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - return newBundlesLayout({resetCache: true}) - .getLayout('/root/index.js') - .then(bundles => - expect(bundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/b.js'], - children: [], - }], - }) - ); - }); - - pit('separate cache in which bundle is each dependency', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js'), dep('/root/a.js')], - asyncDependencies: [], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js')], - asyncDependencies: [['/root/b.js']], - }); - case '/root/b.js': - return Promise.resolve({ - dependencies: [dep('/root/b.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - return newBundlesLayout({resetCache: true}) - .getLayout('/root/index.js') - .then(bundles => - expect(bundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js', '/root/a.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/b.js'], - children: [], - }], - }) - ); - }); - - pit('separate cache in which bundle is each dependency', () => { - Resolver.prototype.getDependencies.mockImpl((path) => { - switch (path) { - case '/root/index.js': - return Promise.resolve({ - dependencies: [dep('/root/index.js'), dep('/root/a.js')], - asyncDependencies: [['/root/b.js'], ['/root/c.js']], - }); - case '/root/a.js': - return Promise.resolve({ - dependencies: [dep('/root/a.js')], - asyncDependencies: [], - }); - case '/root/b.js': - return Promise.resolve({ - dependencies: [dep('/root/b.js')], - asyncDependencies: [['/root/d.js']], - }); - case '/root/c.js': - return Promise.resolve({ - dependencies: [dep('/root/c.js')], - asyncDependencies: [], - }); - case '/root/d.js': - return Promise.resolve({ - dependencies: [dep('/root/d.js')], - asyncDependencies: [], - }); - default: - throw 'Undefined path: ' + path; - } - }); - - var layout = newBundlesLayout({resetCache: true}); - return layout.getLayout('/root/index.js').then(() => { - expect(layout.getBundleIDForModule('/root/index.js')).toBe('bundle.0'); - expect(layout.getBundleIDForModule('/root/a.js')).toBe('bundle.0'); - expect(layout.getBundleIDForModule('/root/b.js')).toBe('bundle.0.1'); - expect(layout.getBundleIDForModule('/root/c.js')).toBe('bundle.0.2'); - expect(layout.getBundleIDForModule('/root/d.js')).toBe('bundle.0.1.3'); - }); - }); - }); - }); - - describe('cache', () => { - beforeEach(() => { - loadCacheSync.mockReturnValue({ - '/root/index.js': { - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [], - }], - }, - '/root/b.js': { - id: 'bundle.2', - modules: ['/root/b.js'], - children: [], - }, - }); - }); - - pit('should load layouts', () => { - const layout = newBundlesLayout({ resetCache: false }); - - return Promise - .all([ - layout.getLayout('/root/index.js'), - layout.getLayout('/root/b.js'), - ]) - .then(([layoutIndex, layoutB]) => { - expect(layoutIndex).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [], - }], - }); - - expect(layoutB).toEqual({ - id: 'bundle.2', - modules: ['/root/b.js'], - children: [], - }); - }); - }); - - it('should load moduleToBundle map', () => { - const layout = newBundlesLayout({ resetCache: false }); - - expect(layout.getBundleIDForModule('/root/index.js')).toBe('bundle.0'); - expect(layout.getBundleIDForModule('/root/a.js')).toBe('bundle.0.1'); - expect(layout.getBundleIDForModule('/root/b.js')).toBe('bundle.2'); - }); - }); -}); diff --git a/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js b/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js deleted file mode 100644 index 00868b22908df6..00000000000000 --- a/packager/react-packager/src/BundlesLayout/__tests__/BundlesLayoutIntegration-test.js +++ /dev/null @@ -1,599 +0,0 @@ -/** - * 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. - */ -'use strict'; - -jest - .autoMockOff() - .mock('../../DependencyResolver/Cache') - .mock('../../Activity'); - -const Promise = require('promise'); -const path = require('path'); - -jest.mock('fs'); - -var BundlesLayout = require('../index'); -var Cache = require('../../DependencyResolver/Cache'); -var Resolver = require('../../Resolver'); -var fs = require('fs'); - -describe('BundlesLayout', () => { - var fileWatcher; - - const polyfills = [ - 'polyfills/prelude_dev.js', - 'polyfills/prelude.js', - 'polyfills/require.js', - 'polyfills/polyfills.js', - 'polyfills/console.js', - 'polyfills/error-guard.js', - 'polyfills/String.prototype.es6.js', - 'polyfills/Array.prototype.es6.js', - 'polyfills/Array.es6.js', - 'polyfills/Object.es7.js', - 'polyfills/babelHelpers.js', - ]; - const baseFs = getBaseFs(); - - beforeEach(() => { - fileWatcher = { - on: () => this, - isWatchman: () => Promise.resolve(false) - }; - }); - - describe('generate', () => { - function newBundlesLayout() { - const resolver = new Resolver({ - projectRoots: ['/root', '/' + __dirname.split('/')[1]], - fileWatcher: fileWatcher, - cache: new Cache(), - assetExts: ['js', 'png'], - assetRoots: ['/root'], - }); - - return new BundlesLayout({ - dependencyResolver: resolver, - resetCache: true, - projectRoots: ['/root', '/' + __dirname.split('/')[1]], - }); - } - - function stripPolyfills(bundle) { - return Promise - .all(bundle.children.map(childModule => stripPolyfills(childModule))) - .then(children => { - const modules = bundle.modules - .filter(moduleName => { // filter polyfills - for (let p of polyfills) { - if (moduleName.indexOf(p) !== -1) { - return false; - } - } - return true; - }); - - return { - id: bundle.id, - modules: modules, - children: children, - }; - }); - } - - function setMockFilesystem(mockFs) { - fs.__setMockFilesystem(Object.assign(mockFs, baseFs)); - } - - pit('should bundle single-module app', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [], - }) - ) - ); - }); - - pit('should bundle dependant modules', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - require("xa");`, - 'a.js': ` - /** - * @providesModule xa - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js', '/root/a.js'], - children: [], - }) - ) - ); - }); - - pit('should split bundles for async dependencies', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa");`, - 'a.js': ` - /**, - * @providesModule xa - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [], - }], - }) - ) - ); - }); - - pit('should split into multiple bundles separate async dependencies', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa"); - ${'System.import'}("xb");`, - 'a.js': ` - /**, - * @providesModule xa - */`, - 'b.js': ` - /** - * @providesModule xb - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [ - { - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [], - }, { - id: 'bundle.0.2', - modules: ['/root/b.js'], - children: [], - }, - ], - }) - ) - ); - }); - - pit('should fully traverse sync dependencies', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - require("xa"); - ${'System.import'}("xb");`, - 'a.js': ` - /**, - * @providesModule xa - */`, - 'b.js': ` - /** - * @providesModule xb - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js', '/root/a.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/b.js'], - children: [], - }], - }) - ) - ); - }); - - pit('should include sync dependencies async dependencies might have', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa");`, - 'a.js': ` - /**, - * @providesModule xa - */, - require("xb");`, - 'b.js': ` - /** - * @providesModule xb - */ - require("xc");`, - 'c.js': ` - /** - * @providesModule xc - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/b.js', '/root/c.js'], - children: [], - }], - }) - ) - ); - }); - - pit('should allow duplicated dependencies across bundles', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa"); - ${'System.import'}("xb");`, - 'a.js': ` - /**, - * @providesModule xa - */, - require("xc");`, - 'b.js': ` - /** - * @providesModule xb - */ - require("xc");`, - 'c.js': ` - /** - * @providesModule xc - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [ - { - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/c.js'], - children: [], - }, - { - id: 'bundle.0.2', - modules: ['/root/b.js', '/root/c.js'], - children: [], - }, - ], - }) - ) - ); - }); - - pit('should put in separate bundles async dependencies of async dependencies', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa");`, - 'a.js': ` - /**, - * @providesModule xa - */, - ${'System.import'}("xb");`, - 'b.js': ` - /** - * @providesModule xb - */ - require("xc");`, - 'c.js': ` - /** - * @providesModule xc - */`, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [ - { - id: 'bundle.0.1', - modules: ['/root/a.js'], - children: [{ - id: 'bundle.0.1.2', - modules: ['/root/b.js', '/root/c.js'], - children: [], - }], - }, - ], - }) - ) - ); - }); - - pit('should put image dependencies into separate bundles', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa");`, - 'a.js':` - /**, - * @providesModule xa - */, - require("./img.png");`, - 'img.png': '', - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/img.png'], - children: [], - }], - }) - ) - ); - }); - - pit('should put image dependencies across bundles', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa"); - ${'System.import'}("xb");`, - 'a.js':` - /**, - * @providesModule xa - */, - require("./img.png");`, - 'b.js':` - /**, - * @providesModule xb - */, - require("./img.png");`, - 'img.png': '', - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [ - { - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/img.png'], - children: [], - }, - { - id: 'bundle.0.2', - modules: ['/root/b.js', '/root/img.png'], - children: [], - }, - ], - }) - ) - ); - }); - - pit('could async require asset', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("./img.png");`, - 'img.png': '', - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/img.png'], - children: [], - }], - }) - ) - ); - }); - - pit('should include deprecated assets into separate bundles', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("xa");`, - 'a.js':` - /**, - * @providesModule xa - */, - require("image!img");`, - 'img.png': '', - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/a.js', '/root/img.png'], - children: [], - }], - }) - ) - ); - }); - - pit('could async require deprecated asset', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("image!img");`, - 'img.png': '', - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/img.png'], - children: [], - }], - }) - ) - ); - }); - - pit('should put packages into bundles', () => { - setMockFilesystem({ - 'root': { - 'index.js': ` - /** - * @providesModule xindex - */ - ${'System.import'}("aPackage");`, - 'aPackage': { - 'package.json': JSON.stringify({ - name: 'aPackage', - main: './main.js', - browser: { - './main.js': './client.js', - }, - }), - 'main.js': 'some other code', - 'client.js': 'some code', - }, - } - }); - - return newBundlesLayout().getLayout('/root/index.js').then(bundles => - stripPolyfills(bundles).then(resolvedBundles => - expect(resolvedBundles).toEqual({ - id: 'bundle.0', - modules: ['/root/index.js'], - children: [{ - id: 'bundle.0.1', - modules: ['/root/aPackage/client.js'], - children: [], - }], - }) - ) - ); - }); - }); - - function getBaseFs() { - const p = path.join(__dirname, '../../../Resolver/polyfills').substring(1); - const root = {}; - let currentPath = root; - - p.split('/').forEach(part => { - const child = {}; - currentPath[part] = child; - currentPath = child; - }); - - polyfills.forEach(polyfill => - currentPath[polyfill.split('/')[1]] = '' - ); - - return root; - } -}); diff --git a/packager/react-packager/src/BundlesLayout/index.js b/packager/react-packager/src/BundlesLayout/index.js deleted file mode 100644 index 2fd906232af502..00000000000000 --- a/packager/react-packager/src/BundlesLayout/index.js +++ /dev/null @@ -1,219 +0,0 @@ -/** - * 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. - */ -'use strict'; - -const Activity = require('../Activity'); - -const _ = require('underscore'); -const declareOpts = require('../lib/declareOpts'); -const fs = require('fs'); -const getCacheFilePath = require('../DependencyResolver/Cache/lib/getCacheFilePath'); -const loadCacheSync = require('../DependencyResolver/Cache/lib/loadCacheSync'); -const version = require('../../../../package.json').version; -const path = require('path'); -const tmpdir = require('os').tmpDir(); - -const validateOpts = declareOpts({ - dependencyResolver: { - type: 'object', - required: true, - }, - resetCache: { - type: 'boolean', - default: false, - }, - cacheVersion: { - type: 'string', - default: '1.0', - }, - projectRoots: { - type: 'array', - required: true, - }, -}); - -const BUNDLE_PREFIX = 'bundle'; - -/** - * Class that takes care of separating the graph of dependencies into - * separate bundles - */ -class BundlesLayout { - constructor(options) { - const opts = validateOpts(options); - this._resolver = opts.dependencyResolver; - - // Cache in which bundle is each module. - this._moduleToBundle = Object.create(null); - - // Cache the bundles layouts for each entry point. This entries - // are not evicted unless the user explicitly specifies so as - // computing them is pretty expensive - this._layouts = Object.create(null); - - // TODO: watch for file creations and removals to update this caches - - this._cacheFilePath = this._getCacheFilePath(opts); - if (!opts.resetCache) { - this._loadCacheSync(this._cacheFilePath); - } else { - this._persistCacheEventually(); - } - } - - getLayout(entryPath, isDev) { - if (this._layouts[entryPath]) { - return this._layouts[entryPath]; - } - var currentBundleID = 0; - const rootBundle = { - id: BUNDLE_PREFIX + '.' + currentBundleID++, - modules: [], - children: [], - }; - var pending = [{paths: [entryPath], bundle: rootBundle}]; - - this._layouts[entryPath] = promiseWhile( - () => pending.length > 0, - () => rootBundle, - () => { - const {paths, bundle} = pending.shift(); - - // pending sync dependencies we still need to explore for the current - // pending dependency - const pendingSyncDeps = paths; - - // accum variable for sync dependencies of the current pending - // dependency we're processing - const syncDependencies = Object.create(null); - - return promiseWhile( - () => pendingSyncDeps.length > 0, - () => { - const dependencies = Object.keys(syncDependencies); - if (dependencies.length > 0) { - bundle.modules = dependencies; - } - - // persist changes to layouts - this._persistCacheEventually(); - }, - index => { - const pendingSyncDep = pendingSyncDeps.shift(); - return this._resolver - .getDependencies(pendingSyncDep, {dev: isDev}) - .then(deps => { - deps.dependencies.forEach(dep => { - if (dep.path !== pendingSyncDep && !dep.isPolyfill()) { - pendingSyncDeps.push(dep.path); - } - syncDependencies[dep.path] = true; - this._moduleToBundle[dep.path] = bundle.id; - }); - deps.asyncDependencies.forEach(asyncDeps => { - const childBundle = { - id: bundle.id + '.' + currentBundleID++, - modules: [], - children: [], - }; - - bundle.children.push(childBundle); - pending.push({paths: asyncDeps, bundle: childBundle}); - }); - }); - }, - ); - }, - ); - - return this._layouts[entryPath]; - } - - getBundleIDForModule(path) { - return this._moduleToBundle[path]; - } - - _loadCacheSync(cachePath) { - const loadCacheId = Activity.startEvent('Loading bundles layout'); - const cacheOnDisk = loadCacheSync(cachePath); - - // TODO: create single-module bundles for unexistent modules - // TODO: remove modules that no longer exist - Object.keys(cacheOnDisk).forEach(entryPath => { - this._layouts[entryPath] = Promise.resolve(cacheOnDisk[entryPath]); - this._fillModuleToBundleMap(cacheOnDisk[entryPath]); - }); - - Activity.endEvent(loadCacheId); - } - - _fillModuleToBundleMap(bundle) { - bundle.modules.forEach(module => this._moduleToBundle[module] = bundle.id); - bundle.children.forEach(child => this._fillModuleToBundleMap(child)); - } - - _persistCacheEventually() { - _.debounce( - this._persistCache.bind(this), - 2000, - ); - } - - _persistCache() { - if (this._persisting !== null) { - return this._persisting; - } - - this._persisting = Promise - .all(_.values(this._layouts)) - .then(bundlesLayout => { - var json = Object.create(null); - Object.keys(this._layouts).forEach((p, i) => - json[p] = bundlesLayout[i] - ); - - return Promise.denodeify(fs.writeFile)( - this._cacheFilepath, - JSON.stringify(json), - ); - }) - .then(() => this._persisting = null); - - return this._persisting; - } - - _getCacheFilePath(options) { - return getCacheFilePath( - tmpdir, - 'react-packager-bundles-cache-', - version, - options.projectRoots.join(',').split(path.sep).join('-'), - options.cacheVersion || '0', - ); - } -} - -// Runs the body Promise meanwhile the condition callback is satisfied. -// Once it's not satisfied anymore, it returns what the results callback -// indicates -function promiseWhile(condition, result, body) { - return _promiseWhile(condition, result, body, 0); -} - -function _promiseWhile(condition, result, body, index) { - if (!condition()) { - return Promise.resolve(result()); - } - - return body(index).then(() => - _promiseWhile(condition, result, body, index + 1) - ); -} - -module.exports = BundlesLayout; diff --git a/packager/react-packager/src/DependencyResolver/AssetModule.js b/packager/react-packager/src/DependencyResolver/AssetModule.js index f5555facd74451..c2f51fbb2b441c 100644 --- a/packager/react-packager/src/DependencyResolver/AssetModule.js +++ b/packager/react-packager/src/DependencyResolver/AssetModule.js @@ -21,10 +21,6 @@ class AssetModule extends Module { return Promise.resolve([]); } - getAsyncDependencies() { - return Promise.resolve([]); - } - read() { return Promise.resolve({}); } diff --git a/packager/react-packager/src/DependencyResolver/AssetModule_DEPRECATED.js b/packager/react-packager/src/DependencyResolver/AssetModule_DEPRECATED.js index a77d0aef5e932c..3c4659462aa8f6 100644 --- a/packager/react-packager/src/DependencyResolver/AssetModule_DEPRECATED.js +++ b/packager/react-packager/src/DependencyResolver/AssetModule_DEPRECATED.js @@ -24,10 +24,6 @@ class AssetModule_DEPRECATED extends Module { return Promise.resolve([]); } - getAsyncDependencies() { - return Promise.resolve([]); - } - hash() { return `AssetModule_DEPRECATED : ${this.path}`; } diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js index 879c53efa59f55..c4004ed75183c1 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionRequest.js @@ -187,23 +187,6 @@ class ResolutionRequest { }); } - getAsyncDependencies(response) { - return Promise.resolve().then(() => { - const mod = this._moduleCache.getModule(this._entryPath); - return mod.getAsyncDependencies().then(bundles => - Promise - .all(bundles.map(bundle => - Promise.all(bundle.map( - dep => this.resolveDependency(mod, dep) - )) - )) - .then(bs => bs.map(bundle => bundle.map(dep => dep.path))) - ); - }).then(asyncDependencies => asyncDependencies.forEach( - (dependency) => response.pushAsyncDependency(dependency) - )); - } - _getAllMocks(pattern) { // Take all mocks in all the roots into account. This is necessary // because currently mocks are global: any module can be mocked by diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionResponse.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionResponse.js index c13895fbe1e91d..56e1ed7a104be4 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionResponse.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/ResolutionResponse.js @@ -11,7 +11,6 @@ class ResolutionResponse { constructor() { this.dependencies = []; - this.asyncDependencies = []; this.mainModuleId = null; this.mocks = null; this.numPrependedDependencies = 0; @@ -22,13 +21,11 @@ class ResolutionResponse { copy(properties) { const { dependencies = this.dependencies, - asyncDependencies = this.asyncDependencies, mainModuleId = this.mainModuleId, mocks = this.mocks, } = properties; return Object.assign(new this.constructor(), this, { dependencies, - asyncDependencies, mainModuleId, mocks, }); @@ -69,11 +66,6 @@ class ResolutionResponse { this.numPrependedDependencies += 1; } - pushAsyncDependency(dependency) { - this._assertNotFinalized(); - this.asyncDependencies.push(dependency); - } - setResolvedDependencyPairs(module, pairs) { this._assertNotFinalized(); const hash = module.hash(); diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/__tests__/DependencyGraph-test.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/__tests__/DependencyGraph-test.js index 09a4454373e21e..990e234f82ad4e 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/__tests__/DependencyGraph-test.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/__tests__/DependencyGraph-test.js @@ -4068,40 +4068,6 @@ describe('DependencyGraph', function() { }); }); - describe('getAsyncDependencies', () => { - pit('should get dependencies', function() { - var root = '/root'; - fs.__setMockFilesystem({ - 'root': { - 'index.js': [ - '/**', - ' * @providesModule index', - ' */', - 'System.' + 'import("a")', - ].join('\n'), - 'a.js': [ - '/**', - ' * @providesModule a', - ' */', - ].join('\n'), - }, - }); - - var dgraph = new DependencyGraph({ - ...defaults, - roots: [root], - }); - - return dgraph.getDependencies('/root/index.js') - .then(response => response.finalize()) - .then(({ asyncDependencies }) => { - expect(asyncDependencies).toEqual([ - ['/root/a.js'], - ]); - }); - }); - }); - describe('Extensions', () => { pit('supports custom file extensions', () => { var root = '/root'; diff --git a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js index 3c5ade661eb512..9241b18a119aff 100644 --- a/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js +++ b/packager/react-packager/src/DependencyResolver/DependencyGraph/index.js @@ -185,14 +185,11 @@ class DependencyGraph { const response = new ResolutionResponse(); - return Promise.all([ - req.getOrderedDependencies( - response, - this._opts.mocksPattern, - recursive, - ), - req.getAsyncDependencies(response), - ]).then(() => response); + return req.getOrderedDependencies( + response, + this._opts.mocksPattern, + recursive, + ).then(() => response); }); } diff --git a/packager/react-packager/src/DependencyResolver/Module.js b/packager/react-packager/src/DependencyResolver/Module.js index f9142611fed3e7..116a52e093cef4 100644 --- a/packager/react-packager/src/DependencyResolver/Module.js +++ b/packager/react-packager/src/DependencyResolver/Module.js @@ -91,14 +91,6 @@ class Module { ); } - getAsyncDependencies() { - return this._cache.get( - this.path, - 'asyncDependencies', - () => this.read().then(data => data.asyncDependencies) - ); - } - invalidate() { this._cache.invalidate(this.path); } @@ -146,7 +138,6 @@ class Module { return { id, dependencies: [], - asyncDependencies: [], code: content, }; } else { @@ -155,13 +146,12 @@ class Module { ? transformCode(this, content) : Promise.resolve({code: content}); - return codePromise.then(({code, dependencies, asyncDependencies}) => { + return codePromise.then(({code, dependencies}) => { const {deps} = this._extractor(code); return { id, code, dependencies: dependencies || deps.sync, - asyncDependencies: asyncDependencies || deps.async, }; }); } diff --git a/packager/react-packager/src/DependencyResolver/__tests__/Module-test.js b/packager/react-packager/src/DependencyResolver/__tests__/Module-test.js index 4ed5868b1860b6..71bc552278a216 100644 --- a/packager/react-packager/src/DependencyResolver/__tests__/Module-test.js +++ b/packager/react-packager/src/DependencyResolver/__tests__/Module-test.js @@ -167,45 +167,6 @@ describe('Module', () => { }); }); - describe('Async Dependencies', () => { - function expectAsyncDependenciesToEqual(expected) { - const module = createModule(); - return module.getAsyncDependencies().then(actual => - expect(actual).toEqual(expected) - ); - } - - pit('should recognize single dependency', () => { - mockIndexFile('System.' + 'import("dep1")'); - - return expectAsyncDependenciesToEqual([['dep1']]); - }); - - pit('should parse single quoted dependencies', () => { - mockIndexFile('System.' + 'import(\'dep1\')'); - - return expectAsyncDependenciesToEqual([['dep1']]); - }); - - pit('should parse multiple async dependencies on the same module', () => { - mockIndexFile([ - 'System.' + 'import("dep1")', - 'System.' + 'import("dep2")', - ].join('\n')); - - return expectAsyncDependenciesToEqual([ - ['dep1'], - ['dep2'], - ]); - }); - - pit('parse fine new lines', () => { - mockIndexFile('System.' + 'import(\n"dep1"\n)'); - - return expectAsyncDependenciesToEqual([['dep1']]); - }); - }); - describe('Code', () => { const fileContents = 'arbitrary(code)'; beforeEach(function() { @@ -247,7 +208,7 @@ describe('Module', () => { const fileContents = 'arbitrary(code);'; const exampleCode = ` require('a'); - System.import('b'); + arbitrary.code('b'); require('c');`; beforeEach(function() { @@ -268,12 +229,8 @@ describe('Module', () => { transformCode.mockReturnValue(Promise.resolve({code: exampleCode})); const module = createModule({transformCode}); - return Promise.all([ - module.getDependencies(), - module.getAsyncDependencies(), - ]).then(([dependencies, asyncDependencies]) => { + return module.getDependencies().then(dependencies => { expect(dependencies).toEqual(['a', 'c']); - expect(asyncDependencies).toEqual([['b']]); }); }); @@ -285,29 +242,8 @@ describe('Module', () => { })); const module = createModule({transformCode}); - return Promise.all([ - module.getDependencies(), - module.getAsyncDependencies(), - ]).then(([dependencies, asyncDependencies]) => { + return module.getDependencies().then(dependencies => { expect(dependencies).toEqual(mockedDependencies); - expect(asyncDependencies).toEqual([['b']]); - }); - }); - - pit('uses async dependencies that `transformCode` resolves to, instead of extracting them', () => { - const mockedAsyncDependencies = [['foo', 'bar'], ['baz']]; - transformCode.mockReturnValue(Promise.resolve({ - code: exampleCode, - asyncDependencies: mockedAsyncDependencies, - })); - const module = createModule({transformCode}); - - return Promise.all([ - module.getDependencies(), - module.getAsyncDependencies(), - ]).then(([dependencies, asyncDependencies]) => { - expect(dependencies).toEqual(['a', 'c']); - expect(asyncDependencies).toEqual(mockedAsyncDependencies); }); }); diff --git a/packager/react-packager/src/DependencyResolver/lib/extractRequires.js b/packager/react-packager/src/DependencyResolver/lib/extractRequires.js index 107cc6ba9e36b6..5dbf63cc6b4b30 100644 --- a/packager/react-packager/src/DependencyResolver/lib/extractRequires.js +++ b/packager/react-packager/src/DependencyResolver/lib/extractRequires.js @@ -18,7 +18,6 @@ const lineCommentRe = /\/\/.+(\n|$)/g; function extractRequires(code) { var deps = { sync: [], - async: [], }; code = code @@ -41,15 +40,6 @@ function extractRequires(code) { deps.sync.push(dep); return match; }) - // Parse async dependencies this module has. As opposed to what happens - // with sync dependencies, when the module is required, it's async - // dependencies won't be loaded into memory. This is deferred till the - // code path gets to the import statement: - // System.import('dep1') - .replace(replacePatterns.SYSTEM_IMPORT_RE, (match, pre, quot, dep, post) => { - deps.async.push([dep]); - return match; - }); return {code, deps}; } diff --git a/packager/react-packager/src/DependencyResolver/lib/replacePatterns.js b/packager/react-packager/src/DependencyResolver/lib/replacePatterns.js index a4e563d2c67cce..8c10710ec459c7 100644 --- a/packager/react-packager/src/DependencyResolver/lib/replacePatterns.js +++ b/packager/react-packager/src/DependencyResolver/lib/replacePatterns.js @@ -12,4 +12,3 @@ exports.IMPORT_RE = /(\bimport\s+(?:[^'"]+\s+from\s+)??)(['"])([^'"]+)(\2)/g; exports.EXPORT_RE = /(\bexport\s+(?:[^'"]+\s+from\s+)??)(['"])([^'"]+)(\2)/g; exports.REQUIRE_RE = /(\brequire\s*?\(\s*?)(['"])([^'"]+)(\2\s*?\))/g; -exports.SYSTEM_IMPORT_RE = /(\bSystem\.import\s*?\(\s*?)(['"])([^'"]+)(\2\s*?\))/g; diff --git a/packager/react-packager/src/Resolver/__tests__/Resolver-test.js b/packager/react-packager/src/Resolver/__tests__/Resolver-test.js index 7ef335d9b3d2d4..2f1f65dea67604 100644 --- a/packager/react-packager/src/Resolver/__tests__/Resolver-test.js +++ b/packager/react-packager/src/Resolver/__tests__/Resolver-test.js @@ -37,10 +37,9 @@ describe('Resolver', function() { }); class ResolutionResponseMock { - constructor({dependencies, mainModuleId, asyncDependencies}) { + constructor({dependencies, mainModuleId}) { this.dependencies = dependencies; this.mainModuleId = mainModuleId; - this.asyncDependencies = asyncDependencies; } prependDependency(dependency) { @@ -80,7 +79,6 @@ describe('Resolver', function() { return Promise.resolve(new ResolutionResponseMock({ dependencies: deps, mainModuleId: 'index', - asyncDependencies: [], })); }); @@ -180,7 +178,6 @@ describe('Resolver', function() { return Promise.resolve(new ResolutionResponseMock({ dependencies: deps, mainModuleId: 'index', - asyncDependencies: [], })); }); @@ -208,7 +205,6 @@ describe('Resolver', function() { return Promise.resolve(new ResolutionResponseMock({ dependencies: deps, mainModuleId: 'index', - asyncDependencies: [], })); }); @@ -637,7 +633,6 @@ describe('Resolver', function() { const resolutionResponse = new ResolutionResponseMock({ dependencies: [module], mainModuleId: 'test module', - asyncDependencies: [], }); resolutionResponse.getResolvedDependencyPairs = (module) => { diff --git a/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js b/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js deleted file mode 100644 index 39d687881885ba..00000000000000 --- a/packager/react-packager/src/Resolver/polyfills/__tests__/loadBundles-test.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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. - */ -'use strict'; - -jest.dontMock('../loadBundles'); -jest.mock('NativeModules'); - -let loadBundles; -let loadBundlesCalls; - -describe('loadBundles', () => { - beforeEach(() => { - loadBundles = jest.genMockFunction(); - loadBundlesCalls = loadBundles.mock.calls; - require('NativeModules').RCTBundlesLoader = {loadBundles}; - - require('../loadBundles'); - }); - - it('should set `global.__loadBundles` function when polyfill is initialized', () => { - expect(typeof global.__loadBundles).toBe('function'); - }); - - it('should return a promise', () => { - loadBundles.mockImpl((bundles, callback) => callback()); - expect(global.__loadBundles(['bundle.0']) instanceof Promise).toBeTruthy(); - }); - - pit('shouldn\'t request already loaded bundles', () => { - loadBundles.mockImpl((bundles, callback) => callback()); - return global.__loadBundles(['bundle.0']) - .then(() => global.__loadBundles(['bundle.0'])) - .then(() => expect(loadBundlesCalls.length).toBe(1)); - }); - - pit('shouldn\'n request inflight bundles', () => { - loadBundles.mockImpl((bundles, callback) => { - if (bundles.length === 1 && bundles[0] === 'bundle.0') { - setTimeout(callback, 1000); - } else if (bundles.length === 1 && bundles[0] === 'bundle.1') { - setTimeout(callback, 500); - } - }); - - const promises = Promise.all([ - global.__loadBundles(['bundle.0']), - global.__loadBundles(['bundle.0', 'bundle.1']), - ]).then(() => { - expect(loadBundlesCalls.length).toBe(2); - expect(loadBundlesCalls[0][0][0]).toBe('bundle.0'); - expect(loadBundlesCalls[1][0][0]).toBe('bundle.1'); - }); - - jest.runAllTimers(); - return promises; - }); -}); diff --git a/packager/react-packager/src/Resolver/polyfills/loadBundles.js b/packager/react-packager/src/Resolver/polyfills/loadBundles.js deleted file mode 100644 index 7bb9be104a32c5..00000000000000 --- a/packager/react-packager/src/Resolver/polyfills/loadBundles.js +++ /dev/null @@ -1,34 +0,0 @@ -/* eslint strict:0 */ - -let loadBundlesOnNative = (bundles) => - new Promise((resolve) => - require('NativeModules').RCTBundlesLoader.loadBundles(bundles, resolve)); - -let requestedBundles = Object.create(null); - -/** - * Returns a promise that is fulfilled once all the indicated bundles are - * loaded into memory and injected into the JS engine. - * This invokation might need to go through the bridge - * and run native code to load some, if not all, the requested bundles. - * If all the bundles have already been loaded, the promise is resolved - * immediately. Otherwise, we'll determine which bundles still need to get - * loaded considering both, the ones already loaded, and the ones being - * currently asynchronously loaded by other invocations to `__loadBundles`, - * and return a promise that will get fulfilled once all these are finally - * loaded. - * - * Note this function should only be invoked by generated code. - */ -global.__loadBundles = function(bundles) { - // split bundles by whether they've already been requested or not - const bundlesToRequest = bundles.filter(b => !requestedBundles[b]); - - // keep a reference to the promise loading each bundle - if (bundlesToRequest.length > 0) { - const nativePromise = loadBundlesOnNative(bundlesToRequest); - bundlesToRequest.forEach(b => requestedBundles[b] = nativePromise); - } - - return Promise.all(bundles.map(bundle => requestedBundles[bundle])); -}; diff --git a/packager/react-packager/src/transforms/babel-plugin-system-import/__tests__/babel-plugin-system-import-test.js b/packager/react-packager/src/transforms/babel-plugin-system-import/__tests__/babel-plugin-system-import-test.js deleted file mode 100644 index b29f1bd55be619..00000000000000 --- a/packager/react-packager/src/transforms/babel-plugin-system-import/__tests__/babel-plugin-system-import-test.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @emails oncall+jsinfra - */ - -'use strict'; - -jest.autoMockOff(); -jest.mock('../../../BundlesLayout'); - -const babel = require('babel-core'); -const BundlesLayout = require('../../../BundlesLayout'); - -const testData = { - isolated: { - input: 'System.' + 'import("moduleA");', - output: 'loadBundles(["bundle.0"]);' - }, - single: { - input: 'System.' + 'import("moduleA").then(function (bundleA) {});', - output: 'loadBundles(["bundle.0"]).then(function (bundleA) {});' - }, - multiple: { - input: [ - 'Promise.all([', - 'System.' + 'import("moduleA"), System.' + 'import("moduleB"),', - ']).then(function (bundlesA, bundlesB) {});', - ].join('\n'), - output: [ - 'Promise.all([', - 'loadBundles(["bundle.0"]), loadBundles(["bundle.1"])', - ']).then(function (bundlesA, bundlesB) {});', - ].join(''), - }, -}; - -describe('System.import', () => { - let layout = new BundlesLayout(); - BundlesLayout.prototype.getBundleIDForModule.mockImpl(module => { - switch (module) { - case 'moduleA': return 'bundle.0'; - case 'moduleB': return 'bundle.1'; - } - }); - - function transform(source) { - return babel.transform(source, { - plugins: [ - [require('../'), { bundlesLayout: layout }] - ], - }).code; - } - - function test(data) { - // transform and remove new lines - expect(transform(data.input).replace(/(\r\n|\n|\r)/gm,'')).toEqual(data.output); - } - - it('should transform isolated `System.import`', () => { - test(testData.isolated); - }); - - it('should transform single `System.import`', () => { - test(testData.single); - }); - - it('should transform multiple `System.import`s', () => { - test(testData.multiple); - }); -}); diff --git a/packager/react-packager/src/transforms/babel-plugin-system-import/index.js b/packager/react-packager/src/transforms/babel-plugin-system-import/index.js deleted file mode 100644 index 7cf0f0a08524fa..00000000000000 --- a/packager/react-packager/src/transforms/babel-plugin-system-import/index.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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. - * - */ -/*jslint node: true */ -'use strict'; - -const t = require('babel-types'); - -/** -* Transforms asynchronous module importing into a function call -* that includes which bundle needs to be loaded -* -* Transforms: -* -* System.import('moduleA') -* -* to: -* -* loadBundles('bundleA') -*/ -module.exports = function() { - return { - visitor: { - CallExpression: function (path, state) { - if (!isAppropriateSystemImportCall(path.node)) { - return; - } - - var bundlesLayout = state.opts.bundlesLayout; - var bundleID = bundlesLayout.getBundleIDForModule( - path.node.arguments[0].value - ); - - var bundles = bundleID.split('.'); - bundles.splice(0, 1); - bundles = bundles.map(function(id) { - return t.stringLiteral('bundle.' + id); - }); - - path.replaceWith(t.callExpression( - t.identifier('loadBundles'), - [t.arrayExpression(bundles)] - )); - }, - }, - }; -}; - -function isAppropriateSystemImportCall(node) { - return ( - node.callee.type === 'MemberExpression' && - node.callee.object.name === 'System' && - node.callee.property.name === 'import' && - node.arguments.length === 1 && - node.arguments[0].type === 'StringLiteral' - ); -} From 272096ce7c0d3dfb0302079cefbb6f72e43a9870 Mon Sep 17 00:00:00 2001 From: Henry Kirkness Date: Tue, 9 Feb 2016 18:46:42 -0800 Subject: [PATCH 002/417] Added Choke to showcase Summary: Closes https://github.com/facebook/react-native/pull/5848 Reviewed By: svcscm Differential Revision: D2920042 Pulled By: androidtrunkagent fb-gh-sync-id: e45d4789200e1825e319eaf7bb70d3ff52c12325 shipit-source-id: e45d4789200e1825e319eaf7bb70d3ff52c12325 --- website/src/react-native/showcase.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/website/src/react-native/showcase.js b/website/src/react-native/showcase.js index 9b3b8722de38b7..83ebcb88eac90e 100644 --- a/website/src/react-native/showcase.js +++ b/website/src/react-native/showcase.js @@ -166,6 +166,12 @@ var apps = [ link: 'https://play.google.com/store/apps/details?id=com.cbssports.fantasy.franchisefootball2015', author: 'CBS Sports', }, + { + name: 'Choke - Rap Battle With Friends', + icon: 'http://a3.mzstatic.com/us/r30/Purple49/v4/3e/83/85/3e8385d8-140f-da38-a100-1393cef3e816/icon175x175.png', + link: 'https://itunes.apple.com/us/app/choke-rap-battle-with-friends/id1077937445?ls=1&mt=8', + author: 'Henry Kirkness', + }, { name: 'Codementor - Live 1:1 Expert Developer Help', icon: 'http://a1.mzstatic.com/us/r30/Purple3/v4/db/cf/35/dbcf3523-bac7-0f54-c6a8-a80bf4f43c38/icon175x175.jpeg', From a11f980a3425149bed7f560a3162315cc8c0e82f Mon Sep 17 00:00:00 2001 From: Christopher Dro Date: Tue, 9 Feb 2016 19:15:52 -0800 Subject: [PATCH 003/417] Remove isRequired on source prop for Android Summary: Makes source required across both platforms. Closes https://github.com/facebook/react-native/pull/5845 Reviewed By: svcscm Differential Revision: D2920250 Pulled By: vjeux fb-gh-sync-id: 21845b601df32dc2e12a95544afa3db4c0414746 shipit-source-id: 21845b601df32dc2e12a95544afa3db4c0414746 --- Libraries/Image/Image.android.js | 4 ++-- Libraries/Image/Image.ios.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 4c920dcf2aa55a..fdc8c2f64cec76 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -63,7 +63,7 @@ var ImageViewAttributes = merge(ReactNativeViewAttributes.UIView, { var Image = React.createClass({ propTypes: { ...View.propTypes, - style: StyleSheetPropType(ImageStylePropTypes), + style: StyleSheetPropType(ImageStylePropTypes), /** * `uri` is a string representing the resource identifier for the image, which * could be an http address, a local file path, or a static image @@ -75,7 +75,7 @@ var Image = React.createClass({ }), // Opaque type returned by require('./image.jpg') PropTypes.number, - ]).isRequired, + ]), /** * similarly to `source`, this property represents the resource used to render * the loading indicator for the image, displayed until image is ready to be diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 4830a6dec3365e..625dc8d50eca1c 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -213,7 +213,7 @@ var Image = React.createClass({ if (this.context.isInAParentText) { RawImage = RCTVirtualImage; if (!width || !height) { - console.warn('You must specify a width and height for the image %s', uri); + console.warn('You must specify a width and height for the image %s', uri); } } From 142f8c92de22a27bcbf09d8a0626a562c67a6aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Stu=CC=88tz?= Date: Wed, 10 Feb 2016 05:00:32 -0800 Subject: [PATCH 004/417] Fixed icon handling Summary: [This commit](https://github.com/facebook/react-native/commit/e730a9fdd08e63eabf75963ed9cdc17564cf0bfb) (_Load assets from same folder as JSbundle (Android)_) causes React Native to look for assets inside the same folder the JSBundle was loaded from and generates asset URIs containing the absolute path to the asset (e.g. _/sdcard/bundle/drawable-xxhdpi/ic_back.png_). While this is fine for a normal `ImageView`, `ToolbarAndroid`/`ReactToolbar` currently crashes if the icons are located on the file system. This happens because when setting an icon on `ReactToolbar`, Fresco is only used if the icon URI contains `http:// `or `https://`. For all other cases (like in this case where it starts with `file://`), the view tries to load the Drawable from the Android App Resources by it's name (which in this case is an absolute file-URI) and therefore causes it to crash (`getDrawableResourceByName` returns 0 if the Drawable was not found, then `getResources().getDrawable(DrawableRes int id)` throws an Exception if th Closes https://github.com/facebook/react-native/pull/5753 Reviewed By: svcscm Differential Revision: D2921418 Pulled By: foghina fb-gh-sync-id: 7a3f81b530a8c1530e98e7b592ee7e44c8f19df1 shipit-source-id: 7a3f81b530a8c1530e98e7b592ee7e44c8f19df1 --- .../react/views/toolbar/ReactToolbar.java | 278 ++++++++++-------- 1 file changed, 157 insertions(+), 121 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbar.java b/ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbar.java index 5fe30921a69593..aae49837941036 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbar.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/toolbar/ReactToolbar.java @@ -2,8 +2,6 @@ package com.facebook.react.views.toolbar; -import javax.annotation.Nullable; - import android.content.Context; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; @@ -14,7 +12,6 @@ import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.controller.BaseControllerListener; -import com.facebook.drawee.controller.ControllerListener; import com.facebook.drawee.drawable.ScalingUtils; import com.facebook.drawee.generic.GenericDraweeHierarchy; import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder; @@ -22,88 +19,110 @@ import com.facebook.drawee.view.DraweeHolder; import com.facebook.drawee.view.MultiDraweeHolder; import com.facebook.imagepipeline.image.ImageInfo; +import com.facebook.imagepipeline.image.QualityInfo; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.uimanager.PixelUtil; + +import javax.annotation.Nullable; /** * Custom implementation of the {@link Toolbar} widget that adds support for remote images in logo * and navigationIcon using fresco. */ public class ReactToolbar extends Toolbar { + private static final String PROP_ACTION_ICON = "icon"; private static final String PROP_ACTION_SHOW = "show"; private static final String PROP_ACTION_SHOW_WITH_TEXT = "showWithText"; private static final String PROP_ACTION_TITLE = "title"; + private static final String PROP_ICON_URI = "uri"; + private static final String PROP_ICON_WIDTH = "width"; + private static final String PROP_ICON_HEIGHT = "height"; + private final DraweeHolder mLogoHolder; private final DraweeHolder mNavIconHolder; private final DraweeHolder mOverflowIconHolder; private final MultiDraweeHolder mActionsHolder = - new MultiDraweeHolder<>(); - - private final ControllerListener mLogoControllerListener = - new BaseControllerListener() { - @Override - public void onFinalImageSet( - String id, - @Nullable final ImageInfo imageInfo, - @Nullable Animatable animatable) { - if (imageInfo != null) { - final DrawableWithIntrinsicSize logoDrawable = - new DrawableWithIntrinsicSize(mLogoHolder.getTopLevelDrawable(), imageInfo); - setLogo(logoDrawable); - } - } - }; - - private final ControllerListener mNavIconControllerListener = - new BaseControllerListener() { - @Override - public void onFinalImageSet( - String id, - @Nullable final ImageInfo imageInfo, - @Nullable Animatable animatable) { - if (imageInfo != null) { - final DrawableWithIntrinsicSize navIconDrawable = - new DrawableWithIntrinsicSize(mNavIconHolder.getTopLevelDrawable(), imageInfo); - setNavigationIcon(navIconDrawable); - } - } - }; - - private final ControllerListener mOverflowIconControllerListener = - new BaseControllerListener() { - @Override - public void onFinalImageSet( - String id, - @Nullable final ImageInfo imageInfo, - @Nullable Animatable animatable) { - if (imageInfo != null) { - final DrawableWithIntrinsicSize overflowIconDrawable = - new DrawableWithIntrinsicSize(mOverflowIconHolder.getTopLevelDrawable(), imageInfo); - setOverflowIcon(overflowIconDrawable); - } - } - }; + new MultiDraweeHolder<>(); + + private IconControllerListener mLogoControllerListener; + private IconControllerListener mNavIconControllerListener; + private IconControllerListener mOverflowIconControllerListener; + + /** + * Attaches specific icon width & height to a BaseControllerListener which will be used to + * create the Drawable + */ + private abstract class IconControllerListener extends BaseControllerListener { - private static class ActionIconControllerListener extends BaseControllerListener { - private final MenuItem mItem; private final DraweeHolder mHolder; + private IconImageInfo mIconImageInfo; + + public IconControllerListener(DraweeHolder holder) { + mHolder = holder; + } + + public void setIconImageInfo(IconImageInfo iconImageInfo) { + mIconImageInfo = iconImageInfo; + } + + @Override + public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) { + super.onFinalImageSet(id, imageInfo, animatable); + + final ImageInfo info = mIconImageInfo != null ? mIconImageInfo : imageInfo; + setDrawable(new DrawableWithIntrinsicSize(mHolder.getTopLevelDrawable(), info)); + } + + protected abstract void setDrawable(Drawable d); + + } + + private class ActionIconControllerListener extends IconControllerListener { + private final MenuItem mItem; + ActionIconControllerListener(MenuItem item, DraweeHolder holder) { + super(holder); mItem = item; - mHolder = holder; } @Override - public void onFinalImageSet( - String id, - @Nullable ImageInfo imageInfo, - @Nullable Animatable animatable) { - if (imageInfo != null) { - mItem.setIcon(new DrawableWithIntrinsicSize(mHolder.getTopLevelDrawable(), imageInfo)); - } + protected void setDrawable(Drawable d) { + mItem.setIcon(d); + } + } + + /** + * Simple implementation of ImageInfo, only providing width & height + */ + private static class IconImageInfo implements ImageInfo { + + private int mWidth; + private int mHeight; + + public IconImageInfo(int width, int height) { + mWidth = width; + mHeight = height; + } + + @Override + public int getWidth() { + return mWidth; + } + + @Override + public int getHeight() { + return mHeight; + } + + @Override + public QualityInfo getQualityInfo() { + return null; } + } public ReactToolbar(Context context) { @@ -112,6 +131,28 @@ public ReactToolbar(Context context) { mLogoHolder = DraweeHolder.create(createDraweeHierarchy(), context); mNavIconHolder = DraweeHolder.create(createDraweeHierarchy(), context); mOverflowIconHolder = DraweeHolder.create(createDraweeHierarchy(), context); + + mLogoControllerListener = new IconControllerListener(mLogoHolder) { + @Override + protected void setDrawable(Drawable d) { + setLogo(d); + } + }; + + mNavIconControllerListener = new IconControllerListener(mNavIconHolder) { + @Override + protected void setDrawable(Drawable d) { + setNavigationIcon(d); + } + }; + + mOverflowIconControllerListener = new IconControllerListener(mOverflowIconHolder) { + @Override + protected void setDrawable(Drawable d) { + setOverflowIcon(d); + } + }; + } private final Runnable mLayoutRunnable = new Runnable() { @@ -172,51 +213,15 @@ private void attachDraweeHolders() { } /* package */ void setLogoSource(@Nullable ReadableMap source) { - String uri = source != null ? source.getString("uri") : null; - if (uri == null) { - setLogo(null); - } else if (uri.startsWith("http://") || uri.startsWith("https://")) { - DraweeController controller = Fresco.newDraweeControllerBuilder() - .setUri(Uri.parse(uri)) - .setControllerListener(mLogoControllerListener) - .setOldController(mLogoHolder.getController()) - .build(); - mLogoHolder.setController(controller); - } else { - setLogo(getDrawableResourceByName(uri)); - } + setIconSource(source, mLogoControllerListener, mLogoHolder); } /* package */ void setNavIconSource(@Nullable ReadableMap source) { - String uri = source != null ? source.getString("uri") : null; - if (uri == null) { - setNavigationIcon(null); - } else if (uri.startsWith("http://") || uri.startsWith("https://")) { - DraweeController controller = Fresco.newDraweeControllerBuilder() - .setUri(Uri.parse(uri)) - .setControllerListener(mNavIconControllerListener) - .setOldController(mNavIconHolder.getController()) - .build(); - mNavIconHolder.setController(controller); - } else { - setNavigationIcon(getDrawableResourceByName(uri)); - } + setIconSource(source, mNavIconControllerListener, mNavIconHolder); } /* package */ void setOverflowIconSource(@Nullable ReadableMap source) { - String uri = source != null ? source.getString("uri") : null; - if (uri == null) { - setOverflowIcon(null); - } else if (uri.startsWith("http://") || uri.startsWith("https://")) { - DraweeController controller = Fresco.newDraweeControllerBuilder() - .setUri(Uri.parse(uri)) - .setControllerListener(mOverflowIconControllerListener) - .setOldController(mOverflowIconHolder.getController()) - .build(); - mOverflowIconHolder.setController(controller); - } else { - setOverflowIcon(getDrawableByName(uri)); - } + setIconSource(source, mOverflowIconControllerListener, mOverflowIconHolder); } /* package */ void setActions(@Nullable ReadableArray actions) { @@ -226,16 +231,13 @@ private void attachDraweeHolders() { if (actions != null) { for (int i = 0; i < actions.size(); i++) { ReadableMap action = actions.getMap(i); + MenuItem item = menu.add(Menu.NONE, Menu.NONE, i, action.getString(PROP_ACTION_TITLE)); - ReadableMap icon = action.hasKey(PROP_ACTION_ICON) ? action.getMap(PROP_ACTION_ICON) : null; - if (icon != null) { - String iconSource = icon.getString("uri"); - if (iconSource.startsWith("http://") || iconSource.startsWith("https://")) { - setMenuItemIcon(item, icon); - } else { - item.setIcon(getDrawableResourceByName(iconSource)); - } + + if (action.hasKey(PROP_ACTION_ICON)) { + setMenuItemIcon(item, action.getMap(PROP_ACTION_ICON)); } + int showAsAction = action.hasKey(PROP_ACTION_SHOW) ? action.getInt(PROP_ACTION_SHOW) : MenuItem.SHOW_AS_ACTION_NEVER; @@ -248,24 +250,43 @@ private void attachDraweeHolders() { } } - /** - * This is only used when the icon is remote (http/s). Creates & adds a new {@link DraweeHolder} - * to {@link #mActionsHolder} and attaches a {@link ActionIconControllerListener} that just sets - * the top level drawable when it's loaded. - */ - private void setMenuItemIcon(MenuItem item, ReadableMap icon) { - String iconSource = icon.getString("uri"); + private void setMenuItemIcon(final MenuItem item, ReadableMap iconSource) { DraweeHolder holder = - DraweeHolder.create(createDraweeHierarchy(), getContext()); - DraweeController controller = Fresco.newDraweeControllerBuilder() - .setUri(Uri.parse(iconSource)) - .setControllerListener(new ActionIconControllerListener(item, holder)) - .setOldController(holder.getController()) - .build(); - holder.setController(controller); + DraweeHolder.create(createDraweeHierarchy(), getContext()); + ActionIconControllerListener controllerListener = new ActionIconControllerListener(item, holder); + controllerListener.setIconImageInfo(getIconImageInfo(iconSource)); + + setIconSource(iconSource, controllerListener, holder); mActionsHolder.add(holder); + + } + + /** + * Sets an icon for a specific icon source. If the uri indicates an icon + * to be somewhere remote (http/https) or on the local filesystem, it uses fresco to load it. + * Otherwise it loads the Drawable from the Resources and directly returns it via a callback + */ + private void setIconSource(ReadableMap source, IconControllerListener controllerListener, DraweeHolder holder) { + + String uri = source != null ? source.getString(PROP_ICON_URI) : null; + + if (uri == null) { + controllerListener.setIconImageInfo(null); + controllerListener.setDrawable(null); + } else if (uri.startsWith("http://") || uri.startsWith("https://") || uri.startsWith("file://")) { + controllerListener.setIconImageInfo(getIconImageInfo(source)); + DraweeController controller = Fresco.newDraweeControllerBuilder() + .setUri(Uri.parse(uri)) + .setControllerListener(controllerListener) + .setOldController(holder.getController()) + .build(); + holder.setController(controller); + } else { + controllerListener.setDrawable(getDrawableByName(uri)); + } + } private GenericDraweeHierarchy createDraweeHierarchy() { @@ -283,7 +304,22 @@ private int getDrawableResourceByName(String name) { } private Drawable getDrawableByName(String name) { - return getResources().getDrawable(getDrawableResourceByName(name)); + int drawableResId = getDrawableResourceByName(name); + if (drawableResId != 0) { + return getResources().getDrawable(getDrawableResourceByName(name)); + } else { + return null; + } + } + + private IconImageInfo getIconImageInfo(ReadableMap source) { + if (source.hasKey(PROP_ICON_WIDTH) && source.hasKey(PROP_ICON_HEIGHT)) { + final int width = Math.round(PixelUtil.toPixelFromDIP(source.getInt(PROP_ICON_WIDTH))); + final int height = Math.round(PixelUtil.toPixelFromDIP(source.getInt(PROP_ICON_HEIGHT))); + return new IconImageInfo(width, height); + } else { + return null; + } } } From 152f1ee58cd3b6f65292c38a7cbe9e280ab914c1 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Wed, 10 Feb 2016 14:21:06 +0000 Subject: [PATCH 005/417] removed temporarilty .travis.yml It will be synced from fbsource in an hour --- .travis.yml | 87 ----------------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 67ac1cc42ecd4e..00000000000000 --- a/.travis.yml +++ /dev/null @@ -1,87 +0,0 @@ -language: objective-c - -osx_image: xcode7.2 - -cache: - directories: - - node_modules - - .nvm - -install: - - brew reinstall nvm - - mkdir -p .nvm - - export NVM_DIR="$PWD/.nvm" - - source $(brew --prefix nvm)/nvm.sh - - nvm install 5 - - rm -Rf "${TMPDIR}/jest_preprocess_cache" - - npm config set spin=false - - npm install -g flow-bin@`node -p "require('fs').readFileSync('.flowconfig', 'utf8').split('[version]')[1].trim()"` - - npm install - -script: -- | - if [ "$TEST_TYPE" = objc ] - then - - ./scripts/objc-test.sh - - elif [ "$TEST_TYPE" = js ] - then - - npm install github@0.2.4 - cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; flow --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" node bots/code-analysis-bot.js - flow check && npm test -- '\/Libraries\/' - - elif [ "$TEST_TYPE" = packager ] - then - - npm test -- '\/packager\/' - - elif [ "$TEST_TYPE" = cli ] - then - - npm test -- '\/(local|private|react-native)-cli\/' - - elif [ "$TEST_TYPE" = build_website ] - then - - cd website - $(which npm) install - ./setup.sh - if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then - # Automatically publish the website - echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc - ./publish.sh - else - # Make sure the website builds without error - node server/generate.js - fi - - elif [ "$TEST_TYPE" = e2e ] - then - ./scripts/e2e-test.sh - else - echo "Unknown test type: $TEST_TYPE" - exit 1 - fi - -env: - matrix: - - TEST_TYPE=objc - - TEST_TYPE=js - - TEST_TYPE=packager - - TEST_TYPE=cli - - TEST_TYPE=build_website - - TEST_TYPE=e2e - global: - # $GITHUB_TOKEN - - secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU=" - # $APPETIZE_TOKEN - - secure: "egsvVSpszTzrNd6bN62DsVAzMiSZI/OHgdizfPryqvqWBf655ztE6XFQSEFNpuIAzSKDDF25ioT8iPfVsbC1iK6HDWHfmqYxML0L+OoU0gi+hV2oKUBFZDZ1fwSnFoWuBdNdMDpLlUxvJp6N1WyfNOB2dxuZUt8eTt48Hi3+Hpc=" - # $S3_TOKEN - - secure: "lY8JZPA0A7zT7L5KF9BBg34XYWIeR/RJiEvE7l7oVr88KnEPtyd//79eHhhVKnUnav7zsk5QJwkcX0MxKTp/dp4G0Am+zOX+sfA8kQrJ+2/+FzFW7AEsW/kHByfaIEIly9DQvUFt4I4oMm8nQZysJLahDgNWglyI3RTuJp//hcY=" - -branches: - only: - - master - - /^.*-stable$/ From d7f787665c52949600f806b7f8655bb1db7bae6f Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Wed, 10 Feb 2016 07:04:48 -0800 Subject: [PATCH 006/417] Added .travis.yml to fbsource to support github PR with it Reviewed By: mkonicek Differential Revision: D2921590 fb-gh-sync-id: 714813270268e5b83e7068f3fe12ee442cd2eb69 shipit-source-id: 714813270268e5b83e7068f3fe12ee442cd2eb69 --- .travis.yml | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000000..9b10d721b5b2eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,88 @@ +language: objective-c + +osx_image: xcode7.2 + +cache: + directories: + - node_modules + - .nvm + +install: + - brew reinstall nvm + - mkdir -p .nvm + - export NVM_DIR="$PWD/.nvm" + - source $(brew --prefix nvm)/nvm.sh + - nvm install 5 + - rm -Rf "${TMPDIR}/jest_preprocess_cache" + - npm config set spin=false + - npm install -g flow-bin@`node -p "require('fs').readFileSync('.flowconfig', 'utf8').split('[version]')[1].trim()"` + - npm install + +script: +- | + if [ "$TEST_TYPE" = objc ] + then + + ./scripts/objc-test.sh + + elif [ "$TEST_TYPE" = js ] + then + + npm install github@0.2.4 + cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; flow --json) | GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" node bots/code-analysis-bot.js + flow check && npm test -- '\/Libraries\/' + + elif [ "$TEST_TYPE" = packager ] + then + + npm test -- '\/packager\/' + + elif [ "$TEST_TYPE" = cli ] + then + + npm test -- '\/(local|private|react-native)-cli\/' + + elif [ "$TEST_TYPE" = build_website ] + then + + cd website + $(which npm) install + ./setup.sh + if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then + # Automatically publish the website + echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc + ./publish.sh + else + # Make sure the website builds without error + node server/generate.js + fi + + elif [ "$TEST_TYPE" = e2e ] + then + ./scripts/e2e-test.sh + else + echo "Unknown test type: $TEST_TYPE" + exit 1 + fi + +env: + matrix: + - TEST_TYPE=objc + - TEST_TYPE=js + - TEST_TYPE=packager + - TEST_TYPE=cli + - TEST_TYPE=build_website + - TEST_TYPE=e2e + global: + # $GITHUB_TOKEN + - secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU=" + # $APPETIZE_TOKEN + - secure: "egsvVSpszTzrNd6bN62DsVAzMiSZI/OHgdizfPryqvqWBf655ztE6XFQSEFNpuIAzSKDDF25ioT8iPfVsbC1iK6HDWHfmqYxML0L+OoU0gi+hV2oKUBFZDZ1fwSnFoWuBdNdMDpLlUxvJp6N1WyfNOB2dxuZUt8eTt48Hi3+Hpc=" + # $S3_TOKEN + - secure: "lY8JZPA0A7zT7L5KF9BBg34XYWIeR/RJiEvE7l7oVr88KnEPtyd//79eHhhVKnUnav7zsk5QJwkcX0MxKTp/dp4G0Am+zOX+sfA8kQrJ+2/+FzFW7AEsW/kHByfaIEIly9DQvUFt4I4oMm8nQZysJLahDgNWglyI3RTuJp//hcY=" + +branches: + only: + - master + - /^.*-stable$/ + \ No newline at end of file From c9a1956c4fd9cfb6bf883c835b501d097181e1a4 Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Wed, 10 Feb 2016 07:24:38 -0800 Subject: [PATCH 007/417] Fix promises on iOS to no longer wrap values in Arrays Summary: public In https://github.com/facebook/react-native/commit/9baff8f437eee49f8ab0e6f433bf86466ca16662#diff-8d9841e5b53fd6c9cf3a7f431827e319R331, I incorrectly assumed that iOS was wrapping promises in an extra Array. What was really happening is that all the callers were doing this. I removed the wrapping in the callers and the special case handling MessageQueue. Now one can pass whatever object one wants to resolve and it will show properly in the resolve call on the js side. This fixes issue https://github.com/facebook/react-native/issues/5851 Reviewed By: nicklockwood Differential Revision: D2921565 fb-gh-sync-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9 shipit-source-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9 --- Libraries/CameraRoll/RCTCameraRollManager.m | 10 +++++----- Libraries/LinkingIOS/RCTLinkingManager.m | 6 +++--- Libraries/Utilities/MessageQueue.js | 6 +----- React/Modules/RCTClipboard.m | 2 +- React/Modules/RCTSourceCode.m | 2 +- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Libraries/CameraRoll/RCTCameraRollManager.m b/Libraries/CameraRoll/RCTCameraRollManager.m index fc97c9493b4af8..d060224ccc7afa 100644 --- a/Libraries/CameraRoll/RCTCameraRollManager.m +++ b/Libraries/CameraRoll/RCTCameraRollManager.m @@ -98,7 +98,7 @@ @implementation RCTCameraRollManager RCTLogWarn(@"Error saving cropped image: %@", saveError); reject(RCTErrorUnableToSave, nil, saveError); } else { - resolve(@[assetURL.absoluteString]); + resolve(assetURL.absoluteString); } }]; }); @@ -110,22 +110,22 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve, BOOL hasNextPage) { if (!assets.count) { - resolve(@[@{ + resolve(@{ @"edges": assets, @"page_info": @{ @"has_next_page": @NO, } - }]); + }); return; } - resolve(@[@{ + resolve(@{ @"edges": assets, @"page_info": @{ @"start_cursor": assets[0][@"node"][@"image"][@"uri"], @"end_cursor": assets[assets.count - 1][@"node"][@"image"][@"uri"], @"has_next_page": @(hasNextPage), } - }]); + }); } RCT_EXPORT_METHOD(getPhotos:(NSDictionary *)params diff --git a/Libraries/LinkingIOS/RCTLinkingManager.m b/Libraries/LinkingIOS/RCTLinkingManager.m index d720631674c939..b8bc364bd8bf25 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.m +++ b/Libraries/LinkingIOS/RCTLinkingManager.m @@ -80,7 +80,7 @@ - (void)handleOpenURLNotification:(NSNotification *)notification // TODO: we should really report success/failure via the promise here // Doesn't really matter what thread we call this on since it exits the app [RCTSharedApplication() openURL:URL]; - resolve(@[@YES]); + resolve(@YES); } RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL @@ -90,13 +90,13 @@ - (void)handleOpenURLNotification:(NSNotification *)notification if (RCTRunningInAppExtension()) { // Technically Today widgets can open urls, but supporting that would require // a reference to the NSExtensionContext - resolve(@[@NO]); + resolve(@NO); return; } // This can be expensive, so we deliberately don't call on main thread BOOL canOpen = [RCTSharedApplication() canOpenURL:URL]; - resolve(@[@(canOpen)]); + resolve(@(canOpen)); } @end diff --git a/Libraries/Utilities/MessageQueue.js b/Libraries/Utilities/MessageQueue.js index 8e58ee06e3c71f..7b31c114914a33 100644 --- a/Libraries/Utilities/MessageQueue.js +++ b/Libraries/Utilities/MessageQueue.js @@ -324,11 +324,7 @@ class MessageQueue { method, args, (data) => { - // iOS always wraps the data in an Array regardless of what the - // shape of the data so we strip it out - // Android sends the data back properly - // TODO: Remove this once iOS has support for Promises natively (t9774697) - resolve(Platform.OS == 'ios' ? data[0] : data); + resolve(data); }, (errorData) => { var error = createErrorFromErrorData(errorData); diff --git a/React/Modules/RCTClipboard.m b/React/Modules/RCTClipboard.m index 0a0bf14816f868..cad23d58b4e6e1 100644 --- a/React/Modules/RCTClipboard.m +++ b/React/Modules/RCTClipboard.m @@ -33,7 +33,7 @@ - (dispatch_queue_t)methodQueue rejecter:(__unused RCTPromiseRejectBlock)reject) { UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; - resolve(@[RCTNullIfNil(clipboard.string)]); + resolve(RCTNullIfNil(clipboard.string)); } @end diff --git a/React/Modules/RCTSourceCode.m b/React/Modules/RCTSourceCode.m index e538fa5d0c9608..f8d96fac68e88d 100644 --- a/React/Modules/RCTSourceCode.m +++ b/React/Modules/RCTSourceCode.m @@ -32,7 +32,7 @@ - (void)setScriptText:(NSString *)scriptText {} if (RCT_DEV && self.scriptData && self.scriptURL) { NSString *scriptText = [[NSString alloc] initWithData:self.scriptData encoding:NSUTF8StringEncoding]; - resolve(@[@{@"text": scriptText, @"url": self.scriptURL.absoluteString}]); + resolve(@{@"text": scriptText, @"url": self.scriptURL.absoluteString}); } else { reject(RCTErrorUnavailable, nil, RCTErrorWithMessage(@"Source code is not available")); } From e6b6aedd86cc20ef153b10c53025118b9ca8b296 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Wed, 10 Feb 2016 15:50:52 +0000 Subject: [PATCH 008/417] new way to update stable website --- Releases.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Releases.md b/Releases.md index 06933c78924eba..b41c73c82d0820 100644 --- a/Releases.md +++ b/Releases.md @@ -34,7 +34,19 @@ Make absolutely sure a basic iOS and Android workflow works on the release branc - Check git history, the last commit should be "[0.19-rc] Bump version numbers" (with the correct version) - `git push origin 0.version_you_are_releasing-stable` - + +#### Update https://facebook.github.io/react-native + +Move `latest` tag when doing a release and pushing to `0.x-stable` branch, CI will build and deploy the +latest docs to the website. + +``` +git tag -d latest +git push origin :latest +git tag latest +git push origin version_you_are_releasing-stable --tags +``` + ## Make sure we have release notes Post that we're ready to release so voluteers can write release notes: From bab48182d94a36f1eb98d475315077f0ee8aeba1 Mon Sep 17 00:00:00 2001 From: Andy Street Date: Wed, 10 Feb 2016 08:13:26 -0800 Subject: [PATCH 009/417] Add Object.getPropertyNames() and Object.toJSONMap APIs Summary: Adds APIs to get all the enumerable property names of an object and to get an object as a map of property names to JSON values. public Reviewed By: lexs Differential Revision: D2916238 fb-gh-sync-id: 0d9ee1eb4886d58fba8241537f6a0dad6024bd0e shipit-source-id: 0d9ee1eb4886d58fba8241537f6a0dad6024bd0e --- ReactAndroid/src/main/jni/react/Value.cpp | 34 +++++++++++++++++++++++ ReactAndroid/src/main/jni/react/Value.h | 6 ++++ 2 files changed, 40 insertions(+) diff --git a/ReactAndroid/src/main/jni/react/Value.cpp b/ReactAndroid/src/main/jni/react/Value.cpp index ac07c486fd5cd4..6c1c393ded7828 100644 --- a/ReactAndroid/src/main/jni/react/Value.cpp +++ b/ReactAndroid/src/main/jni/react/Value.cpp @@ -79,6 +79,16 @@ Value Object::getProperty(const String& propName) const { return Value(m_context, property); } +Value Object::getPropertyAtIndex(unsigned index) const { + JSValueRef exn; + JSValueRef property = JSObjectGetPropertyAtIndex(m_context, m_obj, index, &exn); + if (!property) { + std::string exceptionText = Value(m_context, exn).toString().str(); + throwJSExecutionException("Failed to get property at index %u: %s", index, exceptionText.c_str()); + } + return Value(m_context, property); +} + Value Object::getProperty(const char *propName) const { return getProperty(String(propName)); } @@ -96,6 +106,30 @@ void Object::setProperty(const char *propName, const Value& value) const { setProperty(String(propName), value); } +std::vector Object::getPropertyNames() const { + std::vector names; + auto namesRef = JSObjectCopyPropertyNames(m_context, m_obj); + size_t count = JSPropertyNameArrayGetCount(namesRef); + for (size_t i = 0; i < count; i++) { + auto string = String::ref(JSPropertyNameArrayGetNameAtIndex(namesRef, i)); + names.emplace_back(string.str()); + } + JSPropertyNameArrayRelease(namesRef); + return names; +} + +std::unordered_map Object::toJSONMap() const { + std::unordered_map map; + auto namesRef = JSObjectCopyPropertyNames(m_context, m_obj); + size_t count = JSPropertyNameArrayGetCount(namesRef); + for (size_t i = 0; i < count; i++) { + auto key = String::ref(JSPropertyNameArrayGetNameAtIndex(namesRef, i)); + map.emplace(key.str(), getProperty(key).toJSONString()); + } + JSPropertyNameArrayRelease(namesRef); + return map; +} + /* static */ Object Object::create(JSContextRef ctx) { JSObjectRef newObj = JSObjectMake( diff --git a/ReactAndroid/src/main/jni/react/Value.h b/ReactAndroid/src/main/jni/react/Value.h index 1cee8cc9fd1587..8549c7f1bc4d4f 100644 --- a/ReactAndroid/src/main/jni/react/Value.h +++ b/ReactAndroid/src/main/jni/react/Value.h @@ -4,6 +4,9 @@ #include #include +#include +#include + #include #include #include @@ -123,8 +126,11 @@ class Object : public noncopyable { Value getProperty(const String& propName) const; Value getProperty(const char *propName) const; + Value getPropertyAtIndex(unsigned index) const; void setProperty(const String& propName, const Value& value) const; void setProperty(const char *propName, const Value& value) const; + std::vector getPropertyNames() const; + std::unordered_map toJSONMap() const; void makeProtected() { if (!m_isProtected && m_obj) { From e7005f7f5429422b6f2e9c2aa29c9d57bda7b77a Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Wed, 10 Feb 2016 08:36:15 -0800 Subject: [PATCH 010/417] Fixed missing rows on UIExplorer - Grid Layout example Summary: public I was looking into the missing panels at the bottom of the - Grid Layout example, and found that it was caused by several problems, some in the example and some in ListView itself. The first problem seemed to be a bug in the `_getDistanceFromEnd()` method, which calculates whether the ListView needs to load more content based on the distance of the visible content from the bottom of the scrollview. This was previously using the function Math.max(scrollProperties.contentLength, scrollProperties.visibleLength) - scrollProperties.visibleLength - scrollProperties.offset to calculate the amount the user could scroll before they run out of content. This sort-of works in most cases because `scrollProperties.contentLength` is usually longer than `scrollProperties.visibleLength`, so this would generally evaluate to scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset which meant that it would be positive as long as there was content still to be displayed offscreen, and negative when you reached the end of the content. This logic breaks down if `contentLength` is less than `visibleLength`, however. For example, if you have 300pts of content loaded, and your scrollView is 500pts tall, and your scroll position is zero, this evaluates to Math.max(300, 500) - 500 - 0 = 0 In other words, the algorithm is saying that you have zero pts of scroll content remaining before you need to reload. But actually, the bottom 200pts of the screen are empty, so you're really 200pts in debt, and need to load extra rows to fill that space. The correct algorithm is simply to get rid of the `Math.max` and just use scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset I originally thought that this was the cause of the gap, but it isn't, because ListView has `DEFAULT_SCROLL_RENDER_AHEAD = 1000`, which means that it tries to load at least 1000pts more content than is currently visible, to avoid gaps. This masked the bug, so in practice it wasn't causing an issue. The next problem I found was that there is an implict assumption in ListView that the first page of content you load is sufficient to cover the screen, or rather, that the first _ second page is sufficient. The constants `DEFAULT_INITIAL_ROWS = 10` and `DEFAULT_PAGE_SIZE = 1`, mean that when the ListView first loads, the following happens: 1. It loads 10 rows of content. 2. It checks if `_getDistanceFromEnd() < DEFAULT_SCROLL_RENDER_AHEAD` (1000). 3. If it is, it loads another `DEFAULT_PAGE_SIZE` rows of content, then stops. In the case of the ListView Grid Layout example, this meant that it first loaded 10 cells, then loaded another 1, for a total of 11. The problem was that going from 10 to 11 cells isn't sufficient to fill the visible scroll area, and it doesn't change the `contentSize` (since the cells wrap onto the same line), and since ListView doesn't try to load any more until the `contentSize` or `scrollOffset ` changes, it stops loading new rows at that point. I tried fixing this by calling `_renderMoreRowsIfNeeded()` after `_pageInNewRows()` so that it will continue to fetch new rows until the `_getDistanceFromEnd()` is less than the threshold, rather than stopping after the first page and waiting until the `contentSize` or `scrollOffset` change, but although this solves the problem for the Grid Layout example, it leads to over-fetching in the more common case of a standard row-based ListView. In the end, I just increased the `pageSize` to 3 for the Grid Layout example, which makes more sense anyway since loading a page that is not a multiple of the number of cells per row confuses the `_renderMoreRowsIfNeeded` algorithm, and leads to gaps at the bottom of the view. This solved the problem, however there was still a "pop-in" effect, where the additional rows were paged in after the ListView appeared. This was simply a misconfiguration in the example itself: The default of 10 rows was insufficient to fill the screen, so I changed the `initialListSize` prop to `20`. Reviewed By: javache Differential Revision: D2911690 fb-gh-sync-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3 shipit-source-id: 8d6bd78843335fb091e7e24f7c2e6a416b0321d3 --- Examples/UIExplorer/ListViewGridLayoutExample.js | 3 +++ Examples/UIExplorer/ListViewPagingExample.js | 5 ++--- Libraries/CustomComponents/ListView/ListView.js | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Examples/UIExplorer/ListViewGridLayoutExample.js b/Examples/UIExplorer/ListViewGridLayoutExample.js index ac7d56b8611272..4d8017335d5642 100644 --- a/Examples/UIExplorer/ListViewGridLayoutExample.js +++ b/Examples/UIExplorer/ListViewGridLayoutExample.js @@ -67,6 +67,9 @@ var ListViewGridLayoutExample = React.createClass({ ); diff --git a/Examples/UIExplorer/ListViewPagingExample.js b/Examples/UIExplorer/ListViewPagingExample.js index f6cdcae62aa476..a1406c52ff95ab 100644 --- a/Examples/UIExplorer/ListViewPagingExample.js +++ b/Examples/UIExplorer/ListViewPagingExample.js @@ -32,7 +32,6 @@ var { UIManager, } = NativeModules; -var PAGE_SIZE = 4; var THUMB_URLS = [ require('./Thumbnails/like.png'), require('./Thumbnails/dislike.png'), @@ -182,8 +181,8 @@ var ListViewPagingExample = React.createClass({ renderSectionHeader={this.renderSectionHeader} renderRow={this.renderRow} initialListSize={10} - pageSize={PAGE_SIZE} - scrollRenderAheadDistance={2000} + pageSize={4} + scrollRenderAheadDistance={500} /> ); }, diff --git a/Libraries/CustomComponents/ListView/ListView.js b/Libraries/CustomComponents/ListView/ListView.js index 1a9bef47b3fb33..c10717b5a78255 100644 --- a/Libraries/CustomComponents/ListView/ListView.js +++ b/Libraries/CustomComponents/ListView/ListView.js @@ -147,11 +147,15 @@ var ListView = React.createClass({ */ onEndReached: PropTypes.func, /** - * Threshold in pixels for onEndReached. + * Threshold in pixels (virtual, not physical) for calling onEndReached. */ onEndReachedThreshold: PropTypes.number, /** - * Number of rows to render per event loop. + * Number of rows to render per event loop. Note: if your 'rows' are actually + * cells, i.e. they don't span the full width of your view (as in the + * ListViewGridLayoutExample), you should set the pageSize to be a multiple + * of the number of cells per row, otherwise you're likely to see gaps at + * the edge of the ListView as new pages are loaded. */ pageSize: PropTypes.number, /** @@ -512,11 +516,7 @@ var ListView = React.createClass({ }, _getDistanceFromEnd: function(scrollProperties) { - var maxLength = Math.max( - scrollProperties.contentLength, - scrollProperties.visibleLength - ); - return maxLength - scrollProperties.visibleLength - scrollProperties.offset; + return scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset; }, _updateVisibleRows: function(updatedFrames) { From 197880518b30d6f2b72ff4c86f92ea2982ed8524 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Wed, 10 Feb 2016 08:37:58 -0800 Subject: [PATCH 011/417] Updating the native code to make it match reality. Summary: In the native code, you must use RCTLinkingManager instead of LinkingManager and you have to import it as well. Closes https://github.com/facebook/react-native/pull/5830 Reviewed By: svcscm Differential Revision: D2921718 Pulled By: androidtrunkagent fb-gh-sync-id: a95ec358c69e8830b7f0fb2ec60baefc06139758 shipit-source-id: a95ec358c69e8830b7f0fb2ec60baefc06139758 --- Libraries/Linking/Linking.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index 97282ab663918b..a27e454647b60a 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -53,10 +53,12 @@ const DEVICE_NOTIF_EVENT = 'openURL'; * execution you'll need to add the following lines to you `*AppDelegate.m`: * * ``` + *#import "RCTLinkingManager.h" + * * - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url * sourceApplication:(NSString *)sourceApplication annotation:(id)annotation * { - * return [LinkingManager application:application openURL:url + * return [RCTLinkingManager application:application openURL:url * sourceApplication:sourceApplication annotation:annotation]; * } * @@ -64,7 +66,7 @@ const DEVICE_NOTIF_EVENT = 'openURL'; * - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity * restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler * { - * return [LinkingManager application:application + * return [RCTLinkingManager application:application * continueUserActivity:userActivity * restorationHandler:restorationHandler]; * } From 97741af8b99ea8e443d41b80c4d9a8fd843a96ab Mon Sep 17 00:00:00 2001 From: wusuopu Date: Wed, 10 Feb 2016 08:40:01 -0800 Subject: [PATCH 012/417] Fix warnings of StyleInspector Summary: Fix issue #5831 Closes https://github.com/facebook/react-native/pull/5832 Reviewed By: svcscm Differential Revision: D2917760 Pulled By: vjeux fb-gh-sync-id: 3808d14075b259dd21056a7111205edae1e3eb48 shipit-source-id: 3808d14075b259dd21056a7111205edae1e3eb48 --- Libraries/Inspector/StyleInspector.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Inspector/StyleInspector.js b/Libraries/Inspector/StyleInspector.js index 96d13ad6a74e5f..96db90e8a0763d 100644 --- a/Libraries/Inspector/StyleInspector.js +++ b/Libraries/Inspector/StyleInspector.js @@ -25,13 +25,13 @@ class StyleInspector extends React.Component { return ( - {names.map(name => {name}:)} + {names.map(name => {name}:)} {names.map(name => { var value = typeof this.props.style[name] === 'object' ? JSON.stringify(this.props.style[name]) : this.props.style[name]; - return {value}; + return {value}; } ) } From 189ef95bb609cf60537320dbd523e821fc978b2f Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Wed, 10 Feb 2016 17:13:51 +0000 Subject: [PATCH 013/417] [website] Update 404.js --- website/src/react-native/404.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/react-native/404.js b/website/src/react-native/404.js index 4b1e116ae418bc..fb6bc8d0c542b8 100755 --- a/website/src/react-native/404.js +++ b/website/src/react-native/404.js @@ -22,4 +22,4 @@ var fourOhFour = React.createClass({ } }); -module.exports = fourOhFour; +module.exports = fourOhFour; \ No newline at end of file From ab09ff53d4ceaf1d2ceb11ab99814bca5cfbeceb Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Wed, 10 Feb 2016 17:20:53 +0000 Subject: [PATCH 014/417] [website] Make 404.js line ending match internal --- website/src/react-native/404.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/src/react-native/404.js b/website/src/react-native/404.js index fb6bc8d0c542b8..4b1e116ae418bc 100755 --- a/website/src/react-native/404.js +++ b/website/src/react-native/404.js @@ -22,4 +22,4 @@ var fourOhFour = React.createClass({ } }); -module.exports = fourOhFour; \ No newline at end of file +module.exports = fourOhFour; From d96a4ba94de5171a53150ee55e277abdd9c5b968 Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Wed, 10 Feb 2016 09:25:30 -0800 Subject: [PATCH 015/417] Minor fixes to clipboard and Linking to remove TODOs Reviewed By: nicklockwood Differential Revision: D2921782 fb-gh-sync-id: e387b720421ed6ed03a50633d71e08791f87c761 shipit-source-id: e387b720421ed6ed03a50633d71e08791f87c761 --- Libraries/LinkingIOS/RCTLinkingManager.m | 6 ++---- React/Modules/RCTClipboard.m | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Libraries/LinkingIOS/RCTLinkingManager.m b/Libraries/LinkingIOS/RCTLinkingManager.m index b8bc364bd8bf25..1a30422175b1de 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.m +++ b/Libraries/LinkingIOS/RCTLinkingManager.m @@ -77,10 +77,8 @@ - (void)handleOpenURLNotification:(NSNotification *)notification resolve:(RCTPromiseResolveBlock)resolve reject:(__unused RCTPromiseRejectBlock)reject) { - // TODO: we should really report success/failure via the promise here - // Doesn't really matter what thread we call this on since it exits the app - [RCTSharedApplication() openURL:URL]; - resolve(@YES); + BOOL opened = [RCTSharedApplication() openURL:URL]; + resolve(@(opened)); } RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL diff --git a/React/Modules/RCTClipboard.m b/React/Modules/RCTClipboard.m index cad23d58b4e6e1..8d059c4a374555 100644 --- a/React/Modules/RCTClipboard.m +++ b/React/Modules/RCTClipboard.m @@ -26,14 +26,14 @@ - (dispatch_queue_t)methodQueue RCT_EXPORT_METHOD(setString:(NSString *)content) { UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; - clipboard.string = content; + clipboard.string = (content ? : @""); } RCT_EXPORT_METHOD(getString:(RCTPromiseResolveBlock)resolve rejecter:(__unused RCTPromiseRejectBlock)reject) { UIPasteboard *clipboard = [UIPasteboard generalPasteboard]; - resolve(RCTNullIfNil(clipboard.string)); + resolve((clipboard.string ? : @"")); } @end From f2a60a202fd3dd737a968820c7941686ed1d9ddb Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Wed, 10 Feb 2016 10:40:42 -0800 Subject: [PATCH 016/417] Add 'file://' prefix to sourceURL when loading a script from a file. Reviewed By: svcscm Differential Revision: D2922108 Pulled By: androidtrunkagent fb-gh-sync-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8 shipit-source-id: d9c98af31e844e3fed2f57a3a4250a6ef5e735a8 --- .../main/java/com/facebook/react/bridge/JSBundleLoader.java | 2 +- ReactAndroid/src/main/jni/react/jni/OnLoad.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java index db9fb05df8eb7c..799863b087c4df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java @@ -31,7 +31,7 @@ public void loadScript(ReactBridge bridge) { if (fileName.startsWith("assets://")) { bridge.loadScriptFromAssets(context.getAssets(), fileName.replaceFirst("assets://", "")); } else { - bridge.loadScriptFromFile(fileName, fileName); + bridge.loadScriptFromFile(fileName, "file://" + fileName); } } diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp index 128ef833895441..783b45dd91d651 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp @@ -700,9 +700,9 @@ static void loadScriptFromAssets(JNIEnv* env, jobject obj, jobject assetManager, env->CallStaticVoidMethod(markerClass, gLogMarkerMethod, env->NewStringUTF("loadScriptFromAssets_read")); if (JniJSModulesUnbundle::isUnbundle(manager, assetNameStr)) { - loadApplicationUnbundle(bridge, manager, script, assetNameStr); + loadApplicationUnbundle(bridge, manager, script, "file://" + assetNameStr); } else { - executeApplicationScript(bridge, script, assetNameStr); + executeApplicationScript(bridge, script, "file://" + assetNameStr); } if (env->ExceptionCheck()) { return; From b051d07b819be7ff01ac54106ca7f0f0289d1bd0 Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 10 Feb 2016 12:46:26 -0800 Subject: [PATCH 017/417] Update CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3171208c89d3cb..b5d0c744d1173c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ The core team will be monitoring for pull requests. When we get one, we'll run s *Before* submitting a pull request, please make sure the following is done… 1. Fork the repo and create your branch from `master`. -2. If you've added code that should be tested, add tests! +2. **Describe your test plan in your commit.** If you've added code that should be tested, add tests! 3. If you've changed APIs, update the documentation. 4. Add the copyright notice to the top of any new files you've added. 5. Ensure tests pass on Travis and Circle CI. From 915e5826efba758c42aefeeab69499ddcdd9cf50 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Wed, 10 Feb 2016 12:48:41 -0800 Subject: [PATCH 018/417] Restricted image decoding to 2 simultaneous threads Reviewed By: zjj010104 Differential Revision: D2922292 fb-gh-sync-id: eddd47d02fc721acc1da69e7483c6570997320b5 shipit-source-id: eddd47d02fc721acc1da69e7483c6570997320b5 --- Libraries/Image/RCTImageLoader.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Libraries/Image/RCTImageLoader.m b/Libraries/Image/RCTImageLoader.m index 0d7b06f5c1d578..22bffa4a3d2661 100644 --- a/Libraries/Image/RCTImageLoader.m +++ b/Libraries/Image/RCTImageLoader.m @@ -38,6 +38,7 @@ @implementation RCTImageLoader { NSArray> *_loaders; NSArray> *_decoders; + NSOperationQueue *_imageDecodeQueue; dispatch_queue_t _URLCacheQueue; NSURLCache *_URLCache; } @@ -474,7 +475,13 @@ - (RCTImageLoaderCancellationBlock)decodeImageDataWithoutClipping:(NSData *)data completionHandler:completionHandler]; } else { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + // Serialize decoding to prevent excessive memory usage + if (!_imageDecodeQueue) { + _imageDecodeQueue = [NSOperationQueue new]; + _imageDecodeQueue.name = @"com.facebook.react.ImageDecoderQueue"; + _imageDecodeQueue.maxConcurrentOperationCount = 2; + } + [_imageDecodeQueue addOperationWithBlock:^{ if (cancelled) { return; } @@ -501,7 +508,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageDataWithoutClipping:(NSData *)data NSError *finalError = RCTErrorWithMessage(errorMessage); completionHandler(finalError, nil); } - }); + }]; return ^{ OSAtomicOr32Barrier(1, &cancelled); From eab211b1ecc68c26d227b07800b1c0b328c2fcec Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Wed, 10 Feb 2016 12:50:16 -0800 Subject: [PATCH 019/417] Fix comment in open source MainActivity Reviewed By: mkonicek Differential Revision:D2923275 Ninja: ninja fb-gh-sync-id: 1a6700853a1b292c3ae3dd17f2b3e8ce4a2755cf shipit-source-id: 1a6700853a1b292c3ae3dd17f2b3e8ce4a2755cf --- .../generator-android/templates/package/MainActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/local-cli/generator-android/templates/package/MainActivity.java b/local-cli/generator-android/templates/package/MainActivity.java index 552a4d2a59de9f..283dffc92e17f8 100644 --- a/local-cli/generator-android/templates/package/MainActivity.java +++ b/local-cli/generator-android/templates/package/MainActivity.java @@ -28,9 +28,9 @@ protected boolean getUseDeveloperSupport() { } /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ + * A list of packages used by the app. If the app uses additional views + * or modules besides the default ones, add more packages here. + */ @Override protected List getPackages() { return Arrays.asList( From bf21002f2a7f4541091e04758cd32c97da53c893 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Wed, 10 Feb 2016 13:51:33 -0800 Subject: [PATCH 020/417] =?UTF-8?q?Circle=20CI=20stopped=20working=20with?= =?UTF-8?q?=20Gradle=20properly=20https://circleci.com/g=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: …h/facebook/react-native/2393, this is a fix Closes https://github.com/facebook/react-native/pull/5857 Reviewed By: svcscm Differential Revision: D2923274 Pulled By: androidtrunkagent fb-gh-sync-id: 0f76958fde4639eca0b3f59b85a1443adf8c48d1 shipit-source-id: 0f76958fde4639eca0b3f59b85a1443adf8c48d1 --- circle.yml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/circle.yml b/circle.yml index b0ea6e9902b3d3..7ea22ee0edadea 100644 --- a/circle.yml +++ b/circle.yml @@ -13,23 +13,25 @@ machine: dependencies: pre: - # BUCK - - if [[ ! -e buck ]]; then git clone https://github.com/facebook/buck.git; fi - - cd buck && ant - - buck/bin/buck --version - - buck/bin/buck fetch ReactAndroid/src/test/java/com/facebook/react/modules - - buck/bin/buck fetch ReactAndroid/src/main/java/com/facebook/react - - buck/bin/buck fetch ReactAndroid/src/main/java/com/facebook/react/shell - - buck/bin/buck fetch ReactAndroid/src/test/... - - buck/bin/buck fetch ReactAndroid/src/androidTest/... - # using npm@3 because of problems with shrink-wrapped optional deps installs on linux - - npm install -g npm@3.2 - - source scripts/circle-ci-android-setup.sh && getAndroidSDK - - ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog + # BUCK + - if [[ ! -e buck ]]; then git clone https://github.com/facebook/buck.git; fi + - cd buck && ant + - buck/bin/buck --version + - buck/bin/buck fetch ReactAndroid/src/test/java/com/facebook/react/modules + - buck/bin/buck fetch ReactAndroid/src/main/java/com/facebook/react + - buck/bin/buck fetch ReactAndroid/src/main/java/com/facebook/react/shell + - buck/bin/buck fetch ReactAndroid/src/test/... + - buck/bin/buck fetch ReactAndroid/src/androidTest/... + # using npm@3 because of problems with shrink-wrapped optional deps installs on linux + - npm install -g npm@3.2 + - source scripts/circle-ci-android-setup.sh && getAndroidSDK + - ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog cache_directories: - - "ReactAndroid/build/downloads" - - "buck" - - "buck-out/bin" + - "ReactAndroid/build/downloads" + - "buck" + - "buck-out/bin" + override: + - npm install test: pre: # starting emulator in advance because it takes very long to boot From 98e5e2b4275871b86c1e2c30a3400a331d6b422f Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Thu, 11 Feb 2016 02:20:59 -0800 Subject: [PATCH 021/417] Remove knowledge of fbjs from the packager Summary: As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm. This PR does several things: 1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`. 2. Removes the modules that were previously being used in lieu of their `fbjs` eq Closes https://github.com/facebook/react-native/pull/5084 Reviewed By: bestander Differential Revision: D2803288 Pulled By: davidaurelio fb-gh-sync-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2 shipit-source-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2 --- .flowconfig | 4 - .../__tests__/InteractionManager-test.js | 1 + Libraries/Promise.js | 36 +- Libraries/vendor/core/Map.js | 626 ------------------ Libraries/vendor/core/isEmpty.js | 34 - Libraries/vendor/crypto/crc32.js | 92 --- Libraries/vendor/fbjs/CSSCore.js | 14 + Libraries/vendor/fbjs/Deferred.js | 14 + Libraries/vendor/fbjs/EventListener.js | 14 + Libraries/vendor/fbjs/Map.js | 14 + Libraries/vendor/fbjs/PromiseMap.js | 14 + Libraries/vendor/fbjs/TouchEventUtils.js | 14 + Libraries/vendor/fbjs/URI.js | 14 + Libraries/vendor/fbjs/UserAgent.js | 14 + Libraries/vendor/fbjs/UserAgentData.js | 14 + Libraries/vendor/fbjs/VersionRange.js | 14 + Libraries/vendor/fbjs/areEqual.js | 14 + Libraries/vendor/fbjs/base62.js | 14 + Libraries/vendor/fbjs/camelize.js | 14 + Libraries/vendor/fbjs/camelizeStyleName.js | 14 + Libraries/vendor/fbjs/containsNode.js | 14 + Libraries/vendor/fbjs/crc32.js | 14 + Libraries/vendor/fbjs/createArrayFromMixed.js | 14 + .../vendor/fbjs/createNodesFromMarkup.js | 14 + Libraries/vendor/fbjs/emptyFunction.js | 14 + Libraries/vendor/fbjs/emptyObject.js | 14 + Libraries/vendor/fbjs/everyObject.js | 14 + Libraries/vendor/fbjs/fetchWithRetries.js | 14 + Libraries/vendor/fbjs/filterObject.js | 14 + Libraries/vendor/fbjs/flattenArray.js | 14 + Libraries/vendor/fbjs/focusNode.js | 14 + Libraries/vendor/fbjs/forEachObject.js | 14 + Libraries/vendor/fbjs/getActiveElement.js | 14 + Libraries/vendor/fbjs/getMarkupWrap.js | 14 + .../vendor/fbjs/getUnboundedScrollPosition.js | 14 + Libraries/vendor/fbjs/hyphenate.js | 14 + Libraries/vendor/fbjs/hyphenateStyleName.js | 14 + Libraries/vendor/fbjs/invariant.js | 14 + Libraries/vendor/fbjs/isEmpty.js | 14 + Libraries/vendor/fbjs/isNode.js | 14 + Libraries/vendor/fbjs/isTextNode.js | 14 + Libraries/vendor/fbjs/joinClasses.js | 14 + Libraries/vendor/fbjs/keyMirror.js | 14 + Libraries/vendor/fbjs/keyOf.js | 14 + Libraries/vendor/fbjs/mapObject.js | 14 + Libraries/vendor/fbjs/memoizeStringOnly.js | 14 + Libraries/vendor/fbjs/monitorCodeUse.js | 14 + .../fbjs/nativeRequestAnimationFrame.js | 14 + Libraries/vendor/fbjs/nullthrows.js | 14 + Libraries/vendor/fbjs/performance.js | 14 + Libraries/vendor/fbjs/performanceNow.js | 14 + Libraries/vendor/fbjs/removeFromArray.js | 14 + .../vendor/fbjs/requestAnimationFrame.js | 14 + Libraries/vendor/fbjs/resolveImmediate.js | 14 + Libraries/vendor/fbjs/shallowEqual.js | 14 + Libraries/vendor/fbjs/someObject.js | 14 + Libraries/vendor/fbjs/sprintf.js | 14 + Libraries/vendor/fbjs/warning.js | 14 + .../vendor/fbjs/xhrSimpleDataSerializer.js | 14 + npm-shrinkwrap.json | 169 ++--- package.json | 5 +- packager/blacklist.js | 30 - packager/react-packager/src/Resolver/index.js | 1 - 63 files changed, 848 insertions(+), 892 deletions(-) delete mode 100644 Libraries/vendor/core/Map.js delete mode 100644 Libraries/vendor/core/isEmpty.js delete mode 100644 Libraries/vendor/crypto/crc32.js create mode 100644 Libraries/vendor/fbjs/CSSCore.js create mode 100644 Libraries/vendor/fbjs/Deferred.js create mode 100644 Libraries/vendor/fbjs/EventListener.js create mode 100644 Libraries/vendor/fbjs/Map.js create mode 100644 Libraries/vendor/fbjs/PromiseMap.js create mode 100644 Libraries/vendor/fbjs/TouchEventUtils.js create mode 100644 Libraries/vendor/fbjs/URI.js create mode 100644 Libraries/vendor/fbjs/UserAgent.js create mode 100644 Libraries/vendor/fbjs/UserAgentData.js create mode 100644 Libraries/vendor/fbjs/VersionRange.js create mode 100644 Libraries/vendor/fbjs/areEqual.js create mode 100644 Libraries/vendor/fbjs/base62.js create mode 100644 Libraries/vendor/fbjs/camelize.js create mode 100644 Libraries/vendor/fbjs/camelizeStyleName.js create mode 100644 Libraries/vendor/fbjs/containsNode.js create mode 100644 Libraries/vendor/fbjs/crc32.js create mode 100644 Libraries/vendor/fbjs/createArrayFromMixed.js create mode 100644 Libraries/vendor/fbjs/createNodesFromMarkup.js create mode 100644 Libraries/vendor/fbjs/emptyFunction.js create mode 100644 Libraries/vendor/fbjs/emptyObject.js create mode 100644 Libraries/vendor/fbjs/everyObject.js create mode 100644 Libraries/vendor/fbjs/fetchWithRetries.js create mode 100644 Libraries/vendor/fbjs/filterObject.js create mode 100644 Libraries/vendor/fbjs/flattenArray.js create mode 100644 Libraries/vendor/fbjs/focusNode.js create mode 100644 Libraries/vendor/fbjs/forEachObject.js create mode 100644 Libraries/vendor/fbjs/getActiveElement.js create mode 100644 Libraries/vendor/fbjs/getMarkupWrap.js create mode 100644 Libraries/vendor/fbjs/getUnboundedScrollPosition.js create mode 100644 Libraries/vendor/fbjs/hyphenate.js create mode 100644 Libraries/vendor/fbjs/hyphenateStyleName.js create mode 100644 Libraries/vendor/fbjs/invariant.js create mode 100644 Libraries/vendor/fbjs/isEmpty.js create mode 100644 Libraries/vendor/fbjs/isNode.js create mode 100644 Libraries/vendor/fbjs/isTextNode.js create mode 100644 Libraries/vendor/fbjs/joinClasses.js create mode 100644 Libraries/vendor/fbjs/keyMirror.js create mode 100644 Libraries/vendor/fbjs/keyOf.js create mode 100644 Libraries/vendor/fbjs/mapObject.js create mode 100644 Libraries/vendor/fbjs/memoizeStringOnly.js create mode 100644 Libraries/vendor/fbjs/monitorCodeUse.js create mode 100644 Libraries/vendor/fbjs/nativeRequestAnimationFrame.js create mode 100644 Libraries/vendor/fbjs/nullthrows.js create mode 100644 Libraries/vendor/fbjs/performance.js create mode 100644 Libraries/vendor/fbjs/performanceNow.js create mode 100644 Libraries/vendor/fbjs/removeFromArray.js create mode 100644 Libraries/vendor/fbjs/requestAnimationFrame.js create mode 100644 Libraries/vendor/fbjs/resolveImmediate.js create mode 100644 Libraries/vendor/fbjs/shallowEqual.js create mode 100644 Libraries/vendor/fbjs/someObject.js create mode 100644 Libraries/vendor/fbjs/sprintf.js create mode 100644 Libraries/vendor/fbjs/warning.js create mode 100644 Libraries/vendor/fbjs/xhrSimpleDataSerializer.js diff --git a/.flowconfig b/.flowconfig index 78c0582045e172..026deca0e9c935 100644 --- a/.flowconfig +++ b/.flowconfig @@ -14,12 +14,8 @@ # Ignore react and fbjs where there are overlaps, but don't ignore # anything that react-native relies on -.*/node_modules/fbjs/lib/Map.js -.*/node_modules/fbjs/lib/Promise.js .*/node_modules/fbjs/lib/fetch.js .*/node_modules/fbjs/lib/ExecutionEnvironment.js -.*/node_modules/fbjs/lib/isEmpty.js -.*/node_modules/fbjs/lib/crc32.js .*/node_modules/fbjs/lib/ErrorUtils.js # Flow has a built-in definition for the 'react' module which we prefer to use diff --git a/Libraries/Interaction/__tests__/InteractionManager-test.js b/Libraries/Interaction/__tests__/InteractionManager-test.js index 736fc93c585f64..032acf2555465b 100644 --- a/Libraries/Interaction/__tests__/InteractionManager-test.js +++ b/Libraries/Interaction/__tests__/InteractionManager-test.js @@ -6,6 +6,7 @@ jest .autoMockOff() + .mock('ErrorUtils') .mock('BatchedBridge'); function expectToBeCalledOnce(fn) { diff --git a/Libraries/Promise.js b/Libraries/Promise.js index 004741948e4d14..6484dd176807e1 100644 --- a/Libraries/Promise.js +++ b/Libraries/Promise.js @@ -1,30 +1,18 @@ /** + * Copyright (c) 2016-present, Facebook, Inc. + * All rights reserved. * - * Copyright 2013-2014 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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 Promise - * - * This module wraps and augments the minimally ES6-compliant Promise - * implementation provided by the promise npm package. + * @flow */ - 'use strict'; -global.setImmediate = require('setImmediate'); -var Promise = require('promise/setimmediate/es6-extensions'); -require('promise/setimmediate/done'); +const Promise = require('fbjs/lib/Promise'); // this will require Promise.native.js + if (__DEV__) { require('promise/setimmediate/rejection-tracking').enable({ allRejections: true, @@ -46,12 +34,4 @@ if (__DEV__) { }); } -/** - * Handle either fulfillment or rejection with the same callback. - */ -Promise.prototype.finally = function(onSettled) { - return this.then(onSettled, onSettled); -}; - - module.exports = Promise; diff --git a/Libraries/vendor/core/Map.js b/Libraries/vendor/core/Map.js deleted file mode 100644 index 114add77b308ca..00000000000000 --- a/Libraries/vendor/core/Map.js +++ /dev/null @@ -1,626 +0,0 @@ -/** - * @generated SignedSource<<375749f44ce7c0f681fc1297943eaf74>> - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Copyright 2013-2014 Facebook, Inc. - * @providesModule Map - * @preventMunge - * @typechecks - */ - -var guid = require('guid'); -var isNode = require('isNode'); -var toIterator = require('toIterator'); -var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); - -module.exports = (function(global, undefined) { - // Since our implementation is spec-compliant for the most part we can safely - // delegate to a built-in version if exists and is implemented correctly. - // Firefox had gotten a few implementation details wrong across different - // versions so we guard against that. - if (!_shouldPolyfillES6Collection('Map')) { - return global.Map; - } - - /** - * == ES6 Map Collection == - * - * This module is meant to implement a Map collection as described in chapter - * 23.1 of the ES6 specification. - * - * Map objects are collections of key/value pairs where both the keys and - * values may be arbitrary ECMAScript language values. A distinct key value - * may only occur in one key/value pair within the Map's collection. - * - * https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects - * - * There only two -- rather small -- diviations from the spec: - * - * 1. The use of frozen objects as keys. - * We decided not to allow and simply throw an error. The reason being is - * we store a "hash" on the object for fast access to it's place in the - * internal map entries. - * If this turns out to be a popular use case it's possible to implement by - * overiding `Object.freeze` to store a "hash" property on the object - * for later use with the map. - * - * 2. The `size` property on a map object is a regular property and not a - * computed property on the prototype as described by the spec. - * The reason being is that we simply want to support ES3 environments - * which doesn't implement computed properties. - * - * == Usage == - * - * var map = new Map(iterable); - * - * map.set(key, value); - * map.get(key); // value - * map.has(key); // true - * map.delete(key); // true - * - * var iterator = map.keys(); - * iterator.next(); // {value: key, done: false} - * - * var iterator = map.values(); - * iterator.next(); // {value: value, done: false} - * - * var iterator = map.entries(); - * iterator.next(); // {value: [key, value], done: false} - * - * map.forEach(function(value, key){ this === thisArg }, thisArg); - * - * map.clear(); // resets map. - */ - - /** - * Constants - */ - - // Kinds of map iterations 23.1.5.3 - var KIND_KEY = 'key'; - var KIND_VALUE = 'value'; - var KIND_KEY_VALUE = 'key+value'; - - // In older browsers we can't create a null-prototype object so we have to - // defend against key collisions with built-in methods. - var KEY_PREFIX = '$map_'; - - // This property will be used as the internal size variable to disallow - // writing and to issue warnings for writings in development. - var SECRET_SIZE_PROP; - if (__DEV__) { - SECRET_SIZE_PROP = '$size' + guid(); - } - - // In oldIE we use the DOM Node `uniqueID` property to get create the hash. - var OLD_IE_HASH_PREFIX = 'IE_HASH_'; - - class Map { - - /** - * 23.1.1.1 - * Takes an `iterable` which is basically any object that implements a - * Symbol.iterator (@@iterator) method. The iterable is expected to be a - * collection of pairs. Each pair is a key/value pair that will be used - * to instantiate the map. - * - * @param {*} iterable - */ - constructor(iterable) { - if (!isObject(this)) { - throw new TypeError('Wrong map object type.'); - } - - initMap(this); - - if (iterable != null) { - var it = toIterator(iterable); - var next; - while (!(next = it.next()).done) { - if (!isObject(next.value)) { - throw new TypeError('Expected iterable items to be pair objects.'); - } - this.set(next.value[0], next.value[1]); - } - } - } - - /** - * 23.1.3.1 - * Clears the map from all keys and values. - */ - clear() { - initMap(this); - } - - /** - * 23.1.3.7 - * Check if a key exists in the collection. - * - * @param {*} key - * @return {boolean} - */ - has(key) { - var index = getIndex(this, key); - return !!(index != null && this._mapData[index]); - } - - /** - * 23.1.3.9 - * Adds a key/value pair to the collection. - * - * @param {*} key - * @param {*} value - * @return {map} - */ - set(key, value) { - var index = getIndex(this, key); - - if (index != null && this._mapData[index]) { - this._mapData[index][1] = value; - } else { - index = this._mapData.push([ - key, - value - ]) - 1; - setIndex(this, key, index); - if (__DEV__) { - this[SECRET_SIZE_PROP] += 1; - } else { - this.size += 1; - } - } - - return this; - } - - /** - * 23.1.3.6 - * Gets a value associated with a key in the collection. - * - * @param {*} key - * @return {*} - */ - get(key) { - var index = getIndex(this, key); - if (index == null) { - return undefined; - } else { - return this._mapData[index][1]; - } - } - - - /** - * 23.1.3.3 - * Delete a key/value from the collection. - * - * @param {*} key - * @return {boolean} Whether the key was found and deleted. - */ - delete(key) { - var index = getIndex(this, key); - if (index != null && this._mapData[index]) { - setIndex(this, key, undefined); - this._mapData[index] = undefined; - if (__DEV__) { - this[SECRET_SIZE_PROP] -= 1; - } else { - this.size -= 1; - } - return true; - } else { - return false; - } - } - - /** - * 23.1.3.4 - * Returns an iterator over the key/value pairs (in the form of an Array) in - * the collection. - * - * @return {MapIterator} - */ - entries() { - return new MapIterator(this, KIND_KEY_VALUE); - } - - /** - * 23.1.3.8 - * Returns an iterator over the keys in the collection. - * - * @return {MapIterator} - */ - keys() { - return new MapIterator(this, KIND_KEY); - } - - /** - * 23.1.3.11 - * Returns an iterator over the values pairs in the collection. - * - * @return {MapIterator} - */ - values() { - return new MapIterator(this, KIND_VALUE); - } - - /** - * 23.1.3.5 - * Iterates over the key/value pairs in the collection calling `callback` - * with [value, key, map]. An optional `thisArg` can be passed to set the - * context when `callback` is called. - * - * @param {function} callback - * @param {?object} thisArg - */ - forEach(callback, thisArg) { - if (typeof callback !== 'function') { - throw new TypeError('Callback must be callable.'); - } - - var boundCallback = callback.bind(thisArg || undefined); - var mapData = this._mapData; - - // Note that `mapData.length` should be computed on each iteration to - // support iterating over new items in the map that were added after the - // start of the iteration. - for (var i = 0; i < mapData.length; i++) { - var entry = mapData[i]; - if (entry != null) { - boundCallback(entry[1], entry[0], this); - } - } - } - } - - // 23.1.3.12 - Map.prototype[toIterator.ITERATOR_SYMBOL] = Map.prototype.entries; - - class MapIterator { - - /** - * 23.1.5.1 - * Create a `MapIterator` for a given `map`. While this class is private it - * will create objects that will be passed around publicily. - * - * @param {map} map - * @param {string} kind - */ - constructor(map, kind) { - if (!(isObject(map) && map['_mapData'])) { - throw new TypeError('Object is not a map.'); - } - - if ([KIND_KEY, KIND_KEY_VALUE, KIND_VALUE].indexOf(kind) === -1) { - throw new Error('Invalid iteration kind.'); - } - - this._map = map; - this._nextIndex = 0; - this._kind = kind; - } - - /** - * 23.1.5.2.1 - * Get the next iteration. - * - * @return {object} - */ - next() { - if (!this instanceof Map) { - throw new TypeError('Expected to be called on a MapIterator.'); - } - - var map = this._map; - var index = this._nextIndex; - var kind = this._kind; - - if (map == null) { - return createIterResultObject(undefined, true); - } - - var entries = map['_mapData']; - - while (index < entries.length) { - var record = entries[index]; - - index += 1; - this._nextIndex = index; - - if (record) { - if (kind === KIND_KEY) { - return createIterResultObject(record[0], false); - } else if (kind === KIND_VALUE) { - return createIterResultObject(record[1], false); - } else if (kind) { - return createIterResultObject(record, false); - } - } - } - - this._map = undefined; - - return createIterResultObject(undefined, true); - } - } - - // We can put this in the class definition once we have computed props - // transform. - // 23.1.5.2.2 - MapIterator.prototype[toIterator.ITERATOR_SYMBOL] = function() { - return this; - } - - /** - * Helper Functions. - */ - - /** - * Return an index to map.[[MapData]] array for a given Key. - * - * @param {map} map - * @param {*} key - * @return {?number} - */ - function getIndex(map, key) { - if (isObject(key)) { - var hash = getHash(key); - return map._objectIndex[hash]; - } else { - var prefixedKey = KEY_PREFIX + key; - if (typeof key === 'string') { - return map._stringIndex[prefixedKey]; - } else { - return map._otherIndex[prefixedKey]; - } - } - } - - /** - * Setup an index that refer to the key's location in map.[[MapData]]. - * - * @param {map} map - * @param {*} key - */ - function setIndex(map, key, index) { - var shouldDelete = index == null; - - if (isObject(key)) { - var hash = getHash(key); - if (shouldDelete) { - delete map._objectIndex[hash]; - } else { - map._objectIndex[hash] = index; - } - } else { - var prefixedKey = KEY_PREFIX + key; - if (typeof key === 'string') { - if (shouldDelete) { - delete map._stringIndex[prefixedKey]; - } else { - map._stringIndex[prefixedKey] = index; - } - } else { - if (shouldDelete) { - delete map._otherIndex[prefixedKey]; - } else { - map._otherIndex[prefixedKey] = index; - } - } - } - } - - /** - * Instantiate a map with internal slots. - * - * @param {map} map - */ - function initMap(map) { - // Data structure design inspired by Traceur's Map implementation. - // We maintain an internal array for all the entries. The array is needed - // to remember order. However, to have a reasonable HashMap performance - // i.e. O(1) for insertion, deletion, and retrieval. We maintain indices - // in objects for fast look ups. Indices are split up according to data - // types to avoid collisions. - map._mapData = []; - - // Object index maps from an object "hash" to index. The hash being a unique - // property of our choosing that we associate with the object. Association - // is done by ways of keeping a non-enumerable property on the object. - // Ideally these would be `Object.create(null)` objects but since we're - // trying to support ES3 we'll have to gaurd against collisions using - // prefixes on the keys rather than rely on null prototype objects. - map._objectIndex = {}; - - // String index maps from strings to index. - map._stringIndex = {}; - - // Numbers, booleans, undefined, and null. - map._otherIndex = {}; - - // Unfortunately we have to support ES3 and cannot have `Map.prototype.size` - // be a getter method but just a regular method. The biggest problem with - // this is safety. Clients can change the size property easily and possibly - // without noticing (e.g. `if (map.size = 1) {..}` kind of typo). What we - // can do to mitigate use getters and setters in development to disallow - // and issue a warning for changing the `size` property. - if (__DEV__) { - if (isES5) { - // If the `SECRET_SIZE_PROP` property is already defined then we're not - // in the first call to `initMap` (e.g. coming from `map.clear()`) so - // all we need to do is reset the size without defining the properties. - if (map.hasOwnProperty(SECRET_SIZE_PROP)) { - map[SECRET_SIZE_PROP] = 0; - } else { - Object.defineProperty(map, SECRET_SIZE_PROP, { - value: 0, - writable: true - }); - Object.defineProperty(map, 'size', { - set: (v) => { - console.error( - 'PLEASE FIX ME: You are changing the map size property which ' + - 'should not be writable and will break in production.' - ); - throw new Error('The map size property is not writable.'); - }, - get: () => map[SECRET_SIZE_PROP] - }); - } - - // NOTE: Early return to implement immutable `.size` in DEV. - return; - } - } - - // This is a diviation from the spec. `size` should be a getter on - // `Map.prototype`. However, we have to support IE8. - map.size = 0; - } - - /** - * Check if something is an object. - * - * @param {*} o - * @return {boolean} - */ - function isObject(o) { - return o != null && (typeof o === 'object' || typeof o === 'function'); - } - - /** - * Create an iteration object. - * - * @param {*} value - * @param {boolean} done - * @return {object} - */ - function createIterResultObject(value, done) { - return {value, done}; - } - - // Are we in a legit ES5 environment. Spoiler alert: that doesn't include IE8. - var isES5 = (function() { - try { - Object.defineProperty({}, 'x', {}); - return true; - } catch(e) { - return false; - } - })(); - - /** - * Check if an object can be extended. - * - * @param {object|array|function|regexp} o - * @return {boolean} - */ - function isExtensible(o) { - if (!isES5) { - return true; - } else { - return Object.isExtensible(o); - } - } - - /** - * IE has a `uniqueID` set on every DOM node. So we construct the hash from - * this uniqueID to avoid memory leaks and the IE cloneNode bug where it - * clones properties in addition to the attributes. - * - * @param {object} node - * @return {?string} - */ - function getIENodeHash(node) { - var uniqueID; - switch (node.nodeType) { - case 1: // Element - uniqueID = node.uniqueID; - break; - case 9: // Document - uniqueID = node.documentElement.uniqueID; - break; - default: - return null; - } - - if (uniqueID) { - return OLD_IE_HASH_PREFIX + uniqueID; - } else { - return null; - } - } - - var getHash = (function() { - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - var hashProperty = guid(); - var hashCounter = 0; - - /** - * Get the "hash" associated with an object. - * - * @param {object|array|function|regexp} o - * @return {number} - */ - return function getHash(o) { - if (o[hashProperty]) { - return o[hashProperty]; - } else if (!isES5 && - o.propertyIsEnumerable && - o.propertyIsEnumerable[hashProperty]) { - return o.propertyIsEnumerable[hashProperty]; - } else if (!isES5 && - isNode(o) && - getIENodeHash(o)) { - return getIENodeHash(o); - } else if (!isES5 && o[hashProperty]) { - return o[hashProperty]; - } - - if (isExtensible(o)) { - hashCounter += 1; - if (isES5) { - Object.defineProperty(o, hashProperty, { - enumerable: false, - writable: false, - configurable: false, - value: hashCounter - }); - } else if (o.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Addiotionally, since this is a function it - // will not show up in `JSON.stringify` which is what we want. - o.propertyIsEnumerable = function() { - return propIsEnumerable.apply(this, arguments); - }; - o.propertyIsEnumerable[hashProperty] = hashCounter; - } else if (isNode(o)) { - // At this point we couldn't get the IE `uniqueID` to use as a hash - // and we couldn't use a non-enumerable property to exploit the - // dontEnum bug so we simply add the `hashProperty` on the node - // itself. - o[hashProperty] = hashCounter; - } else { - throw new Error('Unable to set a non-enumerable property on object.'); - } - return hashCounter; - } else { - throw new Error('Non-extensible objects are not allowed as keys.'); - } - }; - })(); - - return Map; -})(/* jslint evil: true */ Function('return this')()); diff --git a/Libraries/vendor/core/isEmpty.js b/Libraries/vendor/core/isEmpty.js deleted file mode 100644 index 27f4c0069a06f7..00000000000000 --- a/Libraries/vendor/core/isEmpty.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @generated SignedSource<<97ffcebc9ae390e734026a4f3964bff6>> - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * @providesModule isEmpty - */ - -/** - * Mimics empty from PHP. - */ -function isEmpty(obj) { - if (Array.isArray(obj)) { - return obj.length === 0; - } else if (typeof obj === 'object') { - for (var i in obj) { - return false; - } - return true; - } else { - return !obj; - } -} - -module.exports = isEmpty; diff --git a/Libraries/vendor/crypto/crc32.js b/Libraries/vendor/crypto/crc32.js deleted file mode 100644 index 540d60aa832b6e..00000000000000 --- a/Libraries/vendor/crypto/crc32.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @generated SignedSource<<77bdeb858138636c96c405d64b6be55c>> - * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !! This file is a check-in of a static_upstream project! !! - * !! !! - * !! You should not modify this file directly. Instead: !! - * !! 1) Use `fjs use-upstream` to temporarily replace this with !! - * !! the latest version from upstream. !! - * !! 2) Make your changes, test them, etc. !! - * !! 3) Use `fjs push-upstream` to copy your changes back to !! - * !! static_upstream. !! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * Copyright 2004-present Facebook. All Rights Reserved. - * - * @providesModule crc32 - */ - -/* jslint bitwise: true */ - -/** - * Modified from the original for performance improvements. - * - * @see http://create.stephan-brumme.com/crc32/ - * @see http://stackoverflow.com/questions/18638900/ - * @copyright 2006 Andrea Ercolino - * @license MIT - */ - -var table = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, - 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, - 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, - 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, - 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, - 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, - 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, - 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, - 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, - 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, - 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, - 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, - 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, - 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, - 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, - 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, - 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, - 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, - 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, - 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, - 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, - 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -]; - -if (global.Int32Array !== undefined) { - table = new Int32Array(table); -} - -/** - * @returns Number - */ -function crc32(str) { - var crc = -1; - for (var i = 0, len = str.length; i < len; i++) { - crc = (crc >>> 8) ^ table[(crc ^ str.charCodeAt(i)) & 0xFF]; - } - return ~crc; -} - -module.exports = crc32; diff --git a/Libraries/vendor/fbjs/CSSCore.js b/Libraries/vendor/fbjs/CSSCore.js new file mode 100644 index 00000000000000..70f72f7677a64a --- /dev/null +++ b/Libraries/vendor/fbjs/CSSCore.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule CSSCore + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/CSSCore'); diff --git a/Libraries/vendor/fbjs/Deferred.js b/Libraries/vendor/fbjs/Deferred.js new file mode 100644 index 00000000000000..88704b83901aab --- /dev/null +++ b/Libraries/vendor/fbjs/Deferred.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule Deferred + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/Deferred'); diff --git a/Libraries/vendor/fbjs/EventListener.js b/Libraries/vendor/fbjs/EventListener.js new file mode 100644 index 00000000000000..ec6041de37dfb3 --- /dev/null +++ b/Libraries/vendor/fbjs/EventListener.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule EventListener + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/EventListener'); diff --git a/Libraries/vendor/fbjs/Map.js b/Libraries/vendor/fbjs/Map.js new file mode 100644 index 00000000000000..4fd97503ba8b58 --- /dev/null +++ b/Libraries/vendor/fbjs/Map.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule Map + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/Map'); diff --git a/Libraries/vendor/fbjs/PromiseMap.js b/Libraries/vendor/fbjs/PromiseMap.js new file mode 100644 index 00000000000000..30891f521c75de --- /dev/null +++ b/Libraries/vendor/fbjs/PromiseMap.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule PromiseMap + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/PromiseMap'); diff --git a/Libraries/vendor/fbjs/TouchEventUtils.js b/Libraries/vendor/fbjs/TouchEventUtils.js new file mode 100644 index 00000000000000..f75be694416499 --- /dev/null +++ b/Libraries/vendor/fbjs/TouchEventUtils.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule TouchEventUtils + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/TouchEventUtils'); diff --git a/Libraries/vendor/fbjs/URI.js b/Libraries/vendor/fbjs/URI.js new file mode 100644 index 00000000000000..72c5650012cf86 --- /dev/null +++ b/Libraries/vendor/fbjs/URI.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule URI + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/URI'); diff --git a/Libraries/vendor/fbjs/UserAgent.js b/Libraries/vendor/fbjs/UserAgent.js new file mode 100644 index 00000000000000..85c2669b8c1a45 --- /dev/null +++ b/Libraries/vendor/fbjs/UserAgent.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule UserAgent + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/UserAgent'); diff --git a/Libraries/vendor/fbjs/UserAgentData.js b/Libraries/vendor/fbjs/UserAgentData.js new file mode 100644 index 00000000000000..13ff6a335caf44 --- /dev/null +++ b/Libraries/vendor/fbjs/UserAgentData.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule UserAgentData + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/UserAgentData'); diff --git a/Libraries/vendor/fbjs/VersionRange.js b/Libraries/vendor/fbjs/VersionRange.js new file mode 100644 index 00000000000000..de55fe18928d28 --- /dev/null +++ b/Libraries/vendor/fbjs/VersionRange.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule VersionRange + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/VersionRange'); diff --git a/Libraries/vendor/fbjs/areEqual.js b/Libraries/vendor/fbjs/areEqual.js new file mode 100644 index 00000000000000..8c020878a20a75 --- /dev/null +++ b/Libraries/vendor/fbjs/areEqual.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule areEqual + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/areEqual'); diff --git a/Libraries/vendor/fbjs/base62.js b/Libraries/vendor/fbjs/base62.js new file mode 100644 index 00000000000000..596b871dcbf695 --- /dev/null +++ b/Libraries/vendor/fbjs/base62.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule base62 + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/base62'); diff --git a/Libraries/vendor/fbjs/camelize.js b/Libraries/vendor/fbjs/camelize.js new file mode 100644 index 00000000000000..356cfefaad1c5b --- /dev/null +++ b/Libraries/vendor/fbjs/camelize.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule camelize + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/camelize'); diff --git a/Libraries/vendor/fbjs/camelizeStyleName.js b/Libraries/vendor/fbjs/camelizeStyleName.js new file mode 100644 index 00000000000000..a92ed2c104d9f9 --- /dev/null +++ b/Libraries/vendor/fbjs/camelizeStyleName.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule camelizeStyleName + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/camelizeStyleName'); diff --git a/Libraries/vendor/fbjs/containsNode.js b/Libraries/vendor/fbjs/containsNode.js new file mode 100644 index 00000000000000..67d65e4f4a748b --- /dev/null +++ b/Libraries/vendor/fbjs/containsNode.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule containsNode + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/containsNode'); diff --git a/Libraries/vendor/fbjs/crc32.js b/Libraries/vendor/fbjs/crc32.js new file mode 100644 index 00000000000000..cb4fba1a20120a --- /dev/null +++ b/Libraries/vendor/fbjs/crc32.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule crc32 + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/crc32'); diff --git a/Libraries/vendor/fbjs/createArrayFromMixed.js b/Libraries/vendor/fbjs/createArrayFromMixed.js new file mode 100644 index 00000000000000..6489c47746cd2b --- /dev/null +++ b/Libraries/vendor/fbjs/createArrayFromMixed.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule createArrayFromMixed + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/createArrayFromMixed'); diff --git a/Libraries/vendor/fbjs/createNodesFromMarkup.js b/Libraries/vendor/fbjs/createNodesFromMarkup.js new file mode 100644 index 00000000000000..fb5899c0ff3d0a --- /dev/null +++ b/Libraries/vendor/fbjs/createNodesFromMarkup.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule createNodesFromMarkup + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/createNodesFromMarkup'); diff --git a/Libraries/vendor/fbjs/emptyFunction.js b/Libraries/vendor/fbjs/emptyFunction.js new file mode 100644 index 00000000000000..ac55c276a163fa --- /dev/null +++ b/Libraries/vendor/fbjs/emptyFunction.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule emptyFunction + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/emptyFunction'); diff --git a/Libraries/vendor/fbjs/emptyObject.js b/Libraries/vendor/fbjs/emptyObject.js new file mode 100644 index 00000000000000..f738081cc0d03b --- /dev/null +++ b/Libraries/vendor/fbjs/emptyObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule emptyObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/emptyObject'); diff --git a/Libraries/vendor/fbjs/everyObject.js b/Libraries/vendor/fbjs/everyObject.js new file mode 100644 index 00000000000000..4fe49e035ad7b0 --- /dev/null +++ b/Libraries/vendor/fbjs/everyObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule everyObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/everyObject'); diff --git a/Libraries/vendor/fbjs/fetchWithRetries.js b/Libraries/vendor/fbjs/fetchWithRetries.js new file mode 100644 index 00000000000000..16d1e1aa98ebf0 --- /dev/null +++ b/Libraries/vendor/fbjs/fetchWithRetries.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule fetchWithRetries + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/fetchWithRetries'); diff --git a/Libraries/vendor/fbjs/filterObject.js b/Libraries/vendor/fbjs/filterObject.js new file mode 100644 index 00000000000000..819e188e4bf50d --- /dev/null +++ b/Libraries/vendor/fbjs/filterObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule filterObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/filterObject'); diff --git a/Libraries/vendor/fbjs/flattenArray.js b/Libraries/vendor/fbjs/flattenArray.js new file mode 100644 index 00000000000000..14f12d6a41ffd8 --- /dev/null +++ b/Libraries/vendor/fbjs/flattenArray.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule flattenArray + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/flattenArray'); diff --git a/Libraries/vendor/fbjs/focusNode.js b/Libraries/vendor/fbjs/focusNode.js new file mode 100644 index 00000000000000..91df968db9e018 --- /dev/null +++ b/Libraries/vendor/fbjs/focusNode.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule focusNode + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/focusNode'); diff --git a/Libraries/vendor/fbjs/forEachObject.js b/Libraries/vendor/fbjs/forEachObject.js new file mode 100644 index 00000000000000..1e5b39f29f293a --- /dev/null +++ b/Libraries/vendor/fbjs/forEachObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule forEachObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/forEachObject'); diff --git a/Libraries/vendor/fbjs/getActiveElement.js b/Libraries/vendor/fbjs/getActiveElement.js new file mode 100644 index 00000000000000..cb597c5a27830c --- /dev/null +++ b/Libraries/vendor/fbjs/getActiveElement.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule getActiveElement + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/getActiveElement'); diff --git a/Libraries/vendor/fbjs/getMarkupWrap.js b/Libraries/vendor/fbjs/getMarkupWrap.js new file mode 100644 index 00000000000000..8673d463022599 --- /dev/null +++ b/Libraries/vendor/fbjs/getMarkupWrap.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule getMarkupWrap + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/getMarkupWrap'); diff --git a/Libraries/vendor/fbjs/getUnboundedScrollPosition.js b/Libraries/vendor/fbjs/getUnboundedScrollPosition.js new file mode 100644 index 00000000000000..a72586ef406349 --- /dev/null +++ b/Libraries/vendor/fbjs/getUnboundedScrollPosition.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule getUnboundedScrollPosition + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/getUnboundedScrollPosition'); diff --git a/Libraries/vendor/fbjs/hyphenate.js b/Libraries/vendor/fbjs/hyphenate.js new file mode 100644 index 00000000000000..00cec2c76b635d --- /dev/null +++ b/Libraries/vendor/fbjs/hyphenate.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule hyphenate + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/hyphenate'); diff --git a/Libraries/vendor/fbjs/hyphenateStyleName.js b/Libraries/vendor/fbjs/hyphenateStyleName.js new file mode 100644 index 00000000000000..b1349ea097d183 --- /dev/null +++ b/Libraries/vendor/fbjs/hyphenateStyleName.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule hyphenateStyleName + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/hyphenateStyleName'); diff --git a/Libraries/vendor/fbjs/invariant.js b/Libraries/vendor/fbjs/invariant.js new file mode 100644 index 00000000000000..1a19702441d806 --- /dev/null +++ b/Libraries/vendor/fbjs/invariant.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule invariant + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/invariant'); diff --git a/Libraries/vendor/fbjs/isEmpty.js b/Libraries/vendor/fbjs/isEmpty.js new file mode 100644 index 00000000000000..3d9ae58e99ecd4 --- /dev/null +++ b/Libraries/vendor/fbjs/isEmpty.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule isEmpty + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/isEmpty'); diff --git a/Libraries/vendor/fbjs/isNode.js b/Libraries/vendor/fbjs/isNode.js new file mode 100644 index 00000000000000..d99b32dad5076e --- /dev/null +++ b/Libraries/vendor/fbjs/isNode.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule isNode + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/isNode'); diff --git a/Libraries/vendor/fbjs/isTextNode.js b/Libraries/vendor/fbjs/isTextNode.js new file mode 100644 index 00000000000000..7b39b169863c77 --- /dev/null +++ b/Libraries/vendor/fbjs/isTextNode.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule isTextNode + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/isTextNode'); diff --git a/Libraries/vendor/fbjs/joinClasses.js b/Libraries/vendor/fbjs/joinClasses.js new file mode 100644 index 00000000000000..8e7908a9d0d148 --- /dev/null +++ b/Libraries/vendor/fbjs/joinClasses.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule joinClasses + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/joinClasses'); diff --git a/Libraries/vendor/fbjs/keyMirror.js b/Libraries/vendor/fbjs/keyMirror.js new file mode 100644 index 00000000000000..021b3405206c49 --- /dev/null +++ b/Libraries/vendor/fbjs/keyMirror.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule keyMirror + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/keyMirror'); diff --git a/Libraries/vendor/fbjs/keyOf.js b/Libraries/vendor/fbjs/keyOf.js new file mode 100644 index 00000000000000..646040a5718691 --- /dev/null +++ b/Libraries/vendor/fbjs/keyOf.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule keyOf + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/keyOf'); diff --git a/Libraries/vendor/fbjs/mapObject.js b/Libraries/vendor/fbjs/mapObject.js new file mode 100644 index 00000000000000..a74e35737cc167 --- /dev/null +++ b/Libraries/vendor/fbjs/mapObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule mapObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/mapObject'); diff --git a/Libraries/vendor/fbjs/memoizeStringOnly.js b/Libraries/vendor/fbjs/memoizeStringOnly.js new file mode 100644 index 00000000000000..36d4d31458f950 --- /dev/null +++ b/Libraries/vendor/fbjs/memoizeStringOnly.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule memoizeStringOnly + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/memoizeStringOnly'); diff --git a/Libraries/vendor/fbjs/monitorCodeUse.js b/Libraries/vendor/fbjs/monitorCodeUse.js new file mode 100644 index 00000000000000..c06614c17d2b75 --- /dev/null +++ b/Libraries/vendor/fbjs/monitorCodeUse.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule monitorCodeUse + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/monitorCodeUse'); diff --git a/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js b/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js new file mode 100644 index 00000000000000..5ff2ba2a85becd --- /dev/null +++ b/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule nativeRequestAnimationFrame + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/nativeRequestAnimationFrame'); diff --git a/Libraries/vendor/fbjs/nullthrows.js b/Libraries/vendor/fbjs/nullthrows.js new file mode 100644 index 00000000000000..5de73280dbf0cc --- /dev/null +++ b/Libraries/vendor/fbjs/nullthrows.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule nullthrows + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/nullthrows'); diff --git a/Libraries/vendor/fbjs/performance.js b/Libraries/vendor/fbjs/performance.js new file mode 100644 index 00000000000000..eab35d18d69e92 --- /dev/null +++ b/Libraries/vendor/fbjs/performance.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule performance + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/performance'); diff --git a/Libraries/vendor/fbjs/performanceNow.js b/Libraries/vendor/fbjs/performanceNow.js new file mode 100644 index 00000000000000..fa0c50535c1168 --- /dev/null +++ b/Libraries/vendor/fbjs/performanceNow.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule performanceNow + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/performanceNow'); diff --git a/Libraries/vendor/fbjs/removeFromArray.js b/Libraries/vendor/fbjs/removeFromArray.js new file mode 100644 index 00000000000000..0af09ec367922b --- /dev/null +++ b/Libraries/vendor/fbjs/removeFromArray.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule removeFromArray + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/removeFromArray'); diff --git a/Libraries/vendor/fbjs/requestAnimationFrame.js b/Libraries/vendor/fbjs/requestAnimationFrame.js new file mode 100644 index 00000000000000..1671e27ef1f251 --- /dev/null +++ b/Libraries/vendor/fbjs/requestAnimationFrame.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule requestAnimationFrame + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/requestAnimationFrame'); diff --git a/Libraries/vendor/fbjs/resolveImmediate.js b/Libraries/vendor/fbjs/resolveImmediate.js new file mode 100644 index 00000000000000..e587c24dada352 --- /dev/null +++ b/Libraries/vendor/fbjs/resolveImmediate.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule resolveImmediate + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/resolveImmediate'); diff --git a/Libraries/vendor/fbjs/shallowEqual.js b/Libraries/vendor/fbjs/shallowEqual.js new file mode 100644 index 00000000000000..065a3e68200293 --- /dev/null +++ b/Libraries/vendor/fbjs/shallowEqual.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule shallowEqual + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/shallowEqual'); diff --git a/Libraries/vendor/fbjs/someObject.js b/Libraries/vendor/fbjs/someObject.js new file mode 100644 index 00000000000000..edd2cdd7b1d7f4 --- /dev/null +++ b/Libraries/vendor/fbjs/someObject.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule someObject + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/someObject'); diff --git a/Libraries/vendor/fbjs/sprintf.js b/Libraries/vendor/fbjs/sprintf.js new file mode 100644 index 00000000000000..f4140fc06400c1 --- /dev/null +++ b/Libraries/vendor/fbjs/sprintf.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule sprintf + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/sprintf'); diff --git a/Libraries/vendor/fbjs/warning.js b/Libraries/vendor/fbjs/warning.js new file mode 100644 index 00000000000000..7ae0cdf81b8e88 --- /dev/null +++ b/Libraries/vendor/fbjs/warning.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule warning + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/warning'); diff --git a/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js b/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js new file mode 100644 index 00000000000000..d0d9b2c60c5253 --- /dev/null +++ b/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js @@ -0,0 +1,14 @@ +/** + * Copyright (c) 2016-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. + * + * @providesModule xhrSimpleDataSerializer + * @flow + */ +'use strict'; + +module.exports = require('fbjs/lib/xhrSimpleDataSerializer'); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index dc7c0be87142f9..9826948e1dcac7 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -142,15 +142,15 @@ "from": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz" }, - "recast": { - "version": "0.10.33", - "from": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz" - }, "regenerator": { "version": "0.8.40", "from": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz" + }, + "recast": { + "version": "0.10.33", + "from": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz" } } }, @@ -1815,19 +1815,21 @@ "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.1.0.tgz" }, "fbjs": { - "version": "0.6.0", - "from": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.0.tgz", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.0.tgz", + "version": "0.7.2", + "from": "fbjs@0.7.2", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.7.2.tgz", "dependencies": { - "ua-parser-js": { - "version": "0.7.10", - "from": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz" - }, - "whatwg-fetch": { - "version": "0.9.0", - "from": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz" + "isomorphic-fetch": { + "version": "2.2.1", + "from": "isomorphic-fetch@>=2.1.1 <3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "dependencies": { + "whatwg-fetch": { + "version": "0.11.0", + "from": "whatwg-fetch@>=0.10.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.11.0.tgz" + } + } } } }, @@ -1915,16 +1917,16 @@ "from": "are-we-there-yet@~1.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz" }, - "asn1": { - "version": "0.1.11", - "from": "asn1@0.1.11", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz" - }, "assert-plus": { "version": "0.1.5", "from": "assert-plus@^0.1.5", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz" }, + "asn1": { + "version": "0.1.11", + "from": "asn1@0.1.11", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz" + }, "async": { "version": "1.5.0", "from": "async@^1.4.0", @@ -1950,6 +1952,11 @@ "from": "boom@^2.8.x", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz" }, + "caseless": { + "version": "0.11.0", + "from": "caseless@~0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz" + }, "brace-expansion": { "version": "1.1.1", "from": "brace-expansion@>=1.0.0 <2.0.0", @@ -1960,11 +1967,6 @@ "from": "chalk@^1.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz" }, - "caseless": { - "version": "0.11.0", - "from": "caseless@~0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz" - }, "combined-stream": { "version": "1.0.5", "from": "combined-stream@~1.0.5", @@ -2065,36 +2067,36 @@ "from": "graceful-readlink@>= 1.0.0", "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" }, - "has-ansi": { - "version": "2.0.0", - "from": "has-ansi@^2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" - }, "har-validator": { "version": "2.0.2", "from": "har-validator@~2.0.2", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz" }, - "has-unicode": { - "version": "1.0.1", - "from": "has-unicode@^1.0.0", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.1.tgz" + "has-ansi": { + "version": "2.0.0", + "from": "has-ansi@^2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" }, "hawk": { "version": "3.1.0", "from": "hawk@~3.1.0", "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz" }, - "hoek": { - "version": "2.16.3", - "from": "hoek@2.x.x", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + "has-unicode": { + "version": "1.0.1", + "from": "has-unicode@^1.0.0", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.1.tgz" }, "http-signature": { "version": "0.11.0", "from": "http-signature@~0.11.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz" }, + "hoek": { + "version": "2.16.3", + "from": "hoek@2.x.x", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + }, "inherits": { "version": "2.0.1", "from": "inherits@*", @@ -2120,31 +2122,31 @@ "from": "isarray@0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, - "isstream": { - "version": "0.1.2", - "from": "isstream@~0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" - }, "json-stringify-safe": { "version": "5.0.1", "from": "json-stringify-safe@~5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" }, + "isstream": { + "version": "0.1.2", + "from": "isstream@~0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" + }, "jsonpointer": { "version": "2.0.0", "from": "jsonpointer@2.0.0", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz" }, - "lodash._basetostring": { - "version": "3.0.1", - "from": "lodash._basetostring@^3.0.0", - "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz" - }, "lodash._createpadding": { "version": "3.6.1", "from": "lodash._createpadding@^3.0.0", "resolved": "https://registry.npmjs.org/lodash._createpadding/-/lodash._createpadding-3.6.1.tgz" }, + "lodash._basetostring": { + "version": "3.0.1", + "from": "lodash._basetostring@^3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz" + }, "lodash.pad": { "version": "3.1.1", "from": "lodash.pad@^3.0.0", @@ -2210,16 +2212,16 @@ "from": "path-is-absolute@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" }, - "pinkie": { - "version": "1.0.0", - "from": "pinkie@^1.0.0", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz" - }, "pinkie-promise": { "version": "1.0.0", "from": "pinkie-promise@^1.0.0", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz" }, + "pinkie": { + "version": "1.0.0", + "from": "pinkie@^1.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz" + }, "qs": { "version": "5.2.0", "from": "qs@~5.2.0", @@ -2235,16 +2237,16 @@ "from": "request@2.x", "resolved": "https://registry.npmjs.org/request/-/request-2.65.0.tgz" }, - "sntp": { - "version": "1.0.9", - "from": "sntp@1.x.x", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz" - }, "semver": { "version": "5.0.3", "from": "semver@~5.0.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz" }, + "sntp": { + "version": "1.0.9", + "from": "sntp@1.x.x", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz" + }, "string_decoder": { "version": "0.10.31", "from": "string_decoder@~0.10.x", @@ -2255,21 +2257,16 @@ "from": "stringstream@~0.0.4", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" }, - "strip-ansi": { - "version": "3.0.0", - "from": "strip-ansi@^3.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz" - }, - "supports-color": { - "version": "2.0.0", - "from": "supports-color@^2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" - }, "strip-json-comments": { "version": "0.1.3", "from": "strip-json-comments@0.1.x", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz" }, + "strip-ansi": { + "version": "3.0.0", + "from": "strip-ansi@^3.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz" + }, "tar": { "version": "2.2.1", "from": "tar@~2.2.0", @@ -2280,6 +2277,11 @@ "from": "tough-cookie@~2.2.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgz" }, + "supports-color": { + "version": "2.0.0", + "from": "supports-color@^2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + }, "tunnel-agent": { "version": "0.4.1", "from": "tunnel-agent@~0.4.1", @@ -2344,15 +2346,15 @@ "from": "glob@>=5.0.14 <6.0.0", "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" }, - "minimatch": { - "version": "3.0.0", - "from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" - }, "once": { "version": "1.3.2", "from": "once@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz" + }, + "minimatch": { + "version": "3.0.0", + "from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" } } }, @@ -4058,6 +4060,18 @@ } } } + }, + "fbjs": { + "version": "0.6.1", + "from": "fbjs@>=0.6.0 <0.7.0", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.1.tgz", + "dependencies": { + "whatwg-fetch": { + "version": "0.9.0", + "from": "whatwg-fetch@>=0.9.0 <0.10.0", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz" + } + } } } }, @@ -4544,6 +4558,11 @@ "from": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz" }, + "ua-parser-js": { + "version": "0.7.10", + "from": "ua-parser-js@>=0.7.9 <0.8.0", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz" + }, "uglify-js": { "version": "2.4.24", "from": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.24.tgz", diff --git a/package.json b/package.json index 8e606d2fc6b544..eb0789b0164ec9 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,8 @@ ], "unmockedModulePathPatterns": [ "promise", - "source-map" + "source-map", + "fbjs" ] }, "main": "Libraries/react-native/react-native.js", @@ -121,7 +122,7 @@ "connect": "^2.8.3", "debug": "^2.2.0", "event-target-shim": "^1.0.5", - "fbjs": "^0.6.0", + "fbjs": "^0.7.2", "fbjs-scripts": "^0.4.0", "graceful-fs": "^4.1.2", "image-size": "^0.3.5", diff --git a/packager/blacklist.js b/packager/blacklist.js index ee369e1af7266d..318e09e88ee8f8 100644 --- a/packager/blacklist.js +++ b/packager/blacklist.js @@ -17,36 +17,6 @@ var sharedBlacklist = [ 'node_modules/react/lib/React.js', 'node_modules/react/lib/ReactDOM.js', - // For each of these fbjs files (especially the non-forks/stubs), we should - // consider deleting the conflicting copy and just using the fbjs version. - // - // fbjs forks: - 'node_modules/fbjs/lib/Map.js', - 'node_modules/fbjs/lib/Promise.js', - 'node_modules/fbjs/lib/fetch.js', - // fbjs stubs: - 'node_modules/fbjs/lib/ErrorUtils.js', - 'node_modules/fbjs/lib/URI.js', - // fbjs modules: - 'node_modules/fbjs/lib/Deferred.js', - 'node_modules/fbjs/lib/PromiseMap.js', - 'node_modules/fbjs/lib/UserAgent.js', - 'node_modules/fbjs/lib/areEqual.js', - 'node_modules/fbjs/lib/base62.js', - 'node_modules/fbjs/lib/crc32.js', - 'node_modules/fbjs/lib/everyObject.js', - 'node_modules/fbjs/lib/fetchWithRetries.js', - 'node_modules/fbjs/lib/filterObject.js', - 'node_modules/fbjs/lib/flattenArray.js', - 'node_modules/fbjs/lib/forEachObject.js', - 'node_modules/fbjs/lib/isEmpty.js', - 'node_modules/fbjs/lib/nullthrows.js', - 'node_modules/fbjs/lib/removeFromArray.js', - 'node_modules/fbjs/lib/resolveImmediate.js', - 'node_modules/fbjs/lib/someObject.js', - 'node_modules/fbjs/lib/sprintf.js', - 'node_modules/fbjs/lib/xhrSimpleDataSerializer.js', - // Those conflicts with the ones in fbjs/. We need to blacklist the // internal version otherwise they won't work in open source. 'downstream/core/CSSCore.js', diff --git a/packager/react-packager/src/Resolver/index.js b/packager/react-packager/src/Resolver/index.js index a677c2199da867..10e138c8b96109 100644 --- a/packager/react-packager/src/Resolver/index.js +++ b/packager/react-packager/src/Resolver/index.js @@ -85,7 +85,6 @@ class Resolver { (opts.blacklistRE && opts.blacklistRE.test(filepath)); }, providesModuleNodeModules: [ - 'fbjs', 'react', 'react-native', // Parse requires AsyncStorage. They will From 28116ec3dbfc410d74d6a01c76068d9b62582d7a Mon Sep 17 00:00:00 2001 From: Adam Miskiewicz Date: Thu, 11 Feb 2016 02:44:24 -0800 Subject: [PATCH 022/417] Reverted commit D2803288 Summary: As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm. This PR does several things: 1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`. 2. Removes the modules that were previously being used in lieu of their `fbjs` eq Closes https://github.com/facebook/react-native/pull/5084 Reviewed By: bestander Differential Revision: D2803288 Pulled By: javache fb-gh-sync-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1 shipit-source-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1 --- .flowconfig | 4 + .../__tests__/InteractionManager-test.js | 1 - Libraries/Promise.js | 36 +- Libraries/vendor/core/Map.js | 626 ++++++++++++++++++ Libraries/vendor/core/isEmpty.js | 34 + Libraries/vendor/crypto/crc32.js | 92 +++ Libraries/vendor/fbjs/CSSCore.js | 14 - Libraries/vendor/fbjs/Deferred.js | 14 - Libraries/vendor/fbjs/EventListener.js | 14 - Libraries/vendor/fbjs/Map.js | 14 - Libraries/vendor/fbjs/PromiseMap.js | 14 - Libraries/vendor/fbjs/TouchEventUtils.js | 14 - Libraries/vendor/fbjs/URI.js | 14 - Libraries/vendor/fbjs/UserAgent.js | 14 - Libraries/vendor/fbjs/UserAgentData.js | 14 - Libraries/vendor/fbjs/VersionRange.js | 14 - Libraries/vendor/fbjs/areEqual.js | 14 - Libraries/vendor/fbjs/base62.js | 14 - Libraries/vendor/fbjs/camelize.js | 14 - Libraries/vendor/fbjs/camelizeStyleName.js | 14 - Libraries/vendor/fbjs/containsNode.js | 14 - Libraries/vendor/fbjs/crc32.js | 14 - Libraries/vendor/fbjs/createArrayFromMixed.js | 14 - .../vendor/fbjs/createNodesFromMarkup.js | 14 - Libraries/vendor/fbjs/emptyFunction.js | 14 - Libraries/vendor/fbjs/emptyObject.js | 14 - Libraries/vendor/fbjs/everyObject.js | 14 - Libraries/vendor/fbjs/fetchWithRetries.js | 14 - Libraries/vendor/fbjs/filterObject.js | 14 - Libraries/vendor/fbjs/flattenArray.js | 14 - Libraries/vendor/fbjs/focusNode.js | 14 - Libraries/vendor/fbjs/forEachObject.js | 14 - Libraries/vendor/fbjs/getActiveElement.js | 14 - Libraries/vendor/fbjs/getMarkupWrap.js | 14 - .../vendor/fbjs/getUnboundedScrollPosition.js | 14 - Libraries/vendor/fbjs/hyphenate.js | 14 - Libraries/vendor/fbjs/hyphenateStyleName.js | 14 - Libraries/vendor/fbjs/invariant.js | 14 - Libraries/vendor/fbjs/isEmpty.js | 14 - Libraries/vendor/fbjs/isNode.js | 14 - Libraries/vendor/fbjs/isTextNode.js | 14 - Libraries/vendor/fbjs/joinClasses.js | 14 - Libraries/vendor/fbjs/keyMirror.js | 14 - Libraries/vendor/fbjs/keyOf.js | 14 - Libraries/vendor/fbjs/mapObject.js | 14 - Libraries/vendor/fbjs/memoizeStringOnly.js | 14 - Libraries/vendor/fbjs/monitorCodeUse.js | 14 - .../fbjs/nativeRequestAnimationFrame.js | 14 - Libraries/vendor/fbjs/nullthrows.js | 14 - Libraries/vendor/fbjs/performance.js | 14 - Libraries/vendor/fbjs/performanceNow.js | 14 - Libraries/vendor/fbjs/removeFromArray.js | 14 - .../vendor/fbjs/requestAnimationFrame.js | 14 - Libraries/vendor/fbjs/resolveImmediate.js | 14 - Libraries/vendor/fbjs/shallowEqual.js | 14 - Libraries/vendor/fbjs/someObject.js | 14 - Libraries/vendor/fbjs/sprintf.js | 14 - Libraries/vendor/fbjs/warning.js | 14 - .../vendor/fbjs/xhrSimpleDataSerializer.js | 14 - npm-shrinkwrap.json | 169 +++-- package.json | 5 +- packager/blacklist.js | 30 + packager/react-packager/src/Resolver/index.js | 1 + 63 files changed, 892 insertions(+), 848 deletions(-) create mode 100644 Libraries/vendor/core/Map.js create mode 100644 Libraries/vendor/core/isEmpty.js create mode 100644 Libraries/vendor/crypto/crc32.js delete mode 100644 Libraries/vendor/fbjs/CSSCore.js delete mode 100644 Libraries/vendor/fbjs/Deferred.js delete mode 100644 Libraries/vendor/fbjs/EventListener.js delete mode 100644 Libraries/vendor/fbjs/Map.js delete mode 100644 Libraries/vendor/fbjs/PromiseMap.js delete mode 100644 Libraries/vendor/fbjs/TouchEventUtils.js delete mode 100644 Libraries/vendor/fbjs/URI.js delete mode 100644 Libraries/vendor/fbjs/UserAgent.js delete mode 100644 Libraries/vendor/fbjs/UserAgentData.js delete mode 100644 Libraries/vendor/fbjs/VersionRange.js delete mode 100644 Libraries/vendor/fbjs/areEqual.js delete mode 100644 Libraries/vendor/fbjs/base62.js delete mode 100644 Libraries/vendor/fbjs/camelize.js delete mode 100644 Libraries/vendor/fbjs/camelizeStyleName.js delete mode 100644 Libraries/vendor/fbjs/containsNode.js delete mode 100644 Libraries/vendor/fbjs/crc32.js delete mode 100644 Libraries/vendor/fbjs/createArrayFromMixed.js delete mode 100644 Libraries/vendor/fbjs/createNodesFromMarkup.js delete mode 100644 Libraries/vendor/fbjs/emptyFunction.js delete mode 100644 Libraries/vendor/fbjs/emptyObject.js delete mode 100644 Libraries/vendor/fbjs/everyObject.js delete mode 100644 Libraries/vendor/fbjs/fetchWithRetries.js delete mode 100644 Libraries/vendor/fbjs/filterObject.js delete mode 100644 Libraries/vendor/fbjs/flattenArray.js delete mode 100644 Libraries/vendor/fbjs/focusNode.js delete mode 100644 Libraries/vendor/fbjs/forEachObject.js delete mode 100644 Libraries/vendor/fbjs/getActiveElement.js delete mode 100644 Libraries/vendor/fbjs/getMarkupWrap.js delete mode 100644 Libraries/vendor/fbjs/getUnboundedScrollPosition.js delete mode 100644 Libraries/vendor/fbjs/hyphenate.js delete mode 100644 Libraries/vendor/fbjs/hyphenateStyleName.js delete mode 100644 Libraries/vendor/fbjs/invariant.js delete mode 100644 Libraries/vendor/fbjs/isEmpty.js delete mode 100644 Libraries/vendor/fbjs/isNode.js delete mode 100644 Libraries/vendor/fbjs/isTextNode.js delete mode 100644 Libraries/vendor/fbjs/joinClasses.js delete mode 100644 Libraries/vendor/fbjs/keyMirror.js delete mode 100644 Libraries/vendor/fbjs/keyOf.js delete mode 100644 Libraries/vendor/fbjs/mapObject.js delete mode 100644 Libraries/vendor/fbjs/memoizeStringOnly.js delete mode 100644 Libraries/vendor/fbjs/monitorCodeUse.js delete mode 100644 Libraries/vendor/fbjs/nativeRequestAnimationFrame.js delete mode 100644 Libraries/vendor/fbjs/nullthrows.js delete mode 100644 Libraries/vendor/fbjs/performance.js delete mode 100644 Libraries/vendor/fbjs/performanceNow.js delete mode 100644 Libraries/vendor/fbjs/removeFromArray.js delete mode 100644 Libraries/vendor/fbjs/requestAnimationFrame.js delete mode 100644 Libraries/vendor/fbjs/resolveImmediate.js delete mode 100644 Libraries/vendor/fbjs/shallowEqual.js delete mode 100644 Libraries/vendor/fbjs/someObject.js delete mode 100644 Libraries/vendor/fbjs/sprintf.js delete mode 100644 Libraries/vendor/fbjs/warning.js delete mode 100644 Libraries/vendor/fbjs/xhrSimpleDataSerializer.js diff --git a/.flowconfig b/.flowconfig index 026deca0e9c935..78c0582045e172 100644 --- a/.flowconfig +++ b/.flowconfig @@ -14,8 +14,12 @@ # Ignore react and fbjs where there are overlaps, but don't ignore # anything that react-native relies on +.*/node_modules/fbjs/lib/Map.js +.*/node_modules/fbjs/lib/Promise.js .*/node_modules/fbjs/lib/fetch.js .*/node_modules/fbjs/lib/ExecutionEnvironment.js +.*/node_modules/fbjs/lib/isEmpty.js +.*/node_modules/fbjs/lib/crc32.js .*/node_modules/fbjs/lib/ErrorUtils.js # Flow has a built-in definition for the 'react' module which we prefer to use diff --git a/Libraries/Interaction/__tests__/InteractionManager-test.js b/Libraries/Interaction/__tests__/InteractionManager-test.js index 032acf2555465b..736fc93c585f64 100644 --- a/Libraries/Interaction/__tests__/InteractionManager-test.js +++ b/Libraries/Interaction/__tests__/InteractionManager-test.js @@ -6,7 +6,6 @@ jest .autoMockOff() - .mock('ErrorUtils') .mock('BatchedBridge'); function expectToBeCalledOnce(fn) { diff --git a/Libraries/Promise.js b/Libraries/Promise.js index 6484dd176807e1..004741948e4d14 100644 --- a/Libraries/Promise.js +++ b/Libraries/Promise.js @@ -1,18 +1,30 @@ /** - * Copyright (c) 2016-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. + * Copyright 2013-2014 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * * @providesModule Promise - * @flow + * + * This module wraps and augments the minimally ES6-compliant Promise + * implementation provided by the promise npm package. */ -'use strict'; -const Promise = require('fbjs/lib/Promise'); // this will require Promise.native.js +'use strict'; +global.setImmediate = require('setImmediate'); +var Promise = require('promise/setimmediate/es6-extensions'); +require('promise/setimmediate/done'); if (__DEV__) { require('promise/setimmediate/rejection-tracking').enable({ allRejections: true, @@ -34,4 +46,12 @@ if (__DEV__) { }); } +/** + * Handle either fulfillment or rejection with the same callback. + */ +Promise.prototype.finally = function(onSettled) { + return this.then(onSettled, onSettled); +}; + + module.exports = Promise; diff --git a/Libraries/vendor/core/Map.js b/Libraries/vendor/core/Map.js new file mode 100644 index 00000000000000..114add77b308ca --- /dev/null +++ b/Libraries/vendor/core/Map.js @@ -0,0 +1,626 @@ +/** + * @generated SignedSource<<375749f44ce7c0f681fc1297943eaf74>> + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !! This file is a check-in of a static_upstream project! !! + * !! !! + * !! You should not modify this file directly. Instead: !! + * !! 1) Use `fjs use-upstream` to temporarily replace this with !! + * !! the latest version from upstream. !! + * !! 2) Make your changes, test them, etc. !! + * !! 3) Use `fjs push-upstream` to copy your changes back to !! + * !! static_upstream. !! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * Copyright 2013-2014 Facebook, Inc. + * @providesModule Map + * @preventMunge + * @typechecks + */ + +var guid = require('guid'); +var isNode = require('isNode'); +var toIterator = require('toIterator'); +var _shouldPolyfillES6Collection = require('_shouldPolyfillES6Collection'); + +module.exports = (function(global, undefined) { + // Since our implementation is spec-compliant for the most part we can safely + // delegate to a built-in version if exists and is implemented correctly. + // Firefox had gotten a few implementation details wrong across different + // versions so we guard against that. + if (!_shouldPolyfillES6Collection('Map')) { + return global.Map; + } + + /** + * == ES6 Map Collection == + * + * This module is meant to implement a Map collection as described in chapter + * 23.1 of the ES6 specification. + * + * Map objects are collections of key/value pairs where both the keys and + * values may be arbitrary ECMAScript language values. A distinct key value + * may only occur in one key/value pair within the Map's collection. + * + * https://people.mozilla.org/~jorendorff/es6-draft.html#sec-map-objects + * + * There only two -- rather small -- diviations from the spec: + * + * 1. The use of frozen objects as keys. + * We decided not to allow and simply throw an error. The reason being is + * we store a "hash" on the object for fast access to it's place in the + * internal map entries. + * If this turns out to be a popular use case it's possible to implement by + * overiding `Object.freeze` to store a "hash" property on the object + * for later use with the map. + * + * 2. The `size` property on a map object is a regular property and not a + * computed property on the prototype as described by the spec. + * The reason being is that we simply want to support ES3 environments + * which doesn't implement computed properties. + * + * == Usage == + * + * var map = new Map(iterable); + * + * map.set(key, value); + * map.get(key); // value + * map.has(key); // true + * map.delete(key); // true + * + * var iterator = map.keys(); + * iterator.next(); // {value: key, done: false} + * + * var iterator = map.values(); + * iterator.next(); // {value: value, done: false} + * + * var iterator = map.entries(); + * iterator.next(); // {value: [key, value], done: false} + * + * map.forEach(function(value, key){ this === thisArg }, thisArg); + * + * map.clear(); // resets map. + */ + + /** + * Constants + */ + + // Kinds of map iterations 23.1.5.3 + var KIND_KEY = 'key'; + var KIND_VALUE = 'value'; + var KIND_KEY_VALUE = 'key+value'; + + // In older browsers we can't create a null-prototype object so we have to + // defend against key collisions with built-in methods. + var KEY_PREFIX = '$map_'; + + // This property will be used as the internal size variable to disallow + // writing and to issue warnings for writings in development. + var SECRET_SIZE_PROP; + if (__DEV__) { + SECRET_SIZE_PROP = '$size' + guid(); + } + + // In oldIE we use the DOM Node `uniqueID` property to get create the hash. + var OLD_IE_HASH_PREFIX = 'IE_HASH_'; + + class Map { + + /** + * 23.1.1.1 + * Takes an `iterable` which is basically any object that implements a + * Symbol.iterator (@@iterator) method. The iterable is expected to be a + * collection of pairs. Each pair is a key/value pair that will be used + * to instantiate the map. + * + * @param {*} iterable + */ + constructor(iterable) { + if (!isObject(this)) { + throw new TypeError('Wrong map object type.'); + } + + initMap(this); + + if (iterable != null) { + var it = toIterator(iterable); + var next; + while (!(next = it.next()).done) { + if (!isObject(next.value)) { + throw new TypeError('Expected iterable items to be pair objects.'); + } + this.set(next.value[0], next.value[1]); + } + } + } + + /** + * 23.1.3.1 + * Clears the map from all keys and values. + */ + clear() { + initMap(this); + } + + /** + * 23.1.3.7 + * Check if a key exists in the collection. + * + * @param {*} key + * @return {boolean} + */ + has(key) { + var index = getIndex(this, key); + return !!(index != null && this._mapData[index]); + } + + /** + * 23.1.3.9 + * Adds a key/value pair to the collection. + * + * @param {*} key + * @param {*} value + * @return {map} + */ + set(key, value) { + var index = getIndex(this, key); + + if (index != null && this._mapData[index]) { + this._mapData[index][1] = value; + } else { + index = this._mapData.push([ + key, + value + ]) - 1; + setIndex(this, key, index); + if (__DEV__) { + this[SECRET_SIZE_PROP] += 1; + } else { + this.size += 1; + } + } + + return this; + } + + /** + * 23.1.3.6 + * Gets a value associated with a key in the collection. + * + * @param {*} key + * @return {*} + */ + get(key) { + var index = getIndex(this, key); + if (index == null) { + return undefined; + } else { + return this._mapData[index][1]; + } + } + + + /** + * 23.1.3.3 + * Delete a key/value from the collection. + * + * @param {*} key + * @return {boolean} Whether the key was found and deleted. + */ + delete(key) { + var index = getIndex(this, key); + if (index != null && this._mapData[index]) { + setIndex(this, key, undefined); + this._mapData[index] = undefined; + if (__DEV__) { + this[SECRET_SIZE_PROP] -= 1; + } else { + this.size -= 1; + } + return true; + } else { + return false; + } + } + + /** + * 23.1.3.4 + * Returns an iterator over the key/value pairs (in the form of an Array) in + * the collection. + * + * @return {MapIterator} + */ + entries() { + return new MapIterator(this, KIND_KEY_VALUE); + } + + /** + * 23.1.3.8 + * Returns an iterator over the keys in the collection. + * + * @return {MapIterator} + */ + keys() { + return new MapIterator(this, KIND_KEY); + } + + /** + * 23.1.3.11 + * Returns an iterator over the values pairs in the collection. + * + * @return {MapIterator} + */ + values() { + return new MapIterator(this, KIND_VALUE); + } + + /** + * 23.1.3.5 + * Iterates over the key/value pairs in the collection calling `callback` + * with [value, key, map]. An optional `thisArg` can be passed to set the + * context when `callback` is called. + * + * @param {function} callback + * @param {?object} thisArg + */ + forEach(callback, thisArg) { + if (typeof callback !== 'function') { + throw new TypeError('Callback must be callable.'); + } + + var boundCallback = callback.bind(thisArg || undefined); + var mapData = this._mapData; + + // Note that `mapData.length` should be computed on each iteration to + // support iterating over new items in the map that were added after the + // start of the iteration. + for (var i = 0; i < mapData.length; i++) { + var entry = mapData[i]; + if (entry != null) { + boundCallback(entry[1], entry[0], this); + } + } + } + } + + // 23.1.3.12 + Map.prototype[toIterator.ITERATOR_SYMBOL] = Map.prototype.entries; + + class MapIterator { + + /** + * 23.1.5.1 + * Create a `MapIterator` for a given `map`. While this class is private it + * will create objects that will be passed around publicily. + * + * @param {map} map + * @param {string} kind + */ + constructor(map, kind) { + if (!(isObject(map) && map['_mapData'])) { + throw new TypeError('Object is not a map.'); + } + + if ([KIND_KEY, KIND_KEY_VALUE, KIND_VALUE].indexOf(kind) === -1) { + throw new Error('Invalid iteration kind.'); + } + + this._map = map; + this._nextIndex = 0; + this._kind = kind; + } + + /** + * 23.1.5.2.1 + * Get the next iteration. + * + * @return {object} + */ + next() { + if (!this instanceof Map) { + throw new TypeError('Expected to be called on a MapIterator.'); + } + + var map = this._map; + var index = this._nextIndex; + var kind = this._kind; + + if (map == null) { + return createIterResultObject(undefined, true); + } + + var entries = map['_mapData']; + + while (index < entries.length) { + var record = entries[index]; + + index += 1; + this._nextIndex = index; + + if (record) { + if (kind === KIND_KEY) { + return createIterResultObject(record[0], false); + } else if (kind === KIND_VALUE) { + return createIterResultObject(record[1], false); + } else if (kind) { + return createIterResultObject(record, false); + } + } + } + + this._map = undefined; + + return createIterResultObject(undefined, true); + } + } + + // We can put this in the class definition once we have computed props + // transform. + // 23.1.5.2.2 + MapIterator.prototype[toIterator.ITERATOR_SYMBOL] = function() { + return this; + } + + /** + * Helper Functions. + */ + + /** + * Return an index to map.[[MapData]] array for a given Key. + * + * @param {map} map + * @param {*} key + * @return {?number} + */ + function getIndex(map, key) { + if (isObject(key)) { + var hash = getHash(key); + return map._objectIndex[hash]; + } else { + var prefixedKey = KEY_PREFIX + key; + if (typeof key === 'string') { + return map._stringIndex[prefixedKey]; + } else { + return map._otherIndex[prefixedKey]; + } + } + } + + /** + * Setup an index that refer to the key's location in map.[[MapData]]. + * + * @param {map} map + * @param {*} key + */ + function setIndex(map, key, index) { + var shouldDelete = index == null; + + if (isObject(key)) { + var hash = getHash(key); + if (shouldDelete) { + delete map._objectIndex[hash]; + } else { + map._objectIndex[hash] = index; + } + } else { + var prefixedKey = KEY_PREFIX + key; + if (typeof key === 'string') { + if (shouldDelete) { + delete map._stringIndex[prefixedKey]; + } else { + map._stringIndex[prefixedKey] = index; + } + } else { + if (shouldDelete) { + delete map._otherIndex[prefixedKey]; + } else { + map._otherIndex[prefixedKey] = index; + } + } + } + } + + /** + * Instantiate a map with internal slots. + * + * @param {map} map + */ + function initMap(map) { + // Data structure design inspired by Traceur's Map implementation. + // We maintain an internal array for all the entries. The array is needed + // to remember order. However, to have a reasonable HashMap performance + // i.e. O(1) for insertion, deletion, and retrieval. We maintain indices + // in objects for fast look ups. Indices are split up according to data + // types to avoid collisions. + map._mapData = []; + + // Object index maps from an object "hash" to index. The hash being a unique + // property of our choosing that we associate with the object. Association + // is done by ways of keeping a non-enumerable property on the object. + // Ideally these would be `Object.create(null)` objects but since we're + // trying to support ES3 we'll have to gaurd against collisions using + // prefixes on the keys rather than rely on null prototype objects. + map._objectIndex = {}; + + // String index maps from strings to index. + map._stringIndex = {}; + + // Numbers, booleans, undefined, and null. + map._otherIndex = {}; + + // Unfortunately we have to support ES3 and cannot have `Map.prototype.size` + // be a getter method but just a regular method. The biggest problem with + // this is safety. Clients can change the size property easily and possibly + // without noticing (e.g. `if (map.size = 1) {..}` kind of typo). What we + // can do to mitigate use getters and setters in development to disallow + // and issue a warning for changing the `size` property. + if (__DEV__) { + if (isES5) { + // If the `SECRET_SIZE_PROP` property is already defined then we're not + // in the first call to `initMap` (e.g. coming from `map.clear()`) so + // all we need to do is reset the size without defining the properties. + if (map.hasOwnProperty(SECRET_SIZE_PROP)) { + map[SECRET_SIZE_PROP] = 0; + } else { + Object.defineProperty(map, SECRET_SIZE_PROP, { + value: 0, + writable: true + }); + Object.defineProperty(map, 'size', { + set: (v) => { + console.error( + 'PLEASE FIX ME: You are changing the map size property which ' + + 'should not be writable and will break in production.' + ); + throw new Error('The map size property is not writable.'); + }, + get: () => map[SECRET_SIZE_PROP] + }); + } + + // NOTE: Early return to implement immutable `.size` in DEV. + return; + } + } + + // This is a diviation from the spec. `size` should be a getter on + // `Map.prototype`. However, we have to support IE8. + map.size = 0; + } + + /** + * Check if something is an object. + * + * @param {*} o + * @return {boolean} + */ + function isObject(o) { + return o != null && (typeof o === 'object' || typeof o === 'function'); + } + + /** + * Create an iteration object. + * + * @param {*} value + * @param {boolean} done + * @return {object} + */ + function createIterResultObject(value, done) { + return {value, done}; + } + + // Are we in a legit ES5 environment. Spoiler alert: that doesn't include IE8. + var isES5 = (function() { + try { + Object.defineProperty({}, 'x', {}); + return true; + } catch(e) { + return false; + } + })(); + + /** + * Check if an object can be extended. + * + * @param {object|array|function|regexp} o + * @return {boolean} + */ + function isExtensible(o) { + if (!isES5) { + return true; + } else { + return Object.isExtensible(o); + } + } + + /** + * IE has a `uniqueID` set on every DOM node. So we construct the hash from + * this uniqueID to avoid memory leaks and the IE cloneNode bug where it + * clones properties in addition to the attributes. + * + * @param {object} node + * @return {?string} + */ + function getIENodeHash(node) { + var uniqueID; + switch (node.nodeType) { + case 1: // Element + uniqueID = node.uniqueID; + break; + case 9: // Document + uniqueID = node.documentElement.uniqueID; + break; + default: + return null; + } + + if (uniqueID) { + return OLD_IE_HASH_PREFIX + uniqueID; + } else { + return null; + } + } + + var getHash = (function() { + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + var hashProperty = guid(); + var hashCounter = 0; + + /** + * Get the "hash" associated with an object. + * + * @param {object|array|function|regexp} o + * @return {number} + */ + return function getHash(o) { + if (o[hashProperty]) { + return o[hashProperty]; + } else if (!isES5 && + o.propertyIsEnumerable && + o.propertyIsEnumerable[hashProperty]) { + return o.propertyIsEnumerable[hashProperty]; + } else if (!isES5 && + isNode(o) && + getIENodeHash(o)) { + return getIENodeHash(o); + } else if (!isES5 && o[hashProperty]) { + return o[hashProperty]; + } + + if (isExtensible(o)) { + hashCounter += 1; + if (isES5) { + Object.defineProperty(o, hashProperty, { + enumerable: false, + writable: false, + configurable: false, + value: hashCounter + }); + } else if (o.propertyIsEnumerable) { + // Since we can't define a non-enumerable property on the object + // we'll hijack one of the less-used non-enumerable properties to + // save our hash on it. Addiotionally, since this is a function it + // will not show up in `JSON.stringify` which is what we want. + o.propertyIsEnumerable = function() { + return propIsEnumerable.apply(this, arguments); + }; + o.propertyIsEnumerable[hashProperty] = hashCounter; + } else if (isNode(o)) { + // At this point we couldn't get the IE `uniqueID` to use as a hash + // and we couldn't use a non-enumerable property to exploit the + // dontEnum bug so we simply add the `hashProperty` on the node + // itself. + o[hashProperty] = hashCounter; + } else { + throw new Error('Unable to set a non-enumerable property on object.'); + } + return hashCounter; + } else { + throw new Error('Non-extensible objects are not allowed as keys.'); + } + }; + })(); + + return Map; +})(/* jslint evil: true */ Function('return this')()); diff --git a/Libraries/vendor/core/isEmpty.js b/Libraries/vendor/core/isEmpty.js new file mode 100644 index 00000000000000..27f4c0069a06f7 --- /dev/null +++ b/Libraries/vendor/core/isEmpty.js @@ -0,0 +1,34 @@ +/** + * @generated SignedSource<<97ffcebc9ae390e734026a4f3964bff6>> + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !! This file is a check-in of a static_upstream project! !! + * !! !! + * !! You should not modify this file directly. Instead: !! + * !! 1) Use `fjs use-upstream` to temporarily replace this with !! + * !! the latest version from upstream. !! + * !! 2) Make your changes, test them, etc. !! + * !! 3) Use `fjs push-upstream` to copy your changes back to !! + * !! static_upstream. !! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * @providesModule isEmpty + */ + +/** + * Mimics empty from PHP. + */ +function isEmpty(obj) { + if (Array.isArray(obj)) { + return obj.length === 0; + } else if (typeof obj === 'object') { + for (var i in obj) { + return false; + } + return true; + } else { + return !obj; + } +} + +module.exports = isEmpty; diff --git a/Libraries/vendor/crypto/crc32.js b/Libraries/vendor/crypto/crc32.js new file mode 100644 index 00000000000000..540d60aa832b6e --- /dev/null +++ b/Libraries/vendor/crypto/crc32.js @@ -0,0 +1,92 @@ +/** + * @generated SignedSource<<77bdeb858138636c96c405d64b6be55c>> + * + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * !! This file is a check-in of a static_upstream project! !! + * !! !! + * !! You should not modify this file directly. Instead: !! + * !! 1) Use `fjs use-upstream` to temporarily replace this with !! + * !! the latest version from upstream. !! + * !! 2) Make your changes, test them, etc. !! + * !! 3) Use `fjs push-upstream` to copy your changes back to !! + * !! static_upstream. !! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * Copyright 2004-present Facebook. All Rights Reserved. + * + * @providesModule crc32 + */ + +/* jslint bitwise: true */ + +/** + * Modified from the original for performance improvements. + * + * @see http://create.stephan-brumme.com/crc32/ + * @see http://stackoverflow.com/questions/18638900/ + * @copyright 2006 Andrea Ercolino + * @license MIT + */ + +var table = [ + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, + 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, + 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, + 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, + 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, + 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, + 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, + 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, + 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, + 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, + 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, + 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, + 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, + 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, + 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, + 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, + 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, + 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, + 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, + 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, + 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, + 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D +]; + +if (global.Int32Array !== undefined) { + table = new Int32Array(table); +} + +/** + * @returns Number + */ +function crc32(str) { + var crc = -1; + for (var i = 0, len = str.length; i < len; i++) { + crc = (crc >>> 8) ^ table[(crc ^ str.charCodeAt(i)) & 0xFF]; + } + return ~crc; +} + +module.exports = crc32; diff --git a/Libraries/vendor/fbjs/CSSCore.js b/Libraries/vendor/fbjs/CSSCore.js deleted file mode 100644 index 70f72f7677a64a..00000000000000 --- a/Libraries/vendor/fbjs/CSSCore.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule CSSCore - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/CSSCore'); diff --git a/Libraries/vendor/fbjs/Deferred.js b/Libraries/vendor/fbjs/Deferred.js deleted file mode 100644 index 88704b83901aab..00000000000000 --- a/Libraries/vendor/fbjs/Deferred.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule Deferred - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/Deferred'); diff --git a/Libraries/vendor/fbjs/EventListener.js b/Libraries/vendor/fbjs/EventListener.js deleted file mode 100644 index ec6041de37dfb3..00000000000000 --- a/Libraries/vendor/fbjs/EventListener.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule EventListener - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/EventListener'); diff --git a/Libraries/vendor/fbjs/Map.js b/Libraries/vendor/fbjs/Map.js deleted file mode 100644 index 4fd97503ba8b58..00000000000000 --- a/Libraries/vendor/fbjs/Map.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule Map - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/Map'); diff --git a/Libraries/vendor/fbjs/PromiseMap.js b/Libraries/vendor/fbjs/PromiseMap.js deleted file mode 100644 index 30891f521c75de..00000000000000 --- a/Libraries/vendor/fbjs/PromiseMap.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule PromiseMap - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/PromiseMap'); diff --git a/Libraries/vendor/fbjs/TouchEventUtils.js b/Libraries/vendor/fbjs/TouchEventUtils.js deleted file mode 100644 index f75be694416499..00000000000000 --- a/Libraries/vendor/fbjs/TouchEventUtils.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule TouchEventUtils - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/TouchEventUtils'); diff --git a/Libraries/vendor/fbjs/URI.js b/Libraries/vendor/fbjs/URI.js deleted file mode 100644 index 72c5650012cf86..00000000000000 --- a/Libraries/vendor/fbjs/URI.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule URI - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/URI'); diff --git a/Libraries/vendor/fbjs/UserAgent.js b/Libraries/vendor/fbjs/UserAgent.js deleted file mode 100644 index 85c2669b8c1a45..00000000000000 --- a/Libraries/vendor/fbjs/UserAgent.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule UserAgent - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/UserAgent'); diff --git a/Libraries/vendor/fbjs/UserAgentData.js b/Libraries/vendor/fbjs/UserAgentData.js deleted file mode 100644 index 13ff6a335caf44..00000000000000 --- a/Libraries/vendor/fbjs/UserAgentData.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule UserAgentData - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/UserAgentData'); diff --git a/Libraries/vendor/fbjs/VersionRange.js b/Libraries/vendor/fbjs/VersionRange.js deleted file mode 100644 index de55fe18928d28..00000000000000 --- a/Libraries/vendor/fbjs/VersionRange.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule VersionRange - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/VersionRange'); diff --git a/Libraries/vendor/fbjs/areEqual.js b/Libraries/vendor/fbjs/areEqual.js deleted file mode 100644 index 8c020878a20a75..00000000000000 --- a/Libraries/vendor/fbjs/areEqual.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule areEqual - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/areEqual'); diff --git a/Libraries/vendor/fbjs/base62.js b/Libraries/vendor/fbjs/base62.js deleted file mode 100644 index 596b871dcbf695..00000000000000 --- a/Libraries/vendor/fbjs/base62.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule base62 - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/base62'); diff --git a/Libraries/vendor/fbjs/camelize.js b/Libraries/vendor/fbjs/camelize.js deleted file mode 100644 index 356cfefaad1c5b..00000000000000 --- a/Libraries/vendor/fbjs/camelize.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule camelize - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/camelize'); diff --git a/Libraries/vendor/fbjs/camelizeStyleName.js b/Libraries/vendor/fbjs/camelizeStyleName.js deleted file mode 100644 index a92ed2c104d9f9..00000000000000 --- a/Libraries/vendor/fbjs/camelizeStyleName.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule camelizeStyleName - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/camelizeStyleName'); diff --git a/Libraries/vendor/fbjs/containsNode.js b/Libraries/vendor/fbjs/containsNode.js deleted file mode 100644 index 67d65e4f4a748b..00000000000000 --- a/Libraries/vendor/fbjs/containsNode.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule containsNode - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/containsNode'); diff --git a/Libraries/vendor/fbjs/crc32.js b/Libraries/vendor/fbjs/crc32.js deleted file mode 100644 index cb4fba1a20120a..00000000000000 --- a/Libraries/vendor/fbjs/crc32.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule crc32 - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/crc32'); diff --git a/Libraries/vendor/fbjs/createArrayFromMixed.js b/Libraries/vendor/fbjs/createArrayFromMixed.js deleted file mode 100644 index 6489c47746cd2b..00000000000000 --- a/Libraries/vendor/fbjs/createArrayFromMixed.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule createArrayFromMixed - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/createArrayFromMixed'); diff --git a/Libraries/vendor/fbjs/createNodesFromMarkup.js b/Libraries/vendor/fbjs/createNodesFromMarkup.js deleted file mode 100644 index fb5899c0ff3d0a..00000000000000 --- a/Libraries/vendor/fbjs/createNodesFromMarkup.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule createNodesFromMarkup - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/createNodesFromMarkup'); diff --git a/Libraries/vendor/fbjs/emptyFunction.js b/Libraries/vendor/fbjs/emptyFunction.js deleted file mode 100644 index ac55c276a163fa..00000000000000 --- a/Libraries/vendor/fbjs/emptyFunction.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule emptyFunction - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/emptyFunction'); diff --git a/Libraries/vendor/fbjs/emptyObject.js b/Libraries/vendor/fbjs/emptyObject.js deleted file mode 100644 index f738081cc0d03b..00000000000000 --- a/Libraries/vendor/fbjs/emptyObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule emptyObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/emptyObject'); diff --git a/Libraries/vendor/fbjs/everyObject.js b/Libraries/vendor/fbjs/everyObject.js deleted file mode 100644 index 4fe49e035ad7b0..00000000000000 --- a/Libraries/vendor/fbjs/everyObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule everyObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/everyObject'); diff --git a/Libraries/vendor/fbjs/fetchWithRetries.js b/Libraries/vendor/fbjs/fetchWithRetries.js deleted file mode 100644 index 16d1e1aa98ebf0..00000000000000 --- a/Libraries/vendor/fbjs/fetchWithRetries.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule fetchWithRetries - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/fetchWithRetries'); diff --git a/Libraries/vendor/fbjs/filterObject.js b/Libraries/vendor/fbjs/filterObject.js deleted file mode 100644 index 819e188e4bf50d..00000000000000 --- a/Libraries/vendor/fbjs/filterObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule filterObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/filterObject'); diff --git a/Libraries/vendor/fbjs/flattenArray.js b/Libraries/vendor/fbjs/flattenArray.js deleted file mode 100644 index 14f12d6a41ffd8..00000000000000 --- a/Libraries/vendor/fbjs/flattenArray.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule flattenArray - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/flattenArray'); diff --git a/Libraries/vendor/fbjs/focusNode.js b/Libraries/vendor/fbjs/focusNode.js deleted file mode 100644 index 91df968db9e018..00000000000000 --- a/Libraries/vendor/fbjs/focusNode.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule focusNode - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/focusNode'); diff --git a/Libraries/vendor/fbjs/forEachObject.js b/Libraries/vendor/fbjs/forEachObject.js deleted file mode 100644 index 1e5b39f29f293a..00000000000000 --- a/Libraries/vendor/fbjs/forEachObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule forEachObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/forEachObject'); diff --git a/Libraries/vendor/fbjs/getActiveElement.js b/Libraries/vendor/fbjs/getActiveElement.js deleted file mode 100644 index cb597c5a27830c..00000000000000 --- a/Libraries/vendor/fbjs/getActiveElement.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule getActiveElement - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/getActiveElement'); diff --git a/Libraries/vendor/fbjs/getMarkupWrap.js b/Libraries/vendor/fbjs/getMarkupWrap.js deleted file mode 100644 index 8673d463022599..00000000000000 --- a/Libraries/vendor/fbjs/getMarkupWrap.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule getMarkupWrap - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/getMarkupWrap'); diff --git a/Libraries/vendor/fbjs/getUnboundedScrollPosition.js b/Libraries/vendor/fbjs/getUnboundedScrollPosition.js deleted file mode 100644 index a72586ef406349..00000000000000 --- a/Libraries/vendor/fbjs/getUnboundedScrollPosition.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule getUnboundedScrollPosition - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/getUnboundedScrollPosition'); diff --git a/Libraries/vendor/fbjs/hyphenate.js b/Libraries/vendor/fbjs/hyphenate.js deleted file mode 100644 index 00cec2c76b635d..00000000000000 --- a/Libraries/vendor/fbjs/hyphenate.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule hyphenate - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/hyphenate'); diff --git a/Libraries/vendor/fbjs/hyphenateStyleName.js b/Libraries/vendor/fbjs/hyphenateStyleName.js deleted file mode 100644 index b1349ea097d183..00000000000000 --- a/Libraries/vendor/fbjs/hyphenateStyleName.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule hyphenateStyleName - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/hyphenateStyleName'); diff --git a/Libraries/vendor/fbjs/invariant.js b/Libraries/vendor/fbjs/invariant.js deleted file mode 100644 index 1a19702441d806..00000000000000 --- a/Libraries/vendor/fbjs/invariant.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule invariant - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/invariant'); diff --git a/Libraries/vendor/fbjs/isEmpty.js b/Libraries/vendor/fbjs/isEmpty.js deleted file mode 100644 index 3d9ae58e99ecd4..00000000000000 --- a/Libraries/vendor/fbjs/isEmpty.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule isEmpty - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/isEmpty'); diff --git a/Libraries/vendor/fbjs/isNode.js b/Libraries/vendor/fbjs/isNode.js deleted file mode 100644 index d99b32dad5076e..00000000000000 --- a/Libraries/vendor/fbjs/isNode.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule isNode - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/isNode'); diff --git a/Libraries/vendor/fbjs/isTextNode.js b/Libraries/vendor/fbjs/isTextNode.js deleted file mode 100644 index 7b39b169863c77..00000000000000 --- a/Libraries/vendor/fbjs/isTextNode.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule isTextNode - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/isTextNode'); diff --git a/Libraries/vendor/fbjs/joinClasses.js b/Libraries/vendor/fbjs/joinClasses.js deleted file mode 100644 index 8e7908a9d0d148..00000000000000 --- a/Libraries/vendor/fbjs/joinClasses.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule joinClasses - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/joinClasses'); diff --git a/Libraries/vendor/fbjs/keyMirror.js b/Libraries/vendor/fbjs/keyMirror.js deleted file mode 100644 index 021b3405206c49..00000000000000 --- a/Libraries/vendor/fbjs/keyMirror.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule keyMirror - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/keyMirror'); diff --git a/Libraries/vendor/fbjs/keyOf.js b/Libraries/vendor/fbjs/keyOf.js deleted file mode 100644 index 646040a5718691..00000000000000 --- a/Libraries/vendor/fbjs/keyOf.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule keyOf - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/keyOf'); diff --git a/Libraries/vendor/fbjs/mapObject.js b/Libraries/vendor/fbjs/mapObject.js deleted file mode 100644 index a74e35737cc167..00000000000000 --- a/Libraries/vendor/fbjs/mapObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule mapObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/mapObject'); diff --git a/Libraries/vendor/fbjs/memoizeStringOnly.js b/Libraries/vendor/fbjs/memoizeStringOnly.js deleted file mode 100644 index 36d4d31458f950..00000000000000 --- a/Libraries/vendor/fbjs/memoizeStringOnly.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule memoizeStringOnly - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/memoizeStringOnly'); diff --git a/Libraries/vendor/fbjs/monitorCodeUse.js b/Libraries/vendor/fbjs/monitorCodeUse.js deleted file mode 100644 index c06614c17d2b75..00000000000000 --- a/Libraries/vendor/fbjs/monitorCodeUse.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule monitorCodeUse - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/monitorCodeUse'); diff --git a/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js b/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js deleted file mode 100644 index 5ff2ba2a85becd..00000000000000 --- a/Libraries/vendor/fbjs/nativeRequestAnimationFrame.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule nativeRequestAnimationFrame - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/nativeRequestAnimationFrame'); diff --git a/Libraries/vendor/fbjs/nullthrows.js b/Libraries/vendor/fbjs/nullthrows.js deleted file mode 100644 index 5de73280dbf0cc..00000000000000 --- a/Libraries/vendor/fbjs/nullthrows.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule nullthrows - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/nullthrows'); diff --git a/Libraries/vendor/fbjs/performance.js b/Libraries/vendor/fbjs/performance.js deleted file mode 100644 index eab35d18d69e92..00000000000000 --- a/Libraries/vendor/fbjs/performance.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule performance - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/performance'); diff --git a/Libraries/vendor/fbjs/performanceNow.js b/Libraries/vendor/fbjs/performanceNow.js deleted file mode 100644 index fa0c50535c1168..00000000000000 --- a/Libraries/vendor/fbjs/performanceNow.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule performanceNow - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/performanceNow'); diff --git a/Libraries/vendor/fbjs/removeFromArray.js b/Libraries/vendor/fbjs/removeFromArray.js deleted file mode 100644 index 0af09ec367922b..00000000000000 --- a/Libraries/vendor/fbjs/removeFromArray.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule removeFromArray - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/removeFromArray'); diff --git a/Libraries/vendor/fbjs/requestAnimationFrame.js b/Libraries/vendor/fbjs/requestAnimationFrame.js deleted file mode 100644 index 1671e27ef1f251..00000000000000 --- a/Libraries/vendor/fbjs/requestAnimationFrame.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule requestAnimationFrame - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/requestAnimationFrame'); diff --git a/Libraries/vendor/fbjs/resolveImmediate.js b/Libraries/vendor/fbjs/resolveImmediate.js deleted file mode 100644 index e587c24dada352..00000000000000 --- a/Libraries/vendor/fbjs/resolveImmediate.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule resolveImmediate - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/resolveImmediate'); diff --git a/Libraries/vendor/fbjs/shallowEqual.js b/Libraries/vendor/fbjs/shallowEqual.js deleted file mode 100644 index 065a3e68200293..00000000000000 --- a/Libraries/vendor/fbjs/shallowEqual.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule shallowEqual - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/shallowEqual'); diff --git a/Libraries/vendor/fbjs/someObject.js b/Libraries/vendor/fbjs/someObject.js deleted file mode 100644 index edd2cdd7b1d7f4..00000000000000 --- a/Libraries/vendor/fbjs/someObject.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule someObject - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/someObject'); diff --git a/Libraries/vendor/fbjs/sprintf.js b/Libraries/vendor/fbjs/sprintf.js deleted file mode 100644 index f4140fc06400c1..00000000000000 --- a/Libraries/vendor/fbjs/sprintf.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule sprintf - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/sprintf'); diff --git a/Libraries/vendor/fbjs/warning.js b/Libraries/vendor/fbjs/warning.js deleted file mode 100644 index 7ae0cdf81b8e88..00000000000000 --- a/Libraries/vendor/fbjs/warning.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule warning - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/warning'); diff --git a/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js b/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js deleted file mode 100644 index d0d9b2c60c5253..00000000000000 --- a/Libraries/vendor/fbjs/xhrSimpleDataSerializer.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2016-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. - * - * @providesModule xhrSimpleDataSerializer - * @flow - */ -'use strict'; - -module.exports = require('fbjs/lib/xhrSimpleDataSerializer'); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 9826948e1dcac7..dc7c0be87142f9 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -142,15 +142,15 @@ "from": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz" }, - "regenerator": { - "version": "0.8.40", - "from": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", - "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz" - }, "recast": { "version": "0.10.33", "from": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz" + }, + "regenerator": { + "version": "0.8.40", + "from": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", + "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz" } } }, @@ -1815,21 +1815,19 @@ "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.1.0.tgz" }, "fbjs": { - "version": "0.7.2", - "from": "fbjs@0.7.2", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.7.2.tgz", + "version": "0.6.0", + "from": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.0.tgz", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.0.tgz", "dependencies": { - "isomorphic-fetch": { - "version": "2.2.1", - "from": "isomorphic-fetch@>=2.1.1 <3.0.0", - "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "dependencies": { - "whatwg-fetch": { - "version": "0.11.0", - "from": "whatwg-fetch@>=0.10.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.11.0.tgz" - } - } + "ua-parser-js": { + "version": "0.7.10", + "from": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz" + }, + "whatwg-fetch": { + "version": "0.9.0", + "from": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz" } } }, @@ -1917,16 +1915,16 @@ "from": "are-we-there-yet@~1.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.0.4.tgz" }, - "assert-plus": { - "version": "0.1.5", - "from": "assert-plus@^0.1.5", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz" - }, "asn1": { "version": "0.1.11", "from": "asn1@0.1.11", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz" }, + "assert-plus": { + "version": "0.1.5", + "from": "assert-plus@^0.1.5", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.1.5.tgz" + }, "async": { "version": "1.5.0", "from": "async@^1.4.0", @@ -1952,11 +1950,6 @@ "from": "boom@^2.8.x", "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz" }, - "caseless": { - "version": "0.11.0", - "from": "caseless@~0.11.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz" - }, "brace-expansion": { "version": "1.1.1", "from": "brace-expansion@>=1.0.0 <2.0.0", @@ -1967,6 +1960,11 @@ "from": "chalk@^1.1.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz" }, + "caseless": { + "version": "0.11.0", + "from": "caseless@~0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz" + }, "combined-stream": { "version": "1.0.5", "from": "combined-stream@~1.0.5", @@ -2067,36 +2065,36 @@ "from": "graceful-readlink@>= 1.0.0", "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" }, - "har-validator": { - "version": "2.0.2", - "from": "har-validator@~2.0.2", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz" - }, "has-ansi": { "version": "2.0.0", "from": "has-ansi@^2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" }, - "hawk": { - "version": "3.1.0", - "from": "hawk@~3.1.0", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz" + "har-validator": { + "version": "2.0.2", + "from": "har-validator@~2.0.2", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.2.tgz" }, "has-unicode": { "version": "1.0.1", "from": "has-unicode@^1.0.0", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-1.0.1.tgz" }, - "http-signature": { - "version": "0.11.0", - "from": "http-signature@~0.11.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz" + "hawk": { + "version": "3.1.0", + "from": "hawk@~3.1.0", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.0.tgz" }, "hoek": { "version": "2.16.3", "from": "hoek@2.x.x", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" }, + "http-signature": { + "version": "0.11.0", + "from": "http-signature@~0.11.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.11.0.tgz" + }, "inherits": { "version": "2.0.1", "from": "inherits@*", @@ -2122,31 +2120,31 @@ "from": "isarray@0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, - "json-stringify-safe": { - "version": "5.0.1", - "from": "json-stringify-safe@~5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" - }, "isstream": { "version": "0.1.2", "from": "isstream@~0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" }, + "json-stringify-safe": { + "version": "5.0.1", + "from": "json-stringify-safe@~5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" + }, "jsonpointer": { "version": "2.0.0", "from": "jsonpointer@2.0.0", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz" }, - "lodash._createpadding": { - "version": "3.6.1", - "from": "lodash._createpadding@^3.0.0", - "resolved": "https://registry.npmjs.org/lodash._createpadding/-/lodash._createpadding-3.6.1.tgz" - }, "lodash._basetostring": { "version": "3.0.1", "from": "lodash._basetostring@^3.0.0", "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz" }, + "lodash._createpadding": { + "version": "3.6.1", + "from": "lodash._createpadding@^3.0.0", + "resolved": "https://registry.npmjs.org/lodash._createpadding/-/lodash._createpadding-3.6.1.tgz" + }, "lodash.pad": { "version": "3.1.1", "from": "lodash.pad@^3.0.0", @@ -2212,16 +2210,16 @@ "from": "path-is-absolute@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz" }, - "pinkie-promise": { - "version": "1.0.0", - "from": "pinkie-promise@^1.0.0", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz" - }, "pinkie": { "version": "1.0.0", "from": "pinkie@^1.0.0", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz" }, + "pinkie-promise": { + "version": "1.0.0", + "from": "pinkie-promise@^1.0.0", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz" + }, "qs": { "version": "5.2.0", "from": "qs@~5.2.0", @@ -2237,16 +2235,16 @@ "from": "request@2.x", "resolved": "https://registry.npmjs.org/request/-/request-2.65.0.tgz" }, - "semver": { - "version": "5.0.3", - "from": "semver@~5.0.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz" - }, "sntp": { "version": "1.0.9", "from": "sntp@1.x.x", "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz" }, + "semver": { + "version": "5.0.3", + "from": "semver@~5.0.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz" + }, "string_decoder": { "version": "0.10.31", "from": "string_decoder@~0.10.x", @@ -2257,16 +2255,21 @@ "from": "stringstream@~0.0.4", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" }, - "strip-json-comments": { - "version": "0.1.3", - "from": "strip-json-comments@0.1.x", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz" - }, "strip-ansi": { "version": "3.0.0", "from": "strip-ansi@^3.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz" }, + "supports-color": { + "version": "2.0.0", + "from": "supports-color@^2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + }, + "strip-json-comments": { + "version": "0.1.3", + "from": "strip-json-comments@0.1.x", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-0.1.3.tgz" + }, "tar": { "version": "2.2.1", "from": "tar@~2.2.0", @@ -2277,11 +2280,6 @@ "from": "tough-cookie@~2.2.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.0.tgz" }, - "supports-color": { - "version": "2.0.0", - "from": "supports-color@^2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" - }, "tunnel-agent": { "version": "0.4.1", "from": "tunnel-agent@~0.4.1", @@ -2346,15 +2344,15 @@ "from": "glob@>=5.0.14 <6.0.0", "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" }, - "once": { - "version": "1.3.2", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz" - }, "minimatch": { "version": "3.0.0", "from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz" + }, + "once": { + "version": "1.3.2", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz" } } }, @@ -4060,18 +4058,6 @@ } } } - }, - "fbjs": { - "version": "0.6.1", - "from": "fbjs@>=0.6.0 <0.7.0", - "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.6.1.tgz", - "dependencies": { - "whatwg-fetch": { - "version": "0.9.0", - "from": "whatwg-fetch@>=0.9.0 <0.10.0", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-0.9.0.tgz" - } - } } } }, @@ -4558,11 +4544,6 @@ "from": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz" }, - "ua-parser-js": { - "version": "0.7.10", - "from": "ua-parser-js@>=0.7.9 <0.8.0", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.10.tgz" - }, "uglify-js": { "version": "2.4.24", "from": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.24.tgz", diff --git a/package.json b/package.json index eb0789b0164ec9..8e606d2fc6b544 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,7 @@ ], "unmockedModulePathPatterns": [ "promise", - "source-map", - "fbjs" + "source-map" ] }, "main": "Libraries/react-native/react-native.js", @@ -122,7 +121,7 @@ "connect": "^2.8.3", "debug": "^2.2.0", "event-target-shim": "^1.0.5", - "fbjs": "^0.7.2", + "fbjs": "^0.6.0", "fbjs-scripts": "^0.4.0", "graceful-fs": "^4.1.2", "image-size": "^0.3.5", diff --git a/packager/blacklist.js b/packager/blacklist.js index 318e09e88ee8f8..ee369e1af7266d 100644 --- a/packager/blacklist.js +++ b/packager/blacklist.js @@ -17,6 +17,36 @@ var sharedBlacklist = [ 'node_modules/react/lib/React.js', 'node_modules/react/lib/ReactDOM.js', + // For each of these fbjs files (especially the non-forks/stubs), we should + // consider deleting the conflicting copy and just using the fbjs version. + // + // fbjs forks: + 'node_modules/fbjs/lib/Map.js', + 'node_modules/fbjs/lib/Promise.js', + 'node_modules/fbjs/lib/fetch.js', + // fbjs stubs: + 'node_modules/fbjs/lib/ErrorUtils.js', + 'node_modules/fbjs/lib/URI.js', + // fbjs modules: + 'node_modules/fbjs/lib/Deferred.js', + 'node_modules/fbjs/lib/PromiseMap.js', + 'node_modules/fbjs/lib/UserAgent.js', + 'node_modules/fbjs/lib/areEqual.js', + 'node_modules/fbjs/lib/base62.js', + 'node_modules/fbjs/lib/crc32.js', + 'node_modules/fbjs/lib/everyObject.js', + 'node_modules/fbjs/lib/fetchWithRetries.js', + 'node_modules/fbjs/lib/filterObject.js', + 'node_modules/fbjs/lib/flattenArray.js', + 'node_modules/fbjs/lib/forEachObject.js', + 'node_modules/fbjs/lib/isEmpty.js', + 'node_modules/fbjs/lib/nullthrows.js', + 'node_modules/fbjs/lib/removeFromArray.js', + 'node_modules/fbjs/lib/resolveImmediate.js', + 'node_modules/fbjs/lib/someObject.js', + 'node_modules/fbjs/lib/sprintf.js', + 'node_modules/fbjs/lib/xhrSimpleDataSerializer.js', + // Those conflicts with the ones in fbjs/. We need to blacklist the // internal version otherwise they won't work in open source. 'downstream/core/CSSCore.js', diff --git a/packager/react-packager/src/Resolver/index.js b/packager/react-packager/src/Resolver/index.js index 10e138c8b96109..a677c2199da867 100644 --- a/packager/react-packager/src/Resolver/index.js +++ b/packager/react-packager/src/Resolver/index.js @@ -85,6 +85,7 @@ class Resolver { (opts.blacklistRE && opts.blacklistRE.test(filepath)); }, providesModuleNodeModules: [ + 'fbjs', 'react', 'react-native', // Parse requires AsyncStorage. They will From 0b89b18b1bd85307110ae073ae0a291d9a534e0c Mon Sep 17 00:00:00 2001 From: Felix Oghina Date: Thu, 11 Feb 2016 04:36:16 -0800 Subject: [PATCH 023/417] format exceptions correctly when crashing Reviewed By: ivank Differential Revision: D2921881 fb-gh-sync-id: bd35ada33c752877dd3f6274ed8d4b4b7c851b9a shipit-source-id: bd35ada33c752877dd3f6274ed8d4b4b7c851b9a --- .../modules/core/ExceptionsManagerModule.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java index 876a2fca2c5de5..ca12dd6c57d790 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java @@ -16,6 +16,7 @@ import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.ReadableType; import com.facebook.react.devsupport.DevSupportManager; import com.facebook.react.common.ReactConstants; @@ -32,16 +33,17 @@ public String getName() { return "RKExceptionsManager"; } - private String stackTraceToString(ReadableArray stack) { - StringBuilder stringBuilder = new StringBuilder(); + private String stackTraceToString(String message, ReadableArray stack) { + StringBuilder stringBuilder = new StringBuilder(message).append(", stack:\n"); for (int i = 0; i < stack.size(); i++) { ReadableMap frame = stack.getMap(i); - stringBuilder.append(frame.getString("methodName")); - stringBuilder.append("\n "); - stringBuilder.append(new File(frame.getString("file")).getName()); - stringBuilder.append(":"); - stringBuilder.append(frame.getInt("lineNumber")); - if (frame.hasKey("column") && !frame.isNull("column")) { + stringBuilder + .append(frame.getString("methodName")) + .append("@") + .append(frame.getInt("lineNumber")); + if (frame.hasKey("column") && + !frame.isNull("column") && + frame.getType("column") == ReadableType.Number) { stringBuilder .append(":") .append(frame.getInt("column")); @@ -58,14 +60,14 @@ public void reportFatalException(String title, ReadableArray details, int except @ReactMethod public void reportSoftException(String title, ReadableArray details, int exceptionId) { - FLog.e(ReactConstants.TAG, title + "\n" + stackTraceToString(details)); + FLog.e(ReactConstants.TAG, stackTraceToString(title, details)); } private void showOrThrowError(String title, ReadableArray details, int exceptionId) { if (mDevSupportManager.getDevSupportEnabled()) { mDevSupportManager.showNewJSError(title, details, exceptionId); } else { - throw new JavascriptException(stackTraceToString(details)); + throw new JavascriptException(stackTraceToString(title, details)); } } From 6f1417c84982e0705912b57bf9d1aaaf1476d7d9 Mon Sep 17 00:00:00 2001 From: Konstantin Raev Date: Thu, 11 Feb 2016 06:16:34 -0800 Subject: [PATCH 024/417] CI now builds docs website and deploys it to /%version% path Summary: Copy of #5760 reverted merge. We need to preserve history of docs changes on the webserver. The goal is to allow users to browse outdated versions of docs. To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut. I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it. How it works: 1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder. Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL. All relative URLs will work within that website 2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder. Github will serve this website from https://facebook.github.io/react-native/releases/v Closes https://github.com/facebook/react-native/pull/5873 Reviewed By: svcscm Differential Revision: D2926901 Pulled By: androidtrunkagent fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1 shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1 --- .travis.yml | 20 +--- .../Animated/src/AnimatedImplementation.js | 2 +- Libraries/Components/ScrollView/ScrollView.js | 2 +- .../PushNotificationIOS.js | 2 +- Libraries/ReactIOS/NativeMethodsMixin.js | 6 +- Libraries/Utilities/AlertIOS.js | 2 +- .../browser/eventPlugins/PanResponder.js | 2 +- circle.yml | 16 +++ docs/AndroidUIPerformance.md | 24 ++--- docs/Animations.md | 18 ++-- docs/CommunicationIOS.md | 12 +-- docs/DevelopmentSetupAndroid.md | 4 +- docs/DirectManipulation.md | 2 +- docs/EmbeddedAppAndroid.md | 2 +- docs/EmbeddedAppIOS.md | 4 +- docs/GestureResponderSystem.md | 2 +- docs/GettingStarted.md | 8 +- docs/Images.md | 2 +- docs/KnownIssues.md | 4 +- docs/LinkingLibraries.md | 6 +- docs/NavigatorComparison.md | 4 +- docs/Performance.md | 2 +- docs/RunningOnDeviceIOS.md | 2 +- docs/SignedAPKAndroid.md | 2 +- docs/Style.md | 12 +-- docs/Troubleshooting.md | 2 +- docs/Tutorial.md | 18 ++-- docs/Upgrading.md | 2 +- website/.gitignore | 1 + website/README.md | 10 +- website/core/DocsSidebar.js | 2 +- website/core/HeaderLinks.js | 6 +- website/core/Site.js | 15 ++- website/layout/AutodocsLayout.js | 4 +- website/package.json | 6 +- website/publish-android.sh | 36 ------- website/publish-gh-pages.js | 99 +++++++++++++++++++ website/publish.sh | 33 ------- website/server/convert.js | 11 +++ website/server/extractDocs.js | 2 +- website/server/generate.js | 3 +- website/src/react-native/circle.yml | 4 + website/src/react-native/css/react-native.css | 2 +- website/src/react-native/index.js | 2 +- 44 files changed, 234 insertions(+), 186 deletions(-) delete mode 100755 website/publish-android.sh create mode 100644 website/publish-gh-pages.js delete mode 100755 website/publish.sh create mode 100644 website/src/react-native/circle.yml diff --git a/.travis.yml b/.travis.yml index 9b10d721b5b2eb..c1d47f6c00f63f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,24 +42,11 @@ script: npm test -- '\/(local|private|react-native)-cli\/' - elif [ "$TEST_TYPE" = build_website ] - then - - cd website - $(which npm) install - ./setup.sh - if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then - # Automatically publish the website - echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc - ./publish.sh - else - # Make sure the website builds without error - node server/generate.js - fi - elif [ "$TEST_TYPE" = e2e ] then + ./scripts/e2e-test.sh + else echo "Unknown test type: $TEST_TYPE" exit 1 @@ -71,11 +58,8 @@ env: - TEST_TYPE=js - TEST_TYPE=packager - TEST_TYPE=cli - - TEST_TYPE=build_website - TEST_TYPE=e2e global: - # $GITHUB_TOKEN - - secure: "HlmG8M2DmBUSBh6KH1yVIe/8gR4iibg4WfcHq1x/xYQxGbvleq7NOo04V6eFHnl9cvZCu+PKH0841WLnGR7c4BBf47GVu/o16nXzggPumHKy++lDzxFPlJ1faMDfjg/5vjbAxRUe7D3y98hQSeGHH4tedc8LvTaFLVu7iiGqvjU=" # $APPETIZE_TOKEN - secure: "egsvVSpszTzrNd6bN62DsVAzMiSZI/OHgdizfPryqvqWBf655ztE6XFQSEFNpuIAzSKDDF25ioT8iPfVsbC1iK6HDWHfmqYxML0L+OoU0gi+hV2oKUBFZDZ1fwSnFoWuBdNdMDpLlUxvJp6N1WyfNOB2dxuZUt8eTt48Hi3+Hpc=" # $S3_TOKEN diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index 3d70feef8b387e..01b701a7770652 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -1556,7 +1556,7 @@ var event = function( * interaction patterns, like drag-and-drop. * * You can see more example usage in `AnimationExample.js`, the Gratuitous - * Animation App, and [Animations documentation guide](http://facebook.github.io/react-native/docs/animations.html). + * Animation App, and [Animations documentation guide](docs/animations.html). * * Note that `Animated` is designed to be fully serializable so that animations * can be run in a high performance way, independent of the normal JavaScript diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index cb07b740918d7f..bdc8978e5166b1 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -315,7 +315,7 @@ var ScrollView = React.createClass({ * A RefreshControl component, used to provide pull-to-refresh * functionality for the ScrollView. * - * See [RefreshControl](http://facebook.github.io/react-native/docs/refreshcontrol.html). + * See [RefreshControl](docs/refreshcontrol.html). */ refreshControl: PropTypes.element, diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index 189bc7ead83a60..a4adace18ac8ad 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -30,7 +30,7 @@ var DEVICE_LOCAL_NOTIF_EVENT = 'localNotificationReceived'; * To get up and running, [configure your notifications with Apple](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW6) * and your server-side system. To get an idea, [this is the Parse guide](https://parse.com/tutorials/ios-push-notifications). * - * [Manually link](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#manual-linking) the PushNotificationIOS library + * [Manually link](docs/linking-libraries-ios.html#manual-linking) the PushNotificationIOS library * * - Be sure to add the following to your `Header Search Paths`: * `$(SRCROOT)/../node_modules/react-native/Libraries/PushNotificationIOS` diff --git a/Libraries/ReactIOS/NativeMethodsMixin.js b/Libraries/ReactIOS/NativeMethodsMixin.js index 33b99994a72d17..c288ea8a01b03c 100644 --- a/Libraries/ReactIOS/NativeMethodsMixin.js +++ b/Libraries/ReactIOS/NativeMethodsMixin.js @@ -56,7 +56,7 @@ function warnForStyleProps(props, validAttributes) { * composite components that aren't directly backed by a native view. This will * generally include most components that you define in your own app. For more * information, see [Direct - * Manipulation](/react-native/docs/direct-manipulation.html). + * Manipulation](docs/direct-manipulation.html). */ var NativeMethodsMixin = { /** @@ -74,7 +74,7 @@ var NativeMethodsMixin = { * Note that these measurements are not available until after the rendering * has been completed in native. If you need the measurements as soon as * possible, consider using the [`onLayout` - * prop](/react-native/docs/view.html#onlayout) instead. + * prop](docs/view.html#onlayout) instead. */ measure: function(callback: MeasureOnSuccessCallback) { UIManager.measure( @@ -108,7 +108,7 @@ var NativeMethodsMixin = { * This function sends props straight to native. They will not participate in * future diff process - this means that if you do not include them in the * next render, they will remain active (see [Direct - * Manipulation](/react-native/docs/direct-manipulation.html)). + * Manipulation](docs/direct-manipulation.html)). */ setNativeProps: function(nativeProps: Object) { if (__DEV__) { diff --git a/Libraries/Utilities/AlertIOS.js b/Libraries/Utilities/AlertIOS.js index ec8c926c6edb15..1da237b0c23e5f 100644 --- a/Libraries/Utilities/AlertIOS.js +++ b/Libraries/Utilities/AlertIOS.js @@ -45,7 +45,7 @@ type ButtonsArray = Array<{ class AlertIOS { /** * Creates a popup to alert the user. See - * [Alert](/react-native/docs/alert.html). + * [Alert](docs/alert.html). * * - title: string -- The dialog's title. * - message: string -- An optional message that appears above the text input. diff --git a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js index 36490a84302696..c633dd724be79f 100644 --- a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js +++ b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js @@ -23,7 +23,7 @@ var currentCentroidY = TouchHistoryMath.currentCentroidY; * recognize simple multi-touch gestures. * * It provides a predictable wrapper of the responder handlers provided by the - * [gesture responder system](/react-native/docs/gesture-responder-system.html). + * [gesture responder system](docs/gesture-responder-system.html). * For each handler, it provides a new `gestureState` object alongside the * native event object: * diff --git a/circle.yml b/circle.yml index 7ea22ee0edadea..7d396cc43eef4b 100644 --- a/circle.yml +++ b/circle.yml @@ -26,12 +26,15 @@ dependencies: - npm install -g npm@3.2 - source scripts/circle-ci-android-setup.sh && getAndroidSDK - ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog + - cd website && npm install cache_directories: - "ReactAndroid/build/downloads" - "buck" - "buck-out/bin" + - "website/node_modules" override: - npm install + test: pre: # starting emulator in advance because it takes very long to boot @@ -41,6 +44,7 @@ test: - ./gradlew :ReactAndroid:assembleDebug -PdisablePreDex -Pjobs=1: timeout: 360 - source scripts/circle-ci-android-setup.sh && waitForAVD + override: # buck tests - buck/bin/buck test ReactAndroid/src/test/... --config build.threads=1 @@ -57,9 +61,21 @@ test: # run tests on the emulator - ./gradlew :ReactAndroid:connectedAndroidTest -PdisablePreDex --stacktrace --info: timeout: 360 + + # testing docs generation is not broken + - cd website && node ./server/generate.js post: # copy test report for Circle CI to display - mkdir -p $CIRCLE_TEST_REPORTS/junit/ - find . -type f -regex ".*/build/test-results/debug/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; - find . -type f -regex ".*/outputs/androidTest-results/connected/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; +deployment: + website: + branch: [/.*-stable/, /master/] + commands: + # generate docs website + - git config --global user.email "bestnader@fb.com" + - git config --global user.name "Website Deployment Script" + - echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" > ~/.netrc + - cd website && GIT_USER=bestander npm run gh-pages diff --git a/docs/AndroidUIPerformance.md b/docs/AndroidUIPerformance.md index 321bb0c46bfe7a..3dc51532dc38eb 100644 --- a/docs/AndroidUIPerformance.md +++ b/docs/AndroidUIPerformance.md @@ -43,7 +43,7 @@ Once the trace starts collecting, perform the animation or interaction you care After opening the trace in your browser (preferably Chrome), you should see something like this: -![Example](/react-native/img/SystraceExample.png) +![Example](img/SystraceExample.png) **HINT**: Use the WASD keys to strafe and zoom @@ -51,7 +51,7 @@ After opening the trace in your browser (preferably Chrome), you should see some The first thing you should do is highlight the 16ms frame boundaries if you haven't already done that. Check this checkbox at the top right of the screen: -![Enable VSync Highlighting](/react-native/img/SystraceHighlightVSync.png) +![Enable VSync Highlighting](img/SystraceHighlightVSync.png) You should see zebra stripes as in the screenshot above. If you don't, try profiling on a different device: Samsung has been known to have issues displaying vsyncs while the Nexus series is generally pretty reliable. @@ -65,43 +65,43 @@ On the left side, you'll see a set of threads which correspond to the timeline r This is where standard android measure/layout/draw happens. The thread name on the right will be your package name (in my case book.adsmanager) or UI Thread. The events that you see on this thread should look something like this and have to do with `Choreographer`, `traversals`, and `DispatchUI`: -![UI Thread Example](/react-native/img/SystraceUIThreadExample.png) +![UI Thread Example](img/SystraceUIThreadExample.png) ### JS Thread This is where JS is executed. The thread name will be either `mqt_js` or `<...>` depending on how cooperative the kernel on your device is being. To identify it if it doesn't have a name, look for things like `JSCall`, `Bridge.executeJSCall`, etc: -![JS Thread Example](/react-native/img/SystraceJSThreadExample.png) +![JS Thread Example](img/SystraceJSThreadExample.png) ### Native Modules Thread This is where native module calls (e.g. the `UIManager`) are executed. The thread name will be either `mqt_native_modules` or `<...>`. To identify it in the latter case, look for things like `NativeCall`, `callJavaModuleMethod`, and `onBatchComplete`: -![Native Modules Thread Example](/react-native/img/SystraceNativeModulesThreadExample.png) +![Native Modules Thread Example](img/SystraceNativeModulesThreadExample.png) ### Bonus: Render Thread If you're using Android L (5.0) and up, you will also have a render thread in your application. This thread generates the actual OpenGL commands used to draw your UI. The thread name will be either `RenderThread` or `<...>`. To identify it in the latter case, look for things like `DrawFrame` and `queueBuffer`: -![Render Thread Example](/react-native/img/SystraceRenderThreadExample.png) +![Render Thread Example](img/SystraceRenderThreadExample.png) ## Identifying a culprit A smooth animation should look something like the following: -![Smooth Animation](/react-native/img/SystraceWellBehaved.png) +![Smooth Animation](img/SystraceWellBehaved.png) Each change in color is a frame -- remember that in order to display a frame, all our UI work needs to be done by the end of that 16ms period. Notice that no thread is working close to the frame boundary. An application rendering like this is rendering at 60FPS. If you noticed chop, however, you might see something like this: -![Choppy Animation from JS](/react-native/img/SystraceBadJS.png) +![Choppy Animation from JS](img/SystraceBadJS.png) Notice that the JS thread is executing basically all the time, and across frame boundaries! This app is not rendering at 60FPS. In this case, **the problem lies in JS**. You might also see something like this: -![Choppy Animation from UI](/react-native/img/SystraceBadUI.png) +![Choppy Animation from UI](img/SystraceBadUI.png) In this case, the UI and render threads are the ones that have work crossing frame boundaries. The UI that we're trying to render on each frame is requiring too much work to be done. In this case, **the problem lies in the native views being rendered**. @@ -111,7 +111,7 @@ At this point, you'll have some very helpful information to inform your next ste If you identified a JS problem, look for clues in the specific JS that you're executing. In the scenario above, we see `RCTEventEmitter` being called multiple times per frame. Here's a zoom-in of the JS thread from the trace above: -![Too much JS](/react-native/img/SystraceBadJS2.png) +![Too much JS](img/SystraceBadJS2.png) This doesn't seem right. Why is it being called so often? Are they actually different events? The answers to these questions will probably depend on your product code. And many times, you'll want to look into [shouldComponentUpdate](https://facebook.github.io/react/docs/component-specs.html#updating-shouldcomponentupdate). @@ -128,7 +128,7 @@ If you identified a native UI problem, there are usually two scenarios: In the first scenario, you'll see a trace that has the UI thread and/or Render Thread looking like this: -![Overloaded GPU](/react-native/img/SystraceBadUI.png) +![Overloaded GPU](img/SystraceBadUI.png) Notice the long amount of time spent in `DrawFrame` that crosses frame boundaries. This is time spent waiting for the GPU to drain its command buffer from the previous frame. @@ -143,7 +143,7 @@ If these don't help and you want to dig deeper into what the GPU is actually doi In the second scenario, you'll see something more like this: -![Creating Views](/react-native/img/SystraceBadCreateUI.png) +![Creating Views](img/SystraceBadCreateUI.png) Notice that first the JS thread thinks for a bit, then you see some work done on the native modules thread, followed by an expensive traversal on the UI thread. diff --git a/docs/Animations.md b/docs/Animations.md index af8d0031ca1ff9..15dac519b865ca 100644 --- a/docs/Animations.md +++ b/docs/Animations.md @@ -267,7 +267,7 @@ it provides much less control than `Animated` and other animation libraries, so you may need to use another approach if you can't get `LayoutAnimation` to do what you want. -![](/react-native/img/LayoutAnimationExample.gif) +![](img/LayoutAnimationExample.gif) ```javascript var App = React.createClass({ @@ -376,7 +376,7 @@ var App = React.createClass({ ``` [Run this example](https://rnplay.org/apps/4FUQ-A) -![](/react-native/img/TweenState.gif) +![](img/TweenState.gif) Here we animated the opacity, but as you might guess, we can animate any numeric value. Read more about react-tween-state in its @@ -395,7 +395,7 @@ value and end value. Rebound [is used internally](https://github.com/facebook/react-native/search?utf8=%E2%9C%93&q=rebound) by React Native on `Navigator` and `WarningBox`. -![](/react-native/img/ReboundImage.gif) +![](img/ReboundImage.gif) Notice that Rebound animations can be interrupted - if you release in the middle of a press, it will animate back from the current state to @@ -440,7 +440,7 @@ var App = React.createClass({ transform: [{scaleX: this.state.scale}, {scaleY: this.state.scale}], }; - var imageUri = "https://facebook.github.io/react-native/img/ReboundExample.png"; + var imageUri = "img/ReboundExample.png"; return ( @@ -461,13 +461,13 @@ oscillate around the end value. In the above example, we would add See the below gif for an example of where in your interface you might use this. -![](/react-native/img/Rebound.gif) Screenshot from +![](img/Rebound.gif) Screenshot from [react-native-scrollable-tab-view](https://github.com/brentvatne/react-native-scrollable-tab-view). You can run a similar example [here](https://rnplay.org/apps/qHU_5w). #### A sidenote about setNativeProps -As mentioned [in the Direction Manipulation section](/react-native/docs/direct-manipulation.html), +As mentioned [in the Direction Manipulation section](docs/direct-manipulation.html), `setNativeProps` allows us to modify properties of native-backed components (components that are actually backed by native views, unlike composite components) directly, without having to `setState` and @@ -497,7 +497,7 @@ render: function() { this._photo = component} - source={{uri: "https://facebook.github.io/react-native/img/ReboundExample.png"}} + source={{uri: "img/ReboundExample.png"}} style={{width: 250, height: 200}} /> @@ -516,14 +516,14 @@ frames per second), look into using `setNativeProps` or `shouldComponentUpdate` to optimize them. You may also want to defer any computationally intensive work until after animations are complete, using the -[InteractionManager](/react-native/docs/interactionmanager.html). You +[InteractionManager](docs/interactionmanager.html). You can monitor the frame rate by using the In-App Developer Menu "FPS Monitor" tool. ### Navigator Scene Transitions As mentioned in the [Navigator -Comparison](https://facebook.github.io/react-native/docs/navigator-comparison.html#content), +Comparison](docs/navigator-comparison.html#content), `Navigator` is implemented in JavaScript and `NavigatorIOS` is a wrapper around native functionality provided by `UINavigationController`, so these scene transitions apply only to `Navigator`. In order to re-create diff --git a/docs/CommunicationIOS.md b/docs/CommunicationIOS.md index 3e430636f05b2c..dae65bc2737e24 100644 --- a/docs/CommunicationIOS.md +++ b/docs/CommunicationIOS.md @@ -7,7 +7,7 @@ permalink: docs/communication-ios.html next: native-modules-android --- -In [Integrating with Existing Apps guide](http://facebook.github.io/react-native/docs/embedded-app-ios.html) and [Native UI Components guide](https://facebook.github.io/react-native/docs/native-components-ios.html) we learn how to embed React Native in a native component and vice versa. When we mix native and React Native components, we'll eventually find a need to communicate between these two worlds. Some ways to achieve that have been already mentioned in other guides. This article summarizes available techniques. +In [Integrating with Existing Apps guide](docs/embedded-app-ios.html) and [Native UI Components guide](docs/native-components-ios.html) we learn how to embed React Native in a native component and vice versa. When we mix native and React Native components, we'll eventually find a need to communicate between these two worlds. Some ways to achieve that have been already mentioned in other guides. This article summarizes available techniques. ## Introduction @@ -80,13 +80,13 @@ There is no way to update only a few properties at a time. We suggest that you b > Currently, JS functions `componentWillReceiveProps` and `componentWillUpdateProps` of the top level RN component will not be called after a prop update. However, you can access the new props in `componentWillMount` function. ### Passing properties from React Native to native -The problem exposing properties of native components is covered in detail in [this article](https://facebook.github.io/react-native/docs/native-components-ios.html#properties). In short, export properties with `RCT_CUSTOM_VIEW_PROPERTY` macro in your custom native component, then just use them in React Native as if the component was an ordinary React Native component. +The problem exposing properties of native components is covered in detail in [this article](docs/native-components-ios.html#properties). In short, export properties with `RCT_CUSTOM_VIEW_PROPERTY` macro in your custom native component, then just use them in React Native as if the component was an ordinary React Native component. ### Limits of properties The main drawback of cross-language properties is that they do not support callbacks, which would allow us to handle bottom-up data bindings. Imagine you have a small RN view that you want to be removed from the native parent view as a result of a JS action. There is no way to do that with props, as the information would need to go bottom-up. -Although we have a flavor of cross-language callbacks ([described here](https://facebook.github.io/react-native/docs/native-modules-ios.html#callbacks)), these callbacks are not always the thing we need. The main problem is that they are not intended to be passed as properties. Rather, this mechanism allows us to trigger a native action from JS, and handle the result of that action in JS. +Although we have a flavor of cross-language callbacks ([described here](docs/native-modules-ios.html#callbacks)), these callbacks are not always the thing we need. The main problem is that they are not intended to be passed as properties. Rather, this mechanism allows us to trigger a native action from JS, and handle the result of that action in JS. ## Other ways of cross-language interaction (events and native modules) @@ -96,7 +96,7 @@ React Native enables you to perform cross-language function calls. You can execu ### Calling React Native functions from native (events) -Events are described in detail in [this article](http://facebook.github.io/react-native/docs/native-components-ios.html#events). Note that using events gives us no guarantees about execution time, as the event is handled on a separate thread. +Events are described in detail in [this article](docs/native-components-ios.html#events). Note that using events gives us no guarantees about execution time, as the event is handled on a separate thread. Events are powerful, because they allow us to change React Native components without needing a reference to them. However, there are some pitfalls that you can fall into while using them: @@ -108,7 +108,7 @@ The common pattern we use when embedding native in React Native is to make the n ### Calling native functions from React Native (native modules) -Native modules are Objective-C classes that are available in JS. Typically one instance of each module is created per JS bridge. They can export arbitrary functions and constants to React Native. They have been covered in detail in [this article](https://facebook.github.io/react-native/docs/native-modules-ios.html#content). +Native modules are Objective-C classes that are available in JS. Typically one instance of each module is created per JS bridge. They can export arbitrary functions and constants to React Native. They have been covered in detail in [this article](docs/native-modules-ios.html#content). The fact that native modules are singletons limits the mechanism in context of embedding. Let's say we have a React Native component embedded in a native view and we want to update the native, parent view. Using the native module mechanism, we would export a function that not only takes expected arguments, but also an identifier of the parent native view. The identifier would be used to retrieve a reference to the parent view to update. That said, we would need to keep a mapping from identifiers to native views in the module. @@ -125,7 +125,7 @@ When integrating native and React Native, we also need a way to consolidate two ### Layout of a native component embedded in React Native -This case is covered in [this article](https://facebook.github.io/react-native/docs/native-components-ios.html#styles). Basically, as all our native react views are subclasses of `UIView`, most style and size attributes will work like you would expect out of the box. +This case is covered in [this article](docs/native-components-ios.html#styles). Basically, as all our native react views are subclasses of `UIView`, most style and size attributes will work like you would expect out of the box. ### Layout of a React Native component embedded in native diff --git a/docs/DevelopmentSetupAndroid.md b/docs/DevelopmentSetupAndroid.md index eab90e85a87541..9eee7608851994 100644 --- a/docs/DevelopmentSetupAndroid.md +++ b/docs/DevelopmentSetupAndroid.md @@ -55,7 +55,7 @@ React Native Android use [gradle](https://docs.gradle.org) as a build system. We * Android Support Repository 2. Click "Install Packages" -![SDK Manager window](/react-native/img/AndroidSDK1.png) ![SDK Manager window](/react-native/img/AndroidSDK2.png) +![SDK Manager window](img/AndroidSDK1.png) ![SDK Manager window](img/AndroidSDK2.png) ### Install Genymotion @@ -75,7 +75,7 @@ Genymotion is much easier to set up than stock Google emulators. However, it's o 3. [Configure hardware acceleration (HAXM)](http://developer.android.com/tools/devices/emulator.html#vm-mac), otherwise the emulator is going to be slow. 4. Create an Android Virtual Device (AVD): 1. Run `android avd` and click on **Create...** - ![Create AVD dialog](/react-native/img/CreateAVD.png) + ![Create AVD dialog](img/CreateAVD.png) 2. With the new AVD selected, click `Start...` 5. To bring up the developer menu press F2 (or install [Frappé](http://getfrappe.com)) diff --git a/docs/DirectManipulation.md b/docs/DirectManipulation.md index a47a39fe2cbdb1..3c6fd46ed930d6 100644 --- a/docs/DirectManipulation.md +++ b/docs/DirectManipulation.md @@ -156,7 +156,7 @@ view using `{...this.props}`. The reason for this is that `TouchableOpacity` is actually a composite component, and so in addition to depending on `setNativeProps` on its child, it also requires that the child perform touch handling. To do this, it passes on [various -props](https://facebook.github.io/react-native/docs/view.html#onmoveshouldsetresponder) +props](docs/view.html#onmoveshouldsetresponder) that call back to the `TouchableOpacity` component. `TouchableHighlight`, in contrast, is backed by a native view and only requires that we implement `setNativeProps`. diff --git a/docs/EmbeddedAppAndroid.md b/docs/EmbeddedAppAndroid.md index 88122d52ac86c0..eb8cc6fb4a4589 100644 --- a/docs/EmbeddedAppAndroid.md +++ b/docs/EmbeddedAppAndroid.md @@ -166,7 +166,7 @@ To run your app, you need to first start the development server. To do this, sim Now build and run your Android app as normal (e.g. `./gradlew installDebug`). Once you reach your React-powered activity inside the app, it should load the JavaScript code from the development server and display: -![Screenshot](/react-native/img/EmbeddedAppAndroid.png) +![Screenshot](img/EmbeddedAppAndroid.png) ## Sharing a ReactInstance across multiple Activities / Fragments in your app diff --git a/docs/EmbeddedAppIOS.md b/docs/EmbeddedAppIOS.md index 2082070ba16f1e..294d4b7fe30aee 100644 --- a/docs/EmbeddedAppIOS.md +++ b/docs/EmbeddedAppIOS.md @@ -98,7 +98,7 @@ React.AppRegistry.registerComponent('SimpleApp', () => SimpleApp); You should now add a container view for the React Native component. It can be any `UIView` in your app. -![Container view example](/react-native/img/EmbeddedAppContainerViewExample.png) +![Container view example](img/EmbeddedAppContainerViewExample.png) However, let's subclass `UIView` for the sake of clean code. Let's name it `ReactView`. Open up `Yourproject.xcworkspace` and create a new class `ReactView` (You can name it whatever you like :)). @@ -186,7 +186,7 @@ If you don't do this, you will see the error - `Could not connect to development Now compile and run your app. You shall now see your React Native app running inside of the `ReactView`. -![Example](/react-native/img/EmbeddedAppExample.png) +![Example](img/EmbeddedAppExample.png) Live reload and all of the debugging tools will work from the simulator (make sure that DEBUG=1 is set under Build Settings -> Preprocessor Macros). You've got a simple React component totally encapsulated behind an Objective-C `UIView` subclass. diff --git a/docs/GestureResponderSystem.md b/docs/GestureResponderSystem.md index 2c83274350c755..b7c8dbc40e19ee 100644 --- a/docs/GestureResponderSystem.md +++ b/docs/GestureResponderSystem.md @@ -68,4 +68,4 @@ However, sometimes a parent will want to make sure that it becomes responder. Th ### PanResponder -For higher-level gesture interpretation, check out [PanResponder](/react-native/docs/panresponder.html). +For higher-level gesture interpretation, check out [PanResponder](docs/panresponder.html). diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index cc83191d1140bc..dcee2490ad53f9 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -27,7 +27,7 @@ We recommend periodically running `brew update && brew upgrade` to keep your pro To write React Native apps for Android, you will need to install the Android SDK (and an Android emulator if you want to work on your app without having to use a physical device). See [Android setup guide](android-setup.html) for instructions on how to set up your Android environment. -_NOTE:_ There is experimental [Windows and Linux support](/react-native/docs/linux-windows-support.html) for Android development. +_NOTE:_ There is experimental [Windows and Linux support](docs/linux-windows-support.html) for Android development. ## Quick start @@ -41,7 +41,7 @@ _NOTE:_ There is experimental [Windows and Linux support](/react-native/docs/lin - Open `index.ios.js` in your text editor of choice and edit some lines. - Hit ⌘-R in your iOS simulator to reload the app and see your change! -_Note: If you are using an iOS device, see the [Running on iOS Device page](http://facebook.github.io/react-native/docs/running-on-device-ios.html#content)._ +_Note: If you are using an iOS device, see the [Running on iOS Device page](docs/running-on-device-ios.html#content)._ **To run the Android app:** @@ -51,11 +51,11 @@ _Note: If you are using an iOS device, see the [Running on iOS Device page](http - Press the menu button (F2 by default, or ⌘-M in Genymotion) and select *Reload JS* to see your change! - Run `adb logcat *:S ReactNative:V ReactNativeJS:V` in a terminal to see your app's logs -_Note: If you are using an Android device, see the [Running on Android Device page](http://facebook.github.io/react-native/docs/running-on-device-android.html#content)._ +_Note: If you are using an Android device, see the [Running on Android Device page](docs/running-on-device-android.html#content)._ Congratulations! You've successfully run and modified your first React Native app. -_If you run into any issues getting started, see the [troubleshooting page](/react-native/docs/troubleshooting.html#content)._ +_If you run into any issues getting started, see the [troubleshooting page](docs/troubleshooting.html#content)._ ## Adding Android to an existing React Native project diff --git a/docs/Images.md b/docs/Images.md index 12ab24fe2fdf79..7685626eb37b3b 100644 --- a/docs/Images.md +++ b/docs/Images.md @@ -90,7 +90,7 @@ Many of the images you will display in your app will not be available at compile ## Local Filesystem Images -See [CameraRoll](/react-native/docs/cameraroll.html) for an example of +See [CameraRoll](docs/cameraroll.html) for an example of using local resources that are outside of `Images.xcassets`. ### Best Camera Roll Image diff --git a/docs/KnownIssues.md b/docs/KnownIssues.md index a3deb731978395..8a2616c023ff16 100644 --- a/docs/KnownIssues.md +++ b/docs/KnownIssues.md @@ -38,7 +38,7 @@ PushNotificationIOS ### Some props are only supported on one platform -There are properties that work on one platform only, either because they can inherently only be supported on that platform or because they haven't been implemented on the other platforms yet. All of these are annotated with `@platform` in JS docs and have a small badge next to them on the website. See e.g. [Image](https://facebook.github.io/react-native/docs/image.html). +There are properties that work on one platform only, either because they can inherently only be supported on that platform or because they haven't been implemented on the other platforms yet. All of these are annotated with `@platform` in JS docs and have a small badge next to them on the website. See e.g. [Image](docs/image.html). ### Platform parity @@ -62,7 +62,7 @@ Another issue with `overflow: 'hidden'` on Android: a view is not clipped by the ### View shadows -The `shadow*` [view styles](/react-native/docs/view.html#style) apply on iOS, and the `elevation` view prop is available on Android. Setting `elevation` on Android is equivalent to using the [native elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation), and has the same limitations (most significantly, it only works on Android 5.0+). Setting `elevation` on Android also affects the z-order for overlapping views. +The `shadow*` [view styles](docs/view.html#style) apply on iOS, and the `elevation` view prop is available on Android. Setting `elevation` on Android is equivalent to using the [native elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation), and has the same limitations (most significantly, it only works on Android 5.0+). Setting `elevation` on Android also affects the z-order for overlapping views. ### Android M permissions diff --git a/docs/LinkingLibraries.md b/docs/LinkingLibraries.md index 8fc6fe6e582b34..0ce0849531a481 100644 --- a/docs/LinkingLibraries.md +++ b/docs/LinkingLibraries.md @@ -65,7 +65,7 @@ folder. Drag this file to your project on Xcode (usually under the `Libraries` group on Xcode); -![](/react-native/img/AddToLibraries.png) +![](img/AddToLibraries.png) #### Step 2 @@ -73,7 +73,7 @@ Click on your main project file (the one that represents the `.xcodeproj`) select `Build Phases` and drag the static library from the `Products` folder inside the Library you are importing to `Link Binary With Libraries` -![](/react-native/img/AddToBuildPhases.png) +![](img/AddToBuildPhases.png) #### Step 3 @@ -97,4 +97,4 @@ Paths`. There you should include the path to your library (if it has relevant files on subdirectories remember to make it `recursive`, like `React` on the example). -![](/react-native/img/AddToSearchPaths.png) +![](img/AddToSearchPaths.png) diff --git a/docs/NavigatorComparison.md b/docs/NavigatorComparison.md index cc6c5c6c8bbdcf..80262d1a358d86 100644 --- a/docs/NavigatorComparison.md +++ b/docs/NavigatorComparison.md @@ -7,8 +7,8 @@ permalink: docs/navigator-comparison.html next: known-issues --- -The differences between [Navigator](/react-native/docs/navigator.html) -and [NavigatorIOS](/react-native/docs/navigatorios.html) are a common +The differences between [Navigator](docs/navigator.html) +and [NavigatorIOS](docs/navigatorios.html) are a common source of confusion for newcomers. Both `Navigator` and `NavigatorIOS` are components that allow you to diff --git a/docs/Performance.md b/docs/Performance.md index 1dfbb544445cc4..efded189650c07 100644 --- a/docs/Performance.md +++ b/docs/Performance.md @@ -72,7 +72,7 @@ out of the box than `Navigator`. The reason for this is that the animations for the transitions are done entirely on the main thread, and so they are not interrupted by frame drops on the JavaScript thread. ([Read about why you should probably use Navigator -anyways.](/react-native/docs/navigator-comparison.html)) +anyways.](docs/navigator-comparison.html)) Similarly, you can happily scroll up and down through a ScrollView when the JavaScript thread is locked up because the ScrollView lives on the diff --git a/docs/RunningOnDeviceIOS.md b/docs/RunningOnDeviceIOS.md index c90f3b04ed887a..619b048fcea22d 100644 --- a/docs/RunningOnDeviceIOS.md +++ b/docs/RunningOnDeviceIOS.md @@ -31,7 +31,7 @@ When you run your app on device, we pack all the JavaScript code and the images ## Disabling in-app developer menu -When building your app for production, your app's scheme should be set to `Release` as detailed in [the debugging documentation](/react-native/docs/debugging.html#debugging-react-native-apps) in order to disable the in-app developer menu. +When building your app for production, your app's scheme should be set to `Release` as detailed in [the debugging documentation](docs/debugging.html#debugging-react-native-apps) in order to disable the in-app developer menu. ## Troubleshooting diff --git a/docs/SignedAPKAndroid.md b/docs/SignedAPKAndroid.md index d35e95d82d9da6..b32defa06eaf1a 100644 --- a/docs/SignedAPKAndroid.md +++ b/docs/SignedAPKAndroid.md @@ -78,7 +78,7 @@ If you need to change the way the JavaScript bundle and/or drawable resources ar #### If you *don't* have a `react.gradle` file: -You can [upgrade](/react-native/docs/upgrading.html) to the latest version of React Native to get this file. Alternatively, you can bundle the JavaScript package and drawable resources manually by doing the following in a terminal: +You can [upgrade](docs/upgrading.html) to the latest version of React Native to get this file. Alternatively, you can bundle the JavaScript package and drawable resources manually by doing the following in a terminal: ```sh $ mkdir -p android/app/src/main/assets diff --git a/docs/Style.md b/docs/Style.md index 9f7229c94e2eff..fb6cb7a6dc077a 100644 --- a/docs/Style.md +++ b/docs/Style.md @@ -33,7 +33,7 @@ var styles = StyleSheet.create({ `StyleSheet.create` construct is optional but provides some key advantages. It ensures that the values are **immutable** and **opaque** by transforming them into plain numbers that reference an internal table. By putting it at the end of the file, you also ensure that they are only created once for the application and not on every render. -All the attribute names and values are a subset of what works on the web. For layout, React Native implements [Flexbox](/react-native/docs/flexbox.html). +All the attribute names and values are a subset of what works on the web. For layout, React Native implements [Flexbox](docs/flexbox.html). ## Using Styles @@ -95,8 +95,8 @@ var List = React.createClass({ You can checkout latest support of CSS Properties in following Links. -- [View Properties](/react-native/docs/view.html#style) -- [Image Properties](/react-native/docs/image.html#style) -- [Text Properties](/react-native/docs/text.html#style) -- [Flex Properties](/react-native/docs/flexbox.html#content) -- [Transform Properties](/react-native/docs/transforms.html#content) +- [View Properties](docs/view.html#style) +- [Image Properties](docs/image.html#style) +- [Text Properties](docs/text.html#style) +- [Flex Properties](docs/flexbox.html#content) +- [Transform Properties](docs/transforms.html#content) diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index 6db929a2c2782b..b0063ae19cf23a 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -78,7 +78,7 @@ pod 'React', :path => '../node_modules/react-native', :subspecs => [ ``` Next, make sure you have run `pod install` and that a `Pods/` directory has been created in your project with React installed. CocoaPods will instruct you to use the generated `.xcworkspace` file henceforth to be able to use these installed dependencies. -If you are adding React manually, make sure you have included all the relevant dependencies, like `RCTText.xcodeproj`, `RCTImage.xcodeproj` depending on the ones you are using. Next, the binaries built by these dependencies have to be linked to your app binary. Use the `Linked Frameworks and Binaries` section in the Xcode project settings. More detailed steps are here: [Linking Libraries](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content). +If you are adding React manually, make sure you have included all the relevant dependencies, like `RCTText.xcodeproj`, `RCTImage.xcodeproj` depending on the ones you are using. Next, the binaries built by these dependencies have to be linked to your app binary. Use the `Linked Frameworks and Binaries` section in the Xcode project settings. More detailed steps are here: [Linking Libraries](docs/linking-libraries-ios.html#content). ##### Argument list too long: recursive header expansion failed diff --git a/docs/Tutorial.md b/docs/Tutorial.md index b5dc1d16c084aa..1e0be8a205e6b1 100644 --- a/docs/Tutorial.md +++ b/docs/Tutorial.md @@ -16,7 +16,7 @@ We assume you have experience writing applications with React. If not, you can l ## Setup -React Native requires the basic setup explained at [React Native Getting Started](https://facebook.github.io/react-native/docs/getting-started.html#content). +React Native requires the basic setup explained at [React Native Getting Started](docs/getting-started.html#content). After installing these dependencies there are two simple commands to get a React Native project all set up for development. @@ -111,8 +111,8 @@ And lastly we need to apply this style to the Image component: Press `⌘+R` / `Reload JS` and the image should now render.
- - + +
@@ -189,8 +189,8 @@ Styling the text is pretty straightforward: Go ahead and press `⌘+R` / `Reload JS` and you'll see the updated view.
- - + +
### Fetching real data @@ -282,8 +282,8 @@ Now modify the render function to render a loading view if we don't have any mov Now press `⌘+R` / `Reload JS` and you should see "Loading movies..." until the response comes back, then it will render the first movie it fetched from Rotten Tomatoes.
- - + +
## ListView @@ -367,8 +367,8 @@ Finally, we add styles for the `ListView` component to the `styles` JS object: And here's the final result:
- - + +
There's still some work to be done to make it a fully functional app such as: adding navigation, search, infinite scroll loading, etc. Check the [Movies Example](https://github.com/facebook/react-native/tree/master/Examples/Movies) to see it all working. diff --git a/docs/Upgrading.md b/docs/Upgrading.md index 51b46bfe737e54..4034b4f731cfbf 100644 --- a/docs/Upgrading.md +++ b/docs/Upgrading.md @@ -50,7 +50,7 @@ Xcode project format is pretty complex and sometimes it's tricky to upgrade and ### From 0.13 to 0.14 -The major change in this version happened to the CLI ([see changelog](https://github.com/facebook/react-native/releases/tag/v0.14.0-rc)) and static images ([see docs](http://facebook.github.io/react-native/docs/images.html)). To use the new asset system in existing Xcode project, do the following: +The major change in this version happened to the CLI ([see changelog](https://github.com/facebook/react-native/releases/tag/v0.14.0-rc)) and static images ([see docs](docs/images.html)). To use the new asset system in existing Xcode project, do the following: Add new "Run Script" step to your project's build phases: diff --git a/website/.gitignore b/website/.gitignore index 850f11c1b9cdf5..9ece2944657e65 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -1,3 +1,4 @@ src/react-native/docs/** core/metadata.js *.log +/build/ diff --git a/website/README.md b/website/README.md index 5c162aab6feedb..3c633b91216b5e 100644 --- a/website/README.md +++ b/website/README.md @@ -17,14 +17,8 @@ Anytime you change the contents, just refresh the page and it's going to be upda # Publish the website -First setup your environment by having two folders, one `react-native` and one `react-native-gh-pages`. The publish script expects those exact names. - ```sh -./setup.sh +cd website +npm run publish-website ``` -Then, after you've done changes, just run the command and it'll automatically build the static version of the site and publish it to gh-pages. - -```sh -./publish.sh -``` diff --git a/website/core/DocsSidebar.js b/website/core/DocsSidebar.js index 2c18c7c8e75784..d8640e40d7908c 100644 --- a/website/core/DocsSidebar.js +++ b/website/core/DocsSidebar.js @@ -72,7 +72,7 @@ var DocsSidebar = React.createClass({ if (metadata.permalink.match(/^https?:/)) { return metadata.permalink; } - return '/react-native/' + metadata.permalink + '#content'; + return metadata.permalink + '#content'; }, render: function() { diff --git a/website/core/HeaderLinks.js b/website/core/HeaderLinks.js index afee22f2406be6..6feaa91940fbd5 100644 --- a/website/core/HeaderLinks.js +++ b/website/core/HeaderLinks.js @@ -14,11 +14,11 @@ var AlgoliaDocSearch = require('AlgoliaDocSearch'); var HeaderLinks = React.createClass({ linksInternal: [ - {section: 'docs', href: '/react-native/docs/getting-started.html', text: 'Docs'}, - {section: 'support', href: '/react-native/support.html', text: 'Support'}, + {section: 'docs', href: 'docs/getting-started.html', text: 'Docs'}, + {section: 'support', href: 'support.html', text: 'Support'}, {section: 'releases', href: 'https://github.com/facebook/react-native/releases', text: 'Releases'}, {section: 'newsletter', href: 'http://reactnative.cc', text: 'Newsletter'}, - {section: 'showcase', href: '/react-native/showcase.html', text: 'Showcase'}, + {section: 'showcase', href: 'showcase.html', text: 'Showcase'}, ], linksExternal: [ {section: 'github', href: 'https://github.com/facebook/react-native', text: 'GitHub'}, diff --git a/website/core/Site.js b/website/core/Site.js index c1cdc5a129e4cd..183690e919ded2 100644 --- a/website/core/Site.js +++ b/website/core/Site.js @@ -11,9 +11,12 @@ var React = require('React'); var HeaderLinks = require('HeaderLinks'); +var Metadata = require('Metadata'); var Site = React.createClass({ render: function() { + const path = Metadata.config.RN_DEPLOYMENT_PATH; + var basePath = '/react-native/' + (path ? path + '/' : ''); var title = this.props.title ? this.props.title + ' – ' : ''; var currentYear = (new Date()).getFullYear(); title += 'React Native | A framework for building native apps using React'; @@ -30,10 +33,12 @@ var Site = React.createClass({ + + - - + + @@ -43,8 +48,8 @@ var Site = React.createClass({
- - + + React Native @@ -72,7 +77,7 @@ var Site = React.createClass({ fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); `}} /> -