code-wasm 1.0.0 → 1.1.2
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 +8 -8
- package/dist/code_wasm.d.ts +4 -4
- package/dist/code_wasm.js +4 -4
- package/dist/code_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,15 +61,15 @@ console.log(run("let a = 1\n"));
|
|
|
61
61
|
|
|
62
62
|
## `run(src)`
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
yourself if you need one.
|
|
64
|
+
Runs the program and returns `""` on success or `"error: ..."` on any
|
|
65
|
+
failure (parse error, undefined variable, a failed `assert`, …). A
|
|
66
|
+
program's observable output is whatever it emits itself through a linked
|
|
67
|
+
module — there is no bindings dump to return. There is no structured
|
|
68
|
+
result type; parse the string yourself if you need one.
|
|
69
69
|
|
|
70
70
|
```js
|
|
71
|
-
run(
|
|
72
|
-
// '
|
|
71
|
+
run('let a = 5\nassert a = 5\n');
|
|
72
|
+
// ''
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
## `run_with_modules(src, modules)`
|
|
@@ -105,7 +105,7 @@ const modules = {
|
|
|
105
105
|
|
|
106
106
|
run_with_modules(
|
|
107
107
|
'link "math" as m\n' +
|
|
108
|
-
'emit Double {
|
|
108
|
+
'emit Double { _class = "Double", value = 21 } to m get n\n' +
|
|
109
109
|
"assert n.value = 42\n",
|
|
110
110
|
modules,
|
|
111
111
|
);
|
package/dist/code_wasm.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Runs `src` and returns
|
|
6
|
-
*
|
|
7
|
-
* single string return keeps the JS side trivial
|
|
8
|
-
* support — see `run_with_modules` for that.
|
|
5
|
+
* Runs `src` and returns `""` on success or `"error: ..."` — a program's
|
|
6
|
+
* output is whatever it emits itself (through a linked module), not a dump
|
|
7
|
+
* of its final bindings. A single string return keeps the JS side trivial
|
|
8
|
+
* for now. No module support — see `run_with_modules` for that.
|
|
9
9
|
*/
|
|
10
10
|
export function run(src: string): string;
|
|
11
11
|
|
package/dist/code_wasm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* @ts-self-types="./code_wasm.d.ts" */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Runs `src` and returns
|
|
5
|
-
*
|
|
6
|
-
* single string return keeps the JS side trivial
|
|
7
|
-
* support — see `run_with_modules` for that.
|
|
4
|
+
* Runs `src` and returns `""` on success or `"error: ..."` — a program's
|
|
5
|
+
* output is whatever it emits itself (through a linked module), not a dump
|
|
6
|
+
* of its final bindings. A single string return keeps the JS side trivial
|
|
7
|
+
* for now. No module support — see `run_with_modules` for that.
|
|
8
8
|
* @param {string} src
|
|
9
9
|
* @returns {string}
|
|
10
10
|
*/
|
package/dist/code_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code-wasm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Run Code — a language with no user-defined functions, particle emission for behavior, and browser-embeddable third-party modules — in any browser or JS host. A small WASM bridge around the language's real parser and interpreter.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/code_wasm.js",
|