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

1352 commits

Author SHA1 Message Date
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
Bartek Iwańczuk
1f52d180c0
refactor: factor out AstParser from DocParser (#4923) 2020-04-27 15:46:39 +02:00
Bartek Iwańczuk
8e9ab9e33e
refactor: decouple Console implementation from stdout (#4899)
When creating a console instance, one must pass "printFunc" arg
which is used internally by Console to output messages.

Due to numerous refactors there was a single method ("console.clear()")
that used "Deno.stdout" instead of "printFunc".

This commit unifies how "Console" outpus message, by using 
"printFunc" in all methods; consequently "Deno.stdout" is no longer
imported in "cli/js/console.ts" making it a standalone module that doesn't
depend on any CLI-specific APIs.
2020-04-27 15:40:47 +02:00
Bartek Iwańczuk
8e4333fd99
BREAKING: remove Deno.runTests() API (#4922)
Deno.runTests() interface is not yet good enough to be exposed
publicly with stability guarantees.

This commit removes public API related to testing: Deno.runTests()
and Deno.TestMessage, but keeps them exposed on Deno.internal object
so they can be used with "deno test" subcommand.
2020-04-27 14:51:22 +02:00
Ali Hasani
fe5b151755
feat(test): add quiet flag (#4894) 2020-04-27 13:05:26 +02:00
Marcos Casagrande
26dfd3c110
Add buffer size argument to copy (#4907) 2020-04-26 16:25:24 -04:00
Thiago Veronezi
fe6a670454
the scheme bits of an uri is case-insensitive; https://tools.ietf.org/html/rfc3986#section-3.1 (#4909) 2020-04-26 11:04:02 -04:00
Bartek Iwańczuk
62150dd328
BREAKING CHANGE: change return type of Deno.resources() (#4893) 2020-04-25 22:02:15 +02:00
Nayeem Rahman
b33685e94b
fix(cli/js/symbols): Update symbol descriptions (#4878)
Don't use Symbol.for() to define Deno.symbols.customInspect.
2020-04-25 10:53:26 -04:00
Ryan Dahl
0c47cd6785
introduce unstable flag, make a few things unstable (#4892) 2020-04-25 09:31:54 -04:00
Ryan Dahl
f8d83361cd
chdir should require --allow-write (#4889) 2020-04-24 19:55:33 -04:00
Bartek Iwańczuk
1378df3364
remove bootstrap methods from global scope after bootstrapping (#4869) 2020-04-25 01:03:45 +02:00
Bartek Iwańczuk
912a57f6a2
change type of stdio handles in JS api (#4891) 2020-04-25 01:01:25 +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
833539fcaf
add help messages to Deno.test() sanitizers (#4887) 2020-04-25 00:07:25 +02:00
Bartek Iwańczuk
e9fa6b87ce
stabilize Deno.iter() and Deno.iterSync() (#4890) 2020-04-25 00:05:48 +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
Ryan Dahl
0da042c6fe
fix clippy (#4875) 2020-04-24 11:14:18 +02:00
David Sherret
f952d69eec
Parallelized deno fmt (#4823) 2020-04-23 19:01:15 -04:00
Bartek Iwańczuk
da6d0c2760
upgrade: Rust 1.43.0 (#4871) 2020-04-23 14:12:44 -04:00
Fenzland
cb935a375c
fix(#2142) make URLSearchParams more standardized (#4695) 2020-04-23 10:30:32 -04:00
Nayeem Rahman
65bba2b87e
refactor(cli/js/testing): Rename disableOpSanitizer to sanitizeOps (#4854)
* rename disableOpSanitizer to sanitizeOps
* rename disableResourceSanitizer to sanitizeResources
2020-04-23 14:40:16 +02:00
Ryan Dahl
d8711155ca
Rename deno_core::Isolate to deno_core::CoreIsolate (#4851) 2020-04-23 11:51:07 +02:00
Bert Belder
10a174834e
Upgrade to rusty_v8 v0.4.0 (#4856) 2020-04-23 03:35:52 +02:00
David Sherret
c43aaa3996
upgrade: dprint 0.13.1 (#4853)
* Allows union and intersection types to have same multi-line behaviour as arguments (more like prettier).
* Stops line breaks before `extends` in conditional type, which would have been a parser error.
* Check for `// dprint-ignore-file` comment before parsing. This allow files that panic in swc to be ignored.
* Fixes a bug in "multi-line" detection.
2020-04-22 19:20:38 -04:00
Bartek Iwańczuk
197a589a4a
fix Deno.iterSync() examples (#4855) 2020-04-22 18:36:04 -04:00
Ryan Dahl
e26c2cd7c8
Add comments in Reader/SyncReader about iter/iterSync (#4852) 2020-04-22 22:00:48 +02: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
Ryan Dahl
da6819a14c
Add comment distinguishing Deno.Buffer from Node's Buffer (#4847) 2020-04-22 14:26:16 -04:00
张超杰
08936c2efc
chore(docs): A space should be left after the single-line comment (#4811) 2020-04-22 10:21:05 -04:00
Kitson Kelly
8bcfc03d71
Rewrite streams (#4842) 2020-04-22 10:06:51 -04:00
张超杰
b270d6c8d0
typo 2020-04-21 16:11:52 -04:00
Ryan Dahl
cc1720132a
Move resource_table from deno::State to deno_core::Isolate (#4834) 2020-04-21 09:48:44 -04:00
Nayeem Rahman
ef6ee25e09
refactor(cli/fmt_errors): Improve source line formatting (#4832) 2020-04-20 15:39:02 -04:00
Ryan Dahl
6e5f3453f8
Remove core/plugin.rs (#4824)
This simplifies the plugin interface in order to deliver op crates with a similar API
2020-04-20 10:27:15 -04:00
Ryan Dahl
c1ec042a00
Modify op dispatcher to include &mut Isolate argument (#4821)
- Removes unnecessary RwLock and Rc around the op registry table
- Preparation to move resource_table to deno_core::Isolate.
- Towards #3453, #4222
2020-04-19 23:54:46 -04:00
Nayeem Rahman
4e3532fe7b
fix(core/js_errors): Get error's name and message from JS fields (#4808) 2020-04-19 15:17:22 +02:00
David Sherret
5292d24e6f
upgrade: dprint 0.13.0 (#4816) 2020-04-19 13:26:17 +02:00
Ryan Dahl
4d2b9cd37a
Fix Op definitions (#4814) 2020-04-18 20:05:13 -04:00
迷渡
ade05f3c00
fix(doc): Group ID (#4803) 2020-04-18 11:25:35 -04:00
EnokMan
47617e60d5
feat: startTLS (#4773) 2020-04-18 11:21:20 -04:00
Bartek Iwańczuk
10469ec279
store debugger url on DenoInspector (#4793) 2020-04-18 12:51:51 +02:00
迷渡
9d53a7a523
fix(doc): FileInfo.created is creation time (#4799) 2020-04-18 00:05:33 -04:00
Bartek Iwańczuk
41f836dc91
replace block_on in net interfaces (#4796) 2020-04-17 18:45:34 +02:00
Gudmund Vatn
260084ccbf
Add close method to Plugin (#4670) (#4785) 2020-04-17 12:51:10 +02:00
Nayeem Rahman
5bfe3eb8f4
feat(cli/installer.rs): Add DENO_INSTALL_ROOT (#4787) 2020-04-16 18:15:42 -04:00
Bartek Iwańczuk
d359789c52
feat: support Deno namespace in Worker API (#4784) 2020-04-16 23:40:29 +02:00
Bartek Iwańczuk
00fa4858b0
v0.41.0 2020-04-16 10:47:12 -04:00
Bartek Iwańczuk
0c48470b35
remove more calls to futures::executor::block_on (#4775) 2020-04-16 16:29:28 +02:00
trgwii
42c421f49d
Add @ for cleaner Batch files on Windows (#4764) 2020-04-16 01:42:09 -04:00
Nayeem Rahman
5ac728a5f1
refactor(cli/js/ops/fs): Improve readdir() and FileInfo interfaces (#4763) 2020-04-16 01:40:30 -04:00
Bartek Iwańczuk
aab26d226e
remove calls to futures::executor::block_on (#4760) 2020-04-15 23:14:28 -04:00
Ryan Dahl
fab0204cbf
Make writeSync, readSync, seekSync, openSync, isatty proper synchronous syscalls (#4762) 2020-04-15 20:43:19 -04:00
Kitson Kelly
cb64cf3ce2
Add support for AbortController/AbortSignal (#4757) 2020-04-15 10:10:49 -04:00
Nayeem Rahman
95eb6d780c
fix(cli/js/net): Make generator return types iterable (#4661) 2020-04-15 12:44:09 +02:00
Ryan Dahl
263dc8f5fe
Revert "test(inspector): add coverage test case (#4725)" (#4754)
Flaky and doesn't implement any features.

This reverts commit a7a3a771a0.
2020-04-15 11:26:31 +02:00
Bartek Iwańczuk
a7a3a771a0
test(inspector): add coverage test case (#4725) 2020-04-14 20:09:50 +02:00
Bartek Iwańczuk
e08ece2d2c
fix(worker): make worker name spec compliant (#4746) 2020-04-14 17:41:06 +02:00
Ryan Dahl
cb5dd69dda
upgrade: rust crates (#4742) 2020-04-14 09:31:29 -04:00
Ryan Dahl
ff60b31129
dedup various type definitions (#4741)
FormData FilePropertyBag DomFile BlobPropertyBag RequestCache 
RequestCredentials RequestDestination RequestMode RequestRedirect 
ResponseType
2020-04-14 09:23:07 -04:00
Ryan Dahl
360c05ffe7
dedup Headers types (#4736) 2020-04-13 22:46:23 -04:00
Luca Casonato
c915e4d77d
fix(doc): Added extends field to interface (#4739) 2020-04-14 00:28:49 +02:00
Luca Casonato
a9923f3f93
fix(doc): expose optionality in function params and class members (#4738) 2020-04-14 00:07:06 +02:00
Bartek Iwańczuk
2585b72c9b
feat: implement EventTarget for worker scope (#4737) 2020-04-13 22:18:31 +02:00
crowlKats
25bd6868e5
feat(worker): add MessageEvent, ErrorEvent and handling to Worker API (#4391)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-04-13 18:34:32 +02:00
Nayeem Rahman
0ea6eb83a9
refactor(core/js_error): Align JSStackFrame with CallSite (#4715)
Renames and adds missing fields to JSStackFrame from CallSite. Fixes #4705.

Cleans up base changes for line and column numbers.
2020-04-13 10:54:16 -04:00
Bartek Iwańczuk
5105c68399
workers: update postMessage and location types (#4734) 2020-04-13 16:48:12 +02:00
Khải
ef76389e42
Convert ProcessStatus to a tagged union (#4732) 2020-04-13 10:46:34 -04:00
迷渡
3a5dae4303
docs: highlight NO_COLOR (#4723) 2020-04-11 23:12:42 -04:00
Ryan Dahl
637a9ecd6a
dedup URLSearchParams, URL, Location, DOMStringList (#4719) 2020-04-11 17:19:36 -04:00
Ryan Dahl
da28fc1e7b
dedup type declarations (#4718)
Blob, BlobPart, BufferSource, ReferrerPolicy, BlobPart, AbortSignal, AbortSignalEventMap
2020-04-11 16:25:31 -04:00
David Yamnitsky
0641ad0d9b
deno install should also accept log level flags for installed script (#4714) 2020-04-11 11:47:27 -04:00
Kitson Kelly
fc4819e1e0
refactor: Event and EventTarget implementations (#4707)
Refactors Event and EventTarget so that they better encapsulate their
non-public data as well as are more forward compatible with things like
DOM Nodes.

Moves `dom_types.ts` -> `dom_types.d.ts` which was always the intention,
it was a legacy of when we used to build the types from the code and the
limitations of the compiler.  There was a lot of cruft in `dom_types`
which shouldn't have been there, and mis-alignment to the DOM standards.
This generally has been eliminated, though we still have some minor
differences from the DOM (like the removal of some deprecated
methods/properties).

Adds `DOMException`.  Strictly it shouldn't inherit from `Error`, but
most browsers provide a stack trace when one is thrown, so the behaviour
in Deno actually better matches the browser.

`Event` still doesn't log to console like it does in the browser.  I
 wanted to get this raised and that could be an enhancement later on (it
 currently doesn't either).
2020-04-11 11:42:02 -04:00
Nayeem Rahman
2b362bef85
refactor(cli/fmt_errors): Format stack frames in prepareStackTrace() (#4706) 2020-04-11 02:08:11 -04:00
gewoonwoutje
2feb661b85
Replace panic with invalid_utf8 OpError (#4704)
Co-authored-by: Wout Elstgeest <w.elstgeest@inepro.com>
2020-04-10 22:14:16 -04:00
Ryan Dahl
2af9f5f2cf
Remove __domTypes namespace (#4698) 2020-04-10 14:24:42 -04:00
Nayeem Rahman
8b4508338b
fix(core/js_error): Get frame data from prepareStackTrace() (#4690)
Fixes: #2703
Fixes: #2710
Closes: #4153
Closes: #4232

Co-authored-by: Kevin (Kun) Kassimo Qian <kevinkassimo@gmail.com>
2020-04-10 18:26:52 +02: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
Bartek Iwańczuk
be71885628
implement Worker.terminate() and self.close() (#4684) 2020-04-10 00:15:17 +02:00
Chris Knight
2becae884e
BREAKING: Remove deprecated mkdir, mkdirSync APIs (#4615) 2020-04-09 11:15:56 -04:00
Nayeem Rahman
71ac552249
feat(cli/doc): Support doc for runtime built-ins (#4635) 2020-04-09 14:34:24 +02:00
Ryan Dahl
198a045dbe
Remove __event, __eventTarget, __customEvent namespaces (#4683) 2020-04-09 12:03:44 +02:00
Ryan Dahl
0cf4ac91e6
v0.40.0 2020-04-08 14:59:06 -04:00
Ryan Dahl
b7e673ba93
upgrade: rust crates (#4679) 2020-04-08 14:29:42 -04:00
Ryan Dahl
dd2d19b22d
Remove __blob and __console namespaces (#4677) 2020-04-08 13:21:04 -04:00
Bartek Iwańczuk
491b8e1cea
feat(doc): handle function params and type params (#4672) 2020-04-08 17:03:42 +02:00
Ryan Dahl
fe17496831
Remove extra copy of URLSearchParams (#4675) 2020-04-08 10:32:08 -04:00
Ryan Dahl
efff39a3ac
Remove panic catch around dprint calls (#4676)
dprint seems to be stable enough to not panic on our own source code
now.
2020-04-08 10:31:48 -04:00
Ryan Dahl
b4836be57e
Remove __io namespace (#4669) 2020-04-08 01:30:51 +02:00
Ryan Dahl
f07fcfcc80
Remove __url namespace (#4668) 2020-04-07 17:11:38 -04:00
Ryan Dahl
6660fb25c9
Remove __workers namespace (#4665) 2020-04-07 15:03:14 -04:00
Bartek Iwańczuk
86fd0c66a6
feat(doc): handle basic reexports (#4625) 2020-04-07 19:47:06 +02:00
Ryan Dahl
51f5276e8c
Remove __textEncoding and __performanceUtil namespaces (#4663) 2020-04-07 13:27:37 -04:00
Akshat Agarwal
caff550b6c
BREAKING: Rename 'deno fetch' subcommand to 'deno cache' (#4656) 2020-04-07 11:24:47 -04:00
Ryan Dahl
62726430be
Remove __timers namespace (#4662) 2020-04-07 11:12:31 -04:00
Bartek Iwańczuk
dd3a94933a
feat: add --importmap flag to deno bundle (#4651) 2020-04-07 12:32:09 +02:00
Giorgi Rostomashvili
f82b9ba329
fix: fetch reference types for JS files (#4652)
Fixes #4000 and fixes #4476. Now always tries to fetch reference types
for JS files. Does not throw if it fails, since Typescript compiler will
complain if the file is not there(it will try to fetch it again first)
and people who just use JS should not be bothered by this error.

Not sure about my test, it passes and catches the bug but maybe there is
a better way to express it.
2020-04-06 16:52:25 -04:00
Yusuke Sakurai
b9e5e4c7ec
fix: test_create_cache_if_dir_not_exit (#4636)
This test doesn't remove created directory after test. It will fail on next run.
2020-04-06 10:08:53 -04:00
Ondřej Žára
0ea9562933
docs: add README to cli/js/web/ (#4578) 2020-04-06 13:06:11 +02:00
crowlKats
6720a0dc02
feat: Add File support in FormData (#4632) 2020-04-05 15:49:04 -04:00
Andres Villegas
2911fcc78d
Enable inspector tests (#4628) 2020-04-04 14:46:09 -04:00
Lorran Rosa
b017409dcd
on init create disk_cache directory if it doesn't already exists (#4617) 2020-04-03 22:43:49 -04:00
Kitson Kelly
f527407287
clippy (#4618) 2020-04-03 22:41:16 -04:00
Parker Gabel
0db04d6a42
fix(#4546) Added Math.trunc to toSecondsFromEpoch to conform the result to u64 (#4575) 2020-04-03 15:20:40 -04:00
Yusuke Sakurai
2426174485
feat: Expose ReadableStream and make Blob more standardized (#4581)
Co-authored-by: crowlkats <crowlkats@gmail.com>
2020-04-03 14:55:23 -04:00
Ryan Dahl
cb0acfe305
v0.39.0 2020-04-03 14:38:56 -04:00
dubiousjim
6f9c78979d
Properly handle invalid utf8 in paths (#4609) 2020-04-03 13:47:57 -04:00
dubiousjim
c5c3abc517
adjust docs for Deno.seek (#4610) 2020-04-03 13:45:44 -04:00
Bert Belder
c0cb198114
Make inspector more robust, add --inspect-brk support (#4552) 2020-04-03 13:40:11 -04:00
Bartek Iwańczuk
3f489ae1ae
fix: async ops sanitizer false positives in timers (#4602) 2020-04-03 19:20:36 +02:00
Bartek Iwańczuk
efb022a50c
upgrade dprint to 0.9.10 (#4601) 2020-04-03 18:35:03 +02:00
Bartek Iwańczuk
e99374a0a3
make Worker.poll private (#4603) 2020-04-03 18:01:45 +02:00
dubiousjim
ce02167c75
Improve tests and docs for Deno.rename (#4597) 2020-04-03 11:00:16 -04:00
Ondřej Žára
6204555be3
"deno doc" parses the "implements" clause of a class def (#4604) 2020-04-03 14:11:50 +02:00
Ondřej Žára
b57d075c07
deno doc parses super-class names (#4595)
Co-Authored-By: Luca Casonato <luca.casonato@antipy.com>
2020-04-03 10:32:46 +02:00
dubiousjim
7a9273d9cf
Refactor and expand mkdir tests (#4579) 2020-04-02 14:54:33 -04:00
Ryan Dahl
c738797944
feat: deno test --filter (#4570) 2020-04-02 09:26:40 -04:00
Luca Casonato
3d56f3afca
Added 'declare' handling to 'deno doc' (#4573) 2020-04-02 11:38:13 +02:00
Kitson Kelly
2e24385c48
Support dynamic import in bundles. (#4561) 2020-04-01 23:14:30 -04:00
Marcus Weiner
2ff8012dcc
Expose global state publicly (#4572) 2020-04-01 19:41:32 -04:00
Chris Knight
1c30d755bf
better parameter names for a couple functions (#4559) 2020-04-01 12:57:33 -04:00
木杉
6291ac82ee
fix(#4554): use --inspect in repl & eval (#4562) 2020-04-01 09:35:34 -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
Chris Knight
857d96001d
doc: Improve API documentation and add examples (#4548) 2020-03-31 23:21:37 -04:00
crowlKats
7b675a332c
fix: invalid blob type (#4536) 2020-03-31 14:42:18 -04:00
dubiousjim
d4d0b5d90c
Properly track isFile, isSymlink, isDirectory (#4541)
* Properly track isFile, isSymlink, isDirectory

These don't exhaust all the possibilities, so none of them should be
defined as "neither of the others".

* empty
2020-03-31 13:46:25 -04:00
dubiousjim
bdcb926b37
Fix umask test (#4533) 2020-03-30 19:02:02 -04:00
Michał Sabiniarz
30fdf6dc83
console: print promise details (#4524) 2020-03-30 19:01:19 -04:00
Michał Sabiniarz
4b71ac550e
console: iterable printing improvements (#4472)
1. Array elements are now grouped the same as in Node.js
2. Limit to 100 (Node.js default) elements to display in iterable
3. Print each element in new line if excessing max line length (same as in Node.js)
4. Print length of the TypedArray
5. Print information about empty items in Array
2020-03-30 13:45:37 -04:00
Luca Casonato
d795d34362
fix(doc): Safely deal with optional type (#4526) 2020-03-29 22:41:27 -04:00
Chris Knight
e88dcdc5e1
API doc improvments (#4525) 2020-03-29 21:39:10 -04:00
Ryan Dahl
6ae47449ec
Ignore flaky test cafile_info (#4517)
Ref #4512
2020-03-28 22:51:30 +01:00
Kevin (Kun) "Kassimo" Qian
2f7842246e
fix(inspector): proper error message on port collision (#4514) 2020-03-28 17:42:29 -04:00
Luca Casonato
ad198b1cf1
feat: Added colors to doc output (#4518) 2020-03-28 17:35:31 -04:00
Ryan Dahl
d6cb3892d4
v0.38.0 2020-03-28 15:26:58 -04:00
Bartek Iwańczuk
3fac487461
feat: Add "deno doc" subcommand (#4500) 2020-03-28 14:16:57 -04:00
Kitson Kelly
bced52505f
Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
Kitson Kelly
1397b8e0e7
upgrade: dprint 0.9.6 (#4509) 2020-03-28 10:04:18 -04:00
Ryan Dahl
2874664e91
feat: Support Inspector / Chrome Devtools (#4484)
This is a first pass implementation which is still missing several important
features:
- support for --inspect-brk (#4503)
- support for source maps (#4501)
- support for piping console.log to devtools console (#4502)

Co-authored-by: Bert Belder <bertbelder@gmail.com>
Co-authored-by: Matt Harrison <mt.harrison86@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-03-27 16:09:51 -04:00
Chris Knight
8bcdb422e3
Improve isatty and kill API docs; Deno.kill() - throw on Windows (#4497) 2020-03-26 15:52:47 -04:00
Chris Knight
a053462566
refactor: rename ConsoleOptions to InspectOptions (#4493) 2020-03-25 20:48:47 -04:00
Ryan Dahl
fd432e2346
upgrade: dprint 0.9.5 (#4491) 2020-03-25 17:24:26 -04:00
Kevin (Kun) "Kassimo" Qian
5d7bcf86fd
feat: window.close() (#4474) 2020-03-24 23:56:40 -04:00
Kevin (Kun) "Kassimo" Qian
3938071e91
errors: replace .lines with explicit .split newline (#4483) 2020-03-24 23:55:54 -04:00
Chris Knight
eeedb416c0
doc: improve various API docs and include examples (#4486) 2020-03-24 23:54:41 -04:00
Kevin (Kun) "Kassimo" Qian
3d228f5f9e
hide source line if error message longer than 150 chars (#4487) 2020-03-24 23:53:48 -04:00
Kevin (Kun) "Kassimo" Qian
addfdc4cd0
fix: add fsEvent notify::Error casts (#4488) 2020-03-24 23:50:51 -04:00
Yusuke Sakurai
07fc95acee
feat: add queueMicrotask to d.ts (#4477) 2020-03-24 13:39:41 -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
Michał Sabiniarz
2e5e5fe393
console: replace object abbreviation with line breaking (#4425) 2020-03-24 00:57:05 -04:00
Kevin (Kun) "Kassimo" Qian
c61a231ff4
remove extra dot in Permission request output (#4471) 2020-03-24 00:54:17 -04:00
João Souto
70a5034431
feat: Support Unix Domain Sockets (#4176) 2020-03-23 18:02:51 -04:00
Ryan Dahl
b924e5ab7e
v0.37.1 2020-03-23 17:14:34 -04:00
Ryan Dahl
d143fe61bc
v0.37.0 2020-03-23 12:28:27 -04:00
bartOssh
ec07386067
feat: first pass at "deno upgrade" (#4328) 2020-03-23 11:37:24 -04:00
Chris Knight
a0ba476fee
doc: API improvements to chown, close, compile and connect (#4463) 2020-03-23 00:03:45 -04:00
Ryan Dahl
12ff78ed4c
Remove @url comments from d.ts files (#4449)
These have no function and are not tested, probably incorrect in many
situations.
2020-03-21 17:58:31 -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
dubiousjim
77a44163fb
chmod should throw on Windows (#4446) 2020-03-20 16:03:04 -04:00
dubiousjim
1c6f177d19
use prebuilt "not implemented" error (#4442) 2020-03-20 12:10:02 -04:00
dubiousjim
69303e2149
refactor: move code from fs.rs into ops/fs.rs (#4428)
This a complex boring PR that shifts around code (primarily) in cli/fs.rs and
cli/ops/fs.rs. The gain of this refactoring is to ease the way for #4188 and
#4017, and also to avoid some future development pain.

Mostly there is no change in functionality. Except:
* squashed bugs where op_utime and op_chown weren't using `resolve_from_cwd`
* eliminated the use of the external `remove_dir_all` crate.
* op_chmod now only queries metadata to verify file/dir exists on Windows (it
  will already fail on Unix if it doesn't)
* op_chown now verifies the file/dir's existence on Windows like chmod does.
2020-03-20 09:46:26 -04:00
Samrith Shankar
798904b0f2
Add require-await lint rule (#4401) 2020-03-20 09:38:34 -04:00
Ryan Dahl
a6d8098b35
Clean up installer tests (#4433) 2020-03-19 17:20:46 -04:00
Bartek Iwańczuk
87d2ba42bf
perf: Optimize TextEncoder and TextDecoder (#4430)
* add tests for "Deno.core.encode" and "Deno.core.decode" for empty inputs
* use "Deno.core.encode" in "TextEncoder"
* use "Deno.core.decode" in "TextDecoder"
* remove "core_decode" and "core_encode" benchmarks
2020-03-19 21:31:56 +01:00
Ryan Dahl
392d2c1118
Fix cafile_install_remote_module test (#4429) 2020-03-19 12:46:56 -04:00
Kevin (Kun) "Kassimo" Qian
2f3de4b425
Simplify timer with macrotask callback (#4385) 2020-03-19 10:45:28 -04: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
Bartek Iwańczuk
b0b27c4310
refactor: rename Deno.TestDefinition.skip to ignore (#4400) 2020-03-19 10:58:12 +01:00
Chris Knight
54d1f299dc
Chmod API documentation improvements (#4427) 2020-03-18 21:25:01 -04:00
Chris Knight
2a34cbfaf9
Improve API docs for Deno.bundle and Deno.chdir (#4426) 2020-03-18 19:40:06 -04: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
Bert Belder
070464e2cc
Fix unit test runner ConnectionReset bug (#4424)
Fixes: #4373
2020-03-18 12:13:01 -07:00
Kitson Kelly
da8cb408c8
Provide compiled JSON to TypeScript compiler. (#4404)
Fixes #4101

Previously, we would just provide the raw JSON to the TypeScript
compiler worker, but TypeScript does not transform JSON.  This caused
a problem when emitting a bundle, that the JSON would just be "inlined"
into the output, instead of being transformed into a module.

This fixes this problem by providing the compiled JSON to the TypeScript
compiler, so TypeScript just sees JSON as a "normal" TypeScript module.
2020-03-18 12:39:53 -04:00
Bert Belder
a2b2851582
Upgrade rust crates (#4412) 2020-03-17 17:42:22 -07:00
Bartek Iwańczuk
4a4894532e
try to handle ConnectionReset error in windows CI for unit tests (#4407) 2020-03-17 17:35:38 -04:00
crowlKats
9833975ef2
feat: fetch should accept a FormData body (#4363) 2020-03-17 02:32:43 -04:00
dubiousjim
f9557a4ff6
Add mode option to open/create (#4289) 2020-03-16 15:02:41 -04:00
Gurwinder Singh
8077ade741
refactor: remove an unsafe and some boxing (#4398) 2020-03-16 10:46:31 -07:00
Bartek Iwańczuk
0d14a7bd53
try to fix unit test runner on Windows (#4395)
This PR attempts to fix intermittent errors occurring on Windows for "cli/tests/unit_test_runner.ts." Runner has been reworked to create only single TCP listener instead of one listener per worker.
Additionally worker doesn't close TCP socket - it waits for parent process to close the socket and only then exits.
2020-03-16 16:50:58 +01:00
Bartek Iwańczuk
7d0b77440e
fix: fetch closes unused body (#4393)
This commit makes sure that "httpBody" resource is closed in case of redirections in fetch API.
2020-03-16 15:32:29 +01:00
Kevin (Kun) "Kassimo" Qian
49541a04d2
console: Symbol.toStringTag and display Object symbol entries (#4388) 2020-03-16 09:05:39 -04:00
Bartek Iwańczuk
1edb20b399
refactor: add no-return-await lint rule (#4384) 2020-03-16 10:22:16 +01:00
Bartek Iwańczuk
70434b5bfb
refactor: change test reporter output (#4371)
This commit changes output of default test reporter to resemble output from Rust test runner;
first the name of running test is printed with "...", then after test has run result is printed on the same line.

* Split "Deno.TestEvent.Result" into "TestStart" and "TestEnd";
* changes TestReporter interface to support both events; 

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-15 17:58:59 +01:00
Bartek Iwańczuk
dc6e0c3591
feat: Deno.core.{encode,decode}; standalone UTF-8 encoding/decoding (#4349)
This commits add two new methods to "Deno.core" namespace: "encode" and "decode".

Those methods are bound in Rust to provide a) fast b) generally available of encoding and decoding UTF-8 strings. 

Both methods are now used in "cli/js/dispatch_json.ts".
2020-03-15 15:31:55 +01:00
Kitson Kelly
2f4be6e944
Remove Object.prototype.__proto__ (#4341) 2020-03-15 11:34:22 +01:00
Nayeem Rahman
64a35acd64
feat(cli/js/testing): Add TestDefinition::skip (#4351) 2020-03-15 10:34:24 +01:00
dubiousjim
6cc40b0865
BREAKING CHANGE FileInfo.len renamed to FileName.size (#4338) 2020-03-14 22:57:42 -04:00
Bartek Iwańczuk
bf51f7b2ec
replace source-mappings-map with rust-sourcemap (#4368) 2020-03-14 22:10:23 +01:00
Kitson Kelly
ba687125e7
Add support for jsx/tsx for deno test (#4369) 2020-03-14 13:23:53 +01:00
Bartek Iwańczuk
d6bbbdda75
Update CLI for unit_test_runner.ts (#4352)
* drop server guard before unit test result check

To prevent cascading test failures when js_unit_test http server
guard is dropped before asserting that tests were successful.
This is really a band-aid and doesn't solve underlying issue with
http server.

* Update CLI for unit_test_runner.ts

* Change cli/js/tests/unit_test_runner.ts command line interface to work in 3
  modes:
  - "one-off" - run tests that match permissions of currently running
    process
  - "master" - run tests for all possible permission combinations, by
   spawning subprocesses running in "worker" mode and communicating via
   TCP socket; requires elevated permissions
  - "worker" - run tests for set of permissions provided by CLI arg;
  requires elevated permissions to setup TCP connection to "master";
  after initial setup process drops permissions to given set

* Support filtering of tests by string passed after "--" CLI arg

* Update cli/js/tests/README.md
2020-03-14 11:53:20 +01:00
Bartek Iwańczuk
aab1acaed1
refactor: unit test runner communicates using TCP socket (#4336)
Rewrites "cli/js/unit_test_runner.ts" to communicate with spawned subprocesses 
using TCP socket.

* Rewrite "Deno.runTests()" by factoring out testing logic to private "TestApi" 
  class. "TestApi" implements "AsyncIterator" that yields "TestEvent"s, 
  which is an interface for different types of event occuring during running
  tests.

* Add "reporter" argument to "Deno.runTests()" to allow users to provide custom
  reporting mechanism for tests. It's represented by "TestReporter" interface,
  that implements hook functions for each type of "TestEvent". If "reporter"
  is not provided then default console reporting is used (via 
  "ConsoleReporter").

* Change how "unit_test_runner" communicates with spawned suprocesses. Instead
  of parsing text data from child's stdout, a TCP socket is created and used
  for communication. "unit_test_runner" can run in either "master" or "worker"
  mode. Former is responsible for test discovery and establishing needed
  permission combinations; while latter (that is spawned by "master") executes
  tests that match given permission set.

* Use "SocketReporter" that implements "TestReporter" interface to send output
  of tests to "master" process. Data is sent as stringified JSON and then
  parsed by "master" as structured data. "master" applies it's own reporting 
  logic to output tests to console (by reusing default "ConsoleReporter").
2020-03-13 15:57:32 +01:00
crowlKats
e435c2be15
Remove doc strings from cli/js TS files (#4329)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-13 10:22:22 +01:00
Ryan Dahl
3ac642c183
upgrade: Rust 1.42.0 (#4331) 2020-03-12 18:07:57 +01:00
Ryan Dahl
63cee35691
Enable std tests in debug mode (#4332) 2020-03-12 17:12:20 +01:00
Ryan Dahl
3ed6ccc905
v0.36.0 2020-03-11 19:13:01 -04:00
João Souto
fb5c31416d
Add waker to StreamResource to fix hang on close bugs (#4293) 2020-03-11 18:19:24 -04:00
Bartek Iwańczuk
810e4a16be
reorg: Deno global initialization (#4317) 2020-03-11 21:57:24 +01:00
Bartek Iwańczuk
b8fa3fd5e7
move compiler API tests to integration tests (#4319) 2020-03-11 21:54:53 +01:00
dubiousjim
a28fa2415f
support permission mode in mkdir (#4286) 2020-03-11 16:14:23 -04:00
dubiousjim
72c408ea9d
Stricter permissions for Deno.makeTemp* (#4318) 2020-03-11 15:05:42 -04:00
Bartek Iwańczuk
2d1b39bef3
reorg: remove dispatch.ts, move signals, factor out web utils (#4316)
- moves signal definition from "cli/js/process.ts" to "cli/js/signals.ts"
- removes "cli/js/dispatch.ts"
- removes "cli/js/types.ts"
- moves web specific utilities to "cli/js/web/util.ts"
2020-03-11 15:49:53 +01:00
Bartek Iwańczuk
99a0c6df79
reorg: cli/js/compiler/, move more API to cli/js/web/ (#4310)
- moves compiler implementation to "cli/js/compiler/" directory
- moves more APIs to "cli/js/web":
    * "console.ts"
    * "console_table.ts"
    * "performance.ts"
    * "timers.ts"
    * "workers.ts"
- removes some dead code from "cli/js/"
2020-03-11 10:53:06 +01:00
Ryan Dahl
94f4c6807a
Improve dprint config (#4314) 2020-03-11 10:51:57 +01:00
Nayeem Rahman
ce14ef09d0
doc(cli/flags): Reduce empty lines in help messages (#4312) 2020-03-10 19:23: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
dubiousjim
8078d976d2
Add Deno.umask (#4290) 2020-03-10 15:11:27 -04:00
Nayeem Rahman
6443e4aed1
refactor: Cleanup options object parameters (#4296) 2020-03-10 12:08:58 -04:00
Bartek Iwańczuk
fbc4731256
refactor: uncomment tests broken tests, use skip (#4311)
* uncomment broken tests, use skip:
- net_test.ts 
- url_test.ts
- fetch_test.ts
2020-03-10 16:38:02 +01:00
Florian Häglsperger
62f4a2a788
Add global "quiet" flag (#4135) 2020-03-10 08:26:17 -04:00
Bartek Iwańczuk
dca00211ab
use Object instead of Map for promise table (#4309) 2020-03-09 22:04:49 -04:00
Bartek Iwańczuk
68119e1d7e
reorg: move js runtime tests to cli/js/tests/ (#4250)
All Deno runtime test files were moved to cli/js/tests/ directory.

It makes a clear distinction that cli/js/tests/ contains code
that is run under Deno runtime as opposed to code in cli/js/ which
is used to create bundle and snapshot with "deno_typescript".
2020-03-10 01:06:47 +01:00
Ryan Dahl
dad8036766
upgrade: dprint 0.8.0 (#4308) 2020-03-10 01:01:33 +01:00
Bartek Iwańczuk
b7eb241c35
reorg: move JS ops implementations to cli/js/ops/, part 3 (#4302)
Following JS ops were moved to separate files in cli/js/ops directory:
- net
- tls
- fs
2020-03-10 00:22:15 +01:00
Bartek Iwańczuk
886f330ec8
reorg: move JS ops implementations to cli/js/ops/, part 2 (#4283)
Following JS ops were moved to separate files in cli/js/ops directory:
- io
- process
- worker_host
- web_worker
- plugins
- timers
- signal
- permissions
2020-03-09 15:18:02 +01:00
Yusuke Sakurai
6f0b70eb1e
disable test_raw_tty (#4282) 2020-03-08 17:10:45 +01: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
dubiousjim
0dd131d4a5
Rename perm to mode (#4276)
There's a lot of variation in doc comments and internal code about
whether chmod/0o777-style permissions are called `mode` or `perm`. (For
example, mkdir and writeFile choose differently.)

Had proposed earlier to go consistently with `perm`, but on balance devs
prefer to go with `mode`.
2020-03-07 22:29:12 -05:00
Ryan Dahl
18076db8f0
upgrade rust dependencies (#4270) 2020-03-07 15:51:23 -05:00
Bartek Iwańczuk
88b77da25c
refactor: remove cli/ops/files.rs (#4246)
* "op_close" - moved to "cli/ops/resources.rs"
* "op_seek", "op_open" - moved to "cli/ops/fs.rs"

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-07 13:20:27 +01:00
Ryan Dahl
ec1946a95e
Improve run_and_collect_output (#4272)
* Fix flaky test test_permissions_net_listen_allow_localhost

* Improve error reporting for run_and_collect_output
2020-03-07 11:27:16 +01:00
Ryan Dahl
61f12ea775
Fix flaky test test_permissions_net_listen_allow_localhost (#4271) 2020-03-06 17:40:18 +01:00
Aurélien Bertron
5e31b96f9a
Add content type for wasm, fix encoding in wasm test fixture (#4269) 2020-03-06 11:31:22 -05:00
dubiousjim
acf0958e94
Rename name/filename arguments to path (#4227)
There's a lot of variation in doc comments and internal code about
whether the first parameter to file system calls is `path` or `name` or
`filename`. For consistency, have made it always be `path`.
2020-03-06 11:29:23 -05:00
João Souto
e81fb25b7a
Fix unwanted ANSI Reset Sequence (#4268) 2020-03-06 08:48:38 -05:00
dubiousjim
9a63902db5
Rename readDir -> readdir (#4225) 2020-03-06 08:34:02 -05:00
Ryan Dahl
afea9b2edd
fix: call unwatch when dropping FsEventsResource (#4266) 2020-03-05 20:01:08 -05:00
Bartek Iwańczuk
2e59007214 move Web APIs to cli/js/web/ 2020-03-05 18:48:55 +01:00
Bartek Iwańczuk
9b59ed7c79 fix event target tests 2020-03-05 11:09:04 -05:00
Ryan Dahl
c850b258b4
Support async function and EventListenerObject as listeners (#4240) 2020-03-05 08:36:13 -05:00
Ryan Dahl
54a1688868
Allow BadResource errors to take a custom message (#4251) 2020-03-05 08:30:41 -05:00
Bartek Iwańczuk
20dad3659c
refactor: preliminary cleanup of Deno.runTests() (#4237)
* refactor: preliminary cleanup of Deno.runTests()

* Change time measurement to use new Date() instead of
  performance.now(). Because there is no guarantee that tests are
  run with "--allow-hr" using new Date() guarantees higher
  precision of 1ms instead of 2ms.

* Support String type filter in "skip" and "only".

* Split "exitOnFail" into "exitOnFail" and "failFast".
  Former tells if "runTests()" should exit with code 1 on test
  failure, while latter tells if "runTests()" should stop
  running tests on first failure.

* Use "defer" to wait for unhandled promise rejection - this bit
  is funky and doesn't seem right, but for now it's just a rewrite
  from using "setTimeout". Intended to be fixed in later commits.

* Remove global "__DENO_TEST_REGISTRY", don't expose list of
  registered tests (to be addressed in follow up commits)

* Remove arbitrary slow test threshold; use uniform coloring
  instead
2020-03-05 11:52:18 +01:00
Bartek Iwańczuk
52b96fc22a
refactor: cleanup compiler runtimes (#4230)
- Cleanup "tsCompilerOnMessage" by factoring out separate methods for each 
  request type:
    * "compile"
    * "runtimeCompile"
    * "runtimeTranspile"
- Simplify control flow of compiler workers by a) no longer calling "close()" in worker runtime after a
single message; b) explicitly shutting down worker from host after a single message

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-03-05 11:13:10 +01:00
Bert Belder
5d3dfa4cf6
Remove unnecessary macro from cli/ops/tty.rs (#4254)
It contains a clippy issue, and there's no need for this macro anyway.
2020-03-04 15:54:09 -08:00
Ryan Dahl
a1b98e9e6a
Remove Deno.errors.Other (#4249) 2020-03-04 13:18:32 -05:00
Bartek Iwańczuk
8d96dffa41
refactor: rewrite testPerm into unitTest (#4231)
Rewrite "testPerm" helper function used for testing of internal 
runtime code. It's been renamed to "unitTest" and provides API that
is extensible in the future by accepting optional "UnitTestOptions" 
argument. "test" helper was also removed and replaced by
overloaded version of "unitTest" that takes only function argument.

"UnitTestOptions" currently supports "perms" and "skip"
options, where former works exactly as first argument to "testPerm"
did, while the latter allows to conditionally skip tests.
2020-03-04 17:31:14 +01:00
Kitson Kelly
30682cf74f
Migrate internal bundles to System (#4233) 2020-03-04 14:26:00 +01:00
yuta0801
5e7ca445ff
Fix deno install file name including extra dot on Windows (#4243) 2020-03-04 00:40:56 -08:00
Ryan Dahl
ce5a57667c
Disable flaky and broken tests (#4239) 2020-03-03 16:02:35 -05:00
Bartek Iwańczuk
ee452ad883
add assertOps sanitizer in cli/js/ unit tests (#4209)
* add "assertOps" test assertion which makes sure test case
  is not "leaking" ops - ie. after test finishes there are no 
  pending async ops

* apply "assertOps" to all tests in "cli/js/"

* fix numerous tests leaking ops

* document problem with edge case in "clearInterval"
   and "clearTimeout" implementation where they
   may leak async ops

* move "cli/js/worker_test.ts" to "cli/tests/worker_test.ts" and 
  run as integration test; workers leak ops because of missing
  "terminate" implementation
2020-03-03 18:22:53 +01:00
Yusuke Sakurai
4dc004f0a2
misc: reduce unnecesarry output in cli/js tests (#4182)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-03-03 15:51:07 +01:00
Bert Belder
eafd40feab
Do not convert exceptions to JSON and back (#4214) 2020-03-02 14:20:16 -08:00
Kitson Kelly
83d902a780
Fix JavaScript dependencies in bundles. (#4215)
Fixes #4602

We turned off `allowJs` by default, to keep the compiler from grabbing
a bunch of files that it wouldn't actually do anything useful with.  On
the other hand, this caused problems with bundles, where the compiler
needs to gather all the dependencies, including JavaScript ones.  This
fixes this so that when we are bundling, we analyse JavaScript imports
in the compiler.
2020-03-02 22:18:27 +01:00
dubiousjim
a3c3a56ff7
Rename Option -> Options (#4226)
* Rename MkdirOption interface to MkdirOptions

It was hard to remember which Options interfaces were spelled in the
singular and which in the plural (and anyway this one contained two
options).

Also added MkdirOptions to cli/js/deno.ts. All the analogous interfaces
were exported there.

* Rename RemoveOption interface to RemoveOptions

This was the last remaining Option interface spelled in the singular.
Easier to remember if they're all Option**s**; plus we may want to add extra
options here later.
2020-03-02 21:24:42 +01:00
Bartek Iwańczuk
ff5bba3be8
feat: update metrics to track different op types (#4221) 2020-03-02 19:13:36 +01:00
Bartek Iwańczuk
cfe4369ded
refactor: rename structures related to Modules (#4217)
* rename structures related to ES Modules; add "Modules" prefix
* remove unneeded Unpin trait requirement for "ModuleLoader"
2020-03-02 19:12:49 +01:00
bartOssh
4a47ffa5c4
seek should return cursor position (#4211) 2020-03-02 11:44:46 -05:00
dubiousjim
6cd46fa3ef
Cleanup comments and internal variables (#4205) 2020-03-02 10:19:42 -05:00
João Souto
809019dc6e
Port Complex Permissions Tests to Rust (#4200) 2020-03-01 19:51:54 -05:00
ecyrbe
2a594bd3b2
feat(std/node): add os.tmpdir() implementation (#4213) 2020-03-01 19:05:04 -05:00
Ryan Dahl
ad21210edd
perf: use subarray instead of slice in dispatch minimal (#4180) 2020-03-01 17:17:59 -05:00
Kevin (Kun) "Kassimo" Qian
c3661e9f07
Make internel error frames dimmer (#4201) 2020-03-01 16:17:44 -05:00
Chris Knight
b84f3efa14
docs: fix broken Deno.write() example (#4190) 2020-02-29 20:37:32 +01:00
Nayeem Rahman
1f9d158bdc
refactor(cli/js): Replace constructError() with getErrorClass() (#4189)
Flattens dispatch error handling to produce one less useless stack frame on op errors.
2020-02-29 19:04:10 +01:00
Bartek Iwańczuk
f55b22e195
add assertResources sanitizer to cli/js/ unit tests (#4161) 2020-02-29 18:45:47 +01:00
Ryan Dahl
a29343c7d6 v0.35.0 2020-02-28 23:49:49 -05:00
Bartek Iwańczuk
bdf95c7b72
Revert "perf: use subarray instead of slice in dispatch minimal (#4173)" (#4174)
This reverts commit 0eb91c5591.
2020-02-28 19:33:52 +01:00
Ryan Dahl
0099c28db3
http_cache: change .headers.json to .metadata.json (#4175)
Add original URL to metadata. This is so the VS Code Plugin can reverse
look up the URL for cache entries. Ref #4069.
2020-02-28 13:15:31 -05:00
Bartek Iwańczuk
0eb91c5591
perf: use subarray instead of slice in dispatch minimal (#4173) 2020-02-28 17:13:07 +01:00
Kitson Kelly
0a51611d76
Clean up lib.deno.ns.d.ts JSDoc (#4170) 2020-02-28 11:05:40 -05:00
Bartek Iwańczuk
a13b0e2727
rewrite permission revoke test as integration test (#4164) 2020-02-28 15:47:54 +01:00
Kevin (Kun) "Kassimo" Qian
7255cc9bc0
Support TypeScript eval through deno eval -T flag (#4141) 2020-02-28 09:17:56 -05:00
Kevin (Kun) "Kassimo" Qian
b5bf28e68f
fetch_cached_remote_source support redirect URL without base (#4099) 2020-02-28 09:04:18 -05:00
Bartek Iwańczuk
9b6a9b769e
Revert "chore: share HTTP server between tests (#3966)" (#4165)
This reverts commit e6167c7813.
2020-02-27 23:32:02 -08:00
Bert Belder
1cb1ab6c00
Merge mod_evaluate() and mod_evaluate_dyn_import() methods (#4167) 2020-02-27 16:30:18 -08:00
Ryan Dahl
973dbd1ba1
Return non-zero exit code on malformed stdin fmt (#4163) 2020-02-27 15:39:41 -05:00
Bartek Iwańczuk
fa5f3aa600
replace impl Future with poll_fn for net.rs, process.rs, tls.rs (#4158) 2020-02-27 21:08:21 +01:00
Kitson Kelly
1d26da6a47
feat: Support types compiler option in compiler APIs (#4155)
Handles `types` in the compiler APIs to make it easier to supply
external type libraries.
2020-02-27 11:27:00 -05:00
Bartek Iwańczuk
daf7617f42
rewrite normalize_path (#4143)
Rewrite "normalize_path()" to remove all intermediate components from the path, ie. "./" and "../". It's very similar in functionality to fs::canonicalize(), however "normalize_path() doesn't resolve symlinks.
2020-02-26 22:11:52 +01:00
Bartek Iwańczuk
7fff2d2d1e
remove Read/Write futures, use poll_fn instead (#4150) 2020-02-26 22:06:20 +01:00
Bartek Iwańczuk
9adcdabd65
stream output of js unit tests (#4146) 2020-02-26 20:33:18 +01:00
Kitson Kelly
671f0b83be
Bundles can be sync or async based on top level await (#4124)
Previously, bundles always utilised top level await, even if the bundled
modules didn't require top level await.  Now, analysis of the bundle is
done and if none of the bundled modules are asynchronously executed,
then the bundle as a whole will be synchronously executed.

Fixes #4055
Fixes #4123
2020-02-26 17:59:33 +01:00
Ryan Dahl
9a8d6fbd98
DenoFlags -> Flags (#4136) 2020-02-26 11:52:15 +01:00
Ryan Dahl
3eebef39c5
upgrade: dprint 0.7.0 (#4130)
* upgrade: dprint 0.7.0

Also make deno fmt less verbose (like cargo fmt)
2020-02-26 11:50:53 +01:00
Ryan Dahl
3d03d7e83b
Fix flaky tests (#4134) 2020-02-26 11:50:25 +01:00
Bartek Iwańczuk
0e37184ca8
add window.self read-only property (#4131) 2020-02-26 11:49:38 +01:00
Kevin (Kun) "Kassimo" Qian
5946808f66
tty: Deno.setRaw(rid, mode) to turn on/off raw mode (#3958) 2020-02-26 01:01:24 -05:00
João Souto
e53064c4f2
Port permission_prompt_tests to Rust (#4129) 2020-02-25 15:36:35 -05:00
Kitson Kelly
be787d09d5
upgrade: TypeScript 3.8 (#4100) 2020-02-25 15:33:19 -05:00
Ryan Dahl
f47f3f9672
Remove _async from method names since _sync are gone (#4128) 2020-02-25 20:42:00 +01:00
Nayeem Rahman
14e7e1e3af
fix: Resolve makeTemp* paths from CWD (#4104) 2020-02-25 09:23:23 -05:00
Ryan Dahl
91b606aaae
Clean up how we use opIds (#4118) 2020-02-25 09:14:27 -05:00
Kitson Kelly
805992b14a
Fix issues with JavaScript importing JavaScript. (#4120)
Fixes #3852
Fixes #4117
2020-02-25 03:32:43 -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
João Souto
ac933dd1b8
port tools/repl_test.py to Rust (#4096)
ref #2988
2020-02-24 17:49:40 -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
Ryan Dahl
f4fd433e1a
Add Deno.Err change missing from previous commit (#4113) 2020-02-24 16:36:12 -05:00
Bartek Iwańczuk
e1687c0a46
rename Deno.Err -> Deno.errors (#4093) 2020-02-24 15:48:35 -05:00
Kitson Kelly
2b7e28b591
feat: Add Deno.formatDiagnostics (#4032) 2020-02-24 14:48:14 -05:00
João Souto
c250778704
Remove ansi_term dependency (#4106) 2020-02-24 10:29:56 -05:00
Yoshiya Hinosawa
c080d7fba3
fix: add mutex guard for permission_prompt tests (#4105)
This PR introduces the mutex guard for the test cases which depends on the 
permission prompt mocking utility. permission_request test cases depend on 
the mocked (dummy) value of the permission_prompt result. The value is stored 
at static STUB_PROMPT_VALUE: AtomicBool and these test cases share this 
value. So we should lock at the start of these test cases.

Before this change cargo test permission failed 6 times out of 20. After this 
change, 0 times out of 20 (on my mac).
2020-02-24 09:13:03 -05:00
ecyrbe
fb08cf7005
Add missing node os.release() implementation (#4065) 2020-02-24 08:35:45 -05:00
Bartek Iwańczuk
4e1abb4f3a
refactor: use OpError instead of ErrBox for errors in ops (#4058)
To better reflect changes in error types in JS from #3662 this PR changes 
default error type used in ops from "ErrBox" to "OpError".

"OpError" is a type that can be sent over to JSON; it has all 
information needed to construct error in JavaScript. That
made "GetErrorKind" trait useless and so it was removed altogether.

To provide compatibility with previous use of "ErrBox" an implementation of
"From<ErrBox> for OpError" was added, however, it is an escape hatch and
ops implementors should strive to use "OpError" directly.
2020-02-23 14:51:29 -05:00
Kevin (Kun) "Kassimo" Qian
e9fff02e96
fetch: proper error for unsupported protocol (#4085) 2020-02-23 09:45:02 -05:00
Kevin (Kun) "Kassimo" Qian
bf48f5fa5a
Move WebAsssembly namespace to shared_globals (#4084) 2020-02-23 09:40:44 -05:00
EnokMan
14129b6c8f
feat: support brotli compression for fetch API (#4082) 2020-02-23 09:37:43 -05:00
ecyrbe
fb98556d56
feat(std/node): add os.loadavg() (#4075) 2020-02-22 18:46:52 -05:00
Bartek Iwańczuk
bd640bc7e6
feat: Deno.fsEvents() (#3452) 2020-02-21 13:21:51 -05:00
hazæ41
08686cbc3a
feat: support UDP sockets (#3946) 2020-02-21 11:26:54 -05:00
Bartek Iwańczuk
dd8a109481
refactor: remove unneeded ErrorKinds (#3936) 2020-02-21 10:36:13 -05:00
Bartek Iwańczuk
d9efb8c02a
fix: add io ops to worker to fix fetch (#4054) 2020-02-21 10:35:41 -05:00
木杉
6dd9643845
upgrade: dprint 0.6.1 (#4061) 2020-02-21 00:13:11 -05:00
Ryan Dahl
a0d3b4ebc5 v0.34.0 2020-02-20 10:57:42 -05:00
Kitson Kelly
6431622a6d
fix: mis-detecting imports on JavaScript when there is no checkJs (#4040)
This PR fixes an issue where we recursively analysed imports on plain JS files
in the compiler irrespective of "checkJs" being true. This caused problems
where when analysing the imports of those files, we would mistake some
import like structures (AMD/CommonJS) as dependencies and try to resolve
the "modules" even though the compiler would not actually look at those files.
2020-02-19 22:58:05 -05:00
Kitson Kelly
0e579ee9dc
fix: emit when bundle contains single module (#4042)
Fixes #4031

When a bundle contains a single module, we were incorrectly determining
the module name, resulting in a non-functional bundle.  This PR corrects
that determination.
2020-02-19 22:35:21 -05:00
Bartek Iwańczuk
742a16b506
refactor: rewrite file_fetcher to use async fns, lift blocking call (#4037) 2020-02-19 17:51:10 -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
Bartek Iwańczuk
852823fa50
refactor: rewrite HTTP cache for file fetcher (#4030) 2020-02-19 08:17:13 -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
Bartek Iwańczuk
3d5bed35e0
refactor: remove run_worker_loop (#4028)
* remove run_worker_loop, impl poll for WebWorker
* store JoinHandle to worker thread
2020-02-18 14:47:11 -05:00
Kevin (Kun) "Kassimo" Qian
08dcf6bff7
feat: Deno.makeTempFile (#4024) 2020-02-18 14:45:59 -05:00
Ryan Dahl
f0f807c524
upgrade: dprint 0.6.0 (#4026) 2020-02-18 10:34:24 -05:00
Bartek Iwańczuk
302debebb3
refactor: cleanup cli/lib.rs (#4006)
* rename methods on Worker related to module loading
* reorganize cli/lib.rs
* remove cli/progress.rs and cli/shell.rs
2020-02-18 10:08:18 -05:00
Bartek Iwańczuk
95563476f6
fix(deno test): support directories as arguments (#4011) 2020-02-17 13:11:45 -05:00
geoFlux
2e7d449623
feat: add --cert flag for http client (#3972) 2020-02-17 11:59:51 -05:00
Kitson Kelly
98e585a284
Fix issue with detecting AMD like imports (#4009) 2020-02-16 11:11:44 +01:00
Ben Noordhuis
503d8bfef2
fix: skip non-UTF-8 dir entries in Deno.readDir() (#4004)
Example:

		$ python2 -c 'open("\x80\x7F", "w")'

		$ deno eval 'Deno.readDirSync(".")'
		thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli/ops/fs.rs:373:16
		note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
		fatal runtime error: failed to initiate panic, error 5
		Aborted (core dumped)

Before this commit they made deno panic, now they are silently skipped.
Not ideal but arguably better than panicking.

No test because what characters are and aren't allowed in filenames is
highly file system-dependent.

Closes #3950
2020-02-15 10:37:05 -05:00
Bartek Iwańczuk
a0f015b1a3
refactor: replace Arc<Box<..>> with Rc<..> (#3996) 2020-02-15 01:18:36 +01:00
Ryan Dahl
87c329c45a
v0.33.0 2020-02-13 17:45:22 -05:00
Ryan Dahl
9325744a94
Clean up fmt flags and path handling (#3988) 2020-02-13 16:02:18 -05:00
Kitson Kelly
6bd846a780
Improvements to bundling. (#3965)
Moves to using a minimal System loader for bundles generated by Deno.
TypeScript in 3.8 will be able to output TLA for modules, and the loader
is written to take advantage of that as soon as we update Deno to TS
3.8.

System also allows us to support `import.meta` and provide more ESM
aligned assignment of exports, as well as there is better handling of
circular imports.

The loader is also very terse versus to try to save overhead.

Also, fixed an issue where abstract classes were not being re-exported.

Fixes #2553
Fixes #3559
Fixes #3751
Fixes #3825
Refs #3301
2020-02-12 16:41:51 -05:00
Nayeem Rahman
3563ab4c53
fix: Correctly determine a --cached-only error (#3979) 2020-02-12 17:02:34 +01:00
Bartek Iwańczuk
e6167c7813
chore: share HTTP server between tests (#3966) 2020-02-11 22:02:35 +01:00
Bartek Iwańczuk
63718ab305
dont use env vars in multiple installer tests (#3967) 2020-02-11 22:02:11 +01: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
e0bcecee60
refactor: Remove atomics from metrics (#3968)
* replace "AtomicUsize" with "u64" for field type on "Metrics"
* move "compiler_starts" field from "Metrics" to "GlobalState"
2020-02-11 17:23:40 +01:00
Bartek Iwańczuk
a3bfbccead
refactor: rewrite deno test, add Deno.test() (#3865)
* rewrite test runner in Rust
* migrate "test" and "runTests" functions from std to "Deno" namespace
* use "Deno.test()" to run internal JS unit tests
* remove std downloads for Deno subcommands
2020-02-11 12:01:56 +01:00
Nayeem Rahman
701ce9b334
refactor: Use PathBuf for paths in flag parsing and whitelists (#3955)
* Use PathBuf for DenoSubcommand::Bundle's out_file
* Use PathBuf for DenoSubcommand::Format's files
* Use PathBuf for DenoSubcommand::Install's dir
* Use PathBuf for read/write whitelists
2020-02-11 10:29:36 +01:00
Bartek Iwańczuk
79b3bc05d6
workers: basic event loop (#3828)
* establish basic event loop for workers
* make "self.close()" inside worker
* remove "runWorkerMessageLoop() - instead manually call global function 
  in Rust when message arrives. This is done in preparation for structured clone
* refactor "WorkerChannel" and use distinct structs for internal 
  and external channels;  "WorkerChannelsInternal" and "WorkerHandle"
* move "State.worker_channels_internal" to "Worker.internal_channels"
* add "WorkerEvent" enum for child->host communication; 
  currently "Message(Buf)" and  "Error(ErrBox)" variants are supported
* add tests for nested workers
* add tests for worker throwing error on startup
2020-02-11 10:04:59 +01:00
Ryan Dahl
e1105a1594
upgrade: dprint-plugin-typescript 0.5.0 (#3952) 2020-02-10 19:08:49 +01:00
Andy Finch
1abd408770
No longer require aligned buffer for shared queue (#3935)
Fixes: #3925
2020-02-09 10:54:16 -08:00
Kevin (Kun) "Kassimo" Qian
5066018412
fmt: deno fmt - formats stdin and print to stdout (#3920) 2020-02-09 11:19:05 +01:00
Bartek Iwańczuk
cdba5ab6fc refactor: rename ThreadSafeState, use RefCell for mutable state (#3931)
* rename ThreadSafeState to State
* State stores InnerState wrapped in Rc and RefCell
2020-02-08 20:34:31 +01:00
Kevin (Kun) "Kassimo" Qian
619a24390f
install: add --force flag and remove yes/no prompt (#3917) 2020-02-08 09:49:55 +01:00
Bert Belder
25467aa7c7
Add blanket impl for the 'Resource' trait (#3903) 2020-02-07 17:18:28 -08:00
Brad Dunbar
d7edf393b6
toAsyncIterable: Remove unnecessary EOF check (#3914)
In denoland/deno#2335 a conditional was added to make sure
toAsyncIterator didn't skip chunks because the reader returned data and
EOF in a single call, fixing #2330.

Later, in denoland/deno#2591, the `Reader` interface changed to
`Promise<number | EOF>`. Since the reader no longer returns data and EOF
in a single call, this conditional is not necessary. We can just return
`{ done: true }` when we get `EOF`.

Co-authored-by: Arun Srinivasan <rulfzid@gmail.com>

Co-authored-by: Arun Srinivasan <rulfzid@gmail.com>
2020-02-07 18:51:01 -05:00
Ryan Dahl
724e39f13f
Enable thread pool for blocking ops (#3912) 2020-02-07 17:54:44 -05:00
Ryan Dahl
99186dbaa2
Remove conditionals from installer (#3909) 2020-02-07 09:31:19 +01:00
Ryan Dahl
98fc7db47d
Fix deno types | head (#3910) 2020-02-07 09:30:05 +01:00
Kitson Kelly
ea6179f7dc
Improve support for diagnostics from runtime compiler APIs (#3911)
- Exports diagnostic items from `diagnostics.ts` which are missing at
  runtime.
- Returns an array of diagnostics, instead of an object with a property
  of `items`.  This is because of the way Rust deals with certain
  structures, and shouldn't be exposed in the APIs.
2020-02-07 01:54:05 -05:00
Yoshiya Hinosawa
5a8ba3b114
feat: add std/signal/mod.ts (#3913) 2020-02-07 01:53:15 -05:00
Ryan Dahl
d9c84eb91e
Rename ThreadSafeGlobalState to GlobalState (#3907)
simplify
2020-02-06 23:05:02 -05:00
Seungho Kim
522e856347
fix(cli/flags.rs): Prevent providing --allow-env flag twice (#3906) 2020-02-06 21:58:11 -05:00
Ryan Dahl
5e8581ff4b
fix 015_duplicate_parallel_import (#3904) 2020-02-06 21:24:51 -05:00
Ryan Dahl
ed680552a2
fix: basic web worker message passing (#3893)
Removes OP_HOST_GET_WORKER_LOADED, OP_HOST_POLL_WORKER, 
OP_HOST_RESUME_WORKER and ready/messageBuffer in cli/js/workers.ts.
2020-02-05 17:16:07 -05:00
Chris Knight
700f5e45ef
Fix: jsDoc for Deno.dir() (#3888) 2020-02-05 15:41:55 -05:00
Chris Knight
a04e7270cd
fix: Validate all tests included in unit_tests.ts (#3879) 2020-02-05 09:23:23 +01:00
Ryan Dahl
55ea854671
Move create_channels into worker constructor (#3889) 2020-02-05 08:40:38 +01:00
Luka Hartwig
7d115a2a65
refactor: port fetch test to rust (#3887) 2020-02-04 17:42:07 -05:00
Bartek Iwańczuk
184be99f5b
refactor: CLI subcommands and argv (#3886) 2020-02-04 20:24:33 +01:00
Tilman Roeder
2ab49a80a6
Do not encode files loaded from network as utf8 (#3856) 2020-02-04 11:27:50 -05:00
Bartek Iwańczuk
70eccff7f1
reenable some tests (#3882) 2020-02-04 09:10:46 -05:00
Ryan Dahl
161cf7cdfd
refactor: Use Tokio's single-threaded runtime (#3844)
This change simplifies how we execute V8. Previously V8 Isolates jumped
around threads every time they were woken up. This was overly complex and
potentially hurting performance in a myriad ways. Now isolates run on
their own dedicated thread and never move.

- blocking_json spawns a thread and does not use a thread pool
- op_host_poll_worker and op_host_resume_worker are non-operational
- removes Worker::get_message and Worker::post_message
- ThreadSafeState::workers table contains WorkerChannel entries instead
  of actual Worker instances.
- MainWorker and CompilerWorker are no longer Futures.
- The multi-threaded version of deno_core_http_bench was removed.
- AyncOps no longer need to be Send + Sync

This PR is very large and several tests were disabled to speed
integration:
- installer_test_local_module_run
- installer_test_remote_module_run
- _015_duplicate_parallel_import
- _026_workers
2020-02-03 18:08:44 -05:00
Ryan Dahl
0471243334
upgrade: dprint 0.3.0-alpha.6 2020-02-03 15:52:32 -05:00
Bartek Iwańczuk
f4cc08c4fc
v0.32.0 2020-02-03 16:36:07 +01:00
serverhiccups
2b0cf74a8f
Make fetch API more standards compliant (#3667) 2020-02-03 15:54:47 +01:00
Ryan Dahl
fba40d86c4
Use tokio::test for some of cli's unit tests (#3868) 2020-02-03 08:53:50 -05: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
Luka Hartwig
f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -05:00
Andy Finch
4f8a5c0239
feat: support crate imports in deno_typescript (#3814)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-02-01 12:02:23 +01:00
Tim Ermilov
2cd3994902
Add support for multiple files in fetch command (#3845) 2020-01-31 16:07:37 -05:00
Ryan Dahl
1dc8afe3af
Add NO_BUILD_SNAPSHOTS to speed up incremental builds (#3847) 2020-01-31 12:43:08 -05:00
Bartek Iwańczuk
e1697421e2
chore: remove std/installer, port installer tests to Rust (#3843) 2020-01-31 17:34:50 +01:00
Bartek Iwańczuk
c7a2a33ea1
chore: upgrade dprint (#3842) 2020-01-31 11:06:42 +01: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
25b13c8917
Use tokio::main (#3831) 2020-01-30 11:28:51 -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
Ryan Dahl
8e3bc774f7
Adjust dprint configuration to be closer to prettier (#3824) 2020-01-30 09:33:32 +01:00
Ryan Dahl
e1b3a0769a
Try to fix docs.rs for cli crate (#3823) 2020-01-30 09:32:20 +01:00
EnokMan
1c6c6c6d7f
Deno.makeTempDir() check permissions (#3810) 2020-01-29 23:21:41 -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
Bartek Iwańczuk
161adfc51b
workers: proper TS libs, more spec-compliant APIs (#3812)
* split lib.deno_main.d.ts into:
  - lib.deno.shared_globals.d.ts
  - lib.deno.window.d.ts
  - lib.deno.worker.d.ts
* remove no longer used libs:
  - lib.deno_main.d.ts
  - lib.deno_worker.d.ts
* change module loading to use proper TS library for compilation
* align to Worker API spec:
  - Worker.terminate()
  - self.close()
  - self.name
2020-01-29 18:54:23 +01: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
Bartek Iwańczuk
ac10d79d23 refactor: isomorphic snapshot for CLI (#3728) 2020-01-27 21:12:25 -05:00
Kitson Kelly
f604becaba Improve support of type definitions (#3755) 2020-01-26 13:59:41 -05:00
Kevin (Kun) "Kassimo" Qian
ec44be0760 lock: support lock-write for fetch command (#3787) 2020-01-26 13:43:59 -05:00
Ryan Dahl
9d98f0126c
Remove dead code in cli/shell.rs (#3792) 2020-01-26 11:40:28 -05:00
Ben Noordhuis
ba78ba69b0 fix clippy warnings (#3798) 2020-01-26 10:50:15 -05:00
Ben Noordhuis
97ed0c954d feat: make eval support --v8-flags=... (#3797)
Closes #3796
2020-01-26 09:49:34 -05:00
Bartek Iwańczuk
c824eb5817
refactor: Modules and Loader trait (#3791)
* move is_dyn_import argument from Loader::resolve to Loader::load - it was always kind of strange that resolve() checks permissions.
* change argument type from &str to &ModuleSpecifier where applicable
2020-01-25 18:53:16 +01:00
Bert Belder
37a7b01d5c
Refactor error tracking and scope juggling in deno_core (#3783) 2020-01-25 14:31:42 +01:00