diff --git a/package-lock.json b/package-lock.json index b8aa4b2..41c86f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,10 @@ { - "name": "assetpack", + "name": "@play-co/assetpack", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "assetpack", + "name": "@play-co/assetpack", "license": "MIT", "workspaces": [ "packages/*" @@ -57,6 +57,10 @@ "resolved": "packages/core", "link": true }, + "node_modules/@assetpack/plugin-cache-buster": { + "resolved": "packages/cache-buster", + "link": true + }, "node_modules/@assetpack/plugin-ffmpeg": { "resolved": "packages/ffmpeg", "link": true @@ -712,6 +716,15 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@emnapi/core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.1.1.tgz", + "integrity": "sha512-eu4KjHfXg3I+UUR7vSuwZXpRo4c8h4Rtb5Lu2F7Z4JqJFl/eidquONEBiRs6viXKpWBC3BaJBy68xGJ2j56idw==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@emnapi/runtime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.1.0.tgz", @@ -3505,6 +3518,255 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.1.2.tgz", + "integrity": "sha512-8JuczewTFIZ/XIjHQ+YlQUydHvlKx2hkcxtuGwh+t/t5zWyZct6YG4+xjHcq8xyc/e7FmFwf42Zj2YgICwmlvA==", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.1.0", + "@emnapi/runtime": "^1.1.0", + "@tybys/wasm-util": "^0.8.1" + } + }, + "node_modules/@node-rs/crc32": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32/-/crc32-1.10.0.tgz", + "integrity": "sha512-SFvU8PGZexRMRPUhi+4a9LW4oqFuK5CLEElysrKoRtNkJ+LcRFL+b3wfuzbcDq/ea0rS0nzRLFZwVsNVyWaGew==", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@node-rs/crc32-android-arm-eabi": "1.10.0", + "@node-rs/crc32-android-arm64": "1.10.0", + "@node-rs/crc32-darwin-arm64": "1.10.0", + "@node-rs/crc32-darwin-x64": "1.10.0", + "@node-rs/crc32-freebsd-x64": "1.10.0", + "@node-rs/crc32-linux-arm-gnueabihf": "1.10.0", + "@node-rs/crc32-linux-arm64-gnu": "1.10.0", + "@node-rs/crc32-linux-arm64-musl": "1.10.0", + "@node-rs/crc32-linux-x64-gnu": "1.10.0", + "@node-rs/crc32-linux-x64-musl": "1.10.0", + "@node-rs/crc32-wasm32-wasi": "1.10.0", + "@node-rs/crc32-win32-arm64-msvc": "1.10.0", + "@node-rs/crc32-win32-ia32-msvc": "1.10.0", + "@node-rs/crc32-win32-x64-msvc": "1.10.0" + } + }, + "node_modules/@node-rs/crc32-android-arm-eabi": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm-eabi/-/crc32-android-arm-eabi-1.10.0.tgz", + "integrity": "sha512-IRas7ylc8nB3988nnaT4PC5ZuaK3VOrLbTyg1Y/5ZHlxsYpqLpCb7VMf/oRrHxkSzSTlluD+inv3J8UE3i5Ojg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-android-arm64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm64/-/crc32-android-arm64-1.10.0.tgz", + "integrity": "sha512-4vX1gB+rf3sYma/LLycmYsuFKolWdZX7tQOwLQ6PDwE7dAoN3mWAgS3RBw2G6PerGD9r90vSXWXPLJnF3OAhlw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-darwin-arm64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-arm64/-/crc32-darwin-arm64-1.10.0.tgz", + "integrity": "sha512-nAAdxZqxFBxqhI3ZMEGi7QDwg44N4laYO4iGIGhjLvsUDqJlYeIlqZ39Lh2gOK3D2uF/TaT4b0bU5EPHWnKMOQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-darwin-x64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-x64/-/crc32-darwin-x64-1.10.0.tgz", + "integrity": "sha512-0YhLJFDY7VAKlJ4+SdfZFY+u0X18tkuD3NCtPp1SYh1o9pWpFVBbTKWvdjjx/Ihqw0ozkfc3iewFJU7vlrDQJg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-freebsd-x64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-freebsd-x64/-/crc32-freebsd-x64-1.10.0.tgz", + "integrity": "sha512-BE0IeHn59GzaebTM85Dpe+ErPV8E+WuXd/sNyLLS8jZUuNoOJwFUKotm8CUFG+MI40N0U9PzvZjQSwaeMsyMsQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm-gnueabihf": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm-gnueabihf/-/crc32-linux-arm-gnueabihf-1.10.0.tgz", + "integrity": "sha512-R3mN3uSZaslJtXW3NXdropB9tHCnOgbrvq7MtmCRpHi2Ie3E46Ohi8cW0HgHjihptafTf8NWsoYzErm39BTY0Q==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm64-gnu": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-gnu/-/crc32-linux-arm64-gnu-1.10.0.tgz", + "integrity": "sha512-2zZ2RQLVhjCWRWiLvz/CoP5BFld/zE/uD2Z9Nk+Y5zmJ11CD1RC3lqKG1M3MgEiQq9CnWJxwyy5kM2q4jDeXkg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-arm64-musl": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-musl/-/crc32-linux-arm64-musl-1.10.0.tgz", + "integrity": "sha512-WEIavGFHMAFe8NIKhbYnM6k2x7y6M/NQewXE8cqeV03Q8mLzCDBr34i/MzpW+M42NvEYgcM8c3Ayn2FijHb64Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-x64-gnu": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-gnu/-/crc32-linux-x64-gnu-1.10.0.tgz", + "integrity": "sha512-K/7aY/h8QngsLk0KsalQ3AlZ8ljXRisZgc20RcbB4UZkjl5AN6TeHQlVbx9U2MSBE5f6ViiZEr8c8CcID3W2Mg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-linux-x64-musl": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-musl/-/crc32-linux-x64-musl-1.10.0.tgz", + "integrity": "sha512-GyCSm+Dp96qUvqrsxKgfd3TFrE8v5sRUYiMgNKK6G1m7nQb/VXvab9UoBSKeFw131odt3LlIuBAuhMnbb4za5w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-wasm32-wasi": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-wasm32-wasi/-/crc32-wasm32-wasi-1.10.0.tgz", + "integrity": "sha512-C+2IK5HwNUz2aiMGiN0RTijb80X5V1jo/o8bsHqi8ukoRyO6HLMhVn+xptqY+RRSf4VUzzNR5eHqD+WLcLId0g==", + "cpu": [ + "wasm32" + ], + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@node-rs/crc32-win32-arm64-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-arm64-msvc/-/crc32-win32-arm64-msvc-1.10.0.tgz", + "integrity": "sha512-RaVo4edbEM3DyQkvXGKdPizUmr2A4NjLMk/1x9b/tz/k2rdd+QaPAauDwWAzs7SKoDBV9H4qc3hNFuKGjjRhjA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-win32-ia32-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-ia32-msvc/-/crc32-win32-ia32-msvc-1.10.0.tgz", + "integrity": "sha512-5KqJFdzRXELpXcdNgahafjkc9MxZJfKDVkFPBMkQIjjkv8PQ49DVw15/7yuhAN0pyYccNaUil4vtVoo7WTIVgQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@node-rs/crc32-win32-x64-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-x64-msvc/-/crc32-win32-x64-msvc-1.10.0.tgz", + "integrity": "sha512-6b99QpwNCQube1xleD+9IcF6foEWHYQYjuZrHAR5diuP/uqM7i+KCgMU9fbCFLs5zmssYHO3CQSZ8G+V0eC59g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4281,6 +4543,15 @@ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, + "node_modules/@tybys/wasm-util": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.8.1.tgz", + "integrity": "sha512-GSsTwyBl4pIzsxAY5wroZdyQKyhXk0d8PCRZtrSZ2WEB1cBdrp2EgGBwHOGCZtIIPun/DL3+AykCv+J6fyRH4Q==", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@types/babel__core": { "version": "7.20.0", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", @@ -14798,6 +15069,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/cache-buster": { + "name": "@assetpack/plugin-cache-buster", + "version": "0.7.0", + "license": "MIT", + "dependencies": { + "@node-rs/crc32": "^1.10.0", + "fs-extra": "^11.1.0" + }, + "devDependencies": { + "@assetpack/core": "0.7.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@assetpack/core": ">=0.0.0" + } + }, "packages/cli": { "name": "@assetpack/cli", "version": "0.7.0", @@ -15231,6 +15520,14 @@ } } }, + "@assetpack/plugin-cache-buster": { + "version": "file:packages/cache-buster", + "requires": { + "@assetpack/core": "0.7.0", + "@node-rs/crc32": "^1.10.0", + "fs-extra": "^11.1.0" + } + }, "@assetpack/plugin-ffmpeg": { "version": "file:packages/ffmpeg", "requires": { @@ -15856,6 +16153,15 @@ } } }, + "@emnapi/core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.1.1.tgz", + "integrity": "sha512-eu4KjHfXg3I+UUR7vSuwZXpRo4c8h4Rtb5Lu2F7Z4JqJFl/eidquONEBiRs6viXKpWBC3BaJBy68xGJ2j56idw==", + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, "@emnapi/runtime": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.1.0.tgz", @@ -17908,6 +18214,125 @@ } } }, + "@napi-rs/wasm-runtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.1.2.tgz", + "integrity": "sha512-8JuczewTFIZ/XIjHQ+YlQUydHvlKx2hkcxtuGwh+t/t5zWyZct6YG4+xjHcq8xyc/e7FmFwf42Zj2YgICwmlvA==", + "optional": true, + "requires": { + "@emnapi/core": "^1.1.0", + "@emnapi/runtime": "^1.1.0", + "@tybys/wasm-util": "^0.8.1" + } + }, + "@node-rs/crc32": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32/-/crc32-1.10.0.tgz", + "integrity": "sha512-SFvU8PGZexRMRPUhi+4a9LW4oqFuK5CLEElysrKoRtNkJ+LcRFL+b3wfuzbcDq/ea0rS0nzRLFZwVsNVyWaGew==", + "requires": { + "@node-rs/crc32-android-arm-eabi": "1.10.0", + "@node-rs/crc32-android-arm64": "1.10.0", + "@node-rs/crc32-darwin-arm64": "1.10.0", + "@node-rs/crc32-darwin-x64": "1.10.0", + "@node-rs/crc32-freebsd-x64": "1.10.0", + "@node-rs/crc32-linux-arm-gnueabihf": "1.10.0", + "@node-rs/crc32-linux-arm64-gnu": "1.10.0", + "@node-rs/crc32-linux-arm64-musl": "1.10.0", + "@node-rs/crc32-linux-x64-gnu": "1.10.0", + "@node-rs/crc32-linux-x64-musl": "1.10.0", + "@node-rs/crc32-wasm32-wasi": "1.10.0", + "@node-rs/crc32-win32-arm64-msvc": "1.10.0", + "@node-rs/crc32-win32-ia32-msvc": "1.10.0", + "@node-rs/crc32-win32-x64-msvc": "1.10.0" + } + }, + "@node-rs/crc32-android-arm-eabi": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm-eabi/-/crc32-android-arm-eabi-1.10.0.tgz", + "integrity": "sha512-IRas7ylc8nB3988nnaT4PC5ZuaK3VOrLbTyg1Y/5ZHlxsYpqLpCb7VMf/oRrHxkSzSTlluD+inv3J8UE3i5Ojg==", + "optional": true + }, + "@node-rs/crc32-android-arm64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-android-arm64/-/crc32-android-arm64-1.10.0.tgz", + "integrity": "sha512-4vX1gB+rf3sYma/LLycmYsuFKolWdZX7tQOwLQ6PDwE7dAoN3mWAgS3RBw2G6PerGD9r90vSXWXPLJnF3OAhlw==", + "optional": true + }, + "@node-rs/crc32-darwin-arm64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-arm64/-/crc32-darwin-arm64-1.10.0.tgz", + "integrity": "sha512-nAAdxZqxFBxqhI3ZMEGi7QDwg44N4laYO4iGIGhjLvsUDqJlYeIlqZ39Lh2gOK3D2uF/TaT4b0bU5EPHWnKMOQ==", + "optional": true + }, + "@node-rs/crc32-darwin-x64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-darwin-x64/-/crc32-darwin-x64-1.10.0.tgz", + "integrity": "sha512-0YhLJFDY7VAKlJ4+SdfZFY+u0X18tkuD3NCtPp1SYh1o9pWpFVBbTKWvdjjx/Ihqw0ozkfc3iewFJU7vlrDQJg==", + "optional": true + }, + "@node-rs/crc32-freebsd-x64": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-freebsd-x64/-/crc32-freebsd-x64-1.10.0.tgz", + "integrity": "sha512-BE0IeHn59GzaebTM85Dpe+ErPV8E+WuXd/sNyLLS8jZUuNoOJwFUKotm8CUFG+MI40N0U9PzvZjQSwaeMsyMsQ==", + "optional": true + }, + "@node-rs/crc32-linux-arm-gnueabihf": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm-gnueabihf/-/crc32-linux-arm-gnueabihf-1.10.0.tgz", + "integrity": "sha512-R3mN3uSZaslJtXW3NXdropB9tHCnOgbrvq7MtmCRpHi2Ie3E46Ohi8cW0HgHjihptafTf8NWsoYzErm39BTY0Q==", + "optional": true + }, + "@node-rs/crc32-linux-arm64-gnu": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-gnu/-/crc32-linux-arm64-gnu-1.10.0.tgz", + "integrity": "sha512-2zZ2RQLVhjCWRWiLvz/CoP5BFld/zE/uD2Z9Nk+Y5zmJ11CD1RC3lqKG1M3MgEiQq9CnWJxwyy5kM2q4jDeXkg==", + "optional": true + }, + "@node-rs/crc32-linux-arm64-musl": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-arm64-musl/-/crc32-linux-arm64-musl-1.10.0.tgz", + "integrity": "sha512-WEIavGFHMAFe8NIKhbYnM6k2x7y6M/NQewXE8cqeV03Q8mLzCDBr34i/MzpW+M42NvEYgcM8c3Ayn2FijHb64Q==", + "optional": true + }, + "@node-rs/crc32-linux-x64-gnu": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-gnu/-/crc32-linux-x64-gnu-1.10.0.tgz", + "integrity": "sha512-K/7aY/h8QngsLk0KsalQ3AlZ8ljXRisZgc20RcbB4UZkjl5AN6TeHQlVbx9U2MSBE5f6ViiZEr8c8CcID3W2Mg==", + "optional": true + }, + "@node-rs/crc32-linux-x64-musl": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-linux-x64-musl/-/crc32-linux-x64-musl-1.10.0.tgz", + "integrity": "sha512-GyCSm+Dp96qUvqrsxKgfd3TFrE8v5sRUYiMgNKK6G1m7nQb/VXvab9UoBSKeFw131odt3LlIuBAuhMnbb4za5w==", + "optional": true + }, + "@node-rs/crc32-wasm32-wasi": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-wasm32-wasi/-/crc32-wasm32-wasi-1.10.0.tgz", + "integrity": "sha512-C+2IK5HwNUz2aiMGiN0RTijb80X5V1jo/o8bsHqi8ukoRyO6HLMhVn+xptqY+RRSf4VUzzNR5eHqD+WLcLId0g==", + "optional": true, + "requires": { + "@napi-rs/wasm-runtime": "^0.1.1" + } + }, + "@node-rs/crc32-win32-arm64-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-arm64-msvc/-/crc32-win32-arm64-msvc-1.10.0.tgz", + "integrity": "sha512-RaVo4edbEM3DyQkvXGKdPizUmr2A4NjLMk/1x9b/tz/k2rdd+QaPAauDwWAzs7SKoDBV9H4qc3hNFuKGjjRhjA==", + "optional": true + }, + "@node-rs/crc32-win32-ia32-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-ia32-msvc/-/crc32-win32-ia32-msvc-1.10.0.tgz", + "integrity": "sha512-5KqJFdzRXELpXcdNgahafjkc9MxZJfKDVkFPBMkQIjjkv8PQ49DVw15/7yuhAN0pyYccNaUil4vtVoo7WTIVgQ==", + "optional": true + }, + "@node-rs/crc32-win32-x64-msvc": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@node-rs/crc32-win32-x64-msvc/-/crc32-win32-x64-msvc-1.10.0.tgz", + "integrity": "sha512-6b99QpwNCQube1xleD+9IcF6foEWHYQYjuZrHAR5diuP/uqM7i+KCgMU9fbCFLs5zmssYHO3CQSZ8G+V0eC59g==", + "optional": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -18504,6 +18929,15 @@ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "dev": true }, + "@tybys/wasm-util": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.8.1.tgz", + "integrity": "sha512-GSsTwyBl4pIzsxAY5wroZdyQKyhXk0d8PCRZtrSZ2WEB1cBdrp2EgGBwHOGCZtIIPun/DL3+AykCv+J6fyRH4Q==", + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, "@types/babel__core": { "version": "7.20.0", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.0.tgz", diff --git a/package.json b/package.json index 32e146c..2b63b72 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "assetpack", + "name": "@play-co/assetpack", "private": true, "license": "MIT", "workspaces": [ diff --git a/packages/cache-buster/.asset-pack/sdf-font/sdf.0.png b/packages/cache-buster/.asset-pack/sdf-font/sdf.0.png new file mode 100644 index 0000000..833a228 Binary files /dev/null and b/packages/cache-buster/.asset-pack/sdf-font/sdf.0.png differ diff --git a/packages/cache-buster/.asset-pack/sdf-font/sdf.1.png b/packages/cache-buster/.asset-pack/sdf-font/sdf.1.png new file mode 100644 index 0000000..a4bb93c Binary files /dev/null and b/packages/cache-buster/.asset-pack/sdf-font/sdf.1.png differ diff --git a/packages/cache-buster/.asset-pack/sdf-font/sdf.fnt b/packages/cache-buster/.asset-pack/sdf-font/sdf.fnt new file mode 100644 index 0000000..9a4c76f --- /dev/null +++ b/packages/cache-buster/.asset-pack/sdf-font/sdf.fnt @@ -0,0 +1,543 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/cache-buster/README.md b/packages/cache-buster/README.md new file mode 100644 index 0000000..a25d2b0 --- /dev/null +++ b/packages/cache-buster/README.md @@ -0,0 +1,44 @@ +# @assetpack/plugin-cache-buster + +AssetPack plugin for generating hashes and appending them to the file names. +Super useful for when assets change and they need to be re-downloaded. + +Note that order matters with AssetPack plugins and its best to have this pipe transform happen at. + +When combining this with `texturePacker` you add the `texturePackerCacheBuster` pipe right after +the `cacheBuster` pipe. `texturePackerCacheBuster` will ensure that the json files internanlly update their +asset names to accommodate the new file names. + +## Example transform + +``` +|- assets + |- mySprite.png + |- myJson.json +``` +transforms to: +``` +|- assets + |- mySprite-dfs3e.png + |- myJson-aw3dsf.json +``` +## Installation + +```sh +npm install --save-dev @assetpack/plugin-cache-buster +``` + +## Basic Usage + +```js +import { cacheBuster } from "@assetpack/plugin-cache-buster"; + +export default { + ... + pipes: { + ... + cacheBuster(), + }, +}; +``` + diff --git a/packages/cache-buster/jest.config.js b/packages/cache-buster/jest.config.js new file mode 100644 index 0000000..2a52343 --- /dev/null +++ b/packages/cache-buster/jest.config.js @@ -0,0 +1,10 @@ +const sharedConfig = require('../../jest.config'); + +module.exports = { + ...sharedConfig, + rootDir: './', + moduleNameMapper: { + '^@assetpack/plugin-(.*)$': '/../$1/src', + '^@assetpack/(.*)$': '/../$1/src', + }, +}; diff --git a/packages/cache-buster/package.json b/packages/cache-buster/package.json new file mode 100644 index 0000000..345a705 --- /dev/null +++ b/packages/cache-buster/package.json @@ -0,0 +1,47 @@ +{ + "name": "@assetpack/plugin-cache-buster", + "version": "0.7.0", + "description": "", + "homepage": "https://github.com/pixijs/assetpack/tree/master/packages/cache-buster/#readme", + "bugs": "https://github.com/pixijs/assetpack/issues", + "repository": { + "url": "pixijs/assetpack", + "directory": "packages/cache-buster" + }, + "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": { + "@node-rs/crc32": "^1.10.0", + "fs-extra": "^11.1.0" + }, + "devDependencies": { + "@assetpack/core": "0.7.0" + }, + "peerDependencies": { + "@assetpack/core": ">=0.0.0" + }, + "engines": { + "node": ">=16.0.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/cache-buster/rollup.config.mjs b/packages/cache-buster/rollup.config.mjs new file mode 100644 index 0000000..d68789d --- /dev/null +++ b/packages/cache-buster/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/cache-buster/src/cacheBuster.ts b/packages/cache-buster/src/cacheBuster.ts new file mode 100644 index 0000000..8eca40e --- /dev/null +++ b/packages/cache-buster/src/cacheBuster.ts @@ -0,0 +1,53 @@ +import type { AssetPipe, Asset } from '@assetpack/core'; +import { createNewAssetAt, swapExt } from '@assetpack/core'; +import { readFileSync } from 'fs-extra'; + +import { crc32 as calculateCrc32 } from '@node-rs/crc32'; + +/** + * Cache buster asset pipe. This pipe will add a hash to the end of the filename + * the hash is calculated from the contents of the file. + * + * worth noting that when combined with the texture packer plugin, an additional + * plugin is required to update the texture packer json files to point to the new + * file names (`texturePackerCacheBuster.ts`) + * + * @returns the cache buster asset pipe + */ +export function cacheBuster(): AssetPipe +{ + const defaultOptions = {}; + + return { + folder: false, + name: 'cache-buster', + defaultOptions, + test(asset: Asset) + { + return !asset.isFolder; + }, + async transform(asset: Asset) + { + const buffer = asset.buffer ?? readFileSync(asset.path); + + const hash = crc32(buffer); + const newFileName = swapExt(asset.filename, `-${hash}${asset.extension}`); + + const newAsset = createNewAssetAt(asset, newFileName); + + // by attaching the buffer - we can avoid reading the file again + // and the final copy op will use the buffer, rather than the file path! + newAsset.buffer = buffer; + + return [newAsset]; + } + }; +} + +/** Calculate a CRC32 checksum. */ +export function crc32(input: string | Buffer): string +{ + const checksumHex = calculateCrc32(input).toString(16); + + return Buffer.from(checksumHex, 'hex').toString('base64url'); +} diff --git a/packages/cache-buster/src/index.ts b/packages/cache-buster/src/index.ts new file mode 100644 index 0000000..ee8925a --- /dev/null +++ b/packages/cache-buster/src/index.ts @@ -0,0 +1 @@ +export * from './cacheBuster'; diff --git a/packages/cache-buster/test/cacheBuster.test.ts b/packages/cache-buster/test/cacheBuster.test.ts new file mode 100644 index 0000000..45d3b2f --- /dev/null +++ b/packages/cache-buster/test/cacheBuster.test.ts @@ -0,0 +1,49 @@ +import { AssetPack, joinSafe } from '@assetpack/core'; +import { existsSync, readFileSync } from 'fs-extra'; +import { assetPath, createFolder, getInputDir, getOutputDir } from '../../../shared/test'; +import { cacheBuster, crc32 } from '../src'; + +const pkg = 'cache-buster'; + +describe('CacheBuster', () => +{ + it('should hash a file', async () => + { + const testName = 'cache-buster'; + const inputDir = getInputDir(pkg, testName); + const outputDir = getOutputDir(pkg, testName); + + createFolder( + pkg, + { + name: testName, + files: [ + { + name: 'ttf.ttf', + content: assetPath(pkg, 'Roboto-Regular.ttf'), + }, + ], + folders: [], + } + ); + + const assetpack = new AssetPack({ + entry: inputDir, + output: outputDir, + cache: true, + pipes: [ + cacheBuster() + ] + }); + + await assetpack.run(); + + const originalPath = joinSafe('.testInput', testName, 'ttf.ttf'); + + const buffer = readFileSync(originalPath); + + const hash = crc32(buffer); + + expect(existsSync(joinSafe('.testOutput', testName, `ttf-${hash}.ttf`))).toBe(true); + }); +}); diff --git a/packages/cache-buster/test/resources/Roboto-Regular.otf b/packages/cache-buster/test/resources/Roboto-Regular.otf new file mode 100644 index 0000000..8d5da0c Binary files /dev/null and b/packages/cache-buster/test/resources/Roboto-Regular.otf differ diff --git a/packages/cache-buster/test/resources/Roboto-Regular.svg b/packages/cache-buster/test/resources/Roboto-Regular.svg new file mode 100644 index 0000000..cd131cb --- /dev/null +++ b/packages/cache-buster/test/resources/Roboto-Regular.svg @@ -0,0 +1,899 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/cache-buster/test/resources/Roboto-Regular.ttf b/packages/cache-buster/test/resources/Roboto-Regular.ttf new file mode 100644 index 0000000..2b6392f Binary files /dev/null and b/packages/cache-buster/test/resources/Roboto-Regular.ttf differ diff --git a/packages/cache-buster/tsconfig.json b/packages/cache-buster/tsconfig.json new file mode 100644 index 0000000..2c8a456 --- /dev/null +++ b/packages/cache-buster/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*", "types/**/*", "test/**/*"], + +}