fix
This commit is contained in:
1
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.d.ts
generated
vendored
Normal file
1
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export { asyncIterator, type ReadableStreamIteratorOptions, } from "../core/asyncIterator.js";
|
89
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js
generated
vendored
Normal file
89
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
const a = Object.getPrototypeOf(
|
||||
Object.getPrototypeOf(
|
||||
/* istanbul ignore next */
|
||||
async function* () {
|
||||
}
|
||||
).prototype
|
||||
);
|
||||
class c {
|
||||
#t;
|
||||
#n;
|
||||
#r = !1;
|
||||
#e = void 0;
|
||||
constructor(e, t) {
|
||||
this.#t = e, this.#n = t;
|
||||
}
|
||||
next() {
|
||||
const e = () => this.#s();
|
||||
return this.#e = this.#e ? this.#e.then(e, e) : e(), this.#e;
|
||||
}
|
||||
return(e) {
|
||||
const t = () => this.#i(e);
|
||||
return this.#e ? this.#e.then(t, t) : t();
|
||||
}
|
||||
async #s() {
|
||||
if (this.#r)
|
||||
return {
|
||||
done: !0,
|
||||
value: void 0
|
||||
};
|
||||
let e;
|
||||
try {
|
||||
e = await this.#t.read();
|
||||
} catch (t) {
|
||||
throw this.#e = void 0, this.#r = !0, this.#t.releaseLock(), t;
|
||||
}
|
||||
return e.done && (this.#e = void 0, this.#r = !0, this.#t.releaseLock()), e;
|
||||
}
|
||||
async #i(e) {
|
||||
if (this.#r)
|
||||
return {
|
||||
done: !0,
|
||||
value: e
|
||||
};
|
||||
if (this.#r = !0, !this.#n) {
|
||||
const t = this.#t.cancel(e);
|
||||
return this.#t.releaseLock(), await t, {
|
||||
done: !0,
|
||||
value: e
|
||||
};
|
||||
}
|
||||
return this.#t.releaseLock(), {
|
||||
done: !0,
|
||||
value: e
|
||||
};
|
||||
}
|
||||
}
|
||||
const n = Symbol();
|
||||
function i() {
|
||||
return this[n].next();
|
||||
}
|
||||
Object.defineProperty(i, "name", { value: "next" });
|
||||
function o(r) {
|
||||
return this[n].return(r);
|
||||
}
|
||||
Object.defineProperty(o, "name", { value: "return" });
|
||||
const u = Object.create(a, {
|
||||
next: {
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0,
|
||||
value: i
|
||||
},
|
||||
return: {
|
||||
enumerable: !0,
|
||||
configurable: !0,
|
||||
writable: !0,
|
||||
value: o
|
||||
}
|
||||
});
|
||||
function h({ preventCancel: r = !1 } = {}) {
|
||||
const e = this.getReader(), t = new c(
|
||||
e,
|
||||
r
|
||||
), s = Object.create(u);
|
||||
return s[n] = t, s;
|
||||
}
|
||||
export {
|
||||
h as asyncIterator
|
||||
};
|
1
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.d.ts
generated
vendored
Normal file
1
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export { fromAnyIterable } from "../core/fromAnyIterable.js";
|
34
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js
generated
vendored
Normal file
34
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
function c(n) {
|
||||
const t = a(n);
|
||||
return new ReadableStream(
|
||||
{
|
||||
async pull(e) {
|
||||
const { value: r, done: o } = await t.next();
|
||||
o ? e.close() : e.enqueue(r);
|
||||
},
|
||||
async cancel(e) {
|
||||
if (typeof t.return == "function" && typeof await t.return(e) != "object")
|
||||
throw new TypeError("return() fulfills with a non-object.");
|
||||
return e;
|
||||
}
|
||||
},
|
||||
new CountQueuingStrategy({
|
||||
highWaterMark: 0
|
||||
})
|
||||
);
|
||||
}
|
||||
function a(n) {
|
||||
let t = n[Symbol.asyncIterator]?.bind(n);
|
||||
if (t === void 0) {
|
||||
const r = n[Symbol.iterator](), o = {
|
||||
[Symbol.iterator]: () => r
|
||||
};
|
||||
t = async function* () {
|
||||
return yield* o;
|
||||
};
|
||||
}
|
||||
return t();
|
||||
}
|
||||
export {
|
||||
c as fromAnyIterable
|
||||
};
|
2
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.d.ts
generated
vendored
Normal file
2
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./asyncIterator.js";
|
||||
export * from "./fromAnyIterable.js";
|
6
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js
generated
vendored
Normal file
6
book/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { asyncIterator as e } from "./asyncIterator.js";
|
||||
import { fromAnyIterable as a } from "./fromAnyIterable.js";
|
||||
export {
|
||||
e as asyncIterator,
|
||||
a as fromAnyIterable
|
||||
};
|
Reference in New Issue
Block a user