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

2705 commits

Author SHA1 Message Date
Divy Srivastava
c97a97240b
fix(ext/node): handle closing process.stdin more than once (#21267)
Fixes https://github.com/denoland/deno/issues/21112

Aligns more towards what Node.js does. Closing stdin more than once is a
nop.
2023-11-20 18:57:18 +05:30
Kenta Moriuchi
c806fbdabe
fix(ext,runtime): add missing custom inspections (#21219) 2023-11-19 09:13:38 +01:00
Matt Mastracci
679b7bb8fa
fix(ext/http): fix crash in dropped Deno.serve requests (#21252)
Fixes #21250

We were attempting to recycle dropped resource responses too early.
2023-11-18 13:16:53 -07:00
David Sherret
c213ad380f
chore: combine TestCommandBuilder with DenoCmd (#21248) 2023-11-17 22:46:15 -05:00
Matt Mastracci
4a2d8c4bbd
chore: disable curl --http2 tests (#21247) 2023-11-18 02:08:16 +00:00
Matt Mastracci
23119fc1d4
test(cli): http test reliability fixes (#21246) 2023-11-17 16:19:00 -07:00
Florian Schwalm
20bf697ba6
chore(cli): Fix rename test for XFS (#21215)
Renaming a directory to a path where a non-empty directory already
exists was asserted to always fail with `ENOTEMPTY`
According to glibc manual the function may also fail with `EEXIST` on
"some other systems". One such case is using XFS [^1].

This commit handles the EEXIST case.

[^1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/xfs/xfs_inode.c?h=v4.18&id=94710cac0ef4ee177a63b5227664b38c95bbf703#n3082
2023-11-17 15:24:10 -07:00
David Sherret
daab366b03
ci: fix flaky stdio_streams_are_locked_in_permission_prompt (#21238)
Part of #21187
2023-11-17 16:57:11 +00:00
David Sherret
29011d5929
chore: various improvements to tests (#21222) 2023-11-17 10:05:42 -05:00
Bartek Iwańczuk
9534e6e113
feat(unstable): Workspaces support (#20410)
This commit adds unstable workspace support. This is extremely
bare-bones and
minimal first-pass at this.

With this change `deno.json` supports specifying `workspaces` key, that
accepts a list of subdirectories. Each workspace can have its own import
map. It's required to specify a `"name"` and `"version"` properties in the
configuration file for the workspace:

```jsonc
// deno.json
{
  "workspaces": [
     "a",
     "b"
  },
  "imports": {
    "express": "npm:express@5"
   }
}
```
``` jsonc
// a/deno.json
{
  "name": "a",
  "version": "1.0.2",
  "imports": {
    "kleur": "npm:kleur"
  }
}
```
```jsonc
// b/deno.json
{
  "name": "b",
  "version": "0.51.0",
  "imports": {
    "chalk": "npm:chalk"
  }
}
```

`--unstable-workspaces` flag is required to use this feature:
```
$ deno run --unstable-workspaces mod.ts
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-11-17 01:28:38 +00:00
David Sherret
ceca097e6f
fix(npm): support cjs entrypoint in node_modules folder (#21224)
Closes #21109
2023-11-16 17:29:35 -05:00
Igor Zinkovsky
b572abfcb3
feat(ext/cron) modify Deno.cron API to make handler arg last (#21225)
This PR changes the `Deno.cron` API:
* Marks the existing function as deprecated
* Introduces 2 new overloads, where the handler arg is always last:
```ts
Deno.cron(
  name: string,
  schedule: string,
  handler: () => Promise<void> | void,
)

Deno.cron(
  name: string,
  schedule: string,
  options?: { backoffSchedule?: number[]; signal?: AbortSignal },
  handler: () => Promise<void> | void,
)
```

This PR also fixes a bug, when other crons continue execution after one
of the crons was closed using `signal`.
2023-11-16 14:19:00 -08:00
Matt Mastracci
6b42cecc06
feat(ext/net): use rustls_tokio_stream (#21205)
Fixes #21121 and #19498

Migrates fully to rustls_tokio_stream. We no longer need to maintain our
own TlsStream implementation to properly support duplex.

This should fix a number of errors with TLS and websockets, HTTP and
"other" places where it's failing.
2023-11-15 16:12:46 -07:00
Yoshiya Hinosawa
c67de43ff3
fix(runtime): fix Deno.noColor when stdout is not tty (#21208) 2023-11-15 14:10:12 +09:00
David Sherret
d342c0df71
chore: switch compile tests over to the TestBuilder (#21180) 2023-11-14 16:58:06 +00:00
Bartek Iwańczuk
cf6673b23d
fix(ext/node): add APIs perf_hook.performance (#21192)
Required for Next.js.
2023-11-14 16:33:09 +05:30
Kenta Moriuchi
886652156e
fix(ext/web): webstorage has trap for symbol (#21090) 2023-11-14 07:01:15 +01:00
Matt Mastracci
fe0d9e078f
chore(cli): unflake signal test (#21185)
If these tests do eventually break, they'll time out.
2023-11-13 18:45:48 +00:00
Matt Mastracci
65b9150f83
chore(ext/web): use a non-resource stream for textDecoderStreamCleansUpOnCancel (#21181)
Follow-up fix to #21074
2023-11-13 11:35:48 -07:00
David Sherret
6e1f3aa013
fix(install): should work with non-existent relative root (#21161)
Closes #21160
2023-11-13 09:44:01 -05:00
Nayeem Rahman
55e0483626
fix(lsp): update tsconfig after refreshing settings on init (#21170) 2023-11-12 22:30:04 +00:00
Florian Schwalm
3a7abe6906
fix(ext/web): Prevent TextDecoderStream resource leak on stream cancellation (#21074)
This PR uses the new `cancel` method of `TransformStream` to properly
clean up the internal `TextDecoder` used in `TextDecoderStream` if the
stream is cancelled.

Fixes #13142

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-12 12:47:03 -07:00
Kenta Moriuchi
0c1ab2c7f7
fix(ext/node): Re-enable alloc max size test (#21059)
Ref #21036
2023-11-11 08:23:01 +00:00
Jacob Hummer
b2e3389a6a
fix(node/http): export globalAgent (#21081)
Fixes #21080 
Fixes #18312

---------

Signed-off-by: Jacob Hummer <jcbhmr@outlook.com>
2023-11-11 10:13:30 +05:30
Tareque Md Hanif
eff3e43296
chore(cli): Migrate some unit tests to "Promise.withResolvers()" (#21128)
Migrate to use `Promise.withResolvers()` instead of `deferred` in some
of the tests in `cli/tests/unit/`.
Issue: #21041
2023-11-10 14:29:09 -07:00
Divy Srivastava
df14835b83
fix(ext/node): implement process.geteuid (#21151)
Fixes #21097
2023-11-10 11:49:57 -07:00
David Sherret
b78c7130e9
fix: improve deno doc --lint error messages (#21156)
This also updates deno_graph, which has the JSR change to use "exports".
It's not yet useful atm, so I've made this PR a fix about the deno doc
--lint error message improvements. I'll do a follow-up PR that adds
exports to the deno.json
2023-11-10 18:40:39 +00:00
Divy Srivastava
9f2e56ba96
chore: use internal namespace in 40_testing.js (#21141)
Towards #21136 

- [x] assign serializePermissions, setTimeout and setExitHandler APIs to
internal namespace
- [x] remove usage of assert
2023-11-10 14:34:41 +00:00
Igor Zinkovsky
f4305433dc
fix(test) reduce queue persistence test time from 60 secs to 6 secs (#21142)
This PR reduces the time to run `queue persistence with inflight
messages` test from 60 seconds down to about 6 seconds.

The test simulates a crash to ensure that inflight messages are cleaned
up and re-queued when the new process starts. Since messages are
considered dead after 5 seconds of being queued, reopening the db within
5 seconds does not re-queue the messages on startup (they do get
re-queued after 60 seconds, which is the cleanup frequency). By waiting
for 5 seconds before reopening the db, the test ensures that the cleanup
happens quickly when the db is opened.
2023-11-10 11:28:38 +01:00
Bartek Iwańczuk
612b7dfcc7
fix(node/child_process): properly normalize stdio for 'spawnSync' (#21103)
Closes https://github.com/denoland/deno/issues/20782
2023-11-10 05:59:39 +00:00
Matt Mastracci
9010b8df53
perf: remove knowledge of promise IDs from deno (#21132)
We can move all promise ID knowledge to deno_core, allowing us to better
experiment with promise implementation in deno_core.

`{un,}refOpPromise(promise)` is equivalent to
`{un,}refOp(promise[promiseIdSymbol])`
2023-11-09 13:57:26 -07:00
Divy Srivastava
c4029f6af2
fix(node): implement createPrivateKey (#20981)
Towards #18455
2023-11-09 23:26:59 +05:30
Matt Mastracci
02c5f49a7a
chore: refactor test_server and move to rustls-tokio-stream (#21117)
Remove tokio-rustls as a direct dependency of Deno and refactor
test_server to reduce code duplication.

All tcp and tls listener paths go through the same streams now, with the
exception of the simpler Hyper http-only handlers (those can be done in
a later follow-up).

Minor bugs fixed:
 - gRPC server should only serve h2
 - WebSocket over http/2 had a port overlap
- Restored missing eye-catchers for some servers (still missing on Hyper
ones)
2023-11-08 13:00:29 -07:00
Aravind
e4593873a9
fix(ext/http): Throwing Error if the return value of Deno.serve handler is not a Response class (#21099)
---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-11-07 15:52:44 -07:00
David Sherret
7978bc5d1b
fix(node): cjs export analysis should probe for json files (#21113)
Closes #21064
2023-11-07 16:38:55 -05:00
David Sherret
9201198efd
fix(node): inspect ancestor directories when resolving cjs re-exports during analysis (#21104)
If a CJS re-export can't be resolved, it will check the ancestor
directories, which is more similar to what `require` does at runtime.
2023-11-07 09:56:06 -05:00
Gasman
837c870ff4
fix(node/http): socket.setTimeout (#20930)
Fixes #20923
2023-11-07 00:51:14 +01:00
Kenta Moriuchi
90189dd997
fix(ext): use String#toWellFormed in ext/webidl and ext/node (#21054)
Fixes #18802 

This PR adds `util.toUSVString` to node:util:

```js
import util from "node:util";
util.toUSVString("string\ud801"); // => "string\ufffd"
```
2023-11-06 22:18:28 +01:00
David Sherret
7eb34c7a36
fix(byonm): correct resolution for scoped packages (#21083) 2023-11-06 08:35:26 -05:00
Matt Mastracci
485fade0b6
chore: migrate to new deno_core and metrics (#21057)
- Uses the new OpMetrics system for sync and async calls
- Partial revert of #21048 as we moved Array.fromAsync upstream to
deno_core
2023-11-05 14:27:36 -07:00
David Sherret
e4c947dd2b
fix(node): use closest package.json to resolve package.json imports (#21075) 2023-11-04 16:41:51 +00:00
David Sherret
8acf059ac6
fix(doc): deno doc --lint mod.ts should output how many files checked (#21084)
As pointed out in https://github.com/denoland/deno/issues/21067 , it's
confusing that `deno doc --lint mod.ts` outputs the documentation to
stdout on success. Instead, it would be better if it outputted how many
files were checked similar to what `deno lint` does on success. It still
outputs the documentation if `--lint` or `--html` are provided so this
is non-breaking.
2023-11-04 04:43:54 +00:00
Igor Zinkovsky
1d0856a4f1
feat(ext/kv): increase checks limit (#21055) 2023-11-02 11:57:11 -07:00
Asher Gomez
d7348c870a
fix: add missing Object.groupBy() and Map.groupBy() types (#21050) 2023-11-01 23:18:41 +00:00
David Sherret
58d543a480
fix(repl): jsxImportSource was not working (#21049)
I made some fixes in deno_ast to make this possible and we forgot to
update this.
2023-11-01 23:04:54 +00:00
Bartek Iwańczuk
ab72019a17
feat: enable Array.fromAsync (#21048) 2023-11-01 22:25:18 +00:00
Bartek Iwańczuk
24c3c96958
feat: granular --unstable-* flags (#20968)
This commit adds granular `--unstable-*` flags:
- "--unstable-broadcast-channel"
- "--unstable-ffi"
- "--unstable-fs"
- "--unstable-http"
- "--unstable-kv"
- "--unstable-net"
- "--unstable-worker-options"
- "--unstable-cron"

These flags are meant to replace a "catch-all" flag - "--unstable", that
gives a binary control whether unstable features are enabled or not. The
downside of this flag that allowing eg. Deno KV API also enables the FFI
API (though the latter is still gated with a permission).

These flags can also be specified in `deno.json` file under `unstable`
key.

Currently, "--unstable" flag works the same way - I will open a follow
up PR that will print a warning when using "--unstable" and suggest to use
concrete "--unstable-*" flag instead. We plan to phase out "--unstable"
completely in Deno 2.
2023-11-01 23:15:08 +01:00
Matt Mastracci
42c426e769
feat(ext/websocket): websockets over http2 (#21040)
Implements `WebSocket` over http/2. This requires a conformant http/2
server supporting the extended connect protocol.

Passes approximately 100 new WPT tests (mostly `?wpt_flags=h2` versions
of existing websockets APIs).

This is implemented as a fallback when http/1.1 fails, so a server that
supports both h1 and h2 WebSockets will still end up on the http/1.1
upgrade path.

The patch also cleas up the websockets handshake to split it up into
http, https+http1 and https+http2, making it a little less intertwined.

This uncovered a likely bug in the WPT test server:
https://github.com/web-platform-tests/wpt/issues/42896
2023-11-01 21:11:01 +00:00
Bartek Iwańczuk
587f2e0800
feat: precompile JSX (#20962)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
2023-11-01 20:30:23 +00:00
David Sherret
02822d309f
fix(test): --junit-path should handle when the dir doesn't exist (#21044)
Closes https://github.com/denoland/deno/issues/21022
2023-11-01 19:59:51 +00:00