summaryrefslogtreecommitdiff
path: root/cli
AgeCommit message (Collapse)Author
2023-08-29refactor(init): simplify template (#20325)Ryan Dahl
- Don't include benchmark file - most people won't need this. - Use deno.json instead of deno.jsonc, because it's a more common file format.
2023-08-29chore(cli): use NPM_CONFIG_REGISTRY for all tests (#20320)Matt Mastracci
We never want tests to hit the real npm registry because this causes test flakes. In addition, we set a sentinal "unset" value for `NPM_CONFIG_REGISTRY` to ensure that all tests requiring npm go through the test server.
2023-08-29fix(ext/kv): don't panic if listening on queues and KV is not closed (#20317)Igor Zinkovsky
fixes #20312
2023-08-29feat(lockfile): add redirects to the lockfile (#20262)David Sherret
2023-08-29fix(lsp): recreate npm search cache when cache path changes (#20327)David Sherret
2023-08-29feat(lsp): npm specifier completions (#20121)Nayeem Rahman
2023-08-29fix(node/http): don't leak resources on destroyed request (#20040)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19828
2023-08-29fix(lsp): delete test modules with all tests deleted (#20321)Nayeem Rahman
Fixes https://github.com/denoland/vscode_deno/issues/899.
2023-08-29fix(ext/node): fix argv[1] in Worker (#20305)Yoshiya Hinosawa
2023-08-28refactor(runtime): factor out code between build.rs and worker.rs (#20299)Nayeem Rahman
Adds `runtime/shared.rs` which is imported by both `build.rs` and the rest of the crate, containing utilities used by both. Renames the `snapshot_from_snapshot` feature to `exclude_runtime_main_js` since that's what it does and it's relevant outside of snapshotting when `__runtime_js_sources` is specified.
2023-08-28fix(ext/node): shared global buffer unlock correctness fix (#20314)Matt Mastracci
The fix for #20188 was not entirely correct -- we were unlocking the global buffer incorrectly. This PR introduces a lock state that ensures we only unlock a lock we have taken out.
2023-08-28fix(ext/http): don't panic on stream responses in cancelled requests (#20316)Matt Mastracci
When a TCP connection is force-closed (ie: browser refresh), the underlying future we pass to Hyper is dropped which may cause us to try to drop the body resource while the OpState lock is still held. Preconditions for this bug to trigger: - The body resource must have been taken - The response must return a resource (which requires us to take the OpState lock) - The TCP connection must have been dropped before this Fixes #20315 and #20298
2023-08-28fix: unexpected lsp function arg comma completion (#20311)Marvin Hagemeister
2023-08-28fix(fmt/markdown): ignore trailing words in code block info string for ↵David Sherret
language detection (#20310)
2023-08-28fix(node/http): correctly send `Content-length` header instead of ↵osddeitf
`Transfer-Encoding: chunked` (#20127) Fix #20063.
2023-08-27test(bench): mark explicit timer test as flaky (#20304)Nayeem Rahman
https://github.com/denoland/deno/actions/runs/5990043261/job/16246927846?pr=18642 The test is just `b.start(); b.end()` where the time measured between must be less 10 μs during warmup. Can't improve it. Also fixes doc mistake.
2023-08-27feat(lint): --rules print all rules (#20256)sigmaSd
The motivation is If I'm using deno lint --rules, I want to see all the rules especially the one that have no tags, since the recommend ones are already active This change also prints the tags associated with the rule inline.
2023-08-27fix(lsp/testing): use full ancestry to compute static id of step (#20297)Nayeem Rahman
Fixes https://github.com/denoland/vscode_deno/issues/656. Test steps were ID'd by a checksum of `[origin, level, step_name]` which is incorrect. Now it's `[origin, ...ancestor_names, step_name]`.
2023-08-26chore: 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-26fix(kv) increase number of allowed mutations in atomic (#20126)Igor Zinkovsky
fixes #19741 Impose a limit on the total atomic payload size
2023-08-26chore(core): bump and trim deps (#20265)Matt Mastracci
Skipping for a later follow-up: - base64: #20266 - notify - indexmap (will require follow-up in upstream projects)
2023-08-26fix(bench): explicit timers don't force high precision measurements (#20272)Nayeem Rahman
Disables `BenchContext::start()` and `BenchContext::end()` for low precision benchmarks (less than 0.01s per iteration). Prints a warning when they are used in such benchmarks, suggesting to remove them. ```ts Deno.bench("noop", { group: "noops" }, () => {}); Deno.bench("noop with start/end", { group: "noops" }, (b) => { b.start(); b.end(); }); ``` Before: ``` cpu: 12th Gen Intel(R) Core(TM) i9-12900K runtime: deno 1.36.2 (x86_64-unknown-linux-gnu) file:///home/nayeem/projects/deno/temp3.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------- ----------------------------- noop 2.63 ns/iter 380,674,131.4 (2.45 ns … 27.78 ns) 2.55 ns 4.03 ns 5.33 ns noop with start and end 302.47 ns/iter 3,306,146.0 (200 ns … 151.2 µs) 300 ns 400 ns 400 ns summary noop 115.14x faster than noop with start and end ``` After: ``` cpu: 12th Gen Intel(R) Core(TM) i9-12900K runtime: deno 1.36.1 (x86_64-unknown-linux-gnu) file:///home/nayeem/projects/deno/temp3.ts benchmark time (avg) iter/s (min … max) p75 p99 p995 ----------------------------------------------------------------------------- ----------------------------- noop 3.01 ns/iter 332,565,561.7 (2.73 ns … 29.54 ns) 2.93 ns 5.29 ns 7.45 ns noop with start and end 7.73 ns/iter 129,291,091.5 (6.61 ns … 46.76 ns) 7.87 ns 13.12 ns 15.32 ns Warning start() and end() calls in "noop with start and end" are ignored because it averages less than 0.01s per iteration. Remove them for better results. summary noop 2.57x faster than noop with start and end ```
2023-08-26fix(node): propagate create cipher errors (#20280)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19002
2023-08-26fix(lsp): implement deno.suggest.completeFunctionCalls (#20214)Nayeem Rahman
Fixes https://github.com/denoland/vscode_deno/issues/743. ```ts const items: string[] = ['foo', 'bar', 'baz']; items.map // -> items.map(callbackfn) // auto-completes with argument placeholders. ``` --- We have our own setting for `suggest.completeFunctionCalls`, which must be enabled: ```js { "deno.suggest.completeFunctionCalls": true, // Re-implementation of: // "javascript.suggest.completeFunctionCalls": true, // "typescript.suggest.completeFunctionCalls": true, } ``` But before this commit the actual implementation had been left as a TODO.
2023-08-26feat(lsp): update imports on file rename (#20245)Nayeem Rahman
Closes https://github.com/denoland/vscode_deno/issues/410.
2023-08-26feat(cli/tools): add TAP test reporter (#14390) (#20073)Valentin Anger
This PR adds a test reporter for the [Test Anything Protocol](https://testanything.org). It makes the following implementation decisions: - No TODO pragma, as there is no such marker in `Deno.test` - SKIP pragma for `ignore`d tests - Test steps are treated as TAP14 subtests - Support for this in consumers seems spotty - Some consumers will incorrectly interpret these markers, resulting in unexpected output - Considering the lack of support, and to avoid implementation complexity, subtests are at most one level deep (all test steps are in the same subtest) - To accommodate consumers that use comments to indicate test-suites (unspecced) - The test module path is output as a comment - This is disabled for `--parallel` testing - Failure diagnostics are output as JSON, which is also valid YAML - The structure is not specified, so the format roughly follows the spec example: ``` --- message: "Failed with error 'hostname peebles.example.com not found'" severity: fail found: hostname: 'peebles.example.com' address: ~ wanted: hostname: 'peebles.example.com' address: '85.193.201.85' at: file: test/dns-resolve.c line: 142 ... ```
2023-08-25fix(ext/tls): upgrade webpki version (#20285)Matt Mastracci
This removes a webpki version that was showing up as vulnerable to https://github.com/briansmith/webpki/issues/69. Needed to upgrade `reqwest` as part of this.
2023-08-25fix(lsp): test explorer panic on step result (#20289)Nayeem Rahman
Fixes https://github.com/denoland/vscode_deno/issues/843. Prevents step results from being reported twice. Refactors `LspTestReporter` to use a complete `(test_id, descriptor)` map instead of a brittle `LspTestReporter::stack`.
2023-08-25chore: fully remove atty dep (#20288)Matt Mastracci
This fully removes the `atty` crate from deno by bumping `env_logger` and removing the now-unused `atty` dep for runtime.
2023-08-25chore(cli): remove atty crate (#20275)Matt Mastracci
Removes a crate with an outstanding vulnerability.
2023-08-25fix(lsp/testing): don't queue modules without tests (#20277)Nayeem Rahman
Fixes https://github.com/denoland/vscode_deno/issues/890.
2023-08-24chore: forward v1.36.3 release commit to main (#20270)denobot
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24build(deps): bump trust-dns-server from 0.22.0 to 0.22.1 (#20114)dependabot[bot]
Bumps [trust-dns-server](https://github.com/bluejekyll/trust-dns) from 0.22.0 to 0.22.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/bluejekyll/trust-dns/releases">trust-dns-server's releases</a>.</em></p> <blockquote> <h2>v0.22.1 - Deny response requests on the server</h2> <h2>0.22.1</h2> <h3>Fixed</h3> <ul> <li>(server) drop response messages <a href="https://redirect.github.com/bluejekyll/trust-dns/issues/1952">#1952</a> by <a href="https://github.com/djc"><code>@​djc</code></a></li> </ul> </blockquote> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/bluejekyll/trust-dns/blob/main/CHANGELOG.md">trust-dns-server's changelog</a>.</em></p> <blockquote> <h2>0.22.1</h2> <h3>Fixed</h3> <ul> <li>(server) drop response messages <a href="https://redirect.github.com/bluejekyll/trust-dns/issues/1952">#1952</a> by <a href="https://github.com/djc"><code>@​djc</code></a></li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/bluejekyll/trust-dns/commit/9f344b54cdd90cd1fe435c603c5b97fb32eda3f2"><code>9f344b5</code></a> bump server and bin crates to 0.22.1</li> <li><a href="https://github.com/bluejekyll/trust-dns/commit/9e6e77293bc75f961695eb95fb23d2a56600de87"><code>9e6e772</code></a> update CHANGELOG for 0.22.1</li> <li><a href="https://github.com/bluejekyll/trust-dns/commit/5f6278154d4ceaec11ae6c1f91222faa7bd43838"><code>5f62781</code></a> Regenerate the test SSL certificates</li> <li><a href="https://github.com/bluejekyll/trust-dns/commit/2fd26031711b00ec0c88aa88044716ffb2f0ef94"><code>2fd2603</code></a> server: drop response messages</li> <li>See full diff in <a href="https://github.com/bluejekyll/trust-dns/compare/v0.22.0...v0.22.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=trust-dns-server&package-manager=cargo&previous-version=0.22.0&new-version=0.22.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/denoland/deno/network/alerts). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-24refactor: use "deno_config" crate (#20260)Bartek Iwańczuk
Moved the configuration file to https://github.com/denoland/deno_config as we will have to use it in other projects.
2023-08-23fix(ext/web): add stream tests to detect v8slice split bug (#20253)Matt Mastracci
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23fix: add missing `URL.canParse()` types (#20244)Asher Gomez
Reference: https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static
2023-08-22fix(ext/web): better handling of errors in resourceForReadableStream (#20238)Matt Mastracci
Improves error handling when the Resource is closed in various phases of the ReadableStream. Ensure that we send a consistent `cancel` reason.
2023-08-22fix(ext/node): simultaneous reads can leak into each other (#20223)Matt Mastracci
Reported in #20188 This was caused by re-use of a global buffer `BUF` during simultaneous async reads.
2023-08-22fix(cli): add timeout on inspector tests (#20225)Matt Mastracci
I believe this test locked up on this run below: https://github.com/denoland/deno/actions/runs/5928630684/job/16074661291
2023-08-22fix(lint): erroneous remove await in async (#20235)David Sherret
Closes #20229
2023-08-22feat(ext/kv): connect to remote database (#20178)Heyang Zhou
This patch adds a `remote` backend for `ext/kv`. This supports connection to Deno Deploy and potentially other services compatible with the KV Connect protocol.
2023-08-21refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193)David Sherret
2023-08-21feat(unstable): Improve FFI types (#20215)Aapo Alasuutari
Few improvements to FFI types: 1. Export `PointerObject` for convenience. It's fairly commonly used in library code and thus should be exported. 2. Fix various comments around `PointerValue` and `UnsafePointer` and expand upon them to better reflect reality. 3. Instead of using a `Record<"value", type>[T]` for determining the type of an FFI symbol parameter use direct `T extends "value" ? type : never` comparison. The last part enables smuggling extra information into the parameter and return value string declarations at the type level. eg. Instead of just `"u8"` the parameter can be `"u8" & { [brand]: T }` for some `T extends number`. That `T` can then be extracted from the parameter to form the TypeScript function's parameter or return value type. Essentially, this enables type-safe FFI! The foremost use-cases for this are enums and pointer safety. These are implemented in the second commit which should enable, in a backwards compatible way, for pointer parameters to declare what sort of pointer they mean, functions to declare what the API definition of the native function is, and for numbers to declare what Enum they stand for (if any).
2023-08-21fix(ext/http): ensure request body resource lives as long as response is ↵Matt Mastracci
alive (#20206) Deno.serve's fast streaming implementation was not keeping the request body resource ID alive. We were taking the `Rc<Resource>` from the resource table during the response, so a hairpin duplex response that fed back the request body would work. However, if any JS code attempted to read from the request body (which requires the resource ID to be valid), the response would fail with a difficult-to-diagnose "EOF" error. This was affecting more complex duplex uses of `Deno.fetch` (though as far as I can tell was unreported). Simple test: ```ts const reader = request.body.getReader(); return new Response( new ReadableStream({ async pull(controller) { const { done, value } = await reader.read(); if (done) { controller.close(); } else { controller.enqueue(value); } }, }), ``` And then attempt to use the stream in duplex mode: ```ts async function testDuplex( reader: ReadableStreamDefaultReader<Uint8Array>, writable: WritableStreamDefaultWriter<Uint8Array>, ) { await writable.write(new Uint8Array([1])); const chunk1 = await reader.read(); assert(!chunk1.done); assertEquals(chunk1.value, new Uint8Array([1])); await writable.write(new Uint8Array([2])); const chunk2 = await reader.read(); assert(!chunk2.done); assertEquals(chunk2.value, new Uint8Array([2])); await writable.close(); const chunk3 = await reader.read(); assert(chunk3.done); } ``` In older versions of Deno, this would just lock up. I believe after 23ff0e722e3c4b0827940853c53c5ee2ede5ec9f, it started throwing a more explicit error: ``` httpServerStreamDuplexJavascript => ./cli/tests/unit/serve_test.ts:1339:6 error: TypeError: request or response body error: error reading a body from connection: Connection reset by peer (os error 54) at async Object.pull (ext:deno_web/06_streams.js:810:27) ```
2023-08-19chore: remove third_party submodule (#20201)Divy Srivastava
removes third_party submodule, tools are installed on-demand. - removed `load_test` and websocket benchmark (covered by benchy) - removed node/bun http benchmarks (covered by benchy) - `dlint` & `dprint` downloaded on-demand. - `wrk` & `hyperfine` downloaded before CI benchmark run. Install locally using: `./tools/install_prebuilt.js wrk hyperfine` #### updating dlint/dprint update version in `tools/util.js` and place binary in `denoland/deno_third_party`.
2023-08-18ci: try to fix flaky stdio_streams_are_locked_in_permission_prompt (#20204)David Sherret
2023-08-18fix(node/http): emit error when addr in use (#20200)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/20186
2023-08-18feat(ext/kv): key expiration (#20091)Heyang Zhou
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-08-17fix(test): JUnit reporter includes file, line and column attributes (#20174)Alexander Michaud
Closes #20156
2023-08-17fix(unstable): disable importing from the vendor directory (#20067)David Sherret
Some people might get think they need to import from this directory, which could cause confusion and duplicate dependencies. Additionally, the `vendor` directory has special behaviour in the language server, so importing from the folder will definitely cause confusion and issues there.