aboutsummaryrefslogtreecommitdiff
path: root/src/js/node
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-16 21:15:24 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-16 21:15:24 -0700
commit209dc981c0ef52de5c80eab5d24ec8a8eba765e8 (patch)
treec3d203d03d109161bcaf25558c05fda49c5e864e /src/js/node
parent7fc392b182fa45d1fa33e654c2b4d1f1022a1ac3 (diff)
downloadbun-209dc981c0ef52de5c80eab5d24ec8a8eba765e8.tar.gz
bun-209dc981c0ef52de5c80eab5d24ec8a8eba765e8.tar.zst
bun-209dc981c0ef52de5c80eab5d24ec8a8eba765e8.zip
Implement Workers (#3645)
* copy files * format * options * Introduce `Worker`, `onmessage`, `onerror`, and `postMessage` globals * Stub `Worker.prototype.ref` & `Worker.prototype.unref` * Update web_worker.zig * Worker works * Add "mini" mode * add wakeup * Partially fix the keep-alive issue * clean up refer behavior * Implement `serialize` & `deserialize` in `bun:jsc` & add polyfill for `node:v8` * Types & docs * Update globals.d.ts * Add mutex * Fixes --------- Co-authored-by: Dylan Conway <dylan.conway567@gmail.com> Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js/node')
-rw-r--r--src/js/node/v8.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/js/node/v8.ts b/src/js/node/v8.ts
index 3018c34e6..b043e10fe 100644
--- a/src/js/node/v8.ts
+++ b/src/js/node/v8.ts
@@ -1,6 +1,7 @@
// Hardcoded module "node:v8"
// This is a stub! None of this is actually implemented yet.
import { hideFromStack, throwNotImplemented } from "../shared";
+import { serialize as jscSerialize, deserialize as jscDeserialize } from "bun:jsc";
function notimpl(message) {
throwNotImplemented("node:v8 " + message);
@@ -42,8 +43,8 @@ function getHeapCodeStatistics() {
function setFlagsFromString() {
notimpl("setFlagsFromString");
}
-function deserialize() {
- notimpl("deserialize");
+function deserialize(value) {
+ return jscDeserialize(value);
}
function takeCoverage() {
notimpl("takeCoverage");
@@ -51,8 +52,8 @@ function takeCoverage() {
function stopCoverage() {
notimpl("stopCoverage");
}
-function serialize() {
- notimpl("serialize");
+function serialize(arg1) {
+ return jscSerialize(arg1, { binaryType: "nodebuffer" });
}
function writeHeapSnapshot() {
notimpl("writeHeapSnapshot");