diff options
author | Andy Hayden <andyhayden1@gmail.com> | 2019-01-12 13:50:04 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-01-12 16:50:04 -0500 |
commit | f626b04ebe320a96a220af29595c6ca84cf9a10a (patch) | |
tree | ea059a796fed0650060398a8d347ae001d6f621c | |
parent | 7d6a0f64f20004f89f5e2cbfcf7941f0a8dafd21 (diff) |
Reorgnanize repos, examples and tests (denoland/deno_std#105)
Original: https://github.com/denoland/deno_std/commit/c5e6e015b5be19027f60c19ca86283d12f9258f3
-rwxr-xr-x | examples/gist.ts | 2 | ||||
-rw-r--r-- | examples/ws.ts | 4 | ||||
-rw-r--r-- | flags/example.ts | 2 | ||||
-rw-r--r-- | flags/mod.ts (renamed from flags/index.ts) | 0 | ||||
-rwxr-xr-x | flags/tests/all_bool.ts | 2 | ||||
-rwxr-xr-x | flags/tests/bool.ts | 2 | ||||
-rwxr-xr-x | flags/tests/dash.ts | 2 | ||||
-rwxr-xr-x | flags/tests/default_bool.ts | 2 | ||||
-rwxr-xr-x | flags/tests/dotted.ts | 2 | ||||
-rwxr-xr-x | flags/tests/kv_short.ts | 2 | ||||
-rwxr-xr-x | flags/tests/long.ts | 2 | ||||
-rwxr-xr-x | flags/tests/num.ts | 2 | ||||
-rw-r--r-- | flags/tests/parse.ts | 2 | ||||
-rwxr-xr-x | flags/tests/short.ts | 2 | ||||
-rwxr-xr-x | flags/tests/stop_early.ts | 2 | ||||
-rwxr-xr-x | flags/tests/unknown.ts | 2 | ||||
-rwxr-xr-x | flags/tests/whitespace.ts | 2 | ||||
-rw-r--r-- | http/README.md (renamed from net/README.md) | 4 | ||||
-rwxr-xr-x | http/file_server.ts (renamed from net/file_server.ts) | 2 | ||||
-rw-r--r-- | http/file_server_test.ts (renamed from net/file_server_test.ts) | 0 | ||||
-rw-r--r-- | http/http.ts (renamed from net/http.ts) | 6 | ||||
-rw-r--r-- | http/http_bench.ts (renamed from net/http_bench.ts) | 2 | ||||
-rw-r--r-- | http/http_status.ts (renamed from net/http_status.ts) | 0 | ||||
-rw-r--r-- | http/http_test.ts (renamed from net/http_test.ts) | 4 | ||||
-rw-r--r-- | http/mod.ts | 8 | ||||
-rw-r--r-- | io/bufio.ts (renamed from net/bufio.ts) | 0 | ||||
-rw-r--r-- | io/bufio_test.ts (renamed from net/bufio_test.ts) | 0 | ||||
-rw-r--r-- | io/iotest.ts (renamed from net/iotest.ts) | 0 | ||||
-rw-r--r-- | io/ioutil.ts (renamed from net/ioutil.ts) | 0 | ||||
-rw-r--r-- | io/ioutil_test.ts (renamed from net/ioutil_test.ts) | 0 | ||||
-rw-r--r-- | io/util.ts (renamed from net/util.ts) | 0 | ||||
-rw-r--r-- | log/README.md (renamed from logging/README.md) | 0 | ||||
-rw-r--r-- | log/handlers.ts (renamed from logging/handlers.ts) | 0 | ||||
-rw-r--r-- | log/levels.ts (renamed from logging/levels.ts) | 0 | ||||
-rw-r--r-- | log/logger.ts (renamed from logging/logger.ts) | 0 | ||||
-rw-r--r-- | log/mod.ts (renamed from logging/index.ts) | 0 | ||||
-rw-r--r-- | log/test.ts (renamed from logging/test.ts) | 2 | ||||
-rwxr-xr-x | test.ts | 15 | ||||
-rw-r--r-- | textproto/mod.ts (renamed from net/textproto.ts) | 4 | ||||
-rw-r--r-- | textproto/test.ts (renamed from net/textproto_test.ts) | 6 | ||||
-rw-r--r-- | ws/mod.ts (renamed from net/ws.ts) | 6 | ||||
-rw-r--r-- | ws/sha1.ts (renamed from net/sha1.ts) | 0 | ||||
-rw-r--r-- | ws/sha1_test.ts (renamed from net/sha1_test.ts) | 0 | ||||
-rw-r--r-- | ws/test.ts (renamed from net/ws_test.ts) | 6 |
44 files changed, 54 insertions, 45 deletions
diff --git a/examples/gist.ts b/examples/gist.ts index 7b3d59f87..1baff874a 100755 --- a/examples/gist.ts +++ b/examples/gist.ts @@ -1,7 +1,7 @@ #!/usr/bin/env deno --allow-net --allow-env import { args, env, exit, readFile } from "deno"; -import { parse } from "https://deno.land/x/flags/index.ts"; +import { parse } from "https://deno.land/x/flags/mod.ts"; function pathBase(p: string): string { const parts = p.split("/"); diff --git a/examples/ws.ts b/examples/ws.ts index f8e711c49..bc2a7bd0b 100644 --- a/examples/ws.ts +++ b/examples/ws.ts @@ -1,10 +1,10 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import { serve } from "https://deno.land/x/net/http.ts"; +import { serve } from "https://deno.land/x/http/mod.ts"; import { acceptWebSocket, isWebSocketCloseEvent, isWebSocketPingEvent -} from "https://deno.land/x/net/ws.ts"; +} from "https://deno.land/x/ws/mod.ts"; async function main() { console.log("websocket server is running on 0.0.0.0:8080"); diff --git a/flags/example.ts b/flags/example.ts index 811aacd69..5aa0a5034 100644 --- a/flags/example.ts +++ b/flags/example.ts @@ -1,4 +1,4 @@ import { args } from "deno"; -import { parse } from "./index.ts"; +import { parse } from "./mod.ts"; console.dir(parse(args)); diff --git a/flags/index.ts b/flags/mod.ts index 28a5c8eac..28a5c8eac 100644 --- a/flags/index.ts +++ b/flags/mod.ts diff --git a/flags/tests/all_bool.ts b/flags/tests/all_bool.ts index 2e0bba4ce..07b12c292 100755 --- a/flags/tests/all_bool.ts +++ b/flags/tests/all_bool.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; // flag boolean true (default all --args to boolean) test(function flagBooleanTrue() { diff --git a/flags/tests/bool.ts b/flags/tests/bool.ts index 5d135028e..6fa014d8d 100755 --- a/flags/tests/bool.ts +++ b/flags/tests/bool.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function flagBooleanDefaultFalse() { const argv = parse(["moo"], { diff --git a/flags/tests/dash.ts b/flags/tests/dash.ts index f8cec6ef7..6ab1a7d75 100755 --- a/flags/tests/dash.ts +++ b/flags/tests/dash.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function hyphen() { assertEqual(parse(["-n", "-"]), { n: "-", _: [] }); diff --git a/flags/tests/default_bool.ts b/flags/tests/default_bool.ts index 8cf6a720b..82dab5538 100755 --- a/flags/tests/default_bool.ts +++ b/flags/tests/default_bool.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function booleanDefaultTrue() { const argv = parse([], { diff --git a/flags/tests/dotted.ts b/flags/tests/dotted.ts index 94867abb2..6b64e3b5e 100755 --- a/flags/tests/dotted.ts +++ b/flags/tests/dotted.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function dottedAlias() { const argv = parse(["--a.b", "22"], { diff --git a/flags/tests/kv_short.ts b/flags/tests/kv_short.ts index 1050d7734..41853c1de 100755 --- a/flags/tests/kv_short.ts +++ b/flags/tests/kv_short.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function short() { const argv = parse(["-b=123"]); diff --git a/flags/tests/long.ts b/flags/tests/long.ts index 41c3e7743..d75ece3b2 100755 --- a/flags/tests/long.ts +++ b/flags/tests/long.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function longOpts() { assertEqual(parse(["--bool"]), { bool: true, _: [] }); diff --git a/flags/tests/num.ts b/flags/tests/num.ts index 0588b51f6..cc5b1b4e3 100755 --- a/flags/tests/num.ts +++ b/flags/tests/num.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function nums() { const argv = parse([ diff --git a/flags/tests/parse.ts b/flags/tests/parse.ts index 30551f875..263335761 100644 --- a/flags/tests/parse.ts +++ b/flags/tests/parse.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function _arseArgs() { assertEqual(parse(["--no-moo"]), { moo: false, _: [] }); diff --git a/flags/tests/short.ts b/flags/tests/short.ts index dee981351..fe8994394 100755 --- a/flags/tests/short.ts +++ b/flags/tests/short.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function numbericShortArgs() { assertEqual(parse(["-n123"]), { n: 123, _: [] }); diff --git a/flags/tests/stop_early.ts b/flags/tests/stop_early.ts index ca64bf97e..aef4d5dc5 100755 --- a/flags/tests/stop_early.ts +++ b/flags/tests/stop_early.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; // stops parsing on the first non-option when stopEarly is set test(function stopParsing() { diff --git a/flags/tests/unknown.ts b/flags/tests/unknown.ts index 2c87b18fe..e86f92796 100755 --- a/flags/tests/unknown.ts +++ b/flags/tests/unknown.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function booleanAndAliasIsNotUnknown() { const unknown = []; diff --git a/flags/tests/whitespace.ts b/flags/tests/whitespace.ts index 8373cd19e..46ad09426 100755 --- a/flags/tests/whitespace.ts +++ b/flags/tests/whitespace.ts @@ -1,5 +1,5 @@ import { test, assertEqual } from "../../testing/mod.ts"; -import { parse } from "../index.ts"; +import { parse } from "../mod.ts"; test(function whitespaceShouldBeWhitespace() { assertEqual(parse(["-x", "\t"]).x, "\t"); diff --git a/net/README.md b/http/README.md index 65f2b9ad7..e81e42a41 100644 --- a/net/README.md +++ b/http/README.md @@ -3,7 +3,7 @@ Usage: ```typescript -import { serve } from "https://deno.land/x/net/http.ts"; +import { serve } from "https://deno.land/x/http/mod.ts"; const s = serve("0.0.0.0:8000"); async function main() { @@ -22,5 +22,5 @@ A small program for serving local files over HTTP. Add the following to your `.bash_profile` ``` -alias file_server="deno https://deno.land/x/net/file_server.ts --allow-net" +alias file_server="deno https://deno.land/x/http/file_server.ts --allow-net" ``` diff --git a/net/file_server.ts b/http/file_server.ts index 72432abdd..4437a44e4 100755 --- a/net/file_server.ts +++ b/http/file_server.ts @@ -10,7 +10,7 @@ import { ServerRequest, setContentLength, Response -} from "./http.ts"; +} from "./mod.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/net/file_server_test.ts b/http/file_server_test.ts index bd00d749b..bd00d749b 100644 --- a/net/file_server_test.ts +++ b/http/file_server_test.ts diff --git a/net/http.ts b/http/http.ts index e360e0d86..da7bc0169 100644 --- a/net/http.ts +++ b/http/http.ts @@ -1,8 +1,8 @@ import { listen, Conn, toAsyncIterator, Reader, copy } from "deno"; -import { BufReader, BufState, BufWriter } from "./bufio.ts"; -import { TextProtoReader } from "./textproto.ts"; +import { BufReader, BufState, BufWriter } from "../io/bufio.ts"; +import { TextProtoReader } from "../textproto/mod.ts"; import { STATUS_TEXT } from "./http_status.ts"; -import { assert } from "./util.ts"; +import { assert } from "../io/util.ts"; interface Deferred { promise: Promise<{}>; diff --git a/net/http_bench.ts b/http/http_bench.ts index 8e1e24ad6..5aca12f55 100644 --- a/net/http_bench.ts +++ b/http/http_bench.ts @@ -1,5 +1,5 @@ import * as deno from "deno"; -import { serve } from "./http.ts"; +import { serve } from "./mod.ts"; const addr = deno.args[1] || "127.0.0.1:4500"; const server = serve(addr); diff --git a/net/http_status.ts b/http/http_status.ts index a3006d319..a3006d319 100644 --- a/net/http_status.ts +++ b/http/http_status.ts diff --git a/net/http_test.ts b/http/http_test.ts index 9235feb02..ba0cec3e3 100644 --- a/net/http_test.ts +++ b/http/http_test.ts @@ -12,8 +12,8 @@ import { ServerRequest, setContentLength, Response -} from "./http.ts"; -import { BufWriter, BufReader } from "./bufio.ts"; +} from "./mod.ts"; +import { BufWriter, BufReader } from "../io/bufio.ts"; interface ResponseTest { response: Response; diff --git a/http/mod.ts b/http/mod.ts new file mode 100644 index 000000000..217bd68b3 --- /dev/null +++ b/http/mod.ts @@ -0,0 +1,8 @@ +import { + serve, + listenAndServe, + Response, + setContentLength, + ServerRequest +} from "./http.ts"; +export { serve, listenAndServe, Response, setContentLength, ServerRequest }; diff --git a/net/bufio.ts b/io/bufio.ts index 0dd2b94b4..0dd2b94b4 100644 --- a/net/bufio.ts +++ b/io/bufio.ts diff --git a/net/bufio_test.ts b/io/bufio_test.ts index fa8f4b73b..fa8f4b73b 100644 --- a/net/bufio_test.ts +++ b/io/bufio_test.ts diff --git a/net/iotest.ts b/io/iotest.ts index e3a42f58a..e3a42f58a 100644 --- a/net/iotest.ts +++ b/io/iotest.ts diff --git a/net/ioutil.ts b/io/ioutil.ts index 68d6e5190..68d6e5190 100644 --- a/net/ioutil.ts +++ b/io/ioutil.ts diff --git a/net/ioutil_test.ts b/io/ioutil_test.ts index 422901e4a..422901e4a 100644 --- a/net/ioutil_test.ts +++ b/io/ioutil_test.ts diff --git a/net/util.ts b/io/util.ts index 811940b4d..811940b4d 100644 --- a/net/util.ts +++ b/io/util.ts diff --git a/logging/README.md b/log/README.md index 1d88cb070..1d88cb070 100644 --- a/logging/README.md +++ b/log/README.md diff --git a/logging/handlers.ts b/log/handlers.ts index a0163e6cd..a0163e6cd 100644 --- a/logging/handlers.ts +++ b/log/handlers.ts diff --git a/logging/levels.ts b/log/levels.ts index 52d28aea5..52d28aea5 100644 --- a/logging/levels.ts +++ b/log/levels.ts diff --git a/logging/logger.ts b/log/logger.ts index 9f34f9c32..9f34f9c32 100644 --- a/logging/logger.ts +++ b/log/logger.ts diff --git a/logging/index.ts b/log/mod.ts index e8c762ac6..e8c762ac6 100644 --- a/logging/index.ts +++ b/log/mod.ts diff --git a/logging/test.ts b/log/test.ts index 17117ae8b..fdc994eb7 100644 --- a/logging/test.ts +++ b/log/test.ts @@ -1,6 +1,6 @@ import { remove, open, readAll } from "deno"; import { assertEqual, test } from "../testing/mod.ts"; -import * as log from "index.ts"; +import * as log from "./mod.ts"; import { FileHandler } from "./handlers.ts"; // TODO: establish something more sophisticated @@ -5,11 +5,6 @@ import "colors/test.ts"; import "datetime/test.ts"; import "examples/test.ts"; import "flags/test.ts"; -import "logging/test.ts"; -import "media_types/test.ts"; -import "net/bufio_test.ts"; -import "net/http_test.ts"; -import "net/textproto_test.ts"; import "fs/mkdirp_test.ts"; import "fs/path/basename_test.ts"; import "fs/path/dirname_test.ts"; @@ -20,12 +15,18 @@ import "fs/path/parse_format_test.ts"; import "fs/path/relative_test.ts"; import "fs/path/resolve_test.ts"; import "fs/path/zero_length_strings_test.ts"; +import "io/bufio_test.ts"; +import "http/http_test.ts"; +import "log/test.ts"; +import "media_types/test.ts"; import "testing/test.ts"; +import "textproto/test.ts"; +import "ws/test.ts"; -import { runTests, completePromise } from "net/file_server_test.ts"; +import { runTests, completePromise } from "http/file_server_test.ts"; const fileServer = run({ - args: ["deno", "--allow-net", "net/file_server.ts", ".", "--cors"] + args: ["deno", "--allow-net", "http/file_server.ts", ".", "--cors"] }); runTests(new Promise(res => setTimeout(res, 5000))); diff --git a/net/textproto.ts b/textproto/mod.ts index 832299e1c..ee7647296 100644 --- a/net/textproto.ts +++ b/textproto/mod.ts @@ -3,8 +3,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -import { BufReader, BufState } from "./bufio.ts"; -import { charCode } from "./util.ts"; +import { BufReader, BufState } from "../io/bufio.ts"; +import { charCode } from "../io/util.ts"; const asciiDecoder = new TextDecoder(); function str(buf: Uint8Array): string { diff --git a/net/textproto_test.ts b/textproto/test.ts index e0ae0749c..0f8bee227 100644 --- a/net/textproto_test.ts +++ b/textproto/test.ts @@ -3,9 +3,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -import { BufReader } from "./bufio.ts"; -import { TextProtoReader, append } from "./textproto.ts"; -import { stringsReader } from "./util.ts"; +import { BufReader } from "../io/bufio.ts"; +import { TextProtoReader, append } from "./mod.ts"; +import { stringsReader } from "../io/util.ts"; import { test, assert, assertEqual } from "../testing/mod.ts"; function reader(s: string): TextProtoReader { @@ -1,8 +1,8 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { Buffer, Writer, Conn } from "deno"; -import { ServerRequest } from "./http.ts"; -import { BufReader, BufWriter } from "./bufio.ts"; -import { readLong, readShort, sliceLongToBytes } from "./ioutil.ts"; +import { ServerRequest } from "../http/http.ts"; +import { BufReader, BufWriter } from "../io/bufio.ts"; +import { readLong, readShort, sliceLongToBytes } from "../io/ioutil.ts"; import { Sha1 } from "./sha1.ts"; export const OpCodeContinue = 0x0; diff --git a/net/sha1.ts b/ws/sha1.ts index 036c3c552..036c3c552 100644 --- a/net/sha1.ts +++ b/ws/sha1.ts diff --git a/net/sha1_test.ts b/ws/sha1_test.ts index b385f18da..b385f18da 100644 --- a/net/sha1_test.ts +++ b/ws/sha1_test.ts diff --git a/net/ws_test.ts b/ws/test.ts index 62e5a6089..bf800f7e3 100644 --- a/net/ws_test.ts +++ b/ws/test.ts @@ -1,6 +1,6 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { Buffer } from "deno"; -import { BufReader } from "./bufio.ts"; +import { BufReader } from "../io/bufio.ts"; import { test, assert, assertEqual } from "../testing/mod.ts"; import { createSecAccept, @@ -11,8 +11,8 @@ import { OpCodeTextFrame, readFrame, unmask -} from "./ws.ts"; -import { serve } from "./http.ts"; +} from "./mod.ts"; +import { serve } from "../http/http.ts"; test(async function testReadUnmaskedTextFrame() { // unmasked single text frame with payload "Hello" |