summaryrefslogtreecommitdiff
path: root/cli
AgeCommit message (Collapse)Author
2022-10-20feat(cli): check for updates in background (#15974)Bert Belder
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-10-20feat(ext/ffi): Make op_ffi_ptr_of fast (#16297)Aapo Alasuutari
Makes `op_ffi_ptr_of` fast. One of the tests changed from printing `false` to `true` as the fast `&[u8]` slice path creates the slice with a null pointer. Thus the `op_ffi_ptr_of` will now return a null pointer value whereas previously it returned a dangling pointer value.
2022-10-20perf(ext/ffi): Fast UnsafePointerView read functions (#16351)Aapo Alasuutari
This PR makes pointer read methods of `Deno.UnsafePointerView` Fast API compliant, with the exception of `getCString` which cannot be made fast with current V8 Fast API.
2022-10-19feat: Add new lockfile format (#16349)Bartek Iwańczuk
Introduces a new lockfile format that will be used to support locking "npm" dependencies. Currently the format looks as follows: ``` // This file is automatically generated by Deno, do not edit its contents // manually. This file should be commited to your repository. { "version": "2", "remote": { "https://deno.land/std@0.160.0/http/server.ts": "asdwetsw44523asdfgfas..", "https://deno.land/std@0.160.0/http/file_server.ts": "asdwetsw44523asdfgfas.." } } ``` A follow up PR will add "npm" key that will be used to store information related to "npm" dependencies and their resolution. The new format is used when `--lock-write` is present, if user tries to load a lock file using the old format it will still work.
2022-10-18refactor: better errors in lockfile and preparation for new version (#16344)Bartek Iwańczuk
A small cleanup that improves errors in the lockfile as well as prepares for adding a new format of the lock file that will allow to provide backward compatibility with existing format (ie. "Lockfile::content" will be changed into an enum "LockfileContent" that will have "V1" and "V2" variants).
2022-10-18feat: introduce navigator.language (#12322)Luca Matei Pintilie
Link to the spec: https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language-dev Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18feat(task): remove warning about being unstable (#16281)Bartek Iwańczuk
`deno task` has been in use for a few months now. It was very well received and there are not many complaints. I feel like this warning might be discouraging for some users and we don't really plan to make drastic changes to it (besides adding support for globs in unspecified future).
2022-10-18feat(unstable/task): fail task on async command failure (#16301)David Sherret
Tests and implementation are found here: https://github.com/denoland/deno_task_shell/pull/59 This is a breaking change, but `deno task` is unstable. > This changes async commands so that on non-zero exit code they will fail the entire task. For example: > > ```jsonc > // task that asynchronously starts a server and starts a watcher for the frontend > "dev": "deno task server & deno task frontend:watch" > ``` > > Previously when running `deno task dev`, if `deno task server` failed, the entire command would not fail, which kept in line with `sh`, but it's not very practical. This change causes `deno task dev` to fail. > > To opt out, developers can add an `|| exit 0`: > > ```jsonc > "dev": "deno task server || exit 0 & deno task frontend:watch" > ```
2022-10-18test(crypto): update crypto.getRandomValues calls (#16338)Filip Skokan
[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) does not return a Promise.
2022-10-18fix: move generated napi symbols to cli/ (#16330)Bartek Iwańczuk
<!-- Before submitting a PR, please read http://deno.land/manual/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. -->
2022-10-18fix(ext/net): return an error from `startTls` and `serveHttp` if the ↵Yusuke Tanaka
original connection is captured elsewhere (#16242) This commit removes the calls to `expect()` on `std::rc::Rc`, which caused Deno to panic under certain situations. We now return an error if `Rc` is referenced by other variables. Fixes #9360 Fixes #13345 Fixes #13926 Fixes #16241 Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-17chore: upgrade internal deno_std to 0.160 (#16333)David Sherret
2022-10-17chore: forward v1.26.2 to main (#16331)Bartek Iwańczuk
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> <!-- Before submitting a PR, please read http://deno.land/manual/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. --> Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17perf(npm): parallelize caching of npm specifier package infos (#16323)David Sherret
2022-10-17bench: don't send data to grafana (#16324)Bartek Iwańczuk
ci / bench release ubuntu-20.04-xl (pull_request) went from 24m to 23m
2022-10-17bench: run HTTP benches for 10s (#16322)Bartek Iwańczuk
ci / bench release ubuntu-20.04-xl (pull_request) went from 27m to 24m
2022-10-17feat(unstable/npm): support providing npm dist-tag in npm package specifier ↵David Sherret
(#16293)
2022-10-17feat(unstable): add windowsRawArguments to SpawnOptions (#16319)Yoshiya Hinosawa
This change adds `windowsRawArguments` to `SpawnOptions`. The option enables skipping the default quoting and escaping while creating the command on windows. The option works in a similar way as `windowsVerbatimArguments` in child_process.spawn options in Node.js, and is necessary for simulating it in `std/node`. closes #8852
2022-10-17fix(lsp): treat empty import map value config as none (#16224)Tomofumi Chiba
Ref: denoland/vscode_deno#718 Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-17fix(build) fix linux symbols export list format (#16313)Luke Channings
Fixes the error reported in #16304. > = note: /usr/bin/ld:/home/abotella/Projects/deno/cli/generated_symbol_exports_list_linux.def:1: syntax error in dynamic list collect2: error: ld returned 1 exit status This was caused by the format of the symbols list on Linux being malformed (as the error implies). The format is documented in ld's [VERSION](https://sourceware.org/binutils/docs/ld/VERSION.html) as well as: > --export-dynamic-symbol-list=file Specify a --export-dynamic-symbol for each pattern in the file. The format of the file is the same as the version node without scope and node name. See VERSION for more information. Previously, the format for the Linux symbols list was simply a list of symbols, now it follows the format: ``` { symbol_name_a; ...; symbol_name_z }; ```
2022-10-16fix: add error cause in recursive cause tail (#16306)Cre3per
2022-10-16fix(ext/cache): illegal constructor (#16205)Marcos Casagrande
2022-10-16feat: support inlay hints (#16287)Kitson Kelly
Closes: #11853
2022-10-15feat(unstable/task): add `INIT_CWD` env var (#16110)David Sherret
2022-10-15refactor(build): better handle old glibc (#16238)Luke Channings
Follow-up to #16208. - Refactors build.rs behaviour to use `-exported_symbols_list` / `--export-dynamic-symbol-list` - Since all build systems now rely on a symbols list file, I have added `generate_exported_symbols_list`, which derives the symbol list file depending on the platform, which makes `tools/napi/generate_link_win.js` redundant. - Fixes a missed instance of `i8` being used instead of `c_char` Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-10-15bench: don't show output (#16288)Bartek Iwańczuk
Benchmarks are extremely noisy and it makes it impossible to inspect what's going on in GitHub action logger.
2022-10-15fix(ext/ffi): Fix UnsafeCallback ref'ing making Deno enter a live-loop (#16216)Aapo Alasuutari
Fixes #15136 Currently `UnsafeCallback` class' `ref()` and `unref()` methods rely on the `event_loop_middleware` implementation in core. If even a single `UnsafeCallback` is ref'ed, then the FFI event loop middleware will always return `true` to signify that there may still be more work for the event loop to do. The middleware handling in core does not wait a moment to check again, but will instead synchronously directly re-poll the event loop and middlewares for more work. This becomes a live-loop. This PR introduces a `Future` implementation for the `CallbackInfo` struct that acts as the intermediary data storage between an `UnsafeCallback` and the `libffi` C callback. Ref'ing a callback now means calling an async op that binds to the `CallbackInfo` Future and only resolves once the callback is unref'ed. The `libffi` C callback will call the waker of this Future when it fires to make sure that the main thread wakes up to receive the callback.
2022-10-15bench: avoid port collision (#16285)Bartek Iwańczuk
2022-10-15fix(ext/crypto): correct HMAC get key length op (#16201)Filip Skokan
fixes #16180 `HMAC`'s `get key length` `op` uses the hash function's block size, not output size. refs https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
2022-10-14fix(lsp): properly handle snippets on completions (#16274)Kitson Kelly
Fixes #15367
2022-10-13fix(cli): allow importMap to be an absolute URL within the deno config file ↵Mark Gibson
(#16234)
2022-10-13chore: Added onbeforeunload to window type definition (#16251)Matt Ezell
2022-10-12fix(cli): skip removing the latter part if `@` appears at the beginning (#16244)Yusuke Tanaka
This commit prevents panics that `deno compile` command ran into under certain conditions from occurring. Such conditions are as follows. - the target file name begins with `@`, OR - the stem part of the target file name is equal to one of ["main", "index", "mod", "index"] && the parent directory name starts with `@` Fixes #16243
2022-10-10fix(ext/fetch): fix illegal header regex (#16236)Marcos Casagrande
This PR fixes invalid header parsing which is flaky because `g` flag is being used in the regex, which keeps track of `lastIndex` ```javascript try { new Headers([["x", "\u0000x"]]); // error } catch(e) {} new Headers([["x", "\u0000x"]]); // no error ``` This issue affects `Response` & `Request` constructors as well
2022-10-10fix sparse array inspection (#16204)sigmaSd
fix https://github.com/denoland/deno/issues/16202
2022-10-10fix(npm): support compiling on linux/aarch64 (#16208)Luke Channings
Changes introduced in #13633 have broken the ability to compile for linux/aarch64 - specifically the use of a `i8` as a char type, which is an `u8` on linux/aarch64. This PR: - Replaces instances of `i8` with the architecture-aware wrapper type `c_char` - Skips the use of `--export-dynamic-symbol` on linux-aarch64, because the target environments often rely on older libc/binutils versions
2022-10-09feat(core): improve resource read & write traits (#16115)Luca Casonato
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-09perf(ext/crypto): optimize `getRandomValues` (#16212)Divy Srivastava
2022-10-08chore(napi_sym): fix readme path (#16203)李瑞丰
2022-10-07perf(napi): optimize primitive napi functions (#16163)Divy Srivastava
This optimization applies on `napi_get_undefined`, `napi_get_null` & `napi_get_boolean`. ``` # main benchmark time (avg) (min … max) p75 p99 p995 ---------------------------------------------------------- ----------------------------- warmup 482.55 ps/iter (462.5 ps … 15.67 ns) 475 ps 525 ps 829.1 ps napi_get_undefined 25.07 ns/iter (24.03 ns … 36.87 ns) 25.37 ns 27.09 ns 34.85 ns ``` ``` # This patch benchmark time (avg) (min … max) p75 p99 p995 ---------------------------------------------------------- ----------------------------- warmup 484.78 ps/iter (462.5 ps … 14.4 ns) 475 ps 554.1 ps 583.3 ps napi_get_undefined 15.52 ns/iter (15.35 ns … 22.14 ns) 15.41 ns 17.18 ns 20.02 ns ```
2022-10-07chore(napi): Add README explainer for cli/napi_sym and cli/napi (#16187)Divy Srivastava
2022-10-07fix(napi): move napi symbols file (#16179)Colin Ihrig
The current location was causing failures during v1.26.1 publication. <!-- Before submitting a PR, please read http://deno.land/manual/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. -->
2022-10-07refactor(napi): simplify `napi_value` interface (#16170)Divy Srivastava
2022-10-06chore: forward v1.26.1 release commit to main (#16178)denobot
This is the release commit being forwarded back to main for 1.26.1 Please ensure: - [x] Everything looks ok in the PR - [x] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.26.1 && git checkout -b forward_v1.26.1 upstream/forward_v1.26.1 ``` Don't need this PR? Close it. cc @cjihrig Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06fix(build): don't export all symbols to dynamic symbol table (#16171)Divy Srivastava
Currently, we use `-rdynamic` for exporting Node API symbols to the symbol table. `-rdynamic` will export *all* symbols, that means previously unused functions will not be optimized away introducing a lot of binary bloat. This patch uses `-exported_symbol` and `--export-dynamic-symbol` link flags (not as universal as `-rdynamic`) to only mark Node API symbols to be put in the dynamic symbol table.
2022-10-05fix(node): add dns/promises and stream/consumers (#16169)David Sherret
2022-10-05feat(npm): implement Node API (#13633)Divy Srivastava
This PR implements the NAPI for loading native modules into Deno. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com> Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05fix(ext/cache): prevent cache insert if body is not fully written (#16138)Marcos Casagrande
2022-10-05fix(ext/flash): Avoid sending Content-Length when status code is 204 (#15901)ayame113
Currently Content-Length is sent when the status code is 204. However, according to the spec, this should not be sent. Modify the if statement below to prevent the Content-Length from being sent.
2022-10-04refactor: remove old Node compat code (#16142)Bartek Iwańczuk
This code was introduced in 808f797633ba82c0e9198481ddd742284a03cb9c and was needed for "compat mode". Since "compat mode" was removed in v1.26, this code is no longer needed.