Commit graph

270 commits

Author SHA1 Message Date
Bartek Iwańczuk 39872646eb
feat: stabilize 'alpnProtocols' setting (#19704)
Ref https://github.com/denoland/deno/issues/19685
2023-07-04 15:28:50 +02:00
Bartek Iwańczuk 3c8bbc434d
feat: Stabilize Deno.serve() API (#19141)
This commit stabilizes "Deno.serve()", which becomes the
preferred way to create HTTP servers in Deno.

Documentation was adjusted for each overload of "Deno.serve()"
API and the API always binds to "127.0.0.1:8000" by default.
2023-07-04 01:46:32 +02:00
David Sherret 7a7e0748e3
feat: upgrade to TypeScript 5.1.6 (#19695)
Integrates https://github.com/denoland/TypeScript/pull/7
2023-07-04 00:36:35 +02:00
ud2 d632cce129
fix(dts): make globals available on globalThis (#19438)
This PR changes Web IDL interfaces to be declared with `var` instead of
`class`, so that accessing them via `globalThis` does not raise type
errors.

Closes #13390.
2023-07-03 14:36:55 -04:00
Bartek Iwańczuk 26c2abef7f
fix: Update typings for Deno.errors namespace (#19688)
Follow up to https://github.com/denoland/deno/pull/19514, where I forgot
to update type declarations.
2023-07-03 15:30:39 +02:00
Bartek Iwańczuk ad3c494b46
Revert "Reland "refactor(core): cleanup feature flags for js source i… (#19611)
…nclusion" (#19519)"

This reverts commit 28a4f3d0f5.

This change causes failures when used outside Deno repo:
```
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.34.3+b37b286
Args: ["/opt/hostedtoolcache/deno/0.0.0-b37b286f7fa68d5656f7c180f6127bdc38cf2cf5/x64/deno", "test", "--doc", "--unstable", "--allow-all", "--coverage=./cov"]

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to read "/home/runner/work/deno/deno/core/00_primordials.js"

Caused by:
    No such file or directory (os error 2)', core/runtime/jsruntime.rs:699:8
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
2023-06-26 13:54:10 +02:00
Nayeem Rahman 28a4f3d0f5
Reland "refactor(core): cleanup feature flags for js source inclusion" (#19519)
Relands #19463. This time the `ExtensionFileSourceCode` enum is
preserved, so this effectively just splits feature
`include_js_for_snapshotting` into `exclude_js_sources` and
`runtime_js_sources`, adds a `force_include_js_sources` option on
`extension!()`, and unifies `ext::Init_ops_and_esm()` and
`ext::init_ops()` into `ext::init()`.
2023-06-25 09:35:31 +02:00
andy faf6eaf2d3
chore: fix typos in HrtimePermissionDescriptor and performance.now docs (#19469) 2023-06-16 14:38:36 +02:00
Igor Zinkovsky fd9d6baea3
feat(kv) queue implementation (#19459)
Extend the unstable `Deno.Kv` API to support queues.
2023-06-13 17:49:57 -07:00
Bartek Iwańczuk 60bf79c184
Revert "refactor(core): cleanup feature flags for js source inclusion… (#19490)
… (#19463)"

This reverts commit ceb03cfb03.

This is being reverted because it causes 3.5Mb increase in the binary
size,
due to runtime JS code being included in the binary, even though it's
already snapshotted.

CC @nayeemrmn
2023-06-13 22:36:16 +00:00
Nayeem Rahman ceb03cfb03
refactor(core): cleanup feature flags for js source inclusion (#19463)
Remove `ExtensionFileSourceCode::LoadedFromFsDuringSnapshot` and feature
`include_js_for_snapshotting` since they leak paths that are only
applicable in this repo to embedders. Replace with feature
`exclude_js_sources`. Additionally the feature
`force_include_js_sources` allows negating it, if both features are set.
We need both of these because features are additive and there must be a
way of force including sources for snapshot creation while still having
the `exclude_js_sources` feature. `force_include_js_sources` is only set
for build deps, so sources are still excluded from the final binary.

You can also specify `force_include_js_sources` on any extension to
override the above features for that extension. Towards #19398.

But there was still the snapshot-from-snapshot situation where code
could be executed twice, I addressed that by making `mod_evaluate()` and
scripts like `core/01_core.js` behave idempotently. This allowed
unifying `ext::init_ops()` and `ext::init_ops_and_esm()` into
`ext::init()`.
2023-06-13 09:45:06 -06:00
David Sherret 7f15126f23
chore(tests): test_util - Add PathRef (#19450)
This adds a new `PathRef` struct to test_util for making it easier to
work with paths in test code. I'm going to expand on this more in the
future.
2023-06-10 11:09:45 -04:00
David Sherret 2aba4365ae
perf(cli): conditionally load typescript declaration files (#19392)
Closes #18583
2023-06-06 17:07:46 -04:00
Leo Kettmeir 08bd23970d
feat: add more options to Deno.inspect (#19337)
For https://github.com/denoland/deno_std/issues/3404

---------

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-06-05 12:25:47 +02:00
Nayeem Rahman 34dac6c6ef
refactor(core): remove force_op_registration and cleanup JsRuntimeForSnapshot (#19353)
Addresses
https://github.com/denoland/deno/pull/19308#discussion_r1212248194. 

Removes force_op_registration as it is no longer necessary.
2023-06-03 14:22:32 -06:00
Nayeem Rahman b6a3f8f722
refactor(core): remove ext: modules from the module map (#19040)
Rather than disallowing `ext:` resolution, clear the module map after
initializing extensions so extension modules are anonymized. This
operation is explicitly called in `deno_runtime`. Re-inject `node:`
specifiers into the module map after doing this.

Fixes #17717.
2023-05-28 12:44:41 -06:00
Hirotaka Tagawa / wafuwafu13 114ec3c1f7
feat(ext/fs): add isBlockDevice, isCharDevice, isFifo, isSocket to FileInfo (#19008)
`isFile`, `isDirectory`, `isSymlink` are defined in `Deno.FileInfo`, but
`isBlockDevice`, `isCharacterDevice`, `isFIFO`, `isSocket` are not
defined.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-24 21:18:13 +02:00
Connor Burton 19f1823e44
docs: be explicit in the unit of time of delay in setTimeout (#19207) 2023-05-22 14:04:28 +00:00
Leo Kettmeir addfb0c546
fix(ci): simplify test assertion for http version enforcing with Deno.createHttpClient (#19210) 2023-05-21 21:52:45 +02:00
Leo Kettmeir 3e03865d89
feat(unstable): add more options to Deno.createHttpClient (#17385) 2023-05-21 03:43:54 +02:00
Matt Mastracci 7f5290b694
feat(ext/http): ref/unref for server (#19197)
Add `ref` and `unref` to return value from `Deno.serve`. Unblocks #3326.
2023-05-19 15:14:40 -06:00
Bartek Iwańczuk 5b07522349
BREAKING(unstable): change return type of Deno.serve() API (#19189)
This commit changes the return type of an unstable `Deno.serve()` API
to instead return a `Deno.Server` object that has a `finished` field.

This change is done in preparation to be able to ref/unref the HTTP
server.
2023-05-19 02:59:23 +02:00
Heyang Zhou 320c6d30f5
fix(kv): kv.close() interrupts in-flight operations (#19076)
Fixes https://github.com/denoland/deno/issues/19049
2023-05-17 12:18:47 +08:00
Yoshiya Hinosawa 6bea6b31d3
fix(dts): move BroadcastChannel type to lib.deno.unstable.d.ts (#19108) 2023-05-14 20:27:14 +09:00
David Sherret b8495e0377
fix(cli): upgrade to Typescript 5.0.4 (#19090) 2023-05-11 14:12:58 +00:00
David Sherret ec67e96a12
fix(dts): align seekSync position arg with seek (#19077)
Closes #19060
2023-05-10 22:04:30 +02:00
Bartek Iwańczuk 8382adaf7d
docs: update Deno.Writer docstring (#18987)
Closes
https://github.com/denoland/deno/issues/18985#issuecomment-1534493623
2023-05-04 14:37:45 +02:00
kang 632395da89
fix(docs): replace "e.g." with "i.e." in seek()/seekSync() comment (#18964)
Clarify calculation of number "9" in `seek()`/`seekSync()` comment of
lib.deno.ns.d.ts by replacing "e.g." with "i.e."
2023-05-03 20:41:25 +00:00
Yarden Shoham 341fc11e24
docs(lib): document Deno.Command requires the allow-run permission (#18958) 2023-05-02 15:51:50 +00:00
Michael Lazarev 2ee55145c0
docs: correct example of piping the output of a subprocess to a file (#18933)
Fixes #18909
2023-05-01 21:52:56 +00:00
David Sherret 30628288ce
perf: lazily retrieve ppid (#18940)
This is very apparent on Windows.

Before: 45.74ms (Hello world)
After: 33.92ms

Closes #18939
2023-05-01 18:21:27 +00:00
Matt Mastracci bb1f5e4262
perf(core): async op pseudo-codegen and performance work (#18887)
Performance:

```
async_ops.js: 760k -> 1030k (!)
async_ops_deferred.js: 730k -> 770k
Deno.serve bench: 118k -> 124k
WS test w/ third_party/prebuilt/mac/load_test 100 localhost 8000 0 0: unchanged

Startup time: approx 0.5ms slower (13.7 -> 14.2ms)
```
2023-04-30 08:50:24 +00:00
Luca Casonato 3fbb31c3c1
feat(kv): return ok bool from atomic commit (#18873) 2023-04-27 16:59:02 +02:00
Bartek Iwańczuk 09b6dbc0a6
feat: Deprecate Deno.run API in favor of Deno.Command (#17630) (#18866)
This commit adds `@deprecated` comments to `Deno.run` API declarations.
Since stabilization of `Deno.Command` API in [Deno
v1.31](https://deno.com/blog/v1.31#api-stabilizations), `Deno.Command`
is the preferred (more reliable) API to interact with subprocesses.
This is the preparation for the removal of `Deno.run` API in Deno 2.0.
2023-04-27 02:11:23 +02:00
David Sherret f4e442da4d
fix(dts): URLPatternComponentResult groups should have possibly undefined key values (#18643)
Closes #18640
2023-04-26 19:15:25 -04:00
Matt Mastracci e2761df3fe
fix(ext/http): internal upgradeHttpRaw works with "Deno.serve()" API (#18859)
Fix internal "upgradeHttpRaw" API restoring capability to upgrade HTTP
connection in polyfilles "node:http" API.
2023-04-27 00:58:18 +02:00
Ryan Dahl 2df6db36c8
feat(ext/kv): add more atomic operation helpers (#18854)
Co-authored-by: losfair <zhy20000919@hotmail.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
2023-04-26 17:14:01 +00:00
Bartek Iwańczuk 1b450015e7
BREAKING(unstable): remove "Deno.serve(handler, options)" overload (#18759)
In preparation to stabilization of the API this overload was decided to
be removed.
2023-04-26 14:54:03 +02:00
David Sherret 5b4a9b48ae
refactor(ext/node): enforce interior mutable for NodePermissions to remove clones (#18831)
We can make `NodePermissions` rely on interior mutability (which the
`PermissionsContainer` is already doing) in order to not have to clone
everything all the time. This also reduces the chance of an accidental
`borrow` while `borrrow_mut`.
2023-04-24 21:07:48 -04:00
David Sherret aa286fdecb
refactor(ext/node): allow injecting NodeFs from CLI (#18829)
This allows providing a `NodeFs` as part of the `WorkerOptions`.
2023-04-24 19:44:35 -04:00
Leo Kettmeir be9e3c430f
docs: add categories to APIs without (#18826) 2023-04-24 20:24:18 +00:00
David Sherret a615eb3b56
refactor(node): move most of cli/node to ext/node (#18797)
This is just a straight refactor and I didn't do any cleanup in
ext/node. After this PR we can start to clean it up and make things
private that don't need to be public anymore.
2023-04-21 21:02:46 -04:00
David Sherret d2d62b6312
refactor(npm): add CliNodeResolver (#18742) 2023-04-17 15:36:23 -04:00
Ryan Dahl 2184103a5e
feat(kv): AtomicOperation#sum (#18704) 2023-04-15 10:33:31 +02:00
David Sherret 136dce67ce
refactor: break up ProcState (#18707)
1. Breaks up functionality within `ProcState` into several other structs
to break out the responsibilities (`ProcState` is only a data struct
now).
2. Moves towards being able to inject dependencies more easily and have
functionality only require what it needs.
3. Exposes `Arc<T>` around the "service structs" instead of it being
embedded within them. The idea behind embedding them was to reduce the
verbosity of needing to pass around `Arc<...>`, but I don't think it was
exactly working and as we move more of these structs to be more
injectable I don't think the extra verbosity will be a big deal.
2023-04-14 16:22:33 -04:00
Yiyu Lin d790ea7d53
refactor(cli,ext,ops): cleanup regex with lazy-regex (#17296)
- bump deps: the newest `lazy-regex` need newer `oncecell` and
`regex`
- reduce `unwrap`
- remove dep `lazy_static`
- make more regex cached

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-13 03:08:01 +02:00
David Sherret d07aa4a072
refactor(npm): use deno_npm and deno_semver (#18602) 2023-04-06 18:46:44 -04:00
Matt Mastracci a1764f7690
refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies,
mainly focused on ensuring that ASCII strings are easy to provide to the
JS runtime.

While we are replacing a 16-byte reference in a number of places with a
24-byte structure (measured via `std::mem::size_of`), the reduction in
copies wins out over the additional size of the arguments passed into
functions.

Benchmarking shows approximately the same if not slightly less wallclock
time/instructions retired, but I believe this continues to open up
further refactoring opportunities.
2023-04-04 06:46:31 -06:00
Dj 62c5664697
feat(ext/ffi): support marking symbols as optional (#18529) 2023-04-03 21:32:21 +03:00
David Sherret ae1ba2af3c
perf(check): faster source hashing (#18534) 2023-04-01 10:12:40 -04:00