esrap 2.2.3 → 2.2.5
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/package.json +12 -2
- package/src/languages/ts/public.d.ts +7 -2
- package/src/languages/tsx/index.js +0 -2
- package/src/languages/tsx/public.d.ts +5 -2
- package/src/languages/types.d.ts +1 -2
- package/src/public.d.ts +1 -1
- package/src/types.d.ts +1 -15
- package/types/index.d.ts +31 -32
- package/types/index.d.ts.map +7 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esrap",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "Parse in reverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@changesets/cli": "^2.27.11",
|
|
31
31
|
"@sveltejs/acorn-typescript": "^1.0.5",
|
|
32
|
+
"@types/estree": "^1.0.8",
|
|
32
33
|
"@typescript-eslint/types": "^8.2.0",
|
|
33
34
|
"@vitest/ui": "^2.1.1",
|
|
34
35
|
"acorn": "^8.15.0",
|
|
@@ -43,13 +44,22 @@
|
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"@jridgewell/sourcemap-codec": "^1.4.15"
|
|
45
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@typescript-eslint/types": "^8.2.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"@typescript-eslint/types": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
46
55
|
"publishConfig": {
|
|
47
56
|
"access": "public"
|
|
48
57
|
},
|
|
49
58
|
"scripts": {
|
|
50
59
|
"changeset:version": "changeset version",
|
|
51
60
|
"changeset:publish": "changeset publish",
|
|
52
|
-
"
|
|
61
|
+
"gen": "dts-buddy -m esrap:./src/public.d.ts -m esrap/languages/ts:./src/languages/ts/public.d.ts -m esrap/languages/tsx:./src/languages/tsx/public.d.ts",
|
|
62
|
+
"check": "pnpm gen && tsc",
|
|
53
63
|
"sandbox": "node test/sandbox/index.js",
|
|
54
64
|
"test": "vitest --run",
|
|
55
65
|
"test:ui": "vitest --ui",
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Visitors, BaseNode } from '../../types';
|
|
2
|
+
import type { TSOptions, BaseComment, Comment } from '../types';
|
|
3
|
+
export type { BaseComment, Comment };
|
|
4
|
+
export type Node = BaseNode;
|
|
5
|
+
export default function ts(options?: TSOptions): Visitors<BaseNode>;
|
|
6
|
+
// was Record<TSESTree.Expression['type'] | 'Super' | 'RestElement', number>
|
|
7
|
+
export declare const EXPRESSIONS_PRECEDENCE: Record<string, number>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { Visitors, BaseNode } from '../../types';
|
|
2
|
+
import type { TSOptions, BaseComment, Comment } from '../types';
|
|
3
|
+
export type { BaseComment, Comment };
|
|
4
|
+
export type Node = BaseNode;
|
|
5
|
+
export default function tsx(options?: TSOptions): Visitors<BaseNode>;
|
package/src/languages/types.d.ts
CHANGED
package/src/public.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PrintOptions, Visitors } from './types';
|
|
1
|
+
export type { PrintOptions, Visitors } from './types';
|
|
2
2
|
export * from './index';
|
package/src/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Context } from 'esrap';
|
|
1
|
+
import type { Context } from 'esrap';
|
|
3
2
|
|
|
4
3
|
export type BaseNode = {
|
|
5
4
|
type: string;
|
|
@@ -23,19 +22,6 @@ export type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_'
|
|
|
23
22
|
|
|
24
23
|
export { Context };
|
|
25
24
|
|
|
26
|
-
export type TypeAnnotationNodes =
|
|
27
|
-
| TSESTree.TypeNode
|
|
28
|
-
| TSESTree.TypeElement
|
|
29
|
-
| TSESTree.TSTypeAnnotation
|
|
30
|
-
| TSESTree.TSPropertySignature
|
|
31
|
-
| TSESTree.TSTypeParameter
|
|
32
|
-
| TSESTree.TSTypeParameterDeclaration
|
|
33
|
-
| TSESTree.TSTypeParameterInstantiation
|
|
34
|
-
| TSESTree.TSEnumMember
|
|
35
|
-
| TSESTree.TSInterfaceHeritage
|
|
36
|
-
| TSESTree.TSClassImplements
|
|
37
|
-
| TSExpressionWithTypeArguments;
|
|
38
|
-
|
|
39
25
|
type TSExpressionWithTypeArguments = {
|
|
40
26
|
type: 'TSExpressionWithTypeArguments';
|
|
41
27
|
expression: any;
|
package/types/index.d.ts
CHANGED
|
@@ -69,11 +69,30 @@ declare module 'esrap' {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
declare module 'esrap/languages/ts' {
|
|
72
|
-
import type { TSESTree } from '@typescript-eslint/types';
|
|
73
72
|
import type { Context } from 'esrap';
|
|
74
|
-
export
|
|
75
|
-
export default function
|
|
76
|
-
|
|
73
|
+
export type Node = BaseNode;
|
|
74
|
+
export default function ts(options?: TSOptions): Visitors<BaseNode>;
|
|
75
|
+
// was Record<TSESTree.Expression['type'] | 'Super' | 'RestElement', number>
|
|
76
|
+
export const EXPRESSIONS_PRECEDENCE: Record<string, number>;
|
|
77
|
+
type BaseNode = {
|
|
78
|
+
type: string;
|
|
79
|
+
loc?: null | {
|
|
80
|
+
start: { line: number; column: number };
|
|
81
|
+
end: { line: number; column: number };
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type NodeOf<T extends string, X> = X extends { type: T } ? X : never;
|
|
86
|
+
|
|
87
|
+
type SpecialisedVisitors<T extends BaseNode> = {
|
|
88
|
+
[K in T['type']]?: Visitor<NodeOf<K, T>>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type Visitor<T> = (node: T, context: Context) => void;
|
|
92
|
+
|
|
93
|
+
type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_'
|
|
94
|
+
? never
|
|
95
|
+
: SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void };
|
|
77
96
|
type TSOptions = {
|
|
78
97
|
quotes?: 'double' | 'single';
|
|
79
98
|
comments?: Comment[];
|
|
@@ -101,6 +120,14 @@ declare module 'esrap/languages/ts' {
|
|
|
101
120
|
end: Position;
|
|
102
121
|
};
|
|
103
122
|
}
|
|
123
|
+
|
|
124
|
+
export {};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare module 'esrap/languages/tsx' {
|
|
128
|
+
import type { Context } from 'esrap';
|
|
129
|
+
export type Node = BaseNode;
|
|
130
|
+
export default function tsx(options?: TSOptions): Visitors<BaseNode>;
|
|
104
131
|
type BaseNode = {
|
|
105
132
|
type: string;
|
|
106
133
|
loc?: null | {
|
|
@@ -120,15 +147,6 @@ declare module 'esrap/languages/ts' {
|
|
|
120
147
|
type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_'
|
|
121
148
|
? never
|
|
122
149
|
: SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void };
|
|
123
|
-
|
|
124
|
-
export {};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
declare module 'esrap/languages/tsx' {
|
|
128
|
-
import type { TSESTree } from '@typescript-eslint/types';
|
|
129
|
-
import type { Context } from 'esrap';
|
|
130
|
-
export default function _default(options?: TSOptions): Visitors<TSESTree.Node>;
|
|
131
|
-
export type Node = TSESTree.Node;
|
|
132
150
|
type TSOptions = {
|
|
133
151
|
quotes?: 'double' | 'single';
|
|
134
152
|
comments?: Comment[];
|
|
@@ -156,25 +174,6 @@ declare module 'esrap/languages/tsx' {
|
|
|
156
174
|
end: Position;
|
|
157
175
|
};
|
|
158
176
|
}
|
|
159
|
-
type BaseNode = {
|
|
160
|
-
type: string;
|
|
161
|
-
loc?: null | {
|
|
162
|
-
start: { line: number; column: number };
|
|
163
|
-
end: { line: number; column: number };
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
type NodeOf<T extends string, X> = X extends { type: T } ? X : never;
|
|
168
|
-
|
|
169
|
-
type SpecialisedVisitors<T extends BaseNode> = {
|
|
170
|
-
[K in T['type']]?: Visitor<NodeOf<K, T>>;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
type Visitor<T> = (node: T, context: Context) => void;
|
|
174
|
-
|
|
175
|
-
type Visitors<T extends BaseNode = BaseNode> = T['type'] extends '_'
|
|
176
|
-
? never
|
|
177
|
-
: SpecialisedVisitors<T> & { _?: (node: T, context: Context, visit: (node: T) => void) => void };
|
|
178
177
|
|
|
179
178
|
export {};
|
|
180
179
|
}
|
package/types/index.d.ts.map
CHANGED
|
@@ -12,20 +12,22 @@
|
|
|
12
12
|
"PrintOptions",
|
|
13
13
|
"print",
|
|
14
14
|
"Context",
|
|
15
|
-
"EXPRESSIONS_PRECEDENCE",
|
|
16
15
|
"Node",
|
|
16
|
+
"ts",
|
|
17
|
+
"EXPRESSIONS_PRECEDENCE",
|
|
17
18
|
"TSOptions",
|
|
18
19
|
"Position",
|
|
19
20
|
"BaseComment",
|
|
20
|
-
"Comment"
|
|
21
|
+
"Comment",
|
|
22
|
+
"tsx"
|
|
21
23
|
],
|
|
22
24
|
"sources": [
|
|
23
25
|
"../src/types.d.ts",
|
|
24
26
|
"../src/index.js",
|
|
25
27
|
"../src/context.js",
|
|
26
|
-
"../src/languages/ts/
|
|
28
|
+
"../src/languages/ts/public.d.ts",
|
|
27
29
|
"../src/languages/types.d.ts",
|
|
28
|
-
"../src/languages/tsx/
|
|
30
|
+
"../src/languages/tsx/public.d.ts"
|
|
29
31
|
],
|
|
30
32
|
"sourcesContent": [
|
|
31
33
|
null,
|
|
@@ -35,6 +37,6 @@
|
|
|
35
37
|
null,
|
|
36
38
|
null
|
|
37
39
|
],
|
|
38
|
-
"mappings": ";
|
|
40
|
+
"mappings": ";MAEYA,QAAQA;;;;;;;;MAQfC,MAAMA;;MAENC,mBAAmBA;;;;MAIZC,OAAOA;;aAEPC,QAAQA;;;;WAWHC,QAAQA;;;;;;MAWbC,OAAOA;;kBAEFC,YAAYA;;;;;;;;;iBCWbC,KAAKA;;;;cC7CRC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aCLRC,IAAIA;yBACQC,EAAEA;;cAELC,sBAAsBA;MHJ/BZ,QAAQA;;;;;;;;MAQfC,MAAMA;;MAENC,mBAAmBA;;;;MAIZC,OAAOA;;MAEPC,QAAQA;;;MIhBRS,SAASA;;;;;;;WAOXC,QAAQA;;;;;;;kBAODC,WAAWA;;;;;;;kBAOXC,OAAOA;;;;;;;;;;;;aCpBZN,IAAIA;yBACQO,GAAGA;MLFfjB,QAAQA;;;;;;;;MAQfC,MAAMA;;MAENC,mBAAmBA;;;;MAIZC,OAAOA;;MAEPC,QAAQA;;;MIhBRS,SAASA;;;;;;;WAOXC,QAAQA;;;;;;;kBAODC,WAAWA;;;;;;;kBAOXC,OAAOA",
|
|
39
41
|
"ignoreList": []
|
|
40
42
|
}
|