[ci] format
This commit is contained in:
parent
2a7dd040e8
commit
f6d61e6e72
2 changed files with 7 additions and 10 deletions
|
@ -113,7 +113,7 @@ export async function getImage(
|
||||||
|
|
||||||
const isDev = globalThis.astroImage.command === 'dev';
|
const isDev = globalThis.astroImage.command === 'dev';
|
||||||
const isLocalImage = !isRemoteImage(resolved.src);
|
const isLocalImage = !isRemoteImage(resolved.src);
|
||||||
|
|
||||||
const _loader = isDev && isLocalImage ? globalThis.astroImage.ssrLoader : loader;
|
const _loader = isDev && isLocalImage ? globalThis.astroImage.ssrLoader : loader;
|
||||||
|
|
||||||
if (!_loader) {
|
if (!_loader) {
|
||||||
|
@ -130,8 +130,8 @@ export async function getImage(
|
||||||
}
|
}
|
||||||
|
|
||||||
const src = globalThis?.astroImage
|
const src = globalThis?.astroImage
|
||||||
? globalThis.astroImage.filenameFormat(resolved, searchParams)
|
? globalThis.astroImage.filenameFormat(resolved, searchParams)
|
||||||
: `${ROUTE_PATTERN}?${searchParams.toString()}`;
|
: `${ROUTE_PATTERN}?${searchParams.toString()}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...attributes,
|
...attributes,
|
||||||
|
|
|
@ -54,13 +54,10 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
|
||||||
// Added to globalThis to share the same map in Node and Vite
|
// Added to globalThis to share the same map in Node and Vite
|
||||||
function addStaticImage(transform: TransformOptions) {
|
function addStaticImage(transform: TransformOptions) {
|
||||||
staticImages.set(propsToFilename(transform), transform);
|
staticImages.set(propsToFilename(transform), transform);
|
||||||
};
|
}
|
||||||
|
|
||||||
// TODO: Add support for custom, user-provided filename format functions
|
// TODO: Add support for custom, user-provided filename format functions
|
||||||
function filenameFormat(
|
function filenameFormat(transform: TransformOptions, searchParams: URLSearchParams) {
|
||||||
transform: TransformOptions,
|
|
||||||
searchParams: URLSearchParams
|
|
||||||
) {
|
|
||||||
if (mode === 'ssg') {
|
if (mode === 'ssg') {
|
||||||
return isRemoteImage(transform.src)
|
return isRemoteImage(transform.src)
|
||||||
? path.join(OUTPUT_DIR, path.basename(propsToFilename(transform)))
|
? path.join(OUTPUT_DIR, path.basename(propsToFilename(transform)))
|
||||||
|
@ -72,7 +69,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
|
||||||
} else {
|
} else {
|
||||||
return `${ROUTE_PATTERN}?${searchParams.toString()}`;
|
return `${ROUTE_PATTERN}?${searchParams.toString()}`;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// Initialize the integration's globalThis namespace
|
// Initialize the integration's globalThis namespace
|
||||||
// This is needed to share scope between Node and Vite
|
// This is needed to share scope between Node and Vite
|
||||||
|
@ -82,7 +79,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration =
|
||||||
command,
|
command,
|
||||||
addStaticImage,
|
addStaticImage,
|
||||||
filenameFormat,
|
filenameFormat,
|
||||||
}
|
};
|
||||||
|
|
||||||
if (mode === 'ssr') {
|
if (mode === 'ssr') {
|
||||||
injectRoute({
|
injectRoute({
|
||||||
|
|
Loading…
Reference in a new issue