Commit graph

10736 commits

Author SHA1 Message Date
David Sherret 741afc4b94
fix(lsp): use a dedicated thread for the parent process checker (#21869)
Ensures the Deno process is brought down even when the runtime gets hung
up on something.

Marvin found that the lsp was running without a parent vscode around so
this is maybe/probably related.
2024-01-09 11:36:03 -05:00
Bartek Iwańczuk cd43d2b877
chore: upgrade deno_core to 0.244.0 (#21859) 2024-01-09 17:25:10 +01:00
Divy Srivastava 6db631a432
fix(ext/websocket): pass on uncaught errors in idleTimeout (#21846)
Fixes https://github.com/denoland/deno/issues/21840

The problem was hard to reproduce as its a race condition. I've added a
test that reproduces the problem 1/10 tries. We should move the
idleTimeout handling to Rust (maybe even built into fastwebsocket).
2024-01-09 19:56:54 +05:30
Asher Gomez 19c10c0246
chore: cleanup readAll() logic (#21862) 2024-01-09 13:53:28 +01:00
David Sherret be888c068c
fix(task): do not eagerly auto-install packages in package.json when "nodeModulesDir": false (#21858)
There's no need to auto-install the package.json if the user is not
using a node_modules directory.

Closes #21850
2024-01-08 19:30:36 -05:00
David Sherret 0efb17b2cb
fix(unstable/tar): skip node_modules, .git, and config "exclude" (#21816) 2024-01-08 18:51:49 -05:00
Ryan Dahl ea5c9a3383
chore: rename do-not-use-publish (#21854) 2024-01-08 20:07:36 +00:00
Marvin Hagemeister 040fdeec0b
fix: cjs export rewritten to invalid identifier (#21853)
<!--
Before submitting a PR, please read https://deno.com/manual/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.
-->

Fixes https://github.com/denoland/deno/issues/21836
2024-01-08 17:50:52 +00:00
David Sherret e212e1fc35
perf: skip expanding exclude globs (#21817)
We were calling `expand_glob` on our excludes, which is very expensive
and unnecessary because we can pattern match while traversing instead.

1. Doesn't expand "exclude" globs. Instead pattern matches while walking
the directory.
2. Splits up the "include" into base paths and applicable file patterns.
This causes less pattern matching to occur because we're only pattern
matching on patterns that might match and not ones in completely
unrelated directories.
2024-01-08 17:18:42 +00:00
Nayeem Rahman ee45d5bf8f
perf(lsp): use host-owned cache for auto-import completions (#21852) 2024-01-08 17:05:05 +00:00
Bartek Iwańczuk 43d2ecd4f0
fix(registry): wait for already pending publish (#21663)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-01-08 15:25:18 +00:00
Asher Gomez 664ffe2ad0
chore(ext/io): cleanup unused functions (#21844)
These functions don't appear to be used anywhere.
2024-01-08 14:04:11 +01:00
Kenta Moriuchi c2c115ebd8
fix(ext): enable prefer-primordials for internal TypeScript (#21813)
Enabled prefer-primordials lint for ext/cron and ext/kv.
2024-01-07 23:20:02 +01:00
David Sherret a731647a51
chore: update LICENSE.md to 2024 (#21833) 2024-01-06 19:14:38 -05:00
Asher Gomez 1af0daa487
chore: define removal version in deprecated IO APIs (#21702)
This defines the removal version of v2 for the following APIs that
favour the Streams API:
* `Deno.copy()`
* `Deno.File`
* `Deno.iter()`
* `Deno.Buffer`
* `Deno.readAll()`
* `Deno.readAllSync()`
* `Deno.writeAll()`
* `Deno.writeAllSync()`
* `Deno.FsWatcher.return()`
2024-01-06 16:38:25 +01:00
Bartek Iwańczuk 13279cb0ab
fix(compile): preserve granular unstable features (#21827)
Fix https://github.com/denoland/deno/issues/21814
2024-01-06 19:31:09 +05:30
Kitson Kelly 49d8320e45
fix(kv): improve .listenQueue types (#21781)
Fixes: #21780
2024-01-06 14:42:14 +01:00
Bartek Iwańczuk d1706c2ac9
refactor: split runtime/98_global_scope.js (#21785) 2024-01-06 14:40:26 +01:00
Divy Srivastava bfd5f1598c
feat(ext/crypto): initial support for p521 in generateKey and importKey (#21815)
Part 1 of a potential 3 part series. Ref #13449 

The current implementation passes key material back and forth RustCrypto
group of crates and ring. ring does not implement p521 yet.

This PR adds support for P521 named curve in `generateKey` and
`importKey` where we use RustCrypto. Other parts should be moved over to
the RustGroup group of crates for consistency.
2024-01-06 16:48:31 +05:30
Divy Srivastava 1d46ee5129
chore(build): document faster rebuilds with cargo plonk (#21823) 2024-01-06 16:27:04 +05:30
Jovi De Croock 7fbdc15f22
fix(cli): update import map url (#21824)
Fixes https://github.com/denoland/deno/issues/21822

This updates the import-maps help URL to the one mentioned in the issue
2024-01-06 11:55:28 +01:00
Divy Srivastava dac9b6ab43
fix(ext/node): add WriteStream.isTTY (#21801) 2024-01-05 22:37:14 +01:00
David Sherret 7c5c502773
chore: update format script (#21811)
The PR referenced has been released so we can update this now.
2024-01-05 16:02:37 +00:00
Bartek Iwańczuk 824f4fa55f
refactor(tools/repl): reorganize code (#21810)
Some drive-by cleanup as I'm working through
https://github.com/denoland/deno_core/pull/415.
2024-01-05 16:14:58 +01:00
Kenta Moriuchi e7e25db24f
chore: update deno_lint for CI (#21802) 2024-01-05 15:03:06 +00:00
Divy Srivastava 9f86705fa6
chore(ext/webgpu): include GPUCanvasContext in snapshot (#21773)
Part 1 of #21713 

Changes:

- Remove `.present()` and add a `presentGPUCanvasContext` (not exposed
yet to users)
- Move lazy load logic to `00_init.js`. This can be used to use webgpu
on-demand from future code (OffScreenCanvas)
2024-01-05 19:55:01 +05:30
Divy Srivastava 611993fbe0
fix(ci): update copright year for _fs_cp.js (#21803) 2024-01-05 13:43:56 +00:00
Divy Srivastava df062d2c78
fix(ext/node): add fs.cp, fs.cpSync, promises.cp (#21745)
Fixes https://github.com/denoland/deno/issues/20803
Fixes https://github.com/denoland/deno/issues/21723

Performance: copying a 48GiB rust `target` folder (recursive)
| Platform  | `deno` | `node v21.5` | Improvement |
| -------- | ------- | ------- | ------- |
| macOS (APFS) |   3.1secs  |  127.99 secs |  **42x** |
| Windows | 18.3secs | 67.2secs |  **3.8x** |

Copying files with varying sizes:


![image](https://github.com/denoland/deno/assets/34997667/58932652-6f7a-47f5-8504-896dc9ab4ddc)
2024-01-05 18:28:33 +05:30
Nayeem Rahman bac51f66aa
fix(lsp): show test code lens for template literal names (#21798) 2024-01-05 12:04:33 +00:00
Bartek Iwańczuk aadcd64065
chore: forward v1.39.2 release commit to main (#21793) 2024-01-04 23:52:17 +00:00
Matt Mastracci c36d9129b5
chore(cli): bump deno_core (#21790) 2024-01-04 18:53:04 +00:00
David Sherret 0245ac08d4
perf(coverage): faster source mapping (#21783)
I did not measure this change (O(n) to O(log n)), but mainly this should
be slightly more accurate at getting the line number.
2024-01-04 08:49:17 -05:00
Divy Srivastava 7fc6f4902a
fix(ci): copyright year for console_test.ts (#21787)
Missed in
b2cd254c35 (diff-0c2dcdd1ce20382e6ddefe52956cf2f570f18063cf09067f8a7ca44abaf33122)
2024-01-04 00:57:13 -05:00
Kenta Moriuchi b2cd254c35
fix: strict type check for cross realms (#21669)
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when
using `Object.prototype.isPrototypeOf` to check built-in types.

```js
import vm from "node:vm";

const err = new Error();
const crossErr = vm.runInNewContext(`new Error()`);

console.assert( !(crossErr instanceof Error) );
console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) );
```

This PR changes to check using internal slots solves them.

---

current: 

```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error {}
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
Date {}
```

this PR:

```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error: message
    at <anonymous>:1:1
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
2018-12-10T02:26:59.002Z
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04 09:42:38 +05:30
David Sherret 4855674857
fix(unstable/byonm): support using an import map with byonm (#21786)
Supports mixing an import map with byonm.
2024-01-04 09:20:58 +05:30
Divy Srivastava ad65440092
fix(ext/node): UdpSocket ref and unref (#21777) 2024-01-04 08:51:39 +05:30
nokazn a0b6872359
fix(cli): respect exclude option for deno check command (#21779)
This PR fixes #21658.

- `check` subcommand sees `exclude` option in `deno.json`. When some
paths passed with `check` command listed in `exclude`, they are ignored.
- When some files are listed in `exclude` and imported indirectly among
module graph, they are checked.
2024-01-03 20:43:17 -05:00
Matt Mastracci 00970daea2
fix(cli): harden permission stdio check (#21778)
Harden the code that does permission checks to protect against
re-opening of stdin.

Code that runs FFI is vulnerable to an attack where fd 0 is closed
during a permission check and re-opened with a file that contains a
positive response (ie: `y` or `A`). While FFI code is dangerous in
general, we can make it more difficult for FFI-enabled code to bypass
additional permission checks.

- Checks to see if the underlying file for stdin has changed from the
start to the end of the permission check (detects races)
- Checks to see if the message is excessively long (lowering the window
for races)
- Checks to see if stdin and stderr are still terminals at the end of
the function (making races more difficult)
2024-01-04 00:31:39 +01:00
Bartek Iwańczuk 7f1c41d245
chore: make test server less noisy (#21782)
Test server was printing a lot of "early eof" messages eg when running
`cargo test integration::npm`. This commit filters out these messages.
2024-01-03 22:43:34 +00:00
Nayeem Rahman 9526520cf0
fix(lsp): support test code lens for Deno.test.{ignore,only}() (#21775) 2024-01-03 16:34:21 +00:00
David Sherret 97937a097e
fix(jupyter): error message when install fails due to jupyter command not being on PATH (#21767)
We were failing silently in this scenario.
2024-01-03 14:45:10 +00:00
Matt Mastracci a387efa46e
fix(cli): make signals tests more reliable (#21772)
Delivering POSIX signals too quickly may result in signal coalescing.
2024-01-03 07:41:58 -07:00
Jovi De Croock f5ad15b504
fix(node/zlib): accept dataview and buffer in zlib bindings (#21756)
Fixes #20516 
Follow up to #21747 and #21746

This tackles the last point of #20516 where certain inputs weren't
accepted in the other zlib methods

This adds the `toU8` conversion of `_brotli` to `_zlib.mjs`, when we
create the ZLibBuffer, we'll sanitize the input. I noticed that the
async had no handler for `string` input so I added that as well.
2024-01-03 19:03:51 +05:30
Nayeem Rahman 59cfe20f3b
chore: ignore hanging lsp jsx test (#21771) 2024-01-03 04:47:59 +00:00
Bartek Iwańczuk 1ee01d57d6
chore: upgrade deno_core to 0.241.0 (#21765) 2024-01-03 01:34:41 +00:00
Nayeem Rahman 261f32ef65
feat(lsp): cache jsxImportSource automatically (#21687) 2024-01-02 23:48:34 +00:00
Bartek Iwańczuk 42e2e318ab
chore: update SECURITY.md (#21766) 2024-01-02 17:53:01 -05:00
Matt Mastracci 001f0df7ee
chore(ext/net): bump rustls-tokio-stream to fix panic (#21763)
Pull in https://github.com/denoland/rustls-tokio-stream/pull/22 to fix
https://github.com/denoland/deno/issues/21762
2024-01-02 14:17:16 -07:00
Divy Srivastava 60403faaf3
fix(ext/node): use node:process in _streams.mjs (#21755)
Fixes https://github.com/denoland/deno/issues/21644

`next build` works:
```
~/gh/deno/target/debug/deno run -A --unstable-byonm ./node_modules/.bin/next build
Warning: Not implemented: process.on("rejectionHandled")
   ▲ Next.js 14.0.4

 ✓ Creating an optimized production build
 ✓ Compiled successfully
 ✓ Linting and checking validity of types
   Collecting page data  ..Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
 ✓ Collecting page data
   Generating static pages (0/5)  [    ]Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
Warning: Not implemented: process.on("rejectionHandled")
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                    5.32 kB        87.4 kB
└ ○ /_not-found                          875 B            83 kB
+ First Load JS shared by all            82.1 kB
  ├ chunks/938-5e061ba0d46125b1.js       26.8 kB
  ├ chunks/fd9d1056-735d320b4b8745cb.js  53.5 kB
  ├ chunks/main-app-2945f337109ea73c.js  220 B
  └ chunks/webpack-e3c6517d4ab8d680.js   1.68 kB


○  (Static)  prerendered as static content
```
2024-01-02 19:08:05 +01:00
Bartek Iwańczuk 3e68114736
chore: increase unit test timeout to 3m (#21760)
Alternative to #21758 to fix timing out tests on Windows.
2024-01-02 16:56:52 +01:00