summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/blob.ts8
-rw-r--r--js/body.ts10
-rw-r--r--js/buffer.ts8
-rw-r--r--js/build.ts4
-rw-r--r--js/chmod.ts4
-rw-r--r--js/chown.ts4
-rw-r--r--js/colors.ts2
-rw-r--r--js/compiler.ts40
-rw-r--r--js/console.ts10
-rw-r--r--js/console_table.ts4
-rw-r--r--js/copy_file.ts4
-rw-r--r--js/core.ts2
-rw-r--r--js/custom_event.ts6
-rw-r--r--js/deno.ts90
-rw-r--r--js/diagnostics.ts2
-rw-r--r--js/dir.ts4
-rw-r--r--js/dispatch.ts4
-rw-r--r--js/dispatch_json.ts8
-rw-r--r--js/dispatch_json_test.ts6
-rw-r--r--js/dispatch_minimal.ts4
-rw-r--r--js/dom_file.ts4
-rw-r--r--js/dom_util.ts2
-rw-r--r--js/error_stack.ts6
-rw-r--r--js/error_stack_test.ts11
-rw-r--r--js/event.ts4
-rw-r--r--js/event_target.ts8
-rw-r--r--js/fetch.ts29
-rw-r--r--js/file_info.ts2
-rw-r--r--js/files.ts8
-rw-r--r--js/form_data.ts10
-rw-r--r--js/format_error.ts4
-rw-r--r--js/get_random_values.ts6
-rw-r--r--js/globals.ts45
-rw-r--r--js/headers.ts6
-rw-r--r--js/link.ts4
-rw-r--r--js/location.ts8
-rw-r--r--js/main.ts44
-rw-r--r--js/make_temp_dir.ts4
-rw-r--r--js/metrics.ts4
-rw-r--r--js/mixins/dom_iterable.ts6
-rw-r--r--js/mkdir.ts4
-rw-r--r--js/net.ts10
-rw-r--r--js/os.ts31
-rw-r--r--js/performance.ts4
-rw-r--r--js/permissions.ts4
-rw-r--r--js/plugins.d.ts9
-rw-r--r--js/process.ts14
-rw-r--r--js/read_dir.ts8
-rw-r--r--js/read_file.ts4
-rw-r--r--js/read_link.ts4
-rw-r--r--js/remove.ts4
-rw-r--r--js/rename.ts4
-rw-r--r--js/repl.ts18
-rw-r--r--js/request.ts6
-rw-r--r--js/resources.ts4
-rw-r--r--js/stat.ts6
-rw-r--r--js/symlink.ts8
-rw-r--r--js/text_encoding.ts6
-rw-r--r--js/timers.ts10
-rw-r--r--js/truncate.ts4
-rw-r--r--js/url.ts8
-rw-r--r--js/url_search_params.ts4
-rw-r--r--js/util.ts4
-rw-r--r--js/utime.ts4
-rw-r--r--js/version.ts2
-rw-r--r--js/workers.ts14
-rw-r--r--js/write_file.ts8
-rw-r--r--js/xeval.ts8
68 files changed, 332 insertions, 321 deletions
diff --git a/js/blob.ts b/js/blob.ts
index 94d03c97f..4c86f1f24 100644
--- a/js/blob.ts
+++ b/js/blob.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import { containsOnlyASCII, hasOwnProperty } from "./util";
-import { TextEncoder } from "./text_encoding";
-import { build } from "./build";
+import * as domTypes from "./dom_types.ts";
+import { containsOnlyASCII, hasOwnProperty } from "./util.ts";
+import { TextEncoder } from "./text_encoding.ts";
+import { build } from "./build.ts";
export const bytesSymbol = Symbol("bytes");
diff --git a/js/body.ts b/js/body.ts
index b1f1af8a5..6567b1934 100644
--- a/js/body.ts
+++ b/js/body.ts
@@ -1,8 +1,8 @@
-import * as formData from "./form_data";
-import * as blob from "./blob";
-import * as encoding from "./text_encoding";
-import * as headers from "./headers";
-import * as domTypes from "./dom_types";
+import * as formData from "./form_data.ts";
+import * as blob from "./blob.ts";
+import * as encoding from "./text_encoding.ts";
+import * as headers from "./headers.ts";
+import * as domTypes from "./dom_types.ts";
const { Headers } = headers;
diff --git a/js/buffer.ts b/js/buffer.ts
index 9525e6954..dc73b7e60 100644
--- a/js/buffer.ts
+++ b/js/buffer.ts
@@ -4,10 +4,10 @@
// Copyright 2009 The Go Authors. All rights reserved. BSD license.
// https://github.com/golang/go/blob/master/LICENSE
-import { Reader, Writer, EOF, SyncReader, SyncWriter } from "./io";
-import { assert } from "./util";
-import { TextDecoder } from "./text_encoding";
-import { DenoError, ErrorKind } from "./errors";
+import { Reader, Writer, EOF, SyncReader, SyncWriter } from "./io.ts";
+import { assert } from "./util.ts";
+import { TextDecoder } from "./text_encoding.ts";
+import { DenoError, ErrorKind } from "./errors.ts";
// MIN_READ is the minimum ArrayBuffer size passed to a read call by
// buffer.ReadFrom. As long as the Buffer has at least MIN_READ bytes beyond
diff --git a/js/build.ts b/js/build.ts
index 1b02e7862..157de30bc 100644
--- a/js/build.ts
+++ b/js/build.ts
@@ -18,9 +18,9 @@ export interface BuildInfo {
export const build: BuildInfo = {
// These string will be replaced by rollup
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
- arch: `ROLLUP_REPLACE_ARCH` as any,
+ arch: `DENO_REPLACE_ARCH` as any,
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
- os: `ROLLUP_REPLACE_OS` as any
+ os: `DENO_REPLACE_OS` as any
};
// TODO(kevinkassimo): deprecate Deno.platform
diff --git a/js/chmod.ts b/js/chmod.ts
index 23b3dff25..7bf54cc5b 100644
--- a/js/chmod.ts
+++ b/js/chmod.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Changes the permission of a specific file/directory of specified path
* synchronously.
diff --git a/js/chown.ts b/js/chown.ts
index 6bfddab98..a8bad1193 100644
--- a/js/chown.ts
+++ b/js/chown.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/**
* Change owner of a regular file or directory synchronously. Unix only at the moment.
diff --git a/js/colors.ts b/js/colors.ts
index ab89af81c..47a893036 100644
--- a/js/colors.ts
+++ b/js/colors.ts
@@ -3,7 +3,7 @@
// TODO(kitsonk) Replace with `deno_std/colors/mod.ts` when we can load modules
// which end in `.ts`.
-import { noColor } from "./os";
+import { noColor } from "./deno.ts";
interface Code {
open: string;
diff --git a/js/compiler.ts b/js/compiler.ts
index 71b1b06c9..255ac9774 100644
--- a/js/compiler.ts
+++ b/js/compiler.ts
@@ -1,20 +1,25 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as ts from "typescript";
-import { bold, cyan, yellow } from "./colors";
-import { Console } from "./console";
-import { core } from "./core";
-import { Diagnostic, fromTypeScriptDiagnostic } from "./diagnostics";
-import { cwd } from "./dir";
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
-import * as os from "./os";
-import { TextEncoder } from "./text_encoding";
-import { getMappedModuleName, parseTypeDirectives } from "./type_directives";
-import { assert, notImplemented } from "./util";
-import * as util from "./util";
-import { window } from "./window";
-import { postMessage, workerClose, workerMain } from "./workers";
-import { writeFileSync } from "./write_file";
+// TODO(ry) Combine this implementation with //deno_typescript/compiler_main.js
+
+/// <reference types="../third_party/node_modules/typescript/lib/typescript.d.ts"/>
+
+import "./globals.ts";
+
+import { bold, cyan, yellow } from "./colors.ts";
+import { Console } from "./console.ts";
+import { core } from "./core.ts";
+import { Diagnostic, fromTypeScriptDiagnostic } from "./diagnostics.ts";
+import { cwd } from "./dir.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
+import * as os from "./os.ts";
+import { TextEncoder } from "./text_encoding.ts";
+import { getMappedModuleName, parseTypeDirectives } from "./type_directives.ts";
+import { assert, notImplemented } from "./util.ts";
+import * as util from "./util.ts";
+import { window } from "./window.ts";
+import { postMessage, workerClose, workerMain } from "./workers.ts";
+import { writeFileSync } from "./write_file.ts";
// Warning! The values in this enum are duplicated in cli/msg.rs
// Update carefully!
@@ -31,9 +36,10 @@ enum MediaType {
const console = new Console(core.print);
window.console = console;
window.workerMain = workerMain;
-export default function denoMain(): void {
+function denoMain(): void {
os.start(true, "TS");
}
+window["denoMain"] = denoMain;
const ASSETS = "$asset$";
const OUT_DIR = "$deno$";
diff --git a/js/console.ts b/js/console.ts
index db6a87296..2ce4b20cd 100644
--- a/js/console.ts
+++ b/js/console.ts
@@ -1,9 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { isTypedArray } from "./util";
-import { TypedArray } from "./types";
-import { TextEncoder } from "./text_encoding";
-import { File, stdout } from "./files";
-import { cliTable } from "./console_table";
+import { isTypedArray } from "./util.ts";
+import { TypedArray } from "./types.ts";
+import { TextEncoder } from "./text_encoding.ts";
+import { File, stdout } from "./files.ts";
+import { cliTable } from "./console_table.ts";
type ConsoleContext = Set<unknown>;
type ConsoleOptions = Partial<{
diff --git a/js/console_table.ts b/js/console_table.ts
index d4a404aa1..d74dc0127 100644
--- a/js/console_table.ts
+++ b/js/console_table.ts
@@ -1,8 +1,8 @@
// Copyright Joyent, Inc. and other Node contributors. MIT license.
// Forked from Node's lib/internal/cli_table.js
-import { TextEncoder } from "./text_encoding";
-import { hasOwnProperty } from "./util";
+import { TextEncoder } from "./text_encoding.ts";
+import { hasOwnProperty } from "./util.ts";
const encoder = new TextEncoder();
diff --git a/js/copy_file.ts b/js/copy_file.ts
index b299a52bc..94d2b63db 100644
--- a/js/copy_file.ts
+++ b/js/copy_file.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Copies the contents of a file to another by name synchronously.
* Creates a new file if target does not exists, and if target exists,
diff --git a/js/core.ts b/js/core.ts
index 436ba7ccb..d394d822f 100644
--- a/js/core.ts
+++ b/js/core.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { window } from "./window";
+import { window } from "./window.ts";
// This allows us to access core in API even if we
// dispose window.Deno
diff --git a/js/custom_event.ts b/js/custom_event.ts
index 5f9e413fb..67668bbb7 100644
--- a/js/custom_event.ts
+++ b/js/custom_event.ts
@@ -1,7 +1,7 @@
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import * as event from "./event";
-import { getPrivateValue, requiredArguments } from "./util";
+import * as domTypes from "./dom_types.ts";
+import * as event from "./event.ts";
+import { getPrivateValue, requiredArguments } from "./util.ts";
// WeakMaps are recommended for private attributes (see MDN link below)
// https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Add-on_SDK/Guides/Contributor_s_Guide/Private_Properties#Using_WeakMaps
diff --git a/js/deno.ts b/js/deno.ts
index 65a93c467..efccb7741 100644
--- a/js/deno.ts
+++ b/js/deno.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Public deno module.
-export { noColor, pid, env, exit, isTTY, execPath, homeDir } from "./os";
-export { chdir, cwd } from "./dir";
+export { env, exit, isTTY, execPath, homeDir } from "./os.ts";
+export { chdir, cwd } from "./dir.ts";
export {
File,
open,
@@ -18,7 +18,7 @@ export {
seekSync,
close,
OpenMode
-} from "./files";
+} from "./files.ts";
export {
EOF,
copy,
@@ -37,40 +37,46 @@ export {
WriteSeeker,
ReadWriteCloser,
ReadWriteSeeker
-} from "./io";
-export { Buffer, readAll, readAllSync, writeAll, writeAllSync } from "./buffer";
-export { mkdirSync, mkdir } from "./mkdir";
+} from "./io.ts";
+export {
+ Buffer,
+ readAll,
+ readAllSync,
+ writeAll,
+ writeAllSync
+} from "./buffer.ts";
+export { mkdirSync, mkdir } from "./mkdir.ts";
export {
makeTempDirSync,
makeTempDir,
MakeTempDirOptions
-} from "./make_temp_dir";
-export { chmodSync, chmod } from "./chmod";
-export { chownSync, chown } from "./chown";
-export { utimeSync, utime } from "./utime";
-export { removeSync, remove, RemoveOption } from "./remove";
-export { renameSync, rename } from "./rename";
-export { readFileSync, readFile } from "./read_file";
-export { readDirSync, readDir } from "./read_dir";
-export { copyFileSync, copyFile } from "./copy_file";
-export { readlinkSync, readlink } from "./read_link";
-export { statSync, lstatSync, stat, lstat } from "./stat";
-export { linkSync, link } from "./link";
-export { symlinkSync, symlink } from "./symlink";
-export { writeFileSync, writeFile, WriteFileOptions } from "./write_file";
-export { applySourceMap } from "./error_stack";
-export { ErrorKind, DenoError } from "./errors";
+} from "./make_temp_dir.ts";
+export { chmodSync, chmod } from "./chmod.ts";
+export { chownSync, chown } from "./chown.ts";
+export { utimeSync, utime } from "./utime.ts";
+export { removeSync, remove, RemoveOption } from "./remove.ts";
+export { renameSync, rename } from "./rename.ts";
+export { readFileSync, readFile } from "./read_file.ts";
+export { readDirSync, readDir } from "./read_dir.ts";
+export { copyFileSync, copyFile } from "./copy_file.ts";
+export { readlinkSync, readlink } from "./read_link.ts";
+export { statSync, lstatSync, stat, lstat } from "./stat.ts";
+export { linkSync, link } from "./link.ts";
+export { symlinkSync, symlink } from "./symlink.ts";
+export { writeFileSync, writeFile, WriteFileOptions } from "./write_file.ts";
+export { applySourceMap } from "./error_stack.ts";
+export { ErrorKind, DenoError } from "./errors.ts";
export {
permissions,
revokePermission,
Permission,
Permissions
-} from "./permissions";
-export { truncateSync, truncate } from "./truncate";
-export { FileInfo } from "./file_info";
-export { connect, dial, listen, Listener, Conn } from "./net";
-export { metrics, Metrics } from "./metrics";
-export { resources } from "./resources";
+} from "./permissions.ts";
+export { truncateSync, truncate } from "./truncate.ts";
+export { FileInfo } from "./file_info.ts";
+export { connect, dial, listen, Listener, Conn } from "./net.ts";
+export { metrics, Metrics } from "./metrics.ts";
+export { resources } from "./resources.ts";
export {
kill,
run,
@@ -78,23 +84,35 @@ export {
Process,
ProcessStatus,
Signal
-} from "./process";
-export { inspect, customInspect } from "./console";
-export { build, platform, OperatingSystem, Arch } from "./build";
-export { version } from "./version";
+} from "./process.ts";
+export { inspect, customInspect } from "./console.ts";
+export { build, platform, OperatingSystem, Arch } from "./build.ts";
+export { version } from "./version.ts";
export const args: string[] = [];
// These are internal Deno APIs. We are marking them as internal so they do not
// appear in the runtime type library.
/** @internal */
-export { core } from "./core";
+export { core } from "./core.ts";
/** @internal */
-export { setPrepareStackTrace } from "./error_stack";
+export { setPrepareStackTrace } from "./error_stack.ts";
// TODO Don't expose Console nor stringifyArgs.
/** @internal */
-export { Console, stringifyArgs } from "./console";
+export { Console, stringifyArgs } from "./console.ts";
// TODO Don't expose DomIterableMixin.
/** @internal */
-export { DomIterableMixin } from "./mixins/dom_iterable";
+export { DomIterableMixin } from "./mixins/dom_iterable.ts";
+
+/** The current process id of the runtime. */
+export let pid: number;
+
+/** Reflects the NO_COLOR environment variable: https://no-color.org/ */
+export let noColor: boolean;
+
+// TODO(ry) This should not be exposed to Deno.
+export function _setGlobals(pid_: number, noColor_: boolean): void {
+ pid = pid_;
+ noColor = noColor_;
+}
diff --git a/js/diagnostics.ts b/js/diagnostics.ts
index 1207eca4f..4085d31fe 100644
--- a/js/diagnostics.ts
+++ b/js/diagnostics.ts
@@ -4,7 +4,7 @@
// compiler, which is strongly influenced by the format of TypeScript
// diagnostics.
-import * as ts from "typescript";
+/// <reference types="../third_party/node_modules/typescript/lib/typescript.d.ts"/>
/** The log category for a diagnostic message */
export enum DiagnosticCategory {
diff --git a/js/dir.ts b/js/dir.ts
index f2cf91c21..ef1111555 100644
--- a/js/dir.ts
+++ b/js/dir.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/**
* `cwd()` Return a string representing the current working directory.
diff --git a/js/dispatch.ts b/js/dispatch.ts
index af91a9b9e..1a60a5363 100644
--- a/js/dispatch.ts
+++ b/js/dispatch.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as minimal from "./dispatch_minimal";
-import * as json from "./dispatch_json";
+import * as minimal from "./dispatch_minimal.ts";
+import * as json from "./dispatch_json.ts";
// These consts are shared with Rust. Update with care.
export const OP_READ = 1;
diff --git a/js/dispatch_json.ts b/js/dispatch_json.ts
index 8ec924f4c..572ec855a 100644
--- a/js/dispatch_json.ts
+++ b/js/dispatch_json.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as util from "./util";
-import { TextEncoder, TextDecoder } from "./text_encoding";
-import { core } from "./core";
-import { ErrorKind, DenoError } from "./errors";
+import * as util from "./util.ts";
+import { TextEncoder, TextDecoder } from "./text_encoding.ts";
+import { core } from "./core.ts";
+import { ErrorKind, DenoError } from "./errors.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Ok = any;
diff --git a/js/dispatch_json_test.ts b/js/dispatch_json_test.ts
index 47e5cef2f..11dadc620 100644
--- a/js/dispatch_json_test.ts
+++ b/js/dispatch_json_test.ts
@@ -2,9 +2,9 @@ import { testPerm, assertMatch, unreachable } from "./test_util.ts";
const openErrorStackPattern = new RegExp(
`^.*
- at unwrapResponse \\(js\\/dispatch_json\\.ts:.*\\)
- at sendAsync.* \\(js\\/dispatch_json\\.ts:.*\\)
- at async Object\\.open \\(js\\/files\\.ts:.*\\).*$`,
+ at unwrapResponse \\(.*dispatch_json\\.ts:.*\\)
+ at Object.sendAsync \\(.*dispatch_json\\.ts:.*\\)
+ at async Object\\.open \\(.*files\\.ts:.*\\).*$`,
"ms"
);
diff --git a/js/dispatch_minimal.ts b/js/dispatch_minimal.ts
index 75514368c..98636f85b 100644
--- a/js/dispatch_minimal.ts
+++ b/js/dispatch_minimal.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as util from "./util";
-import { core } from "./core";
+import * as util from "./util.ts";
+import { core } from "./core.ts";
const promiseTableMin = new Map<number, util.Resolvable<number>>();
// Note it's important that promiseId starts at 1 instead of 0, because sync
diff --git a/js/dom_file.ts b/js/dom_file.ts
index 88d8ba4a9..1340da125 100644
--- a/js/dom_file.ts
+++ b/js/dom_file.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import * as blob from "./blob";
+import * as domTypes from "./dom_types.ts";
+import * as blob from "./blob.ts";
// TODO Rename this to DomFileImpl
export class DenoFile extends blob.DenoBlob implements domTypes.DomFile {
diff --git a/js/dom_util.ts b/js/dom_util.ts
index 7a5dc80b9..85a33fad1 100644
--- a/js/dom_util.ts
+++ b/js/dom_util.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Utility functions for DOM nodes
-import * as domTypes from "./dom_types";
+import * as domTypes from "./dom_types.ts";
export function isNode(nodeImpl: domTypes.EventTarget | null): boolean {
return Boolean(nodeImpl && "nodeType" in nodeImpl);
diff --git a/js/error_stack.ts b/js/error_stack.ts
index 7d41b9cf4..98b0b02d4 100644
--- a/js/error_stack.ts
+++ b/js/error_stack.ts
@@ -1,9 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// Some of the code here is adapted directly from V8 and licensed under a BSD
// style license available here: https://github.com/v8/v8/blob/24886f2d1c565287d33d71e4109a53bf0b54b75c/LICENSE.v8
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
-import { assert } from "./util";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
+import { assert } from "./util.ts";
export interface Location {
/** The full url for the module, e.g. `file://some/file.ts` or
diff --git a/js/error_stack_test.ts b/js/error_stack_test.ts
index 0df491f39..4c7edb2fd 100644
--- a/js/error_stack_test.ts
+++ b/js/error_stack_test.ts
@@ -90,22 +90,19 @@ test(function prepareStackTrace(): void {
structuredStackTrace: CallSite[]
) => string = MockError.prepareStackTrace;
const result = prepareStackTrace(new Error("foo"), [
- getMockCallSite("gen/cli/bundle/main.js", 23, 0)
+ getMockCallSite("CLI_SNAPSHOT.js", 23, 0)
]);
assert(result.startsWith("Error: foo\n"));
- assert(
- result.includes("<anonymous> (js/"),
- "should remap to something in 'js/'"
- );
+ assert(result.includes(".ts:"), "should remap to something in 'js/'");
});
test(function applySourceMap(): void {
const result = Deno.applySourceMap({
- filename: "gen/cli/bundle/main.js",
+ filename: "CLI_SNAPSHOT.js",
line: 23,
column: 0
});
- assert(result.filename.startsWith("js/"));
+ assert(result.filename.endsWith(".ts"));
assert(result.line != null);
assert(result.column != null);
});
diff --git a/js/event.ts b/js/event.ts
index 222b562a2..723926054 100644
--- a/js/event.ts
+++ b/js/event.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import { getPrivateValue, requiredArguments } from "./util";
+import * as domTypes from "./dom_types.ts";
+import { getPrivateValue, requiredArguments } from "./util.ts";
// WeakMaps are recommended for private attributes (see MDN link below)
// https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Add-on_SDK/Guides/Contributor_s_Guide/Private_Properties#Using_WeakMaps
diff --git a/js/event_target.ts b/js/event_target.ts
index e376e78a1..96ce8e2a8 100644
--- a/js/event_target.ts
+++ b/js/event_target.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import { DenoError, ErrorKind } from "./errors";
-import { hasOwnProperty, requiredArguments } from "./util";
+import * as domTypes from "./dom_types.ts";
+import { DenoError, ErrorKind } from "./errors.ts";
+import { hasOwnProperty, requiredArguments } from "./util.ts";
import {
getRoot,
isNode,
@@ -9,7 +9,7 @@ import {
isShadowInclusiveAncestor,
isSlotable,
retarget
-} from "./dom_util";
+} from "./dom_util.ts";
// https://dom.spec.whatwg.org/#get-the-parent
// Note: Nodes, shadow roots, and documents override this algorithm so we set it to null.
diff --git a/js/fetch.ts b/js/fetch.ts
index 2e18ece9a..d66eb1c48 100644
--- a/js/fetch.ts
+++ b/js/fetch.ts
@@ -1,16 +1,21 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { assert, createResolvable, notImplemented, isTypedArray } from "./util";
-import * as domTypes from "./dom_types";
-import { TextDecoder, TextEncoder } from "./text_encoding";
-import { DenoBlob, bytesSymbol as blobBytesSymbol } from "./blob";
-import { Headers } from "./headers";
-import * as io from "./io";
-import { read, close } from "./files";
-import { Buffer } from "./buffer";
-import { FormData } from "./form_data";
-import { URLSearchParams } from "./url_search_params";
-import * as dispatch from "./dispatch";
-import { sendAsync } from "./dispatch_json";
+import {
+ assert,
+ createResolvable,
+ notImplemented,
+ isTypedArray
+} from "./util.ts";
+import * as domTypes from "./dom_types.ts";
+import { TextDecoder, TextEncoder } from "./text_encoding.ts";
+import { DenoBlob, bytesSymbol as blobBytesSymbol } from "./blob.ts";
+import { Headers } from "./headers.ts";
+import * as io from "./io.ts";
+import { read, close } from "./files.ts";
+import { Buffer } from "./buffer.ts";
+import { FormData } from "./form_data.ts";
+import { URLSearchParams } from "./url_search_params.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendAsync } from "./dispatch_json.ts";
function getHeaderValueParams(value: string): Map<string, string> {
const params = new Map();
diff --git a/js/file_info.ts b/js/file_info.ts
index c124e06bf..a98989e79 100644
--- a/js/file_info.ts
+++ b/js/file_info.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { StatResponse } from "./stat";
+import { StatResponse } from "./stat.ts";
/** A FileInfo describes a file and is returned by `stat`, `lstat`,
* `statSync`, `lstatSync`.
diff --git a/js/files.ts b/js/files.ts
index 0335056b3..98d18f0cf 100644
--- a/js/files.ts
+++ b/js/files.ts
@@ -9,13 +9,13 @@ import {
SyncReader,
SyncWriter,
SyncSeeker
-} from "./io";
-import { sendAsyncMinimal, sendSyncMinimal } from "./dispatch_minimal";
-import * as dispatch from "./dispatch";
+} from "./io.ts";
+import { sendAsyncMinimal, sendSyncMinimal } from "./dispatch_minimal.ts";
+import * as dispatch from "./dispatch.ts";
import {
sendSync as sendSyncJson,
sendAsync as sendAsyncJson
-} from "./dispatch_json";
+} from "./dispatch_json.ts";
/** Open a file and return an instance of the `File` object
* synchronously.
diff --git a/js/form_data.ts b/js/form_data.ts
index 3c40e64d3..f5ae290eb 100644
--- a/js/form_data.ts
+++ b/js/form_data.ts
@@ -1,9 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import * as blob from "./blob";
-import * as domFile from "./dom_file";
-import { DomIterableMixin } from "./mixins/dom_iterable";
-import { requiredArguments } from "./util";
+import * as domTypes from "./dom_types.ts";
+import * as blob from "./blob.ts";
+import * as domFile from "./dom_file.ts";
+import { DomIterableMixin } from "./mixins/dom_iterable.ts";
+import { requiredArguments } from "./util.ts";
const dataSymbol = Symbol("data");
diff --git a/js/format_error.ts b/js/format_error.ts
index dde0f6a58..801da0d0b 100644
--- a/js/format_error.ts
+++ b/js/format_error.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
// TODO(bartlomieju): move to `repl.ts`?
export function formatError(errString: string): string {
diff --git a/js/get_random_values.ts b/js/get_random_values.ts
index 154e77f75..e54f34785 100644
--- a/js/get_random_values.ts
+++ b/js/get_random_values.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
-import { assert } from "./util";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
+import { assert } from "./util.ts";
/** Synchronously collects cryptographically secure random values. The
* underlying CSPRNG in use is Rust's `rand::rngs::ThreadRng`.
diff --git a/js/globals.ts b/js/globals.ts
index ed7621165..6de8a5d89 100644
--- a/js/globals.ts
+++ b/js/globals.ts
@@ -7,31 +7,31 @@
// Modules which will make up part of the global public API surface should be
// imported as namespaces, so when the runtime type library is generated they
// can be expressed as a namespace in the type library.
-import { window } from "./window";
-import * as blob from "./blob";
-import * as consoleTypes from "./console";
-import * as csprng from "./get_random_values";
-import * as customEvent from "./custom_event";
-import * as Deno from "./deno";
-import * as domTypes from "./dom_types";
-import * as domFile from "./dom_file";
-import * as event from "./event";
-import * as eventTarget from "./event_target";
-import * as formData from "./form_data";
-import * as fetchTypes from "./fetch";
-import * as headers from "./headers";
-import * as textEncoding from "./text_encoding";
-import * as timers from "./timers";
-import * as url from "./url";
-import * as urlSearchParams from "./url_search_params";
-import * as workers from "./workers";
-import * as performanceUtil from "./performance";
-
-import * as request from "./request";
+import { window } from "./window.ts";
+import * as blob from "./blob.ts";
+import * as consoleTypes from "./console.ts";
+import * as csprng from "./get_random_values.ts";
+import * as customEvent from "./custom_event.ts";
+import * as Deno from "./deno.ts";
+import * as domTypes from "./dom_types.ts";
+import * as domFile from "./dom_file.ts";
+import * as event from "./event.ts";
+import * as eventTarget from "./event_target.ts";
+import * as formData from "./form_data.ts";
+import * as fetchTypes from "./fetch.ts";
+import * as headers from "./headers.ts";
+import * as textEncoding from "./text_encoding.ts";
+import * as timers from "./timers.ts";
+import * as url from "./url.ts";
+import * as urlSearchParams from "./url_search_params.ts";
+import * as workers from "./workers.ts";
+import * as performanceUtil from "./performance.ts";
+
+import * as request from "./request.ts";
// These imports are not exposed and therefore are fine to just import the
// symbols required.
-import { core } from "./core";
+import { core } from "./core.ts";
// During the build process, augmentations to the variable `window` in this
// file are tracked and created as part of default library that is built into
@@ -72,7 +72,6 @@ window.window = window;
// properties when building the runtime type library, as the whole module
// is flattened into a single namespace.
window.Deno = Deno;
-Object.freeze(window.Deno);
// Globally available functions and object instances.
window.atob = textEncoding.atob;
diff --git a/js/headers.ts b/js/headers.ts
index e31c0903e..dc0de54dd 100644
--- a/js/headers.ts
+++ b/js/headers.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as domTypes from "./dom_types";
-import { DomIterableMixin } from "./mixins/dom_iterable";
-import { requiredArguments } from "./util";
+import * as domTypes from "./dom_types.ts";
+import { DomIterableMixin } from "./mixins/dom_iterable.ts";
+import { requiredArguments } from "./util.ts";
// From node-fetch
// Copyright (c) 2016 David Frank. MIT License.
diff --git a/js/link.ts b/js/link.ts
index f6c6530b2..a6f732926 100644
--- a/js/link.ts
+++ b/js/link.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Synchronously creates `newname` as a hard link to `oldname`.
*
diff --git a/js/location.ts b/js/location.ts
index 535a2bcea..d495f99ca 100644
--- a/js/location.ts
+++ b/js/location.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { URL } from "./url";
-import { notImplemented } from "./util";
-import { Location } from "./dom_types";
-import { window } from "./window";
+import { URL } from "./url.ts";
+import { notImplemented } from "./util.ts";
+import { Location } from "./dom_types.ts";
+import { window } from "./window.ts";
export class LocationImpl implements Location {
constructor(url: string) {
diff --git a/js/main.ts b/js/main.ts
index 25e27b69f..31a7647df 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -1,36 +1,29 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-// eslint-disable-next-line @typescript-eslint/no-triple-slash-reference
-/// <reference path="./plugins.d.ts" />
-
-import "./globals";
-
-import { assert, log } from "./util";
-import * as os from "./os";
-import { args } from "./deno";
-import { setPrepareStackTrace } from "./error_stack";
-import { replLoop } from "./repl";
-import { xevalMain, XevalFunc } from "./xeval";
-import { setVersions } from "./version";
-import { window } from "./window";
-import { setLocation } from "./location";
-
-// builtin modules
-import * as deno from "./deno";
-
-export default function denoMain(
- preserveDenoNamespace: boolean = true,
- name?: string
-): void {
+import "./globals.ts";
+
+import { assert, log } from "./util.ts";
+import * as os from "./os.ts";
+import { args } from "./deno.ts";
+import { setPrepareStackTrace } from "./error_stack.ts";
+import { replLoop } from "./repl.ts";
+import { xevalMain, XevalFunc } from "./xeval.ts";
+import { setVersions } from "./version.ts";
+import { window } from "./window.ts";
+import { setLocation } from "./location.ts";
+import * as Deno from "./deno.ts";
+
+function denoMain(preserveDenoNamespace: boolean = true, name?: string): void {
const s = os.start(preserveDenoNamespace, name);
setVersions(s.denoVersion, s.v8Version);
// handle `--version`
if (s.versionFlag) {
- console.log("deno:", deno.version.deno);
- console.log("v8:", deno.version.v8);
- console.log("typescript:", deno.version.typescript);
+ const { console } = window;
+ console.log("deno:", Deno.version.deno);
+ console.log("v8:", Deno.version.v8);
+ console.log("typescript:", Deno.version.typescript);
os.exit(0);
}
@@ -55,3 +48,4 @@ export default function denoMain(
replLoop();
}
}
+window["denoMain"] = denoMain;
diff --git a/js/make_temp_dir.ts b/js/make_temp_dir.ts
index 5e0a28205..14494b5da 100644
--- a/js/make_temp_dir.ts
+++ b/js/make_temp_dir.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
export interface MakeTempDirOptions {
dir?: string;
diff --git a/js/metrics.ts b/js/metrics.ts
index 48e3102e5..b32c29789 100644
--- a/js/metrics.ts
+++ b/js/metrics.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
export interface Metrics {
opsDispatched: number;
diff --git a/js/mixins/dom_iterable.ts b/js/mixins/dom_iterable.ts
index 97e8133ec..bbd1905ce 100644
--- a/js/mixins/dom_iterable.ts
+++ b/js/mixins/dom_iterable.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-import { DomIterable } from "../dom_types";
-import { window } from "../window";
-import { requiredArguments } from "../util";
+import { DomIterable } from "../dom_types.ts";
+import { window } from "../window.ts";
+import { requiredArguments } from "../util.ts";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Constructor<T = {}> = new (...args: any[]) => T;
diff --git a/js/mkdir.ts b/js/mkdir.ts
index 54f99224b..bc09ba358 100644
--- a/js/mkdir.ts
+++ b/js/mkdir.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Creates a new directory with the specified path synchronously.
* If `recursive` is set to true, nested directories will be created (also known
diff --git a/js/net.ts b/js/net.ts
index 809dd4092..b0651b326 100644
--- a/js/net.ts
+++ b/js/net.ts
@@ -1,9 +1,9 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { EOF, Reader, Writer, Closer } from "./io";
-import { notImplemented } from "./util";
-import { read, write, close } from "./files";
-import * as dispatch from "./dispatch";
-import { sendSync, sendAsync } from "./dispatch_json";
+import { EOF, Reader, Writer, Closer } from "./io.ts";
+import { notImplemented } from "./util.ts";
+import { read, write, close } from "./files.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
export type Network = "tcp";
// TODO support other types:
diff --git a/js/os.ts b/js/os.ts
index c44c27825..dbfbf3c88 100644
--- a/js/os.ts
+++ b/js/os.ts
@@ -1,22 +1,13 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { core } from "./core";
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
-import { assert } from "./util";
-import * as util from "./util";
-import { window } from "./window";
+import { core } from "./core.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
+import { assert } from "./util.ts";
+import * as util from "./util.ts";
+import { window } from "./window.ts";
-/** The current process id of the runtime. */
-export let pid: number;
-
-/** Reflects the NO_COLOR environment variable: https://no-color.org/ */
-export let noColor: boolean;
-
-function setGlobals(pid_: number, noColor_: boolean): void {
- assert(!pid);
- pid = pid_;
- noColor = noColor_;
-}
+// builtin modules
+import { _setGlobals } from "./deno.ts";
/** Check if running in terminal.
*
@@ -85,7 +76,11 @@ export function start(preserveDenoNamespace = true, source?: string): Start {
util.setLogDebug(s.debugFlag, source);
- setGlobals(s.pid, s.noColor);
+ // pid and noColor need to be set in the Deno module before it's set to be
+ // frozen.
+ _setGlobals(s.pid, s.noColor);
+ delete window.Deno._setGlobals;
+ Object.freeze(window.Deno);
if (preserveDenoNamespace) {
util.immutableDefine(window, "Deno", window.Deno);
diff --git a/js/performance.ts b/js/performance.ts
index d2f339c46..6ea8e56e1 100644
--- a/js/performance.ts
+++ b/js/performance.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
interface NowResponse {
seconds: number;
diff --git a/js/permissions.ts b/js/permissions.ts
index bc969f3a8..4f393501c 100644
--- a/js/permissions.ts
+++ b/js/permissions.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
/** Permissions as granted by the caller */
export interface Permissions {
diff --git a/js/plugins.d.ts b/js/plugins.d.ts
deleted file mode 100644
index 842a897de..000000000
--- a/js/plugins.d.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-
-// This allows TypeScript to resolve any modules that end with `!string`
-// as there is a rollup plugin that will take any mids ending with `!string`
-// and return them as a string to rollup for inlining
-declare module "*!string" {
- const value: string;
- export default value;
-}
diff --git a/js/process.ts b/js/process.ts
index dd4f70103..4de9fe774 100644
--- a/js/process.ts
+++ b/js/process.ts
@@ -1,11 +1,11 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
-import { File, close } from "./files";
-import { ReadCloser, WriteCloser } from "./io";
-import { readAll } from "./buffer";
-import { assert, unreachable } from "./util";
-import { platform } from "./build";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
+import { File, close } from "./files.ts";
+import { ReadCloser, WriteCloser } from "./io.ts";
+import { readAll } from "./buffer.ts";
+import { assert, unreachable } from "./util.ts";
+import { platform } from "./build.ts";
/** How to handle subprocess stdio.
*
diff --git a/js/read_dir.ts b/js/read_dir.ts
index 27d011a08..2fa6a566b 100644
--- a/js/read_dir.ts
+++ b/js/read_dir.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
-import { FileInfo, FileInfoImpl } from "./file_info";
-import { StatResponse } from "./stat";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
+import { FileInfo, FileInfoImpl } from "./file_info.ts";
+import { StatResponse } from "./stat.ts";
interface ReadDirResponse {
entries: StatResponse[];
diff --git a/js/read_file.ts b/js/read_file.ts
index 1ca52e276..de6630cc0 100644
--- a/js/read_file.ts
+++ b/js/read_file.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { open, openSync } from "./files";
-import { readAll, readAllSync } from "./buffer";
+import { open, openSync } from "./files.ts";
+import { readAll, readAllSync } from "./buffer.ts";
/** Read the entire contents of a file synchronously.
*
diff --git a/js/read_link.ts b/js/read_link.ts
index fae1e64b6..861fbff0b 100644
--- a/js/read_link.ts
+++ b/js/read_link.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Returns the destination of the named symbolic link synchronously.
*
diff --git a/js/remove.ts b/js/remove.ts
index f2a94f395..36413a7c4 100644
--- a/js/remove.ts
+++ b/js/remove.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
export interface RemoveOption {
recursive?: boolean;
diff --git a/js/rename.ts b/js/rename.ts
index 80794747d..c906ce37b 100644
--- a/js/rename.ts
+++ b/js/rename.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
/** Synchronously renames (moves) `oldpath` to `newpath`. If `newpath` already
* exists and is not a directory, `renameSync()` replaces it. OS-specific
diff --git a/js/repl.ts b/js/repl.ts
index 08a4fb210..966e809e8 100644
--- a/js/repl.ts
+++ b/js/repl.ts
@@ -1,12 +1,14 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { close } from "./files";
-import { exit } from "./os";
-import { window } from "./window";
-import { core } from "./core";
-import { formatError } from "./format_error";
-import { stringifyArgs } from "./console";
-import * as dispatch from "./dispatch";
-import { sendSync, sendAsync } from "./dispatch_json";
+import { close } from "./files.ts";
+import { exit } from "./os.ts";
+import { window } from "./window.ts";
+import { core } from "./core.ts";
+import { formatError } from "./format_error.ts";
+import { stringifyArgs } from "./console.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+
+const { console } = window;
/**
* REPL logging.
diff --git a/js/request.ts b/js/request.ts
index 5ed1e9d63..f7a3cdfc1 100644
--- a/js/request.ts
+++ b/js/request.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as headers from "./headers";
-import * as body from "./body";
-import * as domTypes from "./dom_types";
+import * as headers from "./headers.ts";
+import * as body from "./body.ts";
+import * as domTypes from "./dom_types.ts";
const { Headers } = headers;
diff --git a/js/resources.ts b/js/resources.ts
index 6e2ec202b..27598ce09 100644
--- a/js/resources.ts
+++ b/js/resources.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as dispatch from "./dispatch";
-import { sendSync } from "./dispatch_json";
+import * as dispatch from "./dispatch.ts";
+import { sendSync } from "./dispatch_json.ts";
export interface ResourceMap {
[rid: number]: string;
diff --git a/js/stat.ts b/js/stat.ts
index 1cc8d070a..1f53e6f7b 100644
--- a/js/stat.ts
+++ b/js/stat.ts
@@ -1,7 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
-import { FileInfo, FileInfoImpl } from "./file_info";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
+import { FileInfo, FileInfoImpl } from "./file_info.ts";
export interface StatResponse {
isFile: boolean;
diff --git a/js/symlink.ts b/js/symlink.ts
index 6fd2e90a5..4418e22ce 100644
--- a/js/symlink.ts
+++ b/js/symlink.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
-import * as util from "./util";
-import { platform } from "./build";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
+import * as util from "./util.ts";
+import { platform } from "./build.ts";
/** Synchronously creates `newname` as a symbolic link to `oldname`. The type
* argument can be set to `dir` or `file` and is only available on Windows
diff --git a/js/text_encoding.ts b/js/text_encoding.ts
index 830b4278e..5aed7ac07 100644
--- a/js/text_encoding.ts
+++ b/js/text_encoding.ts
@@ -23,9 +23,9 @@
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
-import * as base64 from "./base64";
-import * as domTypes from "./dom_types";
-import { DenoError, ErrorKind } from "./errors";
+import * as base64 from "./base64.ts";
+import * as domTypes from "./dom_types.ts";
+import { DenoError, ErrorKind } from "./errors.ts";
const CONTINUE = null;
const END_OF_STREAM = -1;
diff --git a/js/timers.ts b/js/timers.ts
index 4b8596cb7..8aec33d92 100644
--- a/js/timers.ts
+++ b/js/timers.ts
@@ -1,8 +1,10 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { assert } from "./util";
-import { window } from "./window";
-import * as dispatch from "./dispatch";
-import { sendSync, sendAsync } from "./dispatch_json";
+import { assert } from "./util.ts";
+import { window } from "./window.ts";
+import * as dispatch from "./dispatch.ts";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+
+const { console } = window;
interface Timer {
id: number;
diff --git a/js/truncate.ts b/js/truncate.ts
index c6e5b3ad0..5ce7b5158 100644
--- a/js/truncate.ts
+++ b/js/truncate.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import * as dispatch from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import * as dispatch from "./dispatch.ts";
function coerceLen(len?: number): number {
if (!len) {
diff --git a/js/url.ts b/js/url.ts
index 6520af834..334d1c09b 100644
--- a/js/url.ts
+++ b/js/url.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import * as urlSearchParams from "./url_search_params";
-import * as domTypes from "./dom_types";
-import { getRandomValues } from "./get_random_values";
-import { window } from "./window";
+import * as urlSearchParams from "./url_search_params.ts";
+import * as domTypes from "./dom_types.ts";
+import { getRandomValues } from "./get_random_values.ts";
+import { window } from "./window.ts";
interface URLParts {
protocol: string;
diff --git a/js/url_search_params.ts b/js/url_search_params.ts
index 8e122191d..63c02d3b8 100644
--- a/js/url_search_params.ts
+++ b/js/url_search_params.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { URL } from "./url";
-import { requiredArguments, isIterable } from "./util";
+import { URL } from "./url.ts";
+import { requiredArguments, isIterable } from "./util.ts";
export class URLSearchParams {
private params: Array<[string, string]> = [];
diff --git a/js/util.ts b/js/util.ts
index da56465a2..86a856170 100644
--- a/js/util.ts
+++ b/js/util.ts
@@ -1,5 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { TypedArray } from "./types";
+import { TypedArray } from "./types.ts";
+import { window } from "./window.ts";
+const { console } = window;
let logDebug = false;
let logSource = "JS";
diff --git a/js/utime.ts b/js/utime.ts
index c71710458..7495378b1 100644
--- a/js/utime.ts
+++ b/js/utime.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { sendSync, sendAsync } from "./dispatch_json";
-import { OP_UTIME } from "./dispatch";
+import { sendSync, sendAsync } from "./dispatch_json.ts";
+import { OP_UTIME } from "./dispatch.ts";
function toSecondsFromEpoch(v: number | Date): number {
return v instanceof Date ? v.valueOf() / 1000 : v;
diff --git a/js/version.ts b/js/version.ts
index 471072d81..3ceade24e 100644
--- a/js/version.ts
+++ b/js/version.ts
@@ -9,7 +9,7 @@ export const version: Version = {
deno: "",
v8: "",
// This string will be replaced by rollup
- typescript: `ROLLUP_REPLACE_TS_VERSION`
+ typescript: `DENO_REPLACE_TS_VERSION`
};
/**
diff --git a/js/workers.ts b/js/workers.ts
index 7bcbe6279..36c2aa50b 100644
--- a/js/workers.ts
+++ b/js/workers.ts
@@ -1,12 +1,12 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
/* eslint-disable @typescript-eslint/no-explicit-any */
-import * as dispatch from "./dispatch";
-import { sendAsync, sendSync } from "./dispatch_json";
-import { log } from "./util";
-import { TextDecoder, TextEncoder } from "./text_encoding";
-import { window } from "./window";
-import { blobURLMap } from "./url";
-import { blobBytesWeakMap } from "./blob";
+import * as dispatch from "./dispatch.ts";
+import { sendAsync, sendSync } from "./dispatch_json.ts";
+import { log } from "./util.ts";
+import { TextDecoder, TextEncoder } from "./text_encoding.ts";
+import { window } from "./window.ts";
+import { blobURLMap } from "./url.ts";
+import { blobBytesWeakMap } from "./blob.ts";
const encoder = new TextEncoder();
const decoder = new TextDecoder();
diff --git a/js/write_file.ts b/js/write_file.ts
index c7b71725c..d6307e002 100644
--- a/js/write_file.ts
+++ b/js/write_file.ts
@@ -1,8 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { stat, statSync } from "./stat";
-import { open, openSync } from "./files";
-import { chmod, chmodSync } from "./chmod";
-import { writeAll, writeAllSync } from "./buffer";
+import { stat, statSync } from "./stat.ts";
+import { open, openSync } from "./files.ts";
+import { chmod, chmodSync } from "./chmod.ts";
+import { writeAll, writeAllSync } from "./buffer.ts";
/** Options for writing to a file.
* `perm` would change the file's permission if set.
diff --git a/js/xeval.ts b/js/xeval.ts
index fa706ae20..2ef90ce29 100644
--- a/js/xeval.ts
+++ b/js/xeval.ts
@@ -1,7 +1,7 @@
-import { Buffer, writeAll } from "./buffer";
-import { stdin } from "./files";
-import { TextEncoder, TextDecoder } from "./text_encoding";
-import { Reader, EOF } from "./io";
+import { Buffer, writeAll } from "./buffer.ts";
+import { stdin } from "./files.ts";
+import { TextEncoder, TextDecoder } from "./text_encoding.ts";
+import { Reader, EOF } from "./io.ts";
export type XevalFunc = (v: string) => void;