Commit graph

569 commits

Author SHA1 Message Date
uki00a 6d7e3621da
fix: compilation error introduced by #4543 (#5673) 2020-05-20 12:15:41 -04:00
Ali Hasani 22da75b8e5
feat(std/node): first pass at url module (#4700) 2020-05-20 10:37:30 -04:00
Garrone Joseph 7630326b4c
feat(std/node) Export TextDecoder and TextEncoder from util (#5663) 2020-05-20 10:35:51 -04:00
uki00a 9b4da88a96
fix(std/io): BufReader should not share the internal buffer across reads (#4543) 2020-05-20 16:34:20 +02:00
Ali Hasani ef14d62462
feat(std/bytes): add hasSuffix and contains functions, update docs (#4801) 2020-05-20 16:32:28 +02:00
Oliver Lenehan 662eb8f8c9
feat(std/fmt): rgb24 and bgRgb24 can use numbers for color (#5198) 2020-05-20 10:29:59 -04:00
Evan Hahn f5c0188b5e
std/node: add util.callbackify (#5415)
This adds [Node's `util.callbackify`][0] to `std/node/util.ts`.

I lifted most of this from the [original Node source code][1] (and [its
tests][2]). I tried to make minimal modifications to the source.

I made a few arbitrary decisions:

- I was unable to do the function's types elegantly. I made overloads
  for functions that have 0 to 5 (inclusive) arguments, excluding the
  callback. I would love to know a better way to do this. (It seems that
  the folks at DefinitelyTyped [were also stumped][3], though maybe
  their solution is deliberate.)
- There are a few edge cases that cause custom Node errors to be
  produced. Instead of re-implementing those errors completely, I
  created simplified classes. These are mostly correct but are not
  identical to the real Node errors.
- The tests implement a possibly-arcane `TestQueue` class. I originally
  used a lot of inline promises but found it too repetitive.

Closes [#5366][4].

[0]: https://nodejs.org/api/util.html#util_util_callbackify_original
[1]: 4780493301/lib/util.js (L183-L226)
[2]: 4780493301/test/parallel/test-util-callbackify.js
[3]: 7d24857ddb/types/node/util.d.ts (L61-L84)
[4]: https://github.com/denoland/deno/issues/5366
2020-05-20 10:29:05 -04:00
Marcos Casagrande 7566aa8765
fix(std/log): await default logger setup (#5341) 2020-05-20 16:27:01 +02:00
Anil Seervi f366e5e9bb
docs(std): fixed spelling mistake (#5662) 2020-05-20 13:20:20 +02:00
Marcos Casagrande eb5acb39d5
feat(std/node): Add fs.promises.readFile (#5656) 2020-05-20 02:50:48 -04:00
Marcos Casagrande 62c34bc21e
fix(std/node) improve fs.close compatibility (#5649) 2020-05-19 19:01:06 -04:00
zfx 7589d4d7c4
fix(multipart): fix error when parsing file name in utf8 format (#5428) 2020-05-19 14:22:26 -04:00
Speykious 9752b853dd
Provide better ANSI colorized output when inspecting objects (#5404) 2020-05-19 14:19:26 -04:00
Ali Hasani 6072755ead
Implement Deno.symlink() for windows (#5533) 2020-05-19 00:46:02 +02:00
Ryan Dahl 2a038eafcd
Revert "Fix definition of URL constructor (#5521)" (#5564)
This reverts commit 63bc468365.
2020-05-18 08:46:56 -04:00
pontakornth ce81064e4c
docs(std): Fix typo (#5582) 2020-05-18 12:10:19 +02:00
Andrey Trebler 2d5abbe909
fix(std/hash): SHA1 hash of Uint8Array (#5086) 2020-05-18 00:04:11 +02:00
Bert Belder 36fde75d77
Miscellaneous documentation and spelling improvements (#5527)
* Extended/updated documentation on code editor setup and plugins.
* Moved documentation to the right file.
* Fixed spelling errors in documentation and code.
* Updated broken links.

Co-authored-by: 迷渡 <justjavac@gmail.com>
Co-authored-by: AlfieriChou <alfierichou@gmail.com>
Co-authored-by: Anil Seervi <anil13112000@gmail.com
Co-authored-by: Bert Belder <bertbelder@gmail.com>
Co-authored-by: Fernando Basso <fernandobasso.br@gmail.com>
Co-authored-by: József Sallai <jozsef@sallai.me>
Co-authored-by: S4ltyGo4t <mario.weidner@gmx.de>
Co-authored-by: Tommy May <tommymay37@gmail.com>
Co-authored-by: Turbinya <wownucleos@gmail.com>
Co-authored-by: ᴜɴвʏтᴇ <i@shangyes.net>
2020-05-17 19:24:39 +02:00
Ali Hasani eddb916883
Implement Deno.kill for windows (#5347) 2020-05-17 19:11:24 +02:00
Masahiro Miyashiro (3846masa) 63bc468365
Fix definition of URL constructor (#5521) 2020-05-17 11:37:16 -04:00
A.E Clarence 4db4a7fbcc
Improve moveSync jsdoc 2020-05-17 11:36:01 -04:00
Marcos Casagrande 4d3bcd807d
docs(std): Fix default value in comment (#5539) 2020-05-17 12:31:19 +02:00
Akash Vishwakarma 6257684da6
Fix spelling: "--alow-write" => "--allow-write" (#5486) 2020-05-16 20:36:13 +02:00
Anil Seervi 59cb3c14c7
Fixed Typo (#5495) 2020-05-16 09:31:21 -04:00
domharrington b34628a26a
docs(std): Fix spelling mistake on permission (#5476) 2020-05-16 11:36:11 +02:00
Bert Belder 76a6a1ff46
Fix a bunch of spelling errors (#5314) 2020-05-16 00:36:49 +02:00
ddaza 15466c9007
improve chat example (#5474) 2020-05-15 17:00:31 -04:00
Henry Zhuang e98b759446
improve deferred test (#5459) 2020-05-15 16:59:44 -04:00
Peter Indiola 0e4a927bcf docs(std/fmt): Fix typo (#5315) 2020-05-15 22:33:45 +02:00
Linus Unnebäck 8228ea85fd
refactor(fs): use every instead of reduce (#5323)
The previous usage of `reduce` was basically implementing the `every`

A small difference is that the new implementation will stop checking 
as soon as one element have returned false, which will reduce 
the number of unnecessary checks.
2020-05-15 20:53:23 +02:00
Claudio Cicali f37967d229
fix link (#5333)
Replaced with the current master version
2020-05-15 10:13:33 -04:00
Tomasz Gałkowski 8440d765d5
fix: setTimeout and friends have too strict types (#5412) 2020-05-15 09:51:49 -04:00
Marcos Casagrande ce57a1824d
feat(std/node): fs.writeFileSync polyfill (#5414) 2020-05-15 09:50:27 -04:00
Stéphane Klein 62a7fcbdc4
fix(std/testing): Provide message and diff for assertStrictEq (#5417)
closes #5416
2020-05-15 09:49:11 -04:00
skdltmxn 06f3268f3a
feat: add std/hash/fnv (#5403) 2020-05-15 09:42:19 -04:00
Anil Seervi 3e07e0b01d
Fix typos (#5441) 2020-05-15 08:52:01 -04:00
Juan Julián Merelo Guervós f2e431c2b0
shorten example (#5448) 2020-05-15 08:51:15 -04:00
Evan Hahn 6f7e74d694
[std/node]: remove execute permissions from fs.ts (#5363) 2020-05-14 11:57:12 -04:00
Mike Nikles 0cbd432dc7
Add .css to the MEDIA_TYPES. (#5367) 2020-05-14 11:56:29 -04:00
Bert Belder 676be6632c
Fix flakiness in std file_server tests (#5306)
Fixes: #5275
2020-05-14 14:14:35 +02:00
Bartek Iwańczuk c474d38354
std/0.51.0 (#5336) 2020-05-14 13:45:05 +02:00
Marcos Casagrande 524b1547b7
std/node fs.readFile should take string as option (#5316) 2020-05-14 07:04:07 -04:00
Dante Calderón c3a205bae8
Fix typos across the repo (#5295)
Corrections made:
* cli/js/tests/README.md:44:7: corrected "discoveres" to "discovers"
* cli/js/tests/chown_test.ts:111:37: corrected "priviledge" to "privilege"
* cli/worker.rs:231:56: corrected "decendants" to "descendants"
* deno_typescript/lib.rs:136:50: corrected "emmited" to "emitted"
* core/es_isolate.rs:492:67: corrected "registerd" to "registered"
* core/isolate.rs:103:28: corrected "initalize" to "initialize"
* docs/runtime.md:29:14: corrected "ect" to "etc"
* docs/tools/debugger.md:122:16: corrected "implementes" to "implements"
* std/encoding/_yaml/dumper/dumper_state.ts:57:63: corrected "everwhere" to "everywhere"
* std/encoding/csv.ts:37:43: corrected "referal" to "referral"
* std/fmt/sprintf.ts:209:20: corrected "unusuable" to "unusable"
* std/fmt/README.md:21:40: corrected "Alternativly" to "Alternatively"
* std/fmt/README.md:35:68: corrected "seperated" to "separated"
* std/fmt/README.md:179:59: corrected "provded" to "provided"
* std/mime/multipart.ts:581:46: corrected "writen" to "written"
* std/path/_globrex.ts:19:52: corrected "equivelant" to "equivalent"
* std/node/events_test.ts:447:9: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:475:9: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:500:29: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:530:40: corrected "asyncronous" to "asynchronous"
* std/node/events_test.ts:555:9: corrected "asyncronous" to "asynchronous"
* tools/deno_tcp_proxy.ts:1:42: corrected "perfromance" to "performance"
* std/node/module.ts:1003:18: corrected "existend" to "existed"
2020-05-14 06:38:42 +02:00
Kitson Kelly 3d7552af2e
Update to TypeScript 3.9 (#4510) 2020-05-13 08:03:04 -04:00
Lucas Machado eec0855737
fix(std): fix broken style guide link (#5211) 2020-05-11 20:36:24 -04:00
Ryan Dahl 73d8fa74c6
BREAKING: There is no public Rust API for the CLI (#5226) 2020-05-11 17:33:36 -04:00
Edward Elric b2da8f3d4e
doc: fix typo in std/node/README.md (#4819) 2020-05-11 15:13:06 +02:00
Nayeem Rahman e74a83a715
fix(std/encoding/yaml): Correct exports (#5191) 2020-05-10 17:17:54 -04:00
Ryan Dahl d5dd5ae87d
std/0.50.0
Add std/version.ts and document unstableness of std.
2020-05-09 09:15:26 -04:00
Ryan Dahl 5de077ab65
Move style guide to docs dir (#5174) 2020-05-09 09:05:23 -04:00
Nayeem Rahman f184332c09
BREAKING(std): reorganization (#5087)
* Prepend underscores to private modules
* Remove collectUint8Arrays() It would be a misuse of Deno.iter()'s result.
* Move std/_util/async.ts to std/async
* Move std/util/sha*.ts to std/hash
2020-05-09 08:34:47 -04:00
Oliver Lenehan 7d3728e3f4
feat(std/fmt): 8bit and 24bit ANSI colors (#5168) 2020-05-09 06:29:44 -04:00
Andrey Trebler c42ad381ad
revert PR #5002 (#5141) 2020-05-08 10:32:09 -04:00
zjopy 761b7efb3b
fix(docs): add missing "deno run" (#5126) 2020-05-07 13:48:48 +02:00
Luca Casonato 34ec3b2254
Multi page manual (#5110) 2020-05-06 18:21:13 -04:00
Ryan Dahl 846c049c9b
Remove flaky and useless tests (#5116) 2020-05-06 17:04:52 -04:00
Tomofumi Chiba 6e287d9518
update manual with "deno run" (#5082) 2020-05-05 09:45:51 -04:00
Marcos Casagrande f0aea98c85
feat(std/node): fs.writefile / fs.promises.writeFile (#5054) 2020-05-04 18:59:37 -04:00
David Sherret 60f2d57fb7
feat(fmt): Add deno-fmt-ignore and deno-fmt-ignore-file comment support (#5075) 2020-05-04 15:17:15 -04:00
Nayeem Rahman 8c509bd885
feat(URL): Support drive letters for file URLs on Windows (#5074)
refactor: Parse URLs more sequentially. This makes it easier to change matching behaviour depending on the protocol.
fix: Fail when a host isn't given for certain protocols.
fix: Convert back-slashes info forward-slashes.
2020-05-04 14:32:54 -04:00
Ryan Dahl 6c02b061ce
stabilize Deno.cwd and require --allow-read (#5068) 2020-05-04 14:23:06 -04:00
Andrey Trebler 796fc9bc3e
BREAKING: make WebSocket directly implement AsyncIterable (#5044) (#5045) 2020-05-04 12:27:06 -04:00
Bartek Iwańczuk a913b7a1ba
BREAKING: remove CLI 'deno script.ts' hack (#5026)
This PR removes the hack in CLI that allows to run scripts with shorthand: deno script.ts.

Removing this functionality because it hacks around short-comings of clap our CLI parser. We agree that this shorthand syntax is desirable, but it needs to be rethinked and reimplemented. For 1.0 we should go with conservative approach that is correct.
2020-05-04 13:03:30 +02:00
Kitson Kelly bd3b9cc7d9
Add sha256 and sha224 support (along with HMAC variants) (#5066) 2020-05-04 06:10:57 -04:00
Ali Hasani 5cc0f056d1
[std/node] add the ability to path argument to be URL type (#5055) 2020-05-03 15:14:38 -04:00
Kitson Kelly 1560af2b6e
Move std/util/sha1.ts to ES private fields (#5053) 2020-05-03 14:45:40 +02:00
Ryan Dahl 03d0ee60b4
Add hint on how to install gist program (#5041) 2020-05-02 18:35:25 -04:00
Nayeem Rahman 96fd0f4692
BREAKING: feat(cli/installer): Support guessing the executable name (#5036) 2020-05-01 15:33:11 -04:00
Bert Belder fa396c0a22
fix std/fs/walk example (#5030) 2020-05-01 12:37:32 -04:00
木杉 e57f0749e7
fix(std/http): avoid directly modifying the headers object (#5024) 2020-05-01 10:35:18 -04:00
john gravois be65f6692f
docs(std): typo fix (#5023) 2020-05-01 12:33:03 +02:00
Marcos Casagrande 9ded17d722
BREAKING: reorder std/io/utils copyBytes arguments (#5022) 2020-04-30 16:39:25 -04:00
张超杰 21f4c7f35c
doc(std/fs): README.md (#4913) 2020-04-30 14:32:44 -04:00
Nikolai Vavilov 898773d3f8
std/node: toString for globals (#5013) 2020-04-30 13:58:40 -04:00
Luca Casonato 80e2211141
Unstable methods should not appear in runtime or d.ts (#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-04-30 11:23:40 -04:00
Nikolai Vavilov 84d687e958
std/node: make process global (#4985) 2020-04-30 10:00:02 -04:00
Tomofumi Chiba 5f8c4d9b68
fix(manual): Deno.copy args order (#4999) 2020-04-30 13:01:16 +02:00
Ali Hasani c569d958aa
fix(std): use fromFileUrl (#5005) 2020-04-30 12:47:53 +02:00
Andrey Trebler 8ec36681dd
feat: Make WebSocket Reader/Writer (#5001) (#5002) 2020-04-30 03:09:48 -04:00
Marcos Casagrande 12c6055855
Cleanup std/node/fs functions (#5000) 2020-04-29 21:36:44 -04:00
Ryan Dahl bc792c0267
make camel case readDir, readLink, realPath (#4995) 2020-04-29 16:39:37 -04:00
Marcos Casagrande 78e0ae643c
Fix MultipartReader for big files (#4865) 2020-04-29 16:38:24 -04:00
Bartek Iwańczuk d308e8d0c0
BREAKING: remove custom implementation of Deno.Buffer.toString() (#4992)
Keep in mind Buffer.toString() still exists, but returns [object Object]. 

Reason for removal of Buffer.toString() was that it implicitly used 
TextDecoder with fixed "utf-8" encoding and no way to customize 
the encoding.
2020-04-29 22:38:10 +02:00
Nayeem Rahman b51c863550
feat(std/path): Add fromFileUrl() (#4993)
Fix: URL constructor accepts a URL object which is not a base
2020-04-29 16:20:55 -04:00
Bert Belder 3e6ea62841
BREAKING: Include limited metadata in 'DirEntry' objects (#4941)
This change is to prevent needed a separate stat syscall for each file
when using readdir.

For consistency, this PR also modifies std's `WalkEntry` interface to
extend `DirEntry` with an additional `path` field.
2020-04-29 16:00:31 -04:00
Valentin Anger 721a4ad59d
BREAKING: Map-like interface for Deno.env (#4942) 2020-04-29 14:48:19 -04:00
张超杰 17cf2ecdac
adjust docs for std/log (#4984) 2020-04-29 09:38:44 -04:00
Marcos Casagrande ec41fb69cc
fix: Make std/io copyN write the whole read buffer (#4978) 2020-04-29 12:25:40 +02:00
David Sherret 6fd754fba0
Move the docs like @param [obj.prop] to the interface. (#4974) 2020-04-28 23:26:31 +02:00
Ryan Dahl ea28a088a4
Remove Conn.closeRead (#4970) 2020-04-28 15:17:55 -04:00
Nayeem Rahman 678313b176
BREAKING: Remove Deno.EOF, use null instead (#4953) 2020-04-28 12:40:43 -04:00
Ryan Dahl e0ca60e770
BREAKING: Use LLVM target triple for Deno.build (#4948)
Deno.build.os values have changed to correspond to standard LLVM target triples
"win" -> "windows"
"mac" -> "darwin"
2020-04-28 12:35:23 -04:00
迷渡 5a03e42117
typo (#4962) 2020-04-28 09:05:14 -04:00
Bartek Iwańczuk 2cb875bcfb
refactor: rename sync io interfaces (#4945)
This commit renames sync io interfaces:
* SyncReader -> ReaderSync
* SyncWriter -> WriterSync
* SyncSeeker -> SeekerSync
2020-04-28 13:23:30 +02:00
Bartek Iwańczuk 8feb30e325
BREAKING: remove overload of Deno.test() (#4951)
This commit removes overload of Deno.test() that accepted named
function.
2020-04-28 12:33:09 +02:00
Bert Belder ee4e6a1ef9
Rename FileInfo time fields and represent them as Date objects (#4932)
This patch also increases the resolution of reported file times to
sub-millisecond precision.
2020-04-27 21:13:32 +02:00
Marcos Casagrande c190a0dbc4
Improve std/http/io.ts parseHTTPVersion (#4930) 2020-04-27 14:08:20 -04:00
underfin df0000ff0a
feat(std/uuid): Implement uuid v5 (#4916) 2020-04-27 08:49:34 -04:00
Ali Hasani 516d970fd3
bug fix and tests for std/node/fs/mkdir (#4917) 2020-04-27 08:48:54 -04:00
张超杰 e10ee045ed
fix: typo fs readme.md (#4903) 2020-04-27 13:03:13 +02:00
Marcos Casagrande 128dce0d8a
Increase copyN buffer size to match go implementation (#4904) 2020-04-26 16:29:51 -04:00
张超杰 49cad79fb1
fix(std/fs): move dest if not exists and overwrite (#4910) 2020-04-26 16:27:24 -04:00
Akshat Agarwal 4f9bb11444
reorder copyN arguments to match Deno.copy (#4900) 2020-04-26 16:26:02 -04:00
Christopher Dieringer b28e60ecaf
refactor(std/log): support enum log level (#4859) 2020-04-25 11:13:26 +02:00
Bartek Iwańczuk 4a8d25646a
BREAKING CHANGE: remove Deno.OpenMode (#4884)
This commit removes Deno.OpenMode along with overloaded variants
of Deno.open() and Deno.openSync() that used OpenMode.
2020-04-25 00:45:55 +02:00
Bartek Iwańczuk 0cb1bb98cc
BREAKING CHANGE: change order of args in Deno.copy() (#4885) 2020-04-25 00:09:14 +02:00
Bartek Iwańczuk 824329f0da
BREAKING CHANGE: rename Deno.fsEvents() to Deno.watchFs() (#4886) 2020-04-24 23:40:29 +02:00
Bartek Iwańczuk 6a37e4426e
BREAKING CHANGE: rename TLS APIs to camel case (#4888)
This commit renames all APIs containing "TLS" to use camel case
(connectTLS -> connectTls, etc.)
2020-04-24 23:29:14 +02:00
Ali Hasani 6efdacddf3
create readme for std/bytes (#4876) 2020-04-24 14:24:29 -04:00
Bartek Iwańczuk 68d287eed5
BREAKING CHANGE: rename Deno.toAsyncIterator() to Deno.iter() (#4848)
* rename Deno.toAsyncIterator() to Deno.iter()
* adds sync version Deno.iterSync()
* adds optional second argument for buffer size
2020-04-22 21:30:45 +02:00
Nikolai Vavilov f72f045de5
std/node: require_ -> require (#4828) 2020-04-20 14:30:52 -04:00
Ali Hasani 437e35ca52
Add no-async-promise-executor lint rule (#4809) 2020-04-20 11:29:37 +02:00
Bartek Iwańczuk e2fd729a0b
fix(std): existsFile test 2020-04-18 22:29:39 +02:00
Chris Knight 957050cd02
feature: synchronous buffered writer (#4693) 2020-04-17 16:12:14 -04:00
Nayeem Rahman 5bfe3eb8f4
feat(cli/installer.rs): Add DENO_INSTALL_ROOT (#4787) 2020-04-16 18:15:42 -04:00
Chris Knight 1cd1f7de70
refactor: proper Node polyfill directory iteration now that Deno supports this (#4783) 2020-04-16 15:45:30 -04:00
uki00a f2d1bc3af3
docs(std): update links to documents (#4777) 2020-04-16 11:57:49 -04:00
Nayeem Rahman 5ac728a5f1
refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (#4763) 2020-04-16 01:40:30 -04:00
Steven Guerrero 6441852a1d
Migrate std/types to x/types (#4771) 2020-04-16 01:27:10 -04:00
Ali Hasani 7cfd094359
Implement UUID v1 (#4758) 2020-04-15 10:38:05 -04:00
Nayeem Rahman 926db017d9
Remove std/testing/format.ts (#4749) 2020-04-15 10:12:42 -04:00
Steven Guerrero 8397cd52a5
Refactor std/types (#4713) 2020-04-13 13:15:18 -04:00
Jake Gordon a5f7ff7200
manual.md tweaks (#4730) 2020-04-13 10:47:14 -04:00
Ali Hasani e23f33de7b
add copyFile & copyFileSync to std/node/fs (#4726) 2020-04-12 14:34:16 -04:00
Yusuke Sakurai 6e0c9a0c32
refactor(std/multipart): make readForm() return value more type safe (#4710) 2020-04-12 01:24:58 -04:00
Chris Knight 3e51e67f8a
remove unnecessary delay in std/signal tests (#4703) 2020-04-10 22:03:41 -04:00
木杉 195ad4c626
fix(std/http): verify cookie name & update SameSite type (#4685) 2020-04-10 10:12:42 -04:00
Chris Knight 85c61bff1c
fix(std/testing/asserts): change left/right to actual/expected (#4697) 2020-04-10 10:10:45 -04:00
Chris Knight 5bf1e4de3b
feat(std/signal): add utility for listening to signal events (#4696) 2020-04-10 10:05:56 -04:00
Ryan Dahl 02bc58d832
BREAKING: Make fetch API more web compatible (#4687)
- Removes the __fetch namespace from `deno types`
- Response.redirect should be a static.
- Response.body should not be AsyncIterable.
- Disables the deno_proxy benchmark
- Makes std/examples/curl.ts buffer the body before printing to stdout
2020-04-10 09:51:17 -04:00
Ryan Dahl ac215a2461
Fix build - 2becae broke CI (#4686) 2020-04-09 13:45:10 -04:00
Chris Knight 475a47cfb7
feat(std/log): improvements and new log handler (#4674) 2020-04-09 13:45:24 +02:00
Ali Hasani 90d6831271
feat(std/node): add isPrimitive (#4673) 2020-04-08 18:44:39 -04:00
Ali Hasani 68bde7a0c6
feat(std/node): add fs.mkdir functions and fs.exists tests (#4660) 2020-04-08 18:43:35 -04:00
Akshat Agarwal caff550b6c
BREAKING: Rename 'deno fetch' subcommand to 'deno cache' (#4656) 2020-04-07 11:24:47 -04:00
木杉 481fcfc8bd
file_server: use text/typescript instead of application/typescript (#4620)
I just tried it and found that using application/typescript, the browser will download 
the file directly, I think that .ts should be mapped to application/javascript or 
text/typescript
2020-04-07 10:06:22 -04:00
Nayeem Rahman e586d0c8b8
feat(std/http/server): Respond with 400 on request parse failure (#4614) 2020-04-07 12:34:18 +02:00
Ali Hasani 47a580293e
Add exists and existsSync to std/node (#4655) 2020-04-06 23:43:14 -04:00
Ali Hasani f5d505332e
Remove media_types from std/README.md (#4650) 2020-04-06 19:16:18 -04:00
Bartek Iwańczuk ee126eb4a7
remove std/testing/runner.ts (#4649) 2020-04-06 18:50:56 +02:00
Andrew Stucki 1e478d73e3
Drop headers with trailing whitespace in header name (#4642)
This relates directly to [an
issue](https://github.com/denoland/deno_std/issues/620) that I initially
raised in `deno_std` awhile back, and was reminded about it today when
the `oak` project popped up on my github recommended repos.

As of now Deno's http servers are vulnerable to the same underlying
issue of go CVE-2019-16276 due to the fact that it's based off of ported
go code from their old standard library. [Here's the commit that fixed
the
CVE.](6e6f4aaf70)

Long story short, some off the shelf proxies and caching servers allow
for passing unaltered malformed headers to backends that they're
fronting. When they pass invalid headers that they don't understand this
can cause issues with HTTP request smuggling. I believe that to this
date, this is the default behavior of AWS ALBs--meaning any server that
strips whitespace from the tail end of header field names and then
interprets the header, when placed behind an ALB, is susceptible to
request smuggling.

The current behavior is actually specifically called out in [RFC
7230](https://tools.ietf.org/html/rfc7230#section-3.2.4) as something
that MUST result in a rejected message, but the change corresponding to
this PR, is more lenient and what both go and nginx currently do, and is
better than the current behavior.
2020-04-06 09:58:46 -04:00
Andreas 703c0b7c17
feat(std/flags): pass key and value to unknown (#4637) 2020-04-06 09:27:10 -04:00
Khải 788a6abfd3
fix(std/testing): formatting bigint (#4626) 2020-04-04 13:13:37 -04:00
Nayeem Rahman faa0f520cf
doc: Improve the style guide (#4627) 2020-04-04 13:11:43 -04:00
dubiousjim a5fc505edb
fix erroneous assert (#4608) 2020-04-03 13:49:05 -04:00
Ryan Dahl 13db64fbc6
Remove /std/media_types (#4594) 2020-04-03 12:11:52 -04:00
Ryan Dahl c8fc29fcca
Revert "Respond with 400 on request parse failure" (#4593)
readRequest should not write a response.

This reverts commit 017a611131.
2020-04-02 15:20:17 -04:00
Ryan Dahl 12c6b2395b
Move encode, decode helpers to /std/encoding/utf8.ts, delete /std/strings/ (#4565)
also removes std/encoding/mod.ts and std/archive/mod.ts which are useless.
2020-04-01 15:23:39 -04:00
木杉 3a0b617503
std(media_types): change .ts content type to application/typescript (#4563) 2020-04-01 15:04:36 -04:00
Ryan Dahl 578138a930
Remove std/strings/pad.ts because String.prototype.padStart exists (#4564) 2020-04-01 20:28:16 +02:00
Khải fa7929ad2c
fix(file_server): use media_types for Content-Type header (#4555) 2020-04-01 12:51:01 -04:00
木杉 5ac2c4aa2e
fix(#4550): setCookie should append cookies (#4558) 2020-04-01 09:37:11 -04:00
Nayeem Rahman 270e87d9db
refactor(cli/js/testing): Reduce testing interfaces (#4451)
* Reduce "testing" interfaces
* Use a callback instead of a generator for Deno.runTests()
* Default RunTestsOptions::reportToConsole to true
* Compose TestMessage into a single interface
2020-04-01 10:47:23 +02:00
Nayeem Rahman 017a611131
feat(std/http/server): Respond with 400 on request parse failure (#4551) 2020-04-01 10:24:05 +02:00
Ondřej Žára a86b07f2df
used native padStart/End where possible (#4537) 2020-03-31 12:34:13 +02:00
uki00a a98512af9a
fix(std/encoding/csv): enable skipped tests (#4520) 2020-03-30 11:37:58 -04:00
Kitson Kelly 7670a13f8a
feat: Add common to std/path (#4527) 2020-03-30 11:36:55 -04:00
Niklas Eicker 92f1c71a6f
doc: Fix some typos and improve a few sentences in the std manual (#4522) 2020-03-29 22:23:57 -04:00
Kitson Kelly bced52505f
Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
Ryan Dahl 5837ce464c
upgrade: rusty_v8 to v0.3.9 (#4505) 2020-03-28 10:00:14 -04:00
Bartek Iwańczuk 30bcf6a2ea
Revert "avoid using same port number for test (#4147)"
Ref #4467

This reverts commit 60cee4f045.
2020-03-24 12:24:58 -04:00
uki00a b2478f3a21
docs: update manual about how to run tests for std (#4462) 2020-03-24 15:34:50 +01:00
Yusuke Sakurai c337d2c434
clean up textproto code in std (#4458)
- moved and renamed append() into bytes from ws and textproto
- renamed textproto/readder_tests.ts -> textproto/test.ts
2020-03-22 14:49:09 -04:00
uki00a 07ea145ec4
re-enable a test (#4461) 2020-03-22 14:41:42 -04:00
Akshat Agarwal b8a5c29bf8
BREAKING CHANGE Rename Deno.run's args to cmd (#4444)
This is to avoid confusion with Deno.args which does not include the 
executable to be run.
2020-03-21 17:44:18 -04:00
Yusuke Sakurai 60cee4f045
avoid using same port number for test (#4147) 2020-03-21 09:53:47 -04:00
Ryan Dahl 0adc86f105
Remove DENO_BUILD_MODE and DENO_BUILD_PATH (#4431)
* Remove DENO_BUILD_MODE and DENO_BUILD_PATH

Also remove outdated docs related to ninja/gn.

* fix

* remove parameter to build_mode()

* remove arg parsing from benchmark.py
2020-03-20 21:48:34 -04:00
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