@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.
Files changed (147) hide show
  1. package/dist/node_modules/.package-lock.json +34 -24
  2. package/dist/node_modules/@types/node/README.md +2 -2
  3. package/dist/node_modules/@types/node/assert.d.ts +23 -1
  4. package/dist/node_modules/@types/node/async_hooks.d.ts +64 -0
  5. package/dist/node_modules/@types/node/buffer.buffer.d.ts +124 -38
  6. package/dist/node_modules/@types/node/buffer.d.ts +19 -17
  7. package/dist/node_modules/@types/node/child_process.d.ts +88 -161
  8. package/dist/node_modules/@types/node/cluster.d.ts +5 -6
  9. package/dist/node_modules/@types/node/constants.d.ts +14 -12
  10. package/dist/node_modules/@types/node/crypto.d.ts +237 -166
  11. package/dist/node_modules/@types/node/dgram.d.ts +15 -14
  12. package/dist/node_modules/@types/node/diagnostics_channel.d.ts +39 -15
  13. package/dist/node_modules/@types/node/dns/promises.d.ts +11 -9
  14. package/dist/node_modules/@types/node/dns.d.ts +28 -21
  15. package/dist/node_modules/@types/node/events.d.ts +81 -35
  16. package/dist/node_modules/@types/node/fs/promises.d.ts +61 -36
  17. package/dist/node_modules/@types/node/fs.d.ts +251 -193
  18. package/dist/node_modules/@types/node/globals.d.ts +146 -442
  19. package/dist/node_modules/@types/node/globals.typedarray.d.ts +17 -0
  20. package/dist/node_modules/@types/node/http.d.ts +136 -31
  21. package/dist/node_modules/@types/node/http2.d.ts +102 -26
  22. package/dist/node_modules/@types/node/https.d.ts +94 -60
  23. package/dist/node_modules/@types/node/index.d.ts +5 -3
  24. package/dist/node_modules/@types/node/{inspector.d.ts → inspector.generated.d.ts} +272 -2
  25. package/dist/node_modules/@types/node/module.d.ts +362 -138
  26. package/dist/node_modules/@types/node/net.d.ts +27 -20
  27. package/dist/node_modules/@types/node/os.d.ts +14 -3
  28. package/dist/node_modules/@types/node/package.json +4 -89
  29. package/dist/node_modules/@types/node/perf_hooks.d.ts +37 -10
  30. package/dist/node_modules/@types/node/process.d.ts +108 -35
  31. package/dist/node_modules/@types/node/querystring.d.ts +2 -3
  32. package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
  33. package/dist/node_modules/@types/node/stream/consumers.d.ts +33 -7
  34. package/dist/node_modules/@types/node/stream/web.d.ts +13 -4
  35. package/dist/node_modules/@types/node/stream.d.ts +963 -1014
  36. package/dist/node_modules/@types/node/string_decoder.d.ts +2 -2
  37. package/dist/node_modules/@types/node/test.d.ts +1504 -1655
  38. package/dist/node_modules/@types/node/timers/promises.d.ts +28 -17
  39. package/dist/node_modules/@types/node/timers.d.ts +157 -111
  40. package/dist/node_modules/@types/node/tls.d.ts +105 -67
  41. package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +120 -37
  42. package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +15 -0
  43. package/dist/node_modules/@types/node/ts5.6/index.d.ts +5 -3
  44. package/dist/node_modules/@types/node/url.d.ts +10 -1
  45. package/dist/node_modules/@types/node/util.d.ts +28 -3
  46. package/dist/node_modules/@types/node/v8.d.ts +6 -5
  47. package/dist/node_modules/@types/node/vm.d.ts +147 -68
  48. package/dist/node_modules/@types/node/wasi.d.ts +1 -1
  49. package/dist/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  50. package/dist/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  51. package/dist/node_modules/@types/node/web-globals/events.d.ts +97 -0
  52. package/dist/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
  53. package/dist/node_modules/@types/node/worker_threads.d.ts +60 -39
  54. package/dist/node_modules/@types/node/zlib.d.ts +21 -20
  55. package/dist/node_modules/debug/package.json +7 -3
  56. package/dist/node_modules/debug/src/browser.js +2 -1
  57. package/dist/node_modules/debug/src/common.js +57 -39
  58. package/dist/node_modules/fast-uri/.github/dependabot.yml +1 -1
  59. package/dist/node_modules/fast-uri/.github/workflows/ci.yml +81 -3
  60. package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +6 -2
  61. package/dist/node_modules/fast-uri/LICENSE +3 -1
  62. package/dist/node_modules/fast-uri/README.md +55 -37
  63. package/dist/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  64. package/dist/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  65. package/dist/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  66. package/dist/node_modules/fast-uri/benchmark/package.json +17 -0
  67. package/dist/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  68. package/dist/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  69. package/dist/node_modules/fast-uri/eslint.config.js +6 -0
  70. package/dist/node_modules/fast-uri/index.js +98 -61
  71. package/dist/node_modules/fast-uri/lib/schemes.js +160 -81
  72. package/dist/node_modules/fast-uri/lib/utils.js +217 -123
  73. package/dist/node_modules/fast-uri/package.json +44 -14
  74. package/dist/node_modules/fast-uri/test/ajv.test.js +7 -3
  75. package/dist/node_modules/fast-uri/test/equal.test.js +7 -2
  76. package/dist/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
  77. package/dist/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  78. package/dist/node_modules/fast-uri/test/parse.test.js +31 -31
  79. package/dist/node_modules/fast-uri/test/resolve.test.js +52 -49
  80. package/dist/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  81. package/dist/node_modules/fast-uri/test/serialize.test.js +55 -47
  82. package/dist/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  83. package/dist/node_modules/fast-uri/test/uri-js.test.js +230 -230
  84. package/dist/node_modules/fast-uri/test/util.test.js +23 -8
  85. package/dist/node_modules/fast-uri/tsconfig.json +9 -0
  86. package/dist/node_modules/fast-uri/types/index.d.ts +16 -9
  87. package/dist/node_modules/fast-uri/types/index.test-d.ts +9 -9
  88. package/dist/node_modules/fs-extra/LICENSE +1 -1
  89. package/dist/node_modules/fs-extra/README.md +3 -1
  90. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +11 -1
  91. package/dist/node_modules/fs-extra/lib/copy/copy.js +13 -15
  92. package/dist/node_modules/fs-extra/lib/fs/index.js +6 -0
  93. package/dist/node_modules/fs-extra/lib/util/async.js +29 -0
  94. package/dist/node_modules/fs-extra/lib/util/stat.js +2 -1
  95. package/dist/node_modules/fs-extra/package.json +1 -1
  96. package/dist/node_modules/jsonfile/README.md +1 -1
  97. package/dist/node_modules/jsonfile/index.js +3 -3
  98. package/dist/node_modules/jsonfile/package.json +1 -1
  99. package/dist/node_modules/simple-git/dist/cjs/index.js +235 -235
  100. package/dist/node_modules/simple-git/dist/cjs/index.js.map +3 -3
  101. package/dist/node_modules/simple-git/dist/esm/index.js +229 -233
  102. package/dist/node_modules/simple-git/dist/esm/index.js.map +3 -3
  103. package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +1 -1
  104. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +1 -1
  105. package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +2 -3
  106. package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +2 -3
  107. package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +0 -1
  108. package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -1
  109. package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +2 -2
  110. package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +1 -1
  111. package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +1 -1
  112. package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +1 -1
  113. package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -3
  114. package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +1 -1
  115. package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +4 -2
  116. package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +3 -3
  117. package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +1 -1
  118. package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +2 -2
  119. package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +1 -1
  120. package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +9 -13
  121. package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +5 -6
  122. package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +5 -7
  123. package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +0 -1
  124. package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -1
  125. package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +1 -1
  126. package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +11 -10
  127. package/dist/node_modules/simple-git/package.json +6 -6
  128. package/dist/node_modules/simple-git/readme.md +8 -0
  129. package/dist/node_modules/undici-types/dispatcher.d.ts +1 -0
  130. package/dist/node_modules/undici-types/eventsource.d.ts +0 -2
  131. package/dist/node_modules/undici-types/filereader.d.ts +1 -1
  132. package/dist/node_modules/undici-types/interceptors.d.ts +3 -1
  133. package/dist/node_modules/undici-types/package.json +1 -1
  134. package/dist/node_modules/undici-types/patch.d.ts +0 -38
  135. package/dist/node_modules/undici-types/readable.d.ts +5 -0
  136. package/dist/node_modules/undici-types/webidl.d.ts +6 -0
  137. package/dist/node_modules/undici-types/websocket.d.ts +0 -2
  138. package/dist/package-lock.json +911 -812
  139. package/dist/package.json +1 -1
  140. package/dist/util/getAvailableStarters.js +2 -2
  141. package/package.json +1 -1
  142. package/dist/node_modules/@types/node/dom-events.d.ts +0 -124
  143. package/dist/node_modules/fast-uri/benchmark.js +0 -105
  144. package/dist/node_modules/fast-uri/lib/scopedChars.js +0 -30
  145. package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
  146. package/dist/node_modules/fast-uri/test/compatibility.test.js +0 -131
  147. package/dist/node_modules/jsonfile/CHANGELOG.md +0 -171
