From 5d309ff52cd399a6b71968a6b9a70c8ac0b98981 Mon Sep 17 00:00:00 2001 From: Joel Kronqvist Date: Sat, 5 Mar 2022 19:02:27 +0200 Subject: Added node_modules for the updating to work properly. --- .../src/transformation/util/clone-deep-browser.ts | 19 +++++++++++++++++++ .../@babel/core/src/transformation/util/clone-deep.ts | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100644 node_modules/@babel/core/src/transformation/util/clone-deep-browser.ts create mode 100644 node_modules/@babel/core/src/transformation/util/clone-deep.ts (limited to 'node_modules/@babel/core/src/transformation') diff --git a/node_modules/@babel/core/src/transformation/util/clone-deep-browser.ts b/node_modules/@babel/core/src/transformation/util/clone-deep-browser.ts new file mode 100644 index 0000000..78ae53e --- /dev/null +++ b/node_modules/@babel/core/src/transformation/util/clone-deep-browser.ts @@ -0,0 +1,19 @@ +const serialized = "$$ babel internal serialized type" + Math.random(); + +function serialize(key, value) { + if (typeof value !== "bigint") return value; + return { + [serialized]: "BigInt", + value: value.toString(), + }; +} + +function revive(key, value) { + if (!value || typeof value !== "object") return value; + if (value[serialized] !== "BigInt") return value; + return BigInt(value.value); +} + +export default function (value) { + return JSON.parse(JSON.stringify(value, serialize), revive); +} diff --git a/node_modules/@babel/core/src/transformation/util/clone-deep.ts b/node_modules/@babel/core/src/transformation/util/clone-deep.ts new file mode 100644 index 0000000..cc077ce --- /dev/null +++ b/node_modules/@babel/core/src/transformation/util/clone-deep.ts @@ -0,0 +1,9 @@ +import v8 from "v8"; +import cloneDeep from "./clone-deep-browser"; + +export default function (value) { + if (v8.deserialize && v8.serialize) { + return v8.deserialize(v8.serialize(value)); + } + return cloneDeep(value); +} -- cgit v1.2.3