diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/console/01_console.js | 51 | ||||
-rw-r--r-- | ext/console/lib.rs | 65 | ||||
-rw-r--r-- | ext/node/polyfills/internal_binding/types.ts | 20 |
3 files changed, 20 insertions, 116 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js index e5f5d8dcd..eaa69ae04 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -272,7 +272,7 @@ function isAnyArrayBuffer(value) { } function isArgumentsObject(value) { - return ops.op_is_arguments_object(value); + return core.isArgumentsObject(value); } function isArrayBuffer(value) { @@ -285,7 +285,7 @@ function isArrayBuffer(value) { } function isAsyncFunction(value) { - return ops.op_is_async_function(value); + return core.isAsyncFunction(value); } function isBooleanObject(value) { @@ -325,7 +325,7 @@ function isTypedArray(value) { } function isGeneratorFunction(value) { - return ops.op_is_generator_function(value); + return core.isGeneratorFunction(value); } function isMap(value) { @@ -338,15 +338,15 @@ function isMap(value) { } function isMapIterator(value) { - return ops.op_is_map_iterator(value); + return core.isMapIterator(value); } function isModuleNamespaceObject(value) { - return ops.op_is_module_namespace_object(value); + return core.isModuleNamespaceObject(value); } function isNativeError(value) { - return ops.op_is_native_error(value); + return core.isNativeError(value); } function isNumberObject(value) { @@ -376,11 +376,11 @@ function isBigIntObject(value) { } function isPromise(value) { - return ops.op_is_promise(value); + return core.isPromise(value); } function isRegExp(value) { - return ops.op_is_reg_exp(value); + return core.isRegExp(value); } function isSet(value) { @@ -393,7 +393,7 @@ function isSet(value) { } function isSetIterator(value) { - return ops.op_is_set_iterator(value); + return core.isSetIterator(value); } function isStringObject(value) { @@ -3519,38 +3519,6 @@ function createFilteredInspectProxy({ object, keys, evaluate }) { } } -// A helper function that will bind our own console implementation -// with default implementation of Console from V8. This will cause -// console messages to be piped to inspector console. -// -// We are using `Deno.core.callConsole` binding to preserve proper stack -// frames in inspector console. This has to be done because V8 considers -// the last JS stack frame as gospel for the inspector. In our case we -// specifically want the latest user stack frame to be the one that matters -// though. -// -// Inspired by: -// https://github.com/nodejs/node/blob/1317252dfe8824fd9cfee125d2aaa94004db2f3b/lib/internal/util/inspector.js#L39-L61 -function wrapConsole(consoleFromDeno, consoleFromV8) { - const callConsole = core.callConsole; - - const keys = ObjectKeys(consoleFromV8); - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (ObjectHasOwn(consoleFromDeno, key)) { - consoleFromDeno[key] = FunctionPrototypeBind( - callConsole, - consoleFromDeno, - consoleFromV8[key], - consoleFromDeno[key], - ); - } else { - // Add additional console APIs from the inspector - consoleFromDeno[key] = consoleFromV8[key]; - } - } -} - // Expose these fields to internalObject for tests. internals.Console = Console; internals.cssToAnsi = cssToAnsi; @@ -3575,5 +3543,4 @@ export { quoteString, setNoColorFn, styles, - wrapConsole, }; diff --git a/ext/console/lib.rs b/ext/console/lib.rs index 5464da555..87791303c 100644 --- a/ext/console/lib.rs +++ b/ext/console/lib.rs @@ -5,20 +5,7 @@ use std::path::PathBuf; deno_core::extension!( deno_console, - ops = [ - op_is_any_arraybuffer, - op_is_arguments_object, - op_is_async_function, - op_is_generator_function, - op_is_generator_object, - op_is_map_iterator, - op_is_module_namespace_object, - op_is_native_error, - op_is_promise, - op_is_reg_exp, - op_is_set_iterator, - op_preview_entries, - ], + ops = [op_is_any_arraybuffer, op_preview_entries,], esm = ["01_console.js"], ); @@ -31,56 +18,6 @@ fn op_is_any_arraybuffer(value: &v8::Value) -> bool { value.is_array_buffer() || value.is_shared_array_buffer() } -#[op2(fast)] -pub fn op_is_arguments_object(value: &v8::Value) -> bool { - value.is_arguments_object() -} - -#[op2(fast)] -pub fn op_is_async_function(value: &v8::Value) -> bool { - value.is_async_function() -} - -#[op2(fast)] -pub fn op_is_generator_function(value: &v8::Value) -> bool { - value.is_generator_function() -} - -#[op2(fast)] -pub fn op_is_generator_object(value: &v8::Value) -> bool { - value.is_generator_object() -} - -#[op2(fast)] -pub fn op_is_map_iterator(value: &v8::Value) -> bool { - value.is_map_iterator() -} - -#[op2(fast)] -pub fn op_is_module_namespace_object(value: &v8::Value) -> bool { - value.is_module_namespace_object() -} - -#[op2(fast)] -pub fn op_is_native_error(value: &v8::Value) -> bool { - value.is_native_error() -} - -#[op2(fast)] -pub fn op_is_promise(value: &v8::Value) -> bool { - value.is_promise() -} - -#[op2(fast)] -pub fn op_is_reg_exp(value: &v8::Value) -> bool { - value.is_reg_exp() -} - -#[op2(fast)] -pub fn op_is_set_iterator(value: &v8::Value) -> bool { - value.is_set_iterator() -} - #[op2] pub fn op_preview_entries<'s>( scope: &mut v8::HandleScope<'s>, diff --git a/ext/node/polyfills/internal_binding/types.ts b/ext/node/polyfills/internal_binding/types.ts index 1f0528b2f..e5df43ba8 100644 --- a/ext/node/polyfills/internal_binding/types.ts +++ b/ext/node/polyfills/internal_binding/types.ts @@ -91,7 +91,7 @@ export function isAnyArrayBuffer( } export function isArgumentsObject(value: unknown): value is IArguments { - return ops.op_is_arguments_object(value); + return core.isArgumentsObject(value); } export function isArrayBuffer(value: unknown): value is ArrayBuffer { @@ -106,7 +106,7 @@ export function isArrayBuffer(value: unknown): value is ArrayBuffer { export function isAsyncFunction( value: unknown, ): value is (...args: unknown[]) => Promise<unknown> { - return ops.op_is_async_function(value); + return core.isAsyncFunction(value); } // deno-lint-ignore ban-types @@ -155,11 +155,11 @@ export function isDate(value: unknown): value is Date { export function isGeneratorFunction( value: unknown, ): value is GeneratorFunction { - return ops.op_is_generator_function(value); + return core.isGeneratorFunction(value); } export function isGeneratorObject(value: unknown): value is Generator { - return ops.op_is_generator_object(value); + return core.isGeneratorObject(value); } export function isMap(value: unknown): value is Map<unknown, unknown> { @@ -174,17 +174,17 @@ export function isMap(value: unknown): value is Map<unknown, unknown> { export function isMapIterator( value: unknown, ): value is IterableIterator<[unknown, unknown]> { - return ops.op_is_map_iterator(value); + return core.isMapIterator(value); } export function isModuleNamespaceObject( value: unknown, ): value is Record<string | number | symbol, unknown> { - return ops.op_is_module_namespace_object(value); + return core.isModuleNamespaceObject(value); } export function isNativeError(value: unknown): value is Error { - return ops.op_is_native_error(value); + return core.isNativeError(value); } // deno-lint-ignore ban-types @@ -215,7 +215,7 @@ export function isBigIntObject(value: unknown): value is bigint { } export function isPromise(value: unknown): value is Promise<unknown> { - return ops.op_is_promise(value); + return core.isPromise(value); } export function isProxy( @@ -225,7 +225,7 @@ export function isProxy( } export function isRegExp(value: unknown): value is RegExp { - return ops.op_is_reg_exp(value); + return core.isRegExp(value); } export function isSet(value: unknown): value is Set<unknown> { @@ -240,7 +240,7 @@ export function isSet(value: unknown): value is Set<unknown> { export function isSetIterator( value: unknown, ): value is IterableIterator<unknown> { - return ops.op_is_set_iterator(value); + return core.isSetIterator(value); } export function isSharedArrayBuffer( |