webpack-dev-server 1.15.1 → 1.16.2
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/CHANGELOG.md +36 -16
- package/README.md +23 -0
- package/bin/webpack-dev-server.js +15 -0
- package/client/index.bundle.js +3 -3
- package/client/index.js +128 -96
- package/client/live.bundle.js +4 -4
- package/client/live.html +1 -1
- package/client/live.js +129 -128
- package/client/page.jade +7 -7
- package/client/socket.js +41 -0
- package/client/style.css +58 -58
- package/client/web_modules/jquery/index.js +1 -1
- package/client/web_modules/jquery/jquery-1.8.1.js +9301 -9301
- package/client/webpack.config.js +11 -11
- package/lib/Server.js +416 -409
- package/package.json +2 -2
- package/ssl/ca.crt +13 -13
- package/ssl/ca.csr +11 -11
- package/ssl/ca.key +15 -15
- package/ssl/server.crt +13 -13
- package/ssl/server.csr +11 -11
- package/ssl/server.key +15 -15
package/client/live.js
CHANGED
|
@@ -1,128 +1,129 @@
|
|
|
1
|
-
var $ = require("jquery");
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
require("./style.css");
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
$errors.show();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
old
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
var $ = require("jquery");
|
|
2
|
+
var stripAnsi = require('strip-ansi');
|
|
3
|
+
var socket = require('./socket');
|
|
4
|
+
require("./style.css");
|
|
5
|
+
|
|
6
|
+
var hot = false;
|
|
7
|
+
var currentHash = "";
|
|
8
|
+
|
|
9
|
+
$(function() {
|
|
10
|
+
$("body").html(require("./page.jade")());
|
|
11
|
+
var status = $("#status");
|
|
12
|
+
var okness = $("#okness");
|
|
13
|
+
var $errors = $("#errors");
|
|
14
|
+
var iframe = $("#iframe");
|
|
15
|
+
var header = $(".header");
|
|
16
|
+
|
|
17
|
+
var contentPage = window.location.pathname.substr("/webpack-dev-server".length) + window.location.search;
|
|
18
|
+
|
|
19
|
+
status.text("Connecting to sockjs server...");
|
|
20
|
+
$errors.hide();
|
|
21
|
+
iframe.hide();
|
|
22
|
+
header.css({
|
|
23
|
+
borderColor: "#96b5b4"
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
var onSocketMsg = {
|
|
27
|
+
hot: function() {
|
|
28
|
+
hot = true;
|
|
29
|
+
iframe.attr("src", contentPage + window.location.hash);
|
|
30
|
+
},
|
|
31
|
+
invalid: function() {
|
|
32
|
+
okness.text("");
|
|
33
|
+
status.text("App updated. Recompiling...");
|
|
34
|
+
header.css({
|
|
35
|
+
borderColor: "#96b5b4"
|
|
36
|
+
});
|
|
37
|
+
$errors.hide();
|
|
38
|
+
if(!hot) iframe.hide();
|
|
39
|
+
},
|
|
40
|
+
hash: function(hash) {
|
|
41
|
+
currentHash = hash;
|
|
42
|
+
},
|
|
43
|
+
"still-ok": function() {
|
|
44
|
+
okness.text("");
|
|
45
|
+
status.text("App ready.");
|
|
46
|
+
header.css({
|
|
47
|
+
borderColor: ""
|
|
48
|
+
});
|
|
49
|
+
$errors.hide();
|
|
50
|
+
if(!hot) iframe.show();
|
|
51
|
+
},
|
|
52
|
+
ok: function() {
|
|
53
|
+
okness.text("");
|
|
54
|
+
$errors.hide();
|
|
55
|
+
reloadApp();
|
|
56
|
+
},
|
|
57
|
+
warnings: function() {
|
|
58
|
+
okness.text("Warnings while compiling.");
|
|
59
|
+
$errors.hide();
|
|
60
|
+
reloadApp();
|
|
61
|
+
},
|
|
62
|
+
errors: function(errors) {
|
|
63
|
+
status.text("App updated with errors. No reload!");
|
|
64
|
+
okness.text("Errors while compiling.");
|
|
65
|
+
$errors.text("\n" + stripAnsi(errors.join("\n\n\n")) + "\n\n");
|
|
66
|
+
header.css({
|
|
67
|
+
borderColor: "#ebcb8b"
|
|
68
|
+
});
|
|
69
|
+
$errors.show();
|
|
70
|
+
iframe.hide();
|
|
71
|
+
},
|
|
72
|
+
"proxy-error": function(errors) {
|
|
73
|
+
status.text("Could not proxy to content base target!");
|
|
74
|
+
okness.text("Proxy error.");
|
|
75
|
+
$errors.text("\n" + stripAnsi(errors.join("\n\n\n")) + "\n\n");
|
|
76
|
+
header.css({
|
|
77
|
+
borderColor: "#ebcb8b"
|
|
78
|
+
});
|
|
79
|
+
$errors.show();
|
|
80
|
+
iframe.hide();
|
|
81
|
+
},
|
|
82
|
+
close: function() {
|
|
83
|
+
status.text("");
|
|
84
|
+
okness.text("Disconnected.");
|
|
85
|
+
$errors.text("\n\n\n Lost connection to webpack-dev-server.\n Please restart the server to reestablish connection...\n\n\n\n");
|
|
86
|
+
header.css({
|
|
87
|
+
borderColor: "#ebcb8b"
|
|
88
|
+
});
|
|
89
|
+
$errors.show();
|
|
90
|
+
iframe.hide();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
socket("/sockjs-node", onSocketMsg);
|
|
95
|
+
|
|
96
|
+
iframe.load(function() {
|
|
97
|
+
status.text("App ready.");
|
|
98
|
+
header.css({
|
|
99
|
+
borderColor: ""
|
|
100
|
+
});
|
|
101
|
+
iframe.show();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
function reloadApp() {
|
|
105
|
+
if(hot) {
|
|
106
|
+
status.text("App hot update.");
|
|
107
|
+
try {
|
|
108
|
+
iframe[0].contentWindow.postMessage("webpackHotUpdate" + currentHash, "*");
|
|
109
|
+
} catch(e) {
|
|
110
|
+
console.warn(e);
|
|
111
|
+
}
|
|
112
|
+
iframe.show();
|
|
113
|
+
} else {
|
|
114
|
+
status.text("App updated. Reloading app...");
|
|
115
|
+
header.css({
|
|
116
|
+
borderColor: "#96b5b4"
|
|
117
|
+
});
|
|
118
|
+
try {
|
|
119
|
+
var old = iframe[0].contentWindow.location + "";
|
|
120
|
+
if(old.indexOf("about") == 0) old = null;
|
|
121
|
+
iframe.attr("src", old || (contentPage + window.location.hash));
|
|
122
|
+
old && iframe[0].contentWindow.location.reload();
|
|
123
|
+
} catch(e) {
|
|
124
|
+
iframe.attr("src", contentPage + window.location.hash);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
});
|
package/client/page.jade
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
.header
|
|
2
|
-
span#okness
|
|
3
|
-
= " "
|
|
4
|
-
span#status
|
|
5
|
-
pre#errors
|
|
6
|
-
#warnings
|
|
7
|
-
iframe#iframe(src="javascript:;" allowfullscreen)
|
|
1
|
+
.header
|
|
2
|
+
span#okness
|
|
3
|
+
= " "
|
|
4
|
+
span#status
|
|
5
|
+
pre#errors
|
|
6
|
+
#warnings
|
|
7
|
+
iframe#iframe(src="javascript:;" allowfullscreen)
|
package/client/socket.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var SockJS = require("sockjs-client");
|
|
2
|
+
|
|
3
|
+
var retries = 0;
|
|
4
|
+
var sock = null;
|
|
5
|
+
|
|
6
|
+
function socket(url, handlers) {
|
|
7
|
+
sock = new SockJS(url);
|
|
8
|
+
|
|
9
|
+
sock.onopen = function() {
|
|
10
|
+
retries = 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
sock.onclose = function() {
|
|
14
|
+
if(retries === 0)
|
|
15
|
+
handlers.close();
|
|
16
|
+
|
|
17
|
+
// Try to reconnect.
|
|
18
|
+
sock = null;
|
|
19
|
+
|
|
20
|
+
// After 10 retries stop trying, to prevent logspam.
|
|
21
|
+
if(retries <= 10) {
|
|
22
|
+
// Exponentially increase timeout to reconnect.
|
|
23
|
+
// Respectfully copied from the package `got`.
|
|
24
|
+
var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
|
|
25
|
+
retries += 1;
|
|
26
|
+
|
|
27
|
+
setTimeout(function() {
|
|
28
|
+
socket(url, handlers);
|
|
29
|
+
}, retryInMs);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
sock.onmessage = function(e) {
|
|
34
|
+
// This assumes that all data sent via the websocket is JSON.
|
|
35
|
+
var msg = JSON.parse(e.data);
|
|
36
|
+
if(handlers[msg.type])
|
|
37
|
+
handlers[msg.type](msg.data);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = socket;
|
package/client/style.css
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
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
|
+
*: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 +1,2 @@
|
|
|
1
|
-
require("./jquery-1.8.1");
|
|
1
|
+
require("./jquery-1.8.1");
|
|
2
2
|
module.exports = jQuery;
|