diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2019-02-13 02:08:56 +1100 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-02-12 10:08:56 -0500 |
commit | a21a5ad2fa4dcbad58fe63c298c69f8607705bf4 (patch) | |
tree | 03e0092f46813ffdf84f53ab58f71b8a0276207e /js/stat.ts | |
parent | 1e5e091cb074896c7550b1b6f802582f12629048 (diff) |
Add Deno global namespace (#1748)
Resolves #1705
This PR adds the Deno APIs as a global namespace named `Deno`. For backwards
compatibility, the ability to `import * from "deno"` is preserved. I have tried
to convert every test and internal code the references the module to use the
namespace instead, but because I didn't break compatibility I am not sure.
On the REPL, `deno` no longer exists, replaced only with `Deno` to align with
the regular runtime.
The runtime type library includes both the namespace and module. This means it
duplicates the whole type information. When we remove the functionality from the
runtime, it will be a one line change to the library generator to remove the
module definition from the type library.
I marked a `TODO` in a couple places where to remove the `"deno"` module, but
there are additional places I know I didn't mark.
Diffstat (limited to 'js/stat.ts')
-rw-r--r-- | js/stat.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/js/stat.ts b/js/stat.ts index d734115e6..4d04ea221 100644 --- a/js/stat.ts +++ b/js/stat.ts @@ -8,8 +8,7 @@ import { FileInfo, FileInfoImpl } from "./file_info"; /** Queries the file system for information on the path provided. If the given * path is a symlink information about the symlink will be returned. * - * import { lstat } from "deno"; - * const fileInfo = await lstat("hello.txt"); + * const fileInfo = await Deno.lstat("hello.txt"); * assert(fileInfo.isFile()); */ export async function lstat(filename: string): Promise<FileInfo> { @@ -20,8 +19,7 @@ export async function lstat(filename: string): Promise<FileInfo> { * If the given path is a symlink information about the symlink will be * returned. * - * import { lstatSync } from "deno"; - * const fileInfo = lstatSync("hello.txt"); + * const fileInfo = Deno.lstatSync("hello.txt"); * assert(fileInfo.isFile()); */ export function lstatSync(filename: string): FileInfo { @@ -31,8 +29,7 @@ export function lstatSync(filename: string): FileInfo { /** Queries the file system for information on the path provided. `stat` Will * always follow symlinks. * - * import { stat } from "deno"; - * const fileInfo = await stat("hello.txt"); + * const fileInfo = await Deno.stat("hello.txt"); * assert(fileInfo.isFile()); */ export async function stat(filename: string): Promise<FileInfo> { @@ -42,8 +39,7 @@ export async function stat(filename: string): Promise<FileInfo> { /** Queries the file system for information on the path provided synchronously. * `statSync` Will always follow symlinks. * - * import { statSync } from "deno"; - * const fileInfo = statSync("hello.txt"); + * const fileInfo = Deno.statSync("hello.txt"); * assert(fileInfo.isFile()); */ export function statSync(filename: string): FileInfo { |