Skip to content

Commit

Permalink
chore: upgrade deno_core (#22725)
Browse files Browse the repository at this point in the history
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
  • Loading branch information
nathanwhit authored Mar 6, 2024
1 parent 6b48aff commit 9df917c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repository = "https://github.com/denoland/deno"

[workspace.dependencies]
deno_ast = { version = "0.34.1", features = ["transpiling"] }
deno_core = { version = "0.267.0" }
deno_core = { version = "0.268.0" }

deno_bench_util = { version = "0.134.0", path = "./bench_util" }
deno_lockfile = "0.19.0"
Expand Down
3 changes: 1 addition & 2 deletions ext/fs/30_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import {
op_fs_utime_sync,
op_fs_write_file_async,
op_fs_write_file_sync,
op_is_terminal,
op_set_raw,
} from "ext:core/ops";
const {
Expand Down Expand Up @@ -769,7 +768,7 @@ class FsFile {
}

isTerminal() {
return op_is_terminal(this.#rid);
return core.isTerminal(this.#rid);
}

setRaw(mode, options = {}) {
Expand Down
8 changes: 4 additions & 4 deletions ext/io/12_io.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Thank you! We love Go! <3

import { core, internals, primordials } from "ext:core/mod.js";
import { op_is_terminal, op_set_raw } from "ext:core/ops";
import { op_set_raw } from "ext:core/ops";
const {
Uint8Array,
ArrayPrototypePush,
Expand Down Expand Up @@ -222,7 +222,7 @@ class Stdin {
}

isTerminal() {
return op_is_terminal(this.#rid);
return core.isTerminal(this.#rid);
}
}

Expand Down Expand Up @@ -262,7 +262,7 @@ class Stdout {
}

isTerminal() {
return op_is_terminal(this.#rid);
return core.isTerminal(this.#rid);
}
}

Expand Down Expand Up @@ -302,7 +302,7 @@ class Stderr {
}

isTerminal() {
return op_is_terminal(this.#rid);
return core.isTerminal(this.#rid);
}
}

Expand Down
8 changes: 5 additions & 3 deletions ext/node/polyfills/tty.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

import { primordials } from "ext:core/mod.js";
import { core, primordials } from "ext:core/mod.js";
const {
Error,
} = primordials;
import { op_is_terminal } from "ext:core/ops";
const {
isTerminal,
} = core;

import { ERR_INVALID_FD } from "ext:deno_node/internal/errors.ts";
import { LibuvStreamWrap } from "ext:deno_node/internal_binding/stream_wrap.ts";
Expand All @@ -23,7 +25,7 @@ function isatty(fd) {
* correspond to `fd` 0, 1, 2 (stdin, stdout, stderr). This may change in
* the future.
*/
return op_is_terminal(fd);
return isTerminal(fd);
} catch (_) {
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions runtime/js/40_tty.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { internals, primordials } from "ext:core/mod.js";
import { op_console_size, op_is_terminal } from "ext:core/ops";
import { core, internals, primordials } from "ext:core/mod.js";
import { op_console_size } from "ext:core/ops";
const {
Uint32Array,
} = primordials;
const {
isTerminal,
} = core;

const size = new Uint32Array(2);

Expand All @@ -18,7 +21,7 @@ function isatty(rid) {
new Error().stack,
"Use `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()`, `Deno.stderr.isTerminal()` or `Deno.FsFile.isTerminal()` instead.",
);
return op_is_terminal(rid);
return isTerminal(rid);
}

export { consoleSize, isatty };
13 changes: 1 addition & 12 deletions runtime/ops/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@ use winapi::um::wincon;

deno_core::extension!(
deno_tty,
ops = [
op_set_raw,
op_is_terminal,
op_console_size,
op_read_line_prompt
],
ops = [op_set_raw, op_console_size, op_read_line_prompt],
state = |state| {
#[cfg(unix)]
state.put(TtyModeStore::default());
Expand Down Expand Up @@ -209,12 +204,6 @@ fn op_set_raw(
}
}

#[op2(fast)]
fn op_is_terminal(state: &mut OpState, rid: u32) -> Result<bool, AnyError> {
let handle = state.resource_table.get_handle(rid)?;
Ok(handle.is_terminal())
}

#[op2(fast)]
fn op_console_size(
state: &mut OpState,
Expand Down

0 comments on commit 9df917c

Please sign in to comment.