0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-05 10:26:44 -05:00
deno/ext/console/lib.rs
Bartek Iwańczuk e4b8fa5f4f
fix: move extension file declarations to cli/tsc/dts (#28180)
This commits moves all `.d.ts` files from `ext/*` to `cli/tsc/dts`.

Due to TSC snapshot removal, `cargo publish` is now erroring out,
unable to find the declaration files. These files were moved to
"cli/tsc/dts", because it's much easier than keeping them in 
extension directories, while still providing them compressed 
or uncompressed depending on the build type.
2025-02-19 02:53:21 +01:00

30 lines
730 B
Rust

// Copyright 2018-2025 the Deno authors. MIT license.
use deno_core::op2;
use deno_core::v8;
deno_core::extension!(
deno_console,
ops = [op_preview_entries],
esm = ["01_console.js"],
);
#[op2]
pub fn op_preview_entries<'s>(
scope: &mut v8::HandleScope<'s>,
object: &v8::Object,
slow_path: bool,
) -> v8::Local<'s, v8::Value> {
let (entries, is_key_value) = object.preview_entries(scope);
match entries {
None => v8::undefined(scope).into(),
Some(entries) => {
if !slow_path {
return entries.into();
}
let ret: [v8::Local<v8::Value>; 2] =
[entries.into(), v8::Boolean::new(scope, is_key_value).into()];
v8::Array::new_with_elements(scope, &ret).into()
}
}
}