Skip to content

Commit

Permalink
fix: export original exports if register returns 0
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Jul 22, 2022
1 parent 999ab6b commit ee5cc38
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/emnapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tybys/emnapi",
"version": "0.18.1",
"version": "0.18.2",
"description": "Node-API implementation for Emscripten",
"main": "index.js",
"devDependencies": {},
Expand Down
2 changes: 1 addition & 1 deletion packages/emnapi/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mergeInto(LibraryManager.library, {
const exports = {}
const exportsHandle = scope.add(envObject, exports)
const napiValue = _napi_register_wasm_v1(envObject.id, exportsHandle.id)
return (!napiValue) ? undefined : emnapi.handleStore.get(napiValue)!.value
return (!napiValue) ? exports : emnapi.handleStore.get(napiValue)!.value
})
} catch (err) {
emnapi.closeScope(env, scope)
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tybys/emnapi-runtime",
"version": "0.18.1",
"version": "0.18.2",
"description": "emnapi runtime",
"main": "index.js",
"module": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"transform": "@tybys/ts-transform-define",
"defines": {
"NULL": 0,
"__VERSION__": "\"0.18.1\""
"__VERSION__": "\"0.18.2\""
}
}
]
Expand Down

0 comments on commit ee5cc38

Please sign in to comment.