@wllzhang/afsim-compiler 0.5.3 → 0.5.6
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/index.mjs +1 -1
- package/package.json +1 -1
- package/pkg/afsim_compiler_lib.js +9 -0
- package/pkg/{afsim_compiler_bg.js → afsim_compiler_lib_bg.js} +9 -0
- package/pkg/afsim_compiler_lib_bg.wasm +0 -0
- package/pkg/package.json +7 -7
- package/pkg/afsim_compiler.js +0 -9
- package/pkg/afsim_compiler_bg.wasm +0 -0
- /package/pkg/{afsim_compiler.d.ts → afsim_compiler_lib.d.ts} +0 -0
- /package/pkg/{afsim_compiler_bg.wasm.d.ts → afsim_compiler_lib_bg.wasm.d.ts} +0 -0
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
|
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -21,6 +21,15 @@ export function compile_json(input) {
|
|
|
21
21
|
wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
export function __wbg_error_7c5f5b5154c052d7(arg0, arg1) {
|
|
25
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
26
|
+
}
|
|
27
|
+
export function __wbg_log_7d8110815355c340(arg0, arg1) {
|
|
28
|
+
console.log(getStringFromWasm0(arg0, arg1));
|
|
29
|
+
}
|
|
30
|
+
export function __wbg_warn_f2f01bad85a87234(arg0, arg1) {
|
|
31
|
+
console.warn(getStringFromWasm0(arg0, arg1));
|
|
32
|
+
}
|
|
24
33
|
let cachedDataViewMemory0 = null;
|
|
25
34
|
function getDataViewMemory0() {
|
|
26
35
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
Binary file
|
package/pkg/package.json
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
"description": "JSON to AFSIM DSL compiler",
|
|
5
5
|
"version": "0.1.0",
|
|
6
6
|
"files": [
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
7
|
+
"afsim_compiler_lib_bg.wasm",
|
|
8
|
+
"afsim_compiler_lib.js",
|
|
9
|
+
"afsim_compiler_lib_bg.js",
|
|
10
|
+
"afsim_compiler_lib.d.ts"
|
|
11
11
|
],
|
|
12
|
-
"main": "
|
|
13
|
-
"types": "
|
|
12
|
+
"main": "afsim_compiler_lib.js",
|
|
13
|
+
"types": "afsim_compiler_lib.d.ts",
|
|
14
14
|
"sideEffects": [
|
|
15
|
-
"./
|
|
15
|
+
"./afsim_compiler_lib.js",
|
|
16
16
|
"./snippets/*"
|
|
17
17
|
]
|
|
18
18
|
}
|
package/pkg/afsim_compiler.js
DELETED
|
Binary file
|
|
File without changes
|
|
File without changes
|