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

6501 commits

Author SHA1 Message Date
vwh
1711158984
fix(cli/init): broken link in deno init sample template (#24545)
This commit fixes the broken link in the sample template provided by the
deno init command.
2024-07-12 15:04:27 -04:00
David Sherret
1c41db76ac
fix: include already seen deps in lockfile dep tracking (#24556)
Tests in https://github.com/denoland/deno_graph/pull/504

Closes #24536
2024-07-12 14:48:03 -04:00
David Sherret
8ee14bd56a
refactor: move importMap with imports/scopes diagnostic to deno_config (#24553) 2024-07-12 12:48:53 -04:00
denobot
0be4c8947d
chore: forward v1.45.1 release commit to main (#24540)
This is the release commit being forwarded back to main for 1.45.1

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-07-12 01:14:14 +02:00
Nathan Whitaker
3d0e1b65b1
fix(node): Ignore broken default install scripts (#24534)
NPM inserts a default install script when a package has a `binding.gyp`
file.

It's possible, however, for the package to exclude the `binding.gyp`
file when they publish, and in this case the install script will never
succeed for a user of the package.

This happens with `fsevents`, for instance. They don't include the
`binding.gyp` file in their published tarball, but the default install
script appears in the manifest served by `npm`.

This causes us to warn that `fsevents` has an install script, but when
you try to run it it fails due to `binding.gyp` not existing.
2024-07-11 18:39:45 +00:00
David Sherret
ba63740e7f
chore: @netlify/edge-bundler workaround until Deno 2.0 (#24532)
Hack for a few months until Deno 2.0. See code for details
2024-07-11 17:43:46 +00:00
David Sherret
f950f59983
fix(npm): only warn about lifecycle scripts not being run when setting up directory (#24530)
Closes #24518
2024-07-11 16:41:42 +00:00
denobot
04ff5c731d
1.45.0 (#24512)
Bumped versions for 1.45.0

---------

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-11 00:08:02 +02:00
Leo Kettmeir
28f9485c25
chore: update deno_doc (#24509) 2024-07-10 22:46:46 +02:00
David Sherret
a49d0bd10b
fix(check): CJS types importing dual ESM/CJS package should prefer CJS types (#24492)
Closes #16370
2024-07-10 14:46:25 -04:00
David Sherret
4d2d764816
feat(jsr): support publishing jsr packages in npm workspaces (#24507)
Supports publishing an npm workspace with a directory structure similar
to the following:

- workspace
  - package.json
  - package-a
    - package.json
    - jsr.json
  - package-b
    - package.json
    - jsr.json

deno_config PR: https://github.com/denoland/deno_config/pull/77

Closes https://github.com/denoland/deno/issues/23638
2024-07-10 14:46:09 -04:00
Nathan Whitaker
69afa8718f
chore: tweak warning message for un-run install scripts (#24508)
Previously when we printed out the packages that skipped install
scripts, we didn't prefix them with `npm:`. When you pass
`--allow-scripts` though, we require `npm:`, which means you can't just
copy paste the package name from the warning message.
2024-07-10 18:03:41 +00:00
Bartek Iwańczuk
8b34c4d75b
fix: memory leak when transpiling (#24490)
This commit fixes memory leak described in
https://github.com/denoland/deno/issues/24380.

This is done by upgrading following crates:
- deno_ast
- deno_graph
- eszip
- dprint-plugin-typescript
- deno_lint
- deno_doc
- deno_emit
2024-07-10 13:51:55 +00:00
Adam Gregory
82f9216610
fix: Add sys permission kinds for node compat (#24242)
Fixes #24241

* Support "statfs", "username", "getPriority" and "setPriority" kinds
for `--allow-sys`.
* Check individual permissions in `node:os.userInfo()` instead of a
single "userInfo" permission.
* Check for "uid" permission in `node:process.geteuid()` instead of
"geteuid".
* Add missing "homedir" to `SysPermissionDescriptor.kind` union

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-10 15:15:43 +02:00
Victor Turansky
92d567d356
fix(ext/webgpu): fix GPUUncapturedErrorEvent parent type (#24369)
https://developer.mozilla.org/en-US/docs/Web/API/GPUUncapturedErrorEvent

Signed-off-by: Victor Turansky <victor.turansky@gmail.com>
2024-07-10 12:39:15 +05:30
Nathan Whitaker
ce7dc2be92
feat(node): Support executing npm package lifecycle scripts (preinstall/install/postinstall) (#24487)
Adds support for running npm package lifecycle scripts, opted into via a
new `--allow-scripts` flag.

With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno
install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run
lifecycle scripts attached to the given packages.

Note at the moment this only works when `nodeModulesDir` is true (using
the local resolver).

When a package with un-run lifecycle scripts is encountered, we emit a
warning suggesting things may not work and to try running lifecycle
scripts. Additionally, if a package script implicitly requires
`node-gyp` and it's not found on the system, we emit a warning.

Extra things in this PR:
- Extracted out bits of `task.rs` into a separate module for reuse
- Added a couple fields to `process.config` in order to support
`node-gyp` (it relies on a few variables being there)
- Drive by fix to downloading new npm packages to test registry

---

TODO:
- [x] validation for allow-scripts args (make sure it looks like an npm
package)
- [x] make allow-scripts matching smarter
- [ ] figure out what issues this closes

---
Review notes:
- This adds a bunch of deps to our test registry due to using
`node-gyp`, so it's pretty noisy
2024-07-10 03:06:08 +00:00
Asher Gomez
eb46296e97
feat: deprecate deno vendor (#22183)
This commit deprecates `deno vendor` subcommand in favor
of using `--vendor` flag or `"vendor": true` setting in the config file.

The subcommand is still available (until Deno 2) but is hidden from
the help output.

Closes #20584

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-10 03:18:10 +02:00
muddlebee
ff5163af05
feat(cli): deno init --lib (#22499)
Closes #22287

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-07-09 21:13:34 -04:00
muddlebee
9776a13e33
fix: panic when piping "deno help" or "deno --version" (#22917)
Fixes #22863

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-09 22:57:00 +00:00
HasanAlrimawi
fb6348500f
feat(compile): support --env (#24166)
Supported the use of --env flag with the compile subcommand, so that the
generated executable/binary file can access the passed env file.
2024-07-09 21:33:41 +00:00
David Sherret
43d10a558b
fix: do not download compilerOptions -> types when not type checking (#24473)
Closes https://github.com/denoland/deno/issues/22738
2024-07-09 17:07:16 -04:00
David Sherret
e5c3c21e95
feat(workspace): support object config (#24483)
This adds object config for the workspace config:

```json
{
  "workspace": {
    "members": ["./member-1", "./member-2"]
  }
}
```

This is a more verbose version of `"workspace": ["./member-1",
"./member-2"]`. Although we don't need it at the moment, it makes the
naming of `"workspace"` more clear and leaves the object open for more
config in the future.

Closes https://github.com/denoland/deno/issues/24456
2024-07-09 17:06:50 -04:00
Bartek Iwańczuk
3674f4536b
fix: restore reference to dom.extras in lib.dom.d.ts (#24489)
This was changed by mistake in #24326.

Closes https://github.com/denoland/deno/issues/24459.
2024-07-09 22:46:50 +02:00
Zebreus
3c91d597ce
fix: make .setup-cache.bin in node_modules more reproducible (#24480) 2024-07-09 18:04:21 +00:00
snek
158b4a4e02
fix: only use maglev in DENO_FUTURE for now (#24485)
let it bake for a bit before enabling by default

Signed-off-by: snek <snek@deno.com>
2024-07-09 17:26:45 +00:00
David Sherret
839caf6faf
refactor: use concrete error types for node resolution (#24470)
This will help clean up some of the code in the CLI because we'll be
able to tell how the resolution failed (not part of this PR).
2024-07-09 12:15:03 -04:00
Nayeem Rahman
0087402094
fix(lsp): do sloppy resolution for node-to-node imports in byonm (#24481) 2024-07-09 14:25:50 +01:00
Asher Gomez
77c5a336ad
docs(ext/net): explain port: 0 behavior (#24475) 2024-07-09 16:57:27 +10:00
HasanAlrimawi
c3b168f5a2
fix: add warning for invalid unstable feature use in deno.json/jsonc (#24120) 2024-07-09 01:50:47 +00:00
Nayeem Rahman
d472c48b38
fix(lsp): inherit workspace-root-only fields in members (#24440) 2024-07-08 22:31:27 +01:00
David Sherret
86010bec09
fix(workspace): better cli file argument handling (#24447)
Closes https://github.com/denoland/deno/issues/24422
2024-07-08 14:12:10 +00:00
Marvin Hagemeister
1e97f0f148
feat: add __tests__ to test file detection defaults (#24443)
The `jest` test runner popularized putting tests into a `__tests__`
folder. Whilst many have switched to going with a `.test` suffix in the
file name these days, there are still many jest projects that have
`__tests__`. By adding this to the default test detection logic it makes
`deno test` discover those out of the box.
2024-07-08 15:19:59 +02:00
Luca Casonato
74ac29bae6
fix(permissions): handle ipv6 addresses correctly (#24397)
Also don't panic on invalid domain names and addresses.

Extracted with cleanups up from #24080

Co-authored-by: Yazan AbdAl-Rahman <yazan.abdalrahman@exalt.ps>
2024-07-05 23:45:06 +01:00
David Sherret
80df9aec1d
refactor: move FileCollector to deno_config (#24433) 2024-07-05 17:53:09 -04:00
Nathan Whitaker
d4d3a3c54f
fix(node): Implement fs.lchown (and process.getegid) (#24418)
Closes https://github.com/denoland/deno/issues/21260.
Part of https://github.com/denoland/deno/issues/18218.

Implements `node:fs.lchown`, and enables the node_compat test for it.
The test uses `process.getegid`, which we didn't have implemented, so I
went ahead and implemented that as well to get the test working.
2024-07-05 18:32:51 +00:00
Divy Srivastava
233e5f6fea
chore: rename __runtime_js_source to hmr (#24442)
Saves some keystrokes and easy to remember

```
cargo b --features hmr
```
2024-07-05 17:47:53 +05:30
Bartek Iwańczuk
0bbfd6fb3d
feat: Deprecate --lock-write flag (#24436)
This commit deprecates `--lock-write` flag by removing it from
the help output and printing a warning message when it's used.

Users should use `--frozen=false` instead which was added
in https://github.com/denoland/deno/pull/24355.

Towards https://github.com/denoland/deno/issues/24167.
2024-07-05 04:38:12 +02:00
David Sherret
d91215d418
fix: revert accidentally added parentPath on DirEntry (#24438)
Reverts the accidentally added `.parentPath` on dir entries in
https://github.com/denoland/deno/pull/24257/files

This should not have been added to the public api and is not documented.
2024-07-04 20:58:30 -04:00
David Sherret
f396b3d1c8
fix(publish): unfurling should always be done with the package json (#24435)
Closes https://github.com/denoland/deno/issues/24430
2024-07-05 00:41:01 +00:00
Zander Hill
f00f0f9298
feat(jupyter): support confirm and prompt in notebooks (#23592)
Closes: https://github.com/denoland/deno/issues/22633

This commit adds support for `confirm` and `prompt` APIs,
that instead of reading from stdin are using notebook frontend
to show modal boxes and wait for answers.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-04 22:12:14 +00:00
David Sherret
147411e64b
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as
support for npm workspaces. npm workspaces is still lacking in that we
only install packages into the root node_modules folder. We'll make it
smarter over time in order for it to figure out when to add node_modules
folders within packages.

This includes a breaking change in config file resolution where we stop
searching for config files on the first found package.json unless it's
in a workspace. For the previous behaviour, the root deno.json needs to
be updated to be a workspace by adding `"workspace":
["./path-to-pkg-json-folder-goes-here"]`. See details in
https://github.com/denoland/deno_config/pull/66

Closes #24340
Closes #24159
Closes #24161
Closes #22020
Closes #18546
Closes #16106
Closes #24160
2024-07-04 00:54:33 +00:00
Nayeem Rahman
dd6d19e120
fix(lsp): correct scope attribution for injected @types/node (#24404) 2024-07-03 20:25:42 +01:00
Bartek Iwańczuk
3242e2718f
feat: Upgrade to TypeScript 5.5.2 (#24326)
This commit upgrades TypeScript to 5.5.2.

https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/
2024-07-03 16:09:54 +02:00
Nathan Whitaker
dadc606419
fix(ext/node): Add fs.lutimes / fs.lutimesSync (#23172)
Part of #18218


- Adds `fs.lutimes` and `fs.lutimesSync` to our node polyfills. To do
this I added methods to the `FileSystem` trait + ops to expose the
functionality to JS.
- Exports `fs._toUnixTimestamp`. Node exposes an internal util
`toUnixTimestamp` from the fs module to be used by unit tests (so we
need it for the unit test to pass unmodified). It's weird because it's
only supposed to be used internally but it's still publicly accessible
- Matches up error handling and timestamp handling for fs.futimes and
fs.utimes with node
- Enables the node_compat utimes test - this exercises futimes, lutimes,
and utimes.
2024-07-02 19:33:32 -07:00
HasanAlrimawi
3324d7203e
fix(compile): prevent setting unstable feature twice (#24381)
Prevent panic when enabling a feature that is already enabled by
removing duplicate features.

Closes #22015

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-07-02 23:15:10 +00:00
Bartek Iwańczuk
7d919f6fd9
refactor(jupyter): move ZeroMQ server to a separate thread (#24373)
Moves the ZeroMQ messaging server to a separate thread.

This will allow to run blocking JS code and maintain communication
with the notebook frontend.

Towards https://github.com/denoland/deno/pull/23592
Towards https://github.com/denoland/deno/pull/24250
Closes https://github.com/denoland/deno/issues/23617
2024-07-03 00:37:54 +02:00
Nathan Whitaker
c13b6d1413
feat(cli): Add --frozen flag to error out if lockfile is out of date (#24355)
Closes #18296.

Adds a `--frozen` (alias `--frozen-lockfile`) flag that errors out if
the lockfile is out of date. This is useful for running in CI (where an
out of date lockfile is usually a mistake) or to prevent accidental
changes in dependencies.

![Screenshot 2024-06-26 at 7 11
13 PM](https://github.com/denoland/deno/assets/17734409/538404b8-b422-4f05-89e8-4c9b1c248576)
2024-07-02 15:00:16 -07:00
Kenta Moriuchi
f78a60e882
feat(ext/web): add Blob.prototype.bytes() (#24148) 2024-07-02 16:04:08 +02:00
Bartek Iwańczuk
8db420d552
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24388)
Reland of https://github.com/denoland/deno/pull/24056 that doesn't
suffer from the problem that was discovered in
https://github.com/denoland/deno/pull/24261.

It uses upgraded `hyper` and `hyper-util` that fixed the previous
problem in https://github.com/hyperium/hyper/pull/3691.
2024-07-02 02:09:47 +02:00
Heyang Zhou
9c1f741112
fix(compile): atomically write compile output (#24378)
Atomically write `deno compile` output file so we won't get a partially
written ELF/PE file, and prevents corrupting running processes.
2024-07-02 06:54:17 +08:00
David Sherret
6f30ef88a2
fix(windows): check USERPROFILE env var for finding home directory (#24384) 2024-07-01 18:17:17 -04:00
Bartek Iwańczuk
b0cd43b5f3
fix(lsp): use CliLockfile (#24387)
The build broke in https://github.com/denoland/deno/pull/24365.
2024-07-01 22:14:17 +00:00
Nayeem Rahman
38a6be2e8e
fix(lsp): respect lockfile redirects entries for resolution (#24365) 2024-07-01 22:08:32 +01:00
Divy Srivastava
cd4a0072dc
BREAKING(unstable/ffi): remove callback reentrant flag (#24367)
Closes https://github.com/denoland/deno/issues/22947

This option is no longer needed as fast calls are now allowed to
re-enter the isolate
2024-07-01 09:36:33 +05:30
Nathan Whitaker
bc8a0e6e68
refactor(cli): Create wrapper around deno_lockfile::Lockfile (#24366)
As suggested in
https://github.com/denoland/deno/pull/24355#discussion_r1657875422.

I wasn't able to hide the mutex stuff as much as I'd like (ended up just
adding an escape hatch `inner()` method that locks the inner mutex),
because you can't return references to the inner fields through a mutex.

This is mostly motivated by the frozen lockfile changes
2024-06-28 17:18:21 -07:00
Nayeem Rahman
2ddae872f9
fix(lsp): don't use global cache paths for scope allocation (#24353) 2024-06-28 18:18:21 +01:00
Leo Kettmeir
ec9963570b
chore: update deno_doc (#24308) 2024-06-28 05:03:51 -07:00
Nayeem Rahman
67dcd6db51
feat(lsp): ts language service scopes (#24345) 2024-06-26 23:47:01 +01:00
Bartek Iwańczuk
2a2ff96be1
fix(ext/node): discover .npmrc in user's homedir (#24021)
This commit adds discovery of `.npmrc` files in user's homedir.

This is not a perfect fix as it doesn't merge multiple `.npmrc` files
together as per https://github.com/denoland/deno/issues/23954
but allows to fallback if no `.npmrc` file is discovered in the project
root.
2024-06-27 00:17:00 +02:00
David Sherret
0da01c0ca6
refactor: move PackageJson to deno_config (#24348) 2024-06-26 21:24:10 +00:00
David Sherret
eb283c43f5
refactor: bump deno_graph to 0.79 (#24337)
No fixes in this to my knowledge. Just an upgrade. The functionality
here will be used in a different PR.
2024-06-26 01:42:18 +00:00
Asher Gomez
c012c202af
docs(cli): remove trailing slash from import.meta.dirname expected output (#24295) 2024-06-21 15:52:46 +10:00
David Sherret
b62534dbf1
fix(task): do not propagate env changes outside subshells (#24279)
* https://github.com/denoland/deno_task_shell/pull/120
2024-06-20 00:57:53 +00:00
snek
293a36f98d
fix: more node-api fixes (#24220)
- add fallback impls of external string apis which always copy. after
upstream changes to rusty_v8 we can support non-copying api as well.
- `napi_get_buffer_data` needs to work on all TypedArray instances.
  - Fixes: https://github.com/denoland/deno/issues/24209
- `target_defaults.default_configuration` is used by some modules to
find the corresponding node file from node-gyp
- `node_api_get_module_filename` expects the filename to be a `file:`
url.
2024-06-19 11:33:46 -07:00
denobot
6c6ee02dfd
chore: forward v1.44.4 release commit to main (#24271)
This is the release commit being forwarded back to main for 1.44.4

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-06-19 20:29:53 +02:00
Bartek Iwańczuk
b94707af7d
Revert "chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)" (#24262)
This reverts commit fb31eaa9ca.

Reverting because users reported spurious errors when downloading
dependencies - https://github.com/denoland/deno/issues/24260.

Closes https://github.com/denoland/deno/issues/24260
2024-06-19 16:09:17 +02:00
Divy Srivastava
8dd7beb7c6
fix(ext/node): Add SIGPOLL and SIGUNUSED signals (#24259) 2024-06-19 13:41:09 +05:30
Divy Srivastava
209b286813
fix(ext/node): Add Dirent.path and Dirent.parentPath (#24257) 2024-06-19 12:51:01 +05:30
denobot
1d6b775f81
chore: forward v1.44.3 release commit to main (#24256)
This is the release commit being forwarded back to main for 1.44.3

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-06-19 03:17:32 +02:00
Nayeem Rahman
810474d8b7
fix(lsp): use import map from workspace root (#24246)
Follow up to #24206 which broke deno_std intellisense.
2024-06-19 00:00:17 +02:00
safaa-mojahed
4b83ce8aca
fix(repl): prevent panic when deleting globalThis.closed property (#24014) 2024-06-17 21:34:25 -04:00
Nayeem Rahman
5dec3fd4b7
feat(lsp): multi deno.json resolver scopes (#24206) 2024-06-17 21:54:23 +01:00
Leo Kettmeir
341913319c
fix(docs): correctly resolve href for built-ins (#24228) 2024-06-17 16:06:05 +02:00
Satya Rohith
0f48313565
chore: upgrade to rust 1.79 (#24207) 2024-06-14 17:10:57 +05:30
Nathan Whitaker
368eb9073b
fix(napi): Read reference ownership before calling finalizer to avoid crash (#24203)
Fixes #23493.

What was happening here was that napi-rs was freeing the napi reference
([here](19e3488efc/crates/napi/src/bindgen_runtime/mod.rs (L62)))
during its finalize callback (which we call
[here](fb31eaa9ca/cli/napi/js_native_api.rs (L132))).
We then were [reading the `ownership`
field](fb31eaa9ca/cli/napi/js_native_api.rs (L136))
of that freed reference.

For some reason on arm macs the freed memory gets zeroed, so the value
of `ownership` was `0` when we read it (i.e. it was
`ReferenceOwnership::Runtime`). We then freed it again (since we thought
we owned it), causing the segfault.
2024-06-13 22:31:42 +00:00
David Sherret
4ec9250c40
fix(npm): use more relaxed package.json version constraint parsing (#24202) 2024-06-13 18:29:27 -04:00
Bartek Iwańczuk
fb31eaa9ca
chore: upgrade to reqwest 0.12.4 and rustls 0.22 (#24056)
This commit updates Deno to use `reqwest` at 0.12.4
and `rustls` at 0.22. Other related crates were updated
as well to match versions accepted by `reqwest` and `rustls`.

Note: we are not using the latest available `rustls` yet,
but this upgrade was non-trivial already, so a bump to
0.23 for `rustls` will be done in a separate commit.

Closes #23370

---------

Signed-off-by: Ryan Dahl <ry@tinyclouds.org>
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-13 22:41:26 +02:00
Nayeem Rahman
518e4d3b3a
perf(lsp): store settings in Arc (#24191) 2024-06-13 20:57:14 +01:00
snek
8ad25e86da
fix: node-api get_value_string_utf8 should use utf8_length (#24193)
whoops. also did a drive-by cleanup of `isolate` usage since i noticed
it while using `utf8_length(isolate)`
2024-06-12 21:39:20 -07:00
denobot
efb2085b61
chore: forward v1.44.2 release commit to main (#24194)
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-06-13 01:57:22 +00:00
Nathan Whitaker
a7531361ef
fix(cli): Explicitly cache NPM packages during deno install (#24190)
Fixes a regression introduced in
https://github.com/denoland/deno/pull/24170, where we wouldn't actually
set up the node modules dir on `deno install` if there was an up to date
deno lockfile present.

Previously we were relying on the fact that resolving pending module
resolution called `cache_packages` (which sets up the node modules dir).
When pending resolutions were removed, and the `resolve_pending`
function with it, we also removed the `cache_packages` call needed to
set up node modules.
2024-06-12 16:06:41 -07:00
Nayeem Rahman
b30e5c0985
fix(lsp): strip .js before probing for valid import fix (#24188) 2024-06-12 22:22:57 +01:00
Nayeem Rahman
85e9a790c9
feat(lsp): respect editor indentation options (#24181) 2024-06-12 17:41:01 +01:00
Divy Srivastava
05ec50672d
chore: remove dead code (#24185) 2024-06-12 10:13:03 -04:00
snek
3765e6b3a6
fix: clean up some node-api details (#24178)
- fix a few napi_* types
- clean up env hooks
- implement blocking queue in tsfn
- reduce transmutes
- use new `DataView::new` api from rusty_v8
2024-06-11 17:40:44 -07:00
Nayeem Rahman
3b9eeba02c
fix(lsp): don't sort workspace files (#24180) 2024-06-11 21:06:43 +01:00
Nayeem Rahman
0c199acb88
refactor(lsp): collect npm reqs by scope (#24172) 2024-06-11 18:14:36 +01:00
David Sherret
4bc96c5d2a
fix(npm): resolve dynamic npm imports individually (#24170)
* https://github.com/denoland/deno_npm/pull/57
* https://github.com/denoland/deno_graph/pull/498

Closes https://github.com/denoland/deno/issues/17802
2024-06-11 08:55:12 -04:00
David Sherret
d74be0842a
FUTURE: support deno install <alias>@npm:<package> (#24156)
Closes #23144
2024-06-10 23:56:43 +00:00
Nathan Whitaker
7996c0df92
fix(jupyter): Avoid panicking when DEBUG env var is set (#24168)
Fixes #22050.

It seems very unlikely that a user would be intending to enable deno's
internal debug logs by setting the DEBUG env var. If they really want
that, they can set `RUST_LOG=debug` instead.
2024-06-10 22:36:39 +00:00
snek
e3b2ee183b
fix: Rewrite Node-API (#24101)
Phase 1 node-api rewrite
2024-06-10 16:20:44 +00:00
Nayeem Rahman
7c5dbd5d54
feat(lsp): workspace jsr resolution (#24121) 2024-06-10 17:03:17 +01:00
David Sherret
31154ff958
fix(check): attempt to resolve types from pkg before @types pkg (#24152)
I've been meaning to fix this for ages, but I finally ran into it here:


https://github.com/dsherret/ts-ast-viewer/actions/runs/9432038675/job/25981325408

We need to resolve the `@types` package as a fallback instead of eagerly
resolving it.
2024-06-08 20:05:28 -04:00
Luca Casonato
c1f23c5788
fix(ext/node): lossy UTF-8 read node_modules files (#24140)
Previously various reads of files in `node_modules` would error on
invalid UTF-8. These were cases involving:

- reading package.json from Rust
- reading package.json from JS
- reading CommonJS files from JS
- reading CommonJS files from Rust (for ESM translation)
- reading ESM files from Rust
2024-06-08 18:36:13 +02:00
David Sherret
ed20102713
fix: make writing to the deps cache more reliable (#24135)
I was able to reproduce this locally.

```
[error] Failed to execute snippet: 
import { validate } from "@std/uuid";
import { assert, assertFalse } from "@std/assert";

assert(validate("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"));
assertFalse(validate("not a UUID"));
Download https://jsr.io/@std/uuid/meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1_meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/common.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/constants.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v1.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v3.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v4.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v5.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/_common.ts
error: Access is denied. (os error 5) (for 'V:\.cache\deno\deps\https\jsr.io\2ae5bb614c7526d0876be0b76da1372fd51304ae27d6202ee94df720b3523d08')
 at file:///V:/deno_std/uuid/common.ts:43
[error] Failed to execute snippet:
import { v5, NAMESPACE_DNS, NIL_UUID } from "@std/uuid";
import { assert, assertFalse } from "@std/assert";

const data = new TextEncoder().encode("deno.land");
const uuid = await v5.generate(NAMESPACE_DNS, data);

assert(v5.validate(uuid));
assertFalse(v5.validate(NIL_UUID));
Download https://jsr.io/@std/uuid/meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1_meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/common.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/constants.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v1.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v3.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v4.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v5.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/_common.ts
error: Access is denied. (os error 5) (for 'V:\.cache\deno\deps\https\jsr.io\63dd818c5fc1ac39c04df9b42bd9dd4bbc07f7d1b174e405d003731125778da1')
    at https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts:30:15
 at file:///V:/deno_std/uuid/mod.ts:4
[error] Failed to execute snippet:
import { isNil } from "@std/uuid";
import { assert, assertFalse } from "@std/assert";

assert(isNil("00000000-0000-0000-0000-000000000000"));
assertFalse(isNil(crypto.randomUUID()));
Download https://jsr.io/@std/uuid/meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1_meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/common.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/constants.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v1.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v3.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v4.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v5.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/_common.ts
error: Access is denied. (os error 5) (for 'V:\.cache\deno\deps\https\jsr.io\fd3a12fc091d16ee29f10fa7a05eeeb8bd6c3cc014642e72478c757f00e7261e')
    at https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts:34:40
 at file:///V:/deno_std/uuid/common.ts:23
[error] Failed to execute snippet:
import { version } from "@std/uuid";
import { assertEquals } from "@std/assert/assert-equals";

assertEquals(version("d9428888-122b-11e1-b85c-61cd3cbb3210"), 1);
assertEquals(version("6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b"), 4);
Download https://jsr.io/@std/uuid/meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1_meta.json
Download https://jsr.io/@std/uuid/1.0.0-rc.1/mod.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/common.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/constants.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v1.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v3.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v4.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/v5.ts
Download https://jsr.io/@std/uuid/1.0.0-rc.1/_common.ts
error: Access is denied. (os error 5) (for 'V:\.cache\deno\deps\https\jsr.io\2ae5bb614c7526d0876be0b76da1372fd51304ae27d6202ee94df720b3523d08')
 at file:///V:/deno_std/uuid/common.ts:66
4 errors found
```

It occurs when many Deno processes are writing to the deps cache at the
same time. Fix is to use `atomic_write_with_retries` which is much more
reliable (and the function that helped make the ecosystem tests more
reliable too). After this change I no longer have this issue.

Closes https://github.com/denoland/deno/issues/24073
2024-06-07 13:06:17 -04:00
David Sherret
78774dd664
fix: do not panic linting files with UTF-8 BOM (#24136)
Closes #24122
2024-06-07 17:02:47 +00:00
David Sherret
386d5c8310
refactor: remove PermissionsContainer in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.

My guess is this is also a perf improvement because Deno is doing less
work.
2024-06-06 23:37:53 -04:00
David Sherret
7a17eba5a7
refactor: NpmRegistryApi - #[async_trait(?Send)] (#24126) 2024-06-06 22:37:41 +00:00
Nathan Whitaker
47d19461a5
fix(cli): Overwrite existing bin entries in node_modules (#24123)
Previously we warned on unix and didn't touch them on windows, now we
unconditionally overwrite them. This matches what npm does.
2024-06-06 21:21:25 +00:00
denobot
4d531bf229
chore: forward v1.44.1 release commit to main (#24115)
This is the release commit being forwarded back to main for 1.44.1

Co-authored-by: devsnek <devsnek@users.noreply.github.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-06-06 03:23:10 +00:00
David Sherret
566adb7c0a
fix(npm): use configured auth for tarball urls instead of scope auth (#24111)
Deno was using the scope auth for the tarball urls, which is not always
correct. We are going to do a release immediately for this issue.
2024-06-05 21:24:52 +00:00
Bartek Iwańczuk
0db73f6333
fix: update deno_npm (#24065) 2024-06-05 19:22:40 +00:00
David Sherret
a013b9113d
fix: support importing statically unanalyzable npm specifiers (#24107)
Closes https://github.com/denoland/deno/issues/20479
Closes https://github.com/denoland/deno/issues/18744
2024-06-05 15:18:06 -04:00
David Sherret
1b355d8a87
refactor(npm): improve locking around updating npm resolution (#24104)
Introduces a `SyncReadAsyncWriteLock` to make it harder to write to the
npm resolution without first waiting async in a queue. For the npm
resolution, reading synchronously is fine, but when updating, someone
should wait async, clone the data, then write the data at the end back.
2024-06-05 15:17:35 -04:00
David Sherret
7ed90a20d0
fix: better handling of npm resolution occurring on workers (#24094)
Closes https://github.com/denoland/deno/issues/24063
2024-06-05 17:04:16 +02:00
Bartek Iwańczuk
eb218c0f33
chore: upgrade dlint to 0.60.0 (#24041)
Factoring out `dlint` upgrade from
https://github.com/denoland/deno/pull/24034 as it
requires us to change the lint step on mac to use ARM runners.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2024-06-05 01:09:29 +02:00
Igor Zinkovsky
32f655db54
fix(docs): update Deno.Command docs (#24097) 2024-06-04 12:19:42 -07:00
Andreas Kohn
92c881faa7
docs(console): More clearly indicate the contents of DENO_CERT (#24091)
The PEM file specified by DENO_CERT can contain multiple certificates
13924fdb1b/cli/args/mod.rs (L722-L742)

Signed-off-by: Andreas Kohn <andreas.kohn@gmail.com>
2024-06-04 11:50:50 -04:00
David Sherret
3341c50b6a
refactor: don't share reqwest::HttpClient across tokio runtimes (#24092)
This also fixes several issues where we weren't properly creating http
clients with the user's settings.
2024-06-03 21:17:08 +00:00
Nayeem Rahman
72088f2f52
fix(lsp): complete exports for import mapped jsr specifiers (#24054) 2024-06-03 21:32:28 +01:00
David Sherret
b1f776adef
refactor: extract structs for downloading tarballs and npm registry packuments (#24067) 2024-06-03 01:39:13 +00:00
Kenta Moriuchi
eda43c46de
fix: validate integer values in Deno.exitCode setter (#24068) 2024-06-02 21:29:01 -04:00
David Sherret
38ff9faff6
fix: retry writing lockfile on failure (#24052)
Ran into this running the deno_graph ecosystem tests where many
processes writing to the same path at the same time would cause an
error.
2024-05-31 23:25:08 -04:00
denobot
9e2971d40f
1.44.0 (#24045)
Bumped versions for 1.44.0

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-05-30 04:49:23 +00:00
David Sherret
2d3b596cf5
feat: do not require DENO_FUTURE=1 for npmrc support (#24043) 2024-05-30 04:07:57 +00:00
Nayeem Rahman
556012320e
feat(lsp): support .npmrc (#24042)
Closes #24040
2024-05-30 03:16:15 +00:00
Aapo Alasuutari
d67ee9a08b
BREAKING(ffi/unstable): use BigInt representation in turbocall (#23983)
Built ontop of #23981, this sets FFI
turbocalls (Fast Call API) to use the BigInt representation.
2024-05-30 08:00:11 +05:30
Nathan Whitaker
a379009bfd
fix(cli): Prefer npm bin entries provided by packages closer to the root (#24024)
Fixes #24012.

In the case of multiple packages providing a binary with a same name, we
were basically leaving the results undefined (since we set up things in
parallel, and whichever got set up first won). In addition, we were
warning about these cases, even though it's a situation that's expected
to occur.

Instead, in the case of a collision in the binary names, we prefer the
binary provided by the package with the least depth in the dependency
tree.

While I was at it, I also took moved more code to `bin_entries.rs` since
it was starting to get a bit cluttered.
2024-05-29 17:45:22 -07:00
Luca Casonato
e084fe10a9
feat(lint): add no-boolean-literal-for-arguments rule and enable no-unused-vars for jsx files (#24034)
* https://github.com/denoland/deno_lint/pull/1271
* https://github.com/denoland/deno_lint/pull/1277

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-30 00:09:16 +00:00
Luke Edwards
13723f267e
feat: Add Deno.exitCode API (#23609)
This commits adds the ability to set a would-be exit code 
for the Deno process without forcing an immediate exit, 
through the new `Deno.exitCode` API.

- **Implements `Deno.exitCode` getter and setter**: Adds support for
setting
and retrieving a would-be exit code via `Deno.exitCode`.
This allows for asynchronous cleanup before process termination 
without immediately exiting.
- **Ensures type safety**: The setter for `Deno.exitCode` validates that
the provided value is a number, throwing a TypeError if not, to ensure
that
only valid exit codes are set.

Closes to #23605

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 23:16:27 +00:00
Kyle Kelley
cf611fbf54
chore: upgrade jupyter runtimelib to 0.11.0 (#24036)
Brings in:

* More fully typed structures (for when we get to implementing more)
* `with_metadata`, `with_buffers`, etc. from
https://github.com/runtimed/runtimed/pull/99

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-29 22:46:47 +00:00
Nayeem Rahman
3d3722507e
perf(repl): don't walk workspace in repl language server (#24037) 2024-05-29 21:31:09 +01:00
Marvin Hagemeister
3c3076a84c
fix(task): always use npm for npm run with flags (#24028) 2024-05-29 20:16:35 +00:00
David Sherret
814ac9a75d
perf: avoid building module graph if dynamic specifier already in graph (#24035) 2024-05-29 14:59:35 -04:00
David Sherret
94f040ac28
fix: bump cache sqlite dbs to v2 for WAL journal mode change (#24030)
In https://github.com/denoland/deno/pull/23955 we changed the sqlite db
journal mode to WAL. This causes issues when someone is running an old
version of Deno using TRUNCATE and a new version because the two fight
against each other.
2024-05-29 18:38:18 +00:00
Nayeem Rahman
fada25b0dd
fix(lsp): don't discover deno.json in vendor dir (#24032) 2024-05-29 18:08:54 +01:00
David Sherret
a8923534ed
chore: set lockfile as having no content changes after write (#24023)
Slight perf regression when updating deno_lockfile in
https://github.com/denoland/deno/pull/23979
2024-05-28 23:40:40 -04:00
Nayeem Rahman
14a74600de
perf(lsp): lock out requests until init is complete (#23998) 2024-05-29 01:26:43 +01:00
Nathan Whitaker
2024c974b6
perf(cli): Improve concurrency when setting up node_modules and loading cached npm package info (#24018)
The same issue in two different places - doing blocking FS work in an
async task, limiting the amount of work that happens concurrently.

- When setting up node_modules, where we try to set up entries
concurrently but were blocking other tasks from actually running.
- When loading package info from the npm registry file cache, loading
and deserializing is expensive and prevents concurrency. This was
especially noticeable when loading an npm resolution snapshot from a
lockfile (`snapshot_from_lockfile` in `deno_npm`).

Installing deps in `deno-docs`:

```
❯ hyperfine -i -p 'rm -rf node_modules/' '../d7/deno-main i' '../d7/target/release/deno i'
Benchmark 1: ../d7/deno-main i
  Time (mean ± σ):      2.193 s ±  0.027 s    [User: 0.589 s, System: 1.033 s]
  Range (min … max):    2.151 s …  2.242 s    10 runs

Benchmark 2: ../d7/target/release/deno i
  Time (mean ± σ):      1.597 s ±  0.021 s    [User: 0.977 s, System: 1.337 s]
  Range (min … max):    1.550 s …  1.627 s    10 runs

Summary
  ../d7/target/release/deno i ran
    1.37 ± 0.02 times faster than ../d7/deno-main i
```

Caching `npm:@11ty/eleventy`:
```
❯ hyperfine -i -p 'rm -rf node_modules/' --warmup 5 '../../d7/deno-main cache npm:@11ty/eleventy' '../../d7/target/release/deno cache npm:@11ty/eleventy'
Benchmark 1: ../../d7/deno-main cache npm:@11ty/eleventy
  Time (mean ± σ):     129.9 ms ±   2.2 ms    [User: 27.5 ms, System: 101.3 ms]
  Range (min … max):   127.5 ms … 135.8 ms    10 runs

Benchmark 2: ../../d7/target/release/deno cache npm:@11ty/eleventy
  Time (mean ± σ):     100.6 ms ±   1.3 ms    [User: 38.8 ms, System: 233.8 ms]
  Range (min … max):    99.3 ms … 103.2 ms    10 runs

Summary
  ../../d7/target/release/deno cache npm:@11ty/eleventy ran
    1.29 ± 0.03 times faster than ../../d7/deno-main cache npm:@11ty/eleventy
```

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-28 21:17:36 +00:00
David Sherret
69da5d8290
perf: skip npm install if graph has no new packages (#24017) 2024-05-28 16:24:07 -04:00
David Sherret
57617af16a
perf: parse source files in parallel (#23858) 2024-05-28 16:23:11 -04:00
Nathan Whitaker
3e8f29ae41
perf(cli): Optimize setting up node_modules on macOS (#23980)
Hard linking (`linkat`) is ridiculously slow on mac. `copyfile` is
better, but what's even faster is `clonefile`. It doesn't have the space
savings that comes with hardlinking, but the performance difference is
worth it imo.

```
❯ hyperfine -i -p 'rm -rf node_modules/' '../../d7/target/release/deno cache npm:@11ty/eleventy' 'deno cache npm:@11ty/eleventy'
Benchmark 1: ../../d7/target/release/deno cache npm:@11ty/eleventy
  Time (mean ± σ):     115.4 ms ±   1.2 ms    [User: 27.2 ms, System: 87.3 ms]
  Range (min … max):   113.7 ms … 117.5 ms    10 runs

Benchmark 2: deno cache npm:@11ty/eleventy
  Time (mean ± σ):     619.3 ms ±   6.4 ms    [User: 34.3 ms, System: 575.6 ms]
  Range (min … max):   612.2 ms … 633.3 ms    10 runs

Summary
  ../../d7/target/release/deno cache npm:@11ty/eleventy ran
    5.37 ± 0.08 times faster than deno cache npm:@11ty/eleventy
```
2024-05-28 11:59:17 -07:00
David Sherret
448fe67b7a
feat(vendor): support modifying remote files in vendor folder without checksum errors (#23979)
Includes:

* https://github.com/denoland/deno_graph/pull/486
* https://github.com/denoland/deno_graph/pull/488
* https://github.com/denoland/deno_lockfile/pull/25
* https://github.com/denoland/deno_lockfile/pull/22
* https://github.com/denoland/deno_graph/pull/483
* https://github.com/denoland/deno_graph/pull/470
2024-05-28 14:58:43 -04:00
Yoshiya Hinosawa
8b5089e41f
fix(coverage): do not generate script coverage with empty url (#24007)
closes #24004
2024-05-28 23:01:32 +09:00
Hajime-san
9aa593cd5d
fix(cli/test): decoding percent-encoding(non-ASCII) file path correctly (#23200)
# Summary

This PR resolves about the issue.
fixes #10810

And the formerly context is in the PR. 
#22582

Here is an expected behaviour example with this change.

- 🦕.test.ts
```ts
import { assertEquals } from "https://deno.land/std@0.215.0/assert/mod.ts";

Deno.test("example test", () => {
  assertEquals("🍋", "🦕");
});
```
2024-05-28 13:34:57 +00:00
Mike Mulchrone
dc5c799c39
fix(deno_task): more descriptive error message (#24001)
Signed-off-by: Mike Mulchrone <mikemulchrone987@gmail.com>
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-05-28 13:33:08 +00:00
Asher Gomez
adbd564758
FUTURE(ext/ffi,ext/webgpu): stabilize FFI and WebGPU APIs (#24011)
Closes #23906
2024-05-28 11:37:43 +00:00
Yoshiya Hinosawa
e9cc8a2b53
fix(coverage): skip generating coverage json for http(s) scripts (#24008)
closes #21784
2024-05-28 20:25:46 +09:00
Divy Srivastava
53606de634
BREAKING(ffi/unstable): always return u64 as bigint (#23981)
The mixed `number | bigint` representation was useful optimization for
pointers. Now, pointers are represented as V8 externals. As part of the
FFI stabilization effort we want to make `bigint` the only
representation for `u64` and `i64`.

BigInt representation performance is almost on par with mixed
representation with the added benefit that its less confusing and users
don't need manual checks and conversions for doing operations on the
value.

```
cpu: AMD Ryzen 5 7530U with Radeon Graphics
runtime: deno 1.43.6+92a8d09 (x86_64-unknown-linux-gnu)

file:///home/divy/gh/ffi/main.ts
benchmark                 time (avg)        iter/s             (min … max)       p75       p99      p995
-------------------------------------------------------------------------- -----------------------------
nop                        4.01 ns/iter 249,533,690.5     (3.97 ns … 10.8 ns) 3.97 ns 4.36 ns 9.03 ns
ret bigint                 7.74 ns/iter 129,127,186.8    (7.72 ns … 10.46 ns) 7.72 ns 8.11 ns 8.82 ns
ret i32                    7.81 ns/iter 128,087,100.5    (7.77 ns … 12.72 ns) 7.78 ns 8.57 ns 9.75 ns
ret bigint (add op)       15.02 ns/iter  66,588,253.2   (14.64 ns … 24.99 ns) 14.76 ns 19.13 ns 19.44 ns
ret i32    (add op)       12.02 ns/iter  83,209,131.8   (11.95 ns … 18.18 ns) 11.98 ns 13.11 ns 14.5 ns
```
2024-05-28 09:31:09 +05:30
Yoshiya Hinosawa
d99c6c1ea4
fix(coverage): handle ignore patterns (#23974)
closes #23972
2024-05-28 12:37:30 +09:00
David Sherret
c4211e2ffc
fix(publish): raise diagnostics for triple-slash directives for --dry-run instead of just publish (#23811) 2024-05-28 01:35:08 +00:00
Bartek Iwańczuk
1667e28a15
FUTURE(ext/fs): stabilize file system APIs (#23968)
Closes https://github.com/denoland/deno/issues/23906

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-05-27 23:43:07 +00:00
Hasan-Alrimawi
e44c538f37
fix: --env flag confusing message on syntax error (#23915)
Enhanced warning message for --env flag with run and eval subcommands. 

The commit is specifically made to address issue #23674 by improving the
warning messages that appear when using the --env flag with run or eval
subcommands in the following scenarios:

1. Missing environment file.
2. Incorrect syntax in the environment file content.


**Changes made**

- Distinguishes between cases of missing environment file and wrong
syntax in the environment file content.
- Shows a concise warning message to convey the case/issue occurred.

**Code changes & enhancements**
- Implemented a match statement to handle different types of errors
received while getting and parsing the file content to display a concise
warning message, rather than simple error check and then displaying the
same warning message for whatever the type of error is.
- Updated the related existing tests to reflect the new warning
messages.
- Added two test cases to cover the wrong environment file content
syntax with both run and eval subcommands.

**Impact**
The use of --env flag with both run/eval would be more user-friendly as
it gives a precise description of what is not right when using
incorrectly.

If you could give it a look, @dsherret , I appreciate your feedback on
these changes.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-27 15:06:18 +02:00
Alex Gleason
f8975a8ecb
fix(ext/websocket): change default idleTimeout to 30s (#23985)
Change the default server websocket `idleTimeout` to 30s to work with common Nginx setups which have a default timeout of 60 seconds
2024-05-26 10:46:05 +05:30
Yoshiya Hinosawa
0ef1c774f6
fix(coverage): add tooltip to line count in html report (#23971)
closes #21582
2024-05-26 13:22:57 +09:00
Divy Srivastava
16ed81f62c
chore(cli): remove extract_standalone path from CLI (#23982)
No longer needed as standalone binaries use `denort`
2024-05-26 09:43:20 +05:30
David Sherret
b21004b1d1
fix: use hash of in-memory bytes only for code cache (#23966)
* https://github.com/denoland/deno_core/pull/752
* https://github.com/denoland/deno_core/pull/753

Did benchmarking on this and it's slightly faster (couple ms) or equal
to in performance as main.

Closes #23904
2024-05-24 10:15:46 -04:00
Bartek Iwańczuk
92a8d09e49
fix(npm): set up node_modules/.bin/ entries for package that provide bin entrypoints (#23496)
Closes https://github.com/denoland/deno/issues/23036

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-23 23:43:38 +00:00
Bartek Iwańczuk
959739f609
FUTURE: initial support for .npmrc file (#23560)
This commit adds initial support for ".npmrc" files.

Currently we only discover ".npmrc" files next to "package.json" files
and discovering these files in user home dir is left for a follow up.

This pass supports "_authToken" and "_auth" configuration
for providing authentication.

LSP support has been left for a follow up PR.

Towards https://github.com/denoland/deno/issues/16105
2024-05-23 23:26:23 +02:00
Nathan Whitaker
5de30c5323
fix(cli): Support deno.lock with only package.json present + fix DENO_FUTURE install interactions with lockfile (#23918)
Fixes #23571.

Previously, we required a `deno.json` to be present (or the `--lock`
flag) in order for us to resolve a `deno.lock` file. This meant that if
you were using deno in an npm-first project deno wouldn't use a
lockfile.

Additionally, while I was fixing that, I discovered there were a couple
bugs keeping the future `install` command from using a lockfile.

With this PR, `install` will actually resolve the lockfile (or create
one if not present), and update it if it's not up-to-date. This also
speeds up `deno install`, as we can use the lockfile to skip work during
npm resolution.
2024-05-23 12:31:05 -07:00
Nayeem Rahman
0a30897925
refactor(lsp): determine file referrer for each document (#23867) 2024-05-23 17:31:56 +01:00
David Sherret
143ea4759f
feat(task): run npm run commands with Deno more often (#23794)
Closes #23036
2024-05-23 15:39:48 +00:00
Felipe Baltor
fa1ba256d2
refactor: remove custom utc_now in favor of chrono::Utc:now feature (#23888)
This PR removes the use of the custom `utc_now` function in favor of the
`chrono` implementation. It resolves #22864.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 13:59:11 +02:00
Bert Belder
de5b47b13c
perf(startup): use WAL journal for sqlite databases in DENO_DIR (#23955)
While investigating poor cold start performance on my GCP VM (32 cores,
130GB SSD), I found that writing to the various sqlite databases in
DENO_DIR was quite slow. The slowness seems to primarily be caused by
excessive latency from a number of `fsync()` calls.

The performance difference is best demonstrated by deleting the sqlite
databases from DENO_DIR while leaving the downloaded sources in place.

The benchmark (see notes below):

```
piscisaureus@bert-us:~/erofs/source$ export DENO_DIR=./.deno
piscisaureus@bert-us:~/erofs/source$ hyperfine --warmup 3   \
  --prepare "rm -rf .deno/*_v1*"                            \
  "deno run -A --cached-only demo.ts"                       \
  "eatmydata deno run -A --cached-only demo.ts"             \
  "~/deno/target/release/deno run -A --cached-only demo.ts"
Benchmark 1: deno run -A --cached-only demo.ts
  Time (mean ± σ):      1.174 s ±  0.037 s    [User: 0.153 s, System: 0.184 s]
  Range (min … max):    1.104 s …  1.212 s    10 runs
 
Benchmark 2: eatmydata deno run -A --cached-only demo.ts
  Time (mean ± σ):     265.5 ms ±   3.6 ms    [User: 138.5 ms, System: 135.1 ms]
  Range (min … max):   260.6 ms … 271.2 ms    11 runs
 
Benchmark 3: ~/deno/target/release/deno run -A --cached-only demo.ts
  Time (mean ± σ):     226.2 ms ±   9.2 ms    [User: 136.7 ms, System: 93.3 ms]
  Range (min … max):   218.8 ms … 247.1 ms    13 runs
 
Summary
  ~/deno/target/release/deno run -A --cached-only demo.ts ran
    1.17 ± 0.05 times faster than eatmydata deno run -A --cached-only demo.ts
    5.19 ± 0.27 times faster than deno run -A --cached-only demo.ts
```

Notes:
* Benchmark 1: unmodified Deno 1.43.6
* Benchmark 2: unmodified Deno 1.43.6 wrapped with `eatmydata` (which is
a tool to neuter `fsync()` calls)
* Benchmark 3: this PR applied on top of Deno 1.43.6


The script that got benchmarked:

```typescript
// demo.ts
import * as express from "npm:express@4.16.3";
import * as postgres from "https://deno.land/x/postgres/mod.ts";

let _dummy = [express, postgres]; // Force use of imports.
console.log("hello world");
```
2024-05-23 00:33:47 -04:00
Asher Gomez
71375491d1
feat(cli/test): deno test --clean (#23519)
The result of the call is ignored as it throws even when the directory
does not exist.

Closes #23491
2024-05-23 03:04:12 +00:00
Asher Gomez
8a636d0600
feat(ext/fetch): Request.bytes() and Response.bytes() (#23823)
Closes #23790
2024-05-23 00:27:58 +00:00
David Sherret
f5d0c4b1ea
feat: add lowercase -v version flag (#23750)
Ref https://github.com/denoland/deno/issues/5289
2024-05-23 00:20:20 +00:00
Asher Gomez
4908d45758
feat(ext/fs): stabilize Deno.FsFile.unlock[Sync]() and Deno.FsFile.lock[Sync]() (#23754)
Related #22230
CC @dyedgreen
2024-05-23 09:17:00 +10:00
Luca Casonato
971f09abe4
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users
tampering with the global `Object` prototype.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-23 00:03:35 +02:00
Asher Gomez
6c167c64d6
feat(ext/fs): stabilize Deno.FsFile.syncData[Sync]() and Deno.FsFile.sync[Sync]() (#23733)
Closes #22230
2024-05-22 21:59:51 +00:00
Hajime-san
cbddf468e3
fix(lsp): process Fenced Code Block in JSDoc on completion correctly (#23822)
partially fixing https://github.com/denoland/deno/issues/23820


https://github.com/denoland/deno/assets/41257923/0adb5d4e-cfd5-4195-9045-19d1c0a07a43

BTW, it is out of scope on this PR that to process type of `@param` to
be an code block due to it's a bit complicated.
2024-05-22 12:00:14 -07:00
Matt Mastracci
596a2996cf
feat(cli): Add slow test warning (#23874)
By default, uses a 60 second timeout, backing off 2x each time (can be
overridden using the hidden `DENO_SLOW_TEST_TIMEOUT` which we implement
only really for spec testing.

```
Deno.test(async function test() {
  await new Promise(r => setTimeout(r, 130_000));
});
```

```
$ target/debug/deno test /tmp/test_slow.ts 
Check file:///tmp/test_slow.ts
running 1 test from ../../../../../../tmp/test_slow.ts
test ...'test' is running very slowly (1m0s)
'test' is running very slowly (2m0s)
 ok (2m10s)

ok | 1 passed | 0 failed (2m10s)
```

---------

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-22 08:08:27 -06:00
Leo Kettmeir
7ab7a14db7
refactor(docs): use @experimental instead of @tags unstable (#23884) 2024-05-22 04:31:51 -07:00
Bartek Iwańczuk
fabd9a214b
chore: forward v1.43.6 release commit to main (#23936)
Bumped versions for 1.43.6

Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-22 01:35:04 +00:00
Nathan Whitaker
db82e8b557
fix(lsp): Fix display of JSDoc named examples (#23927)
We were wrapping the display string in an unnecessary pair of triple
backticks, breaking highlighting

Before:
![Screenshot 2024-05-21 at 12 16
12 PM](https://github.com/denoland/deno/assets/17734409/1cf5a3ce-56dd-443d-9d1a-bd33625ff1f2)

After:
![Screenshot 2024-05-21 at 12 16
36 PM](https://github.com/denoland/deno/assets/17734409/646c4c48-9b5a-4326-bb95-b1374627d969)
2024-05-21 14:04:19 -07:00
Kyle Kelley
8698e80304
refactor(jupyter): use runtimelib for Jupyter structures and directory paths (#23826)
This brings in [`runtimelib`](https://github.com/runtimed/runtimed) to
use:

## Fully typed structs for Jupyter Messages

```rust
let msg = connection.read().await?;

self
  .send_iopub(
    runtimelib::Status::busy().as_child_of(msg),
  )
  .await?;
```

## Jupyter paths

Jupyter paths are implemented in Rust, allowing the Deno kernel to be
installed completely via Deno without a requirement on Python or
Jupyter. Deno users will be able to install and use the kernel with just
VS Code or other editors that support Jupyter.

```rust
pub fn status() -> Result<(), AnyError> {
  let user_data_dir = user_data_dir()?;

  let kernel_spec_dir_path = user_data_dir.join("kernels").join("deno");
  let kernel_spec_path = kernel_spec_dir_path.join("kernel.json");

  if kernel_spec_path.exists() {
    log::info!(" Deno kernel already installed");
    Ok(())
  } else {
    log::warn!("ℹ️ Deno kernel is not yet installed, run `deno jupyter --install` to set it up");
    Ok(())
  }
}
```

Closes https://github.com/denoland/deno/issues/21619
2024-05-21 22:35:21 +02:00
Nayeem Rahman
cc8c0609eb
fix(lsp): apply import fix to missing declaration code action (#23924) 2024-05-21 21:15:16 +01:00
David Sherret
ddb5449f42
chore: add test to ensure parsing only happens once on first load (#23837) 2024-05-21 16:12:40 -04:00
David Sherret
9795637724
fix(task): do not error if node_modules folder not exists (#23920)
Revealed https://github.com/denoland/deno/issues/23919

Closes #23914
2024-05-21 16:12:14 -04:00
Nayeem Rahman
a5111fbc4d
fix(cli): use CliNodeResolver::resolve() for managed node_modules (#23902) 2024-05-21 17:54:15 +01:00
David Sherret
54eb930e8c
perf: resolver - skip cwd lookup if able (#23851)
The cwd lookup was taking 2% of a flamegraph I was looking at.
2024-05-21 10:38:06 -04:00
Simon Lecoq
fa5c61e441
fix(cli/coverage): invalid line id in html reporter (#23908) 2024-05-21 13:37:36 +02:00
Bartek Iwańczuk
c703ddd965
chore: force import assertion support (#23855)
https://github.com/denoland/deno/pull/23838 might accidentally disable
import assertions support because of V8 12.6 unshipping it, but we want
import assertions to be supported until Deno 2.
2024-05-21 00:10:43 +00:00
David Sherret
c89f9f9ad1
perf(cache): compile ts to js in parallel for deno cache (#23892)
Closes https://github.com/denoland/deno/issues/23860
2024-05-20 13:49:12 -04:00
Kenta Moriuchi
9e890399fc
fix: add missing URL.parse types (#23893) 2024-05-19 15:55:15 +01:00
David Sherret
a2dbcf9e0a
perf: analyze cjs exports and emit typescript in parallel (#23856) 2024-05-18 11:42:03 -04:00
denobot
fcb6a18b2b
chore: forward v1.43.5 release commit to main (#23877)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-17 21:49:44 -04:00
David Sherret
1a0fbc4c3c
fix(npm): regression deserializing JSON for some npm packages (#23868)
* https://github.com/denoland/deno_npm/pull/53

Closes https://github.com/denoland/deno/issues/23862
2024-05-17 17:14:36 +00:00
Satya Rohith
20cb0e8863
feat(serve): support --port 0 to use an open port (#23846)
Closes https://github.com/denoland/deno/issues/23845
2024-05-17 05:38:50 +00:00
Bartek Iwańczuk
2b560be83f
chore: forward v1.43.4 commit to main (#23861)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-05-17 03:57:53 +02:00
Nayeem Rahman
f8956eb763
fix(lsp): respect types dependencies for tsc roots (#23825) 2024-05-16 22:12:25 +01:00
Divy Srivastava
88983fb3eb
fix(node): seperate worker module cache (#23634)
Construct a new module graph container for workers instead of sharing it
with the main worker.

Fixes #17248
Fixes #23461

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-16 07:09:35 +00:00
Arnau Orriols
f6c6e768c8
perf(compile): Do not checksum eszip content (#23839)
Related: https://github.com/denoland/eszip/pull/181

eszip < v0.69.0 hashes all its contents to ensure data integrity. This
feature is not necessary in Deno CLI as the binary integrity guarantee
is deemed an external responsibility (ie it is to be assumed that, if
necessary, the compiled binary will be checksumed externally prior to
being executed).

eszip >= v0.69.0 no longer performs this checksum by default. This
reduces the cold-start time of the compiled binaries, proportionally to
their size.
2024-05-15 21:13:53 -04:00
David Sherret
5385a42ec4
perf(jsr): download metadata files as soon as possible and in parallel (#23836)
* https://github.com/denoland/deno_graph/pull/471
* https://github.com/denoland/deno_graph/pull/473
2024-05-16 00:58:57 +02:00
David Sherret
cb4d77421f
fix(doc): --lint - private ref diagnostic was displaying incorrect information (#23834)
* https://github.com/denoland/deno_doc/pull/576

Closes #23303
2024-05-15 14:53:45 -07:00
Nathan Whitaker
36d877be4a
perf(lsp): Cache semantic tokens for open documents (#23799)
VScode will typically send a `textDocument/semanticTokens/full` request
followed by `textDocument/semanticTokens/range`, and occassionally
request semantic tokens even when we know nothing has changed. Semantic
tokens also get refreshed on each change. Computing semantic tokens is
relatively heavy in TSC, so we should avoid it as much as possible.

Caches the semantic tokens for open documents, to avoid making TSC do
unnecessary work. Results in a noticeable improvement in local
benchmarking

before:
```
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 383ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1079ms)
   - Find/Replace
      (10 runs, mean: 59ms)
   - Code Lens
      (10 runs, mean: 440ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 9921ms)
<- End benchmarking lsp
```

after:
```
Starting Deno benchmark
-> Start benchmarking lsp
   - Simple Startup/Shutdown 
      (10 runs, mean: 395ms)
   - Big Document/Several Edits 
      (5 runs, mean: 1024ms)
   - Find/Replace
      (10 runs, mean: 56ms)
   - Code Lens
      (10 runs, mean: 438ms)
   - deco-cx/apps Multiple Edits + Navigation
      (5 runs, mean: 8927ms)
<- End benchmarking lsp
```
2024-05-15 01:51:48 +00:00
David Sherret
4ddc85e1da
fix(emit): regression - keep comments in emit (#23815)
Closes https://github.com/denoland/deno/discussions/23814
2024-05-14 22:01:31 +00:00
Nayeem Rahman
dda8979cb1
fix(lsp): show reference code lens on methods (#23804) 2024-05-14 22:42:35 +01:00
David Sherret
e39b94f3aa
fix(runtime): output to stderr with colors if a tty and stdout is piped (#23813)
This also fixes a bug where Deno would output to stderr with colours
when piped and stdout was not piped.
2024-05-14 17:32:09 -04:00
David Sherret
f16b4d4df8
fix(npm): make tarball extraction more reliable (#23759)
1. Extracts to a directory beside the destination.
2. Renames to the destination with retries.
2024-05-14 14:26:48 -04:00
David Sherret
c0e3b6ed9d
fix(publish): always include config file when publishing (#23797)
Closes https://github.com/denoland/deno/issues/23796
2024-05-14 18:15:43 +00:00
David Sherret
c6189e2070
fix(publish): error for missing version constraints on dry-publish instead of just publish (#23798)
Closes https://github.com/denoland/deno/issues/22835
2024-05-14 10:30:09 -04:00
futsuuu
c0a600786e
fix: Add missing "junction" type for SymlinkOptions.types (#23756)
Junction symlink support is added in #22762, but `SymlinkOptions` and
its documents are not updated.
2024-05-14 15:06:21 +02:00
David Sherret
6084cf60ba
fix(doc/publish): support expando properties (#23795)
* https://github.com/denoland/deno_graph/pull/428
* https://github.com/denoland/deno_doc/pull/575

Closes https://github.com/denoland/deno/issues/23276
2024-05-14 00:00:33 +00:00
David Sherret
f2dc3f9a94
chore(task): various small refactorings (#23793) 2024-05-13 22:55:14 +00:00
Leo Kettmeir
df879f9f74
chore: cleanup unused dependencies (#23787) 2024-05-13 14:23:39 -07:00
Evan
329a8ae0c0
fix(cli): panic with deno coverage (#23353)
This PR directly addresses the issue raised in #23282 where Deno panics
if `deno coverage` is called with `--include` regex that returns no
matches.

I've opted not to change the return value of `collect_summary` for
simplicity and return an empty `HashMap` instead
2024-05-13 23:18:38 +02:00
Nayeem Rahman
88529f0b47
refactor(lsp): reuse CliGraphResolverOptions::sloppy_imports_resolver (#23764) 2024-05-13 17:55:31 +01:00
David Sherret
2b62a5b814
fix(npm): handle null fields in npm registry JSON (#23785)
* https://github.com/denoland/deno_npm/pull/52

Closes https://github.com/denoland/deno/issues/23776
2024-05-12 22:19:04 +00:00
denobot
dac49a116e
chore: forward v1.43.3 release commit to main (#23771)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-05-10 19:20:34 -04:00