Adds react-events package for internal testing (#15150)

* Adds react-events package for internal testing
This commit is contained in:
Dominic Gannaway 2019-03-19 15:12:45 +00:00 committed by GitHub
parent 7ad7386308
commit 55cc921c5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 129 additions and 1 deletions

View File

@ -0,0 +1,3 @@
# `react-events`
This is package is intended for use with the experimental React events API.

16
packages/react-events/index.js vendored Normal file
View File

@ -0,0 +1,16 @@
/**
* 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';
const ReactEvents = require('./src/ReactEvents');
// TODO: decide on the top-level export form.
// This is hacky but makes it work with both Rollup and Jest.
module.exports = ReactEvents.default || ReactEvents;

7
packages/react-events/npm/index.js vendored Normal file
View File

@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-events.production.min.js');
} else {
module.exports = require('./cjs/react-events.development.js');
}

View File

@ -0,0 +1,35 @@
{
"name": "react-events",
"description": "React is a JavaScript library for building user interfaces.",
"keywords": [
"react"
],
"version": "0.1.0",
"homepage": "https://reactjs.org/",
"bugs": "https://github.com/facebook/react/issues",
"license": "MIT",
"files": [
"LICENSE",
"README.md",
"build-info.json",
"cjs/",
"umd/"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/react"
},
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
"loose-envify": "^1.1.0"
},
"browserify": {
"transform": [
"loose-envify"
]
}
}

View File

@ -0,0 +1,25 @@
/**
* 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
*/
import {
REACT_EVENT_TARGET_TYPE,
REACT_EVENT_TARGET_TOUCH_HIT,
} from 'shared/ReactSymbols';
import type {ReactEventTarget} from 'shared/ReactTypes';
const TouchHitTarget: ReactEventTarget = {
$$typeof: REACT_EVENT_TARGET_TYPE,
type: REACT_EVENT_TARGET_TOUCH_HIT,
};
const ReactEvents = {
TouchHitTarget,
};
export default ReactEvents;

View File

@ -53,6 +53,11 @@ export const REACT_EVENT_TARGET_TYPE = hasSymbol
? Symbol.for('react.event_target')
: 0xead6;
// React event targets
export const REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol
? Symbol.for('react.event_target.touch_hit')
: 0xead7;
const MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
const FAUX_ITERATOR_SYMBOL = '@@iterator';

View File

@ -95,5 +95,5 @@ export type ReactEvent = {|
export type ReactEventTarget = {|
$$typeof: Symbol | number,
type: string,
type: Symbol | number,
|};

View File

@ -461,6 +461,15 @@ const bundles = [
global: 'SchedulerTracing',
externals: [],
},
/******* React Events (experimental) *******/
{
bundleTypes: [NODE_DEV, NODE_PROD, FB_WWW_DEV, FB_WWW_PROD],
moduleType: ISOMORPHIC,
entry: 'react-events',
global: 'ReactEvents',
externals: [],
},
];
// Based on deep-freeze by substack (public domain)

View File

@ -1147,6 +1147,34 @@
"packageName": "scheduler",
"size": 12088,
"gzip": 2473
},
{
"filename": "react-events.development.js",
"bundleType": "NODE_DEV",
"packageName": "react-events",
"size": 1135,
"gzip": 623
},
{
"filename": "react-events.production.min.js",
"bundleType": "NODE_PROD",
"packageName": "react-events",
"size": 448,
"gzip": 328
},
{
"filename": "ReactEvents-dev.js",
"bundleType": "FB_WWW_DEV",
"packageName": "react-events",
"size": 1106,
"gzip": 613
},
{
"filename": "ReactEvents-prod.js",
"bundleType": "FB_WWW_PROD",
"packageName": "react-events",
"size": 643,
"gzip": 377
}
]
}