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

9037 commits

Author SHA1 Message Date
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
Yoshiya Hinosawa
3d75fb2be7
fix(ext/node): make cipher/decipher transform stream (#18408) 2023-03-24 22:29:14 +09:00
Heyang Zhou
94ef428b56
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-24 20:06:27 +08:00
Bartek Iwańczuk
275dee60e7
refactor: make version and user_agent &'static str (#18400)
These caused a bunch of unnecessary allocations on each startup.
2023-03-23 23:27:58 +01:00
Matt Mastracci
edab8f2fd4
fix(core): located_script_name macro was using format syntax (#18388) 2023-03-23 16:00:59 -06:00
Matt Mastracci
ad77ba0f7b
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-23 16:00:46 -06:00
denobot
e8348231df
chore: forward v1.32.1 release commit to main (#18399)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-23 22:55:23 +01:00
Bartek Iwańczuk
09ddb35265
core: disable resizable ArrayBuffer and growable SharedArrayBuffer (#18395) 2023-03-23 19:25:07 +00: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
64602e7027
refactor(core): move setting up snapshot context to JsRuntime::snapshot (#18383) 2023-03-23 18:40:17 +05:30
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
Matt Mastracci
f69e4794d2
chore: update ext/ code to only use ASCII (#18371)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-22 19:34:14 -06:00
Matt Mastracci
d06fdf6add
chore(ext/kv): create basic README.md (#18370) 2023-03-23 00:03:38 +01:00