Skip to content

Commit

Permalink
refactor: update module exports for totp-wasm package
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed Mar 4, 2024
1 parent 4b0402d commit 8f6dc5f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
6 changes: 2 additions & 4 deletions packages/totp-wasm/deno/mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export { hotp, totp, steam_guard } from '../dist/totp_wasm.js'
import * as totp from '../dist/totp_wasm.js'
import data from '../dist/wasm_data.js'
export const init = totp.default
export const wasm_data = data
export { wasm_data } from '../dist/wasm_data.js'
export { default as init } from '../dist/totp_wasm.js'
1 change: 1 addition & 0 deletions packages/totp-wasm/dist/wasm_data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const wasm_data: string
2 changes: 1 addition & 1 deletion packages/totp-wasm/dist/wasm_data.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/totp-wasm/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { hotp, totp, steam_guard } from './dist/totp_wasm'
import * as totp from './dist/totp_wasm'
export const init = totp.default
export { default as init } from './dist/totp_wasm'
export { wasm_data } from './dist/wasm_data'
6 changes: 2 additions & 4 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ execSync(

const wasm_file = `${out_dir}/totp_wasm_bg.wasm`
const wasm_data = readFileSync(wasm_file).toString('base64')
const deno_loader = `// @ts-nocheck
export default "${wasm_data}";
`
writeFileSync(`${out_dir}/wasm_data.js`, deno_loader)
writeFileSync(`${out_dir}/wasm_data.js`, "// @ts-nocheck\nexport const wasm_data = \"" + wasm_data + "\";\n")
writeFileSync(`${out_dir}/wasm_data.d.ts`, "export const wasm_data: string\n")

0 comments on commit 8f6dc5f

Please sign in to comment.