@markuplint/ml-ast 3.0.0-dev.177 → 3.0.0-dev.290
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/index.d.ts +1 -1
- package/lib/index.js +1 -4
- package/lib/types.d.ts +99 -119
- package/lib/types.js +1 -2
- package/package.json +8 -3
package/lib/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './types';
|
|
1
|
+
export * from './types.js';
|
package/lib/index.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -1,52 +1,43 @@
|
|
|
1
1
|
export interface MLToken {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
readonly uuid: string;
|
|
3
|
+
raw: string;
|
|
4
|
+
startOffset: number;
|
|
5
|
+
endOffset: number;
|
|
6
|
+
startLine: number;
|
|
7
|
+
endLine: number;
|
|
8
|
+
startCol: number;
|
|
9
|
+
endCol: number;
|
|
10
|
+
[extendKey: `__${string}`]: string | number | boolean | null;
|
|
11
11
|
}
|
|
12
|
-
export type MLASTNodeType =
|
|
13
|
-
| 'doctype'
|
|
14
|
-
| 'starttag'
|
|
15
|
-
| 'endtag'
|
|
16
|
-
| 'comment'
|
|
17
|
-
| 'text'
|
|
18
|
-
| 'omittedtag'
|
|
19
|
-
| 'psblock'
|
|
20
|
-
| 'html-attr'
|
|
21
|
-
| 'ps-attr';
|
|
12
|
+
export type MLASTNodeType = 'doctype' | 'starttag' | 'endtag' | 'comment' | 'text' | 'omittedtag' | 'psblock' | 'html-attr' | 'ps-attr';
|
|
22
13
|
export type MLASTNode = MLASTDoctype | MLASTTag | MLASTComment | MLASTText | MLASTPreprocessorSpecificBlock | MLASTAttr;
|
|
23
14
|
export interface MLASTAbstractNode extends MLToken {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
readonly type: MLASTNodeType;
|
|
16
|
+
nodeName: string;
|
|
17
|
+
parentNode: MLASTParentNode | null;
|
|
18
|
+
prevNode: MLASTNode | null;
|
|
19
|
+
nextNode: MLASTNode | null;
|
|
20
|
+
isFragment: boolean;
|
|
21
|
+
isGhost: boolean;
|
|
31
22
|
}
|
|
32
23
|
export interface MLASTDoctype extends MLASTAbstractNode {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
readonly type: 'doctype';
|
|
25
|
+
name: string;
|
|
26
|
+
readonly publicId: string;
|
|
27
|
+
readonly systemId: string;
|
|
37
28
|
}
|
|
38
29
|
export interface MLASTElement extends MLASTAbstractNode {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
readonly type: 'starttag';
|
|
31
|
+
namespace: string;
|
|
32
|
+
elementType: ElementType;
|
|
33
|
+
attributes: MLASTAttr[];
|
|
34
|
+
hasSpreadAttr: boolean;
|
|
35
|
+
childNodes?: MLASTNode[];
|
|
36
|
+
pearNode: MLASTElementCloseTag | null;
|
|
37
|
+
readonly selfClosingSolidus?: MLToken;
|
|
38
|
+
readonly endSpace?: MLToken;
|
|
39
|
+
readonly tagOpenChar: string;
|
|
40
|
+
readonly tagCloseChar: string;
|
|
50
41
|
}
|
|
51
42
|
/**
|
|
52
43
|
* Element type
|
|
@@ -57,89 +48,86 @@ export interface MLASTElement extends MLASTAbstractNode {
|
|
|
57
48
|
*/
|
|
58
49
|
export type ElementType = 'html' | 'web-component' | 'authored';
|
|
59
50
|
export interface MLASTElementCloseTag extends MLASTAbstractNode {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
readonly type: 'endtag';
|
|
52
|
+
readonly namespace: string;
|
|
53
|
+
attributes: MLASTAttr[];
|
|
54
|
+
childNodes?: MLASTNode[];
|
|
55
|
+
pearNode: MLASTTag | null;
|
|
56
|
+
readonly tagOpenChar: string;
|
|
57
|
+
readonly tagCloseChar: string;
|
|
67
58
|
}
|
|
68
59
|
export interface MLASTPreprocessorSpecificBlock extends MLASTAbstractNode {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
readonly type: 'psblock';
|
|
61
|
+
nodeName: string;
|
|
62
|
+
parentNode: MLASTParentNode | null;
|
|
63
|
+
prevNode: MLASTNode | null;
|
|
64
|
+
nextNode: MLASTNode | null;
|
|
65
|
+
childNodes?: MLASTNode[];
|
|
66
|
+
branchedChildNodes?: MLASTNode[];
|
|
76
67
|
}
|
|
77
68
|
export type MLASTTag = MLASTElement | MLASTElementCloseTag;
|
|
78
69
|
export type MLASTParentNode = MLASTElement | MLASTPreprocessorSpecificBlock;
|
|
79
70
|
export interface MLASTComment extends MLASTAbstractNode {
|
|
80
|
-
|
|
71
|
+
readonly type: 'comment';
|
|
81
72
|
}
|
|
82
73
|
export interface MLASTText extends MLASTAbstractNode {
|
|
83
|
-
|
|
74
|
+
readonly type: 'text';
|
|
84
75
|
}
|
|
85
76
|
export type MLASTAttr = MLASTHTMLAttr | MLASTPreprocessorSpecificAttr;
|
|
86
77
|
export interface MLASTHTMLAttr extends MLASTAbstractNode {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
78
|
+
readonly type: 'html-attr';
|
|
79
|
+
spacesBeforeName: MLToken;
|
|
80
|
+
name: MLToken;
|
|
81
|
+
spacesBeforeEqual: MLToken;
|
|
82
|
+
equal: MLToken;
|
|
83
|
+
spacesAfterEqual: MLToken;
|
|
84
|
+
startQuote: MLToken;
|
|
85
|
+
value: MLToken;
|
|
86
|
+
endQuote: MLToken;
|
|
87
|
+
isDynamicValue?: true;
|
|
88
|
+
isDirective?: true;
|
|
89
|
+
potentialName?: string;
|
|
90
|
+
candidate?: string;
|
|
91
|
+
isDuplicatable: boolean;
|
|
92
|
+
parentNode: null;
|
|
93
|
+
nextNode: null;
|
|
94
|
+
prevNode: null;
|
|
95
|
+
isFragment: false;
|
|
96
|
+
isGhost: false;
|
|
106
97
|
}
|
|
107
98
|
export interface MLASTPreprocessorSpecificAttr extends MLASTAbstractNode {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
99
|
+
readonly type: 'ps-attr';
|
|
100
|
+
readonly potentialName: string;
|
|
101
|
+
readonly potentialValue: string;
|
|
102
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
103
|
+
isDuplicatable: boolean;
|
|
113
104
|
}
|
|
114
105
|
export interface MLASTDocument {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
106
|
+
nodeList: MLASTNode[];
|
|
107
|
+
readonly isFragment: boolean;
|
|
108
|
+
unknownParseError?: string;
|
|
118
109
|
}
|
|
119
110
|
export interface MLMarkupLanguageParser {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
* In the above, the `aria-hidden` is `true`.
|
|
141
|
-
*/
|
|
142
|
-
booleanish?: boolean;
|
|
111
|
+
parse(sourceCode: string, options?: ParserOptions & {
|
|
112
|
+
readonly offsetOffset?: number;
|
|
113
|
+
readonly offsetLine?: number;
|
|
114
|
+
readonly offsetColumn?: number;
|
|
115
|
+
}): MLASTDocument;
|
|
116
|
+
/**
|
|
117
|
+
* @default "omittable"
|
|
118
|
+
*/
|
|
119
|
+
endTag?: EndTagType;
|
|
120
|
+
/**
|
|
121
|
+
* Detect value as a true if its attribute is booleanish value and omitted.
|
|
122
|
+
*
|
|
123
|
+
* Ex:
|
|
124
|
+
* ```jsx
|
|
125
|
+
* <Component aria-hidden />
|
|
126
|
+
* ```
|
|
127
|
+
*
|
|
128
|
+
* In the above, the `aria-hidden` is `true`.
|
|
129
|
+
*/
|
|
130
|
+
booleanish?: boolean;
|
|
143
131
|
}
|
|
144
132
|
/**
|
|
145
133
|
* The end tag omittable type.
|
|
@@ -150,20 +138,12 @@ export interface MLMarkupLanguageParser {
|
|
|
150
138
|
*/
|
|
151
139
|
export type EndTagType = 'xml' | 'omittable' | 'never';
|
|
152
140
|
export type ParserOptions = {
|
|
153
|
-
|
|
154
|
-
|
|
141
|
+
readonly ignoreFrontMatter?: boolean;
|
|
142
|
+
readonly authoredElementName?: ParserAuthoredElementNameDistinguishing;
|
|
155
143
|
};
|
|
156
|
-
export type ParserAuthoredElementNameDistinguishing =
|
|
157
|
-
| string
|
|
158
|
-
| Readonly<RegExp>
|
|
159
|
-
| Readonly<ParserAuthoredElementNameDistinguishingFunction>
|
|
160
|
-
| readonly (string | Readonly<RegExp> | ParserAuthoredElementNameDistinguishingFunction)[];
|
|
144
|
+
export type ParserAuthoredElementNameDistinguishing = string | Readonly<RegExp> | Readonly<ParserAuthoredElementNameDistinguishingFunction> | readonly (string | Readonly<RegExp> | ParserAuthoredElementNameDistinguishingFunction)[];
|
|
161
145
|
export type ParserAuthoredElementNameDistinguishingFunction = (name: string) => boolean;
|
|
162
146
|
export type Parse = MLMarkupLanguageParser['parse'];
|
|
163
147
|
export type Walker = (node: MLASTNode, depth: number) => void;
|
|
164
|
-
export type NamespaceURI =
|
|
165
|
-
| 'http://www.w3.org/1999/xhtml'
|
|
166
|
-
| 'http://www.w3.org/2000/svg'
|
|
167
|
-
| 'http://www.w3.org/1998/Math/MathML'
|
|
168
|
-
| 'http://www.w3.org/1999/xlink';
|
|
148
|
+
export type NamespaceURI = 'http://www.w3.org/1999/xhtml' | 'http://www.w3.org/2000/svg' | 'http://www.w3.org/1998/Math/MathML' | 'http://www.w3.org/1999/xlink';
|
|
169
149
|
export type Namespace = 'html' | 'svg' | 'mml' | 'xlink';
|
package/lib/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-ast",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.290+af676442",
|
|
4
4
|
"description": "The markuplint AST types.",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"private": false,
|
|
9
|
-
"
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./lib/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
10
15
|
"types": "lib/index.d.ts",
|
|
11
16
|
"publishConfig": {
|
|
12
17
|
"access": "public"
|
|
@@ -18,5 +23,5 @@
|
|
|
18
23
|
"build": "tsc",
|
|
19
24
|
"clean": "tsc --build --clean"
|
|
20
25
|
},
|
|
21
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "af6764422feecb56d1d84659028f53daf685bb78"
|
|
22
27
|
}
|