0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 21:53:27 -05:00
penpot-exporter-figma-plugin/ui-src/parser/parse.ts

25 lines
638 B
TypeScript
Raw Normal View History

import { componentsLibrary } from '@plugin/ComponentLibrary';
import { createFile } from '@ui/lib/penpot';
import { createComponentLibrary, createPage } from '@ui/parser/creators';
import { uiComponents } from '@ui/parser/libraries/UiComponents';
import { PenpotDocument } from '@ui/types';
import { idLibrary } from '.';
export const parse = ({ name, children = [], components }: PenpotDocument) => {
componentsLibrary.init(components);
uiComponents.init();
idLibrary.init();
const file = createFile(name);
for (const page of children) {
createPage(file, page);
}
createComponentLibrary(file);
return file;
};