Commit graph

74 commits

Author SHA1 Message Date
Satya Rohith 50223c5c53
fix(ext/node): dispatch beforeExit/exit events irrespective of listeners (#23382)
Closes https://github.com/denoland/deno/issues/23342
Closes https://github.com/denoland/deno/issues/21757
2024-04-16 13:45:41 +00:00
David Sherret 68fecc6de4
fix: less aggressive vendor folder ignoring (#23100)
This is slightly breaking as some users want the `vendor` folder
excluded and may not have that specified in their deno.json.

Closes #22833
2024-03-27 14:25:39 -04:00
Nathan Whitaker ab67b4c645
fix(coverage): Error if no files are included in the report (#22952)
Fixes #22941.

In that case, the only file with coverage was the `test.ts` file. The
coverage reporter filters out test files before compiling its report, so
after filtering we were left with an empty set of files. Later on it's
assumed that there is at least 1 file to be reported on, and we panic.
Instead of panicking, just issue an error after filtering.
2024-03-15 20:58:57 -07:00
David Sherret ad6b00a2bf
chore: enable clippy unused_async rule (#22834) 2024-03-11 23:48:00 -04:00
David Sherret 2dfc0aca7c
fix(publish): make include and exclude work (#22720)
1. Stops `deno publish` using some custom include/exclude behaviour from
other sub commands
2. Takes ancestor directories into account when resolving gitignore
3. Backards compatible change that adds ability to unexclude an exclude
by using a negated glob at a more specific level for all sub commands
(see https://github.com/denoland/deno_config/pull/44).
2024-03-07 20:16:32 -05: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
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
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
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
Matt Mastracci a45c1e4ae4
chore: bump deno_core (#21832) 2024-01-10 09:48:40 +05:30
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
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
林炳权 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
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
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
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
Bartek Iwańczuk fdb4953ea4
refactor: unify CDP types in a single module (#21094)
This commit moves all Chrome Devtools Protocol messages to `cli/cdp.rs`
and refactors all places using these types to pull them from a common
place.

No functional changes.
2023-11-05 22:58:59 +00:00
David Sherret 8f065a60e7
fix: improved using declaration support (#20959)
Upgrades to deno_ast 0.30.
2023-10-24 09:37:02 -04:00
林炳权 7a01799f49
chore: update to Rust 1.73 (#20781) 2023-10-05 14:49:09 -04:00
David Sherret 8c1677ecbc
refactor(npm): break up NpmModuleLoader and move more methods into the managed CliNpmResolver (#20777)
Part of https://github.com/denoland/deno/issues/18967
2023-10-03 19:05:06 -04:00
Marvin Hagemeister 9d1385896f
fix: exclude internal JS files from coverage (#20448) 2023-09-11 13:53:42 +00:00
Nayeem Rahman 17276a1df9
fix: empty include in config file excludes all (#20404) 2023-09-08 15:04:45 +01:00
林炳权 2080669943
chore: update to Rust 1.72 (#20258)
<!--
Before submitting a PR, please read https://deno.com/manual/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.
-->

As the title.

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-26 22:04:12 -06:00
David Sherret b9b0386948
feat(unstable): rename deno_modules to vendor (#20065)
Renames the unstable `deno_modules` directory and corresponding settings
to `vendor` after feedback. Also causes the vendoring of the
`node_modules` directory which can be disabled via
`--node-modules-dir=false` or `"nodeModulesDir": false`.
2023-08-06 21:56:56 -04:00
David Sherret 1cefa831fd
feat(unstable): optional deno_modules directory (#19977)
Closes #15633
2023-08-02 00:49:09 +00:00
Matt Mastracci 8465bd0037
chore: update to Rust 1.71 (#19822) 2023-07-13 15:16:24 -06:00
Martin Fischer 801b9ec62d
chore: fix typos (#19572) 2023-06-26 09:10:27 -04:00
David Sherret 9efed4c7a3
refactor(cli): remove ProcState - add CliFactory (#18900)
This removes `ProcState` and replaces it with a new `CliFactory` which
initializes our "service structs" on demand. This isn't a performance
improvement at the moment for `deno run`, but might unlock performance
improvements in the future.
2023-05-01 14:35:23 -04:00
Levente Kurusa c336755881
fix(test/coverage): exclude test files (#18748)
Fixes: #18454
2023-04-19 23:30:52 +02:00
David Sherret 136dce67ce
refactor: break up ProcState (#18707)
1. Breaks up functionality within `ProcState` into several other structs
to break out the responsibilities (`ProcState` is only a data struct
now).
2. Moves towards being able to inject dependencies more easily and have
functionality only require what it needs.
3. Exposes `Arc<T>` around the "service structs" instead of it being
embedded within them. The idea behind embedding them was to reduce the
verbosity of needing to pass around `Arc<...>`, but I don't think it was
exactly working and as we move more of these structs to be more
injectable I don't think the extra verbosity will be a big deal.
2023-04-14 16:22:33 -04:00
David Sherret d192d84a0e
refactor(cli): add Emitter struct (#18690)
Removes the functions in the `emit` module and replaces them with an
`Emitter` struct that can have "ctor dependencies" injected rather than
using functions to pass along the dependencies.

This is part of a long term refactor to move more functionality out of
proc state.
2023-04-13 18:03:07 +00:00
David Sherret 9c255b2843
refactor: ProcState::build -> ProcState::from_flags (#18672) 2023-04-12 14:54:28 -04:00
Matt Mastracci a1764f7690
refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies,
mainly focused on ensuring that ASCII strings are easy to provide to the
JS runtime.

While we are replacing a 16-byte reference in a number of places with a
24-byte structure (measured via `std::mem::size_of`), the reduction in
copies wins out over the additional size of the arguments passed into
functions.

Benchmarking shows approximately the same if not slightly less wallclock
time/instructions retired, but I believe this continues to open up
further refactoring opportunities.
2023-04-04 06:46:31 -06:00
Geert-Jan Zwiers 206c593519
fix(coverage): ignore files from npm registry (#18457)
Fixes https://github.com/denoland/deno/issues/17664 and part of
https://github.com/denoland/deno/issues/18454 by excluding files
belonging to npm modules by default in the coverage output.
2023-03-30 17:40:22 +00:00
Matt Mastracci 0b4770fa7d
perf(core) Reduce script name and script code copies (#18298)
Reduce the number of copies and allocations of script code by carrying
around ownership/reference information from creation time.

As an advantage, this allows us to maintain the identity of `&'static
str`-based scripts and use v8's external 1-byte strings (to avoid
incorrectly passing non-ASCII strings, debug `assert!`s gate all string
reference paths).

Benchmark results:

Perf improvements -- ~0.1 - 0.2ms faster, but should reduce garbage
w/external strings and reduces data copies overall. May also unlock some
more interesting optimizations in the future.

This requires adding some generics to functions, but manual
monomorphization has been applied (outer/inner function) to avoid code
bloat.
2023-03-21 22:33:12 +00:00
David Sherret fb021d7cef
refactor: remove usages of map_or / map_or_else (#18212)
These methods are confusing because the arguments are backwards. I feel
like they should have never been added to `Option<T>` and that clippy
should suggest rewriting to
`map(...).unwrap_or(...)`/`map(...).unwrap_or_else(|| ...)`

https://github.com/rust-lang/rfcs/issues/1025
2023-03-15 17:46:36 -04:00
Bartek Iwańczuk 48ede89f1f
refactor(core): resolve_url_or_path and resolve_url_or_path_deprecated (#18170)
This commit changes current "deno_core::resolve_url_or_path" API to
"resolve_url_or_path_deprecated" and adds new "resolve_url_or_path"
API that requires to explicitly pass the directory from which paths
should be resolved to. 

Some of the call sites were updated to use the new API, the reminder
of them will be updated in a follow up PR.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-14 01:12:09 +00:00
Bartek Iwańczuk 72fe9bb470
refactor: rename InternalModuleLoader to ExtModuleLoader, use ext: scheme for snapshotted modules (#18041)
This commit renames "deno_core::InternalModuleLoader" to
"ExtModuleLoader" and changes the specifiers used by the 
modules loaded from this loader to "ext:".

"internal:" scheme was really ambiguous and it's more characters than
"ext:", which should result in slightly smaller snapshot size.

Closes https://github.com/denoland/deno/issues/18020
2023-03-08 12:44:54 +01:00
Leo Kettmeir 84a96110cd
refactor: rename deno specifiers to internal (#17655) 2023-02-05 17:49:20 +01:00
David Sherret f5840bdcd3
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27 10:43:16 -05:00
Divy Srivastava d5634164cb
chore: use rustfmt imports_granularity option (#17421)
Closes https://github.com/denoland/deno/issues/2699
Closes https://github.com/denoland/deno/issues/2347

Uses unstable rustfmt features. Since dprint invokes `rustfmt` we do not
need to switch the cargo toolchain to nightly. Do we care about
formatting stability of our codebase across Rust versions? (I don't)
2023-01-14 23:18:58 -05:00
Geert-Jan Zwiers 6557642fc8
refactor(coverage): use FileFlags struct (#17388) 2023-01-13 16:56:29 -05:00
Yiyu Lin a00e432297
chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 16:51:32 +09:00
David Sherret 10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
linbingquan f46df3e359
chore: update to Rust 1.66.0 (#17078) 2022-12-17 23:20:15 +01:00