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

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/tar')
-rw-r--r--deps/npm/node_modules/tar/lib/strip-absolute-path.js14
-rw-r--r--deps/npm/node_modules/tar/lib/unpack.js32
-rw-r--r--deps/npm/node_modules/tar/lib/write-entry.js29
-rw-r--r--deps/npm/node_modules/tar/package.json25
4 files changed, 72 insertions, 28 deletions
diff --git a/deps/npm/node_modules/tar/lib/strip-absolute-path.js b/deps/npm/node_modules/tar/lib/strip-absolute-path.js
new file mode 100644
index 00000000000..49161ddc304
--- /dev/null
+++ b/deps/npm/node_modules/tar/lib/strip-absolute-path.js
@@ -0,0 +1,14 @@
+// unix absolute paths are also absolute on win32, so we use this for both
+const { isAbsolute, parse } = require('path').win32
+
+// returns [root, stripped]
+module.exports = path => {
+ let r = ''
+ while (isAbsolute(path)) {
+ // windows will think that //x/y/z has a "root" of //x/y/
+ const root = path.charAt(0) === '/' ? '/' : parse(path).root
+ path = path.substr(root.length)
+ r += root
+ }
+ return [r, path]
+}
diff --git a/deps/npm/node_modules/tar/lib/unpack.js b/deps/npm/node_modules/tar/lib/unpack.js
index fc765096efd..3a29a65142e 100644
--- a/deps/npm/node_modules/tar/lib/unpack.js
+++ b/deps/npm/node_modules/tar/lib/unpack.js
@@ -9,6 +9,7 @@ const path = require('path')
const mkdir = require('./mkdir.js')
const mkdirSync = mkdir.sync
const wc = require('./winchars.js')
+const stripAbsolutePath = require('./strip-absolute-path.js')
const ONENTRY = Symbol('onEntry')
const CHECKFS = Symbol('checkFs')
@@ -195,10 +196,10 @@ class Unpack extends Parser {
// absolutes on posix are also absolutes on win32
// so we only need to test this one to get both
- if (path.win32.isAbsolute(p)) {
- const parsed = path.win32.parse(p)
- this.warn('stripping ' + parsed.root + ' from absolute path', p)
- entry.path = p.substr(parsed.root.length)
+ const s = stripAbsolutePath(p)
+ if (s[0]) {
+ entry.path = s[1]
+ this.warn(`stripping ${s[0]} from absolute path`, p)
}
}
@@ -413,6 +414,20 @@ class Unpack extends Parser {
// check if a thing is there, and if so, try to clobber it
[CHECKFS] (entry) {
this[PEND]()
+
+ // if we are not creating a directory, and the path is in the dirCache,
+ // then that means we are about to delete the directory we created
+ // previously, and it is no longer going to be a directory, and neither
+ // is any of its children.
+ if (entry.type !== 'Directory') {
+ for (const path of this.dirCache.keys()) {
+ if (path === entry.absolute ||
+ path.indexOf(entry.absolute + '/') === 0 ||
+ path.indexOf(entry.absolute + '\\') === 0)
+ this.dirCache.delete(path)
+ }
+ }
+
this[MKDIR](path.dirname(entry.absolute), this.dmode, er => {
if (er)
return this[ONERROR](er, entry)
@@ -474,6 +489,15 @@ class UnpackSync extends Unpack {
}
[CHECKFS] (entry) {
+ if (entry.type !== 'Directory') {
+ for (const path of this.dirCache.keys()) {
+ if (path === entry.absolute ||
+ path.indexOf(entry.absolute + '/') === 0 ||
+ path.indexOf(entry.absolute + '\\') === 0)
+ this.dirCache.delete(path)
+ }
+ }
+
const er = this[MKDIR](path.dirname(entry.absolute), this.dmode)
if (er)
return this[ONERROR](er, entry)
diff --git a/deps/npm/node_modules/tar/lib/write-entry.js b/deps/npm/node_modules/tar/lib/write-entry.js
index 0c019006f3b..d7c347f8f62 100644
--- a/deps/npm/node_modules/tar/lib/write-entry.js
+++ b/deps/npm/node_modules/tar/lib/write-entry.js
@@ -26,6 +26,7 @@ const CLOSE = Symbol('close')
const MODE = Symbol('mode')
const warner = require('./warn-mixin.js')
const winchars = require('./winchars.js')
+const stripAbsolutePath = require('./strip-absolute-path.js')
const modeFix = require('./mode-fix.js')
@@ -54,12 +55,12 @@ const WriteEntry = warner(class WriteEntry extends MiniPass {
if (typeof opt.onwarn === 'function')
this.on('warn', opt.onwarn)
- if (!this.preservePaths && path.win32.isAbsolute(p)) {
- // absolutes on posix are also absolutes on win32
- // so we only need to test this one to get both
- const parsed = path.win32.parse(p)
- this.warn('stripping ' + parsed.root + ' from absolute path', p)
- this.path = p.substr(parsed.root.length)
+ if (!this.preservePaths) {
+ const s = stripAbsolutePath(this.path)
+ if (s[0]) {
+ this.path = s[1]
+ this.warn('stripping ' + s[0] + ' from absolute path', p)
+ }
}
this.win32 = !!opt.win32 || process.platform === 'win32'
@@ -343,13 +344,15 @@ const WriteEntryTar = warner(class WriteEntryTar extends MiniPass {
if (typeof opt.onwarn === 'function')
this.on('warn', opt.onwarn)
- if (path.isAbsolute(this.path) && !this.preservePaths) {
- const parsed = path.parse(this.path)
- this.warn(
- 'stripping ' + parsed.root + ' from absolute path',
- this.path
- )
- this.path = this.path.substr(parsed.root.length)
+ if (!this.preservePaths) {
+ const s = stripAbsolutePath(this.path)
+ if (s[0]) {
+ this.warn(
+ 'stripping ' + s[0] + ' from absolute path',
+ this.path
+ )
+ this.path = s[1]
+ }
}
this.remain = readEntry.size
diff --git a/deps/npm/node_modules/tar/package.json b/deps/npm/node_modules/tar/package.json
index b12db0f3ef5..89c00d00353 100644
--- a/deps/npm/node_modules/tar/package.json
+++ b/deps/npm/node_modules/tar/package.json
@@ -1,8 +1,8 @@
{
- "_from": "tar@4.4.13",
- "_id": "tar@4.4.13",
+ "_from": "tar@4.4.15",
+ "_id": "tar@4.4.15",
"_inBundle": false,
- "_integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==",
+ "_integrity": "sha512-ItbufpujXkry7bHH9NpQyTXPbJ72iTlXgkBAYsAjDXk3Ds8t/3NfO5P4xZGy7u+sYuQUbimgzswX4uQIEeNVOA==",
"_location": "/tar",
"_phantomChildren": {
"safe-buffer": "5.1.2",
@@ -11,12 +11,12 @@
"_requested": {
"type": "version",
"registry": true,
- "raw": "tar@4.4.13",
+ "raw": "tar@4.4.15",
"name": "tar",
"escapedName": "tar",
- "rawSpec": "4.4.13",
+ "rawSpec": "4.4.15",
"saveSpec": null,
- "fetchSpec": "4.4.13"
+ "fetchSpec": "4.4.15"
},
"_requiredBy": [
"#USER",
@@ -24,10 +24,10 @@
"/node-gyp",
"/pacote"
],
- "_resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz",
- "_shasum": "43b364bc52888d555298637b10d60790254ab525",
- "_spec": "tar@4.4.13",
- "_where": "/Users/mperrotte/npminc/cli",
+ "_resolved": "https://registry.npmjs.org/tar/-/tar-4.4.15.tgz",
+ "_shasum": "3caced4f39ebd46ddda4d6203d48493a919697f8",
+ "_spec": "tar@4.4.15",
+ "_where": "/Users/darcyclarke/Documents/Repos/npm/npm6",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
@@ -68,6 +68,9 @@
"homepage": "https://github.com/npm/node-tar#readme",
"license": "ISC",
"name": "tar",
+ "publishConfig": {
+ "tag": "v4-legacy"
+ },
"repository": {
"type": "git",
"url": "git+https://github.com/npm/node-tar.git"
@@ -84,5 +87,5 @@
"coverage-map": "map.js",
"check-coverage": true
},
- "version": "4.4.13"
+ "version": "4.4.15"
}