Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package/src/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function download(src: string, dest: string): Promise<void> {

const file = await Deno.create(dest);
await writeAll(file, contents);
Deno.close(file.rid);
file.close();
}

export async function unzip(
Expand Down
2 changes: 1 addition & 1 deletion src/core/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export function writeFileToStdout(file: string) {
const df = Deno.openSync(file, { read: true });
const contents = readAllSync(df);
writeAllSync(Deno.stdout, contents);
Deno.close(df.rid);
df.close();
}

export function clearLine() {
Expand Down
33 changes: 0 additions & 33 deletions src/core/performance/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,4 @@ export function reportPeformanceMetrics() {
console.log("Performance metrics");
console.log("Quarto:");
console.log(JSON.stringify(quartoPerformanceMetrics(), null, 2));
console.log();
// denoMetrics is some kind of fancy object that doesn't respond
// to a bunch of the normal methods. So we have to do this
// the JSON-round-trip way.
console.log("Deno:");
const denoMetrics = JSON.parse(JSON.stringify(Deno.metrics() as any));
denoMetrics.ops = Object.fromEntries(
Object.entries(denoMetrics.ops).map(
([key, opMetrics]: any) => {
for (const key of Object.keys(opMetrics)) {
if (opMetrics[key] === 0) {
delete opMetrics[key];
}
}
return [key, opMetrics];
},
).filter(([_key, opMetrics]: any) => Object.keys(opMetrics).length > 0)
.map(([key, opMetrics]: any) => {
if (
(opMetrics.opsDispatched === opMetrics.opsDispatchedSync &&
opMetrics.opsDispatched === opMetrics.opsCompleted &&
opMetrics.opsDispatched === opMetrics.opsCompletedSync) ||
(opMetrics.opsDispatched === opMetrics.opsDispatchedAsync &&
opMetrics.opsDispatched === opMetrics.opsCompleted &&
opMetrics.opsDispatched === opMetrics.opsCompletedAsync)
) {
return [key, opMetrics.opsDispatched];
} else {
return [key, opMetrics];
}
}),
);
console.log(JSON.stringify(denoMetrics, null, 2));
}
2 changes: 1 addition & 1 deletion src/core/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function jupyterHubServicePrefix() {
}

export function isInteractiveTerminal() {
return Deno.isatty(Deno.stderr.rid);
return Deno.stderr.isTerminal();
}

export function isInteractiveSession() {
Expand Down
5 changes: 3 additions & 2 deletions src/core/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { MuxAsyncIterator, pooledMap } from "async";
import { iterateReader } from "io/iterate-reader";
import { type Closer, type Reader } from "io/types";
import { debug, info } from "../deno_ral/log.ts";
import { onCleanup } from "./cleanup.ts";
import { ProcessResult } from "./process-types.ts";
Expand Down Expand Up @@ -104,7 +105,7 @@ export async function execProcess(

// Add streams to the multiplexer
const addStream = (
stream: (Deno.Reader & Deno.Closer) | null,
stream: (Reader & Closer) | null,
filter?: (output: string) => string,
) => {
if (stream !== null) {
Expand All @@ -131,7 +132,7 @@ export async function execProcess(
}

// Close the streams
const closeStream = (stream: (Deno.Reader & Deno.Closer) | null) => {
const closeStream = (stream: (Reader & Closer) | null) => {
if (stream) {
stream.close();
}
Expand Down
8 changes: 4 additions & 4 deletions src/project/types/website/listing/website-listing-feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(preamble));
await feedFile.write(textEncoder.encode(preamble));

for (const feedItem of feedItems) {
const item = renderEjs(
Expand All @@ -523,7 +523,7 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(item));
await feedFile.write(textEncoder.encode(item));
}

// Render the postamble
Expand All @@ -534,9 +534,9 @@ async function generateFeed(
escape,
},
);
await Deno.write(feedFile.rid, textEncoder.encode(postamble));
await feedFile.write(textEncoder.encode(postamble));
} finally {
Deno.close(feedFile.rid);
feedFile.close();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/publish/common/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function stageDocumentPublish(title: string, publishFiles: PublishFiles) {
const publishDir = globalTempContext().createDir();

// copy all files to it
const stagedFiles = window.structuredClone(publishFiles) as PublishFiles;
const stagedFiles = globalThis.structuredClone(publishFiles) as PublishFiles;
stagedFiles.baseDir = publishDir;
for (const file of publishFiles.files) {
const src = join(publishFiles.baseDir, file);
Expand Down
Loading