@rust-js/runtime 0.0.1
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 +21 -0
- package/index.js +3354 -0
- package/package.json +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @rust-js/runtime
|
|
2
|
+
|
|
3
|
+
The helpers the JS rust-js writes imports: bounds checks, Rust's integer
|
|
4
|
+
arithmetic and formatting, iterators, JSON for serde, and the rest. Released
|
|
5
|
+
with the compiler, at its version, as ReScript's `@rescript/runtime` is. See
|
|
6
|
+
[ADR 0103](../docs/decisions/0103-runtime-package.md).
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
// frontend/src/form.js, as rust-js writes it
|
|
10
|
+
import { $debugStr, $parseInt } from "@rust-js/runtime";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
A module imports the helpers its code names; the package has the ones they
|
|
14
|
+
use in turn. Each is a named export, so a bundler keeps only what's used. An
|
|
15
|
+
app installs the compiler's own version: the build adapter refuses another.
|
|
16
|
+
|
|
17
|
+
`index.js` is written by the compiler, from the helpers it has:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun run runtime # ./target/debug/rust-js --runtime-module > runtime/index.js
|
|
21
|
+
```
|