Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
feat: Support transforming hooks and arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mohebifar committed Feb 28, 2024
1 parent ba7fd3d commit fc8db84
Show file tree
Hide file tree
Showing 6 changed files with 324 additions and 172 deletions.
15 changes: 9 additions & 6 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ Type: `Feature` - `Bug` - `Enhancement` - `Refactor` - `Unknown`
- [x] `Enhancement` Memoize any non-primitive value used in JSX
- [x] `Enhancement` Support memoization of object destructuring
- [x] `Enhancement` Unwrap JSX elements into memoizable variables
- [ ] `Enhancement` Support side-effect for dependencies
- [ ] `Feature` Support transforming hooks
- [ ] `Enhancement` Support memoization of callbacks declared using function declarations
- [x] `Enhancement` Support components with multiple returns
- [x] `Enhancement` Support side-effect for dependencies
- [x] `Feature` Support transforming hooks
- [ ] `Enhancement` Support memoization of callbacks declared using function declarations after

### Low Priority

- [ ] `Enhancement` Skip memoization of useState setter functions
- [ ] `Enhancement` When unwrapping array and object patterns, optimize the unwrapping by limiting it to component variables
- [ ] `Enhancement` Support React.createElement calls
- [ ] `Enhancement` Hot module reloading improvement utilizing a checksum to invalidate cache
- [x] ~`Enhancement` Hot module reloading improvement utilizing a checksum to invalidate cache~ Not needed
- [ ] `Feature` Memoize array map items

## `Feature` ESLint Plugin
Expand All @@ -30,5 +34,4 @@ The following are unknowns that need to be researched and tested.

- [ ] Assignment expressions in JSX `<div>{(a = 1)} {a}</div>` - is the order of execution guaranteed?
- [ ] Source maps - is it possible to generate source maps for the transformed code?
- [ ] Hot reloading - how does hot reloading work with the transformed code?
- [ ] Memoization of values declared after the first return statement
- [x] ~Hot reloading - how does hot reloading work with the transformed code?~ It works!
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const parseCodeAndRun = (fixtureName: string) => {

describe("Component fixtures", () => {
describe("applyModification", () => {
it.each(Array.from({ length: 12 }, (_, i) => `fixture_${i + 1}`))(
it.each(Array.from({ length: 13 }, (_, i) => `fixture_${i + 1}`))(
"%s",
(fixtureName) => {
const [, program] = parseCodeAndRun(fixtureName);
Expand Down
Loading

0 comments on commit fc8db84

Please sign in to comment.