diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-05-17 21:27:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 22:27:17 +0200 |
commit | 330c820ae8d7826dfe3d88c01ba07728121fa021 (patch) | |
tree | a5c0216f5cba4ea503e9cba3b0abdd8d4290c123 /runtime/js/99_main.js | |
parent | f57aac77ff9ce514730504066daca0a61a959d32 (diff) |
BREAKING(unstable): Enable Deno namespace in workers by default (#14581)
This commit removes "WorkerOptions.deno" option as a boolean,
as well as "WorkerOptions.deno.namespace" settings. Starting
with this commit all workers have access to "Deno" namespace
by default.
Diffstat (limited to 'runtime/js/99_main.js')
-rw-r--r-- | runtime/js/99_main.js | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index cf2525b06..b469a29dc 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -26,7 +26,6 @@ delete Object.prototype.__proto__; PromisePrototypeThen, TypeError, } = window.__bootstrap.primordials; - const infra = window.__bootstrap.infra; const util = window.__bootstrap.util; const eventTarget = window.__bootstrap.eventTarget; const globalInterfaces = window.__bootstrap.globalInterfaces; @@ -627,7 +626,6 @@ delete Object.prototype.__proto__; function bootstrapWorkerRuntime( runtimeOptions, name, - useDenoNamespace, internalName, ) { if (hasBootstrapped) { @@ -697,23 +695,18 @@ delete Object.prototype.__proto__; close: core.close, ...denoNs, }; - if (useDenoNamespace) { - if (unstableFlag) { - ObjectAssign(finalDenoNs, denoNsUnstable); - } - ObjectDefineProperties(finalDenoNs, { - pid: util.readOnly(pid), - noColor: util.readOnly(noColor), - args: util.readOnly(ObjectFreeze(args)), - }); - // Setup `Deno` global - we're actually overriding already - // existing global `Deno` with `Deno` namespace from "./deno.ts". - ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs)); - ObjectFreeze(globalThis.Deno.core); - } else { - delete globalThis.Deno; - infra.assert(globalThis.Deno === undefined); + if (unstableFlag) { + ObjectAssign(finalDenoNs, denoNsUnstable); } + ObjectDefineProperties(finalDenoNs, { + pid: util.readOnly(pid), + noColor: util.readOnly(noColor), + args: util.readOnly(ObjectFreeze(args)), + }); + // Setup `Deno` global - we're actually overriding already + // existing global `Deno` with `Deno` namespace from "./deno.ts". + ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs)); + ObjectFreeze(globalThis.Deno.core); } ObjectDefineProperties(globalThis, { |