json-asty 1.2.7 → 1.3.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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-asty",
3
- "version": "1.2.7",
3
+ "version": "1.3.1",
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.1",
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,12 +46,15 @@
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.29.0",
50
- "@babel/preset-env": "7.29.2",
51
- "@babel/plugin-transform-runtime": "7.29.0",
52
- "mocha": "11.7.5",
49
+ "@babel/core": "7.29.7",
50
+ "@babel/preset-env": "7.29.7",
51
+ "@babel/plugin-transform-runtime": "7.29.7",
52
+ "mocha": "11.7.6",
53
53
  "chai": "6.2.2"
54
54
  },
55
+ "allowScripts": {
56
+ "es5-ext": true
57
+ },
55
58
  "upd": [ "!chalk", "!eslint", "!grunt-eslint" ],
56
59
  "scripts": {
57
60
  "prepublishOnly": "grunt default",
@@ -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): object;
89
+ static parse(json: string): AstNode;
29
90
 
30
91
  /* dump AST */
31
- static dump(ast: object, options?: { colors?: boolean }): string;
92
+ static dump(ast: AstNode, options?: { colors?: boolean }): string;
32
93
 
33
94
  /* unparse AST into JSON */
34
- static unparse(ast: object): string;
95
+ static unparse(ast: AstNode): string;
35
96
  }
36
97
  }
37
98