Skip to content

Commit f9c320f

Browse files
halfzebraEduard Kyvenko
authored and
Eduard Kyvenko
committed
fix($dependencies): Upgraded all the dependencies and swapped chai for unexpected
1 parent 495c8a3 commit f9c320f

File tree

4 files changed

+629
-302
lines changed

4 files changed

+629
-302
lines changed

config/webpackDevServer.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const errorOverlayMiddleware = require('react-error-overlay/middleware');
3+
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');
44
const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware');
55
const config = require('./webpack.config.dev');
66
const paths = require('./paths');

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
},
1919
"dependencies": {
2020
"assets-webpack-plugin": "^3.5.1",
21-
"autoprefixer": "^7.1.2",
21+
"autoprefixer": "^7.1.4",
2222
"babel-cli": "^6.26.0",
2323
"babel-core": "^6.26.0",
2424
"babel-loader": "^7.1.2",
2525
"babel-preset-es2015": "^6.24.1",
2626
"babel-preset-es2016": "^6.24.1",
2727
"babel-preset-es2017": "^6.24.1",
28-
"chalk": "^2.0.1",
28+
"chalk": "^2.1.0",
2929
"clean-webpack-plugin": "^0.1.16",
3030
"cli-table": "0.3.1",
3131
"connect-history-api-fallback": "^1.3.0",
3232
"cross-spawn": "^5.1.0",
33-
"css-loader": "^0.28.5",
33+
"css-loader": "^0.28.7",
3434
"dotenv": "^4.0.0",
3535
"elm": "^0.18.0",
3636
"elm-hot-loader": "0.5.4",
@@ -44,29 +44,29 @@
4444
"minimist": "1.2.0",
4545
"postcss-loader": "^2.0.5",
4646
"prompt": "1.0.0",
47-
"react-dev-utils": "^3.1.1",
48-
"react-error-overlay": "^1.0.10",
47+
"react-dev-utils": "^4.0.1",
48+
"react-error-overlay": "^2.0.1",
4949
"string-replace-loader": "^1.3.0",
5050
"style-loader": "^0.18.1",
5151
"sw-precache-webpack-plugin": "^0.11.4",
5252
"url-loader": "^0.5.9",
53-
"webpack": "^3.5.5",
53+
"webpack": "^3.5.6",
5454
"webpack-dev-server": "^2.7.1"
5555
},
5656
"devDependencies": {
5757
"babel-eslint": "^7.2.3",
58-
"chai": "^4.1.0",
5958
"commitizen": "^2.9.6",
6059
"cz-conventional-changelog": "^2.0.0",
6160
"dir-compare": "^1.3.0",
62-
"eslint": "^4.3.0",
63-
"eslint-plugin-prettier": "^2.1.2",
61+
"eslint": "^4.6.1",
62+
"eslint-plugin-prettier": "^2.2.0",
6463
"husky": "^0.14.3",
65-
"mocha": "^3.5.0",
64+
"mocha": "^3.5.2",
6665
"nightmare": "^2.10.0",
67-
"prettier": "^1.5.3",
66+
"prettier": "^1.6.1",
6867
"rimraf": "^2.5.4",
69-
"semantic-release": "^6.3.2"
68+
"semantic-release": "^7.0.2",
69+
"unexpected": "^10.35.0"
7070
},
7171
"engines": {
7272
"node": ">=6.0.0"
@@ -93,8 +93,8 @@
9393
"eslint": "eslint .",
9494
"prettier": "prettier --write --single-quote '{bin,config,scripts,template/src,tests}/**/*.js'",
9595
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
96-
"test": "npm run -s test:cli && npm run -s test:functional",
97-
"test:cli": "mocha tests/cliAccessibility.js --reporter spec --timeout 15000",
98-
"test:functional": "mocha tests/*.spec.js --reporter spec --timeout 15000"
96+
"test": "npm run test:cli && npm run test:functional",
97+
"test:cli": "mocha tests/cliAccessibility.js --timeout 15000",
98+
"test:functional": "mocha tests/*.spec.js --timeout 15000"
9999
}
100100
}

scripts/utils/webpackHotDevClient.js

