diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-06-20 23:49:27 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-20 23:49:27 -0400 |
commit | 0a81ec6b1e00ef01900393ae0460eaf3a6ec05d6 (patch) | |
tree | 020b1d71aabd8102ae85ae24fc89becb035b4854 /cli/js | |
parent | c0ea9a99c0dc21faf46f73dca481361853e914fa (diff) |
Remove Deno.dir and dirs dependency (#6385)
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/deno_unstable.ts | 2 | ||||
-rw-r--r-- | cli/js/diagnostics_util.ts | 2 | ||||
-rw-r--r-- | cli/js/lib.deno.unstable.d.ts | 169 | ||||
-rw-r--r-- | cli/js/ops/os.ts | 30 |
4 files changed, 1 insertions, 202 deletions
diff --git a/cli/js/deno_unstable.ts b/cli/js/deno_unstable.ts index 991df9955..d8624c675 100644 --- a/cli/js/deno_unstable.ts +++ b/cli/js/deno_unstable.ts @@ -5,7 +5,7 @@ export { umask } from "./ops/fs/umask.ts"; export { linkSync, link } from "./ops/fs/link.ts"; export { symlinkSync, symlink } from "./ops/fs/symlink.ts"; -export { dir, loadavg, osRelease, hostname } from "./ops/os.ts"; +export { loadavg, osRelease, hostname } from "./ops/os.ts"; export { openPlugin } from "./ops/plugins.ts"; export { transpileOnly, compile, bundle } from "./compiler_api.ts"; export { applySourceMap, formatDiagnostics } from "./ops/errors.ts"; diff --git a/cli/js/diagnostics_util.ts b/cli/js/diagnostics_util.ts index 7b66d72a3..905a4397c 100644 --- a/cli/js/diagnostics_util.ts +++ b/cli/js/diagnostics_util.ts @@ -16,8 +16,6 @@ const unstableDenoGlobalProperties = [ "link", "symlinkSync", "symlink", - "DirKind", - "dir", "loadavg", "osRelease", "openPlugin", diff --git a/cli/js/lib.deno.unstable.d.ts b/cli/js/lib.deno.unstable.d.ts index dd8de2eb6..3339bfbac 100644 --- a/cli/js/lib.deno.unstable.d.ts +++ b/cli/js/lib.deno.unstable.d.ts @@ -83,175 +83,6 @@ declare namespace Deno { options?: SymlinkOptions ): Promise<void>; - /** **UNSTABLE** */ - export type DirKind = - | "home" - | "cache" - | "config" - | "executable" - | "data" - | "data_local" - | "audio" - | "desktop" - | "document" - | "download" - | "font" - | "picture" - | "public" - | "template" - | "tmp" - | "video"; - - /** - * **UNSTABLE**: Currently under evaluation to decide if method name `dir` and - * parameter type alias name `DirKind` should be renamed. - * - * Returns the user and platform specific directories. - * - * ```ts - * const homeDirectory = Deno.dir("home"); - * ``` - * - * Requires `allow-env` permission. - * - * Returns `null` if there is no applicable directory or if any other error - * occurs. - * - * Argument values: `"home"`, `"cache"`, `"config"`, `"executable"`, `"data"`, - * `"data_local"`, `"audio"`, `"desktop"`, `"document"`, `"download"`, - * `"font"`, `"picture"`, `"public"`, `"template"`, `"tmp"`, `"video"` - * - * `"home"` - * - * |Platform | Value | Example | - * | ------- | -----------------------------------------| -----------------------| - * | Linux | `$HOME` | /home/alice | - * | macOS | `$HOME` | /Users/alice | - * | Windows | `{FOLDERID_Profile}` | C:\Users\Alice | - * - * `"cache"` - * - * |Platform | Value | Example | - * | ------- | ----------------------------------- | ---------------------------- | - * | Linux | `$XDG_CACHE_HOME` or `$HOME`/.cache | /home/alice/.cache | - * | macOS | `$HOME`/Library/Caches | /Users/Alice/Library/Caches | - * | Windows | `{FOLDERID_LocalAppData}` | C:\Users\Alice\AppData\Local | - * - * `"config"` - * - * |Platform | Value | Example | - * | ------- | ------------------------------------- | -------------------------------- | - * | Linux | `$XDG_CONFIG_HOME` or `$HOME`/.config | /home/alice/.config | - * | macOS | `$HOME`/Library/Preferences | /Users/Alice/Library/Preferences | - * | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming | - * - * `"executable"` - * - * |Platform | Value | Example | - * | ------- | --------------------------------------------------------------- | -----------------------| - * | Linux | `XDG_BIN_HOME` or `$XDG_DATA_HOME`/../bin or `$HOME`/.local/bin | /home/alice/.local/bin | - * | macOS | - | - | - * | Windows | - | - | - * - * `"data"` - * - * |Platform | Value | Example | - * | ------- | ---------------------------------------- | ---------------------------------------- | - * | Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/alice/.local/share | - * | macOS | `$HOME`/Library/Application Support | /Users/Alice/Library/Application Support | - * | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming | - * - * `"data_local"` - * - * |Platform | Value | Example | - * | ------- | ---------------------------------------- | ---------------------------------------- | - * | Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/alice/.local/share | - * | macOS | `$HOME`/Library/Application Support | /Users/Alice/Library/Application Support | - * | Windows | `{FOLDERID_LocalAppData}` | C:\Users\Alice\AppData\Local | - * - * `"audio"` - * - * |Platform | Value | Example | - * | ------- | ------------------ | -------------------- | - * | Linux | `XDG_MUSIC_DIR` | /home/alice/Music | - * | macOS | `$HOME`/Music | /Users/Alice/Music | - * | Windows | `{FOLDERID_Music}` | C:\Users\Alice\Music | - * - * `"desktop"` - * - * |Platform | Value | Example | - * | ------- | -------------------- | ---------------------- | - * | Linux | `XDG_DESKTOP_DIR` | /home/alice/Desktop | - * | macOS | `$HOME`/Desktop | /Users/Alice/Desktop | - * | Windows | `{FOLDERID_Desktop}` | C:\Users\Alice\Desktop | - * - * `"document"` - * - * |Platform | Value | Example | - * | ------- | ---------------------- | ------------------------ | - * | Linux | `XDG_DOCUMENTS_DIR` | /home/alice/Documents | - * | macOS | `$HOME`/Documents | /Users/Alice/Documents | - * | Windows | `{FOLDERID_Documents}` | C:\Users\Alice\Documents | - * - * `"download"` - * - * |Platform | Value | Example | - * | ------- | ---------------------- | ------------------------ | - * | Linux | `XDG_DOWNLOAD_DIR` | /home/alice/Downloads | - * | macOS | `$HOME`/Downloads | /Users/Alice/Downloads | - * | Windows | `{FOLDERID_Downloads}` | C:\Users\Alice\Downloads | - * - * `"font"` - * - * |Platform | Value | Example | - * | ------- | ---------------------------------------------------- | ------------------------------ | - * | Linux | `$XDG_DATA_HOME`/fonts or `$HOME`/.local/share/fonts | /home/alice/.local/share/fonts | - * | macOS | `$HOME/Library/Fonts` | /Users/Alice/Library/Fonts | - * | Windows | – | – | - * - * `"picture"` - * - * |Platform | Value | Example | - * | ------- | --------------------- | ----------------------- | - * | Linux | `XDG_PICTURES_DIR` | /home/alice/Pictures | - * | macOS | `$HOME`/Pictures | /Users/Alice/Pictures | - * | Windows | `{FOLDERID_Pictures}` | C:\Users\Alice\Pictures | - * - * `"public"` - * - * |Platform | Value | Example | - * | ------- | --------------------- | ------------------- | - * | Linux | `XDG_PUBLICSHARE_DIR` | /home/alice/Public | - * | macOS | `$HOME`/Public | /Users/Alice/Public | - * | Windows | `{FOLDERID_Public}` | C:\Users\Public | - * - * `"template"` - * - * |Platform | Value | Example | - * | ------- | ---------------------- | ---------------------------------------------------------- | - * | Linux | `XDG_TEMPLATES_DIR` | /home/alice/Templates | - * | macOS | – | – | - * | Windows | `{FOLDERID_Templates}` | C:\Users\Alice\AppData\Roaming\Microsoft\Windows\Templates | - * - * `"tmp"` - * - * |Platform | Value | Example | - * | ------- | ---------------------- | ---------------------------------------------------------- | - * | Linux | `TMPDIR` | /tmp | - * | macOS | `TMPDIR` | /tmp | - * | Windows | `{TMP}` | C:\Users\Alice\AppData\Local\Temp | - * - * `"video"` - * - * |Platform | Value | Example | - * | ------- | ------------------- | --------------------- | - * | Linux | `XDG_VIDEOS_DIR` | /home/alice/Videos | - * | macOS | `$HOME`/Movies | /Users/Alice/Movies | - * | Windows | `{FOLDERID_Videos}` | C:\Users\Alice\Videos | - * - */ - export function dir(kind: DirKind): string | null; - /** **Unstable** There are questions around which permission this needs. And * maybe should be renamed (loadAverage?) * diff --git a/cli/js/ops/os.ts b/cli/js/ops/os.ts index e63d8b358..696c9f10b 100644 --- a/cli/js/ops/os.ts +++ b/cli/js/ops/os.ts @@ -1,6 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { sendSync } from "./dispatch_json.ts"; -import { errors } from "../errors.ts"; export function loadavg(): number[] { return sendSync("op_loadavg"); @@ -40,35 +39,6 @@ export const env = { delete: deleteEnv, }; -type DirKind = - | "home" - | "cache" - | "config" - | "executable" - | "data" - | "data_local" - | "audio" - | "desktop" - | "document" - | "download" - | "font" - | "picture" - | "public" - | "template" - | "tmp" - | "video"; - -export function dir(kind: DirKind): string | null { - try { - return sendSync("op_get_dir", { kind }); - } catch (error) { - if (error instanceof errors.PermissionDenied) { - throw error; - } - return null; - } -} - export function execPath(): string { return sendSync("op_exec_path"); } |