From 38fa2dbc1e26e312ea59f647202c9ef0eca170d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 28 Dec 2023 20:30:07 +0100 Subject: [PATCH] chore: update deno_core to 0.240.0 (#21726) --- Cargo.lock | 12 ++-- Cargo.toml | 2 +- ext/console/01_console.js | 51 +++------------ ext/console/lib.rs | 65 +------------------- ext/node/polyfills/internal_binding/types.ts | 20 +++--- runtime/js/99_main.js | 8 +-- 6 files changed, 29 insertions(+), 129 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0348016871..9f251cd622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.239.0" +version = "0.240.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7765fb48adcbe8949483afc28dc39de500a5464eb3b4b211d2920aca1af236b" +checksum = "ea9bea00d7d4c7bef64e61421f227ee3114f510f6ad9826fbc5a29463c578c75" dependencies = [ "anyhow", "bytes", @@ -1571,9 +1571,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.115.0" +version = "0.116.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c81860fa6e339f5db9bfbf55503300b8b86c7bbdfde70bf9fcfa57624e1b0eef" +checksum = "5fd1cec75129fb26122c079a5644fa89b0c9c6a5078814c734113dac5e368120" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5140,9 +5140,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.148.0" +version = "0.149.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29fc23773946897ae2bc9db186b27103d35d35591bfa541d5570a30de14c72f2" +checksum = "3727a7a969fb85aa7f6a31071dcf8b574809871f8fc07ccd9abdf21152112496" dependencies = [ "bytes", "derive_more", diff --git a/Cargo.toml b/Cargo.toml index 4d00b1c3f1..ea21a70809 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "0.31.6", features = ["transpiling"] } -deno_core = { version = "0.239.0" } +deno_core = { version = "0.240.0" } deno_runtime = { version = "0.137.0", path = "./runtime" } napi_sym = { version = "0.59.0", path = "./cli/napi/sym" } diff --git a/ext/console/01_console.js b/ext/console/01_console.js index e5f5d8dcd8..eaa69ae04b 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 5464da555f..87791303cb 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 1f0528b2f5..e5df43ba80 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 { - 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 { @@ -174,17 +174,17 @@ export function isMap(value: unknown): value is Map { 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 { - 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 { - 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 { @@ -240,7 +240,7 @@ export function isSet(value: unknown): value is Set { export function isSetIterator( value: unknown, ): value is IterableIterator { - return ops.op_is_set_iterator(value); + return core.isSetIterator(value); } export function isSharedArrayBuffer( diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index b67b6a0bf6..2ab10c13e5 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -39,7 +39,6 @@ import { inspectArgs, quoteString, setNoColorFn, - wrapConsole, } from "ext:deno_console/01_console.js"; import * as performance from "ext:deno_web/15_performance.js"; import * as url from "ext:deno_url/00_url.js"; @@ -480,9 +479,8 @@ function bootstrapMainRuntime(runtimeOptions) { ObjectSetPrototypeOf(globalThis, Window.prototype); if (inspectFlag) { - const consoleFromV8 = core.console; const consoleFromDeno = globalThis.console; - wrapConsole(consoleFromDeno, consoleFromV8); + core.wrapConsole(consoleFromDeno, core.v8Console); } event.setEventTargetData(globalThis); @@ -574,8 +572,6 @@ function bootstrapWorkerRuntime( performance.setTimeOrigin(DateNow()); globalThis_ = globalThis; - const consoleFromV8 = globalThis.Deno.core.console; - // Remove bootstrapping data from the global scope delete globalThis.__bootstrap; delete globalThis.bootstrap; @@ -603,7 +599,7 @@ function bootstrapWorkerRuntime( ObjectSetPrototypeOf(globalThis, DedicatedWorkerGlobalScope.prototype); const consoleFromDeno = globalThis.console; - wrapConsole(consoleFromDeno, consoleFromV8); + core.wrapConsole(consoleFromDeno, core.v8Console); event.setEventTargetData(globalThis); event.saveGlobalThisReference(globalThis);