cdk-common 2.0.863 → 2.0.864
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/.jsii +2 -2
- package/lib/main.js +1 -1
- package/node_modules/punycode/LICENSE-MIT.txt +20 -0
- package/node_modules/punycode/README.md +148 -0
- package/node_modules/punycode/package.json +58 -0
- package/node_modules/punycode/punycode.es6.js +444 -0
- package/node_modules/punycode/punycode.js +443 -0
- package/node_modules/table/node_modules/ajv/dist/compile/resolve.d.ts +1 -1
- package/node_modules/table/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
- package/node_modules/table/node_modules/ajv/dist/runtime/uri.js +1 -1
- package/node_modules/table/node_modules/ajv/dist/runtime/uri.js.map +1 -1
- package/node_modules/table/node_modules/ajv/dist/types/index.d.ts +1 -1
- package/node_modules/table/node_modules/ajv/lib/compile/index.ts +1 -1
- package/node_modules/table/node_modules/ajv/lib/compile/resolve.ts +1 -1
- package/node_modules/table/node_modules/ajv/lib/runtime/uri.ts +1 -1
- package/node_modules/table/node_modules/ajv/lib/types/index.ts +1 -1
- package/node_modules/table/node_modules/ajv/package.json +4 -4
- package/node_modules/uri-js/LICENSE +11 -0
- package/node_modules/uri-js/README.md +203 -0
- package/node_modules/uri-js/dist/es5/uri.all.d.ts +59 -0
- package/node_modules/uri-js/dist/es5/uri.all.js +1443 -0
- package/node_modules/uri-js/dist/es5/uri.all.js.map +1 -0
- package/node_modules/uri-js/dist/es5/uri.all.min.d.ts +59 -0
- package/node_modules/uri-js/dist/es5/uri.all.min.js +3 -0
- package/node_modules/uri-js/dist/es5/uri.all.min.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/index.d.ts +1 -0
- package/node_modules/uri-js/dist/esnext/index.js +17 -0
- package/node_modules/uri-js/dist/esnext/index.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +3 -0
- package/node_modules/uri-js/dist/esnext/regexps-iri.js +3 -0
- package/node_modules/uri-js/dist/esnext/regexps-iri.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +4 -0
- package/node_modules/uri-js/dist/esnext/regexps-uri.js +42 -0
- package/node_modules/uri-js/dist/esnext/regexps-uri.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/http.d.ts +3 -0
- package/node_modules/uri-js/dist/esnext/schemes/http.js +28 -0
- package/node_modules/uri-js/dist/esnext/schemes/http.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/https.d.ts +3 -0
- package/node_modules/uri-js/dist/esnext/schemes/https.js +9 -0
- package/node_modules/uri-js/dist/esnext/schemes/https.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +12 -0
- package/node_modules/uri-js/dist/esnext/schemes/mailto.js +148 -0
- package/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +7 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +23 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +10 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn.js +49 -0
- package/node_modules/uri-js/dist/esnext/schemes/urn.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +7 -0
- package/node_modules/uri-js/dist/esnext/schemes/ws.js +41 -0
- package/node_modules/uri-js/dist/esnext/schemes/ws.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +3 -0
- package/node_modules/uri-js/dist/esnext/schemes/wss.js +9 -0
- package/node_modules/uri-js/dist/esnext/schemes/wss.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/uri.d.ts +59 -0
- package/node_modules/uri-js/dist/esnext/uri.js +480 -0
- package/node_modules/uri-js/dist/esnext/uri.js.map +1 -0
- package/node_modules/uri-js/dist/esnext/util.d.ts +6 -0
- package/node_modules/uri-js/dist/esnext/util.js +36 -0
- package/node_modules/uri-js/dist/esnext/util.js.map +1 -0
- package/node_modules/uri-js/package.json +77 -0
- package/package.json +1 -1
- package/node_modules/fast-uri/.gitattributes +0 -2
- package/node_modules/fast-uri/.github/.stale.yml +0 -21
- package/node_modules/fast-uri/.github/dependabot.yml +0 -13
- package/node_modules/fast-uri/.github/tests_checker.yml +0 -8
- package/node_modules/fast-uri/.github/workflows/ci.yml +0 -22
- package/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +0 -20
- package/node_modules/fast-uri/LICENSE +0 -30
- package/node_modules/fast-uri/README.md +0 -125
- package/node_modules/fast-uri/benchmark.js +0 -105
- package/node_modules/fast-uri/index.js +0 -305
- package/node_modules/fast-uri/lib/schemes.js +0 -188
- package/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/node_modules/fast-uri/lib/utils.js +0 -236
- package/node_modules/fast-uri/package.json +0 -41
- package/node_modules/fast-uri/test/.gitkeep +0 -0
- package/node_modules/fast-uri/test/compatibility.test.js +0 -129
- package/node_modules/fast-uri/test/equal.test.js +0 -104
- package/node_modules/fast-uri/test/parse.test.js +0 -310
- package/node_modules/fast-uri/test/resolve.test.js +0 -76
- package/node_modules/fast-uri/test/serialize.test.js +0 -144
- package/node_modules/fast-uri/types/index.d.ts +0 -53
- package/node_modules/fast-uri/types/index.test-d.ts +0 -17
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Number of days of inactivity before an issue becomes stale
|
|
2
|
-
daysUntilStale: 15
|
|
3
|
-
# Number of days of inactivity before a stale issue is closed
|
|
4
|
-
daysUntilClose: 7
|
|
5
|
-
# Issues with these labels will never be considered stale
|
|
6
|
-
exemptLabels:
|
|
7
|
-
- "discussion"
|
|
8
|
-
- "feature request"
|
|
9
|
-
- "bug"
|
|
10
|
-
- "help wanted"
|
|
11
|
-
- "plugin suggestion"
|
|
12
|
-
- "good first issue"
|
|
13
|
-
# Label to use when marking an issue as stale
|
|
14
|
-
staleLabel: stale
|
|
15
|
-
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
16
|
-
markComment: >
|
|
17
|
-
This issue has been automatically marked as stale because it has not had
|
|
18
|
-
recent activity. It will be closed if no further activity occurs. Thank you
|
|
19
|
-
for your contributions.
|
|
20
|
-
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
21
|
-
closeComment: false
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: "github-actions"
|
|
4
|
-
directory: "/"
|
|
5
|
-
schedule:
|
|
6
|
-
interval: "monthly"
|
|
7
|
-
open-pull-requests-limit: 10
|
|
8
|
-
|
|
9
|
-
- package-ecosystem: "npm"
|
|
10
|
-
directory: "/"
|
|
11
|
-
schedule:
|
|
12
|
-
interval: "weekly"
|
|
13
|
-
open-pull-requests-limit: 10
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
- master
|
|
8
|
-
- next
|
|
9
|
-
- 'v*'
|
|
10
|
-
paths-ignore:
|
|
11
|
-
- 'docs/**'
|
|
12
|
-
- '*.md'
|
|
13
|
-
pull_request:
|
|
14
|
-
paths-ignore:
|
|
15
|
-
- 'docs/**'
|
|
16
|
-
- '*.md'
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
test:
|
|
20
|
-
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
|
|
21
|
-
with:
|
|
22
|
-
license-check: true
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
name: package-manager-ci
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
- master
|
|
8
|
-
- next
|
|
9
|
-
- 'v*'
|
|
10
|
-
paths-ignore:
|
|
11
|
-
- 'docs/**'
|
|
12
|
-
- '*.md'
|
|
13
|
-
pull_request:
|
|
14
|
-
paths-ignore:
|
|
15
|
-
- 'docs/**'
|
|
16
|
-
- '*.md'
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
test:
|
|
20
|
-
uses: fastify/workflows/.github/workflows/plugins-ci-package-manager.yml@v3
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2021 The Fastify Team
|
|
2
|
-
Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
|
|
3
|
-
All rights reserved.
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without
|
|
6
|
-
modification, are permitted provided that the following conditions are met:
|
|
7
|
-
* Redistributions of source code must retain the above copyright
|
|
8
|
-
notice, this list of conditions and the following disclaimer.
|
|
9
|
-
* Redistributions in binary form must reproduce the above copyright
|
|
10
|
-
notice, this list of conditions and the following disclaimer in the
|
|
11
|
-
documentation and/or other materials provided with the distribution.
|
|
12
|
-
* The names of any contributors may not be used to endorse or promote
|
|
13
|
-
products derived from this software without specific prior written
|
|
14
|
-
permission.
|
|
15
|
-
|
|
16
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
|
|
20
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
23
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
-
|
|
27
|
-
* * *
|
|
28
|
-
|
|
29
|
-
The complete list of contributors can be found at:
|
|
30
|
-
- https://github.com/garycourt/uri-js/graphs/contributors
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# fast-uri
|
|
2
|
-
|
|
3
|
-
<div align="center">
|
|
4
|
-
|
|
5
|
-
[](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
|
|
6
|
-
[](https://standardjs.com/)
|
|
7
|
-
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
Dependency free RFC 3986 URI toolbox.
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
## Options
|
|
15
|
-
|
|
16
|
-
All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:
|
|
17
|
-
|
|
18
|
-
* `scheme` (string)
|
|
19
|
-
Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.
|
|
20
|
-
|
|
21
|
-
* `reference` (string)
|
|
22
|
-
If set to `"suffix"`, it indicates that the URI is in the suffix format and the parser will use the option's `scheme` property to determine the URI's scheme.
|
|
23
|
-
|
|
24
|
-
* `tolerant` (boolean, false)
|
|
25
|
-
If set to `true`, the parser will relax URI resolving rules.
|
|
26
|
-
|
|
27
|
-
* `absolutePath` (boolean, false)
|
|
28
|
-
If set to `true`, the serializer will not resolve a relative `path` component.
|
|
29
|
-
|
|
30
|
-
* `unicodeSupport` (boolean, false)
|
|
31
|
-
If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
|
|
32
|
-
|
|
33
|
-
* `domainHost` (boolean, false)
|
|
34
|
-
If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt).
|
|
35
|
-
|
|
36
|
-
### Parse
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
const uri = require('fast-uri')
|
|
40
|
-
uri.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
|
|
41
|
-
// Output
|
|
42
|
-
{
|
|
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"
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Serialize
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
const uri = require('fast-uri')
|
|
57
|
-
uri.serialize({scheme : "http", host : "example.com", fragment : "footer"})
|
|
58
|
-
// Output
|
|
59
|
-
"http://example.com/#footer"
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Resolve
|
|
64
|
-
|
|
65
|
-
```js
|
|
66
|
-
const uri = require('fast-uri')
|
|
67
|
-
uri.resolve("uri://a/b/c/d?q", "../../g")
|
|
68
|
-
// Output
|
|
69
|
-
"uri://a/g"
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Equal
|
|
73
|
-
|
|
74
|
-
```js
|
|
75
|
-
const uri = require('fast-uri')
|
|
76
|
-
uri.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d")
|
|
77
|
-
// Output
|
|
78
|
-
true
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Scheme supports
|
|
82
|
-
|
|
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
|
-
|
|
85
|
-
* http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
|
|
86
|
-
* https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
|
|
87
|
-
* ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
|
|
88
|
-
* wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
|
|
89
|
-
* urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
|
|
90
|
-
* urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
## Benchmarks
|
|
94
|
-
|
|
95
|
-
```
|
|
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)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## TODO
|
|
122
|
-
|
|
123
|
-
- [ ] Support MailTo
|
|
124
|
-
- [ ] Be 100% iso compatible with uri-js
|
|
125
|
-
- [ ] Add browser test stack
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const benchmark = require('benchmark')
|
|
4
|
-
const suite = new benchmark.Suite()
|
|
5
|
-
const fasturi = require('./')
|
|
6
|
-
const urijs = require('uri-js')
|
|
7
|
-
|
|
8
|
-
const base = 'uri://a/b/c/d;p?q'
|
|
9
|
-
|
|
10
|
-
const domain = 'https://example.com/foo#bar$fiz'
|
|
11
|
-
const ipv4 = '//10.10.10.10'
|
|
12
|
-
const ipv6 = '//[2001:db8::7]'
|
|
13
|
-
const urn = 'urn:foo:a123,456'
|
|
14
|
-
const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
15
|
-
|
|
16
|
-
// Initialization as there is a lot to parse at first
|
|
17
|
-
// eg: regexes
|
|
18
|
-
fasturi.parse(domain)
|
|
19
|
-
urijs.parse(domain)
|
|
20
|
-
|
|
21
|
-
suite.add('fast-uri: parse domain', function () {
|
|
22
|
-
fasturi.parse(domain)
|
|
23
|
-
})
|
|
24
|
-
suite.add('urijs: parse domain', function () {
|
|
25
|
-
urijs.parse(domain)
|
|
26
|
-
})
|
|
27
|
-
suite.add('WHATWG URL: parse domain', function () {
|
|
28
|
-
// eslint-disable-next-line
|
|
29
|
-
new URL(domain)
|
|
30
|
-
})
|
|
31
|
-
suite.add('fast-uri: parse IPv4', function () {
|
|
32
|
-
fasturi.parse(ipv4)
|
|
33
|
-
})
|
|
34
|
-
suite.add('urijs: parse IPv4', function () {
|
|
35
|
-
urijs.parse(ipv4)
|
|
36
|
-
})
|
|
37
|
-
suite.add('fast-uri: parse IPv6', function () {
|
|
38
|
-
fasturi.parse(ipv6)
|
|
39
|
-
})
|
|
40
|
-
suite.add('urijs: parse IPv6', function () {
|
|
41
|
-
urijs.parse(ipv6)
|
|
42
|
-
})
|
|
43
|
-
suite.add('fast-uri: parse URN', function () {
|
|
44
|
-
fasturi.parse(urn)
|
|
45
|
-
})
|
|
46
|
-
suite.add('urijs: parse URN', function () {
|
|
47
|
-
urijs.parse(urn)
|
|
48
|
-
})
|
|
49
|
-
suite.add('WHATWG URL: parse URN', function () {
|
|
50
|
-
// eslint-disable-next-line
|
|
51
|
-
new URL(urn)
|
|
52
|
-
})
|
|
53
|
-
suite.add('fast-uri: parse URN uuid', function () {
|
|
54
|
-
fasturi.parse(urnuuid)
|
|
55
|
-
})
|
|
56
|
-
suite.add('urijs: parse URN uuid', function () {
|
|
57
|
-
urijs.parse(urnuuid)
|
|
58
|
-
})
|
|
59
|
-
suite.add('fast-uri: serialize uri', function () {
|
|
60
|
-
fasturi.serialize({
|
|
61
|
-
scheme: 'uri',
|
|
62
|
-
userinfo: 'foo:bar',
|
|
63
|
-
host: 'example.com',
|
|
64
|
-
port: 1,
|
|
65
|
-
path: 'path',
|
|
66
|
-
query: 'query',
|
|
67
|
-
fragment: 'fragment'
|
|
68
|
-
})
|
|
69
|
-
})
|
|
70
|
-
suite.add('urijs: serialize uri', function () {
|
|
71
|
-
urijs.serialize({
|
|
72
|
-
scheme: 'uri',
|
|
73
|
-
userinfo: 'foo:bar',
|
|
74
|
-
host: 'example.com',
|
|
75
|
-
port: 1,
|
|
76
|
-
path: 'path',
|
|
77
|
-
query: 'query',
|
|
78
|
-
fragment: 'fragment'
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
suite.add('fast-uri: serialize IPv6', function () {
|
|
82
|
-
fasturi.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
|
|
83
|
-
})
|
|
84
|
-
suite.add('urijs: serialize IPv6', function () {
|
|
85
|
-
urijs.serialize({ host: '2606:2800:220:1:248:1893:25c8:1946' })
|
|
86
|
-
})
|
|
87
|
-
suite.add('fast-uri: serialize ws', function () {
|
|
88
|
-
fasturi.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
|
|
89
|
-
})
|
|
90
|
-
suite.add('urijs: serialize ws', function () {
|
|
91
|
-
urijs.serialize({ scheme: 'ws', host: 'example.com', resourceName: '/foo?bar', secure: true })
|
|
92
|
-
})
|
|
93
|
-
suite.add('fast-uri: resolve', function () {
|
|
94
|
-
fasturi.resolve(base, '../../../g')
|
|
95
|
-
})
|
|
96
|
-
suite.add('urijs: resolve', function () {
|
|
97
|
-
urijs.resolve(base, '../../../g')
|
|
98
|
-
})
|
|
99
|
-
suite.on('cycle', cycle)
|
|
100
|
-
|
|
101
|
-
suite.run()
|
|
102
|
-
|
|
103
|
-
function cycle (e) {
|
|
104
|
-
console.log(e.target.toString())
|
|
105
|
-
}
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const URL = require('node:url')
|
|
4
|
-
const { normalizeIPv6, normalizeIPv4, removeDotSegments, recomposeAuthority, normalizeComponentEncoding } = require('./lib/utils')
|
|
5
|
-
const SCHEMES = require('./lib/schemes')
|
|
6
|
-
|
|
7
|
-
function normalize (uri, options) {
|
|
8
|
-
if (typeof uri === 'string') {
|
|
9
|
-
uri = serialize(parse(uri, options), options)
|
|
10
|
-
} else if (typeof uri === 'object') {
|
|
11
|
-
uri = parse(serialize(uri, options), options)
|
|
12
|
-
}
|
|
13
|
-
return uri
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function resolve (baseURI, relativeURI, options) {
|
|
17
|
-
const schemelessOptions = Object.assign({ scheme: 'null' }, options)
|
|
18
|
-
const resolved = resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true)
|
|
19
|
-
return serialize(resolved, { ...schemelessOptions, skipEscape: true })
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function resolveComponents (base, relative, options, skipNormalization) {
|
|
23
|
-
const target = {}
|
|
24
|
-
if (!skipNormalization) {
|
|
25
|
-
base = parse(serialize(base, options), options) // normalize base components
|
|
26
|
-
relative = parse(serialize(relative, options), options) // normalize relative components
|
|
27
|
-
}
|
|
28
|
-
options = options || {}
|
|
29
|
-
|
|
30
|
-
if (!options.tolerant && relative.scheme) {
|
|
31
|
-
target.scheme = relative.scheme
|
|
32
|
-
// target.authority = relative.authority;
|
|
33
|
-
target.userinfo = relative.userinfo
|
|
34
|
-
target.host = relative.host
|
|
35
|
-
target.port = relative.port
|
|
36
|
-
target.path = removeDotSegments(relative.path || '')
|
|
37
|
-
target.query = relative.query
|
|
38
|
-
} else {
|
|
39
|
-
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
|
|
40
|
-
// target.authority = relative.authority;
|
|
41
|
-
target.userinfo = relative.userinfo
|
|
42
|
-
target.host = relative.host
|
|
43
|
-
target.port = relative.port
|
|
44
|
-
target.path = removeDotSegments(relative.path || '')
|
|
45
|
-
target.query = relative.query
|
|
46
|
-
} else {
|
|
47
|
-
if (!relative.path) {
|
|
48
|
-
target.path = base.path
|
|
49
|
-
if (relative.query !== undefined) {
|
|
50
|
-
target.query = relative.query
|
|
51
|
-
} else {
|
|
52
|
-
target.query = base.query
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
if (relative.path.charAt(0) === '/') {
|
|
56
|
-
target.path = removeDotSegments(relative.path)
|
|
57
|
-
} else {
|
|
58
|
-
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
59
|
-
target.path = '/' + relative.path
|
|
60
|
-
} else if (!base.path) {
|
|
61
|
-
target.path = relative.path
|
|
62
|
-
} else {
|
|
63
|
-
target.path = base.path.slice(0, base.path.lastIndexOf('/') + 1) + relative.path
|
|
64
|
-
}
|
|
65
|
-
target.path = removeDotSegments(target.path)
|
|
66
|
-
}
|
|
67
|
-
target.query = relative.query
|
|
68
|
-
}
|
|
69
|
-
// target.authority = base.authority;
|
|
70
|
-
target.userinfo = base.userinfo
|
|
71
|
-
target.host = base.host
|
|
72
|
-
target.port = base.port
|
|
73
|
-
}
|
|
74
|
-
target.scheme = base.scheme
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
target.fragment = relative.fragment
|
|
78
|
-
|
|
79
|
-
return target
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function equal (uriA, uriB, options) {
|
|
83
|
-
if (typeof uriA === 'string') {
|
|
84
|
-
uriA = unescape(uriA)
|
|
85
|
-
uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true })
|
|
86
|
-
} else if (typeof uriA === 'object') {
|
|
87
|
-
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true })
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (typeof uriB === 'string') {
|
|
91
|
-
uriB = unescape(uriB)
|
|
92
|
-
uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true })
|
|
93
|
-
} else if (typeof uriB === 'object') {
|
|
94
|
-
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true })
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return uriA.toLowerCase() === uriB.toLowerCase()
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function serialize (cmpts, opts) {
|
|
101
|
-
const components = {
|
|
102
|
-
host: cmpts.host,
|
|
103
|
-
scheme: cmpts.scheme,
|
|
104
|
-
userinfo: cmpts.userinfo,
|
|
105
|
-
port: cmpts.port,
|
|
106
|
-
path: cmpts.path,
|
|
107
|
-
query: cmpts.query,
|
|
108
|
-
nid: cmpts.nid,
|
|
109
|
-
nss: cmpts.nss,
|
|
110
|
-
uuid: cmpts.uuid,
|
|
111
|
-
fragment: cmpts.fragment,
|
|
112
|
-
reference: cmpts.reference,
|
|
113
|
-
resourceName: cmpts.resourceName,
|
|
114
|
-
secure: cmpts.secure,
|
|
115
|
-
error: ''
|
|
116
|
-
}
|
|
117
|
-
const options = Object.assign({}, opts)
|
|
118
|
-
const uriTokens = []
|
|
119
|
-
|
|
120
|
-
// find scheme handler
|
|
121
|
-
const schemeHandler = SCHEMES[(options.scheme || components.scheme || '').toLowerCase()]
|
|
122
|
-
|
|
123
|
-
// perform scheme specific serialization
|
|
124
|
-
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(components, options)
|
|
125
|
-
|
|
126
|
-
if (components.path !== undefined) {
|
|
127
|
-
if (!options.skipEscape) {
|
|
128
|
-
components.path = escape(components.path)
|
|
129
|
-
|
|
130
|
-
if (components.scheme !== undefined) {
|
|
131
|
-
components.path = components.path.split('%3A').join(':')
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
components.path = unescape(components.path)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (options.reference !== 'suffix' && components.scheme) {
|
|
139
|
-
uriTokens.push(components.scheme)
|
|
140
|
-
uriTokens.push(':')
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const authority = recomposeAuthority(components, options)
|
|
144
|
-
if (authority !== undefined) {
|
|
145
|
-
if (options.reference !== 'suffix') {
|
|
146
|
-
uriTokens.push('//')
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
uriTokens.push(authority)
|
|
150
|
-
|
|
151
|
-
if (components.path && components.path.charAt(0) !== '/') {
|
|
152
|
-
uriTokens.push('/')
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
if (components.path !== undefined) {
|
|
156
|
-
let s = components.path
|
|
157
|
-
|
|
158
|
-
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
159
|
-
s = removeDotSegments(s)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (authority === undefined) {
|
|
163
|
-
s = s.replace(/^\/\//u, '/%2F') // don't allow the path to start with "//"
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
uriTokens.push(s)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (components.query !== undefined) {
|
|
170
|
-
uriTokens.push('?')
|
|
171
|
-
uriTokens.push(components.query)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (components.fragment !== undefined) {
|
|
175
|
-
uriTokens.push('#')
|
|
176
|
-
uriTokens.push(components.fragment)
|
|
177
|
-
}
|
|
178
|
-
return uriTokens.join('')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const hexLookUp = Array.from({ length: 127 }, (v, k) => /[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))
|
|
182
|
-
|
|
183
|
-
function nonSimpleDomain (value) {
|
|
184
|
-
let code = 0
|
|
185
|
-
for (let i = 0, len = value.length; i < len; ++i) {
|
|
186
|
-
code = value.charCodeAt(i)
|
|
187
|
-
if (code > 126 || hexLookUp[code]) {
|
|
188
|
-
return true
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return false
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u
|
|
195
|
-
|
|
196
|
-
function parse (uri, opts) {
|
|
197
|
-
const options = Object.assign({}, opts)
|
|
198
|
-
const parsed = {
|
|
199
|
-
scheme: undefined,
|
|
200
|
-
userinfo: undefined,
|
|
201
|
-
host: '',
|
|
202
|
-
port: undefined,
|
|
203
|
-
path: '',
|
|
204
|
-
query: undefined,
|
|
205
|
-
fragment: undefined
|
|
206
|
-
}
|
|
207
|
-
const gotEncoding = uri.indexOf('%') !== -1
|
|
208
|
-
if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri
|
|
209
|
-
|
|
210
|
-
const matches = uri.match(URI_PARSE)
|
|
211
|
-
|
|
212
|
-
if (matches) {
|
|
213
|
-
// store each component
|
|
214
|
-
parsed.scheme = matches[1]
|
|
215
|
-
parsed.userinfo = matches[3]
|
|
216
|
-
parsed.host = matches[4]
|
|
217
|
-
parsed.port = parseInt(matches[5], 10)
|
|
218
|
-
parsed.path = matches[6] || ''
|
|
219
|
-
parsed.query = matches[7]
|
|
220
|
-
parsed.fragment = matches[8]
|
|
221
|
-
|
|
222
|
-
// fix port number
|
|
223
|
-
if (isNaN(parsed.port)) {
|
|
224
|
-
parsed.port = matches[5]
|
|
225
|
-
}
|
|
226
|
-
if (parsed.host) {
|
|
227
|
-
const ipv4result = normalizeIPv4(parsed.host)
|
|
228
|
-
if (ipv4result.isIPV4 === false) {
|
|
229
|
-
parsed.host = normalizeIPv6(ipv4result.host, { isIPV4: false }).host.toLowerCase()
|
|
230
|
-
} else {
|
|
231
|
-
parsed.host = ipv4result.host
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && !parsed.path && parsed.query === undefined) {
|
|
235
|
-
parsed.reference = 'same-document'
|
|
236
|
-
} else if (parsed.scheme === undefined) {
|
|
237
|
-
parsed.reference = 'relative'
|
|
238
|
-
} else if (parsed.fragment === undefined) {
|
|
239
|
-
parsed.reference = 'absolute'
|
|
240
|
-
} else {
|
|
241
|
-
parsed.reference = 'uri'
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// check for reference errors
|
|
245
|
-
if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {
|
|
246
|
-
parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// find scheme handler
|
|
250
|
-
const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()]
|
|
251
|
-
|
|
252
|
-
// check if scheme can't handle IRIs
|
|
253
|
-
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
|
|
254
|
-
// if host component is a domain name
|
|
255
|
-
if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && nonSimpleDomain(parsed.host)) {
|
|
256
|
-
// convert Unicode IDN -> ASCII IDN
|
|
257
|
-
try {
|
|
258
|
-
parsed.host = URL.domainToASCII(parsed.host.toLowerCase())
|
|
259
|
-
} catch (e) {
|
|
260
|
-
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
// convert IRI -> URI
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
267
|
-
if (gotEncoding && parsed.scheme !== undefined) {
|
|
268
|
-
parsed.scheme = unescape(parsed.scheme)
|
|
269
|
-
}
|
|
270
|
-
if (gotEncoding && parsed.userinfo !== undefined) {
|
|
271
|
-
parsed.userinfo = unescape(parsed.userinfo)
|
|
272
|
-
}
|
|
273
|
-
if (gotEncoding && parsed.host !== undefined) {
|
|
274
|
-
parsed.host = unescape(parsed.host)
|
|
275
|
-
}
|
|
276
|
-
if (parsed.path !== undefined && parsed.path.length) {
|
|
277
|
-
parsed.path = encodeURI(parsed.path)
|
|
278
|
-
}
|
|
279
|
-
if (parsed.fragment !== undefined && parsed.fragment.length) {
|
|
280
|
-
parsed.fragment = encodeURI(decodeURI(parsed.fragment))
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// perform scheme specific parsing
|
|
285
|
-
if (schemeHandler && schemeHandler.parse) {
|
|
286
|
-
schemeHandler.parse(parsed, options)
|
|
287
|
-
}
|
|
288
|
-
} else {
|
|
289
|
-
parsed.error = parsed.error || 'URI can not be parsed.'
|
|
290
|
-
}
|
|
291
|
-
return parsed
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
const fastUri = {
|
|
295
|
-
normalize,
|
|
296
|
-
resolve,
|
|
297
|
-
resolveComponents,
|
|
298
|
-
equal,
|
|
299
|
-
serialize,
|
|
300
|
-
parse
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
module.exports = fastUri
|
|
304
|
-
module.exports.default = fastUri
|
|
305
|
-
module.exports.fastUri = fastUri
|