seroval-plugins 1.5.6 → 1.6.0
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/index-Col4D1Sf.d.ts +46 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/web-43VA2W_p.js +650 -0
- package/dist/web.d.ts +2 -0
- package/dist/web.js +2 -0
- package/package.json +11 -21
- package/dist/cjs/development/web.cjs +0 -826
- package/dist/cjs/development/web.cjs.map +0 -7
- package/dist/cjs/production/web.cjs +0 -1
- package/dist/esm/development/web.mjs +0 -803
- package/dist/esm/development/web.mjs.map +0 -7
- package/dist/esm/production/web.mjs +0 -1
- package/dist/types/web/abort-signal.d.ts +0 -3
- package/dist/types/web/abort-signal.d.ts.map +0 -1
- package/dist/types/web/blob.d.ts +0 -3
- package/dist/types/web/blob.d.ts.map +0 -1
- package/dist/types/web/custom-event.d.ts +0 -3
- package/dist/types/web/custom-event.d.ts.map +0 -1
- package/dist/types/web/dom-exception.d.ts +0 -3
- package/dist/types/web/dom-exception.d.ts.map +0 -1
- package/dist/types/web/event.d.ts +0 -3
- package/dist/types/web/event.d.ts.map +0 -1
- package/dist/types/web/file.d.ts +0 -3
- package/dist/types/web/file.d.ts.map +0 -1
- package/dist/types/web/form-data.d.ts +0 -3
- package/dist/types/web/form-data.d.ts.map +0 -1
- package/dist/types/web/headers.d.ts +0 -3
- package/dist/types/web/headers.d.ts.map +0 -1
- package/dist/types/web/image-data.d.ts +0 -3
- package/dist/types/web/image-data.d.ts.map +0 -1
- package/dist/types/web/index.d.ts +0 -15
- package/dist/types/web/index.d.ts.map +0 -1
- package/dist/types/web/readable-stream.d.ts +0 -3
- package/dist/types/web/readable-stream.d.ts.map +0 -1
- package/dist/types/web/request.d.ts +0 -3
- package/dist/types/web/request.d.ts.map +0 -1
- package/dist/types/web/response.d.ts +0 -3
- package/dist/types/web/response.d.ts.map +0 -1
- package/dist/types/web/url-search-params.d.ts +0 -3
- package/dist/types/web/url-search-params.d.ts.map +0 -1
- package/dist/types/web/url.d.ts +0 -3
- package/dist/types/web/url.d.ts.map +0 -1
- package/web/abort-signal.ts +0 -131
- package/web/blob.ts +0 -41
- package/web/custom-event.ts +0 -66
- package/web/dom-exception.ts +0 -57
- package/web/event.ts +0 -62
- package/web/file.ts +0 -50
- package/web/form-data.ts +0 -105
- package/web/headers.ts +0 -49
- package/web/image-data.ts +0 -74
- package/web/index.ts +0 -14
- package/web/readable-stream.ts +0 -148
- package/web/request.ts +0 -82
- package/web/response.ts +0 -65
- package/web/url-search-params.ts +0 -40
- package/web/url.ts +0 -37
|
@@ -1,826 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// web/index.ts
|
|
21
|
-
var web_exports = {};
|
|
22
|
-
__export(web_exports, {
|
|
23
|
-
AbortSignalPlugin: () => abort_signal_default,
|
|
24
|
-
BlobPlugin: () => blob_default,
|
|
25
|
-
CustomEventPlugin: () => custom_event_default,
|
|
26
|
-
DOMExceptionPlugin: () => dom_exception_default,
|
|
27
|
-
EventPlugin: () => event_default,
|
|
28
|
-
FilePlugin: () => file_default,
|
|
29
|
-
FormDataPlugin: () => form_data_default,
|
|
30
|
-
HeadersPlugin: () => headers_default,
|
|
31
|
-
ImageDataPlugin: () => image_data_default,
|
|
32
|
-
ReadableStreamPlugin: () => readable_stream_default,
|
|
33
|
-
RequestPlugin: () => request_default,
|
|
34
|
-
ResponsePlugin: () => response_default,
|
|
35
|
-
URLPlugin: () => url_default,
|
|
36
|
-
URLSearchParamsPlugin: () => url_search_params_default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(web_exports);
|
|
39
|
-
|
|
40
|
-
// web/abort-signal.ts
|
|
41
|
-
var import_seroval = require("seroval");
|
|
42
|
-
var PROMISE_TO_ABORT_SIGNAL = (promise) => {
|
|
43
|
-
const controller = new AbortController();
|
|
44
|
-
const abort = controller.abort.bind(controller);
|
|
45
|
-
promise.then(abort, abort);
|
|
46
|
-
return controller;
|
|
47
|
-
};
|
|
48
|
-
function resolveAbortSignalResult(resolve) {
|
|
49
|
-
resolve(this.reason);
|
|
50
|
-
}
|
|
51
|
-
function resolveAbortSignal(resolve) {
|
|
52
|
-
this.addEventListener("abort", resolveAbortSignalResult.bind(this, resolve), {
|
|
53
|
-
once: true
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function abortSignalToPromise(signal) {
|
|
57
|
-
return new Promise(resolveAbortSignal.bind(signal));
|
|
58
|
-
}
|
|
59
|
-
var ABORT_CONTROLLER = {};
|
|
60
|
-
var AbortControllerFactoryPlugin = /* @__PURE__ */ (0, import_seroval.createPlugin)({
|
|
61
|
-
tag: "seroval-plugins/web/AbortControllerFactoryPlugin",
|
|
62
|
-
test(value) {
|
|
63
|
-
return value === ABORT_CONTROLLER;
|
|
64
|
-
},
|
|
65
|
-
parse: {
|
|
66
|
-
sync() {
|
|
67
|
-
return ABORT_CONTROLLER;
|
|
68
|
-
},
|
|
69
|
-
async async() {
|
|
70
|
-
return await Promise.resolve(ABORT_CONTROLLER);
|
|
71
|
-
},
|
|
72
|
-
stream() {
|
|
73
|
-
return ABORT_CONTROLLER;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
serialize() {
|
|
77
|
-
return PROMISE_TO_ABORT_SIGNAL.toString();
|
|
78
|
-
},
|
|
79
|
-
deserialize() {
|
|
80
|
-
return PROMISE_TO_ABORT_SIGNAL;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
var AbortSignalPlugin = /* @__PURE__ */ (0, import_seroval.createPlugin)({
|
|
84
|
-
tag: "seroval-plugins/web/AbortSignal",
|
|
85
|
-
extends: [AbortControllerFactoryPlugin],
|
|
86
|
-
test(value) {
|
|
87
|
-
if (typeof AbortSignal === "undefined") {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
return value instanceof AbortSignal;
|
|
91
|
-
},
|
|
92
|
-
parse: {
|
|
93
|
-
sync(value, ctx) {
|
|
94
|
-
if (value.aborted) {
|
|
95
|
-
return {
|
|
96
|
-
reason: ctx.parse(value.reason)
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return {};
|
|
100
|
-
},
|
|
101
|
-
async async(value, ctx) {
|
|
102
|
-
if (value.aborted) {
|
|
103
|
-
return {
|
|
104
|
-
reason: await ctx.parse(value.reason)
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
const result = await abortSignalToPromise(value);
|
|
108
|
-
return {
|
|
109
|
-
reason: await ctx.parse(result)
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
stream(value, ctx) {
|
|
113
|
-
if (value.aborted) {
|
|
114
|
-
return {
|
|
115
|
-
reason: ctx.parse(value.reason)
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const promise = abortSignalToPromise(value);
|
|
119
|
-
return {
|
|
120
|
-
factory: ctx.parse(ABORT_CONTROLLER),
|
|
121
|
-
controller: ctx.parse(promise)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
serialize(node, ctx) {
|
|
126
|
-
if (node.reason) {
|
|
127
|
-
return "AbortSignal.abort(" + ctx.serialize(node.reason) + ")";
|
|
128
|
-
}
|
|
129
|
-
if (node.controller && node.factory) {
|
|
130
|
-
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.controller) + ").signal";
|
|
131
|
-
}
|
|
132
|
-
return "(new AbortController).signal";
|
|
133
|
-
},
|
|
134
|
-
deserialize(node, ctx) {
|
|
135
|
-
if (node.reason) {
|
|
136
|
-
return AbortSignal.abort(ctx.deserialize(node.reason));
|
|
137
|
-
}
|
|
138
|
-
if (node.controller) {
|
|
139
|
-
return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
|
|
140
|
-
}
|
|
141
|
-
const controller = new AbortController();
|
|
142
|
-
return controller.signal;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
var abort_signal_default = AbortSignalPlugin;
|
|
146
|
-
|
|
147
|
-
// web/blob.ts
|
|
148
|
-
var import_seroval2 = require("seroval");
|
|
149
|
-
var BlobPlugin = /* @__PURE__ */ (0, import_seroval2.createPlugin)({
|
|
150
|
-
tag: "seroval-plugins/web/Blob",
|
|
151
|
-
test(value) {
|
|
152
|
-
if (typeof Blob === "undefined") {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
return value instanceof Blob;
|
|
156
|
-
},
|
|
157
|
-
parse: {
|
|
158
|
-
async async(value, ctx) {
|
|
159
|
-
return {
|
|
160
|
-
type: await ctx.parse(value.type),
|
|
161
|
-
buffer: await ctx.parse(await value.arrayBuffer())
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
serialize(node, ctx) {
|
|
166
|
-
return "new Blob([" + ctx.serialize(node.buffer) + "],{type:" + ctx.serialize(node.type) + "})";
|
|
167
|
-
},
|
|
168
|
-
deserialize(node, ctx) {
|
|
169
|
-
return new Blob([ctx.deserialize(node.buffer)], {
|
|
170
|
-
type: ctx.deserialize(node.type)
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
var blob_default = BlobPlugin;
|
|
175
|
-
|
|
176
|
-
// web/custom-event.ts
|
|
177
|
-
var import_seroval3 = require("seroval");
|
|
178
|
-
function createCustomEventOptions(current) {
|
|
179
|
-
return {
|
|
180
|
-
detail: current.detail,
|
|
181
|
-
bubbles: current.bubbles,
|
|
182
|
-
cancelable: current.cancelable,
|
|
183
|
-
composed: current.composed
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
var CustomEventPlugin = /* @__PURE__ */ (0, import_seroval3.createPlugin)({
|
|
187
|
-
tag: "seroval-plugins/web/CustomEvent",
|
|
188
|
-
test(value) {
|
|
189
|
-
if (typeof CustomEvent === "undefined") {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
return value instanceof CustomEvent;
|
|
193
|
-
},
|
|
194
|
-
parse: {
|
|
195
|
-
sync(value, ctx) {
|
|
196
|
-
return {
|
|
197
|
-
type: ctx.parse(value.type),
|
|
198
|
-
options: ctx.parse(createCustomEventOptions(value))
|
|
199
|
-
};
|
|
200
|
-
},
|
|
201
|
-
async async(value, ctx) {
|
|
202
|
-
return {
|
|
203
|
-
type: await ctx.parse(value.type),
|
|
204
|
-
options: await ctx.parse(createCustomEventOptions(value))
|
|
205
|
-
};
|
|
206
|
-
},
|
|
207
|
-
stream(value, ctx) {
|
|
208
|
-
return {
|
|
209
|
-
type: ctx.parse(value.type),
|
|
210
|
-
options: ctx.parse(createCustomEventOptions(value))
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
serialize(node, ctx) {
|
|
215
|
-
return "new CustomEvent(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
|
|
216
|
-
},
|
|
217
|
-
deserialize(node, ctx) {
|
|
218
|
-
return new CustomEvent(
|
|
219
|
-
ctx.deserialize(node.type),
|
|
220
|
-
ctx.deserialize(node.options)
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
var custom_event_default = CustomEventPlugin;
|
|
225
|
-
|
|
226
|
-
// web/dom-exception.ts
|
|
227
|
-
var import_seroval4 = require("seroval");
|
|
228
|
-
var DOMExceptionPlugin = /* @__PURE__ */ (0, import_seroval4.createPlugin)({
|
|
229
|
-
tag: "seroval-plugins/web/DOMException",
|
|
230
|
-
test(value) {
|
|
231
|
-
if (typeof DOMException === "undefined") {
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
return value instanceof DOMException;
|
|
235
|
-
},
|
|
236
|
-
parse: {
|
|
237
|
-
sync(value, ctx) {
|
|
238
|
-
return {
|
|
239
|
-
name: ctx.parse(value.name),
|
|
240
|
-
message: ctx.parse(value.message)
|
|
241
|
-
};
|
|
242
|
-
},
|
|
243
|
-
async async(value, ctx) {
|
|
244
|
-
return {
|
|
245
|
-
name: await ctx.parse(value.name),
|
|
246
|
-
message: await ctx.parse(value.message)
|
|
247
|
-
};
|
|
248
|
-
},
|
|
249
|
-
stream(value, ctx) {
|
|
250
|
-
return {
|
|
251
|
-
name: ctx.parse(value.name),
|
|
252
|
-
message: ctx.parse(value.message)
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
},
|
|
256
|
-
serialize(node, ctx) {
|
|
257
|
-
return "new DOMException(" + ctx.serialize(node.message) + "," + ctx.serialize(node.name) + ")";
|
|
258
|
-
},
|
|
259
|
-
deserialize(node, ctx) {
|
|
260
|
-
return new DOMException(
|
|
261
|
-
ctx.deserialize(node.message),
|
|
262
|
-
ctx.deserialize(node.name)
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
var dom_exception_default = DOMExceptionPlugin;
|
|
267
|
-
|
|
268
|
-
// web/event.ts
|
|
269
|
-
var import_seroval5 = require("seroval");
|
|
270
|
-
function createEventOptions(current) {
|
|
271
|
-
return {
|
|
272
|
-
bubbles: current.bubbles,
|
|
273
|
-
cancelable: current.cancelable,
|
|
274
|
-
composed: current.composed
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
var EventPlugin = /* @__PURE__ */ (0, import_seroval5.createPlugin)({
|
|
278
|
-
tag: "seroval-plugins/web/Event",
|
|
279
|
-
test(value) {
|
|
280
|
-
if (typeof Event === "undefined") {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
return value instanceof Event;
|
|
284
|
-
},
|
|
285
|
-
parse: {
|
|
286
|
-
sync(value, ctx) {
|
|
287
|
-
return {
|
|
288
|
-
type: ctx.parse(value.type),
|
|
289
|
-
options: ctx.parse(createEventOptions(value))
|
|
290
|
-
};
|
|
291
|
-
},
|
|
292
|
-
async async(value, ctx) {
|
|
293
|
-
return {
|
|
294
|
-
type: await ctx.parse(value.type),
|
|
295
|
-
options: await ctx.parse(createEventOptions(value))
|
|
296
|
-
};
|
|
297
|
-
},
|
|
298
|
-
stream(value, ctx) {
|
|
299
|
-
return {
|
|
300
|
-
type: ctx.parse(value.type),
|
|
301
|
-
options: ctx.parse(createEventOptions(value))
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
serialize(node, ctx) {
|
|
306
|
-
return "new Event(" + ctx.serialize(node.type) + "," + ctx.serialize(node.options) + ")";
|
|
307
|
-
},
|
|
308
|
-
deserialize(node, ctx) {
|
|
309
|
-
return new Event(
|
|
310
|
-
ctx.deserialize(node.type),
|
|
311
|
-
ctx.deserialize(node.options)
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
var event_default = EventPlugin;
|
|
316
|
-
|
|
317
|
-
// web/file.ts
|
|
318
|
-
var import_seroval6 = require("seroval");
|
|
319
|
-
var FilePlugin = /* @__PURE__ */ (0, import_seroval6.createPlugin)({
|
|
320
|
-
tag: "seroval-plugins/web/File",
|
|
321
|
-
test(value) {
|
|
322
|
-
if (typeof File === "undefined") {
|
|
323
|
-
return false;
|
|
324
|
-
}
|
|
325
|
-
return value instanceof File;
|
|
326
|
-
},
|
|
327
|
-
parse: {
|
|
328
|
-
async async(value, ctx) {
|
|
329
|
-
return {
|
|
330
|
-
name: await ctx.parse(value.name),
|
|
331
|
-
options: await ctx.parse({
|
|
332
|
-
type: value.type,
|
|
333
|
-
lastModified: value.lastModified
|
|
334
|
-
}),
|
|
335
|
-
buffer: await ctx.parse(await value.arrayBuffer())
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
serialize(node, ctx) {
|
|
340
|
-
return "new File([" + ctx.serialize(node.buffer) + "]," + ctx.serialize(node.name) + "," + ctx.serialize(node.options) + ")";
|
|
341
|
-
},
|
|
342
|
-
deserialize(node, ctx) {
|
|
343
|
-
return new File(
|
|
344
|
-
[ctx.deserialize(node.buffer)],
|
|
345
|
-
ctx.deserialize(node.name),
|
|
346
|
-
ctx.deserialize(node.options)
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
var file_default = FilePlugin;
|
|
351
|
-
|
|
352
|
-
// web/form-data.ts
|
|
353
|
-
var import_seroval7 = require("seroval");
|
|
354
|
-
function convertFormData(instance) {
|
|
355
|
-
const items = [];
|
|
356
|
-
instance.forEach((value, key) => {
|
|
357
|
-
items.push([key, value]);
|
|
358
|
-
});
|
|
359
|
-
return items;
|
|
360
|
-
}
|
|
361
|
-
var FORM_DATA_FACTORY = {};
|
|
362
|
-
var FORM_DATA_FACTORY_CONSTRUCTOR = (e, f = new FormData(), i = 0, s = e.length, t) => {
|
|
363
|
-
for (; i < s; i++) {
|
|
364
|
-
t = e[i];
|
|
365
|
-
f.append(t[0], t[1]);
|
|
366
|
-
}
|
|
367
|
-
return f;
|
|
368
|
-
};
|
|
369
|
-
var FormDataFactoryPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
|
|
370
|
-
tag: "seroval-plugins/web/FormDataFactory",
|
|
371
|
-
test(value) {
|
|
372
|
-
return value === FORM_DATA_FACTORY;
|
|
373
|
-
},
|
|
374
|
-
parse: {
|
|
375
|
-
sync() {
|
|
376
|
-
return FORM_DATA_FACTORY;
|
|
377
|
-
},
|
|
378
|
-
async async() {
|
|
379
|
-
return await Promise.resolve(FORM_DATA_FACTORY);
|
|
380
|
-
},
|
|
381
|
-
stream() {
|
|
382
|
-
return FORM_DATA_FACTORY;
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
serialize() {
|
|
386
|
-
return FORM_DATA_FACTORY_CONSTRUCTOR.toString();
|
|
387
|
-
},
|
|
388
|
-
deserialize() {
|
|
389
|
-
return FORM_DATA_FACTORY;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
var FormDataPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
|
|
393
|
-
tag: "seroval-plugins/web/FormData",
|
|
394
|
-
extends: [file_default, FormDataFactoryPlugin],
|
|
395
|
-
test(value) {
|
|
396
|
-
if (typeof FormData === "undefined") {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
return value instanceof FormData;
|
|
400
|
-
},
|
|
401
|
-
parse: {
|
|
402
|
-
sync(value, ctx) {
|
|
403
|
-
return {
|
|
404
|
-
factory: ctx.parse(FORM_DATA_FACTORY),
|
|
405
|
-
entries: ctx.parse(convertFormData(value))
|
|
406
|
-
};
|
|
407
|
-
},
|
|
408
|
-
async async(value, ctx) {
|
|
409
|
-
return {
|
|
410
|
-
factory: await ctx.parse(FORM_DATA_FACTORY),
|
|
411
|
-
entries: await ctx.parse(convertFormData(value))
|
|
412
|
-
};
|
|
413
|
-
},
|
|
414
|
-
stream(value, ctx) {
|
|
415
|
-
return {
|
|
416
|
-
factory: ctx.parse(FORM_DATA_FACTORY),
|
|
417
|
-
entries: ctx.parse(convertFormData(value))
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
serialize(node, ctx) {
|
|
422
|
-
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.entries) + ")";
|
|
423
|
-
},
|
|
424
|
-
deserialize(node, ctx) {
|
|
425
|
-
return FORM_DATA_FACTORY_CONSTRUCTOR(
|
|
426
|
-
ctx.deserialize(node.entries)
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
var form_data_default = FormDataPlugin;
|
|
431
|
-
|
|
432
|
-
// web/headers.ts
|
|
433
|
-
var import_seroval8 = require("seroval");
|
|
434
|
-
function convertHeaders(instance) {
|
|
435
|
-
const items = [];
|
|
436
|
-
instance.forEach((value, key) => {
|
|
437
|
-
items.push([key, value]);
|
|
438
|
-
});
|
|
439
|
-
return items;
|
|
440
|
-
}
|
|
441
|
-
var HeadersPlugin = /* @__PURE__ */ (0, import_seroval8.createPlugin)({
|
|
442
|
-
tag: "seroval-plugins/web/Headers",
|
|
443
|
-
test(value) {
|
|
444
|
-
if (typeof Headers === "undefined") {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
return value instanceof Headers;
|
|
448
|
-
},
|
|
449
|
-
parse: {
|
|
450
|
-
sync(value, ctx) {
|
|
451
|
-
return {
|
|
452
|
-
value: ctx.parse(convertHeaders(value))
|
|
453
|
-
};
|
|
454
|
-
},
|
|
455
|
-
async async(value, ctx) {
|
|
456
|
-
return {
|
|
457
|
-
value: await ctx.parse(convertHeaders(value))
|
|
458
|
-
};
|
|
459
|
-
},
|
|
460
|
-
stream(value, ctx) {
|
|
461
|
-
return {
|
|
462
|
-
value: ctx.parse(convertHeaders(value))
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
serialize(node, ctx) {
|
|
467
|
-
return "new Headers(" + ctx.serialize(node.value) + ")";
|
|
468
|
-
},
|
|
469
|
-
deserialize(node, ctx) {
|
|
470
|
-
return new Headers(ctx.deserialize(node.value));
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
var headers_default = HeadersPlugin;
|
|
474
|
-
|
|
475
|
-
// web/image-data.ts
|
|
476
|
-
var import_seroval9 = require("seroval");
|
|
477
|
-
var ImageDataPlugin = /* @__PURE__ */ (0, import_seroval9.createPlugin)({
|
|
478
|
-
tag: "seroval-plugins/web/ImageData",
|
|
479
|
-
test(value) {
|
|
480
|
-
if (typeof ImageData === "undefined") {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
return value instanceof ImageData;
|
|
484
|
-
},
|
|
485
|
-
parse: {
|
|
486
|
-
sync(value, ctx) {
|
|
487
|
-
return {
|
|
488
|
-
data: ctx.parse(value.data),
|
|
489
|
-
width: ctx.parse(value.width),
|
|
490
|
-
height: ctx.parse(value.height),
|
|
491
|
-
options: ctx.parse({
|
|
492
|
-
colorSpace: value.colorSpace
|
|
493
|
-
})
|
|
494
|
-
};
|
|
495
|
-
},
|
|
496
|
-
async async(value, ctx) {
|
|
497
|
-
return {
|
|
498
|
-
data: await ctx.parse(value.data),
|
|
499
|
-
width: await ctx.parse(value.width),
|
|
500
|
-
height: await ctx.parse(value.height),
|
|
501
|
-
options: await ctx.parse({
|
|
502
|
-
colorSpace: value.colorSpace
|
|
503
|
-
})
|
|
504
|
-
};
|
|
505
|
-
},
|
|
506
|
-
stream(value, ctx) {
|
|
507
|
-
return {
|
|
508
|
-
data: ctx.parse(value.data),
|
|
509
|
-
width: ctx.parse(value.width),
|
|
510
|
-
height: ctx.parse(value.height),
|
|
511
|
-
options: ctx.parse({
|
|
512
|
-
colorSpace: value.colorSpace
|
|
513
|
-
})
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
serialize(node, ctx) {
|
|
518
|
-
return "new ImageData(" + ctx.serialize(node.data) + "," + ctx.serialize(node.width) + "," + ctx.serialize(node.height) + "," + ctx.serialize(node.options) + ")";
|
|
519
|
-
},
|
|
520
|
-
deserialize(node, ctx) {
|
|
521
|
-
return new ImageData(
|
|
522
|
-
ctx.deserialize(node.data),
|
|
523
|
-
ctx.deserialize(node.width),
|
|
524
|
-
ctx.deserialize(node.height),
|
|
525
|
-
ctx.deserialize(node.options)
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
var image_data_default = ImageDataPlugin;
|
|
530
|
-
|
|
531
|
-
// web/readable-stream.ts
|
|
532
|
-
var import_seroval10 = require("seroval");
|
|
533
|
-
var READABLE_STREAM_FACTORY = {};
|
|
534
|
-
var READABLE_STREAM_FACTORY_CONSTRUCTOR = (stream) => new ReadableStream({
|
|
535
|
-
start: (controller) => {
|
|
536
|
-
stream.on({
|
|
537
|
-
next: (value) => {
|
|
538
|
-
try {
|
|
539
|
-
controller.enqueue(value);
|
|
540
|
-
} catch (_error) {
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
throw: (value) => {
|
|
544
|
-
controller.error(value);
|
|
545
|
-
},
|
|
546
|
-
return: () => {
|
|
547
|
-
try {
|
|
548
|
-
controller.close();
|
|
549
|
-
} catch (_error) {
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
var ReadableStreamFactoryPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
|
|
556
|
-
tag: "seroval-plugins/web/ReadableStreamFactory",
|
|
557
|
-
test(value) {
|
|
558
|
-
return value === READABLE_STREAM_FACTORY;
|
|
559
|
-
},
|
|
560
|
-
parse: {
|
|
561
|
-
sync() {
|
|
562
|
-
return READABLE_STREAM_FACTORY;
|
|
563
|
-
},
|
|
564
|
-
async async() {
|
|
565
|
-
return await Promise.resolve(READABLE_STREAM_FACTORY);
|
|
566
|
-
},
|
|
567
|
-
stream() {
|
|
568
|
-
return READABLE_STREAM_FACTORY;
|
|
569
|
-
}
|
|
570
|
-
},
|
|
571
|
-
serialize() {
|
|
572
|
-
return READABLE_STREAM_FACTORY_CONSTRUCTOR.toString();
|
|
573
|
-
},
|
|
574
|
-
deserialize() {
|
|
575
|
-
return READABLE_STREAM_FACTORY;
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
async function drainStream(stream, reader) {
|
|
579
|
-
try {
|
|
580
|
-
const result = await reader.read();
|
|
581
|
-
if (result.done) {
|
|
582
|
-
stream.return(result.value);
|
|
583
|
-
reader.releaseLock();
|
|
584
|
-
} else {
|
|
585
|
-
stream.next(result.value);
|
|
586
|
-
await drainStream(stream, reader);
|
|
587
|
-
}
|
|
588
|
-
} catch (error) {
|
|
589
|
-
stream.throw(error);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
function cleanupStream(reader) {
|
|
593
|
-
reader.cancel().catch(() => {
|
|
594
|
-
});
|
|
595
|
-
reader.releaseLock();
|
|
596
|
-
}
|
|
597
|
-
function toStream(value) {
|
|
598
|
-
const stream = (0, import_seroval10.createStream)();
|
|
599
|
-
const reader = value.getReader();
|
|
600
|
-
const cleanup = cleanupStream.bind(null, reader);
|
|
601
|
-
drainStream(stream, reader).catch(cleanup);
|
|
602
|
-
return [stream, cleanup];
|
|
603
|
-
}
|
|
604
|
-
var ReadableStreamPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
|
|
605
|
-
tag: "seroval/plugins/web/ReadableStream",
|
|
606
|
-
extends: [ReadableStreamFactoryPlugin],
|
|
607
|
-
test(value) {
|
|
608
|
-
if (typeof ReadableStream === "undefined") {
|
|
609
|
-
return false;
|
|
610
|
-
}
|
|
611
|
-
return value instanceof ReadableStream;
|
|
612
|
-
},
|
|
613
|
-
parse: {
|
|
614
|
-
sync(_value, ctx) {
|
|
615
|
-
return {
|
|
616
|
-
factory: ctx.parse(READABLE_STREAM_FACTORY),
|
|
617
|
-
stream: ctx.parse((0, import_seroval10.createStream)())
|
|
618
|
-
};
|
|
619
|
-
},
|
|
620
|
-
async async(value, ctx) {
|
|
621
|
-
return {
|
|
622
|
-
factory: await ctx.parse(READABLE_STREAM_FACTORY),
|
|
623
|
-
stream: await ctx.parse(toStream(value)[0])
|
|
624
|
-
};
|
|
625
|
-
},
|
|
626
|
-
stream(value, ctx) {
|
|
627
|
-
const [stream, cleanup] = toStream(value);
|
|
628
|
-
ctx.addCleanup(cleanup);
|
|
629
|
-
return {
|
|
630
|
-
factory: ctx.parse(READABLE_STREAM_FACTORY),
|
|
631
|
-
stream: ctx.parse(stream)
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
serialize(node, ctx) {
|
|
636
|
-
return "(" + ctx.serialize(node.factory) + ")(" + ctx.serialize(node.stream) + ")";
|
|
637
|
-
},
|
|
638
|
-
deserialize(node, ctx) {
|
|
639
|
-
const stream = ctx.deserialize(node.stream);
|
|
640
|
-
return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
|
|
641
|
-
}
|
|
642
|
-
});
|
|
643
|
-
var readable_stream_default = ReadableStreamPlugin;
|
|
644
|
-
|
|
645
|
-
// web/request.ts
|
|
646
|
-
var import_seroval11 = require("seroval");
|
|
647
|
-
function createRequestOptions(current, body) {
|
|
648
|
-
return {
|
|
649
|
-
body,
|
|
650
|
-
cache: current.cache,
|
|
651
|
-
credentials: current.credentials,
|
|
652
|
-
headers: current.headers,
|
|
653
|
-
integrity: current.integrity,
|
|
654
|
-
keepalive: current.keepalive,
|
|
655
|
-
method: current.method,
|
|
656
|
-
mode: current.mode,
|
|
657
|
-
redirect: current.redirect,
|
|
658
|
-
referrer: current.referrer,
|
|
659
|
-
referrerPolicy: current.referrerPolicy
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
var RequestPlugin = /* @__PURE__ */ (0, import_seroval11.createPlugin)({
|
|
663
|
-
tag: "seroval-plugins/web/Request",
|
|
664
|
-
extends: [readable_stream_default, headers_default],
|
|
665
|
-
test(value) {
|
|
666
|
-
if (typeof Request === "undefined") {
|
|
667
|
-
return false;
|
|
668
|
-
}
|
|
669
|
-
return value instanceof Request;
|
|
670
|
-
},
|
|
671
|
-
parse: {
|
|
672
|
-
async async(value, ctx) {
|
|
673
|
-
return {
|
|
674
|
-
url: await ctx.parse(value.url),
|
|
675
|
-
options: await ctx.parse(
|
|
676
|
-
createRequestOptions(
|
|
677
|
-
value,
|
|
678
|
-
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
|
|
679
|
-
)
|
|
680
|
-
)
|
|
681
|
-
};
|
|
682
|
-
},
|
|
683
|
-
stream(value, ctx) {
|
|
684
|
-
return {
|
|
685
|
-
url: ctx.parse(value.url),
|
|
686
|
-
options: ctx.parse(
|
|
687
|
-
createRequestOptions(
|
|
688
|
-
value,
|
|
689
|
-
value.body && !value.bodyUsed ? value.clone().body : null
|
|
690
|
-
)
|
|
691
|
-
)
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
serialize(node, ctx) {
|
|
696
|
-
return "new Request(" + ctx.serialize(node.url) + "," + ctx.serialize(node.options) + ")";
|
|
697
|
-
},
|
|
698
|
-
deserialize(node, ctx) {
|
|
699
|
-
return new Request(
|
|
700
|
-
ctx.deserialize(node.url),
|
|
701
|
-
ctx.deserialize(node.options)
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
var request_default = RequestPlugin;
|
|
706
|
-
|
|
707
|
-
// web/response.ts
|
|
708
|
-
var import_seroval12 = require("seroval");
|
|
709
|
-
function createResponseOptions(current) {
|
|
710
|
-
return {
|
|
711
|
-
headers: current.headers,
|
|
712
|
-
status: current.status,
|
|
713
|
-
statusText: current.statusText
|
|
714
|
-
};
|
|
715
|
-
}
|
|
716
|
-
var ResponsePlugin = /* @__PURE__ */ (0, import_seroval12.createPlugin)({
|
|
717
|
-
tag: "seroval-plugins/web/Response",
|
|
718
|
-
extends: [readable_stream_default, headers_default],
|
|
719
|
-
test(value) {
|
|
720
|
-
if (typeof Response === "undefined") {
|
|
721
|
-
return false;
|
|
722
|
-
}
|
|
723
|
-
return value instanceof Response;
|
|
724
|
-
},
|
|
725
|
-
parse: {
|
|
726
|
-
async async(value, ctx) {
|
|
727
|
-
return {
|
|
728
|
-
body: await ctx.parse(
|
|
729
|
-
value.body && !value.bodyUsed ? await value.clone().arrayBuffer() : null
|
|
730
|
-
),
|
|
731
|
-
options: await ctx.parse(createResponseOptions(value))
|
|
732
|
-
};
|
|
733
|
-
},
|
|
734
|
-
stream(value, ctx) {
|
|
735
|
-
return {
|
|
736
|
-
body: ctx.parse(
|
|
737
|
-
value.body && !value.bodyUsed ? value.clone().body : null
|
|
738
|
-
),
|
|
739
|
-
options: ctx.parse(createResponseOptions(value))
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
},
|
|
743
|
-
serialize(node, ctx) {
|
|
744
|
-
return "new Response(" + ctx.serialize(node.body) + "," + ctx.serialize(node.options) + ")";
|
|
745
|
-
},
|
|
746
|
-
deserialize(node, ctx) {
|
|
747
|
-
return new Response(
|
|
748
|
-
ctx.deserialize(node.body),
|
|
749
|
-
ctx.deserialize(node.options)
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
var response_default = ResponsePlugin;
|
|
754
|
-
|
|
755
|
-
// web/url.ts
|
|
756
|
-
var import_seroval13 = require("seroval");
|
|
757
|
-
var URLPlugin = /* @__PURE__ */ (0, import_seroval13.createPlugin)({
|
|
758
|
-
tag: "seroval-plugins/web/URL",
|
|
759
|
-
test(value) {
|
|
760
|
-
if (typeof URL === "undefined") {
|
|
761
|
-
return false;
|
|
762
|
-
}
|
|
763
|
-
return value instanceof URL;
|
|
764
|
-
},
|
|
765
|
-
parse: {
|
|
766
|
-
sync(value, ctx) {
|
|
767
|
-
return {
|
|
768
|
-
value: ctx.parse(value.href)
|
|
769
|
-
};
|
|
770
|
-
},
|
|
771
|
-
async async(value, ctx) {
|
|
772
|
-
return {
|
|
773
|
-
value: await ctx.parse(value.href)
|
|
774
|
-
};
|
|
775
|
-
},
|
|
776
|
-
stream(value, ctx) {
|
|
777
|
-
return {
|
|
778
|
-
value: ctx.parse(value.href)
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
},
|
|
782
|
-
serialize(node, ctx) {
|
|
783
|
-
return "new URL(" + ctx.serialize(node.value) + ")";
|
|
784
|
-
},
|
|
785
|
-
deserialize(node, ctx) {
|
|
786
|
-
return new URL(ctx.deserialize(node.value));
|
|
787
|
-
}
|
|
788
|
-
});
|
|
789
|
-
var url_default = URLPlugin;
|
|
790
|
-
|
|
791
|
-
// web/url-search-params.ts
|
|
792
|
-
var import_seroval14 = require("seroval");
|
|
793
|
-
var URLSearchParamsPlugin = /* @__PURE__ */ (0, import_seroval14.createPlugin)({
|
|
794
|
-
tag: "seroval-plugins/web/URLSearchParams",
|
|
795
|
-
test(value) {
|
|
796
|
-
if (typeof URLSearchParams === "undefined") {
|
|
797
|
-
return false;
|
|
798
|
-
}
|
|
799
|
-
return value instanceof URLSearchParams;
|
|
800
|
-
},
|
|
801
|
-
parse: {
|
|
802
|
-
sync(value, ctx) {
|
|
803
|
-
return {
|
|
804
|
-
value: ctx.parse(value.toString())
|
|
805
|
-
};
|
|
806
|
-
},
|
|
807
|
-
async async(value, ctx) {
|
|
808
|
-
return {
|
|
809
|
-
value: await ctx.parse(value.toString())
|
|
810
|
-
};
|
|
811
|
-
},
|
|
812
|
-
stream(value, ctx) {
|
|
813
|
-
return {
|
|
814
|
-
value: ctx.parse(value.toString())
|
|
815
|
-
};
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
serialize(node, ctx) {
|
|
819
|
-
return "new URLSearchParams(" + ctx.serialize(node.value) + ")";
|
|
820
|
-
},
|
|
821
|
-
deserialize(node, ctx) {
|
|
822
|
-
return new URLSearchParams(ctx.deserialize(node.value));
|
|
823
|
-
}
|
|
824
|
-
});
|
|
825
|
-
var url_search_params_default = URLSearchParamsPlugin;
|
|
826
|
-
//# sourceMappingURL=web.cjs.map
|