summaryrefslogtreecommitdiff
path: root/runtime/js
AgeCommit message (Collapse)Author
2024-11-18feat(runtime): remove public OTEL trace API (#26854)Luca Casonato
This PR removes the public Deno.tracing.Span API. We are not confident we can ship an API that is better than the `@opentelemetry/api` API, because V8 CPED does not support us using `using` to manage span context. If this changes, we can revisit this decision. For now, users wanting custom spans can instrument their code using the `@opentelemetry/api` API and `@deno/otel`. This PR also speeds up the OTEL trace generation by a 30% by using Uint8Array instead of strings for the trace ID and span ID.
2024-11-16feat(jupyter): Add `Deno.jupyter.image` API (#26284)Bartek Iwańczuk
This commit adds `Deno.jupyter.image` API to display PNG and JPG images: ``` const data = Deno.readFileSync("./my-image.jpg"); Deno.jupyter.image(data); Deno.jupyter.image("./my-image.jpg"); ```
2024-11-14feat(cli): add `--unstable-node-globals` flag (#26617)Marvin Hagemeister
This PR adds a new `--unstable-node-globals` flag to expose Node globals by default. Fixes https://github.com/denoland/deno/issues/26611 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-14fix: otel resiliency (#26857)snek
Improving the breadth of collected data, and ensuring that the collected data is more likely to be successfully reported. - Use `log` crate in more places - Hook up `log` crate to otel - Switch to process-wide otel processors - Handle places that use `process::exit` Also adds a more robust testing framework, with a deterministic tracing setting. Refs: https://github.com/denoland/deno/issues/26852
2024-11-13feat: OpenTelemetry Tracing API and Exporting (#26710)snek
Initial import of OTEL code supporting tracing. Metrics soon to come. Implements APIs for https://jsr.io/@deno/otel so that code using OpenTelemetry.js just works tm. There is still a lot of work to do with configuration and adding built-in tracing to core APIs, which will come in followup PRs. --------- Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-08fix: performance.timeOrigin (#26787)snek
`performance.timeOrigin` was being set from when JS started executing, but `op_now` measures from an `std::time::Instant` stored in `OpState`, which is created at a completely different time. This caused `performance.timeOrigin` to be very incorrect. This PR corrects the origin and also cleans up some of the timer code. Compared to `Date.now()`, `performance`'s time origin is now consistently within 5us (0.005ms) of system time. ![image](https://github.com/user-attachments/assets/0a7be04a-4f6d-4816-bd25-38a2e6136926)
2024-11-04chore: update dlint to v0.68.0 for internal (#26711)Kenta Moriuchi
2024-10-23fix: share inotify fd across watchers (#26200)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/26104 Fixes https://github.com/denoland/deno/issues/26071 Fixes https://github.com/denoland/deno/issues/17757
2024-10-10fix(unstable/worker): ensure import permissions are passed (#26101)David Sherret
We only had integration tests for this and not an integration test. Closes #26074
2024-10-04fix(node): fix worker_threads issues blocking Angular support (#26024)Nathan Whitaker
Fixes #22995. Fixes #23000. There were a handful of bugs here causing the hang (each with a corresponding minimized test): - We were canceling recv futures when `receiveMessageOnPort` was called, but this caused the "receive loop" in the message port to exit. This was due to the fact that `CancelHandle`s are never reset (i.e., once you `cancel` a `CancelHandle`, it remains cancelled). That meant that after `receieveMessageOnPort` was called, the subsequent calls to `op_message_port_recv_message` would throw `Interrupted` exceptions, and we would exit the loop. The cancellation, however, isn't actually necessary. `op_message_port_recv_message` only borrows the underlying port for long enough to poll the receiver, so the borrow there could never overlap with `op_message_port_recv_message_sync`. - Calling `MessagePort.unref()` caused the "receive loop" in the message port to exit. This was because we were setting `messageEventListenerCount` to 0 on unref. Not only does that break the counter when multiple `MessagePort`s are present in the same thread, but we also exited the "receive loop" whenever the listener count was 0. I assume this was to prevent the recv promise from keeping the event loop open. Instead of this, I chose to just unref the recv promise as needed to control the event loop. - The last bug causing the hang (which was a doozy to debug) ended up being an unfortunate interaction between how we implement our messageport "receive loop" and a pattern found in `npm:piscina` (which angular uses). The gist of it is that piscina uses an atomic wait loop along with `receiveMessageOnPort` in its worker threads, and as the worker is getting started, the following incredibly convoluted series of events occurs: 1. Parent sends a MessagePort `p` to worker 2. Parent sends a message `m` to the port `p` 3. Parent notifies the worker with `Atomics.notify` that a new message is available 4. Worker receives message, adds "message" listener to port `p` 5. Adding the listener triggers `MessagePort.start()` on `p` 6. Receive loop in MessagePort.start receives the message `m`, but then hits an await point and yields (before dispatching the "message" event) 7. Worker continues execution, starts the atomic wait loop, and immediately receives the existing notification from the parent that a message is available 8. Worker attempts to receive the new message `m` with `receiveMessageOnPort`, but this returns `undefined` because the receive loop already took the message in 6 9. Atomic wait loop continues to next iteration, waiting for the next message with `Atomic.wait` 10. `Atomic.wait` blocks the worker thread, which prevents the receive loop from continuing and dispatching the "message" event for the received message 11. The parent waits for the worker to respond to the first message, and waits 12. The thread can't make any more progress, and the whole process hangs The fix I've chosen here (which I don't particularly love, but it works) is to just delay the `MessagePort.start` call until the end of the event loop turn, so that the atomic wait loop receives the message first. This prevents the hang. --- Those were the main issues causing the hang. There ended up being a few other small bugs as well, namely `exit` being emitted multiple times, and not patching up the message port when it's received by `receiveMessageOnPort`.
2024-09-27fix(node): Pass NPM_PROCESS_STATE to subprocesses via temp file instead of ↵Nathan Whitaker
env var (#25896) Fixes https://github.com/denoland/deno/issues/25401. Fixes https://github.com/denoland/deno/issues/25841. Fixes https://github.com/denoland/deno/issues/25891.
2024-09-26chore: cleanup unused deprecated code (#25839)Asher Gomez
2024-09-24fix: better error for Deno.UnsafeWindowSurface, correct HttpClient name, ↵Leo Kettmeir
cleanup unused code (#25833)
2024-09-23feat: make 'globalThis.location' a configurable property (#25812)Bartek Iwańczuk
This commit changes `globalThis.location` property to be configurable so that packages wanting to override it (or delete it) work properly. Towards https://github.com/denoland/deno/issues/23882 This change makes reproduction from https://github.com/denoland/deno/issues/23882#issuecomment-2340783437 pass properly.
2024-09-16chore: remove `warnOnDeprecatedApi()` (#25673)Asher Gomez
2024-09-16chore: lint `40_fs_events.js` (#25672)Asher Gomez
Fixes CI https://github.com/denoland/deno/actions/runs/10892648144/job/30225971485
2024-09-17chore(fs): undeprecate `Deno.FsWatcher.prototype.return()` (#25623)Asher Gomez
2024-09-16chore: cleanup remaining `internals.future` code (#25624)Asher Gomez
2024-09-14feat: print `Listening on` messages on stderr instead of stdout (#25491)Marvin Hagemeister
Fixes https://github.com/denoland/deno/issues/25114 --------- Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: crowlkats <crowlkats@toaxl.com> Co-authored-by: Nathan Whitaker <17734409+nathanwhit@users.noreply.github.com>
2024-09-13refactor(runtime): align error messages (#25563)Ian Bull
Aligns the error messages in the runtime folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269
2024-09-12fix(ext/node): Implement detached option in `child_process` (#25218)Nathan Whitaker
Fixes https://github.com/denoland/deno/issues/25193.
2024-09-12refactor: cleanup unstable checks for WebGPU, FFI and FS APIs (#25586)Asher Gomez
Continuation of work in #25488. --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-12feat: stabilize `Deno.createHttpClient()` (#25569)Asher Gomez
Closes #25518
2024-09-10BREAKING(temporal/unstable): Remove obsoleted Temporal APIs part 2 (#25505)Kenta Moriuchi
Mainly I removed `Temporal.Calendar` and `Temporal.TimeZone` and replaced them to APIs that handle calendar and timezone as strings. https://github.com/tc39/proposal-temporal/pull/2925 Related #24836
2024-09-11BREAKING(fs): remove `Deno.FsFile.prototype.rid` (#25499)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-10feat(cli): use NotCapable error for permission errors (#25431)Luca Casonato
Closes #7394 --------- Co-authored-by: snek <snek@deno.com>
2024-09-09BREAKING(fs): remove `Deno.fsync[Sync]()` (#25448)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-09BREAKING: Remove `--unstable` flag (#25522)Bartek Iwańczuk
This commit effectively removes the --unstable flag. It's still being parsed, but it only prints a warning that a granular flag should be used instead and doesn't actually enable any unstable feature. Closes https://github.com/denoland/deno/issues/25485 Closes https://github.com/denoland/deno/issues/23237
2024-09-09BREAKING(fs): remove `Deno.fdatasync[Sync]()` (#25520)Asher Gomez
2024-09-06fix(runtime): use more null proto objects again (#25040)Kenta Moriuchi
proceed with #23921 This PR is a preparation for https://github.com/denoland/deno_lint/pull/1307 --------- Signed-off-by: Kenta Moriuchi <moriken@kimamass.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-06BREAKING(buffer): remove `Deno.Buffer` (#25441)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-05BREAKING(fs): remove `Deno.funlock[Sync]()` (#25442)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-05BREAKING(fs): remove `Deno.seek[Sync]()` (#25449)Asher Gomez
Towards #22079
2024-09-05BREAKING(fs): remove `Deno.FsWatcher.prototype.rid` (#25444)Asher Gomez
Towards #22079
2024-09-05BREAKING(fs): remove `Deno.File` (#25447)Asher Gomez
Towards #22079
2024-09-05BREAKING(types): soft-remove `Deno.run()` (#25403)Asher Gomez
Towards #22079
2024-09-04test: run js_unit_tests with `--unstable-*` flags (#25394)Bartek Iwańczuk
2024-09-04chore: remove some dead code around DENO_FUTURE env var (#25418)Bartek Iwańczuk
These codepaths were not used anymore.
2024-09-04BREAKING(io): remove `Deno.read[Sync]()` (#25409)Asher Gomez
Towards #22079 Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04feat(cli): give access to `process` global everywhere (#25291)Luca Casonato
2024-09-04BREAKING(io): remove `Deno.write[Sync]()` (#25408)Asher Gomez
Towards #22079 Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04BEAKING(buffer): remove `Deno.readAll[Sync]()` (#25386)Asher Gomez
Towards #22079 Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04BREAKING(fs): remove `Deno.ftruncate[Sync]()` (#25412)Asher Gomez
Towards #22079 Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-04chore(tty): soft-remove `Deno.isatty()` (#25410)Asher Gomez
Towards #22079
2024-09-04BREAKING(buffer): remove `Deno.writeAll[Sync]()` (#25407)Asher Gomez
2024-09-04BREAKING(fs): remove `Deno.fstat[Sync]()` (#25351)Asher Gomez
Towards #22079 Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-03BREAKING(io): remove `Deno.copy()` (#25345)Asher Gomez
Towards #22079 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-09-03BREAKING(permissions): remove --allow-hrtime (#25367)Luca Casonato
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because it is already possible to get access to high resolution timers through workers and SharedArrayBuffer. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-09-03BREAKING(console): remove `Deno.customInspect` (#25348)Asher Gomez
Note: this is implemented on Deploy. However, according to @magurotuna, a thin compatibility layer might be in the works that'd prevent breakages for PRs such as this one. Towards #22079
2024-09-03BREAKING(unstable): drop support for Deno.run.{clearEnv,gid,uid} (#25371)Bartek Iwańczuk
These are unstable options and the APIs is now deprecated. To limit amount of unstable flags we elected to have these APIs removed.