0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-24 14:11:58 -05:00
Commit graph

11180 commits

Author SHA1 Message Date
Bartek Iwańczuk
e9cf8ffc26
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-12 02:08:31 +02:00
Nathan Whitaker
68c6d06e38
fix(lsp): Denormalize specifiers before calling $projectChanged (#23322)
Fixes the regression described in
https://github.com/denoland/deno/pull/23293#issuecomment-2049819724.
This affected jupyter notebooks, as the LSP was passing in already
denormalized specifiers, while the jupyter kernel was not. We need to
denormalize the specifiers to evict the proper keys from our caches.
2024-04-12 02:08:31 +02:00
David Sherret
734e84badc
fix(npm): local nodeModulesDir was sometimes resolving duplicates of same package (#23320) 2024-04-12 02:08:31 +02:00
Bartek Iwańczuk
0c3cbe14ac
chore: update release doc template (#23299)
Adjusts release doc template to changes made by @crowlKats in
`apiland_scripts`.
2024-04-12 02:08:31 +02:00
denobot
04c0a4cbf7
1.42.2 (#23314)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-11 12:09:03 +05:30
Nayeem Rahman
9e6e25529b
perf(lsp): replace document registry source cache on update (#23311) 2024-04-11 10:31:52 +05:30
Nathan Whitaker
be9c36cf6c
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-11 10:31:52 +05:30
林炳权
e2a817d11c
chore: update to Rust 1.77.2 (#23262)
update to Rust 1.77.2


---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-11 10:31:52 +05:30
Asher Gomez
0cc0cd0bbc
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-11 10:31:52 +05:30
Nayeem Rahman
b8ac027ff4
refactor(lsp): cleanup documents dependents calculation (#23295) 2024-04-11 10:31:52 +05:30
Asher Gomez
8cd97bc845
fix(ext/fs): account for all ops in leak checks (#23300)
This is PR a smaller retry of #23066 that simply ensures all async
`ext/fs` ops are accounted for if left hanging in tests. This also sorts
the `OP_DETAILS` in alphabetical order for easy future reading.

When reviewing, it might be best to look at the commits in order for
better understanding.
2024-04-11 10:31:52 +05:30
Matt Mastracci
c169a8f127
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-11 10:31:52 +05:30
Nathan Whitaker
9056fdeda2
perf(lsp): More granular locking of FileSystemDocuments (#23291)
Previously we locked the entire `FileSystemDocuments` even for lookups,
causing contention. This was particularly bad because some of the hot
ops (namely `op_resolve`) can end up hitting that lock under contention.

This PR replaces the mutex with synchronization internal to
`FileSystemDocuments` (an `AtomicBool` for the dirty flag, and then a
`DashMap` for the actual documents).

I need to think a bit more about whether or not this introduces any
problematic race conditions.
2024-04-11 10:31:51 +05:30
Carlos Precioso
ba72b3bc63
docs: Fix typo "discreet" to "discrete" (#23290)
Changes `discreet` in the documentation for `discrete`

"Discreet" means careful to avoid being noticed, "discrete" means
separate parts, and is what the documentation refers to.
2024-04-11 10:31:51 +05:30
Satya Rohith
7ef10564d5
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-11 10:31:51 +05:30
Divy Srivastava
51f77463d0
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-11 10:31:51 +05:30
Asher Gomez
4ad011e829
chore: update h2 crate (#23272)
Prerequisite #23273.
2024-04-11 10:31:51 +05:30
Matt Mastracci
a91bf052c1
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-11 10:31:51 +05:30
Asher Gomez
95e78a96b1
refactor: use chrono::DateTime::from_timestamp (#23273)
`chrono::NaiveDateTime::from_timestamp_opt()` was deprecated in
https://github.com/chronotope/chrono/pull/1473.

Prerequisite for #23272.
2024-04-11 10:31:51 +05:30
Nayeem Rahman
37d81841b4
perf(lsp): cache ts config in isolate until new project version (#23283) 2024-04-11 10:31:51 +05:30
Bartek Iwańczuk
c8086a29a3
fix(ext/http): Make Deno.serveHttp() work when proxying (#23269)
Closes https://github.com/denoland/deno/issues/21900
2024-04-11 10:31:51 +05:30
Matt Mastracci
377573c6bc
refactor(ext/tls): use cppgc to deduplicate the tls key loading code (#23289)
Pass the certificates and key files as CPPGC objects.

Towards #23233
2024-04-11 10:31:51 +05:30
Asher Gomez
ce6d54db5d
chore: update deprecation notices of APIs to be soft-removed (#23076) 2024-04-11 10:31:51 +05:30
Bartek Iwańczuk
cbfd987ce4
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-11 10:31:51 +05:30
Asher Gomez
a5ca3bc74f
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-11 10:31:51 +05:30
Nayeem Rahman
41f0616471
perf(lsp): don't pass remote modules as tsc roots (#23259) 2024-04-11 10:31:51 +05:30
Nayeem Rahman
de05a9b633
Revert "perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)" (#23285) 2024-04-11 10:31:51 +05:30
MAKS11060
5a830becaf
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-11 10:31:51 +05:30
Yoshiya Hinosawa
217c82ea7c
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-11 10:31:50 +05:30
Asher Gomez
255411eb8f
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-11 10:31:50 +05:30
Asher Gomez
f05b02978a
FUTURE(ext/fs): remove Deno.FsWatcher.prototype.rid (#23234) 2024-04-11 10:31:50 +05:30
Asher Gomez
add191d93d
FUTURE(ext/fs): make Deno.FsFile constructor illegal (#23235)
I'm unsure whether we're planning to make the `Deno.FsFile` constructor
illegal or remove `FsFile` from the `Deno.*` namspace in Deno 2. Either
way, this PR works towards the former. I'll create a superceding PR if
the latter is planned instead.

Towards #23089
2024-04-11 10:31:50 +05:30
Nathan Whitaker
808f019f9d
perf(lsp): Don't retain SourceFileObjects in sourceFileCache longer than necessary (#23258)
The TS language service requests source files via
[getSourceFile](7a25fd5ef0/cli/tsc/99_main_compiler.js (L560)).
In that function, we [unconditionally
add](7a25fd5ef0/cli/tsc/99_main_compiler.js (L613-L614))
the source file to our sourceFileCache. The issue is that we only remove
things from that cache if the source file [becomes out of
date](7a25fd5ef0/cli/tsc/99_main_compiler.js (L777-L783)).
For files that don't get changed, we keep them in the cache
indefinitely. So sometimes we keep SourceFile objects from being GC'ed
because they're retained in our cache, even though TS doesn't refer to
them any more. I see this in pretty much all of the heap snapshots I've
taken.

---

The fix here is pretty direct - just store weak references to the
sourcefiles in the cache. It doesn't really change our caching behavior,
it just prevents us from being the only retainer of a `SourceFile`. I
also split the `sourceFileCache` into a separate cache just for assets,
as we rely on those being alive.

The simpler fix is to only cache assets, but presumably that has a perf
impact.

---
In local testing, this PR reduced the size of the JS heap by about 1 GB
when using `deno lsp` in the Typescript repo.
2024-04-11 10:31:50 +05:30
Nayeem Rahman
1752a7fc7a
refactor(lsp): remove DocumentInner (#23251) 2024-04-11 10:31:50 +05:30
Matt Mastracci
3df3a35ece
fix(ext/net): Improve ts types for network APIs (#23228)
This currently fails to type-check in deno, but we know that listener is
a `Listener<TcpConn>` here and we should be able to improve the typing:

```
let listener = Deno.listen({ port: 0 });
console.log(listener.addr.port);

->

error: TS2339 [ERROR]: Property 'port' does not exist on type 'Addr'.
  Property 'port' does not exist on type 'UnixAddr'.
let listener = Deno.listen({ port: 0 }); console.log(listener.addr.port)
```

After:

```
Check file:///tmp/test.ts
```
2024-04-11 10:31:50 +05:30
David Sherret
b7a16842c8
perf(lsp): use lockfile to reduce npm pkg resolution time (#23247)
This functionality was broken. The series of events was:

1. Load the npm resolution from the lockfile.
2. Discover only a subset of the specifiers in the documents.
3. Clear the npm snapshot.
4. Redo npm resolution with the new specifiers (~500ms).

What this now does:

1. Load the npm resolution from the lockfile.
2. Discover only a subset of the specifiers in the documents and take
into account the specifiers from the lockfile.
3. Do not redo resolution (~1ms).
2024-04-11 10:31:50 +05:30
Nayeem Rahman
4cb46f6683
fix(lsp): respect DENO_FUTURE for BYONM config (#23207) 2024-04-11 10:31:50 +05:30
David Sherret
677c4c0c26
FUTURE: override byonm with nodeModulesDir setting (#23222)
Makes the `"nodeModulesDir"` setting take precedence over byonm when
using `DENO_FUTURE`.
2024-04-11 10:31:50 +05:30
Divy Srivastava
48c3461c9a
fix(ext/node): hostname is valid IPv4 addr (#23243)
Fixes `docusaurus serve`
2024-04-11 10:31:50 +05:30
Divy Srivastava
ee8148bc68
fix(ext/node): Add "module" to builtinsModule (#23242)
Fixes https://github.com/denoland/deno/issues/22731
2024-04-11 10:31:50 +05:30
Nayeem Rahman
c3823e1e78
perf(lsp): don't keep remote module ast's in memory (#23230) 2024-04-11 10:31:50 +05:30
JOTSR
ce552f3624
fix(cli): update deno doc help to fit current usage (#23224) 2024-04-11 10:31:50 +05:30
Matt Mastracci
e576014aea
fix(cli): fix deadlock in test writer when test pipe is full (#23210)
The tests would deadlock if we tried to write the sync marker into a
pipe that was full because one test streamed just enough data to fill
the pipe, so when we went to actually write the sync marker we blocked
when nobody was reading.

We use a two-phase lock for sync markers now: one to indicate "ready to
sync" and the second to indicate that the sync bytes have been received.
2024-04-11 10:31:50 +05:30
Asher Gomez
472aef2269
FUTURE: remove deprecated APIs within workers (#23220) 2024-04-11 10:31:50 +05:30
Matt Mastracci
2e921e1bec
fix(runtime): fix Windows permission prompt (#23212)
Followup to https://github.com/denoland/deno/pull/23184
2024-04-11 10:31:50 +05:30
Satya Rohith
471644caf7
fix(ext/node): count MessagePort message listeners in hasMessageEventListener (#23209) 2024-04-11 10:31:50 +05:30
Bartek Iwańczuk
ffd68ff78b
refactor(flags): prepare for deno install changes (#23217)
This commit adds enum to "InstallFlags" and "UninstallFlags" that will
allow to support both local and global (un)installation.

Currently the local variant is not used.

Towards https://github.com/denoland/deno/issues/23062
2024-04-11 10:31:50 +05:30
Matt Mastracci
a8b6c4ad2c
chore: try to fix mac runner (#23214)
https://github.com/actions/runner-images/issues/9626
2024-04-11 10:31:50 +05:30
Matt Mastracci
d73005189f
chore: Make WPT repo shallow (#23205)
This is a particularly large repo and making it shallow improves
checkout time.
2024-04-11 10:31:50 +05:30
Satya Rohith
5499d750b9
refactor(ext/node): remove worker_threads dependency on ext:runtime (#23206) 2024-04-11 10:31:50 +05:30