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:
parent
6fcf06306e
commit
52c1017a74
6 changed files with 8 additions and 14 deletions
3
cli/dts/lib.deno.ns.d.ts
vendored
3
cli/dts/lib.deno.ns.d.ts
vendored
|
@ -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;
|
||||
}
|
||||
|
|
3
cli/dts/lib.deno.unstable.d.ts
vendored
3
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -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
|
||||
|
|
|
@ -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)))
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
});
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ delete Object.prototype.__proto__;
|
|||
"PermissionStatus",
|
||||
"hostname",
|
||||
"ppid",
|
||||
"mainModule",
|
||||
"ftruncate",
|
||||
"ftruncateSync",
|
||||
"fdatasync",
|
||||
|
|
Loading…
Reference in a new issue