@@ -1,59 +1,99 @@
1
1
  'use strict'
2
2
 
3
- const { HEX } = require('./scopedChars')
4
-
5
- function normalizeIPv4 (host) {
6
- if (findToken(host, '.') < 3) { return { host, isIPV4: false } }
7
- const matches = host.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u) || []
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[]} input
18
- * @param {boolean} [keepZero=false]
19
- * @returns {string|undefined}
10
+ * @param {Array<string>} input
11
+ * @returns {string}
20
12
  */
21
- function stringArrayToHexStripped (input, keepZero = false) {
13
+ function stringArrayToHexStripped (input) {
22
14
  let acc = ''
23
- let strip = true
24
- for (const c of input) {
25
- if (HEX[c] === undefined) return undefined
26
- if (c !== '0' && strip === true) strip = false
27
- if (!strip) acc += c
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
- function consume () {
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 - 1 >= 0 && input[i - 1] === ':') {
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
- isZone = true
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 (isZone) {
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
- function normalizeIPv6 (host, opts = {}) {
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, escapedHost, isIPV6: true }
160
+ return { host: newHost, isIPV6: true, escapedHost }
111
161
  } else {
112
162
  return { host, isIPV6: false }
113
163
  }
114
164
  }
115
165
 
116
- function stripLeadingZeros (str, token) {
117
- let out = ''
118
- let skip = true
119
- const l = str.length
120
- for (let i = 0; i < l; i++) {
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
- const RDS1 = /^\.\.?\//u
148
- const RDS2 = /^\/\.(?:\/|$)/u
149
- const RDS3 = /^\/\.\.(?:\/|$)/u
150
- const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/u
151
-
152
- function removeDotSegments (input) {
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
- while (input.length) {
156
- if (input.match(RDS1)) {
157
- input = input.replace(RDS1, '')
158
- } else if (input.match(RDS2)) {
159
- input = input.replace(RDS2, '/')
160
- } else if (input.match(RDS3)) {
161
- input = input.replace(RDS3, '/')
162
- output.pop()
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
- throw new Error('Unexpected dot segment condition')
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
- function normalizeComponentEncoding (components, esc) {
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 (components.scheme !== undefined) {
182
- components.scheme = func(components.scheme)
273
+ if (component.scheme !== undefined) {
274
+ component.scheme = func(component.scheme)
183
275
  }
184
- if (components.userinfo !== undefined) {
185
- components.userinfo = func(components.userinfo)
276
+ if (component.userinfo !== undefined) {
277
+ component.userinfo = func(component.userinfo)
186
278
  }
187
- if (components.host !== undefined) {
188
- components.host = func(components.host)
279
+ if (component.host !== undefined) {
280
+ component.host = func(component.host)
189
281
  }
190
- if (components.path !== undefined) {
191
- components.path = func(components.path)
282
+ if (component.path !== undefined) {
283
+ component.path = func(component.path)
192
284
  }
193
- if (components.query !== undefined) {
194
- components.query = func(components.query)
285
+ if (component.query !== undefined) {
286
+ component.query = func(component.query)
195
287
  }
196
- if (components.fragment !== undefined) {
197
- components.fragment = func(components.fragment)
288
+ if (component.fragment !== undefined) {
289
+ component.fragment = func(component.fragment)
198
290
  }
199
- return components
291
+ return component
200
292
  }
201
293
 
202
- function recomposeAuthority (components, options) {
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 (components.userinfo !== undefined) {
206
- uriTokens.push(components.userinfo)
301
+ if (component.userinfo !== undefined) {
302
+ uriTokens.push(component.userinfo)
207
303
  uriTokens.push('@')
208
304
  }
209
305
 
210
- if (components.host !== undefined) {
211
- let host = unescape(components.host)
212
- const ipV4res = normalizeIPv4(host)
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 = components.host
313
+ host = component.host
222
314
  }
223
315
  }
224
316
  uriTokens.push(host)
225
317
  }
226
318
 
227
- if (typeof components.port === 'number' || typeof components.port === 'string') {
319
+ if (typeof component.port === 'number' || typeof component.port === 'string') {
228
320
  uriTokens.push(':')
229
- uriTokens.push(String(components.port))
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
- normalizeIPv4,
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 free RFC 3986 URI toolbox",
4
- "version": "3.0.3",
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
- "bench": "node benchmark.js",
20
- "lint": "standard | snazzy",
21
- "lint:fix": "standard --fix",
22
- "test": "npm run lint && npm run test:unit && npm run test:typescript",
23
- "test:ci": "npm run lint && npm run test:unit -- --coverage-report=lcovonly && npm run test:typescript",
24
- "test:unit": "npx tape test/**/*.js",
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
- "benchmark": "^2.1.4",
32
- "coveralls": "^3.1.1",
33
- "snazzy": "^9.0.0",
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.31.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
- const fastUri = require('../')
7
+
3
8
  const ajv = new AJV({
4
- uriResolver: fastUri // comment this line to see it works with uri-js
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 URI = require('../')
4
+ const fastURI = require('..')
5
5
 
6
- const fn = URI.equal
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