Skip to content

Commit 89e14d3

Browse files
committed
1 parent 5383f3a commit 89e14d3

File tree

13 files changed

+125
-61
lines changed

13 files changed

+125
-61
lines changed

node_modules/tar/LICENSE

Lines changed: 0 additions & 15 deletions
This file was deleted.

node_modules/tar/LICENSE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Blue Oak Model License
2+
3+
Version 1.0.0
4+
5+
## Purpose
6+
7+
This license gives everyone as much permission to work with
8+
this software as possible, while protecting contributors
9+
from liability.
10+
11+
## Acceptance
12+
13+
In order to receive this license, you must agree to its
14+
rules. The rules of this license are both obligations
15+
under that agreement and conditions to your license.
16+
You must not do anything with this software that triggers
17+
a rule that you cannot or will not follow.
18+
19+
## Copyright
20+
21+
Each contributor licenses you to do everything with this
22+
software that would otherwise infringe that contributor's
23+
copyright in it.
24+
25+
## Notices
26+
27+
You must ensure that everyone who gets a copy of
28+
any part of this software from you, with or without
29+
changes, also gets the text of this license or a link to
30+
<https://blueoakcouncil.org/license/1.0.0>.
31+
32+
## Excuse
33+
34+
If anyone notifies you in writing that you have not
35+
complied with [Notices](#notices), you can keep your
36+
license by taking all practical steps to comply within 30
37+
days after the notice. If you do not do so, your license
38+
ends immediately.
39+
40+
## Patent
41+
42+
Each contributor licenses you to do everything with this
43+
software that would otherwise infringe any patent claims
44+
they can license or become able to license.
45+
46+
## Reliability
47+
48+
No contributor can revoke this license.
49+
50+
## No Liability
51+
52+
***As far as the law allows, this software comes as is,
53+
without any warranty or condition, and no contributor
54+
will be liable to anyone for any damages related to this
55+
software or this license, under any kind of legal claim.***

node_modules/tar/dist/commonjs/header.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ class Header {
6868
if (!buf || !(buf.length >= off + 512)) {
6969
throw new Error('need 512 bytes for header');
7070
}
71-
this.path = decString(buf, off, 100);
72-
this.mode = decNumber(buf, off + 100, 8);
73-
this.uid = decNumber(buf, off + 108, 8);
74-
this.gid = decNumber(buf, off + 116, 8);
75-
this.size = decNumber(buf, off + 124, 12);
76-
this.mtime = decDate(buf, off + 136, 12);
71+
this.path = ex?.path ?? decString(buf, off, 100);
72+
this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
73+
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
74+
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
75+
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
76+
this.mtime =
77+
ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
7778
this.cksum = decNumber(buf, off + 148, 12);
7879
// if we have extended or global extended headers, apply them now
7980
// See https://github.com/npm/node-tar/pull/187
@@ -101,11 +102,15 @@ class Header {
101102
this.linkpath = decString(buf, off + 157, 100);
102103
if (buf.subarray(off + 257, off + 265).toString() ===
103104
'ustar\u000000') {
104-
this.uname = decString(buf, off + 265, 32);
105-
this.gname = decString(buf, off + 297, 32);
106105
/* c8 ignore start */
107-
this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
108-
this.devmin = decNumber(buf, off + 337, 8) ?? 0;
106+
this.uname =
107+
ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
108+
this.gname =
109+
ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
110+
this.devmaj =
111+
ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
112+
this.devmin =
113+
ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
109114
/* c8 ignore stop */
110115
if (buf[off + 475] !== 0) {
111116
// definitely a prefix, definitely >130 chars.
@@ -117,8 +122,12 @@ class Header {
117122
if (prefix) {
118123
this.path = prefix + '/' + this.path;
119124
}
120-
this.atime = decDate(buf, off + 476, 12);
121-
this.ctime = decDate(buf, off + 488, 12);
125+
/* c8 ignore start */
126+
this.atime =
127+
ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
128+
this.ctime =
129+
ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
130+
/* c8 ignore stop */
122131
}
123132
}
124133
let sum = 8 * 0x20;

node_modules/tar/dist/commonjs/list.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,16 @@ const listFileSync = (opt) => {
8282
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
8383
if (stat.size < readSize) {
8484
const buf = Buffer.allocUnsafe(stat.size);
85-
node_fs_1.default.readSync(fd, buf, 0, stat.size, 0);
86-
p.end(buf);
85+
const read = node_fs_1.default.readSync(fd, buf, 0, stat.size, 0);
86+
p.end(read === buf.byteLength ? buf : buf.subarray(0, read));
8787
}
8888
else {
8989
let pos = 0;
9090
const buf = Buffer.allocUnsafe(readSize);
9191
while (pos < stat.size) {
9292
const bytesRead = node_fs_1.default.readSync(fd, buf, 0, readSize, pos);
93+
if (bytesRead === 0)
94+
break;
9395
pos += bytesRead;
9496
p.write(buf.subarray(0, bytesRead));
9597
}

node_modules/tar/dist/commonjs/pack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ class Pack extends minipass_1.Minipass {
135135
}
136136
this.portable = !!opt.portable;
137137
if (opt.gzip || opt.brotli || opt.zstd) {
138-
if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) > 1) {
138+
if ((opt.gzip ? 1 : 0) +
139+
(opt.brotli ? 1 : 0) +
140+
(opt.zstd ? 1 : 0) >
141+
1) {
139142
throw new TypeError('gzip, brotli, zstd are mutually exclusive');
140143
}
141144
if (opt.gzip) {

node_modules/tar/dist/commonjs/parse.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,8 @@ class Parser extends events_1.EventEmitter {
449449
const ended = this[ENDED];
450450
this[ENDED] = false;
451451
this[UNZIP] =
452-
this[UNZIP] === undefined ?
453-
new minizlib_1.Unzip({})
454-
: isZstd ?
455-
new minizlib_1.ZstdDecompress({})
452+
this[UNZIP] === undefined ? new minizlib_1.Unzip({})
453+
: isZstd ? new minizlib_1.ZstdDecompress({})
456454
: new minizlib_1.BrotliDecompress({});
457455
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
458456
this[UNZIP].on('error', er => this.abort(er));

node_modules/tar/dist/esm/header.js

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ export class Header {
4242
if (!buf || !(buf.length >= off + 512)) {
4343
throw new Error('need 512 bytes for header');
4444
}
45-
this.path = decString(buf, off, 100);
46-
this.mode = decNumber(buf, off + 100, 8);
47-
this.uid = decNumber(buf, off + 108, 8);
48-
this.gid = decNumber(buf, off + 116, 8);
49-
this.size = decNumber(buf, off + 124, 12);
50-
this.mtime = decDate(buf, off + 136, 12);
45+
this.path = ex?.path ?? decString(buf, off, 100);
46+
this.mode = ex?.mode ?? gex?.mode ?? decNumber(buf, off + 100, 8);
47+
this.uid = ex?.uid ?? gex?.uid ?? decNumber(buf, off + 108, 8);
48+
this.gid = ex?.gid ?? gex?.gid ?? decNumber(buf, off + 116, 8);
49+
this.size = ex?.size ?? gex?.size ?? decNumber(buf, off + 124, 12);
50+
this.mtime =
51+
ex?.mtime ?? gex?.mtime ?? decDate(buf, off + 136, 12);
5152
this.cksum = decNumber(buf, off + 148, 12);
5253
// if we have extended or global extended headers, apply them now
5354
// See https://github.com/npm/node-tar/pull/187
@@ -75,11 +76,15 @@ export class Header {
7576
this.linkpath = decString(buf, off + 157, 100);
7677
if (buf.subarray(off + 257, off + 265).toString() ===
7778
'ustar\u000000') {
78-
this.uname = decString(buf, off + 265, 32);
79-
this.gname = decString(buf, off + 297, 32);
8079
/* c8 ignore start */
81-
this.devmaj = decNumber(buf, off + 329, 8) ?? 0;
82-
this.devmin = decNumber(buf, off + 337, 8) ?? 0;
80+
this.uname =
81+
ex?.uname ?? gex?.uname ?? decString(buf, off + 265, 32);
82+
this.gname =
83+
ex?.gname ?? gex?.gname ?? decString(buf, off + 297, 32);
84+
this.devmaj =
85+
ex?.devmaj ?? gex?.devmaj ?? decNumber(buf, off + 329, 8) ?? 0;
86+
this.devmin =
87+
ex?.devmin ?? gex?.devmin ?? decNumber(buf, off + 337, 8) ?? 0;
8388
/* c8 ignore stop */
8489
if (buf[off + 475] !== 0) {
8590
// definitely a prefix, definitely >130 chars.
@@ -91,8 +96,12 @@ export class Header {
9196
if (prefix) {
9297
this.path = prefix + '/' + this.path;
9398
}
94-
this.atime = decDate(buf, off + 476, 12);
95-
this.ctime = decDate(buf, off + 488, 12);
99+
/* c8 ignore start */
100+
this.atime =
101+
ex?.atime ?? gex?.atime ?? decDate(buf, off + 476, 12);
102+
this.ctime =
103+
ex?.ctime ?? gex?.ctime ?? decDate(buf, off + 488, 12);
104+
/* c8 ignore stop */
96105
}
97106
}
98107
let sum = 8 * 0x20;

node_modules/tar/dist/esm/list.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ const listFileSync = (opt) => {
5252
const readSize = opt.maxReadSize || 16 * 1024 * 1024;
5353
if (stat.size < readSize) {
5454
const buf = Buffer.allocUnsafe(stat.size);
55-
fs.readSync(fd, buf, 0, stat.size, 0);
56-
p.end(buf);
55+
const read = fs.readSync(fd, buf, 0, stat.size, 0);
56+
p.end(read === buf.byteLength ? buf : buf.subarray(0, read));
5757
}
5858
else {
5959
let pos = 0;
6060
const buf = Buffer.allocUnsafe(readSize);
6161
while (pos < stat.size) {
6262
const bytesRead = fs.readSync(fd, buf, 0, readSize, pos);
63+
if (bytesRead === 0)
64+
break;
6365
pos += bytesRead;
6466
p.write(buf.subarray(0, bytesRead));
6567
}

node_modules/tar/dist/esm/pack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ export class Pack extends Minipass {
105105
}
106106
this.portable = !!opt.portable;
107107
if (opt.gzip || opt.brotli || opt.zstd) {
108-
if ((opt.gzip ? 1 : 0) + (opt.brotli ? 1 : 0) + (opt.zstd ? 1 : 0) > 1) {
108+
if ((opt.gzip ? 1 : 0) +
109+
(opt.brotli ? 1 : 0) +
110+
(opt.zstd ? 1 : 0) >
111+
1) {
109112
throw new TypeError('gzip, brotli, zstd are mutually exclusive');
110113
}
111114
if (opt.gzip) {

node_modules/tar/dist/esm/parse.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,8 @@ export class Parser extends EE {
446446
const ended = this[ENDED];
447447
this[ENDED] = false;
448448
this[UNZIP] =
449-
this[UNZIP] === undefined ?
450-
new Unzip({})
451-
: isZstd ?
452-
new ZstdDecompress({})
449+
this[UNZIP] === undefined ? new Unzip({})
450+
: isZstd ? new ZstdDecompress({})
453451
: new BrotliDecompress({});
454452
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
455453
this[UNZIP].on('error', er => this.abort(er));

0 commit comments

Comments
 (0)