switched to wrangler 2.0, fixed NaN check on track id, updated compat date
This commit is contained in:
parent
0dcc61196f
commit
58884fb608
12 changed files with 475 additions and 2684 deletions
20
wasm_build.mjs
Normal file
20
wasm_build.mjs
Normal file
|
@ -0,0 +1,20 @@
|
|||
import * as fs from 'fs'
|
||||
import { execSync } from 'child_process'
|
||||
import { chdir } from 'process'
|
||||
|
||||
chdir('wasm')
|
||||
|
||||
execSync('wasm-pack build -t nodejs')
|
||||
|
||||
const pkg_name = JSON.parse(fs.readFileSync('pkg/package.json', 'utf8'))['name']
|
||||
|
||||
const js_path = `pkg/${pkg_name}.js`
|
||||
let loader_js = fs.readFileSync(js_path, 'utf8')
|
||||
|
||||
loader_js = `import wasmModule from './${pkg_name}_bg.wasm'\n\n` + loader_js
|
||||
loader_js = loader_js.replace('const { TextDecoder, TextEncoder } = require(String.raw`util`);\n', '')
|
||||
loader_js = loader_js.replace(`const path = require('path').join(__dirname, '${pkg_name}_bg.wasm');\n`, '')
|
||||
loader_js = loader_js.replace("const bytes = require('fs').readFileSync(path);\n\n", '')
|
||||
loader_js = loader_js.replace('const wasmModule = new WebAssembly.Module(bytes);\n', '')
|
||||
|
||||
fs.writeFileSync(js_path, loader_js)
|
Loading…
Add table
Add a link
Reference in a new issue