1
1
/* global __resourceQuery */
2
- var url = require ( ' url' ) ;
3
- var stripAnsi = require ( ' strip-ansi' ) ;
4
- var socket = require ( ' ./socket' ) ;
2
+ var url = require ( " url" ) ;
3
+ var stripAnsi = require ( " strip-ansi" ) ;
4
+ var socket = require ( " ./socket" ) ;
5
5
6
6
function getCurrentScriptSource ( ) {
7
7
// `document.currentScript` is the most accurate way to find the current script,
@@ -91,11 +91,11 @@ var onSocketMsg = {
91
91
var hostname = urlParts . hostname ;
92
92
var protocol = urlParts . protocol ;
93
93
94
- if ( urlParts . hostname === ' 0.0.0.0' ) {
94
+ if ( urlParts . hostname === " 0.0.0.0" ) {
95
95
// why do we need this check?
96
96
// hostname n/a for file protocol (example, when using electron, ionic)
97
97
// see: https://github.com/webpack/webpack-dev-server/pull/384
98
- if ( window . location . hostname && ! ! ~ window . location . protocol . indexOf ( ' http' ) ) {
98
+ if ( window . location . hostname && ! ! ~ window . location . protocol . indexOf ( " http" ) ) {
99
99
hostname = window . location . hostname ;
100
100
}
101
101
}
@@ -104,16 +104,16 @@ if(urlParts.hostname === '0.0.0.0') {
104
104
// a protocol would result in an invalid URL.
105
105
// When https is used in the app, secure websockets are always necessary
106
106
// because the browser doesn't accept non-secure websockets.
107
- if ( hostname && ( window . location . protocol === "https:" || urlParts . hostname === ' 0.0.0.0' ) ) {
107
+ if ( hostname && ( window . location . protocol === "https:" || urlParts . hostname === " 0.0.0.0" ) ) {
108
108
protocol = window . location . protocol ;
109
109
}
110
110
111
111
var socketUrl = url . format ( {
112
112
protocol : protocol ,
113
113
auth : urlParts . auth ,
114
114
hostname : hostname ,
115
- port : ( urlParts . port === '0' ) ? window . location . port : urlParts . port ,
116
- pathname : urlParts . path == null || urlParts . path === '/' ? "/sockjs-node" : urlParts . path
115
+ port : ( urlParts . port === "0" ) ? window . location . port : urlParts . port ,
116
+ pathname : urlParts . path == null || urlParts . path === "/" ? "/sockjs-node" : urlParts . path
117
117
} ) ;
118
118
119
119
socket ( socketUrl , onSocketMsg ) ;
0 commit comments