Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/handlers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
},
};

Expand Down Expand Up @@ -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 });
},
};

Expand Down
1 change: 1 addition & 0 deletions src/handlers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function VArg(argument: string) {
} catch {
// ignore parsing errors
}
return argument;
}

export function parseArgs(
Expand Down
9 changes: 6 additions & 3 deletions src/ipx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down