mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 00:43:04 +00:00
29 lines
862 B
JavaScript
29 lines
862 B
JavaScript
import { relative } from 'node:path';
|
|
import { cyan, magenta, green, dim, yellow } from 'kolorist';
|
|
|
|
const version = "0.2.7";
|
|
|
|
function logWorkboxResult(strategy, buildResult, viteOptions) {
|
|
const { root, logLevel = "info" } = viteOptions;
|
|
if (logLevel === "silent")
|
|
return;
|
|
const { count, size, filePaths, warnings } = buildResult;
|
|
if (logLevel === "info") {
|
|
console.info([
|
|
"",
|
|
`${cyan(`SvelteKit VitePWA v${version}`)}`,
|
|
`mode ${magenta(strategy)}`,
|
|
`precache ${green(`${count} entries`)} ${dim(`(${(size / 1024).toFixed(2)} KiB)`)}`,
|
|
"files generated",
|
|
...filePaths.map((p) => ` ${dim(relative(root, p))}`)
|
|
].join("\n"));
|
|
}
|
|
warnings && warnings.length > 0 && console.warn(yellow([
|
|
"warnings",
|
|
...warnings.map((w) => ` ${w}`),
|
|
""
|
|
].join("\n")));
|
|
}
|
|
|
|
export { logWorkboxResult };
|