@markuplint/ml-ast
Advanced tools
Comparing version 4.0.0-dev.28 to 4.0.0-rc.0
@@ -1,26 +0,35 @@ | ||
export interface MLToken { | ||
export type MLASTNodeType = 'doctype' | 'starttag' | 'endtag' | 'comment' | 'text' | 'omittedtag' | 'psblock' | 'invalid' | 'attr' | 'spread'; | ||
/** | ||
* Element type | ||
* | ||
* - `html`: From native HTML Standard | ||
* - `web-component`: As the Web Component according to HTML Standard | ||
* - `authored`: Authored element (JSX Element etc.) through the view framework or the template engine. | ||
*/ | ||
export type ElementType = 'html' | 'web-component' | 'authored'; | ||
export type MLASTNode = MLASTDoctype | MLASTTag | MLASTComment | MLASTText | MLASTPreprocessorSpecificBlock | MLASTInvalid | MLASTAttr; | ||
export type MLASTParentNode = MLASTElement | MLASTPreprocessorSpecificBlock; | ||
export type MLASTNodeTreeItem = MLASTChildNode | MLASTDoctype; | ||
export type MLASTChildNode = MLASTTag | MLASTText | MLASTComment | MLASTPreprocessorSpecificBlock | MLASTInvalid; | ||
export type MLASTTag = MLASTElement | MLASTElementCloseTag; | ||
export type MLASTAttr = MLASTHTMLAttr | MLASTSpreadAttr; | ||
export interface MLASTToken { | ||
readonly uuid: string; | ||
raw: string; | ||
startOffset: number; | ||
endOffset: number; | ||
startLine: number; | ||
endLine: number; | ||
startCol: number; | ||
endCol: number; | ||
[extendKey: `__${string}`]: string | number | boolean | null; | ||
readonly raw: string; | ||
readonly startOffset: number; | ||
readonly endOffset: number; | ||
readonly startLine: number; | ||
readonly endLine: number; | ||
readonly startCol: number; | ||
readonly endCol: number; | ||
} | ||
export type MLASTNodeType = 'doctype' | 'starttag' | 'endtag' | 'comment' | 'text' | 'omittedtag' | 'psblock' | 'html-attr' | 'ps-attr'; | ||
export type MLASTNode = MLASTDoctype | MLASTTag | MLASTComment | MLASTText | MLASTPreprocessorSpecificBlock | MLASTAttr; | ||
export interface MLASTAbstractNode extends MLToken { | ||
interface MLASTAbstractNode extends MLASTToken { | ||
readonly type: MLASTNodeType; | ||
nodeName: string; | ||
parentNode: MLASTParentNode | null; | ||
prevNode: MLASTNode | null; | ||
nextNode: MLASTNode | null; | ||
isFragment: boolean; | ||
isGhost: boolean; | ||
readonly nodeName: string; | ||
readonly parentNode: MLASTParentNode | null; | ||
} | ||
export interface MLASTDoctype extends MLASTAbstractNode { | ||
readonly type: 'doctype'; | ||
name: string; | ||
readonly depth: number; | ||
readonly name: string; | ||
readonly publicId: string; | ||
@@ -31,27 +40,19 @@ readonly systemId: string; | ||
readonly type: 'starttag'; | ||
namespace: string; | ||
elementType: ElementType; | ||
attributes: MLASTAttr[]; | ||
hasSpreadAttr: boolean; | ||
childNodes?: MLASTNode[]; | ||
pearNode: MLASTElementCloseTag | null; | ||
readonly selfClosingSolidus?: MLToken; | ||
readonly endSpace?: MLToken; | ||
readonly depth: number; | ||
readonly namespace: string; | ||
readonly elementType: ElementType; | ||
readonly attributes: readonly MLASTAttr[]; | ||
readonly hasSpreadAttr?: boolean; | ||
readonly childNodes: readonly MLASTChildNode[]; | ||
readonly pairNode: MLASTElementCloseTag | null; | ||
readonly selfClosingSolidus?: MLASTToken; | ||
readonly tagOpenChar: string; | ||
readonly tagCloseChar: string; | ||
readonly isGhost: boolean; | ||
} | ||
/** | ||
* Element type | ||
* | ||
* - `html`: From native HTML Standard | ||
* - `web-component`: As the Web Component according to HTML Standard | ||
* - `authored`: Authored element (JSX Element etc.) through the view framework or the template engine. | ||
*/ | ||
export type ElementType = 'html' | 'web-component' | 'authored'; | ||
export interface MLASTElementCloseTag extends MLASTAbstractNode { | ||
readonly type: 'endtag'; | ||
readonly namespace: string; | ||
attributes: MLASTAttr[]; | ||
childNodes?: MLASTNode[]; | ||
pearNode: MLASTTag | null; | ||
readonly depth: number; | ||
readonly parentNode: null; | ||
readonly pairNode: MLASTElement; | ||
readonly tagOpenChar: string; | ||
@@ -62,52 +63,62 @@ readonly tagCloseChar: string; | ||
readonly type: 'psblock'; | ||
nodeName: string; | ||
parentNode: MLASTParentNode | null; | ||
prevNode: MLASTNode | null; | ||
nextNode: MLASTNode | null; | ||
childNodes?: MLASTNode[]; | ||
branchedChildNodes?: MLASTNode[]; | ||
readonly depth: number; | ||
readonly nodeName: string; | ||
readonly childNodes: readonly MLASTChildNode[]; | ||
readonly branchedChildNodes?: readonly MLASTNode[]; | ||
readonly isBogus: boolean; | ||
} | ||
export type MLASTTag = MLASTElement | MLASTElementCloseTag; | ||
export type MLASTParentNode = MLASTElement | MLASTPreprocessorSpecificBlock; | ||
export interface MLASTComment extends MLASTAbstractNode { | ||
readonly type: 'comment'; | ||
readonly nodeName: '#comment'; | ||
readonly depth: number; | ||
readonly isBogus: boolean; | ||
} | ||
export interface MLASTText extends MLASTAbstractNode { | ||
readonly type: 'text'; | ||
readonly nodeName: '#text'; | ||
readonly depth: number; | ||
} | ||
export type MLASTAttr = MLASTHTMLAttr | MLASTPreprocessorSpecificAttr; | ||
export interface MLASTHTMLAttr extends MLASTAbstractNode { | ||
readonly type: 'html-attr'; | ||
spacesBeforeName: MLToken; | ||
name: MLToken; | ||
spacesBeforeEqual: MLToken; | ||
equal: MLToken; | ||
spacesAfterEqual: MLToken; | ||
startQuote: MLToken; | ||
value: MLToken; | ||
endQuote: MLToken; | ||
isDynamicValue?: true; | ||
isDirective?: true; | ||
potentialName?: string; | ||
candidate?: string; | ||
isDuplicatable: boolean; | ||
parentNode: null; | ||
nextNode: null; | ||
prevNode: null; | ||
isFragment: false; | ||
isGhost: false; | ||
export interface MLASTInvalid extends MLASTAbstractNode { | ||
readonly type: 'invalid'; | ||
readonly nodeName: '#invalid'; | ||
readonly depth: number; | ||
readonly kind?: Exclude<MLASTChildNode['type'], 'invalid'>; | ||
readonly isBogus: true; | ||
} | ||
export interface MLASTPreprocessorSpecificAttr extends MLASTAbstractNode { | ||
readonly type: 'ps-attr'; | ||
readonly potentialName: string; | ||
readonly potentialValue: string; | ||
readonly valueType: 'string' | 'number' | 'boolean' | 'code'; | ||
isDuplicatable: boolean; | ||
export interface MLASTHTMLAttr extends MLASTToken { | ||
readonly type: 'attr'; | ||
readonly nodeName: string; | ||
readonly spacesBeforeName: MLASTToken; | ||
readonly name: MLASTToken; | ||
readonly spacesBeforeEqual: MLASTToken; | ||
readonly equal: MLASTToken; | ||
readonly spacesAfterEqual: MLASTToken; | ||
readonly startQuote: MLASTToken; | ||
readonly value: MLASTToken; | ||
readonly endQuote: MLASTToken; | ||
readonly isDynamicValue?: true; | ||
readonly isDirective?: true; | ||
readonly potentialName?: string; | ||
readonly potentialValue?: string; | ||
readonly valueType?: 'string' | 'number' | 'boolean' | 'code'; | ||
readonly candidate?: string; | ||
readonly isDuplicatable: boolean; | ||
} | ||
export interface MLASTSpreadAttr extends MLASTToken { | ||
readonly type: 'spread'; | ||
readonly nodeName: '#spread'; | ||
} | ||
export interface MLASTDocument { | ||
nodeList: MLASTNode[]; | ||
readonly raw: string; | ||
readonly nodeList: readonly MLASTNodeTreeItem[]; | ||
readonly isFragment: boolean; | ||
unknownParseError?: string; | ||
readonly unknownParseError?: string; | ||
} | ||
/** | ||
* @deprecated Use `MLParser` instead. This will be dropped in v5. | ||
*/ | ||
export interface MLMarkupLanguageParser { | ||
/** | ||
* @deprecated | ||
*/ | ||
parse(sourceCode: string, options?: ParserOptions & { | ||
@@ -120,2 +131,3 @@ readonly offsetOffset?: number; | ||
* @default "omittable" | ||
* @deprecated | ||
*/ | ||
@@ -132,5 +144,33 @@ endTag?: EndTagType; | ||
* In the above, the `aria-hidden` is `true`. | ||
* | ||
* @deprecated | ||
*/ | ||
booleanish?: boolean; | ||
} | ||
export interface MLParser { | ||
parse(sourceCode: string, options?: ParserOptions & { | ||
readonly offsetOffset?: number; | ||
readonly offsetLine?: number; | ||
readonly offsetColumn?: number; | ||
}): MLASTDocument; | ||
/** | ||
* @default "omittable" | ||
*/ | ||
endTag?: EndTagType; | ||
/** | ||
* Detect value as a true if its attribute is booleanish value and omitted. | ||
* | ||
* Ex: | ||
* ```jsx | ||
* <Component aria-hidden /> | ||
* ``` | ||
* | ||
* In the above, the `aria-hidden` is `true`. | ||
*/ | ||
booleanish?: boolean; | ||
tagNameCaseSensitive?: boolean; | ||
} | ||
export interface MLParserModule { | ||
readonly parser: MLParser; | ||
} | ||
/** | ||
@@ -150,5 +190,9 @@ * The end tag omittable type. | ||
export type ParserAuthoredElementNameDistinguishingFunction = (name: string) => boolean; | ||
/** | ||
* @deprecated | ||
*/ | ||
export type Parse = MLMarkupLanguageParser['parse']; | ||
export type Walker = (node: MLASTNode, depth: number) => void; | ||
export type Walker<Node extends MLASTNodeTreeItem> = (node: Node, sequentailPrevNode: MLASTNodeTreeItem | null, depth: number) => void; | ||
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'; | ||
export type Namespace = 'html' | 'svg' | 'mml' | 'xlink'; | ||
export {}; |
{ | ||
"name": "@markuplint/ml-ast", | ||
"version": "4.0.0-dev.28+0131de5e", | ||
"version": "4.0.0-rc.0", | ||
"description": "The markuplint AST types.", | ||
@@ -26,3 +26,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
}, | ||
"gitHead": "0131de5ea9dd6d3fd5472d7b414b66644c758881" | ||
"gitHead": "3fdeb45cb69ed52b3a215a7520cea1181601443f" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
8894
196