summaryrefslogtreecommitdiff
path: root/std/path
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-05-09 13:34:47 +0100
committerGitHub <noreply@github.com>2020-05-09 08:34:47 -0400
commitf184332c09c851faac50f598d29ebe4426e05464 (patch)
tree2659aba63702537fcde1bb64ddeafea1e5863f3e /std/path
parent2b02535028f868ea8dfc471c4921a237747ccd4a (diff)
BREAKING(std): reorganization (#5087)
* Prepend underscores to private modules * Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result. * Move std/_util/async.ts to std/async * Move std/util/sha*.ts to std/hash
Diffstat (limited to 'std/path')
-rw-r--r--std/path/_constants.ts (renamed from std/path/constants.ts)4
-rw-r--r--std/path/_globrex.ts (renamed from std/path/globrex.ts)0
-rw-r--r--std/path/_globrex_test.ts (renamed from std/path/globrex_test.ts)2
-rw-r--r--std/path/_util.ts (renamed from std/path/utils.ts)2
-rw-r--r--std/path/common.ts2
-rw-r--r--std/path/glob.ts4
-rw-r--r--std/path/mod.ts7
-rw-r--r--std/path/posix.ts4
-rw-r--r--std/path/separator.ts4
-rw-r--r--std/path/win32.ts4
10 files changed, 18 insertions, 15 deletions
diff --git a/std/path/constants.ts b/std/path/_constants.ts
index 97d3bcf58..ae0aac184 100644
--- a/std/path/constants.ts
+++ b/std/path/_constants.ts
@@ -48,7 +48,7 @@ export const CHAR_EQUAL = 61; /* = */
export const CHAR_0 = 48; /* 0 */
export const CHAR_9 = 57; /* 9 */
-export const isWindows = build.os === "windows";
-export const EOL = isWindows ? "\r\n" : "\n";
+const isWindows = build.os == "windows";
+
export const SEP = isWindows ? "\\" : "/";
export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;
diff --git a/std/path/globrex.ts b/std/path/_globrex.ts
index 3fc69dd6c..3fc69dd6c 100644
--- a/std/path/globrex.ts
+++ b/std/path/_globrex.ts
diff --git a/std/path/globrex_test.ts b/std/path/_globrex_test.ts
index c52ed108e..2974b4719 100644
--- a/std/path/globrex_test.ts
+++ b/std/path/_globrex_test.ts
@@ -4,7 +4,7 @@
const { test } = Deno;
import { assertEquals } from "../testing/asserts.ts";
-import { GlobrexOptions, globrex } from "./globrex.ts";
+import { GlobrexOptions, globrex } from "./_globrex.ts";
const isWin = Deno.build.os === "windows";
const t = { equal: assertEquals, is: assertEquals };
diff --git a/std/path/utils.ts b/std/path/_util.ts
index fc3dc5be9..2776303cb 100644
--- a/std/path/utils.ts
+++ b/std/path/_util.ts
@@ -10,7 +10,7 @@ import {
CHAR_DOT,
CHAR_FORWARD_SLASH,
CHAR_BACKWARD_SLASH,
-} from "./constants.ts";
+} from "./_constants.ts";
export function assertPath(path: string): void {
if (typeof path !== "string") {
diff --git a/std/path/common.ts b/std/path/common.ts
index 0a4de3f0c..e0e51ef23 100644
--- a/std/path/common.ts
+++ b/std/path/common.ts
@@ -1,6 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-import { SEP } from "./constants.ts";
+import { SEP } from "./separator.ts";
/** Determines the common path from a set of paths, using an optional separator,
* which defaults to the OS default separator.
diff --git a/std/path/glob.ts b/std/path/glob.ts
index a11865c26..80672579d 100644
--- a/std/path/glob.ts
+++ b/std/path/glob.ts
@@ -1,5 +1,5 @@
-import { SEP, SEP_PATTERN } from "./constants.ts";
-import { globrex } from "./globrex.ts";
+import { SEP, SEP_PATTERN } from "./separator.ts";
+import { globrex } from "./_globrex.ts";
import { join, normalize } from "./mod.ts";
import { assert } from "../testing/asserts.ts";
diff --git a/std/path/mod.ts b/std/path/mod.ts
index 104e0b616..9cb7f1edb 100644
--- a/std/path/mod.ts
+++ b/std/path/mod.ts
@@ -4,7 +4,7 @@
import * as _win32 from "./win32.ts";
import * as _posix from "./posix.ts";
-import { isWindows } from "./constants.ts";
+const isWindows = Deno.build.os == "windows";
const path = isWindows ? _win32 : _posix;
@@ -27,8 +27,7 @@ export const {
toNamespacedPath,
} = path;
-export { common } from "./common.ts";
-export { EOL, SEP, SEP_PATTERN, isWindows } from "./constants.ts";
+export * from "./common.ts";
+export { SEP, SEP_PATTERN } from "./separator.ts";
export * from "./interface.ts";
export * from "./glob.ts";
-export * from "./globrex.ts";
diff --git a/std/path/posix.ts b/std/path/posix.ts
index 156aba796..e88eb3f97 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -3,14 +3,14 @@
const { cwd } = Deno;
import { FormatInputPathObject, ParsedPath } from "./interface.ts";
-import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./constants.ts";
+import { CHAR_DOT, CHAR_FORWARD_SLASH } from "./_constants.ts";
import {
assertPath,
normalizeString,
isPosixPathSeparator,
_format,
-} from "./utils.ts";
+} from "./_util.ts";
export const sep = "/";
export const delimiter = ":";
diff --git a/std/path/separator.ts b/std/path/separator.ts
new file mode 100644
index 000000000..fb990b808
--- /dev/null
+++ b/std/path/separator.ts
@@ -0,0 +1,4 @@
+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+const isWindows = Deno.build.os == "windows";
+export const SEP = isWindows ? "\\" : "/";
+export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;
diff --git a/std/path/win32.ts b/std/path/win32.ts
index 401e572db..0557b3768 100644
--- a/std/path/win32.ts
+++ b/std/path/win32.ts
@@ -8,7 +8,7 @@ import {
CHAR_BACKWARD_SLASH,
CHAR_COLON,
CHAR_QUESTION_MARK,
-} from "./constants.ts";
+} from "./_constants.ts";
import {
assertPath,
@@ -16,7 +16,7 @@ import {
isWindowsDeviceRoot,
normalizeString,
_format,
-} from "./utils.ts";
+} from "./_util.ts";
import { assert } from "../testing/asserts.ts";
export const sep = "\\";