forked from external-repos/squoosh
fixup
This commit is contained in:
@@ -10,6 +10,7 @@ echo "============================================="
|
|||||||
rm -rf pkg,{-parallel}
|
rm -rf pkg,{-parallel}
|
||||||
wasm-pack build -t web
|
wasm-pack build -t web
|
||||||
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel
|
||||||
|
sed -i "s|input = import.meta.url.replace(/\\\.js$/, '_bg.wasm');||" pkg{,-parallel}/oxipng.js
|
||||||
rm pkg{,-parallel}/.gitignore
|
rm pkg{,-parallel}/.gitignore
|
||||||
)
|
)
|
||||||
echo "============================================="
|
echo "============================================="
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ async function load(module, imports, maybe_memory) {
|
|||||||
|
|
||||||
async function init(input, maybe_memory) {
|
async function init(input, maybe_memory) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports.wbg = {};
|
imports.wbg = {};
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ async function load(module, imports) {
|
|||||||
|
|
||||||
async function init(input) {
|
async function init(input) {
|
||||||
if (typeof input === 'undefined') {
|
if (typeof input === 'undefined') {
|
||||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
|
||||||
}
|
}
|
||||||
const imports = {};
|
const imports = {};
|
||||||
imports.wbg = {};
|
imports.wbg = {};
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ async function startMainThread() {
|
|||||||
const num = navigator.hardwareConcurrency;
|
const num = navigator.hardwareConcurrency;
|
||||||
const workers = Array.from({ length: num }, () => new Worker('./worker', { type: 'module' }));
|
const workers = Array.from({ length: num }, () => new Worker('./worker', { type: 'module' }));
|
||||||
await initOxiPNG(fetch(wasmUrl), undefined as any);
|
await initOxiPNG(fetch(wasmUrl), undefined as any);
|
||||||
const workerInit: WorkerInit = worker_initializer();
|
const workerInit: WorkerInit = worker_initializer(num);
|
||||||
await Promise.all(workers.map(worker => initWorker(worker, workerInit)));
|
await Promise.all(workers.map(worker => initWorker(worker, workerInit)));
|
||||||
start_main_thread(num);
|
start_main_thread();
|
||||||
return {
|
return {
|
||||||
optimise,
|
optimise,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user