FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

7
node_modules/seroval-plugins/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
MIT License Copyright (c) 2025 Alexis Munsayac <alexis.munsayac@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

46
node_modules/seroval-plugins/README.md generated vendored Normal file
View File

@@ -0,0 +1,46 @@
# `seroval-plugins`
> Plugins for `seroval`
[![NPM](https://img.shields.io/npm/v/seroval.svg)](https://www.npmjs.com/package/seroval) [![JavaScript Style Guide](https://badgen.net/badge/code%20style/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)
## Install
```bash
npm install --save seroval-plugins
```
```bash
yarn add seroval-plugins
```
```bash
pnpm add seroval-plugins
```
## Features
### `seroval-plugins/web`
- [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
- [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
- [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent)
- [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException)
- [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event)
- [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)
- [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)
- [`ImageData`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)
- [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers)
- [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
- [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
- [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
- [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
- [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL)
## Sponsors
![Sponsors](https://github.com/lxsmnsyc/sponsors/blob/main/sponsors.svg?raw=true)
## License
MIT © [lxsmnsyc](https://github.com/lxsmnsyc)

View File

@@ -0,0 +1,818 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// web/index.ts
var web_exports = {};
__export(web_exports, {
AbortSignalPlugin: () => abort_signal_default,
BlobPlugin: () => blob_default,
CustomEventPlugin: () => custom_event_default,
DOMExceptionPlugin: () => dom_exception_default,
EventPlugin: () => event_default,
FilePlugin: () => file_default,
FormDataPlugin: () => form_data_default,
HeadersPlugin: () => headers_default,
ImageDataPlugin: () => image_data_default,
ReadableStreamPlugin: () => readable_stream_default,
RequestPlugin: () => request_default,
ResponsePlugin: () => response_default,
URLPlugin: () => url_default,
URLSearchParamsPlugin: () => url_search_params_default
});
module.exports = __toCommonJS(web_exports);
// web/abort-signal.ts
var import_seroval = require("seroval");
var PROMISE_TO_ABORT_SIGNAL = (promise) => {
const controller = new AbortController();
const abort = controller.abort.bind(controller);
promise.then(abort, abort);
return controller;
};
function resolveAbortSignalResult(resolve) {
resolve(this.reason);
}
function resolveAbortSignal(resolve) {
this.addEventListener("abort", resolveAbortSignalResult.bind(this, resolve), {
once: true
});
}
function abortSignalToPromise(signal) {
return new Promise(resolveAbortSignal.bind(signal));
}
var ABORT_CONTROLLER = {};
var AbortControllerFactoryPlugin = /* @__PURE__ */ (0, import_seroval.createPlugin)({
tag: "seroval-plugins/web/AbortControllerFactoryPlugin",
test(value) {
return value === ABORT_CONTROLLER;
},
parse: {
sync() {
return ABORT_CONTROLLER;
},
async async() {
return await Promise.resolve(ABORT_CONTROLLER);
},
stream() {
return ABORT_CONTROLLER;
}
},
serialize() {
return PROMISE_TO_ABORT_SIGNAL.toString();
},
deserialize() {
return PROMISE_TO_ABORT_SIGNAL;
}
});
var AbortSignalPlugin = /* @__PURE__ */ (0, import_seroval.createPlugin)({
tag: "seroval-plugins/web/AbortSignal",
extends: [AbortControllerFactoryPlugin],
test(value) {
if (typeof AbortSignal === "undefined") {
return false;
}
return value instanceof AbortSignal;
},
parse: {
sync(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason)
};
}
return {};
},
async async(value, ctx) {
if (value.aborted) {
return {
reason: await ctx.parse(value.reason)
};
}
const result = await abortSignalToPromise(value);
return {
reason: await ctx.parse(result)
};
},
stream(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason)
};
}
const promise = abortSignalToPromise(value);
return {
factory: ctx.parse(ABORT_CONTROLLER),
controller: ctx.parse(promise)
};
}
},
serialize(node, ctx) {
if (node.reason) {
return "AbortSignal.abort(" + ctx.serialize(node.reason) + ")";
}
if (node.controller && node.factory) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.controller) + ").signal";
}
return "(new AbortController).signal";
},
deserialize(node, ctx) {
if (node.reason) {
return AbortSignal.abort(ctx.deserialize(node.reason));
}
if (node.controller) {
return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
}
const controller = new AbortController();
return controller.signal;
}
});
var abort_signal_default = AbortSignalPlugin;
// web/blob.ts
var import_seroval2 = require("seroval");
var BlobPlugin = /* @__PURE__ */ (0, import_seroval2.createPlugin)({
tag: "seroval-plugins/web/Blob",
test(value) {
if (typeof Blob === "undefined") {
return false;
}
return value instanceof Blob;
},
parse: {
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
buffer: await ctx.parse(await value.arrayBuffer())
};
}
},
serialize(node, ctx) {
return "new Blob([" + ctx.serialize(node.buffer) + "],{type:" + ctx.serialize(node.type) + "})";
},
deserialize(node, ctx) {
return new Blob([ctx.deserialize(node.buffer)], {
type: ctx.deserialize(node.type)
});
}
});
var blob_default = BlobPlugin;
// web/custom-event.ts
var import_seroval3 = require("seroval");
function createCustomEventOptions(current) {
return {
detail: current.detail,
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed
};
}
var CustomEventPlugin = /* @__PURE__ */ (0, import_seroval3.createPlugin)({
tag: "seroval-plugins/web/CustomEvent",
test(value) {
if (typeof CustomEvent === "undefined") {
return false;
}
return value instanceof CustomEvent;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value))
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createCustomEventOptions(value))
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value))
};
}
},
serialize(node, ctx) {
return "new CustomEvent(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new CustomEvent(
ctx.deserialize(node.type),
ctx.deserialize(node.options)
);
}
});
var custom_event_default = CustomEventPlugin;
// web/dom-exception.ts
var import_seroval4 = require("seroval");
var DOMExceptionPlugin = /* @__PURE__ */ (0, import_seroval4.createPlugin)({
tag: "seroval-plugins/web/DOMException",
test(value) {
if (typeof DOMException === "undefined") {
return false;
}
return value instanceof DOMException;
},
parse: {
sync(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message)
};
},
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
message: await ctx.parse(value.message)
};
},
stream(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message)
};
}
},
serialize(node, ctx) {
return "new DOMException(" + ctx.serialize(node.message) + "," + ctx.serialize(node.name) + ")";
},
deserialize(node, ctx) {
return new DOMException(
ctx.deserialize(node.message),
ctx.deserialize(node.name)
);
}
});
var dom_exception_default = DOMExceptionPlugin;
// web/event.ts
var import_seroval5 = require("seroval");
function createEventOptions(current) {
return {
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed
};
}
var EventPlugin = /* @__PURE__ */ (0, import_seroval5.createPlugin)({
tag: "seroval-plugins/web/Event",
test(value) {
if (typeof Event === "undefined") {
return false;
}
return value instanceof Event;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value))
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createEventOptions(value))
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value))
};
}
},
serialize(node, ctx) {
return "new Event(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Event(
ctx.deserialize(node.type),
ctx.deserialize(node.options)
);
}
});
var event_default = EventPlugin;
// web/file.ts
var import_seroval6 = require("seroval");
var FilePlugin = /* @__PURE__ */ (0, import_seroval6.createPlugin)({
tag: "seroval-plugins/web/File",
test(value) {
if (typeof File === "undefined") {
return false;
}
return value instanceof File;
},
parse: {
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
options: await ctx.parse({
type: value.type,
lastModified: value.lastModified
}),
buffer: await ctx.parse(await value.arrayBuffer())
};
}
},
serialize(node, ctx) {
return "new File([" + ctx.serialize(node.buffer) + "]," + ctx.serialize(node.name) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new File(
[ctx.deserialize(node.buffer)],
ctx.deserialize(node.name),
ctx.deserialize(node.options)
);
}
});
var file_default = FilePlugin;
// web/form-data.ts
var import_seroval7 = require("seroval");
function convertFormData(instance) {
const items = [];
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
var FORM_DATA_FACTORY = {};
var FORM_DATA_FACTORY_CONSTRUCTOR = (e, f = new FormData(), i = 0, s = e.length, t) => {
for (; i < s; i++) {
t = e[i];
f.append(t[0], t[1]);
}
return f;
};
var FormDataFactoryPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
tag: "seroval-plugins/web/FormDataFactory",
test(value) {
return value === FORM_DATA_FACTORY;
},
parse: {
sync() {
return FORM_DATA_FACTORY;
},
async async() {
return await Promise.resolve(FORM_DATA_FACTORY);
},
stream() {
return FORM_DATA_FACTORY;
}
},
serialize() {
return FORM_DATA_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return FORM_DATA_FACTORY;
}
});
var FormDataPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
tag: "seroval-plugins/web/FormData",
extends: [file_default, FormDataFactoryPlugin],
test(value) {
if (typeof FormData === "undefined") {
return false;
}
return value instanceof FormData;
},
parse: {
sync(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value))
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(FORM_DATA_FACTORY),
entries: await ctx.parse(convertFormData(value))
};
},
stream(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value))
};
}
},
serialize(node, ctx) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.entries) + ")";
},
deserialize(node, ctx) {
return FORM_DATA_FACTORY_CONSTRUCTOR(
ctx.deserialize(node.entries)
);
}
});
var form_data_default = FormDataPlugin;
// web/headers.ts
var import_seroval8 = require("seroval");
function convertHeaders(instance) {
const items = [];
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
var HeadersPlugin = /* @__PURE__ */ (0, import_seroval8.createPlugin)({
tag: "seroval-plugins/web/Headers",
test(value) {
if (typeof Headers === "undefined") {
return false;
}
return value instanceof Headers;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(convertHeaders(value))
};
},
async async(value, ctx) {
return {
value: await ctx.parse(convertHeaders(value))
};
},
stream(value, ctx) {
return {
value: ctx.parse(convertHeaders(value))
};
}
},
serialize(node, ctx) {
return "new Headers(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new Headers(ctx.deserialize(node.value));
}
});
var headers_default = HeadersPlugin;
// web/image-data.ts
var import_seroval9 = require("seroval");
var ImageDataPlugin = /* @__PURE__ */ (0, import_seroval9.createPlugin)({
tag: "seroval-plugins/web/ImageData",
test(value) {
if (typeof ImageData === "undefined") {
return false;
}
return value instanceof ImageData;
},
parse: {
sync(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace
})
};
},
async async(value, ctx) {
return {
data: await ctx.parse(value.data),
width: await ctx.parse(value.width),
height: await ctx.parse(value.height),
options: await ctx.parse({
colorSpace: value.colorSpace
})
};
},
stream(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace
})
};
}
},
serialize(node, ctx) {
return "new ImageData(" + ctx.serialize(node.data) + "," + ctx.serialize(node.width) + "," + ctx.serialize(node.height) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new ImageData(
ctx.deserialize(node.data),
ctx.deserialize(node.width),
ctx.deserialize(node.height),
ctx.deserialize(node.options)
);
}
});
var image_data_default = ImageDataPlugin;
// web/readable-stream.ts
var import_seroval10 = require("seroval");
var READABLE_STREAM_FACTORY = {};
var READABLE_STREAM_FACTORY_CONSTRUCTOR = (stream) => new ReadableStream({
start: (controller) => {
stream.on({
next: (value) => {
try {
controller.enqueue(value);
} catch (_error) {
}
},
throw: (value) => {
controller.error(value);
},
return: () => {
try {
controller.close();
} catch (_error) {
}
}
});
}
});
var ReadableStreamFactoryPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
tag: "seroval-plugins/web/ReadableStreamFactory",
test(value) {
return value === READABLE_STREAM_FACTORY;
},
parse: {
sync() {
return READABLE_STREAM_FACTORY;
},
async async() {
return await Promise.resolve(READABLE_STREAM_FACTORY);
},
stream() {
return READABLE_STREAM_FACTORY;
}
},
serialize() {
return READABLE_STREAM_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return READABLE_STREAM_FACTORY;
}
});
function toStream(value) {
const stream = (0, import_seroval10.createStream)();
const reader = value.getReader();
async function push() {
try {
const result = await reader.read();
if (result.done) {
stream.return(result.value);
} else {
stream.next(result.value);
await push();
}
} catch (error) {
stream.throw(error);
}
}
push().catch(() => {
});
return stream;
}
var ReadableStreamPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
tag: "seroval/plugins/web/ReadableStream",
extends: [ReadableStreamFactoryPlugin],
test(value) {
if (typeof ReadableStream === "undefined") {
return false;
}
return value instanceof ReadableStream;
},
parse: {
sync(_value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse((0, import_seroval10.createStream)())
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(READABLE_STREAM_FACTORY),
stream: await ctx.parse(toStream(value))
};
},
stream(value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse(toStream(value))
};
}
},
serialize(node, ctx) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.stream) + ")";
},
deserialize(node, ctx) {
const stream = ctx.deserialize(node.stream);
return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
}
});
var readable_stream_default = ReadableStreamPlugin;
// web/request.ts
var import_seroval11 = require("seroval");
function createRequestOptions(current, body) {
return {
body,
cache: current.cache,
credentials: current.credentials,
headers: current.headers,
integrity: current.integrity,
keepalive: current.keepalive,
method: current.method,
mode: current.mode,
redirect: current.redirect,
referrer: current.referrer,
referrerPolicy: current.referrerPolicy
};
}
var RequestPlugin = /* @__PURE__ */ (0, import_seroval11.createPlugin)({
tag: "seroval-plugins/web/Request",
extends: [readable_stream_default, headers_default],
test(value) {
if (typeof Request === "undefined") {
return false;
}
return value instanceof Request;
},
parse: {
async async(value, ctx) {
return {
url: await ctx.parse(value.url),
options: await ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
)
)
};
},
stream(value, ctx) {
return {
url: ctx.parse(value.url),
options: ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed ? value.clone().body : null
)
)
};
}
},
serialize(node, ctx) {
return "new Request(" + ctx.serialize(node.url) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Request(
ctx.deserialize(node.url),
ctx.deserialize(node.options)
);
}
});
var request_default = RequestPlugin;
// web/response.ts
var import_seroval12 = require("seroval");
function createResponseOptions(current) {
return {
headers: current.headers,
status: current.status,
statusText: current.statusText
};
}
var ResponsePlugin = /* @__PURE__ */ (0, import_seroval12.createPlugin)({
tag: "seroval-plugins/web/Response",
extends: [readable_stream_default, headers_default],
test(value) {
if (typeof Response === "undefined") {
return false;
}
return value instanceof Response;
},
parse: {
async async(value, ctx) {
return {
body: await ctx.parse(
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
),
options: await ctx.parse(createResponseOptions(value))
};
},
stream(value, ctx) {
return {
body: ctx.parse(
value.body && !value.bodyUsed ? value.clone().body : null
),
options: ctx.parse(createResponseOptions(value))
};
}
},
serialize(node, ctx) {
return "new Response(" + ctx.serialize(node.body) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Response(
ctx.deserialize(node.body),
ctx.deserialize(node.options)
);
}
});
var response_default = ResponsePlugin;
// web/url.ts
var import_seroval13 = require("seroval");
var URLPlugin = /* @__PURE__ */ (0, import_seroval13.createPlugin)({
tag: "seroval-plugins/web/URL",
test(value) {
if (typeof URL === "undefined") {
return false;
}
return value instanceof URL;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.href)
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.href)
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.href)
};
}
},
serialize(node, ctx) {
return "new URL(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new URL(ctx.deserialize(node.value));
}
});
var url_default = URLPlugin;
// web/url-search-params.ts
var import_seroval14 = require("seroval");
var URLSearchParamsPlugin = /* @__PURE__ */ (0, import_seroval14.createPlugin)({
tag: "seroval-plugins/web/URLSearchParams",
test(value) {
if (typeof URLSearchParams === "undefined") {
return false;
}
return value instanceof URLSearchParams;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.toString())
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.toString())
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.toString())
};
}
},
serialize(node, ctx) {
return "new URLSearchParams(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new URLSearchParams(ctx.deserialize(node.value));
}
});
var url_search_params_default = URLSearchParamsPlugin;
//# sourceMappingURL=web.cjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,795 @@
// web/abort-signal.ts
import { createPlugin } from "seroval";
var PROMISE_TO_ABORT_SIGNAL = (promise) => {
const controller = new AbortController();
const abort = controller.abort.bind(controller);
promise.then(abort, abort);
return controller;
};
function resolveAbortSignalResult(resolve) {
resolve(this.reason);
}
function resolveAbortSignal(resolve) {
this.addEventListener("abort", resolveAbortSignalResult.bind(this, resolve), {
once: true
});
}
function abortSignalToPromise(signal) {
return new Promise(resolveAbortSignal.bind(signal));
}
var ABORT_CONTROLLER = {};
var AbortControllerFactoryPlugin = /* @__PURE__ */ createPlugin({
tag: "seroval-plugins/web/AbortControllerFactoryPlugin",
test(value) {
return value === ABORT_CONTROLLER;
},
parse: {
sync() {
return ABORT_CONTROLLER;
},
async async() {
return await Promise.resolve(ABORT_CONTROLLER);
},
stream() {
return ABORT_CONTROLLER;
}
},
serialize() {
return PROMISE_TO_ABORT_SIGNAL.toString();
},
deserialize() {
return PROMISE_TO_ABORT_SIGNAL;
}
});
var AbortSignalPlugin = /* @__PURE__ */ createPlugin({
tag: "seroval-plugins/web/AbortSignal",
extends: [AbortControllerFactoryPlugin],
test(value) {
if (typeof AbortSignal === "undefined") {
return false;
}
return value instanceof AbortSignal;
},
parse: {
sync(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason)
};
}
return {};
},
async async(value, ctx) {
if (value.aborted) {
return {
reason: await ctx.parse(value.reason)
};
}
const result = await abortSignalToPromise(value);
return {
reason: await ctx.parse(result)
};
},
stream(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason)
};
}
const promise = abortSignalToPromise(value);
return {
factory: ctx.parse(ABORT_CONTROLLER),
controller: ctx.parse(promise)
};
}
},
serialize(node, ctx) {
if (node.reason) {
return "AbortSignal.abort(" + ctx.serialize(node.reason) + ")";
}
if (node.controller && node.factory) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.controller) + ").signal";
}
return "(new AbortController).signal";
},
deserialize(node, ctx) {
if (node.reason) {
return AbortSignal.abort(ctx.deserialize(node.reason));
}
if (node.controller) {
return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
}
const controller = new AbortController();
return controller.signal;
}
});
var abort_signal_default = AbortSignalPlugin;
// web/blob.ts
import { createPlugin as createPlugin2 } from "seroval";
var BlobPlugin = /* @__PURE__ */ createPlugin2({
tag: "seroval-plugins/web/Blob",
test(value) {
if (typeof Blob === "undefined") {
return false;
}
return value instanceof Blob;
},
parse: {
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
buffer: await ctx.parse(await value.arrayBuffer())
};
}
},
serialize(node, ctx) {
return "new Blob([" + ctx.serialize(node.buffer) + "],{type:" + ctx.serialize(node.type) + "})";
},
deserialize(node, ctx) {
return new Blob([ctx.deserialize(node.buffer)], {
type: ctx.deserialize(node.type)
});
}
});
var blob_default = BlobPlugin;
// web/custom-event.ts
import { createPlugin as createPlugin3 } from "seroval";
function createCustomEventOptions(current) {
return {
detail: current.detail,
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed
};
}
var CustomEventPlugin = /* @__PURE__ */ createPlugin3({
tag: "seroval-plugins/web/CustomEvent",
test(value) {
if (typeof CustomEvent === "undefined") {
return false;
}
return value instanceof CustomEvent;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value))
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createCustomEventOptions(value))
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value))
};
}
},
serialize(node, ctx) {
return "new CustomEvent(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new CustomEvent(
ctx.deserialize(node.type),
ctx.deserialize(node.options)
);
}
});
var custom_event_default = CustomEventPlugin;
// web/dom-exception.ts
import { createPlugin as createPlugin4 } from "seroval";
var DOMExceptionPlugin = /* @__PURE__ */ createPlugin4({
tag: "seroval-plugins/web/DOMException",
test(value) {
if (typeof DOMException === "undefined") {
return false;
}
return value instanceof DOMException;
},
parse: {
sync(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message)
};
},
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
message: await ctx.parse(value.message)
};
},
stream(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message)
};
}
},
serialize(node, ctx) {
return "new DOMException(" + ctx.serialize(node.message) + "," + ctx.serialize(node.name) + ")";
},
deserialize(node, ctx) {
return new DOMException(
ctx.deserialize(node.message),
ctx.deserialize(node.name)
);
}
});
var dom_exception_default = DOMExceptionPlugin;
// web/event.ts
import { createPlugin as createPlugin5 } from "seroval";
function createEventOptions(current) {
return {
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed
};
}
var EventPlugin = /* @__PURE__ */ createPlugin5({
tag: "seroval-plugins/web/Event",
test(value) {
if (typeof Event === "undefined") {
return false;
}
return value instanceof Event;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value))
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createEventOptions(value))
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value))
};
}
},
serialize(node, ctx) {
return "new Event(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Event(
ctx.deserialize(node.type),
ctx.deserialize(node.options)
);
}
});
var event_default = EventPlugin;
// web/file.ts
import { createPlugin as createPlugin6 } from "seroval";
var FilePlugin = /* @__PURE__ */ createPlugin6({
tag: "seroval-plugins/web/File",
test(value) {
if (typeof File === "undefined") {
return false;
}
return value instanceof File;
},
parse: {
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
options: await ctx.parse({
type: value.type,
lastModified: value.lastModified
}),
buffer: await ctx.parse(await value.arrayBuffer())
};
}
},
serialize(node, ctx) {
return "new File([" + ctx.serialize(node.buffer) + "]," + ctx.serialize(node.name) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new File(
[ctx.deserialize(node.buffer)],
ctx.deserialize(node.name),
ctx.deserialize(node.options)
);
}
});
var file_default = FilePlugin;
// web/form-data.ts
import { createPlugin as createPlugin7 } from "seroval";
function convertFormData(instance) {
const items = [];
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
var FORM_DATA_FACTORY = {};
var FORM_DATA_FACTORY_CONSTRUCTOR = (e, f = new FormData(), i = 0, s = e.length, t) => {
for (; i < s; i++) {
t = e[i];
f.append(t[0], t[1]);
}
return f;
};
var FormDataFactoryPlugin = /* @__PURE__ */ createPlugin7({
tag: "seroval-plugins/web/FormDataFactory",
test(value) {
return value === FORM_DATA_FACTORY;
},
parse: {
sync() {
return FORM_DATA_FACTORY;
},
async async() {
return await Promise.resolve(FORM_DATA_FACTORY);
},
stream() {
return FORM_DATA_FACTORY;
}
},
serialize() {
return FORM_DATA_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return FORM_DATA_FACTORY;
}
});
var FormDataPlugin = /* @__PURE__ */ createPlugin7({
tag: "seroval-plugins/web/FormData",
extends: [file_default, FormDataFactoryPlugin],
test(value) {
if (typeof FormData === "undefined") {
return false;
}
return value instanceof FormData;
},
parse: {
sync(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value))
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(FORM_DATA_FACTORY),
entries: await ctx.parse(convertFormData(value))
};
},
stream(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value))
};
}
},
serialize(node, ctx) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.entries) + ")";
},
deserialize(node, ctx) {
return FORM_DATA_FACTORY_CONSTRUCTOR(
ctx.deserialize(node.entries)
);
}
});
var form_data_default = FormDataPlugin;
// web/headers.ts
import { createPlugin as createPlugin8 } from "seroval";
function convertHeaders(instance) {
const items = [];
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
var HeadersPlugin = /* @__PURE__ */ createPlugin8({
tag: "seroval-plugins/web/Headers",
test(value) {
if (typeof Headers === "undefined") {
return false;
}
return value instanceof Headers;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(convertHeaders(value))
};
},
async async(value, ctx) {
return {
value: await ctx.parse(convertHeaders(value))
};
},
stream(value, ctx) {
return {
value: ctx.parse(convertHeaders(value))
};
}
},
serialize(node, ctx) {
return "new Headers(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new Headers(ctx.deserialize(node.value));
}
});
var headers_default = HeadersPlugin;
// web/image-data.ts
import { createPlugin as createPlugin9 } from "seroval";
var ImageDataPlugin = /* @__PURE__ */ createPlugin9({
tag: "seroval-plugins/web/ImageData",
test(value) {
if (typeof ImageData === "undefined") {
return false;
}
return value instanceof ImageData;
},
parse: {
sync(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace
})
};
},
async async(value, ctx) {
return {
data: await ctx.parse(value.data),
width: await ctx.parse(value.width),
height: await ctx.parse(value.height),
options: await ctx.parse({
colorSpace: value.colorSpace
})
};
},
stream(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace
})
};
}
},
serialize(node, ctx) {
return "new ImageData(" + ctx.serialize(node.data) + "," + ctx.serialize(node.width) + "," + ctx.serialize(node.height) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new ImageData(
ctx.deserialize(node.data),
ctx.deserialize(node.width),
ctx.deserialize(node.height),
ctx.deserialize(node.options)
);
}
});
var image_data_default = ImageDataPlugin;
// web/readable-stream.ts
import { createPlugin as createPlugin10, createStream } from "seroval";
var READABLE_STREAM_FACTORY = {};
var READABLE_STREAM_FACTORY_CONSTRUCTOR = (stream) => new ReadableStream({
start: (controller) => {
stream.on({
next: (value) => {
try {
controller.enqueue(value);
} catch (_error) {
}
},
throw: (value) => {
controller.error(value);
},
return: () => {
try {
controller.close();
} catch (_error) {
}
}
});
}
});
var ReadableStreamFactoryPlugin = /* @__PURE__ */ createPlugin10({
tag: "seroval-plugins/web/ReadableStreamFactory",
test(value) {
return value === READABLE_STREAM_FACTORY;
},
parse: {
sync() {
return READABLE_STREAM_FACTORY;
},
async async() {
return await Promise.resolve(READABLE_STREAM_FACTORY);
},
stream() {
return READABLE_STREAM_FACTORY;
}
},
serialize() {
return READABLE_STREAM_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return READABLE_STREAM_FACTORY;
}
});
function toStream(value) {
const stream = createStream();
const reader = value.getReader();
async function push() {
try {
const result = await reader.read();
if (result.done) {
stream.return(result.value);
} else {
stream.next(result.value);
await push();
}
} catch (error) {
stream.throw(error);
}
}
push().catch(() => {
});
return stream;
}
var ReadableStreamPlugin = /* @__PURE__ */ createPlugin10({
tag: "seroval/plugins/web/ReadableStream",
extends: [ReadableStreamFactoryPlugin],
test(value) {
if (typeof ReadableStream === "undefined") {
return false;
}
return value instanceof ReadableStream;
},
parse: {
sync(_value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse(createStream())
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(READABLE_STREAM_FACTORY),
stream: await ctx.parse(toStream(value))
};
},
stream(value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse(toStream(value))
};
}
},
serialize(node, ctx) {
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.stream) + ")";
},
deserialize(node, ctx) {
const stream = ctx.deserialize(node.stream);
return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
}
});
var readable_stream_default = ReadableStreamPlugin;
// web/request.ts
import { createPlugin as createPlugin11 } from "seroval";
function createRequestOptions(current, body) {
return {
body,
cache: current.cache,
credentials: current.credentials,
headers: current.headers,
integrity: current.integrity,
keepalive: current.keepalive,
method: current.method,
mode: current.mode,
redirect: current.redirect,
referrer: current.referrer,
referrerPolicy: current.referrerPolicy
};
}
var RequestPlugin = /* @__PURE__ */ createPlugin11({
tag: "seroval-plugins/web/Request",
extends: [readable_stream_default, headers_default],
test(value) {
if (typeof Request === "undefined") {
return false;
}
return value instanceof Request;
},
parse: {
async async(value, ctx) {
return {
url: await ctx.parse(value.url),
options: await ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
)
)
};
},
stream(value, ctx) {
return {
url: ctx.parse(value.url),
options: ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed ? value.clone().body : null
)
)
};
}
},
serialize(node, ctx) {
return "new Request(" + ctx.serialize(node.url) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Request(
ctx.deserialize(node.url),
ctx.deserialize(node.options)
);
}
});
var request_default = RequestPlugin;
// web/response.ts
import { createPlugin as createPlugin12 } from "seroval";
function createResponseOptions(current) {
return {
headers: current.headers,
status: current.status,
statusText: current.statusText
};
}
var ResponsePlugin = /* @__PURE__ */ createPlugin12({
tag: "seroval-plugins/web/Response",
extends: [readable_stream_default, headers_default],
test(value) {
if (typeof Response === "undefined") {
return false;
}
return value instanceof Response;
},
parse: {
async async(value, ctx) {
return {
body: await ctx.parse(
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
),
options: await ctx.parse(createResponseOptions(value))
};
},
stream(value, ctx) {
return {
body: ctx.parse(
value.body && !value.bodyUsed ? value.clone().body : null
),
options: ctx.parse(createResponseOptions(value))
};
}
},
serialize(node, ctx) {
return "new Response(" + ctx.serialize(node.body) + "," + ctx.serialize(node.options) + ")";
},
deserialize(node, ctx) {
return new Response(
ctx.deserialize(node.body),
ctx.deserialize(node.options)
);
}
});
var response_default = ResponsePlugin;
// web/url.ts
import { createPlugin as createPlugin13 } from "seroval";
var URLPlugin = /* @__PURE__ */ createPlugin13({
tag: "seroval-plugins/web/URL",
test(value) {
if (typeof URL === "undefined") {
return false;
}
return value instanceof URL;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.href)
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.href)
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.href)
};
}
},
serialize(node, ctx) {
return "new URL(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new URL(ctx.deserialize(node.value));
}
});
var url_default = URLPlugin;
// web/url-search-params.ts
import { createPlugin as createPlugin14 } from "seroval";
var URLSearchParamsPlugin = /* @__PURE__ */ createPlugin14({
tag: "seroval-plugins/web/URLSearchParams",
test(value) {
if (typeof URLSearchParams === "undefined") {
return false;
}
return value instanceof URLSearchParams;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.toString())
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.toString())
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.toString())
};
}
},
serialize(node, ctx) {
return "new URLSearchParams(" + ctx.serialize(node.value) + ")";
},
deserialize(node, ctx) {
return new URLSearchParams(ctx.deserialize(node.value));
}
});
var url_search_params_default = URLSearchParamsPlugin;
export {
abort_signal_default as AbortSignalPlugin,
blob_default as BlobPlugin,
custom_event_default as CustomEventPlugin,
dom_exception_default as DOMExceptionPlugin,
event_default as EventPlugin,
file_default as FilePlugin,
form_data_default as FormDataPlugin,
headers_default as HeadersPlugin,
image_data_default as ImageDataPlugin,
readable_stream_default as ReadableStreamPlugin,
request_default as RequestPlugin,
response_default as ResponsePlugin,
url_default as URLPlugin,
url_search_params_default as URLSearchParamsPlugin
};
//# sourceMappingURL=web.mjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
declare const AbortSignalPlugin: any;
export default AbortSignalPlugin;
//# sourceMappingURL=abort-signal.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"abort-signal.d.ts","sourceRoot":"","sources":["../../../web/abort-signal.ts"],"names":[],"mappings":"AAwDA,QAAA,MAAM,iBAAiB,KAwErB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const BlobPlugin: any;
export default BlobPlugin;
//# sourceMappingURL=blob.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blob.d.ts","sourceRoot":"","sources":["../../../web/blob.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU,KA8Bd,CAAC;AAEH,eAAe,UAAU,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const CustomEventPlugin: any;
export default CustomEventPlugin;
//# sourceMappingURL=custom-event.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"custom-event.d.ts","sourceRoot":"","sources":["../../../web/custom-event.ts"],"names":[],"mappings":"AAiBA,QAAA,MAAM,iBAAiB,KA8CrB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const DOMExceptionPlugin: any;
export default DOMExceptionPlugin;
//# sourceMappingURL=dom-exception.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dom-exception.d.ts","sourceRoot":"","sources":["../../../web/dom-exception.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,kBAAkB,KA8CtB,CAAC;AAEH,eAAe,kBAAkB,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const EventPlugin: any;
export default EventPlugin;
//# sourceMappingURL=event.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../web/event.ts"],"names":[],"mappings":"AAgBA,QAAA,MAAM,WAAW,KA2Cf,CAAC;AAEH,eAAe,WAAW,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const FilePlugin: any;
export default FilePlugin;
//# sourceMappingURL=file.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../web/file.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,UAAU,KAsCd,CAAC;AAEH,eAAe,UAAU,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const FormDataPlugin: any;
export default FormDataPlugin;
//# sourceMappingURL=form-data.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"form-data.d.ts","sourceRoot":"","sources":["../../../web/form-data.ts"],"names":[],"mappings":"AA2DA,QAAA,MAAM,cAAc,KA2ClB,CAAC;AAEH,eAAe,cAAc,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const HeadersPlugin: any;
export default HeadersPlugin;
//# sourceMappingURL=headers.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../web/headers.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,aAAa,KAkCjB,CAAC;AAEH,eAAe,aAAa,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const ImageDataPlugin: any;
export default ImageDataPlugin;
//# sourceMappingURL=image-data.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image-data.d.ts","sourceRoot":"","sources":["../../../web/image-data.ts"],"names":[],"mappings":"AAUA,QAAA,MAAM,eAAe,KA6DnB,CAAC;AAEH,eAAe,eAAe,CAAC"}

