diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-02-14 00:50:15 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-02-13 08:50:15 -0500 |
commit | c468be64ed6cc3d3d3c2a74f15ba1157082f0f5b (patch) | |
tree | caa77e4b4d7f66ab532e4ee2c1d17a844de6cf89 | |
parent | 473d7317eafad44de4d99a3b0aa54f7e1d49ed79 (diff) |
Cleanup Deno namespace (#1765)
-rw-r--r-- | js/console.ts | 5 | ||||
-rw-r--r-- | js/console_test.ts | 5 | ||||
-rw-r--r-- | js/deno.ts | 15 | ||||
-rw-r--r-- | js/files.ts | 1 | ||||
-rw-r--r-- | js/metrics.ts | 2 | ||||
-rw-r--r-- | js/mixins/dom_iterable_test.ts | 8 | ||||
-rw-r--r-- | js/os.ts | 1 |
7 files changed, 26 insertions, 11 deletions
diff --git a/js/console.ts b/js/console.ts index e5dafceee..38931f5ee 100644 --- a/js/console.ts +++ b/js/console.ts @@ -366,7 +366,9 @@ function isCollapsed( return collapsedAt <= indentLevel; } -/** TODO Do not expose this from "deno" namespace. */ +/** TODO Do not expose this from "deno" namespace. + * @internal + */ export function stringifyArgs( // tslint:disable-next-line:no-any args: any[], @@ -501,6 +503,7 @@ const timerMap = new Map<string, number>(); export class Console { indentLevel: number; collapsedAt: number | null; + /** @internal */ constructor(private printFunc: PrintFunc) { this.indentLevel = 0; this.collapsedAt = null; diff --git a/js/console_test.ts b/js/console_test.ts index 42672221c..d61c87307 100644 --- a/js/console_test.ts +++ b/js/console_test.ts @@ -1,7 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { test, assertEqual, assert } from "./test_util.ts"; -const { Console, libdeno, stringifyArgs, inspect, write, stdout } = Deno; +// Some of these APIs aren't exposed in the types and so we have to cast to any +// in order to "trick" TypeScript. +// tslint:disable-next-line:no-any +const { Console, libdeno, stringifyArgs, inspect, write, stdout } = Deno as any; const console = new Console(libdeno.print); diff --git a/js/deno.ts b/js/deno.ts index 5f3998116..45e16e52d 100644 --- a/js/deno.ts +++ b/js/deno.ts @@ -31,9 +31,13 @@ export { } from "./io"; export { Buffer, readAll } from "./buffer"; export { mkdirSync, mkdir } from "./mkdir"; -export { makeTempDirSync, makeTempDir } from "./make_temp_dir"; +export { + makeTempDirSync, + makeTempDir, + MakeTempDirOptions +} from "./make_temp_dir"; export { chmodSync, chmod } from "./chmod"; -export { removeSync, remove } from "./remove"; +export { removeSync, remove, RemoveOption } from "./remove"; export { renameSync, rename } from "./rename"; export { readFileSync, readFile } from "./read_file"; export { readDirSync, readDir } from "./read_dir"; @@ -41,22 +45,25 @@ export { copyFileSync, copyFile } from "./copy_file"; export { readlinkSync, readlink } from "./read_link"; export { statSync, lstatSync, stat, lstat } from "./stat"; export { symlinkSync, symlink } from "./symlink"; -export { writeFileSync, writeFile } from "./write_file"; +export { writeFileSync, writeFile, WriteFileOptions } from "./write_file"; export { ErrorKind, DenoError } from "./errors"; export { libdeno } from "./libdeno"; export { platform } from "./platform"; export { truncateSync, truncate } from "./truncate"; export { FileInfo } from "./file_info"; export { connect, dial, listen, Listener, Conn } from "./net"; -export { metrics } from "./metrics"; +export { metrics, Metrics } from "./metrics"; export { resources } from "./resources"; export { run, RunOptions, Process, ProcessStatus } from "./process"; export { inspect } from "./console"; export const args: string[] = []; // TODO Don't expose Console nor stringifyArgs. +/** @internal */ export { Console, stringifyArgs } from "./console"; // TODO Don't expose DomIterableMixin. +/** @internal */ export { DomIterableMixin } from "./mixins/dom_iterable"; // TODO Don't expose deferred. +/** @internal */ export { deferred } from "./util"; diff --git a/js/files.ts b/js/files.ts index a876301f8..e2c7123e6 100644 --- a/js/files.ts +++ b/js/files.ts @@ -57,6 +57,7 @@ export type OpenMode = /** A factory function for creating instances of `File` associated with the * supplied file name. + * @internal */ export function create(filename: string): Promise<File> { return open(filename, "w+"); diff --git a/js/metrics.ts b/js/metrics.ts index 248b58f28..1cbc9f13b 100644 --- a/js/metrics.ts +++ b/js/metrics.ts @@ -4,7 +4,7 @@ import * as flatbuffers from "./flatbuffers"; import { assert } from "./util"; import * as dispatch from "./dispatch"; -interface Metrics { +export interface Metrics { opsDispatched: number; opsCompleted: number; bytesSentControl: number; diff --git a/js/mixins/dom_iterable_test.ts b/js/mixins/dom_iterable_test.ts index 3125fd741..863891f51 100644 --- a/js/mixins/dom_iterable_test.ts +++ b/js/mixins/dom_iterable_test.ts @@ -17,10 +17,10 @@ function setup() { return { Base, - DomIterable: Deno.DomIterableMixin<string, number, typeof Base>( - Base, - dataSymbol - ) + // This is using an internal API we don't want published as types, so having + // to cast to any to "trick" TypeScript + // tslint:disable-next-line:no-any + DomIterable: (Deno as any).DomIterableMixin(Base, dataSymbol) }; } @@ -12,6 +12,7 @@ export let pid: number; /** Reflects the NO_COLOR environment variable: https://no-color.org/ */ export let noColor: boolean; +/** @internal */ export function setGlobals(pid_: number, noColor_: boolean): void { assert(!pid); pid = pid_; |