summaryrefslogtreecommitdiff
path: root/runtime/lib.rs
AgeCommit message (Collapse)Author
2024-11-15perf: use available system memory for v8 isolate memory limit (#26868)Bartek Iwańczuk
Instead of using the default 1.4Gb limit (which was meant for browser tabs) configure V8 to set the heap limit to the amount of memory available in the system. Closes https://github.com/denoland/deno/issues/23424 Closes https://github.com/denoland/deno/issues/26435 Closes https://github.com/denoland/deno/issues/21226
2024-11-14feat(cli): add `--unstable-node-globals` flag (#26617)Marvin Hagemeister
This PR adds a new `--unstable-node-globals` flag to expose Node globals by default. Fixes https://github.com/denoland/deno/issues/26611 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-14fix: otel resiliency (#26857)snek
Improving the breadth of collected data, and ensuring that the collected data is more likely to be successfully reported. - Use `log` crate in more places - Hook up `log` crate to otel - Switch to process-wide otel processors - Handle places that use `process::exit` Also adds a more robust testing framework, with a deterministic tracing setting. Refs: https://github.com/denoland/deno/issues/26852
2024-11-13feat: OpenTelemetry Tracing API and Exporting (#26710)snek
Initial import of OTEL code supporting tracing. Metrics soon to come. Implements APIs for https://jsr.io/@deno/otel so that code using OpenTelemetry.js just works tm. There is still a lot of work to do with configuration and adding built-in tracing to core APIs, which will come in followup PRs. --------- Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-09-24fix: better error for Deno.UnsafeWindowSurface, correct HttpClient name, ↵Leo Kettmeir
cleanup unused code (#25833)
2024-09-16refactor(permissions): split up Descriptor into Allow, Deny, and Query (#25508)David Sherret
This makes the permission system more versatile.
2024-09-12feat: stabilize `Deno.createHttpClient()` (#25569)Asher Gomez
Closes #25518
2024-09-04test: run js_unit_tests with `--unstable-*` flags (#25394)Bartek Iwańczuk
2024-09-04chore: remove some dead code around DENO_FUTURE env var (#25418)Bartek Iwańczuk
These codepaths were not used anymore.
2024-09-03feat: hide several --unstable-* flags (#25378)Bartek Iwańczuk
This commit hides following unstable flags: - `--unstable-ffi` (the API is now stable) - `--unstable-webgpu` (this API is now stable) - `--unstable-fs` (no more unstable APIs) - `--unstable-byonm` (BYONM is on by default) The flags are still parseable, but they are not used. Concrete cleanup will be done in a follow up PR.
2024-09-03BREAKING(unstable): drop support for Deno.run.{clearEnv,gid,uid} (#25371)Bartek Iwańczuk
These are unstable options and the APIs is now deprecated. To limit amount of unstable flags we elected to have these APIs removed.
2024-08-27fix: removed unstable-htttp from deno help (#25216)HasanAlrimawi
Closes #25210 . Removed --unstable-http from being displayed on deno run --help=unstable --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-08-21fix: warn about import assertions when using typescript (#25135)David Sherret
1. On emit, checks for the prescence of import assertions. 1. Warns and doesn't store the parsed source in the emit cache in this case.
2024-06-13fix(cli): missing flag for `--unstable-process` (#24199)Luca Casonato
2024-06-06refactor: remove `PermissionsContainer` in deno_runtime (#24119)David Sherret
Also removes permissions being passed in for node resolution. It was completely useless because we only checked it for reading package.json files, but Deno reading package.json files for resolution is perfectly fine. My guess is this is also a perf improvement because Deno is doing less work.
2024-04-24feat: Add `deno serve` subcommand (#23511)Matt Mastracci
By default, `deno serve` will assign port 8000 (like `Deno.serve`). Users may choose a different port using `--port`. `deno serve /tmp/file.ts` `server.ts`: ```ts export default { fetch(req) { return new Response("hello world!\n"); }, }; ```
2024-04-17perf: v8 code cache (#23081)Igor Zinkovsky
This PR enables V8 code cache for ES modules and for `require` scripts through `op_eval_context`. Code cache artifacts are transparently stored and fetched using sqlite db and are passed to V8. `--no-code-cache` can be used to disable. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-12refactor: add `deno_permissions` crate (#22236)Divy Srivastava
Issue https://github.com/denoland/deno/issues/22222 ![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2) This PR moves `runtime/permissions` code to a upstream crate called `deno_permissions`. The `deno_permissions::PermissionsContainer` is put into the OpState and can be used instead of the current trait-based permissions system. For this PR, I've migrated `deno_fetch` to the new crate but kept the rest of the trait-based system as a wrapper of `deno_permissions` crate. Doing the migration all at once is error prone and hard to review. Comparing incremental compile times for `ext/fetch` on Mac M1: | profile | `cargo build --bin deno` | `cargo plonk build --bin deno` | | --------- | ------------- | ------------------- | | `debug` | 20 s | 0.8s | | `release` | 4 mins 12 s | 1.4s |
2024-03-08fix: respect unstable "temporal" configuration in config file (#22134)Bartek Iwańczuk
Actual fix happened in https://github.com/denoland/deno/pull/22782, but this commit adds additional tests and cleans up V8 flags passed on init. Closes https://github.com/denoland/deno/issues/22123 Closes https://github.com/denoland/deno/issues/22560 Closes https://github.com/denoland/deno/issues/22557
2024-02-07refactor: extract out `runtime::colors` to `deno_terminal::colors` (#22324)David Sherret
2024-01-23feat: warn when using --unstable, prefer granular flags (#21452)Bartek Iwańczuk
This commit deprecates "--unstable" flag. When "--unstable" flag is encountered a warning like this is printed: ``` The `--unstable` flag is deprecated, use granular `--unstable-*` flags instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When "--unstable" flag is used and an unstable API is called an additional warning like this is printed for each API call: ``` The `Deno.dlopen` API was used with `--unstable` flag. The `--unstable` flag is deprecated, use granular `--unstable-ffi` instead. Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags ``` When no "--unstable-*" flag is provided and an unstable API is called following warning is issued before exiting: ``` Unstable API 'Deno.dlopen'. The `--unstable-ffi` flag must be provided. ``` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-22feat(web): ImageBitmap (#21898)Leo Kettmeir
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-09feat: bring back WebGPU (#20812)Leo Kettmeir
Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com> Co-authored-by: Kenta Moriuchi <moriken@kimamass.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-14refactor: snapshot module for deno_runtime (#21162)Divy Srivastava
Closes #21134
2023-11-01feat(cron) implement Deno.cron() (#21019)Igor Zinkovsky
This PR adds unstable `Deno.cron` API to trigger execution of cron jobs. * State: All cron state is in memory. Cron jobs are scheduled according to the cron schedule expression and the current time. No state is persisted to disk. * Time zone: Cron expressions specify time in UTC. * Overlapping executions: not permitted. If the next scheduled execution time occurs while the same cron job is still executing, the scheduled execution is skipped. * Retries: failed jobs are automatically retried until they succeed or until retry threshold is reached. Retry policy can be optionally specified using `options.backoffSchedule`.
2023-08-28refactor(runtime): factor out code between build.rs and worker.rs (#20299)Nayeem Rahman
Adds `runtime/shared.rs` which is imported by both `build.rs` and the rest of the crate, containing utilities used by both. Renames the `snapshot_from_snapshot` feature to `exclude_runtime_main_js` since that's what it does and it's relevant outside of snapshotting when `__runtime_js_sources` is specified.
2023-08-06build: allow disabling snapshots for dev (#20048)Nayeem Rahman
Closes #19399 (running without snapshots at all was suggested as an alternative solution). Adds a `__runtime_js_sources` pseudo-private feature to load extension JS sources at runtime for faster development, instead of building and loading snapshots or embedding sources in the binary. Will only work in a development environment obviously. Try running `cargo test --features __runtime_js_sources integration::node_unit_tests::os_test`. Then break some behaviour in `ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an empty array, and run it again. Fix and then run again. No more build time in between.
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-04refactor(ext/node): remove NodeEnv trait (#18986)Luca Casonato
2023-04-24refactor(ext/node): allow injecting `NodeFs` from CLI (#18829)David Sherret
This allows providing a `NodeFs` as part of the `WorkerOptions`.
2023-04-03refactor: remove "ext/flash" (#18578)Bartek Iwańczuk
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-03-30refactor(ext/node): add NodeEnv::Fs associated type (#18484)Bartek Iwańczuk
This commit adds associated type to "NodeEnv" trait, called "Fs". The "Fs" type has a trait bound on "NodeFs", which specifies APIs required for all ops and resolution APIs to function. A "RealFs" implementation of "NodeFs" is exported from the "deno_node" crate, that provides a default implementation for the trait. All code in "deno_node" extension was changed to use the "NodeFs" trait to handle file system operations, instead of relying on APIs from the standard library.
2023-03-28refactor(ext/node): change extension type parameter (#18483)Bartek Iwańczuk
This commit changes the type parameter for "deno_node" extension, from `P: NodePermission` to `Env: NodeEnv`. `NodeEnv` is a new trait that has associated type `P: NodePermission`. This is a stepping stone to support swappable file system for the extension, that will be added as a second associated type to the `NodeEnv` trait.
2023-03-22feat(ext/kv): key-value store (#18232)Heyang Zhou
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-17BREAKING(unstable): remove WebGPU (#18094)Leo Kettmeir
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-07refactor: Add "deno_fs" extension crate (#18040)Bartek Iwańczuk
This commit factors out APIs related to file system from "runtime/" to a separate "deno_fs" extension crate.
2023-03-05refactor(runtime): factor out deno_io extension crate (#18001)Bartek Iwańczuk
This is a prerequisite to factor out FS ops to a separate crate.
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-11-21feat(core): Ability to create snapshots from existing snapshots (#16597)Bartek Iwańczuk
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2022-10-05feat(npm): implement Node API (#13633)Divy Srivastava
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-09-28feat: implement Web Cache API (#15829)Satya Rohith
2022-09-02refactor: move JsError formatting to deno_runtime (#15345)Christian Dürr
This takes the existing `fmt_error` module from cli and puts it as a public module into `deno_runtime`.
2022-08-09feat: add ext/node for require support (#15362)Bartek Iwańczuk
This commit adds "ext/node" extension that implementes CommonJS module system. In the future this extension might be extended to actually contain implementation of Node compatibility layer in favor of "deno_std/node". Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require" namespace and is meant to be used by other functionality to be landed soon. This is a minimal first pass, things that still don't work: support for dynamic imports in CJS conditional exports
2022-02-15chore(ext/timers): move ext/timers to ext/web (#13665)Andreu Botella
2022-01-07chore: update copyright to 2022 (#13306)Ryan Dahl
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2021-12-11fix: op_set_exit_code (#13034)Bartek Iwańczuk
Fixes "op_set_exit_code" by sharing a single "Arc" between all workers (via "op state") instead of having a "global" value stored in "deno_runtime" crate. As a consequence setting an exit code is always scoped to a tree of workers, instead of being overridable if there are multiple worker tree (like in "deno test --jobs" subcommand). Refactored "cli/main.rs" functions to return "Result<i32, AnyError>" instead of "Result<(), AnyError>" so they can return exit code.
2021-11-28chore: re-export `deno_core` from `deno_runtime` (#12923)DjDeveloper
2021-11-28feat(runtime): add op_set_exit_code (#12911)Ben Noordhuis
Set the exit code to use if none is provided to Deno.exit(), or when Deno exits naturally. Needed for process.exitCode Node compat. Paves the way for #12888.
2021-10-10refactor(metrics): move to core (#12386)Aaron O'Mullan
Avoids overhead of wrapping ops (and allocs when inspecting async-op futures)