pacote 7.2.0 → 7.3.3
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 +45 -0
- package/extract.js +38 -2
- package/lib/extract-stream.js +25 -1
- package/lib/fetchers/registry/tarball.js +65 -77
- package/lib/util/git.js +4 -3
- package/package.json +8 -8
- package/tarball.js +22 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
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="7.3.3"></a>
|
|
6
|
+
## [7.3.3](https://github.com/zkat/pacote/compare/v7.3.2...v7.3.3) (2018-02-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **tarball:** another attempt at fixing opts.resolved ([aff3b6a](https://github.com/zkat/pacote/commit/aff3b6a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<a name="7.3.2"></a>
|
|
16
|
+
## [7.3.2](https://github.com/zkat/pacote/compare/v7.3.1...v7.3.2) (2018-02-15)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* **tarball:** opts.resolved impl was triggering extra registry lookups ([0a4729d](https://github.com/zkat/pacote/commit/0a4729d))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<a name="7.3.1"></a>
|
|
26
|
+
## [7.3.1](https://github.com/zkat/pacote/compare/v7.3.0...v7.3.1) (2018-02-14)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **tarball:** stop using mississippi.pipe() in tarball.js and extract.js ([f5c1da9](https://github.com/zkat/pacote/commit/f5c1da9))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<a name="7.3.0"></a>
|
|
36
|
+
# [7.3.0](https://github.com/zkat/pacote/compare/v7.2.0...v7.3.0) (2018-02-07)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **git:** fix resolution of prerelease versions ([#130](https://github.com/zkat/pacote/issues/130)) ([83be46b](https://github.com/zkat/pacote/commit/83be46b)), closes [#129](https://github.com/zkat/pacote/issues/129)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **extract:** append _resolved and _integrity automatically ([#134](https://github.com/zkat/pacote/issues/134)) ([6886b65](https://github.com/zkat/pacote/commit/6886b65))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
5
50
|
<a name="7.2.0"></a>
|
|
6
51
|
# [7.2.0](https://github.com/zkat/pacote/compare/v7.1.1...v7.2.0) (2018-01-19)
|
|
7
52
|
|
package/extract.js
CHANGED
|
@@ -4,12 +4,18 @@ const BB = require('bluebird')
|
|
|
4
4
|
|
|
5
5
|
const cacache = require('cacache')
|
|
6
6
|
const extractStream = require('./lib/extract-stream')
|
|
7
|
+
const fs = require('fs')
|
|
7
8
|
const mkdirp = BB.promisify(require('mkdirp'))
|
|
8
9
|
const npa = require('npm-package-arg')
|
|
9
10
|
const optCheck = require('./lib/util/opt-check')
|
|
11
|
+
const path = require('path')
|
|
10
12
|
const retry = require('promise-retry')
|
|
11
13
|
const rimraf = BB.promisify(require('rimraf'))
|
|
12
14
|
|
|
15
|
+
const truncateAsync = BB.promisify(fs.truncate)
|
|
16
|
+
const readFileAsync = BB.promisify(fs.readFile)
|
|
17
|
+
const appendFileAsync = BB.promisify(fs.appendFile)
|
|
18
|
+
|
|
13
19
|
module.exports = extract
|
|
14
20
|
function extract (spec, dest, opts) {
|
|
15
21
|
opts = optCheck(opts)
|
|
@@ -60,7 +66,7 @@ function extract (spec, dest, opts) {
|
|
|
60
66
|
|
|
61
67
|
function extractByDigest (start, spec, dest, opts) {
|
|
62
68
|
return mkdirp(dest).then(() => {
|
|
63
|
-
const xtractor = extractStream(dest, opts)
|
|
69
|
+
const xtractor = extractStream(spec, dest, opts)
|
|
64
70
|
const cached = cacache.get.stream.byDigest(opts.cache, opts.integrity, opts)
|
|
65
71
|
cached.pipe(xtractor)
|
|
66
72
|
return new BB((resolve, reject) => {
|
|
@@ -80,18 +86,48 @@ function extractByDigest (start, spec, dest, opts) {
|
|
|
80
86
|
|
|
81
87
|
let fetch
|
|
82
88
|
function extractByManifest (start, spec, dest, opts) {
|
|
89
|
+
let integrity = opts.integrity
|
|
90
|
+
let resolved = opts.resolved
|
|
83
91
|
return mkdirp(dest).then(() => {
|
|
84
|
-
const xtractor = extractStream(dest, opts)
|
|
92
|
+
const xtractor = extractStream(spec, dest, opts)
|
|
85
93
|
if (!fetch) {
|
|
86
94
|
fetch = require('./lib/fetch')
|
|
87
95
|
}
|
|
88
96
|
const tardata = fetch.tarball(spec, opts)
|
|
97
|
+
if (!resolved) {
|
|
98
|
+
tardata.on('manifest', m => {
|
|
99
|
+
resolved = m._resolved
|
|
100
|
+
})
|
|
101
|
+
tardata.on('integrity', i => {
|
|
102
|
+
integrity = i
|
|
103
|
+
})
|
|
104
|
+
}
|
|
89
105
|
tardata.pipe(xtractor)
|
|
90
106
|
return new BB((resolve, reject) => {
|
|
91
107
|
tardata.on('error', reject)
|
|
92
108
|
xtractor.on('error', reject)
|
|
93
109
|
xtractor.on('close', resolve)
|
|
94
110
|
})
|
|
111
|
+
}).then(() => {
|
|
112
|
+
if (!opts.resolved) {
|
|
113
|
+
const pjson = path.join(dest, 'package.json')
|
|
114
|
+
return readFileAsync(pjson, 'utf8')
|
|
115
|
+
.then(str => {
|
|
116
|
+
return truncateAsync(pjson)
|
|
117
|
+
.then(() => {
|
|
118
|
+
return appendFileAsync(pjson, str.replace(
|
|
119
|
+
/}\s*$/,
|
|
120
|
+
`\n,"_resolved": ${
|
|
121
|
+
JSON.stringify(resolved || '')
|
|
122
|
+
}\n,"_integrity": ${
|
|
123
|
+
JSON.stringify(integrity || '')
|
|
124
|
+
}\n,"_from": ${
|
|
125
|
+
JSON.stringify(spec.toString())
|
|
126
|
+
}\n}`
|
|
127
|
+
))
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}
|
|
95
131
|
}).then(() => {
|
|
96
132
|
opts.log.silly('pacote', `${spec} extracted in ${Date.now() - start}ms`)
|
|
97
133
|
}).catch(err => {
|
package/lib/extract-stream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const PassThrough = require('stream').PassThrough
|
|
3
4
|
const path = require('path')
|
|
4
5
|
const tar = require('tar')
|
|
5
6
|
|
|
@@ -10,7 +11,29 @@ function computeMode (fileMode, optMode, umask) {
|
|
|
10
11
|
return (fileMode | optMode) & ~(umask || 0)
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
function
|
|
14
|
+
function pkgJsonTransform (spec, opts) {
|
|
15
|
+
return entry => {
|
|
16
|
+
if (entry.path === 'package.json') {
|
|
17
|
+
const transformed = new PassThrough()
|
|
18
|
+
let str = ''
|
|
19
|
+
entry.on('end', () => transformed.end(str.replace(
|
|
20
|
+
/}\s*$/,
|
|
21
|
+
`\n,"_resolved": ${
|
|
22
|
+
JSON.stringify(opts.resolved || '')
|
|
23
|
+
}\n,"_integrity": ${
|
|
24
|
+
JSON.stringify(opts.integrity || '')
|
|
25
|
+
}\n,"_from": ${
|
|
26
|
+
JSON.stringify(spec.toString())
|
|
27
|
+
}\n}`
|
|
28
|
+
)))
|
|
29
|
+
entry.on('error', e => transformed.emit('error'))
|
|
30
|
+
entry.on('data', d => { str += d })
|
|
31
|
+
return transformed
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function extractStream (spec, dest, opts) {
|
|
14
37
|
opts = opts || {}
|
|
15
38
|
const sawIgnores = new Set()
|
|
16
39
|
return tar.x({
|
|
@@ -20,6 +43,7 @@ function extractStream (dest, opts) {
|
|
|
20
43
|
onwarn: msg => opts.log && opts.log.warn('tar', msg),
|
|
21
44
|
uid: opts.uid,
|
|
22
45
|
gid: opts.gid,
|
|
46
|
+
transform: opts.resolved && pkgJsonTransform(spec, opts),
|
|
23
47
|
onentry (entry) {
|
|
24
48
|
if (entry.type.toLowerCase() === 'file') {
|
|
25
49
|
entry.mode = computeMode(entry.mode, opts.fmode, opts.umask)
|
|
@@ -7,31 +7,40 @@ const manifest = require('./manifest')
|
|
|
7
7
|
const optCheck = require('../../util/opt-check')
|
|
8
8
|
const PassThrough = require('stream').PassThrough
|
|
9
9
|
const pickRegistry = require('./pick-registry')
|
|
10
|
-
const pipe = BB.promisify(require('mississippi').pipe)
|
|
11
10
|
const ssri = require('ssri')
|
|
12
11
|
const url = require('url')
|
|
13
12
|
|
|
14
13
|
module.exports = tarball
|
|
15
14
|
function tarball (spec, opts) {
|
|
16
15
|
opts = optCheck(opts)
|
|
16
|
+
const registry = pickRegistry(spec, opts)
|
|
17
17
|
const stream = new PassThrough()
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
let mani
|
|
19
|
+
if (
|
|
20
|
+
opts.resolved &&
|
|
21
|
+
// spec.type === 'version' &&
|
|
22
|
+
opts.resolved.indexOf(registry) === 0
|
|
23
|
+
) {
|
|
24
|
+
// fakeChild is a shortcut to avoid looking up a manifest!
|
|
25
|
+
mani = BB.resolve({
|
|
26
|
+
name: spec.name,
|
|
27
|
+
version: spec.fetchSpec,
|
|
28
|
+
_integrity: opts.integrity,
|
|
29
|
+
_resolved: opts.resolved,
|
|
30
|
+
_fakeChild: true
|
|
31
|
+
})
|
|
32
|
+
} else {
|
|
33
|
+
// We can't trust opts.resolved if it's going to a separate host.
|
|
34
|
+
mani = manifest(spec, opts)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
mani.then(mani => {
|
|
38
|
+
!mani._fakeChild && stream.emit('manifest', mani)
|
|
39
|
+
const fetchStream = fromManifest(mani, spec, opts).on(
|
|
40
|
+
'integrity', i => stream.emit('integrity', i)
|
|
34
41
|
)
|
|
42
|
+
fetchStream.on('error', err => stream.emit('error', err))
|
|
43
|
+
fetchStream.pipe(stream)
|
|
35
44
|
}).catch(err => stream.emit('error', err))
|
|
36
45
|
return stream
|
|
37
46
|
}
|
|
@@ -42,33 +51,27 @@ function fromManifest (manifest, spec, opts) {
|
|
|
42
51
|
opts.scope = spec.scope || opts.scope
|
|
43
52
|
const stream = new PassThrough()
|
|
44
53
|
const registry = pickRegistry(spec, opts)
|
|
45
|
-
getTarballUrl(spec, registry, manifest, opts)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
.
|
|
65
|
-
|
|
66
|
-
if (hash) {
|
|
67
|
-
stream.emit('integrity', decodeURIComponent(hash))
|
|
68
|
-
}
|
|
69
|
-
res.body.on('error', err => stream.emit('error', err))
|
|
70
|
-
res.body.pipe(stream)
|
|
71
|
-
})
|
|
54
|
+
const uri = getTarballUrl(spec, registry, manifest, opts)
|
|
55
|
+
fetch(uri, registry, Object.assign({
|
|
56
|
+
headers: {
|
|
57
|
+
'pacote-req-type': 'tarball',
|
|
58
|
+
'pacote-pkg-id': `registry:${manifest.name}@${uri}`
|
|
59
|
+
},
|
|
60
|
+
integrity: manifest._integrity,
|
|
61
|
+
algorithms: [
|
|
62
|
+
manifest._integrity
|
|
63
|
+
? ssri.parse(manifest._integrity).pickAlgorithm()
|
|
64
|
+
: 'sha1'
|
|
65
|
+
],
|
|
66
|
+
spec
|
|
67
|
+
}, opts))
|
|
68
|
+
.then(res => {
|
|
69
|
+
const hash = res.headers.get('x-local-cache-hash')
|
|
70
|
+
if (hash) {
|
|
71
|
+
stream.emit('integrity', decodeURIComponent(hash))
|
|
72
|
+
}
|
|
73
|
+
res.body.on('error', err => stream.emit('error', err))
|
|
74
|
+
res.body.pipe(stream)
|
|
72
75
|
})
|
|
73
76
|
.catch(err => stream.emit('error', err))
|
|
74
77
|
return stream
|
|
@@ -76,38 +79,23 @@ function fromManifest (manifest, spec, opts) {
|
|
|
76
79
|
|
|
77
80
|
function getTarballUrl (spec, registry, mani, opts) {
|
|
78
81
|
const reg = url.parse(registry)
|
|
79
|
-
const tarball = url.parse(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// https://github.com/npm/npm/pull/9471
|
|
95
|
-
//
|
|
96
|
-
// TL;DR: Some alternative registries host tarballs on http and packuments
|
|
97
|
-
// on https, and vice-versa. There's also a case where people who can't use
|
|
98
|
-
// SSL to access the npm registry, for example, might use
|
|
99
|
-
// `--registry=http://registry.npmjs.org/`. In this case, we need to
|
|
100
|
-
// rewrite `tarball` to match the protocol.
|
|
101
|
-
//
|
|
102
|
-
if (reg.hostname === tarball.hostname && reg.protocol !== tarball.protocol) {
|
|
103
|
-
tarball.protocol = reg.protocol
|
|
104
|
-
// Ports might be same host different protocol!
|
|
105
|
-
if (reg.port !== tarball.port) {
|
|
106
|
-
delete tarball.host
|
|
107
|
-
tarball.port = reg.port
|
|
108
|
-
}
|
|
109
|
-
delete tarball.href
|
|
82
|
+
const tarball = url.parse(mani._resolved)
|
|
83
|
+
// https://github.com/npm/npm/pull/9471
|
|
84
|
+
//
|
|
85
|
+
// TL;DR: Some alternative registries host tarballs on http and packuments
|
|
86
|
+
// on https, and vice-versa. There's also a case where people who can't use
|
|
87
|
+
// SSL to access the npm registry, for example, might use
|
|
88
|
+
// `--registry=http://registry.npmjs.org/`. In this case, we need to
|
|
89
|
+
// rewrite `tarball` to match the protocol.
|
|
90
|
+
//
|
|
91
|
+
if (reg.hostname === tarball.hostname && reg.protocol !== tarball.protocol) {
|
|
92
|
+
tarball.protocol = reg.protocol
|
|
93
|
+
// Ports might be same host different protocol!
|
|
94
|
+
if (reg.port !== tarball.port) {
|
|
95
|
+
delete tarball.host
|
|
96
|
+
tarball.port = reg.port
|
|
110
97
|
}
|
|
111
|
-
|
|
112
|
-
}
|
|
98
|
+
delete tarball.href
|
|
99
|
+
}
|
|
100
|
+
return url.format(tarball)
|
|
113
101
|
}
|
package/lib/util/git.js
CHANGED
|
@@ -14,6 +14,7 @@ const path = require('path')
|
|
|
14
14
|
const pinflight = require('promise-inflight')
|
|
15
15
|
const uniqueFilename = require('unique-filename')
|
|
16
16
|
const which = BB.promisify(require('which'))
|
|
17
|
+
const semver = require('semver')
|
|
17
18
|
|
|
18
19
|
const GOOD_ENV_VARS = new Set([
|
|
19
20
|
'GIT_ASKPASS',
|
|
@@ -141,9 +142,9 @@ function revs (repo, opts) {
|
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
if (type === 'tag') {
|
|
144
|
-
const match = ref.match(/v?(\d+\.\d+\.\d+)$/)
|
|
145
|
-
if (match) {
|
|
146
|
-
revs.versions[match[1]] = doc
|
|
145
|
+
const match = ref.match(/v?(\d+\.\d+\.\d+(?:[-+].+)?)$/)
|
|
146
|
+
if (match && semver.valid(match[1], true)) {
|
|
147
|
+
revs.versions[semver.clean(match[1], true)] = doc
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
150
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacote",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.3",
|
|
4
4
|
"description": "JavaScript package downloader",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"prerelease": "npm t",
|
|
12
12
|
"release": "standard-version -s",
|
|
13
13
|
"postrelease": "npm publish && git push --follow-tags",
|
|
14
|
-
"pretest": "standard
|
|
14
|
+
"pretest": "standard",
|
|
15
15
|
"test": "nyc --all -- tap -J test/*.js",
|
|
16
16
|
"test-docker": "docker run -it --rm --name pacotest -v \"$PWD\":/tmp -w /tmp node:latest npm test",
|
|
17
17
|
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"lru-cache": "^4.1.1",
|
|
49
49
|
"make-fetch-happen": "^2.6.0",
|
|
50
50
|
"minimatch": "^3.0.4",
|
|
51
|
-
"mississippi": "^
|
|
51
|
+
"mississippi": "^2.0.0",
|
|
52
52
|
"normalize-package-data": "^2.4.0",
|
|
53
53
|
"npm-package-arg": "^6.0.0",
|
|
54
54
|
"npm-packlist": "^1.1.10",
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"promise-retry": "^1.1.1",
|
|
59
59
|
"protoduck": "^5.0.0",
|
|
60
60
|
"safe-buffer": "^5.1.1",
|
|
61
|
-
"semver": "^5.
|
|
62
|
-
"ssri": "^5.1
|
|
63
|
-
"tar": "^4.
|
|
61
|
+
"semver": "^5.5.0",
|
|
62
|
+
"ssri": "^5.2.1",
|
|
63
|
+
"tar": "^4.3.3",
|
|
64
64
|
"unique-filename": "^1.1.0",
|
|
65
65
|
"which": "^1.3.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"mkdirp": "^0.5.1",
|
|
69
|
-
"nock": "^9.1.
|
|
69
|
+
"nock": "^9.1.6",
|
|
70
70
|
"npmlog": "^4.1.2",
|
|
71
71
|
"nyc": "^11.4.1",
|
|
72
72
|
"require-inject": "^1.4.2",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"standard": "^10.0.3",
|
|
75
75
|
"standard-version": "^4.3.0",
|
|
76
76
|
"tacks": "^1.2.6",
|
|
77
|
-
"tap": "^11.0
|
|
77
|
+
"tap": "^11.1.0",
|
|
78
78
|
"tar-stream": "^1.5.5",
|
|
79
79
|
"weallbehave": "^1.2.0",
|
|
80
80
|
"weallcontribute": "^1.0.7"
|
package/tarball.js
CHANGED
|
@@ -10,7 +10,6 @@ const npa = require('npm-package-arg')
|
|
|
10
10
|
const optCheck = require('./lib/util/opt-check')
|
|
11
11
|
const PassThrough = require('stream').PassThrough
|
|
12
12
|
const path = require('path')
|
|
13
|
-
const pipe = BB.promisify(require('mississippi').pipe)
|
|
14
13
|
const pipeline = require('mississippi').pipeline
|
|
15
14
|
const ssri = require('ssri')
|
|
16
15
|
const url = require('url')
|
|
@@ -106,12 +105,16 @@ function tarballStream (spec, opts) {
|
|
|
106
105
|
}
|
|
107
106
|
})
|
|
108
107
|
.then(
|
|
109
|
-
tarStream =>
|
|
108
|
+
tarStream => tarStream
|
|
109
|
+
.on('error', err => stream.emit('error', err))
|
|
110
|
+
.pipe(stream),
|
|
110
111
|
err => stream.emit('error', err)
|
|
111
112
|
)
|
|
112
113
|
} else {
|
|
113
114
|
opts.log.silly('tarball', `no integrity hash provided for ${spec} - fetching by manifest`)
|
|
114
|
-
|
|
115
|
+
tarballByManifest(startTime, spec, opts)
|
|
116
|
+
.on('error', err => stream.emit('error', err))
|
|
117
|
+
.pipe(stream)
|
|
115
118
|
}
|
|
116
119
|
return stream
|
|
117
120
|
}
|
|
@@ -129,20 +132,28 @@ function tarballToFile (spec, dest, opts) {
|
|
|
129
132
|
opts.log.silly('tarball', `cached content for ${spec} copied (${Date.now() - startTime}ms)`)
|
|
130
133
|
}, err => {
|
|
131
134
|
if (err.code === 'ENOENT') {
|
|
132
|
-
return
|
|
133
|
-
tarballByManifest(startTime, spec, opts)
|
|
134
|
-
fs.createWriteStream(dest)
|
|
135
|
-
|
|
135
|
+
return new BB((resolve, reject) => {
|
|
136
|
+
const tardata = tarballByManifest(startTime, spec, opts)
|
|
137
|
+
const writer = fs.createWriteStream(dest)
|
|
138
|
+
tardata.on('error', reject)
|
|
139
|
+
writer.on('error', reject)
|
|
140
|
+
writer.on('close', resolve)
|
|
141
|
+
tardata.pipe(writer)
|
|
142
|
+
})
|
|
136
143
|
} else {
|
|
137
144
|
throw err
|
|
138
145
|
}
|
|
139
146
|
})
|
|
140
147
|
} else {
|
|
141
148
|
opts.log.silly('tarball', `no integrity hash provided for ${spec} - fetching by manifest`)
|
|
142
|
-
return
|
|
143
|
-
tarballByManifest(startTime, spec, opts)
|
|
144
|
-
fs.createWriteStream(dest)
|
|
145
|
-
|
|
149
|
+
return new BB((resolve, reject) => {
|
|
150
|
+
const tardata = tarballByManifest(startTime, spec, opts)
|
|
151
|
+
const writer = fs.createWriteStream(dest)
|
|
152
|
+
tardata.on('error', reject)
|
|
153
|
+
writer.on('error', reject)
|
|
154
|
+
writer.on('close', resolve)
|
|
155
|
+
tardata.pipe(writer)
|
|
156
|
+
})
|
|
146
157
|
}
|
|
147
158
|
})
|
|
148
159
|
}
|