From f90f62fa52eccd020026b6899de1b3c7ae0288b6 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Fri, 8 Mar 2019 09:25:16 +0900 Subject: Use Deno global var instead of built-in "deno" module (denoland/deno_std#247) Original: https://github.com/denoland/deno_std/commit/395392912d69fe320d74c1f95a27be8e4adc0fa6 --- http/file_server.ts | 5 ++--- http/http_bench.ts | 3 +-- http/server.ts | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'http') diff --git a/http/file_server.ts b/http/file_server.ts index 20ad45be6..19a94c6aa 100755 --- a/http/file_server.ts +++ b/http/file_server.ts @@ -7,7 +7,6 @@ // 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, @@ -181,8 +180,8 @@ async function serveFile(req: ServerRequest, filename: string) { async function serveFallback(req: ServerRequest, e: Error) { if ( - e instanceof DenoError && - (e as DenoError).kind === ErrorKind.NotFound + e instanceof Deno.DenoError && + (e as Deno.DenoError).kind === ErrorKind.NotFound ) { return { status: 404, diff --git a/http/http_bench.ts b/http/http_bench.ts index c7c2bdf2d..fa7d40bbc 100644 --- a/http/http_bench.ts +++ b/http/http_bench.ts @@ -1,8 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import * as deno from "deno"; import { serve } from "./server.ts"; -const addr = deno.args[1] || "127.0.0.1:4500"; +const addr = Deno.args[1] || "127.0.0.1:4500"; const server = serve(addr); const body = new TextEncoder().encode("Hello World"); diff --git a/http/server.ts b/http/server.ts index d39173045..f3b92ee90 100644 --- a/http/server.ts +++ b/http/server.ts @@ -1,6 +1,8 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. const { listen, toAsyncIterator, copy } = Deno; -import { Conn, Reader, Writer } from "deno"; +type Conn = Deno.Conn; +type Reader = Deno.Reader; +type Writer = Deno.Writer; import { BufReader, BufState, BufWriter } from "../io/bufio.ts"; import { TextProtoReader } from "../textproto/mod.ts"; import { STATUS_TEXT } from "./http_status.ts"; -- cgit v1.2.3