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

8519 commits

Author SHA1 Message Date
denobot
65db94feba
1.29.4 (#17452)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-01-16 23:07:42 +01:00
Geert-Jan Zwiers
6f9e27aa6a
refactor(cli): fewer clones (#17450) 2023-01-16 21:35:42 +01:00
David Sherret
7cf10d0f0d
refactor(npm): avoid cloning snapshot for lockfile (#17451) 2023-01-16 21:35:42 +01:00
Andreu Botella
3b03fb822d
refactor(core): Move pending_promise_rejections to ContextState (#17447)
This is a requirement before supporting modules in realms.
2023-01-16 21:35:42 +01:00
Kenta Moriuchi
566e30c29d
chore: update dlint to v0.37.0 for GitHub Actions (#17295)
Updated third_party dlint to v0.37.0 for GitHub Actions. This PR
includes following changes:
 
* fix(prefer-primordials): Stop using array pattern assignments
* fix(prefer-primordials): Stop using global intrinsics except for
`SharedArrayBuffer`
* feat(guard-for-in): Apply new guard-for-in rule
2023-01-16 21:35:41 +01:00
Bartek Iwańczuk
47130f3500
refactor(core): rename pending_promise_exception to pending_promise_rejection (#17441)
These are technically rejections - a rejection can then raise an
exception.
2023-01-16 21:35:41 +01:00
David Sherret
c036c12e44
fix(repl): improve validator to mark more code as incomplete (#17443)
Closes #17442
2023-01-16 21:35:41 +01:00
Leo Kettmeir
24fc295423
fix(cli/fmt): show filepath for InvalidData error (#17361) 2023-01-16 21:35:24 +01:00
Asher Gomez
bac880e734
chore: update std submodule and its imports (#17408) 2023-01-16 21:35:24 +01:00
Divy Srivastava
7f65a5d58a
chore(ext/webidl): Add dictionary converter microbenchmark (#17435)
This commits add a `webidl.createDictionaryConverter` converter
microbenchmark.

There are 2 PRs currently open that need a microbenchmark for webidl
dictionary converter. See https://github.com/denoland/deno/pull/16594
and https://github.com/denoland/deno/pull/16407

Closes https://github.com/denoland/deno/issues/17436
2023-01-16 21:35:23 +01:00
Divy Srivastava
1a0638032e
fix(runtime/os): use GetPerformanceInfo for swap info on Windows (#17433)
Fixes https://github.com/denoland/deno/issues/17417

According to
https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
, `stat.ullTotalPageFile` value is reliable only from
GetPerformanceInfo()

Also see https://github.com/GuillaumeGomez/sysinfo/issues/534

Co-authored-by: Nightly <dhairysrivastava5@gmail.com>
2023-01-16 21:35:23 +01:00
Andreu Botella
4ee76247bc
fix(ops): disallow memory slices as inputs to async ops (#16738)
In Rust, it is UB if a slice is mutated while borrowed except through
the slice itself, and it is also UB if a mutable slice is read while
borrowed. The op macro allows borrowing an `ArrayBuffer{,View}` as a
memory slice for the duration of an op, but this is not sound for async
ops, since the `ArrayBuffer` could be accessed from JS during the await
points. This PR therefore disallows such automatic borrowing only for
async ops.

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-16 21:35:23 +01:00
Garcia
a4d50f8075
fix(ext/ffi): use SafeMap in getTypeSizeAndAlignment (#17305) 2023-01-16 21:35:23 +01:00
Isaiah Gamble
2df72a6e54
fix(ext/flash): Fix panic when JS caller doesn't consume request body (#16173)
If the JS handler gets a POST, PUT, or PATCH request, but doesn't
`await` the body, deno would panic because it will try to read the body
even though the request has already been handled.

Not sure how/where to test this case, so I could use some help with
that.
2023-01-16 21:35:23 +01:00
Geert-Jan Zwiers
183305c05e
fix(ext/fetch): remove Response.trailer from types (#17284) 2023-01-16 21:35:01 +01:00
Kenta Moriuchi
ac056e0aa6
fix(core): Add Generator and AsyncGenerator to promordials (#17241) 2023-01-16 21:35:00 +01:00
Divy Srivastava
9be8f61f52
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699
Closes https://github.com/denoland/deno/issues/2347

Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not
need to switch the cargo toolchain to nightly. Do we care about
formatting stability of our codebase across Rust versions? (I don't)
2023-01-16 21:35:00 +01:00
Isaiah Gamble
d731f1bf35
fix(ext/fetch) Fix request clone error in flash server (#16174) 2023-01-16 21:35:00 +01:00
Yiyu Lin
e989882162
refactor: clean up unwrap and clone (#17282)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-16 21:35:00 +01:00
Andreu Botella
827dfb2139
refactor(core): Move optional callbacks from JsRuntimeState to ContextState (#17422)
The `JsRuntimeState` struct stores a number of JS callbacks that are
used either in the event loop or when interacting with V8. Some of these
callback fields are vectors of callbacks, and therefore could plausibly
store at least one callback per realm. However, some of those fields are
`Option<v8::Global<v8::Function>>`, which would make the callbacks set
by a realm override the one that might have been set by a different
realm.

As it turns out, all of the current such optional callbacks
(`js_promise_reject_cb`, `js_format_exception_cb` and
`js_wasm_streaming_cb`) are only used from inside a realm, and therefore
this change makes it so such callbacks can only be set from inside a
realm, and will only affect that realm.

This is a reland of #15599.

Towards #13239.
2023-01-16 21:35:00 +01:00
Bartek Iwańczuk
e4ca366c88
fix(napi): functions related to errors (#17370)
This commits fixes various NAPI functions related to creation and
throwing of errors.
2023-01-16 21:34:39 +01:00
Kamil Ogórek
5208a4a36a
fix(ext/flash): Fix typo in 'chunked' flash ops (#17302)
Just a `s/chuncked/chunked/g`.
2023-01-16 21:34:39 +01:00
David Sherret
dde5d9c802
fix(npm): handle an npm package that has itself as a dependency (#17425)
I'm not sure this properly handles scenarios where an npm package uses
an alias that resolves to itself, we can fix that if we find a package
that actually depends on that behavior.

Closes #17420
2023-01-16 21:34:39 +01:00
David Sherret
d5627da552
refactor: create enum for --builtin doc flag (#17423) 2023-01-16 21:34:39 +01:00
David Sherret
1d28ed6e5b
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-16 21:34:39 +01:00
Kamil Ogórek
4cc9e2e325
fix(ext/flash): Correctly handle errors for chunked responses (#17303)
The leading cause of the problem was that `handleResponse` has
`tryRespondChunked` passed as an argument, which in turn is implemented
as a call to `core.ops.op_try_flash_respond_chuncked`, that throws in
the repro code.

`handleResponse` was not handled correctly, as it not returned any
value, and had no `catch` attached to it.
It also effectively was never correctly handled inside two other blocks
with `resp.then` and `PromisePrototypeCatch(PromisePrototypeThen(resp,
"..."))` as well, as it just short-circuited the promise with an empty
resolve, instead of relying on the last `(async () => {})` block.

This change makes `handleResponse` return a correct value and attach
`onError` handler to the "non-thenable" variant of response handling
code.
2023-01-16 21:34:15 +01:00
Divy Srivastava
deeeaa8b3a
fix(runtime/fs): preserve permissions in copyFileSync for macOS (#17412)
Fixes https://github.com/denoland/deno/issues/16921
2023-01-16 21:34:15 +01:00
Andreu Botella
4bd29601f0
feat(core): Reland support for async ops in realms (#17204)
Currently realms are supported on `deno_core`, but there was no support
for async ops anywhere other than the main realm. The main issue is that
the `js_recv_cb` callback, which resolves promises corresponding to
async ops, was only set for the main realm, so async ops in other realms
would never resolve. Furthermore, promise ID's are specific to each
realm, which meant that async ops from other realms would result in a
wrong promise from the main realm being resolved.

This change takes the `ContextState` struct added in #17050, and adds to
it a `js_recv_cb` callback for each realm. Combined with the fact that
that same PR also added a list of known realms to `JsRuntimeState`, and
that #17174 made `OpCtx` instances realm-specific and had them include
an index into that list of known realms, this makes it possible to know
the current realm in the `queue_async_op` and `queue_fast_async_op`
methods, and therefore to send the results of promises for each realm to
that realm, and prevent the ID's from getting mixed up.

Additionally, since promise ID's are no longer unique to the isolate,
having a single set of unrefed ops doesn't work. This change therefore
also moves `unrefed_ops` from `JsRuntimeState` to `ContextState`, and
adds the lengths of the unrefed op sets for all known realms to get the
total number of unrefed ops to compare in the event loop.

This PR is a reland of #14734 after it was reverted in #16366, except
that `ContextState` and `JsRuntimeState::known_realms` were previously
relanded in #17050. Another significant difference with the original PR
is passing around an index into `JsRuntimeState::known_realms` instead
of a `v8::Global<v8::Context>` to identify the realm, because async op
queuing in fast calls cannot call into V8, and therefore cannot have
access to V8 globals. This also simplified the implementation of
`resolve_async_ops`.

Co-authored-by: Luis Malheiro <luismalheiro@gmail.com>
2023-01-16 21:34:15 +01:00
Divy Srivastava
f7bb6a0be0
chore(napi): Remove unstable libuv methods (#17416)
This commit removes the libuv pollyfills introduced with Node-API
support.

It is too much Node-specific. Most Node-API modules that depend on libuv
are already giving up the benefits of Node-API. We should rather
encourage modules to use `ThreadSafeFunction` or `AsyncWork` to
interface with the event loop.

Relevant discussion a few months ago:
https://github.com/denoland/deno/pull/13633#discussion_r904916178

cc @bartlomieju
2023-01-16 21:33:12 +01:00
Bartek Iwańczuk
df245ab9ff
fix(napi): correct arguments for napi_get_typedarray_info (#17306) 2023-01-16 21:33:12 +01:00
Bartek Iwańczuk
413a959b45
chore: upgrade rusty_v8 to 0.60.1 (#17407)
Required for https://github.com/denoland/deno/pull/17306
2023-01-16 21:33:12 +01:00
Kiryl Dziamura
c7bff76c41
fix(npm): use original node regex in npm resolution (#17404)
Fixes regex for matching conditional exports in a package.
Updated to the same regex Node.js uses.
2023-01-16 21:33:12 +01:00
Max Coplan
8e0c2f34fa
refactor(bench/http): Use optional chaining instead of || fallthrough (#17317) 2023-01-16 21:33:12 +01:00
Geert-Jan Zwiers
3888162cfa
refactor(coverage): use FileFlags struct (#17388) 2023-01-16 21:33:11 +01:00
Geert-Jan Zwiers
3c53c4b049
refactor(cli/tools): reduce cloning (#17309) 2023-01-16 21:32:01 +01:00
Bartek Iwańczuk
d464df3a25
fix(napi): allow cleanup hook to remove itself (#17402)
This commit fixes "cleanup hooks" in NAPI integration in two ways:
- don't hold to RefCell's borrow while iterating over hooks
- allow a hook to remove itself when being called
2023-01-16 21:32:01 +01:00
Lino Le Van
1b207796aa
fix(napi): update node version to lts (#17399) 2023-01-16 21:32:01 +01:00
David Sherret
69a84a6a2b
chore(ci): use windows-2022 runner on skipped release job on PRs (#17398) 2023-01-16 21:32:01 +01:00
David Sherret
0eb68246da
chore: small cleanup of scripts in ./tools and run copyright checker in lint.js (#17393) 2023-01-16 21:32:01 +01:00
denobot
9806dcc914
1.29.3 (#17395)
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-01-13 12:17:13 -05:00
Bartek Iwańczuk
0e5c7404f2 fix(permissions): lock stdio streams when prompt is shown (#17392)
This commit changes permission prompt to lock stdio streams when prompt
is shown.
2023-01-13 11:20:20 -05:00
Bartek Iwańczuk
9c4327f9d1 tests: Disable flaky flash_shutdown test (#17390) 2023-01-13 11:20:20 -05:00
Bartek Iwańczuk
7ed2c13827 fix(napi): date and unwrap handling (#17369) 2023-01-13 11:20:20 -05:00
Yiyu Lin
3f270c1760 chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 11:20:20 -05:00
David Sherret
369f1d6e01 chore(ci): try to make sysroot step more reliable (#17383)
Main is failing a lot because of:

```
Err:8 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 debootstrap all 1.0.118ubuntu1.8
  Connection failed [IP: 40.81.13.82 80]
Fetched 44.1 MB in 60s (734 kB/s)
E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.118ubuntu1.8_all.deb  Connection failed [IP: 40.81.13.82 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
```
2023-01-13 11:20:19 -05:00
Bartek Iwańczuk
78364f3816 tests: move integration tests to a single module (#17380)
Effectively reverts changes done in
https://github.com/denoland/deno/pull/16816
2023-01-13 11:20:19 -05:00
Leo Kettmeir
257471f586 fix: make self and window getters only & make getterOnly ignore setting (#17362) 2023-01-13 11:20:19 -05:00
David Sherret
0003cf756e chore(ci): only run doc tests on linux (#17379)
Doc tests were observed to take over 100s on the Mac CI in one instance.
2023-01-13 11:20:18 -05:00
Leo Kettmeir
95d4fb624f fix(webidl): properly implement setlike (#17363) 2023-01-13 11:20:18 -05:00
David Sherret
c4be3a0ce7 chore(ci): try some wpt parallelism (#17375) 2023-01-13 11:20:18 -05:00