seroval-plugins 1.6.3 → 1.6.5

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.
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_web = require("./web-Cz0hD_-8.cjs");
2
+ const require_web = require("./web-SNaRz6Pu.cjs");
3
3
  Object.defineProperty(exports, "web", {
4
4
  enumerable: true,
5
5
  get: function() {
package/dist/dev/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as web_exports } from "./web-43VA2W_p.js";
1
+ import { t as web_exports } from "./web-C5aekFCA.js";
2
2
  export { web_exports as web };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { createPlugin, createStream } from "seroval";
2
+ import { createPlugin, createStream, isStream } from "seroval";
3
3
  //#region web/abort-signal.ts
4
4
  const PROMISE_TO_ABORT_SIGNAL = (promise) => {
5
5
  const controller = new AbortController();
@@ -39,7 +39,7 @@ const AbortSignalPlugin = /* @__PURE__ */ createPlugin({
39
39
  return PROMISE_TO_ABORT_SIGNAL.toString();
40
40
  },
41
41
  deserialize() {
42
- return PROMISE_TO_ABORT_SIGNAL;
42
+ throw new Error("seroval-plugins/web/AbortControllerFactoryPlugin cannot be deserialized directly.");
43
43
  }
44
44
  })],
45
45
  test(value) {
@@ -72,7 +72,11 @@ const AbortSignalPlugin = /* @__PURE__ */ createPlugin({
72
72
  },
73
73
  deserialize(node, ctx) {
74
74
  if (node.reason) return AbortSignal.abort(ctx.deserialize(node.reason));
75
- if (node.controller) return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
75
+ if (node.controller) {
76
+ const controller = ctx.deserialize(node.controller);
77
+ if (!(controller instanceof Promise)) throw new Error("Expected a Promise source.");
78
+ return PROMISE_TO_ABORT_SIGNAL(controller).signal;
79
+ }
76
80
  return new AbortController().signal;
77
81
  }
78
82
  });
@@ -491,6 +495,7 @@ const ReadableStreamPlugin = /* @__PURE__ */ createPlugin({
491
495
  },
492
496
  deserialize(node, ctx) {
493
497
  const stream = ctx.deserialize(node.stream);
498
+ if (!stream || typeof stream !== "object" || !isStream(stream)) throw new Error("Expected a stream source.");
494
499
  return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
495
500
  }
496
501
  });
@@ -50,7 +50,7 @@ const AbortSignalPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
50
50
  return PROMISE_TO_ABORT_SIGNAL.toString();
51
51
  },
52
52
  deserialize() {
53
- return PROMISE_TO_ABORT_SIGNAL;
53
+ throw new Error("seroval-plugins/web/AbortControllerFactoryPlugin cannot be deserialized directly.");
54
54
  }
55
55
  })],
56
56
  test(value) {
@@ -83,7 +83,11 @@ const AbortSignalPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
83
83
  },
84
84
  deserialize(node, ctx) {
85
85
  if (node.reason) return AbortSignal.abort(ctx.deserialize(node.reason));
86
- if (node.controller) return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
86
+ if (node.controller) {
87
+ const controller = ctx.deserialize(node.controller);
88
+ if (!(controller instanceof Promise)) throw new Error("Expected a Promise source.");
89
+ return PROMISE_TO_ABORT_SIGNAL(controller).signal;
90
+ }
87
91
  return new AbortController().signal;
88
92
  }
89
93
  });
@@ -502,6 +506,7 @@ const ReadableStreamPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
502
506
  },
503
507
  deserialize(node, ctx) {
504
508
  const stream = ctx.deserialize(node.stream);
509
+ if (!stream || typeof stream !== "object" || !(0, seroval.isStream)(stream)) throw new Error("Expected a stream source.");
505
510
  return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
506
511
  }
507
512
  });
package/dist/dev/web.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_web = require("./web-Cz0hD_-8.cjs");
2
+ const require_web = require("./web-SNaRz6Pu.cjs");
3
3
  exports.AbortSignalPlugin = require_web.AbortSignalPlugin;
4
4
  exports.BlobPlugin = require_web.BlobPlugin;
5
5
  exports.CustomEventPlugin = require_web.CustomEventPlugin;
package/dist/dev/web.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as RequestPlugin, c as HeadersPlugin, d as EventPlugin, f as DOMExceptionPlugin, h as AbortSignalPlugin, i as ResponsePlugin, l as FormDataPlugin, m as BlobPlugin, n as URLSearchParamsPlugin, o as ReadableStreamPlugin, p as CustomEventPlugin, r as URLPlugin, s as ImageDataPlugin, u as FilePlugin } from "./web-43VA2W_p.js";
1
+ import { a as RequestPlugin, c as HeadersPlugin, d as EventPlugin, f as DOMExceptionPlugin, h as AbortSignalPlugin, i as ResponsePlugin, l as FormDataPlugin, m as BlobPlugin, n as URLSearchParamsPlugin, o as ReadableStreamPlugin, p as CustomEventPlugin, r as URLPlugin, s as ImageDataPlugin, u as FilePlugin } from "./web-C5aekFCA.js";
2
2
  export { AbortSignalPlugin, BlobPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FilePlugin, FormDataPlugin, HeadersPlugin, ImageDataPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLPlugin, URLSearchParamsPlugin };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_web = require("./web-Cz0hD_-8.cjs");
