1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

feat: Stabilize Deno.mainModule (#6993)

This commit is contained in:
Nayeem Rahman 2020-08-10 21:41:51 +01:00 committed by GitHub
parent 6fcf06306e
commit 52c1017a74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 14 deletions

View file

@ -2025,4 +2025,7 @@ declare namespace Deno {
* called when `Deno.inspect()` is called, or when the object is logged to
* the console. */
export const customInspect: unique symbol;
/** The URL of the entrypoint module entered from the command-line. */
export const mainModule: string;
}

View file

@ -1098,9 +1098,6 @@ declare namespace Deno {
*/
export function hostname(): string;
/** **UNSTABLE**: The URL of the file that was originally executed from the command-line. */
export const mainModule: string;
/** **UNSTABLE**: new API, yet to be vetted.
* Synchronously truncates or extends the specified file stream, to reach the
* specified `len`. If `len` is not specified then the entire file contents

View file

@ -53,7 +53,6 @@ fn op_main_module(
let main_path = std::env::current_dir().unwrap().join(main_url.to_string());
state.check_read_blind(&main_path, "main_module")?;
}
state.check_unstable("Deno.mainModule");
Ok(JsonOp::Sync(json!(&main)))
}

View file

@ -328,14 +328,10 @@ delete Object.prototype.__proto__;
ppid: util.readOnly(ppid),
noColor: util.readOnly(noColor),
args: util.readOnly(Object.freeze(args)),
mainModule: util.getterOnly(opMainModule),
});
if (unstableFlag) {
Object.defineProperty(
finalDenoNs,
"mainModule",
util.getterOnly(opMainModule),
);
Object.assign(finalDenoNs, denoNsUnstable);
}

View file

@ -1925,7 +1925,7 @@ itest!(import_meta {
});
itest!(main_module {
args: "run --quiet --unstable --allow-read --reload main_module.ts",
args: "run --quiet --allow-read --reload main_module.ts",
output: "main_module.ts.out",
});

View file

@ -101,7 +101,6 @@ delete Object.prototype.__proto__;
"PermissionStatus",
"hostname",
"ppid",
"mainModule",
"ftruncate",
"ftruncateSync",
"fdatasync",