Commit graph

684 commits

Author SHA1 Message Date
Matt Mastracci 6b42cecc06
feat(ext/net): use rustls_tokio_stream (#21205)
Fixes #21121 and #19498

Migrates fully to rustls_tokio_stream. We no longer need to maintain our
own TlsStream implementation to properly support duplex.

This should fix a number of errors with TLS and websockets, HTTP and
"other" places where it's failing.
2023-11-15 16:12:46 -07:00
David Sherret b78c7130e9
fix: improve deno doc --lint error messages (#21156)
This also updates deno_graph, which has the JSR change to use "exports".
It's not yet useful atm, so I've made this PR a fix about the deno doc
--lint error message improvements. I'll do a follow-up PR that adds
exports to the deno.json
2023-11-10 18:40:39 +00:00
Divy Srivastava 9f2e56ba96
chore: use internal namespace in 40_testing.js (#21141)
Towards #21136 

- [x] assign serializePermissions, setTimeout and setExitHandler APIs to
internal namespace
- [x] remove usage of assert
2023-11-10 14:34:41 +00:00
David Sherret 7eb34c7a36
fix(byonm): correct resolution for scoped packages (#21083) 2023-11-06 08:35:26 -05:00
Matt Mastracci 485fade0b6
chore: migrate to new deno_core and metrics (#21057)
- Uses the new OpMetrics system for sync and async calls
- Partial revert of #21048 as we moved Array.fromAsync upstream to
deno_core
2023-11-05 14:27:36 -07:00
David Sherret e4c947dd2b
fix(node): use closest package.json to resolve package.json imports (#21075) 2023-11-04 16:41:51 +00:00
David Sherret 8acf059ac6
fix(doc): deno doc --lint mod.ts should output how many files checked (#21084)
As pointed out in https://github.com/denoland/deno/issues/21067 , it's
confusing that `deno doc --lint mod.ts` outputs the documentation to
stdout on success. Instead, it would be better if it outputted how many
files were checked similar to what `deno lint` does on success. It still
outputs the documentation if `--lint` or `--html` are provided so this
is non-breaking.
2023-11-04 04:43:54 +00:00
Bartek Iwańczuk 24c3c96958
feat: granular --unstable-* flags (#20968)
This commit adds granular `--unstable-*` flags:
- "--unstable-broadcast-channel"
- "--unstable-ffi"
- "--unstable-fs"
- "--unstable-http"
- "--unstable-kv"
- "--unstable-net"
- "--unstable-worker-options"
- "--unstable-cron"

These flags are meant to replace a "catch-all" flag - "--unstable", that
gives a binary control whether unstable features are enabled or not. The
downside of this flag that allowing eg. Deno KV API also enables the FFI
API (though the latter is still gated with a permission).

These flags can also be specified in `deno.json` file under `unstable`
key.

Currently, "--unstable" flag works the same way - I will open a follow
up PR that will print a warning when using "--unstable" and suggest to use
concrete "--unstable-*" flag instead. We plan to phase out "--unstable"
completely in Deno 2.
2023-11-01 23:15:08 +01:00
Matt Mastracci 42c426e769
feat(ext/websocket): websockets over http2 (#21040)
Implements `WebSocket` over http/2. This requires a conformant http/2
server supporting the extended connect protocol.

Passes approximately 100 new WPT tests (mostly `?wpt_flags=h2` versions
of existing websockets APIs).

This is implemented as a fallback when http/1.1 fails, so a server that
supports both h1 and h2 WebSockets will still end up on the http/1.1
upgrade path.

The patch also cleas up the websockets handshake to split it up into
http, https+http1 and https+http2, making it a little less intertwined.

This uncovered a likely bug in the WPT test server:
https://github.com/web-platform-tests/wpt/issues/42896
2023-11-01 21:11:01 +00:00
Bartek Iwańczuk 587f2e0800
feat: precompile JSX (#20962)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-01 20:30:23 +00:00
Asher Gomez f8f4e77632
feat(unstable): deno run --env (#20300)
This change adds the `--env=[FILE]` flag to the `run`, `compile`,
`eval`, `install` and `repl` subcommands. Environment variables set in
the CLI overwrite those defined in the `.env` file.
2023-11-01 15:21:13 +00:00
David Sherret f1df22ce0a
feat(doc): improve non-exported diagnostic (#21033)
This will now catch way more scenarios.
2023-11-01 13:54:44 +01:00
David Sherret d1ef561dbf
feat: deno doc --lint (#21032)
Adds a new `--lint` flag to `deno doc` that surfaces three kinds of
diagnostics:

1. Diagnostic for non-exported type referenced in an exported type.
* Why? People often forget to export types from a module in TypeScript.
To supress this diagnostic, add an `@internal` jsdoc tag to the internal
type.
1. Diagnostic for missing return type or missing property type on a
**public** type.
* Why? Otherwise `deno doc` will not display good documentation. Adding
explicit types also helps with type checking performance.
1. Diagnostic for missing jsdoc on a **public** type.
* Why? Everything should be documented. This diagnostic can be supressed
by adding a jsdoc comment description.

If the lint passes, `deno doc` generates documentation as usual.

For example, checking for deno doc diagnostics on the CI:

```shellsession
$ deno doc --lint mod.ts second_entrypoint.ts > /dev/null
```

This feature is incredibly useful for library authors.

## Why not include this in `deno lint`?

1. The command needs the documenation output in order to figure out the
diagnostics.
1. `deno lint` doesn't understand where the entrypoints are. That's
critical for the diagnostics to be useful.
1. It's much more performant to do this while generating documentation.
1. There is precedence in rustdoc (ex. `#![warn(missing_docs)]`).

## Why not `--check`?

It is confusing with `deno run --check`, since that means to run type
checking (and confusing with `deno check --docs`).

## Output Future Improvement

The output is not ideal atm, but it's fine for a first pass. We will
improve it in the future.

Closes https://github.com/denoland/deno_lint/pull/972
Closes https://github.com/denoland/deno_lint/issues/970
Closes https://github.com/denoland/deno/issues/19356
2023-10-31 18:19:42 -04:00
Matt Mastracci e4308aebc0
feat(ext/websocket): use rustls-tokio-stream instead of tokio-rustls (#20518)
Use new https://github.com/denoland/rustls-tokio-stream project instead
of tokio-rustls for direct websocket connections. This library was
written from the ground up to be more reliable and should help with
various bugs that may occur due to underlying bugs in the old library.

Believed to fix #20355, #18977, #20948
2023-10-31 09:34:45 -06:00
David Sherret 092555c611
refactor: update to deno_doc 0.71 (#21023) 2023-10-31 09:19:43 +05:30
Bartek Iwańczuk 48c5c3a3fb
feat(doc): support multiple file entry (#21018)
This commit adds support for multiple entry points to `deno doc`.

Unfortunately to achieve that, I had to change the semantics of the
command to explicitly require `--filter` parameter for filtering
symbols, instead of treating second free argument as the filter argument.

`deno doc --builtin` is still supported, but cannot be mixed with
actual entrypoints.
2023-10-30 23:58:57 +01: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
Bartek Iwańczuk 6e2abb2b13
chore: update deno_std submodule (#20994) 2023-10-27 10:34:30 -04: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 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
David Sherret 59a5fe530f
refactor: upgrade to deno_ast 0.31 and deno_graph 0.59 (#20965) 2023-10-24 21:43:19 +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
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
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
Nayeem Rahman 2fb9ddd2e6
chore(task): remove warning for npm "scripts" (#20880) 2023-10-12 07:33:59 +01:00
Leo Kettmeir 8ba1242a05
feat(WebSocketStream): rename connection to opened (#20878) 2023-10-11 07:31:05 +02:00
Nayeem Rahman 0606c11403
fix(bench): use total time when measuring wavg (#20862) 2023-10-10 14:40:36 +01: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
Nayeem Rahman ac464ead49
feat(jupyter): support Deno.test() (#20778) 2023-10-05 21:45:11 +01: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
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
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
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
Nayeem Rahman 98ef7bd818
fix(lsp): resolve remote import maps (#20651) 2023-09-24 18:00:15 +01:00
Kyle Kelley 788bc8d021
fix(cli): Enhanced errors for Jupyter (#20530) 2023-09-18 22:07:33 +00: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
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
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
Nayeem Rahman 11f0ccf805
fix(test): share fail fast tracker between threads (#20515) 2023-09-15 15:46:48 +00:00
Bartek Iwańczuk 5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02: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
Marvin Hagemeister 9d1385896f
fix: exclude internal JS files from coverage (#20448) 2023-09-11 13:53:42 +00: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 3fc19dab47
feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
Nayeem Rahman 2cbd1b40cb
fix(test): apply filter before checking for "only" (#20389) 2023-09-06 17:07:37 +01:00