1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00
Commit graph

4445 commits

Author SHA1 Message Date
David Sherret
1cc5482ca8 chore(tests): fix flaky test_no_lock (#18206)
The test output capturing is known to be flaky.

Closes #18199
2023-03-16 11:59:32 +09:00
David Sherret
d84da1520f fix(lsp): avoid calling client while holding lock (#18197) 2023-03-16 11:59:24 +09:00
Divy Srivastava
6dd98c0c25 perf: do not depend on iana-time-zone (#18088)
Chrono's `clock` feature pulls in `iana-time-zone` which links to macOS
core_foundation. This PR itself is not enough to get rid of
CoreFoundation. Removal depends on getting rid of security framework,
see #18071
2023-03-16 11:59:02 +09:00
Bartek Iwańczuk
ddb5f64d02 refactor: deno_core not using std::env::current_dir (#18173)
This commit changes "deno_core" to not rely on implicitly calling
"std::env::current_dir()" when resolving module specifiers using
APIs from "deno_core::modules_specifier".

Supersedes https://github.com/denoland/deno/pull/15454
2023-03-16 11:58:43 +09:00
Bartek Iwańczuk
c125bb1e5b refactor(core): remove "resolve_url_or_path_deprecated" (#18174)
Remove remaining usages of "resolve_url_or_path_deprecated" in favor
of "resolve_url_or_path" with explicit calls to
"std::env::current_dir()".

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-16 11:58:13 +09:00
Yiyu Lin
7773af5861 refactor(lockfile): move anyhow to thiserror (#18178) 2023-03-16 11:58:00 +09:00
Bartek Iwańczuk
9bbe015fca test: fix flaky resolve_import_map_flags_take_precedence test (#18182)
Trying to fix https://github.com/denoland/deno/issues/18180
2023-03-16 11:57:34 +09:00
Nayeem Rahman
fd39443f8f test: parallelize applicable node compat tests (#18161) 2023-03-16 11:57:28 +09:00
Yoshiya Hinosawa
9d0161356b fix(ext/node): add crypto.createCipheriv (#18091) 2023-03-16 11:57:05 +09:00
Bartek Iwańczuk
ab2200afd8 refactor: --watch commands use deno_core::resolve_url_or_path (#18172)
This commit changes various CLI subcommands that have support for
the "--watch" flag to use initial current working directory when
resolving "main module". 

This is part of migration towards explicitly passing current working
directory to "deno_core::resolve_url_or_path" API.

As a side effect this makes "deno <subcommand> --watch" more aligned to
user expectations, where calling "Deno.chdir()" during program doesn't
break watcher.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-16 11:57:00 +09:00
Bartek Iwańczuk
1964172bf6 refactor(core): resolve_url_or_path and resolve_url_or_path_deprecated (#18170)
This commit changes current "deno_core::resolve_url_or_path" API to
"resolve_url_or_path_deprecated" and adds new "resolve_url_or_path"
API that requires to explicitly pass the directory from which paths
should be resolved to. 

Some of the call sites were updated to use the new API, the reminder
of them will be updated in a follow up PR.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-16 11:56:53 +09:00
Bartek Iwańczuk
5070671882 refactor: Remove call sites of "deno_core::resolve_url_or_path" (#18169)
These call sites didn't need to use "resolve_url_or_path".

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-16 11:56:47 +09:00
David Sherret
dafbdb52d3 fix(info/doc): add missing --no-lock and --lock flags (#18166)
Closes #18159
2023-03-16 11:56:40 +09:00
David Sherret
06afb54281 fix(npm): show a progress bar when initializing the node_modules folder (#18136)
Creating the node_modules folder when the packages are already
downloaded can take a bit of time and not knowing what is going on can
be confusing. It's better to show a progress bar.
2023-03-16 11:56:22 +09:00
Bartek Iwańczuk
4f0f24bf6e refactor(core): pass cwd explicitly to resolve_path (#18092)
Towards landing #15454
2023-03-16 11:56:11 +09:00
David Sherret
93e66dabcb 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-16 11:55:41 +09:00
Geert-Jan Zwiers
5a193887e2 chore(cli/tests): use test builder in more integration tests (#18031) 2023-03-16 11:55:36 +09:00
Ryan Dahl
c370f9e7ae 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-16 11:55:23 +09:00
Kenta Moriuchi
fd601d9999 fix(core): SafePromiseAll to be unaffected by Array#@@iterator (#17542) 2023-03-16 11:54:49 +09:00
David Sherret
d1ffe48d32 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-16 11:54:44 +09:00
David Sherret
c1a8a3a1ae 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-16 11:54:35 +09:00
Ikko Eltociear Ashimine
cad834f01a chore: typo (#18128) 2023-03-16 11:54:27 +09:00
denobot
5f0931e6c8
1.31.2 (#18111)
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2023-03-10 14:25:50 +09:00
Lino Le Van
afb04af3e3 chore(cli): fix outdated comment (#18106) 2023-03-10 13:03:17 +09:00
Bartek Iwańczuk
c7528240cb 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-10 13:03:08 +09:00
Bartek Iwańczuk
159f444d16 fix(prompt): better output with control chars (#18108) 2023-03-10 13:02:28 +09:00
Bartek Iwańczuk
2cd5f64695 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-10 13:02:12 +09:00
David Sherret
0c0b5c1195 refactor(tests/lsp): consolidate more into test LspClient and reduce verbosity (#18100) 2023-03-10 13:02:04 +09:00
Bartek Iwańczuk
566db8921b chore: update Rust to 1.68.0 (#18102) 2023-03-10 13:01:49 +09:00
Bartek Iwańczuk
09de6a11d6 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-10 13:01:41 +09:00
Divy Srivastava
716409e81e fix(ext/webstorage): check size of inputs before insert (#18087) 2023-03-10 13:01:34 +09:00
David Sherret
9e08d43d68 refactor(lsp): improve test client initialization (#18015) 2023-03-10 12:59:47 +09:00
David Sherret
b064c95e93 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-10 12:59:23 +09:00
Divy Srivastava
c39695736e 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-10 12:59:15 +09:00
Bartek Iwańczuk
81a9784116 chore: update tempfile dependency (#18077) 2023-03-10 12:59:04 +09:00
Bartek Iwańczuk
88bf50c812 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-10 12:58:49 +09:00
David Sherret
35c889d1ad 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-10 12:58:41 +09:00
Bartek Iwańczuk
793089bdf0 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-10 12:58:25 +09:00
Bartek Iwańczuk
81293440be 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-10 12:58:18 +09:00
Bartek Iwańczuk
3e16c3fe36 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-10 12:58:06 +09:00
Caleb Cox
ec69d8c8ab fix(cli): add space after period in --v8-flags (#18063)
Add space between period and "Any" in `--v8-flags` help text.
2023-03-10 12:57:58 +09:00
ayame113
36fc29869a chore(docs): Fixed manual link (#18060) 2023-03-10 12:57:26 +09:00
Bartek Iwańczuk
05eecec2f0 perf: disable snapshot compression (#18061)
This commit disables snapshot compression for the CLI snapshot.]

Decompressing the snapshot on startup takes ~2.5ms.
2023-03-10 12:57:19 +09:00
Bartek Iwańczuk
b67df0f07b 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-10 12:57:09 +09:00
Nick Hanley
c879a00cc9 chore(tests): use temp dir in test missing_deno_dir (#18057)
Fixes #18056
2023-03-10 12:56:57 +09:00
David Sherret
bd6fd4ea5f chore(tests): ability to capture stdout and stderr separately (#18035)
This is to allow making assertions on stdout and stderr separately.
2023-03-10 12:56:18 +09:00
Bartek Iwańczuk
4fbc51ca46 refactor: move definition of Deno.build from "runtime" to "core" (#18036)
We use information about build in several extension crates like
"ext/node" or "runtime/". In an effort to move "fs" APIs to a separate 
crate it is a prerequisite to have this information available outside 
of the "runtime/" crate.

This commit moves definition of "build" object to "Deno.core" that is 
later forwarded to "Deno.build".
2023-03-10 12:55:19 +09:00
Nayeem Rahman
38ed6d55f7 fix(check): include dts files in tsc roots (#18026) 2023-03-10 12:55:13 +09:00
Filip Skokan
7e0cc3cb2f fix(ext/crypto): correctly limit ECDSA and hash algorithms (#18030)
Closes #18029
2023-03-10 12:52:00 +09:00
Bartek Iwańczuk
dea5de1c45 refactor(runtime): remove 40_files.js, 40_write_file.js and 40_read_file.js (#18018)
JavaScript APIs from "runtime/js/40_files.js" combined abstractions
for stdio streams ("Stdout", "Stderr", "Stdin") and file system file
("File", "FsFile"). APIs from "runtime/js/40_read_file.js" and 
"runtime/js/40_write_file.js" were implemented using ops from 
"runtime/ops/fs.rs".

This file was removed and relevant APIs were moved to "deno_io/12_io.js"
and "runtime/js/30_fs.js".

This work is meant to enable factoring out "deno_fs" crate.
2023-03-10 12:47:49 +09:00