@poe-platform/safe-bash 0.1.760 → 0.1.762
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/image-ast/index.browser.js +117 -13
- package/dist/image-ast/index.js +117 -13
- package/dist/pdf-ast/index.js +121 -13
- package/dist/safe-bash/command-chunks/{chunk-MC4XXPQJ.js → chunk-D4GXXV65.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UCI6ZQFB.js → chunk-F7MJRXQ2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-S3SCPBHC.js → chunk-P3Q2QSCA.js} +125 -13
- package/dist/safe-bash/commands/csvcut/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvcut/index.js +3 -1
- package/dist/safe-bash/commands/csvgrep/index.d.ts +1 -1
- package/dist/safe-bash/commands/csvgrep/index.js +3 -1
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/htmlq/index.js +4 -1
- package/dist/safe-bash/core.browser.js +10 -7
- package/dist/safe-bash/shell/runtime.js +5 -5
- package/dist/safe-bash-command-ffmpeg/index.js +1457 -1390
- package/dist/safe-bash-command-git/LICENSE +21 -0
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +117 -13
- package/dist/safe-bash-command-pdfinfo/index.js +117 -13
- package/dist/safe-bash-command-pdftk/index.js +117 -13
- package/dist/safe-bash-command-pdftoppm/index.js +117 -13
- package/dist/safe-bash-command-pdftotext/index.js +117 -13
- package/dist/safe-bash-command-qpdf/index.js +117 -13
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +117 -13
- package/dist/safe-bash-command-wkhtmltopdf/index.js +117 -13
- package/package.json +2 -2
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +32 -0
- package/third-party/pdf-ast/licenses/AGG-2.3.txt +7 -0
- package/third-party/pdf-ast/licenses/MIT.txt +21 -0
|
@@ -33965,6 +33965,88 @@ function formatExtractedPageText(page, options = {}) {
|
|
|
33965
33965
|
|
|
33966
33966
|
// packages/pdf-ast/src/render/raster.ts
|
|
33967
33967
|
init_buffer();
|
|
33968
|
+
|
|
33969
|
+
// packages/pdf-ast/src/render/cubic.ts
|
|
33970
|
+
init_buffer();
|
|
33971
|
+
function flattenCubic(x1, y1, x2, y2, x3, y3, x4, y4) {
|
|
33972
|
+
const points = [[x1, y1]];
|
|
33973
|
+
const subdivide = (ax, ay, bx, by, cx, cy, dx, dy, level) => {
|
|
33974
|
+
if (level > 16) return;
|
|
33975
|
+
const abx = (ax + bx) / 2, aby = (ay + by) / 2;
|
|
33976
|
+
const bcx = (bx + cx) / 2, bcy = (by + cy) / 2;
|
|
33977
|
+
const cdx = (cx + dx) / 2, cdy = (cy + dy) / 2;
|
|
33978
|
+
const abcx = (abx + bcx) / 2, abcy = (aby + bcy) / 2;
|
|
33979
|
+
const bcdx = (bcx + cdx) / 2, bcdy = (bcy + cdy) / 2;
|
|
33980
|
+
const midx = (abcx + bcdx) / 2, midy = (abcy + bcdy) / 2;
|
|
33981
|
+
const chordX = dx - ax, chordY = dy - ay;
|
|
33982
|
+
const d2 = Math.abs((bx - dx) * chordY - (by - dy) * chordX);
|
|
33983
|
+
const d3 = Math.abs((cx - dx) * chordY - (cy - dy) * chordX);
|
|
33984
|
+
const significant2 = d2 > 1e-30, significant3 = d3 > 1e-30;
|
|
33985
|
+
if (!significant2 && !significant3) {
|
|
33986
|
+
if (Math.abs(ax + cx - 2 * bx) + Math.abs(ay + cy - 2 * by) + Math.abs(bx + dx - 2 * cx) + Math.abs(by + dy - 2 * cy) <= 4) {
|
|
33987
|
+
points.push([midx, midy]);
|
|
33988
|
+
return;
|
|
33989
|
+
}
|
|
33990
|
+
} else {
|
|
33991
|
+
const distance = (significant2 ? d2 : 0) + (significant3 ? d3 : 0);
|
|
33992
|
+
if (distance * distance <= 0.25 * (chordX * chordX + chordY * chordY)) {
|
|
33993
|
+
points.push([bcx, bcy]);
|
|
33994
|
+
return;
|
|
33995
|
+
}
|
|
33996
|
+
}
|
|
33997
|
+
subdivide(ax, ay, abx, aby, abcx, abcy, midx, midy, level + 1);
|
|
33998
|
+
subdivide(midx, midy, bcdx, bcdy, cdx, cdy, dx, dy, level + 1);
|
|
33999
|
+
};
|
|
34000
|
+
subdivide(x1, y1, x2, y2, x3, y3, x4, y4, 0);
|
|
34001
|
+
points.push([x4, y4]);
|
|
34002
|
+
return points;
|
|
34003
|
+
}
|
|
34004
|
+
|
|
34005
|
+
// packages/pdf-ast/src/render/image-sampling.ts
|
|
34006
|
+
init_buffer();
|
|
34007
|
+
function sampleImageLinear(image, x, y, out) {
|
|
34008
|
+
x = Math.max(0, Math.min(image.width - 1, x));
|
|
34009
|
+
y = Math.max(0, Math.min(image.height - 1, y));
|
|
34010
|
+
const x0 = Math.floor(x), y0 = Math.floor(y);
|
|
34011
|
+
const fx = x - x0, fy = y - y0;
|
|
34012
|
+
out.fill(0);
|
|
34013
|
+
for (let j = 0; j < 2; j++) {
|
|
34014
|
+
for (let i = 0; i < 2; i++) {
|
|
34015
|
+
const offset = (Math.min(image.height - 1, y0 + j) * image.width + Math.min(image.width - 1, x0 + i)) * 4;
|
|
34016
|
+
const alpha = image.data[offset + 3] * (i ? fx : 1 - fx) * (j ? fy : 1 - fy);
|
|
34017
|
+
out[0] = out[0] + image.data[offset] * alpha;
|
|
34018
|
+
out[1] = out[1] + image.data[offset + 1] * alpha;
|
|
34019
|
+
out[2] = out[2] + image.data[offset + 2] * alpha;
|
|
34020
|
+
out[3] = out[3] + alpha;
|
|
34021
|
+
}
|
|
34022
|
+
}
|
|
34023
|
+
if (out[3] > 0) {
|
|
34024
|
+
out[0] = out[0] / out[3];
|
|
34025
|
+
out[1] = out[1] / out[3];
|
|
34026
|
+
out[2] = out[2] / out[3];
|
|
34027
|
+
}
|
|
34028
|
+
}
|
|
34029
|
+
function downscaleImage(image, widthScale, heightScale) {
|
|
34030
|
+
const sample = new Float64Array(4);
|
|
34031
|
+
while (widthScale > 2 && image.width > 1 || heightScale > 2 && image.height > 1) {
|
|
34032
|
+
const width = widthScale > 2 ? Math.ceil(image.width / 2) : image.width;
|
|
34033
|
+
const height = heightScale > 2 ? Math.ceil(image.height / 2) : image.height;
|
|
34034
|
+
const data = new Uint8Array(width * height * 4);
|
|
34035
|
+
for (let y = 0; y < height; y++) {
|
|
34036
|
+
for (let x = 0; x < width; x++) {
|
|
34037
|
+
sampleImageLinear(image, (x + 0.5) * image.width / width - 0.5, (y + 0.5) * image.height / height - 0.5, sample);
|
|
34038
|
+
const offset = (y * width + x) * 4;
|
|
34039
|
+
for (let c = 0; c < 4; c++) data[offset + c] = Math.round(sample[c]);
|
|
34040
|
+
}
|
|
34041
|
+
}
|
|
34042
|
+
widthScale /= image.width / width;
|
|
34043
|
+
heightScale /= image.height / height;
|
|
34044
|
+
image = { width, height, data };
|
|
34045
|
+
}
|
|
34046
|
+
return image;
|
|
34047
|
+
}
|
|
34048
|
+
|
|
34049
|
+
// packages/pdf-ast/src/render/raster.ts
|
|
33968
34050
|
function encodePng(bitmap) {
|
|
33969
34051
|
return encodeRgbaToPng(bitmap.width, bitmap.height, bitmap.data);
|
|
33970
34052
|
}
|
|
@@ -34731,14 +34813,11 @@ function segmentsToScreenEdges(segments, pageHeight, scale, closeSubpaths = fals
|
|
|
34731
34813
|
const [p1x, p1y] = toScreen(seg.x1, seg.y1);
|
|
34732
34814
|
const [p2x, p2y] = toScreen(seg.x2, seg.y2);
|
|
34733
34815
|
const [p3x, p3y] = toScreen(seg.x, seg.y);
|
|
34734
|
-
const
|
|
34816
|
+
const points = flattenCubic(curX, curY, p1x, p1y, p2x, p2y, p3x, p3y);
|
|
34735
34817
|
let px = curX;
|
|
34736
34818
|
let py = curY;
|
|
34737
|
-
for (let
|
|
34738
|
-
const
|
|
34739
|
-
const mt = 1 - t;
|
|
34740
|
-
const qx = mt * mt * mt * curX + 3 * mt * mt * t * p1x + 3 * mt * t * t * p2x + t * t * t * p3x;
|
|
34741
|
-
const qy = mt * mt * mt * curY + 3 * mt * mt * t * p1y + 3 * mt * t * t * p2y + t * t * t * p3y;
|
|
34819
|
+
for (let i = 1; i < points.length; i++) {
|
|
34820
|
+
const [qx, qy] = points[i];
|
|
34742
34821
|
edges.push({ x0: px, y0: py, x1: qx, y1: qy });
|
|
34743
34822
|
px = qx;
|
|
34744
34823
|
py = qy;
|
|
@@ -35023,6 +35102,17 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35023
35102
|
const maxPx = Math.min(width - 1, clipMaxPx, Math.ceil(Math.max(...cornersPx)) - 1);
|
|
35024
35103
|
const minPy = Math.max(0, clipMinPy, Math.floor(Math.min(...cornersPy)));
|
|
35025
35104
|
const maxPy = Math.min(height - 1, clipMaxPy, Math.ceil(Math.max(...cornersPy)) - 1);
|
|
35105
|
+
if (minPx > maxPx || minPy > maxPy) continue;
|
|
35106
|
+
const source = downscaleImage(
|
|
35107
|
+
{ width: img.width, height: img.height, data: img.decodedRgba },
|
|
35108
|
+
Math.hypot(d, c) * img.width / Math.abs(det * scale),
|
|
35109
|
+
Math.hypot(b, a) * img.height / Math.abs(det * scale)
|
|
35110
|
+
);
|
|
35111
|
+
const ax = a * scale / img.width, ay = b * scale / img.width;
|
|
35112
|
+
const bx = c * scale / img.height, by = d * scale / img.height;
|
|
35113
|
+
const s1 = ax * ax + ay * ay, s2 = bx * bx + by * by, cross = ax * bx + ay * by;
|
|
35114
|
+
const smooth = Math.fround((s1 + s2 + Math.hypot(s1 - s2, 2 * cross)) / 2) <= 1;
|
|
35115
|
+
const sample = new Float64Array(4);
|
|
35026
35116
|
for (let py = minPy; py <= maxPy; py++) {
|
|
35027
35117
|
const yPdf = displayList.height - (py + 0.5) / scale;
|
|
35028
35118
|
if (img.clipRect && (yPdf < img.clipRect[1] || yPdf > img.clipRect[3])) continue;
|
|
@@ -35034,9 +35124,14 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35034
35124
|
const u = (d * dxPdf - c * dyPdf) / det;
|
|
35035
35125
|
const v = (-b * dxPdf + a * dyPdf) / det;
|
|
35036
35126
|
if (u < 0 || u > 1 || v < 0 || v > 1) continue;
|
|
35037
|
-
|
|
35038
|
-
|
|
35039
|
-
|
|
35127
|
+
if (smooth) {
|
|
35128
|
+
sampleImageLinear(source, u * source.width - 0.5, (1 - v) * source.height - 0.5, sample);
|
|
35129
|
+
} else {
|
|
35130
|
+
const sx = Math.min(source.width - 1, Math.max(0, Math.floor(u * source.width)));
|
|
35131
|
+
const sy = Math.min(source.height - 1, Math.max(0, Math.floor((1 - v) * source.height)));
|
|
35132
|
+
const sIdx = (sy * source.width + sx) * 4;
|
|
35133
|
+
for (let c2 = 0; c2 < 4; c2++) sample[c2] = source.data[sIdx + c2];
|
|
35134
|
+
}
|
|
35040
35135
|
blendPixel(
|
|
35041
35136
|
rgba,
|
|
35042
35137
|
width,
|
|
@@ -35044,11 +35139,11 @@ function renderDisplayListToBitmap(displayList, options = {}) {
|
|
|
35044
35139
|
px,
|
|
35045
35140
|
py,
|
|
35046
35141
|
{
|
|
35047
|
-
r:
|
|
35048
|
-
g:
|
|
35049
|
-
b:
|
|
35142
|
+
r: sample[0] / 255,
|
|
35143
|
+
g: sample[1] / 255,
|
|
35144
|
+
b: sample[2] / 255
|
|
35050
35145
|
},
|
|
35051
|
-
|
|
35146
|
+
sample[3] / 255,
|
|
35052
35147
|
img.blendMode,
|
|
35053
35148
|
clipMask
|
|
35054
35149
|
);
|
|
@@ -37231,3 +37326,20 @@ export {
|
|
|
37231
37326
|
* Copyright 2017 Mozilla Foundation. Licensed under Apache-2.0.
|
|
37232
37327
|
* See licenses/PDFJS-APACHE-2.0.txt and THIRD_PARTY_NOTICES.md.
|
|
37233
37328
|
*/
|
|
37329
|
+
/*!
|
|
37330
|
+
* Anti-Grain Geometry - Version 2.3
|
|
37331
|
+
* Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
|
|
37332
|
+
*
|
|
37333
|
+
* Permission to copy, use, modify, sell and distribute this software
|
|
37334
|
+
* is granted provided this copyright notice appears in all copies.
|
|
37335
|
+
* This software is provided "as is" without express or implied
|
|
37336
|
+
* warranty, and with no claim as to its suitability for any purpose.
|
|
37337
|
+
*
|
|
37338
|
+
* Adapted from PDFium third_party/agg23/agg_curves.cpp, curve4_div.
|
|
37339
|
+
* See THIRD_PARTY_NOTICES.md for the pinned revision and adaptations.
|
|
37340
|
+
*/
|
|
37341
|
+
/*!
|
|
37342
|
+
* Staged image reduction adapted from Mozilla PDF.js CanvasGraphics._scaleImage.
|
|
37343
|
+
* Copyright 2012 Mozilla Foundation. Licensed under Apache-2.0.
|
|
37344
|
+
* See THIRD_PARTY_NOTICES.md for the source revision and adaptations.
|
|
37345
|
+
*/
|
|
@@ -5,5 +5,5 @@ export declare function createCsvcutCommand(options?: CsvcutCommandOptions): Com
|
|
|
5
5
|
export declare const csvcutCommand: CommandDefinition;
|
|
6
6
|
export declare function createCsvcutCommands(options?: CsvcutCommandsOptions): readonly CommandDefinition[];
|
|
7
7
|
export declare function csvcutCommands(options?: CsvcutCommandsOptions): VirtualShellPlugin;
|
|
8
|
-
export declare function evalSyncCsvcut(inBytes: Uint8Array, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
8
|
+
export declare function evalSyncCsvcut(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -31,7 +31,7 @@ export function csvcutCommands(options = {}) {
|
|
|
31
31
|
let _syncAbortSignal;
|
|
32
32
|
const syncAbortSignal = () => (_syncAbortSignal ??= new AbortController().signal);
|
|
33
33
|
export function evalSyncCsvcut(inBytes, opArgs, readFileSync) {
|
|
34
|
-
if (inBytes.byteLength > 16384)
|
|
34
|
+
if (inBytes !== undefined && inBytes.byteLength > 16384)
|
|
35
35
|
return undefined;
|
|
36
36
|
const budget = new CsvBudget({}, syncAbortSignal());
|
|
37
37
|
try {
|
|
@@ -55,6 +55,8 @@ export function evalSyncCsvcut(inBytes, opArgs, readFileSync) {
|
|
|
55
55
|
const dialect = { ...supplied.dialect, profile: supplied.dialect?.profile ?? "utf8-sig-permissive-v1" };
|
|
56
56
|
if (Number.isSafeInteger(dialect.skipLines) && dialect.skipLines < 0)
|
|
57
57
|
dialect.skipLines = 0;
|
|
58
|
+
if (sourceBytes === undefined)
|
|
59
|
+
return undefined;
|
|
58
60
|
const parser = new CsvParser(dialect, budget);
|
|
59
61
|
const rows = [...parser.push(sourceBytes), ...parser.end()];
|
|
60
62
|
const first = rows[0];
|
|
@@ -5,5 +5,5 @@ export declare function createCsvgrepCommand(options?: CsvgrepCommandOptions): C
|
|
|
5
5
|
export declare const csvgrepCommand: CommandDefinition;
|
|
6
6
|
export declare function createCsvgrepCommands(options?: CsvgrepCommandsOptions): readonly CommandDefinition[];
|
|
7
7
|
export declare function csvgrepCommands(options?: CsvgrepCommandsOptions): VirtualShellPlugin;
|
|
8
|
-
export declare function evalSyncCsvgrep(inBytes: Uint8Array, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
8
|
+
export declare function evalSyncCsvgrep(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined): string | undefined;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -31,7 +31,7 @@ export function csvgrepCommands(options = {}) {
|
|
|
31
31
|
let _syncAbortSignal;
|
|
32
32
|
const syncAbortSignal = () => (_syncAbortSignal ??= new AbortController().signal);
|
|
33
33
|
export function evalSyncCsvgrep(inBytes, opArgs, readFileSync) {
|
|
34
|
-
if (inBytes.byteLength > 16384)
|
|
34
|
+
if (inBytes !== undefined && inBytes.byteLength > 16384)
|
|
35
35
|
return undefined;
|
|
36
36
|
const budget = new CsvBudget({}, syncAbortSignal());
|
|
37
37
|
try {
|
|
@@ -64,6 +64,8 @@ export function evalSyncCsvgrep(inBytes, opArgs, readFileSync) {
|
|
|
64
64
|
return undefined;
|
|
65
65
|
sourceBytes = fileBytes;
|
|
66
66
|
}
|
|
67
|
+
if (sourceBytes === undefined)
|
|
68
|
+
return undefined;
|
|
67
69
|
const parser = new CsvParser(options.dialect ?? {}, budget);
|
|
68
70
|
const rows = [...parser.push(sourceBytes), ...parser.end()];
|
|
69
71
|
const matcher = options.names ? undefined : createMatcher(options, fileMatchSet, budget);
|
|
@@ -2,5 +2,5 @@ import { HtmlError, detachHtmlNode, htmlText, htmlq, htmlqBaseline, htmlqBytes,
|
|
|
2
2
|
export { selectHtml, parseHtmlqArguments, htmlqBytes, htmlq, parseHtml, parseHtmlSync, inclusiveHtmlDescendants, serializeHtml, serializeHtmlBytes, htmlText, detachHtmlNode, HtmlError, htmlqBaseline, };
|
|
3
3
|
export type { HtmlqArguments, HtmlqCommandOptions, HtmlqCommandsOptions, HtmlqRunOptions, HtmlqResult, HtmlAccounting, HtmlOptions, HtmlLimits, HtmlNode, HtmlNamespace, HtmlAttribute, HtmlErrorCode, } from "../../../safe-bash-command-htmlq/index.js";
|
|
4
4
|
export { createHtmlqCommand, createHtmlqCommands, htmlqCommand, htmlqCommands } from "../../../safe-bash-command-htmlq/index.js";
|
|
5
|
-
export declare function evalSyncHtmlq(inBytes: Uint8Array, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
|
|
5
|
+
export declare function evalSyncHtmlq(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -17,7 +17,7 @@ const syncHtmlLimits = Object.freeze({
|
|
|
17
17
|
outputBytes: Infinity,
|
|
18
18
|
});
|
|
19
19
|
export function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
20
|
-
if (inBytes.byteLength > 16384)
|
|
20
|
+
if (inBytes && inBytes.byteLength > 16384)
|
|
21
21
|
return undefined;
|
|
22
22
|
try {
|
|
23
23
|
const invocation = invocationOptions({ signal: syncAbortSignal(), limits: syncHtmlLimits });
|
|
@@ -33,6 +33,9 @@ export function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
|
33
33
|
return undefined;
|
|
34
34
|
srcBytes = fBytes;
|
|
35
35
|
}
|
|
36
|
+
// Missing bytes mean inherited stdin has not been collected by the fast path.
|
|
37
|
+
if (!srcBytes)
|
|
38
|
+
return undefined;
|
|
36
39
|
const budget = new HtmlBudget(invocation);
|
|
37
40
|
const original = syncHtmlDecoder.decode(srcBytes);
|
|
38
41
|
const document = parseHtmlSync(original, invocation, budget);
|
|
@@ -52394,7 +52394,7 @@ function csvcutCommands(options8 = {}) {
|
|
|
52394
52394
|
var _syncAbortSignal;
|
|
52395
52395
|
var syncAbortSignal = () => _syncAbortSignal ??= new AbortController().signal;
|
|
52396
52396
|
function evalSyncCsvcut(inBytes, opArgs, readFileSync) {
|
|
52397
|
-
if (inBytes.byteLength > 16384) return void 0;
|
|
52397
|
+
if (inBytes !== void 0 && inBytes.byteLength > 16384) return void 0;
|
|
52398
52398
|
const budget = new CsvBudget({}, syncAbortSignal());
|
|
52399
52399
|
try {
|
|
52400
52400
|
const supplied = parseCsvcutArguments(opArgs, budget);
|
|
@@ -52412,6 +52412,7 @@ function evalSyncCsvcut(inBytes, opArgs, readFileSync) {
|
|
|
52412
52412
|
if (supplied.names && supplied.headerless) return void 0;
|
|
52413
52413
|
const dialect = { ...supplied.dialect, profile: supplied.dialect?.profile ?? "utf8-sig-permissive-v1" };
|
|
52414
52414
|
if (Number.isSafeInteger(dialect.skipLines) && dialect.skipLines < 0) dialect.skipLines = 0;
|
|
52415
|
+
if (sourceBytes === void 0) return void 0;
|
|
52415
52416
|
const parser = new CsvParser(dialect, budget);
|
|
52416
52417
|
const rows = [...parser.push(sourceBytes), ...parser.end()];
|
|
52417
52418
|
const first = rows[0];
|
|
@@ -52503,7 +52504,7 @@ function csvgrepCommands(options8 = {}) {
|
|
|
52503
52504
|
var _syncAbortSignal2;
|
|
52504
52505
|
var syncAbortSignal2 = () => _syncAbortSignal2 ??= new AbortController().signal;
|
|
52505
52506
|
function evalSyncCsvgrep(inBytes, opArgs, readFileSync) {
|
|
52506
|
-
if (inBytes.byteLength > 16384) return void 0;
|
|
52507
|
+
if (inBytes !== void 0 && inBytes.byteLength > 16384) return void 0;
|
|
52507
52508
|
const budget = new CsvBudget2({}, syncAbortSignal2());
|
|
52508
52509
|
try {
|
|
52509
52510
|
const options8 = parseCsvgrepArguments(opArgs, budget);
|
|
@@ -52528,6 +52529,7 @@ function evalSyncCsvgrep(inBytes, opArgs, readFileSync) {
|
|
|
52528
52529
|
if (!fileBytes || fileBytes.byteLength > 16384) return void 0;
|
|
52529
52530
|
sourceBytes = fileBytes;
|
|
52530
52531
|
}
|
|
52532
|
+
if (sourceBytes === void 0) return void 0;
|
|
52531
52533
|
const parser = new CsvParser2(options8.dialect ?? {}, budget);
|
|
52532
52534
|
const rows = [...parser.push(sourceBytes), ...parser.end()];
|
|
52533
52535
|
const matcher = options8.names ? void 0 : createMatcher(options8, fileMatchSet, budget);
|
|
@@ -52607,7 +52609,7 @@ var syncHtmlLimits = Object.freeze({
|
|
|
52607
52609
|
outputBytes: Infinity
|
|
52608
52610
|
});
|
|
52609
52611
|
function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
52610
|
-
if (inBytes.byteLength > 16384) return void 0;
|
|
52612
|
+
if (inBytes && inBytes.byteLength > 16384) return void 0;
|
|
52611
52613
|
try {
|
|
52612
52614
|
const invocation = invocationOptions({ signal: syncAbortSignal3(), limits: syncHtmlLimits });
|
|
52613
52615
|
const args = parseHtmlqArguments(opArgs, invocation);
|
|
@@ -52619,6 +52621,7 @@ function evalSyncHtmlq(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
|
52619
52621
|
if (!fBytes || fBytes.byteLength > 16384) return void 0;
|
|
52620
52622
|
srcBytes = fBytes;
|
|
52621
52623
|
}
|
|
52624
|
+
if (!srcBytes) return void 0;
|
|
52622
52625
|
const budget = new HtmlBudget(invocation);
|
|
52623
52626
|
const original = syncHtmlDecoder.decode(srcBytes);
|
|
52624
52627
|
const document = parseHtmlSync(original, invocation, budget);
|
|
@@ -87413,9 +87416,9 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
87413
87416
|
"LC_MEASUREMENT",
|
|
87414
87417
|
"LC_IDENTIFICATION"
|
|
87415
87418
|
]) {
|
|
87416
|
-
if (lcAll) lines4.push(`${cat}
|
|
87419
|
+
if (lcAll) lines4.push(`${cat}="${lcAll}"`);
|
|
87417
87420
|
else if (getEnv(cat)) lines4.push(`${cat}=${getEnv(cat)}`);
|
|
87418
|
-
else lines4.push(`${cat}="${lang}"`);
|
|
87421
|
+
else lines4.push(`${cat}="${lang || "C.UTF-8"}"`);
|
|
87419
87422
|
}
|
|
87420
87423
|
lines4.push(`LC_ALL=${lcAll ?? ""}`);
|
|
87421
87424
|
return lines4.join("\n");
|
|
@@ -89971,7 +89974,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
89971
89974
|
const inBytes = hasSingleHereStringRedir ? fastSharedTextEncoder.encode(hereStrVal) : EMPTY_BYTES;
|
|
89972
89975
|
const optInBytes = hasSingleHereStringRedir ? inBytes : void 0;
|
|
89973
89976
|
const readFile = (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true);
|
|
89974
|
-
let csvOut = w0Plain === "csvcut" ? evalSyncCsvcut(
|
|
89977
|
+
let csvOut = w0Plain === "csvcut" ? evalSyncCsvcut(optInBytes, allArgs, readFile) : w0Plain === "csvgrep" ? evalSyncCsvgrep(optInBytes, allArgs, readFile) : w0Plain === "csvlook" ? evalSyncCsvlook(optInBytes, allArgs, readFile) : w0Plain === "csvjson" ? evalSyncCsvjson(optInBytes, allArgs, readFile) : w0Plain === "csvsort" ? evalSyncCsvsort(optInBytes, allArgs, readFile) : w0Plain === "csvformat" ? evalSyncCsvformat(optInBytes, allArgs, readFile) : w0Plain === "csvstat" ? evalSyncCsvstat(optInBytes, allArgs, readFile) : w0Plain === "in2csv" ? evalSyncIn2csv(optInBytes, allArgs, readFile) : w0Plain === "csvstack" ? evalSyncCsvstack(optInBytes, allArgs, readFile) : w0Plain === "csvjoin" ? evalSyncCsvjoin(optInBytes, allArgs, readFile) : w0Plain === "dd" ? evalSyncDd(optInBytes, allArgs, readFile, (p, b) => {
|
|
89975
89978
|
try {
|
|
89976
89979
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
89977
89980
|
return tryWriteMemoryFileSync(this.backingFs, resolvePath(rawState.cwd, p), b, false, 438 & ~(rawState.umask ?? 18), this.commandSignal);
|
|
@@ -90388,7 +90391,7 @@ unsigned int ${ident}_len = ${view.byteLength};
|
|
|
90388
90391
|
})() : w0Plain === "base32" ? (() => {
|
|
90389
90392
|
const b32 = (0, base_exports.evalSyncBase32)(inBytes, allArgs, readFile);
|
|
90390
90393
|
return b32 !== void 0 ? sharedSyncPipeDecoder.decode(b32) : void 0;
|
|
90391
|
-
})() : w0Plain === "xq" || w0Plain === "yq" ? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile) : w0Plain === "xmllint" ? evalSyncXmllint(inBytes, allArgs, readFile) : evalSyncHtmlq(
|
|
90394
|
+
})() : w0Plain === "xq" || w0Plain === "yq" ? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile) : w0Plain === "xmllint" ? evalSyncXmllint(inBytes, allArgs, readFile) : evalSyncHtmlq(optInBytes, allArgs, readFile, (p, b) => {
|
|
90392
90395
|
try {
|
|
90393
90396
|
if (this._inSyncLoopPreflight) return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
90394
90397
|
return tryWriteMemoryFileSync(this.backingFs, resolvePath(rawState.cwd, p), b, false, 438 & ~(rawState.umask ?? 18), this.commandSignal);
|
|
@@ -34102,11 +34102,11 @@ export class Runtime {
|
|
|
34102
34102
|
"LC_PAPER", "LC_NAME", "LC_ADDRESS", "LC_TELEPHONE", "LC_MEASUREMENT", "LC_IDENTIFICATION"
|
|
34103
34103
|
]) {
|
|
34104
34104
|
if (lcAll)
|
|
34105
|
-
lines.push(`${cat}
|
|
34105
|
+
lines.push(`${cat}="${lcAll}"`);
|
|
34106
34106
|
else if (getEnv(cat))
|
|
34107
34107
|
lines.push(`${cat}=${getEnv(cat)}`);
|
|
34108
34108
|
else
|
|
34109
|
-
lines.push(`${cat}="${lang}"`);
|
|
34109
|
+
lines.push(`${cat}="${lang || "C.UTF-8"}"`);
|
|
34110
34110
|
}
|
|
34111
34111
|
lines.push(`LC_ALL=${lcAll ?? ""}`);
|
|
34112
34112
|
return lines.join("\n");
|
|
@@ -37741,9 +37741,9 @@ export class Runtime {
|
|
|
37741
37741
|
const optInBytes = hasSingleHereStringRedir ? inBytes : undefined;
|
|
37742
37742
|
const readFile = (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true);
|
|
37743
37743
|
let csvOut = w0Plain === "csvcut"
|
|
37744
|
-
? evalSyncCsvcut(
|
|
37744
|
+
? evalSyncCsvcut(optInBytes, allArgs, readFile)
|
|
37745
37745
|
: w0Plain === "csvgrep"
|
|
37746
|
-
? evalSyncCsvgrep(
|
|
37746
|
+
? evalSyncCsvgrep(optInBytes, allArgs, readFile)
|
|
37747
37747
|
: w0Plain === "csvlook"
|
|
37748
37748
|
? evalSyncCsvlook(optInBytes, allArgs, readFile)
|
|
37749
37749
|
: w0Plain === "csvjson"
|
|
@@ -38325,7 +38325,7 @@ export class Runtime {
|
|
|
38325
38325
|
? this.evalSyncXqOrYq(w0Plain, inBytes, allArgs, readFile)
|
|
38326
38326
|
: w0Plain === "xmllint"
|
|
38327
38327
|
? evalSyncXmllint(inBytes, allArgs, readFile)
|
|
38328
|
-
: evalSyncHtmlq(
|
|
38328
|
+
: evalSyncHtmlq(optInBytes, allArgs, readFile, (p, b) => { try {
|
|
38329
38329
|
if (this._inSyncLoopPreflight)
|
|
38330
38330
|
return Boolean(this.canFastMemoryRedirect && this._isMemoryBackingFs);
|
|
38331
38331
|
return tryWriteMemoryFileSync(this.backingFs, resolvePath(rawState.cwd, p), b, false, 0o666 & ~(rawState.umask ?? 0o022), this.commandSignal);
|