mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
BREAKING: make Deno.hostname unstable (#5108)
This commit is contained in:
parent
eb505f8afc
commit
b8364a2636
5 changed files with 11 additions and 10 deletions
|
@ -59,7 +59,7 @@ export {
|
|||
export { metrics, Metrics } from "./ops/runtime.ts";
|
||||
export { mkdirSync, mkdir, MkdirOptions } from "./ops/fs/mkdir.ts";
|
||||
export { connect, listen, Listener, Conn } from "./net.ts";
|
||||
export { dir, env, exit, execPath, hostname } from "./ops/os.ts";
|
||||
export { dir, env, exit, execPath } from "./ops/os.ts";
|
||||
export { run, RunOptions, Process, ProcessStatus } from "./process.ts";
|
||||
export { DirEntry, readDirSync, readDir } from "./ops/fs/read_dir.ts";
|
||||
export { readFileSync, readFile } from "./read_file.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 } from "./ops/os.ts";
|
||||
export { dir, 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";
|
||||
|
|
8
cli/js/lib.deno.ns.d.ts
vendored
8
cli/js/lib.deno.ns.d.ts
vendored
|
@ -97,14 +97,6 @@ declare namespace Deno {
|
|||
* */
|
||||
export function test(name: string, fn: () => void | Promise<void>): void;
|
||||
|
||||
/** Get the `hostname` of the machine the Deno process is running on.
|
||||
*
|
||||
* console.log(Deno.hostname());
|
||||
*
|
||||
* Requires `allow-env` permission.
|
||||
*/
|
||||
export function hostname(): string;
|
||||
|
||||
/** Exit the Deno process with optional exit code. If no exit code is supplied
|
||||
* then Deno will exit with return code of 0.
|
||||
*
|
||||
|
|
8
cli/js/lib.deno.unstable.d.ts
vendored
8
cli/js/lib.deno.unstable.d.ts
vendored
|
@ -1174,4 +1174,12 @@ declare namespace Deno {
|
|||
state: PermissionState;
|
||||
constructor(state: PermissionState);
|
||||
}
|
||||
|
||||
/** Get the `hostname` of the machine the Deno process is running on.
|
||||
*
|
||||
* console.log(Deno.hostname());
|
||||
*
|
||||
* Requires `allow-env` permission.
|
||||
*/
|
||||
export function hostname(): string;
|
||||
}
|
||||
|
|
|
@ -173,6 +173,7 @@ fn op_hostname(
|
|||
_args: Value,
|
||||
_zero_copy: Option<ZeroCopyBuf>,
|
||||
) -> Result<JsonOp, OpError> {
|
||||
state.check_unstable("Deno.hostname");
|
||||
state.check_env()?;
|
||||
let hostname = sys_info::hostname().unwrap_or_else(|_| "".to_string());
|
||||
Ok(JsonOp::Sync(json!(hostname)))
|
||||
|
|
Loading…
Reference in a new issue