Commit graph

11196 commits

Author SHA1 Message Date
Asher Gomez 5cfa03ceca
fix(ext/node): initial crypto.createPublicKey() support (#22509)
Closes #21807

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-13 08:17:23 +00:00
Asher Gomez 6e6c316c9d
feat(ext/node): add more named curves in crypto.generateKeyPair[Sync]() (#22882)
Towards fixing #21761
2024-03-13 12:14:51 +05:30
Divy Srivastava f50678b4f3
chore: explicitly type state.put for permissions (#22881) 2024-03-13 10:04:48 +05:30
Nayeem Rahman 485b4c6301
fix(runtime): negate partial condition for deny flags (#22866) 2024-03-12 22:12:29 +00:00
David Sherret c10d96cb21
fix(slow-types): improved exports tracing and infer type literals in as exprs (#22849)
Several fixes in deno_graph:

* https://github.com/denoland/deno_graph/pull/411
* https://github.com/denoland/deno_graph/pull/413
* https://github.com/denoland/deno_graph/pull/414
* https://github.com/denoland/deno_graph/pull/415
* https://github.com/denoland/deno_graph/pull/416
* https://github.com/denoland/deno_graph/pull/417

Also created https://github.com/denoland/publish_smoke_tests to help
prevent regressions in the future.

Closes https://github.com/denoland/deno/issues/22829
Closes https://github.com/denoland/deno/issues/22819
Closes https://github.com/denoland/deno/issues/22802
2024-03-12 17:45:38 +00:00
Divy Srivastava de28e6fc09
refactor: add deno_permissions crate (#22236)
Issue https://github.com/denoland/deno/issues/22222


![image](https://github.com/denoland/deno/assets/34997667/2af8474b-b919-4519-98ce-9d29bc7829f2)

This PR moves `runtime/permissions` code to a upstream crate called
`deno_permissions`. The `deno_permissions::PermissionsContainer` is put
into the OpState and can be used instead of the current trait-based
permissions system.

For this PR, I've migrated `deno_fetch` to the new crate but kept the
rest of the trait-based system as a wrapper of `deno_permissions` crate.
Doing the migration all at once is error prone and hard to review.

Comparing incremental compile times for `ext/fetch` on Mac M1:

| profile | `cargo build --bin deno` | `cargo plonk build --bin deno` |
| --------- | ------------- | ------------------- |
| `debug`   | 20 s          | 0.8s                |
| `release` | 4 mins 12 s   | 1.4s                  |
2024-03-12 10:42:26 -07:00
Divy Srivastava 4a88695563
fix(ext/node): flush brotli decompression stream (#22856)
Fixes https://github.com/denoland/deno/issues/22259

The decompressed input size was not restored because of improper
flushing of the CBrotliDecompressStream state.
2024-03-12 17:23:31 +05:30
David Sherret ad6b00a2bf
chore: enable clippy unused_async rule (#22834) 2024-03-11 23:48:00 -04:00
Asher Gomez c38c14f51f
chore: make Node setup script less sensitive to changes (#22855)
This change tweaks the Node setup script less sensitive to changes by
removing the test counter line in `tools/node_compat/TODO.md`.
Previously, this line would cause linting issues when two Node compat
changes occured one after another.

See
https://github.com/denoland/deno/actions/runs/8226735149/job/22493585874

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-03-12 03:31:34 +00:00
Matt Mastracci 61d86b906f
fix(cli): use Instant for test times (#22853)
Fixes https://github.com/denoland/deno_std/issues/4473
2024-03-11 19:30:15 -06:00
Bartek Iwańczuk 47f318230f
test(ext/node): add worker_threads test for SharedArrayBuffer (#22850)
Follow up to https://github.com/denoland/deno/pull/22815
2024-03-11 22:59:42 +00:00
Nathan Whitaker a77b2987bc
fix(ext/node): Match punycode module behavior to node (#22847)
Fixes #19214.

We were using the `idna` crate to implement our polyfill for
`punycode.toASCII` and `punycode.toUnicode`. The `idna` crate is
correct, and adheres to the IDNA2003/2008 spec, but it turns out
`node`'s implementations don't really follow any spec! Instead, node
splits the domain by `'.'` and punycode encodes/decodes each part. This
means that node's implementations will happily work on codepoints that
are disallowed by the IDNA specs, causing the error in #19214.

While fixing this, I went ahead and matched the node behavior on all of
the punycode functions and enabled node's punycode test in our
`node_compat` suite.
2024-03-11 15:49:43 -07:00
Bartek Iwańczuk d69aab62b0
fix(ext/node): make worker setup synchronous (#22815)
This commit fixes race condition in "node:worker_threads" module were
the first message did a setup of "threadId", "workerData" and
"environmentData".
Now this data is passed explicitly during workers creation and is set up
before any user code is executed.

Closes https://github.com/denoland/deno/issues/22783
Closes https://github.com/denoland/deno/issues/22672

---------

Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-03-11 23:18:03 +01:00
Nathan Whitaker 28b362adfc
fix(runtime): Restore default signal handler after user handlers are unregistered (#22757)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

Fixes #22724. Fixes #7164.

This does add a dependency on `signal-hook`, but it's just a higher
level API on top of `signal-hook-registry` (which we and `tokio` already
depend on) and doesn't add any transitive deps.
2024-03-11 10:22:28 -07:00
David Sherret 670e9a9be7
chore: fix child_process test (#22845)
This was failing in old versions of git.
2024-03-11 11:45:36 -04:00
David Sherret 644ac0fe43
chore: hidden tool for overwriting files with fast check output (#22822)
Not sure if we should do this, but it's a nice hidden tool that
overwrites the working tree with the fast check output.
2024-03-11 11:42:12 -04:00
Bartek Iwańczuk badb42fc23
build: fix node_compat/setup.ts check (#22842) 2024-03-11 13:31:24 +00:00
Bartek Iwańczuk bb6e4c7414
fix(ext/node): worker_threads.parentPort is updated on startup (#20794)
This addresses
https://github.com/denoland/deno/issues/20613#issuecomment-1739962483.
2024-03-11 08:21:06 +05:30
Luca Casonato 2c3162f994
chore: remove unused bench job (#22188) 2024-03-10 23:23:31 +00:00
mash-graz 80dbcd3ddf
fix(ext/node) implement receiveMessageOnPort for node:worker_threads (#22766)
Implementation of `receiveMessageOnPort` for `node:worker_threads`

Fixes: #22702
2024-03-11 00:23:06 +01:00
mash-graz 16dbbfa64a
fix(node:http) Export validateHeaderName and validateHeaderValue functions (#22616)
Modify `_http_outgoing.ts` to support the extended signature of
`validateHeaderName()` used since node v19.5.0/v18.14.0 by adding the
`label` parameter. (see:
https://nodejs.org/api/http.html#httpvalidateheadernamename-label)

Making both validation functions accessible as public exports of
`node:http`

Fixes: #22614
2024-03-10 22:46:05 +00:00
Asher Gomez 0e64450369
chore: update WPT expectations (#22838)
Fixes the latest failure.

See
https://github.com/denoland/deno/actions/runs/8218359853/job/22475137521
2024-03-10 23:15:37 +01:00
Kenta Moriuchi 84db80642a
chore: replace 'call' to 'execute' in error messages (#22579)
Since both "call" and "execute" were used in error messages, I replaced them with "execute," which is more used.
2024-03-10 02:23:14 +00:00
David Sherret f8543a9fd8
fix(publish): regression - publishing with vendor folder (#22830)
In
https://github.com/denoland/deno/pull/22720/files#diff-d62d85de2a7ffb816cd2fdbaa47e588352f521c7c43d058b75649bbb255e0ae1R70
, I copy and pasted from another area of the code and didn't think about
removing how it ignores the vendor folder by default.
2024-03-09 20:40:53 -05:00
Dimitris Apostolou dff056ae41
fix: fix crate vulnerabilities (#22825)
https://rustsec.org/advisories/RUSTSEC-2024-0003
https://rustsec.org/advisories/RUSTSEC-2024-0020
2024-03-10 02:38:03 +01:00
David Sherret 5d3d4eba39
fix(node): require of pkg json imports was broken (#22821) 2024-03-09 10:21:31 -05:00
Divy Srivastava e1fb174f86
fix(ext/websocket): do not continue reading if socket rid closes (#21849)
Fixes https://github.com/denoland/deno/issues/21379
2024-03-09 09:36:17 +05:30
Divy Srivastava 0bed4d3e51
fix(ext/node): support junction symlinks on Windows (#22762)
Fixes https://github.com/denoland/deno/issues/20609

Vitepress support! `vitepress dev` and `vitepress build` via BYONM
2024-03-09 09:07:29 +05:30
Nathan Whitaker 26cee4eb0d
fix(ext/node): Implement isBuiltin in node:module (#22817)
Fixes #22502

Implements the
[`isBuiltin`](https://nodejs.org/api/module.html#moduleisbuiltinmodulename)
function in `node:module`. I had to update the version of `@types/node`
in the test registry in order to get the test I added to typecheck.
2024-03-08 18:06:04 -08:00
Nathan Whitaker 529f79505d
fix(ext/node): Add Immediate class to mirror NodeJS.Immediate (#22808)
Fixes #21660

Adds a basic `Immediate` class to mirror `NodeJS.Immediate`, and changes
`setImmediate` and `clearImmediate` to return and accept (respectively)
`Immediate` objects.

Note that for now {ref,unref,hasRef} are effectively stubs, as deno_core
doesn't really natively support immediates (they're currently modeled as
timers with delay of 0). Eventually we probably want to actually
implement these properly.
2024-03-08 15:58:43 -08:00
David Sherret 58c28d9879
fix(config): remove pkg name example and add pattern to schema (#22813) 2024-03-08 23:13:25 +00:00
David Sherret 0146abd9fe
fix(config): add unstable features as examples to config schema (#22814) 2024-03-08 23:11:05 +00:00
David Sherret 119744c285
fix(publish): suggest using --allow-dirty on uncommitted changes (#22810) 2024-03-08 22:49:15 +00:00
David Sherret 071b3da020
chore(test): add [WILDCHARS(x)] and [WILDLINE] (#22803) 2024-03-08 22:16:07 +00:00
tuhana 66d1b155dd
fix(cli): occasional panics on progress bar (#22809)
Uses `Instant` instead of `SystemTime` for
`cli/util/progress_bar/mod.rs`. Fixes #22558
2024-03-08 14:27:58 -07:00
David Sherret 5d85efd595
fix(publish): ability to un-exclude when .gitignore ignores everything (#22805)
This is an unrealistic scenario, but it's still a good thing to fix and
have a test for because it probably fixes some other underlying issues
with how the gitignore was being resolved for the root directory.

From https://github.com/denoland/deno/pull/22720#issuecomment-1986134425
2024-03-08 14:25:22 -05:00
David Sherret fee4943f76
fix(node): resolve .css files in npm packages when type checking (#22804)
When type checking, we should just resolve css files in npm packages and
not surface a type checking error on the specifier.
2024-03-08 14:14:28 -05:00
mimikun 8fdc376b4a
fix(publish): typo in --allow-dirty help text (#22799) 2024-03-08 18:03:32 +00:00
Luca Casonato 5d671e079a
fix: support sloppy resolution to file where directory exists (#22800)
Previously the sloppy resolver could not resolve the following:

- foo/bar.ts
- foo.ts
- index.ts

Where `index.ts` contains `import "./foo"`, because it did not consider
`foo.ts` a valid target for this directory import.

This commit fixes this bug.
2024-03-08 17:25:55 +00:00
Bartek Iwańczuk 93b9d114a4
refactor(ext/node): worker_threads.isMainThread setup (#22785)
This commit changes how we figure out if we're running on main
thread in `node:worker_threads` module. Instead of relying on quirky
"magic variable" for a name to check if we're on main thread, we are
now explicitly passing this information during bootstrapping of the
runtime. As a side effect, `WorkerOptions.name` is more useful
and matches what Node.js does more closely (though not fully).

Towards https://github.com/denoland/deno/issues/22783
2024-03-08 17:31:11 +01:00
Satya Rohith d5b01e4158
refactor(ext/node): use worker ops directly in worker_threads (#22794) 2024-03-08 14:45:55 +00:00
denobot 44da066359
chore: forward v1.41.2 release commit to main (#22793)
This is the release commit being forwarded back to main for 1.41.2

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-08 09:12:36 +00:00
David Sherret 40089b37c0
fix(publish): include explicitly specified .gitignored files and directories (#22790)
This allows explicitly overriding a .gitignore by specifying files and
directories in "include". This does not apply to globs in an include as
files matching those will still be gitignored. Additionally,
individually gitignored files within an included directory will still be
ignored.
2024-03-08 05:46:06 +00:00
David Sherret 2c6e9107b6
fix(publish): do not include .gitignore (#22789)
Regression from https://github.com/denoland/deno/pull/22720
2024-03-08 04:16:19 +00:00
Matt Mastracci 3745556ccd
feat(ext/node): ref/unref on workers (#22778)
Implements ref/unref on worker to fix part of #22629
2024-03-07 18:51:19 -07:00
David Sherret 2dfc0aca7c
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
2024-03-07 20:16:32 -05:00
Bartek Iwańczuk 2ed984ba3a
fix: respect unstable "temporal" configuration in config file (#22134)
Actual fix happened in https://github.com/denoland/deno/pull/22782, but
this commit adds additional tests and cleans up V8 flags passed on init.

Closes https://github.com/denoland/deno/issues/22123
Closes https://github.com/denoland/deno/issues/22560
Closes https://github.com/denoland/deno/issues/22557
2024-03-08 01:32:11 +01:00
Bartek Iwańczuk 2d5b19277b
chore: upgrade deno_core (#22782) 2024-03-08 00:06:28 +01:00
Bartek Iwańczuk 914b7495a8
fix(publish): reland error if there are uncommitted changes (#22613) (#22632)
Reverted in https://github.com/denoland/deno/pull/22625
2024-03-07 22:13:36 +01:00
Divy Srivastava e0c9102b49
perf: hard link npm cache (#22773) 2024-03-07 13:10:19 -05:00