@putout/engine-parser 15.1.1 → 15.2.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/lib/parser.d.ts +57 -0
- package/lib/parsers/babel/index.js +1 -0
- package/package.json +11 -8
package/lib/parser.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {Node, Program} from '@putout/babel';
|
|
2
|
+
import {
|
|
3
|
+
Format,
|
|
4
|
+
Semantics,
|
|
5
|
+
Visitors,
|
|
6
|
+
} from '@putout/printer';
|
|
7
|
+
|
|
8
|
+
export type PrinterFormat = Format;
|
|
9
|
+
|
|
10
|
+
export type PrinterSemantics = Semantics;
|
|
11
|
+
|
|
12
|
+
export type PrinterVisitors = Visitors;
|
|
13
|
+
|
|
14
|
+
export interface PrinterOptions {
|
|
15
|
+
format?: PrinterFormat;
|
|
16
|
+
semantics?: PrinterSemantics;
|
|
17
|
+
visitors?: PrinterVisitors;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// --- Parse ---
|
|
21
|
+
export interface ParseOptions {
|
|
22
|
+
parser?: 'babel' | 'acorn' | 'espree' | 'esprima' | 'tenko';
|
|
23
|
+
printer?: 'putout' | 'babel';
|
|
24
|
+
isTS?: boolean;
|
|
25
|
+
isJSX?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function parse(source: string, options?: ParseOptions): Program;
|
|
29
|
+
|
|
30
|
+
// --- Print ---
|
|
31
|
+
type PrinterName = 'putout' | 'babel';
|
|
32
|
+
type PrinterTuple = [
|
|
33
|
+
name: PrinterName,
|
|
34
|
+
options: Record<string, unknown>,
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
export interface PrintOptions {
|
|
38
|
+
printer?: PrinterName | PrinterTuple;
|
|
39
|
+
source?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function print(ast: Node, options?: PrintOptions): string;
|
|
43
|
+
|
|
44
|
+
export function generate(node: Node, options?: Record<string, unknown>, sourceMaps?: Record<string, unknown>): string;
|
|
45
|
+
|
|
46
|
+
export function template(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
|
|
47
|
+
|
|
48
|
+
export namespace template {
|
|
49
|
+
export function ast(source: string, options?: Record<string, unknown>): Node;
|
|
50
|
+
export function program(source: string, options?: Record<string, unknown>): (...args: unknown[]) => Node;
|
|
51
|
+
export function extractExpression(node: Node): Node;
|
|
52
|
+
|
|
53
|
+
export namespace ast {
|
|
54
|
+
export function fresh(source: string, options?: Record<string, unknown>): Node;
|
|
55
|
+
} export namespace program {
|
|
56
|
+
export function ast(source: string, options?: Record<string, unknown>): Node;
|
|
57
|
+
}}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-parser",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout parser",
|
|
7
7
|
"homepage": "https://github.com/coderaiser/putout/tree/master/packages/engine-parser#readme",
|
|
8
8
|
"main": "./lib/parser.js",
|
|
9
|
+
"types": "./lib/parser.d.ts",
|
|
9
10
|
"release": false,
|
|
10
11
|
"tag": false,
|
|
11
12
|
"changelog": false,
|
|
@@ -24,18 +25,20 @@
|
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"test": "madrun test",
|
|
28
|
+
"test:dts": "madrun test:dts",
|
|
27
29
|
"watch:test": "madrun watch:test",
|
|
28
30
|
"lint": "madrun lint",
|
|
29
31
|
"fresh:lint": "madrun fresh:lint",
|
|
30
32
|
"lint:fresh": "madrun lint:fresh",
|
|
31
33
|
"fix:lint": "madrun fix:lint",
|
|
32
34
|
"coverage": "madrun coverage",
|
|
33
|
-
"report": "madrun report"
|
|
35
|
+
"report": "madrun report",
|
|
36
|
+
"wisdom": "madrun wisdom"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
36
39
|
"@putout/babel": "^5.0.0",
|
|
37
|
-
"@putout/printer": "^17.0.0",
|
|
38
40
|
"@putout/operator-watermark": "^1.0.0",
|
|
41
|
+
"@putout/printer": "^18.0.0",
|
|
39
42
|
"align-spaces": "^3.0.0",
|
|
40
43
|
"estree-to-babel": "^12.0.0",
|
|
41
44
|
"nano-memoize": "^3.0.11",
|
|
@@ -49,21 +52,21 @@
|
|
|
49
52
|
"devDependencies": {
|
|
50
53
|
"@putout/eslint-flat": "^4.0.0",
|
|
51
54
|
"acorn": "^8.1.1",
|
|
55
|
+
"check-dts": "^1.0.0",
|
|
52
56
|
"acorn-stage3": "^4.0.0",
|
|
53
57
|
"acorn-typescript": "^1.4.13",
|
|
54
|
-
"c8": "^10.0.0",
|
|
55
58
|
"eslint": "^10.0.0",
|
|
56
|
-
"eslint-plugin-n": "^17.0.0",
|
|
57
59
|
"eslint-plugin-putout": "^31.0.0",
|
|
58
60
|
"espree": "^11.0.0",
|
|
59
61
|
"esprima": "^4.0.1",
|
|
60
|
-
"hermes-parser": "^0.
|
|
62
|
+
"hermes-parser": "^0.36.0",
|
|
61
63
|
"just-camel-case": "^6.2.0",
|
|
62
64
|
"madrun": "^13.0.0",
|
|
63
|
-
"montag": "^
|
|
65
|
+
"montag": "^2.0.0",
|
|
64
66
|
"nodemon": "^3.0.1",
|
|
65
67
|
"putout": "*",
|
|
66
|
-
"
|
|
68
|
+
"superc8": "^12.0.0",
|
|
69
|
+
"supertape": "^13.0.0",
|
|
67
70
|
"tenko": "^2.0.0"
|
|
68
71
|
},
|
|
69
72
|
"license": "MIT",
|