15
node_modules/seroval-plugins/dist/types/web/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export { default as AbortSignalPlugin } from './abort-signal';
export { default as BlobPlugin } from './blob';
export { default as CustomEventPlugin } from './custom-event';
export { default as DOMExceptionPlugin } from './dom-exception';
export { default as EventPlugin } from './event';
export { default as FilePlugin } from './file';
export { default as FormDataPlugin } from './form-data';
export { default as HeadersPlugin } from './headers';
export { default as ImageDataPlugin } from './image-data';
export { default as ReadableStreamPlugin } from './readable-stream';
export { default as RequestPlugin } from './request';
export { default as ResponsePlugin } from './response';
export { default as URLPlugin } from './url';
export { default as URLSearchParamsPlugin } from './url-search-params';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const ReadableStreamPlugin: any;
export default ReadableStreamPlugin;
//# sourceMappingURL=readable-stream.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"readable-stream.d.ts","sourceRoot":"","sources":["../../../web/readable-stream.ts"],"names":[],"mappings":"AAqFA,QAAA,MAAM,oBAAoB,KA6CxB,CAAC;AAEH,eAAe,oBAAoB,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const RequestPlugin: any;
export default RequestPlugin;
//# sourceMappingURL=request.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../web/request.ts"],"names":[],"mappings":"AA6BA,QAAA,MAAM,aAAa,KAkDjB,CAAC;AAEH,eAAe,aAAa,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const ResponsePlugin: any;
export default ResponsePlugin;
//# sourceMappingURL=response.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../web/response.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,cAAc,KA4ClB,CAAC;AAEH,eAAe,cAAc,CAAC"}

