Skip to content

Commit

Permalink
fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
KentarouTakeda committed Nov 1, 2022
1 parent f14073a commit 309ab23
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/libs.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dirname } from 'path';
import { strip } from 'png-strip-chunks';
import { optimize, OptimizedSvg } from 'svgo';
import { optimize } from 'svgo';
import type { config as ClassConfig } from './PlantUMLServer';

export const replaceCodeBlock = (markdown: string): string =>
Expand Down Expand Up @@ -59,17 +59,8 @@ export const optimizeImage = async (
throw new Error(`plantuml-server: invalid format "${format}"`);
};

const isOptimizedSvg = (optimized: any): optimized is OptimizedSvg => {
return (
optimized && optimized.error == null && typeof optimized.data === 'string'
);
};

export const optimizeSvg = async (src: Buffer): Promise<Buffer> => {
const optimized = optimize(src.toString());
if (!isOptimizedSvg(optimized)) {
throw optimized;
}
return Buffer.from(optimized.data);
};

Expand Down

0 comments on commit 309ab23

Please sign in to comment.