diff --git a/path/_separator.ts b/path/_separator.ts new file mode 100644 index 000000000000..e3a376a636ed --- /dev/null +++ b/path/_separator.ts @@ -0,0 +1,12 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +// This module is browser compatible. + +// NOTE: This file exists to break circular referencecs; it should NOT be +// imported directly, outside of the "std/path" module. + +import { isWindows } from "../_util/os.ts"; +import { sep as win32Sep } from "./win32.ts"; +import { sep as posixSep } from "./posix.ts"; + +export const SEP = isWindows ? win32Sep : posixSep; +export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/; diff --git a/path/common.ts b/path/common.ts index 791105a6447c..0165a4b8b5d0 100644 --- a/path/common.ts +++ b/path/common.ts @@ -1,7 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. -import { SEP } from "./separator.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/path/glob.ts b/path/glob.ts index 265dc4a54ff6..5efdd69e0188 100644 --- a/path/glob.ts +++ b/path/glob.ts @@ -2,7 +2,7 @@ // This module is browser compatible. import { isWindows, osType } from "../_util/os.ts"; -import { SEP, SEP_PATTERN } from "./separator.ts"; +import { SEP, SEP_PATTERN } from "./_separator.ts"; import * as _win32 from "./win32.ts"; import * as _posix from "./posix.ts"; import type { OSType } from "../_util/os.ts"; diff --git a/path/mod.ts b/path/mod.ts index a51b83165e66..784bc5273bd3 100644 --- a/path/mod.ts +++ b/path/mod.ts @@ -49,6 +49,6 @@ export const { } = path; export * from "./common.ts"; -export { SEP, SEP_PATTERN } from "./separator.ts"; +export * from "./_separator.ts"; export * from "./_interface.ts"; export * from "./glob.ts"; diff --git a/path/separator.ts b/path/separator.ts deleted file mode 100644 index 99e4dff1b20a..000000000000 --- a/path/separator.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. - -import { isWindows } from "../_util/os.ts"; - -export const SEP = isWindows ? "\\" : "/"; -export const SEP_PATTERN = isWindows ? /[\\/]+/ : /\/+/;