Commit graph

4494 commits

Author SHA1 Message Date
Matt Mastracci a561cc28cd
chore(cli) Use with_context(|| format!(...)) rather than context(format!(...)) to avoid allocations in non-error path (#18332) 2023-03-21 12:13:32 -06:00
Bartek Iwańczuk 0d27de943a
perf: disable TSC snapshot compression (#18333)
This commit disables compression of the TSC snapshot.
The compression only decreased the size of snapshot by 0.5Mb
and it took about 40s during release build to compress.

With recent gains in TS 5.0 upgrade in terms of size and performance
it makes sense to remove this compression.
2023-03-21 17:53:46 +00:00
Matt Mastracci 2ef8269fdb
fix(cli) Better error messages on corrupt databases that aren't automatically re-created (#18330) 2023-03-21 17:19:10 +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
Yoshiya Hinosawa aa729a42b4
chore(tools): restore node compat test setup script (#18290) 2023-03-21 22:38:07 +09:00
ayame113 c34e26a9d5
docs: fix broken Deno.FsFile#readable example code (#18277) 2023-03-21 16:22:21 +09:00
Yoshiya Hinosawa 896d7f02cb
chore(ext/console): inspect anonymous function as [Function (anonymous)] (#18283)
This PR changes the inspect result of anonymous functions from
`[Function]` to `[Function (anonymous)]`. This behavior is aligned
to `util.inspect` of Node.js.
2023-03-21 13:12:13 +09:00
Sam Gwilym 4c34a2f2df
feat(ext/net): Add multicasting APIs to DatagramConn (#10706) (#17811) 2023-03-20 22:27:00 +01: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 aba5329aec
refactor(ext/node): make initialization functions sync (#18282)
These functions don't need to be async, as they are only calling
synchronous JavaScript code. As a follow up, all 3 functions
should be merge together - this will reduce roundtrips for
calling V8 from Rust, which is somewhat expensive
2023-03-20 00:40:21 -04:00
Andreu Botella 090169cfbc
feat(compile): Add support for web workers in standalone mode (#17657)
This commit adds support for spawning Web Workers in self-contained
binaries created with "deno compile" subcommand.

As long as module requested in "new Worker" constructor is part of the
eszip (by means of statically importing it beforehand, or using "--include"
flag), then the worker can be spawned.
2023-03-19 23:32:54 +01:00
Max Dahlgren bf149d047f
test(ext/node): port _fs tests from std/node (#18262)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-20 01:10:39 +09:00
Sanskar Gauchan 3b1cb8af69
test(ext/node): add querystring_test.ts and readline_test.ts (#18256) 2023-03-19 19:49:11 +09:00
Sanskar Gauchan 472c06b92e
test(ext/node): add _fs_access_test.ts and _fs_watch_test.ts (#18249)
part of https://github.com/denoland/deno/issues/17840
2023-03-19 19:37:00 +09:00
Kamil Ogórek dd1e650063
fix(runtime): Extract error code for all OS error variants (#17958) 2023-03-19 00:01:50 +00:00
Andreu Botella b64ec79268
feat(compile): Enable multiple roots for a standalone module graph (#17663)
This change will enable dynamic imports and web workers to use modules
not reachable from the main module, by passing a list of extra side
module roots as options to `deno compile`. 

This can be done by specifying "--include" flag that accepts a file path or a
URL. This flag can be specified multiple times, to include several modules.
The modules specified with "--include" flag, will be added to the produced
"eszip".
2023-03-19 00:43:07 +01: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
Leo Kettmeir 4c1f3daa83
chore(bench): add RUNTIME_SNAPSHOT.bin (#18269) 2023-03-18 21:00:00 +01: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
Divy Srivastava 00f4c0df97
chore(cli/tests): move macos_shared_libraries test to macos_test.rs (#18268)
As per review comment in original PR:
https://github.com/denoland/deno/pull/18244#issuecomment-1473769606
2023-03-18 21:08:51 +05:30
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
Yoshiya Hinosawa 5223f3d9b6
fix(ext/node): add createDecipheriv (#18245) 2023-03-18 21:51:28 +09:00
Andrew 44553aa09e
docs(FFI/UnsafePointerView): fix a typo in a docstring (#18034) 2023-03-18 12:25:06 +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
Geert-Jan Zwiers 058865c9a3
fix(cli): preserve blob store when resetting file watcher (#18253)
Fixes https://github.com/denoland/deno/issues/17733

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-03-17 19:58:25 -06: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
Bartek Iwańczuk 0bc6bf5d33
chore: add tests for node:async_hooks (#18004)
Closes https://github.com/denoland/deno/issues/17878

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2023-03-17 18:53:57 +01:00
Farsen976 e6fe1630f0
fix(cli/integration): clippy lints (#18248)
This addresses two warnings from clippy, redundant-static-lifetimes and trim-split-whitespace.
closes #18247
2023-03-17 20:51:32 +09:00
Divy Srivastava 0eabd2c6d6
chore: add test for macOS shared libraries (#18244)
Closes https://github.com/denoland/deno/issues/18243
2023-03-17 07:41:17 +02:00
Yoshiya Hinosawa e30d24be72
chore(ext/console): add 'quotes' internal option to Deno.inspect (#18183) 2023-03-17 12:22:09 +09:00
Bartek Iwańczuk 8f9becee76
perf: disable runtime snapshot compression (#18239)
This commit removes compression for the runtime JS code.

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

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

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 00:29:32 +01:00
Bartek Iwańczuk 3f031ad9af
BREAKING(ext/fs): FileInfo.dev is defined on Windows (#18237)
Addresses feedback from
https://github.com/denoland/deno/pull/18073#issuecomment-1471480385.

Reverts changes to `FileInfo` fields that are not available on Windows
making them `null`. Only `FileInfo.dev` is non-null.
2023-03-17 00:14:56 +01:00
Divy Srivastava 1300d6178e
fix(ext/node): resource leak in createHmac (#18229)
This commit fixes https://github.com/denoland/deno/issues/18140.
Verified that test fails on `main`.
2023-03-16 22:25:12 +01:00
Roy Li 2c7174a5a2
fix(repl): Hide indexable properties in tab completion (#18141)
Closes #17831. This change hides the indices of any indexed collection
when triggering tab completion for object properties in the REPL.

An example is shown in the issue, but for verbosity here is another.

Before the change:
```
> const arr = new Uint8ClampedArray([1, 2, 3])
undefined
> arr.
0                     map
1                     reverse
2                     reduce
...
```
After the change:
```
> const arr = new Uint8ClampedArray([1, 2, 3])
undefined
> arr.
constructor               reduce
BYTES_PER_ELEMENT         reduceRight
buffer                    set
...
```

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-03-16 19:46:50 +00:00
David Sherret 56731f2f8d
chore: ignore permission_prompt_strips_ansi_codes_and_control_chars test (#18234)
This test hangs on all operating systems.

Opened https://github.com/denoland/deno/issues/18233 for the future
2023-03-16 14:36:23 -04:00
Bartek Iwańczuk 29c9a5c90d
refactor: reorder op initialization (#18228)
To be able to preserve "Deno.core.ops" we need to ensure that
ops are registered in the same order in various places, otherwise
we will get mismatch in external references ordering.

Prerequisite for https://github.com/denoland/deno/pull/18080
2023-03-16 18:36:53 +01:00
Nick Hanley 1a3c2e2f1d
feat(repl): add DENO_REPL_HISTORY to change history file path (#18047) 2023-03-17 01:22:24 +09:00
denobot 33b85a2b8e
chore: forward v1.31.3 release commit to main (#18222)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2023-03-16 17:09:26 +09:00
Farsen976 96bc15dfa2
fix(ext/node): implement "ascii" encoding for node:fs writeFile() (#18097) 2023-03-16 12:16:03 +09:00
David Sherret c1eba16b84
fix(repl): do not panic deleting Deno or deleting all its properties (#18211)
Closes #18194
Closes #12092
2023-03-15 21:41:13 -04:00
Bartek Iwańczuk 48a0b7f98f
feat(fs): support FileInfo.dev on Windows (#18073)
This commit adds support for retrieving `dev` information
when stating files on Windows.

Additionally `Deno.FileInfo` interfaces was changed to always
return 0 for fields that we don't retrieve information for on Windows.

Closes https://github.com/denoland/deno/issues/18053

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-03-16 02:35:13 +01:00
Timo Wilhelm 92c3ac3034
fix(ext/http): abort request signal when response errors (#17822) 2023-03-15 22:37:06 +00:00
David Sherret fb021d7cef
refactor: remove usages of map_or / map_or_else (#18212)
These methods are confusing because the arguments are backwards. I feel
like they should have never been added to `Option<T>` and that clippy
should suggest rewriting to
`map(...).unwrap_or(...)`/`map(...).unwrap_or_else(|| ...)`

https://github.com/rust-lang/rfcs/issues/1025
2023-03-15 17:46:36 -04:00
David Sherret ca51f4f6c0
fix(npm): "not implemented scheme" message should properly show the scheme (#18209) 2023-03-15 15:23:30 -04:00
Divy Srivastava 3a46a89e34
chore: add test for ws ping/pong (#18204)
This commit adds test for https://github.com/denoland/deno/issues/17761
which was fixed by https://github.com/denoland/deno/pull/17762. Verified
that test fails on Deno 1.30.1
2023-03-15 22:09:09 +05:30
David Sherret 5c505316b3
chore(tests): fix flaky test_no_lock (#18206)
The test output capturing is known to be flaky.

Closes #18199
2023-03-16 00:03:36 +09:00