[ci] format
This commit is contained in:
parent
6b1e798146
commit
7a91600a9e
2 changed files with 28 additions and 13 deletions
|
@ -155,9 +155,7 @@ export async function generateImage(
|
|||
};
|
||||
}
|
||||
|
||||
export function getStaticImageList(): Map<
|
||||
string, { path: string; options: ImageTransform }
|
||||
> {
|
||||
export function getStaticImageList(): Map<string, { path: string; options: ImageTransform }> {
|
||||
if (!globalThis?.astroAsset?.staticImages) {
|
||||
return new Map();
|
||||
}
|
||||
|
|
|
@ -196,12 +196,20 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn
|
|||
}
|
||||
}
|
||||
|
||||
const staticImageList = getStaticImageList()
|
||||
const staticImageList = getStaticImageList();
|
||||
|
||||
if (staticImageList.size) logger.info(null, `\n${bgGreen(black(` generating optimized images `))}`); let count = 0;
|
||||
if (staticImageList.size)
|
||||
logger.info(null, `\n${bgGreen(black(` generating optimized images `))}`);
|
||||
let count = 0;
|
||||
for (const imageData of staticImageList.entries()) {
|
||||
count++
|
||||
await generateImage(pipeline, imageData[1].options, imageData[1].path, count, staticImageList.size);
|
||||
count++;
|
||||
await generateImage(
|
||||
pipeline,
|
||||
imageData[1].options,
|
||||
imageData[1].path,
|
||||
count,
|
||||
staticImageList.size
|
||||
);
|
||||
}
|
||||
|
||||
delete globalThis?.astroAsset?.addStaticImage;
|
||||
|
@ -214,7 +222,13 @@ export async function generatePages(opts: StaticBuildOptions, internals: BuildIn
|
|||
logger.info(null, dim(`Completed in ${getTimeStat(timer, performance.now())}.\n`));
|
||||
}
|
||||
|
||||
async function generateImage(pipeline: BuildPipeline, transform: ImageTransform, path: string, count: number, totalCount: number) {
|
||||
async function generateImage(
|
||||
pipeline: BuildPipeline,
|
||||
transform: ImageTransform,
|
||||
path: string,
|
||||
count: number,
|
||||
totalCount: number
|
||||
) {
|
||||
const logger = pipeline.getLogger();
|
||||
let timeStart = performance.now();
|
||||
const generationData = await generateImageInternal(pipeline, transform, path);
|
||||
|
@ -230,7 +244,10 @@ async function generateImage(pipeline: BuildPipeline, transform: ImageTransform,
|
|||
? `(reused cache entry)`
|
||||
: `(before: ${generationData.weight.before}kB, after: ${generationData.weight.after}kB)`;
|
||||
const counter = `(${count}/${totalCount})`;
|
||||
logger.info(null, ` ${green('▶')} ${path} ${dim(statsText)} ${dim(timeIncrease)} ${dim(counter)}}`);
|
||||
logger.info(
|
||||
null,
|
||||
` ${green('▶')} ${path} ${dim(statsText)} ${dim(timeIncrease)} ${dim(counter)}}`
|
||||
);
|
||||
}
|
||||
|
||||
async function generatePage(
|
||||
|
|
Loading…
Reference in a new issue