1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

8313 commits

Author SHA1 Message Date
Bartek Iwańczuk
3e47a27f4f
tests: Refactor inspector tests (#16967)
This commit adds "InspectorTester" struct which is used in
inspector tests - it encapsulated various functionalities that
we need (like reading/writing to WebSocket), but also adds
better error handling which should help with debugging flaky
tests.
2022-12-06 18:55:29 +01:00
Luca Casonato
923370f18f
fix(ext/fetch): new Request should soft clone (#16869)
Previously the inner request object of the original and the new request
were the same, causing the requests to be entangled and mutable changes
to one to be visible to the other. This fixes that.
2022-12-06 09:39:04 +01:00
David Sherret
3973ceb634
fix(npm): dependency types were sometimes not being resolved when package had no types entry (#16958)
Closes #16957
2022-12-05 20:09:31 -05:00
Bartek Iwańczuk
79285fa83b
npm: ensure runtime exceptions are surfaced when debugger is attached (#16943)
Currently runtime exception are only displayed at the program end in
terminal, which makes it only a partial fix, as a full fix requires
https://github.com/denoland/rusty_v8/pull/1149 which adds new bindings 
to the inspector that allows to notify it about thrown exceptions.
This will be handled in a follow up commit.
2022-12-06 02:00:10 +01:00
David Sherret
a7dd28a07c
fix(task): improve word parsing (#16911)
Ref https://github.com/denoland/deno_task_shell/pull/67
2022-12-05 19:02:20 -05:00
David Sherret
5e1113ec77
chore: move/remove some repo top level files (#16951) 2022-12-05 17:30:58 -05:00
David Sherret
2fab4583ef
fix(test): improve how --fail-fast shuts down when hitting limit (#16956)
Closes #15650
2022-12-05 16:17:49 -05:00
Bartek Iwańczuk
3863aaf8ae
refactor: remove references to Deno.core in bootstrap code (#16937)
Prerequisite for https://github.com/denoland/deno/pull/16881
2022-12-05 17:11:57 +01:00
Divy Srivastava
55595ca1b7
fix(ops): disallow auto-borrowing OpState across potential await point (#16952)
Fixes https://github.com/denoland/deno/issues/16934

Example compiler error:
```
error: mutable opstate is not supported in async ops
   --> core/ops_builtin.rs:122:1
    |
122 | #[op]
    | ^^^^^
    |
    = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2022-12-05 21:40:22 +05:30
David Sherret
715f35d635
fix(windows): support special key presses in raw mode (#16904)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-05 09:46:04 -05:00
Bartek Iwańczuk
918518b506
napi: respect --quiet flag in unimplemented warnings (#16935) 2022-12-05 14:25:25 +01:00
Bartek Iwańczuk
83b6085604
revert: Inspector changes (#16939)
Reverts 66dc54a7f and e2a0c3f0

Closes https://github.com/denoland/deno/issues/16926
2022-12-04 21:08:53 +01:00
阿豪
8b5b327b18
feat(ext/ffi): better type hints for Deno.dlopen (#16874) 2022-12-03 17:45:35 +05:30
Bartek Iwańczuk
0169949c29
test: reenable inspector_break_on_first_line_in_test test (#16908) 2022-12-03 02:48:10 +01:00
Bert Belder
66dc54a7f5
fix(inspector): even if already woken, always schedule an interrupt (#16910) 2022-12-03 01:18:21 +01:00
Bartek Iwańczuk
e2a0c3f0dc
fix(inspector): allow to poll session with reentry (#16863)
This commit completely rewrites inspector session polling.

Until now, there was a single function responsible for polling inspector
sessions which could have been called when polling the "JsRuntime"
as well as from internal inspector functions. There are some cases
where it's required to have reentrant polling of sessions (eg. when 
"debugger" statement is run) which should be blocking until inspector
sends appropriate message to continue execution. This was not possible
before, because polling of sessions didn't have reentry ability.

As a consequence, session polling was split into two separate functions:
a) one to be used when polling from async context (on each tick of event
loop in "JsRuntime")
b) one to be used when polling synchronously and potentially blocking
(used by various inspector methods).

There are further cleanups and simplifications to be made in inspector
code, but this rewrite solves the problem at hand (being able to
evaluate
"debugger" JS statement and continue inspector functionality).

Co-authored-by: Bert Belder <bertbelder@gmail.com>
2022-12-02 23:17:02 +01:00
David Sherret
868068c847
chore(windows): fix flaky pty_complete_imports (#16905) 2022-12-02 14:59:04 -05:00
David Sherret
83bc8c473d
fix(upgrade/windows): show informative message on access denied error (#16887)
Closes #16886
2022-12-02 14:53:10 -05:00
Rui Chen
c3b75c692c
chore(build): bump textwrap to 0.15.2 (#16906)
As [textwrap 0.15.1 got
yanked](https://github.com/mgeisler/textwrap/issues/484), it caused some
build issue [in the homebrew
side](https://github.com/Homebrew/homebrew-core/pull/116662), bumping
the dependency to 0.15.2.

Signed-off-by: Rui Chen <rui@chenrui.dev>
2022-12-02 14:43:03 -05:00
David Sherret
f4b8c2ea7d
chore: fix flaky netListenUnrefAndRef (#16892)
Closes #16890
2022-12-02 12:41:52 -05:00
David Sherret
b638bc183d
fix(task): support redirects in pipe sequences (#16903)
Categorizing this as a fix because it currently fails silently.
2022-12-02 12:02:44 -05:00
Bartek Iwańczuk
4d07ed0efa
chore: rewrite tests and utils to use Deno.Command API (#16895)
Since "Deno.spawn()", "Deno.spawnSync()" and "Deno.spawnChild"
are getting deprecated, this commits rewrites all tests and utilities to
use "Deno.Command" API instead.
2022-12-02 14:43:17 +01:00
Divy Srivastava
6982c74e11
perf: use fast api for io read/write sync (#15863)
```
$ dd if=/dev/zero bs=65536 count=500000 | ./stdio # C baseline

500000+0 records in
500000+0 records out
32768000000 bytes transferred in 4.126087 secs (7941664827 bytes/sec)
c: size 32768000000 reads 500000 blocksize 65536
```

```
$ dd if=/dev/zero bs=65536 count=500000 | deno run stdio.js # Deno

500000+0 records in
500000+0 records out
32768000000 bytes transferred in 4.279032 secs (7657806719 bytes/sec)
deno: size 32768000000 reads 500000 blocksize 65536
```
2022-12-02 11:35:18 +05:30
Divy Srivastava
9b2b8df927
feat(ops): Fast zero copy string arguments (#16777)
Uses SeqOneByteString optimization to do zero-copy `&str` arguments in
fast calls.

- [x] Depends on https://github.com/denoland/rusty_v8/pull/1129
- [x] Depends on
https://chromium-review.googlesource.com/c/v8/v8/+/4036884
- [x] Disable in async ops
- [x] Make it work with owned `String` with an extra alloc in fast path.
- [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast
case

```rust
#[op]
fn op_string_len(s: &str) -> u32 { 
  str.len() as u32 
}
```
2022-12-02 05:29:15 +00:00
Bartek Iwańczuk
075854e516
chore: update std submodule to 0.167.0 (#16894) 2022-12-02 00:56:10 +01:00
David Sherret
05469fc382
fix(upgrade): respect the --quiet flag (#16888)
Also, use `ProgressBar` for upgrading.
2022-12-01 18:05:49 -05:00
David Sherret
1615852025
chore(npm): fix types tests (#16882) 2022-12-01 12:26:33 -05:00
David Sherret
fafb3eebaf
fix(vendor): properly handle bare specifiers that start with http (#16885) 2022-12-01 11:01:19 -05:00
Geert-Jan Zwiers
0a82f3c0e9
chore(tools): update deprecated commands in format and lint tool (#16864)
Updates tools/format.js and tools/lint.js from Deno.spawn to
Deno.Command API.
2022-12-01 16:51:47 +01:00
Divy Srivastava
824cb485c5
perf(ext/websocket): skip Events constructor checks (#16365)
WebSocket internal events can bypass Event's webidl checks and
`ReflectDefineProperty` on the object value. Note, this intentionally
makes websocket events `isTrusted` configurable (not spec-compliant)
which hurts performance a lot.

Before:
```
Msg/sec: 167627.750000
Msg/sec: 168239.250000
Msg/sec: 169690.000000
```

After:
```
Msg/sec: 191065.500000
Msg/sec: 194745.250000
Msg/sec: 194746.000000
```
2022-12-01 20:05:32 +05:30
denobot
98d062e3dc
chore: forward v1.28.3 release commit to main (#16884)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2022-12-01 22:46:27 +09:00
David Sherret
b1e29d1bd0
fix(npm): improve package.json exports support for types (#16880) 2022-11-30 23:07:32 +00:00
Bartek Iwańczuk
d1962e07af
fix(repl): respect --quiet flag (#16875)
This commit changes REPL behavior to respect --quiet flag. Once 
this flag is present REPL will not print a banner at the start.
2022-11-30 23:25:20 +01:00
Bartek Iwańczuk
381932ce1e
chore: upgrade rusty_v8 to 0.58.0 (#16879) 2022-11-30 22:20:18 +00:00
David Sherret
623dbe7a57
chore: remove unnecessary lifetimes (#16878)
It seems we don't really need to allow these clippy rules.
2022-11-30 19:19:32 +00:00
ud2
972048ce36
fix(ext/web): fix typings for readable stream readers (#16191)
* Introduces `ReadableStreamDefaultReadResult` and modifies
`ReadableStreamDefaultReader.read` to return this type (closes #15269).
* Adds the missing `ReadableStreamBYOBReader` constructor.
* Removes the nonexistent `ReadableStreamReader` class.
2022-11-30 16:24:13 +01:00
Bartek Iwańczuk
3f71c0dcf5
chore: upgrade rusty_v8 to 0.57.0 (#16871) 2022-11-30 00:45:33 +00:00
David Sherret
73f8c820f3
fix(fmt/markdown): fix emoji width calculation in tables (#16870)
https://github.com/dprint/dprint-plugin-markdown/pull/67
2022-11-30 00:34:38 +00:00
David Sherret
e2655c992e
fix(lsp): analyze fs dependencies of dependencies to find npm package requirements (#16866)
Closes #16867
2022-11-30 00:32:18 +00:00
sigmaSd
2656af2544
fix(coverage): Error if the emit cache is invalid (#16850) 2022-11-29 18:43:54 +01:00
Yoshiya Hinosawa
e4fe5ee72a
fix(ext/node): allow absolute path in createRequire (#16853)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-29 14:13:14 +09:00
David Sherret
d3299c2d6c
fix(npm): don't resolve JS files when resolving types (#16854)
Closes #16851
2022-11-28 17:48:56 -05:00
David Sherret
2d4c46c975
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857) 2022-11-28 17:28:54 -05:00
Bartek Iwańczuk
f526513d74
feat(core): show unresolved promise origin (#16650)
This commit updates unhelpful messages that are raised when event loop
stalls on unresolved top-level promises.

Instead of "Module evaluation is still pending but there are no pending
ops or dynamic imports. This situation is often caused by unresolved
promises." and "Dynamically imported module evaluation is still pending
but there are no pending ops. This situation is often caused by
unresolved promises." we are now printing a message like: 

error: Top-level await promise never resolved
[SOURCE LINE]
^
    at [FUNCTION NAME] ([FILENAME])

eg:
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^
at <anonymous>
(file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1)

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2022-11-28 23:07:23 +01:00
Bartek Iwańczuk
fd51b2e506
fix(npm): allow to inspect npm modules with --inspect-brk (#16841) 2022-11-28 21:59:36 +01:00
Leo Kettmeir
9202611e36
fix(runtime): feature-flag snapshot from snapshot (#16843) 2022-11-28 12:47:25 +01:00
Leo Kettmeir
1dd4843b62
feat(unstable): rework Deno.Command (#16812)
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-28 12:33:51 +01:00
David Sherret
fb04e87387
fix(npm): ensure npm package downloaded once per run when using --reload (#16842) 2022-11-27 13:25:08 -05:00
Aapo Alasuutari
a4dfc6f955
fix(ext/ffi): Null buffer pointer value is inconsistent (#16625)
Currently, slow call path will always create a dangling pointer to
replace a null pointer when called with eg. a `new Uint8Array()`
parameter, which V8 initialises as a null pointer backed buffer.

However, the fast call path will never change the pointer value and will
thus expose a null pointer. Thus, it's possible that the pointer value
that a native call sees coming from Deno changes between two sequential
invocations of the same function with the exact same parameters.

Since null pointers can be quite important, and `Uint8Array` is the
chosen fast path for Deno FFI `"buffer"` parameters, I think it is
fairly important that the null pointer be properly exposed to the native
code. Thus this PR.

### `*mut c_void`
While here, I also changed the type of our pointer values to `*mut
c_void`. This is mainly due to JS buffers always being `*mut`, and
because we offer a way to turn a pointer into a JS `ArrayBuffer`
(`op_ffi_get_buf`) which is read-write. I'm not exactly sure which way
we should really go here, we have pointers that are definitely mut but
we also cannot assume all of our pointers are. So, do we go with the
maxima or the minima?

### `optimisedCall(new Uint8Array())`
V8 seems to have a bug where calling an optimised function with a newly
created empty `Uint8Array` (no argument or 0) will not see the data
pointer being null but instead it's some stable pointer, perhaps
pointing to some internal null-backing-store. The pointer value is also
an odd (not even) number, so it might specifically be a tagged pointer.

This will probably be an issue for some users, if they try to use eg.
`method(cstr("something"), new Uint8Array())` as a way to do a fast call
to `method` with a null pointer as the second parameter.

If instead of a `new Uint8Array()` the user instead uses some `const
NULL = new Uint8Array()` where the `NULL` buffer has been passed to a
slow call previously, then the fast call will properly see a null
pointer.

I'll take this up with some V8 engineers to see if this couldn't be
fixed.
2022-11-27 14:38:54 +00:00
Divy Srivastava
ca66978a5a
feat(ops): fast calls for Wasm (#16776)
This PR introduces Wasm ops. These calls are optimized for entry from
Wasm land.

The `#[op(wasm)]` attribute is opt-in. 

Last parameter `Option<&mut [u8]>` is the memory slice of the Wasm
module *when entered from a Fast API call*. Otherwise, the user is
expected to implement logic to obtain the memory if `None`

```rust
#[op(wasm)]
pub fn op_args_get(
  offset: i32,
  buffer_offset: i32,
  memory: Option<&mut [u8]>,
) {
  // ...
}
```
2022-11-27 19:24:28 +05:30