json-asty 1.2.6 → 1.3.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/.ase/service.log +14 -0
- package/.ase/service.yaml +1 -0
- package/Gruntfile.js +1 -1
- package/Makefile +1 -1
- package/README.md +1 -1
- package/eslint.yaml +1 -1
- package/lib/json-asty.browser.js +1 -1
- package/lib/json-asty.node.js +1 -1
- package/package.json +10 -7
- package/src/json-asty.cli.js +2 -2
- package/src/json-asty.d.ts +65 -4
- package/src/json-asty.js +1 -1
- package/src/json-asty.pegjs +1 -1
- package/tst/json-asty.js +1 -1
package/.ase/service.log
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
ase: [2026-07-05 00:57:58.486]: [INFO]: service: listening on port 43331
|
|
2
|
+
ase: [2026-07-05 00:57:58.556]: [INFO]: mcp: POST /mcp [initialize]
|
|
3
|
+
ase: [2026-07-05 00:57:58.571]: [INFO]: mcp: POST /mcp [notifications/initialized]
|
|
4
|
+
ase: [2026-07-05 00:57:58.574]: [INFO]: mcp: POST /mcp [tools/list]
|
|
5
|
+
ase: [2026-07-05 00:57:58.579]: [INFO]: mcp: GET /mcp
|
|
6
|
+
ase: [2026-07-05 01:03:00.593]: [INFO]: mcp: GET /mcp
|
|
7
|
+
ase: [2026-07-05 01:08:02.613]: [INFO]: mcp: GET /mcp
|
|
8
|
+
ase: [2026-07-05 01:13:04.534]: [INFO]: mcp: GET /mcp
|
|
9
|
+
ase: [2026-07-05 01:18:06.500]: [INFO]: mcp: GET /mcp
|
|
10
|
+
ase: [2026-07-05 01:23:08.474]: [INFO]: mcp: GET /mcp
|
|
11
|
+
ase: [2026-07-05 01:28:10.473]: [INFO]: mcp: GET /mcp
|
|
12
|
+
ase: [2026-07-05 01:33:12.443]: [INFO]: mcp: GET /mcp
|
|
13
|
+
ase: [2026-07-05 01:38:14.425]: [INFO]: mcp: GET /mcp
|
|
14
|
+
ase: [2026-07-05 01:43:16.411]: [INFO]: mcp: GET /mcp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
port: 43331
|
package/Gruntfile.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
package/Makefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
##
|
|
2
2
|
## JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
## Copyright (c) 2018-
|
|
3
|
+
## Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
##
|
|
5
5
|
## Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
## a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -137,7 +137,7 @@ JSON (new):
|
|
|
137
137
|
License
|
|
138
138
|
-------
|
|
139
139
|
|
|
140
|
-
Copyright © 2018-
|
|
140
|
+
Copyright © 2018-2026 Dr. Ralf S. Engelschall (http://engelschall.com/)
|
|
141
141
|
|
|
142
142
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
143
143
|
a copy of this software and associated documentation files (the
|
package/eslint.yaml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
##
|
|
2
2
|
## JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
## Copyright (c) 2018-
|
|
3
|
+
## Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
##
|
|
5
5
|
## Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
## a copy of this software and associated documentation files (the
|
package/lib/json-asty.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
package/lib/json-asty.node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-asty",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Lossless JSON-to-AST Parser and AST-to-JSON Generator",
|
|
5
5
|
"keywords": [ "json", "ast", "parse", "generate" ],
|
|
6
6
|
"browser": "lib/json-asty.browser.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"cli-io": "0.9.13"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"grunt": "1.6.
|
|
31
|
+
"grunt": "1.6.2",
|
|
32
32
|
"grunt-cli": "1.5.0",
|
|
33
33
|
"grunt-contrib-clean": "2.0.1",
|
|
34
34
|
"grunt-contrib-watch": "1.1.0",
|
|
@@ -46,11 +46,14 @@
|
|
|
46
46
|
"eslint-plugin-promise": "6.6.0",
|
|
47
47
|
"eslint-plugin-import": "2.32.0",
|
|
48
48
|
"eslint-plugin-node": "11.1.0",
|
|
49
|
-
"@babel/core": "7.
|
|
50
|
-
"@babel/preset-env": "7.
|
|
51
|
-
"@babel/plugin-transform-runtime": "7.
|
|
52
|
-
"mocha": "11.7.
|
|
53
|
-
"chai": "6.2.
|
|
49
|
+
"@babel/core": "7.29.0",
|
|
50
|
+
"@babel/preset-env": "7.29.2",
|
|
51
|
+
"@babel/plugin-transform-runtime": "7.29.0",
|
|
52
|
+
"mocha": "11.7.6",
|
|
53
|
+
"chai": "6.2.2"
|
|
54
|
+
},
|
|
55
|
+
"allowScripts": {
|
|
56
|
+
"es5-ext": true
|
|
54
57
|
},
|
|
55
58
|
"upd": [ "!chalk", "!eslint", "!grunt-eslint" ],
|
|
56
59
|
"scripts": {
|
package/src/json-asty.cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*!
|
|
3
3
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
4
|
-
** Copyright (c) 2018-
|
|
4
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
5
5
|
**
|
|
6
6
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
7
7
|
** a copy of this software and associated documentation files (the
|
|
@@ -67,7 +67,7 @@ const cli = new CLIio({
|
|
|
67
67
|
if (argv.version) {
|
|
68
68
|
process.stderr.write(my.name + " " + my.version + " <" + my.homepage + ">\n")
|
|
69
69
|
process.stderr.write(my.description + "\n")
|
|
70
|
-
process.stderr.write("Copyright (c) 2018-
|
|
70
|
+
process.stderr.write("Copyright (c) 2018-2026 " + my.author.name + " <" + my.author.url + ">\n")
|
|
71
71
|
process.stderr.write("Licensed under " + my.license + " <http://spdx.org/licenses/" + my.license + ".html>\n")
|
|
72
72
|
process.exit(0)
|
|
73
73
|
}
|
package/src/json-asty.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
|
@@ -23,15 +23,76 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
declare module "json-asty" {
|
|
26
|
+
/* the position of an AST node in the source */
|
|
27
|
+
export interface AstNodePos {
|
|
28
|
+
line: number;
|
|
29
|
+
column: number;
|
|
30
|
+
offset: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* the AST node API (as provided by the underlying "asty-astq" library) */
|
|
34
|
+
export interface AstNode {
|
|
35
|
+
/* node type management */
|
|
36
|
+
type(type: string): AstNode;
|
|
37
|
+
type(): string;
|
|
38
|
+
|
|
39
|
+
/* node merging */
|
|
40
|
+
merge(node: AstNode, takePos?: boolean, attrMap?: { [ from: string ]: string }): AstNode;
|
|
41
|
+
|
|
42
|
+
/* attribute management */
|
|
43
|
+
set(name: string, value: any): AstNode;
|
|
44
|
+
set(attrs: { [ name: string ]: any }): AstNode;
|
|
45
|
+
unset(name: string): AstNode;
|
|
46
|
+
unset(names: string[]): AstNode;
|
|
47
|
+
get(name: string): any;
|
|
48
|
+
get(names: string[]): any[];
|
|
49
|
+
attrs(): string[];
|
|
50
|
+
|
|
51
|
+
/* position management */
|
|
52
|
+
pos(line: number, column: number, offset: number): AstNode;
|
|
53
|
+
pos(): AstNodePos;
|
|
54
|
+
|
|
55
|
+
/* child node management */
|
|
56
|
+
create(type: string, attrs?: { [ name: string ]: any }, childs?: AstNode[]): AstNode;
|
|
57
|
+
add(...childs: (AstNode | AstNode[])[]): AstNode;
|
|
58
|
+
ins(pos: number, ...childs: (AstNode | AstNode[])[]): AstNode;
|
|
59
|
+
del(...childs: AstNode[]): AstNode;
|
|
60
|
+
childs(begin?: number, end?: number): AstNode[];
|
|
61
|
+
child(pos: number): AstNode;
|
|
62
|
+
nth(): number;
|
|
63
|
+
|
|
64
|
+
/* tree navigation and traversal */
|
|
65
|
+
parent(): AstNode;
|
|
66
|
+
walk(
|
|
67
|
+
callback: (node: AstNode, depth: number, parent: AstNode, when: "downward" | "upward") => void,
|
|
68
|
+
when?: "downward" | "upward" | "both"
|
|
69
|
+
): AstNode;
|
|
70
|
+
|
|
71
|
+
/* serialization */
|
|
72
|
+
dump(
|
|
73
|
+
maxDepth?: number,
|
|
74
|
+
colorize?: (type: "tree" | "type" | "value" | "position", text: string) => string,
|
|
75
|
+
unicode?: boolean
|
|
76
|
+
): string;
|
|
77
|
+
serialize(): string;
|
|
78
|
+
|
|
79
|
+
/* querying (mixed in from the underlying "astq" library) */
|
|
80
|
+
query(
|
|
81
|
+
selector: string,
|
|
82
|
+
params?: { [ name: string ]: any },
|
|
83
|
+
trace?: boolean
|
|
84
|
+
): AstNode[];
|
|
85
|
+
}
|
|
86
|
+
|
|
26
87
|
export default class JsonAsty {
|
|
27
88
|
/* parse JSON into AST */
|
|
28
|
-
static parse(json: string):
|
|
89
|
+
static parse(json: string): AstNode;
|
|
29
90
|
|
|
30
91
|
/* dump AST */
|
|
31
|
-
static dump(ast:
|
|
92
|
+
static dump(ast: AstNode, options?: { colors?: boolean }): string;
|
|
32
93
|
|
|
33
94
|
/* unparse AST into JSON */
|
|
34
|
-
static unparse(ast:
|
|
95
|
+
static unparse(ast: AstNode): string;
|
|
35
96
|
}
|
|
36
97
|
}
|
|
37
98
|
|
package/src/json-asty.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
package/src/json-asty.pegjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|
package/tst/json-asty.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
|
|
3
|
-
** Copyright (c) 2018-
|
|
3
|
+
** Copyright (c) 2018-2026 Dr. Ralf S. Engelschall <rse@engelschall.com>
|
|
4
4
|
**
|
|
5
5
|
** Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
** a copy of this software and associated documentation files (the
|