Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorForrest L Norvell <ogd@aoaioxxysz.net>2015-01-22 05:12:40 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-01-23 15:48:00 +0300
commite9f8ab3cd6324fbf2678132324d4cd8579209442 (patch)
treef7dbcd88bc061963d6df193f8408a1c38ae59b8e /lib
parent168a2505e8584d4ff78987705d7a809ac125c322 (diff)
npm-registry-client@6.0.0
* support /-/package/:name/access endpoint * support /-/package/:name/dist-tags endpoint * mandatory `access` parameter for publishes, with no default (because the client doesn't know which is appropriate). * registry client has atypical inheritance, so npm.client.distTags.* can be in their own little namespace.
Diffstat (limited to 'lib')
-rw-r--r--lib/cache/caching-client.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/cache/caching-client.js b/lib/cache/caching-client.js
index 459a236f5..ec8eb8e16 100644
--- a/lib/cache/caching-client.js
+++ b/lib/cache/caching-client.js
@@ -24,6 +24,7 @@ function CachingRegistryClient (config) {
// swizzle in our custom cache invalidation logic
this._request = this.request
this.request = this._invalidatingRequest
+ this.get = get
}
inherits(CachingRegistryClient, RegistryClient)
@@ -42,7 +43,7 @@ CachingRegistryClient.prototype._invalidatingRequest = function (uri, params, cb
// thinking that it didn't work when it did.
// Note that failure is an acceptable option here, since the only
// result will be a stale cache for some helper commands.
- client.log.verbose("request", "invalidating", invalidated, "on", method)
+ log.verbose("request", "invalidating", invalidated, "on", method)
return rimraf(invalidated, function () {
cb.apply(undefined, args)
})
@@ -52,7 +53,7 @@ CachingRegistryClient.prototype._invalidatingRequest = function (uri, params, cb
})
}
-CachingRegistryClient.prototype.get = function get (uri, params, cb) {
+function get (uri, params, cb) {
assert(typeof uri === "string", "must pass registry URI to get")
assert(params && typeof params === "object", "must pass params to get")
assert(typeof cb === "function", "must pass callback to get")
@@ -68,7 +69,10 @@ CachingRegistryClient.prototype.get = function get (uri, params, cb) {
// If the GET is part of a write operation (PUT or DELETE), then
// skip past the cache entirely, but still save the results.
- if (uri.match(/\?write=true$/)) return get_.call(this, uri, cachePath, params, cb)
+ if (uri.match(/\?write=true$/)) {
+ log.verbose("get", "GET as part of write; not caching result")
+ return get_.call(this, uri, cachePath, params, cb)
+ }
var client = this
fs.stat(cachePath, function (er, stat) {
@@ -170,6 +174,7 @@ function get_ (uri, cachePath, params, cb) {
}
function saveToCache (cachePath, data, saved) {
+ log.verbose("get", "saving", data.name, "to", cachePath)
getCacheStat(function (er, st) {
mkdirp(path.dirname(cachePath), function (er, made) {
if (er) return saved()