diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-12-07 14:21:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-07 14:21:01 +0100 |
commit | c1fc7b2cd511ce83566f696c8880d6718e5c6885 (patch) | |
tree | 6430faa4996b1022c0e1ae1e78cb3b9e196029eb /ext | |
parent | 5dd9b26155ceed514364f92fe4fdacb6b8cc8182 (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 'ext')
57 files changed, 58 insertions, 97 deletions
diff --git a/ext/broadcast_channel/01_broadcast_channel.js b/ext/broadcast_channel/01_broadcast_channel.js index a482a2dce..6ee857474 100644 --- a/ext/broadcast_channel/01_broadcast_channel.js +++ b/ext/broadcast_channel/01_broadcast_channel.js @@ -2,7 +2,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; @@ -13,7 +13,6 @@ import { setTarget, } from "ext:deno_web/02_event.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeIndexOf, ArrayPrototypePush, diff --git a/ext/cache/01_cache.js b/ext/cache/01_cache.js index d3514a3f2..ef5db61cc 100644 --- a/ext/cache/01_cache.js +++ b/ext/cache/01_cache.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"; import * as webidl from "ext:deno_webidl/00_webidl.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypePush, ObjectPrototypeIsPrototypeOf, diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 4f0ff6362..27203789f 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -2,9 +2,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; -const internals = globalThis.__bootstrap.internals; -const primordials = globalThis.__bootstrap.primordials; +import { core, internals, primordials } from "ext:core/mod.js"; const { AggregateErrorPrototype, Array, diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 58cbde716..f20de7a40 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -6,9 +6,8 @@ /// <reference path="../webidl/internal.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; -const primordials = globalThis.__bootstrap.primordials; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js index d03751d08..4b95595ec 100644 --- a/ext/fetch/20_headers.js +++ b/ext/fetch/20_headers.js @@ -19,7 +19,7 @@ import { HTTP_TOKEN_CODE_POINT_RE, httpTrim, } from "ext:deno_web/00_infra.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayIsArray, ArrayPrototypePush, diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js index 12ce2bb58..0d9990fcd 100644 --- a/ext/fetch/21_formdata.js +++ b/ext/fetch/21_formdata.js @@ -9,7 +9,7 @@ /// <reference path="./lib.deno_fetch.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { Blob, @@ -17,7 +17,6 @@ import { File, FilePrototype, } from "ext:deno_web/09_file.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypePush, ArrayPrototypeSlice, diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index 644b9f76f..54edb7999 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -11,7 +11,7 @@ /// <reference path="./lib.deno_fetch.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { parseUrlEncoded, @@ -36,7 +36,6 @@ import { readableStreamTee, readableStreamThrowIfErrored, } from "ext:deno_web/06_streams.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBufferPrototype, ArrayBufferIsView, diff --git a/ext/fetch/22_http_client.js b/ext/fetch/22_http_client.js index 45f5de80e..25c3cba97 100644 --- a/ext/fetch/22_http_client.js +++ b/ext/fetch/22_http_client.js @@ -10,7 +10,7 @@ /// <reference path="./lib.deno_fetch.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; const ops = core.ops; import { SymbolDispose } from "ext:deno_web/00_infra.js"; diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js index b78ed07be..512355766 100644 --- a/ext/fetch/23_request.js +++ b/ext/fetch/23_request.js @@ -30,7 +30,7 @@ import { } from "ext:deno_fetch/20_headers.js"; import { HttpClientPrototype } from "ext:deno_fetch/22_http_client.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeMap, ArrayPrototypeSlice, diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js index 0b37c1229..e5ec8fedf 100644 --- a/ext/fetch/23_response.js +++ b/ext/fetch/23_response.js @@ -10,7 +10,7 @@ /// <reference path="./lib.deno_fetch.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; import { @@ -30,7 +30,6 @@ import { headerListFromHeaders, headersFromHeaderList, } from "ext:deno_fetch/20_headers.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeMap, ArrayPrototypePush, diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js index 8a71d9bcf..b70d6d873 100644 --- a/ext/fetch/26_fetch.js +++ b/ext/fetch/26_fetch.js @@ -10,7 +10,7 @@ /// <reference path="./lib.deno_fetch.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { byteLowerCase } from "ext:deno_web/00_infra.js"; @@ -32,7 +32,6 @@ import { toInnerResponse, } from "ext:deno_fetch/23_response.js"; import * as abortSignal from "ext:deno_web/03_abort_signal.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypePush, ArrayPrototypeSplice, diff --git a/ext/fetch/27_eventsource.js b/ext/fetch/27_eventsource.js index 1db65d748..b8ceffb16 100644 --- a/ext/fetch/27_eventsource.js +++ b/ext/fetch/27_eventsource.js @@ -2,7 +2,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; @@ -19,7 +19,6 @@ import { getLocationHref } from "ext:deno_web/12_location.js"; import { newInnerRequest } from "ext:deno_fetch/23_request.js"; import { mainFetch } from "ext:deno_fetch/26_fetch.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeFind, Number, diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index 233935be9..ef9123442 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.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 { ArrayBufferIsView, ArrayBufferPrototype, diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 830703230..29c6c4aac 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -1,6 +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 { op_fs_chmod_async, @@ -9,7 +9,6 @@ const { op_fs_link_async, op_fs_flock_async, } = Deno.core.ensureFastOps(); -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeFilter, Date, diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js index adb03a22c..beac52289 100644 --- a/ext/http/00_serve.js +++ b/ext/http/00_serve.js @@ -1,8 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -const core = globalThis.Deno.core; -const primordials = globalThis.__bootstrap.primordials; -const internals = globalThis.__bootstrap.internals; +import { core, internals, primordials } from "ext:core/mod.js"; const { BadResourcePrototype, InterruptedPrototype } = core; import { InnerBody } from "ext:deno_fetch/22_body.js"; diff --git a/ext/http/01_http.js b/ext/http/01_http.js index cfe0f710e..acaea5e7c 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -1,8 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -const core = globalThis.Deno.core; -const internals = globalThis.__bootstrap.internals; -const primordials = globalThis.__bootstrap.primordials; +import { core, internals, primordials } from "ext:core/mod.js"; const { BadResourcePrototype, InterruptedPrototype, ops } = core; const { op_http_write } = Deno.core.ensureFastOps(); import * as webidl from "ext:deno_webidl/00_webidl.js"; diff --git a/ext/io/12_io.js b/ext/io/12_io.js index e1d72ffb5..c38ee12b0 100644 --- a/ext/io/12_io.js +++ b/ext/io/12_io.js @@ -4,9 +4,8 @@ // Documentation liberally lifted from them too. // Thank you! We love Go! <3 -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; -const primordials = globalThis.__bootstrap.primordials; import { readableStreamForRid, writableStreamForRid, diff --git a/ext/net/01_net.js b/ext/net/01_net.js index b4b8ca218..c81ca61c5 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -1,6 +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 { BadResourcePrototype, InterruptedPrototype, ops } = core; import { readableStreamForRidUnrefable, @@ -11,7 +11,6 @@ import { import * as abortSignal from "ext:deno_web/03_abort_signal.js"; import { SymbolDispose } from "ext:deno_web/00_infra.js"; -const primordials = globalThis.__bootstrap.primordials; const { Error, Number, diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index 4be2f08e0..a73e3ef04 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -1,9 +1,8 @@ // 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; import { Conn, Listener } from "ext:deno_net/01_net.js"; -const primordials = globalThis.__bootstrap.primordials; const { Number, TypeError } = primordials; function opStartTls(args) { diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index eb845f237..c6b84543a 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -2,10 +2,8 @@ // deno-lint-ignore-file -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 { ArrayIsArray, ArrayPrototypeIncludes, diff --git a/ext/node/polyfills/_process/process.ts b/ext/node/polyfills/_process/process.ts index 062effe07..b153c8e19 100644 --- a/ext/node/polyfills/_process/process.ts +++ b/ext/node/polyfills/_process/process.ts @@ -7,7 +7,7 @@ // The following are all the process APIs that don't depend on the stream module // They have to be split this way to prevent a circular dependency -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; import { nextTick as _nextTick } from "ext:deno_node/_next_tick.ts"; import { _exiting } from "ext:deno_node/_process/exiting.ts"; import * as fs from "ext:deno_fs/30_fs.js"; diff --git a/ext/node/polyfills/http2.ts b/ext/node/polyfills/http2.ts index afd9a22bc..bab607b80 100644 --- a/ext/node/polyfills/http2.ts +++ b/ext/node/polyfills/http2.ts @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; import { notImplemented, warnNotImplemented } from "ext:deno_node/_utils.ts"; import { EventEmitter } from "node:events"; import { Buffer } from "node:buffer"; diff --git a/ext/node/polyfills/internal/crypto/_randomInt.ts b/ext/node/polyfills/internal/crypto/_randomInt.ts index 9f161668d..e5ab41ee7 100644 --- a/ext/node/polyfills/internal/crypto/_randomInt.ts +++ b/ext/node/polyfills/internal/crypto/_randomInt.ts @@ -3,7 +3,8 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const ops = globalThis.Deno.core.ops; +import { core } from "ext:core/mod.js"; +const ops = core.ops; export default function randomInt(max: number): number; export default function randomInt(min: number, max: number): number; diff --git a/ext/node/polyfills/internal/crypto/random.ts b/ext/node/polyfills/internal/crypto/random.ts index e8776cdf0..4a4b68274 100644 --- a/ext/node/polyfills/internal/crypto/random.ts +++ b/ext/node/polyfills/internal/crypto/random.ts @@ -32,7 +32,7 @@ export { } from "ext:deno_node/internal/crypto/_randomFill.mjs"; export { default as randomInt } from "ext:deno_node/internal/crypto/_randomInt.ts"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { StringPrototypePadStart, StringPrototypeToString } = primordials; const { core } = globalThis.__bootstrap; diff --git a/ext/node/polyfills/internal/process/report.ts b/ext/node/polyfills/internal/process/report.ts index 7d178626c..cd77eeda5 100644 --- a/ext/node/polyfills/internal/process/report.ts +++ b/ext/node/polyfills/internal/process/report.ts @@ -3,7 +3,7 @@ import { arch, versions } from "ext:deno_node/_process/process.ts"; import { cpus, hostname, networkInterfaces } from "node:os"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { Error, StringPrototypeToUpperCase, diff --git a/ext/node/polyfills/internal/timers.mjs b/ext/node/polyfills/internal/timers.mjs index 3dc5073c6..92fb51d57 100644 --- a/ext/node/polyfills/internal/timers.mjs +++ b/ext/node/polyfills/internal/timers.mjs @@ -4,7 +4,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { MapPrototypeDelete, MapPrototypeSet, diff --git a/ext/node/polyfills/internal/util/parse_args/parse_args.js b/ext/node/polyfills/internal/util/parse_args/parse_args.js index 798039620..910eef436 100644 --- a/ext/node/polyfills/internal/util/parse_args/parse_args.js +++ b/ext/node/polyfills/internal/util/parse_args/parse_args.js @@ -1,7 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeForEach, ArrayPrototypeIncludes, diff --git a/ext/node/polyfills/internal/util/parse_args/utils.js b/ext/node/polyfills/internal/util/parse_args/utils.js index d101dd3fd..8cbbbc6c2 100644 --- a/ext/node/polyfills/internal/util/parse_args/utils.js +++ b/ext/node/polyfills/internal/util/parse_args/utils.js @@ -1,7 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // Copyright Joyent and Node contributors. All rights reserved. MIT license. -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeFind, ObjectEntries, diff --git a/ext/node/polyfills/internal/validators.mjs b/ext/node/polyfills/internal/validators.mjs index b5b539088..e728d40ad 100644 --- a/ext/node/polyfills/internal/validators.mjs +++ b/ext/node/polyfills/internal/validators.mjs @@ -9,7 +9,7 @@ import { hideStackFrames } from "ext:deno_node/internal/hide_stack_frames.ts"; import { isArrayBufferView } from "ext:deno_node/internal/util/types.ts"; import { normalizeEncoding } from "ext:deno_node/internal/normalize_encoding.mjs"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeIncludes, ArrayPrototypeJoin, diff --git a/ext/node/polyfills/internal_binding/stream_wrap.ts b/ext/node/polyfills/internal_binding/stream_wrap.ts index 3e4d0be6a..f381b21ce 100644 --- a/ext/node/polyfills/internal_binding/stream_wrap.ts +++ b/ext/node/polyfills/internal_binding/stream_wrap.ts @@ -40,7 +40,7 @@ import { } from "ext:deno_node/internal_binding/async_wrap.ts"; import { codeMap } from "ext:deno_node/internal_binding/uv.ts"; -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; const { ops } = core; interface Reader { diff --git a/ext/node/polyfills/internal_binding/udp_wrap.ts b/ext/node/polyfills/internal_binding/udp_wrap.ts index d8b0bf059..98ca5bb3a 100644 --- a/ext/node/polyfills/internal_binding/udp_wrap.ts +++ b/ext/node/polyfills/internal_binding/udp_wrap.ts @@ -23,7 +23,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; const ops = core.ops; import { AsyncWrap, diff --git a/ext/node/polyfills/internal_binding/util.ts b/ext/node/polyfills/internal_binding/util.ts index 59f1246fc..302b2d57c 100644 --- a/ext/node/polyfills/internal_binding/util.ts +++ b/ext/node/polyfills/internal_binding/util.ts @@ -28,7 +28,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const core = globalThis.Deno.core; +import { core } from "ext:core/mod.js"; const ops = core.ops; const handleTypes = ["TCP", "TTY", "UDP", "FILE", "PIPE", "UNKNOWN"]; diff --git a/ext/node/polyfills/timers.ts b/ext/node/polyfills/timers.ts index 2bedbe65b..a9953a1e7 100644 --- a/ext/node/polyfills/timers.ts +++ b/ext/node/polyfills/timers.ts @@ -3,7 +3,7 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { MapPrototypeGet, MapPrototypeDelete, diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts index 68c9626c9..a77167253 100644 --- a/ext/node/polyfills/util.ts +++ b/ext/node/polyfills/util.ts @@ -16,7 +16,7 @@ import { isDeepStrictEqual } from "ext:deno_node/internal/util/comparisons.ts"; import process from "node:process"; import { validateString } from "ext:deno_node/internal/validators.mjs"; import { parseArgs } from "ext:deno_node/internal/util/parse_args/parse_args.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayIsArray, ArrayPrototypeJoin, diff --git a/ext/url/00_url.js b/ext/url/00_url.js index d0ec376d6..899a86aa0 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -5,11 +5,10 @@ /// <reference path="../../core/lib.deno_core.d.ts" /> /// <reference path="../webidl/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; 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 { ArrayIsArray, ArrayPrototypeMap, diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js index 71962d405..e0f63b707 100644 --- a/ext/url/01_urlpattern.js +++ b/ext/url/01_urlpattern.js @@ -7,11 +7,10 @@ /// <reference path="./internal.d.ts" /> /// <reference path="./lib.deno_url.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; 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 { ArrayPrototypePop, RegExpPrototypeExec, diff --git a/ext/web/00_infra.js b/ext/web/00_infra.js index 441081604..91bacb9e9 100644 --- a/ext/web/00_infra.js +++ b/ext/web/00_infra.js @@ -6,10 +6,8 @@ /// <reference path="../web/internal.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" /> -const core = globalThis.Deno.core; -const internals = globalThis.__bootstrap.internals; +import { core, internals, primordials } from "ext:core/mod.js"; const ops = core.ops; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeJoin, ArrayPrototypeMap, diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js index 941b057e4..fcf96e77a 100644 --- a/ext/web/01_dom_exception.js +++ b/ext/web/01_dom_exception.js @@ -7,7 +7,7 @@ /// <reference path="../web/internal.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" /> -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeSlice, Error, diff --git a/ext/web/01_mimesniff.js b/ext/web/01_mimesniff.js index 7d402e080..66cc41e2c 100644 --- a/ext/web/01_mimesniff.js +++ b/ext/web/01_mimesniff.js @@ -6,7 +6,7 @@ /// <reference path="../web/internal.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" /> -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeIncludes, MapPrototypeGet, diff --git a/ext/web/02_event.js b/ext/web/02_event.js index f0c24f353..a171a1991 100644 --- a/ext/web/02_event.js +++ b/ext/web/02_event.js @@ -5,11 +5,10 @@ // parts still exists. This means you will observe a lot of strange structures // and impossible logic branches based on what Deno currently supports. -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeFilter, ArrayPrototypeIncludes, diff --git a/ext/web/02_structured_clone.js b/ext/web/02_structured_clone.js index b0c7559c0..53e146616 100644 --- a/ext/web/02_structured_clone.js +++ b/ext/web/02_structured_clone.js @@ -6,9 +6,8 @@ /// <reference path="../web/internal.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBuffer, ArrayBufferPrototype, diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js index ee974345b..27a9fcbde 100644 --- a/ext/web/02_timers.js +++ b/ext/web/02_timers.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 { ArrayPrototypePush, ArrayPrototypeShift, diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js index f534ec04f..acde8b42e 100644 --- a/ext/web/03_abort_signal.js +++ b/ext/web/03_abort_signal.js @@ -13,7 +13,7 @@ import { listenerCount, setIsTrusted, } from "ext:deno_web/02_event.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeEvery, ArrayPrototypePush, diff --git a/ext/web/04_global_interfaces.js b/ext/web/04_global_interfaces.js index 375c98198..c68a5d1c3 100644 --- a/ext/web/04_global_interfaces.js +++ b/ext/web/04_global_interfaces.js @@ -4,7 +4,7 @@ /// <reference path="../../core/internal.d.ts" /> import { EventTarget } from "ext:deno_web/02_event.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { Symbol, SymbolToStringTag, diff --git a/ext/web/05_base64.js b/ext/web/05_base64.js index 3971b2e58..65792bd27 100644 --- a/ext/web/05_base64.js +++ b/ext/web/05_base64.js @@ -6,11 +6,10 @@ /// <reference path="../web/internal.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; -const primordials = globalThis.__bootstrap.primordials; const { ObjectPrototypeIsPrototypeOf, TypeErrorPrototype, diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 9fc15d1ad..1df375328 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -6,8 +6,7 @@ /// <reference path="./lib.deno_web.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; -const internals = globalThis.__bootstrap.internals; +import { core, internals, primordials } from "ext:core/mod.js"; const { op_arraybuffer_was_detached, op_transfer_arraybuffer, @@ -29,7 +28,6 @@ import { remove, signalAbort, } from "ext:deno_web/03_abort_signal.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBuffer, ArrayBufferIsView, diff --git a/ext/web/08_text_encoding.js b/ext/web/08_text_encoding.js index 81a3425ed..e942fadea 100644 --- a/ext/web/08_text_encoding.js +++ b/ext/web/08_text_encoding.js @@ -9,11 +9,10 @@ /// <reference path="../web/lib.deno_web.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; 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, DataViewPrototypeGetByteLength, diff --git a/ext/web/09_file.js b/ext/web/09_file.js index 7ee029d8a..6e91e2492 100644 --- a/ext/web/09_file.js +++ b/ext/web/09_file.js @@ -10,12 +10,11 @@ /// <reference path="./internal.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { ReadableStream } from "ext:deno_web/06_streams.js"; import { URL } from "ext:deno_url/00_url.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBufferPrototype, ArrayBufferPrototypeSlice, diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js index 07a5a38ec..437086861 100644 --- a/ext/web/10_filereader.js +++ b/ext/web/10_filereader.js @@ -10,11 +10,10 @@ /// <reference path="./internal.d.ts" /> /// <reference lib="esnext" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; 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; import { forgivingBase64Encode } from "ext:deno_web/00_infra.js"; import { EventTarget, ProgressEvent } from "ext:deno_web/02_event.js"; import { decode, TextDecoder } from "ext:deno_web/08_text_encoding.js"; diff --git a/ext/web/12_location.js b/ext/web/12_location.js index f469e9093..ed44d7c51 100644 --- a/ext/web/12_location.js +++ b/ext/web/12_location.js @@ -4,7 +4,7 @@ import { URL } from "ext:deno_url/00_url.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { Error, ObjectDefineProperties, diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js index 2a0d864ba..c1ba3f4c4 100644 --- a/ext/web/13_message_port.js +++ b/ext/web/13_message_port.js @@ -6,7 +6,7 @@ /// <reference path="./internal.d.ts" /> /// <reference path="./lib.deno_web.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const { InterruptedPrototype, ops } = core; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; @@ -18,7 +18,6 @@ import { setIsTrusted, } from "ext:deno_web/02_event.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBufferPrototype, ArrayBufferPrototypeGetByteLength, diff --git a/ext/web/14_compression.js b/ext/web/14_compression.js index 0563861c2..d992c33f2 100644 --- a/ext/web/14_compression.js +++ b/ext/web/14_compression.js @@ -5,9 +5,8 @@ /// <reference path="./internal.d.ts" /> /// <reference path="./lib.deno_web.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; -const primordials = globalThis.__bootstrap.primordials; const { SymbolFor, ObjectPrototypeIsPrototypeOf, diff --git a/ext/web/15_performance.js b/ext/web/15_performance.js index 4527ff00c..4a5b42ef6 100644 --- a/ext/web/15_performance.js +++ b/ext/web/15_performance.js @@ -1,6 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -const primordials = globalThis.__bootstrap.primordials; +import { primordials } from "ext:core/mod.js"; const { ArrayPrototypeFilter, ArrayPrototypeFind, diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index 956def267..30c515e24 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -6,8 +6,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; -const primordials = globalThis.__bootstrap.primordials; +import { core, primordials } from "ext:core/mod.js"; const { ArrayBufferPrototype, ArrayBufferIsView, diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js index a4e6b71a3..477f93b93 100644 --- a/ext/websocket/01_websocket.js +++ b/ext/websocket/01_websocket.js @@ -2,7 +2,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; import { URL } from "ext:deno_url/00_url.js"; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; @@ -20,7 +20,6 @@ import { } from "ext:deno_web/02_event.js"; import { Blob, BlobPrototype } from "ext:deno_web/09_file.js"; import { getLocationHref } from "ext:deno_web/12_location.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayBufferPrototype, ArrayBufferIsView, diff --git a/ext/websocket/02_websocketstream.js b/ext/websocket/02_websocketstream.js index ff24a72af..16346e73b 100644 --- a/ext/websocket/02_websocketstream.js +++ b/ext/websocket/02_websocketstream.js @@ -2,7 +2,7 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; @@ -14,7 +14,6 @@ import { headerListFromHeaders, headersFromHeaderList, } from "ext:deno_fetch/20_headers.js"; -const primordials = globalThis.__bootstrap.primordials; const { ArrayPrototypeJoin, ArrayPrototypeMap, diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js index 4e7c77aa0..c58e7e6ba 100644 --- a/ext/webstorage/01_webstorage.js +++ b/ext/webstorage/01_webstorage.js @@ -2,10 +2,9 @@ /// <reference path="../../core/internal.d.ts" /> -const core = globalThis.Deno.core; +import { core, primordials } from "ext:core/mod.js"; const ops = core.ops; import * as webidl from "ext:deno_webidl/00_webidl.js"; -const primordials = globalThis.__bootstrap.primordials; const { Symbol, SymbolFor, |