@farmfe/plugin-wasm 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +9 -9
  2. package/package.json +10 -10
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @farmfe/plugin-wasm
2
2
 
3
- A farm plugin which imports Wasm modules.
3
+ A farm plugin for importing Wasm modules.
4
4
 
5
5
  ## Installation
6
6
 
@@ -24,19 +24,19 @@ export default defineConfig({
24
24
 
25
25
  ## WebAssembly
26
26
 
27
- 预编译的 `.wasm` 文件可以通过`?init`来导入。 默认导出一个初始化函数,返回值为所导出 [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) 实例对象的 Promise:
27
+ Pre-compiled `.wasm` files can be imported using the `?init` query. The default export is an initialization function, which returns a Promise resolving to a [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) object:
28
28
 
29
29
  ```ts
30
- import init from './example.wasm?init'
30
+ import init from './example.wasm?init';
31
31
  init().then((instance) => {
32
- instance.exports.test()
33
- })
32
+ instance.exports.test();
33
+ });
34
34
  ```
35
35
 
36
- `init` 函数还可以将传递给 [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) 的导入对象作为其第二个参数:
36
+ The `init` function can also take an import object as its second parameter, which is passed to [`WebAssembly.Instance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance):
37
37
 
38
38
  ```ts
39
- import init from './example.wasm?init'
39
+ import init from './example.wasm?init';
40
40
  init({
41
41
  imports: {
42
42
  someFunc: () => {
@@ -45,7 +45,7 @@ init({
45
45
  },
46
46
  }).then(() => {
47
47
  /* ... */
48
- })
48
+ });
49
49
  ```
50
50
 
51
- 在生产构建当中,体积小于 assetInlineLimit 的 .wasm 文件将会被内联为 base64 字符串。否则,它们将被视为 静态资源 ,并按需获取。
51
+ In production builds, `.wasm` files smaller than the `assetInlineLimit` will be inlined as base64 strings. Otherwise, they will be treated as static assets and fetched on demand.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmfe/plugin-wasm",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "main": "scripts/index.js",
5
5
  "types": "scripts/index.d.ts",
6
6
  "type": "module",
@@ -36,15 +36,15 @@
36
36
  "options.d.ts"
37
37
  ],
38
38
  "optionalDependencies": {
39
- "farmfe-plugin-wasm-darwin-arm64": "0.0.2",
40
- "farmfe-plugin-wasm-darwin-x64": "0.0.2",
41
- "farmfe-plugin-wasm-linux-arm64-gnu": "0.0.2",
42
- "farmfe-plugin-wasm-linux-arm64-musl": "0.0.2",
43
- "farmfe-plugin-wasm-linux-x64-gnu": "0.0.2",
44
- "farmfe-plugin-wasm-linux-x64-musl": "0.0.2",
45
- "farmfe-plugin-wasm-win32-arm64-msvc": "0.0.2",
46
- "farmfe-plugin-wasm-win32-ia32-msvc": "0.0.2",
47
- "farmfe-plugin-wasm-win32-x64-msvc": "0.0.2"
39
+ "farmfe-plugin-wasm-darwin-arm64": "0.0.3",
40
+ "farmfe-plugin-wasm-darwin-x64": "0.0.3",
41
+ "farmfe-plugin-wasm-linux-arm64-gnu": "0.0.3",
42
+ "farmfe-plugin-wasm-linux-arm64-musl": "0.0.3",
43
+ "farmfe-plugin-wasm-linux-x64-gnu": "0.0.3",
44
+ "farmfe-plugin-wasm-linux-x64-musl": "0.0.3",
45
+ "farmfe-plugin-wasm-win32-arm64-msvc": "0.0.3",
46
+ "farmfe-plugin-wasm-win32-ia32-msvc": "0.0.3",
47
+ "farmfe-plugin-wasm-win32-x64-msvc": "0.0.3"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "cargo watch -w src -s 'scripts/watch.sh'",