1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-01 09:24:20 -04:00
denoland-deno/cli/js
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
..
ops Implement Deno.kill for windows (#5347) 2020-05-17 19:11:24 +02:00
tests Implement Deno.kill for windows (#5347) 2020-05-17 19:11:24 +02:00
web fix: setTimeout and friends have too strict types (#5412) 2020-05-15 09:51:49 -04:00
buffer.ts internal: reorder Buffer's copyBytes arguments (#5021) 2020-04-30 15:46:44 -04:00
build.ts BREAKING: Use LLVM target triple for Deno.build (#4948) 2020-04-28 12:35:23 -04:00
colors.ts refactor(cli/fmt_errors): Format stack frames in prepareStackTrace() (#4706) 2020-04-11 02:08:11 -04:00
compiler.ts refactor: rewrite TS dependency analysis in Rust (#5029) 2020-05-18 12:59:29 +02:00
compiler_api.ts refactor: merge TS compiler into single file (#5091) 2020-05-06 00:19:18 +02:00
compiler_options.ts refactor: merge TS compiler into single file (#5091) 2020-05-06 00:19:18 +02:00
core.ts Use globalThis to reference global scope (#3719) 2020-01-20 09:30:30 -05:00
deno.ts BREAKING: make Deno.hostname unstable (#5108) 2020-05-09 12:44:35 -04:00
deno_unstable.ts BREAKING: make Deno.hostname unstable (#5108) 2020-05-09 12:44:35 -04:00
diagnostics.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
diagnostics_util.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
error_stack.ts refactor(core/js_error): Align JSStackFrame with CallSite (#4715) 2020-04-13 10:54:16 -04:00
errors.ts Make writeSync, readSync, seekSync, openSync, isatty proper synchronous syscalls (#4762) 2020-04-15 20:43:19 -04:00
files.ts BREAKING: Remove Deno.EOF, use null instead (#4953) 2020-04-28 12:40:43 -04:00
globals.ts fix: Expose ErrorEvent globally (#5222) 2020-05-11 14:28:13 +02:00
globals_unstable.ts Unstable methods should not appear in runtime or d.ts (#4957) 2020-04-30 11:23:40 -04:00
internals.ts BREAKING: Remove Deno.symbols namespace (#4936) 2020-04-28 01:06:03 +02:00
io.ts fix: bug in Deno.copy (#4977) 2020-04-28 21:30:48 -04:00
lib.deno.ns.d.ts Miscellaneous documentation and spelling improvements (#5527) 2020-05-17 19:24:39 +02:00
lib.deno.shared_globals.d.ts Fix definition of URL constructor (#5521) 2020-05-17 11:37:16 -04:00
lib.deno.unstable.d.ts Miscellaneous documentation and spelling improvements (#5527) 2020-05-17 19:24:39 +02:00
lib.deno.window.d.ts feat(workers): "crypto" global accessible in Worker scope (#5121) 2020-05-08 14:30:53 +02:00
lib.deno.worker.d.ts BREAKING: remove window.location and self.location (#5034) 2020-05-01 20:15:28 +02:00
main.ts remove bootstrap methods from global scope after bootstrapping (#4869) 2020-04-25 01:03:45 +02:00
net.ts default to 0.0.0.0 for Deno.listen (#5203) 2020-05-13 09:18:41 -04:00
net_unstable.ts Unstable methods should not appear in runtime or d.ts (#4957) 2020-04-30 11:23:40 -04:00
permissions.ts refactor(cli/js/permissions): Split read and write permission descriptors (#4774) 2020-04-28 16:43:58 +02:00
process.ts refactor: remove combined io interface like ReadCloser (#4944) 2020-04-28 12:32:43 +02:00
rbtree.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
read_file.ts Remove doc strings from cli/js TS files (#4329) 2020-03-13 10:22:22 +01:00
read_text_file.ts fix(#4769) Adds readTextFile, writeTextFile, with sync counterparts (#4901) 2020-04-28 01:35:20 -04:00
repl.ts Add hint on how to exit REPL (#5143) 2020-05-08 18:58:51 -04:00
runtime.ts BREAKING: Use LLVM target triple for Deno.build (#4948) 2020-04-28 12:35:23 -04:00
runtime_main.ts feat(workers): "crypto" global accessible in Worker scope (#5121) 2020-05-08 14:30:53 +02:00
runtime_worker.ts fix: Expose ErrorEvent globally (#5222) 2020-05-11 14:28:13 +02:00
signals.ts BREAKING: Use LLVM target triple for Deno.build (#4948) 2020-04-28 12:35:23 -04:00
testing.ts BREAKING: remove overload of Deno.test() (#4951) 2020-04-28 12:33:09 +02:00
tls.ts BREAKING CHANGE: rename TLS APIs to camel case (#4888) 2020-04-24 23:29:14 +02:00
ts_global.d.ts add option to lint and format only staged files (#5172) 2020-05-09 06:22:27 -04:00
util.ts feat: Add WritableStreams (and enable ReadableStreams piping) (#4980) 2020-04-30 10:40:10 -04:00
version.ts Update to Prettier 2 and use ES Private Fields (#4498) 2020-03-28 13:03:49 -04:00
write_file.ts BREAKING: Use LLVM target triple for Deno.build (#4948) 2020-04-28 12:35:23 -04:00
write_text_file.ts fix(#4769) Adds readTextFile, writeTextFile, with sync counterparts (#4901) 2020-04-28 01:35:20 -04:00