diff --git a/_readers_test.ts b/_readers_test.ts index 0ce1661..d3fbff9 100644 --- a/_readers_test.ts +++ b/_readers_test.ts @@ -2,7 +2,7 @@ import { streamReader } from "./_readers.ts"; import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { group } from "./_test_util.ts"; -import { decode, encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { decode, encode } from "./_util.ts"; group("streamReader", ({ test }) => { test("basic", async () => { diff --git a/_test_util.ts b/_test_util.ts index 7d972ea..b71aee7 100644 --- a/_test_util.ts +++ b/_test_util.ts @@ -6,7 +6,7 @@ import { } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { RoutingError } from "./error.ts"; import { createRecorder } from "./testing.ts"; -import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { encode } from "./_util.ts"; import { green, red } from "./vendor/https/deno.land/std/fmt/colors.ts"; import { STATUS_TEXT } from "./vendor/https/deno.land/std/http/http_status.ts"; diff --git a/_util.ts b/_util.ts index f18d019..01e5675 100644 --- a/_util.ts +++ b/_util.ts @@ -72,3 +72,14 @@ export function promiseInterrupter({ } }); } + +const decoder = new TextDecoder(); +const encoder = new TextEncoder(); + +export function decode(bin?: BufferSource): string { + return decoder.decode(bin); +} + +export function encode(s?: string): Uint8Array { + return encoder.encode(s); +} diff --git a/agent_test.ts b/agent_test.ts index 3bdc72a..f7e9ebb 100644 --- a/agent_test.ts +++ b/agent_test.ts @@ -1,5 +1,5 @@ // Copyright 2019-2020 Yusuke Sakurai. All rights reserved. MIT license. -import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { encode } from "./_util.ts"; import { createAgent } from "./agent.ts"; import { createApp } from "./app.ts"; import { diff --git a/body_parser.ts b/body_parser.ts index 040fe55..5e8571a 100644 --- a/body_parser.ts +++ b/body_parser.ts @@ -3,9 +3,9 @@ import { MultipartFormData, MultipartReader, } from "./vendor/https/deno.land/std/mime/multipart.ts"; -import Reader = Deno.Reader; -import { decode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { decode } from "./_util.ts"; +import Reader = Deno.Reader; export interface BodyParser { text(): Promise; json(): Promise; diff --git a/modules-lock.json b/modules-lock.json index 1724431..af0d9ee 100644 --- a/modules-lock.json +++ b/modules-lock.json @@ -1,6 +1,6 @@ { "https://deno.land/std": { - "version": "@0.87.0", + "version": "@0.90.0", "modules": [ "/testing/asserts.ts", "/textproto/mod.ts", @@ -13,7 +13,6 @@ "/io/writers.ts", "/http/_io.ts", "/http/http_status.ts", - "/encoding/utf8.ts", "/flags/mod.ts", "/fmt/printf.ts", "/fmt/colors.ts", diff --git a/modules.json b/modules.json index 1724431..af0d9ee 100755 --- a/modules.json +++ b/modules.json @@ -1,6 +1,6 @@ { "https://deno.land/std": { - "version": "@0.87.0", + "version": "@0.90.0", "modules": [ "/testing/asserts.ts", "/textproto/mod.ts", @@ -13,7 +13,6 @@ "/io/writers.ts", "/http/_io.ts", "/http/http_status.ts", - "/encoding/utf8.ts", "/flags/mod.ts", "/fmt/printf.ts", "/fmt/colors.ts", diff --git a/serveio.ts b/serveio.ts index c1cf247..e0b0916 100644 --- a/serveio.ts +++ b/serveio.ts @@ -2,7 +2,7 @@ import { BufReader, BufWriter } from "./vendor/https/deno.land/std/io/bufio.ts"; import { TextProtoReader } from "./vendor/https/deno.land/std/textproto/mod.ts"; import { closableBodyReader, streamReader, timeoutReader } from "./_readers.ts"; -import { promiseInterrupter } from "./_util.ts"; +import { encode, promiseInterrupter } from "./_util.ts"; import { assert, AssertionError, @@ -17,7 +17,6 @@ import { ServeOptions, ServerResponse, } from "./server.ts"; -import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; import Reader = Deno.Reader; import Writer = Deno.Writer; import Buffer = Deno.Buffer; diff --git a/serveio_test.ts b/serveio_test.ts index c502dd5..81835c8 100644 --- a/serveio_test.ts +++ b/serveio_test.ts @@ -10,7 +10,7 @@ import { } from "./serveio.ts"; import { assertEquals } from "./vendor/https/deno.land/std/testing/asserts.ts"; import { StringReader } from "./vendor/https/deno.land/std/io/readers.ts"; -import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { encode } from "./_util.ts"; import Buffer = Deno.Buffer; import copy = Deno.copy; import { ServerResponse } from "./server.ts"; diff --git a/server_test.ts b/server_test.ts index a22d52c..20b2345 100644 --- a/server_test.ts +++ b/server_test.ts @@ -8,7 +8,7 @@ import { assertEquals, assertThrowsAsync, } from "./vendor/https/deno.land/std/testing/asserts.ts"; -import { encode } from "./vendor/https/deno.land/std/encoding/utf8.ts"; +import { encode } from "./_util.ts"; import { createAgent } from "./agent.ts"; import { readResponse, writeRequest } from "./serveio.ts"; import { BufReader } from "./vendor/https/deno.land/std/io/bufio.ts"; diff --git a/vendor/https/deno.land/std/async/mod.ts b/vendor/https/deno.land/std/async/mod.ts index 5c64b6b..4139e95 100644 --- a/vendor/https/deno.land/std/async/mod.ts +++ b/vendor/https/deno.land/std/async/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/async/mod.ts"; +export * from "https://deno.land/std@0.90.0/async/mod.ts"; diff --git a/vendor/https/deno.land/std/datetime/mod.ts b/vendor/https/deno.land/std/datetime/mod.ts index d47de34..b6c8c53 100644 --- a/vendor/https/deno.land/std/datetime/mod.ts +++ b/vendor/https/deno.land/std/datetime/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/datetime/mod.ts"; +export * from "https://deno.land/std@0.90.0/datetime/mod.ts"; diff --git a/vendor/https/deno.land/std/encoding/utf8.ts b/vendor/https/deno.land/std/encoding/utf8.ts deleted file mode 100644 index 9c7ba58..0000000 --- a/vendor/https/deno.land/std/encoding/utf8.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "https://deno.land/std@0.87.0/encoding/utf8.ts"; diff --git a/vendor/https/deno.land/std/flags/mod.ts b/vendor/https/deno.land/std/flags/mod.ts index da6aed9..06f2747 100644 --- a/vendor/https/deno.land/std/flags/mod.ts +++ b/vendor/https/deno.land/std/flags/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/flags/mod.ts"; +export * from "https://deno.land/std@0.90.0/flags/mod.ts"; diff --git a/vendor/https/deno.land/std/fmt/colors.ts b/vendor/https/deno.land/std/fmt/colors.ts index 7a5b786..8d8549c 100644 --- a/vendor/https/deno.land/std/fmt/colors.ts +++ b/vendor/https/deno.land/std/fmt/colors.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/fmt/colors.ts"; +export * from "https://deno.land/std@0.90.0/fmt/colors.ts"; diff --git a/vendor/https/deno.land/std/fmt/printf.ts b/vendor/https/deno.land/std/fmt/printf.ts index 804a2e5..26da49d 100644 --- a/vendor/https/deno.land/std/fmt/printf.ts +++ b/vendor/https/deno.land/std/fmt/printf.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/fmt/printf.ts"; +export * from "https://deno.land/std@0.90.0/fmt/printf.ts"; diff --git a/vendor/https/deno.land/std/fs/exists.ts b/vendor/https/deno.land/std/fs/exists.ts index 606358b..655d564 100644 --- a/vendor/https/deno.land/std/fs/exists.ts +++ b/vendor/https/deno.land/std/fs/exists.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/fs/exists.ts"; +export * from "https://deno.land/std@0.90.0/fs/exists.ts"; diff --git a/vendor/https/deno.land/std/fs/expand_glob.ts b/vendor/https/deno.land/std/fs/expand_glob.ts index 2c6d6aa..c725165 100644 --- a/vendor/https/deno.land/std/fs/expand_glob.ts +++ b/vendor/https/deno.land/std/fs/expand_glob.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/fs/expand_glob.ts"; +export * from "https://deno.land/std@0.90.0/fs/expand_glob.ts"; diff --git a/vendor/https/deno.land/std/hash/sha1.ts b/vendor/https/deno.land/std/hash/sha1.ts index 0131a9f..88cc3b7 100644 --- a/vendor/https/deno.land/std/hash/sha1.ts +++ b/vendor/https/deno.land/std/hash/sha1.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/hash/sha1.ts"; +export * from "https://deno.land/std@0.90.0/hash/sha1.ts"; diff --git a/vendor/https/deno.land/std/http/_io.ts b/vendor/https/deno.land/std/http/_io.ts index a23f6f7..2e4bfeb 100644 --- a/vendor/https/deno.land/std/http/_io.ts +++ b/vendor/https/deno.land/std/http/_io.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/http/_io.ts"; +export * from "https://deno.land/std@0.90.0/http/_io.ts"; diff --git a/vendor/https/deno.land/std/http/http_status.ts b/vendor/https/deno.land/std/http/http_status.ts index d7ea8ff..1ecf3ae 100644 --- a/vendor/https/deno.land/std/http/http_status.ts +++ b/vendor/https/deno.land/std/http/http_status.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/http/http_status.ts"; +export * from "https://deno.land/std@0.90.0/http/http_status.ts"; diff --git a/vendor/https/deno.land/std/io/bufio.ts b/vendor/https/deno.land/std/io/bufio.ts index 558140d..2c9ebec 100644 --- a/vendor/https/deno.land/std/io/bufio.ts +++ b/vendor/https/deno.land/std/io/bufio.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/io/bufio.ts"; +export * from "https://deno.land/std@0.90.0/io/bufio.ts"; diff --git a/vendor/https/deno.land/std/io/readers.ts b/vendor/https/deno.land/std/io/readers.ts index 5a6d27a..8b5f9ff 100644 --- a/vendor/https/deno.land/std/io/readers.ts +++ b/vendor/https/deno.land/std/io/readers.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/io/readers.ts"; +export * from "https://deno.land/std@0.90.0/io/readers.ts"; diff --git a/vendor/https/deno.land/std/io/writers.ts b/vendor/https/deno.land/std/io/writers.ts index a8f6d2a..4eff887 100644 --- a/vendor/https/deno.land/std/io/writers.ts +++ b/vendor/https/deno.land/std/io/writers.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/io/writers.ts"; +export * from "https://deno.land/std@0.90.0/io/writers.ts"; diff --git a/vendor/https/deno.land/std/mime/multipart.ts b/vendor/https/deno.land/std/mime/multipart.ts index 6dffead..ffd2285 100644 --- a/vendor/https/deno.land/std/mime/multipart.ts +++ b/vendor/https/deno.land/std/mime/multipart.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/mime/multipart.ts"; +export * from "https://deno.land/std@0.90.0/mime/multipart.ts"; diff --git a/vendor/https/deno.land/std/path/mod.ts b/vendor/https/deno.land/std/path/mod.ts index cbb932e..7b49d38 100644 --- a/vendor/https/deno.land/std/path/mod.ts +++ b/vendor/https/deno.land/std/path/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/path/mod.ts"; +export * from "https://deno.land/std@0.90.0/path/mod.ts"; diff --git a/vendor/https/deno.land/std/testing/asserts.ts b/vendor/https/deno.land/std/testing/asserts.ts index 952cd66..540e4c4 100644 --- a/vendor/https/deno.land/std/testing/asserts.ts +++ b/vendor/https/deno.land/std/testing/asserts.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/testing/asserts.ts"; +export * from "https://deno.land/std@0.90.0/testing/asserts.ts"; diff --git a/vendor/https/deno.land/std/textproto/mod.ts b/vendor/https/deno.land/std/textproto/mod.ts index a795459..6084ce9 100644 --- a/vendor/https/deno.land/std/textproto/mod.ts +++ b/vendor/https/deno.land/std/textproto/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/textproto/mod.ts"; +export * from "https://deno.land/std@0.90.0/textproto/mod.ts"; diff --git a/vendor/https/deno.land/std/ws/mod.ts b/vendor/https/deno.land/std/ws/mod.ts index 251e0f9..fbae447 100644 --- a/vendor/https/deno.land/std/ws/mod.ts +++ b/vendor/https/deno.land/std/ws/mod.ts @@ -1 +1 @@ -export * from "https://deno.land/std@0.87.0/ws/mod.ts"; +export * from "https://deno.land/std@0.90.0/ws/mod.ts";