@emulsify/cli 1.11.4 → 1.12.0
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/dist/node_modules/.package-lock.json +34 -24
- package/dist/node_modules/@types/node/README.md +2 -2
- package/dist/node_modules/@types/node/assert.d.ts +23 -1
- package/dist/node_modules/@types/node/async_hooks.d.ts +64 -0
- package/dist/node_modules/@types/node/buffer.buffer.d.ts +124 -38
- package/dist/node_modules/@types/node/buffer.d.ts +19 -17
- package/dist/node_modules/@types/node/child_process.d.ts +88 -161
- package/dist/node_modules/@types/node/cluster.d.ts +5 -6
- package/dist/node_modules/@types/node/constants.d.ts +14 -12
- package/dist/node_modules/@types/node/crypto.d.ts +237 -166
- package/dist/node_modules/@types/node/dgram.d.ts +15 -14
- package/dist/node_modules/@types/node/diagnostics_channel.d.ts +39 -15
- package/dist/node_modules/@types/node/dns/promises.d.ts +11 -9
- package/dist/node_modules/@types/node/dns.d.ts +28 -21
- package/dist/node_modules/@types/node/events.d.ts +81 -35
- package/dist/node_modules/@types/node/fs/promises.d.ts +61 -36
- package/dist/node_modules/@types/node/fs.d.ts +251 -193
- package/dist/node_modules/@types/node/globals.d.ts +146 -442
- package/dist/node_modules/@types/node/globals.typedarray.d.ts +17 -0
- package/dist/node_modules/@types/node/http.d.ts +136 -31
- package/dist/node_modules/@types/node/http2.d.ts +102 -26
- package/dist/node_modules/@types/node/https.d.ts +94 -60
- package/dist/node_modules/@types/node/index.d.ts +5 -3
- package/dist/node_modules/@types/node/{inspector.d.ts → inspector.generated.d.ts} +272 -2
- package/dist/node_modules/@types/node/module.d.ts +362 -138
- package/dist/node_modules/@types/node/net.d.ts +27 -20
- package/dist/node_modules/@types/node/os.d.ts +14 -3
- package/dist/node_modules/@types/node/package.json +4 -89
- package/dist/node_modules/@types/node/perf_hooks.d.ts +37 -10
- package/dist/node_modules/@types/node/process.d.ts +108 -35
- package/dist/node_modules/@types/node/querystring.d.ts +2 -3
- package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/dist/node_modules/@types/node/stream/consumers.d.ts +33 -7
- package/dist/node_modules/@types/node/stream/web.d.ts +13 -4
- package/dist/node_modules/@types/node/stream.d.ts +963 -1014
- package/dist/node_modules/@types/node/string_decoder.d.ts +2 -2
- package/dist/node_modules/@types/node/test.d.ts +1504 -1655
- package/dist/node_modules/@types/node/timers/promises.d.ts +28 -17
- package/dist/node_modules/@types/node/timers.d.ts +157 -111
- package/dist/node_modules/@types/node/tls.d.ts +105 -67
- package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +120 -37
- package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +15 -0
- package/dist/node_modules/@types/node/ts5.6/index.d.ts +5 -3
- package/dist/node_modules/@types/node/url.d.ts +10 -1
- package/dist/node_modules/@types/node/util.d.ts +28 -3
- package/dist/node_modules/@types/node/v8.d.ts +6 -5
- package/dist/node_modules/@types/node/vm.d.ts +147 -68
- package/dist/node_modules/@types/node/wasi.d.ts +1 -1
- package/dist/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/dist/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/dist/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/dist/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
- package/dist/node_modules/@types/node/worker_threads.d.ts +60 -39
- package/dist/node_modules/@types/node/zlib.d.ts +21 -20
- package/dist/node_modules/debug/package.json +7 -3
- package/dist/node_modules/debug/src/browser.js +2 -1
- package/dist/node_modules/debug/src/common.js +57 -39
- package/dist/node_modules/fast-uri/.github/dependabot.yml +1 -1
- package/dist/node_modules/fast-uri/.github/workflows/ci.yml +81 -3
- package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +6 -2
- package/dist/node_modules/fast-uri/LICENSE +3 -1
- package/dist/node_modules/fast-uri/README.md +55 -37
- package/dist/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
- package/dist/node_modules/fast-uri/benchmark/equal.mjs +51 -0
- package/dist/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
- package/dist/node_modules/fast-uri/benchmark/package.json +17 -0
- package/dist/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
- package/dist/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
- package/dist/node_modules/fast-uri/eslint.config.js +6 -0
- package/dist/node_modules/fast-uri/index.js +98 -61
- package/dist/node_modules/fast-uri/lib/schemes.js +160 -81
- package/dist/node_modules/fast-uri/lib/utils.js +217 -123
- package/dist/node_modules/fast-uri/package.json +44 -14
- package/dist/node_modules/fast-uri/test/ajv.test.js +7 -3
- package/dist/node_modules/fast-uri/test/equal.test.js +7 -2
- package/dist/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
- package/dist/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
- package/dist/node_modules/fast-uri/test/parse.test.js +31 -31
- package/dist/node_modules/fast-uri/test/resolve.test.js +52 -49
- package/dist/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
- package/dist/node_modules/fast-uri/test/serialize.test.js +55 -47
- package/dist/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
- package/dist/node_modules/fast-uri/test/uri-js.test.js +230 -230
- package/dist/node_modules/fast-uri/test/util.test.js +23 -8
- package/dist/node_modules/fast-uri/tsconfig.json +9 -0
- package/dist/node_modules/fast-uri/types/index.d.ts +16 -9
- package/dist/node_modules/fast-uri/types/index.test-d.ts +9 -9
- package/dist/node_modules/fs-extra/LICENSE +1 -1
- package/dist/node_modules/fs-extra/README.md +3 -1
- package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +11 -1
- package/dist/node_modules/fs-extra/lib/copy/copy.js +13 -15
- package/dist/node_modules/fs-extra/lib/fs/index.js +6 -0
- package/dist/node_modules/fs-extra/lib/util/async.js +29 -0
- package/dist/node_modules/fs-extra/lib/util/stat.js +2 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/jsonfile/README.md +1 -1
- package/dist/node_modules/jsonfile/index.js +3 -3
- package/dist/node_modules/jsonfile/package.json +1 -1
- package/dist/node_modules/simple-git/dist/cjs/index.js +235 -235
- package/dist/node_modules/simple-git/dist/cjs/index.js.map +3 -3
- package/dist/node_modules/simple-git/dist/esm/index.js +229 -233
- package/dist/node_modules/simple-git/dist/esm/index.js.map +3 -3
- package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +2 -3
- package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +2 -3
- package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +0 -1
- package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +2 -2
- package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -3
- package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +4 -2
- package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +3 -3
- package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +2 -2
- package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +9 -13
- package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +5 -6
- package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +5 -7
- package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +0 -1
- package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +11 -10
- package/dist/node_modules/simple-git/package.json +6 -6
- package/dist/node_modules/simple-git/readme.md +8 -0
- package/dist/node_modules/undici-types/dispatcher.d.ts +1 -0
- package/dist/node_modules/undici-types/eventsource.d.ts +0 -2
- package/dist/node_modules/undici-types/filereader.d.ts +1 -1
- package/dist/node_modules/undici-types/interceptors.d.ts +3 -1
- package/dist/node_modules/undici-types/package.json +1 -1
- package/dist/node_modules/undici-types/patch.d.ts +0 -38
- package/dist/node_modules/undici-types/readable.d.ts +5 -0
- package/dist/node_modules/undici-types/webidl.d.ts +6 -0
- package/dist/node_modules/undici-types/websocket.d.ts +0 -2
- package/dist/package-lock.json +911 -812
- package/dist/package.json +1 -1
- package/dist/util/getAvailableStarters.js +2 -2
- package/package.json +1 -1
- package/dist/node_modules/@types/node/dom-events.d.ts +0 -124
- package/dist/node_modules/fast-uri/benchmark.js +0 -105
- package/dist/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
- package/dist/node_modules/fast-uri/test/compatibility.test.js +0 -131
- package/dist/node_modules/jsonfile/CHANGELOG.md +0 -171
|
@@ -1,188 +1,267 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { isUUID } = require('./utils')
|
|
4
4
|
const URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const supportedSchemeNames = /** @type {const} */ (['http', 'https', 'ws',
|
|
7
|
+
'wss', 'urn', 'urn:uuid'])
|
|
8
|
+
|
|
9
|
+
/** @typedef {supportedSchemeNames[number]} SchemeName */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {string} name
|
|
13
|
+
* @returns {name is SchemeName}
|
|
14
|
+
*/
|
|
15
|
+
function isValidSchemeName (name) {
|
|
16
|
+
return supportedSchemeNames.indexOf(/** @type {*} */ (name)) !== -1
|
|
8
17
|
}
|
|
9
18
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
/**
|
|
20
|
+
* @callback SchemeFn
|
|
21
|
+
* @param {import('../types/index').URIComponent} component
|
|
22
|
+
* @param {import('../types/index').Options} options
|
|
23
|
+
* @returns {import('../types/index').URIComponent}
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} SchemeHandler
|
|
28
|
+
* @property {SchemeName} scheme - The scheme name.
|
|
29
|
+
* @property {boolean} [domainHost] - Indicates if the scheme supports domain hosts.
|
|
30
|
+
* @property {SchemeFn} parse - Function to parse the URI component for this scheme.
|
|
31
|
+
* @property {SchemeFn} serialize - Function to serialize the URI component for this scheme.
|
|
32
|
+
* @property {boolean} [skipNormalize] - Indicates if normalization should be skipped for this scheme.
|
|
33
|
+
* @property {boolean} [absolutePath] - Indicates if the scheme uses absolute paths.
|
|
34
|
+
* @property {boolean} [unicodeSupport] - Indicates if the scheme supports Unicode.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {import('../types/index').URIComponent} wsComponent
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
function wsIsSecure (wsComponent) {
|
|
42
|
+
if (wsComponent.secure === true) {
|
|
43
|
+
return true
|
|
44
|
+
} else if (wsComponent.secure === false) {
|
|
45
|
+
return false
|
|
46
|
+
} else if (wsComponent.scheme) {
|
|
47
|
+
return (
|
|
48
|
+
wsComponent.scheme.length === 3 &&
|
|
49
|
+
(wsComponent.scheme[0] === 'w' || wsComponent.scheme[0] === 'W') &&
|
|
50
|
+
(wsComponent.scheme[1] === 's' || wsComponent.scheme[1] === 'S') &&
|
|
51
|
+
(wsComponent.scheme[2] === 's' || wsComponent.scheme[2] === 'S')
|
|
52
|
+
)
|
|
53
|
+
} else {
|
|
54
|
+
return false
|
|
13
55
|
}
|
|
56
|
+
}
|
|
14
57
|
|
|
15
|
-
|
|
58
|
+
/** @type {SchemeFn} */
|
|
59
|
+
function httpParse (component) {
|
|
60
|
+
if (!component.host) {
|
|
61
|
+
component.error = component.error || 'HTTP URIs must have a host.'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return component
|
|
16
65
|
}
|
|
17
66
|
|
|
18
|
-
|
|
19
|
-
|
|
67
|
+
/** @type {SchemeFn} */
|
|
68
|
+
function httpSerialize (component) {
|
|
69
|
+
const secure = String(component.scheme).toLowerCase() === 'https'
|
|
20
70
|
|
|
21
71
|
// normalize the default port
|
|
22
|
-
if (
|
|
23
|
-
|
|
72
|
+
if (component.port === (secure ? 443 : 80) || component.port === '') {
|
|
73
|
+
component.port = undefined
|
|
24
74
|
}
|
|
25
75
|
|
|
26
76
|
// normalize the empty path
|
|
27
|
-
if (!
|
|
28
|
-
|
|
77
|
+
if (!component.path) {
|
|
78
|
+
component.path = '/'
|
|
29
79
|
}
|
|
30
80
|
|
|
31
81
|
// NOTE: We do not parse query strings for HTTP URIs
|
|
32
82
|
// as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
|
33
83
|
// and not the HTTP spec.
|
|
34
84
|
|
|
35
|
-
return
|
|
85
|
+
return component
|
|
36
86
|
}
|
|
37
87
|
|
|
38
|
-
|
|
88
|
+
/** @type {SchemeFn} */
|
|
89
|
+
function wsParse (wsComponent) {
|
|
39
90
|
// indicate if the secure flag is set
|
|
40
|
-
|
|
91
|
+
wsComponent.secure = wsIsSecure(wsComponent)
|
|
41
92
|
|
|
42
93
|
// construct resouce name
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
94
|
+
wsComponent.resourceName = (wsComponent.path || '/') + (wsComponent.query ? '?' + wsComponent.query : '')
|
|
95
|
+
wsComponent.path = undefined
|
|
96
|
+
wsComponent.query = undefined
|
|
46
97
|
|
|
47
|
-
return
|
|
98
|
+
return wsComponent
|
|
48
99
|
}
|
|
49
100
|
|
|
50
|
-
|
|
101
|
+
/** @type {SchemeFn} */
|
|
102
|
+
function wsSerialize (wsComponent) {
|
|
51
103
|
// normalize the default port
|
|
52
|
-
if (
|
|
53
|
-
|
|
104
|
+
if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === '') {
|
|
105
|
+
wsComponent.port = undefined
|
|
54
106
|
}
|
|
55
107
|
|
|
56
108
|
// ensure scheme matches secure flag
|
|
57
|
-
if (typeof
|
|
58
|
-
|
|
59
|
-
|
|
109
|
+
if (typeof wsComponent.secure === 'boolean') {
|
|
110
|
+
wsComponent.scheme = (wsComponent.secure ? 'wss' : 'ws')
|
|
111
|
+
wsComponent.secure = undefined
|
|
60
112
|
}
|
|
61
113
|
|
|
62
114
|
// reconstruct path from resource name
|
|
63
|
-
if (
|
|
64
|
-
const [path, query] =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
115
|
+
if (wsComponent.resourceName) {
|
|
116
|
+
const [path, query] = wsComponent.resourceName.split('?')
|
|
117
|
+
wsComponent.path = (path && path !== '/' ? path : undefined)
|
|
118
|
+
wsComponent.query = query
|
|
119
|
+
wsComponent.resourceName = undefined
|
|
68
120
|
}
|
|
69
121
|
|
|
70
122
|
// forbid fragment component
|
|
71
|
-
|
|
123
|
+
wsComponent.fragment = undefined
|
|
72
124
|
|
|
73
|
-
return
|
|
125
|
+
return wsComponent
|
|
74
126
|
}
|
|
75
127
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
/** @type {SchemeFn} */
|
|
129
|
+
function urnParse (urnComponent, options) {
|
|
130
|
+
if (!urnComponent.path) {
|
|
131
|
+
urnComponent.error = 'URN can not be parsed'
|
|
132
|
+
return urnComponent
|
|
80
133
|
}
|
|
81
|
-
const matches =
|
|
134
|
+
const matches = urnComponent.path.match(URN_REG)
|
|
82
135
|
if (matches) {
|
|
83
|
-
const scheme = options.scheme ||
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const urnScheme = `${scheme}:${options.nid ||
|
|
87
|
-
const schemeHandler =
|
|
88
|
-
|
|
136
|
+
const scheme = options.scheme || urnComponent.scheme || 'urn'
|
|
137
|
+
urnComponent.nid = matches[1].toLowerCase()
|
|
138
|
+
urnComponent.nss = matches[2]
|
|
139
|
+
const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`
|
|
140
|
+
const schemeHandler = getSchemeHandler(urnScheme)
|
|
141
|
+
urnComponent.path = undefined
|
|
89
142
|
|
|
90
143
|
if (schemeHandler) {
|
|
91
|
-
|
|
144
|
+
urnComponent = schemeHandler.parse(urnComponent, options)
|
|
92
145
|
}
|
|
93
146
|
} else {
|
|
94
|
-
|
|
147
|
+
urnComponent.error = urnComponent.error || 'URN can not be parsed.'
|
|
95
148
|
}
|
|
96
149
|
|
|
97
|
-
return
|
|
150
|
+
return urnComponent
|
|
98
151
|
}
|
|
99
152
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
153
|
+
/** @type {SchemeFn} */
|
|
154
|
+
function urnSerialize (urnComponent, options) {
|
|
155
|
+
if (urnComponent.nid === undefined) {
|
|
156
|
+
throw new Error('URN without nid cannot be serialized')
|
|
157
|
+
}
|
|
158
|
+
const scheme = options.scheme || urnComponent.scheme || 'urn'
|
|
159
|
+
const nid = urnComponent.nid.toLowerCase()
|
|
103
160
|
const urnScheme = `${scheme}:${options.nid || nid}`
|
|
104
|
-
const schemeHandler =
|
|
161
|
+
const schemeHandler = getSchemeHandler(urnScheme)
|
|
105
162
|
|
|
106
163
|
if (schemeHandler) {
|
|
107
|
-
|
|
164
|
+
urnComponent = schemeHandler.serialize(urnComponent, options)
|
|
108
165
|
}
|
|
109
166
|
|
|
110
|
-
const
|
|
111
|
-
const nss =
|
|
112
|
-
|
|
167
|
+
const uriComponent = urnComponent
|
|
168
|
+
const nss = urnComponent.nss
|
|
169
|
+
uriComponent.path = `${nid || options.nid}:${nss}`
|
|
113
170
|
|
|
114
171
|
options.skipEscape = true
|
|
115
|
-
return
|
|
172
|
+
return uriComponent
|
|
116
173
|
}
|
|
117
174
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
175
|
+
/** @type {SchemeFn} */
|
|
176
|
+
function urnuuidParse (urnComponent, options) {
|
|
177
|
+
const uuidComponent = urnComponent
|
|
178
|
+
uuidComponent.uuid = uuidComponent.nss
|
|
179
|
+
uuidComponent.nss = undefined
|
|
122
180
|
|
|
123
|
-
if (!options.tolerant && (!
|
|
124
|
-
|
|
181
|
+
if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
|
|
182
|
+
uuidComponent.error = uuidComponent.error || 'UUID is not valid.'
|
|
125
183
|
}
|
|
126
184
|
|
|
127
|
-
return
|
|
185
|
+
return uuidComponent
|
|
128
186
|
}
|
|
129
187
|
|
|
130
|
-
|
|
131
|
-
|
|
188
|
+
/** @type {SchemeFn} */
|
|
189
|
+
function urnuuidSerialize (uuidComponent) {
|
|
190
|
+
const urnComponent = uuidComponent
|
|
132
191
|
// normalize UUID
|
|
133
|
-
|
|
134
|
-
return
|
|
192
|
+
urnComponent.nss = (uuidComponent.uuid || '').toLowerCase()
|
|
193
|
+
return urnComponent
|
|
135
194
|
}
|
|
136
195
|
|
|
137
|
-
const http = {
|
|
196
|
+
const http = /** @type {SchemeHandler} */ ({
|
|
138
197
|
scheme: 'http',
|
|
139
198
|
domainHost: true,
|
|
140
199
|
parse: httpParse,
|
|
141
200
|
serialize: httpSerialize
|
|
142
|
-
}
|
|
201
|
+
})
|
|
143
202
|
|
|
144
|
-
const https = {
|
|
203
|
+
const https = /** @type {SchemeHandler} */ ({
|
|
145
204
|
scheme: 'https',
|
|
146
205
|
domainHost: http.domainHost,
|
|
147
206
|
parse: httpParse,
|
|
148
207
|
serialize: httpSerialize
|
|
149
|
-
}
|
|
208
|
+
})
|
|
150
209
|
|
|
151
|
-
const ws = {
|
|
210
|
+
const ws = /** @type {SchemeHandler} */ ({
|
|
152
211
|
scheme: 'ws',
|
|
153
212
|
domainHost: true,
|
|
154
213
|
parse: wsParse,
|
|
155
214
|
serialize: wsSerialize
|
|
156
|
-
}
|
|
215
|
+
})
|
|
157
216
|
|
|
158
|
-
const wss = {
|
|
217
|
+
const wss = /** @type {SchemeHandler} */ ({
|
|
159
218
|
scheme: 'wss',
|
|
160
219
|
domainHost: ws.domainHost,
|
|
161
220
|
parse: ws.parse,
|
|
162
221
|
serialize: ws.serialize
|
|
163
|
-
}
|
|
222
|
+
})
|
|
164
223
|
|
|
165
|
-
const urn = {
|
|
224
|
+
const urn = /** @type {SchemeHandler} */ ({
|
|
166
225
|
scheme: 'urn',
|
|
167
226
|
parse: urnParse,
|
|
168
227
|
serialize: urnSerialize,
|
|
169
228
|
skipNormalize: true
|
|
170
|
-
}
|
|
229
|
+
})
|
|
171
230
|
|
|
172
|
-
const urnuuid = {
|
|
231
|
+
const urnuuid = /** @type {SchemeHandler} */ ({
|
|
173
232
|
scheme: 'urn:uuid',
|
|
174
233
|
parse: urnuuidParse,
|
|
175
234
|
serialize: urnuuidSerialize,
|
|
176
235
|
skipNormalize: true
|
|
177
|
-
}
|
|
236
|
+
})
|
|
178
237
|
|
|
179
|
-
const SCHEMES = {
|
|
238
|
+
const SCHEMES = /** @type {Record<SchemeName, SchemeHandler>} */ ({
|
|
180
239
|
http,
|
|
181
240
|
https,
|
|
182
241
|
ws,
|
|
183
242
|
wss,
|
|
184
243
|
urn,
|
|
185
244
|
'urn:uuid': urnuuid
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
Object.setPrototypeOf(SCHEMES, null)
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @param {string|undefined} scheme
|
|
251
|
+
* @returns {SchemeHandler|undefined}
|
|
252
|
+
*/
|
|
253
|
+
function getSchemeHandler (scheme) {
|
|
254
|
+
return (
|
|
255
|
+
scheme && (
|
|
256
|
+
SCHEMES[/** @type {SchemeName} */ (scheme)] ||
|
|
257
|
+
SCHEMES[/** @type {SchemeName} */(scheme.toLowerCase())])
|
|
258
|
+
) ||
|
|
259
|
+
undefined
|
|
186
260
|
}
|
|
187
261
|
|
|
188
|
-
module.exports =
|
|
262
|
+
module.exports = {
|
|
263
|
+
wsIsSecure,
|
|
264
|
+
SCHEMES,
|
|
265
|
+
isValidSchemeName,
|
|
266
|
+
getSchemeHandler,
|
|
267
|
+
}
|