This PR updates the behavior of `deno test --coverage` option. Now if
`--coverage` option is specified, `deno test` command automatically
shows summary report in the terminal, and generates the lcov report in
`$coverage_dir/lcov.info` and html report in `$coverage_dir/html/`
This change also adds `--coverage-raw-data-only` flag, which prevents
the above reports generated, instead only generates the raw json
coverage data (which is the same as current behavior)
With `nodeModulesDir: auto` (and `none`, to a lesser extent), we
frequently repeatedly try to cache npm packages during resolution. On a
(private) fresh project, I counted that `sync_resolution_with_fs` was
called 478 times over the course of a fresh build. This reduces the
number of calls to 8, and doing so speeds things up substantially.
```
❯ hyperfine --warmup 2 -N "deno task build" "../deno/target/release-lite/deno task build"
Benchmark 1: deno task build
Time (mean ± σ): 3.652 s ± 0.042 s [User: 3.285 s, System: 2.399 s]
Range (min … max): 3.587 s … 3.712 s 10 runs
Benchmark 2: ../deno/target/release-lite/deno task build
Time (mean ± σ): 1.356 s ± 0.007 s [User: 1.961 s, System: 1.108 s]
Range (min … max): 1.345 s … 1.372 s 10 runs
Summary
../deno/target/release-lite/deno task build ran
2.69 ± 0.03 times faster than deno task build
```
This extracts out the shared libraries and `.node` native modules to a
temp file and opens them from there. **This means that this
implementation will not work in every scenario.** For example, a library
could require other files that only exist in the in-memory file system.
To solve that, we'll introduce
https://github.com/denoland/deno/issues/28918 later or adapt this
solution to solve more issues.
Additionally, this will not work when run on readonly file systems.
We used a different error message by referring to the first parameter as
`previousValue` instead of `prevValue`. Node uses `prevValue` in the
error message.
The bug has been fixed by updating the regex to ensure that the shebang
characters (#!) are no longer excluded. This allows the shebang to be
retained and parsed correctly.
---------
Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
This should make the "forward release commit" CI job actually work. The
issue was that actions/checkout by default does a shallow clone
(fetch-deptg == 1), so then when we tried to cherry-pick it would fail
due to missing the history. That's why the cherry-pick would work fine
locally, but fail every time in CI
This is the release commit being forwarded back to main for 2.2.10
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
Co-authored-by: Nathan Whitaker <nathan@deno.com>
Fixes#28891
We were checking if the node_modules entry for the package was present,
but then reading from the global cache.
Instead, read from the package.json in node_modules. As a fallback(which
in theory should only really happen if the node_modules dir is somehow
messed up), take the more expensive (but likely to work) path of reading
from the registry.json.
Ref https://github.com/denoland/deno/issues/28836
This PR replaces the _stream.mjs bundle with a file-by-file port instead. A codemod transpiles Node.js internals to ESM. The codemod performs three tasks: translating CJS to ESM, remapping internal dependencies, and hoisting lazy requires as imports.
The process is fully automated through the `update_node_stream.ts` script, simplifying future internal updates. The script checks out Node.js from a specific tag defined in the `tests/node_compat/runner`.
Additionally, the update enables new tests in our Node test runner and adds features (like compose()) that were missing from the outdated bundle.
## Performance
There is a 140KB+ binary size increase on aarch64-apple-darwin and nop startup time stays the same.
This is where deno_lockfile gets the info for the transform from 4->5.
So while we were doing this optimization on new v5 lockfiles, we weren't
doing it correctly for ones migrated from earlier versions.
Testing this is kinda hard because our tests don't use the default
registry, hmm