summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-12-07 14:21:01 +0100
committerGitHub <noreply@github.com>2023-12-07 14:21:01 +0100
commitc1fc7b2cd511ce83566f696c8880d6718e5c6885 (patch)
tree6430faa4996b1022c0e1ae1e78cb3b9e196029eb /runtime/js
parent5dd9b26155ceed514364f92fe4fdacb6b8cc8182 (diff)
refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)
This commit refactors how we access "core", "internals" and "primordials" objects coming from `deno_core`, in our internal JavaScript code. Instead of capturing them from "globalThis.__bootstrap" namespace, we import them from recently added "ext:core/mod.js" file.
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/01_errors.js3
-rw-r--r--runtime/js/06_util.js3
-rw-r--r--runtime/js/10_permissions.js4
-rw-r--r--runtime/js/11_workers.js3
-rw-r--r--runtime/js/30_os.js4
-rw-r--r--runtime/js/40_fs_events.js3
-rw-r--r--runtime/js/40_http.js2
-rw-r--r--runtime/js/40_process.js3
-rw-r--r--runtime/js/40_signals.js3
-rw-r--r--runtime/js/40_tty.js3
-rw-r--r--runtime/js/41_prompt.js3
-rw-r--r--runtime/js/90_deno_ns.js2
-rw-r--r--runtime/js/98_global_scope.js3
-rw-r--r--runtime/js/99_main.js4
14 files changed, 14 insertions, 29 deletions
diff --git a/runtime/js/01_errors.js b/runtime/js/01_errors.js
index 0c54f6581..fb88f735b 100644
--- a/runtime/js/01_errors.js
+++ b/runtime/js/01_errors.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const { BadResource, Interrupted } = core;
-const primordials = globalThis.__bootstrap.primordials;
const { Error } = primordials;
class NotFound extends Error {
diff --git a/runtime/js/06_util.js b/runtime/js/06_util.js
index c9fd4befe..838b1d18c 100644
--- a/runtime/js/06_util.js
+++ b/runtime/js/06_util.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
Promise,
SafeArrayIterator,
diff --git a/runtime/js/10_permissions.js b/runtime/js/10_permissions.js
index 075291a1b..2d3295f85 100644
--- a/runtime/js/10_permissions.js
+++ b/runtime/js/10_permissions.js
@@ -1,11 +1,9 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, internals, primordials } from "ext:core/mod.js";
const ops = core.ops;
import { pathFromURL } from "ext:deno_web/00_infra.js";
import { Event, EventTarget } from "ext:deno_web/02_event.js";
-const internals = globalThis.__bootstrap.internals;
-const primordials = globalThis.__bootstrap.primordials;
const {
ArrayIsArray,
ArrayPrototypeIncludes,
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js
index bd0d1afc8..60ea94bf4 100644
--- a/runtime/js/11_workers.js
+++ b/runtime/js/11_workers.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeFilter,
Error,
diff --git a/runtime/js/30_os.js b/runtime/js/30_os.js
index 583449083..5bc96e54b 100644
--- a/runtime/js/30_os.js
+++ b/runtime/js/30_os.js
@@ -1,10 +1,8 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, internals, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const internals = globalThis.__bootstrap.internals;
import { Event, EventTarget } from "ext:deno_web/02_event.js";
-const primordials = globalThis.__bootstrap.primordials;
const {
Error,
FunctionPrototypeBind,
diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js
index b10f6fd10..c9d0f1feb 100644
--- a/runtime/js/40_fs_events.js
+++ b/runtime/js/40_fs_events.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const { BadResourcePrototype, InterruptedPrototype, ops } = core;
-const primordials = globalThis.__bootstrap.primordials;
const {
ArrayIsArray,
ObjectPrototypeIsPrototypeOf,
diff --git a/runtime/js/40_http.js b/runtime/js/40_http.js
index 5ee219360..223c7a3e6 100644
--- a/runtime/js/40_http.js
+++ b/runtime/js/40_http.js
@@ -1,5 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core } from "ext:core/mod.js";
const ops = core.ops;
import { HttpConn } from "ext:deno_http/01_http.js";
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js
index 67093398a..b8e05ce5a 100644
--- a/runtime/js/40_process.js
+++ b/runtime/js/40_process.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeMap,
ArrayPrototypeSlice,
diff --git a/runtime/js/40_signals.js b/runtime/js/40_signals.js
index 3c5b83789..20771da36 100644
--- a/runtime/js/40_signals.js
+++ b/runtime/js/40_signals.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
SafeSet,
SafeSetIterator,
diff --git a/runtime/js/40_tty.js b/runtime/js/40_tty.js
index 7476daad3..cb1a456a0 100644
--- a/runtime/js/40_tty.js
+++ b/runtime/js/40_tty.js
@@ -1,7 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
Uint32Array,
} = primordials;
diff --git a/runtime/js/41_prompt.js b/runtime/js/41_prompt.js
index 37fdaed77..e665aae07 100644
--- a/runtime/js/41_prompt.js
+++ b/runtime/js/41_prompt.js
@@ -1,6 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
-const primordials = globalThis.__bootstrap.primordials;
+import { core, primordials } from "ext:core/mod.js";
import { isatty } from "ext:runtime/40_tty.js";
import { stdin } from "ext:deno_io/12_io.js";
const { ArrayPrototypePush, StringPrototypeCharCodeAt, Uint8Array } =
diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js
index 5ab56d8d7..834e5d1a3 100644
--- a/runtime/js/90_deno_ns.js
+++ b/runtime/js/90_deno_ns.js
@@ -1,6 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core } from "ext:core/mod.js";
const ops = core.ops;
import * as timers from "ext:deno_web/02_timers.js";
diff --git a/runtime/js/98_global_scope.js b/runtime/js/98_global_scope.js
index 406ea50f5..56354948e 100644
--- a/runtime/js/98_global_scope.js
+++ b/runtime/js/98_global_scope.js
@@ -1,8 +1,7 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-const core = globalThis.Deno.core;
+import { core, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const primordials = globalThis.__bootstrap.primordials;
const {
ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 050cd3bf8..22352bf29 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -3,10 +3,8 @@
// Remove Intl.v8BreakIterator because it is a non-standard API.
delete Intl.v8BreakIterator;
-const core = globalThis.Deno.core;
+import { core, internals, primordials } from "ext:core/mod.js";
const ops = core.ops;
-const internals = globalThis.__bootstrap.internals;
-const primordials = globalThis.__bootstrap.primordials;
const {
ArrayPrototypeFilter,
ArrayPrototypeIncludes,