@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 CHANGED
@@ -1 +1 @@
1
- export * from './types';
1
+ export * from './types.js';
package/lib/index.js CHANGED
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./types"), exports);
1
+ export * from './types.js';
package/lib/types.d.ts CHANGED
@@ -1,52 +1,43 @@
1
1
  export interface MLToken {
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;
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
- readonly type: MLASTNodeType;
25
- nodeName: string;
26
- parentNode: MLASTParentNode | null;
27
- prevNode: MLASTNode | null;
28
- nextNode: MLASTNode | null;
29
- isFragment: boolean;
30
- isGhost: boolean;
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
- readonly type: 'doctype';
34
- name: string;
35
- readonly publicId: string;
36
- readonly systemId: string;
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
- readonly type: 'starttag';
40
- namespace: string;
41
- elementType: ElementType;
42
- attributes: MLASTAttr[];
43
- hasSpreadAttr: boolean;
44
- childNodes?: MLASTNode[];
45
- pearNode: MLASTElementCloseTag | null;
46
- readonly selfClosingSolidus?: MLToken;
47
- readonly endSpace?: MLToken;
48
- readonly tagOpenChar: string;
49
- readonly tagCloseChar: string;
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
- readonly type: 'endtag';
61
- readonly namespace: string;
62
- attributes: MLASTAttr[];
63
- childNodes?: MLASTNode[];
64
- pearNode: MLASTTag | null;
65
- readonly tagOpenChar: string;
66
- readonly tagCloseChar: string;
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
- readonly type: 'psblock';
70
- nodeName: string;
71
- parentNode: MLASTParentNode | null;
72
- prevNode: MLASTNode | null;
73
- nextNode: MLASTNode | null;
74
- childNodes?: MLASTNode[];
75
- branchedChildNodes?: MLASTNode[];
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
- readonly type: 'comment';
71
+ readonly type: 'comment';
81
72
  }
82
73
  export interface MLASTText extends MLASTAbstractNode {
83
- readonly type: 'text';
74
+ readonly type: 'text';
84
75
  }
85
76
  export type MLASTAttr = MLASTHTMLAttr | MLASTPreprocessorSpecificAttr;
86
77
  export interface MLASTHTMLAttr extends MLASTAbstractNode {
87
- readonly type: 'html-attr';
88
- spacesBeforeName: MLToken;
89
- name: MLToken;
90
- spacesBeforeEqual: MLToken;
91
- equal: MLToken;
92
- spacesAfterEqual: MLToken;
93
- startQuote: MLToken;
94
- value: MLToken;
95
- endQuote: MLToken;
96
- isDynamicValue?: true;
97
- isDirective?: true;
98
- potentialName?: string;
99
- candidate?: string;
100
- isDuplicatable: boolean;
101
- parentNode: null;
102
- nextNode: null;
103
- prevNode: null;
104
- isFragment: false;
105
- isGhost: false;
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
- readonly type: 'ps-attr';
109
- readonly potentialName: string;
110
- readonly potentialValue: string;
111
- readonly valueType: 'string' | 'number' | 'boolean' | 'code';
112
- isDuplicatable: boolean;
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
- nodeList: MLASTNode[];
116
- readonly isFragment: boolean;
117
- unknownParseError?: string;
106
+ nodeList: MLASTNode[];
107
+ readonly isFragment: boolean;
108
+ unknownParseError?: string;
118
109
  }
119
110
  export interface MLMarkupLanguageParser {
120
- parse(
121
- sourceCode: string,
122
- options?: ParserOptions & {
123
- readonly offsetOffset?: number;
124
- readonly offsetLine?: number;
125
- readonly offsetColumn?: number;
126
- },
127
- ): MLASTDocument;
128
- /**
129
- * @default "omittable"
130
- */
131
- endTag?: EndTagType;
132
- /**
133
- * Detect value as a true if its attribute is booleanish value and omitted.
134
- *
135
- * Ex:
136
- * ```jsx
137
- * <Component aria-hidden />
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
- readonly ignoreFrontMatter?: boolean;
154
- readonly authoredElementName?: ParserAuthoredElementNameDistinguishing;
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
- "use strict";
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.177+e94f3601",
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
- "main": "lib/index.js",
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": "e94f3601bf93366d1a2c7385ff7235817d82f7c9"
26
+ "gitHead": "af6764422feecb56d1d84659028f53daf685bb78"
22
27
  }