Update app and tooling
This commit is contained in:
parent
3046531bdd
commit
e620ec7349
4950 changed files with 2975120 additions and 10 deletions
26
node_modules/micro/lib/parse-endpoint.js
generated
vendored
Normal file
26
node_modules/micro/lib/parse-endpoint.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const {URL} = require('url');
|
||||
|
||||
module.exports = function parseEndpoint(str) {
|
||||
const url = new URL(str);
|
||||
|
||||
switch (url.protocol) {
|
||||
case 'pipe:': {
|
||||
// some special handling
|
||||
const cutStr = str.replace(/^pipe:/, '');
|
||||
if (cutStr.slice(0, 4) !== '\\\\.\\') {
|
||||
throw new Error(`Invalid Windows named pipe endpoint: ${str}`);
|
||||
}
|
||||
return [cutStr];
|
||||
}
|
||||
case 'unix:':
|
||||
if (!url.pathname) {
|
||||
throw new Error(`Invalid UNIX domain socket endpoint: ${str}`);
|
||||
}
|
||||
return [url.pathname];
|
||||
case 'tcp:':
|
||||
url.port = url.port || '3000';
|
||||
return [parseInt(url.port, 10), url.hostname];
|
||||
default:
|
||||
throw new Error(`Unknown --listen endpoint scheme (protocol): ${url.protocol}`);
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue