diff --git a/package-lock.json b/package-lock.json index 445b53b..24c51ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,9 +15,7 @@ "@rollup/plugin-typescript": "^11.0.0", "@types/fs-extra": "^11.0.1", "@types/jest": "^29.4.0", - "chokidar": "^3.5.3", "eslint": "^8.33.0", - "eventemitter3": "^5.0.1", "find-up": "^5.0.0", "fs-extra": "^11.1.0", "husky": "^8.0.3", @@ -4386,6 +4384,10 @@ "resolved": "packages/cache-buster", "link": true }, + "node_modules/@play-co/assetpack-plugin-compress": { + "resolved": "packages/compress", + "link": true + }, "node_modules/@play-co/assetpack-plugin-ffmpeg": { "resolved": "packages/ffmpeg", "link": true @@ -4398,8 +4400,8 @@ "resolved": "packages/manifest", "link": true }, - "node_modules/@play-co/assetpack-plugin-mipmap-compress": { - "resolved": "packages/mipmap-compress", + "node_modules/@play-co/assetpack-plugin-mipmap": { + "resolved": "packages/mipmap", "link": true }, "node_modules/@play-co/assetpack-plugin-texture-packer": { @@ -4591,6 +4593,15 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/cli-progress": { + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.5.tgz", + "integrity": "sha512-D4PbNRbviKyppS5ivBGyFO29POlySLmA2HyUFE4p5QGazAMM3CwkKWcvTl8gvElSuxRh6FPKL8XmidX873ou4g==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/clone": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@types/clone/-/clone-2.1.1.tgz", @@ -5502,6 +5513,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -5968,6 +5980,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, "dependencies": { "restore-cursor": "^3.1.0" }, @@ -5990,6 +6003,7 @@ "version": "2.6.1", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "dev": true, "engines": { "node": ">=6" }, @@ -6693,6 +6707,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, "dependencies": { "clone": "^1.0.2" }, @@ -6704,6 +6719,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true, "engines": { "node": ">=0.8" } @@ -7305,12 +7321,6 @@ "node": ">=0.10.0" } }, - "node_modules/eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -8780,6 +8790,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true, "engines": { "node": ">=8" } @@ -8994,6 +9005,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, "engines": { "node": ">=10" }, @@ -10449,6 +10461,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -10900,6 +10913,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, "engines": { "node": ">=6" } @@ -11929,6 +11943,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "dependencies": { "mimic-fn": "^2.1.0" }, @@ -11989,6 +12004,7 @@ "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", @@ -13270,6 +13286,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -13496,6 +13513,45 @@ "node": ">=8" } }, + "node_modules/sharp": { + "version": "0.33.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", + "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", + "hasInstallScript": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.0" + }, + "engines": { + "libvips": ">=8.15.2", + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.3", + "@img/sharp-darwin-x64": "0.33.3", + "@img/sharp-libvips-darwin-arm64": "1.0.2", + "@img/sharp-libvips-darwin-x64": "1.0.2", + "@img/sharp-libvips-linux-arm": "1.0.2", + "@img/sharp-libvips-linux-arm64": "1.0.2", + "@img/sharp-libvips-linux-s390x": "1.0.2", + "@img/sharp-libvips-linux-x64": "1.0.2", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", + "@img/sharp-libvips-linuxmusl-x64": "1.0.2", + "@img/sharp-linux-arm": "0.33.3", + "@img/sharp-linux-arm64": "0.33.3", + "@img/sharp-linux-s390x": "0.33.3", + "@img/sharp-linux-x64": "0.33.3", + "@img/sharp-linuxmusl-arm64": "0.33.3", + "@img/sharp-linuxmusl-x64": "0.33.3", + "@img/sharp-wasm32": "0.33.3", + "@img/sharp-win32-ia32": "0.33.3", + "@img/sharp-win32-x64": "0.33.3" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -14633,6 +14689,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, "dependencies": { "defaults": "^1.0.3" } @@ -15121,22 +15178,21 @@ } }, "packages/compress": { - "name": "@assetpack/plugin-compress", - "version": "0.7.0", - "extraneous": true, + "name": "@play-co/assetpack-plugin-compress", + "version": "1.1.3", "license": "MIT", "dependencies": { "fs-extra": "^11.1.0", - "sharp": "^0.32.0" + "sharp": "^0.33.3" }, "devDependencies": { - "@assetpack/core": "0.7.0" + "@play-co/assetpack-core": "1.1.3" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@assetpack/core": ">=0.0.0" + "@play-co/assetpack-core": ">=0.0.0" } }, "packages/core": { @@ -15148,12 +15204,12 @@ "@pixi/runner": "^7.0.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", + "cli-progress": "^3.12.0", "clone": "^2.1.2", "fs-extra": "^11.1.0", "merge": "^2.1.1", "minimatch": "5.1.1", "object-hash": "3.0.0", - "ora": "^5.4.1", "readline": "^1.3.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.0", @@ -15161,6 +15217,7 @@ "upath": "^2.0.0" }, "devDependencies": { + "@types/cli-progress": "3.11.5", "@types/clone": "^2.1.1", "@types/object-hash": "^3.0.0" }, @@ -15241,27 +15298,27 @@ } }, "packages/mipmap": { - "name": "@assetpack/plugin-mipmap", - "version": "0.7.0", - "extraneous": true, + "name": "@play-co/assetpack-plugin-mipmap", + "version": "1.1.3", "license": "MIT", "dependencies": { "fs-extra": "^11.1.0", - "sharp": "^0.32.0" + "sharp": "^0.33.3" }, "devDependencies": { - "@assetpack/core": "0.7.0" + "@play-co/assetpack-core": "1.1.3" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@assetpack/core": ">=0.0.0" + "@play-co/assetpack-core": ">=0.0.0" } }, "packages/mipmap-compress": { "name": "@play-co/assetpack-plugin-mipmap-compress", "version": "1.1.3", + "extraneous": true, "license": "MIT", "dependencies": { "fs-extra": "^11.1.0", @@ -15277,45 +15334,6 @@ "@play-co/assetpack-core": ">=0.0.0" } }, - "packages/mipmap-compress/node_modules/sharp": { - "version": "0.33.3", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", - "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", - "hasInstallScript": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.0" - }, - "engines": { - "libvips": ">=8.15.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.3", - "@img/sharp-darwin-x64": "0.33.3", - "@img/sharp-libvips-darwin-arm64": "1.0.2", - "@img/sharp-libvips-darwin-x64": "1.0.2", - "@img/sharp-libvips-linux-arm": "1.0.2", - "@img/sharp-libvips-linux-arm64": "1.0.2", - "@img/sharp-libvips-linux-s390x": "1.0.2", - "@img/sharp-libvips-linux-x64": "1.0.2", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", - "@img/sharp-libvips-linuxmusl-x64": "1.0.2", - "@img/sharp-linux-arm": "0.33.3", - "@img/sharp-linux-arm64": "0.33.3", - "@img/sharp-linux-s390x": "0.33.3", - "@img/sharp-linux-x64": "0.33.3", - "@img/sharp-linuxmusl-arm64": "0.33.3", - "@img/sharp-linuxmusl-x64": "0.33.3", - "@img/sharp-wasm32": "0.33.3", - "@img/sharp-win32-ia32": "0.33.3", - "@img/sharp-win32-x64": "0.33.3" - } - }, "packages/texture-packer": { "name": "@play-co/assetpack-plugin-texture-packer", "version": "1.1.3", @@ -15395,45 +15413,6 @@ "glob": "^8.0.3" } }, - "packages/texture-packer/node_modules/sharp": { - "version": "0.33.3", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", - "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", - "hasInstallScript": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.0" - }, - "engines": { - "libvips": ">=8.15.2", - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.3", - "@img/sharp-darwin-x64": "0.33.3", - "@img/sharp-libvips-darwin-arm64": "1.0.2", - "@img/sharp-libvips-darwin-x64": "1.0.2", - "@img/sharp-libvips-linux-arm": "1.0.2", - "@img/sharp-libvips-linux-arm64": "1.0.2", - "@img/sharp-libvips-linux-s390x": "1.0.2", - "@img/sharp-libvips-linux-x64": "1.0.2", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", - "@img/sharp-libvips-linuxmusl-x64": "1.0.2", - "@img/sharp-linux-arm": "0.33.3", - "@img/sharp-linux-arm64": "0.33.3", - "@img/sharp-linux-s390x": "0.33.3", - "@img/sharp-linux-x64": "0.33.3", - "@img/sharp-linuxmusl-arm64": "0.33.3", - "@img/sharp-linuxmusl-x64": "0.33.3", - "@img/sharp-wasm32": "0.33.3", - "@img/sharp-win32-ia32": "0.33.3", - "@img/sharp-win32-x64": "0.33.3" - } - }, "packages/webfont": { "name": "@play-co/assetpack-plugin-webfont", "version": "1.1.3", @@ -18659,16 +18638,17 @@ "requires": { "@node-rs/crc32": "^1.10.0", "@pixi/runner": "^7.0.0", + "@types/cli-progress": "3.11.5", "@types/clone": "^2.1.1", "@types/object-hash": "^3.0.0", "chalk": "^4.1.2", "chokidar": "^3.5.2", + "cli-progress": "^3.12.0", "clone": "^2.1.2", "fs-extra": "^11.1.0", "merge": "^2.1.1", "minimatch": "5.1.1", "object-hash": "3.0.0", - "ora": "^5.4.1", "readline": "^1.3.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.0", @@ -18695,6 +18675,14 @@ "fs-extra": "^11.1.0" } }, + "@play-co/assetpack-plugin-compress": { + "version": "file:packages/compress", + "requires": { + "@play-co/assetpack-core": "1.1.3", + "fs-extra": "^11.1.0", + "sharp": "^0.33.3" + } + }, "@play-co/assetpack-plugin-ffmpeg": { "version": "file:packages/ffmpeg", "requires": { @@ -18721,43 +18709,12 @@ "upath": "^2.0.1" } }, - "@play-co/assetpack-plugin-mipmap-compress": { - "version": "file:packages/mipmap-compress", + "@play-co/assetpack-plugin-mipmap": { + "version": "file:packages/mipmap", "requires": { "@play-co/assetpack-core": "1.1.3", "fs-extra": "^11.1.0", "sharp": "^0.33.3" - }, - "dependencies": { - "sharp": { - "version": "0.33.3", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", - "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", - "requires": { - "@img/sharp-darwin-arm64": "0.33.3", - "@img/sharp-darwin-x64": "0.33.3", - "@img/sharp-libvips-darwin-arm64": "1.0.2", - "@img/sharp-libvips-darwin-x64": "1.0.2", - "@img/sharp-libvips-linux-arm": "1.0.2", - "@img/sharp-libvips-linux-arm64": "1.0.2", - "@img/sharp-libvips-linux-s390x": "1.0.2", - "@img/sharp-libvips-linux-x64": "1.0.2", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", - "@img/sharp-libvips-linuxmusl-x64": "1.0.2", - "@img/sharp-linux-arm": "0.33.3", - "@img/sharp-linux-arm64": "0.33.3", - "@img/sharp-linux-s390x": "0.33.3", - "@img/sharp-linux-x64": "0.33.3", - "@img/sharp-linuxmusl-arm64": "0.33.3", - "@img/sharp-linuxmusl-x64": "0.33.3", - "@img/sharp-wasm32": "0.33.3", - "@img/sharp-win32-ia32": "0.33.3", - "@img/sharp-win32-x64": "0.33.3", - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.0" - } - } } }, "@play-co/assetpack-plugin-texture-packer": { @@ -18790,35 +18747,6 @@ "requires": { "@types/glob": "^8.0.0" } - }, - "sharp": { - "version": "0.33.3", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", - "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", - "requires": { - "@img/sharp-darwin-arm64": "0.33.3", - "@img/sharp-darwin-x64": "0.33.3", - "@img/sharp-libvips-darwin-arm64": "1.0.2", - "@img/sharp-libvips-darwin-x64": "1.0.2", - "@img/sharp-libvips-linux-arm": "1.0.2", - "@img/sharp-libvips-linux-arm64": "1.0.2", - "@img/sharp-libvips-linux-s390x": "1.0.2", - "@img/sharp-libvips-linux-x64": "1.0.2", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", - "@img/sharp-libvips-linuxmusl-x64": "1.0.2", - "@img/sharp-linux-arm": "0.33.3", - "@img/sharp-linux-arm64": "0.33.3", - "@img/sharp-linux-s390x": "0.33.3", - "@img/sharp-linux-x64": "0.33.3", - "@img/sharp-linuxmusl-arm64": "0.33.3", - "@img/sharp-linuxmusl-x64": "0.33.3", - "@img/sharp-wasm32": "0.33.3", - "@img/sharp-win32-ia32": "0.33.3", - "@img/sharp-win32-x64": "0.33.3", - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.0" - } } } }, @@ -18980,6 +18908,15 @@ "@babel/types": "^7.3.0" } }, + "@types/cli-progress": { + "version": "3.11.5", + "resolved": "https://registry.npmjs.org/@types/cli-progress/-/cli-progress-3.11.5.tgz", + "integrity": "sha512-D4PbNRbviKyppS5ivBGyFO29POlySLmA2HyUFE4p5QGazAMM3CwkKWcvTl8gvElSuxRh6FPKL8XmidX873ou4g==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/clone": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@types/clone/-/clone-2.1.1.tgz", @@ -19676,6 +19613,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -19994,6 +19932,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, "requires": { "restore-cursor": "^3.1.0" } @@ -20009,7 +19948,8 @@ "cli-spinners": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.1.tgz", - "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==" + "integrity": "sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==", + "dev": true }, "cli-truncate": { "version": "3.1.0", @@ -20562,6 +20502,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dev": true, "requires": { "clone": "^1.0.2" }, @@ -20569,7 +20510,8 @@ "clone": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==" + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "dev": true } } }, @@ -21028,12 +20970,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "eventemitter3": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", - "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", - "dev": true - }, "execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -22134,7 +22070,8 @@ "is-interactive": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==" + "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", + "dev": true }, "is-invalid-path": { "version": "1.0.2", @@ -22273,7 +22210,8 @@ "is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==" + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true }, "is-weakmap": { "version": "2.0.1", @@ -23376,6 +23314,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, "requires": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -23723,7 +23662,8 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true }, "min-document": { "version": "2.19.0", @@ -24535,6 +24475,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, "requires": { "mimic-fn": "^2.1.0" } @@ -24577,6 +24518,7 @@ "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", + "dev": true, "requires": { "bl": "^4.1.0", "chalk": "^4.1.0", @@ -25531,6 +25473,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, "requires": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -25677,6 +25620,35 @@ "kind-of": "^6.0.2" } }, + "sharp": { + "version": "0.33.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.3.tgz", + "integrity": "sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A==", + "requires": { + "@img/sharp-darwin-arm64": "0.33.3", + "@img/sharp-darwin-x64": "0.33.3", + "@img/sharp-libvips-darwin-arm64": "1.0.2", + "@img/sharp-libvips-darwin-x64": "1.0.2", + "@img/sharp-libvips-linux-arm": "1.0.2", + "@img/sharp-libvips-linux-arm64": "1.0.2", + "@img/sharp-libvips-linux-s390x": "1.0.2", + "@img/sharp-libvips-linux-x64": "1.0.2", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.2", + "@img/sharp-libvips-linuxmusl-x64": "1.0.2", + "@img/sharp-linux-arm": "0.33.3", + "@img/sharp-linux-arm64": "0.33.3", + "@img/sharp-linux-s390x": "0.33.3", + "@img/sharp-linux-x64": "0.33.3", + "@img/sharp-linuxmusl-arm64": "0.33.3", + "@img/sharp-linuxmusl-x64": "0.33.3", + "@img/sharp-wasm32": "0.33.3", + "@img/sharp-win32-ia32": "0.33.3", + "@img/sharp-win32-x64": "0.33.3", + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.0" + } + }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -26532,6 +26504,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dev": true, "requires": { "defaults": "^1.0.3" } diff --git a/package.json b/package.json index 1e8632a..cadad5f 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,7 @@ "@rollup/plugin-typescript": "^11.0.0", "@types/fs-extra": "^11.0.1", "@types/jest": "^29.4.0", - "chokidar": "^3.5.3", "eslint": "^8.33.0", - "eventemitter3": "^5.0.1", "find-up": "^5.0.0", "fs-extra": "^11.1.0", "husky": "^8.0.3", diff --git a/packages/compress/README.md b/packages/compress/README.md new file mode 100644 index 0000000..1a19c90 --- /dev/null +++ b/packages/compress/README.md @@ -0,0 +1,34 @@ +# @assetpack/plugin-compress + +AssetPack plugin for compressing images into different formats. + +## Installation + +```sh +npm install --save-dev @assetpack/plugin-compress +``` + +## Basic Usage + +```js +import { compress } from "@assetpack/plugin-compress"; + +export default { + ... + plugins: { + ... + compress: compress(), + }, +}; +``` + +## Options + +### compressJpg + +- `tags` - An object containing the tags to use for the plugin. Defaults to `{ nc: "nc" }`. + - `nc` - The tag used to denote that the image should not be compressed. Can be placed on a folder or file. +- jpg: Any settings supported by [sharp](https://sharp.pixelplumbing.com/api-output#jpeg) +- png: Any settings supported by [sharp](https://sharp.pixelplumbing.com/api-output#png) +- webp: Any settings supported by [sharp](https://sharp.pixelplumbing.com/api-output#webp) +- avif: Any settings supported by [sharp](https://sharp.pixelplumbing.com/api-output#avif) diff --git a/packages/mipmap-compress/jest.config.js b/packages/compress/jest.config.js similarity index 100% rename from packages/mipmap-compress/jest.config.js rename to packages/compress/jest.config.js diff --git a/packages/mipmap-compress/package.json b/packages/compress/package.json similarity index 88% rename from packages/mipmap-compress/package.json rename to packages/compress/package.json index 323bb58..c362307 100644 --- a/packages/mipmap-compress/package.json +++ b/packages/compress/package.json @@ -1,12 +1,12 @@ { - "name": "@play-co/assetpack-plugin-mipmap-compress", + "name": "@play-co/assetpack-plugin-compress", "version": "1.1.3", "description": "", - "homepage": "https://github.com/pixijs/assetpack/tree/master/packages/mipmap-compress/#readme", + "homepage": "https://github.com/pixijs/assetpack/tree/master/packages/compress/#readme", "bugs": "https://github.com/pixijs/assetpack/issues", "repository": { "url": "pixijs/assetpack", - "directory": "packages/mipmap-compress" + "directory": "packages/compress" }, "license": "MIT", "author": "Zyie", diff --git a/packages/mipmap-compress/rollup.config.mjs b/packages/compress/rollup.config.mjs similarity index 100% rename from packages/mipmap-compress/rollup.config.mjs rename to packages/compress/rollup.config.mjs diff --git a/packages/compress/src/compress.ts b/packages/compress/src/compress.ts new file mode 100644 index 0000000..0c79964 --- /dev/null +++ b/packages/compress/src/compress.ts @@ -0,0 +1,119 @@ +import type { PluginOptions, Asset, AssetPipe } from '@play-co/assetpack-core'; +import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; +import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'; +import sharp from 'sharp'; +import { resolveOptions } from './utils/resolveOptions'; +import { compressSharp } from './utils/compressSharp'; + +type CompressJpgOptions = Omit; +type CompressWebpOptions = Omit; +type CompressAvifOptions = Omit; +type CompressPngOptions = Omit; + +export interface CompressOptions extends PluginOptions<'nc'> +{ + png?: CompressPngOptions | boolean; + webp?: CompressWebpOptions | boolean; + avif?: CompressAvifOptions | boolean; + jpg?: CompressJpgOptions | boolean; +} + +export interface MipmapCompressImageData +{ + format: '.avif' | '.png' | '.webp' | '.jpg' | '.jpeg'; + resolution: number; + sharpImage: sharp.Sharp; +} + +export function compress(options: CompressOptions = {}): AssetPipe +{ + const compress = resolveOptions(options, { + png: true, + jpg: true, + webp: false, + avif: false, + }); + + if (compress) + { + compress.jpg = resolveOptions(compress.jpg, { + + }); + compress.png = resolveOptions(compress.png, { + quality: 90, + }); + compress.webp = resolveOptions(compress.webp, { + quality: 80, + }); + compress.avif = resolveOptions(compress.avif, { + + }); + } + + const defaultOptions = { + ...compress, + tags: { + nc: 'nc', + ...options.tags, + } + }; + + return { + folder: true, + name: 'compress', + defaultOptions, + test(asset: Asset, options) + { + return options && checkExt(asset.path, '.png', '.jpg', '.jpeg') && !asset.allMetaData[options.tags.nc as any]; + }, + async transform(asset: Asset, options) + { + const shouldCompress = compress && !asset.metaData[options.tags.nc as any]; + + if (!shouldCompress) + { + return []; + } + + try + { + const image: MipmapCompressImageData = { + format: asset.extension as MipmapCompressImageData['format'], + resolution: 1, + sharpImage: sharp(asset.buffer), + }; + + const processedImages = await compressSharp(image, options); + + const newAssets = processedImages.map((data) => + { + const end = `${data.format}`; + const filename = asset.filename + .replace(/\.[^/.]+$/, end); + + const newAsset = createNewAssetAt( + asset, + filename + ); + + return newAsset; + }); + + const promises = processedImages.map((image, i) => image.sharpImage.toBuffer().then((buffer) => + { + newAssets[i].buffer = buffer; + })); + + await Promise.all(promises); + + return newAssets; + } + catch (error) + { + throw new Error(`[AssetPack] Failed to compress image: ${asset.path} - ${error}`); + } + }, + + }; +} + diff --git a/packages/compress/src/index.ts b/packages/compress/src/index.ts new file mode 100644 index 0000000..8ceff92 --- /dev/null +++ b/packages/compress/src/index.ts @@ -0,0 +1 @@ +export * from './compress'; diff --git a/packages/mipmap-compress/src/utils/compressSharp.ts b/packages/compress/src/utils/compressSharp.ts similarity index 98% rename from packages/mipmap-compress/src/utils/compressSharp.ts rename to packages/compress/src/utils/compressSharp.ts index 96698c6..5fafd51 100644 --- a/packages/mipmap-compress/src/utils/compressSharp.ts +++ b/packages/compress/src/utils/compressSharp.ts @@ -1,5 +1,5 @@ import type { AvifOptions, WebpOptions, JpegOptions, PngOptions } from 'sharp'; -import type { MipmapCompressImageData, CompressOptions } from '../mipmapCompress'; +import type { MipmapCompressImageData, CompressOptions } from '../compress'; import sharp from 'sharp'; export async function compressSharp( diff --git a/packages/mipmap-compress/src/utils/resolveOptions.ts b/packages/compress/src/utils/resolveOptions.ts similarity index 100% rename from packages/mipmap-compress/src/utils/resolveOptions.ts rename to packages/compress/src/utils/resolveOptions.ts diff --git a/packages/mipmap-compress/test/Compress.test.ts b/packages/compress/test/Compress.test.ts similarity index 83% rename from packages/mipmap-compress/test/Compress.test.ts rename to packages/compress/test/Compress.test.ts index 1031772..296302f 100644 --- a/packages/mipmap-compress/test/Compress.test.ts +++ b/packages/compress/test/Compress.test.ts @@ -1,9 +1,9 @@ import { AssetPack } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; -import { mipmapCompress } from '../src/mipmapCompress'; +import { compress } from '../src/compress'; -const pkg = 'mipmap-compress'; +const pkg = 'compress'; describe('Compress', () => { @@ -35,14 +35,11 @@ describe('Compress', () => output: outputDir, cache: false, pipes: [ - mipmapCompress({ - mipmap: false, - compress: { - png: true, - webp: true, - avif: true, - jpg: true, - }, + compress({ + png: true, + webp: true, + avif: true, + jpg: true, }), ] }); @@ -58,7 +55,7 @@ describe('Compress', () => expect(existsSync(`${outputDir}/testJpg.png`)).toBe(false); }); - it('should compress png with 1 plugin', async () => + it.only('should compress png with 1 plugin', async () => { const testName = 'compress-png-1-plugin'; const inputDir = getInputDir(pkg, testName); @@ -85,14 +82,11 @@ describe('Compress', () => output: outputDir, cache: false, pipes: [ - mipmapCompress({ - mipmap: false, - compress: { - png: true, - webp: true, - jpg: true, - avif: true, - }, + compress({ + png: true, + webp: true, + jpg: true, + avif: true, }), ] }); @@ -135,11 +129,9 @@ describe('Compress', () => output: outputDir, cache: false, pipes: [ - mipmapCompress({ - compress: { - webp: false, - avif: false, - } + compress({ + webp: false, + avif: false, }) ] }); diff --git a/packages/mipmap-compress/test/resources/jpg-1.jpg b/packages/compress/test/resources/jpg-1.jpg similarity index 100% rename from packages/mipmap-compress/test/resources/jpg-1.jpg rename to packages/compress/test/resources/jpg-1.jpg diff --git a/packages/mipmap-compress/test/resources/png-1.png b/packages/compress/test/resources/png-1.png similarity index 100% rename from packages/mipmap-compress/test/resources/png-1.png rename to packages/compress/test/resources/png-1.png diff --git a/packages/mipmap-compress/test/resources/png-2.png b/packages/compress/test/resources/png-2.png similarity index 100% rename from packages/mipmap-compress/test/resources/png-2.png rename to packages/compress/test/resources/png-2.png diff --git a/packages/mipmap-compress/test/resources/sp-1.png b/packages/compress/test/resources/sp-1.png similarity index 100% rename from packages/mipmap-compress/test/resources/sp-1.png rename to packages/compress/test/resources/sp-1.png diff --git a/packages/mipmap-compress/test/resources/sp-2.png b/packages/compress/test/resources/sp-2.png similarity index 100% rename from packages/mipmap-compress/test/resources/sp-2.png rename to packages/compress/test/resources/sp-2.png diff --git a/packages/mipmap-compress/test/resources/sp-3.jpg b/packages/compress/test/resources/sp-3.jpg similarity index 100% rename from packages/mipmap-compress/test/resources/sp-3.jpg rename to packages/compress/test/resources/sp-3.jpg diff --git a/packages/compress/tsconfig.json b/packages/compress/tsconfig.json new file mode 100644 index 0000000..10fc255 --- /dev/null +++ b/packages/compress/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*", "types/**/*", "test/**/*"], +} diff --git a/packages/core/package.json b/packages/core/package.json index 997b2b6..f39de82 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -38,7 +38,7 @@ "merge": "^2.1.1", "minimatch": "5.1.1", "object-hash": "3.0.0", - "ora": "^5.4.1", + "cli-progress": "^3.12.0", "readline": "^1.3.0", "string-width": "^4.2.3", "strip-ansi": "^6.0.0", @@ -47,7 +47,8 @@ }, "devDependencies": { "@types/clone": "^2.1.1", - "@types/object-hash": "^3.0.0" + "@types/object-hash": "^3.0.0", + "@types/cli-progress": "3.11.5" }, "engines": { "node": ">=16.0.0" diff --git a/packages/core/src/AssetPack.ts b/packages/core/src/AssetPack.ts index 9cc5a90..f5ff946 100644 --- a/packages/core/src/AssetPack.ts +++ b/packages/core/src/AssetPack.ts @@ -11,17 +11,17 @@ import objectHash from 'object-hash'; import { Logger } from './logger/Logger'; import { promiseAllConcurrent } from './utils/promiseAllConcurrent'; import { path } from './utils/path'; +import merge from 'merge'; export class AssetPack { - public static defaultConfig: AssetPackConfig = { + private _defaultConfig: AssetPackConfig = { entry: './static', output: './dist', ignore: [], cache: true, logLevel: 'info', pipes: [], - // files: [] }; readonly config: AssetPackConfig; @@ -33,13 +33,12 @@ export class AssetPack constructor(config: AssetPackConfig = {}) { - config = { ...AssetPack.defaultConfig, ...config }; - this.config = config; - this._entryPath = normalizePath(config.entry as string); - this._outputPath = normalizePath(config.output as string); + this.config = merge.recursive(true, this._defaultConfig, config); + this._entryPath = normalizePath(this.config.entry as string); + this._outputPath = normalizePath(this.config.output as string); Logger.init({ - level: config.logLevel || 'info' + level: this.config.logLevel || 'info', }); const { pipes, cache, ...configWithoutPlugins } = config; @@ -98,8 +97,8 @@ export class AssetPack this._assetWatcher = new AssetWatcher({ entryPath: this._entryPath, assetCacheData, - ignore: config.ignore, - assetSettingsData: config.assetSettings as AssetSettings[] || [], + ignore: this.config.ignore, + assetSettingsData: this.config.assetSettings as AssetSettings[] || [], onUpdate: async (root: Asset) => { Logger.report({ @@ -128,11 +127,6 @@ export class AssetPack } } }); - - Logger.report({ - type: 'buildStart', - message: config.entry, - }); } /** @@ -180,6 +174,10 @@ export class AssetPack phase: 'transform', message: percent.toString() }); + + // wait for 2 seconds before starting the next asset + // this is to prevent the CPU from being overloaded + await new Promise((resolve) => setTimeout(resolve, 4000)); })); await promiseAllConcurrent(all, 5); diff --git a/packages/core/src/AssetWatcher.ts b/packages/core/src/AssetWatcher.ts index fa2468a..d99ba9b 100644 --- a/packages/core/src/AssetWatcher.ts +++ b/packages/core/src/AssetWatcher.ts @@ -7,6 +7,7 @@ import { AssetIgnore } from './AssetIgnore'; import type { AssetSettings } from './pipes/PipeSystem'; import { applySettingToAsset } from './utils/applySettingToAsset'; import { path } from './utils/path'; +import { Logger } from './logger/Logger'; export interface AssetWatcherOptions { @@ -26,11 +27,6 @@ interface ChangeData export class AssetWatcher { - static defaultOptions: Omit = { - entryPath: './src/assets', - ignore: [], - }; - private _watcher: chokidar.FSWatcher | undefined; private _assetHash: Record = {}; @@ -45,12 +41,10 @@ export class AssetWatcher private _ignore: AssetIgnore; private _assetSettingsData: AssetSettings[]; private _assetCacheData: Record | undefined | null; - private _inited = false; + private _initialised = false; constructor(options: AssetWatcherOptions) { - options = { ...AssetWatcher.defaultOptions, ...options }; - const entryPath = options.entryPath; this._onUpdate = options.onUpdate; @@ -58,7 +52,7 @@ export class AssetWatcher this._entryPath = entryPath; this._ignore = new AssetIgnore({ - ignore: options.ignore as string[], + ignore: options.ignore as string[] ?? [], basePath: entryPath }); @@ -68,8 +62,13 @@ export class AssetWatcher private _init() { - if (this._inited) return; - this._inited = true; + if (this._initialised) return; + this._initialised = true; + + Logger.report({ + type: 'buildStart', + message: this._entryPath, + }); const asset = new Asset({ path: this._entryPath, @@ -93,14 +92,12 @@ export class AssetWatcher { this._init(); - // logAssetGraph(this._root); - return this._runUpdate(); } async watch() { - let firstRun = !this._inited; + let firstRun = !this._initialised; this._init(); diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 9ae5d2e..768b0f6 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -1,4 +1,4 @@ -import type { LogLevel } from './logger/logLevel'; +import type { LogLevelKeys } from './logger/logLevel'; import type { AssetPipe } from './pipes/AssetPipe'; import type { AssetSettings } from './pipes/PipeSystem'; @@ -17,7 +17,7 @@ export interface AssetPackConfig * If true cached tree will be used */ cache?: boolean; - logLevel?: LogLevel; + logLevel?: LogLevelKeys; pipes?: (AssetPipe | AssetPipe[])[]; assetSettings?: AssetSettings[]; } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index ca38f25..63a08e2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,20 +1,18 @@ // export * from './AssetPack'; -// export * from './Cache'; -// export * from './config'; +export * from './config'; export * from './logger/Logger'; // export * from './Plugin'; // export * from './Processor'; // export * from './utils'; +export * from './Asset'; export * from './AssetPack'; export * from './config'; -export * from './pipes/PipeSystem'; export * from './pipes/AssetPipe'; +export * from './pipes/PipeSystem'; export * from './pipes/multiPipe'; -export * from './Asset'; export * from './utils/checkExt'; export * from './utils/createNewAssetAt'; -export * from './utils/stripTags'; export * from './utils/merge'; export * from './utils/path'; +export * from './utils/stripTags'; export * from './utils/swapExt'; - diff --git a/packages/core/src/logger/Logger.ts b/packages/core/src/logger/Logger.ts index 6485f36..8fde31c 100644 --- a/packages/core/src/logger/Logger.ts +++ b/packages/core/src/logger/Logger.ts @@ -1,10 +1,10 @@ import type { ReporterEvent } from './Reporter'; import { Reporter } from './Reporter'; -import type { LogLevel } from './logLevel'; +import type { LogLevelKeys } from './logLevel'; export interface LoggerOptions { - level: LogLevel; + level: LogLevelKeys; } class LoggerClass diff --git a/packages/core/src/logger/Reporter.ts b/packages/core/src/logger/Reporter.ts index f0b6d57..ea3fad1 100644 --- a/packages/core/src/logger/Reporter.ts +++ b/packages/core/src/logger/Reporter.ts @@ -1,13 +1,13 @@ import chalk from 'chalk'; -import type { LogLevel } from './logLevel'; -import { LogLevelEnum } from './logLevel'; -import { persistMessage, resetWindow, setSpinnerStatus, updateSpinner } from './render'; +import type { LogLevelKeys } from './logLevel'; +import { LogLevel } from './logLevel'; +import { persistMessage, resetWindow, startProgress, stopProgress, updateProgress } from './render'; import { prettifyTime } from './utils'; export interface LogEvent { type: 'log'; - level: LogLevel; + level: LogLevelKeys; message: string; } @@ -20,96 +20,69 @@ export interface BuildEvent export type ReporterEvent = LogEvent | BuildEvent; -function getProgressBar(ratio: number) -{ - const size = 40; - const prog = []; - - for (let i = 0; i < size; i++) - { - if (ratio > (i / size)) - { - prog.push('█'); - } - else - { - prog.push('░'); - } - } - - return prog.join(''); -} export class Reporter { - public level: LogLevel = 'info'; + public level: LogLevelKeys = 'info'; private _buildTime = 0; // Exported only for test public report(event: ReporterEvent): void { - const logLevelFilter = LogLevelEnum[this.level || 'info']; + const logLevelFilter = LogLevel[this.level || 'info']; switch (event.type) { case 'buildStart': { - if (logLevelFilter < LogLevelEnum.info) + if (logLevelFilter < LogLevel.info) { break; } this._buildTime = Date.now(); - updateSpinner('Starting Plugins...'); // Clear any previous output resetWindow(); - - /// / persistMessage(`${chalk.blue.bold('›')} ${chalk.blue.bold(`Building: ${event.message}`)}`); - - setSpinnerStatus('success', `AssetPack Initialized`); + persistMessage(chalk.green.bold(`✔ AssetPack Initialized`)); persistMessage(`${chalk.blue.bold('›')} ${chalk.blue.bold(`Building: ${event.message}`)}`); + startProgress(); break; } case 'buildProgress': { - if (logLevelFilter < LogLevelEnum.info) + if (logLevelFilter < LogLevel.info) { break; } // render a bar.. - const progress = parseInt(event.message || '0', 10) / 100; + const progress = parseInt(event.message || '0', 10); - const progressBar = getProgressBar(progress); - - const message = `${progressBar} ${event.message}%`; - - updateSpinner(`${chalk.green(message)}`); + updateProgress(progress); break; } case 'buildSuccess': - if (logLevelFilter < LogLevelEnum.info) + if (logLevelFilter < LogLevel.info) { break; } - setSpinnerStatus('success', 'Build Complete'); + stopProgress(); resetWindow(); - persistMessage(chalk.green.bold(`✔ AssetPack Completed in ${prettifyTime(Date.now() - this._buildTime)}`)); break; case 'buildFailure': - if (logLevelFilter < LogLevelEnum.error) + if (logLevelFilter < LogLevel.error) { break; } + stopProgress(); resetWindow(); - - setSpinnerStatus('error', chalk.red.bold('Build failed.')); + persistMessage(chalk.green.bold(`✖ AssetPack Build Failed`)); break; case 'log': { - if (logLevelFilter < LogLevelEnum[event.level]) + if (logLevelFilter < LogLevel[event.level]) { break; } diff --git a/packages/core/src/logger/logLevel.ts b/packages/core/src/logger/logLevel.ts index adac450..136d472 100644 --- a/packages/core/src/logger/logLevel.ts +++ b/packages/core/src/logger/logLevel.ts @@ -1,4 +1,4 @@ -export enum LogLevelEnum +export enum LogLevel { none = 0, error = 1, @@ -7,4 +7,4 @@ export enum LogLevelEnum verbose = 4, } -export type LogLevel = keyof typeof LogLevelEnum; +export type LogLevelKeys = keyof typeof LogLevel; diff --git a/packages/core/src/logger/render.ts b/packages/core/src/logger/render.ts index 8983601..453d6c4 100644 --- a/packages/core/src/logger/render.ts +++ b/packages/core/src/logger/render.ts @@ -1,7 +1,6 @@ -// @flow import type { Writable } from 'stream'; +import cliProgress from 'cli-progress'; -import ora from 'ora'; import readline from 'readline'; import { countLines } from './utils'; import chalk from 'chalk'; @@ -14,28 +13,11 @@ let lineCount = 0; let errorLineCount = 0; let statusPersisted = false; -const spinner = ora({ - color: 'green', - stream: stdout, - discardStdin: false, - spinner: { - interval: 120, - frames: ['◐', '◓', '◑', '◒'] - } -}); const persistedMessages: string[] = []; export function writeOut(message: string, isError = false) { const processedMessage = `${message}\n`; - const hasSpinner = spinner.isSpinning; - - // Stop spinner so we don't duplicate it - if (hasSpinner) - { - spinner.stop(); - } - const lines = countLines(message); if (isError) @@ -48,12 +30,6 @@ export function writeOut(message: string, isError = false) stdout.write(processedMessage); lineCount += lines; } - - // Restart the spinner - if (hasSpinner) - { - spinner.start(); - } } export function persistMessage(message: string) @@ -64,39 +40,6 @@ export function persistMessage(message: string) writeOut(message); } -export function setSpinnerStatus(type: 'success' | 'error' | 'warn' | 'info', message?: string) -{ - const curMessage = spinner.text.replace(/\n$/, ''); - - if (type === 'error') - { - spinner.fail(chalk.red.bold(message ?? curMessage)); - } - else if (type === 'warn') - { - spinner.warn(chalk.yellow.bold(message ?? curMessage)); - } - else if (type === 'success') - { - spinner.succeed(chalk.green.bold(message ?? curMessage)); - } - else if (type === 'info') - { - spinner.info(chalk.blue.bold(message ?? curMessage)); - } - - lineCount++; -} - -export function updateSpinner(message: string) -{ - spinner.text = `${message}\n`; - if (!spinner.isSpinning) - { - spinner.start(); - } -} - function clearStream(stream: Writable, lines: number) { readline.moveCursor(stream, 0, -lines); @@ -125,3 +68,22 @@ export function resetWindow() writeOut(m); } } + +const progressBar = new cliProgress.SingleBar({ + format: `${chalk.green('{bar}')} {percentage}%`, +}, cliProgress.Presets.rect); + +export function startProgress() +{ + progressBar.start(100, 0); +} + +export function updateProgress(progress: number) +{ + progressBar.update(progress); +} + +export function stopProgress() +{ + progressBar.stop(); +} diff --git a/packages/manifest/test/Manifest.test.ts b/packages/manifest/test/Manifest.test.ts index d51e77b..03ea38f 100644 --- a/packages/manifest/test/Manifest.test.ts +++ b/packages/manifest/test/Manifest.test.ts @@ -1,7 +1,8 @@ import { AssetPack } from '@play-co/assetpack-core'; import { audio } from '@play-co/assetpack-plugin-ffmpeg'; import { pixiManifest } from '@play-co/assetpack-plugin-manifest'; -import { mipmapCompress, spineAtlasMipmap } from '@play-co/assetpack-plugin-mipmap-compress'; +import { spineAtlasMipmap } from '@play-co/assetpack-plugin-mipmap'; +import { compress } from '@play-co/assetpack-plugin-compress'; import { texturePacker } from '@play-co/assetpack-plugin-texture-packer'; import { existsSync, readJSONSync } from 'fs-extra'; import type { File } from '../../../shared/test'; @@ -122,13 +123,11 @@ describe('Manifest', () => }), audio(), spineAtlasMipmap(), - mipmapCompress({ - compress: { - png: true, - jpg: true, - webp: true, - avif: false, - } + compress({ + png: true, + jpg: true, + webp: true, + avif: false, }), pixiManifest(), ] @@ -326,11 +325,9 @@ describe('Manifest', () => }), audio(), spineAtlasMipmap(), - mipmapCompress({ - compress: { - webp: true, - png: true, - } + compress({ + webp: true, + png: true, }), pixiManifest({ createShortcuts: true, @@ -547,11 +544,9 @@ describe('Manifest', () => }), audio(), spineAtlasMipmap(), - mipmapCompress({ - compress: { - webp: true, - png: true, - } + compress({ + webp: true, + png: true, }), pixiManifest({ createShortcuts: true, @@ -708,11 +703,9 @@ describe('Manifest', () => }), audio(), spineAtlasMipmap(), - mipmapCompress({ - compress: { - webp: true, - png: true, - } + compress({ + webp: true, + png: true, }), pixiManifest({ createShortcuts: false, diff --git a/packages/mipmap-compress/README.md b/packages/mipmap/README.md similarity index 100% rename from packages/mipmap-compress/README.md rename to packages/mipmap/README.md diff --git a/packages/mipmap/jest.config.js b/packages/mipmap/jest.config.js new file mode 100644 index 0000000..9b54d88 --- /dev/null +++ b/packages/mipmap/jest.config.js @@ -0,0 +1,10 @@ +const sharedConfig = require('../../jest.config'); + +module.exports = { + ...sharedConfig, + rootDir: './', + moduleNameMapper: { + '^@play-co/assetpack-plugin-(.*)$': '/../$1/src', + '^@play-co/assetpack-(.*)$': '/../$1/src', + }, +}; diff --git a/packages/mipmap/package.json b/packages/mipmap/package.json new file mode 100644 index 0000000..21e4171 --- /dev/null +++ b/packages/mipmap/package.json @@ -0,0 +1,47 @@ +{ + "name": "@play-co/assetpack-plugin-mipmap", + "version": "1.1.3", + "description": "", + "homepage": "https://github.com/pixijs/assetpack/tree/master/packages/mipmap/#readme", + "bugs": "https://github.com/pixijs/assetpack/issues", + "repository": { + "url": "pixijs/assetpack", + "directory": "packages/mipmap" + }, + "license": "MIT", + "author": "Zyie", + "exports": { + "import": "./dist/es/index.js", + "types": "./dist/types/index.d.ts", + "default": "./dist/cjs/index.js" + }, + "main": "./dist/cjs/index.js", + "module": "./dist/es/index.js", + "types": "./dist/types/index.d.ts", + "files": [ + "dist", + "*.d.ts" + ], + "scripts": { + "prebuild": "rimraf dist", + "build": "rollup -c", + "test": "npx jest --config ./jest.config.js", + "test:types": "tsc --noEmit" + }, + "dependencies": { + "fs-extra": "^11.1.0", + "sharp": "^0.33.3" + }, + "devDependencies": { + "@play-co/assetpack-core": "1.1.3" + }, + "peerDependencies": { + "@play-co/assetpack-core": ">=0.0.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/mipmap/rollup.config.mjs b/packages/mipmap/rollup.config.mjs new file mode 100644 index 0000000..d68789d --- /dev/null +++ b/packages/mipmap/rollup.config.mjs @@ -0,0 +1,7 @@ +import { readFileSync } from 'fs'; + +import { createConfig } from '../../shared/rollup.config.mjs'; + +export default createConfig({ + pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) +}); diff --git a/packages/mipmap-compress/src/index.ts b/packages/mipmap/src/index.ts similarity index 51% rename from packages/mipmap-compress/src/index.ts rename to packages/mipmap/src/index.ts index 0f1422b..c7e9b23 100644 --- a/packages/mipmap-compress/src/index.ts +++ b/packages/mipmap/src/index.ts @@ -1,2 +1,2 @@ -export * from './mipmapCompress'; +export * from './mipmap'; export * from './spineAtlasMipmap'; diff --git a/packages/mipmap-compress/src/mipmapCompress.ts b/packages/mipmap/src/mipmap.ts similarity index 55% rename from packages/mipmap-compress/src/mipmapCompress.ts rename to packages/mipmap/src/mipmap.ts index 1355d4c..677489e 100644 --- a/packages/mipmap-compress/src/mipmapCompress.ts +++ b/packages/mipmap/src/mipmap.ts @@ -1,12 +1,10 @@ -import type { PluginOptions, Asset, AssetPipe } from '@play-co/assetpack-core'; -import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; -import type { AvifOptions, JpegOptions, PngOptions, WebpOptions } from 'sharp'; +import type { Asset, AssetPipe, PluginOptions } from '@play-co/assetpack-core'; +import { checkExt, createNewAssetAt } from '@play-co/assetpack-core'; import sharp from 'sharp'; -import { resolveOptions } from './utils/resolveOptions'; import { mipmapSharp } from './utils/mipmapSharp'; -import { compressSharp } from './utils/compressSharp'; +import { resolveOptions } from './utils/resolveOptions'; -export interface MipmapOptions +export interface MipmapOptions extends PluginOptions<'fix' | T> { /** A template for denoting the resolution of the images. */ template?: string; @@ -16,25 +14,6 @@ export interface MipmapOptions fixedResolution?: string; } -type CompressJpgOptions = Omit; -type CompressWebpOptions = Omit; -type CompressAvifOptions = Omit; -type CompressPngOptions = Omit; - -export interface CompressOptions -{ - png?: CompressPngOptions | boolean; - webp?: CompressWebpOptions | boolean; - avif?: CompressAvifOptions | boolean; - jpg?: CompressJpgOptions | boolean; -} - -export interface MipmapCompressOptions extends PluginOptions<'fix' | 'nc'> -{ - mipmap?: MipmapOptions | boolean; - compress?: CompressOptions | boolean; -} - export interface MipmapCompressImageData { format: '.avif' | '.png' | '.webp' | '.jpg' | '.jpeg'; @@ -45,42 +24,20 @@ export interface MipmapCompressImageData const defaultMipmapOptions: Required = { template: '@%%x', resolutions: { default: 1, low: 0.5 }, - fixedResolution: 'default' + fixedResolution: 'default', + tags: { + fix: 'fix', + } }; -export function mipmapCompress(_options: MipmapCompressOptions = {}): AssetPipe +export function mipmap(_options: MipmapOptions = {}): AssetPipe { - const mipmap = resolveOptions(_options.mipmap, defaultMipmapOptions); - - const compress = resolveOptions(_options.compress, { - png: true, - jpg: true, - webp: false, - avif: false, - }); - - if (compress) - { - compress.jpg = resolveOptions(compress.jpg, { - - }); - compress.png = resolveOptions(compress.png, { - quality: 90, - }); - compress.webp = resolveOptions(compress.webp, { - quality: 80, - }); - compress.avif = resolveOptions(compress.avif, { - - }); - } + const mipmap = resolveOptions(_options, defaultMipmapOptions); const defaultOptions = { - mipmap, - compress, + ...mipmap, tags: { fix: 'fix', - nc: 'nc', ..._options.tags, } }; @@ -91,12 +48,11 @@ export function mipmapCompress(_options: MipmapCompressOptions = {}): AssetPipe< defaultOptions, test(asset: Asset, options) { - return (options.mipmap || options.compress) && checkExt(asset.path, '.png', '.jpg', '.jpeg'); + return options && checkExt(asset.path, '.png', '.jpg', '.jpeg'); }, async transform(asset: Asset, options) { const shouldMipmap = mipmap && !asset.metaData[options.tags.fix as any]; - const shouldCompress = compress && !asset.metaData[options.tags.nc as any]; let processedImages: MipmapCompressImageData[]; @@ -106,13 +62,12 @@ export function mipmapCompress(_options: MipmapCompressOptions = {}): AssetPipe< sharpImage: sharp(asset.buffer), }; - // first mipmap if we want.. try { if (shouldMipmap) { - const { resolutions, fixedResolution } = options.mipmap as Required - || defaultOptions.mipmap; + const { resolutions, fixedResolution } = options as Required + || defaultOptions; const fixedResolutions: {[x: string]: number} = {}; @@ -138,28 +93,14 @@ export function mipmapCompress(_options: MipmapCompressOptions = {}): AssetPipe< throw new Error(`[AssetPack] Failed to mipmap image: ${asset.path} - ${error}`); } - try - { - if (shouldCompress) - { - processedImages = (await Promise.all( - processedImages.map((image) => compressSharp(image, options.compress as CompressOptions)) - )).flat(); - } - } - catch (error) - { - throw new Error(`[AssetPack] Failed to compress image: ${asset.path} - ${error}`); - } - // now create our new assets const newAssets = processedImages.map((data) => { let resolution = ''; - if (options.mipmap) + if (options) { - resolution = (options.mipmap as Required).template.replace('%%', `${data.resolution}`); + resolution = (options as Required).template.replace('%%', `${data.resolution}`); resolution = data.resolution === 1 ? '' : resolution; } diff --git a/packages/mipmap-compress/src/spineAtlasMipmap.ts b/packages/mipmap/src/spineAtlasMipmap.ts similarity index 98% rename from packages/mipmap-compress/src/spineAtlasMipmap.ts rename to packages/mipmap/src/spineAtlasMipmap.ts index 12507dc..f9a6f75 100644 --- a/packages/mipmap-compress/src/spineAtlasMipmap.ts +++ b/packages/mipmap/src/spineAtlasMipmap.ts @@ -1,6 +1,6 @@ import type { Asset, PluginOptions } from '@play-co/assetpack-core'; import { checkExt, type AssetPipe, createNewAssetAt } from '@play-co/assetpack-core'; -import type { MipmapOptions } from './mipmapCompress'; +import type { MipmapOptions } from './mipmap'; export type SpineOptions = PluginOptions<'fix' | 'nc'> & MipmapOptions; diff --git a/packages/mipmap-compress/src/utils/mipmapSharp.ts b/packages/mipmap/src/utils/mipmapSharp.ts similarity index 94% rename from packages/mipmap-compress/src/utils/mipmapSharp.ts rename to packages/mipmap/src/utils/mipmapSharp.ts index 641e4ee..63af2c7 100644 --- a/packages/mipmap-compress/src/utils/mipmapSharp.ts +++ b/packages/mipmap/src/utils/mipmapSharp.ts @@ -1,4 +1,4 @@ -import type { MipmapCompressImageData } from '../mipmapCompress'; +import type { MipmapCompressImageData } from '../mipmap'; export async function mipmapSharp( image: MipmapCompressImageData, diff --git a/packages/mipmap/src/utils/resolveOptions.ts b/packages/mipmap/src/utils/resolveOptions.ts new file mode 100644 index 0000000..4264257 --- /dev/null +++ b/packages/mipmap/src/utils/resolveOptions.ts @@ -0,0 +1,29 @@ +/** + * Determines and returns the options based on the given arguments. + * + * This function checks if `options` is a boolean. If it is, and `options` is `true`, + * the function returns `defaultOptions`. If `options` is `false`, the function returns `false`. + * If `options` is not a boolean, the function merges `options` with `defaultOptions`, + * giving precedence to the properties in `options`. + * + * @template T The type of the options object. + * @param {options} T | boolean | undefined The custom options provided by the user, + * or a boolean flag indicating whether to use the default options (`true`) or no options (`false`), + * or `undefined` to use the default options. + * @param {defaultOptions} T The default options object. + * @returns {T} The resolved options object. If `options` is `false`, returns `false`. + * Otherwise, returns an object of type `T` that merges `defaultOptions` and `options`, + * with properties in `options` taking precedence. + */ +export function resolveOptions(options: T | boolean | undefined, defaultOptions: T) +{ + if (typeof options === 'boolean') + { + return options ? defaultOptions : false; + } + + return { + ...defaultOptions, + ...(options || {}) + } as T; +} diff --git a/packages/mipmap-compress/test/Mipmap.test.ts b/packages/mipmap/test/Mipmap.test.ts similarity index 92% rename from packages/mipmap-compress/test/Mipmap.test.ts rename to packages/mipmap/test/Mipmap.test.ts index aa32c96..55e7cae 100644 --- a/packages/mipmap-compress/test/Mipmap.test.ts +++ b/packages/mipmap/test/Mipmap.test.ts @@ -1,10 +1,10 @@ import { AssetPack } from '@play-co/assetpack-core'; import { existsSync } from 'fs-extra'; import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; -import { mipmapCompress } from '../src/mipmapCompress'; +import { mipmap } from '../src/mipmap'; import { spineAtlasMipmap } from '../src/spineAtlasMipmap'; -const pkg = 'mipmap-compress'; +const pkg = 'mipmap'; describe('Mipmap', () => { @@ -44,14 +44,11 @@ describe('Mipmap', () => }); const opts = { - mipmap: { - resolutions: { - high: 2, - default: 1, - low: 0.5, - } - }, - compress: false + resolutions: { + high: 2, + default: 1, + low: 0.5, + } }; const assetpack = new AssetPack({ @@ -59,8 +56,8 @@ describe('Mipmap', () => output: outputDir, cache: false, pipes: [ - mipmapCompress(opts), - spineAtlasMipmap(opts.mipmap), + mipmap(opts), + spineAtlasMipmap(opts), ] }); @@ -103,7 +100,7 @@ describe('Mipmap', () => folders: [], }); - const mipmap = { + const mipmapOpts = { resolutions: { low: 0.5 }, fixedResolution: 'low' }; @@ -113,8 +110,8 @@ describe('Mipmap', () => output: outputDir, cache: false, pipes: [ - spineAtlasMipmap(mipmap), - mipmapCompress({ compress: { png: true }, mipmap }), + spineAtlasMipmap(mipmapOpts), + mipmap(mipmapOpts), ] }); @@ -160,7 +157,7 @@ describe('Mipmap', () => output: outputDir, cache: false, pipes: [ - mipmapCompress({ compress: false }), + mipmap(), spineAtlasMipmap(), ] }); @@ -209,7 +206,7 @@ describe('Mipmap', () => output: outputDir, cache: false, pipes: [ - mipmapCompress({ compress: false }), + mipmap(), spineAtlasMipmap(), ] }); @@ -251,7 +248,7 @@ describe('Mipmap', () => entry: inputDir, output: outputDir, cache: false, - pipes: [mipmapCompress({ compress: false })] + pipes: [mipmap()] }); await assetpack.run(); diff --git a/packages/mipmap-compress/test/resources/dragon.atlas b/packages/mipmap/test/resources/dragon.atlas similarity index 100% rename from packages/mipmap-compress/test/resources/dragon.atlas rename to packages/mipmap/test/resources/dragon.atlas diff --git a/packages/mipmap-compress/test/resources/dragon.json b/packages/mipmap/test/resources/dragon.json similarity index 100% rename from packages/mipmap-compress/test/resources/dragon.json rename to packages/mipmap/test/resources/dragon.json diff --git a/packages/mipmap-compress/test/resources/dragon.png b/packages/mipmap/test/resources/dragon.png similarity index 100% rename from packages/mipmap-compress/test/resources/dragon.png rename to packages/mipmap/test/resources/dragon.png diff --git a/packages/mipmap-compress/test/resources/dragon2.png b/packages/mipmap/test/resources/dragon2.png similarity index 100% rename from packages/mipmap-compress/test/resources/dragon2.png rename to packages/mipmap/test/resources/dragon2.png diff --git a/packages/mipmap/test/resources/jpg-1.jpg b/packages/mipmap/test/resources/jpg-1.jpg new file mode 100644 index 0000000..8164815 Binary files /dev/null and b/packages/mipmap/test/resources/jpg-1.jpg differ diff --git a/packages/mipmap/test/resources/png-1.png b/packages/mipmap/test/resources/png-1.png new file mode 100644 index 0000000..0fdeed9 Binary files /dev/null and b/packages/mipmap/test/resources/png-1.png differ diff --git a/packages/mipmap/test/resources/png-2.png b/packages/mipmap/test/resources/png-2.png new file mode 100644 index 0000000..b2cc1c5 Binary files /dev/null and b/packages/mipmap/test/resources/png-2.png differ diff --git a/packages/mipmap/test/resources/sp-1.png b/packages/mipmap/test/resources/sp-1.png new file mode 100644 index 0000000..c51eef2 Binary files /dev/null and b/packages/mipmap/test/resources/sp-1.png differ diff --git a/packages/mipmap/test/resources/sp-2.png b/packages/mipmap/test/resources/sp-2.png new file mode 100644 index 0000000..ec1dcc8 Binary files /dev/null and b/packages/mipmap/test/resources/sp-2.png differ diff --git a/packages/mipmap/test/resources/sp-3.jpg b/packages/mipmap/test/resources/sp-3.jpg new file mode 100644 index 0000000..747e8a8 Binary files /dev/null and b/packages/mipmap/test/resources/sp-3.jpg differ diff --git a/packages/mipmap-compress/tsconfig.json b/packages/mipmap/tsconfig.json similarity index 100% rename from packages/mipmap-compress/tsconfig.json rename to packages/mipmap/tsconfig.json diff --git a/packages/texture-packer/test/texturePackerCacheBuster.test.ts b/packages/texture-packer/test/texturePackerCacheBuster.test.ts index 35970a4..bbce12c 100644 --- a/packages/texture-packer/test/texturePackerCacheBuster.test.ts +++ b/packages/texture-packer/test/texturePackerCacheBuster.test.ts @@ -1,6 +1,6 @@ import { AssetPack } from '@play-co/assetpack-core'; import { cacheBuster } from '@play-co/assetpack-plugin-cache-buster'; -import { mipmapCompress } from '@play-co/assetpack-plugin-mipmap-compress'; +import { compress } from '@play-co/assetpack-plugin-compress'; import { texturePacker, texturePackerCompress } from '@play-co/assetpack-plugin-texture-packer'; import { existsSync, readJSONSync } from 'fs-extra'; import type { File } from '../../../shared/test/index'; @@ -87,12 +87,10 @@ describe('Texture Packer Compression', () => resolutions: { default: 1 }, }, }), - mipmapCompress({ - compress: { - png: true, - jpg: true, - webp: true, - } + compress({ + png: true, + jpg: true, + webp: true, }), texturePackerCompress(), cacheBuster(), diff --git a/packages/texture-packer/test/texturePackerCompress.test.ts b/packages/texture-packer/test/texturePackerCompress.test.ts index 90e7f70..890c770 100644 --- a/packages/texture-packer/test/texturePackerCompress.test.ts +++ b/packages/texture-packer/test/texturePackerCompress.test.ts @@ -1,5 +1,5 @@ import { AssetPack } from '@play-co/assetpack-core'; -import { mipmapCompress } from '@play-co/assetpack-plugin-mipmap-compress'; +import { compress } from '@play-co/assetpack-plugin-compress'; import { texturePacker, texturePackerCompress } from '@play-co/assetpack-plugin-texture-packer'; import { readJSONSync } from 'fs-extra'; import type { File } from '../../../shared/test/index'; @@ -53,12 +53,10 @@ describe('Texture Packer Compression', () => resolutions: { default: 1 }, }, }), - mipmapCompress({ - compress: { - png: true, - jpg: true, - webp: true, - } + compress({ + png: true, + jpg: true, + webp: true, }), texturePackerCompress(), ]