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

10703 commits

Author SHA1 Message Date
Nayeem Rahman
7d88e48296
perf(lsp): use null types instead of stub modules (#21541) 2023-12-12 10:26:27 +00:00
Bartek Iwańczuk
49a6daaa83
perf(lsp): collect counts and durations of all requests (#21540)
In addition to collecting details per-request metrics of the last 3000
request this commit adds aggregate metrics for all requests.
2023-12-12 08:18:10 +01:00
Yoshiya Hinosawa
8ea35de158
chore: modify editorconfig settings (#21533) 2023-12-12 12:43:41 +09:00
Yoshiya Hinosawa
5ddf8732f0
feat(coverage): add summary reporter (#21535) 2023-12-12 12:42:57 +09:00
Matt Mastracci
a4f45f7092
perf(ext/ffi): switch from middleware to tasks (#21239)
Deno-side changes for https://github.com/denoland/deno_core/pull/350

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-12-12 03:10:33 +00:00
Matt Mastracci
d13e45f2b3
perf(ext/napi): port NAPI to v8 tasks (#21406)
Part 2 of removing middleware.

This is somewhat awkward because `V8CrossThreadTaskSpawner` requires
tasks to be `Send`, but NAPI makes heavy use of `!Send` pointers. In
addition, Rust causes a closure to be `!Send` if you pull a `!Send`
value out of a struct.

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-12-11 10:52:55 -07:00
David Sherret
a272bc1bd0
fix: ignore more paths in dynamic arg module search (#21539)
Upgrades deno_doc for https://github.com/denoland/deno_graph/pull/344
2023-12-11 10:46:24 -07:00
Bartek Iwańczuk
88566cee72
perf(lsp): instrument all ops with performance marks (#21536)
Adds performance measurements for all ops used by the LSP. Also changes
output of "Language server status" page to include more precise
information.

Current suspicion is that computing "script version" takes a long time
for some users.
2023-12-11 17:33:56 +01:00
Ryan Dahl
98121de5be
fix: allow reserved word 'mod' in exports (#21537)
This problem occurred trying to load tensorflow.js
```
> import * as tf from 'npm:@tensorflow/tfjs';
Uncaught SyntaxError: Identifier 'mod' has already been declared at file:///Users/ry/Library/Caches/deno/npm/registry.npmjs.org/@tensorflow/tfjs/4.14.0/dist/tf.node.js:167:14
    at async <anonymous>:1:33
```
2023-12-11 17:23:50 +01:00
Bartek Iwańczuk
7bf267c197
perf(lsp): simplify some of the startup code (#21538)
Remove some dead code in "99_main_compiler.js". Eagerly start the LSP
TSC host, it was adding some not needed complexity around the TSC thread code.
2023-12-11 16:59:09 +01:00
David Sherret
6bdf2388da
fix(doc): ambient namespaces should have members as exports (#21483) 2023-12-11 14:09:52 +01:00
Yoshiya Hinosawa
073e341faf
fix(coverage): escape source code in html coverage report (#21531) 2023-12-11 19:24:20 +09:00
Yoshiya Hinosawa
e9ab9ba9f0
test(ext/node): enable some compat test cases (#21532)
This change uncomments Node.js compat test cases which was enabled by the
addition of `vm.runInNewContext`
https://github.com/denoland/deno/pull/21527
2023-12-11 19:17:36 +09:00
Divy Srivastava
02e138dca9
fix(ext/node): basic vm.runInNewContext implementation (#21527)
Simple implementation to support webpack (& Next.js):
8766092180/lib/javascript/JavascriptParser.js (L4329)
2023-12-11 07:08:45 +00:00
Divy Srivastava
0bee37a5e2
fix(ext/websocket): don't panic on bad resource id (#21431)
https://github.com/denoland/deno/issues/21379
2023-12-11 12:22:54 +05:30
Divy Srivastava
5e24e28318
fix(ext/node): ServerResponse getHeader() return undefined (#21525)
Matches Node's return type.

Next.js check for `if (header === undefined)`:

e02fe314dc/packages/next/src/server/base-http/node.ts (L93)
2023-12-11 11:11:59 +05:30
Divy Srivastava
e8fc7c20b7
fix(ext/node): stub ServerResponse#flushHeaders (#21526)
This commit adds a no-op flushHeaders method to the ServerResponse
object. It is a nop because the ServerResponse implementation is based
on top of the Deno server API instead of the Node `OutgoingMessage`
base.

Fixes #21509
2023-12-11 04:46:12 +00:00
Yoshiya Hinosawa
67eec26308
refactor(coverage): separate reporter-related structs (#21528) 2023-12-11 13:30:38 +09:00
Leo Kettmeir
393abed387
feat: bring back WebGPU (#20812)
Signed-off-by: Leo Kettmeir <crowlkats@toaxl.com>
Co-authored-by: Kenta Moriuchi <moriken@kimamass.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-09 01:19:16 +01:00
Nayeem Rahman
123d9ea047
feat(lsp): debug log file (#21500) 2023-12-08 17:04:56 +00:00
David Sherret
ddfbe71ced
feat(lsp): provide quick fixes for specifiers that could be resolved sloppily (#21506) 2023-12-08 09:57:06 -05:00
Luca Casonato
6596912d5a
chore: update a bunch of crates (#21270)
Fixes #21217

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08 15:55:11 +01:00
Julien Cayzac
ca64771257
fix(unstable): Honor granular unstable flags in js runtime (#21466)
This fixes #21434 for `BroadcastChannel` and `WebSocketStream`.
`--unstable` still enable both, but granular unstable flags now also
work:

* `--unstable-net` now enables `WebSocketStream`.
* `--unstable-broadcast-channel` now enables `BroadcastChannel`.
* Additionally, there are now tests for all granular unstable flags.
Since `unsafe-proto` already had tests, so I didn't add any for this
one.

It also introduces a map to keep track of granular unstable ids without
having to sync multiple places.
2023-12-08 14:24:49 +01:00
Luca Casonato
e15c735ede
perf(ext/url): improve URLPattern perf (#21488)
This significantly optimizes URLPattern in the case where the same
URL is matched against many patterns (like in a router).

Also minor speedups to other use-cases.
2023-12-08 12:02:52 +01:00
Kenta Moriuchi
b24356d9b9
fix(ext/node): use primordials in ext/node/polyfills/_util (#21444) 2023-12-08 18:00:03 +09:00
Yoshiya Hinosawa
3a74fa60ca
fix(ext/node): allow null value for req.setHeader (#21391)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08 17:43:19 +09:00
Yoshiya Hinosawa
2b3daa690d
feat(test): add default to --coverage option (#21510) 2023-12-08 17:35:42 +09:00
Yoshiya Hinosawa
d68d1e2022
feat(coverage): add html reporter (#21495)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08 16:54:52 +09:00
Divy Srivastava
c5c5dea90d
chore: use primordials in 40_testing.js (#21422)
This commit brings back usage of primordials in "40_testing.js" by
turning it back into an ES module and using new "lazy loading" functionality
of ES modules coming from "deno_core".

The same approach was applied to "40_jupyter.js".

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08 08:33:25 +01:00
Max Goodhart
2235a1a359
fix(node/tls): fix NotValidForName for host set via socket / servername (#21441)
This PR is an attempt to fix
https://github.com/denoland/deno/issues/20293, in which node modules
connecting to databases fail due to TLS errors. I ran into this
attempting to use
[node-postgres](https://github.com/brianc/node-postgres) to connect to a
[Neon](https://neon.tech) database.

Investigating via `--inspect-brk` led me to notice that the hostname
eventually passed to `Deno.startTls` was null. The hostname is
determined by the following code:


f6b889b432/ext/node/polyfills/_tls_wrap.ts (L87-L89)

This logic doesn't appear to be correct. I couldn't find reference to
`servername` existing on the `secureContext` in either Node's or Deno's
docs. There's a lot of scope here, and it's my first time reading
through this code, so I could be missing something!

Node uses [the following
logic](2e458d9736/lib/_tls_wrap.js (L1679-L1682)
) to determine the hostname for certificate validation:
 
```
    const hostname = options.servername ||
                   options.host ||
                   (options.socket && options.socket._host) ||
                   'localhost';
```

This PR updates the `TLSSocket` polyfill to use behave similarly (though
I omitted the default to `localhost` at the end; I'm not sure if
including it is necessary or correct). With this change, `node-postgres`
connects to my TLS endpoint successfully (aside: Neon requires SNI,
which also works as expected).

---

I tried to update the tests in
https://github.com/denoland/deno/blob/main/cli/tests/unit_node/tls_test.ts
to exercise this change, but the test fails for me on `main` on Linux. I
investigated briefly and noticed that the test fixture
`cli/tests/testdata/tls/localhost.crt` doesn't appear to include the
`subjectAltName` specified in `domains.txt`. I believe the certificate
isn't matching `localhost`, but that's where I ended investigating.
2023-12-08 03:53:36 +00:00
David Sherret
d192cc2640
fix: add more warnings when using sloppy imports (#21503)
One warning for when using it with `deno compile` and another when using
it with `deno run`.
2023-12-07 22:35:53 -05:00
Leo Kettmeir
3724d44d59
chore: bump rust to 1.74.1 (#21499) 2023-12-07 22:10:32 +01:00
David Sherret
78566753c8
feat: add suggestions to module not found error messages for file urls (#21498) 2023-12-07 15:59:13 -05:00
ud2
3f96e5a29a
fix(ext/node): include non-enumerable keys in Reflect.ownKeys(globalThis) (#21485)
Closes #21484.
2023-12-07 21:34:44 +05:30
Bartek Iwańczuk
c1fc7b2cd5
refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)
This commit refactors how we access "core", "internals" and
"primordials" objects coming from `deno_core`, in our internal JavaScript code.

Instead of capturing them from "globalThis.__bootstrap" namespace, we
import them from recently added "ext:core/mod.js" file.
2023-12-07 14:21:01 +01:00
Leo Kettmeir
5dd9b26155
chore: update deno_core (#21487)
For #20812
2023-12-07 14:07:53 +01:00
David Sherret
890780a9e9
feat(unstable): ability to resolve specifiers with no extension, specifiers for a directory, and TS files from JS extensions (#21464)
Adds an `--unstable-sloppy-imports` flag which supports the
following for `file:` specifiers:

* Allows writing `./mod` in a specifier to do extension probing.
- ex. `import { Example } from "./example"` instead of `import { Example
} from "./example.ts"`
* Allows writing `./routes` to do directory extension probing for files
like `./routes/index.ts`
* Allows writing `./mod.js` for *mod.ts* files.

This functionality is **NOT RECOMMENDED** for general use with Deno:

1. It's not as optimal for perf:
https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-2/
1. It makes tooling in the ecosystem more complex in order to have to
understand this.
1. The "Deno way" is to be explicit about what you're doing. It's better
in the long run.
1. It doesn't work if published to the Deno registry because doing stuff
like extension probing with remote specifiers would be incredibly slow.

This is instead only recommended to help with migrating existing
projects to Deno. For example, it's very useful for getting CJS projects
written with import/export declaration working in Deno without modifying
module specifiers and for supporting TS ESM projects written with
`./mod.js` specifiers.

This feature will output warnings to guide the user towards correcting
their specifiers. Additionally, quick fixes are provided in the LSP to
update these specifiers:
2023-12-07 00:03:18 +00:00
Matt Mastracci
9314928990
chore: bump deno_core and update tests (#21467)
Landing changes required for
https://github.com/denoland/deno_core/pull/359

We needed to update 99_main.js and a whole load of tests.

API changes:

- setPromiseRejectCallback becomes setUnhandledPromiseRejectionHandler.
The function is now called from eventLoopTick.
- The promiseRejectMacrotaskCallback no longer exists, as this is
automatically handled in eventLoopTick.
- ops.op_dispatch_exception now takes a second parameter: in_promise.
The preferred way to call this op is now reportUnhandledException or
reportUnhandledPromiseRejection.
2023-12-06 17:02:52 -07:00
David Sherret
68d356eed9
feat: TypeScript 5.3 (#21480)
https://github.com/denoland/TypeScript/pull/9
2023-12-06 18:49:34 -05:00
Bartek Iwańczuk
a931a47511
feat: stabilize Deno.HttpServer.shutdown and Unix socket support (#21463)
This commit stabilizes "Deno.HttpServer.shutdown" API as well as
Unix socket support in "Deno.serve" API.

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-12-06 23:43:01 +00:00
David Sherret
e372fc73e8
fix(task): handle node_modules/.bin directory with byonm (#21386)
A bit hacky, but it works. Essentially, this will check for all the
scripts in the node_modules/.bin directory then force them to run with
Deno via deno_task_shell.
2023-12-06 16:36:06 -05:00
David Sherret
7fdc3c8f1f
fix(compile/npm): ignore symlinks to non-existent paths in node_modules directory (#21479)
Part of https://github.com/denoland/deno/issues/21476
2023-12-06 16:25:24 -05:00
Bartek Iwańczuk
07f78912d6
chore: update rustyline to 13.0.0 (#21481)
Prerequisite for https://github.com/denoland/deno/pull/18453.

This update also makes it possible to address
https://github.com/denoland/deno/issues/8049 by
using
https://docs.rs/rustyline/latest/rustyline/struct.Editor.html#method.create_external_printer
2023-12-06 21:56:40 +01:00
David Sherret
9bdc9e4ecb
fix(npm): do not create symlink for non-system optional dep in node_modules directory (#21478)
Closes https://github.com/denoland/deno/issues/21476
2023-12-06 14:24:00 -05:00
Yoshiya Hinosawa
f75eb12801
test(ext/node): compare free memory in log scale (#21475) 2023-12-07 00:32:39 +09:00
David Sherret
1ac370632f
fix: display unstable flags at bottom of help text (#21468)
Moves the unstable flags to be at the bottom of the help text. They were
previously all over the place for some reason.
2023-12-06 09:22:30 -05:00
Jamie
8c0fb9003d
feat(ext/web): add ImageData Web API (#21183)
Fixes #19288

Adds the `ImageData` Web API. 

This would be beneficial to projects using `ImageData` as a convenient
transport layer for pixel data. This is common in Web Assembly projects
that manipulate images. Having this global available in Deno would
improve compatibility of existing JS libraries.

**References**
- [MDN ImageData Web
API](https://developer.mozilla.org/en-US/docs/Web/API/ImageData)
- [whatwg HTML Standard Canvas
Spec](https://html.spec.whatwg.org/multipage/canvas.html#pixel-manipulation)
2023-12-06 14:20:28 +01:00
Yusuke Tanaka
dadd8b3d66
feat(ext/fetch): allow Deno.HttpClient to be declared with using (#21453)
This commit adds a method of `Symbol.dispose` to the object returned
from `Deno.createHttpClient`, so we can make use of [explicit resource
management](https://github.com/tc39/proposal-explicit-resource-management)
by declaring it with `using`.
2023-12-06 16:52:59 +09:00
David Sherret
65993e5efa
fix(fmt): "singleQuote": true should prefer single quote—not always use one (#21470) 2023-12-05 22:06:19 -05:00
Bartek Iwańczuk
bd7a6bb016
chore: forward v1.38.5 release commit to main (#21472)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-12-06 00:53:16 +00:00