Commit graph

846 commits

Author SHA1 Message Date
David Sherret e9fe71acb5
fix(unstable): sloppy imports should resolve .d.ts files during types resolution (#22602) 2024-02-27 18:30:21 +00:00
Luca Casonato 8d5c231349
feat(publish): support sloppy imports and bare node built-ins (#22588) 2024-02-27 15:13:16 +00:00
Matt Mastracci 47c2a63d87
chore: bump deno_core (#22596)
Migrations:

 - snapshot code updated
 - runtime stats API tweaks
2024-02-27 08:05:57 -07:00
Bartek Iwańczuk f1a691274e
feat(publish): discover jsr.json and jsr.jsonc files (#22587)
Closes https://github.com/denoland/deno/issues/22491
2024-02-27 08:27:21 +00:00
David Sherret 6567dc94a9
fix(lsp): import map expansion (#22553) 2024-02-24 00:21:09 -05:00
Matt Mastracci 5193834cf2
refactor(cli): clean up test runner channels (#22422)
Gets us closer to solving #20707.

Rewrites the `TestEventSender`:

- Allow for explicit creation of multiple streams. This will allow for
one-std{out,err}-per-worker
- All test events are received along with a worker ID, allowing for
eventual, proper parallel threading of test events.
 
In theory this should open up proper interleaving of test output,
however that is left for a future PR.

I had some plans for a better performing synchronization primitive, but
the inter-thread communication is tricky. This does, however, speed up
the processing of large numbers of tests 15-25% (possibly even more on
100,000+).

Before

```
ok | 1000 passed | 0 failed (32ms)
ok | 10000 passed | 0 failed (276ms)
```

After

```
ok | 1000 passed | 0 failed (25ms)
ok | 10000 passed | 0 failed (230ms)
```
2024-02-23 11:11:15 -07:00
Marvin Hagemeister cddefecfff
feat: infer dependencies from package.json (#22563)
<!--
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 enhances the `deno publish` command to infer dependencies from
`package.json` if present.
2024-02-23 15:56:49 +01:00
Divy Srivastava f49abcc1ac
feat(publish): respect .gitignore during deno publish (#22514)
Files from `.gitignore`, global git config, `.git/info/exclude` and
`deno.json`'s `exclude` are ignored.
2024-02-23 07:56:34 +05:30
Bartek Iwańczuk 197d2480bb
fix(compile): respect compiler options for emit (#22521)
`deno compile` was ignoring configuration file and thus not applying
`compilerOptions` to influence the way files were emitted.
2024-02-21 23:03:11 +00:00
David Sherret 9166d8a4e9
feat(publish): type check on publish (#22506)
Supersedes #22501 and also fixes that issue.
2024-02-21 08:35:25 -05:00
David Sherret f90889e5ee
perf(jsr): fast check cache and lazy fast check graph (#22485) 2024-02-20 21:29:57 +00:00
Luca Casonato 54a3eb585d
fix(publish): print files that will be published (#22495) 2024-02-20 13:30:34 +01:00
Luca Casonato ef43d51497
fix(publish): ignore .DS_Store while publishing (#22478) 2024-02-19 10:48:35 -05:00
David Sherret 66424032a2
feat(unstable/lint): no-slow-types for JSR packages (#22430)
1. Renames zap/fast-check to instead be a `no-slow-types` lint rule.
1. This lint rule is automatically run when doing `deno lint` for
packages (deno.json files with a name, version, and exports field)
1. This lint rules still occurs on publish. It can be skipped by running
with `--no-slow-types`
2024-02-19 15:28:41 +00:00
Asher Gomez eb542bc185
chore(fs): rename op_fs_file_stat_{async/sync} ops (#22476)
Renames `op_fs_fstat_{sync/async}` to `op_fs_file_stat_{async/sync}` in
preparation of the upcoming removal of `Deno.fstat()` in v2.
2024-02-19 06:33:42 -07:00
Luca Casonato 15c64365a2
fix: write lockfile in deno info (#22272) 2024-02-19 13:02:40 +01:00
David Sherret 828d9b8485
refactor: remove module graph setup from ModuleLoader (#22442)
`ModuleLoader` was doing too much duplicate work.
2024-02-16 22:10:06 +00:00
Matt Mastracci 67a4231bb6
refactor(cli): move op sanitizer to Rust (#22413)
The format of the sanitizers will change a little bit:

- If multiple async ops leak and traces are on, we repeat the async op
header once per stack trace.
- All leaks are aggregated under a "Leaks detected:" banner as the new
timers are eventually going to be added, and these are neither ops nor
resources.
 - `1 async op` is now `An async op`
- If ops and resources leak, we show both (rather than op leaks masking
resources)

Follow-on to https://github.com/denoland/deno/pull/22226
2024-02-16 21:22:12 +00:00
Matt Mastracci f705906256
chore(ext/web): refactor timer ops before landing op sanitizer (#22435)
Splitting the sleep and interval ops allows us to detect an interval
timer. We also remove the use of the `op_async_void_deferred` call.

A future PR will be able to split the op sanitizer messages for timers
and intervals.
2024-02-16 15:35:51 +00:00
David Sherret 4f80d83774
feat(unstable): single checksum per JSR package in the lockfile (#22421)
This changes the lockfile to not store JSR specifiers in the "remote"
section. Instead a single JSR integrity is stored per package in the
lockfile, which is a hash of the version's `x.x.x_meta.json` file, which
contains hashes for every file in the package. The hashes in this file
are then compared against when loading.

Additionally, when using `{ "vendor": true }` in a deno.json, the files
can be modified without causing lockfile errors—the checksum is only
checked when copying into the vendor folder and not afterwards
(eventually we should add this behaviour for non-jsr specifiers as
well). As part of this change, the `vendor` folder creation is not
always automatic in the LSP and running an explicit cache command is
necessary. The code required to track checksums in the LSP would have
been too complex for this PR, so that all goes through deno_graph now.
The vendoring is still automatic when running from the CLI.
2024-02-15 14:49:35 -05:00
Nayeem Rahman 012a9d8aeb
chore: rename DENO_REGISTRY_URL to JSR_URL (#22414) 2024-02-14 18:30:44 +00:00
Leo Kettmeir 981a19f067
feat(unstable): define config in publish url (#22406) 2024-02-14 12:53:15 +01:00
Matt Mastracci e23fc6d88c
chore: deno_core bump (#22407)
- Adding `None` flag for warmup script.
 - Modify opcall trace interface to match new Rust implementation
2024-02-13 19:44:37 -07:00
Divy Srivastava a68eb3fcc3
feat: denort binary for deno compile (#22205)
This introduces the `denort` binary - a slim version of deno without
tooling. The binary is used as the default for `deno compile`.

Improves `deno compile` final size by ~2.5x (141 MB -> 61 MB) on Linux
x86_64.
2024-02-13 21:52:30 +05:30
林炳权 80d5ffbe7c
chore: update to Rust 1.76 (#22376)
Update to Rust 1.76
2024-02-12 03:00:33 +00:00
David Sherret d2477f7806
fix: cache bust jsr deps on constraint failure (#22372)
Removes the `FileFetcher`'s internal cache because I don't believe it's
necessary (we already cache this kind of stuff in places like deno_graph
or config files in different places). Removing it fixes this bug because
this functionality was already implemented in deno_graph and lowers
memory usage of the CLI a little bit.
2024-02-10 10:02:31 -05:00
David Sherret e5e2c45998
fix: upgrade to deno_ast 0.33 (#22341)
* Uses diagnostics from deno_ast
* Real fix for https://github.com/denoland/deno/pull/22310
* Moves `deno lint --json` code here
* Upgrades swc
   
 Closes #22117
 Closes #22109
 Closes #21927
 Closes #20993
2024-02-09 01:40:26 +00:00
David Sherret 83d72e5c1c
refactor: extract out runtime::colors to deno_terminal::colors (#22324) 2024-02-07 11:25:14 -05:00
Bartek Iwańczuk 043fee48fd
chore: upgrade deno_core to 0.259.0 (#22311)
This update brings number of ops available to user code down to 45.
2024-02-07 02:16:08 +01:00
David Sherret c6def993e0
fix(publish): lazily parse sources (#22301)
Closes #22290
2024-02-06 15:57:10 -05:00
Divy Srivastava e568cb8bf8
chore(ws): remove unused op_ws_send_pong (#22283) 2024-02-06 13:37:20 +01:00
Matt Mastracci 2c621f5894
refactor(cli): Move op descriptions into Rust and prepare for op import (#22271)
This moves the op sanitizer descriptions into Rust code and prepares for
eventual op import from `ext:core/ops`. We cannot import these ops from
`ext:core/ops` as the testing infrastructure ops are not always present.

Changes:
- Op descriptions live in `cli` code and are currently accessible via an
op for the older sanitizer code
 - `phf` dep moved to workspace root so we can use it here
- `ops.op_XXX` changed to to `op_XXX` to prepare for op imports later
on.
2024-02-05 20:26:59 +00:00
Matt Mastracci 0a3d329dd8
Reland refactor(cli): use new sanitizer for resources (#22226)
Originally in #22125
Reverted in #22153 because of #22148

Fixed in deno_core https://github.com/denoland/deno_core/pull/538

Test plan: 

1. Check out: https://github.com/poolifier/poolifier-deno.git

2. `PATH=.../deno/target/release/:$PATH deno task test`

3. `ok | 13 passed (188 steps) | 0 failed (18s)`
2024-02-05 12:21:29 -07:00
Matt Mastracci aecad7f353
refactor(cli): Add TestFailureDescription (#22267)
Extract zero-risk changes from #22226
2024-02-05 17:27:17 +00:00
Bartek Iwańczuk aba91490d6
fix(publish): use lighter crate for opening browser (#22224)
Alternative to https://github.com/denoland/deno/pull/22223 which
switches `webbrowser` crate to `open` (https://crates.io/crates/open)
which is lighterweight.
2024-02-01 16:25:56 +01:00
Leo Kettmeir e58b1900a7
fix(publish): add node specifiers (#22213) 2024-02-01 05:18:44 +01:00
Bartek Iwańczuk cfb57b1855
fix(install): forward granular --unstable-* flags (#22164)
Closes https://github.com/denoland/deno/issues/22154
2024-02-01 09:16:37 +05:30
David Sherret 4b7c6049ef
refactor: load bytes in deno_graph (#22212)
Upgrades deno_graph to 0.64 where deno_graph is now responsible for
turning bytes into a string. This is in preparation for Wasm modules.
2024-02-01 03:15:22 +00:00
Bartek Iwańczuk 830d096b66
fix(publish): rename --no-fast-check to --no-zap (#22214)
Also prints an information about the flag when there are `zap` errors.
2024-02-01 02:16:52 +00:00
Bartek Iwańczuk 163491f237
chore(publish): try to automatically open the web browser (#22208) 2024-01-31 22:38:57 +01:00
Leo Kettmeir b91ae88860
chore: update deno_doc (#22174) 2024-01-31 17:34:15 +00:00
Bartek Iwańczuk 560390c93c
chore(publish): add --no-fast-check flag (#22203) 2024-01-31 16:10:31 +01:00
Luca Casonato d923705d9d
fix: canary for arm64 macos (#22187)
This doesn't actually trigger the arm64 build job nightly yet. I'll do
that in a follow up.
2024-01-30 20:50:54 +01:00
Bartek Iwańczuk 7281775381
Revert "refactor(cli): use new sanitizer for resources (#22125)" (#22153) 2024-01-27 20:37:36 +01:00
Matt Mastracci 84fb2ad71b
refactor(cli): use new sanitizer for resources (#22125)
Step 1 of the Rustification of sanitizers, which unblocks the faster
timers.

This replaces the resource sanitizer with a Rust one, using the new APIs
in deno_core.
2024-01-26 17:24:16 -05:00
Luca Casonato 316093fec4
feat(publish): error on invalid external imports (#22088) 2024-01-24 21:59:18 +00:00
Luca Casonato 52ad1ef154
feat(publish): give diagnostic on invalid package files (#22082) 2024-01-24 21:24:52 +00:00
Luca Casonato 176118a046
feat(publish): exclude and include (#22055) 2024-01-24 20:30:08 +00:00
Luca Casonato 745333f073
chore: improve unanalyzable dynamic import diagnostic (#22051) 2024-01-24 14:49:33 +01:00
Bartek Iwańczuk b66f5ed00e
feat: TC39 decorator proposal support (#22040)
This commit adds support for [TC39 Decorator
Proposal](https://github.com/tc39/proposal-decorators).

These decorators are only available in transpiled sources - ie.
non-JavaScript files (because of lack of support in V8).

This entails that "experimental TypeScript decorators" are not available
by default
and require to be configured, with a configuration like this:
```
{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}
```


Closes https://github.com/denoland/deno/issues/19160

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-24 18:46:23 +05:30
Asher Gomez 4c0b66baab
refactor: set removal version for deno bundle (#22062)
This change sets the removal version for the `deno bundle` sub-command
for Deno v2. The warnings appear when `deno bundle` is run and in the
`--help` menu.
2024-01-24 02:36:51 +01:00
Luca Casonato 137f1a0c68
feat(cli): improved diagnostics printing (#22049)
This initially uses the new diagnostic printer in `deno lint`,
`deno doc` and `deno publish`. In the limit we should also update
`deno check` to use this printer.
2024-01-23 16:37:43 +01:00
Luca Casonato 052fd78690
refactor: use parsed source cache when unfurling import map (#22001) 2024-01-23 12:40:23 +01:00
Bartek Iwańczuk e49973d96d
chore: update deno_ast and deno_graph (#22033)
This upgrade unblocks support for ES decorator proposal.

Co-authored-by: crowlkats <crowlkats@toaxl.com>
2024-01-23 11:25:44 +01:00
Anwesh 706752753d
fix(info): return proper exit code on error (#21952) 2024-01-23 01:42:26 +00:00
Bartek Iwańczuk d20c9e75d1
refactor: add "UnstableConfig" struct to cli/args/flags.rs (#21993)
This commit adds "UnstableConfig" struct which centralizes
handling of all "--unstable-*" flags.

Closes https://github.com/denoland/deno/issues/21920
2024-01-22 17:37:28 +00:00
Bartek Iwańczuk 88bc57d764
feat(jupyter): don't require --unstable flag (#21963)
This commit removes the requirement for `--unstable` flag in `deno
jupyter` subcommand. The process will no longer exit if this flag is not
provided, however the subcommand itself is still considered unstable
and might change in the future.

Required for https://github.com/denoland/deno/pull/21452
2024-01-18 23:16:14 +01:00
David Sherret 35c1652f56
fix(lsp): regression - formatting was broken on windows (#21972)
~~Waiting on: https://github.com/denoland/deno_config/pull/31~~

Closes #21971
Closes https://github.com/denoland/vscode_deno/issues/1029
2024-01-18 15:57:30 -05:00
David Sherret 4e72ca313a
refactor: use globbing from deno_config (#21925) 2024-01-15 19:15:39 -05:00
Bartek Iwańczuk 72ecfe0419
fix(publish): support deno.jsonc file (#21948) 2024-01-15 15:07:57 +00:00
Bartek Iwańczuk 0d51c1f90e
feat: remove conditional unstable type-checking (#21825)
This commit removes conditional type-checking of unstable APIs.

Before this commit `deno check` (or any other type-checking command and
the LSP) would error out if there was an unstable API in the code, but not
`--unstable` flag provided.

This situation hinders DX and makes it harder to configure Deno. Failing
during runtime unless `--unstable` flag is provided is enough in this case.
2024-01-14 18:29:17 +01:00
David Sherret d88c869917
fix(check): should not panic when all specified files excluded (#21929)
Closes #21926
2024-01-13 16:06:18 -05:00
Bartek Iwańczuk f45ceb2320
chore(publish): add --dry-run flag (#21895) 2024-01-11 21:17:03 +00:00
David Sherret 70ac06138c
feat(unstable): fast subset type checking of JSR dependencies (#21873) 2024-01-10 22:40:30 +00:00
Matt Mastracci a45c1e4ae4
chore: bump deno_core (#21832) 2024-01-10 09:48:40 +05:30
Bartek Iwańczuk 69959aa01f
fix: update deno_lint and swc (#21718)
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-09 23:20:52 +00:00
David Sherret be888c068c
fix(task): do not eagerly auto-install packages in package.json when "nodeModulesDir": false (#21858)
There's no need to auto-install the package.json if the user is not
using a node_modules directory.

Closes #21850
2024-01-08 19:30:36 -05:00
David Sherret 0efb17b2cb
fix(unstable/tar): skip node_modules, .git, and config "exclude" (#21816) 2024-01-08 18:51:49 -05:00
David Sherret e212e1fc35
perf: skip expanding exclude globs (#21817)
We were calling `expand_glob` on our excludes, which is very expensive
and unnecessary because we can pattern match while traversing instead.

1. Doesn't expand "exclude" globs. Instead pattern matches while walking
the directory.
2. Splits up the "include" into base paths and applicable file patterns.
This causes less pattern matching to occur because we're only pattern
matching on patterns that might match and not ones in completely
unrelated directories.
2024-01-08 17:18:42 +00:00
Bartek Iwańczuk 43d2ecd4f0
fix(registry): wait for already pending publish (#21663)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-01-08 15:25:18 +00:00
Bartek Iwańczuk 824f4fa55f
refactor(tools/repl): reorganize code (#21810)
Some drive-by cleanup as I'm working through
https://github.com/denoland/deno_core/pull/415.
2024-01-05 16:14:58 +01:00
David Sherret 0245ac08d4
perf(coverage): faster source mapping (#21783)
I did not measure this change (O(n) to O(log n)), but mainly this should
be slightly more accurate at getting the line number.
2024-01-04 08:49:17 -05:00
David Sherret 97937a097e
fix(jupyter): error message when install fails due to jupyter command not being on PATH (#21767)
We were failing silently in this scenario.
2024-01-03 14:45:10 +00:00
林炳权 96b581bdd2
chore: update to Rust 1.75 (#21731) 2024-01-01 23:22:48 +01:00
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Leo Kettmeir 4de9ddcf21
chore: update deno_doc to 0.85.0 (#21678) 2023-12-30 00:04:50 +00:00
Bartek Iwańczuk c2414db1f6
refactor: simplify hyper, http, h2 deps (#21715)
Main change is that:
- "hyper" has been renamed to "hyper_v014" to signal that it's legacy
- "hyper1" has been renamed to "hyper" and should be the default
2023-12-27 11:59:57 -05:00
Bartek Iwańczuk 8fbac67395
refactor: change cli/ to use hyper 1.1 (#21705) 2023-12-26 14:32:21 +01:00
Bartek Iwańczuk 476f5d3deb
fix(repl): remove stray debug log (#21635)
Left behind in #21623 by mistake.
2023-12-18 18:52:43 -07:00
Bartek Iwańczuk 5b2caed7fd
fix(coverage): error if no files found (#21615)
This commit fixes a panic in `deno coverage` command if the file
to be covered doesn't produce any coverage data.

Fixes https://github.com/denoland/deno/issues/21580
2023-12-18 11:43:27 +01:00
Bartek Iwańczuk a44a5de430
refactor: factor out cdp::ExceptionThrown notification (#21623)
Just removing some duplicated code.
2023-12-18 11:43:02 +01:00
Raashid Anwar 9ede8d7b69
fix(bench): added group banner to bench output. (#21551)
Added group banner to bench output.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-17 22:57:14 +00:00
Bartek Iwańczuk 4c2c053afe
fix: urls for publishing (#21613) 2023-12-17 10:50:11 +00:00
Bartek Iwańczuk fd6044dfec
fix: prompts when publishing (#21596) 2023-12-15 13:52:51 +00:00
Bartek Iwańczuk 62e3f5060e
refactor: check if scope and package exist before publish (#21575)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2023-12-15 10:27:10 +00:00
Bartek Iwańczuk 19d52b9a55
refactor: split registry into multiple modules (#21572)
Co-authored-by: David Sherret <dsherret@gmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-12-14 12:05:59 +01:00
David Sherret 4b6fc64646
chore(unstable/publish): ordered publish of packages in workspace (#21550)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-12-14 10:55:56 +01:00
Matt Mastracci 76a6ea5775
refactor(cli): update to new deno_core promise/call methods (#21519) 2023-12-13 08:07:26 -07:00
Bartek Iwańczuk bbf8f69cb9
test: integration tests for tarring/unfurling (#21544) 2023-12-13 11:00:45 +01:00
Bartek Iwańczuk 0ceae7a490
refactor: suggest entrypoint on missing 'exports' (#21549) 2023-12-12 19:18:02 +01:00
Bartek Iwańczuk ece78cfb8a
refactor: nicer warning display (#21547) 2023-12-12 23:45:45 +09:00
Bartek Iwańczuk 06c5f99a01
refactor: better handling for registry urls (#21545) 2023-12-12 23:45:20 +09:00
Yoshiya Hinosawa 93ea46b31d
fix(coverage): rename --pretty to --detailed (#21543) 2023-12-12 20:53:41 +09:00
Yoshiya Hinosawa 5ddf8732f0
feat(coverage): add summary reporter (#21535) 2023-12-12 12:42:57 +09:00
Yoshiya Hinosawa 073e341faf
fix(coverage): escape source code in html coverage report (#21531) 2023-12-11 19:24:20 +09:00
Yoshiya Hinosawa 67eec26308
refactor(coverage): separate reporter-related structs (#21528) 2023-12-11 13:30:38 +09:00
David Sherret ddfbe71ced
feat(lsp): provide quick fixes for specifiers that could be resolved sloppily (#21506) 2023-12-08 09:57:06 -05:00
Yoshiya Hinosawa d68d1e2022
feat(coverage): add html reporter (#21495)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-12-08 16:54:52 +09:00
David Sherret d192cc2640
fix: add more warnings when using sloppy imports (#21503)
One warning for when using it with `deno compile` and another when using
it with `deno run`.
2023-12-07 22:35:53 -05:00
David Sherret 78566753c8
feat: add suggestions to module not found error messages for file urls (#21498) 2023-12-07 15:59:13 -05:00