diff --git a/package/src/util/utils.ts b/package/src/util/utils.ts index 3a0445a2d7d..f3145cf6420 100644 --- a/package/src/util/utils.ts +++ b/package/src/util/utils.ts @@ -24,7 +24,7 @@ export async function download(src: string, dest: string): Promise { const file = await Deno.create(dest); await writeAll(file, contents); - Deno.close(file.rid); + file.close(); } export async function unzip( diff --git a/src/core/console.ts b/src/core/console.ts index 590e855479e..0795ed0685f 100644 --- a/src/core/console.ts +++ b/src/core/console.ts @@ -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() { diff --git a/src/core/performance/metrics.ts b/src/core/performance/metrics.ts index 9551375a59b..fe4dfcbe067 100644 --- a/src/core/performance/metrics.ts +++ b/src/core/performance/metrics.ts @@ -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)); } diff --git a/src/core/platform.ts b/src/core/platform.ts index 74c890d4e4c..adb28fc8196 100644 --- a/src/core/platform.ts +++ b/src/core/platform.ts @@ -93,7 +93,7 @@ export function jupyterHubServicePrefix() { } export function isInteractiveTerminal() { - return Deno.isatty(Deno.stderr.rid); + return Deno.stderr.isTerminal(); } export function isInteractiveSession() { diff --git a/src/core/process.ts b/src/core/process.ts index 6912af70e11..809431547b8 100644 --- a/src/core/process.ts +++ b/src/core/process.ts @@ -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"; @@ -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) { @@ -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(); } diff --git a/src/project/types/website/listing/website-listing-feed.ts b/src/project/types/website/listing/website-listing-feed.ts index b23f144dd73..1b9d6ccd46e 100644 --- a/src/project/types/website/listing/website-listing-feed.ts +++ b/src/project/types/website/listing/website-listing-feed.ts @@ -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( @@ -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 @@ -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(); } } diff --git a/src/publish/common/publish.ts b/src/publish/common/publish.ts index 20c9e1f7cf5..e5a11573cc6 100644 --- a/src/publish/common/publish.ts +++ b/src/publish/common/publish.ts @@ -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);