Skip to content

Commit d6880c9

Browse files
authored
Merge branch 'next' into remove-highlightcode-option
2 parents d4ee6e8 + 63398bd commit d6880c9

22 files changed

+199
-53
lines changed

appveyor.cleanup-cache.txt

-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@ Edit this file to trigger a cache rebuild.
22
http://help.appveyor.com/discussions/questions/1310-delete-cache
33

44
----
5-
6-
bump
7-
cya

appveyor.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
image: Visual Studio 2017
22

33
environment:
4+
APPVEYOR_SAVE_CACHE_ON_ERROR: true
45
matrix:
56
- nodejs_version: 10
6-
test_suite: "simple"
7+
test_suite: 'simple'
78
- nodejs_version: 10
8-
test_suite: "installs"
9+
test_suite: 'installs'
910
- nodejs_version: 10
10-
test_suite: "kitchensink"
11+
test_suite: 'kitchensink'
1112
- nodejs_version: 10
12-
test_suite: "kitchensink-eject"
13+
test_suite: 'kitchensink-eject'
1314
- nodejs_version: 8
14-
test_suite: "simple"
15+
test_suite: 'simple'
1516
- nodejs_version: 8
16-
test_suite: "installs"
17+
test_suite: 'installs'
1718
- nodejs_version: 8
18-
test_suite: "kitchensink"
19+
test_suite: 'kitchensink'
1920
- nodejs_version: 8
20-
test_suite: "kitchensink-eject"
21+
test_suite: 'kitchensink-eject'
2122
cache:
22-
- node_modules -> appveyor.cleanup-cache.txt
23-
- packages\react-scripts\node_modules -> appveyor.cleanup-cache.txt
23+
- '%APPDATA%\npm-cache -> appveyor.cleanup-cache.txt'
24+
- '%LOCALAPPDATA%\Yarn\Cache -> appveyor.cleanup-cache.txt'
2425

2526
clone_depth: 50
2627

2728
matrix:
2829
fast_finish: true
30+
allow_failures:
31+
- test_suite: 'installs'
2932

3033
platform:
3134
- x64
@@ -46,4 +49,5 @@ test_script:
4649
- node --version
4750
- npm --version
4851
- yarn --version
52+
- yarn cache dir
4953
- bash tasks/e2e-%test_suite%.sh

