1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00

Change import { x } from "deno" to const { x } = Deno (#218)

This commit is contained in:
Bert Belder 2019-02-25 21:35:50 -08:00 committed by Ryan Dahl
parent d441a7dbf0
commit 6063378a92
32 changed files with 43 additions and 55 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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";

View file

@ -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 {

View file

@ -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 */

View file

@ -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));

View file

@ -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));

View file

@ -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";

View file

@ -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 */

View file

@ -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,

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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,

View file

@ -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";

View file

@ -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

View file

@ -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() {

View file

@ -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");

View file

@ -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";

View file

@ -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,

View file

@ -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";

View file

@ -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";

View file

@ -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();

View file

@ -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) {

View file

@ -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";

View file

@ -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 {