-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Resolve paths for views asynchronously #2653
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
base: master
Are you sure you want to change the base?
Conversation
Nice! Anyway we can add to this a way to prevent stampeding (which the sync version protected from) to the default lookup implementation? |
Oh, yes! I think I could work that in. |
Updated. |
a048a24
to
4de612f
Compare
5f268a4
to
9848645
Compare
👍 |
eb10dba
to
340be0f
Compare
Hey, @aredridel could you rebase this PR, please? |
Will do later today hopefully |
It is just lovely when a 10 year old PR with value is revived! This might not make it into the |
4de612f
to
747869f
Compare
Isn't it just? I get so mad when projects close things after 30 or 180 days as stale. Sometimes we should take our time! Anyway, rebased. I did not keep the view options being passed to the lookup function. That's a little useful, I guess, but not really needed. |
747869f
to
ffeab94
Compare
I just merged the last required change we needed to land before cutting the |
The fact that we have no direct coverage for the const View = app.get('view');
const view = new View();
const path = view.lookup('name'); And this would break with this change. In some past cases we have been careful enough to avoid even this internal concealed breakage. That said, I am actually a fan of us moving a bit toward keeping our internals safe and then breaking them more often. That is one of the only ways to really prevent folks from coupling to them. So with that in mind I personally would love to land this for the 5.1.0 release but will need to get more consensus before we do. This might mean it doesn't make the timeline, but 🤷 what's another 10 years? Either way, pinging in @expressjs/express-tc just in case anyone has an immediate and strong opinion. |
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!
I don't have a strong opinion on this, I'd rather not say anything.
If someone is doing this, they really should stop. The location of that file could be deleted or moved, which would affect their application, and I don’t think we should worry about that. By the way, we should start testing the views whenever possible. |
Agreed. This would focus compatibility with the contract, which I think is good. Users can always figure out creative ways to use the library in ways it wasn't intended to be used (like deep imports) 🙂 but I'm fine with breaking those. |
This eliminates the only post-startup synchronous I/O in Express.
In addition, this makes the view.lookup method non-private, intended to be used
by view engines to resolve paths to partials, and, if the View class is
extended, could be used for other resources such as internationalized messages.