1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-31 03:29:10 -05:00
denoland-deno/cli
Luca Casonato 3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
..
args refactor(cli): use shared sys kind parser in flags.rs (#16087) 2022-09-29 19:34:16 +09:00
bench perf(ext/crypto): optimize getRandomValues (#16212) 2022-10-09 15:38:38 +05:30
cache perf: node cjs & esm analysis cache (#16097) 2022-10-01 12:15:56 +02:00
dts docs(fs): add default info of OpenOptions (#16104) 2022-10-03 17:22:40 +02:00
lsp lsp: use deno:/asset instead of deno:asset (#16023) 2022-10-01 20:02:25 +02:00
napi perf(napi): optimize primitive napi functions (#16163) 2022-10-07 16:24:01 +05:30
napi_sym chore(napi_sym): fix readme path (#16203) 2022-10-08 19:32:34 +05:30
node fix(node): add dns/promises and stream/consumers (#16169) 2022-10-05 19:33:52 -04:00
npm fix(npm): better error is version is specified after subpath (#16131) 2022-10-03 19:10:53 +02:00
ops feat(npm): functionality to support child_process.fork (#15891) 2022-09-28 13:04:16 -04:00
schemas chore(cli): update config file schema to include test config (#15246) 2022-07-19 15:10:41 -04:00
tests feat(core): improve resource read & write traits (#16115) 2022-10-09 14:49:25 +00:00
tools feat(lint): add --compact flag for terse output (#15926) 2022-09-28 18:47:48 +02:00
tsc feat(cli): update to TypeScript 4.8 (#15064) 2022-09-20 07:00:01 +10:00
auth_tokens.rs chore: update copyright to 2022 (#13306) 2022-01-07 22:09:52 -05:00
build.rs fix(napi): move napi symbols file (#16179) 2022-10-07 09:21:43 +05:30
Cargo.toml chore: forward v1.26.1 release commit to main (#16178) 2022-10-06 16:49:40 -04:00
cdp.rs docs: turn bare URLs into clickable links (#15347) 2022-07-30 12:20:29 +02:00
checksum.rs chore: update copyright to 2022 (#13306) 2022-01-07 22:09:52 -05:00
deno.ico fix(cli): add icon and metadata to deno.exe on Windows (#6693) 2020-07-15 21:54:38 +02:00
deno_dir.rs perf: node cjs & esm analysis cache (#16097) 2022-10-01 12:15:56 +02:00
deno_std.rs chore: forward v1.26.1 release commit to main (#16178) 2022-10-06 16:49:40 -04:00
diagnostics.rs feat: Stabilize Deno.hostname() API (#15932) 2022-09-28 15:36:06 +02:00
diff.rs refactor: update comment in diff.rs (#15142) 2022-07-10 22:49:18 -04:00
display.rs test(cli): add test cases (#16091) 2022-09-30 14:02:44 -04:00
emit.rs refactor: extract out check code from emit (#15729) 2022-09-02 10:54:40 -04:00
errors.rs chore: remove all pub(crate)s from the cli crate (#14083) 2022-03-23 09:54:22 -04:00
exports.def feat(npm): implement Node API (#13633) 2022-10-05 19:36:44 +05:30
file_fetcher.rs feat(npm): add support for --reload=npm: and --reload=npm:<package> (#15972) 2022-09-22 10:39:58 -04:00
file_watcher.rs upgrade deps (#15914) 2022-09-16 19:11:30 -04:00
fs_util.rs feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
graph_util.rs fix(npm): panic on invalid package name (#16123) 2022-10-03 17:45:01 +02:00
http_cache.rs chore(tests): use custom temp dir creation for the tests (#14153) 2022-04-01 11:15:37 -04:00
http_util.rs refactor: move out test files from root testdata directory into sub directories (#15949) 2022-09-19 10:32:21 -04:00
lockfile.rs chore(tests): use custom temp dir creation for the tests (#14153) 2022-04-01 11:15:37 -04:00
logger.rs chore: remove all pub(crate)s from the cli crate (#14083) 2022-03-23 09:54:22 -04:00
main.rs feat(npm): implement Node API (#13633) 2022-10-05 19:36:44 +05:30
module_loader.rs perf: node cjs & esm analysis cache (#16097) 2022-10-01 12:15:56 +02:00
proc_state.rs refactor: remove old Node compat code (#16142) 2022-10-04 17:53:23 +02:00
progress_bar.rs chore: use Rust 1.64.0 (#16035) 2022-09-26 21:52:16 +02:00
README.md Remove deno_typescript (#6813) 2020-07-20 19:49:57 -04:00
resolver.rs fix: resolve jsxImportSource relative to module (#15561) 2022-08-24 19:36:05 +02:00
standalone.rs feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
text_encoding.rs feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
tsc.rs feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
unix_util.rs build: require safety comments on unsafe code (#13870) 2022-06-26 00:13:24 +02:00
version.rs chore: update copyright to 2022 (#13306) 2022-01-07 22:09:52 -05:00
windows_util.rs chore: fix Windows specific clippy errors (#15212) 2022-07-15 12:30:25 -04:00
worker.rs feat(npm): functionality to support child_process.fork (#15891) 2022-09-28 13:04:16 -04:00

Deno CLI Crate

crates docs

This provides the actual deno executable and the user-facing APIs.

The deno crate uses the deno_core to provide the executable.