Lines changed: 22 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -12,146 +12,29 @@
1212
var SockJS = require('sockjs-client');
1313
var stripAnsi = require('strip-ansi');
1414
var url = require('url');
15+
var launchEditorEndpoint = require('react-dev-utils/launchEditorEndpoint');
1516
var formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
16-
var Entities = require('html-entities').AllHtmlEntities;
17-
var ansiHTML = require('react-dev-utils/ansiHTML');
17+
var ErrorOverlay = require('react-error-overlay');
1818
var highlightElmCompilerErrors = require('./highlightElmCompilerErrors');
19-
var entities = new Entities();
20-
21-
function createOverlayIframe(onIframeLoad) {
22-
var iframe = document.createElement('iframe');
23-
iframe.id = 'react-dev-utils-webpack-hot-dev-client-overlay';
24-
iframe.src = 'about:blank';
25-
iframe.style.position = 'fixed';
26-
iframe.style.left = 0;
27-
iframe.style.top = 0;
28-
iframe.style.right = 0;
29-
iframe.style.bottom = 0;
30-
iframe.style.width = '100vw';
31-
iframe.style.height = '100vh';
32-
iframe.style.border = 'none';
33-
iframe.style.zIndex = 2147483647;
34-
iframe.onload = onIframeLoad;
35-
return iframe;
36-
}
37-
38-
function addOverlayDivTo(iframe) {
39-
// TODO: unify these styles with react-error-overlay
40-
iframe.contentDocument.body.style.margin = 0;
41-
iframe.contentDocument.body.style.maxWidth = '100vw';
42-
43-
var outerDiv = iframe.contentDocument.createElement('div');
44-
outerDiv.id = 'react-dev-utils-webpack-hot-dev-client-overlay-div';
45-
outerDiv.style.width = '100%';
46-
outerDiv.style.height = '100%';
47-
outerDiv.style.boxSizing = 'border-box';
48-
outerDiv.style.textAlign = 'center';
49-
outerDiv.style.backgroundColor = 'rgb(255, 255, 255)';
50-
51-
var div = iframe.contentDocument.createElement('div');
52-
div.style.position = 'relative';
53-
div.style.display = 'inline-flex';
54-
div.style.flexDirection = 'column';
55-
div.style.height = '100%';
56-
div.style.width = '1024px';
57-
div.style.maxWidth = '100%';
58-
div.style.overflowX = 'hidden';
59-
div.style.overflowY = 'auto';
60-
div.style.padding = '0.5rem';
61-
div.style.boxSizing = 'border-box';
62-
div.style.textAlign = 'left';
63-
div.style.fontFamily = 'Consolas, Menlo, monospace';
64-
div.style.fontSize = '11px';
65-
div.style.whiteSpace = 'pre-wrap';
66-
div.style.wordBreak = 'break-word';
67-
div.style.lineHeight = '1.5';
68-
div.style.color = 'rgb(41, 50, 56)';
69-
70-
outerDiv.appendChild(div);
71-
iframe.contentDocument.body.appendChild(outerDiv);
72-
return div;
73-
}
74-
75-
function overlayHeaderStyle() {
76-
return (
77-
'font-size: 2em;' +
78-
'font-family: sans-serif;' +
79-
'color: rgb(206, 17, 38);' +
80-
'white-space: pre-wrap;' +
81-
'margin: 0 2rem 0.75rem 0px;' +
82-
'flex: 0 0 auto;' +
83-
'max-height: 35%;' +
84-
'overflow: auto;'
85-
);
86-
}
87-
88-
var overlayIframe = null;
89-
var overlayDiv = null;
90-
var lastOnOverlayDivReady = null;
91-
92-
function ensureOverlayDivExists(onOverlayDivReady) {
93-
if (overlayDiv) {
94-
// Everything is ready, call the callback right away.
95-
onOverlayDivReady(overlayDiv);
96-
return;
97-
}
98-
99-
// Creating an iframe may be asynchronous so we'll schedule the callback.
100-
// In case of multiple calls, last callback wins.
101-
lastOnOverlayDivReady = onOverlayDivReady;
102-
103-
if (overlayIframe) {
104-
// We're already creating it.
105-
return;
106-
}
107-
108-
// Create iframe and, when it is ready, a div inside it.
109-
overlayIframe = createOverlayIframe(function onIframeLoad() {
110-
overlayDiv = addOverlayDivTo(overlayIframe);
111-
// Now we can talk!
112-
lastOnOverlayDivReady(overlayDiv);
113-
});
114-
115-
// Zalgo alert: onIframeLoad() will be called either synchronously
116-
// or asynchronously depending on the browser.
117-
// We delay adding it so `overlayIframe` is set when `onIframeLoad` fires.
118-
document.body.appendChild(overlayIframe);
119-
}
12019

