mirror of
https://github.com/denoland/deno.git
synced 2025-08-02 18:12:39 +00:00
refactor: don't expose Deno[Deno.internal].core namespace (#18816)
This commit is contained in:
parent
2df6db36c8
commit
14aaa73c02
12 changed files with 95 additions and 61 deletions
|
@ -391,12 +391,6 @@ function promiseRejectMacrotaskCallback() {
|
|||
let hasBootstrapped = false;
|
||||
// Set up global properties shared by main and worker runtime.
|
||||
ObjectDefineProperties(globalThis, windowOrWorkerGlobalScope);
|
||||
// FIXME(bartlomieju): temporarily add whole `Deno.core` to
|
||||
// `Deno[Deno.internal]` namespace. It should be removed and only necessary
|
||||
// methods should be left there.
|
||||
ObjectAssign(internals, {
|
||||
core,
|
||||
});
|
||||
const internalSymbol = Symbol("Deno.internal");
|
||||
const finalDenoNs = {
|
||||
internal: internalSymbol,
|
||||
|
@ -428,7 +422,7 @@ function bootstrapMainRuntime(runtimeOptions) {
|
|||
13: v8Version,
|
||||
14: userAgent,
|
||||
15: inspectFlag,
|
||||
// 16: enableTestingFeaturesFlag
|
||||
16: enableTestingFeaturesFlag,
|
||||
} = runtimeOptions;
|
||||
|
||||
performance.setTimeOrigin(DateNow());
|
||||
|
@ -503,6 +497,12 @@ function bootstrapMainRuntime(runtimeOptions) {
|
|||
ObjectAssign(finalDenoNs, denoNsUnstable);
|
||||
}
|
||||
|
||||
// Add `Deno[Deno.internal].core` namespace if
|
||||
// `--enable-testing-features-do-not-use` flag is set.
|
||||
if (enableTestingFeaturesFlag) {
|
||||
ObjectAssign(internals, { core });
|
||||
}
|
||||
|
||||
// Setup `Deno` global - we're actually overriding already existing global
|
||||
// `Deno` with `Deno` namespace from "./deno.ts".
|
||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||
|
@ -612,6 +612,11 @@ function bootstrapWorkerRuntime(
|
|||
noColor: util.readOnly(noColor),
|
||||
args: util.readOnly(ObjectFreeze(args)),
|
||||
});
|
||||
// Add `Deno[Deno.internal].core` namespace if
|
||||
// `--enable-testing-features-do-not-use` flag is set.
|
||||
if (enableTestingFeaturesFlag) {
|
||||
ObjectAssign(internals, { core });
|
||||
}
|
||||
// Setup `Deno` global - we're actually overriding already
|
||||
// existing global `Deno` with `Deno` namespace from "./deno.ts".
|
||||
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue