Comparing version
{ | ||
"name": "unwasm", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "WebAssembly tools for JavaScript", | ||
@@ -51,34 +51,30 @@ "repository": "unjs/unwasm", | ||
"dependencies": { | ||
"magic-string": "^0.30.5", | ||
"mlly": "^1.5.0", | ||
"knitwork": "^1.0.0", | ||
"magic-string": "^0.30.8", | ||
"mlly": "^1.6.1", | ||
"pathe": "^1.1.2", | ||
"pkg-types": "^1.0.3", | ||
"unplugin": "^1.6.0" | ||
"unplugin": "^1.9.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@types/node": "^20.11.4", | ||
"@vitest/coverage-v8": "^1.2.0", | ||
"@webassemblyjs/wasm-parser": "^1.11.6", | ||
"assemblyscript": "^0.27.23", | ||
"@types/node": "^20.11.26", | ||
"@vitest/coverage-v8": "^1.3.1", | ||
"@webassemblyjs/wasm-parser": "^1.12.1", | ||
"assemblyscript": "^0.27.25", | ||
"automd": "^0.3.6", | ||
"changelogen": "^0.5.5", | ||
"esbuild": "^0.19.11", | ||
"eslint": "^8.56.0", | ||
"esbuild": "^0.20.1", | ||
"eslint": "^8.57.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
"jiti": "^1.21.0", | ||
"miniflare": "^3.20231218.1", | ||
"prettier": "^3.2.2", | ||
"rollup": "^4.9.5", | ||
"typescript": "^5.3.3", | ||
"miniflare": "^3.20240304.1", | ||
"prettier": "^3.2.5", | ||
"rollup": "^4.13.0", | ||
"typescript": "^5.4.2", | ||
"unbuild": "^2.0.0", | ||
"vite": "^5.0.11", | ||
"vitest": "^1.2.0" | ||
"vite": "^5.1.6", | ||
"vitest": "^1.3.1" | ||
}, | ||
"packageManager": "pnpm@8.14.1", | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"@webassemblyjs/helper-wasm-bytecode@1.11.6": "patches/@webassemblyjs__helper-wasm-bytecode@1.11.6.patch", | ||
"@webassemblyjs/leb128@1.11.6": "patches/@webassemblyjs__leb128@1.11.6.patch" | ||
} | ||
} | ||
"packageManager": "pnpm@8.15.4" | ||
} |
@@ -1,7 +0,11 @@ | ||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
# unwasm | ||
<!-- automd:badges color=yellow codecov --> | ||
[](https://npmjs.com/package/unwasm) | ||
[](https://npmjs.com/package/unwasm) | ||
[](https://codecov.io/gh/unjs/unwasm) | ||
<!-- /automd --> | ||
Universal [WebAssembly](https://webassembly.org/) tools for JavaScript. | ||
@@ -13,19 +17,2 @@ | ||
## Roadmap | ||
The development will be split into multiple stages. | ||
> [!IMPORTANT] | ||
> This Project is under development! See the linked discussions to be involved! | ||
- [ ] Builder plugin powered by [unjs/unplugin](https://github.com/unjs/unplugin) ([unjs/unwasm#2](https://github.com/unjs/unwasm/issues/2)) | ||
- [x] Rollup | ||
- [ ] Build Tools ([unjs/unwasm#3](https://github.com/unjs/unwasm/issues/3)) | ||
- [x] `parseWasm` | ||
- [ ] Runtime Utils ([unjs/unwasm#4](https://github.com/unjs/unwasm/issues/4)) | ||
- [ ] ESM Loader ([unjs/unwasm#5](https://github.com/unjs/unwasm/issues/5)) | ||
- [ ] Integration with [Wasmer](https://github.com/wasmerio) ([unjs/unwasm#6](https://github.com/unjs/unwasm/issues/6)) | ||
- [ ] Convention for library authors exporting wasm modules ([unjs/unwasm#7](https://github.com/unjs/unwasm/issues/7)) | ||
- [x] Auto resolve imports from the imports map | ||
## Bindings API | ||
@@ -80,2 +67,14 @@ | ||
### Module compatibility | ||
There are situations where libraries require a [`WebAssembly.Module`](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Module) instance to initialize [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Instance/Instance) themselves. In order to maximize compatibility, unwasm allows a specific import suffix `?module` to import `.wasm` files as a Module directly. | ||
```js | ||
import _sumMod from "unwasm/examples/sum.wasm?module"; | ||
const { sum } = await WebAssembly.instantiate(_sumMod).then((i) => i.exports); | ||
``` | ||
> [!NOTE] | ||
> Open [an issue](https://github.com/unjs/unwasm/issues/new/choose) to us! We would love to help those libraries to migrate! | ||
## Integration | ||
@@ -89,16 +88,23 @@ | ||
<!-- automd:pm-install --> | ||
```sh | ||
# ✨ Auto-detect | ||
npx nypm install unwasm | ||
# npm | ||
npm install --dev unwasm | ||
npm install unwasm | ||
# yarn | ||
yarn add -D unwasm | ||
yarn add unwasm | ||
# pnpm | ||
pnpm i -D unwasm | ||
pnpm install unwasm | ||
# bun | ||
bun i -D unwasm | ||
bun install unwasm | ||
``` | ||
<!-- /automd --> | ||
### Builder Plugins | ||
@@ -197,4 +203,7 @@ | ||
## Development | ||
## Contribution | ||
<details> | ||
<summary>Local development</summary> | ||
- Clone this repository | ||
@@ -204,18 +213,27 @@ - Install the latest LTS version of [Node.js](https://nodejs.org/en/) | ||
- Install dependencies using `pnpm install` | ||
- Run interactive tests using `pnpm dev` | ||
- Optionally install [es6-string-html](https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html) extension to make it easier to work with string templates. | ||
- Run tests using `pnpm dev` or `pnpm test` | ||
</details> | ||
<!-- /automd --> | ||
## License | ||
Made with 💛 | ||
<!-- automd:contributors license=MIT author="pi0" --> | ||
Published under [MIT License](./LICENSE). | ||
Published under the [MIT](https://github.com/unjs/unwasm/blob/main/LICENSE) license. | ||
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/unwasm/graphs/contributors) 💛 | ||
<br><br> | ||
<a href="https://github.com/unjs/unwasm/graphs/contributors"> | ||
<img src="https://contrib.rocks/image?repo=unjs/unwasm" /> | ||
</a> | ||
<!-- Badges --> | ||
<!-- /automd --> | ||
[npm-version-src]: https://img.shields.io/npm/v/unwasm?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-version-href]: https://npmjs.com/package/unwasm | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/unwasm?style=flat&colorA=18181B&colorB=F0DB4F | ||
[npm-downloads-href]: https://npmjs.com/package/unwasm | ||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/unwasm/main?style=flat&colorA=18181B&colorB=F0DB4F | ||
[codecov-href]: https://codecov.io/gh/unjs/unwasm | ||
<!-- automd:with-automd --> | ||
--- | ||
_🤖 auto updated with [automd](https://automd.unjs.io)_ | ||
<!-- /automd --> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
512958
0.06%13721
0.15%235
8.29%6
20%18
5.88%+ Added
+ Added
Updated
Updated
Updated