View File

@@ -0,0 +1,3 @@
declare const URLSearchParamsPlugin: any;
export default URLSearchParamsPlugin;
//# sourceMappingURL=url-search-params.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"url-search-params.d.ts","sourceRoot":"","sources":["../../../web/url-search-params.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qBAAqB,KAkCzB,CAAC;AAEH,eAAe,qBAAqB,CAAC"}

3
node_modules/seroval-plugins/dist/types/web/url.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const URLPlugin: any;
export default URLPlugin;
//# sourceMappingURL=url.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../web/url.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,SAAS,KA+Bb,CAAC;AAEH,eAAe,SAAS,CAAC"}

70
node_modules/seroval-plugins/package.json generated vendored Normal file
View File

@@ -0,0 +1,70 @@
{
"name": "seroval-plugins",
"type": "module",
"version": "1.5.2",
"files": [
"dist",
"web"
],
"engines": {
"node": ">=10"
},
"license": "MIT",
"keywords": [
"pridepack"
],
"devDependencies": {
"@types/node": "^24.10.0",
"@vitest/ui": "^4.0.6",
"pridepack": "2.6.4",
"seroval": "1.5.2",
"tslib": "^2.8.1",
"typescript": "^5.9.3",
"vitest": "^4.0.6"
},
"peerDependencies": {
"seroval": "^1.0"
},
"private": false,
"description": "Stringify JS values",
"repository": {
"url": "https://github.com/lxsmnsyc/seroval.git",
"type": "git"
},
"homepage": "https://github.com/lxsmnsyc/seroval/tree/main/packages/plugins",
"bugs": {
"url": "https://github.com/lxsmnsyc/seroval/issues"
},
"publishConfig": {
"access": "public"
},
"author": "Alexis Munsayac",
"exports": {
"./web": {
"types": "./dist/types/web/index.d.ts",
"development": {
"require": "./dist/cjs/development/web.cjs",
"import": "./dist/esm/development/web.mjs"
},
"require": "./dist/cjs/production/web.cjs",
"import": "./dist/esm/production/web.mjs"
}
},
"typesVersions": {
"*": {
"web": [
"./dist/types/web/index.d.ts"
]
}
},
"scripts": {
"build": "pridepack build",
"type-check": "pridepack check",
"clean": "pridepack clean",
"watch": "pridepack watch",
"start": "pridepack start",
"dev": "pridepack dev",
"test": "vitest",
"test:ui": "vitest --ui"
}
}

