reachable-url 1.6.1 → 1.6.5

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/README.md CHANGED
@@ -4,13 +4,7 @@
4
4
  [![Coverage Status](https://img.shields.io/coveralls/Kikobeats/reachable-url.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/reachable-url)
5
5
  [![NPM Status](https://img.shields.io/npm/dm/reachable-url.svg?style=flat-square)](https://www.npmjs.org/package/reachable-url)
6
6
 
7
- > Given an url resolve it as fast as possible.
8
-
9
- Given an URL, it will be resolved fastest as possible.
10
-
11
- It will be performing different HTTP requests in parallel (GET, HEAD) and it will return the first response to respond.
12
-
13
- Don't use this module for consuming `body` since it isn't always be available.
7
+ > Given an URL, it resolves as fast as possible, performing a GET without downloading the body.
14
8
 
15
9
  ## Install
16
10
 
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  const pReflect = require('p-reflect')
4
- const pTimeout = require('p-timeout')
5
4
  const { URL } = require('url')
6
5
  const got = require('got')
7
6
 
@@ -15,10 +14,11 @@ const mergeResponse = (responseOrigin = {}, responseDestination = {}) => ({
15
14
 
16
15
  const createFetcher = method => async (url, opts = {}) => {
17
16
  const req = got(url, {
18
- responseType: 'buffer',
19
- method,
20
17
  retry: 0,
21
- ...opts
18
+ ...opts,
19
+ decompress: false,
20
+ responseType: 'buffer',
21
+ method
22
22
  })
23
23
 
24
24
  const redirectStatusCodes = []
@@ -27,7 +27,7 @@ const createFetcher = method => async (url, opts = {}) => {
27
27
 
28
28
  req.on('response', res => {
29
29
  response = res
30
- res.destroy()
30
+ response.once('data', () => req.cancel())
31
31
  })
32
32
 
33
33
  req.on('redirect', res => {
@@ -35,9 +35,7 @@ const createFetcher = method => async (url, opts = {}) => {
35
35
  redirectStatusCodes.push(res.statusCode)
36
36
  })
37
37
 
38
- const { isFulfilled, value, reason: error } = await pReflect(
39
- pTimeout(req, opts.timeout || Infinity)
40
- )
38
+ const { isFulfilled, value, reason: error } = await pReflect(req)
41
39
 
42
40
  const mergedResponse = mergeResponse(isFulfilled ? value : error.response, response)
43
41
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "reachable-url",
3
3
  "description": "Given an url resolve it as fast as possible",
4
4
  "homepage": "https://nicedoc.io/Kikobeats/reachable-url",
5
- "version": "1.6.1",
5
+ "version": "1.6.5",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -27,24 +27,24 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "got": "~11.8.0",
30
- "p-reflect": "~2.1.0",
31
- "p-timeout": "~4.1.0"
30
+ "p-reflect": "~2.1.0"
32
31
  },
33
32
  "devDependencies": {
34
33
  "@commitlint/cli": "latest",
35
34
  "@commitlint/config-conventional": "latest",
36
35
  "ava": "latest",
36
+ "c8": "latest",
37
37
  "ci-publish": "latest",
38
38
  "conventional-github-releaser": "latest",
39
39
  "finepack": "latest",
40
40
  "git-authors-cli": "latest",
41
- "git-dirty": "latest",
42
- "lint-staged": "latest",
41
+ "nano-staged": "latest",
43
42
  "npm-check-updates": "latest",
44
- "nyc": "latest",
45
43
  "prettier-standard": "latest",
46
44
  "simple-git-hooks": "latest",
47
- "standard": "latest"
45
+ "standard": "latest",
46
+ "standard-markdown": "latest",
47
+ "standard-version": "latest"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=8"
@@ -54,16 +54,17 @@
54
54
  ],
55
55
  "scripts": {
56
56
  "clean": "rm -rf node_modules",
57
+ "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
57
58
  "lint": "standard",
58
59
  "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
59
- "precommit": "lint-staged",
60
- "prerelease": "npm run update:check",
60
+ "precommit": "nano-staged",
61
+ "prerelease": "npm run update:check && npm run contributors",
61
62
  "pretest": "npm run lint",
62
63
  "preversion": "git-authors-cli && git add package.json",
63
64
  "release": "standard-version -a",
64
65
  "release:github": "conventional-github-releaser -p angular",
65
66
  "release:tags": "git push --follow-tags origin HEAD:master",
66
- "test": "nyc ava",
67
+ "test": "c8 ava",
67
68
  "update": "ncu -u",
68
69
  "update:check": "ncu -- --error-level 2"
69
70
  },
@@ -73,16 +74,16 @@
73
74
  "@commitlint/config-conventional"
74
75
  ]
75
76
  },
76
- "lint-staged": {
77
- "package.json": [
78
- "finepack"
79
- ],
77
+ "nano-staged": {
80
78
  "*.js": [
81
79
  "prettier-standard"
80
+ ],
81
+ "package.json": [
82
+ "finepack"
82
83
  ]
83
84
  },
84
85
  "simple-git-hooks": {
85
86
  "commit-msg": "npx commitlint --edit",
86
- "pre-commit": "npx lint-staged"
87
+ "pre-commit": "npx nano-staged"
87
88
  }
88
89
  }
package/CHANGELOG.md DELETED
@@ -1,283 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ### [1.6.1](https://github.com/Kikobeats/reachable-url/compare/v1.6.0...v1.6.1) (2021-09-06)
6
-
7
- ## [1.6.0](https://github.com/Kikobeats/reachable-url/compare/v1.5.1...v1.6.0) (2021-07-17)
8
-
9
-
10
- ### Features
11
-
12
- * only perform GET requests ([b2e090d](https://github.com/Kikobeats/reachable-url/commit/b2e090d3606140fff7aab3af75c32197bb228ee3))
13
-
14
- ### [1.5.1](https://github.com/Kikobeats/reachable-url/compare/v1.5.0...v1.5.1) (2021-06-29)
15
-
16
-
17
- ### Bug Fixes
18
-
19
- * keep original request url ([d259242](https://github.com/Kikobeats/reachable-url/commit/d25924200a78e36fd21c90eee2d63d03c4c799d2))
20
-
21
- ## [1.5.0](https://github.com/Kikobeats/reachable-url/compare/v1.4.20...v1.5.0) (2021-06-28)
22
-
23
-
24
- ### Features
25
-
26
- * ensure to don't download body ([f3a73ba](https://github.com/Kikobeats/reachable-url/commit/f3a73bac77e6b516fd36e98df082b76f42dbf388))
27
-
28
- ### [1.4.20](https://github.com/Kikobeats/reachable-url/compare/v1.4.19...v1.4.20) (2020-12-28)
29
-
30
- ### [1.4.19](https://github.com/Kikobeats/reachable-url/compare/v1.4.18...v1.4.19) (2020-12-07)
31
-
32
- ### [1.4.18](https://github.com/Kikobeats/reachable-url/compare/v1.4.17...v1.4.18) (2020-12-03)
33
-
34
- ### [1.4.17](https://github.com/Kikobeats/reachable-url/compare/v1.4.16...v1.4.17) (2020-10-21)
35
-
36
- ### [1.4.16](https://github.com/Kikobeats/reachable-url/compare/v1.4.15...v1.4.16) (2020-10-21)
37
-
38
- ### [1.4.15](https://github.com/Kikobeats/reachable-url/compare/v1.4.14...v1.4.15) (2020-09-20)
39
-
40
- ### [1.4.14](https://github.com/Kikobeats/reachable-url/compare/v1.4.13...v1.4.14) (2020-09-04)
41
-
42
- ### [1.4.13](https://github.com/Kikobeats/reachable-url/compare/v1.4.12...v1.4.13) (2020-07-18)
43
-
44
- ### [1.4.12](https://github.com/Kikobeats/reachable-url/compare/v1.4.11...v1.4.12) (2020-07-12)
45
-
46
- ### [1.4.11](https://github.com/Kikobeats/reachable-url/compare/v1.4.10...v1.4.11) (2020-07-08)
47
-
48
- ### [1.4.10](https://github.com/Kikobeats/reachable-url/compare/v1.4.9...v1.4.10) (2020-07-04)
49
-
50
- ### [1.4.9](https://github.com/Kikobeats/reachable-url/compare/v1.4.8...v1.4.9) (2020-06-06)
51
-
52
- ### [1.4.8](https://github.com/Kikobeats/reachable-url/compare/v1.4.7...v1.4.8) (2020-06-01)
53
-
54
- ### [1.4.7](https://github.com/Kikobeats/reachable-url/compare/v1.4.6...v1.4.7) (2020-05-04)
55
-
56
- ### [1.4.6](https://github.com/Kikobeats/reachable-url/compare/v1.4.5...v1.4.6) (2020-04-30)
57
-
58
- ### [1.4.5](https://github.com/Kikobeats/reachable-url/compare/v1.4.4...v1.4.5) (2020-04-21)
59
-
60
- ### [1.4.4](https://github.com/Kikobeats/reachable-url/compare/v1.4.3...v1.4.4) (2020-03-26)
61
-
62
- ### [1.4.3](https://github.com/Kikobeats/reachable-url/compare/v1.4.2...v1.4.3) (2020-02-21)
63
-
64
- ### [1.4.2](https://github.com/Kikobeats/reachable-url/compare/v1.4.1...v1.4.2) (2020-02-07)
65
-
66
- ### [1.4.1](https://github.com/Kikobeats/reachable-url/compare/v1.4.0...v1.4.1) (2020-02-03)
67
-
68
- ## [1.4.0](https://github.com/Kikobeats/reachable-url/compare/v1.3.3...v1.4.0) (2020-02-01)
69
-
70
-
71
- ### Features
72
-
73
- * use got@10 ([5370c48](https://github.com/Kikobeats/reachable-url/commit/5370c4886ebe458d14420cc987a13a0ab811a931))
74
-
75
- ### [1.3.3](https://github.com/Kikobeats/reachable-url/compare/v1.3.2...v1.3.3) (2020-01-28)
76
-
77
- ### [1.3.2](https://github.com/Kikobeats/reachable-url/compare/v1.3.1...v1.3.2) (2020-01-26)
78
-
79
-
80
- ### Bug Fixes
81
-
82
- * identation ([38085f0](https://github.com/Kikobeats/reachable-url/commit/38085f071d2de7ec9ec12488f3a0073cc3eee854))
83
-
84
- ### [1.3.1](https://github.com/Kikobeats/reachable-url/compare/v1.3.0...v1.3.1) (2020-01-23)
85
-
86
- ## [1.3.0](https://github.com/Kikobeats/reachable-url/compare/v1.2.4...v1.3.0) (2020-01-22)
87
-
88
-
89
- ### Features
90
-
91
- * ensure to resolve prerender urls ([291d809](https://github.com/Kikobeats/reachable-url/commit/291d809))
92
-
93
-
94
-
95
- ### [1.2.4](https://github.com/Kikobeats/reachable-url/compare/v1.2.3...v1.2.4) (2020-01-22)
96
-
97
-
98
- ### Build System
99
-
100
- * add 404 as fallback status code ([68bbec7](https://github.com/Kikobeats/reachable-url/commit/68bbec7))
101
-
102
-
103
-
104
- ### [1.2.3](https://github.com/Kikobeats/reachable-url/compare/v1.2.2...v1.2.3) (2020-01-22)
105
-
106
-
107
- ### Build System
108
-
109
- * ensure to handle common statuses ([519e025](https://github.com/Kikobeats/reachable-url/commit/519e025))
110
-
111
-
112
-
113
- ### [1.2.2](https://github.com/Kikobeats/reachable-url/compare/v1.2.1...v1.2.2) (2019-12-18)
114
-
115
- ### [1.2.1](https://github.com/Kikobeats/reachable-url/compare/v1.2.0...v1.2.1) (2019-08-18)
116
-
117
- ## [1.2.0](https://github.com/Kikobeats/reachable-url/compare/v1.1.9...v1.2.0) (2019-08-10)
118
-
119
-
120
- ### Features
121
-
122
- * prefix cdn urls ([b7b3000](https://github.com/Kikobeats/reachable-url/commit/b7b3000))
123
-
124
- ### 1.1.9 (2019-06-21)
125
-
126
-
127
- ### Bug Fixes
128
-
129
- * **package:** update got to version 9.6.0 ([0a2122b](https://github.com/Kikobeats/reachable-url/commit/0a2122b))
130
- * **package:** update p-any to version 2.0.0 ([50ce345](https://github.com/Kikobeats/reachable-url/commit/50ce345))
131
- * **package:** update p-any to version 2.1.0 ([15cdca2](https://github.com/Kikobeats/reachable-url/commit/15cdca2))
132
-
133
-
134
- ### Build System
135
-
136
- * add automate release ([82e3477](https://github.com/Kikobeats/reachable-url/commit/82e3477))
137
- * add automate release ([#10](https://github.com/Kikobeats/reachable-url/issues/10)) ([4d08cc5](https://github.com/Kikobeats/reachable-url/commit/4d08cc5))
138
- * ignore envrc ([bd72cf8](https://github.com/Kikobeats/reachable-url/commit/bd72cf8))
139
- * update dependencies ([de1e8d6](https://github.com/Kikobeats/reachable-url/commit/de1e8d6))
140
-
141
-
142
-
143
- ### 1.1.8 (2018-12-19)
144
-
145
-
146
- ### Bug Fixes
147
-
148
- * **package:** update got to version 9.5.0 ([96b5c32](https://github.com/Kikobeats/reachable-url/commit/96b5c32))
149
-
150
-
151
-
152
- ### 1.1.7 (2018-12-11)
153
-
154
-
155
- ### Build System
156
-
157
- * update dependencies ([52aaa05](https://github.com/Kikobeats/reachable-url/commit/52aaa05))
158
-
159
-
160
-
161
- ### 1.1.6 (2018-09-12)
162
-
163
-
164
-
165
- ### 1.1.5 (2018-09-11)
166
-
167
-
168
-
169
- ### 1.1.4 (2018-09-09)
170
-
171
-
172
-
173
- ### 1.1.3 (2018-08-07)
174
-
175
-
176
-
177
- ### 1.1.2 (2018-07-07)
178
-
179
-
180
-
181
- ### 1.1.1 (2018-07-07)
182
-
183
-
184
-
185
- ## 1.1.0 (2018-07-07)
186
-
187
-
188
-
189
- ### 1.0.1 (2018-05-02)
190
-
191
-
192
-
193
- ## 1.0.0 (2018-05-01)
194
-
195
-
196
-
197
- <a name="1.1.8"></a>
198
- ## 1.1.8 (2018-12-19)
199
-
200
- * fix(package): update got to version 9.5.0 ([96b5c32](https://github.com/Kikobeats/reachable-url/commit/96b5c32))
201
- * Update package.json ([ca392e2](https://github.com/Kikobeats/reachable-url/commit/ca392e2))
202
- * Update README.md ([c6c66bf](https://github.com/Kikobeats/reachable-url/commit/c6c66bf))
203
- * docs(readme): add Greenkeeper badge ([fa6928b](https://github.com/Kikobeats/reachable-url/commit/fa6928b))
204
- * chore(package): update dependencies ([c0b5455](https://github.com/Kikobeats/reachable-url/commit/c0b5455))
205
-
206
-
207
-
208
- <a name="1.1.7"></a>
209
- ## 1.1.7 (2018-12-11)
210
-
211
- * build: update dependencies ([52aaa05](https://github.com/Kikobeats/reachable-url/commit/52aaa05))
212
- * Add already encoded case ([54d7608](https://github.com/Kikobeats/reachable-url/commit/54d7608))
213
- * Add more encoding cases ([6595a11](https://github.com/Kikobeats/reachable-url/commit/6595a11))
214
- * Add query search test ([b4f1162](https://github.com/Kikobeats/reachable-url/commit/b4f1162))
215
- * Update package.json ([11f42d0](https://github.com/Kikobeats/reachable-url/commit/11f42d0))
216
- * Update README.md ([b37539d](https://github.com/Kikobeats/reachable-url/commit/b37539d))
217
-
218
-
219
-
220
- <a name="1.1.6"></a>
221
- ## 1.1.6 (2018-09-12)
222
-
223
- * Ensure encode url ([87e3456](https://github.com/Kikobeats/reachable-url/commit/87e3456))
224
-
225
-
226
-
227
- <a name="1.1.5"></a>
228
- ## 1.1.5 (2018-09-11)
229
-
230
- * Avoid parse response ([93a5b39](https://github.com/Kikobeats/reachable-url/commit/93a5b39)), closes [#1](https://github.com/Kikobeats/reachable-url/issues/1)
231
-
232
-
233
-
234
- <a name="1.1.4"></a>
235
- ## 1.1.4 (2018-09-09)
236
-
237
- * Update dependencies ([a140f62](https://github.com/Kikobeats/reachable-url/commit/a140f62))
238
- * Update package.json ([21e1d96](https://github.com/Kikobeats/reachable-url/commit/21e1d96))
239
-
240
-
241
-
242
- <a name="1.1.3"></a>
243
- ## 1.1.3 (2018-08-07)
244
-
245
- * Update deps ([ca9ce00](https://github.com/Kikobeats/reachable-url/commit/ca9ce00))
246
-
247
-
248
-
249
- <a name="1.1.2"></a>
250
- ## 1.1.2 (2018-07-07)
251
-
252
- * Separate redirect urls from status code ([d9df81f](https://github.com/Kikobeats/reachable-url/commit/d9df81f))
253
-
254
-
255
-
256
- <a name="1.1.1"></a>
257
- ## 1.1.1 (2018-07-07)
258
-
259
- * Refactor ([dafa364](https://github.com/Kikobeats/reachable-url/commit/dafa364))
260
-
261
-
262
-
263
- <a name="1.1.0"></a>
264
- # 1.1.0 (2018-07-07)
265
-
266
- * Associate statusCode per each redirect url ([2f6dbf1](https://github.com/Kikobeats/reachable-url/commit/2f6dbf1))
267
-
268
-
269
-
270
- <a name="1.0.1"></a>
271
- ## 1.0.1 (2018-05-02)
272
-
273
- * Add options test ([58037f7](https://github.com/Kikobeats/reachable-url/commit/58037f7))
274
- * Fixt test ([5772a5e](https://github.com/Kikobeats/reachable-url/commit/5772a5e))
275
- * Refactor ([f5433df](https://github.com/Kikobeats/reachable-url/commit/f5433df))
276
-
277
-
278
-
279
- <a name="1.0.0"></a>
280
- # 1.0.0 (2018-05-01)
281
-
282
- * Add files field ([fa46548](https://github.com/Kikobeats/reachable-url/commit/fa46548))
283
- * First commit ([081f7b0](https://github.com/Kikobeats/reachable-url/commit/081f7b0))