From decdf93de0811025975a2647b4db245be4b5bfa3 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 5 Mar 2019 13:03:57 -0800 Subject: [PATCH] Fixed an additional unmount edge case. Moved hook into temporary package. --- packages/create-subscription/index.js | 1 - packages/react-hooks/README.md | 3 +++ packages/react-hooks/index.js | 12 ++++++++++ packages/react-hooks/npm/index.js | 7 ++++++ packages/react-hooks/package.json | 24 +++++++++++++++++++ .../useSubscription-test.internal.js | 2 +- .../src/useSubscription.js | 0 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 packages/react-hooks/README.md create mode 100644 packages/react-hooks/index.js create mode 100644 packages/react-hooks/npm/index.js create mode 100644 packages/react-hooks/package.json rename packages/{create-subscription => react-hooks}/src/__tests__/useSubscription-test.internal.js (99%) rename packages/{create-subscription => react-hooks}/src/useSubscription.js (100%) diff --git a/packages/create-subscription/index.js b/packages/create-subscription/index.js index b6e16aaee8613..314587a1351b1 100644 --- a/packages/create-subscription/index.js +++ b/packages/create-subscription/index.js @@ -10,4 +10,3 @@ 'use strict'; export * from './src/createSubscription'; -export * from './src/useSubscription'; diff --git a/packages/react-hooks/README.md b/packages/react-hooks/README.md new file mode 100644 index 0000000000000..68bb2c4a262e5 --- /dev/null +++ b/packages/react-hooks/README.md @@ -0,0 +1,3 @@ +# react-hooks + +Placeholder package. \ No newline at end of file diff --git a/packages/react-hooks/index.js b/packages/react-hooks/index.js new file mode 100644 index 0000000000000..f5030786a9639 --- /dev/null +++ b/packages/react-hooks/index.js @@ -0,0 +1,12 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +'use strict'; + +export * from './src/useSubscription'; diff --git a/packages/react-hooks/npm/index.js b/packages/react-hooks/npm/index.js new file mode 100644 index 0000000000000..a09b8cb3c55f1 --- /dev/null +++ b/packages/react-hooks/npm/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-hooks.production.min.js'); +} else { + module.exports = require('./cjs/react-hooks.development.js'); +} diff --git a/packages/react-hooks/package.json b/packages/react-hooks/package.json new file mode 100644 index 0000000000000..e08e0eaf92b31 --- /dev/null +++ b/packages/react-hooks/package.json @@ -0,0 +1,24 @@ +{ + "private": true, + "name": "react-hooks", + "description": "Reusable hooks", + "version": "16.8.3", + "repository": { + "type": "git", + "url": "https://github.com/facebook/react.git", + "directory": "packages/react-hooks" + }, + "files": [ + "LICENSE", + "README.md", + "build-info.json", + "index.js", + "cjs/" + ], + "peerDependencies": { + "react": "^16.3.0" + }, + "devDependencies": { + "rxjs": "^5.5.6" + } +} diff --git a/packages/create-subscription/src/__tests__/useSubscription-test.internal.js b/packages/react-hooks/src/__tests__/useSubscription-test.internal.js similarity index 99% rename from packages/create-subscription/src/__tests__/useSubscription-test.internal.js rename to packages/react-hooks/src/__tests__/useSubscription-test.internal.js index 0a5fbd0a317fd..3027a6c4c4466 100644 --- a/packages/create-subscription/src/__tests__/useSubscription-test.internal.js +++ b/packages/react-hooks/src/__tests__/useSubscription-test.internal.js @@ -22,7 +22,7 @@ describe('useSubscription', () => { jest.resetModules(); jest.mock('scheduler', () => require('scheduler/unstable_mock')); - useSubscription = require('create-subscription').useSubscription; + useSubscription = require('react-hooks').useSubscription; React = require('react'); ReactTestRenderer = require('react-test-renderer'); Scheduler = require('scheduler'); diff --git a/packages/create-subscription/src/useSubscription.js b/packages/react-hooks/src/useSubscription.js similarity index 100% rename from packages/create-subscription/src/useSubscription.js rename to packages/react-hooks/src/useSubscription.js