create-expo 5.0.0 → 5.1.0
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/build/{205.index.js → 589.index.js} +442 -128
- package/build/601.index.js +20 -11
- package/build/{525.index.js → 870.index.js} +423 -334
- package/build/Examples.d.ts +38 -0
- package/build/Template.d.ts +98 -0
- package/build/__mocks__/fs.d.ts +1 -0
- package/build/__mocks__/ora.d.ts +1 -0
- package/build/__tests__/Examples.test.d.ts +1 -0
- package/build/__tests__/Template.test.d.ts +1 -0
- package/build/__tests__/configureWorkspaces.test.d.ts +1 -0
- package/build/__tests__/createAsync.test.d.ts +1 -0
- package/build/__tests__/createExpoConfig.test.d.ts +1 -0
- package/build/__tests__/createFileTransformer.test.d.ts +1 -0
- package/build/__tests__/generateAgentFiles.test.d.ts +1 -0
- package/build/__tests__/promptSdkVersion.test.d.ts +1 -0
- package/build/__tests__/resolvePackageManager.test.d.ts +1 -0
- package/build/__tests__/sanitizeTemplate.test.d.ts +1 -0
- package/build/__tests__/telemetry.test.d.ts +1 -0
- package/build/agent-files/AGENTS.md +41 -0
- package/build/agent-files/CLAUDE.md +1 -0
- package/build/cli.d.ts +1 -0
- package/build/configureWorkspaces.d.ts +9 -0
- package/build/createAsync.d.ts +11 -0
- package/build/createExpoConfig.d.ts +38 -0
- package/build/createFileTransform.d.ts +5 -0
- package/build/error.d.ts +9 -0
- package/build/generateAgentFiles.d.ts +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +38 -10
- package/build/legacyTemplates.d.ts +7 -0
- package/build/log.d.ts +12 -0
- package/build/paths.d.ts +2 -0
- package/build/promptSdkVersion.d.ts +23 -0
- package/build/resolvePackageManager.d.ts +12 -0
- package/build/resolveProjectRoot.d.ts +3 -0
- package/build/sessionStorage.d.ts +8 -0
- package/build/telemetry.d.ts +29 -0
- package/build/utils/__tests__/args.test.d.ts +1 -0
- package/build/utils/__tests__/array.test.d.ts +1 -0
- package/build/utils/__tests__/log.test.d.ts +1 -0
- package/build/utils/__tests__/npm.test.d.ts +1 -0
- package/build/utils/__tests__/obj.test.d.ts +1 -0
- package/build/utils/args.d.ts +33 -0
- package/build/utils/array.d.ts +1 -0
- package/build/utils/dir.d.ts +1 -0
- package/build/utils/env.d.ts +14 -0
- package/build/utils/fetch.d.ts +2 -0
- package/build/utils/git.d.ts +1 -0
- package/build/utils/github.d.ts +2 -0
- package/build/utils/log.d.ts +6 -0
- package/build/utils/npm.d.ts +52 -0
- package/build/utils/obj.d.ts +1 -0
- package/build/utils/tar.d.ts +10 -0
- package/build/utils/update-check.d.ts +2 -0
- package/package.json +33 -21
- package/template/agent-files/AGENTS.md +41 -0
- package/template/agent-files/CLAUDE.md +1 -0
- package/build/517.index.js +0 -1380
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
exports.id =
|
|
2
|
-
exports.ids = [
|
|
1
|
+
exports.id = 870;
|
|
2
|
+
exports.ids = [870];
|
|
3
3
|
exports.modules = {
|
|
4
4
|
|
|
5
5
|
/***/ 2671:
|
|
@@ -11691,14 +11691,6 @@ function bisearch(ucs) {
|
|
|
11691
11691
|
}
|
|
11692
11692
|
|
|
11693
11693
|
|
|
11694
|
-
/***/ }),
|
|
11695
|
-
|
|
11696
|
-
/***/ 392:
|
|
11697
|
-
/***/ ((module) => {
|
|
11698
|
-
|
|
11699
|
-
module.exports = eval("require")("../package.json");
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
11694
|
/***/ }),
|
|
11703
11695
|
|
|
11704
11696
|
/***/ 9337:
|
|
@@ -11726,12 +11718,12 @@ globstar while`,t,d,e,f,m),this.matchOne(t.slice(d),e.slice(f),s))return this.de
|
|
|
11726
11718
|
|
|
11727
11719
|
/***/ }),
|
|
11728
11720
|
|
|
11729
|
-
/***/
|
|
11721
|
+
/***/ 6378:
|
|
11730
11722
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
11731
11723
|
|
|
11732
11724
|
"use strict";
|
|
11733
11725
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11734
|
-
/* harmony export */ Aq: () => (/* binding */
|
|
11726
|
+
/* harmony export */ Aq: () => (/* binding */ p),
|
|
11735
11727
|
/* harmony export */ PJ: () => (/* binding */ untar),
|
|
11736
11728
|
/* harmony export */ WT: () => (/* binding */ streamToAsyncIterable)
|
|
11737
11729
|
/* harmony export */ });
|
|
@@ -11744,15 +11736,18 @@ function createReadableStream(t) {
|
|
|
11744
11736
|
const {pull: n, cancel: i} = t;
|
|
11745
11737
|
if (n && i) {
|
|
11746
11738
|
let e;
|
|
11739
|
+
let a;
|
|
11747
11740
|
t.pull = function wrappedPull(t) {
|
|
11748
11741
|
return e = n(t);
|
|
11749
11742
|
};
|
|
11750
11743
|
t.cancel = function wrappedCancel() {
|
|
11751
|
-
if (null !=
|
|
11744
|
+
if (null != a) {
|
|
11745
|
+
return a;
|
|
11746
|
+
} else if (null != e) {
|
|
11752
11747
|
const settle = () => i();
|
|
11753
|
-
return Promise.resolve(e).then(settle, settle);
|
|
11748
|
+
return a = Promise.resolve(e).then(settle, settle);
|
|
11754
11749
|
}
|
|
11755
|
-
return i();
|
|
11750
|
+
return a = Promise.resolve(i());
|
|
11756
11751
|
};
|
|
11757
11752
|
}
|
|
11758
11753
|
const a = new ReadableStream(t, e);
|
|
@@ -11769,12 +11764,24 @@ function streamToAsyncIterable(e) {
|
|
|
11769
11764
|
if (!e[Symbol.asyncIterator]) {
|
|
11770
11765
|
return async function*() {
|
|
11771
11766
|
const t = e.getReader();
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11767
|
+
let n = !1;
|
|
11768
|
+
try {
|
|
11769
|
+
while (1) {
|
|
11770
|
+
const e = await t.read();
|
|
11771
|
+
if (e.done) {
|
|
11772
|
+
n = !0;
|
|
11773
|
+
return e.value;
|
|
11774
|
+
}
|
|
11775
|
+
yield e.value;
|
|
11776
|
+
}
|
|
11777
|
+
} finally {
|
|
11778
|
+
try {
|
|
11779
|
+
if (!n) {
|
|
11780
|
+
await t.cancel();
|
|
11781
|
+
}
|
|
11782
|
+
} finally {
|
|
11783
|
+
t.releaseLock();
|
|
11776
11784
|
}
|
|
11777
|
-
yield e.value;
|
|
11778
11785
|
}
|
|
11779
11786
|
}();
|
|
11780
11787
|
} else {
|
|
@@ -11782,20 +11789,75 @@ function streamToAsyncIterable(e) {
|
|
|
11782
11789
|
}
|
|
11783
11790
|
}
|
|
11784
11791
|
|
|
11785
|
-
function
|
|
11786
|
-
if (
|
|
11787
|
-
|
|
11788
|
-
return async function read() {
|
|
11789
|
-
return await t.read();
|
|
11790
|
-
};
|
|
11792
|
+
async function* streamToSizedAsyncIterable(e, t, n) {
|
|
11793
|
+
if (null == t) {
|
|
11794
|
+
yield* streamToAsyncIterable(e);
|
|
11791
11795
|
} else {
|
|
11792
|
-
const
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
+
const i = e.getReader();
|
|
11797
|
+
let a = t;
|
|
11798
|
+
let r = !1;
|
|
11799
|
+
try {
|
|
11800
|
+
while (1) {
|
|
11801
|
+
const e = await i.read();
|
|
11802
|
+
if (e.done) {
|
|
11803
|
+
r = !0;
|
|
11804
|
+
break;
|
|
11805
|
+
}
|
|
11806
|
+
a -= e.value.byteLength;
|
|
11807
|
+
if (a < 0) {
|
|
11808
|
+
throw new Error(`${n} body exceeds declared size`);
|
|
11809
|
+
}
|
|
11810
|
+
yield e.value;
|
|
11811
|
+
}
|
|
11812
|
+
if (a > 0) {
|
|
11813
|
+
throw new Error(`${n} body is shorter than declared size`);
|
|
11814
|
+
}
|
|
11815
|
+
} finally {
|
|
11816
|
+
try {
|
|
11817
|
+
if (!r) {
|
|
11818
|
+
await i.cancel();
|
|
11819
|
+
}
|
|
11820
|
+
} finally {
|
|
11821
|
+
i.releaseLock();
|
|
11822
|
+
}
|
|
11823
|
+
}
|
|
11796
11824
|
}
|
|
11797
11825
|
}
|
|
11798
11826
|
|
|
11827
|
+
function streamLikeToIterator(e) {
|
|
11828
|
+
const t = "getReader" in e && "function" == typeof e.getReader ? streamToAsyncIterable(e) : e;
|
|
11829
|
+
const n = t[Symbol.asyncIterator] ? t[Symbol.asyncIterator]() : t[Symbol.iterator]();
|
|
11830
|
+
let i = !1;
|
|
11831
|
+
const a = {
|
|
11832
|
+
[Symbol.asyncIterator]: () => a,
|
|
11833
|
+
async next() {
|
|
11834
|
+
if (i) {
|
|
11835
|
+
return {
|
|
11836
|
+
done: !0,
|
|
11837
|
+
value: void 0
|
|
11838
|
+
};
|
|
11839
|
+
}
|
|
11840
|
+
const e = await n.next();
|
|
11841
|
+
i = !!e.done;
|
|
11842
|
+
return e.done ? {
|
|
11843
|
+
done: !0,
|
|
11844
|
+
value: void 0
|
|
11845
|
+
} : e;
|
|
11846
|
+
},
|
|
11847
|
+
async return() {
|
|
11848
|
+
if (!i) {
|
|
11849
|
+
i = !0;
|
|
11850
|
+
await (n.return?.());
|
|
11851
|
+
}
|
|
11852
|
+
return {
|
|
11853
|
+
done: !0,
|
|
11854
|
+
value: void 0
|
|
11855
|
+
};
|
|
11856
|
+
}
|
|
11857
|
+
};
|
|
11858
|
+
return a;
|
|
11859
|
+
}
|
|
11860
|
+
|
|
11799
11861
|
function iterableToStream(e, t) {
|
|
11800
11862
|
const n = t?.signal;
|
|
11801
11863
|
const i = new AbortController;
|
|
@@ -11941,6 +12003,9 @@ class ReadableStreamBlockReader {
|
|
|
11941
12003
|
this.block = new Uint8Array(t);
|
|
11942
12004
|
this.buffer = null;
|
|
11943
12005
|
}
|
|
12006
|
+
async close() {
|
|
12007
|
+
await this.next.return();
|
|
12008
|
+
}
|
|
11944
12009
|
async read() {
|
|
11945
12010
|
const {blockSize: e, block: t} = this;
|
|
11946
12011
|
let n = 0;
|
|
@@ -11962,7 +12027,7 @@ class ReadableStreamBlockReader {
|
|
|
11962
12027
|
}
|
|
11963
12028
|
}
|
|
11964
12029
|
while ((i = e - n) > 0) {
|
|
11965
|
-
const {done: e, value: a} = await this.next();
|
|
12030
|
+
const {done: e, value: a} = await this.next.next();
|
|
11966
12031
|
if (e || !a?.byteLength) {
|
|
11967
12032
|
break;
|
|
11968
12033
|
} else if (a.byteLength > i) {
|
|
@@ -12000,7 +12065,7 @@ class ReadableStreamBlockReader {
|
|
|
12000
12065
|
}
|
|
12001
12066
|
}
|
|
12002
12067
|
this.blockLocked = !1;
|
|
12003
|
-
const {done: i, value: a} = await this.next();
|
|
12068
|
+
const {done: i, value: a} = await this.next.next();
|
|
12004
12069
|
if (i) {
|
|
12005
12070
|
return null;
|
|
12006
12071
|
} else if (a.byteLength > e) {
|
|
@@ -12030,7 +12095,7 @@ class ReadableStreamBlockReader {
|
|
|
12030
12095
|
}
|
|
12031
12096
|
}
|
|
12032
12097
|
while (t > 0) {
|
|
12033
|
-
const {done: e, value: n} = await this.next();
|
|
12098
|
+
const {done: e, value: n} = await this.next.next();
|
|
12034
12099
|
if (e) {
|
|
12035
12100
|
return t;
|
|
12036
12101
|
} else if (n.byteLength > t) {
|
|
@@ -12260,29 +12325,34 @@ async function expectTrailer(e, t) {
|
|
|
12260
12325
|
async function decodeHeaders(e) {
|
|
12261
12326
|
let t = 0;
|
|
12262
12327
|
const n = Object.create(null);
|
|
12263
|
-
while (t
|
|
12328
|
+
while (t <= 32e3) {
|
|
12264
12329
|
let i = "";
|
|
12330
|
+
let a = 0;
|
|
12265
12331
|
for await (const n of readUntilBoundary(e, s, l)) {
|
|
12266
12332
|
if (null == n) {
|
|
12267
12333
|
throw new Error("Invalid Multipart Headers: Unexpected EOF");
|
|
12268
12334
|
} else if (!t && !i && 45 === n[0] && 45 === n[1]) {
|
|
12269
12335
|
return null;
|
|
12270
12336
|
} else {
|
|
12271
|
-
|
|
12272
|
-
if (
|
|
12337
|
+
a += n.byteLength;
|
|
12338
|
+
if (a > 16e3) {
|
|
12273
12339
|
throw new Error("Invalid Multipart Headers: A header exceeded its maximum length of 16kB");
|
|
12274
12340
|
}
|
|
12341
|
+
i += d.decode(n, {
|
|
12342
|
+
stream: !0
|
|
12343
|
+
});
|
|
12275
12344
|
}
|
|
12276
12345
|
}
|
|
12346
|
+
i += d.decode();
|
|
12277
12347
|
if (i) {
|
|
12278
12348
|
const e = i.indexOf(":");
|
|
12279
12349
|
if (e > -1) {
|
|
12280
|
-
const
|
|
12281
|
-
const
|
|
12282
|
-
if (
|
|
12283
|
-
n[
|
|
12350
|
+
const r = i.slice(0, e).trim().toLowerCase();
|
|
12351
|
+
const o = i.slice(e + 1).trim();
|
|
12352
|
+
if (o) {
|
|
12353
|
+
n[r] = o;
|
|
12284
12354
|
}
|
|
12285
|
-
t +=
|
|
12355
|
+
t += a + s.byteLength;
|
|
12286
12356
|
} else {
|
|
12287
12357
|
throw new Error("Invalid Multipart Headers: Invalid header value missing `:`");
|
|
12288
12358
|
}
|
|
@@ -12290,113 +12360,119 @@ async function decodeHeaders(e) {
|
|
|
12290
12360
|
break;
|
|
12291
12361
|
}
|
|
12292
12362
|
}
|
|
12293
|
-
if (t >
|
|
12363
|
+
if (t > 32e3) {
|
|
12294
12364
|
throw new Error("Invalid Multipart Headers: Headers exceeded their maximum length of 32kB");
|
|
12295
12365
|
}
|
|
12296
12366
|
return n;
|
|
12297
12367
|
}
|
|
12298
12368
|
|
|
12299
12369
|
async function* parseMultipart(e, t) {
|
|
12300
|
-
const n =
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
|
|
12318
|
-
|
|
12319
|
-
|
|
12320
|
-
|
|
12321
|
-
|
|
12322
|
-
|
|
12323
|
-
}(i, n);
|
|
12324
|
-
let a;
|
|
12325
|
-
while (a = await decodeHeaders(i)) {
|
|
12326
|
-
const e = a["content-type"];
|
|
12327
|
-
const t = parseContentDisposition(a["content-disposition"]);
|
|
12328
|
-
const r = t?.filename || t?.name;
|
|
12329
|
-
const o = parseContentLength(a["content-length"]);
|
|
12330
|
-
if (!r) {
|
|
12331
|
-
throw new Error("Invalid Multipart Part: Missing Content-Disposition name or filename parameter");
|
|
12332
|
-
}
|
|
12333
|
-
let s = !1;
|
|
12334
|
-
let l = 0;
|
|
12335
|
-
let c;
|
|
12336
|
-
if (null !== o) {
|
|
12337
|
-
l = o;
|
|
12338
|
-
c = createReadableStream({
|
|
12339
|
-
expectedLength: o,
|
|
12340
|
-
async cancel() {
|
|
12341
|
-
if (l > 0) {
|
|
12342
|
-
l = await i.skip(l);
|
|
12343
|
-
if (l > 0) {
|
|
12344
|
-
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12345
|
-
}
|
|
12346
|
-
}
|
|
12347
|
-
if (!s) {
|
|
12348
|
-
await expectTrailer(i, n);
|
|
12349
|
-
s = !0;
|
|
12350
|
-
}
|
|
12351
|
-
},
|
|
12352
|
-
async pull(e) {
|
|
12353
|
-
if (l) {
|
|
12354
|
-
const t = await i.pull(l);
|
|
12355
|
-
if (!t) {
|
|
12356
|
-
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12357
|
-
}
|
|
12358
|
-
l -= t.byteLength;
|
|
12359
|
-
e.enqueue(i.blockLocked ? t.slice() : t);
|
|
12360
|
-
}
|
|
12361
|
-
if (!l) {
|
|
12362
|
-
await expectTrailer(i, n);
|
|
12363
|
-
s = !0;
|
|
12364
|
-
e.close();
|
|
12370
|
+
const n = new ReadableStreamBlockReader(e, 4096);
|
|
12371
|
+
try {
|
|
12372
|
+
yield* async function* readMultipart(e, t) {
|
|
12373
|
+
const n = function convertToBoundaryBytes(e) {
|
|
12374
|
+
const t = e.match(c);
|
|
12375
|
+
const n = `--${t?.[1] || "-"}`;
|
|
12376
|
+
const i = `\r\n${n}`;
|
|
12377
|
+
const a = utf8Encode(n);
|
|
12378
|
+
const r = utf8Encode(i);
|
|
12379
|
+
return {
|
|
12380
|
+
raw: a,
|
|
12381
|
+
rawSkipTable: bytesToSkipTable(a),
|
|
12382
|
+
trailer: r,
|
|
12383
|
+
trailerSkipTable: bytesToSkipTable(r)
|
|
12384
|
+
};
|
|
12385
|
+
}(t.contentType);
|
|
12386
|
+
await async function expectPreamble(e, t) {
|
|
12387
|
+
let n = 0;
|
|
12388
|
+
for await (const i of readUntilBoundary(e, t.raw, t.rawSkipTable)) {
|
|
12389
|
+
if (null == i) {
|
|
12390
|
+
throw new Error("Invalid Multipart Preamble: Unexpected EOF");
|
|
12391
|
+
} else if ((n += i?.byteLength) > 16e3) {
|
|
12392
|
+
throw new Error("Invalid Multipart Preamble: Boundary not found within the first 16kB");
|
|
12365
12393
|
}
|
|
12366
12394
|
}
|
|
12367
|
-
});
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
|
|
12395
|
+
}(e, n);
|
|
12396
|
+
let i;
|
|
12397
|
+
while (i = await decodeHeaders(e)) {
|
|
12398
|
+
const t = i["content-type"];
|
|
12399
|
+
const a = parseContentDisposition(i["content-disposition"]);
|
|
12400
|
+
const r = a?.filename || a?.name;
|
|
12401
|
+
const o = parseContentLength(i["content-length"]);
|
|
12402
|
+
if (!r) {
|
|
12403
|
+
throw new Error("Invalid Multipart Part: Missing Content-Disposition name or filename parameter");
|
|
12404
|
+
}
|
|
12405
|
+
let s = !1;
|
|
12406
|
+
let l = 0;
|
|
12407
|
+
let c;
|
|
12408
|
+
if (null !== o) {
|
|
12409
|
+
l = o;
|
|
12410
|
+
c = createReadableStream({
|
|
12411
|
+
expectedLength: o,
|
|
12412
|
+
async cancel() {
|
|
12413
|
+
if (l > 0) {
|
|
12414
|
+
l = await e.skip(l);
|
|
12415
|
+
if (l > 0) {
|
|
12416
|
+
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12417
|
+
}
|
|
12418
|
+
}
|
|
12419
|
+
if (!s) {
|
|
12420
|
+
await expectTrailer(e, n);
|
|
12421
|
+
s = !0;
|
|
12422
|
+
}
|
|
12423
|
+
},
|
|
12424
|
+
async pull(t) {
|
|
12425
|
+
if (l) {
|
|
12426
|
+
const n = await e.pull(l);
|
|
12427
|
+
if (!n) {
|
|
12428
|
+
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12429
|
+
}
|
|
12430
|
+
l -= n.byteLength;
|
|
12431
|
+
t.enqueue(e.blockLocked ? n.slice() : n);
|
|
12432
|
+
}
|
|
12433
|
+
if (!l) {
|
|
12434
|
+
await expectTrailer(e, n);
|
|
12435
|
+
s = !0;
|
|
12436
|
+
t.close();
|
|
12437
|
+
}
|
|
12375
12438
|
}
|
|
12376
|
-
}
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12439
|
+
});
|
|
12440
|
+
} else {
|
|
12441
|
+
const t = readUntilBoundary(e, n.trailer, n.trailerSkipTable);
|
|
12442
|
+
c = createReadableStream({
|
|
12443
|
+
async cancel() {
|
|
12444
|
+
for await (const e of t) {
|
|
12445
|
+
if (!e) {
|
|
12446
|
+
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12447
|
+
}
|
|
12448
|
+
}
|
|
12449
|
+
s = !0;
|
|
12450
|
+
},
|
|
12451
|
+
async pull(e) {
|
|
12452
|
+
const n = await t.next();
|
|
12453
|
+
if (n.done) {
|
|
12454
|
+
e.close();
|
|
12455
|
+
s = !0;
|
|
12456
|
+
} else if (!n.value) {
|
|
12457
|
+
throw new Error("Invalid Multipart Part: Unexpected EOF");
|
|
12458
|
+
} else {
|
|
12459
|
+
e.enqueue(n.value.slice());
|
|
12460
|
+
}
|
|
12461
|
+
}
|
|
12462
|
+
});
|
|
12389
12463
|
}
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
}
|
|
12464
|
+
yield new MultipartPart(c, r, {
|
|
12465
|
+
type: t ?? void 0,
|
|
12466
|
+
size: o ?? void 0,
|
|
12467
|
+
headers: i
|
|
12468
|
+
});
|
|
12469
|
+
if (l > 0 || !s) {
|
|
12470
|
+
await c.cancel();
|
|
12471
|
+
}
|
|
12472
|
+
}
|
|
12473
|
+
}(n, t);
|
|
12474
|
+
} finally {
|
|
12475
|
+
await n.close();
|
|
12400
12476
|
}
|
|
12401
12477
|
}
|
|
12402
12478
|
|
|
@@ -12410,9 +12486,10 @@ const isBlob = e => "object" == typeof e && null != e && (e instanceof Multipart
|
|
|
12410
12486
|
|
|
12411
12487
|
const makeFormHeader = (e, t) => {
|
|
12412
12488
|
let n = f + i + u;
|
|
12413
|
-
|
|
12489
|
+
const a = encodeName(e.name);
|
|
12490
|
+
n += `Content-Disposition: form-data; name="${a}"`;
|
|
12414
12491
|
if (null != e.filename) {
|
|
12415
|
-
n += `; filename="${encodeName(e.filename)}"`;
|
|
12492
|
+
n += `; filename="${e.filename === e.name ? a : encodeName(e.filename)}"`;
|
|
12416
12493
|
}
|
|
12417
12494
|
if (t) {
|
|
12418
12495
|
if (t.type) {
|
|
@@ -12434,39 +12511,36 @@ const makeFormHeader = (e, t) => {
|
|
|
12434
12511
|
return n;
|
|
12435
12512
|
};
|
|
12436
12513
|
|
|
12437
|
-
const
|
|
12514
|
+
const y = (/* unused pure expression or super */ null && (`multipart/form-data; boundary=${i}`));
|
|
12438
12515
|
|
|
12439
12516
|
async function* streamMultipart(e) {
|
|
12440
|
-
const n
|
|
12441
|
-
|
|
12442
|
-
while (!(i = await n()).done && i.value) {
|
|
12443
|
-
const e = i.value[0];
|
|
12444
|
-
const n = i.value[1];
|
|
12445
|
-
if (isBlob(n)) {
|
|
12517
|
+
for await (const [n, i] of streamLikeToIterator(e)) {
|
|
12518
|
+
if (isBlob(i)) {
|
|
12446
12519
|
yield t.encode(makeFormHeader({
|
|
12447
|
-
name:
|
|
12448
|
-
filename: "name" in
|
|
12449
|
-
},
|
|
12450
|
-
|
|
12520
|
+
name: n,
|
|
12521
|
+
filename: "name" in i ? i.name : n
|
|
12522
|
+
}, i));
|
|
12523
|
+
const e = i.stream();
|
|
12524
|
+
yield* streamToSizedAsyncIterable(e, i.size || null, "Invalid Multipart: Part");
|
|
12451
12525
|
} else {
|
|
12452
12526
|
yield t.encode(makeFormHeader({
|
|
12453
|
-
name:
|
|
12527
|
+
name: n
|
|
12454
12528
|
}, void 0));
|
|
12455
|
-
yield "string" == typeof
|
|
12529
|
+
yield "string" == typeof i ? t.encode(i) : i;
|
|
12456
12530
|
}
|
|
12457
12531
|
yield t.encode(u);
|
|
12458
12532
|
}
|
|
12459
12533
|
yield t.encode(h);
|
|
12460
12534
|
}
|
|
12461
12535
|
|
|
12462
|
-
const
|
|
12536
|
+
const m = 512;
|
|
12463
12537
|
|
|
12464
12538
|
function blockPad(e) {
|
|
12465
12539
|
const t = 511 & e;
|
|
12466
|
-
return t &&
|
|
12540
|
+
return t && m - t;
|
|
12467
12541
|
}
|
|
12468
12542
|
|
|
12469
|
-
let
|
|
12543
|
+
let p = function(e) {
|
|
12470
12544
|
e[e.FILE = 48] = "FILE";
|
|
12471
12545
|
e[e.LINK = 49] = "LINK";
|
|
12472
12546
|
e[e.SYMLINK = 50] = "SYMLINK";
|
|
@@ -12482,12 +12556,13 @@ function initTarHeader(e) {
|
|
|
12482
12556
|
gid: e?.gid || 0,
|
|
12483
12557
|
size: e?.size || 0,
|
|
12484
12558
|
mtime: e?.mtime || 0,
|
|
12485
|
-
typeflag: e?.typeflag ||
|
|
12559
|
+
typeflag: e?.typeflag || p.FILE,
|
|
12486
12560
|
linkname: e?.linkname || null,
|
|
12487
12561
|
uname: e?.uname || null,
|
|
12488
12562
|
gname: e?.gname || null,
|
|
12489
12563
|
devmajor: e?.devmajor || 0,
|
|
12490
|
-
devminor: e?.devminor || 0
|
|
12564
|
+
devminor: e?.devminor || 0,
|
|
12565
|
+
_paxSize: e?._paxSize
|
|
12491
12566
|
};
|
|
12492
12567
|
}
|
|
12493
12568
|
|
|
@@ -12503,7 +12578,7 @@ const getTarName = e => {
|
|
|
12503
12578
|
}
|
|
12504
12579
|
};
|
|
12505
12580
|
|
|
12506
|
-
const getTarSize = e => e._paxSize
|
|
12581
|
+
const getTarSize = e => e._paxSize ?? e.size;
|
|
12507
12582
|
|
|
12508
12583
|
class TarChunk extends StreamFile {
|
|
12509
12584
|
constructor(e, t) {
|
|
@@ -12541,7 +12616,7 @@ class TarFile extends StreamFile {
|
|
|
12541
12616
|
this.uid = t.uid;
|
|
12542
12617
|
this.gid = t.gid;
|
|
12543
12618
|
this.mtime = t.mtime;
|
|
12544
|
-
this.typeflag =
|
|
12619
|
+
this.typeflag = p.FILE;
|
|
12545
12620
|
this.linkname = null;
|
|
12546
12621
|
this.uname = t.uname;
|
|
12547
12622
|
this.gname = t.gname;
|
|
@@ -12552,59 +12627,60 @@ class TarFile extends StreamFile {
|
|
|
12552
12627
|
|
|
12553
12628
|
async function decodePax(e, t, i) {
|
|
12554
12629
|
let a = i.size;
|
|
12555
|
-
|
|
12630
|
+
const r = [];
|
|
12556
12631
|
while (a > 0) {
|
|
12557
|
-
|
|
12632
|
+
const t = await e.read();
|
|
12558
12633
|
if (!t || t.byteLength !== e.blockSize) {
|
|
12559
12634
|
throw new Error("Invalid Tar: Unexpected EOF while parsing PAX data");
|
|
12560
12635
|
}
|
|
12561
|
-
a
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12636
|
+
const n = Math.min(a, t.byteLength);
|
|
12637
|
+
r.push(t.slice(0, n));
|
|
12638
|
+
a -= n;
|
|
12639
|
+
}
|
|
12640
|
+
const o = new Uint8Array(i.size);
|
|
12641
|
+
for (let e = 0, t = 0; e < r.length; e++) {
|
|
12642
|
+
o.set(r[e], t);
|
|
12643
|
+
t += r[e].byteLength;
|
|
12568
12644
|
}
|
|
12569
|
-
for (let e = 0,
|
|
12570
|
-
while (
|
|
12571
|
-
|
|
12645
|
+
for (let e = 0, a = 0; e < o.byteLength; a = e) {
|
|
12646
|
+
while (a < o.byteLength && 32 !== o[a]) {
|
|
12647
|
+
a++;
|
|
12572
12648
|
}
|
|
12573
|
-
const
|
|
12574
|
-
if (!
|
|
12649
|
+
const r = parseInt(n.decode(o.subarray(e, a)), 10);
|
|
12650
|
+
if (!r || r != r) {
|
|
12575
12651
|
break;
|
|
12576
12652
|
}
|
|
12577
|
-
if (10 !==
|
|
12653
|
+
if (10 !== o[e + r - 1]) {
|
|
12578
12654
|
break;
|
|
12579
12655
|
}
|
|
12580
|
-
const
|
|
12581
|
-
const
|
|
12582
|
-
if (-1 ===
|
|
12656
|
+
const s = n.decode(o.subarray(a + 1, e + r - 1));
|
|
12657
|
+
const l = s.indexOf("=");
|
|
12658
|
+
if (-1 === l) {
|
|
12583
12659
|
break;
|
|
12584
12660
|
}
|
|
12585
|
-
const
|
|
12586
|
-
const
|
|
12587
|
-
e +=
|
|
12588
|
-
switch (
|
|
12661
|
+
const c = s.slice(0, l);
|
|
12662
|
+
const d = s.slice(l + 1);
|
|
12663
|
+
e += r;
|
|
12664
|
+
switch (c) {
|
|
12589
12665
|
case "path":
|
|
12590
12666
|
if (t) {
|
|
12591
|
-
t._paxName =
|
|
12667
|
+
t._paxName = d;
|
|
12592
12668
|
}
|
|
12593
|
-
i._paxName =
|
|
12669
|
+
i._paxName = d;
|
|
12594
12670
|
break;
|
|
12595
12671
|
|
|
12596
12672
|
case "linkpath":
|
|
12597
12673
|
if (t) {
|
|
12598
|
-
t._paxLinkName =
|
|
12674
|
+
t._paxLinkName = d;
|
|
12599
12675
|
}
|
|
12600
|
-
i._paxLinkName =
|
|
12676
|
+
i._paxLinkName = d;
|
|
12601
12677
|
break;
|
|
12602
12678
|
|
|
12603
12679
|
case "size":
|
|
12604
12680
|
if (t) {
|
|
12605
|
-
t._paxSize = +
|
|
12681
|
+
t._paxSize = +d;
|
|
12606
12682
|
}
|
|
12607
|
-
i._paxSize = +
|
|
12683
|
+
i._paxSize = +d;
|
|
12608
12684
|
break;
|
|
12609
12685
|
|
|
12610
12686
|
case "gid":
|
|
@@ -12612,17 +12688,17 @@ async function decodePax(e, t, i) {
|
|
|
12612
12688
|
case "mode":
|
|
12613
12689
|
case "mtime":
|
|
12614
12690
|
if (t) {
|
|
12615
|
-
t[
|
|
12691
|
+
t[c] = +d;
|
|
12616
12692
|
}
|
|
12617
|
-
i[
|
|
12693
|
+
i[c] = +d;
|
|
12618
12694
|
break;
|
|
12619
12695
|
|
|
12620
12696
|
case "uname":
|
|
12621
12697
|
case "gname":
|
|
12622
12698
|
if (t) {
|
|
12623
|
-
t[
|
|
12699
|
+
t[c] = d;
|
|
12624
12700
|
}
|
|
12625
|
-
i[
|
|
12701
|
+
i[c] = d;
|
|
12626
12702
|
}
|
|
12627
12703
|
}
|
|
12628
12704
|
}
|
|
@@ -12730,7 +12806,7 @@ function decodeBase(e, t) {
|
|
|
12730
12806
|
e._prefix = decodeString(t, 345, 500);
|
|
12731
12807
|
}
|
|
12732
12808
|
if (0 === e.typeflag && e.name.endsWith("/")) {
|
|
12733
|
-
e.typeflag =
|
|
12809
|
+
e.typeflag = p.DIRECTORY;
|
|
12734
12810
|
}
|
|
12735
12811
|
}
|
|
12736
12812
|
|
|
@@ -12765,10 +12841,10 @@ async function decodeHeader(e, t) {
|
|
|
12765
12841
|
|
|
12766
12842
|
case 0:
|
|
12767
12843
|
case 55:
|
|
12768
|
-
case
|
|
12769
|
-
case
|
|
12770
|
-
case
|
|
12771
|
-
case
|
|
12844
|
+
case p.FILE:
|
|
12845
|
+
case p.LINK:
|
|
12846
|
+
case p.SYMLINK:
|
|
12847
|
+
case p.DIRECTORY:
|
|
12772
12848
|
decodeBase(i, n);
|
|
12773
12849
|
return i;
|
|
12774
12850
|
|
|
@@ -12789,79 +12865,91 @@ async function decodeHeader(e, t) {
|
|
|
12789
12865
|
}
|
|
12790
12866
|
|
|
12791
12867
|
async function* untar(e) {
|
|
12792
|
-
const t =
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12800
|
-
|
|
12801
|
-
async cancel() {
|
|
12802
|
-
if (!t) {
|
|
12803
|
-
t = !0;
|
|
12804
|
-
a += e;
|
|
12805
|
-
}
|
|
12806
|
-
if (a > 0) {
|
|
12807
|
-
if (await n.skip(a) > 0) {
|
|
12808
|
-
throw new Error("Invalid Tar: Unexpected EOF");
|
|
12809
|
-
}
|
|
12810
|
-
a = 0;
|
|
12811
|
-
}
|
|
12812
|
-
},
|
|
12813
|
-
async pull(i) {
|
|
12814
|
-
if (a) {
|
|
12815
|
-
const e = await n.pull(a);
|
|
12816
|
-
if (!e) {
|
|
12817
|
-
throw new Error("Invalid Tar: Unexpected EOF");
|
|
12818
|
-
}
|
|
12819
|
-
a -= e.byteLength;
|
|
12820
|
-
i.enqueue(n.blockLocked ? e.slice() : e);
|
|
12868
|
+
const t = new ReadableStreamBlockReader(e, m);
|
|
12869
|
+
try {
|
|
12870
|
+
yield* async function* readTar(e) {
|
|
12871
|
+
const t = initTarHeader(null);
|
|
12872
|
+
let n;
|
|
12873
|
+
while (null != (n = await decodeHeader(e, t))) {
|
|
12874
|
+
const t = n._paxSize ?? n.size;
|
|
12875
|
+
if (!Number.isSafeInteger(t) || t < 0) {
|
|
12876
|
+
throw new Error(`Invalid Tar: Invalid entry size ${t}`);
|
|
12821
12877
|
}
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12878
|
+
const i = blockPad(t);
|
|
12879
|
+
let a = 0 === i;
|
|
12880
|
+
let r = t;
|
|
12881
|
+
const o = createReadableStream({
|
|
12882
|
+
expectedLength: t,
|
|
12883
|
+
async cancel() {
|
|
12884
|
+
if (!a) {
|
|
12885
|
+
r += i;
|
|
12886
|
+
}
|
|
12887
|
+
if (r > 0) {
|
|
12888
|
+
if (await e.skip(r) > 0) {
|
|
12889
|
+
throw new Error("Invalid Tar: Unexpected EOF");
|
|
12890
|
+
}
|
|
12891
|
+
r = 0;
|
|
12892
|
+
}
|
|
12893
|
+
a = !0;
|
|
12894
|
+
},
|
|
12895
|
+
async pull(t) {
|
|
12896
|
+
if (r) {
|
|
12897
|
+
const n = await e.pull(r);
|
|
12898
|
+
if (!n) {
|
|
12899
|
+
throw new Error("Invalid Tar: Unexpected EOF");
|
|
12900
|
+
}
|
|
12901
|
+
r -= n.byteLength;
|
|
12902
|
+
t.enqueue(e.blockLocked ? n.slice() : n);
|
|
12903
|
+
}
|
|
12904
|
+
if (!r) {
|
|
12905
|
+
if (!a) {
|
|
12906
|
+
if (await e.skip(i) > 0) {
|
|
12907
|
+
throw new Error("Invalid Tar: Unexpected EOF");
|
|
12908
|
+
}
|
|
12909
|
+
a = !0;
|
|
12910
|
+
}
|
|
12911
|
+
t.close();
|
|
12827
12912
|
}
|
|
12828
12913
|
}
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
case y.FILE:
|
|
12838
|
-
o = new TarFile(r, i);
|
|
12839
|
-
break;
|
|
12914
|
+
});
|
|
12915
|
+
let s;
|
|
12916
|
+
switch (n.typeflag) {
|
|
12917
|
+
case 0:
|
|
12918
|
+
case 55:
|
|
12919
|
+
case p.FILE:
|
|
12920
|
+
s = new TarFile(o, n);
|
|
12921
|
+
break;
|
|
12840
12922
|
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12923
|
+
case p.LINK:
|
|
12924
|
+
case p.SYMLINK:
|
|
12925
|
+
case p.DIRECTORY:
|
|
12926
|
+
s = new TarChunk(o, n);
|
|
12927
|
+
break;
|
|
12846
12928
|
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12929
|
+
default:
|
|
12930
|
+
await o.cancel();
|
|
12931
|
+
continue;
|
|
12932
|
+
}
|
|
12933
|
+
yield s;
|
|
12934
|
+
if (r > 0 || !a) {
|
|
12935
|
+
await o.cancel();
|
|
12936
|
+
}
|
|
12937
|
+
}
|
|
12938
|
+
}(t);
|
|
12939
|
+
} finally {
|
|
12940
|
+
await t.close();
|
|
12855
12941
|
}
|
|
12856
12942
|
}
|
|
12857
12943
|
|
|
12858
12944
|
const b = 100;
|
|
12859
12945
|
|
|
12860
|
-
const w = new Uint8Array(
|
|
12946
|
+
const w = new Uint8Array(m);
|
|
12947
|
+
|
|
12948
|
+
const g = /[^\x00-\x7f]/;
|
|
12861
12949
|
|
|
12862
12950
|
function encodeString(e, n, i, a) {
|
|
12863
12951
|
if (a) {
|
|
12864
|
-
t.encodeInto(
|
|
12952
|
+
t.encodeInto(a, e.subarray(n, i));
|
|
12865
12953
|
}
|
|
12866
12954
|
}
|
|
12867
12955
|
|
|
@@ -12899,28 +12987,9 @@ function encodeOctal(e, t, n, i) {
|
|
|
12899
12987
|
}
|
|
12900
12988
|
}
|
|
12901
12989
|
|
|
12902
|
-
function indexOfPrefixEnd(e) {
|
|
12903
|
-
if (e.length <= 255) {
|
|
12904
|
-
let t = e.length - 1;
|
|
12905
|
-
while ((t = e.lastIndexOf("/", t - 1)) > -1) {
|
|
12906
|
-
if (t < 155 && e.length - t - 1 < b) {
|
|
12907
|
-
return t;
|
|
12908
|
-
}
|
|
12909
|
-
}
|
|
12910
|
-
}
|
|
12911
|
-
return -1;
|
|
12912
|
-
}
|
|
12913
|
-
|
|
12914
12990
|
function encodeHeader(e) {
|
|
12915
|
-
const t = new Uint8Array(
|
|
12991
|
+
const t = new Uint8Array(m);
|
|
12916
12992
|
!function encodeBase(e, t) {
|
|
12917
|
-
let n = t.name;
|
|
12918
|
-
if (!t._paxName && !t._longName && n.length > b) {
|
|
12919
|
-
const e = indexOfPrefixEnd(n);
|
|
12920
|
-
if (e > -1) {
|
|
12921
|
-
n = n.slice(e + 1);
|
|
12922
|
-
}
|
|
12923
|
-
}
|
|
12924
12993
|
if (!t.typeflag) {
|
|
12925
12994
|
t.typeflag = function modeToType(e) {
|
|
12926
12995
|
switch (61440 & e) {
|
|
@@ -12931,26 +13000,26 @@ function encodeHeader(e) {
|
|
|
12931
13000
|
return 51;
|
|
12932
13001
|
|
|
12933
13002
|
case 16384:
|
|
12934
|
-
return
|
|
13003
|
+
return p.DIRECTORY;
|
|
12935
13004
|
|
|
12936
13005
|
case 4096:
|
|
12937
13006
|
return 54;
|
|
12938
13007
|
|
|
12939
13008
|
case 40960:
|
|
12940
|
-
return
|
|
13009
|
+
return p.SYMLINK;
|
|
12941
13010
|
|
|
12942
13011
|
default:
|
|
12943
|
-
return
|
|
13012
|
+
return p.FILE;
|
|
12944
13013
|
}
|
|
12945
13014
|
}(t.mode);
|
|
12946
13015
|
}
|
|
12947
13016
|
if (!t.mode) {
|
|
12948
|
-
t.mode = t.typeflag ===
|
|
13017
|
+
t.mode = t.typeflag === p.DIRECTORY ? 493 : 420;
|
|
12949
13018
|
}
|
|
12950
13019
|
if (!t.mtime) {
|
|
12951
13020
|
t.mtime = Math.floor(Date.now() / 1e3);
|
|
12952
13021
|
}
|
|
12953
|
-
encodeString(e, 0, 100,
|
|
13022
|
+
encodeString(e, 0, 100, t.name);
|
|
12954
13023
|
encodeOctal(e, 100, 108, 4095 & t.mode);
|
|
12955
13024
|
encodeOctal(e, 108, 116, t.uid);
|
|
12956
13025
|
encodeOctal(e, 116, 124, t.gid);
|
|
@@ -12979,15 +13048,15 @@ function encodeHeader(e) {
|
|
|
12979
13048
|
}
|
|
12980
13049
|
|
|
12981
13050
|
function encodePax(e) {
|
|
12982
|
-
function encodePaxEntry(e,
|
|
12983
|
-
const
|
|
12984
|
-
let
|
|
12985
|
-
const
|
|
12986
|
-
|
|
12987
|
-
if (1 + Math.floor(Math.log10(
|
|
12988
|
-
|
|
13051
|
+
function encodePaxEntry(e, n) {
|
|
13052
|
+
const i = ` ${e}=${n}\n`;
|
|
13053
|
+
let a = t.encode(i).byteLength;
|
|
13054
|
+
const r = `${a}`;
|
|
13055
|
+
a += r.length;
|
|
13056
|
+
if (1 + Math.floor(Math.log10(a)) > r.length) {
|
|
13057
|
+
a += 1;
|
|
12989
13058
|
}
|
|
12990
|
-
return `${
|
|
13059
|
+
return `${a}${i}`;
|
|
12991
13060
|
}
|
|
12992
13061
|
let n = "";
|
|
12993
13062
|
if (e._paxName) {
|
|
@@ -12999,64 +13068,84 @@ function encodePax(e) {
|
|
|
12999
13068
|
return n ? t.encode(n) : null;
|
|
13000
13069
|
}
|
|
13001
13070
|
|
|
13002
|
-
function
|
|
13003
|
-
|
|
13004
|
-
|
|
13071
|
+
function truncateHeaderString(e) {
|
|
13072
|
+
let t = 99;
|
|
13073
|
+
while (128 == (192 & e[t])) {
|
|
13074
|
+
t--;
|
|
13075
|
+
}
|
|
13076
|
+
return n.decode(e.subarray(0, t));
|
|
13005
13077
|
}
|
|
13006
13078
|
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
t
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
const e = indexOfPrefixEnd(t.name);
|
|
13026
|
-
if (e > -1) {
|
|
13027
|
-
t._prefix = t.name.slice(0, e);
|
|
13028
|
-
t.name = t.name.slice(e + 1);
|
|
13079
|
+
function prepareHeaderStrings(e) {
|
|
13080
|
+
if (e.name.length > 33 && (e.name.length > b || g.test(e.name))) {
|
|
13081
|
+
const i = t.encode(e.name);
|
|
13082
|
+
if (i.byteLength > b) {
|
|
13083
|
+
const t = function indexOfPrefixEnd(e) {
|
|
13084
|
+
if (e.byteLength <= 255) {
|
|
13085
|
+
let t = e.byteLength;
|
|
13086
|
+
while ((t = e.lastIndexOf(47, t - 1)) > 0) {
|
|
13087
|
+
if (t < 155 && e.byteLength - t - 1 < b) {
|
|
13088
|
+
return t;
|
|
13089
|
+
}
|
|
13090
|
+
}
|
|
13091
|
+
}
|
|
13092
|
+
return -1;
|
|
13093
|
+
}(i);
|
|
13094
|
+
if (t > -1) {
|
|
13095
|
+
e._prefix = n.decode(i.subarray(0, t));
|
|
13096
|
+
e.name = n.decode(i.subarray(t + 1));
|
|
13029
13097
|
} else {
|
|
13030
|
-
|
|
13031
|
-
|
|
13098
|
+
e._paxName = e.name;
|
|
13099
|
+
e.name = truncateHeaderString(i);
|
|
13032
13100
|
}
|
|
13033
13101
|
}
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13102
|
+
}
|
|
13103
|
+
if (e.linkname && e.linkname.length > 33 && (e.linkname.length > b || g.test(e.linkname))) {
|
|
13104
|
+
const n = t.encode(e.linkname);
|
|
13105
|
+
if (n.byteLength > b) {
|
|
13106
|
+
e._paxLinkName = e.linkname;
|
|
13107
|
+
e.linkname = truncateHeaderString(n);
|
|
13037
13108
|
}
|
|
13038
|
-
|
|
13039
|
-
|
|
13109
|
+
}
|
|
13110
|
+
}
|
|
13111
|
+
|
|
13112
|
+
async function* tar(e) {
|
|
13113
|
+
for await (const t of streamLikeToIterator(e)) {
|
|
13114
|
+
const e = initTarHeader(t);
|
|
13115
|
+
if (!Number.isSafeInteger(e.size) || e.size < 0) {
|
|
13116
|
+
throw new Error(`Invalid Tar: Cannot safely encode part with size ${e.size}`);
|
|
13117
|
+
}
|
|
13118
|
+
if (t.lastModified && !e.mtime) {
|
|
13119
|
+
e.mtime = Math.floor(t.lastModified / 1e3);
|
|
13120
|
+
}
|
|
13121
|
+
if (e.typeflag === p.DIRECTORY && !e.name.endsWith("/")) {
|
|
13122
|
+
e.name += "/";
|
|
13123
|
+
} else if (e.typeflag === p.SYMLINK) {
|
|
13124
|
+
e.size = 0;
|
|
13125
|
+
}
|
|
13126
|
+
prepareHeaderStrings(e);
|
|
13127
|
+
const n = encodePax(e);
|
|
13128
|
+
if (n) {
|
|
13040
13129
|
const e = initTarHeader(null);
|
|
13041
13130
|
e.typeflag = 120;
|
|
13042
|
-
e.size =
|
|
13131
|
+
e.size = n.byteLength;
|
|
13043
13132
|
yield encodeHeader(e);
|
|
13044
|
-
yield
|
|
13045
|
-
const t = blockPad(
|
|
13133
|
+
yield n;
|
|
13134
|
+
const t = blockPad(n.byteLength);
|
|
13046
13135
|
if (t) {
|
|
13047
13136
|
yield w.subarray(0, t);
|
|
13048
13137
|
}
|
|
13049
13138
|
}
|
|
13050
|
-
yield encodeHeader(
|
|
13051
|
-
const
|
|
13052
|
-
if (
|
|
13053
|
-
yield*
|
|
13054
|
-
} else if (!
|
|
13055
|
-
await
|
|
13139
|
+
yield encodeHeader(e);
|
|
13140
|
+
const i = t.stream();
|
|
13141
|
+
if (e.size) {
|
|
13142
|
+
yield* streamToSizedAsyncIterable(i, e.size, "Invalid Tar: Entry");
|
|
13143
|
+
} else if (!i.locked) {
|
|
13144
|
+
await i.cancel();
|
|
13056
13145
|
}
|
|
13057
|
-
const
|
|
13058
|
-
if (
|
|
13059
|
-
yield w.subarray(0,
|
|
13146
|
+
const a = blockPad(e.size);
|
|
13147
|
+
if (a) {
|
|
13148
|
+
yield w.subarray(0, a);
|
|
13060
13149
|
}
|
|
13061
13150
|
}
|
|
13062
13151
|
yield new Uint8Array(1024);
|