summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-01-23refactor: Move lockfile to a separate crate (#17503)Bartek Iwańczuk
Moves the lockfile implementation to a separate crate so other projects like Deploy can use it as well.
2023-01-23fix(napi): improve napi_adjust_external_memory (#17501)Divy Srivastava
<!-- Before submitting a PR, please read http://deno.land/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. -->
2023-01-23fix(napi): handle return value from initializer (#17502)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17349
2023-01-23fix(napi): improve napi_is_detached_arraybuffer (#17498)Divy Srivastava
2023-01-23fix(napi): improve napi_detach_arraybuffer (#17499)Divy Srivastava
2023-01-22fix(napi): correctly handle name in napi_create_function (#17489)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/17472
2023-01-21fix(ext/ffi): disallow empty ffi structs (#17487)Divy Srivastava
This patch makes `NativeType` to `libffi::middle::Type` conversion failliable and w.t disallows struct with empty fields. libffi does not handle "empty" struct because they don't exist in C (or Rust). Fixes #17481
2023-01-20Revert "perf(ext/websocket): optimize socket.send (#16320)" (#17480)Leo Kettmeir
This reverts commit 36307c45
2023-01-20feat: Stabilize Deno.Listener.ref/unref (#17477)Bartek Iwańczuk
2023-01-19chore: upgrade tokio to 1.24.2 (#17467)Jun Jiang
Tokio 1.24.2 fixed an unsoundness issue https://github.com/tokio-rs/tokio/pull/5375
2023-01-19refactor(core): Overwrite `ArrayPrototypeToString` in primordials (#17470)Kenta Moriuchi
2023-01-19refactor: cleanup ModuleMap (#17469)Leo Kettmeir
- changes module id to be usize & 0 based instead of 1 based - merges `ids_by_handle` & `handles_by_id` to be a single `handles` vector - removes `next_module_id`, as vector is used - turns `info` into a vector
2023-01-19feat: ES module snapshotting (#17460)Leo Kettmeir
This commit adds support for snapshotting ES modules. This is done by adding an ability to serialize and deserialize a "ModuleMap" and attach it to the snapshot, using "add_context_data" API. This has been tested with 400 modules and seems to not have a limit on the number of modules that might be snapshotted. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-19feat(runtime): add bigint to seek typings (#17314)Leo Kettmeir
2023-01-18chore(ext/crypto): Update rsa to 0.7.0 (#16327)Kyle Willmon
Bump the rsa crate to 0.7.0 The API for the `rsa` crate has changed significantly, but I have verified that tests continue to pass throughout this update.
2023-01-18Optimize http_bench_json_ops example (#16505)Divy Srivastava
2023-01-18chore: upgrade base64-simd to 0.8.0 (#17463)Nugine
This PR upgrades the `base64-simd` dependency of `deno_web`. base64-simd v0.8 supports `forgiving_decode` in ["copy" mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode.html), ["inplace" mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode_inplace.html) or ["alloc" mode](https://docs.rs/base64-simd/0.8.0/base64_simd/fn.forgiving_decode_to_vec.html). When #17159 resolves, they can be used to reduce unnecessary allocations and copies. base64-simd v0.8 also supports AArch64 SIMD out of box.
2023-01-18fix(napi): don't hold on to borrow during iteration (#17461)Bartek Iwańczuk
I mistakenly held on to a RefCell's borrow for the whole time of iteration, but since these counters can be refed/unrefed from any thread that is a mistake.
2023-01-18refactor(cli): Integrate standalone mode cert handling into `Flags` (#17419)Andreu Botella
The way the standalone mode handles the `--cert` flag is different to all other modes. This is because `--cert` takes a path to the certificate file, which is directly added to the root cert store; except for compile mode, where its byte contents are stored in the standalone metadata, and they are added to the root cert store after the `ProcState` is created. This change instead changes `Flags::ca_file` (an `Option<String>`) into `Flags::ca_data`, which can represent a `String` file path or a `Vec<u8>` with the certificate contents. That way, standalone mode can create a `ProcState` whose root cert store alreay contains the certificate. This change also adds a tests for certificates in standalone mode, since there weren't any before. This refactor will help with implementing web workers in standalone mode in the future.
2023-01-17fix(napi) use c_char instead of hardcoding i8 to avoid incompatibility with ↵Luke Channings
aarch64 (#17458) Quick one, compatibility fix for [aarch64 builds](https://github.com/LukeChannings/deno-arm64).
2023-01-17chore: forward v1.29.4 release commit to main (#17453)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-16refactor(cli): fewer clones (#17450)Geert-Jan Zwiers
2023-01-16refactor(npm): avoid cloning snapshot for lockfile (#17451)David Sherret
2023-01-16refactor(core): Move `pending_promise_rejections` to `ContextState` (#17447)Andreu Botella
This is a requirement before supporting modules in realms.
2023-01-16chore: update dlint to v0.37.0 for GitHub Actions (#17295)Kenta Moriuchi
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-16refactor(core): rename pending_promise_exception to ↵Bartek Iwańczuk
pending_promise_rejection (#17441) These are technically rejections - a rejection can then raise an exception.
2023-01-16fix(repl): improve validator to mark more code as incomplete (#17443)David Sherret
Closes #17442
2023-01-16fix(cli/fmt): show filepath for InvalidData error (#17361)Leo Kettmeir
2023-01-15chore: update std submodule and its imports (#17408)Asher Gomez
2023-01-15chore(ext/webidl): Add dictionary converter microbenchmark (#17435)Divy Srivastava
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-15fix(runtime/os): use GetPerformanceInfo for swap info on Windows (#17433)Divy Srivastava
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-15fix(ops): disallow memory slices as inputs to async ops (#16738)Andreu Botella
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-15fix(ext/ffi): use SafeMap in getTypeSizeAndAlignment (#17305)Garcia
2023-01-15fix(ext/flash): Fix panic when JS caller doesn't consume request body (#16173)Isaiah Gamble
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-15fix(ext/fetch): remove Response.trailer from types (#17284)Geert-Jan Zwiers
2023-01-15fix(core): Add `Generator` and `AsyncGenerator` to promordials (#17241)Kenta Moriuchi
2023-01-14chore: use rustfmt imports_granularity option (#17421)Divy Srivastava
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-15fix(ext/fetch) Fix request clone error in flash server (#16174)Isaiah Gamble
2023-01-15refactor: clean up `unwrap` and `clone` (#17282)Yiyu Lin
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-15refactor(core): Move optional callbacks from `JsRuntimeState` to ↵Andreu Botella
`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-15fix(napi): functions related to errors (#17370)Bartek Iwańczuk
This commits fixes various NAPI functions related to creation and throwing of errors.
2023-01-15fix(ext/flash): Fix typo in 'chunked' flash ops (#17302)Kamil Ogórek
Just a `s/chuncked/chunked/g`.
2023-01-14fix(npm): handle an npm package that has itself as a dependency (#17425)David Sherret
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-14refactor: create enum for `--builtin` doc flag (#17423)David Sherret
2023-01-14refactor(tsc): do not store some typescript declaration file text in ↵David Sherret
multiple places (#17410)
2023-01-14fix(ext/flash): Correctly handle errors for chunked responses (#17303)Kamil Ogórek
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-14fix(ext/flash): Correctly handle errors for chunked responses (#17303)Kamil Ogórek
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-14fix(runtime/fs): preserve permissions in copyFileSync for macOS (#17412)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/16921
2023-01-14feat(core): Reland support for async ops in realms (#17204)Andreu Botella
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-14chore(napi): Remove unstable libuv methods (#17416)Divy Srivastava
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