Commit graph

461 commits

Author SHA1 Message Date
Satya Rohith 89b61b5d05
fix(cli): give context when failed to load import map (#10478) 2021-05-04 14:27:20 +02:00
Casper Beyer abaec7a88e
fix(cli/tools/test): print module tests originate from (#10428) 2021-04-30 11:56:47 -04:00
Casper Beyer c455c28b83
feat(test): run test modules in parallel (#9815)
This commit adds support for running test in parallel.

Entire test runner functionality has been rewritten
from JavaScript to Rust and a set of ops was added to support reporting in Rust.

A new "--jobs" flag was added to "deno test" that allows to configure 
how many threads will be used. When given no value it defaults to 2.
2021-04-28 20:17:04 +02:00
Casper Beyer f3751e498f
feat(cli): add test permissions to Deno.test (#10188)
This commits adds adds "permissions" option to the test definitions 
which allows tests to run with different permission sets than 
the process's permission.

The change will only be in effect within the test function, once the 
test has completed the original process permission set is restored.

Test permissions cannot exceed the process's permission.
You can only narrow or drop permissions, failure to acquire a 
permission results in an error being thrown and the test case will fail.
2021-04-25 23:38:59 +02:00
Nayeem Rahman fb1ccc3d88
refactor(cli): rename Deno.emit() bundle options to "module" and "classic" (#10332) 2021-04-26 06:54:57 +10:00
Aaron O'Mullan 06cd451d20
cleanup(cli): use runtime's reg_sync() and reg_async() (#10241) 2021-04-18 16:03:46 +02:00
Aaron O'Mullan 46b1c653c0
refactor(deno): remove concept of bin & json ops (#10145) 2021-04-12 15:55:05 -04:00
crowlKats fefe93c91b
feat(runtime/permissions): prompt fallback (#9376)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-04-12 11:15:43 +09:00
Aaron O'Mullan 058579da56
refactor(ops): remove variadic buffers (#9944) 2021-04-02 09:47:57 -04:00
Nayeem Rahman ebd2047de4
feat(cli/source_map): Use top user frame for error source lines (#9604)
This commit changes formatting of JS errors; by not showing 
source lines for internal code. Where possible, instead using 
the top stack frame associated with user code i.e. the first 
location that is colourful and not a "deno:" URL.
2021-02-26 12:40:05 +01:00
Luca Casonato 9d70ea2e9f
feat(unstable): per op metrics (#9240) 2021-02-21 19:20:31 +01:00
Ryan Dahl c7dabc99ee
Make ModuleSpecifier a type alias, not wrapper struct (#9531) 2021-02-17 13:47:18 -05:00
Bartek Iwańczuk f6d6b24506
feat: support loading import map from URL (#9519)
This commit adds support for loading import maps from URLs,
both remote and local.

This feature is supported in CLI flag as well as in runtime
compiler API.
2021-02-17 14:32:57 +01:00
Kitson Kelly 7e9028b532
feat(cli): Deno.emit supports bundling as IIFE (#9291)
Closes #9204
2021-02-16 12:02:00 +11:00
Yoshiya Hinosawa fc162162a1
fix(cli): fix panic in Deno.emit (#9302) 2021-01-29 10:33:58 +09:00
Nayeem Rahman 81d73f2987
fix(cli): Check permissions for Deno.emit() (#9139) 2021-01-18 08:58:23 +11:00
Yusuke Tanaka d8fd71afdf
chore: update copyright to 2021 (#9092) 2021-01-11 18:13:41 +01:00
Luca Casonato 39bbbbce70
fix: use inline source maps when present in js (#8995) 2021-01-06 00:10:36 +01:00
Kitson Kelly 012f99bd9a
refactor(cli): runtime compiler APIs consolidated to Deno.emit() (#8799)
Closes: #4752
2021-01-01 08:43:54 +11:00
Kitson Kelly 8011eced14
feat(lsp): add cache command (#8911) 2020-12-30 15:17:17 +11:00
Bartek Iwańczuk 2e74f164b6
refactor: deno_runtime crate (#8640)
This commit moves Deno JS runtime, ops, permissions and
inspector implementation to new "deno_runtime" crate located
in "runtime/" directory.

Details in "runtime/README.md".

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-12-13 19:45:53 +01:00
Bartek Iwańczuk 31935c6b8d
refactor(cli): more options on Worker (#8724) 2020-12-12 00:36:18 +01:00
Bartek Iwańczuk 65e72b68ac
refactor(cli): decouple ops from ProgramState and Flags (#8659)
This commit does major refactor of "Worker" and "WebWorker",
in order to decouple them from "ProgramState" and "Flags".
The main points of interest are "create_main_worker()" and
"create_web_worker_callback()" functions which are responsible
for creating "Worker" and "WebWorker" in CLI context.
As a result it is now possible to factor out common "runtime"
functionality into a separate crate.
2020-12-11 18:49:26 +01:00
Steven Guerrero 43a35b005f
perf: use minimal op with performance.now() (#8619) 2020-12-07 08:27:25 -05:00
Bartek Iwańczuk c0ccbcdaee
refactor(cli): Reorganize worker code, use stronger memory ordering (#8638) 2020-12-07 04:30:40 +01:00
Bartek Iwańczuk f49d955601
fix(compile): disable source mapping of errors (#8581)
This commit disables source mapping of errors
for standalone binaries. Since applying source
maps relies on using file fetcher infrastructure
it's not feasible to use it for standalone binaries
that are not supposed to use that infrastructure.
2020-12-01 23:33:44 +01:00
Marcus Hultman c7276e15e5
feat(unstable): add cbreak option to setRaw (#8383) 2020-11-30 11:08:03 -05:00
Kitson Kelly e2858d0bbb
chore: clippy future cleanups (#8514) 2020-11-28 06:47:35 +11:00
William Perron 59f10b3604
fix(cli/ops/net): add write permissions for unixpackets datagrams & unix socket (#8511)
Fixes #7781
2020-11-27 13:43:39 -05:00
Bartek Iwańczuk 85a5a081b2
refactor(cli): reorganize main.rs and split workers (#8495)
Factored out "init_v8_flags", "init_logger" and 
"get_subcommand" from "main" function.

Also "Worker" was removed in favor of moving 
logic to "MainWorker" and "WebWorker" respectively.
2020-11-26 15:17:45 +01:00
Bartek Iwańczuk 8d0b1b40f5
fix(websocket): set User-Agent header (#8502) 2020-11-26 15:12:08 +01:00
crowlKats a837fb9a07
fix(cli/websocket): set User-Agent header (#8470) 2020-11-26 13:58:50 +01:00
crowlKats d40b0711a7
fix(websocket): Fix PermissionDenied error being caught in constructor (#8402) 2020-11-25 15:17:46 +01:00
crowlKats a08d2eee2b
add canary versioning (#8480) 2020-11-25 05:30:14 -05:00
Nayeem Rahman 14877f7fe2
feat(unstable): Add deno test --no-run (#8093)
This commit adds new flag to "deno test" subcommand
called "--no-run" that allows to preload, cache an type
check.
2020-11-22 14:06:51 +01:00
Bartek Iwańczuk 91f293442d
refactor(cli): worker event serialization (#8438)
This commit simplifies code responsible for serialization
of web worker events. Instead of using "PrettyJsError"
it's enough to downcast to "deno_core::JsError", making
the code less specific to cli/ implementation.
2020-11-20 13:25:18 +01:00
Bartek Iwańczuk e582796f42
refactor(cli): rename fmt_errors::JsError to PrettyJsError (#8435)
This commit renames "fmt_errors::JsError" to "PrettyJsError"
to avoid confusion with "deno_core::JsError".

Consequently "CoreJsError" aliases to "deno_core::JsError"
were removed.

Additionally source mapping step has been removed from
"PrettyJsError::create" to better separate domains.
2020-11-19 20:37:22 +01:00
Bartek Iwańczuk 636af2850c
refactor(cli): rename fs module to fs_util (#8380)
This commit renames "fs" module in "cli/" to "fs_util". This is purely
cosmetic change; there were a few places which aliased "crate::fs"
to "deno_fs" which was very confusing with "fs" module in ops.
2020-11-16 20:48:50 +01:00
Divy Srivastava d5661f677e
refactor: deno_crypto op crate (#7956)
This commit factors out "deno_crypto" op crate.

"rand" crate dependency was consequently moved to 
"deno_crypto" crate and reexported.
2020-11-13 22:01:57 +01:00
Bartek Iwańczuk a269dffe17
chore: remove dead code (#8298) 2020-11-08 23:35:36 +01:00
Kitson Kelly d672e1405d
refactor(cli): cleanup compiler snapshot and tsc/module_graph (#8220) 2020-11-03 06:41:20 +11:00
Kitson Kelly fdcc78500c
refactor(cli): migrate runtime compile/bundle to new infrastructure (#8192)
Fixes #8060
2020-11-02 13:51:56 +11:00
Nayeem Rahman 6be6c517d0
fix(cli/fmt): Strip "\\?\" prefix when displaying Windows paths (#8135) 2020-10-30 03:19:03 +01:00
Elias Sjögreen 305a9c04ba
feat(unstable): add Deno.systemCpuInfo() (#7774) 2020-10-26 10:54:27 -04:00
Bartek Iwańczuk 57cad53945
refactor(cli): rewrite Deno.transpileOnly() to use SWC (#8090)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-10-26 14:03:03 +01:00
Kitson Kelly 7e2c7fb6c5
refactor(cli): migrate run and cache to new infrastructure (#7996)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-23 11:50:15 +11:00
nerix 0a2f0fe7f2
fix(cli/rt/websockets): Only add Sec-WebSocket-Protocol if it's not empty (#7936) 2020-10-22 17:09:44 +02:00
Casper Beyer dfe19c5c75
feat: stabilize Deno.fsync and Deno.fdatasync (#8038) 2020-10-20 09:52:10 -04:00
Nayeem Rahman 7aba07cc77
fix(cli/worker): Print error stacks from the origin Worker (#7987)
Fixes #4728
2020-10-20 15:05:42 +11:00
William Perron 943b0980c7
feat(cli/ops): add the sleep_sync op (#7974) 2020-10-15 21:06:31 -04:00
Bartek Iwańczuk 135053486c
fix: top-level-await module execution (#7946)
This commit changes implementation of top-level-await in "deno_core".

Previously promise returned from module evaluation was not awaited,
leading to out-of-order execution of modules that have TLA. It's been
fixed by changing "JsRuntime::mod_evaluate" to be an async function
that resolves when the promise returned from module evaluation also
resolves. When waiting for promise resolution event loop is polled
repeatedly, until there are no more dynamic imports or pending
ops.
2020-10-14 14:04:09 +02:00
Bartek Iwańczuk 0bd3cea0ff
refactor(cli): rename GlobalState to ProgramState (#7914) 2020-10-13 13:35:35 +02:00
Kitson Kelly 26639b3bac
chore(cli): remove dead code (#7941) 2020-10-12 22:25:25 +11:00
Bartek Iwańczuk 527628e186
reland JsRuntime/Worker is not a Future (#7924) 2020-10-11 13:20:40 +02:00
Ryan Dahl 08bb8b3d53
Fix 100% CPU idling problem by reverting #7672 (#7911)
* Revert "refactor: Worker is not a Future (#7895)"

This reverts commit f4357f0ff9.

* Revert "refactor(core): JsRuntime is not a Future (#7855)"

This reverts commit d8879feb8c.

* Revert "fix(core): module execution with top level await (#7672)"

This reverts commit c7c7677825.
2020-10-10 11:41:11 +02:00
Bartek Iwańczuk f4357f0ff9
refactor: Worker is not a Future (#7895)
This commit rewrites deno::Worker to not implement Future
trait.

Instead there are two separate methods:
- Worker::poll_event_loop() - does single tick of event loop
- Worker::run_event_loop() - runs event loop to completion

Additionally some cleanup to Worker's field visibility was done.
2020-10-09 19:08:10 +02:00
Bartek Iwańczuk 9b70f2f345
refactor: rename isolate to js_runtime (#7858)
This commit renames occurrences of "isolate" variable name
to "js_runtime". This was outstanding debt after renaming
deno_core::CoreIsolate to JsRuntime.
2020-10-07 17:20:20 +02:00
Nayeem Rahman c226d3af25
fix(cli/ops/fs): Don't force Windows paths separate paths with forward slash (#7833) 2020-10-07 14:05:43 +02:00
Bartek Iwańczuk c7c7677825
fix(core): module execution with top level await (#7672)
This commit fixes implementation of top level await in "deno_core".

Previously promise returned from module execution was ignored causing to execute
modules out-of-order.

With this commit promise returned from module execution is stored on "JsRuntime"
and event loop is polled until the promise resolves.
2020-10-06 10:18:22 +02:00
Casper Beyer 4c779b5e8c
refactor(repl): use an inspector session (#7763)
This ports the REPL over to Rust and makes use of an inspector session to run a REPL on top of any isolate which lets make full use of rustylines various things like validators and completors without having to introduce a bunch of hard to test internal ops and glue code.

An accidental but good side effect of this is that the multiple line input we previously had is now an editable multi-line input prompt that is correctly stored in the history as a single entry.
2020-10-02 01:14:55 +02:00
Bartek Iwańczuk 45d4fd44c9
refactor: move op state registration to workers (#7696) 2020-09-28 12:14:11 +02:00
Bartek Iwańczuk e1beebc71a
refactor: factor out check_unstable op helper (#7695) 2020-09-26 20:26:51 +02:00
Bartek Iwańczuk ff785bc35a
refactor: use JsRuntime to implement TSC (#7691)
This commits removes "CompilerWorker" in favor of
using "JsRuntime".

"cli/ops/compiler.rs" has been removed in favor of inline
registration of ops in "cli/tsc.rs"
2020-09-26 16:33:25 +02:00
Bartek Iwańczuk dd1cd4d952
fix: clearing timers race condition (#7617) 2020-09-22 19:33:29 +02:00
Bartek Iwańczuk 92edc36442
refactor: use futures and serde_json from deno_core (#7614) 2020-09-21 18:36:37 +02:00
tokiedokie c4ed3fb7e7
chore: add copyright (#7593) 2020-09-21 08:26:41 -04:00
Bartek Iwańczuk b657d743a2
refactor: remove CliState, use OpState, add CliModuleLoader (#7588)
- remove "CliState.workers" and "CliState.next_worker_id", instead
store them on "OpState" using type aliases.
- remove "CliState.global_timer" and "CliState.start_time", instead
store them on "OpState" using type aliases.
- remove "CliState.is_internal", instead pass it to Worker::new
- move "CliState::permissions" to "OpState"
- move "CliState::main_module" to "OpState"
- move "CliState::global_state" to "OpState"
- move "CliState::check_unstable()" to "GlobalState"
- change "cli_state()" to "global_state()"
- change "deno_core::ModuleLoader" trait to pass "OpState" to callbacks
- rename "CliState" to "CliModuleLoader"
2020-09-20 01:17:35 +02:00
Bartek Iwańczuk f44522eac9
refactor: move fields from CliState to OpState (#7558)
- move rng to OpState
- move GlobalTimer to OpState
- move Metrics to OpState
2020-09-18 20:39:47 +02:00
Bartek Iwańczuk 7845740637
refactor: deno_fetch op crate (#7524) 2020-09-18 09:20:55 -04:00
Bartek Iwańczuk 6453cb7567
refactor: Move URL to op_crates/web (#7544) 2020-09-17 19:13:20 +02:00
Bartek Iwańczuk bda9379385
refactor: move op_resources and op_close to deno_core (#7539)
Moves op_close and op_resources to deno_core::ops and exports them.
Adds serde dependency to deno_core and reexports it.

Moves JS implementation of those ops to Deno.core and reexports them in Deno.
2020-09-17 18:09:50 +02:00
Ryan Dahl 46bf660e36
refactor: make fetch use op_fetch_read instead of op_read (#7529) 2020-09-17 16:11:55 +02:00
Ryan Dahl 104aebdfb5
Re-export deno_core::url (#7525)
Also re-exports deno_core::futures and deno_core::serde_json but these are not yet used in the CLI.
2020-09-16 14:28:07 -04:00
Ryan Dahl c3ef358c01 Remove unnecessary extern statements 2020-09-16 13:29:42 -04:00
Ryan Dahl 0cb64cef76 Remove unnecessary serde_derive dependency 2020-09-16 13:29:42 -04:00
Ryan Dahl 0715803b7f
Remove http_client from CliState, store in OpState directly (#7497) 2020-09-15 16:15:01 -04:00
Ryan Dahl 70f070706d
Rename deno::state::State to deno::state::CliState (#7480) 2020-09-14 21:22:32 -04:00
Bert Belder f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Luca Casonato daa780e2cf
fix(WebSocket): no panic on failed connect + handle promise rejection via error event (#7437) 2020-09-13 11:52:20 +02:00
Kitson Kelly 10fbfcbc79
refactor: improve tsc diagnostics (#7420) 2020-09-12 11:53:57 +02:00
Bartek Iwańczuk 0d1f626edd
refactor(core): JsRuntime initialization (#7415)
Removes:
- "deno_core::StartupData"
- "deno_core::Script"
- "deno_core::OwnedScript"

Changes to "JsRuntime":
- remove "new_with_loader()"
- remove "with_heap_limits()"
- rename "IsolateOptions" to "RuntimeOptions" and make public
- "JsRuntime::new()" takes "RuntimeOptions" as a single param
2020-09-11 15:18:49 +02:00
Ryan Dahl 7c2e7c6608
Use gotham-like state for ops (#7385)
Provides a concrete state type that can be dynamically added. This is necessary for op crates.
* renames BasicState to OpState
* async ops take `Rc<RefCell<OpState>>`
* sync ops take `&mut OpState`
* removes `OpRegistry`, `OpRouter` traits
* `get_error_class_fn` moved to OpState
* ResourceTable moved to OpState
2020-09-10 09:57:45 -04:00
Akshat Agarwal c1b4ff61c9
feat(unstable): Add Deno.systemMemoryInfo() (#7350)
Co-authored-by: marcopacini <pacinim88@gmail.com>
Co-authored-by: Casper Beyer <caspervonb@pm.me>
2020-09-10 10:38:17 +02:00
Bartek Iwańczuk f57a2c1e85
refactor(core): rename CoreIsolate to JsRuntime (#7373)
deno_core/
- rename core_isolate.rs to runtime.rs
- rename CoreIsolate to JsRuntime
- rename JSError to JsError
- rename JSStackFrame to JsStackFrame

cli/
- update references from deno_core::CoreIsolate to deno_core::JsRuntime
- rename deno_core::JSError to deno_core::JsError
- rename fmt_errors::JSError to fmt_errors::JsError
2020-09-06 21:44:29 +02:00
Bert Belder c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
crowlKats 8c880d3261
feat: Implement WebSocket API (#7051) 2020-09-05 10:39:25 -04:00
Casper Beyer 87e513ffc5
fix: use millisecond precision for Deno.futime and Deno.utime (#7299) 2020-09-01 10:03:07 -04:00
Casper Beyer 94d38eee4c
replace utime crate with filetime (#7268) 2020-08-31 22:24:17 -04:00
Casper Beyer 32de714dc7
feat(unstable): add Deno.futime and Deno.futimeSync (#7266) 2020-08-31 14:29:43 -04:00
Bartek Iwańczuk 7e946858a4
refactor: migrate ops to new dispatch wrapper (#7118) 2020-08-28 17:08:24 +02:00
Bert Belder c8b5f1e454
Simplify ErrBox-to-class mapping & hook it up to core json ops (#7195) 2020-08-26 18:48:04 +02:00
Bert Belder aead9dc91e
Remove some more unnecessary 'to_string()' calls (#7190) 2020-08-26 01:13:20 +02:00
Bert Belder 9bfb0df805
refactor: remove OpError, use ErrBox everywhere (#7187)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-08-26 00:22:15 +02:00
Bert Belder 27f4aeb924
Make Rc/Arc wrapper around State/GlobalState visible (#7104) 2020-08-19 02:01:48 +02:00
Nayeem Rahman 015fa0bd41
refactor: permissions (#7074) 2020-08-18 16:29:32 -04:00
Bert Belder f6e9150b33
Async op dispatcher support with 'stateful_json_op_(a)sync()' (#7095)
Closes: #7020
2020-08-18 20:50:52 +02:00
Ryan Dahl f5a4f1fdc0
Undo JsonOpDispatcher and OpDispatcher traits (#7023)
This reverts commit f83d672ffa.
This reverts commit d51972377c.
2020-08-12 16:44:58 +02:00
Nayeem Rahman 52c1017a74
feat: Stabilize Deno.mainModule (#6993) 2020-08-10 16:41:51 -04:00
Bartek Iwańczuk 59ca66a207
Encode op errors as strings instead of numbers (#6977) 2020-08-07 16:47:18 -04:00
Luca Casonato ce7808baf0
feat(cli): custom http client for fetch (#6918) 2020-08-05 20:44:03 +02:00
Bartek Iwańczuk b449964d1a
refactor: remove more compiler runtime code (#6841) 2020-07-23 15:29:36 +02:00
Ryan Dahl 2460689b1a
Remove deno_typescript (#6813) 2020-07-20 19:49:57 -04:00
Luca Casonato 071a6e284a
Share reqwest client between fetch calls (#6792) 2020-07-18 15:05:08 -04:00
Gurwinder Singh f83d672ffa
refactor: new trait JsonOpDispatcher (#6742) 2020-07-14 14:22:02 -04:00
Gurwinder Singh d51972377c
refactor: Make OpDispatcher a trait (#6736) 2020-07-13 16:19:51 -04:00
Nayeem Rahman 69e0886362
fix(URL): Implement spec-compliant host parsing (#6689) 2020-07-10 15:51:24 -04:00
Sebastien Filion 1bcc35b84a
feat(unstable): add Deno.consoleSize (#6520) 2020-07-10 10:07:12 -04:00
Maayan Hanin edb7a0eead
fix(cli): panic when stdio is null on windows (#6528)
Fixes: #6409
2020-07-09 21:06:51 +02:00
Valentin Anger be7e0f2d49
BREAKING(core): Remove control slice from ops (#6048) 2020-07-08 11:23:50 -04:00
uki00a a2bf61d1ae
feat(unstable): Deno.ppid (#6539) 2020-07-08 10:35:45 -04:00
dubiousjim 6b78729ba8
feat: Deno.chown() make uid, gid args optional (#4612) 2020-07-06 13:15:13 +02:00
Casper Beyer aeadf8189a
fix(cli): change seek offset type from i32 to i64 (#6518) 2020-06-27 15:58:35 -04:00
Bert Belder 0c735ebdc7
Fix clippy warning (#6503) 2020-06-26 20:16:49 +02:00
Casper Beyer e278c90d8a
feat(unstable): add Deno.fdatasyncSync and fdatasync (#6403) 2020-06-26 08:36:35 -04:00
Luca Casonato 4102a19585
fix: panic when process stdio rid is 0 or invalid (#6405) 2020-06-25 12:38:19 -04:00
Casper Beyer 6b3be01a00
feat(unstable): add Deno.fstatSync and fstat (#6425) 2020-06-22 08:58:52 -04:00
Casper Beyer 40866d7cd5
feat(unstable): add Deno.fsyncSync and fsync (#6411) 2020-06-21 09:29:44 -04:00
Ryan Dahl 0a81ec6b1e
Remove Deno.dir and dirs dependency (#6385) 2020-06-20 23:49:27 -04:00
Casper Beyer 86f92e04c7
feat(unstable): add Deno.ftruncate and ftruncateSync (#6243) 2020-06-20 09:46:10 -04:00
Bartek Iwańczuk 826a3135b4
refactor(compiler): split code paths for compile and bundle (#6304)
* refactor "compile" and "runtimeCompile" in "compiler.ts" and factor out
separate methods for "compile" and "bundle" operations

* remove noisy debug output from "compiler.ts"
 
* provide "Serialize" implementations for enums in "msg.rs"

* rename "analyze_dependencies_and_references" to "pre_process_file" and
move it to "tsc.rs"

* refactor ModuleGraph to use more concrete types and properly annotate
locations where errors occur

* remove dead code from "file_fetcher.rs" - "SourceFile.types_url" is no
longer needed, as type reference parsing is done in "ModuleGraph"

* remove unneeded field "source_path" from ".meta" files stored for
compiled source file (towards #6080)
2020-06-19 12:27:15 +02:00
Peter Evers fc850b11e5
unixpacket should also return byte length on send (#6291) 2020-06-15 12:20:45 -04:00
Kermit Xuan 77545219a6
fix: DatagramConn.send should return bytes sent (#6265) 2020-06-13 10:14:31 -04:00
Ryan Dahl e9424bf6b5
Revert "feat: add Deno.osName()" (#6261)
Deno.build.os provides the same functionality

This reverts commit 6ccf9037a6.
2020-06-12 09:53:53 -04:00
Rubin Bhandari 6ccf9037a6
feat: add Deno.osName() (#5714) 2020-06-11 13:11:26 -04:00
John Gardner ca5b5ba530
feat: Add Deno.mainModule (#6180) 2020-06-10 23:00:29 -04:00
Ryan Dahl 54c3f8e27f
fix udp BorrowMutError (#6221) 2020-06-10 11:26:28 -04:00
Casper Beyer 1e0808d501
fix: Deno.readSync on stdin (#6126)
Currently sync operations on stdin are failing because tokio::Stdin
cannot be converted to a std::File.

This commit replaces tokio::stdin with a raw file descriptor 
wrapped in a std::fs::File which can be converted to a 
tokio::File and back again making the synchronous version 
of op_read actually work.
2020-06-09 18:29:12 +02:00
Tuan Le 878f306a39
feat(cli): Add Deno.env.delete() (#5859) 2020-06-09 14:58:30 +02:00
Nayeem Rahman 44251ce8ea
fix(cli/js/web/worker): Disable relative module specifiers (#5266) 2020-06-09 14:33:52 +02:00
Valentin Anger becbb56b19
feat(core): Ops can take several zero copy buffers (#4788) 2020-06-01 14:20:47 -04:00
uki00a 64bd2768f7
fix(#4850): Deno.remove() fails to remove unix socket (#5967) 2020-05-30 14:48:26 -04:00
Ryan Dahl dad551a3a7
upgrade: Rust crates (#5959) 2020-05-30 11:35:44 +02:00
Ryan Dahl d4b05dd89e
refactor: Split isolate and state using safe get_slot() (#5929) 2020-05-29 17:41:39 -04:00
Nayeem Rahman 8e39275429
fix(cli/permissions): Fix CWD and exec path leaks (#5642) 2020-05-29 17:27:43 +02:00
Valentin Anger b7f0b073bb
Add unstable checks for unix transport (#5818)
Also remove the unix example from the stable documentation
to stay in line with the `Deno.listen` one
2020-05-24 09:43:40 -04:00
Ali Hasani 6072755ead
Implement Deno.symlink() for windows (#5533) 2020-05-19 00:46:02 +02:00
Ali Hasani c3ec16535f
Make Deno.remove() work with directory symlinks on windows (#5488) 2020-05-18 14:50:44 +02:00
Bartek Iwańczuk 9d63772fe5
refactor: rewrite TS dependency analysis in Rust (#5029)
This commit completely overhauls how module analysis is 
performed in TS compiler by moving the logic to Rust.

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

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

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

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

* add "ModuleGraphLoader"
  - can fetch local and remote sources
  - parses source code using SWC and extracts imports, exports, file references, special 
     headers
  - this struct inherited all of the hidden complexity and cruft from TS version and requires 
     several follow up PRs
* rewrite cli/tsc.rs to perform module analysis upfront and send all required source code to 
  TS worker in one message
* remove op_resolve_modules and op_fetch_source_files from cli/ops/compiler.rs
* run TS worker on the same thread
2020-05-18 12:59:29 +02:00
Yiyu Lin c4fe58d8df
Return error if more than one listener calls WorkerHandle::get_event() (#5461) 2020-05-17 06:50:38 +02:00
Yiyu Lin 0b9942da84
fix some unwrap() in Rust (#5485) 2020-05-16 09:41:32 -04:00
Yiyu Lin 871a0c9c0e
fix some clippy warning (#5462) 2020-05-15 15:26:16 -04:00
Kevin (Kun) "Kassimo" Qian 7de86ab605
cli: don't panic on Deno.close invalid argument (#5320) 2020-05-14 06:59:56 -04:00
Bert Belder 3cccadcf0f
Change plugin interface to prevent segfaults when unloading plugin (#5210)
Fixes: #3473
Closes: #5193
2020-05-11 22:39:13 +02:00
Bartek Iwańczuk 32aeec9630
refactor: check permissions in SourceFileFetcher (#5011)
This PR hot-fixes permission escapes in dynamic imports, workers
and runtime compiler APIs.

"permissions" parameter was added to public APIs of SourceFileFetcher
and appropriate permission checks are performed during loading of
local and remote files.
2020-05-11 13:13:27 +02:00
Ryan Dahl b8364a2636
BREAKING: make Deno.hostname unstable (#5108) 2020-05-09 12:44:35 -04:00
Bartek Iwańczuk f9f10229a4
refactor: Remove cli::compilers module (#5138)
This PR removes "cli/compilers/" directory.

"cli/compilers/ts.rs" has been renamed to "cli/tsc.rs"
2020-05-08 16:18:00 +02:00
Bartek Iwańczuk aca21dad1b
BREAKING: make Worker.deno unstable (#5128)
This commit makes "Worker.deno" option unstable.

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

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

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

This commit removes:
- cli/compilers/wasm.rs
- cli/compilers/wasm_wrap.js
- two integration tests related to .wasm imports
2020-05-07 20:43:27 +02:00
Ryan Dahl 221221cc97
BREAKING: execPath should require allow-read (#5109) 2020-05-06 15:51:33 -04:00
Bartek Iwańczuk cf5a39a361
refactor(ts): remove op_cache (#5071)
This PR removes op_cache and refactors how Deno interacts with TS compiler.

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

Additionally "Diagnostic" and its children got refactored to use "Deserialize" trait
instead of manually implementing JSON deserialization.
2020-05-05 18:23:15 +02:00