Commit graph

443 commits

Author SHA1 Message Date
Bartek Iwańczuk 50a3209fff
chore: deprecate Deno.metrics() API (#20684)
This API is providing hoops to jump through with undergoing migration to
`#[op2]` macro. 

The overhead of supporting this API is non-trivial and besides internal
use of it in test sanitizers is very rarely used in the wild.
2023-09-26 17:34:53 +02:00
Bartek Iwańczuk 142449ecab
refactor: rewrite some ops to op2 macro (#20603) 2023-09-21 08:08:23 -06:00
Nayeem Rahman 86c04f43e0
fix(lsp): pass quote preference to tsc (#20547) 2023-09-18 20:48:32 +01:00
Bartek Iwańczuk 0b78a61f08
refactor: rewrite cli/ ops to op2 (#20462) 2023-09-12 13:14:45 +02:00
Bartek Iwańczuk 82c2864065
refactor: strongly typed TSC ops (#20466)
Removes usage of `serde_json::Value` in several ops used in TSC, in
favor of using strongly typed structs. This will unblock more 
changes in https://github.com/denoland/deno/pull/20462.
2023-09-12 00:55:57 +00:00
Matt Mastracci 950e0e9cd6
fix(ext/http): create a graceful shutdown API (#20387)
This PR implements a graceful shutdown API for Deno.serve, allowing all
current connections to drain from the server before shutting down, while
preventing new connections from being started or new transactions on
existing connections from being created.

We split the cancellation handle into two parts: a listener handle, and
a connection handle. A graceful shutdown cancels the listener only,
while allowing the connections to drain. The connection handle aborts
all futures. If the listener handle is cancelled, we put the connections
into graceful shutdown mode, which disables keep-alive on http/1.1 and
uses http/2 mechanisms for http/2 connections.

In addition, we now guarantee that all connections are complete or
cancelled, and all resources are cleaned up when the server `finished`
promise resolves -- we use a Rust-side server refcount for this.

Performance impact: does not appear to affect basic serving performance
by more than 1% (~126k -> ~125k)

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-09-12 00:06:38 +00:00
David Sherret c228adc27d
feat: TypeScript 5.2 (#20425)
Without `using` declarations or decorator metadata (waiting for that in
v8).
2023-09-09 15:03:21 -04:00
David Sherret 3fc19dab47
feat: support import attributes (#20342) 2023-09-07 09:09:16 -04:00
Bartek Iwańczuk 147c845c95
feat(test): Add Deno.test.ignore and Deno.test.only (#20365)
Closes https://github.com/denoland/deno/issues/17106
2023-09-06 14:17:33 +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
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
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
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
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
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
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
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 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
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
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 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
David Sherret b03d82e5d3
fix(tsc): more informative diagnostic when Deno does not exist (#19825)
Also improved the diagnostic when using something like `Deno.openKv` and
it doesn't exist.
2023-07-13 23:29:51 +00:00
David Sherret 8dd9d5f523
refactor(lsp): move config file related code to config.rs (#19790)
Will make #19788 easier.
2023-07-10 21:45:09 +00:00
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
David Sherret 23b9be7b37
fix(check): ensure diagnostics caused by changes in other files get invalidated between runs (#18541)
Regression caused by the performance improvement in #18329. Figuring
this out was hard. It's luckily still fast after this change.

Closes #18516
2023-04-01 10:04:56 -04:00
David Sherret 7ec45770c8
fix: upgrade to TypeScript 5.0.3 (#18532) 2023-03-31 17:09:04 +00:00
David Sherret 87ccd4bcd1
fix(lsp): better handling of data: urls (#18527)
1. Log instead of error when the referrer can't be found
2. Fixes typescript to resolve data urls correctly. Properly documented
here:
https://github.com/denoland/TypeScript/pull/4/files#diff-180da7c288743d11d8590d30f0c07c48e5dcf291aa671bbea0dd520a9a1359d2

Closes #18524
2023-03-31 16:48:18 +00:00
Luca Casonato 02e01b171f
fix(dts): improve types for the Deno.KV API (#18510) 2023-03-30 22:52:31 +02:00
Luca Casonato e888c3f534
feat(ext/kv): return versionstamp from set/commit (#18512)
This commit updates the `Deno.Kv` API to return the new commited
versionstamp for the mutated data from `db.set` and `ao.commit`. This is
returned in the form of a `Deno.KvCommitResult` object that has a
`versionstamp` property.
2023-03-30 20:57:21 +02:00
David Sherret c4f82cab31
fix(lsp): textDocument/references should respect includeDeclaration (#18496) 2023-03-30 16:15:21 +00:00
David Sherret 3abc53f811
docs: clarify Deno.consoleSize returns the window size (#18508)
Closes #18477
2023-03-30 11:47:33 -04:00
Heyang Zhou 27834dfc10
chore(ext/kv): add limits (#18415) 2023-03-25 15:29:36 +08:00
David Sherret 675179a176
chore(types): fix type checking errors in 99_main_compiler.js (#18403) 2023-03-24 10:35:44 -04:00
Matt Mastracci ad77ba0f7b
fix(core): panic at build time if extension code contains anything other than 7-bit ASCII (#18372)
This will improve diagnostics and catch any non-ASCII extension code
early.

This will use `debug_assert!` rather than `assert!` to avoid runtime
costs, and ensures (in debug_assert mode only) that all extension source
files are ASCII as we load them.
2023-03-23 16:00:46 -06:00
Ryan Dahl f9c8d98b77
Revert "refactor: rename Deno.openKv() to Deno.kv() (#18349)" (#18362)
This reverts commit 50b793c9ed.
2023-03-22 20:23:36 +01:00
Ryan Dahl 50b793c9ed
refactor: rename Deno.openKv() to Deno.kv() (#18349) 2023-03-22 10:02:40 -04:00
Bartek Iwańczuk e73e8410f6
chore: upgrade rusty_v8 to 0.66.0 (#18339) 2023-03-22 13:38:56 +01:00
Heyang Zhou 92ebf4afe5
feat(ext/kv): key-value store (#18232)
This commit adds unstable "Deno.openKv()" API that allows to open
a key-value database at a specified path.

---------

Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-22 12:13:24 +08:00
Matt Mastracci 0b4770fa7d
perf(core) Reduce script name and script code copies (#18298)
Reduce the number of copies and allocations of script code by carrying
around ownership/reference information from creation time.

As an advantage, this allows us to maintain the identity of `&'static
str`-based scripts and use v8's external 1-byte strings (to avoid
incorrectly passing non-ASCII strings, debug `assert!`s gate all string
reference paths).

Benchmark results:

Perf improvements -- ~0.1 - 0.2ms faster, but should reduce garbage
w/external strings and reduces data copies overall. May also unlock some
more interesting optimizations in the future.

This requires adding some generics to functions, but manual
monomorphization has been applied (outer/inner function) to avoid code
bloat.
2023-03-21 22:33:12 +00:00
David Sherret 253b556e6f
perf(check): type check local files only when not using --all (#18329)
Closes #18171
2023-03-21 18:19:42 -04:00
Bartek Iwańczuk 7e61e8f0e0
chore: update formatting configuration (#18331) 2023-03-21 17:01:53 -04:00
Bartek Iwańczuk cc46f6776c
Revert "perf: disable TSC snapshot compression (#18333)" (#18336)
This reverts commit 0d27de943a.
2023-03-21 19:11:22 +00:00
Bartek Iwańczuk 0d27de943a
perf: disable TSC snapshot compression (#18333)
This commit disables compression of the TSC snapshot.
The compression only decreased the size of snapshot by 0.5Mb
and it took about 40s during release build to compress.

With recent gains in TS 5.0 upgrade in terms of size and performance
it makes sense to remove this compression.
2023-03-21 17:53:46 +00:00
David Sherret 2fcf1f14cf
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator
support because swc does not support that yet.
2023-03-21 15:46:40 +00:00
ayame113 c34e26a9d5
docs: fix broken Deno.FsFile#readable example code (#18277) 2023-03-21 16:22:21 +09:00
Sam Gwilym 4c34a2f2df
feat(ext/net): Add multicasting APIs to DatagramConn (#10706) (#17811) 2023-03-20 22:27:00 +01:00
Bartek Iwańczuk 3c9771deb2
Reland "perf(core): preserve ops between snapshots (#18080)" (#18272)
Relanding 4b6305f4f2
2023-03-18 18:30:04 -04:00
Bartek Iwańczuk d11e89127d
Revert "perf(core): preserve ops between snapshots (#18080)" (#18267)
This reverts commit 4b6305f4f2.
2023-03-18 14:59:51 +00:00
Andrew 44553aa09e
docs(FFI/UnsafePointerView): fix a typo in a docstring (#18034) 2023-03-18 12:25:06 +00:00
Bartek Iwańczuk 4b6305f4f2
perf(core): preserve ops between snapshots (#18080)
This commit changes the build process in a way that preserves already
registered ops in the snapshot. This allows us to skip creating hundreds of
"v8::String" on each startup, but sadly there is still some op registration
going on startup (however we're registering 49 ops instead of >200 ops). 

This situation could be further improved, by moving some of the ops 
from "runtime/" to a separate extension crates.

---------

Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-03-18 12:51:21 +01:00
Matt Mastracci 3487fde236
perf(core) Reduce copying and cloning in extension initialization (#18252)
Follow-up to #18210:

* we are passing the generated `cfg` object into the state function
rather than passing individual config fields
 * reduce cloning dramatically by making the state_fn `FnOnce`
 * `take` for `ExtensionBuilder` to avoid more unnecessary copies
 * renamed `config` to `options`
2023-03-17 22:15:27 +00:00
Matt Mastracci e55b448730
feat(core) deno_core::extension! macro to simplify extension registration (#18210)
This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements:

* `deno_core::ops!` registers a block of `#[op]`s, optionally with type
parameters, useful for places where we share lists of ops
* `deno_core::extension!` is used to register an extension, and creates
two methods that can be used at runtime/snapshot generation time:
`init_ops` and `init_ops_and_esm`.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 18:22:15 +00:00
Leo Kettmeir 35196eab27
BREAKING(unstable): remove WebGPU (#18094)
This PR _**temporarily**_ removes WebGPU (which has behind the
`--unstable` flag in Deno), due to performance complications due to its
presence.

It will be brought back in the future; as a point of reference, Chrome
will ship WebGPU to stable on 26/04/2023.

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-17 00:29:32 +01:00
Bartek Iwańczuk 3f031ad9af
BREAKING(ext/fs): FileInfo.dev is defined on Windows (#18237)
Addresses feedback from
https://github.com/denoland/deno/pull/18073#issuecomment-1471480385.

Reverts changes to `FileInfo` fields that are not available on Windows
making them `null`. Only `FileInfo.dev` is non-null.
2023-03-17 00:14:56 +01:00
Bartek Iwańczuk 48a0b7f98f
feat(fs): support FileInfo.dev on Windows (#18073)
This commit adds support for retrieving `dev` information
when stating files on Windows.

Additionally `Deno.FileInfo` interfaces was changed to always
return 0 for fields that we don't retrieve information for on Windows.

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

---------

Co-authored-by: David Sherret <dsherret@gmail.com>
2023-03-16 02:35:13 +01:00
Bartek Iwańczuk 1930c09b04
refactor(core): remove "resolve_url_or_path_deprecated" (#18174)
Remove remaining usages of "resolve_url_or_path_deprecated" in favor
of "resolve_url_or_path" with explicit calls to
"std::env::current_dir()".

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-14 17:18:01 +00:00
Bartek Iwańczuk 48ede89f1f
refactor(core): resolve_url_or_path and resolve_url_or_path_deprecated (#18170)
This commit changes current "deno_core::resolve_url_or_path" API to
"resolve_url_or_path_deprecated" and adds new "resolve_url_or_path"
API that requires to explicitly pass the directory from which paths
should be resolved to. 

Some of the call sites were updated to use the new API, the reminder
of them will be updated in a follow up PR.

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-14 01:12:09 +00:00
Bartek Iwańczuk c4771356f2
refactor: Remove call sites of "deno_core::resolve_url_or_path" (#18169)
These call sites didn't need to use "resolve_url_or_path".

Towards landing https://github.com/denoland/deno/pull/15454
2023-03-13 19:31:03 -04:00
David Sherret bcb6ee9d08
refactor(npm): push npm struct creation to a higher level (#18139)
This has been bothering me for a while and it became more painful while
working on #18136 because injecting the shared progress bar became very
verbose. Basically we should move the creation of all these npm structs
up to a higher level.

This is a stepping stone for a future refactor where we can improve how
we create all our structs.
2023-03-12 23:32:59 -04:00
David Sherret 8db853514c
fix(check): regression where config "types" entries caused type checking errors (#18124)
Closes #18117
Closes #18121 (this is just over 10ms faster in a directory one up from
the root folder)

cc @nayeemrmn
2023-03-11 11:43:45 -05:00
Bartek Iwańczuk b32a6f8ad2
refactor(core): don't use Result in ExtensionBuilder::state (#18066)
There's no point for this API to expect result. If something fails it should
result in a panic during build time to signal to embedder that setup is
wrong.
2023-03-07 22:37:37 +01:00
ayame113 08591d052a
chore(docs): Fixed manual link (#18060) 2023-03-07 08:01:56 -05:00
Nayeem Rahman 273777f7d9
fix(check): include dts files in tsc roots (#18026) 2023-03-05 12:47:04 -05:00
Geert-Jan Zwiers 399a22db88
chore(docs): add note about loadavg returning 0 on windows (#18006) 2023-03-04 05:31:55 -04:00
Divy Srivastava 38555a6a0f
feat(ops): reland fast zero copy string arguments (#17996)
Reland https://github.com/denoland/deno/pull/16777

The codegen is disabled in async ops and when fallback to slow call is
possible (return type is a Result) to avoid hitting this V8 bug:
https://github.com/denoland/deno/issues/17159
2023-03-03 19:04:10 +05:30
David Sherret 033b70af19
fix(npm): lazily install package.json dependencies only when necessary (#17931)
This lazily does an "npm install" when any package name matches what's
found in the package.json or when running a script from package.json
with deno task.

Part of #17916

Closes #17928
2023-02-24 19:35:43 -05:00
Leo Kettmeir 484b6fe2fa
refactor(flash): move remoteAddr to options bag (#17913)
Applies suggestion from #17912
2023-02-24 23:36:07 +01:00
David Sherret 344317ec50
feat(npm): support bare specifiers from package.json in more subcommands and language server (#17891) 2023-02-23 10:58:10 -05:00
David Sherret a6ca4d0d61
refactor: use deno_graph for npm specifiers (#17858)
This changes npm specifiers to be handled by deno_graph and resolved to
an npm package name and version when the specifier is encountered. It
also slightly changes how npm specifier resolution occurs—previously it
would collect all the npm specifiers and resolve them all at once, but
now it resolves them on the fly as they are encountered in the module
graph.

https://github.com/denoland/deno_graph/pull/232

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-02-22 14:15:25 -05:00
Aapo Alasuutari 0f9daaeacb
fix(ext/ffi): Fix re-ref'ing UnsafeCallback (#17704) 2023-02-22 19:09:59 +00:00
Aapo Alasuutari b56b8c8a75
feat(ext/ffi): Replace pointer integers with v8::External objects (#16889) 2023-02-22 19:32:38 +02:00
Ryan Dahl 4afa150f21
Revert "feat: Deprecate Deno.run API in favor of Deno.Command (#17630)" (#17875)
Deno.Command needs to be stabilized first and allow people to upgrade to
it before we can deprecate Deno.run. Otherwise lint will suddenly fail
with deprecated errors without giving people a chance to update.
2023-02-22 07:27:00 -05:00
David Sherret 2f98c3e1a6
chore: remove base64 encoding code from typescript snapshot (#17862)
This code is no longer used because we use swc for this now.
2023-02-21 22:56:58 -05:00
David Sherret 3479bc7661
fix(npm): improve peer dependency resolution (#17835)
This PR fixes peer dependency resolution to only resolve peers based on
the current graph traversal path. Previously, it would resolve a peers
by looking at a graph node's ancestors, which is not correct because
graph nodes are shared by different resolutions.

It also stores more information about peer dependency resolution in the
lockfile.
2023-02-21 12:03:48 -05:00
Bartek Iwańczuk 848e2c0d57
feat: Deprecate Deno.run API in favor of Deno.Command (#17630) 2023-02-16 12:11:32 +01:00
David Sherret c4b9a91e27
refactor: use deno_graph's semver and npm structs (#17791) 2023-02-15 13:20:40 -05:00
Leo Kettmeir c7535950b6
feat(flash): add 2nd param to handler to get remote address (#17633)
Closes #17583
2023-02-15 16:37:41 +01:00
Bartek Iwańczuk 201737c518
feat: stabilize Deno.osUptime() (#17554)
This commit stabilizes "Deno.osUptime()" API. The "--unstable" flag is
no longer required to use this API.
2023-02-14 12:35:38 +01:00
Bartek Iwańczuk 2502a37d41
chore(build): don't compress TSC snapshot in debug build (#17772)
Compressing the TSC snapshot in debug build took
~45s on M1 MacBook Pro; without compression it took ~1s.
Thus we're not not using compressed snapshot, trading off
a lot of build time for some startup time in debug build.
2023-02-14 02:46:32 +01:00
Bartek Iwańczuk f917d2e2c1
feat: Stabilize Deno.Command API (#17628)
This commit stabilizes "Deno.Command" API with all its related APIs.

"--unstable" flag is no longer required to use this API.
2023-02-13 19:25:00 +01:00
Leo Kettmeir 8b5be962f5
fix: add WouldBlock error (#17339) 2023-02-12 23:14:33 +01:00
Leo Kettmeir a55f0eb2fc
feat: add signal option to Deno.resolveDns (#17384)
Closes #14406
2023-02-11 14:14:02 +00:00
Leo Kettmeir e22ebc6b6b
feat: add more variants to Deno.build.os (#17340)
Closes #14799
2023-02-11 14:25:45 +01:00
Kamil Ogórek 68008bee51
fix(dts): make Deno.Command accept readonly prop in options.args (#17718) 2023-02-10 18:09:02 +01:00
David Sherret b3e88e0681
refactor: deno_graph 0.43 upgrade (#17692) 2023-02-09 22:00:23 -05:00
Leo Kettmeir 84a96110cd
refactor: rename deno specifiers to internal (#17655) 2023-02-05 17:49:20 +01:00
Leo Kettmeir 3035dee9f1
chore: update webgpu (#17534) 2023-01-30 15:14:16 +01:00
RA80533 50ba8ae6b2
docs: fix typos in WriteFileOptions's JSDoc (#17507) 2023-01-28 22:10:06 +01:00
David Sherret f5840bdcd3
chore: upgrade to Rust 1.67 (#17548)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-01-27 10:43:16 -05:00
David Sherret 83642976bf
fix: remove leftover Deno.spawn references (#17524) 2023-01-25 12:28:08 -05:00
Asher Gomez 900929f65c
feat: Add sync APIs for "Deno.permissions" (#17019)
This commit adds sync versions of async APIs to "Deno.permissions"
namespace.

Following APIs were added:
- "Deno.permissions.querySync"
- "Deno.permissions.requestSync"
- "Deno.permissions.revokeSync"
2023-01-25 00:42:44 +01:00
Leo Kettmeir 2027d98a8e
feat: allow first arg in test step to be a function (#17096) 2023-01-24 15:41:01 +01:00
Bartek Iwańczuk fc2e00152b
feat: support node built-in module imports (#17264)
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-01-24 09:05:54 -05:00
Leo Kettmeir cadeaae045
feat(runtime/command): make stdin default to inherit for spawn() (#17334)
Closes #17230
2023-01-24 15:03:46 +01:00
David Sherret 654e177c91
refactor(deno_graph): remove unused Resolved::Ok#kind usage (#17504)
See https://github.com/denoland/deno_graph/pull/205 for more details.
2023-01-24 08:23:19 -05:00
Bartek Iwańczuk da23f7f876
feat: Stabilize Deno.Listener.ref/unref (#17477) 2023-01-20 16:32:55 +01:00
Leo Kettmeir 18e8ce4ca5
feat(runtime): add bigint to seek typings (#17314) 2023-01-19 05:30:56 +01:00
Asher Gomez 7683ba5e90
chore: update std submodule and its imports (#17408) 2023-01-15 21:09:26 +01:00
David Sherret 1712a88e69
refactor(tsc): do not store some typescript declaration file text in multiple places (#17410) 2023-01-14 09:36:19 -05:00
Leo Kettmeir a6b3910bdf
feat: allow passing a ReadableStream to Deno.writeFile/Deno.writeTextFile (#17329)
Closes #13229
2023-01-12 03:37:23 +01:00
Bartek Iwańczuk 636352e0ca
fix(npm): allow to read package.json if permissions are granted (#17209)
This commit changes signature of "deno_core::ModuleLoader::resolve" to pass
an enum indicating whether or not we're resolving a specifier for dynamic import.

Additionally "CliModuleLoader" was changes to store both "parent permissions" (or
"root permissions") as well as "dynamic permissions" that allow to check for permissions
in top-level module load an dynamic imports.

Then all code paths that have anything to do with Node/npm compat are now checking
for permissions which are passed from module loader instance associated with given
worker.
2023-01-10 14:35:44 +01:00
Leo Kettmeir e6c49d14b1
feat(runtime/os): add Deno.env.has() (#17315) 2023-01-09 20:19:55 +01:00
Leo Kettmeir c41d4ff90e
feat(core): allow specifying name and dependencies of an Extension (#17301) 2023-01-08 23:48:46 +01:00
Dj ad82918f56
feat(ext/ffi): structs by value (#15060)
Adds support for passing and returning structs as buffers to FFI. This does not implement fastapi support for structs. Needed for certain system APIs such as AppKit on macOS.
2023-01-08 09:28:10 +05:30
Geert-Jan Zwiers 4e6b78cb43
refactor(cli): clean up clones (#17268) 2023-01-05 12:33:09 -05:00
Yiyu Lin 319f607476
chore(cli,ext,rt): remove some unnecessary clone or malloc (#17261) 2023-01-04 13:20:36 +01:00
David Sherret 421ec90a8e
fix(declaration): change Deno.open example to not use Deno.close(rid) (#17218) 2023-01-03 10:48:03 -05:00
David Sherret 10e4b2e140
chore: update copyright year to 2023 (#17247)
Yearly tradition of creating extra noise in git.
2023-01-02 21:00:42 +00:00
Kamil Ogórek 7ce2b58bcf
feat(unstable): Add "Deno.osUptime()" API (#17179)
This PR adds support for `Deno.osUptime` which reports number of seconds
since os was booted. It will allow us to be compatible with Node's `os.uptime` -
https://nodejs.org/api/os.html#osuptime

Partially based on
https://docs.rs/uptime_lib/latest/src/uptime_lib/lib.rs.html
2022-12-27 00:16:12 +01:00
linbingquan f46df3e359
chore: update to Rust 1.66.0 (#17078) 2022-12-17 23:20:15 +01:00
Leo Kettmeir 50c7526526
fix: re-add Response.json static method (#17061)
Same as #16040
2022-12-15 10:33:19 -05:00
Bartek Iwańczuk 585ec1218f
Revert "feat(ops): Fast zero copy string arguments (#16777)" (#17063)
This reverts commit 9b2b8df927.

Closes https://github.com/dsherret/ts-morph/issues/1372
Closes https://github.com/denoland/deno/issues/16979
2022-12-15 15:26:10 +00:00
David Sherret 9e9e8f1e38
fix: upgrade to TS 4.9.4 (#17048) 2022-12-14 13:00:51 -05:00
Leo Kettmeir 76a9df1ed8
docs: use example & default tags (#17032) 2022-12-13 14:14:41 +01:00
Leo Kettmeir 5d9bb8b4b0
feat: support createNew in Deno.writeFile (#17023) 2022-12-13 05:12:49 +01:00
Leo Kettmeir a2ba573e77
fix: default to "inherit" for Deno.Command#spawn()'s stdout & stderr (#17025) 2022-12-13 05:12:19 +01:00
David Sherret 653aebfa1a
fix: respect the --quiet flag in more cases (#16998) 2022-12-09 10:54:24 -05:00
Bartek Iwańczuk cb6700fa5a
unstable: remove Deno.spawn, Deno.spawnSync, Deno.spawnChild APIs (#16893)
This commit removes three unstable Deno APIs:
- "Deno.spawn()"
- "Deno.spawnSync()"
- "Deno.spawnChild()"

These APIs were replaced by a unified "Deno.Command" API.
2022-12-09 16:43:36 +01:00
David Sherret 91443bbc0b
fix(compile): ensure import map is used when specified in deno config file (#16990)
Closes #14246
2022-12-08 11:50:09 -05:00
David Sherret f4385866f8
feat: upgrade to TypeScript 4.9.3 (#16973)
Updated from: https://github.com/denoland/TypeScript/pull/2
2022-12-07 12:59:59 -05:00
David Sherret c03e0f3853
refactor: remove deno_graph::Locker usage (#16877)
This is just a straight refactor and doesn't make any improvements to
the code that could now be made.

Closes #16493
2022-12-06 14:12:51 -05:00
David Sherret 3973ceb634
fix(npm): dependency types were sometimes not being resolved when package had no types entry (#16958)
Closes #16957
2022-12-05 20:09:31 -05:00
阿豪 8b5b327b18
feat(ext/ffi): better type hints for Deno.dlopen (#16874) 2022-12-03 17:45:35 +05:30
Divy Srivastava 9b2b8df927
feat(ops): Fast zero copy string arguments (#16777)
Uses SeqOneByteString optimization to do zero-copy `&str` arguments in
fast calls.

- [x] Depends on https://github.com/denoland/rusty_v8/pull/1129
- [x] Depends on
https://chromium-review.googlesource.com/c/v8/v8/+/4036884
- [x] Disable in async ops
- [x] Make it work with owned `String` with an extra alloc in fast path.
- [x] Support `Cow<'_, str>`. Owned for slow case, Borrowed for fast
case

```rust
#[op]
fn op_string_len(s: &str) -> u32 { 
  str.len() as u32 
}
```
2022-12-02 05:29:15 +00:00
David Sherret b1e29d1bd0
fix(npm): improve package.json exports support for types (#16880) 2022-11-30 23:07:32 +00:00
David Sherret 2d4c46c975
refactor: create util folder, move nap_sym to napi/sym, move http_cache to cache folder (#16857) 2022-11-28 17:28:54 -05:00
Leo Kettmeir 1dd4843b62
feat(unstable): rework Deno.Command (#16812)
Refactors the `Deno.Command` class to not handle any state, but only being an intermediary to calling its methods, and as such any methods and properties besides `output`, `outputSync` & `spawn` have been removed. Interracting with a `spawn`ed subprocess now works by using the methods and properties on the returned class of the `spawn` method.
2022-11-28 12:33:51 +01:00
David Sherret dcb4ffb93a
refactor: move dts files, diagnostics.rs, and tsc.rs to tsc folder (#16820) 2022-11-25 18:29:48 -05:00
David Sherret beaa0d8867
chore: more debug logging and avoid allocating strings in ts logging when not debug (#16689) 2022-11-23 13:34:44 -05:00
Bartek Iwańczuk b70f520ebc
fix: Make npm packages works with import maps (#16754)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-11-22 20:09:30 +01:00
David Sherret bfd9912e1f
fix(typescript): allow synthetic default imports when using ModuleKind.ESNext (#16438)
Closes #16437
2022-10-27 08:12:40 -04:00
David Sherret 8864a1d10f
fix(lsp): regression - error when removing file (#16388) 2022-10-22 15:36:07 -04:00
David Sherret bcfe279fba
feat(unstable/npm): initial type checking of npm specifiers (#16332) 2022-10-21 15:20:18 +00:00
Divy Srivastava 0f27b84a5c
chore(core): remove core.opSync (#16379)
This patch removes the last uses of `core.opSync` from Deno.

The new and JIT-friendly way to call sync ops is `core.ops.op_name()`.
2022-10-21 19:35:23 +05:30
Kitson Kelly 7d78f58187
feat: support inlay hints (#16287)
Closes: #11853
2022-10-16 13:39:43 +11:00
Kitson Kelly 73e89844ba
feat(cli): update to TypeScript 4.8 (#15064) 2022-09-20 07:00:01 +10:00
Aapo Alasuutari 2164f6b1eb
perf(ops): Monomorphic sync op calls (#15337)
Welcome to better optimised op calls! Currently opSync is called with parameters of every type and count. This most definitely makes the call megamorphic. Additionally, it seems that spread params leads to V8 not being able to optimise the calls quite as well (apparently Fast Calls cannot be used with spread params).

Monomorphising op calls should lead to some improved performance. Now that unwrapping of sync ops results is done on Rust side, this is pretty simple:

```
opSync("op_foo", param1, param2);
// -> turns to
ops.op_foo(param1, param2);
```

This means sync op calls are now just directly calling the native binding function. When V8 Fast API Calls are enabled, this will enable those to be called on the optimised path.

Monomorphising async ops likely requires using callbacks and is left as an exercise to the reader.
2022-08-11 15:56:56 +02:00
Yongwook Choi 2138b68c24
fix: Update Object.prototype.__proto__ related comments (#15394) 2022-08-04 08:39:16 +05:30
David Sherret 0c87dd1e98
perf: use emit from swc instead of tsc (#15118) 2022-07-12 18:58:39 -04:00
Kitson Kelly 5db16d1229
fix(lsp): enable auto imports (#15145)
Fixes: #15111
2022-07-12 09:35:18 +10:00
Rafael Ávila de Espíndola 2d15e926f9
fix: update to TypeScript 4.7.4 (#15022) 2022-07-04 15:13:50 +10:00
Bartek Iwańczuk 681bb49d0d
fix(lsp): restart TS language service when caching dependencies (#14979) 2022-06-27 19:43:43 +02:00
Nayeem Rahman ef7bc5e0a6
fix(check): ignore TS2306 (#14940)
Fixes a regression where this type checking error was being surfaced in certain scenarios.
2022-06-23 12:18:32 -04:00
Nayeem Rahman 845d4754c6
fix(check): use "moduleDetection": "force" (#14875) 2022-06-15 12:26:43 -04:00
Kitson Kelly 5692132755
fix(lsp): handle get diagnostic errors better (#14776) 2022-06-03 22:23:33 +10:00
Kitson Kelly 7eee521199
feat: update to TypeScript 4.7 (#14242) 2022-06-01 10:19:18 +10:00
Bartek Iwańczuk d76acfdc17
fix: base64 encoding of source maps with emojis (#14607)
This commit fixes source maps for files that contain emojis.

This is done by updating "deno_ast" to "0.14.1" for the case
of "--no-check" flag (ie using SWC emit) and by overriding
TSC's default base64 encoder (which turned out to be buggy)
for the type checking case.
2022-05-17 16:59:35 +02:00
David Sherret eb5ffab1cb
fix(lsp): correct positions in some scenarios (#14359) 2022-05-15 14:41:37 -04:00
Kitson Kelly ef26a267ae
fix(cli): add dom.extras lib (#14430)
Closes: #12558
Fixes: #14344
2022-04-29 13:47:58 +10:00
David Sherret c0e3b6096d
refactor(lsp): store all the assets in Rust when initializing (#14367) 2022-04-25 11:23:24 -04:00
Divy Srivastava b4e42953e1
feat(core): codegen ops (#13861)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
2022-03-14 18:44:15 +01:00