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 CHANGED
@@ -61,15 +61,15 @@ console.log(run("let a = 1\n"));
61
61
 
62
62
  ## `run(src)`
63
63
 
64
- Returns the program's final top-level bindings, rendered exactly like
65
- `code run`'s stdout (`name = value`, one per line, JSON-shaped values)
66
- or `"error: ..."` on any failure (parse error, undefined variable, a
67
- failed `assert`, …). There is no structured result type; parse the string
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("let a = 5\nlet b = \"hi\"\nassert a = 5\n");
72
- // 'a = 5\nb = "hi"\n'
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 { "_class": "Double", "value": 21 } to m get n\n' +
108
+ 'emit Double { _class = "Double", value = 21 } to m get n\n' +
109
109
  "assert n.value = 42\n",
110
110
  modules,
111
111
  );
@@ -2,10 +2,10 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  /**
5
- * Runs `src` and returns either the bindings dump (matching `code run`'s
6
- * stdout exactly, via the same `format_bindings`) or `"error: ..."` a
7
- * single string return keeps the JS side trivial for now. No module
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 either the bindings dump (matching `code run`'s
5
- * stdout exactly, via the same `format_bindings`) or `"error: ..."` a
6
- * single string return keeps the JS side trivial for now. No module
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
  */
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-wasm",
3
- "version": "1.0.0",
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",