Releases: lxsmnsyc/forgetti
Releases · lxsmnsyc/forgetti
v0.8.0
v0.7.0
What's Changed
- Separate
$$ref
from$$cache
by @SukkaW in #30- Pretty big internal change, so I have to make a minor release. This change separates ref handling from cache management (instead of
useRef
for all,useRef
is only now used for refs, the rest usesuseMemo
). This change is pretty much aligned to React's behavior e.g. Server Components support and proper cache management throughuseMemo
- Pretty big internal change, so I have to make a minor release. This change separates ref handling from cache management (instead of
Full Changelog: v0.6.2...v0.7.0
v0.6.0
- Change cache generation to use
useRef
instead ofuseMemo
e288b04- React may potentially free up
useMemo
references in a scheduled way (think of LRU).useRef
doesn't have this kind of behavior
- React may potentially free up
- Add auto-memoization runtime for JSX 1645c4d
- This allows components of the respective framework to re-render only when necessary.
- Change preset config API d14ccd9
- Deprecate
optimizeJSX
config 27093b7- Defining
runtime.memo
in the preset will automatically generate JSX optimization
- Defining
v0.5.0
This release adds a new optimization process on top of the current memoization process. Forgetti will now run the transform as follows:
- Pre-inlining
Variable declarations that can be inlined are recursively inlined. This allows the memoization step to know the largest possible constant expression and cache it in a single entry. - Expansion
Assignment expressions and hooks had issues in optimization in 0.4.x. With the expansion step, these expressions are now moved before the parent statement path, and ensures that these expressions are called out of their rules. - Simplify
Some expressions that are guaranteed to have literal evaluation are evaluated in compile-time. - Memoization
This is where the old core runs. A major difference compared to 0.4.x now is that the memoization process will test first if the entire expression is a "constant" to save more cache slots. Previously, it would subdivide naively, generating unnecessary amount of caching. - Post-inlining
Same process as step 1. This allows generated variables to be inlined so that there's less output.
Changes
- Fix #14 by @SukkaW in #15
- Fix nested hook call by @SukkaW in #18
- Fix hook expr optimization and add optimization steps by @lxsmnsyc in #20
- Add cache to isConstant and isContainsHook by @SukkaW in #19
- Feat: accept exclude components options by @SukkaW in #17
- 0.5.0 by @lxsmnsyc in #21
Full Changelog: v0.4.7...v0.5.0
v0.3.0
- Fix constant expressions to use logical OR assignment shorthand 6f3b926
- Add support for
throw
statements 37c1d3c - Add support for labeled statements 4df469f
- Fix subsequent
let
to be merged as a single declaration 5d224a4 - Fix
useMemo
anduseCallback
tracked dependency - Improve docs
Full Changelog: v0.2.0...v0.3.0
v0.2.0
- Now auto-memoizes
useRef
import { useRef } from 'react';
function Example(props) {
return useRef(props.value);
}
// Compiles into
import { useMemo as _useMemo } from "react";
import { useRef } from 'react';
function Example(props) {
let _c = _useMemo(() => new Array(1), []);
let _v = _c[0] || (_c[0] = {
current: props.value
});
return _v;
}
Full Changelog: v0.1.1...v0.2.0