1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

1134 commits

Author SHA1 Message Date
denobot
997aa604df
1.37.0 (#20574)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-09-19 20:29:17 +00:00
Shreyas
d72f5d573a
fix: Deno.Command - improve error message when cwd is not a directory (#20460) 2023-09-18 17:48:54 +00:00
Bartek Iwańczuk
5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
David Sherret
6dc8682b9a
feat: explicit resource management in TypeScript (#20506)
This adds support for `using` and `await using` declarations in
TypeScript only. We need to wait for v8 to support it for this to work
in JS.
2023-09-14 18:08:59 +00:00
Matt Mastracci
81d50e1b66
chore: bump deno_core and cargo update (#20480)
Bump deno_core, pulling in new rusty_v8. Requires some op2/deprecation
fixes.
2023-09-13 22:01:31 +00:00
Matt Mastracci
bfd230fd78
chore: update inner #\![allow] to #[allow] (#20463)
Functions should generally be annotated with `#[allow]` blocks rather
than using inner `#![allow]` annotations.
2023-09-11 17:12:33 -06:00
Bartek Iwańczuk
bdeb4bddbf
refactor: rewrite runtime/ ops to op2 (#20459) 2023-09-12 00:10:43 +02:00
Bartek Iwańczuk
9e243d22f4
Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303) (#20370)
This reverts commit
83426be6ee.

Includes a regression test.
2023-09-04 17:05:06 -04:00
Bartek Iwańczuk
83426be6ee
refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303)
Rewrites 3 ops that used "op(deferred)" to use "op2(async(lazy))"
instead.
This will allow us to remove codepath for handling "deferred" ops in
"deno_core".
2023-09-02 08:48:21 +02:00
Bartek Iwańczuk
2b191c6e9d
chore: forward v1.36.4 to main (#20352)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-09-01 18:08:58 +00:00
Nayeem Rahman
1cce306022
fix(runtime/permissions): Resolve executable specifiers in allowlists and queries (#14130)
Closes #14122.

Adds two extensions to `--allow-run` behaviour:
- When `--allow-run=foo` is specified and `foo` is found in the `PATH`
at startup, `RunDescriptor::Path(which("foo"))` is added to the
allowlist alongside `RunDescriptor::Name("foo")`. Currently only the
latter is.
- When run permission for `foo` is queried and `foo` is found in the
`PATH` at runtime, either `RunDescriptor::Path(which("foo"))` or
`RunDescriptor::Name("foo")` would qualify in the allowlist. Currently
only the latter does.
2023-08-30 18:52:01 +01:00
Nayeem Rahman
bd034e360d
refactor(runtime): factor out code between build.rs and worker.rs (#20299)
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-28 15:30:46 -06:00
林炳权
2080669943
chore: update to Rust 1.72 (#20258)
<!--
Before submitting a PR, please read https://deno.com/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.
-->

As the title.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
Matt Mastracci
fd70b7025b
chore: fully remove atty dep (#20288)
This fully removes the `atty` crate from deno by bumping `env_logger`
and removing the now-unused `atty` dep for runtime.
2023-08-25 17:40:21 +00:00
Matt Mastracci
c272d26ae8
chore(cli): remove atty crate (#20275)
Removes a crate with an outstanding vulnerability.
2023-08-25 07:43:07 -06:00
denobot
3a2d284c96
chore: forward v1.36.3 release commit to main (#20270)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24 17:53:01 +00:00
Matt Mastracci
b1ce2e4167
fix(ext/web): add stream tests to detect v8slice split bug (#20253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23 17:03:05 -06:00
Heyang Zhou
6d4a005e41
feat(ext/kv): connect to remote database (#20178)
This patch adds a `remote` backend for `ext/kv`. This supports
connection to Deno Deploy and potentially other services compatible with
the KV Connect protocol.
2023-08-22 13:56:00 +08:00
Matt Mastracci
71d2f4cb97
fix(runtime): use host header for inspector websocket URL (#20171)
If a `host` header is specified, use that for the generated websocket
URLs.

Fixes #20087
2023-08-15 22:30:33 +00:00
Matt Mastracci
4380a09a05
feat(ext/node): eagerly bootstrap node (#20153)
To fix bugs around detection of when node emulation is required, we will
just eagerly initialize it. The improvements we make to reduce the
impact of the startup time:

 - [x] Process stdin/stdout/stderr are lazily created
 - [x] node.js global proxy no longer allocates on each access check
- [x] Process checks for `beforeExit` listeners before doing expensive
shutdown work
- [x] Process should avoid adding global event handlers until listeners
are added

Benchmarking this PR (`89de7e1ff`) vs main (`41cad2179`)

```
12:36 $ third_party/prebuilt/mac/hyperfine --warmup 100 -S none './deno-41cad2179 run ./empty.js' './deno-89de7e1ff run ./empty.js'
Benchmark 1: ./deno-41cad2179 run ./empty.js
  Time (mean ± σ):      24.3 ms ±   1.6 ms    [User: 16.2 ms, System: 6.0 ms]
  Range (min … max):    21.1 ms …  29.1 ms    115 runs
 
Benchmark 2: ./deno-89de7e1ff run ./empty.js
  Time (mean ± σ):      24.0 ms ±   1.4 ms    [User: 16.3 ms, System: 5.6 ms]
  Range (min … max):    21.3 ms …  28.6 ms    126 runs
```

Fixes https://github.com/denoland/deno/issues/20142
Fixes https://github.com/denoland/deno/issues/15826
Fixes https://github.com/denoland/deno/issues/20028
2023-08-16 04:36:36 +09:00
await-ovo
41cad2179f
fix(runtime): navigator.userAgent in web worker (#20129)
Fixes https://github.com/denoland/deno/issues/20079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-15 17:04:36 +02:00
Divy Srivastava
94d664535b
chore: forward v1.36.1 to main (#20119)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-08-10 16:44:41 +03:00
Divy Srivastava
91dc6fa5f1
chore: upgrade fastwebsockets to 0.4.4 (#19089)
Fixes https://github.com/denoland/deno/issues/19041
2023-08-10 09:59:06 +05:30
Nayeem Rahman
c1c8eb3d55
build: allow disabling snapshots for dev (#20048)
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-08-06 01:47:15 +02:00
Nayeem Rahman
b96f283064
refactor: remove snapshot_module_load_cb (#20043) 2023-08-05 23:00:38 +00:00
denobot
6ba245fe25
1.36.0 (#20036)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03 18:26:25 +02:00
Asher Gomez
6fb7e8d93b
feat(permissions): add "--deny-*" flags (#19070)
This commit adds new "--deny-*" permission flags. These are complimentary to
"--allow-*" flags.

These flags can be used to restrict access to certain resources, even if they
were granted using "--allow-*" flags or the "--allow-all" ("-A") flag.

Eg. specifying "--allow-read --deny-read" will result in a permission error,
while "--allow-read --deny-read=/etc" will allow read access to all FS but the
"/etc" directory.

Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly
by adding, a new "PermissionStatus.partial" field. This field denotes that
while permission might be granted to requested resource, it's only partial (ie.
a "--deny-*" flag was specified that excludes some of the requested resources).
Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for
permissions like "Deno.permissions.query({ name: "read", path: "foo/" })"
will return "PermissionStatus { state: "granted", onchange: null, partial: true }",
denoting that some of the subpaths don't have read access.

Closes #18804.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-03 13:19:19 +02:00
David Sherret
51ceed860b
chore: fix windows clippy errors (#20014) 2023-08-01 23:30:19 +02:00
Matt Mastracci
45572e329a
refactor(runtime): use new fd methods from resource table (#20010)
Prereq for fast streams work. No longer need `#[cfg]` around
`backing_fd`.
2023-08-01 14:48:39 -04:00
Ricardo Iván Vieitez Parra
98403691d1
fix: call setIsTrusted for generated events (MessageEvent) (#19919)
This addresses issue #19918.

## Issue description

Event messages have the wrong isTrusted value when they are not
triggered by user interaction, which differs from the browser. In
particular, all MessageEvents created by Deno have isTrusted set to
false, even though it should be true.

This is my first ever contribution to Deno, so I might be missing
something.
2023-07-31 23:22:07 +02:00
Leo Kettmeir
aa8078b688
feat(node/os): implement getPriority, setPriority & userInfo (#19370)
Takes #4202 over
Closes #17850 

---------

Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-07-31 22:29:09 +02:00
Nayeem Rahman
d5efdeeff1
refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
denobot
89ba3f820c
1.35.3 (#19947)
Bumped versions for 1.35.3
Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
2023-07-26 10:18:02 -04:00
Bartek Iwańczuk
a4e0f3ff88
chore: update deno_core to 0.196.0 (#19897)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-07-23 13:42:41 +00:00
VlkrS
60d3c4c1ec
feat(runtime): sys_info.rs - Use KERN_OSRELEASE on {Free,Open}BSD (#19849)
os_release() can use the same API as apple on FreeBSD and OpenBSD. Ports
for both systems contain a patch to that effect.

See:

https://github.com/freebsd/freebsd-ports/blob/main/www/deno/files/patch-runtime_ops_os_sys__info.rs

https://cvsweb.openbsd.org/ports/lang/deno/patches/patch-runtime_ops_os_sys_info_rs?rev=1.2
2023-07-22 05:50:57 +02:00
denobot
0c3bbf7acd
chore: forward v1.35.2 release commit to main (#19887)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-20 05:11:50 +02:00
Luca Casonato
e511022c74
feat(ext/node): properly segregate node globals (#19307)
Code run within Deno-mode and Node-mode should have access to a
slightly different set of globals. Previously this was done through a
compile time code-transform for Node-mode, but this is not ideal and has
many edge cases, for example Node's globalThis having a different
identity than Deno's globalThis.

This commit makes the `globalThis` of the entire runtime a semi-proxy.
This proxy returns a different set of globals depending on the caller's
mode. This is not a full proxy, because it is shadowed by "real"
properties on globalThis. This is done to avoid the overhead of a full
proxy for all globalThis operations.

The globals between Deno-mode and Node-mode are now properly segregated.
This means that code running in Deno-mode will not have access to Node's
globals, and vice versa. Deleting a managed global in Deno-mode will
NOT delete the corresponding global in Node-mode, and vice versa.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-07-19 10:30:04 +02:00
sigmaSd
cfb9478a43
fix(runtime): print process name in case of spawn error (#19855)
Fix https://github.com/denoland/deno/issues/19400

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-07-19 01:24:30 +02:00
David Sherret
b03d82e5d3
fix(tsc): more informative diagnostic when Deno does not exist (#19825)
Also improved the diagnostic when using something like `Deno.openKv` and
it doesn't exist.
2023-07-13 23:29:51 +00:00
Matt Mastracci
8465bd0037
chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00
David Sherret
2f4b73410a
chore: forward 1.35.1 back to main (#19814) 2023-07-12 21:36:42 -04:00
Bartek Iwańczuk
1edc8693bf
chore: upgrade deno_core and rusty_v8 (#19773) 2023-07-09 22:48:47 +00:00
denobot
1ac5fddf54
1.35.0 (#19717)
Bumped versions for 1.35.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-05 01:58:01 +02:00
Bartek Iwańczuk
6d0c658023
fix: move Deno.serve to stable namespace (#19718)
This was missed in #19141
2023-07-04 23:04:26 +00:00
Bartek Iwańczuk
01f0d03ae8
refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)
Closes https://github.com/denoland/deno/issues/19510
2023-07-02 20:19:30 +02:00
Nayeem Rahman
b9c0e7cd55
Reland "fix(cli): don't store blob and data urls in the module cache" (#18581)
Relands #18261 now that
https://github.com/lucacasonato/esbuild_deno_loader/pull/54 is landed
and used by fresh.
Fixes #18260.
2023-07-02 00:52:30 +02:00
Luca Casonato
476e4ed03c
fix(ext/kv): expose Deno.AtomicOperation (#19674) 2023-07-01 09:24:15 +02:00
Nayeem Rahman
55362452a8
fix(core): consistent extension source resolution (#19615)
Currently the resolution for extension sources is different depending on
whether `include_js_files_for_snapshotting`
is enabled. If sources are embedded it uses `include_str!()` which is
module-relative. If sources are read at runtime paths are joined to
`CARGO_MANIFEST_DIR` and are package-relative. This makes them both
package-relative.

Fixes `cargo run -p deno_runtime --example extension_with_esm --features
include_js_files_for_snapshotting`.
2023-06-29 23:07:05 +02:00
Bartek Iwańczuk
0434e04177
feat: add more Deno.errors classes (#19514)
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-29 01:46:16 +02:00
Martin Fischer
801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04: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
Bartek Iwańczuk
dda0f1c343
refactor(serde_v8): split ZeroCopyBuf into JsBuffer and ToJsBuffer (#19566)
`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-22 23:37:56 +02:00
Bartek Iwańczuk
c8dc6b14ec
chore: add conditional compilation for tokio_unstable feature (#19537)
Closes https://github.com/denoland/deno/issues/19528
2023-06-16 17:33:28 +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
Matt Mastracci
88e6e9c1e6
refactor(core): some runtime methods should live on the module map (#19502)
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-14 16:45:59 +00:00
Bartek Iwańczuk
5ef225853c
perf: don't run microtask checkpoint if macrotask callback did no work (#19492)
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-14 16:21:06 +02: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
VlkrS
ea97af312f
feat: Adaptations to support OpenBSD port (#19153) 2023-06-12 13:14:27 +03:00
David Sherret
ff690b0ab4
chore: fix flaky stdio_streams_are_locked_in_permission_prompt (#19443) 2023-06-09 13:24:39 -04: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
5c55f2b4fb
chore: upgrade to Rust 1.70.0 (#19345)
Co-authored-by: linbingquan <695601626@qq.com>
2023-06-06 00:35:39 +00:00
VlkrS
3d582156b6
feat(runtime): Add an OpenBSD implementation for rss() (#19221)
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-05 14:24:19 +02:00
Mathias Lafeldt
77a950aac4
feat(runtime): support creating workers using custom v8 params (#19339)
In order to limit the memory usage of isolates via heap_limits.
2023-06-05 09:22:32 +00:00
Nayeem Rahman
34dac6c6ef
refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353)
Addresses
https://github.com/denoland/deno/pull/19308#discussion_r1212248194. 

Removes force_op_registration as it is no longer necessary.
2023-06-03 14:22:32 -06:00
Marvin Hagemeister
926d493f19
fix(runtime): add missing SIGIOT alias to SIGABRT (#19333) 2023-05-31 16:39:01 -06:00
Exidex
f3193e0e1c
feat(runtime): Add example for extension with ops (#19204)
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-31 14:26:24 -06:00
Matt Mastracci
8e84dc0139
chore(core): Split JsRuntimeForSnapshot from JsRuntime (#19308)
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-31 08:19:06 -06:00
David Sherret
3b69d238cd
feat(runtime): add WorkerLogLevel (#19316)
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-30 15:34:50 +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
Nayeem Rahman
b6a3f8f722
refactor(core): remove ext: modules from the module map (#19040)
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-28 12:44:41 -06:00
Leo Kettmeir
be59e93220
refactor(node/http): don't use readablestream for writing to request (#19282)
Refactors the internal usage of a readablestream to write to the
resource directly

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-27 15:42:20 +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
Bartek Iwańczuk
0bb5bbc7a0
fix(node): fire 'unhandledrejection' event when using node: or npm: imports (#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-24 15:40:41 +02:00
David Sherret
ffa020f43a
fix(runtime): JS debug log to stderr (#19217)
Debug logs should all go to stderr.
2023-05-22 18:17:31 +00:00
Matt Mastracci
8724ba9d08
feat(runtime): Provide environment-configurable options for tokio parameters (#19173) 2023-05-18 18:08:57 -06: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
Matt Mastracci
62e779f82d
fix(runtime): Box the main future to avoid blowing up the stack (#19155)
This fixes `Unhandled exception at [...] Stack overflow` on Windows,
caused by the large size of the main future.
2023-05-17 15:49:57 -06:00
Matt Mastracci
9845361153
refactor(core): bake single-thread assumptions into spawn/spawn_blocking (#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-14 15:40:01 -06:00
yzy-1
b99159bf14
fix(runtime): Example hello_runtime panic (#19125)
After commit f34fcd, running example will panic because esm_entry_point
is not set.

Closes https://github.com/denoland/deno/issues/19127
2023-05-14 21:55:26 +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
David Sherret
18e9f4642c
fix(lsp): hard to soft error when unable to get completion info (#19091) 2023-05-11 12:04:27 -04:00
Nayeem Rahman
2ba9ccc1ab
fix(runtime): ChildProcess::kill() doesn't require additional perms (#15339)
Fixes #15217.
2023-05-11 14:53:45 +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
29aa988476
refactor(core): http_next generic over request extractor (#19071) 2023-05-10 16:23:26 +02:00
Luca Casonato
f34fcd16ea
fix(core): let V8 drive extension ESM loads (#18997)
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-09 12:37:13 +02:00
David Sherret
df1ca4a158
refactor(ext/fs): deno_fs::FileSystem - conditional Send + Sync (#18993)
This allows for having a conditional `Send + Sync` on the file system trait for Deploy.
2023-05-08 11:02:02 -04: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
Luca Casonato
95e209a0e4
refactor(ext/node): remove NodeEnv trait (#18986) 2023-05-04 14:36:38 +02:00
Nayeem Rahman
7a8bb3b611
fix(core): allow esm extensions not included in snapshot (#18980)
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-04 02:44:59 +02:00
David Sherret
adcda4fa64
refactor(ext/io): move tty metadata to separate collection (#18959)
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-02 17:55:10 -04:00
Bartek Iwańczuk
97147faf89
chore: release extension crates, unpin tokio (#18954) 2023-05-02 11:30:11 +00:00
Bartek Iwańczuk
2f651b2d64
fix(npm): canonicalize filename before returning (#18948)
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-02 02:35:33 +02:00
David Sherret
913176313b
perf: lazily create RootCertStore (#18938) 2023-05-01 16:42:05 -04:00
David Sherret
30628288ce
perf: lazily retrieve ppid (#18940)
This is very apparent on Windows.

Before: 45.74ms (Hello world)
After: 33.92ms

Closes #18939
2023-05-01 18:21:27 +00:00
Kenta Moriuchi
6728ad4203
fix(core): Use primordials for methods (#18839)
I would like to get this change into Deno before merging
https://github.com/denoland/deno_lint/pull/1152
2023-05-01 15:30:02 +02:00
Leo Kettmeir
b31cf9fde6
refactor(webidl): move prefix & context out of converters options bag (#18931) 2023-05-01 10:47:13 +00:00
Leo Kettmeir
59825a95b4
refactor: remove ext/console/01_colors.js (#18927) 2023-04-30 09:11:37 +00:00
Leo Kettmeir
9c8ebce3dc
refactor: merge Deno & Node inspectors (#18691) 2023-04-30 07:24:13 +00:00
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
683dbd7f3b
Revert "refactor: don't expose Deno[Deno.internal].core namespace" (#18881)
Also conditionally disabled one test if there's not enough space on
device.
2023-04-28 00:37:03 +02:00
Bartek Iwańczuk
14aaa73c02
refactor: don't expose Deno[Deno.internal].core namespace (#18816) 2023-04-26 19:57:38 +02:00
David Sherret
5b4a9b48ae
refactor(ext/node): enforce interior mutable for NodePermissions to remove clones (#18831)
We can make `NodePermissions` rely on interior mutability (which the
`PermissionsContainer` is already doing) in order to not have to clone
everything all the time. This also reduces the chance of an accidental
`borrow` while `borrrow_mut`.
2023-04-24 21:07:48 -04:00
David Sherret
aa286fdecb
refactor(ext/node): allow injecting NodeFs from CLI (#18829)
This allows providing a `NodeFs` as part of the `WorkerOptions`.
2023-04-24 19:44:35 -04: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
1d447cb7c3
refactor(core): remove ops from Deno.core.ops that are disabled (#18793)
This commit changes how "disabled" ops behave. Instead of using "void"
functions under the hood, they now explicitly throw errors saying
that a given op doesn't exist.
2023-04-21 15:22:45 +02:00
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
Kenta Moriuchi
f086ec57b4
fix(core): Use safe primordials wrappers (#18687) 2023-04-14 22:23:28 +02:00
Elijah
e2853a955c
test(runtime): support Windows in resolve_from_cwd_absolute (#18379)
`current_dir().unwrap()` joined with a Path is equivalent to the
implementation in `resolve_from_cwd()`. Manually tested on Ubuntu 22.04
and Windows 11.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
2023-04-13 01:45:53 +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
Matt Mastracci
a1764f7690
refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies,
mainly focused on ensuring that ASCII strings are easy to provide to the
JS runtime.

While we are replacing a 16-byte reference in a number of places with a
24-byte structure (measured via `std::mem::size_of`), the reduction in
copies wins out over the additional size of the arguments passed into
functions.

Benchmarking shows approximately the same if not slightly less wallclock
time/instructions retired, but I believe this continues to open up
further refactoring opportunities.
2023-04-04 06:46:31 -06: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
Bartek Iwańczuk
2846bbe0a3
refactor: "Deno.serve()" API uses "Deno.serveHttp()" internally (#18568)
This commit changes implementation of "Deno.serve()" API to use
"Deno.serveHttp()" under the hood. This change will allow us to
remove the "flash" server implementation, bringing stability to the
"Deno.serve()" API.

"cli/tests/unit/flash_test.ts" was renamed to "serve_test.ts".

Closes https://github.com/denoland/deno/issues/15574
Closes https://github.com/denoland/deno/issues/15504
Closes https://github.com/denoland/deno/issues/15646
Closes https://github.com/denoland/deno/issues/15909
Closes https://github.com/denoland/deno/issues/15911
Closes https://github.com/denoland/deno/issues/16828
Closes https://github.com/denoland/deno/issues/18046
Closes https://github.com/denoland/deno/issues/15869
2023-04-03 17:44:18 +02:00
Kenta Moriuchi
03edd48edd
chore: Turn back on dlintPreferPrimordials (#17715)
Closes #17709
2023-04-02 19:41:41 +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
Bartek Iwańczuk
913e2875c1
refactor(ext/node): add NodeEnv::Fs associated type (#18484)
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-30 03:20:31 +02:00
Bartek Iwańczuk
c5302a0587
refactor(ext/node): change extension type parameter (#18483)
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-28 23:52:08 +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
Bartek Iwańczuk
e5b2815b39
Reland "refactor: remove Deno[Deno.internal].nodeUnstable namespace" (#18475)
This reverts commit 357bcfcf79.
2023-03-28 14:44:22 +02:00
Bartek Iwańczuk
795ecfa146
refactor(runtime): manual serialization of bootstrap data (#18448)
This commit changes how data required to bootstrap main and worker
runtime is serialized. 

Instead of relying on serde_v8 and using JSON object,
we're doing manual serialization to a "v8::Array". This limits number 
of V8 strings that need to be serialized by 16. 

It also made it clear that some data could be obtained during
snapshotting instead of during bootstrap.
2023-03-28 10:27:17 +02:00
Bartek Iwańczuk
357bcfcf79
Revert "refactor: remove Deno[Deno.internal].nodeUnstable namespace (… (#18458)
…#18449)"

This reverts commit d1a9c4cd7c.

Appears this made CI very flaky on macOS, but I can't repeat it locally
yet
2023-03-27 14:25:17 +00:00
Bartek Iwańczuk
d1a9c4cd7c
refactor: remove Deno[Deno.internal].nodeUnstable namespace (#18449)
Since we can preserve ops in the snapshot these days, we no longer
need to have "Deno[Deno.internal].nodeUnstable" namespace.

Instead, various built-in Node.js modules can use appropriate APIs
directly.
2023-03-27 02:15:08 +02:00
Bartek Iwańczuk
4d09b0c294
refactor: use default implementation of BootstrapOptions (#18439)
Drive-by cleanup while I was looking into serialization of
BootstrapOptions.
There's no need to use non-default implementation in these places.
2023-03-26 04:38:45 +00:00
Leo Kettmeir
fe88b53e50
refactor: include mitata (#18426) 2023-03-25 15:29:46 +01:00
Bartek Iwańczuk
275dee60e7
refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
2023-03-23 23:27:58 +01:00
Matt Mastracci
ad77ba0f7b
fix(core): panic at build time if extension code contains anything other than 7-bit ASCII (#18372)
This will improve diagnostics and catch any non-ASCII extension code
early.

This will use `debug_assert!` rather than `assert!` to avoid runtime
costs, and ensures (in debug_assert mode only) that all extension source
files are ASCII as we load them.
2023-03-23 16:00:46 -06: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
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
Ryan Dahl
f9c8d98b77
Revert "refactor: rename Deno.openKv() to Deno.kv() (#18349)" (#18362)
This reverts commit 50b793c9ed.
2023-03-22 20:23:36 +01:00
Ryan Dahl
50b793c9ed
refactor: rename Deno.openKv() to Deno.kv() (#18349) 2023-03-22 10:02:40 -04: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
Matt Mastracci
0b4770fa7d
perf(core) Reduce script name and script code copies (#18298)
Reduce the number of copies and allocations of script code by carrying
around ownership/reference information from creation time.

As an advantage, this allows us to maintain the identity of `&'static
str`-based scripts and use v8's external 1-byte strings (to avoid
incorrectly passing non-ASCII strings, debug `assert!`s gate all string
reference paths).

Benchmark results:

Perf improvements -- ~0.1 - 0.2ms faster, but should reduce garbage
w/external strings and reduces data copies overall. May also unlock some
more interesting optimizations in the future.

This requires adding some generics to functions, but manual
monomorphization has been applied (outer/inner function) to avoid code
bloat.
2023-03-21 22:33:12 +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
Bartek Iwańczuk
cd53ab5427
refactor(ext/node): untangle dependencies between js files (#18284)
Moving some code around in `ext/node` is it's a bit better well defined
and makes it possible for others to embed it.

I expect to see no difference in startup perf with this change.
2023-03-20 14:05:13 -04:00
Bartek Iwańczuk
3c9771deb2
Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)
Relanding 4b6305f4f2
2023-03-18 18:30:04 -04:00
Bartek Iwańczuk
d33369c6c7
perf(core): use static specifier in ExtensionFileSource (#18271)
Relanding #18264

-------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-18 20:09:13 +00:00
Bartek Iwańczuk
f6c364fcf6
Revert "perf(core): use static specifier in ExtensionFileSource (#182… (#18270)
…64)"

This reverts commit 8af0c83519.

Causes bench stage to fail on CI.
2023-03-18 20:25:28 +01:00
Bartek Iwańczuk
d11e89127d
Revert "perf(core): preserve ops between snapshots (#18080)" (#18267)
This reverts commit 4b6305f4f2.
2023-03-18 14:59:51 +00:00
Divy Srivastava
8af0c83519
perf(core): use static specifier in ExtensionFileSource (#18264)
Closes #18085

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-18 13:14:28 +00:00
Bartek Iwańczuk
4b6305f4f2
perf(core): preserve ops between snapshots (#18080)
This commit changes the build process in a way that preserves already
registered ops in the snapshot. This allows us to skip creating hundreds of
"v8::String" on each startup, but sadly there is still some op registration
going on startup (however we're registering 49 ops instead of >200 ops). 

This situation could be further improved, by moving some of the ops 
from "runtime/" to a separate extension crates.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-18 12:51:21 +01:00
Matt Mastracci
3487fde236
perf(core) Reduce copying and cloning in extension initialization (#18252)
Follow-up to #18210:

* we are passing the generated `cfg` object into the state function
rather than passing individual config fields
 * reduce cloning dramatically by making the state_fn `FnOnce`
 * `take` for `ExtensionBuilder` to avoid more unnecessary copies
 * renamed `config` to `options`
2023-03-17 22:15:27 +00:00
Matt Mastracci
e55b448730
feat(core) deno_core::extension! macro to simplify extension registration (#18210)
This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements:

* `deno_core::ops!` registers a block of `#[op]`s, optionally with type
parameters, useful for places where we share lists of ops
* `deno_core::extension!` is used to register an extension, and creates
two methods that can be used at runtime/snapshot generation time:
`init_ops` and `init_ops_and_esm`.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 18:22:15 +00:00