0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2024-12-22 13:43:03 -05:00

Improve performance of image processing (#135)

* Improve performance of image processing

* refactor

* add changelog
This commit is contained in:
Jordi Sala Morales 2024-06-04 08:02:46 +02:00 committed by GitHub
parent fd14e544b8
commit 8a86304fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"penpot-exporter": patch
---
Improve image processing speed

24
package-lock.json generated
View file

@ -1,15 +1,16 @@
{
"name": "penpot-exporter",
"version": "0.3.1",
"version": "0.4.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "penpot-exporter",
"version": "0.3.1",
"version": "0.4.1",
"license": "MPL2.0",
"dependencies": {
"@create-figma-plugin/ui": "^3.2",
"base64-js": "^1.5",
"classnames": "^2.5",
"preact": "^10.21",
"react-hook-form": "^7.51",
@ -3240,6 +3241,25 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"node_modules/better-path-resolve": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/better-path-resolve/-/better-path-resolve-1.0.0.tgz",

View file

@ -23,6 +23,7 @@
"license": "MPL2.0",
"dependencies": {
"@create-figma-plugin/ui": "^3.2",
"base64-js": "^1.5",
"classnames": "^2.5",
"preact": "^10.21",
"react-hook-form": "^7.51",

View file

@ -1,3 +1,5 @@
import { fromByteArray } from 'base64-js';
import { imagesLibrary } from '@plugin/ImageLibrary';
import { detectMimeType } from '@plugin/utils';
@ -36,7 +38,7 @@ const generateAndRegister = async (imageHash: string) => {
const bytes = await image.getBytesAsync();
const { width, height } = await image.getSizeAsync();
const b64 = figma.base64Encode(bytes);
const b64 = fromByteArray(bytes);
const mtype = detectMimeType(b64);
const dataUri = `data:${mtype};base64,${b64}`;