forked from external-repos/squoosh
codec-impl linking
This commit is contained in:
4
codecs/package.json
Normal file
4
codecs/package.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "codecs",
|
||||||
|
"version": "0.0.0"
|
||||||
|
}
|
||||||
1
src/codec-impl
Symbolic link
1
src/codec-impl
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../codecs
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { resize } from '../../../codecs/hqx/pkg';
|
import { resize } from '../../codec-impl/hqx/pkg';
|
||||||
import { HqxOptions } from './processor-meta';
|
import { HqxOptions } from './processor-meta';
|
||||||
|
|
||||||
export async function hqx(
|
export async function hqx(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import imagequant, { QuantizerModule } from '../../../codecs/imagequant/imagequant';
|
import imagequant, { QuantizerModule } from '../../codec-impl/imagequant/imagequant';
|
||||||
import wasmUrl from '../../../codecs/imagequant/imagequant.wasm';
|
import wasmUrl from 'url:../../codec-impl/imagequant/imagequant.wasm';
|
||||||
import { QuantizeOptions } from './processor-meta';
|
import { QuantizeOptions } from './processor-meta';
|
||||||
import { initEmscriptenModule } from '../util';
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import mozjpeg_enc, { MozJPEGModule } from '../../../codecs/mozjpeg_enc/mozjpeg_enc';
|
import mozjpeg_enc, { MozJPEGModule } from '../../codec-impl/mozjpeg_enc/mozjpeg_enc';
|
||||||
import wasmUrl from '../../../codecs/mozjpeg_enc/mozjpeg_enc.wasm';
|
// import wasmUrl from 'url:../../codecs/mozjpeg_enc/mozjpeg_enc.wasm';
|
||||||
|
import wasmUrl from 'url:../../codec-impl/mozjpeg_enc/mozjpeg_enc.wasm';
|
||||||
import { EncodeOptions } from './encoder-meta';
|
import { EncodeOptions } from './encoder-meta';
|
||||||
import { initEmscriptenModule } from '../util';
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { optimise } from '../../../codecs/oxipng/pkg';
|
import { optimise } from '../../codec-impl/oxipng/pkg';
|
||||||
import { EncodeOptions } from './encoder-meta';
|
import { EncodeOptions } from './encoder-meta';
|
||||||
|
|
||||||
export async function compress(data: ArrayBuffer, options: EncodeOptions): Promise<ArrayBuffer> {
|
export async function compress(data: ArrayBuffer, options: EncodeOptions): Promise<ArrayBuffer> {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { h, Component } from 'preact';
|
import { h, Component } from 'preact';
|
||||||
import { bind } from '../../lib/initial-util';
|
|
||||||
import { inputFieldValueAsNumber, preventDefault } from '../../lib/util';
|
import { inputFieldValueAsNumber, preventDefault } from '../../lib/util';
|
||||||
import { EncodeOptions } from './encoder-meta';
|
import { EncodeOptions } from './encoder-meta';
|
||||||
import Range from '../../components/range';
|
import Range from '../../components/range';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { proxy } from 'comlink';
|
import { proxy } from 'comlink';
|
||||||
|
import workerURL from 'bundle:./processor-worker/index.ts';
|
||||||
import { QuantizeOptions } from './imagequant/processor-meta';
|
import { QuantizeOptions } from './imagequant/processor-meta';
|
||||||
import { canvasEncode, blobToArrayBuffer } from '../lib/util';
|
import { canvasEncode, blobToArrayBuffer } from '../lib/util';
|
||||||
import { EncodeOptions as MozJPEGEncoderOptions } from './mozjpeg/encoder-meta';
|
import { EncodeOptions as MozJPEGEncoderOptions } from './mozjpeg/encoder-meta';
|
||||||
@@ -69,7 +70,8 @@ export default class Processor {
|
|||||||
// definition can't be overwritten.
|
// definition can't be overwritten.
|
||||||
this._worker = new Worker(
|
this._worker = new Worker(
|
||||||
// './processor-worker',
|
// './processor-worker',
|
||||||
new URL('./processor-worker/index.ts', import.meta.url),
|
// new URL('./processor-worker/index.ts', import.meta.url),
|
||||||
|
workerURL,
|
||||||
{ name: 'processor-worker', type: 'module' },
|
{ name: 'processor-worker', type: 'module' },
|
||||||
// { name: 'processor-worker', type: 'module' },
|
// { name: 'processor-worker', type: 'module' },
|
||||||
) as Worker;
|
) as Worker;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import wasmUrl from '../../../codecs/rotate/rotate.wasm';
|
import wasmUrl from 'url:../../codec-impl/rotate/rotate.wasm';
|
||||||
import { RotateOptions, RotateModuleInstance } from './processor-meta';
|
import { RotateOptions, RotateModuleInstance } from './processor-meta';
|
||||||
|
|
||||||
// We are loading a 500B module here. Loading the code to feature-detect
|
// We are loading a 500B module here. Loading the code to feature-detect
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import webp_dec, { WebPModule } from '../../../codecs/webp/dec/webp_dec';
|
import webp_dec, { WebPModule } from '../../codec-impl/webp/dec/webp_dec';
|
||||||
import wasmUrl from '../../../codecs/webp/dec/webp_dec.wasm';
|
import wasmUrl from 'url:../../codec-impl/webp/dec/webp_dec.wasm';
|
||||||
import { initEmscriptenModule } from '../util';
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
let emscriptenModule: Promise<WebPModule>;
|
let emscriptenModule: Promise<WebPModule>;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import webp_enc, { WebPModule } from '../../../codecs/webp/enc/webp_enc';
|
import webp_enc, { WebPModule } from '../../codec-impl/webp/enc/webp_enc';
|
||||||
import wasmUrl from '../../../codecs/webp/enc/webp_enc.wasm';
|
import wasmUrl from 'url:../../codec-impl/webp/enc/webp_enc.wasm';
|
||||||
import { EncodeOptions } from './encoder-meta';
|
import { EncodeOptions } from './encoder-meta';
|
||||||
import { initEmscriptenModule } from '../util';
|
import { initEmscriptenModule } from '../util';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user