summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-01-31 23:17:49 +0100
committerGitHub <noreply@github.com>2024-01-31 23:17:49 +0100
commit95e4741f0008577097984752e8eb3960e68ff169 (patch)
tree19fabc91ceb68269e2e66a9d7490d7641a6f6f07 /runtime/js
parent13a91a69f87df98a31030d602f629a9a20f8a9c8 (diff)
refactor: migrate runtime/ and ext/canvas/ to virtual ops module (#22196)
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js32
1 files changed, 19 insertions, 13 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index adbc32b75..1d3cce8de 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -5,6 +5,16 @@ delete Intl.v8BreakIterator;
import { core, internals, primordials } from "ext:core/mod.js";
const ops = core.ops;
+import {
+ op_bootstrap_args,
+ op_bootstrap_is_tty,
+ op_bootstrap_no_color,
+ op_bootstrap_pid,
+ op_main_module,
+ op_ppid,
+ op_set_format_exception_callback,
+ op_snapshot_options,
+} from "ext:core/ops";
const {
ArrayPrototypeFilter,
ArrayPrototypeIncludes,
@@ -331,14 +341,10 @@ function importScripts(...urls) {
}
}
-function opMainModule() {
- return ops.op_main_module();
-}
-
-const opArgs = memoizeLazy(() => ops.op_bootstrap_args());
-const opPid = memoizeLazy(() => ops.op_bootstrap_pid());
-const opPpid = memoizeLazy(() => ops.op_ppid());
-setNoColorFn(() => ops.op_bootstrap_no_color() || !ops.op_bootstrap_is_tty());
+const opArgs = memoizeLazy(() => op_bootstrap_args());
+const opPid = memoizeLazy(() => op_bootstrap_pid());
+const opPpid = memoizeLazy(() => op_ppid());
+setNoColorFn(() => op_bootstrap_no_color() || !op_bootstrap_is_tty());
function formatException(error) {
if (
@@ -433,7 +439,7 @@ function runtimeStart(
core.setMacrotaskCallback(timers.handleTimerMacrotask);
core.setWasmStreamingCallback(fetch.handleWasmStreaming);
core.setReportExceptionCallback(event.reportException);
- ops.op_set_format_exception_callback(formatException);
+ op_set_format_exception_callback(formatException);
version.setVersions(
denoVersion,
v8Version,
@@ -741,7 +747,7 @@ const {
tsVersion,
v8Version,
target,
-} = ops.op_snapshot_options();
+} = op_snapshot_options();
function bootstrapMainRuntime(runtimeOptions) {
if (hasBootstrapped) {
@@ -823,9 +829,9 @@ function bootstrapMainRuntime(runtimeOptions) {
ObjectDefineProperties(finalDenoNs, {
pid: util.getterOnly(opPid),
ppid: util.getterOnly(opPpid),
- noColor: util.getterOnly(() => ops.op_bootstrap_no_color()),
+ noColor: util.getterOnly(() => op_bootstrap_no_color()),
args: util.getterOnly(opArgs),
- mainModule: util.getterOnly(opMainModule),
+ mainModule: util.getterOnly(() => op_main_module()),
// TODO(kt3k): Remove this export at v2
// See https://github.com/denoland/deno/issues/9294
customInspect: {
@@ -983,7 +989,7 @@ function bootstrapWorkerRuntime(
ObjectDefineProperties(finalDenoNs, {
pid: util.getterOnly(opPid),
- noColor: util.getterOnly(() => ops.op_bootstrap_no_color()),
+ noColor: util.getterOnly(() => op_bootstrap_no_color()),
args: util.getterOnly(opArgs),
// TODO(kt3k): Remove this export at v2
// See https://github.com/denoland/deno/issues/9294