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

671 commits

Author SHA1 Message Date
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