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

448 commits

Author SHA1 Message Date
Kitson Kelly
e9edc05bed
fix(cli): ensure that transitory dependencies are emitted (#8275)
Fixes #8111
2020-11-08 07:00:42 +11:00
Kitson Kelly
5f7c80986f
fix(cli): correct libs sent to tsc for unstable worker (#8260)
Fixes #8257
2020-11-06 12:10:19 +11:00
Bartek Iwańczuk
791119d4af
build: rewrite tools/ scripts to deno (#8247)
This commit rewrites scripts in "tools/" directory
to use Deno instead of Python. In return it allows 
to remove huge number of Python packages in "third_party/".
2020-11-05 15:53:21 +01:00
Kitson Kelly
272e9b82eb
fix(cli): inject helpers when transpiling via swc (#8221)
Fixes #8212
2020-11-02 22:33:43 +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
Bartek Iwańczuk
4f57ca0daf
fix: panic in bundler (#8168)
This commit fixes panic in bundler which was caused
by not setting thread-local slots.
2020-10-30 12:19:49 +01:00
Sander Hahn
1854c6f73b
fix(cli): prompt works with windows eol and eof (#8149) 2020-10-29 18:35:58 +01:00
Yusuke Tanaka
bfce376c68
refactor(watch): create single watcher for whole process (#8083)
This commit rewrites file watcher used with --watch flag.

Instead of creating new watcher after each restart, only a single
watcher is created for whole process. Additionally debouncing
mechanism has been added to prevent infinite restart loops 
if multiple files were changed in quick succession.

Co-authored-by: bartossh <lenart.consulting@gmail.com>
2020-10-28 12:41:18 +01:00
Kevin (Kun) "Kassimo" Qian
07359b7957
fix(repl): don't hang on unpaired braces (#8151)
Previously, entering a single ']' would cause repl to forever accepting
new lines, due to that `ValidationResult::Invalid` would actually be
consumed by the editor itself while continue building the lines. Instead
we should mark it as `Valid` and send the bad input for evaluation to
get the proper error from V8.

Before:
```
> ]
(you can keep entering new line here, and it will never consume input
until you Ctrl-C)
```

After:
```
> ]
Uncaught SyntaxError: Unexpected token ']'
>
```
2020-10-28 06:03:17 -04:00
Kitson Kelly
e01664d0ae
fix(cli): module graph handles redirects properly (#8159)
Fixes #8154
2020-10-28 20:38:09 +11:00
Kitson Kelly
5af1dcfe29
fix(cli): do not throw on empty typescript files (#8143)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-10-27 13:19:27 +01:00
Kitson Kelly
b03f4a4a1c
fix(cli): restore permission check on workers (#8123)
Fixes #8120
2020-10-27 06:56:00 +11: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
Kitson Kelly
3d19fb493b
fix(cli): properly handle roots with extensions that don't match media type (#8114) 2020-10-26 07:17:58 +11:00
Kitson Kelly
117fcf61f0
test(cli): dynamic imports not evaluated until runtime (#8102)
Closes #7997
2020-10-25 07:02:11 +11: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
Divy Srivastava
d592c128cf
chores(cli/fmt): make --ignore stable (#7922)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-10-22 19:04:35 +02:00
Kitson Kelly
0fb39f9176
feat(cli): add types for WeakRef/FinalizationRegistry (#8056)
Fixes #8051
2020-10-21 21:57:01 +11:00
Nayeem Rahman
070d99645f
chore: Rename --importmap to --import-map (#7032)
--importmap still works as an alias to --import-map
but is not visible in CLI help output.
2020-10-20 14:30:59 +02:00
Nayeem Rahman
7aba07cc77
fix(cli/worker): Print error stacks from the origin Worker (#7987)
Fixes #4728
2020-10-20 15:05:42 +11:00
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
Casper Beyer
9d664f8375
fix(cli/repl): ignore pair matching inside literals (#8037) 2020-10-19 19:13:23 +02:00
Casper Beyer
35028db5e5
fix(cli/repl): unterminated string literal should invalidate (#7896)
This adds the grave character to the pair matching so that template
string literals trigger multi-line edits.
2020-10-19 16:54:50 +02:00
Casper Beyer
f5c23f8058
fix(cli/repl): write all results to stdout (#7893)
This writes all evaluaton results to stdout regardless if the result is
an error or not.

This matches the behavior of other read-eval-print-loops like Node.
2020-10-19 13:41:25 +02:00
Kitson Kelly
bbe4474d39
fix(cli): ModuleGraph2 properly handles redirects (#7981) 2020-10-16 10:34:55 +11:00
Bartek Iwańczuk
12e700bddf
fix(test): return error when awaiting unresolved promise (#7968)
This commit fixes test runner by awaitning "Deno.runTests()" call,
which ensures proper error is returned when there's an unresolved
promise that's being awaited.
2020-10-14 15:19:13 +02:00
Bartek Iwańczuk
135053486c
fix: top-level-await module execution (#7946)
This commit changes implementation of top-level-await in "deno_core".

Previously promise returned from module evaluation was not awaited,
leading to out-of-order execution of modules that have TLA. It's been
fixed by changing "JsRuntime::mod_evaluate" to be an async function
that resolves when the promise returned from module evaluation also
resolves. When waiting for promise resolution event loop is polled
repeatedly, until there are no more dynamic imports or pending
ops.
2020-10-14 14:04:09 +02:00
Yoshiya Hinosawa
0dcaea72ae
feat: add alert, confirm, and prompt (#7507)
This commit adds "alert", "confirm" and "prompt" functions from web standards.
2020-10-13 15:31:59 +02:00
Valentin Anger
fede13f2eb
feat(cli): support importmap flag with deno doc subcommand (#7821)
Fixes #7783
2020-10-12 10:05:46 +11: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
c7c7677825
fix(core): module execution with top level await (#7672)
This commit fixes implementation of top level await in "deno_core".

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

With this commit promise returned from module execution is stored on "JsRuntime"
and event loop is polled until the promise resolves.
2020-10-06 10:18:22 +02:00
Casper Beyer
5cd29b37f7
feat(cli/repl): enable await and let re-declarations (#7784)
This enables `replMode` during evaluations which allows for top level
await and let re-declarations.
2020-10-02 13:17:47 +02:00
Casper Beyer
6825d7f13d
fix(cli/repl): use a default referrer when empty (#7794)
This makes use of a default referrer when its empty in repl mode so that
dynamic imports work in the global evaluation context.

Co-authored-by: Bartek Iwanczuk <biwanczuk@gmail.com>
2020-10-02 13:13:23 +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
Kitson Kelly
e077b93d77
refactor: add concept of 'legacy' compiler to enable non-breaking refactoring (#7762) 2020-10-01 20:33:15 +10:00
Kitson Kelly
dcd0595058
fix: check cached versions during transpile (#7760)
Fixes: #7759
2020-09-30 21:46:42 +10:00
Kitson Kelly
7c62b7b043
fix(cli): use global_state file_fetcher when using SpecifierHandler (#7748)
Fixes: #7709
2020-09-30 17:22:58 +10:00
Luca Casonato
ebcb032c6b
fix: no check recognizes require (#7720) 2020-09-27 14:16:18 -04:00
Kitson Kelly
751bb45a0a
fix: ignore fileExists in tsc host (#7635)
Fixes #7630
2020-09-23 11:39:20 +10:00
Bartek Iwańczuk
dd1cd4d952
fix: clearing timers race condition (#7617) 2020-09-22 19:33:29 +02:00
Casper Beyer
9caeff3208
fix(cli/repl): interpret object literals as expressions (#7591) 2020-09-21 16:09:53 -04:00
Bartek Iwańczuk
92edc36442
refactor: use futures and serde_json from deno_core (#7614) 2020-09-21 18:36:37 +02:00
William Perron
42772845f6
fix(info): add --importmap flag (#7424) 2020-09-21 15:07:19 +02:00
Yusuke Tanaka
db5004f200
fix(fmt,lint): do not print number of checked files when --quiet is enabled (#7579) 2020-09-20 13:49:22 +02:00
tokiedokie
4c2920ddd7
fix(cli/fmt): canonicalize files in current dir (#7508) 2020-09-18 13:03:37 -04:00
Casper Beyer
de95fbebc4
fix(cli/repl): format evaluation results with the object specifier (#7561) 2020-09-18 12:47:08 -04: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
tokiedokie
04d3472257
refactor(cli/tests): change std_path to root_path in std_tests() (#7438) 2020-09-15 06:26:57 +02:00
Bartek Iwańczuk
a65bcadcf2
test: reenable TS decorator test (#7471) 2020-09-14 18:59:54 +02:00
tokiedokie
e688a701e2
test(cli/tests/https_import): use ts file in localhost instead of remote (#7431) 2020-09-14 13:18:00 +02:00
Nayeem Rahman
f874b83aa0
test(cli/tests/unit): Enable color for js_unit_tests (#7443) 2020-09-14 12:46:50 +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
Bartek Iwańczuk
b216d48e5f
upgrade: deno_doc, deno_lint, dprint, swc (#7434)
upgrades:
- swc_ecmascript 0.7.7
- dprint-plugin-typescript 0.31.3
- deno_lint 0.2.0
- deno_doc 0.1.9

Split std_lint test into std_lint and unit_test_lint.

Added lint ignores to CommonJS files in std/node.
2020-09-13 14:15:38 +02:00
Bert Belder
bf70442b08
upgrade: rusty_v8 0.10.0 / V8 8.7.75 (#7429) 2020-09-13 13:43:50 +02:00
Luca Casonato
daa780e2cf
fix(WebSocket): no panic on failed connect + handle promise rejection via error event (#7437) 2020-09-13 11:52:20 +02:00
Luca Casonato
82d0f7ec84
chore: remove --no-check from deno info (#7439) 2020-09-12 23:34:54 +02:00
Luca Casonato
d048f58f05
chore: add systemMemoryInfo unstable diagnostic (#7435) 2020-09-12 16:12:14 +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
Yusuke Tanaka
857f9b32e0
feat(fmt, lint): show number of checked files (#7312) 2020-09-09 16:45:31 +02:00
Nayeem Rahman
b17a5fbcfa
fix(op_crates/web): Use "deno:" URLs for internal script specifiers (#7383) 2020-09-09 14:23:57 +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
crowlKats
8c880d3261
feat: Implement WebSocket API (#7051) 2020-09-05 10:39:25 -04:00
tokiedokie
fcee4265c6
support env_logger / RUST_LOG (#7142) 2020-09-03 16:16:49 -04:00
Ryan Dahl
a4439800e6
Remove unnecessary stdout pipes in tests (#7322) 2020-09-02 18:31:22 +02:00
Yusuke Tanaka
fa65e49bc6
feat(lint): Add support for reading input from stdin (#7263) 2020-08-31 13:53:42 +02:00
Valentin Anger
31f32ed8c4
Move benchmarks to Rust (#7134)
All benchmarks are done in Rust and can be invoked with
`cargo bench`.

Currently this has it's own "harness" that behaves like
`./tools/benchmark.py` did.
Because of this tests inside `cli/bench` are currently not run.
This should be switched to the language provided harness
once the `#[bench]` attribute has been stabilized.
2020-08-28 09:03:50 -04:00
Luca Casonato
a7fd3a4f58
fix(cli): revert "never type check deno info #6978" (#7199) 2020-08-26 20:27:06 +02:00
Bartek Iwańczuk
2600d5ac09
fix(doc): stack overflow for .d.ts files (#7167) 2020-08-23 15:48:35 +02:00
Nayeem Rahman
015fa0bd41
refactor: permissions (#7074) 2020-08-18 16:29:32 -04:00
Bert Belder
b308a774e8
Fix nightly and Windows-only clippy warnings (#7095) 2020-08-18 20:50:52 +02:00
Casper Beyer
4b3a3d9d0f
Enable WebAssembly.instantiateStreaming (#7043) 2020-08-14 13:48:37 -04: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
Ryan Dahl
7d01fcbb77
Remove unnecessary drop calls (#7007) 2020-08-10 17:31:05 -04:00
Nayeem Rahman
52c1017a74
feat: Stabilize Deno.mainModule (#6993) 2020-08-10 16:41:51 -04:00
Bert Belder
f17eb634fa
test(cli/inspector_port_collision): skip test on WSL (#6991) 2020-08-08 22:06:44 +02:00
Bert Belder
9806933f57
test(cli/inspector_port_collision): fail rather than hang (#6991) 2020-08-08 22:06:44 +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
Nayeem Rahman
479164d287
fix(deno info): Never type check (#6978) 2020-08-07 16:46:54 -04:00
Luca Casonato
9d50c5c1a6
feat: hash file names in gen cache (#6911) 2020-08-03 14:55:03 +02:00
Divy Srivastava
0da4779b17
feat(unstable): add "--ignore" flag to deno fmt (#6890) 2020-07-30 12:09:08 -04:00
Bartek Iwańczuk
b45f9a7357
fix: deno-types directive should have higher precedence than X-TypeScript-Types header (#6761) 2020-07-24 14:21:36 +02:00
Bartek Iwańczuk
b449964d1a
refactor: remove more compiler runtime code (#6841) 2020-07-23 15:29:36 +02:00
Bartek Iwańczuk
fa61956f03
Port internal TS code to JS (#6793)
Co-authored-by: Ryan Dahl <ry@tinyclouds.org>
2020-07-19 19:49:44 +02:00
Bartek Iwańczuk
6e34f6a7cc
fix: providing empty source code for missing compiled files (#6760)
This commit adds a fallback mechanism for absent compiled source file.

Because imported type declaration files are not emitted by TS compiler
and their imports are not elided users often hit "No such file or directory"
error. With this commit in such situation an empty source file will be
provided to V8 with a warning to the user suggesting using "import type"/
"export type" syntax instead.
2020-07-17 15:50:17 +02:00
Bartek Iwańczuk
73a9036089
fix: panic for runtime error in TS compiler (#6758) 2020-07-15 14:23:17 +02:00
David Sherret
cde4dbb351
Use dprint for internal formatting (#6682) 2020-07-14 15:24:17 -04:00
Maayan Hanin
d619e3c7ac
fix(cli): don't panic when no "HOME" env var is set (#6728) 2020-07-13 18:24:54 +02:00
uki00a
4731f4800c
fix(Deno.ppid): improve error message when --unstable is missing (#6717) 2020-07-13 14:00:56 +02:00
Oscar Linde
3be2064803
feat(cli): add DENO_CERT environment variable (#6370) 2020-07-12 19:18:27 -04:00
Bartek Iwańczuk
a26b4a9f1e
chore: reenable ignored integration tests (#6703) 2020-07-11 18:29:55 +02:00
Maayan Hanin
edb7a0eead
fix(cli): panic when stdio is null on windows (#6528)
Fixes: #6409
2020-07-09 21:06:51 +02:00
Emmanuel
cbbd944359
feat(cli): json option for "deno info" (#6372) 2020-07-08 10:50:12 -04:00
Kitson Kelly
82aabb657a
feat: add --no-check option (#6456)
This commit adds a "--no-check" option to following subcommands:
- "deno cache"
- "deno info"
- "deno run"
- "deno test"

The "--no-check" options allows to skip type checking step and instead 
directly transpiles TS sources to JS sources. 

This solution uses `ts.transpileModule()` API and is just an interim
solution before implementing it fully in Rust.
2020-07-08 11:26:39 +02:00
Takahiko Inayama
14a44464a6
feat: add lockfile support to bundle (#6624) 2020-07-07 13:05:28 +02:00
uki00a
ab4c574f52
fix: Deno.setRaw shouldn't panic on ENOTTY (#6630) 2020-07-06 18:26:34 -04:00
crowlKats
2b52e3daf1
feat: deno upgrade --output (#6352) 2020-07-06 18:21:26 -04:00
Bartek Iwańczuk
d1289db1c3
chore: re-enable tests using media_types (#6642) 2020-07-05 23:09:50 -04:00
Ryan Dahl
5f9e600c5b
chore: port http_server.py to rust (#6364) 2020-07-04 13:05:01 -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
Andrey Filatkin
a690a20679
fix(cli/upgrade): upgrade fails on Windows with space in temp path (#6522) 2020-06-29 09:13:07 -04:00
Ryan Dahl
42464e922d
'Compile' messages changed to 'Check' messages (#6504) 2020-06-26 16:59:08 -04:00
Kitson Kelly
70463bac7d
fix: Omit buildinfo when --reload passed (#6489) 2020-06-26 08:23:25 -04:00
Kitson Kelly
6f09b8de41
Restore stats for incremental compile (#6474) 2020-06-25 15:50:16 +02:00
Bartek Iwańczuk
3cbd1075c7
Incremental compilation for TypeScript (#6428)
This commit adds incremental compilation capabilities to internal TS compiler.

Instead of using "ts.createProgram()" API for compilation step (during deno 
startup), "ts.createIncrementalProgram()" API is used instead.

Thanks to TS' ".tsbuildinfo" file that already stores all necessary metadata
for compilation I was able to remove our own invention that is ".graph" file. 
".tsbuildinfo" file is stored alongside compiled source and is used to 
cache-bust outdated dependencies, facilitated by the "version" field. 
The value for "version" field is computed in Rust during loading of module 
graph and is basically a hash of the file contents.

Please keep in mind that incremental compilation is only used for initial 
compilation (or dynamic imports compilation) - bundling and runtime compiler 
APIs haven't been changed at all.

Due to problems with source map I changed compilation settings to inline 
source map (inlineSourceMap instead of sourceMap).
2020-06-24 16:59:12 +02:00
Kitson Kelly
1d8fc39494
Add ability to output compiler performance information (#6434) 2020-06-24 11:58:23 +02:00
uki00a
345a5b3dff
fix: "deno test" should respect NO_COLOR=true (#6371) 2020-06-19 12:10:31 +02:00
Alan Gou
ffedbd79ad
build: lint cli/tests/unit using deno lint (#6327) 2020-06-19 11:05:37 +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
097e42418c
chore: move fmt test to integration tests (#6340) 2020-06-17 21:50:30 +02:00
Bartek Iwańczuk
b1893e65f2
fix(compiler): JSX compilation and provide better error message (#6300) 2020-06-15 17:53:05 +02:00
Nayeem Rahman
e613bfe47a
feat: Add TestDefinition::only (#5793) 2020-06-12 11:58:04 -04:00
Ryan Dahl
d0970daacd
make std deno-lint clean (#6240)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-06-12 09:19:29 -04:00
Casper Beyer
813210d433
fix: WebAssembly runtime error propagation (#6137)
Currently WebAssembly runtime errors don't propagate up to the user as
they use urls to denote where the error occurred which get caught by the source-map
pipeline which doesn't support the wasm scheme.
2020-06-11 11:03:27 -04:00
Jaap Aarts
5ee2ce1b1c
feat: allow reading the entry file from stdin (#6130) 2020-06-11 10:58:09 -04:00
John Gardner
ca5b5ba530
feat: Add Deno.mainModule (#6180) 2020-06-10 23:00:29 -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
4b7d3b060e
fix: several regressions in TS compiler (#6177)
This commit fixes several regressions in TS compiler:

* double compilation of same module during same process run

* compilation of JavaScript entry point with non-JS imports

* unexpected skip of emit during compilation

Additional checks were added to ensure "allowJs" setting is 
used in TS compiler if JavaScript has non-JS dependencies.
2020-06-10 16:02:41 +02:00
Bartek Iwańczuk
db70b77e4b
fix: handle @deno-types in export {} (#6202)
* fix: handle @deno-types in export {}

* lint

* fix tests

* fmt

* fix test
2020-06-10 14:19:41 +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
Jack Kelly
cb29f7f323
test: fixed initial [WILDCARD] not matching empty the on first line (#5420) 2020-06-08 19:24:27 +02:00
Ryan Dahl
8a4533eb75 feat: deno eval -p (#5682) 2020-06-06 09:07:59 -04:00
Bert Belder
9a783ae4e6
ci: upgrade to Rust 1.44.0 (#6113) 2020-06-05 05:11:15 +02:00
Ryan Dahl
23dc9c13db
Fix REPL BorrowMutError panic (#6055) 2020-06-02 16:37:52 -04:00
Bartek Iwańczuk
c813990806
fix: compile TS dependencies of JS files (#6000)
This commit fixes regression that caused TS dependencies
not being compiled.

Check was added that ensures TS compiler is run if 
any of dependencies in module graph is TS/TSX/JSX.
2020-06-01 21:01:51 +02:00
Bartek Iwańczuk
02d46bae9f
fix: media type for .cjs and application/node (#6005) 2020-05-31 21:08:26 +02:00
Bartek Iwańczuk
550556e948
fix: ES private fields parsing in SWC (#5964) 2020-05-30 17:32:48 +02:00
Nayeem Rahman
8e39275429
fix(cli/permissions): Fix CWD and exec path leaks (#5642) 2020-05-29 17:27:43 +02: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
Kitson Kelly
2668637e9b
fix: REPL evaluates in strict mode (#5565)
Since everything that Deno loads is treated as an ES Module, 
it means that all code is treated as "use strict" except for 
when using the REPL. This PR changes that so code in the 
REPL is also always evaluated with "use strict". There are 
also a couple other places where we load code as scripts 
which should also use "use strict" just in case.
2020-05-29 12:24:06 +02:00
uki00a
55311c33c4
chore(integration_tests): stop collecting unnecessary output in permissions tests (#5926) 2020-05-28 19:40:33 -04:00
Bert Belder
131f2a5f0c
fix: BorrowMutError when evaluating expression in inspector console (#5822)
Note that this does not fix the 'Uncaught ReferenceError' issue that
happens when 'eager evaluation' is enabled in the inspector.

Fixes: #5807
2020-05-25 04:26:33 +02:00
Bert Belder
ee0b5bb89e
test: add utility function for assigning unique port to inspector (#5822) 2020-05-25 02:41:59 +02:00
Bartek Iwańczuk
c3c16f025c
fix: TSX analysis in module graph loader (#5785) 2020-05-23 19:04:29 +02:00
Bartek Iwańczuk
960f9ccb2e
fix: SWC lexer settings and silent errors (#5752)
This commit changes how error occurring in SWC are handled.
Changed lexer settings to properly handle TS decorators.
Changed output of SWC error to annotate with position in file.
2020-05-22 19:23:35 +02:00
Bartek Iwańczuk
e191c70989
fix: ts type imports (#5733) 2020-05-22 19:05:18 +02:00
Bartek Iwańczuk
f9e45114b9
fix: redirects handling in module analysis (#5726)
This commit fixes a bug introduced in #5029 that caused bad 
handling of redirects during module analysis. 

Also ensured that duplicate modules are not downloaded.
2020-05-22 16:01:00 +02:00
Bartek Iwańczuk
491feb859f
fix: --inspect flag working like --inspect-brk (#5697) 2020-05-21 20:34:25 +02:00
Bartek Iwańczuk
5f9c1c7da6
fix: disallow http imports for modules loaded over https (#5680) 2020-05-21 13:06:12 +02:00
Ryan Dahl
30702e2678
move js unit tests to cli/tests (#5678) 2020-05-20 17:52:51 -04:00
Speykious
9752b853dd
Provide better ANSI colorized output when inspecting objects (#5404) 2020-05-19 14:19:26 -04:00
uki00a
cdc9323ccc
fix: REPL does not exit properly when close() is called (#5451) 2020-05-19 13:33:11 -04: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
Bartek Iwańczuk
e16eb9e108
chore: capture stderr in integration tests (#5549)
This commit removes "check_stderr" setting from itest! macro used
to generate integration tests. Without this setting on tests discarded
output of stderr making it very hard to debug the problem in test.

Numerous tests were changed by adding "--quiet" flag to not display
"Compile"/"Download" prompts.
2020-05-17 17:42:39 +02:00
uki00a
c5a54e44bc
chore: port deno_dir_test to Rust (#5408) 2020-05-15 10:22:28 -04:00
Ryan Dahl
73d8fa74c6
BREAKING: There is no public Rust API for the CLI (#5226) 2020-05-11 17:33:36 -04:00
Ryan Dahl
fb7d7f40ed
Merge std_tests.rs into integration_tests.rs.rs (#5228)
* Remove usage of url_to_filename from integration_tests
* Make test ports not conflict with each other
2020-05-11 14:49:19 -04:00
Bartek Iwańczuk
32aeec9630
refactor: check permissions in SourceFileFetcher (#5011)
This PR hot-fixes permission escapes in dynamic imports, workers
and runtime compiler APIs.

"permissions" parameter was added to public APIs of SourceFileFetcher
and appropriate permission checks are performed during loading of
local and remote files.
2020-05-11 13:13:27 +02:00
Ryan Dahl
eb505f8afc
Add support for X-Deno-Warning header (#5161) 2020-05-09 12:43:24 -04:00
crowlKats
abbf0339cd
feat(upgrade): allow specifying a version (#5156) 2020-05-09 06:31:15 -04:00
Ryan Dahl
4e5e6da348
Add hint on how to exit REPL (#5143)
Removes exit and help commands
2020-05-08 18:58:51 -04:00
Bartek Iwańczuk
aca21dad1b
BREAKING: make Worker.deno unstable (#5128)
This commit makes "Worker.deno" option unstable.

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

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

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

This commit removes:
- cli/compilers/wasm.rs
- cli/compilers/wasm_wrap.js
- two integration tests related to .wasm imports
2020-05-07 20:43:27 +02:00
Bartek Iwańczuk
0ba90c8c11
fix(imports): fix panic on unsupported scheme (#5131) 2020-05-07 15:57:10 +02:00
Ryan Dahl
6666f1d36a
remove target_test.py (#5112) 2020-05-06 16:34:48 -04:00
Ryan Dahl
221221cc97
BREAKING: execPath should require allow-read (#5109) 2020-05-06 15:51:33 -04:00
Bert Belder
e513751ee9
Clean up 'inspector_break_on_first_line' test and fix its flakiness (#5098) 2020-05-06 04:32:14 +02:00
Bert Belder
e574437922
Fix inspector hanging when task budget is exceeded (#5083)
The issue is solved by proxying websocket messages over a pair of
`futures::mpsc::unbounded` channels. As these are are implemented in
the 'futures' crate, they can't participate in Tokio's cooperative
task yielding.
2020-05-05 16:12:45 +02:00
Ryan Dahl
6c02b061ce
stabilize Deno.cwd and require --allow-read (#5068) 2020-05-04 14:23:06 -04:00
Ryan Dahl
92c0591fcb
simplify unit tests: compiler_api, workers (#5073) 2020-05-04 10:40:18 -04:00
Bartek Iwańczuk
a913b7a1ba
BREAKING: remove CLI 'deno script.ts' hack (#5026)
This PR removes the hack in CLI that allows to run scripts with shorthand: deno script.ts.

Removing this functionality because it hacks around short-comings of clap our CLI parser. We agree that this shorthand syntax is desirable, but it needs to be rethinked and reimplemented. For 1.0 we should go with conservative approach that is correct.
2020-05-04 13:03:30 +02:00
Bartek Iwańczuk
2872b362ff
BREAKING: disallow static import of local modules from remote modules (#5050)
This commit changes module loading logic to disallow statically import
local module (file:// scheme) from remote modules (http://, https://
schemes).
2020-05-02 15:51:08 +02:00
Bartek Iwańczuk
de2c042482
BREAKING: remove support for JSON imports (#5037)
This commit removes support for importing JSON files as modules.

This change is dictated by security; browsers rolled back on this
support as well.
2020-05-02 00:32:05 +02:00
Nayeem Rahman
96fd0f4692
BREAKING: feat(cli/installer): Support guessing the executable name (#5036) 2020-05-01 15:33:11 -04:00
Fenzland
25b765c123
fix misaligned error reporting on tab char (#5032) 2020-05-01 13:03:54 -04:00
Luca Casonato
80e2211141
Unstable methods should not appear in runtime or d.ts (#4957)
Co-authored-by: Kitson Kelly <me@kitsonkelly.com>
2020-04-30 11:23:40 -04:00
Luca Casonato
e6f70c77ee
Make import maps unstable (#4934) 2020-04-28 01:12:38 +02:00
Bartek Iwańczuk
7a94ea08e9
fix(core): fix top-level-await error handling (#4911) 2020-04-27 17:25:26 +02:00
Ryan Dahl
4036be2ab2
Make runtime compile ops unstable (#4912) 2020-04-27 09:59:34 -04:00
Ryan Dahl
0c47cd6785
introduce unstable flag, make a few things unstable (#4892) 2020-04-25 09:31:54 -04:00
Nayeem Rahman
5bfe3eb8f4
feat(cli/installer.rs): Add DENO_INSTALL_ROOT (#4787) 2020-04-16 18:15:42 -04:00
Ryan Dahl
263dc8f5fe
Revert "test(inspector): add coverage test case (#4725)" (#4754)
Flaky and doesn't implement any features.

This reverts commit a7a3a771a0.
2020-04-15 11:26:31 +02:00
Bartek Iwańczuk
a7a3a771a0
test(inspector): add coverage test case (#4725) 2020-04-14 20:09:50 +02:00
Nayeem Rahman
0ea6eb83a9
refactor(core/js_error): Align JSStackFrame with CallSite (#4715)
Renames and adds missing fields to JSStackFrame from CallSite. Fixes #4705.

Cleans up base changes for line and column numbers.
2020-04-13 10:54:16 -04:00
Nayeem Rahman
2b362bef85
refactor(cli/fmt_errors): Format stack frames in prepareStackTrace() (#4706) 2020-04-11 02:08:11 -04:00
Akshat Agarwal
caff550b6c
BREAKING: Rename 'deno fetch' subcommand to 'deno cache' (#4656) 2020-04-07 11:24:47 -04:00
Bartek Iwańczuk
dd3a94933a
feat: add --importmap flag to deno bundle (#4651) 2020-04-07 12:32:09 +02:00
Giorgi Rostomashvili
f82b9ba329
fix: fetch reference types for JS files (#4652)
Fixes #4000 and fixes #4476. Now always tries to fetch reference types
for JS files. Does not throw if it fails, since Typescript compiler will
complain if the file is not there(it will try to fetch it again first)
and people who just use JS should not be bothered by this error.

Not sure about my test, it passes and catches the bug but maybe there is
a better way to express it.
2020-04-06 16:52:25 -04:00
Andres Villegas
2911fcc78d
Enable inspector tests (#4628) 2020-04-04 14:46:09 -04:00
Bert Belder
c0cb198114
Make inspector more robust, add --inspect-brk support (#4552) 2020-04-03 13:40:11 -04:00
Kitson Kelly
2e24385c48
Support dynamic import in bundles. (#4561) 2020-04-01 23:14:30 -04:00
Ryan Dahl
6ae47449ec
Ignore flaky test cafile_info (#4517)
Ref #4512
2020-03-28 22:51:30 +01:00
Kevin (Kun) "Kassimo" Qian
2f7842246e
fix(inspector): proper error message on port collision (#4514) 2020-03-28 17:42:29 -04:00
Ryan Dahl
2874664e91
feat: Support Inspector / Chrome Devtools (#4484)
This is a first pass implementation which is still missing several important
features:
- support for --inspect-brk (#4503)
- support for source maps (#4501)
- support for piping console.log to devtools console (#4502)

Co-authored-by: Bert Belder <bertbelder@gmail.com>
Co-authored-by: Matt Harrison <mt.harrison86@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2020-03-27 16:09:51 -04:00
Kevin (Kun) "Kassimo" Qian
5d7bcf86fd
feat: window.close() (#4474) 2020-03-24 23:56:40 -04:00
Kevin (Kun) "Kassimo" Qian
3938071e91
errors: replace .lines with explicit .split newline (#4483) 2020-03-24 23:55:54 -04:00
Kevin (Kun) "Kassimo" Qian
3d228f5f9e
hide source line if error message longer than 150 chars (#4487) 2020-03-24 23:53:48 -04:00
bartOssh
ec07386067
feat: first pass at "deno upgrade" (#4328) 2020-03-23 11:37:24 -04:00
Ryan Dahl
0adc86f105
Remove DENO_BUILD_MODE and DENO_BUILD_PATH (#4431)
* Remove DENO_BUILD_MODE and DENO_BUILD_PATH

Also remove outdated docs related to ninja/gn.

* fix

* remove parameter to build_mode()

* remove arg parsing from benchmark.py
2020-03-20 21:48:34 -04:00
Ryan Dahl
a6d8098b35
Clean up installer tests (#4433) 2020-03-19 17:20:46 -04:00