feat(repl): support --import flag#33104
Open
seroperson wants to merge 3 commits intodenoland:mainfrom
Open
Conversation
ce3f356 to
937d5dd
Compare
937d5dd to
bb7ee8e
Compare
Contributor
Author
|
@bartlomieju @littledivy Hello! Sorry for pinging you, but would you mind reviewing this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23071
--importflag (alias for--preload) for thereplcommand, which loads each specified module using V8 APIs and assigns its' named exports to the global scope.I've implemented it using V8 APIs thought the same is likely possible using evaluating plain JS strings. Maybe the second approach could be simpler, just from my point of view it's bit of dirty.
It's kind of similar to
--eval-file, but different in details:--eval-filefetches the raw text content of a file and evaluates it as a script in the REPL context:jsr:ornpm:schemesWhile
--import:jsr:,npm:,https:specifiers workSo,
--importjust complements the--eval-file.How to use
Testing
co-authored with Claude Opus 4.6, mostly for consulting about the codebase.