0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00
This commit is contained in:
Alex Sánchez 2024-04-08 11:49:43 +02:00
parent 308fa93625
commit 6dbee90040
No known key found for this signature in database
GPG key ID: 68A95170EEB87E16
5 changed files with 20 additions and 11 deletions

View file

@ -4,5 +4,6 @@
"api": "1.0.0",
"main": "dist/code.js",
"ui": "dist/ui.html",
"editorType": ["figma", "figjam"]
"editorType": ["figma", "figjam"],
"documentAccess": "dynamic-page"
}

8
package-lock.json generated
View file

@ -14,11 +14,13 @@
"slugify": "^1.6"
},
"devDependencies": {
"@figma/eslint-plugin-figma-plugins": "^0.15",
"@figma/plugin-typings": "^1.88",
"@figma/eslint-plugin-figma-plugins": "^0.15.0",
"@figma/plugin-typings": "^1.90.0",
"@trivago/prettier-plugin-sort-imports": "^4.3",
"@types/react": "^18.2",
"@types/react-dom": "^18.2",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"css-loader": "^6.10",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1",
@ -33,7 +35,7 @@
"stylelint": "^16.3",
"stylelint-config-standard": "^36.0",
"ts-loader": "^9.5",
"typescript": "^5.4",
"typescript": "^5.4.4",
"typescript-eslint": "^7.4",
"webpack": "^5.91",
"webpack-cli": "^5.1"

View file

@ -25,11 +25,13 @@
"slugify": "^1.6"
},
"devDependencies": {
"@figma/eslint-plugin-figma-plugins": "^0.15",
"@figma/plugin-typings": "^1.88",
"@figma/eslint-plugin-figma-plugins": "^0.15.0",
"@figma/plugin-typings": "^1.90.0",
"@trivago/prettier-plugin-sort-imports": "^4.3",
"@types/react": "^18.2",
"@types/react-dom": "^18.2",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"css-loader": "^6.10",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1",
@ -44,7 +46,7 @@
"stylelint": "^16.3",
"stylelint-config-standard": "^36.0",
"ts-loader": "^9.5",
"typescript": "^5.4",
"typescript": "^5.4.4",
"typescript-eslint": "^7.4",
"webpack": "^5.91",
"webpack-cli": "^5.1"

View file

@ -19,13 +19,17 @@ function detectMimeType(b64: string) {
}
}
function traverse(node: BaseNode): NodeData | TextData {
async function traverse(node: BaseNode): Promise<NodeData | TextData> {
const children: (NodeData | TextData)[] = [];
if (node.type === 'PAGE') {
await node.loadAsync();
}
if ('children' in node) {
if (node.type !== 'INSTANCE') {
for (const child of node.children) {
children.push(traverse(child));
children.push(await traverse(child));
}
}
}
@ -101,7 +105,7 @@ function traverse(node: BaseNode): NodeData | TextData {
figma.showUI(__html__, { themeColors: true, height: 200, width: 300 });
const root: NodeData | TextData = traverse(figma.root); // start the traversal at the root
const root: NodeData | TextData = await traverse(figma.root); // start the traversal at the root
figma.ui.postMessage({ type: 'FIGMAFILE', data: root });
figma.ui.onmessage = msg => {

View file

@ -5,7 +5,7 @@
"skipLibCheck": true,
"jsx": "react",
"lib": ["DOM", "ES6"],
"target": "ES6",
"target": "es2017",
"module": "ESNext",
"moduleResolution": "Node10",
"strict": true,