0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

9053 commits

Author SHA1 Message Date
Bartek Iwańczuk
381f5801f9
Revert "refactor(ext/node): Use Deno.inspect (#17960)" (#18491)
This reverts commit a3529d0232.

This change made debugging Node tests very hard - `AssertionError` is
now printed as `[Circular *1]` giving no visibility what failed.

We need to align two implementations together and remove this one then.
2023-03-30 15:33:28 +00:00
David Sherret
e0429e2ad6
fix(repl): improve package.json support (#18497)
1. Fixes a cosmetic issue in the repl where it would display lsp warning
messages.
2. Lazily loads dependencies from the package.json on use.
3. Supports using bare specifiers from package.json in the REPL.

Closes #17929
Closes #18494
2023-03-30 10:43:16 -04:00
Yoshiya Hinosawa
3deade4b14
chore(ext/node): run node compat parallel tests in core number concurrency (#18505)
We currently run the all test cases in `parallel` category at the same
time, which invokes hundreds process at the same time, and that seems
causing some flakiness in CI. (maybe related to #18487)

This PR limits the concurrency to the number of cpu cores. This is more
aligned to how Node.js run their `parallel` test in their repository.
42c4a35952/Makefile (L356)
2023-03-30 16:35:45 +02:00
Bartek Iwańczuk
d418f792a9
test: fix test_check_origin_not_supported (#18504)
Merge of dotland and dotcom caused this test to fail.
2023-03-30 19:17:39 +05:30
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
David Sherret
89bbbd102c
refactor(lsp): remove boolean parameters on documents.documents(...) (#18493)
I think this makes things clearer at the call sites.
2023-03-29 16:25:48 -04:00
Andrew Nester
bacbf94925
test(ext/node): add timers_tests.ts from std/node (#18472) 2023-03-29 18:34:37 +09:00
Andrew Nester
04399d138e
test(ext/node): add string_decoder_test.ts from std/node (#18473) 2023-03-29 18:32:29 +09:00
David Sherret
b5d3eb5c23
chore: fix flaky pty_internal_repl (#18486) 2023-03-29 00:25:28 +00:00
Christian Dürr
4577a6966f
fix: Add missing processenv winapi feature to deno_io (#18485)
Currently the `processenv` feature is not explicitly requested by
`deno_io`, however it is using the `processenv` module. This will
prevent downstream users from building on Windows.

I'd assume that this doesn't popup in Deno itself since another crate is
enabling this feature.
2023-03-29 01:29:10 +02:00
Bartek Iwańczuk
ceab7a8d23
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-28 23:58:12 +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
Matt Mastracci
c65149c0a0
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-28 14:06:57 -06:00
Ryan Dahl
35fd8583ef
refactor: move shared library tests to their own file (#18479) 2023-03-28 13:40:43 -04:00
Kamal Singh
e789f813f9
test(node/fs): add fs.Dir tests (#18463)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-28 23:58:40 +09:00
Yoshiya Hinosawa
4358ab2d84
fix(ext/node): implement crypto.Sign (RSA/PEM/SHA{224,256,384,512}) (#18471) 2023-03-28 21:46:48 +09: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
Divy Srivastava
10012c2fe3
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-28 10:56:38 +00:00
Divy Srivastava
67e21e71ce
chore(ext/node): port pbkdf2 to Rust (#18470)
Towards #18455
2023-03-28 09:40:56 +00:00
Andrew Nester
d0a0ff680e
chore: add test for Linux shared libraries (#18461)
Closes #18266
2023-03-28 09:00:19 +00: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
Matt Mastracci
86c3c4f343
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-27 22:01:52 +00:00
Marvin Hagemeister
8c051dbd1a
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-27 21:54:22 +02:00
Bartek Iwańczuk
101abf3541
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-27 18:28:41 +02:00
Divy Srivastava
b2fd0742bd
feat: port node:zlib to rust (#18291) 2023-03-27 16:03:07 +00:00
Divy Srivastava
9ebce6e725
fix(cli/bench): look for clone3 syscalls for thread count (#18456) 2023-03-27 14:45:00 +00: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
Kenta Moriuchi
2b389ecf62
fix(streams): add support Float64Array to ReadableStreamByobReader (#18188) 2023-03-27 15:28:52 +02: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
Marvin Hagemeister
355275ec0f
fix(cli): add colors to "Module not found" error frame (#18437) 2023-03-27 01:10:47 +02:00
Geert-Jan Zwiers
a29d88b43b
feat(bench): add --no-run flag (#18433) 2023-03-26 14:55:58 +00:00
Max Dahlgren
701099b2a9
test(ext/node): Port crypto tests from std/node (#18382) 2023-03-26 10:03:10 +00:00
Nayeem Rahman
b4c61c146a
fix(cli): don't store blob and data urls in the module cache (#18261) 2023-03-26 12:24:10 +03:00
Yoshiya Hinosawa
8b596cbae1
chore: document Node.js compat test setup script (#18381) 2023-03-26 12:22:09 +03:00
Mike Mulchrone
3c5350f949
chore: Improving FS Error Message for op_realpath_sync and op_realpath_async (#18404)
#17526
2023-03-26 12:20:51 +03:00
滑威
0742ea1170
fix(cli): deno upgrade file permission (#18427) 2023-03-26 12:19:12 +03: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
33362b88c3
chore: upgrade clap to v4 (#17333) 2023-03-26 06:06:18 +02:00
Nayeem Rahman
8a4865c379
feat(test): print pending tests on sigint (#18246) 2023-03-25 21:32:11 +02:00
Leo Kettmeir
fe88b53e50
refactor: include mitata (#18426) 2023-03-25 15:29:46 +01:00
Geert-Jan Zwiers
e4c60bc1c6
chore(tests): enable single_compile_with_reload again (#18196) 2023-03-25 09:59:39 +00:00
Heyang Zhou
27834dfc10
chore(ext/kv): add limits (#18415) 2023-03-25 15:29:36 +08:00
Aapo Alasuutari
1c6b797383
test(ext/ffi): Increase timeout value in event loop integration test callback (#18394) 2023-03-25 09:18:41 +02:00
Yoshiya Hinosawa
70e2e8f2dd
fix(ext/node): add aes-128-ecb algorithm support (#18412) 2023-03-25 15:42:07 +09:00
Kenta Moriuchi
255b06d793
chore: update wpt again (#18384)
This reverts commit 4c2269d64a.

> This update introduced more flakiness to the tests on CI, we are going
> to investigate and reland this update after Deno 1.32.0 is released.
2023-03-25 03:27:49 +00:00
David Sherret
d00f8b4e84
ci: fix main (#18420) 2023-03-24 13:47:50 -04:00
David Sherret
de4667febe
chore: fix located_script_name test (#18418)
Closes #18417
2023-03-24 16:00:47 +00:00
David Sherret
675179a176
chore(types): fix type checking errors in 99_main_compiler.js (#18403) 2023-03-24 10:35:44 -04:00
Divy Srivastava
d740a9e43d
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-24 14:13:26 +00:00