Commit graph

520 commits

Author SHA1 Message Date
Aaron O'Mullan 678a881f63
refactor(runtime): Worker bootstrap options (#12299) 2021-10-05 22:41:14 +02:00
Bartek Iwańczuk f1d3a17043
feat: add --compat flag to provide built-in Node modules (#12293)
This commit adds "--compat" flag. When the flag is passed a set of mappings for
built-in Node modules is injected into the import map. If user doesn't
explicitly provide an import map (using "--import-map" flag) then a map is
created on the fly. If there are already existing mappings in import map that
would clash with built-in Node modules a set of diagnostics is printed to the
terminal with suggestions how to proceed.
2021-10-05 01:35:55 +02:00
Sylvain Cau ee2e25fba7
feat(cli/uninstall): add uninstall command (#12209) 2021-09-30 11:38:07 -04:00
Andreu Botella cdb252af0a
feat: support serializing WebAssembly.Module objects (#12140) 2021-09-29 10:47:24 +02:00
Ryan Dahl 01da1d0adc
refactor: Rename ProgramState to ProcState (#12204)
Move Arc into struct
2021-09-24 11:10:42 -04:00
Bartek Iwańczuk f840906943
fix(core): prevent multiple main module loading (#12128)
This commit fixes a problem where loading and executing multiple 
modules leads to all of the having "import.meta.main" set to true.

Following Rust APIs were deprecated:
- deno_core::JsRuntime::load_module
- deno_runtime::Worker::execute_module
- deno_runtime::WebWorker::execute_module

Following Rust APIs were added:
- deno_core::JsRuntime::load_main_module
- deno_core::JsRuntime::load_side_module
- deno_runtime::Worker::execute_main_module
- deno_runtime::Worker::execute_side_module
- deno_runtime::WebWorker::execute_main_module

Trying to load multiple "main" modules into the runtime now results in an
error. If user needs to load additional "non-main" modules they should use
APIs for "side" module.
2021-09-18 03:44:53 +02:00
Bartek Iwańczuk cba1e7b5a3
feat: add option flags to 'deno fmt' (#12060) 2021-09-13 22:06:45 +02:00
Bartek Iwańczuk 0dbeb774ba
feat(fmt): add support for configuration file (#11944)
This commit adds support for configuration file for "deno fmt"
subcommand. It is also respected by LSP when formatting
files.

Example configuration:
{
    "fmt": {
        "files": {
            "include": ["src/"],
            "exclude": ["src/testdata/"]
        },
        "options": {
            "useTabs": true,
            "lineWidth": 80,
            "indentWidth": 4,
            "singleQuote": true,
            "textWrap": "preserve"
        }
    }
}
2021-09-13 20:19:10 +02:00
Ryan Dahl 13991e5995
refactor: Remove duplicated colors.rs file (#11990) 2021-09-12 12:04:17 -04:00
Bartek Iwańczuk d236f432b8
refactor: use import_map crate (#11974)
Removes ImportMap implementation from "cli/" and instead
uses "import_map" crate
2021-09-11 03:38:24 +02:00
David Sherret 4833103011
fix: exit process on panic in a tokio task (#11942) 2021-09-07 19:34:27 -04:00
David Sherret 2c2e3ec1ca
refactor(lsp): use deno_ast and cache swc ASTs (#11780) 2021-09-07 10:39:32 -04:00
Bartek Iwańczuk 44ca3ce6ae
refactor: factor out DenoSubcommand enum variant into structs (#11896)
This commit refactors "DenoSubcommand" enum in a way that variants
no longer contain anonymous structures but instead contain
dedicated structures for each subcommand, eg. "DenoSubcommand::Lint"
now contains "LintSubcommand".
2021-09-04 01:33:35 +02:00
Bartek Iwańczuk d93570a619
feat(lint): add support for config file and CLI flags for rules (#11776)
This commit adds support for following flags in deno lint subcommand:

--config - allows to load configuration file and parses "lint" object
--rules-tags=<tags> - allows specifying which set of tagged rules should be run
--rules-include=<rules> - allow specifying which rules should be run
--rules-exclude=<rules> - allow specifying which rules should not be run
2021-09-03 17:01:58 +02:00
Bartek Iwańczuk c84532b6d5
chore: upgrade crates (#11894)
Co-authored-by: David Sherret <dsherret@gmail.com>
2021-09-02 17:38:19 +02:00
Luca Casonato fcd0992dba
fix: move unstable declarations to deno.unstable (#11876) 2021-08-31 11:25:15 +02:00
Casper Beyer b9a965c607
refactor(cli): introduce module specifier test modes (#11769)
This commit merges the two vectors of specifiers into a single one introducing
the concept of a "TestMode" which is a tri-state enum specifying how a specifier
is to be tested (as documentation, as an executable module or as both).

This is determined during the collection phase and determines how a specifier
will be executed based on how the specifier was collected (directly or not) and
if it has an eligible media_type when fetched.

For example "deno test README.md" is marked as documentation because, while it
is a direct inclusion it is not an executable media type therefore will only
have the fenced code blocks that can be parsed from it tested.
2021-08-26 21:21:58 +02:00
Casper Beyer a3fd4bb998
fix(cli): dispatch unload event on watch drop (#11696) 2021-08-24 22:34:09 +02:00
Casper Beyer a7240c5091
feat(cli): add --ignore flag to test command (#11712) 2021-08-24 17:23:29 +02:00
Casper Beyer 2c17045aa8
refactor(cli/tools/test): infer disable log from program state (#11803) 2021-08-23 16:03:57 +02:00
Bartek Iwańczuk dbcdd3a18e
fix: duplicate import in cli/main.rs (#11813) 2021-08-23 14:08:55 +02:00
Casper Beyer f3b2f23a1d
refactor(cli/flags): use an optional non zero usize for fail-fast (#11804)
Changes the type of the `fail_fast` flag from `Option<usize>` to
`Option<NonZeroUsize>` as an optional value of zero isn't sound.
2021-08-23 12:37:02 +02:00
Casper Beyer 198699faba
fix(cli/flags): require a non zero usize for concurrent jobs (#11802) 2021-08-23 12:35:38 +02:00
Casper Beyer 4b800f5d26
refactor(cli): pass optional op_init to create_main_worker (#11707)
Replaces the testing flag in create_main_worker with a more 
general purpose hook to register additional ops.
2021-08-17 12:08:39 +02:00
Andreu Botella ddbb7b83f2
feat(runtime): support classic workers for internal testing (#11338)
This commit implements classic workers, but only when the `--enable-testing-features-do-not-use` flag is provided. This change is not user facing. Classic workers are used extensively in WPT tests. The classic workers do not support loading from disk, and do not support TypeScript.

Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-16 14:29:54 +02:00
Casper Beyer ed19e32d98
refactor: normalize is_supported_ check naming (#11698)
Normalizes the naming of the functions used to determine 
if a path is a suitable match for the test runner and placed 
them both in the the fs_util module.
2021-08-14 10:17:21 +02:00
Casper Beyer ebb79b28a5
refactor(cli): generalize module specifier collection (#11679) 2021-08-13 12:06:49 +02:00
Bartek Iwańczuk b9a8111a00
refactor: --unsafely-ignore-certificate-errors (#11629) 2021-08-10 13:19:45 +02:00
TheAifam5 353a4a1af3
feat: Add --unsafely-treat-insecure-origin-as-secure flag to disable SSL verification (#11324)
This commit adds "--unsafely-treat-insecure-origin-as-secure" flag 
that allows to disable SSL verification for all domains, or specific
domains if they were passed as an argument to the flag.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-08-09 16:53:21 +02:00
Justin Chase 02c74fb709
feat(tls): Optionally support loading native certs (#11491)
This commit adds "DENO_TLS_CA_STORE" env variable to support 
optionally loading certificates from the users local certificate store. 
This will allow them to successfully connect via tls with corporate 
and self signed certs provided they have them installed in their keystore. 
It also allows them to deal with revoked certs by simply updating 
their keystore without having to upgrade Deno.

Currently supported values are "mozilla", "system" or empty value.
2021-08-07 14:49:38 +02:00
David Sherret 864ce6e832
feat(repl): add --eval flag for evaluating code when the repl starts (#11590) 2021-08-06 17:30:28 -04:00
Yusuke Tanaka 8f00b5542c
chore: upgrade Rust to 1.54.0 (#11554) 2021-07-30 15:03:41 +02:00
Divy Srivastava 2b13bb6945
feat(runtime): implement navigator.hardwareConcurrency (#11448)
This commit implements "navigator.hardwareConcurrency" API, which
supersedes "Deno.systemCpuInfo()" API (which was removed in this commit).
2021-07-29 21:45:11 +02:00
Casper Beyer c276b52828
feat: type check codeblocks in Markdown file with "deno test --doc" (#11421) 2021-07-29 21:03:06 +02:00
Casper Beyer 4861b13aab
fix(cli): normalize test command errors (#11375) 2021-07-22 13:34:29 +02:00
Casper Beyer 2e57476fbb
fix(cli): return error from coverage_command (#11411) 2021-07-15 18:28:14 +02:00
Yasser A.Idrissi 32855f2c85
feat: Add support for "deno test --fail-fast=N" (#11316)
This commit adds support for specifying threshold in the "--fail-fast"
flag for "deno test" subcommand. Previously using "--fail-fast" stopped
running the test suite after first failure and with this change users
may specify number of failed tests that will cause the suite to be interrupted.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-07-12 12:55:42 +02:00
Luca Casonato f649960f87
refactor: deno_http op crate (#11335) 2021-07-12 12:44:49 +02:00
Ryan Dahl 67c9937e66
Revert "feat(cli/tools/test_runner): add terse reporter (#11156)" (#11352)
it's another flag to understand, more code, and isn't something that anyone really needs.

This reverts commit 9d57a4aaeb.
2021-07-10 07:51:30 -07:00
Casper Beyer 9d57a4aaeb
feat(cli/tools/test_runner): add terse reporter (#11156)
This commit adds "--terse" flag to "deno test" that makes testing reporter
output one character per test case instead of one line per case.

This is an unstable feature.
2021-07-10 01:29:18 +02:00
Casper Beyer 9b89668065
fix(cli): make --doc work with --watch (#11183) 2021-07-10 01:15:15 +02:00
David Sherret 7fc0e8ec8c
chore: use parking_lot for synchronization primitives to align with tokio (#11289)
parking_lot is already transitively used in tokio via the "full" cargo feature
2021-07-06 23:48:01 -04:00
Luca Casonato bdfad23dd0
feat: support SharedArrayBuffer sharing between workers (#11040)
This commit adds support for sharing SABs between workers.
2021-07-06 19:42:52 +02:00
Casper Beyer e8258e0210
feat(test): add --shuffle flag to randomize test ordering (#11163) 2021-07-05 21:20:33 -04:00
Jimmy Wärting 2c0b0e45b7
refactor: asynchronous blob backing store (#10969)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-07-05 15:34:37 +02:00
Bartek Iwańczuk 38a7128cdd
feat: Add "deno_net" extension (#11150)
This commits moves implementation of net related APIs available on "Deno"
namespace to "deno_net" extension.

Following APIs were moved:
- Deno.listen()
- Deno.connect()
- Deno.listenTls()
- Deno.serveHttp()
- Deno.shutdown()
- Deno.resolveDns()
- Deno.listenDatagram()
- Deno.startTls()
- Deno.Conn
- Deno.Listener
- Deno.DatagramConn
2021-06-29 01:43:03 +02:00
David Sherret 477273085f
chore: use lsp to get parent process id (#11083)
Removes the previously added internal `--parent-pid` flag. This solution is better.
2021-06-22 21:48:01 -04:00
Luca Casonato 6261c89e04
feat: transfer MessagePort between workers (#11076)
Add support for transferring `MessagePort`s between workers.
2021-06-22 16:30:16 +02:00
Bartek Iwańczuk 9105892ec8
refactor: unify JavaScript script execution method (#11043)
This commit renames "JsRuntime::execute" to "JsRuntime::execute_script". Additionally
same renames were applied to methods on "deno_runtime::Worker" and
"deno_runtime::WebWorker".

A new macro was added to "deno_core" called "located_script_name" which
returns the name of Rust file alongside line no and col no of that call site.
This macro is useful in combination with "JsRuntime::execute_script"
and allows to provide accurate place where "one-off" JavaScript scripts
are executed for internal runtime functions.

Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
2021-06-22 01:45:41 +02:00
Kitson Kelly 281c4cd8fc
feat(cli): support "types" when type checking (#10999)
Fixes #10677
2021-06-22 07:18:32 +10:00
Bartek Iwańczuk a2f939b99c
refactor(core): always attach inspector to isolate (#11042)
This commit changes "deno_core::JsRuntime" to always create
"deno_core::JsRuntimeInspector" instance.
2021-06-21 19:37:51 +02:00
Nayeem Rahman 2ea41d3ac1
fix(core/modules): Prepare modules only once per runtime (#11015)
This commit changes module loading implementation in "deno_core"
to call "ModuleLoader::prepare" hook only once per entry point.

This is done to avoid multiple type checking of the same code
in case of duplicated dynamic imports.

Relevant code in "cli/module_graph.rs" was updated as well.
2021-06-19 16:14:43 +02:00
David Sherret aecf989d43
chore(lsp): add --parent-pid <pid> flag (#11023)
This commit adds a new `--parent-pid <pid>` flag to `deno lsp` that when provided starts a task that checks for the existence of the provided process id (ex. vscode's) every 30 seconds. If the process doesn't exist (meaning the deno process has nothing interacting with it), then it terminates itself.
2021-06-17 19:57:58 -04:00
Bartek Iwańczuk fe11495920
refactor: use join instead of format! (#10921) 2021-06-10 16:18:13 +02:00
Bartek Iwańczuk 6091ea098a
refactor: merge deno_file crate into deno_web (#10914)
This refactor makes it so there's one less crate to publish on each release.
2021-06-10 15:26:10 +02:00
Yusuke Tanaka 41e9a21307
fix(cli): output json with trailing newline character (#10830) 2021-06-03 20:49:02 +02:00
Bartek Iwańczuk ea2c7ac556
fix: running subcommand with coverage collection (#10802) 2021-05-31 16:53:49 +02:00
crowlKats b21fa78a1e
feat(cli): add origin data dir to deno info (#10589)
Co-authored-by: Nayeem Rahman <nayeemrmn99@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2021-05-27 14:23:12 +09:00
Bartek Iwańczuk e5beb800c9
refactor: move JsRuntimeInspector to deno_core (#10763)
This commit moves implementation of "JsRuntimeInspector" to "deno_core" crate.

To achieve that following changes were made:

* "Worker" and "WebWorker" no longer own instance of "JsRuntimeInspector",
instead it is now owned by "deno_core::JsRuntime".

* Consequently polling of inspector is no longer done in "Worker"/"WebWorker",
instead it's done in "deno_core::JsRuntime::poll_event_loop".

* "deno_core::JsRuntime::poll_event_loop" and "deno_core::JsRuntime::run_event_loop",
now accept "wait_for_inspector" boolean that tells if event loop should still be 
"pending" if there are active inspector sessions - this change fixes the problem 
that inspector disconnects from the frontend and process exits once the code has
stopped executing.
2021-05-26 21:07:12 +02:00
Bartek Iwańczuk e9edd7e14d
refactor: Rewrite Inspector implementation (#10725)
This commit refactors implementation of inspector.

The intention is to be able to move inspector implementation to "deno_core".

Following things were done to make that possible:

* "runtime/inspector.rs" was split into "runtime/inspector/mod.rs"
and "runtime/inspector/server.rs", separating inspector implementation
from Websocket server implementation.

* "DenoInspector" was renamed to "JsRuntimeInspector" and reference to "server"
was removed from the structure, making it independent of Websocket server
used to connect to Chrome Devtools.

* "WebsocketSession" was renamed to "InspectorSession" and rewritten in such
a way that it's not tied to Websockets anymore; instead it accepts a pair
of "proxy" channel ends that allow to integrate the session with different
"transports".

* "InspectorSession" was renamed to "LocalInspectorSession" to better indicate
that it's an "in-memory" session and doesn't require Websocket server. It was
also rewritten in such a way that it uses "InspectorSession" from previous point
instead of reimplementing "v8::inspector::ChannelImpl" trait; this is done by using
the "proxy" channels to communicate with the V8 session.

Consequently "LocalInspectorSession" is now a frontend to "InspectorSession". This
introduces a small inconvenience that awaiting responses for "LocalInspectorSession" requires
to concurrently poll worker's event loop. This arises from the fact that "InspectorSession"
is now owned by "JsRuntimeInspector", which in turn is owned by "Worker" or "WebWorker".
To ease this situation "Worker::with_event_loop" helper method was added, that takes
a future and concurrently polls it along with the event loop (using "tokio::select!" macro
inside a loop).
2021-05-26 17:47:33 +02:00
Ben Noordhuis af1546391c feat(extensions): BroadcastChannel WPT conformance
Replaces the file-backed provider by an in-memory one because proper
file locking is a hard problem that detracts from the proof of concept.

Teach the WPT runner how to extract tests from .html files because all
the relevant tests in test_util/wpt/webmessaging/broadcastchannel are
inside basics.html and interface.html.
2021-05-23 15:16:42 +02:00
Ben Noordhuis 8cf7f966f2 feat(extensions): add BroadcastChannel
Co-Authored-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixes: #10354
2021-05-23 15:16:42 +02:00
Yoshiya Hinosawa b3f2502b32
fix(test): ensure coverage dir exists (#10717) 2021-05-21 22:57:00 +09:00
Casper Beyer 42f76670fc
fix(cli): canonicalize coverage dir (#10364) 2021-05-19 15:33:22 +02:00
Luca Casonato 5151afa123
fix: static import permissions in dynamic imports
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-05-17 09:45:54 +02:00
Kitson Kelly 81f8585643
feat(lsp): add internal debugging logging (#10438)
Ref: #10368
2021-05-11 14:54:10 +10:00
Casper Beyer 36c5461129
feat(test): add support for type checking documentation (#10521)
This commit adds support for type checking codeblocks in the JS doc 
comments.
2021-05-11 01:54:39 +02:00
Bartek Iwańczuk ce48b32979
refactor(cli): replace loading file for --config flag with generic structure (#10481)
Currently file passed to --config file is parsed using TsConfig structure
that does multiple things when loading the file. Instead of relying on that
structure I've introduced ConfigFile structure that can be updated to
sniff out more fields from the config file in the future.
2021-05-10 18:16:39 +02:00
crowlKats dfe528198d
feat: add WebStorage API (#7819)
This commit introduces localStorage and sessionStorage.
2021-05-10 12:02:47 +02:00
Liam Murphy 7a9ebd1585
feat: add deno test --watch (#9160)
This commit implements file watching for deno test.

When a file is changed, only the test modules which 
use it as a dependency are rerun.

This is accomplished by reworking the file watching infrastructure 
to pass the paths which have changed to the resolver, and then 
constructing a module graph for each test module to check if it 
contains any changed files.
2021-05-10 08:06:13 +02:00
Luca Casonato f208e6a26f
chore: update wgpu and realign to spec (#9760) 2021-05-06 16:48:45 +02: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
Bartek Iwańczuk baf7092ea2
remove --unstable flag from CLI features (#10190) 2021-04-27 12:44:36 +02:00
Ryan Dahl f7c298e297
Remove denort optimization (#10350)
denort is an optimization to "deno compile" to produce slightly smaller
output. It's a decent idea, but causes a lot of negative side-effects:

- Deno's link time is a source of constant agony both locally and in CI,
  denort doubles link time.
- The release process is a long and arduous undertaking with many manual
  steps. denort necessitates an additional manual zip + upload from M1
  apple computers.
- The "deno compile" interface is complicated with the "--lite" option.
  This is confusing for uses ("why wouldn't you want lite?").

The benefits of this feature do not outweigh the negatives. We must find
a different approach to optimizing "deno compile" output.
2021-04-26 13:28:38 -04:00
Ryan Dahl 9c3da280e0
remove #![deny(warnings)] (#10376)
Prefer RUSTFLAGS="-D warnings" to prevent warnings, but cannot 
enable yet due to #10378.
2021-04-26 10:10:57 -04: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
Aaron O'Mullan 83bece56b0
refactor(core): move op cache sync responsibility to rust space (#10340)
Even if bootstrapping the JS runtime is low level, it's an abstraction leak of 
core to require users to call `Deno.core.ops()` in JS space.

So instead we're introducing a `JsRuntime::sync_ops_cache()` method, 
once we have runtime extensions a new runtime will ensure the ops 
cache is setup (for the provided extensions) and then loading/unloading 
plugins should be the only operations that require op cache syncs
2021-04-25 22:00:05 +02:00
Ben Noordhuis d46b37f6a8
feat(cli): raise file descriptor limit on startup (#10162)
Raise the soft limit to the hard limit when possible. This is similar
to what Node.js does to avoid running into "out of file descriptors"
errors too quickly.

On most Linux systems, raises the limit from 1,024 to 1,048,576.
On most macOS systems, raises the limit from 256 to 10,240.

Fixes #10148.
2021-04-13 10:24:45 -04:00
Kitson Kelly d9d4a5d73c
feat(lsp): add registry import auto-complete (#9934) 2021-04-09 11:27:27 +10:00
Luca Casonato 966ce7de8a
feat: blob URL support (#10045)
This commit adds blob URL support. Blob URLs are stored in a process
global storage, that can be accessed from all workers, and the module
loader. Blob URLs can be created using `URL.createObjectURL` and revoked
using `URL.revokeObjectURL`.

This commit does not add support for `fetch`ing blob URLs. This will be
added in a follow up commit.
2021-04-07 15:22:14 +02:00
Luca Casonato 00e63306cb
refactor: add deno_file op crate (#10019)
Also enables WPT for FileReader.
2021-04-06 12:55:05 +02:00
Ryan Dahl f46e39c5c5
remove macro_use (#9884) 2021-03-26 12:34:25 -04:00
Luca Casonato d5e0e8c0c2
fix: include deno.crypto in "deno types" (#9863) 2021-03-26 08:43:58 +01:00
Yusuke Tanaka e7954413e1
upgrade: Rust 1.51.0 (#9895) 2021-03-25 19:17:37 +01:00
Andrew Mitchell 277e19f4d2
fix(cli/bundle): display anyhow error chain (#9822) 2021-03-18 20:02:29 -04:00
Luca Casonato 0770449c93
refactor: move Console to op_crates/console (#9770) 2021-03-12 21:23:59 +01:00
Luca Casonato e83ff62ccb
chore: split web op crate (#9635)
This commit starts splitting out the deno_web op crate into multiple
smaller crates. This commit splits out WebIDL and URL API, but in the
future I want to split out each spec into its own crate. That means we
will have (in rough order of loading): `webidl`, `dom`, `streams`,
`console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and
`webgpu` crates.
2021-03-12 16:17:18 +01:00
Divy Srivastava 74584eef04
fix(cli/compile): do not append .exe depending on target (#9668) 2021-03-07 08:20:01 -05:00
Kitson Kelly 6dae627749
feat(cli): represent type dependencies in info (#9630)
Fixes #7927
2021-03-01 22:49:58 +11:00
crowlKats 7cd14f97c9
feat: WebGPU API (#7977)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-03-01 11:31:13 +01:00
Luca Casonato ff83df399a
fix: typo in coverage exit_unstable (#9626) 2021-03-01 01:25:43 +01:00
Ryan Dahl 07eb009044
Improve 'deno lsp' help text (#9610) 2021-02-26 15:51:25 +01:00
Liam Murphy cdae4423c2
feat(cli/doc): use type definitions "deno doc" if available (#8459)
This commit adds support for type definitions in "deno doc";
with this change "deno doc" is able to leverage the same directives
as TS compiler.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-02-25 16:24:05 +01:00
Casper Beyer ae8874b4b2
feat: add "deno coverage" subcommand (#8664)
This commit adds a new subcommand called "coverage" 
which can generate code coverage reports to stdout in 
multiple formats from code coverage profiles collected to disk.

Currently this supports outputting a pretty printed diff and 
the lcov format for interoperability with third-party services and tools.

Code coverage is still collected via other subcommands 
that run and collect code coverage such as 
"deno test --coverage=<directory>" but that command no 
longer prints a pretty printed report at the end of a test 
run with coverage collection enabled.

The restrictions on which files that can be reported on has 
also been relaxed and are fully controllable with the include 
and exclude regular expression flags on the coverage subcommand.

Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2021-02-24 15:27:51 +01:00
Satya Rohith 06fcfc5c0a
feat: add --ext flag to deno eval (#9295)
This PR deprecates the "--ts"/"-T" flag of "deno eval" (which will later be removed in 2.0)
and introduces "--ext" which is used by "deno fmt" for content type selection. 
This is to ensure we have a single flag that can be used across subcommands 
to select the language (JS/TS).
2021-02-21 17:58:32 +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 879897ada6
feat(cli): support auth tokens for accessing private modules (#9508)
Closes #5239
2021-02-16 13:50:27 +11:00
Satya Rohith 16036a8a51 feat: add markdown support to deno fmt (#8887)
This commit adds support for formatting markdown files with "deno fmt".

Additionally "--ext={js|jsx|ts|tsx|md}" flag was added to "deno fmt"
that allows to specify file type when providing contents over stdio.
2021-01-19 18:39:35 +01:00
Luca Casonato 4c223d0521
fix: panic during deno compile with no args (#9167) 2021-01-19 16:19:36 +01:00
Bartek Iwańczuk 9ff468df73
feat: Standalone lite binaries and cross compilation (#9141)
This commit adds --target and --lite flags to deno compile subcommand.

--target allows to cross-compile binary to different target architectures by
fetching appropriate binary from remote server on first run. All downloaded
binaries are stored in "$DENO_DIR/dl".

--lite allows to use lite version of the runtime (ie. the one that doesn't contain
built-in tooling like formatter or linter).
2021-01-19 03:40:22 +01:00
Casper Beyer f43855cead
fix(cli): print a newline after help and version (#9158) 2021-01-19 01:56:24 +01:00
Yusuke Tanaka d8fd71afdf
chore: update copyright to 2021 (#9092) 2021-01-11 18:13:41 +01:00
Luca Casonato 4361895476
fix: don't error on version and help flag (#9064) 2021-01-09 13:08:03 +01:00
Luca Casonato a44349dfdf
feat: denort binary (#9041)
This commit adds new binary target called "denort".

It is a "lite" version of "deno" binary that can only execute
code embedded inside the binary itself.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-01-08 03:08:51 +01:00
Nayeem Rahman e61e81eb57
feat: add --location=<href> and globalThis.location (#7369) 2021-01-07 19:06:08 +01:00
Casper Beyer f8df9938c5
fix(coverage): do not store source inline in raw reports (#9025)
When we were doing single process in-memory reports getting the source
from the runtime was practical, but now that we're writing to disk this
conflicts with the format tools taking raw v8 coverage dumps expect.
2021-01-07 05:53:57 -05:00
Steven Guerrero adc2f08c17
feat: Add configurable permissions for Workers (#8215)
This commit adds new option to "Worker" Web API that allows to 
configure permissions.

New "Worker.deno.permissions" option can be used to define limited
permissions to the worker thread by either:
- inherit set of parent thread permissions
- use limited subset of parent thread permissions
- revoke all permissions (full sandbox)

In order to achieve this functionality "CliModuleLoader"
was modified to accept "initial permissions", which are used
for top module loading (ie. uses parent thread permission set
to load top level module of a worker).
2021-01-06 21:31:16 +01:00
Luca Casonato 2e18fcebcc
refactor: move WebSocket API to an op_crate (#9026) 2021-01-06 16:57:28 +01:00
Bartek Iwańczuk bb88418221
refactor(cli): remove 'js' module, simplify compiler snapshot (#9020)
This commit removes "js" module from "cli".

It contained stuff related to TypeScript compiler (snapshot,
declaration files) and thus it was moved to "tsc" module.
2021-01-06 02:38:23 +01:00
Nayeem Rahman cbc2108525
feat(cli/standalone): support runtime flags for deno compile (#8738) 2021-01-05 00:15:52 +01:00
Kitson Kelly 8011eced14
feat(lsp): add cache command (#8911) 2020-12-30 15:17:17 +11:00
Yusuke Tanaka d5f3a749eb
refactor(cli/flags): change allow_read/write/net types from bool to Option<Vec<T>> (#8896)
This PR refactors "cli/flags.rs" and "runtime/permissions.rs" so 
that "allow_read", "allow_write" and "allow_net" themselves
have allowlists, instead of storing them in additional fields.
2020-12-29 19:34:35 +01:00
Casper Beyer 091059450e
feat(unstable): collect coverage from the run command (#8893)
This adds implicit coverage collection to the run command 
when a coverage collection directory is set (via an environment 
variable).
2020-12-28 16:51:26 +01:00
Luca Casonato bd85d0ed42
refactor: rewrite lsp to be async (#8727)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
2020-12-21 08:44:26 -05:00
Casper Beyer 3078fcf55a
feat(unstable): record raw coverage into a directory (#8642) 2020-12-21 14:04:25 +01: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
Kitson Kelly 301d3e4b68
feat: add mvp language server (#8515)
Resolves #8400
2020-12-07 21:46:39 +11:00
crowlKats 7135d34cca
refactor(cli): remove Option from Flags.v8_flags (#8633) 2020-12-06 18:19:21 +01:00
Nayeem Rahman 108972c966
chore(cli/flags): Use deno compile --output for the out file (#8563) 2020-12-01 15:11:02 +01:00
Luca Casonato 6aa692fece
feat: deno compile (#8539) 2020-11-30 20:35:12 +01:00
crowlKats 973af61d8b
feat(cli/tools/upgrade): canary support (#8476) 2020-11-29 20:00:35 +01:00
Yusuke Tanaka d9b4182868
fix(watcher): watcher doesn't exit when module resolution fails (#8521)
This commit makes the file watcher continue to work even if module
resolution fails at the initial attempt, allowing us to execute `run`
or `bundle` subcommand when a script has invalid syntax. In such
cases, the watcher observes a single file that is specified as an
command line argument.
2020-11-28 15:18:13 +01: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
Yusuke Tanaka e3f73d3ec0
feat(unstable): Support --watch flag for bundle and fmt subcommands (#8276)
This commit adds support for "--watch" flag for "bundle" 
and "fmt" subcommands.

In addition to this, it refactors "run --watch" command so that
module resolution will occur every time the file watcher detects 
file addition/deletion, which allows the watcher to observe a file 
that is newly added to the dependency as well.
2020-11-22 21:45:44 +01: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 9eaa1fb71d
refactor(cli): move tooling to cli/tools/ (#8424)
This commit moves following tools into a single "tools"
module located at "cli/tools/mod.rs":
- formatter 
- linter
- test runner
- coverage collector
- installer
- binary upgrader
- repl
2020-11-19 19:19:34 +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
Bartek Iwańczuk 2cbf5c26ac
feat(lint): support --rules --json (#8384)
This commit adds support for "--json" flag in combination
with "--rules". List of rules is serialized to JSON and printed.
2020-11-14 20:51:30 +01:00
Max Drosdo.www 444c2cda4f
refactor(cli): minor cleanup of main.rs (#8362) 2020-11-13 08:49:59 +11:00
KNnut aaf7166a9d
refactor(cli): remove unnecessary format! calls (#8315) 2020-11-09 15:38:29 +01:00
Bartek Iwańczuk a269dffe17
chore: remove dead code (#8298) 2020-11-08 23:35:36 +01:00
Kitson Kelly 96e03e0b93
refactor(cli): refactor file_fetcher (#8245) 2020-11-06 11:38:21 +11:00
Bartek Iwańczuk c3dd19c5d3
refactor(cli): remove ProgramState::permissions (#8228)
This commit removes ProgramState::permissions field.

Having permissions parsed from CLI flags stored on globally
accessible state object made it easy to mistakenly use these
permissions in situations which required "runtime" permissions.
2020-11-02 23:37:55 +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
Luca Casonato 8d99adb6c4
refactor: don't spin up V8 for deno cache (#8186) 2020-10-29 14:19:55 +01:00
Kitson Kelly 6844caa9a5
fix(cli): restore tripleslash lib refs support (#8157)
Fixes #8147
2020-10-28 11:52:20 +11:00
Ryan Dahl c4d33e8d77
fix: Use -rw-r--r-- for cache files (#8132) 2020-10-26 12:58:58 -04:00
Bartek Iwańczuk aebbdd5cc2
Revert "feat(lint): stabilize "deno lint" subcommand (#8075)" (#8128)
This reverts commit c5c48f845a.
2020-10-26 13:36:13 +01:00
Bartek Iwańczuk 95854b88ad
refactor(run): use new module graph for run --watch (#8085)
This commit changes how "deno run --watch" is implemented
by migrating to use ModuleGraph2.
2020-10-25 01:27:00 +02:00
Bartek Iwańczuk 35f184cdcc
refactor: use of lock file in ModuleGraph2 (#8087) 2020-10-23 23:01:54 +02:00
Bartek Iwańczuk 9d36331278
Revert "feat(cli): Add deno cache --test and --worker (#7920)" (#8089)
This reverts commit be15cf285d.
2020-10-23 16:56:25 +02:00
Nayeem Rahman be15cf285d
feat(cli): Add deno cache --test and --worker (#7920) 2020-10-23 13:31:49 +02:00
Kitson Kelly ab898556a4
refactor(cli): move bundle check to new infrastructure (#8071) 2020-10-23 22:05:41 +11: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
Bartek Iwańczuk c5c48f845a
feat(lint): stabilize "deno lint" subcommand (#8075)
This commit stabilizes "deno lint" by removing
the need to pass --unstable flag.

--unstable is still required when using --json flag.
2020-10-22 21:52:37 +02:00
Akshat Agarwal d6c824a6c3
refactor(cli): use PathBuf instead of String for lint and fmt subcommands (#8042) 2020-10-21 13:12:01 +02:00
Kitson Kelly 57e95032c8
feat(cli): add support for bundle --no-check (#8023)
Fixes #6686
2020-10-20 14:10:42 +11:00
Absebo 1474d5d76d
fix(cli): Handling of relative importmaps while using watch (#7950) 2020-10-19 23:53:39 +02:00
Nayeem Rahman 3f5513758d
feat(cli/installer): Add missing flags for deno install (#7601)
This commit adds support for following flags:
- deno install --importmap
- deno install --no-remote
- deno install --lock
- deno install --lock-write
- deno install --cached-only
- deno install --v8-flags
- deno install --seed
2020-10-19 21:19:20 +02:00
Kitson Kelly 10654fa955
refactor(cli): add tsc2 (#7942)
Ref #7225
2020-10-14 10:52:49 +11: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
Kitson Kelly e877b36072
refactor(cli): move info subcommand over to new module graph (#7892) 2020-10-12 13:25:27 +11:00
Valentin Anger fede13f2eb
feat(cli): support importmap flag with deno doc subcommand (#7821)
Fixes #7783
2020-10-12 10:05:46 +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
Kitson Kelly 99aa23b8dd
refactor(cli): remove TextDocument (#7850) 2020-10-07 22:43:44 +11:00
Kitson Kelly 7ab645f512
refactor(cli): cleanups to new module graph (#7846) 2020-10-07 16:24:15 +11:00
Casper Beyer 21965e8a96
refactor(cli/repl): tightly integrate event loop (#7834) 2020-10-06 13:50:48 +02:00
Casper Beyer c191ca1aeb
fix(cli/repl): put the thread to sleep when idle (#7804) 2020-10-03 12:51:25 +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
Casper Beyer 6587d1bce8
fix(cli/test): do not start inspector server when collecting coverage (#7718) 2020-09-28 12:22:29 +02:00
Bartek Iwańczuk 45d4fd44c9
refactor: move op state registration to workers (#7696) 2020-09-28 12:14:11 +02:00
Nayeem Rahman 8cbf0e75b2
fix: Use $deno$test.ts instead of .deno.test.ts (#7717) 2020-09-27 14:21:11 -04:00
Bartek Iwańczuk f64a44810e
refactor: combine MainWorker::new and MainWorker::create (#7693)
* combine MainWorker::new and MainWorker::create

* remove compiler_starts fields

* make op_state types explicit for readability
2020-09-26 18:16:33 +02:00
Kitson Kelly c489589e2b
refactor: new module graph used for no check (#7621) 2020-09-25 08:31:17 +10:00
Casper Beyer 6254bd41b7
fix(cli/coverage): print lines with no coverage to stdout (#7640) 2020-09-23 14:12:24 -04:00
bartOssh 29dd62b08c
fix(watch): watch importmap file for changes (#7580) 2020-09-23 13:56:16 +02:00
Yusuke Tanaka c30c782c2c
fix(logger): change log level to which prefix added (#7582) 2020-09-22 11:08:10 -04:00
Casper Beyer cca8856fbf
refactor(cli/coverage): remove dependency on global state (#7616)
This removes the dependency on global state and instead relies on the
runtime's internal state to get the script sources it saw when it
collected code coverage for them.
2020-09-22 13:59:02 +10:00
Bartek Iwańczuk 92edc36442
refactor: use futures and serde_json from deno_core (#7614) 2020-09-21 18:36:37 +02:00
Nayeem Rahman 0a9d7e4e39
fix(cli/installer): Don't reload by default (#7596) 2020-09-20 14:05:11 +02: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
Ryan Dahl 8edf099485
publish deno_fetch during CI (#7557) 2020-09-18 12:31:30 -04:00
Bartek Iwańczuk 7845740637
refactor: deno_fetch op crate (#7524) 2020-09-18 09:20:55 -04:00
Bartek Iwańczuk d245ececb6
fix: disable rustyline logs (#7535) 2020-09-17 20:38:57 +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
Bert Belder 21f2e45b0d
Revert "feat(install): bundle before installation" (#7522)
This reverts the changes introduced by PR #5276, which made
`deno install «script»` automatically bundle the script's dependencies.
It broke the `deno install` command for a large number of scripts.

This reverts commit 34e98fa59c.

Closes: #7492
2020-09-16 18:41:58 +02:00
bartOssh 81ca7096c5
refactor(unstable): deno info --json output (#7417)
Provide flat JSON structured output.

Fix BrokenPipe error when piping out to "head".
2020-09-16 15:38:38 +02:00
Ryan Dahl b2fa903d64 cli/msg.rs -> cli/media_type.rs 2020-09-15 11:55:51 -04:00
Bert Belder f5b40c918c
refactor: use the 'anyhow' crate instead of 'ErrBox' (#7476) 2020-09-15 01:50:52 +02:00
Bert Belder 3da20d19a1
chore: fix clippy warnings (#7476) 2020-09-15 00:11:20 +02:00
Kitson Kelly a6f34d4722
refactor: use ParsedModule and improve MediaTypes enum (#7456) 2020-09-14 14:27:44 +02:00
Casper Beyer 755cfa98eb
feat(unstable): deno test --coverage (#6901)
This commit adds basic support for collecting coverage
data using "deno test". 

Currently the report is only a text added to the end
of output from "deno test".
2020-09-13 15:01:30 +02:00
Nayeem Rahman 5276cc8592
refactor: Improve placeholder module names (#7430) 2020-09-12 11:33:51 +02:00
Bartek Iwańczuk 60dbc6b294
Revert "feat(unstable): Support data: urls (#5157)" (#7432)
This reverts commit e3319f34a6.
2020-09-12 11:08:00 +02:00
Valentin Anger e3319f34a6
feat(unstable): Support data: urls (#5157) 2020-09-11 22:40:48 +02:00
Bartek Iwańczuk a3282aa9ed
feat(unstable): deno run --watch (#7382)
Co-authored-by: Sebastian Seedorf <mail@sebse.de>
2020-09-11 18:19:49 +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
KrisChambers 1cd2267500
feat(info): Dependency count and sizes (#6786)
This commit changes "deno info" subcommand logic.

- Modules are no longer loaded into V8 isolate - analysis
  is done using ModuleGraph.
- Removed deno_core::Deps structure.
- Modules are no longer type-checked and transpiled - 
  "compiled" file is shown only if it is already available.
- Added number of unique dependencies for root module.
- Changed tree output:
  - file size is shown next to the dependency
  - repeated dependencies are marked with "*"
  - used less spaces in prefix to save terminal width
2020-09-07 15:59:47 +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
Bartek Iwańczuk 803bdd37c7
refactor(core): merge CoreIsolate and EsIsolate (#7370) 2020-09-06 16:50:49 +02:00
Bert Belder c821e8f2f1
Move JSON ops to deno_core (#7336) 2020-09-06 02:34:02 +02:00
Yoshiya Hinosawa 34e98fa59c
feat(install): bundle before installation (#5276) 2020-09-05 13:31:14 +02:00
tokiedokie fcee4265c6
support env_logger / RUST_LOG (#7142) 2020-09-03 16:16:49 -04:00
Bartek Iwańczuk c82c3b982e
refactor: Compiler config in Rust (#7228)
* port tsc_config.rs

* cleanup options

* bring back allowNonTsExtension

* try

* fix test

* fix test2

* move config for bundling

* remove Transpile compile request

* remove dead code

* remove more dead code

* remove checkJs regex

* fix

* handle config str for runtime APIs

* lint

* runtimeCompile config in Rust

* runtimeCompile and runtimeTranspile config in Rust

* fix

* remove lint supression

* upgrade: jsonc-parser 0.13.0

* remove unneeded to_string()

* upgrade: jsonc-parser 0.14.0

* remove AsRef<str>
2020-08-31 20:12:24 +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
Bartek Iwańczuk 2600d5ac09
fix(doc): stack overflow for .d.ts files (#7167) 2020-08-23 15:48:35 +02:00
Bartek Iwańczuk be1e7ab532
refactor: move cli/doc/ to separate crate (#7103) 2020-08-19 19:13:43 +02:00
Bert Belder 27f4aeb924
Make Rc/Arc wrapper around State/GlobalState visible (#7104) 2020-08-19 02:01:48 +02:00
souldzin d6cee70695
feat: Add "--json" flag to deno lint (#6940)
Co-authored-by: JackSkylark <jdslaughter44@gmail.com>
2020-08-13 17:30:46 +02:00
Divy Srivastava 6706eb5515
feat: add "--ignore" to deno lint (#6934) 2020-08-12 15:47:44 +02:00
Valentin Anger d7077b9073
doc: Remove detailed / summary distinction (#6818) 2020-08-11 11:06:55 +02:00
Bartek Iwańczuk 6fcf06306e
feat(doc): handle imports (#6987)
This commit adds additional objects to JSON output
of "deno doc" command to facilitate linking between 
types in different modules.
2020-08-10 17:41:19 +02:00
Bert Belder f22b7dc783
fix(cli): show error on unrecognized V8 flag, exit on --help (#6980) 2020-08-08 21:23:21 +02:00
Bartek Iwańczuk 41215eb29c
Op crate for Web APIs (#6906)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-08-07 16:55:02 +02:00
Bartek Iwańczuk 55ea9c7e85
refactor: remove repeated code in main.rs (#6954) 2020-08-04 16:08:41 +02:00
Maayan Hanin 5fc5e7b54a
fix(cli): add support for non-UTF8 source files (#6789)
Fixes: #5542
2020-08-03 23:39:48 +02:00
Bartek Iwańczuk b718e6ff53
upgrade: deno_lint, dprint, swc (#6928)
This commit upgrades:
deno_lint 0.1.20
dprint-plugin-typescript 0.25.0
swc_ecmascript 0.1.0

SWC is no longer reexported from dprint nor deno_lint.
2020-07-31 16:59:22 +02:00
Divy Srivastava 0da4779b17
feat(unstable): add "--ignore" flag to deno fmt (#6890) 2020-07-30 12:09:08 -04:00
Ryan Dahl 2460689b1a
Remove deno_typescript (#6813) 2020-07-20 19:49:57 -04:00
Bartek Iwańczuk 98e0ed54db
fix: ModuleSpecifier removes relative path parts (#6762) 2020-07-16 10:53:07 +02:00
Valentin Anger 3374c73fba
feat(doc): Improve terminal printer (#6594)
- Add more support for generics
- Add the --private flag - displays documentation for
  not exported and private nodes
- Display more attributes like abstract, static and readonly
- Display type aliases
- Refactor module to use the Display trait
- Use a bit more color
2020-07-12 14:16:33 +02:00
Bartek Iwańczuk 98f6a5a47d
chore: upgrade deno_lint, remove direct dprint dep (#6679)
This PR removes direct dependency on dprint-plugin-typescript 
and swc_ecma_visit. Both of these dependencies have been 
pushed out to deno_lint crate. This should make it a bit easier 
to do the upgrades and prevent having conflicting crate requirements.
2020-07-11 11:47:06 +02:00
Emmanuel cbbd944359
feat(cli): json option for "deno info" (#6372) 2020-07-08 10:50:12 -04:00
crowlKats 2b52e3daf1
feat: deno upgrade --output (#6352) 2020-07-06 18:21:26 -04:00
Jacob Gee-Clarke 79610378d3
feat(cli): Added support for the --cert flag with 'deno upgrade' (#6609) 2020-07-05 23:58:23 -04:00
Bartek Iwańczuk cc12e86fe3
refactor: lock file (#6569)
- refactor lock file creation
- provide deterministic output in lock file (alphabetically sorted)
- dynamic imports are checked against lock file
2020-07-02 17:54:51 +02:00
Kitson Kelly 062d1a41ea
refactor: Improvements to TsCompiler and its tests (#6576) 2020-06-30 13:10:51 +02:00
Valentin Anger db36857288
refactor: util functions take slices instead of heap values (#6547) 2020-06-29 14:17:37 +02:00
Bartek Iwańczuk 4817c153e4
Re-land "fix(cli): ipv6 parsing for --allow-net params" (#6472)
With some minor adjustments
2020-06-26 08:09:02 -04:00
Bartek Iwańczuk 6bbe52fba3
Revert "fix(cli): ipv6 parsing for --allow-net params (#6453)" (#6458) 2020-06-25 00:41:13 +02:00
Colin Harrington 702547d65a
fix(cli): ipv6 parsing for --allow-net params (#6453)
Co-authored-by: Liming Jin <jinliming2@gmail.com>
2020-06-24 09:43:29 -04:00
Kitson Kelly 1d8fc39494
Add ability to output compiler performance information (#6434) 2020-06-24 11:58:23 +02: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
Bartek Iwańczuk 90c5dcfe79
chore(test): move testing utilities to test_util crate (#6360) 2020-06-18 11:54:55 -04:00
Bartek Iwańczuk 07bf90779b
feat(lint): add --rules flag (#6264) 2020-06-12 16:42:12 +02:00
Bartek Iwańczuk e7054d50f0
update: deno_lint to v0.1.10 (#6248)
* update: deno lint to v0.1.10

* Parallelize "deno lint" subcommand
2020-06-12 01:44:17 +02:00
Jaap Aarts 5ee2ce1b1c
feat: allow reading the entry file from stdin (#6130) 2020-06-11 10:58:09 -04:00
Bartek Iwańczuk e4e332abbb
feat(lint): use default globs, upgrade to v0.1.9 (#6222)
This commit:
* added default file globs so "deno lint" can be run
without arguments (just like "deno fmt")
* added test for globs in "deno lint"
* upgrade "deno_lint" crate to v0.1.9
2020-06-10 23:29:48 +02:00
Bartek Iwańczuk 8366f36873
upgrade: deno_lint v0.1.8 (#6208) 2020-06-09 18:40:08 +02:00
uki00a 2b2d800b43
feat(doc): display all overloads in cli details view (#6186) 2020-06-09 14:12:47 +02:00
Bartek Iwańczuk 0e9da7e731
feat: "deno lint" subcommand (#6125) 2020-06-08 14:06:20 +02:00
Filippo Rossi 78333f0ab3 Add diff for "deno fmt --check" (#5599) 2020-06-06 09:07:59 -04:00
Ryan Dahl 8a4533eb75 feat: deno eval -p (#5682) 2020-06-06 09:07:59 -04:00
Ryan Dahl e3cc3db20f
Revert "feat: format deno bundle output (#5139)" (#6085)
This reverts commit 93cf3bd534.
2020-06-04 08:36:25 -04:00
Ryan Dahl 8b1b4766a1
Move create_main_worker to MainWorker::create (#6034) 2020-06-01 22:44:17 -04:00
Ali Hasani 30785ed592
fix(bundle): better size output (#5997) 2020-06-01 18:42:12 -04:00
Ryan Dahl d4b05dd89e
refactor: Split isolate and state using safe get_slot() (#5929) 2020-05-29 17:41:39 -04:00
Bartek Iwańczuk ad6d2a7734
refactor: TS compiler and module graph (#5817)
This PR addresses many problems with module graph loading
introduced in #5029, as well as many long standing issues.

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

Basic dependency tracking for TS compilation has been implemented.

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

Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-05-29 16:32:15 +02:00
Adam Odziemkowski 958f21e7ab
fix(cli): write lock file before running any code (#5794) 2020-05-29 02:43:31 -04:00
Bartek Iwańczuk 8799855fdc
refactor: reorganize TS compiler (#5603) 2020-05-20 16:25:40 +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