121-
function showErrorOverlay(message) {
122-
ensureOverlayDivExists(function onOverlayDivReady(overlayDiv) {
123-
// TODO: unify this with our runtime overlay
124-
overlayDiv.innerHTML =
125-
'<div style="' +
126-
overlayHeaderStyle() +
127-
'">Failed to compile</div>' +
128-
'<pre style="' +
129-
'display: block; padding: 0.5em; margin-top: 0; ' +
130-
'margin-bottom: 0.5em; overflow-x: auto; white-space: pre-wrap; ' +
131-
'border-radius: 0.25rem; background-color: rgba(206, 17, 38, 0.05)">' +
132-
'<code style="font-family: Consolas, Menlo, monospace;">' +
133-
ansiHTML(entities.encode(message)) +
134-
'</code></pre>' +
135-
'<div style="' +
136-
'font-family: sans-serif; color: rgb(135, 142, 145); margin-top: 0.5rem; ' +
137-
'flex: 0 0 auto">' +
138-
'This error occurred during the build time and cannot be dismissed.</div>';
20+
ErrorOverlay.startReportingRuntimeErrors({
21+
launchEditorEndpoint: launchEditorEndpoint,
22+
onError: function() {
23+
// TODO: why do we need this?
24+
if (module.hot && typeof module.hot.decline === 'function') {
25+
module.hot.decline();
26+
}
27+
},
28+
filename: '/static/js/bundle.js'
29+
});
30+
31+
if (module.hot && typeof module.hot.dispose === 'function') {
32+
module.hot.dispose(function() {
33+
// TODO: why do we need this?
34+
ErrorOverlay.stopReportingRuntimeErrors();
13935
});
14036
}
14137

142-
function destroyErrorOverlay() {
143-
if (!overlayDiv) {
144-
// It is not there in the first place.
145-
return;
146-
}
147-
148-
// Clean up and reset internal state.
149-
document.body.removeChild(overlayIframe);
150-
overlayDiv = null;
151-
overlayIframe = null;
152-
lastOnOverlayDivReady = null;
153-
}
154-
15538
// Connect to WebpackDevServer via a socket.
15639
var connection = new SockJS(
15740
url.format({
@@ -199,9 +82,9 @@ function handleSuccess() {
19982
// Attempt to apply hot updates or reload.
20083
if (isHotUpdate) {
20184
tryApplyUpdates(function onHotUpdateSuccess() {
202-
// Only destroy it when we're sure it's a hot update.
85+
// Only dismiss it when we're sure it's a hot update.
20386
// Otherwise it would flicker right before the reload.
204-
destroyErrorOverlay();
87+
ErrorOverlay.dismissBuildError();
20588
});
20689
}
20790
}
@@ -241,9 +124,9 @@ function handleWarnings(warnings) {
241124
// Only print warnings if we aren't refreshing the page.
242125
// Otherwise they'll disappear right away anyway.
243126
printWarnings();
244-
// Only destroy it when we're sure it's a hot update.
127+
// Only dismiss it when we're sure it's a hot update.
245128
// Otherwise it would flicker right before the reload.
246-
destroyErrorOverlay();
129+
ErrorOverlay.dismissBuildError();
247130
});
248131
} else {
249132
// Print initial warnings immediately.
@@ -267,7 +150,7 @@ function handleErrors(errors) {
267150
);
268151

269152
// Only show the first error.
270-
showErrorOverlay(formatted.errors[0]);
153+
ErrorOverlay.reportBuildError(formatted.errors[0]);
271154

272155
// Also log them to the console.
273156
if (typeof console !== 'undefined' && typeof console.error === 'function') {

0 commit comments

Comments
 (0)