131
node_modules/seroval-plugins/web/abort-signal.ts generated vendored Normal file
View File

@@ -0,0 +1,131 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
const PROMISE_TO_ABORT_SIGNAL = (promise: Promise<unknown>) => {
const controller = new AbortController();
const abort = controller.abort.bind(controller);
promise.then(abort, abort);
return controller;
};
function resolveAbortSignalResult(
this: AbortSignal,
resolve: (value: unknown) => void,
): void {
resolve(this.reason);
}
function resolveAbortSignal(
this: AbortSignal,
resolve: (value: unknown) => void,
): void {
this.addEventListener('abort', resolveAbortSignalResult.bind(this, resolve), {
once: true,
});
}
function abortSignalToPromise(signal: AbortSignal): Promise<unknown> {
return new Promise(resolveAbortSignal.bind(signal));
}
const ABORT_CONTROLLER = {};
const AbortControllerFactoryPlugin = /* @__PURE__ */ createPlugin<object, {}>({
tag: 'seroval-plugins/web/AbortControllerFactoryPlugin',
test(value) {
return value === ABORT_CONTROLLER;
},
parse: {
sync() {
return ABORT_CONTROLLER;
},
async async() {
return await Promise.resolve(ABORT_CONTROLLER);
},
stream() {
return ABORT_CONTROLLER;
},
},
serialize() {
return PROMISE_TO_ABORT_SIGNAL.toString();
},
deserialize() {
return PROMISE_TO_ABORT_SIGNAL;
},
});
const AbortSignalPlugin = /* @__PURE__ */ createPlugin<
AbortSignal,
{ reason?: SerovalNode; controller?: SerovalNode; factory?: SerovalNode }
>({
tag: 'seroval-plugins/web/AbortSignal',
extends: [AbortControllerFactoryPlugin],
test(value) {
if (typeof AbortSignal === 'undefined') {
return false;
}
return value instanceof AbortSignal;
},
parse: {
sync(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason),
};
}
return {};
},
async async(value, ctx) {
if (value.aborted) {
return {
reason: await ctx.parse(value.reason),
};
}
const result = await abortSignalToPromise(value);
return {
reason: await ctx.parse(result),
};
},
stream(value, ctx) {
if (value.aborted) {
return {
reason: ctx.parse(value.reason),
};
}
const promise = abortSignalToPromise(value);
return {
factory: ctx.parse(ABORT_CONTROLLER),
controller: ctx.parse(promise),
};
},
},
serialize(node, ctx) {
if (node.reason) {
return 'AbortSignal.abort(' + ctx.serialize(node.reason) + ')';
}
if (node.controller && node.factory) {
return (
'(' +
ctx.serialize(node.factory) +
')(' +
ctx.serialize(node.controller) +
').signal'
);
}
return '(new AbortController).signal';
},
deserialize(node, ctx) {
if (node.reason) {
return AbortSignal.abort(ctx.deserialize(node.reason));
}
if (node.controller) {
return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
}
const controller = new AbortController();
return controller.signal;
},
});
export default AbortSignalPlugin;

