Commit graph

1339 commits

Author SHA1 Message Date
Tuan Le 878f306a39
feat(cli): Add Deno.env.delete() (#5859) 2020-06-09 14:58:30 +02:00
Nayeem Rahman 44251ce8ea
fix(cli/js/web/worker): Disable relative module specifiers (#5266) 2020-06-09 14:33:52 +02:00
uki00a 2b2d800b43
feat(doc): display all overloads in cli details view (#6186) 2020-06-09 14:12:47 +02:00
Nayeem Rahman b3e189ee4f
fix(cli/js/process): Strengthen socket types based on pipes (#4836) 2020-06-09 13:18:18 +02:00
Jack Kelly cb29f7f323
test: fixed initial [WILDCARD] not matching empty the on first line (#5420) 2020-06-08 19:24:27 +02:00
Peter Indiola 6236252c66
feat(cli/js/net): make rid on listener public (#5571) 2020-06-08 18:24:51 +02:00
Marcos Casagrande d907133944
fix(cli/web/fetch): multipart/form-data request body support for binary files (#5886) 2020-06-08 18:08:26 +02:00
Faycel 4feccdd3b7
Adjusting the HTTPS_PROXY flag text (#6103) 2020-06-08 12:06:06 -04:00
Bartek Iwańczuk 0e9da7e731
feat: "deno lint" subcommand (#6125) 2020-06-08 14:06:20 +02:00
Akshat Agarwal 1e709387e4
Add "fork" method on DenoPermissions, PermissionState (#5693) 2020-06-06 16:56:21 +02:00
Filippo Rossi 78333f0ab3 Add diff for "deno fmt --check" (#5599) 2020-06-06 09:07:59 -04:00
Ryan Dahl 8a4533eb75 feat: deno eval -p (#5682) 2020-06-06 09:07:59 -04:00
Casper Beyer ed5aedc6b4
Rename abbreviated assertions in std/testing (#6118) 2020-06-05 23:43:00 -04:00
Taisuke Fukuno 93175b7a79
added mjs files for default fmt (#6134) 2020-06-05 23:36:50 -04:00
Taisuke Fukuno d2243b1125
deno test should run mjs files (#6122) 2020-06-05 17:01:44 -04:00
Bert Belder 18670c47e6
fix: 'deno upgrade' doesn't work on Windows 8.1/PowerShell 4.0 (#6132)
Fixes: #6109
2020-06-05 22:16:44 +02:00
Bert Belder ee7727cd07
To find home dir, use only $USERPROFILE on Windows, $HOME on Posix (#6132)
$HOME is meaningless on Windows. It may be set by users or by third
party software, but it is non-standard and should not be relied upon.

Likewise, $USERPROFILE is meaningless on other platforms.
2020-06-05 22:15:05 +02:00
Ryan Dahl 78bfeebad1
Revert "fix: Use # to denote line number in stack traces" (#6119)
This reverts commit c4c6a8dae4

There is some controversy about this change because vscode doesn't interpret the fragments correctly. Needs more discussion before landing.
2020-06-05 11:37:40 -04:00
Andrew Mitchell c4c6a8dae4
fix: Use # to denote line number in stack traces (#6114)
This makes the URLs in stack traces actual URLs to the files.
Before: https://deno.land/std/testing/asserts.ts:138:11
After: https://deno.land/std/testing/asserts.ts#138:11
2020-06-05 08:01:02 -04:00
Bert Belder 9a783ae4e6
ci: upgrade to Rust 1.44.0 (#6113) 2020-06-05 05:11:15 +02:00
Ryan Dahl e3cc3db20f
Revert "feat: format deno bundle output (#5139)" (#6085)
This reverts commit 93cf3bd534.
2020-06-04 08:36:25 -04:00
uki00a 9bd5c08d5a
feat(doc): handle detail output for enum (#6078) 2020-06-03 21:40:50 +02:00
David Sherret fcae2fec87
Upgrade to swc_ecma_parser 0.24.5 (#6077) 2020-06-03 21:36:55 +02:00
Chris Knight 1ebd330927
doc: complete unstable documentation and make consistent (#6074) 2020-06-03 13:46:09 -04:00
Ryan Dahl 515d19d901
v1.0.5 2020-06-03 12:52:01 -04:00
David Sherret 445e44199b
Update to dprint 0.19.1 and swc_ecma_parser 0.24.3 (#6068) 2020-06-03 17:24:25 +02:00
Marcos Casagrande a1915a0d4f
fix(fetch): Support 101 status code (#6059) 2020-06-03 09:43:11 -04:00
Ryan Dahl 23dc9c13db
Fix REPL BorrowMutError panic (#6055) 2020-06-02 16:37:52 -04:00
Ryan Dahl b7b6e0674f
Remove unused check-only feature (#6035) 2020-06-02 14:56:21 -04:00
Bartek Iwańczuk 9c59a4b18c
v1.0.4 2020-06-02 15:48:17 +02:00
Kitson Kelly 3fe6bc1b82
fix: Better use of @ts-expect-error (#6038) 2020-06-02 00:24:44 -04:00
Ryan Dahl 8b1b4766a1
Move create_main_worker to MainWorker::create (#6034) 2020-06-01 22:44:17 -04:00
Ali Hasani 30785ed592
fix(bundle): better size output (#5997) 2020-06-01 18:42:12 -04:00
Matt Dumler a4567e0e01
fix(doc): remove JSDoc comment truncation (#6031) 2020-06-01 18:40:51 -04:00
Ryan Dahl b693ca7f7f
upgrade: crates (#6032) 2020-06-01 16:25:10 -04:00
Bartek Iwańczuk c813990806
fix: compile TS dependencies of JS files (#6000)
This commit fixes regression that caused TS dependencies
not being compiled.

Check was added that ensures TS compiler is run if 
any of dependencies in module graph is TS/TSX/JSX.
2020-06-01 21:01:51 +02:00
Valentin Anger becbb56b19
feat(core): Ops can take several zero copy buffers (#4788) 2020-06-01 14:20:47 -04:00
精武陈真 f0ba814a79
fix jsDoc (#5992) 2020-06-01 09:53:43 -04:00
Marcos Casagrande 29db4104c4
fix(cli/web): Body.bodyUsed should use IsReadableStreamDisturbed 2020-06-01 14:37:46 +02:00
Marcos Casagrande 1d3dce9a68
fix(cli/js/web): formData parser for binary files (#6015) 2020-06-01 14:32:08 +02:00
Marcos Casagrande edeeedf401
fix(cli/fetch): set null body for null-body status (#5980) 2020-05-31 19:21:14 -04:00
Marcos Casagrande 08552fc6b9
fix(fetch): network error on multiple redirects (#5985) 2020-05-31 16:13:53 -04:00
Marcos Casagrande ecb94c06e9
fix Headers.name and FormData.name (#5994) 2020-05-31 16:07:24 -04:00
Bartek Iwańczuk 02d46bae9f
fix: media type for .cjs and application/node (#6005) 2020-05-31 21:08:26 +02:00
uki00a 464f5bf769
chore(cli/tests/unit/remove_test): remove duplicate codes between sync and async cases (#6004) 2020-05-31 13:19:56 -04:00
uki00a 64bd2768f7
fix(#4850): Deno.remove() fails to remove unix socket (#5967) 2020-05-30 14:48:26 -04:00
Bartek Iwańczuk 550556e948
fix: ES private fields parsing in SWC (#5964) 2020-05-30 17:32:48 +02:00
Chris Knight 8b037364ac
doc: add/update jsdoc for global functions (#5963) 2020-05-30 11:19:16 -04:00
Ryan Dahl dad551a3a7
upgrade: Rust crates (#5959) 2020-05-30 11:35:44 +02:00
Marcos Casagrande a82f24e9a8
test to check that resource handle is closed after stream is cancelled (#5956) 2020-05-30 01:02:41 -04:00
Ryan Dahl d4b05dd89e
refactor: Split isolate and state using safe get_slot() (#5929) 2020-05-29 17:41:39 -04:00
Bartek Iwańczuk 106b001738
v1.0.3 2020-05-29 18:48:48 +02:00
Nayeem Rahman 8e39275429
fix(cli/permissions): Fix CWD and exec path leaks (#5642) 2020-05-29 17:27:43 +02:00
Bartek Iwańczuk ad6d2a7734
refactor: TS compiler and module graph (#5817)
This PR addresses many problems with module graph loading
introduced in #5029, as well as many long standing issues.

"ModuleGraphLoader" has been wired to "ModuleLoader" implemented
on "State" - that means that dependency analysis and fetching is done
before spinning up TS compiler worker.

Basic dependency tracking for TS compilation has been implemented.

Errors caused by import statements are now annotated with import
location.

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-05-29 16:32:15 +02:00
Nayeem Rahman 49c7077401
fix(cli/js/error_stack): Expose Error.captureStackTrace (#5254) 2020-05-29 14:02:36 +02:00
Akshat Agarwal ce246d8d85
feat(cli): deserialize Permissions from JSON (#5779) 2020-05-29 13:00:47 +02:00
Luca Casonato 02a6720527
Improved typechecking error for unstable props (#5503) 2020-05-29 12:45:20 +02:00
Kitson Kelly 2668637e9b
fix: REPL evaluates in strict mode (#5565)
Since everything that Deno loads is treated as an ES Module, 
it means that all code is treated as "use strict" except for 
when using the REPL. This PR changes that so code in the 
REPL is also always evaluated with "use strict". There are 
also a couple other places where we load code as scripts 
which should also use "use strict" just in case.
2020-05-29 12:24:06 +02:00
Adam Odziemkowski 958f21e7ab
fix(cli): write lock file before running any code (#5794) 2020-05-29 02:43:31 -04:00
Peter Evers fe7d6824c9
fix DenoBlob name (#5879) 2020-05-29 02:27:57 -04:00
uki00a 55311c33c4
chore(integration_tests): stop collecting unnecessary output in permissions tests (#5926) 2020-05-28 19:40:33 -04:00
David Sherret dc6c07e3ed
fix(cli): Handle formatting UTF-8 w/ BOM files (#5881) 2020-05-28 13:35:24 -04:00
Speykious 6d9b06619d
improve indentation when displaying objects with console.log (#5909) 2020-05-28 09:04:43 -04:00
Marcos Casagrande c9bbb200d6
formData: set default filename for Blob to <blob> (#5907) 2020-05-28 09:02:00 -04:00
Kevin (Kun) "Kassimo" Qian 3cbcdd4250
console: Hide values for console.table if display not necessary (#5914) 2020-05-28 08:30:32 -04:00
Matt Dumler f6e58b076c
fix(doc): handle comments at the top of the file (#5891) 2020-05-27 23:38:36 +02:00
Marcos Casagrande f8c6500eef
test(clie/web/fetch): Re-enable tests (#5904) 2020-05-27 16:37:19 -04:00
Bartek Iwańczuk 7d764a2c27
upgrade: dprint to 0.19.0 (#5899) 2020-05-27 11:19:31 -04:00
Kitson Kelly 228f9c207f
Use ts-expect-error instead of ts-ignore. (#5869) 2020-05-26 10:02:16 -04:00
Bartek Iwańczuk f462f7fe54
fix: parsing of JSX and TSX in SWC (#5870) 2020-05-26 15:41:00 +02:00
Marcos Casagrande 4e92ef7dc9
Add more tests for fetch response body (#5852) 2020-05-25 16:20:09 -04:00
Marcos Casagrande 08f74e1f6a
fix(cli/web/fetch): Make Response constructor standard (#5787) 2020-05-25 12:55:16 -04:00
Marcos Casagrande 1c4a9665e2
fix: Allow ArrayBuffer as Fetch request body (#5831) 2020-05-25 09:26:36 -04:00
Marcos Casagrande c9f0e34e29
Improve bufferFromStream (#5826) 2020-05-25 09:14:01 -04:00
Marcos Casagrande 20bf04dc7e
Move getHeaderValueParams & hasHeaderValueOf to util.ts (#5824) 2020-05-25 09:12:09 -04:00
Bert Belder 131f2a5f0c
fix: BorrowMutError when evaluating expression in inspector console (#5822)
Note that this does not fix the 'Uncaught ReferenceError' issue that
happens when 'eager evaluation' is enabled in the inspector.

Fixes: #5807
2020-05-25 04:26:33 +02:00
Bert Belder ee0b5bb89e
test: add utility function for assigning unique port to inspector (#5822) 2020-05-25 02:41:59 +02:00
Bartek Iwańczuk e934df5f7d
fix: create HTTP cache lazily (#5795) 2020-05-24 19:20:40 +02:00
Andrew Mitchell 4ca0d6e2d3
Re-enable several fetch tests (#5803) 2020-05-24 12:04:57 -04:00
Valentin Anger b7f0b073bb
Add unstable checks for unix transport (#5818)
Also remove the unix example from the stable documentation
to stay in line with the `Deno.listen` one
2020-05-24 09:43:40 -04:00
Bartek Iwańczuk c3c16f025c
fix: TSX analysis in module graph loader (#5785) 2020-05-23 19:04:29 +02:00
guzhongren 94f1de5f80
Fix example (#5775) 2020-05-23 10:16:57 -04:00
Luca Casonato 6feca0ef8b
Fix Deno.dir and Diagnostics being present at stable runtime (#5750) 2020-05-23 09:37:12 -04:00
Marcos Casagrande 28b651c2e2
Simplify isFiniteNonNegativeNumber (#5686) 2020-05-22 22:09:35 -04:00
Ergenekon Yiğit 4fa69e890e
fix: atob should throw dom exception (#5730) 2020-05-22 21:52:50 -04:00
Bartek Iwańczuk 526c9196e2
v1.0.2 2020-05-22 20:00:28 +02:00
Bartek Iwańczuk 960f9ccb2e
fix: SWC lexer settings and silent errors (#5752)
This commit changes how error occurring in SWC are handled.
Changed lexer settings to properly handle TS decorators.
Changed output of SWC error to annotate with position in file.
2020-05-22 19:23:35 +02:00
Bartek Iwańczuk e191c70989
fix: ts type imports (#5733) 2020-05-22 19:05:18 +02:00
Chris Knight 4b06e35765
doc: clarify and warn on Deno.read/write behaviour (#5743) 2020-05-22 12:56:12 -04:00
Bartek Iwańczuk f9e45114b9
fix: redirects handling in module analysis (#5726)
This commit fixes a bug introduced in #5029 that caused bad 
handling of redirects during module analysis. 

Also ensured that duplicate modules are not downloaded.
2020-05-22 16:01:00 +02:00
David Sherret ee71099492
fix(fmt): Do not panic on new expr with no parens. (#5734)
Closes #5567
2020-05-21 20:43:32 -04:00
Bartek Iwańczuk 491feb859f
fix: --inspect flag working like --inspect-brk (#5697) 2020-05-21 20:34:25 +02:00
Bhumij Gupta 88e8c32652
docd: Replace obsolete Deno.homeDir() with Deno.dir('home') (#5708) 2020-05-21 14:06:42 +02:00
Colin Harrington aea5b12bae
ci: Errors in benchmarks should fail CI (#5422) 2020-05-21 13:08:43 +02:00
Bartek Iwańczuk 5f9c1c7da6
fix: disallow http imports for modules loaded over https (#5680) 2020-05-21 13:06:12 +02:00
Maple Miao 9fdc6dc435
docs: fix test glob pattern (#5661) 2020-05-21 01:02:32 -04:00
Marcos Casagrande 47b089ffa8
fix: streams hwm validation (#5681) 2020-05-20 20:18:43 -04:00
Ryan Dahl 30702e2678
move js unit tests to cli/tests (#5678) 2020-05-20 17:52:51 -04:00
Ryan Dahl 49dda23f6b
v1.0.1 2020-05-20 12:40:26 -04:00
David Sherret 91d576aa5a
Update dprint 0.18.4 (#5671)
Fixes trailing comma issue
2020-05-20 10:30:33 -04:00
Bartek Iwańczuk 8799855fdc
refactor: reorganize TS compiler (#5603) 2020-05-20 16:25:40 +02:00
Ryan Dahl 0fb5f23466
fix(doc): crash on formatting type predicate (#5651) 2020-05-19 18:55:06 -04:00
Speykious 9752b853dd
Provide better ANSI colorized output when inspecting objects (#5404) 2020-05-19 14:19:26 -04:00
uki00a cdc9323ccc
fix: REPL does not exit properly when close() is called (#5451) 2020-05-19 13:33:11 -04:00
buckle2000 1be7ec47ac
Mark Deno.pid and Deno.noColor as const (#5593) 2020-05-18 21:51:54 -04:00
Ali Hasani 6072755ead
Implement Deno.symlink() for windows (#5533) 2020-05-19 00:46:02 +02:00
Nayeem Rahman 93c2164673
Fix URL encoding (#5557) 2020-05-18 09:47:45 -04:00
Ali Hasani c3ec16535f
Make Deno.remove() work with directory symlinks on windows (#5488) 2020-05-18 14:50:44 +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
Bartek Iwańczuk f6caf4883d
fix: disable test using 019_media_types (#5589)
This commit disabled flaky test in cli/module_graph.rs.

The test uses 019_media_types.ts which was known to be flaky
for some time. Test should be reenabled once test HTTP server
is rewritten to Rust.
2020-05-18 14:00:08 +02:00
Bartek Iwańczuk 9d63772fe5
refactor: rewrite TS dependency analysis in Rust (#5029)
This commit completely overhauls how module analysis is 
performed in TS compiler by moving the logic to Rust.

In the current setup module analysis is performed using 
"ts.preProcessFile" API in a special TS compiler worker 
running on a separate thread.

"ts.preProcessFile" allowed us to build a lot of functionality
in CLI including X-TypeScript-Types header support 
and @deno-types directive support. Unfortunately at the 
same time complexity of the ops required to perform 
supporting tasks exploded and caused some hidden 
permission escapes.

This PR introduces "ModuleGraphLoader" which can parse
source and load recursively all dependent source files; as 
well as declaration files. All dependencies used in TS 
compiler and now fetched and collected upfront in Rust 
before spinning up TS compiler.

To achieve feature parity with existing APIs this commit 
includes a lot of changes:

* add "ModuleGraphLoader"
  - can fetch local and remote sources
  - parses source code using SWC and extracts imports, exports, file references, special 
     headers
  - this struct inherited all of the hidden complexity and cruft from TS version and requires 
     several follow up PRs
* rewrite cli/tsc.rs to perform module analysis upfront and send all required source code to 
  TS worker in one message
* remove op_resolve_modules and op_fetch_source_files from cli/ops/compiler.rs
* run TS worker on the same thread
2020-05-18 12:59:29 +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
David Sherret a054250a2c
Update to dprint 0.18.3 and the latest version of swc (#5509) 2020-05-17 18:56:22 +02:00
Bartek Iwańczuk e16eb9e108
chore: capture stderr in integration tests (#5549)
This commit removes "check_stderr" setting from itest! macro used
to generate integration tests. Without this setting on tests discarded
output of stderr making it very hard to debug the problem in test.

Numerous tests were changed by adding "--quiet" flag to not display
"Compile"/"Download" prompts.
2020-05-17 17:42:39 +02:00
Masahiro Miyashiro (3846masa) 63bc468365
Fix definition of URL constructor (#5521) 2020-05-17 11:37:16 -04:00
Ali Hasani 6ffb8ee2c3
docs: update cli/js/tests README (#5531) 2020-05-17 12:14:37 +02:00
Yiyu Lin c4fe58d8df
Return error if more than one listener calls WorkerHandle::get_event() (#5461) 2020-05-17 06:50:38 +02:00
Yiyu Lin f12dffca9f
tsc: use serde to (de)serialize CompiledFileMetadata (#5481)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-05-16 21:47:26 +02:00
Siddharth Parmar bfd4baf2d3
Fix formatting of example code in typescript declaration files (#5475) 2020-05-16 21:23:48 +02:00
Yiyu Lin 0b9942da84
fix some unwrap() in Rust (#5485) 2020-05-16 09:41:32 -04:00
Bert Belder 76a6a1ff46
Fix a bunch of spelling errors (#5314) 2020-05-16 00:36:49 +02:00
Yiyu Lin 871a0c9c0e
fix some clippy warning (#5462) 2020-05-15 15:26:16 -04:00
Bartek Iwańczuk 89fe81168e
fix: panic if $DENO_DIR is a relative path (#5375)
This commit fixes panic occurring if $DENO_DIR is set to a relative
path, eg. "DENO_DIR=denodir deno run main.ts".

Before creating DenoDir instance given path is checked and if necessary
resolved against current working directory.

Additional sanity checks were put in place to ensure all caches
receive absolute path for the location.
2020-05-15 16:32:52 +02:00
uki00a c5a54e44bc
chore: port deno_dir_test to Rust (#5408) 2020-05-15 10:22:28 -04:00
Tomasz Gałkowski 8440d765d5
fix: setTimeout and friends have too strict types (#5412) 2020-05-15 09:51:49 -04:00
Chris Knight 8c45d3a06d
doc: add stream api (#5418) 2020-05-15 09:35:50 -04:00
Valentin Anger 5b76f7a838
Remove debug prints introduced in e18aaf49c (#5356) 2020-05-14 14:10:54 -04:00
Kevin (Kun) "Kassimo" Qian 7de86ab605
cli: don't panic on Deno.close invalid argument (#5320) 2020-05-14 06:59:56 -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
Bartek Iwańczuk 55d2c6bd10
v1.0.0 2020-05-13 18:07:15 -04:00
Pavan Kumar 9c01403865
default to 0.0.0.0 for Deno.listen (#5203) 2020-05-13 09:18:41 -04:00
Kitson Kelly 3d7552af2e
Update to TypeScript 3.9 (#4510) 2020-05-13 08:03:04 -04:00
Bert Belder e34a3b61f4
Make --inspect-brk pause on the first line of _user_ code (#5250) 2020-05-13 00:12:46 +02:00
A.E Clarence e90c95b465
fix example of readTextFile (#5247) 2020-05-12 13:38:44 -04:00
Bartek Iwańczuk 053c568c8c
fix: source maps in inspector for local files (#5245)
This commit changes handling of source maps by setting proper
file URLs for "file" and "sources" fields in the source map.
2020-05-12 17:44:25 +02:00
Bartek Iwańczuk 35e8bc8de6
v1.0.0-rc3 2020-05-12 08:33:18 -04:00
Bartek Iwańczuk d062ffc1ba
fix: source maps in inspector (#5223)
This commit fixes problems with source maps in Chrome Devtools
by substituting source map URL generated by TS compiler with
actual file URL pointing to DENO_DIR.

Dummy value of "source_map_url" has been removed from
"ScriptOrigin".

Also fixes lock file which used compiled source code to generate
lock hash; it now uses source code of the file that is
being compiled.
2020-05-11 23:48:36 +02:00
Ryan Dahl 73d8fa74c6
BREAKING: There is no public Rust API for the CLI (#5226) 2020-05-11 17:33:36 -04:00
Bert Belder 3cccadcf0f
Change plugin interface to prevent segfaults when unloading plugin (#5210)
Fixes: #3473
Closes: #5193
2020-05-11 22:39:13 +02:00
Ryan Dahl fb7d7f40ed
Merge std_tests.rs into integration_tests.rs.rs (#5228)
* Remove usage of url_to_filename from integration_tests
* Make test ports not conflict with each other
2020-05-11 14:49:19 -04:00
Kitson Kelly d16c7394cb
fix: Expose ErrorEvent globally (#5222) 2020-05-11 14:28:13 +02:00
Bartek Iwańczuk 32aeec9630
refactor: check permissions in SourceFileFetcher (#5011)
This PR hot-fixes permission escapes in dynamic imports, workers
and runtime compiler APIs.

"permissions" parameter was added to public APIs of SourceFileFetcher
and appropriate permission checks are performed during loading of
local and remote files.
2020-05-11 13:13:27 +02:00
Bartek Iwańczuk 0d148c6e80
fix: remove default --allow-read perm for deno test (#5208) 2020-05-10 23:24:36 +02:00
David Sherret e9318aa2c0
Update to dprint 0.17.2 (#5195) 2020-05-10 08:49:00 -04:00
Bartek Iwańczuk d8f5b37218
1.0.0-rc2 2020-05-09 15:37:22 -04:00
Bartek Iwańczuk 1fddcc3721
refactor(cli): unify display of errors from Rust and JS (#5183) 2020-05-09 21:09:46 +02:00
Kitson Kelly 670d01d012
fix: Allow multiple Set-Cookie headers (#5100) 2020-05-09 19:20:18 +02:00
Nayeem Rahman 7a635eda5e
fix(cli/installer): Fix concurrent env handling in tests (#5182) 2020-05-09 19:14:56 +02:00
Ryan Dahl b8364a2636
BREAKING: make Deno.hostname unstable (#5108) 2020-05-09 12:44:35 -04:00
Ryan Dahl eb505f8afc
Add support for X-Deno-Warning header (#5161) 2020-05-09 12:43:24 -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
crowlKats abbf0339cd
feat(upgrade): allow specifying a version (#5156) 2020-05-09 06:31:15 -04:00
Michał Zdunek 9790399bce
add option to lint and format only staged files (#5172) 2020-05-09 06:22:27 -04:00
Ryan Dahl 4e5e6da348
Add hint on how to exit REPL (#5143)
Removes exit and help commands
2020-05-08 18:58:51 -04:00
Bartek Iwańczuk f9f10229a4
refactor: Remove cli::compilers module (#5138)
This PR removes "cli/compilers/" directory.

"cli/compilers/ts.rs" has been renamed to "cli/tsc.rs"
2020-05-08 16:18:00 +02:00
Oliver Lenehan a08a4abac1
feat(workers): "crypto" global accessible in Worker scope (#5121) 2020-05-08 14:30:53 +02:00
Chris Knight 5fea4e826c
fix: correct type error text (#5150) 2020-05-08 14:28:46 +02:00
Bartek Iwańczuk aca21dad1b
BREAKING: make Worker.deno unstable (#5128)
This commit makes "Worker.deno" option unstable.

Added new manual entry "docs/runtime/workers.md".

Removed stale workers tests.
2020-05-07 21:15:59 +02:00
Bartek Iwańczuk 2b66b8a03e
BREAKING: Remove support for .wasm imports (#5135)
Importing .wasm files is non-standardized therefore deciding to
support current functionality past 1.0 release is risky.

Besides that .wasm import posed many challenges in our codebase
due to complex interactions with TS compiler which spawned
thread for each encountered .wasm import.

This commit removes:
- cli/compilers/wasm.rs
- cli/compilers/wasm_wrap.js
- two integration tests related to .wasm imports
2020-05-07 20:43:27 +02:00
Yoshiya Hinosawa 93cf3bd534
feat: format deno bundle output (#5139) 2020-05-07 14:39:00 -04:00
Ryan Dahl 9a8d948420
Remove REPL/Windows hack (#5136) 2020-05-07 12:01:27 -04:00
Bartek Iwańczuk 53265fb6db
feat(bundle): add --config flag (#5130) 2020-05-07 17:02:03 +02:00
Bartek Iwańczuk 0ba90c8c11
fix(imports): fix panic on unsupported scheme (#5131) 2020-05-07 15:57:10 +02:00
Yoshiya Hinosawa dabe88f854
fix(deno_dir): better error message (#5120)
Add better error messages when a cache subdirectory in 
`DENO_DIR` cannot be created.
2020-05-07 14:32:57 +02:00
zjopy 761b7efb3b
fix(docs): add missing "deno run" (#5126) 2020-05-07 13:48:48 +02:00
Bert Belder 7e00b2471d
Upgrade to rusty_v8 0.4.2 / V8 8.4.300 (#5113) 2020-05-06 22:35:24 +02:00
Ryan Dahl 6666f1d36a
remove target_test.py (#5112) 2020-05-06 16:34:48 -04:00
Ryan Dahl 221221cc97
BREAKING: execPath should require allow-read (#5109) 2020-05-06 15:51:33 -04:00
Nikolai Vavilov 76c77bb32c
Check destination length in encodeInto (#5078) 2020-05-06 13:10:15 -04:00
Bartek Iwańczuk 91369841ef
refactor(ts): make processImports logic more verbose (#5089) 2020-05-06 16:59:43 +02:00
Ryan Dahl 2b15e53d5a
Upgrade crates (#5104) 2020-05-06 10:10:51 -04:00
Bartek Iwańczuk e18aaf49cf
feat: deno doc handles default exports (#4873) 2020-05-06 14:48:48 +02:00
Bert Belder e513751ee9
Clean up 'inspector_break_on_first_line' test and fix its flakiness (#5098) 2020-05-06 04:32:14 +02:00
Bartek Iwańczuk 2ecdbb62ae
refactor: merge TS compiler into single file (#5091) 2020-05-06 00:19:18 +02:00
Bartek Iwańczuk 9cd7d59840
fix(cli): fix paths in internal stack traces (#5093)
This commit updates "deno_typescript" crate to properly map
bundle entrypoint file to internal specifier.

All import specifiers were remapped from "file:///a/b/c.ts" to
"$deno$/a/b/c.ts", but that was not the case for entrypoint file
"main.ts" and "compiler.ts".

Because of that internal stack traces were inconsistent; showing
"file:///some/random/path/on/ci/machine.ts" URL in frames that
originate from "main.ts" or "compiler.ts" and "$deno$/file.ts"
for all other imports.
2020-05-05 23:13:04 +02:00
Ryan Dahl 5875bb9c0d
Simplify ProcessStdio (#5092) 2020-05-05 16:54:25 -04:00
Bartek Iwańczuk cf5a39a361
refactor(ts): remove op_cache (#5071)
This PR removes op_cache and refactors how Deno interacts with TS compiler.

Ultimate goal is to completely sandbox TS compiler worker; it should operate on
simple request -> response basis. With this commit TS compiler no longer
caches compiled sources as they are generated but rather collects all sources
and sends them back to Rust when compilation is done.

Additionally "Diagnostic" and its children got refactored to use "Deserialize" trait
instead of manually implementing JSON deserialization.
2020-05-05 18:23:15 +02:00
Bert Belder e574437922
Fix inspector hanging when task budget is exceeded (#5083)
The issue is solved by proxying websocket messages over a pair of
`futures::mpsc::unbounded` channels. As these are are implemented in
the 'futures' crate, they can't participate in Tokio's cooperative
task yielding.
2020-05-05 16:12:45 +02:00
Ryan Dahl 5f67a202ff
v1.0.0-rc1 2020-05-04 15:46:39 -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
Ryan Dahl 191c59a591
Rename DenoPermissions, add abs path asserts (#5076) 2020-05-04 14:10:59 -04:00
Ryan Dahl 38ecabf205
Simplify ts-compiler's normalizeString (#5072) 2020-05-04 12:22:42 -04:00
Ryan Dahl 92c0591fcb
simplify unit tests: compiler_api, workers (#5073) 2020-05-04 10:40:18 -04:00
Daniel Lenksjö 1500547afa
fix: URL constructor throws confusing error on invalid scheme (#5057) 2020-05-04 10:06:47 -04:00
Ryan Dahl 821a4ae5fd
Make it so ts compiler doesn't call cwd op (#5070)
Removes duplicate implementation of the module resolution algorithm
2020-05-04 09:39:40 -04:00
木杉 58d0c4f9d6
fix(console): formatting misalignment on console.table (#5046) 2020-05-04 13:36:26 +02:00
Divya 36ad4e3b77
fix(install): Propagate --unstable flag (#5061) 2020-05-04 13:35:00 +02: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 7e32269f3f
Add TransformStream and TransformStreamController (#5042) 2020-05-03 15:10:52 -04:00
Nayeem Rahman 0f3e6e2eea
fix(cli/fmt_errors): Respect NO_COLOR for stack frames (#5051) 2020-05-02 23:55:16 -04:00
Ryan Dahl bbbf9f299c
Deno.chdir should require allow-read not allow-write (#5033) 2020-05-02 18:33:43 -04:00
Bartek Iwańczuk 2872b362ff
BREAKING: disallow static import of local modules from remote modules (#5050)
This commit changes module loading logic to disallow statically import
local module (file:// scheme) from remote modules (http://, https://
schemes).
2020-05-02 15:51:08 +02:00
Bartek Iwańczuk de2c042482
BREAKING: remove support for JSON imports (#5037)
This commit removes support for importing JSON files as modules.

This change is dictated by security; browsers rolled back on this
support as well.
2020-05-02 00:32:05 +02:00
Nayeem Rahman 96fd0f4692
BREAKING: feat(cli/installer): Support guessing the executable name (#5036) 2020-05-01 15:33:11 -04:00
Bartek Iwańczuk 6661e7e287
BREAKING: remove window.location and self.location (#5034)
This commit removes "location" global available on "window",
"globalThis" and "self".
2020-05-01 20:15:28 +02:00
Ryan Dahl 5d3c49082f
Correct copyright in cli/js/web/decode_utf8.ts (#5035) 2020-05-01 13:29:00 -04:00
Fenzland 25b765c123
fix misaligned error reporting on tab char (#5032) 2020-05-01 13:03:54 -04:00
Marcos Casagrande 4297b865f9
internal: reorder Buffer's copyBytes arguments (#5021) 2020-04-30 15:46:44 -04:00
David Sherret 3e72d63205
fix(fmt): Format abstract async as abstract async (#5020) 2020-04-30 21:05:30 +02:00
Bartek Iwańczuk f79cb08e0b
feat: add SWC dependency analyzer (#5015)
This commit adds "analyze_dependencies" function that uses SWC
(by the means of AstParser) to perform analysis of static and dynamic
imports.
2020-04-30 20:18:50 +02: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
Bartek Iwańczuk 4993a6504b
fix(doc): better repr for object literal types (#4998) 2020-04-30 16:40:51 +02:00
Kitson Kelly 81c75332fb
feat: Add WritableStreams (and enable ReadableStreams piping) (#4980) 2020-04-30 10:40:10 -04:00
Bartek Iwańczuk 46bfcbbaa8
refactor(core): add "prepare_load" hook to ModuleLoader trait (#4866)
This PR adds prepare_load hook method to ModuleLoader trait. It allows implementors to perform preparation work before starting actual module loading into isolate. It's meant to be used in CLI; where "transpilation" step will be explicitly performed during prepare_load instead of doing it adhoc for each module if needed.
2020-04-30 14:37:06 +02:00
Bartek Iwańczuk f92bb9cf4d
v0.42.0 2020-04-29 17:04:05 -04:00
Ryan Dahl bc792c0267
make camel case readDir, readLink, realPath (#4995) 2020-04-29 16:39:37 -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
Brayden 2337fca277
Make Deno.isatty stable (#4937) 2020-04-29 12:43:34 +02:00
Marcos Casagrande 0703431ec2
fix: bug in Deno.copy (#4977) 2020-04-28 21:30:48 -04:00
Bartek Iwańczuk 640f6878f6
refactor: Deno.listener closes when breaking out of async iterator (#4976) 2020-04-29 01:08:02 +02:00
Bartek Iwańczuk 1b6181e434
refactor: factor out datagram from Deno.listen(), make it unstable (#4968)
This commit changes Deno.listen() API by factoring out datagram listeners to Deno.listenDatagram(). New Deno.listenDatagram() is unstable.
2020-04-28 21:46:39 +02:00
Ryan Dahl ea28a088a4
Remove Conn.closeRead (#4970) 2020-04-28 15:17:55 -04:00
David Sherret f899d76667
Fix stdin not formatting JSX (#4971) 2020-04-28 15:17:40 -04:00
Bartek Iwańczuk 6ee00e4da3
refactor: change InspectOptions, make Deno.inspect stable (#4967) 2020-04-28 20:11:50 +02:00
Nayeem Rahman 678313b176
BREAKING: Remove Deno.EOF, use null instead (#4953) 2020-04-28 12:40:43 -04:00
Ali Hasani 47c2f034e9
BREAKING: address renamed to path in UnixAddr UnixConnectOptions UnixListenOptions (#4959) 2020-04-28 12:37:59 -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
Bartek Iwańczuk f7ab19b1b7
mark Deno.startTls as unstable (#4965) 2020-04-28 18:01:13 +02:00
Nayeem Rahman 76ee6fb335
refactor(cli/js/permissions): Split read and write permission descriptors (#4774) 2020-04-28 16:43:58 +02:00
Marcos Casagrande 927a771fa4
url: Make zero a valid port (#4963) 2020-04-28 10:40:17 -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
Chris Knight b980b26d85
doc: remove unstable API marker form Deno.Metrics and Deno.RunOptions (#4949) 2020-04-28 12:35:43 +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
Bartek Iwańczuk b508e84567
refactor: remove combined io interface like ReadCloser (#4944)
This commit removes "combined" interfaces from cli/js/io.ts; in the
like of "ReadCloser", "WriteCloser" in favor of using intersections
of concrete interfaces.
2020-04-28 12:32:43 +02:00
Bartek Iwańczuk dea3ca39ba
refactor: rename SeekMode variants to camelCase and stabilize (#4946) 2020-04-28 12:30:59 +02:00
Luca Casonato 30dc9bb748
Make shutdown unstable and async (#4940) 2020-04-28 01:36:47 -04:00
Divya de751e5221
fix(#4769) Adds readTextFile, writeTextFile, with sync counterparts (#4901) 2020-04-28 01:35:20 -04:00
Marcos Casagrande 2fc5878668
Change URL.port implementation to match WHATWG specifications (#4954)
Changed `URL.port` implementation to match [WHATWG
specifications](https://url.spec.whatwg.org/#port-state).

This PR matches the behaviour of other browsers:

1.  a `TypeError` must be thrown when passing an URL with an invalid
port to the constructor.

2. When setting an invalid port, using property setter, I haven't found
what should happen in this case, so I mimic **Firefox** & **Node**
behaviour. If an invalid port is set, it will use the previous value.
**Chrome** sets the value to `'0'` if an invalid port is set. I prefer
to keep the previous valid value.  (I can use Chrome's behaviour if you
think it's better, it's a simple value change)

```
url.port = '3000'; // valid
url.port = 'deno'; // invalid
assertEquals(url.port, '3000');
```

3. If the port value equals the current protocol default port value,
`port` will be an empty string.
2020-04-28 01:23:06 -04:00
Luca Casonato 15099cc016
Make Deno.kill unstable (#4950) 2020-04-27 23:36:43 -04:00
Ali Hasani 22b1a302f4
make utime unstable (#4955) 2020-04-27 21:14:47 -04:00
Bartek Iwańczuk 76641eb05e
refactor: remove stdio interfaces, use intersection types (#4952) 2020-04-28 02:01:00 +02:00
Luca Casonato e6f70c77ee
Make import maps unstable (#4934) 2020-04-28 01:12:38 +02:00
Nayeem Rahman 4041a7b857
BREAKING: Remove Deno.symbols namespace (#4936) 2020-04-28 01:06:03 +02:00
Chris Knight 2f0641885c
docs: document default value of sanitizeOps and sanitizeResources (#4943) 2020-04-28 00:56:22 +02:00
Ryan Dahl f2d5e6f58a
loadavg and osRelease made unstable (#4938) 2020-04-27 18:00:19 -04:00
Luca Casonato 95a08857f1
Make unix sockets require allow-write (#4939) 2020-04-27 16:56:24 -04:00
Brayden a1974cbe43
Mark Deno.umask unstable (#4935) 2020-04-27 16:07:57 -04: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
uki00a d440495b6b
fix(console): don't throw RangeError when an invalid date is passed (#4929) 2020-04-27 13:39:39 -04:00
Ryan Dahl 62976a1c94
signal APIs should require --unstable (#4926) 2020-04-27 13:38:23 -04:00
Bartek Iwańczuk 7a94ea08e9
fix(core): fix top-level-await error handling (#4911) 2020-04-27 17:25:26 +02:00
Ryan Dahl dd0b25e313
Make Deno.setRaw and Deno.isatty unstable (#4925) 2020-04-27 10:54:55 -04:00
Ryan Dahl 3e9b0da346
Make Deno.dir unstable (#4924) 2020-04-27 16:53:56 +02:00
Ryan Dahl 4036be2ab2
Make runtime compile ops unstable (#4912) 2020-04-27 09:59:34 -04:00