Commit graph

1828 commits

Author SHA1 Message Date
Bartek Iwańczuk 92576fdcfd
fix(ext/node): support MessagePort in WorkerOptions.workerData (#22950)
This commit fixes passing `MessagePort` instances to
`WorkerOptions.workerData`.

Before they were not serialized and deserialized properly when spawning
a worker thread.

Closes https://github.com/denoland/deno/issues/22935
2024-03-16 01:59:18 +01:00
Nathan Whitaker ebbc897b69
fix(ext/node): Reimplement StringDecoder to match node's behavior (#22933)
Fixes #22158.

Basically reimplements the whole `StringDecoder` with a much more direct
translation (read like one-to-one) of node's current logic. The old
implementation was closer to node's super old impl and it was too hard
to keep the code structure while matching the behavior of their new
logic.

This adds support for UTF-16LE, ascii, and latin1. 

This also enables the node_compat test, which now passes without
modification.
2024-03-15 17:24:13 -07:00
Nathan Whitaker 85116226b3
chore: Forward 1.41.3 release commit (#22930)
Forward 1.41.3 release commit

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-14 21:23:24 +00:00
Divy Srivastava b00f076017
fix(ext/node): Support private EC key signing (#22914)
Fixes https://github.com/denoland/deno/issues/18972

Support for web-push VAPID keys & jws signing

- Fixes EC keygen to return raw private key and uncompressed public key
point.
- Support for `EC PRIVATE KEY`
2024-03-14 14:53:50 +01:00
Divy Srivastava 9c348a0acd
fix(ext/node): support spki format in createPublicKey (#22918) 2024-03-14 14:39:46 +01:00
Divy Srivastava cf3c6f9b08
fix(ext/node): crypto.getCipherInfo() (#22916)
Stub implementation of getCipherInfo(). Good enough for most cases.

Note: We do not support all OpenSSL ciphers (likely never will)

Fixes https://github.com/denoland/deno/issues/21805
2024-03-14 19:00:29 +05:30
guangwu cad79af785
fix: typo in error from GPUBuffer.prototype.mapAsync (#22913) 2024-03-14 13:28:27 +00:00
Divy Srivastava 10e592f954
fix(ext/node): DH (dhKeyAgreement) support for createPrivateKey (#22891)
Ref https://github.com/denoland/deno/pull/22511
2024-03-14 08:56:07 +05:30
David Sherret bc782cee98
fix(node): resolve types via package.json for directory import (#22878)
Does a package resolve when resolving types for a directory (copying the
behaviour that typescript does).
2024-03-13 22:37:56 -04:00
Nayeem Rahman da58722851
fix(node): add nul byte to statfs path on windows (#22905) 2024-03-13 20:57:34 +00:00
Satya Rohith bbc211906d
fix(ext/node): make worker ids sequential (#22884) 2024-03-13 19:52:53 +00:00
Satya Rohith 0fd8f549e2
fix(ext/node): allow automatic worker_thread termination (#22647)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-13 17:22:25 +00:00
Nayeem Rahman f377fce640
feat(node): implement fs.statfs() (#22862) 2024-03-13 10:57:59 +00:00
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 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
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
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
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
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 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 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
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
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
Matt Mastracci 4791d16a8e
perf(cli): use faster_hex (#22761)
`cli::util::checksum` was showing up on flame graphs because it was
concatenating allocated strings. We can use `faster-hex` to improve it.
2024-03-07 10:00:43 -07:00
Satya Rohith 588dd5e669
fix(ext/node): http2.createServer (#22708) 2024-03-07 19:28:46 +05:30
Leo Kettmeir 0fb67ce43e
feat(node/util): styleText (#22758)
Implements https://github.com/nodejs/node/pull/51850
2024-03-07 00:45:28 +01:00
Nathan Whitaker 9df917c0be
chore: upgrade deno_core (#22725)
<!--
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.
-->
2024-03-06 15:08:10 -08:00
Divy Srivastava 39d9281bb9
fix(ext/node): add default methods to fs.StatsBase (#22750) 2024-03-06 23:01:20 +01:00
Divy Srivastava 7542d1050a
fix(ext/node): strip --enable-source-maps from argv (#22743)
Fixes https://github.com/denoland/deno/issues/21750
2024-03-06 13:40:47 +00:00
Divy Srivastava 6ba0b7952d
fix(node): stat/statSync returns instance of fs.Stats (#22294)
Fixes https://github.com/denoland/deno/issues/22291

---------

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-06 13:59:10 +01:00
Divy Srivastava 89d7bc693a
chore: remove debug console table log in node/http2 (#22741) 2024-03-06 13:43:10 +01:00
Divy Srivastava d283a53655
fix(node): implement ALS enterWith (#22740)
Fixes https://github.com/denoland/deno/issues/18127
https://github.com/denoland/deno/issues/17248

SvelteKit works now!
```
$ deno run -A npm:create-svelte@latest my-app

create-svelte version 6.0.9

┌  Welcome to SvelteKit!
│
◇  Which Svelte app template?
│  SvelteKit demo app
│
◇  Add type checking with TypeScript?
│  Yes, using JavaScript with JSDoc comments
│
◇  Select additional options (use arrow keys/space bar)
│  none
│
└  Your project is ready!

✔ Type-checked JavaScript
  https://www.typescriptlang.org/tsconfig#checkJs

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-add

Next steps:
  1: cd my-app
  2: npm install
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat

$ cd my-app/
$ deno task dev
Task dev vite dev

  VITE v5.1.4  ready in 1632 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
```
2024-03-06 12:05:57 +00:00
Matt Mastracci bebbb61eea
fix(cli): improve logging on failed named pipe (#22726) 2024-03-06 03:17:46 +01:00
Marvin Hagemeister c38f59f657
fix: update node process version to latest node LTS (#22709)
<!--
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.
-->
The issue seems to be already fixed since we upped to a newer 18.x
version string in [another
PR](https://github.com/denoland/deno/pull/20366). Updating to latest
node LTS version can't hurt though.

Fixes https://github.com/denoland/deno/issues/21515
2024-03-05 17:02:08 +01:00
Bartek Iwańczuk d9fa2dd550
chore: upgrade deno_core (#22699)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-03-05 01:17:39 +00:00
Divy Srivastava 5a28d70e05
fix(node): errno property when command missing (#22691)
Fixes https://github.com/denoland/deno/issues/22604

`remix dev` with Node adapter works:
```
$ ~/gh/littledivy/deno/target/debug/deno task dev
Task dev remix dev --manual

 💿  remix dev

 info  building...
 info  built (619ms)
[remix-serve] http://localhost:3000 (http://192.168.1.24:3000)

GET / 200 - - 3.090 ms
```
2024-03-04 16:35:44 +00:00
cui fliter d4b3b39cc0
chore: fix typos (#22677) 2024-03-04 14:28:57 +00:00
Matt Mastracci 736b91edd0
perf(cli): use new deno_core timers (#22569)
Improves #19100 

Fixes #20356

Replaces #20428



Changes made in deno_core to support this:

 - [x] Errors must be handled in setTimeout callbacks
 - [x] Microtask ordering is not-quite-right
 - [x] Timer cancellation must be checked right before dispatch
 - [x] Timer sanitizer
 - [x] Move high-res timer to deno_core
 - [x] Timers need opcall tracing
2024-03-01 11:15:18 -07:00