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

Fix dynamic import base path problem for REPL and eval #2757

Merged
merged 1 commit into from Aug 9, 2019

Conversation

@kevinkassimo
Copy link
Contributor

commented Aug 9, 2019

Closes #2756

Separated into 2 parts, since <anonymous> is not known to core crate (while <unknown> is known), and that <> would be escaped for URL paths and looks ugly, thus replaced with __anonymous__.

We do not have a robust way to test REPL directly atm. Instead test on Deno.core.evalContext which is used by REPL.

@ry ry requested a review from piscisaureus Aug 9, 2019

@@ -46,6 +46,10 @@ impl fmt::Display for ModuleResolutionError {
pub struct ModuleSpecifier(Url);

impl ModuleSpecifier {
fn is_dummy_specifier(specifier: &str) -> bool {
specifier == "<unknown>"

This comment has been minimized.

Copy link
@piscisaureus

piscisaureus Aug 9, 2019

Collaborator

I think this is good as a short term fix.

Longer term, we should make ModuleSpecifier an enum , something like enum ModuleSpecifier { Url(Url), Repl(PathBuf) }, and stop converting between String/Url/ModuleSpecifier all the time, and change the resolve_import signature to
pub fn resolve_import( specifier: &str, base: ModuleSpecifier ) -> Result<ModuleSpecifier, ModuleResolutionError>.

@ry
ry approved these changes Aug 9, 2019
Copy link
Collaborator

left a comment

LGTM

@ry ry merged commit 286ee1d into denoland:master Aug 9, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.