@thi.ng/lispy 0.3.8 → 0.4.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/CHANGELOG.md +8 -1
- package/README.md +2 -2
- package/index.d.ts +5 -3
- package/index.js +8 -2
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-07-
|
|
3
|
+
- **Last updated**: 2025-07-30T22:32:35Z
|
|
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
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 210 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -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.
|
|
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 {
|
|
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(
|
|
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
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Lightweight, extensible, interpreted Lisp-style DSL for embedding in other projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.11.
|
|
43
|
-
"@thi.ng/checks": "^3.7.
|
|
44
|
-
"@thi.ng/compare": "^2.4.
|
|
45
|
-
"@thi.ng/defmulti": "^3.0.
|
|
46
|
-
"@thi.ng/errors": "^2.5.
|
|
47
|
-
"@thi.ng/math": "^5.11.
|
|
48
|
-
"@thi.ng/object-utils": "^1.2.
|
|
49
|
-
"@thi.ng/sexpr": "^1.
|
|
50
|
-
"@thi.ng/strings": "^3.9.
|
|
42
|
+
"@thi.ng/api": "^8.11.33",
|
|
43
|
+
"@thi.ng/checks": "^3.7.13",
|
|
44
|
+
"@thi.ng/compare": "^2.4.25",
|
|
45
|
+
"@thi.ng/defmulti": "^3.0.73",
|
|
46
|
+
"@thi.ng/errors": "^2.5.39",
|
|
47
|
+
"@thi.ng/math": "^5.11.33",
|
|
48
|
+
"@thi.ng/object-utils": "^1.2.5",
|
|
49
|
+
"@thi.ng/sexpr": "^1.1.1",
|
|
50
|
+
"@thi.ng/strings": "^3.9.19"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"esbuild": "^0.25.8",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"status": "beta",
|
|
97
97
|
"year": 2023
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "1df8a3a9061257ea73ccf1ab9cdf63c81a9f519f\n"
|
|
100
100
|
}
|