0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-12 16:59:32 -05:00
Commit graph

11155 commits

Author SHA1 Message Date
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
Bartek Iwańczuk
0307d88360
fix(ext/node): polyfill node:domain module (#23088)
Closes https://github.com/denoland/deno/issues/16852

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-04-11 10:31:49 +05:30
Satya Rohith
dba1c58933
fix(ext/node): patch MessagePort if provided as workerData (#23198)
MessagePort if directly assigned to workerData property instead of
embedding it in an object then it is not patched to a NodeMessagePort.
This commit fixes the bug.
2024-04-11 10:31:49 +05:30
Nathan Whitaker
4649005648
fix(lsp): Remove client-facing format failure warning (#23196)
Fixes #23163.

The client-facing warning doesn't provide any value and is super
annoying. We still emit a warning message on the server side for format
errors, which should fulfill the same (less intrusive) purpose.
2024-04-11 10:31:49 +05:30
Asher Gomez
47420d8449
chore: ensure python@3.11 is installed for WPT tests (#23195)
This provides a more thorough check of whether the correct Python
version is installed for running WPT tests.
2024-04-11 10:31:49 +05:30
Matt Mastracci
f358f6958c
chore(tests): rewrite tls_test to avoid any hardcoded ports (#23191)
To avoid the risk of port collisions during tests, we listen on port 0
and use that for both ends of the connections (for any tests we run in
this file).
2024-04-11 10:31:49 +05:30
Nathan Whitaker
77f2a2c3f2
fix(ext/node): Support returning tokens and option defaults in node:util.parseArgs (#23192)
Fixes #23179.
Fixes #22454.

Enables passing `{tokens: true}` to `parseArgs` and setting default
values for options.

With this PR, the observable framework works with deno out of the box
(no unstable flags needed).

The existing code was basically copied straight from node, so this PR
mostly just updates that (out of date) vendored code. Also fixes some
issues with error exports (before this PR, in certain error cases we
were attempting to construct error classes that weren't actually in
scope).

The last change (in the second commit) adds a small hack so that we
actually exercise the `test-parse-args.js` node_compat test, previously
it was reported as passing though it should have failed. That test now
passes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-11 10:31:49 +05:30
Alex Yang
f4e4e1baaf
feat: improve AsyncLocalStorage api (#23175)
Fixes: https://github.com/denoland/deno/issues/23174
2024-04-11 10:31:49 +05:30
Bartek Iwańczuk
473212a8b3
FUTURE: enable BYONM by default (#23194)
When `DENO_FUTURE=1` env var is present, then BYONM
("bring your own node_modules") is enabled by default.
That means that is there's a `package.json` present, users
are expected to explicitly install dependencies from that file.

Towards https://github.com/denoland/deno/issues/23151
2024-04-11 10:31:49 +05:30
Asher Gomez
2352b83a9a
chore: move tools/node_compat to tests/node_compat/runner (#23025)
The `tools/node_compat/node` submodule has been moved to
`tests/node_compat/runner/suite` and the remaining files within
`tools/node_compat` to `tests/node_compat/runner`.

Most of the changes are of the header within `tests/node_compat/test`
files. The `setup` and `test` tasks within `tests/node_comapt` execute
successfully.

Towards #22525
CC @mmastrac
2024-04-11 10:31:49 +05:30
Nayeem Rahman
37dba20c76
feat(lsp): respect nested deno.json for fmt and lint config (#23159) 2024-04-11 10:31:49 +05:30
Matt Mastracci
5a2ff6557c
fix(cli): Enforce a human delay in prompt to fix paste problem (#23184)
The permission prompt doesn't wait for quiescent input, so someone
pasting a large text file into the console may end up losing the prompt.
We enforce a minimum human delay and wait for a 100ms quiescent period
before we write and accept prompt input to avoid this problem.

This does require adding a human delay in all prompt tests, but that's
pretty straightforward. I rewrote the locked stdout/stderr test while I
was in here.
2024-04-11 10:31:49 +05:30
David Sherret
6a32ae8f28
perf: reduce allocations in MediaType::from_specifier (#23190)
Includes https://github.com/denoland/deno_media_type/pull/7
2024-04-11 10:31:49 +05:30
Matt Mastracci
9f7b025a1f
chore: Update to macos-13 for mac runners (#23193) 2024-04-11 10:31:49 +05:30
Matt Mastracci
2d1e1a7a94
chore(ext/ffi): sym is unused on aarch64 linux (#23188)
Fix a warning on linux aarch64

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
2024-04-11 10:31:49 +05:30
Satya Rohith
36808d89d5
fix(ext/node): MessagePort works (#22999)
Closes https://github.com/denoland/deno/issues/22951
Closes https://github.com/denoland/deno/issues/23001

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-04-11 10:31:49 +05:30
Nathan Whitaker
0a5e4cb233
fix(ext/node): Add fs.readv, fs.readvSync (#23166)
Part of #18218.

Implements `fs.readv` and `fs.readvSync` and enables the corresponding
`node_compat` tests.
2024-04-11 10:31:49 +05:30
David Sherret
9aef08b46b
chore(specs): add jsr and npm env vars to tests by default (#23171) 2024-04-11 10:31:49 +05:30
Asher Gomez
7c732cd95f
chore: update std submodule to 0.221.0 (#23112) 2024-04-11 10:31:49 +05:30
David Sherret
c793649b9e
fix: prevent cache db errors when deno_dir not exists (#23168)
Closes #20202
2024-04-11 10:31:49 +05:30
David Sherret
b25cc8034d
perf(node): put pkg json into an Rc (#23156)
Was doing a bit of debugging on why some stuff is not working in a
personal project and ran a quick debug profile and saw it cloning the
pkg json a lot. We should put this in an Rc.
2024-04-11 10:31:49 +05:30
denobot
08f0613b39
1.42.1 (#23158)
Bumped versions for 1.42.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-01 12:03:06 +05:30
David Sherret
8698492128
fix(node): handle empty 'main' entry in pkg json (#23155) 2024-04-01 07:07:11 +01:00
David Sherret
b8af46e007
fix(check): ignore certain diagnostics in remote modules and when publishing (#23119)
Unused locals and parameters don't make sense to surface in remote
modules. Additionally, fast check can cause these kind of diagnostics
when publishing, so they should be ignored.

Closes #22959
2024-03-31 16:39:40 -04:00
Nayeem Rahman
0144594044
fix(lsp): don't apply preload limit to workspace walk (#23123) 2024-03-31 21:39:23 +01:00
David Sherret
db89ce33f4
chore(lsp): remove recursion in recurse_dependents (#23153)
Was investigating a separate stack overflow (that I've now found in the
node resolution code) and came across this. We should avoid recursion
(this is very old code).
2024-03-31 13:04:42 -04:00