-
Notifications
You must be signed in to change notification settings - Fork 100
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] Add REPL example #415
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,528 @@ | |||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. | |||
|
|||
use deno_core::serde::Deserialize; |
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.
Upstream it in a separate PR
core/examples/repl.rs
Outdated
pub enum EvaluationOutput { | ||
Value(String), | ||
Error(String), | ||
} | ||
|
||
impl std::fmt::Display for EvaluationOutput { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
EvaluationOutput::Value(value) => f.write_str(value), | ||
EvaluationOutput::Error(value) => f.write_str(value), | ||
} | ||
} | ||
} |
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.
seems excessive for an example
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's copy-pasted from cli/tools/repl
. I'm trying to slim it down as much as possible so we can turn it into a runtime API to provide node:repl
polyfill.
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.
Plus see #412 - Matt and I have been discussing this and we want to do a bin target to be able to test changes quickly without having to rebuilt deno
itself (because iterating on deno_core
is waaaaaay faster).
Some drive-by cleanup as I'm working through denoland/deno_core#415.
Some drive-by cleanup as I'm working through denoland/deno_core#415.
This commit adds minimal binary target to "deno_core" crate. It is now possible to "cargo run ./path/to/file.ts" to execute a file. This feature is being added for development and testing purposes only and is not meant for end-users. The API is minimal and the binary can't do anything interesting. "fs_module_loader" example has been removed in favor of binary target. Closes #412 Once #415 lands we can extend functionality further.
Closes #411