summaryrefslogtreecommitdiff
path: root/runtime
AgeCommit message (Collapse)Author
2023-06-29feat: add more Deno.errors classes (#19514)Bartek Iwańczuk
This commit adds following new error classes: - `Deno.errors.NotADirectory` - `Deno.errors.FilesystemLoop` - `Deno.errors.IsADirectory` - `Deno.errors.NetworkUnreachable` Closes https://github.com/denoland/deno/issues/19408
2023-06-26chore: fix typos (#19572)Martin Fischer
2023-06-26Revert "Reland "refactor(core): cleanup feature flags for js source i… ↵Bartek Iwańczuk
(#19611) …nclusion" (#19519)" This reverts commit 28a4f3d0f5383695b1d49ccdc8b0f799a715b2c2. 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-25Reland "refactor(core): cleanup feature flags for js source inclusion" (#19519)Nayeem Rahman
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-22refactor(serde_v8): split ZeroCopyBuf into JsBuffer and ToJsBuffer (#19566)Bartek Iwańczuk
`ZeroCopyBuf` was convenient to use, but sometimes it did hide details that some copies were necessary in certain cases. Also it made it way to easy for the caller to pass around and convert into different values. This commit splits `ZeroCopyBuf` into `JsBuffer` (an array buffer coming from V8) and `ToJsBuffer` (a Rust buffer that will be converted into a V8 array buffer). As a result some magical conversions were removed (they were never used) limiting the API surface and preparing for changes in #19534.
2023-06-16chore: add conditional compilation for tokio_unstable feature (#19537)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19528
2023-06-16chore: forward v1.34.3 release commit to main (#19526)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-14refactor(core): some runtime methods should live on the module map (#19502)Matt Mastracci
A few easy migrations of module code from the runtime to the module map. The module map already has a few places where it needs a handle scope, so we're not coupling it any further with the v8 runtime. `init_runtime_module_map` is replaced with an option to reduce API surface of JsRuntime. `module_resolve_callback` now lives in the `ModuleMap` and we use a annex data to avoid having to go through the `Rc<RefCell<...>>` stored in the `JsRuntime`'s isolate.
2023-06-14perf: don't run microtask checkpoint if macrotask callback did no work (#19492)Bartek Iwańczuk
Most of the time there's no firing timers, nor pending promise rejections, so it's wasteful to run microtask checkpoint additionally twice on each tick of the event loop. Closes https://github.com/denoland/deno/issues/18871 Ref https://github.com/denoland/deno/issues/19451
2023-06-13Revert "refactor(core): cleanup feature flags for js source inclusion… ↵Bartek Iwańczuk
(#19490) … (#19463)" This reverts commit ceb03cfb037cf7024a5048b17b508ddda59cfa05. 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-13refactor(core): cleanup feature flags for js source inclusion (#19463)Nayeem Rahman
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-12feat: Adaptations to support OpenBSD port (#19153)VlkrS
2023-06-09chore: fix flaky stdio_streams_are_locked_in_permission_prompt (#19443)David Sherret
2023-06-09perf: add Tokio runtime monitor (#19415)Bartek Iwańczuk
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-09chore: forward v1.34.2 release commit to main (#19434)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06chore: upgrade to Rust 1.70.0 (#19345)David Sherret
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-05feat(runtime): Add an OpenBSD implementation for rss() (#19221)VlkrS
In case you would consider including specific implementations and not only build fixes, here's the implementation of the ```rss()``` function for OpenBSD.
2023-06-05feat(runtime): support creating workers using custom v8 params (#19339)Mathias Lafeldt
In order to limit the memory usage of isolates via heap_limits.
2023-06-03refactor(core): remove force_op_registration and cleanup ↵Nayeem Rahman
JsRuntimeForSnapshot (#19353) Addresses https://github.com/denoland/deno/pull/19308#discussion_r1212248194. Removes force_op_registration as it is no longer necessary.
2023-05-31fix(runtime): add missing SIGIOT alias to SIGABRT (#19333)Marvin Hagemeister
2023-05-31feat(runtime): Add example for extension with ops (#19204)Exidex
Spend quite some time trying to get this working. With proper example would have been a lot faster. So this is pr with the example. I also rearranged examples a little bit to allow for addition of more examples
2023-05-31chore(core): Split JsRuntimeForSnapshot from JsRuntime (#19308)Matt Mastracci
This cleans up `JsRuntime` a bit more: * We no longer print cargo's rerun-if-changed messages in `JsRuntime` -- those are printed elsewhere * We no longer special case the OwnedIsolate for snapshots. Instead we make use of an inner object that has the `Drop` impl and allows us to `std::mem::forget` it if we need to extract the isolate for a snapshot * The `snapshot` method is only available on `JsRuntimeForSnapshot`, not `JsRuntime`. * `OpState` construction is slightly cleaner, though I'd still like to extract more --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-30feat(runtime): add `WorkerLogLevel` (#19316)David Sherret
This is not really used yet, but provides some infrastructure for doing more fine grained logging in JS. I will add warn messages in a future PR.
2023-05-29chore: forward v1.34.1 to main (#19312)Bartek Iwańczuk
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com> Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-05-28refactor(core): remove ext: modules from the module map (#19040)Nayeem Rahman
Rather than disallowing `ext:` resolution, clear the module map after initializing extensions so extension modules are anonymized. This operation is explicitly called in `deno_runtime`. Re-inject `node:` specifiers into the module map after doing this. Fixes #17717.
2023-05-27refactor(node/http): don't use readablestream for writing to request (#19282)Leo Kettmeir
Refactors the internal usage of a readablestream to write to the resource directly --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-241.34.0 (#19246)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24fix(node): fire 'unhandledrejection' event when using node: or npm: imports ↵Bartek Iwańczuk
(#19235) This commit fixes emitting "unhandledrejection" event when there are "node:" or "npm:" imports. Before this commit the Node "unhandledRejection" event was emitted using a regular listener for Web "unhandledrejection" event. This listener was installed before any user listener had a chance to be installed which effectively prevent emitting "unhandledrejection" events to user code. Closes https://github.com/denoland/deno/issues/16928
2023-05-22fix(runtime): JS debug log to stderr (#19217)David Sherret
Debug logs should all go to stderr.
2023-05-18feat(runtime): Provide environment-configurable options for tokio parameters ↵Matt Mastracci
(#19173)
2023-05-18chore: forward v1.33.4 release commit to main (#19181)denobot
**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-17fix(runtime): Box the main future to avoid blowing up the stack (#19155)Matt Mastracci
This fixes `Unhandled exception at [...] Stack overflow` on Windows, caused by the large size of the main future.
2023-05-14refactor(core): bake single-thread assumptions into spawn/spawn_blocking ↵Matt Mastracci
(#19056) Partially supersedes #19016. This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes the requirement for `spawn` tasks to be `Send` given our single-threaded executor. While we don't need to technically do anything w/`spawn_blocking`, this allows us to have a single `JoinHandle` type that works for both cases, and allows us to more easily experiment with alternative `spawn_blocking` implementations that do not require tokio (ie: rayon). Async ops (+~35%): Before: ``` time 1310 ms rate 763358 time 1267 ms rate 789265 time 1259 ms rate 794281 time 1266 ms rate 789889 ``` After: ``` time 956 ms rate 1046025 time 954 ms rate 1048218 time 924 ms rate 1082251 time 920 ms rate 1086956 ``` HTTP serve (+~4.4%): Before: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 68.78us 19.77us 1.43ms 86.84% Req/Sec 68.78k 5.00k 73.84k 91.58% 1381833 requests in 10.10s, 167.36MB read Requests/sec: 136823.29 Transfer/sec: 16.57MB ``` After: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 63.12us 17.43us 1.11ms 85.13% Req/Sec 71.82k 3.71k 77.02k 79.21% 1443195 requests in 10.10s, 174.79MB read Requests/sec: 142921.99 Transfer/sec: 17.31MB ``` Suggested-By: alice@ryhl.io Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-14fix(runtime): Example hello_runtime panic (#19125)yzy-1
After commit f34fcd, running example will panic because esm_entry_point is not set. Closes https://github.com/denoland/deno/issues/19127
2023-05-12chore: forward v1.33.3 release commit to main (#19111)denobot
**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-11fix(lsp): hard to soft error when unable to get completion info (#19091)David Sherret
2023-05-11fix(runtime): `ChildProcess::kill()` doesn't require additional perms (#15339)Nayeem Rahman
Fixes #15217.
2023-05-10feat(compile): unstable npm and node specifier support (#19005)David Sherret
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-10refactor(core): http_next generic over request extractor (#19071)Matt Mastracci
2023-05-09fix(core): let V8 drive extension ESM loads (#18997)Luca Casonato
This now allows circular imports across extensions. Instead of load + eval of all ESM files in declaration order, all files are only loaded. Eval is done recursively by V8, only evaluating files that are listed in `Extension::esm_entry_point` fields. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-08refactor(ext/fs): `deno_fs::FileSystem` - conditional `Send + Sync` (#18993)David Sherret
This allows for having a conditional `Send + Sync` on the file system trait for Deploy.
2023-05-05refactor(ext/node): combine `deno_node::Fs` with `deno_fs::FileSystem` (#18991)David Sherret
2023-05-04refactor(ext/fs): boxed deno_fs::FileSystem (#18945)David Sherret
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-04chore: forward v1.33.2 release commit to main (#18990)denobot
**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-04refactor(ext/node): remove NodeEnv trait (#18986)Luca Casonato
2023-05-04fix(core): allow esm extensions not included in snapshot (#18980)Nayeem Rahman
Fixes #18979. This changes the predicate for allowing `ext:` specifier resolution from `snapshot_loaded_and_not_snapshotting` to `ext_resolution_allowed` which is only set to true during the extension module loading phase. Module loaders as used in core are now declared as `ExtModuleLoader` rather than `dyn ModuleLoader`.
2023-05-02refactor(ext/io): move tty metadata to separate collection (#18959)David Sherret
This removes the tty stuff that's hanging on the file resources and instead stores them in a separate `TtyModeStore`. Although this will cause the tty store items to not be removed when the resource is removed, I think this is ok to do because there will be a small number of resources this is every done with and usually those resources won't ever be closed.
2023-05-02chore: release extension crates, unpin tokio (#18954)Bartek Iwańczuk
2023-05-02fix(npm): canonicalize filename before returning (#18948)Bartek Iwańczuk
This commit changes how paths for npm packages are handled, by canonicalizing them when resolving. This is done so that instead of returning "node_modules/<package_name>@<version>/node_modules/<dep>/index.js" (which is a symlink) we "node_modules/<dep>@<dep_version>/index.js. Fixes https://github.com/denoland/deno/issues/18924 Fixes https://github.com/bluwy/create-vite-extra/issues/31 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
2023-05-01perf: lazily create RootCertStore (#18938)David Sherret