-
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): use node-lookups for mapping generated components if used mult…
…iple times in html (#932) * (fix): use node-lookups for mapping generated components if used multiple times in html * fix bugs with re-using components with html components
- Loading branch information
1 parent
396edb4
commit c7b2148
Showing
11 changed files
with
114 additions
and
116 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
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: [], | ||
}, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}) | ||
], | ||
}, | ||
} | ||
} |
Oops, something went wrong.