Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleanup cli/js/compiler.ts #3347

Closed
bartlomieju opened this issue Nov 14, 2019 · 9 comments
Closed

refactor: cleanup cli/js/compiler.ts #3347

bartlomieju opened this issue Nov 14, 2019 · 9 comments

Comments

@bartlomieju
Copy link
Member

cli/js/compiler.ts became a little unwieldy and could use some cleaning.

I think that we could factor out Host, BundlerHost and CompilerHost and maybe split compiler.ts into more files; maybe js/compiler.ts and js/compiler/host.ts?

I will work on that, posting for tracking

@bartlomieju
Copy link
Member Author

One more thing to keep in mind: ideally we could add more entry points, but that's not possible now without increasing binary size.

@ry
Copy link
Member

ry commented Nov 14, 2019

If we're refactoring cli/js/compiler.ts it should be done in way that can share more code with https://github.com/denoland/deno/blob/master/deno_typescript/compiler_main.js (which essentially serves the same purpose)

@bartlomieju
Copy link
Member Author

Sure, but that means downgrading most of the code to JS with JSDoc, right?

@kitsonk
Copy link
Contributor

kitsonk commented Nov 15, 2019

@bartlomieju be careful, I've got some stuff for the bundling going on in another PR right now... I think it can be rationalised more, I have pulled some stuff out that really doesn't have to deal with the host, but there is part of me that would like us to get some the transpile stuff in (like the userland API access to the compiler (#2927), and potentially this transpile only feature (#3321)) before we really have a grasp of how to structure the compiler. Specifically we wouldn't want to un-DRY anything, but exploding out some of the functionality so it is a bit easier to maintain might make sense.

@ry I would like to too... though I would hate to "regress" to JavaScript only... I wonder if we could bootstrap the TypeScript compiler, bring up a minimal program to transpile the host in TypeScript, and possibly also the bundle loader, and then transpile the bundles.

@bartlomieju
Copy link
Member Author

Thanks for the heads up @kitsonk! In that case I'll hold off until you're done.

@ry
Copy link
Member

ry commented Nov 15, 2019

I think regressing to JavaScript isn't such a big deal. The interface to TS is a relatively small bit of code - and it isn't exposed to the users. Because of the bootstrapping problem, I think it's a lot less complex to just write this part in JS.

@kitsonk
Copy link
Contributor

kitsonk commented Nov 15, 2019

Ok, one thought is that we enable checkJs on deno_typescript.

@kitsonk
Copy link
Contributor

kitsonk commented Nov 15, 2019

We should turn checkJs on deno_typescript. At that point we can still have confidence whatever is in the internal bundles is type safe.

@bartlomieju
Copy link
Member Author

Done in #3442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants