1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

5520 commits

Author SHA1 Message Date
Divy Srivastava
857e0841c0
chore: bump quick-junit to 0.3.5 (#21004)
Towards #20996
2023-10-28 15:10:17 +02:00
David Sherret
daf9756127
feat(task): add head command (#20998)
Adds a built-in `head` command to deno task:

https://github.com/denoland/deno_task_shell/pull/93
2023-10-27 23:15:00 -04:00
Bartek Iwańczuk
e6ff84c9f9
chore: Remove 'UNSTABLE:' from 'deno compile' help (#21003)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-28 01:54:52 +00:00
Bartek Iwańczuk
e7abb705f9
Revert "chore: update deno_std submodule (#20994)" (#21001)
This reverts commit 6e2abb2b13.
2023-10-28 01:24:37 +00:00
Divy Srivastava
4c6b986f17
chore(ext/crypto): upgrade to ring 0.17 (#20824)
Ref https://github.com/denoland/deno/issues/18071
2023-10-27 23:15:09 +02:00
Bartek Iwańczuk
6e2abb2b13
chore: update deno_std submodule (#20994) 2023-10-27 10:34:30 -04:00
Luca Casonato
9a97edce05
feat: rename Deno.Server to Deno.HttpServer (#20842)
Keeps the old name around for backwards compat.

Closes #20840
2023-10-27 14:35:31 +02:00
David Sherret
9ec18c35c7
feat(doc): display non-exported types referenced in exported types (#20990)
Upgrades to deno_doc 0.70 which includes the feature for showing
non-exported types referenced in exported types as well as a much more
advanced deno doc that uses a symbol graph.
2023-10-26 21:27:50 -04:00
David Sherret
9026f20b2d
fix(unstable/byonm): improve error messages (#20987)
This improves the error messages when a specifier can't be resolved from
a deno module into an npm package.
2023-10-26 21:22:15 -04:00
David Sherret
347c22dd5e
fix: add 'unstable' property to config json schema (#20984) 2023-10-26 22:11:24 +02:00
Luca Casonato
08b99f3909
chore: update base64 crate (#20877) 2023-10-26 18:39:04 +02:00
David Sherret
842e29057d
refactor: break out ModuleInfoCache from ParsedSourceCache (#20977)
As title. This will help use the two independently from the other, which
will help in an upcoming deno doc PR where I need to parse the source
files with scope analysis.
2023-10-25 18:13:22 -04:00
Nayeem Rahman
79a9f2a77c
perf(lsp): fix redundant walk when collecting tsc code lenses (#20974) 2023-10-25 21:51:02 +01:00
David Sherret
be97170a19
feat(unstable): ability to npm install then deno run main.ts (#20967)
This PR adds a new unstable "bring your own node_modules" (BYONM)
functionality currently behind a `--unstable-byonm` flag (`"unstable":
["byonm"]` in a deno.json).

This enables users to run a separate install command (ex. `npm install`,
`pnpm install`) then run `deno run main.ts` and Deno will respect the
layout of the node_modules directory as setup by the separate install
command. It also works with npm/yarn/pnpm workspaces.

For this PR, the behaviour is opted into by specifying
`--unstable-byonm`/`"unstable": ["byonm"]`, but in the future we may
make this the default behaviour as outlined in
https://github.com/denoland/deno/issues/18967#issuecomment-1761248941

This is an extremely rough initial implementation. Errors are
terrible in this and the LSP requires frequent restarts. Improvements
will be done in follow up PRs.
2023-10-25 14:39:00 -04:00
Nayeem Rahman
6c60859407
build: fix lsp benchmark (#20969) 2023-10-25 03:13:16 +00:00
David Sherret
59a5fe530f
refactor: upgrade to deno_ast 0.31 and deno_graph 0.59 (#20965) 2023-10-24 21:43:19 +00:00
Nayeem Rahman
a7bd0cf7a8
perf(lsp): cleanup workspace settings scopes (#20937) 2023-10-24 21:27:27 +01:00
David Sherret
8f065a60e7
fix: improved using declaration support (#20959)
Upgrades to deno_ast 0.30.
2023-10-24 09:37:02 -04:00
Jérôme Benoit
9df36b33c6
docs(event): fixlets to code comments (#20944) 2023-10-23 14:34:37 +02:00
sigmaSd
9f9c3d9048
fix(polyfill): correctly handle flag when its equal 0 (#20953)
Fixes https://github.com/denoland/deno/issues/20910
2023-10-22 08:02:55 +00:00
Yoshiya Hinosawa
fb73eb1e9d
feat(unstable): allow bare specifier for builtin node module (#20728)
closes #20566
2023-10-20 13:02:08 +09:00
Bartek Iwańczuk
8d9fef3b89
refactor: add WatcherCommunicator helper struct (#20927)
This commit introduces "WatcherCommunicator" struct that
is used facilitate bi-directional communication between CLI
file watcher and the watched function.

Prerequisite for https://github.com/denoland/deno/pull/20876
2023-10-19 07:05:00 +02:00
Bartek Iwańczuk
5095af7801
fix(ext/node): process.argv0 (#20925)
Fixes https://github.com/denoland/deno/issues/20924
2023-10-18 01:51:39 +02:00
Nayeem Rahman
7561f6ecea
fix(lsp): include mtime in tsc script version (#20911) 2023-10-17 05:13:06 +01:00
Nayeem Rahman
659cd90758
feat(lsp): respect "typescript.preferences.quoteStyle" when deno.json is absent (#20891) 2023-10-17 02:51:42 +01:00
Nayeem Rahman
ebb7fe412e
fix(lsp): show diagnostics for untitled files (#20916) 2023-10-16 20:21:57 +01:00
David Sherret
cb70c4d0c4
fix(node): resolve file.d specifiers in npm packages (#20918)
Makes type checking octokit work.

Closes #20854
2023-10-17 00:26:38 +09:00
Nayeem Rahman
bd238be4b5
fix(lsp): don't commit registry completions on "/" (#20902) 2023-10-13 14:38:34 +01:00
Marcos Casagrande
7599990a4f
perf(ext/streams): optimize streams (#20649)
This PR introduces several optimizations to streams

### Highlights:
- `ReadableStream` constructor: +20% iter/s.
- `WritableStream` constructor: +50% iter/s.
- `TransformStream` constructor: +30% iter/s.
- `ReadableStream` iterator (both 2 and 20 chunks): +42% and +25%
iter/s.
- `ReadableByteStream` iterator (both 2 and 20 chunks): +39% and +20%
iter/s.

### Benchmarks
**main**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.0 (x86_64-unknown-linux-gnu)

benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
ReadableStream constructor                    294.52 ns/iter   3,395,392.9 (277.92 ns … 618.26 ns) 292.66 ns 353.87 ns 618.26 ns
WritableStream constructor                    235.51 ns/iter   4,246,065.3 (213.04 ns … 306.35 ns) 236.77 ns 279.08 ns 281.32 ns
TransformStream constructor                   672.52 ns/iter   1,486,938.7 (652.15 ns … 880.74 ns) 670.11 ns 880.74 ns 880.74 ns
ReadableStream - iterator (2 chunks)           10.44 µs/iter      95,757.9   (8.97 µs … 830.91 µs)  10.22 µs  14.74 µs  18.93 µs
ReadableStream - iterator (20 chunks)          21.93 µs/iter      45,593.4   (18.8 µs … 864.97 µs)  20.57 µs  57.15 µs 137.16 µs
ReadableStream - reader (2 chunks)              7.09 µs/iter     140,987.2     (7.03 µs … 7.18 µs)   7.13 µs   7.18 µs   7.18 µs
ReadableStream - reader (20 chunks)            18.41 µs/iter      54,324.2    (15.7 µs … 252.7 µs)  17.14 µs  68.88 µs  94.08 µs
ReadableByteStream - iterator (2 chunks)       11.06 µs/iter      90,375.1   (9.75 µs … 404.69 µs)  10.88 µs   16.6 µs  29.69 µs
ReadableByteStream - iterator (20 chunks)      26.71 µs/iter      37,435.0  (22.98 µs … 508.34 µs)  25.25 µs  85.28 µs 155.65 µs
ReadableByteStream - reader (2 chunks)          7.99 µs/iter     125,131.1     (7.92 µs … 8.13 µs)   8.01 µs   8.13 µs   8.13 µs
ReadableByteStream - reader (20 chunks)        23.46 µs/iter      42,618.5  (20.28 µs … 414.66 µs)  21.94 µs  90.52 µs 147.38 µs
```

**this PR**
```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.37.0 (x86_64-unknown-linux-gnu)

benchmark                                      time (avg)        iter/s             (min … max)       p75       p99      p995
----------------------------------------------------------------------------------------------- -----------------------------
ReadableStream constructor                    235.48 ns/iter   4,246,584.3 (223.12 ns … 504.65 ns)  234.3 ns 290.84 ns 311.12 ns
WritableStream constructor                    156.31 ns/iter   6,397,537.3 (148.54 ns … 211.13 ns) 157.49 ns 199.82 ns 208.23 ns
TransformStream constructor                   471.29 ns/iter   2,121,815.3 (452.53 ns … 791.41 ns) 468.62 ns 540.36 ns 791.41 ns
ReadableStream - iterator (2 chunks)            7.32 µs/iter     136,705.4   (6.35 µs … 639.97 µs)    7.1 µs  12.12 µs  20.98 µs
ReadableStream - iterator (20 chunks)          17.48 µs/iter      57,195.1  (14.48 µs … 289.06 µs)  16.06 µs  76.98 µs 114.61 µs
ReadableStream - reader (2 chunks)              6.86 µs/iter     145,847.9      (6.8 µs … 6.97 µs)   6.88 µs   6.97 µs   6.97 µs
ReadableStream - reader (20 chunks)            16.88 µs/iter      59,227.7  (14.04 µs … 311.29 µs)  15.39 µs  74.95 µs  97.45 µs
ReadableByteStream - iterator (2 chunks)        7.94 µs/iter     125,881.2   (6.86 µs … 811.16 µs)   7.69 µs  11.43 µs   16.6 µs
ReadableByteStream - iterator (20 chunks)      22.23 µs/iter      44,978.2  (18.98 µs … 590.11 µs)  20.73 µs  45.13 µs  159.8 µs
ReadableByteStream - reader (2 chunks)           7.4 µs/iter     135,206.9     (7.36 µs … 7.42 µs)    7.4 µs   7.42 µs   7.42 µs
ReadableByteStream - reader (20 chunks)        21.03 µs/iter      47,555.6  (17.75 µs … 357.66 µs)  19.52 µs  98.69 µs  146.5 µs
```

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-10-13 14:30:09 +02:00
denobot
5da1bd802c
chore: forward v1.37.2 release commit to main (#20897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 03:12:06 +00:00
Kyle Kelley
48e695a2c8
feat(unstable): add Deno.jupyter.display API (#20819)
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-12 22:32:38 +00:00
Bartek Iwańczuk
c464cd7073
refactor: FeatureChecker integration in ext/ crates (#20797)
Towards https://github.com/denoland/deno/issues/20779.
2023-10-12 15:55:50 +00:00
Nayeem Rahman
5dd010a4fb
feat(lsp): send "deno/didChangeDenoConfiguration" notifications (#20827) 2023-10-12 16:07:27 +01:00
Nayeem Rahman
eaeb10cee1
perf(lsp): fix redundant file reads (#20802) 2023-10-12 15:37:56 +01:00
Bartek Iwańczuk
cee221109a
fix(node/http2): fixes to support grpc (#20712)
This commit improves "node:http2" module implementation, by enabling
to use "options.createConnection" callback when starting an HTTP2
session.
This change enables to pass basic client-side test with "grpc-js/grpc"
package.
Smaller fixes like "Http2Session.unref()" and "Http2Session.setTimeout()"
were handled as well.

Fixes #16647
2023-10-12 14:03:19 +00:00
Nayeem Rahman
2fb9ddd2e6
chore(task): remove warning for npm "scripts" (#20880) 2023-10-12 07:33:59 +01:00
David Sherret
93e07fa118
fix: upgrade dprint-plugin-markdown 0.16.2 and typescript 0.88.1 (#20879)
Markdown:

* fix: hard break in list was incorrectly being converted to soft with
hard break
6678390b27

TypeScript:

* fix: multi-line string indent was broken in some cases
(https://github.com/dprint/dprint-plugin-typescript/pull/566)
* feat: add parens around unary expressions in in/instanceof
(https://github.com/dprint/dprint-plugin-typescript/pull/564)
2023-10-11 05:48:03 +00:00
Leo Kettmeir
8ba1242a05
feat(WebSocketStream): rename connection to opened (#20878) 2023-10-11 07:31:05 +02:00
Nayeem Rahman
2215a3ea2e
fix(lsp): normalize "deno:" urls statelessly (#20867) 2023-10-10 19:32:22 +01:00
Bartek Iwańczuk
7b80b27a96
chore: disable another flaky Node compat test (#20872) 2023-10-10 18:17:11 +00:00
Nayeem Rahman
0606c11403
fix(bench): use total time when measuring wavg (#20862) 2023-10-10 14:40:36 +01:00
Nayeem Rahman
6bbccb72d7
refactor(lsp): add "deno.reloadImportRegistries" as a command (#20823) 2023-10-10 05:53:41 +01:00
Nayeem Rahman
84c9300aff
fix(lsp): allow formatting vendor files (#20844) 2023-10-09 23:43:32 +01:00
Bartek Iwańczuk
29026fac21
chore: disable another flaky Node compat test (#20846) 2023-10-09 11:23:40 +00:00
Bartek Iwańczuk
d868bae90a
chore: disable flaky Node compat test (#20832) 2023-10-09 17:57:32 +09:00
Luca Casonato
ae81065c75
fix(ext/http): Deno.Server should not be thenable (#20723)
Otherwise you can not return `Deno.Server` from async functions.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-09 12:43:14 +09:00
Nayeem Rahman
35f028daf2
perf(lsp): optimize formatting minified files (#20829) 2023-10-09 04:39:52 +01:00
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
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
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
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
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
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
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
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
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
denobot
3b78981ffe
chore: forward v1.37.1 release commit to main (#20706)
This is the release commit being forwarded back to main for 1.37.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-09-27 09:13:48 +00:00
Igor Zinkovsky
f0a022bed4
fix(kv_queues): graceful shutdown (#20627)
This fixes the `TypeError: Database closed` error during shutdown.
2023-09-26 20:06:57 -07:00
Nayeem Rahman
b433133a1f
fix(lsp): allow query strings for "deno:/status.md" (#20697) 2023-09-27 01:48:34 +01:00
Bartek Iwańczuk
46a4bd5178
feat(unstable): add Deno.jupyter.broadcast API (#20656)
Closes https://github.com/denoland/deno/issues/20591

---------

Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-27 02:21:06 +02:00
David Sherret
91832ce278
fix(upgrade): error instead of panic on unzip failure (#20691)
For #20683
2023-09-26 17:52:47 -04:00
Nayeem Rahman
cb154d6afa
chore(lsp): bump tower-lsp to 0.20.0 (#20693) 2023-09-26 21:57:14 +01:00
David Sherret
dcb00bb9b8
chore: slight cleanup in npm resolvers (#20692) 2023-09-26 16:42:39 -04:00
Bartek Iwańczuk
50a3209fff
chore: deprecate Deno.metrics() API (#20684)
This API is providing hoops to jump through with undergoing migration to
`#[op2]` macro. 

The overhead of supporting this API is non-trivial and besides internal
use of it in test sanitizers is very rarely used in the wild.
2023-09-26 17:34:53 +02:00
Luca Casonato
c68650d532
fix(cli/test): clear connection pool after tests (#20680)
This helps reduce flakes where a test starts an HTTP server and makes a
request using fetch, then shuts down the server, then starting a new
test with a new server, but the connection pool still has a "not quite
closed yet" connection to the old server, and a new request to the new
server gets sent on the closed connection, which obviously errors out.
2023-09-26 19:46:06 +09:00
Nayeem Rahman
939279aa10
feat(lsp): support more vscode built-in settings (#20679) 2023-09-26 03:54:07 +01:00
Luca Casonato
8e1304ced4
perf(test): use fast ops for deno test register (#20670)
Use fast ops for test registration. This speeds up `Deno.test` and
`t.step()` significantly (2x over Deno 1.37.0).
2023-09-26 02:21:18 +00:00
Luca Casonato
a879f8c9fa
test: unflake serve_test/httpServerTcpCancellation (#20672)
Previously could flake on the op sanitizer because the
`await makeTempFile()` promise could leak out of the test. Now we ensure
the request is fully handled before returning.
2023-09-26 02:12:12 +00:00
Luca Casonato
26f431fd14
perf(test): use core.currentUserCallSite (#20669)
Speeds up `Deno.test` calls by a bit.
2023-09-26 10:01:56 +09:00
Matt Mastracci
a27ee8f368
fix(ext/http): ensure that resources are closed when request is cancelled (#20641)
Builds on top of #20622 to fix #10854
2023-09-25 17:23:55 +02:00
Mikko
83f20007aa
docs: fix broken deno manual link (#20667) 2023-09-25 14:09:27 +02:00
Nayeem Rahman
bb4b00df92
feat(lsp): cache all dependencies quick fix (#20665) 2023-09-24 23:33:52 +01:00
Nayeem Rahman
98ef7bd818
fix(lsp): resolve remote import maps (#20651) 2023-09-24 18:00:15 +01:00
Nayeem Rahman
33f84321b2
refactor(lsp): implement "deno.cacheOnSave" server-side (#20632) 2023-09-24 17:59:42 +01:00
Nayeem Rahman
d955d66a3f
fix(lsp): show related information for tsc diagnostics (#20654) 2023-09-24 08:18:51 +01:00
Igor Zinkovsky
b5ba5f157e
fix(kv): unflake kv unit tests (#20640)
fixes #20635
2023-09-23 17:59:01 -07:00
Matt Mastracci
06297d952d
feat(ext/web): use readableStreamDefaultReaderRead in resourceForReadableStream (#20622)
We can go one level down in abstraction and avoid using the public
`ReadableStream` APIs.

This patch ~5% perf boost on small ReadableStream:

```
Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   148.32us  108.95us   3.88ms   95.71%
    Req/Sec    33.24k     2.68k   37.94k    73.76%
  668188 requests in 10.10s, 77.74MB read
Requests/sec:  66162.91
Transfer/sec:      7.70MB
```

main:

```
Running 10s test @ http://localhost:8080/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   150.23us   67.61us   4.39ms   94.80%
    Req/Sec    31.81k     1.55k   35.56k    83.17%
  639078 requests in 10.10s, 74.36MB read
Requests/sec:  63273.72
Transfer/sec:      7.36MB
```
2023-09-23 14:55:28 +00:00
Bartek Iwańczuk
b1ca67ac01
fix(jupyter): await Jupyter.display evaluation (#20646) 2023-09-23 16:30:16 +02:00
Bartek Iwańczuk
1ad097c4bf
refactor: rewrite ops using i64/usize to op2 (#20647) 2023-09-23 14:04:47 +02:00
Divy Srivastava
75a724890d
fix(node): supported arguments to randomFillSync (#20637)
Fixes https://github.com/denoland/deno/issues/20634
2023-09-23 10:04:55 +02:00
Igor Zinkovsky
035df85732
feat(kv_queues): increase max queue delay to 30 days (#20626) 2023-09-22 09:40:35 -07:00
Bartek Iwańczuk
142449ecab
refactor: rewrite some ops to op2 macro (#20603) 2023-09-21 08:08:23 -06:00
Nayeem Rahman
a4ac6a3f5f
refactor(lsp): store language sections in WorkspaceSettings (#20593)
When sending configuration requests to the client, reads `javascript`
and `typescript` sections in addition to `deno`.

The LSP's initialization options now accepts `javascript` and
`typescript` namespaces.
2023-09-21 06:46:39 +01:00
denobot
997aa604df
1.37.0 (#20574)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-09-19 20:29:17 +00:00
Matt Mastracci
612818d043
fix(cli): ensure that an exception in getOwnPropertyDescriptor('constructor') doesn't break Deno.inspect (#20568)
Fixes #20561
2023-09-19 18:24:19 +00:00
Nayeem Rahman
40122d7f2a
fix(lsp): force correct media type detection from tsc (#20562) 2023-09-19 16:37:27 +01:00
Nayeem Rahman
9004117790
fix(lsp): refresh npm completions on each character (#20565) 2023-09-19 12:01:06 +00:00
Luca Casonato
2772d302f5
perf: make deno test 10x faster (#20550) 2023-09-19 12:10:20 +02:00
Nayeem Rahman
b9b4ad31d9
refactor(lsp): dedup import map lookup for auto-imports (#20538) 2023-09-19 00:59:26 +01:00
Kyle Kelley
788bc8d021
fix(cli): Enhanced errors for Jupyter (#20530) 2023-09-18 22:07:33 +00:00
David Sherret
3de9af4d0b
fix(npm): properly handle legacy shasum of package (#20557)
Closes #20554
2023-09-18 16:40:41 -04:00
await-ovo
dc1da30927
fix(cli): for main-module that exists in package.json, use the version defined in package.json directly (#20328) 2023-09-18 20:02:58 +00:00
Nayeem Rahman
f5963b6a05
refactor(lsp): cleanup document preload (#20520) 2023-09-18 20:58:16 +01:00
Nayeem Rahman
86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Nayeem Rahman
f7ba701304
fix(lsp): prefer local auto-import specifiers (#20539)
Give auto-import completion entries a sort-text suffix depending on if
the specifier parses as a URL. This will favour relative and bare
(likely import-mapped) specifiers.
2023-09-18 19:55:24 +01:00
Shreyas
d72f5d573a
fix: Deno.Command - improve error message when cwd is not a directory (#20460) 2023-09-18 17:48:54 +00:00
Nayeem Rahman
87ddd1f04d
fix(lsp): restore tsc's quick fix ordering (#20545) 2023-09-18 17:39:28 +01:00
Kyle Kelley
ee38bbbc8e
fix(jupyter-kernel): don't log errors from objects without a Symbol.for("Jupyter.display") (#20546)
Fast follow up to #20537.

Before:


![image](https://github.com/denoland/deno/assets/836375/8a12e83d-9008-419b-bd1f-24c0ac90afd3)

After:

<img width="235" alt="image"
src="https://github.com/denoland/deno/assets/836375/467bf381-278e-4577-a980-7b0ddb08d2af">

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-18 16:31:20 +00:00
Matt Mastracci
701931477c
fix(cli): fetch works in Jupyter (#20552)
An op2 needs to be overloaded by an op2, not an op1.
2023-09-18 15:39:39 +00:00
David Sherret
0709c051f8
feat(unstable): package manager (#20517)
Adds an experimental unstable built-in package manager to Deno, but it is
currently not usable because the registry infrastructure hasn't been
setup and it points to a non-existent url by default. The default
registry url can be configured via the `DENO_REGISTRY_URL` environment
variable.
2023-09-18 10:46:44 -04:00
Bartek Iwańczuk
4fcd9a0de8
fix(lsp): sort quickfix actions (#17221)
This commit changes ordering of quickfix actions, by sorting them in
following order:

- TSC fixes
- Deno fixes
- deno_lint fixes

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-17 19:05:19 +01:00
Kyle Kelley
81d6ea8e11
feat(jupyter-kernel): accept nested objects from display calls (#20537)
Closes #20535.

# Screenshots

## JSON
<img width="779" alt="image"
src="https://github.com/denoland/deno/assets/836375/668bb1a6-3f76-4b36-974e-cdc6c93f94c3">

## Vegalite

<img width="558" alt="image"
src="https://github.com/denoland/deno/assets/836375/a5e70908-6b87-42d8-85c3-1323ad52a00f">

# Implementation

Instead of going the route of recursively getting all the objects under
`application/.*json` keys, I went with `JSON.stringify`ing in denospace
then parsing it from rust. One of the key benefits of serializing and
deserializing is that non-JSON-able entries will get stripped
automatically. This also keeps the code pretty simple.

In the future we should _only_ do this for `application/.*json` keys.

cc @mmastrac
2023-09-17 10:38:52 -06:00
第二扩展
23bf05cff2
build: add an environment variable to skip cross build check (#20281) (#20533) 2023-09-17 16:06:51 +00:00
Nayeem Rahman
fa18878f54
fix(lsp): include JSON modules in local import completions (#20536) 2023-09-17 07:50:30 +01:00
Kyle Kelley
3b2e553b05
set evalue to a one space string for truthiness on old jupyter (#20531)
"Fixes" the exception display issue of #20524 on older versions of
Jupyter that required `evalue` to be truthy. For now, until we can do
proper processing of the `ExceptionDetails` this will make Jupyter
Notebook 6.5.1 and below happy.

This is the alternative "just work now" PR to #20530
2023-09-17 02:02:21 +00:00
Nayeem Rahman
d13e6e6db8
feat(lsp): include source in auto import completion label (#20523) 2023-09-16 15:51:35 +01:00
Luca Casonato
430b63c2c4
perf: improve async op santizer speed and accuracy (#20501)
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-16 07:48:31 +02:00
Bartek Iwańczuk
bf07604113
feat: Add "deno jupyter" subcommand (#20337)
This commit adds "deno jupyter" subcommand which
provides a Deno kernel for Jupyter notebooks.

The implementation is mostly based on Deno's REPL and
reuses large parts of it (though there's some clean up that
needs to happen in follow up PRs). Not all functionality of
Jupyter kernel is implemented and some message type
are still not implemented (eg. "inspect_request") but
the kernel is fully working and provides all the capatibilities
that the Deno REPL has; including TypeScript transpilation
and npm packages support.

Closes https://github.com/denoland/deno/issues/13016

---------

Co-authored-by: Adam Powers <apowers@ato.ms>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-16 02:42:09 +02:00
Bartek Iwańczuk
5a1505db67
feat(ext/node): http2.connect() API (#19671)
This commit improves compatibility of "node:http2" module by polyfilling
"connect" method and "ClientHttp2Session" class. Basic operations like
streaming, header and trailer handling are working correctly. 
Refing/unrefing is still a TODO and "npm:grpc-js/grpc" is not yet working
correctly.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-09-15 21:51:25 +02:00
Nayeem Rahman
11f0ccf805
fix(test): share fail fast tracker between threads (#20515) 2023-09-15 15:46:48 +00:00
Matt Mastracci
d226970c0e
chore(ext/http): fix a rejection test (#20514)
Use `assertRejects` to actually catch errors.
2023-09-15 08:53:38 -06:00
Matt Mastracci
71af3c375c
fix(ext/http): ensure aborted bodies throw (#20503)
Fixes #20502 -- ensure that Hyper errors make it through to JS.
2023-09-15 08:08:21 -06:00
Luca Casonato
06ece5645c
fix: init v8 platform once on main thread (#20495)
This is a mitigation for segfaults happening in V8 on CPU with MPK
(memory protected keys).

After much trail and error we found that unless V8 platform is
initialized on main thread the segfaults start appears once JIT 
kicks in. "deno test" and "deno bench" were affected by
this problem.

Fixes https://github.com/denoland/deno/issues/19926
Fixes https://github.com/denoland/deno/issues/20243
Fixes https://github.com/denoland/deno/issues/20450

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-15 00:17:01 +02:00
Bartek Iwańczuk
5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
Matt Mastracci
dc505e905e
chore(cli): update chrono to remove broken time dep (#20508)
Fixes the last dependabot security warning
2023-09-14 13:17:38 -06:00
David Sherret
6dc8682b9a
feat: explicit resource management in TypeScript (#20506)
This adds support for `using` and `await using` declarations in
TypeScript only. We need to wait for v8 to support it for this to work
in JS.
2023-09-14 18:08:59 +00:00
David Sherret
e66d3c2c2e
refactor: remove DENO_UNSTABLE_NPM_SYNC_DOWNLOAD and custom sync functionality (#20504)
https://github.com/denoland/deno/pull/20488 enables us to remove this
functionality. This is better because our test suite is now not testing
a separate code path.
2023-09-14 17:51:28 +00:00
David Sherret
54890ee98b
chore(tests): ability to pattern match unordered lines (#20488)
This adds the ability to pattern match unordered lines. For example, the
downloading messages may appear in any order

```
[UNORDERED_START]
Download https://localhost:4546/a.ts
Download https://localhost:4546/b.ts
[UNORDERED_END]
Hello!
```

Additionally, I've made the pattern matching slightly more strict and the output better.
2023-09-14 16:21:57 +00:00
Luca Casonato
851f795001
fix: output traces for op sanitizer in more cases (#20494)
This adds traces for the "started outside test, closed inside test"
case.
2023-09-14 16:38:15 +02:00
lionel-rowe
2046aeed70
feat(ext/web): Add name to Deno.customInspect of File objects (#20415)
Fixes https://github.com/denoland/deno/issues/20414
2023-09-14 07:06:58 +02:00
David Sherret
12a75e3b43
refactor: move deno_core::TaskQueue to cli::util::sync (#20481)
TaskQueue is being removed from `deno_core` and replaced with an unsync
version in deno_unsyc.

https://github.com/denoland/deno_core/pull/193

This is a change in preparation for that. The remaining
`deno_core::TaskQueue` usage in this repo should be replaced with
`deno_core::unsync::TaskQueue` once upgraded.
2023-09-13 21:53:07 +00:00
Nayeem Rahman
022664aab4
feat(lsp): WorkspaceSettings::disablePaths (#20475) 2023-09-13 17:30:27 +01:00
Nayeem Rahman
bdf1850679
fix(lsp): match enable_paths by whole path components (#20470) 2023-09-12 14:36:50 +01:00
Bartek Iwańczuk
0b78a61f08
refactor: rewrite cli/ ops to op2 (#20462) 2023-09-12 13:14:45 +02:00
Leigh McCulloch
4a8b873111
fix(init): skip existing files instead of erroring (#20434)
### What
Skip writing files from the template if the files already exist in the
project directory.

### Why
When I run deno init in a directory that already has a main.ts, or one
of the other template files, I usually want to initialize a workspace
around a file I've started working in. A hard error in this case seems
counter productive. An informational message about what's being skipped
seems sufficient.

Close #20433
2023-09-12 12:55:26 +02:00
Bartek Iwańczuk
f32acb945e
refactor: rewrite ext/io, ext/webstorage ops to op2 (#20461) 2023-09-12 12:42:05 +02:00
Bartek Iwańczuk
82c2864065
refactor: strongly typed TSC ops (#20466)
Removes usage of `serde_json::Value` in several ops used in TSC, in
favor of using strongly typed structs. This will unblock more 
changes in https://github.com/denoland/deno/pull/20462.
2023-09-12 00:55:57 +00:00
Matt Mastracci
950e0e9cd6
fix(ext/http): create a graceful shutdown API (#20387)
This PR implements a graceful shutdown API for Deno.serve, allowing all
current connections to drain from the server before shutting down, while
preventing new connections from being started or new transactions on
existing connections from being created.

We split the cancellation handle into two parts: a listener handle, and
a connection handle. A graceful shutdown cancels the listener only,
while allowing the connections to drain. The connection handle aborts
all futures. If the listener handle is cancelled, we put the connections
into graceful shutdown mode, which disables keep-alive on http/1.1 and
uses http/2 mechanisms for http/2 connections.

In addition, we now guarantee that all connections are complete or
cancelled, and all resources are cleaned up when the server `finished`
promise resolves -- we use a Rust-side server refcount for this.

Performance impact: does not appear to affect basic serving performance
by more than 1% (~126k -> ~125k)

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-12 00:06:38 +00:00
Matt Mastracci
bfd230fd78
chore: update inner #\![allow] to #[allow] (#20463)
Functions should generally be annotated with `#[allow]` blocks rather
than using inner `#![allow]` annotations.
2023-09-11 17:12:33 -06:00
Marvin Hagemeister
9d1385896f
fix: exclude internal JS files from coverage (#20448) 2023-09-11 13:53:42 +00:00
Nayeem Rahman
4460336fda
fix(lsp): always enable semantic tokens responses (#20440) 2023-09-10 20:09:45 +01:00
Marvin Hagemeister
0b3968c468
chore: speed up test name escapeing (#20439) 2023-09-10 14:07:00 +02:00
David Sherret
c228adc27d
feat: TypeScript 5.2 (#20425)
Without `using` declarations or decorator metadata (waiting for that in
v8).
2023-09-09 15:03:21 -04:00
Nayeem Rahman
f75a17521d
fix(lsp): respect configured exclusions for testing APIs (#20427)
LSP testing APIs now obey the various file inclusion settings:
- Modules shown in the text explorer now respect the `exclude`,
`test.exclude` and `test.include` fields in `deno.json`, as well as
`deno.enablePaths` in VSCode settings.
- Modules with testing code lens now respect the `"exclude"`,
`test.exclude` and `test.include` fields in `deno.json`. Code lens
already respects `deno.enablePaths`.
2023-09-09 19:37:01 +01:00
Matt Mastracci
947865c054
feat(cli): allow --log-level=trace for additional deep debugging (#20426)
This allows us to opt in to extremely detailed tracing from dependency
libraries, like so:

```
cargo run --features tracing/log,tracing/max_level_trace -- test --log-level=trace -A --unstable ./cli/tests/unit/serve_test.ts 
```

It will not impact normal operation as it requires the
`tracing/max_level_trace` and `tracing/log` to be active.

Note that tracing is already a dependency -- this just makes it a direct
dep of cli so we can access its features more easily.
2023-09-09 12:03:19 -06:00
Nayeem Rahman
29ff0bfa9f
Reland "refactor(lsp): clean up "enablePaths" handling (#20388)" (#20423) 2023-09-09 15:04:21 +01:00
David Sherret
c521c5fe77
feat: lockfile v3 (#20424)
Details: https://github.com/denoland/deno_lockfile/pull/8
2023-09-08 14:34:57 -04:00
David Sherret
9cac5601b8
fix(compile): support providing flags as args (#20422)
Closes #20413
2023-09-08 17:14:59 +00:00
David Sherret
1b7d5937d9
fix(fmt/markdown): improve ignore comment handling (#20421)
Two bug fixes:

* https://github.com/dprint/dprint-plugin-markdown/pull/85
* https://github.com/dprint/dprint-plugin-markdown/pull/84
2023-09-08 16:38:42 +00:00
Nayeem Rahman
f3d25af61c
Revert "refactor(lsp): clean up "enablePaths" handling (#20388)" (#20419)
This reverts commit 4a11603c76.
2023-09-08 15:48:26 +00:00
Nayeem Rahman
17276a1df9
fix: empty include in config file excludes all (#20404) 2023-09-08 15:04:45 +01:00
Nayeem Rahman
14522fc628
chore(lsp): remove TestingSettings::enable (#20407) 2023-09-08 12:47:57 +01:00
Curran McConnell
a9cc4631ca
fix(ext/node/ops/zlib/brotli): Allow decompressing more than 4096 bytes (#20301)
Fixes https://github.com/denoland/deno/issues/19816

In that issue, I suggest switching over the other brotli functionality
to the Rust API provided by the `brotli` crate. Here, I only do that
with the `brotli_decompress` function to fix the bug with buffers longer
than 4096 bytes.
2023-09-08 09:11:33 +05:30
Nayeem Rahman
4a11603c76
refactor(lsp): clean up "enablePaths" handling (#20388)
Previously we pre-computed enabled paths into `Config::enabled_paths`,
and had to keep updating it. Now we determine enabled paths directly
from `Config::settings` on demand as a single source of truth.

Removes `Config::root_uri`. If `InitializeParams::rootUri` is given, and
it doesn't correspond to a folder in
`InitializeParams::workspaceFolders`, prepend it to
`Config::workspace_folders` as a mocked folder.

Includes groundwork for
https://github.com/denoland/vscode_deno/issues/908. In a minor version
cycle or two we can fix that in vscode_deno, and it won't break for Deno
versions post this patch due to the corrected deserialization logic for
`enablePaths`.
2023-09-08 00:50:34 +01:00
David Sherret
3fc19dab47
feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
Heyang Zhou
01a761f1d4
chore(ext/kv): limit total key size in an atomic op to 80 KiB (#20395)
Keys are expensive metadata. We track it for various purposes, e.g.
transaction conflict check, and key expiration.

This patch limits the total key size in an atomic operation to 80 KiB
(81920 bytes). This helps ensure efficiency in implementations.
2023-09-07 15:07:04 +08:00
Nayeem Rahman
2cbd1b40cb
fix(test): apply filter before checking for "only" (#20389) 2023-09-06 17:07:37 +01:00
Marvin Hagemeister
e0a269c23a
fix: don't show filtered test suites as running (#20385) 2023-09-06 14:54:21 +02:00
Bartek Iwańczuk
147c845c95
feat(test): Add Deno.test.ignore and Deno.test.only (#20365)
Closes https://github.com/denoland/deno/issues/17106
2023-09-06 14:17:33 +02:00
Divy Srivastava
9befa566ec
fix(ext/node): implement AES GCM cipher (#20368)
Adds support for AES-GCM 128/256 bit keys in `node:crypto` and
`setAAD()`, `setAuthTag()` and `getAuthTag()`

Uses https://github.com/littledivy/aead-gcm-stream

Fixes https://github.com/denoland/deno/issues/19836
https://github.com/denoland/deno/issues/20353
2023-09-06 11:01:50 +05:30
sigmaSd
be1fc754a1
feat(lsp): provide the deno.cache command server-side (#20111)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-09-05 16:36:35 +01:00
zuisong
4a561f12db
fix(node/child_process): don't crash on undefined/null value of an env var (#20378)
Fixes #20373

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-05 12:42:35 +02:00
Bartek Iwańczuk
2a1ba2732e
chore: disable 'test-http-content-length.js` test (#20344) 2023-09-04 23:23:01 +02:00
Bartek Iwańczuk
9e243d22f4
Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303) (#20370)
This reverts commit
83426be6ee.

Includes a regression test.
2023-09-04 17:05:06 -04:00
Nayeem Rahman
12f6ad32c2
fix(lsp): properly handle disabled configuration requests (#20358)
Fixes #19802.

Properly respect when clients do not have the `workspace/configuration`
capability, a.k.a. when an editor cannot provide scoped settings on
request from the LSP.

- Fix one spot where we weren't checking for the capability before
sending this request.
- For `enablePaths`, fall back to the settings passed in the
initialization options in more cases.
- Respect the `workspace/configuration` capability in the test harness
client.

See:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration.
2023-09-02 16:36:04 +01:00
Nayeem Rahman
e1fb48524d
Reland "feat(lsp): enable via config file detection (#20334)" (#20349) 2023-09-01 21:13:13 +01:00
Bartek Iwańczuk
2b191c6e9d
chore: forward v1.36.4 to main (#20352)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-09-01 18:08:58 +00:00
Bartek Iwańczuk
a74554987a
Revert "feat(lsp): enable via config file detection (#20334)" (#20347)
This reverts commit c0dcf6a357.

CC @nayeemrmn
2023-09-01 12:01:20 +00:00
Nayeem Rahman
c0dcf6a357
feat(lsp): enable via config file detection (#20334)
With https://github.com/denoland/vscode_deno/pull/902 for
https://github.com/denoland/vscode_deno/issues/880.

For multi-folder workspaces, note that this only scans the first one and
applies the result to all. That means users would have to still have to
specify `"deno.enable": true/false` for their secondary folders if the
preference is different for those.
2023-08-31 19:10:09 +01:00
Nayeem Rahman
1cce306022
fix(runtime/permissions): Resolve executable specifiers in allowlists and queries (#14130)
Closes #14122.

Adds two extensions to `--allow-run` behaviour:
- When `--allow-run=foo` is specified and `foo` is found in the `PATH`
at startup, `RunDescriptor::Path(which("foo"))` is added to the
allowlist alongside `RunDescriptor::Name("foo")`. Currently only the
latter is.
- When run permission for `foo` is queried and `foo` is found in the
`PATH` at runtime, either `RunDescriptor::Path(which("foo"))` or
`RunDescriptor::Name("foo")` would qualify in the allowlist. Currently
only the latter does.
2023-08-30 18:52:01 +01:00
Nayeem Rahman
d28384c3de
refactor(lsp): store test definitions in adjacency list (#20330)
Previously:
```rust
pub struct TestDefinition {
  pub id: String,
  pub name: String,
  pub range: SourceRange,
  pub steps: Vec<TestDefinition>,
}

pub struct TestDefinitions {
  pub discovered: Vec<TestDefinition>,
  pub injected: Vec<lsp_custom::TestData>,
  pub script_version: String,
}
```
Now:
```rust
pub struct TestDefinition {
  pub id: String,
  pub name: String,
  pub range: Option<Range>,
  pub is_dynamic: bool, // True for 'injected' module, not statically detected but added at runtime.
  pub parent_id: Option<String>,
  pub step_ids: HashSet<String>,
}

pub struct TestModule {
  pub specifier: ModuleSpecifier,
  pub script_version: String,
  pub defs: HashMap<String, TestDefinition>,
}
```

Storing the test tree as a literal tree diminishes the value of IDs,
even though vscode stores them that way. This makes all data easily
accessible from `TestModule`. It unifies the interface between
'discovered' and 'injected' tests. This unblocks some enhancements wrt
syncing tests between the LSP and extension, such as this TODO:
61f08d5a71/client/src/testing.ts (L251-L259)
and https://github.com/denoland/vscode_deno/issues/900. We should also
get more flexibility overall.

`TestCollector` is cleaned up, now stores a `&mut TestModule` directly
and registers tests as it comes across them with
`TestModule::register()`. This method ensures sanity in the redundant
data from having both of `TestDefinition::{parent_id,step_ids}`.

All of the messy conversions between `TestDescription`,
`LspTestDescription`, `TestDefinition`, `TestData` and `TestIdentifier`
are cleaned up. They shouldn't have been using `impl From` and now the
full list of tests is available to their implementations.
2023-08-30 16:31:31 +01:00
Divy Srivastava
329698cf73
fix(napi): ignore tsfn recv error (#20324)
Ref https://github.com/denoland/deno/issues/20072
2023-08-30 09:04:55 +05:30
Ryan Dahl
f76bfbbe33
refactor(init): simplify template (#20325)
- Don't include benchmark file - most people won't need this.
- Use deno.json instead of deno.jsonc, because it's a more common file
  format.
2023-08-29 19:58:56 +00:00
Matt Mastracci
64045ebc7a
chore(cli): use NPM_CONFIG_REGISTRY for all tests (#20320)
We never want tests to hit the real npm registry because this causes
test flakes. In addition, we set a sentinal "unset" value for
`NPM_CONFIG_REGISTRY` to ensure that all tests requiring npm go through
the test server.
2023-08-29 13:02:54 -06:00
Igor Zinkovsky
441b860978
fix(ext/kv): don't panic if listening on queues and KV is not closed (#20317)
fixes #20312
2023-08-29 11:24:44 -07:00
David Sherret
c4451d3076
feat(lockfile): add redirects to the lockfile (#20262) 2023-08-29 12:03:02 -05:00
David Sherret
bdc91211b0
fix(lsp): recreate npm search cache when cache path changes (#20327) 2023-08-29 16:24:19 +00:00
Nayeem Rahman
b5f032df73
feat(lsp): npm specifier completions (#20121) 2023-08-29 10:22:05 -05:00
Bartek Iwańczuk
2929313652
fix(node/http): don't leak resources on destroyed request (#20040)
Closes https://github.com/denoland/deno/issues/19828
2023-08-29 12:13:58 +00:00
Nayeem Rahman
c31c93ce70
fix(lsp): delete test modules with all tests deleted (#20321)
Fixes https://github.com/denoland/vscode_deno/issues/899.
2023-08-29 09:43:11 +01:00
Yoshiya Hinosawa
fb7092fb43
fix(ext/node): fix argv[1] in Worker (#20305) 2023-08-29 12:18:25 +09:00
Nayeem Rahman
bd034e360d
refactor(runtime): factor out code between build.rs and worker.rs (#20299)
Adds `runtime/shared.rs` which is imported by both `build.rs` and the
rest of the crate, containing utilities used by both.
Renames the `snapshot_from_snapshot` feature to
`exclude_runtime_main_js` since that's what it does and it's relevant
outside of snapshotting when `__runtime_js_sources` is specified.
2023-08-28 15:30:46 -06:00
Matt Mastracci
7adaf613bf
fix(ext/node): shared global buffer unlock correctness fix (#20314)
The fix for #20188 was not entirely correct -- we were unlocking the
global buffer incorrectly. This PR introduces a lock state that ensures
we only unlock a lock we have taken out.
2023-08-28 15:28:39 -06:00
Matt Mastracci
9198bbd454
fix(ext/http): don't panic on stream responses in cancelled requests (#20316)
When a TCP connection is force-closed (ie: browser refresh), the
underlying future we pass to Hyper is dropped which may cause us to try
to drop the body resource while the OpState lock is still held.

Preconditions for this bug to trigger:

 - The body resource must have been taken
- The response must return a resource (which requires us to take the
OpState lock)
 - The TCP connection must have been dropped before this

Fixes #20315 and #20298
2023-08-28 13:29:34 -06:00
Marvin Hagemeister
539e5032d3
fix: unexpected lsp function arg comma completion (#20311) 2023-08-28 17:07:22 +02:00
David Sherret
ebfead1021
fix(fmt/markdown): ignore trailing words in code block info string for language detection (#20310) 2023-08-28 12:28:06 +00:00
osddeitf
c2547ba039
fix(node/http): correctly send Content-length header instead of Transfer-Encoding: chunked (#20127)
Fix #20063.
2023-08-28 09:32:54 +02:00
Nayeem Rahman
f826574873
test(bench): mark explicit timer test as flaky (#20304)
https://github.com/denoland/deno/actions/runs/5990043261/job/16246927846?pr=18642

The test is just `b.start(); b.end()` where the time measured between
must be less 10 μs during warmup. Can't improve it.
Also fixes doc mistake.
2023-08-27 22:22:23 +02:00
sigmaSd
916ddcef6d
feat(lint): --rules print all rules (#20256)
The motivation is If I'm using deno lint --rules, I want to see all the
rules especially the one that have no tags, since the recommend ones are
already active

This change also prints the tags associated with the rule inline.
2023-08-27 11:17:41 +02:00
Nayeem Rahman
e1fe31508c
fix(lsp/testing): use full ancestry to compute static id of step (#20297)
Fixes https://github.com/denoland/vscode_deno/issues/656.

Test steps were ID'd by a checksum of `[origin, level, step_name]` which
is incorrect. Now it's `[origin, ...ancestor_names, step_name]`.
2023-08-27 11:16:09 +02:00
林炳权
2080669943
chore: update to Rust 1.72 (#20258)
<!--
Before submitting a PR, please read https://deno.com/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.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

As the title.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
Igor Zinkovsky
e4cebf3e0d
fix(kv) increase number of allowed mutations in atomic (#20126)
fixes #19741

Impose a limit on the total atomic payload size
2023-08-26 18:26:09 -07:00
Matt Mastracci
d104a09f79
chore(core): bump and trim deps (#20265)
Skipping for a later follow-up:

 - base64: #20266
 - notify
 - indexmap (will require follow-up in upstream projects)
2023-08-26 07:10:42 -06:00
Nayeem Rahman
5dbf5c8293
fix(bench): explicit timers don't force high precision measurements (#20272)
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-26 11:29:45 +02:00
Divy Srivastava
1cb547d885
fix(node): propagate create cipher errors (#20280)
Fixes https://github.com/denoland/deno/issues/19002
2023-08-26 10:45:37 +05:30
Nayeem Rahman
37292e74e1
fix(lsp): implement deno.suggest.completeFunctionCalls (#20214)
Fixes https://github.com/denoland/vscode_deno/issues/743.
```ts
const items: string[] = ['foo', 'bar', 'baz'];

items.map
// ->
items.map(callbackfn) // auto-completes with argument placeholders.
```

---

We have our own setting for `suggest.completeFunctionCalls`, which must
be enabled:
```js
{
    "deno.suggest.completeFunctionCalls": true,
    // Re-implementation of:
    // "javascript.suggest.completeFunctionCalls": true,
    // "typescript.suggest.completeFunctionCalls": true,
}
```
But before this commit the actual implementation had been left as a TODO.
2023-08-26 02:53:44 +02:00
Nayeem Rahman
6f077ebb07
feat(lsp): update imports on file rename (#20245)
Closes https://github.com/denoland/vscode_deno/issues/410.
2023-08-26 02:50:47 +02:00
Valentin Anger
a526cff0a9
feat(cli/tools): add TAP test reporter (#14390) (#20073)
This PR adds a test reporter for the [Test Anything
Protocol](https://testanything.org).

It makes the following implementation decisions:
- No TODO pragma, as there is no such marker in `Deno.test`
- SKIP pragma for `ignore`d tests
- Test steps are treated as TAP14 subtests
  - Support for this in consumers seems spotty
- Some consumers will incorrectly interpret these markers, resulting in
unexpected output
- Considering the lack of support, and to avoid implementation
complexity,
subtests are at most one level deep (all test steps are in the same
subtest)
- To accommodate consumers that use comments to indicate test-suites
(unspecced)
  - The test module path is output as a comment
  - This is disabled for `--parallel` testing
- Failure diagnostics are output as JSON, which is also valid YAML
- The structure is not specified, so the format roughly follows the spec
example:
  ```
  ---
  message: "Failed with error 'hostname peebles.example.com not found'"
  severity: fail
  found:
    hostname: 'peebles.example.com'
    address: ~
  wanted:
    hostname: 'peebles.example.com'
    address: '85.193.201.85'
  at:
    file: test/dns-resolve.c
    line: 142
  ...
  ```
2023-08-26 01:19:23 +02:00
Matt Mastracci
8bb4e10881
fix(ext/tls): upgrade webpki version (#20285)
This removes a webpki version that was showing up as vulnerable to
https://github.com/briansmith/webpki/issues/69.

Needed to upgrade `reqwest` as part of this.
2023-08-25 23:40:25 +02:00
Nayeem Rahman
907d9bb4d7
fix(lsp): test explorer panic on step result (#20289)
Fixes https://github.com/denoland/vscode_deno/issues/843.

Prevents step results from being reported twice. Refactors
`LspTestReporter` to use a complete `(test_id, descriptor)` map instead
of a brittle `LspTestReporter::stack`.
2023-08-25 23:32:22 +02:00
Matt Mastracci
fd70b7025b
chore: fully remove atty dep (#20288)
This fully removes the `atty` crate from deno by bumping `env_logger`
and removing the now-unused `atty` dep for runtime.
2023-08-25 17:40:21 +00:00
Matt Mastracci
c272d26ae8
chore(cli): remove atty crate (#20275)
Removes a crate with an outstanding vulnerability.
2023-08-25 07:43:07 -06:00
Nayeem Rahman
9e31f9452e
fix(lsp/testing): don't queue modules without tests (#20277)
Fixes https://github.com/denoland/vscode_deno/issues/890.
2023-08-25 11:12:11 +02:00
denobot
3a2d284c96
chore: forward v1.36.3 release commit to main (#20270)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24 17:53:01 +00:00
dependabot[bot]
a47c160cbc
build(deps): bump trust-dns-server from 0.22.0 to 0.22.1 (#20114)
Bumps [trust-dns-server](https://github.com/bluejekyll/trust-dns) from
0.22.0 to 0.22.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/bluejekyll/trust-dns/releases">trust-dns-server's
releases</a>.</em></p>
<blockquote>
<h2>v0.22.1 - Deny response requests on the server</h2>
<h2>0.22.1</h2>
<h3>Fixed</h3>
<ul>
<li>(server) drop response messages <a
href="https://redirect.github.com/bluejekyll/trust-dns/issues/1952">#1952</a>
by <a href="https://github.com/djc"><code>@​djc</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md">trust-dns-server's
changelog</a>.</em></p>
<blockquote>
<h2>0.22.1</h2>
<h3>Fixed</h3>
<ul>
<li>(server) drop response messages <a
href="https://redirect.github.com/bluejekyll/trust-dns/issues/1952">#1952</a>
by <a href="https://github.com/djc"><code>@​djc</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9f344b54cd"><code>9f344b5</code></a>
bump server and bin crates to 0.22.1</li>
<li><a
href="9e6e77293b"><code>9e6e772</code></a>
update CHANGELOG for 0.22.1</li>
<li><a
href="5f6278154d"><code>5f62781</code></a>
Regenerate the test SSL certificates</li>
<li><a
href="2fd2603171"><code>2fd2603</code></a>
server: drop response messages</li>
<li>See full diff in <a
href="https://github.com/bluejekyll/trust-dns/compare/v0.22.0...v0.22.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=trust-dns-server&package-manager=cargo&previous-version=0.22.0&new-version=0.22.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/denoland/deno/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-24 09:10:26 -06:00
Bartek Iwańczuk
f9beb92818
refactor: use "deno_config" crate (#20260)
Moved the configuration file to https://github.com/denoland/deno_config
as we will have to use it in other projects.
2023-08-24 11:21:34 +02:00
Matt Mastracci
b1ce2e4167
fix(ext/web): add stream tests to detect v8slice split bug (#20253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23 17:03:05 -06:00
Asher Gomez
af1b794e53
fix: add missing URL.canParse() types (#20244)
Reference:
https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static
2023-08-23 09:31:13 +02:00
Matt Mastracci
9b01307704
fix(ext/web): better handling of errors in resourceForReadableStream (#20238)
Improves error handling when the Resource is closed in various phases of
the ReadableStream. Ensure that we send a consistent `cancel` reason.
2023-08-22 16:16:34 -06:00
Matt Mastracci
c37b9655b6
fix(ext/node): simultaneous reads can leak into each other (#20223)
Reported in #20188

This was caused by re-use of a global buffer `BUF` during simultaneous
async reads.
2023-08-22 14:45:10 +00:00
Matt Mastracci
792dc75471
fix(cli): add timeout on inspector tests (#20225)
I believe this test locked up on this run below:

https://github.com/denoland/deno/actions/runs/5928630684/job/16074661291
2023-08-22 07:25:38 -06:00
David Sherret
8649648b43
fix(lint): erroneous remove await in async (#20235)
Closes #20229
2023-08-22 12:16:35 +02:00
Heyang Zhou
6d4a005e41
feat(ext/kv): connect to remote database (#20178)
This patch adds a `remote` backend for `ext/kv`. This supports
connection to Deno Deploy and potentially other services compatible with
the KV Connect protocol.
2023-08-22 13:56:00 +08:00
David Sherret
5834d282d4
refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 09:53:52 +00:00
Aapo Alasuutari
af125c8e70
feat(unstable): Improve FFI types (#20215)
Few improvements to FFI types:
1. Export `PointerObject` for convenience. It's fairly commonly used in
library code and thus should be exported.
2. Fix various comments around `PointerValue` and `UnsafePointer` and
expand upon them to better reflect reality.
3. Instead of using a `Record<"value", type>[T]` for determining the
type of an FFI symbol parameter use direct `T extends "value" ? type :
never` comparison.

The last part enables smuggling extra information into the parameter and
return value string declarations at the type level. eg. Instead of just
`"u8"` the parameter can be `"u8" & { [brand]: T }` for some `T extends
number`. That `T` can then be extracted from the parameter to form the
TypeScript function's parameter or return value type. Essentially, this
enables type-safe FFI!

The foremost use-cases for this are enums and pointer safety. These are
implemented in the second commit which should enable, in a backwards
compatible way, for pointer parameters to declare what sort of pointer
they mean, functions to declare what the API definition of the native
function is, and for numbers to declare what Enum they stand for (if
any).
2023-08-21 13:36:26 +05:30
Matt Mastracci
576d0db372
fix(ext/http): ensure request body resource lives as long as response is alive (#20206)
Deno.serve's fast streaming implementation was not keeping the request
body resource ID alive. We were taking the `Rc<Resource>` from the
resource table during the response, so a hairpin duplex response that
fed back the request body would work.

However, if any JS code attempted to read from the request body (which
requires the resource ID to be valid), the response would fail with a
difficult-to-diagnose "EOF" error.

This was affecting more complex duplex uses of `Deno.fetch` (though as
far as I can tell was unreported).

Simple test:

```ts
        const reader = request.body.getReader();
        return new Response(
          new ReadableStream({
            async pull(controller) {
              const { done, value } = await reader.read();
              if (done) {
                controller.close();
              } else {
                controller.enqueue(value);
              }
            },
          }),
```

And then attempt to use the stream in duplex mode:

```ts

async function testDuplex(
  reader: ReadableStreamDefaultReader<Uint8Array>,
  writable: WritableStreamDefaultWriter<Uint8Array>,
) {
  await writable.write(new Uint8Array([1]));
  const chunk1 = await reader.read();
  assert(!chunk1.done);
  assertEquals(chunk1.value, new Uint8Array([1]));
  await writable.write(new Uint8Array([2]));
  const chunk2 = await reader.read();
  assert(!chunk2.done);
  assertEquals(chunk2.value, new Uint8Array([2]));
  await writable.close();
  const chunk3 = await reader.read();
  assert(chunk3.done);
}
```

In older versions of Deno, this would just lock up. I believe after
23ff0e722e, it started throwing a more
explicit error:

```
httpServerStreamDuplexJavascript => ./cli/tests/unit/serve_test.ts:1339:6
error: TypeError: request or response body error: error reading a body from connection: Connection reset by peer (os error 54)
    at async Object.pull (ext:deno_web/06_streams.js:810:27)
```
2023-08-21 01:35:26 +00:00
Divy Srivastava
c2259f78eb
chore: remove third_party submodule (#20201)
removes third_party submodule, tools are installed on-demand.

- removed `load_test` and websocket benchmark (covered by benchy)
- removed node/bun http benchmarks (covered by benchy)
- `dlint` & `dprint` downloaded on-demand. 
- `wrk` & `hyperfine` downloaded before CI benchmark run. 
   Install locally using: `./tools/install_prebuilt.js wrk hyperfine`

#### updating dlint/dprint

update version in `tools/util.js` and place binary in
`denoland/deno_third_party`.
2023-08-19 09:56:12 +05:30
David Sherret
0e4469c7a1
ci: try to fix flaky stdio_streams_are_locked_in_permission_prompt (#20204) 2023-08-18 11:01:41 -04:00
Bartek Iwańczuk
a48ec1d563
fix(node/http): emit error when addr in use (#20200)
Closes https://github.com/denoland/deno/issues/20186
2023-08-18 13:48:18 +02:00
Heyang Zhou
c77c836a23
feat(ext/kv): key expiration (#20091)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-08-18 17:34:16 +08:00
Alexander Michaud
b5839eefcf
fix(test): JUnit reporter includes file, line and column attributes (#20174)
Closes #20156
2023-08-17 23:41:29 +02:00
David Sherret
f343391a9f
fix(unstable): disable importing from the vendor directory (#20067)
Some people might get think they need to import from this directory,
which could cause confusion and duplicate dependencies. Additionally,
the `vendor` directory has special behaviour in the language server, so
importing from the folder will definitely cause confusion and issues
there.
2023-08-17 16:14:22 +00:00
David Sherret
6082e51094
fix(cli): handle missing now field in cache (#20192)
Fixes this error message:

```
error: missing field `now` at line 32 column 1
```

This would occur if someone used an old version of the deno_cache
library to cache information in the cache then tried to load it with the
latest CLI. Regression in the last patch when migrating to the
deno_cache_dir crate.
2023-08-17 15:25:00 +00:00
Nayeem Rahman
6de35e4b2e
fix(lsp): pass fmt options to completion requests (#20184)
Fixes https://github.com/denoland/vscode_deno/issues/856.
2023-08-17 10:46:11 -04:00
David Sherret
4535f79a4a
fix(npm): do not panic providing file url to require.resolve paths (#20182)
Closes #19922
2023-08-17 10:39:06 -04:00
Matt Mastracci
23ff0e722e
feat(ext/web): resourceForReadableStream (#20180)
Extracted from fast streams work.

This is a resource wrapper for `ReadableStream`, allowing us to treat
all `ReadableStream` instances as resources, and remove special paths in
both `fetch` and `serve`.

Performance with a ReadableStream response yields ~18% improvement:

```
  return new Response(new ReadableStream({
    start(controller) {
      controller.enqueue(new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));
      controller.close();
    }
  })
```

This patch:

```
12:36 $ third_party/prebuilt/mac/wrk http://localhost:8080
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    99.96us  100.03us   6.65ms   98.84%
    Req/Sec    47.73k     2.43k   51.02k    89.11%
  959308 requests in 10.10s, 117.10MB read
Requests/sec:  94978.71
Transfer/sec:     11.59MB
```

main:

```
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   163.03us  685.51us  19.73ms   99.27%
    Req/Sec    39.50k     3.98k   66.11k    95.52%
  789582 requests in 10.10s, 82.83MB read
Requests/sec:  78182.65
Transfer/sec:      8.20MB
```
2023-08-17 07:52:37 -06:00
Heyang Zhou
0960e895da
fix(ext/kv): retry transaction on SQLITE_BUSY errors (#20189)
Properly handle the `SQLITE_BUSY` error code by retrying the
transaction.

Also wraps database initialization logic in a transaction to protect
against incomplete/concurrent initializations.

Fixes https://github.com/denoland/deno/issues/20116.
2023-08-17 18:53:55 +08:00
Marcos Casagrande
ec63b36994
perf(ext/event): optimize Event constructor (#20181)
This PR optimizes `Event` constructor

- ~Added a fast path for empty `eventInitDict`~ Removed `EventInit`
dictionary converter
- Don't make `isTrusted` a
[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)
property. Doing so makes it non-spec compliant but calling
`Object/Reflect.defineProperty` on the constructor is a big bottleneck.
Node did the same a few months ago
https://github.com/nodejs/node/pull/46974. In my opinion, the
performance gains are worth deviating from the spec for a
browser-related property.

**This PR**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init      36.69 ns/iter  27,257,504.6   (33.36 ns … 42.45 ns)  37.71 ns  39.61 ns  40.07 ns
event constructor               36.7 ns/iter  27,246,776.6   (33.35 ns … 56.03 ns)  37.73 ns  40.14 ns  41.74 ns
```

**main**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init     380.48 ns/iter   2,628,275.8 (366.66 ns … 399.39 ns) 384.58 ns 398.27 ns 399.39 ns
event constructor             480.33 ns/iter   2,081,882.6 (466.67 ns … 503.47 ns) 484.27 ns 501.28 ns 503.47 ns
```

```js
Deno.bench("event constructor no init", () => {
  const event = new Event("foo");
});

Deno.bench("event constructor", () => {
  const event = new Event("foo", { bubbles: true, cancelable: false });
});
```

towards https://github.com/denoland/deno/issues/20167
2023-08-17 10:35:18 +02:00
Leo Kettmeir
1b0e394d48
fix: release ReadeableStream in fetch (#17365)
Fixes #16648

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-08-16 14:02:15 +02:00