41
node_modules/seroval-plugins/web/blob.ts generated vendored Normal file
View File

@@ -0,0 +1,41 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
type BlobNode = {
type: SerovalNode;
buffer: SerovalNode;
};
const BlobPlugin = /* @__PURE__ */ createPlugin<Blob, BlobNode>({
tag: 'seroval-plugins/web/Blob',
test(value) {
if (typeof Blob === 'undefined') {
return false;
}
return value instanceof Blob;
},
parse: {
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
buffer: await ctx.parse(await value.arrayBuffer()),
};
},
},
serialize(node, ctx) {
return (
'new Blob([' +
ctx.serialize(node.buffer) +
'],{type:' +
ctx.serialize(node.type) +
'})'
);
},
deserialize(node, ctx) {
return new Blob([ctx.deserialize(node.buffer) as ArrayBuffer], {
type: ctx.deserialize(node.type) as string,
});
},
});
export default BlobPlugin;

66
node_modules/seroval-plugins/web/custom-event.ts generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
function createCustomEventOptions(current: CustomEvent): CustomEventInit {
return {
detail: current.detail as unknown,
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed,
};
}
type CustomEventNode = {
type: SerovalNode;
options: SerovalNode;
};
const CustomEventPlugin = /* @__PURE__ */ createPlugin<
CustomEvent,
CustomEventNode
>({
tag: 'seroval-plugins/web/CustomEvent',
test(value) {
if (typeof CustomEvent === 'undefined') {
return false;
}
return value instanceof CustomEvent;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value)),
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createCustomEventOptions(value)),
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createCustomEventOptions(value)),
};
},
},
serialize(node, ctx) {
return (
'new CustomEvent(' +
ctx.serialize(node.type) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new CustomEvent(
ctx.deserialize(node.type) as string,
ctx.deserialize(node.options) as CustomEventInit,
);
},
});
export default CustomEventPlugin;

