-
Notifications
You must be signed in to change notification settings - Fork 77
Fix/typescript dependency caching #1703
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
Fix/typescript dependency caching #1703
Conversation
Resolves tscircuit#1696 by preventing unnecessary re-downloading of TypeScript dependencies. - Add fetchWithPackageCaching function with 7-day TTL cache - Remove complex closure patterns in ATA fetcher configuration - Simplify @tsci package handling to single URL pattern - Use compression for efficient storage - Remove unnecessary hash functions and error handling complexity The implementation now uses a clean function reference instead of confusing closures: fetcher: fetchWithPackageCaching as typeof fetch
The apiUrl variable is still needed for the AI autocomplete feature. Only the ATA fetcher was simplified to use fetchWithPackageCaching.
Auto-formatted code according to project style guidelines.
- Add proper type validation for cached data before destructuring - Support all @tsci URL patterns: jsdelivr.net, data.jsdelivr.com resolve/npm - Include jsdelivr_resolve parameter for resolve URLs - Prevent runtime errors from corrupted cache data
Auto-format code for consistency with project style guidelines.
- Add missing package name transformation logic that was in original code - Convert dots to slashes in package names for proper URL routing - Fixes package resolution for @tsci packages with dots in names - Maintains backward compatibility with existing package patterns
@seveibar can i get a review on this |
…ication - Restore CACHE_PREFIX variable and use it consistently - Add TTL check for TypeScript lib files (7-day expiration) - Replace complex regex with simple string operations using indexOf/substring - Apply consistent cache data structure with timestamp for all cached items - Maintain backward compatibility while improving code clarity Addresses feedback from @imrishabh18: - No more complex regex patterns - Proper TTL handling for TypeScript library files - Consistent use of CACHE_PREFIX constant
The original code used /\./ to replace only the FIRST dot, not all dots. Using /\./g could break package resolution for packages with multiple dots. Changes /\./g back to /\./ to maintain backward compatibility with existing package naming conventions.
Extract status, statusText, and headers properties instead of passing the entire Response object. The Response constructor expects a ResponseInit object as the second parameter, not a Response instance. This prevents potential runtime errors and ensures proper response object creation with correct metadata.
@imrishabh18 can i get a another round of review for this ? |
@seveibar can i get a review on this |
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
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.
please update your PR. otherwise it's closed automatically
This is pretty good |
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.
Maybe @imrishabh18 can review & merge if it looks good.
@Sahelisaha04 if you want faster reviews, you can join the discord: https://tscircuit.com/join and shout in the #reviewme channel. Sorry it took so long for me to review
okay on it |
cc @imrishabh18 can you pls review it |
Fixes #1696
/claim #1696
Screencast.From.2025-09-24.14-24-00.1.mp4
adding video