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

8746 commits

Author SHA1 Message Date
Bartek Iwańczuk
fc2e00152b
feat: support node built-in module imports (#17264)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-24 09:05:54 -05:00
Leo Kettmeir
cadeaae045
feat(runtime/command): make stdin default to inherit for spawn() (#17334)
Closes #17230
2023-01-24 15:03:46 +01:00
David Sherret
654e177c91
refactor(deno_graph): remove unused Resolved::Ok#kind usage (#17504)
See https://github.com/denoland/deno_graph/pull/205 for more details.
2023-01-24 08:23:19 -05:00
Asher Gomez
0d1471282b
feat(upgrade): link to release notes & blog post (#17073)
This change prints a link to the release notes to `deno upgrade` output
and its variations.

Release notes aren't printed for commands relating to canary versions.

Closes #16350.
2023-01-24 13:30:45 +01:00
Bartek Iwańczuk
bf237c6241
refactor: Move lockfile to a separate crate (#17503)
Moves the lockfile implementation to a separate crate so other projects
like Deploy can use it as well.
2023-01-23 23:41:02 +01:00
Divy Srivastava
cd19231306
fix(napi): improve napi_adjust_external_memory (#17501)
<!--
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-23 19:00:01 +05:30
Divy Srivastava
c3e0b12c72
fix(napi): handle return value from initializer (#17502)
Fixes https://github.com/denoland/deno/issues/17349
2023-01-23 18:59:46 +05:30
Divy Srivastava
b96bbc32c8
fix(napi): improve napi_is_detached_arraybuffer (#17498) 2023-01-23 14:22:18 +05:30
Divy Srivastava
2e1df62380
fix(napi): improve napi_detach_arraybuffer (#17499) 2023-01-23 14:21:55 +05:30
Divy Srivastava
c3e3694b9d
fix(napi): correctly handle name in napi_create_function (#17489)
Fixes https://github.com/denoland/deno/issues/17472
2023-01-22 15:04:18 +05:30
Divy Srivastava
5928925541
fix(ext/ffi): disallow empty ffi structs (#17487)
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-21 21:21:14 +05:30
Leo Kettmeir
638b6ef554
Revert "perf(ext/websocket): optimize socket.send (#16320)" (#17480)
This reverts commit 36307c45
2023-01-20 17:20:14 +01:00
Bartek Iwańczuk
da23f7f876
feat: Stabilize Deno.Listener.ref/unref (#17477) 2023-01-20 16:32:55 +01:00
Jun Jiang
c230a95551
chore: upgrade tokio to 1.24.2 (#17467)
Tokio 1.24.2 fixed an unsoundness issue
https://github.com/tokio-rs/tokio/pull/5375
2023-01-19 21:57:13 +05:30
Kenta Moriuchi
023f028186
refactor(core): Overwrite ArrayPrototypeToString in primordials (#17470) 2023-01-19 21:52:18 +05:30
Leo Kettmeir
f85b006628
refactor: cleanup ModuleMap (#17469)
- 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-19 13:47:41 +01:00
Leo Kettmeir
8dbf7d7866
feat: ES module snapshotting (#17460)
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-19 10:00:35 +01:00
Leo Kettmeir
18e8ce4ca5
feat(runtime): add bigint to seek typings (#17314) 2023-01-19 05:30:56 +01:00
Kyle Willmon
84e9794970
chore(ext/crypto): Update rsa to 0.7.0 (#16327)
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-18 15:18:41 +00:00
Divy Srivastava
f418be4f57
Optimize http_bench_json_ops example (#16505) 2023-01-18 15:09:54 +00:00
Nugine
9686a00419
chore: upgrade base64-simd to 0.8.0 (#17463)
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-18 20:05:24 +05:30
Bartek Iwańczuk
f1b275ed6b
fix(napi): don't hold on to borrow during iteration (#17461)
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-18 02:14:53 +01:00
Andreu Botella
69ec45eac7
refactor(cli): Integrate standalone mode cert handling into Flags (#17419)
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-18 01:18:24 +01:00
Luke Channings
1a792f8805
fix(napi) use c_char instead of hardcoding i8 to avoid incompatibility with aarch64 (#17458)
Quick one, compatibility fix for [aarch64
builds](https://github.com/LukeChannings/deno-arm64).
2023-01-17 10:57:44 -05:00
denobot
f2a5f6d7f0
chore: forward v1.29.4 release commit to main (#17453)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-17 00:30:33 +01:00
Geert-Jan Zwiers
e023a6e3f0
refactor(cli): fewer clones (#17450) 2023-01-16 15:27:41 -05:00
David Sherret
40527526e5
refactor(npm): avoid cloning snapshot for lockfile (#17451) 2023-01-16 19:46:30 +00:00
Andreu Botella
f0c79a676c
refactor(core): Move pending_promise_rejections to ContextState (#17447)
This is a requirement before supporting modules in realms.
2023-01-16 22:06:42 +05:30
Kenta Moriuchi
6da958d7ec
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 17:17:18 +01:00
Bartek Iwańczuk
40134ffc99
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 15:19:04 +00:00
David Sherret
9d3483d4eb
fix(repl): improve validator to mark more code as incomplete (#17443)
Closes #17442
2023-01-16 09:45:06 -05:00
Leo Kettmeir
df4d0c55c0
fix(cli/fmt): show filepath for InvalidData error (#17361) 2023-01-16 00:30:52 +00:00
Asher Gomez
7683ba5e90
chore: update std submodule and its imports (#17408) 2023-01-15 21:09:26 +01:00
Divy Srivastava
8f321a8a39
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-15 13:36:12 +00:00
Divy Srivastava
a4c98e3472
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-15 12:56:30 +00:00
Andreu Botella
90c0381272
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-15 07:40:01 +00:00
Garcia
44d9acca75
fix(ext/ffi): use SafeMap in getTypeSizeAndAlignment (#17305) 2023-01-15 06:42:52 +00:00
Isaiah Gamble
9830ae8297
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-15 04:59:35 +00:00
Geert-Jan Zwiers
2f15efbb3d
fix(ext/fetch): remove Response.trailer from types (#17284) 2023-01-15 04:42:52 +00:00
Kenta Moriuchi
1dc3609ff2
fix(core): Add Generator and AsyncGenerator to promordials (#17241) 2023-01-15 04:26:05 +00:00
Divy Srivastava
d5634164cb
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-14 23:18:58 -05:00
Isaiah Gamble
efcbfd5206
fix(ext/fetch) Fix request clone error in flash server (#16174) 2023-01-15 05:08:34 +01:00
Yiyu Lin
fd85f840cd
refactor: clean up unwrap and clone (#17282)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-01-15 09:36:46 +05:30
Andreu Botella
05ef925eb0
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-15 09:09:00 +05:30
Bartek Iwańczuk
df8bfa26be
fix(napi): functions related to errors (#17370)
This commits fixes various NAPI functions related to creation and
throwing of errors.
2023-01-15 09:06:55 +05:30
Kamil Ogórek
e4c6e6e95f
fix(ext/flash): Fix typo in 'chunked' flash ops (#17302)
Just a `s/chuncked/chunked/g`.
2023-01-15 09:04:29 +05:30
David Sherret
7cd249db10
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-14 15:10:07 -05:00
David Sherret
01e02d3123
refactor: create enum for --builtin doc flag (#17423) 2023-01-14 12:39:56 -05:00
David Sherret
1712a88e69
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-14 09:36:19 -05:00
Kamil Ogórek
429ccff657
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-14 15:06:45 +01:00