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

8964 commits

Author SHA1 Message Date
Yoshiya Hinosawa
cd8a8993f1
chore(ext/node): copy internal/crypto/types.ts from std (#18156) 2023-03-14 00:18:07 +09:00
Kamil Ogórek
58d8b2e98d
docs(ext): Update docs for URLPattern to make all examples work (#17870) 2023-03-13 15:26:58 +01:00
David Sherret
11f225ef7d
fix: ensure no node_modules directory is created when a package.json exists and no npm dependencies are used (#18134)
Closes #18133
Closes #18038
2023-03-13 14:03:19 +00:00
Geert-Jan Zwiers
983447e860
chore(cli/tests): use test builder in more integration tests (#18031) 2023-03-13 09:40:46 -04:00
Ryan Dahl
224cff7a2f
Revert "feat(core): prevent isolate drop for CLI main worker (#18059)" (#18157)
Fixes https://github.com/denoland/deno/issues/18120
https://github.com/denoland/deno/issues/18137
https://github.com/denoland/fresh/issues/1073

This reverts commit 0cce9c2bcc.
2023-03-13 12:58:17 +00: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
Filip Skokan
92c388761a
wpt: only tag daily runs as master (#18155)
This PR updates the WPT upload script so that it only labels runs that
come from the daily WPT job as "master".

This is so that only the daily synchronized runs get selected when
viewing dashboards such as
[this](https://wpt.fyi/results/?label=master&label=experimental&product=deno&product=node.js&product=chrome&product=edge&product=firefox&product=safari&aligned&view=subtest&q=deno%3A%21missing).
2023-03-13 13:24:16 +01:00
Luca Bruno
3f26ee8604
feat(ext/fetch): support fallible request-builder hooks (#18116)
This tweaks the signature of `request_builder_hook` in order to support
fallible hooks.

The rationale for this is mostly on two sides:
* it allows a hook to inspect and possibly drop an outgoing request
(e.g. for policying purposes), bubbling up a detailed error message to
the user.
* it wires into newer `reqwest` API which allows to split and then
reassemble a `RequestBuilder`, although only in a fallible way
(https://github.com/seanmonstar/reqwest/pull/1770)
2023-03-13 10:29:05 +00:00
Kenta Moriuchi
e5673f5ed8
fix(core): SafePromiseAll to be unaffected by Array#@@iterator (#17542) 2023-03-13 19:24:31 +09:00
David Sherret
bcb6ee9d08
refactor(npm): push npm struct creation to a higher level (#18139)
This has been bothering me for a while and it became more painful while
working on #18136 because injecting the shared progress bar became very
verbose. Basically we should move the creation of all these npm structs
up to a higher level.

This is a stepping stone for a future refactor where we can improve how
we create all our structs.
2023-03-12 23:32:59 -04:00
David Sherret
8db853514c
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
2023-03-11 11:43:45 -05:00
Ikko Eltociear Ashimine
e4430400ce
chore: typo (#18128) 2023-03-11 08:58:55 -05:00
Bartek Iwańczuk
215528f499
build: run clippy with --all-features (#18115) 2023-03-10 21:07:28 +09:00
David Sherret
a7a804919d
chore(ci): update other workflows to use cargo-toolchain.toml (#18109)
I accidentally missed these in #18104
2023-03-10 11:55:51 +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
Yusuke Tanaka
e3408067cc
refactor: use pin! macro from std (#18110)
<!--
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 replaces `pin_mut!` macro with `pin!` macro that has been
provided from std since Rust 1.68.0.
With the std version we can not only expect its stability but also pass
an expression (rather than identifier) as an argument to the macro.
2023-03-10 02:28:51 +00:00
Lino Le Van
c7a5f928d3
chore(cli): fix outdated comment (#18106) 2023-03-09 21:13:53 -05:00
Bartek Iwańczuk
d1685b120b
refactor(core): remove RuntimeOptions::extensions_with_js (#18099)
This commit removes "deno_core::RuntimeOptions::extensions_with_js".

Now it's embedders' responsibility to properly register extensions
that will not contains JavaScript sources when running from an existing
snapshot.

Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-09 19:22:27 -05:00
Bartek Iwańczuk
78d430103a
fix(prompt): better output with control chars (#18108) 2023-03-10 01:09:14 +01:00
David Sherret
0da193882e
chore(ci): ensure Rust toolchain installation is based on rust-toolchain.toml (#18104)
It seems like `dtolnay/rust-toolchain` does not want to support
rust-toolchain.toml unfortunately and we had thought it did.
2023-03-09 17:01:41 -05:00
Bartek Iwańczuk
44e67df1cd
fix: Split extension registration and snapshotting (#18098)
This commit partially reverts changes from
https://github.com/denoland/deno/pull/18095.

Turns out I made a mistake that became apparent when working
on removing "RuntimeOptions::extensions_with_js" in a follow up.
2023-03-09 21:09:45 +01:00
David Sherret
47012bd931
refactor(tests/lsp): consolidate more into test LspClient and reduce verbosity (#18100) 2023-03-09 15:09:03 -05:00
Divy Srivastava
2f81e555d8
chore: bump rusty_v8 to 0.64.0 (#18096) 2023-03-09 19:51:26 +00:00
Bartek Iwańczuk
bb07e230d1
chore: update Rust to 1.68.0 (#18102) 2023-03-09 19:18:00 +00:00
Bartek Iwańczuk
8f207c0f3f
refactor: Split extension registration for runtime and snapshotting (#18095)
This commit splits "<ext_name>::init" functions into "init_ops" and
"init_ops_and_esm". That way we don't have to construct list of
ESM sources on each startup if we're running with a snapshot.

In a follow up commit "deno_core" will be changed to not have a split
between "extensions" and "extensions_with_js" - it will be embedders'
responsibility to pass appropriately configured extensions.

Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-09 14:56:19 +00:00
Divy Srivastava
99da8a69e7
fix(ext/webstorage): check size of inputs before insert (#18087) 2023-03-09 12:28:51 +00:00
Bartek Iwańczuk
c3cba7f22c
refactor(core): Extension::builder_with_deps (#18093)
Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-09 12:10:54 +00:00
Kenta Moriuchi
521cb4ca9b
fix(rumtime): Add Deno. prefix for registered symbols (#18086) 2023-03-09 04:09:40 +00:00
Bartek Iwańczuk
4e8edafb39
perf(core): over-allocate in ModuleMap when running from snapshot (#18083)
This commit changes "ModuleMap" initialization to over-allocate by 16
for vectors storing module information and module V8 handles. In 99%
cases there's gonna be at least one additional module loaded, so it's
very wasteful to have to reallocate when the module is executed (IIRC
Rust will double the size of the vector) and move all of the elements.
2023-03-09 09:12:46 +05:30
Bartek Iwańczuk
0f9df73349
perf: don't add unload event listener (#18082)
This commit changes how "unload" event is handled - before
this commit an event listener was added unconditionally in
the runtime bootstrapping function, which for some reason was
very expensive (0.3ms). Instead of adding an event listener,
a check was added to "dispatchEvent" function that performs
the same action (so it's only called if there's an event dispatched).
2023-03-09 01:08:54 +00:00
David Sherret
25d98ca289
refactor(lsp): improve test client initialization (#18015) 2023-03-08 23:15:20 +00:00
Roy Ivy III
f2e5e01832
fix(runtime/windows): ensure Deno.stdin.setRaw(false) properly disables raw mode (#17983) 2023-03-08 19:56:49 +00:00
David Sherret
23e1ba7e2d
fix(npm): improve peer dependency resolution with circular dependencies (#18069)
This improves peer dependency resolution yet again. We did not handle
scenarios like the following:

```
// a -> b -> c -> d -> c -> b (peer)
```

...which would maybe work ok the first time its run in some cases, but
then lead to a lockfile that would error on load.

This now keeps track of circular dependencies and updates nodes
accordingly. That said, there is still a lurking bug in this code
somewhere that I've added a comment for (there is a mitigation on the
tail end that seems to work well). The current state is much better than
before and I can look into it later. I think it's something small that's
incorrect.
2023-03-08 12:22:08 -05:00
Divy Srivastava
0cce9c2bcc
feat(core): prevent isolate drop for CLI main worker (#18059)
```
Benchmark 1: deno run -A ../empty.js
  Time (mean ± σ):      20.5 ms ±   0.5 ms    [User: 13.4 ms, System: 5.1 ms]
  Range (min … max):    19.8 ms …  24.0 ms    119 runs

Benchmark 2: target/release/deno run -A ../empty.js
  Time (mean ± σ):      18.8 ms ±   0.3 ms    [User: 13.0 ms, System: 4.9 ms]
  Range (min … max):    18.3 ms …  19.9 ms    129 runs
  ```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-08 22:21:14 +05:30
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
Bartek Iwańczuk
0e8fc4dc6c
Revert "perf: disable snapshot compression (#18061)" (#18074)
This reverts commit d12b039e1a.

It was landed as an experiment and it confirms much faster startup
if not compression is applied.
2023-03-08 21:14:04 +05:30
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
72fe9bb470
refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)
This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the 
modules loaded from this loader to "ext:".

"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.

Closes https://github.com/denoland/deno/issues/18020
2023-03-08 12:44:54 +01:00
Bartek Iwańczuk
d24c6ea27f
refactor(runtime): conditionally register Extension with source files (#18068)
Since we are snapshotting extension source at build time, there's no
need to define list of sources for the extension at runtime.

This commit changes "deno_node" extension by removing "init_polyfill"
function in favor of "init_polyfill_ops_and_esm()" and "init_polyfill_ops()".

The former is used during snapshot and when "deno_runtime" is compiled
with "dont_create_runtime_snapshot" cargo feature flag. The latter is used
when running a worker from an existing snapshot.

This is a start of a bigger refactor to all extensions - thanks to this
change, we don't have to iterate over all defined source files for extension at
runtime, and because of that we don't have to create a filepath for each of the
source files. It's not a big deal, but we are iterating over 300 files on each start,
and concatenating 3 strings before creating a "PathBuf" for ~200 of them.
This is already visible on the startup flamegraphs and should be avoided.
2023-03-08 12:43:26 +01:00
Bartek Iwańczuk
9eb987e46c
perf: move setting up Deno namespace to snapshot time (#18067)
No need to do it on startup every time.
2023-03-08 09:50:54 +05:30
Bartek Iwańczuk
b32a6f8ad2
refactor(core): don't use Result in ExtensionBuilder::state (#18066)
There's no point for this API to expect result. If something fails it should
result in a panic during build time to signal to embedder that setup is
wrong.
2023-03-07 22:37:37 +01:00
Caleb Cox
0e3affcd5b
fix(cli): add space after period in --v8-flags (#18063)
Add space between period and "Any" in `--v8-flags` help text.
2023-03-07 17:07:28 +01:00
Bartek Iwańczuk
76d085ff6a
perf: move runtime bootstrap code to snapshot time (#18062)
This commit moves some of the code from "99_main.js" to
be executed during the snapshot time instead of on each
worker bootstrap. These should minimally help with startup
time benchmark.
2023-03-07 16:11:54 +01:00
ayame113
08591d052a
chore(docs): Fixed manual link (#18060) 2023-03-07 08:01:56 -05:00
Bartek Iwańczuk
d12b039e1a
perf: disable snapshot compression (#18061)
This commit disables snapshot compression for the CLI snapshot.]

Decompressing the snapshot on startup takes ~2.5ms.
2023-03-07 13:57:58 +01: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
Nick Hanley
64354f4112
chore(tests): use temp dir in test missing_deno_dir (#18057)
Fixes #18056
2023-03-07 00:00:51 -05:00
Tristan F
805e8b39ce
chore: remove duplicate copyright disclaimer (#18055)
Removes duplicate copyright disclaimer from `/lockfile/lib.rs`
2023-03-06 22:56:53 -05:00
Bartek Iwańczuk
489cafd5ba
refactor: use v8::String::new_external_onebyte_static where appropriate (#18051) 2023-03-06 16:37:46 +00:00