Skip to content

Commit

Permalink
Fix/builder id meta (#1411)
Browse files Browse the repository at this point in the history
* f

* f
  • Loading branch information
samijaber committed Apr 25, 2024
1 parent 8083203 commit 1dbdf32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/great-taxis-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/mitosis': patch
---

add `includeMeta` option to Builder generator
9 changes: 8 additions & 1 deletion packages/core/src/parsers/builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,14 +485,15 @@ type BuilderToMitosisOptions = {
includeBuilderExtras?: boolean;
preserveTextBlocks?: boolean;
includeSpecialBindings?: boolean;
includeMeta?: boolean;
};

export const builderElementToMitosisNode = (
block: BuilderElement,
options: BuilderToMitosisOptions,
_internalOptions: InternalOptions = {},
): MitosisNode => {
const { includeSpecialBindings = true } = options;
const { includeSpecialBindings = true, includeMeta = false } = options;

if (block.component?.name === 'Core:Fragment') {
block.component.name = 'Fragment';
Expand Down Expand Up @@ -694,6 +695,12 @@ export const builderElementToMitosisNode = (
slots: {
...slots,
},
meta: includeMeta
? {
'builder-id': block.id,
...block.meta,
}
: {},
});

// Has single text node child
Expand Down

0 comments on commit 1dbdf32

Please sign in to comment.