1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

987 commits

Author SHA1 Message Date
David Sherret
c89a20b428
perf(cache): single cache file for remote modules (#24983)
This changes the global cache to store the cache file for remote modules
in one file instead of two.
2024-08-26 23:59:17 +00:00
David Sherret
e13230226f
feat: lockfile v4 by default (#25165)
This won't be fully stabilized until 2.0 is released.
2024-08-26 23:01:50 +00:00
Bartek Iwańczuk
ba58628601
Reland "test: run unit tests with DENO_FUTURE=1" (#25212)
Reverted in https://github.com/denoland/deno/pull/25060
2024-08-26 23:58:28 +02:00
Luca Casonato
e53678fd58
Revert "feat(fetch): accept async iterables for body" (#25207)
Unfortunately this caused a regression:
https://github.com/denoland/deno/issues/25203.

Need to do some more upstream spec work to fix this before this can be
re-landed.

Reverts denoland/deno#24623
2024-08-26 12:24:27 +02:00
Armaan Salam
675539c7ab
fix(bench): Fix table column alignments and NO_COLOR=1 (#25190)
Fix table layout for `deno bench` command with and without color
(`NO_COLOR=1`).

Fixes issue in #25156
2024-08-26 11:56:04 +02:00
Marvin Hagemeister
1dad29aa04
fix(node/cluster): improve stubs to make log4js work (#25146)
- Add missing exports to `node:cluster`
- Fix default export not being an instance of `EventEmitter`
- Fix aliasing of properties
- Fix `disconnected` -> `disconnect` export naming

This makes `log4js` work in Deno. `karma` starts too, but somehow the
server isn't responding. That looks like a different issue.

Fixes https://github.com/denoland/deno/issues/24858
2024-08-26 11:19:58 +02:00
Nayeem Rahman
2ab4afc6b8
refactor(lsp): changes for lsp_types 0.97.0 (#25169) 2024-08-24 01:21:21 +01:00
Divy Srivastava
38bc4021e6
fix(ext/crypto): throw DataError for invalid EC key import (#25181)
Fixes https://github.com/denoland/deno/issues/20931
2024-08-23 22:06:40 +05:30
Divy Srivastava
d9a7b30d1f
fix(ext/node): import JWK octet key pairs (#25180)
Ref https://github.com/denoland/deno/issues/24129

`kty: "okp"` is defined in
[rfc8037](https://www.rfc-editor.org/rfc/rfc8037.html)
2024-08-23 22:06:28 +05:30
Yusuke Tanaka
d54d29662f
chore: enable log feature for tracing crate (#25078)
This commit enables the `log` feature for the `tracing` crate.

This allows us to examine additional detailed logs emitted by third party crates
that use `tracing` crate for logging by setting `RUST_LOG` env var or passing
`-L` option in command line.

Closes #25045
2024-08-22 19:15:10 -07:00
Nathan Whitaker
f606402677
fix(install): Use relative symlinks in deno install (#25164)
Fixes https://github.com/denoland/deno/issues/25161
2024-08-22 21:55:17 +00:00
Leo Kettmeir
9bc7de9b13
fix(urlpattern): fallback to empty string for undefined group values (#25151)
This change was introduced in #24741, but due to the change in
behaviour, we will revert it and re-introduce it in 2.0
2024-08-22 05:44:09 -07:00
Divy Srivastava
2531204a34
fix(ext/node): register node:wasi built-in (#25134)
Fixes https://github.com/denoland/deno/issues/23531
2024-08-22 09:03:52 +05:30
Nathan Whitaker
48da3c17ea
fix(add): Handle packages without root exports (#25102)
Fixes #24607.

This PR makes the logic that caches top level dependencies (things
present in import map) smarter, so we handle JSR dependencies without
root exports.
2024-08-21 15:23:32 -07:00
Nayeem Rahman
c22ff197db
fix(lsp): resolve jsx import source with types mode (#25064) 2024-08-21 20:00:23 +01:00
David Sherret
1d4169204c
fix: warn about import assertions when using typescript (#25135)
1. On emit, checks for the prescence of import assertions.
1. Warns and doesn't store the parsed source in the emit cache in this
case.
2024-08-21 17:12:56 +00:00
Nayeem Rahman
76990df6fa
chore(lsp): use 'install' terminology for jsr and npm packages (#25119) 2024-08-21 15:10:28 +01:00
Satya Rohith
e920835417
fix(ext/node): pass content-disposition header as string instead of bytes (#25128)
Closes https://github.com/denoland/deno/issues/25117
2024-08-21 10:13:17 +00:00
seb
a3a54bc747
fix(ext/net): validate port in Deno.{connect,serve,listen} (#24399)
Co-authored-by: Will Leach <4619280+melbourne2991@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 21:25:41 +00:00
David Sherret
37279e0b0a
fix(add): error when config file contains importMap field (#25115)
The "imports" field has higher precedence than "importMap", so we should
error when `deno add` goes to add an `"imports"` field.

Closes https://github.com/denoland/deno/issues/24264
Closes https://github.com/denoland/deno/pull/24478
2024-08-20 16:32:01 -04:00
David Sherret
a7c002ae63
chore: enable no-console dlint rule (#25113) 2024-08-20 15:14:37 -04:00
Nayeem Rahman
acba2cd48c
fix(lsp): include scoped import map keys in completions (#25047) 2024-08-20 19:38:47 +01:00
Yazan AbdAl-Rahman
a7c8bb1596
feat: glob and directory support for deno check and deno cache cli arg paths (#25001)
Closes #24668
Closes #20813

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 18:38:06 +00:00
Bartek Iwańczuk
1f47248143
fix: adjust suggestion for lockfile regeneration (#25107)
Ref https://github.com/denoland/deno/pull/24436#issuecomment-2288568645
2024-08-20 20:13:17 +02:00
HasanAlrimawi
0704454755
feat: Print deprecation message for npm packages (#24992)
This commit adds ability to print deprecation notices
for npm packages that have been marked as deprecated.

Closes #24013
2024-08-20 19:53:53 +02:00
Nathan Whitaker
5168700be6
feat(config): Support frozen lockfile config option in deno.json (#25100)
Closes #24544
2024-08-20 14:55:47 +00:00
David Sherret
f1c58ec041
feat(unstable): ability to use a local copy of jsr packages (#25068) 2024-08-20 14:11:43 +00:00
Hajime-san
19bcb40059
feat(cli/tools): add a subcommand --hide-stacktraces for test (#24095) 2024-08-20 01:27:36 +00:00
Yazan AbdAl-Rahman
4f49f703c1
fix(cli): update permission prompt message for compiled binaries (#24081)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-08-20 01:20:06 +00:00
melbourne2991
0eba180fdb
fix(repl): Prevent panic on broken pipe (#21945) 2024-08-20 00:21:12 +00:00
Yazan AbdAl-Rahman
4285cb339d
fix(lint): support linting tsx/jsx from stdin (#24955)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-08-19 20:42:13 +00:00
Bartek Iwańczuk
b5051e25c2
feat: Deprecate "import assertions" with a warning (#24743)
This commit deprecates "import assertions" proposal that has been
replaced with "import attributes".

Any time an import assertion is encountered a warning will be printed
to the terminal. This warning will be printed for both local and 
remote files (ie. user code and dependencies).

Import assertions support will be removed in Deno 2.
2024-08-19 22:36:35 +02:00
David Sherret
bf510544ef
chore: improve accessing special file test (#25099) 2024-08-19 16:21:27 -04:00
Bedis Nbiba
ee2b6899a1
fix: add permission name when accessing a special file errors (#25085) 2024-08-19 17:45:10 +00:00
David Sherret
c9edb15f15
fix(compile): make output more deterministic (#25092)
Closes https://github.com/denoland/deno/issues/25084
2024-08-19 16:41:11 +00:00
Marvin Hagemeister
48701c19f8
fix(node/tty): fix tty.WriteStream.hasColor with different args (#25094)
The check in `tty.WriteStream.prototype.hasColors()` was incorrect
leading to the
[`yoctocolors`](https://github.com/sindresorhus/yoctocolors) package not
printing any colors.

Fixes https://github.com/denoland/deno/issues/24407
2024-08-19 17:13:09 +02:00
David Sherret
526f39fbb9
feat(FUTURE): terse lockfile (v4) (#25059) 2024-08-19 03:01:39 +00:00
Luca Casonato
9bc2dd29ad
fix: clean up flag help output (#24686)
Permission flags are unified in a clearer and concise output.
Unstable flags are hidden by default with exception of the `unstable`
flag itself. the remaining unstable flags can be seen with a
`--help=unstable`.
This also cleans up to show unstable flags only for subcommands that
actually need them.
Also sorts flags alphabetically, and gorups various flags together in a
set of categories.

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-08-18 15:39:53 -07:00
Marvin Hagemeister
558d2a098b
fix(node/http): wrong req.url value (#25081)
This PR addresses a regression introduced in
https://github.com/denoland/deno/pull/25021 that would cause the
`req.url` parameter in Node's http server to always be a single
character instead of the expected value. The regression was caused by
effectively calling `.indexOf()` on an empty string and thus passing the
wrong index for slicing.

```js
"".indexOf("/") // -> -1
request.url.slice(-1) // effectively only giving us the last character
```

Fixes https://github.com/denoland/deno/issues/25080
2024-08-18 15:37:39 +00:00
Yoshiya Hinosawa
b6cdb31c05
fix(ext/node): fix prismjs compatibiliy in Web Worker (#25062)
PrismJS uses `WorkerGlobalScope` and `self` for detecting browser's Web
Worker context:
59e5a34713/prism.js (L11)

Now the detection logic above is broken when it's imported from Deno's
Web Worker context because we only hide `self` (Prism assumes when
`WorkerGlobalScope` is available, `self` is also available).

This change fixes the above by also hiding `WorkerGlobalScope` global in
Node compat mode.

closes #25008
2024-08-17 11:16:43 +09:00
Nathan Whitaker
ff4226a3cd
fix(node/fs): Use correct offset and length in node:fs.read and write (#25049)
My fix in #25030 was buggy, I forgot to pass the `byteOffset` and
`byteLength`. Whoops.

I also discovered that fs.read was not respecting the `offset` argument,
and we were constructing a new `Buffer` for the callback instead of just
passing the original one (which is what node does, and the @types/node
definitions also indicate the callback should get the same type).
Fixes #25028.
2024-08-16 09:48:57 -07:00
David Sherret
4d1b263e91
feat(publish): suggest importing jsr:@std/ for deno.land/std urls (#25046) 2024-08-16 10:42:11 -04:00
David Sherret
57cd2951f1
feat(config/jsr): add license field (#25056)
1. Adds a new "license" field.
1. Adds this field by default when doing `deno init --lib`
2024-08-16 13:12:52 +00:00
Yoshiya Hinosawa
105d27bc7d
fix(ext/node): improve shelljs compat with managed npm execution (#24912)
This change improves the Node.js compatibility in managed npm resolution
mode by disabling the discovery of `node_modules` when the
main specifier is inside of `DENO_DIR`.

closes #22732
closes #24589
2024-08-16 12:48:48 +09:00
Bartek Iwańczuk
b6c74aab24
Revert "test: run unit tests with DENO_FUTURE=1 (#24400)" (#25060)
This reverts commit 22a834ff5b.

Appears this commit might have broken tests on `main`.
2024-08-15 23:30:06 +00:00
Nathan Whitaker
a58494483a
chore: Disable part of parallel serve test on macos (flaky) (#25057)
MacOS tends to not distribute evenly, so just don't assert that requests
were served by > 1 worker on mac.

Also added a check that all workers start, so we at least check that on
macos.
2024-08-15 21:48:35 +00:00
Nathan Whitaker
5ec3c5c3a4
feat(lint): Add lint for usage of node globals (with autofix) (#25048)
From upgrading `deno_lint`.

Previously if you had a node project that used a bunch of node globals
(`process.env`, etc), you would have to fix the errors by hand. This PR
includes a new lint that detects usages of node globals (`process`,
`setImmediate`, `Buffer`, etc.) and provides an autofix to import the
correct value. For instance:

```ts
// main.ts
const _foo = process.env.FOO;
```

`deno lint` gives you

```ts
error[no-node-globals]: NodeJS globals are not available in Deno
 --> /home/foo.ts:1:14
  |
1 | const _foo = process.env.FOO;
  |              ^^^^^^^
  = hint: Add `import process from "node:process";`

  docs: https://lint.deno.land/rules/no-node-globals


Found 1 problem (1 fixable via --fix)
Checked 1 file
```
And `deno lint --fix` adds the import for you:

```ts
// main.ts
import process from "node:process";
const _foo = process.env.FOO;
```
2024-08-15 20:43:04 +00:00
Nathan Whitaker
8749d651fb
fix(node): Create additional pipes for child processes (#25016)
Linux/macos only currently.

Part of https://github.com/denoland/deno/issues/23524 (fixes it on
platforms other than windows).
Part of #16899  (fixes it on platforms other than windows).

After this PR, playwright is functional on mac/linux.
2024-08-15 09:38:46 -07:00
Nathan Whitaker
e92a05b551
feat(serve): Opt-in parallelism for deno serve (#24920)
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple
workers to parallelize serving requests.


```bash
deno serve --parallel main.ts
```

Currently on linux we use `SO_REUSEPORT` and rely on the fact that the
kernel will distribute connections in a round-robin manner.

On mac and windows, we sort of emulate this by cloning the underlying
file descriptor and passing a handle to each worker. The connections
will not be guaranteed to be fairly distributed (and in practice almost
certainly won't be), but the distribution is still spread enough to
provide a significant performance increase.

---
(Run on an Macbook Pro with an M3 Max, serving `deno.com`

baseline::
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.78ms   13.56ms 330.54ms   79.12%
    Req/Sec   258.58     35.56   360.00     70.64%
  Latency Distribution
     50%  236.72ms
     75%  248.46ms
     90%  256.84ms
     99%  268.23ms
  15458 requests in 30.02s, 2.47GB read
Requests/sec:    514.89
Transfer/sec:     84.33MB
```

this PR (`with --parallel` flag)
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   117.40ms  142.84ms 590.45ms   79.07%
    Req/Sec     1.33k   175.19     1.77k    69.00%
  Latency Distribution
     50%   22.34ms
     75%  223.67ms
     90%  357.32ms
     99%  460.50ms
  79636 requests in 30.07s, 12.74GB read
Requests/sec:   2647.96
Transfer/sec:    433.71MB
```
2024-08-14 22:26:21 +00:00
Sean McArthur
875ee618d3
feat(ext/node): support http2session.socket (#24786)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-14 21:59:22 +00:00
Nayeem Rahman
4eff1e8ec4
fix(lsp): import map lookup for jsr subpath auto import (#25025) 2024-08-14 22:38:18 +01:00
Pig Fang
3a3315cc7f
feat(fmt): support HTML, Svelte, Vue, Astro and Angular (#25019)
This commit adds capability to format HTML, Svelte, Vue, Astro and Angular
files.

"--unstable-html" is required to format HTML files, and "--unstable-component"
flag is needed to format other formats. These can also be specified in the config
file.

Close #25015
2024-08-14 22:58:48 +02:00
Bartek Iwańczuk
22a834ff5b
test: run unit tests with DENO_FUTURE=1 (#24400)
This commit adds another test suite that runs all Deno unit tests
with `DENO_FUTURE=1` flag to ensure all APIs are working as
expected, once Deno 2 is released.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-14 22:50:06 +02:00
Asher Gomez
f89b531149
feat(node): support username and _password in .npmrc file (#24793)
Closes #23950
2024-08-14 18:53:15 +02:00
Nathan Whitaker
1f2d48cd97
fix(node/fs): node:fs.read and write should accept typed arrays other than Uint8Array (#25030)
Part of #25028.

Our underlying read/write operations in `io` assume the buffer is a
Uint8Array, but we were passing in other typed arrays (in the case above
it was `Int8Array`).
2024-08-14 09:42:31 -07:00
Marvin Hagemeister
c765d9ad2f
fix(node/inspector): Session constructor should not throw (#25041)
There is no constructor code when creating an inspector `Session`
instance in Node. Also get rid of some symbols which should've been
private properties. This PR doesn't yet add any new implementations
though as these are mostly cosmetic changes.
2024-08-14 13:34:24 +00:00
Luca Casonato
130a2592f1
fix(cli): support --watch when running cjs npm packages (#25038) 2024-08-14 15:21:11 +02:00
Marvin Hagemeister
533d31bc4e
fix: node:inspector not being registered (#25007)
For some reason we didn't register the `node:inspector` module, which
lead to a panic when trying to import it. This PR registers it.

Related: https://github.com/denoland/deno/issues/25004
2024-08-14 12:33:42 +00:00
Bartek Iwańczuk
b325bf0a35
feat(clean): add progress bar (#25026)
Closes https://github.com/denoland/deno/issues/25020
2024-08-14 13:04:07 +02:00
Łukasz Czerniawski
e2faf50375
feat(coverage): add breadcrumbs to deno coverage --html report (#24860) 2024-08-14 16:37:19 +09:00
David Sherret
39a21fd78e
feat(publish): error on missing license file (#25011)
Closes https://github.com/denoland/deno/issues/24676
2024-08-12 19:51:58 -04:00
David Sherret
d3ced2fe43
chore: mark upgrade_prompt as flaky (#25009) 2024-08-12 23:04:00 +02:00
David Sherret
085058cfff
feat: deno remove (#24952)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-12 16:17:25 -04:00
Kenta Moriuchi
76f4f202e7
chore: update the copyright of c, mjs, and jsx (#25005) 2024-08-12 12:41:32 -04:00
Leo Kettmeir
e5f0058b74
feat: better help output (#24958) 2024-08-12 08:55:33 -07:00
Luca Casonato
56e8ed5eb1
fix(ext/node): don't concat set-cookie in ServerResponse.appendHeader (#25000)
Follow-on to
https://github.com/denoland/deno/pull/24216/files#r1642188672
2024-08-12 12:01:37 +02:00
Bartek Iwańczuk
004b74c8c6
feat: Rename --unstable-hmr to --watch-hmr (#24975)
This commit stabilizes HMR functionality and renames
`--unstable-hmr` to `--watch-hmr`. The `--unstable-hmr`
flag is still working, but hidden from the help output.
It will be removed in Deno 2.

Once https://github.com/denoland/deno/pull/24958 lands
we should improve grouping of `--watch` and `--watch-hmr`
flags.
2024-08-12 00:10:55 +02:00
Divy Srivastava
d6f662ac82
fix(ext/node): support ieee-p1363 ECDSA signatures and pss salt len (#24981)
Fixes https://github.com/denoland/deno/issues/22919
2024-08-11 14:59:53 +05:30
Divy Srivastava
feba133711
fix(ext/node): createBrotliCompress params (#24984)
Fixes https://github.com/denoland/deno/issues/24416
2024-08-11 14:26:30 +05:30
Pig Fang
82884348cb
feat(fmt): support CSS, SCSS, Sass and Less (#24870)
This PR integrates [Malva](https://github.com/g-plane/malva) into `deno
fmt`, which introduces the ability to format CSS, SCSS, Sass and Less
files.

On Linux x64 6.10, this PR increases about 800KiB:

```                                                                                                                                                                      
❯ wc -c target/release/deno
125168728 target/release/deno

❯ wc -c target/release/deno
124349456 target/release/deno
```
2024-08-09 18:52:23 +02:00
Nathan Whitaker
218ee1b1ff
fix(add): Better error message when missing npm specifier (#24970)
Before:
<img width="278" alt="Screenshot 2024-08-09 at 3 15 01 PM"
src="https://github.com/user-attachments/assets/91b0ada6-93ee-4be6-a996-078aef98c2a9">

After:
<img width="888" alt="Screenshot 2024-08-09 at 3 52 15 PM"
src="https://github.com/user-attachments/assets/3c88a0e8-c761-4f70-88bf-109355ac12f0">
2024-08-09 14:29:11 +00:00
Nathan Whitaker
854c7ba198
fix(install): Properly handle dist tags when setting up node_modules (#24968)
Fixes https://github.com/denoland/deno/issues/24966.
Fixes https://github.com/denoland/deno/issues/24932.
2024-08-09 13:35:54 +00:00
Marvin Hagemeister
f474c4f4ff
fix: stub node:module.register() (#24965)
This is commonly used to register loading non standard file types. But
some libs also register TS loaders which Deno supports natively, like
the npm `payload` package. This PR unblocks those.

Fixes https://github.com/denoland/deno/issues/24902
2024-08-09 14:25:33 +02:00
Bartek Iwańczuk
ffe1bfd54c
feat: deno init --serve (#24897)
This commit adds "--serve" flag to "deno init" subcommand,
that provides a template for quick starting a project using
"deno serve".

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-08-08 16:54:39 +00:00
Nathan Whitaker
3f692bed0a
fix(add): Support dist tags in deno add (#24960)
Fixes #24956.
2024-08-08 16:45:41 +00:00
Yusuke Tanaka
e36b1a3aa8
fix(ext/fetch): include TCP src/dst socket info in error messages (#24939)
This commit makes `fetch` error messages include source and destination TCP
socket info i.e. port number and IP address for better debuggability.

Closes #24922
2024-08-08 08:47:15 -07:00
Bartek Iwańczuk
c94d1b10f8
feat(install): change 'Add ...' message (#24949)
Changes messages printed by `deno add` from
`Add @oak/oak - jsr:@oak/oak^16.1.0` to
`Add jsr:@oak/oak16.1.0`.
2024-08-08 16:25:05 +02:00
Birk Skyum
4c56353594
feat(cli): Add --env-file as alternative to --env (#24555) 2024-08-08 06:50:57 -07:00
Bartek Iwańczuk
ab8802f49b
feat(permissions): link to docs in permission prompt (#24948)
This commit updates permission prompt to add a link
to the documentation for particular flag.

Additionally the box drawings around the prompt have been slightly
altered for better visibility.

<img width="737" alt="Screenshot 2024-08-08 at 12 42 32"
src="https://github.com/user-attachments/assets/6ae748cd-4f29-439d-b0ee-f28f565f211a">
2024-08-08 15:39:31 +02:00
David Sherret
e9e3ab4628
feat: deno clean (#24950)
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-08-08 13:22:18 +00:00
Marvin Hagemeister
f50d38869d
fix(node/util): add missing debug alias of debuglog (#24944)
Add the missing `node:util.debug` export which is an alias of
`node:util.debuglog`, see
https://nodejs.org/api/util.html#utildebugsection
2024-08-08 13:52:14 +02:00
Satya Rohith
65224786d2
fix(ext/node): client closing streaming request shouldn't terminate http server (#24946)
Closes https://github.com/denoland/deno/issues/22820
2024-08-08 10:22:58 +00:00
David Sherret
6fce23c54e
perf: skip saving to emit cache after first failure (#24896) 2024-08-08 09:41:30 +00:00
Yusuke Tanaka
4e4c96bf66
fix(ext/fetch): include URL and error details on fetch failures (#24910)
This commit improves error messages that `fetch` generates on failure.

Fixes #24835
2024-08-07 23:18:33 -07:00
Marvin Hagemeister
9d6da1036d
fix: rename watch event missing (#24893)
This PR ensures that we forward a `rename` event in our file watcher.
The rust lib we use combines that with the `modify` event.

This fixes a compatibility issue with Node too, which sends the `rename`
event as well.

Fixes https://github.com/denoland/deno/issues/24880
2024-08-07 18:15:57 +02:00
David Sherret
04473c04ed
fix(compile): support workspace members importing other members (#24909) 2024-08-07 07:43:05 +00:00
Luca Casonato
4fa8869f24
feat(ext/node): rewrite crypto keys (#24463)
This completely rewrites how we handle key material in ext/node. Changes
in this
PR:

- **Signing**
  - RSA
  - RSA-PSS 🆕
  - DSA 🆕
  - EC
  - ED25519 🆕
- **Verifying**
  - RSA
  - RSA-PSS 🆕
  - DSA 🆕
  - EC 🆕
  - ED25519 🆕
- **Private key import**
  - Passphrase encrypted private keys 🆕
  - RSA
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - RSA-PSS
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - DSA 🆕
  - EC
    - PEM
    - DER (SEC1) 🆕
    - DER (PKCS#8) 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH
- **Public key import**
  - RSA
    - PEM
    - DER (PKCS#1) 🆕
    - DER (PKCS#8) 🆕
  - RSA-PSS 🆕
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Private key export**
  - RSA 🆕
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Public key export**
  - RSA
  - DSA 🆕
  - EC 🆕
  - X25519 🆕
  - ED25519 🆕
  - DH 🆕
- **Key pair generation**
  - Overhauled, but supported APIs unchanged

This PR adds a lot of new individual functionality. But most importantly
because
of the new key material representation, it is now trivial to add new
algorithms
(as shown by this PR).

Now, when adding a new algorithm, it is also widely supported - for
example
previously we supported ED25519 key pair generation, but we could not
import,
export, sign or verify with ED25519. We can now do all of those things.
2024-08-07 08:43:58 +02:00
Nayeem Rahman
9a83efa04b
feat(lsp): node specifier completions (#24904) 2024-08-06 16:30:34 +01:00
Satya Rohith
b3f1f3ba04
feat: deno run <task> (#24891)
This PR updates `deno run` to fallback to executing tasks when there is
no script with the specified name. If there are both script and a task
with the same name then `deno run` will prioritise executing the script.
2024-08-06 20:35:30 +05:30
snek
897159dc6e
feat: vm rewrite (#24596)
rewrite vm implementation to increase compat.
vm.Module+importModuleDynamically callbacks should be added in a
followup.
2024-08-06 12:52:53 +00:00
HasanAlrimawi
bbf23190d4
fix: update dry run success message (#24885) 2024-08-06 08:14:06 +00:00
Leo Kettmeir
ba40347a35
feat(fetch): accept async iterables for body (#24623)
Implements https://github.com/whatwg/webidl/pull/1397
Fixes #21454 
Closes #24849
2024-08-06 00:13:02 -07:00
Bartek Iwańczuk
3e1f98236f
feat: Add Deno.ServeDefaultExport type (#24879)
Closes https://github.com/denoland/deno/issues/23725
2024-08-05 23:19:09 +02:00
Leo Kettmeir
27ea23ea69
feat(urlpattern): add ignoreCase option & hasRegExpGroups property, and fix spec discrepancies (#24741)
Fixes #20906
Fixes #24266
Closes #21073

---------

Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2024-08-05 01:49:28 -07:00
snek
71ca61e189
Revert "feat: async context" (#24856)
Reverts denoland/deno#24402

deno_web can't depend on code in runtime
2024-08-02 18:16:59 +00:00
snek
3a1a1cc030
feat: async context (#24402)
We are switching to ContinuationPreservedEmbedderData. This allows
adding async context tracking to the various async operations that deno
provides.

Fixes: https://github.com/denoland/deno/issues/7010
Fixes: https://github.com/denoland/deno/issues/22886
Fixes: https://github.com/denoland/deno/issues/24368
2024-08-02 08:14:35 -07:00
Bartek Iwańczuk
b82a2f114c
fix(ext/node): node:zlib coerces quality 10 to 9.5 (#24850)
Fixes https://github.com/denoland/deno/issues/24572
2024-08-02 16:44:32 +02:00
Luca Casonato
7495bcbf77
Revert "perf(ext/node): improve Buffer from string performance" (#24851) 2024-08-02 16:23:21 +02:00
David Sherret
0da81205d5
feat(unstable/fmt): move yaml formatting behind unstable flag (#24848)
This moves YAML formatting behind an unstable flag for Deno 1.46. This
will make it opt-in to start and then we can remove the flag to make it
on by default in version of Deno after that.

This can be specified by doing `deno fmt --unstable-yaml` or by
specifying the following in a deno.json file:

```json
{
  "unstable": ["fmt-yaml"]
}
```
2024-08-02 13:52:48 +00:00
Luca Casonato
84ff418265
feat(test): rename --allow-none to --permit-no-files (#24809) 2024-08-02 13:18:59 +00:00
Pig Fang
124a13280e
feat(fmt): support YAML (#24717) 2024-08-02 12:12:51 +00:00
David Sherret
2ca9940f00
chore: mark upgrade_invalid_canary_version as flaky (#24833) 2024-08-02 12:28:21 +02:00
Hajime-san
ba93278281
fix(ext/webgpu): assign missing constants property of shader about GPUDevice.createRenderPipeline[Async] (#24803)
fixes https://github.com/denoland/deno/issues/24287
2024-08-01 11:19:25 -07:00
Leo Kettmeir
6db5f1bb6e
fix(ext/console): render properties of Intl.Locale (#24827)
Fixes #21271

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-08-01 09:45:05 -07:00
Luca Casonato
4eda9e64e9
fix(ext/http): correctly consume response body in Deno.serve (#24811)
Prior to this commit, you could return a `Response` created from a
string or Uint8Array multiple times.

Now you can't do that anymore.
2024-08-01 15:46:05 +02:00
Ryan Dahl
c79cb339ef
chore: upgrade flaky_test, fastwebsockets, base64, base32, notify (#24746) 2024-08-01 08:35:35 -04:00
Divy Srivastava
9f27bf9144
fix(compile): adhoc codesign mach-o by default (#24824) 2024-08-01 02:11:24 -07:00
Luca Casonato
f1fc708d81
fix(ext/crypto): respect offsets when writing into ab views in randomFillSync (#24816) 2024-08-01 09:38:46 +02:00
snek
f57745fe21
feat: upgrade V8 to 12.8 (#24693)
- upgrade to v8 12.8
  - optimizes DataView bigint methods
  - fixes global interceptors
  - includes CPED methods for ALS
- fix global resolution
- makes global resolution consistent using host_defined_options.
originally a separate patch but due to the global interceptor bug it
needs to be included in this pr for all tests to pass.
2024-07-31 23:22:34 +00:00
Luca Casonato
1faac2dce3
fix(ext/node): handle node child_process with --v8-options flag (#24804)
Makes `v8flags` package from NPM work.
2024-07-31 16:28:08 +02:00
Marvin Hagemeister
9e6288ec61
fix(node/fs/promises): watch should be async iterable (#24805)
The way `fs.watch` works is different in `node:fs/promises` than
`node:fs`. It has a different function signature and it returns an async
iterable instead, see
https://nodejs.org/api/fs.html#fspromiseswatchfilename-options

Fixes https://github.com/denoland/deno/issues/24661
2024-07-31 13:07:49 +02:00
Marvin Hagemeister
1e2581e57b
fix(node/timers/promises): add scheduler APIs (#24802)
This PR adds the experimental `scheduler` APIs in Node's
`timers/promises` module. See
https://nodejs.org/api/timers.html#timerspromisesschedulerwaitdelay-options

Fixes https://github.com/denoland/deno/issues/24800
2024-07-31 12:00:01 +02:00
Nathan Whitaker
cd59fc53a5
fix(node): Rework node:child_process IPC (#24763)
Fixes https://github.com/denoland/deno/issues/24756. Fixes
https://github.com/denoland/deno/issues/24796.

This also gets vitest working when using
[`--pool=forks`](https://vitest.dev/guide/improving-performance#pool)
(which is the default as of vitest 2.0). Ref
https://github.com/denoland/deno/issues/23882.

---

This PR resolves a handful of issues with child_process IPC. In
particular:

- We didn't support sending typed array views over IPC
- Opening an IPC channel resulted in the event loop never exiting
- Sending a `null` over IPC would terminate the channel
- There was some UB in the read implementation (transmuting an `&[u8]`
to `&mut [u8]`)
- The `send` method wasn't returning anything, so there was no way to
signal backpressure (this also resulted in the benchmark
`child_process_ipc.mjs` being misleading, as it tried to respect
backpressure. That gave node much worse results at larger message sizes,
and gave us much worse results at smaller message sizes).
- We weren't setting up the `channel` property on the `process` global
(or on the `ChildProcess` object), and also didn't have a way to
ref/unref the channel
- Calling `kill` multiple times (or disconnecting the channel, then
calling kill) would throw an error
- Node couldn't spawn a deno subprocess and communicate with it over IPC
2024-07-30 16:13:24 -07:00
David Sherret
fe884c557a
fix(compile/windows): handle cjs re-export of relative path with parent component (#24795)
Closes https://github.com/denoland/deno/issues/24785
2024-07-30 16:46:15 -04:00
David Sherret
7a3810195d
fix(node): support wildcards in package.json imports (#24794) 2024-07-30 17:14:07 +00:00
Divy Srivastava
1ba88a7892
perf(ext/node): improve Buffer from string performance (#24567)
Fixes https://github.com/denoland/deno/issues/24323

- Use a Buffer pool for `fromString`
- Implement fast call base64 writes
- Direct from string `create` method for each encoding op

```
$ deno bench -A bench.mjs # 1.45.1+fee4d3a
cpu: Apple M1 Pro
runtime: deno 1.45.1+fee4d3a (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      550 ns/iter     (490 ns … 1'265 ns)    572 ns    606 ns  1'265 ns
Buffer#write base64     285 ns/iter       (259 ns … 371 ns)    307 ns    347 ns    360 ns

$ ~/gh/deno/target/release/deno bench -A bench.mjs # this PR
cpu: Apple M1 Pro
runtime: deno dev (aarch64-apple-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      151 ns/iter       (145 ns … 770 ns)    148 ns    184 ns    648 ns
Buffer#write base64   62.58 ns/iter     (60.79 ns … 157 ns)  61.65 ns  75.79 ns    141 ns

$ node bench.mjs # v22.4.0
cpu: Apple M1 Pro
runtime: node v22.4.0 (arm64-darwin)

benchmark                time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------- -----------------------------
Buffer.from base64      163 ns/iter     (96.92 ns … 375 ns)  99.45 ns    127 ns    220 ns
Buffer#write base64   75.48 ns/iter     (74.97 ns … 134 ns)  75.17 ns  81.83 ns  96.84 ns
```
2024-07-30 18:09:55 +05:30
David Sherret
38a363dc7c
chore: mark upgrade invalid lockfile as flaky (#24760)
Closes #24759
2024-07-29 16:18:25 -04:00
Satya Rohith
8c2f1f5a55
chore: upgrade to rust 1.80 (#24778) 2024-07-29 12:58:04 -04:00
Satya Rohith
8bab761bcc
fix(ext/node): prevent panic in http2.connect with uppercase header names (#24780)
Closes https://github.com/denoland/deno/issues/24678
2024-07-29 13:33:55 +02:00
Yazan AbdAl-Rahman
41f8988dc7
fix(http): Adjust hostname display for Windows when using 0.0.0.0 (#24698)
Fixes #24687

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-07-28 23:04:05 +02:00
David Sherret
50fa4d7ef5
fix: actually add missing node:readline/promises module (#24772)
Closes #24768
2024-07-28 15:41:10 -04:00
Yoshiya Hinosawa
99e811f5eb
test(ext/node): reduce http_test flakiness (#24742) 2024-07-27 22:47:47 +09:00
Kyle Kelley
63f8218a7d
fix: adapt to new jupyter runtime API and include session IDs (#24762)
Closes #24737, #24437.
2024-07-27 10:39:08 +02:00
David Sherret
06b6352292
fix(unstable/compile): handle byonm import in sub dir (#24755)
Regression in 1.45.0 caused by storing relative paths instead of
absolute paths in the binary.

Closes #24654
2024-07-26 15:53:53 -04:00
David Sherret
bee16c54ab
fix(publish): workspace included license file had incorrect path (#24747)
Also fixes the issue where we say a package was successfully published
before it wasn't.

Bug in https://github.com/denoland/deno/pull/24714
2024-07-26 15:35:29 +00:00
David Sherret
7907265590
fix(node): cjs pkg dynamically importing esm-only pkg fails (#24730) 2024-07-25 21:40:10 -04:00
Marvin Hagemeister
0cf7f268a7
fix(node/worker_threads): support port.once() (#24725)
Support `MessagePort.once` in Node mode and enable relevant
`worker_threads` test. Noticed that another Node test was passing as
well, so I enabled that too.
2024-07-25 23:06:19 +02:00
David Sherret
763f05e74d
fix(unstable): move sloppy-import warnings to lint rule (#24710)
Adds a new `no-sloppy-imports` lint rule and cleans up the lint code.

Closes #22844
Closes https://github.com/denoland/deno_lint/issues/1293
2024-07-25 09:07:59 -04:00
Asher Gomez
5f44148e83
chore: update to std@2024.07.19 (#24715) 2024-07-25 15:30:28 +10:00
David Sherret
84b7504d0f
fix(workspaces/publish): include the license file from the workspace root if not in pkg (#24714) 2024-07-25 01:43:30 +00:00
Bartek Iwańczuk
5f5f662a68
fix: upgrade deno_core to 0.298.0 (#24709)
Fixes percent-encoded filenames in stack traces:
- https://github.com/denoland/deno_core/pull/759

Closes #18983
2024-07-25 03:36:34 +02:00
Asher Gomez
f248050cb4
chore: use @std prefix for internal module specifiers (#24543)
This change aims to replace all relative import specifiers targeted at
`tests/util/std` with mapped ones (using a `deno.json` file). Towards
updating the `std` git submodule.
2024-07-25 10:26:54 +10:00
Nathan Whitaker
795ed23b35
fix(future): Emit deno install warning less often, suggest deno install in error message (#24706)
Two small changes:

- In our BYONM errors, suggest running `deno install` instead of `npm
install` if `DENO_FUTURE` is set
- Only emit warning about `deno install` changes if you do `deno install
<foo>` with deno_future unset
2024-07-24 23:37:13 +00:00
Bartek Iwańczuk
1fad6eb2ac
fix(ext/fetch): respect authority from URL (#24705)
This commit fixes handling of "authority" in the URL by properly
sending "Authorization Basic..." header in `fetch` API.

This is a regression from https://github.com/denoland/deno/pull/24593
Fixes https://github.com/denoland/deno/issues/24697

CC @seanmonstar
2024-07-24 23:22:43 +02:00
Leo Kettmeir
b305ba3e1c
perf: update deno_doc (#24700)
Ref https://github.com/denoland/deno_doc/pull/616
2024-07-24 12:23:16 -07:00
HasanAlrimawi
fcd9bbe8ee
fix: update lsp error message of 'relative import path' to 'use deno add' for npm/jsr packages (#24524) 2024-07-24 16:12:42 +01:00
Yoshiya Hinosawa
199a8ca4c5
fix(ext/node/net): emit error before close when connection is refused (#24656) 2024-07-24 20:33:45 +09:00
Nathan Whitaker
29934d558c
fix(node): Run node compat tests listed in the ignore field (and fix the ones that fail) (#24631)
The intent is that those tests will be executed, but our check that the
files are up to date won't overwrite the contents of the tests. This is
useful when a test needs some manual edits to work.

It turns out we weren't actually running them.

---

This ended up turning into a couple of small bug fixes to get the tests
passing:

- We weren't canonicalizing the exec path properly (it sometimes still
had `..` or `.` in it)
- We weren't accepting strings in `process.exit`

There was one failure I couldn't figure out quickly, so I disabled the
test for now, and filed a follow up issue: #24694
2024-07-24 03:12:08 +00:00
David Sherret
52ababc4bf
fix(node): better detection for when to surface node resolution errors (#24653) 2024-07-24 00:22:24 +00:00
Bartek Iwańczuk
445e05a39d
Reland "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24692)
Reverted in
95847f4e94.
2024-07-24 02:11:38 +02:00
David Sherret
9114a2df69
fix(upgrade): do not error if config in cwd invalid (#24689)
```
> deno upgrade
error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile.
V:\scratch
> V:\deno\target\debug\deno upgrade
Looking up latest version
Local deno version 1.45.3 is the most recent release
```

Closes #24517
Closes #20729
2024-07-23 19:00:48 -04:00
HasanAlrimawi
f0df54fc70
fix: enable the reporting of parsing related problems when running deno lint (#24332) 2024-07-23 21:17:17 +00:00
Nayeem Rahman
a45a40533e
fix(lsp): rewrite import for 'infer return type' action (#24685) 2024-07-23 19:39:14 +01:00
Bartek Iwańczuk
8a7ed17ea2
Revert "fix(cli): add NAPI support in standalone mode (#24642)" (#24682)
This reverts commit 4e8f5875bc.

Reverting because, it caused a failure during v1.45.3 publish:

https://github.com/denoland/deno/actions/runs/10048730693/job/27773718095

CC @Mutefish0
2024-07-23 02:42:26 +02:00
Kenta Moriuchi
715675565a
fix(types): Conform lib.deno_web.d.ts to lib.dom.d.ts and lib.webworker.d.ts (#24599)
Fix #24578
Fix #21981
2024-07-22 22:02:39 +02:00
David Sherret
6960637b5c
fix(publish): warn about missing license file (#24677)
Part of https://github.com/denoland/deno/issues/24676 , but just a
warning for now.
2024-07-22 15:46:37 -04:00
Nayeem Rahman
5a696551b7
fix(lsp): scope attribution for asset documents (#24663) 2024-07-22 15:06:08 +01:00
Bartek Iwańczuk
95847f4e94
Revert "fix: CFunctionInfo and CTypeInfo leaks (#24634)" (#24665)
This reverts commit 6c5905dbc3.

Reverting because of errors like this in CI:
```
#
# Fatal error in , line 0
# Check failed: FastApiCallNode::ArityForArgc(c_arg_count, slow_arg_count) == value_input_count.
#
#
#
#FailureMessage Object: 0x7fd5b3ffd9d0
==== C stack trace ===============================

    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1111883) [0x55b8d2107883]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1110b6b) [0x55b8d2106b6b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110c6f9) [0x55b8d21026f9]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x20413cd) [0x55b8d30373cd]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x2034222) [0x55b8d302a222]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x202ff44) [0x55b8d3025f44]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1e0b253) [0x55b8d2e01253]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1dfcd96) [0x55b8d2df2d96]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df92aa) [0x55b8d2def2aa]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1df8b71) [0x55b8d2deeb71]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x11ce49b) [0x55b8d21c449b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x121fb23) [0x55b8d2215b23]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1221359) [0x55b8d2217359]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x1112f3b) [0x55b8d2108f3b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x111792b) [0x55b8d210d92b]
    /home/runner/work/deno/deno/target/release/deps/url_ops-e4068c650cedb9fa(+0x110df0f) [0x55b8d2103f0f]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7fd5cb294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7fd5cb326850]
```
2024-07-22 14:58:58 +02:00
MujahedSafaa
994b6327d3
fix(ext/console): Error Cause Not Inspect-Formatted when printed (#24526)
This pull request addresses an issue where the Error.cause property was
not formatted correctly when printed using console.log, leading to
confusion.

solution:
Implemented a fix to ensure that Error.cause is formatted properly when
printed by console.log, and the fix done by using JSON.stringify

This PR fixes https://github.com/denoland/deno/issues/23416

---------

Signed-off-by: MujahedSafaa <168719085+MujahedSafaa@users.noreply.github.com>
2024-07-22 04:18:49 -07:00
Ivancing
4e8f5875bc
fix(cli): add NAPI support in standalone mode (#24642)
Currently, importing Node-Addons modules in a standalone binary results
in a `missing symbol called` error
(https://github.com/denoland/deno/issues/24614). Because the NAPI
symbols are not exported in this mode. This PR should fix the issue.
2024-07-21 10:40:42 -07:00