@thi.ng/lispy 0.3.8 → 0.4.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-07-21T08:21:58Z
3
+ - **Last updated**: 2025-07-29T09:14:04Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -11,6 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ ## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/lispy@0.4.0) (2025-07-29)
15
+
16
+ #### 🚀 Features
17
+
18
+ - add syntax opts arg for `evalSource()` ([1a44c23](https://github.com/thi-ng/umbrella/commit/1a44c23))
19
+ - add JSON parse/stringify builtins ([dda16d6](https://github.com/thi-ng/umbrella/commit/dda16d6))
20
+
14
21
  ## [0.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/lispy@0.3.0) (2025-05-28)
15
22
 
16
23
  #### 🚀 Features
package/README.md CHANGED
@@ -221,7 +221,7 @@ For Node.js REPL:
221
221
  const lispy = await import("@thi.ng/lispy");
222
222
  ```
223
223
 
224
- Package sizes (brotli'd, pre-treeshake): ESM: 1.96 KB
224
+ Package sizes (brotli'd, pre-treeshake): ESM: 1.99 KB
225
225
 
226
226
  ## Dependencies
227
227
 
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ASTNode } from "@thi.ng/sexpr";
1
+ import type { ASTNode, SyntaxOpts } from "@thi.ng/sexpr";
2
2
  export type Env = Record<string, any>;
3
3
  /**
4
4
  * DSL built-ins as multi-method which directly operates on AST nodes. For
@@ -14,12 +14,14 @@ export declare const BUILTINS: import("@thi.ng/defmulti").MultiFn2<ASTNode[], En
14
14
  export declare const ENV: Env;
15
15
  /**
16
16
  * Parses & evaluates given S-expression(s) and returns result of last one. If
17
- * no environment is provided, uses {@link ENV}.
17
+ * no environment is provided, uses {@link ENV}. Furthermore, `opts` can be used
18
+ * to customize the syntax rules for parsing.
18
19
  *
19
20
  * @param src
20
21
  * @param env
22
+ * @param opts
21
23
  */
22
- export declare const evalSource: (src: string, env?: Env) => any;
24
+ export declare const evalSource: (src: string, env?: Env, opts?: Partial<SyntaxOpts>) => any;
23
25
  export declare const evalArgs: (nodes: ASTNode[], env?: Env) => any[];
24
26
  export declare const interpret: import("@thi.ng/defmulti").MultiFn2<ASTNode, Env, any>;
25
27
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { identity, always, never } from "@thi.ng/api/fn";
1
+ import { always, identity, never } from "@thi.ng/api/fn";
2
2
  import { isFunction } from "@thi.ng/checks/is-function";
3
3
  import { OPERATORS } from "@thi.ng/compare/ops";
4
4
  import { DEFAULT, defmulti } from "@thi.ng/defmulti";
@@ -265,10 +265,16 @@ const ENV = {
265
265
  never,
266
266
  int: parseInt,
267
267
  float: parseFloat,
268
+ //json
269
+ "json-parse": JSON.parse,
270
+ "json-str": JSON.stringify,
268
271
  // misc
269
272
  print: console.log
270
273
  };
271
- const evalSource = (src, env = ENV) => parse(src).children.reduce((_, x) => interpret(x, env), void 0);
274
+ const evalSource = (src, env = ENV, opts) => parse(src, opts).children.reduce(
275
+ (_, x) => interpret(x, env),
276
+ void 0
277
+ );
272
278
  const evalArgs = (nodes, env = ENV) => nodes.map((a) => interpret(a, env));
273
279
  const interpret = runtime({
274
280
  expr: (x, env) => BUILTINS(x.children, env),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/lispy",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "Lightweight, extensible, interpreted Lisp-style DSL for embedding in other projects",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -46,7 +46,7 @@
46
46
  "@thi.ng/errors": "^2.5.38",
47
47
  "@thi.ng/math": "^5.11.32",
48
48
  "@thi.ng/object-utils": "^1.2.4",
49
- "@thi.ng/sexpr": "^1.0.22",
49
+ "@thi.ng/sexpr": "^1.1.0",
50
50
  "@thi.ng/strings": "^3.9.18"
51
51
  },
52
52
  "devDependencies": {
@@ -96,5 +96,5 @@
96
96
  "status": "beta",
97
97
  "year": 2023
98
98
  },
99
- "gitHead": "11747c482773d3da03c8b7848b25a56251ccd759\n"
99
+ "gitHead": "691c2a96134ee27d2c9c6cfbec34710bda347186\n"
100
100
  }