-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bugs with re-using components with html components
- Loading branch information
1 parent
f9a3a23
commit 5bf5d9e
Showing
5 changed files
with
56 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
import { ChunkDefinition, FileType, ChunkType } from '@teleporthq/teleport-types' | ||
import * as types from '@babel/types' | ||
|
||
export const createComponentChunk = (): ChunkDefinition => ({ | ||
name: 'jsx-component', | ||
meta: { | ||
nodesLookup: { | ||
container: { | ||
openingElement: { | ||
name: { | ||
name: '', | ||
}, | ||
attributes: [], | ||
}, | ||
export const createComponentChunk = (): ChunkDefinition => { | ||
const jsxElement: types.JSXElement = { | ||
type: 'JSXElement', | ||
openingElement: { | ||
type: 'JSXOpeningElement', | ||
name: { | ||
type: 'JSXIdentifier', | ||
name: '', | ||
}, | ||
selfClosing: false, | ||
attributes: [], | ||
}, | ||
dynamicRefPrefix: { | ||
prop: 'props', | ||
children: [], | ||
} | ||
|
||
return { | ||
name: 'jsx-component', | ||
meta: { | ||
nodesLookup: { | ||
container: jsxElement as unknown as Record<string, unknown>, | ||
}, | ||
dynamicRefPrefix: { | ||
prop: 'props', | ||
}, | ||
}, | ||
}, | ||
type: ChunkType.AST, | ||
fileType: FileType.JS, | ||
linkAfter: ['import-local'], | ||
content: { | ||
declarations: [ | ||
{ | ||
init: { | ||
params: [], | ||
body: { | ||
body: [], | ||
type: ChunkType.AST, | ||
fileType: FileType.JS, | ||
linkAfter: ['import-local'], | ||
content: { | ||
declarations: [ | ||
{ | ||
init: { | ||
params: [], | ||
body: { | ||
body: [], | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}) | ||
], | ||
}, | ||
} | ||
} |