57
node_modules/seroval-plugins/web/dom-exception.ts generated vendored Normal file
View File

@@ -0,0 +1,57 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
type DOMExceptionNode = {
name: SerovalNode;
message: SerovalNode;
};
const DOMExceptionPlugin = /* @__PURE__ */ createPlugin<
DOMException,
DOMExceptionNode
>({
tag: 'seroval-plugins/web/DOMException',
test(value) {
if (typeof DOMException === 'undefined') {
return false;
}
return value instanceof DOMException;
},
parse: {
sync(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message),
};
},
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
message: await ctx.parse(value.message),
};
},
stream(value, ctx) {
return {
name: ctx.parse(value.name),
message: ctx.parse(value.message),
};
},
},
serialize(node, ctx) {
return (
'new DOMException(' +
ctx.serialize(node.message) +
',' +
ctx.serialize(node.name) +
')'
);
},
deserialize(node, ctx) {
return new DOMException(
ctx.deserialize(node.message) as string,
ctx.deserialize(node.name) as string,
);
},
});
export default DOMExceptionPlugin;

62
node_modules/seroval-plugins/web/event.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
function createEventOptions(current: Event): EventInit {
return {
bubbles: current.bubbles,
cancelable: current.cancelable,
composed: current.composed,
};
}
type EventNode = {
type: SerovalNode;
options: SerovalNode;
};
const EventPlugin = /* @__PURE__ */ createPlugin<Event, EventNode>({
tag: 'seroval-plugins/web/Event',
test(value) {
if (typeof Event === 'undefined') {
return false;
}
return value instanceof Event;
},
parse: {
sync(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value)),
};
},
async async(value, ctx) {
return {
type: await ctx.parse(value.type),
options: await ctx.parse(createEventOptions(value)),
};
},
stream(value, ctx) {
return {
type: ctx.parse(value.type),
options: ctx.parse(createEventOptions(value)),
};
},
},
serialize(node, ctx) {
return (
'new Event(' +
ctx.serialize(node.type) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new Event(
ctx.deserialize(node.type) as string,
ctx.deserialize(node.options) as EventInit,
);
},
});
export default EventPlugin;

