pacote 9.1.0 → 9.2.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 CHANGED
@@ -2,6 +2,44 @@
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.2.3"></a>
6
+ ## [9.2.3](https://github.com/zkat/pacote/compare/v9.2.2...v9.2.3) (2018-10-31)
7
+
8
+
9
+
10
+ <a name="9.2.2"></a>
11
+ ## [9.2.2](https://github.com/zkat/pacote/compare/v9.2.1...v9.2.2) (2018-10-31)
12
+
13
+
14
+
15
+ <a name="9.2.1"></a>
16
+ ## [9.2.1](https://github.com/zkat/pacote/compare/v9.2.0...v9.2.1) (2018-10-31)
17
+
18
+
19
+
20
+ <a name="9.2.0"></a>
21
+ # [9.2.0](https://github.com/zkat/pacote/compare/v9.1.1...v9.2.0) (2018-10-30)
22
+
23
+
24
+ ### Features
25
+
26
+ * **enjoyBy:** add opts.enjoy-by option ([7df399c](https://github.com/zkat/pacote/commit/7df399c))
27
+
28
+
29
+
30
+ <a name="9.1.1"></a>
31
+ ## [9.1.1](https://github.com/zkat/pacote/compare/v9.1.0...v9.1.1) (2018-10-26)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **deps:** bump protoduck to remove CC0-1.0 license in dep ([3d9d9a6](https://github.com/zkat/pacote/commit/3d9d9a6))
37
+ * **git:** Fix temp directory permissions for git fetcher ([#159](https://github.com/zkat/pacote/issues/159)) ([97c3aeb](https://github.com/zkat/pacote/commit/97c3aeb))
38
+ * **packument:** group together all registry specs in silly log ([2333a17](https://github.com/zkat/pacote/commit/2333a17))
39
+ * **standard:** standard --fix ([0ecb188](https://github.com/zkat/pacote/commit/0ecb188))
40
+
41
+
42
+
5
43
  <a name="9.1.0"></a>
6
44
  # [9.1.0](https://github.com/zkat/pacote/compare/v9.0.0...v9.1.0) (2018-08-15)
7
45
 
package/README.md CHANGED
@@ -229,6 +229,16 @@ for package specs that are not already packaged, such as git and directory
229
229
  dependencies. The default `opts.dirPacker` does not execute `prepare` scripts,
230
230
  even though npm itself does.
231
231
 
232
+ ##### <a name="opts-enjoy-by"></a> `opts.enjoy-by`
233
+
234
+ * Alias: `opts.enjoyBy`
235
+ * Type: Date-able
236
+ * Default: undefined
237
+
238
+ If passed in, will be used while resolving to filter the versions for **registry
239
+ dependencies** such that versions published **after** `opts.enjoy-by` are not
240
+ considered -- as if they'd never been published.
241
+
232
242
  ##### <a name="opts-include-deprecated"></a> `opts.include-deprecated`
233
243
 
234
244
  * Alias: `opts.includeDeprecated`
package/lib/fetch.js CHANGED
@@ -8,7 +8,7 @@ const Fetcher = duck.define(['spec', 'opts', 'manifest'], {
8
8
  tarball: ['spec', 'opts'],
9
9
  fromManifest: ['manifest', 'spec', 'opts'],
10
10
  clearMemoized () {}
11
- }, {name: 'Fetcher'})
11
+ }, { name: 'Fetcher' })
12
12
  module.exports = Fetcher
13
13
 
14
14
  module.exports.packument = packument
@@ -34,11 +34,11 @@ Fetcher.impl(fetchDirectory, {
34
34
  const pkgPath = path.join(spec.fetchSpec, 'package.json')
35
35
  const srPath = path.join(spec.fetchSpec, 'npm-shrinkwrap.json')
36
36
  return BB.join(
37
- readFileAsync(pkgPath).then(JSON.parse).catch({code: 'ENOENT'}, err => {
37
+ readFileAsync(pkgPath).then(JSON.parse).catch({ code: 'ENOENT' }, err => {
38
38
  err.code = 'ENOPACKAGEJSON'
39
39
  throw err
40
40
  }),
41
- readFileAsync(srPath).then(JSON.parse).catch({code: 'ENOENT'}, () => null),
41
+ readFileAsync(srPath).then(JSON.parse).catch({ code: 'ENOENT' }, () => null),
42
42
  (pkg, sr) => {
43
43
  pkg._shrinkwrap = sr
44
44
  pkg._hasShrinkwrap = !!sr
@@ -50,7 +50,7 @@ Fetcher.impl(fetchDirectory, {
50
50
  ).then(pkg => {
51
51
  if (!pkg.bin && pkg.directories && pkg.directories.bin) {
52
52
  const dirBin = pkg.directories.bin
53
- return glob(path.join(spec.fetchSpec, dirBin, '/**'), {nodir: true}).then(matches => {
53
+ return glob(path.join(spec.fetchSpec, dirBin, '/**'), { nodir: true }).then(matches => {
54
54
  matches.forEach(filePath => {
55
55
  const relative = path.relative(spec.fetchSpec, filePath)
56
56
  if (relative && relative[0] !== '.') {
@@ -43,9 +43,9 @@ Fetcher.impl(fetchFile, {
43
43
  opts.cache, `pacote:tarball:file:${src}`, data, {
44
44
  integrity: opts.integrity
45
45
  }
46
- ).then(integrity => ({data, integrity}))
46
+ ).then(integrity => ({ data, integrity }))
47
47
  } else {
48
- return {data}
48
+ return { data }
49
49
  }
50
50
  }).then(info => {
51
51
  if (info.integrity) { stream.emit('integrity', info.integrity) }
@@ -157,7 +157,7 @@ function resolve (url, spec, name, opts) {
157
157
  function withTmp (opts, cb) {
158
158
  if (opts.cache) {
159
159
  // cacache has a special facility for working in a tmp dir
160
- return cacache.tmp.withTmp(opts.cache, {tmpPrefix: 'git-clone'}, cb)
160
+ return cacache.tmp.withTmp(opts.cache, { tmpPrefix: 'git-clone', uid: opts.uid, gid: opts.gid }, cb)
161
161
  } else {
162
162
  const tmpDir = path.join(osenv.tmpdir(), 'pacote-git-tmp')
163
163
  const tmpName = uniqueFilename(tmpDir, 'git-clone')
@@ -16,10 +16,13 @@ function manifest (spec, opts) {
16
16
  }
17
17
 
18
18
  function getManifest (spec, opts) {
19
- return fetchPackument(spec, opts).then(packument => {
19
+ return fetchPackument(spec, opts.concat({
20
+ fullMetadata: opts.enjoyBy ? true : opts.fullMetadata
21
+ })).then(packument => {
20
22
  try {
21
23
  return pickManifest(packument, spec.fetchSpec, {
22
24
  defaultTag: opts.defaultTag,
25
+ enjoyBy: opts.enjoyBy,
23
26
  includeDeprecated: opts.includeDeprecated
24
27
  })
25
28
  } catch (err) {
@@ -32,9 +35,12 @@ function getManifest (spec, opts) {
32
35
  preferOffline: false,
33
36
  preferOnline: true
34
37
  })
35
- return fetchPackument(spec, opts).then(packument => {
38
+ return fetchPackument(spec, opts.concat({
39
+ fullMetadata: opts.enjoyBy ? true : opts.fullMetadata
40
+ })).then(packument => {
36
41
  return pickManifest(packument, spec.fetchSpec, {
37
- defaultTag: opts.defaultTag
42
+ defaultTag: opts.defaultTag,
43
+ enjoyBy: opts.enjoyBy
38
44
  })
39
45
  })
40
46
  } else {
@@ -48,7 +48,7 @@ function tarball (spec, opts) {
48
48
  module.exports.fromManifest = fromManifest
49
49
  function fromManifest (manifest, spec, opts) {
50
50
  opts = optCheck(opts)
51
- if (spec.scope) { opts = opts.concat({scope: spec.scope}) }
51
+ if (spec.scope) { opts = opts.concat({ scope: spec.scope }) }
52
52
  const stream = new PassThrough()
53
53
  const registry = fetch.pickRegistry(spec, opts)
54
54
  const uri = getTarballUrl(spec, registry, manifest, opts)
@@ -37,7 +37,7 @@ function finalizeManifest (pkg, spec, opts) {
37
37
  const key = finalKey(pkg, spec)
38
38
  opts = optCheck(opts)
39
39
 
40
- const cachedManifest = (opts.cache && key && !opts.preferOnline && !opts.fullMetadata)
40
+ const cachedManifest = (opts.cache && key && !opts.preferOnline && !opts.fullMetadata && !opts.enjoyBy)
41
41
  ? cacache.get.info(opts.cache, key, opts)
42
42
  : BB.resolve(null)
43
43
 
@@ -156,7 +156,7 @@ function tarballedProps (pkg, spec, opts) {
156
156
  needsShrinkwrap && jsonFromStream('npm-shrinkwrap.json', extracted),
157
157
  needsManifest && jsonFromStream('package.json', extracted),
158
158
  needsBin && getPaths(extracted),
159
- needsHash && ssri.fromStream(tarStream, {algorithms: ['sha1', 'sha512']}),
159
+ needsHash && ssri.fromStream(tarStream, { algorithms: ['sha1', 'sha512'] }),
160
160
  needsExtract && pipe(tarStream, extracted),
161
161
  (sr, mani, paths, hash) => {
162
162
  if (needsManifest && !mani) {
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 }).then(() => {
78
+ return execGit(['init'], { cwd: target })
79
79
  }).then(() => {
80
- return execGit(['checkout', committish || 'HEAD'], {cwd: target})
80
+ return execGit(['checkout', committish || 'HEAD'], { cwd: target })
81
81
  }).then(() => {
82
82
  return updateSubmodules(target, opts)
83
83
  }).then(() => headSha(target, opts))
@@ -110,7 +110,7 @@ function updateSubmodules (localRepo, opts) {
110
110
 
111
111
  function headSha (repo, opts) {
112
112
  opts = optCheck(opts)
113
- return execGit(['rev-parse', '--revs-only', 'HEAD'], {cwd: repo}, opts).spread(stdout => {
113
+ return execGit(['rev-parse', '--revs-only', 'HEAD'], { cwd: repo }, opts).spread(stdout => {
114
114
  return stdout.trim()
115
115
  })
116
116
  }
@@ -139,7 +139,7 @@ function revs (repo, opts) {
139
139
  if (!ref) { return revs } // ???
140
140
  if (ref.endsWith(CARET_BRACES)) { return revs } // refs/tags/x^{} crap
141
141
  const type = refType(line)
142
- const doc = {sha, ref, type}
142
+ const doc = { sha, ref, type }
143
143
 
144
144
  revs.refs[ref] = doc
145
145
  // We can check out shallow clones on specific SHAs if we have a ref
@@ -157,7 +157,7 @@ function revs (repo, opts) {
157
157
  }
158
158
 
159
159
  return revs
160
- }, {versions: {}, 'dist-tags': {}, refs: {}, shas: {}})
160
+ }, { versions: {}, 'dist-tags': {}, refs: {}, shas: {} })
161
161
  }, err => {
162
162
  err.message = `Error while executing:\n${GITPATH} ls-remote -h -t ${repo}\n\n${err.stderr}\n${err.message}`
163
163
  throw err
@@ -11,29 +11,31 @@ module.exports = figgyPudding({
11
11
  defaultTag: 'tag',
12
12
  dirPacker: {},
13
13
  dmode: {},
14
+ 'enjoy-by': 'enjoyBy',
15
+ enjoyBy: {},
14
16
  fmode: {},
15
- 'fetch-retries': {default: 2},
16
- 'fetch-retry-factor': {default: 10},
17
- 'fetch-retry-maxtimeout': {default: 60000},
18
- 'fetch-retry-mintimeout': {default: 10000},
17
+ 'fetch-retries': { default: 2 },
18
+ 'fetch-retry-factor': { default: 10 },
19
+ 'fetch-retry-maxtimeout': { default: 60000 },
20
+ 'fetch-retry-mintimeout': { default: 10000 },
19
21
  fullMetadata: 'full-metadata',
20
- 'full-metadata': {default: false},
22
+ 'full-metadata': { default: false },
21
23
  gid: {},
22
- includeDeprecated: {default: true},
24
+ includeDeprecated: { default: true },
23
25
  'include-deprecated': 'includeDeprecated',
24
26
  integrity: {},
25
- log: {default: logger},
27
+ log: { default: logger },
26
28
  memoize: {},
27
29
  offline: {},
28
30
  preferOffline: 'prefer-offline',
29
31
  'prefer-offline': {},
30
32
  preferOnline: 'prefer-online',
31
33
  'prefer-online': {},
32
- registry: {default: 'https://registry.npmjs.org/'},
34
+ registry: { default: 'https://registry.npmjs.org/' },
33
35
  resolved: {},
34
36
  retry: {},
35
37
  scope: {},
36
- tag: {default: 'latest'},
38
+ tag: { default: 'latest' },
37
39
  uid: {},
38
40
  umask: {},
39
41
  where: {}
@@ -33,7 +33,7 @@ function packDir (manifest, label, dir, target, opts) {
33
33
  }
34
34
 
35
35
  function mkPacker (dir) {
36
- return packlist({path: dir}).then(files => {
36
+ return packlist({ path: dir }).then(files => {
37
37
  return tar.c({
38
38
  cwd: dir,
39
39
  gzip: true,
@@ -36,7 +36,7 @@ function withTarballStream (spec, opts, streamHandler) {
36
36
  const file = path.resolve(opts.where || '.', opts.resolved.substr(5))
37
37
  return statAsync(file)
38
38
  .then(() => {
39
- const verifier = ssri.integrityStream({integrity: opts.integrity})
39
+ const verifier = ssri.integrityStream({ integrity: opts.integrity })
40
40
  const stream = fs.createReadStream(file)
41
41
  .on('error', err => verifier.emit('error', err))
42
42
  .pipe(verifier)
@@ -50,7 +50,7 @@ function withTarballStream (spec, opts, streamHandler) {
50
50
  throw err
51
51
  })
52
52
  })
53
- : BB.reject(Object.assign(new Error('no file!'), {code: 'ENOENT'}))
53
+ : BB.reject(Object.assign(new Error('no file!'), { code: 'ENOENT' }))
54
54
 
55
55
  const tryDigest = tryFile
56
56
  .catch(err => {
@@ -96,10 +96,10 @@ function withTarballStream (spec, opts, streamHandler) {
96
96
  const tardata = fetch.tarball(spec, opts)
97
97
  if (!opts.resolved) {
98
98
  tardata.on('manifest', m => {
99
- opts = opts.concat({resolved: m._resolved})
99
+ opts = opts.concat({ resolved: m._resolved })
100
100
  })
101
101
  tardata.on('integrity', i => {
102
- opts = opts.concat({integrity: i})
102
+ opts = opts.concat({ integrity: i })
103
103
  })
104
104
  }
105
105
  return BB.try(() => streamHandler(tardata))
@@ -117,7 +117,7 @@ function withTarballStream (spec, opts, streamHandler) {
117
117
  throw err
118
118
  }
119
119
  })
120
- }, {retries: 1}))
120
+ }, { retries: 1 }))
121
121
  }
122
122
  })
123
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacote",
3
- "version": "9.1.0",
3
+ "version": "9.2.3",
4
4
  "description": "JavaScript package downloader",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -41,44 +41,44 @@
41
41
  ],
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "bluebird": "^3.5.1",
45
- "cacache": "^11.0.2",
46
- "figgy-pudding": "^3.2.1",
47
- "get-stream": "^3.0.0",
48
- "glob": "^7.1.2",
44
+ "bluebird": "^3.5.2",
45
+ "cacache": "^11.2.0",
46
+ "figgy-pudding": "^3.5.1",
47
+ "get-stream": "^4.1.0",
48
+ "glob": "^7.1.3",
49
49
  "lru-cache": "^4.1.3",
50
50
  "make-fetch-happen": "^4.0.1",
51
51
  "minimatch": "^3.0.4",
52
- "minipass": "^2.3.3",
52
+ "minipass": "^2.3.5",
53
53
  "mississippi": "^3.0.0",
54
54
  "mkdirp": "^0.5.1",
55
55
  "normalize-package-data": "^2.4.0",
56
56
  "npm-package-arg": "^6.1.0",
57
- "npm-packlist": "^1.1.10",
58
- "npm-pick-manifest": "^2.1.0",
59
- "npm-registry-fetch": "^3.0.0",
57
+ "npm-packlist": "^1.1.12",
58
+ "npm-pick-manifest": "^2.2.3",
59
+ "npm-registry-fetch": "^3.8.0",
60
60
  "osenv": "^0.1.5",
61
61
  "promise-inflight": "^1.0.1",
62
62
  "promise-retry": "^1.1.1",
63
- "protoduck": "^5.0.0",
63
+ "protoduck": "^5.0.1",
64
64
  "rimraf": "^2.6.2",
65
65
  "safe-buffer": "^5.1.2",
66
- "semver": "^5.5.0",
67
- "ssri": "^6.0.0",
68
- "tar": "^4.4.3",
69
- "unique-filename": "^1.1.0",
70
- "which": "^1.3.0"
66
+ "semver": "^5.6.0",
67
+ "ssri": "^6.0.1",
68
+ "tar": "^4.4.6",
69
+ "unique-filename": "^1.1.1",
70
+ "which": "^1.3.1"
71
71
  },
72
72
  "devDependencies": {
73
- "nock": "^9.2.6",
73
+ "nock": "^10.0.1",
74
74
  "npmlog": "^4.1.2",
75
- "nyc": "^11.8.0",
75
+ "nyc": "^13.1.0",
76
76
  "require-inject": "^1.4.3",
77
- "standard": "^11.0.1",
77
+ "standard": "^12.0.1",
78
78
  "standard-version": "^4.4.0",
79
- "tacks": "^1.2.6",
79
+ "tacks": "^1.2.7",
80
80
  "tap": "^12.0.1",
81
- "tar-stream": "^1.6.1",
81
+ "tar-stream": "^1.6.2",
82
82
  "weallbehave": "^1.2.0",
83
83
  "weallcontribute": "^1.0.7"
84
84
  }
package/packument.js CHANGED
@@ -23,7 +23,7 @@ function packument (spec, opts) {
23
23
  return fetchPackument(spec, opts)
24
24
  }).then(p => {
25
25
  const elapsedTime = Date.now() - startTime
26
- opts.log.silly('pacote', `${spec.type} packument for ${spec.name}@${spec.saveSpec || spec.fetchSpec} fetched in ${elapsedTime}ms`)
26
+ opts.log.silly('pacote', `${spec.registry ? 'registry' : spec.type} packument for ${spec.name}@${spec.saveSpec || spec.fetchSpec} fetched in ${elapsedTime}ms`)
27
27
  return p
28
28
  })
29
29
  }
package/prefetch.js CHANGED
@@ -15,7 +15,7 @@ function prefetch (spec, opts) {
15
15
  const startTime = Date.now()
16
16
  if (!opts.cache) {
17
17
  opts.log.info('prefetch', 'skipping prefetch: no cache provided')
18
- return BB.resolve({spec})
18
+ return BB.resolve({ spec })
19
19
  }
20
20
  if (opts.integrity && !opts.preferOnline) {
21
21
  opts.log.silly('prefetch', 'checking if', opts.integrity, 'is already cached')