single-file-cli 2.0.31 → 2.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/lib/browser.js +10 -2
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/deno.json
CHANGED
package/lib/browser.js
CHANGED
|
@@ -64,6 +64,9 @@ async function launchBrowser(options = {}, indexPath = 0) {
|
|
|
64
64
|
args = args.filter(arg => !argNames.includes(arg.split("=")[0]));
|
|
65
65
|
args.push(...options.args);
|
|
66
66
|
}
|
|
67
|
+
if (options.args.includes("--headless=new") || args.includes("--auto-open-devtools-for-tabs")) {
|
|
68
|
+
args.push("--disable-site-isolation-trials");
|
|
69
|
+
}
|
|
67
70
|
const command = new Command(executablePath, { args, stdout: PIPED_STD_CONFIG, stderr: PIPED_STD_CONFIG });
|
|
68
71
|
try {
|
|
69
72
|
child = await command.spawn();
|
|
@@ -82,7 +85,7 @@ async function launchBrowser(options = {}, indexPath = 0) {
|
|
|
82
85
|
return debugPort;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
|
-
async function getDebugPort(port =
|
|
88
|
+
async function getDebugPort(port = getRandomDebugPort(), usedPorts = []) {
|
|
86
89
|
try {
|
|
87
90
|
await fetch("http://localhost:" + port + "/json/version");
|
|
88
91
|
} catch (error) {
|
|
@@ -91,7 +94,7 @@ async function getDebugPort(port = 9222, usedPorts = []) {
|
|
|
91
94
|
if (usedPorts.length < DEBUG_PORT_RANGE) {
|
|
92
95
|
usedPorts.push(port);
|
|
93
96
|
do {
|
|
94
|
-
port =
|
|
97
|
+
port = getRandomDebugPort();
|
|
95
98
|
} while (usedPorts.includes(port));
|
|
96
99
|
return getDebugPort(port, usedPorts);
|
|
97
100
|
} else {
|
|
@@ -99,6 +102,11 @@ async function getDebugPort(port = 9222, usedPorts = []) {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
|
|
105
|
+
|
|
106
|
+
function getRandomDebugPort() {
|
|
107
|
+
return Math.floor(Math.random() * DEBUG_PORT_RANGE) + DEBUG_PORT_MIN;
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
async function closeBrowser() {
|
|
103
111
|
if (child !== undefined) {
|
|
104
112
|
child.kill();
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.0.
|
|
1
|
+
export const version = "2.0.32";
|