forked from parcel-bundler/lightningcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwasm-node.mjs
More file actions
25 lines (20 loc) · 706 Bytes
/
wasm-node.mjs
File metadata and controls
25 lines (20 loc) · 706 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { Environment, napi } from 'napi-wasm';
import fs from 'fs';
let wasmBytes = fs.readFileSync(new URL('lightningcss_node.wasm', import.meta.url));
let wasmModule = new WebAssembly.Module(wasmBytes);
let instance = new WebAssembly.Instance(wasmModule, {
env: napi
});
let env = new Environment(instance);
let wasm = env.exports;
export default async function init() {
// do nothing. for backward compatibility.
}
export function transform(options) {
return wasm.transform(options);
}
export function transformStyleAttribute(options) {
return wasm.transformStyleAttribute(options);
}
export { browserslistToTargets } from './browserslistToTargets.js'
export { Features } from './flags.js'