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

[WIP] TypeScript support in REPL #1169

Closed
wants to merge 10 commits into from

Conversation

bartlomieju
Copy link
Member

Ref #1158

This is initial pass at implementing TypeScript support in REPL. It's quite complex task and we're aiming for MVP with this PR.

There are a few PR that might need to land before this one including:
#1136 #1165

cc: @kitsonk @hayd @ry

js/compiler.ts Outdated Show resolved Hide resolved
@bartlomieju
Copy link
Member Author

@kitsonk PTAL any feedback would be much appreciated

@bartlomieju
Copy link
Member Author

bartlomieju commented Nov 7, 2018

Right now I'm getting this diagnostic:

Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy.

Also since I used the same compiler options as for standard program execution which uses AMD, define is required to run the code (running any code results in: ReferenceError: define is not defined)

@hayd hayd mentioned this pull request Nov 9, 2018
@hayd
Copy link
Contributor

hayd commented Nov 9, 2018

I wonder if the meat of this should move to vm.ts similar to node. https://nodejs.org/api/vm.html

@bartlomieju
Copy link
Member Author

bartlomieju commented Nov 9, 2018

I've got basic compilation working, now is time for imports 👍

EDIT: ATM I'm not able to import any local module because in parse_local_or_remote containingFile is [repl].ts and Rust refuses to parse it.

@@ -405,6 +405,7 @@ export class DenoCompiler
assert(
mediaType === MediaType.TypeScript || mediaType === MediaType.JavaScript
);
console.log("pre emit output");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before shipping, these should be util's log (hidden behind debug flag).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, just needed some guidance during debugging.

@hayd
Copy link
Contributor

hayd commented Nov 9, 2018

Is there a way to tease apart the compile and eval steps? I think that will enable a fix for #1174 (as well as potentially being cleaner).

@bartlomieju
Copy link
Member Author

@hayd yes, that's what we're aiming for. Deno compiler will return compiled JS code and it will be up to REPL to execute it.

@hayd
Copy link
Contributor

hayd commented Dec 2, 2018

Is this waiting on #1136?

@kitsonk
Copy link
Contributor

kitsonk commented Dec 2, 2018

Actually I think we need to wait for #1190 which I am working on at the moment, but it is fairly complex. Once we have that, we can create a better incremental compiler too as well.

@ry
Copy link
Member

ry commented Jan 9, 2019

Closing old PRs. I'm still not ready to address TS in the REPL - but now that native ES modules are landed we're much closer. Let's talk about it in a few weeks.

@ry ry closed this Jan 9, 2019
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

Successfully merging this pull request may close these issues.

4 participants