Commit graph

11688 commits

Author SHA1 Message Date
Marvin Hagemeister 1e97f0f148
feat: add __tests__ to test file detection defaults (#24443)
The `jest` test runner popularized putting tests into a `__tests__`
folder. Whilst many have switched to going with a `.test` suffix in the
file name these days, there are still many jest projects that have
`__tests__`. By adding this to the default test detection logic it makes
`deno test` discover those out of the box.
2024-07-08 15:19:59 +02:00
Luca Casonato 74ac29bae6
fix(permissions): handle ipv6 addresses correctly (#24397)
Also don't panic on invalid domain names and addresses.

Extracted with cleanups up from #24080

Co-authored-by: Yazan AbdAl-Rahman <yazan.abdalrahman@exalt.ps>
2024-07-05 23:45:06 +01:00
David Sherret 80df9aec1d
refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
Nathan Whitaker d4d3a3c54f
fix(node): Implement fs.lchown (and process.getegid) (#24418)
Closes https://github.com/denoland/deno/issues/21260.
Part of https://github.com/denoland/deno/issues/18218.

Implements `node:fs.lchown`, and enables the node_compat test for it.
The test uses `process.getegid`, which we didn't have implemented, so I
went ahead and implemented that as well to get the test working.
2024-07-05 18:32:51 +00:00
Marvin Hagemeister 28d2ff7bdc
chore: remove unused class private properties (#24441)
Noticed that these private class properties are never used. Maybe a
leftover from an earlier implementation.
2024-07-05 16:27:06 +02:00
Divy Srivastava 233e5f6fea
chore: rename __runtime_js_source to hmr (#24442)
Saves some keystrokes and easy to remember

```
cargo b --features hmr
```
2024-07-05 17:47:53 +05:30
Luca Casonato 08e5606c34
fix(ext/node): rewrite digest handling (#24392)
Previously we had many different code paths all
handling digests in different places, all with
wildly different digest support. This commit
rewrites this to use a single digest handling
mechanism for all digest operations.

It adds various aliases for digest algorithms,
like node does. For example
`sha1WithRSAEncryption` is an alias for `sha1`.

It also adds support for `md5-sha1` digests in
various places.
2024-07-05 10:10:22 +02:00
Divy Srivastava b290fd01f3
fix(ext/node): http chunked writes hangs (#24428)
Fixes https://github.com/denoland/deno/issues/24239
2024-07-05 08:49:42 +05:30
Bartek Iwańczuk 0bbfd6fb3d
feat: Deprecate --lock-write flag (#24436)
This commit deprecates `--lock-write` flag by removing it from
the help output and printing a warning message when it's used.

Users should use `--frozen=false` instead which was added
in https://github.com/denoland/deno/pull/24355.

Towards https://github.com/denoland/deno/issues/24167.
2024-07-05 04:38:12 +02:00
David Sherret d91215d418
fix: revert accidentally added parentPath on DirEntry (#24438)
Reverts the accidentally added `.parentPath` on dir entries in
https://github.com/denoland/deno/pull/24257/files

This should not have been added to the public api and is not documented.
2024-07-04 20:58:30 -04:00
David Sherret f396b3d1c8
fix(publish): unfurling should always be done with the package json (#24435)
Closes https://github.com/denoland/deno/issues/24430
2024-07-05 00:41:01 +00:00
Zander Hill f00f0f9298
feat(jupyter): support confirm and prompt in notebooks (#23592)
Closes: https://github.com/denoland/deno/issues/22633

This commit adds support for `confirm` and `prompt` APIs,
that instead of reading from stdin are using notebook frontend
to show modal boxes and wait for answers.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-04 22:12:14 +00:00
Marvin Hagemeister 96b527b8df
fix(node/http): don't throw on .address() before .listen() (#24432)
It's perfectly valid to access `server.address()` before calling
`.listen()`. Until a server actively listens on a socket Node will
return `null` here, but we threw a "Cannot access property 'port' of
undefined" instead.

This was discovered when inspecting failures in Koa's test suite with
Deno.
2024-07-04 18:28:48 +02:00
Filip Skokan f632b4a92e
feat(ext/crypto): make deriveBits length parameter optional and nullable (#24426)
Updates SubtleCrypto.prototype.deriveBits as per
https://github.com/w3c/webcrypto/pull/345

(WPT update in https://github.com/web-platform-tests/wpt/pull/43400)
2024-07-04 21:10:51 +05:30
David Sherret 147411e64b
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as
support for npm workspaces. npm workspaces is still lacking in that we
only install packages into the root node_modules folder. We'll make it
smarter over time in order for it to figure out when to add node_modules
folders within packages.

This includes a breaking change in config file resolution where we stop
searching for config files on the first found package.json unless it's
in a workspace. For the previous behaviour, the root deno.json needs to
be updated to be a workspace by adding `"workspace":
["./path-to-pkg-json-folder-goes-here"]`. See details in
https://github.com/denoland/deno_config/pull/66

Closes #24340
Closes #24159
Closes #24161
Closes #22020
Closes #18546
Closes #16106
Closes #24160
2024-07-04 00:54:33 +00:00
Nayeem Rahman dd6d19e120
fix(lsp): correct scope attribution for injected @types/node (#24404) 2024-07-03 20:25:42 +01:00
Bartek Iwańczuk 3242e2718f
feat: Upgrade to TypeScript 5.5.2 (#24326)
This commit upgrades TypeScript to 5.5.2.

https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/
2024-07-03 16:09:54 +02:00
Satya Rohith 496ea5903b
fix(ext/node): don't wait for end() call to send http client request (#24390)
Closes https://github.com/denoland/deno/issues/24232
Closes https://github.com/denoland/deno/issues/24215
2024-07-03 19:00:39 +05:30
Nathan Whitaker dadc606419
fix(ext/node): Add fs.lutimes / fs.lutimesSync (#23172)
Part of #18218


- Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do
this I added methods to the `FileSystem` trait + ops to expose the
functionality to JS.
- Exports `fs._toUnixTimestamp`. Node exposes an internal util
`toUnixTimestamp` from the fs module to be used by unit tests (so we
need it for the unit test to pass unmodified). It's weird because it's
only supposed to be used internally but it's still publicly accessible
- Matches up error handling and timestamp handling for fs.futimes and
fs.utimes with node
- Enables the node_compat utimes test - this exercises futimes, lutimes,
and utimes.
2024-07-02 19:33:32 -07:00
HasanAlrimawi 3324d7203e
fix(compile): prevent setting unstable feature twice (#24381)
Prevent panic when enabling a feature that is already enabled by
removing duplicate features.

Closes #22015

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-02 23:15:10 +00:00
Bartek Iwańczuk 7d919f6fd9
refactor(jupyter): move ZeroMQ server to a separate thread (#24373)
Moves the ZeroMQ messaging server to a separate thread.

This will allow to run blocking JS code and maintain communication
with the notebook frontend.

Towards https://github.com/denoland/deno/pull/23592
Towards https://github.com/denoland/deno/pull/24250
Closes https://github.com/denoland/deno/issues/23617
2024-07-03 00:37:54 +02:00
Nathan Whitaker c13b6d1413
feat(cli): Add --frozen flag to error out if lockfile is out of date (#24355)
Closes #18296.

Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if
the lockfile is out of date. This is useful for running in CI (where an
out of date lockfile is usually a mistake) or to prevent accidental
changes in dependencies.

![Screenshot 2024-06-26 at 7 11
13 PM](https://github.com/denoland/deno/assets/17734409/538404b8-b422-4f05-89e8-4c9b1c248576)
2024-07-02 15:00:16 -07:00
Kenta Moriuchi d379c0b299
fix(ext/web): use primordials of ES2024 ArrayBuffer transfer (#24396)
Ref: https://github.com/denoland/deno_core/issues/135
2024-07-02 22:27:01 +02:00
Kenta Moriuchi f78a60e882
feat(ext/web): add Blob.prototype.bytes() (#24148) 2024-07-02 16:04:08 +02:00
Bartek Iwańczuk 8db420d552
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)
Reland of https://github.com/denoland/deno/pull/24056 that doesn't
suffer from the problem that was discovered in
https://github.com/denoland/deno/pull/24261.

It uses upgraded `hyper` and `hyper-util` that fixed the previous
problem in https://github.com/hyperium/hyper/pull/3691.
2024-07-02 02:09:47 +02:00
Heyang Zhou 9c1f741112
fix(compile): atomically write compile output (#24378)
Atomically write `deno compile` output file so we won't get a partially
written ELF/PE file, and prevents corrupting running processes.
2024-07-02 06:54:17 +08:00
snek a555cb4d1d
feat: upgrade deno_core (#24364)
- Symbol.asyncDispose no longer needs to be polyfilled
- assorted updates for cppgc api changes
2024-07-01 15:48:52 -07:00
Filip Skokan 740c6a0998
fix(ext/node): add Symbol.toStringTag to KeyObject instances (#24377)
As per https://github.com/nodejs/node/pull/46043, this adds
Symbol.toStringTag getter to KeyObject.
2024-07-02 00:36:22 +02:00
David Sherret 6f30ef88a2
fix(windows): check USERPROFILE env var for finding home directory (#24384) 2024-07-01 18:17:17 -04:00
Bartek Iwańczuk b0cd43b5f3
fix(lsp): use CliLockfile (#24387)
The build broke in https://github.com/denoland/deno/pull/24365.
2024-07-01 22:14:17 +00:00
Nayeem Rahman 38a6be2e8e
fix(lsp): respect lockfile redirects entries for resolution (#24365) 2024-07-01 22:08:32 +01:00
Divy Srivastava cd4a0072dc
BREAKING(unstable/ffi): remove callback reentrant flag (#24367)
Closes https://github.com/denoland/deno/issues/22947

This option is no longer needed as fast calls are now allowed to
re-enter the isolate
2024-07-01 09:36:33 +05:30
Nathan Whitaker bc8a0e6e68
refactor(cli): Create wrapper around deno_lockfile::Lockfile (#24366)
As suggested in
https://github.com/denoland/deno/pull/24355#discussion_r1657875422.

I wasn't able to hide the mutex stuff as much as I'd like (ended up just
adding an escape hatch `inner()` method that locks the inner mutex),
because you can't return references to the inner fields through a mutex.

This is mostly motivated by the frozen lockfile changes
2024-06-28 17:18:21 -07:00
Nayeem Rahman 2ddae872f9
fix(lsp): don't use global cache paths for scope allocation (#24353) 2024-06-28 18:18:21 +01:00
Leo Kettmeir ec9963570b
chore: update deno_doc (#24308) 2024-06-28 05:03:51 -07:00
ud2 8d14a9db2f
fix(ext/node): make next tick queue resilient to Array.prototype tampering (#24361)
Closes #24358.
2024-06-27 21:45:46 +00:00
Nayeem Rahman 67dcd6db51
feat(lsp): ts language service scopes (#24345) 2024-06-26 23:47:01 +01:00
Bartek Iwańczuk 2a2ff96be1
fix(ext/node): discover .npmrc in user's homedir (#24021)
This commit adds discovery of `.npmrc` files in user's homedir.

This is not a perfect fix as it doesn't merge multiple `.npmrc` files
together as per https://github.com/denoland/deno/issues/23954
but allows to fallback if no `.npmrc` file is discovered in the project
root.
2024-06-27 00:17:00 +02:00
David Sherret 0da01c0ca6
refactor: move PackageJson to deno_config (#24348) 2024-06-26 21:24:10 +00:00
ud2 86e0292733
perf(ext/node): improve Buffer.from(buffer) (#24352)
Benchmark code from #24341.

```shellsession
$ deno run --allow-hrtime bench.mjs
6479.111583
$ target/release/deno run --allow-hrtime bench.mjs
962.753875
$ node bench.mjs
855.174875
```
2024-06-26 17:11:56 -04:00
David Sherret 77ba0019e7
Revert "perf: improve Buffer.from(buf) by 29x" (#24351)
https://github.com/denoland/deno/pull/24341#discussion_r1655247367

Reverts denoland/deno#24341
2024-06-26 16:23:09 -04:00
Divy Srivastava 2549e5154c
perf: optimize Buffer.from("base64") for forgiving-base64 conforming input (#24346) 2024-06-26 06:24:58 -07:00
Divy Srivastava 6da87450ed
perf: improve Buffer.from(buf) by 29x (#24341) 2024-06-26 06:24:48 -07:00
David Sherret eb283c43f5
refactor: bump deno_graph to 0.79 (#24337)
No fixes in this to my knowledge. Just an upgrade. The functionality
here will be used in a different PR.
2024-06-26 01:42:18 +00:00
Bartek Iwańczuk 09cc473f3b
fix(node): add missing readline/promises module (#24336)
Fixes https://github.com/jsr-io/jsr-npm/issues/91
2024-06-25 19:15:54 -04:00
snek 700cd200c1
feat: add module.parent (#24333)
This field is deprecated but still used by the ecosystem, so let's just
support it.
2024-06-25 11:17:35 -07:00
Divy Srivastava a1ff1a453c
fix(ext/websocket): drop connection when close frame not ack (#24301)
Fixes #24292
2024-06-25 19:09:02 +05:30
Satya Rohith 13aa1d70e9
fix(ext/node): ignore stream error during enqueue (#24243) 2024-06-25 17:02:40 +05:30
Satya Rohith b71a859188
test(node_compat): enable more stream-writable tests (#24328) 2024-06-25 09:36:40 +00:00
Luca Casonato 1e8a6b94b1
fix(ext/node): rewrite crypto.Hash (#24302)
Changes in this PR:

- Added new fixed size hash algorithms (blake2b512, blake2s256,
sha512-224, sha512-256, sha3-224, sha3-256, sha3-384, sha3-512, sm3)
- Added variable size hash algorithms (the concept), with the algorithms
shake128 and shake256
- Use cppgc instead of resources for the hasher
- Enable Node's crypto.Hash tests and fix found bugs
2024-06-24 11:47:12 +02:00