diff --git a/manifest.json b/manifest.json index 775addc..447dfee 100644 --- a/manifest.json +++ b/manifest.json @@ -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" } diff --git a/package-lock.json b/package-lock.json index a1ee559..471fdbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" diff --git a/package.json b/package.json index f70bc56..8740750 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/src/code.ts b/src/code.ts index b2a399d..4f1ebd8 100644 --- a/src/code.ts +++ b/src/code.ts @@ -19,13 +19,17 @@ function detectMimeType(b64: string) { } } -function traverse(node: BaseNode): NodeData | TextData { +async function traverse(node: BaseNode): Promise { 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 => { diff --git a/tsconfig.json b/tsconfig.json index 156ee9e..6d4426d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,7 @@ "skipLibCheck": true, "jsx": "react", "lib": ["DOM", "ES6"], - "target": "ES6", + "target": "es2017", "module": "ESNext", "moduleResolution": "Node10", "strict": true,