1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-27 16:10:57 -05:00
Commit graph

8426 commits

Author SHA1 Message Date
Yiyu Lin
d5ed8a0a9f
chore(cli,ext,rt): remove some unnecessary clone or malloc (#17261) 2023-01-05 13:06:22 +01:00
Yiyu Lin
4820ed9b58
docs(cli): do not need gen doc for cli (#17260) 2023-01-05 13:06:21 +01:00
Asher Gomez
a162f5ef54
chore(CI): update to actions/cache@v3 (#17201) 2023-01-05 13:06:21 +01:00
Asher Gomez
63ca68d058
fix(permissions): process URL in Deno.FfiPermissionDescriptor.path for revoke() and request() (#17094)
Previously, `Deno.permissions.[revoke|request]()` wouldn't correctly
process the `path: URL` when `name` was `ffi`. This change fixes that
behaviour and adds a new function, `formDescriptor()`, to ensure `URL`
arguments are consistently handled across
`Deno.permissions.[query|revoke|request]()`.
2023-01-05 13:06:21 +01:00
Geert-Jan Zwiers
43e8b51316
chore: resolve clippy errors in windows build (#17215) 2023-01-05 13:06:21 +01:00
Bartek Iwańczuk
a012d731ee
fix(lsp): don't error if completionItem/resolve request fails (#17250) 2023-01-05 13:06:21 +01:00
Bartek Iwańczuk
7177768e49
fix(permissions): fix italic font in permission prompt (#17249) 2023-01-05 13:06:21 +01:00
Fenix
211a8b438a
fix(cli): bundle command support shebang file (#17113) 2023-01-05 13:06:21 +01:00
Leo Kettmeir
822173664e
fix(lsp): treat empty string config value as None (#17227)
Fixes #14630
2023-01-05 13:06:20 +01:00
David Sherret
76f30a1878
fix(declaration): change Deno.open example to not use Deno.close(rid) (#17218) 2023-01-05 13:05:50 +01:00
Geert-Jan Zwiers
1a61fe910c
refactor(lsp): reduce number of clones (#17254)
This PR optimizes the code in the language server by performing less
cloning of data.
2023-01-05 13:05:49 +01:00
David Sherret
2fee8394a9
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-05 13:05:49 +01:00
Geert-Jan Zwiers
287f46f0cd
refactor: cleanup redundant call (#17226) 2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
0904665f89
fix(lsp): less agressive completion triggers (#17225)
Closes https://github.com/denoland/deno/issues/17056
Closes https://github.com/denoland/deno/issues/17055
2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
b9768e2338
fix(lsp): completions for private variables (#17220) 2023-01-05 13:05:49 +01:00
Bartek Iwańczuk
4a1a6b7985
fix(lsp): "Add all missing imports" uses correct specifiers (#17216)
This commit fixes "Add all missing imports" quick fix; before
it was replacing all occurrences with the same specifier. Now
every line returned from TSC is processed individually.
2023-01-05 13:05:49 +01:00
Kamil Ogórek
203b5a4822
fix(node): Add op_node_unstable_os_uptime to allow for node interop (#17208) 2023-01-05 13:05:48 +01:00
Kamil Ogórek
5c9e7662d7
fix(ext/net): Remove unstable check from op_node_unstable_net_listen_udp (#17207)
The whole point of creating this alternative operation was to allow
usage in node, without `--unstable` flag.
Introduced and I believe missed in
https://github.com/denoland/deno/pull/16520/
2023-01-05 13:05:48 +01:00
Bartek Iwańczuk
2b15b07753
feat(unstable): Add Deno.Conn.ref()/unref() (#17170)
This commit adds "Deno.Conn.ref()" and "Deno.Conn.unref()" methods.

These methods can be used to make connection block or not block the
event loop from finishing. Refing/unrefing only influences "read" 
operations - ie. scheduling writes to a connection _do_ keep event 
loop alive.

Required for https://github.com/denoland/deno/issues/16710
2023-01-05 13:05:48 +01:00
Kamil Ogórek
3baf1a4bd3
feat(unstable): Add "Deno.osUptime()" API (#17179)
This PR adds support for `Deno.osUptime` which reports number of seconds
since os was booted. It will allow us to be compatible with Node's `os.uptime` -
https://nodejs.org/api/os.html#osuptime

Partially based on
https://docs.rs/uptime_lib/latest/src/uptime_lib/lib.rs.html
2023-01-05 13:05:48 +01:00
Andreu Botella
1e857bc03c
chore(core): Make OpCtx instances be realm-specific (#17174) 2023-01-05 13:05:17 +01:00
Ikko Ashimine
d560fd7b11
chore(npm): fix typo in local.rs (#17186) 2023-01-05 13:05:17 +01:00
Bartek Iwańczuk
127b68df39
fix(core): run macrotasks and next ticks after polling dynamic imports (#17173)
This commit fixes handling of rejected promises in dynamic imports
evaluation.

Previously we were running callbacks for next ticks and macrotasks
_before_ polling
dynamic imports and checked for unhandled rejections immediately after.
This is wrong,
as `unhandledrejection` event is dispatched and its callbacks are run as
macrotasks.

This commit changes order of actions performed by the event loop to
following:
- poll async ops
- poll dynamic imports
- run next tick callbacks
- run macrotask callbacks
- check for unhandled promise rejections
2023-01-05 13:05:16 +01:00
Kamil Ogórek
36a936c5aa
fix(ext/fetch): Guard against invalid URL before its used by reqwest (#17164) 2023-01-05 13:05:16 +01:00
Geert-Jan Zwiers
859913c484
fix: add missing verb in description (#17163) 2023-01-05 13:05:16 +01:00
Bartek Iwańczuk
10ad562b90
fix: rejected dynamic import should retain error context (#17160)
Found this while debugging
https://github.com/denoland/deno/issues/16280.

Before:
```
TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'.
    at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17)
    at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59)
    at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39)
    at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43)
```

After:
```
TypeError: Could not resolve 'file:///Users/ib/dev/test_rollup/mocha/rollup.config.js' from 'file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js'.
  Caused by: 
    Reading /Users/ib/dev/test_rollup/mocha/package.json is not allowed
    at async getConfigFileExport (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:432:17)
    at async Object.loadConfigFile (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/shared/loadConfigFile.js:391:59)
    at async getConfigs (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1679:39)
    at async runRollup (file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/rollup/3.7.3/dist/bin/rollup:1656:43)
```
2023-01-05 13:05:16 +01:00
Kenta Moriuchi
b1cee59fcb
fix(ext): Add checks for owning properties in for-in loops (#17139)
In the for-in loops, there were a few places where we forgot to check if
objects owned some properties, so I added them.
2023-01-05 13:05:16 +01:00
Bartek Iwańczuk
ee39fb2f27
fix(permissions): add information about import() API request (#17149)
This commit changes permission prompt to show that "import()" API
is requesting permissions.

Given "dynamic_import.js" like so:
```
import("https://deno.land/std@0.170.0/version.ts");
```

Before:
```
deno run dynamic_import.js
⚠️  ┌ Deno requests net access to "deno.land".
   ├ Run again with --allow-net to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) > 

```

After:
```
deno run dynamic_import.js
⚠️  ┌ Deno requests net access to "deno.land".
   ├ Requested by `import()` API
   ├ Run again with --allow-net to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) >

```
2023-01-05 13:05:16 +01:00
Kamil Ogórek
e54cede195
fix(core): Do not print errors prop for non-AggregateError errors (#17123)
This commit fixes formatting of JSError with "errors" property. Before this
commit all instances of "Error" were treated as if they were "AggregateError"
if they had "errors" property. After this commit only actual instances of 
"AggregateError" are formatted in such a way, while instances of "Error"
that have "errors" property are formatted without showing details of "errors".
2023-01-05 13:05:16 +01:00
David Sherret
008cd7d878
fix(lsp/format): language formatter used should be based on language id (#17148)
Closes #11897
2023-01-05 13:05:15 +01:00
Andreu Botella
175f973a32
fix(core): Have custom errors be created in the right realm (#17050)
Although PR #16366 did not fully revert `deno_core`'s support for
realms, since `JsRealm` still existed after that, it did remove the
`ContextState` struct, originally introduced in #14734. This change made
`js_build_custom_error_cb`, among other properties, a per-runtime
callback, rather than per-realm, which cause a bug where errors thrown
from an op would always be constructed in the main realm, rather than in
the current one.

This change adds back `ContextState` to fix this bug, adds back the
`known_realms` field of `JsRuntimeState` (needed to be able to drop the
callback when snapshotting), and also relands #14750, which adds the
`js_realm_sync_ops` test for this bug that was removed in #16366.
2023-01-05 13:05:15 +01:00
Bartek Iwańczuk
a524717ba5
chore: update node compat layer to std@0.170.0 (#17147)
Fixed a performance regression for express server
2023-01-05 13:04:39 +01:00
David Sherret
f9be46cd6c
fix: ignore local lockfile for deno install and uninstall (#17145)
Closes #17116
2023-01-05 13:04:39 +01:00
David Sherret
ba8156e578
fix(npm): resolve npm specifiers when root redirected (#17144)
Closes #17136
2023-01-05 13:04:39 +01:00
Ryan Dahl
a26cd4d073
chore: bump deno_fetch and deno_http versions (#17124)
https://github.com/denoland/deno/pull/17081
https://github.com/denoland/deno/pull/17126
2023-01-05 13:04:39 +01:00
Luca Casonato
9cd9a68b00
fix(ext/http): close stream on resp body error (#17126)
Previously, errored streaming response bodies did not cause the HTTP
stream to be aborted. It instead caused the stream to be closed gracefully,
which had the result that the client could not detect the difference
between a successful response and an errored response.

This commit fixes the issue by aborting the stream on error.
2023-01-05 13:04:38 +01:00
Kenta Moriuchi
60b0deb726
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
2023-01-05 13:04:38 +01:00
Kamil Ogórek
ba1a5424dd
chore(test): report correct cwd when running tests via itest macro (#17132) 2023-01-05 13:04:38 +01:00
Kamil Ogórek
faa4e1b7cc
fix(cli): allow for specifying noErrorTruncation compiler option (#17127)
Fixes https://github.com/denoland/deno/issues/16568
2023-01-05 13:04:38 +01:00
David Sherret
ed200d8872
perf(lsp): concurrent reads and exclusive writes (#17135) 2023-01-05 13:04:38 +01:00
Leo Kettmeir
36e9a8c665
fix(lsp/testing): fallback name for non-analyzable tests in collector (#17120)
Closes #17054. 
The fallback is `Test lineNumber:columnNumber`
2023-01-05 13:04:38 +01:00
Leo Kettmeir
69997a9ae2
fix: display URL in invalid URL error (#17128) 2023-01-05 13:04:37 +01:00
David Sherret
c3241a956b
fix: hide progress bars when showing permission prompt (#17130)
Also adds download bytes progress when downloading remote specifiers.

Closes #16860
2023-01-05 13:04:01 +01:00
Divy Srivastava
b9c555d13a
chore(test_util): use pty2 instead of pty (#17131)
Fixes https://github.com/denoland/deno/issues/484

Removes dependency on winapi 0.2.x versions.
2023-01-05 13:04:00 +01:00
Kamil Ogórek
2ebc91c16a
fix(cli): do not clear screen for non-TTY environments in watch mode (#17129) 2023-01-05 13:04:00 +01:00
David Sherret
716a6b018e
refactor(progress bars): global control for drawing (#17091)
This PR adds the concept of a global `DrawThread`, which can receive
multiple renderers to draw information on the screen (note: the
underlying thread is released back to tokio when it's not rendering). It
also separates the concept of progress bars from the existing "draw
thread". This makes it trivial for us to do stuff like show permission
prompts and progress bars at the same time in the future.

The reason this is global is because the process' tty stderr is also a
global concept.
2023-01-05 13:04:00 +01:00
Bartek Iwańczuk
8df1210b63
fix(npm): conditional exports with --node-modules-dir (#17111)
This commit fixes conditional exports in `require()` implementation
if `--node-modules-dir` flag is used.
2023-01-05 13:04:00 +01:00
Luca Casonato
a9c0c20d1c
test(ext/fetch): fix test in release mode (#17125) 2023-01-05 13:03:42 +01:00
Luca Casonato
c059c12a1e
fix(ext/fetch): handle errors in req body stream (#17081)
Right now an error in a request body stream causes an uncatchable
global promise rejection. This PR fixes this to instead propagate the
error correctly into the promise returned from `fetch`.

It additionally fixes errored readable stream bodies being treated as
successfully completed bodies by Rust.
2023-01-05 13:03:42 +01:00
Leo Kettmeir
0bed6e009c
chore(lsp/testing): refactor collectors test (#17104) 2023-01-05 13:03:41 +01:00