-
Notifications
You must be signed in to change notification settings - Fork 4
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
Allow typescript file to be used by sdk:execute #198
Conversation
src/commands/sdk/execute.ts
Outdated
@@ -69,33 +71,70 @@ Other | |||
|
|||
static readStdin = true; | |||
|
|||
async toJavascript(filename: string): Promise<boolean> { | |||
return new Promise((resolve, reject) => { | |||
exec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to use the programmatic api in order to avoid relying on exec
and to save up on temp file reading / writing.
https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API#a-simple-transform-function
src/commands/sdk/execute.ts
Outdated
async beforeConnect() { | ||
this.code = this.stdin || this.args.code || "// paste your code here"; | ||
try { | ||
eval(this.code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, it would be preferable to attempt evaluating in a separate V8 context
https://nodejs.org/api/vm.html#vmruninnewcontextcode-contextobject-options
What does this PR do?
This PR adds the possibility to use typescript file with the method sdk:execute
How should this be manually tested?
...
Other changes
Boyscout