packages/babel-preset-react-app/create.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = function(api, opts, env) {
2727
var isEnvProduction = env === 'production';
2828
var isEnvTest = env === 'test';
2929
var isFlowEnabled = validateBoolOption('flow', opts.flow, true);
30+
var areHelpersEnabled = validateBoolOption('helpers', opts.helpers, true);
3031

3132
if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) {
3233
throw new Error(
@@ -113,7 +114,7 @@ module.exports = function(api, opts, env) {
113114
require('@babel/plugin-transform-runtime').default,
114115
{
115116
corejs: false,
116-
helpers: false,
117+
helpers: areHelpersEnabled,
117118
regenerator: true,
118119
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
119120
// We should turn this on once the lowest version of Node LTS

packages/babel-preset-react-app/dependencies.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
*/
77
'use strict';
88

9+
const validateBoolOption = (name, value, defaultValue) => {
10+
if (typeof value === 'undefined') {
11+
value = defaultValue;
12+
}
13+
14+
if (typeof value !== 'boolean') {
15+
throw new Error(`Preset react-app: '${name}' option must be a boolean.`);
16+
}
17+
18+
return value;
19+
};
20+
921
module.exports = function(api, opts) {
1022
if (!opts) {
1123
opts = {};
@@ -21,6 +33,7 @@ module.exports = function(api, opts) {
2133
var isEnvDevelopment = env === 'development';
2234
var isEnvProduction = env === 'production';
2335
var isEnvTest = env === 'test';
36+
var areHelpersEnabled = validateBoolOption('helpers', opts.helpers, false);
2437
if (!isEnvDevelopment && !isEnvProduction && !isEnvTest) {
2538
throw new Error(
2639
'Using `babel-preset-react-app` requires that you specify `NODE_ENV` or ' +
@@ -76,7 +89,7 @@ module.exports = function(api, opts) {
7689
require('@babel/plugin-transform-runtime').default,
7790
{
7891
corejs: false,
79-
helpers: false,
92+
helpers: areHelpersEnabled,
8093
regenerator: true,
8194
// https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules
8295
// We should turn this on once the lowest version of Node LTS

packages/babel-preset-react-app/dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
const create = require('./create');
1010

1111
module.exports = function(api, opts) {
12-
return create(api, opts, 'development');
12+
return create(api, Object.assign({ helpers: false }, opts), 'development');
1313
};

packages/babel-preset-react-app/prod.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
const create = require('./create');
1010

1111
module.exports = function(api, opts) {
12-
return create(api, opts, 'production');
12+
return create(api, Object.assign({ helpers: false }, opts), 'production');
1313
};

packages/babel-preset-react-app/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
const create = require('./create');
1010

1111
module.exports = function(api, opts) {
12-
return create(api, opts, 'test');
12+
return create(api, Object.assign({ helpers: false }, opts), 'test');
1313
};

packages/react-app-polyfill/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# react-app-polyfill
2+
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.
9+
10+
### Features
11+
12+
Each polyfill ensures the following language features are present:
13+
14+
1. `Promise` (for `async` / `await` support)
15+
1. `window.fetch` (a Promise-based way to make web requests in the browser)
16+
1. `Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`)
17+
1. `Symbol` (a built-in object used by `for...of` syntax and friends)
18+
1. `Array.from` (a built-in static method used by array spread, i.e. `[...arr]`)
19+
20+
### Entry Points
21+
22+
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+
24+
#### Internet Explorer 9
25+
26+
```js
27+
// This must be the first line in src/index.js
28+
import 'react-app-polyfill/ie9';
29+
30+
// ...
31+
```
32+
33+
#### Internet Explorer 11
34+
35+
```js
36+
// This must be the first line in src/index.js
37+
import 'react-app-polyfill/ie11';
38+
39+
// ...
40+
```

packages/react-scripts/config/polyfills.js renamed to packages/react-app-polyfill/ie11.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// @remove-on-eject-begin
21
/**
32
* Copyright (c) 2015-present, Facebook, Inc.
43
*
54
* This source code is licensed under the MIT license found in the
65
* LICENSE file in the root directory of this source tree.
76
*/
8-
// @remove-on-eject-end
97
'use strict';
108

119
if (typeof Promise === 'undefined') {
@@ -23,8 +21,7 @@ require('whatwg-fetch');
2321
// It will use the native implementation if it's present and isn't buggy.
2422
Object.assign = require('object-assign');
2523

26-
// In tests, polyfill requestAnimationFrame since jsdom doesn't provide it yet.
27-
// We don't polyfill it in the browser--this is user's responsibility.
28-
if (process.env.NODE_ENV === 'test') {
29-
require('raf').polyfill(global);
30-
}
24+
// Support for...of (a commonly used syntax feature that requires Symbols)
25+
require('core-js/es6/symbol');
26+
// Support iterable spread (...Set, ...Map)
27+
require('core-js/fn/array/from');

packages/react-app-polyfill/ie9.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
'use strict';
8+
9+
if (typeof Promise === 'undefined') {
10+
// Rejection tracking prevents a common issue where React gets into an
11+
// inconsistent state due to an error, but it gets swallowed by a Promise,
12+
// and the user has no idea what causes React's erratic future behavior.
13+
require('promise/lib/rejection-tracking').enable();
14+
window.Promise = require('promise/lib/es6-extensions.js');
15+
}
16+
17+
// fetch() polyfill for making API calls.
18+
require('whatwg-fetch');
19+
20+
// Object.assign() is commonly used with React.
21+
// It will use the native implementation if it's present and isn't buggy.
22+
Object.assign = require('object-assign');
23+
24+
// Support for...of (a commonly used syntax feature that requires Symbols)
25+
require('core-js/es6/symbol');
26+
// Support iterable spread (...Set, ...Map)
27+
require('core-js/fn/array/from');
28+
29+
// React 16+ relies on Map, Set, and requestAnimationFrame
30+
require('core-js/es6/map');
31+
require('core-js/es6/set');
32+
require('raf').polyfill(window);

packages/react-app-polyfill/jsdom.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
'use strict';
8+
9+
// fetch() polyfill for making API calls.
10+
require('whatwg-fetch');
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "react-app-polyfill",
3+
"version": "0.0.0",
4+
"description": "Polyfills for various browsers including commonly used language features",
5+
"repository": "facebook/create-react-app",
6+
"license": "MIT",
7+
"bugs": {
8+
"url": "https://github.com/facebook/create-react-app/issues"
9+
},
10+
"engines": {
11+
"node": ">=6"
12+
},
13+
"files": [
14+
"ie9.js",
15+
"ie11.js",
16+
"jsdom.js"
17+
],
18+
"dependencies": {
19+
"core-js": "2.5.7",
20+
"object-assign": "4.1.1",
21+
"promise": "8.0.2",
22+
"raf": "3.4.0",
23+
"whatwg-fetch": "3.0.0"
24+
}
25+
}

packages/react-dev-utils/browsersHelper.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const inquirer = require('inquirer');
1313
const pkgUp = require('pkg-up');
1414
const fs = require('fs');
1515

16-
const defaultBrowsers = ['>0.25%', 'not op_mini all', 'ie 11'];
16+
const defaultBrowsers = [
17+
'>0.2%',
18+
'not dead',
19+
'not ie <= 11',
20+
'not op_mini all',
21+
];
1722

1823
function shouldSetBrowsers(isInteractive) {
1924
if (!isInteractive) {

packages/react-error-overlay/webpack.config.iframe.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ module.exports = {
3232
// Dependencies
3333
{
3434
test: /\.js$/,
35+
exclude: /@babel\/runtime/,
3536
use: {
3637
loader: 'babel-loader',
3738
options: {
3839
babelrc: false,
3940
compact: false,
40-
presets: ['babel-preset-react-app/dependencies'],
41+
presets: [
42+
['babel-preset-react-app/dependencies', { helpers: true }],
43+
],
4144
},
4245
},
4346
},

packages/react-scripts/config/webpack.config.dev.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// @remove-on-eject-end
99
'use strict';
1010

11-
const autoprefixer = require('autoprefixer');
1211
const path = require('path');
1312
const webpack = require('webpack');
1413
const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -57,8 +56,11 @@ const getStyleLoaders = (cssOptions, preProcessor) => {
5756
ident: 'postcss',
5857
plugins: () => [
5958
require('postcss-flexbugs-fixes'),
60-
autoprefixer({
61-
flexbox: 'no-2009',
59+
require('postcss-preset-env')({
60+
autoprefixer: {
61+
flexbox: 'no-2009',
62+
},
63+
stage: 3,
6264
}),
6365
],
6466
},
@@ -80,10 +82,7 @@ module.exports = {
8082
devtool: 'cheap-module-source-map',
8183
// These are the "entry points" to our application.
8284
// This means they will be the "root" imports that are included in JS bundle.
83-
// The first two entry points enable "hot" CSS and auto-refreshes for JS.
8485
entry: [
85-
// We ship a few polyfills by default:
86-
require.resolve('./polyfills'),
8786
// Include an alternative client for WebpackDevServer. A client's job is to
8887
// connect to WebpackDevServer by a socket and get notified about changes.
8988
// When you save a file, the client will either apply hot updates (in case
@@ -275,6 +274,7 @@ module.exports = {
275274
// Unlike the application JS, we only compile the standard ES features.
276275
{
277276
test: /\.js$/,
277+
exclude: /@babel\/runtime/,
278278
use: [
279279
// This loader parallelizes code compilation, it is optional but
280280
// improves compile time on larger projects
@@ -290,7 +290,10 @@ module.exports = {
290290
babelrc: false,
291291
compact: false,
292292
presets: [
293-
require.resolve('babel-preset-react-app/dependencies'),
293+
[
294+
require.resolve('babel-preset-react-app/dependencies'),
295+
{ helpers: true },
296+
],
294297
],
295298
cacheDirectory: true,
296299
// Don't waste time on Gzipping the cache
@@ -303,6 +306,11 @@ module.exports = {
303306
'react-scripts',
304307
]),
305308
// @remove-on-eject-end
309+
// If an error happens in a package, it's possible to be
310+
// because it was compiled. Thus, we don't want the browser
311+
// debugger to show the original code. Instead, the code
312+
// being evaluated would be much more helpful.
313+
sourceMaps: false,
306314
},
307315
},
308316
],

0 commit comments

Comments
 (0)