Commit graph

8374 commits

Author SHA1 Message Date
Divy Srivastava
110a0ebe69
perf(core): minimize trivial heap allocations in resolve_async_ops (#16584)
* Use stack allocated array for 16 promises and spill rest to heap. the
exact number can change, maybe 128? (tokio's coop budget limit)
* Avoid v8::Global::clone for global context.
* Do not open global opresolve when its not needed.
2022-11-10 17:26:02 +05:30
Divy Srivastava
bc33a4b2e0
refactor(ops): Rewrite fast call optimizer and codegen (#16514) 2022-11-10 17:23:31 +05:30
Mathias Lafeldt
92764c0dec
feat(runtime): support creating workers with custom v8 snapshots (#16553)
This PR makes it possible for applications to create workers from custom
snapshots to improve runtime performance (without having to fork/copy
`runtime/workers.rs`).
2022-11-10 12:46:26 +01:00
Marcos Casagrande
7bd2c607dd
fix(ext/response): make error, json, redirect enumerable (#16497) 2022-11-10 00:31:14 +01:00
Bartek Iwańczuk
fca539e65c
feat(lock): don't require --unstable for auto discovery (#16582)
Enables discovery of lock file unconditionally (ie. not requiring
"--unstable" flag) as long as there's a config file discovered.
2022-11-10 00:28:01 +01:00
Colin Ihrig
c36496b3bb
feat: stabilize Deno.uid() and Deno.gid() (#16424)
Closes https://github.com/denoland/deno_std/issues/2791
2022-11-09 09:46:50 -05:00
Colin Ihrig
0500aa1f71
feat: stabilize Deno.systemMemoryInfo() (#16445) 2022-11-09 14:14:25 +01:00
Colin Ihrig
f946806868
feat: stabilize Deno.networkInterfaces() (#16451) 2022-11-09 13:29:24 +01:00
Yoshiya Hinosawa
9edcab524f
fix(ext/flash): revert #16284 and add test case (#16576) 2022-11-09 17:20:05 +09:00
denobot
c08fcd96c1
chore: forward v1.27.2 release commit to main (#16572)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2022-11-09 00:27:51 +01:00
David Sherret
cbb3f85433
feat(unstable/npm): support peer dependencies (#16561)
This adds support for peer dependencies in npm packages.

1. If not found higher in the tree (ancestor and ancestor siblings),
peer dependencies are resolved like a dependency similar to npm 7.
2. Optional peer dependencies are only resolved if found higher in the
tree.
3. This creates "copy packages" or duplicates of a package when a
package has different resolution due to peer dependency resolution—see
https://pnpm.io/how-peers-are-resolved. Unlike pnpm though, duplicates
of packages will have `_1`, `_2`, etc. added to the end of the package
version in the directory in order to minimize the chance of hitting the
max file path limit on Windows. This is done for both the local
"node_modules" directory and also the global npm cache. The files are
hard linked in this case to reduce hard drive space.

This is a first pass and the code is definitely more inefficient than it
could be.

Closes #15823
2022-11-08 14:17:24 -05:00
Bartek Iwańczuk
2c72e8d5f4
fix(lock): only store integrities for http: and https: imports (#16558) 2022-11-08 04:08:24 +01:00
David Sherret
ed521850af
chore: fix windows-only clippy error (#16560) 2022-11-07 21:40:20 -05:00
Bartek Iwańczuk
d0212198b6
refactor(ext/node): remove unwraps (#16559) 2022-11-08 03:16:24 +01:00
Ryan Dahl
3019c45f87
refactor: simplify deno_core's grab_global and ensure_objs (#16564)
- refactor: remove JsRuntime::ensure_objs
- refactor: Replace JsRuntime::grab_global with JsRuntime::eval
2022-11-08 02:39:48 +01:00
Bartek Iwańczuk
0d52945d43
chore: upgrade deno_std submodule (#16546) 2022-11-06 23:41:19 +01:00
Abdul Rauf
23a04b15c1
chore(ci): update github actions (#16534) 2022-11-06 21:26:21 +05:30
Bartek Iwańczuk
e7d7da85df
fix(npm): fix CJS resolution with local node_modules dir (#16547)
This commit fixes CJS resolution when there's a local "node_modules/"
directory.

Before this commit relative imports from CJS files where resolved
relative to
root directory of the package instead of relative to referrer file.
2022-11-06 00:58:21 +01:00
sigmaSd
384e53308a
fix(upgrade): don't prompt if current version has changed (#16542)
fix https://github.com/denoland/deno/issues/16539
fix https://github.com/denoland/deno/issues/16537
2022-11-05 19:06:58 -04:00
Luca Casonato
1410e4adea
fix(ext/http): flush chunk when streaming resource (#16536)
When streaming a resource in ext/http, with compression enabled, we
didn't flush individual chunks. This became very problematic when we
enabled `req.body` from `fetch` for FastStream recently.

This commit now correctly flushes each resource chunk after compression.
2022-11-04 18:59:07 +01:00
denobot
61fbfabe44
chore: forward v1.27.1 release commit to main (#16533)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-11-04 00:40:23 +01:00
Yoshiya Hinosawa
6fe9428805
fix(runtime): fix Deno.hostname on windows (#16530) 2022-11-04 04:00:53 +09:00
Bartek Iwańczuk
dae3940519
fix(lock): add --no-lock flag to disable auto discovery of lock file (#16526) 2022-11-03 16:42:56 +01:00
Bartek Iwańczuk
a99539bd4d
fix(lock): require --unstable flag to auto discover lockfile (#16524) 2022-11-03 16:20:47 +01:00
David Sherret
77fb26e143
fix(npm): add console global for node environment (#16519)
This global is already isolated to node during type checking.

Closes #16518
2022-11-02 19:08:09 -04:00
Leo Kettmeir
5140795662
chore: update deno_doc (#16515) 2022-11-02 18:51:37 +01:00
Leo Kettmeir
32b449f891
fix(cli/dts): add typings for Change Array by copy proposal (#16499) 2022-11-02 18:07:03 +01:00
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