Bartek Iwańczuk
dfc254cd57
fix: define window.name ( #20804 )
...
Closes https://github.com/denoland/deno/issues/20750
This matches what browsers do:
https://developer.mozilla.org/en-US/docs/Web/API/Window/name
In the future we might want to change the behavior to actually update
the process name, but that needs a bit of discussion regarding if
it needs a permission flag (that would make polyfiling `process.title`
setter really easy too).
2023-10-08 22:12:59 +00:00
Bartek Iwańczuk
d41d3b8e2f
refactor: migrate last tsc op to op2 macro ( #20816 )
2023-10-08 21:00:41 +02:00
Bartek Iwańczuk
8706a20d1f
bench: fix ops benchmarks ( #20830 )
...
https://github.com/denoland/deno/pull/20808 broke benchmarks, this
commit should fix it.
2023-10-08 18:43:14 +00:00
Matt Mastracci
6cb5d8eb86
fix(ext/ffi): use anybuffer for op_ffi_ptr_of ( #20820 )
...
Fixes #20817
2023-10-08 14:02:07 +09:00
Aapo Alasuutari
effb5e1ce4
fix(node/buffer): utf8ToBytes should return a Uint8Array ( #20769 )
2023-10-08 11:09:50 +09:00
Bartek Iwańczuk
edeccef499
refactor: migrate more ops to op2 macro ( #20808 )
...
Getting closer...
2023-10-07 21:04:03 +05:30
Jesper van den Ende
be7e2bd8c1
fix(cli): Support using both --watch
and --inspect
at the same time ( #20660 )
...
Fixes #20525
2023-10-06 23:33:14 +02:00
Trevor Manz
48bb3b2b0f
feat(unstable): Await return from Jupyter.display
( #20807 )
...
Allows `Jupyter.display` to return a promise.
Example:
```javascript
class WikiPage {
constructor(public name) {}
async [Symbol.for("Jupyter.display")]() {
let response = await fetch("https://en.wikipedia.org/wiki/ " + this.name);
return { "text/html": await response.text() }
}
}
new WikiPage("Deno_(software)")
```
2023-10-06 21:26:11 +00:00
Marcos Casagrande
ceecd8c495
perf(ext/web): optimize structuredClone without transferables ( #20730 )
...
This PR optimizes `structuredClone` when it's called without
transferables.
### Benchmarks
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------------- -----------------------------
structuredClone object 1.64 µs/iter 611,086.0 (1.58 µs … 1.84 µs) 1.66 µs 1.84 µs 1.84 µs
structuredClone transferables 2.82 µs/iter 354,281.4 (2.78 µs … 2.92 µs) 2.84 µs 2.92 µs 2.92 µs
```
**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
structuredClone object 1 µs/iter 998,383.5 (971.28 ns … 1.2 µs) 1 µs 1.2 µs 1.2 µs
structuredClone transferables 2.82 µs/iter 355,087.5 (2.7 µs … 3.07 µs) 2.83 µs 3.07 µs 3.07 µs
```
```js
Deno.bench("structuredClone object", () => {
structuredClone({ foo: "bar" });
});
Deno.bench("structuredClone transferables", () => {
const buf = new Uint8Array([97]);
structuredClone(buf, {
transfer: [buf.buffer],
});
});
```
2023-10-06 23:21:48 +02:00
Trevor Manz
cba5ae45c2
fix(jupyter): Rename logo assets so they are discoverable ( #20806 )
...
Changes logo prefix from `icon-*` to `logo-*` so they are correctly
discovered by Jupyter.
2023-10-06 22:31:12 +02:00
Nayeem Rahman
677a591e56
fix(lsp): percent-encode host in deno: specifiers ( #20811 )
2023-10-06 14:46:43 +01:00
Bartek Iwańczuk
f0608a5b91
refactor: migrate ext/node/ops to op2 ( #20805 )
2023-10-06 00:16:36 +02:00
Nayeem Rahman
ac464ead49
feat(jupyter): support Deno.test() ( #20778 )
2023-10-05 21:45:11 +01:00
David Sherret
820e93e3e7
refactor(npm): add referrer when resolving npm package sub path from deno module ( #20800 )
...
Adds a `referrer` parameter to this function instead of using a fake
one.
2023-10-05 20:18:29 +00:00
林炳权
7a01799f49
chore: update to Rust 1.73 ( #20781 )
2023-10-05 14:49:09 -04:00
Divy Srivastava
ab3c9d41e4
fix(ext/node): implement uv.errname ( #20785 )
...
Fixes https://github.com/denoland/deno/issues/20617
2023-10-05 18:27:20 +00:00
Marcos Casagrande
176bf9ba5f
fix(ext/formdata): support multiple headers in FormData ( #20801 )
...
Fixes https://github.com/denoland/deno/issues/20793
2023-10-05 19:28:44 +02:00
Matt Mastracci
1619932a65
chore(ext/ffi): migrate from op -> op2 for ffi ( #20509 )
...
Migrate to op2. Making a few decisions to get this across the line:
- Empty slices, no matter where the come from, are null pointers. The v8
bugs (https://bugs.chromium.org/p/v8/issues/detail?id=13489 ) and
(https://bugs.chromium.org/p/v8/issues/detail?id=13488 ) make passing
around zero-length slice pointers too dangerous as they might be
uninitialized or null data.
- Offsets and lengths are `#[number] isize` and `#[number] usize`
respectively -- 53 bits should be enough for anyone
- Pointers are bigints. This is a u64 in the fastcall world, and can
accept Integer/Int32/Number/BigInt v8 types in the slow world.
2023-10-05 15:35:21 +02:00
Bartek Iwańczuk
5d98a544b4
refactor: rewrite several extension ops to op2 ( #20457 )
...
Rewrites following extensions:
- `ext/web`
- `ext/url`
- `ext/webstorage`
- `ext/io`
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-05 14:34:38 +02:00
Nayeem Rahman
551a081450
refactor(test): support custom writer in PrettyTestReporter ( #20783 )
2023-10-05 11:25:15 +01:00
Asher Gomez
fd4fc2d818
docs: update alternative APIs for write()
, writeSync()
, read()
and readSync()
( #20792 )
...
Closes #20701
2023-10-05 10:44:37 +02:00
David Sherret
1ff525e25b
refactor(node): combine node resolution code for resolving a package subpath from external code ( #20791 )
...
We had two methods that did the same functionality.
2023-10-04 23:05:12 -04:00
Nayeem Rahman
64f9155126
fix(lsp): show diagnostics for type imports from untyped deps ( #20780 )
2023-10-05 01:38:11 +01:00
Divy Srivastava
1a81b2826d
refactor: rewrite websocket to use op2 macro ( #20140 )
...
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-04 21:43:58 +00:00
Kyle Kelley
cbddf5756e
fix(jupyter): keep this
around ( #20789 )
...
This fixes #20767 .
We were losing `this` and then when an exception was happening, it
didn't show up in the output because we weren't bubbling up exceptions
from within a user defined function for displaying. I thought about
doing a `.call(object)` but didn't want to get in the way of a bound
`this` that a user or library was already putting on the function.
2023-10-04 23:08:57 +02:00
Bartek Iwańczuk
a5568066b3
refactor: use deno_core::FeatureChecker for unstable checks ( #20765 )
2023-10-04 21:42:17 +02:00
Trevor Manz
9a46a824bd
feat(jupyter): send binary data with Deno.jupyter.broadcast
( #20755 )
...
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-10-04 13:05:20 +02:00
Yoshiya Hinosawa
da0b945804
feat(unstable): add unix domain socket support to Deno.serve ( #20759 )
2023-10-04 11:37:39 +09:00
David Sherret
8c1677ecbc
refactor(npm): break up NpmModuleLoader
and move more methods into the managed CliNpmResolver
( #20777 )
...
Part of https://github.com/denoland/deno/issues/18967
2023-10-03 19:05:06 -04:00
Bartek Iwańczuk
494822175f
chore: upgrade deno_core to 0.220.0 ( #20766 )
2023-10-03 23:01:34 +00:00
David Sherret
54fcf539c8
fix(npm): upgrade to deno_npm 0.15.2 ( #20772 )
...
* fix: handle optional deps not found in dependencies map
(https://github.com/denoland/deno_npm/pull/38 )
* fix: resolve a version requirement to the latest dist tag if it
matches (https://github.com/denoland/deno_npm/pull/37 )
Closes #20771
2023-10-03 17:35:47 +00:00
David Sherret
148694eb35
refactor(npm): make NpmCache
, CliNpmRegistryApi
, and NpmResolution
internal to npm::managed
( #20764 )
2023-10-02 17:53:55 -04:00
Luca Casonato
d5b6c636b0
fix(ext/node): don't call undefined nextTick fn ( #20724 )
...
The `process` global is not defined in this file.
Fixes #20441
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-02 14:13:57 +02:00
Nayeem Rahman
6fd2d08418
refactor(lsp): clean up tsc requests ( #20743 )
2023-10-02 07:32:05 +01:00
Marcos Casagrande
de25c81fd0
perf(ext/web): optimize DOMException ( #20715 )
...
This PR optimizes `DOMException` constructor increasing performance of
all Web APIs that throw a `DOMException` (ie: `AbortSignal`)
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
new DOMException() 9.66 µs/iter 103,476.8 (8.47 µs … 942.71 µs) 9.62 µs 11.29 µs 14.04 µs
abort writeTextFileSync 16.45 µs/iter 60,775.5 (13.65 µs … 1.33 ms) 16.39 µs 20.59 µs 24.12 µs
abort readFile 16.25 µs/iter 61,542.2 (15.12 µs … 621.14 µs) 16.18 µs 19.59 µs 22.33 µs
```
**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.1 (x86_64-unknown-linux-gnu)
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------- -----------------------------
new DOMException() 2.37 µs/iter 421,657.0 (2.33 µs … 2.58 µs) 2.37 µs 2.58 µs 2.58 µs
abort writeTextFileSync 7.1 µs/iter 140,760.1 (6.94 µs … 7.68 µs) 7.13 µs 7.68 µs 7.68 µs
abort readFile 5.48 µs/iter 182,648.2 (5.3 µs … 5.69 µs) 5.56 µs 5.69 µs 5.69 µ
```
```js
Deno.bench("new DOMException()", () => {
new DOMException();
});
Deno.bench("abort writeTextFileSync", () => {
const ac = new AbortController();
ac.abort();
try {
Deno.writeTextFileSync("/tmp/out", "x", { signal: ac.signal });
} catch {}
});
Deno.bench("abort readFile", async () => {
const ac = new AbortController();
ac.abort();
try {
await Deno.readFile("/tmp/out", { signal: ac.signal });
} catch {}
});
```
2023-10-02 02:18:34 +02:00
David Sherret
8d24be1a59
refactor(npm): create cli::npm::managed
module ( #20740 )
...
Creates the `cli::npm::managed` module and starts moving more
functionality into it.
2023-09-30 12:06:38 -04:00
Divy Srivastava
1cda3840ff
perf(node): use faster utf8 byte length in Buffer#from ( #20746 )
...
Use the `core.byteLength` op for string utf8 length calculation in
`node:buffer`
```
# This patch
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 272.11 ns/iter 3,675,029.3 (268.41 ns … 301.15 ns) 271.62 ns 295.5 ns 301.15 ns
# Deno 1.37.1
file:///Users/divy/gh/deno/buffer.mjs
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------- -----------------------------
Buffer#from 411.28 ns/iter 2,431,428.8 (393.82 ns … 439.92 ns) 418.85 ns 434.4 ns 439.92 ns
```
2023-09-30 20:04:40 +05:30
Rui He
74e4c7f80f
feat(node/os): Add availableParallelism
( #20745 )
2023-09-30 19:51:06 +05:30
Hirotaka Tagawa / wafuwafu13
9017e789df
test(node_compat): add test-http-url.parse*
( #20458 )
...
Add `test-http-url.parse*` tests for Node compat.
2023-09-30 10:14:48 +02:00
Trevor Manz
7bcf1211a1
feat(jupyter): send Jupyter messaging metadata with Deno.jupyter.broadcast
( #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-30 00:24:09 +02:00
Nayeem Rahman
2d1af0cf51
feat(lsp): jupyter notebook analysis ( #20719 )
2023-09-29 20:44:59 +01:00
Igor Zinkovsky
61b91e10ad
fix(ext/kv): send queue wake messages accross different kv instances ( #20465 )
...
fixes #20454
Current KV queues implementation assumes that `enqueue` and
`listenQueue` are called on the same instance of `Deno.Kv`. It's
possible that the same Deno process opens multiple KV instances pointing
to the same fs path, and in that case `listenQueue` should still get
notified of messages enqueued through a different KV instance.
2023-09-29 11:40:36 -07:00
David Sherret
5edd102f3f
refactor(cli): make CliNpmResolver
a trait ( #20732 )
...
This makes `CliNpmResolver` a trait. The terminology used is:
- **managed** - Deno manages the node_modules folder and does an
auto-install (ex. `ManagedCliNpmResolver`)
- **byonm** - "Bring your own node_modules" (ex. `ByonmCliNpmResolver`,
which is in this PR, but unimplemented at the moment)
Part of #18967
2023-09-29 09:26:25 -04:00
David Sherret
d43e48c4e9
refactor(ext/node): remove dependency on deno_npm and deno_semver ( #20718 )
...
This is required from BYONM (bring your own node_modules).
Part of #18967
2023-09-28 22:43:45 +02:00
Bartek Iwańczuk
0bd53fd52d
fix(jupyter): more robust Deno.jupyter namespace ( #20710 )
2023-09-28 16:51:44 +02:00
David Sherret
35fad4d2bc
fix(upgrade): use tar.exe to extract on Windows ( #20711 )
...
This is what we do for deno install, so it should be fine here
https://github.com/denoland/deno_install/pull/219
Closes https://github.com/denoland/deno/issues/20683
2023-09-27 17:57:58 -04:00
David Sherret
31991e221b
chore: add back dotcom step to release ( #20713 )
...
Accidentally removed in
69b7166c20
2023-09-27 19:22:39 +00:00
Matt Mastracci
8ef52b3e6a
chore(ext/ffi): migrate part of FFI to op2 ( #20699 )
2023-09-27 07:54:43 -06:00
Chen Su
507f24c474
fix(ext/node): fix TypeError in Buffer.from with base64url encoding. ( #20705 )
...
For the following example, if I set the encoding to `base64url`, it'll
throw an unexpected TypeError:
```ts
import { Buffer } from "node:buffer";
Buffer.from("IntcImhlbGxvXCI6XCJoZGQvZStpXCJ9Ig", "base64url").toString();
// error: Uncaught TypeError: src.subarray is not a function
// const buf = Buffer.from(
// ^
// at blitBuffer (ext:deno_node/internal/buffer.mjs:1779:15)
// at Uint8Array.base64urlWrite (ext:deno_node/internal/buffer.mjs:691:10)
// at Object.write (ext:deno_node/internal/buffer.mjs:2195:11)
// at Uint8Array.write (ext:deno_node/internal/buffer.mjs:794:14)
// at fromString (ext:deno_node/internal/buffer.mjs:214:22)
// at _from (ext:deno_node/internal/buffer.mjs:119:12)
// at Function.from (ext:deno_node/internal/buffer.mjs:157:10)
// at file:///Users/foodieats/temp/buffer1.ts:3:20
```
The error caused by `base64urlWrite` function, it should call
`forgivingBase64UrlDecode` not `forgivingBase64UrlEncode`
Also fixed #20563 .
2023-09-27 07:54:19 -06:00
Luca Casonato
aef56f3d70
fix(cli): panic with __runtime_js_sources ( #20704 )
...
Also a drive-by cleanup elsewhere (removing unused enum).
Fixes #20702
2023-09-27 10:55:54 +00:00