Commit graph

1306 commits

Author SHA1 Message Date
Bartek Iwańczuk d98be23023
chore: upgrade rusty_v8 to 0.74.0 (#19633) 2023-06-29 23:21:09 +02:00
Matt Mastracci 98df69fd4c
fix(core): Ensure we don't lose the waker when polling an empty JoinSet (#19655)
This is a reproduction and fix for a very obscure bug where the Deno
runtime locks up we end up polling an empty JoinSet and attempt to
resolve ops after-the-fact. There's a small footgun in the JoinSet API
where polling it while empty returns Ready(None), which means that it
never holds on to the waker. This means that if we aren't testing for
this particular return value and don't stash the waker ourselves for a
future async op to eventually queue, we can end up losing the waker
entirely and the op wakes up, notifies tokio, which notifies the
JoinSet, which then has nobody to notify 😢.

Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-29 16:01:54 +00:00
Bartek Iwańczuk 6c6b20b9ea
chore: update deno_lint to 0.48.0 (#19619) 2023-06-27 12:01:20 +02:00
Bartek Iwańczuk ad3c494b46
Revert "Reland "refactor(core): cleanup feature flags for js source i… (#19611)
…nclusion" (#19519)"

This reverts commit 28a4f3d0f5.

This change causes failures when used outside Deno repo:
```
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.34.3+b37b286
Args: ["/opt/hostedtoolcache/deno/0.0.0-b37b286f7fa68d5656f7c180f6127bdc38cf2cf5/x64/deno", "test", "--doc", "--unstable", "--allow-all", "--coverage=./cov"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to read "/home/runner/work/deno/deno/core/00_primordials.js"

Caused by:
    No such file or directory (os error 2)', core/runtime/jsruntime.rs:699:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2023-06-26 13:54:10 +02:00
Nayeem Rahman 28a4f3d0f5
Reland "refactor(core): cleanup feature flags for js source inclusion" (#19519)
Relands #19463. This time the `ExtensionFileSourceCode` enum is
preserved, so this effectively just splits feature
`include_js_for_snapshotting` into `exclude_js_sources` and
`runtime_js_sources`, adds a `force_include_js_sources` option on
`extension!()`, and unifies `ext::Init_ops_and_esm()` and
`ext::init_ops()` into `ext::init()`.
2023-06-25 09:35:31 +02:00
Divy Srivastava 4a18c76135
fix(ext/node): support brotli APIs (#19223)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-24 19:42:08 +05:30
Matt Mastracci 65d9bfb533
refactor(ops): Adding op2 macro and implementing in a couple of places (#19534)
This is a new op system that will eventually replace `#[op]`. 

Features
 - More maintainable, generally less-coupled code
 - More modern Rust proc-macro libraries
- Enforces correct `fast` labelling for fast ops, allowing for visual
scanning of fast ops
 - Explicit marking of `#[string]`, `#[serde]` and `#[smi]` parameters.

This first version of op2 supports integer and Option<integer>
parameters only, and allows us to start working on converting ops and
adding features.
2023-06-24 13:54:10 +02:00
denobot 239dc5e681
chore: forward v1.34.3 release commit to main (#19526)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-16 01:55:31 +02:00
David Sherret cd27757184
fix(compile): some npm dependencies were missing in compiled output (#19503)
Test is in deno_npm.

Closes #19500
2023-06-14 11:53:14 -04:00
Igor Zinkovsky fd9d6baea3
feat(kv) queue implementation (#19459)
Extend the unstable `Deno.Kv` API to support queues.
2023-06-13 17:49:57 -07:00
Bartek Iwańczuk 60bf79c184
Revert "refactor(core): cleanup feature flags for js source inclusion… (#19490)
… (#19463)"

This reverts commit ceb03cfb03.

This is being reverted because it causes 3.5Mb increase in the binary
size,
due to runtime JS code being included in the binary, even though it's
already snapshotted.

CC @nayeemrmn
2023-06-13 22:36:16 +00:00
Nayeem Rahman ceb03cfb03
refactor(core): cleanup feature flags for js source inclusion (#19463)
Remove `ExtensionFileSourceCode::LoadedFromFsDuringSnapshot` and feature
`include_js_for_snapshotting` since they leak paths that are only
applicable in this repo to embedders. Replace with feature
`exclude_js_sources`. Additionally the feature
`force_include_js_sources` allows negating it, if both features are set.
We need both of these because features are additive and there must be a
way of force including sources for snapshot creation while still having
the `exclude_js_sources` feature. `force_include_js_sources` is only set
for build deps, so sources are still excluded from the final binary.

You can also specify `force_include_js_sources` on any extension to
override the above features for that extension. Towards #19398.

But there was still the snapshot-from-snapshot situation where code
could be executed twice, I addressed that by making `mod_evaluate()` and
scripts like `core/01_core.js` behave idempotently. This allowed
unifying `ext::init_ops()` and `ext::init_ops_and_esm()` into
`ext::init()`.
2023-06-13 09:45:06 -06:00
Leo Kettmeir e1be2bb80d
chore: update clap (#19467)
Also switches to use defer for all subcommands besides run.
2023-06-12 13:54:04 +02:00
David Sherret 748a102919
fix(fmt): do not panic formatting json with multiple values (#19442) 2023-06-09 16:38:38 +00:00
Bartek Iwańczuk 168eb8e01d
perf: add Tokio runtime monitor (#19415)
This commit adds ability to print metrics of the Tokio
runtime to the console by passing "DENO_TOKIO_METRICS=1"
env var.

Metrics will be printed every second, but this can be changed
by "DENO_TOKIO_METRICS_INTERVAL=500" env var.
2023-06-09 11:52:51 +00:00
denobot 1b26f3c726
chore: forward v1.34.2 release commit to main (#19434)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-09 02:17:03 +00:00
David Sherret 55f0150854
refactor(compile): store the npm snapshot in the eszip (#19343) 2023-06-08 11:48:29 -04:00
Matt Mastracci f35161d3c5
chore: Ensure we only end up with the clang version we want & upgrade libffi (#19421)
The number of clang versions installed on the build machines is too dang
high.
2023-06-08 15:16:24 +00:00
Bartek Iwańczuk 0197f42e6b
perf: use sendto syscalls (#19414)
This switches syscall used in HTTP and WS server from "writev"
to "sendto".

"DENO_USE_WRITEV=1" can be used to enable using "writev" syscall.
Doing this for easier testing of various setups.
2023-06-08 12:55:33 +02:00
David Sherret 7e91f74d2b
chore: downgrade to Rust 1.69 (#19407) 2023-06-07 21:02:43 +00:00
David Sherret 5c55f2b4fb
chore: upgrade to Rust 1.70.0 (#19345)
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-06 00:35:39 +00:00
David Sherret 8829a1d362
fix: upgrade to deno_ast 0.27 (#19375)
Closes #19148
2023-06-05 19:03:39 -04:00
Kenta Moriuchi d54ef02dfe
chore: update deno_lint to 0.46.0 (#19372) 2023-06-05 15:57:01 -04:00
Kamil Ogórek 260d2ec3a1
perf(ext/http): Migrate op_http_get_request_headers to v8::Array (#19354) 2023-06-02 22:31:27 +00:00
Bartek Iwańczuk acc6cdc0b1
chore: forward v1.34.1 to main (#19312)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-05-29 20:26:03 -06:00
Bartek Iwańczuk 7f5a61c859
pin enum-as-inner dependency (#19311)
Ref https://github.com/bluejekyll/enum-as-inner/issues/98

Had to pin it during the release to publish crates.
2023-05-30 01:55:38 +00:00
Bartek Iwańczuk d72e0281ff
chore: upgrade rusty_v8 to 0.73.0 (#19278) 2023-05-26 16:17:12 +02:00
denobot 935071dd0e
1.34.0 (#19246)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24 23:38:01 +00:00
David Sherret 91ca9904b5
refactor: upgrade to deno_npm 0.6 (#19244) 2023-05-24 16:23:10 -04:00
David Sherret 787e1f0f92
fix(npm): better handling of optional peer dependencies (#19236)
Has fix for https://github.com/denoland/deno_npm/pull/9
2023-05-24 10:56:23 +02:00
Bartek Iwańczuk 01a95d677f
chore: upgrade rusty_v8 to 0.72.0 (#19228)
This commit updates rusty_v8 to 0.72.0 and by extension
V8 to version 11.5.150.1.
2023-05-24 00:11:37 +02:00
Bartek Iwańczuk 5874fc3d0a
feat: add support for globs in the config file and CLI arguments for files (#19102)
Follow up to https://github.com/denoland/deno/pull/19084.

This commit adds support for globs in the configuration file as well 
as CLI arguments for files. 

With this change users can now use glob syntax for "include" and 
"exclude" fields, like so:

```json
{
  "lint": {
    "include": [
      "directory/test*.ts",
      "other_dir/"
    ],
    "exclude": [
      "other_dir/foo*.ts",
      "nested/nested2/*"
    ]
  },
  "test": {
    "include": [
      "data/test*.ts",
      "nested/",
      "tests/test[1-9].ts"
    ],
    "exclude": [
      "nested/foo?.ts",
      "nested/nested2/*"
    ]
  }
}
```

Or in CLI args like so:
```
// notice quotes here; these values will be passed to Deno verbatim
// and deno will perform glob expansion

$ deno fmt --ignore="data/*.ts"
$ deno lint "data/**/*.ts"
```

Closes https://github.com/denoland/deno/issues/17971
Closes https://github.com/denoland/deno/issues/6365
2023-05-23 03:39:59 +02:00
David Sherret 7b4c483aa1
fix(npm): store npm binary command resolution in lockfile (#19219)
Part of #19038

Closes #19034 (eliminates the time spent re-resolving)
2023-05-22 16:55:04 -04:00
Matt Mastracci 612226de8e
chore(cli): One Rust test per JS and Node unit test file (#19199)
This runs our `js_unit_tests` and `node_unit_tests` in parallel, one
rust test per JS unit test file. Some of our JS tests don't like running
in parallel due to port requirements, so this also makes those use a
specific port-per-file. This does not attempt to make the node-compat
tests work.
2023-05-22 13:35:59 -06:00
Bartek Iwańczuk af72a9c657
Revert "perf: use jemalloc as global allocator (#18957)" (#19187)
This reverts commit 798c1ad0f1.

Reverting because this change caused a spike in memory usage, but we
can't fully realise gains from lower GC pressure from more optimal
malloc/ free provided by "jemalloc". 

We might revisit the topic in future.
2023-05-19 09:10:33 -04:00
David Sherret 55db691174
feat(task): glob expansion (#19084)
This adds cross-platform glob expansion to deno task.
2023-05-18 15:56:10 -04:00
denobot 877b38b370
chore: forward v1.33.4 release commit to main (#19181)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.33.4

Please ensure:
- [x] Everything looks ok in the PR
- [ ] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.33.4 && git checkout -b forward_v1.33.4 upstream/forward_v1.33.4
```

Don't need this PR? Close it.

cc @levex

Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-18 20:44:10 +02:00
David Sherret 41f618a1df
fix(npm): improved optional dependency support (#19135)
Note: If the package information has already been cached, then this
requires running with `--reload` or for the registry information to be
fetched some other way (ex. the cache busting).

Closes #15544

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-17 17:38:50 -04:00
Matt Mastracci ad22336245
feat(ext/web): Request higher-resolution timer on Windows if user requests setTimeout w/short delay (#19149)
If a timer is requested with <=100ms resolution, request the high-res
timer. Since the default Windows timer period is 15ms, this means a
100ms timer could fire at 115ms (15% late). We assume that timers longer
than 100ms are a reasonable cutoff here.

The high-res timers on Windows are still limited. Unfortuntely this
means that our shortest duration 4ms timers can still be 25% late, but
without a more complex timer system or spinning on the clock itself,
we're somewhat bounded by the OS' scheduler itself.
2023-05-17 13:59:55 -06:00
Bartek Iwańczuk cb87cb0283
fix: support "fetch" over HTTPS for IP addresses (#18499)
This commit adds support for connecting to IP addresses over HTTPS.

This is done by updating "rustls" to "0.21.0" and other related crates.

Closes https://github.com/denoland/deno/issues/7660
Closes https://github.com/denoland/deno/issues/17967

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-05-17 02:19:23 +02:00
Leo Kettmeir 867a6d3032
refactor(node): reimplement http client (#19122)
This commit reimplements most of "node:http" client APIs using
"ext/fetch".

There is some duplicated code and two removed Node compat tests that
will be fixed in follow up PRs.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-17 01:20:32 +02:00
Luca Casonato bfe93c6e81
refactor(ext/http): generic abstract listeners (#19132)
Improve abstractions around listeners to support listener + connection
network stream combinations not previously possible (for example a
listener exposed as a Tcp, creating Unix network streams).
2023-05-15 16:55:47 +02:00
Bartek Iwańczuk cf6f965e25
chore: upgrade rusty_v8 to 0.71.2 (#19116)
Closes https://github.com/denoland/deno/issues/19021
2023-05-13 21:11:40 +02:00
denobot 7476ee34fa
chore: forward v1.33.3 release commit to main (#19111)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.33.3

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.33.3 && git checkout -b forward_v1.33.3 upstream/forward_v1.33.3
```

Don't need this PR? Close it.

cc @levex

Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-12 14:47:27 +00:00
Bartek Iwańczuk dad7744f2c
chore: upgrade rusty_v8 to 0.71.1 (#19104)
Fixes https://github.com/denoland/deno/issues/19021
2023-05-12 04:09:32 +02:00
Miroslav Bajtoš 78c7ff91e3
chore: upgrade thiserror and deno_lockfile (#19073)
Upgrade `thiserror` to `1.40.0`.

Remove version pinning so that consumers of deno crates can install
newer versions of `thiserrors` without waiting for us to upgrade our
Cargo.toml.

Upgrade `deno_lockfile` to `0.14.0` to bring in `thiserror` upgrade, see
https://github.com/denoland/deno_lockfile/pull/1.
2023-05-11 16:14:51 +02:00
Yarden Shoham 20c42286f8
chore(deps): bump tokio version to 1.28.1 (#19069) 2023-05-11 14:52:56 +02:00
David Sherret 28aa489de9
feat(compile): unstable npm and node specifier support (#19005)
This is the initial support for npm and node specifiers in `deno
compile`. The npm packages are included in the binary and read from it via
a virtual file system. This also supports the `--node-modules-dir` flag,
dependencies specified in a package.json, and npm binary commands (ex.
`deno compile --unstable npm:cowsay`)

Closes #16632
2023-05-10 20:06:59 -04:00
Matt Mastracci 234cef982c
feat(ext/http): Automatic compression for Deno.serve (#19031)
`Content-Encoding: gzip` support for `Deno.serve`. This doesn't support
Brotli (`br`) yet, however it should not be difficult to add. Heuristics
for compression are modelled after those in `Deno.serveHttp`.

Tests are provided to ensure that the gzip compression is correct. We
chunk a number of different streams (zeros, hard-to-compress data,
already-gzipped data) in a number of different ways (regular, random,
large/small, small/large).
2023-05-10 13:23:14 +02:00
Satya Rohith 3e1cc5dbf5
chore: upgrade tokio to 1.28 (#19053) 2023-05-09 20:13:29 +05:30
David Sherret 723d4b0382
perf(fmt): faster formatting for minified object literals (#19050)
Has fix for
https://github.com/dprint/dprint-plugin-typescript/issues/520
2023-05-09 00:53:58 +02:00
Bartek Iwańczuk 7da8b1d9bb
Revert "perf(core): use jemalloc for V8 array buffer allocator (#18875)" (#19046)
This reverts commit 022aae9854.
2023-05-09 03:42:34 +09:00
David Sherret a6c47ee740
refactor(ext/node): combine deno_node::Fs with deno_fs::FileSystem (#18991) 2023-05-05 16:44:24 +00:00
David Sherret 5270c43e41
refactor(ext/fs): boxed deno_fs::FileSystem (#18945)
1. Boxed `File` and `FileSystem` to allow more easily passing this
through the CLI code (as shown within this pr).
2. `StdFileResource` is now `FileResource`. `FileResource` now contains
an `Rc<dyn File>`.
2023-05-04 14:28:42 -04:00
denobot 4b645676d6
chore: forward v1.33.2 release commit to main (#18990)
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED**

This is the release commit being forwarded back to main for 1.33.2

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.33.2 && git checkout -b forward_v1.33.2 upstream/forward_v1.33.2
```

Don't need this PR? Close it.

cc @levex

Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-04 19:19:35 +02:00
Bartek Iwańczuk 798c1ad0f1
perf: use jemalloc as global allocator (#18957)
Follow up to https://github.com/denoland/deno/pull/18875 that enables
`jemalloc` as a global allocator for the Deno CLI.
2023-05-03 00:36:33 +02:00
Divy Srivastava 022aae9854
perf(core): use jemalloc for V8 array buffer allocator (#18875)
This commits changes "deno_core" to use jemalloc allocator as an
allocator
for V8 array buffers. This greatly improves our GC characteristics as we
are using
a lot of short lived array buffers. They no longer go through the
expensive
malloc/free cycle using the default Rust allocator, but instead use
jemallocator's
memory pool.

As a result the flamegraphs for WS/HTTP server flamegraphs no longer
show
stacks for malloc/free around ops that use ZeroCopyBuf and &[u8].

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-02 20:17:11 +05:30
Bartek Iwańczuk 97147faf89
chore: release extension crates, unpin tokio (#18954) 2023-05-02 11:30:11 +00:00
David Sherret 96e214d9d0
fix(fmt/json): support formatting number with exponent and no sign (#18894)
Numbers with an exponent and no sign (ex. `1e1`) would fail to parse.
2023-04-30 10:03:39 -04:00
Divy Srivastava 64e072e499
fix(ext/websocket): update fastwebsockets to 0.3.1 (#18916)
Fixes https://github.com/denoland/deno/issues/18912
Fixes https://github.com/denoland/deno/issues/18808
2023-04-29 22:39:18 +05:30
denobot 6369098ad7
chore: forward v1.33.1 release commit to main (#18897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 21:14:26 +02:00
denobot 39ece1fe0d
1.33.0 (#18879)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28 01:18:57 +02:00
Bartek Iwańczuk 6cd62ea5e9
chore: upgrade rusty_v8 to 0.71.0 (#18868) 2023-04-27 20:50:46 +02:00
Levente Kurusa c3d670dbc9
feat(node/crypto): Elliptic Curve Diffie-Hellman (ECDH) support (#18832)
- ECDH class
- crypto.createECDH()
- Supported curves:
  - secp256k1
  - prime256v1 / secp256r1
  - secp384r1
  - secp224r1

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-27 18:31:35 +02:00
Bartek Iwańczuk 4192978c3a
feat(lint): add Deno.run to no-deprecated-deno-api (#18869)
This upgrade includes a warning for the deprecated "Deno.run()" API.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-27 02:52:52 +00:00
Bartek Iwańczuk 106e4c475f
chore: upgrade rusty_v8 to 0.70.0 (#18844)
Closes https://github.com/denoland/deno/issues/18369
2023-04-26 10:02:03 +02:00
Nayeem Rahman 667acb075c
fix(lsp): show dependency errors for repeated imports (#18807) 2023-04-24 23:52:27 +00:00
Bartek Iwańczuk 28e2c7204f
chore: remove tokio-tungstenite dependency (#18814) 2023-04-23 23:56:55 -04:00
Matt Mastracci bdffcb409f
feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)
This is a rewrite of the `Deno.serve` API to live on top of hyper
1.0-rc3. The code should be more maintainable long-term, and avoids some
of the slower mpsc patterns that made the older code less efficient than
it could have been.

Missing features:

- `upgradeHttp` and `upgradeHttpRaw` (`upgradeWebSocket` is available,
however).
- Automatic compression is unavailable on responses.
2023-04-22 11:48:21 -06:00
Bartek Iwańczuk 068228cb45
refactor: rewrite tests to "fastwebsockets" crate (#18781)
Migrating off of `tokio-tungstenite` crate.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-22 11:17:31 +02:00
David Sherret a615eb3b56
refactor(node): move most of cli/node to ext/node (#18797)
This is just a straight refactor and I didn't do any cleanup in
ext/node. After this PR we can start to clean it up and make things
private that don't need to be public anymore.
2023-04-21 21:02:46 -04:00
Bartek Iwańczuk 779d379c68
chore: upgrade rusty_v8 to 0.69.0 (#18796) 2023-04-22 00:36:52 +00:00
David Sherret cf9fb18494
feat: upgrade deno_ast to 0.26 (#18795)
Closes #18792
2023-04-21 21:16:25 +00:00
Divy Srivastava 4e944dea1d
fix(ext/websocket): upgrade fastwebsockets to 0.2.4 (#18791)
Fixes https://github.com/denoland/deno/issues/18775
2023-04-21 08:55:02 +02:00
Divy Srivastava 1976504c63
refactor(ext/websocket): use fastwebsockets client (#18725) 2023-04-20 21:54:22 +05:30
Divy Srivastava 9496dfc685
fix(ext/node): implement asymmetric keygen (#18651)
Towards #18455 

This commit implements the keypair generation for asymmetric keys for
the `generateKeyPair` API.

See how key material is managed in this implementation:
https://www.notion.so/denolandinc/node-crypto-design-99fc33f568d24e47a5e4b36002c5325d?pvs=4

Private and public key encoding depend on `KeyObject#export` which is
not implemented. I've also skipped ED448 and X448 since we need a crate
for that in WebCrypto too.
2023-04-19 22:27:34 +05:30
denobot 4e5d370b56
chore: forward v1.32.5 release commit to main (#18758)
Co-authored-by: levex <levex@users.noreply.github.com>
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-04-18 22:20:49 +02:00
Levente Kurusa 530963c34c
refactor(node/crypto): scrypt polyfill to rust (#18746) 2023-04-18 14:29:10 +02:00
Bartek Iwańczuk d01340dab0
chore: upgrade hyper to 0.14.26 (#18693)
https://github.com/hyperium/hyper/releases/tag/v0.14.26
2023-04-14 09:32:32 -06:00
David Sherret efa7c19890
refactor: upgrade to deno_npm 0.3.0 (#18671)
This allows us to specify the `@types/node` version constraint in the
CLI instead of in deno_npm.
2023-04-13 10:47:45 -04:00
Divy Srivastava 738bdebe13
chore: bump fastwebsockets to 0.1.3 (#18684)
Fixes build on aarch64 Linux. See
https://github.com/littledivy/fastwebsockets/issues/2
2023-04-13 13:16:19 +00:00
Bartek Iwańczuk 702284dc22
perf(ops): directly respond for eager ops (#18683)
This commit changes "eager ops" to directly return a response value
instead of calling "opresponse" callback in JavaScript. This saves
one boundary crossing and has a fantastic impact on the "async_ops.js"
benchmark:

```
v1.32.4
$ deno run cli/bench/async_ops.js
time 329 ms rate 3039513
time 322 ms rate 3105590
time 307 ms rate 3257328
time 301 ms rate 3322259
time 303 ms rate 3300330
time 306 ms rate 3267973
time 300 ms rate 3333333
time 301 ms rate 3322259
time 301 ms rate 3322259
time 301 ms rate 3322259
time 302 ms rate 3311258
time 301 ms rate 3322259
time 302 ms rate 3311258
time 302 ms rate 3311258
time 303 ms rate 3300330
```

```
this branch
$ ./target/release/deno run -A cli/bench/async_ops.js
time 257 ms rate 3891050
time 248 ms rate 4032258
time 251 ms rate 3984063
time 246 ms rate 4065040
time 238 ms rate 4201680
time 227 ms rate 4405286
time 228 ms rate 4385964
time 229 ms rate 4366812
time 228 ms rate 4385964
time 226 ms rate 4424778
time 226 ms rate 4424778
time 227 ms rate 4405286
time 228 ms rate 4385964
time 227 ms rate 4405286
time 228 ms rate 4385964
time 227 ms rate 4405286
time 229 ms rate 4366812
time 228 ms rate 4385964
```

Prerequisite for https://github.com/denoland/deno/pull/18652
2023-04-13 14:32:47 +02:00
Yiyu Lin d790ea7d53
refactor(cli,ext,ops): cleanup regex with lazy-regex (#17296)
- bump deps: the newest `lazy-regex` need newer `oncecell` and
`regex`
- reduce `unwrap`
- remove dep `lazy_static`
- make more regex cached

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 03:08:01 +02:00
Yiyu Lin 19c3e4f6dc
refactor(serde_v8): move to thiserror, better error output (#18202)
Ref #17318

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 02:03:56 +02:00
denobot 05c393b99b
chore: forward v1.32.4 release commit to main (#18669)
Co-authored-by: levex <levex@users.noreply.github.com>
2023-04-12 13:03:27 -04:00
Luca Casonato f90caa821c
refactor(ext/fs): abstract FS via FileSystem trait (#18599)
This commit abstracts out the specifics of the underlying system calls
FS operations behind a new `FileSystem` and `File` trait in the
`ext/fs` extension.

This allows other embedders to re-use ext/fs, but substituting in a
different FS backend.

This is likely not the final form of these traits. Eventually they will
be entirely `deno_core::Resource` agnostic, and will live in a seperate
crate.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-12 15:13:32 +02:00
David Sherret 0e3f62d444
fix(npm): cache bust npm specifiers more aggressively (#18636)
Part 1: #18622 
Part 2: This PR

Closes #16901

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-12 08:36:11 -04:00
Divy Srivastava a0dd0cbcb9
fix(ext/node): add X509Certificate (#18625)
Towards #18455
2023-04-07 22:54:16 +05:30
David Sherret 5c7f76c570
fix(npm): reload an npm package's dependency's information when version not found (#18622)
This reloads an npm package's dependency's information when a
version/version req/tag is not found.

This PR applies only to dependencies of npm packages. It does NOT yet
cause npm specifiers to have their dependency information cache busted.
That requires a different solution, but this should help cache bust in
more scenarios.

Part of #16901, but doesn't close it yet
2023-04-06 21:41:19 -04:00
Bartek Iwańczuk 0dca0c5196
chore: remove lockfile/ (#18618)
New home at https://github.com/denoland/deno_lockfile.
2023-04-07 00:55:53 +02:00
David Sherret d07aa4a072
refactor(npm): use deno_npm and deno_semver (#18602) 2023-04-06 18:46:44 -04:00
Divy Srivastava df72420d72
fix(ext/node): implement hkdf-expand (#18612)
Towards https://github.com/denoland/deno/issues/18455
2023-04-06 16:56:56 +00:00
Divy Srivastava 4cc8784f5b
perf(ext/websocket): replace tokio_tungstenite server with fastwebsockets (#18587)
https://github.com/littledivy/fastwebsockets

```
# This PR
./load_test 100 0.0.0.0 8080 0 0
Running benchmark now...
Msg/sec: 176355.000000

# main
./load_test 100 0.0.0.0 8080 0 0
Running benchmark now...
Msg/sec: 157198.750000
```
2023-04-06 18:44:31 +05:30
Yusuke Tanaka 9626c48a01
feat(task): introduce built-in unset command to deno task (#18606)
This introduces a new built-in `unset` command to `deno task` by bumping
deno_task_shell to the latest version 0.11.0. Also this includes a fix
on how `deno task` handles empty environment variables (see
https://github.com/denoland/deno_task_shell/pull/80 for details).
2023-04-06 11:53:44 +09:00
Bartek Iwańczuk 51d3fb78ad
refactor: remove "ext/flash" (#18578)
With https://github.com/denoland/deno/pull/18568 landed we no longer
need "ext/flash". 

This commit removes "deno_flash" extension completely.

This should have some impact on the binary and snapshot size.

Closes https://github.com/denoland/deno/issues/17356
2023-04-03 19:01:02 +02:00
Matt Mastracci 513dadadcf
feat(ext/http): add an op to perform raw HTTP upgrade (#18511)
This commit adds new "op_http_upgrade_early", that allows to hijack
existing "Deno.HttpConn" acquired from "Deno.serveHttp" API 
and performing a Websocket upgrade on this connection.

This is not a public API and is meant to be used internally in the
"ext/node" polyfills for "http" module.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-02 23:27:12 +02:00
denobot ad8d0c90d1
chore: forward v1.32.3 release commit to main (#18561)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-01 20:27:53 -04:00
denobot f465123fdc
chore: forward v1.32.2 release commit to main (#18539)
This is the release commit being forwarded back to main for 1.32.2
2023-04-01 00:10:13 +00:00
Divy Srivastava feab94ff51
fix(ops): fallback when FastApiOneByteString is not utf8 (#18518)
Fixes https://github.com/denoland/deno/issues/18255
2023-03-31 17:46:25 +02:00
Divy Srivastava b9a3790932
perf: const op declaration (#18288)
Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-31 14:42:14 +02:00
David Sherret 6fb6b0c1f3
chore: restore pty tests and make them run on the Linux CI (#18424)
1. Rewrites the tests to be more back and forth rather than getting the
output all at once (which I believe was causing the hangs on linux and
maybe mac)
2. Runs the pty tests on the linux ci.
3. Fixes a bunch of tests that were just wrong.
4. Adds timeouts on the pty tests.
2023-03-28 21:49:00 +00:00
Yoshiya Hinosawa 4358ab2d84
fix(ext/node): implement crypto.Sign (RSA/PEM/SHA{224,256,384,512}) (#18471) 2023-03-28 21:46:48 +09:00
Divy Srivastava 10012c2fe3
feat(ext/node): add crypto.checkPrime API (#18465)
Towards #18455 

This commit implements `checkPrimeSync` and `checkPrime` in node:crypto
using the Miller-Rabin primality test (fun fact: it actually is a test
for composite numbers)

It first compares the candidate against many known small primes and if
not, proceeds to run the Miller-Rabin primality test.
http://nickle.org/examples/miller-rabin.5c used as reference
implementation.
2023-03-28 10:56:38 +00:00
Divy Srivastava 67e21e71ce
chore(ext/node): port pbkdf2 to Rust (#18470)
Towards #18455
2023-03-28 09:40:56 +00:00
Divy Srivastava b2fd0742bd
feat: port node:zlib to rust (#18291) 2023-03-27 16:03:07 +00:00
Leo Kettmeir 33362b88c3
chore: upgrade clap to v4 (#17333) 2023-03-26 06:06:18 +02:00
Leo Kettmeir fe88b53e50
refactor: include mitata (#18426) 2023-03-25 15:29:46 +01:00
Yoshiya Hinosawa 70e2e8f2dd
fix(ext/node): add aes-128-ecb algorithm support (#18412) 2023-03-25 15:42:07 +09:00
denobot e8348231df
chore: forward v1.32.1 release commit to main (#18399)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-23 22:55:23 +01:00
Matt Mastracci f69e4794d2
chore: update ext/ code to only use ASCII (#18371)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-22 19:34:14 -06:00
denobot 25b564bf86
1.32.0 (#18367)
Bumped versions for 1.32.0

---------

Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-03-22 22:22:24 +00:00
Matt Mastracci cebefa8783
chore(test_util): replace tempdir code w/tempdir crate (#18340) 2023-03-22 12:55:19 -06:00
Bartek Iwańczuk e73e8410f6
chore: upgrade rusty_v8 to 0.66.0 (#18339) 2023-03-22 13:38:56 +01:00
Heyang Zhou 92ebf4afe5
feat(ext/kv): key-value store (#18232)
This commit adds unstable "Deno.openKv()" API that allows to open
a key-value database at a specified path.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-22 12:13:24 +08:00
Bartek Iwańczuk cc46f6776c
Revert "perf: disable TSC snapshot compression (#18333)" (#18336)
This reverts commit 0d27de943a.
2023-03-21 19:11:22 +00:00
Bartek Iwańczuk 0d27de943a
perf: disable TSC snapshot compression (#18333)
This commit disables compression of the TSC snapshot.
The compression only decreased the size of snapshot by 0.5Mb
and it took about 40s during release build to compress.

With recent gains in TS 5.0 upgrade in terms of size and performance
it makes sense to remove this compression.
2023-03-21 17:53:46 +00:00
David Sherret 2fcf1f14cf
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator
support because swc does not support that yet.
2023-03-21 15:46:40 +00:00
Max 84fedabab3
chore: bump http to ^0.29.0 (#18259)
`http` is very stable, it's safe to "unpin" it from `=0.28.0` version.

This helps embedders that depend on newer version of `http` crate.
2023-03-19 00:34:56 +00:00
Bartek Iwańczuk 8f9becee76
perf: disable runtime snapshot compression (#18239)
This commit removes compression for the runtime JS code.

It means that we will have a bigger binary, but faster startup. After
several discussion in the CLI team we decided it's worth to trade
about 3Mb of binary size for 2ms faster startup time. With WebGPU
removed in 35196eab27
it shouldn't have such a big impact on the binary size.
2023-03-17 08:49:46 +05:30
Leo Kettmeir 35196eab27
BREAKING(unstable): remove WebGPU (#18094)
This PR _**temporarily**_ removes WebGPU (which has behind the
`--unstable` flag in Deno), due to performance complications due to its
presence.

It will be brought back in the future; as a point of reference, Chrome
will ship WebGPU to stable on 26/04/2023.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 00:29:32 +01:00
Divy Srivastava 5a1d3ea614
chore: bump rusty_v8 to 0.65.0 (#18231)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-16 22:02:09 +00:00
Luca Casonato b99c431ac7
feat(serde_v8): support BigInt serialization (#18225)
This commit enables serializing `v8::BigInt` to `num_bigint::BigInt`
in Rust.

Pre-requisite for sub upcoming feature work.
2023-03-16 16:59:47 +00:00
denobot 33b85a2b8e
chore: forward v1.31.3 release commit to main (#18222)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2023-03-16 17:09:26 +09:00
Divy Srivastava 51649272bd
perf: do not depend on iana-time-zone (#18088)
Chrono's `clock` feature pulls in `iana-time-zone` which links to macOS
core_foundation. This PR itself is not enough to get rid of
CoreFoundation. Removal depends on getting rid of security framework,
see #18071
2023-03-15 07:14:22 +00:00
Yiyu Lin 96b1ede254
refactor(lockfile): move anyhow to thiserror (#18178) 2023-03-14 10:55:52 -04:00
Yoshiya Hinosawa e80cc17dc4
fix(ext/node): add crypto.createCipheriv (#18091) 2023-03-14 15:59:23 +09:00
sean watters e712fbfe4a
fix(core): Upgrades bytes crate from =1.2.1 to ^1.4.0 (#18123)
Motivation: currently can't embed `deno_core` in any project that
depends on later version of `bytes` crate.
2023-03-13 13:26:46 +01:00
denobot 857393d934
chore: forward v1.31.2 release commit to main (#18114)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-10 17:39:29 +09:00
Bartek Iwańczuk 78d430103a
fix(prompt): better output with control chars (#18108) 2023-03-10 01:09:14 +01:00
Divy Srivastava 2f81e555d8
chore: bump rusty_v8 to 0.64.0 (#18096) 2023-03-09 19:51:26 +00:00
David Sherret 25d98ca289
refactor(lsp): improve test client initialization (#18015) 2023-03-08 23:15:20 +00:00
Bartek Iwańczuk 06a12341c6
chore: update tempfile dependency (#18077) 2023-03-08 16:46:27 +00:00
Miroslav Bajtoš b21129173a
deps: bump once_cell to ^1.17.1 (#18075) 2023-03-08 15:49:13 +00:00
David Sherret 88b5fd9088
fix: attempt to only allow one deno process to update the node_modules folder at a time (#18058)
This is implemented in such a way that it should still allow processes
to go through when a file lock wasn't properly cleaned up and the OS
hasn't released it yet (but with a 200ms-ish delay).

Closes #18039
2023-03-08 15:13:13 +00:00
Bartek Iwańczuk fe368b72c1
refactor: Add "deno_fs" extension crate (#18040)
This commit factors out APIs related to file system from "runtime/"
to a separate "deno_fs" extension crate.
2023-03-07 18:13:44 +09:00
Divy Srivastava 4451fa857b
perf(ext/node): improve createHash performance (#18033)
```
> deno run -A ../test.mjs
cpu: unknown
runtime: deno 1.31.1 (aarch64-apple-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p995
------------------------------------------------- -----------------------------
             2.22 µs/iter      (2.2 µs … 2.28 µs)   2.22 µs   2.28 µs   2.28 µs

> target/release/deno run -A test.mjs
cpu: unknown
runtime: deno 1.31.1 (aarch64-apple-darwin)

benchmark      time (avg)             (min … max)       p75       p99      p995
------------------------------------------------- -----------------------------
            864.9 ns/iter   (825.05 ns … 1.22 µs) 864.93 ns   1.22 µs   1.22 µs
```
2023-03-06 08:58:04 +05:30
Bartek Iwańczuk 7afa3aceb0
refactor(runtime): factor out deno_io extension crate (#18001)
This is a prerequisite to factor out FS ops to a separate crate.
2023-03-05 00:39:48 +00:00
David Sherret 84bafd11d5
fix: lazily surface errors in package.json deps parsing (#17974)
Closes #17941
2023-03-03 18:27:05 -04:00
Yusuke Tanaka 88c9a999f7
chore(cli): update deno_lint to 0.41.0 (#17997)
<!--
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.
-->

This commit updates deno_lint crate to 0.41.0. The new version contains
a braking change that requries a minor code fix here, which is also
addressed in this commit.
2023-03-02 21:50:17 +00:00
David Sherret ea1cb4c2fa
chore(test): remove TestCommandOutput macros (#17975) 2023-02-28 15:10:12 -04:00
Dominic DiGiacomo 5e91489db9
deps: bump regexp to ^1.7.0 (#17966) 2023-02-27 08:30:45 +02:00
sean watters ce94bf47ae
fix(cli,ext/web): Upgrading uuid from =1.1.2 to 1.3.0 (#17963)
Resolves https://github.com/denoland/deno/issues/17962
2023-02-26 21:53:52 +02:00
denobot 3cd24fa8d0
chore: forward v1.31.1 release commit to main (#17939)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-02-24 22:37:46 -05:00
David Sherret d6192ce8fd
fix: regression remapping remote specifier to local file (#17935)
Tests added to deno_graph, which were previously not there.

Closes #17932
2023-02-25 01:23:51 +00:00
David Sherret 6472afd12b
fix: remote modules should be allowed to import data urls (#17920)
This was a regression that has already been broken for some time, but
that also became broken for when using an import map 1.31.

Closes #17914
2023-02-24 12:50:03 -05:00
denobot c26fbe38d5
1.31.0 (#17906)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-24 00:16:04 +01:00
David Sherret b15f9e60a0
feat(task): support scripts in package.json (#17887)
This is a super basic initial implementation. We don't create a
`node_modules/.bin` folder at the moment and add it to the PATH like we
should which is necessary to make command name resolution in the
subprocess work properly (ex. you run a script that launches another
script that then tries to launch an "npx command"... this won't work
atm).

Closes #17492
2023-02-22 22:45:35 -05:00
David Sherret a6ca4d0d61
refactor: use deno_graph for npm specifiers (#17858)
This changes npm specifiers to be handled by deno_graph and resolved to
an npm package name and version when the specifier is encountered. It
also slightly changes how npm specifier resolution occurs—previously it
would collect all the npm specifiers and resolve them all at once, but
now it resolves them on the fly as they are encountered in the module
graph.

https://github.com/denoland/deno_graph/pull/232

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-22 14:15:25 -05:00
David Sherret b4b718d6ae
fix(lint): revert no-deprecated-api for Deno.run (#17880) 2023-02-22 16:14:53 +00:00
David Sherret 3479bc7661
fix(npm): improve peer dependency resolution (#17835)
This PR fixes peer dependency resolution to only resolve peers based on
the current graph traversal path. Previously, it would resolve a peers
by looking at a graph node's ancestors, which is not correct because
graph nodes are shared by different resolutions.

It also stores more information about peer dependency resolution in the
lockfile.
2023-02-21 12:03:48 -05:00
Leo Kettmeir 88f6fc6a16
refactor: use ops for idna & punycode (#17817)
Towards https://github.com/denoland/deno/issues/17809
2023-02-20 18:47:42 +01:00
Divy Srivastava ea7ca00c89
perf: use ops for node:crypto ciphers (#17819)
Towards #17809
2023-02-20 22:22:28 +05:30
David Sherret 610b8cc2bf
refactor: add NpmPackageId back from deno_graph as NpmPackageNodeId (#17804)
The `NpmPackageId` struct is being renamed to `NpmPackageNodeId`. In a
future PR it will be moved down into only npm dependency resolution and
a `NpmPackageId` struct will be introduced in `deno_graph` that only has
the name and version of the package (no peer dependency identifier
information). So a `NpmPackageReq` will map to an `NpmPackageId`, which
will map to an `NpmPackageNodeId` in the npm resolution.
2023-02-17 09:12:22 -05:00
Bartek Iwańczuk e0074b5afd
chore: upgrade tokio to 1.25.0 (#17590)
Upgrades "tokio" dependency to version 1.25.0.
2023-02-17 00:34:12 +01:00
David Sherret c4b9a91e27
refactor: use deno_graph's semver and npm structs (#17791) 2023-02-15 13:20:40 -05:00
David Sherret b34e751a5b
refactor: make resolver required (#17783)
Makes the resolver required and prints a warning when vendoring and a
dynamic import can't be resolved.

Closes #16522
2023-02-15 11:30:54 -05:00
Matt Mastracci 4104a674c7
fix(ext/ffi): improve error messages in FFI module (#17786)
Fixes denoland#16922.

The error messages in the `ffi` module are somewhat cryptic when passing
functions that have invalid `parameters` or `result` type strings. While
the generated serializer for the `ForeignFunction` struct correctly
outputs a correct and verbose message, the user sees a far less helpful
`data did not match any variant` message instead.

The underlying cause appears to be the fallback message in the
auto-derived deserializer for untagged enums [1] generated as a result
of `ForeignSymbol` being marked as `#[serde(untagged)]` [2]. Passing an
unexpected value for `NativeType` causes it to error out while
attempting to deserialize both enum variants -- once because it's not a
match for the `ForeignStatic` variant, and once because the
`ForeignFunction` deserializer rejects the invalid type for the
parameters/return type. This is currently open as [serde
#773](https://github.com/serde-rs/serde/issues/773), and not a trivial
exercise to fix generically.

[1]
https://github.com/serde-rs/serde/blob/v0.9.7/serde_derive/src/de.rs#L730
[2] https://github.com/denoland/deno/blob/main/ext/ffi/dlfcn.rs#L102
[3] https://github.com/serde-rs/serde/issues/773

Note that the auto-generated deserializer for untagged enums uses a
private API to buffer deserializer content that we don't have access to.
Instead, we can make use of the `serde_value` crate to buffer the
values. This can likely be removed once the official buffering API lands
(see [4] and [5]). In addition, this crate pulls in `serde_json` as a
cheap way to test that the deserializer works properly.

[4] https://github.com/serde-rs/serde/issues/741
[5] https://github.com/serde-rs/serde/pull/2348
2023-02-15 09:41:59 +05:30
Bartek Iwańczuk d47147fb6a
feat(ext/node): embed std/node into the snapshot (#17724)
This commit moves "deno_std/node" in "ext/node" crate. The code is
transpiled and snapshotted during the build process.

During the first pass a minimal amount of work was done to create the
snapshot, a lot of code in "ext/node" depends on presence of "Deno"
global. This code will be gradually fixed in the follow up PRs to migrate
it to import relevant APIs from "internal:" modules.

Currently the code from snapshot is not used in any way, and all
Node/npm compatibility still uses code from 
"https://deno.land/std/node" (or from the location specified by 
"DENO_NODE_COMPAT_URL"). This will also be handled in a follow 
up PRs.

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-02-14 17:38:45 +01:00
Bartek Iwańczuk 1740e0fc36
chore: upgrade rusty_v8 to 0.63.0 (#17705) 2023-02-10 12:40:03 +00:00
David Sherret b3e88e0681
refactor: deno_graph 0.43 upgrade (#17692) 2023-02-09 22:00:23 -05:00
Leo Kettmeir 286e5d0be9
refactor: internal runtime code TS support (#17672)
This is a proof of concept for being able to snapshot TypeScript files.

Currently only a single runtime file is authored in TypeScript -
"runtime/js/01_version.ts".

Not needed infrastructure was removed from "core/snapshot_util.rs".

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-08 22:40:18 +01:00
Bartek Iwańczuk 65500f36e8
chore: upgrade rusty_v8 to 0.62.2 (#17604)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2023-02-07 13:36:41 +01:00
denobot a4988d00da
chore: forward v1.30.3 release commit to main (#17677)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-07 04:15:38 +00:00
denobot f8ecd236fb
chore: forward v1.30.2 release commit to main (#17641)
This is the release commit being forwarded back to main for 1.30.2

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-02-03 16:26:43 +00:00
denobot 65755a115a
chore: forward v1.30.1 release commit to main (#17623)
This is the release commit being forwarded back to main for 1.30.1
2023-02-02 16:28:40 +00:00
Leo Kettmeir 3035dee9f1
chore: update webgpu (#17534) 2023-01-30 15:14:16 +01:00
David Sherret 1803df7d3a
fix(fmt): semiColons: false - handle prop with following generator and do while with no block body (#17567)
Closes #17559
2023-01-28 10:06:37 -05:00
denobot a6f915c22f
1.30.0 (#17532)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-26 00:15:08 +01:00
Bartek Iwańczuk c6c8c91a6e
feat: embed import map in the config file (#17478)
This commit changes handling of config file to enable
specifying "imports" and "scopes" objects effectively making
the configuration file an import map.

"imports" and "scopes" take precedence over "importMap" configuration,
but have lower priority than "--importmap" CLI flag.

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-25 21:13:40 +01:00
Bartek Iwańczuk 8b7023bc7e
Revert "chore: upgrade rusty_v8 to 0.62.0 (#17200)" (#17523)
This reverts commit e2d75491d5.
2023-01-25 15:36:10 +01:00
Bartek Iwańczuk e2d75491d5
chore: upgrade rusty_v8 to 0.62.0 (#17200) 2023-01-25 12:22:27 +00: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
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
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
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
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
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
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
Bartek Iwańczuk d0f88fc1ca
chore: upgrade rusty_v8 to 0.60.1 (#17407)
Required for https://github.com/denoland/deno/pull/17306
2023-01-14 10:36:42 +05:30
David Sherret 377f593273
chore: forward 1.29.3 release back to main (#17401) 2023-01-13 13:36:51 -05:00
David Sherret 8c3c02354d
fix(fmt): better handling of link reference definitions when formatting markdown (#17352)
Two fixes:

- https://github.com/dprint/dprint-plugin-markdown/pull/75
- https://github.com/dprint/dprint-plugin-markdown/pull/73
2023-01-11 18:35:45 +00:00
Leo Kettmeir c41d4ff90e
feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-08 23:48:46 +01:00
Dj ad82918f56
feat(ext/ffi): structs by value (#15060)
Adds support for passing and returning structs as buffers to FFI. This does not implement fastapi support for structs. Needed for certain system APIs such as AppKit on macOS.
2023-01-08 09:28:10 +05:30
Jun Jiang f26700862a
chore: upgrade tokio to 1.24.0 (#17271) 2023-01-06 16:37:23 +01:00
denobot fa271b70db
chore: forward v1.29.2 release commit to main (#17277)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-05 16:48:19 +01:00
David Sherret 0ee64ad847
fix: upgrade deno_ast to 0.23 (#17269)
Closes #17172
Closes #15669
Closes #8529
2023-01-04 18:54:54 -05:00
Ryan Dahl 400cd331fb
chore: bump deno_fetch and deno_http versions (#17124)
https://github.com/denoland/deno/pull/17081
https://github.com/denoland/deno/pull/17126
2022-12-20 04:54:27 -08:00
Luca Casonato 8e947bb674
fix(ext/http): close stream on resp body error (#17126)
Previously, errored streaming response bodies did not cause the HTTP
stream to be aborted. It instead caused the stream to be closed gracefully,
which had the result that the client could not detect the difference
between a successful response and an errored response.

This commit fixes the issue by aborting the stream on error.
2022-12-20 08:46:45 +00:00
Divy Srivastava 5a8adc342b
chore(test_util): use pty2 instead of pty (#17131)
Fixes https://github.com/denoland/deno/issues/484

Removes dependency on winapi 0.2.x versions.
2022-12-19 18:12:45 +00:00
David Sherret 2afac5bf78
refactor(progress bars): global control for drawing (#17091)
This PR adds the concept of a global `DrawThread`, which can receive
multiple renderers to draw information on the screen (note: the
underlying thread is released back to tokio when it's not rendering). It
also separates the concept of progress bars from the existing "draw
thread". This makes it trivial for us to do stuff like show permission
prompts and progress bars at the same time in the future.

The reason this is global is because the process' tty stderr is also a
global concept.
2022-12-19 11:19:33 -05:00
denobot b9527f5020
chore: forward v1.29.1 release commit to main (#17067)
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2022-12-15 13:30:55 -05:00
denobot 0d4e4af7ac
1.29.0 (#17052)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-12-15 00:22:54 +01:00
David Sherret 392cca87a8
fix(fmt): panic in yaml header with multi-byte characters (#17042)
Closes #17010
2022-12-13 23:36:02 +00:00
Bartek Iwańczuk 12626b11f7
chore: upgrade rusty_v8 to 0.60.0 (#17033) 2022-12-13 17:07:18 +01:00
Bartek Iwańczuk 8c026dab92
feat: improve download progress bar (#16984)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-12-12 20:52:10 -05:00
David Sherret dac30af151
feat(fmt): improve width calculation (#16982)
Formats code according to Unicode Standard Annex #11 rules
(https://crates.io/crates/unicode-width).

This aligns `deno fmt` more with prettier.
2022-12-07 17:32:24 -05:00
David Sherret 192f07bb7e
feat(flags): add deno check --all as new preferred alias for --remote (#16702)
Closes #16374
2022-12-07 13:33:26 -05:00
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05: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
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 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
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
Bartek Iwańczuk 381932ce1e
chore: upgrade rusty_v8 to 0.58.0 (#16879) 2022-11-30 22:20:18 +00: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
Leo Kettmeir 6344b9e0a5
chore: update deno_doc (#16838) 2022-11-26 22:28:20 +00:00
Bartek Iwańczuk d8ab492d01
chore: update rusty_v8 to 0.56.1 (#16835) 2022-11-26 20:11:27 +01:00
Bartek Iwańczuk 55da1a2e72
chore: update rusty_v8 to 0.56.0 (#16814)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-11-26 16:35:46 +01:00
Divy Srivastava 8fc62f93bf
fix(ops): circular dependency in deno_ops test (#16809) 2022-11-25 20:17:21 +05:30
David Sherret e6a9588b43
fix(task): output encoding issues on windows (#16794)
Closes #16792
2022-11-24 19:37:02 -05:00
denobot 72dd7ad807
chore: forward v1.28.2 release commit to main (#16796)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-24 23:59:42 +01:00
David Sherret f2330fcd9b
fix(fmt/markdown): scenario where whitespace was being incorrectly stripped in inline links (#16769)
https://github.com/dprint/dprint-plugin-markdown/pull/69

Closes #16730
2022-11-23 12:44:57 -05:00
Leo Kettmeir 13e3acf71d
chore: workspace inheritance (#16343) 2022-11-22 21:07:35 +01:00
Bartek Iwańczuk f077c4f248
chore: update import_map and deno_doc (#16755) 2022-11-22 16:19:41 +01:00
Bartek Iwańczuk d232746928
feat(core): Ability to create snapshots from existing snapshots (#16597)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-11-21 14:36:26 +01:00
denobot 483c10c94b
chore: forward v1.28.1 release commit to main (#16678)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-17 02:17:19 +01:00
David Sherret 40a72f3555
fix(npm): support non-all lowercase package names (#16669)
Supports package names that aren't all lowercase.

This stores the package with a leading underscore (since that's not
allowed in npm's registry and no package exists with a leading
underscore) then base32 encoded (A-Z0-9) so it can be lowercased and
avoid collisions.

Global cache dir:

```
$DENO_DIR/npm/registry.npmjs.org/_{base32_encode(package_name).to_lowercase()}/{version}
```

node_modules dir `.deno` folder:

```
node_modules/.deno/_{base32_encode(package_name).to_lowercase()}@{version}/node_modules/<package-name>
```

Within node_modules folder:

```
node_modules/<package-name>
```

So, direct childs of the node_modules folder can have collisions between
packages like `JSON` vs `json`, but this is already something npm itself
doesn't handle well. Plus, Deno doesn't actually ever resolve to the
`node_modules/<package-name>` folder, but just has that for
compatibility. Additionally, packages in the `.deno` dir could have
collissions if they have multiple dependencies that only differ in
casing or a dependency that has different casing, but if someone is
doing that then they're already going to have trouble with npm and they
are asking for trouble in general.
2022-11-16 18:44:31 +00:00
denobot 916598f8a7
1.28.0 (#16620)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-13 15:31:36 -05:00
Bartek Iwańczuk b88b7c9244
chore: upgrade rusty_v8 to 0.55.0 (#16604)
<!--
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.
-->
2022-11-12 05:37:37 +01:00
Bartek Iwańczuk fd32f75da9
chore: update crates (#16588) 2022-11-10 17:20:46 +01:00
Divy Srivastava 110a0ebe69
perf(core): minimize trivial heap allocations in resolve_async_ops (#16584)
* Use stack allocated array for 16 promises and spill rest to heap. the
exact number can change, maybe 128? (tokio's coop budget limit)
* Avoid v8::Global::clone for global context.
* Do not open global opresolve when its not needed.
2022-11-10 17:26:02 +05:30
Divy Srivastava bc33a4b2e0
refactor(ops): Rewrite fast call optimizer and codegen (#16514) 2022-11-10 17:23:31 +05:30
denobot c08fcd96c1
chore: forward v1.27.2 release commit to main (#16572)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-09 00:27:51 +01:00
David Sherret cbb3f85433
feat(unstable/npm): support peer dependencies (#16561)
This adds support for peer dependencies in npm packages.

1. If not found higher in the tree (ancestor and ancestor siblings),
peer dependencies are resolved like a dependency similar to npm 7.
2. Optional peer dependencies are only resolved if found higher in the
tree.
3. This creates "copy packages" or duplicates of a package when a
package has different resolution due to peer dependency resolution—see
https://pnpm.io/how-peers-are-resolved. Unlike pnpm though, duplicates
of packages will have `_1`, `_2`, etc. added to the end of the package
version in the directory in order to minimize the chance of hitting the
max file path limit on Windows. This is done for both the local
"node_modules" directory and also the global npm cache. The files are
hard linked in this case to reduce hard drive space.

This is a first pass and the code is definitely more inefficient than it
could be.

Closes #15823
2022-11-08 14:17:24 -05:00
denobot 61fbfabe44
chore: forward v1.27.1 release commit to main (#16533)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-04 00:40:23 +01:00
Leo Kettmeir 5140795662
chore: update deno_doc (#16515) 2022-11-02 18:51:37 +01:00
Divy Srivastava ab7e80bde4
chore(runtime): remove dependency on sys-info crate (#16441)
Fixes #9862 

`loadavg`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `sysinfo` | - |
| Windows | - | Returns `DEFAULT_LOADAVG`. There is no concept of
loadavg on Windows |
| macOS, BSD | `getloadavg` |
https://www.freebsd.org/cgi/man.cgi?query=getloadavg |

`os_release`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `/proc/sys/kernel/osrelease` | - |
| Windows |
[`RtlGetVersion`](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlgetversion)
| dwMajorVersion . dwMinorVersion . dwBuildNumber |
| macOS | `sysctl([CTL_KERN, KERN_OSRELEASE])` | - |

`hostname`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Unix | `gethostname(sysconf(_SC_HOST_NAME_MAX))` | - |
| Windows | `GetHostNameW` | - |

`mem_info`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | sysinfo | - |
| Windows | `sysinfoapi::GlobalMemoryStatusEx` | - |
| macOS | <br> <pre> sysctl([CTL_HW, HW_MEMSIZE]); <br> sysctl([CTL_VM,
VM_SWAPUSAGE]); <br> host_statistics64(mach_host_self(), HOST_VM_INFO64)
</pre> | - |
2022-11-02 12:47:00 +05:30
David Sherret 5cd82b84bb
chore: pin lsp types due to unstable "proposed" feature (#16467)
The "proposed" feature that we depend upon in tower-lsp, turns on the
"proposed" feature in lsp-types which has breaking changes in patch
releases because it's explicitly unstable. We need to pin it to prevent
it breaking cargo publish.
2022-10-28 11:38:56 -04:00
Bartek Iwańczuk c27942fee4
fix(lsp): add ServerCapabilities::encoding (#16444)
This caused v1.27.0 publishing to fail.
2022-10-27 19:34:44 +02:00
denobot b0fb8fa9dc
1.27.0 (#16442)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-27 17:13:26 +02:00
David Sherret 4d166e638f
feat(task): support sleep suffixes (#16425)
Co-authored-by: sigmaSd <sigmasd@users.noreply.github.com>
2022-10-25 21:14:08 -04:00
David Sherret e203bd9c5a
fix: upgrade swc_ecma_parser to 0.122.19 - deno_ast 0.20 (#16406) 2022-10-25 11:55:57 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Bartek Iwańczuk 869acee8fb
chore: upgrade rusty_v8 to 0.54.0 (#16368)
<!--
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.
-->
2022-10-20 21:01:49 +02:00
David Sherret 6fbd95630a
feat(unstable/task): fail task on async command failure (#16301)
Tests and implementation are found here:
https://github.com/denoland/deno_task_shell/pull/59

This is a breaking change, but `deno task` is unstable.

> This changes async commands so that on non-zero exit code they will
fail the entire task. For example:
> 
> ```jsonc
> // task that asynchronously starts a server and starts a watcher for
the frontend
> "dev": "deno task server & deno task frontend:watch"
> ```
> 
> Previously when running `deno task dev`, if `deno task server` failed,
the entire command would not fail, which kept in line with `sh`, but
it's not very practical. This change causes `deno task dev` to fail.
> 
> To opt out, developers can add an `|| exit 0`:
> 
> ```jsonc
> "dev": "deno task server || exit 0 & deno task frontend:watch"
> ```
2022-10-18 14:23:53 +02:00
Bartek Iwańczuk 204c46dcc1
chore: forward v1.26.2 to main (#16331)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>

<!--
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.
-->

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-10-17 23:11:16 +02:00
Bartek Iwańczuk 60dd84a5a0
bench: don't send data to grafana (#16324)
ci / bench release ubuntu-20.04-xl (pull_request) went from 24m to 23m
2022-10-17 17:49:03 +02:00
David Sherret 698ae4bfed
feat(unstable/npm): support providing npm dist-tag in npm package specifier (#16293) 2022-10-17 09:16:19 -04:00
Bartek Iwańczuk edaba4d06b
chore: upgrade rusty_v8 to 0.53.1 (#16303)
This commit fixes startup time regression, caused by update
to rusty_v8 v0.50.0.
2022-10-16 13:26:06 +02:00
Luke Channings fa22956a86
refactor(build): better handle old glibc (#16238)
Follow-up to #16208.

- Refactors build.rs behaviour to use `-exported_symbols_list` /
`--export-dynamic-symbol-list`
- Since all build systems now rely on a symbols list file, I have added
`generate_exported_symbols_list`, which derives the symbol list file
depending on the platform, which makes `tools/napi/generate_link_win.js`
redundant.
- Fixes a missed instance of `i8` being used instead of `c_char`

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-10-15 20:51:04 +05:30
Bartek Iwańczuk e7d7585065
chore: upgrade rusty_v8 to 0.53.0 (#16272) 2022-10-15 01:53:13 +02:00
Luca Casonato 3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Bartek Iwańczuk 5733de8a2e
chore: upgrade rusty_v8 to 0.52.0 (#16183) 2022-10-07 09:21:56 +05:30
denobot afeacb8328
chore: forward v1.26.1 release commit to main (#16178)
This is the release commit being forwarded back to main for 1.26.1

Please ensure:
- [x] Everything looks ok in the PR
- [x] The release has been published

To make edits to this PR:
```shell
git fetch upstream forward_v1.26.1 && git checkout -b forward_v1.26.1 upstream/forward_v1.26.1
```

Don't need this PR? Close it.

cc @cjihrig

Co-authored-by: cjihrig <cjihrig@users.noreply.github.com>
2022-10-06 16:49:40 -04:00
Divy Srivastava cd1c63ad71
fix(build): don't export all symbols to dynamic symbol table (#16171)
Currently, we use `-rdynamic` for exporting Node API symbols to the
symbol table. `-rdynamic` will export *all* symbols, that means
previously unused functions will not be optimized away introducing a lot
of binary bloat. 

This patch uses `-exported_symbol` and `--export-dynamic-symbol` link
flags (not as universal as `-rdynamic`) to only mark Node API symbols to
be put in the dynamic symbol table.
2022-10-06 21:20:00 +05:30
Divy Srivastava 0b016a7fb8
feat(npm): implement Node API (#13633)
This PR implements the NAPI for loading native modules into Deno. 

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: DjDeveloper <43033058+DjDeveloperr@users.noreply.github.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-10-05 19:36:44 +05:30
Satya Rohith eacd6a7f29
chore(ext/cache): make helper functions public (#16117) 2022-10-03 10:52:54 +05:30
denobot d8827514ff
1.26.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-29 00:10:44 +02:00
Divy Srivastava e64af6260a
feat(ext/flash): add reuseport option on Linux (#16022) 2022-09-28 23:16:29 +05:30
Satya Rohith b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30