[ci] format

This commit is contained in:
tony-sull 2022-07-18 19:45:31 +00:00 committed by fredkbot
parent 2a7dd040e8
commit f6d61e6e72
2 changed files with 7 additions and 10 deletions

View file

@ -113,7 +113,7 @@ export async function getImage(
const isDev = globalThis.astroImage.command === 'dev';
const isLocalImage = !isRemoteImage(resolved.src);
const _loader = isDev && isLocalImage ? globalThis.astroImage.ssrLoader : loader;
if (!_loader) {
@ -130,8 +130,8 @@ export async function getImage(
}
const src = globalThis?.astroImage
? globalThis.astroImage.filenameFormat(resolved, searchParams)
: `${ROUTE_PATTERN}?${searchParams.toString()}`;
? globalThis.astroImage.filenameFormat(resolved, searchParams)
: `${ROUTE_PATTERN}?${searchParams.toString()}`;
return {
...attributes,

View file

@ -54,13 +54,10 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
// Added to globalThis to share the same map in Node and Vite
function addStaticImage(transform: TransformOptions) {
staticImages.set(propsToFilename(transform), transform);
};
}
// TODO: Add support for custom, user-provided filename format functions
function filenameFormat(
transform: TransformOptions,
searchParams: URLSearchParams
) {
function filenameFormat(transform: TransformOptions, searchParams: URLSearchParams) {
if (mode === 'ssg') {
return isRemoteImage(transform.src)
? path.join(OUTPUT_DIR, path.basename(propsToFilename(transform)))
@ -72,7 +69,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
} else {
return `${ROUTE_PATTERN}?${searchParams.toString()}`;
}
};
}
// Initialize the integration's globalThis namespace
// This is needed to share scope between Node and Vite
@ -82,7 +79,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
command,
addStaticImage,
filenameFormat,
}
};
if (mode === 'ssr') {
injectRoute({