mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix(ext/node): handle node child_process with --v8-options flag (#24804)
Makes `v8flags` package from NPM work.
This commit is contained in:
parent
f6fad68d7b
commit
1faac2dce3
6 changed files with 34 additions and 0 deletions
|
@ -1030,6 +1030,7 @@ const kNodeFlagsMap = new Map([
|
||||||
["--v8-pool-size", kLongArg],
|
["--v8-pool-size", kLongArg],
|
||||||
]);
|
]);
|
||||||
const kDenoSubcommands = new Set([
|
const kDenoSubcommands = new Set([
|
||||||
|
"add",
|
||||||
"bench",
|
"bench",
|
||||||
"bundle",
|
"bundle",
|
||||||
"cache",
|
"cache",
|
||||||
|
@ -1046,6 +1047,7 @@ const kDenoSubcommands = new Set([
|
||||||
"install",
|
"install",
|
||||||
"lint",
|
"lint",
|
||||||
"lsp",
|
"lsp",
|
||||||
|
"publish",
|
||||||
"repl",
|
"repl",
|
||||||
"run",
|
"run",
|
||||||
"tasks",
|
"tasks",
|
||||||
|
@ -1092,6 +1094,12 @@ function toDenoArgs(args: string[]): string[] {
|
||||||
let isLongWithValue = false;
|
let isLongWithValue = false;
|
||||||
let flagValue;
|
let flagValue;
|
||||||
|
|
||||||
|
if (flag === "--v8-options") {
|
||||||
|
// If --v8-options is passed, it should be replaced with --v8-flags="--help".
|
||||||
|
denoArgs.push("--v8-flags=--help");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (flagInfo === undefined) {
|
if (flagInfo === undefined) {
|
||||||
// If the flag was not found, it's either not a known flag or it's a long
|
// If the flag was not found, it's either not a known flag or it's a long
|
||||||
// flag containing an '='.
|
// flag containing an '='.
|
||||||
|
|
1
tests/registry/npm/v8flags/registry.json
Normal file
1
tests/registry/npm/v8flags/registry.json
Normal file
File diff suppressed because one or more lines are too long
BIN
tests/registry/npm/v8flags/v8flags-4.0.1.tgz
Normal file
BIN
tests/registry/npm/v8flags/v8flags-4.0.1.tgz
Normal file
Binary file not shown.
5
tests/specs/run/npm_v8flags/__test__.jsonc
Normal file
5
tests/specs/run/npm_v8flags/__test__.jsonc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"args": "run -A main.js",
|
||||||
|
"output": "main.out",
|
||||||
|
"exitCode": 0
|
||||||
|
}
|
17
tests/specs/run/npm_v8flags/main.js
Normal file
17
tests/specs/run/npm_v8flags/main.js
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import v8flags from "npm:v8flags@4.0.1";
|
||||||
|
|
||||||
|
const flags = await new Promise((resolve, reject) => {
|
||||||
|
v8flags((err, flags) => {
|
||||||
|
if (err) {
|
||||||
|
reject(err);
|
||||||
|
} else {
|
||||||
|
resolve(flags);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (flags.length < 100) {
|
||||||
|
throw new Error("Expected at least 100 flags");
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("ok");
|
3
tests/specs/run/npm_v8flags/main.out
Normal file
3
tests/specs/run/npm_v8flags/main.out
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Download http://localhost:4260/v8flags
|
||||||
|
Download http://localhost:4260/v8flags/v8flags-4.0.1.tgz
|
||||||
|
ok
|
Loading…
Reference in a new issue