diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index f551ea361e..5cb0f432b4 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -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; } diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index a7203f778c..8a3e872dfa 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -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 @@ -1217,7 +1214,7 @@ declare namespace Deno { /** **UNSTABLE**: New API, yet to be vetted. * A custom HttpClient for use with `fetch`. - * + * * ```ts * const client = new Deno.createHttpClient({ caFile: "./ca.pem" }); * const req = await fetch("https://myserver.com", { client }); @@ -1233,7 +1230,7 @@ declare namespace Deno { */ interface CreateHttpClientOptions { /** A certificate authority to use when validating TLS certificates. - * + * * Requires `allow-read` permission. */ caFile?: string; @@ -1241,7 +1238,7 @@ declare namespace Deno { /** **UNSTABLE**: New API, yet to be vetted. * Create a custom HttpClient for to use with `fetch`. - * + * * ```ts * const client = new Deno.createHttpClient({ caFile: "./ca.pem" }); * const req = await fetch("https://myserver.com", { client }); diff --git a/cli/ops/runtime.rs b/cli/ops/runtime.rs index 1e426ad8ae..55f0d9f576 100644 --- a/cli/ops/runtime.rs +++ b/cli/ops/runtime.rs @@ -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))) } diff --git a/cli/rt/99_main.js b/cli/rt/99_main.js index 873e422915..a28eef8061 100644 --- a/cli/rt/99_main.js +++ b/cli/rt/99_main.js @@ -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); } diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index c4544669ff..e8e8828ccc 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -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", }); diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 23e25237a1..f3dde7b1fd 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -101,7 +101,6 @@ delete Object.prototype.__proto__; "PermissionStatus", "hostname", "ppid", - "mainModule", "ftruncate", "ftruncateSync", "fdatasync",