arri 0.0.27 → 0.0.28
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/chunks/index.cjs +64 -9
- package/dist/chunks/index.mjs +64 -9
- package/package.json +2 -2
package/dist/chunks/index.cjs
CHANGED
|
@@ -3819,14 +3819,26 @@ const Pack = warner$1(class Pack extends Minipass {
|
|
|
3819
3819
|
|
|
3820
3820
|
this.portable = !!opt.portable;
|
|
3821
3821
|
this.zip = null;
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3822
|
+
|
|
3823
|
+
if (opt.gzip || opt.brotli) {
|
|
3824
|
+
if (opt.gzip && opt.brotli) {
|
|
3825
|
+
throw new TypeError('gzip and brotli are mutually exclusive')
|
|
3826
|
+
}
|
|
3827
|
+
if (opt.gzip) {
|
|
3828
|
+
if (typeof opt.gzip !== 'object') {
|
|
3829
|
+
opt.gzip = {};
|
|
3830
|
+
}
|
|
3831
|
+
if (this.portable) {
|
|
3832
|
+
opt.gzip.portable = true;
|
|
3833
|
+
}
|
|
3834
|
+
this.zip = new zlib$1.Gzip(opt.gzip);
|
|
3825
3835
|
}
|
|
3826
|
-
if (
|
|
3827
|
-
opt.
|
|
3836
|
+
if (opt.brotli) {
|
|
3837
|
+
if (typeof opt.brotli !== 'object') {
|
|
3838
|
+
opt.brotli = {};
|
|
3839
|
+
}
|
|
3840
|
+
this.zip = new zlib$1.BrotliCompress(opt.brotli);
|
|
3828
3841
|
}
|
|
3829
|
-
this.zip = new zlib$1.Gzip(opt.gzip);
|
|
3830
3842
|
this.zip.on('data', chunk => super.write(chunk));
|
|
3831
3843
|
this.zip.on('end', _ => super.end());
|
|
3832
3844
|
this.zip.on('drain', _ => this[ONDRAIN]());
|
|
@@ -4678,6 +4690,16 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4678
4690
|
this.strict = !!opt.strict;
|
|
4679
4691
|
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
|
|
4680
4692
|
this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
|
|
4693
|
+
// Unlike gzip, brotli doesn't have any magic bytes to identify it
|
|
4694
|
+
// Users need to explicitly tell us they're extracting a brotli file
|
|
4695
|
+
// Or we infer from the file extension
|
|
4696
|
+
const isTBR = (opt.file && (
|
|
4697
|
+
opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')));
|
|
4698
|
+
// if it's a tbr file it MIGHT be brotli, but we don't know until
|
|
4699
|
+
// we look at it and verify it's not a valid tar file.
|
|
4700
|
+
this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli
|
|
4701
|
+
: isTBR ? undefined
|
|
4702
|
+
: false;
|
|
4681
4703
|
|
|
4682
4704
|
// have to set this so that streams are ok piping into it
|
|
4683
4705
|
this.writable = true;
|
|
@@ -4928,7 +4950,9 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4928
4950
|
}
|
|
4929
4951
|
|
|
4930
4952
|
// first write, might be gzipped
|
|
4931
|
-
|
|
4953
|
+
const needSniff = this[UNZIP] === null ||
|
|
4954
|
+
this.brotli === undefined && this[UNZIP] === false;
|
|
4955
|
+
if (needSniff && chunk) {
|
|
4932
4956
|
if (this[BUFFER]) {
|
|
4933
4957
|
chunk = Buffer.concat([this[BUFFER], chunk]);
|
|
4934
4958
|
this[BUFFER] = null;
|
|
@@ -4937,15 +4961,45 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4937
4961
|
this[BUFFER] = chunk;
|
|
4938
4962
|
return true
|
|
4939
4963
|
}
|
|
4964
|
+
|
|
4965
|
+
// look for gzip header
|
|
4940
4966
|
for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
|
|
4941
4967
|
if (chunk[i] !== gzipHeader[i]) {
|
|
4942
4968
|
this[UNZIP] = false;
|
|
4943
4969
|
}
|
|
4944
4970
|
}
|
|
4945
|
-
|
|
4971
|
+
|
|
4972
|
+
const maybeBrotli = this.brotli === undefined;
|
|
4973
|
+
if (this[UNZIP] === false && maybeBrotli) {
|
|
4974
|
+
// read the first header to see if it's a valid tar file. If so,
|
|
4975
|
+
// we can safely assume that it's not actually brotli, despite the
|
|
4976
|
+
// .tbr or .tar.br file extension.
|
|
4977
|
+
// if we ended before getting a full chunk, yes, def brotli
|
|
4978
|
+
if (chunk.length < 512) {
|
|
4979
|
+
if (this[ENDED$1]) {
|
|
4980
|
+
this.brotli = true;
|
|
4981
|
+
} else {
|
|
4982
|
+
this[BUFFER] = chunk;
|
|
4983
|
+
return true
|
|
4984
|
+
}
|
|
4985
|
+
} else {
|
|
4986
|
+
// if it's tar, it's pretty reliably not brotli, chances of
|
|
4987
|
+
// that happening are astronomical.
|
|
4988
|
+
try {
|
|
4989
|
+
new Header(chunk.slice(0, 512));
|
|
4990
|
+
this.brotli = false;
|
|
4991
|
+
} catch (_) {
|
|
4992
|
+
this.brotli = true;
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {
|
|
4946
4998
|
const ended = this[ENDED$1];
|
|
4947
4999
|
this[ENDED$1] = false;
|
|
4948
|
-
this[UNZIP] =
|
|
5000
|
+
this[UNZIP] = this[UNZIP] === null
|
|
5001
|
+
? new zlib.Unzip()
|
|
5002
|
+
: new zlib.BrotliDecompress();
|
|
4949
5003
|
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
|
|
4950
5004
|
this[UNZIP].on('error', er => this.abort(er));
|
|
4951
5005
|
this[UNZIP].on('end', _ => {
|
|
@@ -5083,6 +5137,7 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
5083
5137
|
this[UNZIP].end(chunk);
|
|
5084
5138
|
} else {
|
|
5085
5139
|
this[ENDED$1] = true;
|
|
5140
|
+
if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0);
|
|
5086
5141
|
this.write(chunk);
|
|
5087
5142
|
}
|
|
5088
5143
|
}
|
package/dist/chunks/index.mjs
CHANGED
|
@@ -3798,14 +3798,26 @@ const Pack = warner$1(class Pack extends Minipass {
|
|
|
3798
3798
|
|
|
3799
3799
|
this.portable = !!opt.portable;
|
|
3800
3800
|
this.zip = null;
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3801
|
+
|
|
3802
|
+
if (opt.gzip || opt.brotli) {
|
|
3803
|
+
if (opt.gzip && opt.brotli) {
|
|
3804
|
+
throw new TypeError('gzip and brotli are mutually exclusive')
|
|
3805
|
+
}
|
|
3806
|
+
if (opt.gzip) {
|
|
3807
|
+
if (typeof opt.gzip !== 'object') {
|
|
3808
|
+
opt.gzip = {};
|
|
3809
|
+
}
|
|
3810
|
+
if (this.portable) {
|
|
3811
|
+
opt.gzip.portable = true;
|
|
3812
|
+
}
|
|
3813
|
+
this.zip = new zlib$1.Gzip(opt.gzip);
|
|
3804
3814
|
}
|
|
3805
|
-
if (
|
|
3806
|
-
opt.
|
|
3815
|
+
if (opt.brotli) {
|
|
3816
|
+
if (typeof opt.brotli !== 'object') {
|
|
3817
|
+
opt.brotli = {};
|
|
3818
|
+
}
|
|
3819
|
+
this.zip = new zlib$1.BrotliCompress(opt.brotli);
|
|
3807
3820
|
}
|
|
3808
|
-
this.zip = new zlib$1.Gzip(opt.gzip);
|
|
3809
3821
|
this.zip.on('data', chunk => super.write(chunk));
|
|
3810
3822
|
this.zip.on('end', _ => super.end());
|
|
3811
3823
|
this.zip.on('drain', _ => this[ONDRAIN]());
|
|
@@ -4657,6 +4669,16 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4657
4669
|
this.strict = !!opt.strict;
|
|
4658
4670
|
this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
|
|
4659
4671
|
this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
|
|
4672
|
+
// Unlike gzip, brotli doesn't have any magic bytes to identify it
|
|
4673
|
+
// Users need to explicitly tell us they're extracting a brotli file
|
|
4674
|
+
// Or we infer from the file extension
|
|
4675
|
+
const isTBR = (opt.file && (
|
|
4676
|
+
opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')));
|
|
4677
|
+
// if it's a tbr file it MIGHT be brotli, but we don't know until
|
|
4678
|
+
// we look at it and verify it's not a valid tar file.
|
|
4679
|
+
this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli
|
|
4680
|
+
: isTBR ? undefined
|
|
4681
|
+
: false;
|
|
4660
4682
|
|
|
4661
4683
|
// have to set this so that streams are ok piping into it
|
|
4662
4684
|
this.writable = true;
|
|
@@ -4907,7 +4929,9 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4907
4929
|
}
|
|
4908
4930
|
|
|
4909
4931
|
// first write, might be gzipped
|
|
4910
|
-
|
|
4932
|
+
const needSniff = this[UNZIP] === null ||
|
|
4933
|
+
this.brotli === undefined && this[UNZIP] === false;
|
|
4934
|
+
if (needSniff && chunk) {
|
|
4911
4935
|
if (this[BUFFER]) {
|
|
4912
4936
|
chunk = Buffer.concat([this[BUFFER], chunk]);
|
|
4913
4937
|
this[BUFFER] = null;
|
|
@@ -4916,15 +4940,45 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
4916
4940
|
this[BUFFER] = chunk;
|
|
4917
4941
|
return true
|
|
4918
4942
|
}
|
|
4943
|
+
|
|
4944
|
+
// look for gzip header
|
|
4919
4945
|
for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
|
|
4920
4946
|
if (chunk[i] !== gzipHeader[i]) {
|
|
4921
4947
|
this[UNZIP] = false;
|
|
4922
4948
|
}
|
|
4923
4949
|
}
|
|
4924
|
-
|
|
4950
|
+
|
|
4951
|
+
const maybeBrotli = this.brotli === undefined;
|
|
4952
|
+
if (this[UNZIP] === false && maybeBrotli) {
|
|
4953
|
+
// read the first header to see if it's a valid tar file. If so,
|
|
4954
|
+
// we can safely assume that it's not actually brotli, despite the
|
|
4955
|
+
// .tbr or .tar.br file extension.
|
|
4956
|
+
// if we ended before getting a full chunk, yes, def brotli
|
|
4957
|
+
if (chunk.length < 512) {
|
|
4958
|
+
if (this[ENDED$1]) {
|
|
4959
|
+
this.brotli = true;
|
|
4960
|
+
} else {
|
|
4961
|
+
this[BUFFER] = chunk;
|
|
4962
|
+
return true
|
|
4963
|
+
}
|
|
4964
|
+
} else {
|
|
4965
|
+
// if it's tar, it's pretty reliably not brotli, chances of
|
|
4966
|
+
// that happening are astronomical.
|
|
4967
|
+
try {
|
|
4968
|
+
new Header(chunk.slice(0, 512));
|
|
4969
|
+
this.brotli = false;
|
|
4970
|
+
} catch (_) {
|
|
4971
|
+
this.brotli = true;
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
}
|
|
4975
|
+
|
|
4976
|
+
if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {
|
|
4925
4977
|
const ended = this[ENDED$1];
|
|
4926
4978
|
this[ENDED$1] = false;
|
|
4927
|
-
this[UNZIP] =
|
|
4979
|
+
this[UNZIP] = this[UNZIP] === null
|
|
4980
|
+
? new zlib.Unzip()
|
|
4981
|
+
: new zlib.BrotliDecompress();
|
|
4928
4982
|
this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
|
|
4929
4983
|
this[UNZIP].on('error', er => this.abort(er));
|
|
4930
4984
|
this[UNZIP].on('end', _ => {
|
|
@@ -5062,6 +5116,7 @@ var parse$1 = warner(class Parser extends EE {
|
|
|
5062
5116
|
this[UNZIP].end(chunk);
|
|
5063
5117
|
} else {
|
|
5064
5118
|
this[ENDED$1] = true;
|
|
5119
|
+
if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0);
|
|
5065
5120
|
this.write(chunk);
|
|
5066
5121
|
}
|
|
5067
5122
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sinclair/typebox": "^0.31.
|
|
15
|
+
"@sinclair/typebox": "^0.31.14",
|
|
16
16
|
"h3": "^1.8.1",
|
|
17
17
|
"esbuild": "^0.19.2",
|
|
18
18
|
"scule": "^1.0.0",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"chokidar": "^3.5.3",
|
|
26
26
|
"listhen": "^1.4.4"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.0.
|
|
28
|
+
"version": "0.0.28",
|
|
29
29
|
"repository": {
|
|
30
30
|
"url": "https://github.com/modiimedia/arri"
|
|
31
31
|
}
|