Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/small-garlics-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/mitosis': patch
---

[React] Refactor: consolidate bindings processing into code processor plugin.
41 changes: 7 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
node_modules
dist
*.log
.vscode/**
!.vscode/extensions.json
!.vscode/settings.json
.idea
coverage
.DS_Store
*.tsbuildinfo
.cache
fiddle/build/
packages/core/mitosis-build
.history
.pnp.*
.eslintcache

# ignore everything in .yarn folder, except the .yarn/patches and the .yarn/versions subfolders
.yarn/*
!/.yarn/patches
!/.yarn/versions
!/.yarn/releases

# sveltekit tmp files
**/package/__package_types_tmp__/

**/test-results/
**/playwright-report/

packages/core/src/__tests__/__snapshots__/local.test.ts.snap

.nx/cache
.nx-cache
.nx/workspace-data
/nbproject/
/.idea/*
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,7 @@ function MyComponent(props) {
lineHeight: \\"normal\\",
width: \\"33%\\",
marginLeft: \\"0px\\",
\\"@media (max-width: 991px)\\": {
width: \\"100%\\",
marginLeft: 0,
},
\\"@media (max-width: 991px)\\": { width: \\"100%\\", marginLeft: 0 },
}}
>
<img
Expand Down Expand Up @@ -462,10 +459,7 @@ function MyComponent(props) {
lineHeight: \\"normal\\",
width: \\"33%\\",
marginLeft: \\"20px\\",
\\"@media (max-width: 991px)\\": {
width: \\"100%\\",
marginLeft: 0,
},
\\"@media (max-width: 991px)\\": { width: \\"100%\\", marginLeft: 0 },
}}
>
<img
Expand Down Expand Up @@ -570,10 +564,7 @@ function MyComponent(props) {
lineHeight: \\"normal\\",
width: \\"33%\\",
marginLeft: \\"20px\\",
\\"@media (max-width: 991px)\\": {
width: \\"100%\\",
marginLeft: 0,
},
\\"@media (max-width: 991px)\\": { width: \\"100%\\", marginLeft: 0 },
}}
>
<img
Expand Down
14 changes: 2 additions & 12 deletions packages/core/src/__tests__/__snapshots__/context.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -578,15 +578,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -625,15 +620,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down
42 changes: 10 additions & 32 deletions packages/core/src/__tests__/__snapshots__/mitosis.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15215,15 +15215,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand All @@ -15250,15 +15245,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -15457,7 +15447,7 @@ function RenderContent(props) {

return (
<RenderBlock
{...state.getRenderContentProps(props.renderContentProps.block, 0)}
{...getRenderContentProps(props.renderContentProps.block, 0)}
/>
);
}
Expand Down Expand Up @@ -15532,7 +15522,7 @@ function MyBasicComponent(props) {
hello: \\"world\\",
}));

return <input {...state.attrs} {...props} />;
return <input {...attrs} {...props} />;
}

export default MyBasicComponent;
Expand Down Expand Up @@ -16188,7 +16178,6 @@ function RenderContent(props) {
get content() {
return 3;
},

get registeredComponents() {
return 4;
},
Expand Down Expand Up @@ -18615,15 +18604,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand All @@ -18650,15 +18634,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -18858,7 +18837,7 @@ function RenderContent(props) {

return (
<RenderBlock
{...state.getRenderContentProps(props.renderContentProps.block, 0)}
{...getRenderContentProps(props.renderContentProps.block, 0)}
/>
);
}
Expand Down Expand Up @@ -18933,7 +18912,7 @@ function MyBasicComponent(props) {
hello: \\"world\\",
}));

return <input {...state.attrs} {...props} />;
return <input {...attrs} {...props} />;
}

export default MyBasicComponent;
Expand Down Expand Up @@ -19597,7 +19576,6 @@ function RenderContent(props) {
get content() {
return 3;
},

get registeredComponents() {
return 4;
},
Expand Down Expand Up @@ -20283,7 +20261,7 @@ exports[`Mitosis, format: react > svelte > Javascript Test > context 1`] = `
"'>' expected. (35:13)
33 | return (
34 |
> 35 | <'activeTab'.Provider value={activeTab}><div>{activeTab}</div></'activeTab'.Provider>
> 35 | <'activeTab'.Provider value={state.activeTab}><div>{activeTab}</div></'activeTab'.Provider>
| ^
36 |
37 |
Expand Down Expand Up @@ -20686,7 +20664,7 @@ exports[`Mitosis, format: react > svelte > Typescript Test > context 1`] = `
"'>' expected. (35:13)
33 | return (
34 |
> 35 | <'activeTab'.Provider value={activeTab}><div>{activeTab}</div></'activeTab'.Provider>
> 35 | <'activeTab'.Provider value={state.activeTab}><div>{activeTab}</div></'activeTab'.Provider>
| ^
36 |
37 |
Expand Down
42 changes: 10 additions & 32 deletions packages/core/src/__tests__/__snapshots__/preact.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1844,15 +1844,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand All @@ -1879,15 +1874,10 @@ function ComponentWithContext(props) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -2089,7 +2079,7 @@ function RenderContent(props) {

return (
<RenderBlock
{...state.getRenderContentProps(props.renderContentProps.block, 0)}
{...getRenderContentProps(props.renderContentProps.block, 0)}
/>
);
}
Expand Down Expand Up @@ -2164,7 +2154,7 @@ function MyBasicComponent(props) {
hello: \\"world\\",
}));

return <input {...state.attrs} {...props} />;
return <input {...attrs} {...props} />;
}

export default MyBasicComponent;
Expand Down Expand Up @@ -2831,7 +2821,6 @@ function RenderContent(props) {
get content() {
return 3;
},

get registeredComponents() {
return 4;
},
Expand Down Expand Up @@ -5596,15 +5585,10 @@ function ComponentWithContext(props: ComponentWithContextProps) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -5636,15 +5620,10 @@ function ComponentWithContext(props: ComponentWithContextProps) {
const foo = useContext(Context1);

return (
<Context2.Provider
value={{
bar: \\"baz\\",
}}
>
<Context2.Provider value={{ bar: \\"baz\\" }}>
<Context1.Provider
value={{
foo: \\"bar\\",

content() {
return props.content;
},
Expand Down Expand Up @@ -5879,7 +5858,7 @@ function RenderContent(props: RenderContentProps) {

return (
<RenderBlock
{...state.getRenderContentProps(props.renderContentProps.block, 0)}
{...getRenderContentProps(props.renderContentProps.block, 0)}
/>
);
}
Expand Down Expand Up @@ -5954,7 +5933,7 @@ function MyBasicComponent(props: any) {
hello: \\"world\\",
}));

return <input {...state.attrs} {...props} />;
return <input {...attrs} {...props} />;
}

export default MyBasicComponent;
Expand Down Expand Up @@ -6693,7 +6672,6 @@ function RenderContent(props: Props) {
get content() {
return 3;
},

get registeredComponents() {
return 4;
},
Expand Down Expand Up @@ -7511,7 +7489,7 @@ exports[`Preact > svelte > Javascript Test > context 1`] = `
"'>' expected. (36:13)
34 | return (
35 |
> 36 | <'activeTab'.Provider value={activeTab}><div>{activeTab}</div></'activeTab'.Provider>
> 36 | <'activeTab'.Provider value={state.activeTab}><div>{activeTab}</div></'activeTab'.Provider>
| ^
37 |
38 |
Expand Down Expand Up @@ -7915,7 +7893,7 @@ exports[`Preact > svelte > Typescript Test > context 1`] = `
"'>' expected. (36:13)
34 | return (
35 |
> 36 | <'activeTab'.Provider value={activeTab}><div>{activeTab}</div></'activeTab'.Provider>
> 36 | <'activeTab'.Provider value={state.activeTab}><div>{activeTab}</div></'activeTab'.Provider>
| ^
37 |
38 |
Expand Down
Loading