summaryrefslogtreecommitdiff
path: root/cli/util/mod.rs
AgeCommit message (Collapse)Author
2024-10-15fix(install): retry downloads of registry info / tarballs (#26278)Nathan Whitaker
Fixes #26085. Adds a basic retry utility with some defaults, starts off with a 100ms wait, then 250ms, then 500ms I've applied the retry in the http client, reusing an existing function, so this also applies to retrying downloads of deno binaries in `upgrade` and `compile`. I can make a separate function that doesn't retry so this doesn't affect `upgrade` and `compile`, but it seemed desirable to have retries there too, so I left it in.
2024-09-17feat(cli): evaluate code snippets in JSDoc and markdown (#25220)Yusuke Tanaka
This commit lets `deno test --doc` command actually evaluate code snippets in JSDoc and markdown files. ## How it works 1. Extract code snippets from JSDoc or code fences 2. Convert them into pseudo files by wrapping them in `Deno.test(...)` 3. Register the pseudo files as in-memory files 4. Run type-check and evaluation We apply some magic at the step 2 - let's say we have the following file named `mod.ts` as an input: ````ts /** * ```ts * import { assertEquals } from "jsr:@std/assert/equals"; * * assertEquals(add(1, 2), 3); * ``` */ export function add(a: number, b: number) { return a + b; } ```` This is virtually transformed into: ```ts import { assertEquals } from "jsr:@std/assert/equals"; import { add } from "files:///path/to/mod.ts"; Deno.test("mod.ts$2-7.ts", async () => { assertEquals(add(1, 2), 3); }); ``` Note that a new import statement is inserted here to make `add` function available. In a nutshell, all items exported from `mod.ts` become available in the generated pseudo file with this automatic import insertion. The intention behind this design is that, from library user's standpoint, it should be very obvious that this `add` function is what this example code is attached to. Also, if there is an explicit import statement like `import { add } from "./mod.ts"`, this import path `./mod.ts` is not helpful for doc readers because they will need to import it in a different way. The automatic import insertion has some edge cases, in particular where there is a local variable in a snippet with the same name as one of the exported items. This case is addressed by employing swc's scope analysis (see test cases for more details). ## "type-checking only" mode stays around This change will likely impact a lot of existing doc tests in the ecosystem because some doc tests rely on the fact that they are not evaluated - some cause side effects if executed, some throw errors at runtime although they do pass the type check, etc. To help those tests gradually transition to the ones runnable with the new `deno test --doc`, we will keep providing the ability to run type-checking only via `deno check --doc`. Additionally there is a `--doc-only` option added to the `check` subcommand too, which is useful when you want to type-check on code snippets in markdown files, as normal `deno check` command doesn't accept markdown. ## Demo https://github.com/user-attachments/assets/47e9af73-d16e-472d-b09e-1853b9e8f5ce --- Closes #4716
2024-08-08fix: Don't shell out to `unzip` in deno upgrade/compile (#24926)Nathan Whitaker
Use the `zip` crate instead Fixes #23988.
2024-07-08fix(workspace): better cli file argument handling (#24447)David Sherret
Closes https://github.com/denoland/deno/issues/24422
2024-07-05refactor: move `FileCollector` to deno_config (#24433)David Sherret
2024-07-04feat: npm workspace and better Deno workspace support (#24334)David Sherret
Adds much better support for the unstable Deno workspaces as well as support for npm workspaces. npm workspaces is still lacking in that we only install packages into the root node_modules folder. We'll make it smarter over time in order for it to figure out when to add node_modules folders within packages. This includes a breaking change in config file resolution where we stop searching for config files on the first found package.json unless it's in a workspace. For the previous behaviour, the root deno.json needs to be updated to be a workspace by adding `"workspace": ["./path-to-pkg-json-folder-goes-here"]`. See details in https://github.com/denoland/deno_config/pull/66 Closes #24340 Closes #24159 Closes #24161 Closes #22020 Closes #18546 Closes #16106 Closes #24160
2024-05-23refactor: remove custom `utc_now` in favor of `chrono::Utc:now` feature ↵Felipe Baltor
(#23888) This PR removes the use of the custom `utc_now` function in favor of the `chrono` implementation. It resolves #22864. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-05-09refactor(lsp): Have JS drive TSC event loop in LSP (#23565)Nathan Whitaker
2024-03-07fix(publish): make include and exclude work (#22720)David Sherret
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-02-27feat(publish): support sloppy imports and bare node built-ins (#22588)Luca Casonato
2024-01-15refactor: use globbing from deno_config (#21925)David Sherret
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-11-23feat(unstable): tar up directory with deno.json (#21228)Bartek Iwańczuk
Co-authored-by: David Sherret <dsherret@gmail.com> Co-authored-by: Luca Casonato <lucacasonato@yahoo.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-06-13fix(lsp): don't pre-load documents matched in the config file's "exclude" ↵David Sherret
(#19431) This prevents documents specified in a deno.json's "exclude" from being pre-loaded by the lsp. For example, someone may have something like: ```jsonc // deno.json { "exclude": [ "dist" // build directory ] } ```
2023-04-11fix(npm): do not "npm install" when npm specifier happens to match ↵David Sherret
package.json entry (#18660)
2023-03-15perf: do not depend on iana-time-zone (#18088)Divy Srivastava
Chrono's `clock` feature pulls in `iana-time-zone` which links to macOS core_foundation. This PR itself is not enough to get rid of CoreFoundation. Removal depends on getting rid of security framework, see #18071
2023-01-25feat(cli): add `DENO_V8_FLAGS` env var (#17313)Leo Kettmeir
Closes #5669
2023-01-02chore: update copyright year to 2023 (#17247)David Sherret
Yearly tradition of creating extra noise in git.
2022-12-19refactor(progress bars): global control for drawing (#17091)David Sherret
This PR adds the concept of a global `DrawThread`, which can receive multiple renderers to draw information on the screen (note: the underlying thread is released back to tokio when it's not rendering). It also separates the concept of progress bars from the existing "draw thread". This makes it trivial for us to do stuff like show permission prompts and progress bars at the same time in the future. The reason this is global is because the process' tty stderr is also a global concept.
2022-12-12feat: improve download progress bar (#16984)Bartek Iwańczuk
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-28refactor: create util folder, move nap_sym to napi/sym, move http_cache to ↵David Sherret
cache folder (#16857)