Merged
Conversation
…e manifests with an internal cache
…ontents of manifets with an internal cache
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors AST parsing and module resolution caching by replacing the external memoize library with internal Map-based caches. The change removes a dependency while maintaining the same caching functionality.
Key Changes:
- Replaced
memoizelibrary with native JavaScriptMapobjects for caching - Implemented explicit cache logic with
has(),get(), andset()operations - Updated all cache clearing functions to use
Map.clear()method
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/extract/tsc/parse.mjs |
Replaced memoize with Map-based cache for TypeScript AST parsing |
src/extract/swc/parse.mjs |
Replaced memoize with Map-based cache for SWC AST parsing |
src/extract/resolve/resolve-amd.mjs |
Replaced memoize with Map-based cache for file existence checks |
src/extract/resolve/get-manifest.mjs |
Replaced memoize with two separate Map-based caches for single and combined package manifests |
src/extract/resolve/external-module-helpers.mjs |
Replaced memoize with Map-based cache for package.json lookups using composite cache keys |
src/extract/acorn/parse.mjs |
Replaced memoize with Map-based cache for Acorn JavaScript AST parsing |
package.json |
Removed memoize dependency |
package-lock.json |
Removed memoize and updated mimic-function to dev dependency only |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
memoizewith internal cache representations (Maps)memoizepackage from the manifest and the lock filePrevious commits already replaced
memoizewith internal caches in other partsof the code.
Motivation and Context
Our caching needs previously solved with
memoizeare pretty trivial. They're just as easy and just as maintainable implemented with internal caches. This reduces our direct runtime dependencies with 2 external packages (memoizeand its dependencymimic-function).B.t.w.
memoizeis a very decent package and I still think memoization is an elegant abstraction. So I'm not dropping it out of any concern or issues on the memoize package itself.How Has This Been Tested?
Types of changes
Checklist
📖
⚖️