1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00
Commit graph

4560 commits

Author SHA1 Message Date
David Sherret
e7b80efca1 refactor(lsp): remove boolean parameters on documents.documents(...) (#18493)
I think this makes things clearer at the call sites.
2023-03-31 11:43:19 -06:00
Andrew Nester
b5024c6998 test(ext/node): add timers_tests.ts from std/node (#18472) 2023-03-31 11:43:19 -06:00
Andrew Nester
c31ddbde4b test(ext/node): add string_decoder_test.ts from std/node (#18473) 2023-03-31 11:43:19 -06:00
David Sherret
dba4b6ca80 chore: fix flaky pty_internal_repl (#18486) 2023-03-31 11:43:19 -06:00
Bartek Iwańczuk
e9aa09bfd4 test(lsp): make lsp_completions_auto_import more robust (#18482)
A completely unrelated change in
https://github.com/denoland/deno/pull/18286 threw of this test.

These changes make it more robust and easier to update in such cases.
2023-03-31 11:43:19 -06:00
Bartek Iwańczuk
bd80ebffc4 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-31 11:43:19 -06:00
David Sherret
f861bd2337 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-31 11:43:19 -06:00
Matt Mastracci
598e9be54e fix(core): restore cache journal mode to TRUNCATE and tweak tokio test in CacheDB (#18469)
Fast-follow on #18401 -- the reason that some tests were panicking in
the `CacheDB` `impl Drop` was that the cache itself was being dropped
during panic and the runtime may or may not still exist at that point.
We can reduce the actual tokio runtime testing to where it's needed.

In addition, we return the journal mode to `TRUNCATE` to avoid the risk
of data corruption.
2023-03-31 11:43:19 -06:00
Ryan Dahl
dcf384259f refactor: move shared library tests to their own file (#18479) 2023-03-31 11:43:19 -06:00
Kamal Singh
0df7e6636a test(node/fs): add fs.Dir tests (#18463)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-31 11:43:19 -06:00
Yoshiya Hinosawa
b71b6665b3 fix(ext/node): implement crypto.Sign (RSA/PEM/SHA{224,256,384,512}) (#18471) 2023-03-31 11:43:19 -06:00
Divy Srivastava
e40f44f79f feat(ext/node): add crypto.checkPrime API (#18465)
Towards #18455 

This commit implements `checkPrimeSync` and `checkPrime` in node:crypto
using the Miller-Rabin primality test (fun fact: it actually is a test
for composite numbers)

It first compares the candidate against many known small primes and if
not, proceeds to run the Miller-Rabin primality test.
http://nickle.org/examples/miller-rabin.5c used as reference
implementation.
2023-03-31 11:43:19 -06:00
Divy Srivastava
2d3be63153 chore(ext/node): port pbkdf2 to Rust (#18470)
Towards #18455
2023-03-31 11:43:19 -06:00
Andrew Nester
22f5c2504e chore: add test for Linux shared libraries (#18461)
Closes #18266
2023-03-31 11:43:19 -06:00
Matt Mastracci
d23579fe6d feat(core): initialize SQLite off-main-thread (#18401)
This gets SQLite off the flamegraph and reduces initialization time by
somewhere between 0.2ms and 0.5ms. In addition, I took the opportunity
to move all the cache management code to a single place and reduce
duplication. While the PR has a net gain of lines, much of that is just
being a bit more deliberate with how we're recovering from errors.

The existing caches had various policies for dealing with cache
corruption, so I've unified them and tried to isolate the decisions we
make for recovery in a single place (see `open_connection` in
`CacheDB`). The policy I chose was:

 1. Retry twice to open on-disk caches
 2. If that fails, try to delete the file and recreate it on-disk
3. If we fail to delete the file or re-create a new cache, use a
fallback strategy that can be chosen per-cache: InMemory (temporary
cache for the process run), BlackHole (ignore writes, return empty
reads), or Error (fail on every operation).

The caches all use the same general code now, and share the cache
failure recovery policy.

In addition, it cleans up a TODO in the `NodeAnalysisCache`.
2023-03-31 11:43:19 -06:00
Marvin Hagemeister
f21d48bc0a fix(ext/node): add missing _preloadModules hook (#18447)
This internal node hook is used by libraries such as `ts-node` when used
as a require hook `node -r ts-node/register`. That combination is often
used with test frameworks like `mocha` or `jasmine`.

We had a reference to `Module._preloadModules` in our code, but the
implementation was missing. While fixing this I also noticed that the
`fakeParent` module that we create internally always threw because of
the `pathDirname` check on the module id in the constructor of `Mdoule`.
So this code path was probably broken for a while.

```txt
✖ ERROR: Error: Empty filepath.
    at pathDirname (ext:deno_node/01_require.js:245:11)
    at new Module (ext:deno_node/01_require.js:446:15)
    at Function.Module._resolveFilename (ext:deno_node/01_require.js:754:28)
    at Function.resolve (ext:deno_node/01_require.js:1015:19)
```
2023-03-31 11:43:19 -06:00
Bartek Iwańczuk
381a3c4369 refactor(cli): remove Lazy<String> and fix help outputs (#18462)
This `Lazy<String>` calls were showing up on flamegraph and there's
really no point in using them.
2023-03-31 11:43:19 -06:00
Divy Srivastava
7c6ef81267 fix(cli/bench): look for clone3 syscalls for thread count (#18456) 2023-03-31 11:43:18 -06:00
Marvin Hagemeister
e06bd19a69 fix(cli): add colors to "Module not found" error frame (#18437) 2023-03-31 11:43:18 -06:00
Max Dahlgren
2813a27364 test(ext/node): Port crypto tests from std/node (#18382) 2023-03-31 11:43:18 -06:00
Nayeem Rahman
9ee4e51ae4 fix(cli): don't store blob and data urls in the module cache (#18261) 2023-03-31 11:43:18 -06:00
滑威
7fa2bf34eb fix(cli): deno upgrade file permission (#18427) 2023-03-31 11:43:18 -06:00
Bartek Iwańczuk
d676944536 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-31 11:43:18 -06:00
Leo Kettmeir
07f61c7535 chore: upgrade clap to v4 (#17333) 2023-03-31 11:43:18 -06:00
Nayeem Rahman
5882a468b0 feat(test): print pending tests on sigint (#18246) 2023-03-31 11:43:18 -06:00
Leo Kettmeir
a6dd700814 refactor: include mitata (#18426) 2023-03-31 11:43:18 -06:00
Geert-Jan Zwiers
585adcc362 chore(tests): enable single_compile_with_reload again (#18196) 2023-03-31 11:43:18 -06:00
Heyang Zhou
859cc700f6 chore(ext/kv): add limits (#18415) 2023-03-31 11:43:18 -06:00
Yoshiya Hinosawa
6374347f9a fix(ext/node): add aes-128-ecb algorithm support (#18412) 2023-03-31 11:43:18 -06:00
David Sherret
87e09da740 chore(types): fix type checking errors in 99_main_compiler.js (#18403) 2023-03-31 11:43:18 -06:00
Divy Srivastava
4f7b778700 feat(ext/node): implement crypto.createSecretKey (#18413)
This commit adds the `crypto.createSecretKey` API.

Key management: This follows the same approach as our WebCrypto
CryptoKey impl where we use WeakMap for storing key material and a
handle is passed around, such that (only internal) JS can access the key
material and we don't have to explicitly close a Rust resource.

As a result, `createHmac` now accepts a secret KeyObject.

Closes https://github.com/denoland/deno/issues/17844
2023-03-31 11:43:18 -06:00
Yoshiya Hinosawa
dc77002b99 fix(ext/node): make cipher/decipher transform stream (#18408) 2023-03-31 11:43:18 -06:00
Heyang Zhou
9c9bcfe4c9 fix(ext/kv): add missing getMany method (#18410)
The `getMany` method was missing from the implementation of the
`Deno.Kv` class. This patch fixes it.
2023-03-31 11:43:18 -06:00
Bartek Iwańczuk
c8f9d89756 refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
2023-03-31 11:43:18 -06:00
Matt Mastracci
1dec3a4936 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-31 11:43:17 -06:00
denobot
99b5eaa2f4
1.32.1 (#18396)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-23 21:00:23 +01:00
Cre3per
eb25e50edb
fix(cli): restore deno run - to handle stdin as typescript (#18391)
Bug reported here shortly after merging `--ext` changes
https://github.com/denoland/deno/pull/17172#issuecomment-1480898098

Also found a missing `--check` in integration tests for `--ext` that
would have missed a bug if there was one.

Fixes #18392
2023-03-23 12:45:43 -04:00
David Sherret
81c5ddf9f2
fix(inspect): ensure non-compact output when object literal has newline in entry text (#18366)
Fixes `Deno.inspect` to make an object literal non-compact when an entry
has multiple lines in it.
2023-03-23 10:58:53 -04:00
David Sherret
6e5a631fe0
refactor(lsp): add LspClientUrl (#18376)
This will make it a bit harder to accidentally use a client url in the
wrong place. I don't fully understand why we do this mapping, but this
will help prevent bugs like #18373

Closes #18374
2023-03-23 14:23:04 +00:00
Ryan Dahl
a3529d0232
refactor(ext/node): Use Deno.inspect (#17960)
No need for two almost identical implementations of the same thing

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-03-23 10:01:07 -04:00
Bartek Iwańczuk
2117d9c1a7
refactor(init): remove CURRENT_STD_URL (#18375)
There's no point in having `Lazy<Url>`, since the only use case 
is string substitution in the "deno init" subcommand.
2023-03-23 03:11:18 +00:00
David Sherret
64f491422b
fix(lsp): ensure enablePaths works when clients do not provide a trailing slash for workspace dir (#18373)
Closes https://github.com/denoland/vscode_deno/issues/827
2023-03-23 01:58:38 +00: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
Heyang Zhou
533e33131f
fix(ext/kv): reverse mapping between AnyValue::Bool and KeyPart::Bool (#18365)
Previously the mapping between `AnyValue::Bool` and `KeyPart::Bool` was
inverted.

This patch also allows using the empty key `[]` as range start/end to
`snapshot_read`.
2023-03-22 21:53:16 +01:00
Heyang Zhou
a117d3d91e
chore(ext/kv): disable ci tests on darwin (#18364)
https://github.com/denoland/deno/issues/18363
2023-03-22 20:46:26 +01: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
Matt Mastracci
cebefa8783
chore(test_util): replace tempdir code w/tempdir crate (#18340) 2023-03-22 12:55:19 -06:00
Bartek Iwańczuk
df614ff6e5
test: ignore flaky node:child_process tests (#18360) 2023-03-22 18:39:13 +00:00
Matt Mastracci
03e236b614
chore(cli): measure performance against wall-clock (#18357)
Fixes test flake by requiring perf to be <150% of wall-clock time rather
than <500ms.
2023-03-22 18:06:29 +00:00
Matt Mastracci
79fb3b1f35
chore(cli): ensure no signal on test exit (#18354)
If deno crashes on exit, we get a failure on the exit code (None instead
of Some(0) but we never see the signal.
2023-03-22 18:00:07 +00:00