Commit graph

6345 commits

Author SHA1 Message Date
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