1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

5238 commits

Author SHA1 Message Date
zuisong
4a561f12db
fix(node/child_process): don't crash on undefined/null value of an env var (#20378)
Fixes #20373

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-05 12:42:35 +02:00
Bartek Iwańczuk
2a1ba2732e
chore: disable 'test-http-content-length.js` test (#20344) 2023-09-04 23:23:01 +02:00
Bartek Iwańczuk
9e243d22f4
Revert "refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303) (#20370)
This reverts commit
83426be6ee.

Includes a regression test.
2023-09-04 17:05:06 -04:00
Nayeem Rahman
12f6ad32c2
fix(lsp): properly handle disabled configuration requests (#20358)
Fixes #19802.

Properly respect when clients do not have the `workspace/configuration`
capability, a.k.a. when an editor cannot provide scoped settings on
request from the LSP.

- Fix one spot where we weren't checking for the capability before
sending this request.
- For `enablePaths`, fall back to the settings passed in the
initialization options in more cases.
- Respect the `workspace/configuration` capability in the test harness
client.

See:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration.
2023-09-02 16:36:04 +01:00
Nayeem Rahman
e1fb48524d
Reland "feat(lsp): enable via config file detection (#20334)" (#20349) 2023-09-01 21:13:13 +01:00
Bartek Iwańczuk
2b191c6e9d
chore: forward v1.36.4 to main (#20352)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
2023-09-01 18:08:58 +00:00
Bartek Iwańczuk
a74554987a
Revert "feat(lsp): enable via config file detection (#20334)" (#20347)
This reverts commit c0dcf6a357.

CC @nayeemrmn
2023-09-01 12:01:20 +00:00
Nayeem Rahman
c0dcf6a357
feat(lsp): enable via config file detection (#20334)
With https://github.com/denoland/vscode_deno/pull/902 for
https://github.com/denoland/vscode_deno/issues/880.

For multi-folder workspaces, note that this only scans the first one and
applies the result to all. That means users would have to still have to
specify `"deno.enable": true/false` for their secondary folders if the
preference is different for those.
2023-08-31 19:10:09 +01:00
Nayeem Rahman
1cce306022
fix(runtime/permissions): Resolve executable specifiers in allowlists and queries (#14130)
Closes #14122.

Adds two extensions to `--allow-run` behaviour:
- When `--allow-run=foo` is specified and `foo` is found in the `PATH`
at startup, `RunDescriptor::Path(which("foo"))` is added to the
allowlist alongside `RunDescriptor::Name("foo")`. Currently only the
latter is.
- When run permission for `foo` is queried and `foo` is found in the
`PATH` at runtime, either `RunDescriptor::Path(which("foo"))` or
`RunDescriptor::Name("foo")` would qualify in the allowlist. Currently
only the latter does.
2023-08-30 18:52:01 +01:00
Nayeem Rahman
d28384c3de
refactor(lsp): store test definitions in adjacency list (#20330)
Previously:
```rust
pub struct TestDefinition {
  pub id: String,
  pub name: String,
  pub range: SourceRange,
  pub steps: Vec<TestDefinition>,
}

pub struct TestDefinitions {
  pub discovered: Vec<TestDefinition>,
  pub injected: Vec<lsp_custom::TestData>,
  pub script_version: String,
}
```
Now:
```rust
pub struct TestDefinition {
  pub id: String,
  pub name: String,
  pub range: Option<Range>,
  pub is_dynamic: bool, // True for 'injected' module, not statically detected but added at runtime.
  pub parent_id: Option<String>,
  pub step_ids: HashSet<String>,
}

pub struct TestModule {
  pub specifier: ModuleSpecifier,
  pub script_version: String,
  pub defs: HashMap<String, TestDefinition>,
}
```

Storing the test tree as a literal tree diminishes the value of IDs,
even though vscode stores them that way. This makes all data easily
accessible from `TestModule`. It unifies the interface between
'discovered' and 'injected' tests. This unblocks some enhancements wrt
syncing tests between the LSP and extension, such as this TODO:
61f08d5a71/client/src/testing.ts (L251-L259)
and https://github.com/denoland/vscode_deno/issues/900. We should also
get more flexibility overall.

`TestCollector` is cleaned up, now stores a `&mut TestModule` directly
and registers tests as it comes across them with
`TestModule::register()`. This method ensures sanity in the redundant
data from having both of `TestDefinition::{parent_id,step_ids}`.

All of the messy conversions between `TestDescription`,
`LspTestDescription`, `TestDefinition`, `TestData` and `TestIdentifier`
are cleaned up. They shouldn't have been using `impl From` and now the
full list of tests is available to their implementations.
2023-08-30 16:31:31 +01:00
Divy Srivastava
329698cf73
fix(napi): ignore tsfn recv error (#20324)
Ref https://github.com/denoland/deno/issues/20072
2023-08-30 09:04:55 +05:30
Ryan Dahl
f76bfbbe33
refactor(init): simplify template (#20325)
- 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-29 19:58:56 +00:00
Matt Mastracci
64045ebc7a
chore(cli): use NPM_CONFIG_REGISTRY for all tests (#20320)
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-29 13:02:54 -06:00
Igor Zinkovsky
441b860978
fix(ext/kv): don't panic if listening on queues and KV is not closed (#20317)
fixes #20312
2023-08-29 11:24:44 -07:00
David Sherret
c4451d3076
feat(lockfile): add redirects to the lockfile (#20262) 2023-08-29 12:03:02 -05:00
David Sherret
bdc91211b0
fix(lsp): recreate npm search cache when cache path changes (#20327) 2023-08-29 16:24:19 +00:00
Nayeem Rahman
b5f032df73
feat(lsp): npm specifier completions (#20121) 2023-08-29 10:22:05 -05:00
Bartek Iwańczuk
2929313652
fix(node/http): don't leak resources on destroyed request (#20040)
Closes https://github.com/denoland/deno/issues/19828
2023-08-29 12:13:58 +00:00
Nayeem Rahman
c31c93ce70
fix(lsp): delete test modules with all tests deleted (#20321)
Fixes https://github.com/denoland/vscode_deno/issues/899.
2023-08-29 09:43:11 +01:00
Yoshiya Hinosawa
fb7092fb43
fix(ext/node): fix argv[1] in Worker (#20305) 2023-08-29 12:18:25 +09:00
Nayeem Rahman
bd034e360d
refactor(runtime): factor out code between build.rs and worker.rs (#20299)
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-28 15:30:46 -06:00
Matt Mastracci
7adaf613bf
fix(ext/node): shared global buffer unlock correctness fix (#20314)
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-28 15:28:39 -06:00
Matt Mastracci
9198bbd454
fix(ext/http): don't panic on stream responses in cancelled requests (#20316)
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-28 13:29:34 -06:00
Marvin Hagemeister
539e5032d3
fix: unexpected lsp function arg comma completion (#20311) 2023-08-28 17:07:22 +02:00
David Sherret
ebfead1021
fix(fmt/markdown): ignore trailing words in code block info string for language detection (#20310) 2023-08-28 12:28:06 +00:00
osddeitf
c2547ba039
fix(node/http): correctly send Content-length header instead of Transfer-Encoding: chunked (#20127)
Fix #20063.
2023-08-28 09:32:54 +02:00
Nayeem Rahman
f826574873
test(bench): mark explicit timer test as flaky (#20304)
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-27 22:22:23 +02:00
sigmaSd
916ddcef6d
feat(lint): --rules print all rules (#20256)
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-27 11:17:41 +02:00
Nayeem Rahman
e1fe31508c
fix(lsp/testing): use full ancestry to compute static id of step (#20297)
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-27 11:16:09 +02: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
Igor Zinkovsky
e4cebf3e0d
fix(kv) increase number of allowed mutations in atomic (#20126)
fixes #19741

Impose a limit on the total atomic payload size
2023-08-26 18:26:09 -07:00
Matt Mastracci
d104a09f79
chore(core): bump and trim deps (#20265)
Skipping for a later follow-up:

 - base64: #20266
 - notify
 - indexmap (will require follow-up in upstream projects)
2023-08-26 07:10:42 -06:00
Nayeem Rahman
5dbf5c8293
fix(bench): explicit timers don't force high precision measurements (#20272)
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-26 11:29:45 +02:00
Divy Srivastava
1cb547d885
fix(node): propagate create cipher errors (#20280)
Fixes https://github.com/denoland/deno/issues/19002
2023-08-26 10:45:37 +05:30
Nayeem Rahman
37292e74e1
fix(lsp): implement deno.suggest.completeFunctionCalls (#20214)
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-26 02:53:44 +02:00
Nayeem Rahman
6f077ebb07
feat(lsp): update imports on file rename (#20245)
Closes https://github.com/denoland/vscode_deno/issues/410.
2023-08-26 02:50:47 +02:00
Valentin Anger
a526cff0a9
feat(cli/tools): add TAP test reporter (#14390) (#20073)
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-26 01:19:23 +02:00
Matt Mastracci
8bb4e10881
fix(ext/tls): upgrade webpki version (#20285)
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-25 23:40:25 +02:00
Nayeem Rahman
907d9bb4d7
fix(lsp): test explorer panic on step result (#20289)
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-25 23:32:22 +02:00
Matt Mastracci
fd70b7025b
chore: fully remove atty dep (#20288)
This fully removes the `atty` crate from deno by bumping `env_logger`
and removing the now-unused `atty` dep for runtime.
2023-08-25 17:40:21 +00:00
Matt Mastracci
c272d26ae8
chore(cli): remove atty crate (#20275)
Removes a crate with an outstanding vulnerability.
2023-08-25 07:43:07 -06:00
Nayeem Rahman
9e31f9452e
fix(lsp/testing): don't queue modules without tests (#20277)
Fixes https://github.com/denoland/vscode_deno/issues/890.
2023-08-25 11:12:11 +02:00
denobot
3a2d284c96
chore: forward v1.36.3 release commit to main (#20270)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-24 17:53:01 +00:00
dependabot[bot]
a47c160cbc
build(deps): bump trust-dns-server from 0.22.0 to 0.22.1 (#20114)
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="9f344b54cd"><code>9f344b5</code></a>
bump server and bin crates to 0.22.1</li>
<li><a
href="9e6e77293b"><code>9e6e772</code></a>
update CHANGELOG for 0.22.1</li>
<li><a
href="5f6278154d"><code>5f62781</code></a>
Regenerate the test SSL certificates</li>
<li><a
href="2fd2603171"><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-24 09:10:26 -06:00
Bartek Iwańczuk
f9beb92818
refactor: use "deno_config" crate (#20260)
Moved the configuration file to https://github.com/denoland/deno_config
as we will have to use it in other projects.
2023-08-24 11:21:34 +02:00
Matt Mastracci
b1ce2e4167
fix(ext/web): add stream tests to detect v8slice split bug (#20253)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-23 17:03:05 -06:00
Asher Gomez
af1b794e53
fix: add missing URL.canParse() types (#20244)
Reference:
https://developer.mozilla.org/en-US/docs/Web/API/URL/canParse_static
2023-08-23 09:31:13 +02:00
Matt Mastracci
9b01307704
fix(ext/web): better handling of errors in resourceForReadableStream (#20238)
Improves error handling when the Resource is closed in various phases of
the ReadableStream. Ensure that we send a consistent `cancel` reason.
2023-08-22 16:16:34 -06:00
Matt Mastracci
c37b9655b6
fix(ext/node): simultaneous reads can leak into each other (#20223)
Reported in #20188

This was caused by re-use of a global buffer `BUF` during simultaneous
async reads.
2023-08-22 14:45:10 +00:00
Matt Mastracci
792dc75471
fix(cli): add timeout on inspector tests (#20225)
I believe this test locked up on this run below:

https://github.com/denoland/deno/actions/runs/5928630684/job/16074661291
2023-08-22 07:25:38 -06:00
David Sherret
8649648b43
fix(lint): erroneous remove await in async (#20235)
Closes #20229
2023-08-22 12:16:35 +02:00
Heyang Zhou
6d4a005e41
feat(ext/kv): connect to remote database (#20178)
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-22 13:56:00 +08:00
David Sherret
5834d282d4
refactor: upgrade deno_ast 0.28 and deno_semver 0.4 (#20193) 2023-08-21 09:53:52 +00:00
Aapo Alasuutari
af125c8e70
feat(unstable): Improve FFI types (#20215)
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-21 13:36:26 +05:30
Matt Mastracci
576d0db372
fix(ext/http): ensure request body resource lives as long as response is 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
23ff0e722e, 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-21 01:35:26 +00:00
Divy Srivastava
c2259f78eb
chore: remove third_party submodule (#20201)
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-19 09:56:12 +05:30
David Sherret
0e4469c7a1
ci: try to fix flaky stdio_streams_are_locked_in_permission_prompt (#20204) 2023-08-18 11:01:41 -04:00
Bartek Iwańczuk
a48ec1d563
fix(node/http): emit error when addr in use (#20200)
Closes https://github.com/denoland/deno/issues/20186
2023-08-18 13:48:18 +02:00
Heyang Zhou
c77c836a23
feat(ext/kv): key expiration (#20091)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-08-18 17:34:16 +08:00
Alexander Michaud
b5839eefcf
fix(test): JUnit reporter includes file, line and column attributes (#20174)
Closes #20156
2023-08-17 23:41:29 +02:00
David Sherret
f343391a9f
fix(unstable): disable importing from the vendor directory (#20067)
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.
2023-08-17 16:14:22 +00:00
David Sherret
6082e51094
fix(cli): handle missing now field in cache (#20192)
Fixes this error message:

```
error: missing field `now` at line 32 column 1
```

This would occur if someone used an old version of the deno_cache
library to cache information in the cache then tried to load it with the
latest CLI. Regression in the last patch when migrating to the
deno_cache_dir crate.
2023-08-17 15:25:00 +00:00
Nayeem Rahman
6de35e4b2e
fix(lsp): pass fmt options to completion requests (#20184)
Fixes https://github.com/denoland/vscode_deno/issues/856.
2023-08-17 10:46:11 -04:00
David Sherret
4535f79a4a
fix(npm): do not panic providing file url to require.resolve paths (#20182)
Closes #19922
2023-08-17 10:39:06 -04:00
Matt Mastracci
23ff0e722e
feat(ext/web): resourceForReadableStream (#20180)
Extracted from fast streams work.

This is a resource wrapper for `ReadableStream`, allowing us to treat
all `ReadableStream` instances as resources, and remove special paths in
both `fetch` and `serve`.

Performance with a ReadableStream response yields ~18% improvement:

```
  return new Response(new ReadableStream({
    start(controller) {
      controller.enqueue(new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]));
      controller.close();
    }
  })
```

This patch:

```
12:36 $ third_party/prebuilt/mac/wrk http://localhost:8080
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    99.96us  100.03us   6.65ms   98.84%
    Req/Sec    47.73k     2.43k   51.02k    89.11%
  959308 requests in 10.10s, 117.10MB read
Requests/sec:  94978.71
Transfer/sec:     11.59MB
```

main:

```
Running 10s test @ http://localhost:8080
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   163.03us  685.51us  19.73ms   99.27%
    Req/Sec    39.50k     3.98k   66.11k    95.52%
  789582 requests in 10.10s, 82.83MB read
Requests/sec:  78182.65
Transfer/sec:      8.20MB
```
2023-08-17 07:52:37 -06:00
Heyang Zhou
0960e895da
fix(ext/kv): retry transaction on SQLITE_BUSY errors (#20189)
Properly handle the `SQLITE_BUSY` error code by retrying the
transaction.

Also wraps database initialization logic in a transaction to protect
against incomplete/concurrent initializations.

Fixes https://github.com/denoland/deno/issues/20116.
2023-08-17 18:53:55 +08:00
Marcos Casagrande
ec63b36994
perf(ext/event): optimize Event constructor (#20181)
This PR optimizes `Event` constructor

- ~Added a fast path for empty `eventInitDict`~ Removed `EventInit`
dictionary converter
- Don't make `isTrusted` a
[LegacyUnforgeable](https://webidl.spec.whatwg.org/#LegacyUnforgeable)
property. Doing so makes it non-spec compliant but calling
`Object/Reflect.defineProperty` on the constructor is a big bottleneck.
Node did the same a few months ago
https://github.com/nodejs/node/pull/46974. In my opinion, the
performance gains are worth deviating from the spec for a
browser-related property.

**This PR**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init      36.69 ns/iter  27,257,504.6   (33.36 ns … 42.45 ns)  37.71 ns  39.61 ns  40.07 ns
event constructor               36.7 ns/iter  27,246,776.6   (33.35 ns … 56.03 ns)  37.73 ns  40.14 ns  41.74 ns
```

**main**

```
cpu: 13th Gen Intel(R) Core(TM) i9-13900H
runtime: deno 1.36.1 (x86_64-unknown-linux-gnu)

benchmark                      time (avg)        iter/s             (min … max)       p75       p99      p995
------------------------------------------------------------------------------- -----------------------------
event constructor no init     380.48 ns/iter   2,628,275.8 (366.66 ns … 399.39 ns) 384.58 ns 398.27 ns 399.39 ns
event constructor             480.33 ns/iter   2,081,882.6 (466.67 ns … 503.47 ns) 484.27 ns 501.28 ns 503.47 ns
```

```js
Deno.bench("event constructor no init", () => {
  const event = new Event("foo");
});

Deno.bench("event constructor", () => {
  const event = new Event("foo", { bubbles: true, cancelable: false });
});
```

towards https://github.com/denoland/deno/issues/20167
2023-08-17 10:35:18 +02:00
Leo Kettmeir
1b0e394d48
fix: release ReadeableStream in fetch (#17365)
Fixes #16648

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-08-16 14:02:15 +02:00
Evan
79d1445796
fix(ext/node): allow for the reassignment of userInfo() on Windows (#20165)
The goal of this PR is to address issue #20106 where a `TypeError`
occurs when the variables `uid` and `gid` from `userInfo()` in `node:os`
are reassigned if the user is on Windows. Both `uid` and `gid` are
marked as `const` therefore producing a `TypeError` when the two are
reassigned.

This PR achieves that goal by marking `uid` and `gid` as `let`
2023-08-16 11:28:49 +02:00
Matt Mastracci
71d2f4cb97
fix(runtime): use host header for inspector websocket URL (#20171)
If a `host` header is specified, use that for the generated websocket
URLs.

Fixes #20087
2023-08-15 22:30:33 +00:00
Matt Mastracci
4380a09a05
feat(ext/node): eagerly bootstrap node (#20153)
To fix bugs around detection of when node emulation is required, we will
just eagerly initialize it. The improvements we make to reduce the
impact of the startup time:

 - [x] Process stdin/stdout/stderr are lazily created
 - [x] node.js global proxy no longer allocates on each access check
- [x] Process checks for `beforeExit` listeners before doing expensive
shutdown work
- [x] Process should avoid adding global event handlers until listeners
are added

Benchmarking this PR (`89de7e1ff`) vs main (`41cad2179`)

```
12:36 $ third_party/prebuilt/mac/hyperfine --warmup 100 -S none './deno-41cad2179 run ./empty.js' './deno-89de7e1ff run ./empty.js'
Benchmark 1: ./deno-41cad2179 run ./empty.js
  Time (mean ± σ):      24.3 ms ±   1.6 ms    [User: 16.2 ms, System: 6.0 ms]
  Range (min … max):    21.1 ms …  29.1 ms    115 runs
 
Benchmark 2: ./deno-89de7e1ff run ./empty.js
  Time (mean ± σ):      24.0 ms ±   1.4 ms    [User: 16.3 ms, System: 5.6 ms]
  Range (min … max):    21.3 ms …  28.6 ms    126 runs
```

Fixes https://github.com/denoland/deno/issues/20142
Fixes https://github.com/denoland/deno/issues/15826
Fixes https://github.com/denoland/deno/issues/20028
2023-08-16 04:36:36 +09:00
await-ovo
41cad2179f
fix(runtime): navigator.userAgent in web worker (#20129)
Fixes https://github.com/denoland/deno/issues/20079

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-08-15 17:04:36 +02:00
Evan
ece2a3de5b
fix(ext/net): implement a graceful error on an invalid SSL certificate (#20157)
The goal of this PR is to address issue #19520 where Deno panics when
encountering an invalid SSL certificate.

This PR achieves that goal by removing an `.expect()` statement and
implementing a match statement on `tsl_config` (found in
[/ext/net/ops_tsl.rs](e071382768/ext/net/ops_tls.rs (L1058)))
to check whether the desired configuration is valid

---------

Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-08-15 00:11:12 +00:00
Kira
ca9ba87d99
fix(cli) error gracefully when script arg is not present and --v8-flags is present in deno run (#20145)
Fix #20022, fix #19627 (duplicate)

#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
2023-08-13 04:04:17 +02:00
Matt Mastracci
babfba14ef
chore: deno_core -> 0.201.0 (#20135) 2023-08-12 19:04:45 +00:00
Divy Srivastava
33dc5d2622
fix(node): implement TLSSocket._start (#20120)
Closes https://github.com/denoland/deno/issues/19983
Closes https://github.com/denoland/deno/issues/18303
Closes https://github.com/denoland/deno/issues/16681
Closes https://github.com/denoland/deno/issues/19978
2023-08-11 11:57:41 +00:00
Divy Srivastava
2f00b0add4
fix(ext/node): support dictionary option in zlib init (#20035)
Fixes https://github.com/denoland/deno/issues/19540
2023-08-11 11:42:35 +00:00
Divy Srivastava
65db8814c3
fix(node): object keys in publicEncrypt (#20128)
Fixes https://github.com/denoland/deno/issues/19935
2023-08-11 07:34:23 +00:00
Divy Srivastava
94d664535b
chore: forward v1.36.1 to main (#20119)
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-08-10 16:44:41 +03:00
Divy Srivastava
91dc6fa5f1
chore: upgrade fastwebsockets to 0.4.4 (#19089)
Fixes https://github.com/denoland/deno/issues/19041
2023-08-10 09:59:06 +05:30
Bartek Iwańczuk
8f854782b1
fix(ext/timers): some timers are not resolved (#20055)
Fixes https://github.com/denoland/deno/issues/19866
2023-08-10 04:01:35 +00:00
Bartek Iwańczuk
04a259e2c8
fix(test): handle ASCII escape chars in test name (#20081)
Handles ASCCI espace chars in test and bench name making
test and bench reporting more reliable. This one is also tested
in the fixture of "node:test" module.
2023-08-10 01:40:34 +02:00
Luca Casonato
03e963f578
chore: rename some helpers on the Fs trait (#20097)
Rename some of the helper methods on the Fs trait to be suffixed with
`_sync` / `_async`, in preparation of the introduction of more async
methods for some helpers.

Also adds a `read_text_file_async` helper to complement the renamed
`read_text_file_sync` helper.
2023-08-08 16:28:18 -04:00
Yusuke Tanaka
f2e30a6f79
refactor(cli): move snapshot_from_lockfile function to deno_npm (#20024)
This commit moves `snapshot_from_lockfile` function to [deno_npm
crate](https://github.com/denoland/deno_npm). This allows this function
to be called outside Deno CLI (in particular, Deno Deploy).
2023-08-08 10:07:29 -07:00
David Sherret
05f838a57c
refactor: use deno_cache_dir crate (#20092)
Uses https://github.com/denoland/deno_cache/pull/26
2023-08-08 14:23:02 +00:00
David Sherret
a037ed77a2
fix(fmt): do not insert expr stmt leading semi-colon in do while stmt body (#20093)
This is for when semiColons: false

Closes #20089
2023-08-08 09:15:19 -04:00
Nayeem Rahman
7ce8c2a1f1
build: remove redundant rerun-if-changed for compiler snapshot (#20094)
Not sure why `40_testing.js` is there. The other two `00_typescript.js`
and `99_main_compiler.js` should be covered by
`files_loaded_during_snapshot` at the end.

This helps with `__runtime_js_sources` wrt changing `40_testing.js`.
2023-08-08 09:21:54 +02: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
7b5bc87f29
fix(unstable): vendor cache should support adding files to hashed directories (#20070)
This changes the design of the manifest.json file to have a separate
"folders" map for mapping hashed directories. This allows, for example,
to add files in a folder like `http_localhost_8000/#testing_5de71/` and
have them be resolved automatically as long as their remaining
components are identity-mappable to the file system (not hashed). It
also saves space in the manifest.json file by only including the hashed
directory instead of each descendant file.

```
// manifest.json
{
  "folders": {
    "https://localhost/NOT_MAPPABLE/": "localhost/#not_mappable_5cefgh"
  },
  "modules": {
    "https://localhost/folder/file": {
      "headers": {
        "content-type": "application/javascript"
      }
    },
  }
}

// folder structure
localhost
  - folder
    - #file_2defn (note: I've made up the hashes in these examples)
  - #not_mappable_5cefgh
    - mod.ts
    - etc.ts
    - more_files.ts
```
2023-08-06 12:25:48 -04:00
Nayeem Rahman
c1c8eb3d55
build: allow disabling snapshots for dev (#20048)
Closes #19399 (running without snapshots at all was suggested as an
alternative solution).

Adds a `__runtime_js_sources` pseudo-private feature to load extension
JS sources at runtime for faster development, instead of building and
loading snapshots or embedding sources in the binary. Will only work in
a development environment obviously.

Try running `cargo test --features __runtime_js_sources
integration::node_unit_tests::os_test`. Then break some behaviour in
`ext/node/polyfills/os.ts` e.g. make `function cpus() {}` return an
empty array, and run it again. Fix and then run again. No more build
time in between.
2023-08-06 01:47:15 +02:00
Nayeem Rahman
b96f283064
refactor: remove snapshot_module_load_cb (#20043) 2023-08-05 23:00:38 +00:00
Matt Mastracci
85a2b281f5
chore: use zlib-ng for flate2 (#20059)
Extracted from PR #16011
2023-08-05 15:43:16 -06:00
David Sherret
6b0f75d1f5
fix(unstable): vendor cache override should handle forbidden windows directory names (#20069)
Meant to do this earlier.
2023-08-05 17:34:07 -04:00
Yoshiya Hinosawa
8a175a780a
fix(test): make test runner work when global setTimeout is replaced (#20052) 2023-08-04 22:29:04 +09:00
Bartek Iwańczuk
6405b5f454
fix(node): polyfill process.title (#20044)
Closes https://github.com/denoland/deno/issues/19777
2023-08-04 14:31:13 +02:00
Bartek Iwańczuk
8d8a89ceea
fix(node): repl._builtinLibs (#20046)
Ref https://github.com/denoland/deno/issues/19733
2023-08-04 14:30:48 +02:00
Bartek Iwańczuk
53ab6c004a
fix(test): use only a single timeout for op sanitizers (#20042)
Chipping away at making tests faster. Appears we don't need double
timeout before sanitizing ops. This should cut baseline cost of running a test
by half.
2023-08-04 10:05:15 +02:00
denobot
6ba245fe25
1.36.0 (#20036)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-08-03 18:26:25 +02:00
Asher Gomez
6fb7e8d93b
feat(permissions): add "--deny-*" flags (#19070)
This commit adds new "--deny-*" permission flags. These are complimentary to
"--allow-*" flags.

These flags can be used to restrict access to certain resources, even if they
were granted using "--allow-*" flags or the "--allow-all" ("-A") flag.

Eg. specifying "--allow-read --deny-read" will result in a permission error,
while "--allow-read --deny-read=/etc" will allow read access to all FS but the
"/etc" directory.

Runtime permissions APIs ("Deno.permissions") were adjusted as well, mainly
by adding, a new "PermissionStatus.partial" field. This field denotes that
while permission might be granted to requested resource, it's only partial (ie.
a "--deny-*" flag was specified that excludes some of the requested resources).
Eg. specifying "--allow-read=foo/ --deny-read=foo/bar" and then querying for
permissions like "Deno.permissions.query({ name: "read", path: "foo/" })"
will return "PermissionStatus { state: "granted", onchange: null, partial: true }",
denoting that some of the subpaths don't have read access.

Closes #18804.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2023-08-03 13:19:19 +02:00
Bartek Iwańczuk
db287e216d
refactor: use '--reporter' and '--junit-path' flags for 'deno test' (#20031)
This commit adds "--reporter" and "--junit-path" flags to "deno test"
subcommand instead of using "--dot" and "--junit" flags.
2023-08-02 22:05:34 -04:00
David Sherret
480894e5c8
feat(unstable/lsp): support navigating to deno_modules folder (#20030)
Closes #20015
Closes https://github.com/denoland/vscode_deno/issues/850 (only for
deno_modules, but I don't think this will be possible for the global
cache)
2023-08-02 16:57:25 -04:00
await-ovo
e8d03119a0
fix(repl): highlight from ident in import from or export from (#20023) 2023-08-02 16:27:03 -04:00
Bartek Iwańczuk
029bdf0cd5
feat(cli): Add dot test reporter (#19804)
This commit adds a "dot" reporter to "deno test" subcommand,
that can be activated using "--dot" flag.

It provides a concise output using:
- "." for passing test
- "," for ignored test
- "!" for failing test

User output is silenced and not printed to the console.

In non-TTY environments each result is printed on a separate line.
2023-08-02 18:38:10 +02:00
Bartek Iwańczuk
d9c85e016f
fix(node): node:test reports correct location (#20025)
Also removed some noisy output that caused test flakiness.
2023-08-02 17:11:04 +02:00
Bartek Iwańczuk
1cb16683bc
fix(bench): iter/s calculation (#20016)
Ref https://github.com/denoland/deno/pull/19994#discussion_r1281267606
Ref https://github.com/denoland/deno/pull/19994#discussion_r1281243602
2023-08-02 10:01:49 -04:00
Kyoh
9fa328f656
fix: make "suggest.autoImports" to switch completions from external modules (#19845) 2023-08-02 09:22:00 -04:00
Bartek Iwańczuk
9d1c32945c
fix: regression in workers using dynamic imports (#20006)
Closes https://github.com/denoland/deno/issues/19903
2023-08-02 01:19:44 +00:00
David Sherret
1cefa831fd
feat(unstable): optional deno_modules directory (#19977)
Closes #15633
2023-08-02 00:49:09 +00:00
Bartek Iwańczuk
36ae37604a
feat(bench): print iter/s in the report (#19994)
This commit adds "iter/s" column to the console report
generated by "deno bench" subcommand.
2023-08-01 23:55:23 +00:00
await-ovo
fec34d8069
fix(ext/node): fix import json using npm specifier (#19723) 2023-08-01 23:20:08 +00:00
Bartek Iwańczuk
21f1b2f62b
feat(node): add polyfill for node:test module (#20002)
This commit provides basic polyfill for "node:test" module. Currently
only top-level "test" function is polyfilled, all remaining functions from
that module throw not implemented errors.
2023-08-02 01:17:38 +02:00
David Sherret
00b5fe8ba3
feat(npm): support running non-bin scripts in npm pkgs via deno run (#19975)
Closes https://github.com/denoland/deno/issues/19967
2023-08-01 18:47:57 -04:00
Matt Mastracci
45572e329a
refactor(runtime): use new fd methods from resource table (#20010)
Prereq for fast streams work. No longer need `#[cfg]` around
`backing_fd`.
2023-08-01 14:48:39 -04:00
Felipe Baltor
ab2627a014
fix(test): request cloning should throw if body stream is locked (#19990)
Follow-up from #19869.
2023-08-01 18:24:42 +00:00
David Sherret
b563746885
fix: deno diagnostic - clarify where to put triple-slash directive (#20009)
Some people might not know what "entrypoint" means or where to put the
triple-slash directive.
2023-08-01 15:27:25 +00:00
Bartek Iwańczuk
5df2b0b4dc
fix: retry module download once if server errored (#17252)
Closes https://github.com/denoland/deno/issues/17251
Closes #19970

This commits adds logic to retry failed module downloads once.
Both request and server errors are handled and the retry is done after
50 ms wait time.
2023-08-01 10:52:28 +02:00
Bartek Iwańczuk
a05e890d56
chore: make LSP test less prone to changes (#20003)
This test was getting changed often, I modified it a bit
so it's less sensitive to changes in declaration files.
2023-07-31 21:31:30 -04:00
Leo Kettmeir
aa8078b688
feat(node/os): implement getPriority, setPriority & userInfo (#19370)
Takes #4202 over
Closes #17850 

---------

Co-authored-by: ecyrbe <ecyrbe@gmail.com>
2023-07-31 22:29:09 +02:00
Luca Casonato
78ceeec6be
perf: faster node globals access in cjs (#19997)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-07-31 19:45:32 +00:00
Nayeem Rahman
d5efdeeff1
refactor: update core extension api usage (#19952) 2023-07-31 18:19:15 +00:00
David Sherret
99daad0541
refactor: NodeCodeTranslator - optional source to translate_cjs_to_esm (#20000) 2023-07-31 17:46:58 +00:00
Matt Mastracci
43877f1209
chore(cli): Reduce port conflict in tests (#19988)
Ports are still occasionally causing CI flake -- allocate and separate
ports further for fetch/http tests.
2023-07-31 07:29:17 -06:00
Matt Mastracci
2fd87471e8
chore(cli): Fix test that locks up on some M2 macs (#19989)
I'm not sure why, but sending SIGABRT to Deno on my machine as part of
this test causes it to lock up very badly, leaving it in an unkillable
`UE+` state.

This showed up after #19333, but was not caused by it.
2023-07-31 07:29:00 -06:00
Nayeem Rahman
02865cb5a2
feat(bench): add BenchContext::start() and BenchContext::end() (#18734)
Closes #17589.
```ts
Deno.bench("foo", async (t) => {
  const resource = setup(); // not included in measurement
  t.start();
  measuredOperation(resource);
  t.end();
  resource.close(); // not included in measurement
});
```
2023-07-31 12:02:59 +02:00
Felipe Baltor
3cb260ed15
fix(Deno.serve): accessing .url on cloned request throws (#19869)
This PR fixes #19818. The problem was that the new InnerRequest class does not initialize the fields urlList and urlListProcessed that are used during a request clone. The solution aims to be straightforward by simply initializing the missing properties during the clone process. I also implemented a "cache" to the url getter of the new InnerRequest, avoiding the cost of calling op_http_get_request_method_and_url.
2023-07-30 09:13:28 -04:00
David Sherret
cfdef0c380
chore: remove println in DenoCompileBinaryWriter (#19976) 2023-07-29 14:06:47 +02:00
JasperVanEsveld
0ec4feaee7
feat(compile): Add --no-terminal to compile command (#17991) 2023-07-28 18:46:26 +03:00
Bartek Iwańczuk
a9951e360c
refactor(cli/tools): split bench into multiple modules (#19974)
I was asked to add "iter/s" to the benchmark output, before attempting
that I wanted to split this into multiple modules.
2023-07-28 11:27:10 -04:00
David Sherret
279030f2b8
fix(npm): improve declaration resolution for filename with different extensions (#19966)
postcss was importing `./index.js` from `./index.d.mts` where there also
existed a `./index.d.ts`.

Closes #19575
2023-07-28 11:24:22 -04:00
Divy Srivastava
bddf5acf89
chore: remove unused dependencies (#19962) 2023-07-28 15:10:13 +05:30
Leo Kettmeir
5cb1d18439
feat: Deno.createHttpClient allowHost (#19689)
This adds an option to allow using the host header in a fetch call.
Closes https://github.com/denoland/deno/issues/16840
Ref https://github.com/denoland/deno/issues/11017
2023-07-28 09:01:06 +02:00
David Sherret
fa52b5e733
fix: do not include jsx without @ts-check in tsc roots (#19964)
Closes #19928
2023-07-27 14:09:02 -04:00
Luca Casonato
7b29f1c934
chore: cleanup EmbeddedModuleLoader (#19911)
Source code is now not cloned anymore between eszip and deno_core, as
eszip now
returns `Arc<[u8]>`, that can be trivially casted into `Arc<str>`, which
`deno_core` can consume without copying.
2023-07-27 16:38:32 +00:00
David Sherret
02d6bbff2c
fix: error on invalid & unsupported jsx compiler options (#19954) 2023-07-27 12:15:39 -04:00
Bartek Iwańczuk
806137bb96
refactor(cli/test): move reporters to a separate directory (#19957)
Just a small cleanup that will make #19804 easier.
2023-07-27 02:16:12 +02:00
David Sherret
56e3daa19b
fix(lsp): handle import mapped node: specifier (#19956)
Closes https://github.com/denoland/vscode_deno/issues/805
2023-07-26 22:52:31 +00:00
Cooper Benson
0e4d6d41ad
feat(cli): Adding JUnit test reports (#19747)
This commit makes the following changes
- Created a `CompoundTestReporter` to allow us to use multiple reporters
- Implements `JUnitTestReporter` which writes JUnit XML to a path
- Added a CLI flag/option `--junit` that enables JUnit reporting. By
default this writes the report to `stdout` (and disables pretty
reporting). If a path is provided, it will write the JUnit report to
that file while the pretty reporter writes to stdout like normal

Output of `deno -- test --allow-all --unstable
--location=http://js-unit-tests/foo/bar --junit
cli/tests/unit/testing_test.ts `
```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="deno test" tests="7" failures="0" errors="0" time="0.176">
    <testsuite name="file:///Users/cooper/deno/deno/cli/tests/unit/testing_test.ts" tests="7" disabled="0" errors="0" failures="0">
        <testcase name="testWrongOverloads" time="0.012">
        </testcase>
        <testcase name="nameOfTestCaseCantBeEmpty" time="0.009">
        </testcase>
        <testcase name="invalidStepArguments" time="0.008">
        </testcase>
        <testcase name="nameOnTextContext" time="0.029">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="originOnTextContext" time="0.030">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="parentOnTextContext" time="0.030">
            <properties>
                <property name="step[passed]" value="step ... nested step"/>
                <property name="step[passed]" value="step"/>
            </properties>
        </testcase>
        <testcase name="explicit undefined for boolean options" time="0.009">
        </testcase>
    </testsuite>
</testsuites>
```
2023-07-27 00:12:35 +02:00
David Sherret
cf16df00d9
fix(check): should bust check cache when json module or npm resolution changes (#19941)
A small part of #19928.
2023-07-26 17:23:07 -04:00
denobot
89ba3f820c
1.35.3 (#19947)
Bumped versions for 1.35.3
Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
2023-07-26 10:18:02 -04:00
David Sherret
1d615b211e
fix(task): ensure quoted strings are maintained mid-word (#19944)
Closes #19942
2023-07-26 08:34:27 -04:00
Bartek Iwańczuk
67de67a106
chore: update chrono dependency (#19943)
Pulled from https://github.com/denoland/deno/pull/19747

Authored-by: Cooper Benson <skycoop@gmail.com>
2023-07-26 01:40:09 +00:00
Bartek Iwańczuk
06209f824c
perf: cache node resolution when accesing a global (#19930)
Reclaims some of the performance hit introduced by
https://github.com/denoland/deno/pull/19307.
2023-07-25 23:43:00 +02:00
Martin Fischer
5d8d1105a4
refactor: simplify signature of diagnose_resolution (#19753)
This commit makes the data flow in the
`diagnose_dependency` function more obvious.
2023-07-25 17:29:29 -04:00
Bartek Iwańczuk
88885d9c2b
fix(lint): allow to use --rules with --rules-tags (#19754) 2023-07-25 17:24:06 -04:00
Vedant Pandey
4a5aaceb26
fix: deno info should respect import map (#19781)
Closes #19742
2023-07-25 18:23:43 +02:00
Bartek Iwańczuk
bd79baea5e
fix(node): add writable and readable fields to FakeSocket (#19931)
Closes https://github.com/denoland/deno/issues/19927
2023-07-25 07:17:53 +00:00
Yoshiya Hinosawa
3d35900639
fix(ext/net): fix string port number handling in listen (#19921)
While string `port` is not allowed in typing, it seems we used to
support that and now it's broken. ref:
https://github.com/denoland/deno/issues/10064#issuecomment-1637427260

This PR restores the support of string port number in `listen` and
`listenTls`
2023-07-25 06:26:18 +00:00
李瑞丰
8053df2de6
fix(cli/test): fix clear screen behavior when run deno test --watch (#19888)
fix #19725
2023-07-25 06:07:54 +02:00
sitogi
b9765647de
fix(cli/init): update to assert/mod.ts (#19924) 2023-07-24 19:57:01 +00:00
David Sherret
40008c73bb
refactor(ext/node): CjsCodeAnalyzer - analyze_cjs optionally pass source text (#19896) 2023-07-24 15:35:13 -04:00