webpack-dev-server 2.10.1 → 2.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/live.js DELETED
@@ -1,124 +0,0 @@
1
- 'use strict';
2
-
3
- /* eslint import/no-extraneous-dependencies: off, global-require: off */
4
-
5
- const $ = require('jquery');
6
- const stripAnsi = require('strip-ansi');
7
- const socket = require('./socket');
8
- require('./style.css');
9
-
10
- let hot = false;
11
- let currentHash = '';
12
-
13
- $(() => {
14
- $('body').html(require('./page.pug')());
15
- const status = $('#status');
16
- const okness = $('#okness');
17
- const $errors = $('#errors');
18
- const iframe = $('#iframe');
19
- const header = $('.header');
20
-
21
- const contentPage = window.location.pathname.substr('/webpack-dev-server'.length) + window.location.search;
22
-
23
- status.text('Connecting to sockjs server...');
24
- $errors.hide();
25
- iframe.hide();
26
- header.css({
27
- borderColor: '#96b5b4'
28
- });
29
-
30
- const onSocketMsg = {
31
- hot() {
32
- hot = true;
33
- iframe.attr('src', contentPage + window.location.hash);
34
- },
35
- invalid() {
36
- okness.text('');
37
- status.text('App updated. Recompiling...');
38
- header.css({
39
- borderColor: '#96b5b4'
40
- });
41
- $errors.hide();
42
- if (!hot) iframe.hide();
43
- },
44
- hash(hash) {
45
- currentHash = hash;
46
- },
47
- 'still-ok': function stillOk() {
48
- okness.text('');
49
- status.text('App ready.');
50
- header.css({
51
- borderColor: ''
52
- });
53
- $errors.hide();
54
- if (!hot) iframe.show();
55
- },
56
- ok() {
57
- okness.text('');
58
- $errors.hide();
59
- reloadApp();
60
- },
61
- warnings() {
62
- okness.text('Warnings while compiling.');
63
- $errors.hide();
64
- reloadApp();
65
- },
66
- errors: function msgErrors(errors) {
67
- status.text('App updated with errors. No reload!');
68
- okness.text('Errors while compiling.');
69
- $errors.text(`\n${stripAnsi(errors.join('\n\n\n'))}\n\n`);
70
- header.css({
71
- borderColor: '#ebcb8b'
72
- });
73
- $errors.show();
74
- iframe.hide();
75
- },
76
- close() {
77
- status.text('');
78
- okness.text('Disconnected.');
79
- $errors.text('\n\n\n Lost connection to webpack-dev-server.\n Please restart the server to reestablish connection...\n\n\n\n');
80
- header.css({
81
- borderColor: '#ebcb8b'
82
- });
83
- $errors.show();
84
- iframe.hide();
85
- }
86
- };
87
-
88
- socket('/sockjs-node', onSocketMsg);
89
-
90
- iframe.on('load', () => {
91
- status.text('App ready.');
92
- header.css({
93
- borderColor: ''
94
- });
95
- iframe.show();
96
- });
97
-
98
- function reloadApp() {
99
- if (hot) {
100
- status.text('App hot update.');
101
- try {
102
- iframe[0].contentWindow.postMessage(`webpackHotUpdate${currentHash}`, '*');
103
- } catch (e) {
104
- console.warn(e); // eslint-disable-line
105
- }
106
- iframe.show();
107
- } else {
108
- status.text('App updated. Reloading app...');
109
- header.css({
110
- borderColor: '#96b5b4'
111
- });
112
- try {
113
- let old = `${iframe[0].contentWindow.location}`;
114
- if (old.indexOf('about') === 0) old = null;
115
- iframe.attr('src', old || (contentPage + window.location.hash));
116
- if (old) {
117
- iframe[0].contentWindow.location.reload();
118
- }
119
- } catch (e) {
120
- iframe.attr('src', contentPage + window.location.hash);
121
- }
122
- }
123
- }
124
- });
package/client/page.pug DELETED
@@ -1,7 +0,0 @@
1
- .header
2
- span#okness
3
- = " "
4
- span#status
5
- pre#errors
6
- #warnings
7
- iframe#iframe(src="javascript:;" allowfullscreen)
package/client/sockjs.js DELETED
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('sockjs-client');
package/client/style.css DELETED
@@ -1,58 +0,0 @@
1
- *,
2
- *:before,
3
- *:after {
4
- -webkit-box-sizing: border-box;
5
- -moz-box-sizing: border-box;
6
- box-sizing: border-box;
7
- }
8
-
9
- body,
10
- html {
11
- margin: 0;
12
- padding: 0;
13
- height: 100%;
14
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
15
- }
16
-
17
- .header {
18
- width: 100%;
19
- height: 30px;
20
- padding: 0 10px;
21
- border-left: 10px solid #a3be8c;
22
- font-size: 12px;
23
- line-height: 30px;
24
- color: #eff1f5;
25
- background: #343d46;
26
- overflow: hidden;
27
- }
28
-
29
- #iframe {
30
- position: absolute;
31
- top: 30px;
32
- right: 0;
33
- bottom: 0;
34
- left: 0;
35
- width: 100%;
36
- height: -webkit-calc(100% - 30px);
37
- height: -moz-calc(100% - 30px);
38
- height: -ms-calc(100% - 30px);
39
- height: -o-calc(100% - 30px);
40
- height: calc(100% - 30px);
41
- border: 0;
42
- }
43
-
44
- #errors {
45
- width: 100%;
46
- margin: 0;
47
- padding: 10px;
48
- font-family: monospace;
49
- font-size: 14px;
50
- line-height: 1.4;
51
- color: #eff1f5;
52
- background: #bf616a;
53
- overflow: auto;
54
- }
55
-
56
- #okness {
57
- font-weight: bold;
58
- }
@@ -1,2 +0,0 @@
1
- require("./jquery-1.8.1");
2
- module.exports = jQuery;