babel-plugin-react-turbo
Advanced tools
Comparing version 0.1.17 to 0.1.18
@@ -14,2 +14,6 @@ export const code = ` | ||
}) { | ||
const {a2} = {}; | ||
const {a: {b: [c]}, x: {g}} = {}; | ||
const {a: [i, j]} = {}; | ||
const [{x}, yy] = []; | ||
return ( | ||
@@ -74,6 +78,4 @@ <div> | ||
const tick = useTick(xxx, text); | ||
const ta = tick.ta; | ||
const {ta, tb} = useTick(xxx, text); | ||
const reff2 = React.useRef(); | ||
const tb = tick.tb; | ||
const abc = () => { | ||
@@ -121,4 +123,3 @@ const setText2 = 'sdf'; | ||
import React, { useState } from "react"; | ||
function A___({ | ||
export default ReactTurbo.reactify(function A___({ | ||
proxy: props | ||
@@ -129,7 +130,4 @@ }) { | ||
return <React.Fragment>{(() => {})()}</React.Fragment>; | ||
} | ||
const A = ReactTurbo.reactify(A___); | ||
function Filter___({ | ||
}); | ||
export const Filter = ReactTurbo.reactify(function Filter___({ | ||
proxy: { | ||
@@ -139,2 +137,13 @@ text | ||
}) { | ||
const _temp = {}; | ||
const a2 = _temp["a2"]; | ||
const _temp2 = {}; | ||
const g = _temp2["x"]["g"]; | ||
const c = _temp2["a"]["b"][0]; | ||
const _temp3 = {}; | ||
const j = _temp3["a"][1]; | ||
const i = _temp3["a"][0]; | ||
const _temp4 = []; | ||
const yy = _temp4[1]; | ||
const x = _temp4[0]["x"]; | ||
return <div> | ||
@@ -144,7 +153,4 @@ {text} | ||
return <React.Fragment>{(() => {})()}</React.Fragment>; | ||
} | ||
const Filter = ReactTurbo.reactify(Filter___); | ||
function useTick(start, themeColor) { | ||
}); | ||
export function useTick(start, themeColor) { | ||
const Hook___ = React.useMemo(() => ReactTurbo.reactify(function Hook___({ | ||
@@ -271,3 +277,3 @@ proxy: { | ||
function Main___({ | ||
const Main = ReactTurbo.reactify(function Main___({ | ||
proxy: { | ||
@@ -299,8 +305,8 @@ a | ||
proxy: { | ||
tick: tick | ||
_temp5: _temp5 | ||
} | ||
}) { | ||
const ta = ReactTurbo.combine(tick, tick => tick.ta); | ||
const tb = _temp5["tb"]; | ||
const ta = _temp5["ta"]; | ||
const reff2 = React.useRef(); | ||
const tb = ReactTurbo.combine(tick, tick => tick.tb); | ||
const abc = ReactTurbo.combine(text, text => () => { | ||
@@ -357,6 +363,4 @@ const setText2 = 'sdf'; | ||
}); | ||
return <Im xxx={xxx} text={text} ren___der={tick => <Re tick={tick}></Re>}></Im>; | ||
} | ||
const Main = ReactTurbo.reactify(Main___); | ||
export default Main;`; | ||
return <Im xxx={xxx} text={text} ren___der={_temp5 => <Re _temp5={_temp5}></Re>}></Im>; | ||
}); | ||
export const MainRee = Main;`; |
import { constifyFn } from './constifyFn.js'; | ||
import { destructuring } from './destructuring.js'; | ||
import { wrapIf } from './wrapIf.js'; | ||
export function preprocess(path) { | ||
destructuring(path); | ||
wrapIf(path); | ||
constifyFn(path); | ||
} |
{ | ||
"name": "babel-plugin-react-turbo", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"description": "Babel plugin for react-turbo", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -17,2 +17,6 @@ // const code = `function square(n) { | ||
}) { | ||
const {a2} = {}; | ||
const {a: {b: [c]}, x: {g}} = {}; | ||
const {a: [i, j]} = {}; | ||
const [{x}, yy] = []; | ||
return ( | ||
@@ -77,6 +81,4 @@ <div> | ||
const tick = useTick(xxx, text); | ||
const ta = tick.ta; | ||
const {ta, tb} = useTick(xxx, text); | ||
const reff2 = React.useRef(); | ||
const tb = tick.tb; | ||
const abc = () => { | ||
@@ -125,4 +127,3 @@ const setText2 = 'sdf'; | ||
import React, { useState } from "react"; | ||
function A___({ | ||
export default ReactTurbo.reactify(function A___({ | ||
proxy: props | ||
@@ -133,7 +134,4 @@ }) { | ||
return <React.Fragment>{(() => {})()}</React.Fragment>; | ||
} | ||
const A = ReactTurbo.reactify(A___); | ||
function Filter___({ | ||
}); | ||
export const Filter = ReactTurbo.reactify(function Filter___({ | ||
proxy: { | ||
@@ -143,2 +141,13 @@ text | ||
}) { | ||
const _temp = {}; | ||
const a2 = _temp["a2"]; | ||
const _temp2 = {}; | ||
const g = _temp2["x"]["g"]; | ||
const c = _temp2["a"]["b"][0]; | ||
const _temp3 = {}; | ||
const j = _temp3["a"][1]; | ||
const i = _temp3["a"][0]; | ||
const _temp4 = []; | ||
const yy = _temp4[1]; | ||
const x = _temp4[0]["x"]; | ||
return <div> | ||
@@ -148,7 +157,4 @@ {text} | ||
return <React.Fragment>{(() => {})()}</React.Fragment>; | ||
} | ||
const Filter = ReactTurbo.reactify(Filter___); | ||
function useTick(start, themeColor) { | ||
}); | ||
export function useTick(start, themeColor) { | ||
const Hook___ = React.useMemo(() => ReactTurbo.reactify(function Hook___({ | ||
@@ -275,3 +281,3 @@ proxy: { | ||
function Main___({ | ||
const Main = ReactTurbo.reactify(function Main___({ | ||
proxy: { | ||
@@ -303,8 +309,8 @@ a | ||
proxy: { | ||
tick: tick | ||
_temp5: _temp5 | ||
} | ||
}) { | ||
const ta = ReactTurbo.combine(tick, tick => tick.ta); | ||
const tb = _temp5["tb"]; | ||
const ta = _temp5["ta"]; | ||
const reff2 = React.useRef(); | ||
const tb = ReactTurbo.combine(tick, tick => tick.tb); | ||
const abc = ReactTurbo.combine(text, text => () => { | ||
@@ -361,6 +367,4 @@ const setText2 = 'sdf'; | ||
}); | ||
return <Im xxx={xxx} text={text} ren___der={tick => <Re tick={tick}></Re>}></Im>; | ||
} | ||
const Main = ReactTurbo.reactify(Main___); | ||
export default Main;`; | ||
return <Im xxx={xxx} text={text} ren___der={_temp5 => <Re _temp5={_temp5}></Re>}></Im>; | ||
}); | ||
export const MainRee = Main;`; |
@@ -5,7 +5,9 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
import { constifyFn } from './constifyFn.js'; | ||
import { destructuring } from './destructuring.js'; | ||
import { wrapIf } from './wrapIf.js'; | ||
export function preprocess(path: NodePath<t.FunctionDeclaration>) { | ||
destructuring(path); | ||
wrapIf(path); | ||
constifyFn(path); | ||
} |
97881
114
2677