50
node_modules/seroval-plugins/web/file.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
type FileNode = {
name: SerovalNode;
options: SerovalNode;
buffer: SerovalNode;
};
const FilePlugin = /* @__PURE__ */ createPlugin<File, FileNode>({
tag: 'seroval-plugins/web/File',
test(value) {
if (typeof File === 'undefined') {
return false;
}
return value instanceof File;
},
parse: {
async async(value, ctx) {
return {
name: await ctx.parse(value.name),
options: await ctx.parse({
type: value.type,
lastModified: value.lastModified,
}),
buffer: await ctx.parse(await value.arrayBuffer()),
};
},
},
serialize(node, ctx) {
return (
'new File([' +
ctx.serialize(node.buffer) +
'],' +
ctx.serialize(node.name) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new File(
[ctx.deserialize(node.buffer) as ArrayBuffer],
ctx.deserialize(node.name) as string,
ctx.deserialize(node.options) as FilePropertyBag,
);
},
});
export default FilePlugin;

105
node_modules/seroval-plugins/web/form-data.ts generated vendored Normal file
View File

@@ -0,0 +1,105 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
import FilePlugin from './file';
type FormDataInit = [key: string, value: FormDataEntryValue][];
function convertFormData(instance: FormData): FormDataInit {
const items: FormDataInit = [];
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
const FORM_DATA_FACTORY = {};
const FORM_DATA_FACTORY_CONSTRUCTOR = (
e: [key: string, value: FormDataEntryValue][],
f = new FormData(),
i = 0,
s = e.length,
t?: [key: string, value: FormDataEntryValue],
) => {
for (; i < s; i++) {
t = e[i];
f.append(t[0], t[1]);
}
return f;
};
const FormDataFactoryPlugin = /* @__PURE__ */ createPlugin<object, {}>({
tag: 'seroval-plugins/web/FormDataFactory',
test(value) {
return value === FORM_DATA_FACTORY;
},
parse: {
sync() {
return FORM_DATA_FACTORY;
},
async async() {
return await Promise.resolve(FORM_DATA_FACTORY);
},
stream() {
return FORM_DATA_FACTORY;
},
},
serialize() {
return FORM_DATA_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return FORM_DATA_FACTORY;
},
});
type FormDataNode = {
factory: SerovalNode;
entries: SerovalNode;
};
const FormDataPlugin = /* @__PURE__ */ createPlugin<FormData, FormDataNode>({
tag: 'seroval-plugins/web/FormData',
extends: [FilePlugin, FormDataFactoryPlugin],
test(value) {
if (typeof FormData === 'undefined') {
return false;
}
return value instanceof FormData;
},
parse: {
sync(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value)),
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(FORM_DATA_FACTORY),
entries: await ctx.parse(convertFormData(value)),
};
},
stream(value, ctx) {
return {
factory: ctx.parse(FORM_DATA_FACTORY),
entries: ctx.parse(convertFormData(value)),
};
},
},
serialize(node, ctx) {
return (
'(' +
ctx.serialize(node.factory) +
')(' +
ctx.serialize(node.entries) +
')'
);
},
deserialize(node, ctx) {
return FORM_DATA_FACTORY_CONSTRUCTOR(
ctx.deserialize(node.entries) as FormDataInit,
);
},
});
export default FormDataPlugin;

49
node_modules/seroval-plugins/web/headers.ts generated vendored Normal file
View File

@@ -0,0 +1,49 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
function convertHeaders(instance: Headers): HeadersInit {
const items: HeadersInit = [];
// biome-ignore lint/complexity/noForEach: <explanation>
instance.forEach((value, key) => {
items.push([key, value]);
});
return items;
}
const HeadersPlugin = /* @__PURE__ */ createPlugin<
Headers,
{ value: SerovalNode }
>({
tag: 'seroval-plugins/web/Headers',
test(value) {
if (typeof Headers === 'undefined') {
return false;
}
return value instanceof Headers;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(convertHeaders(value)),
};
},
async async(value, ctx) {
return {
value: await ctx.parse(convertHeaders(value)),
};
},
stream(value, ctx) {
return {
value: ctx.parse(convertHeaders(value)),
};
},
},
serialize(node, ctx) {
return 'new Headers(' + ctx.serialize(node.value) + ')';
},
deserialize(node, ctx) {
return new Headers(ctx.deserialize(node.value) as HeadersInit);
},
});
export default HeadersPlugin;

74
node_modules/seroval-plugins/web/image-data.ts generated vendored Normal file
View File

@@ -0,0 +1,74 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
type ImageDataNode = {
data: SerovalNode;
width: SerovalNode;
height: SerovalNode;
options: SerovalNode;
};
const ImageDataPlugin = /* @__PURE__ */ createPlugin<ImageData, ImageDataNode>({
tag: 'seroval-plugins/web/ImageData',
test(value) {
if (typeof ImageData === 'undefined') {
return false;
}
return value instanceof ImageData;
},
parse: {
sync(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace,
}),
};
},
async async(value, ctx) {
return {
data: await ctx.parse(value.data),
width: await ctx.parse(value.width),
height: await ctx.parse(value.height),
options: await ctx.parse({
colorSpace: value.colorSpace,
}),
};
},
stream(value, ctx) {
return {
data: ctx.parse(value.data),
width: ctx.parse(value.width),
height: ctx.parse(value.height),
options: ctx.parse({
colorSpace: value.colorSpace,
}),
};
},
},
serialize(node, ctx) {
return (
'new ImageData(' +
ctx.serialize(node.data) +
',' +
ctx.serialize(node.width) +
',' +
ctx.serialize(node.height) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new ImageData(
ctx.deserialize(node.data) as Uint8ClampedArray<ArrayBuffer>,
ctx.deserialize(node.width) as number,
ctx.deserialize(node.height) as number,
ctx.deserialize(node.options) as ImageDataSettings,
);
},
});
export default ImageDataPlugin;

14
node_modules/seroval-plugins/web/index.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export { default as AbortSignalPlugin } from './abort-signal';
export { default as BlobPlugin } from './blob';
export { default as CustomEventPlugin } from './custom-event';
export { default as DOMExceptionPlugin } from './dom-exception';
export { default as EventPlugin } from './event';
export { default as FilePlugin } from './file';
export { default as FormDataPlugin } from './form-data';
export { default as HeadersPlugin } from './headers';
export { default as ImageDataPlugin } from './image-data';
export { default as ReadableStreamPlugin } from './readable-stream';
export { default as RequestPlugin } from './request';
export { default as ResponsePlugin } from './response';
export { default as URLPlugin } from './url';
export { default as URLSearchParamsPlugin } from './url-search-params';

133
node_modules/seroval-plugins/web/readable-stream.ts generated vendored Normal file
View File

