mirror of
https://github.com/denoland/deno.git
synced 2025-08-31 07:47:46 +00:00
fix(ext,runtime): add missing custom inspections (#21219)
This commit is contained in:
parent
a7548afb58
commit
c806fbdabe
31 changed files with 848 additions and 376 deletions
|
@ -12,6 +12,7 @@
|
|||
const core = globalThis.Deno.core;
|
||||
const ops = core.ops;
|
||||
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
||||
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
|
||||
const primordials = globalThis.__bootstrap.primordials;
|
||||
const {
|
||||
DataViewPrototypeGetBuffer,
|
||||
|
@ -23,6 +24,7 @@ const {
|
|||
// SharedArrayBufferPrototype
|
||||
StringPrototypeCharCodeAt,
|
||||
StringPrototypeSlice,
|
||||
SymbolFor,
|
||||
TypedArrayPrototypeSubarray,
|
||||
TypedArrayPrototypeGetBuffer,
|
||||
TypedArrayPrototypeGetByteLength,
|
||||
|
@ -190,6 +192,21 @@ class TextDecoder {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||
return inspect(
|
||||
createFilteredInspectProxy({
|
||||
object: this,
|
||||
evaluate: ObjectPrototypeIsPrototypeOf(TextDecoderPrototype, this),
|
||||
keys: [
|
||||
"encoding",
|
||||
"fatal",
|
||||
"ignoreBOM",
|
||||
],
|
||||
}),
|
||||
inspectOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
webidl.configureInterface(TextDecoder);
|
||||
|
@ -247,6 +264,17 @@ class TextEncoder {
|
|||
written: encodeIntoBuf[1],
|
||||
};
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||
return inspect(
|
||||
createFilteredInspectProxy({
|
||||
object: this,
|
||||
evaluate: ObjectPrototypeIsPrototypeOf(TextEncoderPrototype, this),
|
||||
keys: ["encoding"],
|
||||
}),
|
||||
inspectOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const encodeIntoBuf = new Uint32Array(2);
|
||||
|
@ -342,6 +370,26 @@ class TextDecoderStream {
|
|||
webidl.assertBranded(this, TextDecoderStreamPrototype);
|
||||
return this.#transform.writable;
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||
return inspect(
|
||||
createFilteredInspectProxy({
|
||||
object: this,
|
||||
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||
TextDecoderStreamPrototype,
|
||||
this,
|
||||
),
|
||||
keys: [
|
||||
"encoding",
|
||||
"fatal",
|
||||
"ignoreBOM",
|
||||
"readable",
|
||||
"writable",
|
||||
],
|
||||
}),
|
||||
inspectOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
webidl.configureInterface(TextDecoderStream);
|
||||
|
@ -415,6 +463,24 @@ class TextEncoderStream {
|
|||
webidl.assertBranded(this, TextEncoderStreamPrototype);
|
||||
return this.#transform.writable;
|
||||
}
|
||||
|
||||
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
||||
return inspect(
|
||||
createFilteredInspectProxy({
|
||||
object: this,
|
||||
evaluate: ObjectPrototypeIsPrototypeOf(
|
||||
TextEncoderStreamPrototype,
|
||||
this,
|
||||
),
|
||||
keys: [
|
||||
"encoding",
|
||||
"readable",
|
||||
"writable",
|
||||
],
|
||||
}),
|
||||
inspectOptions,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
webidl.configureInterface(TextEncoderStream);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue