Skip to content

Releases: lxsmnsyc/forgetti

v0.8.0

15 Jan 07:10
Compare
Choose a tag to compare
  • Moved to Biome for better linter/formatter stuff.
  • Fix generated templates to have better dev-only names
Screenshot 2024-01-15 at 3 09 09 PM

v0.7.0

21 Aug 12:13
Compare
Choose a tag to compare

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 uses useMemo). This change is pretty much aligned to React's behavior e.g. Server Components support and proper cache management through useMemo

Full Changelog: v0.6.2...v0.7.0

v0.6.0

29 May 07:32
Compare
Choose a tag to compare
  • Change cache generation to use useRef instead of useMemo e288b04
    • React may potentially free up useMemo references in a scheduled way (think of LRU). useRef doesn't have this kind of behavior
  • 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

v0.5.0

15 May 14:17
Compare
Choose a tag to compare

This release adds a new optimization process on top of the current memoization process. Forgetti will now run the transform as follows:

  1. 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.
  2. 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.
  3. Simplify
    Some expressions that are guaranteed to have literal evaluation are evaluated in compile-time.
  4. 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.
  5. Post-inlining
    Same process as step 1. This allows generated variables to be inlined so that there's less output.

Changes

Full Changelog: v0.4.7...v0.5.0

v0.3.0

08 Mar 15:17
Compare
Choose a tag to compare
  • 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 and useCallback tracked dependency
  • Improve docs

Full Changelog: v0.2.0...v0.3.0

v0.2.0

03 Mar 01:49
Compare
Choose a tag to compare
  • 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