Fries
548ef52ab7
i changed the api to not have a global wasm instance anymore. now initWasm returns a WASM instance you have to pass down to the functions. i feel like this is the best as it means you wont deal with a race condition if you're messing with it more then once at the same time, like i'm doing with tests. i also accounted for the height given as that was the original calculation that the Blurhash C implmentation used, not width * width, width * height.
36 lines
885 B
JavaScript
36 lines
885 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/blurhash-c-wasm.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/blurhash-c-wasm.ts"),
|
|
output: [
|
|
{
|
|
name: "blurhash-c-wasm",
|
|
entryFileNames: "blurhash-c-wasm.cjs",
|
|
dir: "dist",
|
|
format: "cjs",
|
|
sourcemap: "inline",
|
|
},
|
|
],
|
|
}),
|
|
];
|