mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
78 lines
2.4 KiB
TypeScript
78 lines
2.4 KiB
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
// Copyright the Browserify authors. MIT License.
|
|
// Ported mostly from https://github.com/browserify/path-browserify/
|
|
// This module is browser compatible.
|
|
|
|
/**
|
|
* Utilities for working with OS-specific file paths.
|
|
*
|
|
* Functions from this module will automatically switch to support the path style
|
|
* of the current OS, either `windows` for Microsoft Windows, or `posix` for
|
|
* every other operating system, eg. Linux, MacOS, BSD etc.
|
|
*
|
|
* To use functions for a specific path style regardless of the current OS
|
|
* import the modules from the platform sub directory instead.
|
|
*
|
|
* Example, for `posix`:
|
|
*
|
|
* ```ts
|
|
* import { fromFileUrl } from "@std/path/posix/from_file_url";
|
|
* const p = fromFileUrl("file:///home/foo");
|
|
* console.log(p); // "/home/foo"
|
|
* ```
|
|
*
|
|
* or, for `windows`:
|
|
*
|
|
* ```ts
|
|
* import { fromFileUrl } from "@std/path/windows/from_file_url";
|
|
* const p = fromFileUrl("file:///home/foo");
|
|
* console.log(p); // "\\home\\foo"
|
|
* ```
|
|
*
|
|
* This module is browser compatible.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
import * as _windows from "./windows/mod.ts";
|
|
import * as _posix from "./posix/mod.ts";
|
|
import { DELIMITER, SEPARATOR } from "./constants.ts";
|
|
|
|
/** @deprecated (will be removed after 1.0.0) Import from {@link https://deno.land/std/path/windows/mod.ts} instead. */
|
|
export const win32: typeof _windows = _windows;
|
|
|
|
/** @deprecated (will be removed after 1.0.0) Import from {@link https://deno.land/std/posix/mod.ts} instead. */
|
|
export const posix: typeof _posix = _posix;
|
|
|
|
/**
|
|
* @deprecated (will be removed in 0.215.0) Use {@linkcode SEPARATOR} instead.
|
|
*/
|
|
export const sep = SEPARATOR;
|
|
|
|
/**
|
|
* @deprecated (will be removed in 0.215.0) Use {@linkcode DELIMITER} instead.
|
|
*/
|
|
export const delimiter = DELIMITER;
|
|
|
|
export * from "./basename.ts";
|
|
export * from "./constants.ts";
|
|
export * from "./dirname.ts";
|
|
export * from "./extname.ts";
|
|
export * from "./format.ts";
|
|
export * from "./from_file_url.ts";
|
|
export * from "./is_absolute.ts";
|
|
export * from "./join.ts";
|
|
export * from "./normalize.ts";
|
|
export * from "./parse.ts";
|
|
export * from "./relative.ts";
|
|
export * from "./resolve.ts";
|
|
export * from "./to_file_url.ts";
|
|
export * from "./to_namespaced_path.ts";
|
|
export * from "./common.ts";
|
|
export * from "./separator.ts";
|
|
export * from "./_interface.ts";
|
|
export * from "./glob_to_regexp.ts";
|
|
export * from "./is_glob.ts";
|
|
export * from "./join_globs.ts";
|
|
export * from "./normalize_glob.ts";
|