Commit graph

5351 commits

Author SHA1 Message Date
denobot 41877a0b37
1.38.0 (#21051)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-02 01:01:47 +00:00
Asher Gomez d7348c870a
fix: add missing Object.groupBy() and Map.groupBy() types (#21050) 2023-11-01 23:18:41 +00:00
David Sherret 58d543a480
fix(repl): jsxImportSource was not working (#21049)
I made some fixes in deno_ast to make this possible and we forgot to
update this.
2023-11-01 23:04:54 +00:00
Bartek Iwańczuk ab72019a17
feat: enable Array.fromAsync (#21048) 2023-11-01 22:25:18 +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
Matt Mastracci 658f958fb8
chore(cli): bump zeromq dep (#21045)
Reduces the number of crates we need to build pretty significantly
(approx 20).
2023-11-01 20:20:50 +00:00
David Sherret 02822d309f
fix(test): --junit-path should handle when the dir doesn't exist (#21044)
Closes https://github.com/denoland/deno/issues/21022
2023-11-01 19:59:51 +00:00
Luca Casonato d42f154312
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.

Closes #20839

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Bartek Iwańczuk 1d19b1011b
chore: upgrade deno_core (#21036)
Updated to deno_core 0.224.0 and V8 12.0.

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-11-01 20:25:09 +01:00
Igor Zinkovsky 01d3e0f317
feat(cron) implement Deno.cron() (#21019)
This PR adds unstable `Deno.cron` API to trigger execution of cron jobs.

* State: All cron state is in memory. Cron jobs are scheduled according
to the cron schedule expression and the current time. No state is
persisted to disk.
* Time zone: Cron expressions specify time in UTC.
* Overlapping executions: not permitted. If the next scheduled execution
time occurs while the same cron job is still executing, the scheduled
execution is skipped.
* Retries: failed jobs are automatically retried until they succeed or
until retry threshold is reached. Retry policy can be optionally
specified using `options.backoffSchedule`.
2023-11-01 11:57:55 -07:00
Divy Srivastava 82643857cc
Revert "chore: use kqueue backend of notify on macOS" (#21039)
Reverts denoland/deno#21028

Reason:
https://github.com/notify-rs/notify/blob/main/notify/src/kqueue.rs#L79-L81
Need to wait for the watcher thread to spawn otherwise we hit flakes

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-11-01 15:54:27 +00:00
Bartek Iwańczuk 8ea2d926a9
feat: deno doc --html (#21015)
This commit adds static documentation site generate to "deno doc"
subcommand.

Example:
```
$ deno doc --html --name="My library" ./mod.ts
# outputs to ./docs/

$ deno doc --html --name="My library" --output=./documentation/ ./mod.ts ./file2.js
# outputs to ./documentation/

$ deno doc --html --name="My library" ./**/mod.ts
# generate docs for all files with "mod.ts" name
```

Closes https://github.com/denoland/deno/issues/8233
2023-11-01 15:25:05 +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
Bartek Iwańczuk 53248e9bb3
fix(repl): support transforming JSX/TSX (#20695)
Closes https://github.com/denoland/deno/issues/16771

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-01 14:42:54 +01: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
Kenta Moriuchi 841f215fd4
fix(ext/node): adapt dynamic type checking to Node.js behavior (#21014) 2023-11-01 16:06:25 +09: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
Divy Srivastava 6dd96af1ec
chore: update macOS shared library test (#21031) 2023-10-31 17:39:07 +00:00
Leo Kettmeir 39716183ac
feat(ext/web): EventSource (#14730)
Closes #10298

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-10-31 18:16:27 +01:00
Divy Srivastava 646afdf259
chore: use kqueue backend of notify on macOS (#21028)
Towards #20996 

"macos_fsevent" feature of notify links us to CoreFoundation on macOS.
2023-10-31 16:43:04 +00: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
Divy Srivastava ba6bd444b6
perf: use deno_native_certs crate (#18072)
Fixes #18071 

Replace `rustls_native_certs` which links to Security framework.
https://github.com/denoland/deno_native_certs uses dlopen to lazy load
when needed.
2023-10-31 12:55:46 +01:00
Luca Casonato 2d9298f5f5
chore: update ext/kv to use denokv_* crates (#20986)
This commit updates the ext/kv module to use the denokv_* crates for
the protocol and the sqlite backend. This also fixes a couple of bugs in
the sqlite backend, and updates versionstamps to be updated less
linearly.
2023-10-31 11:13:57 +00:00
David Sherret 092555c611
refactor: update to deno_doc 0.71 (#21023) 2023-10-31 09:19:43 +05:30
Bartek Iwańczuk 1713df1352
feat: deno run --unstable-hmr (#20876)
This commit adds `--unstable-hmr` flag, that enabled Hot Module Replacement.

This flag works like `--watch` and accepts the same arguments. If
HMR is not possible the process will be restarted instead.

Currently HMR is only supported in `deno run` subcommand.

Upon HMR a `CustomEvent("hmr")` will be dispatched that contains
information which file was changed in its `details` property.

---------

Co-authored-by: Valentin Anger <syrupthinker@gryphno.de>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-10-31 01:25:58 +01:00
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
Matt Mastracci b75f3b5ca0
feat(ext/websocket): split websocket read/write halves (#20579)
Fixes some UB when sending and receiving at the same time.
2023-10-30 11:49:19 -06:00
Divy Srivastava 09204107d8
fix: implement node:tty (#20892)
Fixes #21012
Closes https://github.com/denoland/deno/issues/20855
Fixes https://github.com/denoland/deno/issues/20890
Fixes https://github.com/denoland/deno/issues/20611
Fixes https://github.com/denoland/deno/issues/20336
Fixes `create-svelte` from https://github.com/denoland/deno/issues/17248

Fixes more reports here:
- https://github.com/denoland/deno/issues/6529#issuecomment-1432690559
- https://github.com/denoland/deno/issues/6529#issuecomment-1522059006
- https://github.com/denoland/deno/issues/6529#issuecomment-1695803570
2023-10-30 15:53:08 +00:00
Divy Srivastava 1acef755ca
chore: remove usage of chrono::Utc::now() (#20995)
Remove usage of Chrono's clock feature which pulls in iana-time-zone ->
core-foundation
2023-10-30 11:45:45 -04:00
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