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

Create a NonCacheRewriter and export cacheRewrittenSourceMap #111

Merged
merged 3 commits into from
Jan 10, 2025

Conversation

uurien
Copy link
Collaborator

@uurien uurien commented Jan 3, 2025

What does this PR do?

Create a NonCacheRewriter class and export cacheRewrittenSourceMap method.

Motivation

Use this in independent thread to rewrite esm files without loading the cache in this thread, and update the cache in the main thread using exported method.

Additional Notes

Describe how to test your changes

Checklist

  • The CHANGELOG.md has been updated
  • Unit tests have been updated and pass
  • If known, an appropriate milestone has been selected

@uurien uurien marked this pull request as ready for review January 3, 2025 15:28
@uurien uurien requested a review from a team as a code owner January 3, 2025 15:28
@uurien uurien changed the title Create a NonCacheRewriter Create a NonCacheRewriter and export cacheRewrittenSourceMap Jan 3, 2025
@uurien uurien marked this pull request as draft January 3, 2025 15:30
@uurien uurien marked this pull request as ready for review January 3, 2025 15:42
@iunanua
Copy link
Collaborator

iunanua commented Jan 4, 2025

Another option could be to continue with a single Rewriter class add a doNotCache parameter to rewrite(code: string, file: string, doNotCache: bool): Result method and skip calling cacheRewrittenSourceMap() when doNotCache: true

But thinking in ESM, I guess it is more elegant to have Rewriter and NonCacheRewriter different classes

@uurien uurien merged commit 8acf326 into main Jan 10, 2025
19 checks passed
@uurien uurien deleted the ugaitz/add-non-cache-rewriter branch January 10, 2025 11:05
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.

3 participants