* omg it’s compiling

* example actually works

* Expose compression level options

* Disable crypto and path module emulation in webpack

* Update README

* Remove small image

* Use -O3 on optipng

* Free memory after copy

* Handle unexpected file reader return types

* Rename level label to effort
This commit is contained in:
Surma
2018-09-04 16:49:45 +01:00
committed by Jake Archibald
parent 170d75482e
commit 54ad30a7ed
19 changed files with 1832 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ import { h, Component } from 'preact';
import * as style from './style.scss';
import { bind } from '../../lib/util';
import { cleanSet, cleanMerge } from '../../lib/clean-modify';
import OptiPNGEncoderOptions from '../../codecs/optipng/options';
import MozJpegEncoderOptions from '../../codecs/mozjpeg/options';
import BrowserJPEGEncoderOptions from '../../codecs/browser-jpeg/options';
import WebPEncoderOptions from '../../codecs/webp/options';
@@ -11,6 +12,7 @@ import BrowserWebPEncoderOptions from '../../codecs/browser-webp/options';
import QuantizerOptionsComponent from '../../codecs/imagequant/options';
import * as identity from '../../codecs/identity/encoder';
import * as optiPNG from '../../codecs/optipng/encoder';
import * as mozJPEG from '../../codecs/mozjpeg/encoder';
import * as webP from '../../codecs/webp/encoder';
import * as browserPNG from '../../codecs/browser-png/encoder';
@@ -35,6 +37,7 @@ import { PreprocessorState } from '../../codecs/preprocessors';
const encoderOptionsComponentMap = {
[identity.type]: undefined,
[optiPNG.type]: OptiPNGEncoderOptions,
[mozJPEG.type]: MozJpegEncoderOptions,
[webP.type]: WebPEncoderOptions,
[browserPNG.type]: undefined,
@@ -143,7 +146,7 @@ export default class Options extends Component<Props, State> {
options={
// Casting options, as encoderOptionsComponentMap[encodeData.type] ensures the correct
// type, but typescript isn't smart enough.
encoderState.options as typeof EncoderOptionComponent['prototype']['props']['options']
encoderState.options as any
}
onChange={onEncoderOptionsChange}
/>