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

9397 commits

Author SHA1 Message Date
denobot
ea6cd3f1fc
1.34.1 (#19310)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-30 01:30:46 +02:00
Bartek Iwańczuk
d90a75c036
fix: use proper ALPN protocols if HTTP client is HTTP/1.1 only (#19303)
Closes https://github.com/denoland/deno/issues/16923

---------

Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-29 23:05:45 +02:00
egg
fc6ba92024
test(ext/node): add os_test.ts (#19305)
Part of #17840

I haven't made any changes or additions to the tests themselves, just
moved the tests over and updated to match.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-29 15:03:14 +02:00
Bartek Iwańczuk
cf8b7bb530
fix(node): http.IncomingMessageForClient.complete (#19302)
Closes https://github.com/denoland/deno/issues/19238
2023-05-29 01:29:01 +02:00
Matt Mastracci
429da4ee2d
refactor(core): Refactor and re-organize code for easier maintenance (#19287)
Part of some work to refactor and decouple the various parts of core.
2023-05-28 19:13:53 +00:00
Nayeem Rahman
b6a3f8f722
refactor(core): remove ext: modules from the module map (#19040)
Rather than disallowing `ext:` resolution, clear the module map after
initializing extensions so extension modules are anonymized. This
operation is explicitly called in `deno_runtime`. Re-inject `node:`
specifiers into the module map after doing this.

Fixes #17717.
2023-05-28 12:44:41 -06:00
Levente Kurusa
bb0676d3e2
fix(ext/http): fix a possible memleak in Brotli (#19250)
We probably need to free the BrotliEncoderState once the stream has
finished.
2023-05-28 12:30:55 -06:00
David Sherret
92080ff6f6
chore: maybe fix cli/standalone/virtual_fs tests on main (#19295)
Not sure why these don't fail on a PR run:
https://github.com/denoland/deno/actions/runs/5102317156/jobs/9171796164

**Merge on approval**
2023-05-28 15:55:30 +02:00
David Sherret
d43e75cbb2
chore: fix flaky test_include_dir_recursive (#19291)
Maybe fixes this on main.
2023-05-28 00:03:49 -04:00
David Sherret
a96844118c
fix(compile): inline symlinks as files outside node_modules dir and warn for directories (#19285)
If a symlink within the `node_modules` directory lies outside that
directory, it will now warn and inline the file. For directories, it
will just warn for now.

Probably fixes #19251 (I'm still unable to reproduce).
2023-05-27 10:33:15 -04:00
Leo Kettmeir
be59e93220
refactor(node/http): don't use readablestream for writing to request (#19282)
Refactors the internal usage of a readablestream to write to the
resource directly

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-27 15:42:20 +02:00
David Sherret
d0c5ff42f4
fix(compile): implicit read permission to npm vfs (#19281)
Closes #19280
2023-05-26 13:33:38 -04:00
Bartek Iwańczuk
a11681a9b0
refactor(node): use internal io and fs APIs (#19267) 2023-05-26 16:18:27 +02:00
Bartek Iwańczuk
d72e0281ff
chore: upgrade rusty_v8 to 0.73.0 (#19278) 2023-05-26 16:17:12 +02:00
Bartek Iwańczuk
160fe9787e
fix(node): make 'v8.setFlagsFromString' a noop (#19271)
Towards https://github.com/denoland/deno/issues/16460
2023-05-26 15:41:03 +02:00
Bartek Iwańczuk
d5a8a3d69f
chore: remove useless benchmark (#19272)
This benchmark is useless and only gives several hundred thousand
messages of failure.

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-05-26 13:26:21 +00:00
David Sherret
25cbd97ab7
chore(lsp/tests): diagnostic synchronization (reland) (#19270)
Merge on approval as it fixes the flaky test.
2023-05-26 08:10:18 +02:00
Bartek Iwańczuk
e95f098ae3
fix(napi): properly handle arguments in napi_get_cb_info (#19269)
Closes https://github.com/denoland/deno/issues/17213
2023-05-26 05:02:12 +00:00
Bartek Iwańczuk
512d5337c4
fix(napi): clear currently registering module slot (#19249)
This commit fixes problem with loading N-API modules that use 
the "old" way of registration (using "napi_module_register" API).
The slot was not cleared after loading modules, causing subsequent
calls that use the new way of registration (using 
"napi_register_module_v1" API) to try and load the previous module.

Ref https://github.com/denoland/deno/issues/16460

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-05-26 10:10:17 +05:30
Bartek Iwańczuk
7ae55e75d8
Revert "chore(lsp/tests): diagnostic synchronization (#19264)" (#19268)
This reverts commit 89026abe39.

This change caused LSP benchmarks to fail on `main`.
2023-05-26 04:31:54 +00:00
David Sherret
89026abe39
chore(lsp/tests): diagnostic synchronization (#19264)
Fixes the flaky lsp test by having better synchronization of diagnostics
between the client and server for testing purposes.
2023-05-26 05:01:33 +02:00
Hirotaka Tagawa / wafuwafu13
0a3d355ce6
chore(node_compat): fix broken link and typo (#19265) 2023-05-26 05:00:29 +02:00
David Sherret
2ddf85492f
fix(compile): improve panic message when stripping root path fails (#19258)
I'm not sure what's going on here, so this will help us debug.

For #19251
2023-05-25 15:29:58 -04:00
David Sherret
2ebd61ee1b
fix(compile): handle when DENO_DIR is readonly (#19257)
Closes #19253
2023-05-25 14:27:45 -04:00
Luca Casonato
76400149a4
fix: don't print release notes on version check prompt (#19252) 2023-05-25 14:45:11 +02:00
denobot
935071dd0e
1.34.0 (#19246)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24 23:38:01 +00:00
Levente Kurusa
9ddb39d4cd
fix(ext/node): ClientRequest.setTimeout(0) should remove listeners (#19240)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
2023-05-24 22:54:12 +02:00
David Sherret
91ca9904b5
refactor: upgrade to deno_npm 0.6 (#19244) 2023-05-24 16:23:10 -04:00
Hirotaka Tagawa / wafuwafu13
114ec3c1f7
feat(ext/fs): add isBlockDevice, isCharDevice, isFifo, isSocket to FileInfo (#19008)
`isFile`, `isDirectory`, `isSymlink` are defined in `Deno.FileInfo`, but
`isBlockDevice`, `isCharacterDevice`, `isFIFO`, `isSocket` are not
defined.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24 21:18:13 +02:00
Bartek Iwańczuk
072e2b2fa2
refactor(core): store pending ops per realm (#19054)
Dispatches op per-realm, and allows JsRealm to be garbage collected.

Slight improvement to benchmarks, but opens opportunity to clean up event loop.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-05-24 13:15:21 -06:00
David Sherret
ba6f573b4e
fix(npm): create node_modules/.deno/node_modules folder (#19242)
This is what pnpm does and we were missing it. It makes modules work
which have a dependency on something, but don't say they have that
dependency, but that dep is still in the tree somewhere.
2023-05-24 15:04:21 -04:00
Matt Mastracci
0fbfdaf901
chore(core): Ensure that net test ports aren't used elsewhere (#19243)
Fixes occasional test flake due to overlapping ports
2023-05-24 12:36:41 -06:00
Levente Kurusa
1174715f99
feat(ext/http): Brotli Compression (#19216)
Add Brotli streaming compression to HTTP
2023-05-24 19:54:47 +02:00
Bartek Iwańczuk
e56695daa8
fix(napi): add napi_async_init and napi_async_destroy (#19234)
We don't have support for "AsyncContext" in "node:async_hooks" 
module, so these two APIs are just noops.

Towards https://github.com/denoland/deno/issues/18610.
2023-05-24 15:41:43 +02:00
Bartek Iwańczuk
0bb5bbc7a0
fix(node): fire 'unhandledrejection' event when using node: or npm: imports (#19235)
This commit fixes emitting "unhandledrejection" event when there are
"node:" or "npm:" imports. 

Before this commit the Node "unhandledRejection" event was emitted
using a regular listener for Web "unhandledrejection" event. This
listener was installed before any user listener had a chance to be 
installed which effectively prevent emitting "unhandledrejection" 
events to user code.

Closes https://github.com/denoland/deno/issues/16928
2023-05-24 15:40:41 +02:00
David Sherret
787e1f0f92
fix(npm): better handling of optional peer dependencies (#19236)
Has fix for https://github.com/denoland/deno_npm/pull/9
2023-05-24 10:56:23 +02:00
David Sherret
cacc8c9a4d
feat: top level package.json install when node_modules dir is explicitly opted into (#19233)
When someone explicitly opts into using the node_modules dir via
`--node-modules-dir` or setting `"nodeModulesDir": true` in the
deno.json file, we should eagerly ensure a top level package.json
install is done on startup. This was initially always done when we added
package.json support and a package.json was auto-discovered, but scaled
it back to be lazily done when a bare specifier matched an entry in the
package.json because of how disruptive it was for people using Deno
scripts in Node projects. That said, it does not make sense for someone
to opt-into having deno control and use their node_modules directory and
not want a package.json install to occur. If such a rare scenario
exists, the `DENO_NO_PACKAGE_JSON=1` environment variable can be set.

Ideally, we would only ever use a node_modules directory with this
explicit opt-in so everything is very clear, but we still have this
automatic scenario when there's a package.json in order to make more
node projects work out of the box.
2023-05-23 18:51:48 -04:00
Bartek Iwańczuk
01a95d677f
chore: upgrade rusty_v8 to 0.72.0 (#19228)
This commit updates rusty_v8 to 0.72.0 and by extension
V8 to version 11.5.150.1.
2023-05-24 00:11:37 +02:00
Yoshiya Hinosawa
26f42a248f
fix(ext/node): add basic node:worker_threads support (#19192)
This PR restores `node:worker_threads` implementation and test cases
from
[`std@0.175.0/node`](https://github.com/denoland/deno_std/blob/0.175.0/node/worker_threads.ts).

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-23 20:56:29 +02:00
Bartek Iwańczuk
3d865949c2
fix: better error message for malformed glob (#19225)
Before:
```
$ cargo run -- test "foo/*******/bar.ts"
error: Pattern syntax error near position 6: wildcards are either regular `*` or recursive `**`
```

After:
```
$ cargo run -- test "foo/*******/bar.ts"
error: Failed to expand glob: "foo/*******/bar.ts"

Caused by:
    Pattern syntax error near position 6: wildcards are either regular `*` or recursive `**`
```

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-05-23 17:35:12 +00:00
Marvin Hagemeister
8608105208
fix(node): duplicate node_module suffixes (#19222)
Noticed that we're checking more module paths than necessary. In
particular the module path array contains a couple of entries with a
duplicated `node_modules/node_modules` suffix.

```js
[
    // ... more entries before here, where some also contain duplicate suffixes
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/.deno/node_modules",
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules/node_modules", // <-- duplicate suffix
    "/Users/marvinhagemeister/dev/preact-render-to-string/node_modules",
    "/Users/marvinhagemeister/dev/node_modules",
    "/Users/marvinhagemeister/node_modules",
    "/Users/node_modules",
    "/node_modules",
    "/node_modules"  // <-- duplicate entry
]
```

This was caused by a misunderstanding in how Rust's
[`Path::ends_with()`](https://doc.rust-lang.org/std/path/struct.Path.html#method.ends_with)
works. It's designed to match on whole path segments and the suffix
`/node_modules` is not that, except for the root entry. This meant that
our check for if the path already ended with `node_module` always
returned `false`. Removing the leading slash fixes that.

While we're at it, we can remove the last condition where we explicitly
added the root `/node_modules` entry since the while loop prior to that
takes care of it already.
2023-05-23 12:46:14 +02:00
Bartek Iwańczuk
5874fc3d0a
feat: add support for globs in the config file and CLI arguments for files (#19102)
Follow up to https://github.com/denoland/deno/pull/19084.

This commit adds support for globs in the configuration file as well 
as CLI arguments for files. 

With this change users can now use glob syntax for "include" and 
"exclude" fields, like so:

```json
{
  "lint": {
    "include": [
      "directory/test*.ts",
      "other_dir/"
    ],
    "exclude": [
      "other_dir/foo*.ts",
      "nested/nested2/*"
    ]
  },
  "test": {
    "include": [
      "data/test*.ts",
      "nested/",
      "tests/test[1-9].ts"
    ],
    "exclude": [
      "nested/foo?.ts",
      "nested/nested2/*"
    ]
  }
}
```

Or in CLI args like so:
```
// notice quotes here; these values will be passed to Deno verbatim
// and deno will perform glob expansion

$ deno fmt --ignore="data/*.ts"
$ deno lint "data/**/*.ts"
```

Closes https://github.com/denoland/deno/issues/17971
Closes https://github.com/denoland/deno/issues/6365
2023-05-23 03:39:59 +02:00
David Sherret
bb37dfb5b7
feat(lsp): support lockfile and node_modules directory (#19203)
This adds support for the lockfile and node_modules directory to the
lsp.

In the case of the node_modules directory, it is only enabled when
explicitly opted into via `"nodeModulesDir": true` in the configuration
file. This is to reduce the language server automatically modifying the
node_modules directory when the user doesn't want it to.

Closes #16510
Closes #16373
2023-05-22 21:28:36 -04:00
Leo Kettmeir
5878258952
refactor: further work on node http client (#19211) 2023-05-23 03:03:10 +02:00
Bartek Iwańczuk
25232fa4e8
fix(node): make sure "setImmediate" is not clamped to 4ms (#19213)
This commit changes implementation of "setImmediate"
from "node:timers" module to 0ms timer that is never
clamped to 4ms no matter how many nested calls there are.

Closes https://github.com/denoland/deno/issues/19034
2023-05-22 22:19:44 +00:00
David Sherret
7b4c483aa1
fix(npm): store npm binary command resolution in lockfile (#19219)
Part of #19038

Closes #19034 (eliminates the time spent re-resolving)
2023-05-22 16:55:04 -04:00
Matt Mastracci
612226de8e
chore(cli): One Rust test per JS and Node unit test file (#19199)
This runs our `js_unit_tests` and `node_unit_tests` in parallel, one
rust test per JS unit test file. Some of our JS tests don't like running
in parallel due to port requirements, so this also makes those use a
specific port-per-file. This does not attempt to make the node-compat
tests work.
2023-05-22 13:35:59 -06:00
David Sherret
ffa020f43a
fix(runtime): JS debug log to stderr (#19217)
Debug logs should all go to stderr.
2023-05-22 18:17:31 +00:00
Matt Mastracci
5c349039b8
chore(cli): Don't assume deno is in path for spawn_kill_permissions (#19198)
We don't need to use the `deno` command here to test kill permissions
and it's awkward to get right without passing `-A`. `cat` works, but for
platforms other than windows. This test should have plenty of coverage
on other platforms.
2023-05-22 09:54:58 -06:00
Connor Burton
19f1823e44
docs: be explicit in the unit of time of delay in setTimeout (#19207) 2023-05-22 14:04:28 +00:00