fast-uri 0.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/.stale.yml +0 -0
- package/.github/dependabot.yml +7 -10
- package/.github/tests_checker.yml +0 -0
- package/.github/workflows/ci.yml +1 -70
- package/.github/workflows/package-manager-ci.yml +4 -4
- package/LICENSE +0 -0
- package/README.md +1 -2
- package/benchmark.js +21 -14
- package/index.d.ts +0 -0
- package/index.js +2 -2
- package/index.test-d.ts +0 -0
- package/lib/schemes.js +0 -0
- package/lib/scopedChars.js +0 -0
- package/lib/utils.js +1 -1
- package/package.json +42 -42
- package/test/.gitkeep +0 -0
- package/test/compatibility.test.js +3 -0
- package/test/equal.test.js +0 -0
- package/test/parse.test.js +0 -0
- package/test/resolve.test.js +0 -0
- package/test/serialize.test.js +0 -0
- package/types/.gitkeep +0 -0
package/.github/.stale.yml
CHANGED
|
File without changes
|
package/.github/dependabot.yml
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
-
- package-ecosystem: github-actions
|
|
4
|
-
directory:
|
|
5
|
-
ignore:
|
|
6
|
-
- dependency-name: "actions/*"
|
|
7
|
-
update-types:
|
|
8
|
-
["version-update:semver-minor", "version-update:semver-patch"]
|
|
3
|
+
- package-ecosystem: "github-actions"
|
|
4
|
+
directory: "/"
|
|
9
5
|
schedule:
|
|
10
|
-
interval:
|
|
6
|
+
interval: "monthly"
|
|
11
7
|
open-pull-requests-limit: 10
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
- package-ecosystem: "npm"
|
|
10
|
+
directory: "/"
|
|
14
11
|
schedule:
|
|
15
|
-
interval:
|
|
12
|
+
interval: "weekly"
|
|
16
13
|
open-pull-requests-limit: 10
|
|
File without changes
|
package/.github/workflows/ci.yml
CHANGED
|
@@ -10,75 +10,6 @@ on:
|
|
|
10
10
|
- 'docs/**'
|
|
11
11
|
- '*.md'
|
|
12
12
|
|
|
13
|
-
env:
|
|
14
|
-
CI: true
|
|
15
|
-
COVERALLS: 0
|
|
16
|
-
|
|
17
13
|
jobs:
|
|
18
14
|
test:
|
|
19
|
-
|
|
20
|
-
strategy:
|
|
21
|
-
matrix:
|
|
22
|
-
# Maintenance and active LTS
|
|
23
|
-
node-version: [10, 12, 14, 16]
|
|
24
|
-
os: [ubuntu-latest, windows-latest, macOS-latest]
|
|
25
|
-
name: Node ${{ matrix.node-version }}
|
|
26
|
-
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v2
|
|
29
|
-
|
|
30
|
-
- name: Use Node.js
|
|
31
|
-
id: setup_node
|
|
32
|
-
uses: actions/setup-node@v2
|
|
33
|
-
with:
|
|
34
|
-
node-version: ${{ matrix.node-version }}
|
|
35
|
-
|
|
36
|
-
- name: Install Dependencies
|
|
37
|
-
id: install
|
|
38
|
-
run: npm install --ignore-scripts
|
|
39
|
-
|
|
40
|
-
- name: Check licenses
|
|
41
|
-
id: license_check
|
|
42
|
-
run: |
|
|
43
|
-
npm run license-checker --if-present
|
|
44
|
-
|
|
45
|
-
# Unit and lint tests
|
|
46
|
-
- name: Tests
|
|
47
|
-
id: test
|
|
48
|
-
run: npm run test:ci
|
|
49
|
-
|
|
50
|
-
- name: Coveralls Parallel
|
|
51
|
-
id: coveralls-parallel
|
|
52
|
-
continue-on-error: true
|
|
53
|
-
uses: coverallsapp/github-action@master
|
|
54
|
-
with:
|
|
55
|
-
github-token: ${{ secrets.github_token }}
|
|
56
|
-
parallel: true
|
|
57
|
-
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}
|
|
58
|
-
|
|
59
|
-
- name: Should Trigger coverallsapp/github-action@master
|
|
60
|
-
id: coveralls-trigger
|
|
61
|
-
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context
|
|
62
|
-
# when continue-on-error failed, outcome is failure and conclusion is success
|
|
63
|
-
if: steps.coveralls-parallel.conclusion == 'success' && steps.coveralls-parallel.outcome != 'success'
|
|
64
|
-
run: |
|
|
65
|
-
echo "::set-output name=COVERALLS_TRIGGER::failure"
|
|
66
|
-
|
|
67
|
-
coverage:
|
|
68
|
-
needs: test
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
if: needs.test.outputs.COVERALLS != 'failure'
|
|
71
|
-
steps:
|
|
72
|
-
- name: Coveralls Finished
|
|
73
|
-
uses: coverallsapp/github-action@master
|
|
74
|
-
with:
|
|
75
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
76
|
-
parallel-finished: true
|
|
77
|
-
|
|
78
|
-
automerge:
|
|
79
|
-
needs: test
|
|
80
|
-
runs-on: ubuntu-latest
|
|
81
|
-
steps:
|
|
82
|
-
- uses: fastify/github-action-merge-dependabot@v3.0.2
|
|
83
|
-
with:
|
|
84
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
15
|
+
uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3
|
|
@@ -16,10 +16,10 @@ jobs:
|
|
|
16
16
|
os: [ubuntu-latest]
|
|
17
17
|
|
|
18
18
|
steps:
|
|
19
|
-
- uses: actions/checkout@
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
20
|
|
|
21
21
|
- name: Use Node.js
|
|
22
|
-
uses: actions/setup-node@
|
|
22
|
+
uses: actions/setup-node@v3.1.1
|
|
23
23
|
id: setup_node
|
|
24
24
|
with:
|
|
25
25
|
node-version: ${{ matrix.node-version }}
|
|
@@ -45,11 +45,11 @@ jobs:
|
|
|
45
45
|
os: [ubuntu-latest]
|
|
46
46
|
|
|
47
47
|
steps:
|
|
48
|
-
- uses: actions/checkout@
|
|
48
|
+
- uses: actions/checkout@v3
|
|
49
49
|
|
|
50
50
|
- name: Use Node.js
|
|
51
51
|
id: setup_node
|
|
52
|
-
uses: actions/setup-node@
|
|
52
|
+
uses: actions/setup-node@v3.1.1
|
|
53
53
|
with:
|
|
54
54
|
node-version: ${{ matrix.node-version }}
|
|
55
55
|
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
5
|
[](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
|
|
6
|
-
[](https://coveralls.io/github/fastify/fast-uri?branch=main)
|
|
7
6
|
[](https://standardjs.com/)
|
|
8
7
|
|
|
9
8
|
</div>
|
|
@@ -102,7 +101,7 @@ urijs: parse IPv4 x 384,705 ops/sec ±0.34% (99 runs sampled)
|
|
|
102
101
|
WHATWG URL: parse IPv4 NOT SUPPORTED
|
|
103
102
|
fast-uri: parse IPv6 x 923,519 ops/sec ±0.09% (100 runs sampled)
|
|
104
103
|
urijs: parse IPv6 x 289,070 ops/sec ±0.07% (95 runs sampled)
|
|
105
|
-
WHATWG
|
|
104
|
+
WHATWG URL: parse IPv6 NOT SUPPORTED
|
|
106
105
|
fast-uri: parse URN x 2,596,395 ops/sec ±0.42% (98 runs sampled)
|
|
107
106
|
urijs: parse URN x 1,152,412 ops/sec ±0.09% (97 runs sampled)
|
|
108
107
|
WHATWG URL: parse URN x 1,183,307 ops/sec ±0.38% (100 runs sampled)
|
package/benchmark.js
CHANGED
|
@@ -4,48 +4,55 @@ const fasturi = require('./')
|
|
|
4
4
|
const urijs = require('uri-js')
|
|
5
5
|
|
|
6
6
|
const base = 'uri://a/b/c/d;p?q'
|
|
7
|
+
|
|
8
|
+
const domain = 'https://example.com/foo#bar$fiz'
|
|
9
|
+
const ipv4 = '//10.10.10.10'
|
|
10
|
+
const ipv6 = '//[2001:db8::7]'
|
|
11
|
+
const urn = 'urn:foo:a123,456'
|
|
12
|
+
const urnuuid = 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6'
|
|
13
|
+
|
|
7
14
|
// Initialization as there is a lot to parse at first
|
|
8
15
|
// eg: regexes
|
|
9
|
-
fasturi.parse(
|
|
10
|
-
urijs.parse(
|
|
16
|
+
fasturi.parse(domain)
|
|
17
|
+
urijs.parse(domain)
|
|
11
18
|
|
|
12
19
|
suite.add('fast-uri: parse domain', function () {
|
|
13
|
-
fasturi.parse(
|
|
20
|
+
fasturi.parse(domain)
|
|
14
21
|
})
|
|
15
22
|
suite.add('urijs: parse domain', function () {
|
|
16
|
-
urijs.parse(
|
|
23
|
+
urijs.parse(domain)
|
|
17
24
|
})
|
|
18
25
|
suite.add('WHATWG URL: parse domain', function () {
|
|
19
26
|
// eslint-disable-next-line
|
|
20
|
-
new URL(
|
|
27
|
+
new URL(domain)
|
|
21
28
|
})
|
|
22
29
|
suite.add('fast-uri: parse IPv4', function () {
|
|
23
|
-
fasturi.parse(
|
|
30
|
+
fasturi.parse(ipv4)
|
|
24
31
|
})
|
|
25
32
|
suite.add('urijs: parse IPv4', function () {
|
|
26
|
-
urijs.parse(
|
|
33
|
+
urijs.parse(ipv4)
|
|
27
34
|
})
|
|
28
35
|
suite.add('fast-uri: parse IPv6', function () {
|
|
29
|
-
fasturi.parse(
|
|
36
|
+
fasturi.parse(ipv6)
|
|
30
37
|
})
|
|
31
38
|
suite.add('urijs: parse IPv6', function () {
|
|
32
|
-
urijs.parse(
|
|
39
|
+
urijs.parse(ipv6)
|
|
33
40
|
})
|
|
34
41
|
suite.add('fast-uri: parse URN', function () {
|
|
35
|
-
fasturi.parse(
|
|
42
|
+
fasturi.parse(urn)
|
|
36
43
|
})
|
|
37
44
|
suite.add('urijs: parse URN', function () {
|
|
38
|
-
urijs.parse(
|
|
45
|
+
urijs.parse(urn)
|
|
39
46
|
})
|
|
40
47
|
suite.add('WHATWG URL: parse URN', function () {
|
|
41
48
|
// eslint-disable-next-line
|
|
42
|
-
new URL(
|
|
49
|
+
new URL(urn)
|
|
43
50
|
})
|
|
44
51
|
suite.add('fast-uri: parse URN uuid', function () {
|
|
45
|
-
fasturi.parse(
|
|
52
|
+
fasturi.parse(urnuuid)
|
|
46
53
|
})
|
|
47
54
|
suite.add('urijs: parse URN uuid', function () {
|
|
48
|
-
urijs.parse(
|
|
55
|
+
urijs.parse(urnuuid)
|
|
49
56
|
})
|
|
50
57
|
suite.add('fast-uri: serialize uri', function () {
|
|
51
58
|
fasturi.serialize({
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
@@ -274,10 +274,10 @@ function parse (uri, opts) {
|
|
|
274
274
|
parsed.host = unescape(parsed.host)
|
|
275
275
|
}
|
|
276
276
|
if (parsed.path !== undefined && parsed.path.length) {
|
|
277
|
-
parsed.path =
|
|
277
|
+
parsed.path = encodeURI(parsed.path)
|
|
278
278
|
}
|
|
279
279
|
if (parsed.fragment !== undefined && parsed.fragment.length) {
|
|
280
|
-
parsed.fragment =
|
|
280
|
+
parsed.fragment = encodeURI(decodeURI(parsed.fragment))
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
|
package/index.test-d.ts
CHANGED
|
File without changes
|
package/lib/schemes.js
CHANGED
|
File without changes
|
package/lib/scopedChars.js
CHANGED
|
File without changes
|
package/lib/utils.js
CHANGED
|
@@ -101,7 +101,7 @@ function normalizeIPv6 (host, opts = {}) {
|
|
|
101
101
|
newHost += '%' + ipv6.zone
|
|
102
102
|
escapedHost += '%25' + ipv6.zone
|
|
103
103
|
}
|
|
104
|
-
return { host: newHost, escapedHost
|
|
104
|
+
return { host: newHost, escapedHost, isIPV6: true }
|
|
105
105
|
} else {
|
|
106
106
|
return { host, isIPV6: false }
|
|
107
107
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "fast-uri",
|
|
3
|
-
"description": "Dependency free RFC 3986 URI toolbox",
|
|
4
|
-
"version": "0.0
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"type": "commonjs",
|
|
7
|
-
"types": "index.d.ts",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"author": "Vincent Le Goff <vince.legoff@gmail.com> (https://github.com/zekth)",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "https://github.com/fastify/fast-uri"
|
|
13
|
-
},
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/fastify/fast-uri/issues"
|
|
16
|
-
},
|
|
17
|
-
"homepage":"https://github.com/fastify/fast-uri",
|
|
18
|
-
"scripts": {
|
|
19
|
-
"bench": "node benchmark.js",
|
|
20
|
-
"lint:fix": "standard --fix",
|
|
21
|
-
"test:lint": "standard | snazzy",
|
|
22
|
-
"test:typescript": "tsd",
|
|
23
|
-
"test:unit": "tap -J test/*.test.js",
|
|
24
|
-
"test:unit:dev": "tap -J test/*.test.js --coverage-report=html",
|
|
25
|
-
"test": "npm run test:lint && npm run test:unit && npm run test:typescript",
|
|
26
|
-
"test:ci": "npm run test:lint && npm run test:unit -- --cov --coverage-report=lcovonly && npm run test:typescript"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"benchmark": "^2.1.4",
|
|
30
|
-
"coveralls": "^3.1.1",
|
|
31
|
-
"snazzy": "^9.0.0",
|
|
32
|
-
"standard": "^
|
|
33
|
-
"tap": "^
|
|
34
|
-
"tsd": "^0.
|
|
35
|
-
"typescript": "^4.4.4",
|
|
36
|
-
"uri-js": "^4.4.1"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {},
|
|
39
|
-
"tap": {
|
|
40
|
-
"check-coverage": false
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "fast-uri",
|
|
3
|
+
"description": "Dependency free RFC 3986 URI toolbox",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"author": "Vincent Le Goff <vince.legoff@gmail.com> (https://github.com/zekth)",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/fastify/fast-uri"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/fastify/fast-uri/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage":"https://github.com/fastify/fast-uri",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"bench": "node benchmark.js",
|
|
20
|
+
"lint:fix": "standard --fix",
|
|
21
|
+
"test:lint": "standard | snazzy",
|
|
22
|
+
"test:typescript": "tsd",
|
|
23
|
+
"test:unit": "tap -J test/*.test.js",
|
|
24
|
+
"test:unit:dev": "tap -J test/*.test.js --coverage-report=html",
|
|
25
|
+
"test": "npm run test:lint && npm run test:unit && npm run test:typescript",
|
|
26
|
+
"test:ci": "npm run test:lint && npm run test:unit -- --cov --coverage-report=lcovonly && npm run test:typescript"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"benchmark": "^2.1.4",
|
|
30
|
+
"coveralls": "^3.1.1",
|
|
31
|
+
"snazzy": "^9.0.0",
|
|
32
|
+
"standard": "^17.0.0",
|
|
33
|
+
"tap": "^16.0.0",
|
|
34
|
+
"tsd": "^0.20.0",
|
|
35
|
+
"typescript": "^4.4.4",
|
|
36
|
+
"uri-js": "^4.4.1"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"tap": {
|
|
40
|
+
"check-coverage": false
|
|
41
|
+
}
|
|
42
|
+
}
|
package/test/.gitkeep
CHANGED
|
File without changes
|
|
@@ -32,6 +32,9 @@ test('compatibility Parse', (t) => {
|
|
|
32
32
|
'//[2606:2800:220:1:248:1893:25c8:1946:43209]',
|
|
33
33
|
'http://foo.bar',
|
|
34
34
|
'http://',
|
|
35
|
+
'#/$defs/stringMap',
|
|
36
|
+
'#/$defs/string%20Map',
|
|
37
|
+
'#/$defs/string Map',
|
|
35
38
|
'//?json=%7B%22foo%22%3A%22bar%22%7D'
|
|
36
39
|
// 'mailto:chris@example.com'-203845,
|
|
37
40
|
// 'mailto:infobot@example.com?subject=current-issue',
|
package/test/equal.test.js
CHANGED
|
File without changes
|
package/test/parse.test.js
CHANGED
|
File without changes
|
package/test/resolve.test.js
CHANGED
|
File without changes
|
package/test/serialize.test.js
CHANGED
|
File without changes
|
package/types/.gitkeep
CHANGED
|
File without changes
|