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

Attempt to fix #20 #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NoahAndrews
Copy link

@NoahAndrews NoahAndrews commented Jun 7, 2024

I expected this PR to fix a file's dependencies not getting re-evaluated when it's compiled, but as of now it does not. Any guidance is appreciated, though I can't guarantee that I'll have the time or motivation to come back to this PR. If someone else has time to work on this, feel free to make a new PR that includes my changes.

This PR does a couple of things:

  • Stops caching typescript compilation results
    • I did this because caching is currently done based on the mtime of a single file, when compilation of a given file is actually the result of not only itself, but all of the files that it imports.
    • Typescript compilation results can be cached again once @isaacs/cached supports caching results based on an array of files, instead of just one.
    • I did not expect this change to fix the specific issue described in Adding an export in one file and using it from in another requires a daemon restart #20
  • Queries the dependencies of the file being compiled using ts.preProcessFile(), and calls updateFileVersion() on each one
    • I was surprised to find that this did not fix the issue.

The results of compilation cannot safely be cached based purely on the
mtime of a single source file. A dependency may have (for example)
deleted something that we were referencing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant