fast-uri 1.0.0 → 2.1.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.
File without changes
@@ -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: daily
6
+ interval: "monthly"
11
7
  open-pull-requests-limit: 10
12
- - package-ecosystem: npm
13
- directory: '/'
8
+
9
+ - package-ecosystem: "npm"
10
+ directory: "/"
14
11
  schedule:
15
- interval: daily
12
+ interval: "weekly"
16
13
  open-pull-requests-limit: 10
File without changes
@@ -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
- runs-on: ${{ matrix.os }}
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
@@ -5,6 +5,9 @@ on:
5
5
  branches:
6
6
  - master
7
7
 
8
+ permissions:
9
+ contents: read
10
+
8
11
  jobs:
9
12
  pnpm:
10
13
  runs-on: ${{ matrix.os }}
@@ -12,26 +15,25 @@ jobs:
12
15
  strategy:
13
16
  matrix:
14
17
  # Maintenance and active LTS
15
- node-version: [10, 12, 14, 16]
16
- os: [ubuntu-latest]
18
+ node-version: [14, 16]
19
+ os: [ubuntu-18.04]
17
20
 
18
21
  steps:
19
- - uses: actions/checkout@v2
22
+ - uses: actions/checkout@v3
23
+ with:
24
+ persist-credentials: false
20
25
 
21
26
  - name: Use Node.js
22
- uses: actions/setup-node@v2
23
- id: setup_node
27
+ uses: actions/setup-node@v3
24
28
  with:
25
29
  node-version: ${{ matrix.node-version }}
26
30
 
27
31
  - name: Install with pnpm
28
- id: install_package_manager
29
32
  run: |
30
33
  curl -L https://unpkg.com/@pnpm/self-installer | node
31
34
  pnpm install
32
35
 
33
36
  - name: Run tests
34
- id: test
35
37
  run: |
36
38
  pnpm run test
37
39
 
@@ -41,25 +43,24 @@ jobs:
41
43
  strategy:
42
44
  matrix:
43
45
  # Maintenance and active LTS
44
- node-version: [10, 12, 14, 16]
45
- os: [ubuntu-latest]
46
+ node-version: [14, 16]
47
+ os: [ubuntu-18.04]
46
48
 
47
49
  steps:
48
- - uses: actions/checkout@v2
50
+ - uses: actions/checkout@v3
51
+ with:
52
+ persist-credentials: false
49
53
 
50
54
  - name: Use Node.js
51
- id: setup_node
52
- uses: actions/setup-node@v2
55
+ uses: actions/setup-node@v3
53
56
  with:
54
57
  node-version: ${{ matrix.node-version }}
55
58
 
56
59
  - name: Install with yarn
57
- id: install_package_manager
58
60
  run: |
59
61
  curl -o- -L https://yarnpkg.com/install.sh | bash
60
62
  yarn install --ignore-engines
61
63
 
62
64
  - name: Run tests
63
- id: test
64
65
  run: |
65
66
  yarn run test
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  <div align="center">
4
4
 
5
5
  [![CI](https://github.com/fastify/fastify/workflows/ci/badge.svg)](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
6
- [![Coverage Status](https://coveralls.io/repos/github/fastify/fast-uri/badge.svg?branch=add_coveralls)](https://coveralls.io/github/fastify/fast-uri?branch=main)
7
6
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](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 ULR: parse IPv6 NOT SUPPORTED
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('https://example.com')
10
- urijs.parse('https://example.com')
16
+ fasturi.parse(domain)
17
+ urijs.parse(domain)
11
18
 
12
19
  suite.add('fast-uri: parse domain', function () {
13
- fasturi.parse('https://example.com')
20
+ fasturi.parse(domain)
14
21
  })
15
22
  suite.add('urijs: parse domain', function () {
16
- urijs.parse('https://example.com')
23
+ urijs.parse(domain)
17
24
  })
18
25
  suite.add('WHATWG URL: parse domain', function () {
19
26
  // eslint-disable-next-line
20
- new URL('https://example.com')
27
+ new URL(domain)
21
28
  })
22
29
  suite.add('fast-uri: parse IPv4', function () {
23
- fasturi.parse('//10.10.10.10')
30
+ fasturi.parse(ipv4)
24
31
  })
25
32
  suite.add('urijs: parse IPv4', function () {
26
- urijs.parse('//10.10.10.10')
33
+ urijs.parse(ipv4)
27
34
  })
28
35
  suite.add('fast-uri: parse IPv6', function () {
29
- fasturi.parse('//[2001:db8::7]')
36
+ fasturi.parse(ipv6)
30
37
  })
31
38
  suite.add('urijs: parse IPv6', function () {
32
- urijs.parse('//[2001:db8::7]')
39
+ urijs.parse(ipv6)
33
40
  })
34
41
  suite.add('fast-uri: parse URN', function () {
35
- fasturi.parse('urn:foo:a123,456')
42
+ fasturi.parse(urn)
36
43
  })
37
44
  suite.add('urijs: parse URN', function () {
38
- urijs.parse('urn:foo:a123,456')
45
+ urijs.parse(urn)
39
46
  })
40
47
  suite.add('WHATWG URL: parse URN', function () {
41
48
  // eslint-disable-next-line
42
- new URL('urn:foo:a123,456')
49
+ new URL(urn)
43
50
  })
44
51
  suite.add('fast-uri: parse URN uuid', function () {
45
- fasturi.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
52
+ fasturi.parse(urnuuid)
46
53
  })
47
54
  suite.add('urijs: parse URN uuid', function () {
48
- urijs.parse('urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6')
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
@@ -126,6 +126,10 @@ function serialize (cmpts, opts) {
126
126
  if (components.path !== undefined) {
127
127
  if (!options.skipEscape) {
128
128
  components.path = escape(components.path)
129
+
130
+ if (components.scheme !== undefined) {
131
+ components.path = components.path.split('%3A').join(':')
132
+ }
129
133
  } else {
130
134
  components.path = unescape(components.path)
131
135
  }
@@ -274,10 +278,10 @@ function parse (uri, opts) {
274
278
  parsed.host = unescape(parsed.host)
275
279
  }
276
280
  if (parsed.path !== undefined && parsed.path.length) {
277
- parsed.path = escape(parsed.path)
281
+ parsed.path = encodeURI(parsed.path)
278
282
  }
279
283
  if (parsed.fragment !== undefined && parsed.fragment.length) {
280
- parsed.fragment = escape(parsed.fragment)
284
+ parsed.fragment = encodeURI(decodeURI(parsed.fragment))
281
285
  }
282
286
  }
283
287
 
package/index.test-d.ts CHANGED
File without changes
package/lib/schemes.js CHANGED
File without changes
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: escapedHost, isIPV6: true }
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": "1.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": "^16.0.4",
33
- "tap": "^15.0.10",
34
- "tsd": "^0.19.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.1.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',
@@ -108,6 +111,10 @@ test('compatibility serialize', (t) => {
108
111
  host: 'example.com',
109
112
  resourceName: '/foo?bar',
110
113
  secure: true
114
+ },
115
+ {
116
+ scheme: 'scheme',
117
+ path: 'with:colon'
111
118
  }
112
119
  ]
113
120
  toSerialize.forEach((x) => {
File without changes
File without changes
File without changes
File without changes
package/types/.gitkeep CHANGED
File without changes