summaryrefslogtreecommitdiff
path: root/cli/cache/node.rs
AgeCommit message (Collapse)Author
2024-05-29fix: bump cache sqlite dbs to v2 for WAL journal mode change (#24030)David Sherret
In https://github.com/denoland/deno/pull/23955 we changed the sqlite db journal mode to WAL. This causes issues when someone is running an old version of Deno using TRUNCATE and a new version because the two fight against each other.
2024-03-21feat(node): load ES modules defined as CJS (#22945)David Sherret
Changes the behaviour in Deno to just always load ES modules in npm packages even if they're defined as CJS. Closes #22818
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-07-19feat(ext/node): properly segregate node globals (#19307)Luca Casonato
Code run within Deno-mode and Node-mode should have access to a slightly different set of globals. Previously this was done through a compile time code-transform for Node-mode, but this is not ideal and has many edge cases, for example Node's globalThis having a different identity than Deno's globalThis. This commit makes the `globalThis` of the entire runtime a semi-proxy. This proxy returns a different set of globals depending on the caller's mode. This is not a full proxy, because it is shadowed by "real" properties on globalThis. This is done to avoid the overhead of a full proxy for all globalThis operations. The globals between Deno-mode and Node-mode are now properly segregated. This means that code running in Deno-mode will not have access to Node's globals, and vice versa. Deleting a managed global in Deno-mode will NOT delete the corresponding global in Node-mode, and vice versa. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-07-10refactor(lsp): move config file related code to config.rs (#19790)David Sherret
Will make #19788 easier.
2023-04-21refactor: move some CJS and ESM code analysis to ext/node (#18789)David Sherret
2023-03-27feat(core): initialize SQLite off-main-thread (#18401)Matt Mastracci
This gets SQLite off the flamegraph and reduces initialization time by somewhere between 0.2ms and 0.5ms. In addition, I took the opportunity to move all the cache management code to a single place and reduce duplication. While the PR has a net gain of lines, much of that is just being a bit more deliberate with how we're recovering from errors. The existing caches had various policies for dealing with cache corruption, so I've unified them and tried to isolate the decisions we make for recovery in a single place (see `open_connection` in `CacheDB`). The policy I chose was: 1. Retry twice to open on-disk caches 2. If that fails, try to delete the file and recreate it on-disk 3. If we fail to delete the file or re-create a new cache, use a fallback strategy that can be chosen per-cache: InMemory (temporary cache for the process run), BlackHole (ignore writes, return empty reads), or Error (fail on every operation). The caches all use the same general code now, and share the cache failure recovery policy. In addition, it cleans up a TODO in the `NodeAnalysisCache`.
2023-03-23refactor: make version and user_agent &'static str (#18400)Bartek Iwańczuk
These caused a bunch of unnecessary allocations on each startup.
2023-03-22perf: disable WAL for transpiled source cache (#18084)Bartek Iwańczuk
Disable Write-Ahead Log for the cached module source database. This brings SQLite connection cost on startup from 2.5% to 1.6%.
2023-03-21Revert "fix(cli) Better error messages on corrupt databases that aren… ↵Bartek Iwańczuk
(#18337) …'t automatically re-created (#18330)" This reverts commit 2ef8269fdb395b0736153ff5fbb9696cbb976e42. Printing these messages by default (instead of requiring `-L debug` flag) caused various tests to start printing it and mismatch in output assertions.
2023-03-21fix(cli) Better error messages on corrupt databases that aren't ↵Matt Mastracci
automatically re-created (#18330)
2023-02-03refactor: reland "preserve ProcState::file_fetcher between restarts" (#17636)Nayeem Rahman
Just some watcher init step that I thought would be "cloned over" but needs to be done again on reset.
2023-01-30Revert "fix(watch): preserve `ProcState::file_fetcher` between restarts ↵Bartek Iwańczuk
(#15466) (#17591) This reverts commit 3545bff678f20c3fdf17fe6b26f96cf1b74f917c.
2023-01-27chore: upgrade to Rust 1.67 (#17548)David Sherret
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27chore(cli/cache): fewer string allocations (#17549)Geert-Jan Zwiers
2023-01-10fix(watch): preserve `ProcState::file_fetcher` between restarts (#15466)Nayeem Rahman
This commit changes "ProcState" to store "file_fetcher" field in an "Arc", allowing it to be preserved between restarts and thus keeping the state alive between the restarts. File watchers for "deno test" and "deno bench" now reset "ProcState" between restarts.
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-11-23chore: more debug logging and avoid allocating strings in ts logging when ↵David Sherret
not debug (#16689)
2022-10-01perf: node cjs & esm analysis cache (#16097)David Sherret
This commit adds a cache for CJS and ESM analysis that is backed by an SQLite file. The connection to the DB is lazily created on first use, so shouldn't have impact on the startup time. Benched with running Vite Deno v1.26: ``` $ deno task dev Warning deno task is unstable and may drastically change in the future Task dev deno run -A --unstable --node-modules-dir npm:vite VITE v3.1.4 ready in 961 ms ➜ Local: http://localhost:5173/ ➜ Network: use --host to expose ``` This branch: ``` ../deno/target/release/deno task dev Warning deno task is unstable and may drastically change in the future Task dev deno run -A --unstable --node-modules-dir npm:vite VITE v3.1.4 ready in 330 ms ➜ Local: http://localhost:5173/ ➜ Network: use --host to expose ``` Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>