-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Follow redirect location as new referrers for nested module imports #2031
Conversation
cli/deno_dir.rs
Outdated
/// download will be written to "filename". This happens no matter the value of | ||
/// use_cache. | ||
fn get_source_code_async( | ||
self: &Self, |
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.
I'd prefer if we could keep these functions out of DenoDir and rather provide explicit parameters for whatever it needs. (During a recent refactoring in this file I discovered these methods to be rather tangled up without a particularly good reason.)
"filename" should already give the location of the cache. You should be able to use that for resolving the "mime file" ?
// May not exist. DON'T unwrap. | ||
let _ = std::fs::remove_file(&metadata_filename); | ||
let p = PathBuf::from(filename); | ||
// TODO(kevinkassimo): consider introduce serde::Deserialize to make things simpler. |
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.
Yes, we need to do this soon. There's another place in the source map handler where I'm manually parsing JSON like this.
052049e
to
d5b79d2
Compare
d7fcdcd
to
8dd76fd
Compare
b105117
to
fb29581
Compare
fb29581
to
6aea655
Compare
@kevinkassimo Is this ready or are you still working on it? I'm ready to land. |
@ry should be ready |
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.
LGTM! Thank you for this important and difficult fix.
We need to refactor DenoDir soon. I will start an issue and let's scope out what a new implementation would need.
Initial attempt to resolve #1742 and #2021. Both examples in the 2 issues seem to be working now:
It is achieved by extending
*.mime
files into*.headers.json
files, which is now of JSON format and might optionally contain a fieldredirect_to
that points to the location of the final redirect.For example, for
https://import-meta.now.sh/redirect.js
,$DENO_DIR/deps/https/import-meta.now.sh/redirect.js
is never created. Instead,$DENO_DIR/deps/https/import-meta.now.sh/redirect.js.headers.json
is created with the following content:which points to the actual cached file location (
https://import-meta.now.sh/sub/final1.js
)TODO:
(Struggling to catch up with recent codebase changes so there is high potential of new bugs introduced)