Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/ml-ast

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/ml-ast - npm Package Compare versions

Comparing version 4.0.0-alpha.9 to 4.0.0-alpha.10

199

lib/types.d.ts

@@ -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,53 +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;
potentialValue?: 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 & {

@@ -121,2 +131,3 @@ readonly offsetOffset?: number;

* @default "omittable"
* @deprecated
*/

@@ -133,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;
}
/**

@@ -151,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-alpha.9",
"version": "4.0.0-alpha.10",
"description": "The markuplint AST types.",

@@ -26,3 +26,3 @@ "repository": "git@github.com:markuplint/markuplint.git",

},
"gitHead": "c86b754700aaf61b561a64dbd0c87424e772f619"
"gitHead": "b41153ea665aa8f091daf6114a06047f4ccb8350"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc