@emulsify/cli 1.11.4 → 1.12.1

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 (148) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/node_modules/.package-lock.json +34 -24
  3. package/dist/node_modules/@types/node/README.md +2 -2
  4. package/dist/node_modules/@types/node/assert.d.ts +23 -1
  5. package/dist/node_modules/@types/node/async_hooks.d.ts +64 -0
  6. package/dist/node_modules/@types/node/buffer.buffer.d.ts +124 -38
  7. package/dist/node_modules/@types/node/buffer.d.ts +19 -17
  8. package/dist/node_modules/@types/node/child_process.d.ts +88 -161
  9. package/dist/node_modules/@types/node/cluster.d.ts +5 -6
  10. package/dist/node_modules/@types/node/constants.d.ts +14 -12
  11. package/dist/node_modules/@types/node/crypto.d.ts +237 -166
  12. package/dist/node_modules/@types/node/dgram.d.ts +15 -14
  13. package/dist/node_modules/@types/node/diagnostics_channel.d.ts +39 -15
  14. package/dist/node_modules/@types/node/dns/promises.d.ts +11 -9
  15. package/dist/node_modules/@types/node/dns.d.ts +28 -21
  16. package/dist/node_modules/@types/node/events.d.ts +81 -35
  17. package/dist/node_modules/@types/node/fs/promises.d.ts +61 -36
  18. package/dist/node_modules/@types/node/fs.d.ts +251 -193
  19. package/dist/node_modules/@types/node/globals.d.ts +146 -442
  20. package/dist/node_modules/@types/node/globals.typedarray.d.ts +17 -0
  21. package/dist/node_modules/@types/node/http.d.ts +136 -31
  22. package/dist/node_modules/@types/node/http2.d.ts +102 -26
  23. package/dist/node_modules/@types/node/https.d.ts +94 -60
  24. package/dist/node_modules/@types/node/index.d.ts +5 -3
  25. package/dist/node_modules/@types/node/{inspector.d.ts → inspector.generated.d.ts} +272 -2
  26. package/dist/node_modules/@types/node/module.d.ts +362 -138
  27. package/dist/node_modules/@types/node/net.d.ts +27 -20
  28. package/dist/node_modules/@types/node/os.d.ts +14 -3
  29. package/dist/node_modules/@types/node/package.json +4 -89
  30. package/dist/node_modules/@types/node/perf_hooks.d.ts +37 -10
  31. package/dist/node_modules/@types/node/process.d.ts +108 -35
  32. package/dist/node_modules/@types/node/querystring.d.ts +2 -3
  33. package/dist/node_modules/@types/node/readline/promises.d.ts +1 -1
  34. package/dist/node_modules/@types/node/stream/consumers.d.ts +33 -7
  35. package/dist/node_modules/@types/node/stream/web.d.ts +13 -4
  36. package/dist/node_modules/@types/node/stream.d.ts +963 -1014
  37. package/dist/node_modules/@types/node/string_decoder.d.ts +2 -2
  38. package/dist/node_modules/@types/node/test.d.ts +1504 -1655
  39. package/dist/node_modules/@types/node/timers/promises.d.ts +28 -17
  40. package/dist/node_modules/@types/node/timers.d.ts +157 -111
  41. package/dist/node_modules/@types/node/tls.d.ts +105 -67
  42. package/dist/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +120 -37
  43. package/dist/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +15 -0
  44. package/dist/node_modules/@types/node/ts5.6/index.d.ts +5 -3
  45. package/dist/node_modules/@types/node/url.d.ts +10 -1
  46. package/dist/node_modules/@types/node/util.d.ts +28 -3
  47. package/dist/node_modules/@types/node/v8.d.ts +6 -5
  48. package/dist/node_modules/@types/node/vm.d.ts +147 -68
  49. package/dist/node_modules/@types/node/wasi.d.ts +1 -1
  50. package/dist/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  51. package/dist/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  52. package/dist/node_modules/@types/node/web-globals/events.d.ts +97 -0
  53. package/dist/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
  54. package/dist/node_modules/@types/node/worker_threads.d.ts +60 -39
  55. package/dist/node_modules/@types/node/zlib.d.ts +21 -20
  56. package/dist/node_modules/debug/package.json +7 -3
  57. package/dist/node_modules/debug/src/browser.js +2 -1
  58. package/dist/node_modules/debug/src/common.js +57 -39
  59. package/dist/node_modules/fast-uri/.github/dependabot.yml +1 -1
  60. package/dist/node_modules/fast-uri/.github/workflows/ci.yml +81 -3
  61. package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +6 -2
  62. package/dist/node_modules/fast-uri/LICENSE +3 -1
  63. package/dist/node_modules/fast-uri/README.md +55 -37
  64. package/dist/node_modules/fast-uri/benchmark/benchmark.mjs +159 -0
  65. package/dist/node_modules/fast-uri/benchmark/equal.mjs +51 -0
  66. package/dist/node_modules/fast-uri/benchmark/non-simple-domain.mjs +22 -0
  67. package/dist/node_modules/fast-uri/benchmark/package.json +17 -0
  68. package/dist/node_modules/fast-uri/benchmark/string-array-to-hex-stripped.mjs +24 -0
  69. package/dist/node_modules/fast-uri/benchmark/ws-is-secure.mjs +65 -0
  70. package/dist/node_modules/fast-uri/eslint.config.js +6 -0
  71. package/dist/node_modules/fast-uri/index.js +98 -61
  72. package/dist/node_modules/fast-uri/lib/schemes.js +160 -81
  73. package/dist/node_modules/fast-uri/lib/utils.js +217 -123
  74. package/dist/node_modules/fast-uri/package.json +44 -14
  75. package/dist/node_modules/fast-uri/test/ajv.test.js +7 -3
  76. package/dist/node_modules/fast-uri/test/equal.test.js +7 -2
  77. package/dist/node_modules/fast-uri/test/fixtures/uri-js-parse.json +501 -0
  78. package/dist/node_modules/fast-uri/test/fixtures/uri-js-serialize.json +120 -0
  79. package/dist/node_modules/fast-uri/test/parse.test.js +31 -31
  80. package/dist/node_modules/fast-uri/test/resolve.test.js +52 -49
  81. package/dist/node_modules/fast-uri/test/rfc-3986.test.js +90 -0
  82. package/dist/node_modules/fast-uri/test/serialize.test.js +55 -47
  83. package/dist/node_modules/fast-uri/test/uri-js-compatibility.test.js +33 -0
  84. package/dist/node_modules/fast-uri/test/uri-js.test.js +230 -230
  85. package/dist/node_modules/fast-uri/test/util.test.js +23 -8
  86. package/dist/node_modules/fast-uri/tsconfig.json +9 -0
  87. package/dist/node_modules/fast-uri/types/index.d.ts +16 -9
  88. package/dist/node_modules/fast-uri/types/index.test-d.ts +9 -9
  89. package/dist/node_modules/fs-extra/LICENSE +1 -1
  90. package/dist/node_modules/fs-extra/README.md +3 -1
  91. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +11 -1
  92. package/dist/node_modules/fs-extra/lib/copy/copy.js +13 -15
  93. package/dist/node_modules/fs-extra/lib/fs/index.js +6 -0
  94. package/dist/node_modules/fs-extra/lib/util/async.js +29 -0
  95. package/dist/node_modules/fs-extra/lib/util/stat.js +2 -1
  96. package/dist/node_modules/fs-extra/package.json +1 -1
  97. package/dist/node_modules/jsonfile/README.md +1 -1
  98. package/dist/node_modules/jsonfile/index.js +3 -3
  99. package/dist/node_modules/jsonfile/package.json +1 -1
  100. package/dist/node_modules/simple-git/dist/cjs/index.js +235 -235
  101. package/dist/node_modules/simple-git/dist/cjs/index.js.map +3 -3
  102. package/dist/node_modules/simple-git/dist/esm/index.js +229 -233
  103. package/dist/node_modules/simple-git/dist/esm/index.js.map +3 -3
  104. package/dist/node_modules/simple-git/dist/src/lib/git-logger.d.ts +1 -1
  105. package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +1 -1
  106. package/dist/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +2 -3
  107. package/dist/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +2 -3
  108. package/dist/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +0 -1
  109. package/dist/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -1
  110. package/dist/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +2 -2
  111. package/dist/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +1 -1
  112. package/dist/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +1 -1
  113. package/dist/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +1 -1
  114. package/dist/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -3
  115. package/dist/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +1 -1
  116. package/dist/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +4 -2
  117. package/dist/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +3 -3
  118. package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +1 -1
  119. package/dist/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +2 -2
  120. package/dist/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +1 -1
  121. package/dist/node_modules/simple-git/dist/src/lib/types/index.d.ts +9 -13
  122. package/dist/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +5 -6
  123. package/dist/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +5 -7
  124. package/dist/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +0 -1
  125. package/dist/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -1
  126. package/dist/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +1 -1
  127. package/dist/node_modules/simple-git/dist/src/lib/utils/util.d.ts +11 -10
  128. package/dist/node_modules/simple-git/package.json +6 -6
  129. package/dist/node_modules/simple-git/readme.md +8 -0
  130. package/dist/node_modules/undici-types/dispatcher.d.ts +1 -0
  131. package/dist/node_modules/undici-types/eventsource.d.ts +0 -2
  132. package/dist/node_modules/undici-types/filereader.d.ts +1 -1
  133. package/dist/node_modules/undici-types/interceptors.d.ts +3 -1
  134. package/dist/node_modules/undici-types/package.json +1 -1
  135. package/dist/node_modules/undici-types/patch.d.ts +0 -38
  136. package/dist/node_modules/undici-types/readable.d.ts +5 -0
  137. package/dist/node_modules/undici-types/webidl.d.ts +6 -0
  138. package/dist/node_modules/undici-types/websocket.d.ts +0 -2
  139. package/dist/package-lock.json +912 -813
  140. package/dist/package.json +2 -2
  141. package/dist/util/getAvailableStarters.js +3 -3
  142. package/package.json +2 -2
  143. package/dist/node_modules/@types/node/dom-events.d.ts +0 -124
  144. package/dist/node_modules/fast-uri/benchmark.js +0 -105
  145. package/dist/node_modules/fast-uri/lib/scopedChars.js +0 -30
  146. package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
  147. package/dist/node_modules/fast-uri/test/compatibility.test.js +0 -131
  148. package/dist/node_modules/jsonfile/CHANGELOG.md +0 -171
@@ -166,24 +166,62 @@ function setup(env) {
166
166
  createDebug.names = [];
167
167
  createDebug.skips = [];
168
168
 
169
- let i;
170
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
171
- const len = split.length;
172
-
173
- for (i = 0; i < len; i++) {
174
- if (!split[i]) {
175
- // ignore empty strings
176
- continue;
169
+ const split = (typeof namespaces === 'string' ? namespaces : '')
170
+ .trim()
171
+ .replace(/\s+/g, ',')
172
+ .split(',')
173
+ .filter(Boolean);
174
+
175
+ for (const ns of split) {
176
+ if (ns[0] === '-') {
177
+ createDebug.skips.push(ns.slice(1));
178
+ } else {
179
+ createDebug.names.push(ns);
177
180
  }
181
+ }
182
+ }
178
183
 
179
- namespaces = split[i].replace(/\*/g, '.*?');
180
-
181
- if (namespaces[0] === '-') {
182
- createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
184
+ /**
185
+ * Checks if the given string matches a namespace template, honoring
186
+ * asterisks as wildcards.
187
+ *
188
+ * @param {String} search
189
+ * @param {String} template
190
+ * @return {Boolean}
191
+ */
192
+ function matchesTemplate(search, template) {
193
+ let searchIndex = 0;
194
+ let templateIndex = 0;
195
+ let starIndex = -1;
196
+ let matchIndex = 0;
197
+
198
+ while (searchIndex < search.length) {
199
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
200
+ // Match character or proceed with wildcard
201
+ if (template[templateIndex] === '*') {
202
+ starIndex = templateIndex;
203
+ matchIndex = searchIndex;
204
+ templateIndex++; // Skip the '*'
205
+ } else {
206
+ searchIndex++;
207
+ templateIndex++;
208
+ }
209
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
210
+ // Backtrack to the last '*' and try to match more characters
211
+ templateIndex = starIndex + 1;
212
+ matchIndex++;
213
+ searchIndex = matchIndex;
183
214
  } else {
184
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
215
+ return false; // No match
185
216
  }
186
217
  }
218
+
219
+ // Handle trailing '*' in template
220
+ while (templateIndex < template.length && template[templateIndex] === '*') {
221
+ templateIndex++;
222
+ }
223
+
224
+ return templateIndex === template.length;
187
225
  }
188
226
 
189
227
  /**
@@ -194,8 +232,8 @@ function setup(env) {
194
232
  */
195
233
  function disable() {
196
234
  const namespaces = [
197
- ...createDebug.names.map(toNamespace),
198
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
235
+ ...createDebug.names,
236
+ ...createDebug.skips.map(namespace => '-' + namespace)
199
237
  ].join(',');
200
238
  createDebug.enable('');
201
239
  return namespaces;
@@ -209,21 +247,14 @@ function setup(env) {
209
247
  * @api public
210
248
  */
211
249
  function enabled(name) {
212
- if (name[name.length - 1] === '*') {
213
- return true;
214
- }
215
-
216
- let i;
217
- let len;
218
-
219
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
220
- if (createDebug.skips[i].test(name)) {
250
+ for (const skip of createDebug.skips) {
251
+ if (matchesTemplate(name, skip)) {
221
252
  return false;
222
253
  }
223
254
  }
224
255
 
225
- for (i = 0, len = createDebug.names.length; i < len; i++) {
226
- if (createDebug.names[i].test(name)) {
256
+ for (const ns of createDebug.names) {
257
+ if (matchesTemplate(name, ns)) {
227
258
  return true;
228
259
  }
229
260
  }
@@ -231,19 +262,6 @@ function setup(env) {
231
262
  return false;
232
263
  }
233
264
 
234
- /**
235
- * Convert regexp to namespace
236
- *
237
- * @param {RegExp} regxep
238
- * @return {String} namespace
239
- * @api private
240
- */
241
- function toNamespace(regexp) {
242
- return regexp.toString()
243
- .substring(2, regexp.toString().length - 2)
244
- .replace(/\.\*\?$/, '*');
245
- }
246
-
247
265
  /**
248
266
  * Coerce `val`.
249
267
  *
@@ -9,5 +9,5 @@ updates:
9
9
  - package-ecosystem: "npm"
10
10
  directory: "/"
11
11
  schedule:
12
- interval: "weekly"
12
+ interval: "monthly"
13
13
  open-pull-requests-limit: 10
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- - master
8
7
  - next
9
8
  - 'v*'
10
9
  paths-ignore:
@@ -15,9 +14,88 @@ on:
15
14
  - 'docs/**'
16
15
  - '*.md'
17
16
 
17
+ permissions:
18
+ contents: read
19
+
18
20
  jobs:
21
+ test-regression-check-node10:
22
+ name: Test compatibility with Node.js 10
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: read
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ with:
29
+ persist-credentials: false
30
+
31
+ - uses: actions/setup-node@v4
32
+ with:
33
+ node-version: '10'
34
+ cache: 'npm'
35
+ cache-dependency-path: package.json
36
+ check-latest: true
37
+
38
+ - name: Install
39
+ run: |
40
+ npm install --ignore-scripts
41
+
42
+ - name: Copy project as fast-uri to node_node_modules
43
+ run: |
44
+ rm -rf ./node_modules/fast-uri/lib &&
45
+ rm -rf ./node_modules/fast-uri/index.js &&
46
+ cp -r ./lib ./node_modules/fast-uri/lib &&
47
+ cp ./index.js ./node_modules/fast-uri/index.js
48
+
49
+ - name: Run tests
50
+ run: |
51
+ npm run test:unit
52
+ env:
53
+ NODE_OPTIONS: no-network-family-autoselection
54
+
55
+ test-browser:
56
+ name: Test browser compatibility
57
+ runs-on: ${{ matrix.os }}
58
+ strategy:
59
+ fail-fast: false
60
+ matrix:
61
+ os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
62
+ browser: ['chromium', 'firefox', 'webkit']
63
+ exclude:
64
+ - os: ubuntu-latest
65
+ browser: webkit
66
+ permissions:
67
+ contents: read
68
+ steps:
69
+ - uses: actions/checkout@v4
70
+ with:
71
+ persist-credentials: false
72
+
73
+ - uses: actions/setup-node@v4
74
+ with:
75
+ node-version: '24'
76
+ cache: 'npm'
77
+ cache-dependency-path: package.json
78
+ check-latest: true
79
+
80
+ - name: Install dependencies
81
+ run: |
82
+ npm install --ignore-scripts
83
+
84
+ - if: ${{ matrix.os == 'windows-latest' }}
85
+ run: npx playwright install winldd
86
+
87
+ - name: Run browser tests
88
+ run: |
89
+ npm run test:browser:${{ matrix.browser }}
90
+
19
91
  test:
20
- uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5.0.0
92
+ needs:
93
+ - test-regression-check-node10
94
+ permissions:
95
+ contents: write
96
+ pull-requests: write
97
+ uses: fastify/workflows/.github/workflows/plugins-ci.yml@v5
21
98
  with:
22
99
  license-check: true
23
- node-versions: '["16", "18", "20", "22"]'
100
+ lint: true
101
+ node-versions: '["16", "18", "20", "22", "24"]'
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- - master
8
7
  - next
9
8
  - 'v*'
10
9
  paths-ignore:
@@ -15,6 +14,11 @@ on:
15
14
  - 'docs/**'
16
15
  - '*.md'
17
16
 
17
+ permissions:
18
+ contents: read
19
+
18
20
  jobs:
19
21
  test:
20
- uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v5.0.0
22
+ permissions:
23
+ contents: read
24
+ uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v5
@@ -1,7 +1,9 @@
1
- Copyright (c) 2021 The Fastify Team
2
1
  Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
2
+ Copyright (c) 2021-present The Fastify team
3
3
  All rights reserved.
4
4
 
5
+ The Fastify team members are listed at https://github.com/fastify/fastify#team.
6
+
5
7
  Redistribution and use in source and binary forms, with or without
6
8
  modification, are permitted provided that the following conditions are met:
7
9
  * Redistributions of source code must retain the above copyright
@@ -2,12 +2,13 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- [![CI](https://github.com/fastify/fast-uri/actions/workflows/ci.yml/badge.svg)](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
6
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
5
+ [![NPM version](https://img.shields.io/npm/v/fast-uri.svg?style=flat)](https://www.npmjs.com/package/fast-uri)
6
+ [![CI](https://github.com/fastify/fast-uri/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
7
+ [![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
7
8
 
8
9
  </div>
9
10
 
10
- Dependency free RFC 3986 URI toolbox.
11
+ Dependency-free RFC 3986 URI toolbox.
11
12
 
12
13
  ## Usage
13
14
 
@@ -40,13 +41,13 @@ const uri = require('fast-uri')
40
41
  uri.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
41
42
  // Output
42
43
  {
43
- scheme : "uri",
44
- userinfo : "user:pass",
45
- host : "example.com",
46
- port : 123,
47
- path : "/one/two.three",
48
- query : "q1=a1&q2=a2",
49
- fragment : "body"
44
+ scheme: "uri",
45
+ userinfo: "user:pass",
46
+ host: "example.com",
47
+ port: 123,
48
+ path: "/one/two.three",
49
+ query: "q1=a1&q2=a2",
50
+ fragment: "body"
50
51
  }
51
52
  ```
52
53
 
@@ -54,7 +55,7 @@ uri.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
54
55
 
55
56
  ```js
56
57
  const uri = require('fast-uri')
57
- uri.serialize({scheme : "http", host : "example.com", fragment : "footer"})
58
+ uri.serialize({scheme: "http", host: "example.com", fragment: "footer"})
58
59
  // Output
59
60
  "http://example.com/#footer"
60
61
 
@@ -64,7 +65,7 @@ uri.serialize({scheme : "http", host : "example.com", fragment : "footer"})
64
65
 
65
66
  ```js
66
67
  const uri = require('fast-uri')
67
- uri.resolve("uri://a/b/c/d?q", "../../g")
68
+ uri.resolve("uri://a/b/c/d?q", "../../g")
68
69
  // Output
69
70
  "uri://a/g"
70
71
  ```
@@ -80,7 +81,7 @@ true
80
81
 
81
82
  ## Scheme supports
82
83
 
83
- fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, fast-uri has built in support for the following schemes:
84
+ fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme)-dependent processing rules. Currently, fast-uri has built-in support for the following schemes:
84
85
 
85
86
  * http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
86
87
  * https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
@@ -93,33 +94,50 @@ fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_sch
93
94
  ## Benchmarks
94
95
 
95
96
  ```
96
- fast-uri: parse domain x 1,306,864 ops/sec ±0.31% (100 runs sampled)
97
- urijs: parse domain x 483,001 ops/sec ±0.09% (99 runs sampled)
98
- WHATWG URL: parse domain x 862,461 ops/sec ±0.18% (97 runs sampled)
99
- fast-uri: parse IPv4 x 2,381,452 ops/sec ±0.26% (96 runs sampled)
100
- urijs: parse IPv4 x 384,705 ops/sec ±0.34% (99 runs sampled)
101
- WHATWG URL: parse IPv4 NOT SUPPORTED
102
- fast-uri: parse IPv6 x 923,519 ops/sec ±0.09% (100 runs sampled)
103
- urijs: parse IPv6 x 289,070 ops/sec ±0.07% (95 runs sampled)
104
- WHATWG URL: parse IPv6 NOT SUPPORTED
105
- fast-uri: parse URN x 2,596,395 ops/sec ±0.42% (98 runs sampled)
106
- urijs: parse URN x 1,152,412 ops/sec ±0.09% (97 runs sampled)
107
- WHATWG URL: parse URN x 1,183,307 ops/sec ±0.38% (100 runs sampled)
108
- fast-uri: parse URN uuid x 1,666,861 ops/sec ±0.10% (98 runs sampled)
109
- urijs: parse URN uuid x 852,724 ops/sec ±0.17% (95 runs sampled)
110
- WHATWG URL: parse URN uuid NOT SUPPORTED
111
- fast-uri: serialize uri x 1,741,499 ops/sec ±0.57% (95 runs sampled)
112
- urijs: serialize uri x 389,014 ops/sec ±0.28% (93 runs sampled)
113
- fast-uri: serialize IPv6 x 441,095 ops/sec ±0.37% (97 runs sampled)
114
- urijs: serialize IPv6 x 255,443 ops/sec ±0.58% (94 runs sampled)
115
- fast-uri: serialize ws x 1,448,667 ops/sec ±0.25% (97 runs sampled)
116
- urijs: serialize ws x 352,884 ops/sec ±0.08% (96 runs sampled)
117
- fast-uri: resolve x 340,084 ops/sec ±0.98% (98 runs sampled)
118
- urijs: resolve x 225,759 ops/sec ±0.37% (95 runs sampled)
97
+ fast-uri benchmark
98
+ ┌─────────┬──────────────────────────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
99
+ │ (index) │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
100
+ ├─────────┼──────────────────────────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
101
+ │ 0 │ 'fast-uri: parse domain' │ '951.31 ± 0.75%' │ '875.00 ± 11.00' │ '1122538 ± 0.01%' │ '1142857 ± 14550' │ 1051187 │
102
+ │ 1 │ 'fast-uri: parse IPv4' │ '443.44 ± 0.22%' │ '406.00 ± 3.00' │ '2422762 ± 0.01%' │ '2463054 ± 18335' │ 2255105 │
103
+ │ 2 │ 'fast-uri: parse IPv6' │ '1241.6 ± 1.74%' │ '1131.0 ± 30.00' │ '875177 ± 0.02%' │ '884173 ± 24092' │ 805399 │
104
+ │ 3 │ 'fast-uri: parse URN' │ '689.19 ± 4.29%' │ '618.00 ± 9.00' │ '1598373 ± 0.01%' │ '1618123 ± 23913' │ 1450972 │
105
+ │ 4 │ 'fast-uri: parse URN uuid' │ '1025.4 ± 2.02%' │ '921.00 ± 19.00' │ '1072419 ± 0.02%' │ '1085776 ± 22871' │ 975236 │
106
+ │ 5 │ 'fast-uri: serialize uri' │ '1028.5 ± 0.53%' │ '933.00 ± 43.00' │ '1063310 ± 0.02%' │ '1071811 ± 50523' │ 972249 │
107
+ │ 6 │ 'fast-uri: serialize long uri with dots' │ '1805.1 ± 0.52%' │ '1627.0 ± 17.00' │ '602620 ± 0.02%' │ '614628 ± 6490' │ 553997 │
108
+ │ 7 │ 'fast-uri: serialize IPv6' │ '2569.4 ± 2.69%' │ '2302.0 ± 21.00' │ '426080 ± 0.03%' │ '434405 ± 3999' │ 389194 │
109
+ │ 8 │ 'fast-uri: serialize ws' │ '979.39 ± 0.43%' │ '882.00 ± 8.00' │ '1111665 ± 0.02%' │ '1133787 ± 10378' │ 1021045 │
110
+ │ 9 │ 'fast-uri: resolve' │ '2208.2 ± 1.08%' │ '1980.0 ± 24.00' │ '495001 ± 0.03%' │ '505051 ± 6049' │ 452848 │
111
+ └─────────┴──────────────────────────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
112
+ uri-js benchmark
113
+ ┌─────────┬───────────────────────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
114
+ │ (index) │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
115
+ ├─────────┼───────────────────────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
116
+ │ 0 │ 'urijs: parse domain' │ '3618.3 ± 0.43%' │ '3314.0 ± 33.00' │ '294875 ± 0.04%' │ '301750 ± 2975' │ 276375 │
117
+ │ 1 │ 'urijs: parse IPv4' │ '4024.1 ± 0.41%' │ '3751.0 ± 25.00' │ '261981 ± 0.04%' │ '266596 ± 1789' │ 248506 │
118
+ │ 2 │ 'urijs: parse IPv6' │ '5417.2 ± 0.46%' │ '4968.0 ± 43.00' │ '196023 ± 0.05%' │ '201288 ± 1727' │ 184598 │
119
+ │ 3 │ 'urijs: parse URN' │ '1324.2 ± 0.23%' │ '1229.0 ± 17.00' │ '801535 ± 0.02%' │ '813670 ± 11413' │ 755185 │
120
+ │ 4 │ 'urijs: parse URN uuid' │ '1822.0 ± 3.08%' │ '1655.0 ± 15.00' │ '594433 ± 0.02%' │ '604230 ± 5427' │ 548843 │
121
+ │ 5 │ 'urijs: serialize uri' │ '4196.8 ± 0.36%' │ '3908.0 ± 27.00' │ '251146 ± 0.04%' │ '255885 ± 1756' │ 238276 │
122
+ │ 6 │ 'urijs: serialize long uri with dots' │ '8331.0 ± 1.30%' │ '7658.0 ± 72.00' │ '126440 ± 0.07%' │ '130582 ± 1239' │ 120034 │
123
+ │ 7 │ 'urijs: serialize IPv6' │ '5685.5 ± 0.30%' │ '5366.0 ± 33.00' │ '182632 ± 0.05%' │ '186359 ± 1153' │ 175886 │
124
+ │ 8 │ 'urijs: serialize ws' │ '4159.3 ± 0.20%' │ '3899.0 ± 28.00' │ '250459 ± 0.04%' │ '256476 ± 1855' │ 240423 │
125
+ │ 9 │ 'urijs: resolve' │ '6729.9 ± 0.39%' │ '6261.0 ± 37.00' │ '156361 ± 0.06%' │ '159719 ± 949' │ 148591 │
126
+ └─────────┴───────────────────────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
127
+ WHATWG URL benchmark
128
+ ┌─────────┬────────────────────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
129
+ │ (index) │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
130
+ ├─────────┼────────────────────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
131
+ │ 0 │ 'WHATWG URL: parse domain' │ '475.22 ± 0.20%' │ '444.00 ± 5.00' │ '2217599 ± 0.01%' │ '2252252 ± 25652' │ 2104289 │
132
+ │ 1 │ 'WHATWG URL: parse URN' │ '384.78 ± 0.85%' │ '350.00 ± 5.00' │ '2809071 ± 0.01%' │ '2857143 ± 41408' │ 2598885 │
133
+ └─────────┴────────────────────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
119
134
  ```
120
135
 
121
136
  ## TODO
122
137
 
123
138
  - [ ] Support MailTo
124
139
  - [ ] Be 100% iso compatible with uri-js
125
- - [ ] Add browser test stack
140
+
141
+ ## License
142
+
143
+ Licensed under [BSD-3-Clause](./LICENSE).
@@ -0,0 +1,159 @@
1
+ import { Bench } from 'tinybench'
2
+ import { fastUri } from '../index.js'
3
+ import { parse as uriJsParse, serialize as uriJsSerialize, resolve as uriJsResolve, equal as uriJsEqual } from 'uri-js'
4
+
5
+ const base = 'uri://a/b/c/d;p?q'
6
+
7
+ const domain = 'https://example.com/foo#bar$fiz'
8
+ const ipv4 = '//10.10.10.10'
9
+ const ipv6 = '//[2001:db8::7]'
10
+ const urn = 'urn:foo:a123,456'
11
+ const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
12
+
13
+ const urnuuidComponent = {
14
+ scheme: 'urn',
15
+ nid: 'uuid',
16
+ uuid: 'f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
17
+ }
18
+
19
+ const {
20
+ parse: fastUriParse,
21
+ serialize: fastUriSerialize,
22
+ resolve: fastUriResolve,
23
+ equal: fastUriEqual,
24
+ } = fastUri
25
+
26
+ // Initialization as there is a lot to parse at first
27
+ // eg: regexes
28
+ fastUriParse(domain)
29
+ uriJsParse(domain)
30
+
31
+ const benchFastUri = new Bench({ name: 'fast-uri benchmark' })
32
+ const benchUriJs = new Bench({ name: 'uri-js benchmark' })
33
+ const benchWHATWG = new Bench({ name: 'WHATWG URL benchmark' })
34
+
35
+ benchFastUri.add('fast-uri: parse domain', function () {
36
+ fastUriParse(domain)
37
+ })
38
+ benchUriJs.add('urijs: parse domain', function () {
39
+ uriJsParse(domain)
40
+ })
41
+ benchWHATWG.add('WHATWG URL: parse domain', function () {
42
+ // eslint-disable-next-line
43
+ new URL(domain)
44
+ })
45
+ benchFastUri.add('fast-uri: parse IPv4', function () {
46
+ fastUriParse(ipv4)
47
+ })
48
+ benchUriJs.add('urijs: parse IPv4', function () {
49
+ uriJsParse(ipv4)
50
+ })
51
+ benchFastUri.add('fast-uri: parse IPv6', function () {
52
+ fastUriParse(ipv6)
53
+ })
54
+ benchUriJs.add('urijs: parse IPv6', function () {
55
+ uriJsParse(ipv6)
56
+ })
57
+ benchFastUri.add('fast-uri: parse URN', function () {
58
+ fastUriParse(urn)
59
+ })
60
+ benchUriJs.add('urijs: parse URN', function () {
61
+ uriJsParse(urn)
62
+ })
63
+ benchWHATWG.add('WHATWG URL: parse URN', function () {
64
+ // eslint-disable-next-line
65
+ new URL(urn)
66
+ })
67
+ benchFastUri.add('fast-uri: parse URN uuid', function () {
68
+ fastUriParse(urnuuid)
69
+ })
70
+ benchUriJs.add('urijs: parse URN uuid', function () {
71
+ uriJsParse(urnuuid)
72
+ })
73
+ benchFastUri.add('fast-uri: serialize URN uuid', function () {
74
+ fastUriSerialize(urnuuidComponent)
75
+ })
76
+ benchUriJs.add('uri-js: serialize URN uuid', function () {
77
+ uriJsSerialize(urnuuidComponent)
78
+ })
79
+ benchFastUri.add('fast-uri: serialize uri', function () {
80
+ fastUriSerialize({
81
+ scheme: 'uri',
82
+ userinfo: 'foo:bar',
83
+ host: 'example.com',
84
+ port: 1,
85
+ path: 'path',
86
+ query: 'query',
87
+ fragment: 'fragment'
88
+ })
89
+ })
90
+ benchUriJs.add('urijs: serialize uri', function () {
91
+ uriJsSerialize({
92
+ scheme: 'uri',
93
+ userinfo: 'foo:bar',
94
+ host: 'example.com',
95
+ port: 1,
96
+ path: 'path',
97
+ query: 'query',
98
+ fragment: 'fragment'
99
+ })
100
+ })
101
+ benchFastUri.add('fast-uri: serialize long uri with dots', function () {
102
+ fastUriSerialize({
103
+ scheme: 'uri',
104
+ userinfo: 'foo:bar',
105
+ host: 'example.com',
106
+ port: 1,
107
+ path: './a/./b/c/../.././d/../e/f/.././/',
108
+ query: 'query',
109
+ fragment: 'fragment'
110
+ })
111
+ })
112
+ benchUriJs.add('urijs: serialize long uri with dots', function () {
113
+ uriJsSerialize({
114
+ scheme: 'uri',
115
+ userinfo: 'foo:bar',
116
+ host: 'example.com',
117
+ port: 1,
118
+ path: './a/./b/c/../.././d/../e/f/.././/',
119
+ query: 'query',
120
+ fragment: 'fragment'
121
+ })
122
+ })
123
+ benchFastUri.add('fast-uri: serialize IPv6', function () {
124
+ fastUriSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
125
+ })
126
+ benchUriJs.add('urijs: serialize IPv6', function () {
127
+ uriJsSerialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
128
+ })
129
+ benchFastUri.add('fast-uri: serialize ws', function () {
130
+ fastUriSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
131
+ })
132
+ benchUriJs.add('urijs: serialize ws', function () {
133
+ uriJsSerialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
134
+ })
135
+ benchFastUri.add('fast-uri: resolve', function () {
136
+ fastUriResolve(base, '../../../g')
137
+ })
138
+ benchUriJs.add('urijs: resolve', function () {
139
+ uriJsResolve(base, '../../../g')
140
+ })
141
+
142
+ benchFastUri.add('fast-uri: equal', function () {
143
+ fastUriEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d')
144
+ })
145
+ benchUriJs.add('urijs: equal', function () {
146
+ uriJsEqual('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d')
147
+ })
148
+
149
+ await benchFastUri.run()
150
+ console.log(benchFastUri.name)
151
+ console.table(benchFastUri.table())
152
+
153
+ await benchUriJs.run()
154
+ console.log(benchUriJs.name)
155
+ console.table(benchUriJs.table())
156
+
157
+ await benchWHATWG.run()
158
+ console.log(benchWHATWG.name)
159
+ console.table(benchWHATWG.table())
@@ -0,0 +1,51 @@
1
+ import { Bench } from 'tinybench'
2
+ import { fastUri } from '../index.js'
3
+
4
+ const {
5
+ equal: fastUriEqual,
6
+ parse: fastUriParse,
7
+ } = fastUri
8
+
9
+ const stringA = 'example://a/b/c/%7Bfoo%7D'
10
+ const stringB = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'
11
+
12
+ const componentA = fastUriParse(stringA)
13
+ const componentB = fastUriParse(stringB)
14
+
15
+ const benchFastUri = new Bench({ name: 'fast-uri equal' })
16
+
17
+ benchFastUri.add('equal string with string', function () {
18
+ fastUriEqual(stringA, stringA)
19
+ })
20
+
21
+ benchFastUri.add('equal component with component', function () {
22
+ fastUriEqual(componentA, componentA)
23
+ })
24
+
25
+ benchFastUri.add('equal component with string', function () {
26
+ fastUriEqual(componentA, stringA)
27
+ })
28
+
29
+ benchFastUri.add('equal string with component', function () {
30
+ fastUriEqual(stringA, componentA)
31
+ })
32
+
33
+ benchFastUri.add('not equal string with string', function () {
34
+ fastUriEqual(stringA, stringB)
35
+ })
36
+
37
+ benchFastUri.add('not equal component with component', function () {
38
+ fastUriEqual(componentA, componentB)
39
+ })
40
+
41
+ benchFastUri.add('not equal component with string', function () {
42
+ fastUriEqual(componentA, stringB)
43
+ })
44
+
45
+ benchFastUri.add('not equal string with component', function () {
46
+ fastUriEqual(stringA, componentB)
47
+ })
48
+
49
+ await benchFastUri.run()
50
+ console.log(benchFastUri.name)
51
+ console.table(benchFastUri.table())
@@ -0,0 +1,22 @@
1
+ import { Bench } from 'tinybench'
2
+ import { nonSimpleDomain } from '../lib/utils.js'
3
+
4
+ const benchNonSimpleDomain = new Bench({ name: 'nonSimpleDomain' })
5
+
6
+ const exampleCom = 'example.com'
7
+ const exaumlmpleCom = 'exämple.com'
8
+ const longDomain = 'abc'.repeat(100) + '.com'
9
+
10
+ console.assert(nonSimpleDomain(exampleCom) === false, 'example.com should be a simple domain')
11
+ console.assert(nonSimpleDomain(exaumlmpleCom) === true, 'exämple.com should not be a simple domain')
12
+ console.assert(nonSimpleDomain(longDomain) === false, `${longDomain} should be a simple domain?`)
13
+
14
+ benchNonSimpleDomain.add('nonSimpleDomain', function () {
15
+ nonSimpleDomain(exampleCom)
16
+ nonSimpleDomain(exaumlmpleCom)
17
+ nonSimpleDomain(longDomain)
18
+ })
19
+
20
+ await benchNonSimpleDomain.run()
21
+ console.log(benchNonSimpleDomain.name)
22
+ console.table(benchNonSimpleDomain.table())