diff --git a/package-lock.json b/package-lock.json index acb1100..d7ce74c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@eriengine/plugin-spatial-audio": "^1.0.2", "@vue/composition-api": "^1.4.1", "add-filename-increment": "^1.0.0", - "adm-zip": "^0.5.9", "an-array-of-english-words": "2.0.0", "animejs": "^3.2.1", "ansi-to-html": "^0.6.14", @@ -36,6 +35,7 @@ "deepmerge": "^4.2.2", "del": "^6.0.0", "electron-updater": "^4.3.9", + "extract-zip": "^2.0.1", "fast-glob": "^3.2.4", "fs-extra": "^9.0.1", "get-folder-size": "^2.0.0", @@ -66,7 +66,6 @@ }, "devDependencies": { "@mdi/font": "^5.8.55", - "@types/adm-zip": "^0.4.34", "@types/animejs": "^3.1.2", "@types/archiver": "^5.1.1", "@types/cross-spawn": "^6.0.2", @@ -1706,15 +1705,6 @@ "node": ">=6" } }, - "node_modules/@types/adm-zip": { - "version": "0.4.34", - "resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.4.34.tgz", - "integrity": "sha512-8ToYLLAYhkRfcmmljrKi22gT2pqu7hGMDtORP1emwIEGmgUTZOsaDjzWFzW5N2frcFRz/50CWt4zA1CxJ73pmQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/animejs": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@types/animejs/-/animejs-3.1.2.tgz", @@ -1899,7 +1889,7 @@ "version": "14.14.20", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", - "dev": true + "devOptional": true }, "node_modules/@types/node-fetch": { "version": "2.5.8", @@ -2080,6 +2070,15 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, + "node_modules/@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.13.0.tgz", @@ -3976,14 +3975,6 @@ "node": ">= 0.12.0" } }, - "node_modules/adm-zip": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", - "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==", - "engines": { - "node": ">=6.0" - } - }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -8246,6 +8237,36 @@ "node": ">=10" } }, + "node_modules/electron/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/electron/node_modules/extract-zip": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", + "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", + "dev": true, + "dependencies": { + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + } + }, + "node_modules/electron/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "node_modules/elliptic": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", @@ -9311,35 +9332,24 @@ } }, "node_modules/extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dependencies": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", + "debug": "^4.1.1", + "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, "bin": { "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" } }, - "node_modules/extract-zip/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/extract-zip/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -9407,7 +9417,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, "dependencies": { "pend": "~1.2.0" } @@ -14121,8 +14130,7 @@ "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, "node_modules/performance-now": { "version": "2.1.0", @@ -20883,7 +20891,6 @@ "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" @@ -22554,15 +22561,6 @@ "defer-to-connect": "^1.0.1" } }, - "@types/adm-zip": { - "version": "0.4.34", - "resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.4.34.tgz", - "integrity": "sha512-8ToYLLAYhkRfcmmljrKi22gT2pqu7hGMDtORP1emwIEGmgUTZOsaDjzWFzW5N2frcFRz/50CWt4zA1CxJ73pmQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/animejs": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@types/animejs/-/animejs-3.1.2.tgz", @@ -22745,7 +22743,7 @@ "version": "14.14.20", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", - "dev": true + "devOptional": true }, "@types/node-fetch": { "version": "2.5.8", @@ -22922,6 +22920,15 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==", "dev": true }, + "@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "optional": true, + "requires": { + "@types/node": "*" + } + }, "@typescript-eslint/eslint-plugin": { "version": "4.13.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.13.0.tgz", @@ -24554,11 +24561,6 @@ "integrity": "sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA==", "dev": true }, - "adm-zip": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.9.tgz", - "integrity": "sha512-s+3fXLkeeLjZ2kLjCBwQufpI5fuN+kIGBxu6530nVQZGVol0d7Y/M88/xw9HGGUcJjKf8LutN3VPRUBq6N7Ajg==" - }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -27874,6 +27876,35 @@ "@electron/get": "^1.0.1", "@types/node": "^14.6.2", "extract-zip": "^1.0.3" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "extract-zip": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", + "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", + "dev": true, + "requires": { + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } } }, "electron-builder": { @@ -29008,32 +29039,14 @@ } }, "extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", - "dev": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", "yauzl": "^2.10.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "extsprintf": { @@ -29094,7 +29107,6 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "dev": true, "requires": { "pend": "~1.2.0" } @@ -32955,8 +32967,7 @@ "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", - "dev": true + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" }, "performance-now": { "version": "2.1.0", @@ -38648,7 +38659,6 @@ "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "dev": true, "requires": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" diff --git a/package.json b/package.json index 1c0f550..43f2562 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "@eriengine/plugin-spatial-audio": "^1.0.2", "@vue/composition-api": "^1.4.1", "add-filename-increment": "^1.0.0", - "adm-zip": "^0.5.9", "an-array-of-english-words": "2.0.0", "animejs": "^3.2.1", "ansi-to-html": "^0.6.14", @@ -38,6 +37,7 @@ "deepmerge": "^4.2.2", "del": "^6.0.0", "electron-updater": "^4.3.9", + "extract-zip": "^2.0.1", "fast-glob": "^3.2.4", "fs-extra": "^9.0.1", "get-folder-size": "^2.0.0", @@ -68,7 +68,6 @@ }, "devDependencies": { "@mdi/font": "^5.8.55", - "@types/adm-zip": "^0.4.34", "@types/animejs": "^3.1.2", "@types/archiver": "^5.1.1", "@types/cross-spawn": "^6.0.2", diff --git a/src/Main/IPC/FileSystem/unzip.ts b/src/Main/IPC/FileSystem/unzip.ts index e924f45..a9ebf33 100644 --- a/src/Main/IPC/FileSystem/unzip.ts +++ b/src/Main/IPC/FileSystem/unzip.ts @@ -1,32 +1,20 @@ import { ipcMain, IpcMainInvokeEvent } from 'electron' import fs from 'fs-extra' -import Zip from 'adm-zip' +import extract from 'extract-zip' -function unzip(src: string, dist: string, overwrite: boolean): Promise { +async function unzip(src: string, dist: string): Promise { return new Promise((resolve, reject) => { if (!fs.existsSync(src)) { const err = new Error(`The '${src}' file not exists.`) reject(err) } - // todo: adm-zip 패키지에 매개변수 3개를 사용할 경우, 비동기 사용에 오류가 있음. - // 버그가 수정되기 전까지 비동기 사용 금지 - // https://github.com/cthackers/adm-zip/issues/407 - // new Zip(src).extractAllToAsync(dist, overwrite, (err) => { - // if (err) reject(err) - // else resolve(dist) - // }) - try { - new Zip(src).extractAllTo(dist, overwrite) - resolve(src) - } catch (reason) { - reject(reason) - } + extract(src, { dir: dist }).then(() => resolve(dist)).catch(reject) }) } -export async function handler(src: string, dist: string, overwrite: boolean): Promise { +export async function handler(src: string, dist: string): Promise { try { - await unzip(src, dist, overwrite) + await unzip(src, dist) } catch (reason) { const { message } = reason as Error return { @@ -46,7 +34,7 @@ export async function handler(src: string, dist: string, overwrite: boolean): Pr } export function ipc(): void { - ipcMain.handle('unzip', async (e: IpcMainInvokeEvent, src: string, dist: string, overwrite: boolean = false): Promise => { - return await handler(src, dist, overwrite) + ipcMain.handle('unzip', async (e: IpcMainInvokeEvent, src: string, dist: string): Promise => { + return await handler(src, dist) }) } \ No newline at end of file diff --git a/src/Renderer/components/Manager/Data/Scene/Map/AssetLoader.vue b/src/Renderer/components/Manager/Data/Scene/Map/AssetLoader.vue index 0617aba..685d92f 100644 --- a/src/Renderer/components/Manager/Data/Scene/Map/AssetLoader.vue +++ b/src/Renderer/components/Manager/Data/Scene/Map/AssetLoader.vue @@ -125,8 +125,14 @@ export default class AssetLoaderComponent extends Vue { const imageModule = __non_webpack_require__(imageModulePath) const audioModule = __non_webpack_require__(audioModulePath) - const checkAssetExists = (rawModuledata: unknown) => { - const { key } = rawModuledata as PalettePaintAsset + const checkAssetExists = (rawModuleData: unknown) => { + const { key, asset } = rawModuleData as PalettePaintAsset + if ( + typeof key !== 'string' || + typeof asset !== 'string' + ) { + return false + } const filePath = path.resolve(this.$store.state.projectDirectory, key) return fs.existsSync(filePath) } diff --git a/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue b/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue index 2a65298..2dcd0db 100644 --- a/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue +++ b/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue @@ -75,7 +75,6 @@