npm-pkg-lint 2.0.2 → 2.0.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/dist/index.js +45 -11
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9385,14 +9385,25 @@ var require_pack = __commonJS({
|
|
|
9385
9385
|
}
|
|
9386
9386
|
this.portable = !!opt.portable;
|
|
9387
9387
|
this.zip = null;
|
|
9388
|
-
if (opt.gzip) {
|
|
9389
|
-
if (
|
|
9390
|
-
|
|
9388
|
+
if (opt.gzip || opt.brotli) {
|
|
9389
|
+
if (opt.gzip && opt.brotli) {
|
|
9390
|
+
throw new TypeError("gzip and brotli are mutually exclusive");
|
|
9391
9391
|
}
|
|
9392
|
-
if (
|
|
9393
|
-
opt.gzip
|
|
9392
|
+
if (opt.gzip) {
|
|
9393
|
+
if (typeof opt.gzip !== "object") {
|
|
9394
|
+
opt.gzip = {};
|
|
9395
|
+
}
|
|
9396
|
+
if (this.portable) {
|
|
9397
|
+
opt.gzip.portable = true;
|
|
9398
|
+
}
|
|
9399
|
+
this.zip = new zlib.Gzip(opt.gzip);
|
|
9400
|
+
}
|
|
9401
|
+
if (opt.brotli) {
|
|
9402
|
+
if (typeof opt.brotli !== "object") {
|
|
9403
|
+
opt.brotli = {};
|
|
9404
|
+
}
|
|
9405
|
+
this.zip = new zlib.BrotliCompress(opt.brotli);
|
|
9394
9406
|
}
|
|
9395
|
-
this.zip = new zlib.Gzip(opt.gzip);
|
|
9396
9407
|
this.zip.on("data", (chunk) => super.write(chunk));
|
|
9397
9408
|
this.zip.on("end", (_) => super.end());
|
|
9398
9409
|
this.zip.on("drain", (_) => this[ONDRAIN]());
|
|
@@ -10117,6 +10128,8 @@ var require_parse = __commonJS({
|
|
|
10117
10128
|
this.strict = !!opt.strict;
|
|
10118
10129
|
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
|
|
10119
10130
|
this.filter = typeof opt.filter === "function" ? opt.filter : noop2;
|
|
10131
|
+
const isTBR = opt.file && (opt.file.endsWith(".tar.br") || opt.file.endsWith(".tbr"));
|
|
10132
|
+
this.brotli = !opt.gzip && opt.brotli !== void 0 ? opt.brotli : isTBR ? void 0 : false;
|
|
10120
10133
|
this.writable = true;
|
|
10121
10134
|
this.readable = false;
|
|
10122
10135
|
this[QUEUE] = new Yallist();
|
|
@@ -10318,7 +10331,8 @@ var require_parse = __commonJS({
|
|
|
10318
10331
|
if (this[ABORTED]) {
|
|
10319
10332
|
return;
|
|
10320
10333
|
}
|
|
10321
|
-
|
|
10334
|
+
const needSniff = this[UNZIP] === null || this.brotli === void 0 && this[UNZIP] === false;
|
|
10335
|
+
if (needSniff && chunk) {
|
|
10322
10336
|
if (this[BUFFER]) {
|
|
10323
10337
|
chunk = Buffer.concat([this[BUFFER], chunk]);
|
|
10324
10338
|
this[BUFFER] = null;
|
|
@@ -10332,10 +10346,28 @@ var require_parse = __commonJS({
|
|
|
10332
10346
|
this[UNZIP] = false;
|
|
10333
10347
|
}
|
|
10334
10348
|
}
|
|
10335
|
-
|
|
10349
|
+
const maybeBrotli = this.brotli === void 0;
|
|
10350
|
+
if (this[UNZIP] === false && maybeBrotli) {
|
|
10351
|
+
if (chunk.length < 512) {
|
|
10352
|
+
if (this[ENDED]) {
|
|
10353
|
+
this.brotli = true;
|
|
10354
|
+
} else {
|
|
10355
|
+
this[BUFFER] = chunk;
|
|
10356
|
+
return true;
|
|
10357
|
+
}
|
|
10358
|
+
} else {
|
|
10359
|
+
try {
|
|
10360
|
+
new Header(chunk.slice(0, 512));
|
|
10361
|
+
this.brotli = false;
|
|
10362
|
+
} catch (_) {
|
|
10363
|
+
this.brotli = true;
|
|
10364
|
+
}
|
|
10365
|
+
}
|
|
10366
|
+
}
|
|
10367
|
+
if (this[UNZIP] === null || this[UNZIP] === false && this.brotli) {
|
|
10336
10368
|
const ended = this[ENDED];
|
|
10337
10369
|
this[ENDED] = false;
|
|
10338
|
-
this[UNZIP] = new zlib.Unzip();
|
|
10370
|
+
this[UNZIP] = this[UNZIP] === null ? new zlib.Unzip() : new zlib.BrotliDecompress();
|
|
10339
10371
|
this[UNZIP].on("data", (chunk2) => this[CONSUMECHUNK](chunk2));
|
|
10340
10372
|
this[UNZIP].on("error", (er) => this.abort(er));
|
|
10341
10373
|
this[UNZIP].on("end", (_) => {
|
|
@@ -10442,6 +10474,8 @@ var require_parse = __commonJS({
|
|
|
10442
10474
|
this[UNZIP].end(chunk);
|
|
10443
10475
|
} else {
|
|
10444
10476
|
this[ENDED] = true;
|
|
10477
|
+
if (this.brotli === void 0)
|
|
10478
|
+
chunk = chunk || Buffer.alloc(0);
|
|
10445
10479
|
this.write(chunk);
|
|
10446
10480
|
}
|
|
10447
10481
|
}
|
|
@@ -10674,7 +10708,7 @@ var require_replace = __commonJS({
|
|
|
10674
10708
|
if (!opt.file) {
|
|
10675
10709
|
throw new TypeError("file is required");
|
|
10676
10710
|
}
|
|
10677
|
-
if (opt.gzip) {
|
|
10711
|
+
if (opt.gzip || opt.brotli || opt.file.endsWith(".br") || opt.file.endsWith(".tbr")) {
|
|
10678
10712
|
throw new TypeError("cannot append to compressed archives");
|
|
10679
10713
|
}
|
|
10680
10714
|
if (!files || !Array.isArray(files) || !files.length) {
|
|
@@ -10885,7 +10919,7 @@ var require_update = __commonJS({
|
|
|
10885
10919
|
if (!opt.file) {
|
|
10886
10920
|
throw new TypeError("file is required");
|
|
10887
10921
|
}
|
|
10888
|
-
if (opt.gzip) {
|
|
10922
|
+
if (opt.gzip || opt.brotli || opt.file.endsWith(".br") || opt.file.endsWith(".tbr")) {
|
|
10889
10923
|
throw new TypeError("cannot append to compressed archives");
|
|
10890
10924
|
}
|
|
10891
10925
|
if (!files || !Array.isArray(files) || !files.length) {
|