diff --git a/src/handlers/handlers.ts b/src/handlers/handlers.ts index 0c19dc3..0f65d56 100644 --- a/src/handlers/handlers.ts +++ b/src/handlers/handlers.ts @@ -149,9 +149,7 @@ export const extract: Handler = { export const rotate: Handler = { args: [VArg], apply: (context, pipe, angel) => { - return pipe.rotate(angel, { - background: context.background, - }); + return pipe.rotate(angel, { background: context.background }); }, }; @@ -196,13 +194,10 @@ export const blur: Handler = { }; // https://sharp.pixelplumbing.com/api-operation#flatten -// TODO: Support background export const flatten: Handler = { args: [VArg, VArg, VArg], apply: (context, pipe) => { - return pipe.flatten({ - background: context.background, - }); + return pipe.flatten({ background: context.background }); }, }; diff --git a/src/handlers/utils.ts b/src/handlers/utils.ts index 7b53af8..574c715 100644 --- a/src/handlers/utils.ts +++ b/src/handlers/utils.ts @@ -16,6 +16,7 @@ export function VArg(argument: string) { } catch { // ignore parsing errors } + return argument; } export function parseArgs( diff --git a/src/ipx.ts b/src/ipx.ts index 9e7b6a3..d6f3372 100644 --- a/src/ipx.ts +++ b/src/ipx.ts @@ -345,9 +345,12 @@ export function createIPX(userOptions: IPXOptions): IPX { })) .filter((h) => h.handler) .sort((a, b) => { - const aKey = (a.handler.order || a.name || "").toString(); - const bKey = (b.handler.order || b.name || "").toString(); - return aKey.localeCompare(bKey); + const aOrder = + typeof a.handler.order === "number" ? a.handler.order : Infinity; + const bOrder = + typeof b.handler.order === "number" ? b.handler.order : Infinity; + if (aOrder !== bOrder) return aOrder - bOrder; + return (a.name || "").localeCompare(b.name || ""); }); // Apply handlers