Fixup import.meta in OxiPNG
This commit is contained in:

committed by
Ingvar Stepanyan

parent
47f9d22dd8
commit
82fadac70e
@ -10,6 +10,7 @@ echo "============================================="
|
||||
rm -rf pkg,{-parallel}
|
||||
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
|
||||
sed -i "s|input = import.meta.url.replace(/\\\.js$/, '_bg.wasm');||" pkg{,-parallel}/oxipng.js
|
||||
rm pkg{,-parallel}/.gitignore
|
||||
)
|
||||
echo "============================================="
|
||||
|
@ -138,7 +138,7 @@ async function load(module, imports, maybe_memory) {
|
||||
|
||||
async function init(input, maybe_memory) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
|
||||
}
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
|
@ -94,7 +94,7 @@ async function load(module, imports) {
|
||||
|
||||
async function init(input) {
|
||||
if (typeof input === 'undefined') {
|
||||
input = import.meta.url.replace(/\.js$/, '_bg.wasm');
|
||||
|
||||
}
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
|
@ -17,9 +17,9 @@ async function startMainThread() {
|
||||
const num = navigator.hardwareConcurrency;
|
||||
const workers = Array.from({ length: num }, () => new Worker('./worker', { type: 'module' }));
|
||||
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)));
|
||||
start_main_thread(num);
|
||||
start_main_thread();
|
||||
return {
|
||||
optimise,
|
||||
};
|
||||
|
Reference in New Issue
Block a user