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

490 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
dubiousjim
9a63902db5
Rename readDir -> readdir (#4225) 2020-03-06 08:34:02 -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
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
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
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
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
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
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
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
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
Bert Belder
1cb1ab6c00
Merge mod_evaluate() and mod_evaluate_dyn_import() methods (#4167) 2020-02-27 16:30:18 -08: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
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
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
Kitson Kelly
be787d09d5
upgrade: TypeScript 3.8 (#4100) 2020-02-25 15:33:19 -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
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
ecyrbe
fb08cf7005
Add missing node os.release() implementation (#4065) 2020-02-24 08:35:45 -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
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
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
Maximilien Mellen
90125566bb
Enable TS strict mode by default (#3899)
Fixes #3324 

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

This PR provides support for referencing other lib files (like lib.dom.d.ts that are not
used by default in Deno.
2020-02-19 00:34:11 -05:00
Kevin (Kun) "Kassimo" Qian
08dcf6bff7
feat: Deno.makeTempFile (#4024) 2020-02-18 14:45:59 -05:00
Kitson Kelly
98e585a284
Fix issue with detecting AMD like imports (#4009) 2020-02-16 11:11:44 +01: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
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
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
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
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
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
Bartek Iwańczuk
184be99f5b
refactor: CLI subcommands and argv (#3886) 2020-02-04 20:24:33 +01:00
serverhiccups
2b0cf74a8f
Make fetch API more standards compliant (#3667) 2020-02-03 15:54:47 +01:00
Rafael Vargas
55063dd8e8
fix: Deno.remove() to properly remove dangling symlinks (#3860)
For some reason, the unit tests for Deno.remove() were not being imported to 
unit_tests.ts and, consequently, not being executed. Thus, I imported them, 
refactored some existent ones and wrote new ones for the symlink removal case.

Since the creation of a symlink is not implemented for Windows yet, assertions
that consider this state were added when the tests are executed in this OS.
2020-02-03 08:20:15 -05:00
Luka Hartwig
f168597b7a
Remove //tests symlink (#3849) 2020-02-02 16:55:22 -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
ac10d79d23 refactor: isomorphic snapshot for CLI (#3728) 2020-01-27 21:12:25 -05:00
Kitson Kelly
950537e8ef Break out runtime lib to main and worker (#3771)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-24 14:15:01 -05:00
Ryan Dahl
fe427eedb1 Mark signal APIs as unstable (#3779) 2020-01-24 16:58:17 +01:00
Yoshiya Hinosawa
bc89f04cbf Add signal handlers (#3757) 2020-01-24 08:15:31 -05:00
Ryan Dahl
74e6eb14dd update readmes (#3765) 2020-01-23 22:32:52 +01:00
Bartek Iwańczuk
63293a90e1
refactor: snapshotting (#3753) 2020-01-22 23:58:13 +01:00
Bartek Iwańczuk
bd9561f4de
Reland "Create an old program to be used in snapshot." (#3747)
* read CLI assets from disk during snapshotting
2020-01-22 20:18:01 +01:00
Ry Dahl
fa7f34eb8c
Revert "Create an old program to be used in snapshot. (#3644)"
Ref #3712. This change allowed the deno_typescript crate to reference
cli/js/lib.deno_runtime.d.ts which breaks "cargo package". We intend to
reintroduce a revised version of this patch later once "cargo
package" is working and tested.

This reverts commit 737ab94ea1.
2020-01-21 14:57:56 -05:00
Takashi Idobe
108294deeb change copyrights from 2019 to 2020 (#3733) 2020-01-21 10:01:55 -05:00
Bartek Iwańczuk
5e2fd183ff
refactor: Rename JS entry functions (#3732) 2020-01-21 15:53:29 +01:00
Michał Sabiniarz
21cc9cb7a7 Implemented alternative open mode in files (#3119)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-21 10:49:42 +01:00
Bartek Iwańczuk
7966bf14c0
refactor: split worker and worker host logic (#3722)
* split ops/worker.rs into ops/worker_host.rs and ops/web_worker.rs

* refactor js/workers.ts and factor out js/worker_main.ts - entry point for WebWorker runtime

* BREAKING CHANGE: remove support for blob: URL in Worker

* BREAKING CHANGE: remove Deno namespace support and noDenoNamespace option in Worker constructor

* introduce WebWorker struct which is a stripped down version of cli::Worker
2020-01-21 09:49:47 +01:00
Bartek Iwańczuk
c90036ab88 refactor: reduce number of ErrorKind variants (#3662) 2020-01-20 10:50:16 -05:00
Kitson Kelly
60b53fd6b6 Use globalThis to reference global scope (#3719)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-01-20 09:30:30 -05:00
Bartek Iwańczuk
23e67eb515
stabilize net Addr (#3709)
Co-authored-by: xiaoxintang <15707971810@163.com>
2020-01-18 21:49:55 +01:00
Bartek Iwańczuk
34b99fec8e
rename dial to connect and dialTLS to connectTLS (#3710) 2020-01-18 18:35:12 +01:00
Ry Dahl
59c674fed5
Mark various APIs in window.Deno as unstable (#3701) 2020-01-17 19:01:24 -05:00
Bartek Iwańczuk
5fa056e53b workers: minimal error handling and async module loading (#3665) 2020-01-17 18:43:53 -05:00
Klaus Hvam
35eb79610f Fix compile and bundle api types (#3703) 2020-01-17 17:45:18 -05:00
Andy Finch
fe5662058e feat: support individual async handler for each op (#3690) 2020-01-17 08:26:11 -05:00
Kevin (Kun) "Kassimo" Qian
0a78bfb836 Add Deno.symbols and move internal fields for test (#3693) 2020-01-16 19:42:58 -05:00
Kevin (Kun) "Kassimo" Qian
91757f63fd feat(fs): add more unix-only fields to FileInfo (#3680) 2020-01-16 09:46:32 -05:00
Kitson Kelly
737ab94ea1 Create an old program to be used in snapshot. (#3644) 2020-01-12 12:20:33 +01:00
Ry Dahl
d492c5abe3
feat: Deno.args now does not include script (#3628)
Previously Deno.args was ["script.js", "arg1", "arg2"]
Now it is just ["arg1", "arg2"]
BREAKING CHANGE
2020-01-09 11:37:01 -07:00
Luca Casonato
b71d5708c6 feat: Deno.create (#3629) 2020-01-08 17:07:03 -05:00
Kitson Kelly
d325566a7e Runtime Compiler API (#3442)
Also restructures the compiler TypeScript files to make them easier to
manage and eventually integrate deno_typescript fully.
2020-01-08 09:17:44 -05:00
Ry Dahl
d4bf0670ce
fix: Deno.mkdir should conform to style guide (#3617) 2020-01-07 14:14:33 -05:00
Ry Dahl
5f1df038fb
Replace libdeno with rusty_v8 (#3556) 2020-01-05 09:19:29 -05:00
Luca Casonato
c41280a057 perf: TextEncoder.encode improvement (#3596) 2020-01-04 17:00:03 -05:00
Waldir Pimenta
2a36879e30 Add missing year ranges to copyright notices (#3582) 2020-01-02 18:41:59 -05:00
Ry Dahl
bfab4ed0df
Happy new year! (#3578) 2020-01-02 15:13:47 -05:00
Bartek Iwańczuk
46d76a7562
upgrade: Tokio 0.2 (#3418) 2019-12-30 14:57:17 +01:00
Kevin (Kun) "Kassimo" Qian
df1665a8fc net: expose shutdown TS def (#3560) 2019-12-30 11:30:20 +01:00
Kevin (Kun) "Kassimo" Qian
176d1ff12e net: expose shutdown() and ShutdownMode (#3558) 2019-12-29 10:20:23 -05:00
Alexandre Szymocha
4d4908dde3 Fix: allow reading into a 0-length array (#3329) 2019-12-28 08:48:36 -05:00
Kevin (Kun) "Kassimo" Qian
43fb24f4cd Drop unnecessary Object.assign from createResolvable() (#3548) 2019-12-24 21:59:46 -05:00
Nayeem Rahman
f07ffe8980 feat: Add Deno.dir("executable") (#3526) 2019-12-21 06:30:13 -05:00
Nayeem Rahman
f4f4c6bcb4 fix: Use sync ops when clearing the console (#3533) 2019-12-21 03:58:28 -05:00
Nayeem Rahman
b7b0668c78 feat: Return null on error in Deno.dir() (#3531) 2019-12-20 19:06:07 -05:00
Ry Dahl
077b6f7672
Reduce all directory functions to Deno.dir() (#3518) 2019-12-18 09:29:00 -05:00
Axetroy
de94698915 Feat: Add more dir APIs for Deno (#3491) 2019-12-15 13:14:20 +08:00
Axetroy
83f95fb8df fetch support URL instance as input (#3496) 2019-12-14 20:49:30 +08:00
Kevin (Kun) "Kassimo" Qian
ec7f3ce1c2 timer: due/now Math.max instead of min (#3477) 2019-12-10 12:21:30 +01:00
Andy Finch
7c3b9b4f4f feat: first pass at native plugins (#3372) 2019-12-05 15:30:20 -05:00
Kevin (Kun) "Kassimo" Qian
3293725131 Timer/microtask ordering fix (#3439) 2019-12-03 22:19:03 -05:00
木杉
537c6b3ed9 fix realpath behavior in windows (#3425) 2019-12-01 11:23:35 -08:00
Kevin (Kun) "Kassimo" Qian
f88dc4e197 Add Deno.realpath (#3404) 2019-11-26 00:40:57 -08:00
Bartek Iwańczuk
658ec2aaf9 better error message for missing module (#3402) 2019-11-25 09:33:23 -05:00
Kitson Kelly
9e97eb2879 Make private namespaces in lib.deno_runtime.d.ts more private (#3400) 2019-11-24 10:36:49 -05:00
Kitson Kelly
8d977d0117 feat: Support named exports on bundles. (#3352) 2019-11-20 11:02:08 -05:00
Ry Dahl
4902a1cacb
Turn on TS strict mode for deno_typescript (#3330) 2019-11-14 15:05:36 -05:00
Kevin (Kun) "Kassimo" Qian
4189cc1ab5 Loader: support .wasm imports (#3328)
* loader: support .wasm imports

* http_server: true

* Support named exports

* Clippy
2019-11-14 08:31:39 -05:00
Kitson Kelly
9837d324a7 Update to TypeScript 3.7 (#3275)
and update to prettier 1.19

Also, update `assert()` and remove not null assertions where possibly
in `cli`.

Closes #3273
2019-11-13 13:42:34 -05:00
Kitson Kelly
8d03397293 Make bundles fully standalone (#3325)
- Bundles are fully standalone. They now include the shared loader with
  `deno_typescript`.
- Refactor of the loader in `deno_typescript` to perform module
  instantiation in a more
- Change of behaviour when an output file is not specified on the CLI.
  Previously a default name was determined and the bundle written to that
  file, now the bundle will be sent to `stdout`.
- Refactors in the TypeScript compiler to be able to support the concept
  of a request type.  This provides a cleaner abstraction and makes it
  easier to support things like single module transpiles to the userland.
- Remove a "dangerous" circular dependency between `os.ts` and `deno.ts`,
  and define `pid` and `noColor` in a better way.
- Don't bind early to `console` in `repl.ts`.
- Add an integration test for generating a bundle.
2019-11-13 10:35:56 -05:00
木杉
0f33bf6885 fix url parse bug (#3316) 2019-11-12 13:45:48 -05:00
Yoshiya Hinosawa
31115067cd Add permissions.request (#3296) 2019-11-11 10:33:29 -05:00
Bartek Iwańczuk
335e8bd33c refactor: worker is no longer a resource (#3290) 2019-11-09 12:07:14 -08:00
Nayeem Rahman
d586f119fa net: Check for closing status when iterating Listener (#3309)
std/http/server.ts: Use listener.next() instead of listener.accept()
2019-11-09 14:40:22 -05:00
Ry Dahl
1726194452
Revert "reduce redundancies in the fetch code (#3249)" (#3264)
Max latency benchmark went to zero for deno_proxy.

This reverts commit 65e9179672
2019-11-04 19:10:54 -05:00
Bartek Iwańczuk
0049d4e50c Refactor Worker and ThreadSafeState (#3242)
* Split ThreadSafeState into State and GlobalState. State is a "local"
  state belonging to "Worker" while "GlobalState" is state shared by
  whole program.
* Update "Worker" and ops to use "GlobalState" where applicable
* Move and refactor "WorkerChannels" resource
2019-11-04 10:38:52 -05:00
Nick Stott
65e9179672 reduce redundancies in the fetch code (#3249) 2019-11-02 11:47:55 -04:00
Ry Dahl
af61dbed87 Upgrade node_modules, change tagline, clean up root directory (#3247)
* Upgrade node_modules
* Simplify tagline
* Move gclient_config.py out of root
* Move package.json to tools
* Remove yarn.lock
* Remove CONTRIBUTING.md
2019-10-31 19:33:27 -07:00
Kevin (Kun) Kassimo Qian
9d6cbb73a8
cli: replace timer map with red-black tree (#3218)
This avoids a crash when the Deno process has been running for
2**32 ms (about 50 days). Additionaly, time complexity of finding which
timer is due to fire next is reduced from from O(n) to O(log n).
2019-10-31 17:11:58 -07:00
Sven Nicolai Viig
d7a5aed511 Adds custom inspect method for URL (#3241) 2019-10-31 14:55:54 -04:00
Yoshiya Hinosawa
4f8c936974 Make EOF unique symbol (#3244) 2019-10-31 10:57:09 -04:00
Ry Dahl
8f571ef166
Remove TTY tests - dead code (#3229) 2019-10-29 17:52:57 -04:00
Andy Hayden
3c2399e437 Use top-level await in jsdoc examples (#3239) 2019-10-29 17:11:41 -04:00
Kevin (Kun) "Kassimo" Qian
2f0f236d56 Prevent customInspect error from crashing console (#3226) 2019-10-28 18:29:15 -04:00
Nick Stott
65d9286203 Re-enable basic stream support for fetch bodies (#3192)
* Add sd-streams from https://github.com/stardazed/sd-streams/blob/master/packages/streams/src/

* change the interfaces in dom_types to match what sd-streams expects
2019-10-28 12:41:36 -04:00
Rory Malcolm
967c236fa5 Add CustomInspect for Headers (#3130)
Worth noting due to implementation of the Headers class the contents of headersMap have lowercase keys, although this matches the specification as header keys are case agnostic it does seem to not match behaviour of other implementations in other languages I have seen, would require some rewriting of Headers.ts
2019-10-28 12:23:39 -04:00
Yoshiya Hinosawa
efd7e78af3 Use web standard Permissions API (#3200) 2019-10-27 11:22:53 -04:00
Andy Hayden
aec5a646c9 feat: top-level-for-await (#3212) 2019-10-27 09:04:42 -04:00
Kitson Kelly
c5fe657dd3 Use a more performant utf8 decoder algorithm. (#3204)
Fixes #3163

Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
Co-authored-by: Qwerasd <qwerasd205@users.noreply.github.com>
2019-10-26 10:51:53 -04:00
Bartek Iwańczuk
dfcdc03152 fix: handle malformed control buffers (#3202) 2019-10-25 13:23:16 -04:00
Bartek Iwańczuk
492b87d460 Add error handling for minimal dispatch (#3176) 2019-10-24 17:22:31 -04:00
Ry Dahl
1d8f3cc896
Remove old website (#3194)
Move manual.md and style_guide.md into //std so they can be accessed
from https://deno.land/std/manual.md

Code for new website is https://github.com/denoland/deno_website2

Co-authored-by: Christian Moritz <chrmoritz@gmail.com>
2019-10-24 16:14:05 -04:00
Yoshiya Hinosawa
2804ba8674 remove --no-prompt flag, fail on missing permissions (#3183) 2019-10-22 19:35:43 -04:00
Bartek Iwańczuk
6c5a981fd2 feat: Deno.listenTLS (#3152) 2019-10-21 14:38:28 -04:00
Ry Dahl
4ae1838a6e
Fix clearTimer bug (#3143) 2019-10-19 17:09:24 -04:00
Kevin (Kun) "Kassimo" Qian
b112e14b16 chore: remove xevalDelim from Start interface (#3147) 2019-10-19 02:38:59 -04:00
Bartek Iwańczuk
4221b90c3f perf: eager poll async ops in Isolate (#3046) 2019-10-14 17:46:27 -04:00
Yusuke Sakurai
6056595357 fix: [tls] op_dial_tls is not registerd and broken (#3121) 2019-10-13 10:37:37 -04:00
Ryan Dahl
b81e5db17a
Merge deno_cli_snapshots into deno_cli (#3064) 2019-10-04 20:28:51 -04:00