summaryrefslogtreecommitdiff
path: root/cli/js
AgeCommit message (Collapse)Author
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-09-04refactor(cli/js): align error messages (#25406)Ian Bull
Aligns the error messages in the cli/js folder to be in-line with the Deno style guide.
2024-07-04feat(jupyter): support `confirm` and `prompt` in notebooks (#23592)Zander Hill
Closes: https://github.com/denoland/deno/issues/22633 This commit adds support for `confirm` and `prompt` APIs, that instead of reading from stdin are using notebook frontend to show modal boxes and wait for answers. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29feat: Add `Deno.exitCode` API (#23609)Luke Edwards
This commits adds the ability to set a would-be exit code for the Deno process without forcing an immediate exit, through the new `Deno.exitCode` API. - **Implements `Deno.exitCode` getter and setter**: Adds support for setting and retrieving a would-be exit code via `Deno.exitCode`. This allows for asynchronous cleanup before process termination without immediately exiting. - **Ensures type safety**: The setter for `Deno.exitCode` validates that the provided value is a number, throwing a TypeError if not, to ensure that only valid exit codes are set. Closes to #23605 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
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-04-10chore: update references to `deno_std` to use JSR (#23239)Asher Gomez
There are more uses of `deno.land/std` in the codebase, but for URL parsing purposes rather than network calls or documentation.
2024-03-24fix: don't panic in test and bench if ops not available (#23055)Bartek Iwańczuk
Fixes regression introduced in https://github.com/denoland/deno/pull/22112 that removed checks if `Deno.test` or `Deno.bench` are not used in respective subcommands. Closes https://github.com/denoland/deno/issues/23041
2024-03-24refactor(bench): align ops to testing ops (#23038)Bartek Iwańczuk
Internal refactor that changes how we use ops in `deno bench` subcommand. This brings it in line to what we do in `deno test` subcommand.
2024-03-21chore: upgrade deno_core to 0.272.0 (#23022)Bartek Iwańczuk
2024-02-27perf(cli): reduce overhead in test registration (#22552)Matt Mastracci
- Removes the origin call, since all origins are the same for an isolate (ie: the main module) - Collects the `TestDescription`s and sends them all at the same time inside of an Arc, allowing us to (later on) re-use these instead of cloning. Needs a follow-up pass to remove all the cloning, but that's a thread that is pretty long to pull --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-02-16refactor(cli): move op sanitizer to Rust (#22413)Matt Mastracci
The format of the sanitizers will change a little bit: - If multiple async ops leak and traces are on, we repeat the async op header once per stack trace. - All leaks are aggregated under a "Leaks detected:" banner as the new timers are eventually going to be added, and these are neither ops nor resources. - `1 async op` is now `An async op` - If ops and resources leak, we show both (rather than op leaks masking resources) Follow-on to https://github.com/denoland/deno/pull/22226
2024-02-13chore: deno_core bump (#22407)Matt Mastracci
- Adding `None` flag for warmup script. - Modify opcall trace interface to match new Rust implementation
2024-02-07chore: upgrade deno_core to 0.259.0 (#22311)Bartek Iwańczuk
This update brings number of ops available to user code down to 45.
2024-02-06refactor: don't expose some ops (#22281)Bartek Iwańczuk
This commit brings down the number of ops exposed to user code to 51.
2024-02-05refactor(cli): Move op descriptions into Rust and prepare for op import (#22271)Matt Mastracci
This moves the op sanitizer descriptions into Rust code and prepares for eventual op import from `ext:core/ops`. We cannot import these ops from `ext:core/ops` as the testing infrastructure ops are not always present. Changes: - Op descriptions live in `cli` code and are currently accessible via an op for the older sanitizer code - `phf` dep moved to workspace root so we can use it here - `ops.op_XXX` changed to to `op_XXX` to prepare for op imports later on.
2024-02-05Reland refactor(cli): use new sanitizer for resources (#22226)Matt Mastracci
Originally in #22125 Reverted in #22153 because of #22148 Fixed in deno_core https://github.com/denoland/deno_core/pull/538 Test plan: 1. Check out: https://github.com/poolifier/poolifier-deno.git 2. `PATH=.../deno/target/release/:$PATH deno task test` 3. `ok | 13 passed (188 steps) | 0 failed (18s)`
2024-01-27Revert "refactor(cli): use new sanitizer for resources (#22125)" (#22153)Bartek Iwańczuk
2024-01-26refactor(cli): use new sanitizer for resources (#22125)Matt Mastracci
Step 1 of the Rustification of sanitizers, which unblocks the faster timers. This replaces the resource sanitizer with a Rust one, using the new APIs in deno_core.
2024-01-26fix(testing): add op_spawn_wait mapping in resource sanitizer (#22129)Luca Casonato
2024-01-25chore(cli): split 40_testing (#22112)Matt Mastracci
No code changes -- just splitting 40_testing into three files and removing a couple of unused lines of code.
2024-01-24feat: `FsFile.sync()` and `FsFile.syncSync()` (#22017)Asher Gomez
This change: 1. Implements `Deno.FsFile.sync()` and `Deno.FsFile.syncSync()`. 2. Deprecates `Deno.fsync()` and `Deno.fsyncSync()` for removal in Deno v2, in favour of the above corresponding methods. Related #21995 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-24feat: `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()` (#22019)Asher Gomez
This change: 1. Implements `Deno.FsFile.dataSync()` and `Deno.FsFile.dataSyncSync()`. 2. Deprecates `Deno.fdatasync()` and `Deno.fdatasyncSync()` for removal in Deno v2, in favour of the above corresponding methods. 3. Replaces use of `Deno.fdatasync()` and `Deno.fdatasyncSync()` with the above instance methods. Related #21995
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-04fix: strict type check for cross realms (#21669)Kenta Moriuchi
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when using `Object.prototype.isPrototypeOf` to check built-in types. ```js import vm from "node:vm"; const err = new Error(); const crossErr = vm.runInNewContext(`new Error()`); console.assert( !(crossErr instanceof Error) ); console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) ); ``` This PR changes to check using internal slots solves them. --- current: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error {} > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) Date {} ``` this PR: ``` > import vm from "node:vm"; undefined > vm.runInNewContext(`new Error("message")`) Error: message at <anonymous>:1:1 > vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`) 2018-12-10T02:26:59.002Z ``` --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-09feat: bring back WebGPU (#20812)Leo Kettmeir
Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Kenta Moriuchi <moriken@kimamass.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08chore: use primordials in 40_testing.js (#21422)Divy Srivastava
This commit brings back usage of primordials in "40_testing.js" by turning it back into an ES module and using new "lazy loading" functionality of ES modules coming from "deno_core". The same approach was applied to "40_jupyter.js". Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-02refactor: snapshotting of runtime/ and cli/ (#21430)Bartek Iwańczuk
This commit removes some of the technical debt related to snapshotting JS code: - "cli/ops/mod.rs" and "cli/build.rs" no longer define "cli" extension which was not required anymore - Cargo features for "deno_runtime" crate have been unified in "cli/Cargo.toml" - "cli/build.rs" uses "deno_runtime::snapshot::create_runtime_snapshot" API instead of copy-pasting the code - "cli/js/99_main.js" was completely removed as it's not necessary anymore Towards https://github.com/denoland/deno/issues/21137
2023-11-25perf: move "cli/js/40_testing.js" out of main snapshot (#21212)Divy Srivastava
Closes https://github.com/denoland/deno/issues/21136 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-14perf: move jupyter esm out of main snapshot (#21163)Divy Srivastava
Towards https://github.com/denoland/deno/issues/21136
2023-11-10chore: use internal namespace in 40_testing.js (#21141)Divy Srivastava
Towards #21136 - [x] assign serializePermissions, setTimeout and setExitHandler APIs to internal namespace - [x] remove usage of assert
2023-11-10chore: remove primordial usage from 40_testing.js (#21140)Divy Srivastava
Towards #21136
2023-10-12feat(unstable): add Deno.jupyter.display API (#20819)Kyle Kelley
This brings in [`display`](https://github.com/rgbkrk/display.js) as part of the `Deno.jupyter` namespace. Additionally these APIs were added: - "Deno.jupyter.md" - "Deno.jupyter.html" - "Deno.jupyter.svg" - "Deno.jupyter.format" These APIs greatly extend capabilities of rendering output in Jupyter notebooks. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-10fix(bench): use total time when measuring wavg (#20862)Nayeem Rahman
2023-10-04refactor: rewrite websocket to use op2 macro (#20140)Divy Srivastava
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-04feat(jupyter): send binary data with `Deno.jupyter.broadcast` (#20755)Trevor Manz
Adds `buffers` to the `Deno.jupyter.broadcast` API to send binary data via comms. This affords the ability to send binary data via websockets to the jupyter widget frontend.
2023-09-30feat(jupyter): send Jupyter messaging metadata with `Deno.jupyter.broadcast` ↵Trevor Manz
(#20714) Exposes [`metadata`](https://jupyter-client.readthedocs.io/en/latest/messaging.html#metadata) to the `Deno.jupyter.broadcast` API. ```js await Deno.jupyter.broadcast(msgType, content, metadata); ``` The metadata is required for [`"comm_open"`](https://github.com/jupyter-widgets/ipywidgets/blob/main/packages/schema/messages.md#instantiating-a-widget-object-1) for with `jupyter.widget` target.
2023-09-28fix(jupyter): more robust Deno.jupyter namespace (#20710)Bartek Iwańczuk
2023-09-27feat(unstable): add `Deno.jupyter.broadcast` API (#20656)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20591 --------- Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-26perf(test): use fast ops for deno test register (#20670)Luca Casonato
Use fast ops for test registration. This speeds up `Deno.test` and `t.step()` significantly (2x over Deno 1.37.0).
2023-09-26perf(test): use core.currentUserCallSite (#20669)Luca Casonato
Speeds up `Deno.test` calls by a bit.
2023-09-19perf: make `deno test` 10x faster (#20550)Luca Casonato
2023-09-16perf: improve async op santizer speed and accuracy (#20501)Luca Casonato
This commit improves async op sanitizer speed by only delaying metrics collection if there are pending ops. This results in a speedup of around 30% for small CPU bound unit tests. It performs this check and possible delay on every collection now, fixing an issue with parent test leaks into steps.
2023-09-14fix: output traces for op sanitizer in more cases (#20494)Luca Casonato
This adds traces for the "started outside test, closed inside test" case.
2023-09-10chore: speed up test name escapeing (#20439)Marvin Hagemeister
2023-09-06feat(test): Add Deno.test.ignore and Deno.test.only (#20365)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/17106
2023-08-26fix(bench): explicit timers don't force high precision measurements (#20272)Nayeem Rahman
Disables `BenchContext::start()` and `BenchContext::end()` for low precision benchmarks (less than 0.01s per iteration). Prints a warning when they are used in such benchmarks, suggesting to remove them. ```ts Deno.bench("noop", { group: "noops" }, () => {}); Deno.bench("noop with start/end", { group: "noops" }, (b) => { b.start(); b.end(); }); ``` Before: ``` cpu: 12th Gen Intel(R) Core(TM) i9-12900K runtime: deno 1.36.2 (x86_64-unknown-linux-gnu) file:///home/nayeem/projects/deno/temp3.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------- ----------------------------- noop 2.63 ns/iter 380,674,131.4 (2.45 ns … 27.78 ns) 2.55 ns 4.03 ns 5.33 ns noop with start and end 302.47 ns/iter 3,306,146.0 (200 ns … 151.2 µs) 300 ns 400 ns 400 ns summary noop 115.14x faster than noop with start and end ``` After: ``` cpu: 12th Gen Intel(R) Core(TM) i9-12900K runtime: deno 1.36.1 (x86_64-unknown-linux-gnu) file:///home/nayeem/projects/deno/temp3.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------- ----------------------------- noop 3.01 ns/iter 332,565,561.7 (2.73 ns … 29.54 ns) 2.93 ns 5.29 ns 7.45 ns noop with start and end 7.73 ns/iter 129,291,091.5 (6.61 ns … 46.76 ns) 7.87 ns 13.12 ns 15.32 ns Warning start() and end() calls in "noop with start and end" are ignored because it averages less than 0.01s per iteration. Remove them for better results. summary noop 2.57x faster than noop with start and end ```
2023-08-10fix(test): handle ASCII escape chars in test name (#20081)Bartek Iwańczuk
Handles ASCCI espace chars in test and bench name making test and bench reporting more reliable. This one is also tested in the fixture of "node:test" module.
2023-08-04fix(test): make test runner work when global setTimeout is replaced (#20052)Yoshiya Hinosawa
2023-08-04fix(test): use only a single timeout for op sanitizers (#20042)Bartek Iwańczuk
Chipping away at making tests faster. Appears we don't need double timeout before sanitizing ops. This should cut baseline cost of running a test by half.