Commit graph

5733 commits

Author SHA1 Message Date
Asher Gomez b4990d1aa2
refactor: don't error when .env is not present (#21879)
Uses similar format to when the latest version of std is implicitly
being used.

Closes #21788
2024-01-22 00:27:14 +01:00
Asher Gomez 983c745d4f
chore: use FsFile[Symbol.dispose]() (#22007)
This change takes advantage of explicit resources management for
`FsFile` instances and tweaks documentation to encourage the use of it.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-22 00:20:59 +01:00
Bartek Iwańczuk 568337f3f4
fix: remove conditional unstable type-checking from other commands (#21991)
It appears I missed this in https://github.com/denoland/deno/pull/21825.
2024-01-21 22:47:46 +00:00
Asher Gomez 35fc6f3ab9
chore: use Deno.readTextFile() where appropriate (#22018) 2024-01-21 23:41:28 +01:00
David Sherret fbfeedb68b
fix(lsp): improved npm specifier to import map entry mapping (#22016)
Upgrades to the latest deno_semver
2024-01-21 17:19:10 -05:00
Asher Gomez e58462dbb9
chore: use Deno.writeTextFile() where appropriate (#22008) 2024-01-21 21:58:24 +01:00
Divy Srivastava 1b9f0cb452
chore: add types for Deno.UnsafeWindowSurface (#22010) 2024-01-21 21:51:45 +01:00
Marvin Hagemeister 692738232b
fix(node/fs): promises not exporting fs constants (#21997)
<!--
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.
-->

We were missing the `constants` export in the promise `fs` API which is
available in node.

```ts
import { constants, promises } from "node:fs";
import { constants as fsPromiseConstants } from "node:fs/promises";
console.log(constants === promises.constants); // logs: true
console.log(constants === fsPromiseConstants); // logs: true
```

Fixes https://github.com/denoland/deno/issues/21994
2024-01-21 21:48:48 +01:00
Marvin Hagemeister 59f419bf41
fix(node/http): remoteAddress and remotePort not being set (#21998)
<!--
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.
-->

Ultimately, it came down to using incorrect property names in the
`FakeSocket` constructor. The values are passed under `remoteAddress`,
not `hostname` and `remotePort` instead of `port`.

Fixes https://github.com/denoland/deno/issues/21980
2024-01-19 13:09:37 +01:00
Bartek Iwańczuk c62615bfe5
feat: Start warning on each use of a deprecated API (#21939)
This commit introduces deprecation warnings for "Deno.*" APIs.

This is gonna be quite noisy, but should tremendously help with user
code updates to ensure
smooth migration to Deno 2.0. The warning is printed at each unique call
site to help quickly
identify where code needs to be adjusted. There's some stack frame
filtering going on to
remove frames that are not useful to the user and would only cause
confusion.

The warning can be silenced using "--quiet" flag or
"DENO_NO_DEPRECATION_WARNINGS" env var.

"Deno.run()" API is now using this warning. Other deprecated APIs will
start warning
in follow up PRs.

Example:

```js
import { runEcho as runEcho2 } from "http://localhost:4545/run/warn_on_deprecated_api/mod.ts";

const p = Deno.run({
  cmd: [
    Deno.execPath(),
    "eval",
    "console.log('hello world')",
  ],
});
await p.status();
p.close();

async function runEcho() {
  const p = Deno.run({
    cmd: [
      Deno.execPath(),
      "eval",
      "console.log('hello world')",
    ],
  });
  await p.status();
  p.close();
}

await runEcho();
await runEcho();

for (let i = 0; i < 10; i++) {
  await runEcho();
}

await runEcho2();

```

```
$ deno run --allow-read foo.js
Warning
├ Use of deprecated "Deno.run()" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use "Deno.Command()" API instead.
│
└ Stack trace:
  └─ at file:///Users/ib/dev/deno/foo.js:3:16

hello world
Warning
├ Use of deprecated "Deno.run()" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use "Deno.Command()" API instead.
│
└ Stack trace:
  ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18)
  └─ at file:///Users/ib/dev/deno/foo.js:13:7

hello world
Warning
├ Use of deprecated "Deno.run()" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use "Deno.Command()" API instead.
│
└ Stack trace:
  ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18)
  └─ at file:///Users/ib/dev/deno/foo.js:14:7

hello world
Warning
├ Use of deprecated "Deno.run()" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use "Deno.Command()" API instead.
│
└ Stack trace:
  ├─ at runEcho (file:///Users/ib/dev/deno/foo.js:8:18)
  └─ at file:///Users/ib/dev/deno/foo.js:17:9

hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
Warning
├ Use of deprecated "Deno.run()" API.
│
├ This API will be removed in Deno 2.0. Make sure to upgrade to a stable API before then.
│
├ Suggestion: Use "Deno.Command()" API instead.
│
├ Suggestion: It appears this API is used by a remote dependency.
│             Try upgrading to the latest version of that dependency.
│
└ Stack trace:
  ├─ at runEcho (http://localhost:4545/run/warn_on_deprecated_api/mod.ts:2:18)
  └─ at file:///Users/ib/dev/deno/foo.js:20:7

hello world

```

Closes #21839
2024-01-18 23:30:49 +00:00
Jérôme Benoit 99f9fa5556
fix(types): align global deno worker type with deno.worker/webworker one (#21936)
Transpiler doing type checking such as the ones used in dnt or bundler
fail because of incompatible Worker types if env like browser are
targeted.

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
2024-01-18 22:42:04 +00:00
Bartek Iwańczuk 88bc57d764
feat(jupyter): don't require --unstable flag (#21963)
This commit removes the requirement for `--unstable` flag in `deno
jupyter` subcommand. The process will no longer exit if this flag is not
provided, however the subcommand itself is still considered unstable
and might change in the future.

Required for https://github.com/denoland/deno/pull/21452
2024-01-18 23:16:14 +01:00
David Sherret 35c1652f56
fix(lsp): regression - formatting was broken on windows (#21972)
~~Waiting on: https://github.com/denoland/deno_config/pull/31~~

Closes #21971
Closes https://github.com/denoland/vscode_deno/issues/1029
2024-01-18 15:57:30 -05:00
Divy Srivastava 66ff28c21e
fix(node): update req.socket on WS upgrade (#21984)
Update the `req.socket` to be a `net.Socket` from `FakeSocket`

Fixes #21979
2024-01-18 22:24:02 +05:30
Nayeem Rahman 2141543105
feat(lsp): send "deno/didChangeDenoConfiguration" on init (#21965) 2024-01-17 20:22:28 +00:00
Leo Kettmeir 7662b05623
chore: update deno_doc (#21969) 2024-01-17 14:54:00 +01:00
Bartek Iwańczuk 147bfc9c56
refactor: change tests to not rely on Deno.run() (#21961)
For https://github.com/denoland/deno/pull/21939
2024-01-17 02:18:19 +01:00
Matt Mastracci 971eb0e5e8
chore: bump rustls-tokio-stream and rustls (#21955) 2024-01-16 21:51:54 +01:00
Bartek Iwańczuk ae0e7df41a
chore: ignore inspector_port_collision test (#21923)
Ref https://github.com/denoland/deno/issues/21912

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-16 13:50:03 -07:00
Bartek Iwańczuk b142c81721
chore: upgrade clap to 4.4.17 (#21956) 2024-01-16 13:45:11 +01:00
king8fisher 7d29eb0f63
docs(ns): add a notice on file order returned by readDir (#21953) 2024-01-16 13:57:06 +09:00
David Sherret 4e72ca313a
refactor: use globbing from deno_config (#21925) 2024-01-15 19:15:39 -05:00
Matt Mastracci 3ff80eb152
chore(ext/cache): remove CachePutResource in preparation for resource rewrite (#21949)
We can use `resourceForReadableStream` to ensure that cached resources
are implemented more efficiently and remove one more resource special
case.
2024-01-15 13:14:54 -07:00
Bartek Iwańczuk 72ecfe0419
fix(publish): support deno.jsonc file (#21948) 2024-01-15 15:07:57 +00:00
Bartek Iwańczuk bc8d00c880
chore: upgrade deno_core to 0.246.0 (#21904) 2024-01-14 18:28:46 -07:00
Bartek Iwańczuk 5143b9e7d3
feat(unstable): add Temporal API support (#21738)
This commit adds support for [Stage 3 Temporal API
proposal](https://tc39.es/proposal-temporal/docs/).

The API is available when `--unstable-temporal` flag is passed.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
2024-01-15 01:26:57 +01:00
Asher Gomez f46c03d6b4
chore: define removal version for Deno.metrics() (#21872)
Sets the removal version for `Deno.metrics()` to be v2.
2024-01-15 00:50:08 +01:00
Bartek Iwańczuk a918804ee0
feat(unstable): remove --unstable-workspaces flag (#21891)
The workspaces feature is still considered unstable and can change.
Requiring this flag hinders DX.
2024-01-14 21:58:06 +00:00
Bartek Iwańczuk fc17ddbcc4
feat: Stabilize Deno.connect for 'unix' transport (#21937) 2024-01-14 21:50:58 +00:00
Asher Gomez 658b559657
chore: define removal version for Deno.run() (#21863)
This change sets the removal for `Deno.run()` in v2.
2024-01-14 22:25:23 +01:00
Bartek Iwańczuk a25055356c
feat: Deprecate 'Deno.serveHttp' API (#21874)
`Deno.serveHttp` is now deprecated. 

Users should migrate to `Deno.serve` API.
2024-01-14 22:17:50 +01:00
Bartek Iwańczuk 0d51c1f90e
feat: remove conditional unstable type-checking (#21825)
This commit removes conditional type-checking of unstable APIs.

Before this commit `deno check` (or any other type-checking command and
the LSP) would error out if there was an unstable API in the code, but not
`--unstable` flag provided.

This situation hinders DX and makes it harder to configure Deno. Failing
during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-14 18:29:17 +01:00
Bartek Iwańczuk f3bb0a1a0e
feat: stabilize Deno.connectTls options and Deno.TlsConn.handshake (#21889) 2024-01-14 17:06:26 +00:00
David Sherret 3298ca06f5
fix(jsr): ensure proper storage of ahead of time module infos (#21918)
This was incorrectly being stored so the AOT cache for JSR specifiers
wasn't being used. I added a wrapper type to help prevent the API being
used incorrectly.
2024-01-13 20:56:56 -05:00
denobot 248fb9c946
chore: forward v1.39.4 release commit to main (#21933)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-13 20:32:50 -05:00
David Sherret d88c869917
fix(check): should not panic when all specified files excluded (#21929)
Closes #21926
2024-01-13 16:06:18 -05:00
David Sherret daed588557
fix(config): regression - handle relative patterns with leading dot slash (#21922)
This is a hacky quick fix. We need to spend more time cleaning up this
code and push more stuff down into deno_config.

Closes #21916
2024-01-13 10:39:22 -05:00
Bartek Iwańczuk 0b9c06b632
fix(publish): require http server for tests (#21919) 2024-01-12 15:59:27 -07:00
Bartek Iwańczuk 7471587d29
feat: "rejectionhandled" Web event and "rejectionHandled" Node event (#21875)
This commit adds support for "rejectionhandled" Web Event and
"rejectionHandled" Node event.

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

process.on("rejectionHandled", (promise) => {
  console.log("rejectionHandled", reason, promise);
});

window.addEventListener("rejectionhandled", (event) => {
  console.log("rejectionhandled", event.reason, event.promise);
});
```

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-12 22:10:42 +00:00
Bartek Iwańczuk 288774c5ed
chore: forward v1.39.3 to main (#21915)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-12 19:13:18 +00:00
Bartek Iwańczuk f45ceb2320
chore(publish): add --dry-run flag (#21895) 2024-01-11 21:17:03 +00:00
Divy Srivastava 9268df5f34
fix(web): use rustyline for prompt (#21893)
Workaround until https://github.com/kkawakam/rustyline/pull/759
2024-01-11 22:05:55 +01:00
Nayeem Rahman d8f86c8b9c
refactor(lsp): store project version on documents (#21892) 2024-01-11 17:07:44 +00:00
David Sherret 686141163f
fix(fast_check): analyze identifiers in type assertions/as exprs (#21899)
Closes #21894
2024-01-11 11:55:26 -05:00
David Sherret 70ac06138c
feat(unstable): fast subset type checking of JSR dependencies (#21873) 2024-01-10 22:40:30 +00:00
Kenta Moriuchi 515a34b4de
refactor: use core.ensureFastOps() (#21888) 2024-01-10 15:37:25 -07:00
Bartek Iwańczuk d4893eb51a
refactor: remove snapshotting from deno_runtime (#21794)
Closes https://github.com/denoland/deno/issues/21137
2024-01-10 16:30:50 +01:00
Nayeem Rahman 0234eb23dd
fix(lsp): implement host.getGlobalTypingsCacheLocation() (#21882) 2024-01-10 13:16:30 +00:00
cions 881a62869d
fix: android support (#19437)
<!--
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.
-->

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-10 06:04:14 -07:00
Matt Mastracci a45c1e4ae4
chore: bump deno_core (#21832) 2024-01-10 09:48:40 +05:30
Bartek Iwańczuk 69959aa01f
fix: update deno_lint and swc (#21718)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-09 23:20:52 +00:00
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
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
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
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 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
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
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
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
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
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 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
Divy Srivastava 9f7586a206
fix(ext/node): implement os.machine (#21751) 2024-01-02 14:57:54 +01:00
Divy Srivastava 8e4feacd25
fix(ext/http): use arraybuffer binaryType for server websocket (#21741)
Ref
https://github.com/denoland/deno/issues/15340#issuecomment-1872353134
2024-01-02 10:30:09 +05:30
Divy Srivastava 642c4a44a5
fix(ext/node): querystring stringify without encode callback (#21740)
Fixes https://github.com/denoland/deno/issues/21734

Changes:
- Use default encode when options do not provide a encode callback.
- Remove internal TS for `node:querystring`. Its not helping catching
bugs like this because of invalid type assumptions and use of `any`,
more of a maintenance burden.
2024-01-02 04:54:11 +00:00
Divy Srivastava b21462355a
Revert "fix(runtime): Make native modal keyboard interaction consistent with browsers" (#21739)
Reverts denoland/deno#18453

Fixes https://github.com/denoland/deno/issues/21602
https://github.com/denoland/deno/issues/21631
https://github.com/denoland/deno/issues/21641

Reasons for revert:
- alert() and confirm() swallowed ^C with raw mode.
- prompt() did not re-raise the interrupt signal from rustyline. 
- Default 'Y' on confirm() is a bad default and breaking change.

cc @lionel-rowe
2024-01-02 09:36:05 +05:30
林炳权 96b581bdd2
chore: update to Rust 1.75 (#21731) 2024-01-01 23:22:48 +01:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Raashid Anwar 8ba828b41e
fix(http_client): Fix Deno.createHttpClient to accept poolIdleTimeout parameter (#21603)
Fixed the bug `Deno.createHttpClient` to accept `poolIdleTimeout` parameter.

Fixes https://github.com/denoland/deno/issues/21546
2023-12-31 12:45:12 +00:00
Jovi De Croock 4339a6c55d
fix(node/zlib): consistently return buffer (#21747)
This fixes point 3 of https://github.com/denoland/deno/issues/20516

This PR creates consistency between the sync and async versions of the
brotli compress where we will always return a buffer like Node.
2023-12-31 17:23:09 +05:30
Jovi De Croock 08fc8d50e3
fix(node/zlib): cast Dataview and Buffer to uint8 (#21746)
This fixes point 2 of #20516 

This adds a conversion from Dataview/Buffer by returning `obj.buffer`
which can be converted to a `UInt8Array`.

Question: Regarding point 4 of the mentioned issue would it be
appropriate to copy the toU8 helper to the `zlib.mjs` methods?
2023-12-31 17:20:37 +05:30
Leo Kettmeir 4de9ddcf21
chore: update deno_doc to 0.85.0 (#21678) 2023-12-30 00:04:50 +00:00
Joel Walker 4740929950
fix: Object.groupBy return type should be a partial (#21680)
Signed-off-by: Joel Walker <joelwalker1995@gmail.com>
2023-12-30 00:41:40 +01:00
Bartek Iwańczuk fa3a12a805
chore: disable PTR_HOST dns test for Node compat (#21735)
These tests started failing on CI on Dec 28th, 2023 returning
ENOTFOUND. It's unclear what's going on, since `dig -x
8.8.8.8.in-addr.arpa`.

It needs a deeper investigation, but I want to unblock main branch
in the meantime.
2023-12-29 21:15:22 +00:00
Bartek Iwańczuk 1dd1aba244
fix(node): support nested tests in "node:test" (#21717)
Closes https://github.com/denoland/deno/issues/21679
2023-12-29 16:18:08 +01:00
Bartek Iwańczuk 576b20aa00
fix: allow npm: specifiers in import.meta.resolve (#21716)
Closes https://github.com/denoland/deno/issues/21298.

"npm:" specifiers are matched against import map entries
and if no match is found they are passed through.
2023-12-28 20:37:10 +01:00
Divy Srivastava c08319262a
fix(node): Implement os.cpus() (#21697)
Fixes https://github.com/denoland/deno/issues/21666

Zero added dependency and tries to match the libuv implementation
2023-12-28 09:08:50 +05:30