0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
Commit graph

1898 commits

Author SHA1 Message Date
Yusuke Tanaka
44a89dd6dc
fix(ext/net): return an error from startTls and serveHttp if the original connection is captured elsewhere (#16242)
This commit removes the calls to `expect()` on `std::rc::Rc`, which caused
Deno to panic under certain situations. We now return an error if `Rc`
is referenced by other variables.

Fixes #9360
Fixes #13345
Fixes #13926
Fixes #16241

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-10-18 11:28:27 +09:00
David Sherret
74be01273c
chore: upgrade internal deno_std to 0.160 (#16333) 2022-10-17 22:57:31 +00:00
David Sherret
698ae4bfed
feat(unstable/npm): support providing npm dist-tag in npm package specifier (#16293) 2022-10-17 09:16:19 -04:00
Yoshiya Hinosawa
e41af14b2a
feat(unstable): add windowsRawArguments to SpawnOptions (#16319)
This change adds `windowsRawArguments` to `SpawnOptions`. The option enables
skipping the default quoting and escaping while creating the command on
windows.

The option works in a similar way as `windowsVerbatimArguments` in
child_process.spawn options in Node.js, and is necessary for simulating
it in `std/node`.

closes #8852
2022-10-17 19:51:25 +09:00
Cre3per
cf1be5e76f
fix: add error cause in recursive cause tail (#16306) 2022-10-16 21:16:46 +02:00
Marcos Casagrande
5252ff5dbd
fix(ext/cache): illegal constructor (#16205) 2022-10-16 23:03:17 +05:30
Kitson Kelly
7d78f58187
feat: support inlay hints (#16287)
Closes: #11853
2022-10-16 13:39:43 +11:00
David Sherret
872dc9b1df
feat(unstable/task): add INIT_CWD env var (#16110) 2022-10-15 16:46:28 -04:00
Filip Skokan
225d516466
fix(ext/crypto): correct HMAC get key length op (#16201)
fixes #16180

`HMAC`'s `get key length` `op` uses the hash function's block size, not
output size.

refs
https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
2022-10-15 10:53:35 +05:30
Kitson Kelly
afcea6c233
fix(lsp): properly handle snippets on completions (#16274)
Fixes #15367
2022-10-14 23:04:38 +11:00
Matt Ezell
06ccb6d41e
chore: Added onbeforeunload to window type definition (#16251) 2022-10-13 10:47:47 +02:00
Marcos Casagrande
0cd05d7377
fix(ext/fetch): fix illegal header regex (#16236)
This PR fixes invalid header parsing which is flaky because `g` flag is
being used in the regex, which keeps track of `lastIndex`

```javascript
try {
  new Headers([["x", "\u0000x"]]);  // error
} catch(e) {}
new Headers([["x", "\u0000x"]]); // no error
```

This issue affects `Response` & `Request` constructors as well
2022-10-10 12:06:50 -04:00
sigmaSd
70ad6717df
fix sparse array inspection (#16204)
fix https://github.com/denoland/deno/issues/16202
2022-10-10 10:22:21 -04:00
Luca Casonato
3b6b75bb46
feat(core): improve resource read & write traits (#16115)
This commit introduces two new buffer wrapper types to `deno_core`. The
main benefit of these new wrappers is that they can wrap a number of
different underlying buffer types. This allows for a more flexible read
and write API on resources that will require less copying of data
between different buffer representations.

- `BufView` is a read-only view onto a buffer. It can be backed by
`ZeroCopyBuf`, `Vec<u8>`, and `bytes::Bytes`.
- `BufViewMut` is a read-write view onto a buffer. It can be cheaply
converted into a `BufView`. It can be backed by `ZeroCopyBuf` or
`Vec<u8>`.

Both new buffer views have a cursor. This means that the start point of
the view can be constrained to write / read from just a slice of the
view. Only the start point of the slice can be adjusted. The end point
is fixed. To adjust the end point, the underlying buffer needs to be
truncated.

Readable resources have been changed to better cater to resources that
do not support BYOB reads. The basic `read` method now returns a
`BufView` instead of taking a `ZeroCopyBuf` to fill. This allows the
operation to return buffers that the resource has already allocated,
instead of forcing the caller to allocate the buffer. BYOB reads are
still very useful for resources that support them, so a new `read_byob`
method has been added that takes a `BufViewMut` to fill. `op_read`
attempts to use `read_byob` if the resource supports it, which falls
back to `read` and performs an additional copy if it does not. For
Rust->JS reads this change should have no impact, but for Rust->Rust
reads, this allows the caller to avoid an additional copy in many
scenarios. This combined with the support for `BufView` to be backed by
`bytes::Bytes` allows us to avoid one data copy when piping from a
`fetch` response into an `ext/http` response.

Writable resources have been changed to take a `BufView` instead of a
`ZeroCopyBuf` as an argument. This allows for less copying of data in
certain scenarios, as described above. Additionally a new
`Resource::write_all` method has been added that takes a `BufView` and
continually attempts to write the resource until the entire buffer has
been written. Certain resources like files can override this method to
provide a more efficient `write_all` implementation.
2022-10-09 14:49:25 +00:00
Marcos Casagrande
3a3a848406
fix(ext/cache): prevent cache insert if body is not fully written (#16138) 2022-10-05 16:31:24 +05:30
ayame113
b5425ae2d3
fix(ext/flash): Avoid sending Content-Length when status code is 204 (#15901)
Currently Content-Length is sent when the status code is 204. However,
according to the spec, this should not be sent.
Modify the if statement below to prevent the Content-Length from being
sent.
2022-10-05 12:21:59 +05:30
Marcos Casagrande
569287b15b
perf(ext/fetch): consume body using ops (#16038)
This commit adds a fast path to `Request` and `Response` that
make consuming request bodies much faster when using `Body#text`,
`Body#arrayBuffer`, and `Body#blob`, if the body is a FastStream.
Because the response bodies for `fetch` are FastStream, this speeds up
consuming `fetch` response bodies significantly.
2022-10-04 15:48:50 +02:00
Bartek Iwańczuk
0b4a6c4d08
chore: remove 'fix_exotic_specifier' test (#16143)
It's a test that's been flaky for a week, and after offline discussion,
we're no longer sure what it's testing.
2022-10-04 14:24:35 +02:00
Filip Skokan
0d042d8e54
fix(ext/crypto): interoperable import/export (#16153)
This PR updates RSA key import/export to a state which is interoperable
with other implementations.

For RSA the only OID in and out is `rsaEncryption`.
For EC the only OID in and out is `id-ecpublickey` (fixed in #16152).

see https://github.com/w3c/webcrypto/issues/307#issuecomment-995813032
see https://github.com/w3c/webcrypto/issues/307
see https://github.com/w3c/webcrypto/pull/305
see https://github.com/nodejs/node/pull/42816
2022-10-04 17:37:59 +05:30
Filip Skokan
aa710aac98
fix(ext/crypto): ecdh spki key import/export roundtrip (#16152) 2022-10-04 17:09:41 +05:30
Aurélien Bertron
8d20784f7a
fix(ext/crypto): deriveBits for ECDH not taking length into account (#16128)
Fixes #16047
2022-10-03 23:10:34 -07:00
Bartek Iwańczuk
fde938116d
feat(unstable): add support for npm specifier cli arguments for 'deno cache' (#16141)
This commit adds support for npm specifier in "deno cache" subcommand.

```
$ deno cache --unstable npm:vite npm:chalk https://deno.land/std/http/file_server.ts
```

Besides downloading requested npm package(s), it will also download
necessary code from "std/node/".
2022-10-03 23:26:42 +02:00
Bartek Iwańczuk
5b097fd7e5
fix(npm): better error is version is specified after subpath (#16131) 2022-10-03 19:10:53 +02:00
Bartek Iwańczuk
8e1b2fca59
fix(npm): panic on invalid package name (#16123) 2022-10-03 17:45:01 +02:00
Marcos Casagrande
e2990be264
fix(ext/cache): close resource on error (#16129) 2022-10-03 09:48:59 +05:30
李瑞丰
b3444e0d3b
fix(ext/crypto): fix importKey error when leading zeroes (#16009)
Co-authored-by: Jason <m.jason.liu@outlook.com>
2022-10-03 09:37:25 +05:30
Marcos Casagrande
a55b194638
fix(ext/cache): acquire reader lock before async op (#16126) 2022-10-02 01:21:48 +02:00
Bartek Iwańczuk
048c06f84f
fix(npm): handle json files in require (#16125) 2022-10-01 22:21:19 +02:00
sigmaSd
a6618dc01c
lsp: use deno:/asset instead of deno:asset (#16023)
Make offering "virtual documents" via the lsp easier to parse. `deno:`
can be ambiguous to parse by editors (can conflict with linux paths)

Neovim recently landed a PR https://github.com/neovim/neovim/pull/19797
that allows it to parse `scheme:/` this PR should make deno lsp work
correctly in neovim
2022-10-01 20:02:25 +02:00
Marcos Casagrande
927f4e2e83
fix(ext/fetch): Body#bodyUsed for static body (#16080)
This fixes a bug where `Body#bodyUsed` incorrectly returns `false`
for a body that has actually already been consumed, after `Body#body`
is called.
2022-09-29 17:38:04 +02:00
ayame113
691e36ac50
chore(ext/flash): Enabling disabled windows tests (#16081) 2022-09-29 10:34:26 +05:30
Kitson Kelly
cfbcb3b613
chore: improve JSDoc for built-in APIs (#16048)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-28 22:21:08 +02:00
Divy Srivastava
e2828ad762
fix(ext/flash): reregister socket on partial read on Windows (#16076) 2022-09-28 20:52:24 +02:00
David Sherret
fcb20ab952
chore: fix flaky integration::lint::compact (#16075) 2022-09-28 13:52:10 -04:00
David Sherret
d677ba67f5
feat(npm): functionality to support child_process.fork (#15891) 2022-09-28 13:04:16 -04:00
Brenley Dueck
23125b275f
feat(lint): add --compact flag for terse output (#15926) 2022-09-28 18:47:48 +02:00
Guilherme Bernal
6c55772f0d
feat(core): add Deno.core.setPromiseHooks (#15475) 2022-09-28 16:09:33 +02:00
Luca Casonato
70bc0eb72b
feat(unstable): Deno.setRaw -> Deno.stdin.setRaw (#15797)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-09-28 15:03:56 +02:00
Yoshiya Hinosawa
fa9e7aab6d
feat: add --allow-sys permission flag (#16028) 2022-09-28 21:46:50 +09:00
Satya Rohith
b312279e58
feat: implement Web Cache API (#15829) 2022-09-28 17:41:12 +05:30
Satya Rohith
7a47321b09
fix(ext/fetch): blob url (#16057)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-09-27 22:07:46 +05:30
Marcos Casagrande
c7dd842f84
perf(ext/fetch): use content-length in InnerBody.consume (#15925)
This fast path prevents repeated allocations when receiving a fetch body with a known size.

Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-09-26 20:27:50 +02:00
李瑞丰
a2262c11d7
fix(ext/console): fix error when logging a proxied Date (#16018) 2022-09-26 23:55:58 +09:00
Marcos Casagrande
b73cb7bf9c
perf(ext/console): break on iterableLimit & better sparse array handling (#15935) 2022-09-26 15:55:22 +09:00
David Sherret
f6a9b49dfb
perf: don't re-download package tarball to global cache if local node_modules folder exists for package (#16005) 2022-09-23 17:35:48 -04:00
Marcos Casagrande
12306022da
test(ext/fetch): enable null body status test on windows (#15995) 2022-09-23 08:34:04 -04:00
David Sherret
9bf4ec2eac
chore: temporarily ignore websocketstream test (#15997) 2022-09-22 12:41:42 -04:00
David Sherret
716005a0d4
feat(npm): add flag for creating and resolving npm packages to a local node_modules folder (#15971) 2022-09-22 11:17:02 -04:00
Bartek Iwańczuk
9a216806d5
feat(npm): add support for --reload=npm: and --reload=npm:<package> (#15972) 2022-09-22 10:39:58 -04:00
Kayla Washburn
1ef96343a1
feat: allow exiting on two consecutive ctrl+c presses (#15981) 2022-09-22 04:42:09 -04:00
Yoshiya Hinosawa
cc32a297da
fix(runtime): better error message with Deno.env.get/set (#15966) 2022-09-21 15:18:58 +09:00
Bartek Iwańczuk
35fe9ee530
fix(flash): panic if response if undefined (#15964)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-09-20 22:08:15 +02:00
Kitson Kelly
73e89844ba
feat(cli): update to TypeScript 4.8 (#15064) 2022-09-20 07:00:01 +10:00
David Sherret
1464b756a4
refactor: move out test files from root testdata directory into sub directories (#15949) 2022-09-19 10:32:21 -04:00
David Sherret
a4a894fa1e
fix(doc): deno doc should parse modules if they haven't been parsed before (#15941) 2022-09-18 13:59:33 -04:00
Yoshiya Hinosawa
d7b27ed63b
fix(ext/node): fix builtin module module (#15904) 2022-09-17 20:35:32 +09:00
Divy Srivastava
6154188786
perf(ext/console): avoid wrapConsole when not inspecting (#15931) 2022-09-17 15:34:43 +05:30
Nayeem Rahman
38280990da
fix(runtime): fix permission status cache keys (#15899) 2022-09-16 20:46:38 +09:00
Divy Srivastava
1de17fad7f
chore(ext/flash): disable flaky flash test (#15908) 2022-09-15 09:52:31 +05:30
Colin Ihrig
19deec4494
fix(ops): add node.js env variable allowlist (#15893)
This commit allows the Node compatibility layer to skip
environment variable permission checks when --unstable
is passed and the variable name is one that Node uses.

Fixes: https://github.com/denoland/deno/issues/15890
2022-09-14 11:59:20 -04:00
Bartek Iwańczuk
7b98282993
fix(npm): binary entrypoint for .js or no extension (#15900) 2022-09-14 10:41:47 -04:00
Bartek Iwańczuk
233d5422fd
fix(npm): use shim from deno_node crate for 'module' built-in module (#15881) 2022-09-12 18:11:32 -04:00
David Sherret
98454c1eb8
fix(npm): support cjs resolution of package subpath with package.json (#15855) 2022-09-12 15:47:54 -04:00
David Sherret
a3a4760831
fix(npm): align Deno importing Node cjs with Node esm importing cjs (#15879) 2022-09-12 14:28:51 -04:00
David Sherret
dee9f0acaf
fix(npm): align Node esm code importing cjs with Node (#15838) 2022-09-10 15:00:45 -04:00
David Sherret
3b0de03b59
fix(npm): remove export binding to match node (#15837) 2022-09-10 11:38:11 -04:00
Bartek Iwańczuk
6c179daff0
fix(npm): recursive translation of reexports, remove window global in node code (#15806)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-09-08 22:01:48 +02:00
David Sherret
9e6917426a
fix: upgrade deno_ast to 0.19 (#15808) 2022-09-07 15:06:18 -04:00
Bartek Iwańczuk
4a250b2f25
feat: add --no-npm flag to disable npm: imports (#15673)
This commit adds "--no-npm" flag, it's similar to "--no-remote"
flag. This flag makes Deno error out if "npm:" specifier is encountered.
2022-09-07 15:33:51 +02:00
Colin Ihrig
3b1204eb2d
fix(core): make errors more resistant to tampering (#15789)
This commit makes error objects more resistant to
prototype tampering.

This bug was found when updating the deno_std Node compatibility
layer to Node 18. The Node test 'parallel/test-assert-fail.js'
was breaking std's assertion library.

Refs: https://github.com/denoland/deno_std/pull/2585
2022-09-07 09:11:16 -04:00
Divy Srivastava
d57f9d560d
fix(ext/flash): use utf8 length as Content-Length (#15793) 2022-09-07 16:21:30 +05:30
Divy Srivastava
7f4b043f32
fix(test): unflake wasm_unreachable test (#15794) 2022-09-07 16:21:18 +05:30
Nayeem Rahman
5819fef2d5
test: fix bad resource fixture (#15792) 2022-09-07 09:49:34 +05:30
Divy Srivastava
d2a408f452
perf(runtime): short-circuit queue_async_op for Poll::Ready (#15773) 2022-09-06 23:08:37 +05:30
Nayeem Rahman
118dd47ad0
fix(watch): ignore unload errors on drop (#15782) 2022-09-06 13:18:23 +02:00
David Sherret
08a6af398f
fix(cli): allow using file resource synchronously while being used async (#15747) 2022-09-04 22:33:06 -04:00
Bartek Iwańczuk
e324151520
BREAKING(unstable): remove --compat mode (#15678)
This commit removes "compat" mode. We shipped support for "npm:" specifier
support in v1.25 and that is preferred way to interact with Node code that we
will iterate and improve upon.
2022-09-03 18:19:30 +02:00
Bartek Iwańczuk
fc4025c878
fix(npm): add more context to errors when file doesn't exist (#15749) 2022-09-03 15:43:35 +02:00
Bartek Iwańczuk
223403e899
feat(info): add information about npm modules cache (#15750) 2022-09-03 15:31:01 +02:00
Nayeem Rahman
4f8dea100e
refactor(test): grab runTests() and runBenchmarks() from __bootstrap (#15420) 2022-09-02 19:44:45 +02:00
Geert-Jan Zwiers
7d622a6643
fix(init): suppress info logs when using quiet mode (#15741) 2022-09-02 17:59:36 +02:00
Garcia
4ec213b0aa
fix(ext/timers): create primordial eval (#15110) 2022-09-02 17:55:44 +02:00
David Sherret
03e6727a04
fix(npm): correct exact matching of pre-release versions (#15745) 2022-09-02 11:21:40 -04:00
Jason
8178665bd1
fix(cli/repl): await Promise.any([])... (#15623) 2022-09-02 13:38:06 +02:00
Nayeem Rahman
a74b2ecf37
fix(repl): don't terminate on unhandled error events (#15548) 2022-09-02 12:43:39 +02:00
Geert-Jan Zwiers
58e76098e6
fix(serde_v8): no panic on reading large text file (#15494)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2022-09-01 22:20:11 +02:00
David Sherret
e1d7d7b0e3
fix(npm): better node version and version requirement compatibility (#15714) 2022-09-01 11:50:12 -04:00
Divy Srivastava
20c835407c
fix(ext/flash): retry write failures (#15591) 2022-09-01 18:58:34 +05:30
Bartek Iwańczuk
adec4f575e
fix(npm): translate CJS to ESM with name clashes for files and dirs (#15697) 2022-08-31 00:31:59 +02:00
David Sherret
5f251b283b
fix(npm): prefer importing esm from esm (#15676) 2022-08-30 14:09:22 -04:00
Bartek Iwańczuk
54be07d05e
fix(npm): skip extracting pax_global_header from tarballs (#15677) 2022-08-30 17:15:41 +02:00
Danny Povolotski
5e0fa5dd88
fix(ext/websocket): fix closing of WebSocketStream with unread messages (#15632) 2022-08-30 03:43:17 +02:00
David Sherret
c3e48cba18
fix(compile): panic when running with a populated dep analysis cache (#15672)
Closes #15612
2022-08-29 14:24:10 -04:00
Bartek Iwańczuk
2851a98072
fix(npm): conditional exports with wildcards (#15652) 2022-08-29 19:15:20 +02:00
Bartek Iwańczuk
ad98c9fdd1
chore: update test_util/std/ submodule (#15657) 2022-08-29 11:35:27 +02:00
David Sherret
ec98d86d21
fix(npm): handle cjs re-exports with the same name as an export (#15626) 2022-08-26 14:34:35 -04:00
Yoshiya Hinosawa
9b324b1cf4
fix(ext/node): fix global in node env (#15622) 2022-08-26 23:39:05 +09:00
David Sherret
f583a7ebf4
chore(npm): add test for esm npm binary package (#15609) 2022-08-26 09:17:48 -04:00
Bartek Iwańczuk
da10c9c8d1
fix(ext/flash): panic on AddrInUse (#15607) 2022-08-26 08:42:11 +05:30
David Sherret
376665d115
fix: avoid global declaration collisions in cjs (#15608)
* Use a default stack size * 2 in debug for Windows because swc using so much stack size. We should look into this more later though.
2022-08-25 20:24:18 -04:00
Bartek Iwańczuk
fb1c7b7dea
fix(unstable): finish HTTP response for 205 and 304 responses (#15584)
This commit fixes "Deno.serve()" API by making sure that
205 and 304 responses end with "\r\n\r\n".
2022-08-24 21:26:57 +02:00
David Sherret
348291f5ec
fix(npm): always require --unstable flag even for esm (#15583) 2022-08-24 13:44:38 -04:00
Luca Casonato
33c4d45328
fix: resolve jsxImportSource relative to module (#15561)
Previously `jsxImportSource` was resolved relative to the config file
during graph building, and relative to the emitted module during
runtime.

This is now fixed so that the JSX import source is resolved relative to
the module both during graph building and at runtime.
2022-08-24 19:36:05 +02:00
David Sherret
684aabbc25
feat: support subpaths in npm package references (#15578) 2022-08-24 11:25:32 -04:00
Bartek Iwańczuk
a4cc09447e
fix(unstable): Deno.serve() can parse hostnames (#15579) 2022-08-24 16:38:51 +02:00
Bartek Iwańczuk
5268fa0e0f
fix(unstable): various resolution bugs for npm: specifiers (#15546)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-08-24 14:54:20 +02:00
Luca Casonato
f3bde1d53b
feat(ext/flash): split upgradeHttp into two APIs (#15557)
This commit splits `Deno.upgradeHttp` into two different APIs, because
the same API is currently overloaded with two different functions. Flash
requests upgrade immediately, with no need to return a `Response`
object. Instead you have to manually write the response to the socket.
Hyper requests only upgrade once a `Response` object has been sent.

These two behaviours are now split into `Deno.upgradeHttp` and
`Deno.upgradeHttpRaw`. The latter is flash only. The former only
supports hyper requests at the moment, but can be updated to support
flash in the future.

Additionally this removes `void | Promise<void>` as valid return types
for the handler function. If one wants to use `Deno.upgradeHttpRaw`,
they will have to type cast the handler signature - the signature is
meant for the 99.99%, and should not be complicated for the 0.01% that
use `Deno.upgradeHttpRaw()`.
2022-08-24 17:40:57 +05:30
David Sherret
452df99222
feat(npm): support packages with multiple command names (#15565) 2022-08-23 22:01:21 -04:00
Luca Casonato
4ef08a58df
feat: update Deno.serve function signature (#15563)
This commit changes the `Deno.serve` function signature to be more
versatile and easier to use. It is now a drop in replacement for
std/http's `serve`.

The input validation has also been reworked.
2022-08-24 00:08:56 +02:00
David Sherret
e7367044d9
feat: binary npm commands (#15542) 2022-08-23 10:39:19 -04:00
David Sherret
362af63c6f
fix(cache): do not attempt to emit non-emitable files (#15562) 2022-08-23 10:30:14 -04:00
Luca Casonato
24f7f3fda9
fix(ext/fetch): ignore user content-length header (#15555)
Previously if a user specified a content-length header for an POST
request without a body, the request would contain two `content-length`
headers. One added by us, and one added by the user.

This commit ignores all content-length headers coming from the user,
because we need to have the sole authority on the content-length because
we transmit the body.
2022-08-23 12:43:04 +02:00
Bartek Iwańczuk
c66386dbd2
feat(unstable): Respect --cached-only flags for npm: specifiers (#15512)
This commit changes "npm:" specifier handling to respect "--cached-only" flags and adds "Download" messages for npm registry api calls.

Co-authored-by: David Sherret <dsherret@gmail.com>
2022-08-22 17:35:04 +02:00
Yoshiya Hinosawa
57d48134d1
fix(ext/flash): fix default onListen callback (#15533) 2022-08-22 17:01:43 +09:00
Bartek Iwańczuk
301f6c46ba
fix(unstable): better error for invalid hostname in Deno.serve() (#15529) 2022-08-21 21:15:52 +02:00
Nayeem Rahman
97954003cc
feat: queueMicrotask() error handling (#15522)
Adds error event dispatching for queueMicrotask(). Consequently unhandled errors are now reported with Deno.core.terminate(), which is immune to the existing quirk with plainly thrown errors (#14158).
2022-08-21 20:16:42 +02:00
Yoshiya Hinosawa
fb2aeb79a1
fix(ext/flash): fix listening port (#15519) 2022-08-21 21:27:14 +09:00
Nayeem Rahman
e39d4e3e7f
fix(core/runtime): always cancel termination in exception handling (#15514) 2022-08-21 13:57:10 +02:00
David Sherret
87f80ff6be
feat(unstable): initial support for npm specifiers (#15484)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 11:31:33 -04:00
Leo Kettmeir
1ffbd56164
feat: add "deno init" subcommand (#15469)
This adds an init subcommand to that creates a project starter similar to cargo init.

```
$ deno init my_project
Project initialized
Run these commands to get started:
  cd my_project
  deno run main.ts
  deno run main_test.ts
$ deno run main.ts
Add 2 + 3 5
$ cat main.ts
export function add(a: number, b: number): number {
  return a + b;
}
if (import.meta.main) {
  console.log("Add 2 + 3", add(2, 3));
}
$ cat main_test.ts
import { assertEquals } from "https://deno.land/std@0.151.0/testing/asserts.ts";
import { add } from "./main.ts";
Deno.test(function addTest() {
    assertEquals(add(2, 3), 5);
});
```

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 01:37:05 +02:00
Bartek Iwańczuk
5beec3f106
feat(unstable): change Deno.serve() API (#15498)
- Merge "Deno.serve()" and "Deno.serveTls()" API
- Remove first argument and use "fetch" field options instead
- Update type declarations
- Add more documentation
2022-08-19 14:36:01 +02:00
Divy Srivastava
8bdcec1c84
fix(ext/flash): concurrent response streams (#15493) 2022-08-19 10:14:56 +05:30
Divy Srivastava
cd21cff299
feat(ext/flash): An optimized http/1.1 server (#15405)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
Co-authored-by: crowlkats <crowlkats@toaxl.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2022-08-18 17:35:02 +05:30
Kitson Kelly
a2ab5eee01
docs: add category tag for built-in APIs (#15480) 2022-08-17 13:12:24 +10:00
Bartek Iwańczuk
5a4f84a0e1
chore: upgrade rusty_v8 to 0.48.1 (#15310) 2022-08-15 14:12:11 +02:00
David Sherret
8eed24cd3d
fix(coverage): ensure coverage is only collected in certain situations (#15467) 2022-08-12 15:21:17 -04: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
Nayeem Rahman
578f12d531
fix(cli): allow configurations files to also be json modules (#15444)
Closes #15440
2022-08-11 07:33:42 +10:00
Kayla Washburn
08061b60d9
fix: allow setting globalThis.location when no --location is provided (#15448) 2022-08-10 12:57:30 -06:00
David Sherret
d6f789eb05
chore: temporarily disable op_require_read_file (#15433) 2022-08-09 17:28:13 -04:00
Kitson Kelly
1c2ec1f48f
fix: update deno_graph to fix importing config as JSON module (#15388)
Ref: denoland/deno_graph#166
2022-08-10 07:27:22 +10:00
Bartek Iwańczuk
1f54d87789
feat: add ext/node for require support (#15362)
This commit adds "ext/node" extension that implementes CommonJS module system.

In the future this extension might be extended to actually contain implementation of
Node compatibility layer in favor of "deno_std/node".

Currently this functionality is not publicly exposed, it is available via "Deno[Deno.internal].require"
namespace and is meant to be used by other functionality to be landed soon.

This is a minimal first pass, things that still don't work:

support for dynamic imports in CJS
conditional exports
2022-08-09 21:06:01 +02:00
Nayeem Rahman
34328690dc
fix(test): output parallel test results independently (#15399) 2022-08-04 12:38:40 -04:00
Nayeem Rahman
2e2c623882
fix(test): race condition for cancelled tests (#15233) 2022-08-02 10:55:11 -04:00
Kitson Kelly
09d14b1b57
fix(lsp): use correct commit chars for completions (#15366)
Fixes: #15252
2022-08-02 08:54:17 +10:00
Bartek Iwańczuk
20a89d46c4
fix(core): BorrowMutError in nested error (#15352) 2022-07-30 16:09:42 +02:00
diachedelic
2843160fc7
feat(ext/crypto): deriveBits P-384 (#15138)
This commit adds P-384 curve support for crypto.subtle.deriveBits.

Co-authored-by: James Diacono <james@diacono.com.au>
2022-07-23 22:34:37 +05:30
Bartek Iwańczuk
504d2936ec
fix: unhandledrejection handling for sync throw in top level (#15279)
Fixes an edge in "unhandledrejection" event that prevent synchronous
errors being surfaced when throw from a top-level scope.
2022-07-23 00:40:42 +02:00
Bartek Iwańczuk
72199303d8
fix: Child.unref() unrefs stdio streams properly (#15275) 2022-07-22 18:07:20 +02:00
Bartek Iwańczuk
4e71a9424e
fix: proper typings for unhandledrejection event (#15271) 2022-07-21 23:54:53 +02:00
Satya Rohith
6c3d9b981f
fix(cli): unset jsxFragmentFactory & jsxFactory options (#15264) 2022-07-21 14:44:18 +05:30
David Sherret
26cea0e2ca
feat(test): add --parallel flag, soft deprecate --jobs (#15259)
Co-authored-by: mrkldshv <markladyshev@gmail.com>
2022-07-20 17:36:54 -04:00
Bartek Iwańczuk
d53936eb7d
Reland "feat: add "unhandledrejection" event support" (#15211) 2022-07-20 20:28:19 +02:00
Nayeem Rahman
6e350b2b7c
chore(cli): Ignore "experimentalDecorators" and "moduleDetection" options (#15202) 2022-07-20 16:59:56 +02:00
Bartek Iwańczuk
d17b3906bf
chore: use import.meta.resolve() in tests (#15256) 2022-07-20 16:56:53 +02:00
David Sherret
73504d76b2
fix(task): resolve deno configuration file first from specified --cwd arg (#15257) 2022-07-20 10:36:14 -04:00
ayame113
27a72a12b7
chore: align some Web API type definitions to lib.dom.d.ts (#15219) 2022-07-20 18:30:41 +08:00
Phosra
b8e1250500
fix(ext/web): align DOMException better with spec (#15097) 2022-07-20 10:12:18 +02:00
Dante Issaias
2b1f145c3e
chore(ext): update webgpu (#15059) 2022-07-20 02:22:26 +02:00
David Sherret
0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00