Commit graph

520 commits

Author SHA1 Message Date
David Sherret e7367044d9
feat: binary npm commands (#15542) 2022-08-23 10:39:19 -04:00
David Sherret 7a1a082876
perf: cache swc dependency analysis and don't hold onto ParsedSources in memory (#15502) 2022-08-22 12:14:59 -04:00
Mathias Lafeldt e96933bc16
chore: use Rust 1.63.0 (#15464) 2022-08-21 19:31:14 +02:00
David Sherret 87f80ff6be
feat(unstable): initial support for npm specifiers (#15484)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 11:31:33 -04:00
Leo Kettmeir 1ffbd56164
feat: add "deno init" subcommand (#15469)
This adds an init subcommand to that creates a project starter similar to cargo init.

```
$ deno init my_project
Project initialized
Run these commands to get started:
  cd my_project
  deno run main.ts
  deno run main_test.ts
$ deno run main.ts
Add 2 + 3 5
$ cat main.ts
export function add(a: number, b: number): number {
  return a + b;
}
if (import.meta.main) {
  console.log("Add 2 + 3", add(2, 3));
}
$ cat main_test.ts
import { assertEquals } from "https://deno.land/std@0.151.0/testing/asserts.ts";
import { add } from "./main.ts";
Deno.test(function addTest() {
    assertEquals(add(2, 3), 5);
});
```

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-08-20 01:37:05 +02:00
David Sherret 8eed24cd3d
fix(coverage): ensure coverage is only collected in certain situations (#15467) 2022-08-12 15:21:17 -04:00
David Sherret c3b04683c5
refactor(cli): consolidate most MainWorker related code to the same place (#15459) 2022-08-11 16:59:12 -04:00
David Sherret 321a42d1fb
refactor(runtime): split up MainWorker and WebWorker's preload_module method into two separate methods (#15451) 2022-08-10 18:10:51 -04:00
David Sherret d9fae38d1e
feat: add initial internal npm client and dependency resolver (#15446) 2022-08-10 15:23:58 -04:00
Leo Kettmeir d0ffa0beb5
fix(permissions): ignore empty values (#15447) 2022-08-10 21:13:53 +02:00
David Sherret 0ab262b901
feat: emit files on demand and fix racy emit (#15220) 2022-07-19 11:58:18 -04:00
orvit dbf5e95b59
refactor: remove redundant qualification of symbols in Rust (#15201) 2022-07-15 07:52:44 +10:00
Nayeem Rahman c2770c70b7
chore(cli): remove dead code related to previous tsc emit (#15196) 2022-07-13 15:38:36 -04:00
David Sherret 698eeb90fd
fix: fallback to no type checking cache when db file can't be created (#15180) 2022-07-12 22:44:15 -04:00
David Sherret 0c87dd1e98
perf: use emit from swc instead of tsc (#15118) 2022-07-12 18:58:39 -04:00
cuobiezi 83818c914b
refactor: rename run_basic to run_local (#15068) 2022-07-11 19:02:23 +02:00
Bartek Iwańczuk a919a5dd11
Revert "refactor(snapshots): to their own crate (#14794)" (#15076)
This reverts commit fd5a12d7e2.
2022-07-05 00:12:41 +02:00
David Sherret 95d2f206fc
refactor: extract deno_graph::create_graph use to common function (#15009) 2022-07-01 11:50:16 -04:00
David Sherret e46584a75a
fix(vendor): ignore import map in output directory instead of erroring (#14998) 2022-06-29 20:41:48 -04:00
David Sherret 8c4420c005
refactor: rename RootConfig to CliOptions (#15007) 2022-06-29 11:51:11 -04:00
David Sherret 01adbb1efb
refactor: add RootConfig (#14985) 2022-06-28 16:45:55 -04:00
Colin Ihrig 0f6a5c5fc2
feat(web): add beforeunload event (#14830)
This commit adds the 'beforeunload' event.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-28 10:49:30 -04:00
David Sherret e1c90963fb
refactor: create args folder (#14982) 2022-06-27 16:54:09 -04:00
Divy Srivastava 18c9a7ad64
fix(core): don't panic on non-existent cwd (#14957)
Co-authored-by: cjihrig <cjihrig@gmail.com>
2022-06-25 09:21:58 +05:30
Aaron O'Mullan fd5a12d7e2
refactor(snapshots): to their own crate (#14794)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-06-24 15:04:45 +02:00
David Sherret a7339f756c
refactor: add EmitCache trait (#14925) 2022-06-20 17:59:52 -04:00
Bartek Iwańczuk fc3a966a2d
Deno.exit() is an alias to self.close() in worker contexts (#14826)
This commit changes Deno.exit() to be an alias to self.close() in worker contexts,
and the provided exit code becomes is ignored.
2022-06-13 23:53:04 +02:00
Bartek Iwańczuk 4a0a412d7c
feat: no type-check by default (#14691)
This commit changes default default behavior of type checking
for several subcommands.

Instead of type checking and reporting type errors only for local
files, the type checking is skipped entirely. Type checking can
still be enabled using the "--check" flag.

Following subcomands are affected:
- deno cache
- deno install
- deno eval
- deno run
2022-06-13 23:13:16 +02:00
Bartek Iwańczuk ba13b8e2a9
refactor: ensure exit code reference is passed to all workers (#14814) 2022-06-08 17:45:38 +02:00
Bartek Iwańczuk 2769d60250
fix: watch dynamic imports in --watch (#14775)
Fix dynamic imports being watched in the watcher when using `--watch`.
2022-06-08 12:07:25 +02:00
David Sherret 0cfdf5cede
refactor: use deno_emit (#14737) 2022-05-30 09:39:14 -04:00
David Sherret 1fcecb6789
refactor: upgrade to deno_ast 0.15 (#14680) 2022-05-20 16:40:55 -04:00
Bartek Iwańczuk 9a85a95c43
feat: subcommands type-check only local files by default (#14623)
This commit changes default mode of type-checking to "local" 
and adds "--check" flag to following subcommands:
- deno bench
- deno bundle
- deno cache
- deno compile
- deno eval
- deno install
- deno test
2022-05-17 23:53:42 +02:00
Nayeem Rahman 330c820ae8
BREAKING(unstable): Enable Deno namespace in workers by default (#14581)
This commit removes "WorkerOptions.deno" option as a boolean,
as well as "WorkerOptions.deno.namespace" settings. Starting
with this commit all workers have access to "Deno" namespace
by default.
2022-05-17 22:27:17 +02:00
Bartek Iwańczuk f57aac77ff
BREAKING: Remove unstable Deno.emit and Deno.formatDiagnostics APIs (#14463) 2022-05-17 13:50:31 -04:00
randomicon00 f82a79ffdb
feat: add userAgent property to Navigator's prototype (#14415) 2022-05-14 12:00:02 +02:00
Nayeem Rahman 9853c96cc4
refactor: Remove PrettyJsError and js_error_create_fn (#14378)
This commit:
- removes "fmt_errors::PrettyJsError" in favor of "format_js_error" fn
- removes "deno_core::JsError::create" and 
"deno_core::RuntimeOptions::js_error_create_fn"
- adds new option to "deno_runtime::ops::worker_host::init"
2022-04-27 01:06:10 +02:00
David Sherret 58eab0e2b3
fix(test): capture worker stdout and stderr in test output (#14410) 2022-04-26 19:00:04 -04:00
Naju Mancheril 3833d37b15
feat(repl): add "--eval-file" flag to execute a script file on startup (#14247)
This commit adds support for "--eval-file" in "deno repl" subcommand.

This flag can be used to pass paths or URLs to files, that will be executed
on REPL startup. All files will be executed in the same context as the REPL
(ie. as "plain old scripts", not ES modules), sharing the global scope.

This feature allows to implement custom REPLs on top of Deno's REPL.
2022-04-20 14:16:37 +02:00
David Sherret ae479b1036
perf(fmt/lint): incremental formatting and linting (#14314) 2022-04-19 22:14:00 -04:00
Luca Casonato 803499886b
Remove the DENO_FUTURE_CHECK warning (#14320)
It has good intentions, but it is a really terrible user experience. As
such we shouldn't print this warning.
2022-04-19 17:08:23 +02:00
Nayeem Rahman 8b31fc23cd
refactor: Move source map lookups to core (#14274)
The following transformations gradually faced by "JsError" have all been 
moved up front to "JsError::from_v8_exception()": 

- finding the first non-"deno:" source line; 
- moving "JsError::script_resource_name" etc. into the first error stack 
in case of syntax errors; 
- source mapping "JsError::script_resource_name" etc. when wrapping 
the error even though the frame locations are source mapped earlier; 
- removing "JsError::{script_resource_name,line_number,start_column,end_column}"
entirely in favour of "js_error.frames.get(0)". 

We also no longer pass a js-side callback to "core/02_error.js" from cli. 
I avoided doing this on previous occasions because the source map lookups 
were in an awkward place.
2022-04-15 16:08:09 +02:00
Bartek Iwańczuk 8ae17026cb
feat: Add "deno check" subcommand for type checking (#14072)
This commit adds new "deno check" subcommand.
Currently it is an alias for "deno cache" with the difference that remote
modules don't emit TS diagnostics by default.

Prints warning for "deno run" subcommand if "--check" flag is not present
and there's no "--no-check" flag. Adds "DENO_FUTURE_CHECK" env
variable that allows to opt into new behavior now.
2022-04-11 01:12:51 +02:00
Bartek Iwańczuk 381d565acf
refactor(flags): rename CheckFlag to TypecheckMode (#14111) 2022-03-29 03:48:29 +02:00
David Sherret 89dd5dac62
chore: fix compile_windows_ext test (#14142) 2022-03-28 14:38:15 -04:00
Robert 2262097141
chore: update clap and completions (#14136) 2022-03-28 03:57:56 +02:00
Bartek Iwańczuk 09ae512ccb
feat: "deno bench" subcommand (#13713)
This commit adds "deno bench" subcommand and "Deno.bench()"
API that allows to register bench cases. 

The API is modelled after "Deno.test()" and "deno test" subcommand.

Currently the output is rudimentary and bench cases and not
subject to "ops" and "resource" sanitizers.

Co-authored-by: evan <github@evan.lol>
2022-03-11 23:07:02 +01:00
Bartek Iwańczuk 47f22777be
feat: "deno task" subcommand (#13725)
Co-authored-by: David Sherret <dsherret@gmail.com>
2022-03-10 20:56:14 -05:00
Bartek Iwańczuk 808f797633
fix(compat): cjs/esm interop for dynamic imports (#13792)
This commit fixes CJS/ESM interop in compat mode for dynamically
imported modules.

"ProcState::prepare_module_load" was changed to accept a list
of "graph roots" without associated "module kind". That module kind
was always hardcoded to "ESM" which is not true for CJS/ESM interop -
a CommonJs module might be imported using "import()" function. In
such case the root of the graph should have "CommonJs" module kind
instead of "ESM".
2022-03-11 02:33:02 +01:00
Geert-Jan Zwiers 38e88e32b7
fix(info): print deno info paths with unescaped backslashes on windows (#13847) 2022-03-10 19:57:57 -05:00
Bartek Iwańczuk 22dbbf75f3
refactor: add cli/display.rs module (#13879) 2022-03-09 00:19:02 +01:00
Antonio Musolino 6a030a5396
fix(runtime): disable console color for non tty stdout (#13782) 2022-03-01 12:37:50 +09:00
David Sherret 3b12afd072
chore: upgrade to Rust 1.59 (#13767) 2022-02-24 20:03:12 -05:00
Divy Srivastava 03c55b4970
fix(compile): Support import maps (#13756) 2022-02-24 18:58:00 +05:30
Kitson Kelly ee27b9dd7e
feat: allow specification of import map in config file (#13739)
Closes: #12800
2022-02-23 10:51:14 +11:00
David Sherret b98afb59ae
feat: deno vendor (#13670) 2022-02-16 13:14:19 -05:00
William Tetlow 7b893bd57f
feat(cli): Replace bundling with eszip in deno compile (#13563)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-02-15 18:03:46 +05:30
Maxim 65de5fb465
refactor: use Arc instead of making copies of Flags struct (#13610) 2022-02-11 14:04:31 -05:00
Bartek Iwańczuk 2fa0096821
compat: support --compat in web workers (#13629)
Adds another callback to WebWorkerOptions that allows to execute
some modules before actual worker code executes. This allows to set up Node
global using std/node.
2022-02-11 13:41:56 +01:00
Leo Kettmeir 4799aaac15
refactor: factor out CDP message types (#13551) 2022-02-07 17:05:49 +01:00
Kitson Kelly 7d356250e8
refactor: integrate deno_graph breaking changes (#13495)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2022-02-01 09:33:57 +11:00
Zheyu Zhang 5490cfed20
feat(cli): add "--no-clear-screen" flag (#13454)
This commit adds "--no-clear-screen" flag which can be used
with "--watch" flag to disable clearing of terminal screen on
each file change.
2022-01-31 17:39:39 +01:00
Bartek Iwańczuk b7b6b9c9e5
Revert "refactor: factor out CDP message types (#13501)" (#13540)
This reverts commit 382a978859.
2022-01-31 14:00:18 +01:00
Leo Kettmeir 382a978859
refactor: factor out CDP message types (#13501) 2022-01-27 15:09:47 +01:00
Leo Kettmeir e650165e80
chore: upgrade clap to v3 (#13266) 2022-01-14 17:38:17 +01:00
David Sherret f12164646b
refactor: move transpiling to deno_ast (#13332) 2022-01-13 11:58:00 -05:00
juju 50e8ab8a86
feat(cli): add ignore directives to bundled code (#13309)
This commit adds lint and fmt ignore directives to bundled
code as well as a comment stating that the code was bundled
and shouldn't be edited manually.
2022-01-12 13:05:06 +01:00
Rabin Gaire 605b8db8f6
cli(compile): fix output flag behaviour on compile command (#13299) 2022-01-10 23:24:39 -05:00
Ryan Dahl 1fb5858009
chore: update copyright to 2022 (#13306)
Co-authored-by: Erfan Safari <erfanshield@outlook.com>
2022-01-07 22:09:52 -05:00
VishnuJin d9b130410b
feat(compat) preload Node.js built-in modules in global vars REPL (#13127)
This commit adds preloading of built-in Node.js modules in
the REPL if running with "deno repl --compat --unstable".
2022-01-03 20:10:17 +01:00
Steven Guerrero 39a6c94071
feat(test): Add support for "deno test --compat" (#13235) 2021-12-30 17:18:30 +01:00
Aaron O'Mullan 4208199490
cleanup(cli): use op Extensions (#13223)
Enabling op-middleware for overrides in lieu of imperative .replace_op() etc...

Impacts #13219,  #12938, #13122
2021-12-29 14:30:08 +01:00
Kitson Kelly 8547a37132
chore: update deno_graph and deno_doc (#13173) 2021-12-22 14:25:06 +01:00
Bartek Iwańczuk 907cef563e
refactor: cleanup cli/main.rs (#13160) 2021-12-21 15:49:27 +01:00
Bartek Iwańczuk 1eb78731eb
refactor: Use dedicated flags structures (#13148) 2021-12-20 22:29:02 +01:00
Luca Casonato 17d81ad2ef
chore: add custom panic message (#13145) 2021-12-20 14:49:05 +01:00
Nayeem Rahman 9ffc7edc23
refactor(cli): use GraphData for check and emit (#12960) 2021-12-16 21:45:41 +11:00
Jesper van den Ende 5a3ded6611
feat(watch): support watching external files (#13087) 2021-12-15 16:04:43 -05:00
Bartek Iwańczuk 0dec9b4381
fix: op_set_exit_code (#13034)
Fixes "op_set_exit_code" by sharing a single "Arc" between
all workers (via "op state") instead of having a "global" value stored in
"deno_runtime" crate. As a consequence setting an exit code is always
scoped to a tree of workers, instead of being overridable if there are
multiple worker tree (like in "deno test --jobs" subcommand).

Refactored "cli/main.rs" functions to return "Result<i32, AnyError>" instead
of "Result<(), AnyError>" so they can return exit code.
2021-12-11 15:56:45 +01:00
Kitson Kelly 18a63dd977
feat: add --no-check=remote flag (#12766)
Closes #11970
2021-11-30 09:23:30 +11:00
Ben Noordhuis 993a1dd41a
feat(runtime): add op_set_exit_code (#12911)
Set the exit code to use if none is provided to Deno.exit(), or when
Deno exits naturally.

Needed for process.exitCode Node compat. Paves the way for #12888.
2021-11-28 00:45:38 +01:00
David Sherret adc5974333
fix(lsp): lsp should respect include/exclude files in format config (#12876) 2021-11-24 15:14:19 -05:00
Bartek Iwańczuk 1117d2db39
compat: support compat mode in REPL (#12882)
This commit introduces "ProcState::maybe_resolver" field, which
stores a single instance of resolver for the whole lifetime of the
process, instead of creating these resolvers for each creation
of module graph. As a result, this resolver can be used in fallback
case where graph is not constructed (REPL, loading modules using
"require") unifying resolution logic.
2021-11-24 16:55:10 +01:00
Zheyu Zhang fd6d0e309c
fix(cli/compile): skip bundling for pre-bundled code (#12687) 2021-11-23 23:59:17 +01:00
Nayeem Rahman 7413c96985
fix(cli): don't cache .tsbuildinfo unless emitting (#12830)
Fixes #12755
Fixes #12807
Fixes #12832
2021-11-24 08:20:30 +11:00
Nayeem Rahman cd9193f126
fix(cli): short-circuit in prepare_module_load() (#12604) 2021-11-16 10:25:52 +11:00
Kitson Kelly f5eb177f50
feat(cli): support React 17 JSX transforms (#12631)
Closes #8440
2021-11-09 12:26:39 +11:00
Bert Belder f1b1a3f389
refactor: move mod tokio_util to runtime (#12332)
This avoids a bunch of duplicated code.
2021-11-08 12:49:11 -08:00
Ryan Dahl b92019a847
port check_if_should_use_esm_loader to rust (#12562) 2021-11-01 14:46:07 -04:00
Kitson Kelly 1c739470b5
feat(ext/webstorage): use implied origin when --location not set (#12548)
Closes #11882

BREAKING CHANGE: Previously when `--location` was set, the unique storage key was derived from the the URL of the location instead of just the origin. This change correctly uses just the origin. This may cause previously persisted storage to change its key and data to not be available with the same location as before.
2021-10-27 11:10:27 +11:00
Bert Belder d936a8f3f8
chore: upgrade Rust to 1.56.0 (#12514) 2021-10-26 07:17:11 +02:00
Bartek Iwańczuk f83c756aa0
refactor: use a single Mutex in ProcState for module graph (#12489)
This commit factors out 4 different fields from "ProcState", that are behind
"Arc<Mutex<>>" into a single struct behind a single mutex.
2021-10-19 16:01:46 +02:00
Bartek Iwańczuk 617eeabe83
feat(unstable): Node CJS and ESM resolvers for compat mode (#12424)
This commit adds CJS and ESM Node resolvers to the "--compat" mode.

The functionality is spread across "cli/compat" module and Node compatibility
layer in "deno_std/node"; this stems from the fact that ES module resolution
can only be implemented in Rust as it needs to directly integrated with 
"deno_core"; however "deno_std/node" already provided CJS module resolution.

Currently this resolution is only active when running a files using 
"deno run --compat --unstable <filename>", and is not available in other
subcommands, which will be changed in follow up commits.
2021-10-18 19:36:28 +02:00
Kitson Kelly a7baf5f2bb
refactor: integrate deno_graph into CLI (#12369) 2021-10-11 08:26:22 +11:00
Bartek Iwańczuk c49a057599
feat(compat): inject Node globals in REPL (#12352) 2021-10-08 17:11:33 +02:00
Aaron O'Mullan 6b43e862fd
feat(runtime): allow passing extensions via Worker options (#12362) 2021-10-08 17:03:49 +02:00
Bartek Iwańczuk 4e3068be63
Revert "fix(cli): ensure empty lines don't count towards coverage (#11957)" (#12348)
This reverts commit d5b38a9929.
2021-10-06 19:28:28 +02:00
Bartek Iwańczuk b686907a45
feat(compat): inject Node globals (#12342)
This commit adds automatic injection of Node globals when "--compat" flag
is present.

This is done by executing "https://deno.land/std/node/global.ts" as a "side module",
before main module is executed.

This commit makes "--compat" required to be used with "--unstable" flag, as some
of Node globals require unstable Deno APIs.
2021-10-06 19:07:04 +02:00
Casper Beyer d5b38a9929
fix(cli): ensure empty lines don't count towards coverage (#11957) 2021-10-06 07:05:18 +02:00
CGQAQ c555b31d40
feat(lint): add support for --watch flag (#11983) 2021-10-05 23:07:38 +02:00
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