Commit graph

1056 commits

Author SHA1 Message Date
denobot 41877a0b37
1.38.0 (#21051)
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-02 01:01:47 +00:00
Bartek Iwańczuk 24c3c96958
feat: granular --unstable-* flags (#20968)
This commit adds granular `--unstable-*` flags:
- "--unstable-broadcast-channel"
- "--unstable-ffi"
- "--unstable-fs"
- "--unstable-http"
- "--unstable-kv"
- "--unstable-net"
- "--unstable-worker-options"
- "--unstable-cron"

These flags are meant to replace a "catch-all" flag - "--unstable", that
gives a binary control whether unstable features are enabled or not. The
downside of this flag that allowing eg. Deno KV API also enables the FFI
API (though the latter is still gated with a permission).

These flags can also be specified in `deno.json` file under `unstable`
key.

Currently, "--unstable" flag works the same way - I will open a follow
up PR that will print a warning when using "--unstable" and suggest to use
concrete "--unstable-*" flag instead. We plan to phase out "--unstable"
completely in Deno 2.
2023-11-01 23:15:08 +01:00
Luca Casonato d42f154312
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.

Closes #20839

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-11-01 20:26:12 +01:00
Igor Zinkovsky 01d3e0f317
feat(cron) implement Deno.cron() (#21019)
This PR adds unstable `Deno.cron` API to trigger execution of cron jobs.

* State: All cron state is in memory. Cron jobs are scheduled according
to the cron schedule expression and the current time. No state is
persisted to disk.
* Time zone: Cron expressions specify time in UTC.
* Overlapping executions: not permitted. If the next scheduled execution
time occurs while the same cron job is still executing, the scheduled
execution is skipped.
* Retries: failed jobs are automatically retried until they succeed or
until retry threshold is reached. Retry policy can be optionally
specified using `options.backoffSchedule`.
2023-11-01 11:57:55 -07:00
Leo Kettmeir 39716183ac
feat(ext/web): EventSource (#14730)
Closes #10298

---------

Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com>
2023-10-31 18:16:27 +01:00
Luca Casonato 2d9298f5f5
chore: update ext/kv to use denokv_* crates (#20986)
This commit updates the ext/kv module to use the denokv_* crates for
the protocol and the sqlite backend. This also fixes a couple of bugs in
the sqlite backend, and updates versionstamps to be updated less
linearly.
2023-10-31 11:13:57 +00:00
Divy Srivastava f3b580d001
chore: use is_terminal in atty (#21010) 2023-10-28 19:49:21 -07:00
Bartek Iwańczuk 093b3eee58
chore: update deno_core and port all remaining ops to op2 (#20954)
Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-10-25 13:43:38 +02:00
denobot 5da1bd802c
chore: forward v1.37.2 release commit to main (#20897)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-13 03:12:06 +00:00
Bartek Iwańczuk c464cd7073
refactor: FeatureChecker integration in ext/ crates (#20797)
Towards https://github.com/denoland/deno/issues/20779.
2023-10-12 15:55:50 +00:00
Bartek Iwańczuk 2167a52d69
refactor: remove TimersPermissions::check_unstable (#20831)
This is dead code that was not used in any way.

Ref https://github.com/denoland/deno/pull/20797
2023-10-09 02:08:10 +02:00
Bartek Iwańczuk dfc254cd57
fix: define window.name (#20804)
Closes https://github.com/denoland/deno/issues/20750

This matches what browsers do:
https://developer.mozilla.org/en-US/docs/Web/API/Window/name

In the future we might want to change the behavior to actually update
the process name, but that needs a bit of discussion regarding if
it needs a permission flag (that would make polyfiling `process.title`
setter really easy too).
2023-10-08 22:12:59 +00:00
Bartek Iwańczuk edeccef499
refactor: migrate more ops to op2 macro (#20808)
Getting closer...
2023-10-07 21:04:03 +05:30
Jesper van den Ende be7e2bd8c1
fix(cli): Support using both --watch and --inspect at the same time (#20660)
Fixes #20525
2023-10-06 23:33:14 +02:00
Divy Srivastava 1a81b2826d
refactor: rewrite websocket to use op2 macro (#20140)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-10-04 21:43:58 +00:00
Bartek Iwańczuk a5568066b3
refactor: use deno_core::FeatureChecker for unstable checks (#20765) 2023-10-04 21:42:17 +02:00
Bartek Iwańczuk 0bd53fd52d
fix(jupyter): more robust Deno.jupyter namespace (#20710) 2023-09-28 16:51:44 +02:00
denobot 3b78981ffe
chore: forward v1.37.1 release commit to main (#20706)
This is the release commit being forwarded back to main for 1.37.1

Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2023-09-27 09:13:48 +00:00
Bartek Iwańczuk 46a4bd5178
feat(unstable): add Deno.jupyter.broadcast API (#20656)
Closes https://github.com/denoland/deno/issues/20591

---------

Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
2023-09-27 02:21:06 +02:00
Luca Casonato 26f431fd14
perf(test): use core.currentUserCallSite (#20669)
Speeds up `Deno.test` calls by a bit.
2023-09-26 10:01:56 +09:00
Matt Mastracci 365d1ac7c2
chore: bump deno_core + cargo update (#20636)
```
    Updating aes-gcm v0.10.2 -> v0.10.3
    Updating aho-corasick v1.1.0 -> v1.1.1
    Updating curve25519-dalek v4.1.0 -> v4.1.1
    Updating deno_core v0.214.0 -> v0.215.0
    Updating deno_ops v0.90.0 -> v0.91.0
    Updating deno_unsync v0.2.1 -> v0.3.0
    Updating md-5 v0.10.5 -> v0.10.6
    Updating rustix v0.38.13 -> v0.38.14
    Updating rustls-webpki v0.101.5 -> v0.101.6
    Updating serde_v8 v0.123.0 -> v0.124.0
    Updating sha1 v0.10.5 -> v0.10.6
    Updating smallvec v1.11.0 -> v1.11.1
    Updating tokio-util v0.7.8 -> v0.7.9
    Updating v8 v0.76.0 -> v0.77.0
    Updating winapi-util v0.1.5 -> v0.1.6
```
2023-09-22 19:51:59 +00:00
Bartek Iwańczuk 142449ecab
refactor: rewrite some ops to op2 macro (#20603) 2023-09-21 08:08:23 -06:00
denobot 997aa604df
1.37.0 (#20574)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-09-19 20:29:17 +00:00
Shreyas d72f5d573a
fix: Deno.Command - improve error message when cwd is not a directory (#20460) 2023-09-18 17:48:54 +00:00
Bartek Iwańczuk 5e7435fb80
refactor: rewrite more ops to op2 macro (#20478) 2023-09-14 23:05:18 +02:00
David Sherret 6dc8682b9a
feat: explicit resource management in TypeScript (#20506)
This adds support for `using` and `await using` declarations in
TypeScript only. We need to wait for v8 to support it for this to work
in JS.
2023-09-14 18:08:59 +00:00
Matt Mastracci 81d50e1b66
chore: bump deno_core and cargo update (#20480)
Bump deno_core, pulling in new rusty_v8. Requires some op2/deprecation
fixes.
2023-09-13 22:01:31 +00:00
Matt Mastracci bfd230fd78
chore: update inner #\![allow] to #[allow] (#20463)
Functions should generally be annotated with `#[allow]` blocks rather
than using inner `#![allow]` annotations.
2023-09-11 17:12:33 -06:00
Bartek Iwańczuk bdeb4bddbf
refactor: rewrite runtime/ ops to op2 (#20459) 2023-09-12 00:10:43 +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
Bartek Iwańczuk 83426be6ee
refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303)
Rewrites 3 ops that used "op(deferred)" to use "op2(async(lazy))"
instead.
This will allow us to remove codepath for handling "deferred" ops in
"deno_core".
2023-09-02 08:48:21 +02: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
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 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
林炳权 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
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
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
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
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
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
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
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
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
David Sherret 51ceed860b
chore: fix windows clippy errors (#20014) 2023-08-01 23:30:19 +02:00