0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
Commit graph

7852 commits

Author SHA1 Message Date
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
f0993f413b
fix: parse scoped npm specifiers with no version (#15564) 2022-08-23 13:08:37 -04: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
Bartek Iwańczuk
86ef743c0f
chore: upgrade rusty_v8 to v0.49.0 (#15547) 2022-08-23 14:51:04 +02: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
Geert-Jan Zwiers
ecf3b51fd9
refactor(core/runtime): clean up extra type cast (#15539) 2022-08-23 09:24:17 +05:30
Divy Srivastava
e34260c5b0
BREAKING(ext/ffi): specialized buffer type (#15518) 2022-08-23 09:16:43 +05:30
Kitson Kelly
d0c5477731
docs: add permission tags to JSDocs (#15541)
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2022-08-23 10:57:01 +10:00
Ikko Ashimine
cf80b0a202
chore: typo (#15536) 2022-08-22 12:42:03 -04:00
David Sherret
7a1a082876
perf: cache swc dependency analysis and don't hold onto ParsedSources in memory (#15502) 2022-08-22 12:14:59 -04: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
Giovanny Gutiérrez
5ea51702bd
fix: Free up JsRuntime state global handles before snapshot (#15491) 2022-08-21 21:03:56 +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
Mathias Lafeldt
e96933bc16
chore: use Rust 1.63.0 (#15464) 2022-08-21 19:31:14 +02:00
Yoshiya Hinosawa
fb2aeb79a1
fix(ext/flash): fix listening port (#15519) 2022-08-21 21:27:14 +09:00
Divy Srivastava
906aa78af3
feat(ops): V8 Fast Calls (#15291) 2022-08-21 17:37:53 +05:30
Nayeem Rahman
e39d4e3e7f
fix(core/runtime): always cancel termination in exception handling (#15514) 2022-08-21 13:57:10 +02:00
akmhmgc
3caec9721e
docs: Fix typo (#15507) 2022-08-21 01:37:24 +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
Mathias Lafeldt
1848c7e361
Fix: Honor linter rules in CI and locally (#15492)
RUSTFLAGS take precedence over `target.<triple>.rustflags`. Therefore,
setting the env var globally in CI would always override whatever linter
rules are allowed or denied in .cargo/config.toml.

With this change, we ensure that problems are detected both in CI and
locally, using either cargo clippy or lint.js.
2022-08-19 08:17:18 -04:00
Divy Srivastava
25a109d9ea
chore(bench): add flash router benchmarks (#15495) 2022-08-19 15:54:54 +05:30
Divy Srivastava
9e576dff7c
perf(runtime): optimize Deno.file open & stream (#15496) 2022-08-19 15:54:40 +05:30
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
Leo Kettmeir
0b0843e4a5
refactor(fetch/request): use callback for url and method (#15483) 2022-08-17 16:29:26 +02:00
Kitson Kelly
a2ab5eee01
docs: add category tag for built-in APIs (#15480) 2022-08-17 13:12:24 +10:00
David Sherret
868c7e38bf
feat(runtime): add pre_execute_module_cb (#15485) 2022-08-16 21:00:35 -04:00
Ryan Dahl
0b70c81f97
perf: improve performance.now (#15481) 2022-08-16 21:00:16 +05:30
Geert-Jan Zwiers
eab66a9f4d
chore(bench,test): list .mts under supported file extensions in cli docs (#15477) 2022-08-15 21:16:23 +02:00
迷渡
6541d03ff5
docs: use irm instead of iwr -useb (#15474) 2022-08-15 10:05:29 -04:00
Bartek Iwańczuk
5a4f84a0e1
chore: upgrade rusty_v8 to 0.48.1 (#15310) 2022-08-15 14:12:11 +02:00
David Sherret
18dcc64910
fix(npm): handle storing non-all lowercase package names (#15470) 2022-08-14 09:09:16 -04:00
David Sherret
8eed24cd3d
fix(coverage): ensure coverage is only collected in certain situations (#15467) 2022-08-12 15:21:17 -04:00
Roj
ee2f4e745c
docs(cli/dts): fix typo (#15457) 2022-08-12 15:32:38 +09:00
David Sherret
39fb32df46
chore(ext/node): correct publishing for ext/node (#15461) 2022-08-11 17:25:41 -04:00
David Sherret
c3b04683c5
refactor(cli): consolidate most MainWorker related code to the same place (#15459) 2022-08-11 16:59:12 -04:00
denobot
e4a5f9952f
chore: forward v1.24.3 release commit to main (#15462)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-08-11 16:47:03 -04:00
Bartek Iwańczuk
10ce2e9e80
refactor(ext/node): remove several TODOs (#15452) 2022-08-11 16:44:01 +02: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
Mathias Lafeldt
883269f1f1
chore: move lint rules to cargo config for better editor integration (#15453) 2022-08-11 19:13:27 +05:30
Nayeem Rahman
25a1cc1b28
refactor(core): unwrap sync ops in rust (#15449) 2022-08-11 11:57:20 +02:00
David Sherret
321a42d1fb
refactor(runtime): split up MainWorker and WebWorker's preload_module method into two separate methods (#15451) 2022-08-10 18:10:51 -04: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