1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

2508 commits

Author SHA1 Message Date
David Sherret
8be2bbf074
feat: Wasm module support (#26668)
Support for Wasm modules.

Note this implements the standard where the default export is the
instance (not the module). The module will come later with source phase
imports.

```ts
import { add } from "./math.wasm";

console.log(add(1, 2));
```
2024-11-19 18:59:23 -05:00
Divy Srivastava
069bc15030
feat(ext/node): perf_hooks.monitorEventLoopDelay() (#26905)
Fixes https://github.com/denoland/deno/issues/20961

Depends on https://github.com/denoland/deno_core/pull/965 and
https://github.com/denoland/deno_core/pull/966
2024-11-19 16:49:25 +05:30
Yusuke Tanaka
0e2f6e38e7
feat(ext/fetch): Make fetch client parameters configurable (#26909)
This commit makes HTTP client parameters used in `fetch` API
configurable on the extension initialization via a callback
`client_builder_hook` that users can provide.

The main motivation behind this change is to allow `deno_fetch` users to
tune the HTTP/2 client to suit their needs, although Deno CLI users will
not benefit from it as no JavaScript interface is exposed to set these
parameters currently.

It is up to users whether to provide a hook function. If not provided,
the default configuration from hyper crate will be used.

Ref #26785
2024-11-18 17:48:57 -08:00
Yusuke Tanaka
9f26ca4509
feat(ext/http): Make http server parameters configurable (#26785)
This commit makes http server parameters configurable on the extension
initialization via two callbacks users can provide.

The main motivation behind this change is to allow `deno_http` users to
tune the HTTP/2 server to suit their needs, although Deno CLI users will
not benefit from it as no JavaScript interface is exposed to set these
parameters currently.

It is up to users whether to provide hook functions. If not provided,
the default configuration from hyper crate will be used.
2024-11-18 17:46:24 -08:00
Marvin Hagemeister
df1d36324f
fix(node/crypto): support promisify on generateKeyPair (#26913)
Calling `promisify(generateKeyPair)` didn't work as expected. It
requires a custom promisify implementation.

This was easy to fix thanks to the excellent debugging investigation in
https://github.com/denoland/deno/issues/26910

Fixes https://github.com/denoland/deno/issues/26910

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-19 01:39:40 +01:00
Luca Casonato
594a99817c
feat(runtime): remove public OTEL trace API (#26854)
This PR removes the public Deno.tracing.Span API.
We are not confident we can ship an API that is
better than the `@opentelemetry/api` API, because
V8 CPED does not support us using `using` to
manage span context. If this changes, we can
revisit this decision. For now, users wanting
custom spans can instrument their code using
the `@opentelemetry/api` API and `@deno/otel`.

This PR also speeds up the OTEL trace generation
by a 30% by using Uint8Array instead of
strings for the trace ID and span ID.
2024-11-18 23:55:22 +00:00
Benjamin Swerdlow
73411bb98a
chore: Make ext/net/tcp.rs public (#26891) 2024-11-17 13:36:55 +01:00
reczkok
80098bfeab
fix(ext/webgpu): Create GPUQuerySet converter before usage (#26883)
Converter for `GPUComputePassTimestampWrites` uses converter for
`GPUQuerySet` before it is defined making it impossible to use. This PR
simply reorders converter creation to resolve this issue. Logging the
`GPUQuerySet` still fails (as mentioned in #26769) but it is now usable
inside pass descriptors and works when used.
2024-11-17 08:44:36 +05:30
/usr/bin/cat
8d2960d7cc
fix(ext/node): New async setInterval function to improve the nodejs compatibility (#26703)
Closes #26499
2024-11-16 16:01:19 +01:00
Bartek Iwańczuk
768c5ea2bb
fix(ext/cache): gracefully error when cache creation failed (#26895)
Removes panic reported in https://github.com/denoland/deno/issues/26893
2024-11-16 14:29:36 +00:00
David Sherret
48b94c0995
refactor: use boxed_error in some places (#26887) 2024-11-15 23:22:50 -05:00
Luca Casonato
b8cf259924
feat(fetch): accept async iterables for body (#26882)
Reland of #24623, but with a fix for `String` objects.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-11-15 15:54:28 +01:00
Sahand Akbarzadeh
032ae7fb19
feat(ext/fetch): allow embedders to use hickory_dns_resolver instead of default GaiResolver (#26740)
Allows embedders to use `hickory-dns-resolver` instead of threaded "getaddrinfo" resolver
in the `fetch()` implementation.
2024-11-15 11:44:11 +01:00
David Sherret
617350e79c
refactor(resolver): move more resolution code into deno_resolver (#26873)
Follow-up to cjs refactor.

This moves most of the resolution code into the deno_resolver crate.
Still pending is the npm resolution code.
2024-11-14 15:24:25 -05:00
snek
4e899d48cf
fix: otel resiliency (#26857)
Improving the breadth of collected data, and ensuring that the collected
data is more likely to be successfully reported.

- Use `log` crate in more places
- Hook up `log` crate to otel
- Switch to process-wide otel processors
- Handle places that use `process::exit`

Also adds a more robust testing framework, with a deterministic tracing
setting.

Refs: https://github.com/denoland/deno/issues/26852
2024-11-14 12:16:28 +00:00
David Sherret
f091d1ad69
feat(node): stabilize detecting if CJS via "type": "commonjs" in a package.json (#26439)
This will respect `"type": "commonjs"` in a package.json to determine if
`.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to
be ESM it will be loaded as ESM though.
2024-11-13 15:10:09 +00:00
Divy Srivastava
6a4c6d83ba
fix(ext/node): zlib.crc32() (#26856)
Fixes https://github.com/denoland/deno/issues/26845
2024-11-13 20:07:45 +05:30
Divy Srivastava
7d9ba09f5a
fix(ext/node): use ERR_NOT_IMPLEMENTED for notImplemented (#26853) 2024-11-13 19:47:01 +05:30
snek
aa546189be
feat: OpenTelemetry Tracing API and Exporting (#26710)
Initial import of OTEL code supporting tracing. Metrics soon to come.
Implements APIs for https://jsr.io/@deno/otel so that code using
OpenTelemetry.js just works tm.

There is still a lot of work to do with configuration and adding
built-in tracing to core APIs, which will come in followup PRs.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-11-13 10:38:46 +00:00
Łukasz Czerniawski
7becd83a38
feat(ext/fs): add ctime to Deno.stats and use it in node compat layer (#24801)
This PR fixes #24453, by introducing a ctime (using ctime for UNIX and
ChangeTime for Windows) to Deno.stats.

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2024-11-13 13:35:04 +09:00
Divy Srivastava
43812ee8ff
fix(ext/node): process.getBuiltinModule (#26833)
Closes https://github.com/denoland/deno/issues/26832
2024-11-13 08:02:09 +05:30
Richard Carson
01f3451869
chore: make fields public on PermissionDeniedError and deno_kv::KvConfig (#26798)
A few small changes to avoid needing unsafe mem transmutes to
instantiate the extensions

---------

Signed-off-by: Richard Carson <Rscarson@rogers.com>
2024-11-12 17:49:49 +00:00
Divy Srivastava
3b99f6833c
fix(ext/websocket): initialize error attribute of WebSocket ErrorEvent (#26796)
Fixes https://github.com/denoland/deno/issues/26216

Not required by the spec but Discord.js depends on it, see
https://github.com/denoland/deno/issues/26216#issuecomment-2466060306
2024-11-12 17:10:07 +05:30
Yoshiya Hinosawa
c3c2b37966
fix(ext/node): add autoSelectFamily option to net.createConnection (#26661) 2024-11-12 19:54:47 +09:00
Satya Rohith
90236d67c5
fix(ext/http): prefer brotli for accept-encoding: gzip, deflate, br, zstd (#26814)
Closes https://github.com/denoland/deno/issues/26813
2024-11-12 12:10:41 +05:30
denobot
e1b40a69c0
chore: forward v2.0.6 release commit to main (#26804)
This is the release commit being forwarded back to main for 2.0.6

Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-11-10 13:12:18 +05:30
snek
73fbd61bd0
fix: performance.timeOrigin (#26787)
`performance.timeOrigin` was being set from when JS started executing,
but `op_now` measures from an `std::time::Instant` stored in `OpState`,
which is created at a completely different time. This caused
`performance.timeOrigin` to be very incorrect. This PR corrects the
origin and also cleans up some of the timer code.

Compared to `Date.now()`, `performance`'s time origin is now
consistently within 5us (0.005ms) of system time.


![image](https://github.com/user-attachments/assets/0a7be04a-4f6d-4816-bd25-38a2e6136926)
2024-11-08 23:20:24 +01:00
Divy Srivastava
b482a50299
feat(ext/http): abort event when request is cancelled (#26781)
```js
Deno.serve(async (req) => {
  const { promise, resolve } = Promise.withResolvers<void>();

  req.signal.addEventListener("abort", () => {
    resolve();
  });

  await promise;

  return new Response("Ok");
});
```
2024-11-08 18:46:11 +05:30
Divy Srivastava
637b1d5508
fix(ext/cache): don't panic when creating cache (#26780) 2024-11-08 12:27:29 +05:30
Divy Srivastava
b9262130fe
feat(ext/http): abort signal when request is cancelled (#26761)
Closes https://github.com/denoland/deno/issues/21653
2024-11-07 17:12:13 +05:30
Leo Kettmeir
1cab4f07a3
refactor: use concrete error type for remaining ops (#26746) 2024-11-06 16:57:57 -08:00
Kaveh
db53ec230d
refactor(ext/net): Use hickory dns instead of unmaintained trust-dns (#26741)
This PR replaces the unmaintained and rebranded `trust-dns` to `hickory`
for resolver in `deno_net`.
2024-11-06 15:49:32 -08:00
Satya Rohith
b3a3d84ce2
fix(node:zlib): gzip & gzipSync should accept ArrayBuffer (#26762)
Closes https://github.com/denoland/deno/issues/26638
2024-11-06 15:12:24 +01:00
snek
700f54a13c
fix(ext/node): better inspector support (#26471)
implement local inspector

future changes:
- wire up InspectorServer to enable open/close/url
- wire up connectToMainThread

Fixes https://github.com/denoland/deno/issues/25004
2024-11-06 14:08:26 +00:00
denobot
ef7432c03f
chore: forward v2.0.5 release commit to main (#26755)
This is the release commit being forwarded back to main for 2.0.5

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-11-06 02:27:14 +01:00
Nathan Whitaker
84aee0be9a
fix(ext/node): add findSourceMap to the default export of node:module (#26720)
Next.js 15.0.2 tries to use this and errors out
2024-11-04 21:08:29 +00:00
Leo Kettmeir
fe9f0ee593
refactor(runtime/permissions): use concrete error types (#26464) 2024-11-04 09:17:21 -08:00
Kenta Moriuchi
fb1d33a711
chore: update dlint to v0.68.0 for internal (#26711) 2024-11-04 12:17:11 -05:00
David Sherret
826e42a5b5
fix: improved support for cjs and cts modules (#26558)
* cts support
* better cjs/cts type checking
* deno compile cjs/cts support
* More efficient detect cjs (going towards stabilization)
* Determination of whether .js, .ts, .jsx, or .tsx is cjs or esm is only
done after loading
* Support `import x = require(...);`

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-01 12:27:00 -04:00
Divy Srivastava
4774eab64d
chore: upgrade to rust 1.82 and LLVM 19 (#26615)
Upgrade to rust 1.82 and LLVM 19 . Removes one webusb test because
`requestAdapter` not working on new ubuntu 24 runners
2024-11-01 16:13:02 +05:30
Nathan Whitaker
6c6bbeb974
fix(node): Implement os.userInfo properly, add missing toPrimitive (#24702)
Fixes the implementation of `os.userInfo`, and adds a missing
`toPrimitive` for `tmpdir`. This allows us to enable the corresponding
node_compat test.
2024-10-31 22:18:33 -07:00
Nathan Whitaker
6d44952d4d
fix(ext/node): resolve exports even if parent module filename isn't present (#26553)
Fixes https://github.com/denoland/deno/issues/26505

I'm not exactly sure how this case comes about (I tried to write tests
for it but couldn't manage to reproduce it), but what happens is the
parent filename ends up null, and we bail out of resolving the specifier
in package exports.

I've checked, and in node the parent filename is also null (so that's
not a bug on our part), but node continues to resolve even in that case.
So this PR should match node's behavior more closely than we currently
do.
2024-10-31 10:02:31 -07:00
Nathan Whitaker
951103fc8d
fix(ext/node): convert errors from fs.readFile/fs.readFileSync to node format (#26632)
Fixes the original issue reported in #26404. storybook runs into other
errors after this PR (the new errors will be fixed in other PRs).

Some code used by a dependency of storybook does a [string comparison on
the error
message](ce30b2be34/node-src/lib/getConfiguration.ts (L88-L92))
thrown here to check for a file not found error.
2024-10-31 10:02:17 -07:00
Divy Srivastava
8bfd134da6
fix: clamp smi in fast calls by default (#26506)
Fixes https://github.com/denoland/deno/issues/26480

Ref
d2945fb65b
2024-10-31 10:10:07 +05:30
David Sherret
a8846eb70f
fix: remove permission check in op_require_node_module_paths (#26645) 2024-10-30 20:43:22 +00:00
Nathan Whitaker
a346071dd2
fix(ext/node): return this from http.Server.ref/unref() (#26647)
Fixes https://github.com/denoland/deno/issues/26642
2024-10-30 20:13:32 +00:00
denobot
a1473d82c5
chore: forward v2.0.4 release commit to main (#26636)
This is the release commit being forwarded back to main for 2.0.4

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-10-30 13:46:31 +01:00
Yoshiya Hinosawa
a69224ea5b
Revert "fix(ext/node): fix dns.lookup result ordering (#26264)" (#26621)
This reverts commit d59599fc18.

Closes #26588
2024-10-29 18:41:16 +01:00
Volker Schlecht
51978a7654
fix(ext/napi): export dynamic symbols list for {Free,Open}BSD (#26605)
The two BSD ports are reusing the Linux code here.
2024-10-29 19:41:49 +05:30
Volker Schlecht
efb5e912e5
fix(ext/node): compatibility with {Free,Open}BSD (#26604)
Ports for both BSDs contain patches to the same effect.
See
https://github.com/freebsd/freebsd-ports/blob/main/www/deno/files/patch-ext_node_ops_fs.rs
and
8644910cae/lang/deno/patches/patch-ext_node_ops_fs_rs
2024-10-29 19:40:32 +05:30