summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index c8fdabc25..fdd82862c 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -438,6 +438,7 @@ function bootstrapMainRuntime(runtimeOptions) {
if (hasBootstrapped) {
throw new Error("Worker runtime already bootstrapped");
}
+ const nodeBootstrap = globalThis.nodeBootstrap;
const {
0: args,
@@ -456,6 +457,8 @@ function bootstrapMainRuntime(runtimeOptions) {
13: userAgent,
14: inspectFlag,
// 15: enableTestingFeaturesFlag
+ 16: hasNodeModulesDir,
+ 17: maybeBinaryNpmCommandName,
} = runtimeOptions;
performance.setTimeOrigin(DateNow());
@@ -464,12 +467,13 @@ function bootstrapMainRuntime(runtimeOptions) {
// Remove bootstrapping data from the global scope
delete globalThis.__bootstrap;
delete globalThis.bootstrap;
+ delete globalThis.nodeBootstrap;
hasBootstrapped = true;
// If the `--location` flag isn't set, make `globalThis.location` `undefined` and
// writable, so that they can mock it themselves if they like. If the flag was
// set, define `globalThis.location`, using the provided value.
- if (location_ === undefined) {
+ if (location_ == null) {
mainRuntimeGlobalProperties.location = {
writable: true,
};
@@ -542,6 +546,10 @@ function bootstrapMainRuntime(runtimeOptions) {
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
util.log("args", args);
+
+ if (nodeBootstrap) {
+ nodeBootstrap(hasNodeModulesDir, maybeBinaryNpmCommandName);
+ }
}
function bootstrapWorkerRuntime(
@@ -553,6 +561,8 @@ function bootstrapWorkerRuntime(
throw new Error("Worker runtime already bootstrapped");
}
+ const nodeBootstrap = globalThis.nodeBootstrap;
+
const {
0: args,
1: cpuCount,
@@ -570,6 +580,8 @@ function bootstrapWorkerRuntime(
13: userAgent,
// 14: inspectFlag,
15: enableTestingFeaturesFlag,
+ 16: hasNodeModulesDir,
+ 17: maybeBinaryNpmCommandName,
} = runtimeOptions;
performance.setTimeOrigin(DateNow());
@@ -580,6 +592,7 @@ function bootstrapWorkerRuntime(
// Remove bootstrapping data from the global scope
delete globalThis.__bootstrap;
delete globalThis.bootstrap;
+ delete globalThis.nodeBootstrap;
hasBootstrapped = true;
if (unstableFlag) {
@@ -649,6 +662,10 @@ function bootstrapWorkerRuntime(
// Setup `Deno` global - we're actually overriding already
// existing global `Deno` with `Deno` namespace from "./deno.ts".
ObjectDefineProperty(globalThis, "Deno", util.readOnly(finalDenoNs));
+
+ if (nodeBootstrap) {
+ nodeBootstrap(hasNodeModulesDir, maybeBinaryNpmCommandName);
+ }
}
globalThis.bootstrap = {