react-app-polyfill 0.0.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2013-present, Facebook, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,11 +1,7 @@
1
1
  # react-app-polyfill
2
2
 
3
3
  This package includes polyfills for various browsers.
4
- It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects.<br>
5
- Please refer to its documentation:
6
-
7
- - [Getting Started](https://github.com/facebook/create-react-app/blob/master/README.md#getting-started) – How to create a new app.
8
- - [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App.
4
+ It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects.
9
5
 
10
6
  ### Features
11
7
 
@@ -17,15 +13,27 @@ Each polyfill ensures the following language features are present:
17
13
  1. `Symbol` (a built-in object used by `for...of` syntax and friends)
18
14
  1. `Array.from` (a built-in static method used by array spread, i.e. `[...arr]`)
19
15
 
20
- ### Entry Points
16
+ ### Usage
17
+
18
+ First, install the package using Yarn or npm:
19
+
20
+ ```bash
21
+ npm install react-app-polyfill
22
+ ```
23
+
24
+ or
25
+
26
+ ```bash
27
+ yarn add react-app-polyfill
28
+ ```
21
29
 
22
- There is no single entry point. You can only import individual browser support levels.
30
+ Now, you can import the entry point for the minimal version you intend to support. For example, if you import the IE9 entry point, this will include IE10 and IE11 support.
23
31
 
24
32
  #### Internet Explorer 9
25
33
 
26
34
  ```js
27
- // # index.js
28
- import 'react-app-polyfill/ie9'; // make this the first line of your application
35
+ // This must be the first line in src/index.js
36
+ import 'react-app-polyfill/ie9';
29
37
 
30
38
  // ...
31
39
  ```
@@ -33,8 +41,8 @@ import 'react-app-polyfill/ie9'; // make this the first line of your application
33
41
  #### Internet Explorer 11
34
42
 
35
43
  ```js
36
- // # index.js
37
- import 'react-app-polyfill/ie11'; // make this the first line of your application
44
+ // This must be the first line in src/index.js
45
+ import 'react-app-polyfill/ie11';
38
46
 
39
47
  // ...
40
48
  ```
package/ie9.js CHANGED
@@ -29,4 +29,4 @@ require('core-js/fn/array/from');
29
29
  // React 16+ relies on Map, Set, and requestAnimationFrame
30
30
  require('core-js/es6/map');
31
31
  require('core-js/es6/set');
32
- require('raf').polyfill(global);
32
+ require('raf').polyfill(window);
package/jsdom.js CHANGED
@@ -6,5 +6,9 @@
6
6
  */
7
7
  'use strict';
8
8
 
9
- // fetch() polyfill for making API calls.
10
- require('whatwg-fetch');
9
+ // Make sure we're in a Browser-like environment before importing polyfills
10
+ // This prevents `fetch()` from being imported in a Node test environment
11
+ if (typeof window !== 'undefined') {
12
+ // fetch() polyfill for making API calls.
13
+ require('whatwg-fetch');
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-app-polyfill",
3
- "version": "0.0.0",
3
+ "version": "0.1.3",
4
4
  "description": "Polyfills for various browsers including commonly used language features",
5
5
  "repository": "facebook/create-react-app",
6
6
  "license": "MIT",