mirror of
https://github.com/denoland/deno.git
synced 2024-12-26 17:19:06 -05:00
64037b1f02
Turns out we only virtualized it so one could have a `Console` property, and the other one not. We can just make this `console.Console` available everywhere.
42 lines
958 B
TypeScript
42 lines
958 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
|
// deno-lint-ignore-file prefer-primordials
|
|
|
|
import { Console } from "ext:deno_node/internal/console/constructor.mjs";
|
|
import { windowOrWorkerGlobalScope } from "ext:runtime/98_global_scope_shared.js";
|
|
// Don't rely on global `console` because during bootstrapping, it is pointing
|
|
// to native `console` object provided by V8.
|
|
const console = windowOrWorkerGlobalScope.console.value;
|
|
|
|
Object.assign(console, { Console });
|
|
|
|
export default console;
|
|
|
|
export { Console };
|
|
export const {
|
|
assert,
|
|
clear,
|
|
count,
|
|
countReset,
|
|
debug,
|
|
dir,
|
|
dirxml,
|
|
error,
|
|
group,
|
|
groupCollapsed,
|
|
groupEnd,
|
|
info,
|
|
log,
|
|
profile,
|
|
profileEnd,
|
|
table,
|
|
time,
|
|
timeEnd,
|
|
timeLog,
|
|
timeStamp,
|
|
trace,
|
|
warn,
|
|
} = console;
|
|
// deno-lint-ignore no-explicit-any
|
|
export const indentLevel = (console as any)?.indentLevel;
|