summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto
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 /ext/node/polyfills/internal/crypto
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 'ext/node/polyfills/internal/crypto')
-rw-r--r--ext/node/polyfills/internal/crypto/_randomInt.ts3
-rw-r--r--ext/node/polyfills/internal/crypto/random.ts2
2 files changed, 3 insertions, 2 deletions
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;