Skip to content

Commit

Permalink
Change import { x } from "deno" to const { x } = Deno (denoland#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus authored and ry committed Feb 26, 2019
1 parent d441a7d commit 6063378
Show file tree
Hide file tree
Showing 32 changed files with 43 additions and 55 deletions.
2 changes: 1 addition & 1 deletion 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;
Expand Down
2 changes: 1 addition & 1 deletion 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;
Expand Down
2 changes: 1 addition & 1 deletion 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";
Expand Down
2 changes: 1 addition & 1 deletion 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 {
Expand Down
2 changes: 1 addition & 1 deletion 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 */
Expand Down
2 changes: 1 addition & 1 deletion flags/README.md
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion 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));
2 changes: 1 addition & 1 deletion 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";

Expand Down
2 changes: 1 addition & 1 deletion 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 */
Expand Down
2 changes: 1 addition & 1 deletion 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,
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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();

Expand Down
13 changes: 2 additions & 11 deletions 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;
Expand Down
7 changes: 3 additions & 4 deletions 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";

Expand Down
3 changes: 2 additions & 1 deletion http/file_server.ts
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion 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";
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
2 changes: 1 addition & 1 deletion http/server_test.ts
Expand Up @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion io/bufio_test.ts
Expand Up @@ -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";
Expand Down
3 changes: 2 additions & 1 deletion 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,
Expand Down
2 changes: 1 addition & 1 deletion 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";

Expand Down
3 changes: 2 additions & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion 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() {
Expand Down
2 changes: 1 addition & 1 deletion 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");
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
4 changes: 2 additions & 2 deletions 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,
Expand Down
2 changes: 1 addition & 1 deletion multipart/multipart_test.ts
@@ -1,13 +1,13 @@
// 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,
MultipartReader,
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";
Expand Down
11 changes: 1 addition & 10 deletions prettier/main.ts
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion 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();

Expand Down
2 changes: 1 addition & 1 deletion 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) {
Expand Down
3 changes: 2 additions & 1 deletion 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";
Expand Down
2 changes: 1 addition & 1 deletion 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 {
Expand Down

0 comments on commit 6063378

Please sign in to comment.