Skip to content

Commit f858fb7

Browse files
committed
chore - deno 2
1 parent 9305a88 commit f858fb7

13 files changed

Lines changed: 30 additions & 20 deletions

File tree

src/core/pandoc/pandoc-formats.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export async function pandocListFormatDefaultExtensions(format: string) {
3131
return [];
3232
}
3333
const result = await execProcess({
34-
cmd: [pandocBinaryPath(), `--list-extensions=${format}`],
34+
cmd: pandocBinaryPath(),
35+
args: [`--list-extensions=${format}`],
3536
stdout: "piped",
3637
});
3738
if (result.success) {

src/core/pandoc/self-contained.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export const pandocIngestSelfContainedContent = async (
7272
cmd.push("--resource-path", resourcePath.join(":"));
7373
}
7474
const result = await execProcess({
75-
cmd,
75+
cmd: cmd[0],
76+
args: cmd.slice(1),
7677
stdout: "piped",
7778
cwd: workingDir,
7879
}, input.join("\n"));

src/core/performance/metrics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { Stats } from "./stats.ts";
1010

1111
type FileReadRecord = {
1212
path: string;
13-
stack: string;
13+
stack: string[];
1414
};
1515

1616
let fileReads: FileReadRecord[] | undefined = undefined;
@@ -24,6 +24,7 @@ export function captureFileReads() {
2424
try {
2525
throw new Error("File read");
2626
} catch (e) {
27+
if (!(e instanceof Error)) throw e;
2728
const stack = e.stack!.split("\n").slice(2);
2829
fileReads!.push({ path: String(path), stack });
2930
}

src/core/puppeteer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export async function withPuppeteerBrowserAndPage<T>(
125125
return result!;
126126
}
127127
} catch (error) {
128+
if (!(error instanceof Error)) throw error;
128129
if (
129130
(allowedErrorMessages.indexOf(error.message) !== -1) &&
130131
(attempts < maxAttempts)
@@ -166,6 +167,7 @@ export async function inPuppeteer(
166167
return clientSideResult;
167168
});
168169
} catch (error) {
170+
if (!(error instanceof Error)) throw error;
169171
if (
170172
(allowedErrorMessages.indexOf(error.message) !== -1) &&
171173
(attempts < maxAttempts)

src/core/retry.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/*
2-
* retry.ts
3-
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
5-
*
6-
*/
2+
* retry.ts
3+
*
4+
* Copyright (C) 2020-2022 Posit Software, PBC
5+
*/
76

87
import { sleep } from "./wait.ts";
98

@@ -23,12 +22,13 @@ export async function withRetry<T = void>(
2322
minWait = 1000,
2423
maxWait = 4000,
2524
retry = () => true,
26-
} = (options || {});
25+
} = options || {};
2726
let attempt = 0;
2827
while (true) {
2928
try {
3029
return fn();
3130
} catch (err) {
31+
if (!(err instanceof Error)) throw err;
3232
if ((attempt++ >= attempts) || (retry && !retry(err))) {
3333
throw err;
3434
}

src/core/run/deno.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export const denoRunHandler: RunHandler = {
4343

4444
return await execProcess(
4545
{
46-
cmd: [
47-
architectureToolsPath("deno"),
46+
cmd: architectureToolsPath("deno"),
47+
args: [
4848
"run",
4949
"--import-map",
5050
importMap,

src/core/run/lua.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export const luaRunHandler: RunHandler = {
4343

4444
return await execProcess(
4545
{
46-
cmd,
46+
cmd: cmd[0],
47+
args: cmd.slice(1),
4748
...options,
4849
},
4950
"",
@@ -96,8 +97,8 @@ setmetatable(_G, meta)
9697
// call pandoc w/ temp script as --to
9798
try {
9899
return await execProcess({
99-
cmd: [
100-
pandocBinaryPath(),
100+
cmd: pandocBinaryPath(),
101+
args: [
101102
"--from",
102103
"markdown",
103104
"--to",

src/core/run/python.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export const pythonRunHandler: RunHandler = {
2020
stdin?: string,
2121
options?: RunHandlerOptions,
2222
) => {
23+
const pythonCmd = await pythonExec();
2324
return await execProcess(
2425
{
25-
cmd: [
26-
...(await pythonExec()),
26+
cmd: pythonCmd[0],
27+
args: [
28+
...pythonCmd.slice(1),
2729
script,
2830
...args,
2931
],

src/core/run/r.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const rRunHandler: RunHandler = {
2222
) => {
2323
return await execProcess(
2424
{
25-
cmd: [
26-
await rBinaryPath("Rscript"),
25+
cmd: (await rBinaryPath("Rscript")),
26+
args: [
2727
script,
2828
...args,
2929
],

src/core/run/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface RunHandlerOptions {
1111
env?: {
1212
[key: string]: string;
1313
};
14-
stdout?: "inherit" | "piped" | "null" | number;
14+
stdout?: "inherit" | "piped" | "null";
1515
}
1616

1717
export interface RunHandler {

0 commit comments

Comments
 (0)