@wllzhang/afsim-compiler 0.5.3 → 0.5.4
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.
- package/README.md +34 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -55,14 +55,46 @@ end_platform_type
|
|
|
55
55
|
### `compile(data)`
|
|
56
56
|
|
|
57
57
|
| Parameter | Type | Description |
|
|
58
|
-
|
|
58
|
+
|-----------|------|--------------|
|
|
59
59
|
| `data` | `object \| string` | Scenario definition as a JS object or JSON string |
|
|
60
60
|
| **Returns** | `string` | Compiled AFSIM DSL text |
|
|
61
61
|
| **Throws** | `Error` | On invalid input or compilation failure |
|
|
62
62
|
|
|
63
|
+
## Environments
|
|
64
|
+
|
|
65
|
+
| Environment | Support |
|
|
66
|
+
|-------------|---------|
|
|
67
|
+
| **Browser** | Via Vite / webpack + wasm plugin (recommended) |
|
|
68
|
+
| **Node.js** | Via bundler (e.g. esbuild) — direct ESM import of `.wasm` is not supported |
|
|
69
|
+
|
|
70
|
+
### Browser (Vite / webpack)
|
|
71
|
+
|
|
72
|
+
This package ships a **bundler**-targeted WebAssembly build. When using in a browser project, you need a WASM plugin to handle the `.wasm` import:
|
|
73
|
+
|
|
74
|
+
**Vite:**
|
|
75
|
+
```bash
|
|
76
|
+
npm install vite-plugin-wasm
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
// vite.config.js
|
|
81
|
+
import wasm from 'vite-plugin-wasm';
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
plugins: [wasm()],
|
|
85
|
+
build: { target: 'esnext' },
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Webpack:** use `experiments.asyncWebAssembly: true` or a wasm loader.
|
|
90
|
+
|
|
91
|
+
### Node.js
|
|
92
|
+
|
|
93
|
+
For Node.js scripts, bundle your code with a tool like [esbuild](https://esbuild.github.io/) that can resolve the `.wasm` import.
|
|
94
|
+
|
|
63
95
|
## Platforms
|
|
64
96
|
|
|
65
|
-
Works everywhere: **browsers** (Chrome, Firefox, Safari, Edge), **Node.js** (v18+)
|
|
97
|
+
Works everywhere: **browsers** (Chrome, Firefox, Safari, Edge), **Node.js** (v18+). No architecture-specific packages — one build fits all.
|
|
66
98
|
|
|
67
99
|
## License
|
|
68
100
|
|