@poe-platform/safe-bash 0.1.788 → 0.1.789
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/README.md +1 -1
- package/dist/safe-bash/chunks/{chunk-WHURJBET.js → chunk-2MUJ7RLZ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-CTUHLNJM.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-D4PHJK4T.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-O6356Z27.js → chunk-H7MMJS26.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-KHJGUF2W.js} +14 -0
- package/dist/safe-bash/chunks/{chunk-FJZNUUOQ.js → chunk-VUVKC6HV.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-X5ZCECM6.js} +2 -2
- package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-HO7WDPHZ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
- package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
- package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
- package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-6F7QJMJ3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-AT6ZSOE6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
- package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
- package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
- package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
- package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-UJOO6DKY.js} +20 -9
- package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
- package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
- package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-XNHSCU6I.js} +7 -3
- package/dist/safe-bash/commands/basic.js +148 -48
- package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
- package/dist/safe-bash/commands/cmp.d.ts +2 -3
- package/dist/safe-bash/commands/cmp.js +2 -689
- package/dist/safe-bash/commands/docx/index.browser.js +3 -46
- package/dist/safe-bash/commands/docx/index.d.ts +2 -24
- package/dist/safe-bash/commands/docx/index.js +2 -41
- package/dist/safe-bash/commands/docx/io.d.ts +1 -14
- package/dist/safe-bash/commands/docx/io.js +1 -15
- package/dist/safe-bash/commands/llm/index.browser.js +3 -3
- package/dist/safe-bash/commands/network/index.browser.js +3 -3
- package/dist/safe-bash/commands/node/index.browser.js +3 -3
- package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
- package/dist/safe-bash/commands/pptx/index.js +2 -152
- package/dist/safe-bash/commands/printf-float.d.ts +1 -0
- package/dist/safe-bash/commands/printf-float.js +48 -38
- package/dist/safe-bash/commands/printf-format.js +9 -6
- package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
- package/dist/safe-bash/commands/printf-quote.js +62 -0
- package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
- package/dist/safe-bash/commands/printf-wide.js +41 -0
- package/dist/safe-bash/commands/python/index.browser.js +2 -2
- package/dist/safe-bash/commands/truncate.d.ts +2 -3
- package/dist/safe-bash/commands/truncate.js +2 -686
- package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
- package/dist/safe-bash/contracts/diagnostics.js +2 -0
- package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
- package/dist/safe-bash/contracts/runtime-control.js +2 -0
- package/dist/safe-bash/core.browser.d.ts +1 -1
- package/dist/safe-bash/core.browser.js +2651 -4871
- package/dist/safe-bash/core.d.ts +10 -0
- package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
- package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
- package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
- package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
- package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
- package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
- package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
- package/dist/safe-bash/optional-host.browser.js +9 -1
- package/dist/safe-bash/optional-host.d.ts +3 -1
- package/dist/safe-bash/optional-host.js +3 -1
- package/dist/safe-bash/shell/runtime.js +10 -6
- package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
- package/dist/safe-bash-checksum-engine/index.js +14 -2
- package/dist/safe-bash-command-bzip2/index.js +2 -1
- package/dist/safe-bash-command-cmp/index.d.ts +10 -0
- package/dist/safe-bash-command-cmp/index.js +796 -0
- package/dist/safe-bash-command-cmp/options.d.ts +12 -0
- package/dist/safe-bash-command-cmp/options.js +42 -0
- package/dist/safe-bash-command-csvcut/index.js +11 -8
- package/dist/safe-bash-command-csvgrep/index.js +35 -7
- package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
- package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
- package/dist/safe-bash-command-csvkit/index.js +80 -324
- package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
- package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
- package/dist/safe-bash-command-diff3/index.js +3 -0
- package/dist/safe-bash-command-docx/LICENSE +21 -0
- package/dist/safe-bash-command-docx/index.d.ts +30 -0
- package/dist/safe-bash-command-docx/index.js +67 -0
- package/dist/safe-bash-command-docx/io.d.ts +14 -0
- package/dist/safe-bash-command-docx/io.js +26 -0
- package/dist/safe-bash-command-envsubst/index.js +34 -3
- package/dist/safe-bash-command-exiftool/index.js +3 -0
- package/dist/safe-bash-command-ffmpeg/index.js +1102 -1088
- package/dist/safe-bash-command-fold/family.js +1 -1
- package/dist/safe-bash-command-fold/index.js +1 -1
- package/dist/safe-bash-command-htmlq/index.js +5 -0
- package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
- package/dist/safe-bash-command-imagemagick/index.js +669 -271
- package/dist/safe-bash-command-mmdc/index.js +48 -10
- package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
- package/dist/safe-bash-command-op/index.js +19 -14
- package/dist/safe-bash-command-pandoc/command.js +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -1
- package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
- package/dist/safe-bash-command-pdfimages/index.js +63 -33
- package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
- package/dist/safe-bash-command-pdfinfo/index.js +370 -161
- package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
- package/dist/safe-bash-command-pdftk/index.js +114 -45
- package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
- package/dist/safe-bash-command-pdftoppm/index.js +179 -109
- package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
- package/dist/safe-bash-command-pdftotext/index.js +90 -27
- package/dist/safe-bash-command-pptx/LICENSE +21 -0
- package/dist/safe-bash-command-pptx/index.d.ts +33 -0
- package/dist/safe-bash-command-pptx/index.js +168 -0
- package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
- package/dist/safe-bash-command-qpdf/index.js +80 -29
- package/dist/safe-bash-command-sha512sum/index.js +12 -475
- package/dist/safe-bash-command-sips/index.d.ts +9 -5
- package/dist/safe-bash-command-sips/index.js +63 -44
- package/dist/safe-bash-command-soffice/index.d.ts +9 -3
- package/dist/safe-bash-command-soffice/index.js +65 -24
- package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
- package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/index.js +851 -352
- package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
- package/dist/safe-bash-command-timeout/index.js +3 -3
- package/dist/safe-bash-command-truncate/index.d.ts +8 -3
- package/dist/safe-bash-command-truncate/index.js +790 -272
- package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
- package/dist/safe-bash-command-truncate/sync.js +60 -0
- package/dist/safe-bash-command-wkhtmltopdf/index.js +92 -38
- package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
- package/dist/safe-bash-command-xxd/index.js +78 -20
- package/dist/safe-bash-command-xz/command.d.ts +4 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +1 -1
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/command.js +3 -3
- package/dist/safe-bash-contracts/diagnostics.js +3 -3
- package/dist/safe-bash-contracts/escaping.js +9 -9
- package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.js +21 -19
- package/dist/safe-bash-contracts/io.d.ts +12 -0
- package/dist/safe-bash-contracts/io.js +4 -1
- package/dist/safe-bash-contracts/output.js +3 -2
- package/dist/safe-bash-contracts/runtime-control.js +2 -2
- package/dist/safe-bash-contracts/signals.js +1 -1
- package/dist/safe-bash-contracts/yield.d.ts +1 -0
- package/dist/safe-bash-contracts/yield.js +3 -1
- package/dist/safe-bash-csv-engine/index.d.ts +10 -1
- package/dist/safe-bash-csv-engine/index.js +78 -6
- package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
- package/dist/safe-bash-io-engine/gnu-information.js +1 -1
- package/dist/safe-bash-io-engine/internal.d.ts +1 -1
- package/dist/safe-bash-io-engine/internal.js +2 -2
- package/dist/safe-bash-query-engine/index.js +4 -4
- package/dist/safe-bash-query-engine/interpreter.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +4 -4
- package/package.json +2 -2
- package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
- package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
- package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2VTMZTV3.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-BJ6DGYJA.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CmpLimits {
|
|
2
|
+
readonly maxChunkBytes: number;
|
|
3
|
+
readonly maxFallbackBytes: number;
|
|
4
|
+
}
|
|
5
|
+
export interface CmpCommandsOptions {
|
|
6
|
+
readonly replace?: boolean;
|
|
7
|
+
readonly comparisonBlockBytes?: number;
|
|
8
|
+
readonly limits?: Partial<CmpLimits>;
|
|
9
|
+
}
|
|
10
|
+
export declare function quote(value: string): string;
|
|
11
|
+
export declare function pathQuote(value: string): string;
|
|
12
|
+
export declare function limitsFor(options: CmpCommandsOptions): CmpLimits;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const escapes = new Map([[7, "a"], [8, "b"], [9, "t"], [10, "n"], [11, "v"], [12, "f"], [13, "r"]]);
|
|
2
|
+
export function quote(value) {
|
|
3
|
+
let result = "'";
|
|
4
|
+
for (const byte of new TextEncoder().encode(value)) {
|
|
5
|
+
const escape = escapes.get(byte);
|
|
6
|
+
result += escape ? `\\${escape}` : byte < 32 || byte >= 127 ? `\\${byte.toString(8).padStart(3, "0")}`
|
|
7
|
+
: byte === 39 || byte === 92 ? `\\${String.fromCharCode(byte)}` : String.fromCharCode(byte);
|
|
8
|
+
}
|
|
9
|
+
return `${result}'`;
|
|
10
|
+
}
|
|
11
|
+
export function pathQuote(value) {
|
|
12
|
+
if (value && !value.startsWith("~") && !value.startsWith("#") && value !== "{" && value !== "}"
|
|
13
|
+
&& Array.from(value).every(character => "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_./-+,:@%]~#{}".includes(character)))
|
|
14
|
+
return value;
|
|
15
|
+
const bytes = new TextEncoder().encode(value);
|
|
16
|
+
if (bytes.every(byte => byte >= 32 && byte < 127)) {
|
|
17
|
+
if (!value.includes("'"))
|
|
18
|
+
return `'${value}'`;
|
|
19
|
+
if (!["$", "`", "\\", '"'].some(character => value.includes(character)))
|
|
20
|
+
return `"${value}"`;
|
|
21
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
22
|
+
}
|
|
23
|
+
let result = "'", escaped = false;
|
|
24
|
+
for (const byte of bytes) {
|
|
25
|
+
const special = byte < 32 || byte >= 127;
|
|
26
|
+
if (special !== escaped) {
|
|
27
|
+
result += special ? "'$'" : "''";
|
|
28
|
+
escaped = special;
|
|
29
|
+
}
|
|
30
|
+
result += special ? `\\${escapes.get(byte) ?? byte.toString(8).padStart(3, "0")}`
|
|
31
|
+
: byte === 39 ? "'\\''" : String.fromCharCode(byte);
|
|
32
|
+
}
|
|
33
|
+
return `${result}'`;
|
|
34
|
+
}
|
|
35
|
+
export function limitsFor(options) {
|
|
36
|
+
const limits = { maxChunkBytes: Infinity, maxFallbackBytes: Infinity, ...options.limits };
|
|
37
|
+
for (const [name, value] of Object.entries(options.limits ?? {})) {
|
|
38
|
+
if (value !== Infinity && (!Number.isSafeInteger(value) || value < 1))
|
|
39
|
+
throw new RangeError(`cmp ${name} must be a positive safe integer or Infinity`);
|
|
40
|
+
}
|
|
41
|
+
return Object.freeze(limits);
|
|
42
|
+
}
|
|
@@ -31,7 +31,7 @@ async function* parseCsvRecords(source, options) {
|
|
|
31
31
|
const chunk = await next.call(producer);
|
|
32
32
|
if (chunk.done)
|
|
33
33
|
break;
|
|
34
|
-
for (const row of parser.
|
|
34
|
+
for await (const row of parser.pushAsync(chunk.value)) {
|
|
35
35
|
signal.throwIfAborted();
|
|
36
36
|
yield row;
|
|
37
37
|
}
|
|
@@ -55,6 +55,7 @@ async function* parseCsvRecords(source, options) {
|
|
|
55
55
|
|
|
56
56
|
// packages/safe-bash-command-csvcut/dist/behavior.js
|
|
57
57
|
init_buffer();
|
|
58
|
+
import { yieldTurn } from "../safe-bash-contracts/yield.js";
|
|
58
59
|
import { CsvBudget as CsvBudget2, CsvError, CsvParser as CsvParser2, generatedHeaders, resolveColumns, serializeRow } from "../safe-bash-csv-engine/index.js";
|
|
59
60
|
var bytePrototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
60
61
|
var kindOf = Object.getOwnPropertyDescriptor(bytePrototype, Symbol.toStringTag).get;
|
|
@@ -171,7 +172,12 @@ function cutCsv(source, options, configuration) {
|
|
|
171
172
|
throw new CsvError("LIMIT", "inputBytes limit exceeded");
|
|
172
173
|
const step = supplied.names ? 1 : 4096;
|
|
173
174
|
for (let offset = 0; offset < length; offset += step) {
|
|
175
|
+
if (offset % 4096 === 0) {
|
|
176
|
+
await yieldTurn(signal);
|
|
177
|
+
signal.throwIfAborted();
|
|
178
|
+
}
|
|
174
179
|
retain(parser.push(bytes.subarray(offset, Math.min(offset + step, length))));
|
|
180
|
+
await b.checkpoint();
|
|
175
181
|
if (supplied.names && rows.length) {
|
|
176
182
|
b.charge("inputBytes", length - offset - 1);
|
|
177
183
|
break;
|
|
@@ -428,21 +434,18 @@ function parseCsvcutArguments(args, budget) {
|
|
|
428
434
|
throw new CsvError2("ARGUMENT", "Invalid quoting value");
|
|
429
435
|
quoting = mode;
|
|
430
436
|
} else {
|
|
431
|
-
integer(value, budget);
|
|
432
|
-
throw new CsvError2("UNSUPPORTED", "Native character field limits are unqualified; use invocation fieldBytes limits");
|
|
437
|
+
dialect.fieldCharacters = integer(value, budget);
|
|
433
438
|
}
|
|
434
439
|
break;
|
|
435
440
|
} while (!long && offset < raw.length);
|
|
436
441
|
}
|
|
437
442
|
if (quoting !== void 0) {
|
|
438
|
-
if (quoting !== 0 && quoting !== 3)
|
|
439
|
-
throw new CsvError2("UNSUPPORTED", "Quoting modes 1 and 2 are not qualified");
|
|
440
443
|
dialect.quoting = quoting;
|
|
441
444
|
}
|
|
442
445
|
options.dialect = dialect;
|
|
443
446
|
return options;
|
|
444
447
|
}
|
|
445
|
-
var help = "usage: csvcut [-c COLUMNS] [-C NOT_COLUMNS] [-n] [-x] [--zero] [FILE]\nProject CSV columns from stdin or a literal VFS path.\nReader profile: utf8-sig-permissive-v1; quoting 0/3
|
|
448
|
+
var help = "usage: csvcut [-c COLUMNS] [-C NOT_COLUMNS] [-n] [-x] [--zero] [FILE]\nProject CSV columns from stdin or a literal VFS path.\nReader profile: utf8-sig-permissive-v1; quoting 0/1/2/3.\n";
|
|
446
449
|
var extent2 = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), "byteLength").get;
|
|
447
450
|
async function retireInput(retire, failed) {
|
|
448
451
|
try {
|
|
@@ -520,8 +523,8 @@ async function csvcut(context, invocation, configuration = {}) {
|
|
|
520
523
|
}
|
|
521
524
|
options = parseCsvcutArguments(context.args, budget);
|
|
522
525
|
}
|
|
523
|
-
if (options.encoding !== void 0
|
|
524
|
-
|
|
526
|
+
if (options.encoding !== void 0)
|
|
527
|
+
options = { ...options, dialect: { ...options.dialect, encoding: options.encoding } };
|
|
525
528
|
if (options.help || options.version) {
|
|
526
529
|
const text = options.help ? help : "csvcut 2.2.0 (utf8-sig-permissive-v1 candidate)\n";
|
|
527
530
|
budget.charge("work", text.length);
|
|
@@ -16,6 +16,7 @@ import { CsvBudget, CsvError as CsvError2, CsvParser, generatedHeaders, selectCo
|
|
|
16
16
|
|
|
17
17
|
// packages/safe-bash-command-csvgrep/dist/match.js
|
|
18
18
|
init_buffer();
|
|
19
|
+
import { compilePythonSearch, CsvkitBlocked } from "../safe-bash-command-csvkit/python-regex.js";
|
|
19
20
|
import { CsvError } from "../safe-bash-csv-engine/index.js";
|
|
20
21
|
function pythonWhitespace(code) {
|
|
21
22
|
return code >= 9 && code <= 13 || code >= 28 && code <= 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || [8232, 8233, 8239, 8287, 12288].includes(code);
|
|
@@ -93,7 +94,7 @@ var digitStarts = [
|
|
|
93
94
|
125264,
|
|
94
95
|
130032
|
|
95
96
|
];
|
|
96
|
-
function
|
|
97
|
+
function compileSequence(pattern, b) {
|
|
97
98
|
const atoms = [];
|
|
98
99
|
let ascii = false, ignoreCase = false, multiline = false, dotall = false, offset = 0;
|
|
99
100
|
if (pattern.startsWith("(?")) {
|
|
@@ -271,6 +272,31 @@ function compile(pattern, b) {
|
|
|
271
272
|
return false;
|
|
272
273
|
};
|
|
273
274
|
}
|
|
275
|
+
function compile(pattern, b) {
|
|
276
|
+
try {
|
|
277
|
+
return compileSequence(pattern, b);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (!(error instanceof CsvError) || error.code !== "UNSUPPORTED" || !(error.message.startsWith("Groups") || error.message === "Unsupported Python regex flags or group" || error.message.startsWith("Unsupported Python regex escape")))
|
|
280
|
+
throw error;
|
|
281
|
+
let search;
|
|
282
|
+
try {
|
|
283
|
+
search = compilePythonSearch(pattern, () => b.charge("work", 1), b.remaining("work"), (bytes) => b.charge("retainedBytes", bytes));
|
|
284
|
+
} catch (failure) {
|
|
285
|
+
if (failure instanceof CsvkitBlocked)
|
|
286
|
+
throw error;
|
|
287
|
+
throw failure;
|
|
288
|
+
}
|
|
289
|
+
return (text) => {
|
|
290
|
+
try {
|
|
291
|
+
return search(text);
|
|
292
|
+
} catch (failure) {
|
|
293
|
+
if (failure instanceof CsvkitBlocked)
|
|
294
|
+
throw new CsvError("REGEX", failure.message);
|
|
295
|
+
throw failure;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
274
300
|
function createMatcher(options, set, b) {
|
|
275
301
|
const pattern = options.regex || (options.file === void 0 ? options.match : void 0);
|
|
276
302
|
if (pattern !== void 0) {
|
|
@@ -417,8 +443,7 @@ function parseCsvgrepArguments(args, b) {
|
|
|
417
443
|
else if (arg === "-p" || arg === "--escapechar")
|
|
418
444
|
dialect.escape = value;
|
|
419
445
|
else if (arg === "-e" || arg === "--encoding") {
|
|
420
|
-
|
|
421
|
-
throw new CsvError2("UNSUPPORTED", "Only utf-8-sig decoding is qualified");
|
|
446
|
+
dialect.encoding = value;
|
|
422
447
|
} else if (arg === "-K" || arg === "--skip-lines") {
|
|
423
448
|
let start = 0, end = value.length;
|
|
424
449
|
while (start < end && pythonWhitespace(value.charCodeAt(start))) {
|
|
@@ -452,11 +477,13 @@ function parseCsvgrepArguments(args, b) {
|
|
|
452
477
|
} else if (arg === "-u" || arg === "--quoting") {
|
|
453
478
|
if (!["0", "1", "2", "3"].includes(value))
|
|
454
479
|
throw new CsvError2("ARGUMENT", "Invalid quoting value");
|
|
455
|
-
if (value === "1" || value === "2")
|
|
456
|
-
throw new CsvError2("UNSUPPORTED", "Quoting modes 1 and 2 are not qualified");
|
|
457
480
|
dialect.quoting = Number(value);
|
|
458
|
-
} else
|
|
459
|
-
|
|
481
|
+
} else {
|
|
482
|
+
const size = Number(value);
|
|
483
|
+
if (!Number.isSafeInteger(size))
|
|
484
|
+
throw new CsvError2("ARGUMENT", "Invalid field size");
|
|
485
|
+
dialect.fieldCharacters = size;
|
|
486
|
+
}
|
|
460
487
|
continue;
|
|
461
488
|
}
|
|
462
489
|
if (!ended && (arg === "-t" || arg === "--tabs")) {
|
|
@@ -751,6 +778,7 @@ async function csvgrep(context, invocation, configuration = {}) {
|
|
|
751
778
|
};
|
|
752
779
|
await consume(source(options.filePath ?? "-"), async (bytes) => {
|
|
753
780
|
await deliver(parser.push(bytes));
|
|
781
|
+
await b.checkpoint();
|
|
754
782
|
}, () => Boolean(options.names && headers !== void 0));
|
|
755
783
|
if (!options.names || headers === void 0)
|
|
756
784
|
await deliver(parser.end());
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
normalizeEncoding,
|
|
3
3
|
pythonCodecs,
|
|
4
4
|
resolveCodec
|
|
5
|
-
} from "../../safe-bash/command-chunks/chunk-
|
|
6
|
-
import "../../safe-bash/command-chunks/chunk-
|
|
7
|
-
import "../../safe-bash/command-chunks/chunk-
|
|
5
|
+
} from "../../safe-bash/command-chunks/chunk-IHHTTQX6.js";
|
|
6
|
+
import "../../safe-bash/command-chunks/chunk-EZ2DTOLI.js";
|
|
7
|
+
import "../../safe-bash/command-chunks/chunk-PGEYORBZ.js";
|
|
8
|
+
import "../../safe-bash/command-chunks/chunk-WFDW4XXD.js";
|
|
8
9
|
import "../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
9
10
|
export {
|
|
10
11
|
normalizeEncoding,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
utf8Codec
|
|
3
|
-
} from "../../safe-bash/command-chunks/chunk-
|
|
4
|
-
import "../../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../../safe-bash/command-chunks/chunk-EZ2DTOLI.js";
|
|
4
|
+
import "../../safe-bash/command-chunks/chunk-PGEYORBZ.js";
|
|
5
|
+
import "../../safe-bash/command-chunks/chunk-WFDW4XXD.js";
|
|
5
6
|
import "../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
6
7
|
export {
|
|
7
8
|
utf8Codec
|