You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
13 KiB
1 lines
13 KiB
{"ast":null,"code":"import \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.replace.js\";\nimport \"core-js/modules/es.string.search.js\";\nimport \"core-js/modules/es.array.concat.js\";\n\n/**\n * @param {{ protocol?: string, auth?: string, hostname?: string, port?: string, pathname?: string, search?: string, hash?: string, slashes?: boolean }} objURL\n * @returns {string}\n */\nfunction format(objURL) {\n var protocol = objURL.protocol || \"\";\n\n if (protocol && protocol.substr(-1) !== \":\") {\n protocol += \":\";\n }\n\n var auth = objURL.auth || \"\";\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, \":\");\n auth += \"@\";\n }\n\n var host = \"\";\n\n if (objURL.hostname) {\n host = auth + (objURL.hostname.indexOf(\":\") === -1 ? objURL.hostname : \"[\".concat(objURL.hostname, \"]\"));\n\n if (objURL.port) {\n host += \":\".concat(objURL.port);\n }\n }\n\n var pathname = objURL.pathname || \"\";\n\n if (objURL.slashes) {\n host = \"//\".concat(host || \"\");\n\n if (pathname && pathname.charAt(0) !== \"/\") {\n pathname = \"/\".concat(pathname);\n }\n } else if (!host) {\n host = \"\";\n }\n\n var search = objURL.search || \"\";\n\n if (search && search.charAt(0) !== \"?\") {\n search = \"?\".concat(search);\n }\n\n var hash = objURL.hash || \"\";\n\n if (hash && hash.charAt(0) !== \"#\") {\n hash = \"#\".concat(hash);\n }\n\n pathname = pathname.replace(/[?#]/g,\n /**\n * @param {string} match\n * @returns {string}\n */\n function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace(\"#\", \"%23\");\n return \"\".concat(protocol).concat(host).concat(pathname).concat(search).concat(hash);\n}\n/**\n * @param {URL & { fromCurrentScript?: boolean }} parsedURL\n * @returns {string}\n */\n\n\nfunction createSocketURL(parsedURL) {\n var hostname = parsedURL.hostname; // Node.js module parses it as `::`\n // `new URL(urlString, [baseURLString])` parses it as '[::]'\n\n var isInAddrAny = hostname === \"0.0.0.0\" || hostname === \"::\" || hostname === \"[::]\"; // why do we need this check?\n // hostname n/a for file protocol (example, when using electron, ionic)\n // see: https://github.com/webpack/webpack-dev-server/pull/384\n\n if (isInAddrAny && self.location.hostname && self.location.protocol.indexOf(\"http\") === 0) {\n hostname = self.location.hostname;\n }\n\n var socketURLProtocol = parsedURL.protocol || self.location.protocol; // When https is used in the app, secure web sockets are always necessary because the browser doesn't accept non-secure web sockets.\n\n if (socketURLProtocol === \"auto:\" || hostname && isInAddrAny && self.location.protocol === \"https:\") {\n socketURLProtocol = self.location.protocol;\n }\n\n socketURLProtocol = socketURLProtocol.replace(/^(?:http|.+-extension|file)/i, \"ws\");\n var socketURLAuth = \"\"; // `new URL(urlString, [baseURLstring])` doesn't have `auth` property\n // Parse authentication credentials in case we need them\n\n if (parsedURL.username) {\n socketURLAuth = parsedURL.username; // Since HTTP basic authentication does not allow empty username,\n // we only include password if the username is not empty.\n\n if (parsedURL.password) {\n // Result: <username>:<password>\n socketURLAuth = socketURLAuth.concat(\":\", parsedURL.password);\n }\n } // In case the host is a raw IPv6 address, it can be enclosed in\n // the brackets as the brackets are needed in the final URL string.\n // Need to remove those as url.format blindly adds its own set of brackets\n // if the host string contains colons. That would lead to non-working\n // double brackets (e.g. [[::]]) host\n //\n // All of these web socket url params are optionally passed in through resourceQuery,\n // so we need to fall back to the default if they are not provided\n\n\n var socketURLHostname = (hostname || self.location.hostname || \"localhost\").replace(/^\\[(.*)\\]$/, \"$1\");\n var socketURLPort = parsedURL.port;\n\n if (!socketURLPort || socketURLPort === \"0\") {\n socketURLPort = self.location.port;\n } // If path is provided it'll be passed in via the resourceQuery as a\n // query param so it has to be parsed out of the querystring in order for the\n // client to open the socket to the correct location.\n\n\n var socketURLPathname = \"/ws\";\n\n if (parsedURL.pathname && !parsedURL.fromCurrentScript) {\n socketURLPathname = parsedURL.pathname;\n }\n\n return format({\n protocol: socketURLProtocol,\n auth: socketURLAuth,\n hostname: socketURLHostname,\n port: socketURLPort,\n pathname: socketURLPathname,\n slashes: true\n });\n}\n\nexport default createSocketURL;","map":{"version":3,"sources":["/tmp/vue-hello/node_modules/webpack-dev-server/client/utils/createSocketURL.js"],"names":["format","objURL","protocol","substr","auth","encodeURIComponent","replace","host","hostname","indexOf","concat","port","pathname","slashes","charAt","search","hash","match","createSocketURL","parsedURL","isInAddrAny","self","location","socketURLProtocol","socketURLAuth","username","password","socketURLHostname","socketURLPort","socketURLPathname","fromCurrentScript"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA,SAASA,MAAT,CAAgBC,MAAhB,EAAwB;AACtB,MAAIC,QAAQ,GAAGD,MAAM,CAACC,QAAP,IAAmB,EAAlC;;AAEA,MAAIA,QAAQ,IAAIA,QAAQ,CAACC,MAAT,CAAgB,CAAC,CAAjB,MAAwB,GAAxC,EAA6C;AAC3CD,IAAAA,QAAQ,IAAI,GAAZ;AACD;;AAED,MAAIE,IAAI,GAAGH,MAAM,CAACG,IAAP,IAAe,EAA1B;;AAEA,MAAIA,IAAJ,EAAU;AACRA,IAAAA,IAAI,GAAGC,kBAAkB,CAACD,IAAD,CAAzB;AACAA,IAAAA,IAAI,GAAGA,IAAI,CAACE,OAAL,CAAa,MAAb,EAAqB,GAArB,CAAP;AACAF,IAAAA,IAAI,IAAI,GAAR;AACD;;AAED,MAAIG,IAAI,GAAG,EAAX;;AAEA,MAAIN,MAAM,CAACO,QAAX,EAAqB;AACnBD,IAAAA,IAAI,GAAGH,IAAI,IAAIH,MAAM,CAACO,QAAP,CAAgBC,OAAhB,CAAwB,GAAxB,MAAiC,CAAC,CAAlC,GAAsCR,MAAM,CAACO,QAA7C,GAAwD,IAAIE,MAAJ,CAAWT,MAAM,CAACO,QAAlB,EAA4B,GAA5B,CAA5D,CAAX;;AAEA,QAAIP,MAAM,CAACU,IAAX,EAAiB;AACfJ,MAAAA,IAAI,IAAI,IAAIG,MAAJ,CAAWT,MAAM,CAACU,IAAlB,CAA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A;;;AAGA,MAAIC,iBAAiB,GAAG,CAACnB,QAAQ,IAAIa,IAAI,CAACC,QAAL,CAAcd,QAA1B,IAAsC,WAAvC,EAAoDF,OAApD,CAA4D,YAA5D,EAA0E,IAA1E,CAAxB;AACA,MAAIsB,aAAa,GAAGT,SAAS,CAACR,IAA9B;;AAEA,MAAI,CAACiB,aAAD,IAAkBA,aAAa,KAAK,GAAxC,EAA6C;AAC3CA,IAAAA,aAAa,GAAGP,IAAI,CAACC,QAAL,CAAcX,IAA9B;AACD,GA7CiC,CA6ChC;AACF;AACA;;;AAGA,MAAIkB,iBAAiB,GAAG,KAAxB;;AAEA,MAAIV,SAAS,CAACP,QAAV,IAAsB,CAACO,SAAS,CAACW,iBAArC,EAAwD;AACtDD,IAAAA,iBAAiB,GAAGV,SAAS,CAACP,QAA9B;AACD;;AAED,SAAOZ,MAAM,CAAC;AACZE,IAAAA,QAAQ,EAAEqB,iBADE;AAEZnB,IAAAA,IAAI,EAAEoB,aAFM;AAGZhB,IAAAA,QAAQ,EAAEmB,iBAHE;AAIZhB,IAAAA,IAAI,EAAEiB,aAJM;AAKZhB,IAAAA,QAAQ,EAAEiB,iBALE;AAMZhB,IAAAA,OAAO,EAAE;AANG,GAAD,CAAb;AAQD;;AAED,eAAeK,eAAf","sourcesContent":["/**\n * @param {{ protocol?: string, auth?: string, hostname?: string, port?: string, pathname?: string, search?: string, hash?: string, slashes?: boolean }} objURL\n * @returns {string}\n */\nfunction format(objURL) {\n var protocol = objURL.protocol || \"\";\n\n if (protocol && protocol.substr(-1) !== \":\") {\n protocol += \":\";\n }\n\n var auth = objURL.auth || \"\";\n\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, \":\");\n auth += \"@\";\n }\n\n var host = \"\";\n\n if (objURL.hostname) {\n host = auth + (objURL.hostname.indexOf(\":\") === -1 ? objURL.hostname : \"[\".concat(objURL.hostname, \"]\"));\n\n if (objURL.port) {\n host += \":\".concat(objURL.port);\n }\n }\n\n var pathname = objURL.pathname || \"\";\n\n if (objURL.slashes) {\n host = \"//\".concat(host || \"\");\n\n if (pathname && pathname.charAt(0) !== \"/\") {\n pathname = \"/\".concat(pathname);\n }\n } else if (!host) {\n host = \"\";\n }\n\n var search = objURL.search || \"\";\n\n if (search && search.charAt(0) !== \"?\") {\n search = \"?\".concat(search);\n }\n\n var hash = objURL.hash || \"\";\n\n if (hash && hash.charAt(0) !== \"#\") {\n hash = \"#\".concat(hash);\n }\n\n pathname = pathname.replace(/[?#]/g,\n /**\n * @param {string} match\n * @returns {string}\n */\n function (match) {\n return encodeURIComponent(match);\n });\n search = search.replace(\"#\", \"%23\");\n return \"\".concat(protocol).concat(host).concat(pathname).concat(search).concat(hash);\n}\n/**\n * @param {URL & { fromCurrentScript?: boolean }} parsedURL\n * @returns {string}\n */\n\n\nfunction createSocketURL(parsedURL) {\n var hostname = parsedURL.hostname; // Node.js module parses it as `::`\n // `new URL(urlString, [baseURLString])` parses it as '[::]'\n\n var isInAddrAny = hostname === \"0.0.0.0\" || hostname === \"::\" || hostname === \"[::]\"; // why do we need this check?\n // hostname n/a for file protocol (example, when using electron, ionic)\n // see: https://github.com/webpack/webpack-dev-server/pull/384\n\n if (isInAddrAny && self.location.hostname && self.location.protocol.indexOf(\"http\") === 0) {\n hostname = self.location.hostname;\n }\n\n var socketURLProtocol = parsedURL.protocol || self.location.protocol; // When https is used in the app, secure web sockets are always necessary because the browser doesn't accept non-secure web sockets.\n\n if (socketURLProtocol === \"auto:\" || hostname && isInAddrAny && self.location.protocol === \"https:\") {\n socketURLProtocol = self.location.protocol;\n }\n\n socketURLProtocol = socketURLProtocol.replace(/^(?:http|.+-extension|file)/i, \"ws\");\n var socketURLAuth = \"\"; // `new URL(urlString, [baseURLstring])` doesn't have `auth` property\n // Parse authentication credentials in case we need them\n\n if (parsedURL.username) {\n socketURLAuth = parsedURL.username; // Since HTTP basic authentication does not allow empty username,\n // we only include password if the username is not empty.\n\n if (parsedURL.password) {\n // Result: <username>:<password>\n socketURLAuth = socketURLAuth.concat(\":\", parsedURL.password);\n }\n } // In case the host is a raw IPv6 address, it can be enclosed in\n // the brackets as the brackets are needed in the final URL string.\n // Need to remove those as url.format blindly adds its own set of brackets\n // if the host string contains colons. That would lead to non-working\n // double brackets (e.g. [[::]]) host\n //\n // All of these web socket url params are optionally passed in through resourceQuery,\n // so we need to fall back to the default if they are not provided\n\n\n var socketURLHostname = (hostname || self.location.hostname || \"localhost\").replace(/^\\[(.*)\\]$/, \"$1\");\n var socketURLPort = parsedURL.port;\n\n if (!socketURLPort || socketURLPort === \"0\") {\n socketURLPort = self.location.port;\n } // If path is provided it'll be passed in via the resourceQuery as a\n // query param so it has to be parsed out of the querystring in order for the\n // client to open the socket to the correct location.\n\n\n var socketURLPathname = \"/ws\";\n\n if (parsedURL.pathname && !parsedURL.fromCurrentScript) {\n socketURLPathname = parsedURL.pathname;\n }\n\n return format({\n protocol: socketURLProtocol,\n auth: socketURLAuth,\n hostname: socketURLHostname,\n port: socketURLPort,\n pathname: socketURLPathname,\n slashes: true\n });\n}\n\nexport default createSocketURL;"]},"metadata":{},"sourceType":"module"} |