Commit graph

8147 commits

Author SHA1 Message Date
Bartek Iwańczuk 5dea510b02
fix(lock): autodiscovery of lockfile (#16498)
This commit adds autodiscovery of lockfile. 

This only happens if Deno discovers the configuration file (either 
"deno.json" or "deno.jsonc"). In such case Deno tries to load
"deno.lock"
file that sits next to the configuration file, or creates one for user
if
the lockfile doesn't exist yet.

As a consequence, "--lock" and "--lock-write" flags had been updated.
"--lock" no longer requires a value, if one is not provided, it defaults
to "./deno.lock" resolved from the current working directory.
"--lock-write"
description was updated to say that it forces to overwrite a lockfile.

Autodiscovery is currently not handled by the LSP.
2022-11-02 16:32:30 +01:00
Bartek Iwańczuk 630abb58b0
refactor: Combine ImportMapResolver and JsxResolver (#16508)
These resolvers are used in `deno_graph` APIs. Combining them removes a
lot of code and
unblocks me on https://github.com/denoland/deno/pull/16157
2022-11-02 15:47:02 +01:00
Bartek Iwańczuk 68da943498
chore: fix clippy warning (#16512) 2022-11-02 15:40:11 +01:00
Divy Srivastava ab7e80bde4
chore(runtime): remove dependency on sys-info crate (#16441)
Fixes #9862 

`loadavg`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `sysinfo` | - |
| Windows | - | Returns `DEFAULT_LOADAVG`. There is no concept of
loadavg on Windows |
| macOS, BSD | `getloadavg` |
https://www.freebsd.org/cgi/man.cgi?query=getloadavg |

`os_release`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | `/proc/sys/kernel/osrelease` | - |
| Windows |
[`RtlGetVersion`](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlgetversion)
| dwMajorVersion . dwMinorVersion . dwBuildNumber |
| macOS | `sysctl([CTL_KERN, KERN_OSRELEASE])` | - |

`hostname`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Unix | `gethostname(sysconf(_SC_HOST_NAME_MAX))` | - |
| Windows | `GetHostNameW` | - |

`mem_info`

| Target family | Syscall | Description |
| ------------- | ------- | ----------- |
| Linux | sysinfo | - |
| Windows | `sysinfoapi::GlobalMemoryStatusEx` | - |
| macOS | <br> <pre> sysctl([CTL_HW, HW_MEMSIZE]); <br> sysctl([CTL_VM,
VM_SWAPUSAGE]); <br> host_statistics64(mach_host_self(), HOST_VM_INFO64)
</pre> | - |
2022-11-02 12:47:00 +05:30
David Sherret 5e4e324ceb
fix(lockfile): error if a referenced package id doesn't exist in list of packages (#16509)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-02 01:07:45 +00:00
Bartek Iwańczuk f5cb26a82f
revert 9ea0ce6198 (#16501)
Closes https://github.com/denoland/deno/issues/16450
2022-11-01 16:06:06 +01:00
Bartek Iwańczuk 89c5aa8598
fix(lock): Additive lock file (#16500)
This commit changes lockfile to be "additive" - ie. integrity check only fails if
file/package is already specified in the lockfile, but its integrity doesn't match.

If file/package is not present in the lockfile, it will be added to the lockfile and
the lockfile will be written to disk.
2022-11-01 00:07:36 +01:00
David Sherret cb08b4683f
feat(unstable/npm): deno info --json support for npm specifiers (#16472) 2022-10-31 10:25:46 -04:00
Bartek Iwańczuk c962cd4241
chore: remove stale comments (#16491)
Just a drive-by, noticed some stale comments that haven't been removed
earlier.
2022-10-31 14:14:35 +01:00
sigmaSd b07a753756
fix(tools): show correct upgrade command for upgrading canary (#16486) 2022-10-31 11:48:28 +01:00
Divy Srivastava d76014192d
fix(ext/websocket): make try_send ops infallible (#16454)
Fixes #16450
2022-10-31 12:22:49 +05:30
Shogo Hida 80ed54a4b6
fix(test): add slice method to filename to make them portable (#16482)
In order for test cases to pass regardless of each individual's environment,
this commit adds calls to `slice` method when printing the filenames so
we can avoid getting `console.log` to truncate them.

Fixes #16305
2022-10-31 12:46:59 +09:00
Bartek Iwańczuk 05eb4d1084
chore: remove stable unstable APIs from cli/diagnostics.rs (#16492)
All these APIs are now stable
2022-10-30 23:07:41 +01:00
Geert-Jan Zwiers 94a5103b04
fix: update env to sys permission in jsdoc for Deno.osRelease (#16483)
This API needs `--allow-sys` permissions nowadays, but the docs still
mention `--allow-env` permissions.

```
deno run .\file.ts
⚠️  ┌ Deno requests sys access to "osRelease".
   ├ Requested by `Deno.osRelease()` API      
   ├ Run again with --allow-sys to bypass this prompt.
   └ Allow? [y/n] (y = yes, allow; n = no, deny) >
```
2022-10-30 21:50:34 +01:00
Bartek Iwańczuk 3922ceda03
test: disable run_watch_external_watch_files on macOS (#16477)
This test has hung a lot recently on macOS. I am not sure if this is
because of a bug in the test or because of the macOS runner that is extremely
slow and flaky in general.
2022-10-30 21:25:15 +01:00
Marcos Casagrande 207dd8d111
fix(napi): fix is_detached_arraybuffer (#16478) 2022-10-30 13:13:46 -04:00
Kenta Moriuchi 59ac110edd
fix(core): fix APIs not to be affected by Promise.prototype.then modification (#16326) 2022-10-29 18:25:23 +09:00
David Sherret edaceecec7
feat: support npm specifiers in deno info for display text output only (#16470) 2022-10-28 16:19:55 -04:00
Bartek Iwańczuk 2c674dcd20
refactor(npm): reorganize initialization of compat layer (#16471)
Ensures that "std/node" graph is analyzed only once.
2022-10-28 21:53:55 +02:00
Bartek Iwańczuk e202f890f0
feat(core): support creating snapshots from existing snapshots (#14744) 2022-10-28 21:31:01 +02:00
David Sherret 7c80f15020
fix(lsp): correct parameterNames.suppressWhenArgumentMatchesName and variableTypes.suppressWhenTypeMatchesName (#16469)
Closes #16468
2022-10-28 14:48:14 -04:00
Bartek Iwańczuk d1d42e6ba7
fix(upgrade): don't prompt if latest version is older than current binary (#16464) 2022-10-28 18:43:49 +02:00
David Sherret 5cd82b84bb
chore: pin lsp types due to unstable "proposed" feature (#16467)
The "proposed" feature that we depend upon in tower-lsp, turns on the
"proposed" feature in lsp-types which has breaking changes in patch
releases because it's explicitly unstable. We need to pin it to prevent
it breaking cargo publish.
2022-10-28 11:38:56 -04:00
Bartek Iwańczuk 065f9cc767
fix: change default locale value (#16463)
Pointed by @zbraniecki in
https://github.com/denoland/deno/pull/12322#discussion_r1007416061, I
made a mistake with default locale value.
2022-10-28 17:23:05 +02:00
David Sherret 56d5cb21b0
refactor: move deno info functionality from deno_graph to CLI (#16434)
Closes #16423
2022-10-28 11:03:33 -04:00
Filip Skokan ec09134d8a
fix(ext/crypto): fix HMAC jwk import "use" check (#16465) 2022-10-28 19:50:38 +05:30
Divy Srivastava e18950284f
Reland "perf(core): generate inlined wrappers for async ops" (#16455)
Reland https://github.com/denoland/deno/pull/16428
2022-10-28 16:50:17 +05:30
Divy Srivastava d9e425a947
chore(core): remove TODO in bindings.rs (#16456) 2022-10-28 11:26:16 +05:30
David Sherret a4d4acd1af
chore(npm): add explicit tests for module.exports assignment with type checking (#16435) 2022-10-27 17:54:46 -04:00
Colin Ihrig 1376c6932f
fix: finish stabilizing Deno.osRelease() (#16447)
Fixes: https://github.com/denoland/deno/issues/16446
2022-10-27 16:56:06 -04:00
Bartek Iwańczuk c27942fee4
fix(lsp): add ServerCapabilities::encoding (#16444)
This caused v1.27.0 publishing to fail.
2022-10-27 19:34:44 +02:00
denobot b0fb8fa9dc
1.27.0 (#16442)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-27 17:13:26 +02:00
Divy Srivastava 115cc1e6ae
Revert "perf(core): generate inlined wrappers for async ops (#16428)" (#16443) 2022-10-27 16:58:27 +02:00
Divy Srivastava 02187966c1
perf(core): generate inlined wrappers for async ops (#16428)
V8's JIT can do a better job knowing the argument count and also enable
fast call path (in future).

This also lets us call async ops without `opAsync`:

```js
const { ops } = Deno.core;
await ops.op_void_async();
```

this patch: 4405286 ops/sec
main: 3508771 ops/sec
2022-10-27 19:10:48 +05:30
David Sherret bfd9912e1f
fix(typescript): allow synthetic default imports when using ModuleKind.ESNext (#16438)
Closes #16437
2022-10-27 08:12:40 -04:00
David Sherret 65f12f571b
fix(cli): do not log update checker when log level is quiet (#16433)
Co-authored-by: lucacasonato <hello@lcas.dev>
2022-10-26 21:20:41 +00:00
Colin Ihrig 37340e2386
chore(unstable): rename Deno.getUid() and Deno.getGid() (#16432)
This commit renames `Deno.getUid()` to `Deno.uid()` and renames
`Deno.getGid()` to `Deno.gid()`.
2022-10-26 16:37:48 -04:00
Luca Casonato f4f1f4f0b6
feat(ext/net): reusePort for TCP on Linux (#16398) 2022-10-26 19:04:27 +00:00
Marcos Casagrande de580cedd2
refactor(ext/streams): remove fake detached (#16431)
Removed "fake detached" logic since it's no longer needed after
[#16294](https://github.com/denoland/deno/pull/16294) landed
2022-10-26 20:40:26 +02:00
Leo Kettmeir 6ac603ec88
feat(runtime): make kill signal optional (#16299)
This commit changes "Deno.kill()" method to have a default
value, that is "SIGTERM".
2022-10-26 19:53:16 +02:00
Jan Špaček 642118fdeb
fix(core) Include causes when converting anyhow errors to JS exceptions (#16397)
When an op returns an `anyhow` error with a cause (usually added using
the `.context()` method), the `Error` thrown into JavaScript contains
only the message of the outernmost error in the chain.

This PR simply changes the formatting of `anyhow::Error` from `"{}"` to
`"{:#}"`:

This significantly improves errors for code that embeds Deno and defines
custom ops. For example, in
[chiselstrike/chiselstrike](https://github.com/chiselstrike/chiselstrike),
this PR improves an error message like

```
Error: could not plan migration
```

to

```
Error: could not plan migration: could not migrate table for entity "E": could not add column for field "title": the field does not have a default value
```
2022-10-26 17:30:44 +02:00
Bartek Iwańczuk a57faa8a0a
core: enable --harmony-change-array-by-copy V8 flag (#16429)
Enables [Change Array by copy
proposal](https://github.com/tc39/proposal-change-array-by-copy) via a
V8 flag.
2022-10-26 16:54:22 +02:00
David Sherret 678ac5757b
fix(compile): show an error when using npm specifiers (#16430)
Closes #16427
2022-10-26 13:55:26 +00:00
Kitson Kelly a0d10efbb1
chore: improve built-in API documentation (#16158)
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-26 15:53:48 +02:00
doi yuki 5d45d2a7e0
fix(upgrade): Added error message when using canary option with M1 (#16382)
before
```
Looking up latest version
Found latest version 8c9e6c5565
Checking https://dl.deno.land/canary/8c9e6c5565c1c00437d083de76cdd944e44b1d99/deno-aarch64-apple-darwin.zip
Download could not be found, aborting
```

after
```
Looking up latest canary version
Found latest version 8c9e6c5565
error: Canary builds are not available for M1
```

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-26 15:51:22 +02:00
Cre3per 193b8828c5
feat(cli): show error cause recursion information (#16384) 2022-10-26 15:37:45 +02:00
Divy Srivastava 6cd9343e8b
perf(ext/web): optimize transferArrayBuffer (#16294)
Avoid copying enqueued data + misc optimizations to skip webidl
converter.
2022-10-26 18:28:25 +05:30
Bartek Iwańczuk 046ab7dc8a
feat: Stabilize Deno.osRelease() API (#15973)
Closes https://github.com/denoland/deno/issues/15928
2022-10-26 14:18:58 +02:00
Divy Srivastava 851db03a6e
perf(core): do not drive JsInspector by default (#16410)
Part of https://github.com/denoland/deno/pull/16377
2022-10-26 17:07:50 +05:30
David Sherret 4d166e638f
feat(task): support sleep suffixes (#16425)
Co-authored-by: sigmaSd <sigmasd@users.noreply.github.com>
2022-10-25 21:14:08 -04:00