@poe-platform/safe-bash 0.1.787 → 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-WVWWRMFD.js → chunk-3KROFHBT.js} +1 -1
- 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-IFUNAM4D.js → chunk-5L62A5RO.js} +1 -1
- 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-DREUDEQG.js → chunk-AT6ZSOE6.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BUKYQBXO.js → chunk-BJ6DGYJA.js} +12 -12
- package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-NSEUBSOD.js → chunk-CXMOCPPH.js} +2 -2
- 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-3JS4FOLB.js → chunk-HETU7MYN.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-Z47EO74H.js → chunk-MYKK3Q5G.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GZOUGVVV.js → chunk-OYZ534IK.js} +1 -1
- 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-TFZEYNMX.js → chunk-VQLFJCG7.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-BIXN77VL.js → chunk-VUG324ER.js} +10 -0
- 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-mcp/index.browser.d.ts +875 -0
- package/dist/safe-bash-mcp/index.browser.js +8740 -0
- package/dist/safe-bash-mcp/index.js +32 -31
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +12 -12
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +10 -10
- package/dist/safe-bash-query-engine/query-core.js +12 -12
- package/dist/safe-bash-query-engine/regex.js +3 -3
- package/dist/safe-bash-query-engine/splits.js +4 -4
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/package.json +9 -3
- 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-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// packages/safe-bash-csv-engine/dist/index.js
|
|
6
6
|
init_buffer();
|
|
7
|
+
import { yieldTurn } from "../safe-bash-contracts/yield.js";
|
|
7
8
|
var CsvError = class extends Error {
|
|
8
9
|
code;
|
|
9
10
|
constructor(code, message) {
|
|
@@ -28,6 +29,7 @@ var defaultCsvLimits = Object.freeze({
|
|
|
28
29
|
var CsvBudget = class {
|
|
29
30
|
signal;
|
|
30
31
|
disposed = false;
|
|
32
|
+
lastYieldWork = 0;
|
|
31
33
|
aborted = false;
|
|
32
34
|
pollSignal;
|
|
33
35
|
limits;
|
|
@@ -52,6 +54,14 @@ var CsvBudget = class {
|
|
|
52
54
|
getUsage(key) {
|
|
53
55
|
return this.usage[key];
|
|
54
56
|
}
|
|
57
|
+
async checkpoint() {
|
|
58
|
+
this.signal.throwIfAborted();
|
|
59
|
+
if (this.usage.work - this.lastYieldWork < 4096)
|
|
60
|
+
return;
|
|
61
|
+
this.lastYieldWork = this.usage.work;
|
|
62
|
+
await yieldTurn(this.signal);
|
|
63
|
+
this.signal.throwIfAborted();
|
|
64
|
+
}
|
|
55
65
|
remaining(key) {
|
|
56
66
|
return this.limits[key] - this.usage[key];
|
|
57
67
|
}
|
|
@@ -135,7 +145,10 @@ var typedArrayByteLength = Object.getOwnPropertyDescriptor(Object.getPrototypeOf
|
|
|
135
145
|
var CsvParser = class {
|
|
136
146
|
dialect;
|
|
137
147
|
budget;
|
|
138
|
-
decoder
|
|
148
|
+
decoder;
|
|
149
|
+
encoding;
|
|
150
|
+
fieldCharacters = 0;
|
|
151
|
+
quotedField = false;
|
|
139
152
|
delimiter;
|
|
140
153
|
field = "";
|
|
141
154
|
row = [];
|
|
@@ -151,12 +164,18 @@ var CsvParser = class {
|
|
|
151
164
|
this.dialect = dialect;
|
|
152
165
|
this.budget = budget;
|
|
153
166
|
this.dialect = Object.freeze({ ...dialect });
|
|
167
|
+
this.encoding = (dialect.encoding ?? "utf-8-sig").toLowerCase().replaceAll("_", "-");
|
|
168
|
+
if (!["utf-8-sig", "utf8-sig", "utf-8", "utf8", "ascii", "us-ascii", "latin1", "latin-1", "iso-8859-1"].includes(this.encoding))
|
|
169
|
+
throw new CsvError("UNSUPPORTED", "Unsupported CSV encoding");
|
|
170
|
+
this.decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: !["utf-8-sig", "utf8-sig"].includes(this.encoding) });
|
|
171
|
+
if (dialect.fieldCharacters !== void 0 && (!Number.isSafeInteger(dialect.fieldCharacters) || dialect.fieldCharacters < 0))
|
|
172
|
+
throw new CsvError("ARGUMENT", "Field size must be a nonnegative safe integer");
|
|
154
173
|
this.delimiter = dialect.tabs ? " " : dialect.delimiter ?? ",";
|
|
155
174
|
budget.charge("work", 0);
|
|
156
175
|
if (dialect.profile !== void 0 && dialect.profile !== "utf8-sig-permissive-v1" && dialect.profile !== "utf8-sig-strict-v1")
|
|
157
176
|
throw new CsvError("UNSUPPORTED", "Unsupported CSV reader profile");
|
|
158
|
-
if (dialect.quoting !== void 0 &&
|
|
159
|
-
throw new CsvError("UNSUPPORTED", "Only quoting modes 0 and 3 are
|
|
177
|
+
if (dialect.quoting !== void 0 && ![0, 1, 2, 3].includes(dialect.quoting))
|
|
178
|
+
throw new CsvError("UNSUPPORTED", "Only quoting modes 0, 1, 2 and 3 are supported");
|
|
160
179
|
for (const char of [
|
|
161
180
|
this.delimiter,
|
|
162
181
|
dialect.quote ?? '"',
|
|
@@ -169,6 +188,14 @@ var CsvParser = class {
|
|
|
169
188
|
if (dialect.skipLines !== void 0 && (!Number.isSafeInteger(dialect.skipLines) || dialect.skipLines < 0))
|
|
170
189
|
throw new CsvError("ARGUMENT", "Skip lines must be nonnegative");
|
|
171
190
|
}
|
|
191
|
+
/** Consume a borrowed producer chunk in bounded units before its next pull. */
|
|
192
|
+
async *pushAsync(bytes) {
|
|
193
|
+
for (let offset = 0; offset < bytes.byteLength; offset += 4096) {
|
|
194
|
+
await yieldTurn(this.budget.signal);
|
|
195
|
+
this.budget.signal.throwIfAborted();
|
|
196
|
+
yield* this.push(bytes.subarray(offset, offset + 4096));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
172
199
|
push(bytes) {
|
|
173
200
|
if (this.ended)
|
|
174
201
|
throw new CsvError("INPUT", "CSV parser is closed");
|
|
@@ -184,8 +211,18 @@ var CsvParser = class {
|
|
|
184
211
|
this.budget.charge("retainedBytes", byteLength * 2 + 8);
|
|
185
212
|
let text;
|
|
186
213
|
try {
|
|
187
|
-
|
|
188
|
-
|
|
214
|
+
if (["ascii", "us-ascii", "latin1", "latin-1", "iso-8859-1"].includes(this.encoding)) {
|
|
215
|
+
text = "";
|
|
216
|
+
for (const byte of bytes) {
|
|
217
|
+
if ((this.encoding === "ascii" || this.encoding === "us-ascii") && byte > 127)
|
|
218
|
+
throw new CsvError("INPUT", "Invalid ASCII input");
|
|
219
|
+
text += String.fromCharCode(byte);
|
|
220
|
+
}
|
|
221
|
+
} else
|
|
222
|
+
text = this.decoder.decode(bytes, { stream: true });
|
|
223
|
+
} catch (error) {
|
|
224
|
+
if (error instanceof CsvError)
|
|
225
|
+
throw error;
|
|
189
226
|
throw new CsvError("INPUT", "Invalid UTF-8 input");
|
|
190
227
|
}
|
|
191
228
|
this.budget.charge("decodedBytes", text.length * 2);
|
|
@@ -223,13 +260,46 @@ var CsvParser = class {
|
|
|
223
260
|
this.active = false;
|
|
224
261
|
}
|
|
225
262
|
append(char) {
|
|
263
|
+
if (++this.fieldCharacters > (this.dialect.fieldCharacters ?? Infinity))
|
|
264
|
+
throw new CsvError("INPUT", "Field character limit exceeded");
|
|
226
265
|
this.budget.chargeAppend(this.field.length + char.length);
|
|
227
266
|
this.field += char;
|
|
228
267
|
}
|
|
229
268
|
finishField() {
|
|
230
269
|
this.budget.charge("cells", 1);
|
|
231
270
|
this.budget.charge("retainedBytes", 32);
|
|
232
|
-
this.
|
|
271
|
+
let value = this.field;
|
|
272
|
+
if (this.dialect.quoting === 2 && !this.quotedField && value.length) {
|
|
273
|
+
this.budget.charge("work", value.length);
|
|
274
|
+
const raw = value.trim().toLowerCase();
|
|
275
|
+
const unsigned = raw.startsWith("+") || raw.startsWith("-") ? raw.slice(1) : raw;
|
|
276
|
+
const negative = raw.startsWith("-");
|
|
277
|
+
if (["inf", "infinity", "nan"].includes(unsigned))
|
|
278
|
+
value = unsigned === "nan" ? "nan" : negative ? "-inf" : "inf";
|
|
279
|
+
else {
|
|
280
|
+
const digit = (char) => char !== void 0 && char >= "0" && char <= "9";
|
|
281
|
+
for (let i = 0; i < raw.length; i++) {
|
|
282
|
+
const char = raw[i];
|
|
283
|
+
if (char === "_" && !(digit(raw[i - 1]) && digit(raw[i + 1])) || !digit(char) && !".+-e_".includes(char))
|
|
284
|
+
throw new CsvError("INPUT", "Could not convert unquoted field to float");
|
|
285
|
+
}
|
|
286
|
+
const number = Number(raw.replaceAll("_", ""));
|
|
287
|
+
if (!raw || Number.isNaN(number))
|
|
288
|
+
throw new CsvError("INPUT", "Could not convert unquoted field to float");
|
|
289
|
+
const absolute = Math.abs(number);
|
|
290
|
+
if (!Number.isFinite(number))
|
|
291
|
+
value = number < 0 ? "-inf" : "inf";
|
|
292
|
+
else if (absolute !== 0 && (absolute < 1e-4 || absolute >= 1e16)) {
|
|
293
|
+
const [mantissa, exponent] = number.toExponential().split("e");
|
|
294
|
+
value = mantissa + "e" + exponent[0] + exponent.slice(1).padStart(2, "0");
|
|
295
|
+
} else
|
|
296
|
+
value = Object.is(number, -0) ? "-0.0" : Number.isInteger(number) ? number.toFixed(1) : String(number);
|
|
297
|
+
}
|
|
298
|
+
this.budget.charge("retainedBytes", value.length * 2);
|
|
299
|
+
}
|
|
300
|
+
this.row.push(value);
|
|
301
|
+
this.fieldCharacters = 0;
|
|
302
|
+
this.quotedField = false;
|
|
233
303
|
this.field = "";
|
|
234
304
|
this.state = "start";
|
|
235
305
|
}
|
|
@@ -296,6 +366,7 @@ var CsvParser = class {
|
|
|
296
366
|
if (this.state === "closed" && char === quote && this.dialect.doubleQuote !== false) {
|
|
297
367
|
this.append(char);
|
|
298
368
|
this.state = "quoted";
|
|
369
|
+
this.quotedField = true;
|
|
299
370
|
continue;
|
|
300
371
|
}
|
|
301
372
|
if (this.dialect.profile === "utf8-sig-strict-v1" && this.state === "closed" && !newline && char !== this.delimiter)
|
|
@@ -315,6 +386,7 @@ var CsvParser = class {
|
|
|
315
386
|
continue;
|
|
316
387
|
if (this.state === "start" && char === quote) {
|
|
317
388
|
this.state = "quoted";
|
|
389
|
+
this.quotedField = true;
|
|
318
390
|
continue;
|
|
319
391
|
}
|
|
320
392
|
if (this.dialect.profile === "utf8-sig-strict-v1" && char === quote)
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
requiredFileInput,
|
|
6
6
|
searchRequirements,
|
|
7
7
|
sedRequirements
|
|
8
|
-
} from "../../../safe-bash/command-chunks/chunk-
|
|
9
|
-
import "../../../safe-bash/command-chunks/chunk-
|
|
8
|
+
} from "../../../safe-bash/command-chunks/chunk-6F7QJMJ3.js";
|
|
9
|
+
import "../../../safe-bash/command-chunks/chunk-UJOO6DKY.js";
|
|
10
10
|
import "../../../safe-bash/command-chunks/chunk-OTYUNKT5.js";
|
|
11
|
-
import "../../../safe-bash/command-chunks/chunk-
|
|
11
|
+
import "../../../safe-bash/command-chunks/chunk-XNHSCU6I.js";
|
|
12
12
|
import "../../../safe-bash/command-chunks/chunk-YAFQG4SC.js";
|
|
13
13
|
import "../../../safe-bash/command-chunks/chunk-3746OSHN.js";
|
|
14
14
|
import "../../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requiredFileInput
|
|
3
|
-
} from "../../../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../../../safe-bash/command-chunks/chunk-6F7QJMJ3.js";
|
|
4
4
|
import {
|
|
5
5
|
RESOLVED_EXIT_ONE,
|
|
6
6
|
RESOLVED_EXIT_ZERO,
|
|
7
7
|
builtInDirectContextExecutors
|
|
8
|
-
} from "../../../safe-bash/command-chunks/chunk-
|
|
8
|
+
} from "../../../safe-bash/command-chunks/chunk-UJOO6DKY.js";
|
|
9
9
|
import "../../../safe-bash/command-chunks/chunk-OTYUNKT5.js";
|
|
10
|
-
import "../../../safe-bash/command-chunks/chunk-
|
|
10
|
+
import "../../../safe-bash/command-chunks/chunk-XNHSCU6I.js";
|
|
11
11
|
import {
|
|
12
12
|
inputRequirements
|
|
13
13
|
} from "../../../safe-bash/command-chunks/chunk-YAFQG4SC.js";
|
|
@@ -121,7 +121,7 @@ export declare function replaceArgument(source: string | Uint8Array, pattern: st
|
|
|
121
121
|
export declare function escapeBytes(text: string | Uint8Array, zeroOctal?: boolean, bareOctal?: boolean, unicode?: {
|
|
122
122
|
utf8: boolean;
|
|
123
123
|
missingDigit: (escape: string) => void;
|
|
124
|
-
}): {
|
|
124
|
+
}, literalFormat?: boolean): {
|
|
125
125
|
bytes: Uint8Array;
|
|
126
126
|
stop: boolean;
|
|
127
127
|
};
|
|
@@ -44,9 +44,9 @@ import {
|
|
|
44
44
|
requireOperands,
|
|
45
45
|
syncCommandEvaluators,
|
|
46
46
|
value
|
|
47
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
47
|
+
} from "../safe-bash/command-chunks/chunk-UJOO6DKY.js";
|
|
48
48
|
import "../safe-bash/command-chunks/chunk-OTYUNKT5.js";
|
|
49
|
-
import "../safe-bash/command-chunks/chunk-
|
|
49
|
+
import "../safe-bash/command-chunks/chunk-XNHSCU6I.js";
|
|
50
50
|
import "../safe-bash/command-chunks/chunk-YAFQG4SC.js";
|
|
51
51
|
import "../safe-bash/command-chunks/chunk-3746OSHN.js";
|
|
52
52
|
import "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
|