seroval-plugins 1.2.0 → 1.3.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/LICENSE +1 -1
- package/README.md +2 -0
- package/dist/cjs/development/web.cjs +205 -50
- package/dist/cjs/development/web.cjs.map +4 -4
- package/dist/cjs/production/web.cjs +1 -1
- package/dist/esm/development/web.mjs +203 -48
- package/dist/esm/development/web.mjs.map +4 -4
- package/dist/esm/production/web.mjs +1 -1
- package/dist/types/web/abort-signal.d.ts +19 -0
- package/dist/types/web/abort-signal.d.ts.map +1 -0
- package/dist/types/web/index.d.ts +2 -1
- package/dist/types/web/index.d.ts.map +1 -1
- package/package.json +10 -10
- package/web/abort-signal.ts +197 -0
- package/web/index.ts +2 -1
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
MIT License Copyright (c)
|
|
1
|
+
MIT License Copyright (c) 2025 Alexis Munsayac <alexis.munsayac@gmail.com>
|
|
2
2
|
|
|
3
3
|
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:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -22,12 +22,14 @@ pnpm add seroval-plugins
|
|
|
22
22
|
|
|
23
23
|
### `seroval-plugins/web`
|
|
24
24
|
|
|
25
|
+
- [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
25
26
|
- [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)
|
|
26
27
|
- [`CustomEvent`](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent)
|
|
27
28
|
- [`DOMException`](https://developer.mozilla.org/en-US/docs/Web/API/DOMException)
|
|
28
29
|
- [`Event`](https://developer.mozilla.org/en-US/docs/Web/API/Event)
|
|
29
30
|
- [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File)
|
|
30
31
|
- [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)
|
|
32
|
+
- [`ImageData`](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)
|
|
31
33
|
- [`Headers`](https://developer.mozilla.org/en-US/docs/Web/API/Headers)
|
|
32
34
|
- [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
|
|
33
35
|
- [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// web/index.ts
|
|
21
21
|
var web_exports = {};
|
|
22
22
|
__export(web_exports, {
|
|
23
|
+
AbortSignalPlugin: () => abort_signal_default,
|
|
23
24
|
BlobPlugin: () => blob_default,
|
|
24
25
|
CustomEventPlugin: () => custom_event_default,
|
|
25
26
|
DOMExceptionPlugin: () => dom_exception_default,
|
|
@@ -36,9 +37,163 @@ __export(web_exports, {
|
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(web_exports);
|
|
38
39
|
|
|
39
|
-
// web/
|
|
40
|
+
// web/abort-signal.ts
|
|
40
41
|
var import_seroval = require("seroval");
|
|
41
|
-
|
|
42
|
+
function resolveAbortSignalResult(resolve) {
|
|
43
|
+
resolve(this.reason);
|
|
44
|
+
}
|
|
45
|
+
function resolveAbortSignal(resolve) {
|
|
46
|
+
this.addEventListener("abort", resolveAbortSignalResult.bind(this, resolve), {
|
|
47
|
+
once: true
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function abortSignalToPromise(signal) {
|
|
51
|
+
return new Promise(resolveAbortSignal.bind(signal));
|
|
52
|
+
}
|
|
53
|
+
var AbortSignalController = class {
|
|
54
|
+
constructor() {
|
|
55
|
+
this.controller = new AbortController();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var AbortSignalControllerPlugin = (0, import_seroval.createPlugin)({
|
|
59
|
+
tag: "seroval-plugins/web/AbortSignalController",
|
|
60
|
+
test(value) {
|
|
61
|
+
return value instanceof AbortSignalController;
|
|
62
|
+
},
|
|
63
|
+
parse: {
|
|
64
|
+
stream() {
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
serialize(_node) {
|
|
69
|
+
return "new AbortController";
|
|
70
|
+
},
|
|
71
|
+
deserialize(_node) {
|
|
72
|
+
return new AbortSignalController();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
var AbortSignalAbort = class {
|
|
76
|
+
constructor(controller, reason) {
|
|
77
|
+
this.controller = controller;
|
|
78
|
+
this.reason = reason;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var AbortSignalAbortPlugin = (0, import_seroval.createPlugin)({
|
|
82
|
+
extends: [AbortSignalControllerPlugin],
|
|
83
|
+
tag: "seroval-plugins/web/AbortSignalAbort",
|
|
84
|
+
test(value) {
|
|
85
|
+
return value instanceof AbortSignalAbort;
|
|
86
|
+
},
|
|
87
|
+
parse: {
|
|
88
|
+
stream(value, ctx) {
|
|
89
|
+
return {
|
|
90
|
+
controller: ctx.parse(value.controller),
|
|
91
|
+
reason: ctx.parse(value.reason)
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
serialize(node, ctx) {
|
|
96
|
+
return ctx.serialize(node.controller) + ".abort(" + ctx.serialize(node.reason) + ")";
|
|
97
|
+
},
|
|
98
|
+
deserialize(node, ctx) {
|
|
99
|
+
const controller = ctx.deserialize(
|
|
100
|
+
node.controller
|
|
101
|
+
);
|
|
102
|
+
const reason = ctx.deserialize(node.reason);
|
|
103
|
+
controller.controller.abort(reason);
|
|
104
|
+
return new AbortSignalAbort(controller, reason);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
var AbortSignalPlugin = (0, import_seroval.createPlugin)({
|
|
108
|
+
tag: "seroval-plugins/web/AbortSignal",
|
|
109
|
+
extends: [AbortSignalAbortPlugin],
|
|
110
|
+
test(value) {
|
|
111
|
+
if (typeof AbortSignal === "undefined") {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return value instanceof AbortSignal;
|
|
115
|
+
},
|
|
116
|
+
parse: {
|
|
117
|
+
sync(value, ctx) {
|
|
118
|
+
if (value.aborted) {
|
|
119
|
+
return {
|
|
120
|
+
type: 1 /* Aborted */,
|
|
121
|
+
reason: ctx.parse(value.reason)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
type: 0 /* Pending */
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
async async(value, ctx) {
|
|
129
|
+
if (value.aborted) {
|
|
130
|
+
return {
|
|
131
|
+
type: 1 /* Aborted */,
|
|
132
|
+
reason: await ctx.parse(value.reason)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
const result = await abortSignalToPromise(value);
|
|
136
|
+
return {
|
|
137
|
+
type: 1 /* Aborted */,
|
|
138
|
+
reason: await ctx.parse(result)
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
stream(value, ctx) {
|
|
142
|
+
if (value.aborted) {
|
|
143
|
+
return {
|
|
144
|
+
type: 1 /* Aborted */,
|
|
145
|
+
reason: ctx.parse(value.reason)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const controller = new AbortSignalController();
|
|
149
|
+
ctx.pushPendingState();
|
|
150
|
+
value.addEventListener(
|
|
151
|
+
"abort",
|
|
152
|
+
() => {
|
|
153
|
+
const result = ctx.parseWithError(
|
|
154
|
+
new AbortSignalAbort(controller, value.reason)
|
|
155
|
+
);
|
|
156
|
+
if (result) {
|
|
157
|
+
ctx.onParse(result);
|
|
158
|
+
}
|
|
159
|
+
ctx.popPendingState();
|
|
160
|
+
},
|
|
161
|
+
{ once: true }
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
type: 2 /* Streaming */,
|
|
165
|
+
controller: ctx.parse(controller)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
serialize(node, ctx) {
|
|
170
|
+
if (node.type === 0 /* Pending */) {
|
|
171
|
+
return "(new AbortController).signal";
|
|
172
|
+
}
|
|
173
|
+
if (node.type === 1 /* Aborted */) {
|
|
174
|
+
return "AbortSignal.abort(" + ctx.serialize(node.reason) + ")";
|
|
175
|
+
}
|
|
176
|
+
return "(" + ctx.serialize(node.controller) + ").signal";
|
|
177
|
+
},
|
|
178
|
+
deserialize(node, ctx) {
|
|
179
|
+
if (node.type === 0 /* Pending */) {
|
|
180
|
+
const controller2 = new AbortController();
|
|
181
|
+
return controller2.signal;
|
|
182
|
+
}
|
|
183
|
+
if (node.type === 1 /* Aborted */) {
|
|
184
|
+
return AbortSignal.abort(ctx.deserialize(node.reason));
|
|
185
|
+
}
|
|
186
|
+
const controller = ctx.deserialize(
|
|
187
|
+
node.controller
|
|
188
|
+
);
|
|
189
|
+
return controller.controller.signal;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
var abort_signal_default = AbortSignalPlugin;
|
|
193
|
+
|
|
194
|
+
// web/blob.ts
|
|
195
|
+
var import_seroval2 = require("seroval");
|
|
196
|
+
var BlobPlugin = /* @__PURE__ */ (0, import_seroval2.createPlugin)({
|
|
42
197
|
tag: "seroval-plugins/web/Blob",
|
|
43
198
|
test(value) {
|
|
44
199
|
if (typeof Blob === "undefined") {
|
|
@@ -66,7 +221,7 @@ var BlobPlugin = /* @__PURE__ */ (0, import_seroval.createPlugin)({
|
|
|
66
221
|
var blob_default = BlobPlugin;
|
|
67
222
|
|
|
68
223
|
// web/custom-event.ts
|
|
69
|
-
var
|
|
224
|
+
var import_seroval3 = require("seroval");
|
|
70
225
|
function createCustomEventOptions(current) {
|
|
71
226
|
return {
|
|
72
227
|
detail: current.detail,
|
|
@@ -75,7 +230,7 @@ function createCustomEventOptions(current) {
|
|
|
75
230
|
composed: current.composed
|
|
76
231
|
};
|
|
77
232
|
}
|
|
78
|
-
var CustomEventPlugin = /* @__PURE__ */ (0,
|
|
233
|
+
var CustomEventPlugin = /* @__PURE__ */ (0, import_seroval3.createPlugin)({
|
|
79
234
|
tag: "seroval-plugins/web/CustomEvent",
|
|
80
235
|
test(value) {
|
|
81
236
|
if (typeof CustomEvent === "undefined") {
|
|
@@ -116,8 +271,8 @@ var CustomEventPlugin = /* @__PURE__ */ (0, import_seroval2.createPlugin)({
|
|
|
116
271
|
var custom_event_default = CustomEventPlugin;
|
|
117
272
|
|
|
118
273
|
// web/dom-exception.ts
|
|
119
|
-
var
|
|
120
|
-
var DOMExceptionPlugin = /* @__PURE__ */ (0,
|
|
274
|
+
var import_seroval4 = require("seroval");
|
|
275
|
+
var DOMExceptionPlugin = /* @__PURE__ */ (0, import_seroval4.createPlugin)({
|
|
121
276
|
tag: "seroval-plugins/web/DOMException",
|
|
122
277
|
test(value) {
|
|
123
278
|
if (typeof DOMException === "undefined") {
|
|
@@ -158,7 +313,7 @@ var DOMExceptionPlugin = /* @__PURE__ */ (0, import_seroval3.createPlugin)({
|
|
|
158
313
|
var dom_exception_default = DOMExceptionPlugin;
|
|
159
314
|
|
|
160
315
|
// web/event.ts
|
|
161
|
-
var
|
|
316
|
+
var import_seroval5 = require("seroval");
|
|
162
317
|
function createEventOptions(current) {
|
|
163
318
|
return {
|
|
164
319
|
bubbles: current.bubbles,
|
|
@@ -166,7 +321,7 @@ function createEventOptions(current) {
|
|
|
166
321
|
composed: current.composed
|
|
167
322
|
};
|
|
168
323
|
}
|
|
169
|
-
var EventPlugin = /* @__PURE__ */ (0,
|
|
324
|
+
var EventPlugin = /* @__PURE__ */ (0, import_seroval5.createPlugin)({
|
|
170
325
|
tag: "seroval-plugins/web/Event",
|
|
171
326
|
test(value) {
|
|
172
327
|
if (typeof Event === "undefined") {
|
|
@@ -207,8 +362,8 @@ var EventPlugin = /* @__PURE__ */ (0, import_seroval4.createPlugin)({
|
|
|
207
362
|
var event_default = EventPlugin;
|
|
208
363
|
|
|
209
364
|
// web/file.ts
|
|
210
|
-
var
|
|
211
|
-
var FilePlugin = /* @__PURE__ */ (0,
|
|
365
|
+
var import_seroval6 = require("seroval");
|
|
366
|
+
var FilePlugin = /* @__PURE__ */ (0, import_seroval6.createPlugin)({
|
|
212
367
|
tag: "seroval-plugins/web/File",
|
|
213
368
|
test(value) {
|
|
214
369
|
if (typeof File === "undefined") {
|
|
@@ -242,7 +397,7 @@ var FilePlugin = /* @__PURE__ */ (0, import_seroval5.createPlugin)({
|
|
|
242
397
|
var file_default = FilePlugin;
|
|
243
398
|
|
|
244
399
|
// web/form-data.ts
|
|
245
|
-
var
|
|
400
|
+
var import_seroval7 = require("seroval");
|
|
246
401
|
function convertFormData(instance) {
|
|
247
402
|
const items = [];
|
|
248
403
|
instance.forEach((value, key) => {
|
|
@@ -251,7 +406,7 @@ function convertFormData(instance) {
|
|
|
251
406
|
return items;
|
|
252
407
|
}
|
|
253
408
|
var FORM_DATA_FACTORY = {};
|
|
254
|
-
var FormDataFactoryPlugin = /* @__PURE__ */ (0,
|
|
409
|
+
var FormDataFactoryPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
|
|
255
410
|
tag: "seroval-plugins/web/FormDataFactory",
|
|
256
411
|
test(value) {
|
|
257
412
|
return value === FORM_DATA_FACTORY;
|
|
@@ -277,7 +432,7 @@ var FormDataFactoryPlugin = /* @__PURE__ */ (0, import_seroval6.createPlugin)({
|
|
|
277
432
|
return FORM_DATA_FACTORY;
|
|
278
433
|
}
|
|
279
434
|
});
|
|
280
|
-
var FormDataPlugin = /* @__PURE__ */ (0,
|
|
435
|
+
var FormDataPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
|
|
281
436
|
tag: "seroval-plugins/web/FormData",
|
|
282
437
|
extends: [file_default, FormDataFactoryPlugin],
|
|
283
438
|
test(value) {
|
|
@@ -322,7 +477,7 @@ var FormDataPlugin = /* @__PURE__ */ (0, import_seroval6.createPlugin)({
|
|
|
322
477
|
var form_data_default = FormDataPlugin;
|
|
323
478
|
|
|
324
479
|
// web/headers.ts
|
|
325
|
-
var
|
|
480
|
+
var import_seroval8 = require("seroval");
|
|
326
481
|
function convertHeaders(instance) {
|
|
327
482
|
const items = [];
|
|
328
483
|
instance.forEach((value, key) => {
|
|
@@ -330,7 +485,7 @@ function convertHeaders(instance) {
|
|
|
330
485
|
});
|
|
331
486
|
return items;
|
|
332
487
|
}
|
|
333
|
-
var HeadersPlugin = /* @__PURE__ */ (0,
|
|
488
|
+
var HeadersPlugin = /* @__PURE__ */ (0, import_seroval8.createPlugin)({
|
|
334
489
|
tag: "seroval-plugins/web/Headers",
|
|
335
490
|
test(value) {
|
|
336
491
|
if (typeof Headers === "undefined") {
|
|
@@ -359,8 +514,8 @@ var HeadersPlugin = /* @__PURE__ */ (0, import_seroval7.createPlugin)({
|
|
|
359
514
|
var headers_default = HeadersPlugin;
|
|
360
515
|
|
|
361
516
|
// web/image-data.ts
|
|
362
|
-
var
|
|
363
|
-
var ImageDataPlugin = /* @__PURE__ */ (0,
|
|
517
|
+
var import_seroval9 = require("seroval");
|
|
518
|
+
var ImageDataPlugin = /* @__PURE__ */ (0, import_seroval9.createPlugin)({
|
|
364
519
|
tag: "seroval-plugins/web/ImageData",
|
|
365
520
|
test(value) {
|
|
366
521
|
if (typeof ImageData === "undefined") {
|
|
@@ -415,9 +570,9 @@ var ImageDataPlugin = /* @__PURE__ */ (0, import_seroval8.createPlugin)({
|
|
|
415
570
|
var image_data_default = ImageDataPlugin;
|
|
416
571
|
|
|
417
572
|
// web/readable-stream.ts
|
|
418
|
-
var
|
|
573
|
+
var import_seroval10 = require("seroval");
|
|
419
574
|
var READABLE_STREAM_FACTORY = {};
|
|
420
|
-
var ReadableStreamFactoryPlugin = /* @__PURE__ */ (0,
|
|
575
|
+
var ReadableStreamFactoryPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
|
|
421
576
|
tag: "seroval-plugins/web/ReadableStreamFactory",
|
|
422
577
|
test(value) {
|
|
423
578
|
return value === READABLE_STREAM_FACTORY;
|
|
@@ -447,7 +602,7 @@ var ReadableStreamFactoryPlugin = /* @__PURE__ */ (0, import_seroval9.createPlug
|
|
|
447
602
|
}
|
|
448
603
|
});
|
|
449
604
|
function toStream(value) {
|
|
450
|
-
const stream = (0,
|
|
605
|
+
const stream = (0, import_seroval10.createStream)();
|
|
451
606
|
const reader = value.getReader();
|
|
452
607
|
async function push() {
|
|
453
608
|
try {
|
|
@@ -466,7 +621,7 @@ function toStream(value) {
|
|
|
466
621
|
});
|
|
467
622
|
return stream;
|
|
468
623
|
}
|
|
469
|
-
var ReadableStreamPlugin = /* @__PURE__ */ (0,
|
|
624
|
+
var ReadableStreamPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
|
|
470
625
|
tag: "seroval/plugins/web/ReadableStream",
|
|
471
626
|
extends: [ReadableStreamFactoryPlugin],
|
|
472
627
|
test(value) {
|
|
@@ -479,7 +634,7 @@ var ReadableStreamPlugin = /* @__PURE__ */ (0, import_seroval9.createPlugin)({
|
|
|
479
634
|
sync(_value, ctx) {
|
|
480
635
|
return {
|
|
481
636
|
factory: ctx.parse(READABLE_STREAM_FACTORY),
|
|
482
|
-
stream: ctx.parse((0,
|
|
637
|
+
stream: ctx.parse((0, import_seroval10.createStream)())
|
|
483
638
|
};
|
|
484
639
|
},
|
|
485
640
|
async async(value, ctx) {
|
|
@@ -520,7 +675,7 @@ var ReadableStreamPlugin = /* @__PURE__ */ (0, import_seroval9.createPlugin)({
|
|
|
520
675
|
var readable_stream_default = ReadableStreamPlugin;
|
|
521
676
|
|
|
522
677
|
// web/request.ts
|
|
523
|
-
var
|
|
678
|
+
var import_seroval11 = require("seroval");
|
|
524
679
|
function createRequestOptions(current, body) {
|
|
525
680
|
return {
|
|
526
681
|
body,
|
|
@@ -536,7 +691,7 @@ function createRequestOptions(current, body) {
|
|
|
536
691
|
referrerPolicy: current.referrerPolicy
|
|
537
692
|
};
|
|
538
693
|
}
|
|
539
|
-
var RequestPlugin = /* @__PURE__ */ (0,
|
|
694
|
+
var RequestPlugin = /* @__PURE__ */ (0, import_seroval11.createPlugin)({
|
|
540
695
|
tag: "seroval-plugins/web/Request",
|
|
541
696
|
extends: [readable_stream_default, headers_default],
|
|
542
697
|
test(value) {
|
|
@@ -577,7 +732,7 @@ var RequestPlugin = /* @__PURE__ */ (0, import_seroval10.createPlugin)({
|
|
|
577
732
|
var request_default = RequestPlugin;
|
|
578
733
|
|
|
579
734
|
// web/response.ts
|
|
580
|
-
var
|
|
735
|
+
var import_seroval12 = require("seroval");
|
|
581
736
|
function createResponseOptions(current) {
|
|
582
737
|
return {
|
|
583
738
|
headers: current.headers,
|
|
@@ -585,7 +740,7 @@ function createResponseOptions(current) {
|
|
|
585
740
|
statusText: current.statusText
|
|
586
741
|
};
|
|
587
742
|
}
|
|
588
|
-
var ResponsePlugin = /* @__PURE__ */ (0,
|
|
743
|
+
var ResponsePlugin = /* @__PURE__ */ (0, import_seroval12.createPlugin)({
|
|
589
744
|
tag: "seroval-plugins/web/Response",
|
|
590
745
|
extends: [readable_stream_default, headers_default],
|
|
591
746
|
test(value) {
|
|
@@ -622,63 +777,63 @@ var ResponsePlugin = /* @__PURE__ */ (0, import_seroval11.createPlugin)({
|
|
|
622
777
|
});
|
|
623
778
|
var response_default = ResponsePlugin;
|
|
624
779
|
|
|
625
|
-
// web/url
|
|
626
|
-
var
|
|
627
|
-
var
|
|
628
|
-
tag: "seroval-plugins/web/
|
|
780
|
+
// web/url.ts
|
|
781
|
+
var import_seroval13 = require("seroval");
|
|
782
|
+
var URLPlugin = /* @__PURE__ */ (0, import_seroval13.createPlugin)({
|
|
783
|
+
tag: "seroval-plugins/web/URL",
|
|
629
784
|
test(value) {
|
|
630
|
-
if (typeof
|
|
785
|
+
if (typeof URL === "undefined") {
|
|
631
786
|
return false;
|
|
632
787
|
}
|
|
633
|
-
return value instanceof
|
|
788
|
+
return value instanceof URL;
|
|
634
789
|
},
|
|
635
790
|
parse: {
|
|
636
791
|
sync(value, ctx) {
|
|
637
|
-
return ctx.parse(value.
|
|
792
|
+
return ctx.parse(value.href);
|
|
638
793
|
},
|
|
639
794
|
async async(value, ctx) {
|
|
640
|
-
return await ctx.parse(value.
|
|
795
|
+
return await ctx.parse(value.href);
|
|
641
796
|
},
|
|
642
797
|
stream(value, ctx) {
|
|
643
|
-
return ctx.parse(value.
|
|
798
|
+
return ctx.parse(value.href);
|
|
644
799
|
}
|
|
645
800
|
},
|
|
646
801
|
serialize(node, ctx) {
|
|
647
|
-
return "new
|
|
802
|
+
return "new URL(" + ctx.serialize(node) + ")";
|
|
648
803
|
},
|
|
649
804
|
deserialize(node, ctx) {
|
|
650
|
-
return new
|
|
805
|
+
return new URL(ctx.deserialize(node));
|
|
651
806
|
}
|
|
652
807
|
});
|
|
653
|
-
var
|
|
808
|
+
var url_default = URLPlugin;
|
|
654
809
|
|
|
655
|
-
// web/url.ts
|
|
656
|
-
var
|
|
657
|
-
var
|
|
658
|
-
tag: "seroval-plugins/web/
|
|
810
|
+
// web/url-search-params.ts
|
|
811
|
+
var import_seroval14 = require("seroval");
|
|
812
|
+
var URLSearchParamsPlugin = /* @__PURE__ */ (0, import_seroval14.createPlugin)({
|
|
813
|
+
tag: "seroval-plugins/web/URLSearchParams",
|
|
659
814
|
test(value) {
|
|
660
|
-
if (typeof
|
|
815
|
+
if (typeof URLSearchParams === "undefined") {
|
|
661
816
|
return false;
|
|
662
817
|
}
|
|
663
|
-
return value instanceof
|
|
818
|
+
return value instanceof URLSearchParams;
|
|
664
819
|
},
|
|
665
820
|
parse: {
|
|
666
821
|
sync(value, ctx) {
|
|
667
|
-
return ctx.parse(value.
|
|
822
|
+
return ctx.parse(value.toString());
|
|
668
823
|
},
|
|
669
824
|
async async(value, ctx) {
|
|
670
|
-
return await ctx.parse(value.
|
|
825
|
+
return await ctx.parse(value.toString());
|
|
671
826
|
},
|
|
672
827
|
stream(value, ctx) {
|
|
673
|
-
return ctx.parse(value.
|
|
828
|
+
return ctx.parse(value.toString());
|
|
674
829
|
}
|
|
675
830
|
},
|
|
676
831
|
serialize(node, ctx) {
|
|
677
|
-
return "new
|
|
832
|
+
return "new URLSearchParams(" + ctx.serialize(node) + ")";
|
|
678
833
|
},
|
|
679
834
|
deserialize(node, ctx) {
|
|
680
|
-
return new
|
|
835
|
+
return new URLSearchParams(ctx.deserialize(node));
|
|
681
836
|
}
|
|
682
837
|
});
|
|
683
|
-
var
|
|
838
|
+
var url_search_params_default = URLSearchParamsPlugin;
|
|
684
839
|
//# sourceMappingURL=web.cjs.map
|