11/* 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" ) ;
55
66function getCurrentScriptSource ( ) {
77 // `document.currentScript` is the most accurate way to find the current script,
@@ -91,11 +91,11 @@ var onSocketMsg = {
9191var hostname = urlParts . hostname ;
9292var protocol = urlParts . protocol ;
9393
94- if ( urlParts . hostname === ' 0.0.0.0' ) {
94+ if ( urlParts . hostname === " 0.0.0.0" ) {
9595 // why do we need this check?
9696 // hostname n/a for file protocol (example, when using electron, ionic)
9797 // 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" ) ) {
9999 hostname = window . location . hostname ;
100100 }
101101}
@@ -104,16 +104,16 @@ if(urlParts.hostname === '0.0.0.0') {
104104// a protocol would result in an invalid URL.
105105// When https is used in the app, secure websockets are always necessary
106106// 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" ) ) {
108108 protocol = window . location . protocol ;
109109}
110110
111111var socketUrl = url . format ( {
112112 protocol : protocol ,
113113 auth : urlParts . auth ,
114114 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
117117} ) ;
118118
119119socket ( socketUrl , onSocketMsg ) ;
0 commit comments