@markuplint/ml-ast 3.0.0 → 3.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/types.d.ts +29 -29
- package/package.json +2 -2
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface MLToken {
|
|
2
|
-
uuid: string;
|
|
2
|
+
readonly uuid: string;
|
|
3
3
|
raw: string;
|
|
4
4
|
startOffset: number;
|
|
5
5
|
endOffset: number;
|
|
@@ -12,7 +12,7 @@ export interface MLToken {
|
|
|
12
12
|
export type MLASTNodeType = 'doctype' | 'starttag' | 'endtag' | 'comment' | 'text' | 'omittedtag' | 'psblock' | 'html-attr' | 'ps-attr';
|
|
13
13
|
export type MLASTNode = MLASTDoctype | MLASTTag | MLASTComment | MLASTText | MLASTPreprocessorSpecificBlock | MLASTAttr;
|
|
14
14
|
export interface MLASTAbstractNode extends MLToken {
|
|
15
|
-
type: MLASTNodeType;
|
|
15
|
+
readonly type: MLASTNodeType;
|
|
16
16
|
nodeName: string;
|
|
17
17
|
parentNode: MLASTParentNode | null;
|
|
18
18
|
prevNode: MLASTNode | null;
|
|
@@ -21,23 +21,23 @@ export interface MLASTAbstractNode extends MLToken {
|
|
|
21
21
|
isGhost: boolean;
|
|
22
22
|
}
|
|
23
23
|
export interface MLASTDoctype extends MLASTAbstractNode {
|
|
24
|
-
type: 'doctype';
|
|
24
|
+
readonly type: 'doctype';
|
|
25
25
|
name: string;
|
|
26
|
-
publicId: string;
|
|
27
|
-
systemId: string;
|
|
26
|
+
readonly publicId: string;
|
|
27
|
+
readonly systemId: string;
|
|
28
28
|
}
|
|
29
29
|
export interface MLASTElement extends MLASTAbstractNode {
|
|
30
|
-
type: 'starttag';
|
|
30
|
+
readonly type: 'starttag';
|
|
31
31
|
namespace: string;
|
|
32
32
|
elementType: ElementType;
|
|
33
33
|
attributes: MLASTAttr[];
|
|
34
34
|
hasSpreadAttr: boolean;
|
|
35
35
|
childNodes?: MLASTNode[];
|
|
36
36
|
pearNode: MLASTElementCloseTag | null;
|
|
37
|
-
selfClosingSolidus?: MLToken;
|
|
38
|
-
endSpace?: MLToken;
|
|
39
|
-
tagOpenChar: string;
|
|
40
|
-
tagCloseChar: string;
|
|
37
|
+
readonly selfClosingSolidus?: MLToken;
|
|
38
|
+
readonly endSpace?: MLToken;
|
|
39
|
+
readonly tagOpenChar: string;
|
|
40
|
+
readonly tagCloseChar: string;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Element type
|
|
@@ -48,16 +48,16 @@ export interface MLASTElement extends MLASTAbstractNode {
|
|
|
48
48
|
*/
|
|
49
49
|
export type ElementType = 'html' | 'web-component' | 'authored';
|
|
50
50
|
export interface MLASTElementCloseTag extends MLASTAbstractNode {
|
|
51
|
-
type: 'endtag';
|
|
52
|
-
namespace: string;
|
|
51
|
+
readonly type: 'endtag';
|
|
52
|
+
readonly namespace: string;
|
|
53
53
|
attributes: MLASTAttr[];
|
|
54
54
|
childNodes?: MLASTNode[];
|
|
55
55
|
pearNode: MLASTTag | null;
|
|
56
|
-
tagOpenChar: string;
|
|
57
|
-
tagCloseChar: string;
|
|
56
|
+
readonly tagOpenChar: string;
|
|
57
|
+
readonly tagCloseChar: string;
|
|
58
58
|
}
|
|
59
59
|
export interface MLASTPreprocessorSpecificBlock extends MLASTAbstractNode {
|
|
60
|
-
type: 'psblock';
|
|
60
|
+
readonly type: 'psblock';
|
|
61
61
|
nodeName: string;
|
|
62
62
|
parentNode: MLASTParentNode | null;
|
|
63
63
|
prevNode: MLASTNode | null;
|
|
@@ -68,14 +68,14 @@ export interface MLASTPreprocessorSpecificBlock extends MLASTAbstractNode {
|
|
|
68
68
|
export type MLASTTag = MLASTElement | MLASTElementCloseTag;
|
|
69
69
|
export type MLASTParentNode = MLASTElement | MLASTPreprocessorSpecificBlock;
|
|
70
70
|
export interface MLASTComment extends MLASTAbstractNode {
|
|
71
|
-
type: 'comment';
|
|
71
|
+
readonly type: 'comment';
|
|
72
72
|
}
|
|
73
73
|
export interface MLASTText extends MLASTAbstractNode {
|
|
74
|
-
type: 'text';
|
|
74
|
+
readonly type: 'text';
|
|
75
75
|
}
|
|
76
76
|
export type MLASTAttr = MLASTHTMLAttr | MLASTPreprocessorSpecificAttr;
|
|
77
77
|
export interface MLASTHTMLAttr extends MLASTAbstractNode {
|
|
78
|
-
type: 'html-attr';
|
|
78
|
+
readonly type: 'html-attr';
|
|
79
79
|
spacesBeforeName: MLToken;
|
|
80
80
|
name: MLToken;
|
|
81
81
|
spacesBeforeEqual: MLToken;
|
|
@@ -96,22 +96,22 @@ export interface MLASTHTMLAttr extends MLASTAbstractNode {
|
|
|
96
96
|
isGhost: false;
|
|
97
97
|
}
|
|
98
98
|
export interface MLASTPreprocessorSpecificAttr extends MLASTAbstractNode {
|
|
99
|
-
type: 'ps-attr';
|
|
100
|
-
potentialName: string;
|
|
101
|
-
potentialValue: string;
|
|
102
|
-
valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
99
|
+
readonly type: 'ps-attr';
|
|
100
|
+
readonly potentialName: string;
|
|
101
|
+
readonly potentialValue: string;
|
|
102
|
+
readonly valueType: 'string' | 'number' | 'boolean' | 'code';
|
|
103
103
|
isDuplicatable: boolean;
|
|
104
104
|
}
|
|
105
105
|
export interface MLASTDocument {
|
|
106
106
|
nodeList: MLASTNode[];
|
|
107
|
-
isFragment: boolean;
|
|
107
|
+
readonly isFragment: boolean;
|
|
108
108
|
unknownParseError?: string;
|
|
109
109
|
}
|
|
110
110
|
export interface MLMarkupLanguageParser {
|
|
111
111
|
parse(sourceCode: string, options?: ParserOptions & {
|
|
112
|
-
offsetOffset?: number;
|
|
113
|
-
offsetLine?: number;
|
|
114
|
-
offsetColumn?: number;
|
|
112
|
+
readonly offsetOffset?: number;
|
|
113
|
+
readonly offsetLine?: number;
|
|
114
|
+
readonly offsetColumn?: number;
|
|
115
115
|
}): MLASTDocument;
|
|
116
116
|
/**
|
|
117
117
|
* @default "omittable"
|
|
@@ -138,10 +138,10 @@ export interface MLMarkupLanguageParser {
|
|
|
138
138
|
*/
|
|
139
139
|
export type EndTagType = 'xml' | 'omittable' | 'never';
|
|
140
140
|
export type ParserOptions = {
|
|
141
|
-
ignoreFrontMatter?: boolean;
|
|
142
|
-
authoredElementName?: ParserAuthoredElementNameDistinguishing;
|
|
141
|
+
readonly ignoreFrontMatter?: boolean;
|
|
142
|
+
readonly authoredElementName?: ParserAuthoredElementNameDistinguishing;
|
|
143
143
|
};
|
|
144
|
-
export type ParserAuthoredElementNameDistinguishing = string | RegExp | ParserAuthoredElementNameDistinguishingFunction | (string | RegExp | ParserAuthoredElementNameDistinguishingFunction)[];
|
|
144
|
+
export type ParserAuthoredElementNameDistinguishing = string | Readonly<RegExp> | Readonly<ParserAuthoredElementNameDistinguishingFunction> | readonly (string | Readonly<RegExp> | ParserAuthoredElementNameDistinguishingFunction)[];
|
|
145
145
|
export type ParserAuthoredElementNameDistinguishingFunction = (name: string) => boolean;
|
|
146
146
|
export type Parse = MLMarkupLanguageParser['parse'];
|
|
147
147
|
export type Walker = (node: MLASTNode, depth: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-ast",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "The markuplint AST types.",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"build": "tsc",
|
|
19
19
|
"clean": "tsc --build --clean"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "9547b8dca20736a93e4d01af2d61bee314ba5718"
|
|
22
22
|
}
|