@eyepop.ai/eyepop 1.11.1 → 1.11.3
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/eyepop.index.js +16 -10
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +16 -10
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.js
CHANGED
|
@@ -8714,9 +8714,12 @@ var Stream = class _Stream {
|
|
|
8714
8714
|
static iterFromReadableStream(readableStream, controller, eventHandler) {
|
|
8715
8715
|
let consumed = false;
|
|
8716
8716
|
async function* iterLines() {
|
|
8717
|
-
const lineDecoder = new
|
|
8717
|
+
const lineDecoder = new EyepopLineDecoder();
|
|
8718
8718
|
const iter = readableStreamAsyncIterable(await readableStream);
|
|
8719
|
-
for await (
|
|
8719
|
+
for await (let chunk of iter) {
|
|
8720
|
+
if (typeof chunk === "number") {
|
|
8721
|
+
chunk = new Uint8Array([chunk & 255]);
|
|
8722
|
+
}
|
|
8720
8723
|
for (const line of lineDecoder.decode(chunk)) {
|
|
8721
8724
|
yield line;
|
|
8722
8725
|
}
|
|
@@ -8762,9 +8765,12 @@ var Stream = class _Stream {
|
|
|
8762
8765
|
static fromReadableStream(readableStream, controller) {
|
|
8763
8766
|
let consumed = false;
|
|
8764
8767
|
async function* iterLines() {
|
|
8765
|
-
const lineDecoder = new
|
|
8768
|
+
const lineDecoder = new EyepopLineDecoder();
|
|
8766
8769
|
const iter = readableStreamAsyncIterable(readableStream);
|
|
8767
|
-
for await (
|
|
8770
|
+
for await (let chunk of iter) {
|
|
8771
|
+
if (typeof chunk === "number") {
|
|
8772
|
+
chunk = new Uint8Array([chunk & 255]);
|
|
8773
|
+
}
|
|
8768
8774
|
for (const line of lineDecoder.decode(chunk)) {
|
|
8769
8775
|
yield line;
|
|
8770
8776
|
}
|
|
@@ -8848,7 +8854,7 @@ var Stream = class _Stream {
|
|
|
8848
8854
|
});
|
|
8849
8855
|
}
|
|
8850
8856
|
};
|
|
8851
|
-
var
|
|
8857
|
+
var _EyepopLineDecoder = class _EyepopLineDecoder {
|
|
8852
8858
|
// TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types.
|
|
8853
8859
|
constructor() {
|
|
8854
8860
|
this.buffer = [];
|
|
@@ -8867,8 +8873,8 @@ var _LineDecoder = class _LineDecoder {
|
|
|
8867
8873
|
if (!text) {
|
|
8868
8874
|
return [];
|
|
8869
8875
|
}
|
|
8870
|
-
const trailingNewline =
|
|
8871
|
-
let lines = text.split(
|
|
8876
|
+
const trailingNewline = _EyepopLineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || "");
|
|
8877
|
+
let lines = text.split(_EyepopLineDecoder.NEWLINE_REGEXP);
|
|
8872
8878
|
if (lines.length === 1 && !trailingNewline) {
|
|
8873
8879
|
this.buffer.push(lines[0]);
|
|
8874
8880
|
return [];
|
|
@@ -8916,9 +8922,9 @@ var _LineDecoder = class _LineDecoder {
|
|
|
8916
8922
|
}
|
|
8917
8923
|
};
|
|
8918
8924
|
// prettier-ignore
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
var
|
|
8925
|
+
_EyepopLineDecoder.NEWLINE_CHARS = /* @__PURE__ */ new Set(["\n", "\r", "\v", "\f", "", "", "", "\x85", "\u2028", "\u2029"]);
|
|
8926
|
+
_EyepopLineDecoder.NEWLINE_REGEXP = /\r\n|[\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029]/g;
|
|
8927
|
+
var EyepopLineDecoder = _EyepopLineDecoder;
|
|
8922
8928
|
function readableStreamAsyncIterable(stream) {
|
|
8923
8929
|
if (stream[Symbol.asyncIterator]) return stream;
|
|
8924
8930
|
const reader = stream.getReader();
|