summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-05-28fix: empty `process.platform` with `__runtime_js_sources` (#24005)Marvin Hagemeister
We use the `target` property of the snapshot options to derive `process.platform` and `process.arch` from. This value had an incorrect format when compiled with `__runtime_js_sources` enabled. This PR fixes that so that `process.platform` holds the proper value. Fixes https://github.com/denoland/deno/issues/23164
2024-05-28fix(ext/node): add `throwIfNoEntry` option in `fs.lstatSync` (#24006)Marvin Hagemeister
We didn't support the `throwIfNoEntry` option for Node's `fs.lstatSync` method. Note that the async variant doesn't have this option. Fixes https://github.com/denoland/deno/issues/23996
2024-05-28BREAKING(ffi/unstable): always return u64 as bigint (#23981)Divy Srivastava
The mixed `number | bigint` representation was useful optimization for pointers. Now, pointers are represented as V8 externals. As part of the FFI stabilization effort we want to make `bigint` the only representation for `u64` and `i64`. BigInt representation performance is almost on par with mixed representation with the added benefit that its less confusing and users don't need manual checks and conversions for doing operations on the value. ``` cpu: AMD Ryzen 5 7530U with Radeon Graphics runtime: deno 1.43.6+92a8d09 (x86_64-unknown-linux-gnu) file:///home/divy/gh/ffi/main.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 -------------------------------------------------------------------------- ----------------------------- nop 4.01 ns/iter 249,533,690.5 (3.97 ns … 10.8 ns) 3.97 ns 4.36 ns 9.03 ns ret bigint 7.74 ns/iter 129,127,186.8 (7.72 ns … 10.46 ns) 7.72 ns 8.11 ns 8.82 ns ret i32 7.81 ns/iter 128,087,100.5 (7.77 ns … 12.72 ns) 7.78 ns 8.57 ns 9.75 ns ret bigint (add op) 15.02 ns/iter 66,588,253.2 (14.64 ns … 24.99 ns) 14.76 ns 19.13 ns 19.44 ns ret i32 (add op) 12.02 ns/iter 83,209,131.8 (11.95 ns … 18.18 ns) 11.98 ns 13.11 ns 14.5 ns ```
2024-05-28fix(coverage): handle ignore patterns (#23974)Yoshiya Hinosawa
closes #23972
2024-05-28fix(publish): raise diagnostics for triple-slash directives for `--dry-run` ↵David Sherret
instead of just `publish` (#23811)
2024-05-28chore: update WPT (#23997)Asher Gomez
Fixes [current failure](https://github.com/denoland/deno/actions/runs/9247491137/job/25436409566)
2024-05-27FUTURE(ext/fs): stabilize file system APIs (#23968)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/23906 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-28fix(ext/fs): truncate files when a ReadableStream is passed to writeFile ↵charlotte ✨
(#23330) Closes #19697. This fixes a bug where the writeFile API can create partially-overwritten files which may lead to invalid / corrupt files or data leakage. It also aligns the behavior of writing a ReadableStream and writing a Uint8Array to the disk.
2024-05-27fix(ext/web): `ReadableStream.from()` allows `Iterable` instead of ↵Milly
`IterableIterator` (#23903) `createAsyncFromSyncIterator(x)` which is used in `ReadableStream.from()` expects `x` as `Iterable` but, previous implements specify `Iterator` or `IterableIterator`. If it was `IterableIterator`, it would work, but if it was `Iterator`, an exception will occur. Tests have been merged into WPT. https://github.com/web-platform-tests/wpt/pull/46365 --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-27fix: `--env` flag confusing message on syntax error (#23915)Hasan-Alrimawi
Enhanced warning message for --env flag with run and eval subcommands. The commit is specifically made to address issue #23674 by improving the warning messages that appear when using the --env flag with run or eval subcommands in the following scenarios: 1. Missing environment file. 2. Incorrect syntax in the environment file content. **Changes made** - Distinguishes between cases of missing environment file and wrong syntax in the environment file content. - Shows a concise warning message to convey the case/issue occurred. **Code changes & enhancements** - Implemented a match statement to handle different types of errors received while getting and parsing the file content to display a concise warning message, rather than simple error check and then displaying the same warning message for whatever the type of error is. - Updated the related existing tests to reflect the new warning messages. - Added two test cases to cover the wrong environment file content syntax with both run and eval subcommands. **Impact** The use of --env flag with both run/eval would be more user-friendly as it gives a precise description of what is not right when using incorrectly. If you could give it a look, @dsherret , I appreciate your feedback on these changes. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-26fix(node): set default http server response code 200 (#23977)Marvin Hagemeister
Node sets the default HTTP response status code to 200 on the `ServerResponse`. We initialised it as `undefined` before which caused a problem with 11ty's dev server. Thanks to @vrugtehagel for reporting this issue and finding the correct fix as well 🎉 Fixes https://github.com/denoland/deno/issues/23970
2024-05-26fix(ext/websocket): change default idleTimeout to 30s (#23985)Alex Gleason
Change the default server websocket `idleTimeout` to 30s to work with common Nginx setups which have a default timeout of 60 seconds
2024-05-26fix(coverage): add tooltip to line count in html report (#23971)Yoshiya Hinosawa
closes #21582
2024-05-26chore(cli): remove extract_standalone path from CLI (#23982)Divy Srivastava
No longer needed as standalone binaries use `denort`
2024-05-24fix: use hash of in-memory bytes only for code cache (#23966)David Sherret
* https://github.com/denoland/deno_core/pull/752 * https://github.com/denoland/deno_core/pull/753 Did benchmarking on this and it's slightly faster (couple ms) or equal to in performance as main. Closes #23904
2024-05-23fix(npm): set up node_modules/.bin/ entries for package that provide bin ↵Bartek Iwańczuk
entrypoints (#23496) Closes https://github.com/denoland/deno/issues/23036 --------- Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-23FUTURE: initial support for .npmrc file (#23560)Bartek Iwańczuk
This commit adds initial support for ".npmrc" files. Currently we only discover ".npmrc" files next to "package.json" files and discovering these files in user home dir is left for a follow up. This pass supports "_authToken" and "_auth" configuration for providing authentication. LSP support has been left for a follow up PR. Towards https://github.com/denoland/deno/issues/16105
2024-05-23fix(cli): Support deno.lock with only package.json present + fix DENO_FUTURE ↵Nathan Whitaker
install interactions with lockfile (#23918) Fixes #23571. Previously, we required a `deno.json` to be present (or the `--lock` flag) in order for us to resolve a `deno.lock` file. This meant that if you were using deno in an npm-first project deno wouldn't use a lockfile. Additionally, while I was fixing that, I discovered there were a couple bugs keeping the future `install` command from using a lockfile. With this PR, `install` will actually resolve the lockfile (or create one if not present), and update it if it's not up-to-date. This also speeds up `deno install`, as we can use the lockfile to skip work during npm resolution.
2024-05-23feat(ext/webgpu): byow support for {Free,Open}BSD (#23832)Volker Schlecht
Both ports for the BSDs include patches to the same effect.
2024-05-23fix(ext/node): return cancelled flag in get_response_body_chunk op (#23962)Satya Rohith
The flag lets us exit from read loop without throwing an error when the stream is cancelled. This fixes gRPC cancellation example. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23refactor(lsp): determine file referrer for each document (#23867)Nayeem Rahman
2024-05-23feat(task): run `npm run` commands with Deno more often (#23794)David Sherret
Closes #23036
2024-05-23chore: update denokv_* crates (#23949)Bartek Iwańczuk
Co-authored-by: losfair <zhy20000919@hotmail.com>
2024-05-23fix(ext/node): add stubs for perf_hooks.PerformaceObserver (#23958)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/23943
2024-05-23refactor: remove custom `utc_now` in favor of `chrono::Utc:now` feature ↵Felipe Baltor
(#23888) This PR removes the use of the custom `utc_now` function in favor of the `chrono` implementation. It resolves #22864. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23fix(ext/web): `ReadableStream.from()` ignores null `Symbol.asyncIterator` ↵Milly
(#23910) If `@@asyncIterator` is `null` or `undefined`, it should ignores and fallback to `@@iterator`. Tests have been merged into WPT. https://github.com/web-platform-tests/wpt/pull/46374 The proposal of `ReadableStream.from` uses TC39 [GetIterator][] and [GetMethod][] within it. GetMethod treats null as undefined. So if `@@asyncIterator` is `null` it should be ignored and fallback to `@@iterator`. [GetIterator]: https://tc39.es/ecma262/#sec-getiterator [GetMethod]: https://tc39.es/ecma262/#sec-getmethod ```bash > deno eval "ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream())" error: Uncaught (in promise) TypeError: obj[SymbolAsyncIterator] is not a function ReadableStream.from({ [Symbol.asyncIterator]: null, [Symbol.iterator]: () => ({ next: () => ({ done: true }) }) }).pipeTo(new WritableStream()) ^ at getIterator (ext:deno_web/06_streams.js:5105:38) at Function.from (ext:deno_web/06_streams.js:5207:22) at file:///D:/work/js/deno/tests/wpt/suite/$deno$eval:1:16 ``` --------- Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-23perf(startup): use WAL journal for sqlite databases in DENO_DIR (#23955)Bert Belder
While investigating poor cold start performance on my GCP VM (32 cores, 130GB SSD), I found that writing to the various sqlite databases in DENO_DIR was quite slow. The slowness seems to primarily be caused by excessive latency from a number of `fsync()` calls. The performance difference is best demonstrated by deleting the sqlite databases from DENO_DIR while leaving the downloaded sources in place. The benchmark (see notes below): ``` piscisaureus@bert-us:~/erofs/source$ export DENO_DIR=./.deno piscisaureus@bert-us:~/erofs/source$ hyperfine --warmup 3 \ --prepare "rm -rf .deno/*_v1*" \ "deno run -A --cached-only demo.ts" \ "eatmydata deno run -A --cached-only demo.ts" \ "~/deno/target/release/deno run -A --cached-only demo.ts" Benchmark 1: deno run -A --cached-only demo.ts Time (mean ± σ): 1.174 s ± 0.037 s [User: 0.153 s, System: 0.184 s] Range (min … max): 1.104 s … 1.212 s 10 runs Benchmark 2: eatmydata deno run -A --cached-only demo.ts Time (mean ± σ): 265.5 ms ± 3.6 ms [User: 138.5 ms, System: 135.1 ms] Range (min … max): 260.6 ms … 271.2 ms 11 runs Benchmark 3: ~/deno/target/release/deno run -A --cached-only demo.ts Time (mean ± σ): 226.2 ms ± 9.2 ms [User: 136.7 ms, System: 93.3 ms] Range (min … max): 218.8 ms … 247.1 ms 13 runs Summary ~/deno/target/release/deno run -A --cached-only demo.ts ran 1.17 ± 0.05 times faster than eatmydata deno run -A --cached-only demo.ts 5.19 ± 0.27 times faster than deno run -A --cached-only demo.ts ``` Notes: * Benchmark 1: unmodified Deno 1.43.6 * Benchmark 2: unmodified Deno 1.43.6 wrapped with `eatmydata` (which is a tool to neuter `fsync()` calls) * Benchmark 3: this PR applied on top of Deno 1.43.6 The script that got benchmarked: ```typescript // demo.ts import * as express from "npm:express@4.16.3"; import * as postgres from "https://deno.land/x/postgres/mod.ts"; let _dummy = [express, postgres]; // Force use of imports. console.log("hello world"); ```
2024-05-23feat: enable pointer compression via deno_core bump (#23838)Matt Mastracci
v8 12.6 w/pointer compression enabled. Closes https://github.com/denoland/deno/issues/18935
2024-05-23feat(cli/test): `deno test --clean` (#23519)Asher Gomez
The result of the call is ignored as it throws even when the directory does not exist. Closes #23491
2024-05-22chore: kill node.js tests if they run too long (#23956)Matt Mastracci
2024-05-23feat(ext/fetch): `Request.bytes()` and `Response.bytes()` (#23823)Asher Gomez
Closes #23790
2024-05-23feat: add lowercase `-v` version flag (#23750)David Sherret
Ref https://github.com/denoland/deno/issues/5289
2024-05-23feat(ext/fs): stabilize `Deno.FsFile.unlock[Sync]()` and ↵Asher Gomez
`Deno.FsFile.lock[Sync]()` (#23754) Related #22230 CC @dyedgreen
2024-05-22chore: update release doc template (#23934)Bartek Iwańczuk
Align to latest release process, add some more instructions.
2024-05-23fix(runtime): use more null proto objects (#23921)Luca Casonato
This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-22feat(ext/fs): stabilize `Deno.FsFile.syncData[Sync]()` and ↵Asher Gomez
`Deno.FsFile.sync[Sync]()` (#23733) Closes #22230
2024-05-22fix(lsp): process Fenced Code Block in JSDoc on `completion` correctly (#23822)Hajime-san
partially fixing https://github.com/denoland/deno/issues/23820 https://github.com/denoland/deno/assets/41257923/0adb5d4e-cfd5-4195-9045-19d1c0a07a43 BTW, it is out of scope on this PR that to process type of `@param` to be an code block due to it's a bit complicated.
2024-05-22chore: Fix failing `task_npx_non_existent` test (#23945)Nathan Whitaker
Currently `task::task_npx_non_existent` is consistently failing in CI ([example](https://github.com/denoland/deno/actions/runs/9192958846/job/25282900321#step:43:2772)) due to the output changing slightly ``` -- OUTPUT START -- Task non-existent npx this-command-should-not-exist-for-you npm ERR! code E404 npm ERR! 404 Not Found - GET http://localhost:4260/this-command-should-not-exist-for-you npm ERR! 404 npm ERR! 404 'this-command-should-not-exist-for-you@*' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url. npm ERR! A complete log of this run can be found in: /Users/runner/.npm/_logs/2024-05-22T17_58_42_473Z-debug-0.log -- OUTPUT END -- -- EXPECTED START -- Task non-existent npx this-command-should-not-exist-for-you npm error code E404 npm error 404 Not Found - GET http://localhost:4260/this-command-should-not-exist-for-you [WILDCARD] -- EXPECTED END -- ``` I'm not sure what changed in CI to cause this (and I can't repro it locally, even matching the version of npm and node on the github runners), but fix it with more lenient expected output for that test.
2024-05-22chore(repl): maybe improve repl test flakiness on the CI (#23933)David Sherret
These repl tests are still a bit flaky. Let's try this. https://github.com/denoland/deno/actions/runs/9176525869/job/25232001263
2024-05-22feat(cli): Add slow test warning (#23874)Matt Mastracci
By default, uses a 60 second timeout, backing off 2x each time (can be overridden using the hidden `DENO_SLOW_TEST_TIMEOUT` which we implement only really for spec testing. ``` Deno.test(async function test() { await new Promise(r => setTimeout(r, 130_000)); }); ``` ``` $ target/debug/deno test /tmp/test_slow.ts Check file:///tmp/test_slow.ts running 1 test from ../../../../../../tmp/test_slow.ts test ...'test' is running very slowly (1m0s) 'test' is running very slowly (2m0s) ok (2m10s) ok | 1 passed | 0 failed (2m10s) ``` --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-22refactor(docs): use `@experimental` instead of `@tags unstable` (#23884)Leo Kettmeir
2024-05-22chore: forward v1.43.6 release commit to main (#23936)Bartek Iwańczuk
Bumped versions for 1.43.6 Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-21feat(node): buffer isUtf8/isAscii (#23928)snek
Fixes: https://github.com/denoland/deno/issues/23657 Implements `isUtf8` and `isAscii` as ops.
2024-05-21fix(lsp): Fix display of JSDoc named examples (#23927)Nathan Whitaker
We were wrapping the display string in an unnecessary pair of triple backticks, breaking highlighting Before: ![Screenshot 2024-05-21 at 12 16 12 PM](https://github.com/denoland/deno/assets/17734409/1cf5a3ce-56dd-443d-9d1a-bd33625ff1f2) After: ![Screenshot 2024-05-21 at 12 16 36 PM](https://github.com/denoland/deno/assets/17734409/646c4c48-9b5a-4326-bb95-b1374627d969)
2024-05-21refactor(jupyter): use runtimelib for Jupyter structures and directory paths ↵Kyle Kelley
(#23826) This brings in [`runtimelib`](https://github.com/runtimed/runtimed) to use: ## Fully typed structs for Jupyter Messages ```rust let msg = connection.read().await?; self .send_iopub( runtimelib::Status::busy().as_child_of(msg), ) .await?; ``` ## Jupyter paths Jupyter paths are implemented in Rust, allowing the Deno kernel to be installed completely via Deno without a requirement on Python or Jupyter. Deno users will be able to install and use the kernel with just VS Code or other editors that support Jupyter. ```rust pub fn status() -> Result<(), AnyError> { let user_data_dir = user_data_dir()?; let kernel_spec_dir_path = user_data_dir.join("kernels").join("deno"); let kernel_spec_path = kernel_spec_dir_path.join("kernel.json"); if kernel_spec_path.exists() { log::info!("✅ Deno kernel already installed"); Ok(()) } else { log::warn!("ℹ️ Deno kernel is not yet installed, run `deno jupyter --install` to set it up"); Ok(()) } } ``` Closes https://github.com/denoland/deno/issues/21619
2024-05-21fix(lsp): apply import fix to missing declaration code action (#23924)Nayeem Rahman
2024-05-21chore: add test to ensure parsing only happens once on first load (#23837)David Sherret
2024-05-21fix(task): do not error if node_modules folder not exists (#23920)David Sherret
Revealed https://github.com/denoland/deno/issues/23919 Closes #23914
2024-05-21fix(ext/web): fix potential leak of unread buffers (#23923)Matt Mastracci
Because the buffers are `MaybeUninit<V8Slice<u8>`, and the owner of the `BoundedBufferChannel` is not obligated to read each and every bit of data, we may find that some buffers were not automatically dropped if unread by the time the `BoundedBufferChannelInner` is dropped. Possible repro: ``` Deno.serve(() => new Response(new ReadableStream({ start(controller) { controller.enqueue(new Uint8Array(100_000_000)) } }))); ``` ```bash while true; do curl localhost:8000 | dd count=1; done ```
2024-05-21fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902)Nayeem Rahman