deno-http-worker
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -15,3 +15,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
*/ | ||
denoExecutable: string; | ||
denoExecutable: string | string[]; | ||
/** | ||
@@ -18,0 +18,0 @@ * The path to the script that should be used to bootstrap the worker |
@@ -63,5 +63,14 @@ import path, { resolve } from "path"; | ||
} | ||
const command = _options.denoExecutable; | ||
if (Array.isArray(_options.denoExecutable) && | ||
_options.denoExecutable.length === 0) { | ||
throw new Error("denoExecutable must not be an empty array"); | ||
} | ||
const command = typeof _options.denoExecutable === "string" | ||
? _options.denoExecutable | ||
: _options.denoExecutable[0]; | ||
return new Promise(async (resolve, reject) => { | ||
const args = [ | ||
...(typeof _options.denoExecutable === "string" | ||
? [] | ||
: _options.denoExecutable.slice(1)), | ||
"run", | ||
@@ -68,0 +77,0 @@ ..._options.runFlags, |
@@ -52,3 +52,6 @@ import { it as _it, beforeAll, describe, expect } from "vitest"; | ||
} } | ||
`, { printOutput: true }); | ||
`, { | ||
printOutput: true, | ||
denoExecutable: ["lurk", "-f", "-s", "1000", "deno"], | ||
}); | ||
for (let i = 0; i < 10; i++) { | ||
@@ -55,0 +58,0 @@ let json = await jsonRequest(worker, "https://localhost/hello?isee=you", { |
{ | ||
"name": "deno-http-worker", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -63,3 +63,6 @@ import { it as _it, beforeAll, describe, expect } from "vitest"; | ||
`, | ||
{ printOutput: true } | ||
{ | ||
printOutput: true, | ||
denoExecutable: ["lurk", "-f", "-s", "1000", "deno"], | ||
} | ||
); | ||
@@ -66,0 +69,0 @@ for (let i = 0; i < 10; i++) { |
@@ -30,3 +30,3 @@ import path, { resolve } from "path"; | ||
*/ | ||
denoExecutable: string; | ||
denoExecutable: string | string[]; | ||
@@ -129,7 +129,18 @@ /** | ||
} | ||
if ( | ||
Array.isArray(_options.denoExecutable) && | ||
_options.denoExecutable.length === 0 | ||
) { | ||
throw new Error("denoExecutable must not be an empty array"); | ||
} | ||
const command = | ||
typeof _options.denoExecutable === "string" | ||
? _options.denoExecutable | ||
: (_options.denoExecutable[0] as string); | ||
const command = _options.denoExecutable; | ||
return new Promise(async (resolve, reject) => { | ||
const args = [ | ||
...(typeof _options.denoExecutable === "string" | ||
? [] | ||
: _options.denoExecutable.slice(1)), | ||
"run", | ||
@@ -143,2 +154,3 @@ ..._options.runFlags, | ||
} | ||
const process = spawn(command, args, _options.spawnOptions); | ||
@@ -145,0 +157,0 @@ let running = false; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
97537
25
1489