@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,59 +1,99 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const [address] = matches
|
|
9
|
-
if (address) {
|
|
10
|
-
return { host: stripLeadingZeros(address, '.'), isIPV4: true }
|
|
11
|
-
} else {
|
|
12
|
-
return { host, isIPV4: false }
|
|
13
|
-
}
|
|
14
|
-
}
|
|
3
|
+
/** @type {(value: string) => boolean} */
|
|
4
|
+
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu)
|
|
5
|
+
|
|
6
|
+
/** @type {(value: string) => boolean} */
|
|
7
|
+
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u)
|
|
15
8
|
|
|
16
9
|
/**
|
|
17
|
-
* @param {string
|
|
18
|
-
* @
|
|
19
|
-
* @returns {string|undefined}
|
|
10
|
+
* @param {Array<string>} input
|
|
11
|
+
* @returns {string}
|
|
20
12
|
*/
|
|
21
|
-
function stringArrayToHexStripped (input
|
|
13
|
+
function stringArrayToHexStripped (input) {
|
|
22
14
|
let acc = ''
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
let code = 0
|
|
16
|
+
let i = 0
|
|
17
|
+
|
|
18
|
+
for (i = 0; i < input.length; i++) {
|
|
19
|
+
code = input[i].charCodeAt(0)
|
|
20
|
+
if (code === 48) {
|
|
21
|
+
continue
|
|
22
|
+
}
|
|
23
|
+
if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
|
|
24
|
+
return ''
|
|
25
|
+
}
|
|
26
|
+
acc += input[i]
|
|
27
|
+
break
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (i += 1; i < input.length; i++) {
|
|
31
|
+
code = input[i].charCodeAt(0)
|
|
32
|
+
if (!((code >= 48 && code <= 57) || (code >= 65 && code <= 70) || (code >= 97 && code <= 102))) {
|
|
33
|
+
return ''
|
|
34
|
+
}
|
|
35
|
+
acc += input[i]
|
|
28
36
|
}
|
|
29
|
-
if (keepZero && acc.length === 0) acc = '0'
|
|
30
37
|
return acc
|
|
31
38
|
}
|
|
32
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} GetIPV6Result
|
|
42
|
+
* @property {boolean} error - Indicates if there was an error parsing the IPv6 address.
|
|
43
|
+
* @property {string} address - The parsed IPv6 address.
|
|
44
|
+
* @property {string} [zone] - The zone identifier, if present.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param {string} value
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
51
|
+
const nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u)
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {Array<string>} buffer
|
|
55
|
+
* @returns {boolean}
|
|
56
|
+
*/
|
|
57
|
+
function consumeIsZone (buffer) {
|
|
58
|
+
buffer.length = 0
|
|
59
|
+
return true
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @param {Array<string>} buffer
|
|
64
|
+
* @param {Array<string>} address
|
|
65
|
+
* @param {GetIPV6Result} output
|
|
66
|
+
* @returns {boolean}
|
|
67
|
+
*/
|
|
68
|
+
function consumeHextets (buffer, address, output) {
|
|
69
|
+
if (buffer.length) {
|
|
70
|
+
const hex = stringArrayToHexStripped(buffer)
|
|
71
|
+
if (hex !== '') {
|
|
72
|
+
address.push(hex)
|
|
73
|
+
} else {
|
|
74
|
+
output.error = true
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
buffer.length = 0
|
|
78
|
+
}
|
|
79
|
+
return true
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @param {string} input
|
|
84
|
+
* @returns {GetIPV6Result}
|
|
85
|
+
*/
|
|
33
86
|
function getIPV6 (input) {
|
|
34
87
|
let tokenCount = 0
|
|
35
88
|
const output = { error: false, address: '', zone: '' }
|
|
89
|
+
/** @type {Array<string>} */
|
|
36
90
|
const address = []
|
|
91
|
+
/** @type {Array<string>} */
|
|
37
92
|
const buffer = []
|
|
38
|
-
let isZone = false
|
|
39
93
|
let endipv6Encountered = false
|
|
40
94
|
let endIpv6 = false
|
|
41
95
|
|
|
42
|
-
|
|
43
|
-
if (buffer.length) {
|
|
44
|
-
if (isZone === false) {
|
|
45
|
-
const hex = stringArrayToHexStripped(buffer)
|
|
46
|
-
if (hex !== undefined) {
|
|
47
|
-
address.push(hex)
|
|
48
|
-
} else {
|
|
49
|
-
output.error = true
|
|
50
|
-
return false
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
buffer.length = 0
|
|
54
|
-
}
|
|
55
|
-
return true
|
|
56
|
-
}
|
|
96
|
+
let consume = consumeHextets
|
|
57
97
|
|
|
58
98
|
for (let i = 0; i < input.length; i++) {
|
|
59
99
|
const cursor = input[i]
|
|
@@ -62,29 +102,28 @@ function getIPV6 (input) {
|
|
|
62
102
|
if (endipv6Encountered === true) {
|
|
63
103
|
endIpv6 = true
|
|
64
104
|
}
|
|
65
|
-
if (!consume()) { break }
|
|
66
|
-
tokenCount
|
|
67
|
-
address.push(':')
|
|
68
|
-
if (tokenCount > 7) {
|
|
105
|
+
if (!consume(buffer, address, output)) { break }
|
|
106
|
+
if (++tokenCount > 7) {
|
|
69
107
|
// not valid
|
|
70
108
|
output.error = true
|
|
71
109
|
break
|
|
72
110
|
}
|
|
73
|
-
if (i
|
|
111
|
+
if (i > 0 && input[i - 1] === ':') {
|
|
74
112
|
endipv6Encountered = true
|
|
75
113
|
}
|
|
114
|
+
address.push(':')
|
|
76
115
|
continue
|
|
77
116
|
} else if (cursor === '%') {
|
|
78
|
-
if (!consume()) { break }
|
|
117
|
+
if (!consume(buffer, address, output)) { break }
|
|
79
118
|
// switch to zone detection
|
|
80
|
-
|
|
119
|
+
consume = consumeIsZone
|
|
81
120
|
} else {
|
|
82
121
|
buffer.push(cursor)
|
|
83
122
|
continue
|
|
84
123
|
}
|
|
85
124
|
}
|
|
86
125
|
if (buffer.length) {
|
|
87
|
-
if (
|
|
126
|
+
if (consume === consumeIsZone) {
|
|
88
127
|
output.zone = buffer.join('')
|
|
89
128
|
} else if (endIpv6) {
|
|
90
129
|
address.push(buffer.join(''))
|
|
@@ -96,7 +135,18 @@ function getIPV6 (input) {
|
|
|
96
135
|
return output
|
|
97
136
|
}
|
|
98
137
|
|
|
99
|
-
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {Object} NormalizeIPv6Result
|
|
140
|
+
* @property {string} host - The normalized host.
|
|
141
|
+
* @property {string} [escapedHost] - The escaped host.
|
|
142
|
+
* @property {boolean} isIPV6 - Indicates if the host is an IPv6 address.
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @param {string} host
|
|
147
|
+
* @returns {NormalizeIPv6Result}
|
|
148
|
+
*/
|
|
149
|
+
function normalizeIPv6 (host) {
|
|
100
150
|
if (findToken(host, ':') < 2) { return { host, isIPV6: false } }
|
|
101
151
|
const ipv6 = getIPV6(host)
|
|
102
152
|
|
|
@@ -107,35 +157,17 @@ function normalizeIPv6 (host, opts = {}) {
|
|
|
107
157
|
newHost += '%' + ipv6.zone
|
|
108
158
|
escapedHost += '%25' + ipv6.zone
|
|
109
159
|
}
|
|
110
|
-
return { host: newHost,
|
|
160
|
+
return { host: newHost, isIPV6: true, escapedHost }
|
|
111
161
|
} else {
|
|
112
162
|
return { host, isIPV6: false }
|
|
113
163
|
}
|
|
114
164
|
}
|
|
115
165
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const c = str[i]
|
|
122
|
-
if (c === '0' && skip) {
|
|
123
|
-
if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {
|
|
124
|
-
out += c
|
|
125
|
-
skip = false
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
if (c === token) {
|
|
129
|
-
skip = true
|
|
130
|
-
} else {
|
|
131
|
-
skip = false
|
|
132
|
-
}
|
|
133
|
-
out += c
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return out
|
|
137
|
-
}
|
|
138
|
-
|
|
166
|
+
/**
|
|
167
|
+
* @param {string} str
|
|
168
|
+
* @param {string} token
|
|
169
|
+
* @returns {number}
|
|
170
|
+
*/
|
|
139
171
|
function findToken (str, token) {
|
|
140
172
|
let ind = 0
|
|
141
173
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -144,99 +176,161 @@ function findToken (str, token) {
|
|
|
144
176
|
return ind
|
|
145
177
|
}
|
|
146
178
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
179
|
+
/**
|
|
180
|
+
* @param {string} path
|
|
181
|
+
* @returns {string}
|
|
182
|
+
*
|
|
183
|
+
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
|
|
184
|
+
*/
|
|
185
|
+
function removeDotSegments (path) {
|
|
186
|
+
let input = path
|
|
153
187
|
const output = []
|
|
188
|
+
let nextSlash = -1
|
|
189
|
+
let len = 0
|
|
154
190
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
} else if (input === '.' || input === '..') {
|
|
164
|
-
input = ''
|
|
165
|
-
} else {
|
|
166
|
-
const im = input.match(RDS5)
|
|
167
|
-
if (im) {
|
|
168
|
-
const s = im[0]
|
|
169
|
-
input = input.slice(s.length)
|
|
170
|
-
output.push(s)
|
|
191
|
+
// eslint-disable-next-line no-cond-assign
|
|
192
|
+
while (len = input.length) {
|
|
193
|
+
if (len === 1) {
|
|
194
|
+
if (input === '.') {
|
|
195
|
+
break
|
|
196
|
+
} else if (input === '/') {
|
|
197
|
+
output.push('/')
|
|
198
|
+
break
|
|
171
199
|
} else {
|
|
172
|
-
|
|
200
|
+
output.push(input)
|
|
201
|
+
break
|
|
173
202
|
}
|
|
203
|
+
} else if (len === 2) {
|
|
204
|
+
if (input[0] === '.') {
|
|
205
|
+
if (input[1] === '.') {
|
|
206
|
+
break
|
|
207
|
+
} else if (input[1] === '/') {
|
|
208
|
+
input = input.slice(2)
|
|
209
|
+
continue
|
|
210
|
+
}
|
|
211
|
+
} else if (input[0] === '/') {
|
|
212
|
+
if (input[1] === '.' || input[1] === '/') {
|
|
213
|
+
output.push('/')
|
|
214
|
+
break
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} else if (len === 3) {
|
|
218
|
+
if (input === '/..') {
|
|
219
|
+
if (output.length !== 0) {
|
|
220
|
+
output.pop()
|
|
221
|
+
}
|
|
222
|
+
output.push('/')
|
|
223
|
+
break
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (input[0] === '.') {
|
|
227
|
+
if (input[1] === '.') {
|
|
228
|
+
if (input[2] === '/') {
|
|
229
|
+
input = input.slice(3)
|
|
230
|
+
continue
|
|
231
|
+
}
|
|
232
|
+
} else if (input[1] === '/') {
|
|
233
|
+
input = input.slice(2)
|
|
234
|
+
continue
|
|
235
|
+
}
|
|
236
|
+
} else if (input[0] === '/') {
|
|
237
|
+
if (input[1] === '.') {
|
|
238
|
+
if (input[2] === '/') {
|
|
239
|
+
input = input.slice(2)
|
|
240
|
+
continue
|
|
241
|
+
} else if (input[2] === '.') {
|
|
242
|
+
if (input[3] === '/') {
|
|
243
|
+
input = input.slice(3)
|
|
244
|
+
if (output.length !== 0) {
|
|
245
|
+
output.pop()
|
|
246
|
+
}
|
|
247
|
+
continue
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Rule 2E: Move normal path segment to output
|
|
254
|
+
if ((nextSlash = input.indexOf('/', 1)) === -1) {
|
|
255
|
+
output.push(input)
|
|
256
|
+
break
|
|
257
|
+
} else {
|
|
258
|
+
output.push(input.slice(0, nextSlash))
|
|
259
|
+
input = input.slice(nextSlash)
|
|
174
260
|
}
|
|
175
261
|
}
|
|
262
|
+
|
|
176
263
|
return output.join('')
|
|
177
264
|
}
|
|
178
265
|
|
|
179
|
-
|
|
266
|
+
/**
|
|
267
|
+
* @param {import('../types/index').URIComponent} component
|
|
268
|
+
* @param {boolean} esc
|
|
269
|
+
* @returns {import('../types/index').URIComponent}
|
|
270
|
+
*/
|
|
271
|
+
function normalizeComponentEncoding (component, esc) {
|
|
180
272
|
const func = esc !== true ? escape : unescape
|
|
181
|
-
if (
|
|
182
|
-
|
|
273
|
+
if (component.scheme !== undefined) {
|
|
274
|
+
component.scheme = func(component.scheme)
|
|
183
275
|
}
|
|
184
|
-
if (
|
|
185
|
-
|
|
276
|
+
if (component.userinfo !== undefined) {
|
|
277
|
+
component.userinfo = func(component.userinfo)
|
|
186
278
|
}
|
|
187
|
-
if (
|
|
188
|
-
|
|
279
|
+
if (component.host !== undefined) {
|
|
280
|
+
component.host = func(component.host)
|
|
189
281
|
}
|
|
190
|
-
if (
|
|
191
|
-
|
|
282
|
+
if (component.path !== undefined) {
|
|
283
|
+
component.path = func(component.path)
|
|
192
284
|
}
|
|
193
|
-
if (
|
|
194
|
-
|
|
285
|
+
if (component.query !== undefined) {
|
|
286
|
+
component.query = func(component.query)
|
|
195
287
|
}
|
|
196
|
-
if (
|
|
197
|
-
|
|
288
|
+
if (component.fragment !== undefined) {
|
|
289
|
+
component.fragment = func(component.fragment)
|
|
198
290
|
}
|
|
199
|
-
return
|
|
291
|
+
return component
|
|
200
292
|
}
|
|
201
293
|
|
|
202
|
-
|
|
294
|
+
/**
|
|
295
|
+
* @param {import('../types/index').URIComponent} component
|
|
296
|
+
* @returns {string|undefined}
|
|
297
|
+
*/
|
|
298
|
+
function recomposeAuthority (component) {
|
|
203
299
|
const uriTokens = []
|
|
204
300
|
|
|
205
|
-
if (
|
|
206
|
-
uriTokens.push(
|
|
301
|
+
if (component.userinfo !== undefined) {
|
|
302
|
+
uriTokens.push(component.userinfo)
|
|
207
303
|
uriTokens.push('@')
|
|
208
304
|
}
|
|
209
305
|
|
|
210
|
-
if (
|
|
211
|
-
let host = unescape(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (ipV4res.isIPV4) {
|
|
215
|
-
host = ipV4res.host
|
|
216
|
-
} else {
|
|
217
|
-
const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false })
|
|
306
|
+
if (component.host !== undefined) {
|
|
307
|
+
let host = unescape(component.host)
|
|
308
|
+
if (!isIPv4(host)) {
|
|
309
|
+
const ipV6res = normalizeIPv6(host)
|
|
218
310
|
if (ipV6res.isIPV6 === true) {
|
|
219
311
|
host = `[${ipV6res.escapedHost}]`
|
|
220
312
|
} else {
|
|
221
|
-
host =
|
|
313
|
+
host = component.host
|
|
222
314
|
}
|
|
223
315
|
}
|
|
224
316
|
uriTokens.push(host)
|
|
225
317
|
}
|
|
226
318
|
|
|
227
|
-
if (typeof
|
|
319
|
+
if (typeof component.port === 'number' || typeof component.port === 'string') {
|
|
228
320
|
uriTokens.push(':')
|
|
229
|
-
uriTokens.push(String(
|
|
321
|
+
uriTokens.push(String(component.port))
|
|
230
322
|
}
|
|
231
323
|
|
|
232
324
|
return uriTokens.length ? uriTokens.join('') : undefined
|
|
233
325
|
};
|
|
234
326
|
|
|
235
327
|
module.exports = {
|
|
328
|
+
nonSimpleDomain,
|
|
236
329
|
recomposeAuthority,
|
|
237
330
|
normalizeComponentEncoding,
|
|
238
331
|
removeDotSegments,
|
|
239
|
-
|
|
332
|
+
isIPv4,
|
|
333
|
+
isUUID,
|
|
240
334
|
normalizeIPv6,
|
|
241
335
|
stringArrayToHexStripped
|
|
242
336
|
}
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fast-uri",
|
|
3
|
-
"description": "Dependency
|
|
4
|
-
"version": "3.0
|
|
3
|
+
"description": "Dependency-free RFC 3986 URI toolbox",
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"license": "BSD-3-Clause",
|
|
9
9
|
"author": "Vincent Le Goff <vince.legoff@gmail.com> (https://github.com/zekth)",
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Matteo Collina",
|
|
13
|
+
"email": "hello@matteocollina.com"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "Gürgün Dayıoğlu",
|
|
17
|
+
"email": "hey@gurgun.day",
|
|
18
|
+
"url": "https://heyhey.to/G"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Aras Abbasi",
|
|
22
|
+
"email": "aras.abbasi@gmail.com"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "Frazer Smith",
|
|
26
|
+
"email": "frazer.dev@icloud.com",
|
|
27
|
+
"url": "https://github.com/fdawgs"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
10
30
|
"repository": {
|
|
11
31
|
"type": "git",
|
|
12
32
|
"url": "git+https://github.com/fastify/fast-uri.git"
|
|
@@ -15,25 +35,35 @@
|
|
|
15
35
|
"url": "https://github.com/fastify/fast-uri/issues"
|
|
16
36
|
},
|
|
17
37
|
"homepage": "https://github.com/fastify/fast-uri",
|
|
38
|
+
"funding": [
|
|
39
|
+
{
|
|
40
|
+
"type": "github",
|
|
41
|
+
"url": "https://github.com/sponsors/fastify"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "opencollective",
|
|
45
|
+
"url": "https://opencollective.com/fastify"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
18
48
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"lint": "
|
|
21
|
-
"
|
|
22
|
-
"test": "
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
49
|
+
"lint": "eslint",
|
|
50
|
+
"lint:fix": "eslint --fix",
|
|
51
|
+
"test": "npm run test:unit && npm run test:typescript",
|
|
52
|
+
"test:browser:chromium": "playwright-test ./test/* --runner tape --browser=chromium",
|
|
53
|
+
"test:browser:firefox": "playwright-test ./test/* --runner tape --browser=firefox",
|
|
54
|
+
"test:browser:webkit": "playwright-test ./test/* --runner tape --browser=webkit",
|
|
55
|
+
"test:browser": "npm run test:browser:chromium && npm run test:browser:firefox && npm run test:browser:webkit",
|
|
56
|
+
"test:unit": "tape test/**/*.js",
|
|
25
57
|
"test:unit:dev": "npm run test:unit -- --coverage-report=html",
|
|
26
58
|
"test:typescript": "tsd"
|
|
27
59
|
},
|
|
28
60
|
"devDependencies": {
|
|
29
61
|
"@fastify/pre-commit": "^2.1.0",
|
|
30
62
|
"ajv": "^8.16.0",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"standard": "^17.1.0",
|
|
63
|
+
"eslint": "^9.17.0",
|
|
64
|
+
"neostandard": "^0.12.0",
|
|
65
|
+
"playwright-test": "^14.1.12",
|
|
35
66
|
"tape": "^5.8.1",
|
|
36
|
-
"tsd": "^0.
|
|
37
|
-
"uri-js": "^4.4.1"
|
|
67
|
+
"tsd": "^0.32.0"
|
|
38
68
|
}
|
|
39
69
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const test = require('tape')
|
|
4
|
+
const fastURI = require('..')
|
|
5
|
+
|
|
1
6
|
const AJV = require('ajv')
|
|
2
|
-
|
|
7
|
+
|
|
3
8
|
const ajv = new AJV({
|
|
4
|
-
uriResolver:
|
|
9
|
+
uriResolver: fastURI // comment this line to see it works with uri-js
|
|
5
10
|
})
|
|
6
|
-
const test = require('tape')
|
|
7
11
|
|
|
8
12
|
test('ajv', t => {
|
|
9
13
|
t.plan(1)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const test = require('tape')
|
|
4
|
-
const
|
|
4
|
+
const fastURI = require('..')
|
|
5
5
|
|
|
6
|
-
const fn =
|
|
6
|
+
const fn = fastURI.equal
|
|
7
7
|
const runTest = (t, suite) => {
|
|
8
8
|
suite.forEach(s => {
|
|
9
9
|
const operator = s.result ? '==' : '!='
|
|
@@ -65,6 +65,11 @@ test('URN Equals', (t) => {
|
|
|
65
65
|
// t.equal(URI.equal('urn:foo:a123%2C456', 'URN:FOO:a123%2c456'), true)
|
|
66
66
|
|
|
67
67
|
runTest(t, suite)
|
|
68
|
+
|
|
69
|
+
t.throws(() => {
|
|
70
|
+
fn('urn:', 'urn:FOO:a123,456')
|
|
71
|
+
}, 'URN without nid cannot be serialized')
|
|
72
|
+
|
|
68
73
|
t.end()
|
|
69
74
|
})
|
|
70
75
|
|