@@ -0,0 +1,133 @@
import type { SerovalNode, Stream } from 'seroval';
import { createPlugin, createStream } from 'seroval';
const READABLE_STREAM_FACTORY = {};
const READABLE_STREAM_FACTORY_CONSTRUCTOR = (stream: Stream<unknown>) =>
new ReadableStream({
start: controller => {
stream.on({
next: value => {
try {
controller.enqueue(value);
} catch (_error) {
// no-op
}
},
throw: value => {
controller.error(value);
},
return: () => {
try {
controller.close();
} catch (_error) {
// no-op
}
},
});
},
});
const ReadableStreamFactoryPlugin = /* @__PURE__ */ createPlugin<object, {}>({
tag: 'seroval-plugins/web/ReadableStreamFactory',
test(value) {
return value === READABLE_STREAM_FACTORY;
},
parse: {
sync() {
return READABLE_STREAM_FACTORY;
},
async async() {
return await Promise.resolve(READABLE_STREAM_FACTORY);
},
stream() {
return READABLE_STREAM_FACTORY;
},
},
serialize() {
return READABLE_STREAM_FACTORY_CONSTRUCTOR.toString();
},
deserialize() {
return READABLE_STREAM_FACTORY;
},
});
function toStream<T>(value: ReadableStream<T>): Stream<T | undefined> {
const stream = createStream<T | undefined>();
const reader = value.getReader();
async function push(): Promise<void> {
try {
const result = await reader.read();
if (result.done) {
stream.return(result.value);
} else {
stream.next(result.value);
await push();
}
} catch (error) {
stream.throw(error);
}
}
push().catch(() => {
//
});
return stream;
}
type ReadableStreamNode = {
factory: SerovalNode;
stream: SerovalNode;
};
const ReadableStreamPlugin = /* @__PURE__ */ createPlugin<
ReadableStream,
ReadableStreamNode
>({
tag: 'seroval/plugins/web/ReadableStream',
extends: [ReadableStreamFactoryPlugin],
test(value) {
if (typeof ReadableStream === 'undefined') {
return false;
}
return value instanceof ReadableStream;
},
parse: {
sync(_value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse(createStream()),
};
},
async async(value, ctx) {
return {
factory: await ctx.parse(READABLE_STREAM_FACTORY),
stream: await ctx.parse(toStream(value)),
};
},
stream(value, ctx) {
return {
factory: ctx.parse(READABLE_STREAM_FACTORY),
stream: ctx.parse(toStream(value)),
};
},
},
serialize(node, ctx) {
return (
'(' +
ctx.serialize(node.factory) +
')(' +
ctx.serialize(node.stream) +
')'
);
},
deserialize(node, ctx) {
const stream = ctx.deserialize(node.stream) as Stream<any>;
return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
},
});
export default ReadableStreamPlugin;

82
node_modules/seroval-plugins/web/request.ts generated vendored Normal file
View File

@@ -0,0 +1,82 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
import HeadersPlugin from './headers';
import ReadableStreamPlugin from './readable-stream';
function createRequestOptions(
current: Request,
body: ArrayBuffer | ReadableStream | null,
): RequestInit {
return {
body,
cache: current.cache,
credentials: current.credentials,
headers: current.headers,
integrity: current.integrity,
keepalive: current.keepalive,
method: current.method,
mode: current.mode,
redirect: current.redirect,
referrer: current.referrer,
referrerPolicy: current.referrerPolicy,
};
}
type RequestNode = {
url: SerovalNode;
options: SerovalNode;
};
const RequestPlugin = /* @__PURE__ */ createPlugin<Request, RequestNode>({
tag: 'seroval-plugins/web/Request',
extends: [ReadableStreamPlugin, HeadersPlugin],
test(value) {
if (typeof Request === 'undefined') {
return false;
}
return value instanceof Request;
},
parse: {
async async(value, ctx) {
return {
url: await ctx.parse(value.url),
options: await ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed
? await value.clone().arrayBuffer()
: null,
),
),
};
},
stream(value, ctx) {
return {
url: ctx.parse(value.url),
options: ctx.parse(
createRequestOptions(
value,
value.body && !value.bodyUsed ? value.clone().body : null,
),
),
};
},
},
serialize(node, ctx) {
return (
'new Request(' +
ctx.serialize(node.url) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new Request(
ctx.deserialize(node.url) as string,
ctx.deserialize(node.options) as RequestInit,
);
},
});
export default RequestPlugin;

65
node_modules/seroval-plugins/web/response.ts generated vendored Normal file
View File

@@ -0,0 +1,65 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
import HeadersPlugin from './headers';
import ReadableStreamPlugin from './readable-stream';
function createResponseOptions(current: Response): ResponseInit {
return {
headers: current.headers,
status: current.status,
statusText: current.statusText,
};
}
type ResponseNode = {
body: SerovalNode;
options: SerovalNode;
};
const ResponsePlugin = /* @__PURE__ */ createPlugin<Response, ResponseNode>({
tag: 'seroval-plugins/web/Response',
extends: [ReadableStreamPlugin, HeadersPlugin],
test(value) {
if (typeof Response === 'undefined') {
return false;
}
return value instanceof Response;
},
parse: {
async async(value, ctx) {
return {
body: await ctx.parse(
value.body && !value.bodyUsed
? await value.clone().arrayBuffer()
: null,
),
options: await ctx.parse(createResponseOptions(value)),
};
},
stream(value, ctx) {
return {
body: ctx.parse(
value.body && !value.bodyUsed ? value.clone().body : null,
),
options: ctx.parse(createResponseOptions(value)),
};
},
},
serialize(node, ctx) {
return (
'new Response(' +
ctx.serialize(node.body) +
',' +
ctx.serialize(node.options) +
')'
);
},
deserialize(node, ctx) {
return new Response(
ctx.deserialize(node.body) as BodyInit,
ctx.deserialize(node.options) as ResponseInit,
);
},
});
export default ResponsePlugin;

40
node_modules/seroval-plugins/web/url-search-params.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
const URLSearchParamsPlugin = /* @__PURE__ */ createPlugin<
URLSearchParams,
{ value: SerovalNode }
>({
tag: 'seroval-plugins/web/URLSearchParams',
test(value) {
if (typeof URLSearchParams === 'undefined') {
return false;
}
return value instanceof URLSearchParams;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.toString()),
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.toString()),
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.toString()),
};
},
},
serialize(node, ctx) {
return 'new URLSearchParams(' + ctx.serialize(node.value) + ')';
},
deserialize(node, ctx) {
return new URLSearchParams(ctx.deserialize(node.value) as string);
},
});
export default URLSearchParamsPlugin;

37
node_modules/seroval-plugins/web/url.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
import type { SerovalNode } from 'seroval';
import { createPlugin } from 'seroval';
const URLPlugin = /* @__PURE__ */ createPlugin<URL, { value: SerovalNode }>({
tag: 'seroval-plugins/web/URL',
test(value) {
if (typeof URL === 'undefined') {
return false;
}
return value instanceof URL;
},
parse: {
sync(value, ctx) {
return {
value: ctx.parse(value.href),
};
},
async async(value, ctx) {
return {
value: await ctx.parse(value.href),
};
},
stream(value, ctx) {
return {
value: ctx.parse(value.href),
};
},
},
serialize(node, ctx) {
return 'new URL(' + ctx.serialize(node.value) + ')';
},
deserialize(node, ctx) {
return new URL(ctx.deserialize(node.value) as string);
},
});
export default URLPlugin;