refactor(path): reorg (#101)

This commit is contained in:
木杉 2019-01-11 06:11:44 +08:00 committed by Ryan Dahl
parent 41a2d21826
commit 5be16ba599
18 changed files with 38 additions and 36 deletions

View File

@ -22,7 +22,7 @@
A framework for creating HTTP/HTTPS servers inspired by GoLang.
- **[path](./path/)**
- **[path](./fs/path)**
File path manipulation.

2
fs/path.ts Normal file
View File

@ -0,0 +1,2 @@
export * from "./path/mod.ts";
export * from "./path/interface.ts";

7
fs/path/README.md Normal file
View File

@ -0,0 +1,7 @@
# Deno Path Manipulation Libraries
Usage:
```ts
import * as path from "https://deno.land/x/fs/path.ts";
```

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +0,0 @@
# Deno Path Manipulation Libraries
Usage:
```ts
import * as path from "https://deno.land/x/path/index.ts";
```

18
test.ts
View File

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