We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimizer is a tool that consumes input source files, and generates bundle chunks for the application. Optimizers responsibilities are:
Optimizer
Extract constant to module scope
qHook
The developer writes: header.ts:
header.ts
export const Header = qComponent<{ todos: Todos }, { text: string }>({ onMount: qHook(() => ({ text: '' })), onRender: qHook((_, { text }) => ( <a on:click={qHook<typeof Footer, { filter: FilterStates }>((props, _, { filter }) => updateFilter(props.todos, filter) ).with({ filter })} /> )), });
Optimizer refactors it to something like so:
export const Header_onMount = qHook(() => ({ text: '' })); export const Header_onRender = qHook((_, { text }) => ( <a on:click={qHook('chunk-pqr#Header_onRender_onClick').with({ filter })}/> )) export const Header_onRender_onClick = qHook<typeof Footer, { filter: FilterStates }>( (props, _, { filter }) => updateFilter(props.todos, filter)); export const Header = qComponent<{ todos: Todos }, { text: string }>({ onMount: qHook('chunk-abc#Header_onMount'), onRender: qHook('chunk-xyz#Header_onRender'), });
chunk-abc:
chunk-abc
export {Header_onMount} from './header';
chunk-pqr:
chunk-pqr
export {Header_onRender_onClick} from './header';
chunk-xyz:
chunk-xyz
export {Header_onRender} from './header';
https://hackmd.io/lGHH9hjrSNq7yorN2EOBHA (old) https://hackmd.io/KLG7PrXlQTWO6ZkBPVRAmQ (new)
The text was updated successfully, but these errors were encountered:
manucorporat
No branches or pull requests
Goal
Optimizer
is a tool that consumes input source files, and generates bundle chunks for the application.Optimizer
s responsibilities are:Extract constant to module scope
on any call site ofqHook
function.Example
The developer writes:
header.ts
:Optimizer refactors it to something like so:
chunk-abc
:chunk-pqr
:chunk-xyz
:https://hackmd.io/lGHH9hjrSNq7yorN2EOBHA (old)
https://hackmd.io/KLG7PrXlQTWO6ZkBPVRAmQ (new)
The text was updated successfully, but these errors were encountered: