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] Add REPL example #415

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

[WIP] Add REPL example #415

wants to merge 10 commits into from

Conversation

bartlomieju
Copy link
Member

Closes #411

@@ -0,0 +1,528 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use deno_core::serde::Deserialize;
Copy link
Member Author

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

Comment on lines 96 to 108
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),
}
}
}
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

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).

bartlomieju added a commit to denoland/deno that referenced this pull request Jan 5, 2024
Some drive-by cleanup as I'm working through
denoland/deno_core#415.
bartlomieju added a commit to denoland/deno that referenced this pull request Jan 12, 2024
Some drive-by cleanup as I'm working through
denoland/deno_core#415.
bartlomieju added a commit that referenced this pull request Jan 31, 2024
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.
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.

Add REPL example
2 participants