1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 00:21:05 -05:00

Improve API docs for Deno.bundle and Deno.chdir (#4426)

This commit is contained in:
Chris Knight 2020-03-18 23:40:06 +00:00 committed by GitHub
parent 6e2df8c64f
commit 2a34cbfaf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -355,11 +355,18 @@ declare namespace Deno {
export function cwd(): string; export function cwd(): string;
/** /**
* **UNSTABLE**: maybe needs permissions. * **UNSTABLE**: Currently under evaluation to decide if explicit permission is
* required to change the current working directory.
* *
* Change the current working directory to the specified path. * Change the current working directory to the specified path.
* *
* Throws `Deno.errors.NotFound` if directory not available. * Deno.chdir("/home/userA");
* Deno.chdir("../userB");
* Deno.chdir("C:\\Program Files (x86)\\Java");
*
* Throws `Deno.errors.NotFound` if directory not found.
* Throws `Deno.errors.PermissionDenied` if the user does not have access
* rights
*/ */
export function chdir(directory: string): void; export function chdir(directory: string): void;
@ -2340,16 +2347,21 @@ declare namespace Deno {
): Promise<[DiagnosticItem[] | undefined, Record<string, string>]>; ): Promise<[DiagnosticItem[] | undefined, Record<string, string>]>;
/** **UNSTABLE**: new API, yet to be vetted. /** **UNSTABLE**: new API, yet to be vetted.
*
* `bundle()` is part the compiler API. A full description of this functionality
* can be found in the [manual](https://deno.land/std/manual.md#denobundle).
* *
* Takes a root module name, and optionally a record set of sources. Resolves * Takes a root module name, and optionally a record set of sources. Resolves
* with a single JavaScript string that is like the output of a `deno bundle` * with a single JavaScript string (and bundle diagnostics if issues arise with
* command. If just a root name is provided, the modules will be resolved as if * the bundling) that is like the output of a `deno bundle` command. If just
* the root module had been passed on the command line. * a root name is provided, the modules will be resolved as if the root module
* had been passed on the command line.
* *
* If sources are passed, all modules will be resolved out of this object, where * If sources are passed, all modules will be resolved out of this object, where
* the key is the module name and the value is the content. The extension of the * the key is the module name and the value is the content. The extension of the
* module name will be used to determine the media type of the module. * module name will be used to determine the media type of the module.
* *
* //equivalent to "deno bundle foo.ts" from the command line
* const [ maybeDiagnostics1, output1 ] = await Deno.bundle("foo.ts"); * const [ maybeDiagnostics1, output1 ] = await Deno.bundle("foo.ts");
* *
* const [ maybeDiagnostics2, output2 ] = await Deno.bundle("/foo.ts", { * const [ maybeDiagnostics2, output2 ] = await Deno.bundle("/foo.ts", {