Commit graph

383 commits

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