Commit graph

528 commits

Author SHA1 Message Date
David Sherret b7945a218e
chore: move cert itests to spec tests (#23607) 2024-05-03 00:43:12 +00:00
Bartek Iwańczuk cf0579c7d4
test: npm registry handles two test scopes (#23663)
This commit updates our testing npm registry to handle
additional `@denotest2` scope in addition to `@denotest`
scope. I might have to update it further in the future to handle
additional scopes, but it's good enough for now.
2024-05-03 00:00:38 +00:00
Leo Kettmeir 1b27b58396
fix(test): proper type checking for files with doc tests (#23654)
Closes https://github.com/denoland/deno/issues/23430

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-05-02 18:13:51 +00:00
Satya Rohith 56ba7f3c23
fix(ext/node): support delete process.env.var (#23647)
Closes https://github.com/denoland/deno/issues/23641
2024-05-02 06:40:22 +00:00
Matt Mastracci 505130d813
chore(cli): add permission test (#23633) 2024-05-01 13:17:05 -06:00
David Sherret e0069c87c0
chore: make a couple repl tests less flaky (#23636)
These were both failing for me from time to time locally.
2024-05-01 16:37:17 +00:00
David Sherret 56bf634fa9
fix(node): require.resolve - fallback to global cache when bare specifier from paths not found (#23618)
Part of #22607 (probably closes it, but I haven't done thorough testing)

Makes it so that `require.resolve` with `paths` specified will fallback
to using the global cache when the paths can't be found when using a
global cache (not when using a node_modules folder)
2024-04-30 23:41:29 -04:00
David Sherret f2216c90a7
chore: fix flaky module graph cache tests (#23623) 2024-05-01 01:36:52 +00:00
Nayeem Rahman ac9e07bdfa
chore(lsp): revert import map pre-resolution for jsxImportSource (#23619) 2024-05-01 01:44:20 +01:00
Luca Casonato 6cdf81db7c
feat(cli): add support for jsxImportSourceTypes (#23419)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-04-30 18:12:35 +00:00
Satya Rohith 0156f82e73
fix(ext/node): support multiple message listeners on MessagePort (#23600)
Closes https://github.com/denoland/deno/issues/23561
2024-04-30 16:59:39 +05:30
Kenta Moriuchi 783533d2e3
FUTURE: remove import assertions support for JavaScript (#23541)
Ref #17944, https://github.com/swc-project/swc/issues/8893

TypeScript removes the `assert` keywords in the transpile, so this PR
only works for JavaScript files
2024-04-29 22:43:05 +02:00
David Sherret 4384a126bb
fix: handle specifying an import map in an ancestor dir of deno.json (#23602)
* https://github.com/denoland/deno_config/pull/51

Closes https://github.com/denoland/deno/issues/21440
2024-04-29 14:32:27 -04:00
David Sherret 48daf2dc88
chore: add tests for moduleGraph2 (#23603)
Also did some renames from underscores to hyphens
2024-04-29 14:09:58 -04:00
Matt Mastracci 56fec538e1
fix(ext/http): ensure signal is created iff requested (#23601)
This correctly creates the `AbortSignal` regardless of when we request
it. If the signal is requested after the request has completed, the
signal is created in the aborted state.

Using GC counts, we can see a reduction in object creation:

This PR: 440
deno 1.42.4: 1650
deno 1.43.0+b02ffec: 874
2024-04-29 09:40:02 -06:00
David Sherret da52058a94
chore: migrate bench, publish, and more itests to spec tests (#23584) 2024-04-29 10:08:27 -04:00
Divy Srivastava b02ffec37c
fix(ext/node): exporting rsa public keys (#23596)
Initial support for exporting rsa public KeyObject.

Current assumption is that RSA keys are stored in pkcs1 der format in
key storage.

Ref https://github.com/denoland/deno/issues/23471 
Ref https://github.com/denoland/deno/issues/18928
Ref https://github.com/denoland/deno/issues/21124
2024-04-29 19:16:38 +05:30
Satya Rohith b8444066ea
fix(ext/node): support NODE_DEBUG env (#23583) 2024-04-29 09:36:53 +00:00
Satya Rohith 455cf1743f
fix(ext/node): add support for MessagePort.removeListener/off (#23598)
Closes https://github.com/denoland/deno/issues/23564
2024-04-29 08:53:54 +00:00
David Sherret 651e3e9e6d
fix(compile): certain jsr specifiers sometimes can't load (#23567)
When returning a jsr specifier for resolve it seems like deno core does
not work properly and hangs.

Closes https://github.com/denoland/deno/issues/23551
Closes https://github.com/denoland/deno/issues/23139
2024-04-27 21:11:57 +00:00
Yoshiya Hinosawa 8178f758bc
fix(ext/node): support process.stdin.unref() (#22865)
This PR adds private `[REF]()` and `[UNREF]()` methods to Stdin class,
and call them from Node.js polyfill layer (`TTY` class). This enables
`process.stdin.unref()` and `process.stdin.ref()` for the case when
stdin is terminal.

closes #21796
2024-04-27 20:25:18 +09:00
Bartek Iwańczuk e3d79c1703
test: cleanup npm test registry code (#23578)
Required for https://github.com/denoland/deno/pull/23560
2024-04-26 22:55:43 +02:00
Leo Kettmeir c519355624
feat(ci): category & unstable tags checker (#23568) 2024-04-26 09:04:29 -07:00
Bartek Iwańczuk 0b0af5c635
test: update for private npm registry test server (#23572)
Factored out from https://github.com/denoland/deno/pull/23560 to make it
easier to review.
2024-04-26 15:41:53 +00:00
Matt Mastracci 8c9caeb418
chore: rework TLS code in test server (#23566)
In order to make the reqwest/rustls upgrade more straightforward, we
refactor the test server to depend on deno_tls.
2024-04-25 17:00:04 -04:00
Bartek Iwańczuk 115dedde22
fix: unref stdin read (#23534)
Closes https://github.com/denoland/deno_core/issues/648

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-25 05:32:01 +00:00
David Sherret f3284529f1
feat(jsr): support importing from jsr via HTTPS specifiers (except for type checking) (#23513)
Closes https://github.com/jsr-io/jsr/issues/322
2024-04-24 21:43:34 +00:00
Leo Kettmeir 5a7414e163
chore: update deno_doc (#23544) 2024-04-24 20:34:21 +00:00
Nayeem Rahman ac71d876d7
fix(lsp): inherit missing fmt and lint config from parent scopes (#23547) 2024-04-24 22:14:01 +02:00
Matt Mastracci 2f8825a935
feat: Add deno serve subcommand (#23511)
By default, `deno serve` will assign port 8000 (like `Deno.serve`).
Users may choose a different port using `--port`.

`deno serve /tmp/file.ts`

`server.ts`:
```ts
export default {
  fetch(req) {
    return new Response("hello world!\n");
  },
};
```
2024-04-24 19:45:49 +00:00
David Sherret ded6afccf2
fix(publish): --dry-publish should error for gitignored excluded files (#23540)
Files that were gitignored only were not included in the diagnostic.
2024-04-24 18:52:05 +00:00
Matt Mastracci da70608700
fix(ext/net): check for TLS using undefined rather than using ReflectHas (#23538)
Fixes #23537
2024-04-24 14:27:15 -04:00
Matt Mastracci eed2598e6c
feat(ext/http): Implement request.signal for Deno.serve (#23425)
When the response has been successfully send, we abort the
`Request.signal` property to indicate that all resources associated with
this transaction may be torn down.
2024-04-24 14:03:37 -04:00
Matt Mastracci b60822f6e0
chore: use deno_unsync through deno_core (#23532) 2024-04-24 16:57:34 +00:00
Bartek Iwańczuk b424959d3e
fix(ext/node): worker_threads copies env object (#23536)
Most common argument to `env` option for `worker_threads.Worker` will be
`process.env`.

In Deno `process.env` is a `Proxy` which can't be cloned using
structured clone algorithm.

So to be safe, I'm creating a copy of actual object before it's sent to
the worker thread.

Ref #23522
2024-04-24 16:17:28 +00:00
Bartek Iwańczuk 90a167a1a2
test: add private npm registry (#23510)
This commit adds a "private npm registry" to the test server. This
registry requires to send an appropriate Authorization header.

Towards https://github.com/denoland/deno/issues/16105
2024-04-23 22:54:34 +02:00
Kenta Moriuchi aff7a64544
fix: Float16Array support (#23512)
Ref #23490, #23277

* remove `--js-float16array` flag (This flag has already added to
deno_core)
* add some `Float16Array` support
2024-04-23 22:54:19 +02:00
Nathan Whitaker 8a367d3cc3
fix(cli): Don't panic on invalid emit options (#23463)
Fixes #23456.
2024-04-23 08:50:50 -07:00
Bartek Iwańczuk 35220f0069
fix(workspace): provide workspace members as 'imports' in import map (#23492)
This commit changes the workspace support to provide all workspace
members to be available as imports based on their names and versions.

Closes https://github.com/denoland/deno/issues/23343
2024-04-23 17:21:06 +02:00
Bartek Iwańczuk b0d3b20f23
feat: enable Float16Array support (#23490)
Closes https://github.com/denoland/deno/issues/23450
2024-04-23 15:18:27 +00:00
Nayeem Rahman 5990f05360
fix(lsp): remove Document::open_data on close (#23483) 2024-04-22 19:24:00 +01:00
Marvin Hagemeister 9686a8803e
feat: add jsx precompile skip element option (#23457)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/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.
-->
This PR wires up a new `jsxPrecompileSkipElements` option in
`compilerOptions` that can be used to exempt a list of elements from
being precompiled with the `precompile` JSX transform.
2024-04-22 17:07:36 +02:00
Nathan Whitaker aac7a8cb7c
perf(lsp): Batch "$projectChanged" notification in with the next JS request (#23451)
The actual handling of `$projectChanged` is quick, but JS requests are
not. The cleared caches only get repopulated on the next actual request,
so just batch the change notification in with the next actual request.

No significant difference in benchmarks on my machine, but this speeds
up `did_change` handling and reduces our total number of JS requests (in
addition to coalescing multiple JS change notifs into one).
2024-04-22 08:03:16 -07:00
Asher Gomez 2f5a6a8514
FUTURE(ext/net): remove Deno.ConnectTlsOptions.(certFile|certChain|privateKey) (#23270)
Towards #23089

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-04-21 03:03:44 +00:00
Bartek Iwańczuk 14ae4f897f
fix(ext/node): define http.maxHeaderSize (#23479)
Closes https://github.com/denoland/deno/issues/23432
2024-04-21 07:31:23 +05:30
Asher Gomez 98e2f6d50b
FUTURE(ext/net): remove Deno.ListenTlsOptions.(keyFile|certFile) (#23271)
Towards #23089

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-04-21 01:58:59 +00:00
David Sherret 695f314a91
feat(task): support running npm binary commands in deno.json (#23478)
npm binary commands like `vite` from a `node_modules/.bin` folder will
now execute when defined in a deno.json

Closes https://github.com/denoland/deno/issues/23477
2024-04-20 20:13:46 -04:00
welfuture e55087f57a
fix: Fix some typos in comments (#23470)
Signed-off-by: welfuture <wellfuture@qq.com>
2024-04-21 01:54:07 +02:00
David Sherret db3b3fb665
chore: auto-complete for __spec__.jsonc file (#23476)
This makes writing these tests a little easier.
2024-04-20 22:47:10 +00:00
Divy Srivastava c0f40ed81a
fix(ext/node): implement process.kill in Rust (#23130)
Closes https://github.com/denoland/deno/issues/23056
2024-04-20 18:55:07 +05:30
Divy Srivastava 04c6785fae
fix(ext/node): cp into non-existent parent directory (#23469)
Fixes https://github.com/denoland/deno/issues/20604
2024-04-20 11:41:27 +00:00
Divy Srivastava e0554ac4a2
fix(ext/node): Support env option in worker_thread (#23462)
Fixes https://github.com/denoland/deno/issues/23455
2024-04-20 09:18:10 +05:30
Matt Mastracci 472a370640
feat(runtime): Allow embedders to perform additional access checks on file open (#23208)
Embedders may have special requirements around file opening, so we add a
new `check_open` permission check that is called as part of the file
open process.
2024-04-19 18:12:03 -06:00
Matt Mastracci 365e1f48f7
feat(ext/http): Add addr to HttpServer (#23442)
Adds an `addr` field to `HttpServer` to simplify the pattern
`Deno.serve({ onListen({ port } => listenPort = port })`. This becomes:
`const server = Deno.serve({}); port = server.addr.port`.

Changes:
- Refactors `serve` overloads to split TLS out (in preparation for
landing a place for the TLS SNI information)
- Adds an `addr` field to `HttpServer` that matches the `addr` field of
the corresponding `Deno.Listener`s.
2024-04-19 18:09:50 -06:00
Asher Gomez 05b49a803f
FUTURE: remove Deno.customInspect (#23453) 2024-04-19 20:50:18 +10:00
David Sherret c497e766f1
refactor: move redirect handling into deno_graph (#23444) 2024-04-19 01:43:28 +00:00
Bartek Iwańczuk 9e4ba982df
test: fix node_compat_test (#23446)
It's not clear to me how these tests worked correctly on CI,
 but they were failing hard locally because of two problems:
- missing env var that tests URL for fake npm registry
- trying to run a directory that contains native Node.js tests that
require a special harness
2024-04-19 01:42:18 +02:00
Bartek Iwańczuk 7b02f2aba6
test: deflake tests for rejection handled (#23448)
Fixes flakiness for rejection handled tests on Windows (7 failures in
the past day).
2024-04-18 23:40:15 +00:00
nokazn 3d841acf48
fix(cli): avoid deno add and deno vendor errors when deno.json is empty (#23439) 2024-04-18 15:48:15 -04:00
Matt Mastracci d9d3f81f29
chore: remove unused, unstable 'http' namespace (#23436)
Landing parts of #21903 in preparation for the removal of serveHttp.
2024-04-18 11:21:25 -06:00
Bartek Iwańczuk 6a09a16d71
feat(ext/net): extract TLS key and certificate from interfaces (#23327)
Relands #23325
2024-04-18 11:21:08 -06:00
Matt Mastracci 5e2a747685
fix(ext/node): Correctly send ALPN on node TLS connections (#23434)
Landing work from #21903, plus fixing a node compat bug.

We were always sending the HTTP/2 ALPN on TLS connections which might
confuse upstream servers.

Changes:
- Configure HTTP/2 ALPN when making the TLS connection from the HTTP/2
code
- Read the `ALPNProtocols` property from the TLS connection options
rather than the deno `alpnProtocols` field
 - Add tests

Prereq for landing Deno.serveHttp on Deno.serve: removing older HTTP
servers from the codebase.
2024-04-18 09:37:47 -06:00
Asher Gomez 25a80bc523
test(publish): check specifiers outside fast check module graph (#23369)
Closes #23023
2024-04-17 23:46:33 +00:00
Igor Zinkovsky b3d7df5535
perf: v8 code cache (#23081)
This PR enables V8 code cache for ES modules and for `require` scripts
through `op_eval_context`. Code cache artifacts are transparently stored
and fetched using sqlite db and are passed to V8. `--no-code-cache` can
be used to disable.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17 07:19:55 -07:00
Asher Gomez 9acbf90b06
fix: allow WPT to successfully exit using --exit-zero (#23418)
I went with `--exit-zero`. Happy to change to `--no-exit` if feelings
are strong.

Supercedes #23417
2024-04-17 10:40:47 +00:00
Asher Gomez ebc22d9d7e
chore: update WPT (#23389)
It's best that this only gets merged with the latest version of the
suite, so there's little difference between the `ci` and `wpt_epoch`
workflows. This should make troubleshooting easier.
2024-04-17 09:33:05 +10:00
Matt Mastracci 9c0446567b
fix(cli): Identify and fix a test deadlock (#23411)
If a worker tried to flush large amounts of data right as the test was
ending, it could cause the flush sync marker to get lost.
2024-04-16 15:14:59 -06:00
David Sherret 43c8c1cc6e
feat(check): allow using side effect imports with unknown module kinds (ex. css modules) (#23392)
This allows people to use imports like:

```ts
import "./app.css";
```

...with `deno check` in systems where there's a bundle step (ex. Vite).
This will still error when using it with `deno run` or if the referenced
file does not exist.

See test cases for behaviour.
2024-04-16 16:46:31 -04:00
Nathan Whitaker 422cff1f24
chore(lsp): Add benchmark for performance on a large real-world repo (#23395)
This PR adds a benchmark intended to measure how the LSP handles larger
repos, as well as its performance on a more realistic workload.

The repo being benchmarked is
[deco-cx/apps](https://github.com/deco-cx/apps) which has been vendored
along with its dependencies. It's included as a git submodule as its
fairly large. The LSP requests used in the benchmark are the actual
requests sent by VSCode as I opened, modified, and navigated around a
file (to simulate an actual user interaction).

The main motivation is to have a more realistic benchmark that measures
how we do with a large number of files and dependencies. The
improvements made from 1.42 to 1.42.3 mostly improved performance with
larger repos, so none of our existing benchmarks showed an improvement.

Here are the results for the changes made from 1.42 to 1.42.3 (the new
benchmark is the last one listed):

**1.42.0**

```test
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 379ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1142ms)
   - Find/Replace
      (10 runs, mean: 51ms)
   - Code Lens
      (10 runs, mean: 443ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 25121ms)
<- End benchmarking lsp
```

**1.42.3**

```text
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1135ms)
   - Find/Replace
      (10 runs, mean: 55ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 11675ms)
<- End benchmarking lsp
```
2024-04-16 12:26:51 -07:00
Bartek Iwańczuk 760d64bc6b
fix(ext/node): worker_threads.receiveMessageOnPort doesn't panic (#23406)
Follow up to https://github.com/denoland/deno/pull/23386.
Instead of using async `recv()` method, it was replaced
with a poll based function that doesn't hold onto
RefCell borrow across await point.

Fixes https://github.com/denoland/deno/issues/23362
2024-04-16 18:41:03 +00:00
Kenta Moriuchi 1e26508579
feat(ext/url): add URL.parse (#23318)
Closes #23069
2024-04-16 17:11:57 +02:00
Satya Rohith 50223c5c53
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342
Closes https://github.com/denoland/deno/issues/21757
2024-04-16 13:45:41 +00:00
Bartek Iwańczuk 55c27cadc8
test: add test for running in V8 jitless mode (#23054)
Fixes https://github.com/denoland/deno/issues/22453

This is fixed due to upgrade of deno_core, just adding
a test here.
2024-04-15 23:47:01 +00:00
Bartek Iwańczuk 0b8d7d1d4b
fix(ext/node): panic on 'worker_threads.receiveMessageOnPort' (#23386)
Closes https://github.com/denoland/deno/issues/23362

Previously we were panicking if there was a pending read on a
port and `receiveMessageOnPort` was called. This is now fixed
by cancelling the pending read, trying to read a message and
resuming reading in a loop.
2024-04-16 01:06:39 +02:00
David Sherret 6f278e5c40
fix(lsp): improved cjs tracking (#23374)
Our cjs tracking was a bit broken. It was marking stuff as esm that was
actually cjs leading to type checking errors.
2024-04-15 17:50:52 -04:00
Divy Srivastava f36a8951a4
fix(ext/node): add stub for AsyncResource#asyncId() (#23372)
Ref https://github.com/denoland/deno/issues/23263
2024-04-15 12:54:42 +00:00
Divy Srivastava 402d59eea9
fix(ext/node): promise rejection in VM contexts (#23305)
Fixes https://github.com/denoland/deno/issues/23297

`docusaurus build` works!

```
$ deno run -A repro.js 
fish: Job 1, 'deno run -A ../../littledivy/fs…' terminated by signal SIGSEGV (Address
 boundary error)
$ denod run -A repro.js
error: Uncaught (in promise) Error: rejected
```

Depends on https://github.com/denoland/deno_core/pull/693
2024-04-13 17:02:07 +05:30
David Sherret 4e8d30fca1
chore(test): use file_test_runner for spec tests (#23348)
Extracted out this code to https://github.com/denoland/file_test_runner
and added parallelism. This makes these tests run 6 seconds faster on my
machine and allows re-using this code in other crates like deno_graph,
deno_doc, etc (ex. https://github.com/denoland/deno_graph/pull/437).
2024-04-12 17:58:40 -04:00
Divy Srivastava c56f2e0fc0
chore: upgrade deno_core to 0.274.0 (#23344)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-12 21:45:38 +02:00
Bartek Iwańczuk f3cddb9688
test(compile): dynamic JSR imports are working correctly (#23306)
Adds a test that ensure that dynamic import from JSR are working
correctly for `deno compile`.
2024-04-12 12:27:34 +02:00
David Sherret 98077e4b3c
fix(publish): do not warn about excluded external modules in node_modules directory (#23173) 2024-04-11 23:52:35 +00:00
Bartek Iwańczuk f358ae6278
fix(inspector): don't panic if port is not free (#22745)
Closes https://github.com/denoland/deno/issues/22113
Closes https://github.com/denoland/deno/issues/23177
Closes https://github.com/denoland/deno/issues/22883
Closes https://github.com/denoland/deno/issues/22377
2024-04-12 01:17:10 +02:00
David Sherret ade0cd5e97
fix: upgrade deno_ast related crates (#23187)
Had to revert back swc due to
https://github.com/swc-project/swc/issues/8840

Fixes:

- https://github.com/denoland/deno_lint/pull/1262
- https://github.com/denoland/deno_doc/pull/538
- https://github.com/denoland/deno_doc/pull/537
- https://github.com/denoland/deno_graph/pull/430
- https://github.com/denoland/deno_graph/pull/425
- https://github.com/denoland/deno_graph/pull/432
2024-04-11 23:00:17 +00:00
Bartek Iwańczuk 5758470ee4
Revert "refactor(ext/net): extract TLS key and certificate from inter… (#23325)
…faces (#23296)"

This reverts commit e190acbfa8.

Reverting because it broke stable API type declarations. We will reland
it for v1.43 with updated interfaces
2024-04-11 20:31:11 +00:00
David Sherret df73db671b
fix(npm): local nodeModulesDir was sometimes resolving duplicates of same package (#23320) 2024-04-11 13:18:19 -04:00
Nathan Whitaker 736f73b008
perf(lsp): Only evict caches on JS side when things actually change (#23293)
Currently we evict a lot of the caches on the JS side of things on every
request, namely script versions, script file names, and compiler
settings (as of #23283, it's not quite every request but it's still
unnecessarily often).

This PR reports changes to the JS side, so that it can evict exactly the
caches that it needs too. We might want to do some batching in the
future so as not to do 1 request per change.
2024-04-10 18:06:37 -07:00
林炳权 9304126be5
chore: update to Rust 1.77.2 (#23262)
update to Rust 1.77.2


---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-10 22:08:23 +00:00
Asher Gomez c6f1107e9c
chore: update references to deno_std to use JSR (#23239)
There are more uses of `deno.land/std` in the codebase, but for URL
parsing purposes rather than network calls or documentation.
2024-04-10 17:26:35 -04:00
Nayeem Rahman 7c5745a204
refactor(lsp): cleanup documents dependents calculation (#23295) 2024-04-10 19:58:49 +01:00
Matt Mastracci e190acbfa8
refactor(ext/net): extract TLS key and certificate from interfaces (#23296)
Removes the certificate options from all the interfaces and replaces
them with a new `TlsCertifiedKeyOptions`. This allows us to centralize
the documentation for TLS key management for both client and server, and
will allow us to add key object support in the future.

Also adds an option `keyFormat` field to the cert/key that must be
omitted or set to `pem`. This will allow us to load other format keys in
the future `der`, `pfx`, etc.

In a future PR, we will add a way to load a certified key object, and we
will add another option to `TlsCertifiedKeyOptions` like so:

```ts
export interface TlsCertifiedKeyOptions =
    | TlsCertifiedKeyPem
    | TlsCertifiedKeyFromFile
    | TlsCertifiedKeyConnectTls
    | { key: Deno.CertifiedKey }
```
2024-04-09 16:23:22 -06:00
Satya Rohith 5a3ee6d9af
fix(ext/node): implement MessagePort.unref() (#23278)
Closes https://github.com/denoland/deno/issues/23252
Closes https://github.com/denoland/deno/issues/23264
2024-04-09 20:15:55 +02:00
Divy Srivastava fad12b7c2e
fix(ext/node): node:vm contexts (#23202)
Implement contextified objects in `node:vm`

Fixes https://github.com/denoland/deno/issues/23186
Fixes https://github.com/denoland/deno/issues/22395
Fixes https://github.com/denoland/deno/issues/20607
Fixes https://github.com/denoland/deno/issues/18299
Fixes https://github.com/denoland/deno/issues/19395
Fixes https://github.com/denoland/deno/issues/18315
Fixes https://github.com/denoland/deno/issues/18319
Fixes https://github.com/denoland/deno/issues/23183
2024-04-09 21:24:25 +05:30
Matt Mastracci 47061a4539
feat(ext/net): Refactor TCP socket listeners for future clustering mode (#23037)
Changes:

- Implements a TCP socket listener that will allow for round-robin
load-balancing in-process.
 - Cleans up the raw networking code to make it easier to work with.
2024-04-08 16:18:14 -06:00
Bartek Iwańczuk d3b63bb315
fix(ext/http): Make Deno.serveHttp() work when proxying (#23269)
Closes https://github.com/denoland/deno/issues/21900
2024-04-08 15:02:49 -06:00
Bartek Iwańczuk b7d716e8a3
test: use unordered assertion for node worker test (#23288)
This ordering of events is important here, but it's very hard to get
right.

In the meantime to avoid flakes I'm adding an unordered assertion.
2024-04-08 19:51:37 +00:00
Asher Gomez 03b84197a0
chore: update WPT (#23111)
Should fix some of the current issues with the `wpt_epoch` workflow.

See
https://github.com/denoland/deno/actions/runs/8460701853/job/23179358486

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-08 20:46:53 +02:00
MAKS11060 e3833b5a52
fix(ext/tls): add support EC private key (#23261)
Deno works with the `EC` key, but cannot recognize it.
This code works correctly if the prefix 'EC' is removed.

```typescript
const cert = `-----BEGIN CERTIFICATE-----
MIICqjCCAZKgAwIBAgIULvZQk8us6eYdpKZraHVkW8YKL/IwDQYJKoZIhvcNAQEL
BQAwJzELMAkGA1UEBhMCVVMxGDAWBgNVBAMMD0V4YW1wbGUtUm9vdC1DQTAgFw0y
NDA0MDYwNzM4MDlaGA8yMTIzMDMxNDA3MzgwOVowbTELMAkGA1UEBhMCVVMxEjAQ
BgNVBAgMCVlvdXJTdGF0ZTERMA8GA1UEBwwIWW91ckNpdHkxHTAbBgNVBAoMFEV4
YW1wbGUtQ2VydGlmaWNhdGVzMRgwFgYDVQQDDA9sb2NhbGhvc3QubG9jYWwwWTAT
BgcqhkjOPQIBBggqhkjOPQMBBwNCAATWOALcgzz4LbNikhjVGpkOCUmR8NahjfFw
9pNBuyZnaTcjfeGfiPaV0iQqvTuQnmL+fTBw8PKxzlKGpzsodQaWo1EwTzAfBgNV
HSMEGDAWgBTzut+pwwDfqmMYcI9KNWRDhxcIpTAJBgNVHRMEAjAAMAsGA1UdDwQE
AwIE8DAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBABWp
5LsGj5mWGIy7XpksXb0k2e3fUh+CobNl4JbvE7em68nuyojm0+/vEs8Bpd9vJaUo
tU1btyTO8xUlOGeyNa9Ddd2gj3oB8IGMjxhazWTSDseZ/WqBt6OudPMmnj+jPRQL
8Hb0vyXfmabZnWO9WH9/tcCoGdUdKo2KYN/7M2ojSeRq/4BIL08lC2SVX8DlBG40
8aj3FJo9xsUG59NI31iXVN1UPEN2pakKRJdSVdpbBjxDaEoLw/TB02gqfA43T1fU
wKz+0UYxSCjeW0lOZ3wlaNN2KqiHLuQ6ePG5kqD8aRufmYWK/ImlO/ZiSX60GiPu
K1cC6aWEohOhx+k424Y=
-----END CERTIFICATE-----`
const key = `-----BEGIN EC PRIVATE KEY-----
MHcCAQEEILL8H0x2ZP/ZZ+CwmKLS/zRleO7k7NBgWH0P767zYvlVoAoGCCqGSM49
AwEHoUQDQgAE1jgC3IM8+C2zYpIY1RqZDglJkfDWoY3xcPaTQbsmZ2k3I33hn4j2
ldIkKr07kJ5i/n0wcPDysc5Shqc7KHUGlg==
-----END EC PRIVATE KEY-----`

const config: Deno.ServeTlsOptions = {
  cert,
  // key, // not working // error: Uncaught (in promise) InvalidData: No keys found in key file
  key: key.replaceAll(' EC', ''), // remove ' EC'. it works
}

Deno.serve(config, (r) => Response.json('ok'))
```
2024-04-08 11:36:34 -06:00
Yoshiya Hinosawa 2670c1d580
fix(ext/node): out-of-order writes of fs.createWriteStream (#23244)
This PR follows this fix (https://github.com/nodejs/node/pull/52005) in
Node.js.

Stream's construct callback happens one tick earlier by this change, and
it prevents the reordering of the first few chunks in
`node:stream.Writable`

closes #20284
2024-04-08 12:47:34 +09:00
Asher Gomez 49f6e2e79e
FUTURE(ext/net): remove Deno.(Conn|TlsConn|Listener|TlsListener|UnixConn).prototype.rid (#23219)
Towards #23089

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-04-08 08:59:37 +10:00
Asher Gomez 9b34b7ed18
FUTURE(ext/fs): remove Deno.FsWatcher.prototype.rid (#23234) 2024-04-07 17:46:39 +10:00