mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 21:27:46 +00:00
Create @react-native/polyfills
package.
Summary: Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D22625944 fbshipit-source-id: 1d97550c92115eb637da57e8f38c28e8139f3a8b
This commit is contained in:
parent
bbb7bef539
commit
a77f2c40d1
2
Libraries/vendor/core/ErrorUtils.js
vendored
2
Libraries/vendor/core/ErrorUtils.js
vendored
@ -8,7 +8,7 @@
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
import type {ErrorUtilsT} from '../../polyfills/error-guard';
|
||||
import type {ErrorUtilsT} from '@react-native/polyfills/error-guard';
|
||||
|
||||
/**
|
||||
* The particular require runtime that we are using looks for a global
|
||||
|
@ -21,7 +21,7 @@ module.exports = {
|
||||
),
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!(jest-)?react-native|@react-native-community)',
|
||||
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)/)',
|
||||
],
|
||||
setupFiles: [require.resolve('./jest/setup.js')],
|
||||
testEnvironment: 'node',
|
||||
|
@ -3,49 +3,46 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'transform': {
|
||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': '<rootDir>/jest/assetFileTransformer.js',
|
||||
'.*': './jest/preprocessor.js',
|
||||
},
|
||||
'setupFiles': [
|
||||
'./jest/setup.js',
|
||||
],
|
||||
'timers': 'fake',
|
||||
'testRegex': '/__tests__/.*-test\\.js$',
|
||||
'testPathIgnorePatterns': [
|
||||
'/node_modules/',
|
||||
'<rootDir>/template',
|
||||
'Libraries/Renderer',
|
||||
'RNTester/e2e',
|
||||
],
|
||||
'haste': {
|
||||
'defaultPlatform': 'ios',
|
||||
'platforms': [
|
||||
'ios',
|
||||
'android',
|
||||
],
|
||||
},
|
||||
'unmockedModulePathPatterns': [
|
||||
'node_modules/react/',
|
||||
'Libraries/Renderer',
|
||||
'promise',
|
||||
'source-map',
|
||||
'fastpath',
|
||||
'denodeify',
|
||||
'fbjs',
|
||||
],
|
||||
'testEnvironment': 'node',
|
||||
'collectCoverageFrom': [
|
||||
'Libraries/**/*.js',
|
||||
],
|
||||
'coveragePathIgnorePatterns': [
|
||||
'/__tests__/',
|
||||
'/vendor/',
|
||||
'<rootDir>/Libraries/react-native/',
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
|
||||
'<rootDir>/jest/assetFileTransformer.js',
|
||||
'.*': './jest/preprocessor.js',
|
||||
},
|
||||
setupFiles: ['./jest/setup.js'],
|
||||
timers: 'fake',
|
||||
testRegex: '/__tests__/.*-test\\.js$',
|
||||
testPathIgnorePatterns: [
|
||||
'/node_modules/',
|
||||
'<rootDir>/template',
|
||||
'Libraries/Renderer',
|
||||
'RNTester/e2e',
|
||||
],
|
||||
transformIgnorePatterns: ['node_modules/(?!@react-native/)'],
|
||||
haste: {
|
||||
defaultPlatform: 'ios',
|
||||
platforms: ['ios', 'android'],
|
||||
},
|
||||
unmockedModulePathPatterns: [
|
||||
'node_modules/react/',
|
||||
'Libraries/Renderer',
|
||||
'promise',
|
||||
'source-map',
|
||||
'fastpath',
|
||||
'denodeify',
|
||||
'fbjs',
|
||||
],
|
||||
testEnvironment: 'node',
|
||||
collectCoverageFrom: ['Libraries/**/*.js'],
|
||||
coveragePathIgnorePatterns: [
|
||||
'/__tests__/',
|
||||
'/vendor/',
|
||||
'<rootDir>/Libraries/react-native/',
|
||||
],
|
||||
};
|
||||
|
@ -12,8 +12,8 @@
|
||||
const MockNativeMethods = jest.requireActual('./MockNativeMethods');
|
||||
const mockComponent = jest.requireActual('./mockComponent');
|
||||
|
||||
jest.requireActual('../Libraries/polyfills/Object.es7.js');
|
||||
jest.requireActual('../Libraries/polyfills/error-guard');
|
||||
jest.requireActual('@react-native/polyfills/Object.es7');
|
||||
jest.requireActual('@react-native/polyfills/error-guard');
|
||||
|
||||
global.__DEV__ = true;
|
||||
|
||||
|
@ -85,9 +85,10 @@
|
||||
"react": "0.0.0-experimental-aae83a4b9"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/cli": "^4.10.0",
|
||||
"@react-native-community/cli-platform-android": "^4.10.0",
|
||||
"@react-native-community/cli-platform-ios": "^4.10.0",
|
||||
"@react-native-community/cli": "^4.10.0",
|
||||
"@react-native/polyfills": "1.0.0",
|
||||
"abort-controller": "^3.0.0",
|
||||
"anser": "^1.4.9",
|
||||
"base64-js": "^1.1.2",
|
||||
|
3
packages/polyfills/.npmignore
Normal file
3
packages/polyfills/.npmignore
Normal file
@ -0,0 +1,3 @@
|
||||
**/__mocks__/**
|
||||
**/__tests__/**
|
||||
BUCK
|
20
packages/polyfills/BUCK
Normal file
20
packages/polyfills/BUCK
Normal file
@ -0,0 +1,20 @@
|
||||
load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace")
|
||||
|
||||
yarn_workspace(
|
||||
name = "yarn-workspace",
|
||||
srcs = glob(
|
||||
[
|
||||
"**/*.js",
|
||||
"**/*.json",
|
||||
],
|
||||
exclude = [
|
||||
"**/__fixtures__/**",
|
||||
"**/__flowtests__/**",
|
||||
"**/__mocks__/**",
|
||||
"**/__tests__/**",
|
||||
"**/node_modules/**",
|
||||
"**/node_modules/.bin/**",
|
||||
],
|
||||
),
|
||||
visibility = ["PUBLIC"],
|
||||
)
|
16
packages/polyfills/index.js
Normal file
16
packages/polyfills/index.js
Normal 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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = () => [
|
||||
require.resolve('./console.js'),
|
||||
require.resolve('./error-guard.js'),
|
||||
require.resolve('./Object.es7.js'),
|
||||
];
|
10
packages/polyfills/package.json
Normal file
10
packages/polyfills/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@react-native/polyfills",
|
||||
"version": "1.0.0",
|
||||
"description": "Polyfills for React Native.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:facebook/react-native.git"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
@ -9,8 +9,4 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = () => [
|
||||
require.resolve('./Libraries/polyfills/console.js'),
|
||||
require.resolve('./Libraries/polyfills/error-guard.js'),
|
||||
require.resolve('./Libraries/polyfills/Object.es7.js'),
|
||||
];
|
||||
module.exports = require('@react-native/polyfills');
|
||||
|
@ -89,7 +89,7 @@ try {
|
||||
|
||||
const METRO_CONFIG = path.join(ROOT, 'metro.config.js');
|
||||
const RN_GET_POLYFILLS = path.join(ROOT, 'rn-get-polyfills.js');
|
||||
const RN_POLYFILLS_PATH = 'Libraries/polyfills/';
|
||||
const RN_POLYFILLS_PATH = 'packages/polyfills/';
|
||||
exec(`mkdir -p ${RN_POLYFILLS_PATH}`);
|
||||
|
||||
cp(METRO_CONFIG, '.');
|
||||
|
@ -1144,6 +1144,11 @@
|
||||
"@react-native-community/eslint-plugin@file:packages/eslint-plugin-react-native-community":
|
||||
version "1.1.0"
|
||||
|
||||
"@react-native/polyfills@1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-native/polyfills/-/polyfills-1.0.0.tgz#05bb0031533598f9458cf65a502b8df0eecae780"
|
||||
integrity sha512-0jbp4RxjYopTsIdLl+/Fy2TiwVYHy4mgeu07DG4b/LyM0OS/+lPP5c9sbnt/AMlnF6qz2JRZpPpGw1eMNS6A4w==
|
||||
|
||||
"@reactions/component@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@reactions/component/-/component-2.0.2.tgz#40f8c1c2c37baabe57a0c944edb9310dc1ec6642"
|
||||
|
Loading…
Reference in New Issue
Block a user