summaryrefslogtreecommitdiff
path: root/cli/js
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js')
-rw-r--r--cli/js/deno.ts5
-rw-r--r--cli/js/internals.ts4
-rw-r--r--cli/js/lib.deno.ns.d.ts20
-rw-r--r--cli/js/runtime_main.ts5
-rw-r--r--cli/js/runtime_worker.ts5
-rw-r--r--cli/js/symbols.ts8
-rw-r--r--cli/js/tests/console_test.ts4
-rw-r--r--cli/js/tests/dom_iterable_test.ts2
-rw-r--r--cli/js/tests/error_stack_test.ts2
-rw-r--r--cli/js/tests/headers_test.ts2
-rw-r--r--cli/js/tests/internals_test.ts2
-rw-r--r--cli/js/tests/symbols_test.ts7
-rwxr-xr-xcli/js/tests/unit_test_runner.ts4
-rw-r--r--cli/js/tests/unit_tests.ts1
-rw-r--r--cli/js/web/streams/readable_byte_stream_controller.ts4
-rw-r--r--cli/js/web/streams/readable_stream.ts4
-rw-r--r--cli/js/web/streams/readable_stream_default_controller.ts4
-rw-r--r--cli/js/web/streams/readable_stream_default_reader.ts4
18 files changed, 30 insertions, 57 deletions
diff --git a/cli/js/deno.ts b/cli/js/deno.ts
index caf98ac70..355000ac5 100644
--- a/cli/js/deno.ts
+++ b/cli/js/deno.ts
@@ -12,7 +12,7 @@ export { build, OperatingSystem, Arch } from "./build.ts";
export { chmodSync, chmod } from "./ops/fs/chmod.ts";
export { chownSync, chown } from "./ops/fs/chown.ts";
export { transpileOnly, compile, bundle } from "./compiler/api.ts";
-export { inspect } from "./web/console.ts";
+export { customInspect, inspect } from "./web/console.ts";
export { copyFileSync, copyFile } from "./ops/fs/copy_file.ts";
export {
Diagnostic,
@@ -38,6 +38,7 @@ export {
} from "./files.ts";
export { read, readSync, write, writeSync } from "./ops/io.ts";
export { FsEvent, watchFs } from "./ops/fs_events.ts";
+export { internalSymbol as internal } from "./internals.ts";
export {
EOF,
copy,
@@ -123,5 +124,3 @@ export { core } from "./core.ts";
export let pid: number;
export let noColor: boolean;
-
-export { symbols } from "./symbols.ts";
diff --git a/cli/js/internals.ts b/cli/js/internals.ts
index a675c5d7f..dd02a5fa9 100644
--- a/cli/js/internals.ts
+++ b/cli/js/internals.ts
@@ -1,12 +1,12 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-export const internalSymbol = Symbol("Deno.symbols.internal");
+export const internalSymbol = Symbol("Deno.internal");
// The object where all the internal fields for testing will be living.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const internalObject: { [key: string]: any } = {};
// Register a field to internalObject for test access,
-// through Deno[Deno.symbols.internal][name].
+// through Deno[Deno.internal][name].
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function exposeForTest(name: string, value: any): void {
Object.defineProperty(internalObject, name, {
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts
index d2106b4f8..835f2a95c 100644
--- a/cli/js/lib.deno.ns.d.ts
+++ b/cli/js/lib.deno.ns.d.ts
@@ -379,7 +379,7 @@ declare namespace Deno {
*/
export function umask(mask?: number): number;
- /** **UNSTABLE**: might move to `Deno.symbols`. */
+ /** **UNSTABLE**: might be removed in favor of `null` (#3932). */
export const EOF: unique symbol;
export type EOF = typeof EOF;
@@ -2338,7 +2338,7 @@ declare namespace Deno {
* class A {
* x = 10;
* y = "hello";
- * [Deno.symbols.customInspect](): string {
+ * [Deno.customInspect](): string {
* return "x=" + this.x + ", y=" + this.y;
* }
* }
@@ -2860,16 +2860,8 @@ declare namespace Deno {
windowChange: () => SignalStream;
};
- /** **UNSTABLE**: new API. Maybe move `Deno.EOF` here.
- *
- * Special Deno related symbols. */
- export const symbols: {
- /** Symbol to access exposed internal Deno API */
- readonly internal: unique symbol;
- /** A symbol which can be used as a key for a custom method which will be
- * called when `Deno.inspect()` is called, or when the object is logged to
- * the console. */
- readonly customInspect: unique symbol;
- // TODO(ry) move EOF here?
- };
+ /** A symbol which can be used as a key for a custom method which will be
+ * called when `Deno.inspect()` is called, or when the object is logged to
+ * the console. */
+ export const customInspect: unique symbol;
}
diff --git a/cli/js/runtime_main.ts b/cli/js/runtime_main.ts
index 4c6df892c..6c6617be0 100644
--- a/cli/js/runtime_main.ts
+++ b/cli/js/runtime_main.ts
@@ -19,20 +19,19 @@ import {
eventTargetProperties,
setEventTargetData,
} from "./globals.ts";
-import { internalObject } from "./internals.ts";
+import { internalObject, internalSymbol } from "./internals.ts";
import { setSignals } from "./signals.ts";
import { replLoop } from "./repl.ts";
import { LocationImpl } from "./web/location.ts";
import { setTimeout } from "./web/timers.ts";
import * as runtime from "./runtime.ts";
-import { symbols } from "./symbols.ts";
import { log, immutableDefine } from "./util.ts";
// TODO: factor out `Deno` global assignment to separate function
// Add internal object to Deno object.
// This is not exposed as part of the Deno types.
// @ts-ignore
-Deno[symbols.internal] = internalObject;
+Deno[internalSymbol] = internalObject;
let windowIsClosing = false;
diff --git a/cli/js/runtime_worker.ts b/cli/js/runtime_worker.ts
index 6be8ff586..0e6e84da8 100644
--- a/cli/js/runtime_worker.ts
+++ b/cli/js/runtime_worker.ts
@@ -24,8 +24,7 @@ import { log, assert, immutableDefine } from "./util.ts";
import { MessageEvent, ErrorEvent } from "./web/workers.ts";
import { TextEncoder } from "./web/text_encoding.ts";
import * as runtime from "./runtime.ts";
-import { internalObject } from "./internals.ts";
-import { symbols } from "./symbols.ts";
+import { internalObject, internalSymbol } from "./internals.ts";
import { setSignals } from "./signals.ts";
// FIXME(bartlomieju): duplicated in `runtime_main.ts`
@@ -33,7 +32,7 @@ import { setSignals } from "./signals.ts";
// Add internal object to Deno object.
// This is not exposed as part of the Deno types.
// @ts-ignore
-Deno[symbols.internal] = internalObject;
+Deno[internalSymbol] = internalObject;
const encoder = new TextEncoder();
diff --git a/cli/js/symbols.ts b/cli/js/symbols.ts
deleted file mode 100644
index 59d0751c0..000000000
--- a/cli/js/symbols.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { internalSymbol } from "./internals.ts";
-import { customInspect } from "./web/console.ts";
-
-export const symbols = {
- internal: internalSymbol,
- customInspect,
-};
diff --git a/cli/js/tests/console_test.ts b/cli/js/tests/console_test.ts
index 4a227aafe..264987ba9 100644
--- a/cli/js/tests/console_test.ts
+++ b/cli/js/tests/console_test.ts
@@ -8,12 +8,12 @@ const {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} = Deno as any;
-const customInspect = Deno.symbols.customInspect;
+const customInspect = Deno.customInspect;
const {
Console,
stringifyArgs,
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
-} = Deno[Deno.symbols.internal];
+} = Deno[Deno.internal];
function stringify(...args: unknown[]): string {
return stringifyArgs(args).replace(/\n$/, "");
diff --git a/cli/js/tests/dom_iterable_test.ts b/cli/js/tests/dom_iterable_test.ts
index 827a788a9..b9435b3bc 100644
--- a/cli/js/tests/dom_iterable_test.ts
+++ b/cli/js/tests/dom_iterable_test.ts
@@ -21,7 +21,7 @@ function setup() {
// This is using an internal API we don't want published as types, so having
// to cast to any to "trick" TypeScript
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
- DomIterable: Deno[Deno.symbols.internal].DomIterableMixin(Base, dataSymbol),
+ DomIterable: Deno[Deno.internal].DomIterableMixin(Base, dataSymbol),
};
}
diff --git a/cli/js/tests/error_stack_test.ts b/cli/js/tests/error_stack_test.ts
index 83a2020ac..e5cedfcf5 100644
--- a/cli/js/tests/error_stack_test.ts
+++ b/cli/js/tests/error_stack_test.ts
@@ -2,7 +2,7 @@
import { unitTest, assert } from "./test_util.ts";
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
-const { setPrepareStackTrace } = Deno[Deno.symbols.internal];
+const { setPrepareStackTrace } = Deno[Deno.internal];
interface CallSite {
getThis(): unknown;
diff --git a/cli/js/tests/headers_test.ts b/cli/js/tests/headers_test.ts
index dbc54dc9f..0711a7736 100644
--- a/cli/js/tests/headers_test.ts
+++ b/cli/js/tests/headers_test.ts
@@ -8,7 +8,7 @@ import {
const {
stringifyArgs,
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
-} = Deno[Deno.symbols.internal];
+} = Deno[Deno.internal];
// Logic heavily copied from web-platform-tests, make
// sure pass mostly header basic test
diff --git a/cli/js/tests/internals_test.ts b/cli/js/tests/internals_test.ts
index b794bb5e8..abd4c94c3 100644
--- a/cli/js/tests/internals_test.ts
+++ b/cli/js/tests/internals_test.ts
@@ -5,6 +5,6 @@ unitTest(function internalsExists(): void {
const {
stringifyArgs,
// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol
- } = Deno[Deno.symbols.internal];
+ } = Deno[Deno.internal];
assert(!!stringifyArgs);
});
diff --git a/cli/js/tests/symbols_test.ts b/cli/js/tests/symbols_test.ts
deleted file mode 100644
index ad05e9a70..000000000
--- a/cli/js/tests/symbols_test.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { unitTest, assert } from "./test_util.ts";
-
-unitTest(function symbolsExists(): void {
- assert("internal" in Deno.symbols);
- assert("customInspect" in Deno.symbols);
-});
diff --git a/cli/js/tests/unit_test_runner.ts b/cli/js/tests/unit_test_runner.ts
index 7a246cd39..12d9101b8 100755
--- a/cli/js/tests/unit_test_runner.ts
+++ b/cli/js/tests/unit_test_runner.ts
@@ -11,8 +11,8 @@ import {
reportToConn,
} from "./test_util.ts";
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-const internalObj = (Deno as any)[Deno.symbols.internal];
+// @ts-ignore
+const internalObj = Deno[Deno.internal];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reportToConsole = internalObj.reportToConsole as (message: any) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/cli/js/tests/unit_tests.ts b/cli/js/tests/unit_tests.ts
index 74929c934..627832ca9 100644
--- a/cli/js/tests/unit_tests.ts
+++ b/cli/js/tests/unit_tests.ts
@@ -52,7 +52,6 @@ import "./request_test.ts";
import "./resources_test.ts";
import "./signal_test.ts";
import "./stat_test.ts";
-import "./symbols_test.ts";
import "./symlink_test.ts";
import "./text_encoding_test.ts";
import "./testing_test.ts";
diff --git a/cli/js/web/streams/readable_byte_stream_controller.ts b/cli/js/web/streams/readable_byte_stream_controller.ts
index 615eff968..80ba9ad85 100644
--- a/cli/js/web/streams/readable_byte_stream_controller.ts
+++ b/cli/js/web/streams/readable_byte_stream_controller.ts
@@ -22,7 +22,7 @@ import {
import { ReadableStreamImpl } from "./readable_stream.ts";
import * as sym from "./symbols.ts";
import { assert } from "../../util.ts";
-import { symbols } from "../../symbols.ts";
+import { customInspect } from "../../web/console.ts";
export class ReadableByteStreamControllerImpl
implements ReadableByteStreamController {
@@ -135,7 +135,7 @@ export class ReadableByteStreamControllerImpl
return promise;
}
- [symbols.customInspect](): string {
+ [customInspect](): string {
return `ReadableByteStreamController { byobRequest: ${String(
this.byobRequest
)}, desiredSize: ${String(this.desiredSize)} }`;
diff --git a/cli/js/web/streams/readable_stream.ts b/cli/js/web/streams/readable_stream.ts
index f606319b1..e234c909d 100644
--- a/cli/js/web/streams/readable_stream.ts
+++ b/cli/js/web/streams/readable_stream.ts
@@ -18,8 +18,8 @@ import { ReadableByteStreamControllerImpl } from "./readable_byte_stream_control
import { ReadableStreamAsyncIteratorPrototype } from "./readable_stream_async_iterator.ts";
import { ReadableStreamDefaultControllerImpl } from "./readable_stream_default_controller.ts";
import * as sym from "./symbols.ts";
-import { symbols } from "../../symbols.ts";
import { notImplemented } from "../../util.ts";
+import { customInspect } from "../../web/console.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
@@ -202,7 +202,7 @@ export class ReadableStreamImpl<R = any> implements ReadableStream<R> {
return readableStreamTee(this, false);
}
- [symbols.customInspect](): string {
+ [customInspect](): string {
return `ReadableStream { locked: ${String(this.locked)} }`;
}
diff --git a/cli/js/web/streams/readable_stream_default_controller.ts b/cli/js/web/streams/readable_stream_default_controller.ts
index 866c6d79e..bbdfa1f0d 100644
--- a/cli/js/web/streams/readable_stream_default_controller.ts
+++ b/cli/js/web/streams/readable_stream_default_controller.ts
@@ -21,7 +21,7 @@ import {
} from "./internals.ts";
import { ReadableStreamImpl } from "./readable_stream.ts";
import * as sym from "./symbols.ts";
-import { symbols } from "../../symbols.ts";
+import { customInspect } from "../../web/console.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class ReadableStreamDefaultControllerImpl<R = any>
@@ -112,7 +112,7 @@ export class ReadableStreamDefaultControllerImpl<R = any>
return pendingPromise;
}
- [symbols.customInspect](): string {
+ [customInspect](): string {
return `ReadableStreamDefaultController { desiredSize: ${String(
this.desiredSize
)} }`;
diff --git a/cli/js/web/streams/readable_stream_default_reader.ts b/cli/js/web/streams/readable_stream_default_reader.ts
index 9bdce3e9c..20fb21208 100644
--- a/cli/js/web/streams/readable_stream_default_reader.ts
+++ b/cli/js/web/streams/readable_stream_default_reader.ts
@@ -12,7 +12,7 @@ import {
} from "./internals.ts";
import { ReadableStreamImpl } from "./readable_stream.ts";
import * as sym from "./symbols.ts";
-import { symbols } from "../../symbols.ts";
+import { customInspect } from "../../web/console.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export class ReadableStreamDefaultReaderImpl<R = any>
@@ -83,7 +83,7 @@ export class ReadableStreamDefaultReaderImpl<R = any>
readableStreamReaderGenericRelease(this);
}
- [symbols.customInspect](): string {
+ [customInspect](): string {
return `ReadableStreamDefaultReader { closed: Promise }`;
}
}