Skip to content

Commit

Permalink
fix global runtime namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Feb 9, 2022
1 parent a9442cc commit fb1fc7e
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "0.10.1",
"version": "0.10.2",
"scripts": {
"fetch": "node ./script/install",
"build": "cd ./packages/runtime&&npm run build&&cd ../emnapi&&npm run build",
Expand Down
2 changes: 1 addition & 1 deletion packages/emnapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Most APIs are implemented in JavaScript and they are depend on runtime code ship
<script src="node_modules/@tybys/emnapi-runtime/dist/emnapi.min.js"></script>
<script>
var Module = { /* ... */ };
Module.emnapiRuntime = emnapi;
Module.emnapiRuntime = window.__emnapi_runtime__;
</script>
<script src="your-wasm-glue.js"></script>
```
Expand Down
2 changes: 1 addition & 1 deletion packages/emnapi/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ cmake --build build
<script src="node_modules/@tybys/emnapi-runtime/dist/emnapi.min.js"></script>
<script>
var Module = { /* ... */ };
Module.emnapiRuntime = emnapi;
Module.emnapiRuntime = window.__emnapi_runtime__;
</script>
<script src="your-wasm-glue.js"></script>
```
Expand Down
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.10.1",
"version": "0.10.2",
"description": "Node-API implementation for Emscripten",
"main": "index.js",
"devDependencies": {},
Expand Down
2 changes: 1 addition & 1 deletion packages/emnapi/script/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function build () {
}
return g;
})().emnapi;
})().__emnapi_runtime__;
}
if (!emnapi) {
var err = new Error('Emnapi runtime is not detected. Check if the runtime code is imported or consider using builtin runtime js library.');
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See [/~https://github.com/toyobayashi/emnapi](/~https://github.com/toyobayashi/emnapi)
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.10.1",
"version": "0.10.2",
"description": "emnapi runtime",
"main": "index.js",
"module": "./lib/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime/script/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function build () {

const runtimeDts = extractorConfig.publicTrimmedFilePath

fs.appendFileSync(runtimeDts, '\nexport as namespace emnapi;\n', 'utf8')
fs.appendFileSync(runtimeDts, '\nexport as namespace __emnapi_runtime__;\n', 'utf8')

/**
* @param {boolean=} minify
Expand Down Expand Up @@ -68,7 +68,7 @@ function build () {
output: {
file: path.join(path.dirname(runtimeOut), 'emnapi.js'),
format: 'umd',
name: 'emnapi',
name: '__emnapi_runtime__',
exports: 'named'
}
},
Expand All @@ -77,7 +77,7 @@ function build () {
output: {
file: path.join(path.dirname(runtimeOut), 'emnapi.min.js'),
format: 'umd',
name: 'emnapi',
name: '__emnapi_runtime__',
exports: 'named'
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/test/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tybys/emnapi-test",
"private": true,
"version": "0.10.1",
"version": "0.0.0",
"description": "emnapi test",
"main": "index.js",
"devDependencies": {
Expand Down

0 comments on commit fb1fc7e

Please sign in to comment.