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

252 commits

Author SHA1 Message Date
Nayeem Rahman
b22f48970f
refactor(std/http/server): Remove bad error handling (#4435) 2020-03-20 12:12:27 -04:00
dubiousjim
1c6f177d19
use prebuilt "not implemented" error (#4442) 2020-03-20 12:10:02 -04:00
Samrith Shankar
798904b0f2
Add require-await lint rule (#4401) 2020-03-20 09:38:34 -04:00
Nayeem Rahman
35f6e2e45d
fix(std/http): Properly await ops in a server test (#4436) 2020-03-20 09:46:48 +01:00
Nayeem Rahman
b7e6a31a42
fix(std/http): Fix respond error test on Windows (#4408) 2020-03-19 19:15:21 -04:00
Bartek Iwańczuk
3ef34673c9
std(http/server): close open connections on server close (#3679)
Due to structure of "Server" for each open connection there's a pending "read" op. Because connection owned by "Server" are not tracked, calling "Server.close()" doesn't close open connections.

This commit introduces simple tracking of connections for server and ensures owned connections are closed on "Server.close()".
2020-03-19 16:04:26 +01:00
Nikolai Vavilov
8c1c929034
fix: stack traces for modules imported via std/node's require (#4035) 2020-03-19 10:42:07 -04:00
Bartek Iwańczuk
74c37e759a
remove std/testing/runner.ts, use deno test for std/ tests (#4397)
This introduces BREAKING CHANGE by removing "std/testing/runner.ts".

Std tests are now run using "deno test" subcommand.
2020-03-19 14:49:06 +01:00
Bartek Iwańczuk
8de4a05f2a
fix: std/testing/runner.ts and deno test (#4392)
After splitting "failFast" and "exitOnFail" arguments, there was a situation where failing tests did not exit with code 1.

* fixed argument value passed to Deno.runTests() in deno test
* fixed argument value passed to Deno.runTests() in std/testing/runner.ts
* added integration tests for deno test to ensure failFast and exitOnFail work as expected
* don't write test file to file system, but keep it in memory
2020-03-19 14:26:47 +01:00
Kitson Kelly
5b10ab0984
feat: Add helper functions for permissions to std (#4258) 2020-03-19 11:32:49 +01:00
Bartek Iwańczuk
b0b27c4310
refactor: rename Deno.TestDefinition.skip to ignore (#4400) 2020-03-19 10:58:12 +01:00
Bartek Iwańczuk
6e2df8c64f
feat: Deno.test() sanitizes ops and resources (#4399)
This PR brings assertOps and assertResources sanitizers to Deno.test() API.

assertOps checks that test doesn't leak async ops, ie. there are no unresolved
promises originating from Deno APIs. Enabled by default, can be disabled using 
Deno.TestDefinition.disableOpSanitizer.

assertResources checks that test doesn't leak resources, ie. all resources used
in test are closed. For example; if a file is opened during a test case it must be
explicitly closed before test case finishes. It's most useful for asynchronous
generators. Enabled by default, can be disabled using 
Deno.TestDefinition.disableResourceSanitizer.

We've used those sanitizers in internal runtime tests and it proved very useful in
surfacing incorrect tests which resulted in interference between the tests.

All tests have been sanitized.

Closes #4208
2020-03-18 19:25:55 -04:00
Ryan Dahl
6bd940abfd
Update manual (#4412) 2020-03-17 17:56:33 -07:00
Kitson Kelly
9050d36d57
std: Provide types for React and ReactDOM (#4376)
Introduces `std/types` which is designed to provide types for common
libraries that are compatible with Deno.
2020-03-17 13:28:07 +01:00
Chris Knight
62942749e6
test: Fix broken test and remove redundant test file (#4390) 2020-03-16 12:40:36 +01:00
Bartek Iwańczuk
1edb20b399
refactor: add no-return-await lint rule (#4384) 2020-03-16 10:22:16 +01:00
Chris Knight
620dd9724d
refactor: move existing fs implementation to internal _fs directory (#4381) 2020-03-15 11:48:46 -04:00
Yoshiya Hinosawa
ec3f44581b
docs: fix Deno.compile examples in manual.md (#4380) 2020-03-15 15:30:11 +01:00
Nayeem Rahman
6471d4cfab
refactor(std): Uncomment disabled tests, use skip option (#4378) 2020-03-15 13:03:25 +01:00
Chris Knight
a159165fe5
Node polyfill for fs.chown and fs.close (#4377) 2020-03-14 23:01:34 -04:00
dubiousjim
6cc40b0865
BREAKING CHANGE FileInfo.len renamed to FileName.size (#4338) 2020-03-14 22:57:42 -04:00
Chris Knight
ea4f3ab852
feat: add chmod Node polyfill and related file system constants (#4358) 2020-03-14 17:46:39 -04:00
crowlKats
9648d3da14
Add node querystring polyfill (#4370) 2020-03-14 16:43:49 -04:00
Lucas De Angelis
cd293f7907
doc(http/server): Add coherence to the docs (#4372)
Functions that returns a server are now documented with "Create",
and functions that launches one are documented with "Start".

Also added documentation for listenAndServe that respects these
changes.

Fixes #4367
2020-03-14 10:17:44 -04:00
Oliver Lenehan
0f6acf2753
fix(std): Use Deno.errors where possible. (#4356) 2020-03-13 21:40:13 -04:00
Chris Knight
cabe63eb05
fix: Node polyfill fsAppend rework (#4322)
* My original implementation of `fs.appendFile` used an async API, which, though 
  it would work fine as a polyfill, wasn't an exact match with the Node API.  This PR
  reworks that API to mimic the Node API fully as a synchronous void function with
  an async internal implementation.
* Refactor move of other internal fs `dirent` and `dir` classes to the _fs internal
  directory.
2020-03-12 10:12:27 -04:00
Nayeem Rahman
ce14ef09d0
doc(cli/flags): Reduce empty lines in help messages (#4312) 2020-03-10 19:23:08 -04:00
Oliver Lenehan
a309dcdd0f
feat (std/encoding): add binary module (#4274) 2020-03-10 15:16:08 -04:00
Nayeem Rahman
55119aaee2
refactor(cli/js/net): Cleanup iterable APIs (#4236)
Listener and UDPConn are AsyncIterables instead of AsyncIterators.
The [Symbol.asyncIterator]()s are defined as generators and the
next() methods are gone.

"Listener/Socket has been closed" errors are now BadResource.
2020-03-10 15:14:22 -04:00
Nayeem Rahman
6443e4aed1
refactor: Cleanup options object parameters (#4296) 2020-03-10 12:08:58 -04:00
Chris Knight
2115b38fef
test: add actual error class to fail message (#4305) 2020-03-09 17:46:55 -04:00
Chris Knight
1b6fc87b71
feat(std/node) add appendFile and appendFileSync (#4294) 2020-03-08 19:14:53 -04:00
Bartek Iwańczuk
1b6f831875
reorg: move JS ops implementations to cli/js/ops/, part 1 (#4264)
Following JS ops were moved to separate files in cli/js/ops directory:
- compiler
- dispatch_json
- dispatch_minimal
- errors
- fetch
- fs_events
- os
- random
- repl
- resources
- runtime_compiler
- runtime
- tty
2020-03-08 13:09:22 +01:00
Kitson Kelly
b9037c86ed
Improvements to std/flags. (#4279)
Adds JSDoc to module, improves the typing of the return type, uses
iteration instead of Array forEach, uses the dotall support in Regular
Expression which is now supported in JavaScript, uses destructuring and
nullish coalescing where appropriate.
2020-03-08 11:27:23 +01:00
Harry Wolff
8d1ba3552f
Update manual to reflect newer test running (#4278)
This updates this example code to follow the new test running conventions.

The code as is, when ran produces the following output:

```
➜  dencro git:(master) ✗ deno test        
Compile file:///Users/hswolff/Sites/dencro/test.ts
running 2 tests
OK     oneTest (2.00ms)
OK     t2 (0.00ms)

test result: OK 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (2.00ms)

running 2 tests
OK     oneTest (0.00ms)
OK     t2 (0.00ms)

test result: OK 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (0.00ms)

➜  dencro git:(master) ✗ 
```

Removing `await Deno.runTests();` just causes the tests to run once.
2020-03-07 22:28:30 -05:00
Chris Knight
bb3d9c8280
doc: Update manual with suggestions for when cargo isn't building properly (#4252) 2020-03-06 09:14:58 -05:00
dubiousjim
9a63902db5
Rename readDir -> readdir (#4225) 2020-03-06 08:34:02 -05:00
Ryan Dahl
444b1ab68e
Document TypeScript compiler options (#4241) 2020-03-05 08:26:36 -05:00
Ryan Dahl
159de0245d
Use discord instead of gitter (#4253) 2020-03-04 19:49:51 -05:00
Chris Knight
3968308886
feat(std/node): add directory classes (#4087) 2020-03-03 08:56:10 -05:00
ecyrbe
2a594bd3b2
feat(std/node): add os.tmpdir() implementation (#4213) 2020-03-01 19:05:04 -05:00
Yusuke Sakurai
9075daa2e3
[std/ws] provide default close code for ws.close() (#4172) 2020-02-28 11:17:00 -05:00
Yusuke Sakurai
c65d0c63e7
reduce unnecessary output on tests (#4148) 2020-02-27 15:12:04 -05:00
Yusuke Sakurai
942e67c00b
refactor(std/http): move io functions to http/io.ts (#4126) 2020-02-26 10:48:35 -05:00
Kitson Kelly
be787d09d5
upgrade: TypeScript 3.8 (#4100) 2020-02-25 15:33:19 -05:00
Yusuke Sakurai
22f88b9f37
fix: [http] Consume unread body and trailers before reading next request (#3990)
- Added `ServerRequest.finalize()`:  consuming all unread body stream and trailers.
  - This is cleanup method for reading next request from same keep-alive connection.
  - Needed when handler didn't consume all body and trailers even after responding.
- refactor: `ServerRequest._bodyStream()`, `ServerRequestBody` are removed.
  - Now using `bodyReader()` and `chunkedBodyReader()` instead.
- fix: Trailers should only be read `transfer-encoding` is `chunked` and `trailer` header is set and its value is valid.
- fix: use `Headers.append()` on reading trailers.
- fix: delete `trailer` field from headers after reading trailers.
- reorg: Several functions related to IO are moved into `http/io.ts`
2020-02-24 22:49:39 -05:00
João Souto
5c1ab080cd
Remove ansi_term dependency (#4116) 2020-02-24 19:30:17 -05:00
Ryan Dahl
4005174f6c
Revert "Remove ansi_term dependency"
Broke colors
https://github.com/denoland/deno/issues/4112#issuecomment-590545385

This reverts commit c250778704.
2020-02-24 17:18:15 -05:00
Suguru Motegi
79c6e052ed
fix: createSecKey logic (#4063) 2020-02-24 16:37:15 -05:00
Bartek Iwańczuk
e1687c0a46
rename Deno.Err -> Deno.errors (#4093) 2020-02-24 15:48:35 -05:00
Nayeem Rahman
db59705595
doc: Remove old link to deno types output (#4111) 2020-02-24 15:02:22 -05:00
Bartek Iwańczuk
5da7c7df1d
disable std/examples/chat tests for windows (#4109) 2020-02-24 12:58:13 -05:00
Matthew Lennon
c74684ed90
update build instructions for windows (#4027) 2020-02-24 12:31:21 -05:00
João Souto
c250778704
Remove ansi_term dependency (#4106) 2020-02-24 10:29:56 -05:00
ecyrbe
fb08cf7005
Add missing node os.release() implementation (#4065) 2020-02-24 08:35:45 -05:00
uki00a
fe9ac35a65
fix(std/examples): add tests for examples (#4094) 2020-02-24 08:31:40 -05:00
Yusuke Sakurai
162d66d23f
fix: chat example's content-security-policy (#4091) 2020-02-24 08:10:00 -05:00
Ben Noordhuis
45eb2f9b37
feat(std/node): add os Symbol.toPrimitive methods (#4073)
Node's os module exports a number of methods that evaluate to themselves
when coerced to a primitive.

I.e., `"" + os.arch` and `os.arch()` evaluate to the same string, and
now Deno's shims do too.
2020-02-23 14:40:44 -05:00
Yusuke Sakurai
d9886a44d1
fix: [ws] sock shouldn't throw eof error when failed to read frame (#4083) 2020-02-23 11:59:36 -05:00
Yusuke Sakurai
8b646e8657
Added browser chat example (#4022) 2020-02-22 18:51:04 -05:00
ecyrbe
fb98556d56
feat(std/node): add os.loadavg() (#4075) 2020-02-22 18:46:52 -05:00
jigsaw
c34d96d865
Fix example (#4076) 2020-02-22 18:45:35 -05:00
Bartek Iwańczuk
bd640bc7e6
feat: Deno.fsEvents() (#3452) 2020-02-21 13:21:51 -05:00
ecyrbe
754b8c65ad
feat(std/node) : add os.platform (#4064) 2020-02-21 12:01:01 -05:00
Bartek Iwańczuk
dd8a109481
refactor: remove unneeded ErrorKinds (#3936) 2020-02-21 10:36:13 -05:00
Clemens Tolboom
7e49d96cbc
/std/ws: Fix args index for WS examples (#4046) 2020-02-20 10:19:14 -05:00
Maximilien Mellen
90125566bb
Enable TS strict mode by default (#3899)
Fixes #3324 

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-02-19 15:36:18 -05:00
Kitson Kelly
046bbb2691
Support loading additional TS lib files (#3863)
Fixes #3726

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
2020-02-19 00:34:11 -05:00
Nayeem Rahman
5a3292047c
feat(std/io): Export readDelim(), readStringDelim() and readLines() from bufio.ts (#4019)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-02-17 19:51:13 -05:00
Chris Knight
7b9f6e9c45
feat: Asynchronous event iteration node polyfill (#4016) 2020-02-17 13:22:41 -05:00
Nikolai Vavilov
1908066753
Update ws client example (#4012) 2020-02-17 12:49:30 -05:00
Yusuke Sakurai
621aeef836
fix: appended CRLF to end of trailer headers (#3989) 2020-02-13 16:05:30 -05:00
Chris Knight
a7056095a5
feat(node): add EventEmitter.errorMonitor (#3960) 2020-02-11 15:55:54 -05:00
木杉
92019498f6
fix(file_server): don't crash on "%" pathname (#3953) 2020-02-11 15:53:09 -05:00
Bartek Iwańczuk
b67f20be3b
update references to testing/mod.ts in manual (#3973) 2020-02-11 21:50:20 +01:00
Bartek Iwańczuk
61273085e4
refactor: rewrite tests in std/ to use Deno.test (#3930) 2020-02-11 17:24:27 +01:00
uki00a
5a143cdbd3
fix(std/node): support named import for EventEmitter (#3959) 2020-02-11 11:19:35 -05:00
Chris Knight
81905a867e
feat: Event emitter node polyfill (#3944) 2020-02-10 18:19:48 -05:00
Yusuke Sakurai
e6f204199b
feat: Support HTTP trailer headers for response (#3938) 2020-02-10 11:38:48 -05:00
Benny Shi
e8f639ce53 Add readlink, readlinkSync for std/node/fs.ts (#3926) 2020-02-10 03:38:05 -06:00
Nikolai Vavilov
61c5bb86db
Bump required VS version (#3940)
deno builds successfully with VS2019, so no need to require VS2017.
2020-02-09 10:07:37 -06:00
Bartek Iwańczuk
1c0ffa1383
reenable server tests (#3928) 2020-02-08 14:24:09 -06:00
Yusuke Sakurai
a4bb8bab44 remove non-null assertion operator from std (part2) (#3927) 2020-02-08 14:15:59 -06:00
Yusuke Sakurai
c2986891f6
remove non-null assertion operator from std (part1) (#3900) 2020-02-07 02:23:38 -05:00
Yoshiya Hinosawa
5a8ba3b114
feat: add std/signal/mod.ts (#3913) 2020-02-07 01:53:15 -05:00
Nayeem Rahman
971391dbaf
fix(std/path/globrex.ts): Use non-capturing groups in globrex() (#3898) 2020-02-06 17:25:39 -05:00
Yusuke Sakurai
699d10bd9e
fix: make WebSocket.send() exclusive (#3885) 2020-02-06 08:42:32 -05:00
Kitson Kelly
145188bcf7
std/http/server::serve aligned to std/http/server::serveTLS (#3881) 2020-02-04 15:15:23 +01:00
Rafael Vargas
55063dd8e8
fix: Deno.remove() to properly remove dangling symlinks (#3860)
For some reason, the unit tests for Deno.remove() were not being imported to 
unit_tests.ts and, consequently, not being executed. Thus, I imported them, 
refactored some existent ones and wrote new ones for the symlink removal case.

Since the creation of a symlink is not implemented for Windows yet, assertions
that consider this state were added when the tests are executed in this OS.
2020-02-03 08:20:15 -05:00
Kevin (Kun) "Kassimo" Qian
e8df66c12c
std/encoding: add base32 support (#3855) 2020-02-02 16:49:41 -05:00
Chris Knight
77f4df40f3
Fixed month reference in documented output of parseDate and parseDateTime function calls (#3859) 2020-02-02 16:46:05 -05:00
Bartek Iwańczuk
e1697421e2
chore: remove std/installer, port installer tests to Rust (#3843) 2020-01-31 17:34:50 +01:00
Kevin (Kun) "Kassimo" Qian
97b2a0bb95
bring back std/examples/xeval.ts (#3822) 2020-01-30 21:02:14 -05:00
Chris Knight
3de9540ac6
feat(std/node) Endianness (#3833) 2020-01-30 18:57:29 -05:00
Bartek Iwańczuk
de5c099b47
feat: deno install in Rust (#3806)
//std/installer couldn't be removed due to bug, but it's now deprecated.
2020-01-30 18:42:39 -05:00
Ryan Dahl
2338e7679c
Remove --current-thread flag (#3830)
This flag was added to evaluate performance relative to tokio's threaded
runtime. Although it's faster in the HTTP benchmark, it's clear the runtime
is not the only perf problem.

Removing this flag will simplify further refactors, in particular
adopting the #[tokio::main] macro. This will be done in a follow up.

Ultimately we expect to move to the current thread runtime with Isolates
pinned to specific threads, but that will be a much larger refactor. The
--current-thread just complicates that effort.
2020-01-30 10:49:33 -05:00
Bartek Iwańczuk
73a3cc21d0
feat: dprint formatter (#3820)
* rewrite fmt_test in Rust, remove tools/fmt_test.py
* remove //std/prettier
2020-01-29 21:16:48 -05:00
cknight
f0a6062012
Partial implementation of node os polyfill based on currently available Deno functionality (#3821) 2020-01-29 20:57:29 -05:00
Bartek Iwańczuk
f32c31a0eb dx: descriptive permission errors (#3808)
Before:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```

After:
```
▶ target/debug/deno https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendSync ($deno$/dispatch_json.ts:67:10)
    at listen ($deno$/net.ts:170:15)
    at https://deno.land/std/examples/echo_server.ts:4:23
```

```
▶ target/debug/deno --allow-read=/usr https://deno.land/std/examples/cat.ts /etc/passwd
error: Uncaught PermissionDenied: read access to "/etc/passwd", run again with the --allow-read flag
► $deno$/dispatch_json.ts:40:11
    at DenoError ($deno$/errors.ts:20:5)
    at unwrapResponse ($deno$/dispatch_json.ts:40:11)
    at sendAsync ($deno$/dispatch_json.ts:91:10)
```
2020-01-27 21:13:17 -05:00
Kitson Kelly
f604becaba Improve support of type definitions (#3755) 2020-01-26 13:59:41 -05:00