@poe-platform/safe-bash 0.1.627 → 0.1.628
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/safe-bash/commands/archive/zip/line-endings.d.ts +2 -0
- package/dist/safe-bash/commands/archive/zip/line-endings.d.ts.map +1 -0
- package/dist/safe-bash/commands/archive/zip/line-endings.js +37 -0
- package/dist/safe-bash/commands/archive/zip/line-endings.js.map +1 -0
- package/dist/safe-bash/commands/archive/zip/options.js +2 -2
- package/dist/safe-bash/commands/archive/zip/options.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip-format.js +13 -0
- package/dist/safe-bash/commands/archive/zip-format.js.map +1 -1
- package/dist/safe-bash/commands/archive/zip.d.ts.map +1 -1
- package/dist/safe-bash/commands/archive/zip.js +14 -2
- package/dist/safe-bash/commands/archive/zip.js.map +1 -1
- package/dist/safe-bash/core.browser.js +51 -4
- package/dist/safe-bash/core.browser.js.map +4 -4
- package/package.json +2 -2
|
@@ -26612,6 +26612,34 @@ async function readArchive(context2, source2, options2, budget) {
|
|
|
26612
26612
|
// packages/safe-bash/src/commands/archive/zip.ts
|
|
26613
26613
|
init_platform();
|
|
26614
26614
|
|
|
26615
|
+
// packages/safe-bash/src/commands/archive/zip/line-endings.ts
|
|
26616
|
+
init_platform();
|
|
26617
|
+
async function zipToCrlf(bytes3, store, maxBytes, signal) {
|
|
26618
|
+
signal.throwIfAborted();
|
|
26619
|
+
let text3 = false;
|
|
26620
|
+
for (let index = 0; index < Math.min(bytes3.length, store ? 8192 : 32768); index++) {
|
|
26621
|
+
const byte = bytes3[index];
|
|
26622
|
+
if (byte <= 6 || byte >= 14 && byte <= 25 || byte >= 28 && byte <= 31) return bytes3;
|
|
26623
|
+
if (byte >= 32) text3 = true;
|
|
26624
|
+
}
|
|
26625
|
+
if (!text3) return bytes3;
|
|
26626
|
+
let size = bytes3.length;
|
|
26627
|
+
for (let index = 0; index < bytes3.length; index++) {
|
|
26628
|
+
if (index % 32768 === 0) await yieldTurn(signal);
|
|
26629
|
+
if (bytes3[index] === 10 && ++size > maxBytes) fail("converted payload byte limit exceeded");
|
|
26630
|
+
}
|
|
26631
|
+
if (size === bytes3.length) return bytes3;
|
|
26632
|
+
const output2 = new Uint8Array(size);
|
|
26633
|
+
let offset = 0;
|
|
26634
|
+
for (let index = 0; index < bytes3.length; index++) {
|
|
26635
|
+
if (index % 32768 === 0) await yieldTurn(signal);
|
|
26636
|
+
const byte = bytes3[index];
|
|
26637
|
+
if (byte === 10) output2[offset++] = 13;
|
|
26638
|
+
output2[offset++] = byte;
|
|
26639
|
+
}
|
|
26640
|
+
return output2;
|
|
26641
|
+
}
|
|
26642
|
+
|
|
26615
26643
|
// packages/safe-bash/src/commands/archive/zip/dates.ts
|
|
26616
26644
|
init_platform();
|
|
26617
26645
|
|
|
@@ -26640,6 +26668,7 @@ var longOptions = {
|
|
|
26640
26668
|
"archive-comment": "z",
|
|
26641
26669
|
"entry-comments": "c",
|
|
26642
26670
|
"latest-time": "o",
|
|
26671
|
+
"to-crlf": "l",
|
|
26643
26672
|
delete: "d",
|
|
26644
26673
|
include: "i",
|
|
26645
26674
|
exclude: "x",
|
|
@@ -26687,7 +26716,6 @@ var reservedOptions = [
|
|
|
26687
26716
|
"more-help",
|
|
26688
26717
|
"junk-sfx",
|
|
26689
26718
|
"DOS-names",
|
|
26690
|
-
"to-crlf",
|
|
26691
26719
|
"from-crlf",
|
|
26692
26720
|
"logfile-path",
|
|
26693
26721
|
"log-append",
|
|
@@ -27297,10 +27325,20 @@ async function makeZipEntry(name2, bytes3, attributes, limits, signal, level = 6
|
|
|
27297
27325
|
const chunkSize2 = admit(limits, signal);
|
|
27298
27326
|
const entry = { name: name2, data: bytes3, size: bytes3.length, method: 0, crc32: 0, ...attributes, modified: new Date(attributes.modified.getTime()) };
|
|
27299
27327
|
entryBounds(entry, limits);
|
|
27328
|
+
let textual = false;
|
|
27329
|
+
let binary2 = false;
|
|
27300
27330
|
for (let offset = 0; offset < bytes3.length; offset += chunkSize2) {
|
|
27331
|
+
if (level !== 0 && !entry.directory && !entry.symlink) {
|
|
27332
|
+
for (let index = offset; index < Math.min(bytes3.length, offset + chunkSize2); index++) {
|
|
27333
|
+
const byte = bytes3[index];
|
|
27334
|
+
if (byte <= 6 || byte >= 14 && byte <= 25 || byte >= 28 && byte <= 31) binary2 = true;
|
|
27335
|
+
else if (byte === 9 || byte === 10 || byte === 13 || byte >= 32) textual = true;
|
|
27336
|
+
}
|
|
27337
|
+
}
|
|
27301
27338
|
entry.crc32 = crc322(bytes3.subarray(offset, offset + chunkSize2), entry.crc32);
|
|
27302
27339
|
await yieldTurn(signal);
|
|
27303
27340
|
}
|
|
27341
|
+
if (level !== 0 && !entry.directory && !entry.symlink) entry.internalAttributes = !binary2 && textual ? 1 : 0;
|
|
27304
27342
|
const reader = new CodecReader((async function* () {
|
|
27305
27343
|
yield bytes3;
|
|
27306
27344
|
})(), signal);
|
|
@@ -27955,6 +27993,7 @@ async function parse12(scope, limits) {
|
|
|
27955
27993
|
let archiveComment = false;
|
|
27956
27994
|
let entryComments = false;
|
|
27957
27995
|
let latestTime = false;
|
|
27996
|
+
let toCrlf = false;
|
|
27958
27997
|
let fromDate;
|
|
27959
27998
|
let beforeDate;
|
|
27960
27999
|
let descriptors = false;
|
|
@@ -28011,7 +28050,10 @@ async function parse12(scope, limits) {
|
|
|
28011
28050
|
else if (flag === "z") archiveComment = true;
|
|
28012
28051
|
else if (flag === "c") entryComments = true;
|
|
28013
28052
|
else if (flag === "o") latestTime = true;
|
|
28014
|
-
else if (flag === "
|
|
28053
|
+
else if (flag === "l") {
|
|
28054
|
+
if (argument2[offset + 1] === "l") throw new ZipFailure(16, "Invalid command arguments", `unsupported option: ${argument2}`);
|
|
28055
|
+
toCrlf = true;
|
|
28056
|
+
} else if (flag === "j") junkPaths = true;
|
|
28015
28057
|
else if (flag === "X") {
|
|
28016
28058
|
metadata3 = argument2[offset + 1] === "-" ? "all" : "strip";
|
|
28017
28059
|
if (metadata3 === "all") offset++;
|
|
@@ -28129,7 +28171,7 @@ async function parse12(scope, limits) {
|
|
|
28129
28171
|
}
|
|
28130
28172
|
if (recursivePatterns && !names.length && !operands.length) throw new ZipFailure(16, "Invalid command arguments", "nothing to select from");
|
|
28131
28173
|
if (filesync && action !== "add") throw new ZipFailure(16, "Invalid command arguments", "can't use -d, -f, -u, -U, or -g with filesync -FS\n");
|
|
28132
|
-
return { args, action, archive, output: output2, recursive, recursivePatterns, noWild, stopAtDirectories, quiet, junkPaths, omitDirectories, storeLinks, test, mustMatch, filesync, archiveComment, entryComments, latestTime, fromDate, beforeDate, descriptors, zip64, metadata: metadata3, includes, excludes, level, method, suffixes, operands: [...names, ...operands], firstOperand };
|
|
28174
|
+
return { args, action, archive, output: output2, recursive, recursivePatterns, noWild, stopAtDirectories, quiet, junkPaths, omitDirectories, storeLinks, test, mustMatch, filesync, archiveComment, entryComments, latestTime, toCrlf, fromDate, beforeDate, descriptors, zip64, metadata: metadata3, includes, excludes, level, method, suffixes, operands: [...names, ...operands], firstOperand };
|
|
28133
28175
|
}
|
|
28134
28176
|
function memberName(path, limits) {
|
|
28135
28177
|
if (path.startsWith("//") && !path.startsWith("///")) fail("UNC source paths are unsupported");
|
|
@@ -28236,6 +28278,11 @@ async function prepare(scope, parsed, budget) {
|
|
|
28236
28278
|
const encodeSelected = async (source2, name2, bytes4, attributes) => {
|
|
28237
28279
|
const store = parsed.method === "store" || parsed.level !== 9 && parsed.suffixes.some((suffix2) => name2.endsWith(suffix2));
|
|
28238
28280
|
if (!store && parsed.level === 0 && bytes4.length && !attributes.directory && !attributes.symlink) throw new ZipFailure(5, "Internal logic error", "bad pack level");
|
|
28281
|
+
if (parsed.toCrlf && !attributes.directory && !attributes.symlink) {
|
|
28282
|
+
const originalSize = bytes4.length;
|
|
28283
|
+
bytes4 = await zipToCrlf(bytes4, store, Math.min(limits.maxEntryBytes, limits.maxTotalBytes - budget.totalBytes + originalSize), context2.signal);
|
|
28284
|
+
budget.totalBytes += bytes4.length - originalSize;
|
|
28285
|
+
}
|
|
28239
28286
|
const level = store ? 0 : parsed.level;
|
|
28240
28287
|
let entry = await makeZipEntry(name2, bytes4, attributes, limits, context2.signal, level, !store && (parsed.archive === "-" || parsed.descriptors && bytes4.length > 0));
|
|
28241
28288
|
if (parsed.descriptors) entry.descriptors = true;
|
|
@@ -28512,7 +28559,7 @@ async function prepare(scope, parsed, budget) {
|
|
|
28512
28559
|
else publication = { ...publication, mtimeMs };
|
|
28513
28560
|
}
|
|
28514
28561
|
const bytes3 = originalBytes && !changed && !editComment && !editEntries ? originalBytes : await writeZipArchive({ entries: entries2, comment: comment2 }, limits, context2.signal, false, parsed.zip64 === true);
|
|
28515
|
-
if (parsed.test && parsed.archive !== "-") {
|
|
28562
|
+
if (parsed.test && parsed.archive !== "-" && !(parsed.filesync && !changed)) {
|
|
28516
28563
|
for (const message3 of progress) await budget.output(message3);
|
|
28517
28564
|
progress.length = 0;
|
|
28518
28565
|
progressBytes = 0;
|