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

Dep round trip #1415

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Dep round trip #1415

wants to merge 2 commits into from

Conversation

thedufer
Copy link

This fixes jsdf/browserify-incremental#22, which arises because dep events come with a row that can't be fed back into the cache. This happens in the case when you have a file that is both exposed and required under its exposed name in the same bundle (which seems like it ought to be valid, and works fine without setting the cache option).

Aaron Dufour added 2 commits October 26, 2015 13:29
Browserify-incremental makes the assumption that we can round-trip `dep` events
(slightly mutated to form an object with `row.file` as the key) back into the
cache with no ill effects.  This is true except for the edge case shown here -
when you are both exposing a module and requiring it in the same bundle.
It should be safe to not walk down an exposed module, since it's being taken
care of at the top-level.  If we don't do this, `module-deps` tries to open a
file using the module's exposed name rather than a valid filename, which errors
out.

This is only triggered by passing in a cache value that should be valid.
@jmm
Copy link
Collaborator

jmm commented Oct 26, 2015

@thedufer Thanks for contributing to browserify! I haven't looked at your PR enough to comment on anything else, but re:

This happens in the case when you have a file that is both exposed and required under its exposed name in the same bundle (which seems like it ought to be valid

That actually is not documented. In my opinion nothing related to that should be changed without it first being documented. I think it's intended to work that way, and therefore should be documented, but I've gotten no feedback on my issue.

@thedufer
Copy link
Author

We definitely depend on that behavior, although I do now remember that we had to do some testing to make sure it did what we hoped, because of the lack of documentation. I agree that it should be documented. Anything I can do to help? What kind of feedback would you want on that issue before its worth fixing up the documentation?

@jmm
Copy link
Collaborator

jmm commented Oct 26, 2015

@thedufer

Anything I can do to help?

Probably not, unfortunately, but thank you for asking. 😃

What kind of feedback would you want on that issue before its worth fixing up the documentation?

It's definitely worth fixing (if there's something to be fixed). I'm looking for feedback from @substack or at least a couple of other Collaborators. I can make a guess, even an educated one, on my own about how it's intended to work, but that's a haphazard basis for changing API documentation (and that can be tantamount to changing the API itself, which as far as I know no Collaborator should be doing unilaterally).

We definitely depend on that behavior, although I do now remember that we had to do some testing to make sure it did what we hoped, because of the lack of documentation.

I'd give all the usual cautions about relying on undocumented behavior. People constantly want to do things that are undocumented and that do actually work the way they'd like, until it breaks in a future release (even a patch). See for example (they're all about the same undocumented behavior that lots of people were relying on):

#1044
#1191
#1199
#1213
#1217

@thedufer
Copy link
Author

All of our build tools are carefully frozen to exact versions and we do thorough testing before pushing an upgrade to any of them. We're perfectly willing to fix things if this behavior changes; in the meantime, it's worth depending on this UB because we're getting significant performance benefits related to caching that we wouldn't be able to get without it.

Thanks for the warning, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Exposed module requiring other exposed module results in error when using cache
2 participants