Fries
f7bbb92d85
the api now requires you to call an async function initWasm to make the functions work instead of using top level await. i also optimized the wasm module to have O3 and fast-math (which the original blurhash makefile had and the results do seem to be the same with the javascript blurhash). I also gave the wasm instance functions inside typescript types and i fixed a bug where i didnt free the pointers in order so if you called decode too many times, you will run out of memory.
36 lines
869 B
JavaScript
36 lines
869 B
JavaScript
import { defineConfig } from "rollup";
|
|
import path from "node:path";
|
|
import url from "node:url";
|
|
import Typescript from "@rollup/plugin-typescript";
|
|
import Wasm from "@rollup/plugin-wasm";
|
|
|
|
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
|
|
export default [
|
|
defineConfig({
|
|
plugins: [Typescript(), Wasm({ targetEnv: "auto-inline" })],
|
|
input: path.resolve(dirname, "src/library.ts"),
|
|
output: [
|
|
{
|
|
name: "blurhash-c-wasm",
|
|
entryFileNames: "blurhash-c-wasm.js",
|
|
dir: "dist",
|
|
format: "module",
|
|
sourcemap: "inline",
|
|
},
|
|
],
|
|
}),
|
|
defineConfig({
|
|
plugins: [Typescript(), Wasm({ targetEnv: "auto-inline" })],
|
|
input: path.resolve(dirname, "src/library.ts"),
|
|
output: [
|
|
{
|
|
name: "blurhash-c-wasm",
|
|
entryFileNames: "blurhash-c-wasm.cjs",
|
|
dir: "dist",
|
|
format: "cjs",
|
|
sourcemap: "inline",
|
|
},
|
|
],
|
|
}),
|
|
];
|