From 5be16ba5992b34a64d307779350b88b5cacbfa23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E6=9D=89?= Date: Fri, 11 Jan 2019 06:11:44 +0800 Subject: [PATCH] refactor(path): reorg (#101) --- README.md | 2 +- fs/path.ts | 2 ++ fs/path/README.md | 7 +++++++ {path => fs/path}/basename_test.ts | 4 ++-- {path => fs/path}/constants.ts | 0 {path => fs/path}/dirname_test.ts | 4 ++-- {path => fs/path}/extname_test.ts | 4 ++-- {path => fs/path}/interface.ts | 0 {path => fs/path}/isabsolute_test.ts | 4 ++-- {path => fs/path}/join_test.ts | 4 ++-- path/index.ts => fs/path/mod.ts | 0 {path => fs/path}/parse_format_test.ts | 4 ++-- {path => fs/path}/relative_test.ts | 4 ++-- {path => fs/path}/resolve_test.ts | 4 ++-- {path => fs/path}/zero_length_strings_test.ts | 4 ++-- net/file_server.ts | 2 +- path/README.md | 7 ------- test.ts | 18 +++++++++--------- 18 files changed, 38 insertions(+), 36 deletions(-) create mode 100644 fs/path.ts create mode 100644 fs/path/README.md rename {path => fs/path}/basename_test.ts (97%) rename {path => fs/path}/constants.ts (100%) rename {path => fs/path}/dirname_test.ts (96%) rename {path => fs/path}/extname_test.ts (96%) rename {path => fs/path}/interface.ts (100%) rename {path => fs/path}/isabsolute_test.ts (93%) rename {path => fs/path}/join_test.ts (97%) rename path/index.ts => fs/path/mod.ts (100%) rename {path => fs/path}/parse_format_test.ts (98%) rename {path => fs/path}/relative_test.ts (96%) rename {path => fs/path}/resolve_test.ts (94%) rename {path => fs/path}/zero_length_strings_test.ts (94%) delete mode 100644 path/README.md diff --git a/README.md b/README.md index 3a2788333b..0a996bce37 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A framework for creating HTTP/HTTPS servers inspired by GoLang. -- **[path](./path/)** +- **[path](./fs/path)** File path manipulation. diff --git a/fs/path.ts b/fs/path.ts new file mode 100644 index 0000000000..64390108d6 --- /dev/null +++ b/fs/path.ts @@ -0,0 +1,2 @@ +export * from "./path/mod.ts"; +export * from "./path/interface.ts"; diff --git a/fs/path/README.md b/fs/path/README.md new file mode 100644 index 0000000000..938ffb358f --- /dev/null +++ b/fs/path/README.md @@ -0,0 +1,7 @@ +# Deno Path Manipulation Libraries + +Usage: + +```ts +import * as path from "https://deno.land/x/fs/path.ts"; +``` diff --git a/path/basename_test.ts b/fs/path/basename_test.ts similarity index 97% rename from path/basename_test.ts rename to fs/path/basename_test.ts index b605aa2100..ffe9e051c4 100644 --- a/path/basename_test.ts +++ b/fs/path/basename_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; test(function basename() { assertEqual(path.basename(".js", ".js"), ""); diff --git a/path/constants.ts b/fs/path/constants.ts similarity index 100% rename from path/constants.ts rename to fs/path/constants.ts diff --git a/path/dirname_test.ts b/fs/path/dirname_test.ts similarity index 96% rename from path/dirname_test.ts rename to fs/path/dirname_test.ts index e535ec8911..5613d6d2c8 100644 --- a/path/dirname_test.ts +++ b/fs/path/dirname_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; test(function dirname() { assertEqual(path.posix.dirname("/a/b/"), "/a"); diff --git a/path/extname_test.ts b/fs/path/extname_test.ts similarity index 96% rename from path/extname_test.ts rename to fs/path/extname_test.ts index 0d6d283a8a..63d473d34f 100644 --- a/path/extname_test.ts +++ b/fs/path/extname_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; const slashRE = /\//g; diff --git a/path/interface.ts b/fs/path/interface.ts similarity index 100% rename from path/interface.ts rename to fs/path/interface.ts diff --git a/path/isabsolute_test.ts b/fs/path/isabsolute_test.ts similarity index 93% rename from path/isabsolute_test.ts rename to fs/path/isabsolute_test.ts index 548819ac0e..9591b80451 100644 --- a/path/isabsolute_test.ts +++ b/fs/path/isabsolute_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; test(function isAbsolute() { assertEqual(path.posix.isAbsolute("/home/foo"), true); diff --git a/path/join_test.ts b/fs/path/join_test.ts similarity index 97% rename from path/join_test.ts rename to fs/path/join_test.ts index 25e302eba7..2051dbdaa4 100644 --- a/path/join_test.ts +++ b/fs/path/join_test.ts @@ -1,5 +1,5 @@ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; const backslashRE = /\\/g; diff --git a/path/index.ts b/fs/path/mod.ts similarity index 100% rename from path/index.ts rename to fs/path/mod.ts diff --git a/path/parse_format_test.ts b/fs/path/parse_format_test.ts similarity index 98% rename from path/parse_format_test.ts rename to fs/path/parse_format_test.ts index be98f8739d..8b429ce24e 100644 --- a/path/parse_format_test.ts +++ b/fs/path/parse_format_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; const winPaths = [ // [path, root] diff --git a/path/relative_test.ts b/fs/path/relative_test.ts similarity index 96% rename from path/relative_test.ts rename to fs/path/relative_test.ts index dcf8fed984..87e308b43f 100644 --- a/path/relative_test.ts +++ b/fs/path/relative_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; const relativeTests = { win32: diff --git a/path/resolve_test.ts b/fs/path/resolve_test.ts similarity index 94% rename from path/resolve_test.ts rename to fs/path/resolve_test.ts index b365d40b07..7c2b55249a 100644 --- a/path/resolve_test.ts +++ b/fs/path/resolve_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; import { cwd } from "deno"; const windowsTests = diff --git a/path/zero_length_strings_test.ts b/fs/path/zero_length_strings_test.ts similarity index 94% rename from path/zero_length_strings_test.ts rename to fs/path/zero_length_strings_test.ts index f9b357bf1c..d069c781f1 100644 --- a/path/zero_length_strings_test.ts +++ b/fs/path/zero_length_strings_test.ts @@ -1,8 +1,8 @@ // Copyright the Browserify authors. MIT License. // Ported from https://github.com/browserify/path-browserify/ -import { test, assertEqual } from "../testing/mod.ts"; -import * as path from "./index.ts"; +import { test, assertEqual } from "../../testing/mod.ts"; +import * as path from "./mod.ts"; import { cwd } from "deno"; const pwd = cwd(); diff --git a/net/file_server.ts b/net/file_server.ts index 91afa2d573..bebb93969f 100755 --- a/net/file_server.ts +++ b/net/file_server.ts @@ -12,7 +12,7 @@ import { Response } from "./http.ts"; import { cwd, DenoError, ErrorKind, args, stat, readDir, open } from "deno"; -import { extname } from "../path/index.ts"; +import { extname } from "../fs/path.ts"; import * as extensionsMap from "./extension_map.json"; const dirViewerTemplate = ` diff --git a/path/README.md b/path/README.md deleted file mode 100644 index 924b0a993f..0000000000 --- a/path/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Deno Path Manipulation Libraries - -Usage: - -```ts -import * as path from "https://deno.land/x/path/index.ts"; -``` diff --git a/test.ts b/test.ts index 821aa41160..885096ac93 100755 --- a/test.ts +++ b/test.ts @@ -10,15 +10,15 @@ import "mkdirp/test.ts"; import "net/bufio_test.ts"; import "net/http_test.ts"; import "net/textproto_test.ts"; -import "path/basename_test.ts"; -import "path/dirname_test.ts"; -import "path/extname_test.ts"; -import "path/isabsolute_test.ts"; -import "path/join_test.ts"; -import "path/parse_format_test.ts"; -import "path/relative_test.ts"; -import "path/resolve_test.ts"; -import "path/zero_length_strings_test.ts"; +import "fs/path/basename_test.ts"; +import "fs/path/dirname_test.ts"; +import "fs/path/extname_test.ts"; +import "fs/path/isabsolute_test.ts"; +import "fs/path/join_test.ts"; +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 "testing/test.ts"; import { runTests, completePromise } from "net/file_server_test.ts";