diff --git a/lib/internal/error-serdes.js b/lib/internal/error-serdes.js index 1d0c742dc435d3..b907842c3896ff 100644 --- a/lib/internal/error-serdes.js +++ b/lib/internal/error-serdes.js @@ -1,7 +1,6 @@ 'use strict'; const Buffer = require('buffer').Buffer; -const { serialize, deserialize } = require('v8'); const { SafeSet, Object, @@ -85,7 +84,9 @@ function inspect(...args) { return internalUtilInspect.inspect(...args); } +let serialize; function serializeError(error) { + if (!serialize) serialize = require('v8').serialize; try { if (typeof error === 'object' && ObjectPrototypeToString(error) === '[object Error]') { @@ -110,7 +111,9 @@ function serializeError(error) { Buffer.from(inspect(error), 'utf8')]); } +let deserialize; function deserializeError(error) { + if (!deserialize) deserialize = require('v8').deserialize; switch (error[0]) { case kSerializedError: const { constructor, properties } = deserialize(error.subarray(1)); diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index e65098b92295bc..4693072b8159ad 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -71,13 +71,8 @@ if (common.isMainThread) { expectedModules.add('NativeModule internal/process/main_thread_only'); expectedModules.add('NativeModule internal/process/stdio'); } else { - expectedModules.add('Internal Binding heap_utils'); expectedModules.add('Internal Binding messaging'); - expectedModules.add('Internal Binding serdes'); - expectedModules.add('Internal Binding stream_wrap'); expectedModules.add('Internal Binding symbols'); - expectedModules.add('Internal Binding uv'); - expectedModules.add('Internal Binding v8'); expectedModules.add('Internal Binding worker'); expectedModules.add('NativeModule _stream_duplex'); expectedModules.add('NativeModule _stream_passthrough'); @@ -86,7 +81,6 @@ if (common.isMainThread) { expectedModules.add('NativeModule _stream_writable'); expectedModules.add('NativeModule internal/error-serdes'); expectedModules.add('NativeModule internal/process/worker_thread_only'); - expectedModules.add('NativeModule internal/stream_base_commons'); expectedModules.add('NativeModule internal/streams/buffer_list'); expectedModules.add('NativeModule internal/streams/destroy'); expectedModules.add('NativeModule internal/streams/end-of-stream'); @@ -97,7 +91,6 @@ if (common.isMainThread) { expectedModules.add('NativeModule internal/worker/io'); expectedModules.add('NativeModule module'); expectedModules.add('NativeModule stream'); - expectedModules.add('NativeModule v8'); expectedModules.add('NativeModule worker_threads'); }