diff --git a/benching/mod.ts b/benching/mod.ts index be77b52c22..61df5c06be 100644 --- a/benching/mod.ts +++ b/benching/mod.ts @@ -1,6 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { exit, noColor } from "deno"; +const { exit, noColor } = Deno; interface BenchmarkClock { start: number; diff --git a/colors/mod.ts b/colors/mod.ts index c8bb5b539d..7a45905ce0 100644 --- a/colors/mod.ts +++ b/colors/mod.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { noColor } from "deno"; +const { noColor } = Deno; interface Code { open: string; diff --git a/examples/echo_server.ts b/examples/echo_server.ts index 5776e77ef4..95b9f74131 100644 --- a/examples/echo_server.ts +++ b/examples/echo_server.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { listen, copy } from "deno"; +const { listen, copy } = Deno; (async () => { const addr = "0.0.0.0:8080"; diff --git a/examples/gist.ts b/examples/gist.ts index 860678d88d..8ce68a946e 100755 --- a/examples/gist.ts +++ b/examples/gist.ts @@ -1,7 +1,7 @@ #!/usr/bin/env deno --allow-net --allow-env // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { args, env, exit, readFile } from "deno"; +const { args, env, exit, readFile } = Deno; import { parse } from "https://deno.land/x/flags/mod.ts"; function pathBase(p: string): string { diff --git a/examples/test.ts b/examples/test.ts index 65ff7efa12..30fdcfc4a8 100644 --- a/examples/test.ts +++ b/examples/test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { run } from "deno"; +const { run } = Deno; import { test, assertEqual } from "../testing/mod.ts"; /** Example of how to do basic tests */ diff --git a/flags/README.md b/flags/README.md index 7b63006d6d..b002bf56a3 100644 --- a/flags/README.md +++ b/flags/README.md @@ -5,7 +5,7 @@ Command line arguments parser for Deno based on minimist # Example ```ts -import { args } from "deno"; +const { args } = Deno; import { parse } from "https://deno.land/x/flags/mod.ts"; console.dir(parse(args)); diff --git a/flags/example.ts b/flags/example.ts index 54d64b6817..04ace46731 100644 --- a/flags/example.ts +++ b/flags/example.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { args } from "deno"; +const { args } = Deno; import { parse } from "./mod.ts"; console.dir(parse(args)); diff --git a/format.ts b/format.ts index 4de5cfa877..fa538d53fd 100755 --- a/format.ts +++ b/format.ts @@ -1,6 +1,6 @@ #!/usr/bin/env deno --allow-run --allow-write --allow-read // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { exit, args } from "deno"; +const { exit, args } = Deno; import { parse } from "./flags/mod.ts"; import { xrun, executableSuffix } from "./prettier/util.ts"; diff --git a/fs/path/constants.ts b/fs/path/constants.ts index ce121f9ace..cfba4ebd85 100644 --- a/fs/path/constants.ts +++ b/fs/path/constants.ts @@ -1,7 +1,7 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { platform } from "deno"; +const { platform } = Deno; // Alphabet chars. export const CHAR_UPPERCASE_A = 65; /* A */ diff --git a/fs/path/mod.ts b/fs/path/mod.ts index 7adb230d27..4ca630ed6d 100644 --- a/fs/path/mod.ts +++ b/fs/path/mod.ts @@ -1,7 +1,7 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { cwd, env } from "deno"; +const { cwd, env } = Deno; import { FormatInputPathObject, ParsedPath } from "./interface.ts"; import { isWindows, diff --git a/fs/path/resolve_test.ts b/fs/path/resolve_test.ts index 7c2b55249a..2259dd0257 100644 --- a/fs/path/resolve_test.ts +++ b/fs/path/resolve_test.ts @@ -1,9 +1,9 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ +const { cwd } = Deno; import { test, assertEqual } from "../../testing/mod.ts"; import * as path from "./mod.ts"; -import { cwd } from "deno"; const windowsTests = // arguments result diff --git a/fs/path/zero_length_strings_test.ts b/fs/path/zero_length_strings_test.ts index d069c781f1..c769c9a79a 100644 --- a/fs/path/zero_length_strings_test.ts +++ b/fs/path/zero_length_strings_test.ts @@ -1,9 +1,9 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ +const { cwd } = Deno; import { test, assertEqual } from "../../testing/mod.ts"; import * as path from "./mod.ts"; -import { cwd } from "deno"; const pwd = cwd(); diff --git a/fs/walk.ts b/fs/walk.ts index 92e4ba593f..10393ae0be 100644 --- a/fs/walk.ts +++ b/fs/walk.ts @@ -1,14 +1,5 @@ -import { - FileInfo, - cwd, - readDir, - readDirSync, - readlink, - readlinkSync, - stat, - statSync -} from "deno"; -import { relative } from "path.ts"; +const { readDir, readDirSync, readlink, readlinkSync, stat, statSync } = Deno; +import { FileInfo } from "deno"; export interface WalkOptions { maxDepth?: number; diff --git a/fs/walk_test.ts b/fs/walk_test.ts index 7f21a2fb40..d542739950 100644 --- a/fs/walk_test.ts +++ b/fs/walk_test.ts @@ -1,15 +1,14 @@ -import { +const { cwd, chdir, - FileInfo, makeTempDir, mkdir, open, platform, remove, symlink -} from "deno"; - +} = Deno; +import { FileInfo } from "deno"; import { walk, walkSync, WalkOptions } from "./walk.ts"; import { test, assert, TestFunction } from "../testing/mod.ts"; diff --git a/http/file_server.ts b/http/file_server.ts index 1f3fdd5861..20ad45be64 100755 --- a/http/file_server.ts +++ b/http/file_server.ts @@ -6,13 +6,14 @@ // TODO Add tests like these: // https://github.com/indexzero/http-server/blob/master/test/http-server-test.js +const { ErrorKind, cwd, args, stat, readDir, open } = Deno; +import { DenoError } from "deno"; import { listenAndServe, ServerRequest, setContentLength, Response } from "./server.ts"; -import { cwd, DenoError, ErrorKind, args, stat, readDir, open } from "deno"; import { extname } from "../fs/path.ts"; import { contentType } from "../media_types/mod.ts"; diff --git a/http/file_server_test.ts b/http/file_server_test.ts index 698857dce3..cf4b8dcbd1 100644 --- a/http/file_server_test.ts +++ b/http/file_server_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { readFile, run } from "deno"; +const { readFile, run } = Deno; import { test, assert, assertEqual } from "../testing/mod.ts"; import { BufReader } from "../io/bufio.ts"; diff --git a/http/server.ts b/http/server.ts index 400171fc5b..c6cd95f86e 100644 --- a/http/server.ts +++ b/http/server.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { listen, Conn, toAsyncIterator, Reader, Writer, copy } from "deno"; +const { listen, toAsyncIterator, copy } = Deno; +import { Conn, Reader, Writer } from "deno"; import { BufReader, BufState, BufWriter } from "../io/bufio.ts"; import { TextProtoReader } from "../textproto/mod.ts"; import { STATUS_TEXT } from "./http_status.ts"; diff --git a/http/server_test.ts b/http/server_test.ts index 099547d0c7..cc5863eb56 100644 --- a/http/server_test.ts +++ b/http/server_test.ts @@ -5,7 +5,7 @@ // Ported from // https://github.com/golang/go/blob/master/src/net/http/responsewrite_test.go -import { Buffer } from "deno"; +const { Buffer } = Deno; import { assertEqual, test } from "../testing/mod.ts"; import { Response, ServerRequest } from "./server.ts"; import { BufReader, BufWriter } from "../io/bufio.ts"; diff --git a/io/bufio_test.ts b/io/bufio_test.ts index e63f1c5c97..0a261daea7 100644 --- a/io/bufio_test.ts +++ b/io/bufio_test.ts @@ -3,7 +3,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -import { Buffer, Reader, ReadResult } from "deno"; +const { Buffer } = Deno; +import { Reader, ReadResult } from "deno"; import { test, assert, assertEqual } from "../testing/mod.ts"; import { BufReader, BufState, BufWriter } from "./bufio.ts"; import * as iotest from "./iotest.ts"; diff --git a/io/ioutil_test.ts b/io/ioutil_test.ts index 2c78b25620..168aad52a0 100644 --- a/io/ioutil_test.ts +++ b/io/ioutil_test.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { Buffer, Reader, ReadResult } from "deno"; +const { Buffer } = Deno; +import { Reader, ReadResult } from "deno"; import { assert, assertEqual, runTests, test } from "../testing/mod.ts"; import { copyN, diff --git a/io/readers_test.ts b/io/readers_test.ts index 0bc8ca36a0..8da9d6e73c 100644 --- a/io/readers_test.ts +++ b/io/readers_test.ts @@ -1,7 +1,7 @@ +const { copy } = Deno; import { assert, test } from "../testing/mod.ts"; import { MultiReader, StringReader } from "./readers.ts"; import { StringWriter } from "./writers.ts"; -import { copy } from "deno"; import { copyN } from "./ioutil.ts"; import { decode } from "../strings/strings.ts"; diff --git a/io/util.ts b/io/util.ts index 954808c6cd..d87776ee5a 100644 --- a/io/util.ts +++ b/io/util.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { Buffer, File, mkdir, open, Reader } from "deno"; +const { Buffer, mkdir, open } = Deno; +import { File, Reader } from "deno"; import { encode } from "../strings/strings.ts"; import * as path from "../fs/path.ts"; // `off` is the offset into `dst` where it will at which to begin writing values diff --git a/io/util_test.ts b/io/util_test.ts index c3f134616f..62cdfe533b 100644 --- a/io/util_test.ts +++ b/io/util_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const { remove } = Deno; import { test, assert } from "../testing/mod.ts"; import { copyBytes, tempFile } from "./util.ts"; -import { remove } from "deno"; import * as path from "../fs/path.ts"; test(function testCopyBytes() { diff --git a/io/writers_test.ts b/io/writers_test.ts index 01388497cd..94c58417df 100644 --- a/io/writers_test.ts +++ b/io/writers_test.ts @@ -1,8 +1,8 @@ +const { copy } = Deno; import { assert, test } from "../testing/mod.ts"; import { StringWriter } from "./writers.ts"; import { StringReader } from "./readers.ts"; import { copyN } from "./ioutil.ts"; -import { copy } from "deno"; test(async function ioStringWriter() { const w = new StringWriter("base"); diff --git a/log/handlers.ts b/log/handlers.ts index 5c65c4fd09..96d8c056fd 100644 --- a/log/handlers.ts +++ b/log/handlers.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { open, File, Writer } from "deno"; +const { open } = Deno; +import { File, Writer } from "deno"; import { getLevelByName, LogLevel } from "./levels.ts"; import { LogRecord } from "./logger.ts"; import { red, yellow, blue, bold } from "../colors/mod.ts"; diff --git a/multipart/multipart.ts b/multipart/multipart.ts index f0caa2160e..70874ed85b 100644 --- a/multipart/multipart.ts +++ b/multipart/multipart.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { Buffer, Closer, copy, Reader, ReadResult, remove, Writer } from "deno"; - +const { Buffer, copy, remove } = Deno; +import { Closer, Reader, ReadResult, Writer } from "deno"; import { FormFile } from "./formfile.ts"; import { bytesFindIndex, diff --git a/multipart/multipart_test.ts b/multipart/multipart_test.ts index 3181e45c1b..a87db60d70 100644 --- a/multipart/multipart_test.ts +++ b/multipart/multipart_test.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +const { Buffer, copy, open, remove } = Deno; import { assert, test } from "../testing/mod.ts"; import { matchAfterPrefix, @@ -7,7 +8,6 @@ import { MultipartWriter, scanUntilBoundary } from "./multipart.ts"; -import { Buffer, copy, open, remove } from "deno"; import * as path from "../fs/path.ts"; import { FormFile, isFormFile } from "./formfile.ts"; import { StringWriter } from "../io/writers.ts"; diff --git a/prettier/main.ts b/prettier/main.ts index 435206dcd2..70c2250868 100755 --- a/prettier/main.ts +++ b/prettier/main.ts @@ -2,16 +2,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. // This script formats the given source files. If the files are omitted, it // formats the all files in the repository. -import { - args, - platform, - readAll, - lstat, - exit, - run, - readFile, - writeFile -} from "deno"; +const { args, platform, readAll, lstat, exit, run, readFile, writeFile } = Deno; import { xrun } from "./util.ts"; import { parse } from "../flags/mod.ts"; import { prettier, prettierPlugins } from "./prettier.ts"; diff --git a/prettier/main_test.ts b/prettier/main_test.ts index d770d72320..165081e002 100644 --- a/prettier/main_test.ts +++ b/prettier/main_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { test, assertEqual } from "../testing/mod.ts"; import { xrun, executableSuffix } from "./util.ts"; -import { readAll } from "deno"; +const { readAll } = Deno; const decoder = new TextDecoder(); diff --git a/prettier/util.ts b/prettier/util.ts index 179be444b6..0be583f757 100644 --- a/prettier/util.ts +++ b/prettier/util.ts @@ -1,5 +1,5 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { platform, run } from "deno"; +const { platform, run } = Deno; // Runs a command in cross-platform way export function xrun(opts) { diff --git a/ws/mod.ts b/ws/mod.ts index 6433a75d14..bb943c7142 100644 --- a/ws/mod.ts +++ b/ws/mod.ts @@ -1,5 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { Buffer, Writer, Conn } from "deno"; +const { Buffer } = Deno; +import { Writer, Conn } from "deno"; import { BufReader, BufWriter } from "../io/bufio.ts"; import { readLong, readShort, sliceLongToBytes } from "../io/ioutil.ts"; import { Sha1 } from "./sha1.ts"; diff --git a/ws/test.ts b/ws/test.ts index 684c43002b..46ea1cb83c 100644 --- a/ws/test.ts +++ b/ws/test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import "./sha1_test.ts"; -import { Buffer } from "deno"; +const { Buffer } = Deno; import { BufReader } from "../io/bufio.ts"; import { assert, assertEqual, test } from "../testing/mod.ts"; import {