Commit Graph

343 Commits

Author SHA1 Message Date
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
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
Leo Kettmeir
ec9963570b
chore: update deno_doc (#24308) 2024-06-28 05:03:51 -07: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
David Sherret
47f7bed677
chore: enable clippy::print_stdout and clippy::print_stderr (#23732)
1. Generally we should prefer to use the `log` crate.
2. I very often accidentally commit `eprintln`s.

When we should use `println` or `eprintln`, it's not too bad to be a bit
more verbose and ignore the lint rule.
2024-05-08 22:45:06 -04:00
Bartek Iwańczuk
4e23a5b1fc
FUTURE: deno install changes (#23498)
This PR implements the changes we plan to make to `deno install` in deno
2.0.
- `deno install` without arguments caches dependencies from
`package.json` / `deno.json` and sets up the `node_modules` folder
- `deno install <pkg>` adds the package to the config file (either
`package.json` or `deno.json`), i.e. it aliases `deno add`
- `deno add` can also add deps to `package.json` (this is gated behind
`DENO_FUTURE` due to uncertainty around handling projects with both
`deno.json` and `package.json`)
- `deno install -g <bin>` installs a package as a globally available
binary (the same as `deno install <bin>` in 1.0)

---------

Co-authored-by: Nathan Whitaker <nathan@deno.com>
2024-05-08 12:34:46 -07:00
David Sherret
2dcbef2abb
fix(compile): relative permissions should be retained as relative (#23719)
Closes #23715
2024-05-06 19:21:58 -04:00
Luca Casonato
6cdf81db7c
feat(cli): add support for jsxImportSourceTypes (#23419)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-04-30 18:12:35 +00:00
Kenta Moriuchi
783533d2e3
FUTURE: remove import assertions support for JavaScript (#23541)
Ref #17944, https://github.com/swc-project/swc/issues/8893

TypeScript removes the `assert` keywords in the transpile, so this PR
only works for JavaScript files
2024-04-29 22:43:05 +02:00
David Sherret
4384a126bb
fix: handle specifying an import map in an ancestor dir of deno.json (#23602)
* https://github.com/denoland/deno_config/pull/51

Closes https://github.com/denoland/deno/issues/21440
2024-04-29 14:32:27 -04:00
Leo Kettmeir
5a7414e163
chore: update deno_doc (#23544) 2024-04-24 20:34:21 +00:00
Matt Mastracci
2f8825a935
feat: Add deno serve subcommand (#23511)
By default, `deno serve` will assign port 8000 (like `Deno.serve`).
Users may choose a different port using `--port`.

`deno serve /tmp/file.ts`

`server.ts`:
```ts
export default {
  fetch(req) {
    return new Response("hello world!\n");
  },
};
```
2024-04-24 19:45:49 +00:00
Nathan Whitaker
8a367d3cc3
fix(cli): Don't panic on invalid emit options (#23463)
Fixes #23456.
2024-04-23 08:50:50 -07:00
Bartek Iwańczuk
35220f0069
fix(workspace): provide workspace members as 'imports' in import map (#23492)
This commit changes the workspace support to provide all workspace
members to be available as imports based on their names and versions.

Closes https://github.com/denoland/deno/issues/23343
2024-04-23 17:21:06 +02:00
Marvin Hagemeister
9686a8803e
feat: add jsx precompile skip element option (#23457)
<!--
Before submitting a PR, please read
https://docs.deno.com/runtime/manual/references/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->
This PR wires up a new `jsxPrecompileSkipElements` option in
`compilerOptions` that can be used to exempt a list of elements from
being precompiled with the `precompile` JSX transform.
2024-04-22 17:07:36 +02:00
David Sherret
c497e766f1
refactor: move redirect handling into deno_graph (#23444) 2024-04-19 01:43:28 +00:00
Nayeem Rahman
8e77f091ad
perf(lsp): cleanup document dependencies (#23426) 2024-04-19 00:51:16 +00:00
Igor Zinkovsky
b3d7df5535
perf: v8 code cache (#23081)
This PR enables V8 code cache for ES modules and for `require` scripts
through `op_eval_context`. Code cache artifacts are transparently stored
and fetched using sqlite db and are passed to V8. `--no-code-cache` can
be used to disable.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-04-17 07:19:55 -07:00
Asher Gomez
534dd34f86
fix: add DENO_FUTURE to deno --help (#23368) 2024-04-17 02:58:48 +10:00
Bartek Iwańczuk
f358ae6278
fix(inspector): don't panic if port is not free (#22745)
Closes https://github.com/denoland/deno/issues/22113
Closes https://github.com/denoland/deno/issues/23177
Closes https://github.com/denoland/deno/issues/22883
Closes https://github.com/denoland/deno/issues/22377
2024-04-12 01:17:10 +02:00
David Sherret
ade0cd5e97
fix: upgrade deno_ast related crates (#23187)
Had to revert back swc due to
https://github.com/swc-project/swc/issues/8840

Fixes:

- https://github.com/denoland/deno_lint/pull/1262
- https://github.com/denoland/deno_doc/pull/538
- https://github.com/denoland/deno_doc/pull/537
- https://github.com/denoland/deno_graph/pull/430
- https://github.com/denoland/deno_graph/pull/425
- https://github.com/denoland/deno_graph/pull/432
2024-04-11 23:00:17 +00:00
Asher Gomez
c6f1107e9c
chore: update references to deno_std to use JSR (#23239)
There are more uses of `deno.land/std` in the codebase, but for URL
parsing purposes rather than network calls or documentation.
2024-04-10 17:26:35 -04:00
David Sherret
049e703331
FUTURE: override byonm with nodeModulesDir setting (#23222)
Makes the `"nodeModulesDir"` setting take precedence over byonm when
using `DENO_FUTURE`.
2024-04-05 10:34:51 -04:00
JOTSR
5dda32088a
fix(cli): update deno doc help to fit current usage (#23224) 2024-04-04 22:03:29 +00:00
Bartek Iwańczuk
de3f0b93f5
refactor(flags): prepare for deno install changes (#23217)
This commit adds enum to "InstallFlags" and "UninstallFlags" that will
allow to support both local and global (un)installation.

Currently the local variant is not used.

Towards https://github.com/denoland/deno/issues/23062
2024-04-04 14:40:54 +00:00