Commit graph

13 commits

Author SHA1 Message Date
David Sherret
85d342c045
refactor: use Cow<Path> more in permissions (#30227)
Towards and removing more allocations.
2025-07-29 07:11:57 -04:00
David Sherret
76ce7768ab
refactor(permissions): remove access check callback (#30050)
1. Removes the access check callback, which was kind of confusing.
1. Requires `CheckedPath` for everything in the `FileSystem` trait to
ensure we're always checking permissions.
2025-07-10 21:40:20 -04:00
David Sherret
2617b4ec6b
refactor(permissions): push down special file checking to permissions container (#30005) 2025-07-09 20:50:26 +00:00
Heyang Zhou
882d2ed1b6
feat(ext/fetch): add support for fetch on vsock sockets (#29692)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build wasm32 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
This commit adds support for using
[vsock](https://man7.org/linux/man-pages/man7/vsock.7.html) transport in
fetch API on Linux and macOS.

Similar to #29154, a vsock transport can be specified in the `proxy`
field when calling `Deno.createHttpClient`.

```ts
const client = Deno.createHttpClient({
  proxy: {
    transport: "vsock",
    cid: 2,
    port: 80,
  },
});

await fetch("http://localhost/ping", { client });
```
2025-06-11 09:58:02 +02:00
Luca Casonato
3b6c70e5b2
feat(ext/fetch): add support for fetch on unix sockets (#29154)
This commit adds support for using Unix socket proxies in `fetch` API.

This is facilitated by passing an appropriate `Deno.HttpClient` instance
to the `fetch` API:
```
const client = Deno.createHttpClient({
  proxy: {
    transport: "unix",
    path: "/path/to/unix.sock",
  },
});

await fetch("http://localhost/ping", { client });
```

Closes https://github.com/denoland/deno/issues/8821

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-05-13 18:06:17 +02:00
snek
bc1ced8260
refactor: allow lazy main module (#28929)
implement lazy(?) mode. an unconfigured jsruntime is created if
DENO_UNSTABLE_CONTROL_SOCK is present, and later passed into deno_runtime to be
configured and used.
2025-04-30 19:59:20 +00:00
Nathan Whitaker
c22d17824b
perf(fs): don't canonicalize path when opening file if --allow-all is passed (#28716)
Fixes #28702.

Super artificial benchmark:

```ts
const perf = performance;

async function asyncOpen() {
  const start = perf.now();
  for (let i = 0; i < 100_000; i++) {
    const file = await Deno.open("./foo.txt");
    file.close();
  }
  const end = perf.now();
  console.log(end - start);
}

function syncOpen() {
  const start = perf.now();
  for (let i = 0; i < 100_000; i++) {
    const file = Deno.openSync("./foo.txt");
    file.close();
  }
  const end = perf.now();
  console.log(end - start);
}

if (Deno.args[0]?.trim() === "async") {
  await asyncOpen();
} else {
  syncOpen();
}
```

Results (average of 10 for each):

```
deno sync               1785.59
deno-this-pr sync       491.69
deno async              1839.71
deno-this-pr async      528.78
```

---------

Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2025-04-29 23:16:24 +00:00
snek
2221cf3e7c
feat: deno_core 0.344.0 (#29089)
- new ops init api
  - fix op order
- remove deno_os_worker since extensions must now match the snapshot
exactly
- isatty test change
2025-04-29 13:15:08 +02:00
David Sherret
16d305449d
feat(compile): support for ffi and node native addons (#28934)
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.
2025-04-17 16:01:12 -04:00
snek
9da231dc7a
feat: support linux vsock (#28725)
impl support for vsock
https://man7.org/linux/man-pages/man7/vsock.7.html
2025-04-11 07:35:05 +02:00
Nathan Whitaker
69b59b2296
perf(http): instantiate generic functions in deno_http, increase opt-level for some more hyper deps (#28317)
results on my machine (Macbook pro w/ M3 Max)

canary (hello world):
```
❯ oha -c 125 -n 4000000 --no-tui --disable-compression http://localhost:8000
Summary:
  Success rate: 100.00%
  Total:        31.0160 secs
  Slowest:      0.0083 secs
  Fastest:      0.0005 secs
  Average:      0.0010 secs
  Requests/sec: 128965.6454

  Total data:   49.59 MiB
  Size/request: 13 B
  Size/sec:     1.60 MiB
```

this PR (hello world):
```
❯ oha -c 125 -n 4000000 --no-tui --disable-compression http://localhost:8000
Summary:
  Success rate: 100.00%
  Total:        28.4050 secs
  Slowest:      0.0085 secs
  Fastest:      0.0001 secs
  Average:      0.0009 secs
  Requests/sec: 140820.2060

  Total data:   49.59 MiB
  Size/request: 13 B
  Size/sec:     1.75 MiB
```

---

Two changes here:
- use `opt-level` 3 for some of hyper's deps, since profile overrides
are not transitive
- As noted in the [cargo
reference](https://doc.rust-lang.org/cargo/reference/profiles.html#overrides-and-generics)
generic functions _may_ be optimized at the opt-level of the
_instantiating_ crate, rather than the defining crate. So currently it's
possible that some of the functions in `deno_http` are being compiled at
a lower optimization level. This PR ensures the generics are
instantiated in `deno_http`, which theoretically should guarantee they
actually use opt-level 3.

To allow embedders to still provide a custom property extractor, I put
this behind a feature flag.
2025-02-27 10:07:11 -08:00
Divy Srivastava
cda0c5b3ae
fix: do special file permission check for check_read_path (#27989)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2025-02-12 15:46:21 +00:00
Bartek Iwańczuk
795ecfdca6
refactor(lsp): make TS host use CLI snapshot (#28062)
This commit changes the TS host implementation
in the LSP to use the same snapshot as the runtime worker
and web worker use.

This is due to upcoming V8 upgrade that might require
that all isolates in the same process use the exact same
snapshot.
2025-02-11 18:33:04 +01:00