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
diff options
context:
space:
mode:
authorDarcy Clarke <darcy@darcyclarke.me>2020-02-25 18:59:52 +0300
committerDarcy Clarke <darcy@darcyclarke.me>2020-02-25 21:36:22 +0300
commita6789b1491b2b6ee57702a6118b7cd1fb10a5ce5 (patch)
tree4d28814a486b460f7a7826ec4f99ca9f73fe932a
parentd383adb69cdfbcbe183a356314e021da5cc4d3c8 (diff)
chownr@1.1.4
-rw-r--r--node_modules/chownr/chownr.js74
-rw-r--r--node_modules/chownr/package.json33
-rw-r--r--package-lock.json6
-rw-r--r--package.json2
4 files changed, 80 insertions, 35 deletions
diff --git a/node_modules/chownr/chownr.js b/node_modules/chownr/chownr.js
index 9f04393b7..0d4093216 100644
--- a/node_modules/chownr/chownr.js
+++ b/node_modules/chownr/chownr.js
@@ -7,10 +7,30 @@ const LCHOWN = fs.lchown ? 'lchown' : 'chown'
/* istanbul ignore next */
const LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync'
+/* istanbul ignore next */
const needEISDIRHandled = fs.lchown &&
!process.version.match(/v1[1-9]+\./) &&
!process.version.match(/v10\.[6-9]/)
+const lchownSync = (path, uid, gid) => {
+ try {
+ return fs[LCHOWNSYNC](path, uid, gid)
+ } catch (er) {
+ if (er.code !== 'ENOENT')
+ throw er
+ }
+}
+
+/* istanbul ignore next */
+const chownSync = (path, uid, gid) => {
+ try {
+ return fs.chownSync(path, uid, gid)
+ } catch (er) {
+ if (er.code !== 'ENOENT')
+ throw er
+ }
+}
+
/* istanbul ignore next */
const handleEISDIR =
needEISDIRHandled ? (path, uid, gid, cb) => er => {
@@ -28,14 +48,14 @@ const handleEISDIR =
const handleEISDirSync =
needEISDIRHandled ? (path, uid, gid) => {
try {
- return fs[LCHOWNSYNC](path, uid, gid)
+ return lchownSync(path, uid, gid)
} catch (er) {
if (er.code !== 'EISDIR')
throw er
- fs.chownSync(path, uid, gid)
+ chownSync(path, uid, gid)
}
}
- : (path, uid, gid) => fs[LCHOWNSYNC](path, uid, gid)
+ : (path, uid, gid) => lchownSync(path, uid, gid)
// fs.readdir could only accept an options object as of node v6
const nodeVersion = process.version
@@ -45,11 +65,19 @@ let readdirSync = (path, options) => fs.readdirSync(path, options)
if (/^v4\./.test(nodeVersion))
readdir = (path, options, cb) => fs.readdir(path, cb)
+const chown = (cpath, uid, gid, cb) => {
+ fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => {
+ // Skip ENOENT error
+ cb(er && er.code !== 'ENOENT' ? er : null)
+ }))
+}
+
const chownrKid = (p, child, uid, gid, cb) => {
if (typeof child === 'string')
return fs.lstat(path.resolve(p, child), (er, stats) => {
+ // Skip ENOENT error
if (er)
- return cb(er)
+ return cb(er.code !== 'ENOENT' ? er : null)
stats.name = child
chownrKid(p, stats, uid, gid, cb)
})
@@ -59,11 +87,11 @@ const chownrKid = (p, child, uid, gid, cb) => {
if (er)
return cb(er)
const cpath = path.resolve(p, child.name)
- fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, cb))
+ chown(cpath, uid, gid, cb)
})
} else {
const cpath = path.resolve(p, child.name)
- fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, cb))
+ chown(cpath, uid, gid, cb)
}
}
@@ -72,10 +100,14 @@ const chownr = (p, uid, gid, cb) => {
readdir(p, { withFileTypes: true }, (er, children) => {
// any error other than ENOTDIR or ENOTSUP means it's not readable,
// or doesn't exist. give up.
- if (er && er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
- return cb(er)
+ if (er) {
+ if (er.code === 'ENOENT')
+ return cb()
+ else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
+ return cb(er)
+ }
if (er || !children.length)
- return fs[LCHOWN](p, uid, gid, handleEISDIR(p, uid, gid, cb))
+ return chown(p, uid, gid, cb)
let len = children.length
let errState = null
@@ -85,7 +117,7 @@ const chownr = (p, uid, gid, cb) => {
if (er)
return cb(errState = er)
if (-- len === 0)
- return fs[LCHOWN](p, uid, gid, handleEISDIR(p, uid, gid, cb))
+ return chown(p, uid, gid, cb)
}
children.forEach(child => chownrKid(p, child, uid, gid, then))
@@ -94,9 +126,16 @@ const chownr = (p, uid, gid, cb) => {
const chownrKidSync = (p, child, uid, gid) => {
if (typeof child === 'string') {
- const stats = fs.lstatSync(path.resolve(p, child))
- stats.name = child
- child = stats
+ try {
+ const stats = fs.lstatSync(path.resolve(p, child))
+ stats.name = child
+ child = stats
+ } catch (er) {
+ if (er.code === 'ENOENT')
+ return
+ else
+ throw er
+ }
}
if (child.isDirectory())
@@ -110,12 +149,15 @@ const chownrSync = (p, uid, gid) => {
try {
children = readdirSync(p, { withFileTypes: true })
} catch (er) {
- if (er && er.code === 'ENOTDIR' && er.code !== 'ENOTSUP')
+ if (er.code === 'ENOENT')
+ return
+ else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP')
return handleEISDirSync(p, uid, gid)
- throw er
+ else
+ throw er
}
- if (children.length)
+ if (children && children.length)
children.forEach(child => chownrKidSync(p, child, uid, gid))
return handleEISDirSync(p, uid, gid)
diff --git a/node_modules/chownr/package.json b/node_modules/chownr/package.json
index cc48dc912..5c125f844 100644
--- a/node_modules/chownr/package.json
+++ b/node_modules/chownr/package.json
@@ -1,19 +1,19 @@
{
- "_from": "chownr@1.1.3",
- "_id": "chownr@1.1.3",
+ "_from": "chownr@1.1.4",
+ "_id": "chownr@1.1.4",
"_inBundle": false,
- "_integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==",
+ "_integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
"_location": "/chownr",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "chownr@1.1.3",
+ "raw": "chownr@1.1.4",
"name": "chownr",
"escapedName": "chownr",
- "rawSpec": "1.1.3",
+ "rawSpec": "1.1.4",
"saveSpec": null,
- "fetchSpec": "1.1.3"
+ "fetchSpec": "1.1.4"
},
"_requiredBy": [
"#USER",
@@ -23,10 +23,10 @@
"/pacote",
"/tar"
],
- "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
- "_shasum": "42d837d5239688d55f303003a508230fa6727142",
- "_spec": "chownr@1.1.3",
- "_where": "/Users/mperrotte/npminc/cli",
+ "_resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "_shasum": "6fc9d7b42d32a583596337666e7d08084da2cc6b",
+ "_spec": "chownr@1.1.4",
+ "_where": "/Users/darcyclarke/Documents/Repos/npm/cli",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
@@ -40,8 +40,8 @@
"description": "like `chown -R`",
"devDependencies": {
"mkdirp": "0.3",
- "rimraf": "",
- "tap": "^12.0.1"
+ "rimraf": "^2.7.1",
+ "tap": "^14.10.6"
},
"files": [
"chownr.js"
@@ -55,10 +55,13 @@
"url": "git://github.com/isaacs/chownr.git"
},
"scripts": {
- "postpublish": "git push origin --follow-tags",
"postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
"preversion": "npm test",
- "test": "tap test/*.js --cov"
+ "test": "tap"
},
- "version": "1.1.3"
+ "tap": {
+ "check-coverage": true
+ },
+ "version": "1.1.4"
}
diff --git a/package-lock.json b/package-lock.json
index 1bf5cd29e..150928958 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -666,9 +666,9 @@
"dev": true
},
"chownr": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
- "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw=="
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
+ "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
},
"ci-info": {
"version": "2.0.0",
diff --git a/package.json b/package.json
index 8997cd160..56a372239 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"byte-size": "^5.0.1",
"cacache": "^12.0.3",
"call-limit": "^1.1.1",
- "chownr": "^1.1.3",
+ "chownr": "^1.1.4",
"ci-info": "^2.0.0",
"cli-columns": "^3.1.2",
"cli-table3": "^0.5.1",