2
+ const require_web = require("./web-SNaRz6Pu.cjs");
3
3
  Object.defineProperty(exports, "web", {
4
4
  enumerable: true,
5
5
  get: function() {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as web_exports } from "./web-43VA2W_p.js";
1
+ import { t as web_exports } from "./web-C5aekFCA.js";
2
2
  export { web_exports as web };
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { createPlugin, createStream } from "seroval";
2
+ import { createPlugin, createStream, isStream } from "seroval";
3
3
  //#region web/abort-signal.ts
4
4
  const PROMISE_TO_ABORT_SIGNAL = (promise) => {
5
5
  const controller = new AbortController();
@@ -39,7 +39,7 @@ const AbortSignalPlugin = /* @__PURE__ */ createPlugin({
39
39
  return PROMISE_TO_ABORT_SIGNAL.toString();
40
40
  },
41
41
  deserialize() {
42
- return PROMISE_TO_ABORT_SIGNAL;
42
+ throw new Error("seroval-plugins/web/AbortControllerFactoryPlugin cannot be deserialized directly.");
43
43
  }
44
44
  })],
45
45
  test(value) {
@@ -72,7 +72,11 @@ const AbortSignalPlugin = /* @__PURE__ */ createPlugin({
72
72
  },
73
73
  deserialize(node, ctx) {
74
74
  if (node.reason) return AbortSignal.abort(ctx.deserialize(node.reason));
75
- if (node.controller) return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
75
+ if (node.controller) {
76
+ const controller = ctx.deserialize(node.controller);
77
+ if (!(controller instanceof Promise)) throw new Error("Expected a Promise source.");
78
+ return PROMISE_TO_ABORT_SIGNAL(controller).signal;
79
+ }
76
80
  return new AbortController().signal;
77
81
  }
78
82
  });
@@ -491,6 +495,7 @@ const ReadableStreamPlugin = /* @__PURE__ */ createPlugin({
491
495
  },
492
496
  deserialize(node, ctx) {
493
497
  const stream = ctx.deserialize(node.stream);
498
+ if (!stream || typeof stream !== "object" || !isStream(stream)) throw new Error("Expected a stream source.");
494
499
  return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
495
500
  }
496
501
  });
@@ -50,7 +50,7 @@ const AbortSignalPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
50
50
  return PROMISE_TO_ABORT_SIGNAL.toString();
51
51
  },
52
52
  deserialize() {
53
- return PROMISE_TO_ABORT_SIGNAL;
53
+ throw new Error("seroval-plugins/web/AbortControllerFactoryPlugin cannot be deserialized directly.");
54
54
  }
55
55
  })],
56
56
  test(value) {
@@ -83,7 +83,11 @@ const AbortSignalPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
83
83
  },
84
84
  deserialize(node, ctx) {
85
85
  if (node.reason) return AbortSignal.abort(ctx.deserialize(node.reason));
86
- if (node.controller) return PROMISE_TO_ABORT_SIGNAL(ctx.deserialize(node.controller)).signal;
86
+ if (node.controller) {
87
+ const controller = ctx.deserialize(node.controller);
88
+ if (!(controller instanceof Promise)) throw new Error("Expected a Promise source.");
89
+ return PROMISE_TO_ABORT_SIGNAL(controller).signal;
90
+ }
87
91
  return new AbortController().signal;
88
92
  }
89
93
  });
@@ -502,6 +506,7 @@ const ReadableStreamPlugin = /* @__PURE__ */ (0, seroval.createPlugin)({
502
506
  },
503
507
  deserialize(node, ctx) {
504
508
  const stream = ctx.deserialize(node.stream);
509
+ if (!stream || typeof stream !== "object" || !(0, seroval.isStream)(stream)) throw new Error("Expected a stream source.");
505
510
  return READABLE_STREAM_FACTORY_CONSTRUCTOR(stream);
506
511
  }
507
512
  });
package/dist/web.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_web = require("./web-Cz0hD_-8.cjs");
2
+ const require_web = require("./web-SNaRz6Pu.cjs");
3
3
  exports.AbortSignalPlugin = require_web.AbortSignalPlugin;
4
4
  exports.BlobPlugin = require_web.BlobPlugin;
5
5
  exports.CustomEventPlugin = require_web.CustomEventPlugin;
package/dist/web.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as RequestPlugin, c as HeadersPlugin, d as EventPlugin, f as DOMExceptionPlugin, h as AbortSignalPlugin, i as ResponsePlugin, l as FormDataPlugin, m as BlobPlugin, n as URLSearchParamsPlugin, o as ReadableStreamPlugin, p as CustomEventPlugin, r as URLPlugin, s as ImageDataPlugin, u as FilePlugin } from "./web-43VA2W_p.js";
1
+ import { a as RequestPlugin, c as HeadersPlugin, d as EventPlugin, f as DOMExceptionPlugin, h as AbortSignalPlugin, i as ResponsePlugin, l as FormDataPlugin, m as BlobPlugin, n as URLSearchParamsPlugin, o as ReadableStreamPlugin, p as CustomEventPlugin, r as URLPlugin, s as ImageDataPlugin, u as FilePlugin } from "./web-C5aekFCA.js";
2
2
  export { AbortSignalPlugin, BlobPlugin, CustomEventPlugin, DOMExceptionPlugin, EventPlugin, FilePlugin, FormDataPlugin, HeadersPlugin, ImageDataPlugin, ReadableStreamPlugin, RequestPlugin, ResponsePlugin, URLPlugin, URLSearchParamsPlugin };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "seroval-plugins",
3
3
  "type": "module",
4
- "version": "1.6.3",
4
+ "version": "1.6.5",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
@@ -16,7 +16,7 @@
16
16
  "@types/node": "^26.2.0",
17
17
  "@vitest/ui": "^4.1.10",
18
18
  "esbuild": "^0.28.2",
19
- "seroval": "1.6.3",
19
+ "seroval": "1.6.5",
20
20
  "tsdown": "^0.22.14",
21
21
  "tslib": "^2.8.1",
22
22
  "typescript": "^7.0.2",