19 KiB
19 KiB
moize CHANGELOG
6.1.6
- #196 - Fix
mjstyping not flowing through due to deep-linking ignoringindex.d.ts
6.1.5
- #186 - Avoid type issues when using in project where React is unused
6.1.4
- #184 - Fix pass-through typing for
micro-memoizedependency
6.1.3
- #179 - Invalid types for namespace methods which give the impression that chaining of those methods is possible
6.1.2
- #176 - Remove use of
new Error().stackin derivation of fallbackprofileName, due to potential for OOM crashes in specific scenarios
6.1.1
- Update
fast-equalsto latest major version
6.1.0
- #161 - Provide custom function name when supported
6.0.3
- #153 - Fix ESM/CommonJS cross-compatibility issues in NextJS
6.0.2
- Update dependencies to latest (
fast-equalsin particular to prevent surfacing of an issue it faced)
6.0.1
- #146 - Fix reading deprecated properties on function object
6.0.0
BREAKING CHANGES
moizev5 and below had a default cache size ofInfinity, however starting with v6 the default cache size will be1. If you want to maintain a cache history of multiple entries, it is recommended to usemoize.maxSizeto set the size of history desired. To replicate usage from v5 and below, usemoize.infinite.isReactoption andmoize.reactshorthand method now memoizes on a per-instance basis (previously shared cache across all instances).moize.simpleandmoize.reactSimplehave been removed due to default cache size being 1.isSerializedoption andmoize.serializeshorthand method will now serialize functions by default.shouldSerializeFunctionsoption has been removed, as serializing functions is now the default.equalsoption has been renamed tomatchesArgfor alignment withmatchesKey.
ENHANCEMENTS
- New options:
isShallowEqual(compares each arg in thekeybased on shallow equality)updateCacheForKey(if truthy value returned, will update the cached value for the givenkey)
- New shorthand methods:
moize.infinite(shorthand formaxSizeoption set toInfinity)moize.matchesArg(shorthand formatchesArgoption)moize.matchesKey(shorthand formatchesKeyoption)moize.serializeWith(shorthand forisSerializedandserializeroption)moize.shallow(shorthand forisShallowEqualoption)moize.transformArgs(shorthand fortransformArgsoption)moize.updateCacheForKey(shorthand forupdateCacheForKeyoption)
INTERNALS
- Rewritten in TypeScript, with much better type declarations.
- Changed unit test framework to
jest - Used latest external dependencies for better ESM support in Node 14
5.4.7
5.4.6
- Fix issue where
setTimeoutcauses processes to hang in NodeJS #122
5.4.5
- Improve TypeScript typings
5.4.4
- Fix export in TypeScript declarations(#105)
5.4.3
- Improve typings for TypeScript (#103)
5.4.2
- Ignore when
maxArgsormaxSizearguments are negative
5.4.1
- Upgrade to
babel@7 - Add
"sideEffects": falsetopackage.jsonfor better tree-shaking inwebpack
5.4.0
- Add ESM support for NodeJS with separate
.mjsextension exports
5.3.2
BUGFIXES
- Bump
micro-memoizedependency to fix recursive race condition issue
5.3.1
BUGFIXES
- Clean up logic surrounding
updatefunction to not unnecessarily assign the value twice
5.3.0
NEW FEATURES
- Add the
moized.updatemethod for direct cache manipulation
5.2.3
BUGFIXES
- Actually fix the issue that
5.2.2was supposed to fix (appreciate the persistence @vlad-zhukov)
5.2.2
BUGFIXES
- Fix issue where manually removing a key from
cachewould not clear / remove the expiration timeout
5.2.1
BUGFIXES
- Fix
Object.assignusage on functions (derp)
5.2.0
NEW FEATURES
- Add
collectStatsas a convenience method on the mainmoizeobject
BUGFIXES
- Fix naming convention for determining if statistics are being collected on the
moized function (isCollectingStatsnow, was mistakenlycollectStatsbefore)
5.1.2
BUGFIXES
- Reference the correct option name for
micro-memoize(isMatchingKey) instead ofmoize(matchesKey) for instance methods (oops)
5.1.1
BUGFIXES
- Ensure instance methods that update the cache work correctly with new
matchesKeyoption
5.1.0
NEW FEATURES
- Add
matchesKeyoption - Change
isSerializedto usematchesKeywith customisMatchingKeyinstead of standardisEqual
BUGFIXES
- Prevent
isDeepEqualfrom being passed to themicro-memoizeoptions
5.0.1
- Include
fast-equalsas an explicit dependency
5.0.0
- Complete refactor to leverage
micro-memoizeunder the hood (doubles the speed, and allows for more functionality)
BREAKING CHANGES
- The default
equalsoption now uses SameValueZero equality instead of strict equality equalsoption is now performed iteratively on each argument in the key, rather on the key as a wholematchesKeyoption now performs the full-key comparison thatequalsdid in v4
serializeoption has been changed toisSerializedserializeFunctionsoption has been changed toshouldSerializeFunctions- CommonJS consumers must now use
require('moize').default - The shape of the
cacheobject has changed- If you were modifying it directly instead of using the convenience methods, you may experience breakages
moize.promisenow sets bothisPromiseandupdateExpireoptions (v4 and below only setisPromise)- When
isPromiseistrueand amaxAgeis applied, themaxAgenow begins when the function is created rather than the resolution of the promise- If you want the
maxAgeto apply upon resolution, then either set theupdateExpireoption or use themoize.promiseconvenience method
- If you want the
NEW FEATURES
- Deep equality now available without custom
equalsfunction (eitherisDeepEqualoption, ormoize.deepconvenience method) - Statistics can now be collected for both global and method-specific contexts (see Collecting statistics and
profileName) - Statistics-based introspection methods exist to support reading stats
getStatswill get the stats for theprofileNamepassed, or if none is passed then gets the global statsisCollectingStatsreturns whether stats are being collected
- Cache change listeners are now available to listen for changes
onCacheAddwill fire when a new entry is added to the cacheonCacheChangewill fire when the cache is added to or the LRU order has changedonCacheHitwill fire when an existing entry in cache is used
BUGFIXES
isPromisemethods that resolved had the values re-wrapped in a new promise, which obfuscated chaining on the method (now the original promise is maintained)- Internal de-circularizer for serialized methods was flaky in deeply-nested scenarios (now uses
json-stringify-safe)
DEPRECATIONS
promiseLibraryis no longer a supported option (it is no longer needed, as the original promise is now maintained)
4.0.4
- Add
defaultproperty tomoizewhich points to itself, allowing TypeScript to import correctly as an ES module
4.0.3
- Fix issue where items manually added to cache did not have the same options (
maxAge,maxSize, etc.) applied to them as those added to cache through function call
4.0.2
- Remove duplicate internal method
4.0.1
- Update issue where
onExpirewas firing prior to removal of the key from cache
4.0.0
- Add programmatic update of expiration based on return from
onExpire
BREAKING CHANGES
onExpirewill update the expiration iffalseis returned- In prior versions, the return of
onExpirewas ignored entirely
- In prior versions, the return of
3.5.0
- Add
updateExpireoption, which if true will reset the expiration countdown based onmaxAgewhen a cached value for that key has been hit - Update TypeScript typings (thanks @Joshuaweiss)
3.4.2
- Remove unneeded constants declarations for smaller footprint
3.4.1
- Remove code duplication and unnecessary cache key segregation (reduced library size by ~10.6%)
- Improve Flow typings (no longer driven off of TypeScript typings)
3.4.0
- Add
onExpirecallback that fires when a cache item expires
3.3.1
- Fix TypeScript definitions with correct declarations (thanks @iHaiduk)
3.3.0
- Add
estranspilation in addition to standardlib, preserving ES2015 modules forpkg.module
3.2.2
- Refactor
ReactCacheKeyto double the speed (yes, double)
3.2.1
- Fix issue where
MultipleParameterCacheKeyandReactCacheKeywere not applyingequalscorrectly
3.2.0
- Add
transformArgsoption, which allows trasformation of the arguments prior to being used as a key
3.1.2
- Fix
clearreferencing incorrect object - Fix
equalsnot usingmatchesCustomwhen used in conjunction withserialize
3.1.1
- BAD PUBLISH - do not use!
3.1.0
- New: add
isMoizedintrospection method - New; add FlowType declarations based on TypeScript typings
- New: add
prettierto project, with pre-commit hooks to format the code - Fix: only serialize key once when attempting to match in cache (was serializing on every iteration)
3.0.2
- Improve performance of
takeby making it a higher-order function
3.0.1
- Update TypeScript typings to include new
equalsoption
3.0.0
- Improve performance of multiple parameter cache matching (~3x faster)
- Improve performance of
reactfunctional component cache matching (~9.5x faster) - Improve performance of serialized parameter cache matching (~1.5x faster)
- Improve performance of use with
maxArgs - Add
equalsoption for ability to provide custom equality comparison method - Add
moize.reactSimpleshortcut method to limitreactcache size to1(mimics thePureComponentoptimization) - Add
isReactoption for simplerreactconfiguration viaoptions - Fix issue where
moizewas only able to curryoptionsonce - Fix issue with
reactcache where different functions with identical names / body contents were seen as equal - Fix issue where
maxArgswas not always respected forserializecaches
BREAKING CHANGES
- Custom
cacheis no longer available inoptions moize.reactnow performs a shallow equal comparison ofpropsandcontextinstead of deep value comparison- If you want to perform a deep value equality comparison (if you are mutation props, for example), pass a deep equality comparison method via the
equalsoption such aslodash'sisEqual - If you want to continue using the v2 version of
moize.react, you can manually apply the options:moize.serialize(fn, {maxArgs: 2, serializeFunctions: true})
- If you want to perform a deep value equality comparison (if you are mutation props, for example), pass a deep equality comparison method via the
- The direct cache manipulation
deletemethod has been renamed toremove - The direct cache manipulation
hasCacheFormethod has been renamed tohas - The
keypassed to direct cache manipulation methods (add,has,remove) must now be an array- The array reflects the arguments passed to the method (
moized.hasCacheFor('foo', 'bar')=>moized.has(['foo', 'bar']))
- The array reflects the arguments passed to the method (
2.5.1
- Surface types for TypeScript correctly
2.5.0
- Add TypeScript definitions (thanks vhfmag)
- Skip unneeded first entry iteration when getting the multi-parameter key or finding the index of a key
2.4.1
- Make positive integer checker use regex instead of bitwise operation
2.4.0
- Add
hasCacheFormethod to determine if the memoized function has cache for given arguments
2.3.3
- Remove unneeded iterator key generator method
- Various micro-optimizations
2.3.2
- Add
lodash-webpack-pluginfor smallerdistbuilds
2.3.1
- Streamline the creation of curriable shortcuts (
moize.maxAge,moize.maxSize) - Add curriable shortcut for
moize.maxArgs(missed in initial release)
2.3.0
- More options have shortcut methods
maxAge- Curried method (example:
moize.maxAge(5000)(method))
- Curried method (example:
maxSize- Curried method (example:
moize.maxSize(5)(method))
- Curried method (example:
promise(shortcut forisPromise: true)serializesimple(shortcut formaxSize: 1)
moizefunctions are now composable (example usage:moize.compose(moize.react, moize.simple))
2.2.3
- Simplify internal vs custom cache recognition
- Typing and documentation cleanup
2.2.2
- Abstract out
promiseResolverandpromiseRejecterinto separate testable functions - Various code cleanups and typing enhancements
2.2.1
- Fix issue with
deletecheckingsizeof theCachebefore it had actually updated
2.2.0
- Added
promiseLibraryoption to allow use of custom promise implementation - Bolster
isPromiselogic, auto-removing from cache when the promise is rejected - Update README for more detailed information on both
isPromiseandpromiseLibraryoptions - Convert
Cachekey iteration to use custom iterator instead of standard loop for more stable iteration
2.1.6
- Code cleanup
2.1.5
- Fix issue where
deletewould always set thelastItemtoundefinedeven when items still remained in cache
2.1.4
- Move multiple-parameter key matching to cache (allows for custom
cacheto have its own implementation) - Update documentation for the custom
cacheimplementation, as it requiresgetMultiParamKeynow, plus give a better example of an alternativecache - Make
keys()andvalues()methods no-ops when cache implementation is custom - Make
deleteItemFromCachemethod safe with customcacheimplementations
2.1.3
- Enhance
Cachemore for multiple-parameter functions (now benchmarks faster in all categories)
2.1.2
- Have
areArraysShallowEqualuseisEqualinstead of strict equality to allow forNaNas key
2.1.1
- Optimize cache class to be more efficient in both
hasandgetoperations - Fix issue with
deletethat was preventing delete of falsy keys
2.1.0
- Add
addmethod on cache to allow for manual cache insertion
2.0.3
- Ensure
maxArgsis respected for unserialized functions - Change the arguments length check from
=== 1to>so that zero arguments (undefinedkey) pulls from cache directly instead of tries to go through key matching for multiparam
2.0.2
- Prevent memoization on
moize.reactbased on third parameter to functional components (object of all internal react functions)
2.0.1
- Fix static types applied to functional components not being applied to memoized component
2.0.0
- Refactor to use object equality instead of serialization (vast speed improvements over 1.x.x with multiple parameters)
BREAKING CHANGES
- If you were relying on the serialization (using value equality instead of object equality), it will no longer memoize (you can set
serialize: trueif you want to continue using that option) - If you were using
moizeto memoize React components, you should change your invocations frommoizetomoize.react(see README)
1.5.0
- Add
valuesmethod on memoized function (gets list of computed values stored in cache) - Fix issue with
clearmethod not being present onCache
1.4.5
- Switch to using Cache for caching instead of native Map (was previously only used for polyfilling, but is twice as fast ... I feel silly for not testing its performance prior)
- Simplify and optimize Cache to crank out as much speed as possible
1.4.4
- Add
displayNameproperty to memoized function for better display of memoizedreactcomponents in DevTools - Throw a
TypeErrorwhen the parameter passed to moize is not a function
1.4.3
- Move internal serializer generation to utils, for further partial application leveraging
1.4.2
- Leverage partial functions in a number of places (less arguments passed around, improves performance by ~6%)
1.4.1
- Correct README error explaining
serializeFunctionsoption
1.4.0
- Add
serializeFunctionsoption
1.3.3
- Ensure all numeric parameters (
maxAge,maxArgs,maxSize) are a finite positive integer
1.3.2
- Replace array-based decycle with Map (performance on circular objects)
1.3.1
- Fix README errors
1.3.0
- Add keys method to memoized function, to know the size and also get keys for potential deletion
- Update decycle method with modern techniques and helper functions for better circular reference performance
1.2.0
- Add
maxArgsconfiguration option to limit the number of arguments to use in the key creation for cache
1.1.2
- Remove external dependencies in favor of local
Cacheanddecycleimplementation (smaller bundle size)
1.1.1
- Make handling of circular handling automatic by stringifying in
try/catch, and remove manualisCircularconfiguration option
1.1.0
- Add
cycledependency to handle circular objects - Add
clearanddeletemethods on the memoized function to allow for direct cache manipulation
1.0.3
- Remove warning related to
map-or-similardependency consumption
1.0.2
- Remove no-longer-needed dependencies
1.0.1
- Remove unneeded folders and files from npm package
1.0.0
- Initial release