pacote 9.2.3 → 9.5.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/CHANGELOG.md +46 -0
- package/README.md +1 -1
- package/lib/extract-stream.js +1 -0
- package/lib/fetchers/directory.js +3 -2
- package/lib/fetchers/file.js +1 -1
- package/lib/fetchers/git.js +1 -1
- package/lib/fetchers/registry/manifest.js +6 -4
- package/lib/fetchers/registry/packument.js +9 -1
- package/lib/finalize-manifest.js +2 -1
- package/lib/util/git.js +9 -7
- package/lib/util/opt-check.js +2 -0
- package/lib/util/read-json.js +15 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,52 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
<a name="9.5.0"></a>
|
|
6
|
+
# [9.5.0](https://github.com/zkat/pacote/compare/v9.4.1...v9.5.0) (2019-02-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **enjoy-by:** add `before` as an alias to enjoy-by ([75d62b7](https://github.com/zkat/pacote/commit/75d62b7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="9.4.1"></a>
|
|
16
|
+
## [9.4.1](https://github.com/zkat/pacote/compare/v9.4.0...v9.4.1) (2019-01-24)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **directory, finalize-manifest:** strip byte order marker from JSON ([723ad63](https://github.com/zkat/pacote/commit/723ad63))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="9.4.0"></a>
|
|
26
|
+
# [9.4.0](https://github.com/zkat/pacote/compare/v9.3.0...v9.4.0) (2019-01-14)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **registry:** fall back to fullfat if something might be wrong with corgis ([0e71d6b](https://github.com/zkat/pacote/commit/0e71d6b))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<a name="9.3.0"></a>
|
|
36
|
+
# [9.3.0](https://github.com/zkat/pacote/compare/v9.2.3...v9.3.0) (2018-12-21)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **git, file:** properly catch otherwise unhandled errors ([89d4897](https://github.com/zkat/pacote/commit/89d4897))
|
|
42
|
+
* **test:** set umask opt to fix extract-stream 'accepts dmode/fmode/umask opts' ([e51de83](https://github.com/zkat/pacote/commit/e51de83))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
* **git:** accept git path option ([#164](https://github.com/zkat/pacote/issues/164)) ([f06c8c5](https://github.com/zkat/pacote/commit/f06c8c5))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
5
51
|
<a name="9.2.3"></a>
|
|
6
52
|
## [9.2.3](https://github.com/zkat/pacote/compare/v9.2.2...v9.2.3) (2018-10-31)
|
|
7
53
|
|
package/README.md
CHANGED
package/lib/extract-stream.js
CHANGED
|
@@ -57,6 +57,7 @@ function extractStream (spec, dest, opts) {
|
|
|
57
57
|
onwarn: msg => opts.log && opts.log.warn('tar', msg),
|
|
58
58
|
uid: opts.uid,
|
|
59
59
|
gid: opts.gid,
|
|
60
|
+
umask: opts.umask,
|
|
60
61
|
transform: opts.resolved && pkgJsonTransform(spec, opts),
|
|
61
62
|
onentry (entry) {
|
|
62
63
|
if (entry.type.toLowerCase() === 'file') {
|
|
@@ -5,6 +5,7 @@ const BB = require('bluebird')
|
|
|
5
5
|
const Fetcher = require('../fetch')
|
|
6
6
|
const glob = BB.promisify(require('glob'))
|
|
7
7
|
const packDir = require('../util/pack-dir')
|
|
8
|
+
const readJson = require('../util/read-json')
|
|
8
9
|
const path = require('path')
|
|
9
10
|
const pipe = BB.promisify(require('mississippi').pipe)
|
|
10
11
|
const through = require('mississippi').through
|
|
@@ -34,11 +35,11 @@ Fetcher.impl(fetchDirectory, {
|
|
|
34
35
|
const pkgPath = path.join(spec.fetchSpec, 'package.json')
|
|
35
36
|
const srPath = path.join(spec.fetchSpec, 'npm-shrinkwrap.json')
|
|
36
37
|
return BB.join(
|
|
37
|
-
readFileAsync(pkgPath).then(
|
|
38
|
+
readFileAsync(pkgPath).then(readJson).catch({ code: 'ENOENT' }, err => {
|
|
38
39
|
err.code = 'ENOPACKAGEJSON'
|
|
39
40
|
throw err
|
|
40
41
|
}),
|
|
41
|
-
readFileAsync(srPath).then(
|
|
42
|
+
readFileAsync(srPath).then(readJson).catch({ code: 'ENOENT' }, () => null),
|
|
42
43
|
(pkg, sr) => {
|
|
43
44
|
pkg._shrinkwrap = sr
|
|
44
45
|
pkg._hasShrinkwrap = !!sr
|
package/lib/fetchers/file.js
CHANGED
package/lib/fetchers/git.js
CHANGED
|
@@ -16,9 +16,10 @@ function manifest (spec, opts) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function getManifest (spec, opts) {
|
|
19
|
-
|
|
19
|
+
opts = opts.concat({
|
|
20
20
|
fullMetadata: opts.enjoyBy ? true : opts.fullMetadata
|
|
21
|
-
})
|
|
21
|
+
})
|
|
22
|
+
return fetchPackument(spec, opts).then(packument => {
|
|
22
23
|
try {
|
|
23
24
|
return pickManifest(packument, spec.fetchSpec, {
|
|
24
25
|
defaultTag: opts.defaultTag,
|
|
@@ -29,14 +30,15 @@ function getManifest (spec, opts) {
|
|
|
29
30
|
if (err.code === 'ETARGET' && packument._cached && !opts.offline) {
|
|
30
31
|
opts.log.silly(
|
|
31
32
|
'registry:manifest',
|
|
32
|
-
`no matching version for ${spec.name}@${spec.fetchSpec} in the cache. Forcing revalidation
|
|
33
|
+
`no matching version for ${spec.name}@${spec.fetchSpec} in the cache. Forcing revalidation.`
|
|
33
34
|
)
|
|
34
35
|
opts = opts.concat({
|
|
35
36
|
preferOffline: false,
|
|
36
37
|
preferOnline: true
|
|
37
38
|
})
|
|
38
39
|
return fetchPackument(spec, opts.concat({
|
|
39
|
-
|
|
40
|
+
// Fetch full metadata in case ETARGET was due to corgi delay
|
|
41
|
+
fullMetadata: true
|
|
40
42
|
})).then(packument => {
|
|
41
43
|
return pickManifest(packument, spec.fetchSpec, {
|
|
42
44
|
defaultTag: opts.defaultTag,
|
|
@@ -59,7 +59,15 @@ function fetchPackument (uri, registry, spec, opts) {
|
|
|
59
59
|
mem.set(memoKey, packument)
|
|
60
60
|
}
|
|
61
61
|
return packument
|
|
62
|
-
}))
|
|
62
|
+
})).catch(err => {
|
|
63
|
+
if (err.code === 'E404' && !opts.fullMetadata) {
|
|
64
|
+
return fetchPackument(uri, registry, spec, opts.concat({
|
|
65
|
+
fullMetadata: true
|
|
66
|
+
}))
|
|
67
|
+
} else {
|
|
68
|
+
throw err
|
|
69
|
+
}
|
|
70
|
+
})
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
class ObjProxy {
|
package/lib/finalize-manifest.js
CHANGED
|
@@ -13,6 +13,7 @@ const path = require('path')
|
|
|
13
13
|
const pipe = BB.promisify(require('mississippi').pipe)
|
|
14
14
|
const ssri = require('ssri')
|
|
15
15
|
const tar = require('tar')
|
|
16
|
+
const readJson = require('./util/read-json')
|
|
16
17
|
|
|
17
18
|
// `finalizeManifest` takes as input the various kinds of manifests that
|
|
18
19
|
// manifest handlers ('lib/fetchers/*.js#manifest()') return, and makes sure
|
|
@@ -212,7 +213,7 @@ function jsonFromStream (filename, dataStream) {
|
|
|
212
213
|
entry.on('error', cb)
|
|
213
214
|
finished(entry).then(() => {
|
|
214
215
|
try {
|
|
215
|
-
cb(null,
|
|
216
|
+
cb(null, readJson(data))
|
|
216
217
|
} catch (err) {
|
|
217
218
|
cb(err)
|
|
218
219
|
}
|
package/lib/util/git.js
CHANGED
|
@@ -74,10 +74,10 @@ function fullClone (repo, committish, target, opts) {
|
|
|
74
74
|
if (process.platform === 'win32') {
|
|
75
75
|
gitArgs.push('--config', 'core.longpaths=true')
|
|
76
76
|
}
|
|
77
|
-
return execGit(gitArgs, { cwd: target }).then(() => {
|
|
78
|
-
return execGit(['init'], { cwd: target })
|
|
77
|
+
return execGit(gitArgs, { cwd: target }, opts).then(() => {
|
|
78
|
+
return execGit(['init'], { cwd: target }, opts)
|
|
79
79
|
}).then(() => {
|
|
80
|
-
return execGit(['checkout', committish || 'HEAD'], { cwd: target })
|
|
80
|
+
return execGit(['checkout', committish || 'HEAD'], { cwd: target }, opts)
|
|
81
81
|
}).then(() => {
|
|
82
82
|
return updateSubmodules(target, opts)
|
|
83
83
|
}).then(() => headSha(target, opts))
|
|
@@ -182,7 +182,7 @@ function revs (repo, opts) {
|
|
|
182
182
|
module.exports._exec = execGit
|
|
183
183
|
function execGit (gitArgs, gitOpts, opts) {
|
|
184
184
|
opts = optCheck(opts)
|
|
185
|
-
return checkGit().then(gitPath => {
|
|
185
|
+
return checkGit(opts).then(gitPath => {
|
|
186
186
|
return promiseRetry((retry, number) => {
|
|
187
187
|
if (number !== 1) {
|
|
188
188
|
opts.log.silly('pacote', 'Retrying git command: ' + gitArgs.join(' ') + ' attempt # ' + number)
|
|
@@ -206,7 +206,7 @@ function execGit (gitArgs, gitOpts, opts) {
|
|
|
206
206
|
module.exports._spawn = spawnGit
|
|
207
207
|
function spawnGit (gitArgs, gitOpts, opts) {
|
|
208
208
|
opts = optCheck(opts)
|
|
209
|
-
return checkGit().then(gitPath => {
|
|
209
|
+
return checkGit(opts).then(gitPath => {
|
|
210
210
|
return promiseRetry((retry, number) => {
|
|
211
211
|
if (number !== 1) {
|
|
212
212
|
opts.log.silly('pacote', 'Retrying git command: ' + gitArgs.join(' ') + ' attempt # ' + number)
|
|
@@ -246,8 +246,10 @@ function mkOpts (_gitOpts, opts) {
|
|
|
246
246
|
return gitOpts
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
function checkGit () {
|
|
250
|
-
if (
|
|
249
|
+
function checkGit (opts) {
|
|
250
|
+
if (opts.git) {
|
|
251
|
+
return BB.resolve(opts.git)
|
|
252
|
+
} else if (!GITPATH) {
|
|
251
253
|
const err = new Error('No git binary found in $PATH')
|
|
252
254
|
err.code = 'ENOGIT'
|
|
253
255
|
return BB.reject(err)
|
package/lib/util/opt-check.js
CHANGED
|
@@ -13,6 +13,7 @@ module.exports = figgyPudding({
|
|
|
13
13
|
dmode: {},
|
|
14
14
|
'enjoy-by': 'enjoyBy',
|
|
15
15
|
enjoyBy: {},
|
|
16
|
+
before: 'enjoyBy',
|
|
16
17
|
fmode: {},
|
|
17
18
|
'fetch-retries': { default: 2 },
|
|
18
19
|
'fetch-retry-factor': { default: 10 },
|
|
@@ -21,6 +22,7 @@ module.exports = figgyPudding({
|
|
|
21
22
|
fullMetadata: 'full-metadata',
|
|
22
23
|
'full-metadata': { default: false },
|
|
23
24
|
gid: {},
|
|
25
|
+
git: {},
|
|
24
26
|
includeDeprecated: { default: true },
|
|
25
27
|
'include-deprecated': 'includeDeprecated',
|
|
26
28
|
integrity: {},
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = function (content) {
|
|
4
|
+
// Code also yanked from read-package-json.
|
|
5
|
+
function stripBOM (content) {
|
|
6
|
+
content = content.toString()
|
|
7
|
+
// Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
8
|
+
// because the buffer-to-string conversion in `fs.readFileSync()`
|
|
9
|
+
// translates it to FEFF, the UTF-16 BOM.
|
|
10
|
+
if (content.charCodeAt(0) === 0xFEFF) return content.slice(1)
|
|
11
|
+
return content
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return JSON.parse(stripBOM(content))
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacote",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"description": "JavaScript package downloader",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"bluebird": "^3.5.
|
|
45
|
-
"cacache": "^11.2
|
|
44
|
+
"bluebird": "^3.5.3",
|
|
45
|
+
"cacache": "^11.3.2",
|
|
46
46
|
"figgy-pudding": "^3.5.1",
|
|
47
47
|
"get-stream": "^4.1.0",
|
|
48
48
|
"glob": "^7.1.3",
|
|
49
|
-
"lru-cache": "^
|
|
49
|
+
"lru-cache": "^5.1.1",
|
|
50
50
|
"make-fetch-happen": "^4.0.1",
|
|
51
51
|
"minimatch": "^3.0.4",
|
|
52
52
|
"minipass": "^2.3.5",
|
|
@@ -65,19 +65,19 @@
|
|
|
65
65
|
"safe-buffer": "^5.1.2",
|
|
66
66
|
"semver": "^5.6.0",
|
|
67
67
|
"ssri": "^6.0.1",
|
|
68
|
-
"tar": "^4.4.
|
|
68
|
+
"tar": "^4.4.8",
|
|
69
69
|
"unique-filename": "^1.1.1",
|
|
70
70
|
"which": "^1.3.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"nock": "^10.0.
|
|
73
|
+
"nock": "^10.0.3",
|
|
74
74
|
"npmlog": "^4.1.2",
|
|
75
75
|
"nyc": "^13.1.0",
|
|
76
76
|
"require-inject": "^1.4.3",
|
|
77
77
|
"standard": "^12.0.1",
|
|
78
78
|
"standard-version": "^4.4.0",
|
|
79
79
|
"tacks": "^1.2.7",
|
|
80
|
-
"tap": "^12.0
|
|
80
|
+
"tap": "^12.1.0",
|
|
81
81
|
"tar-stream": "^1.6.2",
|
|
82
82
|
"weallbehave": "^1.2.0",
|
|
83
83
|
"weallcontribute": "^1.0.7"
|